@wrongstack/core 0.257.2 → 0.260.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 (63) hide show
  1. package/dist/{agent-bridge-BrxWHEOm.d.ts → agent-bridge-BbskZ7HH.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-US741uBH.d.ts → agent-subagent-runner-BNIGZx18.d.ts} +28 -8
  3. package/dist/{brain-TjEEwSpw.d.ts → brain-C2yDd7Lw.d.ts} +58 -1
  4. package/dist/{compactor-C5sT4U7I.d.ts → compactor-t0R_AIt_.d.ts} +1 -1
  5. package/dist/{config-DuAu23zm.d.ts → config-FG6As4H5.d.ts} +1 -1
  6. package/dist/{context-CGdgA0q6.d.ts → context-JFOVvu6z.d.ts} +22 -0
  7. package/dist/coordination/index.d.ts +14 -14
  8. package/dist/coordination/index.js +189 -28
  9. package/dist/coordination/index.js.map +1 -1
  10. package/dist/defaults/index.d.ts +25 -25
  11. package/dist/defaults/index.js +881 -83
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/execution/index.d.ts +15 -15
  14. package/dist/execution/index.js +108 -26
  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 +6 -6
  18. package/dist/{goal-preamble-CznHTZqP.d.ts → goal-preamble-B1IXJtLX.d.ts} +9 -9
  19. package/dist/{goal-store-CV9Yz2X_.d.ts → goal-store-CPXz6Mml.d.ts} +4 -2
  20. package/dist/{index-CitPrI3a.d.ts → index-BPcg4N3M.d.ts} +5 -5
  21. package/dist/{index-CC0Mcm05.d.ts → index-CebbJB94.d.ts} +8 -8
  22. package/dist/index.d.ts +44 -42
  23. package/dist/index.js +1452 -274
  24. package/dist/index.js.map +1 -1
  25. package/dist/infrastructure/index.d.ts +6 -6
  26. package/dist/kernel/index.d.ts +9 -9
  27. package/dist/kernel/index.js.map +1 -1
  28. package/dist/{llm-selector-CJ4SyAFE.d.ts → llm-selector-DXxI2tlu.d.ts} +2 -2
  29. package/dist/{mcp-servers-D8YnLaEp.d.ts → mcp-servers-OwNHo43-.d.ts} +3 -3
  30. package/dist/models/index.d.ts +5 -5
  31. package/dist/{models-registry-ByZCdFuQ.d.ts → models-registry-Djlmq4uB.d.ts} +1 -1
  32. package/dist/{multi-agent-coordinator-DqTUEAeC.d.ts → multi-agent-coordinator-CEmrSCMJ.d.ts} +1 -1
  33. package/dist/{null-fleet-bus-B5mfTJXT.d.ts → null-fleet-bus-DT92xqgJ.d.ts} +13 -8
  34. package/dist/observability/index.d.ts +2 -2
  35. package/dist/{package-outdated-watcher-BSgR_kK-.d.ts → package-outdated-watcher-C70ag2G9.d.ts} +3 -3
  36. package/dist/{parallel-eternal-engine-C0juOszP.d.ts → parallel-eternal-engine-0SItuq5r.d.ts} +13 -9
  37. package/dist/{path-resolver-CbkT-RMU.d.ts → path-resolver-DKBh6Jlo.d.ts} +3 -3
  38. package/dist/{permission-CwBBpCoF.d.ts → permission-BJ7eO9Vl.d.ts} +1 -1
  39. package/dist/{permission-policy-B8rSu908.d.ts → permission-policy-DEXOfnpm.d.ts} +3 -2
  40. package/dist/{pipeline-JG8XoudC.d.ts → pipeline-zflkI2dp.d.ts} +2 -2
  41. package/dist/{plan-templates-DPiQMkBz.d.ts → plan-templates-BFXyRkEK.d.ts} +32 -11
  42. package/dist/{provider-runner-hM7EXlLI.d.ts → provider-runner-BC-uywtT.d.ts} +3 -3
  43. package/dist/{retry-policy-Tg7LXkoK.d.ts → retry-policy-Cavrzmtk.d.ts} +1 -1
  44. package/dist/sdd/index.d.ts +8 -8
  45. package/dist/sdd/index.js +20 -2
  46. package/dist/sdd/index.js.map +1 -1
  47. package/dist/{secret-vault-gxtFZYBt.d.ts → secret-vault-CDvDYXWX.d.ts} +1 -1
  48. package/dist/security/index.d.ts +4 -4
  49. package/dist/security/index.js +30 -1
  50. package/dist/security/index.js.map +1 -1
  51. package/dist/{selector-DWsqVjGf.d.ts → selector-B7AivHsu.d.ts} +1 -1
  52. package/dist/{session-event-bridge-BAFWdgQ3.d.ts → session-event-bridge-BmIDxdJd.d.ts} +1 -1
  53. package/dist/{session-reader-CqRvaL5v.d.ts → session-reader-DtofsB-2.d.ts} +1 -1
  54. package/dist/storage/index.d.ts +30 -21
  55. package/dist/storage/index.js +1264 -216
  56. package/dist/storage/index.js.map +1 -1
  57. package/dist/types/index.d.ts +19 -19
  58. package/dist/types/index.js +8 -0
  59. package/dist/types/index.js.map +1 -1
  60. package/dist/utils/index.d.ts +2 -2
  61. package/package.json +1 -1
  62. package/skills/output-standards/SKILL.md +14 -9
  63. package/skills/output-standards/SKILL.save.md +3 -2
@@ -1409,7 +1409,12 @@ Working rules:
1409
1409
  6. Never claim a subagent's work as your own without verifying it. If a
1410
1410
  result looks wrong, ask_subagent for clarification before passing it
1411
1411
  to the user.
1412
- 7. Wind down when satisfied. When the results are good enough, call
1412
+ 7. **Act on subagent mail immediately**. Subagent messages (result, ask,
1413
+ assign, note) are injected inline before every step \u2014 even mid-task.
1414
+ When you see one, address it before continuing: reply to asks, factor
1415
+ in results, act on assignments. Use \`mailbox action=ack\` to mark
1416
+ completed messages.
1417
+ 8. Wind down when satisfied. When the results are good enough, call
1413
1418
  work_complete \u2014 no new subagents will spawn and queued tasks complete
1414
1419
  as aborted. Running subagents finish naturally. Call terminate_subagent
1415
1420
  only for ones you need to stop immediately.`;
@@ -1426,6 +1431,13 @@ Bridge contract:
1426
1431
  structured, and self-contained \u2014 assume the Director will paste your
1427
1432
  output into its own context.
1428
1433
 
1434
+ CRITICAL CONSTRAINT \u2014 NO FURTHER DELEGATION:
1435
+ - You MUST NOT call the \`delegate\` tool or attempt to spawn subagents.
1436
+ - You MUST NOT use \`spawn_subagent\`, \`assign_task\`, or any equivalent.
1437
+ - Your role is to execute the assigned task yourself, not to orchestrate.
1438
+ - If a subtask is too complex, report back to the Director with what you
1439
+ found and let the Director decide how to decompose.
1440
+
1429
1441
  Inter-agent mailbox (if you have the \`mail_send\`/\`mail_inbox\`/\`mailbox\` tools):
1430
1442
  - You are part of a project-wide fleet that may span other terminals and
1431
1443
  WebUIs. Your mailbox identity is \`<your-name>@<session-tag>\` (unique
@@ -1440,7 +1452,12 @@ Inter-agent mailbox (if you have the \`mail_send\`/\`mail_inbox\`/\`mailbox\` to
1440
1452
  their exact id instead of doing everything yourself. Discover ids with
1441
1453
  \`mailbox action=online\`.
1442
1454
  - Answer your mail: reply to the sender's exact \`from\` id. When done with
1443
- an assigned task, post a \`result\` back to whoever assigned it.`;
1455
+ an assigned task, post a \`result\` back to whoever assigned it.
1456
+ - **Mail to the leader is always seen**: when you send \`ask\`, \`result\`,
1457
+ or \`assign\` to the director/leader, the message is injected inline into
1458
+ the leader's conversation before their next step \u2014 even if the leader is
1459
+ mid-task. Use \`mail_send\` to reliably reach the leader instead of
1460
+ waiting for them to check in.`;
1444
1461
  function composeDirectorPrompt(parts = {}) {
1445
1462
  const sections = [];
1446
1463
  const preamble = parts.directorPreamble ?? DEFAULT_DIRECTOR_PREAMBLE;
@@ -8161,6 +8178,20 @@ async function readSubagentPartial(opts, subagentId) {
8161
8178
  }
8162
8179
 
8163
8180
  // src/coordination/agent-subagent-runner.ts
8181
+ function withDisabledToolFiltering(factory) {
8182
+ return async (config) => {
8183
+ const result = await factory(config);
8184
+ const disabled = config.disabledTools ?? [];
8185
+ if (disabled.length === 0) return result;
8186
+ const registry = result.agent.tools;
8187
+ if (registry && typeof registry.unregister === "function") {
8188
+ for (const toolName of disabled) {
8189
+ registry.unregister(toolName);
8190
+ }
8191
+ }
8192
+ return result;
8193
+ };
8194
+ }
8164
8195
  function makeAgentSubagentRunner(opts) {
8165
8196
  const format = opts.formatTaskInput ?? defaultFormatTaskInput;
8166
8197
  return async (task, ctx) => {
@@ -8471,6 +8502,40 @@ var DefaultSessionStore = class _DefaultSessionStore {
8471
8502
  this.events = opts.events;
8472
8503
  this.secretScrubber = opts.secretScrubber;
8473
8504
  }
8505
+ // ── Storage event helpers ───────────────────────────────────────────────────
8506
+ emitRead(sessionId, filePath, operation, outcome, durationMs, error) {
8507
+ this.events?.emit("storage.read", {
8508
+ sessionId,
8509
+ store: "session",
8510
+ filePath,
8511
+ operation,
8512
+ outcome,
8513
+ durationMs,
8514
+ ...error !== void 0 ? { error } : {}
8515
+ });
8516
+ }
8517
+ emitWrite(sessionId, filePath, operation, outcome, durationMs, eventCount, error) {
8518
+ this.events?.emit("storage.write", {
8519
+ sessionId,
8520
+ store: "session",
8521
+ filePath,
8522
+ operation,
8523
+ outcome,
8524
+ durationMs,
8525
+ ...eventCount !== void 0 ? { eventCount } : {},
8526
+ ...error !== void 0 ? { error } : {}
8527
+ });
8528
+ }
8529
+ emitError(sessionId, filePath, operation, error, recoverable) {
8530
+ this.events?.emit("storage.error", {
8531
+ sessionId,
8532
+ store: "session",
8533
+ filePath,
8534
+ operation,
8535
+ error,
8536
+ recoverable
8537
+ });
8538
+ }
8474
8539
  /** Absolute path to the session index file. */
8475
8540
  get indexFile() {
8476
8541
  return path4.join(this.dir, "_index.jsonl");
@@ -8494,22 +8559,26 @@ var DefaultSessionStore = class _DefaultSessionStore {
8494
8559
  const id = meta.id && meta.id.length > 0 ? meta.id : generateSessionId(startedAt, meta.model ?? meta.provider);
8495
8560
  const shardDir = await this.ensureShardDir(id);
8496
8561
  const file = path4.join(shardDir, `${path4.basename(id)}.jsonl`);
8562
+ const t0 = Date.now();
8497
8563
  let handle;
8498
8564
  try {
8499
8565
  handle = await fsp6.open(file, "a", 384);
8500
8566
  } catch (err) {
8567
+ this.emitError(id, file, "create", err instanceof Error ? err.message : String(err), false);
8501
8568
  throw new Error(
8502
8569
  `Failed to open session file: ${err instanceof Error ? err.message : String(err)}`,
8503
8570
  { cause: err }
8504
8571
  );
8505
8572
  }
8506
8573
  try {
8507
- return new FileSessionWriter(id, handle, startedAt, meta, this.events, {
8574
+ const writer = new FileSessionWriter(id, handle, startedAt, meta, this.events, {
8508
8575
  dir: shardDir,
8509
8576
  filePath: file,
8510
8577
  secretScrubber: this.secretScrubber,
8511
8578
  onClose: (s) => this.appendToIndex(s)
8512
8579
  });
8580
+ this.emitWrite(id, file, "create", "success", Date.now() - t0);
8581
+ return writer;
8513
8582
  } catch (err) {
8514
8583
  await handle.close().catch((e) => console.warn(JSON.stringify({
8515
8584
  level: "warn",
@@ -8517,16 +8586,19 @@ var DefaultSessionStore = class _DefaultSessionStore {
8517
8586
  message: e instanceof Error ? e.message : String(e),
8518
8587
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
8519
8588
  })));
8589
+ this.emitError(id, file, "create", err instanceof Error ? err.message : String(err), true);
8520
8590
  throw err;
8521
8591
  }
8522
8592
  }
8523
8593
  async resume(id) {
8524
8594
  const file = this.sessionPath(id, ".jsonl");
8595
+ const t0 = Date.now();
8525
8596
  const data = await this.load(id);
8526
8597
  let handle;
8527
8598
  try {
8528
8599
  handle = await fsp6.open(file, "a", 384);
8529
8600
  } catch (err) {
8601
+ this.emitError(id, file, "resume", err instanceof Error ? err.message : String(err), false);
8530
8602
  throw new Error(
8531
8603
  `Failed to open session "${id}" for append: ${err instanceof Error ? err.message : String(err)}`,
8532
8604
  { cause: err }
@@ -8554,6 +8626,7 @@ var DefaultSessionStore = class _DefaultSessionStore {
8554
8626
  onClose: (s) => this.appendToIndex(s)
8555
8627
  }
8556
8628
  );
8629
+ this.emitWrite(id, file, "resume", "success", Date.now() - t0);
8557
8630
  return { writer, data };
8558
8631
  } catch (err) {
8559
8632
  await handle.close().catch((e) => console.warn(JSON.stringify({
@@ -8562,27 +8635,39 @@ var DefaultSessionStore = class _DefaultSessionStore {
8562
8635
  message: e instanceof Error ? e.message : String(e),
8563
8636
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
8564
8637
  })));
8638
+ this.emitError(id, file, "resume", err instanceof Error ? err.message : String(err), true);
8565
8639
  throw err;
8566
8640
  }
8567
8641
  }
8568
8642
  async load(id) {
8569
8643
  const file = this.sessionPath(id, ".jsonl");
8570
- const raw = await fsp6.readFile(file, "utf8");
8571
- const lines = raw.split("\n").filter((l) => l.trim());
8572
- const events = [];
8573
- for (const line of lines) {
8574
- try {
8575
- const parsed = JSON.parse(line);
8576
- if (parsed !== null && typeof parsed === "object" && typeof parsed.type === "string" && typeof parsed.ts === "string") {
8577
- events.push(parsed);
8644
+ const t0 = Date.now();
8645
+ let outcome = "success";
8646
+ let errorMsg;
8647
+ try {
8648
+ const raw = await fsp6.readFile(file, "utf8");
8649
+ const lines = raw.split("\n").filter((l) => l.trim());
8650
+ const events = [];
8651
+ for (const line of lines) {
8652
+ try {
8653
+ const parsed = JSON.parse(line);
8654
+ if (parsed !== null && typeof parsed === "object" && typeof parsed.type === "string" && typeof parsed.ts === "string") {
8655
+ events.push(parsed);
8656
+ }
8657
+ } catch {
8578
8658
  }
8579
- } catch {
8580
8659
  }
8660
+ const meta = this.metaFromEvents(id, events);
8661
+ const { messages, usage } = this.replay(events, id);
8662
+ const toolCallEnds = extractToolCallEnds(events);
8663
+ return { metadata: meta, events, messages, usage, toolCallEnds };
8664
+ } catch (err) {
8665
+ outcome = "failure";
8666
+ errorMsg = err instanceof Error ? err.message : String(err);
8667
+ throw err;
8668
+ } finally {
8669
+ this.emitRead(id, file, "load", outcome, Date.now() - t0, errorMsg);
8581
8670
  }
8582
- const meta = this.metaFromEvents(id, events);
8583
- const { messages, usage } = this.replay(events, id);
8584
- const toolCallEnds = extractToolCallEnds(events);
8585
- return { metadata: meta, events, messages, usage, toolCallEnds };
8586
8671
  }
8587
8672
  async list(limit = 20) {
8588
8673
  try {
@@ -8649,12 +8734,22 @@ var DefaultSessionStore = class _DefaultSessionStore {
8649
8734
  * (keep latest per session), and rewrite. Atomic via temp+rename.
8650
8735
  */
8651
8736
  async compactIndex() {
8652
- const entries = await this.readIndex();
8653
- if (entries.length === 0) return;
8654
- const tmp = `${this.indexFile}.compact.tmp`;
8655
- const lines = entries.map((s) => JSON.stringify(s)).join("\n") + "\n";
8656
- await fsp6.writeFile(tmp, lines, "utf8");
8657
- await fsp6.rename(tmp, this.indexFile);
8737
+ const t0 = Date.now();
8738
+ let outcome = "success";
8739
+ let errorMsg;
8740
+ try {
8741
+ const entries = await this.readIndex();
8742
+ if (entries.length === 0) return;
8743
+ const tmp = `${this.indexFile}.compact.tmp`;
8744
+ const lines = entries.map((s) => JSON.stringify(s)).join("\n") + "\n";
8745
+ await fsp6.writeFile(tmp, lines, "utf8");
8746
+ await fsp6.rename(tmp, this.indexFile);
8747
+ } catch (err) {
8748
+ outcome = "failure";
8749
+ errorMsg = err instanceof Error ? err.message : String(err);
8750
+ } finally {
8751
+ this.emitWrite("~compact~", this.indexFile, "compact", outcome, Date.now() - t0, void 0, errorMsg);
8752
+ }
8658
8753
  }
8659
8754
  /**
8660
8755
  * Read the index file and return deduplicated session summaries.
@@ -8730,22 +8825,31 @@ var DefaultSessionStore = class _DefaultSessionStore {
8730
8825
  }
8731
8826
  async summaryFor(id) {
8732
8827
  const manifest = this.sessionPath(id, ".summary.json");
8828
+ const t0 = Date.now();
8829
+ let outcome = "success";
8830
+ let errorMsg;
8733
8831
  try {
8734
8832
  const raw = await fsp6.readFile(manifest, "utf8");
8833
+ this.emitRead(id, manifest, "summary", "success", Date.now() - t0);
8735
8834
  return JSON.parse(raw);
8736
8835
  } catch {
8737
8836
  const full = this.sessionPath(id, ".jsonl");
8738
8837
  const stat5 = await fsp6.stat(full);
8739
8838
  const summary = await this.summarize(id, stat5.mtime.toISOString());
8740
8839
  await atomicWrite(manifest, JSON.stringify(summary), { mode: 384 }).catch((err) => {
8840
+ const msg = err instanceof Error ? err.message : String(err);
8841
+ this.emitError(id, manifest, "summary_fallback", msg, true);
8741
8842
  console.warn(JSON.stringify({
8742
8843
  level: "warn",
8743
8844
  event: "session_store.manifest_write_failed",
8744
8845
  sessionId: id,
8745
- message: err instanceof Error ? err.message : String(err),
8846
+ message: msg,
8746
8847
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
8747
8848
  }));
8748
8849
  });
8850
+ outcome = "failure";
8851
+ errorMsg = "summary fallback \u2014 manifest rebuilt";
8852
+ this.emitRead(id, manifest, "summary", outcome, Date.now() - t0, errorMsg);
8749
8853
  return summary;
8750
8854
  }
8751
8855
  }
@@ -9011,7 +9115,7 @@ function extractToolCallEnds(events) {
9011
9115
  return result;
9012
9116
  }
9013
9117
  var FileSessionWriter = class _FileSessionWriter {
9014
- constructor(id, handle, startedAt, meta, events, opts = {}) {
9118
+ constructor(id, handle, startedAt, meta, events, opts = {}, traceId) {
9015
9119
  this.id = id;
9016
9120
  this.handle = handle;
9017
9121
  this.startedAt = startedAt;
@@ -9030,6 +9134,7 @@ var FileSessionWriter = class _FileSessionWriter {
9030
9134
  provider: meta.provider ?? "unknown",
9031
9135
  tokenTotal: 0
9032
9136
  };
9137
+ this.traceId = traceId;
9033
9138
  }
9034
9139
  id;
9035
9140
  handle;
@@ -9062,6 +9167,8 @@ var FileSessionWriter = class _FileSessionWriter {
9062
9167
  lastAppendWarnAt = 0;
9063
9168
  secretScrubber;
9064
9169
  onCloseCb;
9170
+ /** Implements SessionWriter.traceId — propagated from ContextInit.traceId. */
9171
+ traceId;
9065
9172
  // ── Write buffer — batches events to reduce per-event disk I/O ─────────
9066
9173
  //
9067
9174
  // Every append() pushes the scrubbed event into an in-memory buffer instead
@@ -9215,9 +9322,14 @@ var FileSessionWriter = class _FileSessionWriter {
9215
9322
  const eventCount = this.writeBuffer.length;
9216
9323
  const batch = this.writeBuffer.map((e) => JSON.stringify(e)).join("\n") + "\n";
9217
9324
  this.writeBuffer = [];
9325
+ const t0 = Date.now();
9326
+ let outcome = "success";
9327
+ let errorMsg;
9218
9328
  try {
9219
9329
  await this.enqueueWrite(batch);
9220
9330
  } catch (err) {
9331
+ outcome = "failure";
9332
+ errorMsg = err instanceof Error ? err.message : String(err);
9221
9333
  this.appendFailCount += eventCount;
9222
9334
  const now = Date.now();
9223
9335
  if (now - this.lastAppendWarnAt > 5e3) {
@@ -9231,6 +9343,18 @@ var FileSessionWriter = class _FileSessionWriter {
9231
9343
  this.lastAppendWarnAt = now;
9232
9344
  this.appendFailCount = 0;
9233
9345
  }
9346
+ } finally {
9347
+ this.events?.emit("storage.write", {
9348
+ sessionId: this.id,
9349
+ store: "session",
9350
+ filePath: this.filePath,
9351
+ operation: "flush",
9352
+ outcome,
9353
+ durationMs: Date.now() - t0,
9354
+ ...errorMsg !== void 0 ? { error: errorMsg } : {},
9355
+ ...eventCount !== void 0 ? { eventCount } : {},
9356
+ ...this.traceId !== void 0 ? { traceId: this.traceId } : {}
9357
+ });
9234
9358
  }
9235
9359
  }
9236
9360
  observeForSummary(event) {
@@ -9296,14 +9420,46 @@ var FileSessionWriter = class _FileSessionWriter {
9296
9420
  outcome: this.outcome ?? "completed"
9297
9421
  };
9298
9422
  if (this.manifestFile) {
9423
+ const t0 = Date.now();
9424
+ let outcome = "success";
9425
+ let errorMsg;
9299
9426
  try {
9300
9427
  await atomicWrite(this.manifestFile, JSON.stringify(this.summary), { mode: 384 });
9301
- } catch {
9428
+ } catch (err) {
9429
+ outcome = "failure";
9430
+ errorMsg = err instanceof Error ? err.message : String(err);
9431
+ } finally {
9432
+ this.events?.emit("storage.write", {
9433
+ sessionId: this.id,
9434
+ store: "session",
9435
+ filePath: this.manifestFile,
9436
+ operation: "close",
9437
+ outcome,
9438
+ durationMs: Date.now() - t0,
9439
+ ...errorMsg !== void 0 ? { error: errorMsg } : {},
9440
+ ...this.traceId !== void 0 ? { traceId: this.traceId } : {}
9441
+ });
9302
9442
  }
9303
9443
  }
9444
+ const idxT0 = Date.now();
9445
+ let idxOutcome = "success";
9446
+ let idxError;
9304
9447
  try {
9305
9448
  await this.onCloseCb?.(this.summary);
9306
- } catch {
9449
+ } catch (err) {
9450
+ idxOutcome = "failure";
9451
+ idxError = err instanceof Error ? err.message : String(err);
9452
+ } finally {
9453
+ this.events?.emit("storage.write", {
9454
+ sessionId: this.summary.id,
9455
+ store: "session",
9456
+ filePath: this.filePath,
9457
+ operation: "index_append",
9458
+ outcome: idxOutcome,
9459
+ durationMs: Date.now() - idxT0,
9460
+ ...idxError !== void 0 ? { error: idxError } : {},
9461
+ ...this.traceId !== void 0 ? { traceId: this.traceId } : {}
9462
+ });
9307
9463
  }
9308
9464
  try {
9309
9465
  await this.handle.close();
@@ -9464,6 +9620,7 @@ function userInputTitle(content) {
9464
9620
  // src/coordination/director-session.ts
9465
9621
  function makeDirectorSessionFactory(opts) {
9466
9622
  const runId = opts.directorRunId ?? `${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}-director`;
9623
+ const { traceId } = opts;
9467
9624
  let store;
9468
9625
  let dir;
9469
9626
  if (opts.store) {
@@ -9479,12 +9636,16 @@ function makeDirectorSessionFactory(opts) {
9479
9636
  dir,
9480
9637
  directorRunId: runId,
9481
9638
  async createSubagentSession({ subagentId, provider, model, title }) {
9482
- return store.create({
9639
+ const writer = await store.create({
9483
9640
  id: subagentId,
9484
9641
  title: title ?? subagentId,
9485
9642
  provider: provider ?? "unknown",
9486
9643
  model: model ?? "unknown"
9487
9644
  });
9645
+ if (traceId !== void 0) {
9646
+ writer.traceId = traceId;
9647
+ }
9648
+ return writer;
9488
9649
  }
9489
9650
  };
9490
9651
  }
@@ -11555,6 +11716,6 @@ mvn versions:use-latest-versions`;
11555
11716
  }
11556
11717
  }
11557
11718
 
11558
- export { ACP_AGENTS, AGENTS_BY_PHASE, AGENT_CATALOG, TOOLS as AGENT_TOOL_PRESETS, ALL_AGENT_DEFINITIONS, ALL_FLEET_AGENTS, AUDIT_LOG_AGENT, BUG_HUNTER_AGENT, BUILD_AGENTS, BrainDecisionQueue, BrainMonitor, BudgetExceededError, BudgetThresholdSignal, CollabSession, DEFAULT_DIRECTOR_PREAMBLE, DEFAULT_DISPATCH_ROLE, DEFAULT_SUBAGENT_BASELINE, DELIVERY_AGENTS, DEPENDENCY_FILE_PATTERNS, DISCOVERY_AGENTS, DOMAIN_AGENTS, DefaultBrainArbiter, DefaultMailbox, DefaultMultiAgentCoordinator, Director, DirectorAlertLevel, FLEET_ROSTER, FLEET_ROSTER_BUDGETS, FLEET_ROSTER_WITHACP, FleetBus, FleetCostCapError, FleetManager, FleetSpawnBudgetError, FleetUsageAggregator, GlobalMailbox, HEAVY_BUDGET, HumanEscalatingBrainArbiter, InMemoryAgentBridge, InMemoryBridgeTransport, KNOWLEDGE_AGENTS, LIGHT_BUDGET, LargeAnswerStore, MEDIUM_BUDGET, META_AGENTS, NULL_FLEET_BUS, ObservableBrainArbiter, PLANNING_AGENTS, REFACTOR_PLANNER_AGENT, REVIEW_AGENTS, SECURITY_SCANNER_AGENT, SubagentBudget, VERIFY_AGENTS, applyRosterBudget, attachAutoExtend, attachDepWatcherBridge, composeDirectorPrompt, composeSubagentPrompt, createDelegateTool, createMailboxHooks, createMessage, detectEcosystem, dispatchAgent, formatHumanPrompt, getAgentDefinition, getFullPackageLog, getManifestPackages, getPackageAuthor, getPackagesByAgent, mailboxSessionTag, makeAgentSubagentRunner, makeAskResultTool, makeAskTool, makeAssignTool, makeAwaitTasksTool, makeCollabDebugTool, makeDependencyWatcherConfig, makeDirectorSessionFactory, makeFleetEmitTool, makeFleetHealthTool, makeFleetSessionTool, makeFleetStatusTool, makeFleetUsageTool, makeLLMClassifier, makeMailInboxTool, makeMailSendTool, makeMailboxTool, makeRollUpTool, makeSpawnTool, makeTerminateTool, makeWorkCompleteTool, normalizeRecipient, recordPackageAction, resolveMailboxIdentity, resolveProjectDir, rosterSummaryFromConfigs, scoreAgents, startPackageOutdatedWatcher, updatePackageOutdatedStatus };
11719
+ export { ACP_AGENTS, AGENTS_BY_PHASE, AGENT_CATALOG, TOOLS as AGENT_TOOL_PRESETS, ALL_AGENT_DEFINITIONS, ALL_FLEET_AGENTS, AUDIT_LOG_AGENT, BUG_HUNTER_AGENT, BUILD_AGENTS, BrainDecisionQueue, BrainMonitor, BudgetExceededError, BudgetThresholdSignal, CollabSession, DEFAULT_DIRECTOR_PREAMBLE, DEFAULT_DISPATCH_ROLE, DEFAULT_SUBAGENT_BASELINE, DELIVERY_AGENTS, DEPENDENCY_FILE_PATTERNS, DISCOVERY_AGENTS, DOMAIN_AGENTS, DefaultBrainArbiter, DefaultMailbox, DefaultMultiAgentCoordinator, Director, DirectorAlertLevel, FLEET_ROSTER, FLEET_ROSTER_BUDGETS, FLEET_ROSTER_WITHACP, FleetBus, FleetCostCapError, FleetManager, FleetSpawnBudgetError, FleetUsageAggregator, GlobalMailbox, HEAVY_BUDGET, HumanEscalatingBrainArbiter, InMemoryAgentBridge, InMemoryBridgeTransport, KNOWLEDGE_AGENTS, LIGHT_BUDGET, LargeAnswerStore, MEDIUM_BUDGET, META_AGENTS, NULL_FLEET_BUS, ObservableBrainArbiter, PLANNING_AGENTS, REFACTOR_PLANNER_AGENT, REVIEW_AGENTS, SECURITY_SCANNER_AGENT, SubagentBudget, VERIFY_AGENTS, applyRosterBudget, attachAutoExtend, attachDepWatcherBridge, composeDirectorPrompt, composeSubagentPrompt, createDelegateTool, createMailboxHooks, createMessage, detectEcosystem, dispatchAgent, formatHumanPrompt, getAgentDefinition, getFullPackageLog, getManifestPackages, getPackageAuthor, getPackagesByAgent, mailboxSessionTag, makeAgentSubagentRunner, makeAskResultTool, makeAskTool, makeAssignTool, makeAwaitTasksTool, makeCollabDebugTool, makeDependencyWatcherConfig, makeDirectorSessionFactory, makeFleetEmitTool, makeFleetHealthTool, makeFleetSessionTool, makeFleetStatusTool, makeFleetUsageTool, makeLLMClassifier, makeMailInboxTool, makeMailSendTool, makeMailboxTool, makeRollUpTool, makeSpawnTool, makeTerminateTool, makeWorkCompleteTool, normalizeRecipient, recordPackageAction, resolveMailboxIdentity, resolveProjectDir, rosterSummaryFromConfigs, scoreAgents, startPackageOutdatedWatcher, updatePackageOutdatedStatus, withDisabledToolFiltering };
11559
11720
  //# sourceMappingURL=index.js.map
11560
11721
  //# sourceMappingURL=index.js.map