@wrongstack/core 0.265.1 → 0.268.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 (75) hide show
  1. package/dist/{agent-bridge-DrkBxszZ.d.ts → agent-bridge-UhojbpWx.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-DM2pP-B6.d.ts → agent-subagent-runner-Bvtf1o9K.d.ts} +25 -7
  3. package/dist/{brain-BXd_61kQ.d.ts → brain-69wzMKp1.d.ts} +73 -1
  4. package/dist/{compactor-B8pOf45Y.d.ts → compactor-CBQAJoDc.d.ts} +19 -1
  5. package/dist/{config-BMCj_XDs.d.ts → config-VKfOZ-6X.d.ts} +122 -3
  6. package/dist/{context-MRk5PhNv.d.ts → context-C0U8B9NF.d.ts} +88 -1
  7. package/dist/coordination/index.d.ts +57 -161
  8. package/dist/coordination/index.js +471 -177
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +26 -25
  11. package/dist/defaults/index.js +1818 -844
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +72 -16
  14. package/dist/execution/index.js +1270 -265
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/execution/prompt-enhancer.d.ts +1 -1
  17. package/dist/extension/index.d.ts +7 -6
  18. package/dist/global-mailbox-KByEFFBa.d.ts +663 -0
  19. package/dist/{goal-preamble-DvHDSKSe.d.ts → goal-preamble-CrYjmdw4.d.ts} +28 -11
  20. package/dist/{goal-store-DtLMySNb.d.ts → goal-store-Y_zdLZ3q.d.ts} +1 -1
  21. package/dist/hq/index.d.ts +195 -0
  22. package/dist/hq/index.js +1884 -0
  23. package/dist/hq/index.js.map +1 -0
  24. package/dist/index-BfaS-f_m.d.ts +82 -0
  25. package/dist/{index-B-ch8K9C.d.ts → index-CtQnmkaS.d.ts} +8 -8
  26. package/dist/{index-CEDeNodM.d.ts → index-gCv830d7.d.ts} +5 -5
  27. package/dist/index.d.ts +124 -47
  28. package/dist/index.js +5600 -2662
  29. package/dist/index.js.map +1 -1
  30. package/dist/infrastructure/index.d.ts +6 -6
  31. package/dist/infrastructure/index.js +117 -19
  32. package/dist/infrastructure/index.js.map +1 -1
  33. package/dist/kernel/index.d.ts +10 -9
  34. package/dist/kernel/index.js.map +1 -1
  35. package/dist/{pipeline-DPDxH_7m.d.ts → mailbox-types-Ct2hJq0P.d.ts} +1 -244
  36. package/dist/{mcp-servers-2x4w6Jn9.d.ts → mcp-servers-HT3Fi7Bl.d.ts} +10 -4
  37. package/dist/models/index.d.ts +5 -5
  38. package/dist/models/index.js +33 -3
  39. package/dist/models/index.js.map +1 -1
  40. package/dist/{models-registry-DmJlKuNp.d.ts → models-registry-Bvcl3Vaa.d.ts} +1 -1
  41. package/dist/{multi-agent-coordinator-DyCkCZnU.d.ts → multi-agent-coordinator-BACjsmkC.d.ts} +1 -1
  42. package/dist/{null-fleet-bus-CG9QY2aP.d.ts → null-fleet-bus-DA7fvhUg.d.ts} +14 -9
  43. package/dist/observability/index.d.ts +2 -2
  44. package/dist/{parallel-eternal-engine-Jw9uhEoT.d.ts → parallel-eternal-engine-Ci71gYu_.d.ts} +11 -15
  45. package/dist/{path-resolver-Dy2ej-gE.d.ts → path-resolver-O1IJnmKE.d.ts} +4 -3
  46. package/dist/{permission-B9SB45lp.d.ts → permission-Bd-57Lbl.d.ts} +1 -1
  47. package/dist/{permission-policy-CkjSXabK.d.ts → permission-policy-uNXC6Kge.d.ts} +2 -3
  48. package/dist/pipeline-BDNvENyV.d.ts +245 -0
  49. package/dist/{plan-templates-CzD9GnAU.d.ts → plan-templates-EMsalEtN.d.ts} +5 -5
  50. package/dist/{llm-selector-C0tfTCUe.d.ts → provider-model-resolve-CEb9x886.d.ts} +40 -3
  51. package/dist/{provider-runner-DMa70ODu.d.ts → provider-runner-DWJbpo70.d.ts} +3 -3
  52. package/dist/{retry-policy-CN0khdlj.d.ts → retry-policy-C3s_lvdK.d.ts} +1 -1
  53. package/dist/sdd/index.d.ts +9 -8
  54. package/dist/sdd/index.js +44 -14
  55. package/dist/sdd/index.js.map +1 -1
  56. package/dist/{secret-vault-B2yw84VT.d.ts → secret-vault-Cgduf5xL.d.ts} +2 -2
  57. package/dist/security/index.d.ts +5 -67
  58. package/dist/security/index.js +129 -99
  59. package/dist/security/index.js.map +1 -1
  60. package/dist/{selector-CzHh_igB.d.ts → selector-47LBnBVk.d.ts} +1 -1
  61. package/dist/{session-event-bridge-BUI6Jf-4.d.ts → session-event-bridge-Cw7oqmW2.d.ts} +1 -1
  62. package/dist/{session-reader-CMgdMSRP.d.ts → session-reader-DD4v2Obw.d.ts} +1 -1
  63. package/dist/storage/index.d.ts +14 -12
  64. package/dist/storage/index.js +144 -120
  65. package/dist/storage/index.js.map +1 -1
  66. package/dist/tools/index.d.ts +4 -2
  67. package/dist/tools/index.js +166 -31
  68. package/dist/tools/index.js.map +1 -1
  69. package/dist/types/index.d.ts +20 -19
  70. package/dist/types/index.js +1358 -476
  71. package/dist/types/index.js.map +1 -1
  72. package/dist/utils/index.d.ts +472 -405
  73. package/dist/utils/index.js +2321 -1193
  74. package/dist/utils/index.js.map +1 -1
  75. package/package.json +5 -1
@@ -1,23 +1,25 @@
1
- import { E as EventBus, B as BrainArbiter, f as BrainDecisionOption, k as BrainRisk, h as BrainDecisionRequest, e as BrainDecision, i as BrainDecisionSource } from '../brain-BXd_61kQ.js';
2
- export { g as BrainDecisionQueue, j as BrainFallback, D as DefaultBrainArbiter, l as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, w as formatHumanPrompt } from '../brain-BXd_61kQ.js';
3
- import { H as FleetManager, s as Director } from '../null-fleet-bus-CG9QY2aP.js';
4
- export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, h as BugFinding, C as CollabBudgetConfig, i as CollabBudgetOverrides, j as CollabBudgetWarningPayload, k as CollabDebugReport, l as CollabSession, m as CollabSessionOptions, n as CreateDelegateToolOptions, o as CriticConcern, p as CriticEvaluation, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, t as DirectorAlert, u as DirectorAlertLevel, v as DirectorCancelCollabPayload, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, N as LargeAnswerStore, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, P as RefactorPhase, Q as RefactorPlan, S as SECURITY_SCANNER_AGENT, T as SharedFileEntry, U as SharedFileSnapshot, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a0 as makeAskResultTool, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, ae as makeWorkCompleteTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-CG9QY2aP.js';
5
- import { b as AgentDefinition } from '../multi-agent-coordinator-DyCkCZnU.js';
6
- export { T as AGENT_TOOL_PRESETS, c as AgentBudgetTier, d as AgentCapability, A as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, H as HEAVY_BUDGET, L as LIGHT_BUDGET, M as MEDIUM_BUDGET, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-DyCkCZnU.js';
7
- import { F as FleetBus } from '../agent-subagent-runner-DM2pP-B6.js';
8
- export { h as AgentFactory, v as AgentFactoryResult, w as AgentRunnerOptions, x as BudgetExceededError, y as BudgetKind, z as BudgetLimits, E as BudgetNegotiationMode, G as BudgetThresholdDecision, H as BudgetThresholdHandler, I as BudgetThresholdSignal, J as BudgetUsage, L as DECISION_TIMEOUT_MS, N as FleetEvent, O as FleetHandler, i as FleetUsage, j as FleetUsageAggregator, Q as SubagentBudget, Y as SubagentUsageSnapshot, Z as TIMEOUT_PREEMPT_FRACTION, $ as makeAgentSubagentRunner, a0 as withDisabledToolFiltering } from '../agent-subagent-runner-DM2pP-B6.js';
9
- export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-DrkBxszZ.js';
10
- import { c as Mailbox, k as MailboxSendInput, d as MailboxMessage, j as MailboxQuery, g as MailboxAckInput, s as MailboxAckBatchInput, h as MailboxAgentStatus, e as AgentRegistrationInput, A as AgentHeartbeatInput, t as PurgeOptions, u as PurgeResult, v as ClientRegistrationInput, w as ClientHeartbeatInput, x as ClientStatus } from '../pipeline-DPDxH_7m.js';
11
- export { i as MailboxMessageType, l as MailboxTaskContext, o as ReadReceipts, p as RegisteredAgent, r as normalizeRecipient } from '../pipeline-DPDxH_7m.js';
12
- import { C as Context, T as Tool } from '../context-MRk5PhNv.js';
1
+ import { E as EventBus, B as BrainArbiter, f as BrainDecisionOption, k as BrainRisk, h as BrainDecisionRequest, e as BrainDecision, i as BrainDecisionSource } from '../brain-69wzMKp1.js';
2
+ export { g as BrainDecisionQueue, j as BrainFallback, D as DefaultBrainArbiter, l as DefaultBrainArbiterOptions, H as HumanEscalatingBrainArbiter, O as ObservableBrainArbiter, w as formatHumanPrompt } from '../brain-69wzMKp1.js';
3
+ import { H as FleetManager, s as Director } from '../null-fleet-bus-DA7fvhUg.js';
4
+ export { A as ACP_AGENTS, a as AGENTS_BY_PHASE, b as AGENT_CATALOG, c as ALL_AGENT_DEFINITIONS, d as ALL_FLEET_AGENTS, e as AUDIT_LOG_AGENT, f as AutoExtendCeiling, g as AutoExtendPolicy, B as BUG_HUNTER_AGENT, h as BugFinding, C as CollabBudgetConfig, i as CollabBudgetOverrides, j as CollabBudgetWarningPayload, k as CollabDebugReport, l as CollabSession, m as CollabSessionOptions, n as CreateDelegateToolOptions, o as CriticConcern, p as CriticEvaluation, D as DEFAULT_DIRECTOR_PREAMBLE, q as DEFAULT_SUBAGENT_BASELINE, r as DelegateHost, t as DirectorAlert, u as DirectorAlertLevel, v as DirectorCancelCollabPayload, w as DirectorPromptParts, x as DirectorSessionFactory, y as DirectorSessionFactoryOptions, F as FLEET_ROSTER, z as FLEET_ROSTER_BUDGETS, E as FLEET_ROSTER_WITHACP, G as FleetCostCapError, I as FleetManagerOptions, J as FleetRosterBudget, K as FleetSpawnBudgetError, L as ICoordinator, M as IFleetManager, N as LargeAnswerStore, O as NULL_FLEET_BUS, R as REFACTOR_PLANNER_AGENT, P as RefactorPhase, Q as RefactorPlan, S as SECURITY_SCANNER_AGENT, T as SharedFileEntry, U as SharedFileSnapshot, V as SubagentPromptParts, W as applyRosterBudget, X as attachAutoExtend, Y as composeDirectorPrompt, Z as composeSubagentPrompt, _ as createDelegateTool, $ as getAgentDefinition, a0 as makeAskResultTool, a1 as makeAskTool, a2 as makeAssignTool, a3 as makeAwaitTasksTool, a4 as makeCollabDebugTool, a5 as makeDirectorSessionFactory, a6 as makeFleetEmitTool, a7 as makeFleetHealthTool, a8 as makeFleetSessionTool, a9 as makeFleetStatusTool, aa as makeFleetUsageTool, ab as makeRollUpTool, ac as makeSpawnTool, ad as makeTerminateTool, ae as makeWorkCompleteTool, af as rosterSummaryFromConfigs } from '../null-fleet-bus-DA7fvhUg.js';
5
+ import { b as AgentDefinition } from '../multi-agent-coordinator-BACjsmkC.js';
6
+ export { T as AGENT_TOOL_PRESETS, c as AgentBudgetTier, d as AgentCapability, A as AgentPhase, e as DEFAULT_DISPATCH_ROLE, a as DefaultMultiAgentCoordinator, f as DispatchCandidate, D as DispatchClassifier, g as DispatchMethod, h as DispatchOptions, i as DispatchResult, H as HEAVY_BUDGET, L as LIGHT_BUDGET, M as MEDIUM_BUDGET, j as MultiAgentCoordinatorOptions, k as dispatchAgent, m as makeLLMClassifier, s as scoreAgents } from '../multi-agent-coordinator-BACjsmkC.js';
7
+ import { F as FleetBus } from '../agent-subagent-runner-Bvtf1o9K.js';
8
+ export { h as AgentFactory, v as AgentFactoryResult, w as AgentRunnerOptions, x as BudgetExceededError, y as BudgetKind, z as BudgetLimits, E as BudgetNegotiationMode, G as BudgetThresholdDecision, H as BudgetThresholdHandler, I as BudgetThresholdSignal, J as BudgetUsage, L as DECISION_TIMEOUT_MS, N as FleetEvent, O as FleetHandler, i as FleetUsage, j as FleetUsageAggregator, Q as SubagentBudget, Y as SubagentUsageSnapshot, Z as TIMEOUT_PREEMPT_FRACTION, $ as makeAgentSubagentRunner, a0 as withDisabledToolFiltering } from '../agent-subagent-runner-Bvtf1o9K.js';
9
+ export { I as InMemoryAgentBridge, a as InMemoryBridgeTransport, c as createMessage } from '../agent-bridge-UhojbpWx.js';
10
+ import { b as Mailbox, c as MailboxSendInput, M as MailboxMessage, d as MailboxQuery, e as MailboxAckInput, f as MailboxAckBatchInput, a as MailboxAgentStatus, A as AgentRegistrationInput, g as AgentHeartbeatInput, P as PurgeOptions, j as PurgeResult, C as ClientRegistrationInput, h as ClientHeartbeatInput, i as ClientStatus } from '../mailbox-types-Ct2hJq0P.js';
11
+ export { k as MailboxMessageType, l as MailboxTaskContext, R as ReadReceipts, m as RegisteredAgent, n as normalizeRecipient } from '../mailbox-types-Ct2hJq0P.js';
12
+ export { G as GlobalMailbox, al as resolveProjectDir } from '../global-mailbox-KByEFFBa.js';
13
+ import { C as Context, T as Tool } from '../context-C0U8B9NF.js';
13
14
  import 'node:events';
14
- import '../director-state-BfeCUbmk.js';
15
- import '../config-BMCj_XDs.js';
16
- import '../index-CEDeNodM.js';
17
15
  import '../logger-B63L5bTg.js';
16
+ import '../director-state-BfeCUbmk.js';
17
+ import '../config-VKfOZ-6X.js';
18
+ import '../index-gCv830d7.js';
19
+ import '../pipeline-BDNvENyV.js';
18
20
  import '../observability-D-HZN_mF.js';
19
- import '../permission-B9SB45lp.js';
20
- import '../retry-policy-CN0khdlj.js';
21
+ import '../permission-Bd-57Lbl.js';
22
+ import '../retry-policy-C3s_lvdK.js';
21
23
 
22
24
  /** Phase 1 · Discovery — map the territory before any work begins. */
23
25
  declare const DISCOVERY_AGENTS: AgentDefinition[];
@@ -151,145 +153,6 @@ declare class BrainMonitor {
151
153
  private maybeIntervene;
152
154
  }
153
155
 
154
- /**
155
- * GlobalMailbox — project-level inter-agent mailbox with cross-session support.
156
- *
157
- * Stores messages at `~/.wrongstack/projects/<slug>/_mailbox.jsonl` so all
158
- * sessions (terminals, WebUIs) working on the same project share one inbox.
159
- *
160
- * Features:
161
- * - Agent registration + heartbeat (agents go stale after 60s without heartbeat)
162
- * - Per-recipient read receipts (readBy[agentId] = ISO8601)
163
- * - Atomic file-locking for concurrent multi-process writes
164
- * - Unread count for new-mail notifications
165
- * - Online agent list
166
- *
167
- * @module GlobalMailbox
168
- */
169
-
170
- /**
171
- * Derive the project-level mailbox directory path.
172
- *
173
- * Delegates to the CANONICAL `projectSlug()` from wstack-paths so every
174
- * surface (CLI, TUI, WebUI, mailbox tool, loop checker) lands in the exact
175
- * same `~/.wrongstack/projects/<slug>/` directory. A previous inline copy
176
- * skipped the leading/trailing-hyphen strip, which silently split agents
177
- * working on projects with non-alphanumeric name edges into TWO mailboxes.
178
- *
179
- * @param projectRoot — absolute path to the project root
180
- * @param globalRoot — `~/.wrongstack` (or custom global root)
181
- */
182
- declare function resolveProjectDir(projectRoot: string, globalRoot: string): string;
183
- declare class GlobalMailbox implements Mailbox {
184
- /** Path to the JSONL message file. */
185
- readonly messagePath: string;
186
- /** Path to the JSON agent registry file. */
187
- readonly registryPath: string;
188
- /** Path to the JSON client registry file. */
189
- readonly clientRegistryPath: string;
190
- /** Optional event bus for emitting agent registration/heartbeat events. */
191
- private readonly _events?;
192
- /**
193
- * Local cache of the agent registry to avoid re-reading on every call.
194
- * Time-bounded: the registry file is shared ACROSS PROCESSES (that's the
195
- * whole point of GlobalMailbox), so a cache served forever would never see
196
- * agents registered by other sessions. Writers always bypass it.
197
- */
198
- private _registryCache;
199
- /** When the registry cache was last refreshed from disk (epoch ms). */
200
- private _registryCacheAt;
201
- /**
202
- * Local cache of the client registry to avoid re-reading on every call.
203
- * Same reasoning as agent registry cache.
204
- */
205
- private _clientRegistryCache;
206
- /** When the client registry cache was last refreshed from disk (epoch ms). */
207
- private _clientRegistryCacheAt;
208
- /** Last time each local agent sent a heartbeat (throttle). */
209
- private _lastHeartbeat;
210
- /** Last time each local client sent a heartbeat (throttle). */
211
- private _lastClientHeartbeat;
212
- /**
213
- * In-memory mirror of the JSONL message file. The mailbox is shared
214
- * ACROSS PROCESSES, so reads cannot trust the cache blindly — we pair it
215
- * with an mtime check. The file lock serializes every write, so a
216
- * changed mtimeMs is a definitive signal that another process (or this
217
- * one) wrote; an unchanged mtimeMs guarantees no write happened and the
218
- * cache is current. This collapses the per-iteration `query()` cost from
219
- * O(file_size) disk + parse to O(messages) in memory.
220
- */
221
- private _messageCache;
222
- /** mtimeMs of the file when `_messageCache` was populated. */
223
- private _messageCacheMtime;
224
- /** Size of the file when `_messageCache` was populated (extra guard). */
225
- private _messageCacheSize;
226
- /**
227
- * @param projectDir — `~/.wrongstack/projects/<slug>/`
228
- * @param events — optional EventBus for real-time TUI/WebUI notifications
229
- */
230
- constructor(projectDir: string, events?: EventBus);
231
- send(input: MailboxSendInput): Promise<MailboxMessage>;
232
- query(q: MailboxQuery): Promise<MailboxMessage[]>;
233
- ack(input: MailboxAckInput): Promise<MailboxMessage | null>;
234
- ackMany(input: MailboxAckBatchInput): Promise<MailboxMessage[]>;
235
- unreadCount(forAgentId: string): Promise<number>;
236
- registerAgent(input: AgentRegistrationInput): Promise<void>;
237
- heartbeat(input: AgentHeartbeatInput): Promise<void>;
238
- getAgentStatuses(): Promise<MailboxAgentStatus[]>;
239
- getOnlineAgents(): Promise<MailboxAgentStatus[]>;
240
- registerClient(input: ClientRegistrationInput): Promise<void>;
241
- clientHeartbeat(input: ClientHeartbeatInput): Promise<void>;
242
- getClientStatuses(): Promise<ClientStatus[]>;
243
- close(): Promise<void>;
244
- clearAll(): Promise<void>;
245
- purgeStale(opts?: PurgeOptions): Promise<PurgeResult>;
246
- /**
247
- * Read all messages from the JSONL file. Always reads + parses the file.
248
- * Callers that can tolerate a stale-by-mtime view should use
249
- * {@link _readMessagesCached}; writers that need the post-lock truth
250
- * should call this directly (it's what {@link _readMessagesFresh} aliases).
251
- */
252
- private _readMessages;
253
- /**
254
- * Read messages, then adopt the result as the in-memory cache. Use this
255
- * from writers that just took the file lock — the read reflects the
256
- * authoritative post-lock state and should be served to subsequent
257
- * queries without re-reading.
258
- */
259
- private _readMessagesFresh;
260
- /**
261
- * Read messages, consulting the mtime-bounded in-memory cache first.
262
- * The mailbox file is shared across processes; every `send`/`ack`/
263
- * `clearAll`/`purgeStale` takes the file lock, so writes are serialized
264
- * and a changed mtimeMs is a definitive freshness signal. When the
265
- * stat matches the cached mtime+size we return the cached array — no
266
- * file read and no JSON.parse — collapsing the per-iteration query
267
- * cost on the mailbox-loop hot path.
268
- */
269
- private _readMessagesCached;
270
- /**
271
- * Replace the in-memory cache. Caller is responsible for guaranteeing
272
- * that `messages` reflects the current on-disk state (e.g. they just
273
- * read or wrote it under the file lock).
274
- */
275
- private _setMessageCache;
276
- /**
277
- * Append a single just-sent message to the in-memory cache without
278
- * re-reading the file. The caller must hold the file lock (or have
279
- * just released it after a successful append) so the cache stays
280
- * consistent with on-disk state.
281
- */
282
- private _pushToCache;
283
- private _ensureRegistry;
284
- private _readRegistry;
285
- private _pruneStaleInPlace;
286
- private _writeRegistry;
287
- private _ensureClientRegistry;
288
- private _readClientRegistry;
289
- private _pruneStaleClientsInPlace;
290
- private _writeClientRegistry;
291
- }
292
-
293
156
  /**
294
157
  * mailbox-tool — Tool that exposes the inter-agent mailbox to agents.
295
158
  *
@@ -1166,17 +1029,17 @@ declare class ConsensusProtocol {
1166
1029
  * Initiate a vote on a proposed change. Updates the change node's status
1167
1030
  * to 'proposed' and notifies eligible voters via FleetBus.
1168
1031
  */
1169
- initiateVote(changeId: string): void;
1032
+ initiateVote(changeId: string): Promise<void>;
1170
1033
  /**
1171
1034
  * Cast a vote. Updates the change node in the graph and re-evaluates
1172
1035
  * consensus. If the vote triggers a resolution, updates the change status.
1173
1036
  */
1174
- castVote(changeId: string, voterId: string, value: VoteValue, rationale?: string): ConsensusResult;
1037
+ castVote(changeId: string, voterId: string, value: VoteValue, rationale?: string): Promise<ConsensusResult>;
1175
1038
  /**
1176
1039
  * Resolve the current vote without waiting for all eligible voters.
1177
1040
  * Useful when a timeout fires or an agent decides to finalize early.
1178
1041
  */
1179
- resolveNow(changeId: string): ConsensusResult;
1042
+ resolveNow(changeId: string): Promise<ConsensusResult>;
1180
1043
  /**
1181
1044
  * Register or update a voter's configuration.
1182
1045
  */
@@ -1760,6 +1623,8 @@ declare class AutonomousCoordinator {
1760
1623
  private readonly onCoordinatorEvent?;
1761
1624
  private running;
1762
1625
  private iterationCount;
1626
+ private lastSyncAt;
1627
+ private static readonly SYNC_INTERVAL_MS;
1763
1628
  /** Tasks already handled by _onSubagentTerminated (to avoid double goal:failed on fleet event). */
1764
1629
  private readonly _handledBySubagent;
1765
1630
  /** FleetBus subscription disposers, detached in dispose(). */
@@ -1772,6 +1637,27 @@ declare class AutonomousCoordinator {
1772
1637
  run(opts?: RunOptions): Promise<CoordinatorStats>;
1773
1638
  /** Stop the autonomous loop. */
1774
1639
  stop(): void;
1640
+ /**
1641
+ * Report that a terminal worker (not a Director subagent) completed a claimed
1642
+ * task. This updates the auction, DAG, publishes a task-result fact, and
1643
+ * extracts follow-up goals — the same path as subagent completion.
1644
+ */
1645
+ reportTaskCompletion(taskId: string, result: string): Promise<void>;
1646
+ /**
1647
+ * Report that a terminal worker failed a claimed task.
1648
+ */
1649
+ reportTaskFailure(taskId: string, error: string): Promise<void>;
1650
+ /**
1651
+ * Reload the KnowledgeGraph from disk and sync the in-memory DAG with any
1652
+ * changes published by other terminal sessions. New goals are added to the
1653
+ * DAG; existing goals whose status changed (e.g. completed by another
1654
+ * terminal) are transitioned accordingly.
1655
+ *
1656
+ * Safe to call at any time — also used internally by the run loop.
1657
+ */
1658
+ syncFromGraph(): Promise<void>;
1659
+ private _syncDagStatuses;
1660
+ private _maybeSyncFromGraph;
1775
1661
  /**
1776
1662
  * Tear down the coordinator for good: stop the loop and detach all FleetBus
1777
1663
  * subscriptions (this coordinator's + the auctioneer's) plus any open bid
@@ -1805,9 +1691,20 @@ declare class AutonomousCoordinator {
1805
1691
  deps?: string[];
1806
1692
  tags?: string[];
1807
1693
  }): Promise<GoalNode>;
1694
+ private _waitForDagProgress;
1695
+ private _dagProgressKey;
1696
+ private _rebuildDagFromGraph;
1697
+ private _rebuildDagNode;
1808
1698
  private _decomposeGoal;
1809
1699
  private _inferCategory;
1810
1700
  private _processGoal;
1701
+ private _stringifyTaskResult;
1702
+ private _completeTask;
1703
+ private _publishTaskResultFact;
1704
+ private _createFollowUpGoalsFromResult;
1705
+ private _extractFollowUps;
1706
+ private _failTask;
1707
+ private _recordTaskFailed;
1811
1708
  private _handlePendingChange;
1812
1709
  private _onDagEvent;
1813
1710
  private _onSubagentTerminated;
@@ -1815,10 +1712,9 @@ declare class AutonomousCoordinator {
1815
1712
  private _buildVoters;
1816
1713
  private _goalToOptions;
1817
1714
  private _optionToGoal;
1818
- private _dagPriorityToGoal;
1819
1715
  private _mailboxBroadcast;
1820
1716
  /** Emit a CoordinatorEvent to the subscriber (e.g. TUI panel timeline). */
1821
1717
  private _emit;
1822
1718
  }
1823
1719
 
1824
- export { AgentDefinition, AgentHeartbeatInput, AgentRegistrationInput, type ApplyResult, type ApprovalDecision, AutonomousBrain, type AutonomousBrainOptions, AutonomousCoordinator, type AutonomousCoordinatorOptions, type AutonomousDecisionRequest, type AutonomousDecisionType, BUILD_AGENTS, BrainArbiter, BrainDecision, BrainDecisionOption, BrainDecisionRequest, BrainDecisionSource, type BrainInterventionInput, BrainMonitor, type BrainMonitorOptions, BrainRisk, type ChangeFile, ChangeManager, type ChangeManagerOptions, type ChangeNode, type ChangeProposal, type ChangeStatus, type ConsensusOptions, ConsensusProtocol, type ConsensusResult, type CoordinatorEvent, type CoordinatorStats, type DAGEdgeEvent, type DAGEdgeHandler, type DAGNode, type DAGNodeStatus, DEFAULT_QUALITY_CHECKS, DELIVERY_AGENTS, DEPENDENCY_FILE_PATTERNS, DISCOVERY_AGENTS, DOMAIN_AGENTS, type DecisionNode, type DecisionPrompt, DefaultMailbox, type DepWatchEntry, type DepWatcherBridgeOptions, type DependencyWatcherConfig, Director, type EscalationDecision, type FactCategory, type FactNode, FleetBus, FleetManager, GlobalMailbox, type GoalNode, type GoalPriority, type GoalStatus, type GraphSubscription, KNOWLEDGE_AGENTS, KnowledgeGraph, type LLMProvider, META_AGENTS, type MailToolsOptions, Mailbox, MailboxAckInput, MailboxAgentStatus, type MailboxHooksOptions, MailboxMessage, MailboxQuery, type MailboxResolver, MailboxSendInput, type MailboxToolOptions, type NodeFilter, type NodeType, type OutdatedNotifyMessage, PLANNING_AGENTS, type PackageAuthorEntry, type PackageAuthorLog, type PackageAuthorTrackerOptions, type PackageOutdatedEntry, type PackageOutdatedResult, type PackageOutdatedWatcherOptions, type PrioritizationDecision, type QualityCheck, type QualityGateChecks, type QualityGateResult, type QuorumRule, REVIEW_AGENTS, type RollbackResult, type RunOptions, type RunnablesHandler, type SpawnDecision, type TaskAuctionOptions, TaskAuctioneer, type TaskBid, TaskDAG, VERIFY_AGENTS, type VoteNode, type VoteRecord, type VoteValue, type VoterConfig, attachDepWatcherBridge, createMailboxHooks, detectEcosystem, getFullPackageLog, getManifestPackages, getPackageAuthor, getPackagesByAgent, mailboxSessionTag, makeDependencyWatcherConfig, makeMailInboxTool, makeMailSendTool, makeMailboxTool, recordPackageAction, resolveMailboxIdentity, resolveProjectDir, startPackageOutdatedWatcher, updatePackageOutdatedStatus };
1720
+ export { AgentDefinition, AgentHeartbeatInput, AgentRegistrationInput, type ApplyResult, type ApprovalDecision, AutonomousBrain, type AutonomousBrainOptions, AutonomousCoordinator, type AutonomousCoordinatorOptions, type AutonomousDecisionRequest, type AutonomousDecisionType, BUILD_AGENTS, BrainArbiter, BrainDecision, BrainDecisionOption, BrainDecisionRequest, BrainDecisionSource, type BrainInterventionInput, BrainMonitor, type BrainMonitorOptions, BrainRisk, type ChangeFile, ChangeManager, type ChangeManagerOptions, type ChangeNode, type ChangeProposal, type ChangeStatus, type ConsensusOptions, ConsensusProtocol, type ConsensusResult, type CoordinatorEvent, type CoordinatorStats, type DAGEdgeEvent, type DAGEdgeHandler, type DAGNode, type DAGNodeStatus, DEFAULT_QUALITY_CHECKS, DELIVERY_AGENTS, DEPENDENCY_FILE_PATTERNS, DISCOVERY_AGENTS, DOMAIN_AGENTS, type DecisionNode, type DecisionPrompt, DefaultMailbox, type DepWatchEntry, type DepWatcherBridgeOptions, type DependencyWatcherConfig, Director, type EscalationDecision, type FactCategory, type FactNode, FleetBus, FleetManager, type GoalNode, type GoalPriority, type GoalStatus, type GraphSubscription, KNOWLEDGE_AGENTS, KnowledgeGraph, type LLMProvider, META_AGENTS, type MailToolsOptions, Mailbox, MailboxAckInput, MailboxAgentStatus, type MailboxHooksOptions, MailboxMessage, MailboxQuery, type MailboxResolver, MailboxSendInput, type MailboxToolOptions, type NodeFilter, type NodeType, type OutdatedNotifyMessage, PLANNING_AGENTS, type PackageAuthorEntry, type PackageAuthorLog, type PackageAuthorTrackerOptions, type PackageOutdatedEntry, type PackageOutdatedResult, type PackageOutdatedWatcherOptions, type PrioritizationDecision, type QualityCheck, type QualityGateChecks, type QualityGateResult, type QuorumRule, REVIEW_AGENTS, type RollbackResult, type RunOptions, type RunnablesHandler, type SpawnDecision, type TaskAuctionOptions, TaskAuctioneer, type TaskBid, TaskDAG, VERIFY_AGENTS, type VoteNode, type VoteRecord, type VoteValue, type VoterConfig, attachDepWatcherBridge, createMailboxHooks, detectEcosystem, getFullPackageLog, getManifestPackages, getPackageAuthor, getPackagesByAgent, mailboxSessionTag, makeDependencyWatcherConfig, makeMailInboxTool, makeMailSendTool, makeMailboxTool, recordPackageAction, resolveMailboxIdentity, startPackageOutdatedWatcher, updatePackageOutdatedStatus };