@wrongstack/core 0.104.0 → 0.109.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.
@@ -5,7 +5,7 @@ export { A as AuditLevel, S as SessionEventBridge, b as SessionEventBridgeOption
5
5
  export { a as DirectorStateCheckpoint, D as DirectorStateSnapshot, b as DirectorSubagentState, c as DirectorTaskState, l as loadDirectorState } from '../director-state-BfeCUbmk.js';
6
6
  export { D as DefaultSecretScrubber, a as DefaultSecretVault, S as SecretVaultOptions, d as decryptConfigSecrets, e as encryptConfigSecrets, m as migratePlaintextSecrets, r as rewriteConfigEncrypted } from '../secret-vault-DrOhc2i5.js';
7
7
  export { A as AutoApprovePermissionPolicy, D as DefaultPermissionPolicy, P as PermissionPolicyOptions } from '../permission-policy-dF74EpDp.js';
8
- export { C as CompactorOptions, D as DefaultErrorHandler, a as DefaultRetryPolicy, E as EternalAutonomyEngine, b as EternalAutonomyOptions, c as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, d as ParallelEternalEngine, e as ParallelEternalOptions, f as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-CUtmM_0V.js';
8
+ export { C as CompactorOptions, D as DefaultErrorHandler, a as DefaultRetryPolicy, E as EternalAutonomyEngine, b as EternalAutonomyOptions, c as EternalEngineState, H as HybridCompactor, I as IterationStage, P as ParallelEngineState, d as ParallelEternalEngine, e as ParallelEternalOptions, f as ParallelIterationStage, T as ToolExecutor } from '../parallel-eternal-engine-B2CbsKpc.js';
9
9
  export { A as AutoCompactionMiddleware, a as AutonomousRunner, b as AutonomousRunnerOptions, c as AutonomyPromptContributorOptions, D as DefaultSkillLoader, d as DoneCheckResult, e as DoneConditionChecker, I as IntelligentCompactor, f as IntelligentCompactorOptions, S as SelectiveCompactor, g as SelectiveCompactorOptions, h as SkillLoaderOptions, i as buildGoalPreamble, m as makeAutonomyPromptContributor } from '../goal-preamble-CI8lxeY1.js';
10
10
  import { P as ProviderRunner, R as RunProviderOptions } from '../provider-runner-BUunikwY.js';
11
11
  import { b as Response } from '../context-CNRYfhUv.js';
@@ -32,7 +32,7 @@ import '../compactor-DXLxLcmU.js';
32
32
  import '../index-DIKEcfgC.js';
33
33
  import '../pipeline-BqiA_UMr.js';
34
34
  import '../observability-D-HZN_mF.js';
35
- import '../goal-store-ht0VmR1A.js';
35
+ import '../goal-store-CV9Yz2X_.js';
36
36
  import '../skill-Bj6Ezqb8.js';
37
37
  import '../selector-C7wcdqMA.js';
38
38
  import 'node:events';
@@ -1,7 +1,7 @@
1
1
  import * as crypto2 from 'crypto';
2
2
  import { randomBytes, randomUUID, createCipheriv, createDecipheriv, createHash } from 'crypto';
3
3
  import * as fsp from 'fs/promises';
4
- import * as path3 from 'path';
4
+ import * as path11 from 'path';
5
5
  import { isAbsolute, resolve } from 'path';
6
6
  import * as fs5 from 'fs';
7
7
  import * as os from 'os';
@@ -28,9 +28,9 @@ __export(atomic_write_exports, {
28
28
  withFileLock: () => withFileLock
29
29
  });
30
30
  async function atomicWrite(targetPath, content, opts = {}) {
31
- const dir = path3.dirname(targetPath);
31
+ const dir = path11.dirname(targetPath);
32
32
  await fsp.mkdir(dir, { recursive: true });
33
- const tmp = path3.join(dir, `.${path3.basename(targetPath)}.${randomBytes(6).toString("hex")}.tmp`);
33
+ const tmp = path11.join(dir, `.${path11.basename(targetPath)}.${randomBytes(6).toString("hex")}.tmp`);
34
34
  try {
35
35
  if (typeof content === "string") {
36
36
  await fsp.writeFile(tmp, content, { flag: "wx", encoding: opts.encoding ?? "utf8" });
@@ -69,9 +69,9 @@ async function ensureDir(dir) {
69
69
  await fsp.mkdir(dir, { recursive: true });
70
70
  }
71
71
  async function withFileLock(targetPath, fn, opts = {}) {
72
- const dir = path3.dirname(targetPath);
72
+ const dir = path11.dirname(targetPath);
73
73
  await fsp.mkdir(dir, { recursive: true });
74
- const lockPath = path3.join(dir, `.${path3.basename(targetPath)}.lock`);
74
+ const lockPath = path11.join(dir, `.${path11.basename(targetPath)}.lock`);
75
75
  const timeoutMs = opts.timeoutMs ?? 5e3;
76
76
  const staleMs = opts.staleMs ?? 3e4;
77
77
  const started = Date.now();
@@ -218,7 +218,7 @@ var DefaultLogger = class _DefaultLogger {
218
218
  this.stderr = opts.stderr !== false;
219
219
  if (this.file) {
220
220
  try {
221
- fs5.mkdirSync(path3.dirname(this.file), { recursive: true });
221
+ fs5.mkdirSync(path11.dirname(this.file), { recursive: true });
222
222
  } catch {
223
223
  }
224
224
  }
@@ -414,11 +414,11 @@ var DefaultSessionStore = class _DefaultSessionStore {
414
414
  }
415
415
  /** Absolute path to the session index file. */
416
416
  get indexFile() {
417
- return path3.join(this.dir, "_index.jsonl");
417
+ return path11.join(this.dir, "_index.jsonl");
418
418
  }
419
419
  /** Join session ID to its absolute path within the store directory. */
420
420
  sessionPath(id, ext) {
421
- return path3.join(this.dir, `${id}${ext}`);
421
+ return path11.join(this.dir, `${id}${ext}`);
422
422
  }
423
423
  /**
424
424
  * Ensure the directory implied by the session ID exists. When the ID
@@ -426,7 +426,7 @@ var DefaultSessionStore = class _DefaultSessionStore {
426
426
  * subdirectory so sessions group naturally by day.
427
427
  */
428
428
  async ensureShardDir(id) {
429
- const dirPath = path3.dirname(path3.join(this.dir, id));
429
+ const dirPath = path11.dirname(path11.join(this.dir, id));
430
430
  await ensureDir(dirPath);
431
431
  return dirPath;
432
432
  }
@@ -434,7 +434,7 @@ var DefaultSessionStore = class _DefaultSessionStore {
434
434
  const startedAt = (/* @__PURE__ */ new Date()).toISOString();
435
435
  const id = meta.id && meta.id.length > 0 ? meta.id : generateSessionId(startedAt, meta.model ?? meta.provider);
436
436
  const shardDir = await this.ensureShardDir(id);
437
- const file = path3.join(shardDir, `${path3.basename(id)}.jsonl`);
437
+ const file = path11.join(shardDir, `${path11.basename(id)}.jsonl`);
438
438
  let handle;
439
439
  try {
440
440
  handle = await fsp.open(file, "a", 384);
@@ -642,7 +642,7 @@ var DefaultSessionStore = class _DefaultSessionStore {
642
642
  continue;
643
643
  if (entry.isDirectory()) {
644
644
  const childPrefix = depth === 0 ? entry.name : `${prefix}/${entry.name}`;
645
- ids.push(...await this.collectSessionIds(path3.join(dir, entry.name), childPrefix, depth + 1));
645
+ ids.push(...await this.collectSessionIds(path11.join(dir, entry.name), childPrefix, depth + 1));
646
646
  } else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
647
647
  if (entry.name === "_index.jsonl") continue;
648
648
  const base = entry.name.replace(/\.jsonl$/, "");
@@ -676,12 +676,12 @@ var DefaultSessionStore = class _DefaultSessionStore {
676
676
  async deleteSession(id) {
677
677
  await fsp.unlink(this.sessionPath(id, ".jsonl")).catch(() => void 0);
678
678
  await fsp.unlink(this.sessionPath(id, ".summary.json")).catch(() => void 0);
679
- const shardDir = path3.dirname(path3.join(this.dir, id));
680
- const base = path3.basename(id);
679
+ const shardDir = path11.dirname(path11.join(this.dir, id));
680
+ const base = path11.basename(id);
681
681
  for (const ext of [".plan.json", ".todos.json"]) {
682
- await fsp.unlink(path3.join(shardDir, `${base}${ext}`)).catch(() => void 0);
682
+ await fsp.unlink(path11.join(shardDir, `${base}${ext}`)).catch(() => void 0);
683
683
  }
684
- const sessDir = path3.join(shardDir, base);
684
+ const sessDir = path11.join(shardDir, base);
685
685
  await fsp.rm(sessDir, { recursive: true, force: true }).catch(() => void 0);
686
686
  await this.writeTombstone(id);
687
687
  }
@@ -693,7 +693,7 @@ var DefaultSessionStore = class _DefaultSessionStore {
693
693
  let deleted = 0;
694
694
  let activeSessionId = null;
695
695
  try {
696
- const raw = await fsp.readFile(path3.join(this.dir, "active.json"), "utf8");
696
+ const raw = await fsp.readFile(path11.join(this.dir, "active.json"), "utf8");
697
697
  const active = JSON.parse(raw);
698
698
  activeSessionId = active.sessionId ?? null;
699
699
  } catch {
@@ -701,11 +701,11 @@ var DefaultSessionStore = class _DefaultSessionStore {
701
701
  const entries = await fsp.readdir(this.dir, { withFileTypes: true }).catch(() => []);
702
702
  for (const entry of entries) {
703
703
  if (!entry.isDirectory()) continue;
704
- const dateDir = path3.join(this.dir, entry.name);
704
+ const dateDir = path11.join(this.dir, entry.name);
705
705
  const files = await fsp.readdir(dateDir, { withFileTypes: true }).catch(() => []);
706
706
  for (const file of files) {
707
707
  if (!file.isFile() || !file.name.endsWith(".jsonl")) continue;
708
- const jsonlPath = path3.join(dateDir, file.name);
708
+ const jsonlPath = path11.join(dateDir, file.name);
709
709
  try {
710
710
  const stat6 = await fsp.stat(jsonlPath);
711
711
  if (stat6.mtimeMs >= cutoff) continue;
@@ -723,7 +723,7 @@ var DefaultSessionStore = class _DefaultSessionStore {
723
723
  }
724
724
  for (const entry of entries) {
725
725
  if (!entry.isDirectory()) continue;
726
- const dateDir = path3.join(this.dir, entry.name);
726
+ const dateDir = path11.join(this.dir, entry.name);
727
727
  try {
728
728
  const remaining = await fsp.readdir(dateDir);
729
729
  if (remaining.length === 0) {
@@ -888,7 +888,7 @@ var FileSessionWriter = class {
888
888
  this.meta = meta;
889
889
  this.events = events;
890
890
  this.resumed = opts.resumed ?? false;
891
- this.manifestFile = opts.dir ? path3.join(opts.dir, `${path3.basename(id)}.summary.json`) : "";
891
+ this.manifestFile = opts.dir ? path11.join(opts.dir, `${path11.basename(id)}.summary.json`) : "";
892
892
  this.filePath = opts.filePath ?? "";
893
893
  this.secretScrubber = opts.secretScrubber;
894
894
  this.onCloseCb = opts.onClose;
@@ -1211,7 +1211,7 @@ init_atomic_write();
1211
1211
  var QueueStore = class {
1212
1212
  file;
1213
1213
  constructor(opts) {
1214
- this.file = path3.join(opts.dir, "queue.json");
1214
+ this.file = path11.join(opts.dir, "queue.json");
1215
1215
  }
1216
1216
  async write(items) {
1217
1217
  if (items.length === 0) {
@@ -1281,7 +1281,7 @@ var DefaultAttachmentStore = class {
1281
1281
  let data = input.data;
1282
1282
  if (this.spoolDir && bytes >= this.spoolThreshold) {
1283
1283
  await fsp.mkdir(this.spoolDir, { recursive: true });
1284
- spooledPath = path3.join(this.spoolDir, `${id}.bin`);
1284
+ spooledPath = path11.join(this.spoolDir, `${id}.bin`);
1285
1285
  await atomicWrite(spooledPath, input.data, {
1286
1286
  encoding: input.kind === "image" ? "base64" : "utf8"
1287
1287
  });
@@ -1493,7 +1493,7 @@ var FileMemoryBackend = class {
1493
1493
  }
1494
1494
  async remember(scope, entry, filePath) {
1495
1495
  const file = this.resolveFile(filePath, scope);
1496
- await ensureDir(path3.dirname(file));
1496
+ await ensureDir(path11.dirname(file));
1497
1497
  let existing = "";
1498
1498
  try {
1499
1499
  existing = await fsp.readFile(file, "utf8");
@@ -2462,7 +2462,7 @@ var RecoveryLock = class {
2462
2462
  sessionStore;
2463
2463
  probe;
2464
2464
  constructor(opts) {
2465
- this.file = path3.join(opts.dir, LOCK_FILE);
2465
+ this.file = path11.join(opts.dir, LOCK_FILE);
2466
2466
  this.pid = opts.pid ?? process.pid;
2467
2467
  this.hostname = opts.hostname ?? os.hostname();
2468
2468
  this.maxAgeMs = opts.maxAgeMs ?? DEFAULT_MAX_AGE_MS;
@@ -2520,7 +2520,7 @@ var RecoveryLock = class {
2520
2520
  * null return before calling this.
2521
2521
  */
2522
2522
  async write(sessionId) {
2523
- await ensureDir(path3.dirname(this.file));
2523
+ await ensureDir(path11.dirname(this.file));
2524
2524
  const lock = {
2525
2525
  v: 1,
2526
2526
  sessionId,
@@ -3753,7 +3753,7 @@ var DefaultSecretVault = class {
3753
3753
  } catch (err) {
3754
3754
  if (err.code !== "ENOENT") throw err;
3755
3755
  }
3756
- fs5.mkdirSync(path3.dirname(this.keyFile), { recursive: true });
3756
+ fs5.mkdirSync(path11.dirname(this.keyFile), { recursive: true });
3757
3757
  const key = randomBytes(KEY_BYTES);
3758
3758
  try {
3759
3759
  fs5.writeFileSync(this.keyFile, key, { mode: 384, flag: "wx" });
@@ -3822,7 +3822,7 @@ async function rewriteConfigEncrypted(configPath, vault, patch) {
3822
3822
  }
3823
3823
  const merged = deepMerge2(current, patch ?? {});
3824
3824
  const encrypted = encryptConfigSecrets(merged, vault);
3825
- await fsp.mkdir(path3.dirname(configPath), { recursive: true });
3825
+ await fsp.mkdir(path11.dirname(configPath), { recursive: true });
3826
3826
  await atomicWrite(configPath, JSON.stringify(encrypted, null, 2), { mode: 384 });
3827
3827
  await restrictFilePermissions(configPath);
3828
3828
  }
@@ -4063,9 +4063,9 @@ function getInputString(input, key) {
4063
4063
  function pathLooksInsideProject(rawPath, projectRoot) {
4064
4064
  if (!projectRoot) return false;
4065
4065
  if (rawPath === "~" || rawPath.startsWith("~/") || rawPath.startsWith("~\\")) return false;
4066
- const resolved = path3.resolve(projectRoot, rawPath);
4067
- const relative2 = path3.relative(projectRoot, resolved);
4068
- return !!relative2 && !relative2.startsWith("..") && !path3.isAbsolute(relative2);
4066
+ const resolved = path11.resolve(projectRoot, rawPath);
4067
+ const relative2 = path11.relative(projectRoot, resolved);
4068
+ return !!relative2 && !relative2.startsWith("..") && !path11.isAbsolute(relative2);
4069
4069
  }
4070
4070
  function tokenizeShell(command) {
4071
4071
  return command.match(/"[^"]*"|'[^']*'|\S+/g)?.map((token) => token.replace(/^['"]|['"]$/g, "")) ?? [];
@@ -4075,7 +4075,7 @@ function pathTokenIsOutsideProject(token, projectRoot) {
4075
4075
  if (token === "/" || token === "~" || token === "." || token === "..") return token !== ".";
4076
4076
  if (token.includes("*")) return true;
4077
4077
  if (token.startsWith("..") || token.includes("../") || token.includes("..\\")) return true;
4078
- if (path3.isAbsolute(token) || token.startsWith("~/")) return !pathLooksInsideProject(token, projectRoot);
4078
+ if (path11.isAbsolute(token) || token.startsWith("~/")) return !pathLooksInsideProject(token, projectRoot);
4079
4079
  return false;
4080
4080
  }
4081
4081
  function hasDangerousDeleteTarget(tokens, start, projectRoot) {
@@ -4731,7 +4731,7 @@ var DefaultSkillLoader = class {
4731
4731
  const entries = await fsp.readdir(dir, { withFileTypes: true });
4732
4732
  for (const e of entries) {
4733
4733
  if (!e.isDirectory()) continue;
4734
- const skillFile = path3.join(dir, e.name, "SKILL.md");
4734
+ const skillFile = path11.join(dir, e.name, "SKILL.md");
4735
4735
  try {
4736
4736
  const raw = await fsp.readFile(skillFile, "utf8");
4737
4737
  const meta = parseFrontmatter(raw);
@@ -7037,10 +7037,62 @@ var AutonomousRunner = class {
7037
7037
 
7038
7038
  // src/storage/goal-store.ts
7039
7039
  init_atomic_write();
7040
+ function projectHash(absRoot) {
7041
+ return createHash("sha256").update(path11.resolve(absRoot)).digest("hex").slice(0, 12);
7042
+ }
7043
+ function projectSlug(absRoot) {
7044
+ const base = slugify(path11.basename(absRoot));
7045
+ const hash = createHash("sha256").update(path11.resolve(absRoot)).digest("hex").slice(0, 6);
7046
+ return `${base}-${hash}`;
7047
+ }
7048
+ function slugify(name) {
7049
+ return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40) || "project";
7050
+ }
7051
+ function resolveWstackPaths(opts) {
7052
+ const home = opts.userHome ?? os.homedir();
7053
+ const globalRoot = opts.globalRoot ?? path11.join(home, ".wrongstack");
7054
+ const hash = projectHash(opts.projectRoot);
7055
+ const slug = projectSlug(opts.projectRoot);
7056
+ const projectDir = path11.join(globalRoot, "projects", slug);
7057
+ return {
7058
+ globalRoot,
7059
+ configDir: globalRoot,
7060
+ globalConfig: path11.join(globalRoot, "config.json"),
7061
+ secretsKey: path11.join(globalRoot, ".key"),
7062
+ globalMemory: path11.join(globalRoot, "memory.md"),
7063
+ globalSkills: path11.join(globalRoot, "skills"),
7064
+ globalPrompts: path11.join(globalRoot, "prompts"),
7065
+ cacheDir: path11.join(globalRoot, "cache"),
7066
+ modelsCache: path11.join(globalRoot, "cache", "models.dev.json"),
7067
+ modelsOverlayCache: path11.join(globalRoot, "cache", "models-overlay.json"),
7068
+ historyFile: path11.join(globalRoot, "history"),
7069
+ logFile: path11.join(globalRoot, "logs", "wrongstack.log"),
7070
+ projectDir,
7071
+ projectCodebaseIndex: path11.join(projectDir, "codebase-index"),
7072
+ projectMemory: path11.join(projectDir, "memory.md"),
7073
+ projectSessions: path11.join(projectDir, "sessions"),
7074
+ projectTrust: path11.join(projectDir, "trust.json"),
7075
+ projectMeta: path11.join(projectDir, "meta.json"),
7076
+ projectLocalConfig: path11.join(projectDir, "config.local.json"),
7077
+ inProjectAgentsFile: path11.join(opts.projectRoot, ".wrongstack", "AGENTS.md"),
7078
+ inProjectSkills: path11.join(opts.projectRoot, ".wrongstack", "skills"),
7079
+ inProjectWorktrees: path11.join(opts.projectRoot, ".wrongstack", "worktrees"),
7080
+ projectHash: hash,
7081
+ projectSlug: slug,
7082
+ projectGoal: path11.join(projectDir, "goal.json"),
7083
+ projectSpecs: path11.join(projectDir, "specs"),
7084
+ projectTaskGraphs: path11.join(projectDir, "task-graphs"),
7085
+ projectSddSession: path11.join(projectDir, "sdd-session.json"),
7086
+ projectPlan: path11.join(projectDir, "plan.json"),
7087
+ projectAutophase: path11.join(projectDir, "autophase"),
7088
+ syncConfig: path11.join(globalRoot, "sync.json")
7089
+ };
7090
+ }
7091
+
7092
+ // src/storage/goal-store.ts
7040
7093
  var MAX_JOURNAL_ENTRIES = 500;
7041
7094
  function goalFilePath(projectRoot) {
7042
- const hash = createHash("sha256").update(path3.resolve(projectRoot)).digest("hex").slice(0, 12);
7043
- return path3.join(os.homedir(), ".wrongstack", "projects", hash, "goal.json");
7095
+ return resolveWstackPaths({ projectRoot }).projectGoal;
7044
7096
  }
7045
7097
  async function loadGoal(filePath) {
7046
7098
  let raw;
@@ -14900,7 +14952,7 @@ var Director = class _Director {
14900
14952
  })),
14901
14953
  usage: this.usage.snapshot()
14902
14954
  };
14903
- await fsp.mkdir(path3.dirname(this.manifestPath), { recursive: true });
14955
+ await fsp.mkdir(path11.dirname(this.manifestPath), { recursive: true });
14904
14956
  await atomicWrite(this.manifestPath, JSON.stringify(manifest, null, 2), { mode: 384 });
14905
14957
  return this.manifestPath;
14906
14958
  }
@@ -15106,7 +15158,7 @@ var Director = class _Director {
15106
15158
  */
15107
15159
  async readSession(subagentId, tail) {
15108
15160
  if (!this.sessionsRoot) return null;
15109
- const filePath = path3.join(this.sessionsRoot, this.directorRunId, `${subagentId}.jsonl`);
15161
+ const filePath = path11.join(this.sessionsRoot, this.directorRunId, `${subagentId}.jsonl`);
15110
15162
  let raw;
15111
15163
  try {
15112
15164
  raw = await fsp.readFile(filePath, "utf8");
@@ -15630,13 +15682,13 @@ async function readSubagentPartial(opts, subagentId) {
15630
15682
  if (!opts.sessionsRoot) return void 0;
15631
15683
  const candidates = [];
15632
15684
  if (opts.directorRunId) {
15633
- candidates.push(path3.join(opts.sessionsRoot, opts.directorRunId, `${subagentId}.jsonl`));
15685
+ candidates.push(path11.join(opts.sessionsRoot, opts.directorRunId, `${subagentId}.jsonl`));
15634
15686
  } else {
15635
15687
  try {
15636
15688
  const entries = await fsp.readdir(opts.sessionsRoot, { withFileTypes: true });
15637
15689
  for (const entry of entries) {
15638
15690
  if (entry.isDirectory()) {
15639
- candidates.push(path3.join(opts.sessionsRoot, entry.name, `${subagentId}.jsonl`));
15691
+ candidates.push(path11.join(opts.sessionsRoot, entry.name, `${subagentId}.jsonl`));
15640
15692
  }
15641
15693
  }
15642
15694
  } catch {
@@ -15685,9 +15737,9 @@ function makeDirectorSessionFactory(opts) {
15685
15737
  let dir;
15686
15738
  if (opts.store) {
15687
15739
  store = opts.store;
15688
- dir = opts.sessionsRoot ? path3.join(opts.sessionsRoot, runId) : "(caller-managed)";
15740
+ dir = opts.sessionsRoot ? path11.join(opts.sessionsRoot, runId) : "(caller-managed)";
15689
15741
  } else if (opts.sessionsRoot) {
15690
- dir = path3.join(opts.sessionsRoot, runId);
15742
+ dir = path11.join(opts.sessionsRoot, runId);
15691
15743
  store = new DefaultSessionStore({ dir });
15692
15744
  } else {
15693
15745
  throw new Error("makeDirectorSessionFactory requires either `store` or `sessionsRoot`");
@@ -15894,7 +15946,7 @@ var DefaultModelsRegistry = class {
15894
15946
  this.overlay = opts.overlay;
15895
15947
  this.overlayUrl = opts.overlayUrl;
15896
15948
  this.overlayFile = opts.overlayFile;
15897
- this.overlayCacheFile = opts.overlayCacheFile ?? (opts.overlayUrl ? path3.join(path3.dirname(opts.cacheFile), "models-overlay-cache.json") : void 0);
15949
+ this.overlayCacheFile = opts.overlayCacheFile ?? (opts.overlayUrl ? path11.join(path11.dirname(opts.cacheFile), "models-overlay-cache.json") : void 0);
15898
15950
  }
15899
15951
  async load(opts = {}) {
15900
15952
  if (this.payload && !opts.force) return this.payload;
@@ -16107,7 +16159,7 @@ var DefaultModelsRegistry = class {
16107
16159
  }
16108
16160
  /** Used by `wstack models refresh` to expose where the cache lives. */
16109
16161
  cacheLocation() {
16110
- return path3.resolve(this.cacheFile);
16162
+ return path11.resolve(this.cacheFile);
16111
16163
  }
16112
16164
  };
16113
16165
  function hasEntries(payload) {
@@ -16403,7 +16455,7 @@ var DefaultModeStore = class {
16403
16455
  }
16404
16456
  async loadActiveMode() {
16405
16457
  try {
16406
- const configPath = path3.join(this.configDir, "mode.json");
16458
+ const configPath = path11.join(this.configDir, "mode.json");
16407
16459
  const content = await fsp.readFile(configPath, "utf8");
16408
16460
  const data = JSON.parse(content);
16409
16461
  this.activeModeId = data.activeMode ?? null;
@@ -16414,7 +16466,7 @@ var DefaultModeStore = class {
16414
16466
  async saveActiveMode() {
16415
16467
  try {
16416
16468
  await fsp.mkdir(this.configDir, { recursive: true });
16417
- const configPath = path3.join(this.configDir, "mode.json");
16469
+ const configPath = path11.join(this.configDir, "mode.json");
16418
16470
  await atomicWrite(
16419
16471
  configPath,
16420
16472
  JSON.stringify({ activeMode: this.activeModeId }, null, 2)
@@ -16429,11 +16481,11 @@ async function loadProjectModes(modesDir) {
16429
16481
  const entries = await fsp.readdir(modesDir);
16430
16482
  for (const entry of entries) {
16431
16483
  if (!entry.endsWith(".md") && !entry.endsWith(".txt")) continue;
16432
- const filePath = path3.join(modesDir, entry);
16484
+ const filePath = path11.join(modesDir, entry);
16433
16485
  const stat6 = await fsp.stat(filePath);
16434
16486
  if (!stat6.isFile()) continue;
16435
16487
  const content = await fsp.readFile(filePath, "utf8");
16436
- const id = path3.basename(entry, path3.extname(entry));
16488
+ const id = path11.basename(entry, path11.extname(entry));
16437
16489
  modes.push({
16438
16490
  id,
16439
16491
  name: id.replace(/[-_]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()),
@@ -16449,7 +16501,7 @@ async function loadProjectModes(modesDir) {
16449
16501
  async function loadUserModes(modesDir) {
16450
16502
  const modes = [];
16451
16503
  try {
16452
- const manifestPath = path3.join(modesDir, "modes.json");
16504
+ const manifestPath = path11.join(modesDir, "modes.json");
16453
16505
  const content = await fsp.readFile(manifestPath, "utf8");
16454
16506
  const manifest = JSON.parse(content);
16455
16507
  for (const mode of manifest.modes) {
@@ -17366,7 +17418,7 @@ var SpecStore = class {
17366
17418
  indexPath;
17367
17419
  constructor(opts) {
17368
17420
  this.baseDir = opts.baseDir;
17369
- this.indexPath = path3.join(this.baseDir, "_index.json");
17421
+ this.indexPath = path11.join(this.baseDir, "_index.json");
17370
17422
  }
17371
17423
  async save(spec) {
17372
17424
  await ensureDir(this.baseDir);
@@ -17435,7 +17487,7 @@ var SpecStore = class {
17435
17487
  return updated;
17436
17488
  }
17437
17489
  filePath(id) {
17438
- return path3.join(this.baseDir, `${id}.json`);
17490
+ return path11.join(this.baseDir, `${id}.json`);
17439
17491
  }
17440
17492
  async readIndex() {
17441
17493
  try {
@@ -17492,7 +17544,7 @@ var TaskGraphStore = class {
17492
17544
  indexPath;
17493
17545
  constructor(opts) {
17494
17546
  this.baseDir = opts.baseDir;
17495
- this.indexPath = path3.join(this.baseDir, "_index.json");
17547
+ this.indexPath = path11.join(this.baseDir, "_index.json");
17496
17548
  }
17497
17549
  async save(graph) {
17498
17550
  await ensureDir(this.baseDir);
@@ -17530,7 +17582,7 @@ var TaskGraphStore = class {
17530
17582
  }
17531
17583
  }
17532
17584
  filePath(id) {
17533
- return path3.join(this.baseDir, `${id}.json`);
17585
+ return path11.join(this.baseDir, `${id}.json`);
17534
17586
  }
17535
17587
  async readIndex() {
17536
17588
  try {