@agen-ai/agent-protocol 0.3.0 → 0.4.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 +54 -9
- package/dist/capabilities/types.d.ts +1 -1
- package/dist/events/types.d.ts +12 -4
- package/dist/events/types.js +1 -0
- package/dist/failures/index.d.ts +3 -0
- package/dist/failures/index.js +2 -0
- package/dist/failures/parsers.d.ts +5 -0
- package/dist/failures/parsers.js +12 -0
- package/dist/failures/types.d.ts +41 -0
- package/dist/failures/types.js +21 -0
- package/dist/foundation/parsers.d.ts +2 -3
- package/dist/foundation/parsers.js +1 -7
- package/dist/foundation/types.d.ts +2 -12
- package/dist/foundation/types.js +1 -1
- package/dist/jsonSchema/generated.d.ts +3634 -2283
- package/dist/jsonSchema/generated.js +2206 -1246
- package/dist/public/index.d.ts +1 -0
- package/dist/public/index.js +1 -0
- package/dist/zod/accountQuota.d.ts +8 -0
- package/dist/zod/accountQuota.js +7 -5
- package/dist/zod/capabilities.d.ts +3 -3
- package/dist/zod/collaboration.js +1 -1
- package/dist/zod/events.d.ts +42 -31
- package/dist/zod/events.js +17 -3
- package/dist/zod/failures.d.ts +23 -0
- package/dist/zod/failures.js +76 -0
- package/dist/zod/foundation.d.ts +1 -7
- package/dist/zod/foundation.js +0 -13
- package/dist/zod/index.d.ts +2 -1
- package/dist/zod/index.js +10 -2
- package/dist/zod/operations.d.ts +4 -4
- package/dist/zod/operations.js +1 -1
- package/dist/zod/resources.js +1 -1
- package/dist/zod/turns.js +1 -1
- package/dist/zod/typeEquality.generated.d.ts +16 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
`@agen-ai/agent-protocol` is the provider-neutral data contract for coding-agent runtimes. It
|
|
4
4
|
defines opaque identifiers, sessions, turns, approval and elicitation requests, technical
|
|
5
5
|
capabilities, typed operations, safe configuration and managed-content inventories, integration
|
|
6
|
-
observations, effective harness content and package catalogs, environment observations, account-quota observations, collaboration lifecycles, generated resources, portable
|
|
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
9
|
|
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
} from '@agen-ai/agent-protocol';
|
|
51
51
|
|
|
52
52
|
const event: AgentEvent = parseAgentEvent({
|
|
53
|
-
protocolVersion:
|
|
53
|
+
protocolVersion: 10,
|
|
54
54
|
type: 'content.delta',
|
|
55
55
|
sessionId: parseAgentSessionId('external-session:42'),
|
|
56
56
|
turnId: parseAgentTurnId('external-turn:9'),
|
|
@@ -65,7 +65,7 @@ const event: AgentEvent = parseAgentEvent({
|
|
|
65
65
|
const roundTripped = parseAgentEvent(JSON.parse(JSON.stringify(event)));
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
Serialized values carry `protocolVersion:
|
|
68
|
+
Serialized values carry `protocolVersion: 10`; TypeScript API names remain unsuffixed. Unknown
|
|
69
69
|
fields and unsupported protocol versions are rejected.
|
|
70
70
|
|
|
71
71
|
Item snapshots are a closed union keyed by `itemKind`. Common identity and lifecycle fields are
|
|
@@ -78,7 +78,7 @@ attribute bag; source evidence belongs outside the portable event. File-change p
|
|
|
78
78
|
`compareStringsByUnicodeCodePoint` to emit the canonical path ordering required by the protocol
|
|
79
79
|
across both BMP and supplementary Unicode characters.
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
Approval requests correlate to one live item or exact proposed-plan artifact and provide a
|
|
82
82
|
bounded list of typed options. Every option declares its decision, persistence, and neutral scope;
|
|
83
83
|
resolutions select one offered `optionId` or explicitly cancel. Approval capabilities advertise
|
|
84
84
|
the exact persistence/scope combinations an adapter can emit. `context.usage.updated` reports
|
|
@@ -98,6 +98,49 @@ extension or metadata bag.
|
|
|
98
98
|
|
|
99
99
|
## Errors and trust
|
|
100
100
|
|
|
101
|
+
`AgentError` contains required `category`, stable `code`, safe `message`, tagged `recovery`, and
|
|
102
|
+
optional bounded `context`. The categories distinguish rate limiting, exhausted account quota,
|
|
103
|
+
turn budget, execution/context limits, authentication, permission, invalid input, provider overload,
|
|
104
|
+
transport, provider, protocol, internal, and unknown failures. Adapters classify from native evidence;
|
|
105
|
+
an HTTP 429 alone establishes rate limiting and does not establish exhausted account quota.
|
|
106
|
+
|
|
107
|
+
Recovery is one of `unknown`, `none`, `retry`, `wait_for_quota`, or `user_action`. `retry` may carry
|
|
108
|
+
an exactly reported `notBefore` timestamp. `user_action` names `authenticate`, `review_access`,
|
|
109
|
+
`change_configuration`, or `review_allowance`. `none` offers no applicable recovery for this operation.
|
|
110
|
+
These hints describe possible next steps; the application must assess execution certainty and effect
|
|
111
|
+
replay independently before starting more work. The protocol does not retry, schedule continuation,
|
|
112
|
+
switch accounts, or switch providers.
|
|
113
|
+
|
|
114
|
+
An operational failure is separate from terminal authority. `turn.completed` with outcome `failed`
|
|
115
|
+
requires an error; other terminal outcomes cannot carry one. A `runtime.error` observation does not
|
|
116
|
+
itself complete a turn, and a failed tool item does not by itself fail the turn. Contract violations,
|
|
117
|
+
uncertain dispatch and cleanup ownership retain their runtime semantics regardless of failure category.
|
|
118
|
+
|
|
119
|
+
`wait_for_quota` may carry an immutable `AgentFailureQuotaReference` identifying an existing source,
|
|
120
|
+
pool, window, and observation timestamp. Its optional `reset` uses the same `AgentAccountQuotaReset`
|
|
121
|
+
shape and preserves reported versus estimated precision. Reset evidence cannot be newer than the
|
|
122
|
+
referenced observation. Only `rate_limited` and `quota_exhausted` failures may carry a quota reference;
|
|
123
|
+
turn budget and execution limits do not acquire account-quota identity. Omitted quota or reset evidence
|
|
124
|
+
remains absent. The host must establish reference visibility and applicability to the selected binding;
|
|
125
|
+
historical references grant no eligibility after account or credential changes.
|
|
126
|
+
|
|
127
|
+
`runtime.retrying` reports provider-owned retry activity within an active turn. It requires
|
|
128
|
+
`owner: 'provider'`, the turn identity, and an `AgentError`. Its optional `attempt` is a positive,
|
|
129
|
+
one-based retry ordinal; `maxAttempts` is the positive maximum number of retries. Both exclude the
|
|
130
|
+
original attempt. When both are reported, `attempt` cannot exceed `maxAttempts`. Optional `delayMs`
|
|
131
|
+
is a nonnegative safe integer. Counters may repeat or restart across the provider's request/stream
|
|
132
|
+
retry domains within one turn, and missing native facts remain absent. A retry observation neither
|
|
133
|
+
completes a turn nor resolves a pending request; a later authoritative success completes the same turn.
|
|
134
|
+
|
|
135
|
+
V10 removes `AgentError.retryable` and `runtime.warning.payload.retryable`. Warnings retain only
|
|
136
|
+
bounded code, message, and optional context. Existing `AgentError`, `parseAgentError`, and
|
|
137
|
+
`safeParseAgentError` root imports remain available. Failure messages are bounded at 4,000 characters,
|
|
138
|
+
codes at 120 characters, context fields at 160 characters, and serialized failures at 32 KiB.
|
|
139
|
+
Context contains only optional `operation`, `component` and `status`; it cannot carry native payloads,
|
|
140
|
+
credentials or arbitrary attributes.
|
|
141
|
+
The `/json-schema` error artifact publishes structural constraints and names the residual semantic
|
|
142
|
+
invariants enforced by the ordinary parser, including quota applicability and reset observation order.
|
|
143
|
+
|
|
101
144
|
Throwing parsers raise `AgentProtocolValidationError`, a `TypeError` with stable, JSON-safe
|
|
102
145
|
`issues`. Each corresponding `safeParse...` function returns either parsed data or the same issue
|
|
103
146
|
array without throwing. Callers should branch on that public result or error class, not on Zod
|
|
@@ -147,12 +190,14 @@ before delegation; a composer can use the same pure functions to preserve and ex
|
|
|
147
190
|
|
|
148
191
|
## Versioning and release
|
|
149
192
|
|
|
150
|
-
Agent Protocol
|
|
193
|
+
Agent Protocol V10 defines the coordinated SDK `0.4.0` contract shared by this package,
|
|
151
194
|
`@agen-ai/validation`, and `@agen-ai/agent-runtime`. Registry publication and dist-tag state are
|
|
152
|
-
release metadata outside this contract. The earlier public `0.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
195
|
+
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
|
|
197
|
+
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
|
|
200
|
+
environment and account-quota namespaces each use their own schema version 1.
|
|
156
201
|
|
|
157
202
|
The repository release proof builds and packs `@agen-ai/validation`, this package, and
|
|
158
203
|
`@agen-ai/agent-runtime`; rejects workspace-only or private references; then typechecks and runs a
|
|
@@ -149,7 +149,7 @@ export type AgentTurnSteeringCapability = Readonly<{
|
|
|
149
149
|
input: AgentOperationInputCapability;
|
|
150
150
|
}>;
|
|
151
151
|
export interface AgentCapabilities {
|
|
152
|
-
readonly protocolVersion:
|
|
152
|
+
readonly protocolVersion: 10;
|
|
153
153
|
readonly providerKey: AgentProviderKey;
|
|
154
154
|
readonly sessions: Readonly<{
|
|
155
155
|
create: true;
|
package/dist/events/types.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ import type { AgentRequest } from '../requests/index.js';
|
|
|
5
5
|
import type { AgentOperationResult } from '../operations/index.js';
|
|
6
6
|
import type { AgentGeneratedResourceDescriptor } from '../resources/index.js';
|
|
7
7
|
import type { AgentContentStreamKind, AgentContextUsage, AgentDiffSummary, AgentItemSnapshot, AgentPlanStep, AgentTurnCompletedPayload, AgentTurnState } from '../turns/index.js';
|
|
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.warning", "runtime.error", "provider.diagnostic"];
|
|
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: 10;
|
|
12
12
|
readonly type: Type;
|
|
13
13
|
readonly sessionId: AgentSessionId;
|
|
14
14
|
readonly providerRefs?: AgentProviderRefs;
|
|
@@ -72,10 +72,18 @@ export type AgentCollaborationUpdatedEvent = AgentOptionallyTurnScopedEventBase<
|
|
|
72
72
|
export type AgentResourceUpdatedEvent = AgentOptionallyTurnScopedEventBase<'resource.updated', Readonly<{
|
|
73
73
|
resource: AgentGeneratedResourceDescriptor;
|
|
74
74
|
}>>;
|
|
75
|
+
export type AgentRuntimeRetryingEvent = AgentTurnEventBase<'runtime.retrying', Readonly<{
|
|
76
|
+
owner: 'provider';
|
|
77
|
+
error: AgentError;
|
|
78
|
+
/** One-based retry ordinal, excluding the original attempt. */
|
|
79
|
+
attempt?: number;
|
|
80
|
+
/** Maximum number of retries, excluding the original attempt. */
|
|
81
|
+
maxAttempts?: number;
|
|
82
|
+
delayMs?: number;
|
|
83
|
+
}>>;
|
|
75
84
|
export type AgentRuntimeWarningEvent = AgentOptionallyTurnScopedEventBase<'runtime.warning', Readonly<{
|
|
76
85
|
code: string;
|
|
77
86
|
message: string;
|
|
78
|
-
retryable?: boolean;
|
|
79
87
|
context?: AgentErrorContext;
|
|
80
88
|
}>>;
|
|
81
89
|
export type AgentRuntimeErrorEvent = AgentOptionallyTurnScopedEventBase<'runtime.error', Readonly<{
|
|
@@ -86,6 +94,6 @@ export type AgentProviderDiagnosticEvent = AgentOptionallyTurnScopedEventBase<'p
|
|
|
86
94
|
message: string;
|
|
87
95
|
context?: AgentErrorContext;
|
|
88
96
|
}>>;
|
|
89
|
-
export type AgentEvent = AgentTurnStartedEvent | AgentTurnStateChangedEvent | AgentTurnCompletedEvent | AgentItemStartedEvent | AgentItemUpdatedEvent | AgentItemCompletedEvent | AgentContentDeltaEvent | AgentPlanUpdatedEvent | AgentPlanProposedEvent | AgentDiffUpdatedEvent | AgentRequestOpenedEvent | AgentProgressUpdatedEvent | AgentContextUsageUpdatedEvent | AgentArtifactReferencedEvent | AgentOperationUpdatedEvent | AgentCollaborationUpdatedEvent | AgentResourceUpdatedEvent | AgentRuntimeWarningEvent | AgentRuntimeErrorEvent | AgentProviderDiagnosticEvent;
|
|
97
|
+
export type AgentEvent = AgentTurnStartedEvent | AgentTurnStateChangedEvent | AgentTurnCompletedEvent | AgentItemStartedEvent | AgentItemUpdatedEvent | AgentItemCompletedEvent | AgentContentDeltaEvent | AgentPlanUpdatedEvent | AgentPlanProposedEvent | AgentDiffUpdatedEvent | AgentRequestOpenedEvent | AgentProgressUpdatedEvent | AgentContextUsageUpdatedEvent | AgentArtifactReferencedEvent | AgentOperationUpdatedEvent | AgentCollaborationUpdatedEvent | AgentResourceUpdatedEvent | AgentRuntimeRetryingEvent | AgentRuntimeWarningEvent | AgentRuntimeErrorEvent | AgentProviderDiagnosticEvent;
|
|
90
98
|
export {};
|
|
91
99
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/events/types.js
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AgentProtocolParseResult } from '../foundation/validation.js';
|
|
2
|
+
import type { AgentError } from './types.js';
|
|
3
|
+
export declare function parseAgentError(input: unknown): AgentError;
|
|
4
|
+
export declare function safeParseAgentError(input: unknown): AgentProtocolParseResult<AgentError>;
|
|
5
|
+
//# sourceMappingURL=parsers.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { parseWithSchema, safeParseWithSchema } from "../internal/parsers.js";
|
|
2
|
+
import { AgentErrorSchema } from "../zod/failures.js";
|
|
3
|
+
function parseAgentError(input) {
|
|
4
|
+
return parseWithSchema(AgentErrorSchema, input);
|
|
5
|
+
}
|
|
6
|
+
function safeParseAgentError(input) {
|
|
7
|
+
return safeParseWithSchema(AgentErrorSchema, input);
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
parseAgentError,
|
|
11
|
+
safeParseAgentError
|
|
12
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { AgentAccountQuotaReset } from '../accountQuota/types.js';
|
|
2
|
+
import type { AgentIsoDateTime } from '../foundation/types.js';
|
|
3
|
+
export declare const AGENT_FAILURE_CATEGORIES: readonly ["rate_limited", "quota_exhausted", "budget_exhausted", "execution_limit", "context_limit", "authentication", "permission", "invalid_request", "overloaded", "transport", "provider", "protocol", "internal", "unknown"];
|
|
4
|
+
export type AgentFailureCategory = (typeof AGENT_FAILURE_CATEGORIES)[number];
|
|
5
|
+
export declare const AGENT_ERROR_CONTEXT_MAX_LENGTH = 160;
|
|
6
|
+
export interface AgentErrorContext {
|
|
7
|
+
readonly operation?: string;
|
|
8
|
+
readonly component?: string;
|
|
9
|
+
readonly status?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Immutable quota observation evidence, without account or execution authority. */
|
|
12
|
+
export interface AgentFailureQuotaReference {
|
|
13
|
+
readonly sourceId: string;
|
|
14
|
+
readonly poolId: string;
|
|
15
|
+
readonly windowId: string;
|
|
16
|
+
readonly observedAt: AgentIsoDateTime;
|
|
17
|
+
readonly reset?: AgentAccountQuotaReset;
|
|
18
|
+
}
|
|
19
|
+
/** Recovery describes an applicable next step; it never authorizes effect replay. */
|
|
20
|
+
export type AgentRecoveryHint = Readonly<{
|
|
21
|
+
kind: 'unknown';
|
|
22
|
+
}> | Readonly<{
|
|
23
|
+
kind: 'none';
|
|
24
|
+
}> | Readonly<{
|
|
25
|
+
kind: 'retry';
|
|
26
|
+
notBefore?: AgentIsoDateTime;
|
|
27
|
+
}> | Readonly<{
|
|
28
|
+
kind: 'wait_for_quota';
|
|
29
|
+
quota?: AgentFailureQuotaReference;
|
|
30
|
+
}> | Readonly<{
|
|
31
|
+
kind: 'user_action';
|
|
32
|
+
action: 'authenticate' | 'review_access' | 'change_configuration' | 'review_allowance';
|
|
33
|
+
}>;
|
|
34
|
+
export interface AgentError {
|
|
35
|
+
readonly category: AgentFailureCategory;
|
|
36
|
+
readonly code: string;
|
|
37
|
+
readonly message: string;
|
|
38
|
+
readonly recovery: AgentRecoveryHint;
|
|
39
|
+
readonly context?: AgentErrorContext;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const AGENT_FAILURE_CATEGORIES = [
|
|
2
|
+
"rate_limited",
|
|
3
|
+
"quota_exhausted",
|
|
4
|
+
"budget_exhausted",
|
|
5
|
+
"execution_limit",
|
|
6
|
+
"context_limit",
|
|
7
|
+
"authentication",
|
|
8
|
+
"permission",
|
|
9
|
+
"invalid_request",
|
|
10
|
+
"overloaded",
|
|
11
|
+
"transport",
|
|
12
|
+
"provider",
|
|
13
|
+
"protocol",
|
|
14
|
+
"internal",
|
|
15
|
+
"unknown"
|
|
16
|
+
];
|
|
17
|
+
const AGENT_ERROR_CONTEXT_MAX_LENGTH = 160;
|
|
18
|
+
export {
|
|
19
|
+
AGENT_ERROR_CONTEXT_MAX_LENGTH,
|
|
20
|
+
AGENT_FAILURE_CATEGORIES
|
|
21
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { AgentArtifactId, AgentApprovalOptionId, AgentCollaborationId, AgentConfigurationRevisionId,
|
|
1
|
+
import type { AgentArtifactId, AgentApprovalOptionId, AgentCollaborationId, AgentConfigurationRevisionId, AgentGeneratedResourceId, AgentInstanceId, AgentIntegrationId, AgentIntegrationResourceId, AgentIntegrationServerId, AgentIntegrationToolId, AgentIsoDateTime, AgentItemId, AgentJsonValue, AgentManagedContentId, AgentEnvironmentId, AgentEffectiveContentId, AgentCommandId, AgentExtensionId, AgentOperationId, AgentOperationInvocationId, AgentProviderConversationId, AgentProviderHistoryAnchor, AgentProviderItemRef, AgentProviderKey, AgentProviderRefs, AgentProviderRequestRef, AgentProviderTurnRef, AgentRequestFieldId, AgentRequestId, AgentSessionId, AgentTurnId } from './types.js';
|
|
2
2
|
import type { AgentProtocolParseResult } from './validation.js';
|
|
3
|
+
export { parseAgentError, safeParseAgentError } from '../failures/parsers.js';
|
|
3
4
|
export declare const parseAgentInstanceId: (input: unknown) => AgentInstanceId;
|
|
4
5
|
export declare const safeParseAgentInstanceId: (input: unknown) => AgentProtocolParseResult<AgentInstanceId>;
|
|
5
6
|
export declare const parseAgentSessionId: (input: unknown) => AgentSessionId;
|
|
@@ -54,8 +55,6 @@ export declare function parseAgentJsonValue(input: unknown): AgentJsonValue;
|
|
|
54
55
|
export declare function safeParseAgentJsonValue(input: unknown): AgentProtocolParseResult<AgentJsonValue>;
|
|
55
56
|
export declare function parseAgentProviderRefs(input: unknown): AgentProviderRefs;
|
|
56
57
|
export declare function safeParseAgentProviderRefs(input: unknown): AgentProtocolParseResult<AgentProviderRefs>;
|
|
57
|
-
export declare function parseAgentError(input: unknown): AgentError;
|
|
58
|
-
export declare function safeParseAgentError(input: unknown): AgentProtocolParseResult<AgentError>;
|
|
59
58
|
export declare const parseAgentEnvironmentId: (input: unknown) => AgentEnvironmentId;
|
|
60
59
|
export declare const safeParseAgentEnvironmentId: (input: unknown) => AgentProtocolParseResult<AgentEnvironmentId>;
|
|
61
60
|
export declare const parseAgentEffectiveContentId: (input: unknown) => AgentEffectiveContentId;
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
AgentCollaborationIdSchema,
|
|
6
6
|
AgentConfigurationRevisionIdSchema,
|
|
7
7
|
AgentGeneratedResourceIdSchema,
|
|
8
|
-
AgentErrorSchema,
|
|
9
8
|
AgentInstanceIdSchema,
|
|
10
9
|
AgentIntegrationIdSchema,
|
|
11
10
|
AgentIntegrationResourceIdSchema,
|
|
@@ -33,6 +32,7 @@ import {
|
|
|
33
32
|
AgentSessionIdSchema,
|
|
34
33
|
AgentTurnIdSchema
|
|
35
34
|
} from "../zod/foundation.js";
|
|
35
|
+
import { parseAgentError, safeParseAgentError } from "../failures/parsers.js";
|
|
36
36
|
function idParser(schema) {
|
|
37
37
|
return {
|
|
38
38
|
parse: (input) => parseWithSchema(schema, input),
|
|
@@ -164,12 +164,6 @@ function parseAgentProviderRefs(input) {
|
|
|
164
164
|
function safeParseAgentProviderRefs(input) {
|
|
165
165
|
return safeParseWithSchema(AgentProviderRefsSchema, input);
|
|
166
166
|
}
|
|
167
|
-
function parseAgentError(input) {
|
|
168
|
-
return parseWithSchema(AgentErrorSchema, input);
|
|
169
|
-
}
|
|
170
|
-
function safeParseAgentError(input) {
|
|
171
|
-
return safeParseWithSchema(AgentErrorSchema, input);
|
|
172
|
-
}
|
|
173
167
|
const environmentIdParser = idParser(AgentEnvironmentIdSchema);
|
|
174
168
|
const parseAgentEnvironmentId = environmentIdParser.parse;
|
|
175
169
|
const safeParseAgentEnvironmentId = environmentIdParser.safeParse;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { AgentProtocolParseFailure, AgentProtocolParseResult, AgentProtocolParseSuccess, ValidationIssue, ValidationPathSegment, } from './validation.js';
|
|
2
2
|
export { AgentProtocolValidationError } from './validation.js';
|
|
3
|
-
export
|
|
3
|
+
export type { AgentError, AgentErrorContext } from '../failures/types.js';
|
|
4
|
+
export declare const AGENT_PROTOCOL_VERSION: 10;
|
|
4
5
|
export declare const AGENT_PROTOCOL_ID_MAX_LENGTH = 256;
|
|
5
6
|
export declare const AGENT_PROTOCOL_PROVIDER_REFERENCE_MAX_LENGTH = 512;
|
|
6
7
|
export declare const AGENT_PROTOCOL_PROVIDER_KEY_MAX_LENGTH = 100;
|
|
@@ -61,16 +62,5 @@ export interface AgentProviderRefs {
|
|
|
61
62
|
readonly itemId?: AgentProviderItemRef;
|
|
62
63
|
readonly requestId?: AgentProviderRequestRef;
|
|
63
64
|
}
|
|
64
|
-
export interface AgentErrorContext {
|
|
65
|
-
readonly operation?: string;
|
|
66
|
-
readonly component?: string;
|
|
67
|
-
readonly status?: string;
|
|
68
|
-
}
|
|
69
|
-
export interface AgentError {
|
|
70
|
-
readonly code: string;
|
|
71
|
-
readonly message: string;
|
|
72
|
-
readonly retryable: boolean;
|
|
73
|
-
readonly context?: AgentErrorContext;
|
|
74
|
-
}
|
|
75
65
|
export declare function agentProtocolSerializedJsonBytes(value: unknown): number;
|
|
76
66
|
//# sourceMappingURL=types.d.ts.map
|
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 = 10;
|
|
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;
|