@wrongstack/core 0.8.6 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/{agent-bridge-Bad3ZGQ7.d.ts → agent-bridge-DMVOX0cF.d.ts} +1 -1
  2. package/dist/{agent-subagent-runner-Cc8sRJOF.d.ts → agent-subagent-runner-R0I0Xusn.d.ts} +3 -3
  3. package/dist/{compactor-Mw7-rNyb.d.ts → compactor-DVTKL7XD.d.ts} +1 -1
  4. package/dist/{config-Bi4Q0fnz.d.ts → config-DoUAEvXH.d.ts} +8 -2
  5. package/dist/{context-z2x5gv_V.d.ts → context-BRNbHmRM.d.ts} +6 -0
  6. package/dist/coordination/index.d.ts +12 -12
  7. package/dist/coordination/index.js +58 -37
  8. package/dist/coordination/index.js.map +1 -1
  9. package/dist/{default-config-DvRSTELf.d.ts → default-config-Uzla85H-.d.ts} +5 -1
  10. package/dist/defaults/index.d.ts +22 -22
  11. package/dist/defaults/index.js +119 -76
  12. package/dist/defaults/index.js.map +1 -1
  13. package/dist/{events-yCpJD4wa.d.ts → events-CiG9qUM_.d.ts} +1 -1
  14. package/dist/execution/index.d.ts +13 -13
  15. package/dist/execution/index.js.map +1 -1
  16. package/dist/extension/index.d.ts +6 -6
  17. package/dist/{index-SxpnwRlJ.d.ts → index-bOl8lzFV.d.ts} +5 -5
  18. package/dist/{index-BvZld4Dr.d.ts → index-u2ROAV0F.d.ts} +17 -8
  19. package/dist/index.d.ts +31 -31
  20. package/dist/index.js +182 -95
  21. package/dist/index.js.map +1 -1
  22. package/dist/infrastructure/index.d.ts +6 -6
  23. package/dist/kernel/index.d.ts +9 -9
  24. package/dist/{mcp-servers-n2L9ohMX.d.ts → mcp-servers-jEoMIBZv.d.ts} +3 -3
  25. package/dist/models/index.d.ts +2 -2
  26. package/dist/{multi-agent-C8uY45AY.d.ts → multi-agent-3ZnTB1aT.d.ts} +2 -2
  27. package/dist/{multi-agent-coordinator-C7YbZUY8.d.ts → multi-agent-coordinator-COwCGIrU.d.ts} +2 -2
  28. package/dist/{null-fleet-bus-Bb2jVLKr.d.ts → null-fleet-bus-C1grTnOF.d.ts} +6 -6
  29. package/dist/observability/index.d.ts +2 -2
  30. package/dist/{path-resolver-DnC1nOjb.d.ts → path-resolver-TcJfc29Y.d.ts} +2 -2
  31. package/dist/{permission-policy-BBa1M1xc.d.ts → permission-policy-BpCGYBud.d.ts} +2 -2
  32. package/dist/{plan-templates-Cqdy6rtM.d.ts → plan-templates-ByT1HcRI.d.ts} +17 -7
  33. package/dist/{provider-runner-C4ouU7--.d.ts → provider-runner-BEpikbbN.d.ts} +3 -3
  34. package/dist/{retry-policy-OwtKNxo8.d.ts → retry-policy-BYkq0ugs.d.ts} +1 -1
  35. package/dist/sdd/index.d.ts +8 -8
  36. package/dist/{secret-scrubber-CyE1-EMG.d.ts → secret-scrubber-DttNiGYA.d.ts} +1 -1
  37. package/dist/{secret-scrubber-C0n1EqrC.d.ts → secret-scrubber-QSeI0ADi.d.ts} +1 -1
  38. package/dist/security/index.d.ts +4 -4
  39. package/dist/security/index.js +5 -2
  40. package/dist/security/index.js.map +1 -1
  41. package/dist/{selector-DkvgYVS4.d.ts → selector-pox8abg0.d.ts} +1 -1
  42. package/dist/{session-reader-DsadjyF9.d.ts → session-reader-CSWcb5Ga.d.ts} +1 -1
  43. package/dist/storage/index.d.ts +9 -6
  44. package/dist/storage/index.js +109 -63
  45. package/dist/storage/index.js.map +1 -1
  46. package/dist/{system-prompt-CWA6ml-d.d.ts → system-prompt-Bs-Wliab.d.ts} +1 -1
  47. package/dist/{tool-executor-Ch25BDwa.d.ts → tool-executor-D7a00JVJ.d.ts} +4 -4
  48. package/dist/types/index.d.ts +16 -16
  49. package/dist/types/index.js +8 -2
  50. package/dist/types/index.js.map +1 -1
  51. package/dist/utils/index.d.ts +1 -1
  52. package/dist/utils/index.js +3 -1
  53. package/dist/utils/index.js.map +1 -1
  54. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -93,7 +93,7 @@ async function renameWithRetry(from, to) {
93
93
  if (!code || !TRANSIENT_RENAME_CODES.has(code) || i === delays.length) {
94
94
  throw err;
95
95
  }
96
- await new Promise((resolve8) => setTimeout(resolve8, delays[i]));
96
+ await new Promise((resolve9) => setTimeout(resolve9, delays[i]));
97
97
  }
98
98
  }
99
99
  throw lastErr;
@@ -1021,6 +1021,9 @@ var DEFAULT_CONTEXT_CONFIG = Object.freeze({
1021
1021
  preserveK: 10,
1022
1022
  eliseThreshold: 2e3
1023
1023
  });
1024
+ var DEFAULT_AUTONOMY_CONFIG = Object.freeze({
1025
+ autoProceedDelayMs: 45e3
1026
+ });
1024
1027
 
1025
1028
  // src/types/secret-vault.ts
1026
1029
  var ENCRYPTED_PREFIX = "enc:v1:";
@@ -2061,7 +2064,10 @@ var PATTERNS = [
2061
2064
  type: "bearer_token",
2062
2065
  // Anchored with alternation instead of negative lookahead — avoids V8
2063
2066
  // backtracking risk on adversarial input. Bounded at 512 chars.
2064
- regex: /(?:^|[^A-Za-z0-9_.~+/-])Bearer\s+[A-Za-z0-9._~+/-]{20,512}=*(?:$|[^A-Za-z0-9_.~+/-])/g
2067
+ // Min 12 chars: some OAuth providers issue shorter-lived tokens (< 20
2068
+ // chars). A 12-char base64 string has ~71 bits of entropy — above the
2069
+ // threshold where random strings are unlikely to produce false matches.
2070
+ regex: /(?:^|[^A-Za-z0-9_.~+/-])Bearer\s+[A-Za-z0-9._~+/-]{12,512}=*(?:$|[^A-Za-z0-9_.~+/-])/g
2065
2071
  },
2066
2072
  {
2067
2073
  type: "high_entropy_env",
@@ -2694,7 +2700,7 @@ var InMemoryAgentBridge = class {
2694
2700
  );
2695
2701
  }
2696
2702
  this.inflightGuards.add(correlationId);
2697
- return new Promise((resolve8, reject) => {
2703
+ return new Promise((resolve9, reject) => {
2698
2704
  const timer = setTimeout(() => {
2699
2705
  this.inflightGuards.delete(correlationId);
2700
2706
  this.pendingRequests.delete(correlationId);
@@ -2706,7 +2712,7 @@ var InMemoryAgentBridge = class {
2706
2712
  return;
2707
2713
  }
2708
2714
  this.pendingRequests.set(correlationId, {
2709
- resolve: resolve8,
2715
+ resolve: resolve9,
2710
2716
  reject,
2711
2717
  timer
2712
2718
  });
@@ -3990,7 +3996,9 @@ function looksSecret(name) {
3990
3996
  }
3991
3997
  function buildChildEnv(optsOrSessionId) {
3992
3998
  const opts = typeof optsOrSessionId === "string" ? { sessionId: optsOrSessionId } : optsOrSessionId ?? {};
3993
- const passthrough = process.env["WRONGSTACK_CHILD_ENV_PASSTHROUGH"] === "1" || process.env["WRONGSTACK_BASH_ENV_PASSTHROUGH"] === "1";
3999
+ const hasOwn = Object.prototype.hasOwnProperty.call(process.env, "WRONGSTACK_CHILD_ENV_PASSTHROUGH");
4000
+ const legacyHasOwn = Object.prototype.hasOwnProperty.call(process.env, "WRONGSTACK_BASH_ENV_PASSTHROUGH");
4001
+ const passthrough = hasOwn && process.env["WRONGSTACK_CHILD_ENV_PASSTHROUGH"] === "1" || legacyHasOwn && process.env["WRONGSTACK_BASH_ENV_PASSTHROUGH"] === "1";
3994
4002
  if (passthrough && !process.env["CI"]) {
3995
4003
  console.warn(
3996
4004
  "[WrongStack] WARNING: WRONGSTACK_*_ENV_PASSTHROUGH=1 is active \u2014\n all parent env vars (including API keys) forwarded to child processes.\n Do not use on shared or multi-tenant systems."
@@ -4123,24 +4131,30 @@ var DefaultSessionStore = class {
4123
4131
  this.dir = opts.dir;
4124
4132
  this.events = opts.events;
4125
4133
  }
4126
- async create(meta) {
4134
+ /** Join session ID to its absolute path within the store directory. */
4135
+ sessionPath(id, ext) {
4136
+ return path6.join(this.dir, `${id}${ext}`);
4137
+ }
4138
+ async ensureShardDir(_id) {
4127
4139
  await ensureDir(this.dir);
4140
+ return this.dir;
4141
+ }
4142
+ async create(meta) {
4128
4143
  const startedAt = (/* @__PURE__ */ new Date()).toISOString();
4129
4144
  const id = meta.id ?? `${startedAt.replace(/[:.]/g, "-")}-${randomBytes(2).toString("hex")}`;
4130
- const file = path6.join(this.dir, `${id}.jsonl`);
4145
+ const shardDir = await this.ensureShardDir(id);
4146
+ const file = path6.join(shardDir, `${id}.jsonl`);
4131
4147
  let handle;
4132
4148
  try {
4133
4149
  handle = await fsp2.open(file, "a", 384);
4134
4150
  } catch (err) {
4135
4151
  throw new Error(
4136
4152
  `Failed to open session file: ${err instanceof Error ? err.message : String(err)}`,
4137
- {
4138
- cause: err
4139
- }
4153
+ { cause: err }
4140
4154
  );
4141
4155
  }
4142
4156
  try {
4143
- return new FileSessionWriter(id, handle, startedAt, meta, this.events, { dir: this.dir, filePath: file });
4157
+ return new FileSessionWriter(id, handle, startedAt, meta, this.events, { dir: shardDir, filePath: file });
4144
4158
  } catch (err) {
4145
4159
  await handle.close().catch(() => {
4146
4160
  });
@@ -4148,15 +4162,7 @@ var DefaultSessionStore = class {
4148
4162
  }
4149
4163
  }
4150
4164
  async resume(id) {
4151
- const file = path6.join(this.dir, `${id}.jsonl`);
4152
- try {
4153
- await fsp2.access(file, fsp2.constants.R_OK);
4154
- } catch {
4155
- throw new Error(
4156
- `Session "${id}" not found \u2014 the session file does not exist or was deleted.`,
4157
- { cause: new Error("ENOENT") }
4158
- );
4159
- }
4165
+ const file = this.sessionPath(id, ".jsonl");
4160
4166
  const data = await this.load(id);
4161
4167
  let handle;
4162
4168
  try {
@@ -4188,7 +4194,7 @@ var DefaultSessionStore = class {
4188
4194
  }
4189
4195
  }
4190
4196
  async load(id) {
4191
- const file = path6.join(this.dir, `${id}.jsonl`);
4197
+ const file = this.sessionPath(id, ".jsonl");
4192
4198
  const raw = await fsp2.readFile(file, "utf8");
4193
4199
  const lines = raw.split("\n").filter((l) => l.trim());
4194
4200
  const events = [];
@@ -4208,8 +4214,7 @@ var DefaultSessionStore = class {
4208
4214
  async list(limit = 20) {
4209
4215
  try {
4210
4216
  await ensureDir(this.dir);
4211
- const files = await fsp2.readdir(this.dir);
4212
- const ids = files.filter((f) => f.endsWith(".jsonl")).map((f) => f.replace(/\.jsonl$/, ""));
4217
+ const ids = await this.collectSessionIds(this.dir);
4213
4218
  const sessions = await Promise.all(ids.map((id) => this.summaryFor(id).catch(() => null)));
4214
4219
  const out = sessions.filter((s) => s !== null);
4215
4220
  out.sort((a, b) => {
@@ -4222,13 +4227,27 @@ var DefaultSessionStore = class {
4222
4227
  return [];
4223
4228
  }
4224
4229
  }
4230
+ /** Recursively collect all session IDs from shard subdirectories. */
4231
+ async collectSessionIds(dir) {
4232
+ const ids = [];
4233
+ const entries = await fsp2.readdir(dir, { withFileTypes: true });
4234
+ for (const entry of entries) {
4235
+ const full = path6.join(dir, entry.name);
4236
+ if (entry.isDirectory()) {
4237
+ ids.push(...await this.collectSessionIds(full));
4238
+ } else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
4239
+ ids.push(entry.name.replace(/\.jsonl$/, ""));
4240
+ }
4241
+ }
4242
+ return ids;
4243
+ }
4225
4244
  async summaryFor(id) {
4226
- const manifest = path6.join(this.dir, `${id}.summary.json`);
4245
+ const manifest = this.sessionPath(id, ".summary.json");
4227
4246
  try {
4228
4247
  const raw = await fsp2.readFile(manifest, "utf8");
4229
4248
  return JSON.parse(raw);
4230
4249
  } catch {
4231
- const full = path6.join(this.dir, `${id}.jsonl`);
4250
+ const full = this.sessionPath(id, ".jsonl");
4232
4251
  const stat8 = await fsp2.stat(full);
4233
4252
  const summary = await this.summarize(id, stat8.mtime.toISOString());
4234
4253
  await atomicWrite(manifest, JSON.stringify(summary), { mode: 384 }).catch((err) => {
@@ -4241,12 +4260,13 @@ var DefaultSessionStore = class {
4241
4260
  }
4242
4261
  }
4243
4262
  async delete(id) {
4244
- await fsp2.unlink(path6.join(this.dir, `${id}.jsonl`));
4245
- await fsp2.unlink(path6.join(this.dir, `${id}.summary.json`)).catch(() => void 0);
4263
+ await fsp2.unlink(this.sessionPath(id, ".jsonl"));
4264
+ await fsp2.unlink(this.sessionPath(id, ".summary.json")).catch(() => void 0);
4246
4265
  }
4247
4266
  async clearHistory(id) {
4248
- const file = path6.join(this.dir, `${id}.jsonl`);
4249
- const meta = path6.join(this.dir, `${id}.summary.json`);
4267
+ await this.ensureShardDir(id);
4268
+ const file = this.sessionPath(id, ".jsonl");
4269
+ const meta = this.sessionPath(id, ".summary.json");
4250
4270
  const record = `${JSON.stringify({
4251
4271
  type: "session_start",
4252
4272
  ts: (/* @__PURE__ */ new Date()).toISOString(),
@@ -4290,7 +4310,8 @@ var DefaultSessionStore = class {
4290
4310
  startedAt: start?.ts ?? (/* @__PURE__ */ new Date(0)).toISOString(),
4291
4311
  endedAt: end?.ts,
4292
4312
  model: start?.model,
4293
- provider: start?.provider
4313
+ provider: start?.provider,
4314
+ pendingToolUses: end?.pendingToolUses
4294
4315
  };
4295
4316
  }
4296
4317
  replay(events, sessionId = "unknown") {
@@ -4390,9 +4411,6 @@ var FileSessionWriter = class {
4390
4411
  tokenIn = 0;
4391
4412
  tokenOut = 0;
4392
4413
  filePath;
4393
- /** Public accessor for the JSONL path — required by SessionWriter so
4394
- * observability surfaces (`/fleet log`, FleetPanel) can locate the
4395
- * transcript without recomputing the path from session metadata. */
4396
4414
  get transcriptPath() {
4397
4415
  return this.filePath || void 0;
4398
4416
  }
@@ -4400,13 +4418,16 @@ var FileSessionWriter = class {
4400
4418
  resumed;
4401
4419
  appendFailCount = 0;
4402
4420
  lastAppendWarnAt = 0;
4403
- // Rewind support: track pending file changes and prompt index
4404
4421
  promptIndex = 0;
4405
4422
  pendingFileSnapshots = [];
4406
- // Register a pending file change. Call recordFileChange() from tools.
4423
+ /** Tracks open tool_use IDs during the current run to serialize on close for resume. */
4424
+ openToolUses = /* @__PURE__ */ new Set();
4407
4425
  recordFileChange(input) {
4408
4426
  this.pendingFileSnapshots.push(input);
4409
4427
  }
4428
+ get pendingToolUses() {
4429
+ return Array.from(this.openToolUses);
4430
+ }
4410
4431
  async writeSessionStartLazy() {
4411
4432
  const record = `${JSON.stringify({
4412
4433
  type: this.resumed ? "session_resumed" : "session_start",
@@ -4449,13 +4470,12 @@ var FileSessionWriter = class {
4449
4470
  }
4450
4471
  }
4451
4472
  }
4452
- /**
4453
- * Watch events as they're appended and keep the summary state hot, so
4454
- * `close()` can flush a `<id>.summary.json` manifest without re-reading
4455
- * the JSONL. `list()` reads only manifests, turning a per-session full
4456
- * parse into a single stat+read.
4457
- */
4458
4473
  observeForSummary(event) {
4474
+ if (event.type === "tool_use") {
4475
+ this.openToolUses.add(event.id);
4476
+ } else if (event.type === "tool_result") {
4477
+ this.openToolUses.delete(event.id);
4478
+ }
4459
4479
  if (event.type === "user_input" && this.summary.title === "(empty session)") {
4460
4480
  this.summary = { ...this.summary, title: userInputTitle(event.content) };
4461
4481
  } else if (event.type === "llm_response") {
@@ -4549,7 +4569,16 @@ var FileSessionWriter = class {
4549
4569
  }
4550
4570
  }
4551
4571
  const truncated = kept.join("\n");
4552
- await fsp2.writeFile(this.filePath, truncated + "\n", "utf8");
4572
+ const tmpPath = `${this.filePath}.rewind.tmp`;
4573
+ await fsp2.writeFile(tmpPath, truncated + "\n", "utf8");
4574
+ try {
4575
+ await this.handle.close();
4576
+ await fsp2.rename(tmpPath, this.filePath);
4577
+ this.handle = await fsp2.open(this.filePath, "a", 384);
4578
+ } catch (err) {
4579
+ await fsp2.unlink(tmpPath).catch(() => void 0);
4580
+ throw err;
4581
+ }
4553
4582
  await this.append({
4554
4583
  type: "rewound",
4555
4584
  ts: (/* @__PURE__ */ new Date()).toISOString(),
@@ -5242,7 +5271,10 @@ var DefaultConfigLoader = class {
5242
5271
  }
5243
5272
  if (c.mode !== void 0 && !isContextWindowModeId(c.mode)) {
5244
5273
  const known = listContextWindowModes().map((m) => m.id).join(", ");
5245
- throw new Error(`Config: context.mode must be one of: ${known}`);
5274
+ console.warn(
5275
+ `[config] Ignoring unknown context.mode "${c.mode}" (expected one of: ${known}); falling back to "${DEFAULT_CONTEXT_WINDOW_MODE_ID}".`
5276
+ );
5277
+ c.mode = DEFAULT_CONTEXT_WINDOW_MODE_ID;
5246
5278
  }
5247
5279
  }
5248
5280
  validateIdentity(cfg) {
@@ -5369,9 +5401,14 @@ var RecoveryLock = class {
5369
5401
  };
5370
5402
  }
5371
5403
  /**
5372
- * Claim the lock for the given session. Overwrites any existing lock
5373
- * the caller should have already handled abandonment (via
5374
- * `checkAbandoned`) before calling this.
5404
+ * Claim the lock for the given session. Uses exclusive-create (`O_EXCL`)
5405
+ * to detect whether another process acquired the lock between our
5406
+ * `checkAbandoned()` call and now. If the file already exists, it means
5407
+ * another process won the race and we throw instead of silently
5408
+ * overwriting their recovery record.
5409
+ *
5410
+ * The caller MUST have already called `checkAbandoned()` and handled its
5411
+ * null return before calling this.
5375
5412
  */
5376
5413
  async write(sessionId) {
5377
5414
  await ensureDir(path6.dirname(this.file));
@@ -5382,7 +5419,15 @@ var RecoveryLock = class {
5382
5419
  hostname: this.hostname,
5383
5420
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
5384
5421
  };
5385
- await atomicWrite(this.file, JSON.stringify(lock), { mode: 384 });
5422
+ try {
5423
+ await fsp2.writeFile(this.file, JSON.stringify(lock), { flag: "wx", mode: 384 });
5424
+ } catch (err) {
5425
+ const code = err.code;
5426
+ if (code === "EEXIST") {
5427
+ throw new Error(`Recovery lock already held by another process`);
5428
+ }
5429
+ throw err;
5430
+ }
5386
5431
  }
5387
5432
  /**
5388
5433
  * Release the lock. Idempotent — silently succeeds if the file is
@@ -6150,7 +6195,7 @@ var DefaultPermissionPolicy = class {
6150
6195
  return { permission: "auto", source: "context", reason: "file already read in this session" };
6151
6196
  }
6152
6197
  }
6153
- if (tool.permission === "auto") {
6198
+ if (tool.permission === "auto" && !tool.mutating) {
6154
6199
  return { permission: "auto", source: "default" };
6155
6200
  }
6156
6201
  if (this.promptDelegate) {
@@ -6624,8 +6669,8 @@ async function streamProviderToResponse(provider, req, signal, ctx, events) {
6624
6669
  try {
6625
6670
  await Promise.race([
6626
6671
  Promise.resolve(iter.return?.()),
6627
- new Promise((resolve8) => {
6628
- drainTimer = setTimeout(resolve8, 500);
6672
+ new Promise((resolve9) => {
6673
+ drainTimer = setTimeout(resolve9, 500);
6629
6674
  })
6630
6675
  ]);
6631
6676
  } finally {
@@ -6686,7 +6731,7 @@ async function runProviderWithRetry(opts) {
6686
6731
  description
6687
6732
  });
6688
6733
  }
6689
- await new Promise((resolve8, reject) => {
6734
+ await new Promise((resolve9, reject) => {
6690
6735
  let settled = false;
6691
6736
  const onAbort = () => {
6692
6737
  if (settled) return;
@@ -6699,7 +6744,7 @@ async function runProviderWithRetry(opts) {
6699
6744
  settled = true;
6700
6745
  clearTimeout(t2);
6701
6746
  signal.removeEventListener("abort", onAbort);
6702
- resolve8();
6747
+ resolve9();
6703
6748
  }, delay);
6704
6749
  if (signal.aborted) {
6705
6750
  onAbort();
@@ -8343,7 +8388,7 @@ ${recentJournal}` : "No prior iterations.",
8343
8388
  }
8344
8389
  };
8345
8390
  function sleep(ms) {
8346
- return new Promise((resolve8) => setTimeout(resolve8, ms));
8391
+ return new Promise((resolve9) => setTimeout(resolve9, ms));
8347
8392
  }
8348
8393
 
8349
8394
  // src/coordination/subagent-budget.ts
@@ -8493,12 +8538,12 @@ var SubagentBudget = class _SubagentBudget {
8493
8538
  if (!bus || !bus.hasListenerFor("budget.threshold_reached")) {
8494
8539
  return Promise.resolve("stop");
8495
8540
  }
8496
- return new Promise((resolve8) => {
8541
+ return new Promise((resolve9) => {
8497
8542
  let resolved = false;
8498
8543
  const respond = (d) => {
8499
8544
  if (resolved) return;
8500
8545
  resolved = true;
8501
- resolve8(d);
8546
+ resolve9(d);
8502
8547
  };
8503
8548
  const fallback = setTimeout(
8504
8549
  () => respond("stop"),
@@ -11539,7 +11584,7 @@ var DefaultMultiAgentCoordinator = class extends EventEmitter {
11539
11584
  taskIds.map((id) => {
11540
11585
  const cached = this.completedResults.find((r) => r.taskId === id);
11541
11586
  if (cached) return cached;
11542
- return new Promise((resolve8, reject) => {
11587
+ return new Promise((resolve9, reject) => {
11543
11588
  const timeout = setTimeout(() => {
11544
11589
  this.off("task.completed", handler);
11545
11590
  reject(new Error(`awaitTasks timed out waiting for task "${id}"`));
@@ -11548,7 +11593,7 @@ var DefaultMultiAgentCoordinator = class extends EventEmitter {
11548
11593
  if (result.taskId === id) {
11549
11594
  clearTimeout(timeout);
11550
11595
  this.off("task.completed", handler);
11551
- resolve8(result);
11596
+ resolve9(result);
11552
11597
  }
11553
11598
  };
11554
11599
  this.on("task.completed", handler);
@@ -11978,7 +12023,7 @@ function providerErrorToSubagentError(err, message, cause) {
11978
12023
 
11979
12024
  // src/execution/parallel-eternal-engine.ts
11980
12025
  function sleep2(ms) {
11981
- return new Promise((resolve8) => setTimeout(resolve8, ms));
12026
+ return new Promise((resolve9) => setTimeout(resolve9, ms));
11982
12027
  }
11983
12028
  var GOAL_COMPLETE_MARKER2 = /^\s*\[goal[_\s-]?complete\]\s*$/im;
11984
12029
  var ParallelEternalEngine = class {
@@ -13620,11 +13665,11 @@ var Director = class {
13620
13665
  if (cached) return cached;
13621
13666
  const existing = this.taskWaiters.get(id);
13622
13667
  if (existing) return existing.promise;
13623
- let resolve8;
13668
+ let resolve9;
13624
13669
  const promise = new Promise((res) => {
13625
- resolve8 = res;
13670
+ resolve9 = res;
13626
13671
  });
13627
- this.taskWaiters.set(id, { promise, resolve: resolve8 });
13672
+ this.taskWaiters.set(id, { promise, resolve: resolve9 });
13628
13673
  return promise;
13629
13674
  })
13630
13675
  );
@@ -13940,7 +13985,7 @@ function createDelegateTool(opts) {
13940
13985
  subagentId
13941
13986
  });
13942
13987
  const dir = director;
13943
- const result = await new Promise((resolve8) => {
13988
+ const result = await new Promise((resolve9) => {
13944
13989
  let settled = false;
13945
13990
  let timer;
13946
13991
  const finish = (value) => {
@@ -13949,7 +13994,7 @@ function createDelegateTool(opts) {
13949
13994
  if (timer) clearTimeout(timer);
13950
13995
  offTool();
13951
13996
  offIter();
13952
- resolve8(value);
13997
+ resolve9(value);
13953
13998
  };
13954
13999
  const arm = () => {
13955
14000
  if (timer) clearTimeout(timer);
@@ -17092,9 +17137,9 @@ var DefaultHealthRegistry = class {
17092
17137
  }
17093
17138
  async runOne(check) {
17094
17139
  let timer = null;
17095
- const timeout = new Promise((resolve8) => {
17140
+ const timeout = new Promise((resolve9) => {
17096
17141
  timer = setTimeout(
17097
- () => resolve8({ status: "unhealthy", detail: `timeout after ${this.timeoutMs}ms` }),
17142
+ () => resolve9({ status: "unhealthy", detail: `timeout after ${this.timeoutMs}ms` }),
17098
17143
  this.timeoutMs
17099
17144
  );
17100
17145
  });
@@ -17333,14 +17378,14 @@ async function startMetricsServer(opts) {
17333
17378
  const { createServer } = await import('http');
17334
17379
  server = createServer(listener);
17335
17380
  }
17336
- await new Promise((resolve8, reject) => {
17381
+ await new Promise((resolve9, reject) => {
17337
17382
  const onError = (err) => {
17338
17383
  server.off("listening", onListening);
17339
17384
  reject(err);
17340
17385
  };
17341
17386
  const onListening = () => {
17342
17387
  server.off("error", onError);
17343
- resolve8();
17388
+ resolve9();
17344
17389
  };
17345
17390
  server.once("error", onError);
17346
17391
  server.once("listening", onListening);
@@ -17352,8 +17397,8 @@ async function startMetricsServer(opts) {
17352
17397
  return {
17353
17398
  port: boundPort,
17354
17399
  url: `${protocol}://${host}:${boundPort}${path28}`,
17355
- close: () => new Promise((resolve8, reject) => {
17356
- server.close((err) => err ? reject(err) : resolve8());
17400
+ close: () => new Promise((resolve9, reject) => {
17401
+ server.close((err) => err ? reject(err) : resolve9());
17357
17402
  })
17358
17403
  };
17359
17404
  }
@@ -18449,10 +18494,12 @@ async function collectFiles(dir, baseDir) {
18449
18494
  // src/storage/session-rewinder.ts
18450
18495
  init_atomic_write();
18451
18496
  var DefaultSessionRewinder = class {
18452
- constructor(sessionsDir) {
18497
+ constructor(sessionsDir, projectRoot) {
18453
18498
  this.sessionsDir = sessionsDir;
18499
+ this.projectRoot = projectRoot;
18454
18500
  }
18455
18501
  sessionsDir;
18502
+ projectRoot;
18456
18503
  async listCheckpoints(sessionId) {
18457
18504
  const file = path6.join(this.sessionsDir, `${sessionId}.jsonl`);
18458
18505
  const raw = await fsp2.readFile(file, "utf8");
@@ -18509,7 +18556,7 @@ var DefaultSessionRewinder = class {
18509
18556
  }
18510
18557
  }
18511
18558
  }
18512
- const result = await revertSnapshots(snapshotsToRevert);
18559
+ const result = await revertSnapshots(snapshotsToRevert, this.projectRoot);
18513
18560
  const removedEvents = events.length - targetIdx - 1;
18514
18561
  return { ...result, toPromptIndex: checkpointIndex, removedEvents };
18515
18562
  }
@@ -18539,7 +18586,7 @@ var DefaultSessionRewinder = class {
18539
18586
  snapshotsToRevert.push({ promptIndex: event.promptIndex, files: event.files });
18540
18587
  }
18541
18588
  }
18542
- const result = await revertSnapshots(snapshotsToRevert.reverse());
18589
+ const result = await revertSnapshots(snapshotsToRevert.reverse(), this.projectRoot);
18543
18590
  return { ...result, toPromptIndex: targetIndex, removedEvents: snapshotsToRevert.length };
18544
18591
  }
18545
18592
  async rewindToStart(sessionId) {
@@ -18555,7 +18602,7 @@ var DefaultSessionRewinder = class {
18555
18602
  if (allSnapshots.length === 0) {
18556
18603
  return { revertedFiles: [], errors: [], toPromptIndex: 0, removedEvents: 0 };
18557
18604
  }
18558
- const result = await revertSnapshots(allSnapshots.reverse());
18605
+ const result = await revertSnapshots(allSnapshots.reverse(), this.projectRoot);
18559
18606
  return { ...result, toPromptIndex: 0, removedEvents: allSnapshots.length };
18560
18607
  }
18561
18608
  };
@@ -18573,12 +18620,19 @@ function parseEvents(raw) {
18573
18620
  }
18574
18621
  return events;
18575
18622
  }
18576
- async function revertSnapshots(snapshots) {
18623
+ async function revertSnapshots(snapshots, projectRoot) {
18577
18624
  const revertedFiles = [];
18578
18625
  const errors = [];
18579
18626
  for (const snapshot of snapshots) {
18580
18627
  for (const file of snapshot.files) {
18581
18628
  try {
18629
+ const absPath = path6.resolve(file.path);
18630
+ const root = path6.resolve(projectRoot);
18631
+ const rel = path6.relative(root, absPath);
18632
+ if (rel.startsWith("..") || path6.isAbsolute(rel)) {
18633
+ errors.push(`${file.path}: path resolves outside project root \u2014 skipping`);
18634
+ continue;
18635
+ }
18582
18636
  if (file.action === "deleted") {
18583
18637
  if (file.before !== null) {
18584
18638
  await atomicWrite(file.path, file.before, { mode: 420 });
@@ -19754,7 +19808,7 @@ var SecurityScannerOrchestrator = class {
19754
19808
  const delay = Math.round(policy.delayMs(attempt));
19755
19809
  const status = isProviderErr ? err.status : 0;
19756
19810
  console.warn(`[SecurityScanner] retry ${attempt + 1} after ${delay}ms (status=${status}) \u2014 ${errAsErr.message}`);
19757
- await new Promise((resolve8) => setTimeout(resolve8, delay));
19811
+ await new Promise((resolve9) => setTimeout(resolve9, delay));
19758
19812
  return this.completeWithRetry(provider, request, abortController, attempt + 1);
19759
19813
  }
19760
19814
  }
@@ -20769,7 +20823,7 @@ function createMcpControlTool(opts) {
20769
20823
  description: "Manage MCP server lifecycle: list available servers, search by name or capability, enable or disable servers at runtime, restart running servers.",
20770
20824
  category: "mcp",
20771
20825
  permission: "auto",
20772
- mutating: false,
20826
+ mutating: true,
20773
20827
  riskTier: "standard",
20774
20828
  inputSchema,
20775
20829
  async execute(raw, ctx) {
@@ -21251,12 +21305,12 @@ function makeContinueToNextIterationTool() {
21251
21305
  // src/core/iteration-limit.ts
21252
21306
  function requestLimitExtension(opts) {
21253
21307
  const { events, currentIterations, currentLimit, autoExtend, timeoutMs = 3e4 } = opts;
21254
- return new Promise((resolve8) => {
21308
+ return new Promise((resolve9) => {
21255
21309
  let resolved = false;
21256
21310
  const timerFired = () => {
21257
21311
  if (!resolved) {
21258
21312
  resolved = true;
21259
- resolve8(0);
21313
+ resolve9(0);
21260
21314
  }
21261
21315
  };
21262
21316
  const timer = setTimeout(timerFired, timeoutMs);
@@ -21265,14 +21319,14 @@ function requestLimitExtension(opts) {
21265
21319
  if (!resolved) {
21266
21320
  resolved = true;
21267
21321
  clearTimeout(timer);
21268
- resolve8(0);
21322
+ resolve9(0);
21269
21323
  }
21270
21324
  };
21271
21325
  const grant = (extra) => {
21272
21326
  if (!resolved) {
21273
21327
  resolved = true;
21274
21328
  clearTimeout(timer);
21275
- resolve8(Math.max(0, extra));
21329
+ resolve9(Math.max(0, extra));
21276
21330
  }
21277
21331
  };
21278
21332
  events.emit("iteration.limit_reached", {
@@ -21286,7 +21340,7 @@ function requestLimitExtension(opts) {
21286
21340
  if (!resolved) {
21287
21341
  resolved = true;
21288
21342
  clearTimeout(timer);
21289
- resolve8(100);
21343
+ resolve9(100);
21290
21344
  }
21291
21345
  });
21292
21346
  }
@@ -21855,13 +21909,13 @@ var Agent = class {
21855
21909
  }
21856
21910
  }
21857
21911
  waitForConfirm(info) {
21858
- return new Promise((resolve8) => {
21912
+ return new Promise((resolve9) => {
21859
21913
  this.events.emit("tool.confirm_needed", {
21860
21914
  tool: info.tool,
21861
21915
  input: info.input,
21862
21916
  toolUseId: info.toolUseId,
21863
21917
  suggestedPattern: info.suggestedPattern,
21864
- resolve: resolve8
21918
+ resolve: resolve9
21865
21919
  });
21866
21920
  });
21867
21921
  }
@@ -22578,12 +22632,12 @@ ${mem}`);
22578
22632
  }
22579
22633
  }
22580
22634
  async gitStatus(root) {
22581
- return new Promise((resolve8) => {
22635
+ return new Promise((resolve9) => {
22582
22636
  let settled = false;
22583
22637
  const finish = (s) => {
22584
22638
  if (settled) return;
22585
22639
  settled = true;
22586
- resolve8(s);
22640
+ resolve9(s);
22587
22641
  };
22588
22642
  let proc;
22589
22643
  const timer = setTimeout(() => {
@@ -23941,7 +23995,7 @@ var PhaseOrchestrator = class {
23941
23995
  };
23942
23996
  }
23943
23997
  delay(ms) {
23944
- return new Promise((resolve8) => setTimeout(resolve8, ms));
23998
+ return new Promise((resolve9) => setTimeout(resolve9, ms));
23945
23999
  }
23946
24000
  };
23947
24001
 
@@ -24609,7 +24663,11 @@ var WorktreeManager = class {
24609
24663
  const slug = this.makeSlug(opts.slugHint ?? ownerId);
24610
24664
  const branch = `wstack/ap/${slug}`;
24611
24665
  const dir = join(this.worktreesRoot(), slug);
24612
- assertSafePath(dir, this.projectRoot);
24666
+ const absDir = resolve(dir);
24667
+ const absRoot = resolve(this.projectRoot);
24668
+ if (!absDir.startsWith(absRoot + sep)) {
24669
+ throw new Error(`Worktree dir "${absDir}" resolves outside project root`);
24670
+ }
24613
24671
  const baseBranch = opts.baseBranch ?? await this.detectBaseBranch();
24614
24672
  const handle = {
24615
24673
  id: slug,
@@ -24660,7 +24718,8 @@ var WorktreeManager = class {
24660
24718
  this.emitCommitted(handle, false);
24661
24719
  return { committed: false };
24662
24720
  }
24663
- const committed = await this.runGit(["commit", "-m", message], handle.dir);
24721
+ const idArgs = await this.identityArgs(handle.dir);
24722
+ const committed = await this.runGit([...idArgs, "commit", "-m", message], handle.dir);
24664
24723
  if (committed.code !== 0) {
24665
24724
  this.fail(handle, committed.stderr || "git commit failed");
24666
24725
  return { committed: false };
@@ -24686,7 +24745,10 @@ var WorktreeManager = class {
24686
24745
  const mergeArgs = squash ? ["merge", "--squash", handle.branch] : ["merge", "--no-ff", handle.branch];
24687
24746
  const merged = await this.runGit(mergeArgs, this.projectRoot);
24688
24747
  if (merged.code !== 0) {
24689
- const conflictFiles = await this.unmergedFiles();
24748
+ const fromOutput = parseConflictPaths(`${merged.stdout}
24749
+ ${merged.stderr}`);
24750
+ const fromIndex = await this.unmergedFiles();
24751
+ const conflictFiles = [.../* @__PURE__ */ new Set([...fromOutput, ...fromIndex])];
24690
24752
  await this.runGit(["reset", "--hard", "HEAD"], this.projectRoot);
24691
24753
  handle.conflictFiles = conflictFiles;
24692
24754
  this.setStatus(handle, "needs-review", { lastError: merged.stderr });
@@ -24700,7 +24762,8 @@ var WorktreeManager = class {
24700
24762
  }
24701
24763
  if (squash) {
24702
24764
  const msg = opts.message ?? `merge ${handle.branch} (squash)`;
24703
- const commit = await this.runGit(["commit", "-m", msg], this.projectRoot);
24765
+ const idArgs = await this.identityArgs(this.projectRoot);
24766
+ const commit = await this.runGit([...idArgs, "commit", "-m", msg], this.projectRoot);
24704
24767
  if (commit.code !== 0 && !/nothing to commit/i.test(commit.stdout + commit.stderr)) {
24705
24768
  this.fail(handle, commit.stderr || "squash commit failed");
24706
24769
  return { ok: false, stderr: commit.stderr };
@@ -24775,11 +24838,27 @@ var WorktreeManager = class {
24775
24838
  }
24776
24839
  return { insertions, deletions, files, sha };
24777
24840
  }
24841
+ /**
24842
+ * `git -c user.*` fallback so commits succeed on machines and CI runners
24843
+ * that have no global git identity configured. Returns `[]` when both
24844
+ * `user.name` and `user.email` are already set (the common case), so a real
24845
+ * user's identity is never overridden. The worktree branch commits are
24846
+ * squashed away on merge, so the fallback identity never reaches the base
24847
+ * branch history.
24848
+ */
24849
+ async identityArgs(cwd) {
24850
+ const name = (await this.runGit(["config", "user.name"], cwd)).stdout.trim();
24851
+ const email = (await this.runGit(["config", "user.email"], cwd)).stdout.trim();
24852
+ if (name && email) return [];
24853
+ return [
24854
+ "-c",
24855
+ `user.name=${name || "WrongStack AutoPhase"}`,
24856
+ "-c",
24857
+ `user.email=${email || "autophase@wrongstack.local"}`
24858
+ ];
24859
+ }
24778
24860
  async unmergedFiles() {
24779
- const res = await this.runGit(
24780
- ["diff", "--name-only", "--diff-filter=U"],
24781
- this.projectRoot
24782
- );
24861
+ const res = await this.runGit(["diff", "--name-only", "--diff-filter=U"], this.projectRoot);
24783
24862
  return res.stdout.split("\n").map((s) => s.trim()).filter(Boolean);
24784
24863
  }
24785
24864
  emitCommitted(handle, committed) {
@@ -24832,6 +24911,14 @@ var WorktreeManager = class {
24832
24911
  });
24833
24912
  }
24834
24913
  };
24914
+ function parseConflictPaths(output) {
24915
+ const paths = /* @__PURE__ */ new Set();
24916
+ for (const line of output.split("\n")) {
24917
+ const m = line.match(/^CONFLICT \([^)]*\): Merge conflict in (.+?)\s*$/);
24918
+ if (m?.[1]) paths.add(m[1]);
24919
+ }
24920
+ return [...paths];
24921
+ }
24835
24922
  function assertSafePath(dir, projectRoot) {
24836
24923
  const root = resolve(projectRoot);
24837
24924
  const abs = resolve(dir);
@@ -24840,6 +24927,6 @@ function assertSafePath(dir, projectRoot) {
24840
24927
  }
24841
24928
  }
24842
24929
 
24843
- export { AGENTS_BY_PHASE, AGENT_CATALOG, AISpecBuilder, ALL_AGENT_DEFINITIONS, ALL_FLEET_AGENTS, AUDIT_LOG_AGENT, Agent, AgentError, AutoApprovePermissionPolicy, AutoCompactionMiddleware, AutoExecutor, AutoPhasePlanner, AutoPhaseRunner, AutonomousRunner, BUG_HUNTER_AGENT, BudgetExceededError, CONTEXT_WINDOW_MODES, CheckpointManager, ConfigError, ConfigMigrationError, Container, Context, ConversationState, DEFAULT_CONFIG_MIGRATIONS, DEFAULT_CONTEXT_CONFIG, DEFAULT_CONTEXT_WINDOW_MODE_ID, DEFAULT_DIRECTOR_PREAMBLE, DEFAULT_DISPATCH_ROLE, DEFAULT_MAX_ITERATIONS, DEFAULT_MODES, DEFAULT_RECOVERY_STRATEGIES, DEFAULT_SPEC_TEMPLATE, DEFAULT_SUBAGENT_BASELINE, DEFAULT_TOOLS_CONFIG, DefaultAttachmentStore, DefaultConfigLoader, DefaultConfigStore, DefaultErrorHandler, DefaultHealthRegistry, DefaultLogger, DefaultMemoryStore, DefaultModeStore, DefaultModelsRegistry, DefaultMultiAgentCoordinator, DefaultPathResolver, DefaultPermissionPolicy, DefaultPluginAPI, DefaultProviderRunner, DefaultRetryPolicy, DefaultSecretScrubber, DefaultSecretVault, DefaultSessionReader, DefaultSessionRewinder, DefaultSessionStore, DefaultSkillLoader, DefaultSystemPromptBuilder, DefaultTaskStore, DefaultTokenCounter, Director, DirectorStateCheckpoint, DoneConditionChecker, ERROR_CODES, EternalAutonomyEngine, EventBus, ExtensionRegistry, FLEET_ROSTER, FLEET_ROSTER_BUDGETS, FleetBus, FleetManager, FleetSpawnBudgetError, FleetUsageAggregator, FsError, GitignoreUpdater, HybridCompactor, InMemoryAgentBridge, InMemoryBridgeTransport, InMemoryMetricsSink, InputBuilder, IntelligentCompactor, KERNEL_API_VERSION, LAYER_1_IDENTITY, LLMSelector, MAX_JOURNAL_ENTRIES, NULL_FLEET_BUS, NoopMetricsSink, NoopTracer, OTelTracer, PROMETHEUS_CONTENT_TYPE, ParallelEternalEngine, PhaseGraphBuilder, PhaseOrchestrator, PhaseStore, Pipeline, PluginError, ProviderError, ProviderRegistry, QueueStore, REFACTOR_PLANNER_AGENT, RecoveryLock, ReportGenerator, RunController, SECURITY_SCANNER_AGENT, SPEC_TEMPLATES, ScopedEventBus, SddParallelRun, SddTaskDecomposer, SecurityScanner, SecurityScannerOrchestrator, SelectiveCompactor, SessionAnalyzer, SessionError, SkillGenerator, SkillInstaller, SkillManifestStore, SlashCommandRegistry, SpecDrivenDev, SpecParser, SpecStore, SpecVersioning, SubagentBudget, TOKENS, TaskFlow, TaskGenerator, TaskGraphStore, TaskTracker, TechStackDetector, ToolError, ToolExecutor, ToolRegistry, WorktreeManager, WrongStackError, addPlanItem, allServers, analyzeCriticalPath, appendJournal, applyRosterBudget, asBlocks, asText, assertSafePath, atomicWrite, attachAutoExtend, attachPlanCheckpoint, attachTodosCheckpoint, awsServer, blockServer, braveSearchServer, buildBtwBlock, buildChildEnv, buildGoalPreamble, buildOtlpMetricsRequest, buildOtlpTracesRequest, buildRecoveryStrategies, classifyFamily, clearPlan, color, compileGlob, compileUserRegex, composeDirectorPrompt, composeSubagentPrompt, computeTaskProgress, consumeBtwNotes, context7Server, contextManagerTool, createAutoExecutor, createAutoPhaseFromTaskGraph, createContextManagerTool, createDefaultPipelines, createDelegateTool, createMcpControlTool, createMessage, createSecuritySlashCommand, createToolOutputSerializer, decryptConfigSecrets, defaultGitignoreUpdater, defaultOrchestrator, defaultReportGenerator, defaultSecurityScanner, defaultSkillGenerator, defaultTechStackDetector, deriveTodosFromPlanItem, detectNewlineStyle, dispatchAgent, downloadGitHubTarball, emptyGoal, emptyPlan, encryptConfigSecrets, ensureDir, estimateRequestTokens, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, everArtServer, extractRunEnv, filesystemServer, findCriticalPath, formatContextWindowModeList, formatGoal, formatPlan, formatPlanTemplates, formatTodosList, getAgentDefinition, getContextWindowMode, getPlanTemplate, getTemplate, githubServer, goalFilePath, googleMapsServer, isAgentError, isConfigError, isContextWindowModeId, isFsError, isImageBlock, isPluginError, isSessionError, isTextBlock, isThinkingBlock, isToolError, isToolResultBlock, isToolUseBlock, isWrongStackError, listContextWindowModes, listPlanTemplates, listTemplates, loadDirectorState, loadGoal, loadPlan, loadPlugins, loadProjectModes, loadTodosCheckpoint, loadUserModes, makeAgentSubagentRunner, makeAutonomyPromptContributor, makeContinueToNextIterationTool, makeDirectorSessionFactory, makeLLMClassifier, matchAny, matchGlob, migratePlaintextSecrets, miniMaxVisionServer, normalizeToLf, parseContinueDirective, parseSkillRef, pendingBtwCount, projectHash, removePlanItem, renderProgress, renderPrometheus, renderSpecAnalysis, renderTaskGraph, renderTaskList, repairToolUseAdjacency, resolveContextWindowPolicy, resolveWstackPaths, rewriteConfigEncrypted, rosterSummaryFromConfigs, runConfigMigrations, safeParse, safeStringify, sanitizeJsonString, saveGoal, savePlan, saveTodosCheckpoint, scoreAgents, securitySlashCommand, sentinelServer, setBtwNote, setPlanItemStatus, slackServer, startMetricsServer, startOtlpMetricsExporter, startOtlpTraceExporter, stripAnsi, summarizeUsage, templateToMarkdown, toStyle, toWrongStackError, topologicalSort, unifiedDiff, unloadPlugins, validateAgainstSchema, wireMetricsToEvents, wrapAsState, zaiVisionServer };
24930
+ export { AGENTS_BY_PHASE, AGENT_CATALOG, AISpecBuilder, ALL_AGENT_DEFINITIONS, ALL_FLEET_AGENTS, AUDIT_LOG_AGENT, Agent, AgentError, AutoApprovePermissionPolicy, AutoCompactionMiddleware, AutoExecutor, AutoPhasePlanner, AutoPhaseRunner, AutonomousRunner, BUG_HUNTER_AGENT, BudgetExceededError, CONTEXT_WINDOW_MODES, CheckpointManager, ConfigError, ConfigMigrationError, Container, Context, ConversationState, DEFAULT_AUTONOMY_CONFIG, DEFAULT_CONFIG_MIGRATIONS, DEFAULT_CONTEXT_CONFIG, DEFAULT_CONTEXT_WINDOW_MODE_ID, DEFAULT_DIRECTOR_PREAMBLE, DEFAULT_DISPATCH_ROLE, DEFAULT_MAX_ITERATIONS, DEFAULT_MODES, DEFAULT_RECOVERY_STRATEGIES, DEFAULT_SPEC_TEMPLATE, DEFAULT_SUBAGENT_BASELINE, DEFAULT_TOOLS_CONFIG, DefaultAttachmentStore, DefaultConfigLoader, DefaultConfigStore, DefaultErrorHandler, DefaultHealthRegistry, DefaultLogger, DefaultMemoryStore, DefaultModeStore, DefaultModelsRegistry, DefaultMultiAgentCoordinator, DefaultPathResolver, DefaultPermissionPolicy, DefaultPluginAPI, DefaultProviderRunner, DefaultRetryPolicy, DefaultSecretScrubber, DefaultSecretVault, DefaultSessionReader, DefaultSessionRewinder, DefaultSessionStore, DefaultSkillLoader, DefaultSystemPromptBuilder, DefaultTaskStore, DefaultTokenCounter, Director, DirectorStateCheckpoint, DoneConditionChecker, ERROR_CODES, EternalAutonomyEngine, EventBus, ExtensionRegistry, FLEET_ROSTER, FLEET_ROSTER_BUDGETS, FleetBus, FleetManager, FleetSpawnBudgetError, FleetUsageAggregator, FsError, GitignoreUpdater, HybridCompactor, InMemoryAgentBridge, InMemoryBridgeTransport, InMemoryMetricsSink, InputBuilder, IntelligentCompactor, KERNEL_API_VERSION, LAYER_1_IDENTITY, LLMSelector, MAX_JOURNAL_ENTRIES, NULL_FLEET_BUS, NoopMetricsSink, NoopTracer, OTelTracer, PROMETHEUS_CONTENT_TYPE, ParallelEternalEngine, PhaseGraphBuilder, PhaseOrchestrator, PhaseStore, Pipeline, PluginError, ProviderError, ProviderRegistry, QueueStore, REFACTOR_PLANNER_AGENT, RecoveryLock, ReportGenerator, RunController, SECURITY_SCANNER_AGENT, SPEC_TEMPLATES, ScopedEventBus, SddParallelRun, SddTaskDecomposer, SecurityScanner, SecurityScannerOrchestrator, SelectiveCompactor, SessionAnalyzer, SessionError, SkillGenerator, SkillInstaller, SkillManifestStore, SlashCommandRegistry, SpecDrivenDev, SpecParser, SpecStore, SpecVersioning, SubagentBudget, TOKENS, TaskFlow, TaskGenerator, TaskGraphStore, TaskTracker, TechStackDetector, ToolError, ToolExecutor, ToolRegistry, WorktreeManager, WrongStackError, addPlanItem, allServers, analyzeCriticalPath, appendJournal, applyRosterBudget, asBlocks, asText, assertSafePath, atomicWrite, attachAutoExtend, attachPlanCheckpoint, attachTodosCheckpoint, awsServer, blockServer, braveSearchServer, buildBtwBlock, buildChildEnv, buildGoalPreamble, buildOtlpMetricsRequest, buildOtlpTracesRequest, buildRecoveryStrategies, classifyFamily, clearPlan, color, compileGlob, compileUserRegex, composeDirectorPrompt, composeSubagentPrompt, computeTaskProgress, consumeBtwNotes, context7Server, contextManagerTool, createAutoExecutor, createAutoPhaseFromTaskGraph, createContextManagerTool, createDefaultPipelines, createDelegateTool, createMcpControlTool, createMessage, createSecuritySlashCommand, createToolOutputSerializer, decryptConfigSecrets, defaultGitignoreUpdater, defaultOrchestrator, defaultReportGenerator, defaultSecurityScanner, defaultSkillGenerator, defaultTechStackDetector, deriveTodosFromPlanItem, detectNewlineStyle, dispatchAgent, downloadGitHubTarball, emptyGoal, emptyPlan, encryptConfigSecrets, ensureDir, estimateRequestTokens, estimateTextTokens, estimateToolDefTokens, estimateToolInputTokens, estimateToolResultTokens, everArtServer, extractRunEnv, filesystemServer, findCriticalPath, formatContextWindowModeList, formatGoal, formatPlan, formatPlanTemplates, formatTodosList, getAgentDefinition, getContextWindowMode, getPlanTemplate, getTemplate, githubServer, goalFilePath, googleMapsServer, isAgentError, isConfigError, isContextWindowModeId, isFsError, isImageBlock, isPluginError, isSessionError, isTextBlock, isThinkingBlock, isToolError, isToolResultBlock, isToolUseBlock, isWrongStackError, listContextWindowModes, listPlanTemplates, listTemplates, loadDirectorState, loadGoal, loadPlan, loadPlugins, loadProjectModes, loadTodosCheckpoint, loadUserModes, makeAgentSubagentRunner, makeAutonomyPromptContributor, makeContinueToNextIterationTool, makeDirectorSessionFactory, makeLLMClassifier, matchAny, matchGlob, migratePlaintextSecrets, miniMaxVisionServer, normalizeToLf, parseContinueDirective, parseSkillRef, pendingBtwCount, projectHash, removePlanItem, renderProgress, renderPrometheus, renderSpecAnalysis, renderTaskGraph, renderTaskList, repairToolUseAdjacency, resolveContextWindowPolicy, resolveWstackPaths, rewriteConfigEncrypted, rosterSummaryFromConfigs, runConfigMigrations, safeParse, safeStringify, sanitizeJsonString, saveGoal, savePlan, saveTodosCheckpoint, scoreAgents, securitySlashCommand, sentinelServer, setBtwNote, setPlanItemStatus, slackServer, startMetricsServer, startOtlpMetricsExporter, startOtlpTraceExporter, stripAnsi, summarizeUsage, templateToMarkdown, toStyle, toWrongStackError, topologicalSort, unifiedDiff, unloadPlugins, validateAgainstSchema, wireMetricsToEvents, wrapAsState, zaiVisionServer };
24844
24931
  //# sourceMappingURL=index.js.map
24845
24932
  //# sourceMappingURL=index.js.map