@agen-ai/agent-protocol 0.2.2 → 0.2.3
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 +22 -12
- package/dist/capabilities/types.d.ts +64 -18
- package/dist/capabilities/types.js +0 -6
- package/dist/collaboration/index.d.ts +3 -0
- package/dist/collaboration/index.js +2 -0
- package/dist/collaboration/parsers.d.ts +9 -0
- package/dist/collaboration/parsers.js +32 -0
- package/dist/collaboration/types.d.ts +88 -0
- package/dist/collaboration/types.js +64 -0
- package/dist/configuration/index.d.ts +3 -0
- package/dist/configuration/index.js +2 -0
- package/dist/configuration/parsers.d.ts +9 -0
- package/dist/configuration/parsers.js +98 -0
- package/dist/configuration/types.d.ts +72 -0
- package/dist/configuration/types.js +27 -0
- package/dist/events/types.d.ts +15 -3
- package/dist/events/types.js +3 -0
- package/dist/foundation/parsers.d.ts +19 -1
- package/dist/foundation/parsers.js +70 -0
- package/dist/foundation/types.d.ts +10 -1
- package/dist/foundation/types.js +1 -1
- package/dist/integrations/index.d.ts +3 -0
- package/dist/integrations/index.js +2 -0
- package/dist/integrations/parsers.d.ts +7 -0
- package/dist/integrations/parsers.js +23 -0
- package/dist/integrations/types.d.ts +43 -0
- package/dist/integrations/types.js +23 -0
- package/dist/jsonSchema/generated.d.ts +9686 -3515
- package/dist/jsonSchema/generated.js +5341 -1391
- package/dist/managedContent/index.d.ts +3 -0
- package/dist/managedContent/index.js +2 -0
- package/dist/managedContent/parsers.d.ts +7 -0
- package/dist/managedContent/parsers.js +23 -0
- package/dist/managedContent/types.d.ts +39 -0
- package/dist/managedContent/types.js +21 -0
- package/dist/operations/index.d.ts +3 -0
- package/dist/operations/index.js +2 -0
- package/dist/operations/parsers.d.ts +15 -0
- package/dist/operations/parsers.js +181 -0
- package/dist/operations/types.d.ts +112 -0
- package/dist/operations/types.js +67 -0
- package/dist/public/collaboration.d.ts +2 -0
- package/dist/public/collaboration.js +1 -0
- package/dist/public/configuration.d.ts +2 -0
- package/dist/public/configuration.js +1 -0
- package/dist/public/index.d.ts +6 -0
- package/dist/public/index.js +6 -0
- package/dist/public/integrations.d.ts +2 -0
- package/dist/public/integrations.js +1 -0
- package/dist/public/managedContent.d.ts +2 -0
- package/dist/public/managedContent.js +1 -0
- package/dist/public/operations.d.ts +2 -0
- package/dist/public/operations.js +1 -0
- package/dist/public/resources.d.ts +2 -0
- package/dist/public/resources.js +1 -0
- package/dist/requests/parsers.js +40 -11
- package/dist/requests/types.d.ts +35 -8
- package/dist/requests/types.js +15 -1
- package/dist/resources/index.d.ts +3 -0
- package/dist/resources/index.js +2 -0
- package/dist/resources/parsers.d.ts +5 -0
- package/dist/resources/parsers.js +12 -0
- package/dist/resources/types.d.ts +39 -0
- package/dist/resources/types.js +19 -0
- package/dist/sessions/types.d.ts +15 -4
- package/dist/zod/capabilities.d.ts +103 -15
- package/dist/zod/capabilities.js +196 -31
- package/dist/zod/collaboration.d.ts +60 -0
- package/dist/zod/collaboration.js +155 -0
- package/dist/zod/configuration.d.ts +177 -0
- package/dist/zod/configuration.js +157 -0
- package/dist/zod/events.d.ts +214 -22
- package/dist/zod/events.js +15 -0
- package/dist/zod/foundation.d.ts +10 -1
- package/dist/zod/foundation.js +18 -0
- package/dist/zod/index.d.ts +7 -1
- package/dist/zod/index.js +62 -0
- package/dist/zod/integrations.d.ts +76 -0
- package/dist/zod/integrations.js +92 -0
- package/dist/zod/managedContent.d.ts +9 -0
- package/dist/zod/managedContent.js +70 -0
- package/dist/zod/operations.d.ts +339 -0
- package/dist/zod/operations.js +229 -0
- package/dist/zod/requests.d.ts +100 -11
- package/dist/zod/requests.js +66 -26
- package/dist/zod/resources.d.ts +43 -0
- package/dist/zod/resources.js +82 -0
- package/dist/zod/sessions.d.ts +168 -21
- package/dist/zod/sessions.js +54 -42
- package/dist/zod/typeEquality.generated.d.ts +40 -0
- package/package.json +26 -2
package/README.md
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
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
|
-
capabilities,
|
|
6
|
-
|
|
5
|
+
capabilities, typed operations, safe configuration and managed-content inventories, integration
|
|
6
|
+
observations, collaboration lifecycles, generated resources, portable artifact descriptors, and
|
|
7
|
+
provider-observed events. The package does not define a transport or execution runtime.
|
|
7
8
|
|
|
8
9
|
## Ownership boundary
|
|
9
10
|
|
|
@@ -22,8 +23,9 @@ that product concern belongs to the caller's control plane.
|
|
|
22
23
|
## Entrypoints
|
|
23
24
|
|
|
24
25
|
- `@agen-ai/agent-protocol` exports the complete plain API.
|
|
25
|
-
- `/sessions`, `/turns`, `/requests`, `/events`, `/capabilities`,
|
|
26
|
-
|
|
26
|
+
- `/sessions`, `/turns`, `/requests`, `/events`, `/capabilities`, `/artifacts`, `/operations`,
|
|
27
|
+
`/configuration`, `/managed-content`, `/integrations`, `/collaboration`, and `/resources` are
|
|
28
|
+
focused plain entrypoints.
|
|
27
29
|
- `/zod` is the only entrypoint that exposes Zod schemas.
|
|
28
30
|
- `/json-schema` exposes deterministic draft 2020-12 schema artifacts.
|
|
29
31
|
|
|
@@ -41,7 +43,7 @@ import {
|
|
|
41
43
|
} from '@agen-ai/agent-protocol';
|
|
42
44
|
|
|
43
45
|
const event: AgentEvent = parseAgentEvent({
|
|
44
|
-
protocolVersion:
|
|
46
|
+
protocolVersion: 8,
|
|
45
47
|
type: 'content.delta',
|
|
46
48
|
sessionId: parseAgentSessionId('external-session:42'),
|
|
47
49
|
turnId: parseAgentTurnId('external-turn:9'),
|
|
@@ -56,7 +58,7 @@ const event: AgentEvent = parseAgentEvent({
|
|
|
56
58
|
const roundTripped = parseAgentEvent(JSON.parse(JSON.stringify(event)));
|
|
57
59
|
```
|
|
58
60
|
|
|
59
|
-
Serialized values carry `protocolVersion:
|
|
61
|
+
Serialized values carry `protocolVersion: 8`; TypeScript API names remain unsuffixed. Unknown
|
|
60
62
|
fields and unsupported protocol versions are rejected.
|
|
61
63
|
|
|
62
64
|
Item snapshots are a closed union keyed by `itemKind`. Common identity and lifecycle fields are
|
|
@@ -69,13 +71,21 @@ attribute bag; source evidence belongs outside the portable event. File-change p
|
|
|
69
71
|
`compareStringsByUnicodeCodePoint` to emit the canonical path ordering required by the protocol
|
|
70
72
|
across both BMP and supplementary Unicode characters.
|
|
71
73
|
|
|
72
|
-
|
|
74
|
+
V8 approval requests correlate to one live item or exact proposed-plan artifact and provide a
|
|
73
75
|
bounded list of typed options. Every option declares its decision, persistence, and neutral scope;
|
|
74
76
|
resolutions select one offered `optionId` or explicitly cancel. Approval capabilities advertise
|
|
75
77
|
the exact persistence/scope combinations an adapter can emit. `context.usage.updated` reports
|
|
76
78
|
bounded occupancy and optional monotonic cumulative counters for an advertised session or
|
|
77
79
|
materialization measurement scope.
|
|
78
80
|
|
|
81
|
+
Capabilities state technical possibility only. Dynamic operations, configuration fields, managed
|
|
82
|
+
content, and integrations are separate bounded, revisioned catalogs; capability declarations do
|
|
83
|
+
not carry inventory or authority. Operation and configuration input is correlated to the exact
|
|
84
|
+
offered revision and typed field definition. Collaboration exposes canonical graph identity and
|
|
85
|
+
lifecycle state without provider handles. Generated resources expose portable publication state
|
|
86
|
+
and an artifact reference only when the resource is available. None of these domains has a generic
|
|
87
|
+
extension or metadata bag.
|
|
88
|
+
|
|
79
89
|
## Errors and trust
|
|
80
90
|
|
|
81
91
|
Throwing parsers raise `AgentProtocolValidationError`, a `TypeError` with stable, JSON-safe
|
|
@@ -94,11 +104,11 @@ validated protocol output remains canonical across transports and consumers.
|
|
|
94
104
|
|
|
95
105
|
## Versioning and release
|
|
96
106
|
|
|
97
|
-
The package is at `0.2.
|
|
98
|
-
releases may include breaking changes during this beta period
|
|
99
|
-
in the release notes. Protocol
|
|
100
|
-
version.
|
|
101
|
-
|
|
107
|
+
The package is at `0.2.3` while the public API is still being proven with external adapters.
|
|
108
|
+
Pre-1.0 releases may include breaking changes during this beta period, and every such change is
|
|
109
|
+
called out in the release notes. Protocol V8 is independent of any host transport or product
|
|
110
|
+
persistence version. It directly replaces V7 in source; there is no compatibility parser, alias,
|
|
111
|
+
or extension reader.
|
|
102
112
|
|
|
103
113
|
The repository release proof builds and packs `@agen-ai/validation`, this package, and
|
|
104
114
|
`@agen-ai/agent-runtime`; rejects workspace-only or private references; then typechecks and runs a
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { AgentArtifactKind } from '../artifacts/index.js';
|
|
2
|
+
import type { AgentCollaborationControlAction, AgentCollaborationRole } from '../collaboration/index.js';
|
|
3
|
+
import type { AgentConfigurationFieldKind } from '../configuration/index.js';
|
|
2
4
|
import type { AgentProviderKey } from '../foundation/index.js';
|
|
5
|
+
import type { AgentIntegrationKind } from '../integrations/index.js';
|
|
6
|
+
import type { AgentManagedContentKind } from '../managedContent/index.js';
|
|
7
|
+
import type { AgentOperationExecutionMode, AgentOperationFieldKind, AgentOperationKind } from '../operations/index.js';
|
|
8
|
+
import type { AgentGeneratedResourceKind } from '../resources/index.js';
|
|
3
9
|
import type { AgentContextCompactionTrigger, AgentContextCumulativeUsageField, AgentContextMeasurementScope, AgentImageInputMediaType, AgentImageInputSourceKind, AgentTurnInteractionMode } from '../turns/types.js';
|
|
4
|
-
import type { AgentApprovalPersistence, AgentApprovalScopeKind } from '../requests/types.js';
|
|
5
|
-
export declare const AGENT_ELICITATION_MODES: readonly ["unsupported", "text", "structured"];
|
|
10
|
+
import type { AgentApprovalPersistence, AgentApprovalScopeKind, AgentElicitationFieldKind } from '../requests/types.js';
|
|
6
11
|
export declare const AGENT_FILE_CHANGE_MODES: readonly ["none", "final_diff", "structured"];
|
|
7
12
|
export declare const AGENT_AUTHENTICATION_FLOWS: readonly ["device_code", "browser", "terminal"];
|
|
8
|
-
export type AgentElicitationMode = (typeof AGENT_ELICITATION_MODES)[number];
|
|
9
13
|
export type AgentFileChangeMode = (typeof AGENT_FILE_CHANGE_MODES)[number];
|
|
10
14
|
export type AgentAuthenticationFlow = (typeof AGENT_AUTHENTICATION_FLOWS)[number];
|
|
11
15
|
export type AgentBranchCapability = Readonly<{
|
|
@@ -16,19 +20,62 @@ export type AgentBranchCapability = Readonly<{
|
|
|
16
20
|
export type AgentElicitationCapability = Readonly<{
|
|
17
21
|
kind: 'unsupported';
|
|
18
22
|
}> | Readonly<{
|
|
19
|
-
kind: '
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
kind: 'supported';
|
|
24
|
+
fieldKinds: readonly AgentElicitationFieldKind[];
|
|
25
|
+
maxFields: number;
|
|
26
|
+
sensitiveFields: boolean;
|
|
22
27
|
}>;
|
|
23
|
-
export interface AgentConfigurationFieldCapability {
|
|
24
|
-
readonly key: string;
|
|
25
|
-
readonly optionIds: readonly string[];
|
|
26
|
-
}
|
|
27
28
|
export type AgentConfigurationCapability = Readonly<{
|
|
28
29
|
kind: 'managed';
|
|
29
30
|
}> | Readonly<{
|
|
30
31
|
kind: 'selectable';
|
|
31
|
-
|
|
32
|
+
fieldKinds: readonly AgentConfigurationFieldKind[];
|
|
33
|
+
maxFields: number;
|
|
34
|
+
}>;
|
|
35
|
+
export type AgentOperationsCapability = Readonly<{
|
|
36
|
+
kind: 'unsupported';
|
|
37
|
+
}> | Readonly<{
|
|
38
|
+
kind: 'supported';
|
|
39
|
+
operationKinds: readonly AgentOperationKind[];
|
|
40
|
+
fieldKinds: readonly AgentOperationFieldKind[];
|
|
41
|
+
executionModes: readonly AgentOperationExecutionMode[];
|
|
42
|
+
maxOperations: number;
|
|
43
|
+
maxFieldsPerOperation: number;
|
|
44
|
+
}>;
|
|
45
|
+
export type AgentManagedContentCapability = Readonly<{
|
|
46
|
+
kind: 'unsupported';
|
|
47
|
+
}> | Readonly<{
|
|
48
|
+
kind: 'supported';
|
|
49
|
+
contentKinds: readonly AgentManagedContentKind[];
|
|
50
|
+
maxEntries: number;
|
|
51
|
+
}>;
|
|
52
|
+
export type AgentIntegrationsCapability = Readonly<{
|
|
53
|
+
kind: 'unsupported';
|
|
54
|
+
}> | Readonly<{
|
|
55
|
+
kind: 'supported';
|
|
56
|
+
integrationKinds: readonly AgentIntegrationKind[];
|
|
57
|
+
maxIntegrations: number;
|
|
58
|
+
maxServersPerIntegration: number;
|
|
59
|
+
maxToolsPerServer: number;
|
|
60
|
+
maxResourcesPerServer: number;
|
|
61
|
+
}>;
|
|
62
|
+
export type AgentCollaborationCapability = Readonly<{
|
|
63
|
+
kind: 'unsupported';
|
|
64
|
+
}> | Readonly<{
|
|
65
|
+
kind: 'supported';
|
|
66
|
+
roles: readonly AgentCollaborationRole[];
|
|
67
|
+
controlActions: readonly AgentCollaborationControlAction[];
|
|
68
|
+
maxDepth: number;
|
|
69
|
+
maxChildrenPerNode: number;
|
|
70
|
+
maxActiveNodes: number;
|
|
71
|
+
}>;
|
|
72
|
+
export type AgentGeneratedResourcesCapability = Readonly<{
|
|
73
|
+
kind: 'unsupported';
|
|
74
|
+
}> | Readonly<{
|
|
75
|
+
kind: 'supported';
|
|
76
|
+
resourceKinds: readonly AgentGeneratedResourceKind[];
|
|
77
|
+
maxResourcesPerTurn: number;
|
|
78
|
+
maxBytesPerResource: number;
|
|
32
79
|
}>;
|
|
33
80
|
export type AgentAuthenticationCapability = Readonly<{
|
|
34
81
|
kind: 'unsupported';
|
|
@@ -85,7 +132,7 @@ export type AgentTurnSteeringCapability = Readonly<{
|
|
|
85
132
|
input: AgentOperationInputCapability;
|
|
86
133
|
}>;
|
|
87
134
|
export interface AgentCapabilities {
|
|
88
|
-
readonly protocolVersion:
|
|
135
|
+
readonly protocolVersion: 8;
|
|
89
136
|
readonly providerKey: AgentProviderKey;
|
|
90
137
|
readonly sessions: Readonly<{
|
|
91
138
|
create: true;
|
|
@@ -113,12 +160,11 @@ export interface AgentCapabilities {
|
|
|
113
160
|
artifactKinds: readonly AgentArtifactKind[];
|
|
114
161
|
}>;
|
|
115
162
|
readonly configuration: AgentConfigurationCapability;
|
|
116
|
-
readonly
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}>;
|
|
163
|
+
readonly operations: AgentOperationsCapability;
|
|
164
|
+
readonly managedContent: AgentManagedContentCapability;
|
|
165
|
+
readonly integrations: AgentIntegrationsCapability;
|
|
166
|
+
readonly collaboration: AgentCollaborationCapability;
|
|
167
|
+
readonly generatedResources: AgentGeneratedResourcesCapability;
|
|
122
168
|
readonly authentication: AgentAuthenticationCapability;
|
|
123
169
|
readonly versionReporting: boolean;
|
|
124
170
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
const AGENT_ELICITATION_MODES = [
|
|
2
|
-
"unsupported",
|
|
3
|
-
"text",
|
|
4
|
-
"structured"
|
|
5
|
-
];
|
|
6
1
|
const AGENT_FILE_CHANGE_MODES = [
|
|
7
2
|
"none",
|
|
8
3
|
"final_diff",
|
|
@@ -15,6 +10,5 @@ const AGENT_AUTHENTICATION_FLOWS = [
|
|
|
15
10
|
];
|
|
16
11
|
export {
|
|
17
12
|
AGENT_AUTHENTICATION_FLOWS,
|
|
18
|
-
AGENT_ELICITATION_MODES,
|
|
19
13
|
AGENT_FILE_CHANGE_MODES
|
|
20
14
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentProtocolParseResult } from '../foundation/index.js';
|
|
2
|
+
import type { AgentCollaborationControlInput, AgentCollaborationNode, AgentCollaborationSpawnInput } from './types.js';
|
|
3
|
+
export declare function parseAgentCollaborationNode(input: unknown): AgentCollaborationNode;
|
|
4
|
+
export declare function safeParseAgentCollaborationNode(input: unknown): AgentProtocolParseResult<AgentCollaborationNode>;
|
|
5
|
+
export declare function parseAgentCollaborationSpawnInput(input: unknown): AgentCollaborationSpawnInput;
|
|
6
|
+
export declare function safeParseAgentCollaborationSpawnInput(input: unknown): AgentProtocolParseResult<AgentCollaborationSpawnInput>;
|
|
7
|
+
export declare function parseAgentCollaborationControlInput(input: unknown): AgentCollaborationControlInput;
|
|
8
|
+
export declare function safeParseAgentCollaborationControlInput(input: unknown): AgentProtocolParseResult<AgentCollaborationControlInput>;
|
|
9
|
+
//# sourceMappingURL=parsers.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { parseWithSchema, safeParseWithSchema } from "../internal/parsers.js";
|
|
2
|
+
import {
|
|
3
|
+
AgentCollaborationControlInputSchema,
|
|
4
|
+
AgentCollaborationNodeSchema,
|
|
5
|
+
AgentCollaborationSpawnInputSchema
|
|
6
|
+
} from "../zod/collaboration.js";
|
|
7
|
+
function parseAgentCollaborationNode(input) {
|
|
8
|
+
return parseWithSchema(AgentCollaborationNodeSchema, input);
|
|
9
|
+
}
|
|
10
|
+
function safeParseAgentCollaborationNode(input) {
|
|
11
|
+
return safeParseWithSchema(AgentCollaborationNodeSchema, input);
|
|
12
|
+
}
|
|
13
|
+
function parseAgentCollaborationSpawnInput(input) {
|
|
14
|
+
return parseWithSchema(AgentCollaborationSpawnInputSchema, input);
|
|
15
|
+
}
|
|
16
|
+
function safeParseAgentCollaborationSpawnInput(input) {
|
|
17
|
+
return safeParseWithSchema(AgentCollaborationSpawnInputSchema, input);
|
|
18
|
+
}
|
|
19
|
+
function parseAgentCollaborationControlInput(input) {
|
|
20
|
+
return parseWithSchema(AgentCollaborationControlInputSchema, input);
|
|
21
|
+
}
|
|
22
|
+
function safeParseAgentCollaborationControlInput(input) {
|
|
23
|
+
return safeParseWithSchema(AgentCollaborationControlInputSchema, input);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
parseAgentCollaborationControlInput,
|
|
27
|
+
parseAgentCollaborationNode,
|
|
28
|
+
parseAgentCollaborationSpawnInput,
|
|
29
|
+
safeParseAgentCollaborationControlInput,
|
|
30
|
+
safeParseAgentCollaborationNode,
|
|
31
|
+
safeParseAgentCollaborationSpawnInput
|
|
32
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { AgentArtifactId, AgentCollaborationId, AgentError, AgentGeneratedResourceId, AgentIsoDateTime } from '../foundation/index.js';
|
|
2
|
+
import type { AgentTurnInputContent } from '../turns/index.js';
|
|
3
|
+
export declare const AGENT_COLLABORATION_ROLES: readonly ["delegate", "reviewer", "researcher", "specialist"];
|
|
4
|
+
export declare const AGENT_COLLABORATION_STATUSES: readonly ["queued", "starting", "running", "waiting", "completed", "failed", "canceled"];
|
|
5
|
+
export declare const AGENT_COLLABORATION_CONTROL_ACTIONS: readonly ["spawn", "steer", "stop", "close", "inspect"];
|
|
6
|
+
export declare const AGENT_COLLABORATION_OUTCOMES: readonly ["completed", "failed", "canceled"];
|
|
7
|
+
export declare const AGENT_COLLABORATION_STOP_REASONS: readonly ["user_requested", "timeout", "shutdown", "superseded", "other"];
|
|
8
|
+
export declare const AGENT_COLLABORATION_USAGE_FIELDS: readonly ["inputTokens", "outputTokens", "reasoningTokens", "totalTokens", "modelCalls"];
|
|
9
|
+
export declare const AGENT_COLLABORATION_TITLE_MAX_LENGTH = 200;
|
|
10
|
+
export declare const AGENT_COLLABORATION_OBJECTIVE_MAX_LENGTH = 4000;
|
|
11
|
+
export declare const AGENT_COLLABORATION_PROGRESS_MAX_LENGTH = 2000;
|
|
12
|
+
export declare const AGENT_COLLABORATION_RESULT_REFERENCES_MAX_LENGTH = 100;
|
|
13
|
+
export declare const AGENT_COLLABORATION_GRAPH_LIMITS: Readonly<{
|
|
14
|
+
maxNodes: 100;
|
|
15
|
+
maxDepth: 16;
|
|
16
|
+
maxChildrenPerNode: 100;
|
|
17
|
+
maxActiveNodes: 100;
|
|
18
|
+
}>;
|
|
19
|
+
export type AgentCollaborationRole = (typeof AGENT_COLLABORATION_ROLES)[number];
|
|
20
|
+
export type AgentCollaborationStatus = (typeof AGENT_COLLABORATION_STATUSES)[number];
|
|
21
|
+
export type AgentCollaborationControlAction = (typeof AGENT_COLLABORATION_CONTROL_ACTIONS)[number];
|
|
22
|
+
export type AgentCollaborationOutcomeKind = (typeof AGENT_COLLABORATION_OUTCOMES)[number];
|
|
23
|
+
export type AgentCollaborationStopReason = (typeof AGENT_COLLABORATION_STOP_REASONS)[number];
|
|
24
|
+
export type AgentCollaborationUsageField = (typeof AGENT_COLLABORATION_USAGE_FIELDS)[number];
|
|
25
|
+
export type AgentCollaborationOutcome = Readonly<{
|
|
26
|
+
kind: 'completed';
|
|
27
|
+
}> | Readonly<{
|
|
28
|
+
kind: 'failed';
|
|
29
|
+
error: AgentError;
|
|
30
|
+
}> | Readonly<{
|
|
31
|
+
kind: 'canceled';
|
|
32
|
+
reason: AgentCollaborationStopReason;
|
|
33
|
+
}>;
|
|
34
|
+
export type AgentCollaborationUsage = Readonly<{
|
|
35
|
+
kind: 'unavailable';
|
|
36
|
+
}> | Readonly<{
|
|
37
|
+
kind: 'reported';
|
|
38
|
+
inputTokens?: number;
|
|
39
|
+
outputTokens?: number;
|
|
40
|
+
reasoningTokens?: number;
|
|
41
|
+
totalTokens?: number;
|
|
42
|
+
modelCalls?: number;
|
|
43
|
+
}>;
|
|
44
|
+
export interface AgentCollaborationNode {
|
|
45
|
+
readonly collaborationId: AgentCollaborationId;
|
|
46
|
+
readonly rootCollaborationId: AgentCollaborationId;
|
|
47
|
+
readonly parentCollaborationId?: AgentCollaborationId;
|
|
48
|
+
readonly role: AgentCollaborationRole;
|
|
49
|
+
readonly title: string;
|
|
50
|
+
readonly status: AgentCollaborationStatus;
|
|
51
|
+
readonly objective: string;
|
|
52
|
+
readonly progress?: string;
|
|
53
|
+
readonly usage: AgentCollaborationUsage;
|
|
54
|
+
readonly outcome?: AgentCollaborationOutcome;
|
|
55
|
+
readonly createdAt: AgentIsoDateTime;
|
|
56
|
+
readonly updatedAt: AgentIsoDateTime;
|
|
57
|
+
readonly terminalAt?: AgentIsoDateTime;
|
|
58
|
+
readonly closedAt?: AgentIsoDateTime;
|
|
59
|
+
readonly artifactIds?: readonly AgentArtifactId[];
|
|
60
|
+
readonly resourceIds?: readonly AgentGeneratedResourceId[];
|
|
61
|
+
}
|
|
62
|
+
export interface AgentCollaborationSpawnInput {
|
|
63
|
+
readonly collaborationId: AgentCollaborationId;
|
|
64
|
+
readonly parentCollaborationId?: AgentCollaborationId;
|
|
65
|
+
readonly role: AgentCollaborationRole;
|
|
66
|
+
readonly title: string;
|
|
67
|
+
readonly objective: string;
|
|
68
|
+
readonly createdAt: AgentIsoDateTime;
|
|
69
|
+
}
|
|
70
|
+
export interface AgentCollaborationSteerInput extends AgentTurnInputContent {
|
|
71
|
+
readonly action: 'steer';
|
|
72
|
+
readonly collaborationId: AgentCollaborationId;
|
|
73
|
+
}
|
|
74
|
+
export interface AgentCollaborationStopInput {
|
|
75
|
+
readonly action: 'stop';
|
|
76
|
+
readonly collaborationId: AgentCollaborationId;
|
|
77
|
+
readonly reason: AgentCollaborationStopReason;
|
|
78
|
+
}
|
|
79
|
+
export interface AgentCollaborationCloseInput {
|
|
80
|
+
readonly action: 'close';
|
|
81
|
+
readonly collaborationId: AgentCollaborationId;
|
|
82
|
+
}
|
|
83
|
+
export interface AgentCollaborationInspectInput {
|
|
84
|
+
readonly action: 'inspect';
|
|
85
|
+
readonly collaborationId: AgentCollaborationId;
|
|
86
|
+
}
|
|
87
|
+
export type AgentCollaborationControlInput = AgentCollaborationSteerInput | AgentCollaborationStopInput | AgentCollaborationCloseInput | AgentCollaborationInspectInput;
|
|
88
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const AGENT_COLLABORATION_ROLES = [
|
|
2
|
+
"delegate",
|
|
3
|
+
"reviewer",
|
|
4
|
+
"researcher",
|
|
5
|
+
"specialist"
|
|
6
|
+
];
|
|
7
|
+
const AGENT_COLLABORATION_STATUSES = [
|
|
8
|
+
"queued",
|
|
9
|
+
"starting",
|
|
10
|
+
"running",
|
|
11
|
+
"waiting",
|
|
12
|
+
"completed",
|
|
13
|
+
"failed",
|
|
14
|
+
"canceled"
|
|
15
|
+
];
|
|
16
|
+
const AGENT_COLLABORATION_CONTROL_ACTIONS = [
|
|
17
|
+
"spawn",
|
|
18
|
+
"steer",
|
|
19
|
+
"stop",
|
|
20
|
+
"close",
|
|
21
|
+
"inspect"
|
|
22
|
+
];
|
|
23
|
+
const AGENT_COLLABORATION_OUTCOMES = [
|
|
24
|
+
"completed",
|
|
25
|
+
"failed",
|
|
26
|
+
"canceled"
|
|
27
|
+
];
|
|
28
|
+
const AGENT_COLLABORATION_STOP_REASONS = [
|
|
29
|
+
"user_requested",
|
|
30
|
+
"timeout",
|
|
31
|
+
"shutdown",
|
|
32
|
+
"superseded",
|
|
33
|
+
"other"
|
|
34
|
+
];
|
|
35
|
+
const AGENT_COLLABORATION_USAGE_FIELDS = [
|
|
36
|
+
"inputTokens",
|
|
37
|
+
"outputTokens",
|
|
38
|
+
"reasoningTokens",
|
|
39
|
+
"totalTokens",
|
|
40
|
+
"modelCalls"
|
|
41
|
+
];
|
|
42
|
+
const AGENT_COLLABORATION_TITLE_MAX_LENGTH = 200;
|
|
43
|
+
const AGENT_COLLABORATION_OBJECTIVE_MAX_LENGTH = 4e3;
|
|
44
|
+
const AGENT_COLLABORATION_PROGRESS_MAX_LENGTH = 2e3;
|
|
45
|
+
const AGENT_COLLABORATION_RESULT_REFERENCES_MAX_LENGTH = 100;
|
|
46
|
+
const AGENT_COLLABORATION_GRAPH_LIMITS = Object.freeze({
|
|
47
|
+
maxNodes: 100,
|
|
48
|
+
maxDepth: 16,
|
|
49
|
+
maxChildrenPerNode: 100,
|
|
50
|
+
maxActiveNodes: 100
|
|
51
|
+
});
|
|
52
|
+
export {
|
|
53
|
+
AGENT_COLLABORATION_CONTROL_ACTIONS,
|
|
54
|
+
AGENT_COLLABORATION_GRAPH_LIMITS,
|
|
55
|
+
AGENT_COLLABORATION_OBJECTIVE_MAX_LENGTH,
|
|
56
|
+
AGENT_COLLABORATION_OUTCOMES,
|
|
57
|
+
AGENT_COLLABORATION_PROGRESS_MAX_LENGTH,
|
|
58
|
+
AGENT_COLLABORATION_RESULT_REFERENCES_MAX_LENGTH,
|
|
59
|
+
AGENT_COLLABORATION_ROLES,
|
|
60
|
+
AGENT_COLLABORATION_STATUSES,
|
|
61
|
+
AGENT_COLLABORATION_STOP_REASONS,
|
|
62
|
+
AGENT_COLLABORATION_TITLE_MAX_LENGTH,
|
|
63
|
+
AGENT_COLLABORATION_USAGE_FIELDS
|
|
64
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type AgentProtocolParseResult } from '../foundation/index.js';
|
|
2
|
+
import type { AgentConfigurationCatalog, AgentConfigurationSelectionInput } from './types.js';
|
|
3
|
+
export declare function parseAgentConfigurationCatalog(input: unknown): AgentConfigurationCatalog;
|
|
4
|
+
export declare function safeParseAgentConfigurationCatalog(input: unknown): AgentProtocolParseResult<AgentConfigurationCatalog>;
|
|
5
|
+
export declare function parseAgentConfigurationSelectionInput(input: unknown): AgentConfigurationSelectionInput;
|
|
6
|
+
export declare function safeParseAgentConfigurationSelectionInput(input: unknown): AgentProtocolParseResult<AgentConfigurationSelectionInput>;
|
|
7
|
+
export declare function safeParseAgentConfigurationSelectionFor(catalogInput: unknown, selectionInput: unknown): AgentProtocolParseResult<AgentConfigurationSelectionInput>;
|
|
8
|
+
export declare function parseAgentConfigurationSelectionFor(catalogInput: unknown, selectionInput: unknown): AgentConfigurationSelectionInput;
|
|
9
|
+
//# sourceMappingURL=parsers.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentProtocolValidationError
|
|
3
|
+
} from "../foundation/index.js";
|
|
4
|
+
import { parseWithSchema, safeParseWithSchema } from "../internal/parsers.js";
|
|
5
|
+
import {
|
|
6
|
+
AgentConfigurationCatalogSchema,
|
|
7
|
+
AgentConfigurationSelectionInputSchema
|
|
8
|
+
} from "../zod/configuration.js";
|
|
9
|
+
function parseAgentConfigurationCatalog(input) {
|
|
10
|
+
return parseWithSchema(AgentConfigurationCatalogSchema, input);
|
|
11
|
+
}
|
|
12
|
+
function safeParseAgentConfigurationCatalog(input) {
|
|
13
|
+
return safeParseWithSchema(AgentConfigurationCatalogSchema, input);
|
|
14
|
+
}
|
|
15
|
+
function parseAgentConfigurationSelectionInput(input) {
|
|
16
|
+
return parseWithSchema(AgentConfigurationSelectionInputSchema, input);
|
|
17
|
+
}
|
|
18
|
+
function safeParseAgentConfigurationSelectionInput(input) {
|
|
19
|
+
return safeParseWithSchema(AgentConfigurationSelectionInputSchema, input);
|
|
20
|
+
}
|
|
21
|
+
function issue(path, message) {
|
|
22
|
+
return { code: "custom", path, message };
|
|
23
|
+
}
|
|
24
|
+
function safeParseAgentConfigurationSelectionFor(catalogInput, selectionInput) {
|
|
25
|
+
const catalog = safeParseAgentConfigurationCatalog(catalogInput);
|
|
26
|
+
if (!catalog.success) return catalog;
|
|
27
|
+
const selection = safeParseAgentConfigurationSelectionInput(selectionInput);
|
|
28
|
+
if (!selection.success) return selection;
|
|
29
|
+
const issues = [];
|
|
30
|
+
if (selection.data.expectedCatalogRevision !== catalog.data.revision) {
|
|
31
|
+
issues.push(issue(
|
|
32
|
+
["expectedCatalogRevision"],
|
|
33
|
+
"Configuration selection must target the current catalog revision."
|
|
34
|
+
));
|
|
35
|
+
}
|
|
36
|
+
const field = catalog.data.fields.find(
|
|
37
|
+
(candidate) => candidate.key === selection.data.key
|
|
38
|
+
);
|
|
39
|
+
if (field === void 0) {
|
|
40
|
+
issues.push(issue(
|
|
41
|
+
["key"],
|
|
42
|
+
"Configuration selection must target an offered field."
|
|
43
|
+
));
|
|
44
|
+
return { success: false, issues };
|
|
45
|
+
}
|
|
46
|
+
if (selection.data.expectedFieldRevision !== field.revision) {
|
|
47
|
+
issues.push(issue(
|
|
48
|
+
["expectedFieldRevision"],
|
|
49
|
+
"Configuration selection must target the current field revision."
|
|
50
|
+
));
|
|
51
|
+
}
|
|
52
|
+
if (!field.mutable) {
|
|
53
|
+
issues.push(issue(["key"], "Configuration field is not mutable."));
|
|
54
|
+
}
|
|
55
|
+
if (selection.data.value.fieldKind !== field.fieldKind) {
|
|
56
|
+
issues.push(issue(
|
|
57
|
+
["value", "fieldKind"],
|
|
58
|
+
"Configuration value kind must match the selected field."
|
|
59
|
+
));
|
|
60
|
+
return { success: false, issues };
|
|
61
|
+
}
|
|
62
|
+
const value = selection.data.value;
|
|
63
|
+
if (field.fieldKind === "single_select" && value.fieldKind === "single_select" && !field.options.some((option) => option.optionId === value.optionId)) {
|
|
64
|
+
issues.push(issue(
|
|
65
|
+
["value", "optionId"],
|
|
66
|
+
"Configuration selection must reference an offered option."
|
|
67
|
+
));
|
|
68
|
+
}
|
|
69
|
+
if (field.fieldKind === "bounded_integer" && value.fieldKind === "bounded_integer" && (value.value < field.minimum || value.value > field.maximum)) {
|
|
70
|
+
issues.push(issue(
|
|
71
|
+
["value", "value"],
|
|
72
|
+
"Configuration integer is outside the field bounds."
|
|
73
|
+
));
|
|
74
|
+
}
|
|
75
|
+
if (field.fieldKind === "bounded_text" && value.fieldKind === "bounded_text" && value.value.length > field.maxLength) {
|
|
76
|
+
issues.push(issue(
|
|
77
|
+
["value", "value"],
|
|
78
|
+
"Configuration text exceeds the field maximum length."
|
|
79
|
+
));
|
|
80
|
+
}
|
|
81
|
+
return issues.length === 0 ? selection : { success: false, issues };
|
|
82
|
+
}
|
|
83
|
+
function parseAgentConfigurationSelectionFor(catalogInput, selectionInput) {
|
|
84
|
+
const parsed = safeParseAgentConfigurationSelectionFor(
|
|
85
|
+
catalogInput,
|
|
86
|
+
selectionInput
|
|
87
|
+
);
|
|
88
|
+
if (parsed.success) return parsed.data;
|
|
89
|
+
throw new AgentProtocolValidationError(parsed.issues);
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
parseAgentConfigurationCatalog,
|
|
93
|
+
parseAgentConfigurationSelectionFor,
|
|
94
|
+
parseAgentConfigurationSelectionInput,
|
|
95
|
+
safeParseAgentConfigurationCatalog,
|
|
96
|
+
safeParseAgentConfigurationSelectionFor,
|
|
97
|
+
safeParseAgentConfigurationSelectionInput
|
|
98
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export declare const AGENT_CONFIGURATION_FIELD_KINDS: readonly ["boolean", "single_select", "bounded_integer", "bounded_text"];
|
|
2
|
+
export declare const AGENT_CONFIGURATION_SCOPES: readonly ["session", "provider_instance"];
|
|
3
|
+
export declare const AGENT_CONFIGURATION_APPLICATION_TIMINGS: readonly ["immediate", "next_session", "provider_restart"];
|
|
4
|
+
export declare const AGENT_CONFIGURATION_FIELDS_MAX_LENGTH = 100;
|
|
5
|
+
export declare const AGENT_CONFIGURATION_OPTIONS_MAX_LENGTH = 100;
|
|
6
|
+
export declare const AGENT_CONFIGURATION_LABEL_MAX_LENGTH = 200;
|
|
7
|
+
export declare const AGENT_CONFIGURATION_DESCRIPTION_MAX_LENGTH = 2000;
|
|
8
|
+
export declare const AGENT_CONFIGURATION_TEXT_VALUE_MAX_LENGTH = 4000;
|
|
9
|
+
export type AgentConfigurationFieldKind = (typeof AGENT_CONFIGURATION_FIELD_KINDS)[number];
|
|
10
|
+
export type AgentConfigurationScope = (typeof AGENT_CONFIGURATION_SCOPES)[number];
|
|
11
|
+
export type AgentConfigurationApplicationTiming = (typeof AGENT_CONFIGURATION_APPLICATION_TIMINGS)[number];
|
|
12
|
+
export interface AgentConfigurationSelectOption {
|
|
13
|
+
readonly optionId: string;
|
|
14
|
+
readonly label: string;
|
|
15
|
+
readonly description?: string;
|
|
16
|
+
}
|
|
17
|
+
interface AgentConfigurationFieldBase {
|
|
18
|
+
readonly key: string;
|
|
19
|
+
readonly revision: number;
|
|
20
|
+
readonly label: string;
|
|
21
|
+
readonly description?: string;
|
|
22
|
+
readonly scope: AgentConfigurationScope;
|
|
23
|
+
readonly applicationTiming: AgentConfigurationApplicationTiming;
|
|
24
|
+
readonly mutable: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface AgentBooleanConfigurationField extends AgentConfigurationFieldBase {
|
|
27
|
+
readonly fieldKind: 'boolean';
|
|
28
|
+
readonly currentValue: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface AgentSingleSelectConfigurationField extends AgentConfigurationFieldBase {
|
|
31
|
+
readonly fieldKind: 'single_select';
|
|
32
|
+
readonly currentValue: string;
|
|
33
|
+
readonly options: readonly AgentConfigurationSelectOption[];
|
|
34
|
+
}
|
|
35
|
+
export interface AgentBoundedIntegerConfigurationField extends AgentConfigurationFieldBase {
|
|
36
|
+
readonly fieldKind: 'bounded_integer';
|
|
37
|
+
readonly currentValue: number;
|
|
38
|
+
readonly minimum: number;
|
|
39
|
+
readonly maximum: number;
|
|
40
|
+
}
|
|
41
|
+
export interface AgentBoundedTextConfigurationField extends AgentConfigurationFieldBase {
|
|
42
|
+
readonly fieldKind: 'bounded_text';
|
|
43
|
+
readonly currentValue: string;
|
|
44
|
+
readonly maxLength: number;
|
|
45
|
+
readonly multiline: boolean;
|
|
46
|
+
}
|
|
47
|
+
export type AgentConfigurationField = AgentBooleanConfigurationField | AgentSingleSelectConfigurationField | AgentBoundedIntegerConfigurationField | AgentBoundedTextConfigurationField;
|
|
48
|
+
export interface AgentConfigurationCatalog {
|
|
49
|
+
readonly revision: number;
|
|
50
|
+
readonly fields: readonly AgentConfigurationField[];
|
|
51
|
+
}
|
|
52
|
+
export type AgentConfigurationValue = Readonly<{
|
|
53
|
+
fieldKind: 'boolean';
|
|
54
|
+
value: boolean;
|
|
55
|
+
}> | Readonly<{
|
|
56
|
+
fieldKind: 'single_select';
|
|
57
|
+
optionId: string;
|
|
58
|
+
}> | Readonly<{
|
|
59
|
+
fieldKind: 'bounded_integer';
|
|
60
|
+
value: number;
|
|
61
|
+
}> | Readonly<{
|
|
62
|
+
fieldKind: 'bounded_text';
|
|
63
|
+
value: string;
|
|
64
|
+
}>;
|
|
65
|
+
export interface AgentConfigurationSelectionInput {
|
|
66
|
+
readonly key: string;
|
|
67
|
+
readonly expectedCatalogRevision: number;
|
|
68
|
+
readonly expectedFieldRevision: number;
|
|
69
|
+
readonly value: AgentConfigurationValue;
|
|
70
|
+
}
|
|
71
|
+
export {};
|
|
72
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const AGENT_CONFIGURATION_FIELD_KINDS = [
|
|
2
|
+
"boolean",
|
|
3
|
+
"single_select",
|
|
4
|
+
"bounded_integer",
|
|
5
|
+
"bounded_text"
|
|
6
|
+
];
|
|
7
|
+
const AGENT_CONFIGURATION_SCOPES = ["session", "provider_instance"];
|
|
8
|
+
const AGENT_CONFIGURATION_APPLICATION_TIMINGS = [
|
|
9
|
+
"immediate",
|
|
10
|
+
"next_session",
|
|
11
|
+
"provider_restart"
|
|
12
|
+
];
|
|
13
|
+
const AGENT_CONFIGURATION_FIELDS_MAX_LENGTH = 100;
|
|
14
|
+
const AGENT_CONFIGURATION_OPTIONS_MAX_LENGTH = 100;
|
|
15
|
+
const AGENT_CONFIGURATION_LABEL_MAX_LENGTH = 200;
|
|
16
|
+
const AGENT_CONFIGURATION_DESCRIPTION_MAX_LENGTH = 2e3;
|
|
17
|
+
const AGENT_CONFIGURATION_TEXT_VALUE_MAX_LENGTH = 4e3;
|
|
18
|
+
export {
|
|
19
|
+
AGENT_CONFIGURATION_APPLICATION_TIMINGS,
|
|
20
|
+
AGENT_CONFIGURATION_DESCRIPTION_MAX_LENGTH,
|
|
21
|
+
AGENT_CONFIGURATION_FIELDS_MAX_LENGTH,
|
|
22
|
+
AGENT_CONFIGURATION_FIELD_KINDS,
|
|
23
|
+
AGENT_CONFIGURATION_LABEL_MAX_LENGTH,
|
|
24
|
+
AGENT_CONFIGURATION_OPTIONS_MAX_LENGTH,
|
|
25
|
+
AGENT_CONFIGURATION_SCOPES,
|
|
26
|
+
AGENT_CONFIGURATION_TEXT_VALUE_MAX_LENGTH
|
|
27
|
+
};
|