@brainervirus/workit-mcp 8.9.1 → 8.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +85 -77
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -18436,64 +18436,11 @@ function acquireFileLockSync(targetPath, options) {
18436
18436
  }
18437
18437
  }
18438
18438
  }
18439
- // packages/workit-core/src/host-session.ts
18440
- var HOST_SESSION_VARS = [
18441
- ["OPENCODE_SESSION_ID", () => "opencode"],
18442
- ["PI_SESSION_ID", () => "pi"],
18443
- [
18444
- "CODEX_THREAD_ID",
18445
- (env) => env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE === "Codex Desktop" || env.CODEX_ELECTRON_RESOURCES_PATH ? "codex_desktop" : "codex_cli"
18446
- ]
18447
- ];
18448
- var family = (host) => host?.replace(/_(?:cli|desktop)$/, "") ?? null;
18449
- function hostSessionFromEnv(env) {
18450
- const value = (key) => env[key]?.trim() || null;
18451
- let inner = null;
18452
- for (const [key, host] of HOST_SESSION_VARS) {
18453
- const session = value(key);
18454
- if (session) {
18455
- inner = { host: host(env), session };
18456
- break;
18457
- }
18458
- }
18459
- const declared = value("WORKIT_HOST");
18460
- if (env.WORKIT_SESSION_ID !== undefined) {
18461
- const inherited = inner !== null && declared !== null && family(declared) !== family(inner.host);
18462
- if (!inherited)
18463
- return { host: declared, session: value("WORKIT_SESSION_ID") };
18464
- }
18465
- return inner ? { host: inner.host, session: inner.session } : { host: declared, session: null };
18466
- }
18467
-
18468
- // packages/workit-core/src/core/package-root.ts
18469
- import { existsSync } from "node:fs";
18470
- import path3 from "node:path";
18471
- import { fileURLToPath } from "node:url";
18472
- var packageRoot = () => {
18473
- let dir = path3.dirname(fileURLToPath(import.meta.url));
18474
- while (true) {
18475
- const parent = path3.dirname(dir);
18476
- if (existsSync(path3.join(dir, "package.json")) || parent === dir)
18477
- return dir;
18478
- dir = parent;
18479
- }
18480
- };
18481
- var assetRoot = () => {
18482
- const root = packageRoot();
18483
- const assets = path3.join(root, "assets");
18484
- return existsSync(assets) ? assets : root;
18485
- };
18486
-
18487
- // packages/workit-core/src/core/store-lock.ts
18488
- import { spawnSync as spawnSync2 } from "node:child_process";
18489
- import fs5 from "node:fs";
18490
- import { hostname } from "node:os";
18491
-
18492
18439
  // packages/workit-core/src/store/paths.ts
18493
18440
  import { spawnSync } from "node:child_process";
18494
18441
  import { createHash as createHash2 } from "node:crypto";
18495
18442
  import fs4 from "node:fs";
18496
- import path4 from "node:path";
18443
+ import path3 from "node:path";
18497
18444
  var NOT_A_REPO = /not a git repository \(or any (of the parent directories|parent up to)/u;
18498
18445
  var gitRun = (cwd, args) => {
18499
18446
  const run = spawnSync("git", args, {
@@ -18535,14 +18482,14 @@ var DISCOVERY_ENV = [
18535
18482
  ];
18536
18483
  var isGitDir = (dir) => {
18537
18484
  try {
18538
- return fs4.statSync(path4.join(dir, "HEAD")).isFile() && fs4.statSync(path4.join(dir, "objects")).isDirectory() && fs4.statSync(path4.join(dir, "refs")).isDirectory();
18485
+ return fs4.statSync(path3.join(dir, "HEAD")).isFile() && fs4.statSync(path3.join(dir, "objects")).isDirectory() && fs4.statSync(path3.join(dir, "refs")).isDirectory();
18539
18486
  } catch {
18540
18487
  return false;
18541
18488
  }
18542
18489
  };
18543
18490
  var reftableRefs = (common) => {
18544
18491
  try {
18545
- return /^\s*refstorage\s*=\s*reftable\s*$/imu.test(fs4.readFileSync(path4.join(common, "config"), "utf8"));
18492
+ return /^\s*refstorage\s*=\s*reftable\s*$/imu.test(fs4.readFileSync(path3.join(common, "config"), "utf8"));
18546
18493
  } catch {
18547
18494
  return false;
18548
18495
  }
@@ -18562,7 +18509,7 @@ function fastGit(root) {
18562
18509
  if (device !== null && stat.dev !== device)
18563
18510
  return { kind: "none" };
18564
18511
  device = stat.dev;
18565
- const dotGit = path4.join(dir, ".git");
18512
+ const dotGit = path3.join(dir, ".git");
18566
18513
  let entry = null;
18567
18514
  try {
18568
18515
  entry = fs4.statSync(dotGit);
@@ -18583,19 +18530,19 @@ function fastGit(root) {
18583
18530
  const match = /^gitdir: (.+)$/mu.exec(text);
18584
18531
  if (!match)
18585
18532
  return null;
18586
- gitDir = path4.resolve(dir, match[1].trim());
18533
+ gitDir = path3.resolve(dir, match[1].trim());
18587
18534
  } else
18588
18535
  return null;
18589
- if (!fs4.existsSync(path4.join(gitDir, "HEAD")))
18536
+ if (!fs4.existsSync(path3.join(gitDir, "HEAD")))
18590
18537
  return null;
18591
18538
  } else if (isGitDir(dir))
18592
18539
  gitDir = dir;
18593
18540
  if (gitDir) {
18594
18541
  let common = gitDir;
18595
18542
  try {
18596
- common = path4.resolve(gitDir, fs4.readFileSync(path4.join(gitDir, "commondir"), "utf8").trim());
18543
+ common = path3.resolve(gitDir, fs4.readFileSync(path3.join(gitDir, "commondir"), "utf8").trim());
18597
18544
  } catch {}
18598
- if (!fs4.existsSync(path4.join(common, "objects")))
18545
+ if (!fs4.existsSync(path3.join(common, "objects")))
18599
18546
  return null;
18600
18547
  return {
18601
18548
  kind: "repo",
@@ -18605,26 +18552,26 @@ function fastGit(root) {
18605
18552
  reftable: reftableRefs(common)
18606
18553
  };
18607
18554
  }
18608
- const parent = path4.dirname(dir);
18555
+ const parent = path3.dirname(dir);
18609
18556
  if (parent === dir)
18610
18557
  return { kind: "none" };
18611
18558
  dir = parent;
18612
18559
  }
18613
18560
  }
18614
18561
  function resolveStore(root) {
18615
- root = path4.resolve(root);
18562
+ root = path3.resolve(root);
18616
18563
  let directory = false;
18617
18564
  try {
18618
18565
  directory = fs4.statSync(root).isDirectory();
18619
18566
  } catch {}
18620
18567
  if (!directory)
18621
- return { dir: path4.join(root, ".workit"), shared: false, top: null };
18568
+ return { dir: path3.join(root, ".workit"), shared: false, top: null };
18622
18569
  const fast = fastGit(root);
18623
18570
  if (fast?.kind === "none")
18624
- return { dir: path4.join(root, ".workit"), shared: false, top: null };
18571
+ return { dir: path3.join(root, ".workit"), shared: false, top: null };
18625
18572
  if (fast?.kind === "repo")
18626
18573
  return {
18627
- dir: path4.join(fast.common, "workit"),
18574
+ dir: path3.join(fast.common, "workit"),
18628
18575
  shared: true,
18629
18576
  top: fast.top,
18630
18577
  git: { gitDir: fast.gitDir, top: fast.top, reftable: fast.reftable }
@@ -18634,20 +18581,20 @@ function resolveStore(root) {
18634
18581
  if (run.ok && common) {
18635
18582
  const top = gitRun(root, ["rev-parse", "--path-format=absolute", "--show-toplevel"]);
18636
18583
  return {
18637
- dir: path4.join(real(path4.resolve(root, common)), "workit"),
18584
+ dir: path3.join(real(path3.resolve(root, common)), "workit"),
18638
18585
  shared: true,
18639
18586
  top: top.ok && top.stdout.trim() ? real(top.stdout.trim()) : null
18640
18587
  };
18641
18588
  }
18642
18589
  if (run.missing || !run.ok && NOT_A_REPO.test(run.stderr))
18643
- return { dir: path4.join(root, ".workit"), shared: false, top: null };
18590
+ return { dir: path3.join(root, ".workit"), shared: false, top: null };
18644
18591
  return new Error(`cannot locate the workit store: git rev-parse failed (${run.stderr.trim().split(`
18645
18592
  `)[0] || "no output"}); fix the repository (git status should work here)`);
18646
18593
  }
18647
18594
  var rebasingBranch = (gitDir) => {
18648
18595
  for (const state of ["rebase-merge", "rebase-apply"]) {
18649
18596
  try {
18650
- const ref = fs4.readFileSync(path4.join(gitDir, state, "head-name"), "utf8").trim();
18597
+ const ref = fs4.readFileSync(path3.join(gitDir, state, "head-name"), "utf8").trim();
18651
18598
  const match = /^refs\/heads\/(.+)$/u.exec(ref);
18652
18599
  if (match)
18653
18600
  return match[1];
@@ -18662,7 +18609,7 @@ function resolveTaskKey(root, location) {
18662
18609
  if (location.git && !location.git.reftable) {
18663
18610
  let head = "";
18664
18611
  try {
18665
- head = fs4.readFileSync(path4.join(location.git.gitDir, "HEAD"), "utf8").trim();
18612
+ head = fs4.readFileSync(path3.join(location.git.gitDir, "HEAD"), "utf8").trim();
18666
18613
  } catch {}
18667
18614
  const ref = /^ref: refs\/heads\/(.+)$/u.exec(head);
18668
18615
  if (ref && ref[1] !== ".invalid")
@@ -18693,7 +18640,7 @@ function resolveTaskKey(root, location) {
18693
18640
  return { key: `detached-${shortHash(real(worktree))}`, kind: "detached", branch: null };
18694
18641
  }
18695
18642
  function checkoutRootOf(root, location) {
18696
- const resolved = path4.resolve(root);
18643
+ const resolved = path3.resolve(root);
18697
18644
  let canonical = resolved;
18698
18645
  try {
18699
18646
  canonical = fs4.realpathSync(resolved);
@@ -18724,13 +18671,13 @@ function branchRenames(location) {
18724
18671
  }
18725
18672
  for (const entry of entries)
18726
18673
  if (entry.isDirectory())
18727
- walk(path4.join(dir, entry.name));
18674
+ walk(path3.join(dir, entry.name));
18728
18675
  else
18729
- files.push(path4.join(dir, entry.name));
18676
+ files.push(path3.join(dir, entry.name));
18730
18677
  };
18731
- walk(path4.join(path4.dirname(location.dir), "logs", "refs", "heads"));
18678
+ walk(path3.join(path3.dirname(location.dir), "logs", "refs", "heads"));
18732
18679
  if (location.git)
18733
- files.push(path4.join(location.git.gitDir, "logs", "HEAD"));
18680
+ files.push(path3.join(location.git.gitDir, "logs", "HEAD"));
18734
18681
  const seen = new Set;
18735
18682
  const renames = [];
18736
18683
  for (const file of files) {
@@ -18765,11 +18712,63 @@ var checkoutSlug = (root) => {
18765
18712
  let canonical = real(root);
18766
18713
  if (process.platform === "win32")
18767
18714
  canonical = canonical.toLowerCase();
18768
- const base = path4.basename(canonical).replace(/[^A-Za-z0-9._-]/g, "_").slice(0, 40) || "root";
18715
+ const base = path3.basename(canonical).replace(/[^A-Za-z0-9._-]/g, "_").slice(0, 40) || "root";
18769
18716
  return `${base}-${shortHash(canonical)}`;
18770
18717
  };
18771
18718
 
18719
+ // packages/workit-core/src/host-session.ts
18720
+ var HOST_SESSION_VARS = [
18721
+ ["OPENCODE_SESSION_ID", () => "opencode"],
18722
+ ["PI_SESSION_ID", () => "pi"],
18723
+ [
18724
+ "CODEX_THREAD_ID",
18725
+ (env) => env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE === "Codex Desktop" || env.CODEX_ELECTRON_RESOURCES_PATH ? "codex_desktop" : "codex_cli"
18726
+ ]
18727
+ ];
18728
+ var family = (host) => host?.replace(/_(?:cli|desktop)$/, "") ?? null;
18729
+ function hostSessionFromEnv(env) {
18730
+ const value = (key) => env[key]?.trim() || null;
18731
+ let inner = null;
18732
+ for (const [key, host] of HOST_SESSION_VARS) {
18733
+ const session = value(key);
18734
+ if (session) {
18735
+ inner = { host: host(env), session };
18736
+ break;
18737
+ }
18738
+ }
18739
+ const declared = value("WORKIT_HOST");
18740
+ if (env.WORKIT_SESSION_ID !== undefined) {
18741
+ const inherited = inner !== null && declared !== null && family(declared) !== family(inner.host);
18742
+ if (!inherited)
18743
+ return { host: declared, session: value("WORKIT_SESSION_ID") };
18744
+ }
18745
+ return inner ? { host: inner.host, session: inner.session } : { host: declared, session: null };
18746
+ }
18747
+ var OWN_CHILD_SHELL = new Set(["opencode", "pi"]);
18748
+
18749
+ // packages/workit-core/src/core/package-root.ts
18750
+ import { existsSync } from "node:fs";
18751
+ import path4 from "node:path";
18752
+ import { fileURLToPath } from "node:url";
18753
+ var packageRoot = () => {
18754
+ let dir = path4.dirname(fileURLToPath(import.meta.url));
18755
+ while (true) {
18756
+ const parent = path4.dirname(dir);
18757
+ if (existsSync(path4.join(dir, "package.json")) || parent === dir)
18758
+ return dir;
18759
+ dir = parent;
18760
+ }
18761
+ };
18762
+ var assetRoot = () => {
18763
+ const root = packageRoot();
18764
+ const assets = path4.join(root, "assets");
18765
+ return existsSync(assets) ? assets : root;
18766
+ };
18767
+
18772
18768
  // packages/workit-core/src/core/store-lock.ts
18769
+ import { spawnSync as spawnSync2 } from "node:child_process";
18770
+ import fs5 from "node:fs";
18771
+ import { hostname } from "node:os";
18773
18772
  var metadataLockSchema = object2({
18774
18773
  pid: number2().int().nonnegative().safe(),
18775
18774
  processStart: string2().nullable(),
@@ -23402,11 +23401,20 @@ function authorSessions(cwd, rows, branch, range = { base: null, head: null }, s
23402
23401
  sessions.add(session);
23403
23402
  return sessions;
23404
23403
  }
23404
+ var derivesFrom = (derived, bare) => !bare.includes(":") && derived.endsWith(`:${bare}`);
23405
+ var authoredBy = (authors, session) => {
23406
+ if (authors.has(session))
23407
+ return true;
23408
+ for (const author of authors)
23409
+ if (derivesFrom(author, session) || derivesFrom(session, author))
23410
+ return true;
23411
+ return false;
23412
+ };
23405
23413
  var independenceReasons = (row, authors) => {
23406
23414
  const reasons = [];
23407
23415
  if (!row.actor.session)
23408
23416
  reasons.push("no_session");
23409
- else if (authors.has(row.actor.session))
23417
+ else if (authoredBy(authors, row.actor.session))
23410
23418
  reasons.push("author_session");
23411
23419
  if (row.self === true && !reasons.includes("no_session"))
23412
23420
  reasons.push("self");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-mcp",
3
- "version": "8.9.1",
3
+ "version": "8.10.0",
4
4
  "private": false,
5
5
  "description": "Workit shared MCP transport for the eight task and policy operation families",
6
6
  "keywords": [
@@ -42,7 +42,7 @@
42
42
  "build": "bun scripts/build.ts"
43
43
  },
44
44
  "dependencies": {
45
- "@brainervirus/workit-core": "^8.9.1",
45
+ "@brainervirus/workit-core": "^8.10.0",
46
46
  "@modelcontextprotocol/sdk": "1.32.0",
47
47
  "zod": "4.6.5"
48
48
  },