@basein/runner 0.1.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.
Files changed (100) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +276 -0
  3. package/dist/auth/client.d.ts +85 -0
  4. package/dist/auth/client.js +284 -0
  5. package/dist/bin/bir-hooks.d.ts +48 -0
  6. package/dist/bin/bir-hooks.js +201 -0
  7. package/dist/bin/bir-proxy.d.ts +45 -0
  8. package/dist/bin/bir-proxy.js +207 -0
  9. package/dist/bin/bir-scenario.d.ts +24 -0
  10. package/dist/bin/bir-scenario.js +177 -0
  11. package/dist/bin/bir.d.ts +21 -0
  12. package/dist/bin/bir.js +876 -0
  13. package/dist/config/adapters/claude-code.d.ts +76 -0
  14. package/dist/config/adapters/claude-code.js +181 -0
  15. package/dist/config/adapters/generic.d.ts +17 -0
  16. package/dist/config/adapters/generic.js +36 -0
  17. package/dist/config/generate.d.ts +127 -0
  18. package/dist/config/generate.js +114 -0
  19. package/dist/config/resolve.d.ts +68 -0
  20. package/dist/config/resolve.js +132 -0
  21. package/dist/control/client.d.ts +56 -0
  22. package/dist/control/client.js +86 -0
  23. package/dist/control/correlation.d.ts +86 -0
  24. package/dist/control/correlation.js +0 -0
  25. package/dist/control/discovery.d.ts +50 -0
  26. package/dist/control/discovery.js +123 -0
  27. package/dist/control/ordering.d.ts +38 -0
  28. package/dist/control/ordering.js +44 -0
  29. package/dist/control/paths.d.ts +32 -0
  30. package/dist/control/paths.js +56 -0
  31. package/dist/control/server.d.ts +272 -0
  32. package/dist/control/server.js +1131 -0
  33. package/dist/control/transcript.d.ts +75 -0
  34. package/dist/control/transcript.js +241 -0
  35. package/dist/index.d.ts +37 -0
  36. package/dist/index.js +32 -0
  37. package/dist/jsonrpc/framing.d.ts +49 -0
  38. package/dist/jsonrpc/framing.js +143 -0
  39. package/dist/jsonrpc/types.d.ts +52 -0
  40. package/dist/jsonrpc/types.js +46 -0
  41. package/dist/proxy/intercept.d.ts +55 -0
  42. package/dist/proxy/intercept.js +147 -0
  43. package/dist/proxy/relay.d.ts +97 -0
  44. package/dist/proxy/relay.js +166 -0
  45. package/dist/proxy/session.d.ts +116 -0
  46. package/dist/proxy/session.js +319 -0
  47. package/dist/record/housekeeping.d.ts +34 -0
  48. package/dist/record/housekeeping.js +39 -0
  49. package/dist/record/queue.d.ts +48 -0
  50. package/dist/record/queue.js +96 -0
  51. package/dist/record/recorder.d.ts +111 -0
  52. package/dist/record/recorder.js +39 -0
  53. package/dist/record/redact.d.ts +37 -0
  54. package/dist/record/redact.js +119 -0
  55. package/dist/record/remote-recorder.d.ts +110 -0
  56. package/dist/record/remote-recorder.js +301 -0
  57. package/dist/record/truncate.d.ts +36 -0
  58. package/dist/record/truncate.js +85 -0
  59. package/dist/replay/bundle.d.ts +36 -0
  60. package/dist/replay/bundle.js +89 -0
  61. package/dist/replay/controller.d.ts +300 -0
  62. package/dist/replay/controller.js +807 -0
  63. package/dist/replay/coverage.d.ts +41 -0
  64. package/dist/replay/coverage.js +56 -0
  65. package/dist/replay/derive.d.ts +58 -0
  66. package/dist/replay/derive.js +166 -0
  67. package/dist/replay/executor.d.ts +78 -0
  68. package/dist/replay/executor.js +233 -0
  69. package/dist/replay/logic.d.ts +31 -0
  70. package/dist/replay/logic.js +50 -0
  71. package/dist/replay/plan.d.ts +181 -0
  72. package/dist/replay/plan.js +397 -0
  73. package/dist/replay/pricing.d.ts +41 -0
  74. package/dist/replay/pricing.js +76 -0
  75. package/dist/replay/source-run.d.ts +50 -0
  76. package/dist/replay/source-run.js +98 -0
  77. package/dist/replay/tool-error.d.ts +22 -0
  78. package/dist/replay/tool-error.js +60 -0
  79. package/dist/replay/types.d.ts +116 -0
  80. package/dist/replay/types.js +35 -0
  81. package/dist/upstream/client.d.ts +78 -0
  82. package/dist/upstream/client.js +114 -0
  83. package/dist/upstream/http-client.d.ts +78 -0
  84. package/dist/upstream/http-client.js +261 -0
  85. package/dist/upstream/lazy-client.d.ts +31 -0
  86. package/dist/upstream/lazy-client.js +53 -0
  87. package/dist/upstream/stdio-client.d.ts +57 -0
  88. package/dist/upstream/stdio-client.js +203 -0
  89. package/dist/util/log.d.ts +27 -0
  90. package/dist/util/log.js +51 -0
  91. package/dist/util/version.d.ts +2 -0
  92. package/dist/util/version.js +40 -0
  93. package/docs/BaseInstRunner.md +621 -0
  94. package/docs/calculatedReplay.md +1185 -0
  95. package/docs/calculatedReplayGuide.md +448 -0
  96. package/docs/installRun.md +413 -0
  97. package/docs/mcpmark.md +752 -0
  98. package/docs/quickstart.md +201 -0
  99. package/docs/t-bench.md +394 -0
  100. package/package.json +56 -0
@@ -0,0 +1,27 @@
1
+ /**
2
+ * log — the audit line format, ported from RRepeat's `log-line.ts`.
3
+ *
4
+ * WHY ALWAYS `console.error`: `bir-proxy` writes JSON-RPC frames to
5
+ * `process.stdout`. A single stray stdout byte corrupts the host's message
6
+ * stream, and it surfaces as an unrelated MCP error nowhere near the cause.
7
+ * Writing every line to stderr makes that impossible by construction.
8
+ *
9
+ * WHY TEXT AND NOT JSON: `grep` and `awk` are the tools, and the same line an
10
+ * operator watches live is the line that lands in a file. Durability is the
11
+ * shell's job — `bir-hooks 2>&1 | tee -a ~/.baseinstrunner/audit.log`.
12
+ */
13
+ /** `BIR_VERBOSE=1` adds per-message detail lines. Decisions are logged either way. */
14
+ export declare const VERBOSE: boolean;
15
+ /**
16
+ * `BIR_QUIET=1` silences the audit log. For test runs, where a hundred lines of
17
+ * correct behaviour bury the one assertion that failed. Never set it in a real
18
+ * session: the audit log is the only record of what the recorder decided.
19
+ */
20
+ export declare const QUIET: boolean;
21
+ /** Print one audit line: `[bir] <iso ts> <event> key=value …`. */
22
+ export declare function logLine(event: string, fields?: Record<string, unknown>): void;
23
+ /** A detail line, printed only under `BIR_VERBOSE=1`. */
24
+ export declare function logDetail(event: string, fields?: Record<string, unknown>): void;
25
+ export declare function logOnce(key: string, event: string, fields?: Record<string, unknown>): void;
26
+ export declare function errText(err: unknown): string;
27
+ //# sourceMappingURL=log.d.ts.map
@@ -0,0 +1,51 @@
1
+ /**
2
+ * log — the audit line format, ported from RRepeat's `log-line.ts`.
3
+ *
4
+ * WHY ALWAYS `console.error`: `bir-proxy` writes JSON-RPC frames to
5
+ * `process.stdout`. A single stray stdout byte corrupts the host's message
6
+ * stream, and it surfaces as an unrelated MCP error nowhere near the cause.
7
+ * Writing every line to stderr makes that impossible by construction.
8
+ *
9
+ * WHY TEXT AND NOT JSON: `grep` and `awk` are the tools, and the same line an
10
+ * operator watches live is the line that lands in a file. Durability is the
11
+ * shell's job — `bir-hooks 2>&1 | tee -a ~/.baseinstrunner/audit.log`.
12
+ */
13
+ /** `BIR_VERBOSE=1` adds per-message detail lines. Decisions are logged either way. */
14
+ export const VERBOSE = process.env.BIR_VERBOSE === "1";
15
+ /**
16
+ * `BIR_QUIET=1` silences the audit log. For test runs, where a hundred lines of
17
+ * correct behaviour bury the one assertion that failed. Never set it in a real
18
+ * session: the audit log is the only record of what the recorder decided.
19
+ */
20
+ export const QUIET = process.env.BIR_QUIET === "1";
21
+ /** Print one audit line: `[bir] <iso ts> <event> key=value …`. */
22
+ export function logLine(event, fields = {}) {
23
+ if (QUIET)
24
+ return;
25
+ const pairs = [];
26
+ for (const [key, value] of Object.entries(fields)) {
27
+ if (value === undefined || value === null)
28
+ continue;
29
+ const text = String(value);
30
+ pairs.push(/[\s"]/.test(text) ? `${key}=${JSON.stringify(text)}` : `${key}=${text}`);
31
+ }
32
+ const line = `[bir] ${new Date().toISOString()} ${event}${pairs.length ? ` ${pairs.join(" ")}` : ""}`;
33
+ console.error(line);
34
+ }
35
+ /** A detail line, printed only under `BIR_VERBOSE=1`. */
36
+ export function logDetail(event, fields = {}) {
37
+ if (VERBOSE)
38
+ logLine(event, fields);
39
+ }
40
+ /** Log a message once per process, keyed by `key`. For degradation notices. */
41
+ const seen = new Set();
42
+ export function logOnce(key, event, fields = {}) {
43
+ if (seen.has(key))
44
+ return;
45
+ seen.add(key);
46
+ logLine(event, fields);
47
+ }
48
+ export function errText(err) {
49
+ return err instanceof Error ? err.message : String(err);
50
+ }
51
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1,2 @@
1
+ export declare function packageVersion(): string;
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1,40 @@
1
+ /**
2
+ * This package's own version, read from the nearest `package.json`.
3
+ *
4
+ * Every binary needs it for a different reason — `bir` prints it and pins the
5
+ * npx spec it writes into configs, a proxy reports it when it registers, and the
6
+ * control server compares the two — so it lives here rather than in any one of
7
+ * them.
8
+ *
9
+ * A walk, not a constant: the module sits at `dist/util/version.js` when
10
+ * installed and `.test-build/src/util/version.js` under test, and the package
11
+ * root is a different number of levels up in each. Five is enough for both with
12
+ * room to spare.
13
+ */
14
+ import { readFileSync } from "node:fs";
15
+ import { dirname, join } from "node:path";
16
+ import { fileURLToPath } from "node:url";
17
+ let cached;
18
+ export function packageVersion() {
19
+ if (cached)
20
+ return cached;
21
+ let dir = dirname(fileURLToPath(import.meta.url));
22
+ for (let i = 0; i < 5; i += 1) {
23
+ try {
24
+ const pkg = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
25
+ if (pkg.version) {
26
+ cached = pkg.version;
27
+ return cached;
28
+ }
29
+ }
30
+ catch {
31
+ /* keep walking */
32
+ }
33
+ dir = dirname(dir);
34
+ }
35
+ // Unknown, not fatal. A missing version must never stop a session: the worst
36
+ // it costs is a skew check that cannot fire.
37
+ cached = "0.0.0";
38
+ return cached;
39
+ }
40
+ //# sourceMappingURL=version.js.map