pi-ptc-subagents 7.1.0 → 7.3.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.
- package/README.md +71 -37
- package/dist/index.js +591 -274
- package/docs/routes/create-a-task.md +50 -3
- package/docs/routes/manage-a-task.md +75 -3
- package/docs/routes/reach-the-web.md +5 -2
- package/docs/routes/run-one-program.md +5 -3
- package/docs/routes/use-the-built-in-tools.md +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
# pi-ptc-subagents
|
|
2
2
|
|
|
3
|
-
Programmable tool calling and subagent dispatch for [pi](https://pi.dev) — and a
|
|
3
|
+
Programmable tool calling and subagent dispatch for [pi](https://pi.dev) — and a
|
|
4
|
+
[Kimi Code](https://www.kimi.com/code) plugin (`ptc-tools`, MCP) that brings the same
|
|
5
|
+
"write one program, batch-call your tools" to Kimi sessions. The npm package covers pi;
|
|
6
|
+
the Kimi Code plugin ships from this repo's GitHub Releases.
|
|
4
7
|
|
|
5
|
-
pi calls tools one at a time.
|
|
6
|
-
|
|
8
|
+
pi calls tools one at a time. On pi, the model writes a program that calls them in one
|
|
9
|
+
go — and can spawn pi subagents from inside it. On Kimi Code, the plugin gives the model
|
|
10
|
+
one program tool over a fixed file-tool set.
|
|
7
11
|
|
|
8
12
|
```
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
on pi
|
|
14
|
+
full_ptc model ──▶ ptc_run_code ──▶ program ──┬──▶ tools.read · grep · edit · … (session tools)
|
|
15
|
+
└──▶ pi_task_ptc ──▶ pi child ──▶ report
|
|
11
16
|
|
|
12
|
-
codemode_ptc model ──▶ codemode script ───────────┬──▶ tools.read · grep · edit · … (session tools)
|
|
13
|
-
|
|
17
|
+
codemode_ptc model ──▶ codemode script ───────────┬──▶ tools.read · grep · edit · … (session tools)
|
|
18
|
+
└──▶ pi_task_codemode ──▶ pi child ──▶ report
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
on kimi (MCP)
|
|
21
|
+
model ──▶ ptc_run_code ──▶ program ──────▶ tools.read · grep · glob · edit (fs 四件套, workdir-locked)
|
|
17
22
|
|
|
18
|
-
|
|
23
|
+
one call in, one result back — never the calls in between.
|
|
24
|
+
```
|
|
19
25
|
|
|
20
|
-
##
|
|
26
|
+
## On pi
|
|
21
27
|
|
|
22
28
|
- **One program, many tool calls.** `ptc_run_code` and `ptc_workflow` run TypeScript in a
|
|
23
29
|
worker. The program uses the session's tools as `tools.read(...)`, `tools.grep(...)`.
|
|
@@ -30,8 +36,6 @@ Both surfaces are detected from the session. There is no setting.
|
|
|
30
36
|
- **Search, where it belongs.** `web_ds_search` registers only inside dispatched children.
|
|
31
37
|
Off by default.
|
|
32
38
|
|
|
33
|
-
A call looks like this — the same shape on both surfaces:
|
|
34
|
-
|
|
35
39
|
```ts
|
|
36
40
|
// full_ptc, inside ptc_run_code
|
|
37
41
|
const r = await tools.pi_task_ptc({ task: "audit the auth code", wait: true });
|
|
@@ -42,7 +46,42 @@ const r = await tools.pi_task_codemode({ task: "audit the auth code", wait: true
|
|
|
42
46
|
return r.report?.summary ?? r.text;
|
|
43
47
|
```
|
|
44
48
|
|
|
45
|
-
|
|
49
|
+
### Surfaces
|
|
50
|
+
|
|
51
|
+
- **`full_ptc`** — the PTC pair is model-facing. Programs reach tasks with `pi_task_ptc`.
|
|
52
|
+
- **`codemode_ptc`** — pi's codemode orchestrates. Scripts reach tasks with
|
|
53
|
+
`pi_task_codemode`; the PTC pair is not registered at all.
|
|
54
|
+
|
|
55
|
+
Which one you get depends on whether `codemode` is loaded and callable. Nothing to configure.
|
|
56
|
+
|
|
57
|
+
### PTC mode
|
|
58
|
+
|
|
59
|
+
On a `full_ptc` session, PTC mode adds a routing lead to the system prompt: batch your
|
|
60
|
+
tool calls into one program. `/ptc off` drops the lead.
|
|
61
|
+
|
|
62
|
+
It does not hide the built-in tools from the model. pi keeps a tool callable from a
|
|
63
|
+
program only while it is active, so narrowing the loadout would take `tools.read` away
|
|
64
|
+
from the program too — the two cannot both hold on pi 1.4.0.
|
|
65
|
+
|
|
66
|
+
## The Kimi Code plugin (`ptc-tools`)
|
|
67
|
+
|
|
68
|
+
Two MCP tools; the host's own tools remain the orchestrator (no subagent door here —
|
|
69
|
+
Kimi Code ships its own Agent tool, so this plugin doesn't duplicate one):
|
|
70
|
+
|
|
71
|
+
- **`ptc_run_code({ code, description, workdir, timeoutMs? })`** — a TypeScript program in
|
|
72
|
+
the same vm cell as on pi, over a fixed tool set: `read` / `grep` / `glob` / `edit`.
|
|
73
|
+
Every path is realpath-checked and confined to `workdir`; `edit` lands atomically and
|
|
74
|
+
requires a unique `old_string`. No `bash`, no task dispatch inside the program.
|
|
75
|
+
- **`web_ds_search`** — search / open / find, callable directly (no child process needed).
|
|
76
|
+
Quota is per MCP server process (default 30 calls, `0` = unlimited); the DeepSeek key
|
|
77
|
+
resolves from env, then Kimi Code's `config.toml`.
|
|
78
|
+
|
|
79
|
+
Install with `/plugins install https://github.com/a1121611810/pi-ptc-subagents` — the bare repo
|
|
80
|
+
URL tracks the latest GitHub Release (pinned URLs get no update checks); run `/reload` to
|
|
81
|
+
activate. A bundled `ptc` skill teaches the model when to write a program instead of
|
|
82
|
+
fanning out tool calls one by one.
|
|
83
|
+
|
|
84
|
+
## Install (pi)
|
|
46
85
|
|
|
47
86
|
```bash
|
|
48
87
|
pi install npm:pi-ptc-subagents
|
|
@@ -60,24 +99,9 @@ To run one build without touching your settings:
|
|
|
60
99
|
pi -ne -e packages/entry/dist/index.js
|
|
61
100
|
```
|
|
62
101
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
- **`full_ptc`** — the PTC pair is model-facing. Programs reach tasks with `pi_task_ptc`.
|
|
66
|
-
- **`codemode_ptc`** — pi's codemode orchestrates. Scripts reach tasks with
|
|
67
|
-
`pi_task_codemode`; the PTC pair is not registered at all.
|
|
68
|
-
|
|
69
|
-
Which one you get depends on whether `codemode` is loaded and callable. Nothing to configure.
|
|
70
|
-
|
|
71
|
-
## PTC mode
|
|
102
|
+
Requires Node ≥ 22.19.
|
|
72
103
|
|
|
73
|
-
|
|
74
|
-
tool calls into one program. `/ptc mode off` drops the lead.
|
|
75
|
-
|
|
76
|
-
It does not hide the built-in tools from the model. pi keeps a tool callable from a
|
|
77
|
-
program only while it is active, so narrowing the loadout would take `tools.read` away
|
|
78
|
-
from the program too — the two cannot both hold on pi 1.4.0.
|
|
79
|
-
|
|
80
|
-
## Configuration
|
|
104
|
+
## Configuration (pi)
|
|
81
105
|
|
|
82
106
|
`~/.pi/agent/ptc.json` — all optional:
|
|
83
107
|
|
|
@@ -92,19 +116,29 @@ from the program too — the two cannot both hold on pi 1.4.0.
|
|
|
92
116
|
|
|
93
117
|
## Trust posture
|
|
94
118
|
|
|
95
|
-
Programs run
|
|
96
|
-
`
|
|
119
|
+
Programs run in a vm cell on both editions (ADR-0019, v7.0.0): the only door out is
|
|
120
|
+
`tools.*`, which goes through the same tool pipeline as a direct call. Programs do not
|
|
121
|
+
see `process`, `fetch`, or dynamic `import` — code that used them broke in v7.0.0.
|
|
122
|
+
|
|
123
|
+
That is an alignment of power paths, not a security boundary. There is still no OS
|
|
124
|
+
sandbox: whatever the bound tools can do, a program can do, and a dispatched child is a
|
|
125
|
+
full pi process running as you. `bash` is not in the program binding table on either edition.
|
|
97
126
|
|
|
98
127
|
## Compatibility
|
|
99
128
|
|
|
100
|
-
pi `>= 0.86.0
|
|
101
|
-
|
|
102
|
-
|
|
129
|
+
pi `>= 0.86.0`, tracked against latest (currently 1.4.0). Two version facts matter:
|
|
130
|
+
|
|
131
|
+
- **In-program `tools.*` needs pi ≥ 0.99.** On 0.86/0.87 a program still evaluates and can
|
|
132
|
+
still dispatch a task, but session-tool calls fail with a clear version error. The
|
|
133
|
+
codemode surface itself also only exists from 0.99.
|
|
134
|
+
- Everything else in the 0.86–1.4 range is covered by real-machine smoke tests, including
|
|
135
|
+
a program that dispatches a real child process. Per-version details:
|
|
136
|
+
[docs/pi-version-matrix.md](./docs/pi-version-matrix.md).
|
|
103
137
|
|
|
104
138
|
## Documentation
|
|
105
139
|
|
|
106
140
|
- [AGENTS.md](./AGENTS.md) — how this repository is built and guarded
|
|
107
|
-
- [docs/adr/](./docs/adr/) — decisions, 0001–
|
|
141
|
+
- [docs/adr/](./docs/adr/) — decisions, 0001–0020
|
|
108
142
|
- [docs/prototypes/](./docs/prototypes/) — spec and status pages
|
|
109
143
|
- [docs/research/](./docs/research/) — evidence notes
|
|
110
144
|
|