@tekmidian/pai 0.65.2 → 0.66.1
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/{chain-CT3SI-3z.mjs → chain-CZfKIEq9.mjs} +4 -4
- package/dist/{chain-CT3SI-3z.mjs.map → chain-CZfKIEq9.mjs.map} +1 -1
- package/dist/cli/index.mjs +9 -9
- package/dist/cli/program.mjs +9 -9
- package/dist/{context-handover-cache-CRSFdkNi.mjs → context-handover-cache-pkHzmL3c.mjs} +3 -3
- package/dist/{context-handover-cache-CRSFdkNi.mjs.map → context-handover-cache-pkHzmL3c.mjs.map} +1 -1
- package/dist/daemon/index.mjs +7 -7
- package/dist/{daemon-SaPnmoyg.mjs → daemon-DXlaVCkw.mjs} +9 -9
- package/dist/{daemon-SaPnmoyg.mjs.map → daemon-DXlaVCkw.mjs.map} +1 -1
- package/dist/{daemon-DoTVK9z6.mjs → daemon-DyORmxZu.mjs} +7 -7
- package/dist/daemon-mcp/index.mjs +8 -6
- package/dist/daemon-mcp/index.mjs.map +1 -1
- package/dist/{fallback-vHjFZP0Y.mjs → fallback-CIiq2Raw.mjs} +18 -8
- package/dist/fallback-CIiq2Raw.mjs.map +1 -0
- package/dist/hooks/block-sleep-poll.mjs.map +2 -2
- package/dist/hooks/load-project-context.mjs +16 -0
- package/dist/hooks/load-project-context.mjs.map +2 -2
- package/dist/hooks/route-agents-to-worker.mjs +16 -0
- package/dist/hooks/route-agents-to-worker.mjs.map +2 -2
- package/dist/hooks/security-validator.mjs +16 -0
- package/dist/hooks/security-validator.mjs.map +2 -2
- package/dist/hooks/worker-guard.mjs +15 -0
- package/dist/hooks/worker-guard.mjs.map +3 -3
- package/dist/hooks/worker-proxy.mjs +16 -0
- package/dist/hooks/worker-proxy.mjs.map +2 -2
- package/dist/hooks/worker-status-line.mjs +17 -0
- package/dist/hooks/worker-status-line.mjs.map +2 -2
- package/dist/hooks/worker-supervision.mjs +16 -0
- package/dist/hooks/worker-supervision.mjs.map +2 -2
- package/dist/{main-resolver-VSM5ytnA.mjs → main-resolver-BKz_OuEh.mjs} +2 -2
- package/dist/{main-resolver-CKNGux1B.mjs → main-resolver-DPPwHNtn.mjs} +2 -2
- package/dist/{main-resolver-CKNGux1B.mjs.map → main-resolver-DPPwHNtn.mjs.map} +1 -1
- package/dist/{planner-Dzs9-8AS.mjs → planner-Dm5Acyo1.mjs} +5 -5
- package/dist/{planner-Dzs9-8AS.mjs.map → planner-Dm5Acyo1.mjs.map} +1 -1
- package/dist/{program-DK0mRRlf.mjs → program-JJ0TwSHI.mjs} +59 -16
- package/dist/program-JJ0TwSHI.mjs.map +1 -0
- package/dist/{run-DMaCpvMW.mjs → run-BCpbxqA5.mjs} +490 -26
- package/dist/run-BCpbxqA5.mjs.map +1 -0
- package/dist/{run-env-BHWnXqle.mjs → run-env-DRcp7A8K.mjs} +16 -2
- package/dist/run-env-DRcp7A8K.mjs.map +1 -0
- package/dist/{server-DlL1QI2k.mjs → server-DgmAHyFK.mjs} +2 -2
- package/dist/{server-DlL1QI2k.mjs.map → server-DgmAHyFK.mjs.map} +1 -1
- package/dist/{session-keepalive-DVZ9-7qg.mjs → session-keepalive-DxjTHGcK.mjs} +4 -4
- package/dist/{session-keepalive-DVZ9-7qg.mjs.map → session-keepalive-DxjTHGcK.mjs.map} +1 -1
- package/dist/{work-queue-worker-DZiEMvBQ.mjs → work-queue-worker-4tLa5gpQ.mjs} +2 -2
- package/dist/{work-queue-worker-DZiEMvBQ.mjs.map → work-queue-worker-4tLa5gpQ.mjs.map} +1 -1
- package/dist/{work-queue-worker-D7GHuj2I.mjs → work-queue-worker-rFZvTO3p.mjs} +4 -4
- package/docs/commands/README.md +1 -0
- package/docs/commands/worker.md +30 -0
- package/package.json +1 -1
- package/src/hooks/ts/lib/worker-guard.test.ts +12 -0
- package/src/hooks/ts/lib/worker-guard.ts +13 -0
- package/dist/fallback-vHjFZP0Y.mjs.map +0 -1
- package/dist/program-DK0mRRlf.mjs.map +0 -1
- package/dist/run-DMaCpvMW.mjs.map +0 -1
- package/dist/run-env-BHWnXqle.mjs.map +0 -1
|
@@ -7584,6 +7584,13 @@ function decideWorkerGitGuard(command, isWorker, cwd, worktreesRoot) {
|
|
|
7584
7584
|
return { blocked: false };
|
|
7585
7585
|
}
|
|
7586
7586
|
|
|
7587
|
+
// src/workers/browser-tools.ts
|
|
7588
|
+
var BROWSER_SERVER = /chrome|browsr|browser|playwright|puppeteer/i;
|
|
7589
|
+
function isBrowserTool(name) {
|
|
7590
|
+
const server = /^mcp__(.+?)(__|$)/.exec(name)?.[1] ?? name;
|
|
7591
|
+
return BROWSER_SERVER.test(server) && (name.startsWith("mcp__") || !name.includes("__"));
|
|
7592
|
+
}
|
|
7593
|
+
|
|
7587
7594
|
// src/hooks/ts/lib/worker-guard.ts
|
|
7588
7595
|
var deny = (reason) => ({ decision: "deny", reason });
|
|
7589
7596
|
var ALLOW = { decision: "allow" };
|
|
@@ -7705,6 +7712,8 @@ function gitSub(args) {
|
|
|
7705
7712
|
}
|
|
7706
7713
|
return null;
|
|
7707
7714
|
}
|
|
7715
|
+
var PATTERN_KILL = /* @__PURE__ */ new Set(["pkill", "killall"]);
|
|
7716
|
+
var PATTERN_KILL_REASON = "pattern-based process kill blocked: kill only what you started, by PID (`cmd & echo $! > /tmp/x.pid`, then `kill $(cat /tmp/x.pid)`), never by name or pattern; other workers' command lines contain your spec text";
|
|
7708
7717
|
function decideSegment(seg, st, ctx) {
|
|
7709
7718
|
const words = stripPrefix(seg.words);
|
|
7710
7719
|
const [cmd, ...args] = words;
|
|
@@ -7719,6 +7728,9 @@ function decideSegment(seg, st, ctx) {
|
|
|
7719
7728
|
return decideCommand(args[1], { ...ctx, cwd: st.cwd });
|
|
7720
7729
|
}
|
|
7721
7730
|
const pos = args.filter((a) => !isFlag(a));
|
|
7731
|
+
if (PATTERN_KILL.has(cmd) || cmd === "xargs" && args.includes("kill") || cmd === "kill" && /pgrep|pidof/.test(args.join(" "))) {
|
|
7732
|
+
return deny(PATTERN_KILL_REASON);
|
|
7733
|
+
}
|
|
7722
7734
|
if (cmd === "cd") {
|
|
7723
7735
|
const p = pos[0] ? abs(pos[0], st.cwd, ctx.home) : null;
|
|
7724
7736
|
if (!p) return ALLOW;
|
|
@@ -7795,6 +7807,9 @@ function decideWorkerGuard(input, env, ctx) {
|
|
|
7795
7807
|
if (env.PAI_WORKER !== "1") return ALLOW;
|
|
7796
7808
|
const tool = input.tool_name;
|
|
7797
7809
|
const ti = input.tool_input ?? {};
|
|
7810
|
+
if (env.PAI_WORKER_NO_BROWSER === "1" && tool?.startsWith("mcp__") && isBrowserTool(tool)) {
|
|
7811
|
+
return deny(`${tool} blocked: this worker runs with --no-browser`);
|
|
7812
|
+
}
|
|
7798
7813
|
if (tool === "Bash") {
|
|
7799
7814
|
return typeof ti.command === "string" ? decideCommand(ti.command, ctx()) : ALLOW;
|
|
7800
7815
|
}
|