@pellux/goodvibes-sdk 0.37.2 → 0.38.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 (159) hide show
  1. package/dist/contracts/artifacts/operator-contract.json +1 -1
  2. package/dist/events/communication.d.ts +21 -1
  3. package/dist/events/communication.d.ts.map +1 -1
  4. package/dist/platform/agents/message-bus-core.d.ts +7 -0
  5. package/dist/platform/agents/message-bus-core.d.ts.map +1 -1
  6. package/dist/platform/agents/message-bus-core.js +2 -1
  7. package/dist/platform/agents/orchestrator-runner.d.ts +37 -1
  8. package/dist/platform/agents/orchestrator-runner.d.ts.map +1 -1
  9. package/dist/platform/agents/orchestrator-runner.js +158 -7
  10. package/dist/platform/agents/orchestrator.d.ts +40 -0
  11. package/dist/platform/agents/orchestrator.d.ts.map +1 -1
  12. package/dist/platform/agents/orchestrator.js +29 -0
  13. package/dist/platform/agents/turn-knowledge-injection.d.ts +107 -0
  14. package/dist/platform/agents/turn-knowledge-injection.d.ts.map +1 -0
  15. package/dist/platform/agents/turn-knowledge-injection.js +152 -0
  16. package/dist/platform/agents/wrfc-controller.d.ts +23 -0
  17. package/dist/platform/agents/wrfc-controller.d.ts.map +1 -1
  18. package/dist/platform/agents/wrfc-controller.js +55 -0
  19. package/dist/platform/config/manager.d.ts +9 -0
  20. package/dist/platform/config/manager.d.ts.map +1 -1
  21. package/dist/platform/config/manager.js +15 -0
  22. package/dist/platform/core/adaptive-planner.d.ts +50 -0
  23. package/dist/platform/core/adaptive-planner.d.ts.map +1 -1
  24. package/dist/platform/core/adaptive-planner.js +49 -0
  25. package/dist/platform/core/index.d.ts +1 -0
  26. package/dist/platform/core/index.d.ts.map +1 -1
  27. package/dist/platform/core/index.js +1 -0
  28. package/dist/platform/core/orchestrator-runtime.d.ts +11 -0
  29. package/dist/platform/core/orchestrator-runtime.d.ts.map +1 -1
  30. package/dist/platform/core/orchestrator-turn-loop.d.ts +28 -1
  31. package/dist/platform/core/orchestrator-turn-loop.d.ts.map +1 -1
  32. package/dist/platform/core/orchestrator-turn-loop.js +115 -3
  33. package/dist/platform/core/orchestrator.d.ts +61 -0
  34. package/dist/platform/core/orchestrator.d.ts.map +1 -1
  35. package/dist/platform/core/orchestrator.js +74 -1
  36. package/dist/platform/core/plan-proposal.d.ts +165 -0
  37. package/dist/platform/core/plan-proposal.d.ts.map +1 -0
  38. package/dist/platform/core/plan-proposal.js +296 -0
  39. package/dist/platform/knowledge/knowledge-api.d.ts +26 -0
  40. package/dist/platform/knowledge/knowledge-api.d.ts.map +1 -1
  41. package/dist/platform/knowledge/knowledge-api.js +11 -0
  42. package/dist/platform/orchestration/budget.d.ts +22 -0
  43. package/dist/platform/orchestration/budget.d.ts.map +1 -0
  44. package/dist/platform/orchestration/budget.js +35 -0
  45. package/dist/platform/orchestration/cancellation.d.ts +31 -0
  46. package/dist/platform/orchestration/cancellation.d.ts.map +1 -0
  47. package/dist/platform/orchestration/cancellation.js +25 -0
  48. package/dist/platform/orchestration/controller-compat.d.ts +32 -0
  49. package/dist/platform/orchestration/controller-compat.d.ts.map +1 -0
  50. package/dist/platform/orchestration/controller-compat.js +13 -0
  51. package/dist/platform/orchestration/dirty-guard.d.ts +32 -0
  52. package/dist/platform/orchestration/dirty-guard.d.ts.map +1 -0
  53. package/dist/platform/orchestration/dirty-guard.js +147 -0
  54. package/dist/platform/orchestration/engine.d.ts +57 -0
  55. package/dist/platform/orchestration/engine.d.ts.map +1 -0
  56. package/dist/platform/orchestration/engine.js +418 -0
  57. package/dist/platform/orchestration/index.d.ts +18 -0
  58. package/dist/platform/orchestration/index.d.ts.map +1 -0
  59. package/dist/platform/orchestration/index.js +10 -0
  60. package/dist/platform/orchestration/persistence.d.ts +24 -0
  61. package/dist/platform/orchestration/persistence.d.ts.map +1 -0
  62. package/dist/platform/orchestration/persistence.js +176 -0
  63. package/dist/platform/orchestration/phase-runner.d.ts +87 -0
  64. package/dist/platform/orchestration/phase-runner.d.ts.map +1 -0
  65. package/dist/platform/orchestration/phase-runner.js +274 -0
  66. package/dist/platform/orchestration/scheduler.d.ts +45 -0
  67. package/dist/platform/orchestration/scheduler.d.ts.map +1 -0
  68. package/dist/platform/orchestration/scheduler.js +57 -0
  69. package/dist/platform/orchestration/types.d.ts +250 -0
  70. package/dist/platform/orchestration/types.d.ts.map +1 -0
  71. package/dist/platform/orchestration/types.js +15 -0
  72. package/dist/platform/runtime/emitters/communication.d.ts +11 -0
  73. package/dist/platform/runtime/emitters/communication.d.ts.map +1 -1
  74. package/dist/platform/runtime/emitters/communication.js +9 -0
  75. package/dist/platform/runtime/feature-flags/flags.d.ts.map +1 -1
  76. package/dist/platform/runtime/feature-flags/flags.js +17 -0
  77. package/dist/platform/runtime/fleet/adapters/agent.d.ts +56 -0
  78. package/dist/platform/runtime/fleet/adapters/agent.d.ts.map +1 -0
  79. package/dist/platform/runtime/fleet/adapters/agent.js +143 -0
  80. package/dist/platform/runtime/fleet/adapters/automation.d.ts +30 -0
  81. package/dist/platform/runtime/fleet/adapters/automation.d.ts.map +1 -0
  82. package/dist/platform/runtime/fleet/adapters/automation.js +41 -0
  83. package/dist/platform/runtime/fleet/adapters/background-process.d.ts +12 -0
  84. package/dist/platform/runtime/fleet/adapters/background-process.d.ts.map +1 -0
  85. package/dist/platform/runtime/fleet/adapters/background-process.js +46 -0
  86. package/dist/platform/runtime/fleet/adapters/code-index.d.ts +21 -0
  87. package/dist/platform/runtime/fleet/adapters/code-index.d.ts.map +1 -0
  88. package/dist/platform/runtime/fleet/adapters/code-index.js +44 -0
  89. package/dist/platform/runtime/fleet/adapters/orchestration.d.ts +47 -0
  90. package/dist/platform/runtime/fleet/adapters/orchestration.d.ts.map +1 -0
  91. package/dist/platform/runtime/fleet/adapters/orchestration.js +225 -0
  92. package/dist/platform/runtime/fleet/adapters/schedule.d.ts +14 -0
  93. package/dist/platform/runtime/fleet/adapters/schedule.d.ts.map +1 -0
  94. package/dist/platform/runtime/fleet/adapters/schedule.js +28 -0
  95. package/dist/platform/runtime/fleet/adapters/trigger.d.ts +12 -0
  96. package/dist/platform/runtime/fleet/adapters/trigger.d.ts.map +1 -0
  97. package/dist/platform/runtime/fleet/adapters/trigger.js +22 -0
  98. package/dist/platform/runtime/fleet/adapters/watcher.d.ts +13 -0
  99. package/dist/platform/runtime/fleet/adapters/watcher.d.ts.map +1 -0
  100. package/dist/platform/runtime/fleet/adapters/watcher.js +47 -0
  101. package/dist/platform/runtime/fleet/adapters/workflow.d.ts +11 -0
  102. package/dist/platform/runtime/fleet/adapters/workflow.d.ts.map +1 -0
  103. package/dist/platform/runtime/fleet/adapters/workflow.js +34 -0
  104. package/dist/platform/runtime/fleet/adapters/wrfc.d.ts +22 -0
  105. package/dist/platform/runtime/fleet/adapters/wrfc.d.ts.map +1 -0
  106. package/dist/platform/runtime/fleet/adapters/wrfc.js +228 -0
  107. package/dist/platform/runtime/fleet/index.d.ts +10 -0
  108. package/dist/platform/runtime/fleet/index.d.ts.map +1 -0
  109. package/dist/platform/runtime/fleet/index.js +6 -0
  110. package/dist/platform/runtime/fleet/registry.d.ts +113 -0
  111. package/dist/platform/runtime/fleet/registry.d.ts.map +1 -0
  112. package/dist/platform/runtime/fleet/registry.js +630 -0
  113. package/dist/platform/runtime/fleet/types.d.ts +199 -0
  114. package/dist/platform/runtime/fleet/types.d.ts.map +1 -0
  115. package/dist/platform/runtime/fleet/types.js +2 -0
  116. package/dist/platform/runtime/runtime-knowledge-api.d.ts +1 -1
  117. package/dist/platform/runtime/runtime-knowledge-api.d.ts.map +1 -1
  118. package/dist/platform/runtime/runtime-knowledge-api.js +1 -0
  119. package/dist/platform/runtime/services.d.ts +46 -0
  120. package/dist/platform/runtime/services.d.ts.map +1 -1
  121. package/dist/platform/runtime/services.js +78 -0
  122. package/dist/platform/state/code-index-chunking.d.ts +49 -0
  123. package/dist/platform/state/code-index-chunking.d.ts.map +1 -0
  124. package/dist/platform/state/code-index-chunking.js +111 -0
  125. package/dist/platform/state/code-index-db.d.ts +53 -0
  126. package/dist/platform/state/code-index-db.d.ts.map +1 -0
  127. package/dist/platform/state/code-index-db.js +101 -0
  128. package/dist/platform/state/code-index-store.d.ts +175 -0
  129. package/dist/platform/state/code-index-store.d.ts.map +1 -0
  130. package/dist/platform/state/code-index-store.js +612 -0
  131. package/dist/platform/state/index.d.ts +4 -2
  132. package/dist/platform/state/index.d.ts.map +1 -1
  133. package/dist/platform/state/index.js +2 -1
  134. package/dist/platform/state/knowledge-injection.d.ts +23 -0
  135. package/dist/platform/state/knowledge-injection.d.ts.map +1 -1
  136. package/dist/platform/state/knowledge-injection.js +34 -19
  137. package/dist/platform/state/memory-vector-store.d.ts +1 -13
  138. package/dist/platform/state/memory-vector-store.d.ts.map +1 -1
  139. package/dist/platform/state/memory-vector-store.js +6 -38
  140. package/dist/platform/state/sqlite-vec-loader.d.ts +25 -0
  141. package/dist/platform/state/sqlite-vec-loader.d.ts.map +1 -0
  142. package/dist/platform/state/sqlite-vec-loader.js +43 -0
  143. package/dist/platform/tools/agent/manager.d.ts +128 -1
  144. package/dist/platform/tools/agent/manager.d.ts.map +1 -1
  145. package/dist/platform/tools/agent/manager.js +137 -1
  146. package/dist/platform/tools/exec/runtime.d.ts.map +1 -1
  147. package/dist/platform/tools/exec/runtime.js +139 -44
  148. package/dist/platform/tools/exec/schema.d.ts +2 -0
  149. package/dist/platform/tools/exec/schema.d.ts.map +1 -1
  150. package/dist/platform/tools/fetch/runtime.d.ts +7 -0
  151. package/dist/platform/tools/fetch/runtime.d.ts.map +1 -1
  152. package/dist/platform/tools/fetch/runtime.js +8 -6
  153. package/dist/platform/tools/registry.d.ts +9 -3
  154. package/dist/platform/tools/registry.d.ts.map +1 -1
  155. package/dist/platform/tools/registry.js +9 -3
  156. package/dist/platform/types/tools.d.ts +14 -1
  157. package/dist/platform/types/tools.d.ts.map +1 -1
  158. package/dist/platform/version.js +1 -1
  159. package/package.json +17 -9
@@ -3,7 +3,7 @@
3
3
  "product": {
4
4
  "id": "goodvibes",
5
5
  "surface": "operator",
6
- "version": "0.37.2"
6
+ "version": "0.38.0"
7
7
  },
8
8
  "auth": {
9
9
  "modes": [
@@ -2,7 +2,14 @@
2
2
  /**
3
3
  * CommunicationEvent — typed runtime events for structured agent communication.
4
4
  */
5
- export type CommunicationKind = 'directive' | 'status' | 'question' | 'finding' | 'review' | 'handoff' | 'escalation' | 'completion';
5
+ export type CommunicationKind = 'directive' | 'status' | 'question' | 'finding' | 'review' | 'handoff' | 'escalation' | 'completion'
6
+ /**
7
+ * Wave-3 steering: an operator (human)-originated message queued for a
8
+ * live in-process agent via `ProcessRegistry.steer()`. Framed verbatim as
9
+ * a user turn at the drain site (orchestrator-runner.ts), not wrapped in
10
+ * the `[Kind from sender]` inter-agent directive framing.
11
+ */
12
+ | 'steer';
6
13
  export type CommunicationScope = 'direct' | 'broadcast';
7
14
  export type CommunicationEvent = {
8
15
  type: 'COMMUNICATION_SENT';
@@ -37,6 +44,19 @@ export type CommunicationEvent = {
37
44
  cohort?: string | undefined;
38
45
  wrfcId?: string | undefined;
39
46
  parentAgentId?: string | undefined;
47
+ } | {
48
+ /**
49
+ * Honest "the agent actually consumed this at its turn boundary" signal —
50
+ * distinct from COMMUNICATION_DELIVERED, which fires eagerly at send()
51
+ * time and therefore cannot mean "seen by the agent" (see
52
+ * AgentMessageBus.send / orchestrator-runner's per-turn inbox drain).
53
+ * Emitted once, at the drain site, the turn a queued message is
54
+ * actually injected into the target agent's conversation.
55
+ */
56
+ type: 'COMMUNICATION_CONSUMED';
57
+ messageId: string;
58
+ agentId: string;
59
+ turn: number;
40
60
  };
41
61
  export type CommunicationEventType = CommunicationEvent['type'];
42
62
  //# sourceMappingURL=communication.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"communication.d.ts","sourceRoot":"","sources":["../../src/events/communication.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF;;GAEG;AAEH,MAAM,MAAM,iBAAiB,GACzB,WAAW,GACX,QAAQ,GACR,UAAU,GACV,SAA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ACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,EAAE,iBAAiB,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC,GACD;IACE;;;;;;;OAOG;IACH,IAAI,EAAE,wBAAwB,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEN,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC"}
@@ -18,6 +18,13 @@ export interface AgentMessage {
18
18
  }
19
19
  export type MessageCallback = (message: AgentMessage) => void;
20
20
  type MessageOptions = {
21
+ /**
22
+ * Caller-supplied message id. Lets a caller (e.g. ProcessRegistry.steer())
23
+ * learn the id synchronously from its own return value instead of from
24
+ * send()'s boolean result. Defaults to a fresh crypto.randomUUID() when
25
+ * omitted — existing callers are unaffected.
26
+ */
27
+ id?: string | undefined;
21
28
  ttlMs?: number | undefined;
22
29
  kind?: CommunicationKind | undefined;
23
30
  scope?: CommunicationScope | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"message-bus-core.d.ts","sourceRoot":"","sources":["../../../src/platform/agents/message-bus-core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAG3F,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,2BAA2B,CAAC;AAE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AAS,CAAC;QAC9B,IAAI,CAAC,EAAE,0BAA0B,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;QACtD,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACnC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC7B,GAAG,IAAI;IAUR,OAAO,CAAC,cAAc;IAetB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,GAAE,MAAM,GAAG,cAA+B,GAAG,OAAO;IAyCpH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,GAAE,MAAM,GAAG,cAA+B,GAAG,OAAO;IAmD3G,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,GAAG,MAAM,IAAI;IAgBjE,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE;IAY5C,OAAO,CAAC,QAAQ;IAiBhB,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,WAAW;IAgCnB,mFAAmF;IACnF,OAAO,CAAC,WAAW;IAWnB;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IAYzB,OAAO,IAAI,IAAI;IAYf,OAAO,CAAC,KAAK;IAOb,OAAO,CAAC,OAAO;CAahB"}
@@ -33,6 +33,7 @@ export class AgentMessageBus {
33
33
  ...(ttlOrOptions?.cohort !== undefined ? { cohort: ttlOrOptions.cohort } : {}),
34
34
  ...(ttlOrOptions?.wrfcId !== undefined ? { wrfcId: ttlOrOptions.wrfcId } : {}),
35
35
  ...(ttlOrOptions?.parentAgentId !== undefined ? { parentAgentId: ttlOrOptions.parentAgentId } : {}),
36
+ ...(ttlOrOptions?.id !== undefined ? { id: ttlOrOptions.id } : {}),
36
37
  };
37
38
  }
38
39
  send(fromId, toId, content, ttlOrOptions = DEFAULT_TTL_MS) {
@@ -54,7 +55,7 @@ export class AgentMessageBus {
54
55
  }
55
56
  }
56
57
  const message = {
57
- id: crypto.randomUUID(),
58
+ id: options.id ?? crypto.randomUUID(),
58
59
  from: fromId,
59
60
  to: toId,
60
61
  content,
@@ -1,3 +1,4 @@
1
+ import { type ConversationMessageSnapshot } from '../core/conversation.js';
1
2
  import { ToolRegistry } from '../tools/registry.js';
2
3
  import type { ProviderRegistry } from '../providers/registry.js';
3
4
  import type { ModelDefinition } from '../providers/registry-types.js';
@@ -26,10 +27,45 @@ export interface AgentOrchestratorRunContext {
26
27
  readonly emitAgentCompletedEvent: (recordId: string, durationMs: number, output: string, toolCallsMade: number, usage: AgentRecord['usage'] | undefined) => void;
27
28
  readonly emitOrchestrationCompleted: (record: AgentRecord, output: string) => void;
28
29
  readonly emitStreamDelta: (recordId: string, content: string, accumulated: string) => void;
30
+ /**
31
+ * Wave-3 conversation-snapshot bridge (Part C6): register the running
32
+ * agent's live snapshot accessor with AgentManager so
33
+ * AgentManager.getConversationSnapshot(agentId) can serve a full-fidelity
34
+ * live transcript to a fleet tab. Optional — contexts that don't wire a
35
+ * manager (e.g. isolated tests) simply skip the bridge.
36
+ */
37
+ readonly registerConversationSource?: ((agentId: string, source: () => ConversationMessageSnapshot[]) => void) | undefined;
38
+ /**
39
+ * Release the live source at run end, freezing one final snapshot into
40
+ * AgentManager's bounded retention ring (see manager.ts). Always safe to
41
+ * call even when register was never called for this agentId.
42
+ */
43
+ readonly releaseConversationSource?: ((agentId: string) => void) | undefined;
44
+ /**
45
+ * Wave-4 cooperative cancellation bridge (wo701): look up the AbortSignal
46
+ * an orchestration-engine work item registered for this agent, if any.
47
+ * Threaded into `toolRegistry.execute` opts so opted-in tools (exec,
48
+ * fetch) can abort an in-flight child process/request the instant
49
+ * `engine.kill(itemId)` fires, instead of waiting for the next turn
50
+ * boundary's `record.status === 'cancelled'` poll below. Optional —
51
+ * contexts that don't wire an orchestration engine simply omit it and
52
+ * every tool call runs with `opts` undefined, unchanged from before.
53
+ */
54
+ readonly getCancellationSignal?: ((agentId: string) => AbortSignal | undefined) | undefined;
29
55
  readonly processManager?: ProcessManager | undefined;
30
56
  readonly messageBus: Pick<AgentMessageBus, 'getMessages'>;
31
57
  readonly knowledgeService?: Pick<KnowledgeService, 'buildPromptPacketSync'> | undefined;
32
- readonly memoryRegistry?: Pick<import('../state/index.js').MemoryRegistry, 'getAll' | 'searchSemantic'> | undefined;
58
+ readonly memoryRegistry?: Pick<import('../state/index.js').MemoryRegistry, 'getAll' | 'searchSemantic' | 'vectorStats'> | undefined;
59
+ /**
60
+ * Wave-5 (wo801, W5.1) per-turn passive-injection knobs. Both optional —
61
+ * undefined means "use the derived default" (see turn-knowledge-injection.ts:
62
+ * defaultTurnKnowledgeBudgetTokens / DEFAULT_TURN_KNOWLEDGE_RELEVANCE_FLOOR).
63
+ * Setting passiveKnowledgeInjectionBudgetTokens to 0 is the config-level
64
+ * hard no-op: the feature never runs and the base system prompt is
65
+ * byte-identical, independent of the feature flag's own state.
66
+ */
67
+ readonly passiveKnowledgeInjectionBudgetTokens?: number | undefined;
68
+ readonly passiveKnowledgeInjectionRelevanceFloor?: number | undefined;
33
69
  readonly archetypeLoader?: {
34
70
  loadArchetype(template: string): {
35
71
  systemPrompt?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator-runner.d.ts","sourceRoot":"","sources":["../../../src/platform/agents/orchestrator-runner.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAMtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAMnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,WA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AAG;IACzB,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC,CAAC;AAqBF,wBAAgB,mCAAmC,CACjD,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EAAE,iBAAiB,GAAG,YAAY,CAAC,EAC1E,WAAW,EAAE,mBAAmB,GAC/B,eAAe,CAuBjB;AAiQD,wBAAsB,YAAY,CAChC,OAAO,EAAE,2BAA2B,EACpC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,IAAI,CAAC,CAwef"}
@@ -13,8 +13,10 @@ import { ConsecutiveErrorBreaker } from '../core/circuit-breaker.js';
13
13
  import { isRateLimitOrQuotaError, isContextSizeExceededError, isNetworkTransportError } from '../types/errors.js';
14
14
  import { AgentSession } from './session.js';
15
15
  import { estimateTokens, estimateConversationTokens, compactSmallWindow, } from '../core/context-compaction.js';
16
+ import { emitCommunicationConsumed } from '../runtime/emitters/index.js';
16
17
  import { summarizeToolArgs } from './orchestrator-utils.js';
17
18
  import { buildLayeredOrchestratorSystemPrompt, buildOrchestratorSystemPrompt } from './orchestrator-prompts.js';
19
+ import { buildPerTurnKnowledgeInjection, defaultTurnKnowledgeBudgetTokens, recordTurnInjection, DEFAULT_TURN_KNOWLEDGE_RELEVANCE_FLOOR, } from './turn-knowledge-injection.js';
18
20
  import { summarizeError } from '../utils/error-display.js';
19
21
  import { resolveScopedDirectory } from '../runtime/surface-root.js';
20
22
  import { appendGoodVibesRuntimeAwarenessPrompt } from '../tools/goodvibes-runtime/index.js';
@@ -133,7 +135,8 @@ async function executeToolCalls(toolCalls, toolRegistry, session, turn, record,
133
135
  }
134
136
  const callSig = `${call.name}::${JSON.stringify(call.arguments)}`;
135
137
  try {
136
- const result = await toolRegistry.execute(call.id, call.name, call.arguments);
138
+ const signal = context.getCancellationSignal?.(record.id);
139
+ const result = await toolRegistry.execute(call.id, call.name, call.arguments, signal ? { signal } : undefined);
137
140
  results.push({ ...result, callId: call.id });
138
141
  session.appendMessage({
139
142
  type: 'tool_execution',
@@ -291,7 +294,23 @@ export async function runAgentTask(context, record) {
291
294
  : 0;
292
295
  conversation = new ConversationManager();
293
296
  conversation.addUserMessage(record.task);
297
+ // Wave-3 Part C6 bridge: hand AgentManager a live accessor onto THIS
298
+ // ConversationManager instance so a fleet tab can render a full-fidelity
299
+ // transcript while the agent runs. `activeConversation` is a separate
300
+ // const (rather than closing over the outer `let conversation`) so the
301
+ // closure's type is non-nullable without a runtime assertion.
302
+ const activeConversation = conversation;
303
+ context.registerConversationSource?.(record.id, () => activeConversation.getMessageSnapshot());
294
304
  let systemPrompt = buildOrchestratorSystemPrompt(record, undefined, context);
305
+ // Wave-5 (wo801, W5.1) per-turn passive-injection state. `knowledgeIdsAlreadySurfaced`
306
+ // seeds from the spawn-time baseline (record.knowledgeInjections, just populated by the
307
+ // call above) and grows with every id a later turn injects, so no record is ever listed
308
+ // twice across the whole run. `priorTurnKnowledgeBlock` is the last successfully-built
309
+ // block, reused verbatim on turns where nothing new arrived (see newUserInputThisTurn
310
+ // below) — it is composed onto the CURRENT `systemPrompt` fresh every turn (see
311
+ // composeTurnSystemPrompt), never written back into the cached `systemPrompt` let itself.
312
+ const knowledgeIdsAlreadySurfaced = new Set((record.knowledgeInjections ?? []).map((entry) => entry.id));
313
+ let priorTurnKnowledgeBlock = null;
295
314
  let continueLoop = true;
296
315
  let turn = 0;
297
316
  record.progress = 'Turn 1 · Thinking…';
@@ -338,6 +357,16 @@ export async function runAgentTask(context, record) {
338
357
  }
339
358
  session.appendMessage({ type: 'llm_request', turn, messageCount: conversation.getMessagesForLLM().length, timestamp: new Date().toISOString() });
340
359
  const pending = context.messageBus.getMessages(record.id);
360
+ // Steers drained into the conversation THIS turn, awaiting the "consumed"
361
+ // signal below — deferred until the turn's chat call actually succeeds.
362
+ // See the comment at the emission site for why this can't fire here.
363
+ const drainedSteerMessageIds = [];
364
+ // Wave-5 (wo801, W5.1): true when this turn actually added new content to the
365
+ // conversation the model will see — turn 1 (the initial task) or any steer/directive
366
+ // drained just above. Gates per-turn knowledge re-retrieval: no new input means the
367
+ // evolving-conversation query would be identical to last turn's, so the prior turn's
368
+ // block is reused verbatim instead of re-running retrieval for no behavioral gain.
369
+ let newUserInputThisTurn = turn === 1;
341
370
  for (const msg of pending) {
342
371
  // Skip the agent's own broadcasts and any message already injected on a
343
372
  // prior turn so each directive is surfaced to the model exactly once.
@@ -346,14 +375,109 @@ export async function runAgentTask(context, record) {
346
375
  if (injectedMessageIds.has(msg.id))
347
376
  continue;
348
377
  injectedMessageIds.add(msg.id);
349
- const kindLabel = (msg.kind[0] ?? '').toUpperCase() + msg.kind.slice(1);
350
- conversation.addUserMessage(`[${kindLabel} from ${msg.from}]: ${msg.content}`);
378
+ newUserInputThisTurn = true;
379
+ if (msg.kind === 'steer') {
380
+ // A human steer (ProcessRegistry.steer) is a genuine user turn, not
381
+ // an inter-agent directive — inject it verbatim, with none of the
382
+ // "[Kind from sender]" framing used for agent-to-agent messages.
383
+ conversation.addUserMessage(msg.content);
384
+ drainedSteerMessageIds.push(msg.id);
385
+ }
386
+ else {
387
+ const kindLabel = (msg.kind[0] ?? '').toUpperCase() + msg.kind.slice(1);
388
+ conversation.addUserMessage(`[${kindLabel} from ${msg.from}]: ${msg.content}`);
389
+ }
351
390
  }
352
- if (context.featureFlagManager?.isEnabled('agent-context-window-awareness') ?? true) {
391
+ const contextWindowAwarenessEnabled = context.featureFlagManager?.isEnabled('agent-context-window-awareness') ?? true;
392
+ const passiveKnowledgeInjectionEnabled = context.featureFlagManager?.isEnabled('agent-passive-knowledge-injection') ?? true;
393
+ // Resolved once per turn (used by both the awareness check below and the per-turn
394
+ // knowledge budget), rather than only inside the awareness branch, so the passive-
395
+ // injection budget can derive "3% of context window" even when context-window
396
+ // awareness itself is disabled.
397
+ let contextWindowForTurn = 0;
398
+ if (contextWindowAwarenessEnabled || passiveKnowledgeInjectionEnabled) {
353
399
  const modelDef = resolveContextWindowModelDefinition(providerRegistry, activeRoute);
354
- const contextWindow = context.providerRegistry.getContextWindowForModel(modelDef);
355
- systemPrompt = applyContextWindowAwareness(context, record, activeRoute.modelId, contextWindow, conversation, systemPrompt, toolTokens, turn);
400
+ contextWindowForTurn = context.providerRegistry.getContextWindowForModel(modelDef);
401
+ }
402
+ if (contextWindowAwarenessEnabled) {
403
+ systemPrompt = applyContextWindowAwareness(context, record, activeRoute.modelId, contextWindowForTurn, conversation, systemPrompt, toolTokens, turn);
404
+ }
405
+ // Wave-5 (wo801, W5.1): per-turn passive knowledge injection. Gated on the feature
406
+ // flag AND on there being new conversation input this turn; otherwise
407
+ // priorTurnKnowledgeBlock (unchanged) is reused. `priorTurnKnowledgeBlock` and
408
+ // `systemPrompt` are combined into a request-time-only string just below
409
+ // (composeTurnSystemPrompt) — the block is NEVER written back into the `systemPrompt`
410
+ // let, so it cannot compound turn over turn even across the emergency-compaction
411
+ // retry path (which DOES reassign `systemPrompt`) inside the chat-retry loop.
412
+ if (passiveKnowledgeInjectionEnabled && newUserInputThisTurn && context.memoryRegistry) {
413
+ const configuredBudget = context.passiveKnowledgeInjectionBudgetTokens
414
+ ?? defaultTurnKnowledgeBudgetTokens(contextWindowForTurn);
415
+ let turnBudgetTokens = configuredBudget;
416
+ if (contextWindowAwarenessEnabled && contextWindowForTurn > 0) {
417
+ // Clamp the block's budget to whatever headroom is left under the SAME 85%
418
+ // compaction threshold applyContextWindowAwareness just enforced on the base
419
+ // prompt, so base+block can never silently exceed it even though the block is
420
+ // composed after that check ran (risk: B-tier token dishonesty otherwise).
421
+ const msgTokensForBudget = estimateConversationTokens(conversation.getMessagesForLLM());
422
+ const sysTokensForBudget = estimateTokens(systemPrompt);
423
+ const threshold = Math.floor(contextWindowForTurn * CONTEXT_COMPACT_THRESHOLD);
424
+ const headroomTokens = threshold - msgTokensForBudget - sysTokensForBudget - toolTokens;
425
+ turnBudgetTokens = Math.max(0, Math.min(configuredBudget, headroomTokens));
426
+ }
427
+ if (turnBudgetTokens > 0) {
428
+ const relevanceFloor = context.passiveKnowledgeInjectionRelevanceFloor ?? DEFAULT_TURN_KNOWLEDGE_RELEVANCE_FLOOR;
429
+ const { block, record: turnInjectionRecord } = buildPerTurnKnowledgeInjection({
430
+ memoryRegistry: context.memoryRegistry,
431
+ task: record.task,
432
+ writeScope: record.writeScope ?? [],
433
+ conversationTail: conversation.getMessagesForLLM(),
434
+ budgetTokens: turnBudgetTokens,
435
+ relevanceFloor,
436
+ alreadyInjectedIds: [...knowledgeIdsAlreadySurfaced],
437
+ turn,
438
+ });
439
+ priorTurnKnowledgeBlock = block;
440
+ for (const id of turnInjectionRecord.injectedIds)
441
+ knowledgeIdsAlreadySurfaced.add(id);
442
+ record.turnInjections = recordTurnInjection(record.turnInjections, turnInjectionRecord);
443
+ session.appendMessage({ type: 'knowledge_injection', ...turnInjectionRecord });
444
+ }
445
+ else {
446
+ // Hard no-op: no budget headroom this turn. Never call into retrieval for a
447
+ // budget that's already known to be zero, and never claim a block that can't
448
+ // exist — no record, no session message, prior block cleared so the composed
449
+ // prompt below falls back to the base systemPrompt exactly.
450
+ priorTurnKnowledgeBlock = null;
451
+ }
356
452
  }
453
+ // Wave-5 (wo801, W5.1): compose the per-turn knowledge block onto the base
454
+ // systemPrompt fresh at EVERY call site (including each chat-retry iteration below),
455
+ // instead of hoisting a single `const turnSystemPrompt` computed once before the
456
+ // retry loop. This matters because the emergency-compaction retry path inside that
457
+ // loop reassigns the outer `systemPrompt` let (buildLayeredOrchestratorSystemPrompt)
458
+ // — a hoisted const would go stale and keep resubmitting the pre-compaction prompt,
459
+ // silently defeating that retry. Composing here also re-validates fit on every call:
460
+ // if base+block would exceed the SAME 85% compaction threshold applyContextWindowAwareness
461
+ // enforces (using live, current-call token counts, not turn-start estimates), the block
462
+ // is dropped for that call only — this is the safety net for a REUSED block (one that
463
+ // was sized against a headroom estimate one or more turns ago and may no longer fit,
464
+ // e.g. after several no-new-input turns of tool-result growth). It never mutates
465
+ // `priorTurnKnowledgeBlock` or the stored TurnInjectionRecord, both of which honestly
466
+ // reflect what retrieval computed at the time it ran.
467
+ const composeTurnSystemPrompt = (base) => {
468
+ if (!priorTurnKnowledgeBlock)
469
+ return base;
470
+ if (contextWindowAwarenessEnabled && contextWindowForTurn > 0) {
471
+ const liveMsgTokens = estimateConversationTokens(activeConversation.getMessagesForLLM());
472
+ const liveSysTokens = estimateTokens(base);
473
+ const liveBlockTokens = estimateTokens(priorTurnKnowledgeBlock);
474
+ const threshold = Math.floor(contextWindowForTurn * CONTEXT_COMPACT_THRESHOLD);
475
+ if (liveMsgTokens + liveSysTokens + liveBlockTokens + toolTokens > threshold) {
476
+ return base;
477
+ }
478
+ }
479
+ return `${base}\n\n${priorTurnKnowledgeBlock}`;
480
+ };
357
481
  let response;
358
482
  {
359
483
  let networkAttempt = 0;
@@ -380,7 +504,7 @@ export async function runAgentTask(context, record) {
380
504
  model: activeRoute.modelId,
381
505
  messages: conversation.getMessagesForLLM(),
382
506
  tools: toolDefinitions.length > 0 ? toolDefinitions : undefined,
383
- systemPrompt: appendGoodVibesRuntimeAwarenessPrompt(systemPrompt),
507
+ systemPrompt: appendGoodVibesRuntimeAwarenessPrompt(composeTurnSystemPrompt(systemPrompt)),
384
508
  ...(record.reasoningEffort ? { reasoningEffort: record.reasoningEffort } : {}),
385
509
  onDelta,
386
510
  });
@@ -461,6 +585,24 @@ export async function runAgentTask(context, record) {
461
585
  record.streamingContent = undefined;
462
586
  record.progress = `Turn ${turn} · Thinking…`;
463
587
  }
588
+ // Honest "consumed at boundary" signal, emitted here (not at drain time
589
+ // above) because this is the first point in the turn where the chat
590
+ // call is KNOWN to have succeeded. If the call above exhausted its
591
+ // retries/fallbacks, it throws and unwinds out of this function (caught
592
+ // by the outer try/catch → handleAgentRunFailure) without ever reaching
593
+ // this line — so a steer drained into a turn whose chat then fails
594
+ // never gets a consumed signal it didn't earn. Never emit this from
595
+ // AgentMessageBus.send() itself — that fires eagerly, before the agent
596
+ // has any chance to see the message.
597
+ if (context.runtimeBus) {
598
+ for (const messageId of drainedSteerMessageIds) {
599
+ emitCommunicationConsumed(context.runtimeBus, context.emitterContext(record.id), {
600
+ messageId,
601
+ agentId: record.id,
602
+ turn,
603
+ });
604
+ }
605
+ }
464
606
  session.appendMessage({ type: 'llm_response', turn, contentLength: response.content.length, toolCallCount: response.toolCalls.length, usage: response.usage, timestamp: new Date().toISOString() });
465
607
  record.usage = {
466
608
  inputTokens: (record.usage?.inputTokens ?? 0) + response.usage.inputTokens,
@@ -539,4 +681,13 @@ export async function runAgentTask(context, record) {
539
681
  catch (err) {
540
682
  await handleAgentRunFailure(context, record, conversation, session, preAgentProcessIds, err);
541
683
  }
684
+ finally {
685
+ // Wave-3 Part C6 bridge: release on EVERY exit path (normal completion,
686
+ // the mid-loop cancellation/MAX_TURNS early returns above, and the catch
687
+ // above) so the live source is never retained past the run and a final
688
+ // snapshot always lands in AgentManager's retention ring. A no-op when
689
+ // register was never called (e.g. failure before the ConversationManager
690
+ // was created).
691
+ context.releaseConversationSource?.(record.id);
692
+ }
542
693
  }
@@ -1,5 +1,6 @@
1
1
  import { ToolRegistry } from '../tools/registry.js';
2
2
  import type { ConfigManager } from '../config/manager.js';
3
+ import type { ConversationMessageSnapshot } from '../core/conversation.js';
3
4
  import type { ProviderRegistry } from '../providers/registry.js';
4
5
  import { AgentMessageBus } from './message-bus.js';
5
6
  import type { ChannelPluginRegistry } from '../channels/index.js';
@@ -10,6 +11,29 @@ import type { ToolLLM } from '../config/tool-llm.js';
10
11
  import type { FeatureFlagManager } from '../runtime/feature-flags/manager.js';
11
12
  import type { RuntimeEventBus } from '../runtime/events/index.js';
12
13
  export { summarizeToolArgs } from './orchestrator-utils.js';
14
+ /**
15
+ * Wave-3 Part C6 bridge: where AgentOrchestrator forwards a running agent's
16
+ * live conversation-snapshot accessor. In production this is AgentManager's
17
+ * registerConversationSource/releaseConversationSource, wired post-
18
+ * construction in runtime/services.ts (AgentOrchestrator is constructed
19
+ * before AgentManager there, so this is a setter rather than a constructor
20
+ * dependency — same pattern as setRuntimeBus).
21
+ */
22
+ export interface AgentConversationSink {
23
+ readonly register: (agentId: string, source: () => ConversationMessageSnapshot[]) => void;
24
+ readonly release: (agentId: string) => void;
25
+ }
26
+ /**
27
+ * Wave-4 cooperative cancellation bridge (wo701): where AgentOrchestrator
28
+ * looks up a per-agent AbortSignal registered by an orchestration engine's
29
+ * work-item run. Same shape/wiring precedent as AgentConversationSink — a
30
+ * setter rather than a constructor dependency, wired post-construction in
31
+ * runtime/services.ts (production backing is
32
+ * AgentManager.registerCancellationSignal/getCancellationSignal).
33
+ */
34
+ export interface AgentCancellationSource {
35
+ readonly get: (agentId: string) => AbortSignal | undefined;
36
+ }
13
37
  type AgentOrchestratorToolDeps = {
14
38
  readonly fileCache: FileStateCache;
15
39
  readonly projectIndex: ProjectIndex;
@@ -50,6 +74,8 @@ export declare class AgentOrchestrator {
50
74
  private toolDeps;
51
75
  private featureFlagManager;
52
76
  private runtimeBus;
77
+ private conversationSink;
78
+ private cancellationSource;
53
79
  private readonly channelRegistry;
54
80
  private readonly messageBus;
55
81
  constructor(config?: {
@@ -59,6 +85,20 @@ export declare class AgentOrchestrator {
59
85
  setRuntimeBus(runtimeBus: RuntimeEventBus | null): void;
60
86
  /** Set the FeatureFlagManager for context-window awareness gating. */
61
87
  setFeatureFlagManager(manager: FeatureFlagManager): void;
88
+ /**
89
+ * Wire the Wave-3 Part C6 conversation-snapshot bridge (see
90
+ * AgentConversationSink). Pass null to detach — createRunContext() then
91
+ * omits the register/release callbacks entirely and orchestrator-runner's
92
+ * `?.()` calls become no-ops.
93
+ */
94
+ setConversationSink(sink: AgentConversationSink | null): void;
95
+ /**
96
+ * Wire the Wave-4 cancellation bridge (see AgentCancellationSource). Pass
97
+ * null to detach — createRunContext() then omits getCancellationSignal
98
+ * entirely and orchestrator-runner's `?.()` call becomes a no-op, so every
99
+ * tool call runs with `opts` undefined exactly as before this change.
100
+ */
101
+ setCancellationSource(source: AgentCancellationSource | null): void;
62
102
  private emitterContext;
63
103
  private emitAgentProgress;
64
104
  private emitOrchestrationProgress;
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../../src/platform/agents/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAGlE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAgBlE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAa5D,KAAK,yBAAyB,GAAG;IAC/B,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,eAAe,EAAE,OAAO,uBAAuB,EAAE,eAAe,CAAC;IAC1E,QAAQ,CAAC,WAAW,EAAE,OAAO,0BAA0B,EA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A6B;IA+BrC,OAAO,CAAC,4BAA4B;IAOpC,OAAO,CAAC,sBAAsB;IA4D9B,OAAO,CAAC,yBAAyB;IAIjC,OAAO,CAAC,4BAA4B;IAQpC,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,0BAA0B;IA+BlC,OAAO,CAAC,gBAAgB;IA2CxB,uDAAuD;IACjD,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnD"}
@@ -24,6 +24,8 @@ export class AgentOrchestrator {
24
24
  toolDeps = null;
25
25
  featureFlagManager = null;
26
26
  runtimeBus = null;
27
+ conversationSink = null;
28
+ cancellationSource = null;
27
29
  channelRegistry;
28
30
  messageBus;
29
31
  constructor(config = {
@@ -39,6 +41,24 @@ export class AgentOrchestrator {
39
41
  setFeatureFlagManager(manager) {
40
42
  this.featureFlagManager = manager;
41
43
  }
44
+ /**
45
+ * Wire the Wave-3 Part C6 conversation-snapshot bridge (see
46
+ * AgentConversationSink). Pass null to detach — createRunContext() then
47
+ * omits the register/release callbacks entirely and orchestrator-runner's
48
+ * `?.()` calls become no-ops.
49
+ */
50
+ setConversationSink(sink) {
51
+ this.conversationSink = sink;
52
+ }
53
+ /**
54
+ * Wire the Wave-4 cancellation bridge (see AgentCancellationSource). Pass
55
+ * null to detach — createRunContext() then omits getCancellationSignal
56
+ * entirely and orchestrator-runner's `?.()` call becomes a no-op, so every
57
+ * tool call runs with `opts` undefined exactly as before this change.
58
+ */
59
+ setCancellationSource(source) {
60
+ this.cancellationSource = source;
61
+ }
42
62
  emitterContext(agentId) {
43
63
  return {
44
64
  sessionId: 'agent-orchestrator',
@@ -344,6 +364,15 @@ export class AgentOrchestrator {
344
364
  emitAgentCompletedEvent: (recordId, durationMs, output, toolCallsMade, usage) => this.emitAgentCompletedEvent(recordId, durationMs, output, toolCallsMade, usage),
345
365
  emitOrchestrationCompleted: (record, output) => this.emitOrchestrationCompleted(record, output),
346
366
  emitStreamDelta: (recordId, content, accumulated) => this.emitStreamDelta(recordId, content, accumulated),
367
+ registerConversationSource: this.conversationSink
368
+ ? (agentId, source) => this.conversationSink.register(agentId, source)
369
+ : undefined,
370
+ releaseConversationSource: this.conversationSink
371
+ ? (agentId) => this.conversationSink.release(agentId)
372
+ : undefined,
373
+ getCancellationSignal: this.cancellationSource
374
+ ? (agentId) => this.cancellationSource.get(agentId)
375
+ : undefined,
347
376
  processManager: this.toolDeps?.processManager,
348
377
  messageBus: this.messageBus,
349
378
  knowledgeService: this.toolDeps?.knowledgeService,