@basein/runner 0.2.12 → 0.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 +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 +2786 -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/dist/bin/bir-hooks.d.ts
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* Normally nobody runs it: `bir install` makes it the SessionStart hook
|
|
6
6
|
* (`bir-hooks ensure`), which starts it in the background for the project when no
|
|
7
7
|
* recorder is running there, and `bir up` / `bir down` start and stop that
|
|
8
|
-
* background process by hand.
|
|
8
|
+
* background process by hand. `bir-hooks revive --cwd <project>` starts it
|
|
9
|
+
* again mid-session: a bound proxy spawns it, detached, when the recorder it
|
|
10
|
+
* reported to is gone (control/daemon.ts, reviveDaemon). Its audit lines then go to
|
|
9
11
|
* ~/.baseinstrunner/logs/<project-key>.log. It can still be run in a terminal:
|
|
10
12
|
*
|
|
11
13
|
* bir-hooks # start; Ctrl-C to stop
|
|
@@ -16,31 +18,69 @@
|
|
|
16
18
|
* 2. accepts step reports from every `bir-proxy` that finds it;
|
|
17
19
|
* 3. owns run identity, the monotonic `stepIndex`, and the recorder chain (D5).
|
|
18
20
|
*
|
|
21
|
+
* The recorder listens first and signs in afterwards, in the background, so a
|
|
22
|
+
* slow or unreachable BaseIn service never holds a hook; it starts recording
|
|
23
|
+
* by itself when a sign-in appears (`bir login`) — no restart
|
|
24
|
+
* (control/recorder-main.ts, control/recorder-keeper.ts).
|
|
25
|
+
*
|
|
19
26
|
* Environment:
|
|
20
27
|
* BIR_AUTH_URL BaseIn auth-service. Unset, the address `bir setup`
|
|
21
28
|
* stored in ~/.baseinstrunner/config.json is used
|
|
22
|
-
* BIR_CONTROL_PORT
|
|
23
|
-
*
|
|
29
|
+
* BIR_CONTROL_PORT the port to listen on, over the project's own
|
|
30
|
+
* (default: the project's, else 53411, falling
|
|
31
|
+
* back if busy). 0 is any free port — the one
|
|
32
|
+
* taken is in the discovery file, /health and the
|
|
33
|
+
* log (tests and the smoke run; a project's hooks
|
|
34
|
+
* name a fixed port). A value that is not a port
|
|
35
|
+
* is ignored
|
|
36
|
+
* BIR_CORRELATION_DECISION unset (default: `auto`), `auto`, `allow` or
|
|
37
|
+
* `ask` — see below
|
|
24
38
|
* BIR_NO_CORRELATION=1 never inject a call id; join on fingerprints
|
|
25
39
|
* BIR_VERBOSE=1 per-step detail lines
|
|
40
|
+
* BIR_SERVICE_TIMEOUT_MS ceiling for one call to the service made off a
|
|
41
|
+
* hook's path (default 10000)
|
|
42
|
+
* BIR_SUPERSEDED_EXIT_MS how long a recorder the project's hooks moved
|
|
43
|
+
* away from (a reinstall on another port) must
|
|
44
|
+
* have had no session, run, live proxy or unsent
|
|
45
|
+
* step before it exits (default 86400000, a day)
|
|
46
|
+
* BIR_WINDOWS_LAUNCH=spawn Windows only: start the background recorder with
|
|
47
|
+
* a direct hidden spawn instead of PowerShell's
|
|
48
|
+
* Start-Process (faster by about a second; unsafe
|
|
49
|
+
* only when something above Claude Code captures
|
|
50
|
+
* its output — see control/daemon.ts)
|
|
26
51
|
*
|
|
27
52
|
* BIR_REPLAY=0 turn OFF calculated replay — running a scenario on
|
|
28
53
|
* a similar-meaning match (docs/calculatedReplay.md).
|
|
29
54
|
* ON by default; unset or any value other than "0"
|
|
30
|
-
* keeps it on
|
|
31
|
-
*
|
|
32
|
-
*
|
|
55
|
+
* keeps it on (`bir replay off` stores the same
|
|
56
|
+
* for one project). Read §13.2: only when a prompt
|
|
57
|
+
* matches a scenario, that scenario's own steps run
|
|
58
|
+
* without a prompt of their own — a steered step is
|
|
59
|
+
* answered `allow`, a directly executed one never
|
|
60
|
+
* reaches the permission system. Never in plan
|
|
61
|
+
* mode; every other tool call is asked as usual.
|
|
33
62
|
* BIR_REPLAY_ALLOW_SERVERS comma-separated server keys eligible for *direct*
|
|
34
63
|
* execution. Unset means every wrapped server
|
|
35
64
|
* BIR_MIN_STEER_SIMILARITY minimum match similarity to replay (default 0.92)
|
|
36
|
-
*
|
|
65
|
+
* BIR_DERIVE_API_KEY OPTIONAL. Derivation — reading what this turn acts
|
|
37
66
|
* on — is done by the service for a signed-in
|
|
38
|
-
* runner. Set this only to keep
|
|
39
|
-
* machine; signed out and
|
|
40
|
-
* target does not run
|
|
67
|
+
* runner. Set this (an Anthropic key) only to keep
|
|
68
|
+
* that reading on this machine; signed out and
|
|
69
|
+
* unset, a scenario with a target does not run
|
|
70
|
+
* (segmented.md R-PARAM-5)
|
|
71
|
+
* BIR_USE_ANTHROPIC_API_KEY=1 let the background recorder use an
|
|
72
|
+
* ANTHROPIC_API_KEY from its environment for
|
|
73
|
+
* derivation, as older versions did. Off by
|
|
74
|
+
* default: a recorder the SessionStart hook starts
|
|
75
|
+
* has Claude Code's environment, and using the key
|
|
76
|
+
* found there billed the person's own account. A
|
|
77
|
+
* `bir-hooks` run by hand in a terminal uses that
|
|
78
|
+
* terminal's ANTHROPIC_API_KEY as it always did
|
|
41
79
|
* BIR_DERIVE_MODEL derivation model (default claude-haiku-4-5-…)
|
|
42
|
-
* BIR_MATCH_BUDGET_MS prompt-hook match wait (default
|
|
43
|
-
* BIR_DERIVE_BUDGET_MS
|
|
80
|
+
* BIR_MATCH_BUDGET_MS prompt-hook match wait (default 1500)
|
|
81
|
+
* BIR_DERIVE_BUDGET_MS derivation wait before a direct run (default 8000);
|
|
82
|
+
* inside a hook it is at most BIR_HOOK_DERIVE_BUDGET_MS
|
|
83
|
+
* (default 4000)
|
|
44
84
|
* BIR_DERIVE_RECENT_RESULTS how many of this prompt's tool results derivation
|
|
45
85
|
* reads, so a target named by an earlier step can be
|
|
46
86
|
* found (default 5; 0 off)
|
|
@@ -49,31 +89,32 @@
|
|
|
49
89
|
* BIR_INTENT_REQUESTS_PER_TURN probes one turn may send (default 40).
|
|
50
90
|
* Separate from BIR_INTENT_MATCHES_PER_TURN: arming
|
|
51
91
|
* is a claim on the turn, counting hits is not
|
|
92
|
+
* BIR_INTENT_MATCH_BUDGET_MS one intent probe's own ceiling (default 4000).
|
|
93
|
+
* Not a wait: PreToolUse does not wait for a probe
|
|
94
|
+
* unless arming is on (BIR_SEGMENT_ARM=1 or
|
|
95
|
+
* BIR_INTENT_ARM=1), and then at most
|
|
96
|
+
* BIR_INTENT_ARM_BUDGET_MS (default 500)
|
|
52
97
|
* BIR_SEGMENT_ARM 1 lets a handed-out segment actually run mid-task.
|
|
53
98
|
* Unset is observe-only: what would have armed is
|
|
54
99
|
* logged and nothing is replaced
|
|
55
100
|
* BIR_MIN_SEGMENT_STEER_SIMILARITY minimum similarity to steer a segment
|
|
56
101
|
* (default 0.95)
|
|
57
|
-
* BIR_REPLAY_BUDGET_MS whole-plan ceiling, direct mode (
|
|
102
|
+
* BIR_REPLAY_BUDGET_MS whole-plan ceiling, direct mode (unset: the
|
|
103
|
+
* controller's 100000, BIR_REPLAY_PLAN_BUDGET_MS)
|
|
58
104
|
* BIR_STEP_TIMEOUT_MS one direct tools/call (default 60000)
|
|
59
105
|
*
|
|
60
|
-
* ABOUT `BIR_CORRELATION_DECISION`. Correlating a wrapped MCP call
|
|
61
|
-
* answering `PreToolUse` with
|
|
62
|
-
*
|
|
63
|
-
* **auto-approves the call**, so a tool the user would have been asked about
|
|
64
|
-
* no longer asked about.
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* (0.9). Detection decides "do not record this again", which is cheap — the worst
|
|
73
|
-
* case is a lost recording. Steering decides "do not think about this again",
|
|
74
|
-
* which is a much stronger claim, and a 0.90-similar prompt usually covers only
|
|
75
|
-
* part of the live task.
|
|
106
|
+
* ABOUT `BIR_CORRELATION_DECISION`. Correlating a wrapped MCP call exactly
|
|
107
|
+
* means answering `PreToolUse` with an extra argument, and Claude Code only
|
|
108
|
+
* takes that together with `permissionDecision: "allow"` — which also
|
|
109
|
+
* **auto-approves the call**, so a tool the user would have been asked about
|
|
110
|
+
* is no longer asked about. Unset (or `auto`), nothing is passed to the
|
|
111
|
+
* control server, which never does that for an ordinary call: it injects only
|
|
112
|
+
* where `allow` changes nothing the user is asked (a `bypassPermissions`
|
|
113
|
+
* session) and otherwise joins the proxy's report by fingerprint. `allow` is
|
|
114
|
+
* the behaviour of 0.2.12 and earlier, an explicit opt-in that is logged loudly at start
|
|
115
|
+
* — every wrapped call auto-approved and exactly correlated; `ask` keeps the
|
|
116
|
+
* prompt (a host that ignores the injection on a non-allow answer falls back
|
|
117
|
+
* to fingerprints).
|
|
76
118
|
*/
|
|
77
|
-
|
|
78
|
-
export type ReplaySource = "env" | "sidecar" | "default";
|
|
119
|
+
export type { ReplaySource } from "../control/recorder-main.js";
|
|
79
120
|
//# sourceMappingURL=bir-hooks.d.ts.map
|