my-pi 0.0.6 → 0.0.8
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.
- package/README.md +79 -3
- package/dist/{api-S06lPaJV.js → api-BA6XuDOE.js} +1027 -54
- package/dist/api-BA6XuDOE.js.map +1 -0
- package/dist/api.js +1 -1
- package/dist/index.js +20 -2
- package/dist/index.js.map +1 -1
- package/package.json +12 -4
- package/src/extensions/config.test.ts +3 -0
- package/src/extensions/config.ts +10 -1
- package/src/extensions/prompt-presets.test.ts +155 -0
- package/src/extensions/prompt-presets.ts +1487 -0
- package/src/mcp/client.test.ts +217 -0
- package/src/mcp/client.ts +219 -45
- package/src/mcp/config.test.ts +141 -93
- package/src/mcp/config.ts +110 -22
- package/dist/api-S06lPaJV.js.map +0 -1
package/README.md
CHANGED
|
@@ -112,8 +112,9 @@ await runPrintMode(runtime, {
|
|
|
112
112
|
## MCP Servers
|
|
113
113
|
|
|
114
114
|
MCP servers are configured via `mcp.json` files and managed as a pi
|
|
115
|
-
extension.
|
|
116
|
-
via
|
|
115
|
+
extension. Stdio servers are spawned on startup, HTTP servers are
|
|
116
|
+
connected remotely, and their tools are registered via
|
|
117
|
+
`pi.registerTool()`.
|
|
117
118
|
|
|
118
119
|
### Global config
|
|
119
120
|
|
|
@@ -148,6 +149,25 @@ via `pi.registerTool()`.
|
|
|
148
149
|
}
|
|
149
150
|
```
|
|
150
151
|
|
|
152
|
+
HTTP MCP servers are supported too:
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
{
|
|
156
|
+
"mcpServers": {
|
|
157
|
+
"pm-platform": {
|
|
158
|
+
"type": "http",
|
|
159
|
+
"url": "https://project.cloudlobsters.com/api/mcp",
|
|
160
|
+
"headers": {
|
|
161
|
+
"Authorization": "Bearer ..."
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Use `"type": "http"` or `"type": "streamable-http"` for remote MCP
|
|
169
|
+
servers. If `url` is present, my-pi treats the entry as HTTP.
|
|
170
|
+
|
|
151
171
|
Project servers merge with global servers. If both define the same
|
|
152
172
|
server name, the project config wins.
|
|
153
173
|
|
|
@@ -170,11 +190,22 @@ In interactive mode:
|
|
|
170
190
|
- `/skills sync <key|name>` — sync an imported skill to its upstream
|
|
171
191
|
- `/skills refresh` — rescan skill directories
|
|
172
192
|
- `/skills defaults <all-enabled|all-disabled>` — set default policy
|
|
193
|
+
- `/preset` — open the prompt preset manager (base presets + layers)
|
|
194
|
+
- `/preset <name>` — activate a base preset or toggle a layer
|
|
195
|
+
- `/preset base <name>` — activate a base preset directly
|
|
196
|
+
- `/preset enable <layer>` / `/preset disable <layer>` — toggle a
|
|
197
|
+
prompt layer directly
|
|
198
|
+
- `/preset edit <name>` — edit or create a project-local preset in
|
|
199
|
+
`.pi/presets.json`
|
|
200
|
+
- `/preset delete <name>` — delete a project-local preset
|
|
201
|
+
- `/preset reset <name>` — remove a project-local override and fall
|
|
202
|
+
back to user/built-in if available
|
|
203
|
+
- `/preset clear` — clear the active base preset and all layers
|
|
173
204
|
|
|
174
205
|
### How it works
|
|
175
206
|
|
|
176
207
|
1. Pi extension loads `mcp.json` configs (global + project)
|
|
177
|
-
2.
|
|
208
|
+
2. Connects to each MCP server using stdio or HTTP transport
|
|
178
209
|
3. Performs the MCP `initialize` handshake
|
|
179
210
|
4. Calls `tools/list` to discover available tools
|
|
180
211
|
5. Registers each tool via `pi.registerTool()` as
|
|
@@ -224,6 +255,49 @@ them. Detection patterns from
|
|
|
224
255
|
Use `/redact-stats` to see how many secrets were caught. Disable with
|
|
225
256
|
`--no-filter`.
|
|
226
257
|
|
|
258
|
+
## Prompt Presets
|
|
259
|
+
|
|
260
|
+
Prompt presets append runtime instructions to the system prompt
|
|
261
|
+
through a built-in extension. They are split into:
|
|
262
|
+
|
|
263
|
+
- **base presets** — one active at a time
|
|
264
|
+
- **prompt layers** — additive checkboxes you can combine
|
|
265
|
+
|
|
266
|
+
Built-in base presets:
|
|
267
|
+
|
|
268
|
+
- `terse` — short, direct, no fluff
|
|
269
|
+
- `standard` — clear and concise with key context
|
|
270
|
+
- `detailed` — more explanation when nuance matters
|
|
271
|
+
|
|
272
|
+
Built-in layers:
|
|
273
|
+
|
|
274
|
+
- `no-purple-prose`
|
|
275
|
+
- `bullets`
|
|
276
|
+
- `clarify-first`
|
|
277
|
+
- `include-risks`
|
|
278
|
+
|
|
279
|
+
Preset sources are merged in this order:
|
|
280
|
+
|
|
281
|
+
1. built-in defaults
|
|
282
|
+
2. `~/.pi/agent/presets.json`
|
|
283
|
+
3. `.pi/presets.json`
|
|
284
|
+
|
|
285
|
+
Project presets override global/default presets with the same name.
|
|
286
|
+
Strings are treated as base presets by default. Object entries may set
|
|
287
|
+
`kind: "base"` or `kind: "layer"`.
|
|
288
|
+
|
|
289
|
+
CLI layering is supported too:
|
|
290
|
+
|
|
291
|
+
- `--preset terse,no-purple-prose,bullets`
|
|
292
|
+
- `--system-prompt "You are terse and technical."`
|
|
293
|
+
- `--append-system-prompt "Prefer one short paragraph."`
|
|
294
|
+
|
|
295
|
+
Interactive `/preset` selections are also restored on later sessions
|
|
296
|
+
for the same project via `~/.pi/agent/prompt-preset-state.json`.
|
|
297
|
+
|
|
298
|
+
This repo also includes an example `.pi/presets.json` with sample base
|
|
299
|
+
presets and layers.
|
|
300
|
+
|
|
227
301
|
## Session Handoff
|
|
228
302
|
|
|
229
303
|
Use `/handoff <task>` to export conversation context as a markdown
|
|
@@ -249,6 +323,7 @@ src/
|
|
|
249
323
|
chain.ts Agent chain pipelines
|
|
250
324
|
filter-output.ts Secret redaction in tool output
|
|
251
325
|
handoff.ts Session context export
|
|
326
|
+
prompt-presets.ts Runtime prompt preset selection and editing
|
|
252
327
|
recall.ts Past session recall guidance
|
|
253
328
|
mcp/
|
|
254
329
|
client.ts Minimal MCP stdio client (JSON-RPC 2.0)
|
|
@@ -261,6 +336,7 @@ src/
|
|
|
261
336
|
agents/
|
|
262
337
|
*.md Agent definitions (frontmatter + system prompt)
|
|
263
338
|
agent-chain.yaml Chain pipeline definitions
|
|
339
|
+
presets.json Optional project prompt presets
|
|
264
340
|
mcp.json Project MCP server config
|
|
265
341
|
```
|
|
266
342
|
|