@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
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* recorder-main — the long-running half of `bir-hooks`: the control server
|
|
3
|
+
* that receives Claude Code's hooks and the proxies' step reports.
|
|
4
|
+
*
|
|
5
|
+
* Kept out of `bin/bir-hooks.ts` so the SessionStart hook (`bir-hooks ensure`),
|
|
6
|
+
* which runs on every session start, `/clear` and compaction, never loads the
|
|
7
|
+
* control server, the replay engine or the service client it does not use.
|
|
8
|
+
*
|
|
9
|
+
* THE ORDER OF START-UP IS THE POINT. Claude Code sends every hook of a
|
|
10
|
+
* session to this process's port. Until it listens, each one is refused, and
|
|
11
|
+
* Claude Code shows each refusal as a hook error. So, in order:
|
|
12
|
+
*
|
|
13
|
+
* 1. crash handlers — nothing after this can take the process down;
|
|
14
|
+
* 2. the log, the project's port and token, the journal — local files only;
|
|
15
|
+
* 3. the recorder, decided from disk alone (recorder-keeper.ts) — no network;
|
|
16
|
+
* 4. listen, and write the discovery file;
|
|
17
|
+
* 5. only then, in the background and bounded: refresh the token, check an
|
|
18
|
+
* http address, notice a sign-in appearing — none of it ever delays a hook.
|
|
19
|
+
*
|
|
20
|
+
* It used to sign in (two network calls, no timeouts) between 2 and 4, and a
|
|
21
|
+
* slow service held the port closed for up to five minutes.
|
|
22
|
+
*/
|
|
23
|
+
import { ControlServer } from "./server.js";
|
|
24
|
+
/**
|
|
25
|
+
* What a prompt waits for its scenario match by default (`BIR_MATCH_BUDGET_MS`).
|
|
26
|
+
* Past it the prompt goes on without one (K5): the service answering in 1-2 s
|
|
27
|
+
* must not add that to every prompt.
|
|
28
|
+
*/
|
|
29
|
+
export declare const DEFAULT_MATCH_BUDGET_MS = 1500;
|
|
30
|
+
/**
|
|
31
|
+
* `BIR_CORRELATION_DECISION`, passed on only when it was set to `allow` or
|
|
32
|
+
* `ask`. Unset, nothing is passed and the control server decides — and by
|
|
33
|
+
* default (`auto`) it never answers `allow` for an ordinary wrapped call,
|
|
34
|
+
* which skipped the person's permission prompt.
|
|
35
|
+
*/
|
|
36
|
+
export declare function correlationDecisionFromEnv(): "allow" | "ask" | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Which Anthropic key derivation may use, if any.
|
|
39
|
+
*
|
|
40
|
+
* In the background, only one the person set for this purpose. The
|
|
41
|
+
* hook-started recorder has Claude Code's environment, and an API-billed
|
|
42
|
+
* Claude Code carries its `ANTHROPIC_API_KEY` there: picking that up silently
|
|
43
|
+
* billed the person's own key for work the service does for a signed-in
|
|
44
|
+
* runner. It is dropped from this process (replay would otherwise read it
|
|
45
|
+
* from the environment) unless `BIR_USE_ANTHROPIC_API_KEY=1` says to use it.
|
|
46
|
+
*
|
|
47
|
+
* In a terminal (`bir-hooks` run by hand, `daemon` false) the environment is
|
|
48
|
+
* the operator's own, and older guides told them to set exactly this variable
|
|
49
|
+
* to keep derivation on the machine: it is used as it always was.
|
|
50
|
+
*/
|
|
51
|
+
export declare function derivationKey(daemon?: boolean): {
|
|
52
|
+
apiKey?: string;
|
|
53
|
+
source?: string;
|
|
54
|
+
};
|
|
55
|
+
/** Where the three replay switches came from, for `/health` and `bir doctor`. */
|
|
56
|
+
export type ReplaySource = "env" | "sidecar" | "default";
|
|
57
|
+
/** What a recorder still serves (K4, `ControlServer.activity()`). */
|
|
58
|
+
export interface RecorderActivity {
|
|
59
|
+
/** Runs opened and not yet sealed. */
|
|
60
|
+
openRuns: number;
|
|
61
|
+
/** Sessions it has not forgotten (see the control server's reaper). */
|
|
62
|
+
knownSessions: number;
|
|
63
|
+
/** Registered proxies whose process is alive: an open window's MCP servers. */
|
|
64
|
+
liveProxyPids: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The control server's {@link RecorderActivity}. From its own accessor when it
|
|
68
|
+
* has one; otherwise the same, read from its `/health` body (heavier, and
|
|
69
|
+
* asked once a minute only while superseded).
|
|
70
|
+
*/
|
|
71
|
+
export declare function activityOf(server: ControlServer): RecorderActivity;
|
|
72
|
+
export declare function runRecorder(): Promise<void>;
|
|
73
|
+
//# sourceMappingURL=recorder-main.d.ts.map
|