@agen-ai/agent-protocol 0.2.2 → 0.2.4

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.
Files changed (91) hide show
  1. package/README.md +22 -12
  2. package/dist/capabilities/types.d.ts +64 -18
  3. package/dist/capabilities/types.js +0 -6
  4. package/dist/collaboration/index.d.ts +3 -0
  5. package/dist/collaboration/index.js +2 -0
  6. package/dist/collaboration/parsers.d.ts +9 -0
  7. package/dist/collaboration/parsers.js +32 -0
  8. package/dist/collaboration/types.d.ts +88 -0
  9. package/dist/collaboration/types.js +64 -0
  10. package/dist/configuration/index.d.ts +3 -0
  11. package/dist/configuration/index.js +2 -0
  12. package/dist/configuration/parsers.d.ts +9 -0
  13. package/dist/configuration/parsers.js +98 -0
  14. package/dist/configuration/types.d.ts +72 -0
  15. package/dist/configuration/types.js +27 -0
  16. package/dist/events/types.d.ts +15 -3
  17. package/dist/events/types.js +3 -0
  18. package/dist/foundation/parsers.d.ts +19 -1
  19. package/dist/foundation/parsers.js +70 -0
  20. package/dist/foundation/types.d.ts +10 -1
  21. package/dist/foundation/types.js +1 -1
  22. package/dist/integrations/index.d.ts +3 -0
  23. package/dist/integrations/index.js +2 -0
  24. package/dist/integrations/parsers.d.ts +7 -0
  25. package/dist/integrations/parsers.js +23 -0
  26. package/dist/integrations/types.d.ts +43 -0
  27. package/dist/integrations/types.js +23 -0
  28. package/dist/jsonSchema/generated.d.ts +9686 -3515
  29. package/dist/jsonSchema/generated.js +5341 -1391
  30. package/dist/managedContent/index.d.ts +3 -0
  31. package/dist/managedContent/index.js +2 -0
  32. package/dist/managedContent/parsers.d.ts +7 -0
  33. package/dist/managedContent/parsers.js +23 -0
  34. package/dist/managedContent/types.d.ts +39 -0
  35. package/dist/managedContent/types.js +21 -0
  36. package/dist/operations/index.d.ts +3 -0
  37. package/dist/operations/index.js +2 -0
  38. package/dist/operations/parsers.d.ts +15 -0
  39. package/dist/operations/parsers.js +181 -0
  40. package/dist/operations/types.d.ts +112 -0
  41. package/dist/operations/types.js +67 -0
  42. package/dist/public/collaboration.d.ts +2 -0
  43. package/dist/public/collaboration.js +1 -0
  44. package/dist/public/configuration.d.ts +2 -0
  45. package/dist/public/configuration.js +1 -0
  46. package/dist/public/index.d.ts +6 -0
  47. package/dist/public/index.js +6 -0
  48. package/dist/public/integrations.d.ts +2 -0
  49. package/dist/public/integrations.js +1 -0
  50. package/dist/public/managedContent.d.ts +2 -0
  51. package/dist/public/managedContent.js +1 -0
  52. package/dist/public/operations.d.ts +2 -0
  53. package/dist/public/operations.js +1 -0
  54. package/dist/public/resources.d.ts +2 -0
  55. package/dist/public/resources.js +1 -0
  56. package/dist/requests/parsers.js +40 -11
  57. package/dist/requests/types.d.ts +35 -8
  58. package/dist/requests/types.js +15 -1
  59. package/dist/resources/index.d.ts +3 -0
  60. package/dist/resources/index.js +2 -0
  61. package/dist/resources/parsers.d.ts +5 -0
  62. package/dist/resources/parsers.js +12 -0
  63. package/dist/resources/types.d.ts +39 -0
  64. package/dist/resources/types.js +19 -0
  65. package/dist/sessions/types.d.ts +15 -4
  66. package/dist/zod/capabilities.d.ts +103 -15
  67. package/dist/zod/capabilities.js +196 -31
  68. package/dist/zod/collaboration.d.ts +60 -0
  69. package/dist/zod/collaboration.js +155 -0
  70. package/dist/zod/configuration.d.ts +177 -0
  71. package/dist/zod/configuration.js +157 -0
  72. package/dist/zod/events.d.ts +214 -22
  73. package/dist/zod/events.js +15 -0
  74. package/dist/zod/foundation.d.ts +10 -1
  75. package/dist/zod/foundation.js +18 -0
  76. package/dist/zod/index.d.ts +7 -1
  77. package/dist/zod/index.js +62 -0
  78. package/dist/zod/integrations.d.ts +76 -0
  79. package/dist/zod/integrations.js +92 -0
  80. package/dist/zod/managedContent.d.ts +9 -0
  81. package/dist/zod/managedContent.js +70 -0
  82. package/dist/zod/operations.d.ts +339 -0
  83. package/dist/zod/operations.js +229 -0
  84. package/dist/zod/requests.d.ts +100 -11
  85. package/dist/zod/requests.js +66 -26
  86. package/dist/zod/resources.d.ts +43 -0
  87. package/dist/zod/resources.js +82 -0
  88. package/dist/zod/sessions.d.ts +168 -21
  89. package/dist/zod/sessions.js +54 -42
  90. package/dist/zod/typeEquality.generated.d.ts +40 -0
  91. package/package.json +26 -2
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './parsers.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from "./types.js";
2
+ export * from "./parsers.js";
@@ -0,0 +1,7 @@
1
+ import type { AgentProtocolParseResult } from '../foundation/index.js';
2
+ import type { AgentManagedContentCatalog, AgentManagedContentDescriptor } from './types.js';
3
+ export declare function parseAgentManagedContentDescriptor(input: unknown): AgentManagedContentDescriptor;
4
+ export declare function safeParseAgentManagedContentDescriptor(input: unknown): AgentProtocolParseResult<AgentManagedContentDescriptor>;
5
+ export declare function parseAgentManagedContentCatalog(input: unknown): AgentManagedContentCatalog;
6
+ export declare function safeParseAgentManagedContentCatalog(input: unknown): AgentProtocolParseResult<AgentManagedContentCatalog>;
7
+ //# sourceMappingURL=parsers.d.ts.map
@@ -0,0 +1,23 @@
1
+ import { parseWithSchema, safeParseWithSchema } from "../internal/parsers.js";
2
+ import {
3
+ AgentManagedContentCatalogSchema,
4
+ AgentManagedContentDescriptorSchema
5
+ } from "../zod/managedContent.js";
6
+ function parseAgentManagedContentDescriptor(input) {
7
+ return parseWithSchema(AgentManagedContentDescriptorSchema, input);
8
+ }
9
+ function safeParseAgentManagedContentDescriptor(input) {
10
+ return safeParseWithSchema(AgentManagedContentDescriptorSchema, input);
11
+ }
12
+ function parseAgentManagedContentCatalog(input) {
13
+ return parseWithSchema(AgentManagedContentCatalogSchema, input);
14
+ }
15
+ function safeParseAgentManagedContentCatalog(input) {
16
+ return safeParseWithSchema(AgentManagedContentCatalogSchema, input);
17
+ }
18
+ export {
19
+ parseAgentManagedContentCatalog,
20
+ parseAgentManagedContentDescriptor,
21
+ safeParseAgentManagedContentCatalog,
22
+ safeParseAgentManagedContentDescriptor
23
+ };
@@ -0,0 +1,39 @@
1
+ import type { AgentManagedContentId } from '../foundation/index.js';
2
+ export declare const AGENT_MANAGED_CONTENT_KINDS: readonly ["skill", "rule", "prompt", "agent_definition"];
3
+ export declare const AGENT_MANAGED_CONTENT_SOURCES: readonly ["platform", "team"];
4
+ export declare const AGENT_MANAGED_CONTENT_STATUSES: readonly ["available", "disabled"];
5
+ export declare const AGENT_MANAGED_CONTENT_NAME_MAX_LENGTH = 200;
6
+ export declare const AGENT_MANAGED_CONTENT_SUMMARY_MAX_LENGTH = 2000;
7
+ export declare const AGENT_MANAGED_CONTENT_PROMPT_MAX_LENGTH = 16384;
8
+ export declare const AGENT_MANAGED_CONTENT_CATALOG_MAX_LENGTH = 100;
9
+ export type AgentManagedContentKind = (typeof AGENT_MANAGED_CONTENT_KINDS)[number];
10
+ export type AgentManagedContentSource = (typeof AGENT_MANAGED_CONTENT_SOURCES)[number];
11
+ export type AgentManagedContentStatus = (typeof AGENT_MANAGED_CONTENT_STATUSES)[number];
12
+ export interface AgentManagedContentDigest {
13
+ readonly algorithm: 'sha256';
14
+ readonly value: string;
15
+ }
16
+ export type AgentManagedContentInvocation = Readonly<{
17
+ readonly kind: 'provider_materialization';
18
+ }> | Readonly<{
19
+ readonly kind: 'prompt_recipe';
20
+ readonly prompt: string;
21
+ readonly confirmation: 'none' | 'required';
22
+ }>;
23
+ export interface AgentManagedContentDescriptor {
24
+ readonly contentId: AgentManagedContentId;
25
+ readonly revision: number;
26
+ readonly kind: AgentManagedContentKind;
27
+ readonly source: AgentManagedContentSource;
28
+ readonly status: AgentManagedContentStatus;
29
+ readonly name: string;
30
+ readonly summary?: string;
31
+ readonly byteSize: number;
32
+ readonly digest: AgentManagedContentDigest;
33
+ readonly invocation: AgentManagedContentInvocation;
34
+ }
35
+ export interface AgentManagedContentCatalog {
36
+ readonly revision: number;
37
+ readonly entries: readonly AgentManagedContentDescriptor[];
38
+ }
39
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,21 @@
1
+ const AGENT_MANAGED_CONTENT_KINDS = [
2
+ "skill",
3
+ "rule",
4
+ "prompt",
5
+ "agent_definition"
6
+ ];
7
+ const AGENT_MANAGED_CONTENT_SOURCES = ["platform", "team"];
8
+ const AGENT_MANAGED_CONTENT_STATUSES = ["available", "disabled"];
9
+ const AGENT_MANAGED_CONTENT_NAME_MAX_LENGTH = 200;
10
+ const AGENT_MANAGED_CONTENT_SUMMARY_MAX_LENGTH = 2e3;
11
+ const AGENT_MANAGED_CONTENT_PROMPT_MAX_LENGTH = 16384;
12
+ const AGENT_MANAGED_CONTENT_CATALOG_MAX_LENGTH = 100;
13
+ export {
14
+ AGENT_MANAGED_CONTENT_CATALOG_MAX_LENGTH,
15
+ AGENT_MANAGED_CONTENT_KINDS,
16
+ AGENT_MANAGED_CONTENT_NAME_MAX_LENGTH,
17
+ AGENT_MANAGED_CONTENT_PROMPT_MAX_LENGTH,
18
+ AGENT_MANAGED_CONTENT_SOURCES,
19
+ AGENT_MANAGED_CONTENT_STATUSES,
20
+ AGENT_MANAGED_CONTENT_SUMMARY_MAX_LENGTH
21
+ };
@@ -0,0 +1,3 @@
1
+ export * from './types.js';
2
+ export * from './parsers.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export * from "./types.js";
2
+ export * from "./parsers.js";
@@ -0,0 +1,15 @@
1
+ import { type AgentProtocolParseResult } from '../foundation/index.js';
2
+ import type { AgentOperationCatalog, AgentOperationDescriptor, AgentOperationInvocation, AgentOperationResult } from './types.js';
3
+ export declare function parseAgentOperationDescriptor(input: unknown): AgentOperationDescriptor;
4
+ export declare function safeParseAgentOperationDescriptor(input: unknown): AgentProtocolParseResult<AgentOperationDescriptor>;
5
+ export declare function parseAgentOperationCatalog(input: unknown): AgentOperationCatalog;
6
+ export declare function safeParseAgentOperationCatalog(input: unknown): AgentProtocolParseResult<AgentOperationCatalog>;
7
+ export declare function parseAgentOperationInvocation(input: unknown): AgentOperationInvocation;
8
+ export declare function safeParseAgentOperationInvocation(input: unknown): AgentProtocolParseResult<AgentOperationInvocation>;
9
+ export declare function parseAgentOperationResult(input: unknown): AgentOperationResult;
10
+ export declare function safeParseAgentOperationResult(input: unknown): AgentProtocolParseResult<AgentOperationResult>;
11
+ export declare function safeParseAgentOperationInvocationFor(descriptorInput: unknown, invocationInput: unknown): AgentProtocolParseResult<AgentOperationInvocation>;
12
+ export declare function parseAgentOperationInvocationFor(descriptorInput: unknown, invocationInput: unknown): AgentOperationInvocation;
13
+ export declare function safeParseAgentOperationResultFor(descriptorInput: unknown, invocationInput: unknown, resultInput: unknown): AgentProtocolParseResult<AgentOperationResult>;
14
+ export declare function parseAgentOperationResultFor(descriptorInput: unknown, invocationInput: unknown, resultInput: unknown): AgentOperationResult;
15
+ //# sourceMappingURL=parsers.d.ts.map
@@ -0,0 +1,181 @@
1
+ import {
2
+ AgentProtocolValidationError
3
+ } from "../foundation/index.js";
4
+ import { parseWithSchema, safeParseWithSchema } from "../internal/parsers.js";
5
+ import {
6
+ AgentOperationCatalogSchema,
7
+ AgentOperationDescriptorSchema,
8
+ AgentOperationInvocationSchema,
9
+ AgentOperationResultSchema
10
+ } from "../zod/operations.js";
11
+ function parseAgentOperationDescriptor(input) {
12
+ return parseWithSchema(AgentOperationDescriptorSchema, input);
13
+ }
14
+ function safeParseAgentOperationDescriptor(input) {
15
+ return safeParseWithSchema(AgentOperationDescriptorSchema, input);
16
+ }
17
+ function parseAgentOperationCatalog(input) {
18
+ return parseWithSchema(AgentOperationCatalogSchema, input);
19
+ }
20
+ function safeParseAgentOperationCatalog(input) {
21
+ return safeParseWithSchema(AgentOperationCatalogSchema, input);
22
+ }
23
+ function parseAgentOperationInvocation(input) {
24
+ return parseWithSchema(AgentOperationInvocationSchema, input);
25
+ }
26
+ function safeParseAgentOperationInvocation(input) {
27
+ return safeParseWithSchema(AgentOperationInvocationSchema, input);
28
+ }
29
+ function parseAgentOperationResult(input) {
30
+ return parseWithSchema(AgentOperationResultSchema, input);
31
+ }
32
+ function safeParseAgentOperationResult(input) {
33
+ return safeParseWithSchema(AgentOperationResultSchema, input);
34
+ }
35
+ function issue(path, message) {
36
+ return { code: "custom", path, message };
37
+ }
38
+ function safeParseAgentOperationInvocationFor(descriptorInput, invocationInput) {
39
+ const descriptor = safeParseAgentOperationDescriptor(descriptorInput);
40
+ if (!descriptor.success) return descriptor;
41
+ const invocation = safeParseAgentOperationInvocation(invocationInput);
42
+ if (!invocation.success) return invocation;
43
+ const issues = [];
44
+ if (invocation.data.operationId !== descriptor.data.operationId) {
45
+ issues.push(issue(
46
+ ["operationId"],
47
+ "Invocation operationId must match the selected operation."
48
+ ));
49
+ }
50
+ if (invocation.data.expectedRevision !== descriptor.data.revision) {
51
+ issues.push(issue(
52
+ ["expectedRevision"],
53
+ "Invocation revision must match the selected operation revision."
54
+ ));
55
+ }
56
+ const values = new Map(
57
+ invocation.data.values.map((value) => [value.fieldId, value])
58
+ );
59
+ for (const [valueIndex, value] of invocation.data.values.entries()) {
60
+ const field = descriptor.data.fields.find(
61
+ (candidate) => candidate.fieldId === value.fieldId
62
+ );
63
+ if (field === void 0) {
64
+ issues.push(issue(
65
+ ["values", valueIndex, "fieldId"],
66
+ "Invocation fields must be declared by the selected operation."
67
+ ));
68
+ continue;
69
+ }
70
+ if (field.fieldKind !== value.fieldKind) {
71
+ issues.push(issue(
72
+ ["values", valueIndex, "fieldKind"],
73
+ "Invocation field kind must match the selected operation field."
74
+ ));
75
+ continue;
76
+ }
77
+ if (field.fieldKind === "text" && value.fieldKind === "text") {
78
+ if (value.value.length > field.maxLength) {
79
+ issues.push(issue(
80
+ ["values", valueIndex, "value"],
81
+ "Invocation text exceeds the operation field maximum."
82
+ ));
83
+ }
84
+ } else if (field.fieldKind === "single_select" && value.fieldKind === "single_select" && !field.options.some((option) => option.optionId === value.optionId)) {
85
+ issues.push(issue(
86
+ ["values", valueIndex, "optionId"],
87
+ "Invocation selection must reference an offered option."
88
+ ));
89
+ } else if (field.fieldKind === "multi_select" && value.fieldKind === "multi_select") {
90
+ const allowed = new Set(field.options.map((option) => option.optionId));
91
+ if (value.optionIds.some((optionId) => !allowed.has(optionId))) {
92
+ issues.push(issue(
93
+ ["values", valueIndex, "optionIds"],
94
+ "Invocation selections must reference offered options."
95
+ ));
96
+ }
97
+ if (value.optionIds.length > field.maxSelections) {
98
+ issues.push(issue(
99
+ ["values", valueIndex, "optionIds"],
100
+ "Invocation selections exceed the operation field maximum."
101
+ ));
102
+ }
103
+ } else if (field.fieldKind === "integer" && value.fieldKind === "integer" && (value.value < field.minimum || value.value > field.maximum)) {
104
+ issues.push(issue(
105
+ ["values", valueIndex, "value"],
106
+ "Invocation integer is outside the operation field bounds."
107
+ ));
108
+ }
109
+ }
110
+ for (const field of descriptor.data.fields) {
111
+ if (field.required && !values.has(field.fieldId)) {
112
+ issues.push(issue(
113
+ ["values"],
114
+ `Required operation field ${field.fieldId} is missing.`
115
+ ));
116
+ }
117
+ }
118
+ return issues.length === 0 ? invocation : { success: false, issues };
119
+ }
120
+ function parseAgentOperationInvocationFor(descriptorInput, invocationInput) {
121
+ const parsed = safeParseAgentOperationInvocationFor(
122
+ descriptorInput,
123
+ invocationInput
124
+ );
125
+ if (parsed.success) return parsed.data;
126
+ throw new AgentProtocolValidationError(parsed.issues);
127
+ }
128
+ function safeParseAgentOperationResultFor(descriptorInput, invocationInput, resultInput) {
129
+ const descriptor = safeParseAgentOperationDescriptor(descriptorInput);
130
+ if (!descriptor.success) return descriptor;
131
+ const invocation = safeParseAgentOperationInvocationFor(
132
+ descriptor.data,
133
+ invocationInput
134
+ );
135
+ if (!invocation.success) return invocation;
136
+ const result = safeParseAgentOperationResult(resultInput);
137
+ if (!result.success) return result;
138
+ const issues = [];
139
+ if (result.data.invocationId !== invocation.data.invocationId) {
140
+ issues.push(issue(
141
+ ["invocationId"],
142
+ "Operation result invocationId must match the invocation."
143
+ ));
144
+ }
145
+ if (result.data.status === "completed") {
146
+ const hasArtifacts = (result.data.artifactIds?.length ?? 0) > 0;
147
+ const hasResources = (result.data.resourceIds?.length ?? 0) > 0;
148
+ const hasOutputText = result.data.outputText !== void 0;
149
+ const matchesResultKind = descriptor.data.resultKind === "none" && !hasArtifacts && !hasResources && !hasOutputText || descriptor.data.resultKind === "canonical_output" && hasOutputText && !hasArtifacts && !hasResources || descriptor.data.resultKind === "artifact" && hasArtifacts && !hasResources && !hasOutputText || descriptor.data.resultKind === "resource" && hasResources && !hasArtifacts && !hasOutputText;
150
+ if (!matchesResultKind) {
151
+ issues.push(issue(
152
+ [],
153
+ "Completed operation result values must match the descriptor result kind."
154
+ ));
155
+ }
156
+ }
157
+ return issues.length === 0 ? result : { success: false, issues };
158
+ }
159
+ function parseAgentOperationResultFor(descriptorInput, invocationInput, resultInput) {
160
+ const parsed = safeParseAgentOperationResultFor(
161
+ descriptorInput,
162
+ invocationInput,
163
+ resultInput
164
+ );
165
+ if (parsed.success) return parsed.data;
166
+ throw new AgentProtocolValidationError(parsed.issues);
167
+ }
168
+ export {
169
+ parseAgentOperationCatalog,
170
+ parseAgentOperationDescriptor,
171
+ parseAgentOperationInvocation,
172
+ parseAgentOperationInvocationFor,
173
+ parseAgentOperationResult,
174
+ parseAgentOperationResultFor,
175
+ safeParseAgentOperationCatalog,
176
+ safeParseAgentOperationDescriptor,
177
+ safeParseAgentOperationInvocation,
178
+ safeParseAgentOperationInvocationFor,
179
+ safeParseAgentOperationResult,
180
+ safeParseAgentOperationResultFor
181
+ };
@@ -0,0 +1,112 @@
1
+ import type { AgentArtifactId, AgentError, AgentGeneratedResourceId, AgentOperationId, AgentOperationInvocationId, AgentRequestFieldId } from '../foundation/index.js';
2
+ export declare const AGENT_OPERATION_KINDS: readonly ["session_control", "managed_content_invoke", "configuration_select", "integration_control", "collaboration_control", "resource_generate"];
3
+ export declare const AGENT_OPERATION_CONTEXTS: readonly ["workspace", "session", "turn", "collaboration", "resource"];
4
+ export declare const AGENT_OPERATION_TIMINGS: readonly ["before_session", "idle_session", "active_turn"];
5
+ export declare const AGENT_OPERATION_EXECUTION_MODES: readonly ["immediate", "request_continuation", "durable_job"];
6
+ export declare const AGENT_OPERATION_FIELD_KINDS: readonly ["text", "boolean", "single_select", "multi_select", "integer"];
7
+ export declare const AGENT_OPERATION_RESULT_KINDS: readonly ["none", "canonical_output", "artifact", "resource"];
8
+ export declare const AGENT_OPERATION_IDEMPOTENCY_REQUIREMENTS: readonly ["required", "not_required"];
9
+ export declare const AGENT_OPERATION_TITLE_MAX_LENGTH = 200;
10
+ export declare const AGENT_OPERATION_DESCRIPTION_MAX_LENGTH = 2000;
11
+ export declare const AGENT_OPERATION_TEXT_VALUE_MAX_LENGTH = 4000;
12
+ export declare const AGENT_OPERATION_FIELDS_MAX_LENGTH = 16;
13
+ export declare const AGENT_OPERATION_OPTIONS_MAX_LENGTH = 100;
14
+ export declare const AGENT_OPERATION_CATALOG_MAX_LENGTH = 100;
15
+ export declare const AGENT_OPERATION_RESULT_REFERENCES_MAX_LENGTH = 100;
16
+ export declare const AGENT_OPERATION_OUTPUT_TEXT_MAX_LENGTH = 4000;
17
+ export type AgentOperationKind = (typeof AGENT_OPERATION_KINDS)[number];
18
+ export type AgentOperationContext = (typeof AGENT_OPERATION_CONTEXTS)[number];
19
+ export type AgentOperationTiming = (typeof AGENT_OPERATION_TIMINGS)[number];
20
+ export type AgentOperationExecutionMode = (typeof AGENT_OPERATION_EXECUTION_MODES)[number];
21
+ export type AgentOperationFieldKind = (typeof AGENT_OPERATION_FIELD_KINDS)[number];
22
+ export type AgentOperationResultKind = (typeof AGENT_OPERATION_RESULT_KINDS)[number];
23
+ export type AgentOperationIdempotencyRequirement = (typeof AGENT_OPERATION_IDEMPOTENCY_REQUIREMENTS)[number];
24
+ export interface AgentOperationSelectOption {
25
+ readonly optionId: string;
26
+ readonly label: string;
27
+ readonly description?: string;
28
+ }
29
+ interface AgentOperationFieldBase {
30
+ readonly fieldId: AgentRequestFieldId;
31
+ readonly label: string;
32
+ readonly description?: string;
33
+ readonly required: boolean;
34
+ readonly sensitivity: 'ordinary' | 'sensitive';
35
+ }
36
+ export interface AgentOperationTextField extends AgentOperationFieldBase {
37
+ readonly fieldKind: 'text';
38
+ readonly multiline: boolean;
39
+ readonly maxLength: number;
40
+ }
41
+ export interface AgentOperationBooleanField extends AgentOperationFieldBase {
42
+ readonly fieldKind: 'boolean';
43
+ }
44
+ export interface AgentOperationSingleSelectField extends AgentOperationFieldBase {
45
+ readonly fieldKind: 'single_select';
46
+ readonly options: readonly AgentOperationSelectOption[];
47
+ }
48
+ export interface AgentOperationMultiSelectField extends AgentOperationFieldBase {
49
+ readonly fieldKind: 'multi_select';
50
+ readonly options: readonly AgentOperationSelectOption[];
51
+ readonly maxSelections: number;
52
+ }
53
+ export interface AgentOperationIntegerField extends AgentOperationFieldBase {
54
+ readonly fieldKind: 'integer';
55
+ readonly minimum: number;
56
+ readonly maximum: number;
57
+ }
58
+ export type AgentOperationField = AgentOperationTextField | AgentOperationBooleanField | AgentOperationSingleSelectField | AgentOperationMultiSelectField | AgentOperationIntegerField;
59
+ export interface AgentOperationDescriptor {
60
+ readonly operationId: AgentOperationId;
61
+ readonly revision: number;
62
+ readonly kind: AgentOperationKind;
63
+ readonly title: string;
64
+ readonly description?: string;
65
+ readonly context: AgentOperationContext;
66
+ readonly timing: AgentOperationTiming;
67
+ readonly executionMode: AgentOperationExecutionMode;
68
+ readonly fields: readonly AgentOperationField[];
69
+ readonly confirmation: 'none' | 'required';
70
+ readonly idempotency: AgentOperationIdempotencyRequirement;
71
+ readonly resultKind: AgentOperationResultKind;
72
+ }
73
+ export interface AgentOperationCatalog {
74
+ readonly revision: number;
75
+ readonly operations: readonly AgentOperationDescriptor[];
76
+ }
77
+ interface AgentOperationValueBase {
78
+ readonly fieldId: AgentRequestFieldId;
79
+ }
80
+ export type AgentOperationFieldValue = (AgentOperationValueBase & Readonly<{
81
+ fieldKind: 'text';
82
+ value: string;
83
+ }>) | (AgentOperationValueBase & Readonly<{
84
+ fieldKind: 'boolean';
85
+ value: boolean;
86
+ }>) | (AgentOperationValueBase & Readonly<{
87
+ fieldKind: 'single_select';
88
+ optionId: string;
89
+ }>) | (AgentOperationValueBase & Readonly<{
90
+ fieldKind: 'multi_select';
91
+ optionIds: readonly string[];
92
+ }>) | (AgentOperationValueBase & Readonly<{
93
+ fieldKind: 'integer';
94
+ value: number;
95
+ }>);
96
+ export interface AgentOperationInvocation {
97
+ readonly invocationId: AgentOperationInvocationId;
98
+ readonly operationId: AgentOperationId;
99
+ readonly expectedRevision: number;
100
+ readonly values: readonly AgentOperationFieldValue[];
101
+ }
102
+ export type AgentOperationResultStatus = 'accepted' | 'completed' | 'failed' | 'canceled' | 'waiting_for_request';
103
+ export interface AgentOperationResult {
104
+ readonly invocationId: AgentOperationInvocationId;
105
+ readonly status: AgentOperationResultStatus;
106
+ readonly artifactIds?: readonly AgentArtifactId[];
107
+ readonly resourceIds?: readonly AgentGeneratedResourceId[];
108
+ readonly outputText?: string;
109
+ readonly error?: AgentError;
110
+ }
111
+ export {};
112
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,67 @@
1
+ const AGENT_OPERATION_KINDS = [
2
+ "session_control",
3
+ "managed_content_invoke",
4
+ "configuration_select",
5
+ "integration_control",
6
+ "collaboration_control",
7
+ "resource_generate"
8
+ ];
9
+ const AGENT_OPERATION_CONTEXTS = [
10
+ "workspace",
11
+ "session",
12
+ "turn",
13
+ "collaboration",
14
+ "resource"
15
+ ];
16
+ const AGENT_OPERATION_TIMINGS = [
17
+ "before_session",
18
+ "idle_session",
19
+ "active_turn"
20
+ ];
21
+ const AGENT_OPERATION_EXECUTION_MODES = [
22
+ "immediate",
23
+ "request_continuation",
24
+ "durable_job"
25
+ ];
26
+ const AGENT_OPERATION_FIELD_KINDS = [
27
+ "text",
28
+ "boolean",
29
+ "single_select",
30
+ "multi_select",
31
+ "integer"
32
+ ];
33
+ const AGENT_OPERATION_RESULT_KINDS = [
34
+ "none",
35
+ "canonical_output",
36
+ "artifact",
37
+ "resource"
38
+ ];
39
+ const AGENT_OPERATION_IDEMPOTENCY_REQUIREMENTS = [
40
+ "required",
41
+ "not_required"
42
+ ];
43
+ const AGENT_OPERATION_TITLE_MAX_LENGTH = 200;
44
+ const AGENT_OPERATION_DESCRIPTION_MAX_LENGTH = 2e3;
45
+ const AGENT_OPERATION_TEXT_VALUE_MAX_LENGTH = 4e3;
46
+ const AGENT_OPERATION_FIELDS_MAX_LENGTH = 16;
47
+ const AGENT_OPERATION_OPTIONS_MAX_LENGTH = 100;
48
+ const AGENT_OPERATION_CATALOG_MAX_LENGTH = 100;
49
+ const AGENT_OPERATION_RESULT_REFERENCES_MAX_LENGTH = 100;
50
+ const AGENT_OPERATION_OUTPUT_TEXT_MAX_LENGTH = 4e3;
51
+ export {
52
+ AGENT_OPERATION_CATALOG_MAX_LENGTH,
53
+ AGENT_OPERATION_CONTEXTS,
54
+ AGENT_OPERATION_DESCRIPTION_MAX_LENGTH,
55
+ AGENT_OPERATION_EXECUTION_MODES,
56
+ AGENT_OPERATION_FIELDS_MAX_LENGTH,
57
+ AGENT_OPERATION_FIELD_KINDS,
58
+ AGENT_OPERATION_IDEMPOTENCY_REQUIREMENTS,
59
+ AGENT_OPERATION_KINDS,
60
+ AGENT_OPERATION_OPTIONS_MAX_LENGTH,
61
+ AGENT_OPERATION_OUTPUT_TEXT_MAX_LENGTH,
62
+ AGENT_OPERATION_RESULT_KINDS,
63
+ AGENT_OPERATION_RESULT_REFERENCES_MAX_LENGTH,
64
+ AGENT_OPERATION_TEXT_VALUE_MAX_LENGTH,
65
+ AGENT_OPERATION_TIMINGS,
66
+ AGENT_OPERATION_TITLE_MAX_LENGTH
67
+ };
@@ -0,0 +1,2 @@
1
+ export * from '../collaboration/index.js';
2
+ //# sourceMappingURL=collaboration.d.ts.map
@@ -0,0 +1 @@
1
+ export * from "../collaboration/index.js";
@@ -0,0 +1,2 @@
1
+ export * from '../configuration/index.js';
2
+ //# sourceMappingURL=configuration.d.ts.map
@@ -0,0 +1 @@
1
+ export * from "../configuration/index.js";
@@ -2,6 +2,12 @@ export * from '../foundation/index.js';
2
2
  export * from '../sessions/index.js';
3
3
  export * from '../turns/index.js';
4
4
  export * from '../requests/index.js';
5
+ export * from '../operations/index.js';
6
+ export * from '../managedContent/index.js';
7
+ export * from '../configuration/index.js';
8
+ export * from '../integrations/index.js';
9
+ export * from '../collaboration/index.js';
10
+ export * from '../resources/index.js';
5
11
  export * from '../capabilities/index.js';
6
12
  export * from '../artifacts/index.js';
7
13
  export * from '../events/index.js';
@@ -2,6 +2,12 @@ export * from "../foundation/index.js";
2
2
  export * from "../sessions/index.js";
3
3
  export * from "../turns/index.js";
4
4
  export * from "../requests/index.js";
5
+ export * from "../operations/index.js";
6
+ export * from "../managedContent/index.js";
7
+ export * from "../configuration/index.js";
8
+ export * from "../integrations/index.js";
9
+ export * from "../collaboration/index.js";
10
+ export * from "../resources/index.js";
5
11
  export * from "../capabilities/index.js";
6
12
  export * from "../artifacts/index.js";
7
13
  export * from "../events/index.js";
@@ -0,0 +1,2 @@
1
+ export * from '../integrations/index.js';
2
+ //# sourceMappingURL=integrations.d.ts.map
@@ -0,0 +1 @@
1
+ export * from "../integrations/index.js";
@@ -0,0 +1,2 @@
1
+ export * from '../managedContent/index.js';
2
+ //# sourceMappingURL=managedContent.d.ts.map
@@ -0,0 +1 @@
1
+ export * from "../managedContent/index.js";
@@ -0,0 +1,2 @@
1
+ export * from '../operations/index.js';
2
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1 @@
1
+ export * from "../operations/index.js";
@@ -0,0 +1,2 @@
1
+ export * from '../resources/index.js';
2
+ //# sourceMappingURL=resources.d.ts.map
@@ -0,0 +1 @@
1
+ export * from "../resources/index.js";
@@ -38,20 +38,30 @@ function issue(path, message) {
38
38
  function fieldMap(request) {
39
39
  return new Map(request.fields.map((field) => [field.fieldId, field]));
40
40
  }
41
- function choiceAnswerIssues(field, answer, answerIndex) {
41
+ function singleSelectAnswerIssues(field, answer, answerIndex) {
42
42
  const issues = [];
43
43
  const allowedValues = new Set(field.options.map((option) => option.value));
44
- if (answer.values.some((value) => !allowedValues.has(value))) {
44
+ if (answer.value !== void 0 && !allowedValues.has(answer.value)) {
45
45
  issues.push(issue(
46
- ["answers", answerIndex, "values"],
47
- "Choice answers must reference options declared by the request."
46
+ ["answers", answerIndex, "value"],
47
+ "Single-select answers must reference an option declared by the request."
48
48
  ));
49
49
  }
50
- const selectionCount = answer.values.length + (answer.other === void 0 ? 0 : 1);
51
- if (!field.multiple && selectionCount > 1) {
50
+ if (answer.other !== void 0 && !field.allowOther) {
52
51
  issues.push(issue(
53
- ["answers", answerIndex],
54
- "This request field accepts only one choice."
52
+ ["answers", answerIndex, "other"],
53
+ "This request field does not accept a custom choice."
54
+ ));
55
+ }
56
+ return issues;
57
+ }
58
+ function multiSelectAnswerIssues(field, answer, answerIndex) {
59
+ const issues = [];
60
+ const allowedValues = new Set(field.options.map((option) => option.value));
61
+ if (answer.values.some((value) => !allowedValues.has(value))) {
62
+ issues.push(issue(
63
+ ["answers", answerIndex, "values"],
64
+ "Multi-select answers must reference options declared by the request."
55
65
  ));
56
66
  }
57
67
  if (answer.other !== void 0 && !field.allowOther) {
@@ -60,10 +70,17 @@ function choiceAnswerIssues(field, answer, answerIndex) {
60
70
  "This request field does not accept a custom choice."
61
71
  ));
62
72
  }
63
- if (answer.values.length === 0 && answer.other === void 0) {
73
+ const selectionCount = answer.values.length + (answer.other === void 0 ? 0 : 1);
74
+ if (field.required && selectionCount === 0) {
75
+ issues.push(issue(
76
+ ["answers", answerIndex],
77
+ "A required multi-select answer needs a declared option or a custom choice."
78
+ ));
79
+ }
80
+ if (selectionCount > field.maxSelections) {
64
81
  issues.push(issue(
65
82
  ["answers", answerIndex],
66
- "A choice answer requires a declared option or a custom choice."
83
+ "This request field exceeds its maximum selection count."
67
84
  ));
68
85
  }
69
86
  return issues;
@@ -75,7 +92,19 @@ function answerIssues(field, answer, answerIndex) {
75
92
  "Answer kind must match the corresponding request field."
76
93
  )];
77
94
  }
78
- return field.kind === "choice" && answer.kind === "choice" ? choiceAnswerIssues(field, answer, answerIndex) : [];
95
+ if (field.kind === "text" && answer.kind === "text") {
96
+ return answer.value.length <= field.maxLength ? [] : [issue(
97
+ ["answers", answerIndex, "value"],
98
+ "Text answer exceeds the field maximum length."
99
+ )];
100
+ }
101
+ if (field.kind === "single_select" && answer.kind === "single_select") {
102
+ return singleSelectAnswerIssues(field, answer, answerIndex);
103
+ }
104
+ if (field.kind === "multi_select" && answer.kind === "multi_select") {
105
+ return multiSelectAnswerIssues(field, answer, answerIndex);
106
+ }
107
+ return [];
79
108
  }
80
109
  function resolutionIssues(request, resolution) {
81
110
  const issues = [];