@adea-ai/contracts 1.26.1 → 2.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/dist/control-api.d.ts +0 -203
- package/dist/control-api.js +0 -33
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/package.json +5 -1
- package/dist/graphs.d.ts +0 -147
- package/dist/graphs.js +0 -229
package/dist/control-api.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { GraphReferenceSchema } from './graphs.js';
|
|
3
2
|
import { ServiceCallerAssertionSchema } from './authentication.js';
|
|
4
3
|
import { CorrelationMetadataSchema } from './envelopes.js';
|
|
5
4
|
import { IdentifierSchemas } from './identifiers.js';
|
|
@@ -107,192 +106,6 @@ export declare const ProfileResolutionResponseSchema: z.ZodObject<{
|
|
|
107
106
|
skillVersionIds: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"skill-version ID">, string>>>;
|
|
108
107
|
}, z.core.$strip>;
|
|
109
108
|
}, z.core.$strip>;
|
|
110
|
-
declare const GraphLifecyclePayloadSchema: z.ZodObject<{
|
|
111
|
-
reference: typeof GraphReferenceSchema;
|
|
112
|
-
expectedRevision: z.ZodNumber;
|
|
113
|
-
reason: z.ZodString;
|
|
114
|
-
}, z.core.$strict>;
|
|
115
|
-
export declare const GraphDefinitionPublishRequestSchema: z.ZodObject<{
|
|
116
|
-
caller: typeof ServiceCallerAssertionSchema;
|
|
117
|
-
contractVersion: typeof ContractVersionSchema;
|
|
118
|
-
requestId: typeof IdentifierSchemas.requestId;
|
|
119
|
-
workspaceId: typeof IdentifierSchemas.workspaceId;
|
|
120
|
-
correlation: typeof CorrelationMetadataSchema;
|
|
121
|
-
commandId: typeof IdentifierSchemas.commandId;
|
|
122
|
-
idempotencyKey: typeof IdempotencyKeySchema;
|
|
123
|
-
payloadHash: typeof PayloadHashSchema;
|
|
124
|
-
operation: z.ZodLiteral<"graph.publish">;
|
|
125
|
-
issuedAt: typeof TimestampSchema;
|
|
126
|
-
payload: z.ZodObject<{
|
|
127
|
-
definition: z.ZodObject<{
|
|
128
|
-
graphDefinitionId: z.ZodString;
|
|
129
|
-
graphVersion: z.ZodString;
|
|
130
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
131
|
-
nodes: z.ZodArray<z.ZodObject<{
|
|
132
|
-
node: z.ZodString;
|
|
133
|
-
join: z.ZodOptional<z.ZodEnum<{
|
|
134
|
-
all: "all";
|
|
135
|
-
any: "any";
|
|
136
|
-
}>>;
|
|
137
|
-
operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
138
|
-
kind: z.ZodEnum<{
|
|
139
|
-
delegation: "delegation";
|
|
140
|
-
model: "model";
|
|
141
|
-
runtime: "runtime";
|
|
142
|
-
}>;
|
|
143
|
-
name: z.ZodString;
|
|
144
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
145
|
-
kind: z.ZodLiteral<"tool">;
|
|
146
|
-
name: z.ZodString;
|
|
147
|
-
toolPin: z.ZodOptional<z.ZodObject<{
|
|
148
|
-
toolDefinitionId: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"tool-definition ID">, string>>;
|
|
149
|
-
toolVersionId: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"tool-version ID">, string>>;
|
|
150
|
-
contentDigest: z.ZodString;
|
|
151
|
-
operation: z.ZodString;
|
|
152
|
-
}, z.core.$strict>>;
|
|
153
|
-
}, z.core.$strict>], "kind">;
|
|
154
|
-
}, z.core.$strict>>;
|
|
155
|
-
edges: z.ZodArray<z.ZodObject<{
|
|
156
|
-
from: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"__start__">]>;
|
|
157
|
-
to: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"__end__">]>;
|
|
158
|
-
when: z.ZodOptional<z.ZodObject<{
|
|
159
|
-
path: z.ZodArray<z.ZodString>;
|
|
160
|
-
equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
161
|
-
}, z.core.$strict>>;
|
|
162
|
-
}, z.core.$strict>>;
|
|
163
|
-
schemas: z.ZodObject<{
|
|
164
|
-
input: z.ZodString;
|
|
165
|
-
state: z.ZodString;
|
|
166
|
-
output: z.ZodString;
|
|
167
|
-
}, z.core.$strict>;
|
|
168
|
-
requiredCapabilities: z.ZodArray<z.ZodString>;
|
|
169
|
-
compatibility: z.ZodObject<{
|
|
170
|
-
contractMajorVersions: z.ZodArray<z.ZodNumber>;
|
|
171
|
-
compilerVersions: z.ZodArray<z.ZodString>;
|
|
172
|
-
adapterVersions: z.ZodArray<z.ZodString>;
|
|
173
|
-
}, z.core.$strict>;
|
|
174
|
-
}, z.core.$strict>;
|
|
175
|
-
}, z.core.$strict>;
|
|
176
|
-
}, z.core.$strict>;
|
|
177
|
-
export declare const GraphDefinitionDeprecationRequestSchema: z.ZodObject<{
|
|
178
|
-
caller: typeof ServiceCallerAssertionSchema;
|
|
179
|
-
contractVersion: typeof ContractVersionSchema;
|
|
180
|
-
requestId: typeof IdentifierSchemas.requestId;
|
|
181
|
-
workspaceId: typeof IdentifierSchemas.workspaceId;
|
|
182
|
-
correlation: typeof CorrelationMetadataSchema;
|
|
183
|
-
commandId: typeof IdentifierSchemas.commandId;
|
|
184
|
-
idempotencyKey: typeof IdempotencyKeySchema;
|
|
185
|
-
payloadHash: typeof PayloadHashSchema;
|
|
186
|
-
operation: z.ZodLiteral<"graph.deprecate">;
|
|
187
|
-
issuedAt: typeof TimestampSchema;
|
|
188
|
-
payload: typeof GraphLifecyclePayloadSchema;
|
|
189
|
-
}, z.core.$strict>;
|
|
190
|
-
export declare const GraphDefinitionRevocationRequestSchema: z.ZodObject<{
|
|
191
|
-
caller: typeof ServiceCallerAssertionSchema;
|
|
192
|
-
contractVersion: typeof ContractVersionSchema;
|
|
193
|
-
requestId: typeof IdentifierSchemas.requestId;
|
|
194
|
-
workspaceId: typeof IdentifierSchemas.workspaceId;
|
|
195
|
-
correlation: typeof CorrelationMetadataSchema;
|
|
196
|
-
commandId: typeof IdentifierSchemas.commandId;
|
|
197
|
-
idempotencyKey: typeof IdempotencyKeySchema;
|
|
198
|
-
payloadHash: typeof PayloadHashSchema;
|
|
199
|
-
operation: z.ZodLiteral<"graph.revoke">;
|
|
200
|
-
issuedAt: typeof TimestampSchema;
|
|
201
|
-
payload: typeof GraphLifecyclePayloadSchema;
|
|
202
|
-
}, z.core.$strict>;
|
|
203
|
-
export declare const GraphDefinitionResolutionRequestSchema: z.ZodObject<{
|
|
204
|
-
caller: typeof ServiceCallerAssertionSchema;
|
|
205
|
-
contractVersion: typeof ContractVersionSchema;
|
|
206
|
-
requestId: typeof IdentifierSchemas.requestId;
|
|
207
|
-
workspaceId: typeof IdentifierSchemas.workspaceId;
|
|
208
|
-
correlation: typeof CorrelationMetadataSchema;
|
|
209
|
-
operation: z.ZodLiteral<"graph.resolve">;
|
|
210
|
-
requestedAt: typeof TimestampSchema;
|
|
211
|
-
parameters: z.ZodObject<{
|
|
212
|
-
reference: z.ZodObject<{
|
|
213
|
-
graphDefinitionId: z.ZodString;
|
|
214
|
-
graphVersion: z.ZodString;
|
|
215
|
-
contentDigest: z.ZodString;
|
|
216
|
-
}, z.core.$strict>;
|
|
217
|
-
}, z.core.$strict>;
|
|
218
|
-
}, z.core.$strict>;
|
|
219
|
-
export declare const GraphDefinitionResponseSchema: z.ZodObject<{
|
|
220
|
-
contractVersion: typeof ContractVersionSchema;
|
|
221
|
-
requestId: typeof IdentifierSchemas.requestId;
|
|
222
|
-
correlation: typeof CorrelationMetadataSchema;
|
|
223
|
-
data: z.ZodObject<{
|
|
224
|
-
definition: z.ZodObject<{
|
|
225
|
-
reference: z.ZodObject<{
|
|
226
|
-
graphDefinitionId: z.ZodString;
|
|
227
|
-
graphVersion: z.ZodString;
|
|
228
|
-
contentDigest: z.ZodString;
|
|
229
|
-
}, z.core.$strict>;
|
|
230
|
-
revision: z.ZodNumber;
|
|
231
|
-
lifecycle: z.ZodEnum<{
|
|
232
|
-
deprecated: "deprecated";
|
|
233
|
-
published: "published";
|
|
234
|
-
revoked: "revoked";
|
|
235
|
-
}>;
|
|
236
|
-
digestVersion: z.ZodOptional<z.ZodLiteral<"canonical-json-v1">>;
|
|
237
|
-
content: z.ZodObject<{
|
|
238
|
-
graphDefinitionId: z.ZodString;
|
|
239
|
-
graphVersion: z.ZodString;
|
|
240
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
241
|
-
nodes: z.ZodArray<z.ZodObject<{
|
|
242
|
-
node: z.ZodString;
|
|
243
|
-
join: z.ZodOptional<z.ZodEnum<{
|
|
244
|
-
all: "all";
|
|
245
|
-
any: "any";
|
|
246
|
-
}>>;
|
|
247
|
-
operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
248
|
-
kind: z.ZodEnum<{
|
|
249
|
-
delegation: "delegation";
|
|
250
|
-
model: "model";
|
|
251
|
-
runtime: "runtime";
|
|
252
|
-
}>;
|
|
253
|
-
name: z.ZodString;
|
|
254
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
255
|
-
kind: z.ZodLiteral<"tool">;
|
|
256
|
-
name: z.ZodString;
|
|
257
|
-
toolPin: z.ZodOptional<z.ZodObject<{
|
|
258
|
-
toolDefinitionId: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"tool-definition ID">, string>>;
|
|
259
|
-
toolVersionId: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"tool-version ID">, string>>;
|
|
260
|
-
contentDigest: z.ZodString;
|
|
261
|
-
operation: z.ZodString;
|
|
262
|
-
}, z.core.$strict>>;
|
|
263
|
-
}, z.core.$strict>], "kind">;
|
|
264
|
-
}, z.core.$strict>>;
|
|
265
|
-
edges: z.ZodArray<z.ZodObject<{
|
|
266
|
-
from: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"__start__">]>;
|
|
267
|
-
to: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"__end__">]>;
|
|
268
|
-
when: z.ZodOptional<z.ZodObject<{
|
|
269
|
-
path: z.ZodArray<z.ZodString>;
|
|
270
|
-
equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
271
|
-
}, z.core.$strict>>;
|
|
272
|
-
}, z.core.$strict>>;
|
|
273
|
-
schemas: z.ZodObject<{
|
|
274
|
-
input: z.ZodString;
|
|
275
|
-
state: z.ZodString;
|
|
276
|
-
output: z.ZodString;
|
|
277
|
-
}, z.core.$strict>;
|
|
278
|
-
requiredCapabilities: z.ZodArray<z.ZodString>;
|
|
279
|
-
compatibility: z.ZodObject<{
|
|
280
|
-
contractMajorVersions: z.ZodArray<z.ZodNumber>;
|
|
281
|
-
compilerVersions: z.ZodArray<z.ZodString>;
|
|
282
|
-
adapterVersions: z.ZodArray<z.ZodString>;
|
|
283
|
-
}, z.core.$strict>;
|
|
284
|
-
}, z.core.$strict>;
|
|
285
|
-
publishedAt: z.ZodISODateTime;
|
|
286
|
-
changedAt: z.ZodISODateTime;
|
|
287
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
288
|
-
}, z.core.$strict>;
|
|
289
|
-
}, z.core.$strict>;
|
|
290
|
-
}, z.core.$strip>;
|
|
291
|
-
export type GraphDefinitionPublishRequest = z.input<typeof GraphDefinitionPublishRequestSchema>;
|
|
292
|
-
export type GraphDefinitionDeprecationRequest = z.input<typeof GraphDefinitionDeprecationRequestSchema>;
|
|
293
|
-
export type GraphDefinitionRevocationRequest = z.input<typeof GraphDefinitionRevocationRequestSchema>;
|
|
294
|
-
export type GraphDefinitionResolutionRequest = z.input<typeof GraphDefinitionResolutionRequestSchema>;
|
|
295
|
-
export type GraphDefinitionResponse = z.output<typeof GraphDefinitionResponseSchema>;
|
|
296
109
|
declare const CredentialReferenceSchema: z.ZodString;
|
|
297
110
|
/**
|
|
298
111
|
* Write-only secret value. It is accepted once per create or rotate command, is never echoed,
|
|
@@ -892,14 +705,6 @@ export declare const ExecutionRequestValidationRequestSchema: z.ZodObject<{
|
|
|
892
705
|
operation: z.ZodLiteral<"execution.validate">;
|
|
893
706
|
issuedAt: typeof TimestampSchema;
|
|
894
707
|
payload: z.ZodUnion<readonly [z.ZodObject<{
|
|
895
|
-
graph: z.ZodOptional<z.ZodObject<{
|
|
896
|
-
reference: z.ZodObject<{
|
|
897
|
-
graphDefinitionId: z.ZodString;
|
|
898
|
-
graphVersion: z.ZodString;
|
|
899
|
-
contentDigest: z.ZodString;
|
|
900
|
-
}, z.core.$strict>;
|
|
901
|
-
input: z.ZodPipe<z.ZodCustom<import("./graphs.js").GraphInput, import("./graphs.js").GraphInput>, z.ZodTransform<import("./graphs.js").GraphInput, import("./graphs.js").GraphInput>>;
|
|
902
|
-
}, z.core.$strict>>;
|
|
903
708
|
taskId: typeof IdentifierSchemas.taskId;
|
|
904
709
|
agentId: typeof IdentifierSchemas.agentId;
|
|
905
710
|
profileVersionId: typeof IdentifierSchemas.profileVersionId;
|
|
@@ -911,14 +716,6 @@ export declare const ExecutionRequestValidationRequestSchema: z.ZodObject<{
|
|
|
911
716
|
contextPackage: typeof ContextPackagePublicReferenceSchema;
|
|
912
717
|
contextInputs: z.ZodOptional<z.ZodNever>;
|
|
913
718
|
}, z.core.$strip>, z.ZodObject<{
|
|
914
|
-
graph: z.ZodOptional<z.ZodObject<{
|
|
915
|
-
reference: z.ZodObject<{
|
|
916
|
-
graphDefinitionId: z.ZodString;
|
|
917
|
-
graphVersion: z.ZodString;
|
|
918
|
-
contentDigest: z.ZodString;
|
|
919
|
-
}, z.core.$strict>;
|
|
920
|
-
input: z.ZodPipe<z.ZodCustom<import("./graphs.js").GraphInput, import("./graphs.js").GraphInput>, z.ZodTransform<import("./graphs.js").GraphInput, import("./graphs.js").GraphInput>>;
|
|
921
|
-
}, z.core.$strict>>;
|
|
922
719
|
taskId: typeof IdentifierSchemas.taskId;
|
|
923
720
|
agentId: typeof IdentifierSchemas.agentId;
|
|
924
721
|
profileVersionId: typeof IdentifierSchemas.profileVersionId;
|
package/dist/control-api.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { GraphSelectionSchema, GraphDefinitionContentSchema, GraphDefinitionVersionSchema, GraphReferenceSchema, } from './graphs.js';
|
|
3
2
|
import { ServiceCallerAssertionSchema, ServiceScopeSchema } from './authentication.js';
|
|
4
3
|
import { executionScopeFields, validateExecutionScopeFields } from './execution-scope.js';
|
|
5
4
|
import { ModelIdSchema } from './decision-resolution.js';
|
|
@@ -116,37 +115,6 @@ export const ProfileResolutionResponseSchema = successResponse(z.object({
|
|
|
116
115
|
}),
|
|
117
116
|
skillVersionIds: z.array(IdentifierSchemas.skillVersionId).max(128),
|
|
118
117
|
}));
|
|
119
|
-
const GraphMutationContextSchema = CommandContextSchema.omit({ projectId: true });
|
|
120
|
-
const GraphLifecyclePayloadSchema = z
|
|
121
|
-
.object({
|
|
122
|
-
reference: GraphReferenceSchema,
|
|
123
|
-
expectedRevision: z.number().int().positive(),
|
|
124
|
-
reason: z.string().min(1).max(1024),
|
|
125
|
-
})
|
|
126
|
-
.strict();
|
|
127
|
-
export const GraphDefinitionPublishRequestSchema = GraphMutationContextSchema.extend({
|
|
128
|
-
operation: z.literal('graph.publish'),
|
|
129
|
-
issuedAt: TimestampSchema,
|
|
130
|
-
payload: z.object({ definition: GraphDefinitionContentSchema }).strict(),
|
|
131
|
-
}).strict();
|
|
132
|
-
export const GraphDefinitionDeprecationRequestSchema = GraphMutationContextSchema.extend({
|
|
133
|
-
operation: z.literal('graph.deprecate'),
|
|
134
|
-
issuedAt: TimestampSchema,
|
|
135
|
-
payload: GraphLifecyclePayloadSchema,
|
|
136
|
-
}).strict();
|
|
137
|
-
export const GraphDefinitionRevocationRequestSchema = GraphMutationContextSchema.extend({
|
|
138
|
-
operation: z.literal('graph.revoke'),
|
|
139
|
-
issuedAt: TimestampSchema,
|
|
140
|
-
payload: GraphLifecyclePayloadSchema,
|
|
141
|
-
}).strict();
|
|
142
|
-
export const GraphDefinitionResolutionRequestSchema = RequestContextSchema.omit({ projectId: true })
|
|
143
|
-
.extend({
|
|
144
|
-
operation: z.literal('graph.resolve'),
|
|
145
|
-
requestedAt: TimestampSchema,
|
|
146
|
-
parameters: z.object({ reference: GraphReferenceSchema }).strict(),
|
|
147
|
-
})
|
|
148
|
-
.strict();
|
|
149
|
-
export const GraphDefinitionResponseSchema = successResponse(z.object({ definition: GraphDefinitionVersionSchema }).strict());
|
|
150
118
|
const CredentialReferenceSchema = z
|
|
151
119
|
.string()
|
|
152
120
|
.min(1)
|
|
@@ -468,7 +436,6 @@ export const RuntimeListRequestSchema = RequestContextSchema.extend({
|
|
|
468
436
|
});
|
|
469
437
|
export const RuntimeListResponseSchema = successResponse(z.object({ runtimes: z.array(RuntimeReadModelSchema).max(1_000) }));
|
|
470
438
|
const ExecutionValidationPayloadSchema = z.object({
|
|
471
|
-
graph: GraphSelectionSchema.optional(),
|
|
472
439
|
taskId: IdentifierSchemas.taskId,
|
|
473
440
|
agentId: IdentifierSchemas.agentId,
|
|
474
441
|
profileVersionId: IdentifierSchemas.profileVersionId,
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export * from './decision-resolution.js';
|
|
|
8
8
|
export * from './envelopes.js';
|
|
9
9
|
export * from './execution-scope.js';
|
|
10
10
|
export * from './fixtures.js';
|
|
11
|
-
export * from './graphs.js';
|
|
12
11
|
export * from './identifiers.js';
|
|
13
12
|
export * from './memory-writeback.js';
|
|
14
13
|
export * from './pagination.js';
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,6 @@ export * from './decision-resolution.js';
|
|
|
12
12
|
export * from './envelopes.js';
|
|
13
13
|
export * from './execution-scope.js';
|
|
14
14
|
export * from './fixtures.js';
|
|
15
|
-
export * from './graphs.js';
|
|
16
15
|
export * from './identifiers.js';
|
|
17
16
|
export * from './memory-writeback.js';
|
|
18
17
|
export * from './pagination.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adea-ai/contracts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Runtime-independent service boundary between Adea and the Control Plane: canonical identifiers, envelopes, Control API schemas, pagination, and versioning.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
"types": "./dist/index.d.ts",
|
|
29
29
|
"node": "./dist/index.js",
|
|
30
30
|
"default": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./canonical-json": {
|
|
33
|
+
"types": "./dist/canonical-json.d.ts",
|
|
34
|
+
"default": "./dist/canonical-json.js"
|
|
31
35
|
}
|
|
32
36
|
},
|
|
33
37
|
"publishConfig": {
|
package/dist/graphs.d.ts
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const GraphReferenceSchema: z.ZodObject<{
|
|
3
|
-
graphDefinitionId: z.ZodString;
|
|
4
|
-
graphVersion: z.ZodString;
|
|
5
|
-
contentDigest: z.ZodString;
|
|
6
|
-
}, z.core.$strict>;
|
|
7
|
-
export type GraphReference = z.output<typeof GraphReferenceSchema>;
|
|
8
|
-
export declare const GraphToolPinSchema: z.ZodObject<{
|
|
9
|
-
toolDefinitionId: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"tool-definition ID">, string>>;
|
|
10
|
-
toolVersionId: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"tool-version ID">, string>>;
|
|
11
|
-
contentDigest: z.ZodString;
|
|
12
|
-
operation: z.ZodString;
|
|
13
|
-
}, z.core.$strict>;
|
|
14
|
-
export type GraphToolPin = z.output<typeof GraphToolPinSchema>;
|
|
15
|
-
export declare const GRAPH_TOOL_PINS_CAPABILITY: 'graph.tool-pins.v1';
|
|
16
|
-
export declare const GraphDefinitionContentSchema: z.ZodObject<{
|
|
17
|
-
graphDefinitionId: z.ZodString;
|
|
18
|
-
graphVersion: z.ZodString;
|
|
19
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
20
|
-
nodes: z.ZodArray<z.ZodObject<{
|
|
21
|
-
node: z.ZodString;
|
|
22
|
-
join: z.ZodOptional<z.ZodEnum<{
|
|
23
|
-
all: "all";
|
|
24
|
-
any: "any";
|
|
25
|
-
}>>;
|
|
26
|
-
operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
27
|
-
kind: z.ZodEnum<{
|
|
28
|
-
delegation: "delegation";
|
|
29
|
-
model: "model";
|
|
30
|
-
runtime: "runtime";
|
|
31
|
-
}>;
|
|
32
|
-
name: z.ZodString;
|
|
33
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
34
|
-
kind: z.ZodLiteral<"tool">;
|
|
35
|
-
name: z.ZodString;
|
|
36
|
-
toolPin: z.ZodOptional<z.ZodObject<{
|
|
37
|
-
toolDefinitionId: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"tool-definition ID">, string>>;
|
|
38
|
-
toolVersionId: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"tool-version ID">, string>>;
|
|
39
|
-
contentDigest: z.ZodString;
|
|
40
|
-
operation: z.ZodString;
|
|
41
|
-
}, z.core.$strict>>;
|
|
42
|
-
}, z.core.$strict>], "kind">;
|
|
43
|
-
}, z.core.$strict>>;
|
|
44
|
-
edges: z.ZodArray<z.ZodObject<{
|
|
45
|
-
from: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"__start__">]>;
|
|
46
|
-
to: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"__end__">]>;
|
|
47
|
-
when: z.ZodOptional<z.ZodObject<{
|
|
48
|
-
path: z.ZodArray<z.ZodString>;
|
|
49
|
-
equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
50
|
-
}, z.core.$strict>>;
|
|
51
|
-
}, z.core.$strict>>;
|
|
52
|
-
schemas: z.ZodObject<{
|
|
53
|
-
input: z.ZodString;
|
|
54
|
-
state: z.ZodString;
|
|
55
|
-
output: z.ZodString;
|
|
56
|
-
}, z.core.$strict>;
|
|
57
|
-
requiredCapabilities: z.ZodArray<z.ZodString>;
|
|
58
|
-
compatibility: z.ZodObject<{
|
|
59
|
-
contractMajorVersions: z.ZodArray<z.ZodNumber>;
|
|
60
|
-
compilerVersions: z.ZodArray<z.ZodString>;
|
|
61
|
-
adapterVersions: z.ZodArray<z.ZodString>;
|
|
62
|
-
}, z.core.$strict>;
|
|
63
|
-
}, z.core.$strict>;
|
|
64
|
-
/** Public catalog snapshot; the server additionally verifies the content digest. */
|
|
65
|
-
export declare const GraphDefinitionVersionSchema: z.ZodObject<{
|
|
66
|
-
reference: z.ZodObject<{
|
|
67
|
-
graphDefinitionId: z.ZodString;
|
|
68
|
-
graphVersion: z.ZodString;
|
|
69
|
-
contentDigest: z.ZodString;
|
|
70
|
-
}, z.core.$strict>;
|
|
71
|
-
revision: z.ZodNumber;
|
|
72
|
-
lifecycle: z.ZodEnum<{
|
|
73
|
-
deprecated: "deprecated";
|
|
74
|
-
published: "published";
|
|
75
|
-
revoked: "revoked";
|
|
76
|
-
}>;
|
|
77
|
-
digestVersion: z.ZodOptional<z.ZodLiteral<"canonical-json-v1">>;
|
|
78
|
-
content: z.ZodObject<{
|
|
79
|
-
graphDefinitionId: z.ZodString;
|
|
80
|
-
graphVersion: z.ZodString;
|
|
81
|
-
schemaVersion: z.ZodLiteral<1>;
|
|
82
|
-
nodes: z.ZodArray<z.ZodObject<{
|
|
83
|
-
node: z.ZodString;
|
|
84
|
-
join: z.ZodOptional<z.ZodEnum<{
|
|
85
|
-
all: "all";
|
|
86
|
-
any: "any";
|
|
87
|
-
}>>;
|
|
88
|
-
operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
89
|
-
kind: z.ZodEnum<{
|
|
90
|
-
delegation: "delegation";
|
|
91
|
-
model: "model";
|
|
92
|
-
runtime: "runtime";
|
|
93
|
-
}>;
|
|
94
|
-
name: z.ZodString;
|
|
95
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
96
|
-
kind: z.ZodLiteral<"tool">;
|
|
97
|
-
name: z.ZodString;
|
|
98
|
-
toolPin: z.ZodOptional<z.ZodObject<{
|
|
99
|
-
toolDefinitionId: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"tool-definition ID">, string>>;
|
|
100
|
-
toolVersionId: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").OpaqueIdentifier<"tool-version ID">, string>>;
|
|
101
|
-
contentDigest: z.ZodString;
|
|
102
|
-
operation: z.ZodString;
|
|
103
|
-
}, z.core.$strict>>;
|
|
104
|
-
}, z.core.$strict>], "kind">;
|
|
105
|
-
}, z.core.$strict>>;
|
|
106
|
-
edges: z.ZodArray<z.ZodObject<{
|
|
107
|
-
from: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"__start__">]>;
|
|
108
|
-
to: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"__end__">]>;
|
|
109
|
-
when: z.ZodOptional<z.ZodObject<{
|
|
110
|
-
path: z.ZodArray<z.ZodString>;
|
|
111
|
-
equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
112
|
-
}, z.core.$strict>>;
|
|
113
|
-
}, z.core.$strict>>;
|
|
114
|
-
schemas: z.ZodObject<{
|
|
115
|
-
input: z.ZodString;
|
|
116
|
-
state: z.ZodString;
|
|
117
|
-
output: z.ZodString;
|
|
118
|
-
}, z.core.$strict>;
|
|
119
|
-
requiredCapabilities: z.ZodArray<z.ZodString>;
|
|
120
|
-
compatibility: z.ZodObject<{
|
|
121
|
-
contractMajorVersions: z.ZodArray<z.ZodNumber>;
|
|
122
|
-
compilerVersions: z.ZodArray<z.ZodString>;
|
|
123
|
-
adapterVersions: z.ZodArray<z.ZodString>;
|
|
124
|
-
}, z.core.$strict>;
|
|
125
|
-
}, z.core.$strict>;
|
|
126
|
-
publishedAt: z.ZodISODateTime;
|
|
127
|
-
changedAt: z.ZodISODateTime;
|
|
128
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
129
|
-
}, z.core.$strict>;
|
|
130
|
-
export type GraphDefinitionVersion = z.output<typeof GraphDefinitionVersionSchema>;
|
|
131
|
-
export type GraphJsonValue = null | boolean | number | string | GraphJsonValue[] | {
|
|
132
|
-
[key: string]: GraphJsonValue;
|
|
133
|
-
};
|
|
134
|
-
export type GraphInput = {
|
|
135
|
-
[key: string]: GraphJsonValue;
|
|
136
|
-
};
|
|
137
|
-
export declare const GraphInputSchema: z.ZodPipe<z.ZodCustom<GraphInput, GraphInput>, z.ZodTransform<GraphInput, GraphInput>>;
|
|
138
|
-
export declare const GraphSelectionSchema: z.ZodObject<{
|
|
139
|
-
reference: z.ZodObject<{
|
|
140
|
-
graphDefinitionId: z.ZodString;
|
|
141
|
-
graphVersion: z.ZodString;
|
|
142
|
-
contentDigest: z.ZodString;
|
|
143
|
-
}, z.core.$strict>;
|
|
144
|
-
input: z.ZodPipe<z.ZodCustom<GraphInput, GraphInput>, z.ZodTransform<GraphInput, GraphInput>>;
|
|
145
|
-
}, z.core.$strict>;
|
|
146
|
-
export type GraphSelection = z.output<typeof GraphSelectionSchema>;
|
|
147
|
-
export type GraphDefinitionContent = z.output<typeof GraphDefinitionContentSchema>;
|
package/dist/graphs.js
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { IdentifierSchemas } from './identifiers.js';
|
|
3
|
-
const ReferenceSchema = z
|
|
4
|
-
.string()
|
|
5
|
-
.min(1)
|
|
6
|
-
.max(256)
|
|
7
|
-
.regex(/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/);
|
|
8
|
-
const SemverSchema = z.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/);
|
|
9
|
-
const CapabilitySchema = z
|
|
10
|
-
.string()
|
|
11
|
-
.min(1)
|
|
12
|
-
.max(128)
|
|
13
|
-
.regex(/^[a-z][a-z0-9.-]*$/);
|
|
14
|
-
const unique = (values) => new Set(values).size === values.length;
|
|
15
|
-
export const GraphReferenceSchema = z
|
|
16
|
-
.object({
|
|
17
|
-
graphDefinitionId: ReferenceSchema,
|
|
18
|
-
graphVersion: SemverSchema,
|
|
19
|
-
contentDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
20
|
-
})
|
|
21
|
-
.strict();
|
|
22
|
-
const NodeNameSchema = z
|
|
23
|
-
.string()
|
|
24
|
-
.min(1)
|
|
25
|
-
.max(128)
|
|
26
|
-
.regex(/^[a-z][a-z0-9._-]*$/);
|
|
27
|
-
const CanonicalToolOperationNameSchema = z
|
|
28
|
-
.string()
|
|
29
|
-
.min(1)
|
|
30
|
-
.max(128)
|
|
31
|
-
.regex(/^[a-z][a-z0-9.-]*$/);
|
|
32
|
-
export const GraphToolPinSchema = z
|
|
33
|
-
.object({
|
|
34
|
-
toolDefinitionId: IdentifierSchemas.toolDefinitionId,
|
|
35
|
-
toolVersionId: IdentifierSchemas.toolVersionId,
|
|
36
|
-
contentDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/),
|
|
37
|
-
operation: CanonicalToolOperationNameSchema,
|
|
38
|
-
})
|
|
39
|
-
.strict();
|
|
40
|
-
export const GRAPH_TOOL_PINS_CAPABILITY = 'graph.tool-pins.v1';
|
|
41
|
-
const GraphNodeOperationSchema = z.discriminatedUnion('kind', [
|
|
42
|
-
z
|
|
43
|
-
.object({
|
|
44
|
-
kind: z.enum(['runtime', 'model', 'delegation']),
|
|
45
|
-
name: ReferenceSchema,
|
|
46
|
-
})
|
|
47
|
-
.strict(),
|
|
48
|
-
z
|
|
49
|
-
.object({
|
|
50
|
-
kind: z.literal('tool'),
|
|
51
|
-
name: ReferenceSchema,
|
|
52
|
-
toolPin: GraphToolPinSchema.optional(),
|
|
53
|
-
})
|
|
54
|
-
.strict(),
|
|
55
|
-
]);
|
|
56
|
-
export const GraphDefinitionContentSchema = z
|
|
57
|
-
.object({
|
|
58
|
-
graphDefinitionId: ReferenceSchema,
|
|
59
|
-
graphVersion: SemverSchema,
|
|
60
|
-
schemaVersion: z.literal(1),
|
|
61
|
-
nodes: z
|
|
62
|
-
.array(z
|
|
63
|
-
.object({
|
|
64
|
-
node: NodeNameSchema,
|
|
65
|
-
join: z.enum(['all', 'any']).optional(),
|
|
66
|
-
operation: GraphNodeOperationSchema,
|
|
67
|
-
})
|
|
68
|
-
.strict())
|
|
69
|
-
.min(1)
|
|
70
|
-
.max(256)
|
|
71
|
-
.refine((nodes) => unique(nodes.map(({ node }) => node)), 'Graph node names must be unique'),
|
|
72
|
-
edges: z
|
|
73
|
-
.array(z
|
|
74
|
-
.object({
|
|
75
|
-
from: z.union([NodeNameSchema, z.literal('__start__')]),
|
|
76
|
-
to: z.union([NodeNameSchema, z.literal('__end__')]),
|
|
77
|
-
when: z
|
|
78
|
-
.object({
|
|
79
|
-
path: z
|
|
80
|
-
.array(z
|
|
81
|
-
.string()
|
|
82
|
-
.min(1)
|
|
83
|
-
.max(256)
|
|
84
|
-
.refine((key) => !['__proto__', 'prototype', 'constructor'].includes(key)))
|
|
85
|
-
.min(1)
|
|
86
|
-
.max(16),
|
|
87
|
-
equals: z.union([z.string().max(4096), z.number().finite(), z.boolean(), z.null()]),
|
|
88
|
-
})
|
|
89
|
-
.strict()
|
|
90
|
-
.optional(),
|
|
91
|
-
})
|
|
92
|
-
.strict())
|
|
93
|
-
.min(1)
|
|
94
|
-
.max(1_024),
|
|
95
|
-
schemas: z
|
|
96
|
-
.object({ input: ReferenceSchema, state: ReferenceSchema, output: ReferenceSchema })
|
|
97
|
-
.strict(),
|
|
98
|
-
requiredCapabilities: z.array(CapabilitySchema).max(128).refine(unique),
|
|
99
|
-
compatibility: z
|
|
100
|
-
.object({
|
|
101
|
-
contractMajorVersions: z.array(z.number().int().positive()).min(1).refine(unique),
|
|
102
|
-
compilerVersions: z.array(SemverSchema).min(1).refine(unique),
|
|
103
|
-
adapterVersions: z.array(SemverSchema).min(1).refine(unique),
|
|
104
|
-
})
|
|
105
|
-
.strict(),
|
|
106
|
-
})
|
|
107
|
-
.strict()
|
|
108
|
-
.superRefine((definition, context) => {
|
|
109
|
-
const nodes = new Set(definition.nodes.map(({ node }) => node));
|
|
110
|
-
const hasToolPin = definition.nodes.some(({ operation }) => operation.kind === 'tool' && operation.toolPin !== undefined);
|
|
111
|
-
if (hasToolPin && !definition.requiredCapabilities.includes(GRAPH_TOOL_PINS_CAPABILITY)) {
|
|
112
|
-
context.addIssue({
|
|
113
|
-
code: 'custom',
|
|
114
|
-
path: ['requiredCapabilities'],
|
|
115
|
-
message: `Pinned tool operations require ${GRAPH_TOOL_PINS_CAPABILITY}`,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
for (const edge of definition.edges) {
|
|
119
|
-
if (edge.from === '__start__' && edge.when !== undefined) {
|
|
120
|
-
context.addIssue({ code: 'custom', message: 'Start edges cannot depend on node results' });
|
|
121
|
-
}
|
|
122
|
-
if (edge.from !== '__start__' && !nodes.has(edge.from)) {
|
|
123
|
-
context.addIssue({ code: 'custom', message: `Unknown edge source: ${edge.from}` });
|
|
124
|
-
}
|
|
125
|
-
if (edge.to !== '__end__' && !nodes.has(edge.to)) {
|
|
126
|
-
context.addIssue({ code: 'custom', message: `Unknown edge target: ${edge.to}` });
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (!definition.edges.some(({ from }) => from === '__start__')) {
|
|
130
|
-
context.addIssue({ code: 'custom', message: 'Graph requires a start edge' });
|
|
131
|
-
}
|
|
132
|
-
if (!definition.edges.some(({ to }) => to === '__end__')) {
|
|
133
|
-
context.addIssue({ code: 'custom', message: 'Graph requires an end edge' });
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
/** Public catalog snapshot; the server additionally verifies the content digest. */
|
|
137
|
-
export const GraphDefinitionVersionSchema = z
|
|
138
|
-
.object({
|
|
139
|
-
reference: GraphReferenceSchema,
|
|
140
|
-
revision: z.number().int().positive(),
|
|
141
|
-
lifecycle: z.enum(['published', 'deprecated', 'revoked']),
|
|
142
|
-
digestVersion: z.literal('canonical-json-v1').optional(),
|
|
143
|
-
content: GraphDefinitionContentSchema,
|
|
144
|
-
publishedAt: z.iso.datetime(),
|
|
145
|
-
changedAt: z.iso.datetime(),
|
|
146
|
-
reason: z.string().min(1).max(1024).optional(),
|
|
147
|
-
})
|
|
148
|
-
.strict()
|
|
149
|
-
.superRefine((version, context) => {
|
|
150
|
-
if (version.reference.graphDefinitionId !== version.content.graphDefinitionId ||
|
|
151
|
-
version.reference.graphVersion !== version.content.graphVersion ||
|
|
152
|
-
Date.parse(version.changedAt) < Date.parse(version.publishedAt) ||
|
|
153
|
-
(version.lifecycle !== 'published' && !version.reason)) {
|
|
154
|
-
context.addIssue({ code: 'custom', message: 'Graph version metadata is inconsistent' });
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
// Check bounds and plain data before recursive parsing, cloning or digesting.
|
|
158
|
-
// Every graph input is persisted in the plan and may later enter checkpoints.
|
|
159
|
-
function isBoundedGraphInput(value) {
|
|
160
|
-
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
161
|
-
return false;
|
|
162
|
-
const pending = [{ value, depth: 0 }];
|
|
163
|
-
const seen = new Set();
|
|
164
|
-
let count = 0;
|
|
165
|
-
let bytes = 0;
|
|
166
|
-
while (pending.length > 0) {
|
|
167
|
-
const item = pending.pop();
|
|
168
|
-
if (++count > 4_096 || item.depth > 16)
|
|
169
|
-
return false;
|
|
170
|
-
const entry = item.value;
|
|
171
|
-
if (typeof entry === 'string') {
|
|
172
|
-
bytes += new TextEncoder().encode(entry).length;
|
|
173
|
-
}
|
|
174
|
-
else if (typeof entry === 'number') {
|
|
175
|
-
if (!Number.isFinite(entry))
|
|
176
|
-
return false;
|
|
177
|
-
bytes += 24;
|
|
178
|
-
}
|
|
179
|
-
else if (entry === null || typeof entry === 'boolean') {
|
|
180
|
-
bytes += 5;
|
|
181
|
-
}
|
|
182
|
-
else if (typeof entry === 'object') {
|
|
183
|
-
if (seen.has(entry))
|
|
184
|
-
return false;
|
|
185
|
-
seen.add(entry);
|
|
186
|
-
const prototype = Object.getPrototypeOf(entry);
|
|
187
|
-
if (!Array.isArray(entry) && prototype !== Object.prototype && prototype !== null)
|
|
188
|
-
return false;
|
|
189
|
-
if (Array.isArray(entry) &&
|
|
190
|
-
(entry.length > 4_096 || Object.keys(entry).length !== entry.length))
|
|
191
|
-
return false;
|
|
192
|
-
if (Reflect.ownKeys(entry).length > 4_096)
|
|
193
|
-
return false;
|
|
194
|
-
for (const key of Reflect.ownKeys(entry)) {
|
|
195
|
-
if (Array.isArray(entry) && key === 'length')
|
|
196
|
-
continue;
|
|
197
|
-
if (Array.isArray(entry) &&
|
|
198
|
-
(typeof key !== 'string' || !/^(0|[1-9]\d*)$/.test(key) || Number(key) >= entry.length))
|
|
199
|
-
return false;
|
|
200
|
-
if (typeof key !== 'string' ||
|
|
201
|
-
key.length > 256 ||
|
|
202
|
-
['__proto__', 'constructor', 'prototype'].includes(key))
|
|
203
|
-
return false;
|
|
204
|
-
const descriptor = Object.getOwnPropertyDescriptor(entry, key);
|
|
205
|
-
if (!descriptor || !('value' in descriptor) || !descriptor.enumerable)
|
|
206
|
-
return false;
|
|
207
|
-
bytes += new TextEncoder().encode(key).length + 4;
|
|
208
|
-
pending.push({ value: descriptor.value, depth: item.depth + 1 });
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
else
|
|
212
|
-
return false;
|
|
213
|
-
if (bytes > 65_536 || pending.length > 4_096)
|
|
214
|
-
return false;
|
|
215
|
-
}
|
|
216
|
-
return new TextEncoder().encode(JSON.stringify(value)).length <= 65_536;
|
|
217
|
-
}
|
|
218
|
-
export const GraphInputSchema = z
|
|
219
|
-
.custom(isBoundedGraphInput, 'Graph input must be bounded plain JSON')
|
|
220
|
-
.transform((input) => JSON.parse(JSON.stringify(input)))
|
|
221
|
-
.meta({
|
|
222
|
-
type: 'object',
|
|
223
|
-
additionalProperties: {},
|
|
224
|
-
maxProperties: 4_096,
|
|
225
|
-
description: 'Plain JSON object, at most 65536 serialized UTF-8 bytes, 4096 values and 16 nested levels; executable and non-finite values are rejected.',
|
|
226
|
-
});
|
|
227
|
-
export const GraphSelectionSchema = z
|
|
228
|
-
.object({ reference: GraphReferenceSchema, input: GraphInputSchema })
|
|
229
|
-
.strict();
|