@almadar/std 3.12.1 → 3.13.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 (149) hide show
  1. package/behaviors/exports/atoms/std-agent-classifier.orb +402 -0
  2. package/behaviors/exports/atoms/std-agent-completion.orb +469 -0
  3. package/behaviors/exports/atoms/std-agent-context-window.orb +790 -0
  4. package/behaviors/exports/atoms/std-agent-conversation.orb +737 -0
  5. package/behaviors/exports/atoms/std-agent-memory.orb +627 -0
  6. package/behaviors/exports/atoms/std-agent-provider.orb +402 -0
  7. package/behaviors/exports/atoms/std-agent-search.orb +418 -0
  8. package/behaviors/exports/atoms/std-agent-session.orb +825 -0
  9. package/behaviors/exports/atoms/std-agent-tool-call.orb +380 -0
  10. package/behaviors/exports/atoms/std-wizard.orb +63 -70
  11. package/behaviors/exports/molecules/std-agent-fix-loop.orb +1213 -0
  12. package/behaviors/exports/molecules/std-agent-learner.orb +1143 -0
  13. package/behaviors/exports/molecules/std-agent-planner.orb +898 -0
  14. package/behaviors/exports/molecules/std-agent-rag.orb +736 -0
  15. package/behaviors/exports/molecules/std-agent-tool-loop.orb +1237 -0
  16. package/behaviors/exports/molecules/std-detail.orb +4 -0
  17. package/behaviors/exports/molecules/std-geospatial.orb +4 -0
  18. package/behaviors/exports/molecules/std-inventory.orb +8 -0
  19. package/behaviors/exports/molecules/std-list.orb +18 -1
  20. package/behaviors/exports/molecules/std-messaging.orb +4 -0
  21. package/behaviors/exports/organisms/std-agent-assistant.orb +2288 -0
  22. package/behaviors/exports/organisms/std-agent-builder.orb +2664 -0
  23. package/behaviors/exports/organisms/std-agent-pipeline.orb +2307 -0
  24. package/behaviors/exports/organisms/std-agent-reviewer.orb +1743 -0
  25. package/behaviors/exports/organisms/std-agent-tutor.orb +2303 -0
  26. package/behaviors/exports/organisms/std-api-gateway.orb +18 -1
  27. package/behaviors/exports/organisms/std-booking-system.orb +131 -104
  28. package/behaviors/exports/organisms/std-cicd-pipeline.orb +18 -1
  29. package/behaviors/exports/organisms/std-cms.orb +40 -2
  30. package/behaviors/exports/organisms/std-crm.orb +40 -2
  31. package/behaviors/exports/organisms/std-devops-dashboard.orb +18 -1
  32. package/behaviors/exports/organisms/std-finance-tracker.orb +22 -1
  33. package/behaviors/exports/organisms/std-healthcare.orb +167 -136
  34. package/behaviors/exports/organisms/std-helpdesk.orb +22 -1
  35. package/behaviors/exports/organisms/std-hr-portal.orb +115 -88
  36. package/behaviors/exports/organisms/std-iot-dashboard.orb +18 -1
  37. package/behaviors/exports/organisms/std-lms.orb +97 -87
  38. package/behaviors/exports/organisms/std-platformer-app.orb +8 -0
  39. package/behaviors/exports/organisms/std-project-manager.orb +36 -2
  40. package/behaviors/exports/organisms/std-realtime-chat.orb +22 -1
  41. package/behaviors/exports/organisms/std-rpg-game.orb +8 -0
  42. package/behaviors/exports/organisms/std-service-marketplace.orb +36 -2
  43. package/behaviors/exports/organisms/std-social-feed.orb +8 -0
  44. package/behaviors/exports/organisms/std-trading-dashboard.orb +18 -1
  45. package/behaviors/exports/validation-report.json +1425 -0
  46. package/dist/behaviors/exports/atoms/std-agent-classifier.orb +402 -0
  47. package/dist/behaviors/exports/atoms/std-agent-completion.orb +469 -0
  48. package/dist/behaviors/exports/atoms/std-agent-context-window.orb +790 -0
  49. package/dist/behaviors/exports/atoms/std-agent-conversation.orb +737 -0
  50. package/dist/behaviors/exports/atoms/std-agent-memory.orb +627 -0
  51. package/dist/behaviors/exports/atoms/std-agent-provider.orb +402 -0
  52. package/dist/behaviors/exports/atoms/std-agent-search.orb +418 -0
  53. package/dist/behaviors/exports/atoms/std-agent-session.orb +825 -0
  54. package/dist/behaviors/exports/atoms/std-agent-tool-call.orb +380 -0
  55. package/dist/behaviors/exports/atoms/std-wizard.orb +63 -70
  56. package/dist/behaviors/exports/molecules/std-agent-fix-loop.orb +1213 -0
  57. package/dist/behaviors/exports/molecules/std-agent-learner.orb +1143 -0
  58. package/dist/behaviors/exports/molecules/std-agent-planner.orb +898 -0
  59. package/dist/behaviors/exports/molecules/std-agent-rag.orb +736 -0
  60. package/dist/behaviors/exports/molecules/std-agent-tool-loop.orb +1237 -0
  61. package/dist/behaviors/exports/molecules/std-detail.orb +4 -0
  62. package/dist/behaviors/exports/molecules/std-geospatial.orb +4 -0
  63. package/dist/behaviors/exports/molecules/std-inventory.orb +8 -0
  64. package/dist/behaviors/exports/molecules/std-list.orb +18 -1
  65. package/dist/behaviors/exports/molecules/std-messaging.orb +4 -0
  66. package/dist/behaviors/exports/organisms/std-agent-assistant.orb +2288 -0
  67. package/dist/behaviors/exports/organisms/std-agent-builder.orb +2664 -0
  68. package/dist/behaviors/exports/organisms/std-agent-pipeline.orb +2307 -0
  69. package/dist/behaviors/exports/organisms/std-agent-reviewer.orb +1743 -0
  70. package/dist/behaviors/exports/organisms/std-agent-tutor.orb +2303 -0
  71. package/dist/behaviors/exports/organisms/std-api-gateway.orb +18 -1
  72. package/dist/behaviors/exports/organisms/std-booking-system.orb +131 -104
  73. package/dist/behaviors/exports/organisms/std-cicd-pipeline.orb +18 -1
  74. package/dist/behaviors/exports/organisms/std-cms.orb +40 -2
  75. package/dist/behaviors/exports/organisms/std-crm.orb +40 -2
  76. package/dist/behaviors/exports/organisms/std-devops-dashboard.orb +18 -1
  77. package/dist/behaviors/exports/organisms/std-finance-tracker.orb +22 -1
  78. package/dist/behaviors/exports/organisms/std-healthcare.orb +167 -136
  79. package/dist/behaviors/exports/organisms/std-helpdesk.orb +22 -1
  80. package/dist/behaviors/exports/organisms/std-hr-portal.orb +115 -88
  81. package/dist/behaviors/exports/organisms/std-iot-dashboard.orb +18 -1
  82. package/dist/behaviors/exports/organisms/std-lms.orb +97 -87
  83. package/dist/behaviors/exports/organisms/std-platformer-app.orb +8 -0
  84. package/dist/behaviors/exports/organisms/std-project-manager.orb +36 -2
  85. package/dist/behaviors/exports/organisms/std-realtime-chat.orb +22 -1
  86. package/dist/behaviors/exports/organisms/std-rpg-game.orb +8 -0
  87. package/dist/behaviors/exports/organisms/std-service-marketplace.orb +36 -2
  88. package/dist/behaviors/exports/organisms/std-social-feed.orb +8 -0
  89. package/dist/behaviors/exports/organisms/std-trading-dashboard.orb +18 -1
  90. package/dist/behaviors/exports/validation-report.json +1425 -0
  91. package/dist/behaviors/exports-reader.js +6345 -175
  92. package/dist/behaviors/exports-reader.js.map +1 -1
  93. package/dist/behaviors/functions/index.d.ts +620 -1
  94. package/dist/behaviors/functions/index.js +6285 -176
  95. package/dist/behaviors/functions/index.js.map +1 -1
  96. package/dist/behaviors/index.d.ts +1 -1
  97. package/dist/behaviors/index.js +6348 -178
  98. package/dist/behaviors/index.js.map +1 -1
  99. package/dist/behaviors/query.js +6347 -177
  100. package/dist/behaviors/query.js.map +1 -1
  101. package/dist/exports/atoms/std-agent-classifier.orb +402 -0
  102. package/dist/exports/atoms/std-agent-completion.orb +469 -0
  103. package/dist/exports/atoms/std-agent-context-window.orb +790 -0
  104. package/dist/exports/atoms/std-agent-conversation.orb +737 -0
  105. package/dist/exports/atoms/std-agent-memory.orb +627 -0
  106. package/dist/exports/atoms/std-agent-provider.orb +402 -0
  107. package/dist/exports/atoms/std-agent-search.orb +418 -0
  108. package/dist/exports/atoms/std-agent-session.orb +825 -0
  109. package/dist/exports/atoms/std-agent-tool-call.orb +380 -0
  110. package/dist/exports/atoms/std-wizard.orb +63 -70
  111. package/dist/exports/molecules/std-agent-fix-loop.orb +1213 -0
  112. package/dist/exports/molecules/std-agent-learner.orb +1143 -0
  113. package/dist/exports/molecules/std-agent-planner.orb +898 -0
  114. package/dist/exports/molecules/std-agent-rag.orb +736 -0
  115. package/dist/exports/molecules/std-agent-tool-loop.orb +1237 -0
  116. package/dist/exports/molecules/std-detail.orb +4 -0
  117. package/dist/exports/molecules/std-geospatial.orb +4 -0
  118. package/dist/exports/molecules/std-inventory.orb +8 -0
  119. package/dist/exports/molecules/std-list.orb +18 -1
  120. package/dist/exports/molecules/std-messaging.orb +4 -0
  121. package/dist/exports/organisms/std-agent-assistant.orb +2288 -0
  122. package/dist/exports/organisms/std-agent-builder.orb +2664 -0
  123. package/dist/exports/organisms/std-agent-pipeline.orb +2307 -0
  124. package/dist/exports/organisms/std-agent-reviewer.orb +1743 -0
  125. package/dist/exports/organisms/std-agent-tutor.orb +2303 -0
  126. package/dist/exports/organisms/std-api-gateway.orb +18 -1
  127. package/dist/exports/organisms/std-booking-system.orb +131 -104
  128. package/dist/exports/organisms/std-cicd-pipeline.orb +18 -1
  129. package/dist/exports/organisms/std-cms.orb +40 -2
  130. package/dist/exports/organisms/std-crm.orb +40 -2
  131. package/dist/exports/organisms/std-devops-dashboard.orb +18 -1
  132. package/dist/exports/organisms/std-finance-tracker.orb +22 -1
  133. package/dist/exports/organisms/std-healthcare.orb +167 -136
  134. package/dist/exports/organisms/std-helpdesk.orb +22 -1
  135. package/dist/exports/organisms/std-hr-portal.orb +115 -88
  136. package/dist/exports/organisms/std-iot-dashboard.orb +18 -1
  137. package/dist/exports/organisms/std-lms.orb +97 -87
  138. package/dist/exports/organisms/std-platformer-app.orb +8 -0
  139. package/dist/exports/organisms/std-project-manager.orb +36 -2
  140. package/dist/exports/organisms/std-realtime-chat.orb +22 -1
  141. package/dist/exports/organisms/std-rpg-game.orb +8 -0
  142. package/dist/exports/organisms/std-service-marketplace.orb +36 -2
  143. package/dist/exports/organisms/std-social-feed.orb +8 -0
  144. package/dist/exports/organisms/std-trading-dashboard.orb +18 -1
  145. package/dist/exports/validation-report.json +1425 -0
  146. package/dist/index.d.ts +1 -1
  147. package/dist/index.js +6348 -178
  148. package/dist/index.js.map +1 -1
  149. package/package.json +1 -1
@@ -0,0 +1,1237 @@
1
+ {
2
+ "name": "AgentToolLoopOrbital",
3
+ "orbitals": [
4
+ {
5
+ "name": "AgentToolLoopOrbital",
6
+ "entity": {
7
+ "name": "AgentToolLoop",
8
+ "persistence": "runtime",
9
+ "fields": [
10
+ {
11
+ "name": "id",
12
+ "type": "string"
13
+ },
14
+ {
15
+ "name": "name",
16
+ "type": "string"
17
+ },
18
+ {
19
+ "name": "description",
20
+ "type": "string"
21
+ },
22
+ {
23
+ "name": "status",
24
+ "type": "string",
25
+ "default": "active",
26
+ "values": [
27
+ "active",
28
+ "inactive",
29
+ "pending"
30
+ ]
31
+ },
32
+ {
33
+ "name": "createdAt",
34
+ "type": "string"
35
+ },
36
+ {
37
+ "name": "task",
38
+ "type": "string",
39
+ "default": ""
40
+ },
41
+ {
42
+ "name": "plan",
43
+ "type": "string",
44
+ "default": ""
45
+ },
46
+ {
47
+ "name": "iterations",
48
+ "type": "number",
49
+ "default": 0
50
+ },
51
+ {
52
+ "name": "maxIterations",
53
+ "type": "number",
54
+ "default": 10
55
+ },
56
+ {
57
+ "name": "result",
58
+ "type": "string",
59
+ "default": ""
60
+ },
61
+ {
62
+ "name": "currentTool",
63
+ "type": "string",
64
+ "default": ""
65
+ },
66
+ {
67
+ "name": "lastToolResult",
68
+ "type": "string",
69
+ "default": ""
70
+ },
71
+ {
72
+ "name": "error",
73
+ "type": "string",
74
+ "default": ""
75
+ }
76
+ ]
77
+ },
78
+ "traits": [
79
+ {
80
+ "name": "AgentToolLoopLoop",
81
+ "linkedEntity": "AgentToolLoop",
82
+ "category": "interaction",
83
+ "stateMachine": {
84
+ "states": [
85
+ {
86
+ "name": "idle",
87
+ "isInitial": true
88
+ },
89
+ {
90
+ "name": "planning"
91
+ },
92
+ {
93
+ "name": "executing"
94
+ },
95
+ {
96
+ "name": "checking"
97
+ },
98
+ {
99
+ "name": "completed"
100
+ },
101
+ {
102
+ "name": "failed"
103
+ }
104
+ ],
105
+ "events": [
106
+ {
107
+ "key": "INIT",
108
+ "name": "Initialize"
109
+ },
110
+ {
111
+ "key": "EXECUTE",
112
+ "name": "Execute"
113
+ },
114
+ {
115
+ "key": "PLAN_GENERATED",
116
+ "name": "Plan Generated",
117
+ "payload": [
118
+ {
119
+ "name": "plan",
120
+ "type": "string",
121
+ "required": true
122
+ },
123
+ {
124
+ "name": "toolName",
125
+ "type": "string",
126
+ "required": true
127
+ },
128
+ {
129
+ "name": "toolArgs",
130
+ "type": "object",
131
+ "required": true
132
+ }
133
+ ]
134
+ },
135
+ {
136
+ "key": "TOOL_RESULT",
137
+ "name": "Tool Result",
138
+ "payload": [
139
+ {
140
+ "name": "output",
141
+ "type": "string",
142
+ "required": true
143
+ }
144
+ ]
145
+ },
146
+ {
147
+ "key": "CHECK_PASSED",
148
+ "name": "Check Passed",
149
+ "payload": [
150
+ {
151
+ "name": "result",
152
+ "type": "string",
153
+ "required": true
154
+ }
155
+ ]
156
+ },
157
+ {
158
+ "key": "CHECK_NEEDS_MORE",
159
+ "name": "Check Needs More",
160
+ "payload": [
161
+ {
162
+ "name": "toolName",
163
+ "type": "string",
164
+ "required": true
165
+ },
166
+ {
167
+ "name": "toolArgs",
168
+ "type": "object",
169
+ "required": true
170
+ }
171
+ ]
172
+ },
173
+ {
174
+ "key": "MAX_ITERATIONS",
175
+ "name": "Max Iterations Reached",
176
+ "payload": [
177
+ {
178
+ "name": "error",
179
+ "type": "string",
180
+ "required": true
181
+ }
182
+ ]
183
+ },
184
+ {
185
+ "key": "FAILED",
186
+ "name": "Failed",
187
+ "payload": [
188
+ {
189
+ "name": "error",
190
+ "type": "string",
191
+ "required": true
192
+ }
193
+ ]
194
+ },
195
+ {
196
+ "key": "RESET",
197
+ "name": "Reset"
198
+ }
199
+ ],
200
+ "transitions": [
201
+ {
202
+ "from": "idle",
203
+ "to": "idle",
204
+ "event": "INIT",
205
+ "effects": [
206
+ [
207
+ "render-ui",
208
+ "main",
209
+ {
210
+ "type": "stack",
211
+ "direction": "vertical",
212
+ "gap": "lg",
213
+ "children": [
214
+ {
215
+ "type": "stack",
216
+ "direction": "horizontal",
217
+ "gap": "sm",
218
+ "align": "center",
219
+ "children": [
220
+ {
221
+ "type": "icon",
222
+ "name": "repeat",
223
+ "size": "lg"
224
+ },
225
+ {
226
+ "type": "typography",
227
+ "content": "Tool Execution Loop",
228
+ "variant": "h2"
229
+ }
230
+ ]
231
+ },
232
+ {
233
+ "type": "divider"
234
+ },
235
+ {
236
+ "type": "card",
237
+ "children": [
238
+ {
239
+ "type": "stack",
240
+ "direction": "vertical",
241
+ "gap": "md",
242
+ "children": [
243
+ {
244
+ "type": "typography",
245
+ "content": "Describe the task to execute with tools",
246
+ "variant": "body"
247
+ },
248
+ {
249
+ "type": "form-section",
250
+ "entity": "AgentToolLoop",
251
+ "mode": "edit",
252
+ "submitEvent": "EXECUTE",
253
+ "fields": [
254
+ "task"
255
+ ]
256
+ }
257
+ ]
258
+ }
259
+ ]
260
+ }
261
+ ]
262
+ }
263
+ ]
264
+ ]
265
+ },
266
+ {
267
+ "from": "idle",
268
+ "to": "planning",
269
+ "event": "EXECUTE",
270
+ "effects": [
271
+ [
272
+ "set",
273
+ "@entity.status",
274
+ "planning"
275
+ ],
276
+ [
277
+ "set",
278
+ "@entity.iterations",
279
+ 0
280
+ ],
281
+ [
282
+ "agent/generate",
283
+ [
284
+ "string/concat",
285
+ "Task: ",
286
+ "@entity.task",
287
+ "\n\nAvailable tools: ",
288
+ [
289
+ "string/join",
290
+ [
291
+ "agent/tools"
292
+ ],
293
+ ", "
294
+ ],
295
+ "\n\nGenerate a step-by-step plan. Return the first tool to call and its arguments."
296
+ ]
297
+ ],
298
+ [
299
+ "render-ui",
300
+ "main",
301
+ {
302
+ "type": "stack",
303
+ "direction": "vertical",
304
+ "gap": "lg",
305
+ "align": "center",
306
+ "children": [
307
+ {
308
+ "type": "icon",
309
+ "name": "brain",
310
+ "size": "lg"
311
+ },
312
+ {
313
+ "type": "typography",
314
+ "content": "Planning execution...",
315
+ "variant": "h3"
316
+ },
317
+ {
318
+ "type": "spinner",
319
+ "size": "lg"
320
+ },
321
+ {
322
+ "type": "typography",
323
+ "content": "@entity.task",
324
+ "variant": "caption"
325
+ }
326
+ ]
327
+ }
328
+ ]
329
+ ]
330
+ },
331
+ {
332
+ "from": "planning",
333
+ "to": "executing",
334
+ "event": "PLAN_GENERATED",
335
+ "effects": [
336
+ [
337
+ "set",
338
+ "@entity.plan",
339
+ "@payload.plan"
340
+ ],
341
+ [
342
+ "set",
343
+ "@entity.currentTool",
344
+ "@payload.toolName"
345
+ ],
346
+ [
347
+ "set",
348
+ "@entity.iterations",
349
+ [
350
+ "math/add",
351
+ "@entity.iterations",
352
+ 1
353
+ ]
354
+ ],
355
+ [
356
+ "agent/invoke",
357
+ "@payload.toolName",
358
+ "@payload.toolArgs"
359
+ ],
360
+ [
361
+ "render-ui",
362
+ "main",
363
+ {
364
+ "type": "stack",
365
+ "direction": "vertical",
366
+ "gap": "lg",
367
+ "children": [
368
+ {
369
+ "type": "stack",
370
+ "direction": "horizontal",
371
+ "gap": "sm",
372
+ "align": "center",
373
+ "justify": "space-between",
374
+ "children": [
375
+ {
376
+ "type": "stack",
377
+ "direction": "horizontal",
378
+ "gap": "sm",
379
+ "align": "center",
380
+ "children": [
381
+ {
382
+ "type": "icon",
383
+ "name": "tool",
384
+ "size": "lg"
385
+ },
386
+ {
387
+ "type": "typography",
388
+ "content": "Executing Tool",
389
+ "variant": "h2"
390
+ }
391
+ ]
392
+ },
393
+ {
394
+ "type": "badge",
395
+ "label": [
396
+ "string/concat",
397
+ "Iteration ",
398
+ [
399
+ "string/of",
400
+ "@entity.iterations"
401
+ ],
402
+ "/",
403
+ [
404
+ "string/of",
405
+ "@entity.maxIterations"
406
+ ]
407
+ ]
408
+ }
409
+ ]
410
+ },
411
+ {
412
+ "type": "divider"
413
+ },
414
+ {
415
+ "type": "card",
416
+ "children": [
417
+ {
418
+ "type": "stack",
419
+ "direction": "vertical",
420
+ "gap": "sm",
421
+ "children": [
422
+ {
423
+ "type": "typography",
424
+ "content": "Current Tool",
425
+ "variant": "caption"
426
+ },
427
+ {
428
+ "type": "typography",
429
+ "content": "@entity.currentTool",
430
+ "variant": "h4"
431
+ },
432
+ {
433
+ "type": "spinner",
434
+ "size": "md"
435
+ }
436
+ ]
437
+ }
438
+ ]
439
+ },
440
+ {
441
+ "type": "card",
442
+ "children": [
443
+ {
444
+ "type": "stack",
445
+ "direction": "vertical",
446
+ "gap": "sm",
447
+ "children": [
448
+ {
449
+ "type": "typography",
450
+ "content": "Plan",
451
+ "variant": "caption"
452
+ },
453
+ {
454
+ "type": "typography",
455
+ "content": "@entity.plan",
456
+ "variant": "body"
457
+ }
458
+ ]
459
+ }
460
+ ]
461
+ }
462
+ ]
463
+ }
464
+ ]
465
+ ]
466
+ },
467
+ {
468
+ "from": "executing",
469
+ "to": "checking",
470
+ "event": "TOOL_RESULT",
471
+ "effects": [
472
+ [
473
+ "set",
474
+ "@entity.lastToolResult",
475
+ "@payload.output"
476
+ ],
477
+ [
478
+ "agent/generate",
479
+ [
480
+ "string/concat",
481
+ "Task: ",
482
+ "@entity.task",
483
+ "\nPlan: ",
484
+ "@entity.plan",
485
+ "\nTool output: ",
486
+ "@payload.output",
487
+ "\n\nIs the task complete? If yes, provide the final result. If no, specify the next tool and arguments."
488
+ ]
489
+ ],
490
+ [
491
+ "render-ui",
492
+ "main",
493
+ {
494
+ "type": "stack",
495
+ "direction": "vertical",
496
+ "gap": "lg",
497
+ "align": "center",
498
+ "children": [
499
+ {
500
+ "type": "icon",
501
+ "name": "eye",
502
+ "size": "lg"
503
+ },
504
+ {
505
+ "type": "typography",
506
+ "content": "Checking result...",
507
+ "variant": "h3"
508
+ },
509
+ {
510
+ "type": "spinner",
511
+ "size": "lg"
512
+ },
513
+ {
514
+ "type": "badge",
515
+ "label": [
516
+ "string/concat",
517
+ "Iteration ",
518
+ [
519
+ "string/of",
520
+ "@entity.iterations"
521
+ ]
522
+ ]
523
+ }
524
+ ]
525
+ }
526
+ ]
527
+ ]
528
+ },
529
+ {
530
+ "from": "checking",
531
+ "to": "completed",
532
+ "event": "CHECK_PASSED",
533
+ "effects": [
534
+ [
535
+ "set",
536
+ "@entity.result",
537
+ "@payload.result"
538
+ ],
539
+ [
540
+ "set",
541
+ "@entity.status",
542
+ "completed"
543
+ ],
544
+ [
545
+ "render-ui",
546
+ "main",
547
+ {
548
+ "type": "stack",
549
+ "direction": "vertical",
550
+ "gap": "lg",
551
+ "children": [
552
+ {
553
+ "type": "stack",
554
+ "direction": "horizontal",
555
+ "gap": "sm",
556
+ "align": "center",
557
+ "justify": "space-between",
558
+ "children": [
559
+ {
560
+ "type": "stack",
561
+ "direction": "horizontal",
562
+ "gap": "sm",
563
+ "align": "center",
564
+ "children": [
565
+ {
566
+ "type": "icon",
567
+ "name": "check-circle",
568
+ "size": "lg"
569
+ },
570
+ {
571
+ "type": "typography",
572
+ "content": "Loop Complete",
573
+ "variant": "h2"
574
+ }
575
+ ]
576
+ },
577
+ {
578
+ "type": "button",
579
+ "label": "New Task",
580
+ "event": "RESET",
581
+ "variant": "ghost",
582
+ "icon": "rotate-ccw"
583
+ }
584
+ ]
585
+ },
586
+ {
587
+ "type": "divider"
588
+ },
589
+ {
590
+ "type": "simple-grid",
591
+ "columns": 2,
592
+ "children": [
593
+ {
594
+ "type": "stat-display",
595
+ "label": "Iterations",
596
+ "value": "@entity.iterations",
597
+ "icon": "repeat"
598
+ },
599
+ {
600
+ "type": "stat-display",
601
+ "label": "Status",
602
+ "value": "@entity.status",
603
+ "icon": "check"
604
+ }
605
+ ]
606
+ },
607
+ {
608
+ "type": "divider"
609
+ },
610
+ {
611
+ "type": "card",
612
+ "children": [
613
+ {
614
+ "type": "stack",
615
+ "direction": "vertical",
616
+ "gap": "md",
617
+ "children": [
618
+ {
619
+ "type": "typography",
620
+ "content": "Task",
621
+ "variant": "caption"
622
+ },
623
+ {
624
+ "type": "typography",
625
+ "content": "@entity.task",
626
+ "variant": "body"
627
+ },
628
+ {
629
+ "type": "divider"
630
+ },
631
+ {
632
+ "type": "typography",
633
+ "content": "Result",
634
+ "variant": "caption"
635
+ },
636
+ {
637
+ "type": "typography",
638
+ "content": "@entity.result",
639
+ "variant": "body"
640
+ }
641
+ ]
642
+ }
643
+ ]
644
+ }
645
+ ]
646
+ }
647
+ ]
648
+ ]
649
+ },
650
+ {
651
+ "from": "checking",
652
+ "to": "executing",
653
+ "event": "CHECK_NEEDS_MORE",
654
+ "guards": [
655
+ [
656
+ "math/lt",
657
+ "@entity.iterations",
658
+ 10
659
+ ]
660
+ ],
661
+ "effects": [
662
+ [
663
+ "set",
664
+ "@entity.currentTool",
665
+ "@payload.toolName"
666
+ ],
667
+ [
668
+ "set",
669
+ "@entity.iterations",
670
+ [
671
+ "math/add",
672
+ "@entity.iterations",
673
+ 1
674
+ ]
675
+ ],
676
+ [
677
+ "cond",
678
+ [
679
+ "math/gte",
680
+ [
681
+ "agent/context-usage"
682
+ ],
683
+ 0.8
684
+ ],
685
+ [
686
+ "agent/compact",
687
+ "hybrid"
688
+ ]
689
+ ],
690
+ [
691
+ "agent/invoke",
692
+ "@payload.toolName",
693
+ "@payload.toolArgs"
694
+ ],
695
+ [
696
+ "render-ui",
697
+ "main",
698
+ {
699
+ "type": "stack",
700
+ "direction": "vertical",
701
+ "gap": "lg",
702
+ "children": [
703
+ {
704
+ "type": "stack",
705
+ "direction": "horizontal",
706
+ "gap": "sm",
707
+ "align": "center",
708
+ "justify": "space-between",
709
+ "children": [
710
+ {
711
+ "type": "stack",
712
+ "direction": "horizontal",
713
+ "gap": "sm",
714
+ "align": "center",
715
+ "children": [
716
+ {
717
+ "type": "icon",
718
+ "name": "tool",
719
+ "size": "lg"
720
+ },
721
+ {
722
+ "type": "typography",
723
+ "content": "Executing Tool",
724
+ "variant": "h2"
725
+ }
726
+ ]
727
+ },
728
+ {
729
+ "type": "badge",
730
+ "label": [
731
+ "string/concat",
732
+ "Iteration ",
733
+ [
734
+ "string/of",
735
+ "@entity.iterations"
736
+ ],
737
+ "/",
738
+ [
739
+ "string/of",
740
+ "@entity.maxIterations"
741
+ ]
742
+ ]
743
+ }
744
+ ]
745
+ },
746
+ {
747
+ "type": "divider"
748
+ },
749
+ {
750
+ "type": "card",
751
+ "children": [
752
+ {
753
+ "type": "stack",
754
+ "direction": "vertical",
755
+ "gap": "sm",
756
+ "children": [
757
+ {
758
+ "type": "typography",
759
+ "content": "Current Tool",
760
+ "variant": "caption"
761
+ },
762
+ {
763
+ "type": "typography",
764
+ "content": "@entity.currentTool",
765
+ "variant": "h4"
766
+ },
767
+ {
768
+ "type": "spinner",
769
+ "size": "md"
770
+ }
771
+ ]
772
+ }
773
+ ]
774
+ },
775
+ {
776
+ "type": "card",
777
+ "children": [
778
+ {
779
+ "type": "stack",
780
+ "direction": "vertical",
781
+ "gap": "sm",
782
+ "children": [
783
+ {
784
+ "type": "typography",
785
+ "content": "Plan",
786
+ "variant": "caption"
787
+ },
788
+ {
789
+ "type": "typography",
790
+ "content": "@entity.plan",
791
+ "variant": "body"
792
+ }
793
+ ]
794
+ }
795
+ ]
796
+ }
797
+ ]
798
+ }
799
+ ]
800
+ ]
801
+ },
802
+ {
803
+ "from": "checking",
804
+ "to": "failed",
805
+ "event": "MAX_ITERATIONS",
806
+ "effects": [
807
+ [
808
+ "set",
809
+ "@entity.error",
810
+ "@payload.error"
811
+ ],
812
+ [
813
+ "set",
814
+ "@entity.status",
815
+ "failed"
816
+ ],
817
+ [
818
+ "render-ui",
819
+ "main",
820
+ {
821
+ "type": "stack",
822
+ "direction": "vertical",
823
+ "gap": "lg",
824
+ "align": "center",
825
+ "children": [
826
+ {
827
+ "type": "icon",
828
+ "name": "x-circle",
829
+ "size": "lg"
830
+ },
831
+ {
832
+ "type": "typography",
833
+ "content": "Loop Failed",
834
+ "variant": "h2"
835
+ },
836
+ {
837
+ "type": "alert",
838
+ "variant": "error",
839
+ "message": "@entity.error"
840
+ },
841
+ {
842
+ "type": "simple-grid",
843
+ "columns": 2,
844
+ "children": [
845
+ {
846
+ "type": "stat-display",
847
+ "label": "Iterations Used",
848
+ "value": "@entity.iterations",
849
+ "icon": "repeat"
850
+ },
851
+ {
852
+ "type": "stat-display",
853
+ "label": "Max Allowed",
854
+ "value": "@entity.maxIterations",
855
+ "icon": "shield"
856
+ }
857
+ ]
858
+ },
859
+ {
860
+ "type": "button",
861
+ "label": "Retry",
862
+ "event": "RESET",
863
+ "variant": "primary",
864
+ "icon": "rotate-ccw"
865
+ }
866
+ ]
867
+ }
868
+ ]
869
+ ]
870
+ },
871
+ {
872
+ "from": "planning",
873
+ "to": "failed",
874
+ "event": "FAILED",
875
+ "effects": [
876
+ [
877
+ "set",
878
+ "@entity.error",
879
+ "@payload.error"
880
+ ],
881
+ [
882
+ "set",
883
+ "@entity.status",
884
+ "failed"
885
+ ],
886
+ [
887
+ "render-ui",
888
+ "main",
889
+ {
890
+ "type": "stack",
891
+ "direction": "vertical",
892
+ "gap": "lg",
893
+ "align": "center",
894
+ "children": [
895
+ {
896
+ "type": "icon",
897
+ "name": "x-circle",
898
+ "size": "lg"
899
+ },
900
+ {
901
+ "type": "typography",
902
+ "content": "Loop Failed",
903
+ "variant": "h2"
904
+ },
905
+ {
906
+ "type": "alert",
907
+ "variant": "error",
908
+ "message": "@entity.error"
909
+ },
910
+ {
911
+ "type": "simple-grid",
912
+ "columns": 2,
913
+ "children": [
914
+ {
915
+ "type": "stat-display",
916
+ "label": "Iterations Used",
917
+ "value": "@entity.iterations",
918
+ "icon": "repeat"
919
+ },
920
+ {
921
+ "type": "stat-display",
922
+ "label": "Max Allowed",
923
+ "value": "@entity.maxIterations",
924
+ "icon": "shield"
925
+ }
926
+ ]
927
+ },
928
+ {
929
+ "type": "button",
930
+ "label": "Retry",
931
+ "event": "RESET",
932
+ "variant": "primary",
933
+ "icon": "rotate-ccw"
934
+ }
935
+ ]
936
+ }
937
+ ]
938
+ ]
939
+ },
940
+ {
941
+ "from": "executing",
942
+ "to": "failed",
943
+ "event": "FAILED",
944
+ "effects": [
945
+ [
946
+ "set",
947
+ "@entity.error",
948
+ "@payload.error"
949
+ ],
950
+ [
951
+ "set",
952
+ "@entity.status",
953
+ "failed"
954
+ ],
955
+ [
956
+ "render-ui",
957
+ "main",
958
+ {
959
+ "type": "stack",
960
+ "direction": "vertical",
961
+ "gap": "lg",
962
+ "align": "center",
963
+ "children": [
964
+ {
965
+ "type": "icon",
966
+ "name": "x-circle",
967
+ "size": "lg"
968
+ },
969
+ {
970
+ "type": "typography",
971
+ "content": "Loop Failed",
972
+ "variant": "h2"
973
+ },
974
+ {
975
+ "type": "alert",
976
+ "variant": "error",
977
+ "message": "@entity.error"
978
+ },
979
+ {
980
+ "type": "simple-grid",
981
+ "columns": 2,
982
+ "children": [
983
+ {
984
+ "type": "stat-display",
985
+ "label": "Iterations Used",
986
+ "value": "@entity.iterations",
987
+ "icon": "repeat"
988
+ },
989
+ {
990
+ "type": "stat-display",
991
+ "label": "Max Allowed",
992
+ "value": "@entity.maxIterations",
993
+ "icon": "shield"
994
+ }
995
+ ]
996
+ },
997
+ {
998
+ "type": "button",
999
+ "label": "Retry",
1000
+ "event": "RESET",
1001
+ "variant": "primary",
1002
+ "icon": "rotate-ccw"
1003
+ }
1004
+ ]
1005
+ }
1006
+ ]
1007
+ ]
1008
+ },
1009
+ {
1010
+ "from": "completed",
1011
+ "to": "idle",
1012
+ "event": "RESET",
1013
+ "effects": [
1014
+ [
1015
+ "set",
1016
+ "@entity.status",
1017
+ "idle"
1018
+ ],
1019
+ [
1020
+ "set",
1021
+ "@entity.task",
1022
+ ""
1023
+ ],
1024
+ [
1025
+ "set",
1026
+ "@entity.plan",
1027
+ ""
1028
+ ],
1029
+ [
1030
+ "set",
1031
+ "@entity.result",
1032
+ ""
1033
+ ],
1034
+ [
1035
+ "set",
1036
+ "@entity.currentTool",
1037
+ ""
1038
+ ],
1039
+ [
1040
+ "set",
1041
+ "@entity.lastToolResult",
1042
+ ""
1043
+ ],
1044
+ [
1045
+ "set",
1046
+ "@entity.iterations",
1047
+ 0
1048
+ ],
1049
+ [
1050
+ "set",
1051
+ "@entity.error",
1052
+ ""
1053
+ ],
1054
+ [
1055
+ "render-ui",
1056
+ "main",
1057
+ {
1058
+ "type": "stack",
1059
+ "direction": "vertical",
1060
+ "gap": "lg",
1061
+ "children": [
1062
+ {
1063
+ "type": "stack",
1064
+ "direction": "horizontal",
1065
+ "gap": "sm",
1066
+ "align": "center",
1067
+ "children": [
1068
+ {
1069
+ "type": "icon",
1070
+ "name": "repeat",
1071
+ "size": "lg"
1072
+ },
1073
+ {
1074
+ "type": "typography",
1075
+ "content": "Tool Execution Loop",
1076
+ "variant": "h2"
1077
+ }
1078
+ ]
1079
+ },
1080
+ {
1081
+ "type": "divider"
1082
+ },
1083
+ {
1084
+ "type": "card",
1085
+ "children": [
1086
+ {
1087
+ "type": "stack",
1088
+ "direction": "vertical",
1089
+ "gap": "md",
1090
+ "children": [
1091
+ {
1092
+ "type": "typography",
1093
+ "content": "Describe the task to execute with tools",
1094
+ "variant": "body"
1095
+ },
1096
+ {
1097
+ "type": "form-section",
1098
+ "entity": "AgentToolLoop",
1099
+ "mode": "edit",
1100
+ "submitEvent": "EXECUTE",
1101
+ "fields": [
1102
+ "task"
1103
+ ]
1104
+ }
1105
+ ]
1106
+ }
1107
+ ]
1108
+ }
1109
+ ]
1110
+ }
1111
+ ]
1112
+ ]
1113
+ },
1114
+ {
1115
+ "from": "failed",
1116
+ "to": "idle",
1117
+ "event": "RESET",
1118
+ "effects": [
1119
+ [
1120
+ "set",
1121
+ "@entity.status",
1122
+ "idle"
1123
+ ],
1124
+ [
1125
+ "set",
1126
+ "@entity.task",
1127
+ ""
1128
+ ],
1129
+ [
1130
+ "set",
1131
+ "@entity.plan",
1132
+ ""
1133
+ ],
1134
+ [
1135
+ "set",
1136
+ "@entity.result",
1137
+ ""
1138
+ ],
1139
+ [
1140
+ "set",
1141
+ "@entity.currentTool",
1142
+ ""
1143
+ ],
1144
+ [
1145
+ "set",
1146
+ "@entity.lastToolResult",
1147
+ ""
1148
+ ],
1149
+ [
1150
+ "set",
1151
+ "@entity.iterations",
1152
+ 0
1153
+ ],
1154
+ [
1155
+ "set",
1156
+ "@entity.error",
1157
+ ""
1158
+ ],
1159
+ [
1160
+ "render-ui",
1161
+ "main",
1162
+ {
1163
+ "type": "stack",
1164
+ "direction": "vertical",
1165
+ "gap": "lg",
1166
+ "children": [
1167
+ {
1168
+ "type": "stack",
1169
+ "direction": "horizontal",
1170
+ "gap": "sm",
1171
+ "align": "center",
1172
+ "children": [
1173
+ {
1174
+ "type": "icon",
1175
+ "name": "repeat",
1176
+ "size": "lg"
1177
+ },
1178
+ {
1179
+ "type": "typography",
1180
+ "content": "Tool Execution Loop",
1181
+ "variant": "h2"
1182
+ }
1183
+ ]
1184
+ },
1185
+ {
1186
+ "type": "divider"
1187
+ },
1188
+ {
1189
+ "type": "card",
1190
+ "children": [
1191
+ {
1192
+ "type": "stack",
1193
+ "direction": "vertical",
1194
+ "gap": "md",
1195
+ "children": [
1196
+ {
1197
+ "type": "typography",
1198
+ "content": "Describe the task to execute with tools",
1199
+ "variant": "body"
1200
+ },
1201
+ {
1202
+ "type": "form-section",
1203
+ "entity": "AgentToolLoop",
1204
+ "mode": "edit",
1205
+ "submitEvent": "EXECUTE",
1206
+ "fields": [
1207
+ "task"
1208
+ ]
1209
+ }
1210
+ ]
1211
+ }
1212
+ ]
1213
+ }
1214
+ ]
1215
+ }
1216
+ ]
1217
+ ]
1218
+ }
1219
+ ]
1220
+ }
1221
+ }
1222
+ ],
1223
+ "pages": [
1224
+ {
1225
+ "name": "AgentToolLoopPage",
1226
+ "path": "/agenttoolloops",
1227
+ "traits": [
1228
+ {
1229
+ "ref": "AgentToolLoopLoop"
1230
+ }
1231
+ ]
1232
+ }
1233
+ ]
1234
+ }
1235
+ ],
1236
+ "description": "Composes LLM completion, tool invocation, and context window management into an iterative tool-use loop. The agent generates a plan, invokes tools to execute steps, checks results, and either loops back or finishes. Automatically compacts the context window when usage gets too high. Traits composed (inline, representing atom-level concerns): - ToolLoopCompletion: LLM plan generation and result checking - ToolLoopInvoke: tool invocation with argument passing - ToolLoopContext: context window monitoring and compaction"
1237
+ }