@almadar/std 3.13.0 → 3.13.1

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 (86) hide show
  1. package/behaviors/exports/atoms/std-agent-activity-log.orb +559 -0
  2. package/behaviors/exports/atoms/std-agent-chat-thread.orb +774 -0
  3. package/behaviors/exports/atoms/std-agent-classifier.orb +606 -137
  4. package/behaviors/exports/atoms/std-agent-completion.orb +646 -182
  5. package/behaviors/exports/atoms/std-agent-context-window.orb +1762 -258
  6. package/behaviors/exports/atoms/std-agent-conversation.orb +652 -369
  7. package/behaviors/exports/atoms/std-agent-memory.orb +574 -322
  8. package/behaviors/exports/atoms/std-agent-provider.orb +632 -136
  9. package/behaviors/exports/atoms/std-agent-search.orb +228 -198
  10. package/behaviors/exports/atoms/std-agent-session.orb +569 -559
  11. package/behaviors/exports/atoms/std-agent-step-progress.orb +850 -0
  12. package/behaviors/exports/atoms/std-agent-token-gauge.orb +1616 -0
  13. package/behaviors/exports/atoms/std-agent-tool-call.orb +983 -126
  14. package/behaviors/exports/molecules/std-agent-fix-loop.orb +1985 -21
  15. package/behaviors/exports/molecules/std-agent-learner.orb +1830 -23
  16. package/behaviors/exports/molecules/std-agent-planner.orb +1776 -19
  17. package/behaviors/exports/molecules/std-agent-rag.orb +1150 -15
  18. package/behaviors/exports/molecules/std-agent-tool-loop.orb +3643 -23
  19. package/behaviors/exports/organisms/std-agent-assistant.orb +5308 -1156
  20. package/behaviors/exports/organisms/std-agent-builder.orb +13525 -1326
  21. package/behaviors/exports/organisms/std-agent-pipeline.orb +10731 -1088
  22. package/behaviors/exports/organisms/std-agent-reviewer.orb +4187 -525
  23. package/behaviors/exports/organisms/std-agent-tutor.orb +3126 -322
  24. package/behaviors/exports/validation-report.json +1 -1426
  25. package/dist/behaviors/exports/atoms/std-agent-activity-log.orb +559 -0
  26. package/dist/behaviors/exports/atoms/std-agent-chat-thread.orb +774 -0
  27. package/dist/behaviors/exports/atoms/std-agent-classifier.orb +606 -137
  28. package/dist/behaviors/exports/atoms/std-agent-completion.orb +646 -182
  29. package/dist/behaviors/exports/atoms/std-agent-context-window.orb +1762 -258
  30. package/dist/behaviors/exports/atoms/std-agent-conversation.orb +652 -369
  31. package/dist/behaviors/exports/atoms/std-agent-memory.orb +574 -322
  32. package/dist/behaviors/exports/atoms/std-agent-provider.orb +632 -136
  33. package/dist/behaviors/exports/atoms/std-agent-search.orb +228 -198
  34. package/dist/behaviors/exports/atoms/std-agent-session.orb +569 -559
  35. package/dist/behaviors/exports/atoms/std-agent-step-progress.orb +850 -0
  36. package/dist/behaviors/exports/atoms/std-agent-token-gauge.orb +1616 -0
  37. package/dist/behaviors/exports/atoms/std-agent-tool-call.orb +983 -126
  38. package/dist/behaviors/exports/molecules/std-agent-fix-loop.orb +1985 -21
  39. package/dist/behaviors/exports/molecules/std-agent-learner.orb +1830 -23
  40. package/dist/behaviors/exports/molecules/std-agent-planner.orb +1776 -19
  41. package/dist/behaviors/exports/molecules/std-agent-rag.orb +1150 -15
  42. package/dist/behaviors/exports/molecules/std-agent-tool-loop.orb +3643 -23
  43. package/dist/behaviors/exports/organisms/std-agent-assistant.orb +5308 -1156
  44. package/dist/behaviors/exports/organisms/std-agent-builder.orb +13525 -1326
  45. package/dist/behaviors/exports/organisms/std-agent-pipeline.orb +10731 -1088
  46. package/dist/behaviors/exports/organisms/std-agent-reviewer.orb +4187 -525
  47. package/dist/behaviors/exports/organisms/std-agent-tutor.orb +3126 -322
  48. package/dist/behaviors/exports/validation-report.json +1 -1426
  49. package/dist/behaviors/exports-reader.js +4860 -4176
  50. package/dist/behaviors/exports-reader.js.map +1 -1
  51. package/dist/behaviors/functions/index.d.ts +259 -98
  52. package/dist/behaviors/functions/index.js +4845 -4177
  53. package/dist/behaviors/functions/index.js.map +1 -1
  54. package/dist/behaviors/index.d.ts +1 -1
  55. package/dist/behaviors/index.js +4863 -4179
  56. package/dist/behaviors/index.js.map +1 -1
  57. package/dist/behaviors/query.js +4862 -4178
  58. package/dist/behaviors/query.js.map +1 -1
  59. package/dist/exports/atoms/std-agent-activity-log.orb +559 -0
  60. package/dist/exports/atoms/std-agent-chat-thread.orb +774 -0
  61. package/dist/exports/atoms/std-agent-classifier.orb +606 -137
  62. package/dist/exports/atoms/std-agent-completion.orb +646 -182
  63. package/dist/exports/atoms/std-agent-context-window.orb +1762 -258
  64. package/dist/exports/atoms/std-agent-conversation.orb +652 -369
  65. package/dist/exports/atoms/std-agent-memory.orb +574 -322
  66. package/dist/exports/atoms/std-agent-provider.orb +632 -136
  67. package/dist/exports/atoms/std-agent-search.orb +228 -198
  68. package/dist/exports/atoms/std-agent-session.orb +569 -559
  69. package/dist/exports/atoms/std-agent-step-progress.orb +850 -0
  70. package/dist/exports/atoms/std-agent-token-gauge.orb +1616 -0
  71. package/dist/exports/atoms/std-agent-tool-call.orb +983 -126
  72. package/dist/exports/molecules/std-agent-fix-loop.orb +1985 -21
  73. package/dist/exports/molecules/std-agent-learner.orb +1830 -23
  74. package/dist/exports/molecules/std-agent-planner.orb +1776 -19
  75. package/dist/exports/molecules/std-agent-rag.orb +1150 -15
  76. package/dist/exports/molecules/std-agent-tool-loop.orb +3643 -23
  77. package/dist/exports/organisms/std-agent-assistant.orb +5308 -1156
  78. package/dist/exports/organisms/std-agent-builder.orb +13525 -1326
  79. package/dist/exports/organisms/std-agent-pipeline.orb +10731 -1088
  80. package/dist/exports/organisms/std-agent-reviewer.orb +4187 -525
  81. package/dist/exports/organisms/std-agent-tutor.orb +3126 -322
  82. package/dist/exports/validation-report.json +1 -1426
  83. package/dist/index.d.ts +1 -1
  84. package/dist/index.js +4864 -4180
  85. package/dist/index.js.map +1 -1
  86. package/package.json +1 -1
@@ -72,6 +72,106 @@
72
72
  "name": "error",
73
73
  "type": "string",
74
74
  "default": ""
75
+ },
76
+ {
77
+ "name": "currentStep",
78
+ "type": "number",
79
+ "default": 0
80
+ },
81
+ {
82
+ "name": "totalSteps",
83
+ "type": "number",
84
+ "default": 4
85
+ },
86
+ {
87
+ "name": "steps",
88
+ "type": "string",
89
+ "default": "Plan,Execute,Check,Complete"
90
+ },
91
+ {
92
+ "name": "toolName",
93
+ "type": "string",
94
+ "default": ""
95
+ },
96
+ {
97
+ "name": "args",
98
+ "type": "string",
99
+ "default": ""
100
+ },
101
+ {
102
+ "name": "prompt",
103
+ "type": "string",
104
+ "default": ""
105
+ },
106
+ {
107
+ "name": "response",
108
+ "type": "string",
109
+ "default": ""
110
+ },
111
+ {
112
+ "name": "provider",
113
+ "type": "string",
114
+ "default": "anthropic"
115
+ },
116
+ {
117
+ "name": "model",
118
+ "type": "string",
119
+ "default": "claude-sonnet-4-20250514"
120
+ },
121
+ {
122
+ "name": "tokenCount",
123
+ "type": "number",
124
+ "default": 0
125
+ },
126
+ {
127
+ "name": "maxTokens",
128
+ "type": "number",
129
+ "default": 200000
130
+ },
131
+ {
132
+ "name": "usage",
133
+ "type": "number",
134
+ "default": 0
135
+ },
136
+ {
137
+ "name": "current",
138
+ "type": "number",
139
+ "default": 0
140
+ },
141
+ {
142
+ "name": "max",
143
+ "type": "number",
144
+ "default": 200000
145
+ },
146
+ {
147
+ "name": "threshold",
148
+ "type": "number",
149
+ "default": 0.85
150
+ },
151
+ {
152
+ "name": "lastCompactedAt",
153
+ "type": "string",
154
+ "default": ""
155
+ },
156
+ {
157
+ "name": "action",
158
+ "type": "string",
159
+ "default": ""
160
+ },
161
+ {
162
+ "name": "detail",
163
+ "type": "string",
164
+ "default": ""
165
+ },
166
+ {
167
+ "name": "timestamp",
168
+ "type": "string",
169
+ "default": ""
170
+ },
171
+ {
172
+ "name": "duration",
173
+ "type": "number",
174
+ "default": 0
75
175
  }
76
176
  ]
77
177
  },
@@ -281,12 +381,12 @@
281
381
  [
282
382
  "agent/generate",
283
383
  [
284
- "string/concat",
384
+ "str/concat",
285
385
  "Task: ",
286
386
  "@entity.task",
287
387
  "\n\nAvailable tools: ",
288
388
  [
289
- "string/join",
389
+ "str/join",
290
390
  [
291
391
  "agent/tools"
292
392
  ],
@@ -347,7 +447,7 @@
347
447
  "set",
348
448
  "@entity.iterations",
349
449
  [
350
- "math/add",
450
+ "+",
351
451
  "@entity.iterations",
352
452
  1
353
453
  ]
@@ -393,15 +493,15 @@
393
493
  {
394
494
  "type": "badge",
395
495
  "label": [
396
- "string/concat",
496
+ "str/concat",
397
497
  "Iteration ",
398
498
  [
399
- "string/of",
499
+ "str/concat",
400
500
  "@entity.iterations"
401
501
  ],
402
502
  "/",
403
503
  [
404
- "string/of",
504
+ "str/concat",
405
505
  "@entity.maxIterations"
406
506
  ]
407
507
  ]
@@ -477,7 +577,7 @@
477
577
  [
478
578
  "agent/generate",
479
579
  [
480
- "string/concat",
580
+ "str/concat",
481
581
  "Task: ",
482
582
  "@entity.task",
483
583
  "\nPlan: ",
@@ -513,10 +613,10 @@
513
613
  {
514
614
  "type": "badge",
515
615
  "label": [
516
- "string/concat",
616
+ "str/concat",
517
617
  "Iteration ",
518
618
  [
519
- "string/of",
619
+ "str/concat",
520
620
  "@entity.iterations"
521
621
  ]
522
622
  ]
@@ -668,15 +768,15 @@
668
768
  "set",
669
769
  "@entity.iterations",
670
770
  [
671
- "math/add",
771
+ "+",
672
772
  "@entity.iterations",
673
773
  1
674
774
  ]
675
775
  ],
676
776
  [
677
- "cond",
777
+ "if",
678
778
  [
679
- "math/gte",
779
+ ">=",
680
780
  [
681
781
  "agent/context-usage"
682
782
  ],
@@ -685,6 +785,10 @@
685
785
  [
686
786
  "agent/compact",
687
787
  "hybrid"
788
+ ],
789
+ [
790
+ "log",
791
+ "Context below compact threshold"
688
792
  ]
689
793
  ],
690
794
  [
@@ -728,15 +832,15 @@
728
832
  {
729
833
  "type": "badge",
730
834
  "label": [
731
- "string/concat",
835
+ "str/concat",
732
836
  "Iteration ",
733
837
  [
734
- "string/of",
838
+ "str/concat",
735
839
  "@entity.iterations"
736
840
  ],
737
841
  "/",
738
842
  [
739
- "string/of",
843
+ "str/concat",
740
844
  "@entity.maxIterations"
741
845
  ]
742
846
  ]
@@ -1218,20 +1322,3536 @@
1218
1322
  }
1219
1323
  ]
1220
1324
  }
1221
- }
1222
- ],
1223
- "pages": [
1325
+ },
1224
1326
  {
1225
- "name": "AgentToolLoopPage",
1226
- "path": "/agenttoolloops",
1227
- "traits": [
1327
+ "name": "ToolLoopStepProgress",
1328
+ "linkedEntity": "AgentToolLoop",
1329
+ "category": "interaction",
1330
+ "emits": [
1228
1331
  {
1229
- "ref": "AgentToolLoopLoop"
1332
+ "event": "ADVANCE",
1333
+ "scope": "internal",
1334
+ "payload": [
1335
+ {
1336
+ "name": "step",
1337
+ "type": "number"
1338
+ }
1339
+ ]
1340
+ },
1341
+ {
1342
+ "event": "COMPLETE",
1343
+ "scope": "internal",
1344
+ "payload": [
1345
+ {
1346
+ "name": "totalSteps",
1347
+ "type": "number"
1348
+ }
1349
+ ]
1350
+ },
1351
+ {
1352
+ "event": "FAIL",
1353
+ "scope": "internal",
1354
+ "payload": [
1355
+ {
1356
+ "name": "step",
1357
+ "type": "number"
1358
+ }
1359
+ ]
1360
+ }
1361
+ ],
1362
+ "stateMachine": {
1363
+ "states": [
1364
+ {
1365
+ "name": "idle",
1366
+ "isInitial": true
1367
+ },
1368
+ {
1369
+ "name": "in_progress"
1370
+ },
1371
+ {
1372
+ "name": "completed"
1373
+ },
1374
+ {
1375
+ "name": "failed"
1376
+ }
1377
+ ],
1378
+ "events": [
1379
+ {
1380
+ "key": "INIT",
1381
+ "name": "Initialize"
1382
+ },
1383
+ {
1384
+ "key": "START",
1385
+ "name": "Start Pipeline"
1386
+ },
1387
+ {
1388
+ "key": "ADVANCE",
1389
+ "name": "Advance Step"
1390
+ },
1391
+ {
1392
+ "key": "COMPLETE",
1393
+ "name": "Complete Pipeline"
1394
+ },
1395
+ {
1396
+ "key": "FAIL",
1397
+ "name": "Pipeline Failed"
1398
+ },
1399
+ {
1400
+ "key": "RESET",
1401
+ "name": "Reset Pipeline"
1402
+ }
1403
+ ],
1404
+ "transitions": [
1405
+ {
1406
+ "from": "idle",
1407
+ "to": "idle",
1408
+ "event": "INIT",
1409
+ "effects": [
1410
+ [
1411
+ "fetch",
1412
+ "AgentToolLoop"
1413
+ ],
1414
+ [
1415
+ "render-ui",
1416
+ "main",
1417
+ {
1418
+ "type": "stack",
1419
+ "direction": "vertical",
1420
+ "gap": "lg",
1421
+ "children": [
1422
+ {
1423
+ "type": "stack",
1424
+ "direction": "horizontal",
1425
+ "gap": "sm",
1426
+ "align": "center",
1427
+ "children": [
1428
+ {
1429
+ "type": "icon",
1430
+ "name": "list-ordered",
1431
+ "size": "lg"
1432
+ },
1433
+ {
1434
+ "type": "typography",
1435
+ "content": "AgentToolLoop",
1436
+ "variant": "h2"
1437
+ },
1438
+ {
1439
+ "type": "badge",
1440
+ "label": "Idle",
1441
+ "variant": "default"
1442
+ }
1443
+ ]
1444
+ },
1445
+ {
1446
+ "type": "divider"
1447
+ },
1448
+ {
1449
+ "type": "wizard-progress",
1450
+ "currentStep": "@entity.currentStep",
1451
+ "totalSteps": "@entity.totalSteps",
1452
+ "steps": "@entity.steps"
1453
+ },
1454
+ {
1455
+ "type": "button",
1456
+ "label": "Start",
1457
+ "event": "START",
1458
+ "variant": "primary",
1459
+ "icon": "play"
1460
+ }
1461
+ ]
1462
+ }
1463
+ ]
1464
+ ]
1465
+ },
1466
+ {
1467
+ "from": "idle",
1468
+ "to": "in_progress",
1469
+ "event": "START",
1470
+ "effects": [
1471
+ [
1472
+ "set",
1473
+ "@entity.status",
1474
+ "in_progress"
1475
+ ],
1476
+ [
1477
+ "set",
1478
+ "@entity.currentStep",
1479
+ 0
1480
+ ],
1481
+ [
1482
+ "render-ui",
1483
+ "main",
1484
+ {
1485
+ "type": "stack",
1486
+ "direction": "vertical",
1487
+ "gap": "lg",
1488
+ "children": [
1489
+ {
1490
+ "type": "stack",
1491
+ "direction": "horizontal",
1492
+ "gap": "sm",
1493
+ "align": "center",
1494
+ "children": [
1495
+ {
1496
+ "type": "icon",
1497
+ "name": "loader",
1498
+ "size": "lg"
1499
+ },
1500
+ {
1501
+ "type": "typography",
1502
+ "content": "AgentToolLoop",
1503
+ "variant": "h2"
1504
+ },
1505
+ {
1506
+ "type": "badge",
1507
+ "label": "In Progress",
1508
+ "variant": "warning"
1509
+ }
1510
+ ]
1511
+ },
1512
+ {
1513
+ "type": "divider"
1514
+ },
1515
+ {
1516
+ "type": "wizard-progress",
1517
+ "currentStep": "@entity.currentStep",
1518
+ "totalSteps": "@entity.totalSteps",
1519
+ "steps": "@entity.steps"
1520
+ },
1521
+ {
1522
+ "type": "stack",
1523
+ "direction": "horizontal",
1524
+ "gap": "sm",
1525
+ "align": "center",
1526
+ "children": [
1527
+ {
1528
+ "type": "stat-display",
1529
+ "label": "Current Step",
1530
+ "value": "@entity.currentStep"
1531
+ },
1532
+ {
1533
+ "type": "stat-display",
1534
+ "label": "Total Steps",
1535
+ "value": "@entity.totalSteps"
1536
+ }
1537
+ ]
1538
+ },
1539
+ {
1540
+ "type": "stack",
1541
+ "direction": "horizontal",
1542
+ "gap": "sm",
1543
+ "children": [
1544
+ {
1545
+ "type": "button",
1546
+ "label": "Advance",
1547
+ "event": "ADVANCE",
1548
+ "variant": "primary",
1549
+ "icon": "chevron-right"
1550
+ },
1551
+ {
1552
+ "type": "button",
1553
+ "label": "Reset",
1554
+ "event": "RESET",
1555
+ "variant": "ghost",
1556
+ "icon": "rotate-ccw"
1557
+ }
1558
+ ]
1559
+ }
1560
+ ]
1561
+ }
1562
+ ]
1563
+ ]
1564
+ },
1565
+ {
1566
+ "from": "in_progress",
1567
+ "to": "in_progress",
1568
+ "event": "ADVANCE",
1569
+ "guard": [
1570
+ "<",
1571
+ "@entity.currentStep",
1572
+ "@entity.totalSteps"
1573
+ ],
1574
+ "effects": [
1575
+ [
1576
+ "set",
1577
+ "@entity.currentStep",
1578
+ [
1579
+ "+",
1580
+ "@entity.currentStep",
1581
+ 1
1582
+ ]
1583
+ ],
1584
+ [
1585
+ "render-ui",
1586
+ "main",
1587
+ {
1588
+ "type": "stack",
1589
+ "direction": "vertical",
1590
+ "gap": "lg",
1591
+ "children": [
1592
+ {
1593
+ "type": "stack",
1594
+ "direction": "horizontal",
1595
+ "gap": "sm",
1596
+ "align": "center",
1597
+ "children": [
1598
+ {
1599
+ "type": "icon",
1600
+ "name": "loader",
1601
+ "size": "lg"
1602
+ },
1603
+ {
1604
+ "type": "typography",
1605
+ "content": "AgentToolLoop",
1606
+ "variant": "h2"
1607
+ },
1608
+ {
1609
+ "type": "badge",
1610
+ "label": "In Progress",
1611
+ "variant": "warning"
1612
+ }
1613
+ ]
1614
+ },
1615
+ {
1616
+ "type": "divider"
1617
+ },
1618
+ {
1619
+ "type": "wizard-progress",
1620
+ "currentStep": "@entity.currentStep",
1621
+ "totalSteps": "@entity.totalSteps",
1622
+ "steps": "@entity.steps"
1623
+ },
1624
+ {
1625
+ "type": "stack",
1626
+ "direction": "horizontal",
1627
+ "gap": "sm",
1628
+ "align": "center",
1629
+ "children": [
1630
+ {
1631
+ "type": "stat-display",
1632
+ "label": "Current Step",
1633
+ "value": "@entity.currentStep"
1634
+ },
1635
+ {
1636
+ "type": "stat-display",
1637
+ "label": "Total Steps",
1638
+ "value": "@entity.totalSteps"
1639
+ }
1640
+ ]
1641
+ },
1642
+ {
1643
+ "type": "stack",
1644
+ "direction": "horizontal",
1645
+ "gap": "sm",
1646
+ "children": [
1647
+ {
1648
+ "type": "button",
1649
+ "label": "Advance",
1650
+ "event": "ADVANCE",
1651
+ "variant": "primary",
1652
+ "icon": "chevron-right"
1653
+ },
1654
+ {
1655
+ "type": "button",
1656
+ "label": "Reset",
1657
+ "event": "RESET",
1658
+ "variant": "ghost",
1659
+ "icon": "rotate-ccw"
1660
+ }
1661
+ ]
1662
+ }
1663
+ ]
1664
+ }
1665
+ ]
1666
+ ]
1667
+ },
1668
+ {
1669
+ "from": "in_progress",
1670
+ "to": "completed",
1671
+ "event": "COMPLETE",
1672
+ "effects": [
1673
+ [
1674
+ "set",
1675
+ "@entity.status",
1676
+ "completed"
1677
+ ],
1678
+ [
1679
+ "set",
1680
+ "@entity.currentStep",
1681
+ "@entity.totalSteps"
1682
+ ],
1683
+ [
1684
+ "render-ui",
1685
+ "main",
1686
+ {
1687
+ "type": "stack",
1688
+ "direction": "vertical",
1689
+ "gap": "lg",
1690
+ "children": [
1691
+ {
1692
+ "type": "stack",
1693
+ "direction": "horizontal",
1694
+ "gap": "sm",
1695
+ "align": "center",
1696
+ "children": [
1697
+ {
1698
+ "type": "icon",
1699
+ "name": "check-circle",
1700
+ "size": "lg"
1701
+ },
1702
+ {
1703
+ "type": "typography",
1704
+ "content": "AgentToolLoop",
1705
+ "variant": "h2"
1706
+ },
1707
+ {
1708
+ "type": "badge",
1709
+ "label": "Completed",
1710
+ "variant": "success"
1711
+ }
1712
+ ]
1713
+ },
1714
+ {
1715
+ "type": "divider"
1716
+ },
1717
+ {
1718
+ "type": "wizard-progress",
1719
+ "currentStep": "@entity.totalSteps",
1720
+ "totalSteps": "@entity.totalSteps",
1721
+ "steps": "@entity.steps"
1722
+ },
1723
+ {
1724
+ "type": "alert",
1725
+ "variant": "success",
1726
+ "message": "All steps completed successfully."
1727
+ },
1728
+ {
1729
+ "type": "button",
1730
+ "label": "Reset",
1731
+ "event": "RESET",
1732
+ "variant": "ghost",
1733
+ "icon": "rotate-ccw"
1734
+ }
1735
+ ]
1736
+ }
1737
+ ]
1738
+ ]
1739
+ },
1740
+ {
1741
+ "from": "in_progress",
1742
+ "to": "failed",
1743
+ "event": "FAIL",
1744
+ "effects": [
1745
+ [
1746
+ "set",
1747
+ "@entity.status",
1748
+ "failed"
1749
+ ],
1750
+ [
1751
+ "render-ui",
1752
+ "main",
1753
+ {
1754
+ "type": "stack",
1755
+ "direction": "vertical",
1756
+ "gap": "lg",
1757
+ "children": [
1758
+ {
1759
+ "type": "stack",
1760
+ "direction": "horizontal",
1761
+ "gap": "sm",
1762
+ "align": "center",
1763
+ "children": [
1764
+ {
1765
+ "type": "icon",
1766
+ "name": "x-circle",
1767
+ "size": "lg"
1768
+ },
1769
+ {
1770
+ "type": "typography",
1771
+ "content": "AgentToolLoop",
1772
+ "variant": "h2"
1773
+ },
1774
+ {
1775
+ "type": "badge",
1776
+ "label": "Failed",
1777
+ "variant": "destructive"
1778
+ }
1779
+ ]
1780
+ },
1781
+ {
1782
+ "type": "divider"
1783
+ },
1784
+ {
1785
+ "type": "wizard-progress",
1786
+ "currentStep": "@entity.currentStep",
1787
+ "totalSteps": "@entity.totalSteps",
1788
+ "steps": "@entity.steps"
1789
+ },
1790
+ {
1791
+ "type": "alert",
1792
+ "variant": "error",
1793
+ "message": "Pipeline failed at the current step."
1794
+ },
1795
+ {
1796
+ "type": "stack",
1797
+ "direction": "horizontal",
1798
+ "gap": "sm",
1799
+ "children": [
1800
+ {
1801
+ "type": "stat-display",
1802
+ "label": "Failed At Step",
1803
+ "value": "@entity.currentStep"
1804
+ }
1805
+ ]
1806
+ },
1807
+ {
1808
+ "type": "button",
1809
+ "label": "Reset",
1810
+ "event": "RESET",
1811
+ "variant": "ghost",
1812
+ "icon": "rotate-ccw"
1813
+ }
1814
+ ]
1815
+ }
1816
+ ]
1817
+ ]
1818
+ },
1819
+ {
1820
+ "from": "idle",
1821
+ "to": "idle",
1822
+ "event": "RESET",
1823
+ "effects": [
1824
+ [
1825
+ "set",
1826
+ "@entity.status",
1827
+ "idle"
1828
+ ],
1829
+ [
1830
+ "set",
1831
+ "@entity.currentStep",
1832
+ 0
1833
+ ],
1834
+ [
1835
+ "render-ui",
1836
+ "main",
1837
+ {
1838
+ "type": "stack",
1839
+ "direction": "vertical",
1840
+ "gap": "lg",
1841
+ "children": [
1842
+ {
1843
+ "type": "stack",
1844
+ "direction": "horizontal",
1845
+ "gap": "sm",
1846
+ "align": "center",
1847
+ "children": [
1848
+ {
1849
+ "type": "icon",
1850
+ "name": "list-ordered",
1851
+ "size": "lg"
1852
+ },
1853
+ {
1854
+ "type": "typography",
1855
+ "content": "AgentToolLoop",
1856
+ "variant": "h2"
1857
+ },
1858
+ {
1859
+ "type": "badge",
1860
+ "label": "Idle",
1861
+ "variant": "default"
1862
+ }
1863
+ ]
1864
+ },
1865
+ {
1866
+ "type": "divider"
1867
+ },
1868
+ {
1869
+ "type": "wizard-progress",
1870
+ "currentStep": "@entity.currentStep",
1871
+ "totalSteps": "@entity.totalSteps",
1872
+ "steps": "@entity.steps"
1873
+ },
1874
+ {
1875
+ "type": "button",
1876
+ "label": "Start",
1877
+ "event": "START",
1878
+ "variant": "primary",
1879
+ "icon": "play"
1880
+ }
1881
+ ]
1882
+ }
1883
+ ]
1884
+ ]
1885
+ },
1886
+ {
1887
+ "from": "in_progress",
1888
+ "to": "idle",
1889
+ "event": "RESET",
1890
+ "effects": [
1891
+ [
1892
+ "set",
1893
+ "@entity.status",
1894
+ "idle"
1895
+ ],
1896
+ [
1897
+ "set",
1898
+ "@entity.currentStep",
1899
+ 0
1900
+ ],
1901
+ [
1902
+ "render-ui",
1903
+ "main",
1904
+ {
1905
+ "type": "stack",
1906
+ "direction": "vertical",
1907
+ "gap": "lg",
1908
+ "children": [
1909
+ {
1910
+ "type": "stack",
1911
+ "direction": "horizontal",
1912
+ "gap": "sm",
1913
+ "align": "center",
1914
+ "children": [
1915
+ {
1916
+ "type": "icon",
1917
+ "name": "list-ordered",
1918
+ "size": "lg"
1919
+ },
1920
+ {
1921
+ "type": "typography",
1922
+ "content": "AgentToolLoop",
1923
+ "variant": "h2"
1924
+ },
1925
+ {
1926
+ "type": "badge",
1927
+ "label": "Idle",
1928
+ "variant": "default"
1929
+ }
1930
+ ]
1931
+ },
1932
+ {
1933
+ "type": "divider"
1934
+ },
1935
+ {
1936
+ "type": "wizard-progress",
1937
+ "currentStep": "@entity.currentStep",
1938
+ "totalSteps": "@entity.totalSteps",
1939
+ "steps": "@entity.steps"
1940
+ },
1941
+ {
1942
+ "type": "button",
1943
+ "label": "Start",
1944
+ "event": "START",
1945
+ "variant": "primary",
1946
+ "icon": "play"
1947
+ }
1948
+ ]
1949
+ }
1950
+ ]
1951
+ ]
1952
+ },
1953
+ {
1954
+ "from": "completed",
1955
+ "to": "idle",
1956
+ "event": "RESET",
1957
+ "effects": [
1958
+ [
1959
+ "set",
1960
+ "@entity.status",
1961
+ "idle"
1962
+ ],
1963
+ [
1964
+ "set",
1965
+ "@entity.currentStep",
1966
+ 0
1967
+ ],
1968
+ [
1969
+ "render-ui",
1970
+ "main",
1971
+ {
1972
+ "type": "stack",
1973
+ "direction": "vertical",
1974
+ "gap": "lg",
1975
+ "children": [
1976
+ {
1977
+ "type": "stack",
1978
+ "direction": "horizontal",
1979
+ "gap": "sm",
1980
+ "align": "center",
1981
+ "children": [
1982
+ {
1983
+ "type": "icon",
1984
+ "name": "list-ordered",
1985
+ "size": "lg"
1986
+ },
1987
+ {
1988
+ "type": "typography",
1989
+ "content": "AgentToolLoop",
1990
+ "variant": "h2"
1991
+ },
1992
+ {
1993
+ "type": "badge",
1994
+ "label": "Idle",
1995
+ "variant": "default"
1996
+ }
1997
+ ]
1998
+ },
1999
+ {
2000
+ "type": "divider"
2001
+ },
2002
+ {
2003
+ "type": "wizard-progress",
2004
+ "currentStep": "@entity.currentStep",
2005
+ "totalSteps": "@entity.totalSteps",
2006
+ "steps": "@entity.steps"
2007
+ },
2008
+ {
2009
+ "type": "button",
2010
+ "label": "Start",
2011
+ "event": "START",
2012
+ "variant": "primary",
2013
+ "icon": "play"
2014
+ }
2015
+ ]
2016
+ }
2017
+ ]
2018
+ ]
2019
+ },
2020
+ {
2021
+ "from": "failed",
2022
+ "to": "idle",
2023
+ "event": "RESET",
2024
+ "effects": [
2025
+ [
2026
+ "set",
2027
+ "@entity.status",
2028
+ "idle"
2029
+ ],
2030
+ [
2031
+ "set",
2032
+ "@entity.currentStep",
2033
+ 0
2034
+ ],
2035
+ [
2036
+ "render-ui",
2037
+ "main",
2038
+ {
2039
+ "type": "stack",
2040
+ "direction": "vertical",
2041
+ "gap": "lg",
2042
+ "children": [
2043
+ {
2044
+ "type": "stack",
2045
+ "direction": "horizontal",
2046
+ "gap": "sm",
2047
+ "align": "center",
2048
+ "children": [
2049
+ {
2050
+ "type": "icon",
2051
+ "name": "list-ordered",
2052
+ "size": "lg"
2053
+ },
2054
+ {
2055
+ "type": "typography",
2056
+ "content": "AgentToolLoop",
2057
+ "variant": "h2"
2058
+ },
2059
+ {
2060
+ "type": "badge",
2061
+ "label": "Idle",
2062
+ "variant": "default"
2063
+ }
2064
+ ]
2065
+ },
2066
+ {
2067
+ "type": "divider"
2068
+ },
2069
+ {
2070
+ "type": "wizard-progress",
2071
+ "currentStep": "@entity.currentStep",
2072
+ "totalSteps": "@entity.totalSteps",
2073
+ "steps": "@entity.steps"
2074
+ },
2075
+ {
2076
+ "type": "button",
2077
+ "label": "Start",
2078
+ "event": "START",
2079
+ "variant": "primary",
2080
+ "icon": "play"
2081
+ }
2082
+ ]
2083
+ }
2084
+ ]
2085
+ ]
2086
+ }
2087
+ ]
2088
+ }
2089
+ },
2090
+ {
2091
+ "name": "ToolLoopActivityLog",
2092
+ "linkedEntity": "AgentToolLoop",
2093
+ "category": "interaction",
2094
+ "emits": [
2095
+ {
2096
+ "event": "LOG_ENTRY",
2097
+ "scope": "internal",
2098
+ "payload": [
2099
+ {
2100
+ "name": "action",
2101
+ "type": "string"
2102
+ },
2103
+ {
2104
+ "name": "detail",
2105
+ "type": "string"
2106
+ },
2107
+ {
2108
+ "name": "status",
2109
+ "type": "string"
2110
+ }
2111
+ ]
2112
+ }
2113
+ ],
2114
+ "stateMachine": {
2115
+ "states": [
2116
+ {
2117
+ "name": "logging",
2118
+ "isInitial": true
2119
+ }
2120
+ ],
2121
+ "events": [
2122
+ {
2123
+ "key": "INIT",
2124
+ "name": "Initialize"
2125
+ },
2126
+ {
2127
+ "key": "LOG_ENTRY",
2128
+ "name": "Log Entry",
2129
+ "payload": [
2130
+ {
2131
+ "name": "action",
2132
+ "type": "string",
2133
+ "required": true
2134
+ },
2135
+ {
2136
+ "name": "detail",
2137
+ "type": "string",
2138
+ "required": true
2139
+ },
2140
+ {
2141
+ "name": "status",
2142
+ "type": "string",
2143
+ "required": true
2144
+ }
2145
+ ]
2146
+ },
2147
+ {
2148
+ "key": "CLEAR",
2149
+ "name": "Clear Log"
2150
+ }
2151
+ ],
2152
+ "transitions": [
2153
+ {
2154
+ "from": "logging",
2155
+ "to": "logging",
2156
+ "event": "INIT",
2157
+ "effects": [
2158
+ [
2159
+ "fetch",
2160
+ "AgentToolLoop"
2161
+ ],
2162
+ [
2163
+ "render-ui",
2164
+ "main",
2165
+ {
2166
+ "type": "stack",
2167
+ "direction": "vertical",
2168
+ "gap": "lg",
2169
+ "children": [
2170
+ {
2171
+ "type": "stack",
2172
+ "direction": "horizontal",
2173
+ "gap": "sm",
2174
+ "justify": "space-between",
2175
+ "align": "center",
2176
+ "children": [
2177
+ {
2178
+ "type": "stack",
2179
+ "direction": "horizontal",
2180
+ "gap": "sm",
2181
+ "align": "center",
2182
+ "children": [
2183
+ {
2184
+ "type": "icon",
2185
+ "name": "activity",
2186
+ "size": "lg"
2187
+ },
2188
+ {
2189
+ "type": "typography",
2190
+ "content": "Activity Log",
2191
+ "variant": "h2"
2192
+ }
2193
+ ]
2194
+ },
2195
+ {
2196
+ "type": "button",
2197
+ "label": "Clear",
2198
+ "event": "CLEAR",
2199
+ "variant": "ghost",
2200
+ "icon": "trash"
2201
+ }
2202
+ ]
2203
+ },
2204
+ {
2205
+ "type": "divider"
2206
+ },
2207
+ {
2208
+ "type": "timeline",
2209
+ "entity": "AgentToolLoop",
2210
+ "emptyIcon": "activity",
2211
+ "emptyTitle": "No activity yet",
2212
+ "emptyDescription": "Agent actions will appear here as they occur.",
2213
+ "renderItem": [
2214
+ "fn",
2215
+ "item",
2216
+ {
2217
+ "type": "stack",
2218
+ "direction": "vertical",
2219
+ "gap": "xs",
2220
+ "children": [
2221
+ {
2222
+ "type": "stack",
2223
+ "direction": "horizontal",
2224
+ "gap": "sm",
2225
+ "align": "center",
2226
+ "children": [
2227
+ {
2228
+ "type": "badge",
2229
+ "label": "@item.status"
2230
+ },
2231
+ {
2232
+ "type": "typography",
2233
+ "variant": "h4",
2234
+ "content": "@item.action"
2235
+ }
2236
+ ]
2237
+ },
2238
+ {
2239
+ "type": "typography",
2240
+ "variant": "body",
2241
+ "color": "muted",
2242
+ "content": "@item.detail"
2243
+ },
2244
+ {
2245
+ "type": "stack",
2246
+ "direction": "horizontal",
2247
+ "gap": "sm",
2248
+ "align": "center",
2249
+ "children": [
2250
+ {
2251
+ "type": "typography",
2252
+ "variant": "caption",
2253
+ "color": "muted",
2254
+ "content": "@item.timestamp"
2255
+ },
2256
+ {
2257
+ "type": "badge",
2258
+ "label": "@item.duration",
2259
+ "variant": "outline"
2260
+ }
2261
+ ]
2262
+ }
2263
+ ]
2264
+ }
2265
+ ],
2266
+ "fields": [
2267
+ "name",
2268
+ "description",
2269
+ "status",
2270
+ "createdAt",
2271
+ "task",
2272
+ "plan",
2273
+ "iterations",
2274
+ "maxIterations",
2275
+ "result",
2276
+ "currentTool",
2277
+ "lastToolResult",
2278
+ "error",
2279
+ "currentStep",
2280
+ "totalSteps",
2281
+ "steps",
2282
+ "toolName",
2283
+ "args",
2284
+ "prompt",
2285
+ "response",
2286
+ "provider",
2287
+ "model",
2288
+ "tokenCount",
2289
+ "maxTokens",
2290
+ "usage",
2291
+ "current",
2292
+ "max",
2293
+ "threshold",
2294
+ "lastCompactedAt",
2295
+ "action",
2296
+ "detail",
2297
+ "timestamp",
2298
+ "duration"
2299
+ ]
2300
+ }
2301
+ ]
2302
+ }
2303
+ ]
2304
+ ]
2305
+ },
2306
+ {
2307
+ "from": "logging",
2308
+ "to": "logging",
2309
+ "event": "LOG_ENTRY",
2310
+ "effects": [
2311
+ [
2312
+ "persist",
2313
+ "create",
2314
+ "AgentToolLoop",
2315
+ {
2316
+ "action": "@payload.action",
2317
+ "detail": "@payload.detail",
2318
+ "status": "@payload.status",
2319
+ "timestamp": "@now"
2320
+ }
2321
+ ],
2322
+ [
2323
+ "fetch",
2324
+ "AgentToolLoop"
2325
+ ],
2326
+ [
2327
+ "render-ui",
2328
+ "main",
2329
+ {
2330
+ "type": "stack",
2331
+ "direction": "vertical",
2332
+ "gap": "lg",
2333
+ "children": [
2334
+ {
2335
+ "type": "stack",
2336
+ "direction": "horizontal",
2337
+ "gap": "sm",
2338
+ "justify": "space-between",
2339
+ "align": "center",
2340
+ "children": [
2341
+ {
2342
+ "type": "stack",
2343
+ "direction": "horizontal",
2344
+ "gap": "sm",
2345
+ "align": "center",
2346
+ "children": [
2347
+ {
2348
+ "type": "icon",
2349
+ "name": "activity",
2350
+ "size": "lg"
2351
+ },
2352
+ {
2353
+ "type": "typography",
2354
+ "content": "Activity Log",
2355
+ "variant": "h2"
2356
+ }
2357
+ ]
2358
+ },
2359
+ {
2360
+ "type": "button",
2361
+ "label": "Clear",
2362
+ "event": "CLEAR",
2363
+ "variant": "ghost",
2364
+ "icon": "trash"
2365
+ }
2366
+ ]
2367
+ },
2368
+ {
2369
+ "type": "divider"
2370
+ },
2371
+ {
2372
+ "type": "timeline",
2373
+ "entity": "AgentToolLoop",
2374
+ "emptyIcon": "activity",
2375
+ "emptyTitle": "No activity yet",
2376
+ "emptyDescription": "Agent actions will appear here as they occur.",
2377
+ "renderItem": [
2378
+ "fn",
2379
+ "item",
2380
+ {
2381
+ "type": "stack",
2382
+ "direction": "vertical",
2383
+ "gap": "xs",
2384
+ "children": [
2385
+ {
2386
+ "type": "stack",
2387
+ "direction": "horizontal",
2388
+ "gap": "sm",
2389
+ "align": "center",
2390
+ "children": [
2391
+ {
2392
+ "type": "badge",
2393
+ "label": "@item.status"
2394
+ },
2395
+ {
2396
+ "type": "typography",
2397
+ "variant": "h4",
2398
+ "content": "@item.action"
2399
+ }
2400
+ ]
2401
+ },
2402
+ {
2403
+ "type": "typography",
2404
+ "variant": "body",
2405
+ "color": "muted",
2406
+ "content": "@item.detail"
2407
+ },
2408
+ {
2409
+ "type": "stack",
2410
+ "direction": "horizontal",
2411
+ "gap": "sm",
2412
+ "align": "center",
2413
+ "children": [
2414
+ {
2415
+ "type": "typography",
2416
+ "variant": "caption",
2417
+ "color": "muted",
2418
+ "content": "@item.timestamp"
2419
+ },
2420
+ {
2421
+ "type": "badge",
2422
+ "label": "@item.duration",
2423
+ "variant": "outline"
2424
+ }
2425
+ ]
2426
+ }
2427
+ ]
2428
+ }
2429
+ ],
2430
+ "fields": [
2431
+ "name",
2432
+ "description",
2433
+ "status",
2434
+ "createdAt",
2435
+ "task",
2436
+ "plan",
2437
+ "iterations",
2438
+ "maxIterations",
2439
+ "result",
2440
+ "currentTool",
2441
+ "lastToolResult",
2442
+ "error",
2443
+ "currentStep",
2444
+ "totalSteps",
2445
+ "steps",
2446
+ "toolName",
2447
+ "args",
2448
+ "prompt",
2449
+ "response",
2450
+ "provider",
2451
+ "model",
2452
+ "tokenCount",
2453
+ "maxTokens",
2454
+ "usage",
2455
+ "current",
2456
+ "max",
2457
+ "threshold",
2458
+ "lastCompactedAt",
2459
+ "action",
2460
+ "detail",
2461
+ "timestamp",
2462
+ "duration"
2463
+ ]
2464
+ }
2465
+ ]
2466
+ }
2467
+ ],
2468
+ [
2469
+ "notify",
2470
+ "AgentToolLoop created successfully"
2471
+ ]
2472
+ ]
2473
+ },
2474
+ {
2475
+ "from": "logging",
2476
+ "to": "logging",
2477
+ "event": "CLEAR",
2478
+ "effects": [
2479
+ [
2480
+ "persist",
2481
+ "delete",
2482
+ "AgentToolLoop"
2483
+ ],
2484
+ [
2485
+ "fetch",
2486
+ "AgentToolLoop"
2487
+ ],
2488
+ [
2489
+ "render-ui",
2490
+ "main",
2491
+ {
2492
+ "type": "stack",
2493
+ "direction": "vertical",
2494
+ "gap": "lg",
2495
+ "children": [
2496
+ {
2497
+ "type": "stack",
2498
+ "direction": "horizontal",
2499
+ "gap": "sm",
2500
+ "justify": "space-between",
2501
+ "align": "center",
2502
+ "children": [
2503
+ {
2504
+ "type": "stack",
2505
+ "direction": "horizontal",
2506
+ "gap": "sm",
2507
+ "align": "center",
2508
+ "children": [
2509
+ {
2510
+ "type": "icon",
2511
+ "name": "activity",
2512
+ "size": "lg"
2513
+ },
2514
+ {
2515
+ "type": "typography",
2516
+ "content": "Activity Log",
2517
+ "variant": "h2"
2518
+ }
2519
+ ]
2520
+ },
2521
+ {
2522
+ "type": "button",
2523
+ "label": "Clear",
2524
+ "event": "CLEAR",
2525
+ "variant": "ghost",
2526
+ "icon": "trash"
2527
+ }
2528
+ ]
2529
+ },
2530
+ {
2531
+ "type": "divider"
2532
+ },
2533
+ {
2534
+ "type": "timeline",
2535
+ "entity": "AgentToolLoop",
2536
+ "emptyIcon": "activity",
2537
+ "emptyTitle": "No activity yet",
2538
+ "emptyDescription": "Agent actions will appear here as they occur.",
2539
+ "renderItem": [
2540
+ "fn",
2541
+ "item",
2542
+ {
2543
+ "type": "stack",
2544
+ "direction": "vertical",
2545
+ "gap": "xs",
2546
+ "children": [
2547
+ {
2548
+ "type": "stack",
2549
+ "direction": "horizontal",
2550
+ "gap": "sm",
2551
+ "align": "center",
2552
+ "children": [
2553
+ {
2554
+ "type": "badge",
2555
+ "label": "@item.status"
2556
+ },
2557
+ {
2558
+ "type": "typography",
2559
+ "variant": "h4",
2560
+ "content": "@item.action"
2561
+ }
2562
+ ]
2563
+ },
2564
+ {
2565
+ "type": "typography",
2566
+ "variant": "body",
2567
+ "color": "muted",
2568
+ "content": "@item.detail"
2569
+ },
2570
+ {
2571
+ "type": "stack",
2572
+ "direction": "horizontal",
2573
+ "gap": "sm",
2574
+ "align": "center",
2575
+ "children": [
2576
+ {
2577
+ "type": "typography",
2578
+ "variant": "caption",
2579
+ "color": "muted",
2580
+ "content": "@item.timestamp"
2581
+ },
2582
+ {
2583
+ "type": "badge",
2584
+ "label": "@item.duration",
2585
+ "variant": "outline"
2586
+ }
2587
+ ]
2588
+ }
2589
+ ]
2590
+ }
2591
+ ],
2592
+ "fields": [
2593
+ "name",
2594
+ "description",
2595
+ "status",
2596
+ "createdAt",
2597
+ "task",
2598
+ "plan",
2599
+ "iterations",
2600
+ "maxIterations",
2601
+ "result",
2602
+ "currentTool",
2603
+ "lastToolResult",
2604
+ "error",
2605
+ "currentStep",
2606
+ "totalSteps",
2607
+ "steps",
2608
+ "toolName",
2609
+ "args",
2610
+ "prompt",
2611
+ "response",
2612
+ "provider",
2613
+ "model",
2614
+ "tokenCount",
2615
+ "maxTokens",
2616
+ "usage",
2617
+ "current",
2618
+ "max",
2619
+ "threshold",
2620
+ "lastCompactedAt",
2621
+ "action",
2622
+ "detail",
2623
+ "timestamp",
2624
+ "duration"
2625
+ ]
2626
+ }
2627
+ ]
2628
+ }
2629
+ ],
2630
+ [
2631
+ "notify",
2632
+ "AgentToolLoop deleted successfully"
2633
+ ]
2634
+ ]
2635
+ }
2636
+ ]
2637
+ }
2638
+ },
2639
+ {
2640
+ "name": "ToolLoopCompletionFlow",
2641
+ "linkedEntity": "AgentToolLoop",
2642
+ "category": "interaction",
2643
+ "emits": [
2644
+ {
2645
+ "event": "GENERATED",
2646
+ "scope": "internal"
2647
+ }
2648
+ ],
2649
+ "stateMachine": {
2650
+ "states": [
2651
+ {
2652
+ "name": "closed",
2653
+ "isInitial": true
2654
+ },
2655
+ {
2656
+ "name": "open"
2657
+ }
2658
+ ],
2659
+ "events": [
2660
+ {
2661
+ "key": "INIT",
2662
+ "name": "Initialize"
2663
+ },
2664
+ {
2665
+ "key": "GENERATE",
2666
+ "name": "Open"
2667
+ },
2668
+ {
2669
+ "key": "CLOSE",
2670
+ "name": "Close"
2671
+ },
2672
+ {
2673
+ "key": "SAVE",
2674
+ "name": "Save",
2675
+ "payload": [
2676
+ {
2677
+ "name": "data",
2678
+ "type": "object",
2679
+ "required": true
2680
+ }
2681
+ ]
2682
+ }
2683
+ ],
2684
+ "transitions": [
2685
+ {
2686
+ "from": "closed",
2687
+ "to": "closed",
2688
+ "event": "INIT",
2689
+ "effects": [
2690
+ [
2691
+ "ref",
2692
+ "AgentToolLoop"
2693
+ ],
2694
+ [
2695
+ "render-ui",
2696
+ "main",
2697
+ {
2698
+ "type": "stack",
2699
+ "direction": "vertical",
2700
+ "gap": "lg",
2701
+ "children": [
2702
+ {
2703
+ "type": "stack",
2704
+ "direction": "horizontal",
2705
+ "gap": "md",
2706
+ "justify": "space-between",
2707
+ "children": [
2708
+ {
2709
+ "type": "stack",
2710
+ "direction": "horizontal",
2711
+ "gap": "md",
2712
+ "children": [
2713
+ {
2714
+ "type": "icon",
2715
+ "name": "sparkles",
2716
+ "size": "lg"
2717
+ },
2718
+ {
2719
+ "type": "typography",
2720
+ "content": "AgentToolLoop",
2721
+ "variant": "h2"
2722
+ }
2723
+ ]
2724
+ },
2725
+ {
2726
+ "type": "button",
2727
+ "label": "Open",
2728
+ "event": "GENERATE",
2729
+ "variant": "primary",
2730
+ "icon": "sparkles"
2731
+ }
2732
+ ]
2733
+ },
2734
+ {
2735
+ "type": "divider"
2736
+ },
2737
+ {
2738
+ "type": "empty-state",
2739
+ "icon": "sparkles",
2740
+ "title": "Nothing open",
2741
+ "description": "Click Open to view details in a modal overlay."
2742
+ }
2743
+ ]
2744
+ }
2745
+ ]
2746
+ ]
2747
+ },
2748
+ {
2749
+ "from": "closed",
2750
+ "to": "open",
2751
+ "event": "GENERATE",
2752
+ "effects": [
2753
+ [
2754
+ "render-ui",
2755
+ "modal",
2756
+ {
2757
+ "type": "stack",
2758
+ "direction": "vertical",
2759
+ "gap": "md",
2760
+ "children": [
2761
+ {
2762
+ "type": "stack",
2763
+ "direction": "horizontal",
2764
+ "gap": "sm",
2765
+ "children": [
2766
+ {
2767
+ "type": "icon",
2768
+ "name": "sparkles",
2769
+ "size": "md"
2770
+ },
2771
+ {
2772
+ "type": "typography",
2773
+ "content": "AgentToolLoop",
2774
+ "variant": "h3"
2775
+ }
2776
+ ]
2777
+ },
2778
+ {
2779
+ "type": "divider"
2780
+ },
2781
+ {
2782
+ "type": "stack",
2783
+ "direction": "horizontal",
2784
+ "gap": "sm",
2785
+ "children": [
2786
+ {
2787
+ "type": "badge",
2788
+ "label": "@entity.provider"
2789
+ },
2790
+ {
2791
+ "type": "badge",
2792
+ "label": "@entity.model"
2793
+ }
2794
+ ]
2795
+ },
2796
+ {
2797
+ "type": "form-section",
2798
+ "entity": "AgentToolLoop",
2799
+ "mode": "create",
2800
+ "submitEvent": "SAVE",
2801
+ "cancelEvent": "CLOSE",
2802
+ "fields": [
2803
+ "prompt"
2804
+ ]
2805
+ }
2806
+ ]
2807
+ }
2808
+ ]
2809
+ ]
2810
+ },
2811
+ {
2812
+ "from": "open",
2813
+ "to": "closed",
2814
+ "event": "CLOSE",
2815
+ "effects": [
2816
+ [
2817
+ "render-ui",
2818
+ "modal",
2819
+ null
2820
+ ],
2821
+ [
2822
+ "notify",
2823
+ "Cancelled",
2824
+ "info"
2825
+ ],
2826
+ [
2827
+ "ref",
2828
+ "AgentToolLoop"
2829
+ ],
2830
+ [
2831
+ "render-ui",
2832
+ "main",
2833
+ {
2834
+ "type": "stack",
2835
+ "direction": "vertical",
2836
+ "gap": "lg",
2837
+ "children": [
2838
+ {
2839
+ "type": "stack",
2840
+ "direction": "horizontal",
2841
+ "gap": "md",
2842
+ "justify": "space-between",
2843
+ "children": [
2844
+ {
2845
+ "type": "stack",
2846
+ "direction": "horizontal",
2847
+ "gap": "md",
2848
+ "children": [
2849
+ {
2850
+ "type": "icon",
2851
+ "name": "sparkles",
2852
+ "size": "lg"
2853
+ },
2854
+ {
2855
+ "type": "typography",
2856
+ "content": "AgentToolLoop",
2857
+ "variant": "h2"
2858
+ }
2859
+ ]
2860
+ },
2861
+ {
2862
+ "type": "button",
2863
+ "label": "Open",
2864
+ "event": "GENERATE",
2865
+ "variant": "primary",
2866
+ "icon": "sparkles"
2867
+ }
2868
+ ]
2869
+ },
2870
+ {
2871
+ "type": "divider"
2872
+ },
2873
+ {
2874
+ "type": "empty-state",
2875
+ "icon": "sparkles",
2876
+ "title": "Nothing open",
2877
+ "description": "Click Open to view details in a modal overlay."
2878
+ }
2879
+ ]
2880
+ }
2881
+ ]
2882
+ ]
2883
+ },
2884
+ {
2885
+ "from": "open",
2886
+ "to": "closed",
2887
+ "event": "SAVE",
2888
+ "effects": [
2889
+ [
2890
+ "persist",
2891
+ "create",
2892
+ "AgentToolLoop",
2893
+ "@payload.data"
2894
+ ],
2895
+ [
2896
+ "render-ui",
2897
+ "modal",
2898
+ null
2899
+ ],
2900
+ [
2901
+ "emit",
2902
+ "GENERATED"
2903
+ ],
2904
+ [
2905
+ "ref",
2906
+ "AgentToolLoop"
2907
+ ],
2908
+ [
2909
+ "render-ui",
2910
+ "main",
2911
+ {
2912
+ "type": "stack",
2913
+ "direction": "vertical",
2914
+ "gap": "lg",
2915
+ "children": [
2916
+ {
2917
+ "type": "stack",
2918
+ "direction": "horizontal",
2919
+ "gap": "md",
2920
+ "justify": "space-between",
2921
+ "children": [
2922
+ {
2923
+ "type": "stack",
2924
+ "direction": "horizontal",
2925
+ "gap": "md",
2926
+ "children": [
2927
+ {
2928
+ "type": "icon",
2929
+ "name": "sparkles",
2930
+ "size": "lg"
2931
+ },
2932
+ {
2933
+ "type": "typography",
2934
+ "content": "AgentToolLoop",
2935
+ "variant": "h2"
2936
+ }
2937
+ ]
2938
+ },
2939
+ {
2940
+ "type": "button",
2941
+ "label": "Open",
2942
+ "event": "GENERATE",
2943
+ "variant": "primary",
2944
+ "icon": "sparkles"
2945
+ }
2946
+ ]
2947
+ },
2948
+ {
2949
+ "type": "divider"
2950
+ },
2951
+ {
2952
+ "type": "empty-state",
2953
+ "icon": "sparkles",
2954
+ "title": "Nothing open",
2955
+ "description": "Click Open to view details in a modal overlay."
2956
+ }
2957
+ ]
2958
+ }
2959
+ ],
2960
+ [
2961
+ "notify",
2962
+ "AgentToolLoop created successfully"
2963
+ ]
2964
+ ]
2965
+ }
2966
+ ]
2967
+ }
2968
+ },
2969
+ {
2970
+ "name": "ToolLoopToolCallFlow",
2971
+ "linkedEntity": "AgentToolLoop",
2972
+ "category": "interaction",
2973
+ "emits": [
2974
+ {
2975
+ "event": "INVOKED",
2976
+ "scope": "internal"
2977
+ }
2978
+ ],
2979
+ "stateMachine": {
2980
+ "states": [
2981
+ {
2982
+ "name": "closed",
2983
+ "isInitial": true
2984
+ },
2985
+ {
2986
+ "name": "open"
2987
+ }
2988
+ ],
2989
+ "events": [
2990
+ {
2991
+ "key": "INIT",
2992
+ "name": "Initialize"
2993
+ },
2994
+ {
2995
+ "key": "INVOKE",
2996
+ "name": "Open"
2997
+ },
2998
+ {
2999
+ "key": "CLOSE",
3000
+ "name": "Close"
3001
+ },
3002
+ {
3003
+ "key": "SAVE",
3004
+ "name": "Save",
3005
+ "payload": [
3006
+ {
3007
+ "name": "data",
3008
+ "type": "object",
3009
+ "required": true
3010
+ }
3011
+ ]
3012
+ }
3013
+ ],
3014
+ "transitions": [
3015
+ {
3016
+ "from": "closed",
3017
+ "to": "closed",
3018
+ "event": "INIT",
3019
+ "effects": [
3020
+ [
3021
+ "ref",
3022
+ "AgentToolLoop"
3023
+ ],
3024
+ [
3025
+ "render-ui",
3026
+ "main",
3027
+ {
3028
+ "type": "stack",
3029
+ "direction": "vertical",
3030
+ "gap": "lg",
3031
+ "children": [
3032
+ {
3033
+ "type": "stack",
3034
+ "direction": "horizontal",
3035
+ "gap": "md",
3036
+ "justify": "space-between",
3037
+ "children": [
3038
+ {
3039
+ "type": "stack",
3040
+ "direction": "horizontal",
3041
+ "gap": "md",
3042
+ "children": [
3043
+ {
3044
+ "type": "icon",
3045
+ "name": "wrench",
3046
+ "size": "lg"
3047
+ },
3048
+ {
3049
+ "type": "typography",
3050
+ "content": "Invoke Tool",
3051
+ "variant": "h2"
3052
+ }
3053
+ ]
3054
+ },
3055
+ {
3056
+ "type": "button",
3057
+ "label": "Open",
3058
+ "event": "INVOKE",
3059
+ "variant": "primary",
3060
+ "icon": "wrench"
3061
+ }
3062
+ ]
3063
+ },
3064
+ {
3065
+ "type": "divider"
3066
+ },
3067
+ {
3068
+ "type": "empty-state",
3069
+ "icon": "wrench",
3070
+ "title": "Nothing open",
3071
+ "description": "Click Open to view details in a modal overlay."
3072
+ }
3073
+ ]
3074
+ }
3075
+ ]
3076
+ ]
3077
+ },
3078
+ {
3079
+ "from": "closed",
3080
+ "to": "open",
3081
+ "event": "INVOKE",
3082
+ "effects": [
3083
+ [
3084
+ "render-ui",
3085
+ "modal",
3086
+ {
3087
+ "type": "stack",
3088
+ "direction": "vertical",
3089
+ "gap": "md",
3090
+ "children": [
3091
+ {
3092
+ "type": "stack",
3093
+ "direction": "horizontal",
3094
+ "gap": "sm",
3095
+ "children": [
3096
+ {
3097
+ "type": "icon",
3098
+ "name": "wrench",
3099
+ "size": "md"
3100
+ },
3101
+ {
3102
+ "type": "typography",
3103
+ "content": "Invoke Tool",
3104
+ "variant": "h3"
3105
+ }
3106
+ ]
3107
+ },
3108
+ {
3109
+ "type": "divider"
3110
+ },
3111
+ {
3112
+ "type": "form-section",
3113
+ "entity": "AgentToolLoop",
3114
+ "mode": "create",
3115
+ "submitEvent": "SAVE",
3116
+ "cancelEvent": "CLOSE",
3117
+ "fields": [
3118
+ "toolName",
3119
+ "args"
3120
+ ]
3121
+ }
3122
+ ]
3123
+ }
3124
+ ]
3125
+ ]
3126
+ },
3127
+ {
3128
+ "from": "open",
3129
+ "to": "closed",
3130
+ "event": "CLOSE",
3131
+ "effects": [
3132
+ [
3133
+ "render-ui",
3134
+ "modal",
3135
+ null
3136
+ ],
3137
+ [
3138
+ "notify",
3139
+ "Cancelled",
3140
+ "info"
3141
+ ],
3142
+ [
3143
+ "ref",
3144
+ "AgentToolLoop"
3145
+ ],
3146
+ [
3147
+ "render-ui",
3148
+ "main",
3149
+ {
3150
+ "type": "stack",
3151
+ "direction": "vertical",
3152
+ "gap": "lg",
3153
+ "children": [
3154
+ {
3155
+ "type": "stack",
3156
+ "direction": "horizontal",
3157
+ "gap": "md",
3158
+ "justify": "space-between",
3159
+ "children": [
3160
+ {
3161
+ "type": "stack",
3162
+ "direction": "horizontal",
3163
+ "gap": "md",
3164
+ "children": [
3165
+ {
3166
+ "type": "icon",
3167
+ "name": "wrench",
3168
+ "size": "lg"
3169
+ },
3170
+ {
3171
+ "type": "typography",
3172
+ "content": "Invoke Tool",
3173
+ "variant": "h2"
3174
+ }
3175
+ ]
3176
+ },
3177
+ {
3178
+ "type": "button",
3179
+ "label": "Open",
3180
+ "event": "INVOKE",
3181
+ "variant": "primary",
3182
+ "icon": "wrench"
3183
+ }
3184
+ ]
3185
+ },
3186
+ {
3187
+ "type": "divider"
3188
+ },
3189
+ {
3190
+ "type": "empty-state",
3191
+ "icon": "wrench",
3192
+ "title": "Nothing open",
3193
+ "description": "Click Open to view details in a modal overlay."
3194
+ }
3195
+ ]
3196
+ }
3197
+ ]
3198
+ ]
3199
+ },
3200
+ {
3201
+ "from": "open",
3202
+ "to": "closed",
3203
+ "event": "SAVE",
3204
+ "effects": [
3205
+ [
3206
+ "persist",
3207
+ "create",
3208
+ "AgentToolLoop",
3209
+ "@payload.data"
3210
+ ],
3211
+ [
3212
+ "render-ui",
3213
+ "modal",
3214
+ null
3215
+ ],
3216
+ [
3217
+ "emit",
3218
+ "INVOKED"
3219
+ ],
3220
+ [
3221
+ "ref",
3222
+ "AgentToolLoop"
3223
+ ],
3224
+ [
3225
+ "render-ui",
3226
+ "main",
3227
+ {
3228
+ "type": "stack",
3229
+ "direction": "vertical",
3230
+ "gap": "lg",
3231
+ "children": [
3232
+ {
3233
+ "type": "stack",
3234
+ "direction": "horizontal",
3235
+ "gap": "md",
3236
+ "justify": "space-between",
3237
+ "children": [
3238
+ {
3239
+ "type": "stack",
3240
+ "direction": "horizontal",
3241
+ "gap": "md",
3242
+ "children": [
3243
+ {
3244
+ "type": "icon",
3245
+ "name": "wrench",
3246
+ "size": "lg"
3247
+ },
3248
+ {
3249
+ "type": "typography",
3250
+ "content": "Invoke Tool",
3251
+ "variant": "h2"
3252
+ }
3253
+ ]
3254
+ },
3255
+ {
3256
+ "type": "button",
3257
+ "label": "Open",
3258
+ "event": "INVOKE",
3259
+ "variant": "primary",
3260
+ "icon": "wrench"
3261
+ }
3262
+ ]
3263
+ },
3264
+ {
3265
+ "type": "divider"
3266
+ },
3267
+ {
3268
+ "type": "empty-state",
3269
+ "icon": "wrench",
3270
+ "title": "Nothing open",
3271
+ "description": "Click Open to view details in a modal overlay."
3272
+ }
3273
+ ]
3274
+ }
3275
+ ],
3276
+ [
3277
+ "notify",
3278
+ "AgentToolLoop created successfully"
3279
+ ]
3280
+ ]
3281
+ }
3282
+ ]
3283
+ }
3284
+ },
3285
+ {
3286
+ "name": "ToolLoopContextMonitor",
3287
+ "linkedEntity": "AgentToolLoop",
3288
+ "category": "interaction",
3289
+ "stateMachine": {
3290
+ "states": [
3291
+ {
3292
+ "name": "normal",
3293
+ "isInitial": true
3294
+ },
3295
+ {
3296
+ "name": "warning"
3297
+ },
3298
+ {
3299
+ "name": "critical"
3300
+ }
3301
+ ],
3302
+ "events": [
3303
+ {
3304
+ "key": "INIT",
3305
+ "name": "Initialize"
3306
+ },
3307
+ {
3308
+ "key": "UPDATE",
3309
+ "name": "Update Token Count",
3310
+ "payload": [
3311
+ {
3312
+ "name": "current",
3313
+ "type": "number",
3314
+ "required": true
3315
+ }
3316
+ ]
3317
+ },
3318
+ {
3319
+ "key": "COMPACT",
3320
+ "name": "Compact Context"
3321
+ },
3322
+ {
3323
+ "key": "RESET",
3324
+ "name": "Reset Gauge"
3325
+ }
3326
+ ],
3327
+ "transitions": [
3328
+ {
3329
+ "from": "normal",
3330
+ "to": "normal",
3331
+ "event": "INIT",
3332
+ "effects": [
3333
+ [
3334
+ "fetch",
3335
+ "AgentToolLoop"
3336
+ ],
3337
+ [
3338
+ "render-ui",
3339
+ "main",
3340
+ {
3341
+ "type": "stack",
3342
+ "direction": "vertical",
3343
+ "gap": "lg",
3344
+ "children": [
3345
+ {
3346
+ "type": "stack",
3347
+ "direction": "horizontal",
3348
+ "gap": "sm",
3349
+ "align": "center",
3350
+ "children": [
3351
+ {
3352
+ "type": "icon",
3353
+ "name": "gauge",
3354
+ "size": "lg"
3355
+ },
3356
+ {
3357
+ "type": "typography",
3358
+ "content": "Token Usage",
3359
+ "variant": "h2"
3360
+ },
3361
+ {
3362
+ "type": "badge",
3363
+ "label": "Normal",
3364
+ "variant": "default"
3365
+ }
3366
+ ]
3367
+ },
3368
+ {
3369
+ "type": "divider"
3370
+ },
3371
+ {
3372
+ "type": "progress-bar",
3373
+ "value": "@entity.current",
3374
+ "max": "@entity.max"
3375
+ },
3376
+ {
3377
+ "type": "stack",
3378
+ "direction": "horizontal",
3379
+ "gap": "md",
3380
+ "children": [
3381
+ {
3382
+ "type": "stat-display",
3383
+ "label": "Tokens Used",
3384
+ "value": "@entity.current"
3385
+ },
3386
+ {
3387
+ "type": "stat-display",
3388
+ "label": "Max Tokens",
3389
+ "value": "@entity.max"
3390
+ }
3391
+ ]
3392
+ },
3393
+ {
3394
+ "type": "button",
3395
+ "label": "Reset",
3396
+ "event": "RESET",
3397
+ "variant": "ghost",
3398
+ "icon": "rotate-ccw"
3399
+ }
3400
+ ]
3401
+ }
3402
+ ]
3403
+ ]
3404
+ },
3405
+ {
3406
+ "from": "normal",
3407
+ "to": "normal",
3408
+ "event": "UPDATE",
3409
+ "guard": [
3410
+ "<",
3411
+ [
3412
+ "/",
3413
+ "@payload.current",
3414
+ "@entity.max"
3415
+ ],
3416
+ 0.85
3417
+ ],
3418
+ "effects": [
3419
+ [
3420
+ "set",
3421
+ "@entity.current",
3422
+ "@payload.current"
3423
+ ],
3424
+ [
3425
+ "render-ui",
3426
+ "main",
3427
+ {
3428
+ "type": "stack",
3429
+ "direction": "vertical",
3430
+ "gap": "lg",
3431
+ "children": [
3432
+ {
3433
+ "type": "stack",
3434
+ "direction": "horizontal",
3435
+ "gap": "sm",
3436
+ "align": "center",
3437
+ "children": [
3438
+ {
3439
+ "type": "icon",
3440
+ "name": "gauge",
3441
+ "size": "lg"
3442
+ },
3443
+ {
3444
+ "type": "typography",
3445
+ "content": "Token Usage",
3446
+ "variant": "h2"
3447
+ },
3448
+ {
3449
+ "type": "badge",
3450
+ "label": "Normal",
3451
+ "variant": "default"
3452
+ }
3453
+ ]
3454
+ },
3455
+ {
3456
+ "type": "divider"
3457
+ },
3458
+ {
3459
+ "type": "progress-bar",
3460
+ "value": "@entity.current",
3461
+ "max": "@entity.max"
3462
+ },
3463
+ {
3464
+ "type": "stack",
3465
+ "direction": "horizontal",
3466
+ "gap": "md",
3467
+ "children": [
3468
+ {
3469
+ "type": "stat-display",
3470
+ "label": "Tokens Used",
3471
+ "value": "@entity.current"
3472
+ },
3473
+ {
3474
+ "type": "stat-display",
3475
+ "label": "Max Tokens",
3476
+ "value": "@entity.max"
3477
+ }
3478
+ ]
3479
+ },
3480
+ {
3481
+ "type": "button",
3482
+ "label": "Reset",
3483
+ "event": "RESET",
3484
+ "variant": "ghost",
3485
+ "icon": "rotate-ccw"
3486
+ }
3487
+ ]
3488
+ }
3489
+ ]
3490
+ ]
3491
+ },
3492
+ {
3493
+ "from": "normal",
3494
+ "to": "warning",
3495
+ "event": "UPDATE",
3496
+ "guard": [
3497
+ "and",
3498
+ [
3499
+ ">=",
3500
+ [
3501
+ "/",
3502
+ "@payload.current",
3503
+ "@entity.max"
3504
+ ],
3505
+ 0.85
3506
+ ],
3507
+ [
3508
+ "<",
3509
+ [
3510
+ "/",
3511
+ "@payload.current",
3512
+ "@entity.max"
3513
+ ],
3514
+ 0.95
3515
+ ]
3516
+ ],
3517
+ "effects": [
3518
+ [
3519
+ "set",
3520
+ "@entity.current",
3521
+ "@payload.current"
3522
+ ],
3523
+ [
3524
+ "render-ui",
3525
+ "main",
3526
+ {
3527
+ "type": "stack",
3528
+ "direction": "vertical",
3529
+ "gap": "lg",
3530
+ "children": [
3531
+ {
3532
+ "type": "stack",
3533
+ "direction": "horizontal",
3534
+ "gap": "sm",
3535
+ "align": "center",
3536
+ "children": [
3537
+ {
3538
+ "type": "icon",
3539
+ "name": "alert-triangle",
3540
+ "size": "lg"
3541
+ },
3542
+ {
3543
+ "type": "typography",
3544
+ "content": "Token Usage",
3545
+ "variant": "h2"
3546
+ },
3547
+ {
3548
+ "type": "badge",
3549
+ "label": "Warning",
3550
+ "variant": "warning"
3551
+ }
3552
+ ]
3553
+ },
3554
+ {
3555
+ "type": "divider"
3556
+ },
3557
+ {
3558
+ "type": "alert",
3559
+ "variant": "warning",
3560
+ "message": "Token usage approaching limit. Consider compacting."
3561
+ },
3562
+ {
3563
+ "type": "progress-bar",
3564
+ "value": "@entity.current",
3565
+ "max": "@entity.max"
3566
+ },
3567
+ {
3568
+ "type": "stack",
3569
+ "direction": "horizontal",
3570
+ "gap": "md",
3571
+ "children": [
3572
+ {
3573
+ "type": "stat-display",
3574
+ "label": "Tokens Used",
3575
+ "value": "@entity.current"
3576
+ },
3577
+ {
3578
+ "type": "stat-display",
3579
+ "label": "Max Tokens",
3580
+ "value": "@entity.max"
3581
+ }
3582
+ ]
3583
+ },
3584
+ {
3585
+ "type": "stack",
3586
+ "direction": "horizontal",
3587
+ "gap": "sm",
3588
+ "children": [
3589
+ {
3590
+ "type": "button",
3591
+ "label": "Compact",
3592
+ "event": "COMPACT",
3593
+ "variant": "primary",
3594
+ "icon": "minimize-2"
3595
+ },
3596
+ {
3597
+ "type": "button",
3598
+ "label": "Reset",
3599
+ "event": "RESET",
3600
+ "variant": "ghost",
3601
+ "icon": "rotate-ccw"
3602
+ }
3603
+ ]
3604
+ }
3605
+ ]
3606
+ }
3607
+ ]
3608
+ ]
3609
+ },
3610
+ {
3611
+ "from": "normal",
3612
+ "to": "critical",
3613
+ "event": "UPDATE",
3614
+ "guard": [
3615
+ ">=",
3616
+ [
3617
+ "/",
3618
+ "@payload.current",
3619
+ "@entity.max"
3620
+ ],
3621
+ 0.95
3622
+ ],
3623
+ "effects": [
3624
+ [
3625
+ "set",
3626
+ "@entity.current",
3627
+ "@payload.current"
3628
+ ],
3629
+ [
3630
+ "render-ui",
3631
+ "main",
3632
+ {
3633
+ "type": "stack",
3634
+ "direction": "vertical",
3635
+ "gap": "lg",
3636
+ "children": [
3637
+ {
3638
+ "type": "stack",
3639
+ "direction": "horizontal",
3640
+ "gap": "sm",
3641
+ "align": "center",
3642
+ "children": [
3643
+ {
3644
+ "type": "icon",
3645
+ "name": "alert-octagon",
3646
+ "size": "lg"
3647
+ },
3648
+ {
3649
+ "type": "typography",
3650
+ "content": "Token Usage",
3651
+ "variant": "h2"
3652
+ },
3653
+ {
3654
+ "type": "badge",
3655
+ "label": "Critical",
3656
+ "variant": "destructive"
3657
+ }
3658
+ ]
3659
+ },
3660
+ {
3661
+ "type": "divider"
3662
+ },
3663
+ {
3664
+ "type": "alert",
3665
+ "variant": "error",
3666
+ "message": "Token usage critical. Compact immediately to avoid truncation."
3667
+ },
3668
+ {
3669
+ "type": "progress-bar",
3670
+ "value": "@entity.current",
3671
+ "max": "@entity.max"
3672
+ },
3673
+ {
3674
+ "type": "stack",
3675
+ "direction": "horizontal",
3676
+ "gap": "md",
3677
+ "children": [
3678
+ {
3679
+ "type": "stat-display",
3680
+ "label": "Tokens Used",
3681
+ "value": "@entity.current"
3682
+ },
3683
+ {
3684
+ "type": "stat-display",
3685
+ "label": "Max Tokens",
3686
+ "value": "@entity.max"
3687
+ }
3688
+ ]
3689
+ },
3690
+ {
3691
+ "type": "stack",
3692
+ "direction": "horizontal",
3693
+ "gap": "sm",
3694
+ "children": [
3695
+ {
3696
+ "type": "button",
3697
+ "label": "Compact Now",
3698
+ "event": "COMPACT",
3699
+ "variant": "primary",
3700
+ "icon": "minimize-2"
3701
+ },
3702
+ {
3703
+ "type": "button",
3704
+ "label": "Reset",
3705
+ "event": "RESET",
3706
+ "variant": "ghost",
3707
+ "icon": "rotate-ccw"
3708
+ }
3709
+ ]
3710
+ }
3711
+ ]
3712
+ }
3713
+ ]
3714
+ ]
3715
+ },
3716
+ {
3717
+ "from": "warning",
3718
+ "to": "warning",
3719
+ "event": "UPDATE",
3720
+ "guard": [
3721
+ "and",
3722
+ [
3723
+ ">=",
3724
+ [
3725
+ "/",
3726
+ "@payload.current",
3727
+ "@entity.max"
3728
+ ],
3729
+ 0.85
3730
+ ],
3731
+ [
3732
+ "<",
3733
+ [
3734
+ "/",
3735
+ "@payload.current",
3736
+ "@entity.max"
3737
+ ],
3738
+ 0.95
3739
+ ]
3740
+ ],
3741
+ "effects": [
3742
+ [
3743
+ "set",
3744
+ "@entity.current",
3745
+ "@payload.current"
3746
+ ],
3747
+ [
3748
+ "render-ui",
3749
+ "main",
3750
+ {
3751
+ "type": "stack",
3752
+ "direction": "vertical",
3753
+ "gap": "lg",
3754
+ "children": [
3755
+ {
3756
+ "type": "stack",
3757
+ "direction": "horizontal",
3758
+ "gap": "sm",
3759
+ "align": "center",
3760
+ "children": [
3761
+ {
3762
+ "type": "icon",
3763
+ "name": "alert-triangle",
3764
+ "size": "lg"
3765
+ },
3766
+ {
3767
+ "type": "typography",
3768
+ "content": "Token Usage",
3769
+ "variant": "h2"
3770
+ },
3771
+ {
3772
+ "type": "badge",
3773
+ "label": "Warning",
3774
+ "variant": "warning"
3775
+ }
3776
+ ]
3777
+ },
3778
+ {
3779
+ "type": "divider"
3780
+ },
3781
+ {
3782
+ "type": "alert",
3783
+ "variant": "warning",
3784
+ "message": "Token usage approaching limit. Consider compacting."
3785
+ },
3786
+ {
3787
+ "type": "progress-bar",
3788
+ "value": "@entity.current",
3789
+ "max": "@entity.max"
3790
+ },
3791
+ {
3792
+ "type": "stack",
3793
+ "direction": "horizontal",
3794
+ "gap": "md",
3795
+ "children": [
3796
+ {
3797
+ "type": "stat-display",
3798
+ "label": "Tokens Used",
3799
+ "value": "@entity.current"
3800
+ },
3801
+ {
3802
+ "type": "stat-display",
3803
+ "label": "Max Tokens",
3804
+ "value": "@entity.max"
3805
+ }
3806
+ ]
3807
+ },
3808
+ {
3809
+ "type": "stack",
3810
+ "direction": "horizontal",
3811
+ "gap": "sm",
3812
+ "children": [
3813
+ {
3814
+ "type": "button",
3815
+ "label": "Compact",
3816
+ "event": "COMPACT",
3817
+ "variant": "primary",
3818
+ "icon": "minimize-2"
3819
+ },
3820
+ {
3821
+ "type": "button",
3822
+ "label": "Reset",
3823
+ "event": "RESET",
3824
+ "variant": "ghost",
3825
+ "icon": "rotate-ccw"
3826
+ }
3827
+ ]
3828
+ }
3829
+ ]
3830
+ }
3831
+ ]
3832
+ ]
3833
+ },
3834
+ {
3835
+ "from": "warning",
3836
+ "to": "critical",
3837
+ "event": "UPDATE",
3838
+ "guard": [
3839
+ ">=",
3840
+ [
3841
+ "/",
3842
+ "@payload.current",
3843
+ "@entity.max"
3844
+ ],
3845
+ 0.95
3846
+ ],
3847
+ "effects": [
3848
+ [
3849
+ "set",
3850
+ "@entity.current",
3851
+ "@payload.current"
3852
+ ],
3853
+ [
3854
+ "render-ui",
3855
+ "main",
3856
+ {
3857
+ "type": "stack",
3858
+ "direction": "vertical",
3859
+ "gap": "lg",
3860
+ "children": [
3861
+ {
3862
+ "type": "stack",
3863
+ "direction": "horizontal",
3864
+ "gap": "sm",
3865
+ "align": "center",
3866
+ "children": [
3867
+ {
3868
+ "type": "icon",
3869
+ "name": "alert-octagon",
3870
+ "size": "lg"
3871
+ },
3872
+ {
3873
+ "type": "typography",
3874
+ "content": "Token Usage",
3875
+ "variant": "h2"
3876
+ },
3877
+ {
3878
+ "type": "badge",
3879
+ "label": "Critical",
3880
+ "variant": "destructive"
3881
+ }
3882
+ ]
3883
+ },
3884
+ {
3885
+ "type": "divider"
3886
+ },
3887
+ {
3888
+ "type": "alert",
3889
+ "variant": "error",
3890
+ "message": "Token usage critical. Compact immediately to avoid truncation."
3891
+ },
3892
+ {
3893
+ "type": "progress-bar",
3894
+ "value": "@entity.current",
3895
+ "max": "@entity.max"
3896
+ },
3897
+ {
3898
+ "type": "stack",
3899
+ "direction": "horizontal",
3900
+ "gap": "md",
3901
+ "children": [
3902
+ {
3903
+ "type": "stat-display",
3904
+ "label": "Tokens Used",
3905
+ "value": "@entity.current"
3906
+ },
3907
+ {
3908
+ "type": "stat-display",
3909
+ "label": "Max Tokens",
3910
+ "value": "@entity.max"
3911
+ }
3912
+ ]
3913
+ },
3914
+ {
3915
+ "type": "stack",
3916
+ "direction": "horizontal",
3917
+ "gap": "sm",
3918
+ "children": [
3919
+ {
3920
+ "type": "button",
3921
+ "label": "Compact Now",
3922
+ "event": "COMPACT",
3923
+ "variant": "primary",
3924
+ "icon": "minimize-2"
3925
+ },
3926
+ {
3927
+ "type": "button",
3928
+ "label": "Reset",
3929
+ "event": "RESET",
3930
+ "variant": "ghost",
3931
+ "icon": "rotate-ccw"
3932
+ }
3933
+ ]
3934
+ }
3935
+ ]
3936
+ }
3937
+ ]
3938
+ ]
3939
+ },
3940
+ {
3941
+ "from": "warning",
3942
+ "to": "normal",
3943
+ "event": "UPDATE",
3944
+ "guard": [
3945
+ "<",
3946
+ [
3947
+ "/",
3948
+ "@payload.current",
3949
+ "@entity.max"
3950
+ ],
3951
+ 0.85
3952
+ ],
3953
+ "effects": [
3954
+ [
3955
+ "set",
3956
+ "@entity.current",
3957
+ "@payload.current"
3958
+ ],
3959
+ [
3960
+ "render-ui",
3961
+ "main",
3962
+ {
3963
+ "type": "stack",
3964
+ "direction": "vertical",
3965
+ "gap": "lg",
3966
+ "children": [
3967
+ {
3968
+ "type": "stack",
3969
+ "direction": "horizontal",
3970
+ "gap": "sm",
3971
+ "align": "center",
3972
+ "children": [
3973
+ {
3974
+ "type": "icon",
3975
+ "name": "gauge",
3976
+ "size": "lg"
3977
+ },
3978
+ {
3979
+ "type": "typography",
3980
+ "content": "Token Usage",
3981
+ "variant": "h2"
3982
+ },
3983
+ {
3984
+ "type": "badge",
3985
+ "label": "Normal",
3986
+ "variant": "default"
3987
+ }
3988
+ ]
3989
+ },
3990
+ {
3991
+ "type": "divider"
3992
+ },
3993
+ {
3994
+ "type": "progress-bar",
3995
+ "value": "@entity.current",
3996
+ "max": "@entity.max"
3997
+ },
3998
+ {
3999
+ "type": "stack",
4000
+ "direction": "horizontal",
4001
+ "gap": "md",
4002
+ "children": [
4003
+ {
4004
+ "type": "stat-display",
4005
+ "label": "Tokens Used",
4006
+ "value": "@entity.current"
4007
+ },
4008
+ {
4009
+ "type": "stat-display",
4010
+ "label": "Max Tokens",
4011
+ "value": "@entity.max"
4012
+ }
4013
+ ]
4014
+ },
4015
+ {
4016
+ "type": "button",
4017
+ "label": "Reset",
4018
+ "event": "RESET",
4019
+ "variant": "ghost",
4020
+ "icon": "rotate-ccw"
4021
+ }
4022
+ ]
4023
+ }
4024
+ ]
4025
+ ]
4026
+ },
4027
+ {
4028
+ "from": "critical",
4029
+ "to": "critical",
4030
+ "event": "UPDATE",
4031
+ "guard": [
4032
+ ">=",
4033
+ [
4034
+ "/",
4035
+ "@payload.current",
4036
+ "@entity.max"
4037
+ ],
4038
+ 0.95
4039
+ ],
4040
+ "effects": [
4041
+ [
4042
+ "set",
4043
+ "@entity.current",
4044
+ "@payload.current"
4045
+ ],
4046
+ [
4047
+ "render-ui",
4048
+ "main",
4049
+ {
4050
+ "type": "stack",
4051
+ "direction": "vertical",
4052
+ "gap": "lg",
4053
+ "children": [
4054
+ {
4055
+ "type": "stack",
4056
+ "direction": "horizontal",
4057
+ "gap": "sm",
4058
+ "align": "center",
4059
+ "children": [
4060
+ {
4061
+ "type": "icon",
4062
+ "name": "alert-octagon",
4063
+ "size": "lg"
4064
+ },
4065
+ {
4066
+ "type": "typography",
4067
+ "content": "Token Usage",
4068
+ "variant": "h2"
4069
+ },
4070
+ {
4071
+ "type": "badge",
4072
+ "label": "Critical",
4073
+ "variant": "destructive"
4074
+ }
4075
+ ]
4076
+ },
4077
+ {
4078
+ "type": "divider"
4079
+ },
4080
+ {
4081
+ "type": "alert",
4082
+ "variant": "error",
4083
+ "message": "Token usage critical. Compact immediately to avoid truncation."
4084
+ },
4085
+ {
4086
+ "type": "progress-bar",
4087
+ "value": "@entity.current",
4088
+ "max": "@entity.max"
4089
+ },
4090
+ {
4091
+ "type": "stack",
4092
+ "direction": "horizontal",
4093
+ "gap": "md",
4094
+ "children": [
4095
+ {
4096
+ "type": "stat-display",
4097
+ "label": "Tokens Used",
4098
+ "value": "@entity.current"
4099
+ },
4100
+ {
4101
+ "type": "stat-display",
4102
+ "label": "Max Tokens",
4103
+ "value": "@entity.max"
4104
+ }
4105
+ ]
4106
+ },
4107
+ {
4108
+ "type": "stack",
4109
+ "direction": "horizontal",
4110
+ "gap": "sm",
4111
+ "children": [
4112
+ {
4113
+ "type": "button",
4114
+ "label": "Compact Now",
4115
+ "event": "COMPACT",
4116
+ "variant": "primary",
4117
+ "icon": "minimize-2"
4118
+ },
4119
+ {
4120
+ "type": "button",
4121
+ "label": "Reset",
4122
+ "event": "RESET",
4123
+ "variant": "ghost",
4124
+ "icon": "rotate-ccw"
4125
+ }
4126
+ ]
4127
+ }
4128
+ ]
4129
+ }
4130
+ ]
4131
+ ]
4132
+ },
4133
+ {
4134
+ "from": "critical",
4135
+ "to": "warning",
4136
+ "event": "UPDATE",
4137
+ "guard": [
4138
+ "and",
4139
+ [
4140
+ ">=",
4141
+ [
4142
+ "/",
4143
+ "@payload.current",
4144
+ "@entity.max"
4145
+ ],
4146
+ 0.85
4147
+ ],
4148
+ [
4149
+ "<",
4150
+ [
4151
+ "/",
4152
+ "@payload.current",
4153
+ "@entity.max"
4154
+ ],
4155
+ 0.95
4156
+ ]
4157
+ ],
4158
+ "effects": [
4159
+ [
4160
+ "set",
4161
+ "@entity.current",
4162
+ "@payload.current"
4163
+ ],
4164
+ [
4165
+ "render-ui",
4166
+ "main",
4167
+ {
4168
+ "type": "stack",
4169
+ "direction": "vertical",
4170
+ "gap": "lg",
4171
+ "children": [
4172
+ {
4173
+ "type": "stack",
4174
+ "direction": "horizontal",
4175
+ "gap": "sm",
4176
+ "align": "center",
4177
+ "children": [
4178
+ {
4179
+ "type": "icon",
4180
+ "name": "alert-triangle",
4181
+ "size": "lg"
4182
+ },
4183
+ {
4184
+ "type": "typography",
4185
+ "content": "Token Usage",
4186
+ "variant": "h2"
4187
+ },
4188
+ {
4189
+ "type": "badge",
4190
+ "label": "Warning",
4191
+ "variant": "warning"
4192
+ }
4193
+ ]
4194
+ },
4195
+ {
4196
+ "type": "divider"
4197
+ },
4198
+ {
4199
+ "type": "alert",
4200
+ "variant": "warning",
4201
+ "message": "Token usage approaching limit. Consider compacting."
4202
+ },
4203
+ {
4204
+ "type": "progress-bar",
4205
+ "value": "@entity.current",
4206
+ "max": "@entity.max"
4207
+ },
4208
+ {
4209
+ "type": "stack",
4210
+ "direction": "horizontal",
4211
+ "gap": "md",
4212
+ "children": [
4213
+ {
4214
+ "type": "stat-display",
4215
+ "label": "Tokens Used",
4216
+ "value": "@entity.current"
4217
+ },
4218
+ {
4219
+ "type": "stat-display",
4220
+ "label": "Max Tokens",
4221
+ "value": "@entity.max"
4222
+ }
4223
+ ]
4224
+ },
4225
+ {
4226
+ "type": "stack",
4227
+ "direction": "horizontal",
4228
+ "gap": "sm",
4229
+ "children": [
4230
+ {
4231
+ "type": "button",
4232
+ "label": "Compact",
4233
+ "event": "COMPACT",
4234
+ "variant": "primary",
4235
+ "icon": "minimize-2"
4236
+ },
4237
+ {
4238
+ "type": "button",
4239
+ "label": "Reset",
4240
+ "event": "RESET",
4241
+ "variant": "ghost",
4242
+ "icon": "rotate-ccw"
4243
+ }
4244
+ ]
4245
+ }
4246
+ ]
4247
+ }
4248
+ ]
4249
+ ]
4250
+ },
4251
+ {
4252
+ "from": "critical",
4253
+ "to": "normal",
4254
+ "event": "UPDATE",
4255
+ "guard": [
4256
+ "<",
4257
+ [
4258
+ "/",
4259
+ "@payload.current",
4260
+ "@entity.max"
4261
+ ],
4262
+ 0.85
4263
+ ],
4264
+ "effects": [
4265
+ [
4266
+ "set",
4267
+ "@entity.current",
4268
+ "@payload.current"
4269
+ ],
4270
+ [
4271
+ "render-ui",
4272
+ "main",
4273
+ {
4274
+ "type": "stack",
4275
+ "direction": "vertical",
4276
+ "gap": "lg",
4277
+ "children": [
4278
+ {
4279
+ "type": "stack",
4280
+ "direction": "horizontal",
4281
+ "gap": "sm",
4282
+ "align": "center",
4283
+ "children": [
4284
+ {
4285
+ "type": "icon",
4286
+ "name": "gauge",
4287
+ "size": "lg"
4288
+ },
4289
+ {
4290
+ "type": "typography",
4291
+ "content": "Token Usage",
4292
+ "variant": "h2"
4293
+ },
4294
+ {
4295
+ "type": "badge",
4296
+ "label": "Normal",
4297
+ "variant": "default"
4298
+ }
4299
+ ]
4300
+ },
4301
+ {
4302
+ "type": "divider"
4303
+ },
4304
+ {
4305
+ "type": "progress-bar",
4306
+ "value": "@entity.current",
4307
+ "max": "@entity.max"
4308
+ },
4309
+ {
4310
+ "type": "stack",
4311
+ "direction": "horizontal",
4312
+ "gap": "md",
4313
+ "children": [
4314
+ {
4315
+ "type": "stat-display",
4316
+ "label": "Tokens Used",
4317
+ "value": "@entity.current"
4318
+ },
4319
+ {
4320
+ "type": "stat-display",
4321
+ "label": "Max Tokens",
4322
+ "value": "@entity.max"
4323
+ }
4324
+ ]
4325
+ },
4326
+ {
4327
+ "type": "button",
4328
+ "label": "Reset",
4329
+ "event": "RESET",
4330
+ "variant": "ghost",
4331
+ "icon": "rotate-ccw"
4332
+ }
4333
+ ]
4334
+ }
4335
+ ]
4336
+ ]
4337
+ },
4338
+ {
4339
+ "from": "normal",
4340
+ "to": "normal",
4341
+ "event": "COMPACT",
4342
+ "effects": [
4343
+ [
4344
+ "agent/compact"
4345
+ ],
4346
+ [
4347
+ "set",
4348
+ "@entity.lastCompactedAt",
4349
+ "@now"
4350
+ ],
4351
+ [
4352
+ "agent/token-count"
4353
+ ],
4354
+ [
4355
+ "render-ui",
4356
+ "main",
4357
+ {
4358
+ "type": "stack",
4359
+ "direction": "vertical",
4360
+ "gap": "lg",
4361
+ "children": [
4362
+ {
4363
+ "type": "stack",
4364
+ "direction": "horizontal",
4365
+ "gap": "sm",
4366
+ "align": "center",
4367
+ "children": [
4368
+ {
4369
+ "type": "icon",
4370
+ "name": "gauge",
4371
+ "size": "lg"
4372
+ },
4373
+ {
4374
+ "type": "typography",
4375
+ "content": "Token Usage",
4376
+ "variant": "h2"
4377
+ },
4378
+ {
4379
+ "type": "badge",
4380
+ "label": "Normal",
4381
+ "variant": "default"
4382
+ }
4383
+ ]
4384
+ },
4385
+ {
4386
+ "type": "divider"
4387
+ },
4388
+ {
4389
+ "type": "progress-bar",
4390
+ "value": "@entity.current",
4391
+ "max": "@entity.max"
4392
+ },
4393
+ {
4394
+ "type": "stack",
4395
+ "direction": "horizontal",
4396
+ "gap": "md",
4397
+ "children": [
4398
+ {
4399
+ "type": "stat-display",
4400
+ "label": "Tokens Used",
4401
+ "value": "@entity.current"
4402
+ },
4403
+ {
4404
+ "type": "stat-display",
4405
+ "label": "Max Tokens",
4406
+ "value": "@entity.max"
4407
+ }
4408
+ ]
4409
+ },
4410
+ {
4411
+ "type": "button",
4412
+ "label": "Reset",
4413
+ "event": "RESET",
4414
+ "variant": "ghost",
4415
+ "icon": "rotate-ccw"
4416
+ }
4417
+ ]
4418
+ }
4419
+ ]
4420
+ ]
4421
+ },
4422
+ {
4423
+ "from": "warning",
4424
+ "to": "normal",
4425
+ "event": "COMPACT",
4426
+ "effects": [
4427
+ [
4428
+ "agent/compact"
4429
+ ],
4430
+ [
4431
+ "set",
4432
+ "@entity.lastCompactedAt",
4433
+ "@now"
4434
+ ],
4435
+ [
4436
+ "agent/token-count"
4437
+ ],
4438
+ [
4439
+ "render-ui",
4440
+ "main",
4441
+ {
4442
+ "type": "stack",
4443
+ "direction": "vertical",
4444
+ "gap": "lg",
4445
+ "children": [
4446
+ {
4447
+ "type": "stack",
4448
+ "direction": "horizontal",
4449
+ "gap": "sm",
4450
+ "align": "center",
4451
+ "children": [
4452
+ {
4453
+ "type": "icon",
4454
+ "name": "gauge",
4455
+ "size": "lg"
4456
+ },
4457
+ {
4458
+ "type": "typography",
4459
+ "content": "Token Usage",
4460
+ "variant": "h2"
4461
+ },
4462
+ {
4463
+ "type": "badge",
4464
+ "label": "Normal",
4465
+ "variant": "default"
4466
+ }
4467
+ ]
4468
+ },
4469
+ {
4470
+ "type": "divider"
4471
+ },
4472
+ {
4473
+ "type": "progress-bar",
4474
+ "value": "@entity.current",
4475
+ "max": "@entity.max"
4476
+ },
4477
+ {
4478
+ "type": "stack",
4479
+ "direction": "horizontal",
4480
+ "gap": "md",
4481
+ "children": [
4482
+ {
4483
+ "type": "stat-display",
4484
+ "label": "Tokens Used",
4485
+ "value": "@entity.current"
4486
+ },
4487
+ {
4488
+ "type": "stat-display",
4489
+ "label": "Max Tokens",
4490
+ "value": "@entity.max"
4491
+ }
4492
+ ]
4493
+ },
4494
+ {
4495
+ "type": "button",
4496
+ "label": "Reset",
4497
+ "event": "RESET",
4498
+ "variant": "ghost",
4499
+ "icon": "rotate-ccw"
4500
+ }
4501
+ ]
4502
+ }
4503
+ ]
4504
+ ]
4505
+ },
4506
+ {
4507
+ "from": "critical",
4508
+ "to": "normal",
4509
+ "event": "COMPACT",
4510
+ "effects": [
4511
+ [
4512
+ "agent/compact"
4513
+ ],
4514
+ [
4515
+ "set",
4516
+ "@entity.lastCompactedAt",
4517
+ "@now"
4518
+ ],
4519
+ [
4520
+ "agent/token-count"
4521
+ ],
4522
+ [
4523
+ "render-ui",
4524
+ "main",
4525
+ {
4526
+ "type": "stack",
4527
+ "direction": "vertical",
4528
+ "gap": "lg",
4529
+ "children": [
4530
+ {
4531
+ "type": "stack",
4532
+ "direction": "horizontal",
4533
+ "gap": "sm",
4534
+ "align": "center",
4535
+ "children": [
4536
+ {
4537
+ "type": "icon",
4538
+ "name": "gauge",
4539
+ "size": "lg"
4540
+ },
4541
+ {
4542
+ "type": "typography",
4543
+ "content": "Token Usage",
4544
+ "variant": "h2"
4545
+ },
4546
+ {
4547
+ "type": "badge",
4548
+ "label": "Normal",
4549
+ "variant": "default"
4550
+ }
4551
+ ]
4552
+ },
4553
+ {
4554
+ "type": "divider"
4555
+ },
4556
+ {
4557
+ "type": "progress-bar",
4558
+ "value": "@entity.current",
4559
+ "max": "@entity.max"
4560
+ },
4561
+ {
4562
+ "type": "stack",
4563
+ "direction": "horizontal",
4564
+ "gap": "md",
4565
+ "children": [
4566
+ {
4567
+ "type": "stat-display",
4568
+ "label": "Tokens Used",
4569
+ "value": "@entity.current"
4570
+ },
4571
+ {
4572
+ "type": "stat-display",
4573
+ "label": "Max Tokens",
4574
+ "value": "@entity.max"
4575
+ }
4576
+ ]
4577
+ },
4578
+ {
4579
+ "type": "button",
4580
+ "label": "Reset",
4581
+ "event": "RESET",
4582
+ "variant": "ghost",
4583
+ "icon": "rotate-ccw"
4584
+ }
4585
+ ]
4586
+ }
4587
+ ]
4588
+ ]
4589
+ },
4590
+ {
4591
+ "from": "normal",
4592
+ "to": "normal",
4593
+ "event": "RESET",
4594
+ "effects": [
4595
+ [
4596
+ "set",
4597
+ "@entity.current",
4598
+ 0
4599
+ ],
4600
+ [
4601
+ "render-ui",
4602
+ "main",
4603
+ {
4604
+ "type": "stack",
4605
+ "direction": "vertical",
4606
+ "gap": "lg",
4607
+ "children": [
4608
+ {
4609
+ "type": "stack",
4610
+ "direction": "horizontal",
4611
+ "gap": "sm",
4612
+ "align": "center",
4613
+ "children": [
4614
+ {
4615
+ "type": "icon",
4616
+ "name": "gauge",
4617
+ "size": "lg"
4618
+ },
4619
+ {
4620
+ "type": "typography",
4621
+ "content": "Token Usage",
4622
+ "variant": "h2"
4623
+ },
4624
+ {
4625
+ "type": "badge",
4626
+ "label": "Normal",
4627
+ "variant": "default"
4628
+ }
4629
+ ]
4630
+ },
4631
+ {
4632
+ "type": "divider"
4633
+ },
4634
+ {
4635
+ "type": "progress-bar",
4636
+ "value": "@entity.current",
4637
+ "max": "@entity.max"
4638
+ },
4639
+ {
4640
+ "type": "stack",
4641
+ "direction": "horizontal",
4642
+ "gap": "md",
4643
+ "children": [
4644
+ {
4645
+ "type": "stat-display",
4646
+ "label": "Tokens Used",
4647
+ "value": "@entity.current"
4648
+ },
4649
+ {
4650
+ "type": "stat-display",
4651
+ "label": "Max Tokens",
4652
+ "value": "@entity.max"
4653
+ }
4654
+ ]
4655
+ },
4656
+ {
4657
+ "type": "button",
4658
+ "label": "Reset",
4659
+ "event": "RESET",
4660
+ "variant": "ghost",
4661
+ "icon": "rotate-ccw"
4662
+ }
4663
+ ]
4664
+ }
4665
+ ]
4666
+ ]
4667
+ },
4668
+ {
4669
+ "from": "warning",
4670
+ "to": "normal",
4671
+ "event": "RESET",
4672
+ "effects": [
4673
+ [
4674
+ "set",
4675
+ "@entity.current",
4676
+ 0
4677
+ ],
4678
+ [
4679
+ "render-ui",
4680
+ "main",
4681
+ {
4682
+ "type": "stack",
4683
+ "direction": "vertical",
4684
+ "gap": "lg",
4685
+ "children": [
4686
+ {
4687
+ "type": "stack",
4688
+ "direction": "horizontal",
4689
+ "gap": "sm",
4690
+ "align": "center",
4691
+ "children": [
4692
+ {
4693
+ "type": "icon",
4694
+ "name": "gauge",
4695
+ "size": "lg"
4696
+ },
4697
+ {
4698
+ "type": "typography",
4699
+ "content": "Token Usage",
4700
+ "variant": "h2"
4701
+ },
4702
+ {
4703
+ "type": "badge",
4704
+ "label": "Normal",
4705
+ "variant": "default"
4706
+ }
4707
+ ]
4708
+ },
4709
+ {
4710
+ "type": "divider"
4711
+ },
4712
+ {
4713
+ "type": "progress-bar",
4714
+ "value": "@entity.current",
4715
+ "max": "@entity.max"
4716
+ },
4717
+ {
4718
+ "type": "stack",
4719
+ "direction": "horizontal",
4720
+ "gap": "md",
4721
+ "children": [
4722
+ {
4723
+ "type": "stat-display",
4724
+ "label": "Tokens Used",
4725
+ "value": "@entity.current"
4726
+ },
4727
+ {
4728
+ "type": "stat-display",
4729
+ "label": "Max Tokens",
4730
+ "value": "@entity.max"
4731
+ }
4732
+ ]
4733
+ },
4734
+ {
4735
+ "type": "button",
4736
+ "label": "Reset",
4737
+ "event": "RESET",
4738
+ "variant": "ghost",
4739
+ "icon": "rotate-ccw"
4740
+ }
4741
+ ]
4742
+ }
4743
+ ]
4744
+ ]
4745
+ },
4746
+ {
4747
+ "from": "critical",
4748
+ "to": "normal",
4749
+ "event": "RESET",
4750
+ "effects": [
4751
+ [
4752
+ "set",
4753
+ "@entity.current",
4754
+ 0
4755
+ ],
4756
+ [
4757
+ "render-ui",
4758
+ "main",
4759
+ {
4760
+ "type": "stack",
4761
+ "direction": "vertical",
4762
+ "gap": "lg",
4763
+ "children": [
4764
+ {
4765
+ "type": "stack",
4766
+ "direction": "horizontal",
4767
+ "gap": "sm",
4768
+ "align": "center",
4769
+ "children": [
4770
+ {
4771
+ "type": "icon",
4772
+ "name": "gauge",
4773
+ "size": "lg"
4774
+ },
4775
+ {
4776
+ "type": "typography",
4777
+ "content": "Token Usage",
4778
+ "variant": "h2"
4779
+ },
4780
+ {
4781
+ "type": "badge",
4782
+ "label": "Normal",
4783
+ "variant": "default"
4784
+ }
4785
+ ]
4786
+ },
4787
+ {
4788
+ "type": "divider"
4789
+ },
4790
+ {
4791
+ "type": "progress-bar",
4792
+ "value": "@entity.current",
4793
+ "max": "@entity.max"
4794
+ },
4795
+ {
4796
+ "type": "stack",
4797
+ "direction": "horizontal",
4798
+ "gap": "md",
4799
+ "children": [
4800
+ {
4801
+ "type": "stat-display",
4802
+ "label": "Tokens Used",
4803
+ "value": "@entity.current"
4804
+ },
4805
+ {
4806
+ "type": "stat-display",
4807
+ "label": "Max Tokens",
4808
+ "value": "@entity.max"
4809
+ }
4810
+ ]
4811
+ },
4812
+ {
4813
+ "type": "button",
4814
+ "label": "Reset",
4815
+ "event": "RESET",
4816
+ "variant": "ghost",
4817
+ "icon": "rotate-ccw"
4818
+ }
4819
+ ]
4820
+ }
4821
+ ]
4822
+ ]
4823
+ }
4824
+ ]
4825
+ }
4826
+ }
4827
+ ],
4828
+ "pages": [
4829
+ {
4830
+ "name": "AgentToolLoopPage",
4831
+ "path": "/agenttoolloops",
4832
+ "traits": [
4833
+ {
4834
+ "ref": "AgentToolLoopLoop"
4835
+ },
4836
+ {
4837
+ "ref": "ToolLoopStepProgress"
4838
+ },
4839
+ {
4840
+ "ref": "ToolLoopActivityLog"
4841
+ },
4842
+ {
4843
+ "ref": "ToolLoopCompletionFlow"
4844
+ },
4845
+ {
4846
+ "ref": "ToolLoopToolCallFlow"
4847
+ },
4848
+ {
4849
+ "ref": "ToolLoopContextMonitor"
1230
4850
  }
1231
4851
  ]
1232
4852
  }
1233
4853
  ]
1234
4854
  }
1235
4855
  ],
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"
4856
+ "description": "Composes agent atoms + UI atoms into an iterative tool-use loop with step progress tracking and activity logging. The agent generates a plan, invokes tools to execute steps, checks results, and either loops or finishes. Composed atoms: - stdAgentCompletion: LLM plan generation and result checking - stdAgentToolCall: tool invocation with argument passing - stdAgentContextWindow: context window monitoring and compaction - stdAgentStepProgress: visual pipeline step indicator - stdAgentActivityLog: chronological action timeline"
1237
4857
  }