@modootoday/pmcp 0.18.4 → 0.19.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/.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/{apply-75UWIUVQ.js → apply-IPTASVRS.js} +16 -17
- package/dist/{broadcast-CBMVOV3G.js → broadcast-56NPEJWM.js} +3 -4
- package/dist/{chunk-ARA4VDHD.js → chunk-2DAC45ZT.js} +2 -2
- package/dist/{chunk-JS5RTH4I.js → chunk-2Q6MNGU5.js} +2 -2
- package/dist/{chunk-ZWLUH3F2.js → chunk-2W6CEJD7.js} +2 -2
- package/dist/{chunk-YRGDWUFY.js → chunk-3BLHIEAK.js} +2 -2
- package/dist/{chunk-R26RWSFW.js → chunk-3CLLHFP7.js} +2 -2
- package/dist/{chunk-HE2C2S5A.js → chunk-3H5FZCKX.js} +3 -3
- package/dist/{chunk-TFRJ5QOS.js → chunk-7FAA32PB.js} +3 -3
- package/dist/{chunk-DCU2EXQV.js → chunk-D5D3V6RU.js} +4 -4
- package/dist/{chunk-LTZH5E3G.js → chunk-DHAPQUEF.js} +235 -30
- package/dist/{chunk-LBXO4VPG.js → chunk-E4FJOLPJ.js} +6 -3
- package/dist/{chunk-OPYFEHKG.js → chunk-G7JONWL4.js} +29 -1
- package/dist/{chunk-4JUSGIMX.js → chunk-G7NN23YK.js} +2 -2
- package/dist/chunk-GPSOPGJA.js +7 -0
- package/dist/{chunk-LGO2SZAS.js → chunk-IKJOXDCF.js} +2 -2
- package/dist/{chunk-QEW4J3IZ.js → chunk-ISNRDHSD.js} +2 -2
- package/dist/{chunk-S3PIAMXV.js → chunk-J5XQW2CM.js} +68 -8
- package/dist/{chunk-LFR245MZ.js → chunk-JAICIL6H.js} +5 -5
- package/dist/{chunk-GZHHEHKY.js → chunk-JJBSYUSQ.js} +19 -7
- package/dist/{chunk-YSUINA5Q.js → chunk-MB72PZH7.js} +8 -8
- package/dist/{chunk-3CA3NNVH.js → chunk-MFPQDXUQ.js} +5 -5
- package/dist/{chunk-VQ2HEGWH.js → chunk-OKW7VKNQ.js} +2 -2
- package/dist/{chunk-6UXJ62XJ.js → chunk-OWW5VY4D.js} +3 -3
- package/dist/{chunk-OB3P5RMN.js → chunk-U2FPMGEM.js} +2 -2
- package/dist/{chunk-XELAZAIM.js → chunk-UD3BEEBQ.js} +54 -12
- package/dist/{chunk-EAWPJHJ7.js → chunk-UGODVKBJ.js} +2 -2
- package/dist/{chunk-MSOZPOPX.js → chunk-UOLV2AWA.js} +7 -3
- package/dist/{chunk-FBIDDE3N.js → chunk-XKGS2FNF.js} +71 -51
- package/dist/{chunk-XMXBE5IQ.js → chunk-XS2QM6AT.js} +5 -5
- package/dist/{chunk-45Y3KZ3Q.js → chunk-Y65MO2SS.js} +87 -20
- package/dist/{chunk-DAR6RGRN.js → chunk-YTSJRA4Z.js} +2 -2
- package/dist/{chunk-QBJC4DRP.js → chunk-ZYMJV7YX.js} +14 -14
- package/dist/{cli-ZN7ZVDEZ.js → cli-MUP2NSXT.js} +10 -9
- package/dist/{cli-MI4ZCAZ3.js → cli-T5LHBUY2.js} +8 -8
- package/dist/cli.js +3 -3
- package/dist/{completion-WYJAKJE4.js → completion-ZY5P443T.js} +2 -2
- package/dist/{diagnostics-ADIVFSBW.js → diagnostics-KUNS6LCZ.js} +12 -12
- package/dist/{doctor-BBCS4DF5.js → doctor-UH7KEOSO.js} +18 -19
- package/dist/{entry-DMOTX4SS.js → entry-DOUDMRO2.js} +10 -10
- package/dist/{exec-mcp-OBUM3DVW.js → exec-mcp-TGW6FXGC.js} +13 -14
- package/dist/{harness-6AUE3I4Q.js → harness-7HC6UR2D.js} +3 -3
- package/dist/harness-launch-gate.js +4 -4
- package/dist/harness-worker.js +6 -6
- package/dist/hook-body.js +446 -278
- package/dist/{hook-spec-C5fWTSCH.d.ts → hook-spec-0aGt29Pg.d.ts} +22 -2
- package/dist/{hooks-HLPQPVRY.js → hooks-L2MKB75Z.js} +3 -3
- package/dist/{host-5Q3X6OY7.js → host-OAQZTYII.js} +15 -16
- package/dist/{host-LGSWU3PJ.js → host-QSBXKTWT.js} +7 -7
- package/dist/{host-run-4NMQQASQ.js → host-run-HFOADX32.js} +10 -6
- package/dist/http.js +1 -1
- package/dist/{import-mcp-WU7TO2RT.js → import-mcp-BCYXJAIU.js} +11 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -18
- package/dist/{init-XA6XXLGA.js → init-NVJVNZOD.js} +2 -2
- package/dist/{invoke-CYQZYU5T.js → invoke-KVTEPXSC.js} +8 -8
- package/dist/{list-FNGXY5D7.js → list-2VRPMASP.js} +13 -14
- package/dist/{logout-N753FBZP.js → logout-6T5ZDLHQ.js} +12 -13
- package/dist/{logs-TBUA4UWU.js → logs-H3RPKNTE.js} +3 -4
- package/dist/{mailbox-BMTZOSZ7.js → mailbox-O3MX6QPF.js} +3 -4
- package/dist/{mainline-KAD2ERLP.js → mainline-DG75NLBS.js} +306 -57
- package/dist/{mcp-GR4VXKTG.js → mcp-7UKG5TD3.js} +2 -2
- package/dist/{pause-7LILUVGL.js → pause-2HQ7CKMR.js} +3 -4
- package/dist/project/hook-adapter.d.ts +1 -1
- package/dist/{project-OEBACWEX.js → project-BPKQOSKQ.js} +4 -4
- package/dist/{resume-26VFAAMH.js → resume-ETFTR5V3.js} +3 -4
- package/dist/{run-MDRUOEFL.js → run-5JD62E7R.js} +11 -12
- package/dist/{run-7XNGPU2I.js → run-WGIRM6Z7.js} +4 -4
- package/dist/{serve-HXHNWKEK.js → serve-J575WVIU.js} +3 -3
- package/dist/setup-T6T2PFC4.js +20 -0
- package/dist/{start-login-PWCEKNED.js → start-login-2AYCHWLV.js} +12 -13
- package/dist/{status-QFOBQ42J.js → status-2YWTJOMH.js} +20 -27
- package/dist/{status-54IYX2FN.js → status-425ZKIE6.js} +12 -13
- package/dist/{status-RO55QPKV.js → status-GPSLH4VO.js} +3 -4
- package/dist/stdio.js +2 -2
- package/dist/{sweep-35LGQTTO.js → sweep-VY2TNOO5.js} +3 -4
- package/dist/{test-36ZUVALT.js → test-XBLZOX52.js} +50 -15
- package/dist/{tui-CSRW4DN2.js → tui-WNVBHP65.js} +4 -4
- package/dist/{unbroadcast-5QNGAJR2.js → unbroadcast-RKTBP57G.js} +3 -4
- package/dist/{worker-EODWT4KK.js → worker-CGF3UIJE.js} +8 -8
- package/dist/{worktree-create-PZSRB7PH.js → worktree-create-NO4UOOEP.js} +2 -2
- package/dist/{worktree-list-JYB6VXLW.js → worktree-list-NEIDD66X.js} +4 -4
- package/dist/{worktree-sync-UF5CXPWV.js → worktree-sync-W4BDDLRO.js} +8 -9
- package/docs/commands.md +1 -1
- package/docs/git-workflow.md +58 -1
- package/docs/hooks.md +29 -0
- package/docs/project-configuration.md +7 -7
- 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-26WLNWDG.js +0 -93
- package/dist/chunk-MZCRCMEY.js +0 -7
- package/dist/setup-DTKZLZUT.js +0 -18
|
@@ -612,7 +612,7 @@
|
|
|
612
612
|
},
|
|
613
613
|
{
|
|
614
614
|
"name": "pmcp",
|
|
615
|
-
"version": "0.
|
|
615
|
+
"version": "0.19.1",
|
|
616
616
|
"description": "Find package skills and use native runtime project configuration.",
|
|
617
617
|
"source": { "source": "local", "path": "./plugins/pmcp" },
|
|
618
618
|
"policy": { "installation": "AVAILABLE", "authentication": "ON_USE" },
|
package/.mcp.json
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
2
|
specFrom
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OKW7VKNQ.js";
|
|
4
4
|
import {
|
|
5
5
|
catalogFrom
|
|
6
6
|
} from "./chunk-HEBCQTOD.js";
|
|
7
7
|
import "./chunk-7DLZC73N.js";
|
|
8
8
|
import {
|
|
9
9
|
project
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MFPQDXUQ.js";
|
|
11
11
|
import "./chunk-P4N7DBD5.js";
|
|
12
12
|
import {
|
|
13
13
|
renderFrontmatter,
|
|
14
14
|
splitFrontmatter
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-JAICIL6H.js";
|
|
16
|
+
import "./chunk-3CLLHFP7.js";
|
|
17
17
|
import {
|
|
18
18
|
RUNTIMES
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-Y65MO2SS.js";
|
|
20
20
|
import "./chunk-HQOB7OQS.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-J5XQW2CM.js";
|
|
22
|
+
import "./chunk-2Q6MNGU5.js";
|
|
23
|
+
import "./chunk-D5D3V6RU.js";
|
|
24
|
+
import "./chunk-UD3BEEBQ.js";
|
|
25
|
+
import "./chunk-ISNRDHSD.js";
|
|
26
|
+
import "./chunk-G7JONWL4.js";
|
|
27
27
|
import "./chunk-EATCUWGG.js";
|
|
28
28
|
import {
|
|
29
29
|
ProjectError
|
|
30
30
|
} from "./chunk-NRBQK6UX.js";
|
|
31
31
|
import "./chunk-3PW4FI7U.js";
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import "./chunk-LTZH5E3G.js";
|
|
32
|
+
import "./chunk-DHAPQUEF.js";
|
|
34
33
|
import "./chunk-C4NHQGHL.js";
|
|
35
34
|
import "./chunk-Q5H3L6Y4.js";
|
|
36
35
|
import "./chunk-73AKO4UL.js";
|
|
@@ -41,13 +40,13 @@ import {
|
|
|
41
40
|
kindOf
|
|
42
41
|
} from "./chunk-4CRRLDDS.js";
|
|
43
42
|
import "./chunk-YSAWTGNA.js";
|
|
44
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-UOLV2AWA.js";
|
|
45
44
|
import {
|
|
46
45
|
recordProjector
|
|
47
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-XKGS2FNF.js";
|
|
48
47
|
import "./chunk-OEH47H6A.js";
|
|
49
48
|
import "./chunk-IJBSOWHK.js";
|
|
50
|
-
import "./chunk-
|
|
49
|
+
import "./chunk-GPSOPGJA.js";
|
|
51
50
|
import "./chunk-QPL7E2HW.js";
|
|
52
51
|
import "./chunk-PMJG2CXF.js";
|
|
53
52
|
import "./chunk-J6KL3COD.js";
|
|
@@ -240,4 +239,4 @@ export {
|
|
|
240
239
|
projectOrCheck,
|
|
241
240
|
removeAndProject
|
|
242
241
|
};
|
|
243
|
-
//# sourceMappingURL=apply-
|
|
242
|
+
//# sourceMappingURL=apply-IPTASVRS.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
change
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-LTZH5E3G.js";
|
|
3
|
+
} from "./chunk-E4FJOLPJ.js";
|
|
4
|
+
import "./chunk-DHAPQUEF.js";
|
|
6
5
|
import "./chunk-C4NHQGHL.js";
|
|
7
6
|
import "./chunk-A4PKLESO.js";
|
|
8
7
|
import "./chunk-OEH47H6A.js";
|
|
@@ -15,4 +14,4 @@ var run = (context) => change(context, "broadcast");
|
|
|
15
14
|
export {
|
|
16
15
|
run
|
|
17
16
|
};
|
|
18
|
-
//# sourceMappingURL=broadcast-
|
|
17
|
+
//# sourceMappingURL=broadcast-56NPEJWM.js.map
|
|
@@ -1190,7 +1190,7 @@ function registerReadTool(server, tools) {
|
|
|
1190
1190
|
|
|
1191
1191
|
// src/mcp.ts
|
|
1192
1192
|
var SERVER_NAME = "pmcp";
|
|
1193
|
-
var SERVER_VERSION = "0.
|
|
1193
|
+
var SERVER_VERSION = "0.19.1";
|
|
1194
1194
|
function registerSkillTools(server, tools) {
|
|
1195
1195
|
registerCatalogTool(server, tools);
|
|
1196
1196
|
registerFindTool(server, tools);
|
|
@@ -1243,4 +1243,4 @@ export {
|
|
|
1243
1243
|
registerSkillTools,
|
|
1244
1244
|
createSkillServer
|
|
1245
1245
|
};
|
|
1246
|
-
//# sourceMappingURL=chunk-
|
|
1246
|
+
//# sourceMappingURL=chunk-2DAC45ZT.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
git,
|
|
3
3
|
gitText
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-G7JONWL4.js";
|
|
5
5
|
|
|
6
6
|
// src/git/detect.ts
|
|
7
7
|
import { createHash } from "crypto";
|
|
@@ -81,4 +81,4 @@ export {
|
|
|
81
81
|
detect,
|
|
82
82
|
listWorktrees
|
|
83
83
|
};
|
|
84
|
-
//# sourceMappingURL=chunk-
|
|
84
|
+
//# sourceMappingURL=chunk-2Q6MNGU5.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
POLICIES,
|
|
6
6
|
RUNTIMES,
|
|
7
7
|
customPolicy
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-Y65MO2SS.js";
|
|
9
9
|
|
|
10
10
|
// src/hooks/inspection/list.ts
|
|
11
11
|
function policyRows(compiled) {
|
|
@@ -39,4 +39,4 @@ function policyRows(compiled) {
|
|
|
39
39
|
export {
|
|
40
40
|
policyRows
|
|
41
41
|
};
|
|
42
|
-
//# sourceMappingURL=chunk-
|
|
42
|
+
//# sourceMappingURL=chunk-2W6CEJD7.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HOST_MANIFEST,
|
|
3
3
|
HOST_POLICY
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UOLV2AWA.js";
|
|
5
5
|
import {
|
|
6
6
|
projectStateDir
|
|
7
7
|
} from "./chunk-OEH47H6A.js";
|
|
@@ -99,4 +99,4 @@ export {
|
|
|
99
99
|
hostApprovalDoctor,
|
|
100
100
|
writeApproval
|
|
101
101
|
};
|
|
102
|
-
//# sourceMappingURL=chunk-
|
|
102
|
+
//# sourceMappingURL=chunk-3BLHIEAK.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
MARK,
|
|
3
3
|
blockOutput,
|
|
4
4
|
jsonOutput
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Y65MO2SS.js";
|
|
6
6
|
import {
|
|
7
7
|
ProjectError
|
|
8
8
|
} from "./chunk-NRBQK6UX.js";
|
|
@@ -393,4 +393,4 @@ export {
|
|
|
393
393
|
serversForTool,
|
|
394
394
|
mcpOutputs
|
|
395
395
|
};
|
|
396
|
-
//# sourceMappingURL=chunk-
|
|
396
|
+
//# sourceMappingURL=chunk-3CLLHFP7.js.map
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-34DECPVC.js";
|
|
7
7
|
import {
|
|
8
8
|
ptyBinary
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-UOLV2AWA.js";
|
|
10
10
|
import {
|
|
11
11
|
nativeBinary
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XKGS2FNF.js";
|
|
13
13
|
|
|
14
14
|
// src/tui/rust.ts
|
|
15
15
|
import { spawn } from "child_process";
|
|
@@ -64,4 +64,4 @@ export {
|
|
|
64
64
|
runTui,
|
|
65
65
|
dependencies
|
|
66
66
|
};
|
|
67
|
-
//# sourceMappingURL=chunk-
|
|
67
|
+
//# sourceMappingURL=chunk-3H5FZCKX.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assertNativeHost
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-G7NN23YK.js";
|
|
4
4
|
import {
|
|
5
5
|
locateExecutable
|
|
6
6
|
} from "./chunk-R2GPCZUX.js";
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
resourceClaim,
|
|
34
34
|
resourceRunning,
|
|
35
35
|
runtimeUnit
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-IKJOXDCF.js";
|
|
37
37
|
import {
|
|
38
38
|
command
|
|
39
39
|
} from "./chunk-34DECPVC.js";
|
|
@@ -1981,4 +1981,4 @@ export {
|
|
|
1981
1981
|
isReadOnly,
|
|
1982
1982
|
runOperation
|
|
1983
1983
|
};
|
|
1984
|
-
//# sourceMappingURL=chunk-
|
|
1984
|
+
//# sourceMappingURL=chunk-7FAA32PB.js.map
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
installIfStale,
|
|
3
3
|
movableSubmodules,
|
|
4
4
|
updateToPins
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UD3BEEBQ.js";
|
|
6
6
|
import {
|
|
7
7
|
cherry,
|
|
8
8
|
distance
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ISNRDHSD.js";
|
|
10
10
|
import {
|
|
11
11
|
git,
|
|
12
12
|
gitText
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-G7JONWL4.js";
|
|
14
14
|
|
|
15
15
|
// src/git/worktrees/sync.ts
|
|
16
16
|
function heldBy(root, upstream, ahead) {
|
|
@@ -75,4 +75,4 @@ function syncWorktree(options) {
|
|
|
75
75
|
export {
|
|
76
76
|
syncWorktree
|
|
77
77
|
};
|
|
78
|
-
//# sourceMappingURL=chunk-
|
|
78
|
+
//# sourceMappingURL=chunk-D5D3V6RU.js.map
|
|
@@ -9,6 +9,10 @@ import {
|
|
|
9
9
|
isLive,
|
|
10
10
|
leaseFile
|
|
11
11
|
} from "./chunk-C4NHQGHL.js";
|
|
12
|
+
import {
|
|
13
|
+
expandPath,
|
|
14
|
+
projectStateDir
|
|
15
|
+
} from "./chunk-OEH47H6A.js";
|
|
12
16
|
import {
|
|
13
17
|
checkoutOf
|
|
14
18
|
} from "./chunk-IJBSOWHK.js";
|
|
@@ -127,10 +131,10 @@ function filesBroadcast(dir, keep, registry) {
|
|
|
127
131
|
return {
|
|
128
132
|
list,
|
|
129
133
|
unseen(session) {
|
|
130
|
-
const
|
|
131
|
-
const own = new Set([session,
|
|
132
|
-
const seen = Number(
|
|
133
|
-
const started = Date.parse(
|
|
134
|
+
const record2 = registry.get(session);
|
|
135
|
+
const own = new Set([session, record2?.alias].filter(Boolean));
|
|
136
|
+
const seen = Number(record2?.seenBroadcast ?? 0);
|
|
137
|
+
const started = Date.parse(record2?.startedAt ?? "") || 0;
|
|
134
138
|
const all = list();
|
|
135
139
|
const latest = all.at(-1);
|
|
136
140
|
const unseen = all.filter(
|
|
@@ -159,33 +163,59 @@ function filesBroadcast(dir, keep, registry) {
|
|
|
159
163
|
}
|
|
160
164
|
|
|
161
165
|
// src/sessions/files/leases.ts
|
|
162
|
-
import {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
+
import {
|
|
167
|
+
linkSync,
|
|
168
|
+
mkdirSync as mkdirSync2,
|
|
169
|
+
renameSync as renameSync2,
|
|
170
|
+
rmSync as rmSync2,
|
|
171
|
+
writeFileSync as writeFileSync2
|
|
172
|
+
} from "fs";
|
|
173
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
174
|
+
function filesLeases(dir, files = {}) {
|
|
175
|
+
const leasePath = (name) => files[name]?.file ?? join2(dir, leaseFile(name));
|
|
166
176
|
const read = (name) => {
|
|
167
|
-
const lease = asLease(readJson(leasePath(
|
|
177
|
+
const lease = asLease(readJson(leasePath(name)));
|
|
168
178
|
if (!lease || !alive(lease.pid)) return null;
|
|
169
179
|
return lease;
|
|
170
180
|
};
|
|
171
181
|
return {
|
|
172
182
|
read,
|
|
183
|
+
// Atomic against another process taking the same file (another tool may share it): the
|
|
184
|
+
// record is linked into place, and a dead holder's record is replaced and then re-read, so
|
|
185
|
+
// of two takers replacing it at once only the one whose record stays holds the lease.
|
|
173
186
|
take(name, lease) {
|
|
174
|
-
const
|
|
187
|
+
const path = leasePath(name);
|
|
175
188
|
const pid = lease.pid ?? process.pid;
|
|
176
|
-
|
|
177
|
-
writeJson(leasePath(dir, name), {
|
|
189
|
+
const record2 = {
|
|
178
190
|
pid,
|
|
179
191
|
subject: lease.subject,
|
|
180
192
|
...lease.cwd ? { cwd: lease.cwd } : {},
|
|
181
193
|
since: (/* @__PURE__ */ new Date()).toISOString()
|
|
182
|
-
}
|
|
183
|
-
|
|
194
|
+
};
|
|
195
|
+
mkdirSync2(dirname2(path), { recursive: true });
|
|
196
|
+
const temp = `${path}.${process.pid}.${Date.now()}.tmp`;
|
|
197
|
+
writeFileSync2(temp, `${JSON.stringify(record2)}
|
|
198
|
+
`);
|
|
199
|
+
try {
|
|
200
|
+
try {
|
|
201
|
+
linkSync(temp, path);
|
|
202
|
+
return true;
|
|
203
|
+
} catch (error) {
|
|
204
|
+
if (error.code !== "EEXIST") throw error;
|
|
205
|
+
}
|
|
206
|
+
const held = read(name);
|
|
207
|
+
if (held && held.pid !== pid) return false;
|
|
208
|
+
renameSync2(temp, path);
|
|
209
|
+
return asLease(readJson(path))?.pid === pid;
|
|
210
|
+
} finally {
|
|
211
|
+
rmSync2(temp, { force: true });
|
|
212
|
+
}
|
|
184
213
|
},
|
|
185
214
|
release(name, pid = process.pid) {
|
|
186
|
-
const
|
|
215
|
+
const path = leasePath(name);
|
|
216
|
+
const held = asLease(readJson(path));
|
|
187
217
|
if (!held || held.pid === pid || !alive(held.pid)) {
|
|
188
|
-
rmSync2(
|
|
218
|
+
rmSync2(path, { force: true });
|
|
189
219
|
}
|
|
190
220
|
}
|
|
191
221
|
};
|
|
@@ -195,12 +225,12 @@ function filesLeases(dir) {
|
|
|
195
225
|
import {
|
|
196
226
|
appendFileSync,
|
|
197
227
|
existsSync,
|
|
198
|
-
linkSync,
|
|
199
|
-
mkdirSync as
|
|
228
|
+
linkSync as linkSync2,
|
|
229
|
+
mkdirSync as mkdirSync3,
|
|
200
230
|
readdirSync,
|
|
201
231
|
rmSync as rmSync3,
|
|
202
232
|
unlinkSync,
|
|
203
|
-
writeFileSync as
|
|
233
|
+
writeFileSync as writeFileSync3
|
|
204
234
|
} from "fs";
|
|
205
235
|
import { join as join3 } from "path";
|
|
206
236
|
|
|
@@ -265,9 +295,9 @@ function filesMailbox(dir, settings) {
|
|
|
265
295
|
});
|
|
266
296
|
};
|
|
267
297
|
const touch = (path) => {
|
|
268
|
-
|
|
298
|
+
mkdirSync3(join3(path, ".."), { recursive: true, mode: 448 });
|
|
269
299
|
try {
|
|
270
|
-
|
|
300
|
+
writeFileSync3(path, "", { flag: "wx", mode: 384 });
|
|
271
301
|
return true;
|
|
272
302
|
} catch {
|
|
273
303
|
return false;
|
|
@@ -288,7 +318,7 @@ function filesMailbox(dir, settings) {
|
|
|
288
318
|
return {
|
|
289
319
|
settings,
|
|
290
320
|
send(input) {
|
|
291
|
-
|
|
321
|
+
mkdirSync3(messages, { recursive: true, mode: 448 });
|
|
292
322
|
const created = Date.now();
|
|
293
323
|
const ttl = input.ttlMinutes ?? settings.ttlMinutes;
|
|
294
324
|
for (let attempt = 0; ; attempt += 1) {
|
|
@@ -308,12 +338,12 @@ function filesMailbox(dir, settings) {
|
|
|
308
338
|
...input.broadcastId ? { broadcastId: input.broadcastId } : {}
|
|
309
339
|
};
|
|
310
340
|
const temporary = `${pathOf(id)}.${process.pid}.tmp`;
|
|
311
|
-
|
|
341
|
+
writeFileSync3(temporary, `${JSON.stringify(message, null, 2)}
|
|
312
342
|
`, {
|
|
313
343
|
mode: 384
|
|
314
344
|
});
|
|
315
345
|
try {
|
|
316
|
-
|
|
346
|
+
linkSync2(temporary, pathOf(id));
|
|
317
347
|
} catch {
|
|
318
348
|
continue;
|
|
319
349
|
} finally {
|
|
@@ -393,7 +423,7 @@ function filesRegistry(dir, staleMs) {
|
|
|
393
423
|
} catch {
|
|
394
424
|
return [];
|
|
395
425
|
}
|
|
396
|
-
return names.map((name) => asRecord(readJson(join5(fleetDir, name)))).filter((
|
|
426
|
+
return names.map((name) => asRecord(readJson(join5(fleetDir, name)))).filter((record2) => record2 !== null).map((record2) => ({ ...record2, live: isLive(record2, now, staleMs) }));
|
|
397
427
|
};
|
|
398
428
|
const remove = (session) => {
|
|
399
429
|
if (SESSION_ID.test(session)) rmSync5(pathOf(session), { force: true });
|
|
@@ -420,8 +450,8 @@ function filesRegistry(dir, staleMs) {
|
|
|
420
450
|
return next;
|
|
421
451
|
},
|
|
422
452
|
sweep(now = Date.now()) {
|
|
423
|
-
const stale = list(now).filter((
|
|
424
|
-
stale.forEach((
|
|
453
|
+
const stale = list(now).filter((record2) => !record2.live);
|
|
454
|
+
stale.forEach((record2) => remove(record2.session));
|
|
425
455
|
return stale.length;
|
|
426
456
|
}
|
|
427
457
|
};
|
|
@@ -442,7 +472,7 @@ function createFilesStore(dir, options = {}) {
|
|
|
442
472
|
dir,
|
|
443
473
|
registry,
|
|
444
474
|
pause: filesPause(dir),
|
|
445
|
-
leases: filesLeases(dir),
|
|
475
|
+
leases: filesLeases(dir, options.leaseFiles),
|
|
446
476
|
// With the mailbox on, a broadcast is also a message to all, which the mailbox delivers;
|
|
447
477
|
// broadcast.json stays the record status, snapshot and the Claude band read.
|
|
448
478
|
broadcast: !mailbox.settings.enabled ? broadcast : {
|
|
@@ -466,6 +496,178 @@ function createFilesStore(dir, options = {}) {
|
|
|
466
496
|
};
|
|
467
497
|
}
|
|
468
498
|
|
|
499
|
+
// src/sessions/lease-files.ts
|
|
500
|
+
import { dirname as dirname3, isAbsolute, join as join6 } from "path";
|
|
501
|
+
var GATE_DIR = "${gate_dir}/";
|
|
502
|
+
function record(value, where) {
|
|
503
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
504
|
+
throw new Error(`${where} must be a table`);
|
|
505
|
+
return value;
|
|
506
|
+
}
|
|
507
|
+
function setting(value, where) {
|
|
508
|
+
if (value === void 0) return void 0;
|
|
509
|
+
if (typeof value !== "string" || value === "")
|
|
510
|
+
throw new Error(`${where} must be a path`);
|
|
511
|
+
if (value.startsWith(GATE_DIR)) return value;
|
|
512
|
+
const home = value === "~" || value.startsWith("~/") || value.startsWith("$HOME/");
|
|
513
|
+
const path = home ? expandPath("/", value) : value;
|
|
514
|
+
if (!isAbsolute(path))
|
|
515
|
+
throw new Error(
|
|
516
|
+
`${where} must be absolute, start with ~/ or start with \${gate_dir}/`
|
|
517
|
+
);
|
|
518
|
+
return path;
|
|
519
|
+
}
|
|
520
|
+
function readLeaseFiles(leases) {
|
|
521
|
+
if (leases === void 0) return {};
|
|
522
|
+
const out = {};
|
|
523
|
+
for (const [name, raw] of Object.entries(
|
|
524
|
+
record(leases, "[sessions.leases]")
|
|
525
|
+
)) {
|
|
526
|
+
const where = `[sessions.leases.${name}]`;
|
|
527
|
+
const table2 = record(raw, where);
|
|
528
|
+
const file = setting(table2["file"], `${where} file`);
|
|
529
|
+
const events = setting(table2["events"], `${where} events`);
|
|
530
|
+
if (file || events)
|
|
531
|
+
out[name] = { ...file ? { file } : {}, ...events ? { events } : {} };
|
|
532
|
+
}
|
|
533
|
+
return out;
|
|
534
|
+
}
|
|
535
|
+
function readGateLocation(git) {
|
|
536
|
+
if (git === null || typeof git !== "object") return {};
|
|
537
|
+
const mainline = git["mainline"];
|
|
538
|
+
if (mainline === null || typeof mainline !== "object") return {};
|
|
539
|
+
const gate = mainline["gate"];
|
|
540
|
+
if (gate === null || typeof gate !== "object") return {};
|
|
541
|
+
const { tree, tree_env: treeEnv } = gate;
|
|
542
|
+
return {
|
|
543
|
+
...typeof tree === "string" ? { tree } : {},
|
|
544
|
+
...typeof treeEnv === "string" ? { treeEnv } : {}
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
function gateTree(root, stateDir, gate, env) {
|
|
548
|
+
const override = gate.treeEnv ? env[gate.treeEnv] : void 0;
|
|
549
|
+
if (override) return override;
|
|
550
|
+
return gate.tree ? expandPath(root, gate.tree) : join6(stateDir, "gate", "tree");
|
|
551
|
+
}
|
|
552
|
+
function resolveLeaseFiles(files, gateDir) {
|
|
553
|
+
const resolve2 = (path) => path?.startsWith(GATE_DIR) ? join6(gateDir, path.slice(GATE_DIR.length)) : path;
|
|
554
|
+
return Object.fromEntries(
|
|
555
|
+
Object.entries(files ?? {}).map(([name, f]) => {
|
|
556
|
+
const file = resolve2(f.file);
|
|
557
|
+
const events = resolve2(f.events);
|
|
558
|
+
return [
|
|
559
|
+
name,
|
|
560
|
+
{ ...file ? { file } : {}, ...events ? { events } : {} }
|
|
561
|
+
];
|
|
562
|
+
})
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
function leaseFilesFor(root, stateDir, files, gate, env) {
|
|
566
|
+
if (!files || Object.keys(files).length === 0) return {};
|
|
567
|
+
return resolveLeaseFiles(
|
|
568
|
+
files,
|
|
569
|
+
dirname3(gateTree(root, stateDir, gate ?? {}, env))
|
|
570
|
+
);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
// src/sessions/settings.ts
|
|
574
|
+
var MAILBOX_KEYS = [
|
|
575
|
+
"enabled",
|
|
576
|
+
"ttl_minutes",
|
|
577
|
+
"max_delivered",
|
|
578
|
+
"audit",
|
|
579
|
+
"wake"
|
|
580
|
+
];
|
|
581
|
+
function flag(value, where, fallback) {
|
|
582
|
+
if (value === void 0) return fallback;
|
|
583
|
+
if (typeof value !== "boolean")
|
|
584
|
+
throw new Error(`${where} must be true or false`);
|
|
585
|
+
return value;
|
|
586
|
+
}
|
|
587
|
+
function readMailbox(raw) {
|
|
588
|
+
if (raw === void 0)
|
|
589
|
+
return { enabled: false, ttlMinutes: 1440, maxDelivered: 5, audit: true };
|
|
590
|
+
const mailbox = table(raw, "[sessions.mailbox]");
|
|
591
|
+
const unknown = Object.keys(mailbox).find(
|
|
592
|
+
(key) => !MAILBOX_KEYS.includes(key)
|
|
593
|
+
);
|
|
594
|
+
if (unknown) throw new Error(`[sessions.mailbox] unknown key ${unknown}`);
|
|
595
|
+
return {
|
|
596
|
+
enabled: flag(mailbox["enabled"], "[sessions.mailbox] enabled", true),
|
|
597
|
+
ttlMinutes: positiveInteger(
|
|
598
|
+
mailbox["ttl_minutes"],
|
|
599
|
+
"[sessions.mailbox] ttl_minutes",
|
|
600
|
+
1440
|
|
601
|
+
),
|
|
602
|
+
maxDelivered: positiveInteger(
|
|
603
|
+
mailbox["max_delivered"],
|
|
604
|
+
"[sessions.mailbox] max_delivered",
|
|
605
|
+
5
|
|
606
|
+
),
|
|
607
|
+
audit: flag(mailbox["audit"], "[sessions.mailbox] audit", true),
|
|
608
|
+
// Only when on, so mailboxes without wake keep the same compiled policy and hash.
|
|
609
|
+
...flag(mailbox["wake"], "[sessions.mailbox] wake", false) ? { wake: true } : {}
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
function table(value, where) {
|
|
613
|
+
if (value === void 0) return {};
|
|
614
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
615
|
+
throw new Error(`${where} must be a table`);
|
|
616
|
+
return value;
|
|
617
|
+
}
|
|
618
|
+
function positiveInteger(value, where, fallback) {
|
|
619
|
+
if (value === void 0) return fallback;
|
|
620
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) {
|
|
621
|
+
throw new Error(`${where} must be a positive integer`);
|
|
622
|
+
}
|
|
623
|
+
return value;
|
|
624
|
+
}
|
|
625
|
+
function readStoreSettings(raw, git) {
|
|
626
|
+
const sessions = table(raw, "[sessions]");
|
|
627
|
+
if ((sessions["store"] ?? "files") !== "files")
|
|
628
|
+
throw new Error('[sessions] store must be "files"');
|
|
629
|
+
const stateDir = sessions["state_dir"];
|
|
630
|
+
if (stateDir !== void 0 && (typeof stateDir !== "string" || stateDir === "")) {
|
|
631
|
+
throw new Error("[sessions] state_dir must be a path");
|
|
632
|
+
}
|
|
633
|
+
const registry = table(sessions["registry"], "[sessions.registry]");
|
|
634
|
+
const broadcast = table(sessions["broadcast"], "[sessions.broadcast]");
|
|
635
|
+
return {
|
|
636
|
+
...typeof stateDir === "string" ? { stateDir } : {},
|
|
637
|
+
staleMs: positiveInteger(
|
|
638
|
+
registry["stale_minutes"],
|
|
639
|
+
"[sessions.registry] stale_minutes",
|
|
640
|
+
30
|
|
641
|
+
) * 6e4,
|
|
642
|
+
keepBroadcasts: positiveInteger(
|
|
643
|
+
broadcast["keep"],
|
|
644
|
+
"[sessions.broadcast] keep",
|
|
645
|
+
10
|
|
646
|
+
),
|
|
647
|
+
mailbox: readMailbox(sessions["mailbox"]),
|
|
648
|
+
...leaseSettings(sessions["leases"], git)
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
function leaseSettings(leases, git) {
|
|
652
|
+
const leaseFiles = readLeaseFiles(leases);
|
|
653
|
+
if (Object.keys(leaseFiles).length === 0) return {};
|
|
654
|
+
const gate = readGateLocation(git);
|
|
655
|
+
return { leaseFiles, ...Object.keys(gate).length > 0 ? { gate } : {} };
|
|
656
|
+
}
|
|
657
|
+
function openStore(root, settings, env = process.env) {
|
|
658
|
+
const dir = projectStateDir(root, settings.stateDir, env);
|
|
659
|
+
return createFilesStore(dir, {
|
|
660
|
+
...settings,
|
|
661
|
+
leaseFiles: leaseFilesFor(
|
|
662
|
+
root,
|
|
663
|
+
dir,
|
|
664
|
+
settings.leaseFiles,
|
|
665
|
+
settings.gate,
|
|
666
|
+
env
|
|
667
|
+
)
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
|
|
469
671
|
export {
|
|
470
672
|
noticeOf,
|
|
471
673
|
normalizeSelector,
|
|
@@ -474,6 +676,9 @@ export {
|
|
|
474
676
|
inboxKey,
|
|
475
677
|
writeJson,
|
|
476
678
|
SESSION_ID,
|
|
477
|
-
createFilesStore
|
|
679
|
+
createFilesStore,
|
|
680
|
+
resolveLeaseFiles,
|
|
681
|
+
readStoreSettings,
|
|
682
|
+
openStore
|
|
478
683
|
};
|
|
479
|
-
//# sourceMappingURL=chunk-
|
|
684
|
+
//# sourceMappingURL=chunk-DHAPQUEF.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
openStore,
|
|
3
3
|
readStoreSettings
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DHAPQUEF.js";
|
|
5
5
|
import {
|
|
6
6
|
ArgumentError,
|
|
7
7
|
one
|
|
@@ -20,7 +20,10 @@ function storeFrom(context) {
|
|
|
20
20
|
const sessions = config.raw["sessions"] ?? {};
|
|
21
21
|
const leases = Object.keys(sessions["leases"] ?? {});
|
|
22
22
|
return {
|
|
23
|
-
store: openStore(
|
|
23
|
+
store: openStore(
|
|
24
|
+
config.dir,
|
|
25
|
+
readStoreSettings(sessions, config.raw["git"])
|
|
26
|
+
),
|
|
24
27
|
leases,
|
|
25
28
|
root: config.dir
|
|
26
29
|
};
|
|
@@ -70,4 +73,4 @@ export {
|
|
|
70
73
|
storeFrom,
|
|
71
74
|
change
|
|
72
75
|
};
|
|
73
|
-
//# sourceMappingURL=chunk-
|
|
76
|
+
//# sourceMappingURL=chunk-E4FJOLPJ.js.map
|