@tekmidian/pai 1.0.4 → 1.0.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/.claude-plugin/plugin.json +1 -1
- package/dist/{aibroker-client-CQPGqLxL.mjs → aibroker-client-CXsyC7A8.mjs} +2 -2
- package/dist/aibroker-client-ChB7gSxV.mjs +3 -0
- package/dist/auto-route-Bc8xP6TQ.mjs +11 -0
- package/dist/{auto-route-21GdHL70.mjs → auto-route-YaEGVrFl.mjs} +2 -2
- package/dist/budget-DEiebT2A.mjs +15 -0
- package/dist/{caller-identity-yLFb7CKq.mjs → caller-identity-C6Nc96iM.mjs} +4 -4
- package/dist/{capacity-DEveQdFV.mjs → capacity-B2PgKAg4.mjs} +69 -6
- package/dist/{chain-D7PFur8Y.mjs → chain-CtK49-Ma.mjs} +5 -5
- package/dist/cli/index.mjs +2126 -290
- package/dist/{cockpit-actions-BfRMr2sm.mjs → cockpit-actions-C73mJAJ8.mjs} +18 -18
- package/dist/{cockpit-actions-OodH_vx_.mjs → cockpit-actions-D1OPP6Es.mjs} +30 -26
- package/dist/cockpit-memory-CLHZD64W.mjs +20 -0
- package/dist/config/defaults/config.yaml +21 -1
- package/dist/{config-XpZWOYOG.mjs → config-Bz8pAU5Q.mjs} +30 -5
- package/dist/{config-DtENJ6cL.mjs → config-DHgPx3ER.mjs} +1 -1
- package/dist/config-DLmyEK2q.mjs +4 -0
- package/dist/{config-Bu1_vbY8.mjs → config-SlZ-Z52i.mjs} +4 -3
- package/dist/{controls-JLm6g0yP.mjs → controls-rIItFeIJ.mjs} +59 -66
- package/dist/daemon/index.mjs +40 -39
- package/dist/daemon-176qA79N.mjs +46 -0
- package/dist/{daemon-nXanenDM.mjs → daemon-SoUvPUOf.mjs} +80 -30
- package/dist/daemon-mcp/index.mjs +49 -38
- package/dist/detect-C8nFP-kR.mjs +10 -0
- package/dist/{detect-BLKsUOgG.mjs → detect-DLjeYwnt.mjs} +2 -2
- package/dist/{embed-pass-e64AwDCa.mjs → embed-pass-CN1D8MXl.mjs} +5 -5
- package/dist/{embedding-gate-Cnk4YCyX.mjs → embedding-gate-BVQvUmox.mjs} +2 -2
- package/dist/{embedding-gate-6rZrWRXa.mjs → embedding-gate-iq0oQEkF.mjs} +3 -3
- package/dist/{endreason-BC-v05H_.mjs → endreason-C2-hYK0_.mjs} +4 -4
- package/dist/{factory-B7nv75rC.mjs → factory-CYwa0jYj.mjs} +6 -6
- package/dist/factory-DFwez99M.mjs +9 -0
- package/dist/{fallback-CBWpp2F2.mjs → fallback-CwPSCrX8.mjs} +9 -231
- package/dist/{health-C4FQmkJn.mjs → health-D0mUAVdw.mjs} +5 -5
- package/dist/{helpers-DSNK_1KP.mjs → helpers-Dj2nY56t.mjs} +2 -2
- package/dist/{helpers-Dz7mjTSw.mjs → helpers-DyHKAwrW.mjs} +6 -6
- package/dist/hooks/block-sleep-poll.mjs +1 -1
- package/dist/hooks/capture-all-events.mjs +68 -3
- package/dist/hooks/capture-tool-output.mjs +68 -3
- package/dist/hooks/handoff-link.mjs +128 -0
- package/dist/hooks/load-project-context.mjs +8 -8
- package/dist/hooks/local-model-hint.mjs +1 -1
- package/dist/hooks/route-agents-to-worker.mjs +1 -1
- package/dist/hooks/security-validator.mjs +842 -90
- package/dist/hooks/supervision-banner.mjs +186 -48
- package/dist/hooks/worker-edit-repair.mjs +2 -2
- package/dist/hooks/worker-guard.mjs +65 -9
- package/dist/hooks/worker-note.mjs +70 -5
- package/dist/hooks/worker-pool-host.mjs +1518 -265
- package/dist/hooks/worker-proxy.mjs +1 -1
- package/dist/hooks/worker-status-line.mjs +225 -86
- package/dist/hooks/worker-supervision.mjs +1 -1
- package/dist/hooks/worker-tool-name-repair.mjs +2 -2
- package/dist/index.mjs +9 -9
- package/dist/{ipc-client-CnYEF31R.mjs → ipc-client-CmagIFLh.mjs} +2 -2
- package/dist/{ipc-client-DN7EvoVo.mjs → ipc-client-DmbSIBUK.mjs} +1 -1
- package/dist/{kill-tree-DleMNZX3.mjs → kill-tree-DPiMscaY.mjs} +8 -8
- package/dist/kill-tree-Dxei6qlR.mjs +10 -0
- package/dist/{launch-DlZTKE3u.mjs → launch-BZT3JDoZ.mjs} +3 -3
- package/dist/{launch-Di7N-J5X.mjs → launch-Bn2Zf90h.mjs} +3 -3
- package/dist/{indexer-backend-BdjeL4P8.mjs → lessons-CFVU0cwA.mjs} +262 -43
- package/dist/{local-candidate-DLdwQt0s.mjs → local-candidate-DFd4pp-w.mjs} +3 -3
- package/dist/{local-instances-DOxSgT_L.mjs → local-instances-DhF4_sV2.mjs} +2 -2
- package/dist/{local-instances-ZeRkkuS5.mjs → local-instances-KTh8IeOT.mjs} +4 -4
- package/dist/{local-tiers-BE4jGaMa.mjs → local-tiers-CqwGUcEn.mjs} +3 -3
- package/dist/{local-tiers-DNMI5W86.mjs → local-tiers-DSlIYvvm.mjs} +3 -3
- package/dist/{main-config-ops-kTXR8Pyv.mjs → main-config-ops-rda08BCD.mjs} +3 -3
- package/dist/{main-resolver-yp_puSSb.mjs → main-resolver-BKwI0I6H.mjs} +18 -18
- package/dist/{migrate-DrA_OwlZ.mjs → migrate-C2z1YmWC.mjs} +2 -2
- package/dist/{model-inventory-h6Z9fN_o.mjs → model-inventory-BXv15B0d.mjs} +13 -13
- package/dist/{models-add-TVni3A7V.mjs → models-add-5yXTyz3g.mjs} +38 -37
- package/dist/operator-Bmv5tiHQ.mjs +7 -0
- package/dist/{operator-CyuB3aVw.mjs → operator-Br6GeswF.mjs} +2 -2
- package/dist/{pai-marker-BcZyJguM.mjs → pai-marker-D6OoVbM_.mjs} +2 -2
- package/dist/{pane-audit-Lqy9N_Ki.mjs → pane-audit-DLYy9-4g.mjs} +13 -23
- package/dist/{paths-CHifubDh.mjs → paths-CypxFTfn.mjs} +4 -4
- package/dist/{paths-CFHTloSe.mjs → paths-DIOwNcj-.mjs} +3 -3
- package/dist/{planner-j77ndkBf.mjs → planner-BzZ_2lc-.mjs} +29 -29
- package/dist/{pool-Dh-q3iJi.mjs → pool-9EsbKD-U.mjs} +2 -2
- package/dist/{pool-cli-DQ6OzRy2.mjs → pool-cli-Cy5mlycP.mjs} +6 -6
- package/dist/{pool-cli-BggU8GRp.mjs → pool-cli-Db0uDwB9.mjs} +5 -5
- package/dist/{postgres-BK4FP9Zg.mjs → postgres-B1B80bcj.mjs} +3 -3
- package/dist/{postgres-DNIOQijl.mjs → postgres-BL5oBBgY.mjs} +3 -3
- package/dist/{project-setup-CBRtFFh0.mjs → project-setup-DHxdJjEc.mjs} +24 -25
- package/dist/providers-BH6hQYbU.mjs +16 -0
- package/dist/{providers-C9QC0TtO.mjs → providers-BNV7CzC-.mjs} +6 -6
- package/dist/{query-feedback-DN52N9C5.mjs → query-feedback-BWl2HRwN.mjs} +2 -2
- package/dist/registrable-BwFiqazy.mjs +9 -0
- package/dist/{registrable-DpyTtajg.mjs → registrable-Dxs4oKIj.mjs} +4 -4
- package/dist/render-DVGXpfaT.mjs +13 -0
- package/dist/render-jPpMrudf.mjs +2240 -0
- package/dist/root-C8cxhdn9.mjs +36 -0
- package/dist/{root-C4oXlXS_.mjs → root-DmOzMeSv.mjs} +10 -10
- package/dist/route-table-COAmc1nB.mjs +15 -0
- package/dist/{router-CQSc3lk3.mjs → router-D2476pOp.mjs} +2 -2
- package/dist/{router-DwHJRgG9.mjs → router-ghujlEFb.mjs} +1 -1
- package/dist/{routing-f2zulGwD.mjs → routing-B_cg1_Xx.mjs} +13 -13
- package/dist/{routing-DmkheCRH.mjs → routing-aJKMIagQ.mjs} +16 -16
- package/dist/{run-BwZKBJZZ.mjs → run-DE9Q0ldN.mjs} +55 -31
- package/dist/{runtime-paths-WsO9sJFc.mjs → runtime-paths-twfV23YL.mjs} +2 -2
- package/dist/{scan-BBGvU5EB.mjs → scan-CNMcltOX.mjs} +7 -7
- package/dist/{scope-D-h6F6DN.mjs → scope-BTWstJ1B.mjs} +4 -4
- package/dist/session-DgZifjLx.mjs +35 -0
- package/dist/{session-Dn5OJXlg.mjs → session-HBYOABWU.mjs} +28 -28
- package/dist/session-scan-BZxnYN1v.mjs +9 -0
- package/dist/{session-scan-DUn10MBd.mjs → session-scan-CX3MKCNg.mjs} +6 -6
- package/dist/{session-usage-CPvXvSkw.mjs → session-usage-CCmPFFa6.mjs} +117 -2
- package/dist/{status-ggJ7lgVg.mjs → status-Cecau8Ps.mjs} +9 -5
- package/dist/status-D52xC_i0.mjs +6 -0
- package/dist/{tool-errors-7E13StWd.mjs → tool-errors-BFw1gv-z.mjs} +2 -2
- package/dist/{tool-errors-CJWODvlo.mjs → tool-errors-COM2JGEr.mjs} +6 -6
- package/dist/viewer-Ce-Xa9L3.mjs +22 -0
- package/dist/{viewer-wfKnvnrI.mjs → viewer-DvBg6N22.mjs} +16 -14
- package/dist/{wait-ByV0OyMZ.mjs → wait-C5iWILj_.mjs} +3 -3
- package/dist/worker-config-BmcJ9R0U.mjs +42 -0
- package/dist/{worker-config-eY5Qy4vl.mjs → worker-config-DkONNk_H.mjs} +164 -107
- package/dist/workers-config-DwzrtdYu.mjs +4 -0
- package/dist/{worktree-CRs2gyg0.mjs → worktree-O_kU6Q3y.mjs} +164 -8
- package/dist/{zettelkasten-tpCRBYvH.mjs → zettelkasten-BH8AdNh8.mjs} +4 -4
- package/dist/{zettelkasten-_h_tUm2T.mjs → zettelkasten-FFhQFESJ.mjs} +2 -2
- package/docs/commands/README.md +33 -2
- package/docs/commands/audit.md +34 -3
- package/docs/commands/backup.md +1 -1
- package/docs/commands/build.md +4 -4
- package/docs/commands/cd.md +1 -1
- package/docs/commands/clear-names.md +1 -1
- package/docs/commands/cockpit.md +1 -1
- package/docs/commands/config.md +21 -1
- package/docs/commands/daemon.md +1 -1
- package/docs/commands/db.md +1 -1
- package/docs/commands/doc.md +1 -1
- package/docs/commands/end.md +1 -1
- package/docs/commands/find.md +1 -1
- package/docs/commands/git.md +110 -0
- package/docs/commands/handoff.md +70 -0
- package/docs/commands/harness.md +74 -0
- package/docs/commands/help.md +1 -1
- package/docs/commands/home.md +1 -1
- package/docs/commands/hooks-db.md +1 -1
- package/docs/commands/identity.md +1 -1
- package/docs/commands/install.md +1 -1
- package/docs/commands/issue.md +1 -1
- package/docs/commands/kg.md +1 -1
- package/docs/commands/launch.md +1 -1
- package/docs/commands/lessons.md +201 -0
- package/docs/commands/list.md +1 -1
- package/docs/commands/ls.md +1 -1
- package/docs/commands/mcp.md +1 -1
- package/docs/commands/memory.md +1 -1
- package/docs/commands/models.md +1 -1
- package/docs/commands/more.md +1 -1
- package/docs/commands/new.md +1 -1
- package/docs/commands/notes.md +1 -1
- package/docs/commands/notify.md +1 -1
- package/docs/commands/observation.md +1 -1
- package/docs/commands/obsidian.md +1 -1
- package/docs/commands/open.md +1 -1
- package/docs/commands/pane.md +1 -1
- package/docs/commands/pause.md +1 -1
- package/docs/commands/plan.md +1 -1
- package/docs/commands/project.md +1 -1
- package/docs/commands/projects.md +1 -1
- package/docs/commands/providers.md +1 -1
- package/docs/commands/queue.md +1 -1
- package/docs/commands/registry.md +1 -1
- package/docs/commands/reload.md +1 -1
- package/docs/commands/rename.md +1 -1
- package/docs/commands/restore.md +1 -1
- package/docs/commands/resume.md +1 -1
- package/docs/commands/router.md +1 -1
- package/docs/commands/rules.md +70 -0
- package/docs/commands/session.md +1 -1
- package/docs/commands/sessions.md +1 -1
- package/docs/commands/setup.md +1 -1
- package/docs/commands/setups.md +1 -1
- package/docs/commands/shell-init.md +1 -1
- package/docs/commands/skill.md +1 -1
- package/docs/commands/task.md +1 -1
- package/docs/commands/tasks.md +1 -1
- package/docs/commands/topic.md +1 -1
- package/docs/commands/update.md +1 -1
- package/docs/commands/worker.md +1 -1
- package/docs/commands/zettel.md +1 -1
- package/docs/concepts/panes.md +3 -2
- package/gemini-extension.json +1 -1
- package/package.json +2 -2
- package/pai-plugin.json +1 -1
- package/plugins/context-preservation/plugin.json +1 -1
- package/plugins/core/plugin.json +1 -1
- package/plugins/creative/plugin.json +1 -1
- package/plugins/observability/plugin.json +1 -1
- package/plugins/productivity/plugin.json +1 -1
- package/plugins/semantic-search/plugin.json +1 -1
- package/plugins/ui/plugin.json +1 -1
- package/plugins/zettelkasten/plugin.json +1 -1
- package/src/hooks/ts/lib/loop-guard.ts +3 -5
- package/src/hooks/ts/lib/rules/builtin/base64-decode-to-shell.rule.yaml +13 -0
- package/src/hooks/ts/lib/rules/builtin/chmod-world-writable.rule.yaml +13 -0
- package/src/hooks/ts/lib/rules/builtin/chmod-zero.rule.yaml +11 -0
- package/src/hooks/ts/lib/rules/builtin/credential-file-read.rule.yaml +13 -0
- package/src/hooks/ts/lib/rules/builtin/credential-read-then-network.rule.yaml +29 -0
- package/src/hooks/ts/lib/rules/builtin/crontab-persistence.rule.yaml +10 -0
- package/src/hooks/ts/lib/rules/builtin/curl-piped-to-shell.rule.yaml +15 -0
- package/src/hooks/ts/lib/rules/builtin/download-then-execute.rule.yaml +30 -0
- package/src/hooks/ts/lib/rules/builtin/find-root-delete.rule.yaml +11 -0
- package/src/hooks/ts/lib/rules/builtin/git-push-force.rule.yaml +24 -0
- package/src/hooks/ts/lib/rules/builtin/git-push-plus-refspec.rule.yaml +12 -0
- package/src/hooks/ts/lib/rules/builtin/git-reset-hard.rule.yaml +12 -0
- package/src/hooks/ts/lib/rules/builtin/injection-then-tool.rule.yaml +30 -0
- package/src/hooks/ts/lib/rules/builtin/instruction-override-disregard.rule.yaml +12 -0
- package/src/hooks/ts/lib/rules/builtin/instruction-override-ignore.rule.yaml +13 -0
- package/src/hooks/ts/lib/rules/builtin/launchagents-write-persistence.rule.yaml +12 -0
- package/src/hooks/ts/lib/rules/builtin/launchctl-load-persistence.rule.yaml +10 -0
- package/src/hooks/ts/lib/rules/builtin/reverse-shell-dev-tcp.rule.yaml +11 -0
- package/src/hooks/ts/lib/rules/builtin/reverse-shell-interactive-bash.rule.yaml +11 -0
- package/src/hooks/ts/lib/rules/builtin/rm-recursive-parent.rule.yaml +11 -0
- package/src/hooks/ts/lib/rules/builtin/rm-recursive-relative.rule.yaml +11 -0
- package/src/hooks/ts/lib/rules/builtin/rm-recursive-root.rule.yaml +24 -0
- package/src/hooks/ts/lib/rules/builtin/rm-trailing-tilde.rule.yaml +11 -0
- package/src/hooks/ts/lib/rules/builtin/sudoers-nopasswd.rule.yaml +15 -0
- package/src/hooks/ts/lib/rules/builtin.generated.ts +530 -0
- package/src/hooks/ts/lib/rules/eval.ts +74 -0
- package/src/hooks/ts/lib/rules/lint.ts +102 -0
- package/src/hooks/ts/lib/rules/load.ts +229 -0
- package/src/hooks/ts/lib/rules/types.ts +56 -0
- package/src/hooks/ts/pre-tool-use/security-validator.ts +27 -96
- package/src/hooks/ts/user-prompt/handoff-link.ts +34 -0
- package/dist/aibroker-client-BxzeEHPF.mjs +0 -3
- package/dist/auto-route-C3S2W3Bc.mjs +0 -11
- package/dist/budget-BrloTOZW.mjs +0 -15
- package/dist/cockpit-memory-teG9M8bG.mjs +0 -20
- package/dist/config-Cxi-aBf4.mjs +0 -4
- package/dist/daemon-DeYImF1F.mjs +0 -45
- package/dist/detect-Rrimh0xc.mjs +0 -10
- package/dist/factory-Bs9imVMq.mjs +0 -9
- package/dist/kill-tree-SV6hrIa3.mjs +0 -10
- package/dist/operator-BTqvTIc8.mjs +0 -7
- package/dist/providers-FvCLzFge.mjs +0 -16
- package/dist/registrable-BzH4TObg.mjs +0 -9
- package/dist/render-B35bQTE-.mjs +0 -13
- package/dist/render-C84BqQRC.mjs +0 -903
- package/dist/root-DD1xx_Vu.mjs +0 -36
- package/dist/route-table-FEfDuhIV.mjs +0 -15
- package/dist/session-BAhtXdxj.mjs +0 -35
- package/dist/session-scan-B57dNuA4.mjs +0 -9
- package/dist/status-Dm4dYciN.mjs +0 -6
- package/dist/viewer-DEySE4c_.mjs +0 -22
- package/dist/worker-config-CO5FXLAT.mjs +0 -41
- package/dist/workers-config-f8KrkY4L.mjs +0 -4
|
@@ -7351,7 +7351,7 @@ var require_public_api = __commonJS({
|
|
|
7351
7351
|
}
|
|
7352
7352
|
return doc;
|
|
7353
7353
|
}
|
|
7354
|
-
function
|
|
7354
|
+
function parse3(src, reviver, options) {
|
|
7355
7355
|
let _reviver = void 0;
|
|
7356
7356
|
if (typeof reviver === "function") {
|
|
7357
7357
|
_reviver = reviver;
|
|
@@ -7392,7 +7392,7 @@ var require_public_api = __commonJS({
|
|
|
7392
7392
|
return value.toString(options);
|
|
7393
7393
|
return new Document5.Document(value, _replacer, options).toString(options);
|
|
7394
7394
|
}
|
|
7395
|
-
exports.parse =
|
|
7395
|
+
exports.parse = parse3;
|
|
7396
7396
|
exports.parseAllDocuments = parseAllDocuments;
|
|
7397
7397
|
exports.parseDocument = parseDocument5;
|
|
7398
7398
|
exports.stringify = stringify;
|
|
@@ -7777,27 +7777,6 @@ var init_scope = __esm({
|
|
|
7777
7777
|
}
|
|
7778
7778
|
});
|
|
7779
7779
|
|
|
7780
|
-
// src/workers/chatui.ts
|
|
7781
|
-
var init_chatui = __esm({
|
|
7782
|
-
"src/workers/chatui.ts"() {
|
|
7783
|
-
"use strict";
|
|
7784
|
-
}
|
|
7785
|
-
});
|
|
7786
|
-
|
|
7787
|
-
// src/workers/deadline.ts
|
|
7788
|
-
var init_deadline = __esm({
|
|
7789
|
-
"src/workers/deadline.ts"() {
|
|
7790
|
-
"use strict";
|
|
7791
|
-
}
|
|
7792
|
-
});
|
|
7793
|
-
|
|
7794
|
-
// src/workers/active-time.ts
|
|
7795
|
-
var init_active_time = __esm({
|
|
7796
|
-
"src/workers/active-time.ts"() {
|
|
7797
|
-
"use strict";
|
|
7798
|
-
}
|
|
7799
|
-
});
|
|
7800
|
-
|
|
7801
7780
|
// src/workers/stagger.ts
|
|
7802
7781
|
var init_stagger = __esm({
|
|
7803
7782
|
"src/workers/stagger.ts"() {
|
|
@@ -7806,6 +7785,14 @@ var init_stagger = __esm({
|
|
|
7806
7785
|
}
|
|
7807
7786
|
});
|
|
7808
7787
|
|
|
7788
|
+
// src/workers/waiting.ts
|
|
7789
|
+
var init_waiting = __esm({
|
|
7790
|
+
"src/workers/waiting.ts"() {
|
|
7791
|
+
"use strict";
|
|
7792
|
+
init_args();
|
|
7793
|
+
}
|
|
7794
|
+
});
|
|
7795
|
+
|
|
7809
7796
|
// src/workers/capacity.ts
|
|
7810
7797
|
var DEFAULT_CAPACITY;
|
|
7811
7798
|
var init_capacity = __esm({
|
|
@@ -7813,23 +7800,37 @@ var init_capacity = __esm({
|
|
|
7813
7800
|
"use strict";
|
|
7814
7801
|
init_stagger();
|
|
7815
7802
|
init_config3();
|
|
7803
|
+
init_waiting();
|
|
7816
7804
|
init_status();
|
|
7817
7805
|
DEFAULT_CAPACITY = { enabled: true, localDefaultCap: 1, uncappedQueueCap: 3, maxTotalWaitMs: 2 * 36e5, heartbeatMs: 6e4, agingMs: 15 * 6e4 };
|
|
7818
7806
|
}
|
|
7819
7807
|
});
|
|
7820
7808
|
|
|
7821
|
-
// src/workers/
|
|
7822
|
-
var
|
|
7823
|
-
"src/workers/
|
|
7809
|
+
// src/workers/chatui.ts
|
|
7810
|
+
var init_chatui = __esm({
|
|
7811
|
+
"src/workers/chatui.ts"() {
|
|
7824
7812
|
"use strict";
|
|
7825
7813
|
}
|
|
7826
7814
|
});
|
|
7827
7815
|
|
|
7828
|
-
// src/workers/
|
|
7829
|
-
var
|
|
7830
|
-
"src/workers/
|
|
7816
|
+
// src/workers/deadline.ts
|
|
7817
|
+
var init_deadline = __esm({
|
|
7818
|
+
"src/workers/deadline.ts"() {
|
|
7819
|
+
"use strict";
|
|
7820
|
+
}
|
|
7821
|
+
});
|
|
7822
|
+
|
|
7823
|
+
// src/workers/active-time.ts
|
|
7824
|
+
var init_active_time = __esm({
|
|
7825
|
+
"src/workers/active-time.ts"() {
|
|
7826
|
+
"use strict";
|
|
7827
|
+
}
|
|
7828
|
+
});
|
|
7829
|
+
|
|
7830
|
+
// src/workers/denials.ts
|
|
7831
|
+
var init_denials = __esm({
|
|
7832
|
+
"src/workers/denials.ts"() {
|
|
7831
7833
|
"use strict";
|
|
7832
|
-
init_args();
|
|
7833
7834
|
}
|
|
7834
7835
|
});
|
|
7835
7836
|
|
|
@@ -8072,6 +8073,7 @@ var init_worktree = __esm({
|
|
|
8072
8073
|
init_paths();
|
|
8073
8074
|
init_pending();
|
|
8074
8075
|
init_pool();
|
|
8076
|
+
init_config2();
|
|
8075
8077
|
}
|
|
8076
8078
|
});
|
|
8077
8079
|
|
|
@@ -8095,6 +8097,156 @@ var init_endreason = __esm({
|
|
|
8095
8097
|
}
|
|
8096
8098
|
});
|
|
8097
8099
|
|
|
8100
|
+
// src/workers/ps-table.ts
|
|
8101
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
8102
|
+
function truncateLines(text, max = PS_MAX_LINE) {
|
|
8103
|
+
return text.split("\n").map((l) => l.length > max ? l.slice(0, max) : l).join("\n");
|
|
8104
|
+
}
|
|
8105
|
+
function psTable(format, run = realRunner, maxLine = PS_MAX_LINE) {
|
|
8106
|
+
return truncateLines(run(["-axo", format]), maxLine);
|
|
8107
|
+
}
|
|
8108
|
+
var PS_MAX_BUFFER, PS_MAX_LINE, realRunner;
|
|
8109
|
+
var init_ps_table = __esm({
|
|
8110
|
+
"src/workers/ps-table.ts"() {
|
|
8111
|
+
"use strict";
|
|
8112
|
+
PS_MAX_BUFFER = 64 * 1024 * 1024;
|
|
8113
|
+
PS_MAX_LINE = 1024;
|
|
8114
|
+
realRunner = (args) => execFileSync2("ps", args, { encoding: "utf8", env: { ...process.env, LC_ALL: "C" }, maxBuffer: PS_MAX_BUFFER, timeout: 15e3 });
|
|
8115
|
+
}
|
|
8116
|
+
});
|
|
8117
|
+
|
|
8118
|
+
// src/workers/hang-probe.ts
|
|
8119
|
+
var init_hang_probe = __esm({
|
|
8120
|
+
"src/workers/hang-probe.ts"() {
|
|
8121
|
+
"use strict";
|
|
8122
|
+
init_ps_table();
|
|
8123
|
+
}
|
|
8124
|
+
});
|
|
8125
|
+
|
|
8126
|
+
// src/utils/redact.ts
|
|
8127
|
+
var REDACTED, REDACTED_RE, KEY_WORDS, VAL, REDACT_RULES, LINE_RULES, LONG_RUN, KEY_LINE;
|
|
8128
|
+
var init_redact = __esm({
|
|
8129
|
+
"src/utils/redact.ts"() {
|
|
8130
|
+
"use strict";
|
|
8131
|
+
REDACTED = "[REDACTED]";
|
|
8132
|
+
REDACTED_RE = String.raw`\[REDACTED\]`;
|
|
8133
|
+
KEY_WORDS = "password|passwd|secret|token|api[_-]?key|credential|auth(?:orization)?|bearer";
|
|
8134
|
+
VAL = String.raw`(?:"[^"]*"|'[^']*'|[^\s'"]+)`;
|
|
8135
|
+
REDACT_RULES = [
|
|
8136
|
+
{
|
|
8137
|
+
// `Authorization: Bearer xxx` / `Authorization: Basic xxx` — keep the scheme
|
|
8138
|
+
id: "authorization",
|
|
8139
|
+
re: /(Authorization\s*:\s*)(Bearer|Basic)\s+(\S+)/gi,
|
|
8140
|
+
replace: (_m, head, scheme) => `${head}${scheme} ${REDACTED}`
|
|
8141
|
+
},
|
|
8142
|
+
{
|
|
8143
|
+
// `key=value`, `key: value`, `"key": "value"` — key carries a secret-ish word;
|
|
8144
|
+
// the word must be a whole key segment, so `monkeys=` stays untouched
|
|
8145
|
+
id: "key-value",
|
|
8146
|
+
re: new RegExp(String.raw`(?<![A-Za-z0-9])((?:[A-Za-z0-9]+[_-])?(?:${KEY_WORDS})(?![A-Za-z0-9])[A-Za-z0-9_-]*)(\s*[:=]\s*)(?!(?:Bearer|Basic) ${REDACTED_RE})(${VAL})`, "gi"),
|
|
8147
|
+
replace: (_m, key, sep) => `${key}${sep}${REDACTED}`
|
|
8148
|
+
},
|
|
8149
|
+
{
|
|
8150
|
+
// `export FOO_TOKEN=...` / `FOO_KEY=...` — SCREAMING_SNAKE env style
|
|
8151
|
+
id: "env-style",
|
|
8152
|
+
re: new RegExp(String.raw`(?<![A-Za-z0-9])((?:export\s+)?[A-Z][A-Z0-9]*_(?:KEY|SECRET|TOKEN|PASS\w*|CRED\w*|AUTH\w*)\s*=\s*)(${VAL})`, "g"),
|
|
8153
|
+
replace: (_m, head) => `${head}${REDACTED}`
|
|
8154
|
+
},
|
|
8155
|
+
{
|
|
8156
|
+
// long CLI flags only: `--password X`, `--token X`, `--api-key X`, `--secret X`, `--passwd X`
|
|
8157
|
+
id: "cli-flag",
|
|
8158
|
+
re: new RegExp(String.raw`(--(?:password|token|api-key|secret|passwd)(?:\s*=\s*|\s+))(${VAL})`, "gi"),
|
|
8159
|
+
replace: (_m, head) => `${head}${REDACTED}`
|
|
8160
|
+
},
|
|
8161
|
+
{
|
|
8162
|
+
// `scheme://user:pass@host` — redact the password, keep user and host
|
|
8163
|
+
id: "url-credentials",
|
|
8164
|
+
re: /((?<![a-z0-9+.-])[a-z][a-z0-9+.-]*:\/\/[^\s/@:]+:)([^\s/@]+)(@)/gi,
|
|
8165
|
+
replace: (_m, head, _pass, at) => `${head}${REDACTED}${at}`
|
|
8166
|
+
},
|
|
8167
|
+
{
|
|
8168
|
+
// provider token prefixes: sk-ant-, sk-, ghp_/gho_/ghu_/ghs_/ghr_, github_pat_,
|
|
8169
|
+
// glpat-, xoxb-/xoxp-/xoxa-, AKIA/ASIA + 16 chars, AIza + 35 chars, JWT (eyJ… three segments)
|
|
8170
|
+
id: "token-prefix",
|
|
8171
|
+
re: /\b(?:sk-ant-[A-Za-z0-9_-]{20,}|sk-[A-Za-z0-9_-]{20,}|gh[pousr]_[A-Za-z0-9]{30,}|github_pat_[A-Za-z0-9_]{22,}|glpat-[A-Za-z0-9_-]{20,}|xox[bap]-[A-Za-z0-9-]{10,}|(?:AKIA|ASIA)[A-Z0-9]{16}|AIza[A-Za-z0-9_-]{35}(?![A-Za-z0-9_-])|eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+)(?![A-Za-z0-9_-])/g,
|
|
8172
|
+
replace: REDACTED
|
|
8173
|
+
},
|
|
8174
|
+
{
|
|
8175
|
+
// 40+ char opaque base64/hex run, only on a line that also has a secret-ish key word
|
|
8176
|
+
id: "long-run",
|
|
8177
|
+
re: /\b[A-Za-z0-9+/]{40,}={0,2}(?![\w/])/g,
|
|
8178
|
+
// a bare 40-hex git SHA stays; it is only redacted as the value of a secret key
|
|
8179
|
+
replace: (m) => /^[0-9a-f]{40}$/i.test(m) ? m : REDACTED
|
|
8180
|
+
}
|
|
8181
|
+
];
|
|
8182
|
+
LINE_RULES = REDACT_RULES.filter((r) => r.id !== "long-run");
|
|
8183
|
+
LONG_RUN = REDACT_RULES.find((r) => r.id === "long-run");
|
|
8184
|
+
KEY_LINE = new RegExp(`(?:${KEY_WORDS})`, "i");
|
|
8185
|
+
}
|
|
8186
|
+
});
|
|
8187
|
+
|
|
8188
|
+
// src/hooks/ts/lib/build-gate.ts
|
|
8189
|
+
var init_build_gate = __esm({
|
|
8190
|
+
"src/hooks/ts/lib/build-gate.ts"() {
|
|
8191
|
+
"use strict";
|
|
8192
|
+
}
|
|
8193
|
+
});
|
|
8194
|
+
|
|
8195
|
+
// src/hooks/ts/lib/loop-guard.ts
|
|
8196
|
+
var LOOP_MAX_REPEATS, LOOP_READ_STREAK, SELF, LOOP_DENY_REASON, WAIT_CAP_MS, FP_FULL_READ_BYTES, FP_TOTAL_BYTES;
|
|
8197
|
+
var init_loop_guard = __esm({
|
|
8198
|
+
"src/hooks/ts/lib/loop-guard.ts"() {
|
|
8199
|
+
"use strict";
|
|
8200
|
+
init_hang_probe();
|
|
8201
|
+
init_redact();
|
|
8202
|
+
init_build_gate();
|
|
8203
|
+
LOOP_MAX_REPEATS = 4;
|
|
8204
|
+
LOOP_READ_STREAK = Number(process.env.PAI_LOOP_READ_STREAK) > 0 ? Number(process.env.PAI_LOOP_READ_STREAK) : 15;
|
|
8205
|
+
SELF = "If your part is done, commit and write your R report. If you are stuck, report the blocker in R x= (or use pai worker help if available).";
|
|
8206
|
+
LOOP_DENY_REASON = `loop guard: you ran this command ${LOOP_MAX_REPEATS} times with the same result and nothing changed. Stop repeating it. ${SELF}`;
|
|
8207
|
+
WAIT_CAP_MS = 45 * 6e4;
|
|
8208
|
+
FP_FULL_READ_BYTES = 256 * 1024;
|
|
8209
|
+
FP_TOTAL_BYTES = 4 * 1024 * 1024;
|
|
8210
|
+
}
|
|
8211
|
+
});
|
|
8212
|
+
|
|
8213
|
+
// src/audit/scan.ts
|
|
8214
|
+
var init_scan = __esm({
|
|
8215
|
+
"src/audit/scan.ts"() {
|
|
8216
|
+
"use strict";
|
|
8217
|
+
init_loop_guard();
|
|
8218
|
+
}
|
|
8219
|
+
});
|
|
8220
|
+
|
|
8221
|
+
// src/hooks/ts/lib/rules/builtin.generated.ts
|
|
8222
|
+
var init_builtin_generated = __esm({
|
|
8223
|
+
"src/hooks/ts/lib/rules/builtin.generated.ts"() {
|
|
8224
|
+
"use strict";
|
|
8225
|
+
}
|
|
8226
|
+
});
|
|
8227
|
+
|
|
8228
|
+
// src/hooks/ts/lib/rules/load.ts
|
|
8229
|
+
var import_yaml6;
|
|
8230
|
+
var init_load = __esm({
|
|
8231
|
+
"src/hooks/ts/lib/rules/load.ts"() {
|
|
8232
|
+
"use strict";
|
|
8233
|
+
import_yaml6 = __toESM(require_dist(), 1);
|
|
8234
|
+
init_pai_home();
|
|
8235
|
+
init_builtin_generated();
|
|
8236
|
+
}
|
|
8237
|
+
});
|
|
8238
|
+
|
|
8239
|
+
// src/workers/scan.ts
|
|
8240
|
+
var init_scan2 = __esm({
|
|
8241
|
+
"src/workers/scan.ts"() {
|
|
8242
|
+
"use strict";
|
|
8243
|
+
init_scan();
|
|
8244
|
+
init_load();
|
|
8245
|
+
init_paths();
|
|
8246
|
+
init_status();
|
|
8247
|
+
}
|
|
8248
|
+
});
|
|
8249
|
+
|
|
8098
8250
|
// src/workers/render.ts
|
|
8099
8251
|
var init_render = __esm({
|
|
8100
8252
|
"src/workers/render.ts"() {
|
|
@@ -8114,6 +8266,7 @@ var init_render = __esm({
|
|
|
8114
8266
|
init_scope();
|
|
8115
8267
|
init_endreason();
|
|
8116
8268
|
init_report();
|
|
8269
|
+
init_scan2();
|
|
8117
8270
|
}
|
|
8118
8271
|
});
|
|
8119
8272
|
|
|
@@ -8170,6 +8323,8 @@ var init_pane_bar = __esm({
|
|
|
8170
8323
|
"use strict";
|
|
8171
8324
|
init_chatui();
|
|
8172
8325
|
init_render();
|
|
8326
|
+
init_capacity();
|
|
8327
|
+
init_pane_exec();
|
|
8173
8328
|
init_pane_policy();
|
|
8174
8329
|
}
|
|
8175
8330
|
});
|
|
@@ -8179,29 +8334,12 @@ var init_pane_exec = __esm({
|
|
|
8179
8334
|
"src/workers/pane-exec.ts"() {
|
|
8180
8335
|
"use strict";
|
|
8181
8336
|
init_pai_home();
|
|
8337
|
+
init_capacity();
|
|
8182
8338
|
init_pane_bar();
|
|
8183
8339
|
init_pane_policy();
|
|
8184
8340
|
}
|
|
8185
8341
|
});
|
|
8186
8342
|
|
|
8187
|
-
// src/workers/ps-table.ts
|
|
8188
|
-
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
8189
|
-
function truncateLines(text, max = PS_MAX_LINE) {
|
|
8190
|
-
return text.split("\n").map((l) => l.length > max ? l.slice(0, max) : l).join("\n");
|
|
8191
|
-
}
|
|
8192
|
-
function psTable(format, run = realRunner, maxLine = PS_MAX_LINE) {
|
|
8193
|
-
return truncateLines(run(["-axo", format]), maxLine);
|
|
8194
|
-
}
|
|
8195
|
-
var PS_MAX_BUFFER, PS_MAX_LINE, realRunner;
|
|
8196
|
-
var init_ps_table = __esm({
|
|
8197
|
-
"src/workers/ps-table.ts"() {
|
|
8198
|
-
"use strict";
|
|
8199
|
-
PS_MAX_BUFFER = 64 * 1024 * 1024;
|
|
8200
|
-
PS_MAX_LINE = 1024;
|
|
8201
|
-
realRunner = (args) => execFileSync2("ps", args, { encoding: "utf8", env: { ...process.env, LC_ALL: "C" }, maxBuffer: PS_MAX_BUFFER, timeout: 15e3 });
|
|
8202
|
-
}
|
|
8203
|
-
});
|
|
8204
|
-
|
|
8205
8343
|
// src/workers/pane-title.ts
|
|
8206
8344
|
var init_pane_title = __esm({
|
|
8207
8345
|
"src/workers/pane-title.ts"() {
|
|
@@ -7409,7 +7409,7 @@ function parseEscalate(v, bad2) {
|
|
|
7409
7409
|
}
|
|
7410
7410
|
|
|
7411
7411
|
// src/workers/config.ts
|
|
7412
|
-
import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
|
|
7412
|
+
import { existsSync as existsSync6, readFileSync as readFileSync6, statSync as statSync2 } from "node:fs";
|
|
7413
7413
|
|
|
7414
7414
|
// src/daemon/config.ts
|
|
7415
7415
|
import { homedir as homedir2, userInfo } from "node:os";
|
|
@@ -8974,7 +8974,7 @@ import {
|
|
|
8974
8974
|
readdirSync as readdirSync2,
|
|
8975
8975
|
renameSync as renameSync4,
|
|
8976
8976
|
rmSync,
|
|
8977
|
-
statSync as
|
|
8977
|
+
statSync as statSync3,
|
|
8978
8978
|
writeFileSync as writeFileSync3
|
|
8979
8979
|
} from "node:fs";
|
|
8980
8980
|
|
|
@@ -7409,7 +7409,7 @@ function parseEscalate(v, bad2) {
|
|
|
7409
7409
|
}
|
|
7410
7410
|
|
|
7411
7411
|
// src/workers/config.ts
|
|
7412
|
-
import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
|
|
7412
|
+
import { existsSync as existsSync6, readFileSync as readFileSync6, statSync as statSync2 } from "node:fs";
|
|
7413
7413
|
|
|
7414
7414
|
// src/daemon/config.ts
|
|
7415
7415
|
import { homedir as homedir2, userInfo } from "node:os";
|
|
@@ -8981,7 +8981,7 @@ import {
|
|
|
8981
8981
|
readdirSync as readdirSync2,
|
|
8982
8982
|
renameSync as renameSync4,
|
|
8983
8983
|
rmSync,
|
|
8984
|
-
statSync as
|
|
8984
|
+
statSync as statSync3,
|
|
8985
8985
|
writeFileSync as writeFileSync3
|
|
8986
8986
|
} from "node:fs";
|
|
8987
8987
|
import { join as join8 } from "node:path";
|
|
@@ -9254,7 +9254,7 @@ function ownsPid(status) {
|
|
|
9254
9254
|
env: { ...process.env, LC_ALL: "C" }
|
|
9255
9255
|
}).trim();
|
|
9256
9256
|
const psStart = Date.parse(out);
|
|
9257
|
-
const started = spawnTimeOf(status) ?? Date.parse(status.started.replace(" ", "T"));
|
|
9257
|
+
const started = status.procStart ?? spawnTimeOf(status) ?? Date.parse(status.started.replace(" ", "T"));
|
|
9258
9258
|
if (Number.isNaN(psStart) || Number.isNaN(started)) return alive(status.pid);
|
|
9259
9259
|
return Math.abs(psStart - started) <= 12e4;
|
|
9260
9260
|
} catch {
|
|
@@ -10380,7 +10380,7 @@ function decideOrchestratorBash(rawCommand) {
|
|
|
10380
10380
|
// src/hooks/ts/lib/loop-guard.ts
|
|
10381
10381
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
10382
10382
|
import { createHash } from "node:crypto";
|
|
10383
|
-
import { readFileSync as readFileSync13, statSync as
|
|
10383
|
+
import { readFileSync as readFileSync13, statSync as statSync4 } from "node:fs";
|
|
10384
10384
|
import { isAbsolute as isAbsolute2, join as join11, resolve as resolve5 } from "node:path";
|
|
10385
10385
|
|
|
10386
10386
|
// src/workers/ps-table.ts
|
|
@@ -10408,6 +10408,62 @@ function wrapTestCommand(command) {
|
|
|
10408
10408
|
return `${WRAP} --cmd-b64 ${Buffer.from(command, "utf8").toString("base64")}`;
|
|
10409
10409
|
}
|
|
10410
10410
|
|
|
10411
|
+
// src/utils/redact.ts
|
|
10412
|
+
var REDACTED = "[REDACTED]";
|
|
10413
|
+
var REDACTED_RE = String.raw`\[REDACTED\]`;
|
|
10414
|
+
var KEY_WORDS = "password|passwd|secret|token|api[_-]?key|credential|auth(?:orization)?|bearer";
|
|
10415
|
+
var VAL = String.raw`(?:"[^"]*"|'[^']*'|[^\s'"]+)`;
|
|
10416
|
+
var REDACT_RULES = [
|
|
10417
|
+
{
|
|
10418
|
+
// `Authorization: Bearer xxx` / `Authorization: Basic xxx` — keep the scheme
|
|
10419
|
+
id: "authorization",
|
|
10420
|
+
re: /(Authorization\s*:\s*)(Bearer|Basic)\s+(\S+)/gi,
|
|
10421
|
+
replace: (_m, head, scheme) => `${head}${scheme} ${REDACTED}`
|
|
10422
|
+
},
|
|
10423
|
+
{
|
|
10424
|
+
// `key=value`, `key: value`, `"key": "value"` — key carries a secret-ish word;
|
|
10425
|
+
// the word must be a whole key segment, so `monkeys=` stays untouched
|
|
10426
|
+
id: "key-value",
|
|
10427
|
+
re: new RegExp(String.raw`(?<![A-Za-z0-9])((?:[A-Za-z0-9]+[_-])?(?:${KEY_WORDS})(?![A-Za-z0-9])[A-Za-z0-9_-]*)(\s*[:=]\s*)(?!(?:Bearer|Basic) ${REDACTED_RE})(${VAL})`, "gi"),
|
|
10428
|
+
replace: (_m, key, sep) => `${key}${sep}${REDACTED}`
|
|
10429
|
+
},
|
|
10430
|
+
{
|
|
10431
|
+
// `export FOO_TOKEN=...` / `FOO_KEY=...` — SCREAMING_SNAKE env style
|
|
10432
|
+
id: "env-style",
|
|
10433
|
+
re: new RegExp(String.raw`(?<![A-Za-z0-9])((?:export\s+)?[A-Z][A-Z0-9]*_(?:KEY|SECRET|TOKEN|PASS\w*|CRED\w*|AUTH\w*)\s*=\s*)(${VAL})`, "g"),
|
|
10434
|
+
replace: (_m, head) => `${head}${REDACTED}`
|
|
10435
|
+
},
|
|
10436
|
+
{
|
|
10437
|
+
// long CLI flags only: `--password X`, `--token X`, `--api-key X`, `--secret X`, `--passwd X`
|
|
10438
|
+
id: "cli-flag",
|
|
10439
|
+
re: new RegExp(String.raw`(--(?:password|token|api-key|secret|passwd)(?:\s*=\s*|\s+))(${VAL})`, "gi"),
|
|
10440
|
+
replace: (_m, head) => `${head}${REDACTED}`
|
|
10441
|
+
},
|
|
10442
|
+
{
|
|
10443
|
+
// `scheme://user:pass@host` — redact the password, keep user and host
|
|
10444
|
+
id: "url-credentials",
|
|
10445
|
+
re: /((?<![a-z0-9+.-])[a-z][a-z0-9+.-]*:\/\/[^\s/@:]+:)([^\s/@]+)(@)/gi,
|
|
10446
|
+
replace: (_m, head, _pass, at) => `${head}${REDACTED}${at}`
|
|
10447
|
+
},
|
|
10448
|
+
{
|
|
10449
|
+
// provider token prefixes: sk-ant-, sk-, ghp_/gho_/ghu_/ghs_/ghr_, github_pat_,
|
|
10450
|
+
// glpat-, xoxb-/xoxp-/xoxa-, AKIA/ASIA + 16 chars, AIza + 35 chars, JWT (eyJ… three segments)
|
|
10451
|
+
id: "token-prefix",
|
|
10452
|
+
re: /\b(?:sk-ant-[A-Za-z0-9_-]{20,}|sk-[A-Za-z0-9_-]{20,}|gh[pousr]_[A-Za-z0-9]{30,}|github_pat_[A-Za-z0-9_]{22,}|glpat-[A-Za-z0-9_-]{20,}|xox[bap]-[A-Za-z0-9-]{10,}|(?:AKIA|ASIA)[A-Z0-9]{16}|AIza[A-Za-z0-9_-]{35}(?![A-Za-z0-9_-])|eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+)(?![A-Za-z0-9_-])/g,
|
|
10453
|
+
replace: REDACTED
|
|
10454
|
+
},
|
|
10455
|
+
{
|
|
10456
|
+
// 40+ char opaque base64/hex run, only on a line that also has a secret-ish key word
|
|
10457
|
+
id: "long-run",
|
|
10458
|
+
re: /\b[A-Za-z0-9+/]{40,}={0,2}(?![\w/])/g,
|
|
10459
|
+
// a bare 40-hex git SHA stays; it is only redacted as the value of a secret key
|
|
10460
|
+
replace: (m) => /^[0-9a-f]{40}$/i.test(m) ? m : REDACTED
|
|
10461
|
+
}
|
|
10462
|
+
];
|
|
10463
|
+
var LINE_RULES = REDACT_RULES.filter((r) => r.id !== "long-run");
|
|
10464
|
+
var LONG_RUN = REDACT_RULES.find((r) => r.id === "long-run");
|
|
10465
|
+
var KEY_LINE = new RegExp(`(?:${KEY_WORDS})`, "i");
|
|
10466
|
+
|
|
10411
10467
|
// src/hooks/ts/lib/build-gate.ts
|
|
10412
10468
|
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
10413
10469
|
import { existsSync as existsSync12, readFileSync as readFileSync12, realpathSync as realpathSync2 } from "node:fs";
|
|
@@ -10613,7 +10669,7 @@ function worktreeFingerprint(cwd) {
|
|
|
10613
10669
|
if (!p || p.startsWith(".") || p.includes("/.")) continue;
|
|
10614
10670
|
try {
|
|
10615
10671
|
const file = join11(root, p);
|
|
10616
|
-
const st =
|
|
10672
|
+
const st = statSync4(file);
|
|
10617
10673
|
if (!st.isFile() || !st.size) continue;
|
|
10618
10674
|
if (st.size > FP_FULL_READ_BYTES || st.size > budget) {
|
|
10619
10675
|
h.update(`${p}\0${st.size}\0${st.mtimeMs}`);
|
|
@@ -10916,7 +10972,7 @@ function saveLoopState(file, state) {
|
|
|
10916
10972
|
}
|
|
10917
10973
|
|
|
10918
10974
|
// src/workers/tool-errors.ts
|
|
10919
|
-
import { appendFileSync, existsSync as existsSync14, mkdirSync as mkdirSync6, readFileSync as readFileSync15, statSync as
|
|
10975
|
+
import { appendFileSync, existsSync as existsSync14, mkdirSync as mkdirSync6, readFileSync as readFileSync15, statSync as statSync5, openSync, readSync, closeSync } from "node:fs";
|
|
10920
10976
|
import { join as join13 } from "node:path";
|
|
10921
10977
|
|
|
10922
10978
|
// src/workers/agentish.ts
|
|
@@ -11131,7 +11187,7 @@ function appendStopEvent(logDir, id, stop) {
|
|
|
11131
11187
|
}
|
|
11132
11188
|
|
|
11133
11189
|
// src/builds/queue.ts
|
|
11134
|
-
import { existsSync as existsSync15, mkdirSync as mkdirSync8, readdirSync as readdirSync4, readFileSync as readFileSync16, renameSync as renameSync6, rmSync as rmSync4, rmdirSync, statSync as
|
|
11190
|
+
import { existsSync as existsSync15, mkdirSync as mkdirSync8, readdirSync as readdirSync4, readFileSync as readFileSync16, renameSync as renameSync6, rmSync as rmSync4, rmdirSync, statSync as statSync6, writeFileSync as writeFileSync7 } from "node:fs";
|
|
11135
11191
|
import { join as join14 } from "node:path";
|
|
11136
11192
|
var defaultDeps = () => ({
|
|
11137
11193
|
isAlive: (pid) => {
|
|
@@ -11162,13 +11218,13 @@ function breakStaleMutex(m, staleMs = 5e3) {
|
|
|
11162
11218
|
mkdirSync8(guard);
|
|
11163
11219
|
} catch {
|
|
11164
11220
|
try {
|
|
11165
|
-
if (Date.now() -
|
|
11221
|
+
if (Date.now() - statSync6(guard).mtimeMs > staleMs) rmdirSync(guard);
|
|
11166
11222
|
} catch {
|
|
11167
11223
|
}
|
|
11168
11224
|
return;
|
|
11169
11225
|
}
|
|
11170
11226
|
try {
|
|
11171
|
-
if (Date.now() -
|
|
11227
|
+
if (Date.now() - statSync6(m).mtimeMs > staleMs) rmdirSync(m);
|
|
11172
11228
|
} catch {
|
|
11173
11229
|
} finally {
|
|
11174
11230
|
try {
|
|
@@ -7409,7 +7409,7 @@ function parseEscalate(v, bad2) {
|
|
|
7409
7409
|
}
|
|
7410
7410
|
|
|
7411
7411
|
// src/workers/config.ts
|
|
7412
|
-
import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
|
|
7412
|
+
import { existsSync as existsSync6, readFileSync as readFileSync6, statSync as statSync2 } from "node:fs";
|
|
7413
7413
|
|
|
7414
7414
|
// src/daemon/config.ts
|
|
7415
7415
|
import { homedir as homedir2, userInfo } from "node:os";
|
|
@@ -8959,7 +8959,7 @@ import {
|
|
|
8959
8959
|
readdirSync as readdirSync2,
|
|
8960
8960
|
renameSync as renameSync4,
|
|
8961
8961
|
rmSync,
|
|
8962
|
-
statSync as
|
|
8962
|
+
statSync as statSync3,
|
|
8963
8963
|
writeFileSync as writeFileSync3
|
|
8964
8964
|
} from "node:fs";
|
|
8965
8965
|
|
|
@@ -9243,6 +9243,73 @@ function currentWorkerId(env = process.env, logDir) {
|
|
|
9243
9243
|
// src/workers/ps-table.ts
|
|
9244
9244
|
var PS_MAX_BUFFER = 64 * 1024 * 1024;
|
|
9245
9245
|
|
|
9246
|
+
// src/utils/redact.ts
|
|
9247
|
+
var REDACTED = "[REDACTED]";
|
|
9248
|
+
var REDACTED_RE = String.raw`\[REDACTED\]`;
|
|
9249
|
+
var KEY_WORDS = "password|passwd|secret|token|api[_-]?key|credential|auth(?:orization)?|bearer";
|
|
9250
|
+
var VAL = String.raw`(?:"[^"]*"|'[^']*'|[^\s'"]+)`;
|
|
9251
|
+
var REDACT_RULES = [
|
|
9252
|
+
{
|
|
9253
|
+
// `Authorization: Bearer xxx` / `Authorization: Basic xxx` — keep the scheme
|
|
9254
|
+
id: "authorization",
|
|
9255
|
+
re: /(Authorization\s*:\s*)(Bearer|Basic)\s+(\S+)/gi,
|
|
9256
|
+
replace: (_m, head, scheme) => `${head}${scheme} ${REDACTED}`
|
|
9257
|
+
},
|
|
9258
|
+
{
|
|
9259
|
+
// `key=value`, `key: value`, `"key": "value"` — key carries a secret-ish word;
|
|
9260
|
+
// the word must be a whole key segment, so `monkeys=` stays untouched
|
|
9261
|
+
id: "key-value",
|
|
9262
|
+
re: new RegExp(String.raw`(?<![A-Za-z0-9])((?:[A-Za-z0-9]+[_-])?(?:${KEY_WORDS})(?![A-Za-z0-9])[A-Za-z0-9_-]*)(\s*[:=]\s*)(?!(?:Bearer|Basic) ${REDACTED_RE})(${VAL})`, "gi"),
|
|
9263
|
+
replace: (_m, key, sep) => `${key}${sep}${REDACTED}`
|
|
9264
|
+
},
|
|
9265
|
+
{
|
|
9266
|
+
// `export FOO_TOKEN=...` / `FOO_KEY=...` — SCREAMING_SNAKE env style
|
|
9267
|
+
id: "env-style",
|
|
9268
|
+
re: new RegExp(String.raw`(?<![A-Za-z0-9])((?:export\s+)?[A-Z][A-Z0-9]*_(?:KEY|SECRET|TOKEN|PASS\w*|CRED\w*|AUTH\w*)\s*=\s*)(${VAL})`, "g"),
|
|
9269
|
+
replace: (_m, head) => `${head}${REDACTED}`
|
|
9270
|
+
},
|
|
9271
|
+
{
|
|
9272
|
+
// long CLI flags only: `--password X`, `--token X`, `--api-key X`, `--secret X`, `--passwd X`
|
|
9273
|
+
id: "cli-flag",
|
|
9274
|
+
re: new RegExp(String.raw`(--(?:password|token|api-key|secret|passwd)(?:\s*=\s*|\s+))(${VAL})`, "gi"),
|
|
9275
|
+
replace: (_m, head) => `${head}${REDACTED}`
|
|
9276
|
+
},
|
|
9277
|
+
{
|
|
9278
|
+
// `scheme://user:pass@host` — redact the password, keep user and host
|
|
9279
|
+
id: "url-credentials",
|
|
9280
|
+
re: /((?<![a-z0-9+.-])[a-z][a-z0-9+.-]*:\/\/[^\s/@:]+:)([^\s/@]+)(@)/gi,
|
|
9281
|
+
replace: (_m, head, _pass, at) => `${head}${REDACTED}${at}`
|
|
9282
|
+
},
|
|
9283
|
+
{
|
|
9284
|
+
// provider token prefixes: sk-ant-, sk-, ghp_/gho_/ghu_/ghs_/ghr_, github_pat_,
|
|
9285
|
+
// glpat-, xoxb-/xoxp-/xoxa-, AKIA/ASIA + 16 chars, AIza + 35 chars, JWT (eyJ… three segments)
|
|
9286
|
+
id: "token-prefix",
|
|
9287
|
+
re: /\b(?:sk-ant-[A-Za-z0-9_-]{20,}|sk-[A-Za-z0-9_-]{20,}|gh[pousr]_[A-Za-z0-9]{30,}|github_pat_[A-Za-z0-9_]{22,}|glpat-[A-Za-z0-9_-]{20,}|xox[bap]-[A-Za-z0-9-]{10,}|(?:AKIA|ASIA)[A-Z0-9]{16}|AIza[A-Za-z0-9_-]{35}(?![A-Za-z0-9_-])|eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+)(?![A-Za-z0-9_-])/g,
|
|
9288
|
+
replace: REDACTED
|
|
9289
|
+
},
|
|
9290
|
+
{
|
|
9291
|
+
// 40+ char opaque base64/hex run, only on a line that also has a secret-ish key word
|
|
9292
|
+
id: "long-run",
|
|
9293
|
+
re: /\b[A-Za-z0-9+/]{40,}={0,2}(?![\w/])/g,
|
|
9294
|
+
// a bare 40-hex git SHA stays; it is only redacted as the value of a secret key
|
|
9295
|
+
replace: (m) => /^[0-9a-f]{40}$/i.test(m) ? m : REDACTED
|
|
9296
|
+
}
|
|
9297
|
+
];
|
|
9298
|
+
var PEM_BLOCK = /-----BEGIN[^-\n]*PRIVATE KEY-----[\s\S]*?(?:-----END[^-\n]*PRIVATE KEY-----|$)/g;
|
|
9299
|
+
var LINE_RULES = REDACT_RULES.filter((r) => r.id !== "long-run");
|
|
9300
|
+
var LONG_RUN = REDACT_RULES.find((r) => r.id === "long-run");
|
|
9301
|
+
var KEY_LINE = new RegExp(`(?:${KEY_WORDS})`, "i");
|
|
9302
|
+
function redactLine(line) {
|
|
9303
|
+
let out = line;
|
|
9304
|
+
for (const r of LINE_RULES) out = out.replace(r.re, r.replace);
|
|
9305
|
+
if (KEY_LINE.test(out)) out = out.replace(LONG_RUN.re, LONG_RUN.replace);
|
|
9306
|
+
return out;
|
|
9307
|
+
}
|
|
9308
|
+
function redactSecrets(text) {
|
|
9309
|
+
const withPem = text.replace(PEM_BLOCK, `-----BEGIN PRIVATE KEY----- ${REDACTED}`);
|
|
9310
|
+
return withPem.split("\n").map(redactLine).join("\n");
|
|
9311
|
+
}
|
|
9312
|
+
|
|
9246
9313
|
// src/hooks/ts/lib/loop-guard.ts
|
|
9247
9314
|
var LOOP_MAX_REPEATS = 4;
|
|
9248
9315
|
var LOOP_READ_STREAK = Number(process.env.PAI_LOOP_READ_STREAK) > 0 ? Number(process.env.PAI_LOOP_READ_STREAK) : 15;
|
|
@@ -9360,10 +9427,8 @@ ${typeof r.stderr === "string" ? r.stderr : ""}`;
|
|
|
9360
9427
|
text = text.replace(TMP_PATH, "TMP").replace(/\s+/g, " ").trim();
|
|
9361
9428
|
return text.length > RESULT_CHARS ? `${text.slice(0, RESULT_CHARS / 2)} ${text.slice(-RESULT_CHARS / 2)}` : text;
|
|
9362
9429
|
}
|
|
9363
|
-
var SECRET_LINE = /pass(?:word|wd)|secret|token|api[_-]?key|credential|authorization|bearer|private key|^\s*(?:export\s+)?[A-Z][A-Z0-9_]*(?:KEY|SECRET|TOKEN|PASS\w*|CRED\w*|AUTH\w*)\s*=|\b(?:sk|ghp|gho|xox[bap])[-_][A-Za-z0-9_-]{16,}|\b[A-Za-z0-9+]{40,}={0,2}(?![\w/])|\b[a-z][a-z0-9+.-]*:\/\/[^\s\/:@]+:[^\s\/@]+@|\b(?:AKIA|ASIA|AGPA|AIDA|AROA)[A-Z0-9]{16}\b|\bgh[pousr]_[A-Za-z0-9]{20,}/i;
|
|
9364
|
-
var MASKED_LINE = "[line masked: looks like a secret]";
|
|
9365
9430
|
function maskSecrets(text) {
|
|
9366
|
-
return text
|
|
9431
|
+
return redactSecrets(text);
|
|
9367
9432
|
}
|
|
9368
9433
|
function rawText(response) {
|
|
9369
9434
|
if (typeof response === "string") return response;
|