@enricai/barnacle 1.0.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/LICENSE +21 -0
- package/README.md +958 -0
- package/dist/api/errors.d.ts +88 -0
- package/dist/api/errors.d.ts.map +1 -0
- package/dist/api/errors.js +164 -0
- package/dist/api/errors.js.map +1 -0
- package/dist/api/helpers/envelope.d.ts +13 -0
- package/dist/api/helpers/envelope.d.ts.map +1 -0
- package/dist/api/helpers/envelope.js +20 -0
- package/dist/api/helpers/envelope.js.map +1 -0
- package/dist/api/helpers/reply.d.ts +9 -0
- package/dist/api/helpers/reply.d.ts.map +1 -0
- package/dist/api/helpers/reply.js +14 -0
- package/dist/api/helpers/reply.js.map +1 -0
- package/dist/api/plugins/auth.d.ts +27 -0
- package/dist/api/plugins/auth.d.ts.map +1 -0
- package/dist/api/plugins/auth.js +111 -0
- package/dist/api/plugins/auth.js.map +1 -0
- package/dist/api/plugins/error-handler.d.ts +12 -0
- package/dist/api/plugins/error-handler.d.ts.map +1 -0
- package/dist/api/plugins/error-handler.js +72 -0
- package/dist/api/plugins/error-handler.js.map +1 -0
- package/dist/api/plugins/request-context.d.ts +17 -0
- package/dist/api/plugins/request-context.d.ts.map +1 -0
- package/dist/api/plugins/request-context.js +61 -0
- package/dist/api/plugins/request-context.js.map +1 -0
- package/dist/api/routes/health.d.ts +55 -0
- package/dist/api/routes/health.d.ts.map +1 -0
- package/dist/api/routes/health.js +137 -0
- package/dist/api/routes/health.js.map +1 -0
- package/dist/api/routes/plugins-introspection.d.ts +17 -0
- package/dist/api/routes/plugins-introspection.d.ts.map +1 -0
- package/dist/api/routes/plugins-introspection.js +13 -0
- package/dist/api/routes/plugins-introspection.js.map +1 -0
- package/dist/api/schemas/common.d.ts +114 -0
- package/dist/api/schemas/common.d.ts.map +1 -0
- package/dist/api/schemas/common.js +109 -0
- package/dist/api/schemas/common.js.map +1 -0
- package/dist/api/schemas/telemetry.d.ts +66 -0
- package/dist/api/schemas/telemetry.d.ts.map +1 -0
- package/dist/api/schemas/telemetry.js +52 -0
- package/dist/api/schemas/telemetry.js.map +1 -0
- package/dist/cache/keyed-ttl-cache.d.ts +45 -0
- package/dist/cache/keyed-ttl-cache.d.ts.map +1 -0
- package/dist/cache/keyed-ttl-cache.js +69 -0
- package/dist/cache/keyed-ttl-cache.js.map +1 -0
- package/dist/cache/response-cache.d.ts +37 -0
- package/dist/cache/response-cache.d.ts.map +1 -0
- package/dist/cache/response-cache.js +114 -0
- package/dist/cache/response-cache.js.map +1 -0
- package/dist/config.d.ts +258 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +138 -0
- package/dist/config.js.map +1 -0
- package/dist/lib/applicant-payload.d.ts +28 -0
- package/dist/lib/applicant-payload.d.ts.map +1 -0
- package/dist/lib/applicant-payload.js +20 -0
- package/dist/lib/applicant-payload.js.map +1 -0
- package/dist/lib/application-address.d.ts +16 -0
- package/dist/lib/application-address.d.ts.map +1 -0
- package/dist/lib/application-address.js +20 -0
- package/dist/lib/application-address.js.map +1 -0
- package/dist/lib/application-answers.d.ts +151 -0
- package/dist/lib/application-answers.d.ts.map +1 -0
- package/dist/lib/application-answers.js +95 -0
- package/dist/lib/application-answers.js.map +1 -0
- package/dist/lib/application-identity.d.ts +18 -0
- package/dist/lib/application-identity.d.ts.map +1 -0
- package/dist/lib/application-identity.js +20 -0
- package/dist/lib/application-identity.js.map +1 -0
- package/dist/lib/application-resume.d.ts +21 -0
- package/dist/lib/application-resume.d.ts.map +1 -0
- package/dist/lib/application-resume.js +23 -0
- package/dist/lib/application-resume.js.map +1 -0
- package/dist/lib/bedrock.d.ts +22 -0
- package/dist/lib/bedrock.d.ts.map +1 -0
- package/dist/lib/bedrock.js +35 -0
- package/dist/lib/bedrock.js.map +1 -0
- package/dist/lib/case-insensitive-headers.d.ts +15 -0
- package/dist/lib/case-insensitive-headers.d.ts.map +1 -0
- package/dist/lib/case-insensitive-headers.js +29 -0
- package/dist/lib/case-insensitive-headers.js.map +1 -0
- package/dist/lib/chromium-client-hints.d.ts +11 -0
- package/dist/lib/chromium-client-hints.d.ts.map +1 -0
- package/dist/lib/chromium-client-hints.js +17 -0
- package/dist/lib/chromium-client-hints.js.map +1 -0
- package/dist/lib/cookie-value.d.ts +8 -0
- package/dist/lib/cookie-value.d.ts.map +1 -0
- package/dist/lib/cookie-value.js +14 -0
- package/dist/lib/cookie-value.js.map +1 -0
- package/dist/lib/datadog.d.ts +8 -0
- package/dist/lib/datadog.d.ts.map +1 -0
- package/dist/lib/datadog.js +27 -0
- package/dist/lib/datadog.js.map +1 -0
- package/dist/lib/dd-metrics.d.ts +28 -0
- package/dist/lib/dd-metrics.d.ts.map +1 -0
- package/dist/lib/dd-metrics.js +62 -0
- package/dist/lib/dd-metrics.js.map +1 -0
- package/dist/lib/dispatch-metrics.d.ts +19 -0
- package/dist/lib/dispatch-metrics.d.ts.map +1 -0
- package/dist/lib/dispatch-metrics.js +65 -0
- package/dist/lib/dispatch-metrics.js.map +1 -0
- package/dist/lib/env.d.ts +37 -0
- package/dist/lib/env.d.ts.map +1 -0
- package/dist/lib/env.js +70 -0
- package/dist/lib/env.js.map +1 -0
- package/dist/lib/errors.d.ts +15 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +20 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/http.d.ts +7 -0
- package/dist/lib/http.d.ts.map +1 -0
- package/dist/lib/http.js +14 -0
- package/dist/lib/http.js.map +1 -0
- package/dist/lib/job-tracking.d.ts +17 -0
- package/dist/lib/job-tracking.d.ts.map +1 -0
- package/dist/lib/job-tracking.js +19 -0
- package/dist/lib/job-tracking.js.map +1 -0
- package/dist/lib/llm/anthropic-client.d.ts +12 -0
- package/dist/lib/llm/anthropic-client.d.ts.map +1 -0
- package/dist/lib/llm/anthropic-client.js +23 -0
- package/dist/lib/llm/anthropic-client.js.map +1 -0
- package/dist/lib/llm/judge.d.ts +57 -0
- package/dist/lib/llm/judge.d.ts.map +1 -0
- package/dist/lib/llm/judge.js +123 -0
- package/dist/lib/llm/judge.js.map +1 -0
- package/dist/lib/llm/judges/error-messages.d.ts +38 -0
- package/dist/lib/llm/judges/error-messages.d.ts.map +1 -0
- package/dist/lib/llm/judges/error-messages.js +72 -0
- package/dist/lib/llm/judges/error-messages.js.map +1 -0
- package/dist/lib/llm/judges/invalid-fields.d.ts +43 -0
- package/dist/lib/llm/judges/invalid-fields.d.ts.map +1 -0
- package/dist/lib/llm/judges/invalid-fields.js +80 -0
- package/dist/lib/llm/judges/invalid-fields.js.map +1 -0
- package/dist/lib/llm/judges/modal-priority.d.ts +41 -0
- package/dist/lib/llm/judges/modal-priority.d.ts.map +1 -0
- package/dist/lib/llm/judges/modal-priority.js +74 -0
- package/dist/lib/llm/judges/modal-priority.js.map +1 -0
- package/dist/lib/llm/judges/select-option.d.ts +49 -0
- package/dist/lib/llm/judges/select-option.d.ts.map +1 -0
- package/dist/lib/llm/judges/select-option.js +90 -0
- package/dist/lib/llm/judges/select-option.js.map +1 -0
- package/dist/lib/llm/judges/verify-submit.d.ts +68 -0
- package/dist/lib/llm/judges/verify-submit.d.ts.map +1 -0
- package/dist/lib/llm/judges/verify-submit.js +89 -0
- package/dist/lib/llm/judges/verify-submit.js.map +1 -0
- package/dist/lib/llm/schemas.d.ts +220 -0
- package/dist/lib/llm/schemas.d.ts.map +1 -0
- package/dist/lib/llm/schemas.js +239 -0
- package/dist/lib/llm/schemas.js.map +1 -0
- package/dist/lib/logging.d.ts +39 -0
- package/dist/lib/logging.d.ts.map +1 -0
- package/dist/lib/logging.js +219 -0
- package/dist/lib/logging.js.map +1 -0
- package/dist/lib/multipart.d.ts +34 -0
- package/dist/lib/multipart.d.ts.map +1 -0
- package/dist/lib/multipart.js +55 -0
- package/dist/lib/multipart.js.map +1 -0
- package/dist/lib/option-matcher.d.ts +15 -0
- package/dist/lib/option-matcher.d.ts.map +1 -0
- package/dist/lib/option-matcher.js +69 -0
- package/dist/lib/option-matcher.js.map +1 -0
- package/dist/lib/phone.d.ts +11 -0
- package/dist/lib/phone.d.ts.map +1 -0
- package/dist/lib/phone.js +17 -0
- package/dist/lib/phone.js.map +1 -0
- package/dist/lib/random.d.ts +22 -0
- package/dist/lib/random.d.ts.map +1 -0
- package/dist/lib/random.js +33 -0
- package/dist/lib/random.js.map +1 -0
- package/dist/lib/statsd.d.ts +11 -0
- package/dist/lib/statsd.d.ts.map +1 -0
- package/dist/lib/statsd.js +68 -0
- package/dist/lib/statsd.js.map +1 -0
- package/dist/lib/telemetry/call-capture.d.ts +89 -0
- package/dist/lib/telemetry/call-capture.d.ts.map +1 -0
- package/dist/lib/telemetry/call-capture.js +190 -0
- package/dist/lib/telemetry/call-capture.js.map +1 -0
- package/dist/lib/telemetry/call-types.d.ts +65 -0
- package/dist/lib/telemetry/call-types.d.ts.map +1 -0
- package/dist/lib/telemetry/call-types.js +68 -0
- package/dist/lib/telemetry/call-types.js.map +1 -0
- package/dist/lib/telemetry/run-state.d.ts +15 -0
- package/dist/lib/telemetry/run-state.d.ts.map +1 -0
- package/dist/lib/telemetry/run-state.js +23 -0
- package/dist/lib/telemetry/run-state.js.map +1 -0
- package/dist/lib/telemetry/s3-sink.d.ts +48 -0
- package/dist/lib/telemetry/s3-sink.d.ts.map +1 -0
- package/dist/lib/telemetry/s3-sink.js +229 -0
- package/dist/lib/telemetry/s3-sink.js.map +1 -0
- package/dist/lib/telemetry/submission-capture.d.ts +45 -0
- package/dist/lib/telemetry/submission-capture.d.ts.map +1 -0
- package/dist/lib/telemetry/submission-capture.js +57 -0
- package/dist/lib/telemetry/submission-capture.js.map +1 -0
- package/dist/lib/telemetry/telemetry-paths.d.ts +59 -0
- package/dist/lib/telemetry/telemetry-paths.d.ts.map +1 -0
- package/dist/lib/telemetry/telemetry-paths.js +103 -0
- package/dist/lib/telemetry/telemetry-paths.js.map +1 -0
- package/dist/lib/tracking-click.d.ts +20 -0
- package/dist/lib/tracking-click.d.ts.map +1 -0
- package/dist/lib/tracking-click.js +75 -0
- package/dist/lib/tracking-click.js.map +1 -0
- package/dist/lib/url-capture.d.ts +8 -0
- package/dist/lib/url-capture.d.ts.map +1 -0
- package/dist/lib/url-capture.js +17 -0
- package/dist/lib/url-capture.js.map +1 -0
- package/dist/lib/us-states.d.ts +20 -0
- package/dist/lib/us-states.d.ts.map +1 -0
- package/dist/lib/us-states.js +86 -0
- package/dist/lib/us-states.js.map +1 -0
- package/dist/lib/zod-multipart.d.ts +18 -0
- package/dist/lib/zod-multipart.d.ts.map +1 -0
- package/dist/lib/zod-multipart.js +35 -0
- package/dist/lib/zod-multipart.js.map +1 -0
- package/dist/plugins/config-plugin.d.ts +77 -0
- package/dist/plugins/config-plugin.d.ts.map +1 -0
- package/dist/plugins/config-plugin.js +216 -0
- package/dist/plugins/config-plugin.js.map +1 -0
- package/dist/plugins/discover.d.ts +72 -0
- package/dist/plugins/discover.d.ts.map +1 -0
- package/dist/plugins/discover.js +265 -0
- package/dist/plugins/discover.js.map +1 -0
- package/dist/plugins/json-schema-to-zod.d.ts +47 -0
- package/dist/plugins/json-schema-to-zod.d.ts.map +1 -0
- package/dist/plugins/json-schema-to-zod.js +85 -0
- package/dist/plugins/json-schema-to-zod.js.map +1 -0
- package/dist/plugins/loader.d.ts +34 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +348 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/plugin-api-version.d.ts +8 -0
- package/dist/plugins/plugin-api-version.d.ts.map +1 -0
- package/dist/plugins/plugin-api-version.js +11 -0
- package/dist/plugins/plugin-api-version.js.map +1 -0
- package/dist/plugins/plugin-manifest-envelope.d.ts +16 -0
- package/dist/plugins/plugin-manifest-envelope.d.ts.map +1 -0
- package/dist/plugins/plugin-manifest-envelope.js +19 -0
- package/dist/plugins/plugin-manifest-envelope.js.map +1 -0
- package/dist/scraper/behavioral-signals.d.ts +16 -0
- package/dist/scraper/behavioral-signals.d.ts.map +1 -0
- package/dist/scraper/behavioral-signals.js +30 -0
- package/dist/scraper/behavioral-signals.js.map +1 -0
- package/dist/scraper/errors.d.ts +193 -0
- package/dist/scraper/errors.d.ts.map +1 -0
- package/dist/scraper/errors.js +226 -0
- package/dist/scraper/errors.js.map +1 -0
- package/dist/scraper/fixtures.d.ts +23 -0
- package/dist/scraper/fixtures.d.ts.map +1 -0
- package/dist/scraper/fixtures.js +48 -0
- package/dist/scraper/fixtures.js.map +1 -0
- package/dist/scraper/flow-runner.d.ts +1319 -0
- package/dist/scraper/flow-runner.d.ts.map +1 -0
- package/dist/scraper/flow-runner.js +5637 -0
- package/dist/scraper/flow-runner.js.map +1 -0
- package/dist/scraper/graphql-client.d.ts +30 -0
- package/dist/scraper/graphql-client.d.ts.map +1 -0
- package/dist/scraper/graphql-client.js +14 -0
- package/dist/scraper/graphql-client.js.map +1 -0
- package/dist/scraper/http-client.d.ts +75 -0
- package/dist/scraper/http-client.d.ts.map +1 -0
- package/dist/scraper/http-client.js +189 -0
- package/dist/scraper/http-client.js.map +1 -0
- package/dist/scraper/http-status-classifier.d.ts +12 -0
- package/dist/scraper/http-status-classifier.d.ts.map +1 -0
- package/dist/scraper/http-status-classifier.js +29 -0
- package/dist/scraper/http-status-classifier.js.map +1 -0
- package/dist/scraper/metrics.d.ts +50 -0
- package/dist/scraper/metrics.d.ts.map +1 -0
- package/dist/scraper/metrics.js +85 -0
- package/dist/scraper/metrics.js.map +1 -0
- package/dist/scraper/navigate.d.ts +20 -0
- package/dist/scraper/navigate.d.ts.map +1 -0
- package/dist/scraper/navigate.js +30 -0
- package/dist/scraper/navigate.js.map +1 -0
- package/dist/scraper/oracle-sentinels.d.ts +22 -0
- package/dist/scraper/oracle-sentinels.d.ts.map +1 -0
- package/dist/scraper/oracle-sentinels.js +40 -0
- package/dist/scraper/oracle-sentinels.js.map +1 -0
- package/dist/scraper/parse-json-response.d.ts +16 -0
- package/dist/scraper/parse-json-response.d.ts.map +1 -0
- package/dist/scraper/parse-json-response.js +37 -0
- package/dist/scraper/parse-json-response.js.map +1 -0
- package/dist/scraper/pool.d.ts +37 -0
- package/dist/scraper/pool.d.ts.map +1 -0
- package/dist/scraper/pool.js +105 -0
- package/dist/scraper/pool.js.map +1 -0
- package/dist/scraper/rate-limited-json-client.d.ts +35 -0
- package/dist/scraper/rate-limited-json-client.d.ts.map +1 -0
- package/dist/scraper/rate-limited-json-client.js +29 -0
- package/dist/scraper/rate-limited-json-client.js.map +1 -0
- package/dist/scraper/raw-fetch.d.ts +49 -0
- package/dist/scraper/raw-fetch.d.ts.map +1 -0
- package/dist/scraper/raw-fetch.js +40 -0
- package/dist/scraper/raw-fetch.js.map +1 -0
- package/dist/scraper/require-response-field.d.ts +23 -0
- package/dist/scraper/require-response-field.d.ts.map +1 -0
- package/dist/scraper/require-response-field.js +42 -0
- package/dist/scraper/require-response-field.js.map +1 -0
- package/dist/scraper/retry.d.ts +33 -0
- package/dist/scraper/retry.d.ts.map +1 -0
- package/dist/scraper/retry.js +122 -0
- package/dist/scraper/retry.js.map +1 -0
- package/dist/scraper/session-browserbase.d.ts +35 -0
- package/dist/scraper/session-browserbase.d.ts.map +1 -0
- package/dist/scraper/session-browserbase.js +198 -0
- package/dist/scraper/session-browserbase.js.map +1 -0
- package/dist/scraper/session-shared.d.ts +29 -0
- package/dist/scraper/session-shared.d.ts.map +1 -0
- package/dist/scraper/session-shared.js +35 -0
- package/dist/scraper/session-shared.js.map +1 -0
- package/dist/scraper/session-steel.d.ts +31 -0
- package/dist/scraper/session-steel.d.ts.map +1 -0
- package/dist/scraper/session-steel.js +140 -0
- package/dist/scraper/session-steel.js.map +1 -0
- package/dist/scraper/session-warmup.d.ts +31 -0
- package/dist/scraper/session-warmup.d.ts.map +1 -0
- package/dist/scraper/session-warmup.js +46 -0
- package/dist/scraper/session-warmup.js.map +1 -0
- package/dist/scraper/session.d.ts +21 -0
- package/dist/scraper/session.d.ts.map +1 -0
- package/dist/scraper/session.js +28 -0
- package/dist/scraper/session.js.map +1 -0
- package/dist/scraper/stagehand-guard.d.ts +128 -0
- package/dist/scraper/stagehand-guard.d.ts.map +1 -0
- package/dist/scraper/stagehand-guard.js +337 -0
- package/dist/scraper/stagehand-guard.js.map +1 -0
- package/dist/scraper/throttle.d.ts +21 -0
- package/dist/scraper/throttle.d.ts.map +1 -0
- package/dist/scraper/throttle.js +45 -0
- package/dist/scraper/throttle.js.map +1 -0
- package/dist/scripts/hca-inbox-poll.d.ts +19 -0
- package/dist/scripts/hca-inbox-poll.d.ts.map +1 -0
- package/dist/scripts/hca-inbox-poll.js +151 -0
- package/dist/scripts/hca-inbox-poll.js.map +1 -0
- package/dist/scripts/judge-llm-batch.d.ts +98 -0
- package/dist/scripts/judge-llm-batch.d.ts.map +1 -0
- package/dist/scripts/judge-llm-batch.js +350 -0
- package/dist/scripts/judge-llm-batch.js.map +1 -0
- package/dist/scripts/llm-heal.d.ts +165 -0
- package/dist/scripts/llm-heal.d.ts.map +1 -0
- package/dist/scripts/llm-heal.js +595 -0
- package/dist/scripts/llm-heal.js.map +1 -0
- package/dist/scripts/migrate-telemetry-dir-names.d.ts +57 -0
- package/dist/scripts/migrate-telemetry-dir-names.d.ts.map +1 -0
- package/dist/scripts/migrate-telemetry-dir-names.js +156 -0
- package/dist/scripts/migrate-telemetry-dir-names.js.map +1 -0
- package/dist/scripts/probe-setinputfiles.d.ts +28 -0
- package/dist/scripts/probe-setinputfiles.d.ts.map +1 -0
- package/dist/scripts/probe-setinputfiles.js +95 -0
- package/dist/scripts/probe-setinputfiles.js.map +1 -0
- package/dist/scripts/recon-browser.d.ts +304 -0
- package/dist/scripts/recon-browser.d.ts.map +1 -0
- package/dist/scripts/recon-browser.js +1833 -0
- package/dist/scripts/recon-browser.js.map +1 -0
- package/dist/scripts/recon-generate.d.ts +182 -0
- package/dist/scripts/recon-generate.d.ts.map +1 -0
- package/dist/scripts/recon-generate.js +2572 -0
- package/dist/scripts/recon-generate.js.map +1 -0
- package/dist/scripts/recon-heal.d.ts +176 -0
- package/dist/scripts/recon-heal.d.ts.map +1 -0
- package/dist/scripts/recon-heal.js +584 -0
- package/dist/scripts/recon-heal.js.map +1 -0
- package/dist/scripts/recon-http.d.ts +19 -0
- package/dist/scripts/recon-http.d.ts.map +1 -0
- package/dist/scripts/recon-http.js +377 -0
- package/dist/scripts/recon-http.js.map +1 -0
- package/dist/scripts/recon-replay-jobs.d.ts +21 -0
- package/dist/scripts/recon-replay-jobs.d.ts.map +1 -0
- package/dist/scripts/recon-replay-jobs.js +221 -0
- package/dist/scripts/recon-replay-jobs.js.map +1 -0
- package/dist/scripts/recon-shared.d.ts +52 -0
- package/dist/scripts/recon-shared.d.ts.map +1 -0
- package/dist/scripts/recon-shared.js +68 -0
- package/dist/scripts/recon-shared.js.map +1 -0
- package/dist/scripts/recon-summarize.d.ts +15 -0
- package/dist/scripts/recon-summarize.d.ts.map +1 -0
- package/dist/scripts/recon-summarize.js +233 -0
- package/dist/scripts/recon-summarize.js.map +1 -0
- package/dist/scripts/smoke-test.d.ts +22 -0
- package/dist/scripts/smoke-test.d.ts.map +1 -0
- package/dist/scripts/smoke-test.js +236 -0
- package/dist/scripts/smoke-test.js.map +1 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +189 -0
- package/dist/server.js.map +1 -0
- package/dist/site-plugin.d.ts +226 -0
- package/dist/site-plugin.d.ts.map +1 -0
- package/dist/site-plugin.js +13 -0
- package/dist/site-plugin.js.map +1 -0
- package/dist/testing/answers-fixture.d.ts +13 -0
- package/dist/testing/answers-fixture.d.ts.map +1 -0
- package/dist/testing/answers-fixture.js +37 -0
- package/dist/testing/answers-fixture.js.map +1 -0
- package/dist/testing/batch-email-confirmation.d.ts +58 -0
- package/dist/testing/batch-email-confirmation.d.ts.map +1 -0
- package/dist/testing/batch-email-confirmation.js +62 -0
- package/dist/testing/batch-email-confirmation.js.map +1 -0
- package/dist/testing/batch-report.d.ts +33 -0
- package/dist/testing/batch-report.d.ts.map +1 -0
- package/dist/testing/batch-report.js +30 -0
- package/dist/testing/batch-report.js.map +1 -0
- package/dist/testing/contract-parity-suite.d.ts +55 -0
- package/dist/testing/contract-parity-suite.d.ts.map +1 -0
- package/dist/testing/contract-parity-suite.js +39 -0
- package/dist/testing/contract-parity-suite.js.map +1 -0
- package/dist/testing/coverage-guard-suite.d.ts +46 -0
- package/dist/testing/coverage-guard-suite.d.ts.map +1 -0
- package/dist/testing/coverage-guard-suite.js +39 -0
- package/dist/testing/coverage-guard-suite.js.map +1 -0
- package/dist/testing/fixtures/resume.pdf +54 -0
- package/dist/testing/integration-runner.d.ts +62 -0
- package/dist/testing/integration-runner.d.ts.map +1 -0
- package/dist/testing/integration-runner.js +46 -0
- package/dist/testing/integration-runner.js.map +1 -0
- package/dist/testing/mock-fetch-response.d.ts +7 -0
- package/dist/testing/mock-fetch-response.d.ts.map +1 -0
- package/dist/testing/mock-fetch-response.js +16 -0
- package/dist/testing/mock-fetch-response.js.map +1 -0
- package/dist/testing/persona-fixture.d.ts +77 -0
- package/dist/testing/persona-fixture.d.ts.map +1 -0
- package/dist/testing/persona-fixture.js +83 -0
- package/dist/testing/persona-fixture.js.map +1 -0
- package/dist/testing/replay-integration-suite.d.ts +50 -0
- package/dist/testing/replay-integration-suite.d.ts.map +1 -0
- package/dist/testing/replay-integration-suite.js +45 -0
- package/dist/testing/replay-integration-suite.js.map +1 -0
- package/dist/testing/resume-fixture.d.ts +39 -0
- package/dist/testing/resume-fixture.d.ts.map +1 -0
- package/dist/testing/resume-fixture.js +38 -0
- package/dist/testing/resume-fixture.js.map +1 -0
- package/dist/testmail/client.d.ts +61 -0
- package/dist/testmail/client.d.ts.map +1 -0
- package/dist/testmail/client.js +190 -0
- package/dist/testmail/client.js.map +1 -0
- package/dist/testmail/errors.d.ts +18 -0
- package/dist/testmail/errors.d.ts.map +1 -0
- package/dist/testmail/errors.js +29 -0
- package/dist/testmail/errors.js.map +1 -0
- package/dist/types/dispatch-metrics.d.ts +46 -0
- package/dist/types/dispatch-metrics.d.ts.map +1 -0
- package/dist/types/dispatch-metrics.js +25 -0
- package/dist/types/dispatch-metrics.js.map +1 -0
- package/dist/types/logging.d.ts +11 -0
- package/dist/types/logging.d.ts.map +1 -0
- package/dist/types/logging.js +3 -0
- package/dist/types/logging.js.map +1 -0
- package/package.json +283 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SEMANTIC_EQUIVALENCES = void 0;
|
|
4
|
+
exports.matchToOptions = matchToOptions;
|
|
5
|
+
const logging_1 = require("../lib/logging");
|
|
6
|
+
const us_states_1 = require("../lib/us-states");
|
|
7
|
+
const logger = (0, logging_1.getLogger)({ name: "lib/option-matcher" });
|
|
8
|
+
/**
|
|
9
|
+
* Known synonyms keyed by their canonical option value (lowercased).
|
|
10
|
+
* When a payload sends a synonym, we return the canonical option.
|
|
11
|
+
*/
|
|
12
|
+
exports.SEMANTIC_EQUIVALENCES = {
|
|
13
|
+
"i do not wish to disclose": [
|
|
14
|
+
"prefer not to say",
|
|
15
|
+
"prefer not to disclose",
|
|
16
|
+
"decline to answer",
|
|
17
|
+
"decline",
|
|
18
|
+
],
|
|
19
|
+
no: ["na", "n/a", "not applicable"],
|
|
20
|
+
"not a veteran": ["not applicable"],
|
|
21
|
+
"master's degree": ["ms", "m.s.", "masters", "master"],
|
|
22
|
+
"bachelor's degree": ["bs", "b.s.", "ba", "b.a.", "bachelors", "bachelor"],
|
|
23
|
+
"doctorate degree": ["phd", "ph.d.", "doctorate", "doctoral"],
|
|
24
|
+
"higher degree (phd/jd/md/do)": ["jd", "j.d.", "md", "m.d.", "do", "d.o."],
|
|
25
|
+
"associate's degree/college diploma": ["as", "a.s.", "aa", "a.a.", "associates", "associate"],
|
|
26
|
+
"high school diploma/ged": ["ged", "high school", "hs"],
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Match a raw value against a question's allowed options. Dropdown questions
|
|
30
|
+
* on ATS forms require the submitted value to be one of the declared options —
|
|
31
|
+
* sending an out-of-list value typically causes a server error.
|
|
32
|
+
*
|
|
33
|
+
* Matching cascade: exact → case-insensitive → US state name→abbrev →
|
|
34
|
+
* semantic equivalence → substring containment → fallback to first option.
|
|
35
|
+
*/
|
|
36
|
+
function matchToOptions(rawValue, options) {
|
|
37
|
+
const stringOpts = options.filter((o) => typeof o === "string");
|
|
38
|
+
if (stringOpts.length === 0)
|
|
39
|
+
return rawValue;
|
|
40
|
+
const raw = rawValue.trim();
|
|
41
|
+
for (const opt of stringOpts) {
|
|
42
|
+
if (opt === raw)
|
|
43
|
+
return opt;
|
|
44
|
+
}
|
|
45
|
+
const rawLower = raw.toLowerCase();
|
|
46
|
+
for (const opt of stringOpts) {
|
|
47
|
+
if (opt.toLowerCase() === rawLower)
|
|
48
|
+
return opt;
|
|
49
|
+
}
|
|
50
|
+
const stateAbbrev = us_states_1.US_STATE_NAMES[rawLower];
|
|
51
|
+
if (stateAbbrev) {
|
|
52
|
+
for (const opt of stringOpts) {
|
|
53
|
+
if (opt.toUpperCase() === stateAbbrev)
|
|
54
|
+
return opt;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
for (const opt of stringOpts) {
|
|
58
|
+
const synonyms = exports.SEMANTIC_EQUIVALENCES[opt.toLowerCase()];
|
|
59
|
+
if (synonyms?.some((s) => s === rawLower))
|
|
60
|
+
return opt;
|
|
61
|
+
}
|
|
62
|
+
for (const opt of stringOpts) {
|
|
63
|
+
if (opt.toLowerCase().includes(rawLower) || rawLower.includes(opt.toLowerCase()))
|
|
64
|
+
return opt;
|
|
65
|
+
}
|
|
66
|
+
logger.warn(`option mismatch: raw="${raw}" not in [${stringOpts.slice(0, 5).join(", ")}${stringOpts.length > 5 ? ", ..." : ""}] — using fallback "${stringOpts[0]}"`);
|
|
67
|
+
return stringOpts[0];
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=option-matcher.js.map
|
|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C,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,uBAAuB,UAAU,CAAC,CAAC,CAAC,GAAG,CACzJ,CAAC;IACF,OAAO,UAAU,CAAC,CAAC,CAAW,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses a US phone string into area code and subscriber number.
|
|
3
|
+
* Oracle HCM requires the phone split into `areaCode` (first 3 digits) and
|
|
4
|
+
* `number` (remaining digits). Inputs shorter than 10 digits get an empty
|
|
5
|
+
* `areaCode` so the partial number is still submitted as-is.
|
|
6
|
+
*/
|
|
7
|
+
export declare function parsePhone(raw: string): {
|
|
8
|
+
areaCode: string;
|
|
9
|
+
number: string;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=phone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone.d.ts","sourceRoot":"","sources":["../../src/lib/phone.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAM5E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parsePhone = parsePhone;
|
|
4
|
+
/**
|
|
5
|
+
* Parses a US phone string into area code and subscriber number.
|
|
6
|
+
* Oracle HCM requires the phone split into `areaCode` (first 3 digits) and
|
|
7
|
+
* `number` (remaining digits). Inputs shorter than 10 digits get an empty
|
|
8
|
+
* `areaCode` so the partial number is still submitted as-is.
|
|
9
|
+
*/
|
|
10
|
+
function parsePhone(raw) {
|
|
11
|
+
const digits = raw.replace(/\D/g, "");
|
|
12
|
+
if (digits.length >= 10) {
|
|
13
|
+
return { areaCode: digits.slice(0, 3), number: digits.slice(3) };
|
|
14
|
+
}
|
|
15
|
+
return { areaCode: "", number: digits };
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=phone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone.js","sourceRoot":"","sources":["../../src/lib/phone.ts"],"names":[],"mappings":";;AAMA,gCAMC;AAZD;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,GAAW;IACpC,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACtC,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;QACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACnE,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny RNG helpers shared by scraper jitter and metrics reservoir sampling.
|
|
3
|
+
*
|
|
4
|
+
* Exists because hand-rolled `Math.floor(Math.random() * ...)` and inline
|
|
5
|
+
* `pick a random index` blocks were duplicated across throttle.ts, metrics.ts,
|
|
6
|
+
* and session.ts. Centralising them keeps the bounds semantics (inclusive on
|
|
7
|
+
* both sides) consistent and gives the call sites a single name to scan for.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Returns a uniformly distributed integer in the inclusive range [min, max].
|
|
11
|
+
* If `max <= min` the function returns `min` rather than producing NaN or
|
|
12
|
+
* an out-of-range value — callers in throttle/metrics rely on this guard.
|
|
13
|
+
*/
|
|
14
|
+
export declare function randomIntInclusive(min: number, max: number): number;
|
|
15
|
+
/**
|
|
16
|
+
* Picks a uniformly random element from a non-empty readonly array. Falls
|
|
17
|
+
* back to `arr[0]` so the return type stays `T` (no undefined leakage) even
|
|
18
|
+
* if a typed empty array is somehow passed in — TypeScript's `readonly T[]`
|
|
19
|
+
* type does not prove non-emptiness at compile time.
|
|
20
|
+
*/
|
|
21
|
+
export declare function pickRandom<T>(arr: readonly T[]): T;
|
|
22
|
+
//# sourceMappingURL=random.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src/lib/random.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAGnE;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,CAGlD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Tiny RNG helpers shared by scraper jitter and metrics reservoir sampling.
|
|
4
|
+
*
|
|
5
|
+
* Exists because hand-rolled `Math.floor(Math.random() * ...)` and inline
|
|
6
|
+
* `pick a random index` blocks were duplicated across throttle.ts, metrics.ts,
|
|
7
|
+
* and session.ts. Centralising them keeps the bounds semantics (inclusive on
|
|
8
|
+
* both sides) consistent and gives the call sites a single name to scan for.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.randomIntInclusive = randomIntInclusive;
|
|
12
|
+
exports.pickRandom = pickRandom;
|
|
13
|
+
/**
|
|
14
|
+
* Returns a uniformly distributed integer in the inclusive range [min, max].
|
|
15
|
+
* If `max <= min` the function returns `min` rather than producing NaN or
|
|
16
|
+
* an out-of-range value — callers in throttle/metrics rely on this guard.
|
|
17
|
+
*/
|
|
18
|
+
function randomIntInclusive(min, max) {
|
|
19
|
+
if (max <= min)
|
|
20
|
+
return min;
|
|
21
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Picks a uniformly random element from a non-empty readonly array. Falls
|
|
25
|
+
* back to `arr[0]` so the return type stays `T` (no undefined leakage) even
|
|
26
|
+
* if a typed empty array is somehow passed in — TypeScript's `readonly T[]`
|
|
27
|
+
* type does not prove non-emptiness at compile time.
|
|
28
|
+
*/
|
|
29
|
+
function pickRandom(arr) {
|
|
30
|
+
const index = randomIntInclusive(0, arr.length - 1);
|
|
31
|
+
return arr[index] ?? arr[0];
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=random.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random.js","sourceRoot":"","sources":["../../src/lib/random.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAOH,gDAGC;AAQD,gCAGC;AAnBD;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,GAAW,EAAE,GAAW;IACzD,IAAI,GAAG,IAAI,GAAG;QAAE,OAAO,GAAG,CAAC;IAC3B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,SAAgB,UAAU,CAAI,GAAiB;IAC7C,MAAM,KAAK,GAAG,kBAAkB,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACpD,OAAO,GAAG,CAAC,KAAK,CAAC,IAAK,GAAG,CAAC,CAAC,CAAO,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DogStatsD client singleton following Vivian's hot-shots pattern. Sends
|
|
3
|
+
* metrics to the Datadog agent when DD_TRACE_ENABLED=true; falls back to a
|
|
4
|
+
* mock client that logs at debug level for local dev without an agent.
|
|
5
|
+
*/
|
|
6
|
+
import type { StatsD as StatsDInstance } from "hot-shots";
|
|
7
|
+
/** Returns the process-global DogStatsD client (lazily initialized). */
|
|
8
|
+
export declare function getStatsD(): StatsDInstance;
|
|
9
|
+
/** Flushes pending packets and closes the UDP socket. Call during shutdown. */
|
|
10
|
+
export declare function shutdownStatsD(): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=statsd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statsd.d.ts","sourceRoot":"","sources":["../../src/lib/statsd.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,WAAW,CAAC;AAuC1D,wEAAwE;AACxE,wBAAgB,SAAS,IAAI,cAAc,CAK1C;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAc9C"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* DogStatsD client singleton following Vivian's hot-shots pattern. Sends
|
|
4
|
+
* metrics to the Datadog agent when DD_TRACE_ENABLED=true; falls back to a
|
|
5
|
+
* mock client that logs at debug level for local dev without an agent.
|
|
6
|
+
*/
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.getStatsD = getStatsD;
|
|
12
|
+
exports.shutdownStatsD = shutdownStatsD;
|
|
13
|
+
const hot_shots_1 = __importDefault(require("hot-shots"));
|
|
14
|
+
const env_1 = require("../lib/env");
|
|
15
|
+
const logging_1 = require("../lib/logging");
|
|
16
|
+
const logger = (0, logging_1.getLogger)({ name: "statsd" });
|
|
17
|
+
function createClient() {
|
|
18
|
+
const traceEnabled = (0, env_1.getBoolEnv)("DD_TRACE_ENABLED", false);
|
|
19
|
+
if (traceEnabled) {
|
|
20
|
+
const host = (0, env_1.getEnv)("DD_AGENT_HOST", "localhost");
|
|
21
|
+
const port = (0, env_1.getNumericEnv)("DD_DOGSTATSD_PORT", 8125);
|
|
22
|
+
logger.info(`initializing DogStatsD client on ${host}:${port}`);
|
|
23
|
+
return new hot_shots_1.default({
|
|
24
|
+
host,
|
|
25
|
+
port,
|
|
26
|
+
prefix: "barnacle.",
|
|
27
|
+
globalTags: {
|
|
28
|
+
service: (0, env_1.getEnv)("DD_SERVICE", "barnacle"),
|
|
29
|
+
env: (0, env_1.getEnv)("DD_ENV", "development"),
|
|
30
|
+
},
|
|
31
|
+
errorHandler: (err) => {
|
|
32
|
+
logger.warn(`statsd send error: ${err.message}`);
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
logger.debug("initializing mock DogStatsD client (DD_TRACE_ENABLED is off)");
|
|
37
|
+
return new hot_shots_1.default({
|
|
38
|
+
mock: true,
|
|
39
|
+
prefix: "barnacle.",
|
|
40
|
+
globalTags: { service: "barnacle", env: "development" },
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
let client;
|
|
44
|
+
/** Returns the process-global DogStatsD client (lazily initialized). */
|
|
45
|
+
function getStatsD() {
|
|
46
|
+
if (!client) {
|
|
47
|
+
client = createClient();
|
|
48
|
+
}
|
|
49
|
+
return client;
|
|
50
|
+
}
|
|
51
|
+
/** Flushes pending packets and closes the UDP socket. Call during shutdown. */
|
|
52
|
+
function shutdownStatsD() {
|
|
53
|
+
if (!client) {
|
|
54
|
+
return Promise.resolve();
|
|
55
|
+
}
|
|
56
|
+
const c = client;
|
|
57
|
+
return new Promise((resolve, reject) => {
|
|
58
|
+
c.close((err) => {
|
|
59
|
+
if (err) {
|
|
60
|
+
reject(err);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
resolve();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=statsd.js.map
|
|
@@ -0,0 +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AAED,IAAI,MAAkC,CAAC;AAEvC,wEAAwE;AACxE,SAAgB,SAAS;IACvB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,GAAG,YAAY,EAAE,CAAC;IAC1B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,+EAA+E;AAC/E,SAAgB,cAAc;IAC5B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IACD,MAAM,CAAC,GAAG,MAAM,CAAC;IACjB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAsB,EAAE,EAAE;YACjC,IAAI,GAAG,EAAE,CAAC;gBACR,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;iBAAM,CAAC;gBACN,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Append-only NDJSON sink for LLM/Stagehand call samples. Each call emits
|
|
3
|
+
* exactly one line so the judge and self-heal skills have a scoreable corpus
|
|
4
|
+
* without coupling this module to any specific call site.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod/v4";
|
|
7
|
+
/**
|
|
8
|
+
* Categorical failure reason for an LLM call. Surfaces post-mortem without
|
|
9
|
+
* regex-scanning `errorMessage`. Discriminated upstream by the caller.
|
|
10
|
+
*/
|
|
11
|
+
export declare const llmCallFailureKindSchema: z.ZodEnum<{
|
|
12
|
+
"anthropic-billing": "anthropic-billing";
|
|
13
|
+
"anthropic-rate-limit": "anthropic-rate-limit";
|
|
14
|
+
"anthropic-other": "anthropic-other";
|
|
15
|
+
"schema-validation-failed": "schema-validation-failed";
|
|
16
|
+
"response-empty": "response-empty";
|
|
17
|
+
"exception-other": "exception-other";
|
|
18
|
+
}>;
|
|
19
|
+
export type LlmCallFailureKind = z.infer<typeof llmCallFailureKindSchema>;
|
|
20
|
+
/**
|
|
21
|
+
* Anthropic returns status 400 + `error.type === "invalid_request_error"`
|
|
22
|
+
* for BOTH genuine bad-request errors AND quota/spend-limit exhaustion.
|
|
23
|
+
* The official taxonomy at https://platform.claude.com/docs/en/api/errors
|
|
24
|
+
* reuses the same enum value for format problems and quota hits; only the
|
|
25
|
+
* embedded `error.message` text discriminates the latter. This regex is
|
|
26
|
+
* confined to that single ambiguous status+type branch in
|
|
27
|
+
* classifyLlmCallFailure — it is not a broad message scan.
|
|
28
|
+
*/
|
|
29
|
+
export declare const ANTHROPIC_QUOTA_MESSAGE_RX: RegExp;
|
|
30
|
+
/**
|
|
31
|
+
* Classify a thrown LLM-call error into one of the discrete failure kinds.
|
|
32
|
+
*
|
|
33
|
+
* Strategy (priority-ordered):
|
|
34
|
+
* 1. Status + structured `error.type` from the SDK fields. Anthropic's
|
|
35
|
+
* documented taxonomy: 402 + billing_error = payment; 429 +
|
|
36
|
+
* rate_limit_error = rate-limited.
|
|
37
|
+
* 2. For the (400 + invalid_request_error) tuple, Anthropic provides no
|
|
38
|
+
* structural discriminator between "bad format" and "quota exhausted"
|
|
39
|
+
* — match the embedded error.message against ANTHROPIC_QUOTA_MESSAGE_RX
|
|
40
|
+
* to identify the latter. This is the one documented exception to
|
|
41
|
+
* structural classification.
|
|
42
|
+
* 3. Best-effort fallbacks for errors whose SDK shape stripped structure
|
|
43
|
+
* (legacy paths, generic exceptions).
|
|
44
|
+
*
|
|
45
|
+
* SDK-agnostic via duck-typing — works with @anthropic-ai/sdk's APIError,
|
|
46
|
+
* Vercel ai SDK's APICallError, or any provider exposing similar fields.
|
|
47
|
+
*/
|
|
48
|
+
export declare function classifyLlmCallFailure(err: unknown): LlmCallFailureKind;
|
|
49
|
+
/**
|
|
50
|
+
* Validated shape of one LLM call sample. Field names follow beacon/pila's
|
|
51
|
+
* NDJSON contract but in Barnacle's camelCase convention.
|
|
52
|
+
*/
|
|
53
|
+
export declare const llmCallSampleSchema: z.ZodObject<{
|
|
54
|
+
callId: z.ZodString;
|
|
55
|
+
callType: z.ZodString;
|
|
56
|
+
model: z.ZodString;
|
|
57
|
+
systemPrompt: z.ZodNullable<z.ZodString>;
|
|
58
|
+
userContent: z.ZodString;
|
|
59
|
+
responseContent: z.ZodNullable<z.ZodString>;
|
|
60
|
+
parsedOk: z.ZodBoolean;
|
|
61
|
+
inputTokens: z.ZodNullable<z.ZodNumber>;
|
|
62
|
+
outputTokens: z.ZodNullable<z.ZodNumber>;
|
|
63
|
+
latencyMs: z.ZodNullable<z.ZodNumber>;
|
|
64
|
+
success: z.ZodBoolean;
|
|
65
|
+
errorMessage: z.ZodNullable<z.ZodString>;
|
|
66
|
+
failureKind: z.ZodNullable<z.ZodEnum<{
|
|
67
|
+
"anthropic-billing": "anthropic-billing";
|
|
68
|
+
"anthropic-rate-limit": "anthropic-rate-limit";
|
|
69
|
+
"anthropic-other": "anthropic-other";
|
|
70
|
+
"schema-validation-failed": "schema-validation-failed";
|
|
71
|
+
"response-empty": "response-empty";
|
|
72
|
+
"exception-other": "exception-other";
|
|
73
|
+
}>>;
|
|
74
|
+
ts: z.ZodString;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
export type LlmCallSample = z.infer<typeof llmCallSampleSchema>;
|
|
77
|
+
/** Input to `captureLlmCall` — `ts` is derived internally so callers omit it. */
|
|
78
|
+
export type LlmCallInput = Omit<LlmCallSample, "ts">;
|
|
79
|
+
/** Options for `captureLlmCall`. */
|
|
80
|
+
export interface CaptureOptions {
|
|
81
|
+
/** Override the sink path; used in tests to avoid touching the real file. */
|
|
82
|
+
sinkPath?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Appends one validated NDJSON line for an LLM call to the configured sink.
|
|
86
|
+
* Errors are logged and swallowed — telemetry must never break the happy path.
|
|
87
|
+
*/
|
|
88
|
+
export declare function captureLlmCall(input: LlmCallInput, opts?: CaptureOptions): Promise<void>;
|
|
89
|
+
//# sourceMappingURL=call-capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-capture.d.ts","sourceRoot":"","sources":["../../../src/lib/telemetry/call-capture.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAQ3B;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;EAOnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,QACiG,CAAC;AA+DzI;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,kBAAkB,CAqBvE;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;iBAe9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,iFAAiF;AACjF,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AAErD,oCAAoC;AACpC,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,YAAY,EACnB,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,IAAI,CAAC,CAYf"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Append-only NDJSON sink for LLM/Stagehand call samples. Each call emits
|
|
4
|
+
* exactly one line so the judge and self-heal skills have a scoreable corpus
|
|
5
|
+
* without coupling this module to any specific call site.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.llmCallSampleSchema = exports.ANTHROPIC_QUOTA_MESSAGE_RX = exports.llmCallFailureKindSchema = void 0;
|
|
9
|
+
exports.classifyLlmCallFailure = classifyLlmCallFailure;
|
|
10
|
+
exports.captureLlmCall = captureLlmCall;
|
|
11
|
+
const promises_1 = require("node:fs/promises");
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
13
|
+
const date_fns_1 = require("date-fns");
|
|
14
|
+
const v4_1 = require("zod/v4");
|
|
15
|
+
const config_1 = require("../../config");
|
|
16
|
+
const logging_1 = require("../../lib/logging");
|
|
17
|
+
const s3_sink_1 = require("../../lib/telemetry/s3-sink");
|
|
18
|
+
const logger = (0, logging_1.getLogger)({ name: "telemetry/call-capture" });
|
|
19
|
+
/**
|
|
20
|
+
* Categorical failure reason for an LLM call. Surfaces post-mortem without
|
|
21
|
+
* regex-scanning `errorMessage`. Discriminated upstream by the caller.
|
|
22
|
+
*/
|
|
23
|
+
exports.llmCallFailureKindSchema = v4_1.z.enum([
|
|
24
|
+
"anthropic-billing",
|
|
25
|
+
"anthropic-rate-limit",
|
|
26
|
+
"anthropic-other",
|
|
27
|
+
"schema-validation-failed",
|
|
28
|
+
"response-empty",
|
|
29
|
+
"exception-other",
|
|
30
|
+
]);
|
|
31
|
+
/**
|
|
32
|
+
* Anthropic returns status 400 + `error.type === "invalid_request_error"`
|
|
33
|
+
* for BOTH genuine bad-request errors AND quota/spend-limit exhaustion.
|
|
34
|
+
* The official taxonomy at https://platform.claude.com/docs/en/api/errors
|
|
35
|
+
* reuses the same enum value for format problems and quota hits; only the
|
|
36
|
+
* embedded `error.message` text discriminates the latter. This regex is
|
|
37
|
+
* confined to that single ambiguous status+type branch in
|
|
38
|
+
* classifyLlmCallFailure — it is not a broad message scan.
|
|
39
|
+
*/
|
|
40
|
+
exports.ANTHROPIC_QUOTA_MESSAGE_RX = /(your credit balance is too low|insufficient_quota|billing_hard_limit_reached|reached your specified API usage limits|usage limits)/i;
|
|
41
|
+
/**
|
|
42
|
+
* Extract the HTTP status from any of: direct `.status`, `.statusCode`,
|
|
43
|
+
* or the `"<NNN> {json}"` prefix the Vercel ai SDK uses for its default
|
|
44
|
+
* error message format. Returns undefined when no status signal exists.
|
|
45
|
+
*/
|
|
46
|
+
function extractAnthropicStatus(errorObj, message) {
|
|
47
|
+
if (errorObj !== null) {
|
|
48
|
+
if (typeof errorObj.status === "number")
|
|
49
|
+
return errorObj.status;
|
|
50
|
+
if (typeof errorObj.statusCode === "number")
|
|
51
|
+
return errorObj.statusCode;
|
|
52
|
+
}
|
|
53
|
+
const match = message.match(/(?:^|\s)(\d{3})\s+\{/);
|
|
54
|
+
if (match?.[1]) {
|
|
55
|
+
const parsed = Number.parseInt(match[1], 10);
|
|
56
|
+
if (parsed >= 100 && parsed < 600)
|
|
57
|
+
return parsed;
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Extract Anthropic's structured `error.type` from whichever shape the SDK
|
|
63
|
+
* chain exposed: direct `.type` (Anthropic SDK APIError), `.responseBody`
|
|
64
|
+
* JSON (Vercel ai SDK APICallError), `.data` (Vercel ai SDK), or the JSON
|
|
65
|
+
* body embedded in `err.message` as `"<status> {json}"` (the Vercel ai
|
|
66
|
+
* SDK's default toString format). Returns null when no structured marker
|
|
67
|
+
* is present.
|
|
68
|
+
*/
|
|
69
|
+
function extractAnthropicErrorType(errorObj) {
|
|
70
|
+
if (errorObj === null)
|
|
71
|
+
return null;
|
|
72
|
+
if (typeof errorObj.type === "string")
|
|
73
|
+
return errorObj.type;
|
|
74
|
+
const responseBody = errorObj.responseBody;
|
|
75
|
+
if (typeof responseBody === "string" && responseBody.length > 0) {
|
|
76
|
+
try {
|
|
77
|
+
const parsed = JSON.parse(responseBody);
|
|
78
|
+
const t = parsed.error?.type ?? parsed.type;
|
|
79
|
+
if (typeof t === "string")
|
|
80
|
+
return t;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// fall through
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const data = errorObj.data;
|
|
87
|
+
if (data !== undefined && data !== null) {
|
|
88
|
+
const t = data.error?.type ?? data.type;
|
|
89
|
+
if (typeof t === "string")
|
|
90
|
+
return t;
|
|
91
|
+
}
|
|
92
|
+
const message = typeof errorObj.message === "string" ? errorObj.message : "";
|
|
93
|
+
const jsonMatch = message.match(/\d{3}\s+(\{.+\})$/s);
|
|
94
|
+
if (jsonMatch?.[1]) {
|
|
95
|
+
try {
|
|
96
|
+
const parsed = JSON.parse(jsonMatch[1]);
|
|
97
|
+
const t = parsed.error?.type ?? parsed.type;
|
|
98
|
+
if (typeof t === "string")
|
|
99
|
+
return t;
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// fall through
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Classify a thrown LLM-call error into one of the discrete failure kinds.
|
|
109
|
+
*
|
|
110
|
+
* Strategy (priority-ordered):
|
|
111
|
+
* 1. Status + structured `error.type` from the SDK fields. Anthropic's
|
|
112
|
+
* documented taxonomy: 402 + billing_error = payment; 429 +
|
|
113
|
+
* rate_limit_error = rate-limited.
|
|
114
|
+
* 2. For the (400 + invalid_request_error) tuple, Anthropic provides no
|
|
115
|
+
* structural discriminator between "bad format" and "quota exhausted"
|
|
116
|
+
* — match the embedded error.message against ANTHROPIC_QUOTA_MESSAGE_RX
|
|
117
|
+
* to identify the latter. This is the one documented exception to
|
|
118
|
+
* structural classification.
|
|
119
|
+
* 3. Best-effort fallbacks for errors whose SDK shape stripped structure
|
|
120
|
+
* (legacy paths, generic exceptions).
|
|
121
|
+
*
|
|
122
|
+
* SDK-agnostic via duck-typing — works with @anthropic-ai/sdk's APIError,
|
|
123
|
+
* Vercel ai SDK's APICallError, or any provider exposing similar fields.
|
|
124
|
+
*/
|
|
125
|
+
function classifyLlmCallFailure(err) {
|
|
126
|
+
const errorObj = typeof err === "object" && err !== null ? err : null;
|
|
127
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
128
|
+
const name = err instanceof Error ? err.name : "";
|
|
129
|
+
const structuredType = extractAnthropicErrorType(errorObj);
|
|
130
|
+
const status = extractAnthropicStatus(errorObj, message);
|
|
131
|
+
if (structuredType === "billing_error" || status === 402)
|
|
132
|
+
return "anthropic-billing";
|
|
133
|
+
if (structuredType === "rate_limit_error" || status === 429 || name === "RateLimitError") {
|
|
134
|
+
return "anthropic-rate-limit";
|
|
135
|
+
}
|
|
136
|
+
if (status === 400 && structuredType === "invalid_request_error") {
|
|
137
|
+
if (exports.ANTHROPIC_QUOTA_MESSAGE_RX.test(message))
|
|
138
|
+
return "anthropic-billing";
|
|
139
|
+
return "anthropic-other";
|
|
140
|
+
}
|
|
141
|
+
if (structuredType !== null)
|
|
142
|
+
return "anthropic-other";
|
|
143
|
+
if (typeof status === "number" && status >= 400 && status < 600)
|
|
144
|
+
return "anthropic-other";
|
|
145
|
+
if (exports.ANTHROPIC_QUOTA_MESSAGE_RX.test(message))
|
|
146
|
+
return "anthropic-billing";
|
|
147
|
+
if (/APIError$|AnthropicError$|APICallError$/.test(name))
|
|
148
|
+
return "anthropic-other";
|
|
149
|
+
if (/zod|schema|parsed_output is null/i.test(message))
|
|
150
|
+
return "schema-validation-failed";
|
|
151
|
+
return "exception-other";
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Validated shape of one LLM call sample. Field names follow beacon/pila's
|
|
155
|
+
* NDJSON contract but in Barnacle's camelCase convention.
|
|
156
|
+
*/
|
|
157
|
+
exports.llmCallSampleSchema = v4_1.z.object({
|
|
158
|
+
callId: v4_1.z.string(),
|
|
159
|
+
callType: v4_1.z.string(),
|
|
160
|
+
model: v4_1.z.string(),
|
|
161
|
+
systemPrompt: v4_1.z.string().nullable(),
|
|
162
|
+
userContent: v4_1.z.string(),
|
|
163
|
+
responseContent: v4_1.z.string().nullable(),
|
|
164
|
+
parsedOk: v4_1.z.boolean(),
|
|
165
|
+
inputTokens: v4_1.z.number().int().nullable(),
|
|
166
|
+
outputTokens: v4_1.z.number().int().nullable(),
|
|
167
|
+
latencyMs: v4_1.z.number().nullable(),
|
|
168
|
+
success: v4_1.z.boolean(),
|
|
169
|
+
errorMessage: v4_1.z.string().nullable(),
|
|
170
|
+
failureKind: exports.llmCallFailureKindSchema.nullable(),
|
|
171
|
+
ts: v4_1.z.string(),
|
|
172
|
+
});
|
|
173
|
+
/**
|
|
174
|
+
* Appends one validated NDJSON line for an LLM call to the configured sink.
|
|
175
|
+
* Errors are logged and swallowed — telemetry must never break the happy path.
|
|
176
|
+
*/
|
|
177
|
+
async function captureLlmCall(input, opts = {}) {
|
|
178
|
+
const sinkPath = opts.sinkPath ?? config_1.config.telemetry.callsNdjsonPath;
|
|
179
|
+
const sample = { ...input, ts: (0, date_fns_1.formatISO)(new Date()) };
|
|
180
|
+
try {
|
|
181
|
+
const line = `${JSON.stringify(sample)}\n`;
|
|
182
|
+
await (0, promises_1.mkdir)((0, node_path_1.dirname)(sinkPath), { recursive: true });
|
|
183
|
+
await (0, promises_1.appendFile)(sinkPath, line, "utf8");
|
|
184
|
+
(0, s3_sink_1.bufferCallLine)(line);
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
logger.error(`captureLlmCall: failed to write to ${sinkPath}: ${String(err)}`);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=call-capture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-capture.js","sourceRoot":"","sources":["../../../src/lib/telemetry/call-capture.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAuHH,wDAqBC;AAsCD,wCAeC;AA/LD,+CAAqD;AACrD,yCAAoC;AAEpC,uCAAqC;AACrC,+BAA2B;AAE3B,qCAAkC;AAClC,2CAA0C;AAC1C,qDAAyD;A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IAAI,EAAE,CAAC,EAAE,CAAC;IAEtE,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;QAC3C,MAAM,IAAA,gBAAK,EAAC,IAAA,mBAAO,EAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACpD,MAAM,IAAA,qBAAU,EAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACzC,IAAA,wBAAc,EAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,CAAC,KAAK,CAAC,sCAAsC,QAAQ,KAAK,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical call_type string constants for all LLM call sites Barnacle owns
|
|
3
|
+
* directly. Referencing these avoids magic strings in call sites, tests, and
|
|
4
|
+
* the judge/self-heal skills (feat-004/005).
|
|
5
|
+
*/
|
|
6
|
+
/** Attempt-4 rephrase inside the recon-browser step-healing cascade. */
|
|
7
|
+
export declare const CALL_TYPE_RECON_REPHRASE = "recon-rephrase";
|
|
8
|
+
/** Global replan after a step terminally fails in recon-browser. */
|
|
9
|
+
export declare const CALL_TYPE_RECON_REPLAN = "recon-replan";
|
|
10
|
+
/** Patch proposal from the recon-flow-patch-generator (recon-heal). */
|
|
11
|
+
export declare const CALL_TYPE_RECON_FLOW_PATCH = "recon-flow-patch";
|
|
12
|
+
/** Patch proposal from the llm-call-patch-generator (llm-heal). */
|
|
13
|
+
export declare const CALL_TYPE_LLM_PROMPT_PATCH = "llm-prompt-patch";
|
|
14
|
+
/**
|
|
15
|
+
* Stagehand `act()` envelope-validation. Captured by the guardedAct wrapper
|
|
16
|
+
* so every Stagehand-driven LLM call lands in the same NDJSON sink as
|
|
17
|
+
* Barnacle's own Anthropic-SDK calls. Per the user directive that every
|
|
18
|
+
* LLM-touching surface enforces a schema, every act call is logged
|
|
19
|
+
* regardless of outcome — full parity with our other call-type telemetry.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CALL_TYPE_STAGEHAND_ACT = "stagehand-act";
|
|
22
|
+
/** Stagehand `observe()` envelope-validation. See CALL_TYPE_STAGEHAND_ACT. */
|
|
23
|
+
export declare const CALL_TYPE_STAGEHAND_OBSERVE = "stagehand-observe";
|
|
24
|
+
/** Stagehand `extract()` schema-enforced call. See CALL_TYPE_STAGEHAND_ACT. */
|
|
25
|
+
export declare const CALL_TYPE_STAGEHAND_EXTRACT = "stagehand-extract";
|
|
26
|
+
/**
|
|
27
|
+
* Haiku 4.5 judge for submit-success verification. Replaces the per-site
|
|
28
|
+
* regex (`submitEndpointPattern`) that mislabeled successful submits as
|
|
29
|
+
* failures whenever AppCast used a different POST URL than the regex
|
|
30
|
+
* expected. The judge receives evidence (recent network captures, page
|
|
31
|
+
* URL/title, unfocused observe, site criteria) and returns a discriminated
|
|
32
|
+
* verdict — verified=true requires multi-signal corroboration to prevent
|
|
33
|
+
* lax false positives.
|
|
34
|
+
*/
|
|
35
|
+
export declare const CALL_TYPE_JUDGE_SUBMIT_VERIFY = "judge-submit-verify";
|
|
36
|
+
/**
|
|
37
|
+
* Haiku 4.5 judge for invalid-field detection. Replaces INVALID_CLASS_RX
|
|
38
|
+
* (limited to ng-invalid / mat-form-field-invalid / is-invalid class
|
|
39
|
+
* signatures) with structured detection covering aria-invalid attributes,
|
|
40
|
+
* data-invalid attributes, and arbitrary framework variants we haven't
|
|
41
|
+
* seen yet. Strict prompting: only mark a field present when there's a
|
|
42
|
+
* structural invalid marker, not just visual red-border styling.
|
|
43
|
+
*/
|
|
44
|
+
export declare const CALL_TYPE_JUDGE_INVALID_FIELDS = "judge-invalid-fields";
|
|
45
|
+
/**
|
|
46
|
+
* Haiku 4.5 judge for modal-priority ranking of unfocused-observe
|
|
47
|
+
* candidates. Replaces MODAL_PRIORITY_RX (keyword regex over English
|
|
48
|
+
* descriptions). Surfaces modals/dialogs/overlays that BLOCK the form,
|
|
49
|
+
* skips always-visible panels and sidebars that don't.
|
|
50
|
+
*/
|
|
51
|
+
export declare const CALL_TYPE_JUDGE_MODAL_PRIORITY = "judge-modal-priority";
|
|
52
|
+
/**
|
|
53
|
+
* Haiku 4.5 judge for visible-error-message extraction. Replaces
|
|
54
|
+
* errorPattern (class-name regex). Extracts structurally-marked error
|
|
55
|
+
* messages with field hints and severity, skipping placeholder/help text.
|
|
56
|
+
*/
|
|
57
|
+
export declare const CALL_TYPE_JUDGE_ERROR_MESSAGES = "judge-error-messages";
|
|
58
|
+
/**
|
|
59
|
+
* Haiku 4.5 judge that picks the best AVAILABLE option for a required
|
|
60
|
+
* dropdown when the flow's hardcoded answer text doesn't exist in this
|
|
61
|
+
* requisition's option list (per-req screening-question variance). Used by
|
|
62
|
+
* `trySelectPrimitive`'s LLM fallback.
|
|
63
|
+
*/
|
|
64
|
+
export declare const CALL_TYPE_JUDGE_SELECT_OPTION = "judge-select-option";
|
|
65
|
+
//# sourceMappingURL=call-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-types.d.ts","sourceRoot":"","sources":["../../../src/lib/telemetry/call-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AAEzD,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,iBAAiB,CAAC;AAErD,uEAAuE;AACvE,eAAO,MAAM,0BAA0B,qBAAqB,CAAC;AAE7D,mEAAmE;AACnE,eAAO,MAAM,0BAA0B,qBAAqB,CAAC;AAE7D;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;AAEvD,8EAA8E;AAC9E,eAAO,MAAM,2BAA2B,sBAAsB,CAAC;AAE/D,+EAA+E;AAC/E,eAAO,MAAM,2BAA2B,sBAAsB,CAAC;AAE/D;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B,wBAAwB,CAAC;AAEnE;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,yBAAyB,CAAC;AAErE;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,yBAAyB,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,8BAA8B,yBAAyB,CAAC;AAErE;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,wBAAwB,CAAC"}
|