@modootoday/pmcp 0.20.0 → 0.22.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 (124) 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-QJ6MGLBX.js → apply-3PR4UOES.js} +58 -24
  6. package/dist/{available-HYSDAFYH.js → available-BFXLII4A.js} +7 -7
  7. package/dist/{broadcast-LYOA6BEW.js → broadcast-ZALGUJVR.js} +4 -4
  8. package/dist/chunk-2GI5RM3M.js +53 -0
  9. package/dist/chunk-2QJGUR23.js +274 -0
  10. package/dist/{chunk-FD6VGFYZ.js → chunk-3LADLKAI.js} +207 -15
  11. package/dist/{chunk-MZEMLFFD.js → chunk-3OBJVG5R.js} +2 -2
  12. package/dist/{chunk-IQD4W53M.js → chunk-57Q75MS4.js} +18 -18
  13. package/dist/chunk-5YCKFU5Q.js +1672 -0
  14. package/dist/{chunk-IZABPDAO.js → chunk-5ZUDBC3P.js} +2 -2
  15. package/dist/{chunk-EKPMVEIA.js → chunk-73IDLWRI.js} +7 -4
  16. package/dist/{chunk-QYH2NR6G.js → chunk-7FV2LORT.js} +2 -2
  17. package/dist/{chunk-4VK5G3SV.js → chunk-E6YP2PMO.js} +3 -5
  18. package/dist/{chunk-RMHZFWHF.js → chunk-EPNTYTDZ.js} +33 -33
  19. package/dist/{chunk-5JPD6VIH.js → chunk-GBKRDRMZ.js} +22 -7
  20. package/dist/{chunk-T6GOWHK6.js → chunk-GFOQDLPL.js} +6 -1
  21. package/dist/{chunk-RBNMNKNN.js → chunk-JQVSDPFL.js} +3 -3
  22. package/dist/{chunk-OG7QR2DP.js → chunk-KEHB4FZP.js} +17 -2
  23. package/dist/chunk-KUBHGVTD.js +126 -0
  24. package/dist/chunk-L42U5XKC.js +7 -0
  25. package/dist/chunk-LFFIQBNY.js +115 -0
  26. package/dist/{chunk-O2JWF7ZM.js → chunk-LVNGMGOM.js} +2 -2
  27. package/dist/{chunk-PQTM27GU.js → chunk-MR5IBS6L.js} +6 -7
  28. package/dist/{chunk-OAIQ7A3R.js → chunk-NDED2O5B.js} +5 -5
  29. package/dist/{chunk-M2RYXWX2.js → chunk-NHUMPEPV.js} +2 -2
  30. package/dist/{chunk-ONP6JRFZ.js → chunk-OFJIMBTL.js} +2 -2
  31. package/dist/{chunk-YN5GQCHN.js → chunk-RHJEGLYM.js} +6 -1
  32. package/dist/{chunk-JBHGJKSL.js → chunk-RNC7PGW2.js} +2 -2
  33. package/dist/{chunk-J6HNP6HA.js → chunk-RNE4WPBS.js} +2 -2
  34. package/dist/{chunk-YDICIB2A.js → chunk-S4Y44CCC.js} +2 -2
  35. package/dist/{chunk-K2C3KFGB.js → chunk-SEM6WD7J.js} +29 -17
  36. package/dist/{chunk-CQZYQAAV.js → chunk-SLCNCAWY.js} +3 -3
  37. package/dist/{chunk-L4MFGGSI.js → chunk-SPZ42EWE.js} +2 -2
  38. package/dist/{chunk-QOFSPFJ6.js → chunk-TCW2H47H.js} +3405 -3395
  39. package/dist/{chunk-FQAJSNNU.js → chunk-TPGJXENR.js} +3 -3
  40. package/dist/chunk-UKR64U7J.js +20 -0
  41. package/dist/{chunk-66F3HLW4.js → chunk-XB363ZXT.js} +122 -4
  42. package/dist/{chunk-UD3BEEBQ.js → chunk-XZ2TDH3J.js} +80 -3
  43. package/dist/{chunk-QSIADSMQ.js → chunk-Z6WRFOFT.js} +3 -3
  44. package/dist/{claude-GT2BPXEL.js → claude-XVLF4N4S.js} +3 -3
  45. package/dist/{cli-IV5DJCXU.js → cli-6FWRBCWM.js} +8 -8
  46. package/dist/{cli-6HTAJ54L.js → cli-BEEDAD4E.js} +7 -7
  47. package/dist/cli.js +11 -11
  48. package/dist/{completion-PPM7MEI2.js → completion-LHYNCQ3N.js} +7 -7
  49. package/dist/{diagnostics-EWU2ROTG.js → diagnostics-ABTJUYZQ.js} +5 -6
  50. package/dist/{doctor-ZWZQMDKZ.js → doctor-GPPO5L4F.js} +36 -36
  51. package/dist/{entry-NDICBQ2F.js → entry-ARGY5CKA.js} +14 -15
  52. package/dist/{exec-mcp-AG4G7SG7.js → exec-mcp-JEF74XVP.js} +16 -14
  53. package/dist/{harness-JABSZCAA.js → harness-OCXW6YE4.js} +6 -6
  54. package/dist/harness-launch-gate.js +3 -4
  55. package/dist/harness-worker.js +5 -6
  56. package/dist/hook-body.js +247 -86
  57. package/dist/{hook-spec-C7umArqw.d.ts → hook-spec-hZL4MSgi.d.ts} +8 -3
  58. package/dist/hooks-JHXUN5MD.js +24 -0
  59. package/dist/{host-2SZRMHZX.js → host-OBRHBDRE.js} +6 -7
  60. package/dist/{host-BWZ5LA4Q.js → host-VI4ZFCZP.js} +18 -16
  61. package/dist/{host-run-SXLV4LHI.js → host-run-H7AITG7C.js} +5 -7
  62. package/dist/http.js +1 -1
  63. package/dist/{import-mcp-2M7SZRVQ.js → import-mcp-3Y33CUHF.js} +15 -12
  64. package/dist/index.d.ts +11 -2
  65. package/dist/index.js +25 -25
  66. package/dist/{init-HOOIFBAD.js → init-WZJHMWNJ.js} +3 -3
  67. package/dist/{install-HF6CROQP.js → install-7V6NIA7W.js} +4 -4
  68. package/dist/{invoke-JP4MILYY.js → invoke-GWWTXQLO.js} +7 -8
  69. package/dist/{list-UBSBUZKS.js → list-Y6UPLGNF.js} +21 -18
  70. package/dist/{logout-OO3DERRK.js → logout-KAUW4JZZ.js} +16 -13
  71. package/dist/{logs-K3QXKRD4.js → logs-74JGLQG6.js} +4 -4
  72. package/dist/{mailbox-DAJV6VAI.js → mailbox-VK5AVTHI.js} +7 -7
  73. package/dist/{mainline-6K5BA3WX.js → mainline-Q42M2GJ2.js} +173 -34
  74. package/dist/{mcp-JXNTKRJG.js → mcp-IDEUIY2F.js} +2 -2
  75. package/dist/{pause-GRVTSKOK.js → pause-CZ2OZYLC.js} +4 -4
  76. package/dist/project/hook-adapter.d.ts +1 -1
  77. package/dist/{project-M672MKQH.js → project-GVVWLDOJ.js} +5 -5
  78. package/dist/{pty-LHKJKY2E.js → pty-CDLQ4NP2.js} +3 -3
  79. package/dist/report-Z3JV2PCT.js +105 -0
  80. package/dist/{resume-6DMPGG3N.js → resume-DFIHT2RO.js} +4 -4
  81. package/dist/{run-ORBIERI3.js → run-HVNKQHVU.js} +4 -4
  82. package/dist/{run-5W566T3V.js → run-RRWB7U2Q.js} +15 -12
  83. package/dist/{serve-73SRPAV4.js → serve-KJSOU3BR.js} +3 -3
  84. package/dist/{session-XM2CR425.js → session-YZVX4NGN.js} +4 -4
  85. package/dist/{setup-ULKDPF5B.js → setup-3GET6K3J.js} +4 -4
  86. package/dist/smoke-FQQJOQBD.js +16 -0
  87. package/dist/{start-login-BGFAMCZL.js → start-login-RNHSEX5P.js} +16 -13
  88. package/dist/{status-YHXEAJ7U.js → status-3RTGDN2K.js} +10 -10
  89. package/dist/{status-YCW6YJ3S.js → status-RR4VZARJ.js} +40 -23
  90. package/dist/{status-73FEFQUQ.js → status-Y25ONHA5.js} +16 -13
  91. package/dist/stdio.js +2 -2
  92. package/dist/{sweep-XF2HG3EO.js → sweep-EPJMEZR6.js} +4 -4
  93. package/dist/{test-IMNBXOYW.js → test-7NYPQ6YU.js} +30 -20
  94. package/dist/{tui-5GDA22TB.js → tui-H5RPSF4B.js} +4 -4
  95. package/dist/{unbroadcast-XP3OCVN3.js → unbroadcast-NTOC3PY3.js} +4 -4
  96. package/dist/{worker-RV6NGSXT.js → worker-YWFTWIBP.js} +9 -10
  97. package/dist/{worktree-list-4PLE7K6L.js → worktree-list-EMKUMCTQ.js} +2 -2
  98. package/dist/{worktree-sync-GQVYAXGJ.js → worktree-sync-A277AF4M.js} +4 -6
  99. package/docs/commands.md +14 -7
  100. package/docs/git-workflow.md +53 -13
  101. package/docs/hooks.md +138 -10
  102. package/docs/project-configuration.md +31 -1
  103. package/docs/upgrading.md +58 -0
  104. package/gemini-extension.json +2 -2
  105. package/mcp.json +1 -1
  106. package/package.json +5 -5
  107. package/plugin.json +1 -1
  108. package/plugins/pmcp/.claude-plugin/plugin.json +1 -1
  109. package/plugins/pmcp/.mcp.json +1 -1
  110. package/plugins/pmcp/gemini-extension.json +2 -2
  111. package/plugins/pmcp/mcp.json +1 -1
  112. package/plugins/pmcp/mod/sessions/format.ts +2 -2
  113. package/plugins/pmcp/plugin.json +1 -1
  114. package/plugins/pmcp/skills/agent-assets-migrate/SKILL.md +11 -8
  115. package/plugins/pmcp/skills/pmcp-project-init/SKILL.md +11 -7
  116. package/skills/agent-assets-migrate/SKILL.md +11 -8
  117. package/skills/pmcp-project-init/SKILL.md +11 -7
  118. package/dist/chunk-7SDOSTW7.js +0 -130
  119. package/dist/chunk-AWZF72SH.js +0 -1025
  120. package/dist/chunk-FGYFA6JY.js +0 -7
  121. package/dist/chunk-ICF2JZSN.js +0 -92
  122. package/dist/chunk-ISNRDHSD.js +0 -74
  123. package/dist/chunk-QDY6BWE6.js +0 -396
  124. package/dist/hooks-YVQSDQV3.js +0 -21
@@ -21,14 +21,14 @@ tool files.
21
21
 
22
22
  List every source with its bytes and line count, and note which are links:
23
23
 
24
- | Found | Goes to |
25
- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
26
- | `CLAUDE.md`, `GEMINI.md`, `.cursorrules`, `.windsurfrules`, `.github/copilot-instructions.md` | merged into `AGENTS.md`; each then becomes a link to it |
27
- | `.claude/skills/<n>/`, `.agent/skills/<n>/` | `.agents/skills/<n>/` (whole folder) |
28
- | `.claude/commands/<n>.md`, `.agent/workflows/<n>.md` | `.agents/skills/<n>/SKILL.md` plus `[skills.<n>] invocation = "user"` |
29
- | `.claude/agents/<n>.md`, `.gemini/agents/<n>.md`, `.agent/agents/<n>.md` | `.agents/agents/<n>/agent.md` |
30
- | `.claude/rules/*.md` with `paths:` | `.agents/rules/<n>.md` with `trigger: glob` and `globs:` |
31
- | MCP entries in `.mcp.json`, `.gemini/settings.json`, `.codex/config.toml` | `[mcp.<alias>]` in `pmcp.toml` |
24
+ | Found | Goes to |
25
+ | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
26
+ | `CLAUDE.md`, `GEMINI.md`, `.cursorrules`, `.windsurfrules`, `.github/copilot-instructions.md` | merged into `AGENTS.md`; each then becomes a link to it, except `GEMINI.md` (section 2) |
27
+ | `.claude/skills/<n>/`, `.agent/skills/<n>/` | `.agents/skills/<n>/` (whole folder) |
28
+ | `.claude/commands/<n>.md`, `.agent/workflows/<n>.md` | `.agents/skills/<n>/SKILL.md` plus `[skills.<n>] invocation = "user"` |
29
+ | `.claude/agents/<n>.md`, `.gemini/agents/<n>.md`, `.agent/agents/<n>.md` | `.agents/agents/<n>/agent.md` |
30
+ | `.claude/rules/*.md` with `paths:` | `.agents/rules/<n>.md` with `trigger: glob` and `globs:` |
31
+ | MCP entries in `.mcp.json`, `.gemini/settings.json`, `.codex/config.toml` | `[mcp.<alias>]` in `pmcp.toml` |
32
32
 
33
33
  pmcp has no Copilot or Cursor target. Keep those filenames as links to `AGENTS.md` so they
34
34
  cannot drift.
@@ -38,6 +38,9 @@ cannot drift.
38
38
  Diff each instruction file against the others line by line. Keep the union; where two say
39
39
  different things, settle it from the code or ask, and record the decision. Do not summarise
40
40
  during the move. Then replace each old file with a link (`ln -s AGENTS.md CLAUDE.md`).
41
+ For Gemini CLI, delete every `GEMINI.md` once its text is in the `AGENTS.md` beside it, and
42
+ set `"context": { "fileName": ["AGENTS.md"] }` in `.gemini/settings.json` (adding the key if
43
+ the file exists): Gemini CLI then reads `AGENTS.md` in each directory itself.
41
44
  Use file-to-file links only: a directory symlink at the repository root, such as `.agents`
42
45
  pointing at `.agent`, is rejected by the Codex sandbox.
43
46
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pmcp-project-init
3
- description: Set up a repository so every coding agent reads the same instructions, skills, subagents, rules and MCP servers - one AGENTS.md with CLAUDE.md and GEMINI.md linked to it, sources under .agents/, a pmcp.toml with [targets] and [mcp.*] entries, then the optional layers chosen from what the repository is (hook guards, sessions, the git workflow when it is a git checkout, logging, shared MCP authentication, marketplaces), then pmcp project and pmcp doctor, plus the one-time trust step each agent CLI needs. Use when starting a new repository the pmcp way, adding pmcp to a repository that has no agent assets yet, enabling hooks, sessions or the git workflow, or when asked to write a pmcp.toml. Not for moving existing scattered agent files (migrate them instead) or for hosting a skills server.
3
+ description: Set up a repository so every coding agent reads the same instructions, skills, subagents, rules and MCP servers - one AGENTS.md with CLAUDE.md linked to it and Gemini CLI set to read it, sources under .agents/, a pmcp.toml with [targets] and [mcp.*] entries, then the optional layers chosen from what the repository is (hook guards, sessions, the git workflow when it is a git checkout, logging, shared MCP authentication, marketplaces), then pmcp project and pmcp doctor, plus the one-time trust step each agent CLI needs. Use when starting a new repository the pmcp way, adding pmcp to a repository that has no agent assets yet, enabling hooks, sessions or the git workflow, or when asked to write a pmcp.toml. Not for moving existing scattered agent files (migrate them instead) or for hosting a skills server.
4
4
  metadata:
5
5
  tier: open
6
6
  level: L2
@@ -22,18 +22,22 @@ Install `@modootoday/pmcp` as a dev dependency. Never run the bare unscoped name
22
22
  through npx: that name is not the package, and whoever publishes it later would run in your
23
23
  repository.
24
24
 
25
- ## 1. Instructions: one file, two links
25
+ ## 1. Instructions: one file, one link, one setting
26
26
 
27
27
  ```sh
28
28
  printf '# <project>\n\n' > AGENTS.md
29
29
  ln -s AGENTS.md CLAUDE.md
30
- ln -s AGENTS.md GEMINI.md
30
+ mkdir -p .gemini
31
+ printf '{\n "context": { "fileName": ["AGENTS.md"] }\n}\n' > .gemini/settings.json
31
32
  ```
32
33
 
33
- `AGENTS.md` is the real file. Claude Code reads `CLAUDE.md` and Gemini CLI `GEMINI.md`, so
34
- the links make them read the same text. pmcp does not create these links. Keep them
35
- file-to-file links; a directory symlink at the repository root (for example `.agents`
36
- pointing at another folder) is rejected by the Codex sandbox.
34
+ `AGENTS.md` is the real file. Claude Code reads `CLAUDE.md`, so the link makes it read the
35
+ same text. Gemini CLI reads every name in `context.fileName`, in each directory, so the
36
+ setting makes it read `AGENTS.md` itself, nested ones included, and no `GEMINI.md` is
37
+ needed. If `.gemini/settings.json` already exists, add the key to it; `pmcp project` keeps
38
+ keys it does not own. pmcp creates neither the link nor the setting. Keep the link
39
+ file-to-file; a directory symlink at the repository root (for example `.agents` pointing at
40
+ another folder) is rejected by the Codex sandbox.
37
41
 
38
42
  ## 2. Sources under .agents/
39
43
 
@@ -21,14 +21,14 @@ tool files.
21
21
 
22
22
  List every source with its bytes and line count, and note which are links:
23
23
 
24
- | Found | Goes to |
25
- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
26
- | `CLAUDE.md`, `GEMINI.md`, `.cursorrules`, `.windsurfrules`, `.github/copilot-instructions.md` | merged into `AGENTS.md`; each then becomes a link to it |
27
- | `.claude/skills/<n>/`, `.agent/skills/<n>/` | `.agents/skills/<n>/` (whole folder) |
28
- | `.claude/commands/<n>.md`, `.agent/workflows/<n>.md` | `.agents/skills/<n>/SKILL.md` plus `[skills.<n>] invocation = "user"` |
29
- | `.claude/agents/<n>.md`, `.gemini/agents/<n>.md`, `.agent/agents/<n>.md` | `.agents/agents/<n>/agent.md` |
30
- | `.claude/rules/*.md` with `paths:` | `.agents/rules/<n>.md` with `trigger: glob` and `globs:` |
31
- | MCP entries in `.mcp.json`, `.gemini/settings.json`, `.codex/config.toml` | `[mcp.<alias>]` in `pmcp.toml` |
24
+ | Found | Goes to |
25
+ | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
26
+ | `CLAUDE.md`, `GEMINI.md`, `.cursorrules`, `.windsurfrules`, `.github/copilot-instructions.md` | merged into `AGENTS.md`; each then becomes a link to it, except `GEMINI.md` (section 2) |
27
+ | `.claude/skills/<n>/`, `.agent/skills/<n>/` | `.agents/skills/<n>/` (whole folder) |
28
+ | `.claude/commands/<n>.md`, `.agent/workflows/<n>.md` | `.agents/skills/<n>/SKILL.md` plus `[skills.<n>] invocation = "user"` |
29
+ | `.claude/agents/<n>.md`, `.gemini/agents/<n>.md`, `.agent/agents/<n>.md` | `.agents/agents/<n>/agent.md` |
30
+ | `.claude/rules/*.md` with `paths:` | `.agents/rules/<n>.md` with `trigger: glob` and `globs:` |
31
+ | MCP entries in `.mcp.json`, `.gemini/settings.json`, `.codex/config.toml` | `[mcp.<alias>]` in `pmcp.toml` |
32
32
 
33
33
  pmcp has no Copilot or Cursor target. Keep those filenames as links to `AGENTS.md` so they
34
34
  cannot drift.
@@ -38,6 +38,9 @@ cannot drift.
38
38
  Diff each instruction file against the others line by line. Keep the union; where two say
39
39
  different things, settle it from the code or ask, and record the decision. Do not summarise
40
40
  during the move. Then replace each old file with a link (`ln -s AGENTS.md CLAUDE.md`).
41
+ For Gemini CLI, delete every `GEMINI.md` once its text is in the `AGENTS.md` beside it, and
42
+ set `"context": { "fileName": ["AGENTS.md"] }` in `.gemini/settings.json` (adding the key if
43
+ the file exists): Gemini CLI then reads `AGENTS.md` in each directory itself.
41
44
  Use file-to-file links only: a directory symlink at the repository root, such as `.agents`
42
45
  pointing at `.agent`, is rejected by the Codex sandbox.
43
46
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pmcp-project-init
3
- description: Set up a repository so every coding agent reads the same instructions, skills, subagents, rules and MCP servers - one AGENTS.md with CLAUDE.md and GEMINI.md linked to it, sources under .agents/, a pmcp.toml with [targets] and [mcp.*] entries, then the optional layers chosen from what the repository is (hook guards, sessions, the git workflow when it is a git checkout, logging, shared MCP authentication, marketplaces), then pmcp project and pmcp doctor, plus the one-time trust step each agent CLI needs. Use when starting a new repository the pmcp way, adding pmcp to a repository that has no agent assets yet, enabling hooks, sessions or the git workflow, or when asked to write a pmcp.toml. Not for moving existing scattered agent files (migrate them instead) or for hosting a skills server.
3
+ description: Set up a repository so every coding agent reads the same instructions, skills, subagents, rules and MCP servers - one AGENTS.md with CLAUDE.md linked to it and Gemini CLI set to read it, sources under .agents/, a pmcp.toml with [targets] and [mcp.*] entries, then the optional layers chosen from what the repository is (hook guards, sessions, the git workflow when it is a git checkout, logging, shared MCP authentication, marketplaces), then pmcp project and pmcp doctor, plus the one-time trust step each agent CLI needs. Use when starting a new repository the pmcp way, adding pmcp to a repository that has no agent assets yet, enabling hooks, sessions or the git workflow, or when asked to write a pmcp.toml. Not for moving existing scattered agent files (migrate them instead) or for hosting a skills server.
4
4
  metadata:
5
5
  tier: open
6
6
  level: L2
@@ -22,18 +22,22 @@ Install `@modootoday/pmcp` as a dev dependency. Never run the bare unscoped name
22
22
  through npx: that name is not the package, and whoever publishes it later would run in your
23
23
  repository.
24
24
 
25
- ## 1. Instructions: one file, two links
25
+ ## 1. Instructions: one file, one link, one setting
26
26
 
27
27
  ```sh
28
28
  printf '# <project>\n\n' > AGENTS.md
29
29
  ln -s AGENTS.md CLAUDE.md
30
- ln -s AGENTS.md GEMINI.md
30
+ mkdir -p .gemini
31
+ printf '{\n "context": { "fileName": ["AGENTS.md"] }\n}\n' > .gemini/settings.json
31
32
  ```
32
33
 
33
- `AGENTS.md` is the real file. Claude Code reads `CLAUDE.md` and Gemini CLI `GEMINI.md`, so
34
- the links make them read the same text. pmcp does not create these links. Keep them
35
- file-to-file links; a directory symlink at the repository root (for example `.agents`
36
- pointing at another folder) is rejected by the Codex sandbox.
34
+ `AGENTS.md` is the real file. Claude Code reads `CLAUDE.md`, so the link makes it read the
35
+ same text. Gemini CLI reads every name in `context.fileName`, in each directory, so the
36
+ setting makes it read `AGENTS.md` itself, nested ones included, and no `GEMINI.md` is
37
+ needed. If `.gemini/settings.json` already exists, add the key to it; `pmcp project` keeps
38
+ keys it does not own. pmcp creates neither the link nor the setting. Keep the link
39
+ file-to-file; a directory symlink at the repository root (for example `.agents` pointing at
40
+ another folder) is rejected by the Codex sandbox.
37
41
 
38
42
  ## 2. Sources under .agents/
39
43
 
@@ -1,130 +0,0 @@
1
- import {
2
- missingBinary,
3
- nativeBinary,
4
- readLock
5
- } from "./chunk-66F3HLW4.js";
6
- import {
7
- VERSION
8
- } from "./chunk-FGYFA6JY.js";
9
- import {
10
- pickEnv
11
- } from "./chunk-J6KL3COD.js";
12
-
13
- // src/project/host.ts
14
- import { createHash } from "crypto";
15
- import { existsSync, readFileSync } from "fs";
16
- import { join } from "path";
17
- var HOST_DIRECTORY = ".agents/pmcp-pty";
18
- var HOST_MANIFEST = `${HOST_DIRECTORY}/host.json`;
19
- var HOST_POLICY = `${HOST_DIRECTORY}/policy.json`;
20
- function hostPolicy(host) {
21
- const browser = host.browser.allowPrivate;
22
- const launch = host.desktop.launch;
23
- return {
24
- version: 1,
25
- mcp_write: host.mcpWrite,
26
- roots: host.roots,
27
- allow: host.answers.map((a) => ({
28
- profile: a.runtime,
29
- dialog: a.dialog,
30
- options: a.options
31
- })),
32
- ...browser.length > 0 ? { browser: { allow_private: browser } } : {},
33
- ...launch.length > 0 ? { desktop: { launch } } : {}
34
- };
35
- }
36
- function hostManifest(host) {
37
- return {
38
- version: 1,
39
- sessions: host.sessions.map((s) => ({
40
- name: s.name,
41
- profile: s.runtime,
42
- cwd: s.cwd,
43
- argv: s.argv,
44
- labels: { ...s.labels, "pmcp.host": s.name },
45
- restart: s.restart,
46
- max_restarts: s.maxRestarts,
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 } : {}
50
- }))
51
- };
52
- }
53
- var json = (value) => `${JSON.stringify(value, null, 2)}
54
- `;
55
- function hostOutputs(spec) {
56
- if (!spec.host) return [];
57
- return [
58
- {
59
- kind: "file",
60
- path: HOST_MANIFEST,
61
- content: json(hostManifest(spec.host))
62
- },
63
- { kind: "file", path: HOST_POLICY, content: json(hostPolicy(spec.host)) }
64
- ];
65
- }
66
- function ptyBinary(env) {
67
- return nativeBinary("pmcp-pty", "PMCP_PTY_BIN", env);
68
- }
69
- function ptyBinaryDoctor(env) {
70
- const found = ptyBinary(env);
71
- return found ? { tool: "project", check: "pmcp-pty binary", status: "ok", detail: found } : {
72
- tool: "project",
73
- check: "pmcp-pty binary",
74
- status: "warn",
75
- detail: missingBinary("pmcp-pty", "PMCP_PTY_BIN", VERSION)
76
- };
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
- }
94
- var sha256 = (text) => createHash("sha256").update(text).digest("hex");
95
- function hostDoctor(spec) {
96
- if (!spec.host) return [];
97
- const lock = new Map(readLock(spec.root).map((e) => [e.path, e]));
98
- const bad = [HOST_MANIFEST, HOST_POLICY].filter((path) => {
99
- const file = join(spec.root, path);
100
- if (!existsSync(file)) return true;
101
- const entry = lock.get(path);
102
- return entry?.sha256 !== sha256(readFileSync(file, "utf8"));
103
- });
104
- const { sessions, answers, mcpWrite } = spec.host;
105
- const summary = `${sessions.length} session(s), ${answers.length} answer rule(s), mcp_write ${mcpWrite}`;
106
- return [
107
- bad.length === 0 ? {
108
- tool: "project",
109
- check: "pmcp-pty host projected",
110
- status: "ok",
111
- detail: summary
112
- } : {
113
- tool: "project",
114
- check: "pmcp-pty host projected",
115
- status: "fail",
116
- detail: `run pmcp project: ${bad.join(", ")}`
117
- }
118
- ];
119
- }
120
-
121
- export {
122
- HOST_MANIFEST,
123
- HOST_POLICY,
124
- hostOutputs,
125
- ptyBinary,
126
- ptyBinaryDoctor,
127
- hostEnvDoctor,
128
- hostDoctor
129
- };
130
- //# sourceMappingURL=chunk-7SDOSTW7.js.map