@enricai/barnacle 1.6.13 → 1.7.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 (68) hide show
  1. package/README.md +3 -5
  2. package/dist/api/schemas/submissions.d.ts +8 -8
  3. package/dist/lib/bedrock.d.ts +10 -7
  4. package/dist/lib/bedrock.d.ts.map +1 -1
  5. package/dist/lib/bedrock.js +8 -5
  6. package/dist/lib/bedrock.js.map +1 -1
  7. package/dist/lib/http.d.ts +4 -3
  8. package/dist/lib/http.d.ts.map +1 -1
  9. package/dist/lib/http.js +25 -3
  10. package/dist/lib/http.js.map +1 -1
  11. package/dist/lib/llm/anthropic-client.d.ts +12 -0
  12. package/dist/lib/llm/anthropic-client.d.ts.map +1 -1
  13. package/dist/lib/llm/anthropic-client.js +25 -0
  14. package/dist/lib/llm/anthropic-client.js.map +1 -1
  15. package/dist/lib/telemetry/beacon-capture.d.ts +4 -3
  16. package/dist/lib/telemetry/beacon-capture.d.ts.map +1 -1
  17. package/dist/lib/telemetry/beacon-capture.js.map +1 -1
  18. package/dist/lib/telemetry/reconciliation-record.d.ts +15 -33
  19. package/dist/lib/telemetry/reconciliation-record.d.ts.map +1 -1
  20. package/dist/lib/telemetry/reconciliation-record.js +11 -49
  21. package/dist/lib/telemetry/reconciliation-record.js.map +1 -1
  22. package/dist/lib/telemetry/submission-capture.d.ts +8 -13
  23. package/dist/lib/telemetry/submission-capture.d.ts.map +1 -1
  24. package/dist/lib/telemetry/submission-capture.js +2 -4
  25. package/dist/lib/telemetry/submission-capture.js.map +1 -1
  26. package/dist/lib/telemetry/submission-reader.d.ts +3 -4
  27. package/dist/lib/telemetry/submission-reader.d.ts.map +1 -1
  28. package/dist/lib/telemetry/submission-reader.js +3 -4
  29. package/dist/lib/telemetry/submission-reader.js.map +1 -1
  30. package/dist/plugins/config-plugin.d.ts.map +1 -1
  31. package/dist/plugins/config-plugin.js +25 -3
  32. package/dist/plugins/config-plugin.js.map +1 -1
  33. package/dist/plugins/loader.d.ts +0 -7
  34. package/dist/plugins/loader.d.ts.map +1 -1
  35. package/dist/plugins/loader.js +0 -9
  36. package/dist/plugins/loader.js.map +1 -1
  37. package/dist/scraper/deep-locator-actuate.d.ts +24 -19
  38. package/dist/scraper/deep-locator-actuate.d.ts.map +1 -1
  39. package/dist/scraper/deep-locator-actuate.js +68 -23
  40. package/dist/scraper/deep-locator-actuate.js.map +1 -1
  41. package/dist/scraper/deep-locator-scan.d.ts +20 -0
  42. package/dist/scraper/deep-locator-scan.d.ts.map +1 -1
  43. package/dist/scraper/deep-locator-scan.js +25 -0
  44. package/dist/scraper/deep-locator-scan.js.map +1 -1
  45. package/dist/scraper/flow-runner.d.ts +86 -14
  46. package/dist/scraper/flow-runner.d.ts.map +1 -1
  47. package/dist/scraper/flow-runner.js +233 -87
  48. package/dist/scraper/flow-runner.js.map +1 -1
  49. package/dist/scripts/recon-browser.d.ts +6 -5
  50. package/dist/scripts/recon-browser.d.ts.map +1 -1
  51. package/dist/scripts/recon-browser.js +24 -21
  52. package/dist/scripts/recon-browser.js.map +1 -1
  53. package/dist/scripts/recon-generate.d.ts +2 -2
  54. package/dist/scripts/recon-generate.d.ts.map +1 -1
  55. package/dist/scripts/recon-generate.js +21 -88
  56. package/dist/scripts/recon-generate.js.map +1 -1
  57. package/dist/scripts/recon-shared.d.ts +0 -10
  58. package/dist/scripts/recon-shared.d.ts.map +1 -1
  59. package/dist/scripts/recon-shared.js +0 -11
  60. package/dist/scripts/recon-shared.js.map +1 -1
  61. package/dist/site-plugin.d.ts +3 -3
  62. package/dist/testing/coverage-guard-suite.d.mts +7 -7
  63. package/dist/testing/coverage-guard-suite.mjs +5 -5
  64. package/package.json +5 -2
  65. package/dist/scripts/migrate-telemetry-dir-names.d.ts +0 -57
  66. package/dist/scripts/migrate-telemetry-dir-names.d.ts.map +0 -1
  67. package/dist/scripts/migrate-telemetry-dir-names.js +0 -156
  68. package/dist/scripts/migrate-telemetry-dir-names.js.map +0 -1
package/README.md CHANGED
@@ -102,7 +102,7 @@ Drives a real Stagehand + Steel browser through your flow. Captures are wired vi
102
102
 
103
103
  Captures every network call matching `/graph`, `/api/`, `/graphql`, `/v1/`, or `*.json` to `<run-dir>/graphql/<NNN>-<phase>-<operationName>.json` — one file per call, diffable and greppable. Use `--capture-all` for sites with non-standard API paths; it captures every response, producing more noise but missing nothing. Omitting both `--flow` and `--flow-file` runs zero interaction steps and captures only the network activity that fires during page navigation — useful for pure GET-style SPAs that fetch everything they need on load.
104
104
 
105
- Each step runs through a self-healing cascade (`act` → `observe + act` → `observe + act` with `ignoreSelectors` → Anthropic-SDK rephrase) verified by network-counter delta or URL change. The script's `main()` attempts up to two global flow replans before giving up; terminal failures dump a diagnostic bundle to `<run-dir>/step-failures/`. See [docs/playbook.md#1c--self-healing-cascade](./docs/playbook.md#1c--self-healing-cascade) for the full design.
105
+ Each step runs through a self-healing cascade (`act` → `observe + act` → `observe + act` with `ignoreSelectors` → LLM rephrase) verified by network-counter delta or URL change. The script's `main()` attempts up to two global flow replans before giving up; terminal failures dump a diagnostic bundle to `<run-dir>/step-failures/`. See [docs/playbook.md#1c--self-healing-cascade](./docs/playbook.md#1c--self-healing-cascade) for the full design.
106
106
 
107
107
  Total runtime: 20–40 minutes for a typical flow (longer if healing or replans fire), fully unattended.
108
108
 
@@ -222,7 +222,7 @@ pnpm run recon:generate -- --site-id my-site --vocabulary ./src/recon/my-vocabul
222
222
  - Every regex must be free of the `g`/`y` flags and every field name must be a valid JS identifier — the loader rejects both. A stateful regex matches only every other step; a non-identifier emits `payload.<name>` as a syntax error.
223
223
  - Run the generator with a `.ts` vocabulary under `tsx`, or point it at compiled `.js` — plain `node` cannot import TypeScript before v22.18.
224
224
 
225
- > **Deprecated fallback:** omit `--vocabulary` and the generator falls back to a built-in recruiting table (first/last name, email, phone, address), warning as it does. That table is **removed in 2.0.0**, after which an absent vocabulary on a spliceable flow is an error. Supply one now.
225
+ > Omitting `--vocabulary` disables splicing entirely every step's recon constant is emitted literally, with no caller-data substitution.
226
226
 
227
227
  #### Telling the generator your ATS's form-schema wire keys
228
228
 
@@ -587,8 +587,6 @@ import { BUILTIN_SITE_PLUGINS } from "@/plugins/discover";
587
587
  BUILTIN_SITE_PLUGINS.push(mySitePlugin as SitePlugin<unknown, unknown>);
588
588
  ```
589
589
 
590
- `SITE_PLUGINS` in `src/plugins/loader.ts` is an alias for `BUILTIN_SITE_PLUGINS` kept for backwards compatibility; prefer the `discover.ts` import for new code.
591
-
592
590
  Core registers `POST /v1/my-site/run` automatically at startup.
593
591
 
594
592
  ### Wire up the nightly smoke test
@@ -746,7 +744,7 @@ Every line in `.barnacle/calls.ndjson` is a JSON object with these fields (sourc
746
744
 
747
745
  | `callType` | Source | When emitted |
748
746
  |------------|--------|--------------|
749
- | `recon-rephrase` | `src/scripts/recon-browser.ts` | Attempt-4 rephrase inside the recon-browser step-healing cascade — Anthropic SDK is asked to reword the failing step |
747
+ | `recon-rephrase` | `src/scripts/recon-browser.ts` | Attempt-5 rephrase inside the recon-browser step-healing cascade — the ai-SDK model (Anthropic-direct or Bedrock-backed) is asked to reword the failing step |
750
748
  | `recon-replan` | `src/scripts/recon-browser.ts` | Global replan after a step terminally fails — Claude rewrites the remaining flow tail |
751
749
  | `recon-flow-patch` | `src/scripts/recon-heal.ts` | Patch proposal from the recon-flow-patch-generator during the `recon-heal` self-healing loop |
752
750
  | `llm-prompt-patch` | `src/scripts/llm-heal.ts` | Patch proposal from the llm-call-patch-generator during the `llm-heal` self-healing loop |
@@ -43,13 +43,13 @@ export type SubmissionsQuerystring = z.infer<typeof submissionsQuerystringSchema
43
43
  export declare const reconciliationRowSchema: z.ZodObject<{
44
44
  siteId: z.ZodString;
45
45
  requestId: z.ZodString;
46
- joinKeys: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
47
- session: z.ZodDefault<z.ZodNullable<z.ZodObject<{
46
+ joinKeys: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
47
+ session: z.ZodNullable<z.ZodObject<{
48
48
  id: z.ZodString;
49
49
  provider: z.ZodString;
50
50
  ip: z.ZodNullable<z.ZodString>;
51
51
  ipCapturedAt: z.ZodNullable<z.ZodString>;
52
- }, z.core.$strip>>>;
52
+ }, z.core.$strip>>;
53
53
  status: z.ZodEnum<{
54
54
  error: "error";
55
55
  submitted: "submitted";
@@ -64,7 +64,7 @@ export declare const reconciliationRowSchema: z.ZodObject<{
64
64
  skipped: "skipped";
65
65
  }>;
66
66
  trackingUrl: z.ZodNullable<z.ZodString>;
67
- beaconSessionIp: z.ZodDefault<z.ZodNullable<z.ZodString>>;
67
+ beaconSessionIp: z.ZodNullable<z.ZodString>;
68
68
  }, z.core.$strip>;
69
69
  export type ReconciliationRow = z.infer<typeof reconciliationRowSchema>;
70
70
  /**
@@ -95,13 +95,13 @@ export declare const submissionsResponseSchema: z.ZodObject<{
95
95
  submissions: z.ZodArray<z.ZodObject<{
96
96
  siteId: z.ZodString;
97
97
  requestId: z.ZodString;
98
- joinKeys: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
99
- session: z.ZodDefault<z.ZodNullable<z.ZodObject<{
98
+ joinKeys: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
99
+ session: z.ZodNullable<z.ZodObject<{
100
100
  id: z.ZodString;
101
101
  provider: z.ZodString;
102
102
  ip: z.ZodNullable<z.ZodString>;
103
103
  ipCapturedAt: z.ZodNullable<z.ZodString>;
104
- }, z.core.$strip>>>;
104
+ }, z.core.$strip>>;
105
105
  status: z.ZodEnum<{
106
106
  error: "error";
107
107
  submitted: "submitted";
@@ -116,7 +116,7 @@ export declare const submissionsResponseSchema: z.ZodObject<{
116
116
  skipped: "skipped";
117
117
  }>;
118
118
  trackingUrl: z.ZodNullable<z.ZodString>;
119
- beaconSessionIp: z.ZodDefault<z.ZodNullable<z.ZodString>>;
119
+ beaconSessionIp: z.ZodNullable<z.ZodString>;
120
120
  }, z.core.$strip>>;
121
121
  total: z.ZodNumber;
122
122
  }, z.core.$strip>;
@@ -1,16 +1,20 @@
1
1
  import type { AISdkClient } from "@browserbasehq/stagehand";
2
2
  import type { AppConfig } from "../config";
3
- type StagehandModel = ConstructorParameters<typeof AISdkClient>[0]["model"];
3
+ /** AI SDK `LanguageModel` shape Stagehand's `AISdkClient` accepts. */
4
+ export type StagehandModel = ConstructorParameters<typeof AISdkClient>[0]["model"];
4
5
  /**
5
6
  * Builds an AI SDK language model backed by AWS Bedrock for injection into
6
7
  * Stagehand's `llmClient`. Centralises all @ai-sdk/amazon-bedrock imports here
7
8
  * so no other module touches the AWS SDK.
8
9
  *
9
- * Bedrock v4 emits a `LanguageModelV3` (provider spec v3) but Stagehand's
10
- * `AISdkClient` still types its `model` as `LanguageModelV2`. The two specs
11
- * are runtime-compatible for Stagehand's use, so we cast at this single
12
- * boundary rather than letting the version mismatch leak into call sites.
13
- * Remove the cast once Stagehand accepts `LanguageModelV3`.
10
+ * Pinned to the @ai-sdk/amazon-bedrock 3.x line, not the latest 5.x: 5.x
11
+ * emits `LanguageModelV4`, but the `ai` version Stagehand's `AISdkClient`
12
+ * depends on only accepts `specificationVersion: "v2"` and throws
13
+ * `AI_UnsupportedModelVersionError` otherwise. 3.x emits `LanguageModelV2`,
14
+ * matching both Stagehand's dependency and `ai`'s runtime check exactly —
15
+ * the same provider-spec version Stagehand itself pins as an optional
16
+ * dependency. Bump past 3.x only once Stagehand's `ai` dependency accepts
17
+ * newer provider specs.
14
18
  *
15
19
  * When accessKeyId/secretAccessKey are set, uses explicit static credentials.
16
20
  * When omitted, region-only config lets the SDK fall through to its default
@@ -18,5 +22,4 @@ type StagehandModel = ConstructorParameters<typeof AISdkClient>[0]["model"];
18
22
  * instance profile) — correct for IAM-role deployments.
19
23
  */
20
24
  export declare function createBedrockModel(bedrockConfig: AppConfig["bedrock"]): StagehandModel;
21
- export {};
22
25
  //# sourceMappingURL=bedrock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bedrock.d.ts","sourceRoot":"","sources":["../../src/lib/bedrock.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,KAAK,cAAc,GAAG,qBAAqB,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AAE5E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,cAAc,CAgBtF"}
1
+ {"version":3,"file":"bedrock.d.ts","sourceRoot":"","sources":["../../src/lib/bedrock.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,sEAAsE;AACtE,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AAEnF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,cAAc,CAgBtF"}
@@ -7,11 +7,14 @@ const amazon_bedrock_1 = require("@ai-sdk/amazon-bedrock");
7
7
  * Stagehand's `llmClient`. Centralises all @ai-sdk/amazon-bedrock imports here
8
8
  * so no other module touches the AWS SDK.
9
9
  *
10
- * Bedrock v4 emits a `LanguageModelV3` (provider spec v3) but Stagehand's
11
- * `AISdkClient` still types its `model` as `LanguageModelV2`. The two specs
12
- * are runtime-compatible for Stagehand's use, so we cast at this single
13
- * boundary rather than letting the version mismatch leak into call sites.
14
- * Remove the cast once Stagehand accepts `LanguageModelV3`.
10
+ * Pinned to the @ai-sdk/amazon-bedrock 3.x line, not the latest 5.x: 5.x
11
+ * emits `LanguageModelV4`, but the `ai` version Stagehand's `AISdkClient`
12
+ * depends on only accepts `specificationVersion: "v2"` and throws
13
+ * `AI_UnsupportedModelVersionError` otherwise. 3.x emits `LanguageModelV2`,
14
+ * matching both Stagehand's dependency and `ai`'s runtime check exactly —
15
+ * the same provider-spec version Stagehand itself pins as an optional
16
+ * dependency. Bump past 3.x only once Stagehand's `ai` dependency accepts
17
+ * newer provider specs.
15
18
  *
16
19
  * When accessKeyId/secretAccessKey are set, uses explicit static credentials.
17
20
  * When omitted, region-only config lets the SDK fall through to its default
@@ -1 +1 @@
1
- {"version":3,"file":"bedrock.js","sourceRoot":"","sources":["../../src/lib/bedrock.ts"],"names":[],"mappings":";;;AAAA,2DAA6D;AAO7D;;;;;;;;;;;;;;;GAeG;AACH,4BAAmC,aAAmC;IACpE,MAAM,sBAAsB,GAC1B,aAAa,CAAC,WAAW,KAAK,SAAS,IAAI,aAAa,CAAC,eAAe,KAAK,SAAS,CAAC;IAEzF,MAAM,QAAQ,GAAG,IAAA,oCAAmB,EAAC;QACnC,MAAM,EAAE,aAAa,CAAC,MAAM;QAC5B,GAAG,CAAC,sBAAsB;YACxB,CAAC,CAAC;gBACE,WAAW,EAAE,aAAa,CAAC,WAAqB;gBAChD,eAAe,EAAE,aAAa,CAAC,eAAyB;gBACxD,GAAG,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACpF;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,aAAa,CAAC,KAAK,CAA8B,CAAC;AACpE,CAAC"}
1
+ {"version":3,"file":"bedrock.js","sourceRoot":"","sources":["../../src/lib/bedrock.ts"],"names":[],"mappings":";;;AAAA,2DAA6D;AAQ7D;;;;;;;;;;;;;;;;;;GAkBG;AACH,4BAAmC,aAAmC;IACpE,MAAM,sBAAsB,GAC1B,aAAa,CAAC,WAAW,KAAK,SAAS,IAAI,aAAa,CAAC,eAAe,KAAK,SAAS,CAAC;IAEzF,MAAM,QAAQ,GAAG,IAAA,oCAAmB,EAAC;QACnC,MAAM,EAAE,aAAa,CAAC,MAAM;QAC5B,GAAG,CAAC,sBAAsB;YACxB,CAAC,CAAC;gBACE,WAAW,EAAE,aAAa,CAAC,WAAqB;gBAChD,eAAe,EAAE,aAAa,CAAC,eAAyB;gBACxD,GAAG,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACpF;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC"}
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Raises undici's TCP connect timeout from its 10 s hardcoded default.
3
- * Must be called once at process startup in every entry point that makes
4
- * outbound fetch calls (server.ts, scripts, etc.).
2
+ * Raises undici's TCP connect timeout from its 10 s hardcoded default, and
3
+ * patches around a @browserbasehq/sdk header-collision bug the custom
4
+ * dispatcher triggers. Must be called once at process startup in every entry
5
+ * point that makes outbound fetch calls (server.ts, scripts, etc.).
5
6
  */
6
7
  export declare function configureHttpDispatcher(): void;
7
8
  //# sourceMappingURL=http.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/lib/http.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C"}
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/lib/http.ts"],"names":[],"mappings":"AA2BA;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAG9C"}
package/dist/lib/http.js CHANGED
@@ -1,14 +1,36 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.configureHttpDispatcher = configureHttpDispatcher;
7
+ const sdk_1 = __importDefault(require("@browserbasehq/sdk"));
4
8
  const undici_1 = require("undici");
5
9
  const config_1 = require("../config");
6
10
  /**
7
- * Raises undici's TCP connect timeout from its 10 s hardcoded default.
8
- * Must be called once at process startup in every entry point that makes
9
- * outbound fetch calls (server.ts, scripts, etc.).
11
+ * @browserbasehq/sdk sets an explicit `content-length` header, then hands the
12
+ * request to Node's native fetch. Under the custom global dispatcher installed
13
+ * below, undici's Request constructor folds that caller-supplied header
14
+ * together with its own computed one into a comma-joined value (e.g.
15
+ * "52, 52"), which fails undici's digit-only validation with
16
+ * `InvalidArgumentError: invalid content-length header`. Dropping the SDK's
17
+ * explicit header lets undici compute it once, itself.
18
+ */
19
+ function patchBrowserbaseContentLengthHeader() {
20
+ const apiClientPrototype = Object.getPrototypeOf(sdk_1.default.prototype);
21
+ const originalBuildHeaders = apiClientPrototype.buildHeaders;
22
+ apiClientPrototype.buildHeaders = function (args) {
23
+ return originalBuildHeaders.call(this, { ...args, contentLength: null });
24
+ };
25
+ }
26
+ /**
27
+ * Raises undici's TCP connect timeout from its 10 s hardcoded default, and
28
+ * patches around a @browserbasehq/sdk header-collision bug the custom
29
+ * dispatcher triggers. Must be called once at process startup in every entry
30
+ * point that makes outbound fetch calls (server.ts, scripts, etc.).
10
31
  */
11
32
  function configureHttpDispatcher() {
12
33
  (0, undici_1.setGlobalDispatcher)(new undici_1.Agent({ connect: { timeout: config_1.config.scraper.connectTimeoutMs } }));
34
+ patchBrowserbaseContentLengthHeader();
13
35
  }
14
36
  //# sourceMappingURL=http.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/lib/http.ts"],"names":[],"mappings":";;;AAAA,mCAAoD;AAEpD,qCAAkC;AAElC;;;;GAIG;AACH;IACE,IAAA,4BAAmB,EAAC,IAAI,cAAK,CAAC,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,eAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC,CAAC;AAC5F,CAAC"}
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/lib/http.ts"],"names":[],"mappings":";;;;;;AAAA,6DAA6C;AAC7C,mCAAoD;AAEpD,qCAAkC;AAElC;;;;;;;;GAQG;AACH,SAAS,mCAAmC;IAC1C,MAAM,kBAAkB,GAAG,MAAM,CAAC,cAAc,CAAC,aAAW,CAAC,SAAS,CAErE,CAAC;IACF,MAAM,oBAAoB,GAAG,kBAAkB,CAAC,YAAY,CAAC;IAC7D,kBAAkB,CAAC,YAAY,GAAG,UAEhC,IAA6B;QAE7B,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3E,CAAC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH;IACE,IAAA,4BAAmB,EAAC,IAAI,cAAK,CAAC,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,eAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC,CAAC;IAC1F,mCAAmC,EAAE,CAAC;AACxC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import Anthropic from "@anthropic-ai/sdk";
2
+ import { type StagehandModel } from "../../lib/bedrock";
2
3
  /**
3
4
  * Build the shared Anthropic client used by the self-heal cascade's LLM
4
5
  * techniques (attempt-5 rephrase, replan, judges). Returns `null` on a
@@ -9,4 +10,15 @@ import Anthropic from "@anthropic-ai/sdk";
9
10
  * the same way rather than each duplicating the env/Bedrock gate.
10
11
  */
11
12
  export declare function buildAnthropicClient(): Anthropic | null;
13
+ /**
14
+ * Build the provider-agnostic ai-SDK model used by `rephraseWithLLM`'s
15
+ * attempt-5 structured-output call. Unlike {@link buildAnthropicClient},
16
+ * this never returns `null` on a Bedrock-only deployment — it resolves to
17
+ * the Bedrock-backed model (same as the primary act/observe path via
18
+ * `createBedrockModel`) instead of degrading, so Bedrock-only deployments
19
+ * get the same rephrase tier Anthropic-direct deployments already have.
20
+ * Returns `null` only when neither Bedrock nor a direct Anthropic key is
21
+ * configured at all.
22
+ */
23
+ export declare function buildRephraseModel(): StagehandModel | null;
12
24
  //# sourceMappingURL=anthropic-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic-client.d.ts","sourceRoot":"","sources":["../../../src/lib/llm/anthropic-client.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAI1C;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,IAAI,SAAS,GAAG,IAAI,CAGvD"}
1
+ {"version":3,"file":"anthropic-client.d.ts","sourceRoot":"","sources":["../../../src/lib/llm/anthropic-client.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAG1C,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAExE;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,IAAI,SAAS,GAAG,IAAI,CAGvD;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,GAAG,IAAI,CAS1D"}
@@ -4,8 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.buildAnthropicClient = buildAnthropicClient;
7
+ exports.buildRephraseModel = buildRephraseModel;
8
+ const anthropic_1 = require("@ai-sdk/anthropic");
7
9
  const sdk_1 = __importDefault(require("@anthropic-ai/sdk"));
8
10
  const config_1 = require("../../config");
11
+ const bedrock_1 = require("../../lib/bedrock");
9
12
  /**
10
13
  * Build the shared Anthropic client used by the self-heal cascade's LLM
11
14
  * techniques (attempt-5 rephrase, replan, judges). Returns `null` on a
@@ -20,4 +23,26 @@ function buildAnthropicClient() {
20
23
  return null;
21
24
  return new sdk_1.default({ apiKey: config_1.config.scraper.anthropicApiKey });
22
25
  }
26
+ /**
27
+ * Build the provider-agnostic ai-SDK model used by `rephraseWithLLM`'s
28
+ * attempt-5 structured-output call. Unlike {@link buildAnthropicClient},
29
+ * this never returns `null` on a Bedrock-only deployment — it resolves to
30
+ * the Bedrock-backed model (same as the primary act/observe path via
31
+ * `createBedrockModel`) instead of degrading, so Bedrock-only deployments
32
+ * get the same rephrase tier Anthropic-direct deployments already have.
33
+ * Returns `null` only when neither Bedrock nor a direct Anthropic key is
34
+ * configured at all.
35
+ */
36
+ function buildRephraseModel() {
37
+ if (config_1.config.scraper.useBedrock)
38
+ return (0, bedrock_1.createBedrockModel)(config_1.config.bedrock);
39
+ if (!config_1.config.scraper.anthropicApiKey)
40
+ return null;
41
+ const provider = (0, anthropic_1.createAnthropic)({ apiKey: config_1.config.scraper.anthropicApiKey });
42
+ const rawModel = config_1.config.scraper.model;
43
+ const modelId = rawModel.startsWith("anthropic/")
44
+ ? rawModel.slice("anthropic/".length)
45
+ : rawModel;
46
+ return provider.languageModel(modelId);
47
+ }
23
48
  //# sourceMappingURL=anthropic-client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic-client.js","sourceRoot":"","sources":["../../../src/lib/llm/anthropic-client.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA0C;AAE1C,qCAAkC;AAElC;;;;;;;;GAQG;AACH;IACE,IAAI,eAAM,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,eAAM,CAAC,OAAO,CAAC,eAAe;QAAE,OAAO,IAAI,CAAC;IAC9E,OAAO,IAAI,aAAS,CAAC,EAAE,MAAM,EAAE,eAAM,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;AACnE,CAAC"}
1
+ {"version":3,"file":"anthropic-client.js","sourceRoot":"","sources":["../../../src/lib/llm/anthropic-client.ts"],"names":[],"mappings":";;;;;;;AAAA,iDAAoD;AACpD,4DAA0C;AAE1C,qCAAkC;AAClC,2CAAwE;AAExE;;;;;;;;GAQG;AACH;IACE,IAAI,eAAM,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,eAAM,CAAC,OAAO,CAAC,eAAe;QAAE,OAAO,IAAI,CAAC;IAC9E,OAAO,IAAI,aAAS,CAAC,EAAE,MAAM,EAAE,eAAM,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;AACnE,CAAC;AAED;;;;;;;;;GASG;AACH;IACE,IAAI,eAAM,CAAC,OAAO,CAAC,UAAU;QAAE,OAAO,IAAA,4BAAkB,EAAC,eAAM,CAAC,OAAO,CAAC,CAAC;IACzE,IAAI,CAAC,eAAM,CAAC,OAAO,CAAC,eAAe;QAAE,OAAO,IAAI,CAAC;IACjD,MAAM,QAAQ,GAAG,IAAA,2BAAe,EAAC,EAAE,MAAM,EAAE,eAAM,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAC7E,MAAM,QAAQ,GAAG,eAAM,CAAC,OAAO,CAAC,KAAK,CAAC;IACtC,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC;QAC/C,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC;QACrC,CAAC,CAAC,QAAQ,CAAC;IACb,OAAO,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC"}
@@ -22,9 +22,10 @@ import type { beaconEventSchema } from "../../lib/telemetry/reconciliation-recor
22
22
  export type BeaconEventSample = z.infer<typeof beaconEventSchema>;
23
23
  /**
24
24
  * Input to `captureBeaconEvent` — `ts` and `kind` are derived internally so
25
- * callers omit them. `sessionIp` is optional so existing call sites that
26
- * don't yet resolve it keep compiling unchanged; an omitted value is
27
- * persisted as `null`, not left undefined.
25
+ * callers omit them. `sessionIp` is optional because a plugin-managed beacon
26
+ * outcome (`createBeaconOutcomeRecorder`) has no engine-owned tracking-click
27
+ * session to report an IP for; an omitted value is persisted as `null`, not
28
+ * left undefined.
28
29
  */
29
30
  export type BeaconEventInput = Omit<BeaconEventSample, "ts" | "kind" | "sessionIp"> & {
30
31
  sessionIp?: BeaconEventSample["sessionIp"];
@@ -1 +1 @@
1
- {"version":3,"file":"beacon-capture.d.ts","sourceRoot":"","sources":["../../../src/lib/telemetry/beacon-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAO/E,kDAAkD;AAClD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,EAAE,IAAI,GAAG,MAAM,GAAG,WAAW,CAAC,GAAG;IACpF,SAAS,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAC5C,CAAC;AAEF,wCAAwC;AACxC,MAAM,WAAW,yBAAyB;IACxC,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,gBAAgB,EACvB,IAAI,GAAE,yBAA8B,GACnC,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED,0GAA0G;AAC1G,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,OAAO,CAAC,gBAAgB,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC;IAC5E,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,gBAAgB,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;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,KAAK,CAAC,gDAAgD,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC9E,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -14,24 +14,11 @@
14
14
  * mutation of the submit line. A reader folds the two kinds together by
15
15
  * `requestId` to reconstruct one reconciliation record per run.
16
16
  *
17
- * `kind` defaults to `"submit"` because `.barnacle/submissions.ndjson`
18
- * already holds historical unkinded lines that `s3-sink.ts` has shipped to
19
- * S3 — a required `kind` would make every one of those lines unparseable.
20
- *
21
- * `reconciliationRecordSchema`'s preprocess step also folds a legacy
22
- * top-level `vivclid`/`jobReference` shape into `joinKeys`: before the
23
- * opaque `joinKeys` bag existed, those two fields were persisted as named
24
- * top-level keys, and a plain `z.object()` silently drops unrecognized
25
- * keys — reading an old line through the new schema would otherwise lose
26
- * its join keys rather than surface them.
27
- *
28
17
  * `session` (on `submitRecordSchema`) and `sessionIp` (on `beaconEventSchema`)
29
18
  * carry the Browserbase session's identity and outbound IP so it's durable
30
19
  * per-run telemetry rather than only a log line — every plugin acquires its
31
20
  * session the same engine-owned way, so this lands here rather than
32
- * per-plugin. Both are nullable-with-default for the same reason `joinKeys`
33
- * is: millions of already-shipped NDJSON lines (and their S3 mirror) never
34
- * carried these fields and must keep parsing.
21
+ * per-plugin.
35
22
  */
36
23
  import { z } from "zod/v4";
37
24
  /**
@@ -50,20 +37,19 @@ export declare const sessionTelemetrySchema: z.ZodObject<{
50
37
  export type SessionTelemetry = z.infer<typeof sessionTelemetrySchema>;
51
38
  /**
52
39
  * Submit-side record: the existing submission envelope shape plus an opaque
53
- * `joinKeys` bag. Nullable-with-default so pre-existing lines that never
54
- * carried this field still parse.
40
+ * `joinKeys` bag.
55
41
  */
56
42
  export declare const submitRecordSchema: z.ZodObject<{
57
- kind: z.ZodDefault<z.ZodLiteral<"submit">>;
43
+ kind: z.ZodLiteral<"submit">;
58
44
  siteId: z.ZodString;
59
45
  requestId: z.ZodString;
60
- joinKeys: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
61
- session: z.ZodDefault<z.ZodNullable<z.ZodObject<{
46
+ joinKeys: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
47
+ session: z.ZodNullable<z.ZodObject<{
62
48
  id: z.ZodString;
63
49
  provider: z.ZodString;
64
50
  ip: z.ZodNullable<z.ZodString>;
65
51
  ipCapturedAt: z.ZodNullable<z.ZodString>;
66
- }, z.core.$strip>>>;
52
+ }, z.core.$strip>>;
67
53
  inboundPayload: z.ZodUnknown;
68
54
  status: z.ZodEnum<{
69
55
  error: "error";
@@ -103,28 +89,24 @@ export declare const beaconEventSchema: z.ZodObject<{
103
89
  trackingUrl: z.ZodNullable<z.ZodString>;
104
90
  durationMs: z.ZodNumber;
105
91
  ts: z.ZodString;
106
- sessionIp: z.ZodDefault<z.ZodNullable<z.ZodString>>;
92
+ sessionIp: z.ZodNullable<z.ZodString>;
107
93
  }, z.core.$strip>;
108
94
  export type BeaconEvent = z.infer<typeof beaconEventSchema>;
109
95
  /**
110
96
  * Routes an NDJSON line to `submitRecordSchema` or `beaconEventSchema` by
111
- * `kind`. Injects `kind: "submit"` ahead of the discriminated union when the
112
- * field is absent, because `z.discriminatedUnion` reads the raw input's
113
- * discriminant directly and won't fall back to a member schema's default —
114
- * confirmed against zod/v4 3.25.76. Also folds a legacy vivclid/jobReference
115
- * shape into `joinKeys` (see `withLegacyJoinKeys`) before the union runs.
97
+ * `kind`.
116
98
  */
117
- export declare const reconciliationRecordSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodDiscriminatedUnion<[z.ZodObject<{
118
- kind: z.ZodDefault<z.ZodLiteral<"submit">>;
99
+ export declare const reconciliationRecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
100
+ kind: z.ZodLiteral<"submit">;
119
101
  siteId: z.ZodString;
120
102
  requestId: z.ZodString;
121
- joinKeys: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
122
- session: z.ZodDefault<z.ZodNullable<z.ZodObject<{
103
+ joinKeys: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
104
+ session: z.ZodNullable<z.ZodObject<{
123
105
  id: z.ZodString;
124
106
  provider: z.ZodString;
125
107
  ip: z.ZodNullable<z.ZodString>;
126
108
  ipCapturedAt: z.ZodNullable<z.ZodString>;
127
- }, z.core.$strip>>>;
109
+ }, z.core.$strip>>;
128
110
  inboundPayload: z.ZodUnknown;
129
111
  status: z.ZodEnum<{
130
112
  error: "error";
@@ -147,7 +129,7 @@ export declare const reconciliationRecordSchema: z.ZodPipe<z.ZodTransform<unknow
147
129
  trackingUrl: z.ZodNullable<z.ZodString>;
148
130
  durationMs: z.ZodNumber;
149
131
  ts: z.ZodString;
150
- sessionIp: z.ZodDefault<z.ZodNullable<z.ZodString>>;
151
- }, z.core.$strip>]>>;
132
+ sessionIp: z.ZodNullable<z.ZodString>;
133
+ }, z.core.$strip>]>;
152
134
  export type ReconciliationRecord = z.infer<typeof reconciliationRecordSchema>;
153
135
  //# sourceMappingURL=reconciliation-record.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reconciliation-record.d.ts","sourceRoot":"","sources":["../../../src/lib/telemetry/reconciliation-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB;;;;;iBAKjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;iBAY7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,C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 +15,11 @@
15
15
  * mutation of the submit line. A reader folds the two kinds together by
16
16
  * `requestId` to reconstruct one reconciliation record per run.
17
17
  *
18
- * `kind` defaults to `"submit"` because `.barnacle/submissions.ndjson`
19
- * already holds historical unkinded lines that `s3-sink.ts` has shipped to
20
- * S3 — a required `kind` would make every one of those lines unparseable.
21
- *
22
- * `reconciliationRecordSchema`'s preprocess step also folds a legacy
23
- * top-level `vivclid`/`jobReference` shape into `joinKeys`: before the
24
- * opaque `joinKeys` bag existed, those two fields were persisted as named
25
- * top-level keys, and a plain `z.object()` silently drops unrecognized
26
- * keys — reading an old line through the new schema would otherwise lose
27
- * its join keys rather than surface them.
28
- *
29
18
  * `session` (on `submitRecordSchema`) and `sessionIp` (on `beaconEventSchema`)
30
19
  * carry the Browserbase session's identity and outbound IP so it's durable
31
20
  * per-run telemetry rather than only a log line — every plugin acquires its
32
21
  * session the same engine-owned way, so this lands here rather than
33
- * per-plugin. Both are nullable-with-default for the same reason `joinKeys`
34
- * is: millions of already-shipped NDJSON lines (and their S3 mirror) never
35
- * carried these fields and must keep parsing.
22
+ * per-plugin.
36
23
  */
37
24
  Object.defineProperty(exports, "__esModule", { value: true });
38
25
  exports.reconciliationRecordSchema = exports.beaconEventSchema = exports.submitRecordSchema = exports.sessionTelemetrySchema = void 0;
@@ -52,15 +39,14 @@ exports.sessionTelemetrySchema = v4_1.z.object({
52
39
  });
53
40
  /**
54
41
  * Submit-side record: the existing submission envelope shape plus an opaque
55
- * `joinKeys` bag. Nullable-with-default so pre-existing lines that never
56
- * carried this field still parse.
42
+ * `joinKeys` bag.
57
43
  */
58
44
  exports.submitRecordSchema = v4_1.z.object({
59
- kind: v4_1.z.literal("submit").default("submit"),
45
+ kind: v4_1.z.literal("submit"),
60
46
  siteId: v4_1.z.string(),
61
47
  requestId: v4_1.z.string(),
62
- joinKeys: v4_1.z.record(v4_1.z.string(), v4_1.z.unknown()).nullable().default(null),
63
- session: exports.sessionTelemetrySchema.nullable().default(null),
48
+ joinKeys: v4_1.z.record(v4_1.z.string(), v4_1.z.unknown()).nullable(),
49
+ session: exports.sessionTelemetrySchema.nullable(),
64
50
  inboundPayload: v4_1.z.unknown(),
65
51
  status: v4_1.z.enum(["submitted", "error"]),
66
52
  auditPayload: v4_1.z.unknown(),
@@ -92,38 +78,14 @@ exports.beaconEventSchema = v4_1.z.object({
92
78
  trackingUrl: v4_1.z.string().nullable(),
93
79
  durationMs: v4_1.z.number(),
94
80
  ts: v4_1.z.string(),
95
- sessionIp: v4_1.z.string().nullable().default(null),
81
+ sessionIp: v4_1.z.string().nullable(),
96
82
  });
97
- /**
98
- * Folds a legacy top-level `vivclid`/`jobReference` shape into `joinKeys`
99
- * for a line that doesn't already carry `joinKeys`, so historical lines
100
- * from before the opaque `joinKeys` bag existed still surface their join
101
- * keys instead of silently losing them to `z.object()`'s unrecognized-key
102
- * drop. Only synthesizes a non-null bag when a legacy field was actually
103
- * present, so lines with neither (e.g. sites that never had these fields)
104
- * still fall through to `joinKeys`'s own `.default(null)`.
105
- */
106
- function withLegacyJoinKeys(value) {
107
- if ("joinKeys" in value)
108
- return value;
109
- const { vivclid, jobReference, ...rest } = value;
110
- const legacyJoinKeys = vivclid || jobReference
111
- ? { vivclid: vivclid ?? null, jobReference: jobReference ?? null }
112
- : null;
113
- return { ...rest, joinKeys: legacyJoinKeys };
114
- }
115
83
  /**
116
84
  * Routes an NDJSON line to `submitRecordSchema` or `beaconEventSchema` by
117
- * `kind`. Injects `kind: "submit"` ahead of the discriminated union when the
118
- * field is absent, because `z.discriminatedUnion` reads the raw input's
119
- * discriminant directly and won't fall back to a member schema's default —
120
- * confirmed against zod/v4 3.25.76. Also folds a legacy vivclid/jobReference
121
- * shape into `joinKeys` (see `withLegacyJoinKeys`) before the union runs.
85
+ * `kind`.
122
86
  */
123
- exports.reconciliationRecordSchema = v4_1.z.preprocess((value) => {
124
- if (typeof value !== "object" || value === null)
125
- return value;
126
- const withKind = "kind" in value ? value : { ...value, kind: "submit" };
127
- return withLegacyJoinKeys(withKind);
128
- }, v4_1.z.discriminatedUnion("kind", [exports.submitRecordSchema, exports.beaconEventSchema]));
87
+ exports.reconciliationRecordSchema = v4_1.z.discriminatedUnion("kind", [
88
+ exports.submitRecordSchema,
89
+ exports.beaconEventSchema,
90
+ ]);
129
91
  //# sourceMappingURL=reconciliation-record.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reconciliation-record.js","sourceRoot":"","sources":["../../../src/lib/telemetry/reconciliation-record.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;;;AAEH,+BAA2B;AAE3B;;;;;;GAMG;AACU,QAAA,sBAAsB,GAAG,MAAC,CAAC,MAAM,CAAC;IAC7C,EAAE,EAAE,MAAC,CAAC,MAAM,EAAE;IACd,QAAQ,EAAE,MAAC,CAAC,MAAM,EAAE;IACpB,EAAE,EAAE,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzB,YAAY,EAAE,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC;AAIH;;;;GAIG;AACU,QAAA,kBAAkB,GAAG,MAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,MAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC3C,MAAM,EAAE,MAAC,CAAC,MAAM,EAAE;IAClB,SAAS,EAAE,MAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,MAAC,CAAC,MAAM,CAAC,MAAC,CAAC,MAAM,EAAE,EAAE,MAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACpE,OAAO,EAAE,QAAA,sBAAsB,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACxD,cAAc,EAAE,MAAC,CAAC,OAAO,EAAE;IAC3B,MAAM,EAAE,MAAC,CAAC,IAAI,C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AC,kBAAkB,CAAC,MAAM,EAAE;IACrE,QAAA,kBAAkB;IAClB,QAAA,iBAAiB;CAClB,CAAC,CAAC"}
@@ -16,20 +16,20 @@ import type { z } from "zod/v4";
16
16
  * Validated shape of one submission envelope sample. Alias of
17
17
  * `submitRecordSchema` (feat-002) kept under its original export name so the
18
18
  * five existing test files that import it are unaffected — the reconciliation
19
- * schema is a strict superset (adds `kind`, `joinKeys`, both defaulted) of
20
- * the shape this module used to define standalone.
19
+ * schema is a strict superset (adds `kind`, `joinKeys`, `session`) of the
20
+ * shape this module used to define standalone.
21
21
  */
22
22
  export declare const submissionEnvelopeSampleSchema: z.ZodObject<{
23
- kind: z.ZodDefault<z.ZodLiteral<"submit">>;
23
+ kind: z.ZodLiteral<"submit">;
24
24
  siteId: z.ZodString;
25
25
  requestId: z.ZodString;
26
- joinKeys: z.ZodDefault<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
27
- session: z.ZodDefault<z.ZodNullable<z.ZodObject<{
26
+ joinKeys: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
27
+ session: z.ZodNullable<z.ZodObject<{
28
28
  id: z.ZodString;
29
29
  provider: z.ZodString;
30
30
  ip: z.ZodNullable<z.ZodString>;
31
31
  ipCapturedAt: z.ZodNullable<z.ZodString>;
32
- }, z.core.$strip>>>;
32
+ }, z.core.$strip>>;
33
33
  inboundPayload: z.ZodUnknown;
34
34
  status: z.ZodEnum<{
35
35
  error: "error";
@@ -43,14 +43,9 @@ export declare const submissionEnvelopeSampleSchema: z.ZodObject<{
43
43
  export type SubmissionEnvelopeSample = z.infer<typeof submissionEnvelopeSampleSchema>;
44
44
  /**
45
45
  * Input to `captureSubmissionEnvelope` — `ts` and `kind` are derived
46
- * internally so callers omit them. `joinKeys`/`session` are optional so
47
- * existing call sites that don't yet resolve them keep compiling unchanged;
48
- * an omitted value is persisted as `null`, not left undefined.
46
+ * internally so callers omit them.
49
47
  */
50
- export type SubmissionEnvelopeInput = Omit<SubmissionEnvelopeSample, "ts" | "kind" | "joinKeys" | "session"> & {
51
- joinKeys?: Record<string, unknown> | null;
52
- session?: SubmissionEnvelopeSample["session"];
53
- };
48
+ export type SubmissionEnvelopeInput = Omit<SubmissionEnvelopeSample, "ts" | "kind">;
54
49
  /** Options for `captureSubmissionEnvelope`. */
55
50
  export interface CaptureSubmissionOptions {
56
51
  /** Override the sink path; used in tests to avoid touching the real file. */
@@ -1 +1 @@
1
- {"version":3,"file":"submission-capture.d.ts","sourceRoot":"","sources":["../../../src/lib/telemetry/submission-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAShC;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;iBAAqB,CAAC;AAEjE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,wBAAwB,EACxB,IAAI,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CACvC,GAAG;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC1C,OAAO,CAAC,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAC;CAC/C,CAAC;AAEF,+CAA+C;AAC/C,MAAM,WAAW,wBAAwB;IACvC,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI5F;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,uBAAuB,EAC9B,IAAI,GAAE,wBAA6B,GAClC,OAAO,CAAC,IAAI,CAAC,CAgBf"}
1
+ {"version":3,"file":"submission-capture.d.ts","sourceRoot":"","sources":["../../../src/lib/telemetry/submission-capture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAShC;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;iBAAqB,CAAC;AAEjE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,wBAAwB,EAAE,IAAI,GAAG,MAAM,CAAC,CAAC;AAEpF,+CAA+C;AAC/C,MAAM,WAAW,wBAAwB;IACvC,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI5F;AAED;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,uBAAuB,EAC9B,IAAI,GAAE,wBAA6B,GAClC,OAAO,CAAC,IAAI,CAAC,CAcf"}
@@ -28,8 +28,8 @@ const logger = (0, logging_1.getLogger)({ name: "telemetry/submission-capture" }
28
28
  * Validated shape of one submission envelope sample. Alias of
29
29
  * `submitRecordSchema` (feat-002) kept under its original export name so the
30
30
  * five existing test files that import it are unaffected — the reconciliation
31
- * schema is a strict superset (adds `kind`, `joinKeys`, both defaulted) of
32
- * the shape this module used to define standalone.
31
+ * schema is a strict superset (adds `kind`, `joinKeys`, `session`) of the
32
+ * shape this module used to define standalone.
33
33
  */
34
34
  exports.submissionEnvelopeSampleSchema = reconciliation_record_1.submitRecordSchema;
35
35
  /**
@@ -54,8 +54,6 @@ async function captureSubmissionEnvelope(input, opts = {}) {
54
54
  const sample = {
55
55
  ...input,
56
56
  kind: "submit",
57
- joinKeys: input.joinKeys ?? null,
58
- session: input.session ?? null,
59
57
  ts: (0, date_fns_1.formatISO)(new Date()),
60
58
  };
61
59
  try {