@modootoday/pmcp 0.17.4 → 0.18.2

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 (272) hide show
  1. package/.agents/plugins/marketplace.json +1 -1
  2. package/.claude-plugin/marketplace.json +1 -1
  3. package/.claude-plugin/plugin.json +2 -2
  4. package/.mcp.json +1 -1
  5. package/CHANGELOG.md +152 -0
  6. package/CONTRIBUTING.md +71 -0
  7. package/README.md +98 -201
  8. package/SECURITY.md +17 -1
  9. package/dist/apply-JUTGS5WZ.js +242 -0
  10. package/dist/{attachment-tU5FZrgZ.d.ts → attachment-D84OGI6n.d.ts} +1 -1
  11. package/dist/available-DBSIVVJ6.js +73 -0
  12. package/dist/broadcast-CBMVOV3G.js +18 -0
  13. package/dist/chunk-26WLNWDG.js +93 -0
  14. package/dist/chunk-2FIV63WC.js +252 -0
  15. package/dist/chunk-2P4Z2NUX.js +28 -0
  16. package/dist/chunk-34DECPVC.js +22 -0
  17. package/dist/chunk-3FCFAQDG.js +42 -0
  18. package/dist/chunk-3IDXEV5E.js +1934 -0
  19. package/dist/chunk-3PW4FI7U.js +32 -0
  20. package/dist/chunk-3Y3HDMHA.js +108 -0
  21. package/dist/chunk-47O3X4VS.js +113 -0
  22. package/dist/chunk-4NDEP7HU.js +26 -0
  23. package/dist/chunk-5OMOPUE6.js +39 -0
  24. package/dist/chunk-5QQWS4US.js +53 -0
  25. package/dist/chunk-5ZABTVSW.js +48 -0
  26. package/dist/chunk-65KAQSJP.js +7 -0
  27. package/dist/chunk-6STKGOCW.js +27 -0
  28. package/dist/chunk-6WXMJOMI.js +9 -0
  29. package/dist/chunk-73AKO4UL.js +24 -0
  30. package/dist/chunk-7DLZC73N.js +29 -0
  31. package/dist/chunk-7GBYECSK.js +72 -0
  32. package/dist/chunk-7HFIGCSL.js +419 -0
  33. package/dist/chunk-7TD53M7L.js +13 -0
  34. package/dist/chunk-7UCZAN4J.js +778 -0
  35. package/dist/chunk-A4PKLESO.js +112 -0
  36. package/dist/chunk-A7VF7A35.js +1025 -0
  37. package/dist/chunk-ABTJQ4QV.js +74 -0
  38. package/dist/chunk-AJ4VXM2U.js +349 -0
  39. package/dist/chunk-BBTBJCFA.js +380 -0
  40. package/dist/chunk-BU65MNVU.js +13 -0
  41. package/dist/chunk-C4NHQGHL.js +142 -0
  42. package/dist/chunk-CJTKR6K6.js +1213 -0
  43. package/dist/chunk-D77IRGHO.js +1246 -0
  44. package/dist/chunk-DCU2EXQV.js +78 -0
  45. package/dist/chunk-DMZHQZ7P.js +104 -0
  46. package/dist/chunk-DZ2MRTYT.js +135 -0
  47. package/dist/chunk-E2YOZ2FF.js +207 -0
  48. package/dist/chunk-E3DQB5LS.js +48 -0
  49. package/dist/chunk-EATCUWGG.js +66 -0
  50. package/dist/chunk-EAWPJHJ7.js +155 -0
  51. package/dist/chunk-EIDIVIAD.js +33 -0
  52. package/dist/chunk-F5QYZK7E.js +396 -0
  53. package/dist/chunk-F5XMGOOX.js +28 -0
  54. package/dist/chunk-FENOGX3U.js +31 -0
  55. package/dist/chunk-GZHHEHKY.js +44 -0
  56. package/dist/chunk-HDMBVLCZ.js +53 -0
  57. package/dist/chunk-HQOB7OQS.js +81 -0
  58. package/dist/chunk-I2ZP2PSA.js +211 -0
  59. package/dist/chunk-IG33DXLT.js +151 -0
  60. package/dist/chunk-IJBSOWHK.js +86 -0
  61. package/dist/chunk-INT7QLEU.js +114 -0
  62. package/dist/chunk-J7UYNJCR.js +9 -0
  63. package/dist/chunk-JEL35P7S.js +53 -0
  64. package/dist/chunk-JGJ4INEN.js +32 -0
  65. package/dist/chunk-JS5RTH4I.js +84 -0
  66. package/dist/chunk-JWRZDYB5.js +59 -0
  67. package/dist/chunk-KMXRRSKT.js +660 -0
  68. package/dist/chunk-LBXO4VPG.js +73 -0
  69. package/dist/chunk-LLBPVZXM.js +67 -0
  70. package/dist/chunk-LLT5FQBE.js +57 -0
  71. package/dist/chunk-LMT3PPXJ.js +17 -0
  72. package/dist/chunk-LMUBBIE2.js +83 -0
  73. package/dist/chunk-LTZH5E3G.js +479 -0
  74. package/dist/chunk-LW4TG7EL.js +39 -0
  75. package/dist/chunk-MPSQXSC6.js +346 -0
  76. package/dist/chunk-MVFH26QT.js +97 -0
  77. package/dist/chunk-NLEXKE7U.js +67 -0
  78. package/dist/chunk-NQPURJT5.js +44 -0
  79. package/dist/chunk-NRBQK6UX.js +105 -0
  80. package/dist/chunk-OEH47H6A.js +48 -0
  81. package/dist/chunk-OG7QR2DP.js +75 -0
  82. package/dist/chunk-OPYFEHKG.js +52 -0
  83. package/dist/chunk-P4N7DBD5.js +83 -0
  84. package/dist/chunk-PAX3QXX2.js +140 -0
  85. package/dist/chunk-PKODFR5F.js +102 -0
  86. package/dist/chunk-PMJG2CXF.js +122 -0
  87. package/dist/chunk-Q5H3L6Y4.js +23 -0
  88. package/dist/chunk-QEF7EK3T.js +28 -0
  89. package/dist/chunk-QEW4J3IZ.js +74 -0
  90. package/dist/chunk-QPL7E2HW.js +464 -0
  91. package/dist/chunk-R2GPCZUX.js +22 -0
  92. package/dist/chunk-R5MT42JS.js +284 -0
  93. package/dist/chunk-RMATE45Z.js +197 -0
  94. package/dist/chunk-RPQOBHVU.js +87 -0
  95. package/dist/chunk-S3PIAMXV.js +230 -0
  96. package/dist/chunk-T3LKX23M.js +168 -0
  97. package/dist/chunk-T6GOWHK6.js +30 -0
  98. package/dist/chunk-TIA4SPU2.js +10 -0
  99. package/dist/chunk-TNCZ6444.js +57 -0
  100. package/dist/chunk-TVL5RTE6.js +269 -0
  101. package/dist/chunk-TXQ7L33K.js +45 -0
  102. package/dist/chunk-UPQTAHUK.js +189 -0
  103. package/dist/chunk-V4NPDK6X.js +14 -0
  104. package/dist/chunk-VJFEN6DJ.js +38 -0
  105. package/dist/chunk-VMHUEOT5.js +643 -0
  106. package/dist/chunk-VRPMYPZU.js +4985 -0
  107. package/dist/chunk-WIW772I3.js +25 -0
  108. package/dist/chunk-XELAZAIM.js +136 -0
  109. package/dist/chunk-XNML2KIC.js +23 -0
  110. package/dist/chunk-XP2U3LO3.js +30 -0
  111. package/dist/chunk-YGOWIJPE.js +51 -0
  112. package/dist/chunk-YIXDHQYE.js +11 -0
  113. package/dist/chunk-YSAWTGNA.js +117 -0
  114. package/dist/claude-U2JC2DNQ.js +77 -0
  115. package/dist/cli-MI4ZCAZ3.js +41 -0
  116. package/dist/cli-ZN7ZVDEZ.js +46 -0
  117. package/dist/cli.js +144 -16197
  118. package/dist/completion-ILSRB3LW.js +142 -0
  119. package/dist/config-DnpLL2kT.d.ts +46 -0
  120. package/dist/{service-qpCsOXkQ.d.ts → core-C1LPjxK6.d.ts} +2 -6
  121. package/dist/diagnostics-XKXVVQWH.js +93 -0
  122. package/dist/doctor-O2E63YGO.js +538 -0
  123. package/dist/entry-X6CSYQRQ.js +305 -0
  124. package/dist/exec-mcp-2PMWBPD7.js +365 -0
  125. package/dist/harness-L2KSI2ZB.js +177 -0
  126. package/dist/harness-egress-bridge.js +4 -4
  127. package/dist/harness-launch-gate.js +47 -940
  128. package/dist/harness-pane-runner.js +13 -80
  129. package/dist/harness-worker.js +21 -2703
  130. package/dist/hook-body.js +5222 -0
  131. package/dist/hook-spec-C5fWTSCH.d.ts +100 -0
  132. package/dist/hook.js +26 -0
  133. package/dist/hooks-BHTA44X7.js +21 -0
  134. package/dist/host-UIZAXXQH.js +22 -0
  135. package/dist/host-UWK754BW.js +210 -0
  136. package/dist/host-run-BI2OTZDZ.js +307 -0
  137. package/dist/http.d.ts +5 -42
  138. package/dist/http.js +21 -2234
  139. package/dist/import-mcp-GPKJI7DI.js +400 -0
  140. package/dist/index.d.ts +146 -168
  141. package/dist/index.js +133 -4948
  142. package/dist/init-3C2Y7BNJ.js +14 -0
  143. package/dist/install-GG7HHZK2.js +796 -0
  144. package/dist/invoke-44CJRVMK.js +23 -0
  145. package/dist/list-MCP2FXUF.js +68 -0
  146. package/dist/list-WL6L4J5H.js +65 -0
  147. package/dist/load-BEUBABtB.d.ts +21 -0
  148. package/dist/logout-F5EJ5MOU.js +44 -0
  149. package/dist/logs-TBUA4UWU.js +107 -0
  150. package/dist/mailbox/index.d.ts +10 -5
  151. package/dist/mailbox/index.js +53 -1572
  152. package/dist/mailbox-BMTZOSZ7.js +285 -0
  153. package/dist/mailbox-GDJ7BWQN.js +189 -0
  154. package/dist/mainline-KAD2ERLP.js +639 -0
  155. package/dist/marketplace-G4VQET5W.js +191 -0
  156. package/dist/mcp-235QZN2A.js +15 -0
  157. package/dist/mcp-FJ2UQ4RH.js +193 -0
  158. package/dist/models-ISU4DCMA.js +32 -0
  159. package/dist/opencode-CN7JLQYO.js +60 -0
  160. package/dist/pause-7LILUVGL.js +18 -0
  161. package/dist/preview-DT7DWG5F.js +91 -0
  162. package/dist/project/hook-adapter.d.ts +5 -2
  163. package/dist/project/hook-adapter.js +41 -27
  164. package/dist/project-5YV5CUEG.js +70 -0
  165. package/dist/pty-XTJ4MIWK.js +94 -0
  166. package/dist/recovery-U6QB3PMT.js +100 -0
  167. package/dist/reindex-Y27QJFDB.js +22 -0
  168. package/dist/resume-26VFAAMH.js +18 -0
  169. package/dist/run-3AXTZSR7.js +126 -0
  170. package/dist/run-3SOVRQIA.js +19 -0
  171. package/dist/serve-DQMKTFIV.js +104 -0
  172. package/dist/session-XM2CR425.js +159 -0
  173. package/dist/setup-DTKZLZUT.js +18 -0
  174. package/dist/start-login-YTZV6KMF.js +416 -0
  175. package/dist/status-A2OUTNGK.js +9 -0
  176. package/dist/status-H2VAHIDV.js +10 -0
  177. package/dist/status-MROQ7WR7.js +43 -0
  178. package/dist/status-RO55QPKV.js +55 -0
  179. package/dist/status-UME2L33L.js +286 -0
  180. package/dist/stdio.d.ts +3 -13
  181. package/dist/stdio.js +16 -3186
  182. package/dist/sweep-35LGQTTO.js +18 -0
  183. package/dist/test-AGZOJLRZ.js +561 -0
  184. package/dist/tools-gpHNq9Dh.d.ts +328 -0
  185. package/dist/tui-G5LLWCSV.js +153 -0
  186. package/dist/unbroadcast-5QNGAJR2.js +18 -0
  187. package/dist/validate-IU52H2IC.js +46 -0
  188. package/dist/worker-QZ5T6LJD.js +80 -0
  189. package/dist/worktree-create-PZSRB7PH.js +89 -0
  190. package/dist/worktree-list-JYB6VXLW.js +51 -0
  191. package/dist/worktree-sync-UF5CXPWV.js +30 -0
  192. package/docs/authoring.md +82 -0
  193. package/docs/browser-and-desktop.md +46 -0
  194. package/docs/commands.md +325 -0
  195. package/docs/compare.md +35 -0
  196. package/docs/compatibility.md +55 -0
  197. package/docs/embeddings.md +1 -1
  198. package/docs/getting-started.md +105 -0
  199. package/docs/git-workflow.md +60 -0
  200. package/docs/glossary.md +31 -0
  201. package/docs/hooks/capabilities/antigravity.json +199 -0
  202. package/docs/hooks/capabilities/claude.json +179 -0
  203. package/docs/hooks/capabilities/codex.json +179 -0
  204. package/docs/hooks/capabilities/gemini.json +196 -0
  205. package/docs/hooks/capabilities/grok.json +192 -0
  206. package/docs/hooks/capabilities/opencode.json +184 -0
  207. package/docs/hooks.md +264 -0
  208. package/docs/install.md +72 -0
  209. package/docs/library-skills.md +132 -0
  210. package/docs/mailbox.md +16 -5
  211. package/docs/project-configuration.md +540 -58
  212. package/docs/sessions.md +64 -0
  213. package/docs/skills.md +4 -45
  214. package/docs/terminal-harness.md +92 -44
  215. package/docs/terminal-workspace.md +81 -169
  216. package/gemini-extension.json +2 -2
  217. package/mcp.json +1 -1
  218. package/package.json +16 -2
  219. package/plugin.json +2 -2
  220. package/plugins/pmcp/.claude-plugin/plugin.json +4 -2
  221. package/plugins/pmcp/.mcp.json +1 -1
  222. package/plugins/pmcp/gemini-extension.json +2 -2
  223. package/plugins/pmcp/mcp.json +1 -1
  224. package/plugins/pmcp/mod/commands.ts +72 -0
  225. package/plugins/pmcp/mod/contract.d.ts +39 -0
  226. package/plugins/pmcp/mod/draw.tsx +216 -0
  227. package/plugins/pmcp/mod/guard.ts +42 -0
  228. package/plugins/pmcp/mod/hooks.json +4 -0
  229. package/plugins/pmcp/mod/host.ts +46 -0
  230. package/plugins/pmcp/mod/model.ts +144 -0
  231. package/plugins/pmcp/mod/reader/index.ts +18 -0
  232. package/plugins/pmcp/mod/reader/read.ts +76 -0
  233. package/plugins/pmcp/mod/reader/settings.ts +54 -0
  234. package/plugins/pmcp/mod/reader/types.ts +38 -0
  235. package/plugins/pmcp/mod/register.tsx +73 -0
  236. package/plugins/pmcp/mod/sessions/format.ts +91 -0
  237. package/plugins/pmcp/mod/sessions/types.ts +162 -0
  238. package/plugins/pmcp/mod/snapshot.ts +75 -0
  239. package/plugins/pmcp/mod/spinner.tsx +30 -0
  240. package/plugins/pmcp/mod/state.ts +28 -0
  241. package/plugins/pmcp/plugin.json +2 -2
  242. package/plugins/pmcp/skills/agent-assets-migrate/SKILL.md +96 -0
  243. package/plugins/pmcp/skills/headless-agents-ci-scaffold/SKILL.md +101 -0
  244. package/plugins/pmcp/skills/marketplace-plugin-scaffold/SKILL.md +87 -0
  245. package/plugins/pmcp/skills/package-skill-catalog/SKILL.md +51 -15
  246. package/plugins/pmcp/skills/pmcp-browser/SKILL.md +27 -0
  247. package/plugins/pmcp/skills/pmcp-desktop/SKILL.md +25 -0
  248. package/plugins/pmcp/skills/pmcp-project-init/SKILL.md +153 -0
  249. package/plugins/pmcp/skills/pmcp-sessions-and-git/SKILL.md +96 -0
  250. package/plugins/pmcp/skills/skill-package-scaffold/SKILL.md +89 -0
  251. package/schema/catalog-v1.json +187 -0
  252. package/schema/library.json +196 -0
  253. package/schema/marketplace-manifest.json +144 -0
  254. package/schema/plugin-manifest.json +59 -0
  255. package/schema/skill-frontmatter.json +170 -0
  256. package/schema/skill-metadata-core.json +131 -0
  257. package/skills/agent-assets-migrate/SKILL.md +96 -0
  258. package/skills/headless-agents-ci-scaffold/SKILL.md +101 -0
  259. package/skills/marketplace-plugin-scaffold/SKILL.md +87 -0
  260. package/skills/package-skill-catalog/SKILL.md +51 -15
  261. package/skills/pmcp-browser/SKILL.md +27 -0
  262. package/skills/pmcp-desktop/SKILL.md +25 -0
  263. package/skills/pmcp-project-init/SKILL.md +153 -0
  264. package/skills/pmcp-sessions-and-git/SKILL.md +96 -0
  265. package/skills/skill-package-scaffold/SKILL.md +89 -0
  266. package/dist/config-BkSpjUG6.d.ts +0 -50
  267. package/dist/embed-DRROSD3F.d.ts +0 -53
  268. package/dist/hook-spec-CSJJySsH.d.ts +0 -11
  269. package/dist/server-VWSY3Shw.d.ts +0 -543
  270. package/dist/tui-worker.js +0 -6549
  271. package/docs/manual-library-skills.md +0 -74
  272. /package/dist/{tui-worker.d.ts → hook.d.ts} +0 -0
package/SECURITY.md CHANGED
@@ -15,7 +15,7 @@ It must not send dependency inventories or search queries over the network.
15
15
  Network access belongs to explicit CLI commands such as catalog retrieval,
16
16
  authentication, installation, and synchronization.
17
17
 
18
- Package installation changes a project manifest and lockfile through npm or Bun.
18
+ Package installation changes a project manifest and lockfile through npm, Bun or pnpm.
19
19
  Inspect the plan with `--dry-run`; non-interactive application requires `--yes`.
20
20
  The CLI disables dependency install scripts for skill-package installation and
21
21
  checks catalog integrity against registry metadata before applying a plan.
@@ -25,6 +25,22 @@ The server returns skill files as text or base64 and never runs them. An MCP con
25
25
  refuses browser origins it was not given, and caps request size; host names and a
26
26
  per-caller rate limit are options. Authentication and call records belong to the host.
27
27
 
28
+ The optional parts that act on your machine run as your own user:
29
+
30
+ - The [hook bundle](docs/hooks.md) refuses risky commands and edits for the runtimes it
31
+ targets. Guards fail closed; a bundle that cannot load fails open. It stops accidents and
32
+ agents that were told to do something unsafe; it does not replace the runtime's own sandbox.
33
+ - [pmcp-browser](docs/browser-and-desktop.md) sends every request through its own proxy,
34
+ which refuses loopback, private, link-local, metadata and CGNAT addresses and ports other
35
+ than 80 and 443, and starts each Chromium with a fresh profile. Page content reaches the
36
+ agent as data, not instructions.
37
+ - [pmcp-desktop](docs/browser-and-desktop.md) launches only the apps an approved policy
38
+ lists, never a browser.
39
+ - A [`[host]` policy](docs/project-configuration.md#sessions-pmcp-pty-hosts) takes effect
40
+ only after you approve it in your own terminal, and login, auth, trust and hook-review
41
+ dialogs are never answered. The approval check stops accidents, not a process running as
42
+ you, which can write the approvals directory; that guide says what a real boundary needs.
43
+
28
44
  ## Supported versions
29
45
 
30
46
  Security fixes are released on the latest published version. Include the pmcp
@@ -0,0 +1,242 @@
1
+ import {
2
+ specFrom
3
+ } from "./chunk-FENOGX3U.js";
4
+ import {
5
+ catalogFrom
6
+ } from "./chunk-5QQWS4US.js";
7
+ import "./chunk-7DLZC73N.js";
8
+ import {
9
+ project
10
+ } from "./chunk-I2ZP2PSA.js";
11
+ import "./chunk-P4N7DBD5.js";
12
+ import {
13
+ renderFrontmatter,
14
+ splitFrontmatter
15
+ } from "./chunk-A7VF7A35.js";
16
+ import "./chunk-F5QYZK7E.js";
17
+ import {
18
+ RUNTIMES
19
+ } from "./chunk-VRPMYPZU.js";
20
+ import "./chunk-HQOB7OQS.js";
21
+ import "./chunk-S3PIAMXV.js";
22
+ import "./chunk-JS5RTH4I.js";
23
+ import "./chunk-DCU2EXQV.js";
24
+ import "./chunk-XELAZAIM.js";
25
+ import "./chunk-QEW4J3IZ.js";
26
+ import "./chunk-OPYFEHKG.js";
27
+ import "./chunk-EATCUWGG.js";
28
+ import {
29
+ ProjectError
30
+ } from "./chunk-NRBQK6UX.js";
31
+ import "./chunk-3PW4FI7U.js";
32
+ import "./chunk-26WLNWDG.js";
33
+ import "./chunk-LTZH5E3G.js";
34
+ import "./chunk-C4NHQGHL.js";
35
+ import "./chunk-Q5H3L6Y4.js";
36
+ import "./chunk-73AKO4UL.js";
37
+ import "./chunk-JEL35P7S.js";
38
+ import "./chunk-A4PKLESO.js";
39
+ import "./chunk-V4NPDK6X.js";
40
+ import {
41
+ kindOf
42
+ } from "./chunk-KMXRRSKT.js";
43
+ import "./chunk-YSAWTGNA.js";
44
+ import "./chunk-DMZHQZ7P.js";
45
+ import {
46
+ recordProjector
47
+ } from "./chunk-7HFIGCSL.js";
48
+ import "./chunk-OEH47H6A.js";
49
+ import "./chunk-IJBSOWHK.js";
50
+ import "./chunk-65KAQSJP.js";
51
+ import "./chunk-QPL7E2HW.js";
52
+ import "./chunk-PMJG2CXF.js";
53
+
54
+ // src/project/edit.ts
55
+ import {
56
+ cpSync,
57
+ existsSync,
58
+ mkdirSync,
59
+ readFileSync,
60
+ rmSync,
61
+ statSync,
62
+ writeFileSync
63
+ } from "fs";
64
+ import { basename, dirname, join } from "path";
65
+ var CROSS_TOOL = ["name", "description"];
66
+ var tomlValue = (value) => JSON.stringify(value);
67
+ function findEntry(entries, wanted) {
68
+ const exact = entries.filter((e) => e.name === wanted);
69
+ if (exact.length === 1 && exact[0]) return exact[0];
70
+ const bySlug = entries.filter(
71
+ (e) => e.slug === wanted || e.slug.endsWith(`/${wanted}`)
72
+ );
73
+ if (bySlug.length === 1 && bySlug[0]) return bySlug[0];
74
+ if (bySlug.length > 1) {
75
+ throw new ProjectError(
76
+ `${wanted} is ambiguous: ${bySlug.map((e) => e.name).join(", ")}`
77
+ );
78
+ }
79
+ throw new ProjectError(`no catalog skill or agent named ${wanted}`);
80
+ }
81
+ function addEntry(root, entry) {
82
+ const kind = kindOf(entry);
83
+ if (kind !== "skill" && kind !== "agent") {
84
+ throw new ProjectError(
85
+ `${entry.name} is a ${kind}; only skills and agents are added to .agents/`
86
+ );
87
+ }
88
+ const { meta, body } = splitFrontmatter(readFileSync(entry.path, "utf8"));
89
+ const name = basename(entry.slug);
90
+ if (!/^[a-z0-9][a-z0-9-]*$/u.test(name)) {
91
+ throw new ProjectError(
92
+ `${entry.name}: ${name} is not a usable directory name`
93
+ );
94
+ }
95
+ if (kind === "skill") {
96
+ const dest2 = join(root, ".agents/skills", name);
97
+ if (existsSync(dest2))
98
+ throw new ProjectError(`.agents/skills/${name} already exists`);
99
+ const source = entry.root ?? dirname(entry.path);
100
+ mkdirSync(dirname(dest2), { recursive: true });
101
+ if (statSync(source).isDirectory()) {
102
+ cpSync(source, dest2, { recursive: true });
103
+ } else {
104
+ mkdirSync(dest2);
105
+ }
106
+ const head = renderFrontmatter({
107
+ ...meta,
108
+ name,
109
+ description: meta["description"] ?? entry.description
110
+ });
111
+ writeFileSync(
112
+ join(dest2, "SKILL.md"),
113
+ `${head}
114
+ ${body.replace(/^\n/u, "")}`
115
+ );
116
+ return { kind, name, path: `.agents/skills/${name}` };
117
+ }
118
+ const dest = join(root, ".agents/agents", name);
119
+ if (existsSync(dest))
120
+ throw new ProjectError(`.agents/agents/${name} already exists`);
121
+ const kept = {};
122
+ const moved = {};
123
+ for (const [key, value] of Object.entries({ ...meta, name })) {
124
+ if (CROSS_TOOL.includes(key)) {
125
+ kept[key] = value;
126
+ continue;
127
+ }
128
+ moved[key] = value;
129
+ }
130
+ mkdirSync(dest, { recursive: true });
131
+ writeFileSync(
132
+ join(dest, "agent.md"),
133
+ `${renderFrontmatter(kept)}
134
+ ${body.replace(/^\n/u, "")}`
135
+ );
136
+ if (Object.keys(moved).length > 0) {
137
+ const config = join(root, "pmcp.toml");
138
+ const lines = [
139
+ `[agents.${name}.claude]`,
140
+ ...Object.entries(moved).map(([k, v]) => `${k} = ${tomlValue(v)}`)
141
+ ];
142
+ const before = existsSync(config) ? readFileSync(config, "utf8") : "";
143
+ const sep = before === "" || before.endsWith("\n\n") ? "" : "\n";
144
+ writeFileSync(config, `${before}${sep}${lines.join("\n")}
145
+ `);
146
+ }
147
+ return { kind, name, path: `.agents/agents/${name}/agent.md` };
148
+ }
149
+ function withoutTables(toml, name) {
150
+ const own = new RegExp(
151
+ `^\\[(skills\\.${name}|agents\\.${name}(\\.[a-z]+)?)\\]\\s*$`,
152
+ "u"
153
+ );
154
+ const out = [];
155
+ let skipping = false;
156
+ for (const line of toml.split("\n")) {
157
+ if (/^\[/u.test(line)) skipping = own.test(line);
158
+ if (!skipping) out.push(line);
159
+ }
160
+ return out.join("\n").replace(/\n{3,}/gu, "\n\n");
161
+ }
162
+ function removeAsset(root, name) {
163
+ const removed = [];
164
+ for (const rel of [`.agents/skills/${name}`, `.agents/agents/${name}`]) {
165
+ if (!existsSync(join(root, rel))) continue;
166
+ rmSync(join(root, rel), { recursive: true, force: true });
167
+ removed.push(rel);
168
+ }
169
+ if (removed.length === 0)
170
+ throw new ProjectError(`no skill or agent named ${name} in .agents/`);
171
+ const config = join(root, "pmcp.toml");
172
+ if (existsSync(config)) {
173
+ const before = readFileSync(config, "utf8");
174
+ const after = withoutTables(before, name);
175
+ if (after !== before) writeFileSync(config, after);
176
+ }
177
+ return removed;
178
+ }
179
+
180
+ // src/commands/project/apply.ts
181
+ function reproject(context, spec) {
182
+ const result = project(spec, { check: false });
183
+ for (const problem of result.problems) context.ui.error(problem);
184
+ if (result.code !== 0) {
185
+ return 1;
186
+ }
187
+ recordProjector(spec);
188
+ if (result.backup) {
189
+ context.ui.info("backup", result.backup);
190
+ }
191
+ context.ui.success(
192
+ `projected ${result.outputs} outputs`,
193
+ result.pruned > 0 ? `pruned ${result.pruned}` : void 0
194
+ );
195
+ for (const deprecation of spec.deprecations ?? [])
196
+ context.ui.warn(deprecation);
197
+ for (const id of spec.hookBundle?.policy?.targets ?? []) {
198
+ if (RUNTIMES[id].trust !== "folder") continue;
199
+ context.ui.info(
200
+ id,
201
+ "hooks run only once you trust this folder in the runtime; pmcp doctor reports it"
202
+ );
203
+ }
204
+ return 0;
205
+ }
206
+ function projectOrCheck(context) {
207
+ const spec = specFrom(context);
208
+ if (!context.args.flags.has("check")) {
209
+ return reproject(context, spec);
210
+ }
211
+ const result = project(spec, { check: true });
212
+ for (const problem of result.problems) context.ui.error(problem);
213
+ for (const warning of result.warnings ?? []) context.ui.warn(warning);
214
+ if (result.code !== 0) {
215
+ context.ui.info(
216
+ "fix",
217
+ "pmcp project (edit .agents/ or pmcp.toml, never the outputs)"
218
+ );
219
+ return 2;
220
+ }
221
+ context.ui.success(`${result.outputs} outputs match`);
222
+ return 0;
223
+ }
224
+ function addAndProject(context, name) {
225
+ const spec = specFrom(context);
226
+ const added = addEntry(spec.root, findEntry(catalogFrom(context), name));
227
+ context.ui.success(`added ${added.kind} ${added.name}`, added.path);
228
+ return reproject(context, specFrom(context));
229
+ }
230
+ function removeAndProject(context, name) {
231
+ const spec = specFrom(context);
232
+ for (const path of removeAsset(spec.root, name)) {
233
+ context.ui.success("removed", path);
234
+ }
235
+ return reproject(context, specFrom(context));
236
+ }
237
+ export {
238
+ addAndProject,
239
+ projectOrCheck,
240
+ removeAndProject
241
+ };
242
+ //# sourceMappingURL=apply-JUTGS5WZ.js.map
@@ -1,4 +1,4 @@
1
- import { a as MailboxConfig, M as MailboxService } from './service-qpCsOXkQ.js';
1
+ import { a as MailboxConfig, M as MailboxService } from './core-C1LPjxK6.js';
2
2
 
3
3
  interface MailboxAttachmentOptions {
4
4
  readonly config: MailboxConfig;
@@ -0,0 +1,73 @@
1
+ import {
2
+ sayStanding
3
+ } from "./chunk-4NDEP7HU.js";
4
+ import {
5
+ matchingSkills,
6
+ readInstalledDependencies
7
+ } from "./chunk-BBTBJCFA.js";
8
+ import {
9
+ invocation
10
+ } from "./chunk-J7UYNJCR.js";
11
+ import {
12
+ projectFrom,
13
+ remoteCatalog
14
+ } from "./chunk-R5MT42JS.js";
15
+ import "./chunk-RMATE45Z.js";
16
+ import "./chunk-73AKO4UL.js";
17
+ import {
18
+ availableSpec
19
+ } from "./chunk-ABTJQ4QV.js";
20
+ import {
21
+ ArgumentError
22
+ } from "./chunk-A4PKLESO.js";
23
+ import "./chunk-KMXRRSKT.js";
24
+ import "./chunk-YSAWTGNA.js";
25
+
26
+ // src/commands/available.ts
27
+ var availableCommand = {
28
+ ...availableSpec,
29
+ async run(context) {
30
+ if (context.args.positional.length)
31
+ throw new ArgumentError("available takes no package arguments");
32
+ const inventory = readInstalledDependencies(projectFrom(context));
33
+ const catalog = await remoteCatalog(context);
34
+ const matches = matchingSkills(catalog, inventory);
35
+ if (context.args.flags.has("json")) {
36
+ context.ui.data(
37
+ `${JSON.stringify({ catalogRevision: catalog.revision, matches, issues: inventory.issues }, null, 2)}
38
+ `
39
+ );
40
+ } else {
41
+ for (const match of matches) {
42
+ const status = match.verified ? "verified" : "compatible, not verified at this exact version";
43
+ context.ui.data(
44
+ `${match.targetName}@${match.targetVersion} ${match.entry.delivery.packageName}@${match.entry.delivery.version} ${status}
45
+ `
46
+ );
47
+ const { verifiedOn, examplesExecuted } = match.entry.evidence;
48
+ context.ui.line(
49
+ ` ${examplesExecuted} examples executed${verifiedOn ? ` on ${verifiedOn}` : ""}`
50
+ );
51
+ const headings = match.entry.preview?.headings ?? [];
52
+ if (headings.length > 0) {
53
+ context.ui.line(` ${headings.join(" \xB7 ")}`);
54
+ }
55
+ sayStanding(context, match.entry.line);
56
+ }
57
+ context.ui.info(`${matches.length} matching skills`, catalog.revision);
58
+ if (matches.length > 0) {
59
+ context.ui.info(
60
+ "preview",
61
+ `${invocation()} preview <package> shows the contents and a complete example`
62
+ );
63
+ }
64
+ for (const issue of inventory.issues)
65
+ context.ui.warn(issue.reason, issue.name);
66
+ }
67
+ return inventory.issues.length ? 1 : 0;
68
+ }
69
+ };
70
+ export {
71
+ availableCommand
72
+ };
73
+ //# sourceMappingURL=available-DBSIVVJ6.js.map
@@ -0,0 +1,18 @@
1
+ import {
2
+ change
3
+ } from "./chunk-LBXO4VPG.js";
4
+ import "./chunk-26WLNWDG.js";
5
+ import "./chunk-LTZH5E3G.js";
6
+ import "./chunk-C4NHQGHL.js";
7
+ import "./chunk-A4PKLESO.js";
8
+ import "./chunk-OEH47H6A.js";
9
+ import "./chunk-IJBSOWHK.js";
10
+ import "./chunk-QPL7E2HW.js";
11
+ import "./chunk-PMJG2CXF.js";
12
+
13
+ // src/sessions/cli/broadcast.ts
14
+ var run = (context) => change(context, "broadcast");
15
+ export {
16
+ run
17
+ };
18
+ //# sourceMappingURL=broadcast-CBMVOV3G.js.map
@@ -0,0 +1,93 @@
1
+ import {
2
+ createFilesStore
3
+ } from "./chunk-LTZH5E3G.js";
4
+ import {
5
+ projectStateDir
6
+ } from "./chunk-OEH47H6A.js";
7
+
8
+ // src/sessions/settings.ts
9
+ var MAILBOX_KEYS = [
10
+ "enabled",
11
+ "ttl_minutes",
12
+ "max_delivered",
13
+ "audit",
14
+ "wake"
15
+ ];
16
+ function flag(value, where, fallback) {
17
+ if (value === void 0) return fallback;
18
+ if (typeof value !== "boolean")
19
+ throw new Error(`${where} must be true or false`);
20
+ return value;
21
+ }
22
+ function readMailbox(raw) {
23
+ if (raw === void 0)
24
+ return { enabled: false, ttlMinutes: 1440, maxDelivered: 5, audit: true };
25
+ const mailbox = table(raw, "[sessions.mailbox]");
26
+ const unknown = Object.keys(mailbox).find(
27
+ (key) => !MAILBOX_KEYS.includes(key)
28
+ );
29
+ if (unknown) throw new Error(`[sessions.mailbox] unknown key ${unknown}`);
30
+ return {
31
+ enabled: flag(mailbox["enabled"], "[sessions.mailbox] enabled", true),
32
+ ttlMinutes: positiveInteger(
33
+ mailbox["ttl_minutes"],
34
+ "[sessions.mailbox] ttl_minutes",
35
+ 1440
36
+ ),
37
+ maxDelivered: positiveInteger(
38
+ mailbox["max_delivered"],
39
+ "[sessions.mailbox] max_delivered",
40
+ 5
41
+ ),
42
+ audit: flag(mailbox["audit"], "[sessions.mailbox] audit", true),
43
+ // Only when on, so mailboxes without wake keep the same compiled policy and hash.
44
+ ...flag(mailbox["wake"], "[sessions.mailbox] wake", false) ? { wake: true } : {}
45
+ };
46
+ }
47
+ function table(value, where) {
48
+ if (value === void 0) return {};
49
+ if (value === null || typeof value !== "object" || Array.isArray(value))
50
+ throw new Error(`${where} must be a table`);
51
+ return value;
52
+ }
53
+ function positiveInteger(value, where, fallback) {
54
+ if (value === void 0) return fallback;
55
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) {
56
+ throw new Error(`${where} must be a positive integer`);
57
+ }
58
+ return value;
59
+ }
60
+ function readStoreSettings(raw) {
61
+ const sessions = table(raw, "[sessions]");
62
+ if ((sessions["store"] ?? "files") !== "files")
63
+ throw new Error('[sessions] store must be "files"');
64
+ const stateDir = sessions["state_dir"];
65
+ if (stateDir !== void 0 && (typeof stateDir !== "string" || stateDir === "")) {
66
+ throw new Error("[sessions] state_dir must be a path");
67
+ }
68
+ const registry = table(sessions["registry"], "[sessions.registry]");
69
+ const broadcast = table(sessions["broadcast"], "[sessions.broadcast]");
70
+ return {
71
+ ...typeof stateDir === "string" ? { stateDir } : {},
72
+ staleMs: positiveInteger(
73
+ registry["stale_minutes"],
74
+ "[sessions.registry] stale_minutes",
75
+ 30
76
+ ) * 6e4,
77
+ keepBroadcasts: positiveInteger(
78
+ broadcast["keep"],
79
+ "[sessions.broadcast] keep",
80
+ 10
81
+ ),
82
+ mailbox: readMailbox(sessions["mailbox"])
83
+ };
84
+ }
85
+ function openStore(root, settings) {
86
+ return createFilesStore(projectStateDir(root, settings.stateDir), settings);
87
+ }
88
+
89
+ export {
90
+ readStoreSettings,
91
+ openStore
92
+ };
93
+ //# sourceMappingURL=chunk-26WLNWDG.js.map