@takeshape/schema 11.33.2 → 11.36.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.
@@ -10,13 +10,70 @@
10
10
  "description": {
11
11
  "type": "string"
12
12
  },
13
+ "systemPrompt": {
14
+ "type": "string"
15
+ },
16
+ "api": {
17
+ "$ref": "#/definitions/agentApi"
18
+ },
19
+ "start": {
20
+ "$ref": "#/definitions/agentStart"
21
+ },
13
22
  "states": {
14
23
  "$ref": "#/definitions/agentStateMap"
15
24
  }
16
25
  },
17
- "required": ["states"],
26
+ "required": ["start", "states", "api"],
18
27
  "additionalProperties": false
19
28
  },
29
+ "agentApi": {
30
+ "title": "Agent API",
31
+ "discriminator": {
32
+ "propertyName": "type"
33
+ },
34
+ "oneOf": [
35
+ {
36
+ "$ref": "#/definitions/agentApiChat"
37
+ },
38
+ {
39
+ "$ref": "#/definitions/agentApiGenerate"
40
+ }
41
+ ]
42
+ },
43
+ "agentApiChat": {
44
+ "title": "Agent API Chat",
45
+ "type": "object",
46
+ "properties": {
47
+ "type": {
48
+ "enum": ["chat"]
49
+ },
50
+ "arguments": {
51
+ "type": "array",
52
+ "items": {
53
+ "$ref": "#/definitions/agentApiArgument"
54
+ }
55
+ }
56
+ },
57
+ "required": ["type"],
58
+ "additionalProperties": false
59
+ },
60
+ "agentApiGenerate": {
61
+ "title": "Agent API Generate",
62
+ "type": "object",
63
+ "properties": {
64
+ "type": {
65
+ "enum": ["generate"]
66
+ },
67
+ "arguments": {
68
+ "type": "array",
69
+ "items": {
70
+ "$ref": "#/definitions/agentApiArgument"
71
+ }
72
+ }
73
+ },
74
+ "required": ["type"],
75
+ "additionalProperties": false
76
+ },
20
77
  "agentVariable": {
21
78
  "title": "Agent Variable",
22
79
  "type": "object",
@@ -164,6 +221,18 @@
164
221
  "required": ["type", "stateId"],
165
222
  "additionalProperties": false
166
223
  },
224
+ "agentStart": {
225
+ "title": "Agent Start",
226
+ "description": "Configuration for the start of an agent's execution",
227
+ "type": "object",
228
+ "properties": {
229
+ "transition": {
230
+ "$ref": "#/definitions/agentTransition"
231
+ }
232
+ },
233
+ "required": ["transition"],
234
+ "additionalProperties": false
235
+ },
167
236
  "agentStateMap": {
168
237
  "title": "Agent States",
169
238
  "description": "States that are traversed during the execution of an agent.",
@@ -175,6 +244,19 @@
175
244
  },
176
245
  "additionalProperties": false
177
246
  },
247
+ "agentTransition": {
248
+ "title": "Agent State Transition",
249
+ "description": "These steps are evaluated in order until a destination is found.",
250
+ "type": "array",
251
+ "items": {
252
+ "default": {
253
+ "condition": {
254
+ "type": "none"
255
+ }
256
+ },
257
+ "$ref": "#/definitions/agentTransitionStep"
258
+ }
259
+ },
178
260
  "agentState": {
179
261
  "title": "Agent State",
180
262
  "description": "One step of an agent's execution.",
@@ -194,17 +276,7 @@
194
276
  "$ref": "#/definitions/agentExecution"
195
277
  },
196
278
  "transition": {
197
- "title": "Agent State Transition",
198
- "description": "These are evaluated in order until a destination is found.",
199
- "type": "array",
200
- "items": {
201
- "default": {
202
- "condition": {
203
- "type": "none"
204
- }
205
- },
206
- "$ref": "#/definitions/agentTransition"
207
- }
279
+ "$ref": "#/definitions/agentTransition"
208
280
  }
209
281
  },
210
282
  "required": ["name", "execution"],
@@ -216,9 +288,6 @@
216
288
  "propertyName": "type"
217
289
  },
218
290
  "oneOf": [
219
- {
220
- "$ref": "#/definitions/agentExecutionInput"
221
- },
222
291
  {
223
292
  "$ref": "#/definitions/agentExecutionGraphql"
224
293
  },
@@ -230,8 +299,8 @@
230
299
  }
231
300
  ]
232
301
  },
233
- "agentExecutionInputArgument": {
234
- "title": "Agent Execution Input Argument",
302
+ "agentApiArgument": {
303
+ "title": "Agent API Argument",
235
304
  "type": "object",
236
305
  "properties": {
237
306
  "argName": {
@@ -248,30 +317,6 @@
248
317
  "required": ["argName", "argType"],
249
318
  "additionalProperties": false
250
319
  },
251
- "agentExecutionInput": {
252
- "title": "Agent Execution Input",
253
- "type": "object",
254
- "properties": {
255
- "type": {
256
- "enum": ["input"]
257
- },
258
- "name": {
259
- "type": "string",
260
- "pattern": "^[0-9A-Za-z_]+$"
261
- },
262
- "inputType": {
263
- "enum": ["query", "mutation"]
264
- },
265
- "arguments": {
266
- "type": "array",
267
- "items": {
268
- "$ref": "#/definitions/agentExecutionInputArgument"
269
- }
270
- }
271
- },
272
- "required": ["type", "name", "inputType"],
273
- "additionalProperties": false
274
- },
275
320
  "agentExecutionGraphql": {
276
321
  "title": "Agent Execution GraphQL",
277
322
  "type": "object",
@@ -295,12 +340,10 @@
295
340
  "properties": {
296
341
  "type": {
297
342
  "enum": ["arg"]
298
- },
299
- "inputArgName": {
300
- "type": "string"
301
343
  }
302
344
  },
303
- "required": ["type", "inputArgName"]
345
+ "required": ["type"],
346
+ "additionalProperties": false
304
347
  },
305
348
  "agentAiStateInputTemplate": {
306
349
  "title": "Agent AI State Input Template",
@@ -313,7 +356,8 @@
313
356
  "type": "string"
314
357
  }
315
358
  },
316
- "required": ["type", "inputTemplate"]
359
+ "required": ["type", "inputTemplate"],
360
+ "additionalProperties": false
317
361
  },
318
362
  "agentAiStateInput": {
319
363
  "title": "Agent AI State Input",
@@ -536,8 +580,8 @@
536
580
  "required": ["type", "service", "model", "input"],
537
581
  "additionalProperties": false
538
582
  },
539
- "agentTransitionConditionNone": {
540
- "title": "Agent Transition Condition None",
583
+ "agentTransitionStepConditionNone": {
584
+ "title": "Agent Transition Step Condition None",
541
585
  "type": "object",
542
586
  "properties": {
543
587
  "type": {
@@ -547,8 +591,8 @@
547
591
  "required": ["type"],
548
592
  "additionalProperties": false
549
593
  },
550
- "agentTransitionConditionStateOutput": {
551
- "title": "Agent Transition Condition State Output",
594
+ "agentTransitionStepConditionStateOutput": {
595
+ "title": "Agent Transition Step Condition State Output",
552
596
  "type": "object",
553
597
  "properties": {
554
598
  "type": {
@@ -567,8 +611,8 @@
567
611
  "required": ["type", "stateId"],
568
612
  "additionalProperties": false
569
613
  },
570
- "agentTransitionConditionStringContains": {
571
- "title": "Agent Transition Condition String Contains",
614
+ "agentTransitionStepConditionStringContains": {
615
+ "title": "Agent Transition Step Condition String Contains",
572
616
  "type": "object",
573
617
  "properties": {
574
618
  "type": {
@@ -587,8 +631,8 @@
587
631
  "required": ["type", "string"],
588
632
  "additionalProperties": false
589
633
  },
590
- "agentTransitionConditionVariableExists": {
591
- "title": "Agent Transition Condition Variable Exists",
634
+ "agentTransitionStepConditionVariableExists": {
635
+ "title": "Agent Transition Step Condition Variable Exists",
592
636
  "type": "object",
593
637
  "properties": {
594
638
  "type": {
@@ -604,8 +648,8 @@
604
648
  "required": ["type", "variable"],
605
649
  "additionalProperties": false
606
650
  },
607
- "agentTransition": {
608
- "title": "Agent Transition",
651
+ "agentTransitionStep": {
652
+ "title": "Agent Transition Step",
609
653
  "type": "object",
610
654
  "properties": {
611
655
  "destination": {
@@ -621,16 +665,16 @@
621
665
  },
622
666
  "oneOf": [
623
667
  {
624
- "$ref": "#/definitions/agentTransitionConditionNone"
668
+ "$ref": "#/definitions/agentTransitionStepConditionNone"
625
669
  },
626
670
  {
627
- "$ref": "#/definitions/agentTransitionConditionStateOutput"
671
+ "$ref": "#/definitions/agentTransitionStepConditionStateOutput"
628
672
  },
629
673
  {
630
- "$ref": "#/definitions/agentTransitionConditionStringContains"
674
+ "$ref": "#/definitions/agentTransitionStepConditionStringContains"
631
675
  },
632
676
  {
633
- "$ref": "#/definitions/agentTransitionConditionVariableExists"
677
+ "$ref": "#/definitions/agentTransitionStepConditionVariableExists"
634
678
  }
635
679
  ]
636
680
  },
@@ -681,16 +725,11 @@
681
725
  "agentName": {
682
726
  "type": "string",
683
727
  "pattern": "^[0-9A-Za-z_]+$"
684
- },
685
- "inputStateId": {
686
- "type": "string",
687
- "pattern": "^[0-9A-Za-z_]+$"
688
728
  }
689
729
  },
690
730
  "required": [
691
731
  "name",
692
- "agentName",
693
- "inputStateId"
732
+ "agentName"
694
733
  ],
695
734
  "additionalProperties": false
696
735
  },
package/es/taxonomies.js CHANGED
@@ -1,10 +1,5 @@
1
- import memoize from 'lodash/memoize';
1
+ import { weakMemoize } from '@takeshape/util';
2
2
  import { createSchemaPropertyAccessor } from './schema-util';
3
- function weakMemoize(fn) {
4
- const memoized = memoize(fn);
5
- memoized.cache = new WeakMap();
6
- return memoized;
7
- }
8
3
  export function getFirstStringFieldV3(shape, projectSchema) {
9
4
  const forms = projectSchema.forms?.[shape.name];
10
5
  if (!forms?.default) {
@@ -186,30 +186,27 @@
186
186
  "agents": {
187
187
  "findDogColor": {
188
188
  "description": "AI Agent finds a dog's color based on its name",
189
+ "api": {
190
+ "type": "generate",
191
+ "arguments": [
192
+ {
193
+ "argName": "input",
194
+ "argType": "string",
195
+ "required": true
196
+ }
197
+ ]
198
+ },
199
+ "start": {
200
+ "transition": [
201
+ {
202
+ "condition": {
203
+ "type": "none"
204
+ },
205
+ "destination": "bbb"
206
+ }
207
+ ]
208
+ },
189
209
  "states": {
190
- "aaa": {
191
- "name": "mutation",
192
- "execution": {
193
- "type": "input",
194
- "name": "findDogColor",
195
- "inputType": "mutation",
196
- "arguments": [
197
- {
198
- "argName": "input",
199
- "argType": "string",
200
- "required": true
201
- }
202
- ]
203
- },
204
- "transition": [
205
- {
206
- "condition": {
207
- "type": "none"
208
- },
209
- "destination": "bbb"
210
- }
211
- ]
212
- },
213
210
  "bbb": {
214
211
  "name": "query",
215
212
  "variables": [
@@ -339,35 +336,21 @@
339
336
  }
340
337
  },
341
338
  "chat": {
339
+ "api": {
340
+ "type": "chat",
341
+ "arguments": []
342
+ },
343
+ "start": {
344
+ "transition": [
345
+ {
346
+ "condition": {
347
+ "type": "none"
348
+ },
349
+ "destination": "3pjuyB47X"
350
+ }
351
+ ]
352
+ },
342
353
  "states": {
343
- "_L2N2Yxut": {
344
- "name": "mutation",
345
- "execution": {
346
- "type": "input",
347
- "name": "chat",
348
- "inputType": "mutation",
349
- "arguments": [
350
- {
351
- "argName": "input",
352
- "argType": "string",
353
- "required": true
354
- },
355
- {
356
- "argName": "sessionId",
357
- "argType": "sessionId",
358
- "required": false
359
- }
360
- ]
361
- },
362
- "transition": [
363
- {
364
- "condition": {
365
- "type": "none"
366
- },
367
- "destination": "3pjuyB47X"
368
- }
369
- ]
370
- },
371
354
  "3pjuyB47X": {
372
355
  "name": "chat",
373
356
  "execution": {
@@ -375,8 +358,7 @@
375
358
  "service": "openai",
376
359
  "model": "gpt-4o",
377
360
  "input": {
378
- "type": "arg",
379
- "inputArgName": "input"
361
+ "type": "arg"
380
362
  },
381
363
  "systemPrompt": "You are a helpful assistant. If the user says they have no further questions, end your response with the string ALL_DONE."
382
364
  },
@@ -168,30 +168,27 @@
168
168
  "agents": {
169
169
  "findDogColor": {
170
170
  "description": "AI Agent finds a dog's color based on its name",
171
+ "api": {
172
+ "type": "generate",
173
+ "arguments": [
174
+ {
175
+ "argName": "input",
176
+ "argType": "string",
177
+ "required": true
178
+ }
179
+ ]
180
+ },
181
+ "start": {
182
+ "transition": [
183
+ {
184
+ "condition": {
185
+ "type": "none"
186
+ },
187
+ "destination": "bbb"
188
+ }
189
+ ]
190
+ },
171
191
  "states": {
172
- "aaa": {
173
- "name": "mutation",
174
- "execution": {
175
- "type": "input",
176
- "name": "findDogColor",
177
- "inputType": "mutation",
178
- "arguments": [
179
- {
180
- "argName": "input",
181
- "argType": "string",
182
- "required": true
183
- }
184
- ]
185
- },
186
- "transition": [
187
- {
188
- "condition": {
189
- "type": "none"
190
- },
191
- "destination": "bbb"
192
- }
193
- ]
194
- },
195
192
  "bbb": {
196
193
  "name": "query",
197
194
  "variables": [
@@ -284,35 +281,21 @@
284
281
  }
285
282
  },
286
283
  "chat": {
284
+ "api": {
285
+ "type": "chat",
286
+ "arguments": []
287
+ },
288
+ "start": {
289
+ "transition": [
290
+ {
291
+ "condition": {
292
+ "type": "none"
293
+ },
294
+ "destination": "3pjuyB47X"
295
+ }
296
+ ]
297
+ },
287
298
  "states": {
288
- "_L2N2Yxut": {
289
- "name": "mutation",
290
- "execution": {
291
- "type": "input",
292
- "name": "chat",
293
- "inputType": "mutation",
294
- "arguments": [
295
- {
296
- "argName": "input",
297
- "argType": "string",
298
- "required": true
299
- },
300
- {
301
- "argName": "sessionId",
302
- "argType": "sessionId",
303
- "required": false
304
- }
305
- ]
306
- },
307
- "transition": [
308
- {
309
- "condition": {
310
- "type": "none"
311
- },
312
- "destination": "3pjuyB47X"
313
- }
314
- ]
315
- },
316
299
  "3pjuyB47X": {
317
300
  "name": "chat",
318
301
  "execution": {
@@ -320,8 +303,7 @@
320
303
  "service": "openai",
321
304
  "model": "gpt-4o",
322
305
  "input": {
323
- "type": "arg",
324
- "inputArgName": "input"
306
+ "type": "arg"
325
307
  },
326
308
  "systemPrompt": "You are a helpful assistant. If the user says they have no further questions, end your response with the string ALL_DONE."
327
309
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeshape/schema",
3
- "version": "11.33.2",
3
+ "version": "11.36.0",
4
4
  "description": "TakeShape Schema",
5
5
  "homepage": "https://www.takeshape.io",
6
6
  "repository": {
@@ -28,9 +28,9 @@
28
28
  "p-reduce": "^2.1.0",
29
29
  "semver": "^7.3.2",
30
30
  "tiny-invariant": "^1.2.0",
31
- "@takeshape/errors": "11.33.2",
32
- "@takeshape/json-schema": "11.33.2",
33
- "@takeshape/util": "11.33.2"
31
+ "@takeshape/errors": "11.36.0",
32
+ "@takeshape/util": "11.36.0",
33
+ "@takeshape/json-schema": "11.36.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@takeshape/json-schema-to-typescript": "^11.0.0",
@@ -46,7 +46,7 @@
46
46
  "meow": "^9.0.0",
47
47
  "p-map": "^5.0.0",
48
48
  "shortid": "^2.2.15",
49
- "@takeshape/infra": "11.33.2"
49
+ "@takeshape/infra": "11.36.0"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=20"