@modootoday/pmcp 0.22.12 → 0.22.13
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/.agents/plugins/marketplace.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.mcp.json +1 -1
- package/dist/affected-ZWO2F5EM.js +836 -0
- package/dist/{apply-LPKZZ6EL.js → apply-OIKQ5SIY.js} +19 -15
- package/dist/{available-BFXLII4A.js → available-Z5MIDFPH.js} +3 -3
- package/dist/{broadcast-DZGMSZRG.js → broadcast-BF2QL3O7.js} +6 -5
- package/dist/{chunk-DYZVHO2L.js → chunk-24L4MO7H.js} +2 -2
- package/dist/{chunk-7I7O7ZNT.js → chunk-3V37OZQH.js} +5 -3
- package/dist/{chunk-PEMMV5YQ.js → chunk-4O4ZOSBQ.js} +3 -3
- package/dist/{chunk-FODUHLZM.js → chunk-5IZFEVPW.js} +2 -2
- package/dist/{chunk-D5MIZM6L.js → chunk-5KWDQFVY.js} +4 -4
- package/dist/{chunk-R5MT42JS.js → chunk-5OFQVW2K.js} +2 -2
- package/dist/{chunk-OAX6MIOZ.js → chunk-5PNS6V5C.js} +2 -2
- package/dist/chunk-65BW7Y6O.js +40 -0
- package/dist/{chunk-SPZQRLL5.js → chunk-733WVP2R.js} +18 -6
- package/dist/{chunk-HUBJWC7T.js → chunk-737BENAU.js} +7 -7
- package/dist/{chunk-GFOQDLPL.js → chunk-74O7KZUH.js} +13 -3
- package/dist/{chunk-2OOWAGBE.js → chunk-7ZOQELXR.js} +3 -3
- package/dist/{chunk-ITOTOC6Y.js → chunk-A6DARDQ4.js} +3 -3
- package/dist/{chunk-PUIWESU3.js → chunk-A7XCUR2C.js} +4 -4
- package/dist/chunk-BN4XAXMQ.js +65 -0
- package/dist/chunk-FOLA4EUJ.js +261 -0
- package/dist/chunk-FQLCD4HU.js +24 -0
- package/dist/chunk-G4ATQPQI.js +35 -0
- package/dist/{chunk-DP326AER.js → chunk-GNVME5AD.js} +2 -2
- package/dist/{chunk-OEH47H6A.js → chunk-GUHOEIHP.js} +3 -20
- package/dist/{chunk-UMQLIRSU.js → chunk-ISGBOJT7.js} +3 -3
- package/dist/{chunk-RPCIROW7.js → chunk-J3QUG6O5.js} +2 -2
- package/dist/{chunk-B2WRYGHJ.js → chunk-JW5NMQTU.js} +3 -3
- package/dist/{chunk-63RZGEVI.js → chunk-K2VU3B4W.js} +98 -26
- package/dist/{chunk-5QKXEWDB.js → chunk-MHKY6TNF.js} +6 -4
- package/dist/chunk-N7ANFMA5.js +171 -0
- package/dist/{chunk-EX4YXPVW.js → chunk-NNGGNXF2.js} +2 -2
- package/dist/{chunk-7CSUKCU7.js → chunk-P5D6RKMT.js} +13 -94
- package/dist/{chunk-SMZPYJQI.js → chunk-QBSJL3SP.js} +42 -31
- package/dist/chunk-SGFTHKKS.js +86 -0
- package/dist/{chunk-N63QCJHX.js → chunk-T4GVN7XO.js} +5 -5
- package/dist/chunk-T6C3TSTO.js +99 -0
- package/dist/{chunk-UDVYVRGJ.js → chunk-UED3RH53.js} +2 -2
- package/dist/{chunk-SUJCVEBM.js → chunk-VNZTULFD.js} +3 -3
- package/dist/chunk-VSTUKACC.js +7 -0
- package/dist/{chunk-A4PKLESO.js → chunk-WFY7ATSZ.js} +8 -4
- package/dist/{chunk-KPKMEUUH.js → chunk-XSWF7APE.js} +3 -3
- package/dist/{chunk-MIFPPUWY.js → chunk-ZKB7ZNKY.js} +4 -4
- package/dist/{chunk-2GRECE6B.js → chunk-ZS5IDQFJ.js} +4 -4
- package/dist/{cli-JXPJFHUA.js → cli-FSSYFCV3.js} +15 -9
- package/dist/{cli-34EDFXJA.js → cli-IHVNE3WL.js} +9 -9
- package/dist/cli.js +19 -13
- package/dist/{completion-KTECNPVY.js → completion-ZTTJVV4C.js} +8 -6
- package/dist/{diagnostics-I5VZHK42.js → diagnostics-XC5L6Z3E.js} +10 -6
- package/dist/{doctor-JJ2VUNHT.js → doctor-FGDSUBR3.js} +19 -15
- package/dist/{entry-OT7BN3ID.js → entry-NNB2CQLZ.js} +19 -15
- package/dist/{exec-mcp-3E4SRJUY.js → exec-mcp-ZU3Z3XT6.js} +15 -11
- package/dist/{harness-Q236VJSU.js → harness-B7ANLH5M.js} +5 -5
- package/dist/harness-launch-gate.js +8 -4
- package/dist/harness-worker.js +10 -6
- package/dist/heavy-IIZBO4YM.js +1909 -0
- package/dist/hook-body.js +69 -21
- package/dist/{hooks-PABOEQO6.js → hooks-IEJTW7BV.js} +5 -5
- package/dist/{host-UDC4HVX3.js → host-5P4D7GSE.js} +17 -13
- package/dist/{host-LT5JMUFJ.js → host-XXWQ23LD.js} +11 -7
- package/dist/{host-run-LD63JGN7.js → host-run-AEWHFVQL.js} +10 -6
- package/dist/http.js +1 -1
- package/dist/{import-mcp-URVONIZ3.js → import-mcp-BQM5DKYH.js} +14 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -12
- package/dist/{init-4O24ZNUQ.js → init-L6GUO3PW.js} +2 -2
- package/dist/{install-7V6NIA7W.js → install-OFVLR7TI.js} +3 -3
- package/dist/{invoke-JW5OC2HO.js → invoke-3BQ5NG3P.js} +12 -8
- package/dist/{list-UM4DYJRL.js → list-EU4MJOXA.js} +16 -12
- package/dist/{list-WK2IYUK7.js → list-WWYCGD3X.js} +4 -4
- package/dist/{logout-H5X4D26I.js → logout-6DFDYJUI.js} +15 -11
- package/dist/{logs-UHJM7ZCL.js → logs-BRF6DBKG.js} +7 -6
- package/dist/{mailbox-YN6PG66A.js → mailbox-AQCTXO3H.js} +3 -3
- package/dist/{mailbox-NIMBOQPA.js → mailbox-QYA2LQSE.js} +9 -41
- package/dist/{mainline-74WCH4T4.js → mainline-O5AEHG3J.js} +69 -121
- package/dist/{marketplace-G4VQET5W.js → marketplace-TI5HFAHB.js} +2 -2
- package/dist/{mcp-AXHV547W.js → mcp-4R53HSGY.js} +2 -2
- package/dist/{mcp-6P3MVT4V.js → mcp-HR5JFUW7.js} +2 -2
- package/dist/{models-ISU4DCMA.js → models-63NQBSV3.js} +2 -2
- package/dist/{pause-CBZ3BTJL.js → pause-UF7FQDJX.js} +6 -5
- package/dist/{preview-DT7DWG5F.js → preview-WSESS2UN.js} +3 -3
- package/dist/{project-6QUIC73W.js → project-JXXL24WN.js} +5 -5
- package/dist/{reindex-I7RYWCUR.js → reindex-3GPKAFBW.js} +5 -5
- package/dist/{report-ZHOHQ4PZ.js → report-JUSKQPAC.js} +7 -6
- package/dist/{resume-UJEWQ66P.js → resume-3WAROOQ3.js} +6 -5
- package/dist/{run-GZK3XJ62.js → run-VUUQS4WY.js} +5 -5
- package/dist/{run-HQTB7N2R.js → run-XRWU4L73.js} +13 -9
- package/dist/{serve-APEVIJD2.js → serve-OEX5V5CD.js} +7 -7
- package/dist/{setup-SOUBEZ3H.js → setup-SWNAC2C7.js} +6 -4
- package/dist/{smoke-2FI5D74B.js → smoke-5BGJXAHX.js} +4 -4
- package/dist/{start-login-ER7DEGYN.js → start-login-MG26NDE3.js} +15 -11
- package/dist/{status-7NYXRZ3R.js → status-APADL7O2.js} +15 -11
- package/dist/{status-KN2ZE64O.js → status-GKCIVAAR.js} +6 -5
- package/dist/{status-OGABWCPO.js → status-LH7Q255G.js} +17 -13
- package/dist/stdio.js +2 -2
- package/dist/{sweep-EPZCW63Q.js → sweep-VTVPDAPY.js} +6 -5
- package/dist/{test-WRZQERYC.js → test-TK2J3IB7.js} +16 -12
- package/dist/{tui-YUHQ36FC.js → tui-YTPHHKCW.js} +5 -5
- package/dist/{unbroadcast-N6LXHAMT.js → unbroadcast-CH7BAQ2G.js} +6 -5
- package/dist/{validate-KFBCUFI4.js → validate-5QVZBE6W.js} +4 -4
- package/dist/wait-4HYJJAWO.js +141 -0
- package/dist/{worker-OKBJNDEI.js → worker-RBXYAMR4.js} +12 -8
- package/dist/{worktree-create-KMXPQXIQ.js → worktree-create-FEZNQUQ6.js} +2 -2
- package/docs/commands.md +48 -12
- package/docs/git-workflow.md +51 -0
- package/docs/hooks.md +8 -1
- package/docs/project-configuration.md +134 -18
- package/docs/upgrading.md +11 -0
- package/gemini-extension.json +2 -2
- package/mcp.json +1 -1
- package/package.json +5 -5
- package/plugin.json +1 -1
- package/plugins/pmcp/.claude-plugin/plugin.json +1 -1
- package/plugins/pmcp/.mcp.json +1 -1
- package/plugins/pmcp/gemini-extension.json +2 -2
- package/plugins/pmcp/mcp.json +1 -1
- package/plugins/pmcp/plugin.json +1 -1
- package/dist/chunk-3C5FVHQ3.js +0 -7
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
globPattern
|
|
3
|
-
} from "./chunk-UKR64U7J.js";
|
|
4
1
|
import {
|
|
5
2
|
syncWorktree
|
|
6
3
|
} from "./chunk-UYBWUOLR.js";
|
|
4
|
+
import {
|
|
5
|
+
globPattern
|
|
6
|
+
} from "./chunk-UKR64U7J.js";
|
|
7
7
|
import {
|
|
8
8
|
localCli,
|
|
9
9
|
pmcpCommand,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
import {
|
|
29
29
|
leaseSpecs,
|
|
30
30
|
readGitConfig
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-P5D6RKMT.js";
|
|
32
32
|
import {
|
|
33
33
|
detect
|
|
34
34
|
} from "./chunk-SUDG7B6S.js";
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
inboxKey,
|
|
37
37
|
noticeOf,
|
|
38
38
|
readStoreSettings
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-3V37OZQH.js";
|
|
40
40
|
import {
|
|
41
41
|
STATE_FILES,
|
|
42
42
|
runtimePid
|
|
@@ -63,12 +63,17 @@ import {
|
|
|
63
63
|
TOOLS
|
|
64
64
|
} from "./chunk-V4NPDK6X.js";
|
|
65
65
|
import {
|
|
66
|
+
declaresPtyHost,
|
|
66
67
|
hostOutputs,
|
|
67
68
|
packagedBinary,
|
|
68
69
|
readHost,
|
|
69
70
|
readLock,
|
|
70
71
|
readLockFile
|
|
71
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-733WVP2R.js";
|
|
73
|
+
import {
|
|
74
|
+
DISABLE_ENV,
|
|
75
|
+
readLeaseSettings
|
|
76
|
+
} from "./chunk-FOLA4EUJ.js";
|
|
72
77
|
import {
|
|
73
78
|
ProjectError,
|
|
74
79
|
RULES_DIR,
|
|
@@ -167,7 +172,7 @@ function shellWord(text) {
|
|
|
167
172
|
return pieces.join("");
|
|
168
173
|
}
|
|
169
174
|
function forwardedVariables(server) {
|
|
170
|
-
const
|
|
175
|
+
const names4 = new Set(server.envVars ?? []);
|
|
171
176
|
const words = [
|
|
172
177
|
server.command ?? "",
|
|
173
178
|
...server.args,
|
|
@@ -177,11 +182,11 @@ function forwardedVariables(server) {
|
|
|
177
182
|
for (const word of words) {
|
|
178
183
|
for (const match of word.matchAll(VARIABLE)) {
|
|
179
184
|
if (match[1] !== "PROJECT_ROOT") {
|
|
180
|
-
|
|
185
|
+
names4.add(match[1]);
|
|
181
186
|
}
|
|
182
187
|
}
|
|
183
188
|
}
|
|
184
|
-
return [...
|
|
189
|
+
return [...names4].sort();
|
|
185
190
|
}
|
|
186
191
|
function launch(spec) {
|
|
187
192
|
if (spec.command === void 0) {
|
|
@@ -969,9 +974,9 @@ function hookOutputs(spec) {
|
|
|
969
974
|
}
|
|
970
975
|
|
|
971
976
|
// src/project/adapters/opencode-skills.ts
|
|
972
|
-
function opencodeSkillOutputs(spec,
|
|
977
|
+
function opencodeSkillOutputs(spec, names4) {
|
|
973
978
|
if (!spec.tools.has("opencode")) return [];
|
|
974
|
-
return
|
|
979
|
+
return names4.filter((name) => spec.skills[name]?.invocation === "user").map(
|
|
975
980
|
(name) => jsonOutput(OPENCODE_CONFIG, ["permission", "skill", name], "deny")
|
|
976
981
|
);
|
|
977
982
|
}
|
|
@@ -1478,9 +1483,9 @@ function agentNames(root) {
|
|
|
1478
1483
|
);
|
|
1479
1484
|
}
|
|
1480
1485
|
function skillOutputs(spec) {
|
|
1481
|
-
const
|
|
1482
|
-
const outputs = opencodeSkillOutputs(spec,
|
|
1483
|
-
for (const name of
|
|
1486
|
+
const names4 = skillNames(spec.root);
|
|
1487
|
+
const outputs = opencodeSkillOutputs(spec, names4);
|
|
1488
|
+
for (const name of names4) {
|
|
1484
1489
|
const target = `../../.agents/skills/${name}`;
|
|
1485
1490
|
if (spec.tools.has("claude")) {
|
|
1486
1491
|
outputs.push({ kind: "link", path: `.claude/skills/${name}`, target });
|
|
@@ -1694,11 +1699,11 @@ function checkBudget(spec, settings) {
|
|
|
1694
1699
|
}
|
|
1695
1700
|
const tracked = settings.packageBytes !== void 0 || settings.forbidPaths.length > 0 ? trackedFiles(spec.root) : [];
|
|
1696
1701
|
if (settings.packageBytes !== void 0) {
|
|
1697
|
-
const
|
|
1702
|
+
const names4 = new Set(
|
|
1698
1703
|
["AGENTS.md", spec.packageRules?.file].filter(Boolean)
|
|
1699
1704
|
);
|
|
1700
1705
|
for (const file of tracked) {
|
|
1701
|
-
if (!file.includes("/") || !
|
|
1706
|
+
if (!file.includes("/") || !names4.has(basename(file))) continue;
|
|
1702
1707
|
const path = join7(spec.root, file);
|
|
1703
1708
|
if (regularFile(path))
|
|
1704
1709
|
row("package_bytes", file, measure(path).bytes, settings.packageBytes);
|
|
@@ -3781,9 +3786,15 @@ function argvList(value, where) {
|
|
|
3781
3786
|
function startsWith(argv, prefix) {
|
|
3782
3787
|
if (argv.length < prefix.length) return false;
|
|
3783
3788
|
return prefix.every(
|
|
3784
|
-
(word, at) => at === 0 ? program(argv[0]) === word : argv[at]
|
|
3789
|
+
(word, at) => at === 0 ? program(argv[0]) === word : argWord(argv[at], word)
|
|
3785
3790
|
);
|
|
3786
3791
|
}
|
|
3792
|
+
var SCRIPT = /(?:\/|\.[A-Za-z0-9]{1,8}$)/u;
|
|
3793
|
+
function argWord(arg, word) {
|
|
3794
|
+
if (arg === void 0) return false;
|
|
3795
|
+
if (arg === word) return true;
|
|
3796
|
+
return SCRIPT.test(word) && arg.endsWith(`/${word.replace(/^\.\//u, "")}`);
|
|
3797
|
+
}
|
|
3787
3798
|
function blocked(steps, rule) {
|
|
3788
3799
|
return realSteps(steps).some(
|
|
3789
3800
|
(step) => rule.blocks.some((prefix) => startsWith(step.argv, prefix))
|
|
@@ -4779,8 +4790,8 @@ function claimants(store, session, root) {
|
|
|
4779
4790
|
(record) => record.live && record.session !== session && record.worktree === root
|
|
4780
4791
|
).map((record) => record.alias || record.session.slice(0, 8));
|
|
4781
4792
|
}
|
|
4782
|
-
function claimantNotice(root,
|
|
4783
|
-
return `Another live session works in ${root}: ${
|
|
4793
|
+
function claimantNotice(root, names4) {
|
|
4794
|
+
return `Another live session works in ${root}: ${names4.join(", ")}. Edit only files that are yours, and name every path when you commit.`;
|
|
4784
4795
|
}
|
|
4785
4796
|
|
|
4786
4797
|
// src/hooks/policies/workspace/leftovers.ts
|
|
@@ -5153,6 +5164,47 @@ var worktreeSync = {
|
|
|
5153
5164
|
}
|
|
5154
5165
|
};
|
|
5155
5166
|
|
|
5167
|
+
// src/hooks/policies/host/lease.ts
|
|
5168
|
+
function argvList2(value) {
|
|
5169
|
+
const valid = Array.isArray(value) && value.every(
|
|
5170
|
+
(item) => Array.isArray(item) && item.length > 0 && item.every((word) => typeof word === "string" && word !== "")
|
|
5171
|
+
);
|
|
5172
|
+
if (!valid) throw new Error("heavy must be a list of argv prefixes");
|
|
5173
|
+
return value;
|
|
5174
|
+
}
|
|
5175
|
+
function names3(value) {
|
|
5176
|
+
if (value === void 0) return [];
|
|
5177
|
+
if (!Array.isArray(value) || !value.every((v) => typeof v === "string"))
|
|
5178
|
+
throw new Error("skip_env must be a list of names");
|
|
5179
|
+
return value;
|
|
5180
|
+
}
|
|
5181
|
+
var hostLease = {
|
|
5182
|
+
id: "host.lease",
|
|
5183
|
+
events: ["before_tool"],
|
|
5184
|
+
tools: ["shell"],
|
|
5185
|
+
fail: "open",
|
|
5186
|
+
defaultMode: "observe",
|
|
5187
|
+
options(raw) {
|
|
5188
|
+
onlyKeys(raw, ["heavy", "skip_env"]);
|
|
5189
|
+
return { heavy: argvList2(raw["heavy"]), skipEnv: names3(raw["skip_env"]) };
|
|
5190
|
+
},
|
|
5191
|
+
evaluate(input, ctx) {
|
|
5192
|
+
const call = shellCall(input);
|
|
5193
|
+
if (!call) return pass;
|
|
5194
|
+
for (const step of realSteps(call.steps)) {
|
|
5195
|
+
if (!ctx.options.heavy.some((prefix) => startsWith(step.argv, prefix)))
|
|
5196
|
+
continue;
|
|
5197
|
+
if (step.assigned.some((name) => ctx.options.skipEnv.includes(name)))
|
|
5198
|
+
continue;
|
|
5199
|
+
return {
|
|
5200
|
+
verdict: "deny",
|
|
5201
|
+
reason: `${step.argv.join(" ")} is a heavy command ([host.lease] heavy) and runs outside the host lease. Run it as: pmcp heavy -- ${step.argv.join(" ")}`
|
|
5202
|
+
};
|
|
5203
|
+
}
|
|
5204
|
+
return pass;
|
|
5205
|
+
}
|
|
5206
|
+
};
|
|
5207
|
+
|
|
5156
5208
|
// src/hooks/policies/custom.ts
|
|
5157
5209
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
5158
5210
|
import { createHash as createHash5 } from "crypto";
|
|
@@ -5353,7 +5405,8 @@ var FEATURES = byId([
|
|
|
5353
5405
|
roles,
|
|
5354
5406
|
sharedCheckout,
|
|
5355
5407
|
worktreeSync,
|
|
5356
|
-
mainlineDeliver
|
|
5408
|
+
mainlineDeliver,
|
|
5409
|
+
hostLease
|
|
5357
5410
|
]);
|
|
5358
5411
|
var POLICIES = {
|
|
5359
5412
|
...FEATURES,
|
|
@@ -5561,7 +5614,7 @@ function readCustom(root, hooks, guards) {
|
|
|
5561
5614
|
[hooks["edit"], "after_edit"],
|
|
5562
5615
|
[guards["custom"], void 0]
|
|
5563
5616
|
];
|
|
5564
|
-
const
|
|
5617
|
+
const names4 = /* @__PURE__ */ new Set();
|
|
5565
5618
|
const found = [];
|
|
5566
5619
|
for (const [list2, implied] of sources) {
|
|
5567
5620
|
if (list2 === void 0) continue;
|
|
@@ -5569,9 +5622,9 @@ function readCustom(root, hooks, guards) {
|
|
|
5569
5622
|
throw new Error("custom guards must be arrays of tables");
|
|
5570
5623
|
for (const value of list2) {
|
|
5571
5624
|
const entry = readEntry(root, value, implied);
|
|
5572
|
-
if (
|
|
5625
|
+
if (names4.has(entry.name))
|
|
5573
5626
|
throw new Error("shell names must be unique lowercase names");
|
|
5574
|
-
|
|
5627
|
+
names4.add(entry.name);
|
|
5575
5628
|
if (entry.mode !== "off") found.push(entry);
|
|
5576
5629
|
}
|
|
5577
5630
|
}
|
|
@@ -5762,6 +5815,23 @@ function readHooksTable(table3, tools) {
|
|
|
5762
5815
|
};
|
|
5763
5816
|
}
|
|
5764
5817
|
|
|
5818
|
+
// src/hooks/compile/host-lease.ts
|
|
5819
|
+
function readHostLease(host, root) {
|
|
5820
|
+
if (host === void 0) return null;
|
|
5821
|
+
const settings = readLeaseSettings("pmcp.toml", root, host);
|
|
5822
|
+
if (!settings.enabled || settings.guard === "off") return null;
|
|
5823
|
+
if (settings.heavy.length === 0) return null;
|
|
5824
|
+
const options2 = {
|
|
5825
|
+
heavy: settings.heavy,
|
|
5826
|
+
skip_env: [
|
|
5827
|
+
DISABLE_ENV,
|
|
5828
|
+
...settings.legacySkipEnv ? [settings.legacySkipEnv] : []
|
|
5829
|
+
]
|
|
5830
|
+
};
|
|
5831
|
+
FEATURES["host.lease"].options(options2);
|
|
5832
|
+
return { id: "host.lease", mode: settings.guard, options: options2 };
|
|
5833
|
+
}
|
|
5834
|
+
|
|
5765
5835
|
// src/hooks/compile/sessions.ts
|
|
5766
5836
|
var KEYS5 = [
|
|
5767
5837
|
"store",
|
|
@@ -5959,7 +6029,7 @@ function readMainlineDeliver(tables, root) {
|
|
|
5959
6029
|
|
|
5960
6030
|
// src/hooks/compile.ts
|
|
5961
6031
|
function hostGuard(host, guards) {
|
|
5962
|
-
if (host
|
|
6032
|
+
if (!declaresPtyHost(host)) return null;
|
|
5963
6033
|
const shell = asTable(guards["shell"], "[hooks.guards.shell]");
|
|
5964
6034
|
if (shell["host_approval"] !== void 0) return null;
|
|
5965
6035
|
return { id: "shell.host_approval", mode: "deny", options: {} };
|
|
@@ -5974,7 +6044,8 @@ function compileHooks(tables, options2) {
|
|
|
5974
6044
|
const deskSync = readWorktreeSync(tables, options2.root);
|
|
5975
6045
|
const directPush = readMainlineDeliver(tables, options2.root);
|
|
5976
6046
|
const host = hostGuard(tables.host, guardsTable);
|
|
5977
|
-
const
|
|
6047
|
+
const heavy = readHostLease(tables.host, options2.root);
|
|
6048
|
+
const enabled = table3.enabled || host !== null || heavy !== null || sessions.declared || workspace.declared || !!deskSync || !!directPush;
|
|
5978
6049
|
const legacy = legacyEntries(entries, enabled, table3.targets);
|
|
5979
6050
|
if (!enabled)
|
|
5980
6051
|
return {
|
|
@@ -5991,6 +6062,7 @@ function compileHooks(tables, options2) {
|
|
|
5991
6062
|
...deskSync ? [deskSync] : [],
|
|
5992
6063
|
...directPush ? [directPush] : [],
|
|
5993
6064
|
...host ? [host] : [],
|
|
6065
|
+
...heavy ? [heavy] : [],
|
|
5994
6066
|
...readGuards(guardsTable),
|
|
5995
6067
|
...readChecks(hooks["checks"])
|
|
5996
6068
|
];
|
|
@@ -6295,4 +6367,4 @@ export {
|
|
|
6295
6367
|
checkBudget,
|
|
6296
6368
|
readSpec
|
|
6297
6369
|
};
|
|
6298
|
-
//# sourceMappingURL=chunk-
|
|
6370
|
+
//# sourceMappingURL=chunk-K2VU3B4W.js.map
|
|
@@ -5,11 +5,13 @@ import {
|
|
|
5
5
|
} from "./chunk-HQOB7OQS.js";
|
|
6
6
|
import {
|
|
7
7
|
readStoreSettings
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-3V37OZQH.js";
|
|
9
9
|
import {
|
|
10
|
-
expandPath,
|
|
11
10
|
projectStateDir
|
|
12
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-FQLCD4HU.js";
|
|
12
|
+
import {
|
|
13
|
+
expandPath
|
|
14
|
+
} from "./chunk-GUHOEIHP.js";
|
|
13
15
|
|
|
14
16
|
// src/logging/sinks/file.ts
|
|
15
17
|
import {
|
|
@@ -152,4 +154,4 @@ export {
|
|
|
152
154
|
tail,
|
|
153
155
|
logLocation
|
|
154
156
|
};
|
|
155
|
-
//# sourceMappingURL=chunk-
|
|
157
|
+
//# sourceMappingURL=chunk-MHKY6TNF.js.map
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// src/lease/files.ts
|
|
2
|
+
import { spawnSync } from "child_process";
|
|
3
|
+
import {
|
|
4
|
+
appendFileSync,
|
|
5
|
+
existsSync,
|
|
6
|
+
mkdirSync,
|
|
7
|
+
readFileSync,
|
|
8
|
+
readdirSync,
|
|
9
|
+
renameSync,
|
|
10
|
+
rmSync,
|
|
11
|
+
writeFileSync
|
|
12
|
+
} from "fs";
|
|
13
|
+
import { join } from "path";
|
|
14
|
+
var LANES = [
|
|
15
|
+
"gate",
|
|
16
|
+
"hook",
|
|
17
|
+
"interactive",
|
|
18
|
+
"bulk"
|
|
19
|
+
];
|
|
20
|
+
function leasePaths(dir) {
|
|
21
|
+
return {
|
|
22
|
+
dir,
|
|
23
|
+
lock: join(dir, "heavy.lock"),
|
|
24
|
+
admit: join(dir, "admit.lock"),
|
|
25
|
+
holder: join(dir, "heavy.holder"),
|
|
26
|
+
waiters: join(dir, "waiters"),
|
|
27
|
+
running: join(dir, "running"),
|
|
28
|
+
settled: join(dir, "heavy.settled"),
|
|
29
|
+
log: join(dir, "heavy.log"),
|
|
30
|
+
usage: join(dir, "usage.jsonl"),
|
|
31
|
+
released: join(dir, "heavy.released")
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function nowUtc() {
|
|
35
|
+
return (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d{3}Z$/u, "Z");
|
|
36
|
+
}
|
|
37
|
+
function epoch() {
|
|
38
|
+
return Math.floor(Date.now() / 1e3);
|
|
39
|
+
}
|
|
40
|
+
function newId() {
|
|
41
|
+
const random = Math.floor(Math.random() * 16777215).toString(16).padStart(6, "0");
|
|
42
|
+
return `${epoch()}-${random}`;
|
|
43
|
+
}
|
|
44
|
+
function oneLine(text) {
|
|
45
|
+
return text.replace(/[\n\t]/gu, " ").slice(0, 200);
|
|
46
|
+
}
|
|
47
|
+
function writeRecord(file, pid, fields) {
|
|
48
|
+
const temporary = `${file}.tmp.${pid}`;
|
|
49
|
+
const lines = [
|
|
50
|
+
`pid=${pid}`,
|
|
51
|
+
`since=${fields.since ?? epoch()}`,
|
|
52
|
+
`started=${fields.started ?? nowUtc()}`,
|
|
53
|
+
`cwd=${fields.cwd}`,
|
|
54
|
+
`label=${fields.label}`,
|
|
55
|
+
`lane=${fields.lane}`,
|
|
56
|
+
`weight=${fields.weight}`,
|
|
57
|
+
`queued=${fields.queued ?? Date.now()}`,
|
|
58
|
+
`session=${fields.session}`,
|
|
59
|
+
...fields.bypass ? [`bypass=${fields.bypass}`] : [],
|
|
60
|
+
...fields.grace ? ["grace=1"] : [],
|
|
61
|
+
...fields.id ? [`id=${fields.id}`] : [],
|
|
62
|
+
...fields.promote ? [`promote=${fields.promote}`] : [],
|
|
63
|
+
...fields.cancel ? [`cancel=${fields.cancel}`] : []
|
|
64
|
+
];
|
|
65
|
+
writeFileSync(temporary, `${lines.join("\n")}
|
|
66
|
+
`);
|
|
67
|
+
renameSync(temporary, file);
|
|
68
|
+
}
|
|
69
|
+
function readRecord(file) {
|
|
70
|
+
let text;
|
|
71
|
+
try {
|
|
72
|
+
text = readFileSync(file, "utf8");
|
|
73
|
+
} catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
const field = (name) => text.split("\n").find((line) => line.startsWith(`${name}=`))?.slice(name.length + 1) ?? "";
|
|
77
|
+
const pid = Number(field("pid"));
|
|
78
|
+
if (!Number.isInteger(pid) || pid <= 0) return null;
|
|
79
|
+
const since = Number(field("since")) || epoch();
|
|
80
|
+
const lane = field("lane");
|
|
81
|
+
return {
|
|
82
|
+
pid,
|
|
83
|
+
since,
|
|
84
|
+
started: field("started"),
|
|
85
|
+
cwd: field("cwd"),
|
|
86
|
+
label: field("label"),
|
|
87
|
+
lane: LANES.includes(lane) ? lane : "interactive",
|
|
88
|
+
weight: Number(field("weight")) || 1,
|
|
89
|
+
queued: Number(field("queued")) || since * 1e3,
|
|
90
|
+
session: field("session"),
|
|
91
|
+
bypass: field("bypass"),
|
|
92
|
+
grace: field("grace") === "1",
|
|
93
|
+
id: field("id"),
|
|
94
|
+
promote: field("promote"),
|
|
95
|
+
cancel: field("cancel")
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function removeRecord(file, pid) {
|
|
99
|
+
if (readRecord(file)?.pid === pid) rmSync(file, { force: true });
|
|
100
|
+
}
|
|
101
|
+
function pidAlive(pid) {
|
|
102
|
+
try {
|
|
103
|
+
process.kill(pid, 0);
|
|
104
|
+
return true;
|
|
105
|
+
} catch (error) {
|
|
106
|
+
return error.code === "EPERM";
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function leaseHeld(paths) {
|
|
110
|
+
if (!existsSync(paths.lock)) return false;
|
|
111
|
+
return spawnSync("flock", ["-n", paths.lock, "true"]).status !== 0;
|
|
112
|
+
}
|
|
113
|
+
function logEvent(paths, pid, event, detail) {
|
|
114
|
+
try {
|
|
115
|
+
mkdirSync(paths.dir, { recursive: true });
|
|
116
|
+
appendFileSync(paths.log, `${nowUtc()} ${pid} ${event} ${detail}
|
|
117
|
+
`);
|
|
118
|
+
} catch {
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function liveRecords(dir, prune = true) {
|
|
122
|
+
let names;
|
|
123
|
+
try {
|
|
124
|
+
names = readdirSync(dir);
|
|
125
|
+
} catch {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
const found = [];
|
|
129
|
+
for (const name of names) {
|
|
130
|
+
if (name.includes(".tmp.")) continue;
|
|
131
|
+
const file = join(dir, name);
|
|
132
|
+
const record = readRecord(file);
|
|
133
|
+
if (record === null || !pidAlive(record.pid)) {
|
|
134
|
+
if (prune) rmSync(file, { force: true });
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
found.push(record);
|
|
138
|
+
}
|
|
139
|
+
const rank = (record) => LANES.indexOf(record.lane);
|
|
140
|
+
return found.sort(
|
|
141
|
+
(a, b) => rank(a) - rank(b) || a.queued - b.queued || a.pid - b.pid
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
function liveWaiters(paths) {
|
|
145
|
+
return liveRecords(paths.waiters);
|
|
146
|
+
}
|
|
147
|
+
function describeRecord(record) {
|
|
148
|
+
if (record === null) return "an unrecorded process";
|
|
149
|
+
if (!pidAlive(record.pid))
|
|
150
|
+
return `a new holder (last record: pid ${record.pid} ${record.label}, gone)`;
|
|
151
|
+
return `pid ${record.pid} ${record.label} (cwd ${record.cwd}, ${epoch() - record.since}s)`;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export {
|
|
155
|
+
LANES,
|
|
156
|
+
leasePaths,
|
|
157
|
+
nowUtc,
|
|
158
|
+
epoch,
|
|
159
|
+
newId,
|
|
160
|
+
oneLine,
|
|
161
|
+
writeRecord,
|
|
162
|
+
readRecord,
|
|
163
|
+
removeRecord,
|
|
164
|
+
pidAlive,
|
|
165
|
+
leaseHeld,
|
|
166
|
+
logEvent,
|
|
167
|
+
liveRecords,
|
|
168
|
+
liveWaiters,
|
|
169
|
+
describeRecord
|
|
170
|
+
};
|
|
171
|
+
//# sourceMappingURL=chunk-N7ANFMA5.js.map
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
nativeBinary,
|
|
9
9
|
ptyBinary
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-733WVP2R.js";
|
|
11
11
|
|
|
12
12
|
// src/tui/rust.ts
|
|
13
13
|
import { spawn } from "child_process";
|
|
@@ -62,4 +62,4 @@ export {
|
|
|
62
62
|
runTui,
|
|
63
63
|
dependencies
|
|
64
64
|
};
|
|
65
|
-
//# sourceMappingURL=chunk-
|
|
65
|
+
//# sourceMappingURL=chunk-NNGGNXF2.js.map
|
|
@@ -5,11 +5,18 @@ import {
|
|
|
5
5
|
readStoreSettings,
|
|
6
6
|
resolveLeaseFiles,
|
|
7
7
|
resolvePauseFile
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-3V37OZQH.js";
|
|
9
|
+
import {
|
|
10
|
+
Reader,
|
|
11
|
+
child,
|
|
12
|
+
table
|
|
13
|
+
} from "./chunk-T6C3TSTO.js";
|
|
9
14
|
import {
|
|
10
|
-
expandPath,
|
|
11
15
|
projectStateDir
|
|
12
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FQLCD4HU.js";
|
|
17
|
+
import {
|
|
18
|
+
expandPath
|
|
19
|
+
} from "./chunk-GUHOEIHP.js";
|
|
13
20
|
import {
|
|
14
21
|
ConfigError,
|
|
15
22
|
findConfig,
|
|
@@ -19,95 +26,6 @@ import {
|
|
|
19
26
|
// src/git/setup.ts
|
|
20
27
|
import { dirname, join, resolve } from "path";
|
|
21
28
|
|
|
22
|
-
// src/git/config/reader.ts
|
|
23
|
-
var Reader = class {
|
|
24
|
-
constructor(path, name, table2, keys) {
|
|
25
|
-
this.path = path;
|
|
26
|
-
this.name = name;
|
|
27
|
-
this.table = table2;
|
|
28
|
-
for (const key of Object.keys(table2)) {
|
|
29
|
-
if (!keys.includes(key))
|
|
30
|
-
throw new ConfigError(path, `unknown key [${name}] ${key}`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
path;
|
|
34
|
-
name;
|
|
35
|
-
table;
|
|
36
|
-
fail(key, expected) {
|
|
37
|
-
throw new ConfigError(
|
|
38
|
-
this.path,
|
|
39
|
-
`[${this.name}] ${key} must be ${expected}`
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
string(key) {
|
|
43
|
-
const value = this.table[key];
|
|
44
|
-
if (value === void 0) return void 0;
|
|
45
|
-
if (typeof value !== "string" || !value.trim())
|
|
46
|
-
this.fail(key, "a non-empty string");
|
|
47
|
-
return value;
|
|
48
|
-
}
|
|
49
|
-
envName(key) {
|
|
50
|
-
const value = this.string(key);
|
|
51
|
-
if (value !== void 0 && !/^[A-Z_][A-Z0-9_]{0,127}$/u.test(value))
|
|
52
|
-
this.fail(key, "an environment variable name (A-Z, 0-9, _)");
|
|
53
|
-
return value;
|
|
54
|
-
}
|
|
55
|
-
oneOf(key, values, fallback) {
|
|
56
|
-
const value = this.table[key] ?? fallback;
|
|
57
|
-
if (!values.includes(value)) this.fail(key, values.join(" | "));
|
|
58
|
-
return value;
|
|
59
|
-
}
|
|
60
|
-
bool(key, fallback) {
|
|
61
|
-
const value = this.table[key] ?? fallback;
|
|
62
|
-
if (typeof value !== "boolean") this.fail(key, "a boolean");
|
|
63
|
-
return value;
|
|
64
|
-
}
|
|
65
|
-
int(key, fallback) {
|
|
66
|
-
const value = this.table[key] ?? fallback;
|
|
67
|
-
if (!Number.isInteger(value) || value < 1)
|
|
68
|
-
this.fail(key, "a positive integer");
|
|
69
|
-
return value;
|
|
70
|
-
}
|
|
71
|
-
positive(key) {
|
|
72
|
-
const value = this.table[key];
|
|
73
|
-
if (value === void 0) return void 0;
|
|
74
|
-
if (typeof value !== "number" || !(value > 0))
|
|
75
|
-
this.fail(key, "a positive number");
|
|
76
|
-
return value;
|
|
77
|
-
}
|
|
78
|
-
list(key) {
|
|
79
|
-
const value = this.table[key] ?? [];
|
|
80
|
-
if (!Array.isArray(value) || !value.every((v) => typeof v === "string"))
|
|
81
|
-
this.fail(key, "a list of strings");
|
|
82
|
-
return value;
|
|
83
|
-
}
|
|
84
|
-
argv(key) {
|
|
85
|
-
const value = this.list(key);
|
|
86
|
-
if (value.length === 0) return void 0;
|
|
87
|
-
return value;
|
|
88
|
-
}
|
|
89
|
-
// A table of environment variable names to string values.
|
|
90
|
-
envMap(key) {
|
|
91
|
-
const value = this.table[key] ?? {};
|
|
92
|
-
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
93
|
-
this.fail(key, "a table of variable names to strings");
|
|
94
|
-
for (const [name, text] of Object.entries(value)) {
|
|
95
|
-
if (!/^[A-Z_][A-Z0-9_]{0,127}$/u.test(name) || typeof text !== "string")
|
|
96
|
-
this.fail(key, "a table of variable names (A-Z, 0-9, _) to strings");
|
|
97
|
-
}
|
|
98
|
-
return value;
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
function table(path, name, value) {
|
|
102
|
-
if (value === void 0) return void 0;
|
|
103
|
-
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
104
|
-
throw new ConfigError(path, `[${name}] must be a table`);
|
|
105
|
-
return value;
|
|
106
|
-
}
|
|
107
|
-
function child(path, parent, name, key) {
|
|
108
|
-
return table(path, `${name}.${key}`, parent?.[key]);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
29
|
// src/git/config/tables.ts
|
|
112
30
|
import { isAbsolute } from "path";
|
|
113
31
|
function worktrees(path, source) {
|
|
@@ -308,7 +226,8 @@ function readGitConfig(config) {
|
|
|
308
226
|
"worktrees",
|
|
309
227
|
"shared_checkout",
|
|
310
228
|
"submodules",
|
|
311
|
-
"umask"
|
|
229
|
+
"umask",
|
|
230
|
+
"affected"
|
|
312
231
|
]);
|
|
313
232
|
const worktreeTable = child(path, root, "git", "worktrees");
|
|
314
233
|
const named = typeof root["mainline"] === "string";
|
|
@@ -392,4 +311,4 @@ export {
|
|
|
392
311
|
gateTreePath,
|
|
393
312
|
leaseSpecs
|
|
394
313
|
};
|
|
395
|
-
//# sourceMappingURL=chunk-
|
|
314
|
+
//# sourceMappingURL=chunk-P5D6RKMT.js.map
|