pi-session-mcp 0.7.0 → 0.8.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 (66) hide show
  1. package/.pi-session-mcp-cli/config.js +47 -7
  2. package/.pi-session-mcp-cli/doctor.js +68 -2
  3. package/.pi-session-mcp-cli/execution-profile.js +1 -0
  4. package/.pi-session-mcp-cli/extension-spec.js +7 -2
  5. package/.pi-session-mcp-cli/setup-result.js +8 -0
  6. package/.pi-session-mcp-cli/skill-catalog.js +35 -0
  7. package/.pi-session-mcp-cli/skill-customize.js +183 -0
  8. package/.pi-session-mcp-cli/skill-library.js +120 -0
  9. package/CHANGELOG.md +110 -0
  10. package/README.md +15 -3
  11. package/dist/capabilities.d.ts +1 -0
  12. package/dist/capabilities.js +2 -1
  13. package/dist/client-adapters/mcp-verifier.js +6 -2
  14. package/dist/config.d.ts +4 -0
  15. package/dist/config.js +47 -7
  16. package/dist/doctor.d.ts +4 -1
  17. package/dist/doctor.js +68 -2
  18. package/dist/execution-profile.d.ts +4 -0
  19. package/dist/execution-profile.js +1 -0
  20. package/dist/extension-spec.js +7 -2
  21. package/dist/pi-adapter.d.ts +1 -1
  22. package/dist/pi-adapter.js +1 -0
  23. package/dist/pi-skills.d.ts +17 -0
  24. package/dist/pi-skills.js +64 -0
  25. package/dist/sdk-pi-adapter.d.ts +7 -3
  26. package/dist/sdk-pi-adapter.js +57 -11
  27. package/dist/server.js +1 -0
  28. package/dist/session-tools.d.ts +1 -1
  29. package/dist/session-tools.js +20 -4
  30. package/dist/setup-cli.d.ts +2 -0
  31. package/dist/setup-cli.js +16 -0
  32. package/dist/setup-main.d.ts +1 -1
  33. package/dist/setup-main.js +18 -3
  34. package/dist/setup-ownership.d.ts +6 -0
  35. package/dist/setup-ownership.js +29 -5
  36. package/dist/setup-skills.d.ts +37 -0
  37. package/dist/setup-skills.js +353 -0
  38. package/dist/setup.d.ts +7 -0
  39. package/dist/setup.js +49 -6
  40. package/dist/skill-catalog.d.ts +26 -0
  41. package/dist/skill-catalog.js +35 -0
  42. package/dist/skill-customize.d.ts +23 -0
  43. package/dist/skill-customize.js +183 -0
  44. package/dist/skill-library.d.ts +61 -0
  45. package/dist/skill-library.js +120 -0
  46. package/docs/acceptance.md +372 -3
  47. package/docs/adr/0006-pi-extension-allowlist.md +5 -2
  48. package/docs/adr/0007-profile-skill-selection.md +217 -0
  49. package/docs/architecture.md +9 -5
  50. package/docs/client-setup-design.md +133 -1
  51. package/docs/client-setup.md +74 -3
  52. package/docs/doctor-design.md +9 -1
  53. package/docs/installation.md +129 -9
  54. package/docs/pi-extensions-design.md +41 -12
  55. package/docs/releasing.md +15 -6
  56. package/docs/session-mcp.md +7 -2
  57. package/docs/skills.md +487 -0
  58. package/docs/threat-model.md +21 -4
  59. package/docs/tool-contracts.md +9 -5
  60. package/package.json +3 -1
  61. package/pi-session-mcp.example.json +9 -3
  62. package/skills/pi-session-implementation/SKILL.md +42 -0
  63. package/skills/pi-session-orchestration/SKILL.md +93 -0
  64. package/skills/pi-session-review/SKILL.md +58 -0
  65. package/docs/superpowers/plans/2026-10-10-macos-setup.md +0 -1725
  66. package/docs/superpowers/plans/2026-10-11-pi-extensions.md +0 -2450
@@ -3,6 +3,14 @@
3
3
  Status: approved by the owner on 2026-10-11 for implementation. Tracking issue:
4
4
  [#34](https://github.com/plagor44-ux/pi-session-mcp/issues/34).
5
5
 
6
+ > **Amended by [ADR 0007](adr/0007-profile-skill-selection.md).** This design
7
+ > assumed that `noSkills` and the other `no*` options keep skills, prompt
8
+ > templates and themes out of every session. With Pi SDK 1.1.0 that did not hold
9
+ > for resources that an allowlisted extension package ships. An extension
10
+ > allowlist now makes none of them available; a skill reaches a session only
11
+ > through the operator's `skillCatalog` and the profile's `skills`. See
12
+ > [Pi skills](skills.md).
13
+
6
14
  ## Goal
7
15
 
8
16
  An operator can allowlist Pi extensions per execution profile. A profile that
@@ -53,8 +61,10 @@ Success means:
53
61
  `DefaultResourceLoader` with `noExtensions: true`, no skills, templates or
54
62
  themes, and a disabled system prompt. `SdkPiSessionAdapter.create` resolves
55
63
  provider, model, authentication and availability against one `ModelRuntime`
56
- shared by all sessions, and only then builds the resource loader and calls
57
- `createAgentSession`.
64
+ shared by the sessions of profiles without extensions (a profile with
65
+ `extensions` gets a runtime of its own, see *Session creation*), and only then
66
+ builds the resource loader and calls `createAgentSession`. This describes the
67
+ state before this feature; ADR 0007 later added the skill selection.
58
68
 
59
69
  Facts about Pi SDK 1.1.0 that shape this design, verified against the
60
70
  installed package:
@@ -85,8 +95,11 @@ installed package:
85
95
  mismatched npm packages, and `getInstalledPath(source, "user")` falls back
86
96
  to a synchronous `npm root -g` on a miss and accepts legacy global
87
97
  installs; neither is side-effect free.
88
- 9. `pi-cursor-sdk` and `@cursor/sdk` call `console.log`. In a stdio MCP server
89
- such output corrupts the protocol stream.
98
+ 9. Skills, prompt templates and themes that an allowlisted extension package
99
+ ships reached the session although `noSkills` was set (ADR 0007).
100
+ `loadSkills` removes duplicate skill names before `skillsOverride` runs.
101
+ 10. `pi-cursor-sdk` and `@cursor/sdk` call `console.log`. In a stdio MCP server
102
+ such output corrupts the protocol stream.
90
103
 
91
104
  The relevant SDK functions are root exports of
92
105
  `@earendil-works/pi-coding-agent`: `createAgentSessionServices`,
@@ -115,8 +128,12 @@ Rules, enforced by `configSchema`:
115
128
 
116
129
  - Each entry matches `npm:<name>@<version>`. `<name>` is an npm package name,
117
130
  optionally scoped (`@scope/name`), lowercase. `<version>` is an exact semver
118
- version with optional prerelease and build metadata. Ranges, tags, `git:`,
119
- paths and URLs are rejected.
131
+ version with an optional prerelease. Build metadata (`+build`) is rejected
132
+ because npm does not keep it in a published version, so such a pin could
133
+ never match the installed manifest; the configuration fails with
134
+ `config_invalid` instead of every session failing with
135
+ `extension_version_mismatch`. Ranges, tags, `git:`, paths and URLs are
136
+ rejected.
120
137
  - At most 8 entries per profile. A package name appears at most once per
121
138
  profile.
122
139
  - The field is allowed on `read-only` and `coding` profiles, including the
@@ -210,9 +227,17 @@ and step 6 leaves no session to dispose.
210
227
  granted MCP tool or a tool of another extension fails with
211
228
  `extension_tool_conflict`. This also stops an extension from replacing a
212
229
  built-in tool inside a `read-only` profile.
213
- A name must also match `[A-Za-z0-9_.:][A-Za-z0-9_.:-]*`: the SDK reads `*`
214
- in an allowlist as a glob and a leading `+` or `-` as a modifier, so any
215
- other name fails the same way, in both profiles.
230
+ A name must also match `[A-Za-z0-9_][A-Za-z0-9_-]{0,63}`: the SDK reads `*`
231
+ in an allowlist as a glob and a leading `+` or `-` as a modifier, and 64
232
+ characters of letters, digits, `_` and `-` fit the common provider
233
+ function-name limit, so any other name fails the same way, in both
234
+ profiles. Names that Pi SDK 1.1.0 treats as MCP tools fail too: any name
235
+ starting with `mcp__`, and exactly `list_mcp_resources`,
236
+ `list_mcp_resource_templates` and `read_mcp_resource`. When the allowlist
237
+ names no `mcp__` entry, the SDK keeps such tools outside the allowlist for
238
+ codemode and tool_search, so they could otherwise be active without a grant.
239
+ This server's own MCP bridge tools use a single underscore (`mcp_<server>_<tool>`)
240
+ and never collide.
216
241
  The check runs after load and again after binding, because a `session_start`
217
242
  handler can register a tool during `bindExtensions`. If the registered tool
218
243
  set then differs from the one the session was created with, the start fails
@@ -230,7 +255,11 @@ and step 6 leaves no session to dispose.
230
255
  `before_provider_request`, `before_provider_headers` and `context`.
231
256
  - **Prompts.** Every `session.prompt()` call, for every profile, passes
232
257
  `expandPromptTemplates: false`. Client prompt text never dispatches an
233
- extension command, a skill command or a prompt template.
258
+ extension command, a skill command or a prompt template. The call also
259
+ passes `source: "rpc"`, which is what Pi's own RPC mode uses for input from
260
+ a program over stdio and so matches an MCP client. The SDK default,
261
+ `interactive`, means a human at the terminal or the CLI's print mode, which
262
+ a client prompt is not. Extension `input` hooks therefore see `rpc`.
234
263
  - **UI and flags.** No UI context is bound; extension UI calls return the
235
264
  SDK's no-op results. `extensionFlagValues` is empty, so extension flags keep
236
265
  their defaults.
@@ -311,7 +340,7 @@ admitted:
311
340
  | `extension_not_installed` | Configured Pi extension is not installed | Pi has no user install of the package. |
312
341
  | `extension_version_mismatch` | Configured Pi extension version is not installed | The installed version differs from the pinned version. |
313
342
  | `extension_load_failed` | Configured Pi extension could not be loaded | Invalid manifest, entry outside the package, load or bind error, services diagnostic of type `error`. |
314
- | `extension_tool_conflict` | Configured Pi extension tools conflict | An extension tool name collides with a built-in, MCP or other extension tool. |
343
+ | `extension_tool_conflict` | Configured Pi extension tools conflict | An extension tool name collides with a built-in, MCP or other extension tool, or is unsafe (see *Name conflicts*). |
315
344
 
316
345
  Existing codes keep their meaning. An extension provider that is unknown after
317
346
  loading is `unknown_provider`.
@@ -358,7 +387,7 @@ Automated tests use no credentials and no network.
358
387
  - `session_shutdown` on close, on a failure after services, and on a late
359
388
  start after the deadline;
360
389
  - tool lists for read-only and coding, and `extension_tool_conflict`;
361
- - `expandPromptTemplates: false` on every prompt;
390
+ - `expandPromptTemplates: false` and `source: "rpc"` on every prompt;
362
391
  - profiles without extensions taking the unchanged path.
363
392
  - **stdout guard** (`test/stdout-guard.test.ts`): foreign `write` and
364
393
  `console.*` output does not reach stdout, transport writes do, and the
package/docs/releasing.md CHANGED
@@ -20,7 +20,8 @@ error codes, as defined in the [tool contracts](tool-contracts.md).
20
20
 
21
21
  A release is distributed twice: as the GitHub release with its source archive,
22
22
  and as the npm package `pi-session-mcp`. The npm package contains the built
23
- files, the executables, the documentation and the example configuration, but
23
+ files, the executables, the operator documentation and the example
24
+ configuration. It contains no implementation plans (`docs/superpowers/`), and
24
25
  no lockfile, because npm does not ship lockfiles inside packages.
25
26
 
26
27
  ## Update the Pi SDK
@@ -47,7 +48,10 @@ update is possible. It is not an update and not an acceptance.
47
48
  ships in the package as
48
49
  `node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md`. Look for changes
49
50
  to stop reasons, prompt acceptance, the tools declared to the model,
50
- provider keys, MCP naming and packaging.
51
+ provider keys, MCP naming and packaging. For MCP naming, compare the SDK's
52
+ `isMcpToolName` (`dist/core/mcp-servers.js`) with the reserved names in
53
+ `src/session-tools.ts`. That function is not a root export, so no test
54
+ notices when the SDK reserves another name.
51
55
 
52
56
  3. Move the pin:
53
57
 
@@ -100,7 +104,8 @@ release, record the contract again:
100
104
  5. Update the versions named in [Installation](installation.md).
101
105
  6. Run the working-tree
102
106
  [Level 2 lifecycle](acceptance.md#level-2-setup-acceptance) with the real
103
- client for every scope.
107
+ client for every scope (`scripts/setup-acceptance.mjs`, see
108
+ [Tooling](acceptance.md#tooling)).
104
109
 
105
110
  ## Patch audit advisories
106
111
 
@@ -151,7 +156,10 @@ Steps:
151
156
  `## Unreleased`, so that the unreleased entries become the release entries.
152
157
  4. Run the Level 1 checks. `npm run --silent doctor -- --json` must report the
153
158
  new `packageVersion`.
154
- 5. Open one pull request named `chore: prepare v<x.y.z> release`.
159
+ 5. Run the working-tree
160
+ [Level 2 acceptance](acceptance.md#tooling) on the release candidate with
161
+ `scripts/setup-acceptance.mjs`, unless the release notes state its absence.
162
+ 6. Open one pull request named `chore: prepare v<x.y.z> release`.
155
163
 
156
164
  ## Publish a release
157
165
 
@@ -171,7 +179,7 @@ package contains exactly the tagged sources:
171
179
  git clone --branch v<x.y.z> --depth 1 https://github.com/plagor44-ux/pi-session-mcp.git /tmp/pi-session-mcp-release
172
180
  cd /tmp/pi-session-mcp-release
173
181
  npm ci
174
- npm publish --dry-run # review the file list: dist/, .pi-session-mcp-cli/, scripts/doctor.mjs, docs/
182
+ npm publish --dry-run # review the file list: dist/, .pi-session-mcp-cli/, scripts/doctor.mjs, docs/ without docs/superpowers/
175
183
  npm stage publish # the prepack script builds the server, setup and Doctor
176
184
  ```
177
185
 
@@ -210,7 +218,8 @@ After publishing:
210
218
  1. Run the published-release
211
219
  [Level 2 acceptance](acceptance.md#working-tree-and-published-release-variants)
212
220
  from a fresh clone of the tag and from the published npm package, and
213
- record it.
221
+ record it. `scripts/setup-acceptance.mjs` runs both
222
+ ([Tooling](acceptance.md#tooling)).
214
223
  2. Upgrade the installation as described in
215
224
  [Installation](installation.md#upgrade).
216
225
  3. Update the status section in [Acceptance](acceptance.md).
@@ -7,8 +7,13 @@ the Pi session, supplies their definitions as `customTools`, and includes the
7
7
  names in Pi's explicit active `tools` list. The selected tools are verified again
8
8
  before the session is returned.
9
9
 
10
- Global/project extensions remain disabled (`noExtensions: true`). Installing
11
- `pi-mcp-adapter` globally is neither required nor sufficient for this integration.
10
+ Global and project extensions are never auto-discovered; only the extensions
11
+ that a profile allowlists load (see [Pi extensions](installation.md#pi-extensions)).
12
+ Installing `pi-mcp-adapter` globally is neither required nor sufficient for this
13
+ integration. Skills are likewise never auto-discovered; a profile gets only the
14
+ skills it selects from the operator's catalog (see [Pi skills](skills.md)).
15
+ Granting an external MCP tool through `mcpServers` and selecting a skill are
16
+ independent: a skill grants no tool.
12
17
  There is no automatic import of global MCP configuration or ambient credentials.
13
18
  Profiles without `mcpServers` keep their existing built-in tool sets and launch
14
19
  no MCP child process. The public `pi_session_start` input remains unchanged: callers