@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
@@ -0,0 +1,1616 @@
1
+ {
2
+ "name": "AgentTokenGaugeOrbital",
3
+ "orbitals": [
4
+ {
5
+ "name": "AgentTokenGaugeOrbital",
6
+ "entity": {
7
+ "name": "AgentTokenGauge",
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": "current",
38
+ "type": "number",
39
+ "default": 0
40
+ },
41
+ {
42
+ "name": "max",
43
+ "type": "number",
44
+ "default": 180000
45
+ },
46
+ {
47
+ "name": "threshold",
48
+ "type": "number",
49
+ "default": 0.85
50
+ },
51
+ {
52
+ "name": "lastCompactedAt",
53
+ "type": "string",
54
+ "default": ""
55
+ }
56
+ ]
57
+ },
58
+ "traits": [
59
+ {
60
+ "name": "AgentTokenGaugeGauge",
61
+ "linkedEntity": "AgentTokenGauge",
62
+ "category": "interaction",
63
+ "stateMachine": {
64
+ "states": [
65
+ {
66
+ "name": "normal",
67
+ "isInitial": true
68
+ },
69
+ {
70
+ "name": "warning"
71
+ },
72
+ {
73
+ "name": "critical"
74
+ }
75
+ ],
76
+ "events": [
77
+ {
78
+ "key": "INIT",
79
+ "name": "Initialize"
80
+ },
81
+ {
82
+ "key": "UPDATE",
83
+ "name": "Update Token Count",
84
+ "payload": [
85
+ {
86
+ "name": "current",
87
+ "type": "number",
88
+ "required": true
89
+ }
90
+ ]
91
+ },
92
+ {
93
+ "key": "COMPACT",
94
+ "name": "Compact Context"
95
+ },
96
+ {
97
+ "key": "RESET",
98
+ "name": "Reset Gauge"
99
+ }
100
+ ],
101
+ "transitions": [
102
+ {
103
+ "from": "normal",
104
+ "to": "normal",
105
+ "event": "INIT",
106
+ "effects": [
107
+ [
108
+ "fetch",
109
+ "AgentTokenGauge"
110
+ ],
111
+ [
112
+ "render-ui",
113
+ "main",
114
+ {
115
+ "type": "stack",
116
+ "direction": "vertical",
117
+ "gap": "lg",
118
+ "children": [
119
+ {
120
+ "type": "stack",
121
+ "direction": "horizontal",
122
+ "gap": "sm",
123
+ "align": "center",
124
+ "children": [
125
+ {
126
+ "type": "icon",
127
+ "name": "gauge",
128
+ "size": "lg"
129
+ },
130
+ {
131
+ "type": "typography",
132
+ "content": "Token Usage",
133
+ "variant": "h2"
134
+ },
135
+ {
136
+ "type": "badge",
137
+ "label": "Normal",
138
+ "variant": "default"
139
+ }
140
+ ]
141
+ },
142
+ {
143
+ "type": "divider"
144
+ },
145
+ {
146
+ "type": "progress-bar",
147
+ "value": "@entity.current",
148
+ "max": "@entity.max"
149
+ },
150
+ {
151
+ "type": "stack",
152
+ "direction": "horizontal",
153
+ "gap": "md",
154
+ "children": [
155
+ {
156
+ "type": "stat-display",
157
+ "label": "Tokens Used",
158
+ "value": "@entity.current"
159
+ },
160
+ {
161
+ "type": "stat-display",
162
+ "label": "Max Tokens",
163
+ "value": "@entity.max"
164
+ }
165
+ ]
166
+ },
167
+ {
168
+ "type": "button",
169
+ "label": "Reset",
170
+ "event": "RESET",
171
+ "variant": "ghost",
172
+ "icon": "rotate-ccw"
173
+ }
174
+ ]
175
+ }
176
+ ]
177
+ ]
178
+ },
179
+ {
180
+ "from": "normal",
181
+ "to": "normal",
182
+ "event": "UPDATE",
183
+ "guard": [
184
+ "<",
185
+ [
186
+ "/",
187
+ "@payload.current",
188
+ "@entity.max"
189
+ ],
190
+ 0.85
191
+ ],
192
+ "effects": [
193
+ [
194
+ "set",
195
+ "@entity.current",
196
+ "@payload.current"
197
+ ],
198
+ [
199
+ "render-ui",
200
+ "main",
201
+ {
202
+ "type": "stack",
203
+ "direction": "vertical",
204
+ "gap": "lg",
205
+ "children": [
206
+ {
207
+ "type": "stack",
208
+ "direction": "horizontal",
209
+ "gap": "sm",
210
+ "align": "center",
211
+ "children": [
212
+ {
213
+ "type": "icon",
214
+ "name": "gauge",
215
+ "size": "lg"
216
+ },
217
+ {
218
+ "type": "typography",
219
+ "content": "Token Usage",
220
+ "variant": "h2"
221
+ },
222
+ {
223
+ "type": "badge",
224
+ "label": "Normal",
225
+ "variant": "default"
226
+ }
227
+ ]
228
+ },
229
+ {
230
+ "type": "divider"
231
+ },
232
+ {
233
+ "type": "progress-bar",
234
+ "value": "@entity.current",
235
+ "max": "@entity.max"
236
+ },
237
+ {
238
+ "type": "stack",
239
+ "direction": "horizontal",
240
+ "gap": "md",
241
+ "children": [
242
+ {
243
+ "type": "stat-display",
244
+ "label": "Tokens Used",
245
+ "value": "@entity.current"
246
+ },
247
+ {
248
+ "type": "stat-display",
249
+ "label": "Max Tokens",
250
+ "value": "@entity.max"
251
+ }
252
+ ]
253
+ },
254
+ {
255
+ "type": "button",
256
+ "label": "Reset",
257
+ "event": "RESET",
258
+ "variant": "ghost",
259
+ "icon": "rotate-ccw"
260
+ }
261
+ ]
262
+ }
263
+ ]
264
+ ]
265
+ },
266
+ {
267
+ "from": "normal",
268
+ "to": "warning",
269
+ "event": "UPDATE",
270
+ "guard": [
271
+ "and",
272
+ [
273
+ ">=",
274
+ [
275
+ "/",
276
+ "@payload.current",
277
+ "@entity.max"
278
+ ],
279
+ 0.85
280
+ ],
281
+ [
282
+ "<",
283
+ [
284
+ "/",
285
+ "@payload.current",
286
+ "@entity.max"
287
+ ],
288
+ 0.95
289
+ ]
290
+ ],
291
+ "effects": [
292
+ [
293
+ "set",
294
+ "@entity.current",
295
+ "@payload.current"
296
+ ],
297
+ [
298
+ "render-ui",
299
+ "main",
300
+ {
301
+ "type": "stack",
302
+ "direction": "vertical",
303
+ "gap": "lg",
304
+ "children": [
305
+ {
306
+ "type": "stack",
307
+ "direction": "horizontal",
308
+ "gap": "sm",
309
+ "align": "center",
310
+ "children": [
311
+ {
312
+ "type": "icon",
313
+ "name": "alert-triangle",
314
+ "size": "lg"
315
+ },
316
+ {
317
+ "type": "typography",
318
+ "content": "Token Usage",
319
+ "variant": "h2"
320
+ },
321
+ {
322
+ "type": "badge",
323
+ "label": "Warning",
324
+ "variant": "warning"
325
+ }
326
+ ]
327
+ },
328
+ {
329
+ "type": "divider"
330
+ },
331
+ {
332
+ "type": "alert",
333
+ "variant": "warning",
334
+ "message": "Token usage approaching limit. Consider compacting."
335
+ },
336
+ {
337
+ "type": "progress-bar",
338
+ "value": "@entity.current",
339
+ "max": "@entity.max"
340
+ },
341
+ {
342
+ "type": "stack",
343
+ "direction": "horizontal",
344
+ "gap": "md",
345
+ "children": [
346
+ {
347
+ "type": "stat-display",
348
+ "label": "Tokens Used",
349
+ "value": "@entity.current"
350
+ },
351
+ {
352
+ "type": "stat-display",
353
+ "label": "Max Tokens",
354
+ "value": "@entity.max"
355
+ }
356
+ ]
357
+ },
358
+ {
359
+ "type": "stack",
360
+ "direction": "horizontal",
361
+ "gap": "sm",
362
+ "children": [
363
+ {
364
+ "type": "button",
365
+ "label": "Compact",
366
+ "event": "COMPACT",
367
+ "variant": "primary",
368
+ "icon": "minimize-2"
369
+ },
370
+ {
371
+ "type": "button",
372
+ "label": "Reset",
373
+ "event": "RESET",
374
+ "variant": "ghost",
375
+ "icon": "rotate-ccw"
376
+ }
377
+ ]
378
+ }
379
+ ]
380
+ }
381
+ ]
382
+ ]
383
+ },
384
+ {
385
+ "from": "normal",
386
+ "to": "critical",
387
+ "event": "UPDATE",
388
+ "guard": [
389
+ ">=",
390
+ [
391
+ "/",
392
+ "@payload.current",
393
+ "@entity.max"
394
+ ],
395
+ 0.95
396
+ ],
397
+ "effects": [
398
+ [
399
+ "set",
400
+ "@entity.current",
401
+ "@payload.current"
402
+ ],
403
+ [
404
+ "render-ui",
405
+ "main",
406
+ {
407
+ "type": "stack",
408
+ "direction": "vertical",
409
+ "gap": "lg",
410
+ "children": [
411
+ {
412
+ "type": "stack",
413
+ "direction": "horizontal",
414
+ "gap": "sm",
415
+ "align": "center",
416
+ "children": [
417
+ {
418
+ "type": "icon",
419
+ "name": "alert-octagon",
420
+ "size": "lg"
421
+ },
422
+ {
423
+ "type": "typography",
424
+ "content": "Token Usage",
425
+ "variant": "h2"
426
+ },
427
+ {
428
+ "type": "badge",
429
+ "label": "Critical",
430
+ "variant": "destructive"
431
+ }
432
+ ]
433
+ },
434
+ {
435
+ "type": "divider"
436
+ },
437
+ {
438
+ "type": "alert",
439
+ "variant": "error",
440
+ "message": "Token usage critical. Compact immediately to avoid truncation."
441
+ },
442
+ {
443
+ "type": "progress-bar",
444
+ "value": "@entity.current",
445
+ "max": "@entity.max"
446
+ },
447
+ {
448
+ "type": "stack",
449
+ "direction": "horizontal",
450
+ "gap": "md",
451
+ "children": [
452
+ {
453
+ "type": "stat-display",
454
+ "label": "Tokens Used",
455
+ "value": "@entity.current"
456
+ },
457
+ {
458
+ "type": "stat-display",
459
+ "label": "Max Tokens",
460
+ "value": "@entity.max"
461
+ }
462
+ ]
463
+ },
464
+ {
465
+ "type": "stack",
466
+ "direction": "horizontal",
467
+ "gap": "sm",
468
+ "children": [
469
+ {
470
+ "type": "button",
471
+ "label": "Compact Now",
472
+ "event": "COMPACT",
473
+ "variant": "primary",
474
+ "icon": "minimize-2"
475
+ },
476
+ {
477
+ "type": "button",
478
+ "label": "Reset",
479
+ "event": "RESET",
480
+ "variant": "ghost",
481
+ "icon": "rotate-ccw"
482
+ }
483
+ ]
484
+ }
485
+ ]
486
+ }
487
+ ]
488
+ ]
489
+ },
490
+ {
491
+ "from": "warning",
492
+ "to": "warning",
493
+ "event": "UPDATE",
494
+ "guard": [
495
+ "and",
496
+ [
497
+ ">=",
498
+ [
499
+ "/",
500
+ "@payload.current",
501
+ "@entity.max"
502
+ ],
503
+ 0.85
504
+ ],
505
+ [
506
+ "<",
507
+ [
508
+ "/",
509
+ "@payload.current",
510
+ "@entity.max"
511
+ ],
512
+ 0.95
513
+ ]
514
+ ],
515
+ "effects": [
516
+ [
517
+ "set",
518
+ "@entity.current",
519
+ "@payload.current"
520
+ ],
521
+ [
522
+ "render-ui",
523
+ "main",
524
+ {
525
+ "type": "stack",
526
+ "direction": "vertical",
527
+ "gap": "lg",
528
+ "children": [
529
+ {
530
+ "type": "stack",
531
+ "direction": "horizontal",
532
+ "gap": "sm",
533
+ "align": "center",
534
+ "children": [
535
+ {
536
+ "type": "icon",
537
+ "name": "alert-triangle",
538
+ "size": "lg"
539
+ },
540
+ {
541
+ "type": "typography",
542
+ "content": "Token Usage",
543
+ "variant": "h2"
544
+ },
545
+ {
546
+ "type": "badge",
547
+ "label": "Warning",
548
+ "variant": "warning"
549
+ }
550
+ ]
551
+ },
552
+ {
553
+ "type": "divider"
554
+ },
555
+ {
556
+ "type": "alert",
557
+ "variant": "warning",
558
+ "message": "Token usage approaching limit. Consider compacting."
559
+ },
560
+ {
561
+ "type": "progress-bar",
562
+ "value": "@entity.current",
563
+ "max": "@entity.max"
564
+ },
565
+ {
566
+ "type": "stack",
567
+ "direction": "horizontal",
568
+ "gap": "md",
569
+ "children": [
570
+ {
571
+ "type": "stat-display",
572
+ "label": "Tokens Used",
573
+ "value": "@entity.current"
574
+ },
575
+ {
576
+ "type": "stat-display",
577
+ "label": "Max Tokens",
578
+ "value": "@entity.max"
579
+ }
580
+ ]
581
+ },
582
+ {
583
+ "type": "stack",
584
+ "direction": "horizontal",
585
+ "gap": "sm",
586
+ "children": [
587
+ {
588
+ "type": "button",
589
+ "label": "Compact",
590
+ "event": "COMPACT",
591
+ "variant": "primary",
592
+ "icon": "minimize-2"
593
+ },
594
+ {
595
+ "type": "button",
596
+ "label": "Reset",
597
+ "event": "RESET",
598
+ "variant": "ghost",
599
+ "icon": "rotate-ccw"
600
+ }
601
+ ]
602
+ }
603
+ ]
604
+ }
605
+ ]
606
+ ]
607
+ },
608
+ {
609
+ "from": "warning",
610
+ "to": "critical",
611
+ "event": "UPDATE",
612
+ "guard": [
613
+ ">=",
614
+ [
615
+ "/",
616
+ "@payload.current",
617
+ "@entity.max"
618
+ ],
619
+ 0.95
620
+ ],
621
+ "effects": [
622
+ [
623
+ "set",
624
+ "@entity.current",
625
+ "@payload.current"
626
+ ],
627
+ [
628
+ "render-ui",
629
+ "main",
630
+ {
631
+ "type": "stack",
632
+ "direction": "vertical",
633
+ "gap": "lg",
634
+ "children": [
635
+ {
636
+ "type": "stack",
637
+ "direction": "horizontal",
638
+ "gap": "sm",
639
+ "align": "center",
640
+ "children": [
641
+ {
642
+ "type": "icon",
643
+ "name": "alert-octagon",
644
+ "size": "lg"
645
+ },
646
+ {
647
+ "type": "typography",
648
+ "content": "Token Usage",
649
+ "variant": "h2"
650
+ },
651
+ {
652
+ "type": "badge",
653
+ "label": "Critical",
654
+ "variant": "destructive"
655
+ }
656
+ ]
657
+ },
658
+ {
659
+ "type": "divider"
660
+ },
661
+ {
662
+ "type": "alert",
663
+ "variant": "error",
664
+ "message": "Token usage critical. Compact immediately to avoid truncation."
665
+ },
666
+ {
667
+ "type": "progress-bar",
668
+ "value": "@entity.current",
669
+ "max": "@entity.max"
670
+ },
671
+ {
672
+ "type": "stack",
673
+ "direction": "horizontal",
674
+ "gap": "md",
675
+ "children": [
676
+ {
677
+ "type": "stat-display",
678
+ "label": "Tokens Used",
679
+ "value": "@entity.current"
680
+ },
681
+ {
682
+ "type": "stat-display",
683
+ "label": "Max Tokens",
684
+ "value": "@entity.max"
685
+ }
686
+ ]
687
+ },
688
+ {
689
+ "type": "stack",
690
+ "direction": "horizontal",
691
+ "gap": "sm",
692
+ "children": [
693
+ {
694
+ "type": "button",
695
+ "label": "Compact Now",
696
+ "event": "COMPACT",
697
+ "variant": "primary",
698
+ "icon": "minimize-2"
699
+ },
700
+ {
701
+ "type": "button",
702
+ "label": "Reset",
703
+ "event": "RESET",
704
+ "variant": "ghost",
705
+ "icon": "rotate-ccw"
706
+ }
707
+ ]
708
+ }
709
+ ]
710
+ }
711
+ ]
712
+ ]
713
+ },
714
+ {
715
+ "from": "warning",
716
+ "to": "normal",
717
+ "event": "UPDATE",
718
+ "guard": [
719
+ "<",
720
+ [
721
+ "/",
722
+ "@payload.current",
723
+ "@entity.max"
724
+ ],
725
+ 0.85
726
+ ],
727
+ "effects": [
728
+ [
729
+ "set",
730
+ "@entity.current",
731
+ "@payload.current"
732
+ ],
733
+ [
734
+ "render-ui",
735
+ "main",
736
+ {
737
+ "type": "stack",
738
+ "direction": "vertical",
739
+ "gap": "lg",
740
+ "children": [
741
+ {
742
+ "type": "stack",
743
+ "direction": "horizontal",
744
+ "gap": "sm",
745
+ "align": "center",
746
+ "children": [
747
+ {
748
+ "type": "icon",
749
+ "name": "gauge",
750
+ "size": "lg"
751
+ },
752
+ {
753
+ "type": "typography",
754
+ "content": "Token Usage",
755
+ "variant": "h2"
756
+ },
757
+ {
758
+ "type": "badge",
759
+ "label": "Normal",
760
+ "variant": "default"
761
+ }
762
+ ]
763
+ },
764
+ {
765
+ "type": "divider"
766
+ },
767
+ {
768
+ "type": "progress-bar",
769
+ "value": "@entity.current",
770
+ "max": "@entity.max"
771
+ },
772
+ {
773
+ "type": "stack",
774
+ "direction": "horizontal",
775
+ "gap": "md",
776
+ "children": [
777
+ {
778
+ "type": "stat-display",
779
+ "label": "Tokens Used",
780
+ "value": "@entity.current"
781
+ },
782
+ {
783
+ "type": "stat-display",
784
+ "label": "Max Tokens",
785
+ "value": "@entity.max"
786
+ }
787
+ ]
788
+ },
789
+ {
790
+ "type": "button",
791
+ "label": "Reset",
792
+ "event": "RESET",
793
+ "variant": "ghost",
794
+ "icon": "rotate-ccw"
795
+ }
796
+ ]
797
+ }
798
+ ]
799
+ ]
800
+ },
801
+ {
802
+ "from": "critical",
803
+ "to": "critical",
804
+ "event": "UPDATE",
805
+ "guard": [
806
+ ">=",
807
+ [
808
+ "/",
809
+ "@payload.current",
810
+ "@entity.max"
811
+ ],
812
+ 0.95
813
+ ],
814
+ "effects": [
815
+ [
816
+ "set",
817
+ "@entity.current",
818
+ "@payload.current"
819
+ ],
820
+ [
821
+ "render-ui",
822
+ "main",
823
+ {
824
+ "type": "stack",
825
+ "direction": "vertical",
826
+ "gap": "lg",
827
+ "children": [
828
+ {
829
+ "type": "stack",
830
+ "direction": "horizontal",
831
+ "gap": "sm",
832
+ "align": "center",
833
+ "children": [
834
+ {
835
+ "type": "icon",
836
+ "name": "alert-octagon",
837
+ "size": "lg"
838
+ },
839
+ {
840
+ "type": "typography",
841
+ "content": "Token Usage",
842
+ "variant": "h2"
843
+ },
844
+ {
845
+ "type": "badge",
846
+ "label": "Critical",
847
+ "variant": "destructive"
848
+ }
849
+ ]
850
+ },
851
+ {
852
+ "type": "divider"
853
+ },
854
+ {
855
+ "type": "alert",
856
+ "variant": "error",
857
+ "message": "Token usage critical. Compact immediately to avoid truncation."
858
+ },
859
+ {
860
+ "type": "progress-bar",
861
+ "value": "@entity.current",
862
+ "max": "@entity.max"
863
+ },
864
+ {
865
+ "type": "stack",
866
+ "direction": "horizontal",
867
+ "gap": "md",
868
+ "children": [
869
+ {
870
+ "type": "stat-display",
871
+ "label": "Tokens Used",
872
+ "value": "@entity.current"
873
+ },
874
+ {
875
+ "type": "stat-display",
876
+ "label": "Max Tokens",
877
+ "value": "@entity.max"
878
+ }
879
+ ]
880
+ },
881
+ {
882
+ "type": "stack",
883
+ "direction": "horizontal",
884
+ "gap": "sm",
885
+ "children": [
886
+ {
887
+ "type": "button",
888
+ "label": "Compact Now",
889
+ "event": "COMPACT",
890
+ "variant": "primary",
891
+ "icon": "minimize-2"
892
+ },
893
+ {
894
+ "type": "button",
895
+ "label": "Reset",
896
+ "event": "RESET",
897
+ "variant": "ghost",
898
+ "icon": "rotate-ccw"
899
+ }
900
+ ]
901
+ }
902
+ ]
903
+ }
904
+ ]
905
+ ]
906
+ },
907
+ {
908
+ "from": "critical",
909
+ "to": "warning",
910
+ "event": "UPDATE",
911
+ "guard": [
912
+ "and",
913
+ [
914
+ ">=",
915
+ [
916
+ "/",
917
+ "@payload.current",
918
+ "@entity.max"
919
+ ],
920
+ 0.85
921
+ ],
922
+ [
923
+ "<",
924
+ [
925
+ "/",
926
+ "@payload.current",
927
+ "@entity.max"
928
+ ],
929
+ 0.95
930
+ ]
931
+ ],
932
+ "effects": [
933
+ [
934
+ "set",
935
+ "@entity.current",
936
+ "@payload.current"
937
+ ],
938
+ [
939
+ "render-ui",
940
+ "main",
941
+ {
942
+ "type": "stack",
943
+ "direction": "vertical",
944
+ "gap": "lg",
945
+ "children": [
946
+ {
947
+ "type": "stack",
948
+ "direction": "horizontal",
949
+ "gap": "sm",
950
+ "align": "center",
951
+ "children": [
952
+ {
953
+ "type": "icon",
954
+ "name": "alert-triangle",
955
+ "size": "lg"
956
+ },
957
+ {
958
+ "type": "typography",
959
+ "content": "Token Usage",
960
+ "variant": "h2"
961
+ },
962
+ {
963
+ "type": "badge",
964
+ "label": "Warning",
965
+ "variant": "warning"
966
+ }
967
+ ]
968
+ },
969
+ {
970
+ "type": "divider"
971
+ },
972
+ {
973
+ "type": "alert",
974
+ "variant": "warning",
975
+ "message": "Token usage approaching limit. Consider compacting."
976
+ },
977
+ {
978
+ "type": "progress-bar",
979
+ "value": "@entity.current",
980
+ "max": "@entity.max"
981
+ },
982
+ {
983
+ "type": "stack",
984
+ "direction": "horizontal",
985
+ "gap": "md",
986
+ "children": [
987
+ {
988
+ "type": "stat-display",
989
+ "label": "Tokens Used",
990
+ "value": "@entity.current"
991
+ },
992
+ {
993
+ "type": "stat-display",
994
+ "label": "Max Tokens",
995
+ "value": "@entity.max"
996
+ }
997
+ ]
998
+ },
999
+ {
1000
+ "type": "stack",
1001
+ "direction": "horizontal",
1002
+ "gap": "sm",
1003
+ "children": [
1004
+ {
1005
+ "type": "button",
1006
+ "label": "Compact",
1007
+ "event": "COMPACT",
1008
+ "variant": "primary",
1009
+ "icon": "minimize-2"
1010
+ },
1011
+ {
1012
+ "type": "button",
1013
+ "label": "Reset",
1014
+ "event": "RESET",
1015
+ "variant": "ghost",
1016
+ "icon": "rotate-ccw"
1017
+ }
1018
+ ]
1019
+ }
1020
+ ]
1021
+ }
1022
+ ]
1023
+ ]
1024
+ },
1025
+ {
1026
+ "from": "critical",
1027
+ "to": "normal",
1028
+ "event": "UPDATE",
1029
+ "guard": [
1030
+ "<",
1031
+ [
1032
+ "/",
1033
+ "@payload.current",
1034
+ "@entity.max"
1035
+ ],
1036
+ 0.85
1037
+ ],
1038
+ "effects": [
1039
+ [
1040
+ "set",
1041
+ "@entity.current",
1042
+ "@payload.current"
1043
+ ],
1044
+ [
1045
+ "render-ui",
1046
+ "main",
1047
+ {
1048
+ "type": "stack",
1049
+ "direction": "vertical",
1050
+ "gap": "lg",
1051
+ "children": [
1052
+ {
1053
+ "type": "stack",
1054
+ "direction": "horizontal",
1055
+ "gap": "sm",
1056
+ "align": "center",
1057
+ "children": [
1058
+ {
1059
+ "type": "icon",
1060
+ "name": "gauge",
1061
+ "size": "lg"
1062
+ },
1063
+ {
1064
+ "type": "typography",
1065
+ "content": "Token Usage",
1066
+ "variant": "h2"
1067
+ },
1068
+ {
1069
+ "type": "badge",
1070
+ "label": "Normal",
1071
+ "variant": "default"
1072
+ }
1073
+ ]
1074
+ },
1075
+ {
1076
+ "type": "divider"
1077
+ },
1078
+ {
1079
+ "type": "progress-bar",
1080
+ "value": "@entity.current",
1081
+ "max": "@entity.max"
1082
+ },
1083
+ {
1084
+ "type": "stack",
1085
+ "direction": "horizontal",
1086
+ "gap": "md",
1087
+ "children": [
1088
+ {
1089
+ "type": "stat-display",
1090
+ "label": "Tokens Used",
1091
+ "value": "@entity.current"
1092
+ },
1093
+ {
1094
+ "type": "stat-display",
1095
+ "label": "Max Tokens",
1096
+ "value": "@entity.max"
1097
+ }
1098
+ ]
1099
+ },
1100
+ {
1101
+ "type": "button",
1102
+ "label": "Reset",
1103
+ "event": "RESET",
1104
+ "variant": "ghost",
1105
+ "icon": "rotate-ccw"
1106
+ }
1107
+ ]
1108
+ }
1109
+ ]
1110
+ ]
1111
+ },
1112
+ {
1113
+ "from": "normal",
1114
+ "to": "normal",
1115
+ "event": "COMPACT",
1116
+ "effects": [
1117
+ [
1118
+ "agent/compact"
1119
+ ],
1120
+ [
1121
+ "set",
1122
+ "@entity.lastCompactedAt",
1123
+ "@now"
1124
+ ],
1125
+ [
1126
+ "agent/token-count"
1127
+ ],
1128
+ [
1129
+ "render-ui",
1130
+ "main",
1131
+ {
1132
+ "type": "stack",
1133
+ "direction": "vertical",
1134
+ "gap": "lg",
1135
+ "children": [
1136
+ {
1137
+ "type": "stack",
1138
+ "direction": "horizontal",
1139
+ "gap": "sm",
1140
+ "align": "center",
1141
+ "children": [
1142
+ {
1143
+ "type": "icon",
1144
+ "name": "gauge",
1145
+ "size": "lg"
1146
+ },
1147
+ {
1148
+ "type": "typography",
1149
+ "content": "Token Usage",
1150
+ "variant": "h2"
1151
+ },
1152
+ {
1153
+ "type": "badge",
1154
+ "label": "Normal",
1155
+ "variant": "default"
1156
+ }
1157
+ ]
1158
+ },
1159
+ {
1160
+ "type": "divider"
1161
+ },
1162
+ {
1163
+ "type": "progress-bar",
1164
+ "value": "@entity.current",
1165
+ "max": "@entity.max"
1166
+ },
1167
+ {
1168
+ "type": "stack",
1169
+ "direction": "horizontal",
1170
+ "gap": "md",
1171
+ "children": [
1172
+ {
1173
+ "type": "stat-display",
1174
+ "label": "Tokens Used",
1175
+ "value": "@entity.current"
1176
+ },
1177
+ {
1178
+ "type": "stat-display",
1179
+ "label": "Max Tokens",
1180
+ "value": "@entity.max"
1181
+ }
1182
+ ]
1183
+ },
1184
+ {
1185
+ "type": "button",
1186
+ "label": "Reset",
1187
+ "event": "RESET",
1188
+ "variant": "ghost",
1189
+ "icon": "rotate-ccw"
1190
+ }
1191
+ ]
1192
+ }
1193
+ ]
1194
+ ]
1195
+ },
1196
+ {
1197
+ "from": "warning",
1198
+ "to": "normal",
1199
+ "event": "COMPACT",
1200
+ "effects": [
1201
+ [
1202
+ "agent/compact"
1203
+ ],
1204
+ [
1205
+ "set",
1206
+ "@entity.lastCompactedAt",
1207
+ "@now"
1208
+ ],
1209
+ [
1210
+ "agent/token-count"
1211
+ ],
1212
+ [
1213
+ "render-ui",
1214
+ "main",
1215
+ {
1216
+ "type": "stack",
1217
+ "direction": "vertical",
1218
+ "gap": "lg",
1219
+ "children": [
1220
+ {
1221
+ "type": "stack",
1222
+ "direction": "horizontal",
1223
+ "gap": "sm",
1224
+ "align": "center",
1225
+ "children": [
1226
+ {
1227
+ "type": "icon",
1228
+ "name": "gauge",
1229
+ "size": "lg"
1230
+ },
1231
+ {
1232
+ "type": "typography",
1233
+ "content": "Token Usage",
1234
+ "variant": "h2"
1235
+ },
1236
+ {
1237
+ "type": "badge",
1238
+ "label": "Normal",
1239
+ "variant": "default"
1240
+ }
1241
+ ]
1242
+ },
1243
+ {
1244
+ "type": "divider"
1245
+ },
1246
+ {
1247
+ "type": "progress-bar",
1248
+ "value": "@entity.current",
1249
+ "max": "@entity.max"
1250
+ },
1251
+ {
1252
+ "type": "stack",
1253
+ "direction": "horizontal",
1254
+ "gap": "md",
1255
+ "children": [
1256
+ {
1257
+ "type": "stat-display",
1258
+ "label": "Tokens Used",
1259
+ "value": "@entity.current"
1260
+ },
1261
+ {
1262
+ "type": "stat-display",
1263
+ "label": "Max Tokens",
1264
+ "value": "@entity.max"
1265
+ }
1266
+ ]
1267
+ },
1268
+ {
1269
+ "type": "button",
1270
+ "label": "Reset",
1271
+ "event": "RESET",
1272
+ "variant": "ghost",
1273
+ "icon": "rotate-ccw"
1274
+ }
1275
+ ]
1276
+ }
1277
+ ]
1278
+ ]
1279
+ },
1280
+ {
1281
+ "from": "critical",
1282
+ "to": "normal",
1283
+ "event": "COMPACT",
1284
+ "effects": [
1285
+ [
1286
+ "agent/compact"
1287
+ ],
1288
+ [
1289
+ "set",
1290
+ "@entity.lastCompactedAt",
1291
+ "@now"
1292
+ ],
1293
+ [
1294
+ "agent/token-count"
1295
+ ],
1296
+ [
1297
+ "render-ui",
1298
+ "main",
1299
+ {
1300
+ "type": "stack",
1301
+ "direction": "vertical",
1302
+ "gap": "lg",
1303
+ "children": [
1304
+ {
1305
+ "type": "stack",
1306
+ "direction": "horizontal",
1307
+ "gap": "sm",
1308
+ "align": "center",
1309
+ "children": [
1310
+ {
1311
+ "type": "icon",
1312
+ "name": "gauge",
1313
+ "size": "lg"
1314
+ },
1315
+ {
1316
+ "type": "typography",
1317
+ "content": "Token Usage",
1318
+ "variant": "h2"
1319
+ },
1320
+ {
1321
+ "type": "badge",
1322
+ "label": "Normal",
1323
+ "variant": "default"
1324
+ }
1325
+ ]
1326
+ },
1327
+ {
1328
+ "type": "divider"
1329
+ },
1330
+ {
1331
+ "type": "progress-bar",
1332
+ "value": "@entity.current",
1333
+ "max": "@entity.max"
1334
+ },
1335
+ {
1336
+ "type": "stack",
1337
+ "direction": "horizontal",
1338
+ "gap": "md",
1339
+ "children": [
1340
+ {
1341
+ "type": "stat-display",
1342
+ "label": "Tokens Used",
1343
+ "value": "@entity.current"
1344
+ },
1345
+ {
1346
+ "type": "stat-display",
1347
+ "label": "Max Tokens",
1348
+ "value": "@entity.max"
1349
+ }
1350
+ ]
1351
+ },
1352
+ {
1353
+ "type": "button",
1354
+ "label": "Reset",
1355
+ "event": "RESET",
1356
+ "variant": "ghost",
1357
+ "icon": "rotate-ccw"
1358
+ }
1359
+ ]
1360
+ }
1361
+ ]
1362
+ ]
1363
+ },
1364
+ {
1365
+ "from": "normal",
1366
+ "to": "normal",
1367
+ "event": "RESET",
1368
+ "effects": [
1369
+ [
1370
+ "set",
1371
+ "@entity.current",
1372
+ 0
1373
+ ],
1374
+ [
1375
+ "render-ui",
1376
+ "main",
1377
+ {
1378
+ "type": "stack",
1379
+ "direction": "vertical",
1380
+ "gap": "lg",
1381
+ "children": [
1382
+ {
1383
+ "type": "stack",
1384
+ "direction": "horizontal",
1385
+ "gap": "sm",
1386
+ "align": "center",
1387
+ "children": [
1388
+ {
1389
+ "type": "icon",
1390
+ "name": "gauge",
1391
+ "size": "lg"
1392
+ },
1393
+ {
1394
+ "type": "typography",
1395
+ "content": "Token Usage",
1396
+ "variant": "h2"
1397
+ },
1398
+ {
1399
+ "type": "badge",
1400
+ "label": "Normal",
1401
+ "variant": "default"
1402
+ }
1403
+ ]
1404
+ },
1405
+ {
1406
+ "type": "divider"
1407
+ },
1408
+ {
1409
+ "type": "progress-bar",
1410
+ "value": "@entity.current",
1411
+ "max": "@entity.max"
1412
+ },
1413
+ {
1414
+ "type": "stack",
1415
+ "direction": "horizontal",
1416
+ "gap": "md",
1417
+ "children": [
1418
+ {
1419
+ "type": "stat-display",
1420
+ "label": "Tokens Used",
1421
+ "value": "@entity.current"
1422
+ },
1423
+ {
1424
+ "type": "stat-display",
1425
+ "label": "Max Tokens",
1426
+ "value": "@entity.max"
1427
+ }
1428
+ ]
1429
+ },
1430
+ {
1431
+ "type": "button",
1432
+ "label": "Reset",
1433
+ "event": "RESET",
1434
+ "variant": "ghost",
1435
+ "icon": "rotate-ccw"
1436
+ }
1437
+ ]
1438
+ }
1439
+ ]
1440
+ ]
1441
+ },
1442
+ {
1443
+ "from": "warning",
1444
+ "to": "normal",
1445
+ "event": "RESET",
1446
+ "effects": [
1447
+ [
1448
+ "set",
1449
+ "@entity.current",
1450
+ 0
1451
+ ],
1452
+ [
1453
+ "render-ui",
1454
+ "main",
1455
+ {
1456
+ "type": "stack",
1457
+ "direction": "vertical",
1458
+ "gap": "lg",
1459
+ "children": [
1460
+ {
1461
+ "type": "stack",
1462
+ "direction": "horizontal",
1463
+ "gap": "sm",
1464
+ "align": "center",
1465
+ "children": [
1466
+ {
1467
+ "type": "icon",
1468
+ "name": "gauge",
1469
+ "size": "lg"
1470
+ },
1471
+ {
1472
+ "type": "typography",
1473
+ "content": "Token Usage",
1474
+ "variant": "h2"
1475
+ },
1476
+ {
1477
+ "type": "badge",
1478
+ "label": "Normal",
1479
+ "variant": "default"
1480
+ }
1481
+ ]
1482
+ },
1483
+ {
1484
+ "type": "divider"
1485
+ },
1486
+ {
1487
+ "type": "progress-bar",
1488
+ "value": "@entity.current",
1489
+ "max": "@entity.max"
1490
+ },
1491
+ {
1492
+ "type": "stack",
1493
+ "direction": "horizontal",
1494
+ "gap": "md",
1495
+ "children": [
1496
+ {
1497
+ "type": "stat-display",
1498
+ "label": "Tokens Used",
1499
+ "value": "@entity.current"
1500
+ },
1501
+ {
1502
+ "type": "stat-display",
1503
+ "label": "Max Tokens",
1504
+ "value": "@entity.max"
1505
+ }
1506
+ ]
1507
+ },
1508
+ {
1509
+ "type": "button",
1510
+ "label": "Reset",
1511
+ "event": "RESET",
1512
+ "variant": "ghost",
1513
+ "icon": "rotate-ccw"
1514
+ }
1515
+ ]
1516
+ }
1517
+ ]
1518
+ ]
1519
+ },
1520
+ {
1521
+ "from": "critical",
1522
+ "to": "normal",
1523
+ "event": "RESET",
1524
+ "effects": [
1525
+ [
1526
+ "set",
1527
+ "@entity.current",
1528
+ 0
1529
+ ],
1530
+ [
1531
+ "render-ui",
1532
+ "main",
1533
+ {
1534
+ "type": "stack",
1535
+ "direction": "vertical",
1536
+ "gap": "lg",
1537
+ "children": [
1538
+ {
1539
+ "type": "stack",
1540
+ "direction": "horizontal",
1541
+ "gap": "sm",
1542
+ "align": "center",
1543
+ "children": [
1544
+ {
1545
+ "type": "icon",
1546
+ "name": "gauge",
1547
+ "size": "lg"
1548
+ },
1549
+ {
1550
+ "type": "typography",
1551
+ "content": "Token Usage",
1552
+ "variant": "h2"
1553
+ },
1554
+ {
1555
+ "type": "badge",
1556
+ "label": "Normal",
1557
+ "variant": "default"
1558
+ }
1559
+ ]
1560
+ },
1561
+ {
1562
+ "type": "divider"
1563
+ },
1564
+ {
1565
+ "type": "progress-bar",
1566
+ "value": "@entity.current",
1567
+ "max": "@entity.max"
1568
+ },
1569
+ {
1570
+ "type": "stack",
1571
+ "direction": "horizontal",
1572
+ "gap": "md",
1573
+ "children": [
1574
+ {
1575
+ "type": "stat-display",
1576
+ "label": "Tokens Used",
1577
+ "value": "@entity.current"
1578
+ },
1579
+ {
1580
+ "type": "stat-display",
1581
+ "label": "Max Tokens",
1582
+ "value": "@entity.max"
1583
+ }
1584
+ ]
1585
+ },
1586
+ {
1587
+ "type": "button",
1588
+ "label": "Reset",
1589
+ "event": "RESET",
1590
+ "variant": "ghost",
1591
+ "icon": "rotate-ccw"
1592
+ }
1593
+ ]
1594
+ }
1595
+ ]
1596
+ ]
1597
+ }
1598
+ ]
1599
+ }
1600
+ }
1601
+ ],
1602
+ "pages": [
1603
+ {
1604
+ "name": "AgentTokenGaugePage",
1605
+ "path": "/agenttokengauges",
1606
+ "traits": [
1607
+ {
1608
+ "ref": "AgentTokenGaugeGauge"
1609
+ }
1610
+ ]
1611
+ }
1612
+ ]
1613
+ }
1614
+ ],
1615
+ "description": "Token usage display atom with threshold-based state transitions. Shows current token count, usage percentage, and progress bar. Transitions from normal -> warning -> critical based on configurable thresholds. Provides compact and reset actions."
1616
+ }