ACP v2 TypeScript SDK — EXPERIMENTAL DRAFT - v1.3.0
    Preparing search index...

    Class ActiveSessionExperimental

    Experimental draft ACP v2 convenience wrapper for an active session.

    An active session routes session/update notifications for one session ID into an async queue. Use prompt(...) to send user content, then read updates with nextUpdate() until a stop message is returned.

    Index
    • get sessionId(): string
      Experimental

      Session ID returned by session/new.

      Returns string

    • get configOptions(): SessionConfigOption[] | undefined
      Experimental

      Configuration options returned when the session was created, if provided.

      Returns SessionConfigOption[] | undefined

    • get meta(): { [key: string]: unknown } | null | undefined
      Experimental

      Metadata returned when the session was created.

      Returns { [key: string]: unknown } | null | undefined

    • Experimental

      Sends a prompt to this session.

      Strings are converted to one text content block. A single content block is wrapped in an array. The returned promise resolves when the agent accepts the prompt. Completion is reported separately by an idle state_update, which is queued as a stop message for nextUpdate().

      Parameters

      Returns Promise<PromptResponse>

    • Experimental

      Reads agent text until the current prompt turn stops.

      Updates queued before the most recent call to prompt(...) are skipped. Call prompts serially, after the preceding turn reports stop: session updates do not carry a prompt ID and cannot be attributed across overlapping prompt requests. Use nextUpdate() when coordinating requests directly.

      Full agent_message updates replace content for their messageId, while agent_message_chunk updates append to it. Non-text content and other update types are ignored; use nextUpdate() when you need them.

      Returns Promise<string>

    • Experimental

      Stops routing updates to this active-session helper.

      This does not close the ACP session on the agent. Use ClientContext session lifecycle methods when the protocol session itself should be closed or deleted.

      Returns void

    • Experimental

      Supports explicit resource management with using.

      Returns void