@animalabs/agent-framework 0.6.10 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/src/agent.d.ts +2 -0
  2. package/dist/src/agent.d.ts.map +1 -1
  3. package/dist/src/agent.js +3 -0
  4. package/dist/src/agent.js.map +1 -1
  5. package/dist/src/framework.d.ts +115 -15
  6. package/dist/src/framework.d.ts.map +1 -1
  7. package/dist/src/framework.js +820 -104
  8. package/dist/src/framework.js.map +1 -1
  9. package/dist/src/mcpl/channel-registry.d.ts +87 -7
  10. package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
  11. package/dist/src/mcpl/channel-registry.js +329 -49
  12. package/dist/src/mcpl/channel-registry.js.map +1 -1
  13. package/dist/src/modules/workspace/index.d.ts.map +1 -1
  14. package/dist/src/modules/workspace/index.js +13 -4
  15. package/dist/src/modules/workspace/index.js.map +1 -1
  16. package/dist/src/types/agent.d.ts +17 -0
  17. package/dist/src/types/agent.d.ts.map +1 -1
  18. package/dist/src/types/trace.d.ts +32 -0
  19. package/dist/src/types/trace.d.ts.map +1 -1
  20. package/dist/test/channel-registry-routing.test.js +186 -10
  21. package/dist/test/channel-registry-routing.test.js.map +1 -1
  22. package/dist/test/explicit-prose-routing.test.d.ts +11 -0
  23. package/dist/test/explicit-prose-routing.test.d.ts.map +1 -0
  24. package/dist/test/explicit-prose-routing.test.js +247 -0
  25. package/dist/test/explicit-prose-routing.test.js.map +1 -0
  26. package/dist/test/present-while-acting.test.js +85 -8
  27. package/dist/test/present-while-acting.test.js.map +1 -1
  28. package/dist/test/trunk-channel-routing.test.js +2 -2
  29. package/dist/test/trunk-channel-routing.test.js.map +1 -1
  30. package/dist/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +4 -4
  32. package/src/agent.ts +3 -0
  33. package/src/framework.ts +881 -107
  34. package/src/mcpl/channel-registry.ts +401 -54
  35. package/src/modules/workspace/index.ts +13 -4
  36. package/src/types/agent.ts +18 -0
  37. package/src/types/trace.ts +47 -1
@@ -37,7 +37,18 @@ export type TraceEvent =
37
37
  })
38
38
 
39
39
  // Inference lifecycle
40
- | (TraceEventBase & { type: 'inference:started'; agentName: string })
40
+ | (TraceEventBase & {
41
+ type: 'inference:started';
42
+ agentName: string;
43
+ /**
44
+ * The turn-frozen outbound locus (see turnLocusPins) — the channel this
45
+ * turn's plain prose will be routed to. Omitted for turns with no locus
46
+ * (heartbeats with no default channel). Observability only, like every
47
+ * trace field; lets external taps (e.g. a TTS relay) tag the whole
48
+ * activation with its channel without re-deriving routing.
49
+ */
50
+ channelId?: string;
51
+ })
41
52
  | (TraceEventBase & {
42
53
  type: 'inference:completed';
43
54
  agentName: string;
@@ -82,6 +93,8 @@ export type TraceEvent =
82
93
  blockType: 'text' | 'thinking' | 'tool_call' | 'tool_result';
83
94
  /** 0-indexed block position in the current assistant turn. */
84
95
  blockIndex: number;
96
+ /** Turn-frozen outbound locus for this turn (see inference:started). */
97
+ channelId?: string;
85
98
  })
86
99
  | (TraceEventBase & {
87
100
  /**
@@ -95,6 +108,8 @@ export type TraceEvent =
95
108
  phase: 'block_start' | 'block_complete';
96
109
  blockType: 'text' | 'thinking' | 'tool_call' | 'tool_result';
97
110
  blockIndex: number;
111
+ /** Turn-frozen outbound locus for this turn (see inference:started). */
112
+ channelId?: string;
98
113
  })
99
114
  | (TraceEventBase & {
100
115
  type: 'inference:tool_calls_yielded';
@@ -281,6 +296,37 @@ export type TraceEvent =
281
296
  channelId?: string;
282
297
  })
283
298
 
299
+ // Host-owned speech routing (ChannelRegistry.routeSpeech). One trace per
300
+ // delivered prose segment. `text` is the segment verbatim — the same content
301
+ // already on the bus chunk-by-chunk via inference:tokens, and mcpl:* traces
302
+ // are 'ops'-scoped on the webui wire — and `messageId` is the surface's id
303
+ // for the posted message (when the MCPL server reports one). Together they
304
+ // give external taps the (channelId, messageId, text) tuple needed to edit
305
+ // a just-posted message, e.g. a TTS interruption truncating a reply to the
306
+ // words actually voiced.
307
+ | (TraceEventBase & {
308
+ type: 'mcpl:speech-routed';
309
+ /** Agent / conversation whose speech was routed. */
310
+ conversationId: string;
311
+ serverId: string;
312
+ channelId: string;
313
+ delivered: boolean;
314
+ textLen: number;
315
+ /** The routed prose segment, verbatim. */
316
+ text: string;
317
+ /** Surface message id (e.g. Discord message id), when reported. */
318
+ messageId?: string;
319
+ })
320
+ | (TraceEventBase & {
321
+ type: 'mcpl:speech-route-failed';
322
+ /** Agent / conversation whose speech failed to route. */
323
+ conversationId: string;
324
+ /** Empty string when the failure was "no locus at all". */
325
+ channelId: string;
326
+ reason: string;
327
+ textLen: number;
328
+ })
329
+
284
330
  // MCPL server connection lifecycle (spawn / handshake / reconnect health).
285
331
  // Previously these outcomes were visible only on the host process's own
286
332
  // stderr, so a server that lost the boot handshake race just went missing.