@agentproto/runtime 2.1.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,6 +42,7 @@ A per-boot bearer token is generated automatically and written into `<workspace>
42
42
  | MCP | `POST /mcp` (Streamable HTTP) | Stateless mode; per-request transport |
43
43
  | Conversations | `GET /conversations` / `GET /conversations/<id>` | Markdown bodies |
44
44
  | Adapter discovery | `GET /adapters` / `POST /adapters/:slug/install` | When `listAgentAdapters` / `installAgentAdapter` is wired |
45
+ | App scope mounts | `POST /apps/:appId/apply` / `DELETE /apps/:appId/apply` / `GET /scopes/:scopeId/apps` | Mirrors MCP `app_apply` / `app_unapply` / `app_list_applied`; needs `appRegistry` |
45
46
  | Sessions list | `GET /sessions` / `GET /sessions/:id` / `GET /sessions/summaries` | id-or-name in `:id`; summaries are lightweight + paginated |
46
47
  | Agent spawn | `POST /sessions/agent` | Long-lived ACP agent (needs `resolveAgentAdapter`) |
47
48
  | Interrupt turn | `POST /sessions/:id/interrupt` | Cancel the in-flight turn; session stays alive |
package/dist/index.d.ts CHANGED
@@ -3753,8 +3753,14 @@ interface AuthOptions {
3753
3753
  */
3754
3754
 
3755
3755
  interface SessionObserver {
3756
- /** Record the outgoing message that opens a new turn. */
3757
- recordPrompt(sessionId: string, message: unknown): void;
3756
+ /** Record the outgoing message that opens a new turn. `opts.source`, when
3757
+ * set, is the prompt's provenance — `agent:<sessionId>` for a prompt
3758
+ * injected by another session (`agent_prompt` from a supervisor), absent
3759
+ * for a human operator — so a transcript view can attribute the turn to
3760
+ * its real author instead of "you". */
3761
+ recordPrompt(sessionId: string, message: unknown, opts?: {
3762
+ source?: string;
3763
+ }): void;
3758
3764
  /** Record one structured stream event (text-delta, tool-call, usage_update, …). */
3759
3765
  recordEvent(sessionId: string, evt: AgentStreamEvent): void;
3760
3766
  /** Record the durable turn-boundary / exit usage snapshot. */
@@ -3995,6 +4001,16 @@ interface AgentStreamEvent {
3995
4001
  * but no `cost`). */
3996
4002
  tokensIn?: number;
3997
4003
  tokensOut?: number;
4004
+ /** "permission-resolved" outcome for the "agent-prompt" it answers (same
4005
+ * `toolCallId`) — mirrors `session:permission-resolved`'s `decision` so
4006
+ * the durable transcript can tell an answered ask from a still-pending
4007
+ * one. Not an ACP `StreamEvent` kind (synthesized by the registry, same
4008
+ * as "notice"/"turn-end" synthetics) — see registerPendingPermission's
4009
+ * docblock for the "agent-prompt" ask this resolves. */
4010
+ decision?: "approve" | "deny" | "cancelled";
4011
+ /** "permission-resolved" chosen option id, when the driver's offered
4012
+ * options included one (e.g. ACP's `allow_always`). */
4013
+ optionId?: string;
3998
4014
  }
3999
4015
  /**
4000
4016
  * Env vars the registry injects into every process it spawns on a session's
@@ -4019,6 +4035,14 @@ interface AgentStreamEvent {
4019
4035
  * assign-last rule is what makes that true by construction rather than by
4020
4036
  * accident, and is what guarantees a child spawned from inside a session
4021
4037
  * gets its OWN id rather than inheriting its parent's.
4038
+ *
4039
+ * `PARENT_SESSION_ID_ENV` is the third var, injected by `session-spawn.ts`
4040
+ * only (agent spawns, and only when the spawn resolved a parent): the
4041
+ * recorded `parentSessionId` lineage, so a child agent can know WHO spawned
4042
+ * it without a registry round-trip — the discovery half of the child→parent
4043
+ * report-back channel (`message_parent` is the delivery half). Same
4044
+ * assign-last/no-forgery rule as the other two: it mirrors the descriptor's
4045
+ * own `parentSessionId` field, never anything caller- or env-inherited.
4022
4046
  */
4023
4047
  declare const SESSION_ID_ENV = "AGENTPROTO_SESSION_ID";
4024
4048
  declare const WORKSPACE_SLUG_ENV = "AGENTPROTO_WORKSPACE_SLUG";
@@ -4943,6 +4967,7 @@ interface SessionsRegistry {
4943
4967
  * the previous mid-turn rejection byte-for-byte. */
4944
4968
  sendPrompt(id: string, message: unknown, opts?: {
4945
4969
  interrupt?: boolean;
4970
+ source?: string;
4946
4971
  }): Promise<void>;
4947
4972
  /** Fire-and-forget variant of `sendPrompt` for the TURN ITSELF only.
4948
4973
  * Admission (resume attempt + the missing/wrong-kind/dead/busy
@@ -4962,8 +4987,12 @@ interface SessionsRegistry {
4962
4987
  * prompt is admitted + fired on the SAME live session. Ignored
4963
4988
  * (identical to the default) when the session is idle. Omitted or
4964
4989
  * `false` reproduces today's mid-turn rejection byte-for-byte. */
4990
+ /** `opts.source` on either prompt verb is the turn's provenance
4991
+ * (`agent:<sessionId>` when another session injected it — see
4992
+ * `SessionObserver.recordPrompt`); recording-only, never behavioral. */
4965
4993
  enqueuePrompt(id: string, message: unknown, opts?: {
4966
4994
  interrupt?: boolean;
4995
+ source?: string;
4967
4996
  }): Promise<void>;
4968
4997
  /** Eagerly resume ONE dead-but-resumable agent-cli session IN PLACE,
4969
4998
  * WITHOUT a prompt — the boot-time counterpart to the lazy resume that