@workit-dev/codex 1.4.2 → 1.5.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.
@@ -6621,14 +6621,14 @@ var require_dist = __commonJS(function(exports, module) {
6621
6621
  });
6622
6622
 
6623
6623
  // packages/workit-codex/scripts/launch-mcp.ts
6624
- import { existsSync as existsSync14, realpathSync as realpathSync10, statSync as statSync5 } from "node:fs";
6625
- import path35 from "node:path";
6624
+ import { existsSync as existsSync15, realpathSync as realpathSync11, statSync as statSync5 } from "node:fs";
6625
+ import path36 from "node:path";
6626
6626
  import { fileURLToPath as fileURLToPath3 } from "node:url";
6627
6627
 
6628
6628
  // packages/workit-core/src/core.ts
6629
6629
  import { spawnSync as spawnSync19 } from "node:child_process";
6630
- import { existsSync as existsSync9, realpathSync as realpathSync7 } from "node:fs";
6631
- import path28 from "node:path";
6630
+ import { existsSync as existsSync10, realpathSync as realpathSync8 } from "node:fs";
6631
+ import path29 from "node:path";
6632
6632
 
6633
6633
  // packages/workit-core/src/core/task-contract.ts
6634
6634
  import { createHash, randomUUID } from "node:crypto";
@@ -23947,20 +23947,64 @@ var exportDigest = (bundle) => sha256({
23947
23947
  task: bundle.task
23948
23948
  });
23949
23949
  // packages/workit-core/src/autonomy.ts
23950
+ import os6 from "node:os";
23951
+ import path24 from "node:path";
23952
+
23953
+ // packages/workit-core/src/core/eval-world.ts
23954
+ import { existsSync as existsSync8, realpathSync as realpathSync5 } from "node:fs";
23950
23955
  import os5 from "node:os";
23951
23956
  import path23 from "node:path";
23957
+ var EVAL_WORLD_ENV = "WORKIT_EVAL_WORLD";
23958
+ var EVAL_WORLD_MARKER = ".workit-eval-world";
23959
+ var inside2 = (dir, file) => {
23960
+ const rel = path23.relative(dir, file);
23961
+ return !rel.startsWith("..") && !path23.isAbsolute(rel);
23962
+ };
23963
+ var evalWorldEntry = (cwd) => {
23964
+ const raw = process.env[EVAL_WORLD_ENV];
23965
+ if (!raw || !path23.isAbsolute(raw))
23966
+ return null;
23967
+ try {
23968
+ const world = realpathSync5(raw);
23969
+ if (!inside2(realpathSync5(os5.tmpdir()), world) || !inside2(world, realpathSync5(cwd)) || !existsSync8(path23.join(world, EVAL_WORLD_MARKER)))
23970
+ return null;
23971
+ return loadWorkspacesFrom(path23.join(world, "config"))[0] ?? null;
23972
+ } catch {
23973
+ return null;
23974
+ }
23975
+ };
23976
+
23977
+ // packages/workit-core/src/autonomy.ts
23952
23978
  var accountHome2 = () => {
23953
23979
  try {
23954
- return os5.userInfo().homedir;
23980
+ return os6.userInfo().homedir;
23955
23981
  } catch {
23956
- return os5.homedir();
23982
+ return os6.homedir();
23957
23983
  }
23958
23984
  };
23959
23985
  var grantsHome = { resolve: accountHome2 };
23960
23986
  var grantsDir = () => configDir({ HOME: grantsHome.resolve() });
23987
+ var benchWorld = (cwd) => {
23988
+ const entry = evalWorldEntry(cwd);
23989
+ if (!entry)
23990
+ return null;
23991
+ const { grants } = configuredGrants(entry);
23992
+ const lowered = {};
23993
+ for (const kind of GRANT_KINDS) {
23994
+ const value = grants[kind];
23995
+ if (value !== undefined && raises(kind, value, DEFAULT_GRANTS[kind]))
23996
+ lowered[kind] = value;
23997
+ }
23998
+ return {
23999
+ name: entry.name,
24000
+ glob: entry.glob,
24001
+ ...entry.defaultEndpoint ? { defaultEndpoint: entry.defaultEndpoint } : {},
24002
+ autonomy: lowered
24003
+ };
24004
+ };
23961
24005
  var grantsOverride = () => {
23962
- const configured = path23.resolve(resolveConfigDir());
23963
- return configured === path23.resolve(grantsDir()) ? null : `the config directory is redirected to ${configured} (WORKIT_CONFIG, WORKIT_CONFIG_DIR or XDG_CONFIG_HOME), but that override does not apply to grants: grants are read only from ${path23.join(grantsDir(), "workspaces.json")}, so the D4 defaults apply until grants are set there`;
24006
+ const configured = path24.resolve(resolveConfigDir());
24007
+ return configured === path24.resolve(grantsDir()) ? null : `the config directory is redirected to ${configured} (WORKIT_CONFIG, WORKIT_CONFIG_DIR or XDG_CONFIG_HOME), but that override does not apply to grants: grants are read only from ${path24.join(grantsDir(), "workspaces.json")}, so the D4 defaults apply until grants are set there`;
23964
24008
  };
23965
24009
  var GRANT_KINDS = ["push", "pr", "merge", "release", "rerun"];
23966
24010
  var DEFAULT_GRANTS = Object.freeze({
@@ -24125,11 +24169,12 @@ function capAt(named, where, by, why, main = false) {
24125
24169
  };
24126
24170
  }
24127
24171
  function resolveAutonomy(cwd, target) {
24128
- const override = grantsOverride();
24172
+ const world = benchWorld(cwd);
24173
+ const override = world ? null : grantsOverride();
24129
24174
  if (override)
24130
24175
  return { ...autonomyOf(null), note: override };
24131
24176
  const name = process.env.WORKIT_WORKSPACE_NAME?.trim() || undefined;
24132
- let autonomy = autonomyOf(resolveWorkspaceFrom(cwd, grantsDir(), name));
24177
+ let autonomy = autonomyOf(resolveWorkspaceFrom(cwd, grantsDir(), name) ?? world);
24133
24178
  if (name)
24134
24179
  autonomy = capAt(autonomy, cwd, `WORKIT_WORKSPACE_NAME=${name}`, "a name never raises grants");
24135
24180
  const above = checkoutsAbove(cwd);
@@ -24278,7 +24323,7 @@ var BRANCH_RENAME = new Set(["-m", "-M", "--move", "-c", "-C", "--copy"]);
24278
24323
  var WORKTREE_VALUES = new Set(["--reason"]);
24279
24324
  var FETCH_VALUES = new Set(["--depth", "--deepen", "--shallow-since", "--shallow-exclude", "--refmap", "-j", "--jobs"].concat(["--upload-pack", "-o", "--server-option", "--negotiation-tip", "--filter"]).concat(["--recurse-submodules-default", "--submodule-prefix", "-s", "--strategy", "-X"]).concat(["--strategy-option"]));
24280
24325
  // packages/workit-core/src/core/task-engine.ts
24281
- import { realpathSync as realpathSync6 } from "node:fs";
24326
+ import { realpathSync as realpathSync7 } from "node:fs";
24282
24327
 
24283
24328
  // packages/workit-core/src/core/policy-resolver.ts
24284
24329
  function resolvePolicy(input) {
@@ -24527,12 +24572,12 @@ var judgeInputSummary = (raw) => {
24527
24572
  };
24528
24573
 
24529
24574
  // packages/workit-core/src/core/task-view.ts
24530
- import { realpathSync as realpathSync5 } from "node:fs";
24575
+ import { realpathSync as realpathSync6 } from "node:fs";
24531
24576
  var environment = () => [];
24532
24577
  var sameSession2 = (value, context) => typeof value === "object" && value !== null && value.kind === "host" && value.host === context.caller.host && value.handle === context.caller.actor;
24533
24578
  function contextRootError(store, context) {
24534
24579
  try {
24535
- realpathSync5(context.root);
24580
+ realpathSync6(context.root);
24536
24581
  const root = checkoutRootOf(context.root);
24537
24582
  if (root !== store.root && !sameDirectoryIdentity(root, store.root))
24538
24583
  return failure2("invalid_input", "operation context root does not match the task store root");
@@ -26002,7 +26047,7 @@ class WorkitCore {
26002
26047
  if (view.task.workspaceId !== view.workspace.id)
26003
26048
  return failure2("invalid_input", "task and workspace bindings are invalid");
26004
26049
  try {
26005
- if (realpathSync6(view.workspace.root) !== this.store.root)
26050
+ if (realpathSync7(view.workspace.root) !== this.store.root)
26006
26051
  return failure2("invalid_input", "task view root does not match the task store");
26007
26052
  } catch {
26008
26053
  return failure2("invalid_input", "task view root cannot be resolved");
@@ -26253,8 +26298,8 @@ class WorkitCore {
26253
26298
  }
26254
26299
  // packages/workit-core/src/core/repo-context.ts
26255
26300
  import { spawnSync as spawnSync15 } from "node:child_process";
26256
- import { existsSync as existsSync8, readFileSync as readFileSync8, readdirSync as readdirSync3 } from "node:fs";
26257
- import path24 from "node:path";
26301
+ import { existsSync as existsSync9, readFileSync as readFileSync8, readdirSync as readdirSync3 } from "node:fs";
26302
+ import path25 from "node:path";
26258
26303
  var isSafeContextRange = (value) => value.length <= 4096 && (() => {
26259
26304
  try {
26260
26305
  gitRevisionParts(value);
@@ -26398,13 +26443,13 @@ var findPrTemplate = (cwd) => {
26398
26443
  for (const rel of PR_TEMPLATE_FILES) {
26399
26444
  const parts = rel.split("/");
26400
26445
  const base = parts[parts.length - 1];
26401
- const dir = parts.length > 1 ? path24.join(cwd, ...parts.slice(0, -1)) : cwd;
26446
+ const dir = parts.length > 1 ? path25.join(cwd, ...parts.slice(0, -1)) : cwd;
26402
26447
  const actual = probeCaseInsensitive(dir, base);
26403
26448
  if (actual)
26404
26449
  return [...parts.slice(0, -1), actual].join("/");
26405
26450
  }
26406
26451
  for (const rel of PR_TEMPLATE_DIRS) {
26407
- const only = singleMarkdown(path24.join(cwd, ...rel.split("/")));
26452
+ const only = singleMarkdown(path25.join(cwd, ...rel.split("/")));
26408
26453
  if (only)
26409
26454
  return `${rel}/${only}`;
26410
26455
  }
@@ -26434,8 +26479,8 @@ var diffStatForRange = (cwd, range) => {
26434
26479
  return runGit(cwd, ["diff", "--stat", "--"]).stdout;
26435
26480
  };
26436
26481
  var packageScripts = (cwd, keys) => {
26437
- const pkgPath = path24.join(cwd, "package.json");
26438
- if (!existsSync8(pkgPath))
26482
+ const pkgPath = path25.join(cwd, "package.json");
26483
+ if (!existsSync9(pkgPath))
26439
26484
  return [];
26440
26485
  try {
26441
26486
  const pkg = JSON.parse(readFileSync8(pkgPath, "utf8"));
@@ -26460,9 +26505,9 @@ var documentationFiles = (cwd) => {
26460
26505
  if (entry.isDirectory()) {
26461
26506
  if (excluded.has(entry.name))
26462
26507
  continue;
26463
- walk(path24.join(dir, entry.name), depth + 1);
26508
+ walk(path25.join(dir, entry.name), depth + 1);
26464
26509
  } else if (entry.isFile() && (entry.name === "README.md" || entry.name.endsWith(".md"))) {
26465
- matches.push("./" + path24.relative(cwd, path24.join(dir, entry.name)).replaceAll("\\", "/"));
26510
+ matches.push("./" + path25.relative(cwd, path25.join(dir, entry.name)).replaceAll("\\", "/"));
26466
26511
  }
26467
26512
  }
26468
26513
  };
@@ -26470,7 +26515,7 @@ var documentationFiles = (cwd) => {
26470
26515
  return matches.toSorted().slice(0, 200);
26471
26516
  };
26472
26517
  var readTrimmed2 = (file, maxLines) => {
26473
- if (!existsSync8(file))
26518
+ if (!existsSync9(file))
26474
26519
  return "";
26475
26520
  const lines = readFileSync8(file, "utf8").split(`
26476
26521
  `);
@@ -26478,7 +26523,7 @@ var readTrimmed2 = (file, maxLines) => {
26478
26523
  `);
26479
26524
  };
26480
26525
  function prReadyContext(root, range) {
26481
- const cwd = path24.resolve(repoRoot(root));
26526
+ const cwd = path25.resolve(repoRoot(root));
26482
26527
  if (range !== undefined && !isResolvableContextRange(cwd, range))
26483
26528
  return invalidRange(cwd);
26484
26529
  let stdout = "";
@@ -26536,7 +26581,7 @@ ${status.stderr}` : "");
26536
26581
  stdout += `template_path: ${template}
26537
26582
 
26538
26583
  `;
26539
- stdout += readTrimmed2(path24.join(cwd, template), 220);
26584
+ stdout += readTrimmed2(path25.join(cwd, template), 220);
26540
26585
  } else {
26541
26586
  stdout += `template_path: none
26542
26587
 
@@ -26546,7 +26591,7 @@ ${status.stderr}` : "");
26546
26591
  stdout += `
26547
26592
  `;
26548
26593
  stdout += printSection("Recent Validation Signals");
26549
- if (existsSync8(path24.join(cwd, "package.json"))) {
26594
+ if (existsSync9(path25.join(cwd, "package.json"))) {
26550
26595
  stdout += `package.json detected. Common scripts:
26551
26596
  `;
26552
26597
  const found = packageScripts(cwd, ["lint", "format:check", "test", "build"]);
@@ -26555,7 +26600,7 @@ ${status.stderr}` : "");
26555
26600
  `) + `
26556
26601
  `;
26557
26602
  }
26558
- if (existsSync8(path24.join(cwd, "Cargo.toml")) || existsSync8(path24.join(cwd, "src-tauri/Cargo.toml"))) {
26603
+ if (existsSync9(path25.join(cwd, "Cargo.toml")) || existsSync9(path25.join(cwd, "src-tauri/Cargo.toml"))) {
26559
26604
  stdout += `Rust project detected.
26560
26605
  `;
26561
26606
  }
@@ -26588,7 +26633,7 @@ var CHANGELOG_RULES = `- Use an [Unreleased] section.
26588
26633
  - Apply with the host-native editor, preserving the repository changelog conventions.
26589
26634
  - If Unreleased already has duplicate category headings, normalize_only first.`;
26590
26635
  function changelogContext(root, range) {
26591
- const cwd = path24.resolve(repoRoot(root));
26636
+ const cwd = path25.resolve(repoRoot(root));
26592
26637
  if (range !== undefined && !isResolvableContextRange(cwd, range))
26593
26638
  return invalidRange(cwd);
26594
26639
  const resolvedRange = rangeArgOrDefault(range, cwd);
@@ -26606,8 +26651,8 @@ function changelogContext(root, range) {
26606
26651
  stdout += CHANGELOG_RULES + `
26607
26652
  `;
26608
26653
  stdout += printSection("Existing CHANGELOG.md");
26609
- const changelogPath = path24.join(cwd, "CHANGELOG.md");
26610
- if (existsSync8(changelogPath)) {
26654
+ const changelogPath = path25.join(cwd, "CHANGELOG.md");
26655
+ if (existsSync9(changelogPath)) {
26611
26656
  stdout += readTrimmed2(changelogPath, 260) + `
26612
26657
  `;
26613
26658
  } else {
@@ -26626,7 +26671,7 @@ function changelogContext(root, range) {
26626
26671
  return { stdout, stderr: "", exitCode: 0, cwd };
26627
26672
  }
26628
26673
  function docsRefreshContext(root, range) {
26629
- const cwd = path24.resolve(repoRoot(root));
26674
+ const cwd = path25.resolve(repoRoot(root));
26630
26675
  if (range !== undefined && !isResolvableContextRange(cwd, range))
26631
26676
  return invalidRange(cwd);
26632
26677
  const resolvedRange = rangeArgOrDefault(range, cwd);
@@ -26648,8 +26693,8 @@ function docsRefreshContext(root, range) {
26648
26693
  `) + `
26649
26694
  `;
26650
26695
  stdout += printSection("README Preview");
26651
- const readme = path24.join(cwd, "README.md");
26652
- if (existsSync8(readme)) {
26696
+ const readme = path25.join(cwd, "README.md");
26697
+ if (existsSync9(readme)) {
26653
26698
  stdout += readTrimmed2(readme, 220) + `
26654
26699
  `;
26655
26700
  } else {
@@ -26657,8 +26702,8 @@ function docsRefreshContext(root, range) {
26657
26702
  `;
26658
26703
  }
26659
26704
  stdout += printSection("Package Scripts");
26660
- const pkgPath = path24.join(cwd, "package.json");
26661
- if (existsSync8(pkgPath)) {
26705
+ const pkgPath = path25.join(cwd, "package.json");
26706
+ if (existsSync9(pkgPath)) {
26662
26707
  try {
26663
26708
  const pkg = JSON.parse(readFileSync8(pkgPath, "utf8"));
26664
26709
  stdout += JSON.stringify({ name: pkg.name, version: pkg.version, scripts: pkg.scripts }, null, 2) + `
@@ -26671,7 +26716,7 @@ function docsRefreshContext(root, range) {
26671
26716
  return { stdout, stderr: "", exitCode: 0, cwd };
26672
26717
  }
26673
26718
  function releaseNotesContext(root, rangeOrTag) {
26674
- const cwd = path24.resolve(repoRoot(root));
26719
+ const cwd = path25.resolve(repoRoot(root));
26675
26720
  if (!rangeOrTag) {
26676
26721
  return {
26677
26722
  stdout: "",
@@ -26714,7 +26759,7 @@ function releaseNotesContext(root, rangeOrTag) {
26714
26759
  `;
26715
26760
  stdout += printSection("Existing Release Files");
26716
26761
  for (const rel of ["CHANGELOG.md", "RELEASE_NOTES.md", ".github/releases.md"]) {
26717
- if (existsSync8(path24.join(cwd, rel)))
26762
+ if (existsSync9(path25.join(cwd, rel)))
26718
26763
  stdout += rel + `
26719
26764
  `;
26720
26765
  }
@@ -26746,7 +26791,7 @@ import { spawnSync as spawnSync17 } from "node:child_process";
26746
26791
 
26747
26792
  // packages/workit-core/src/core/pr-create.ts
26748
26793
  import fs17 from "node:fs";
26749
- import path25 from "node:path";
26794
+ import path26 from "node:path";
26750
26795
  import { spawnSync as spawnSync16 } from "node:child_process";
26751
26796
  // packages/workit-core/src/forge/pr-body.ts
26752
26797
  function parseGhIssue(value) {
@@ -26766,11 +26811,11 @@ var LOCAL = bounded(20000);
26766
26811
  var NETWORK = bounded(60000);
26767
26812
  function whichOnPath(tool) {
26768
26813
  const names = process.platform === "win32" ? [tool, `${tool}.exe`, `${tool}.cmd`] : [tool];
26769
- for (const dir of (process.env.PATH ?? "").split(path25.delimiter)) {
26814
+ for (const dir of (process.env.PATH ?? "").split(path26.delimiter)) {
26770
26815
  if (!dir)
26771
26816
  continue;
26772
26817
  for (const name of names) {
26773
- const candidate = path25.join(dir, name);
26818
+ const candidate = path26.join(dir, name);
26774
26819
  try {
26775
26820
  fs17.accessSync(candidate, fs17.constants.X_OK);
26776
26821
  return candidate;
@@ -26891,7 +26936,7 @@ var fetchGitLabIssueBody = async (ref, root, deps = {}) => {
26891
26936
 
26892
26937
  // packages/workit-core/src/core/youtrack.ts
26893
26938
  import fs19 from "node:fs";
26894
- import path27 from "node:path";
26939
+ import path28 from "node:path";
26895
26940
 
26896
26941
  // packages/workit-core/src/core/templates.ts
26897
26942
  var repoRoot2 = assetRoot();
@@ -26906,7 +26951,7 @@ import { spawnSync as spawnSync18 } from "node:child_process";
26906
26951
 
26907
26952
  // packages/workit-core/src/forge/exec.ts
26908
26953
  import fs18 from "node:fs";
26909
- import path26 from "node:path";
26954
+ import path27 from "node:path";
26910
26955
 
26911
26956
  // packages/workit-core/src/forge/redact.ts
26912
26957
  var KEY = String.raw`[A-Za-z0-9_.-]*?(?:token|secret|password|passwd|pwd|api[_-]?key|access[_-]?key|account[_-]?key|private[_-]?key|client[_-]?secret|credentials?|authorization|cookie|signature)[A-Za-z0-9_.-]*`;
@@ -26917,11 +26962,11 @@ var ANSI = new RegExp(String.raw`\u001b\[[0-9;?]*[ -/]*[@-~]|\u001b\][^\u0007]*\
26917
26962
  // packages/workit-core/src/forge/exec.ts
26918
26963
  var MAX_BUFFER2 = 64 * 1024 * 1024;
26919
26964
  function findExecutable(bin, env) {
26920
- const dirs = (env.PATH ?? env.Path ?? "").split(path26.delimiter).filter(Boolean);
26965
+ const dirs = (env.PATH ?? env.Path ?? "").split(path27.delimiter).filter(Boolean);
26921
26966
  const exts = process.platform === "win32" ? [".exe"] : [""];
26922
26967
  for (const dir of dirs)
26923
26968
  for (const ext of exts) {
26924
- const candidate = path26.join(dir, `${bin}${ext}`);
26969
+ const candidate = path27.join(dir, `${bin}${ext}`);
26925
26970
  try {
26926
26971
  const stat = fs18.statSync(candidate);
26927
26972
  if (stat.isFile())
@@ -26964,7 +27009,7 @@ var YTRACK_MISSING = "ytrack is not on PATH: Workit reaches YouTrack only throug
26964
27009
 
26965
27010
  // packages/workit-core/src/core/youtrack.ts
26966
27011
  var ISSUE_RE = /^[A-Z]+-\d+$/;
26967
- var youTrackReadOnlyConfigPath = () => process.env.WORKIT_YOUTRACK_CONFIG ?? path27.join(resolveConfigDir(), "youtrack.json");
27012
+ var youTrackReadOnlyConfigPath = () => process.env.WORKIT_YOUTRACK_CONFIG ?? path28.join(resolveConfigDir(), "youtrack.json");
26968
27013
  var readYouTrackContextConfig = () => {
26969
27014
  const cfgPath = youTrackReadOnlyConfigPath();
26970
27015
  if (!fs19.existsSync(cfgPath))
@@ -27316,22 +27361,22 @@ function resolveGitRevision(root, value) {
27316
27361
  }
27317
27362
  }
27318
27363
  function resolveInside(root, candidate) {
27319
- const base = realpathSync7(root);
27320
- const target = path28.resolve(base, candidate);
27321
- if (target !== base && !target.startsWith(base + path28.sep)) {
27364
+ const base = realpathSync8(root);
27365
+ const target = path29.resolve(base, candidate);
27366
+ if (target !== base && !target.startsWith(base + path29.sep)) {
27322
27367
  throw new Error("path must stay inside repository root");
27323
27368
  }
27324
27369
  let ancestor = target;
27325
- while (!existsSync9(ancestor))
27326
- ancestor = path28.dirname(ancestor);
27327
- const canonicalAncestor = realpathSync7(ancestor);
27328
- if (canonicalAncestor !== base && !canonicalAncestor.startsWith(base + path28.sep)) {
27370
+ while (!existsSync10(ancestor))
27371
+ ancestor = path29.dirname(ancestor);
27372
+ const canonicalAncestor = realpathSync8(ancestor);
27373
+ if (canonicalAncestor !== base && !canonicalAncestor.startsWith(base + path29.sep)) {
27329
27374
  throw new Error("path must stay inside repository root");
27330
27375
  }
27331
27376
  return target;
27332
27377
  }
27333
27378
  function run2(root, executable, args, env = {}) {
27334
- const cwd = realpathSync7(root);
27379
+ const cwd = realpathSync8(root);
27335
27380
  const result = spawnSync19(executable, args, {
27336
27381
  cwd,
27337
27382
  encoding: "utf8",
@@ -27346,18 +27391,18 @@ function run2(root, executable, args, env = {}) {
27346
27391
  }
27347
27392
 
27348
27393
  // packages/workit-core/src/core/cli-locate.ts
27349
- import { closeSync as closeSync2, existsSync as existsSync10, openSync as openSync2, readSync } from "node:fs";
27350
- import path29 from "node:path";
27394
+ import { closeSync as closeSync2, existsSync as existsSync11, openSync as openSync2, readSync } from "node:fs";
27395
+ import path30 from "node:path";
27351
27396
  var LAUNCHER_MARKER = "workit-owned-launcher";
27352
27397
  var CLI_PACKAGE_PATH = ["node_modules", "@workit-dev", "cli"];
27353
27398
  var installRoot = (env, platform = process.platform) => {
27354
27399
  if (env.WORKIT_INSTALL_ROOT)
27355
27400
  return env.WORKIT_INSTALL_ROOT;
27356
27401
  const data = dataDir(env, platform);
27357
- return platform === "win32" ? path29.join(data, "install") : data;
27402
+ return platform === "win32" ? path30.join(data, "install") : data;
27358
27403
  };
27359
- var ownedLauncherPath = (env, platform = process.platform) => path29.join(installRoot(env, platform), "bin", platform === "win32" ? "workit.cmd" : "workit");
27360
- var ownedCurrentEntry = (env, platform = process.platform) => path29.join(installRoot(env, platform), "current", ...CLI_PACKAGE_PATH, "dist", "index.js");
27404
+ var ownedLauncherPath = (env, platform = process.platform) => path30.join(installRoot(env, platform), "bin", platform === "win32" ? "workit.cmd" : "workit");
27405
+ var ownedCurrentEntry = (env, platform = process.platform) => path30.join(installRoot(env, platform), "current", ...CLI_PACKAGE_PATH, "dist", "index.js");
27361
27406
  var head = (file) => {
27362
27407
  let fd;
27363
27408
  try {
@@ -27375,7 +27420,7 @@ var head = (file) => {
27375
27420
  var locateWorkitCli = (options = {}) => {
27376
27421
  const env = options.env ?? process.env;
27377
27422
  const platform = options.platform ?? process.platform;
27378
- const exists = options.exists ?? existsSync10;
27423
+ const exists = options.exists ?? existsSync11;
27379
27424
  const read = options.read ?? head;
27380
27425
  const node = options.node ?? process.execPath;
27381
27426
  const launcher = ownedLauncherPath(env, platform);
@@ -27384,7 +27429,7 @@ var locateWorkitCli = (options = {}) => {
27384
27429
  source: "owned-launcher",
27385
27430
  command: launcher,
27386
27431
  args: [],
27387
- binDir: path29.dirname(launcher)
27432
+ binDir: path30.dirname(launcher)
27388
27433
  };
27389
27434
  const current = ownedCurrentEntry(env, platform);
27390
27435
  if (exists(current))
@@ -27413,7 +27458,7 @@ var workitCliEnv = (located, env = process.env, platform = process.platform) =>
27413
27458
  if (located.binDir) {
27414
27459
  const key = pathKey(env);
27415
27460
  const delimiter = platform === "win32" ? ";" : ":";
27416
- const same = (dir) => platform === "win32" ? path29.win32.normalize(dir).toLowerCase() === path29.win32.normalize(located.binDir).toLowerCase() : path29.posix.normalize(dir) === path29.posix.normalize(located.binDir);
27461
+ const same = (dir) => platform === "win32" ? path30.win32.normalize(dir).toLowerCase() === path30.win32.normalize(located.binDir).toLowerCase() : path30.posix.normalize(dir) === path30.posix.normalize(located.binDir);
27417
27462
  const rest = (env[key] ?? "").split(delimiter).filter((dir) => dir && !same(dir));
27418
27463
  patch[key] = [located.binDir, ...rest].join(delimiter);
27419
27464
  }
@@ -27437,8 +27482,8 @@ var SUPPORT_MATRIX = {
27437
27482
  };
27438
27483
 
27439
27484
  // packages/workit-mcp/src/server.ts
27440
- import { existsSync as existsSync11, readFileSync as readFileSync9, realpathSync as realpathSync8 } from "node:fs";
27441
- import path30 from "node:path";
27485
+ import { existsSync as existsSync12, readFileSync as readFileSync9, realpathSync as realpathSync9 } from "node:fs";
27486
+ import path31 from "node:path";
27442
27487
  // node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
27443
27488
  function isZ4Schema(s) {
27444
27489
  const schema = s;
@@ -29903,13 +29948,13 @@ var rootVariants = (workspaceRoot) => {
29903
29948
  if (!workspaceRoot)
29904
29949
  return [];
29905
29950
  const roots = new Set;
29906
- for (const candidate of [workspaceRoot, path30.resolve(workspaceRoot)]) {
29907
- if (path30.isAbsolute(candidate) && candidate !== path30.parse(candidate).root)
29951
+ for (const candidate of [workspaceRoot, path31.resolve(workspaceRoot)]) {
29952
+ if (path31.isAbsolute(candidate) && candidate !== path31.parse(candidate).root)
29908
29953
  roots.add(candidate);
29909
29954
  }
29910
29955
  try {
29911
- const canonical = realpathSync8(workspaceRoot);
29912
- if (canonical !== path30.parse(canonical).root)
29956
+ const canonical = realpathSync9(workspaceRoot);
29957
+ if (canonical !== path31.parse(canonical).root)
29913
29958
  roots.add(canonical);
29914
29959
  } catch {}
29915
29960
  return [...roots].toSorted((left, right) => right.length - left.length);
@@ -29991,12 +30036,12 @@ var thrownResult = (tool, error, workspaceRoot) => {
29991
30036
  };
29992
30037
  function createMcpServer(host, contextProvider) {
29993
30038
  assertMcpHost(host);
29994
- const here = path30.dirname(fileURLToPath2(import.meta.url));
30039
+ const here = path31.dirname(fileURLToPath2(import.meta.url));
29995
30040
  const sourceMarker = markSourcesLoaded([
29996
- path30.join(here, "server.ts"),
29997
- path30.join(here, "..", "..", "workit-core", "src", "core", "task-contract.ts"),
29998
- path30.join(here, "..", "..", "workit-core", "src", "core", "task-engine.ts")
29999
- ].filter((file) => existsSync11(file)));
30041
+ path31.join(here, "server.ts"),
30042
+ path31.join(here, "..", "..", "workit-core", "src", "core", "task-contract.ts"),
30043
+ path31.join(here, "..", "..", "workit-core", "src", "core", "task-engine.ts")
30044
+ ].filter((file) => existsSync12(file)));
30000
30045
  let staleWarned = false;
30001
30046
  const failures = new Map;
30002
30047
  const server = new Server({ name: "workit", version: VERSION }, { capabilities: { tools: {}, resources: {} } });
@@ -30334,7 +30379,7 @@ var EXEC = new Set(["exec", "x", "dlx"]);
30334
30379
  // packages/workit-core/src/core/heavy-words.ts
30335
30380
  var HEAVY_WORDS = new Set(("npm npx pnpm pnpx yarn bun bunx deno corepack make gmake docker podman nerdctl " + "python python3 py uv poetry pdm pipenv hatch rye bundle rake nx " + "jest vitest mocha ava tap karma jasmine nyc c8 tsc vue-tsc svelte-check eslint stylelint " + "tslint webpack webpack-cli rollup parcel tsup vite next nuxt nuxi astro ng react-scripts " + "playwright cypress wdio testcafe turbo lerna sonar-scanner sonarless sonarless-mcp go " + "golangci-lint gotestsum staticcheck cargo mvn mvnw gradle gradlew ant sbt bazel bazelisk " + "buck2 dotnet msbuild pytest py.test tox nox mypy pyright pylint coverage maturin pip pip3 " + "rspec rails phpunit pest phpstan psalm composer mix swift xcodebuild flutter dart pod cmake " + "ninja meson ctest scons docker-compose buildah earthly").split(" "));
30336
30381
  // packages/workit-core/src/hooks/write-gate.ts
30337
- import path31 from "node:path";
30382
+ import path32 from "node:path";
30338
30383
 
30339
30384
  // packages/workit-core/src/core/live-session.ts
30340
30385
  import { spawnSync as spawnSync20 } from "node:child_process";
@@ -30375,7 +30420,7 @@ var MUTATING_WORKIT_GIT = new Set(["commit", "branch", "stage", "unstage"]);
30375
30420
  var CD2 = new Set(["cd", "chdir", "set-location", "sl"]);
30376
30421
  var PUSHD2 = new Set(["pushd", "push-location"]);
30377
30422
  var POPD2 = new Set(["popd", "pop-location"]);
30378
- var UNKNOWN_DIR = path31.resolve(path31.parse(process.cwd()).root, ".workit-unknown-dir");
30423
+ var UNKNOWN_DIR = path32.resolve(path32.parse(process.cwd()).root, ".workit-unknown-dir");
30379
30424
  var DECLARERS = new Set(["export", "declare", "typeset", "local", "readonly"]);
30380
30425
  var REBINDS_ANY = new Set([
30381
30426
  "source",
@@ -30429,7 +30474,7 @@ var OPENS = new Set(["if", "for", "while", "until", "{"]);
30429
30474
  var CLOSES = new Set(["fi", "done", "}"]);
30430
30475
  var UNFOLLOWED = new Set(["case", "esac", "select", "function"]);
30431
30476
  var TRANSPARENT = new Set(["builtin", "command", "time", "!"]);
30432
- var UNKNOWN_VAR = path31.resolve(path31.parse(process.cwd()).root, ".workit-unknown-var");
30477
+ var UNKNOWN_VAR = path32.resolve(path32.parse(process.cwd()).root, ".workit-unknown-var");
30433
30478
  // packages/workit-core/src/core/skill-manifests.ts
30434
30479
  if (false) {}
30435
30480
 
@@ -30449,16 +30494,16 @@ var READERS = new Set([
30449
30494
  "type"
30450
30495
  ]);
30451
30496
  // packages/workit-core/src/hooks/hosts/fields.ts
30452
- import { existsSync as existsSync12, realpathSync as realpathSync9, statSync as statSync4 } from "node:fs";
30453
- import path32 from "node:path";
30497
+ import { existsSync as existsSync13, realpathSync as realpathSync10, statSync as statSync4 } from "node:fs";
30498
+ import path33 from "node:path";
30454
30499
  var isRecord4 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
30455
30500
  var nonEmpty2 = (value) => typeof value === "string" && value.trim() !== "";
30456
30501
  var optionalText = (value) => typeof value === "string" ? value : null;
30457
30502
  var existingDirectory = (value) => {
30458
- if (!nonEmpty2(value) || !path32.isAbsolute(value) || !existsSync12(value))
30503
+ if (!nonEmpty2(value) || !path33.isAbsolute(value) || !existsSync13(value))
30459
30504
  return null;
30460
30505
  try {
30461
- return statSync4(value).isDirectory() ? realpathSync9(value) : null;
30506
+ return statSync4(value).isDirectory() ? realpathSync10(value) : null;
30462
30507
  } catch {
30463
30508
  return null;
30464
30509
  }
@@ -31223,11 +31268,11 @@ if (false) {}
31223
31268
  // packages/workit-core/src/hooks/budget-signal.ts
31224
31269
  import { createHash as createHash12 } from "node:crypto";
31225
31270
  import fs20 from "node:fs";
31226
- import path33 from "node:path";
31271
+ import path34 from "node:path";
31227
31272
  var hash2 = (text) => createHash12("sha256").update(text).digest("hex").slice(0, 32);
31228
- var budgetDir = (store) => path33.join(store, "budget");
31229
- var agentBase = (store, session, agentId) => path33.join(budgetDir(store), hash2(`${session}\x00${agentId ?? ""}`));
31230
- var spawnsFile = (store, session) => path33.join(budgetDir(store), `spawns-${hash2(session)}.jsonl`);
31273
+ var budgetDir = (store) => path34.join(store, "budget");
31274
+ var agentBase = (store, session, agentId) => path34.join(budgetDir(store), hash2(`${session}\x00${agentId ?? ""}`));
31275
+ var spawnsFile = (store, session) => path34.join(budgetDir(store), `spawns-${hash2(session)}.jsonl`);
31231
31276
  var spawnBudget = (prompt) => {
31232
31277
  const found = /^TIMEBOX:[^\n]*?\b(\d+)\s+tool calls\b/mu.exec(prompt);
31233
31278
  const n = found ? Number(found[1]) : NaN;
@@ -31279,8 +31324,8 @@ var startBudget = (store, session, agentId, n) => {
31279
31324
  const cutoff = Date.now() - 604800000;
31280
31325
  for (const name of fs20.readdirSync(dir))
31281
31326
  try {
31282
- if (fs20.statSync(path33.join(dir, name)).mtimeMs < cutoff)
31283
- fs20.rmSync(path33.join(dir, name));
31327
+ if (fs20.statSync(path34.join(dir, name)).mtimeMs < cutoff)
31328
+ fs20.rmSync(path34.join(dir, name));
31284
31329
  } catch {}
31285
31330
  const base = agentBase(store, session, agentId);
31286
31331
  fs20.writeFileSync(`${base}.json`, JSON.stringify({ limit: n, told: 0 }));
@@ -31339,7 +31384,7 @@ if (false)
31339
31384
 
31340
31385
  // packages/workit-codex/scripts/agents.ts
31341
31386
  import {
31342
- existsSync as existsSync13,
31387
+ existsSync as existsSync14,
31343
31388
  lstatSync as lstatSync5,
31344
31389
  mkdirSync as mkdirSync4,
31345
31390
  readdirSync as readdirSync4,
@@ -31348,19 +31393,19 @@ import {
31348
31393
  rmSync as rmSync2,
31349
31394
  writeFileSync as writeFileSync4
31350
31395
  } from "node:fs";
31351
- import os6 from "node:os";
31352
- import path34 from "node:path";
31396
+ import os7 from "node:os";
31397
+ import path35 from "node:path";
31353
31398
  var CODEX_AGENT_ROLES = ["verifier", "reviewer", "implementer"];
31354
31399
  var CODEX_AGENT_MARKER = "# Generated by Workit";
31355
31400
  var codexAgentName = (role) => `workit-${role}`;
31356
31401
  var codexAgentFile = (role) => `${codexAgentName(role)}.toml`;
31357
31402
  var tomlString = (value) => JSON.stringify(value);
31358
31403
  var codexHomeOfInstall = (pluginRoot) => {
31359
- const parts = path34.resolve(pluginRoot).split(path34.sep);
31404
+ const parts = path35.resolve(pluginRoot).split(path35.sep);
31360
31405
  const cache = parts.length - 4;
31361
- return cache >= 2 && parts[cache] === "cache" && parts[cache - 1] === "plugins" ? parts.slice(0, cache - 1).join(path34.sep) || path34.sep : null;
31406
+ return cache >= 2 && parts[cache] === "cache" && parts[cache - 1] === "plugins" ? parts.slice(0, cache - 1).join(path35.sep) || path35.sep : null;
31362
31407
  };
31363
- var codexHomeFor = (pluginRoot, env) => codexHomeOfInstall(pluginRoot) ?? (env.CODEX_HOME || path34.join(env.HOME || os6.homedir(), ".codex"));
31408
+ var codexHomeFor = (pluginRoot, env) => codexHomeOfInstall(pluginRoot) ?? (env.CODEX_HOME || path35.join(env.HOME || os7.homedir(), ".codex"));
31364
31409
  var withRoleModel = (content, file, models) => {
31365
31410
  const role = CODEX_AGENT_ROLES.find((candidate) => codexAgentFile(candidate) === file);
31366
31411
  const chosen = role ? models[role] : undefined;
@@ -31383,7 +31428,7 @@ var versionAtLeast = (version, min) => {
31383
31428
  };
31384
31429
  var pluginVersion = (pluginRoot) => {
31385
31430
  try {
31386
- const version = JSON.parse(readFileSync10(path34.join(pluginRoot, "package.json"), "utf8")).version;
31431
+ const version = JSON.parse(readFileSync10(path35.join(pluginRoot, "package.json"), "utf8")).version;
31387
31432
  return typeof version === "string" && /^\d+\.\d+\.\d+/.test(version) ? version.match(/^\d+\.\d+\.\d+/)[0] : null;
31388
31433
  } catch {
31389
31434
  return null;
@@ -31397,15 +31442,15 @@ var lstatOrNull = (file) => {
31397
31442
  }
31398
31443
  };
31399
31444
  var installCodexAgents = (pluginRoot, codexHome, models = {}) => {
31400
- const source = path34.join(pluginRoot, "agents");
31401
- if (!existsSync13(source))
31445
+ const source = path35.join(pluginRoot, "agents");
31446
+ if (!existsSync14(source))
31402
31447
  return [];
31403
31448
  const version = pluginVersion(pluginRoot);
31404
- const target = path34.join(codexHome, "agents");
31449
+ const target = path35.join(codexHome, "agents");
31405
31450
  const results = [];
31406
31451
  for (const file of readdirSync4(source).filter((name) => name.endsWith(".toml")).toSorted()) {
31407
- const content = withRoleModel(stampCodexAgent(readFileSync10(path34.join(source, file), "utf8"), version), file, models);
31408
- const dest = path34.join(target, file);
31452
+ const content = withRoleModel(stampCodexAgent(readFileSync10(path35.join(source, file), "utf8"), version), file, models);
31453
+ const dest = path35.join(target, file);
31409
31454
  const stat = lstatOrNull(dest);
31410
31455
  if (stat?.isSymbolicLink()) {
31411
31456
  results.push({ file: dest, action: "skipped-symlink" });
@@ -31441,7 +31486,7 @@ var installCodexAgents = (pluginRoot, codexHome, models = {}) => {
31441
31486
  results.push({ file: dest, action: "kept-newer-version" });
31442
31487
  continue;
31443
31488
  }
31444
- const temp = path34.join(target, `.${file}.${process.pid}.${Date.now()}.tmp`);
31489
+ const temp = path35.join(target, `.${file}.${process.pid}.${Date.now()}.tmp`);
31445
31490
  writeFileSync4(temp, content, { flag: "wx" });
31446
31491
  try {
31447
31492
  renameSync3(temp, dest);
@@ -31463,14 +31508,14 @@ var codexQualification = (host) => host === "codex_cli" ? { surface: host, cli:
31463
31508
  var resolveCodexWorkspaceRoot = (pluginRoot, env) => {
31464
31509
  const explicit = env.WORKIT_WORKSPACE_ROOT;
31465
31510
  const inherited = env.PWD;
31466
- const candidate = explicit ?? (inherited && path35.resolve(inherited) !== path35.resolve(pluginRoot) ? inherited : undefined);
31467
- if (!candidate || !path35.isAbsolute(candidate) || !existsSync14(candidate))
31511
+ const candidate = explicit ?? (inherited && path36.resolve(inherited) !== path36.resolve(pluginRoot) ? inherited : undefined);
31512
+ if (!candidate || !path36.isAbsolute(candidate) || !existsSync15(candidate))
31468
31513
  return null;
31469
31514
  try {
31470
31515
  if (!statSync5(candidate).isDirectory())
31471
31516
  return null;
31472
- const canonical = realpathSync10(candidate);
31473
- if (canonical === realpathSync10(pluginRoot)) {
31517
+ const canonical = realpathSync11(candidate);
31518
+ if (canonical === realpathSync11(pluginRoot)) {
31474
31519
  if (!explicit)
31475
31520
  return null;
31476
31521
  const workspace = new TaskStore(canonical).readWorkspace();
@@ -31503,7 +31548,7 @@ var codexContextProvider = (host = detectCodexSurface(process.env), root) => ({
31503
31548
  };
31504
31549
  }
31505
31550
  });
31506
- var pluginRoot = () => path35.resolve(path35.dirname(fileURLToPath3(import.meta.url)), "..");
31551
+ var pluginRoot = () => path36.resolve(path36.dirname(fileURLToPath3(import.meta.url)), "..");
31507
31552
  var codexRoleModels = (cwd) => {
31508
31553
  const out = {};
31509
31554
  for (const role of ["verifier", "reviewer"]) {