@workit-dev/pi 2.27.2 → 2.27.5
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 +5 -0
- package/dist/workit.js +13 -8
- package/package.json +1 -1
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;
|
|
@@ -16722,15 +16727,13 @@ function sessionTrust(cwd, row) {
|
|
|
16722
16727
|
const session = row.actor.session;
|
|
16723
16728
|
if (!session || row.self === true)
|
|
16724
16729
|
return null;
|
|
16730
|
+
const binding = session.includes(":") ? issuedBinding(cwd, session) : null;
|
|
16731
|
+
if (binding === "token" && row.sessionBound !== true)
|
|
16732
|
+
return "unbound_session";
|
|
16725
16733
|
const source = typeof row.sessionSource === "string" ? row.sessionSource : "env";
|
|
16726
16734
|
const host = row.actor.host;
|
|
16727
16735
|
const issuedOnly = source === "flag" ? host !== "cli" : source === "env" && session.includes(":") && !SHELL_VOUCHED_HOSTS.has(host);
|
|
16728
|
-
|
|
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;
|
|
16736
|
+
return issuedOnly && binding === null ? "unissued_session" : null;
|
|
16734
16737
|
}
|
|
16735
16738
|
function trustReasons(cwd, row) {
|
|
16736
16739
|
if (row.integrity === "unverified")
|
|
@@ -29832,11 +29835,13 @@ function currentJudgment(cwd) {
|
|
|
29832
29835
|
// packages/workit-core/src/core/verdict-set.ts
|
|
29833
29836
|
import path44 from "node:path";
|
|
29834
29837
|
var SET_TTL_MS = 7 * 86400000;
|
|
29838
|
+
var SET_ROW = "verdict.set";
|
|
29835
29839
|
var SET_VOID = "verdict.set.voided";
|
|
29836
29840
|
var setStorePath = () => path44.join(resolveStateDir(), "verdicts", "sets", "ledger.jsonl");
|
|
29841
|
+
var distrusted = (cwd, id, rows, type) => rows.some((row) => row.type === type && row.id === id && trustReasons(cwd, row).length > 0);
|
|
29837
29842
|
function gateStands(cwd, gate, rows, now = Date.now()) {
|
|
29838
29843
|
const id = typeof gate.verdictId === "string" ? gate.verdictId : null;
|
|
29839
|
-
if (id !== null && verdictVoids(rows).has(id))
|
|
29844
|
+
if (id !== null && (verdictVoids(rows).has(id) || distrusted(cwd, id, rows, "verdict")))
|
|
29840
29845
|
return false;
|
|
29841
29846
|
if (gate.via !== "set")
|
|
29842
29847
|
return true;
|
|
@@ -29846,7 +29851,7 @@ function gateStands(cwd, gate, rows, now = Date.now()) {
|
|
|
29846
29851
|
if (id === null)
|
|
29847
29852
|
return true;
|
|
29848
29853
|
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");
|
|
29854
|
+
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
29855
|
}
|
|
29851
29856
|
|
|
29852
29857
|
// packages/workit-core/src/hooks/stop.ts
|