@agen-ai/agent-protocol 0.4.0 → 0.4.1

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
@@ -6,6 +6,8 @@ capabilities, typed operations, safe configuration and managed-content inventori
6
6
  observations, effective harness content and package catalogs, environment observations, account-quota observations, operational failures and recovery hints, collaboration lifecycles, generated resources, portable
7
7
  artifact descriptors, and provider-observed events. The package does not define a transport or
8
8
  execution runtime.
9
+ The coordinated source version is unpublished `0.4.1` and uses Agent Protocol V11. The published
10
+ release remains `0.4.0` with V10. The source candidate also includes session-decision data.
9
11
 
10
12
  ## Ownership boundary
11
13
 
@@ -30,7 +32,7 @@ carry no fabricated windows or hints.
30
32
  ## Entrypoints
31
33
 
32
34
  - `@agen-ai/agent-protocol` exports the complete plain API.
33
- - `/sessions`, `/turns`, `/requests`, `/events`, `/capabilities`, `/artifacts`, `/operations`,
35
+ - `/sessions`, `/session-interactions`, `/turns`, `/requests`, `/events`, `/capabilities`, `/artifacts`, `/operations`,
34
36
  `/configuration`, `/managed-content`, `/integrations`, `/collaboration`, `/resources`, and
35
37
  `/account-quota`, `/effective-content`, `/commands`, `/extensions`, and `/environment` are focused plain entrypoints.
36
38
  - `/zod` is the only entrypoint that exposes Zod schemas.
@@ -50,7 +52,7 @@ import {
50
52
  } from '@agen-ai/agent-protocol';
51
53
 
52
54
  const event: AgentEvent = parseAgentEvent({
53
- protocolVersion: 10,
55
+ protocolVersion: 11,
54
56
  type: 'content.delta',
55
57
  sessionId: parseAgentSessionId('external-session:42'),
56
58
  turnId: parseAgentTurnId('external-turn:9'),
@@ -65,7 +67,7 @@ const event: AgentEvent = parseAgentEvent({
65
67
  const roundTripped = parseAgentEvent(JSON.parse(JSON.stringify(event)));
66
68
  ```
67
69
 
68
- Serialized values carry `protocolVersion: 10`; TypeScript API names remain unsuffixed. Unknown
70
+ Serialized values carry `protocolVersion: 11`; TypeScript API names remain unsuffixed. Unknown
69
71
  fields and unsupported protocol versions are rejected.
70
72
 
71
73
  Item snapshots are a closed union keyed by `itemKind`. Common identity and lifecycle fields are
@@ -79,9 +81,24 @@ attribute bag; source evidence belongs outside the portable event. File-change p
79
81
  across both BMP and supplementary Unicode characters.
80
82
 
81
83
  Approval requests correlate to one live item or exact proposed-plan artifact and provide a
82
- bounded list of typed options. Every option declares its decision, persistence, and neutral scope;
83
- resolutions select one offered `optionId` or explicitly cancel. Approval capabilities advertise
84
- the exact persistence/scope combinations an adapter can emit. `context.usage.updated` reports
84
+ bounded list of typed options. Every option declares its decision and a closed `consequence`.
85
+ `scoped` contains precise `persistence` and `scope`; `provider_managed_remembrance` contains explicit
86
+ unknown duration and applicability and a required bounded explanation. Flat persistence/scope
87
+ fields are rejected in V11. Neither approval nor a delivered answer proves the provider wrote a rule.
88
+ Resolutions select one exact offered `optionId` or explicitly cancel. Supported approval capability
89
+ requires `providerManagedRemembrance`: false requires a nonempty readonly precise-mode tuple; true
90
+ allows a bounded readonly array, including empty for a remembered-only provider. Scoped options
91
+ must fit an exact declared mode; remembered options require the true capability. The SDK owns no
92
+ permission database, answer cache, pattern editor, provider payload bag, or revoke API.
93
+
94
+ Consumers should present each offered decision and consequence together. Several options can have
95
+ the same immediate decision and different consequences, so selecting the first `approved` option
96
+ cannot express a person's choice reliably. Return the exact selected `optionId`; keep deny-once,
97
+ deny-and-remember, and explicit cancellation distinct. Show the remembered option's explanation
98
+ and unknown duration/applicability without converting observed provider behavior into a session,
99
+ workspace, path-pattern, or permanent grant.
100
+
101
+ `context.usage.updated` reports
85
102
  bounded occupancy and optional monotonic cumulative counters for an advertised session or
86
103
  materialization measurement scope.
87
104
 
@@ -96,6 +113,45 @@ collapse unrelated pools into one percentage. Quantity units remain distinct fro
96
113
  which uses integer minor units with an explicit scale. None of these domains has a generic
97
114
  extension or metadata bag.
98
115
 
116
+ ## Session-decision data
117
+
118
+ `AgentSessionDecisionRequest` describes a bounded decision outside any model turn. It carries
119
+ `requestId`, `sessionId`, a title, optional description, a workspace target, `expiresAt` and
120
+ one to sixteen uniquely identified choices. It has no `turnId`, provider-native request ID,
121
+ open metadata bag or transport correlation field. Use the root entrypoint or the focused
122
+ `@agen-ai/agent-protocol/session-interactions` entrypoint for its plain types and parsers.
123
+ Only `/zod` exposes the corresponding schemas; the deterministic JSON Schema surface retains
124
+ the same portable data boundary.
125
+
126
+ Every choice describes its consequence. A workspace `grant` is provider-managed, persistent
127
+ and may affect other sessions; it authorizes the workspace rather than only the categories
128
+ detected when the question was created. A `decline` leaves configuration gated and does not
129
+ promise revocation of existing trust, persisted denial or suppression of future questions.
130
+ Hosts must present the target and consequences before applying their decision policy.
131
+ Descriptions and opaque IDs are data, not execution authority.
132
+
133
+ `parseAgentSessionDecisionResponseFor(request, { choiceId })` validates that the response
134
+ selects a choice offered by that exact request. The response has no free-form answer or
135
+ caller-supplied request/session correlation. Actual response authority belongs to the runtime's
136
+ bound `AgentSessionInteraction.respond` capability. The protocol defines portable data;
137
+ callback lifetime, deadlines, delivery receipts, terminal settlement and cleanup are documented
138
+ by [`@agen-ai/agent-runtime`](../agent-runtime/README.md#session-lifetime-interactions).
139
+
140
+ | Portable bound | Maximum |
141
+ | --- | --- |
142
+ | Serialized request | 65,536 UTF-8 bytes |
143
+ | Serialized response | 1,024 UTF-8 bytes |
144
+ | Offered choices | 16, with unique IDs |
145
+ | Choice ID | 128 UTF-8 bytes |
146
+ | Request title and choice label | 120 characters |
147
+ | Request description | 4,000 characters |
148
+ | Choice description | 1,000 characters |
149
+ | Workspace target path | 4,096 UTF-8 bytes |
150
+
151
+ Throwing parsers and `safeParse...` variants use the existing validator-neutral issue contract.
152
+ Unknown fields, duplicate choice IDs and unsupported consequence shapes reject. These values
153
+ remain separate from turn approval/elicitation data and introduce no protocol-version change.
154
+
99
155
  ## Errors and trust
100
156
 
101
157
  `AgentError` contains required `category`, stable `code`, safe `message`, tagged `recovery`, and
@@ -190,13 +246,14 @@ before delegation; a composer can use the same pure functions to preserve and ex
190
246
 
191
247
  ## Versioning and release
192
248
 
193
- Agent Protocol V10 defines the coordinated SDK `0.4.0` contract shared by this package,
194
- `@agen-ai/validation`, and `@agen-ai/agent-runtime`. Registry publication and dist-tag state are
249
+ Agent Protocol V11 defines the contract shared by this package, `@agen-ai/validation`, and
250
+ `@agen-ai/agent-runtime`. The coordinated source SDK is unpublished `0.4.1`; the published
251
+ release is `0.4.0` with V10. Registry publication and dist-tag state are
195
252
  release metadata outside this contract. The earlier public `0.3.0` and `0.3.1` releases remain historical.
196
- The complete seven-package public release inventory must use one coordinated source version. Protocol V10 is
253
+ The complete seven-package public release inventory must use one coordinated source version. Protocol V11 is
197
254
  independent of private transport and product
198
- persistence versions and directly replaces V9 at live boundaries. There is one current parser. V9
199
- serialized data requires the historical owner's frozen decoder and is rejected by the live V10 parser. The
255
+ persistence versions and directly replaces V10 at live boundaries. There is one current parser. V10
256
+ and older serialized data require the historical owner's frozen decoder and are rejected by the live V11 parser. The
200
257
  environment and account-quota namespaces each use their own schema version 1.
201
258
 
202
259
  The repository release proof builds and packs `@agen-ai/validation`, this package, and
@@ -90,9 +90,14 @@ export interface AgentApprovalCapabilityMode {
90
90
  }
91
91
  export type AgentApprovalCapability = Readonly<{
92
92
  kind: 'unsupported';
93
+ }> | Readonly<{
94
+ kind: 'supported';
95
+ modes: readonly [AgentApprovalCapabilityMode, ...AgentApprovalCapabilityMode[]];
96
+ providerManagedRemembrance: false;
93
97
  }> | Readonly<{
94
98
  kind: 'supported';
95
99
  modes: readonly AgentApprovalCapabilityMode[];
100
+ providerManagedRemembrance: true;
96
101
  }>;
97
102
  export type AgentContextUsageCapability = Readonly<{
98
103
  kind: 'unsupported';
@@ -149,7 +154,7 @@ export type AgentTurnSteeringCapability = Readonly<{
149
154
  input: AgentOperationInputCapability;
150
155
  }>;
151
156
  export interface AgentCapabilities {
152
- readonly protocolVersion: 10;
157
+ readonly protocolVersion: 11;
153
158
  readonly providerKey: AgentProviderKey;
154
159
  readonly sessions: Readonly<{
155
160
  create: true;
@@ -8,7 +8,7 @@ import type { AgentContentStreamKind, AgentContextUsage, AgentDiffSummary, Agent
8
8
  export declare const AGENT_EVENT_TYPES: readonly ["turn.started", "turn.state_changed", "turn.completed", "item.started", "item.updated", "item.completed", "content.delta", "turn.plan.updated", "turn.plan.proposed", "turn.diff.updated", "request.opened", "progress.updated", "context.usage.updated", "artifact.referenced", "operation.updated", "collaboration.updated", "resource.updated", "runtime.retrying", "runtime.warning", "runtime.error", "provider.diagnostic"];
9
9
  export type AgentEventType = (typeof AGENT_EVENT_TYPES)[number];
10
10
  interface AgentEventBase<Type extends AgentEventType, Payload> {
11
- readonly protocolVersion: 10;
11
+ readonly protocolVersion: 11;
12
12
  readonly type: Type;
13
13
  readonly sessionId: AgentSessionId;
14
14
  readonly providerRefs?: AgentProviderRefs;
@@ -1,7 +1,7 @@
1
1
  export type { AgentProtocolParseFailure, AgentProtocolParseResult, AgentProtocolParseSuccess, ValidationIssue, ValidationPathSegment, } from './validation.js';
2
2
  export { AgentProtocolValidationError } from './validation.js';
3
3
  export type { AgentError, AgentErrorContext } from '../failures/types.js';
4
- export declare const AGENT_PROTOCOL_VERSION: 10;
4
+ export declare const AGENT_PROTOCOL_VERSION: 11;
5
5
  export declare const AGENT_PROTOCOL_ID_MAX_LENGTH = 256;
6
6
  export declare const AGENT_PROTOCOL_PROVIDER_REFERENCE_MAX_LENGTH = 512;
7
7
  export declare const AGENT_PROTOCOL_PROVIDER_KEY_MAX_LENGTH = 100;
@@ -1,5 +1,5 @@
1
1
  import { AgentProtocolValidationError } from "./validation.js";
2
- const AGENT_PROTOCOL_VERSION = 10;
2
+ const AGENT_PROTOCOL_VERSION = 11;
3
3
  const AGENT_PROTOCOL_ID_MAX_LENGTH = 256;
4
4
  const AGENT_PROTOCOL_PROVIDER_REFERENCE_MAX_LENGTH = 512;
5
5
  const AGENT_PROTOCOL_PROVIDER_KEY_MAX_LENGTH = 100;