@workit-dev/pi 2.27.1 → 2.27.4

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/workit.js +20 -9
  2. package/package.json +1 -1
package/dist/workit.js CHANGED
@@ -16722,15 +16722,13 @@ function sessionTrust(cwd, row) {
16722
16722
  const session = row.actor.session;
16723
16723
  if (!session || row.self === true)
16724
16724
  return null;
16725
+ const binding = session.includes(":") ? issuedBinding(cwd, session) : null;
16726
+ if (binding === "token" && row.sessionBound !== true)
16727
+ return "unbound_session";
16725
16728
  const source = typeof row.sessionSource === "string" ? row.sessionSource : "env";
16726
16729
  const host = row.actor.host;
16727
16730
  const issuedOnly = source === "flag" ? host !== "cli" : source === "env" && session.includes(":") && !SHELL_VOUCHED_HOSTS.has(host);
16728
- if (!issuedOnly)
16729
- return null;
16730
- const binding = issuedBinding(cwd, session);
16731
- if (binding === null)
16732
- return "unissued_session";
16733
- return binding === "token" && row.sessionBound !== true ? "unbound_session" : null;
16731
+ return issuedOnly && binding === null ? "unissued_session" : null;
16734
16732
  }
16735
16733
  function trustReasons(cwd, row) {
16736
16734
  if (row.integrity === "unverified")
@@ -29832,11 +29830,13 @@ function currentJudgment(cwd) {
29832
29830
  // packages/workit-core/src/core/verdict-set.ts
29833
29831
  import path44 from "node:path";
29834
29832
  var SET_TTL_MS = 7 * 86400000;
29833
+ var SET_ROW = "verdict.set";
29835
29834
  var SET_VOID = "verdict.set.voided";
29836
29835
  var setStorePath = () => path44.join(resolveStateDir(), "verdicts", "sets", "ledger.jsonl");
29836
+ var distrusted = (cwd, id, rows, type) => rows.some((row) => row.type === type && row.id === id && trustReasons(cwd, row).length > 0);
29837
29837
  function gateStands(cwd, gate, rows, now = Date.now()) {
29838
29838
  const id = typeof gate.verdictId === "string" ? gate.verdictId : null;
29839
- if (id !== null && verdictVoids(rows).has(id))
29839
+ if (id !== null && (verdictVoids(rows).has(id) || distrusted(cwd, id, rows, "verdict")))
29840
29840
  return false;
29841
29841
  if (gate.via !== "set")
29842
29842
  return true;
@@ -29846,7 +29846,7 @@ function gateStands(cwd, gate, rows, now = Date.now()) {
29846
29846
  if (id === null)
29847
29847
  return true;
29848
29848
  const read = readLedgerAt(cwd, setStorePath(), { integrity: true });
29849
- return read.ok && !read.value.rows.some((row) => row.type === SET_VOID && row.target === id && row.integrity === "verified");
29849
+ return read.ok && !distrusted(cwd, id, read.value.rows, SET_ROW) && !read.value.rows.some((row) => row.type === SET_VOID && row.target === id && row.integrity === "verified");
29850
29850
  }
29851
29851
 
29852
29852
  // packages/workit-core/src/hooks/stop.ts
@@ -33865,16 +33865,27 @@ var opaque = (rest, scan, assigns) => {
33865
33865
  if (hit && rest.some((word) => base3(word).toLowerCase() === "env"))
33866
33866
  scan.hit ??= hit.split("=")[0] ?? null;
33867
33867
  };
33868
+ var LOGIN_VALUED = {
33869
+ su: /[sgGwc]/u,
33870
+ runuser: /[sgGwuc]/u,
33871
+ script: /[cEIOBTmot]/u
33872
+ };
33868
33873
  var loginScript = (words) => {
33869
33874
  const at = words.findIndex((word) => /^(?:su|runuser|script)$/u.test(base3(word)));
33870
33875
  if (at < 0)
33871
33876
  return null;
33877
+ const valued = LOGIN_VALUED[base3(words[at])] ?? /c/u;
33872
33878
  for (let index = at + 1;index < words.length; index += 1) {
33873
33879
  const word = words[index] ?? "";
33874
- if (word === "-c" || word === "--command")
33880
+ if (word === "--command")
33875
33881
  return words[index + 1] ?? null;
33876
33882
  if (word.startsWith("--command="))
33877
33883
  return word.slice("--command=".length);
33884
+ if (!/^-[^-]/u.test(word))
33885
+ continue;
33886
+ const ends = word.slice(1).search(valued) + 1;
33887
+ if (ends > 0 && word[ends] === "c")
33888
+ return word.slice(ends + 1) || (words[index + 1] ?? null);
33878
33889
  }
33879
33890
  return null;
33880
33891
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/pi",
3
- "version": "2.27.1",
3
+ "version": "2.27.4",
4
4
  "description": "Workit native extension for Pi — tools, method skills, and session continuity",
5
5
  "keywords": [
6
6
  "agentic-coding",