@modootoday/pmcp 0.24.1 → 0.26.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 (116) 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/{affected-IPFJM2KD.js → affected-4FILH743.js} +174 -77
  6. package/dist/{apply-CDJQJAZH.js → apply-HJUCYQDQ.js} +18 -15
  7. package/dist/{broadcast-VKZY7WSD.js → broadcast-U7ZYOJWE.js} +7 -4
  8. package/dist/{chunk-GEDRPMBH.js → chunk-2GL5L2G5.js} +2 -2
  9. package/dist/{chunk-AQM2JZMB.js → chunk-2JUHFM4V.js} +2 -2
  10. package/dist/{chunk-UKR64U7J.js → chunk-374AZ4J4.js} +2 -2
  11. package/dist/{chunk-MZ52S4YJ.js → chunk-3JOFDNL4.js} +2 -2
  12. package/dist/{chunk-264DIB5U.js → chunk-3KISMGVP.js} +4 -4
  13. package/dist/{chunk-V5PXMLLL.js → chunk-6XE3WW7S.js} +3 -3
  14. package/dist/{chunk-7CGGDX7X.js → chunk-7FHOSWNQ.js} +2 -2
  15. package/dist/{chunk-5NQZGNKT.js → chunk-7PBWLYCO.js} +3 -3
  16. package/dist/{chunk-2GZKA33O.js → chunk-A4P3IIPE.js} +2 -2
  17. package/dist/{chunk-3O3JZTUU.js → chunk-C7Y2MBCN.js} +3 -3
  18. package/dist/chunk-D7IDT7OA.js +21 -0
  19. package/dist/chunk-E272CFPS.js +14 -0
  20. package/dist/chunk-FLG7VRTC.js +1 -0
  21. package/dist/{chunk-X3RUXLAV.js → chunk-FXDGW2IH.js} +3 -3
  22. package/dist/{chunk-DLIO2D7S.js → chunk-GIL3RBRX.js} +27 -20
  23. package/dist/{chunk-ARXCYFFZ.js → chunk-GQRDEIQA.js} +22 -2
  24. package/dist/chunk-J43Z4O3G.js +7 -0
  25. package/dist/chunk-KLIYFD3W.js +32 -0
  26. package/dist/{chunk-PG62GOPU.js → chunk-KQV2EPAP.js} +2 -2
  27. package/dist/{chunk-LNKAR3IS.js → chunk-LCPCRZ7N.js} +2 -2
  28. package/dist/chunk-NQCAKDRY.js +156 -0
  29. package/dist/{chunk-3SEJNT6F.js → chunk-NQZMGQFG.js} +5 -5
  30. package/dist/{chunk-DGXZBQCA.js → chunk-OBCBCLS2.js} +7 -7
  31. package/dist/{chunk-D4FIBB2G.js → chunk-OG2ESRQP.js} +5 -5
  32. package/dist/{chunk-43MXRTKH.js → chunk-OHCUPXU4.js} +26 -8
  33. package/dist/chunk-OIKT4SYO.js +42 -0
  34. package/dist/{chunk-3V37OZQH.js → chunk-PAY6HEEY.js} +2 -2
  35. package/dist/{chunk-QY2P54Z2.js → chunk-PZ6D3WKD.js} +125 -8
  36. package/dist/{chunk-MOKZPZZO.js → chunk-Q5BQIRM3.js} +2 -2
  37. package/dist/{chunk-VYQJPT27.js → chunk-S2FUWBLO.js} +18 -4
  38. package/dist/{chunk-OGCJO6HQ.js → chunk-TQRLWO4F.js} +2 -2
  39. package/dist/{chunk-VBWB2T3C.js → chunk-UVPIVSZB.js} +14 -6
  40. package/dist/{chunk-MHKY6TNF.js → chunk-VN34GLGJ.js} +3 -3
  41. package/dist/chunk-WUFNKK3U.js +71 -0
  42. package/dist/{chunk-2ZH77O2D.js → chunk-Y7FYCVUK.js} +646 -103
  43. package/dist/{chunk-HES44LTA.js → chunk-YJVSN6UN.js} +29 -5
  44. package/dist/{chunk-EWYLWBKS.js → chunk-YKICVMF7.js} +22 -5
  45. package/dist/{cli-OV5LSSGE.js → cli-FVUHK2NB.js} +7 -7
  46. package/dist/{cli-GFDT4YXM.js → cli-ZOY2274X.js} +9 -9
  47. package/dist/cli.js +40 -6
  48. package/dist/{completion-QNDCU4MF.js → completion-ZKWGPMEK.js} +6 -5
  49. package/dist/{diagnostics-TPK3VC5F.js → diagnostics-IM2OPAPL.js} +7 -7
  50. package/dist/{doctor-K2LADSW2.js → doctor-VZTHEPVC.js} +32 -20
  51. package/dist/{entry-HFQHKL5L.js → entry-Q4EI4PNO.js} +13 -13
  52. package/dist/{exec-mcp-I2YGGWY4.js → exec-mcp-AWGUQVT2.js} +15 -12
  53. package/dist/{harness-BMWGAXCF.js → harness-L4C5XWKR.js} +3 -3
  54. package/dist/harness-launch-gate.js +5 -5
  55. package/dist/harness-worker.js +7 -7
  56. package/dist/{heavy-G6CYQQ7O.js → heavy-OG3UVZNY.js} +327 -131
  57. package/dist/hook-body.js +664 -161
  58. package/dist/{hook-spec-Bd24eo2L.d.ts → hook-spec-u7hnz571.d.ts} +10 -0
  59. package/dist/{hooks-R7AYQXHY.js → hooks-2E6PJJQK.js} +4 -4
  60. package/dist/{host-PLE2T55E.js → host-OQDBQJB2.js} +8 -8
  61. package/dist/{host-EUD6GLWV.js → host-RJJGTKWA.js} +20 -65
  62. package/dist/{host-run-QFNGIDL5.js → host-run-PWCIXJDN.js} +6 -6
  63. package/dist/http.js +1 -1
  64. package/dist/{import-mcp-DVKJOEOE.js → import-mcp-2H2NRUCL.js} +14 -11
  65. package/dist/index.d.ts +2 -2
  66. package/dist/index.js +18 -15
  67. package/dist/{init-DKWNL62M.js → init-O2UCU2WT.js} +2 -2
  68. package/dist/{invoke-U6JTPTXT.js → invoke-SJ3JHRJU.js} +9 -9
  69. package/dist/{list-YKQFJN3G.js → list-SJVXZGKK.js} +17 -14
  70. package/dist/{logout-5YSKC46N.js → logout-ROKXWR3T.js} +15 -12
  71. package/dist/{logs-2JEMSNSG.js → logs-J4W6GFMK.js} +4 -4
  72. package/dist/{mailbox-5FVFMQ2J.js → mailbox-6MHH6CUA.js} +22 -8
  73. package/dist/{mainline-D3PSR6AJ.js → mainline-SWZPKA7U.js} +19 -9
  74. package/dist/{mcp-CHKKXHBB.js → mcp-U7MVFAB4.js} +2 -2
  75. package/dist/owners-MPI22SFU.js +63 -0
  76. package/dist/{pause-CMZOIHTJ.js → pause-3IMVYXQQ.js} +7 -4
  77. package/dist/project/hook-adapter.d.ts +1 -1
  78. package/dist/{project-QEYXISHC.js → project-MGUYHUF7.js} +4 -4
  79. package/dist/{report-UB7MXAUB.js → report-MWXB5XKE.js} +5 -5
  80. package/dist/{resume-PAKIT4TT.js → resume-7LCSV4X3.js} +7 -4
  81. package/dist/{run-HKMYYEZJ.js → run-DDWLS6FY.js} +14 -11
  82. package/dist/{run-FYKDIW4C.js → run-TBO5JO4Y.js} +4 -4
  83. package/dist/{serve-QZNG5UUV.js → serve-RBQYB3FP.js} +3 -3
  84. package/dist/{setup-GRWLDBVB.js → setup-7JHWLV7K.js} +6 -4
  85. package/dist/{smoke-6X6IXQIQ.js → smoke-GZECLXOJ.js} +3 -3
  86. package/dist/{start-login-4GPM32RA.js → start-login-SOTNDUP6.js} +15 -12
  87. package/dist/{status-55CD352M.js → status-EBIUQIGY.js} +35 -30
  88. package/dist/{status-4PYPTYUB.js → status-QFMN7IUG.js} +8 -5
  89. package/dist/{status-W6SCF2GF.js → status-TSTOFNZU.js} +15 -12
  90. package/dist/stdio.js +2 -2
  91. package/dist/{sweep-VURZU6DI.js → sweep-BS7HVSNP.js} +7 -4
  92. package/dist/{test-XYEMYZ2P.js → test-4PZHHWOQ.js} +28 -16
  93. package/dist/{tui-FXSWN2PV.js → tui-QD2LMXHV.js} +4 -4
  94. package/dist/{unbroadcast-7AMLURCG.js → unbroadcast-GRGX3F6T.js} +7 -4
  95. package/dist/{worker-Q4I4EIAJ.js → worker-SPJ4HFWV.js} +11 -11
  96. package/dist/{worktree-list-2HV6ODBS.js → worktree-list-WZC75NLF.js} +8 -9
  97. package/dist/{worktree-sync-MUVKK2CV.js → worktree-sync-BQZD4J73.js} +5 -2
  98. package/docs/commands.md +18 -7
  99. package/docs/git-workflow.md +40 -5
  100. package/docs/glossary.md +1 -1
  101. package/docs/hooks.md +75 -16
  102. package/docs/project-configuration.md +136 -40
  103. package/docs/sessions.md +9 -2
  104. package/docs/upgrading.md +71 -0
  105. package/gemini-extension.json +2 -2
  106. package/mcp.json +1 -1
  107. package/package.json +5 -5
  108. package/plugin.json +1 -1
  109. package/plugins/pmcp/.claude-plugin/plugin.json +1 -1
  110. package/plugins/pmcp/.mcp.json +1 -1
  111. package/plugins/pmcp/gemini-extension.json +2 -2
  112. package/plugins/pmcp/mcp.json +1 -1
  113. package/plugins/pmcp/plugin.json +1 -1
  114. package/dist/chunk-65H4PN33.js +0 -7
  115. package/dist/chunk-7TD53M7L.js +0 -13
  116. package/dist/chunk-FQLCD4HU.js +0 -24
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-5ZABTVSW.js";
4
4
  import {
5
5
  dependencies
6
- } from "./chunk-AQM2JZMB.js";
6
+ } from "./chunk-2JUHFM4V.js";
7
7
  import {
8
8
  interactiveEntry
9
9
  } from "./chunk-LMT3PPXJ.js";
10
10
  import {
11
11
  assertNativeHost
12
- } from "./chunk-MZ52S4YJ.js";
12
+ } from "./chunk-3JOFDNL4.js";
13
13
 
14
14
  // src/tui/startup/host.ts
15
15
  function terminalSupport() {
@@ -42,4 +42,4 @@ export {
42
42
  terminalSupport,
43
43
  requireTerminal
44
44
  };
45
- //# sourceMappingURL=chunk-3O3JZTUU.js.map
45
+ //# sourceMappingURL=chunk-C7Y2MBCN.js.map
@@ -0,0 +1,21 @@
1
+ import {
2
+ jsonOption,
3
+ nearestConfigOption
4
+ } from "./chunk-JPYQDOEW.js";
5
+
6
+ // src/commands/specs/owners.ts
7
+ var ownersSpec = {
8
+ name: "owners",
9
+ examples: [
10
+ "pmcp owners services/auth/src/login.ts",
11
+ "pmcp owners docs --json"
12
+ ],
13
+ describe: "Who looks after a path, from [[owners]] in pmcp.toml",
14
+ usage: "pmcp owners <path>... [--config <file>] [--json]",
15
+ options: [nearestConfigOption, jsonOption]
16
+ };
17
+
18
+ export {
19
+ ownersSpec
20
+ };
21
+ //# sourceMappingURL=chunk-D7IDT7OA.js.map
@@ -0,0 +1,14 @@
1
+ // src/hooks/inspection/source.ts
2
+ function sourceFor(id) {
3
+ if (id.startsWith("custom.")) return "hooks.guards.custom";
4
+ if (id.startsWith("external.")) return "hooks.guards.external";
5
+ if (id.startsWith("checks.")) return "hooks." + id;
6
+ if (id === "owners" || id.startsWith("sessions.") || id.startsWith("git.worktrees") || id === "git.shared_checkout" || id === "git.mainline.deliver")
7
+ return id;
8
+ return "hooks.guards." + id;
9
+ }
10
+
11
+ export {
12
+ sourceFor
13
+ };
14
+ //# sourceMappingURL=chunk-E272CFPS.js.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-FLG7VRTC.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  assertNativeHost
3
- } from "./chunk-MZ52S4YJ.js";
3
+ } from "./chunk-3JOFDNL4.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-LNKAR3IS.js";
36
+ } from "./chunk-LCPCRZ7N.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-X3RUXLAV.js.map
1984
+ //# sourceMappingURL=chunk-FXDGW2IH.js.map
@@ -1,10 +1,10 @@
1
+ import {
2
+ marketplaceSpec
3
+ } from "./chunk-JANBBPKP.js";
1
4
  import {
2
5
  harnessSpec,
3
6
  tuiSpec
4
7
  } from "./chunk-QR6A3TYP.js";
5
- import {
6
- marketplaceSpec
7
- } from "./chunk-JANBBPKP.js";
8
8
  import {
9
9
  mcpSpec
10
10
  } from "./chunk-UVTGY2R3.js";
@@ -16,13 +16,16 @@ import {
16
16
  } from "./chunk-4VVQLWTS.js";
17
17
  import {
18
18
  heavySpec
19
- } from "./chunk-43MXRTKH.js";
19
+ } from "./chunk-OHCUPXU4.js";
20
20
  import {
21
21
  waitSpec
22
22
  } from "./chunk-F3R5HEUB.js";
23
+ import {
24
+ ownersSpec
25
+ } from "./chunk-D7IDT7OA.js";
23
26
  import {
24
27
  sessionsSpec
25
- } from "./chunk-2GZKA33O.js";
28
+ } from "./chunk-A4P3IIPE.js";
26
29
  import {
27
30
  logsSpec
28
31
  } from "./chunk-WZYGM3FR.js";
@@ -71,11 +74,11 @@ var completionSpec = {
71
74
  var COMMANDS = [
72
75
  {
73
76
  ...statusSpec,
74
- load: async () => (await import("./status-55CD352M.js")).statusCommand
77
+ load: async () => (await import("./status-EBIUQIGY.js")).statusCommand
75
78
  },
76
- { ...initSpec, load: async () => (await import("./init-DKWNL62M.js")).initCommand },
77
- { ...hooksSpec, load: async () => (await import("./hooks-R7AYQXHY.js")).hooksCommand },
78
- { ...serveSpec, load: async () => (await import("./serve-QZNG5UUV.js")).serveCommand },
79
+ { ...initSpec, load: async () => (await import("./init-O2UCU2WT.js")).initCommand },
80
+ { ...hooksSpec, load: async () => (await import("./hooks-2E6PJJQK.js")).hooksCommand },
81
+ { ...serveSpec, load: async () => (await import("./serve-RBQYB3FP.js")).serveCommand },
79
82
  { ...listSpec, load: async () => (await import("./list-LV5EKCF6.js")).listCommand },
80
83
  {
81
84
  ...indexSpec,
@@ -112,24 +115,28 @@ var COMMANDS = [
112
115
  { ...syncSpec, load: async () => (await import("./install-5JH4DSFF.js")).syncCommand },
113
116
  {
114
117
  ...projectSpec,
115
- load: async () => (await import("./project-QEYXISHC.js")).projectCommand
118
+ load: async () => (await import("./project-MGUYHUF7.js")).projectCommand
116
119
  },
117
120
  {
118
121
  ...doctorSpec,
119
- load: async () => (await import("./doctor-K2LADSW2.js")).doctorCommand
122
+ load: async () => (await import("./doctor-VZTHEPVC.js")).doctorCommand
120
123
  },
121
124
  {
122
125
  ...sessionsSpec,
123
- load: async () => (await import("./cli-GFDT4YXM.js")).sessionsCommand
126
+ load: async () => (await import("./cli-ZOY2274X.js")).sessionsCommand
124
127
  },
125
- { ...logsSpec, load: async () => (await import("./logs-2JEMSNSG.js")).logsCommand },
126
- { ...gitSpec, load: async () => (await import("./cli-OV5LSSGE.js")).gitCommand },
128
+ { ...logsSpec, load: async () => (await import("./logs-J4W6GFMK.js")).logsCommand },
129
+ { ...gitSpec, load: async () => (await import("./cli-FVUHK2NB.js")).gitCommand },
127
130
  {
128
131
  ...heavySpec,
129
- load: async () => (await import("./heavy-G6CYQQ7O.js")).heavyCommand
132
+ load: async () => (await import("./heavy-OG3UVZNY.js")).heavyCommand
130
133
  },
131
134
  { ...waitSpec, load: async () => (await import("./wait-HEODT7KV.js")).waitCommand },
132
- { ...mcpSpec, load: async () => (await import("./mcp-CHKKXHBB.js")).mcpCommand },
135
+ {
136
+ ...ownersSpec,
137
+ load: async () => (await import("./owners-MPI22SFU.js")).ownersCommand
138
+ },
139
+ { ...mcpSpec, load: async () => (await import("./mcp-U7MVFAB4.js")).mcpCommand },
133
140
  {
134
141
  ...validateSpec,
135
142
  load: async () => (await import("./validate-YXR7FJJX.js")).validateCommand
@@ -140,16 +147,16 @@ var COMMANDS = [
140
147
  },
141
148
  {
142
149
  ...harnessSpec,
143
- load: async () => (await import("./harness-BMWGAXCF.js")).harnessCommand
150
+ load: async () => (await import("./harness-L4C5XWKR.js")).harnessCommand
144
151
  },
145
- { ...tuiSpec, load: async () => (await import("./tui-FXSWN2PV.js")).tuiCommand },
152
+ { ...tuiSpec, load: async () => (await import("./tui-QD2LMXHV.js")).tuiCommand },
146
153
  {
147
154
  ...marketplaceSpec,
148
155
  load: async () => (await import("./marketplace-2X3OOEPW.js")).marketplaceCommand
149
156
  },
150
157
  {
151
158
  ...completionSpec,
152
- load: async () => (await import("./completion-QNDCU4MF.js")).completionCommand
159
+ load: async () => (await import("./completion-ZKWGPMEK.js")).completionCommand
153
160
  }
154
161
  ];
155
162
  var PLANNED = [];
@@ -163,4 +170,4 @@ export {
163
170
  PLANNED,
164
171
  commandNamed
165
172
  };
166
- //# sourceMappingURL=chunk-DLIO2D7S.js.map
173
+ //# sourceMappingURL=chunk-GIL3RBRX.js.map
@@ -397,10 +397,30 @@ function toolFields(name, kind, input, paths) {
397
397
  kind,
398
398
  native: name,
399
399
  ...kind === "shell" ? { command: text2(input["command"]) ?? "" } : {},
400
- paths
400
+ paths,
401
+ ...editFields(name, input, paths)
401
402
  }
402
403
  };
403
404
  }
405
+ function replacement(value) {
406
+ const item = object2(value);
407
+ const old = text2(item["old_string"]);
408
+ const next = text2(item["new_string"]);
409
+ if (old === void 0 || next === void 0) return null;
410
+ return { old, new: next, all: item["replace_all"] === true };
411
+ }
412
+ function editFields(name, input, paths) {
413
+ const path = paths[0];
414
+ if (path === void 0) return {};
415
+ if (name === "Write") {
416
+ const content = text2(input["content"]);
417
+ return content === void 0 ? {} : { edit: { path, content } };
418
+ }
419
+ const list = name === "Edit" ? [replacement(input)] : name === "MultiEdit" && Array.isArray(input["edits"]) ? input["edits"].map(replacement) : null;
420
+ if (list === null || list.length === 0 || list.some((item) => !item))
421
+ return {};
422
+ return { edit: { path, replacements: list } };
423
+ }
404
424
  function stopFields(event, raw, lastMessage) {
405
425
  if (event !== "stop") return {};
406
426
  return {
@@ -1669,4 +1689,4 @@ export {
1669
1689
  readFixtures,
1670
1690
  smoke
1671
1691
  };
1672
- //# sourceMappingURL=chunk-ARXCYFFZ.js.map
1692
+ //# sourceMappingURL=chunk-GQRDEIQA.js.map
@@ -0,0 +1,7 @@
1
+ // src/commands/version.ts
2
+ var VERSION = "0.26.0";
3
+
4
+ export {
5
+ VERSION
6
+ };
7
+ //# sourceMappingURL=chunk-J43Z4O3G.js.map
@@ -0,0 +1,32 @@
1
+ import {
2
+ expandPath
3
+ } from "./chunk-GUHOEIHP.js";
4
+ import {
5
+ gitCommonDir
6
+ } from "./chunk-IJBSOWHK.js";
7
+
8
+ // src/sessions/state-dir.ts
9
+ import { createHash } from "crypto";
10
+ import { realpathSync } from "fs";
11
+ import { homedir } from "os";
12
+ import { join } from "path";
13
+ function stateHome(env) {
14
+ return env["XDG_STATE_HOME"] || join(homedir(), ".local", "state");
15
+ }
16
+ function projectStateId(root) {
17
+ const anchor = gitCommonDir(root) ?? realpathSync(root);
18
+ return createHash("sha256").update(anchor).digest("hex").slice(0, 16);
19
+ }
20
+ function projectStateDir(root, override, env = process.env) {
21
+ if (override) return expandPath(root, override);
22
+ return join(stateHome(env), "pmcp", "projects", projectStateId(root));
23
+ }
24
+ function displacedDir(root, env = process.env) {
25
+ return join(stateHome(env), "pmcp", "displaced", projectStateId(root));
26
+ }
27
+
28
+ export {
29
+ projectStateDir,
30
+ displacedDir
31
+ };
32
+ //# sourceMappingURL=chunk-KLIYFD3W.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createSkillServer
3
- } from "./chunk-7CGGDX7X.js";
3
+ } from "./chunk-7FHOSWNQ.js";
4
4
  import {
5
5
  attachMailbox
6
6
  } from "./chunk-JZKAJUVT.js";
@@ -84,4 +84,4 @@ export {
84
84
  serveWithMailbox,
85
85
  main
86
86
  };
87
- //# sourceMappingURL=chunk-PG62GOPU.js.map
87
+ //# sourceMappingURL=chunk-KQV2EPAP.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-34DECPVC.js";
4
4
  import {
5
5
  ptyBinary
6
- } from "./chunk-264DIB5U.js";
6
+ } from "./chunk-3KISMGVP.js";
7
7
  import {
8
8
  GroupStore,
9
9
  egressPolicy,
@@ -775,4 +775,4 @@ export {
775
775
  prepareBridge,
776
776
  assertBridge
777
777
  };
778
- //# sourceMappingURL=chunk-LNKAR3IS.js.map
778
+ //# sourceMappingURL=chunk-LCPCRZ7N.js.map
@@ -0,0 +1,156 @@
1
+ import {
2
+ ancestors
3
+ } from "./chunk-Z6WRFOFT.js";
4
+ import {
5
+ expandPath
6
+ } from "./chunk-GUHOEIHP.js";
7
+
8
+ // src/sessions/agent-context.ts
9
+ import { readFileSync } from "fs";
10
+ var ENV_MARKERS = [
11
+ "PMCP_PTY_SOCKET",
12
+ "PMCP_PTY_SESSION",
13
+ "CLAUDECODE",
14
+ "CLAUDE_CODE_ENTRYPOINT",
15
+ "CLAUDE_CODE_SESSION_ID",
16
+ "CODEX_THREAD_ID",
17
+ "CODEX_SANDBOX",
18
+ "GEMINI_CLI",
19
+ "GROK_SESSION_ID",
20
+ "GROK_AGENT",
21
+ "ANTIGRAVITY_AGENT",
22
+ "ANTIGRAVITY_CONVERSATION_ID",
23
+ "OPENCODE",
24
+ "AI_AGENT"
25
+ ];
26
+ var RUNTIMES = /* @__PURE__ */ new Set([
27
+ "claude",
28
+ "codex",
29
+ "gemini",
30
+ "grok",
31
+ "opencode",
32
+ "agy",
33
+ "pmcp-pty"
34
+ ]);
35
+ var PACKAGES = /@openai\/codex|@google\/gemini-cli|opencode-ai|@anthropic-ai\/claude-code/u;
36
+ function view(pid) {
37
+ try {
38
+ const stat = readFileSync(`/proc/${pid}/stat`, "utf8");
39
+ const name = stat.slice(stat.indexOf("(") + 1, stat.lastIndexOf(")"));
40
+ const cmdline = readFileSync(`/proc/${pid}/cmdline`, "utf8").replaceAll(
41
+ "\0",
42
+ " "
43
+ );
44
+ return { name, cmdline };
45
+ } catch {
46
+ return null;
47
+ }
48
+ }
49
+ function agentProcess(p) {
50
+ const first = p.cmdline.split(" ")[0] ?? "";
51
+ const base = first.slice(first.lastIndexOf("/") + 1);
52
+ return RUNTIMES.has(p.name) || RUNTIMES.has(base) || PACKAGES.test(p.cmdline);
53
+ }
54
+ function agentContext(env, chain = ancestors().flatMap((pid) => view(pid) ?? [])) {
55
+ const marker = ENV_MARKERS.find((name) => env[name] !== void 0);
56
+ if (marker) return `${marker} is set`;
57
+ const agent = chain.find(agentProcess);
58
+ return agent ? `it runs under ${agent.name}` : null;
59
+ }
60
+
61
+ // src/sessions/operator.ts
62
+ import { createHash, timingSafeEqual } from "crypto";
63
+ import { readFileSync as readFileSync2, statSync } from "fs";
64
+ import { isAbsolute, relative } from "path";
65
+ var OPERATOR_TOKEN_ENV = "PMCP_OPERATOR_TOKEN";
66
+ function fail(message) {
67
+ throw new Error(`[sessions.operator] ${message}`);
68
+ }
69
+ function readOperatorSettings(sessions, root) {
70
+ const table = sessions?.["operator"];
71
+ if (table === void 0) return { via: "tty" };
72
+ if (table === null || typeof table !== "object" || Array.isArray(table))
73
+ fail("must be a table");
74
+ const raw = table;
75
+ const unknown = Object.keys(raw).find(
76
+ (key) => key !== "via" && key !== "token_file"
77
+ );
78
+ if (unknown) fail(`unknown key ${unknown}`);
79
+ const via = raw["via"] ?? "tty";
80
+ if (via === "tty") {
81
+ if (raw["token_file"] !== void 0)
82
+ fail('token_file goes with via = "token"');
83
+ return { via };
84
+ }
85
+ if (via !== "token") fail('via must be "tty" or "token"');
86
+ const given = raw["token_file"];
87
+ if (typeof given !== "string" || given === "")
88
+ fail('via = "token" needs token_file, a path outside the project');
89
+ if (!given.startsWith("~") && !given.startsWith("$HOME/") && !isAbsolute(given))
90
+ fail("token_file must be absolute or start with ~/");
91
+ const tokenFile = expandPath(root, given);
92
+ const inside = relative(root, tokenFile);
93
+ if (!inside.startsWith("..") && !isAbsolute(inside))
94
+ fail(
95
+ "token_file must be outside the project, where agents' edits do not reach"
96
+ );
97
+ return { via, tokenFile };
98
+ }
99
+ function digest(text) {
100
+ return createHash("sha256").update(text.trim()).digest();
101
+ }
102
+ function tokenCheck(file, given) {
103
+ if (!given) return { ok: false, why: `${OPERATOR_TOKEN_ENV} is not set` };
104
+ let mode;
105
+ let expected;
106
+ try {
107
+ mode = statSync(file).mode;
108
+ expected = readFileSync2(file, "utf8");
109
+ } catch {
110
+ return { ok: false, why: `the operator token file ${file} cannot be read` };
111
+ }
112
+ if ((mode & 63) !== 0)
113
+ return {
114
+ ok: false,
115
+ why: `the operator token file ${file} is readable by others; chmod 600 it`
116
+ };
117
+ if (!expected.trim())
118
+ return { ok: false, why: `the operator token file ${file} is empty` };
119
+ return timingSafeEqual(digest(given), digest(expected)) ? { ok: true } : {
120
+ ok: false,
121
+ why: `${OPERATOR_TOKEN_ENV} does not match the operator token`
122
+ };
123
+ }
124
+ function operatorCheck(settings, probe) {
125
+ if (settings.via === "token")
126
+ return tokenCheck(settings.tokenFile, probe.env[OPERATOR_TOKEN_ENV]);
127
+ const agent = agentContext(probe.env, probe.chain);
128
+ if (agent)
129
+ return { ok: false, why: `it runs inside an agent session (${agent})` };
130
+ if (!probe.tty)
131
+ return {
132
+ ok: false,
133
+ why: "the operator runs it from an interactive terminal, and standard input is not one"
134
+ };
135
+ return { ok: true };
136
+ }
137
+ var OperatorOnly = class extends Error {
138
+ constructor(verb, why) {
139
+ super(
140
+ `${verb} is the operator's to run: ${why}. Ask the operator to run it from their own terminal (in your reply, or with pmcp sessions send --to alias:operator where the mailbox is on).`
141
+ );
142
+ this.name = "OperatorOnly";
143
+ }
144
+ };
145
+ function requireOperator(verb, settings, probe) {
146
+ const verdict = operatorCheck(settings, probe);
147
+ if (!verdict.ok) throw new OperatorOnly(verb, verdict.why);
148
+ }
149
+
150
+ export {
151
+ agentContext,
152
+ readOperatorSettings,
153
+ operatorCheck,
154
+ requireOperator
155
+ };
156
+ //# sourceMappingURL=chunk-NQCAKDRY.js.map
@@ -7,7 +7,7 @@ import {
7
7
  prepare,
8
8
  present,
9
9
  writeNative
10
- } from "./chunk-V5PXMLLL.js";
10
+ } from "./chunk-6XE3WW7S.js";
11
11
  import {
12
12
  ANTIGRAVITY_MCP_PLUGIN,
13
13
  BUNDLE_NATIVE_FILES,
@@ -21,16 +21,16 @@ import {
21
21
  same,
22
22
  splitKeyed,
23
23
  withoutBlock
24
- } from "./chunk-2ZH77O2D.js";
24
+ } from "./chunk-Y7FYCVUK.js";
25
25
  import {
26
26
  HOOK_DIRECTORY
27
- } from "./chunk-ARXCYFFZ.js";
27
+ } from "./chunk-GQRDEIQA.js";
28
28
  import {
29
29
  LOCK_FILE,
30
30
  replaceFile,
31
31
  replaceLink,
32
32
  writeLock
33
- } from "./chunk-264DIB5U.js";
33
+ } from "./chunk-3KISMGVP.js";
34
34
  import {
35
35
  RULES_DIR,
36
36
  legacyLinks
@@ -400,4 +400,4 @@ export {
400
400
  unmanagedHooks,
401
401
  describeHookProblem
402
402
  };
403
- //# sourceMappingURL=chunk-3SEJNT6F.js.map
403
+ //# sourceMappingURL=chunk-NQZMGQFG.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  hostApprovalDoctor
3
- } from "./chunk-5NQZGNKT.js";
3
+ } from "./chunk-7PBWLYCO.js";
4
4
  import {
5
5
  wakeableBy
6
6
  } from "./chunk-JQVSDPFL.js";
@@ -12,7 +12,7 @@ import {
12
12
  describeHookProblem,
13
13
  project,
14
14
  unmanagedHooks
15
- } from "./chunk-3SEJNT6F.js";
15
+ } from "./chunk-NQZMGQFG.js";
16
16
  import {
17
17
  ANTIGRAVITY_MCP_PLUGIN,
18
18
  agentNames,
@@ -23,7 +23,7 @@ import {
23
23
  skillNames,
24
24
  splitFrontmatter,
25
25
  uiClaudeDoctor
26
- } from "./chunk-2ZH77O2D.js";
26
+ } from "./chunk-Y7FYCVUK.js";
27
27
  import {
28
28
  pathPmcp,
29
29
  pmcpCommand
@@ -31,19 +31,19 @@ import {
31
31
  import {
32
32
  createFilesStore,
33
33
  inboxKey
34
- } from "./chunk-3V37OZQH.js";
34
+ } from "./chunk-PAY6HEEY.js";
35
35
  import {
36
36
  hostDoctor,
37
37
  hostEnvDoctor,
38
38
  ptyBinaryDoctor,
39
39
  readLockFile
40
- } from "./chunk-264DIB5U.js";
40
+ } from "./chunk-3KISMGVP.js";
41
41
  import {
42
42
  ProjectError
43
43
  } from "./chunk-TYY5TYHF.js";
44
44
  import {
45
45
  projectStateDir
46
- } from "./chunk-FQLCD4HU.js";
46
+ } from "./chunk-KLIYFD3W.js";
47
47
 
48
48
  // src/project/doctor/runner.ts
49
49
  import { spawnSync as spawnSync2 } from "child_process";
@@ -671,4 +671,4 @@ export {
671
671
  spawnRunner,
672
672
  doctor
673
673
  };
674
- //# sourceMappingURL=chunk-DGXZBQCA.js.map
674
+ //# sourceMappingURL=chunk-OBCBCLS2.js.map
@@ -7,20 +7,20 @@ import {
7
7
  observeSession,
8
8
  openGroup,
9
9
  runOperation
10
- } from "./chunk-X3RUXLAV.js";
10
+ } from "./chunk-FXDGW2IH.js";
11
11
  import {
12
12
  nativeHostTools
13
- } from "./chunk-MZ52S4YJ.js";
13
+ } from "./chunk-3JOFDNL4.js";
14
14
  import {
15
15
  locateExecutable
16
16
  } from "./chunk-R2GPCZUX.js";
17
17
  import {
18
18
  artifact,
19
19
  stateDirectory
20
- } from "./chunk-LNKAR3IS.js";
20
+ } from "./chunk-LCPCRZ7N.js";
21
21
  import {
22
22
  ptyBinary
23
- } from "./chunk-264DIB5U.js";
23
+ } from "./chunk-3KISMGVP.js";
24
24
  import {
25
25
  GroupStore,
26
26
  privateJson
@@ -249,4 +249,4 @@ async function invoke(operation) {
249
249
  export {
250
250
  invoke
251
251
  };
252
- //# sourceMappingURL=chunk-D4FIBB2G.js.map
252
+ //# sourceMappingURL=chunk-OG2ESRQP.js.map
@@ -27,10 +27,13 @@ var heavySpec = {
27
27
  },
28
28
  {
29
29
  name: "result",
30
- describe: "The exit code and log of a finished ticket",
31
- usage: "pmcp heavy result <ticket>",
32
- options: ["config", "json"],
33
- examples: ["pmcp heavy result 7f3a"]
30
+ describe: "A job's state and exit code, or with --log its kept output",
31
+ usage: "pmcp heavy result <id> [--log [--tail <n>]] [--json]",
32
+ options: ["log", "tail", "config", "json"],
33
+ examples: [
34
+ "pmcp heavy result 1794239701-482b9b",
35
+ "pmcp heavy result 1794239701-482b9b --log --tail 50"
36
+ ]
34
37
  },
35
38
  {
36
39
  name: "queue",
@@ -70,9 +73,9 @@ var heavySpec = {
70
73
  {
71
74
  name: "stats",
72
75
  describe: "Recorded run times and weights per command",
73
- usage: "pmcp heavy stats [--json]",
74
- options: ["config", "json"],
75
- examples: ["pmcp heavy stats"]
76
+ usage: "pmcp heavy stats [--top <n>] [--json]",
77
+ options: ["top", "config", "json"],
78
+ examples: ["pmcp heavy stats --top 10"]
76
79
  }
77
80
  ],
78
81
  describe: "Run a heavy command within the host-wide budget, by lane, once the host has room",
@@ -110,6 +113,21 @@ var heavySpec = {
110
113
  describe: "cancel: also stop a job that is already running.",
111
114
  boolean: true
112
115
  },
116
+ {
117
+ name: "top",
118
+ describe: "stats: only the n commands with the most runs.",
119
+ placeholder: "<n>"
120
+ },
121
+ {
122
+ name: "log",
123
+ describe: "result: print the job's kept stdout and stderr instead of its state.",
124
+ boolean: true
125
+ },
126
+ {
127
+ name: "tail",
128
+ describe: "result --log: only the last n lines.",
129
+ placeholder: "<n>"
130
+ },
113
131
  {
114
132
  name: "ticket",
115
133
  describe: "Internal: the submitted ticket this run belongs to.",
@@ -131,4 +149,4 @@ var heavySpec = {
131
149
  export {
132
150
  heavySpec
133
151
  };
134
- //# sourceMappingURL=chunk-43MXRTKH.js.map
152
+ //# sourceMappingURL=chunk-OHCUPXU4.js.map
@@ -0,0 +1,42 @@
1
+ import {
2
+ operatorCheck,
3
+ readOperatorSettings,
4
+ requireOperator
5
+ } from "./chunk-NQCAKDRY.js";
6
+ import {
7
+ ArgumentError,
8
+ one
9
+ } from "./chunk-Y6NFETNG.js";
10
+ import {
11
+ findConfig,
12
+ readConfig
13
+ } from "./chunk-GJXOFDJT.js";
14
+
15
+ // src/sessions/operator-cli.ts
16
+ function operatorSettingsFor(context) {
17
+ const path = one(context.args, "config") ?? findConfig(context.cwd);
18
+ if (!path) return { via: "tty" };
19
+ try {
20
+ const config = readConfig(path);
21
+ return readOperatorSettings(config.raw["sessions"], config.dir);
22
+ } catch (error) {
23
+ throw new ArgumentError(
24
+ error instanceof Error ? error.message : String(error)
25
+ );
26
+ }
27
+ }
28
+ function probe(context) {
29
+ return { env: context.env, tty: process.stdin.isTTY === true };
30
+ }
31
+ function isOperator(context) {
32
+ return operatorCheck(operatorSettingsFor(context), probe(context)).ok;
33
+ }
34
+ function requireOperatorFor(context, verb) {
35
+ requireOperator(verb, operatorSettingsFor(context), probe(context));
36
+ }
37
+
38
+ export {
39
+ isOperator,
40
+ requireOperatorFor
41
+ };
42
+ //# sourceMappingURL=chunk-OIKT4SYO.js.map