@takeshape/schema 11.133.4 → 11.134.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.
Files changed (42) 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/project-schema/latest.d.ts +6 -0
  6. package/dist/project-schema/v3.59.0.d.ts +6 -0
  7. package/dist/refs.d.ts +1 -1
  8. package/dist/resolvers/ai/abort-agent-message-response.d.ts +18 -5
  9. package/dist/resolvers/ai/abort-agent-message-response.js +4 -4
  10. package/dist/resolvers/ai/agent-chat-args.js +1 -2
  11. package/dist/resolvers/ai/agent-chat-payload.js +1 -2
  12. package/dist/resolvers/ai/agent-chat-response.d.ts +169 -37
  13. package/dist/resolvers/ai/agent-chat-response.js +11 -7
  14. package/dist/resolvers/ai/agent-generate-args.js +1 -2
  15. package/dist/resolvers/ai/agent-message-input.d.ts +73 -0
  16. package/dist/resolvers/ai/agent-message-input.js +39 -0
  17. package/dist/resolvers/ai/agent-message-output.d.ts +169 -0
  18. package/dist/resolvers/ai/agent-message-output.js +77 -0
  19. package/dist/resolvers/ai/agent-message-payload.d.ts +187 -73
  20. package/dist/resolvers/ai/agent-message-payload.js +20 -72
  21. package/dist/resolvers/ai/agent-run-mode.js +1 -2
  22. package/dist/resolvers/ai/agent-session-payload.d.ts +415 -5
  23. package/dist/resolvers/ai/agent-session-payload.js +83 -2
  24. package/dist/resolvers/ai/create-agent-session-response.d.ts +126 -23
  25. package/dist/resolvers/ai/create-agent-session-response.js +6 -11
  26. package/dist/resolvers/ai/get-agent-message-response.d.ts +592 -18
  27. package/dist/resolvers/ai/get-agent-message-response.js +43 -9
  28. package/dist/resolvers/ai/inspect-agent-response.d.ts +479 -70
  29. package/dist/resolvers/ai/inspect-agent-response.js +30 -19
  30. package/dist/resolvers/ai/send-agent-feedback-args.js +1 -2
  31. package/dist/resolvers/ai/send-agent-message-args.d.ts +8 -8
  32. package/dist/resolvers/ai/send-agent-message-args.js +2 -2
  33. package/dist/resolvers/ai/send-agent-message-response.d.ts +257 -4
  34. package/dist/resolvers/ai/send-agent-message-response.js +32 -2
  35. package/dist/resolvers/ai/types.d.ts +6 -0
  36. package/dist/resolvers/ai/types.js +1 -0
  37. package/dist/resolvers/takeshape/assets/asset.d.ts +1 -1
  38. package/dist/schemas/project-schema/latest.json +15 -0
  39. package/dist/schemas/project-schema/v3.59.0.json +15 -0
  40. package/package.json +6 -6
  41. package/dist/resolvers/ai/constants.d.ts +0 -9
  42. package/dist/resolvers/ai/constants.js +0 -9
@@ -29,8 +29,39 @@ export declare const schema: {
29
29
  readonly type: "string";
30
30
  readonly description: "The unique identifier for the agent run response message.";
31
31
  };
32
+ readonly input: {
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
+ }];
63
+ };
32
64
  readonly session: {
33
- readonly type: "object";
34
65
  readonly properties: {
35
66
  readonly id: {
36
67
  readonly type: "string";
@@ -105,53 +136,154 @@ export declare const schema: {
105
136
  readonly type: "integer";
106
137
  };
107
138
  };
139
+ readonly firstMessageInput: {
140
+ readonly title: "TSAgentMessageInput";
141
+ readonly description: "The input schema for agent messages.";
142
+ readonly discriminator: {
143
+ readonly propertyName: "type";
144
+ };
145
+ readonly oneOf: [{
146
+ readonly title: "TSAgentMessageUnknownInput";
147
+ readonly type: "object";
148
+ readonly properties: {
149
+ readonly type: {
150
+ readonly const: "unknown";
151
+ };
152
+ readonly data: {};
153
+ };
154
+ readonly required: ["type", "data"];
155
+ readonly additionalProperties: false;
156
+ }, {
157
+ readonly title: "TSAgentMessageStringInput";
158
+ readonly type: "object";
159
+ readonly properties: {
160
+ readonly type: {
161
+ readonly const: "string";
162
+ };
163
+ readonly content: {
164
+ readonly type: "string";
165
+ };
166
+ };
167
+ readonly required: ["type", "content"];
168
+ readonly additionalProperties: false;
169
+ }];
170
+ };
171
+ readonly lastMessageOutput: {
172
+ readonly title: "TSAgentMessageOutput";
173
+ readonly description: "The output schema for agent messages.";
174
+ readonly discriminator: {
175
+ readonly propertyName: "type";
176
+ };
177
+ readonly oneOf: [{
178
+ readonly title: "TSAgentGenerateStateOutput";
179
+ readonly type: "object";
180
+ readonly properties: {
181
+ readonly type: {
182
+ readonly const: "generate";
183
+ };
184
+ readonly data: {};
185
+ };
186
+ readonly required: ["type", "data"];
187
+ readonly additionalProperties: false;
188
+ }, {
189
+ readonly title: "TSAgentGraphQLStateOutput";
190
+ readonly type: "object";
191
+ readonly properties: {
192
+ readonly type: {
193
+ readonly const: "graphql";
194
+ };
195
+ readonly data: {};
196
+ };
197
+ readonly required: ["type", "data"];
198
+ readonly additionalProperties: false;
199
+ }, {
200
+ readonly title: "TSAgentChatStateOutput";
201
+ readonly type: "object";
202
+ readonly properties: {
203
+ readonly type: {
204
+ readonly const: "chat";
205
+ };
206
+ readonly data: {
207
+ readonly type: "object";
208
+ readonly properties: {
209
+ readonly content: {
210
+ readonly type: "string";
211
+ };
212
+ readonly artifact: {
213
+ readonly type: "object";
214
+ };
215
+ readonly references: {
216
+ readonly type: "array";
217
+ readonly items: {
218
+ readonly type: "object";
219
+ readonly properties: {
220
+ readonly _tid: {
221
+ readonly type: "string";
222
+ };
223
+ };
224
+ readonly required: ["_tid"];
225
+ readonly additionalProperties: false;
226
+ };
227
+ };
228
+ };
229
+ readonly required: ["content", "references"];
230
+ readonly additionalProperties: false;
231
+ };
232
+ };
233
+ readonly required: ["type", "data"];
234
+ readonly additionalProperties: false;
235
+ }, {
236
+ readonly title: "TSAgentUnknownStateOutput";
237
+ readonly type: "object";
238
+ readonly properties: {
239
+ readonly type: {
240
+ readonly const: "unknown";
241
+ };
242
+ readonly data: {};
243
+ };
244
+ readonly required: ["type", "data"];
245
+ readonly additionalProperties: false;
246
+ }];
247
+ };
248
+ readonly totalTokens: {
249
+ readonly type: "number";
250
+ readonly description: "The total number of tokens used in the agent session.";
251
+ };
108
252
  };
109
- readonly required: ["id", "agentName", "createdAt", "updatedAt", "done", "currentStateId", "chatSessionIds", "sessionMemory", "projectId", "schemaId", "schemaHash"];
253
+ readonly required: ["id", "agentName", "createdAt", "updatedAt", "done", "currentStateId", "chatSessionIds", "sessionMemory", "hasAgentHistory", "hasFeedback", "suspend", "projectId", "schemaId", "schemaHash", "totalTokens"];
110
254
  readonly additionalProperties: false;
255
+ readonly title: "TSAgentSession";
256
+ readonly type: "object";
111
257
  };
112
258
  readonly runMode: {
113
259
  readonly enum: ["BACKGROUND", "IMMEDIATE"];
114
260
  readonly description: "Indicates how the agent message was run";
115
261
  };
116
262
  };
117
- readonly additionalProperties: false;
118
- readonly required: ["messageId", "session", "runMode", "output"];
119
263
  readonly type: "object";
264
+ readonly required: ["messageId", "session", "runMode"];
265
+ readonly additionalProperties: true;
120
266
  };
121
267
  export type AgentChatResponse = FromSchema<typeof schema>;
122
- export declare const validate: import("ajv").ValidateFunction<{
123
- messageId: string;
124
- output: {
125
- artifact?: {
126
- [x: string]: unknown;
127
- } | undefined;
128
- content: string;
129
- references: {
130
- [x: string]: unknown;
131
- }[];
132
- };
133
- runMode: "BACKGROUND" | "IMMEDIATE";
134
- session: {
135
- suspended?: boolean | undefined;
136
- previousStateId?: string | undefined;
137
- hasAgentHistory?: boolean | undefined;
138
- hasFeedback?: boolean | undefined;
139
- suspend?: boolean | undefined;
140
- suspendedTransitionIndices?: number[] | undefined;
141
- id: string;
142
- createdAt: string;
143
- updatedAt: string;
144
- agentName: string;
145
- projectId: string;
146
- schemaId: string;
147
- schemaHash: string;
148
- done: boolean;
149
- currentStateId: string;
150
- chatSessionIds: {
151
- [x: string]: unknown;
268
+ export declare function createUserShapeSchema(): {
269
+ properties: {
270
+ output: import("../../index.ts").PropertySchema | import("../../index.ts").RefSchema;
271
+ input: {
272
+ '@ref': string;
152
273
  };
153
- sessionMemory: {
154
- [x: string]: unknown;
274
+ session: {
275
+ '@ref': string;
276
+ };
277
+ messageId: {
278
+ readonly type: "string";
279
+ readonly description: "The unique identifier for the agent run response message.";
280
+ };
281
+ runMode: {
282
+ readonly enum: ["BACKGROUND", "IMMEDIATE"];
283
+ readonly description: "Indicates how the agent message was run";
155
284
  };
156
285
  };
157
- }>;
286
+ required: string[];
287
+ additionalProperties: false;
288
+ type: "object";
289
+ };
@@ -1,8 +1,6 @@
1
- import { createTypedValidator } from '@takeshape/json-schema';
2
1
  import * as agentChatPayload from "./agent-chat-payload.js";
3
- import { AI_AGENT_CHAT_RESPONSE_SHAPE_NAME } from "./constants.js";
4
2
  import * as sendAgentMessageResponse from "./send-agent-message-response.js";
5
- export const shapeName = AI_AGENT_CHAT_RESPONSE_SHAPE_NAME;
3
+ export const shapeName = 'TSChatResponse';
6
4
  export const schema = {
7
5
  ...sendAgentMessageResponse.schema,
8
6
  properties: {
@@ -10,8 +8,14 @@ export const schema = {
10
8
  output: {
11
9
  ...agentChatPayload.schema
12
10
  }
13
- },
14
- additionalProperties: false,
15
- required: [...sendAgentMessageResponse.schema.required, 'output']
11
+ }
16
12
  };
17
- export const validate = createTypedValidator(schema);
13
+ export function createUserShapeSchema() {
14
+ return sendAgentMessageResponse.createUserShapeSchema({
15
+ properties: {
16
+ output: {
17
+ '@ref': agentChatPayload.shapeName
18
+ }
19
+ }
20
+ });
21
+ }
@@ -1,6 +1,5 @@
1
1
  import { createTypedValidator } from '@takeshape/json-schema';
2
- import { AI_AGENT_GENERATE_ARGS_SHAPE_NAME } from "./constants.js";
3
- export const shapeName = AI_AGENT_GENERATE_ARGS_SHAPE_NAME;
2
+ export const shapeName = 'TSGenerateArgs';
4
3
  export const schema = {
5
4
  type: 'object',
6
5
  properties: {
@@ -0,0 +1,73 @@
1
+ import type { FromSchema } from 'json-schema-to-ts';
2
+ export declare const shapeName = "TSAgentMessageInput";
3
+ export declare const unknownInputSchema: {
4
+ readonly title: "TSAgentMessageUnknownInput";
5
+ readonly type: "object";
6
+ readonly properties: {
7
+ readonly type: {
8
+ readonly const: "unknown";
9
+ };
10
+ readonly data: {};
11
+ };
12
+ readonly required: ["type", "data"];
13
+ readonly additionalProperties: false;
14
+ };
15
+ export declare const stringInputSchema: {
16
+ readonly title: "TSAgentMessageStringInput";
17
+ readonly type: "object";
18
+ readonly properties: {
19
+ readonly type: {
20
+ readonly const: "string";
21
+ };
22
+ readonly content: {
23
+ readonly type: "string";
24
+ };
25
+ };
26
+ readonly required: ["type", "content"];
27
+ readonly additionalProperties: false;
28
+ };
29
+ export declare const schema: {
30
+ readonly title: "TSAgentMessageInput";
31
+ readonly description: "The input schema for agent messages.";
32
+ readonly discriminator: {
33
+ readonly propertyName: "type";
34
+ };
35
+ readonly oneOf: [{
36
+ readonly title: "TSAgentMessageUnknownInput";
37
+ readonly type: "object";
38
+ readonly properties: {
39
+ readonly type: {
40
+ readonly const: "unknown";
41
+ };
42
+ readonly data: {};
43
+ };
44
+ readonly required: ["type", "data"];
45
+ readonly additionalProperties: false;
46
+ }, {
47
+ readonly title: "TSAgentMessageStringInput";
48
+ readonly type: "object";
49
+ readonly properties: {
50
+ readonly type: {
51
+ readonly const: "string";
52
+ };
53
+ readonly content: {
54
+ readonly type: "string";
55
+ };
56
+ };
57
+ readonly required: ["type", "content"];
58
+ readonly additionalProperties: false;
59
+ }];
60
+ };
61
+ export type AgentMessageInput = FromSchema<typeof schema>;
62
+ export declare const shapeSchema: {
63
+ readonly oneOf: [{
64
+ readonly '@ref': "TSAgentMessageUnknownInput";
65
+ }, {
66
+ readonly '@ref': "TSAgentMessageStringInput";
67
+ }];
68
+ readonly title: "TSAgentMessageInput";
69
+ readonly description: "The input schema for agent messages.";
70
+ readonly discriminator: {
71
+ readonly propertyName: "type";
72
+ };
73
+ };
@@ -0,0 +1,39 @@
1
+ export const shapeName = 'TSAgentMessageInput';
2
+ export const unknownInputSchema = {
3
+ title: 'TSAgentMessageUnknownInput',
4
+ type: 'object',
5
+ properties: {
6
+ type: {
7
+ const: 'unknown'
8
+ },
9
+ data: {}
10
+ },
11
+ required: ['type', 'data'],
12
+ additionalProperties: false
13
+ };
14
+ export const stringInputSchema = {
15
+ title: 'TSAgentMessageStringInput',
16
+ type: 'object',
17
+ properties: {
18
+ type: {
19
+ const: 'string'
20
+ },
21
+ content: {
22
+ type: 'string'
23
+ }
24
+ },
25
+ required: ['type', 'content'],
26
+ additionalProperties: false
27
+ };
28
+ export const schema = {
29
+ title: shapeName,
30
+ description: 'The input schema for agent messages.',
31
+ discriminator: {
32
+ propertyName: 'type'
33
+ },
34
+ oneOf: [unknownInputSchema, stringInputSchema]
35
+ };
36
+ export const shapeSchema = {
37
+ ...schema,
38
+ oneOf: [{ '@ref': unknownInputSchema.title }, { '@ref': stringInputSchema.title }]
39
+ };
@@ -0,0 +1,169 @@
1
+ import type { FromSchema } from 'json-schema-to-ts';
2
+ export declare const shapeName = "TSAgentMessageOutput";
3
+ export declare const generateStateOutputSchema: {
4
+ readonly title: "TSAgentGenerateStateOutput";
5
+ readonly type: "object";
6
+ readonly properties: {
7
+ readonly type: {
8
+ readonly const: "generate";
9
+ };
10
+ readonly data: {};
11
+ };
12
+ readonly required: ["type", "data"];
13
+ readonly additionalProperties: false;
14
+ };
15
+ export declare const graphQLStateOutputSchema: {
16
+ readonly title: "TSAgentGraphQLStateOutput";
17
+ readonly type: "object";
18
+ readonly properties: {
19
+ readonly type: {
20
+ readonly const: "graphql";
21
+ };
22
+ readonly data: {};
23
+ };
24
+ readonly required: ["type", "data"];
25
+ readonly additionalProperties: false;
26
+ };
27
+ export declare const chatStateOutputSchema: {
28
+ readonly title: "TSAgentChatStateOutput";
29
+ readonly type: "object";
30
+ readonly properties: {
31
+ readonly type: {
32
+ readonly const: "chat";
33
+ };
34
+ readonly data: {
35
+ readonly type: "object";
36
+ readonly properties: {
37
+ readonly content: {
38
+ readonly type: "string";
39
+ };
40
+ readonly artifact: {
41
+ readonly type: "object";
42
+ };
43
+ readonly references: {
44
+ readonly type: "array";
45
+ readonly items: {
46
+ readonly type: "object";
47
+ readonly properties: {
48
+ readonly _tid: {
49
+ readonly type: "string";
50
+ };
51
+ };
52
+ readonly required: ["_tid"];
53
+ readonly additionalProperties: false;
54
+ };
55
+ };
56
+ };
57
+ readonly required: ["content", "references"];
58
+ readonly additionalProperties: false;
59
+ };
60
+ };
61
+ readonly required: ["type", "data"];
62
+ readonly additionalProperties: false;
63
+ };
64
+ export declare const unknownStateOutputSchema: {
65
+ readonly title: "TSAgentUnknownStateOutput";
66
+ readonly type: "object";
67
+ readonly properties: {
68
+ readonly type: {
69
+ readonly const: "unknown";
70
+ };
71
+ readonly data: {};
72
+ };
73
+ readonly required: ["type", "data"];
74
+ readonly additionalProperties: false;
75
+ };
76
+ export declare const schema: {
77
+ readonly title: "TSAgentMessageOutput";
78
+ readonly description: "The output schema for agent messages.";
79
+ readonly discriminator: {
80
+ readonly propertyName: "type";
81
+ };
82
+ readonly oneOf: [{
83
+ readonly title: "TSAgentGenerateStateOutput";
84
+ readonly type: "object";
85
+ readonly properties: {
86
+ readonly type: {
87
+ readonly const: "generate";
88
+ };
89
+ readonly data: {};
90
+ };
91
+ readonly required: ["type", "data"];
92
+ readonly additionalProperties: false;
93
+ }, {
94
+ readonly title: "TSAgentGraphQLStateOutput";
95
+ readonly type: "object";
96
+ readonly properties: {
97
+ readonly type: {
98
+ readonly const: "graphql";
99
+ };
100
+ readonly data: {};
101
+ };
102
+ readonly required: ["type", "data"];
103
+ readonly additionalProperties: false;
104
+ }, {
105
+ readonly title: "TSAgentChatStateOutput";
106
+ readonly type: "object";
107
+ readonly properties: {
108
+ readonly type: {
109
+ readonly const: "chat";
110
+ };
111
+ readonly data: {
112
+ readonly type: "object";
113
+ readonly properties: {
114
+ readonly content: {
115
+ readonly type: "string";
116
+ };
117
+ readonly artifact: {
118
+ readonly type: "object";
119
+ };
120
+ readonly references: {
121
+ readonly type: "array";
122
+ readonly items: {
123
+ readonly type: "object";
124
+ readonly properties: {
125
+ readonly _tid: {
126
+ readonly type: "string";
127
+ };
128
+ };
129
+ readonly required: ["_tid"];
130
+ readonly additionalProperties: false;
131
+ };
132
+ };
133
+ };
134
+ readonly required: ["content", "references"];
135
+ readonly additionalProperties: false;
136
+ };
137
+ };
138
+ readonly required: ["type", "data"];
139
+ readonly additionalProperties: false;
140
+ }, {
141
+ readonly title: "TSAgentUnknownStateOutput";
142
+ readonly type: "object";
143
+ readonly properties: {
144
+ readonly type: {
145
+ readonly const: "unknown";
146
+ };
147
+ readonly data: {};
148
+ };
149
+ readonly required: ["type", "data"];
150
+ readonly additionalProperties: false;
151
+ }];
152
+ };
153
+ export type AgentMessageOutput = FromSchema<typeof schema>;
154
+ export declare const shapeSchema: {
155
+ readonly oneOf: [{
156
+ readonly '@ref': "TSAgentGenerateStateOutput";
157
+ }, {
158
+ readonly '@ref': "TSAgentGraphQLStateOutput";
159
+ }, {
160
+ readonly '@ref': "TSAgentChatStateOutput";
161
+ }, {
162
+ readonly '@ref': "TSAgentUnknownStateOutput";
163
+ }];
164
+ readonly title: "TSAgentMessageOutput";
165
+ readonly description: "The output schema for agent messages.";
166
+ readonly discriminator: {
167
+ readonly propertyName: "type";
168
+ };
169
+ };
@@ -0,0 +1,77 @@
1
+ export const shapeName = 'TSAgentMessageOutput';
2
+ export const generateStateOutputSchema = {
3
+ title: 'TSAgentGenerateStateOutput',
4
+ type: 'object',
5
+ properties: {
6
+ type: { const: 'generate' },
7
+ data: {}
8
+ },
9
+ required: ['type', 'data'],
10
+ additionalProperties: false
11
+ };
12
+ export const graphQLStateOutputSchema = {
13
+ title: 'TSAgentGraphQLStateOutput',
14
+ type: 'object',
15
+ properties: {
16
+ type: { const: 'graphql' },
17
+ data: {}
18
+ },
19
+ required: ['type', 'data'],
20
+ additionalProperties: false
21
+ };
22
+ export const chatStateOutputSchema = {
23
+ title: 'TSAgentChatStateOutput',
24
+ type: 'object',
25
+ properties: {
26
+ type: { const: 'chat' },
27
+ data: {
28
+ type: 'object',
29
+ properties: {
30
+ content: { type: 'string' },
31
+ artifact: { type: 'object' },
32
+ references: {
33
+ type: 'array',
34
+ items: {
35
+ type: 'object',
36
+ properties: {
37
+ _tid: { type: 'string' }
38
+ },
39
+ required: ['_tid'],
40
+ additionalProperties: false
41
+ }
42
+ }
43
+ },
44
+ required: ['content', 'references'],
45
+ additionalProperties: false
46
+ }
47
+ },
48
+ required: ['type', 'data'],
49
+ additionalProperties: false
50
+ };
51
+ export const unknownStateOutputSchema = {
52
+ title: 'TSAgentUnknownStateOutput',
53
+ type: 'object',
54
+ properties: {
55
+ type: { const: 'unknown' },
56
+ data: {}
57
+ },
58
+ required: ['type', 'data'],
59
+ additionalProperties: false
60
+ };
61
+ export const schema = {
62
+ title: shapeName,
63
+ description: 'The output schema for agent messages.',
64
+ discriminator: {
65
+ propertyName: 'type'
66
+ },
67
+ oneOf: [generateStateOutputSchema, graphQLStateOutputSchema, chatStateOutputSchema, unknownStateOutputSchema]
68
+ };
69
+ export const shapeSchema = {
70
+ ...schema,
71
+ oneOf: [
72
+ { '@ref': generateStateOutputSchema.title },
73
+ { '@ref': graphQLStateOutputSchema.title },
74
+ { '@ref': chatStateOutputSchema.title },
75
+ { '@ref': unknownStateOutputSchema.title }
76
+ ]
77
+ };