@modootoday/pmcp 0.24.1 → 0.25.0

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.
Files changed (93) hide show
  1. package/.agents/plugins/marketplace.json +1 -1
  2. package/.claude-plugin/marketplace.json +1 -1
  3. package/.claude-plugin/plugin.json +1 -1
  4. package/.mcp.json +1 -1
  5. package/dist/{apply-CDJQJAZH.js → apply-6XLLYLJT.js} +9 -8
  6. package/dist/{broadcast-VKZY7WSD.js → broadcast-34CEG2NQ.js} +5 -2
  7. package/dist/{chunk-264DIB5U.js → chunk-2TXVOHRS.js} +3 -3
  8. package/dist/{chunk-X3RUXLAV.js → chunk-3P6Y2BAO.js} +3 -3
  9. package/dist/{chunk-7CGGDX7X.js → chunk-5MUD7FHP.js} +2 -2
  10. package/dist/{chunk-2GZKA33O.js → chunk-A4P3IIPE.js} +2 -2
  11. package/dist/{chunk-GEDRPMBH.js → chunk-BG6TONJO.js} +2 -2
  12. package/dist/{chunk-HES44LTA.js → chunk-C3KRMTIZ.js} +28 -4
  13. package/dist/{chunk-QY2P54Z2.js → chunk-DITIXBFB.js} +61 -8
  14. package/dist/{chunk-LNKAR3IS.js → chunk-DWHM5BAY.js} +2 -2
  15. package/dist/{chunk-VBWB2T3C.js → chunk-EC5QLEZD.js} +2 -2
  16. package/dist/{chunk-MZ52S4YJ.js → chunk-ISWR2XIU.js} +2 -2
  17. package/dist/{chunk-D4FIBB2G.js → chunk-LZVHFPN6.js} +5 -5
  18. package/dist/{chunk-3SEJNT6F.js → chunk-MBHI2TKQ.js} +4 -4
  19. package/dist/{chunk-43MXRTKH.js → chunk-NAHAESFV.js} +9 -4
  20. package/dist/chunk-NQCAKDRY.js +156 -0
  21. package/dist/chunk-OIKT4SYO.js +42 -0
  22. package/dist/{chunk-3O3JZTUU.js → chunk-PECS47OL.js} +3 -3
  23. package/dist/{chunk-AQM2JZMB.js → chunk-PGZZI42O.js} +2 -2
  24. package/dist/{chunk-5NQZGNKT.js → chunk-QYHM6554.js} +2 -2
  25. package/dist/{chunk-DLIO2D7S.js → chunk-RF6RDJYH.js} +16 -16
  26. package/dist/chunk-SMBU3QLE.js +7 -0
  27. package/dist/{chunk-V5PXMLLL.js → chunk-SRSKCFFS.js} +3 -3
  28. package/dist/{chunk-DGXZBQCA.js → chunk-SSQ6EWNA.js} +5 -5
  29. package/dist/{chunk-MOKZPZZO.js → chunk-TJW4DP26.js} +2 -2
  30. package/dist/{chunk-2ZH77O2D.js → chunk-TOR6SKRB.js} +141 -58
  31. package/dist/{chunk-PG62GOPU.js → chunk-UQHJUTDW.js} +2 -2
  32. package/dist/{cli-GFDT4YXM.js → cli-5G2OYTIL.js} +9 -9
  33. package/dist/{cli-OV5LSSGE.js → cli-QDQYUHAP.js} +4 -4
  34. package/dist/cli.js +38 -5
  35. package/dist/{completion-QNDCU4MF.js → completion-3GVNPLZY.js} +4 -4
  36. package/dist/{diagnostics-TPK3VC5F.js → diagnostics-2W7QDQNG.js} +6 -6
  37. package/dist/{doctor-K2LADSW2.js → doctor-3TDO5LJ5.js} +11 -10
  38. package/dist/{entry-HFQHKL5L.js → entry-E62DZQJF.js} +10 -10
  39. package/dist/{exec-mcp-I2YGGWY4.js → exec-mcp-4N7FLY52.js} +7 -6
  40. package/dist/{harness-BMWGAXCF.js → harness-E2AUZDLV.js} +3 -3
  41. package/dist/harness-launch-gate.js +4 -4
  42. package/dist/harness-worker.js +6 -6
  43. package/dist/{heavy-G6CYQQ7O.js → heavy-HZQVFI6P.js} +150 -36
  44. package/dist/hook-body.js +116 -45
  45. package/dist/{hooks-R7AYQXHY.js → hooks-VAEAK2FY.js} +4 -4
  46. package/dist/{host-PLE2T55E.js → host-4GJDGTLW.js} +7 -7
  47. package/dist/{host-EUD6GLWV.js → host-I2EMQ7UE.js} +12 -59
  48. package/dist/{host-run-QFNGIDL5.js → host-run-DDMKD3BU.js} +5 -5
  49. package/dist/http.js +1 -1
  50. package/dist/{import-mcp-DVKJOEOE.js → import-mcp-TNSAMJXI.js} +6 -5
  51. package/dist/index.d.ts +1 -1
  52. package/dist/index.js +10 -9
  53. package/dist/{init-DKWNL62M.js → init-UA7MDNTZ.js} +2 -2
  54. package/dist/{invoke-U6JTPTXT.js → invoke-HW7NBPGP.js} +8 -8
  55. package/dist/{list-YKQFJN3G.js → list-A7VQJXE5.js} +8 -7
  56. package/dist/{logout-5YSKC46N.js → logout-HNPLUKJY.js} +7 -6
  57. package/dist/{mailbox-5FVFMQ2J.js → mailbox-MR6TPD3P.js} +20 -6
  58. package/dist/{mainline-D3PSR6AJ.js → mainline-MSLW3UFD.js} +8 -2
  59. package/dist/{mcp-CHKKXHBB.js → mcp-6C23GX2E.js} +2 -2
  60. package/dist/{pause-CMZOIHTJ.js → pause-H6ZYZF7C.js} +5 -2
  61. package/dist/{project-QEYXISHC.js → project-BX6NCGKB.js} +4 -4
  62. package/dist/{report-UB7MXAUB.js → report-43SFNNCF.js} +2 -2
  63. package/dist/{resume-PAKIT4TT.js → resume-2BWGSTCN.js} +5 -2
  64. package/dist/{run-HKMYYEZJ.js → run-2UVAWBAF.js} +6 -5
  65. package/dist/{run-FYKDIW4C.js → run-7TRWZFEZ.js} +4 -4
  66. package/dist/{serve-QZNG5UUV.js → serve-4XZ5SKJJ.js} +3 -3
  67. package/dist/{start-login-4GPM32RA.js → start-login-AR7ITWNV.js} +7 -6
  68. package/dist/{status-4PYPTYUB.js → status-2GDYLIR3.js} +6 -3
  69. package/dist/{status-55CD352M.js → status-VQCMJFVE.js} +25 -22
  70. package/dist/{status-W6SCF2GF.js → status-ZY6LDQSF.js} +7 -6
  71. package/dist/stdio.js +2 -2
  72. package/dist/{sweep-VURZU6DI.js → sweep-76BUOGEI.js} +5 -2
  73. package/dist/{test-XYEMYZ2P.js → test-VWGNFSH5.js} +9 -7
  74. package/dist/{tui-FXSWN2PV.js → tui-TUMOQBE7.js} +4 -4
  75. package/dist/{unbroadcast-7AMLURCG.js → unbroadcast-HJHYUHZL.js} +5 -2
  76. package/dist/{worker-Q4I4EIAJ.js → worker-NEEPJRVV.js} +8 -8
  77. package/dist/{worktree-list-2HV6ODBS.js → worktree-list-WZC75NLF.js} +8 -9
  78. package/docs/commands.md +8 -6
  79. package/docs/glossary.md +1 -1
  80. package/docs/hooks.md +20 -16
  81. package/docs/project-configuration.md +73 -36
  82. package/docs/sessions.md +9 -2
  83. package/docs/upgrading.md +58 -0
  84. package/gemini-extension.json +2 -2
  85. package/mcp.json +1 -1
  86. package/package.json +5 -5
  87. package/plugin.json +1 -1
  88. package/plugins/pmcp/.claude-plugin/plugin.json +1 -1
  89. package/plugins/pmcp/.mcp.json +1 -1
  90. package/plugins/pmcp/gemini-extension.json +2 -2
  91. package/plugins/pmcp/mcp.json +1 -1
  92. package/plugins/pmcp/plugin.json +1 -1
  93. package/dist/chunk-65H4PN33.js +0 -7
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  COMMANDS,
3
3
  completionSpec
4
- } from "./chunk-DLIO2D7S.js";
4
+ } from "./chunk-RF6RDJYH.js";
5
5
  import "./chunk-QR6A3TYP.js";
6
6
  import "./chunk-JANBBPKP.js";
7
7
  import "./chunk-UVTGY2R3.js";
8
8
  import "./chunk-2HL2MFNI.js";
9
9
  import "./chunk-4VVQLWTS.js";
10
- import "./chunk-43MXRTKH.js";
10
+ import "./chunk-NAHAESFV.js";
11
11
  import "./chunk-F3R5HEUB.js";
12
- import "./chunk-2GZKA33O.js";
12
+ import "./chunk-A4P3IIPE.js";
13
13
  import "./chunk-WZYGM3FR.js";
14
14
  import "./chunk-WBPVNCQO.js";
15
15
  import "./chunk-HF5D6B2U.js";
@@ -143,4 +143,4 @@ var completionCommand = {
143
143
  export {
144
144
  completionCommand
145
145
  };
146
- //# sourceMappingURL=completion-QNDCU4MF.js.map
146
+ //# sourceMappingURL=completion-3GVNPLZY.js.map
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  dependencies
3
- } from "./chunk-AQM2JZMB.js";
3
+ } from "./chunk-PGZZI42O.js";
4
4
  import {
5
5
  assertNativeHost
6
- } from "./chunk-MZ52S4YJ.js";
6
+ } from "./chunk-ISWR2XIU.js";
7
7
  import {
8
8
  locateExecutable
9
9
  } from "./chunk-R2GPCZUX.js";
10
10
  import "./chunk-34DECPVC.js";
11
11
  import {
12
12
  missingBinary
13
- } from "./chunk-264DIB5U.js";
14
- import "./chunk-QY2P54Z2.js";
13
+ } from "./chunk-2TXVOHRS.js";
14
+ import "./chunk-DITIXBFB.js";
15
15
  import "./chunk-N7ANFMA5.js";
16
16
  import "./chunk-TYY5TYHF.js";
17
17
  import "./chunk-T6C3TSTO.js";
@@ -21,7 +21,7 @@ import "./chunk-IJBSOWHK.js";
21
21
  import "./chunk-XWLMZKH2.js";
22
22
  import {
23
23
  VERSION
24
- } from "./chunk-65H4PN33.js";
24
+ } from "./chunk-SMBU3QLE.js";
25
25
  import "./chunk-GJXOFDJT.js";
26
26
  import "./chunk-PMJG2CXF.js";
27
27
  import {
@@ -96,4 +96,4 @@ function inspectTerminalHost() {
96
96
  export {
97
97
  inspectTerminalHost
98
98
  };
99
- //# sourceMappingURL=diagnostics-TPK3VC5F.js.map
99
+ //# sourceMappingURL=diagnostics-2W7QDQNG.js.map
@@ -1,29 +1,30 @@
1
1
  import {
2
2
  specFrom
3
- } from "./chunk-GEDRPMBH.js";
3
+ } from "./chunk-BG6TONJO.js";
4
4
  import "./chunk-7CHUMF3E.js";
5
5
  import {
6
6
  doctor,
7
7
  spawnRunner
8
- } from "./chunk-DGXZBQCA.js";
9
- import "./chunk-5NQZGNKT.js";
8
+ } from "./chunk-SSQ6EWNA.js";
9
+ import "./chunk-QYHM6554.js";
10
10
  import "./chunk-JQVSDPFL.js";
11
11
  import "./chunk-VJFEN6DJ.js";
12
12
  import "./chunk-NHUMPEPV.js";
13
13
  import "./chunk-TIA4SPU2.js";
14
- import "./chunk-3SEJNT6F.js";
14
+ import "./chunk-MBHI2TKQ.js";
15
15
  import "./chunk-ANJMLKBR.js";
16
- import "./chunk-V5PXMLLL.js";
16
+ import "./chunk-SRSKCFFS.js";
17
17
  import {
18
18
  FEATURES,
19
19
  GUARDS,
20
20
  customEvent
21
- } from "./chunk-2ZH77O2D.js";
21
+ } from "./chunk-TOR6SKRB.js";
22
22
  import "./chunk-VYQJPT27.js";
23
23
  import "./chunk-UKR64U7J.js";
24
24
  import "./chunk-2GD7PQ7J.js";
25
25
  import "./chunk-EATCUWGG.js";
26
26
  import "./chunk-OFJIMBTL.js";
27
+ import "./chunk-NQCAKDRY.js";
27
28
  import "./chunk-LFFIQBNY.js";
28
29
  import "./chunk-HQOB7OQS.js";
29
30
  import "./chunk-73AKO4UL.js";
@@ -54,8 +55,8 @@ import {
54
55
  ArgumentError,
55
56
  many
56
57
  } from "./chunk-Y6NFETNG.js";
57
- import "./chunk-264DIB5U.js";
58
- import "./chunk-QY2P54Z2.js";
58
+ import "./chunk-2TXVOHRS.js";
59
+ import "./chunk-DITIXBFB.js";
59
60
  import "./chunk-N7ANFMA5.js";
60
61
  import "./chunk-TYY5TYHF.js";
61
62
  import "./chunk-T6C3TSTO.js";
@@ -63,7 +64,7 @@ import "./chunk-FQLCD4HU.js";
63
64
  import "./chunk-GUHOEIHP.js";
64
65
  import "./chunk-IJBSOWHK.js";
65
66
  import "./chunk-XWLMZKH2.js";
66
- import "./chunk-65H4PN33.js";
67
+ import "./chunk-SMBU3QLE.js";
67
68
  import "./chunk-GJXOFDJT.js";
68
69
  import "./chunk-PMJG2CXF.js";
69
70
  import "./chunk-J6KL3COD.js";
@@ -548,4 +549,4 @@ var doctorCommand = {
548
549
  export {
549
550
  doctorCommand
550
551
  };
551
- //# sourceMappingURL=doctor-K2LADSW2.js.map
552
+ //# sourceMappingURL=doctor-3TDO5LJ5.js.map
@@ -7,27 +7,27 @@ import {
7
7
  } from "./chunk-C3G75JH7.js";
8
8
  import {
9
9
  requireTerminal
10
- } from "./chunk-3O3JZTUU.js";
10
+ } from "./chunk-PECS47OL.js";
11
11
  import "./chunk-5ZABTVSW.js";
12
12
  import {
13
13
  runTui
14
- } from "./chunk-AQM2JZMB.js";
14
+ } from "./chunk-PGZZI42O.js";
15
15
  import {
16
16
  invoke
17
- } from "./chunk-D4FIBB2G.js";
17
+ } from "./chunk-LZVHFPN6.js";
18
18
  import {
19
19
  lockFile
20
20
  } from "./chunk-DZ2MRTYT.js";
21
21
  import "./chunk-LMT3PPXJ.js";
22
- import "./chunk-X3RUXLAV.js";
23
- import "./chunk-MZ52S4YJ.js";
22
+ import "./chunk-3P6Y2BAO.js";
23
+ import "./chunk-ISWR2XIU.js";
24
24
  import {
25
25
  locateExecutable
26
26
  } from "./chunk-R2GPCZUX.js";
27
- import "./chunk-LNKAR3IS.js";
27
+ import "./chunk-DWHM5BAY.js";
28
28
  import "./chunk-34DECPVC.js";
29
- import "./chunk-264DIB5U.js";
30
- import "./chunk-QY2P54Z2.js";
29
+ import "./chunk-2TXVOHRS.js";
30
+ import "./chunk-DITIXBFB.js";
31
31
  import "./chunk-N7ANFMA5.js";
32
32
  import "./chunk-TYY5TYHF.js";
33
33
  import "./chunk-T6C3TSTO.js";
@@ -35,7 +35,7 @@ import "./chunk-FQLCD4HU.js";
35
35
  import "./chunk-GUHOEIHP.js";
36
36
  import "./chunk-IJBSOWHK.js";
37
37
  import "./chunk-XWLMZKH2.js";
38
- import "./chunk-65H4PN33.js";
38
+ import "./chunk-SMBU3QLE.js";
39
39
  import "./chunk-GJXOFDJT.js";
40
40
  import "./chunk-PMJG2CXF.js";
41
41
  import {
@@ -308,4 +308,4 @@ export {
308
308
  launchStartup,
309
309
  planStartup
310
310
  };
311
- //# sourceMappingURL=entry-HFQHKL5L.js.map
311
+ //# sourceMappingURL=entry-E62DZQJF.js.map
@@ -8,16 +8,17 @@ import {
8
8
  } from "./chunk-UPQTAHUK.js";
9
9
  import {
10
10
  specFrom
11
- } from "./chunk-GEDRPMBH.js";
11
+ } from "./chunk-BG6TONJO.js";
12
12
  import "./chunk-7CHUMF3E.js";
13
13
  import {
14
14
  launch
15
- } from "./chunk-2ZH77O2D.js";
15
+ } from "./chunk-TOR6SKRB.js";
16
16
  import "./chunk-VYQJPT27.js";
17
17
  import "./chunk-UKR64U7J.js";
18
18
  import "./chunk-2GD7PQ7J.js";
19
19
  import "./chunk-EATCUWGG.js";
20
20
  import "./chunk-OFJIMBTL.js";
21
+ import "./chunk-NQCAKDRY.js";
21
22
  import "./chunk-LFFIQBNY.js";
22
23
  import "./chunk-HQOB7OQS.js";
23
24
  import "./chunk-73AKO4UL.js";
@@ -33,8 +34,8 @@ import {
33
34
  import "./chunk-ARXCYFFZ.js";
34
35
  import "./chunk-V4NPDK6X.js";
35
36
  import "./chunk-Y6NFETNG.js";
36
- import "./chunk-264DIB5U.js";
37
- import "./chunk-QY2P54Z2.js";
37
+ import "./chunk-2TXVOHRS.js";
38
+ import "./chunk-DITIXBFB.js";
38
39
  import "./chunk-N7ANFMA5.js";
39
40
  import {
40
41
  ProjectError
@@ -44,7 +45,7 @@ import "./chunk-FQLCD4HU.js";
44
45
  import "./chunk-GUHOEIHP.js";
45
46
  import "./chunk-IJBSOWHK.js";
46
47
  import "./chunk-XWLMZKH2.js";
47
- import "./chunk-65H4PN33.js";
48
+ import "./chunk-SMBU3QLE.js";
48
49
  import "./chunk-GJXOFDJT.js";
49
50
  import "./chunk-PMJG2CXF.js";
50
51
  import "./chunk-J6KL3COD.js";
@@ -370,4 +371,4 @@ function runExecMcp(context, name) {
370
371
  export {
371
372
  runExecMcp
372
373
  };
373
- //# sourceMappingURL=exec-mcp-I2YGGWY4.js.map
374
+ //# sourceMappingURL=exec-mcp-4N7FLY52.js.map
@@ -133,12 +133,12 @@ var harnessCommand = {
133
133
  return runPtyMcp(context);
134
134
  }
135
135
  if (context.args.positional[0] === "host") {
136
- const { runHost } = await import("./host-EUD6GLWV.js");
136
+ const { runHost } = await import("./host-I2EMQ7UE.js");
137
137
  return runHost(context);
138
138
  }
139
139
  try {
140
140
  const operation = parseInvocation(context);
141
- const { invoke } = await import("./invoke-U6JTPTXT.js");
141
+ const { invoke } = await import("./invoke-HW7NBPGP.js");
142
142
  const receipt = await invoke(operation);
143
143
  context.ui.data(`${JSON.stringify(receipt)}
144
144
  `);
@@ -156,4 +156,4 @@ var harnessCommand = {
156
156
  export {
157
157
  harnessCommand
158
158
  };
159
- //# sourceMappingURL=harness-BMWGAXCF.js.map
159
+ //# sourceMappingURL=harness-E2AUZDLV.js.map
@@ -7,10 +7,10 @@ import {
7
7
  assertProof,
8
8
  assertResourceFresh,
9
9
  createProof
10
- } from "./chunk-LNKAR3IS.js";
10
+ } from "./chunk-DWHM5BAY.js";
11
11
  import "./chunk-34DECPVC.js";
12
- import "./chunk-264DIB5U.js";
13
- import "./chunk-QY2P54Z2.js";
12
+ import "./chunk-2TXVOHRS.js";
13
+ import "./chunk-DITIXBFB.js";
14
14
  import "./chunk-N7ANFMA5.js";
15
15
  import "./chunk-TYY5TYHF.js";
16
16
  import "./chunk-T6C3TSTO.js";
@@ -18,7 +18,7 @@ import "./chunk-FQLCD4HU.js";
18
18
  import "./chunk-GUHOEIHP.js";
19
19
  import "./chunk-IJBSOWHK.js";
20
20
  import "./chunk-XWLMZKH2.js";
21
- import "./chunk-65H4PN33.js";
21
+ import "./chunk-SMBU3QLE.js";
22
22
  import "./chunk-GJXOFDJT.js";
23
23
  import "./chunk-PMJG2CXF.js";
24
24
  import {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  runOperation
3
- } from "./chunk-X3RUXLAV.js";
4
- import "./chunk-MZ52S4YJ.js";
3
+ } from "./chunk-3P6Y2BAO.js";
4
+ import "./chunk-ISWR2XIU.js";
5
5
  import "./chunk-R2GPCZUX.js";
6
- import "./chunk-LNKAR3IS.js";
6
+ import "./chunk-DWHM5BAY.js";
7
7
  import "./chunk-34DECPVC.js";
8
- import "./chunk-264DIB5U.js";
9
- import "./chunk-QY2P54Z2.js";
8
+ import "./chunk-2TXVOHRS.js";
9
+ import "./chunk-DITIXBFB.js";
10
10
  import "./chunk-N7ANFMA5.js";
11
11
  import "./chunk-TYY5TYHF.js";
12
12
  import "./chunk-T6C3TSTO.js";
@@ -14,7 +14,7 @@ import "./chunk-FQLCD4HU.js";
14
14
  import "./chunk-GUHOEIHP.js";
15
15
  import "./chunk-IJBSOWHK.js";
16
16
  import "./chunk-XWLMZKH2.js";
17
- import "./chunk-65H4PN33.js";
17
+ import "./chunk-SMBU3QLE.js";
18
18
  import "./chunk-GJXOFDJT.js";
19
19
  import "./chunk-PMJG2CXF.js";
20
20
  import {
@@ -4,12 +4,18 @@ import {
4
4
  import {
5
5
  inferSession
6
6
  } from "./chunk-65BW7Y6O.js";
7
+ import {
8
+ isOperator,
9
+ requireOperatorFor
10
+ } from "./chunk-OIKT4SYO.js";
7
11
  import {
8
12
  flockAvailable
9
13
  } from "./chunk-DZ2MRTYT.js";
14
+ import "./chunk-NQCAKDRY.js";
15
+ import "./chunk-Z6WRFOFT.js";
10
16
  import {
11
17
  heavySpec
12
- } from "./chunk-43MXRTKH.js";
18
+ } from "./chunk-NAHAESFV.js";
13
19
  import "./chunk-JPYQDOEW.js";
14
20
  import {
15
21
  ArgumentError,
@@ -21,7 +27,7 @@ import {
21
27
  DISABLE_ENV,
22
28
  NOW_ENV,
23
29
  leaseSettingsFor
24
- } from "./chunk-QY2P54Z2.js";
30
+ } from "./chunk-DITIXBFB.js";
25
31
  import {
26
32
  LANES,
27
33
  describeRecord,
@@ -100,19 +106,24 @@ function applyIo(host, scope, weight, max) {
100
106
  for (let at = 1; at < parts.length; at += 1)
101
107
  enable(join(host.root, ...parts.slice(0, at)));
102
108
  const dir = join(host.root, ...parts);
103
- if (!controllers(dir).includes("io")) return false;
104
- try {
105
- writeFileSync(join(dir, "io.weight"), `default ${weight}`);
106
- if (max) writeFileSync(join(dir, "io.max"), max);
107
- return true;
108
- } catch {
109
- return false;
110
- }
109
+ if (!controllers(dir).includes("io"))
110
+ return { weight: false, max: max ? "failed" : "unset" };
111
+ const write = (file, text) => {
112
+ try {
113
+ writeFileSync(join(dir, file), text);
114
+ return true;
115
+ } catch {
116
+ return false;
117
+ }
118
+ };
119
+ const written = write("io.weight", `default ${weight}`);
120
+ if (!max) return { weight: written, max: "unset" };
121
+ return { weight: written, max: write("io.max", max) ? "set" : "failed" };
111
122
  }
112
123
  function scopeCgroup(unit) {
113
124
  const run2 = spawnSync(
114
125
  "systemctl",
115
- ["--user", "show", unit, "-p", "ControlGroup", "--value"],
126
+ ["--user", "show", `${unit}.scope`, "-p", "ControlGroup", "--value"],
116
127
  { encoding: "utf8" }
117
128
  );
118
129
  const path = run2.status === 0 ? run2.stdout.trim() : "";
@@ -174,8 +185,10 @@ async function weigh(unit, settings2, lane, host, say, onCgroup) {
174
185
  settings2.io.weights[lane],
175
186
  settings2.io.max[lane]
176
187
  );
177
- if (!set && settings2.io.enabled === true)
188
+ if (!set.weight)
178
189
  say(`io control did not reach ${scope}; running without io.weight`);
190
+ if (set.max === "failed")
191
+ say(`io.max for the ${lane} lane was refused; the job runs without it`);
179
192
  return;
180
193
  }
181
194
  await new Promise((resolve) => setTimeout(resolve, 100));
@@ -381,6 +394,30 @@ function hostVerdict(settings2, reading, waiting) {
381
394
  return "wait";
382
395
  }
383
396
 
397
+ // src/lease/skip.ts
398
+ var NESTED = "nested";
399
+ var OPERATOR = "operator";
400
+ var LEGACY_NESTED = /^inside pmcp heavy \d+$/u;
401
+ function allowedReasons(settings2) {
402
+ return [
403
+ .../* @__PURE__ */ new Set([
404
+ NESTED,
405
+ OPERATOR,
406
+ ...settings2.skipReasons,
407
+ ...settings2.skipAlways
408
+ ])
409
+ ];
410
+ }
411
+ function skipRefusal(settings2, reason2, checks) {
412
+ if (reason2 === NESTED || LEGACY_NESTED.test(reason2))
413
+ return checks.nested() ? null : `${NESTED} is the reason pmcp sets inside a leased job, and no leased job encloses this one`;
414
+ if (reason2 === OPERATOR)
415
+ return checks.operator() ? null : `${OPERATOR} is the operator's own skip, from the operator's terminal or with the operator token`;
416
+ if (settings2.skipReasons.includes(reason2)) return null;
417
+ if (settings2.skipAlways.includes(reason2)) return null;
418
+ return `"${reason2}" is not a lease skip reason`;
419
+ }
420
+
384
421
  // src/lease/acquire.ts
385
422
  var STEP_SECONDS = 1;
386
423
  function skipSource(settings2, env) {
@@ -510,8 +547,7 @@ function held(options, paths, fd, start) {
510
547
  const pid = String(process.pid);
511
548
  const env = { [settings2.markerEnv]: pid };
512
549
  if (settings2.legacyMarkerEnv) env[settings2.legacyMarkerEnv] = pid;
513
- if (settings2.legacySkipEnv)
514
- env[settings2.legacySkipEnv] = `inside pmcp heavy ${pid}`;
550
+ if (settings2.legacySkipEnv) env[settings2.legacySkipEnv] = NESTED;
515
551
  let open = true;
516
552
  return {
517
553
  kind: "held",
@@ -529,6 +565,23 @@ function acquireLease(options) {
529
565
  if (!settings2.enabled) return { kind: "disabled" };
530
566
  const paths = leasePaths(settings2.dir);
531
567
  const skip = skipSource(settings2, env);
568
+ const invalid = skip === null ? null : skipRefusal(settings2, skip.reason, {
569
+ nested: () => reentrant(settings2, env),
570
+ operator: () => options.operator?.() ?? false
571
+ });
572
+ if (skip !== null && invalid !== null) {
573
+ if (reentrant(settings2, env)) return { kind: "reentrant" };
574
+ say(
575
+ `${invalid} (${skip.variable}); allowed: ${allowedReasons(settings2).join(", ")}. List a reason in [host.lease] skip_reasons, or run without ${skip.variable} and wait for the lease.`
576
+ );
577
+ logEvent(
578
+ paths,
579
+ process.pid,
580
+ "skip-invalid",
581
+ `reason=${skip.reason} env=${skip.variable} cwd=${options.cwd} label=${label}`
582
+ );
583
+ return { kind: "invalid", reason: skip.reason, variable: skip.variable };
584
+ }
532
585
  const refused = skip !== null && options.lane === "bulk" && !settings2.skipAlways.includes(skip.reason);
533
586
  if (refused && reentrant(settings2, env)) return { kind: "reentrant" };
534
587
  if (skip !== null && refused) {
@@ -755,6 +808,17 @@ function skipShare(records) {
755
808
  runs: ran.length
756
809
  };
757
810
  }
811
+ function skipReasons(records) {
812
+ const honoured = {};
813
+ const invalid = {};
814
+ for (const record2 of records) {
815
+ if (record2.skip !== void 0)
816
+ honoured[record2.skip] = (honoured[record2.skip] ?? 0) + 1;
817
+ if (record2.skip_invalid !== void 0)
818
+ invalid[record2.skip_invalid] = (invalid[record2.skip_invalid] ?? 0) + 1;
819
+ }
820
+ return { honoured, invalid };
821
+ }
758
822
  function percentile(values, share) {
759
823
  const sorted = [...values].sort((a, b) => a - b);
760
824
  return sorted[Math.min(sorted.length - 1, Math.floor(sorted.length * share))] ?? 0;
@@ -780,7 +844,9 @@ function usageStats(records) {
780
844
  signature: key,
781
845
  samples: ran.length,
782
846
  failed: ran.filter((record2) => record2.exit !== 0).length,
783
- timeouts: list.length - ran.length,
847
+ timeouts: list.filter(
848
+ (record2) => record2.outcome !== "ran" && record2.outcome !== "invalid"
849
+ ).length,
784
850
  skipped: ran.filter((record2) => record2.skip !== void 0).length,
785
851
  p50: pick(0.5),
786
852
  p90: pick(0.9)
@@ -911,6 +977,7 @@ var Sampler = class {
911
977
  };
912
978
 
913
979
  // src/lease/run.ts
980
+ var INVALID_EXIT = 2;
914
981
  function prefixed(argv, prefix) {
915
982
  const name = (word = "") => word.slice(word.lastIndexOf("/") + 1);
916
983
  return argv.length >= prefix.length && prefix.every((word, at) => (at === 0 ? name(argv[0]) : argv[at]) === word);
@@ -992,6 +1059,8 @@ function record(run2, fields) {
992
1059
  run2.onUsage?.(usage);
993
1060
  }
994
1061
  function skipFields(run2, outcome) {
1062
+ if (outcome.kind === "invalid")
1063
+ return { skip_invalid: outcome.reason, skip_env: outcome.variable };
995
1064
  if (outcome.kind === "skipped")
996
1065
  return {
997
1066
  skip: outcome.reason,
@@ -1021,6 +1090,18 @@ async function runHeavy(run2) {
1021
1090
  } else {
1022
1091
  outcome = acquireLease({ ...run2, label, lane, weight });
1023
1092
  }
1093
+ if (outcome.kind === "invalid") {
1094
+ record(run2, {
1095
+ ...NOTHING,
1096
+ lane,
1097
+ weight,
1098
+ start: "none",
1099
+ outcome: "invalid",
1100
+ exit: INVALID_EXIT,
1101
+ ...skipFields(run2, outcome)
1102
+ });
1103
+ return INVALID_EXIT;
1104
+ }
1024
1105
  if (outcome.kind === "cancelled") {
1025
1106
  record(run2, {
1026
1107
  ...NOTHING,
@@ -1394,6 +1475,12 @@ function prune(dir) {
1394
1475
  }
1395
1476
  }
1396
1477
  }
1478
+ function ticketOwner(dir, id) {
1479
+ const request = readJson(
1480
+ join5(ticketDir(dir, id), "request.json")
1481
+ );
1482
+ return typeof request?.session === "string" ? request.session : null;
1483
+ }
1397
1484
  function submit(request) {
1398
1485
  prune(request.dir);
1399
1486
  const id = `${Math.floor(Date.now() / 1e3)}-${randomBytes(3).toString("hex")}`;
@@ -1404,6 +1491,7 @@ function submit(request) {
1404
1491
  ticket: id,
1405
1492
  label: request.label,
1406
1493
  cwd: request.cwd,
1494
+ ...request.session ? { session: request.session } : {},
1407
1495
  created: (/* @__PURE__ */ new Date()).toISOString()
1408
1496
  });
1409
1497
  const log = openSync4(join5(path, "log"), "a");
@@ -1707,11 +1795,11 @@ function queueList(context, settings2) {
1707
1795
  return EXIT.ok;
1708
1796
  }
1709
1797
  if (snapshot.waiters.length === 0) context.ui.data("queue: empty\n");
1710
- for (const w of snapshot.waiters)
1711
- context.ui.data(
1712
- `${w.id} ${w.lane} position ${w.position} waited ${w.waited_s}s eta ${w.eta_s ?? "?"}s weight ${w.weight} pid ${w.pid} ${w.session ?? "-"} ${w.label}
1713
- `
1714
- );
1798
+ context.ui.results.records(
1799
+ snapshot.waiters.map(
1800
+ (w) => `${w.id} ${w.lane} position ${w.position} waited ${w.waited_s}s eta ${w.eta_s ?? "?"}s weight ${w.weight} pid ${w.pid} ${w.session ?? "-"} ${w.label}`
1801
+ )
1802
+ );
1715
1803
  return EXIT.ok;
1716
1804
  }
1717
1805
  function queuePromote(context, settings2, id) {
@@ -1720,6 +1808,7 @@ function queuePromote(context, settings2, id) {
1720
1808
  throw new ArgumentError(
1721
1809
  "promote starts a job at once: pass --now --reason <text>"
1722
1810
  );
1811
+ requireOperatorFor(context, "pmcp heavy promote --now");
1723
1812
  const paths = leasePaths(settings2.dir);
1724
1813
  return report(
1725
1814
  context,
@@ -1756,8 +1845,15 @@ function queueCancel(context, settings2, id) {
1756
1845
  return EXIT.ok;
1757
1846
  }
1758
1847
  const running = findRunning(paths, id);
1848
+ const force = context.args.flags.has("force");
1849
+ const owner = (ticket ? ticketOwner(settings2.dir, id) : null) ?? running?.session;
1850
+ if (force && owner !== void 0 && owner !== who(context).session)
1851
+ requireOperatorFor(
1852
+ context,
1853
+ `pmcp heavy cancel --force on another session's job (${owner})`
1854
+ );
1759
1855
  if (running !== null && !ticket) {
1760
- if (!context.args.flags.has("force")) {
1856
+ if (!force) {
1761
1857
  context.ui.error(`${id} is running; --force stops it`);
1762
1858
  return EXIT.failure;
1763
1859
  }
@@ -1770,7 +1866,7 @@ function queueCancel(context, settings2, id) {
1770
1866
  context.ui.error(waiting.why);
1771
1867
  return EXIT.failure;
1772
1868
  }
1773
- const done = cancel(settings2.dir, id, context.args.flags.has("force"));
1869
+ const done = cancel(settings2.dir, id, force);
1774
1870
  if (done === "running") {
1775
1871
  context.ui.error(`${id} is running; --force stops it`);
1776
1872
  return EXIT.failure;
@@ -1801,7 +1897,8 @@ function submitTicket(context, settings2, command) {
1801
1897
  ...command
1802
1898
  ],
1803
1899
  cwd: context.cwd,
1804
- env: context.env
1900
+ env: context.env,
1901
+ session: sessionOf(context.env, context.cwd)
1805
1902
  });
1806
1903
  context.ui.data(`${id}
1807
1904
  `);
@@ -1880,26 +1977,41 @@ function statLine(stat) {
1880
1977
  `write ${pair("write_bytes", 1e6, "MB")}`
1881
1978
  ].join(" ");
1882
1979
  }
1980
+ function top(context) {
1981
+ const text = one(context.args, "top");
1982
+ if (text === void 0) return void 0;
1983
+ const count = Number(text);
1984
+ if (!Number.isInteger(count) || count < 1)
1985
+ throw new ArgumentError("--top is a whole number of at least 1");
1986
+ return count;
1987
+ }
1883
1988
  function stats(context) {
1884
1989
  const records = readUsage(leasePaths(settings(context).dir).usage);
1885
- const found = usageStats(records);
1990
+ const limit = top(context);
1991
+ const found = usageStats(records).slice(0, limit);
1886
1992
  if (context.args.flags.has("json")) {
1887
1993
  context.ui.data(`${JSON.stringify(found)}
1888
1994
  `);
1889
1995
  return EXIT.ok;
1890
1996
  }
1891
- if (found.length === 0) context.ui.data("no usage recorded yet\n");
1997
+ const lines = [];
1998
+ if (found.length === 0) lines.push("no usage recorded yet");
1892
1999
  const { skipped, runs } = skipShare(records);
1893
2000
  if (runs > 0)
1894
- context.ui.data(
1895
- `skipped the lease: ${skipped} of ${runs} runs (${Math.round(skipped / runs * 100)}%)
1896
- `
2001
+ lines.push(
2002
+ `skipped the lease: ${skipped} of ${runs} runs (${Math.round(skipped / runs * 100)}%)`
1897
2003
  );
1898
- context.ui.data(
1899
- "signature @ dir samples p50/p90 of wall, cpu, rss, read, write\n"
2004
+ const reasons = skipReasons(records);
2005
+ const counted = (counts) => Object.entries(counts).sort(([a, x], [b, y]) => y - x || a.localeCompare(b)).map(([name, count]) => `${name} ${count}`).join(", ");
2006
+ if (Object.keys(reasons.honoured).length > 0)
2007
+ lines.push(`skip reasons: ${counted(reasons.honoured)}`);
2008
+ if (Object.keys(reasons.invalid).length > 0)
2009
+ lines.push(`refused skip reasons: ${counted(reasons.invalid)}`);
2010
+ lines.push(
2011
+ "signature @ dir samples p50/p90 of wall, cpu, rss, read, write"
1900
2012
  );
1901
- for (const stat of found) context.ui.data(`${statLine(stat)}
1902
- `);
2013
+ lines.push(...found.map(statLine));
2014
+ context.ui.results.records(lines);
1903
2015
  return EXIT.ok;
1904
2016
  }
1905
2017
  function verbs(context) {
@@ -1930,9 +2042,9 @@ function subcommand(context) {
1930
2042
  `);
1931
2043
  return EXIT.ok;
1932
2044
  }
1933
- for (const line of leaseStatus({ settings: lease, env: context.env }))
1934
- context.ui.data(`${line}
1935
- `);
2045
+ context.ui.results.records(
2046
+ leaseStatus({ settings: lease, env: context.env })
2047
+ );
1936
2048
  return EXIT.ok;
1937
2049
  }
1938
2050
  async function run(context) {
@@ -1972,6 +2084,7 @@ async function run(context) {
1972
2084
  if (now) throw new ArgumentError("--now runs at once; it is not submitted");
1973
2085
  return submitTicket(context, lease, args.passthrough);
1974
2086
  }
2087
+ if (now) requireOperatorFor(context, "pmcp heavy --now");
1975
2088
  const ticket = one(args, "ticket");
1976
2089
  let result = null;
1977
2090
  const config = one(args, "config") ?? findConfig(context.cwd);
@@ -1983,6 +2096,7 @@ async function run(context) {
1983
2096
  ...weight !== void 0 ? { weight } : {},
1984
2097
  ...now ? { now: reason2 } : {},
1985
2098
  root: config ? dirname(config) : context.cwd,
2099
+ operator: () => isOperator(context),
1986
2100
  ...ticket ? { id: ticket } : {},
1987
2101
  argv: args.passthrough,
1988
2102
  cwd: context.cwd,
@@ -2007,4 +2121,4 @@ var heavyCommand = { ...heavySpec, run };
2007
2121
  export {
2008
2122
  heavyCommand
2009
2123
  };
2010
- //# sourceMappingURL=heavy-G6CYQQ7O.js.map
2124
+ //# sourceMappingURL=heavy-HZQVFI6P.js.map