@modootoday/pmcp 0.22.13 → 0.24.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 (146) 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/CONTRIBUTING.md +8 -0
  6. package/dist/{affected-ZWO2F5EM.js → affected-D6FRJPPI.js} +2 -2
  7. package/dist/{apply-OIKQ5SIY.js → apply-6JVJ7FDZ.js} +21 -20
  8. package/dist/{available-Z5MIDFPH.js → available-74CMIBPD.js} +9 -9
  9. package/dist/{broadcast-BF2QL3O7.js → broadcast-VKZY7WSD.js} +3 -3
  10. package/dist/{chunk-K2VU3B4W.js → chunk-25M2YWBH.js} +4 -4
  11. package/dist/chunk-2GZKA33O.js +173 -0
  12. package/dist/chunk-2HL2MFNI.js +159 -0
  13. package/dist/{chunk-4O4ZOSBQ.js → chunk-2MX5C7B2.js} +3 -3
  14. package/dist/chunk-2W2F5BWF.js +166 -0
  15. package/dist/chunk-43MXRTKH.js +134 -0
  16. package/dist/chunk-4VVQLWTS.js +93 -0
  17. package/dist/{chunk-ZKB7ZNKY.js → chunk-56VBB3H7.js} +4 -4
  18. package/dist/{chunk-JEL35P7S.js → chunk-5NDUWEMW.js} +2 -2
  19. package/dist/{chunk-5PNS6V5C.js → chunk-5QBOGEVE.js} +2 -2
  20. package/dist/{chunk-NNGGNXF2.js → chunk-62BC3K4Z.js} +2 -2
  21. package/dist/{chunk-7ZOQELXR.js → chunk-644GNYMB.js} +3 -3
  22. package/dist/{chunk-GNVME5AD.js → chunk-6UGHVU5B.js} +2 -2
  23. package/dist/{chunk-733WVP2R.js → chunk-7A6QIROT.js} +3 -3
  24. package/dist/{chunk-J3QUG6O5.js → chunk-7CHUMF3E.js} +2 -2
  25. package/dist/{chunk-INT7QLEU.js → chunk-7DJQASH3.js} +25 -6
  26. package/dist/{chunk-VNZTULFD.js → chunk-D2MHB5EF.js} +3 -3
  27. package/dist/{chunk-KEHB4FZP.js → chunk-E2E4HIEN.js} +49 -3
  28. package/dist/{chunk-G4ATQPQI.js → chunk-F3R5HEUB.js} +5 -1
  29. package/dist/{chunk-JW5NMQTU.js → chunk-HES44LTA.js} +4 -4
  30. package/dist/{chunk-RHJEGLYM.js → chunk-HF5D6B2U.js} +45 -6
  31. package/dist/{chunk-5OFQVW2K.js → chunk-HYXOJYVR.js} +2 -2
  32. package/dist/{chunk-UED3RH53.js → chunk-ISGHJHVH.js} +2 -2
  33. package/dist/chunk-JANBBPKP.js +50 -0
  34. package/dist/{chunk-XNML2KIC.js → chunk-JPYQDOEW.js} +3 -3
  35. package/dist/{chunk-ZS5IDQFJ.js → chunk-K6ATERWS.js} +4 -4
  36. package/dist/{chunk-737BENAU.js → chunk-LB2WXBPA.js} +5 -5
  37. package/dist/{chunk-5IZFEVPW.js → chunk-LI3BII4F.js} +2 -2
  38. package/dist/chunk-LTMHE5VL.js +7 -0
  39. package/dist/{chunk-XSWF7APE.js → chunk-OGCJO6HQ.js} +9 -8
  40. package/dist/{chunk-A7XCUR2C.js → chunk-Q6V274OB.js} +8 -6
  41. package/dist/{chunk-ISGBOJT7.js → chunk-QR4GXET7.js} +3 -3
  42. package/dist/chunk-QR6A3TYP.js +315 -0
  43. package/dist/{chunk-FOLA4EUJ.js → chunk-QY2P54Z2.js} +10 -2
  44. package/dist/{chunk-EIDIVIAD.js → chunk-QYLOIM4U.js} +9 -2
  45. package/dist/{chunk-P5D6RKMT.js → chunk-RZYZILU4.js} +5 -3
  46. package/dist/{chunk-A6DARDQ4.js → chunk-S6G7YWNE.js} +2 -2
  47. package/dist/{chunk-24L4MO7H.js → chunk-TIH7JFPJ.js} +2 -2
  48. package/dist/{chunk-5KWDQFVY.js → chunk-UFWW4H6V.js} +7 -8
  49. package/dist/chunk-UVTGY2R3.js +78 -0
  50. package/dist/{chunk-LLT5FQBE.js → chunk-VBVNOLRR.js} +7 -3
  51. package/dist/{chunk-ABTJQ4QV.js → chunk-WBPVNCQO.js} +20 -5
  52. package/dist/{chunk-T4GVN7XO.js → chunk-WNP2BXR7.js} +5 -5
  53. package/dist/{chunk-YGOWIJPE.js → chunk-WZYGM3FR.js} +6 -2
  54. package/dist/chunk-Y6NFETNG.js +232 -0
  55. package/dist/{cli-IHVNE3WL.js → cli-GFDT4YXM.js} +14 -15
  56. package/dist/{cli-FSSYFCV3.js → cli-WWNTQJPV.js} +18 -12
  57. package/dist/cli.js +307 -47
  58. package/dist/{completion-ZTTJVV4C.js → completion-I63UIDZ7.js} +25 -23
  59. package/dist/{diagnostics-XC5L6Z3E.js → diagnostics-RUJZBPNZ.js} +6 -6
  60. package/dist/{doctor-FGDSUBR3.js → doctor-CLUFTEFO.js} +21 -21
  61. package/dist/{entry-NNB2CQLZ.js → entry-QSJCFI5Z.js} +10 -10
  62. package/dist/{exec-mcp-ZU3Z3XT6.js → exec-mcp-AFPUJTN7.js} +9 -9
  63. package/dist/{harness-B7ANLH5M.js → harness-PPM32AI5.js} +26 -44
  64. package/dist/harness-launch-gate.js +4 -4
  65. package/dist/harness-worker.js +6 -6
  66. package/dist/{heavy-IIZBO4YM.js → heavy-TEHP5PHT.js} +112 -27
  67. package/dist/hooks-L4PXVEGR.js +24 -0
  68. package/dist/{host-5P4D7GSE.js → host-LBTL47X7.js} +18 -15
  69. package/dist/{host-XXWQ23LD.js → host-MU2GRH57.js} +7 -7
  70. package/dist/{host-run-AEWHFVQL.js → host-run-IRSAQA5Z.js} +6 -6
  71. package/dist/http.js +1 -1
  72. package/dist/{import-mcp-BQM5DKYH.js → import-mcp-QVPW6A2Q.js} +12 -12
  73. package/dist/index.d.ts +1 -1
  74. package/dist/index.js +11 -10
  75. package/dist/init-46STH6FP.js +14 -0
  76. package/dist/{install-OFVLR7TI.js → install-5JH4DSFF.js} +10 -10
  77. package/dist/{invoke-3BQ5NG3P.js → invoke-I6C6UT6Q.js} +8 -8
  78. package/dist/{list-EU4MJOXA.js → list-HXG6EB7V.js} +12 -12
  79. package/dist/{list-WWYCGD3X.js → list-LV5EKCF6.js} +11 -7
  80. package/dist/{logout-6DFDYJUI.js → logout-SSUXJ6SE.js} +9 -9
  81. package/dist/{logs-BRF6DBKG.js → logs-2JEMSNSG.js} +7 -7
  82. package/dist/{mailbox-QYA2LQSE.js → mailbox-5FVFMQ2J.js} +6 -6
  83. package/dist/{mailbox-AQCTXO3H.js → mailbox-ZHZWZMAY.js} +14 -21
  84. package/dist/{mainline-O5AEHG3J.js → mainline-4XP6ZORU.js} +9 -8
  85. package/dist/{marketplace-TI5HFAHB.js → marketplace-2X3OOEPW.js} +10 -9
  86. package/dist/{mcp-HR5JFUW7.js → mcp-L6X45IOS.js} +4 -4
  87. package/dist/{mcp-4R53HSGY.js → mcp-PBTQ5SJW.js} +2 -2
  88. package/dist/{models-63NQBSV3.js → models-XSF45MCD.js} +9 -5
  89. package/dist/{pause-UF7FQDJX.js → pause-CMZOIHTJ.js} +3 -3
  90. package/dist/{preview-WSESS2UN.js → preview-465CQJBQ.js} +4 -4
  91. package/dist/{project-JXXL24WN.js → project-4JPKU2D7.js} +14 -12
  92. package/dist/{reindex-3GPKAFBW.js → reindex-D62HQAN2.js} +7 -7
  93. package/dist/{report-JUSKQPAC.js → report-UB7MXAUB.js} +10 -10
  94. package/dist/{resume-3WAROOQ3.js → resume-PAKIT4TT.js} +3 -3
  95. package/dist/run-OW7436TY.js +23 -0
  96. package/dist/{run-XRWU4L73.js → run-PMASXIGY.js} +8 -8
  97. package/dist/{serve-OEX5V5CD.js → serve-P3HJN6AF.js} +13 -13
  98. package/dist/{session-YZVX4NGN.js → session-3YVVO2GR.js} +6 -6
  99. package/dist/{setup-SWNAC2C7.js → setup-6AQUOWOH.js} +3 -2
  100. package/dist/{smoke-5BGJXAHX.js → smoke-6X6IXQIQ.js} +4 -4
  101. package/dist/{start-login-MG26NDE3.js → start-login-P7YDRTA3.js} +10 -10
  102. package/dist/{status-GKCIVAAR.js → status-4PYPTYUB.js} +4 -4
  103. package/dist/{status-LH7Q255G.js → status-DAXQKT35.js} +28 -27
  104. package/dist/{status-APADL7O2.js → status-DLGZDYEP.js} +18 -11
  105. package/dist/stdio.js +2 -2
  106. package/dist/{sweep-VTVPDAPY.js → sweep-VURZU6DI.js} +3 -3
  107. package/dist/{test-TK2J3IB7.js → test-H243OTSK.js} +12 -12
  108. package/dist/{tui-YTPHHKCW.js → tui-P6XTSTQO.js} +45 -19
  109. package/dist/{unbroadcast-CH7BAQ2G.js → unbroadcast-7AMLURCG.js} +3 -3
  110. package/dist/{validate-5QVZBE6W.js → validate-YXR7FJJX.js} +11 -9
  111. package/dist/{wait-4HYJJAWO.js → wait-HEODT7KV.js} +3 -3
  112. package/dist/{worker-RBXYAMR4.js → worker-5YJLIGTU.js} +8 -8
  113. package/dist/{worktree-create-FEZNQUQ6.js → worktree-create-FTSLMZWS.js} +2 -2
  114. package/docs/commands.md +65 -29
  115. package/docs/hooks.md +3 -3
  116. package/docs/project-configuration.md +54 -38
  117. package/docs/terminal-workspace.md +2 -0
  118. package/docs/upgrading.md +67 -0
  119. package/gemini-extension.json +2 -2
  120. package/mcp.json +1 -1
  121. package/package.json +5 -5
  122. package/plugin.json +1 -1
  123. package/plugins/pmcp/.claude-plugin/plugin.json +1 -1
  124. package/plugins/pmcp/.mcp.json +1 -1
  125. package/plugins/pmcp/gemini-extension.json +2 -2
  126. package/plugins/pmcp/mcp.json +1 -1
  127. package/plugins/pmcp/plugin.json +1 -1
  128. package/plugins/pmcp/skills/headless-agents-ci-scaffold/SKILL.md +1 -1
  129. package/plugins/pmcp/skills/pmcp-project-init/SKILL.md +1 -1
  130. package/plugins/pmcp/skills/pmcp-sessions-and-git/SKILL.md +3 -2
  131. package/skills/headless-agents-ci-scaffold/SKILL.md +1 -1
  132. package/skills/pmcp-project-init/SKILL.md +1 -1
  133. package/skills/pmcp-sessions-and-git/SKILL.md +3 -2
  134. package/dist/chunk-2P4Z2NUX.js +0 -28
  135. package/dist/chunk-3Y3HDMHA.js +0 -108
  136. package/dist/chunk-74O7KZUH.js +0 -45
  137. package/dist/chunk-BN4XAXMQ.js +0 -65
  138. package/dist/chunk-E3DQB5LS.js +0 -48
  139. package/dist/chunk-JWRZDYB5.js +0 -59
  140. package/dist/chunk-LMUBBIE2.js +0 -83
  141. package/dist/chunk-QBSJL3SP.js +0 -162
  142. package/dist/chunk-VSTUKACC.js +0 -7
  143. package/dist/chunk-WFY7ATSZ.js +0 -116
  144. package/dist/hooks-IEJTW7BV.js +0 -24
  145. package/dist/init-L6GUO3PW.js +0 -14
  146. package/dist/run-VUUQS4WY.js +0 -19
@@ -7,27 +7,27 @@ import {
7
7
  } from "./chunk-C3G75JH7.js";
8
8
  import {
9
9
  requireTerminal
10
- } from "./chunk-VNZTULFD.js";
10
+ } from "./chunk-D2MHB5EF.js";
11
11
  import "./chunk-5ZABTVSW.js";
12
12
  import {
13
13
  runTui
14
- } from "./chunk-NNGGNXF2.js";
14
+ } from "./chunk-62BC3K4Z.js";
15
15
  import {
16
16
  invoke
17
- } from "./chunk-T4GVN7XO.js";
17
+ } from "./chunk-WNP2BXR7.js";
18
18
  import {
19
19
  lockFile
20
20
  } from "./chunk-DZ2MRTYT.js";
21
21
  import "./chunk-LMT3PPXJ.js";
22
- import "./chunk-ISGBOJT7.js";
23
- import "./chunk-5IZFEVPW.js";
22
+ import "./chunk-QR4GXET7.js";
23
+ import "./chunk-LI3BII4F.js";
24
24
  import {
25
25
  locateExecutable
26
26
  } from "./chunk-R2GPCZUX.js";
27
- import "./chunk-GNVME5AD.js";
27
+ import "./chunk-6UGHVU5B.js";
28
28
  import "./chunk-34DECPVC.js";
29
- import "./chunk-733WVP2R.js";
30
- import "./chunk-FOLA4EUJ.js";
29
+ import "./chunk-7A6QIROT.js";
30
+ import "./chunk-QY2P54Z2.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-VSTUKACC.js";
38
+ import "./chunk-LTMHE5VL.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-NNB2CQLZ.js.map
311
+ //# sourceMappingURL=entry-QSJCFI5Z.js.map
@@ -8,11 +8,11 @@ import {
8
8
  } from "./chunk-UPQTAHUK.js";
9
9
  import {
10
10
  specFrom
11
- } from "./chunk-5KWDQFVY.js";
12
- import "./chunk-J3QUG6O5.js";
11
+ } from "./chunk-UFWW4H6V.js";
12
+ import "./chunk-7CHUMF3E.js";
13
13
  import {
14
14
  launch
15
- } from "./chunk-K2VU3B4W.js";
15
+ } from "./chunk-25M2YWBH.js";
16
16
  import "./chunk-UYBWUOLR.js";
17
17
  import "./chunk-UKR64U7J.js";
18
18
  import "./chunk-42SO7KYX.js";
@@ -22,7 +22,7 @@ import "./chunk-LFFIQBNY.js";
22
22
  import "./chunk-HQOB7OQS.js";
23
23
  import "./chunk-73AKO4UL.js";
24
24
  import "./chunk-M6X6HVQK.js";
25
- import "./chunk-P5D6RKMT.js";
25
+ import "./chunk-RZYZILU4.js";
26
26
  import "./chunk-SUDG7B6S.js";
27
27
  import "./chunk-3V37OZQH.js";
28
28
  import "./chunk-Z6WRFOFT.js";
@@ -31,10 +31,10 @@ import {
31
31
  McpAuthError
32
32
  } from "./chunk-Q5H3L6Y4.js";
33
33
  import "./chunk-ARXCYFFZ.js";
34
- import "./chunk-WFY7ATSZ.js";
35
34
  import "./chunk-V4NPDK6X.js";
36
- import "./chunk-733WVP2R.js";
37
- import "./chunk-FOLA4EUJ.js";
35
+ import "./chunk-Y6NFETNG.js";
36
+ import "./chunk-7A6QIROT.js";
37
+ import "./chunk-QY2P54Z2.js";
38
38
  import "./chunk-N7ANFMA5.js";
39
39
  import {
40
40
  ProjectError
@@ -44,7 +44,7 @@ import "./chunk-FQLCD4HU.js";
44
44
  import "./chunk-GUHOEIHP.js";
45
45
  import "./chunk-IJBSOWHK.js";
46
46
  import "./chunk-XWLMZKH2.js";
47
- import "./chunk-VSTUKACC.js";
47
+ import "./chunk-LTMHE5VL.js";
48
48
  import "./chunk-GJXOFDJT.js";
49
49
  import "./chunk-PMJG2CXF.js";
50
50
  import "./chunk-J6KL3COD.js";
@@ -370,4 +370,4 @@ function runExecMcp(context, name) {
370
370
  export {
371
371
  runExecMcp
372
372
  };
373
- //# sourceMappingURL=exec-mcp-ZU3Z3XT6.js.map
373
+ //# sourceMappingURL=exec-mcp-AFPUJTN7.js.map
@@ -6,52 +6,20 @@ import {
6
6
  unsupportedReceipt
7
7
  } from "./chunk-F5XMGOOX.js";
8
8
  import {
9
+ HARNESS_OPERATIONS,
9
10
  harnessSpec
10
- } from "./chunk-3Y3HDMHA.js";
11
+ } from "./chunk-QR6A3TYP.js";
11
12
  import {
12
13
  ArgumentError,
13
- one
14
- } from "./chunk-WFY7ATSZ.js";
14
+ one,
15
+ unknownSubcommand
16
+ } from "./chunk-Y6NFETNG.js";
15
17
  import {
16
18
  object
17
19
  } from "./chunk-5OMOPUE6.js";
18
20
 
19
21
  // src/commands/harness/invocation.ts
20
22
  import { readFileSync, statSync } from "fs";
21
- var common = ["group-file", "generation"];
22
- var options = {
23
- "capabilities:inspect": [],
24
- "doctor:inspect": [],
25
- "group:create": ["input"],
26
- "group:list": [],
27
- "group:inspect": ["group-file"],
28
- "group:configure": [...common, "input"],
29
- "group:pause": common,
30
- "group:resume": common,
31
- "group:stop": common,
32
- "session:start": [...common, "input"],
33
- "session:list": ["group-file"],
34
- "session:inspect": ["group-file", "session"],
35
- "session:read": ["group-file", "session", "input"],
36
- "session:watch": ["group-file", "session", "input"],
37
- "session:stop": [...common, "session"],
38
- "control:acquire": [...common, "session", "controller", "mode"],
39
- "control:renew": [...common, "lease-file"],
40
- "control:release": [...common, "lease-file"],
41
- "input:write": [...common, "lease-file", "request-id", "text-file"],
42
- "input:submit": [...common, "lease-file", "request-id"],
43
- "input:interrupt": [...common, "lease-file"],
44
- "attach:open": [...common, "session", "mode", "lease-file"],
45
- "attach:inspect": ["group-file", "session"],
46
- "attach:detach": [...common, "session"],
47
- "delivery:list": ["group-file"],
48
- "delivery:inspect": ["group-file", "request-id"],
49
- "recovery:inspect": ["group-file", "include-starts"],
50
- "recovery:reconcile": common,
51
- "recovery:replace-main": [...common, "input"],
52
- "recovery:stop-orphan": [...common, "session"],
53
- "recovery:abort-start": [...common, "session"]
54
- };
55
23
  function file(path) {
56
24
  const stat = statSync(path);
57
25
  if (!stat.isFile() || stat.size > 65536)
@@ -61,9 +29,23 @@ function file(path) {
61
29
  function parseInvocation(context) {
62
30
  const [family, action, ...extra] = context.args.positional;
63
31
  const key = `${family}:${action}`;
64
- const allowed = options[key];
65
- if (!family || !action || !allowed || extra.length > 0)
66
- throw new ArgumentError("Provide a supported family and operation");
32
+ const allowed = HARNESS_OPERATIONS[key]?.options;
33
+ const families = [
34
+ "layout",
35
+ "host",
36
+ "mcp",
37
+ ...new Set(
38
+ Object.keys(HARNESS_OPERATIONS).map((name) => name.split(":")[0])
39
+ )
40
+ ];
41
+ if (!family || !families.includes(family))
42
+ throw unknownSubcommand("harness", family, families);
43
+ if (!allowed || !action) {
44
+ const actions = Object.keys(HARNESS_OPERATIONS).filter((name) => name.startsWith(`${family}:`)).map((name) => name.slice(family.length + 1));
45
+ throw unknownSubcommand(`harness ${family}`, action, actions);
46
+ }
47
+ if (extra.length > 0)
48
+ throw new ArgumentError(`unexpected ${extra.join(" ")}`);
67
49
  for (const option of [
68
50
  ...context.args.options.keys(),
69
51
  ...context.args.flags
@@ -147,16 +129,16 @@ var harnessCommand = {
147
129
  }
148
130
  if (context.args.positional[0] === "layout") return runLayout(context);
149
131
  if (context.args.positional[0] === "mcp") {
150
- const { runPtyMcp } = await import("./mcp-4R53HSGY.js");
132
+ const { runPtyMcp } = await import("./mcp-PBTQ5SJW.js");
151
133
  return runPtyMcp(context);
152
134
  }
153
135
  if (context.args.positional[0] === "host") {
154
- const { runHost } = await import("./host-5P4D7GSE.js");
136
+ const { runHost } = await import("./host-LBTL47X7.js");
155
137
  return runHost(context);
156
138
  }
157
139
  try {
158
140
  const operation = parseInvocation(context);
159
- const { invoke } = await import("./invoke-3BQ5NG3P.js");
141
+ const { invoke } = await import("./invoke-I6C6UT6Q.js");
160
142
  const receipt = await invoke(operation);
161
143
  context.ui.data(`${JSON.stringify(receipt)}
162
144
  `);
@@ -174,4 +156,4 @@ var harnessCommand = {
174
156
  export {
175
157
  harnessCommand
176
158
  };
177
- //# sourceMappingURL=harness-B7ANLH5M.js.map
159
+ //# sourceMappingURL=harness-PPM32AI5.js.map
@@ -7,10 +7,10 @@ import {
7
7
  assertProof,
8
8
  assertResourceFresh,
9
9
  createProof
10
- } from "./chunk-GNVME5AD.js";
10
+ } from "./chunk-6UGHVU5B.js";
11
11
  import "./chunk-34DECPVC.js";
12
- import "./chunk-733WVP2R.js";
13
- import "./chunk-FOLA4EUJ.js";
12
+ import "./chunk-7A6QIROT.js";
13
+ import "./chunk-QY2P54Z2.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-VSTUKACC.js";
21
+ import "./chunk-LTMHE5VL.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-ISGBOJT7.js";
4
- import "./chunk-5IZFEVPW.js";
3
+ } from "./chunk-QR4GXET7.js";
4
+ import "./chunk-LI3BII4F.js";
5
5
  import "./chunk-R2GPCZUX.js";
6
- import "./chunk-GNVME5AD.js";
6
+ import "./chunk-6UGHVU5B.js";
7
7
  import "./chunk-34DECPVC.js";
8
- import "./chunk-733WVP2R.js";
9
- import "./chunk-FOLA4EUJ.js";
8
+ import "./chunk-7A6QIROT.js";
9
+ import "./chunk-QY2P54Z2.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-VSTUKACC.js";
17
+ import "./chunk-LTMHE5VL.js";
18
18
  import "./chunk-GJXOFDJT.js";
19
19
  import "./chunk-PMJG2CXF.js";
20
20
  import {
@@ -9,19 +9,19 @@ import {
9
9
  } from "./chunk-DZ2MRTYT.js";
10
10
  import {
11
11
  heavySpec
12
- } from "./chunk-BN4XAXMQ.js";
13
- import "./chunk-XNML2KIC.js";
12
+ } from "./chunk-43MXRTKH.js";
13
+ import "./chunk-JPYQDOEW.js";
14
14
  import {
15
15
  ArgumentError,
16
16
  EXIT,
17
17
  one
18
- } from "./chunk-WFY7ATSZ.js";
18
+ } from "./chunk-Y6NFETNG.js";
19
19
  import {
20
20
  BUSY_EXIT,
21
21
  DISABLE_ENV,
22
22
  NOW_ENV,
23
23
  leaseSettingsFor
24
- } from "./chunk-FOLA4EUJ.js";
24
+ } from "./chunk-QY2P54Z2.js";
25
25
  import {
26
26
  LANES,
27
27
  describeRecord,
@@ -57,6 +57,7 @@ import { constants } from "os";
57
57
 
58
58
  // src/lease/scope.ts
59
59
  import { spawnSync as spawnSync2 } from "child_process";
60
+ import { existsSync } from "fs";
60
61
  import { join as join2 } from "path";
61
62
 
62
63
  // src/lease/iocontrol.ts
@@ -119,10 +120,44 @@ function scopeCgroup(unit) {
119
120
  }
120
121
 
121
122
  // src/lease/scope.ts
122
- var scopeSeen;
123
- function scopeAvailable() {
124
- scopeSeen ??= process.platform === "linux" && spawnSync2("systemd-run", ["--user", "--version"], { stdio: "ignore" }).status === 0;
125
- return scopeSeen;
123
+ var BUS_FAILURE = /Failed to connect to (?:the )?bus/u;
124
+ var installed;
125
+ var probed = /* @__PURE__ */ new Map();
126
+ function probeScope(env) {
127
+ const run2 = spawnSync2("systemd-run", ["--user", "--scope", "-q", "true"], {
128
+ env,
129
+ encoding: "utf8",
130
+ stdio: ["ignore", "ignore", "pipe"],
131
+ timeout: 1e4
132
+ });
133
+ if (run2.status === 0) return null;
134
+ const line = (run2.stderr ?? "").trim().split("\n")[0];
135
+ return line || `systemd-run --user exited ${run2.status ?? "on a signal"}`;
136
+ }
137
+ function systemdRun() {
138
+ installed ??= spawnSync2("systemd-run", ["--user", "--version"], { stdio: "ignore" }).status === 0;
139
+ return installed;
140
+ }
141
+ function userManager(exists = existsSync, probe = probeScope, platform = process.platform, present = systemdRun) {
142
+ return {
143
+ unreachable(env) {
144
+ if (platform !== "linux") return "not Linux";
145
+ if (!present()) return "systemd-run is not installed";
146
+ const runtime = env["XDG_RUNTIME_DIR"];
147
+ if (!runtime) return "XDG_RUNTIME_DIR is not set";
148
+ const socket = exists(join2(runtime, "systemd", "private")) || exists(join2(runtime, "bus")) || Boolean(env["DBUS_SESSION_BUS_ADDRESS"]);
149
+ if (!socket) return `no user manager socket in ${runtime}`;
150
+ if (!probed.has(runtime)) probed.set(runtime, probe(env));
151
+ return probed.get(runtime) ?? null;
152
+ }
153
+ };
154
+ }
155
+ function lost(memoryMax, io2) {
156
+ const parts = [
157
+ ...memoryMax === void 0 ? [] : [`MemoryMax=${memoryMax}`],
158
+ ...io2 ? ["io.weight"] : []
159
+ ];
160
+ return parts.join(" and ");
126
161
  }
127
162
  function wantsIo(settings2, lane, host) {
128
163
  if (lane === null || settings2.io.enabled === false) return false;
@@ -147,14 +182,14 @@ async function weigh(unit, settings2, lane, host, say, onCgroup) {
147
182
  }
148
183
  }
149
184
  function scoped(argv, settings2, lane, memoryMax, say, onCgroup = () => {
150
- }, host = cgroupHost()) {
185
+ }, host = cgroupHost(), manager = userManager(), env = process.env) {
151
186
  const io2 = wantsIo(settings2, lane, host);
152
187
  if (memoryMax === void 0 && !io2) return { argv };
153
- if (!scopeAvailable()) {
154
- if (memoryMax !== void 0)
155
- say(
156
- `systemd-run --user is unavailable; running without MemoryMax=${memoryMax}`
157
- );
188
+ const reason2 = manager.unreachable(env);
189
+ if (reason2 !== null) {
190
+ say(
191
+ `no systemd user scope (${reason2}); running without ${lost(memoryMax, io2)}`
192
+ );
158
193
  return { argv };
159
194
  }
160
195
  const unit = `pmcp-heavy-${process.pid}-${Date.now()}`;
@@ -170,6 +205,7 @@ function scoped(argv, settings2, lane, memoryMax, say, onCgroup = () => {
170
205
  "--",
171
206
  ...argv
172
207
  ],
208
+ unscoped: argv,
173
209
  ...io2 && lane !== null ? { started: () => weigh(unit, settings2, lane, host, say, onCgroup) } : {}
174
210
  };
175
211
  }
@@ -489,7 +525,20 @@ function acquireLease(options) {
489
525
  if (!settings2.enabled) return { kind: "disabled" };
490
526
  const paths = leasePaths(settings2.dir);
491
527
  const skip = skipReason(settings2, env);
492
- if (skip !== null) {
528
+ const refused = skip !== null && options.lane === "bulk" && !settings2.skipAlways.includes(skip);
529
+ if (refused && reentrant(settings2, env)) return { kind: "reentrant" };
530
+ if (skip !== null && refused) {
531
+ say(
532
+ `the lease skip (${skip}) is not honoured for a bulk job (--lane bulk, or a [[host.lease.commands]] entry with lane = "bulk"); it queues in the bulk lane. For an emergency run: pmcp heavy --now --reason <text> -- <command>`
533
+ );
534
+ logEvent(
535
+ paths,
536
+ process.pid,
537
+ "skip-refused",
538
+ `reason=${skip} cwd=${options.cwd} label=${label}`
539
+ );
540
+ }
541
+ if (skip !== null && !refused) {
493
542
  say(`running without the host lease: ${skip}`);
494
543
  logEvent(
495
544
  paths,
@@ -695,6 +744,13 @@ var METRICS = [
695
744
  "read_bytes",
696
745
  "write_bytes"
697
746
  ];
747
+ function skipShare(records) {
748
+ const ran = records.filter((record2) => record2.outcome === "ran");
749
+ return {
750
+ skipped: ran.filter((record2) => record2.skip !== void 0).length,
751
+ runs: ran.length
752
+ };
753
+ }
698
754
  function percentile(values, share) {
699
755
  const sorted = [...values].sort((a, b) => a - b);
700
756
  return sorted[Math.min(sorted.length - 1, Math.floor(sorted.length * share))] ?? 0;
@@ -721,6 +777,7 @@ function usageStats(records) {
721
777
  samples: ran.length,
722
778
  failed: ran.filter((record2) => record2.exit !== 0).length,
723
779
  timeouts: list.length - ran.length,
780
+ skipped: ran.filter((record2) => record2.skip !== void 0).length,
724
781
  p50: pick(0.5),
725
782
  p90: pick(0.9)
726
783
  };
@@ -865,13 +922,21 @@ function laneFor(run2) {
865
922
  return { lane, weight };
866
923
  }
867
924
  var SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
925
+ var HEAD = 2048;
868
926
  function execute(argv, run2, extra, watch) {
869
927
  const [bin, ...rest] = argv;
870
928
  return new Promise((resolve) => {
871
929
  const child = spawn(bin ?? "true", rest, {
872
930
  cwd: run2.cwd,
873
931
  env: { ...run2.env, ...extra },
874
- stdio: "inherit"
932
+ stdio: ["inherit", "inherit", watch.stderrHead ? "pipe" : "inherit"]
933
+ });
934
+ let head = "";
935
+ child.stderr?.on("data", (chunk) => {
936
+ process.stderr.write(chunk);
937
+ if (head.length >= HEAD) return;
938
+ head += chunk.toString("utf8");
939
+ watch.stderrHead?.(head.slice(0, HEAD));
875
940
  });
876
941
  void watch.started?.();
877
942
  const forward = (signal) => child.kill(signal);
@@ -975,26 +1040,38 @@ async function runHeavy(run2) {
975
1040
  const memoryMax = run2.settings.profiles[run2.profile]?.memoryMax;
976
1041
  const held2 = outcome.kind === "held" ? outcome : null;
977
1042
  const sampler = new Sampler();
978
- const { argv, started } = scoped(
1043
+ const { argv, started, unscoped } = scoped(
979
1044
  run2.argv,
980
1045
  run2.settings,
981
1046
  held2 ? lane : null,
982
1047
  memoryMax,
983
1048
  run2.say,
984
- (dir) => sampler.useCgroup(dir)
1049
+ (dir) => sampler.useCgroup(dir),
1050
+ void 0,
1051
+ void 0,
1052
+ run2.env
985
1053
  );
986
1054
  const warn = held2 ? holdWarner(run2, epoch()) : () => {
987
1055
  };
1056
+ const tick = (pid) => {
1057
+ warn();
1058
+ sampler.sample(pid);
1059
+ };
988
1060
  const begun = Date.now();
989
1061
  let code = 1;
1062
+ let head = "";
990
1063
  try {
991
1064
  code = await execute(argv, run2, held2?.env ?? {}, {
992
- tick: (pid) => {
993
- warn();
994
- sampler.sample(pid);
995
- },
996
- ...started ? { started } : {}
1065
+ tick,
1066
+ ...started ? { started } : {},
1067
+ ...unscoped ? { stderrHead: (text) => head = text } : {}
997
1068
  });
1069
+ if (code !== 0 && unscoped && BUS_FAILURE.test(head.split("\n")[0] ?? "")) {
1070
+ run2.say(
1071
+ "systemd-run could not reach the user manager; running the command again without the scope"
1072
+ );
1073
+ code = await execute(unscoped, run2, held2?.env ?? {}, { tick });
1074
+ }
998
1075
  } finally {
999
1076
  const wall = Math.round((Date.now() - begun) / 100) / 10;
1000
1077
  held2?.release(code, Math.round(wall));
@@ -1006,7 +1083,8 @@ async function runHeavy(run2) {
1006
1083
  weight,
1007
1084
  start: held2 ? held2.start : "none",
1008
1085
  outcome: "ran",
1009
- exit: code
1086
+ exit: code,
1087
+ ...outcome.kind === "skipped" ? { skip: outcome.reason } : {}
1010
1088
  });
1011
1089
  }
1012
1090
  return code;
@@ -1778,7 +1856,7 @@ function statLine(stat) {
1778
1856
  };
1779
1857
  return [
1780
1858
  stat.signature,
1781
- `samples ${stat.samples} (failed ${stat.failed}, timeouts ${stat.timeouts})`,
1859
+ `samples ${stat.samples} (failed ${stat.failed}, timeouts ${stat.timeouts}, skipped the lease ${stat.skipped})`,
1782
1860
  `wall ${pair("wall_s", 1, "s")}`,
1783
1861
  `cpu ${Math.round(cpu.p50)}/${Math.round(cpu.p90)}s`,
1784
1862
  `rss ${pair("max_rss_kb", 1024, "MB")}`,
@@ -1787,13 +1865,20 @@ function statLine(stat) {
1787
1865
  ].join(" ");
1788
1866
  }
1789
1867
  function stats(context) {
1790
- const found = usageStats(readUsage(leasePaths(settings(context).dir).usage));
1868
+ const records = readUsage(leasePaths(settings(context).dir).usage);
1869
+ const found = usageStats(records);
1791
1870
  if (context.args.flags.has("json")) {
1792
1871
  context.ui.data(`${JSON.stringify(found)}
1793
1872
  `);
1794
1873
  return EXIT.ok;
1795
1874
  }
1796
1875
  if (found.length === 0) context.ui.data("no usage recorded yet\n");
1876
+ const { skipped, runs } = skipShare(records);
1877
+ if (runs > 0)
1878
+ context.ui.data(
1879
+ `skipped the lease: ${skipped} of ${runs} runs (${Math.round(skipped / runs * 100)}%)
1880
+ `
1881
+ );
1797
1882
  context.ui.data(
1798
1883
  "signature @ dir samples p50/p90 of wall, cpu, rss, read, write\n"
1799
1884
  );
@@ -1906,4 +1991,4 @@ var heavyCommand = { ...heavySpec, run };
1906
1991
  export {
1907
1992
  heavyCommand
1908
1993
  };
1909
- //# sourceMappingURL=heavy-IIZBO4YM.js.map
1994
+ //# sourceMappingURL=heavy-TEHP5PHT.js.map
@@ -0,0 +1,24 @@
1
+ import {
2
+ hooksSpec
3
+ } from "./chunk-E2E4HIEN.js";
4
+ import "./chunk-JPYQDOEW.js";
5
+ import {
6
+ ArgumentError,
7
+ unknownSubcommand
8
+ } from "./chunk-Y6NFETNG.js";
9
+
10
+ // src/commands/hooks.ts
11
+ var VERBS = ["list", "test", "report"];
12
+ async function run(context) {
13
+ const [verb = "list", ...extra] = context.args.positional;
14
+ if (!VERBS.includes(verb)) throw unknownSubcommand("hooks", verb, VERBS);
15
+ if (extra.length) throw new ArgumentError(`unexpected ${extra.join(" ")}`);
16
+ if (verb === "list") return (await import("./list-HXG6EB7V.js")).run(context);
17
+ if (verb === "test") return (await import("./test-H243OTSK.js")).run(context);
18
+ return (await import("./report-UB7MXAUB.js")).run(context);
19
+ }
20
+ var hooksCommand = { ...hooksSpec, run };
21
+ export {
22
+ hooksCommand
23
+ };
24
+ //# sourceMappingURL=hooks-L4PXVEGR.js.map
@@ -4,16 +4,16 @@ import {
4
4
  } from "./chunk-F5XMGOOX.js";
5
5
  import {
6
6
  specFrom
7
- } from "./chunk-5KWDQFVY.js";
8
- import "./chunk-J3QUG6O5.js";
7
+ } from "./chunk-UFWW4H6V.js";
8
+ import "./chunk-7CHUMF3E.js";
9
9
  import {
10
10
  approvalDir,
11
11
  approvalState,
12
12
  hostDigest,
13
13
  projectedFiles,
14
14
  writeApproval
15
- } from "./chunk-A6DARDQ4.js";
16
- import "./chunk-K2VU3B4W.js";
15
+ } from "./chunk-S6G7YWNE.js";
16
+ import "./chunk-25M2YWBH.js";
17
17
  import "./chunk-UYBWUOLR.js";
18
18
  import "./chunk-UKR64U7J.js";
19
19
  import "./chunk-42SO7KYX.js";
@@ -23,7 +23,7 @@ import "./chunk-LFFIQBNY.js";
23
23
  import "./chunk-HQOB7OQS.js";
24
24
  import "./chunk-73AKO4UL.js";
25
25
  import "./chunk-M6X6HVQK.js";
26
- import "./chunk-P5D6RKMT.js";
26
+ import "./chunk-RZYZILU4.js";
27
27
  import "./chunk-SUDG7B6S.js";
28
28
  import "./chunk-3V37OZQH.js";
29
29
  import {
@@ -32,14 +32,15 @@ import {
32
32
  import "./chunk-B3OZ4GGO.js";
33
33
  import "./chunk-Q5H3L6Y4.js";
34
34
  import "./chunk-ARXCYFFZ.js";
35
- import {
36
- ArgumentError
37
- } from "./chunk-WFY7ATSZ.js";
38
35
  import "./chunk-V4NPDK6X.js";
36
+ import {
37
+ ArgumentError,
38
+ unknownSubcommand
39
+ } from "./chunk-Y6NFETNG.js";
39
40
  import {
40
41
  hostDoctor
41
- } from "./chunk-733WVP2R.js";
42
- import "./chunk-FOLA4EUJ.js";
42
+ } from "./chunk-7A6QIROT.js";
43
+ import "./chunk-QY2P54Z2.js";
43
44
  import "./chunk-N7ANFMA5.js";
44
45
  import "./chunk-TYY5TYHF.js";
45
46
  import "./chunk-T6C3TSTO.js";
@@ -47,7 +48,7 @@ import "./chunk-FQLCD4HU.js";
47
48
  import "./chunk-GUHOEIHP.js";
48
49
  import "./chunk-IJBSOWHK.js";
49
50
  import "./chunk-XWLMZKH2.js";
50
- import "./chunk-VSTUKACC.js";
51
+ import "./chunk-LTMHE5VL.js";
51
52
  import "./chunk-GJXOFDJT.js";
52
53
  import "./chunk-PMJG2CXF.js";
53
54
  import "./chunk-J6KL3COD.js";
@@ -176,8 +177,10 @@ async function ask(question) {
176
177
  var VERBS = ["approve", "status", "up", "down", "unit"];
177
178
  async function runHost(context) {
178
179
  const [, verb, ...extra] = context.args.positional;
179
- if (extra.length > 0 || !verb || !VERBS.includes(verb))
180
- throw new ArgumentError(`Provide host ${VERBS.join(" | ")}`);
180
+ if (!verb || !VERBS.includes(verb))
181
+ throw unknownSubcommand("harness host", verb, VERBS);
182
+ if (extra.length > 0)
183
+ throw new ArgumentError(`unexpected ${extra.join(" ")}`);
181
184
  const spec = specFrom(context);
182
185
  if (!spec.host) throw new ArgumentError("pmcp.toml has no [host] table");
183
186
  const refused = hostVerbUnsupported(verb);
@@ -187,7 +190,7 @@ async function runHost(context) {
187
190
  return 1;
188
191
  }
189
192
  if (verb === "up" || verb === "down" || verb === "unit") {
190
- const { runHostVerb } = await import("./host-run-AEWHFVQL.js");
193
+ const { runHostVerb } = await import("./host-run-IRSAQA5Z.js");
191
194
  return runHostVerb(verb, spec, context);
192
195
  }
193
196
  if (verb === "status") {
@@ -215,4 +218,4 @@ async function runHost(context) {
215
218
  export {
216
219
  runHost
217
220
  };
218
- //# sourceMappingURL=host-5P4D7GSE.js.map
221
+ //# sourceMappingURL=host-LBTL47X7.js.map
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  requireTerminal,
3
3
  terminalSupport
4
- } from "./chunk-VNZTULFD.js";
4
+ } from "./chunk-D2MHB5EF.js";
5
5
  import "./chunk-5ZABTVSW.js";
6
- import "./chunk-NNGGNXF2.js";
6
+ import "./chunk-62BC3K4Z.js";
7
7
  import "./chunk-LMT3PPXJ.js";
8
- import "./chunk-5IZFEVPW.js";
8
+ import "./chunk-LI3BII4F.js";
9
9
  import "./chunk-R2GPCZUX.js";
10
10
  import "./chunk-34DECPVC.js";
11
- import "./chunk-733WVP2R.js";
12
- import "./chunk-FOLA4EUJ.js";
11
+ import "./chunk-7A6QIROT.js";
12
+ import "./chunk-QY2P54Z2.js";
13
13
  import "./chunk-N7ANFMA5.js";
14
14
  import "./chunk-TYY5TYHF.js";
15
15
  import "./chunk-T6C3TSTO.js";
@@ -17,7 +17,7 @@ import "./chunk-FQLCD4HU.js";
17
17
  import "./chunk-GUHOEIHP.js";
18
18
  import "./chunk-IJBSOWHK.js";
19
19
  import "./chunk-XWLMZKH2.js";
20
- import "./chunk-VSTUKACC.js";
20
+ import "./chunk-LTMHE5VL.js";
21
21
  import "./chunk-GJXOFDJT.js";
22
22
  import "./chunk-PMJG2CXF.js";
23
23
  import "./chunk-J6KL3COD.js";
@@ -25,4 +25,4 @@ export {
25
25
  requireTerminal,
26
26
  terminalSupport
27
27
  };
28
- //# sourceMappingURL=host-XXWQ23LD.js.map
28
+ //# sourceMappingURL=host-MU2GRH57.js.map