@takeshape/schema 11.19.0 → 11.23.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.
@@ -136,7 +136,7 @@
136
136
  "type": "array",
137
137
  "items": {
138
138
  "default": {
139
- "valueCheck": {
139
+ "condition": {
140
140
  "type": "none"
141
141
  }
142
142
  },
@@ -153,9 +153,6 @@
153
153
  "propertyName": "type"
154
154
  },
155
155
  "oneOf": [
156
- {
157
- "$ref": "#/definitions/agentExecutionNoop"
158
- },
159
156
  {
160
157
  "$ref": "#/definitions/agentExecutionInput"
161
158
  },
@@ -163,24 +160,13 @@
163
160
  "$ref": "#/definitions/agentExecutionGraphql"
164
161
  },
165
162
  {
166
- "$ref": "#/definitions/agentExecutionGenerateText"
163
+ "$ref": "#/definitions/agentExecutionGenerate"
167
164
  },
168
165
  {
169
166
  "$ref": "#/definitions/agentExecutionChat"
170
167
  }
171
168
  ]
172
169
  },
173
- "agentExecutionNoop": {
174
- "title": "Agent Execution No Operation",
175
- "type": "object",
176
- "properties": {
177
- "type": {
178
- "enum": ["noop"]
179
- }
180
- },
181
- "required": ["type"],
182
- "additionalProperties": false
183
- },
184
170
  "agentExecutionInputArgument": {
185
171
  "title": "Agent Execution Input Argument",
186
172
  "type": "object",
@@ -190,7 +176,7 @@
190
176
  "pattern": "^[0-9A-Za-z_]+$"
191
177
  },
192
178
  "argType": {
193
- "enum": ["boolean", "integer", "number", "string"]
179
+ "enum": ["boolean", "integer", "number", "string", "sessionId"]
194
180
  },
195
181
  "required": {
196
182
  "type": "boolean"
@@ -408,12 +394,12 @@
408
394
  "required": ["ref"],
409
395
  "additionalProperties": false
410
396
  },
411
- "agentExecutionGenerateText": {
412
- "title": "Agent Execution Generate Text",
397
+ "agentExecutionGenerate": {
398
+ "title": "Agent Execution Generate",
413
399
  "type": "object",
414
400
  "properties": {
415
401
  "type": {
416
- "enum": ["generateText"]
402
+ "enum": ["generate"]
417
403
  },
418
404
  "service": {
419
405
  "type": "string"
@@ -427,7 +413,7 @@
427
413
  "input": {
428
414
  "$ref": "#/definitions/agentAiStateInput"
429
415
  },
430
- "jsonSchema": {
416
+ "outputShape": {
431
417
  "type": "string"
432
418
  },
433
419
  "tools": {
@@ -449,6 +435,38 @@
449
435
  "required": ["type", "service", "model", "input"],
450
436
  "additionalProperties": false
451
437
  },
438
+ "agentChatEndConditionNone": {
439
+ "title": "Agent Chat End Condition None",
440
+ "type": "object",
441
+ "properties": {
442
+ "type": {
443
+ "enum": ["none"]
444
+ }
445
+ },
446
+ "required": [
447
+ "type"
448
+ ],
449
+ "additionalProperties": false
450
+ },
451
+ "agentChatEndConditionStringContains": {
452
+ "title": "Agent Chat End Condition String Contains",
453
+ "type": "object",
454
+ "properties": {
455
+ "type": {
456
+ "enum": [
457
+ "stringContains"
458
+ ]
459
+ },
460
+ "string": {
461
+ "type": "string"
462
+ }
463
+ },
464
+ "required": [
465
+ "type",
466
+ "string"
467
+ ],
468
+ "additionalProperties": false
469
+ },
452
470
  "agentExecutionChat": {
453
471
  "title": "Agent Execution Chat",
454
472
  "type": "object",
@@ -474,8 +492,19 @@
474
492
  "$ref": "#/definitions/agentToolConfig"
475
493
  }
476
494
  },
477
- "sessionArg": {
478
- "type": "string"
495
+ "endCondition": {
496
+ "title": "Agent Chat End Condition",
497
+ "discriminator": {
498
+ "propertyName": "type"
499
+ },
500
+ "oneOf": [
501
+ {
502
+ "$ref": "#/definitions/agentChatEndConditionNone"
503
+ },
504
+ {
505
+ "$ref": "#/definitions/agentChatEndConditionStringContains"
506
+ }
507
+ ]
479
508
  },
480
509
  "guardrails": {
481
510
  "type": "array",
@@ -487,25 +516,29 @@
487
516
  "$ref": "#/definitions/agentGenerateOptions"
488
517
  }
489
518
  },
490
- "required": ["type", "service", "model", "input", "sessionArg"],
519
+ "required": ["type", "service", "model", "input", "endCondition"],
491
520
  "additionalProperties": false
492
521
  },
493
- "agentValueCheckNone": {
494
- "title": "Agent Value Check None",
522
+ "agentTransitionConditionNone": {
523
+ "title": "Agent Transition Condition None",
495
524
  "type": "object",
496
525
  "properties": {
497
526
  "type": {
498
527
  "enum": ["none"]
499
528
  }
500
529
  },
501
- "required": ["type"]
530
+ "required": ["type"],
531
+ "additionalProperties": false
502
532
  },
503
- "agentValueCheckBoolean": {
504
- "title": "Agent Value Check Boolean",
533
+ "agentTransitionConditionStateOutput": {
534
+ "title": "Agent Transition Condition State Output",
505
535
  "type": "object",
506
536
  "properties": {
507
537
  "type": {
508
- "enum": ["boolean"]
538
+ "enum": ["stateOutput"]
539
+ },
540
+ "stateId": {
541
+ "type": "string"
509
542
  },
510
543
  "path": {
511
544
  "type": "string"
@@ -514,22 +547,23 @@
514
547
  "type": "boolean"
515
548
  }
516
549
  },
517
- "required": ["type", "path"]
550
+ "required": ["type", "stateId"],
551
+ "additionalProperties": false
518
552
  },
519
553
  "agentTransition": {
520
554
  "title": "Agent Transition",
521
555
  "type": "object",
522
556
  "properties": {
523
- "valueCheck": {
557
+ "condition": {
524
558
  "discriminator": {
525
559
  "propertyName": "type"
526
560
  },
527
561
  "oneOf": [
528
562
  {
529
- "$ref": "#/definitions/agentValueCheckNone"
563
+ "$ref": "#/definitions/agentTransitionConditionNone"
530
564
  },
531
565
  {
532
- "$ref": "#/definitions/agentValueCheckBoolean"
566
+ "$ref": "#/definitions/agentTransitionConditionStateOutput"
533
567
  }
534
568
  ]
535
569
  },
@@ -542,7 +576,7 @@
542
576
  }
543
577
  },
544
578
  "additionalProperties": false,
545
- "required": ["valueCheck", "destination"]
579
+ "required": ["condition", "destination"]
546
580
  },
547
581
  "agentMap": {
548
582
  "title": "Agent Map",
package/es/types/utils.js CHANGED
@@ -57,7 +57,7 @@ export function isAIResolver(resolver) {
57
57
  return isBasicResolver(resolver) && isAIResolverName(resolver.name);
58
58
  }
59
59
  export function isAIAgentStateExecution(agentExecution) {
60
- return agentExecution.type === 'generateText' || agentExecution.type === 'chat';
60
+ return agentExecution.type === 'generate' || agentExecution.type === 'chat';
61
61
  }
62
62
  export function isProjectSchemaWithServices(schema) {
63
63
  return !isUndefined(schema.services);
package/es/validate.js CHANGED
@@ -795,7 +795,7 @@ function validateAgents(projectSchema) {
795
795
  }
796
796
  for (const [agentName, agent] of Object.entries(agents)) {
797
797
  for (const [stateId, state] of Object.entries(agent.states)) {
798
- if (state.execution.type === 'generateText' || state.execution.type === 'chat') {
798
+ if (state.execution.type === 'generate' || state.execution.type === 'chat') {
799
799
  if (!state.execution.tools) {
800
800
  continue;
801
801
  }
@@ -101,6 +101,32 @@
101
101
  }
102
102
  }
103
103
  }
104
+ },
105
+ "AnswerResponse": {
106
+ "id": "AnswerResponse",
107
+ "name": "AnswerResponse",
108
+ "title": "AnswerResponse",
109
+ "schema": {
110
+ "type": "object",
111
+ "properties": {
112
+ "answered": {
113
+ "description": "Set to true if you were able to answer the question",
114
+ "type": "boolean"
115
+ },
116
+ "message": {
117
+ "description": "Put your response here",
118
+ "type": "string"
119
+ },
120
+ "dogName": {
121
+ "description": "If the question is not answered, set the value of `dogName` to a similar dog name, eg change Franky to Frank.",
122
+ "type": "string"
123
+ }
124
+ },
125
+ "required": [
126
+ "answered",
127
+ "message"
128
+ ]
129
+ }
104
130
  }
105
131
  },
106
132
  "workflows": {},
@@ -177,7 +203,7 @@
177
203
  },
178
204
  "transition": [
179
205
  {
180
- "valueCheck": {
206
+ "condition": {
181
207
  "type": "none"
182
208
  },
183
209
  "destination": "bbb"
@@ -209,7 +235,7 @@
209
235
  },
210
236
  "transition": [
211
237
  {
212
- "valueCheck": {
238
+ "condition": {
213
239
  "type": "none"
214
240
  },
215
241
  "destination": "ccc"
@@ -229,32 +255,33 @@
229
255
  }
230
256
  ],
231
257
  "execution": {
232
- "type": "generateText",
258
+ "type": "generate",
233
259
  "service": "openai",
234
260
  "model": "gpt-4o",
235
261
  "input": {
236
262
  "type": "template",
237
263
  "inputTemplate": "Please respond with the color of this dog\n\n{{input}}\n\nif the answer is in this data:\n\n{{{json results}}}"
238
264
  },
239
- "jsonSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"answered\": {\n \"description\": \"Set to true if you were able to answer the question\",\n \"type\": \"boolean\"\n },\n \"message\": {\n \"description\": \"Put your response here\",\n \"type\": \"string\"\n },\n \"dogName\": {\n \"description\": \"If the question is not answered, set the value of `dogName` to a similar dog name, eg change Franky to Frank.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\"answered\", \"message\"]\n}"
265
+ "outputShape": "AnswerResponse"
240
266
  },
241
267
  "transition": [
242
268
  {
243
- "valueCheck": {
244
- "type": "boolean",
269
+ "condition": {
270
+ "type": "stateOutput",
271
+ "stateId": "ccc",
245
272
  "path": "answered"
246
273
  },
247
274
  "destination": "ddd"
248
275
  },
249
276
  {
250
- "valueCheck": {
277
+ "condition": {
251
278
  "type": "none"
252
279
  },
253
280
  "limit": 3,
254
281
  "destination": "bbb"
255
282
  },
256
283
  {
257
- "valueCheck": {
284
+ "condition": {
258
285
  "type": "none"
259
286
  },
260
287
  "destination": "eee"
@@ -275,7 +302,7 @@
275
302
  }
276
303
  ],
277
304
  "execution": {
278
- "type": "generateText",
305
+ "type": "generate",
279
306
  "service": "openai",
280
307
  "model": "gpt-4o",
281
308
  "input": {
@@ -299,7 +326,7 @@
299
326
  }
300
327
  ],
301
328
  "execution": {
302
- "type": "generateText",
329
+ "type": "generate",
303
330
  "service": "openai",
304
331
  "model": "gpt-4o",
305
332
  "input": {
@@ -327,14 +354,14 @@
327
354
  },
328
355
  {
329
356
  "argName": "sessionId",
330
- "argType": "string",
357
+ "argType": "sessionId",
331
358
  "required": false
332
359
  }
333
360
  ]
334
361
  },
335
362
  "transition": [
336
363
  {
337
- "valueCheck": {
364
+ "condition": {
338
365
  "type": "none"
339
366
  },
340
367
  "destination": "3pjuyB47X"
@@ -351,7 +378,9 @@
351
378
  "type": "arg",
352
379
  "inputArgName": "input"
353
380
  },
354
- "sessionArg": "sessionId",
381
+ "endCondition": {
382
+ "type": "none"
383
+ },
355
384
  "systemPrompt": "You are a helpful assistant."
356
385
  },
357
386
  "transition": []
@@ -95,6 +95,29 @@
95
95
  }
96
96
  }
97
97
  }
98
+ },
99
+ "AnswerResponse": {
100
+ "id": "AnswerResponse",
101
+ "name": "AnswerResponse",
102
+ "title": "AnswerResponse",
103
+ "schema": {
104
+ "type": "object",
105
+ "properties": {
106
+ "answered": {
107
+ "description": "Set to true if you were able to answer the question",
108
+ "type": "boolean"
109
+ },
110
+ "message": {
111
+ "description": "Put your response here",
112
+ "type": "string"
113
+ },
114
+ "dogName": {
115
+ "description": "If the question is not answered, set the value of `dogName` to a similar dog name, eg change Franky to Frank.",
116
+ "type": "string"
117
+ }
118
+ },
119
+ "required": ["answered", "message"]
120
+ }
98
121
  }
99
122
  },
100
123
  "workflows": {},
@@ -109,7 +132,7 @@
109
132
  }
110
133
  }
111
134
  },
112
- "schemaVersion": "3.48.0",
135
+ "schemaVersion": "3.49.0",
113
136
  "apiVersion": "2",
114
137
  "services": {
115
138
  "openai": {
@@ -162,7 +185,7 @@
162
185
  },
163
186
  "transition": [
164
187
  {
165
- "valueCheck": {
188
+ "condition": {
166
189
  "type": "none"
167
190
  },
168
191
  "destination": "bbb"
@@ -189,7 +212,7 @@
189
212
  "path": "getDogList.items"
190
213
  },
191
214
  "transition": [
192
- {"valueCheck": {"type": "none"}, "destination": "ccc"}
215
+ {"condition": {"type": "none"}, "destination": "ccc"}
193
216
  ]
194
217
  },
195
218
  "ccc": {
@@ -198,26 +221,26 @@
198
221
  {"name": "results", "steps": [{"type": "previousStateOutput"}]}
199
222
  ],
200
223
  "execution": {
201
- "type": "generateText",
224
+ "type": "generate",
202
225
  "service": "openai",
203
226
  "model": "gpt-4o",
204
227
  "input": {
205
228
  "type": "template",
206
229
  "inputTemplate": "Please respond with the color of this dog\n\n{{input}}\n\nif the answer is in this data:\n\n{{{json results}}}"
207
230
  },
208
- "jsonSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"answered\": {\n \"description\": \"Set to true if you were able to answer the question\",\n \"type\": \"boolean\"\n },\n \"message\": {\n \"description\": \"Put your response here\",\n \"type\": \"string\"\n },\n \"dogName\": {\n \"description\": \"If the question is not answered, set the value of `dogName` to a similar dog name, eg change Franky to Frank.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\"answered\", \"message\"]\n}"
231
+ "outputShape": "AnswerResponse"
209
232
  },
210
233
  "transition": [
211
234
  {
212
- "valueCheck": {"type": "boolean", "path": "answered"},
235
+ "condition": {"type": "stateOutput", "stateId": "ccc", "path": "answered"},
213
236
  "destination": "ddd"
214
237
  },
215
238
  {
216
- "valueCheck": {"type": "none"},
239
+ "condition": {"type": "none"},
217
240
  "limit": 3,
218
241
  "destination": "bbb"
219
242
  },
220
- {"valueCheck": {"type": "none"}, "destination": "eee"}
243
+ {"condition": {"type": "none"}, "destination": "eee"}
221
244
  ]
222
245
  },
223
246
  "ddd": {
@@ -229,7 +252,7 @@
229
252
  }
230
253
  ],
231
254
  "execution": {
232
- "type": "generateText",
255
+ "type": "generate",
233
256
  "service": "openai",
234
257
  "model": "gpt-4o",
235
258
  "input": {
@@ -248,7 +271,7 @@
248
271
  }
249
272
  ],
250
273
  "execution": {
251
- "type": "generateText",
274
+ "type": "generate",
252
275
  "service": "openai",
253
276
  "model": "gpt-4o",
254
277
  "input": {
@@ -276,14 +299,14 @@
276
299
  },
277
300
  {
278
301
  "argName": "sessionId",
279
- "argType": "string",
302
+ "argType": "sessionId",
280
303
  "required": false
281
304
  }
282
305
  ]
283
306
  },
284
307
  "transition": [
285
308
  {
286
- "valueCheck": {
309
+ "condition": {
287
310
  "type": "none"
288
311
  },
289
312
  "destination": "3pjuyB47X"
@@ -300,7 +323,9 @@
300
323
  "type": "arg",
301
324
  "inputArgName": "input"
302
325
  },
303
- "sessionArg": "sessionId",
326
+ "endCondition": {
327
+ "type": "none"
328
+ },
304
329
  "systemPrompt": "You are a helpful assistant."
305
330
  },
306
331
  "transition": []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeshape/schema",
3
- "version": "11.19.0",
3
+ "version": "11.23.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.19.0",
32
- "@takeshape/json-schema": "11.19.0",
33
- "@takeshape/util": "11.19.0"
31
+ "@takeshape/json-schema": "11.23.0",
32
+ "@takeshape/util": "11.23.0",
33
+ "@takeshape/errors": "11.23.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.19.0"
49
+ "@takeshape/infra": "11.23.0"
50
50
  },
51
51
  "engines": {
52
52
  "node": ">=20"