tinet-agent-cli 0.1.0.dev36__py3-none-any.whl

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 (104) hide show
  1. taco/__init__.py +1 -0
  2. taco/agent_openapi/__init__.py +1 -0
  3. taco/agent_openapi/catalog.py +198 -0
  4. taco/agent_openapi/models.py +47 -0
  5. taco/agent_openapi/parameters.py +111 -0
  6. taco/agent_openapi/service.py +73 -0
  7. taco/aikb/__init__.py +4 -0
  8. taco/aikb/catalog.py +380 -0
  9. taco/aikb/executors.py +157 -0
  10. taco/aikb/file_input.py +55 -0
  11. taco/aikb/models.py +42 -0
  12. taco/aikb/parameters.py +135 -0
  13. taco/aikb/service.py +68 -0
  14. taco/assets/__init__.py +1 -0
  15. taco/assets/agent_openapi/catalog.json +14 -0
  16. taco/assets/agent_openapi/operations/conversation/list-conversations.json +67 -0
  17. taco/assets/agent_openapi/operations/message/list-conversation-messages.json +80 -0
  18. taco/assets/agent_openapi/operations/trace/list-message-traces.json +72 -0
  19. taco/assets/aikb/catalog.json +41 -0
  20. taco/assets/aikb/operations/conversation/chat-conversation-on-open.json +99 -0
  21. taco/assets/aikb/operations/directory/delete-directory.json +81 -0
  22. taco/assets/aikb/operations/directory/edit-directory.json +97 -0
  23. taco/assets/aikb/operations/directory/list-directory-tree.json +106 -0
  24. taco/assets/aikb/operations/directory/save-directory.json +109 -0
  25. taco/assets/aikb/operations/faq/create-faq.json +193 -0
  26. taco/assets/aikb/operations/faq/delete-faq.json +81 -0
  27. taco/assets/aikb/operations/faq/describe-faq.json +82 -0
  28. taco/assets/aikb/operations/faq/edit-faq.json +193 -0
  29. taco/assets/aikb/operations/faq/list-faqs.json +136 -0
  30. taco/assets/aikb/operations/file/create-file.json +145 -0
  31. taco/assets/aikb/operations/file/delete-files.json +110 -0
  32. taco/assets/aikb/operations/file/describe-file.json +82 -0
  33. taco/assets/aikb/operations/file/get-file-upload-url.json +154 -0
  34. taco/assets/aikb/operations/file/list-files.json +146 -0
  35. taco/assets/aikb/operations/media/describe-faq-media-url.json +98 -0
  36. taco/assets/aikb/operations/media/describe-file-media-url.json +90 -0
  37. taco/assets/aikb/operations/oss/signature-for-upload.json +85 -0
  38. taco/assets/aikb/operations/recycle-bin/list-recycled-items.json +151 -0
  39. taco/assets/aikb/operations/repository/describe-bot-repository.json +71 -0
  40. taco/assets/aikb/operations/repository/list-private-repositories.json +75 -0
  41. taco/assets/aikb/operations/repository/list-public-repositories.json +75 -0
  42. taco/assets/aikb/operations/search/search-knowledge-on-open.json +180 -0
  43. taco/assets/examples/README.md +3 -0
  44. taco/assets/examples/agent-basic.json +16 -0
  45. taco/assets/examples/agent-builtin-tool.json +28 -0
  46. taco/assets/examples/agent-workflow-tool.json +30 -0
  47. taco/assets/examples/chatflow-basic.json +24 -0
  48. taco/assets/examples/workflow-http.json +34 -0
  49. taco/assets/manifest.json +12 -0
  50. taco/assets/scenarios/README.md +3 -0
  51. taco/assets/scenarios/agent-basic.json +80 -0
  52. taco/assets/scenarios/agent-builtin-tool.json +116 -0
  53. taco/assets/scenarios/agent-workflow-tool.json +277 -0
  54. taco/assets/schemas/README.md +3 -0
  55. taco/assets/schemas/agent-tool.json +71 -0
  56. taco/assets/schemas/agent.json +199 -0
  57. taco/assets/schemas/chatflow.json +1048 -0
  58. taco/assets/schemas/workflow.http.json +1052 -0
  59. taco/assets/schemas/workflow.json +1052 -0
  60. taco/assets/skills/README.md +3 -0
  61. taco/assets/skills/taco/SKILL.md +68 -0
  62. taco/assets/skills/taco/manifest.json +10 -0
  63. taco/cli.py +127 -0
  64. taco/commands/__init__.py +1 -0
  65. taco/commands/agent.py +760 -0
  66. taco/commands/aikb.py +132 -0
  67. taco/commands/app.py +151 -0
  68. taco/commands/category.py +37 -0
  69. taco/commands/chatflow.py +183 -0
  70. taco/commands/credential.py +222 -0
  71. taco/commands/discovery.py +409 -0
  72. taco/commands/model.py +55 -0
  73. taco/commands/profile.py +124 -0
  74. taco/commands/tool.py +61 -0
  75. taco/commands/workflow.py +714 -0
  76. taco/core/__init__.py +1 -0
  77. taco/core/access_token_manager.py +98 -0
  78. taco/core/api_client.py +263 -0
  79. taco/core/assets.py +81 -0
  80. taco/core/config_store.py +209 -0
  81. taco/core/context.py +19 -0
  82. taco/core/developer_center_client.py +165 -0
  83. taco/core/errors.py +19 -0
  84. taco/core/file_lock.py +80 -0
  85. taco/core/http_headers.py +21 -0
  86. taco/core/openapi_signer.py +221 -0
  87. taco/core/output.py +72 -0
  88. taco/core/profile_manager.py +217 -0
  89. taco/core/profile_resolver.py +151 -0
  90. taco/core/secure_file.py +76 -0
  91. taco/release.py +363 -0
  92. taco/services/__init__.py +1 -0
  93. taco/services/agent_service.py +314 -0
  94. taco/services/app_service.py +153 -0
  95. taco/services/category_service.py +57 -0
  96. taco/services/model_service.py +117 -0
  97. taco/services/tool_service.py +482 -0
  98. taco/services/workflow_compiler.py +1665 -0
  99. taco/services/workflow_service.py +652 -0
  100. taco/services/workflow_tool_service.py +439 -0
  101. tinet_agent_cli-0.1.0.dev36.dist-info/METADATA +158 -0
  102. tinet_agent_cli-0.1.0.dev36.dist-info/RECORD +104 -0
  103. tinet_agent_cli-0.1.0.dev36.dist-info/WHEEL +4 -0
  104. tinet_agent_cli-0.1.0.dev36.dist-info/entry_points.txt +2 -0
@@ -0,0 +1,1048 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://tinet.local/schemas/taco/chatflow.json",
4
+ "title": "TACO Chatflow DSL",
5
+ "description": "声明式 Chatflow YAML 的本地校验 schema;与 workflow 共用节点能力(含 llm / template-transform),终点为 answer(平台 mode=advanced-chat)。",
6
+ "x-taco": {
7
+ "example": "chatflow-basic",
8
+ "commands": [
9
+ "chatflow validate",
10
+ "workflow validate"
11
+ ],
12
+ "risks": [
13
+ "workflow validate 仅执行本地校验和编译,不会发送 HTTP 请求。",
14
+ "DSL 只能引用 secrets 名称,不能写入真实密钥值。",
15
+ "当前 Dify 普通 HTTP executor 无法安全替换动态 JSON body;json data 仅允许静态 JSON,动态客户输入请改用 query 或 x-www-form-urlencoded。",
16
+ "知识检索节点首期仅支持 multiple 多路召回。",
17
+ "branch / parallel 的 then/else/branches 内暂不支持再嵌套控制流。",
18
+ "iterate.steps 内首期仅允许业务节点(http / code / knowledge-retrieval),不可嵌套控制流。",
19
+ "Chatflow 终点使用 answer 字符串模板,不再使用 outputs 映射。",
20
+ "llm 首期仅支持 basic prompt(无 vision/memory/RAG context);template-transform 须显式声明 variables。"
21
+ ]
22
+ },
23
+ "type": "object",
24
+ "required": [
25
+ "kind",
26
+ "name",
27
+ "inputs",
28
+ "answer"
29
+ ],
30
+ "properties": {
31
+ "kind": {
32
+ "const": "chatflow"
33
+ },
34
+ "name": {
35
+ "type": "string",
36
+ "minLength": 1
37
+ },
38
+ "description": {
39
+ "type": "string"
40
+ },
41
+ "inputs": {
42
+ "type": "object",
43
+ "propertyNames": {
44
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
45
+ "maxLength": 30
46
+ },
47
+ "additionalProperties": {
48
+ "$ref": "#/$defs/input"
49
+ }
50
+ },
51
+ "nodes": {
52
+ "type": "array",
53
+ "minItems": 1,
54
+ "items": {
55
+ "$ref": "#/$defs/step"
56
+ }
57
+ },
58
+ "publish": {
59
+ "type": "object",
60
+ "required": [
61
+ "asTool"
62
+ ],
63
+ "properties": {
64
+ "asTool": {
65
+ "type": "boolean"
66
+ }
67
+ },
68
+ "additionalProperties": false
69
+ },
70
+ "steps": {
71
+ "type": "array",
72
+ "minItems": 1,
73
+ "items": {
74
+ "$ref": "#/$defs/step"
75
+ }
76
+ },
77
+ "answer": {
78
+ "type": "string",
79
+ "minLength": 1,
80
+ "description": "最终回复模板,可引用 inputs 与前序节点输出,例如 {{ result.body }}"
81
+ }
82
+ },
83
+ "$defs": {
84
+ "input": {
85
+ "type": "object",
86
+ "required": [
87
+ "type",
88
+ "required"
89
+ ],
90
+ "properties": {
91
+ "type": {
92
+ "enum": [
93
+ "string",
94
+ "number",
95
+ "select"
96
+ ]
97
+ },
98
+ "required": {
99
+ "type": "boolean"
100
+ },
101
+ "description": {
102
+ "type": "string"
103
+ },
104
+ "options": {
105
+ "type": "array",
106
+ "items": {
107
+ "type": "string",
108
+ "minLength": 1
109
+ }
110
+ },
111
+ "max_length": {
112
+ "type": "integer",
113
+ "minimum": 1
114
+ }
115
+ },
116
+ "allOf": [
117
+ {
118
+ "if": {
119
+ "properties": {
120
+ "type": {
121
+ "const": "select"
122
+ }
123
+ },
124
+ "required": [
125
+ "type"
126
+ ]
127
+ },
128
+ "then": {
129
+ "required": [
130
+ "options"
131
+ ],
132
+ "properties": {
133
+ "options": {
134
+ "minItems": 1
135
+ }
136
+ }
137
+ }
138
+ }
139
+ ],
140
+ "additionalProperties": false
141
+ },
142
+ "scalar": {
143
+ "type": [
144
+ "string",
145
+ "number",
146
+ "boolean"
147
+ ]
148
+ },
149
+ "lineScalar": {
150
+ "oneOf": [
151
+ {
152
+ "type": "string",
153
+ "not": {
154
+ "pattern": "[\\r\\n\\u000B\\u000C\\u001C\\u001D\\u001E\\u0085\\u2028\\u2029]"
155
+ }
156
+ },
157
+ {
158
+ "type": [
159
+ "number",
160
+ "boolean"
161
+ ]
162
+ }
163
+ ]
164
+ },
165
+ "headerScalar": {
166
+ "allOf": [
167
+ {
168
+ "$ref": "#/$defs/lineScalar"
169
+ },
170
+ {
171
+ "if": {
172
+ "type": "string"
173
+ },
174
+ "then": {
175
+ "not": {
176
+ "pattern": "\\{\\{[ \\t]{0,16}[A-Za-z][A-Za-z0-9_]{0,49}\\.[A-Za-z_][A-Za-z0-9_]{0,29}[ \\t]{0,16}\\}\\}"
177
+ }
178
+ }
179
+ }
180
+ ]
181
+ },
182
+ "headerName": {
183
+ "type": "string",
184
+ "pattern": "^[!#$%&'*+.^_`|~0-9A-Za-z-]+$"
185
+ },
186
+ "stringMap": {
187
+ "type": "object",
188
+ "additionalProperties": {
189
+ "$ref": "#/$defs/scalar"
190
+ }
191
+ },
192
+ "headerMap": {
193
+ "type": "object",
194
+ "propertyNames": {
195
+ "$ref": "#/$defs/headerName"
196
+ },
197
+ "additionalProperties": {
198
+ "$ref": "#/$defs/headerScalar"
199
+ }
200
+ },
201
+ "queryMap": {
202
+ "type": "object",
203
+ "propertyNames": {
204
+ "minLength": 1,
205
+ "pattern": "^(?!\\s)(?!.*\\s$)[^:\\r\\n\\u000B\\u000C\\u001C\\u001D\\u001E\\u0085\\u2028\\u2029]+$"
206
+ },
207
+ "additionalProperties": {
208
+ "$ref": "#/$defs/lineScalar"
209
+ }
210
+ },
211
+ "authorization": {
212
+ "type": "object",
213
+ "required": [
214
+ "type"
215
+ ],
216
+ "properties": {
217
+ "type": {
218
+ "enum": [
219
+ "no-auth",
220
+ "api-key"
221
+ ]
222
+ },
223
+ "config": {
224
+ "$ref": "#/$defs/authorizationConfig"
225
+ }
226
+ },
227
+ "allOf": [
228
+ {
229
+ "if": {
230
+ "properties": {
231
+ "type": {
232
+ "const": "no-auth"
233
+ }
234
+ },
235
+ "required": [
236
+ "type"
237
+ ]
238
+ },
239
+ "then": {
240
+ "not": {
241
+ "required": [
242
+ "config"
243
+ ]
244
+ }
245
+ }
246
+ },
247
+ {
248
+ "if": {
249
+ "properties": {
250
+ "type": {
251
+ "const": "api-key"
252
+ }
253
+ },
254
+ "required": [
255
+ "type"
256
+ ]
257
+ },
258
+ "then": {
259
+ "required": [
260
+ "config"
261
+ ]
262
+ }
263
+ }
264
+ ],
265
+ "additionalProperties": false
266
+ },
267
+ "authorizationConfig": {
268
+ "type": "object",
269
+ "required": [
270
+ "type",
271
+ "api_key"
272
+ ],
273
+ "properties": {
274
+ "type": {
275
+ "enum": [
276
+ "basic",
277
+ "bearer",
278
+ "custom"
279
+ ]
280
+ },
281
+ "api_key": {
282
+ "type": "string",
283
+ "pattern": "^\\{\\{[ \\t]{0,16}secrets\\.[A-Za-z_][A-Za-z0-9_]{0,29}[ \\t]{0,16}\\}\\}$"
284
+ },
285
+ "header": {
286
+ "$ref": "#/$defs/headerName"
287
+ }
288
+ },
289
+ "allOf": [
290
+ {
291
+ "if": {
292
+ "properties": {
293
+ "type": {
294
+ "const": "custom"
295
+ }
296
+ },
297
+ "required": [
298
+ "type"
299
+ ]
300
+ },
301
+ "then": {
302
+ "required": [
303
+ "header"
304
+ ],
305
+ "properties": {
306
+ "header": {
307
+ "minLength": 1
308
+ }
309
+ }
310
+ }
311
+ }
312
+ ],
313
+ "additionalProperties": false
314
+ },
315
+ "jsonValue": {
316
+ "oneOf": [
317
+ {
318
+ "type": [
319
+ "string",
320
+ "number",
321
+ "boolean",
322
+ "null"
323
+ ]
324
+ },
325
+ {
326
+ "type": "array",
327
+ "items": {
328
+ "$ref": "#/$defs/jsonValue"
329
+ }
330
+ },
331
+ {
332
+ "$ref": "#/$defs/jsonObject"
333
+ }
334
+ ]
335
+ },
336
+ "jsonObject": {
337
+ "type": "object",
338
+ "additionalProperties": {
339
+ "$ref": "#/$defs/jsonValue"
340
+ }
341
+ },
342
+ "body": {
343
+ "type": "object",
344
+ "description": "JSON body 仅允许静态 JSON;动态值请改用 query 或 x-www-form-urlencoded。",
345
+ "required": [
346
+ "type"
347
+ ],
348
+ "properties": {
349
+ "type": {
350
+ "enum": [
351
+ "none",
352
+ "x-www-form-urlencoded",
353
+ "raw-text",
354
+ "json"
355
+ ]
356
+ },
357
+ "data": {}
358
+ },
359
+ "allOf": [
360
+ {
361
+ "if": {
362
+ "properties": {
363
+ "type": {
364
+ "const": "none"
365
+ }
366
+ },
367
+ "required": [
368
+ "type"
369
+ ]
370
+ },
371
+ "then": {
372
+ "not": {
373
+ "required": [
374
+ "data"
375
+ ]
376
+ }
377
+ }
378
+ },
379
+ {
380
+ "if": {
381
+ "properties": {
382
+ "type": {
383
+ "const": "json"
384
+ }
385
+ },
386
+ "required": [
387
+ "type"
388
+ ]
389
+ },
390
+ "then": {
391
+ "required": [
392
+ "data"
393
+ ],
394
+ "properties": {
395
+ "data": {
396
+ "oneOf": [
397
+ {
398
+ "type": "string"
399
+ },
400
+ {
401
+ "$ref": "#/$defs/jsonObject"
402
+ }
403
+ ]
404
+ }
405
+ }
406
+ }
407
+ },
408
+ {
409
+ "if": {
410
+ "properties": {
411
+ "type": {
412
+ "const": "raw-text"
413
+ }
414
+ },
415
+ "required": [
416
+ "type"
417
+ ]
418
+ },
419
+ "then": {
420
+ "required": [
421
+ "data"
422
+ ],
423
+ "properties": {
424
+ "data": {
425
+ "type": "string"
426
+ }
427
+ }
428
+ }
429
+ },
430
+ {
431
+ "if": {
432
+ "properties": {
433
+ "type": {
434
+ "const": "x-www-form-urlencoded"
435
+ }
436
+ },
437
+ "required": [
438
+ "type"
439
+ ]
440
+ },
441
+ "then": {
442
+ "required": [
443
+ "data"
444
+ ],
445
+ "properties": {
446
+ "data": {
447
+ "$ref": "#/$defs/stringMap"
448
+ }
449
+ }
450
+ }
451
+ }
452
+ ],
453
+ "additionalProperties": false
454
+ },
455
+ "timeout": {
456
+ "type": "object",
457
+ "properties": {
458
+ "connect": {
459
+ "type": "integer",
460
+ "minimum": 0
461
+ },
462
+ "read": {
463
+ "type": "integer",
464
+ "minimum": 0
465
+ },
466
+ "write": {
467
+ "type": "integer",
468
+ "minimum": 0
469
+ }
470
+ },
471
+ "additionalProperties": false
472
+ },
473
+ "retry": {
474
+ "type": "object",
475
+ "properties": {
476
+ "enabled": {
477
+ "type": "boolean"
478
+ },
479
+ "retry_enabled": {
480
+ "type": "boolean"
481
+ },
482
+ "max_retries": {
483
+ "type": "integer",
484
+ "minimum": 0,
485
+ "maximum": 10
486
+ },
487
+ "interval": {
488
+ "type": "integer",
489
+ "minimum": 0
490
+ },
491
+ "retry_interval": {
492
+ "type": "integer",
493
+ "minimum": 0
494
+ }
495
+ },
496
+ "additionalProperties": false
497
+ },
498
+ "httpNode": {
499
+ "type": "object",
500
+ "required": [
501
+ "id",
502
+ "type",
503
+ "method",
504
+ "url"
505
+ ],
506
+ "properties": {
507
+ "id": {
508
+ "type": "string",
509
+ "pattern": "^[A-Za-z][A-Za-z0-9_]*$",
510
+ "maxLength": 50
511
+ },
512
+ "type": {
513
+ "const": "http"
514
+ },
515
+ "method": {
516
+ "enum": [
517
+ "GET",
518
+ "POST",
519
+ "PUT",
520
+ "PATCH",
521
+ "DELETE",
522
+ "HEAD",
523
+ "get",
524
+ "post",
525
+ "put",
526
+ "patch",
527
+ "delete",
528
+ "head"
529
+ ]
530
+ },
531
+ "url": {
532
+ "type": "string",
533
+ "minLength": 1
534
+ },
535
+ "query": {
536
+ "$ref": "#/$defs/queryMap"
537
+ },
538
+ "headers": {
539
+ "$ref": "#/$defs/headerMap"
540
+ },
541
+ "body": {
542
+ "$ref": "#/$defs/body"
543
+ },
544
+ "authorization": {
545
+ "$ref": "#/$defs/authorization"
546
+ },
547
+ "timeout": {
548
+ "$ref": "#/$defs/timeout"
549
+ },
550
+ "retry": {
551
+ "$ref": "#/$defs/retry"
552
+ }
553
+ },
554
+ "additionalProperties": false
555
+ },
556
+ "codeNode": {
557
+ "type": "object",
558
+ "required": [
559
+ "id",
560
+ "type",
561
+ "language",
562
+ "code",
563
+ "outputs"
564
+ ],
565
+ "properties": {
566
+ "id": {
567
+ "type": "string",
568
+ "pattern": "^[A-Za-z][A-Za-z0-9_]*$",
569
+ "maxLength": 50
570
+ },
571
+ "type": {
572
+ "const": "code"
573
+ },
574
+ "language": {
575
+ "enum": [
576
+ "python3",
577
+ "javascript"
578
+ ]
579
+ },
580
+ "code": {
581
+ "type": "string",
582
+ "minLength": 1
583
+ },
584
+ "variables": {
585
+ "type": "object",
586
+ "propertyNames": {
587
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
588
+ "maxLength": 30
589
+ },
590
+ "additionalProperties": {
591
+ "type": "string",
592
+ "minLength": 1
593
+ }
594
+ },
595
+ "outputs": {
596
+ "type": "object",
597
+ "minProperties": 1,
598
+ "propertyNames": {
599
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
600
+ "maxLength": 30
601
+ },
602
+ "additionalProperties": {
603
+ "type": "object",
604
+ "required": [
605
+ "type"
606
+ ],
607
+ "properties": {
608
+ "type": {
609
+ "enum": [
610
+ "string",
611
+ "number",
612
+ "object",
613
+ "array[string]",
614
+ "array[number]",
615
+ "array[object]"
616
+ ]
617
+ }
618
+ },
619
+ "additionalProperties": false
620
+ }
621
+ }
622
+ },
623
+ "additionalProperties": false
624
+ },
625
+ "knowledgeRetrievalNode": {
626
+ "type": "object",
627
+ "required": [
628
+ "id",
629
+ "type",
630
+ "query",
631
+ "dataset_ids"
632
+ ],
633
+ "properties": {
634
+ "id": {
635
+ "type": "string",
636
+ "pattern": "^[A-Za-z][A-Za-z0-9_]*$",
637
+ "maxLength": 50
638
+ },
639
+ "type": {
640
+ "const": "knowledge-retrieval"
641
+ },
642
+ "query": {
643
+ "type": "string",
644
+ "minLength": 1
645
+ },
646
+ "dataset_ids": {
647
+ "type": "array",
648
+ "minItems": 1,
649
+ "items": {
650
+ "type": "string",
651
+ "minLength": 1
652
+ }
653
+ },
654
+ "retrieval_mode": {
655
+ "const": "multiple"
656
+ },
657
+ "top_k": {
658
+ "type": "integer",
659
+ "minimum": 1,
660
+ "maximum": 10
661
+ },
662
+ "score_threshold": {
663
+ "type": [
664
+ "number",
665
+ "null"
666
+ ],
667
+ "minimum": 0,
668
+ "maximum": 1
669
+ },
670
+ "reranking_enable": {
671
+ "type": "boolean"
672
+ }
673
+ },
674
+ "additionalProperties": false
675
+ },
676
+ "branchStep": {
677
+ "type": "object",
678
+ "required": [
679
+ "id",
680
+ "branch"
681
+ ],
682
+ "properties": {
683
+ "id": {
684
+ "type": "string",
685
+ "pattern": "^[A-Za-z][A-Za-z0-9_]*$",
686
+ "maxLength": 50
687
+ },
688
+ "branch": {
689
+ "type": "object",
690
+ "required": [
691
+ "when",
692
+ "then",
693
+ "else"
694
+ ],
695
+ "properties": {
696
+ "when": {
697
+ "type": "object",
698
+ "required": [
699
+ "left",
700
+ "op"
701
+ ],
702
+ "properties": {
703
+ "left": {
704
+ "type": "string",
705
+ "minLength": 1
706
+ },
707
+ "op": {
708
+ "enum": [
709
+ "is",
710
+ "is not",
711
+ "contains",
712
+ "not contains",
713
+ "empty",
714
+ "not empty",
715
+ "=",
716
+ "≠",
717
+ ">",
718
+ "<",
719
+ "≥",
720
+ "≤"
721
+ ]
722
+ },
723
+ "right": {
724
+ "type": [
725
+ "string",
726
+ "number",
727
+ "boolean",
728
+ "null"
729
+ ]
730
+ }
731
+ },
732
+ "additionalProperties": false
733
+ },
734
+ "then": {
735
+ "type": "array",
736
+ "minItems": 1,
737
+ "items": {
738
+ "oneOf": [
739
+ {
740
+ "$ref": "#/$defs/httpNode"
741
+ },
742
+ {
743
+ "$ref": "#/$defs/codeNode"
744
+ },
745
+ {
746
+ "$ref": "#/$defs/knowledgeRetrievalNode"
747
+ },
748
+ {
749
+ "$ref": "#/$defs/llmNode"
750
+ },
751
+ {
752
+ "$ref": "#/$defs/templateTransformNode"
753
+ }
754
+ ]
755
+ }
756
+ },
757
+ "else": {
758
+ "type": "array",
759
+ "minItems": 1,
760
+ "items": {
761
+ "oneOf": [
762
+ {
763
+ "$ref": "#/$defs/httpNode"
764
+ },
765
+ {
766
+ "$ref": "#/$defs/codeNode"
767
+ },
768
+ {
769
+ "$ref": "#/$defs/knowledgeRetrievalNode"
770
+ },
771
+ {
772
+ "$ref": "#/$defs/llmNode"
773
+ },
774
+ {
775
+ "$ref": "#/$defs/templateTransformNode"
776
+ }
777
+ ]
778
+ }
779
+ }
780
+ },
781
+ "additionalProperties": false
782
+ }
783
+ },
784
+ "additionalProperties": false
785
+ },
786
+ "parallelStep": {
787
+ "type": "object",
788
+ "required": [
789
+ "id",
790
+ "parallel"
791
+ ],
792
+ "properties": {
793
+ "id": {
794
+ "type": "string",
795
+ "pattern": "^[A-Za-z][A-Za-z0-9_]*$",
796
+ "maxLength": 50
797
+ },
798
+ "parallel": {
799
+ "type": "object",
800
+ "required": [
801
+ "branches"
802
+ ],
803
+ "properties": {
804
+ "branches": {
805
+ "type": "array",
806
+ "minItems": 2,
807
+ "items": {
808
+ "type": "array",
809
+ "minItems": 1,
810
+ "items": {
811
+ "oneOf": [
812
+ {
813
+ "$ref": "#/$defs/httpNode"
814
+ },
815
+ {
816
+ "$ref": "#/$defs/codeNode"
817
+ },
818
+ {
819
+ "$ref": "#/$defs/knowledgeRetrievalNode"
820
+ },
821
+ {
822
+ "$ref": "#/$defs/llmNode"
823
+ },
824
+ {
825
+ "$ref": "#/$defs/templateTransformNode"
826
+ }
827
+ ]
828
+ }
829
+ }
830
+ },
831
+ "join": {
832
+ "type": "string",
833
+ "pattern": "^[A-Za-z][A-Za-z0-9_]*$",
834
+ "maxLength": 50
835
+ }
836
+ },
837
+ "additionalProperties": false
838
+ }
839
+ },
840
+ "additionalProperties": false
841
+ },
842
+ "iterateStep": {
843
+ "type": "object",
844
+ "required": [
845
+ "id",
846
+ "iterate"
847
+ ],
848
+ "properties": {
849
+ "id": {
850
+ "type": "string",
851
+ "pattern": "^[A-Za-z][A-Za-z0-9_]*$",
852
+ "maxLength": 50
853
+ },
854
+ "iterate": {
855
+ "type": "object",
856
+ "required": [
857
+ "over",
858
+ "output",
859
+ "steps"
860
+ ],
861
+ "properties": {
862
+ "over": {
863
+ "type": "string",
864
+ "minLength": 1,
865
+ "description": "迭代数组来源,必须是单个模板引用,例如 {{ prep.chunks }}"
866
+ },
867
+ "output": {
868
+ "type": "string",
869
+ "minLength": 1,
870
+ "description": "每轮收集的输出,必须是 iterate.steps 内节点的单个模板引用"
871
+ },
872
+ "steps": {
873
+ "type": "array",
874
+ "minItems": 1,
875
+ "items": {
876
+ "oneOf": [
877
+ {
878
+ "$ref": "#/$defs/httpNode"
879
+ },
880
+ {
881
+ "$ref": "#/$defs/codeNode"
882
+ },
883
+ {
884
+ "$ref": "#/$defs/knowledgeRetrievalNode"
885
+ },
886
+ {
887
+ "$ref": "#/$defs/llmNode"
888
+ },
889
+ {
890
+ "$ref": "#/$defs/templateTransformNode"
891
+ }
892
+ ]
893
+ }
894
+ }
895
+ },
896
+ "additionalProperties": false
897
+ }
898
+ },
899
+ "additionalProperties": false
900
+ },
901
+ "step": {
902
+ "oneOf": [
903
+ {
904
+ "$ref": "#/$defs/httpNode"
905
+ },
906
+ {
907
+ "$ref": "#/$defs/codeNode"
908
+ },
909
+ {
910
+ "$ref": "#/$defs/knowledgeRetrievalNode"
911
+ },
912
+ {
913
+ "$ref": "#/$defs/branchStep"
914
+ },
915
+ {
916
+ "$ref": "#/$defs/parallelStep"
917
+ },
918
+ {
919
+ "$ref": "#/$defs/iterateStep"
920
+ },
921
+ {
922
+ "$ref": "#/$defs/llmNode"
923
+ },
924
+ {
925
+ "$ref": "#/$defs/templateTransformNode"
926
+ }
927
+ ]
928
+ },
929
+ "llmNode": {
930
+ "type": "object",
931
+ "required": [
932
+ "id",
933
+ "type",
934
+ "provider",
935
+ "model"
936
+ ],
937
+ "properties": {
938
+ "id": {
939
+ "type": "string",
940
+ "pattern": "^[A-Za-z][A-Za-z0-9_]*$",
941
+ "maxLength": 50
942
+ },
943
+ "type": {
944
+ "const": "llm"
945
+ },
946
+ "provider": {
947
+ "type": "string",
948
+ "minLength": 1,
949
+ "maxLength": 200
950
+ },
951
+ "model": {
952
+ "type": "string",
953
+ "minLength": 1,
954
+ "maxLength": 200
955
+ },
956
+ "mode": {
957
+ "enum": [
958
+ "chat",
959
+ "completion"
960
+ ]
961
+ },
962
+ "completion_params": {
963
+ "type": "object",
964
+ "additionalProperties": true
965
+ },
966
+ "prompt": {
967
+ "type": "string",
968
+ "minLength": 1
969
+ },
970
+ "prompt_template": {
971
+ "type": "array",
972
+ "minItems": 1,
973
+ "items": {
974
+ "type": "object",
975
+ "required": [
976
+ "role",
977
+ "text"
978
+ ],
979
+ "properties": {
980
+ "role": {
981
+ "enum": [
982
+ "system",
983
+ "user",
984
+ "assistant"
985
+ ]
986
+ },
987
+ "text": {
988
+ "type": "string",
989
+ "minLength": 1
990
+ }
991
+ },
992
+ "additionalProperties": false
993
+ }
994
+ }
995
+ },
996
+ "additionalProperties": false,
997
+ "anyOf": [
998
+ {
999
+ "required": [
1000
+ "prompt"
1001
+ ]
1002
+ },
1003
+ {
1004
+ "required": [
1005
+ "prompt_template"
1006
+ ]
1007
+ }
1008
+ ]
1009
+ },
1010
+ "templateTransformNode": {
1011
+ "type": "object",
1012
+ "required": [
1013
+ "id",
1014
+ "type",
1015
+ "template",
1016
+ "variables"
1017
+ ],
1018
+ "properties": {
1019
+ "id": {
1020
+ "type": "string",
1021
+ "pattern": "^[A-Za-z][A-Za-z0-9_]*$",
1022
+ "maxLength": 50
1023
+ },
1024
+ "type": {
1025
+ "const": "template-transform"
1026
+ },
1027
+ "template": {
1028
+ "type": "string",
1029
+ "minLength": 1
1030
+ },
1031
+ "variables": {
1032
+ "type": "object",
1033
+ "minProperties": 1,
1034
+ "propertyNames": {
1035
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
1036
+ "maxLength": 30
1037
+ },
1038
+ "additionalProperties": {
1039
+ "type": "string",
1040
+ "minLength": 1
1041
+ }
1042
+ }
1043
+ },
1044
+ "additionalProperties": false
1045
+ }
1046
+ },
1047
+ "additionalProperties": false
1048
+ }