@operad-io/harness-pi 0.0.1 → 0.1.1
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 +7 -277
- package/package.json +6 -6
- package/src/index.ts +2 -1
- package/src/pi-install.ts +1 -1
- package/src/worker.ts +1 -1
package/README.md
CHANGED
|
@@ -1,283 +1,13 @@
|
|
|
1
1
|
# @operad-io/harness-pi
|
|
2
2
|
|
|
3
|
-
The pi harness
|
|
4
|
-
reads one JSON object from stdin, runs one prompt and writes one JSON object per
|
|
5
|
-
line to stdout. The last line is the `Result`. The hub-side step
|
|
6
|
-
(`src/index.ts`, described under "The plugin" below) spawns it. Decisions: `docs/backlog/operad-harness-pi.md` 2, 3, 5, 6, 7.
|
|
3
|
+
**The pi harness.** Runs a prompt with the pi coding agent library you installed.
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
humans and is never parsed.
|
|
5
|
+
This package is part of [operad](https://github.com/operad-io/operad). Most people install only [`@operad-io/cli`](https://www.npmjs.com/package/@operad-io/cli).
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
are in memory, and every path pi uses comes from the input (`agentDir`,
|
|
13
|
-
`sessionDir`, `authPath`, `modelsPath`). Nothing under the user's `~/.pi` is
|
|
14
|
-
read unless the input names it.
|
|
7
|
+
## Documentation
|
|
15
8
|
|
|
16
|
-
|
|
9
|
+
- User guide: [docs/user/dev.md](https://github.com/operad-io/operad/blob/main/docs/user/dev.md)
|
|
10
|
+
- Website: <https://operad.io>
|
|
11
|
+
- Developer reference: `REFERENCE.md` in this directory
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
(`bun add -g @earendil-works/pi-coding-agent`) or npm
|
|
20
|
-
(`npm i -g @earendil-works/pi-coding-agent`), so that a `pi` command is on
|
|
21
|
-
`PATH`. The worker resolves the real path of that command, walks up to the
|
|
22
|
-
directory whose `package.json` is `@earendil-works/pi-coding-agent`, and imports
|
|
23
|
-
the file its `exports["."]` names. It logs `pi <version> loaded from <dir>` on
|
|
24
|
-
stderr. The oldest version it accepts (the floor) is `1.5.0`; a prerelease of
|
|
25
|
-
`1.5.0` is below it. `operad plugin check` reads the same `package.json` and
|
|
26
|
-
fails, naming both versions, when pi is older than the floor, and fails when
|
|
27
|
-
there is no `pi`. The `@earendil-works/pi-coding-agent` in this package's
|
|
28
|
-
`devDependencies` serves the tests only.
|
|
29
|
-
|
|
30
|
-
`pi` must lead into the package through symbolic links, as the bun and npm
|
|
31
|
-
installs make it. A shell wrapper script is refused with its path; set the
|
|
32
|
-
`command` setting to the package's bin (for example
|
|
33
|
-
`~/.bun/install/global/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli.js`)
|
|
34
|
-
to use another pi or a wrapper's target.
|
|
35
|
-
|
|
36
|
-
## stdin
|
|
37
|
-
|
|
38
|
-
One JSON object, then EOF. `test/protocol.test.ts` checks the program against
|
|
39
|
-
this table.
|
|
40
|
-
|
|
41
|
-
| field | type | required | meaning |
|
|
42
|
-
|---|---|---|---|
|
|
43
|
-
| `prompt` | string, non-empty | yes | the text sent to the model |
|
|
44
|
-
| `cwd` | string, non-empty | yes | working directory of the agent |
|
|
45
|
-
| `authPath` | string, non-empty | yes | pi's credentials file |
|
|
46
|
-
| `modelsPath` | string, non-empty | yes | pi's custom models file |
|
|
47
|
-
| `agentDir` | string, non-empty | yes | pi's agent directory (empty of user config) |
|
|
48
|
-
| `piCommand` | string, non-empty | no | the pi command, a name on PATH or a path; absent means `pi` |
|
|
49
|
-
| `sessionDir` | string, non-empty | yes | directory for session files |
|
|
50
|
-
| `resumeSession` | string, non-empty | no | session file path from an earlier `Result.sessionId`; the prompt is sent into it |
|
|
51
|
-
| `model` | string `provider/id` | no | model to use; absent means pi's own default |
|
|
52
|
-
| `thinkingLevel` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh` or `max` | no | reasoning level; absent means pi's default |
|
|
53
|
-
| `access` | object | no | the access profile; `denyPaths` and `denyCommands` (arrays of strings) are enforced in the `tool_call` hook by `@operad-io/access-match`, other fields are ignored; absent means nothing is denied |
|
|
54
|
-
|
|
55
|
-
An invalid object (not JSON, not an object, a required field missing or of the
|
|
56
|
-
wrong type, an optional field of the wrong type) writes one `Result` line with
|
|
57
|
-
`result: "failed"` and `message` naming the field, and exits 2.
|
|
58
|
-
|
|
59
|
-
## stdout
|
|
60
|
-
|
|
61
|
-
One JSON object per line, flushed per line, each with a `type`. Only these
|
|
62
|
-
types appear, in the order the run produces them:
|
|
63
|
-
|
|
64
|
-
| type | other fields | meaning |
|
|
65
|
-
|---|---|---|
|
|
66
|
-
| `message_end` | `role` (`"assistant"`), `text` (optional: the first 300 characters of the message's text as one paragraph; thinking and tool calls left out), `stopReason` (string), `usage` (`{input, output, cache_read, cache_write}`, numbers), `cost` (`{total}` in USD, or `null` when pi gave no price) | an assistant message finished; only assistant messages are written |
|
|
67
|
-
| `tool_execution_start` | `toolCallId`, `toolName`, `at`, `input` (optional) | a tool call began. `at` is the start time in epoch milliseconds. `input` says what ran: for `Bash` the command (one line, first 500 characters), for `Read`, `Edit` and `Write` the path, for another tool its main argument (path, pattern, query, URL or description) when it has one; absent otherwise. Never file contents or tool output. A command shows the values of leading environment assignments (`NAME=value`) as `NAME=***`, masks any value of the operad secret store or of a secret-named environment variable (`KEY`, `TOKEN`, `SECRET`, `PASS`, `PASSWORD`, `AUTH`, `CREDENTIAL`; 6 characters or more) as `***`, and shows `<command not shown: could not read it safely>` for a command it cannot read (an open quote, or a command or process substitution, heredoc or arithmetic in a leading assignment). A call the access profile denies shows `<tool> denied by the access profile`, never its arguments |
|
|
68
|
-
| `tool_execution_end` | `toolCallId`, `toolName`, `isError`, `durationMs`, `error` (optional) | a tool call ended. `durationMs` is how long the call took, measured from its start line. `error` is the first line of the error (at most 300 characters) when `isError` is true; the rest of the error stays out of this line. A refused call writes no `tool_output` |
|
|
69
|
-
| `tool_output` | `toolCallId`, `text` | what a tool call printed. A `text` is at most 64 KiB of UTF-8; a longer output is written as consecutive lines with the same `toolCallId`, so joining them gives the whole output. Written before the call's `tool_execution_end` |
|
|
70
|
-
| `text_delta` | `text` | new assistant text only, not the text so far; at most one line per 100 ms, the rest grouped |
|
|
71
|
-
| `thinking_delta` | `text` | new thinking only, not the thinking so far; at most one line per 100 ms, the rest grouped |
|
|
72
|
-
| `text_end` | `text` | the full text of a finished assistant message, after its increments |
|
|
73
|
-
| `thinking_end` | `text` | the full text of a finished thinking block, after its increments |
|
|
74
|
-
| `blocked` | `toolName`, `reason` | the access matcher refused a tool call; the call does not run: its `tool_execution_end` has `isError: true` and the model gets `reason` as the tool result. The run continues |
|
|
75
|
-
| `agent_settled` | `aborted` (boolean) | pi has stopped for good (not `agent_end`, after which pi may continue) |
|
|
76
|
-
| `result` | see below | always the last line |
|
|
77
|
-
|
|
78
|
-
Every `text_delta`, `thinking_delta`, `text_end`, `thinking_end` and
|
|
79
|
-
`tool_output` line replaces each value of `secretValues` with `***`, as the
|
|
80
|
-
tool call input does. An increment that would end inside a secret value, or
|
|
81
|
-
inside its JSON-escaped spelling, holds the rest of it back for the next
|
|
82
|
-
increment, so a receiver that joins the increments never sees the value whole;
|
|
83
|
-
when the run stops, what is still held is written before the Result.
|
|
84
|
-
|
|
85
|
-
### Result
|
|
86
|
-
|
|
87
|
-
| field | type | required | meaning |
|
|
88
|
-
|---|---|---|---|
|
|
89
|
-
| `type` | `"result"` | yes | |
|
|
90
|
-
| `result` | `"done"`, `"failed"` or `"cancelled"` | yes | how the run ended |
|
|
91
|
-
| `sessionId` | string or null | yes | the session file path; null when no session was opened |
|
|
92
|
-
| `usage` | `{input?, output?, cache_read?, cache_write?}` | yes | sums over every `message_end` (`cacheRead` becomes `cache_read`, `cacheWrite` becomes `cache_write`) |
|
|
93
|
-
| `cost` | `{micros}` or null | yes | `round(sum of cost.total × 1e6)`; null when any `message_end` had no price, or there was none |
|
|
94
|
-
| `finalMessage` | string or null | yes | `getLastAssistantText()` |
|
|
95
|
-
| `reason` | string | on `failed` | a short condition name: `invalid_input`, `session_missing`, `model_missing`, `model_error` (also used for an unexpected error) |
|
|
96
|
-
| `message` | string | on `failed` | human text; names the field or path at fault |
|
|
97
|
-
|
|
98
|
-
## Exit codes
|
|
99
|
-
|
|
100
|
-
| code | when |
|
|
101
|
-
|---|---|
|
|
102
|
-
| 0 | `done` |
|
|
103
|
-
| 1 | `failed` after the input was valid |
|
|
104
|
-
| 2 | invalid input |
|
|
105
|
-
| 143 | SIGTERM: the program calls `abort()`, waits for idle, writes a `cancelled` Result and exits |
|
|
106
|
-
|
|
107
|
-
## Resume
|
|
108
|
-
|
|
109
|
-
With `resumeSession` the program opens that file with `SessionManager.open`
|
|
110
|
-
and sends the new prompt into it. A file that does not exist is `failed` with
|
|
111
|
-
the path in `message`. `sessionId` of the new Result is the same path.
|
|
112
|
-
|
|
113
|
-
## Tests
|
|
114
|
-
|
|
115
|
-
`test/fake-worker.ts` runs the same program with a fake model registered
|
|
116
|
-
(`test/fake-provider.ts`); the script comes from the `FAKE_SCRIPT` environment
|
|
117
|
-
variable. It exists because a model cannot travel over the stdin protocol.
|
|
118
|
-
|
|
119
|
-
## The plugin
|
|
120
|
-
|
|
121
|
-
`src/index.ts` is the hub side: the plugin `pi`, its step
|
|
122
|
-
`pi/agent` and its flow `pi:prompt`. It never imports pi (it only reads its version in `check`); it
|
|
123
|
-
starts `bun src/worker.ts` through `runAgent` from `@operad-io/harness-process`,
|
|
124
|
-
writes the stdin object above, appends every stdout line to the step's log with
|
|
125
|
-
`JsonlLog`, and turns the last `result` line into the facts.
|
|
126
|
-
|
|
127
|
-
The plugin is not installed by `operad init`. Turn it on with:
|
|
128
|
-
|
|
129
|
-
```sh
|
|
130
|
-
operad plugin enable pi
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
A flow switches harness by changing `use` from `radian/agent` to
|
|
134
|
-
`pi/agent`; `dev` does it with `worker.use` in `.operad/dev.json`. The
|
|
135
|
-
params, the result names (`done`, `failed`, `interrupted`) and the facts
|
|
136
|
-
(`exitCode`, `signal`, `sessionId`, `finalMessage`, `usage`, `log`,
|
|
137
|
-
`durationMs`, `stderr`) are `radian`'s, except `args` (below). `usage`
|
|
138
|
-
is the standard one described in [the manual](../../../docs/user/dev.md#usage-and-end-results):
|
|
139
|
-
`model` is the step's `--model` or the `model` setting, and the worker's
|
|
140
|
-
`cost.micros` becomes `costMicros`.
|
|
141
|
-
`sessionId` is the path of pi's
|
|
142
|
-
session file; pass it back as `resumeSession` to continue it.
|
|
143
|
-
|
|
144
|
-
### Params: `args`
|
|
145
|
-
|
|
146
|
-
pi takes no command-line arguments, so the step reads two flags from `args`, in
|
|
147
|
-
the spelling `radian` passes to radian. This lets `dev` run the worker
|
|
148
|
-
and the reviewer on different models through the same plugin.
|
|
149
|
-
|
|
150
|
-
| flag | value | meaning |
|
|
151
|
-
|---|---|---|
|
|
152
|
-
| `--model` | `provider/id` | the model for this step |
|
|
153
|
-
| `--thinking` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh` or `max` | the reasoning level for this step |
|
|
154
|
-
|
|
155
|
-
A flag in `args` wins over the setting of the same meaning (`model`,
|
|
156
|
-
`thinkingLevel`); a chat passes its effort as the step param `effort`, which is
|
|
157
|
-
its thinking level and also wins over the setting; without either the setting
|
|
158
|
-
applies; without all, pi's own default applies and the field is not sent to the
|
|
159
|
-
worker.
|
|
160
|
-
|
|
161
|
-
Any other entry fails the step at once, before the worker starts, with result
|
|
162
|
-
`failed`, reason `invalid_args` and a message that names the entry: an unknown
|
|
163
|
-
flag, a flag without its value, a model that is not `provider/id`, an unknown
|
|
164
|
-
level, a flag given twice. Ignoring a flag silently would hide a wrong model.
|
|
165
|
-
|
|
166
|
-
### Settings
|
|
167
|
-
|
|
168
|
-
The `pi` section of `config.json`. The kernel fills the defaults. A step
|
|
169
|
-
param (`wallTimeSecs`, `stallSecs`) overrides the setting of the same name.
|
|
170
|
-
|
|
171
|
-
| setting | type | default | meaning |
|
|
172
|
-
|---|---|---|---|
|
|
173
|
-
| `model` | string `provider/id` | unset | the model; unset uses pi's own default model |
|
|
174
|
-
| `models` | list of `provider/id` | unset | the models a chat may pick; unset offers every model `pi --list-models` prints |
|
|
175
|
-
| `thinkingLevel` | `off`, `minimal`, `low`, `medium`, `high`, `xhigh` or `max` | unset | the reasoning level; unset uses pi's default |
|
|
176
|
-
| `command` | string | `pi` | the pi command: a name on PATH or a path; it must lead into an installed `@earendil-works/pi-coding-agent` at the floor version or newer |
|
|
177
|
-
| `authPath` | string | `~/.pi/agent/auth.json` | pi's credentials file; the plugin passes the path and never reads the file |
|
|
178
|
-
| `modelsPath` | string | `~/.pi/agent/models.json` | pi's custom models file |
|
|
179
|
-
| `wallTimeSecs` | number | `3600` | the longest one run may take; at most 28500 |
|
|
180
|
-
| `stallSecs` | number | `600` | how long a run may print nothing while no tool call is open |
|
|
181
|
-
| `bashTimeoutSecs` | integer, 1 or more | `1800` | the longest one bash call may run, in seconds; it is the default and the maximum for a call. A call that reaches it is stopped and the model gets a tool error; the run goes on |
|
|
182
|
-
| `operadTools` | object `{ home }` | absent | operad's own tools: the worker opens the home with `@operad-io/mcp` and registers each tool as a pi custom tool named `operad_<tool>` (`operad_list`, `operad_act`, …), with the server's own JSON Schema. A refusal is a tool error and the run goes on. The access profile does not judge them; the owner's MCP allow lists do |
|
|
183
|
-
| `images` | array of `{ path, mediaType }` | absent | image files (`image/png`, `image/jpeg`, `image/gif`, `image/webp`) given to `session.prompt` as image input beside the prompt text |
|
|
184
|
-
| `concurrency` | object, model to positive integer | `{}` | how many runs of one model may go at once, such as `{ "opencode-go/deepseek-v4.1-flash": 2 }`; a model not listed has no limit |
|
|
185
|
-
|
|
186
|
-
How `concurrency` limits runs, what the key is and how a queued step shows
|
|
187
|
-
are in [the manual](../../../docs/user/dev.md#limiting-runs-of-one-model).
|
|
188
|
-
|
|
189
|
-
A leading `~` in a path is the user's home directory. The step's own timeout is
|
|
190
|
-
eight hours, above every allowed wall time.
|
|
191
|
-
|
|
192
|
-
### Where files go
|
|
193
|
-
|
|
194
|
-
pi runs with an agent directory of its own, `<operad home>/harness/pi`, empty of
|
|
195
|
-
user configuration. Session files are in `<operad home>/harness/pi/sessions`
|
|
196
|
-
(`~/.operad/harness/pi/sessions` by default), so the user's own `pi` command
|
|
197
|
-
does not see them. The step's log, one JSON line per worker line, is in the
|
|
198
|
-
store like every step log.
|
|
199
|
-
|
|
200
|
-
### How the step ends
|
|
201
|
-
|
|
202
|
-
| condition | result | `reason` |
|
|
203
|
-
|---|---|---|
|
|
204
|
-
| worker `result` is `done` | `done` | |
|
|
205
|
-
| worker `result` is `failed` | `failed` | the worker's own reason |
|
|
206
|
-
| worker `result` is `cancelled`, or the run was cancelled | `interrupted` | `cancelled` |
|
|
207
|
-
| no `result` line, the worker was killed by a signal | `interrupted` | `signal` |
|
|
208
|
-
| no `result` line, the worker exited | `failed` | `no_result`; `message` ends with the worker's last five stderr lines |
|
|
209
|
-
| wall time, stall, a line over 8 MiB, no program, no directory | `failed` | `wall`, `stall`, `line_too_long`, `missing` or `spawn`, `cwd` |
|
|
210
|
-
|
|
211
|
-
A stall is silence while no tool call is open: pi's `tool_execution_start` opens
|
|
212
|
-
one and `tool_execution_end` closes it. The wall time always applies.
|
|
213
|
-
|
|
214
|
-
An open tool call is therefore not a stall by design; `bashTimeoutSecs` is what bounds one bash call. The worker enforces it by setting the `timeout` of every bash tool call in its `tool_call` handler (pi's bash tool takes a `timeout` in seconds and has no default). The worker also drops `BASH_ENV` and `ENV` from its environment; pi runs `bash -c`, so the user's aliases and functions do not apply.
|
|
215
|
-
|
|
216
|
-
### Model errors
|
|
217
|
-
|
|
218
|
-
A worker failure with reason `model_error` also sets `data.modelError`, the
|
|
219
|
-
shape `radian` gives: `{ kind, status, retry_after_secs, message }`.
|
|
220
|
-
`kind` is derived from the error text the worker passes on: a usage limit
|
|
221
|
-
(`usage limit`, `quota`, `out of credits`) is `usage_limit`; otherwise a 429, 503
|
|
222
|
-
or 529, `overloaded`, `rate limit` or `too many requests` is `unavailable`; any
|
|
223
|
-
other text is `protocol`. `status` is that number when the text has one, else
|
|
224
|
-
`null`; `retry_after_secs` is `null` because pi does not report it. `dev`'s
|
|
225
|
-
review and work waits read `kind` and so treat both harnesses alike.
|
|
226
|
-
|
|
227
|
-
### Asking and resuming
|
|
228
|
-
|
|
229
|
-
The step is `resumable: true`. When the flow returns to it after a question was
|
|
230
|
-
answered, its params carry `resumeSession` and `askAnswer`; the step passes
|
|
231
|
-
`resumeSession` to the worker and adds `You asked: <prompt>. The answer is:
|
|
232
|
-
<answer>. Continue.` to the prompt.
|
|
233
|
-
|
|
234
|
-
A one-time permission arrives in the profile as `grants: [{ waitId, kind,
|
|
235
|
-
value }]`. When it is present the step keeps the worker's stdin open after the
|
|
236
|
-
input line. A `tool_call` the profile refuses and that equals a grant exactly
|
|
237
|
-
(`bash` command text, or a path tool's path) makes the worker write
|
|
238
|
-
`{"type":"grant_use","id":n,"waitId":"..."}` to stdout and wait for one stdin line
|
|
239
|
-
`{"type":"grant_ack","id":n,"used":true|false}`. The host records `grant_used`
|
|
240
|
-
before it answers `used: true`; only then does the call run. A second identical
|
|
241
|
-
call finds the grant used and is checked against the profile as usual.
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
### Asking about a call
|
|
245
|
-
|
|
246
|
-
A call the profile's `askCommands` matches (and that no deny rule matched: deny
|
|
247
|
-
wins over ask) asks a person instead of running. The step keeps the worker's
|
|
248
|
-
stdin open. The worker writes `{"type":"ask_call","id":n,"kind":"command","value":"<the whole command>","shown":"...","session":"<session>"|null}`
|
|
249
|
-
and holds the call; the host asks with `ctx.ask` (choices `allow_once`,
|
|
250
|
-
`allow_always` and `reject_once`, the grace period of the kernel: 10 minutes by
|
|
251
|
-
default, set by `ask.graceSecs`, `askGraceSecs` of the step or the question) and
|
|
252
|
-
answers on
|
|
253
|
-
stdin `{"type":"ask_ack","id":n,"decision":"allow"|"deny"|"stop","reason"?}`,
|
|
254
|
-
after which the worker writes `{"type":"ask_resolved","id":n}`. Questions go
|
|
255
|
-
one at a time. A command that holds a value of the operad secret store is
|
|
256
|
-
refused and never asked about, so no fact holds a secret.
|
|
257
|
-
|
|
258
|
-
- Answered within the grace period (`allow`): the same step goes on and this one
|
|
259
|
-
call runs. `allow_once` keeps nothing for another call; `allow_always` also
|
|
260
|
-
appends the exact command or tool, path and working directory to
|
|
261
|
-
`$OPERAD_HOME/access-user.json`, so later runs read it from the profile's
|
|
262
|
-
`alwaysAllow` entries. `reject_once` is `deny`.
|
|
263
|
-
- Not answered in time (`stop`): the worker holds the call, the host ends the
|
|
264
|
-
program, and the step ends `waiting` (the result is declared). The one pending
|
|
265
|
-
item stays, with the run's object. The flow's `waiting` route goes to a wait
|
|
266
|
-
for a person and back to the step.
|
|
267
|
-
- Answered later: the step runs again with `resumeSession`, `askAnswer` and
|
|
268
|
-
`grants: [{ waitId, kind, value }]` for `allow_once` or `allow_always`. The
|
|
269
|
-
worker uses the grant for the one call it covers (`grant_use`, above); an
|
|
270
|
-
`allow_always` answer also writes its entry to the user layer first. Any other
|
|
271
|
-
call asks again. After `reject_once` no grant arrives and the model is told so
|
|
272
|
-
in the prompt.
|
|
273
|
-
- A run no person's message started (a schedule, a webhook or another event)
|
|
274
|
-
neither reads the user layer nor offers `allow_always` (`operad-sandbox.md`
|
|
275
|
-
decision 8).
|
|
276
|
-
|
|
277
|
-
The host's half (`createCallAsker`, `askCall`, `askRequest`) is in
|
|
278
|
-
`@operad-io/harness-process`. `askCommands` is in the step's `enforces`.
|
|
279
|
-
|
|
280
|
-
### Access profile
|
|
281
|
-
|
|
282
|
-
The step declares `enforces: ["denyPaths", "denyCommands", "askCommands"]` and
|
|
283
|
-
passes the run's profile to the worker, whose `tool_call` handler applies it.
|
|
13
|
+
MIT licensed.
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operad-io/harness-pi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./src/index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@operad-io/access-match": "0.
|
|
10
|
-
"@operad-io/engine": "0.
|
|
11
|
-
"@operad-io/harness-process": "0.
|
|
12
|
-
"@operad-io/mcp": "0.
|
|
9
|
+
"@operad-io/access-match": "0.1.1",
|
|
10
|
+
"@operad-io/engine": "0.1.1",
|
|
11
|
+
"@operad-io/harness-process": "0.1.1",
|
|
12
|
+
"@operad-io/mcp": "0.1.1"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@earendil-works/pi-coding-agent": "1.5.0"
|
|
16
16
|
},
|
|
17
|
-
"description": "operad: the pi harness, a client of the pi coding agent library
|
|
17
|
+
"description": "operad: the pi harness, a client of the pi coding agent library",
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
20
|
"url": "git+https://github.com/operad-io/operad.git",
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* program, never by the hub.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import pkg from "../package.json" with { type: "json" };
|
|
10
11
|
import { secretValuesOf } from "@operad-io/access-match";
|
|
11
12
|
import { existsSync, readFileSync } from "node:fs";
|
|
12
13
|
import { mkdir } from "node:fs/promises";
|
|
@@ -348,7 +349,7 @@ export function createPiHarnessPlugin(options: PiHarnessOptions = {}) {
|
|
|
348
349
|
return definePlugin({
|
|
349
350
|
name: "pi",
|
|
350
351
|
kind: "harness",
|
|
351
|
-
version:
|
|
352
|
+
version: pkg.version,
|
|
352
353
|
models: piModels,
|
|
353
354
|
efforts: PI_EFFORTS,
|
|
354
355
|
settings: PLUGIN_SETTINGS,
|
package/src/pi-install.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Finds the user's installed pi (
|
|
2
|
+
* Finds the user's installed pi (ADR 0023 D9).
|
|
3
3
|
* The `pi` command on PATH (or the `command` setting) is resolved to its real
|
|
4
4
|
* path; walking up from there reaches the package directory whose
|
|
5
5
|
* `package.json` is `@earendil-works/pi-coding-agent`, and the file its
|
package/src/worker.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The pi child program (
|
|
2
|
+
* The pi child program (ADR 0023 D2, D3, D5, D6).
|
|
3
3
|
*
|
|
4
4
|
* Reads one JSON object from stdin, runs one prompt in pi and writes one JSON
|
|
5
5
|
* object per line to stdout, the last a Result. `README.md` holds the tables.
|