@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 +68 -11
- package/dist/capabilities/types.d.ts +6 -1
- package/dist/events/types.d.ts +1 -1
- package/dist/foundation/types.d.ts +1 -1
- package/dist/foundation/types.js +1 -1
- package/dist/jsonSchema/generated.d.ts +1058 -388
- package/dist/jsonSchema/generated.js +660 -227
- package/dist/public/index.d.ts +1 -0
- package/dist/public/index.js +1 -0
- package/dist/public/sessionInteractions.d.ts +2 -0
- package/dist/public/sessionInteractions.js +1 -0
- package/dist/requests/types.d.ts +17 -4
- package/dist/sessionInteractions/index.d.ts +3 -0
- package/dist/sessionInteractions/index.js +2 -0
- package/dist/sessionInteractions/parsers.d.ts +10 -0
- package/dist/sessionInteractions/parsers.js +48 -0
- package/dist/sessionInteractions/types.d.ts +50 -0
- package/dist/sessionInteractions/types.js +18 -0
- package/dist/zod/capabilities.d.ts +73 -7
- package/dist/zod/capabilities.js +32 -30
- package/dist/zod/events.d.ts +47 -35
- package/dist/zod/foundation.d.ts +1 -0
- package/dist/zod/foundation.js +15 -2
- package/dist/zod/index.d.ts +2 -1
- package/dist/zod/index.js +18 -0
- package/dist/zod/requests.d.ts +79 -28
- package/dist/zod/requests.js +15 -2
- package/dist/zod/sessionInteractions.d.ts +55 -0
- package/dist/zod/sessionInteractions.js +114 -0
- package/dist/zod/typeEquality.generated.d.ts +20 -4
- package/package.json +6 -2
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:
|
|
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:
|
|
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
|
|
83
|
-
|
|
84
|
-
|
|
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
|
|
194
|
-
`@agen-ai/
|
|
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
|
|
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
|
|
199
|
-
serialized data
|
|
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:
|
|
157
|
+
readonly protocolVersion: 11;
|
|
153
158
|
readonly providerKey: AgentProviderKey;
|
|
154
159
|
readonly sessions: Readonly<{
|
|
155
160
|
create: true;
|
package/dist/events/types.d.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
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;
|
package/dist/foundation/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AgentProtocolValidationError } from "./validation.js";
|
|
2
|
-
const AGENT_PROTOCOL_VERSION =
|
|
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;
|