@basein/runner 0.2.12 → 0.3.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 +540 -369
- package/dist/auth/client.d.ts +65 -3
- package/dist/auth/client.js +305 -53
- package/dist/bin/bir-hooks.d.ts +72 -31
- package/dist/bin/bir-hooks.js +176 -284
- package/dist/bin/bir-proxy.d.ts +17 -2
- package/dist/bin/bir-proxy.js +222 -28
- package/dist/bin/bir-scenario.d.ts +61 -21
- package/dist/bin/bir-scenario.js +593 -122
- package/dist/bin/bir.d.ts +12 -6
- package/dist/bin/bir.js +2935 -489
- package/dist/bin/investigate.js +40 -15
- package/dist/bin/scenario-edit.d.ts +7 -1
- package/dist/bin/scenario-edit.js +43 -21
- package/dist/bin/scenario-liveness.d.ts +194 -0
- package/dist/bin/scenario-liveness.js +459 -0
- package/dist/bin/scenario-stderr.d.ts +43 -0
- package/dist/bin/scenario-stderr.js +76 -0
- package/dist/bin/service-read.d.ts +88 -0
- package/dist/bin/service-read.js +128 -0
- package/dist/bin/setup.d.ts +19 -0
- package/dist/bin/setup.js +146 -20
- package/dist/config/adapters/claude-code.d.ts +92 -14
- package/dist/config/adapters/claude-code.js +291 -101
- package/dist/config/adapters/generic.d.ts +4 -1
- package/dist/config/adapters/generic.js +13 -14
- package/dist/config/generate.d.ts +392 -14
- package/dist/config/generate.js +666 -19
- package/dist/config/mcp-approval.d.ts +76 -0
- package/dist/config/mcp-approval.js +210 -0
- package/dist/config/node-path.d.ts +42 -0
- package/dist/config/node-path.js +102 -0
- package/dist/config/overrides.d.ts +62 -0
- package/dist/config/overrides.js +136 -0
- package/dist/config/resolve.d.ts +70 -8
- package/dist/config/resolve.js +186 -15
- package/dist/control/client.d.ts +22 -0
- package/dist/control/client.js +26 -7
- package/dist/control/correlation.d.ts +23 -5
- package/dist/control/correlation.js +0 -0
- package/dist/control/daemon.d.ts +400 -18
- package/dist/control/daemon.js +1105 -102
- package/dist/control/discovery.d.ts +77 -5
- package/dist/control/discovery.js +186 -11
- package/dist/control/ensure-hook.d.ts +61 -0
- package/dist/control/ensure-hook.js +160 -8
- package/dist/control/paths.d.ts +26 -0
- package/dist/control/paths.js +34 -0
- package/dist/control/pin-guard.d.ts +83 -0
- package/dist/control/pin-guard.js +534 -0
- package/dist/control/recorder-keeper.d.ts +229 -0
- package/dist/control/recorder-keeper.js +721 -0
- package/dist/control/recorder-main.d.ts +73 -0
- package/dist/control/recorder-main.js +778 -0
- package/dist/control/server.d.ts +707 -31
- package/dist/control/server.js +2787 -302
- package/dist/control/transcript.d.ts +21 -1
- package/dist/control/transcript.js +378 -112
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -1
- package/dist/jsonrpc/framing.d.ts +76 -12
- package/dist/jsonrpc/framing.js +216 -59
- package/dist/proxy/intercept.d.ts +49 -5
- package/dist/proxy/intercept.js +188 -59
- package/dist/proxy/relay.d.ts +16 -0
- package/dist/proxy/relay.js +77 -5
- package/dist/proxy/revive.d.ts +122 -0
- package/dist/proxy/revive.js +251 -0
- package/dist/proxy/session.d.ts +222 -14
- package/dist/proxy/session.js +708 -99
- package/dist/record/recorder.d.ts +51 -3
- package/dist/record/recorder.js +3 -0
- package/dist/record/redact.d.ts +103 -9
- package/dist/record/redact.js +659 -30
- package/dist/record/remote-recorder.d.ts +327 -32
- package/dist/record/remote-recorder.js +1517 -187
- package/dist/record/switchable-recorder.d.ts +126 -0
- package/dist/record/switchable-recorder.js +351 -0
- package/dist/record/truncate.d.ts +40 -1
- package/dist/record/truncate.js +111 -4
- package/dist/replay/bash-channel.d.ts +35 -0
- package/dist/replay/bash-channel.js +133 -0
- package/dist/replay/bundle.d.ts +10 -0
- package/dist/replay/bundle.js +10 -0
- package/dist/replay/controller.d.ts +369 -20
- package/dist/replay/controller.js +1176 -107
- package/dist/replay/derive.d.ts +1 -0
- package/dist/replay/derive.js +81 -24
- package/dist/replay/executor.d.ts +51 -16
- package/dist/replay/executor.js +114 -41
- package/dist/replay/handover.d.ts +54 -1
- package/dist/replay/handover.js +55 -5
- package/dist/replay/logic.d.ts +62 -10
- package/dist/replay/logic.js +140 -22
- package/dist/replay/plan.d.ts +201 -27
- package/dist/replay/plan.js +581 -141
- package/dist/replay/safety.d.ts +72 -0
- package/dist/replay/safety.js +303 -0
- package/dist/replay/source-run.d.ts +10 -0
- package/dist/replay/source-run.js +80 -35
- package/dist/replay/targets.d.ts +15 -1
- package/dist/replay/targets.js +62 -4
- package/dist/replay/tool-error.d.ts +15 -1
- package/dist/replay/tool-error.js +33 -1
- package/dist/replay/types.d.ts +7 -4
- package/dist/upstream/client.d.ts +56 -3
- package/dist/upstream/client.js +61 -4
- package/dist/upstream/headers.d.ts +43 -0
- package/dist/upstream/headers.js +90 -0
- package/dist/upstream/http-client.d.ts +213 -22
- package/dist/upstream/http-client.js +1034 -168
- package/dist/upstream/http-transport.d.ts +143 -0
- package/dist/upstream/http-transport.js +391 -0
- package/dist/upstream/lazy-client.d.ts +8 -0
- package/dist/upstream/lazy-client.js +29 -1
- package/dist/upstream/sse.d.ts +78 -0
- package/dist/upstream/sse.js +189 -0
- package/dist/upstream/stdio-client.d.ts +61 -1
- package/dist/upstream/stdio-client.js +356 -33
- package/dist/util/atomic-write.d.ts +29 -0
- package/dist/util/atomic-write.js +96 -0
- package/dist/util/journal.d.ts +15 -0
- package/dist/util/journal.js +48 -3
- package/dist/util/log.d.ts +10 -0
- package/dist/util/log.js +28 -1
- package/dist/util/off-switch.d.ts +46 -0
- package/dist/util/off-switch.js +91 -0
- package/dist/util/service-health.d.ts +133 -0
- package/dist/util/service-health.js +217 -0
- package/docs/BaseInstRunner.md +694 -621
- package/docs/calculatedReplay.md +1625 -1304
- package/docs/calculatedReplayGuide.md +1212 -1087
- package/docs/installRun.md +1013 -772
- package/docs/loginWeb.md +627 -607
- package/docs/mcpmark.md +49 -16
- package/docs/my-first-sample.md +569 -545
- package/docs/quickstart.md +384 -311
- package/docs/t-bench.md +406 -394
- package/package.json +58 -57
- package/production.md +1371 -0
- package/scripts/install.ps1 +97 -6
- package/scripts/install.sh +104 -7
package/docs/mcpmark.md
CHANGED
|
@@ -86,8 +86,8 @@ identical prompt the recorded values *are* the right ones.
|
|
|
86
86
|
```
|
|
87
87
|
claude -p (cwd = the run dir)
|
|
88
88
|
├── mcp__bir__run_scenario ─────────────▶ bir-scenario ──┐ direct-mode delivery
|
|
89
|
-
│ │ (§4.4 —
|
|
90
|
-
└── mcp__postgres__* ──▶ bir-proxy ──▶ postgres-mcp │
|
|
89
|
+
│ │ (§4.4 — allowed by bir's
|
|
90
|
+
└── mcp__postgres__* ──▶ bir-proxy ──▶ postgres-mcp │ hook once a plan is announced)
|
|
91
91
|
│ (uvx, │
|
|
92
92
|
reports every call mcp<2) │
|
|
93
93
|
▼ │ ▼
|
|
@@ -200,13 +200,17 @@ no `pipx`; both are equivalent here.
|
|
|
200
200
|
Then:
|
|
201
201
|
|
|
202
202
|
```bash
|
|
203
|
-
bir install --replay --local
|
|
203
|
+
bir install --replay --local --server postgres
|
|
204
204
|
```
|
|
205
205
|
|
|
206
|
-
That
|
|
207
|
-
|
|
206
|
+
That writes a copy of `postgres` wrapped with `bir-proxy` into this project's local scope in
|
|
207
|
+
`~/.claude.json` (`.mcp.json` stays as written), installs the hooks into
|
|
208
|
+
`.claude/settings.local.json`, and adds the `bir` scenario server that direct mode delivers
|
|
209
|
+
through. `--server postgres` is needed in a fresh directory: Claude Code never asks about a
|
|
210
|
+
local-scope server, so `bir install` copies a `.mcp.json` server only once Claude Code has
|
|
211
|
+
approved it, and otherwise prints `postgres — left unwrapped`. Note the port it reports —
|
|
208
212
|
it picks a free one (**53411** here, not the 53455 the incident demo uses), and the hook
|
|
209
|
-
URLs in `settings.json` are written for that port.
|
|
213
|
+
URLs in `settings.local.json` are written for that port.
|
|
210
214
|
|
|
211
215
|
### 4.4 Deny the built-ins — this is the whole ballgame
|
|
212
216
|
|
|
@@ -235,13 +239,28 @@ Ignoring 2 permissions.allow entries from .claude/settings.json:
|
|
|
235
239
|
this workspace has not been trusted.
|
|
236
240
|
```
|
|
237
241
|
|
|
238
|
-
This is not cosmetic, and it fails *asymmetrically
|
|
242
|
+
This is not cosmetic, and it fails *asymmetrically*. Which half breaks depends on the
|
|
243
|
+
runner version.
|
|
239
244
|
|
|
240
|
-
|
|
245
|
+
**Current runner.** bir no longer approves wrapped MCP calls, other than a step a steered
|
|
246
|
+
replay pins. For an ordinary
|
|
247
|
+
`mcp__postgres__*` call its `PreToolUse` answers with no permission decision and joins the
|
|
248
|
+
proxy's report by argument fingerprint ([server.ts](../src/control/server.ts),
|
|
249
|
+
`injectionDecision`). With the allow list gone those calls fall to Claude Code's own
|
|
250
|
+
permission check, and in `-p` mode they are denied, so trial 1 cannot even record the task.
|
|
251
|
+
`mcp__bir__run_scenario` is now the tool the hook allows itself, and only while this
|
|
252
|
+
session's direct plan has been announced (never in plan mode; your own deny and ask rules
|
|
253
|
+
still apply). If `run_scenario` is refused anyway, or the model's first call is some other
|
|
254
|
+
tool, the plan is retired without running a step (`replay.vetoed`, booked `not_steered`)
|
|
255
|
+
and the model does the task.
|
|
256
|
+
|
|
257
|
+
**0.2.12 and earlier, which §11 measured.** The other way round:
|
|
258
|
+
|
|
259
|
+
- `mcp__postgres__*` kept working, because bir's own `PreToolUse` answered
|
|
241
260
|
`permissionDecision: "allow"` on the correlation path ([server.ts:859](../src/control/server.ts#L859)).
|
|
242
|
-
- `mcp__bir__run_scenario`
|
|
243
|
-
([controller.ts:301](../src/replay/controller.ts#L301) → `{kind:"passthrough"}`), so it
|
|
244
|
-
no hook-granted allow. With the allow list gone it
|
|
261
|
+
- `mcp__bir__run_scenario` was the **one** tool bir deliberately passed through
|
|
262
|
+
([controller.ts:301](../src/replay/controller.ts#L301) → `{kind:"passthrough"}`), so it got
|
|
263
|
+
no hook-granted allow. With the allow list gone it was denied, and in `-p` mode a denial is
|
|
245
264
|
final:
|
|
246
265
|
|
|
247
266
|
```
|
|
@@ -249,18 +268,22 @@ This is not cosmetic, and it fails *asymmetrically* in the worst possible way:
|
|
|
249
268
|
but you haven't granted it yet.
|
|
250
269
|
```
|
|
251
270
|
|
|
252
|
-
The plan then
|
|
253
|
-
task by hand, and the first manual call
|
|
254
|
-
the task
|
|
271
|
+
The plan then armed in `direct` mode, the model could not reach the delivery tool, it did the
|
|
272
|
+
task by hand, and the first manual call triggered divergence. Everything *looked* healthy —
|
|
273
|
+
the task passed and the audit log said `mode=direct` — while the saving was negative. §11 is
|
|
255
274
|
the measurement.
|
|
256
275
|
|
|
257
|
-
Fix before the first
|
|
276
|
+
Fix before the first trial, either by running `claude` interactively in the directory once
|
|
258
277
|
and accepting the trust dialog, or by setting in `~/.claude.json`:
|
|
259
278
|
|
|
260
279
|
```json
|
|
261
280
|
"projects": { "C:/Users/Admin/Desktop/BasIns/mcpmark-hys": { "hasTrustDialogAccepted": true } }
|
|
262
281
|
```
|
|
263
282
|
|
|
283
|
+
Other ways to let the postgres calls through: `--allowedTools` on the `claude -p` line, or
|
|
284
|
+
`BIR_CORRELATION_DECISION=allow` in the shell that starts `bir-hooks` (§4.5), which brings
|
|
285
|
+
back 0.2.12's auto-approval of every wrapped call.
|
|
286
|
+
|
|
264
287
|
### 4.5 Start the control server, in this directory
|
|
265
288
|
|
|
266
289
|
```bash
|
|
@@ -505,6 +528,11 @@ roughly the cost of just doing the task, plus overhead.
|
|
|
505
528
|
**The mechanism is sound; the delivery channel was blocked.** Nothing in these six trials
|
|
506
529
|
measures direct mode's actual saving, because direct delivery never once happened.
|
|
507
530
|
|
|
531
|
+
*Superseded by later runners (§4.4):* bir now allows `run_scenario` itself for an announced
|
|
532
|
+
direct plan, and a direct plan whose delivery never happens is retired without running a
|
|
533
|
+
step. An untrusted directory no longer produces these `diverged` rows; it shows up as denied
|
|
534
|
+
`mcp__postgres__*` calls instead.
|
|
535
|
+
|
|
508
536
|
### Next
|
|
509
537
|
|
|
510
538
|
1. Trust the workspace (§4.4). Without it every replay measures the divergence path.
|
|
@@ -744,9 +772,14 @@ and read every `sampleValue` as though it were about to be pasted into a shell.
|
|
|
744
772
|
| §13 (2) | a step whose tool returned `Error:` logged `ok=true` | [tool-error.ts](../src/replay/tool-error.ts): an MCP result with `isError: true` is a `failed` step at stage `tool_call`, in direct, divergence and steer mode alike. Since 2026-09-19 a leading `Error` text with `isError: false` no longer counts: replay judges a step by the same rule the recorder does |
|
|
745
773
|
| §13 (3) | `steered_full` booked a saving on errored steps | [controller.ts](../src/replay/controller.ts): any errored step forces `outcome: "failed"`, which books a baseline sample |
|
|
746
774
|
| §12 header | bundle said "previously recorded" for live work | [bundle.ts](../src/replay/bundle.ts): a bundle with no recorded entry says the work was just executed and its side effects are in place |
|
|
747
|
-
| §12 session | `/scenario/run` picked the first unfinished session | [server.ts](../src/control/server.ts): it
|
|
775
|
+
| §12 session | `/scenario/run` picked the first unfinished session | [server.ts](../src/control/server.ts): it runs only the plan of the session whose `run_scenario` call is waiting for it, matched on Claude Code's tool-use id where the host sends one; with none waiting it answers `no_plan` and runs nothing |
|
|
748
776
|
| §12 latent | direct-mode bundle uncapped | [plan.ts](../src/replay/plan.ts): `runToCompletion` caps at `MAX_REPLAY_REASON` |
|
|
749
777
|
| §6 | `steps_pinned` reported 1 for sequential pins | [controller.ts](../src/replay/controller.ts): counted as each pin threads, not from `pinned.size` |
|
|
750
778
|
|
|
751
779
|
Not yet re-measured. Trials 9+ need a re-`calc` (the scenario must be regenerated for the
|
|
752
780
|
validation pass to run) and then the §5 protocol again from a fresh baseline.
|
|
781
|
+
|
|
782
|
+
Before re-running on a runner newer than 0.2.12, read §4.3–4.4 again: `bir install` needs
|
|
783
|
+
`--server postgres` to wrap a fresh directory's server, and wrapped `mcp__postgres__*` calls
|
|
784
|
+
need the trusted `allow` list (or `--allowedTools`) even to record trial 1, while
|
|
785
|
+
`run_scenario` is now allowed by bir's hook.
|