@modootoday/pmcp 0.18.3 → 0.19.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 (111) 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-S2QI72W3.js → apply-JVLYYXAG.js} +17 -17
  6. package/dist/{broadcast-CBMVOV3G.js → broadcast-56NPEJWM.js} +3 -4
  7. package/dist/{chunk-JS5RTH4I.js → chunk-2Q6MNGU5.js} +2 -2
  8. package/dist/{chunk-QK4G7FCU.js → chunk-3O3FS6KM.js} +10 -8
  9. package/dist/{chunk-3MEYKFFO.js → chunk-3TG3KVHZ.js} +3 -3
  10. package/dist/{chunk-FX3LTTMB.js → chunk-47ZGCZQA.js} +3 -3
  11. package/dist/{chunk-6BN35BHI.js → chunk-4LV7KDTS.js} +67 -17
  12. package/dist/{chunk-CKTN6LKP.js → chunk-6MZTOC6H.js} +2 -2
  13. package/dist/{chunk-JM2KR2WJ.js → chunk-CYQIAEQT.js} +5 -5
  14. package/dist/{chunk-DCU2EXQV.js → chunk-D5D3V6RU.js} +4 -4
  15. package/dist/{chunk-LTZH5E3G.js → chunk-DHAPQUEF.js} +235 -30
  16. package/dist/{chunk-LBXO4VPG.js → chunk-E4FJOLPJ.js} +6 -3
  17. package/dist/chunk-FGEBSQQJ.js +7 -0
  18. package/dist/{chunk-OPYFEHKG.js → chunk-G7JONWL4.js} +29 -1
  19. package/dist/{chunk-HFE4QDJQ.js → chunk-HEPSITZX.js} +2 -2
  20. package/dist/{chunk-4GSGT55G.js → chunk-IEK4U5RR.js} +2 -2
  21. package/dist/{chunk-QEW4J3IZ.js → chunk-ISNRDHSD.js} +2 -2
  22. package/dist/{chunk-TVL5RTE6.js → chunk-ITDJ2EXN.js} +11 -1
  23. package/dist/{chunk-S3PIAMXV.js → chunk-J5XQW2CM.js} +68 -8
  24. package/dist/{chunk-PAX3QXX2.js → chunk-J5ZS7GLA.js} +2 -2
  25. package/dist/chunk-J6KL3COD.js +34 -0
  26. package/dist/{chunk-GZHHEHKY.js → chunk-JJBSYUSQ.js} +19 -7
  27. package/dist/{chunk-XJUNAVU2.js → chunk-KHQQGBFJ.js} +107 -20
  28. package/dist/{chunk-7PTG42QU.js → chunk-LCENQ6JR.js} +6 -6
  29. package/dist/{chunk-WM2RF2MI.js → chunk-NLKAEKSG.js} +3 -3
  30. package/dist/{chunk-7DEYLLIE.js → chunk-OHW3A7Z3.js} +2 -2
  31. package/dist/{chunk-TZORR6GZ.js → chunk-PFWTGEZJ.js} +2 -2
  32. package/dist/{chunk-HQWVGU3W.js → chunk-Q3GLKL4B.js} +5 -5
  33. package/dist/{chunk-2RTRY45B.js → chunk-QJRJCXX2.js} +30 -4
  34. package/dist/{chunk-E5XVSMBR.js → chunk-QXRD7N35.js} +2 -2
  35. package/dist/{chunk-M455QSCW.js → chunk-TPLV2YX2.js} +2 -2
  36. package/dist/{chunk-XELAZAIM.js → chunk-UD3BEEBQ.js} +54 -12
  37. package/dist/{chunk-EAWPJHJ7.js → chunk-UGODVKBJ.js} +2 -2
  38. package/dist/{chunk-IIBB37JE.js → chunk-UQNCBXXH.js} +14 -14
  39. package/dist/{chunk-F5LEGPGP.js → chunk-WJJ2KYE4.js} +2 -2
  40. package/dist/{chunk-TAOOPXBV.js → chunk-Y2MZ5RE3.js} +88 -56
  41. package/dist/{cli-ZN7ZVDEZ.js → cli-MUP2NSXT.js} +10 -9
  42. package/dist/{cli-MI4ZCAZ3.js → cli-T5LHBUY2.js} +8 -8
  43. package/dist/cli.js +3 -3
  44. package/dist/{completion-GYN7PX3T.js → completion-CCK3LWVR.js} +2 -2
  45. package/dist/{diagnostics-WACXQ33W.js → diagnostics-6WON3VMZ.js} +13 -12
  46. package/dist/{doctor-VSQ72A6X.js → doctor-UEXUOW5O.js} +19 -19
  47. package/dist/{entry-VFEZC2XB.js → entry-GMC6LRO2.js} +13 -12
  48. package/dist/{exec-mcp-TOQEJFK3.js → exec-mcp-FS7IPXNC.js} +14 -14
  49. package/dist/{harness-XCEWFGCG.js → harness-32PERNQY.js} +4 -4
  50. package/dist/harness-launch-gate.js +6 -5
  51. package/dist/harness-pane-runner.js +2 -1
  52. package/dist/harness-worker.js +8 -7
  53. package/dist/hook-body.js +446 -278
  54. package/dist/{hook-spec-C5fWTSCH.d.ts → hook-spec-0aGt29Pg.d.ts} +22 -2
  55. package/dist/{hooks-32AFBC3Z.js → hooks-VQCLHXRZ.js} +3 -3
  56. package/dist/{host-TE5PNDHJ.js → host-4WNPLAD5.js} +8 -7
  57. package/dist/{host-72OLHUX7.js → host-ED3XRUNM.js} +16 -16
  58. package/dist/{host-run-MXCH26ZD.js → host-run-PNY6NAYW.js} +28 -11
  59. package/dist/http.js +1 -1
  60. package/dist/{import-mcp-QWGZSIZR.js → import-mcp-WEUY6IVK.js} +12 -12
  61. package/dist/index.d.ts +6 -2
  62. package/dist/index.js +18 -18
  63. package/dist/{init-5M3XWOTJ.js → init-5ZDPHPWB.js} +2 -2
  64. package/dist/invoke-MB4SWBIE.js +24 -0
  65. package/dist/{list-FGDUU5DL.js → list-U4SUFIS7.js} +14 -14
  66. package/dist/{logout-KM5N5GOC.js → logout-M76LEHVP.js} +13 -13
  67. package/dist/{logs-TBUA4UWU.js → logs-H3RPKNTE.js} +3 -4
  68. package/dist/{mailbox-BMTZOSZ7.js → mailbox-O3MX6QPF.js} +3 -4
  69. package/dist/{mainline-KAD2ERLP.js → mainline-DG75NLBS.js} +306 -57
  70. package/dist/{mcp-FJ2UQ4RH.js → mcp-AXHV547W.js} +5 -5
  71. package/dist/{mcp-ND6ZQWJE.js → mcp-NSKAEV7J.js} +2 -2
  72. package/dist/{pause-7LILUVGL.js → pause-2HQ7CKMR.js} +3 -4
  73. package/dist/project/hook-adapter.d.ts +1 -1
  74. package/dist/{project-LZKQUV2W.js → project-FTXIKBML.js} +4 -4
  75. package/dist/{recovery-U6QB3PMT.js → recovery-54KHNJX4.js} +4 -3
  76. package/dist/{resume-26VFAAMH.js → resume-ETFTR5V3.js} +3 -4
  77. package/dist/{run-X4663F4M.js → run-UMHKF2GM.js} +4 -4
  78. package/dist/{run-YEVGHGTN.js → run-Y7NKULSP.js} +12 -12
  79. package/dist/{serve-S7MF42SS.js → serve-MRWTSSAU.js} +3 -3
  80. package/dist/setup-T6T2PFC4.js +20 -0
  81. package/dist/{start-login-GKFGTE2A.js → start-login-POISLJD2.js} +13 -13
  82. package/dist/{status-XG5GRWVU.js → status-GGDHOPSE.js} +21 -27
  83. package/dist/{status-RO55QPKV.js → status-GPSLH4VO.js} +3 -4
  84. package/dist/{status-FYG6XYQ6.js → status-XMATSURN.js} +13 -13
  85. package/dist/stdio.js +2 -2
  86. package/dist/{sweep-35LGQTTO.js → sweep-VY2TNOO5.js} +3 -4
  87. package/dist/{test-KFDO6ROC.js → test-ULKQY6FV.js} +51 -15
  88. package/dist/{tui-2MP7DRIX.js → tui-NGBCIBRW.js} +5 -5
  89. package/dist/{unbroadcast-5QNGAJR2.js → unbroadcast-RKTBP57G.js} +3 -4
  90. package/dist/{worker-3VS6RQEL.js → worker-Q7JWY6BR.js} +11 -10
  91. package/dist/{worktree-create-PZSRB7PH.js → worktree-create-NO4UOOEP.js} +2 -2
  92. package/dist/{worktree-list-JYB6VXLW.js → worktree-list-NEIDD66X.js} +4 -4
  93. package/dist/{worktree-sync-UF5CXPWV.js → worktree-sync-W4BDDLRO.js} +8 -9
  94. package/docs/commands.md +1 -1
  95. package/docs/git-workflow.md +58 -1
  96. package/docs/hooks.md +29 -0
  97. package/docs/project-configuration.md +15 -7
  98. package/docs/terminal-harness.md +14 -0
  99. package/gemini-extension.json +2 -2
  100. package/mcp.json +1 -1
  101. package/package.json +5 -5
  102. package/plugin.json +1 -1
  103. package/plugins/pmcp/.claude-plugin/plugin.json +1 -1
  104. package/plugins/pmcp/.mcp.json +1 -1
  105. package/plugins/pmcp/gemini-extension.json +2 -2
  106. package/plugins/pmcp/mcp.json +1 -1
  107. package/plugins/pmcp/plugin.json +1 -1
  108. package/dist/chunk-26WLNWDG.js +0 -93
  109. package/dist/chunk-AF2IBMWN.js +0 -7
  110. package/dist/invoke-SFSN4XT7.js +0 -23
  111. package/dist/setup-DTKZLZUT.js +0 -18
@@ -0,0 +1,34 @@
1
+ // src/native/env-names.ts
2
+ var NAME = /^[A-Z_][A-Z0-9_]{0,127}$/u;
3
+ var RESERVED = ["PMCP_PTY_SOCKET", "PMCP_PTY_SESSION", "PMCP_PTY_INSTANCE"];
4
+ function envNames(value, where) {
5
+ if (value === void 0) return [];
6
+ if (!Array.isArray(value))
7
+ throw new Error(`${where} must be a list of environment variable names`);
8
+ const names = value.map((name, i) => {
9
+ if (typeof name !== "string" || !NAME.test(name))
10
+ throw new Error(
11
+ `${where}[${i}] must be an environment variable name (A-Z, 0-9, _)`
12
+ );
13
+ if (RESERVED.includes(name))
14
+ throw new Error(`${where}[${i}] ${name} is set by pmcp-pty itself`);
15
+ return name;
16
+ });
17
+ return [...new Set(names)];
18
+ }
19
+ function pickEnv(names, env) {
20
+ const values = {};
21
+ const missing = [];
22
+ for (const name of names) {
23
+ const value = env[name];
24
+ if (value === void 0 || value === "") missing.push(name);
25
+ else values[name] = value;
26
+ }
27
+ return { values, missing };
28
+ }
29
+
30
+ export {
31
+ envNames,
32
+ pickEnv
33
+ };
34
+ //# sourceMappingURL=chunk-J6KL3COD.js.map
@@ -1,9 +1,13 @@
1
1
  import {
2
2
  readGitConfig
3
- } from "./chunk-S3PIAMXV.js";
3
+ } from "./chunk-J5XQW2CM.js";
4
4
  import {
5
5
  detect
6
- } from "./chunk-JS5RTH4I.js";
6
+ } from "./chunk-2Q6MNGU5.js";
7
+ import {
8
+ readStoreSettings,
9
+ resolveLeaseFiles
10
+ } from "./chunk-DHAPQUEF.js";
7
11
  import {
8
12
  projectStateDir
9
13
  } from "./chunk-OEH47H6A.js";
@@ -13,21 +17,29 @@ import {
13
17
  } from "./chunk-QPL7E2HW.js";
14
18
 
15
19
  // src/git/setup.ts
16
- import { join, resolve } from "path";
20
+ import { dirname, join, resolve } from "path";
17
21
  function loadGit(cwd, configPath, env) {
18
22
  const path = configPath === void 0 ? findConfig(cwd) : resolve(cwd, configPath);
19
23
  if (path === null)
20
24
  return new Error("no pmcp.toml found; the git workflow is opt-in");
21
- const config = readGitConfig(readConfig(path));
25
+ const project = readConfig(path);
26
+ const config = readGitConfig(project);
22
27
  if (config === null)
23
28
  return new Error(`[git] is absent or disabled in ${path}`);
24
29
  const ctx = detect(cwd, { remote: config.remote, mainline: config.mainline });
25
30
  if (ctx === null) return new Error(`${cwd} is not inside a git checkout`);
26
31
  const stateDir = projectStateDir(ctx.root, config.stateDir, env);
27
- return { config, ctx, stateDir };
32
+ const override = config.gate?.treeEnv ? env[config.gate.treeEnv] : void 0;
33
+ const tree = override || (config.gate?.tree ?? join(stateDir, "gate", "tree"));
34
+ const settings = readStoreSettings(
35
+ project.raw["sessions"],
36
+ project.raw["git"]
37
+ );
38
+ const leaseFiles = resolveLeaseFiles(settings.leaseFiles, dirname(tree));
39
+ return { config, ctx, stateDir, gateTree: tree, leaseFiles };
28
40
  }
29
41
  function gateTreePath(setup) {
30
- return setup.config.gate?.tree ?? join(setup.stateDir, "gate", "tree");
42
+ return setup.gateTree;
31
43
  }
32
44
  function leaseSpecs(config) {
33
45
  if (config.leases.length > 0) return config.leases;
@@ -41,4 +53,4 @@ export {
41
53
  gateTreePath,
42
54
  leaseSpecs
43
55
  };
44
- //# sourceMappingURL=chunk-GZHHEHKY.js.map
56
+ //# sourceMappingURL=chunk-JJBSYUSQ.js.map
@@ -3,16 +3,16 @@ import {
3
3
  } from "./chunk-HQOB7OQS.js";
4
4
  import {
5
5
  readGitConfig
6
- } from "./chunk-S3PIAMXV.js";
6
+ } from "./chunk-J5XQW2CM.js";
7
7
  import {
8
8
  detect
9
- } from "./chunk-JS5RTH4I.js";
9
+ } from "./chunk-2Q6MNGU5.js";
10
10
  import {
11
11
  syncWorktree
12
- } from "./chunk-DCU2EXQV.js";
12
+ } from "./chunk-D5D3V6RU.js";
13
13
  import {
14
14
  gitText
15
- } from "./chunk-OPYFEHKG.js";
15
+ } from "./chunk-G7JONWL4.js";
16
16
  import {
17
17
  localCli,
18
18
  pmcpCommand,
@@ -25,13 +25,11 @@ import {
25
25
  ptyFields,
26
26
  ptyRef
27
27
  } from "./chunk-3PW4FI7U.js";
28
- import {
29
- readStoreSettings
30
- } from "./chunk-26WLNWDG.js";
31
28
  import {
32
29
  inboxKey,
33
- noticeOf
34
- } from "./chunk-LTZH5E3G.js";
30
+ noticeOf,
31
+ readStoreSettings
32
+ } from "./chunk-DHAPQUEF.js";
35
33
  import {
36
34
  STATE_FILES,
37
35
  leaseFile,
@@ -47,7 +45,7 @@ import {
47
45
  packagedBinary,
48
46
  readHost,
49
47
  readLock
50
- } from "./chunk-TAOOPXBV.js";
48
+ } from "./chunk-Y2MZ5RE3.js";
51
49
  import {
52
50
  checkoutOf,
53
51
  hasLinkedWorktrees
@@ -56,6 +54,9 @@ import {
56
54
  ConfigError,
57
55
  readMarketplaces
58
56
  } from "./chunk-QPL7E2HW.js";
57
+ import {
58
+ envNames
59
+ } from "./chunk-J6KL3COD.js";
59
60
 
60
61
  // src/hooks/contract.ts
61
62
  var RUNTIME_IDS = [
@@ -2630,7 +2631,7 @@ var leases = {
2630
2631
  options(raw) {
2631
2632
  return Object.entries(raw).map(([name, value]) => {
2632
2633
  const table3 = value ?? {};
2633
- onlyKeys(table3, ["path", "blocks"]);
2634
+ onlyKeys(table3, ["path", "blocks", "file", "events"]);
2634
2635
  if (table3["path"] !== void 0 && typeof table3["path"] !== "string")
2635
2636
  throw new Error(`${name}.path must be a string`);
2636
2637
  return {
@@ -3822,6 +3823,7 @@ var POLICIES = {
3822
3823
 
3823
3824
  // src/hooks/compile/bindings.ts
3824
3825
  var BASE_TIMEOUT_SEC = 10;
3826
+ var STARTUP_MS = 3e3;
3825
3827
  function listening(policy, options2) {
3826
3828
  const events = policy.eventsFor ? policy.eventsFor(policy.options(options2)) : policy.events;
3827
3829
  return { events, tools: policy.tools };
@@ -3846,8 +3848,15 @@ function bindingsFor(policy, id) {
3846
3848
  want(event, listener.tools ?? ["other"]);
3847
3849
  }
3848
3850
  if (policy.emergencyOffFile) want("before_tool", ["shell", "edit"]);
3849
- const slowest = Math.max(0, ...policy.custom.map((entry) => entry.timeoutMs));
3850
- const timeoutSec = Math.max(BASE_TIMEOUT_SEC, Math.ceil(slowest / 1e3) + 2);
3851
+ const tries = policy.failure ? policy.failure.timeoutMs * (policy.failure.retry + 1) : 0;
3852
+ const slowest = Math.max(
3853
+ tries,
3854
+ ...policy.custom.map((entry) => entry.timeoutMs)
3855
+ );
3856
+ const timeoutSec = Math.max(
3857
+ BASE_TIMEOUT_SEC,
3858
+ Math.ceil((slowest + STARTUP_MS) / 1e3)
3859
+ );
3851
3860
  return [...wanted].flatMap(
3852
3861
  ([event, tools]) => adapter.bindings(event, [...tools], timeoutSec)
3853
3862
  );
@@ -4041,6 +4050,59 @@ function readChecks(raw) {
4041
4050
  });
4042
4051
  }
4043
4052
 
4053
+ // src/hooks/dispatch/failure.ts
4054
+ import { isAbsolute as isAbsolute11, relative as relative6, resolve as resolve13 } from "path";
4055
+ var PASS_KINDS = ["read", "edit-own-worktree"];
4056
+ function readFailure(value) {
4057
+ if (value === void 0) return void 0;
4058
+ if (value === null || typeof value !== "object" || Array.isArray(value))
4059
+ throw new Error("[hooks.failure] must be a table");
4060
+ const table3 = value;
4061
+ for (const key of Object.keys(table3))
4062
+ if (!["timeout_ms", "retry", "pass"].includes(key))
4063
+ throw new Error(`[hooks.failure] unknown key ${key}`);
4064
+ const integer = (key, fallback3, min, max) => {
4065
+ const v = table3[key] ?? fallback3;
4066
+ if (typeof v !== "number" || !Number.isInteger(v) || v < min || v > max)
4067
+ throw new Error(
4068
+ `[hooks.failure] ${key} must be an integer from ${min} to ${max}`
4069
+ );
4070
+ return v;
4071
+ };
4072
+ const pass2 = table3["pass"] ?? [];
4073
+ if (!Array.isArray(pass2) || !pass2.every((kind) => PASS_KINDS.includes(kind)))
4074
+ throw new Error(
4075
+ `[hooks.failure] pass must list ${PASS_KINDS.join(" or ")}`
4076
+ );
4077
+ return {
4078
+ timeoutMs: integer("timeout_ms", 2e3, 100, 6e4),
4079
+ retry: integer("retry", 1, 0, 3),
4080
+ pass: [...new Set(pass2)]
4081
+ };
4082
+ }
4083
+ function ownWorktree(input) {
4084
+ const checkout = checkoutOf(input.cwd);
4085
+ if (!checkout || checkout.main) return false;
4086
+ const paths = input.tool?.paths ?? [];
4087
+ return paths.length > 0 && paths.every((path) => {
4088
+ const rest = relative6(checkout.root, resolve13(input.cwd, path));
4089
+ return rest !== "" && !rest.startsWith("..") && !isAbsolute11(rest);
4090
+ });
4091
+ }
4092
+ function passes(input, pass2) {
4093
+ const kind = input.tool?.kind;
4094
+ if (kind === "read") return pass2.includes("read");
4095
+ if (kind === "edit")
4096
+ return pass2.includes("edit-own-worktree") && ownWorktree(input);
4097
+ return false;
4098
+ }
4099
+ function afterFailure(policy, cause, input, failure) {
4100
+ const head = `pmcp hooks: ${policy} failed (${cause})`;
4101
+ if (passes(input, failure.pass))
4102
+ return { context: [`${head}; passed with a warning`] };
4103
+ return { verdict: "deny", reason: `${head}; refused` };
4104
+ }
4105
+
4044
4106
  // src/hooks/compile/hooks-table.ts
4045
4107
  var KEYS2 = [
4046
4108
  "targets",
@@ -4050,7 +4112,8 @@ var KEYS2 = [
4050
4112
  "guards",
4051
4113
  "checks",
4052
4114
  "shell",
4053
- "edit"
4115
+ "edit",
4116
+ "failure"
4054
4117
  ];
4055
4118
  var LEGACY = /* @__PURE__ */ new Set(["shell", "edit"]);
4056
4119
  var FALLBACKS = ["deny", "warn", "refuse"];
@@ -4090,13 +4153,15 @@ function readHooksTable(table3, tools) {
4090
4153
  }
4091
4154
  const log = errorLog(table3["error_log"]);
4092
4155
  const emergencyOffFile = offFile(table3["emergency_off_file"]);
4156
+ const failure = readFailure(table3["failure"]);
4093
4157
  return {
4094
4158
  enabled,
4095
4159
  targets: [...new Set(targets)],
4096
4160
  askFallback,
4097
4161
  logEnabled: log.enabled,
4098
4162
  ...log.file ? { errorLog: log.file } : {},
4099
- ...emergencyOffFile ? { emergencyOffFile } : {}
4163
+ ...emergencyOffFile ? { emergencyOffFile } : {},
4164
+ ...failure ? { failure } : {}
4100
4165
  };
4101
4166
  }
4102
4167
 
@@ -4138,11 +4203,11 @@ function registryCheck(raw) {
4138
4203
  const unknown = Object.keys(rest).find((key) => key !== "stale_minutes");
4139
4204
  if (unknown) throw new Error(`[sessions.registry] unknown key ${unknown}`);
4140
4205
  }
4141
- function readSessions(raw) {
4206
+ function readSessions(raw, git) {
4142
4207
  const table3 = asTable(raw, "[sessions]");
4143
4208
  const unknown = Object.keys(table3).find((key) => !KEYS3.includes(key));
4144
4209
  if (unknown) throw new Error(`[sessions] unknown key ${unknown}`);
4145
- const settings = readStoreSettings(raw);
4210
+ const settings = readStoreSettings(raw, git);
4146
4211
  registryCheck(table3["registry"]);
4147
4212
  const guards = [];
4148
4213
  if (table3["registry"] !== void 0)
@@ -4292,7 +4357,7 @@ function compileHooks(tables, options2) {
4292
4357
  const table3 = readHooksTable(hooks, options2.tools);
4293
4358
  const guardsTable = asTable(hooks["guards"], "[hooks.guards]");
4294
4359
  const entries = readCustom(options2.root, hooks, guardsTable);
4295
- const sessions = readSessions(tables.sessions);
4360
+ const sessions = readSessions(tables.sessions, tables.git);
4296
4361
  const workspace = readWorkspace(tables.git, options2.root);
4297
4362
  const deskSync = readWorktreeSync(tables, options2.root);
4298
4363
  const directPush = readMainlineDeliver(tables, options2.root);
@@ -4324,6 +4389,7 @@ function compileHooks(tables, options2) {
4324
4389
  contract: 2,
4325
4390
  targets: table3.targets,
4326
4391
  ...table3.emergencyOffFile ? { emergencyOffFile: table3.emergencyOffFile } : {},
4392
+ ...table3.failure ? { failure: table3.failure } : {},
4327
4393
  ...sessions.stateDir ? { stateDir: sessions.stateDir } : {},
4328
4394
  ...table3.errorLog ? { logFile: table3.errorLog } : {},
4329
4395
  log: { ...readLoggingTable(tables.logging), enabled: table3.logEnabled },
@@ -4331,7 +4397,10 @@ function compileHooks(tables, options2) {
4331
4397
  staleMs: sessions.staleMs,
4332
4398
  keepBroadcasts: sessions.keepBroadcasts,
4333
4399
  // Only when on, so projects without a mailbox keep the same policy.json and hash.
4334
- ...sessions.mailbox?.enabled ? { mailbox: sessions.mailbox } : {}
4400
+ ...sessions.mailbox?.enabled ? { mailbox: sessions.mailbox } : {},
4401
+ // Only when declared, like the mailbox, so other projects keep the same policy.json.
4402
+ ...sessions.leaseFiles ? { leaseFiles: sessions.leaseFiles } : {},
4403
+ ...sessions.gate ? { gate: sessions.gate } : {}
4335
4404
  },
4336
4405
  guards,
4337
4406
  custom: pinnedEntries(options2.root, entries, table3.targets),
@@ -4852,6 +4921,21 @@ function named(path, where, name) {
4852
4921
  }
4853
4922
  return name;
4854
4923
  }
4924
+ function readHarness(path, raw) {
4925
+ if (raw === void 0) return void 0;
4926
+ if (raw === null || typeof raw !== "object" || Array.isArray(raw))
4927
+ throw new ConfigError(path, "[harness] must be a table");
4928
+ for (const key of Object.keys(raw))
4929
+ if (key !== "env")
4930
+ throw new ConfigError(path, `[harness] unknown key ${key}`);
4931
+ try {
4932
+ return {
4933
+ env: envNames(raw["env"], "[harness] env")
4934
+ };
4935
+ } catch (error) {
4936
+ throw new ConfigError(path, error.message);
4937
+ }
4938
+ }
4855
4939
  function readSpec(config) {
4856
4940
  const path = config.path;
4857
4941
  const raw = config.raw;
@@ -4925,6 +5009,7 @@ function readSpec(config) {
4925
5009
  const uiClaude = readUiClaude(path, raw["ui"], sessionHooks);
4926
5010
  const permissions = readPermissions(path, raw["permissions"]);
4927
5011
  const host = readHost(path, raw["host"]);
5012
+ const harness = readHarness(path, raw["harness"]);
4928
5013
  return {
4929
5014
  root: config.dir,
4930
5015
  tools,
@@ -4936,6 +5021,7 @@ function readSpec(config) {
4936
5021
  ...uiClaude ? { uiClaude } : {},
4937
5022
  ...permissions ? { permissions } : {},
4938
5023
  ...host ? { host } : {},
5024
+ ...harness ? { harness } : {},
4939
5025
  ...hooks.legacy.length > 0 ? { hooks: hooks.legacy } : {},
4940
5026
  ...hooks.bundle ? { hookBundle: hooks.bundle } : {},
4941
5027
  ...hooks.deprecations.length > 0 ? { deprecations: hooks.deprecations } : {},
@@ -4956,6 +5042,7 @@ export {
4956
5042
  climbCommand,
4957
5043
  RUNTIMES,
4958
5044
  NATIVE_HOOK_FILES,
5045
+ afterFailure,
4959
5046
  uiClaudeOutputs,
4960
5047
  uiClaudeDoctor,
4961
5048
  linkOf,
@@ -4982,4 +5069,4 @@ export {
4982
5069
  permissionDoctor,
4983
5070
  readSpec
4984
5071
  };
4985
- //# sourceMappingURL=chunk-XJUNAVU2.js.map
5072
+ //# sourceMappingURL=chunk-KHQQGBFJ.js.map
@@ -7,24 +7,24 @@ import {
7
7
  observeSession,
8
8
  openGroup,
9
9
  runOperation
10
- } from "./chunk-6BN35BHI.js";
10
+ } from "./chunk-4LV7KDTS.js";
11
11
  import {
12
12
  nativeHostTools
13
- } from "./chunk-HFE4QDJQ.js";
13
+ } from "./chunk-HEPSITZX.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-FX3LTTMB.js";
20
+ } from "./chunk-47ZGCZQA.js";
21
21
  import {
22
22
  ptyBinary
23
- } from "./chunk-2RTRY45B.js";
23
+ } from "./chunk-QJRJCXX2.js";
24
24
  import {
25
25
  GroupStore,
26
26
  privateJson
27
- } from "./chunk-TVL5RTE6.js";
27
+ } from "./chunk-ITDJ2EXN.js";
28
28
  import {
29
29
  integer,
30
30
  object,
@@ -249,4 +249,4 @@ async function invoke(operation) {
249
249
  export {
250
250
  invoke
251
251
  };
252
- //# sourceMappingURL=chunk-7PTG42QU.js.map
252
+ //# sourceMappingURL=chunk-LCENQ6JR.js.map
@@ -6,10 +6,10 @@ import {
6
6
  } from "./chunk-34DECPVC.js";
7
7
  import {
8
8
  ptyBinary
9
- } from "./chunk-2RTRY45B.js";
9
+ } from "./chunk-QJRJCXX2.js";
10
10
  import {
11
11
  nativeBinary
12
- } from "./chunk-TAOOPXBV.js";
12
+ } from "./chunk-Y2MZ5RE3.js";
13
13
 
14
14
  // src/tui/rust.ts
15
15
  import { spawn } from "child_process";
@@ -64,4 +64,4 @@ export {
64
64
  runTui,
65
65
  dependencies
66
66
  };
67
- //# sourceMappingURL=chunk-WM2RF2MI.js.map
67
+ //# sourceMappingURL=chunk-NLKAEKSG.js.map
@@ -1190,7 +1190,7 @@ function registerReadTool(server, tools) {
1190
1190
 
1191
1191
  // src/mcp.ts
1192
1192
  var SERVER_NAME = "pmcp";
1193
- var SERVER_VERSION = "0.18.3";
1193
+ var SERVER_VERSION = "0.19.0";
1194
1194
  function registerSkillTools(server, tools) {
1195
1195
  registerCatalogTool(server, tools);
1196
1196
  registerFindTool(server, tools);
@@ -1243,4 +1243,4 @@ export {
1243
1243
  registerSkillTools,
1244
1244
  createSkillServer
1245
1245
  };
1246
- //# sourceMappingURL=chunk-7DEYLLIE.js.map
1246
+ //# sourceMappingURL=chunk-OHW3A7Z3.js.map
@@ -5,7 +5,7 @@ import {
5
5
  POLICIES,
6
6
  RUNTIMES,
7
7
  customPolicy
8
- } from "./chunk-XJUNAVU2.js";
8
+ } from "./chunk-KHQQGBFJ.js";
9
9
 
10
10
  // src/hooks/inspection/list.ts
11
11
  function policyRows(compiled) {
@@ -39,4 +39,4 @@ function policyRows(compiled) {
39
39
  export {
40
40
  policyRows
41
41
  };
42
- //# sourceMappingURL=chunk-TZORR6GZ.js.map
42
+ //# sourceMappingURL=chunk-PFWTGEZJ.js.map
@@ -8,10 +8,10 @@ import {
8
8
  prepare,
9
9
  present,
10
10
  writeNative
11
- } from "./chunk-JM2KR2WJ.js";
11
+ } from "./chunk-CYQIAEQT.js";
12
12
  import {
13
13
  ANTIGRAVITY_MCP_PLUGIN
14
- } from "./chunk-E5XVSMBR.js";
14
+ } from "./chunk-QXRD7N35.js";
15
15
  import {
16
16
  changedSincePlan,
17
17
  exists,
@@ -22,7 +22,7 @@ import {
22
22
  same,
23
23
  splitKeyed,
24
24
  withoutBlock
25
- } from "./chunk-XJUNAVU2.js";
25
+ } from "./chunk-KHQQGBFJ.js";
26
26
  import {
27
27
  RULES_DIR,
28
28
  legacyLinks
@@ -32,7 +32,7 @@ import {
32
32
  replaceFile,
33
33
  replaceLink,
34
34
  writeLock
35
- } from "./chunk-TAOOPXBV.js";
35
+ } from "./chunk-Y2MZ5RE3.js";
36
36
 
37
37
  // src/project/apply/files.ts
38
38
  import { mkdirSync } from "fs";
@@ -208,4 +208,4 @@ function project(spec, options) {
208
208
  export {
209
209
  project
210
210
  };
211
- //# sourceMappingURL=chunk-HQWVGU3W.js.map
211
+ //# sourceMappingURL=chunk-Q3GLKL4B.js.map
@@ -1,7 +1,14 @@
1
1
  import {
2
+ missingBinary,
2
3
  nativeBinary,
3
4
  readLock
4
- } from "./chunk-TAOOPXBV.js";
5
+ } from "./chunk-Y2MZ5RE3.js";
6
+ import {
7
+ VERSION
8
+ } from "./chunk-FGEBSQQJ.js";
9
+ import {
10
+ pickEnv
11
+ } from "./chunk-J6KL3COD.js";
5
12
 
6
13
  // src/project/host.ts
7
14
  import { createHash } from "crypto";
@@ -37,7 +44,9 @@ function hostManifest(host) {
37
44
  labels: { ...s.labels, "pmcp.host": s.name },
38
45
  restart: s.restart,
39
46
  max_restarts: s.maxRestarts,
40
- delivery_setup: true
47
+ delivery_setup: true,
48
+ // Only when declared, so an approval made before env existed stays valid.
49
+ ...s.env.length > 0 ? { env: s.env } : {}
41
50
  }))
42
51
  };
43
52
  }
@@ -63,9 +72,25 @@ function ptyBinaryDoctor(env) {
63
72
  tool: "project",
64
73
  check: "pmcp-pty binary",
65
74
  status: "warn",
66
- detail: "pmcp-pty not found; set PMCP_PTY_BIN or put it on PATH"
75
+ detail: missingBinary("pmcp-pty", "PMCP_PTY_BIN", VERSION)
67
76
  };
68
77
  }
78
+ function hostEnvDoctor(spec, env) {
79
+ return (spec.host?.sessions ?? []).filter((s) => s.env.length > 0).map((s) => {
80
+ const { missing } = pickEnv(s.env, env);
81
+ return missing.length === 0 ? {
82
+ tool: "project",
83
+ check: `host env (${s.name})`,
84
+ status: "ok",
85
+ detail: `set: ${s.env.join(", ")}`
86
+ } : {
87
+ tool: "project",
88
+ check: `host env (${s.name})`,
89
+ status: "warn",
90
+ detail: `not set: ${missing.join(", ")}; host up refuses ${s.name} until they are`
91
+ };
92
+ });
93
+ }
69
94
  var sha256 = (text) => createHash("sha256").update(text).digest("hex");
70
95
  function hostDoctor(spec) {
71
96
  if (!spec.host) return [];
@@ -99,6 +124,7 @@ export {
99
124
  hostOutputs,
100
125
  ptyBinary,
101
126
  ptyBinaryDoctor,
127
+ hostEnvDoctor,
102
128
  hostDoctor
103
129
  };
104
- //# sourceMappingURL=chunk-2RTRY45B.js.map
130
+ //# sourceMappingURL=chunk-QJRJCXX2.js.map
@@ -2,7 +2,7 @@ import {
2
2
  MARK,
3
3
  blockOutput,
4
4
  jsonOutput
5
- } from "./chunk-XJUNAVU2.js";
5
+ } from "./chunk-KHQQGBFJ.js";
6
6
  import {
7
7
  ProjectError
8
8
  } from "./chunk-NRBQK6UX.js";
@@ -393,4 +393,4 @@ export {
393
393
  serversForTool,
394
394
  mcpOutputs
395
395
  };
396
- //# sourceMappingURL=chunk-E5XVSMBR.js.map
396
+ //# sourceMappingURL=chunk-QXRD7N35.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createSkillServer
3
- } from "./chunk-7DEYLLIE.js";
3
+ } from "./chunk-OHW3A7Z3.js";
4
4
  import {
5
5
  attachMailbox
6
6
  } from "./chunk-NWOV2E26.js";
@@ -84,4 +84,4 @@ export {
84
84
  serveWithMailbox,
85
85
  main
86
86
  };
87
- //# sourceMappingURL=chunk-M455QSCW.js.map
87
+ //# sourceMappingURL=chunk-TPLV2YX2.js.map