@takeshape/schema 11.133.4 → 11.142.5

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 (45) hide show
  1. package/dist/agents.d.ts +2 -4
  2. package/dist/agents.js +99 -98
  3. package/dist/builtin-schema.js +66 -16
  4. package/dist/layers/refs.d.ts +1 -1
  5. package/dist/models/project-schema.d.ts +2 -2
  6. package/dist/models/project-schema.js +7 -3
  7. package/dist/models/types.d.ts +4 -1
  8. package/dist/project-schema/latest.d.ts +6 -0
  9. package/dist/project-schema/v3.59.0.d.ts +6 -0
  10. package/dist/refs.d.ts +1 -1
  11. package/dist/resolvers/ai/abort-agent-message-response.d.ts +18 -5
  12. package/dist/resolvers/ai/abort-agent-message-response.js +4 -4
  13. package/dist/resolvers/ai/agent-chat-args.js +1 -2
  14. package/dist/resolvers/ai/agent-chat-payload.js +1 -2
  15. package/dist/resolvers/ai/agent-chat-response.d.ts +169 -37
  16. package/dist/resolvers/ai/agent-chat-response.js +11 -7
  17. package/dist/resolvers/ai/agent-generate-args.js +1 -2
  18. package/dist/resolvers/ai/agent-message-input.d.ts +73 -0
  19. package/dist/resolvers/ai/agent-message-input.js +39 -0
  20. package/dist/resolvers/ai/agent-message-output.d.ts +169 -0
  21. package/dist/resolvers/ai/agent-message-output.js +77 -0
  22. package/dist/resolvers/ai/agent-message-payload.d.ts +187 -73
  23. package/dist/resolvers/ai/agent-message-payload.js +20 -72
  24. package/dist/resolvers/ai/agent-run-mode.js +1 -2
  25. package/dist/resolvers/ai/agent-session-payload.d.ts +415 -5
  26. package/dist/resolvers/ai/agent-session-payload.js +83 -2
  27. package/dist/resolvers/ai/create-agent-session-response.d.ts +126 -23
  28. package/dist/resolvers/ai/create-agent-session-response.js +6 -11
  29. package/dist/resolvers/ai/get-agent-message-response.d.ts +592 -18
  30. package/dist/resolvers/ai/get-agent-message-response.js +43 -9
  31. package/dist/resolvers/ai/inspect-agent-response.d.ts +479 -70
  32. package/dist/resolvers/ai/inspect-agent-response.js +30 -19
  33. package/dist/resolvers/ai/send-agent-feedback-args.js +1 -2
  34. package/dist/resolvers/ai/send-agent-message-args.d.ts +8 -8
  35. package/dist/resolvers/ai/send-agent-message-args.js +2 -2
  36. package/dist/resolvers/ai/send-agent-message-response.d.ts +257 -4
  37. package/dist/resolvers/ai/send-agent-message-response.js +32 -2
  38. package/dist/resolvers/ai/types.d.ts +6 -0
  39. package/dist/resolvers/ai/types.js +1 -0
  40. package/dist/resolvers/takeshape/assets/asset.d.ts +1 -1
  41. package/dist/schemas/project-schema/latest.json +15 -0
  42. package/dist/schemas/project-schema/v3.59.0.json +15 -0
  43. package/package.json +12 -8
  44. package/dist/resolvers/ai/constants.d.ts +0 -9
  45. package/dist/resolvers/ai/constants.js +0 -9
@@ -1,69 +1,7 @@
1
1
  import type { AiUsage } from '@takeshape/util';
2
2
  import type { CoreMessage } from 'ai';
3
3
  import type { FromSchema } from 'json-schema-to-ts';
4
- export declare const agentGenerateStateOutputSchema: {
5
- readonly title: "AgentGenerateStateOutput";
6
- readonly type: "object";
7
- readonly properties: {
8
- readonly type: {
9
- readonly const: "generate";
10
- };
11
- readonly data: {};
12
- };
13
- readonly required: ["type", "data"];
14
- readonly additionalProperties: false;
15
- };
16
- export declare const agentGraphQLStateOutputSchema: {
17
- readonly title: "AgentGraphQLStateOutput";
18
- readonly type: "object";
19
- readonly properties: {
20
- readonly type: {
21
- readonly const: "graphql";
22
- };
23
- readonly data: {};
24
- };
25
- readonly required: ["type", "data"];
26
- readonly additionalProperties: false;
27
- };
28
- export declare const agentChatStateOutputSchema: {
29
- readonly title: "AgentChatStateOutput";
30
- readonly type: "object";
31
- readonly properties: {
32
- readonly type: {
33
- readonly const: "chat";
34
- };
35
- readonly data: {
36
- readonly title: "AgentChatStateOutputData";
37
- readonly type: "object";
38
- readonly properties: {
39
- readonly content: {
40
- readonly type: "string";
41
- };
42
- readonly artifact: {
43
- readonly type: "object";
44
- };
45
- readonly references: {
46
- readonly type: "array";
47
- readonly items: {
48
- readonly title: "AgentChatStateOutputReference";
49
- readonly type: "object";
50
- readonly properties: {
51
- readonly _tid: {
52
- readonly type: "string";
53
- };
54
- };
55
- readonly required: ["_tid"];
56
- readonly additionalProperties: false;
57
- };
58
- };
59
- };
60
- readonly required: ["content", "references"];
61
- readonly additionalProperties: false;
62
- };
63
- };
64
- readonly required: ["type", "data"];
65
- readonly additionalProperties: false;
66
- };
4
+ export declare const shapeName = "TSAgentMessage";
67
5
  export declare const schema: {
68
6
  readonly $id: "https://takeshape.io/schema/agent-message-payload";
69
7
  readonly type: "object";
@@ -92,14 +30,45 @@ export declare const schema: {
92
30
  readonly type: "object";
93
31
  };
94
32
  readonly input: {
95
- readonly type: "string";
33
+ readonly title: "TSAgentMessageInput";
34
+ readonly description: "The input schema for agent messages.";
35
+ readonly discriminator: {
36
+ readonly propertyName: "type";
37
+ };
38
+ readonly oneOf: [{
39
+ readonly title: "TSAgentMessageUnknownInput";
40
+ readonly type: "object";
41
+ readonly properties: {
42
+ readonly type: {
43
+ readonly const: "unknown";
44
+ };
45
+ readonly data: {};
46
+ };
47
+ readonly required: ["type", "data"];
48
+ readonly additionalProperties: false;
49
+ }, {
50
+ readonly title: "TSAgentMessageStringInput";
51
+ readonly type: "object";
52
+ readonly properties: {
53
+ readonly type: {
54
+ readonly const: "string";
55
+ };
56
+ readonly content: {
57
+ readonly type: "string";
58
+ };
59
+ };
60
+ readonly required: ["type", "content"];
61
+ readonly additionalProperties: false;
62
+ }];
96
63
  };
97
64
  readonly output: {
65
+ readonly title: "TSAgentMessageOutput";
66
+ readonly description: "The output schema for agent messages.";
98
67
  readonly discriminator: {
99
68
  readonly propertyName: "type";
100
69
  };
101
70
  readonly oneOf: [{
102
- readonly title: "AgentGenerateStateOutput";
71
+ readonly title: "TSAgentGenerateStateOutput";
103
72
  readonly type: "object";
104
73
  readonly properties: {
105
74
  readonly type: {
@@ -110,7 +79,7 @@ export declare const schema: {
110
79
  readonly required: ["type", "data"];
111
80
  readonly additionalProperties: false;
112
81
  }, {
113
- readonly title: "AgentGraphQLStateOutput";
82
+ readonly title: "TSAgentGraphQLStateOutput";
114
83
  readonly type: "object";
115
84
  readonly properties: {
116
85
  readonly type: {
@@ -121,14 +90,13 @@ export declare const schema: {
121
90
  readonly required: ["type", "data"];
122
91
  readonly additionalProperties: false;
123
92
  }, {
124
- readonly title: "AgentChatStateOutput";
93
+ readonly title: "TSAgentChatStateOutput";
125
94
  readonly type: "object";
126
95
  readonly properties: {
127
96
  readonly type: {
128
97
  readonly const: "chat";
129
98
  };
130
99
  readonly data: {
131
- readonly title: "AgentChatStateOutputData";
132
100
  readonly type: "object";
133
101
  readonly properties: {
134
102
  readonly content: {
@@ -140,7 +108,6 @@ export declare const schema: {
140
108
  readonly references: {
141
109
  readonly type: "array";
142
110
  readonly items: {
143
- readonly title: "AgentChatStateOutputReference";
144
111
  readonly type: "object";
145
112
  readonly properties: {
146
113
  readonly _tid: {
@@ -159,7 +126,7 @@ export declare const schema: {
159
126
  readonly required: ["type", "data"];
160
127
  readonly additionalProperties: false;
161
128
  }, {
162
- readonly title: "AgentUnknownStateOutput";
129
+ readonly title: "TSAgentUnknownStateOutput";
163
130
  readonly type: "object";
164
131
  readonly properties: {
165
132
  readonly type: {
@@ -170,7 +137,6 @@ export declare const schema: {
170
137
  readonly required: ["type", "data"];
171
138
  readonly additionalProperties: false;
172
139
  }];
173
- readonly required: ["type"];
174
140
  };
175
141
  readonly error: {
176
142
  readonly type: "object";
@@ -307,7 +273,13 @@ export declare const validate: import("ajv").ValidateFunction<{
307
273
  args?: {
308
274
  [x: string]: unknown;
309
275
  } | undefined;
310
- input?: string | undefined;
276
+ input?: {
277
+ type: "unknown";
278
+ data: unknown;
279
+ } | {
280
+ type: "string";
281
+ content: string;
282
+ } | undefined;
311
283
  output?: {
312
284
  type: "generate";
313
285
  data: unknown;
@@ -354,9 +326,9 @@ export declare const validate: import("ajv").ValidateFunction<{
354
326
  } | undefined;
355
327
  blocked?: boolean | undefined;
356
328
  usage?: {
329
+ totalTokens?: number | undefined;
357
330
  completionTokens?: number | undefined;
358
331
  promptTokens?: number | undefined;
359
- totalTokens?: number | undefined;
360
332
  guardrailUnits?: number | undefined;
361
333
  } | undefined;
362
334
  messageId: string;
@@ -385,9 +357,151 @@ export type AgentGenerateStateExecuteResult = {
385
357
  };
386
358
  };
387
359
  export type AgentGraphQLStateExecuteResult = {
360
+ input: unknown;
388
361
  output: AgentGraphQLStateOutput;
389
362
  };
390
363
  export type AgentStateExecuteResult = AgentChatStateExecuteResult | AgentGenerateStateExecuteResult | AgentGraphQLStateExecuteResult;
391
364
  export type AgentChatStateExecuteResultWithoutMetadata = Omit<AgentChatStateExecuteResult, 'metadata'>;
392
365
  export type AgentGenerateStateExecuteResultWithoutMetadata = Omit<AgentGenerateStateExecuteResult, 'metadata'>;
393
366
  export type AgentStateExecuteResultWithoutMetadata = AgentChatStateExecuteResultWithoutMetadata | AgentGenerateStateExecuteResultWithoutMetadata | AgentGraphQLStateExecuteResult;
367
+ export type AgentMessageShapePayload<Output = unknown> = Omit<AgentMessagePayload, 'output'> & {
368
+ output: Output;
369
+ };
370
+ export declare const shapeSchema: {
371
+ readonly properties: {
372
+ readonly input: {
373
+ readonly '@ref': "TSAgentMessageInput";
374
+ };
375
+ readonly output: {
376
+ readonly '@ref': "TSAgentMessageOutput";
377
+ };
378
+ readonly messageId: {
379
+ readonly type: "string";
380
+ readonly description: "ID of the message that was deferred";
381
+ };
382
+ readonly agentName: {
383
+ readonly type: "string";
384
+ readonly description: "Name of the agent this message was created by";
385
+ };
386
+ readonly args: {
387
+ readonly type: "object";
388
+ };
389
+ readonly error: {
390
+ readonly type: "object";
391
+ readonly properties: {
392
+ readonly message: {
393
+ readonly type: "string";
394
+ };
395
+ readonly name: {
396
+ readonly type: "string";
397
+ };
398
+ readonly code: {
399
+ readonly type: "string";
400
+ };
401
+ };
402
+ readonly additionalProperties: false;
403
+ };
404
+ readonly runMode: {
405
+ readonly enum: ["BACKGROUND", "IMMEDIATE"];
406
+ readonly description: "Indicates how the agent message was run";
407
+ };
408
+ readonly abortedAt: {
409
+ readonly type: "number";
410
+ readonly description: "Timestamp when the message was aborted";
411
+ };
412
+ readonly sentAt: {
413
+ readonly type: "number";
414
+ readonly description: "Timestamp when the message was sent";
415
+ };
416
+ readonly startedAt: {
417
+ readonly type: "number";
418
+ readonly description: "Timestamp when the message started processing";
419
+ };
420
+ readonly finishedAt: {
421
+ readonly type: "number";
422
+ readonly description: "Timestamp when the message finished processing";
423
+ };
424
+ readonly span: {
425
+ readonly type: "object";
426
+ readonly description: "The span for the agent run associated with this message";
427
+ readonly properties: {
428
+ readonly traceId: {
429
+ readonly type: "string";
430
+ };
431
+ readonly spanId: {
432
+ readonly type: "string";
433
+ };
434
+ readonly name: {
435
+ readonly type: "string";
436
+ };
437
+ readonly createdAt: {
438
+ readonly type: "number";
439
+ };
440
+ };
441
+ readonly required: ["traceId", "spanId", "name", "createdAt"];
442
+ readonly additionalProperties: false;
443
+ };
444
+ readonly feedback: {
445
+ readonly type: "object";
446
+ readonly properties: {
447
+ readonly name: {
448
+ readonly type: "string";
449
+ readonly description: "Name of the feedback, e.g., \"Quality\", \"Relevance\"";
450
+ };
451
+ readonly label: {
452
+ readonly type: "string";
453
+ readonly description: "String feedback for the agent message, e.g., \"helpful\", \"not helpful\". If a label is provided, a score must not be provided.";
454
+ };
455
+ readonly score: {
456
+ readonly type: "number";
457
+ readonly description: "Numeric feedback for the agent message, typically between 1 and 5. If a score is provided, a label must not be provided.";
458
+ };
459
+ readonly text: {
460
+ readonly type: "string";
461
+ readonly description: "Freeform text feedback for the agent message.";
462
+ };
463
+ readonly note: {
464
+ readonly type: "string";
465
+ readonly description: "Optional note for the feedback, e.g., \"This was helpful because...\"";
466
+ };
467
+ readonly updatedBy: {
468
+ readonly type: "string";
469
+ readonly description: "A string identifying the user who is adding the annotation, such as a name or email address.";
470
+ };
471
+ readonly createdAt: {
472
+ readonly type: "number";
473
+ readonly description: "Timestamp when the feedback was created";
474
+ };
475
+ };
476
+ readonly additionalProperties: false;
477
+ readonly required: ["name"];
478
+ };
479
+ readonly blocked: {
480
+ readonly type: "boolean";
481
+ readonly description: "If this message was blocked by a guardrail";
482
+ };
483
+ readonly usage: {
484
+ readonly type: "object";
485
+ readonly description: "LLM token usage for this message";
486
+ readonly properties: {
487
+ readonly completionTokens: {
488
+ readonly type: "number";
489
+ };
490
+ readonly promptTokens: {
491
+ readonly type: "number";
492
+ };
493
+ readonly totalTokens: {
494
+ readonly type: "number";
495
+ };
496
+ readonly guardrailUnits: {
497
+ readonly type: "number";
498
+ };
499
+ };
500
+ readonly additionalProperties: false;
501
+ };
502
+ };
503
+ readonly type: "object";
504
+ readonly additionalProperties: false;
505
+ readonly required: ["messageId", "sessionId", "agentName", "projectId", "schemaId", "runMode", "sentAt"];
506
+ readonly title: "TSAgentMessage";
507
+ };
@@ -1,65 +1,8 @@
1
1
  import { createTypedValidator } from '@takeshape/json-schema';
2
- export const agentGenerateStateOutputSchema = {
3
- title: 'AgentGenerateStateOutput',
4
- type: 'object',
5
- properties: {
6
- type: { const: 'generate' },
7
- data: {}
8
- },
9
- required: ['type', 'data'],
10
- additionalProperties: false
11
- };
12
- export const agentGraphQLStateOutputSchema = {
13
- title: 'AgentGraphQLStateOutput',
14
- type: 'object',
15
- properties: {
16
- type: { const: 'graphql' },
17
- data: {}
18
- },
19
- required: ['type', 'data'],
20
- additionalProperties: false
21
- };
22
- export const agentChatStateOutputSchema = {
23
- title: 'AgentChatStateOutput',
24
- type: 'object',
25
- properties: {
26
- type: { const: 'chat' },
27
- data: {
28
- title: 'AgentChatStateOutputData',
29
- type: 'object',
30
- properties: {
31
- content: { type: 'string' },
32
- artifact: { type: 'object' },
33
- references: {
34
- type: 'array',
35
- items: {
36
- title: 'AgentChatStateOutputReference',
37
- type: 'object',
38
- properties: {
39
- _tid: { type: 'string' }
40
- },
41
- required: ['_tid'],
42
- additionalProperties: false
43
- }
44
- }
45
- },
46
- required: ['content', 'references'],
47
- additionalProperties: false
48
- }
49
- },
50
- required: ['type', 'data'],
51
- additionalProperties: false
52
- };
53
- const agentUnknownStateOutputSchema = {
54
- title: 'AgentUnknownStateOutput',
55
- type: 'object',
56
- properties: {
57
- type: { const: 'unknown' },
58
- data: {}
59
- },
60
- required: ['type', 'data'],
61
- additionalProperties: false
62
- };
2
+ import omit from 'lodash/omit.js';
3
+ import * as agentMessageInput from "./agent-message-input.js";
4
+ import * as agentMessageOutput from "./agent-message-output.js";
5
+ export const shapeName = 'TSAgentMessage';
63
6
  export const schema = {
64
7
  $id: 'https://takeshape.io/schema/agent-message-payload',
65
8
  type: 'object',
@@ -88,19 +31,10 @@ export const schema = {
88
31
  type: 'object'
89
32
  },
90
33
  input: {
91
- type: 'string'
34
+ ...agentMessageInput.schema
92
35
  },
93
36
  output: {
94
- discriminator: {
95
- propertyName: 'type'
96
- },
97
- oneOf: [
98
- agentGenerateStateOutputSchema,
99
- agentGraphQLStateOutputSchema,
100
- agentChatStateOutputSchema,
101
- agentUnknownStateOutputSchema
102
- ],
103
- required: ['type']
37
+ ...agentMessageOutput.schema
104
38
  },
105
39
  error: {
106
40
  type: 'object',
@@ -206,3 +140,17 @@ export const schema = {
206
140
  additionalProperties: false
207
141
  };
208
142
  export const validate = createTypedValidator(schema);
143
+ const { sessionId, projectId, schemaId, ...shapeSchemaProperties } = schema.properties;
144
+ export const shapeSchema = {
145
+ title: shapeName,
146
+ ...omit(schema, ['$id']),
147
+ properties: {
148
+ ...shapeSchemaProperties,
149
+ input: {
150
+ '@ref': agentMessageInput.shapeName
151
+ },
152
+ output: {
153
+ '@ref': agentMessageOutput.shapeName
154
+ }
155
+ }
156
+ };
@@ -1,7 +1,6 @@
1
1
  import { createTypedValidator } from '@takeshape/json-schema';
2
- import { AI_AGENT_RUN_MODE_SHAPE_NAME } from "./constants.js";
3
2
  const runModes = ['ALLOW_BACKGROUND', 'BACKGROUND', 'IMMEDIATE'];
4
- export const shapeName = AI_AGENT_RUN_MODE_SHAPE_NAME;
3
+ export const shapeName = 'TSAgentRunMode';
5
4
  export const schema = {
6
5
  enum: [...runModes]
7
6
  // description: