Constructor
Parameters
Returns
AcpSession
Properties
Type:
SessionConfigOptionThe session settings the agent exposes (model, mode, …) with their
current and accepted values, as last reported on a session/new,
session/load or session/set_config_option result. undefined until
the agent has reported any.Type:
CognitionSessionMetaThe latest session-level snapshot the agent stamped on an update
(cognition.ai/session): status, URL, finished outcome, whether input is
disabled, what the user must do. Cloud sessions carry it on most
notifications, so this is current without waiting for a status event.Type:
CognitionExtensionNotificationCalled with each typed _cognition.ai/* extension notification for this
session (agent stopped, compaction, connection retries, …).Type:
PermissionHandlerAnswer this session’s permission requests (e.g. running a shell command).
Takes precedence over the client-level onPermission for this session;
when neither is set, requests are rejected so unattended runs are safe by
default. Settable via createSession({ onPermission }) or directly.The session’s web URL (
cognition.ai/url session meta), once the agent
has stamped it on an update — cloud sessions carry it from the first
notification; local sessions have none.Methods
beginReplay()
session/load request is in flight (the agent replays the session’s
transcript as session/update notifications before responding).
cancel()
configOption()
id on ACP v1, configId on v2), if reported.
Parameters
Returns
SessionConfigOption
enableTurnStateUpdates()
session/prompt response is an immediate ack;
turns end on the idle state_update notification instead.
endReplay()
Returns
SessionUpdate
enrichPermissionRequest()
toolCallId reference (the full tool
call was already streamed as a tool_call update).
Parameters
Returns
PermissionRequest
events()
status events say when Devin
starts working, is waiting on the user, or finishes; lifecycle when its
runtime sleeps or exits; activity and typing what it is doing right
now; message_delta, thought_delta, user_message, tool_call, plan
and pull_request cover the transcript.
Parameters
Returns
SessionEvent
extNotify()
_cognition.ai/* notification (no response).
Parameters
Type: one of
-
SessionScopedParams unknown
extRequest()
_cognition.ai/* request with this session’s id
filled in. Typed when the method is in the generated registry
(CognitionAgentResponseMap); any other _cognition.ai/* method is
accepted untyped. Use this for Cognition methods that have no dedicated
helper yet, e.g.
session.extRequest(SESSION_RENAME_METHOD, { title: "Fix flaky test" }).
An explicit directory variant is sent without adding a session id.
Parameters
Type: one of
-
SessionScopedParams unknown
Returns
CognitionRequestResult | Promise<T>
handleConnectionClosed()
Parameters
handleExtension()
Parameters
handleReleased()
handleResult()
session/new, session/resume,
session/set_config_option or session/prompt result carries, so meta,
url and configOptions are set without waiting for a live update.
Parameters
handleUpdate()
session/update notification. Cloud agents stamp the session
snapshot on the notification’s _meta rather than the update’s, so both
are consulted.
Parameters
Type:
SessionNotificationinstrument()
observer until the session detaches.
Parameters
postMessage()
session/prompt; the returned promise settles when the turn ends, with
the same result the original prompt resolves to.
Parameters
Returns
PromptResult
rename()
_cognition.ai/session/rename). Available on both
cloud and local agents; check devin.supports("cognition.ai/sessionRename").
Parameters
Returns
Promise<void>
run()
for await it for typed
SessionEvents, await it for the SessionOutcome
(stop reason, accumulated text, tool calls — and structured output
validated against options.output, e.g. a zod schema).
output schema the outcome’s output is the validated T
(validation failure rejects the turn; a turn that stops without
end_turn resolves, but reading output throws); without one it is
undefined.
Parameters
Type: one of
Returns
Turn | Turn | Turn
send()
prompt builders) to
attach images, audio, or embedded resources.
Parameters
Returns
PromptResult
setMode()
"ask", "accept-edits").
Parameters
Returns
Promise<void>
stream()
Parameters
Returns
SessionEventPromptResult
streamUpdates()
session/update notifications
as they stream, returning the turn result once the agent stops.
Parameters
Returns
SessionUpdatePromptResult
updates()
session/update for this session as it arrives — from turns
this client started and from turns driven elsewhere alike. Subscribes on
the first pull; ends when the consumer stops (break, return(), or
signal) or the session is released, and throws
ConnectionClosedError when the connection drops. Replayed history
from loadSession() is not delivered here.
Parameters
Returns
SessionUpdate
