@agen-ai/agent-protocol 0.1.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/LICENSE +21 -0
- package/README.md +101 -0
- package/dist/artifacts/index.d.ts +3 -0
- package/dist/artifacts/index.js +2 -0
- package/dist/artifacts/parsers.d.ts +5 -0
- package/dist/artifacts/parsers.js +12 -0
- package/dist/artifacts/types.d.ts +19 -0
- package/dist/artifacts/types.js +16 -0
- package/dist/capabilities/index.d.ts +3 -0
- package/dist/capabilities/index.js +2 -0
- package/dist/capabilities/parsers.d.ts +6 -0
- package/dist/capabilities/parsers.js +18 -0
- package/dist/capabilities/types.d.ts +96 -0
- package/dist/capabilities/types.js +20 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/index.js +2 -0
- package/dist/events/parsers.d.ts +6 -0
- package/dist/events/parsers.js +16 -0
- package/dist/events/types.d.ts +78 -0
- package/dist/events/types.js +21 -0
- package/dist/foundation/index.d.ts +4 -0
- package/dist/foundation/index.js +3 -0
- package/dist/foundation/ordering.d.ts +2 -0
- package/dist/foundation/ordering.js +15 -0
- package/dist/foundation/parsers.d.ts +39 -0
- package/dist/foundation/parsers.js +148 -0
- package/dist/foundation/types.d.ts +62 -0
- package/dist/foundation/types.js +39 -0
- package/dist/foundation/validation.d.ts +16 -0
- package/dist/foundation/validation.js +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/internal/parsers.d.ts +5 -0
- package/dist/internal/parsers.js +21 -0
- package/dist/jsonSchema/generated.d.ts +6667 -0
- package/dist/jsonSchema/generated.js +4150 -0
- package/dist/jsonSchema/index.d.ts +2 -0
- package/dist/jsonSchema/index.js +1 -0
- package/dist/public/artifacts.d.ts +2 -0
- package/dist/public/artifacts.js +1 -0
- package/dist/public/capabilities.d.ts +2 -0
- package/dist/public/capabilities.js +1 -0
- package/dist/public/events.d.ts +2 -0
- package/dist/public/events.js +1 -0
- package/dist/public/index.d.ts +8 -0
- package/dist/public/index.js +7 -0
- package/dist/public/requests.d.ts +2 -0
- package/dist/public/requests.js +1 -0
- package/dist/public/sessions.d.ts +2 -0
- package/dist/public/sessions.js +1 -0
- package/dist/public/turns.d.ts +2 -0
- package/dist/public/turns.js +1 -0
- package/dist/requests/index.d.ts +3 -0
- package/dist/requests/index.js +2 -0
- package/dist/requests/parsers.d.ts +9 -0
- package/dist/requests/parsers.js +134 -0
- package/dist/requests/types.d.ts +89 -0
- package/dist/requests/types.js +0 -0
- package/dist/sessions/index.d.ts +3 -0
- package/dist/sessions/index.js +2 -0
- package/dist/sessions/parsers.d.ts +10 -0
- package/dist/sessions/parsers.js +38 -0
- package/dist/sessions/types.d.ts +37 -0
- package/dist/sessions/types.js +0 -0
- package/dist/turns/index.d.ts +3 -0
- package/dist/turns/index.js +2 -0
- package/dist/turns/parsers.d.ts +11 -0
- package/dist/turns/parsers.js +41 -0
- package/dist/turns/types.d.ts +207 -0
- package/dist/turns/types.js +62 -0
- package/dist/zod/artifacts.d.ts +4 -0
- package/dist/zod/artifacts.js +28 -0
- package/dist/zod/capabilities.d.ts +180 -0
- package/dist/zod/capabilities.js +222 -0
- package/dist/zod/events.d.ts +357 -0
- package/dist/zod/events.js +190 -0
- package/dist/zod/foundation.d.ts +45 -0
- package/dist/zod/foundation.js +205 -0
- package/dist/zod/index.d.ts +9 -0
- package/dist/zod/index.js +118 -0
- package/dist/zod/requests.d.ts +123 -0
- package/dist/zod/requests.js +174 -0
- package/dist/zod/sessions.d.ts +65 -0
- package/dist/zod/sessions.js +124 -0
- package/dist/zod/turns.d.ts +219 -0
- package/dist/zod/turns.js +400 -0
- package/dist/zod/typeEquality.generated.d.ts +51 -0
- package/dist/zod/typeEquality.generated.js +0 -0
- package/package.json +95 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./generated.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../artifacts/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../capabilities/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../events/index.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from '../foundation/index.js';
|
|
2
|
+
export * from '../sessions/index.js';
|
|
3
|
+
export * from '../turns/index.js';
|
|
4
|
+
export * from '../requests/index.js';
|
|
5
|
+
export * from '../capabilities/index.js';
|
|
6
|
+
export * from '../artifacts/index.js';
|
|
7
|
+
export * from '../events/index.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "../foundation/index.js";
|
|
2
|
+
export * from "../sessions/index.js";
|
|
3
|
+
export * from "../turns/index.js";
|
|
4
|
+
export * from "../requests/index.js";
|
|
5
|
+
export * from "../capabilities/index.js";
|
|
6
|
+
export * from "../artifacts/index.js";
|
|
7
|
+
export * from "../events/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../requests/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../sessions/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../turns/index.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type AgentProtocolParseResult } from '../foundation/index.js';
|
|
2
|
+
import type { AgentRequest, AgentRequestResolution } from './types.js';
|
|
3
|
+
export declare function parseAgentRequest(input: unknown): AgentRequest;
|
|
4
|
+
export declare function safeParseAgentRequest(input: unknown): AgentProtocolParseResult<AgentRequest>;
|
|
5
|
+
export declare function parseAgentRequestResolution(input: unknown): AgentRequestResolution;
|
|
6
|
+
export declare function safeParseAgentRequestResolution(input: unknown): AgentProtocolParseResult<AgentRequestResolution>;
|
|
7
|
+
export declare function safeParseAgentRequestResolutionFor(requestInput: unknown, resolutionInput: unknown): AgentProtocolParseResult<AgentRequestResolution>;
|
|
8
|
+
export declare function parseAgentRequestResolutionFor(requestInput: unknown, resolutionInput: unknown): AgentRequestResolution;
|
|
9
|
+
//# sourceMappingURL=parsers.d.ts.map
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AgentProtocolValidationError
|
|
3
|
+
} from "../foundation/index.js";
|
|
4
|
+
import { parseWithSchema, safeParseWithSchema } from "../internal/parsers.js";
|
|
5
|
+
import {
|
|
6
|
+
AgentRequestResolutionSchema,
|
|
7
|
+
AgentRequestSchema
|
|
8
|
+
} from "../zod/requests.js";
|
|
9
|
+
function parseAgentRequest(input) {
|
|
10
|
+
return parseWithSchema(AgentRequestSchema, input);
|
|
11
|
+
}
|
|
12
|
+
function safeParseAgentRequest(input) {
|
|
13
|
+
return safeParseWithSchema(AgentRequestSchema, input);
|
|
14
|
+
}
|
|
15
|
+
function parseAgentRequestResolution(input) {
|
|
16
|
+
return parseWithSchema(AgentRequestResolutionSchema, input);
|
|
17
|
+
}
|
|
18
|
+
function safeParseAgentRequestResolution(input) {
|
|
19
|
+
return safeParseWithSchema(AgentRequestResolutionSchema, input);
|
|
20
|
+
}
|
|
21
|
+
function issue(path, message) {
|
|
22
|
+
return { code: "custom", path, message };
|
|
23
|
+
}
|
|
24
|
+
function fieldMap(request) {
|
|
25
|
+
return new Map(request.fields.map((field) => [field.fieldId, field]));
|
|
26
|
+
}
|
|
27
|
+
function choiceAnswerIssues(field, answer, answerIndex) {
|
|
28
|
+
const issues = [];
|
|
29
|
+
const allowedValues = new Set(field.options.map((option) => option.value));
|
|
30
|
+
if (answer.values.some((value) => !allowedValues.has(value))) {
|
|
31
|
+
issues.push(issue(
|
|
32
|
+
["answers", answerIndex, "values"],
|
|
33
|
+
"Choice answers must reference options declared by the request."
|
|
34
|
+
));
|
|
35
|
+
}
|
|
36
|
+
const selectionCount = answer.values.length + (answer.other === void 0 ? 0 : 1);
|
|
37
|
+
if (!field.multiple && selectionCount > 1) {
|
|
38
|
+
issues.push(issue(
|
|
39
|
+
["answers", answerIndex],
|
|
40
|
+
"This request field accepts only one choice."
|
|
41
|
+
));
|
|
42
|
+
}
|
|
43
|
+
if (answer.other !== void 0 && !field.allowOther) {
|
|
44
|
+
issues.push(issue(
|
|
45
|
+
["answers", answerIndex, "other"],
|
|
46
|
+
"This request field does not accept a custom choice."
|
|
47
|
+
));
|
|
48
|
+
}
|
|
49
|
+
if (answer.values.length === 0 && answer.other === void 0) {
|
|
50
|
+
issues.push(issue(
|
|
51
|
+
["answers", answerIndex],
|
|
52
|
+
"A choice answer requires a declared option or a custom choice."
|
|
53
|
+
));
|
|
54
|
+
}
|
|
55
|
+
return issues;
|
|
56
|
+
}
|
|
57
|
+
function answerIssues(field, answer, answerIndex) {
|
|
58
|
+
if (field.kind !== answer.kind) {
|
|
59
|
+
return [issue(
|
|
60
|
+
["answers", answerIndex, "kind"],
|
|
61
|
+
"Answer kind must match the corresponding request field."
|
|
62
|
+
)];
|
|
63
|
+
}
|
|
64
|
+
return field.kind === "choice" && answer.kind === "choice" ? choiceAnswerIssues(field, answer, answerIndex) : [];
|
|
65
|
+
}
|
|
66
|
+
function resolutionIssues(request, resolution) {
|
|
67
|
+
const issues = [];
|
|
68
|
+
if (request.requestKind !== resolution.requestKind) {
|
|
69
|
+
issues.push(issue(
|
|
70
|
+
["requestKind"],
|
|
71
|
+
"Resolution kind must match the request kind."
|
|
72
|
+
));
|
|
73
|
+
}
|
|
74
|
+
if (request.requestId !== resolution.requestId) {
|
|
75
|
+
issues.push(issue(
|
|
76
|
+
["requestId"],
|
|
77
|
+
"Resolution requestId must match the opened request."
|
|
78
|
+
));
|
|
79
|
+
}
|
|
80
|
+
if (request.requestKind !== "elicitation" || resolution.requestKind !== "elicitation" || resolution.disposition !== "answered") {
|
|
81
|
+
return issues;
|
|
82
|
+
}
|
|
83
|
+
const fields = fieldMap(request);
|
|
84
|
+
const answered = /* @__PURE__ */ new Set();
|
|
85
|
+
resolution.answers.forEach((answer, answerIndex) => {
|
|
86
|
+
if (answered.has(answer.fieldId)) {
|
|
87
|
+
issues.push(issue(
|
|
88
|
+
["answers", answerIndex, "fieldId"],
|
|
89
|
+
"Each request field may be answered once."
|
|
90
|
+
));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
answered.add(answer.fieldId);
|
|
94
|
+
const field = fields.get(answer.fieldId);
|
|
95
|
+
if (!field) {
|
|
96
|
+
issues.push(issue(
|
|
97
|
+
["answers", answerIndex, "fieldId"],
|
|
98
|
+
"Answer fieldId must reference a field declared by the request."
|
|
99
|
+
));
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
issues.push(...answerIssues(field, answer, answerIndex));
|
|
103
|
+
});
|
|
104
|
+
for (const field of request.fields) {
|
|
105
|
+
if (field.required && !answered.has(field.fieldId)) {
|
|
106
|
+
issues.push(issue(
|
|
107
|
+
["answers"],
|
|
108
|
+
`Required request field ${field.fieldId} is missing an answer.`
|
|
109
|
+
));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return issues;
|
|
113
|
+
}
|
|
114
|
+
function safeParseAgentRequestResolutionFor(requestInput, resolutionInput) {
|
|
115
|
+
const request = safeParseAgentRequest(requestInput);
|
|
116
|
+
if (!request.success) return request;
|
|
117
|
+
const resolution = safeParseAgentRequestResolution(resolutionInput);
|
|
118
|
+
if (!resolution.success) return resolution;
|
|
119
|
+
const issues = resolutionIssues(request.data, resolution.data);
|
|
120
|
+
return issues.length === 0 ? resolution : { success: false, issues };
|
|
121
|
+
}
|
|
122
|
+
function parseAgentRequestResolutionFor(requestInput, resolutionInput) {
|
|
123
|
+
const parsed = safeParseAgentRequestResolutionFor(requestInput, resolutionInput);
|
|
124
|
+
if (parsed.success) return parsed.data;
|
|
125
|
+
throw new AgentProtocolValidationError(parsed.issues);
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
parseAgentRequest,
|
|
129
|
+
parseAgentRequestResolution,
|
|
130
|
+
parseAgentRequestResolutionFor,
|
|
131
|
+
safeParseAgentRequest,
|
|
132
|
+
safeParseAgentRequestResolution,
|
|
133
|
+
safeParseAgentRequestResolutionFor
|
|
134
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { AgentArtifactId, AgentIsoDateTime, AgentRequestFieldId, AgentRequestId } from '../foundation/index.js';
|
|
2
|
+
interface AgentApprovalSubjectBase {
|
|
3
|
+
readonly title: string;
|
|
4
|
+
readonly description?: string;
|
|
5
|
+
}
|
|
6
|
+
export type AgentApprovalSubject = (AgentApprovalSubjectBase & Readonly<{
|
|
7
|
+
kind: 'plan';
|
|
8
|
+
artifactId: AgentArtifactId;
|
|
9
|
+
}>) | (AgentApprovalSubjectBase & Readonly<{
|
|
10
|
+
kind: 'command' | 'file_change' | 'tool' | 'other';
|
|
11
|
+
artifactId?: never;
|
|
12
|
+
}>);
|
|
13
|
+
export interface AgentApprovalRequest {
|
|
14
|
+
readonly requestKind: 'approval';
|
|
15
|
+
readonly requestId: AgentRequestId;
|
|
16
|
+
readonly prompt: string;
|
|
17
|
+
readonly subject: AgentApprovalSubject;
|
|
18
|
+
readonly expiresAt?: AgentIsoDateTime;
|
|
19
|
+
}
|
|
20
|
+
export interface AgentRequestChoice {
|
|
21
|
+
readonly value: string;
|
|
22
|
+
readonly label: string;
|
|
23
|
+
readonly description?: string;
|
|
24
|
+
}
|
|
25
|
+
interface AgentElicitationFieldBase {
|
|
26
|
+
readonly fieldId: AgentRequestFieldId;
|
|
27
|
+
readonly label: string;
|
|
28
|
+
readonly description?: string;
|
|
29
|
+
readonly required: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface AgentTextElicitationField extends AgentElicitationFieldBase {
|
|
32
|
+
readonly kind: 'text';
|
|
33
|
+
readonly multiline?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface AgentChoiceElicitationField extends AgentElicitationFieldBase {
|
|
36
|
+
readonly kind: 'choice';
|
|
37
|
+
readonly options: readonly AgentRequestChoice[];
|
|
38
|
+
readonly multiple: boolean;
|
|
39
|
+
readonly allowOther: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface AgentBooleanElicitationField extends AgentElicitationFieldBase {
|
|
42
|
+
readonly kind: 'boolean';
|
|
43
|
+
}
|
|
44
|
+
export type AgentElicitationField = AgentTextElicitationField | AgentChoiceElicitationField | AgentBooleanElicitationField;
|
|
45
|
+
export interface AgentElicitationRequest {
|
|
46
|
+
readonly requestKind: 'elicitation';
|
|
47
|
+
readonly requestId: AgentRequestId;
|
|
48
|
+
readonly prompt: string;
|
|
49
|
+
readonly fields: readonly AgentElicitationField[];
|
|
50
|
+
readonly expiresAt?: AgentIsoDateTime;
|
|
51
|
+
}
|
|
52
|
+
export type AgentRequest = AgentApprovalRequest | AgentElicitationRequest;
|
|
53
|
+
export interface AgentApprovalResolution {
|
|
54
|
+
readonly requestKind: 'approval';
|
|
55
|
+
readonly requestId: AgentRequestId;
|
|
56
|
+
readonly decision: 'approved' | 'denied' | 'canceled';
|
|
57
|
+
}
|
|
58
|
+
export interface AgentTextElicitationAnswer {
|
|
59
|
+
readonly fieldId: AgentRequestFieldId;
|
|
60
|
+
readonly kind: 'text';
|
|
61
|
+
readonly value: string;
|
|
62
|
+
}
|
|
63
|
+
export interface AgentChoiceElicitationAnswer {
|
|
64
|
+
readonly fieldId: AgentRequestFieldId;
|
|
65
|
+
readonly kind: 'choice';
|
|
66
|
+
readonly values: readonly string[];
|
|
67
|
+
readonly other?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface AgentBooleanElicitationAnswer {
|
|
70
|
+
readonly fieldId: AgentRequestFieldId;
|
|
71
|
+
readonly kind: 'boolean';
|
|
72
|
+
readonly value: boolean;
|
|
73
|
+
}
|
|
74
|
+
export type AgentElicitationAnswer = AgentTextElicitationAnswer | AgentChoiceElicitationAnswer | AgentBooleanElicitationAnswer;
|
|
75
|
+
export interface AgentAnsweredElicitationResolution {
|
|
76
|
+
readonly requestKind: 'elicitation';
|
|
77
|
+
readonly requestId: AgentRequestId;
|
|
78
|
+
readonly disposition: 'answered';
|
|
79
|
+
readonly answers: readonly AgentElicitationAnswer[];
|
|
80
|
+
}
|
|
81
|
+
export interface AgentCanceledElicitationResolution {
|
|
82
|
+
readonly requestKind: 'elicitation';
|
|
83
|
+
readonly requestId: AgentRequestId;
|
|
84
|
+
readonly disposition: 'canceled';
|
|
85
|
+
}
|
|
86
|
+
export type AgentElicitationResolution = AgentAnsweredElicitationResolution | AgentCanceledElicitationResolution;
|
|
87
|
+
export type AgentRequestResolution = AgentApprovalResolution | AgentElicitationResolution;
|
|
88
|
+
export {};
|
|
89
|
+
//# sourceMappingURL=types.d.ts.map
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AgentProtocolParseResult } from '../foundation/index.js';
|
|
2
|
+
import type { AgentSessionBinding, AgentSessionConfiguration, AgentSessionOpenInput } from './types.js';
|
|
3
|
+
export declare function parseAgentSessionBinding(input: unknown): AgentSessionBinding;
|
|
4
|
+
export declare function safeParseAgentSessionBinding(input: unknown): AgentProtocolParseResult<AgentSessionBinding>;
|
|
5
|
+
export declare function parseAgentSessionConfiguration(input: unknown): AgentSessionConfiguration;
|
|
6
|
+
export declare function safeParseAgentSessionConfiguration(input: unknown): AgentProtocolParseResult<AgentSessionConfiguration>;
|
|
7
|
+
export declare function parseAgentSessionOpenInput(input: unknown): AgentSessionOpenInput;
|
|
8
|
+
export declare function safeParseAgentSessionOpenInput(input: unknown): AgentProtocolParseResult<AgentSessionOpenInput>;
|
|
9
|
+
export declare function matchesAgentSessionBinding(actual: unknown, expected: unknown): boolean;
|
|
10
|
+
//# sourceMappingURL=parsers.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { parseWithSchema, safeParseWithSchema } from "../internal/parsers.js";
|
|
2
|
+
import {
|
|
3
|
+
AgentSessionBindingSchema,
|
|
4
|
+
AgentSessionConfigurationSchema,
|
|
5
|
+
AgentSessionOpenInputSchema
|
|
6
|
+
} from "../zod/sessions.js";
|
|
7
|
+
function parseAgentSessionBinding(input) {
|
|
8
|
+
return parseWithSchema(AgentSessionBindingSchema, input);
|
|
9
|
+
}
|
|
10
|
+
function safeParseAgentSessionBinding(input) {
|
|
11
|
+
return safeParseWithSchema(AgentSessionBindingSchema, input);
|
|
12
|
+
}
|
|
13
|
+
function parseAgentSessionConfiguration(input) {
|
|
14
|
+
return parseWithSchema(AgentSessionConfigurationSchema, input);
|
|
15
|
+
}
|
|
16
|
+
function safeParseAgentSessionConfiguration(input) {
|
|
17
|
+
return safeParseWithSchema(AgentSessionConfigurationSchema, input);
|
|
18
|
+
}
|
|
19
|
+
function parseAgentSessionOpenInput(input) {
|
|
20
|
+
return parseWithSchema(AgentSessionOpenInputSchema, input);
|
|
21
|
+
}
|
|
22
|
+
function safeParseAgentSessionOpenInput(input) {
|
|
23
|
+
return safeParseWithSchema(AgentSessionOpenInputSchema, input);
|
|
24
|
+
}
|
|
25
|
+
function matchesAgentSessionBinding(actual, expected) {
|
|
26
|
+
const parsedActual = safeParseAgentSessionBinding(actual);
|
|
27
|
+
const parsedExpected = safeParseAgentSessionBinding(expected);
|
|
28
|
+
return parsedActual.success && parsedExpected.success && parsedActual.data.conversationId === parsedExpected.data.conversationId && parsedActual.data.historyAnchor === parsedExpected.data.historyAnchor;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
matchesAgentSessionBinding,
|
|
32
|
+
parseAgentSessionBinding,
|
|
33
|
+
parseAgentSessionConfiguration,
|
|
34
|
+
parseAgentSessionOpenInput,
|
|
35
|
+
safeParseAgentSessionBinding,
|
|
36
|
+
safeParseAgentSessionConfiguration,
|
|
37
|
+
safeParseAgentSessionOpenInput
|
|
38
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AgentConfigurationRevisionId, AgentJsonValue, AgentProviderConversationId, AgentProviderHistoryAnchor, AgentSessionId, AgentTurnId } from '../foundation/index.js';
|
|
2
|
+
export interface AgentSessionBinding {
|
|
3
|
+
readonly conversationId: AgentProviderConversationId;
|
|
4
|
+
readonly historyAnchor?: AgentProviderHistoryAnchor;
|
|
5
|
+
}
|
|
6
|
+
export interface AgentSessionConfiguration {
|
|
7
|
+
readonly revision: AgentConfigurationRevisionId;
|
|
8
|
+
readonly values: Readonly<Record<string, AgentJsonValue>>;
|
|
9
|
+
}
|
|
10
|
+
export interface AgentSessionCreateInput {
|
|
11
|
+
readonly operation: 'create';
|
|
12
|
+
readonly sessionId: AgentSessionId;
|
|
13
|
+
readonly configuration: AgentSessionConfiguration;
|
|
14
|
+
}
|
|
15
|
+
export interface AgentSessionResumeInput {
|
|
16
|
+
readonly operation: 'resume';
|
|
17
|
+
readonly sessionId: AgentSessionId;
|
|
18
|
+
readonly binding: AgentSessionBinding;
|
|
19
|
+
readonly configuration: AgentSessionConfiguration;
|
|
20
|
+
}
|
|
21
|
+
export interface AgentSessionBranchSource {
|
|
22
|
+
readonly sessionId: AgentSessionId;
|
|
23
|
+
readonly binding: AgentSessionBinding;
|
|
24
|
+
readonly throughTurn: Readonly<{
|
|
25
|
+
turnId: AgentTurnId;
|
|
26
|
+
historyAnchor: AgentProviderHistoryAnchor;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
export interface AgentSessionBranchInput {
|
|
30
|
+
readonly operation: 'branch';
|
|
31
|
+
readonly sessionId: AgentSessionId;
|
|
32
|
+
readonly source: AgentSessionBranchSource;
|
|
33
|
+
readonly configuration: AgentSessionConfiguration;
|
|
34
|
+
}
|
|
35
|
+
export type AgentSessionOpenInput = AgentSessionCreateInput | AgentSessionResumeInput | AgentSessionBranchInput;
|
|
36
|
+
export type AgentSessionOpenDisposition = 'created' | 'resumed' | 'branched';
|
|
37
|
+
//# sourceMappingURL=types.d.ts.map
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AgentProtocolParseResult } from '../foundation/index.js';
|
|
2
|
+
import type { AgentItemSnapshot, AgentTurnInputContent, AgentTurnInterruptionInput, AgentTurnRunInput } from './types.js';
|
|
3
|
+
export declare function parseAgentTurnInputContent(input: unknown): AgentTurnInputContent;
|
|
4
|
+
export declare function safeParseAgentTurnInputContent(input: unknown): AgentProtocolParseResult<AgentTurnInputContent>;
|
|
5
|
+
export declare function parseAgentTurnRunInput(input: unknown): AgentTurnRunInput;
|
|
6
|
+
export declare function safeParseAgentTurnRunInput(input: unknown): AgentProtocolParseResult<AgentTurnRunInput>;
|
|
7
|
+
export declare function parseAgentTurnInterruptionInput(input: unknown): AgentTurnInterruptionInput;
|
|
8
|
+
export declare function safeParseAgentTurnInterruptionInput(input: unknown): AgentProtocolParseResult<AgentTurnInterruptionInput>;
|
|
9
|
+
export declare function parseAgentItemSnapshot(input: unknown): AgentItemSnapshot;
|
|
10
|
+
export declare function safeParseAgentItemSnapshot(input: unknown): AgentProtocolParseResult<AgentItemSnapshot>;
|
|
11
|
+
//# sourceMappingURL=parsers.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { parseWithSchema, safeParseWithSchema } from "../internal/parsers.js";
|
|
2
|
+
import {
|
|
3
|
+
AgentItemSnapshotSchema,
|
|
4
|
+
AgentTurnInputContentSchema,
|
|
5
|
+
AgentTurnInterruptionInputSchema,
|
|
6
|
+
AgentTurnRunInputSchema
|
|
7
|
+
} from "../zod/turns.js";
|
|
8
|
+
function parseAgentTurnInputContent(input) {
|
|
9
|
+
return parseWithSchema(AgentTurnInputContentSchema, input);
|
|
10
|
+
}
|
|
11
|
+
function safeParseAgentTurnInputContent(input) {
|
|
12
|
+
return safeParseWithSchema(AgentTurnInputContentSchema, input);
|
|
13
|
+
}
|
|
14
|
+
function parseAgentTurnRunInput(input) {
|
|
15
|
+
return parseWithSchema(AgentTurnRunInputSchema, input);
|
|
16
|
+
}
|
|
17
|
+
function safeParseAgentTurnRunInput(input) {
|
|
18
|
+
return safeParseWithSchema(AgentTurnRunInputSchema, input);
|
|
19
|
+
}
|
|
20
|
+
function parseAgentTurnInterruptionInput(input) {
|
|
21
|
+
return parseWithSchema(AgentTurnInterruptionInputSchema, input);
|
|
22
|
+
}
|
|
23
|
+
function safeParseAgentTurnInterruptionInput(input) {
|
|
24
|
+
return safeParseWithSchema(AgentTurnInterruptionInputSchema, input);
|
|
25
|
+
}
|
|
26
|
+
function parseAgentItemSnapshot(input) {
|
|
27
|
+
return parseWithSchema(AgentItemSnapshotSchema, input);
|
|
28
|
+
}
|
|
29
|
+
function safeParseAgentItemSnapshot(input) {
|
|
30
|
+
return safeParseWithSchema(AgentItemSnapshotSchema, input);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
parseAgentItemSnapshot,
|
|
34
|
+
parseAgentTurnInputContent,
|
|
35
|
+
parseAgentTurnInterruptionInput,
|
|
36
|
+
parseAgentTurnRunInput,
|
|
37
|
+
safeParseAgentItemSnapshot,
|
|
38
|
+
safeParseAgentTurnInputContent,
|
|
39
|
+
safeParseAgentTurnInterruptionInput,
|
|
40
|
+
safeParseAgentTurnRunInput
|
|
41
|
+
};
|