@workit-dev/pi 2.27.4 → 2.27.6

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.
package/dist/worker.js CHANGED
@@ -7418,6 +7418,11 @@ function resolveStore(root) {
7418
7418
  }
7419
7419
 
7420
7420
  // packages/workit-core/src/host-session.ts
7421
+ var STAMPING_HOSTS = new Set([
7422
+ "claude_code",
7423
+ "codex_cli",
7424
+ "codex_desktop"
7425
+ ]);
7421
7426
  var OWN_CHILD_SHELL = new Set(["opencode", "pi"]);
7422
7427
  var SESSION_UNSAFE = /[^A-Za-z0-9_.:@/+-]/g;
7423
7428
  function childSessionId(lead, child) {
package/dist/workit.js CHANGED
@@ -10639,6 +10639,11 @@ var HOST_SESSION_VARS = [
10639
10639
  (env) => env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE === "Codex Desktop" || env.CODEX_ELECTRON_RESOURCES_PATH ? "codex_desktop" : "codex_cli"
10640
10640
  ]
10641
10641
  ];
10642
+ var STAMPING_HOSTS = new Set([
10643
+ "claude_code",
10644
+ "codex_cli",
10645
+ "codex_desktop"
10646
+ ]);
10642
10647
  var family = (host) => host?.replace(/_(?:cli|desktop)$/, "") ?? null;
10643
10648
  function hostSessionFromEnv(env) {
10644
10649
  const value = (key) => env[key]?.trim() || null;
@@ -33718,8 +33723,12 @@ var dropAgentStamps = (env, session, toolUseId, command) => {
33718
33723
 
33719
33724
  // packages/workit-core/src/hooks/identity-env.ts
33720
33725
  var NAMES = "WORKIT_(?:AGENT_ID|HOST|SESSION_ID|SESSION_TOKEN)";
33726
+ var HOST_NAMES = "(?:OPENCODE_SESSION_ID|PI_SESSION_ID|CODEX_THREAD_ID|CLAUDECODE|CLAUDE_CODE_ENTRYPOINT)";
33721
33727
  var IDENTITY = new RegExp(`^${NAMES}$`, "u");
33722
- var POWERSHELL = new RegExp(`\\$env:${NAMES}\\b|env:[\\\\/]?${NAMES}\\b|EnvironmentVariable\\(\\s*['"]${NAMES}\\b`, "iu");
33728
+ var HOST_VARIABLE = new RegExp(`^${HOST_NAMES}$`, "u");
33729
+ var powershell = (names) => new RegExp(`\\$env:${names}\\b|env:[\\\\/]?${names}\\b|EnvironmentVariable\\(\\s*['"]${names}\\b`, "iu");
33730
+ var POWERSHELL = powershell(NAMES);
33731
+ var POWERSHELL_HOST = powershell(HOST_NAMES);
33723
33732
  var DECLARES = new Set(["export", "unset", "declare", "typeset", "local", "readonly"]);
33724
33733
  var OPAQUE = new Set([
33725
33734
  "watch",
@@ -33737,14 +33746,21 @@ var ENV_FLAGS = new Set(["i", "0", "v"]);
33737
33746
  var ENV_LONG_VALUED = new Set(["--unset", "--chdir", "--split-string", "--argv0"]);
33738
33747
  var ENV_LONG_FLAGS = /^--(?:ignore-environment|null|debug|(?:block|default|ignore)-signal(?:=.*)?)$/u;
33739
33748
  var base3 = (word) => (word?.split(/[\\/]/u).at(-1) ?? "").replace(/\.exe$/iu, "");
33740
- var named = (word) => IDENTITY.test(word?.split("=")[0] ?? "");
33749
+ var nameOf = (word) => word?.split("=")[0] ?? "";
33750
+ var named = (word) => IDENTITY.test(nameOf(word)) || HOST_VARIABLE.test(nameOf(word));
33741
33751
  var isWorkit = (word) => /^workit(?:-cli)?$/u.test(base3(word));
33742
33752
  var UNREADABLE = "env/unset arguments Workit cannot read";
33753
+ var mark = (scan, word) => {
33754
+ const name = nameOf(word);
33755
+ if (IDENTITY.test(name))
33756
+ scan.hit ??= name;
33757
+ else if (HOST_VARIABLE.test(name))
33758
+ scan.hostHit ??= name;
33759
+ };
33743
33760
  var scanEnv = (words, at, expands, scan, depth) => {
33744
33761
  const risky = (what) => void (scan.risky ??= what);
33745
33762
  const unset = (name) => {
33746
- if (named(name))
33747
- scan.hit ??= name ?? null;
33763
+ mark(scan, name);
33748
33764
  };
33749
33765
  const split = (line, rest, built) => {
33750
33766
  if (line === undefined || depth >= 4)
@@ -33831,8 +33847,7 @@ var commandAt = (words, scan, expands = new Set, from = 0) => {
33831
33847
  let index = from;
33832
33848
  while (index < words.length) {
33833
33849
  while (/^[A-Za-z_]\w*=/u.test(words[index] ?? "")) {
33834
- if (named(words[index]))
33835
- scan.hit ??= words[index]?.split("=")[0] ?? null;
33850
+ mark(scan, words[index]);
33836
33851
  index += 1;
33837
33852
  }
33838
33853
  const name = base3(words[index]).toLowerCase();
@@ -33863,7 +33878,7 @@ var opaque = (rest, scan, assigns) => {
33863
33878
  scan.risky ??= UNREADABLE;
33864
33879
  const hit = rest.find(named);
33865
33880
  if (hit && rest.some((word) => base3(word).toLowerCase() === "env"))
33866
- scan.hit ??= hit.split("=")[0] ?? null;
33881
+ mark(scan, hit);
33867
33882
  };
33868
33883
  var LOGIN_VALUED = {
33869
33884
  su: /[sgGwc]/u,
@@ -33900,8 +33915,7 @@ var scanCommand = (command, dialect, depth, scan) => {
33900
33915
  const expanded = new Set(expands);
33901
33916
  let at = 0;
33902
33917
  while (/^[A-Za-z_]\w*=/u.test(words[at] ?? "")) {
33903
- if (named(words[at]))
33904
- scan.hit ??= words[at]?.split("=")[0] ?? null;
33918
+ mark(scan, words[at]);
33905
33919
  at += 1;
33906
33920
  }
33907
33921
  let declare = at;
@@ -33909,8 +33923,7 @@ var scanCommand = (command, dialect, depth, scan) => {
33909
33923
  declare += 1;
33910
33924
  if (DECLARES.has(words[declare] ?? "")) {
33911
33925
  for (let index = declare + 1;index < words.length; index += 1) {
33912
- if (named(words[index]))
33913
- scan.hit ??= words[index]?.split("=")[0] ?? null;
33926
+ mark(scan, words[index]);
33914
33927
  if (expanded.has(index))
33915
33928
  scan.risky ??= UNREADABLE;
33916
33929
  }
@@ -33923,15 +33936,15 @@ var scanCommand = (command, dialect, depth, scan) => {
33923
33936
  }
33924
33937
  };
33925
33938
  var identityEnvChange = (command, dialect = "posix") => {
33926
- if (!/WORKIT_|\b(?:env|unset|export|declare|typeset|local|readonly)\b/u.test(command))
33939
+ if (!/WORKIT_|OPENCODE_SESSION_ID|PI_SESSION_ID|CODEX_THREAD_ID|CLAUDE|\b(?:env|unset|export|declare|typeset|local|readonly)\b/u.test(command))
33927
33940
  return null;
33928
33941
  if (dialect === "powershell")
33929
- return POWERSHELL.exec(command)?.[0] ?? null;
33930
- const scan = { hit: null, risky: null, runs: false };
33942
+ return POWERSHELL.exec(command)?.[0] ?? (/\bworkit\b/iu.test(command) ? POWERSHELL_HOST.exec(command)?.[0] ?? null : null);
33943
+ const scan = { hit: null, hostHit: null, risky: null, runs: false };
33931
33944
  scanCommand(command, dialect, 0, scan);
33932
- return scan.hit ?? (scan.runs ? scan.risky : null);
33945
+ return scan.hit ?? (scan.runs ? scan.hostHit ?? scan.risky : null);
33933
33946
  };
33934
- var identityEnvDeny = (change) => `workit identity: ${change === UNREADABLE ? `this command runs workit with ${UNREADABLE}` : `this command changes ${change}`}. The host sets WORKIT_HOST, WORKIT_SESSION_ID and WORKIT_AGENT_ID, and Workit acts as who they name; run it without changing them (a verifier or reviewer passes the --session and --token its start text names).`;
33947
+ var identityEnvDeny = (change) => `workit identity: ${change === UNREADABLE ? `this command runs workit with ${UNREADABLE}` : `this command changes ${change}`}. The host sets WORKIT_HOST, WORKIT_SESSION_ID, WORKIT_AGENT_ID and its own session variables, and Workit acts as who they name; run it without changing them (a verifier or reviewer passes the --session and --token its start text names).`;
33935
33948
 
33936
33949
  // packages/workit-core/src/hooks/handle.ts
33937
33950
  var usable2 = (value) => value === "native" || value === "partial";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/pi",
3
- "version": "2.27.4",
3
+ "version": "2.27.6",
4
4
  "description": "Workit native extension for Pi — tools, method skills, and session continuity",
5
5
  "keywords": [
6
6
  "agentic-coding",