@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
@@ -53,18 +53,44 @@
53
53
  "name": "tokenCount",
54
54
  "type": "number",
55
55
  "default": 0
56
+ },
57
+ {
58
+ "name": "role",
59
+ "type": "string",
60
+ "default": "user"
61
+ },
62
+ {
63
+ "name": "content",
64
+ "type": "string",
65
+ "default": ""
66
+ },
67
+ {
68
+ "name": "timestamp",
69
+ "type": "string",
70
+ "default": ""
71
+ },
72
+ {
73
+ "name": "toolName",
74
+ "type": "string",
75
+ "default": ""
56
76
  }
57
77
  ]
58
78
  },
59
79
  "traits": [
60
80
  {
61
- "name": "AgentConversationFlow",
81
+ "name": "AgentConversationThread",
62
82
  "linkedEntity": "AgentConversation",
63
83
  "category": "interaction",
64
84
  "emits": [
65
85
  {
66
- "event": "TOKEN_UPDATE",
67
- "scope": "external"
86
+ "event": "SEND_MESSAGE",
87
+ "scope": "internal",
88
+ "payload": [
89
+ {
90
+ "name": "content",
91
+ "type": "string"
92
+ }
93
+ ]
68
94
  }
69
95
  ],
70
96
  "stateMachine": {
@@ -74,10 +100,7 @@
74
100
  "isInitial": true
75
101
  },
76
102
  {
77
- "name": "active"
78
- },
79
- {
80
- "name": "paused"
103
+ "name": "composing"
81
104
  }
82
105
  ],
83
106
  "events": [
@@ -86,7 +109,11 @@
86
109
  "name": "Initialize"
87
110
  },
88
111
  {
89
- "key": "SEND_MESSAGE",
112
+ "key": "COMPOSE",
113
+ "name": "Compose Message"
114
+ },
115
+ {
116
+ "key": "SEND",
90
117
  "name": "Send Message",
91
118
  "payload": [
92
119
  {
@@ -96,17 +123,9 @@
96
123
  }
97
124
  ]
98
125
  },
99
- {
100
- "key": "PAUSE",
101
- "name": "Pause"
102
- },
103
- {
104
- "key": "RESUME",
105
- "name": "Resume"
106
- },
107
126
  {
108
127
  "key": "CLEAR",
109
- "name": "Clear"
128
+ "name": "Clear Thread"
110
129
  }
111
130
  ],
112
131
  "transitions": [
@@ -131,17 +150,33 @@
131
150
  "type": "stack",
132
151
  "direction": "horizontal",
133
152
  "gap": "sm",
153
+ "justify": "space-between",
134
154
  "align": "center",
135
155
  "children": [
136
156
  {
137
- "type": "icon",
138
- "name": "message-circle",
139
- "size": "lg"
157
+ "type": "stack",
158
+ "direction": "horizontal",
159
+ "gap": "sm",
160
+ "align": "center",
161
+ "children": [
162
+ {
163
+ "type": "icon",
164
+ "name": "message-circle",
165
+ "size": "lg"
166
+ },
167
+ {
168
+ "type": "typography",
169
+ "content": "AgentConversation Thread",
170
+ "variant": "h2"
171
+ }
172
+ ]
140
173
  },
141
174
  {
142
- "type": "typography",
143
- "content": "AgentConversation",
144
- "variant": "h2"
175
+ "type": "button",
176
+ "label": "New Message",
177
+ "event": "COMPOSE",
178
+ "variant": "primary",
179
+ "icon": "plus"
145
180
  }
146
181
  ]
147
182
  },
@@ -149,23 +184,50 @@
149
184
  "type": "divider"
150
185
  },
151
186
  {
152
- "type": "typography",
153
- "variant": "caption",
154
- "color": "muted",
155
- "content": "Start a conversation with the agent."
156
- },
157
- {
158
- "type": "input",
159
- "label": "Message",
160
- "bind": "@entity.lastMessage",
161
- "placeholder": "Type a message..."
162
- },
163
- {
164
- "type": "button",
165
- "label": "Send",
166
- "event": "SEND_MESSAGE",
167
- "variant": "primary",
168
- "icon": "send"
187
+ "type": "data-list",
188
+ "entity": "AgentConversation",
189
+ "emptyIcon": "message-circle",
190
+ "emptyTitle": "No messages yet",
191
+ "emptyDescription": "Start a conversation by sending a message.",
192
+ "renderItem": [
193
+ "fn",
194
+ "item",
195
+ {
196
+ "type": "stack",
197
+ "direction": "vertical",
198
+ "gap": "xs",
199
+ "children": [
200
+ {
201
+ "type": "stack",
202
+ "direction": "horizontal",
203
+ "gap": "sm",
204
+ "align": "center",
205
+ "children": [
206
+ {
207
+ "type": "badge",
208
+ "label": "@item.role"
209
+ },
210
+ {
211
+ "type": "badge",
212
+ "label": "@item.status",
213
+ "variant": "outline"
214
+ },
215
+ {
216
+ "type": "typography",
217
+ "variant": "caption",
218
+ "color": "muted",
219
+ "content": "@item.timestamp"
220
+ }
221
+ ]
222
+ },
223
+ {
224
+ "type": "typography",
225
+ "variant": "body",
226
+ "content": "@item.content"
227
+ }
228
+ ]
229
+ }
230
+ ]
169
231
  }
170
232
  ]
171
233
  }
@@ -174,31 +236,9 @@
174
236
  },
175
237
  {
176
238
  "from": "idle",
177
- "to": "active",
178
- "event": "SEND_MESSAGE",
239
+ "to": "composing",
240
+ "event": "COMPOSE",
179
241
  "effects": [
180
- [
181
- "set",
182
- "@entity.lastMessage",
183
- "@payload.content"
184
- ],
185
- [
186
- "set",
187
- "@entity.turnCount",
188
- [
189
- "+",
190
- "@entity.turnCount",
191
- 1
192
- ]
193
- ],
194
- [
195
- "agent/generate",
196
- "@payload.content"
197
- ],
198
- [
199
- "emit",
200
- "TOKEN_UPDATE"
201
- ],
202
242
  [
203
243
  "render-ui",
204
244
  "main",
@@ -211,21 +251,34 @@
211
251
  "type": "stack",
212
252
  "direction": "horizontal",
213
253
  "gap": "sm",
254
+ "justify": "space-between",
214
255
  "align": "center",
215
256
  "children": [
216
257
  {
217
- "type": "icon",
218
- "name": "message-circle",
219
- "size": "lg"
258
+ "type": "stack",
259
+ "direction": "horizontal",
260
+ "gap": "sm",
261
+ "align": "center",
262
+ "children": [
263
+ {
264
+ "type": "icon",
265
+ "name": "message-circle",
266
+ "size": "lg"
267
+ },
268
+ {
269
+ "type": "typography",
270
+ "content": "AgentConversation Thread",
271
+ "variant": "h2"
272
+ }
273
+ ]
220
274
  },
221
275
  {
222
- "type": "typography",
223
- "content": "AgentConversation",
224
- "variant": "h2"
225
- },
226
- {
227
- "type": "badge",
228
- "label": "@entity.turnCount"
276
+ "type": "button",
277
+ "label": "New Message",
278
+ "event": "COMPOSE",
279
+ "variant": "primary",
280
+ "icon": "plus",
281
+ "disabled": true
229
282
  }
230
283
  ]
231
284
  },
@@ -233,52 +286,129 @@
233
286
  "type": "divider"
234
287
  },
235
288
  {
236
- "type": "typography",
237
- "variant": "body",
238
- "content": "@entity.lastMessage"
239
- },
240
- {
241
- "type": "stack",
242
- "direction": "horizontal",
243
- "gap": "sm",
244
- "children": [
289
+ "type": "data-list",
290
+ "entity": "AgentConversation",
291
+ "emptyIcon": "message-circle",
292
+ "emptyTitle": "No messages yet",
293
+ "emptyDescription": "Start a conversation by sending a message.",
294
+ "renderItem": [
295
+ "fn",
296
+ "item",
245
297
  {
246
- "type": "badge",
247
- "label": "@entity.tokenCount"
298
+ "type": "stack",
299
+ "direction": "vertical",
300
+ "gap": "xs",
301
+ "children": [
302
+ {
303
+ "type": "stack",
304
+ "direction": "horizontal",
305
+ "gap": "sm",
306
+ "align": "center",
307
+ "children": [
308
+ {
309
+ "type": "badge",
310
+ "label": "@item.role"
311
+ },
312
+ {
313
+ "type": "badge",
314
+ "label": "@item.status",
315
+ "variant": "outline"
316
+ },
317
+ {
318
+ "type": "typography",
319
+ "variant": "caption",
320
+ "color": "muted",
321
+ "content": "@item.timestamp"
322
+ }
323
+ ]
324
+ },
325
+ {
326
+ "type": "typography",
327
+ "variant": "body",
328
+ "content": "@item.content"
329
+ }
330
+ ]
248
331
  }
249
332
  ]
250
333
  },
251
334
  {
252
- "type": "input",
253
- "label": "Message",
254
- "bind": "@entity.lastMessage",
255
- "placeholder": "Type a message..."
256
- },
257
- {
258
- "type": "stack",
259
- "direction": "horizontal",
260
- "gap": "sm",
335
+ "type": "form-section",
336
+ "title": "Compose Message",
261
337
  "children": [
262
338
  {
263
- "type": "button",
264
- "label": "Send",
265
- "event": "SEND_MESSAGE",
266
- "variant": "primary",
267
- "icon": "send"
339
+ "type": "textarea",
340
+ "label": "Message",
341
+ "bind": "@entity.content",
342
+ "placeholder": "Type your message..."
268
343
  },
269
344
  {
270
- "type": "button",
271
- "label": "Pause",
272
- "event": "PAUSE",
273
- "variant": "secondary",
274
- "icon": "pause"
345
+ "type": "stack",
346
+ "direction": "horizontal",
347
+ "gap": "sm",
348
+ "children": [
349
+ {
350
+ "type": "button",
351
+ "label": "Send",
352
+ "event": "SEND",
353
+ "variant": "primary",
354
+ "icon": "send"
355
+ }
356
+ ]
357
+ }
358
+ ],
359
+ "fields": [
360
+ {
361
+ "name": "name",
362
+ "type": "string"
275
363
  },
276
364
  {
277
- "type": "button",
278
- "label": "Clear",
279
- "event": "CLEAR",
280
- "variant": "ghost",
281
- "icon": "trash"
365
+ "name": "description",
366
+ "type": "string"
367
+ },
368
+ {
369
+ "name": "status",
370
+ "type": "string",
371
+ "values": [
372
+ "active",
373
+ "inactive",
374
+ "pending"
375
+ ]
376
+ },
377
+ {
378
+ "name": "createdAt",
379
+ "type": "string"
380
+ },
381
+ {
382
+ "name": "messages",
383
+ "type": "array"
384
+ },
385
+ {
386
+ "name": "turnCount",
387
+ "type": "number"
388
+ },
389
+ {
390
+ "name": "lastMessage",
391
+ "type": "string"
392
+ },
393
+ {
394
+ "name": "tokenCount",
395
+ "type": "number"
396
+ },
397
+ {
398
+ "name": "role",
399
+ "type": "string"
400
+ },
401
+ {
402
+ "name": "content",
403
+ "type": "string"
404
+ },
405
+ {
406
+ "name": "timestamp",
407
+ "type": "string"
408
+ },
409
+ {
410
+ "name": "toolName",
411
+ "type": "string"
282
412
  }
283
413
  ]
284
414
  }
@@ -288,31 +418,48 @@
288
418
  ]
289
419
  },
290
420
  {
291
- "from": "active",
292
- "to": "active",
293
- "event": "SEND_MESSAGE",
421
+ "from": "composing",
422
+ "to": "idle",
423
+ "event": "SEND",
294
424
  "effects": [
295
425
  [
296
426
  "set",
297
- "@entity.lastMessage",
427
+ "@entity.content",
298
428
  "@payload.content"
299
429
  ],
300
430
  [
301
431
  "set",
302
- "@entity.turnCount",
303
- [
304
- "+",
305
- "@entity.turnCount",
306
- 1
307
- ]
432
+ "@entity.role",
433
+ "user"
308
434
  ],
309
435
  [
310
- "agent/generate",
311
- "@payload.content"
436
+ "set",
437
+ "@entity.timestamp",
438
+ "@now"
439
+ ],
440
+ [
441
+ "set",
442
+ "@entity.status",
443
+ "sent"
444
+ ],
445
+ [
446
+ "persist",
447
+ "create",
448
+ "AgentConversation",
449
+ {
450
+ "role": "user",
451
+ "content": "@payload.content",
452
+ "timestamp": "@now",
453
+ "status": "sent"
454
+ }
312
455
  ],
313
456
  [
314
457
  "emit",
315
- "TOKEN_UPDATE"
458
+ "SEND_MESSAGE"
459
+ ],
460
+ [
461
+ "fetch",
462
+ "AgentConversation"
316
463
  ],
317
464
  [
318
465
  "render-ui",
@@ -326,21 +473,33 @@
326
473
  "type": "stack",
327
474
  "direction": "horizontal",
328
475
  "gap": "sm",
476
+ "justify": "space-between",
329
477
  "align": "center",
330
478
  "children": [
331
479
  {
332
- "type": "icon",
333
- "name": "message-circle",
334
- "size": "lg"
335
- },
336
- {
337
- "type": "typography",
338
- "content": "AgentConversation",
339
- "variant": "h2"
480
+ "type": "stack",
481
+ "direction": "horizontal",
482
+ "gap": "sm",
483
+ "align": "center",
484
+ "children": [
485
+ {
486
+ "type": "icon",
487
+ "name": "message-circle",
488
+ "size": "lg"
489
+ },
490
+ {
491
+ "type": "typography",
492
+ "content": "AgentConversation Thread",
493
+ "variant": "h2"
494
+ }
495
+ ]
340
496
  },
341
497
  {
342
- "type": "badge",
343
- "label": "@entity.turnCount"
498
+ "type": "button",
499
+ "label": "New Message",
500
+ "event": "COMPOSE",
501
+ "variant": "primary",
502
+ "icon": "plus"
344
503
  }
345
504
  ]
346
505
  },
@@ -348,65 +507,74 @@
348
507
  "type": "divider"
349
508
  },
350
509
  {
351
- "type": "typography",
352
- "variant": "body",
353
- "content": "@entity.lastMessage"
354
- },
355
- {
356
- "type": "stack",
357
- "direction": "horizontal",
358
- "gap": "sm",
359
- "children": [
510
+ "type": "data-list",
511
+ "entity": "AgentConversation",
512
+ "emptyIcon": "message-circle",
513
+ "emptyTitle": "No messages yet",
514
+ "emptyDescription": "Start a conversation by sending a message.",
515
+ "renderItem": [
516
+ "fn",
517
+ "item",
360
518
  {
361
- "type": "badge",
362
- "label": "@entity.tokenCount"
363
- }
364
- ]
365
- },
366
- {
367
- "type": "input",
368
- "label": "Message",
369
- "bind": "@entity.lastMessage",
370
- "placeholder": "Type a message..."
371
- },
372
- {
373
- "type": "stack",
374
- "direction": "horizontal",
375
- "gap": "sm",
376
- "children": [
377
- {
378
- "type": "button",
379
- "label": "Send",
380
- "event": "SEND_MESSAGE",
381
- "variant": "primary",
382
- "icon": "send"
383
- },
384
- {
385
- "type": "button",
386
- "label": "Pause",
387
- "event": "PAUSE",
388
- "variant": "secondary",
389
- "icon": "pause"
390
- },
391
- {
392
- "type": "button",
393
- "label": "Clear",
394
- "event": "CLEAR",
395
- "variant": "ghost",
396
- "icon": "trash"
519
+ "type": "stack",
520
+ "direction": "vertical",
521
+ "gap": "xs",
522
+ "children": [
523
+ {
524
+ "type": "stack",
525
+ "direction": "horizontal",
526
+ "gap": "sm",
527
+ "align": "center",
528
+ "children": [
529
+ {
530
+ "type": "badge",
531
+ "label": "@item.role"
532
+ },
533
+ {
534
+ "type": "badge",
535
+ "label": "@item.status",
536
+ "variant": "outline"
537
+ },
538
+ {
539
+ "type": "typography",
540
+ "variant": "caption",
541
+ "color": "muted",
542
+ "content": "@item.timestamp"
543
+ }
544
+ ]
545
+ },
546
+ {
547
+ "type": "typography",
548
+ "variant": "body",
549
+ "content": "@item.content"
550
+ }
551
+ ]
397
552
  }
398
553
  ]
399
554
  }
400
555
  ]
401
556
  }
557
+ ],
558
+ [
559
+ "notify",
560
+ "AgentConversation created successfully"
402
561
  ]
403
562
  ]
404
563
  },
405
564
  {
406
- "from": "active",
407
- "to": "paused",
408
- "event": "PAUSE",
565
+ "from": "idle",
566
+ "to": "idle",
567
+ "event": "CLEAR",
409
568
  "effects": [
569
+ [
570
+ "persist",
571
+ "delete",
572
+ "AgentConversation"
573
+ ],
574
+ [
575
+ "fetch",
576
+ "AgentConversation"
577
+ ],
410
578
  [
411
579
  "render-ui",
412
580
  "main",
@@ -419,17 +587,33 @@
419
587
  "type": "stack",
420
588
  "direction": "horizontal",
421
589
  "gap": "sm",
590
+ "justify": "space-between",
422
591
  "align": "center",
423
592
  "children": [
424
593
  {
425
- "type": "icon",
426
- "name": "pause-circle",
427
- "size": "lg"
594
+ "type": "stack",
595
+ "direction": "horizontal",
596
+ "gap": "sm",
597
+ "align": "center",
598
+ "children": [
599
+ {
600
+ "type": "icon",
601
+ "name": "message-circle",
602
+ "size": "lg"
603
+ },
604
+ {
605
+ "type": "typography",
606
+ "content": "AgentConversation Thread",
607
+ "variant": "h2"
608
+ }
609
+ ]
428
610
  },
429
611
  {
430
- "type": "typography",
431
- "content": "AgentConversation (Paused)",
432
- "variant": "h2"
612
+ "type": "button",
613
+ "label": "New Message",
614
+ "event": "COMPOSE",
615
+ "variant": "primary",
616
+ "icon": "plus"
433
617
  }
434
618
  ]
435
619
  },
@@ -437,41 +621,74 @@
437
621
  "type": "divider"
438
622
  },
439
623
  {
440
- "type": "alert",
441
- "variant": "info",
442
- "message": "Conversation paused."
443
- },
444
- {
445
- "type": "stack",
446
- "direction": "horizontal",
447
- "gap": "sm",
448
- "children": [
624
+ "type": "data-list",
625
+ "entity": "AgentConversation",
626
+ "emptyIcon": "message-circle",
627
+ "emptyTitle": "No messages yet",
628
+ "emptyDescription": "Start a conversation by sending a message.",
629
+ "renderItem": [
630
+ "fn",
631
+ "item",
449
632
  {
450
- "type": "button",
451
- "label": "Resume",
452
- "event": "RESUME",
453
- "variant": "primary",
454
- "icon": "play"
455
- },
456
- {
457
- "type": "button",
458
- "label": "Clear",
459
- "event": "CLEAR",
460
- "variant": "ghost",
461
- "icon": "trash"
633
+ "type": "stack",
634
+ "direction": "vertical",
635
+ "gap": "xs",
636
+ "children": [
637
+ {
638
+ "type": "stack",
639
+ "direction": "horizontal",
640
+ "gap": "sm",
641
+ "align": "center",
642
+ "children": [
643
+ {
644
+ "type": "badge",
645
+ "label": "@item.role"
646
+ },
647
+ {
648
+ "type": "badge",
649
+ "label": "@item.status",
650
+ "variant": "outline"
651
+ },
652
+ {
653
+ "type": "typography",
654
+ "variant": "caption",
655
+ "color": "muted",
656
+ "content": "@item.timestamp"
657
+ }
658
+ ]
659
+ },
660
+ {
661
+ "type": "typography",
662
+ "variant": "body",
663
+ "content": "@item.content"
664
+ }
665
+ ]
462
666
  }
463
667
  ]
464
668
  }
465
669
  ]
466
670
  }
671
+ ],
672
+ [
673
+ "notify",
674
+ "AgentConversation deleted successfully"
467
675
  ]
468
676
  ]
469
677
  },
470
678
  {
471
- "from": "paused",
472
- "to": "active",
473
- "event": "RESUME",
679
+ "from": "composing",
680
+ "to": "idle",
681
+ "event": "CLEAR",
474
682
  "effects": [
683
+ [
684
+ "persist",
685
+ "delete",
686
+ "AgentConversation"
687
+ ],
688
+ [
689
+ "fetch",
690
+ "AgentConversation"
691
+ ],
475
692
  [
476
693
  "render-ui",
477
694
  "main",
@@ -484,21 +701,33 @@
484
701
  "type": "stack",
485
702
  "direction": "horizontal",
486
703
  "gap": "sm",
704
+ "justify": "space-between",
487
705
  "align": "center",
488
706
  "children": [
489
707
  {
490
- "type": "icon",
491
- "name": "message-circle",
492
- "size": "lg"
708
+ "type": "stack",
709
+ "direction": "horizontal",
710
+ "gap": "sm",
711
+ "align": "center",
712
+ "children": [
713
+ {
714
+ "type": "icon",
715
+ "name": "message-circle",
716
+ "size": "lg"
717
+ },
718
+ {
719
+ "type": "typography",
720
+ "content": "AgentConversation Thread",
721
+ "variant": "h2"
722
+ }
723
+ ]
493
724
  },
494
725
  {
495
- "type": "typography",
496
- "content": "AgentConversation",
497
- "variant": "h2"
498
- },
499
- {
500
- "type": "badge",
501
- "label": "@entity.turnCount"
726
+ "type": "button",
727
+ "label": "New Message",
728
+ "event": "COMPOSE",
729
+ "variant": "primary",
730
+ "icon": "plus"
502
731
  }
503
732
  ]
504
733
  },
@@ -506,60 +735,213 @@
506
735
  "type": "divider"
507
736
  },
508
737
  {
509
- "type": "typography",
510
- "variant": "body",
511
- "content": "@entity.lastMessage"
512
- },
513
- {
514
- "type": "stack",
515
- "direction": "horizontal",
516
- "gap": "sm",
517
- "children": [
738
+ "type": "data-list",
739
+ "entity": "AgentConversation",
740
+ "emptyIcon": "message-circle",
741
+ "emptyTitle": "No messages yet",
742
+ "emptyDescription": "Start a conversation by sending a message.",
743
+ "renderItem": [
744
+ "fn",
745
+ "item",
518
746
  {
519
- "type": "badge",
520
- "label": "@entity.tokenCount"
521
- }
522
- ]
523
- },
524
- {
525
- "type": "input",
526
- "label": "Message",
527
- "bind": "@entity.lastMessage",
528
- "placeholder": "Type a message..."
529
- },
530
- {
531
- "type": "stack",
532
- "direction": "horizontal",
533
- "gap": "sm",
534
- "children": [
535
- {
536
- "type": "button",
537
- "label": "Send",
538
- "event": "SEND_MESSAGE",
539
- "variant": "primary",
540
- "icon": "send"
541
- },
542
- {
543
- "type": "button",
544
- "label": "Pause",
545
- "event": "PAUSE",
546
- "variant": "secondary",
547
- "icon": "pause"
548
- },
549
- {
550
- "type": "button",
551
- "label": "Clear",
552
- "event": "CLEAR",
553
- "variant": "ghost",
554
- "icon": "trash"
747
+ "type": "stack",
748
+ "direction": "vertical",
749
+ "gap": "xs",
750
+ "children": [
751
+ {
752
+ "type": "stack",
753
+ "direction": "horizontal",
754
+ "gap": "sm",
755
+ "align": "center",
756
+ "children": [
757
+ {
758
+ "type": "badge",
759
+ "label": "@item.role"
760
+ },
761
+ {
762
+ "type": "badge",
763
+ "label": "@item.status",
764
+ "variant": "outline"
765
+ },
766
+ {
767
+ "type": "typography",
768
+ "variant": "caption",
769
+ "color": "muted",
770
+ "content": "@item.timestamp"
771
+ }
772
+ ]
773
+ },
774
+ {
775
+ "type": "typography",
776
+ "variant": "body",
777
+ "content": "@item.content"
778
+ }
779
+ ]
555
780
  }
556
781
  ]
557
782
  }
558
783
  ]
559
784
  }
785
+ ],
786
+ [
787
+ "notify",
788
+ "AgentConversation deleted successfully"
789
+ ]
790
+ ]
791
+ }
792
+ ]
793
+ }
794
+ },
795
+ {
796
+ "name": "AgentConversationAgent",
797
+ "linkedEntity": "AgentConversation",
798
+ "category": "interaction",
799
+ "emits": [
800
+ {
801
+ "event": "TOKEN_UPDATE",
802
+ "scope": "internal",
803
+ "payload": [
804
+ {
805
+ "name": "tokenCount",
806
+ "type": "number"
807
+ }
808
+ ]
809
+ }
810
+ ],
811
+ "stateMachine": {
812
+ "states": [
813
+ {
814
+ "name": "idle",
815
+ "isInitial": true
816
+ },
817
+ {
818
+ "name": "active"
819
+ },
820
+ {
821
+ "name": "paused"
822
+ }
823
+ ],
824
+ "events": [
825
+ {
826
+ "key": "INIT",
827
+ "name": "Initialize"
828
+ },
829
+ {
830
+ "key": "SEND_MESSAGE",
831
+ "name": "Send Message",
832
+ "payload": [
833
+ {
834
+ "name": "content",
835
+ "type": "string",
836
+ "required": true
837
+ }
838
+ ]
839
+ },
840
+ {
841
+ "key": "PAUSE",
842
+ "name": "Pause"
843
+ },
844
+ {
845
+ "key": "RESUME",
846
+ "name": "Resume"
847
+ },
848
+ {
849
+ "key": "CLEAR",
850
+ "name": "Clear"
851
+ }
852
+ ],
853
+ "transitions": [
854
+ {
855
+ "from": "idle",
856
+ "to": "idle",
857
+ "event": "INIT",
858
+ "effects": [
859
+ [
860
+ "fetch",
861
+ "AgentConversation"
862
+ ],
863
+ [
864
+ "render-ui",
865
+ "main",
866
+ {
867
+ "type": "empty-state",
868
+ "icon": "message-circle",
869
+ "title": "Conversation",
870
+ "description": "Conversation is ready"
871
+ }
872
+ ]
873
+ ]
874
+ },
875
+ {
876
+ "from": "idle",
877
+ "to": "active",
878
+ "event": "SEND_MESSAGE",
879
+ "effects": [
880
+ [
881
+ "set",
882
+ "@entity.lastMessage",
883
+ "@payload.content"
884
+ ],
885
+ [
886
+ "set",
887
+ "@entity.turnCount",
888
+ [
889
+ "+",
890
+ "@entity.turnCount",
891
+ 1
892
+ ]
893
+ ],
894
+ [
895
+ "agent/generate",
896
+ "@payload.content"
897
+ ],
898
+ [
899
+ "emit",
900
+ "TOKEN_UPDATE"
560
901
  ]
561
902
  ]
562
903
  },
904
+ {
905
+ "from": "active",
906
+ "to": "active",
907
+ "event": "SEND_MESSAGE",
908
+ "effects": [
909
+ [
910
+ "set",
911
+ "@entity.lastMessage",
912
+ "@payload.content"
913
+ ],
914
+ [
915
+ "set",
916
+ "@entity.turnCount",
917
+ [
918
+ "+",
919
+ "@entity.turnCount",
920
+ 1
921
+ ]
922
+ ],
923
+ [
924
+ "agent/generate",
925
+ "@payload.content"
926
+ ],
927
+ [
928
+ "emit",
929
+ "TOKEN_UPDATE"
930
+ ]
931
+ ]
932
+ },
933
+ {
934
+ "from": "active",
935
+ "to": "paused",
936
+ "event": "PAUSE",
937
+ "effects": []
938
+ },
939
+ {
940
+ "from": "paused",
941
+ "to": "active",
942
+ "event": "RESUME",
943
+ "effects": []
944
+ },
563
945
  {
564
946
  "from": "active",
565
947
  "to": "idle",
@@ -584,57 +966,6 @@
584
966
  "set",
585
967
  "@entity.tokenCount",
586
968
  0
587
- ],
588
- [
589
- "render-ui",
590
- "main",
591
- {
592
- "type": "stack",
593
- "direction": "vertical",
594
- "gap": "lg",
595
- "children": [
596
- {
597
- "type": "stack",
598
- "direction": "horizontal",
599
- "gap": "sm",
600
- "align": "center",
601
- "children": [
602
- {
603
- "type": "icon",
604
- "name": "message-circle",
605
- "size": "lg"
606
- },
607
- {
608
- "type": "typography",
609
- "content": "AgentConversation",
610
- "variant": "h2"
611
- }
612
- ]
613
- },
614
- {
615
- "type": "divider"
616
- },
617
- {
618
- "type": "typography",
619
- "variant": "caption",
620
- "color": "muted",
621
- "content": "Start a conversation with the agent."
622
- },
623
- {
624
- "type": "input",
625
- "label": "Message",
626
- "bind": "@entity.lastMessage",
627
- "placeholder": "Type a message..."
628
- },
629
- {
630
- "type": "button",
631
- "label": "Send",
632
- "event": "SEND_MESSAGE",
633
- "variant": "primary",
634
- "icon": "send"
635
- }
636
- ]
637
- }
638
969
  ]
639
970
  ]
640
971
  },
@@ -662,57 +993,6 @@
662
993
  "set",
663
994
  "@entity.tokenCount",
664
995
  0
665
- ],
666
- [
667
- "render-ui",
668
- "main",
669
- {
670
- "type": "stack",
671
- "direction": "vertical",
672
- "gap": "lg",
673
- "children": [
674
- {
675
- "type": "stack",
676
- "direction": "horizontal",
677
- "gap": "sm",
678
- "align": "center",
679
- "children": [
680
- {
681
- "type": "icon",
682
- "name": "message-circle",
683
- "size": "lg"
684
- },
685
- {
686
- "type": "typography",
687
- "content": "AgentConversation",
688
- "variant": "h2"
689
- }
690
- ]
691
- },
692
- {
693
- "type": "divider"
694
- },
695
- {
696
- "type": "typography",
697
- "variant": "caption",
698
- "color": "muted",
699
- "content": "Start a conversation with the agent."
700
- },
701
- {
702
- "type": "input",
703
- "label": "Message",
704
- "bind": "@entity.lastMessage",
705
- "placeholder": "Type a message..."
706
- },
707
- {
708
- "type": "button",
709
- "label": "Send",
710
- "event": "SEND_MESSAGE",
711
- "variant": "primary",
712
- "icon": "send"
713
- }
714
- ]
715
- }
716
996
  ]
717
997
  ]
718
998
  }
@@ -726,12 +1006,15 @@
726
1006
  "path": "/agentconversations",
727
1007
  "traits": [
728
1008
  {
729
- "ref": "AgentConversationFlow"
1009
+ "ref": "AgentConversationThread"
1010
+ },
1011
+ {
1012
+ "ref": "AgentConversationAgent"
730
1013
  }
731
1014
  ]
732
1015
  }
733
1016
  ]
734
1017
  }
735
1018
  ],
736
- "description": "Conversation flow atom for multi-turn agent interactions. Manages message history, turn counting, and token tracking using agent/generate for AI replies."
1019
+ "description": "Conversation flow atom for multi-turn agent interactions. Composes stdAgentChatThread (message display and compose) with an agent trait that handles agent/generate for AI replies and TOKEN_UPDATE emitting."
737
1020
  }