@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,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared Zod schema fragment for the optional post-submission tracking-click
|
|
4
|
+
* URL that every plugin may receive. The engine reads `TrackingUrl`
|
|
5
|
+
* site-agnostically in loader.ts (fireTrackingClick) — this fragment is the
|
|
6
|
+
* single source of truth so a type change propagates to every plugin from one
|
|
7
|
+
* place.
|
|
8
|
+
*
|
|
9
|
+
* Compose into a plugin contract via `.extend(JobTrackingSchema.shape)` or
|
|
10
|
+
* `.merge(JobTrackingSchema)` depending on which Zod combinator the plugin
|
|
11
|
+
* already uses.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.JobTrackingSchema = void 0;
|
|
15
|
+
const v4_1 = require("zod/v4");
|
|
16
|
+
exports.JobTrackingSchema = v4_1.z.object({
|
|
17
|
+
TrackingUrl: v4_1.z.url().optional(),
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=job-tracking.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-tracking.js","sourceRoot":"","sources":["../../src/lib/job-tracking.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,+BAA2B;AAEd,QAAA,iBAAiB,GAAG,MAAC,CAAC,MAAM,CAAC;IACxC,WAAW,EAAE,MAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Anthropic from "@anthropic-ai/sdk";
|
|
2
|
+
/**
|
|
3
|
+
* Build the shared Anthropic client used by the self-heal cascade's LLM
|
|
4
|
+
* techniques (attempt-5 rephrase, replan, judges). Returns `null` on a
|
|
5
|
+
* Bedrock-only deployment or when no `ANTHROPIC_API_KEY` is configured, so
|
|
6
|
+
* callers degrade to deterministic-only healing instead of crashing. Extracted
|
|
7
|
+
* to a leaf module so every entrypoint — the recon CLI, the heal loops, and
|
|
8
|
+
* generated site plugins running {@link runHealingFlow} — resolves the client
|
|
9
|
+
* the same way rather than each duplicating the env/Bedrock gate.
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildAnthropicClient(): Anthropic | null;
|
|
12
|
+
//# sourceMappingURL=anthropic-client.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.buildAnthropicClient = buildAnthropicClient;
|
|
7
|
+
const sdk_1 = __importDefault(require("@anthropic-ai/sdk"));
|
|
8
|
+
const config_1 = require("../../config");
|
|
9
|
+
/**
|
|
10
|
+
* Build the shared Anthropic client used by the self-heal cascade's LLM
|
|
11
|
+
* techniques (attempt-5 rephrase, replan, judges). Returns `null` on a
|
|
12
|
+
* Bedrock-only deployment or when no `ANTHROPIC_API_KEY` is configured, so
|
|
13
|
+
* callers degrade to deterministic-only healing instead of crashing. Extracted
|
|
14
|
+
* to a leaf module so every entrypoint — the recon CLI, the heal loops, and
|
|
15
|
+
* generated site plugins running {@link runHealingFlow} — resolves the client
|
|
16
|
+
* the same way rather than each duplicating the env/Bedrock gate.
|
|
17
|
+
*/
|
|
18
|
+
function buildAnthropicClient() {
|
|
19
|
+
if (config_1.config.scraper.useBedrock || !config_1.config.scraper.anthropicApiKey)
|
|
20
|
+
return null;
|
|
21
|
+
return new sdk_1.default({ apiKey: config_1.config.scraper.anthropicApiKey });
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=anthropic-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic-client.js","sourceRoot":"","sources":["../../../src/lib/llm/anthropic-client.ts"],"names":[],"mappings":";;;;;AAaA,oDAGC;AAhBD,4DAA0C;AAE1C,qCAAkC;AAElC;;;;;;;;GAQG;AACH,SAAgB,oBAAoB;IAClC,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"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Haiku 4.5 judge primitive. Every fuzzy-data judgment in the engine
|
|
3
|
+
* routes through this — submit-verification, invalid-field detection, modal-
|
|
4
|
+
* priority ranking, error-message extraction. Replaces deterministic regexes
|
|
5
|
+
* that silently miss patterns outside what we've happened to observe across
|
|
6
|
+
* AppCast + ClearCompany (both Angular).
|
|
7
|
+
*
|
|
8
|
+
* Why a separate primitive instead of inlining into each call site:
|
|
9
|
+
* - Single chokepoint for telemetry, error classification, and latency
|
|
10
|
+
* accounting across all judge calls.
|
|
11
|
+
* - Pinned model + always-on structured output prevents drift: every
|
|
12
|
+
* call site uses `messages.parse` + `output_config.format` so Haiku's
|
|
13
|
+
* GA constrained-decoding makes schema violations structurally
|
|
14
|
+
* impossible.
|
|
15
|
+
* - Soft cost-control: clamps `max_tokens` to a small default since
|
|
16
|
+
* verdicts are small JSON blobs, not prose.
|
|
17
|
+
*
|
|
18
|
+
* Model selection: Haiku 4.5 is GA, costs $1 / $5 per million tokens
|
|
19
|
+
* (input/output), runs in ~810ms p50 TTFT on Anthropic's first-party API,
|
|
20
|
+
* and has its own rate-limit pool separate from Opus. Validated empirically
|
|
21
|
+
* 2026-06-11 on two production failure dumps — see plan file for the
|
|
22
|
+
* verifySubmit cases.
|
|
23
|
+
*
|
|
24
|
+
* On schema/API failure the wrapper returns null and logs the failureKind
|
|
25
|
+
* via classifyLlmCallFailure(); callers are expected to fall back to a
|
|
26
|
+
* conservative default (typically "not verified" / "no judgment").
|
|
27
|
+
*/
|
|
28
|
+
import type Anthropic from "@anthropic-ai/sdk";
|
|
29
|
+
import type { z } from "zod/v4";
|
|
30
|
+
import { type LlmCallInput } from "../../lib/telemetry/call-capture";
|
|
31
|
+
/** Injectable capture function — matches `captureLlmCall`'s signature. */
|
|
32
|
+
export type JudgeCaptureFn = (input: LlmCallInput) => Promise<void>;
|
|
33
|
+
export interface HaikuJudgeParams<T extends z.ZodTypeAny> {
|
|
34
|
+
client: Anthropic;
|
|
35
|
+
systemPrompt: string;
|
|
36
|
+
userPrompt: string;
|
|
37
|
+
schema: T;
|
|
38
|
+
callType: string;
|
|
39
|
+
maxTokens?: number;
|
|
40
|
+
captureFn?: JudgeCaptureFn;
|
|
41
|
+
}
|
|
42
|
+
export interface HaikuJudgeResult<T extends z.ZodTypeAny> {
|
|
43
|
+
parsed: z.infer<T>;
|
|
44
|
+
latencyMs: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Send a structured-output judgment request to Haiku 4.5. Returns the
|
|
48
|
+
* parsed verdict and the wall-clock latency. Returns null on any failure
|
|
49
|
+
* (API error, schema-validation error, parsed_output null) — callers fall
|
|
50
|
+
* back to a conservative default.
|
|
51
|
+
*
|
|
52
|
+
* The telemetry contract matches every other engine LLM call site exactly:
|
|
53
|
+
* one NDJSON entry per call regardless of outcome, with parsedOk/success
|
|
54
|
+
* fields distinguishing happy path from failure modes.
|
|
55
|
+
*/
|
|
56
|
+
export declare function callHaikuJudge<T extends z.ZodTypeAny>(params: HaikuJudgeParams<T>): Promise<HaikuJudgeResult<T> | null>;
|
|
57
|
+
//# sourceMappingURL=judge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judge.d.ts","sourceRoot":"","sources":["../../../src/lib/llm/judge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAE/C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,8BAA8B,CAAC;AAsBtC,0EAA0E;AAC1E,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEpE,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU;IACtD,MAAM,EAAE,SAAS,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,CAAC,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,cAAc,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU;IACtD,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EACzD,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAC1B,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CA0ErC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generic Haiku 4.5 judge primitive. Every fuzzy-data judgment in the engine
|
|
4
|
+
* routes through this — submit-verification, invalid-field detection, modal-
|
|
5
|
+
* priority ranking, error-message extraction. Replaces deterministic regexes
|
|
6
|
+
* that silently miss patterns outside what we've happened to observe across
|
|
7
|
+
* AppCast + ClearCompany (both Angular).
|
|
8
|
+
*
|
|
9
|
+
* Why a separate primitive instead of inlining into each call site:
|
|
10
|
+
* - Single chokepoint for telemetry, error classification, and latency
|
|
11
|
+
* accounting across all judge calls.
|
|
12
|
+
* - Pinned model + always-on structured output prevents drift: every
|
|
13
|
+
* call site uses `messages.parse` + `output_config.format` so Haiku's
|
|
14
|
+
* GA constrained-decoding makes schema violations structurally
|
|
15
|
+
* impossible.
|
|
16
|
+
* - Soft cost-control: clamps `max_tokens` to a small default since
|
|
17
|
+
* verdicts are small JSON blobs, not prose.
|
|
18
|
+
*
|
|
19
|
+
* Model selection: Haiku 4.5 is GA, costs $1 / $5 per million tokens
|
|
20
|
+
* (input/output), runs in ~810ms p50 TTFT on Anthropic's first-party API,
|
|
21
|
+
* and has its own rate-limit pool separate from Opus. Validated empirically
|
|
22
|
+
* 2026-06-11 on two production failure dumps — see plan file for the
|
|
23
|
+
* verifySubmit cases.
|
|
24
|
+
*
|
|
25
|
+
* On schema/API failure the wrapper returns null and logs the failureKind
|
|
26
|
+
* via classifyLlmCallFailure(); callers are expected to fall back to a
|
|
27
|
+
* conservative default (typically "not verified" / "no judgment").
|
|
28
|
+
*/
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.callHaikuJudge = callHaikuJudge;
|
|
31
|
+
const node_crypto_1 = require("node:crypto");
|
|
32
|
+
const zod_1 = require("@anthropic-ai/sdk/helpers/zod");
|
|
33
|
+
const logging_1 = require("../../lib/logging");
|
|
34
|
+
const call_capture_1 = require("../../lib/telemetry/call-capture");
|
|
35
|
+
const logger = (0, logging_1.getLogger)({ name: "haiku-judge" });
|
|
36
|
+
/**
|
|
37
|
+
* Pinned Haiku version. We pin to a dated snapshot so prompts that
|
|
38
|
+
* empirically work today keep working when Anthropic ships a newer
|
|
39
|
+
* Haiku — model behavior on edge cases can shift between minor versions.
|
|
40
|
+
*/
|
|
41
|
+
const HAIKU_MODEL_ID = "claude-haiku-4-5-20251001";
|
|
42
|
+
/** Default max-tokens for verdict outputs. Verdicts are small JSON blobs;
|
|
43
|
+
* 512 tokens comfortably covers any of our schemas including the rationale
|
|
44
|
+
* fields, while preventing accidental cost explosion if the LLM tried to
|
|
45
|
+
* write prose. */
|
|
46
|
+
const DEFAULT_MAX_TOKENS = 512;
|
|
47
|
+
/** Warn threshold for input prompt size. Haiku TTFT degrades with context;
|
|
48
|
+
* the cutoff below isn't a hard ceiling, just a sanity bell for prompts
|
|
49
|
+
* that would benefit from trimming before they ship to production. */
|
|
50
|
+
const LARGE_PROMPT_WARN_CHARS = 32_000;
|
|
51
|
+
/**
|
|
52
|
+
* Send a structured-output judgment request to Haiku 4.5. Returns the
|
|
53
|
+
* parsed verdict and the wall-clock latency. Returns null on any failure
|
|
54
|
+
* (API error, schema-validation error, parsed_output null) — callers fall
|
|
55
|
+
* back to a conservative default.
|
|
56
|
+
*
|
|
57
|
+
* The telemetry contract matches every other engine LLM call site exactly:
|
|
58
|
+
* one NDJSON entry per call regardless of outcome, with parsedOk/success
|
|
59
|
+
* fields distinguishing happy path from failure modes.
|
|
60
|
+
*/
|
|
61
|
+
async function callHaikuJudge(params) {
|
|
62
|
+
const { client, systemPrompt, userPrompt, schema, callType, maxTokens = DEFAULT_MAX_TOKENS, captureFn = call_capture_1.captureLlmCall, } = params;
|
|
63
|
+
if (userPrompt.length > LARGE_PROMPT_WARN_CHARS) {
|
|
64
|
+
logger.warn(`haiku-judge ${callType}: large prompt ${userPrompt.length} chars; consider trimming for latency`);
|
|
65
|
+
}
|
|
66
|
+
const callId = (0, node_crypto_1.randomUUID)();
|
|
67
|
+
const t0 = performance.now();
|
|
68
|
+
try {
|
|
69
|
+
const response = await client.messages.parse({
|
|
70
|
+
model: HAIKU_MODEL_ID,
|
|
71
|
+
max_tokens: maxTokens,
|
|
72
|
+
system: systemPrompt,
|
|
73
|
+
messages: [{ role: "user", content: userPrompt }],
|
|
74
|
+
output_config: {
|
|
75
|
+
format: (0, zod_1.zodOutputFormat)(schema),
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
const latencyMs = performance.now() - t0;
|
|
79
|
+
const parsed = response.parsed_output;
|
|
80
|
+
if (parsed === null) {
|
|
81
|
+
throw new Error("structured-output enabled but parsed_output is null");
|
|
82
|
+
}
|
|
83
|
+
const textBlock = response.content.find((b) => b.type === "text");
|
|
84
|
+
const rawText = textBlock?.type === "text" ? textBlock.text : "";
|
|
85
|
+
await captureFn({
|
|
86
|
+
callId,
|
|
87
|
+
callType,
|
|
88
|
+
model: HAIKU_MODEL_ID,
|
|
89
|
+
systemPrompt,
|
|
90
|
+
userContent: userPrompt,
|
|
91
|
+
responseContent: rawText,
|
|
92
|
+
parsedOk: true,
|
|
93
|
+
inputTokens: response.usage?.input_tokens ?? null,
|
|
94
|
+
outputTokens: response.usage?.output_tokens ?? null,
|
|
95
|
+
latencyMs,
|
|
96
|
+
success: true,
|
|
97
|
+
errorMessage: null,
|
|
98
|
+
failureKind: null,
|
|
99
|
+
});
|
|
100
|
+
return { parsed: parsed, latencyMs };
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
104
|
+
const latencyMs = performance.now() - t0;
|
|
105
|
+
await captureFn({
|
|
106
|
+
callId,
|
|
107
|
+
callType,
|
|
108
|
+
model: HAIKU_MODEL_ID,
|
|
109
|
+
systemPrompt,
|
|
110
|
+
userContent: userPrompt,
|
|
111
|
+
responseContent: null,
|
|
112
|
+
parsedOk: false,
|
|
113
|
+
inputTokens: null,
|
|
114
|
+
outputTokens: null,
|
|
115
|
+
latencyMs,
|
|
116
|
+
success: false,
|
|
117
|
+
errorMessage: message,
|
|
118
|
+
failureKind: (0, call_capture_1.classifyLlmCallFailure)(err),
|
|
119
|
+
});
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=judge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judge.js","sourceRoot":"","sources":["../../../src/lib/llm/judge.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;AA+DH,wCA4EC;AAzID,6CAAyC;AAGzC,uDAAgE;AAGhE,2CAA0C;AAC1C,+DAIsC;AAEtC,MAAM,MAAM,GAAG,IAAA,mBAAS,EAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;AAElD;;;;GAIG;AACH,MAAM,cAAc,GAAG,2BAA2B,CAAC;AAEnD;;;kBAGkB;AAClB,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B;;sEAEsE;AACtE,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAoBvC;;;;;;;;;GASG;AACI,KAAK,UAAU,cAAc,CAClC,MAA2B;IAE3B,MAAM,EACJ,MAAM,EACN,YAAY,EACZ,UAAU,EACV,MAAM,EACN,QAAQ,EACR,SAAS,GAAG,kBAAkB,EAC9B,SAAS,GAAG,6BAAc,GAC3B,GAAG,MAAM,CAAC;IAEX,IAAI,UAAU,CAAC,MAAM,GAAG,uBAAuB,EAAE,CAAC;QAChD,MAAM,CAAC,IAAI,CACT,eAAe,QAAQ,kBAAkB,UAAU,CAAC,MAAM,uCAAuC,CAClG,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,IAAA,wBAAU,GAAE,CAAC;IAC5B,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAC7B,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC3C,KAAK,EAAE,cAAc;YACrB,UAAU,EAAE,SAAS;YACrB,MAAM,EAAE,YAAY;YACpB,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;YACjD,aAAa,EAAE;gBACb,MAAM,EAAE,IAAA,qBAAe,EAAC,MAAM,CAAC;aAChC;SACF,CAAC,CAAC;QACH,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;QACzC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC;QACtC,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;QACD,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;QAClE,MAAM,OAAO,GAAG,SAAS,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAEjE,MAAM,SAAS,CAAC;YACd,MAAM;YACN,QAAQ;YACR,KAAK,EAAE,cAAc;YACrB,YAAY;YACZ,WAAW,EAAE,UAAU;YACvB,eAAe,EAAE,OAAO;YACxB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,QAAQ,CAAC,KAAK,EAAE,YAAY,IAAI,IAAI;YACjD,YAAY,EAAE,QAAQ,CAAC,KAAK,EAAE,aAAa,IAAI,IAAI;YACnD,SAAS;YACT,OAAO,EAAE,IAAI;YACb,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,MAAoB,EAAE,SAAS,EAAE,CAAC;IACrD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;QACzC,MAAM,SAAS,CAAC;YACd,MAAM;YACN,QAAQ;YACR,KAAK,EAAE,cAAc;YACrB,YAAY;YACZ,WAAW,EAAE,UAAU;YACvB,eAAe,EAAE,IAAI;YACrB,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,IAAI;YACjB,YAAY,EAAE,IAAI;YAClB,SAAS;YACT,OAAO,EAAE,KAAK;YACd,YAAY,EAAE,OAAO;YACrB,WAAW,EAAE,IAAA,qCAAsB,EAAC,GAAG,CAAC;SACzC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error-messages extraction judge. Replaces the framework-conventional
|
|
3
|
+
* regex `errorPattern = /(error-message|mat-error|field-error|...)/` over
|
|
4
|
+
* DOM class signatures.
|
|
5
|
+
*
|
|
6
|
+
* Why: same shape as the invalid-fields judge. The regex covered Angular
|
|
7
|
+
* and Material conventions but missed React Hook Form render-prop errors,
|
|
8
|
+
* headless UI component-based errors, toast-based error notifications,
|
|
9
|
+
* inline tooltip errors, and any site-specific error container class.
|
|
10
|
+
* When the regex missed, the rephrase prompt's VISIBLE ERROR section
|
|
11
|
+
* was `(none)` and the LLM lost the structured field-level rejection
|
|
12
|
+
* messages the server had returned.
|
|
13
|
+
*
|
|
14
|
+
* The judge extracts structurally-marked error messages with optional
|
|
15
|
+
* field hints and severity. Visual-only error styling does NOT count.
|
|
16
|
+
*/
|
|
17
|
+
import type Anthropic from "@anthropic-ai/sdk";
|
|
18
|
+
import type { z } from "zod/v4";
|
|
19
|
+
import { type JudgeCaptureFn } from "../../../lib/llm/judge";
|
|
20
|
+
import { ERROR_MESSAGES_SCHEMA } from "../../../lib/llm/schemas";
|
|
21
|
+
declare const ERROR_MESSAGES_SYSTEM_PROMPT = "You are a strict error-message extractor for browser forms. Given a body-HTML excerpt, identify visible error messages and required-field warnings tied to specific form inputs.\n\nStrict criteria for extracting a message:\n- It lives inside a structural error container (class containing \"error\", \"validation\", \"feedback\", \"invalid\", \"required\", \"help-block-error\", \"form-error\", or app-prefixed equivalent), OR\n- It's inside an aria-live=\"polite\" or aria-live=\"assertive\" region, OR\n- It's directly adjacent to a field marked aria-invalid=\"true\" or data-invalid.\n\nDo NOT extract:\n- Placeholder text inside empty inputs (placeholder= attribute).\n- Help text / hint text that's always visible and explains the field (e.g. \"Format: MM/DD/YYYY\").\n- Tooltips that auto-hide on click outside.\n- Plain prose text that happens to contain words like \"error\" but isn't a structural error indicator.\n\nEach message:\n- text: the visible message string, trimmed to \u2264400 chars.\n- fieldHint: a short identifier for the field the error applies to (label text, placeholder, name= attribute, id), or null if not discoverable.\n- severity: \"error\" for structural validation failures, \"warning\" for soft hints (e.g. \"field will be required\"), \"info\" for purely informational adjacent messages.\n\nReturn up to 50 messages. Empty array when no structural error containers are visible.";
|
|
22
|
+
export interface JudgeErrorMessagesInput {
|
|
23
|
+
/** Body HTML excerpt to scan (typically the page DOM, truncated to ~8KB). */
|
|
24
|
+
bodyHtmlExcerpt: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Run the error-messages judge. Returns a list of structurally-marked
|
|
28
|
+
* error messages with field hints and severity. Returns null when the
|
|
29
|
+
* client is null (Bedrock-only) or the API call fails — callers fall back
|
|
30
|
+
* to an empty list.
|
|
31
|
+
*/
|
|
32
|
+
export declare function judgeErrorMessagesWithLLM(params: {
|
|
33
|
+
client: Anthropic | null;
|
|
34
|
+
input: JudgeErrorMessagesInput;
|
|
35
|
+
captureFn?: JudgeCaptureFn;
|
|
36
|
+
}): Promise<z.infer<typeof ERROR_MESSAGES_SCHEMA> | null>;
|
|
37
|
+
export { ERROR_MESSAGES_SYSTEM_PROMPT };
|
|
38
|
+
//# sourceMappingURL=error-messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-messages.d.ts","sourceRoot":"","sources":["../../../../src/lib/llm/judges/error-messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,QAAA,MAAM,4BAA4B,y4CAkBqD,CAAC;AAExF,MAAM,WAAW,uBAAuB;IACtC,6EAA6E;IAC7E,eAAe,EAAE,MAAM,CAAC;CACzB;AASD;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE;IACtD,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,uBAAuB,CAAC;IAC/B,SAAS,CAAC,EAAE,cAAc,CAAC;CAC5B,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,GAAG,IAAI,CAAC,CAaxD;AAED,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Error-messages extraction judge. Replaces the framework-conventional
|
|
4
|
+
* regex `errorPattern = /(error-message|mat-error|field-error|...)/` over
|
|
5
|
+
* DOM class signatures.
|
|
6
|
+
*
|
|
7
|
+
* Why: same shape as the invalid-fields judge. The regex covered Angular
|
|
8
|
+
* and Material conventions but missed React Hook Form render-prop errors,
|
|
9
|
+
* headless UI component-based errors, toast-based error notifications,
|
|
10
|
+
* inline tooltip errors, and any site-specific error container class.
|
|
11
|
+
* When the regex missed, the rephrase prompt's VISIBLE ERROR section
|
|
12
|
+
* was `(none)` and the LLM lost the structured field-level rejection
|
|
13
|
+
* messages the server had returned.
|
|
14
|
+
*
|
|
15
|
+
* The judge extracts structurally-marked error messages with optional
|
|
16
|
+
* field hints and severity. Visual-only error styling does NOT count.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.ERROR_MESSAGES_SYSTEM_PROMPT = void 0;
|
|
20
|
+
exports.judgeErrorMessagesWithLLM = judgeErrorMessagesWithLLM;
|
|
21
|
+
const judge_1 = require("../../../lib/llm/judge");
|
|
22
|
+
const schemas_1 = require("../../../lib/llm/schemas");
|
|
23
|
+
const call_types_1 = require("../../../lib/telemetry/call-types");
|
|
24
|
+
const ERROR_MESSAGES_SYSTEM_PROMPT = `You are a strict error-message extractor for browser forms. Given a body-HTML excerpt, identify visible error messages and required-field warnings tied to specific form inputs.
|
|
25
|
+
|
|
26
|
+
Strict criteria for extracting a message:
|
|
27
|
+
- It lives inside a structural error container (class containing "error", "validation", "feedback", "invalid", "required", "help-block-error", "form-error", or app-prefixed equivalent), OR
|
|
28
|
+
- It's inside an aria-live="polite" or aria-live="assertive" region, OR
|
|
29
|
+
- It's directly adjacent to a field marked aria-invalid="true" or data-invalid.
|
|
30
|
+
|
|
31
|
+
Do NOT extract:
|
|
32
|
+
- Placeholder text inside empty inputs (placeholder= attribute).
|
|
33
|
+
- Help text / hint text that's always visible and explains the field (e.g. "Format: MM/DD/YYYY").
|
|
34
|
+
- Tooltips that auto-hide on click outside.
|
|
35
|
+
- Plain prose text that happens to contain words like "error" but isn't a structural error indicator.
|
|
36
|
+
|
|
37
|
+
Each message:
|
|
38
|
+
- text: the visible message string, trimmed to ≤400 chars.
|
|
39
|
+
- fieldHint: a short identifier for the field the error applies to (label text, placeholder, name= attribute, id), or null if not discoverable.
|
|
40
|
+
- severity: "error" for structural validation failures, "warning" for soft hints (e.g. "field will be required"), "info" for purely informational adjacent messages.
|
|
41
|
+
|
|
42
|
+
Return up to 50 messages. Empty array when no structural error containers are visible.`;
|
|
43
|
+
exports.ERROR_MESSAGES_SYSTEM_PROMPT = ERROR_MESSAGES_SYSTEM_PROMPT;
|
|
44
|
+
function buildErrorMessagesPrompt(input) {
|
|
45
|
+
return `Extract visible structurally-marked error messages from this excerpt.
|
|
46
|
+
|
|
47
|
+
BODY HTML EXCERPT:
|
|
48
|
+
${input.bodyHtmlExcerpt}`;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Run the error-messages judge. Returns a list of structurally-marked
|
|
52
|
+
* error messages with field hints and severity. Returns null when the
|
|
53
|
+
* client is null (Bedrock-only) or the API call fails — callers fall back
|
|
54
|
+
* to an empty list.
|
|
55
|
+
*/
|
|
56
|
+
async function judgeErrorMessagesWithLLM(params) {
|
|
57
|
+
const { client, input, captureFn } = params;
|
|
58
|
+
if (client === null)
|
|
59
|
+
return null;
|
|
60
|
+
if (input.bodyHtmlExcerpt.length === 0)
|
|
61
|
+
return null;
|
|
62
|
+
const result = await (0, judge_1.callHaikuJudge)({
|
|
63
|
+
client,
|
|
64
|
+
systemPrompt: ERROR_MESSAGES_SYSTEM_PROMPT,
|
|
65
|
+
userPrompt: buildErrorMessagesPrompt(input),
|
|
66
|
+
schema: schemas_1.ERROR_MESSAGES_SCHEMA,
|
|
67
|
+
callType: call_types_1.CALL_TYPE_JUDGE_ERROR_MESSAGES,
|
|
68
|
+
captureFn,
|
|
69
|
+
});
|
|
70
|
+
return result?.parsed ?? null;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=error-messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-messages.js","sourceRoot":"","sources":["../../../../src/lib/llm/judges/error-messages.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AA+CH,8DAiBC;AA3DD,2CAAsE;AACtE,+CAA0D;AAC1D,2DAA4E;AAE5E,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;uFAkBkD,CAAC;AAuC/E,oEAA4B;AAhCrC,SAAS,wBAAwB,CAAC,KAA8B;IAC9D,OAAO;;;EAGP,KAAK,CAAC,eAAe,EAAE,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,yBAAyB,CAAC,MAI/C;IACC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAC5C,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACjC,IAAI,KAAK,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACpD,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAc,EAAC;QAClC,MAAM;QACN,YAAY,EAAE,4BAA4B;QAC1C,UAAU,EAAE,wBAAwB,CAAC,KAAK,CAAC;QAC3C,MAAM,EAAE,+BAAqB;QAC7B,QAAQ,EAAE,2CAA8B;QACxC,SAAS;KACV,CAAC,CAAC;IACH,OAAO,MAAM,EAAE,MAAM,IAAI,IAAI,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Invalid-fields detection judge. Replaces the framework-conventional
|
|
3
|
+
* regex `INVALID_CLASS_RX` (matching Angular ng-invalid, Material
|
|
4
|
+
* mat-form-field-invalid, Bootstrap is-invalid, etc) with a Haiku 4.5
|
|
5
|
+
* structured-output call.
|
|
6
|
+
*
|
|
7
|
+
* Why: the regex covered Angular and Bootstrap conventions but silently
|
|
8
|
+
* missed React Hook Form (aria-invalid attribute), Mantine (data-invalid),
|
|
9
|
+
* Chakra (aria-invalid), HTML5 native :invalid (no class added), Tailwind
|
|
10
|
+
* form libraries, and arbitrary site-specific markers. When the regex
|
|
11
|
+
* missed, the rephrase prompt saw `(none)` in its FORM FIELDS section and
|
|
12
|
+
* the cascade lost the V4-C redirect signal.
|
|
13
|
+
*
|
|
14
|
+
* The judge looks at a body-HTML excerpt + a list of structured field
|
|
15
|
+
* candidates (tag + class + aria attributes) and decides whether each
|
|
16
|
+
* candidate is structurally invalid (class containing "invalid",
|
|
17
|
+
* aria-invalid="true", data-invalid, or near a semantic error container).
|
|
18
|
+
* Visual-only styling does NOT count.
|
|
19
|
+
*/
|
|
20
|
+
import type Anthropic from "@anthropic-ai/sdk";
|
|
21
|
+
import type { z } from "zod/v4";
|
|
22
|
+
import { type JudgeCaptureFn } from "../../../lib/llm/judge";
|
|
23
|
+
import { INVALID_FIELDS_SCHEMA } from "../../../lib/llm/schemas";
|
|
24
|
+
declare const INVALID_FIELDS_SYSTEM_PROMPT = "You are a strict invalid-field detector for browser forms. Given a body-HTML excerpt and (optionally) site-specific class-name prefixes, identify form fields that are structurally in an invalid/error state.\n\nStrict criteria for present=true (mark a field):\n- The container has a class containing \"invalid\" (e.g. ng-invalid, mat-form-field-invalid, is-invalid, field-invalid, app-input-invalid, etc.), OR\n- The element has aria-invalid=\"true\", OR\n- The element has data-invalid (truthy), OR\n- The container is structurally adjacent to an error-message container (class containing \"error\", \"validation\", \"feedback\", \"required\", \"help-block-error\", etc.), OR\n- The element is structurally adjacent to a visible error-text span/div that explains why it's invalid.\n\nDo NOT mark a field when:\n- Only visual styling indicates error (red border via CSS, no semantic marker).\n- The container is in a pristine/untouched state (e.g. ng-pristine ng-untouched alongside ng-invalid means the user hasn't interacted yet \u2014 that's a \"may become invalid\" state, not currently invalid).\n- The element is a hidden input or non-interactive ancestor.\n- The container is invalid ONLY because a descendant is invalid (parent-bubbled invalidity). Angular bubbles ng-invalid up to wrapping forms / lists / question containers; Bootstrap mirrors this on form-group; React Hook Form propagates aria-invalid through fieldsets. When you see <ol class=\"ng-invalid\"> with <li class=\"ng-valid\"> children where ONE deeper descendant is actually invalid, report ONLY the deepest leaf that carries the failure. The leaf is the smallest container with the invalid marker AND no further invalid descendants. Reporting bubbled parents alongside the real leaf creates false positives (the parent's children look like they're invalid when they are not).\n\nWhen the supplied knownErrorClassPrefixes list is non-empty, also treat class names starting with any of those prefixes followed by \"-invalid\" or \"-error\" as structural markers (site-specific convention).\n\nReturn up to 50 fields. Top-level present=true means at least one field is currently invalid. present=false means no structural invalid markers found anywhere in the excerpt.\n\nEach field entry:\n- containerXpath: a best-effort xpath identifying the container (tag + nth-of-type)\n- label: the visible label text near the field, or null if not discoverable\n- markerKind: which marker type triggered (\"class\", \"aria\", \"data\", \"error-container\", \"other\")\n- framework: which UI library this looks like (\"angular\", \"react\", \"vue\", \"mantine\", \"chakra\", \"bootstrap\", \"other\"). Look at framework-conventional class signatures to decide.";
|
|
25
|
+
export interface JudgeInvalidFieldsInput {
|
|
26
|
+
/** Body HTML excerpt to scan (typically the page DOM, truncated to ~8KB). */
|
|
27
|
+
bodyHtmlExcerpt: string;
|
|
28
|
+
/** Site-supplied class-name prefixes that wrap error/invalid state (e.g. ["uapp-", "app-"]). */
|
|
29
|
+
knownErrorClassPrefixes: readonly string[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Run the invalid-fields judge. Returns the parsed verdict (a list of
|
|
33
|
+
* detected invalid containers + a top-level present boolean). Returns null
|
|
34
|
+
* when the client is null (Bedrock-only) or when the API call fails —
|
|
35
|
+
* callers fall back to a conservative "no invalid markers detected" default.
|
|
36
|
+
*/
|
|
37
|
+
export declare function judgeInvalidFieldsWithLLM(params: {
|
|
38
|
+
client: Anthropic | null;
|
|
39
|
+
input: JudgeInvalidFieldsInput;
|
|
40
|
+
captureFn?: JudgeCaptureFn;
|
|
41
|
+
}): Promise<z.infer<typeof INVALID_FIELDS_SCHEMA> | null>;
|
|
42
|
+
export { INVALID_FIELDS_SYSTEM_PROMPT };
|
|
43
|
+
//# sourceMappingURL=invalid-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invalid-fields.d.ts","sourceRoot":"","sources":["../../../../src/lib/llm/judges/invalid-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,QAAA,MAAM,4BAA4B,uqFAuB+I,CAAC;AAElL,MAAM,WAAW,uBAAuB;IACtC,6EAA6E;IAC7E,eAAe,EAAE,MAAM,CAAC;IACxB,gGAAgG;IAChG,uBAAuB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAWD;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE;IACtD,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,uBAAuB,CAAC;IAC/B,SAAS,CAAC,EAAE,cAAc,CAAC;CAC5B,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,GAAG,IAAI,CAAC,CAYxD;AAED,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Invalid-fields detection judge. Replaces the framework-conventional
|
|
4
|
+
* regex `INVALID_CLASS_RX` (matching Angular ng-invalid, Material
|
|
5
|
+
* mat-form-field-invalid, Bootstrap is-invalid, etc) with a Haiku 4.5
|
|
6
|
+
* structured-output call.
|
|
7
|
+
*
|
|
8
|
+
* Why: the regex covered Angular and Bootstrap conventions but silently
|
|
9
|
+
* missed React Hook Form (aria-invalid attribute), Mantine (data-invalid),
|
|
10
|
+
* Chakra (aria-invalid), HTML5 native :invalid (no class added), Tailwind
|
|
11
|
+
* form libraries, and arbitrary site-specific markers. When the regex
|
|
12
|
+
* missed, the rephrase prompt saw `(none)` in its FORM FIELDS section and
|
|
13
|
+
* the cascade lost the V4-C redirect signal.
|
|
14
|
+
*
|
|
15
|
+
* The judge looks at a body-HTML excerpt + a list of structured field
|
|
16
|
+
* candidates (tag + class + aria attributes) and decides whether each
|
|
17
|
+
* candidate is structurally invalid (class containing "invalid",
|
|
18
|
+
* aria-invalid="true", data-invalid, or near a semantic error container).
|
|
19
|
+
* Visual-only styling does NOT count.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.INVALID_FIELDS_SYSTEM_PROMPT = void 0;
|
|
23
|
+
exports.judgeInvalidFieldsWithLLM = judgeInvalidFieldsWithLLM;
|
|
24
|
+
const judge_1 = require("../../../lib/llm/judge");
|
|
25
|
+
const schemas_1 = require("../../../lib/llm/schemas");
|
|
26
|
+
const call_types_1 = require("../../../lib/telemetry/call-types");
|
|
27
|
+
const INVALID_FIELDS_SYSTEM_PROMPT = `You are a strict invalid-field detector for browser forms. Given a body-HTML excerpt and (optionally) site-specific class-name prefixes, identify form fields that are structurally in an invalid/error state.
|
|
28
|
+
|
|
29
|
+
Strict criteria for present=true (mark a field):
|
|
30
|
+
- The container has a class containing "invalid" (e.g. ng-invalid, mat-form-field-invalid, is-invalid, field-invalid, app-input-invalid, etc.), OR
|
|
31
|
+
- The element has aria-invalid="true", OR
|
|
32
|
+
- The element has data-invalid (truthy), OR
|
|
33
|
+
- The container is structurally adjacent to an error-message container (class containing "error", "validation", "feedback", "required", "help-block-error", etc.), OR
|
|
34
|
+
- The element is structurally adjacent to a visible error-text span/div that explains why it's invalid.
|
|
35
|
+
|
|
36
|
+
Do NOT mark a field when:
|
|
37
|
+
- Only visual styling indicates error (red border via CSS, no semantic marker).
|
|
38
|
+
- The container is in a pristine/untouched state (e.g. ng-pristine ng-untouched alongside ng-invalid means the user hasn't interacted yet — that's a "may become invalid" state, not currently invalid).
|
|
39
|
+
- The element is a hidden input or non-interactive ancestor.
|
|
40
|
+
- The container is invalid ONLY because a descendant is invalid (parent-bubbled invalidity). Angular bubbles ng-invalid up to wrapping forms / lists / question containers; Bootstrap mirrors this on form-group; React Hook Form propagates aria-invalid through fieldsets. When you see <ol class="ng-invalid"> with <li class="ng-valid"> children where ONE deeper descendant is actually invalid, report ONLY the deepest leaf that carries the failure. The leaf is the smallest container with the invalid marker AND no further invalid descendants. Reporting bubbled parents alongside the real leaf creates false positives (the parent's children look like they're invalid when they are not).
|
|
41
|
+
|
|
42
|
+
When the supplied knownErrorClassPrefixes list is non-empty, also treat class names starting with any of those prefixes followed by "-invalid" or "-error" as structural markers (site-specific convention).
|
|
43
|
+
|
|
44
|
+
Return up to 50 fields. Top-level present=true means at least one field is currently invalid. present=false means no structural invalid markers found anywhere in the excerpt.
|
|
45
|
+
|
|
46
|
+
Each field entry:
|
|
47
|
+
- containerXpath: a best-effort xpath identifying the container (tag + nth-of-type)
|
|
48
|
+
- label: the visible label text near the field, or null if not discoverable
|
|
49
|
+
- markerKind: which marker type triggered ("class", "aria", "data", "error-container", "other")
|
|
50
|
+
- framework: which UI library this looks like ("angular", "react", "vue", "mantine", "chakra", "bootstrap", "other"). Look at framework-conventional class signatures to decide.`;
|
|
51
|
+
exports.INVALID_FIELDS_SYSTEM_PROMPT = INVALID_FIELDS_SYSTEM_PROMPT;
|
|
52
|
+
function buildInvalidFieldsPrompt(input) {
|
|
53
|
+
return `Identify form fields currently in an invalid/error state.
|
|
54
|
+
|
|
55
|
+
KNOWN ERROR-CLASS PREFIXES (site-specific, optional): ${JSON.stringify(input.knownErrorClassPrefixes)}
|
|
56
|
+
|
|
57
|
+
BODY HTML EXCERPT:
|
|
58
|
+
${input.bodyHtmlExcerpt}`;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Run the invalid-fields judge. Returns the parsed verdict (a list of
|
|
62
|
+
* detected invalid containers + a top-level present boolean). Returns null
|
|
63
|
+
* when the client is null (Bedrock-only) or when the API call fails —
|
|
64
|
+
* callers fall back to a conservative "no invalid markers detected" default.
|
|
65
|
+
*/
|
|
66
|
+
async function judgeInvalidFieldsWithLLM(params) {
|
|
67
|
+
const { client, input, captureFn } = params;
|
|
68
|
+
if (client === null)
|
|
69
|
+
return null;
|
|
70
|
+
const result = await (0, judge_1.callHaikuJudge)({
|
|
71
|
+
client,
|
|
72
|
+
systemPrompt: INVALID_FIELDS_SYSTEM_PROMPT,
|
|
73
|
+
userPrompt: buildInvalidFieldsPrompt(input),
|
|
74
|
+
schema: schemas_1.INVALID_FIELDS_SCHEMA,
|
|
75
|
+
callType: call_types_1.CALL_TYPE_JUDGE_INVALID_FIELDS,
|
|
76
|
+
captureFn,
|
|
77
|
+
});
|
|
78
|
+
return result?.parsed ?? null;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=invalid-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invalid-fields.js","sourceRoot":"","sources":["../../../../src/lib/llm/judges/invalid-fields.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAwDH,8DAgBC;AAnED,2CAAsE;AACtE,+CAA0D;AAC1D,2DAA4E;AAE5E,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;iLAuB4I,CAAC;AA0CzK,oEAA4B;AAjCrC,SAAS,wBAAwB,CAAC,KAA8B;IAC9D,OAAO;;wDAE+C,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,uBAAuB,CAAC;;;EAGnG,KAAK,CAAC,eAAe,EAAE,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,yBAAyB,CAAC,MAI/C;IACC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAC5C,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACjC,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAc,EAAC;QAClC,MAAM;QACN,YAAY,EAAE,4BAA4B;QAC1C,UAAU,EAAE,wBAAwB,CAAC,KAAK,CAAC;QAC3C,MAAM,EAAE,+BAAqB;QAC7B,QAAQ,EAAE,2CAA8B;QACxC,SAAS;KACV,CAAC,CAAC;IACH,OAAO,MAAM,EAAE,MAAM,IAAI,IAAI,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modal-priority judge. Replaces the keyword regex
|
|
3
|
+
* `MODAL_PRIORITY_RX = /(modal|dialog|popup|overlay|drawer)/i` that
|
|
4
|
+
* matched Stagehand's English description strings.
|
|
5
|
+
*
|
|
6
|
+
* Why: the regex missed sheet, flyout, panel, sidebar, lightbox,
|
|
7
|
+
* cdk-overlay, radix-portal, app-prefixed variants, and any non-English
|
|
8
|
+
* description. When the regex missed, the rephrase prompt's UNFOCUSED
|
|
9
|
+
* OBSERVE section didn't bubble the blocking modal to the top — the
|
|
10
|
+
* LLM saw the form fields first and didn't realize a modal was in the
|
|
11
|
+
* way.
|
|
12
|
+
*
|
|
13
|
+
* The judge looks at the full unfocused-observe list and decides which
|
|
14
|
+
* entries are STRUCTURALLY blocking the form (modal with backdrop,
|
|
15
|
+
* dialog, overlay, popup) vs which are always-visible UI (sidebars,
|
|
16
|
+
* sticky headers, panels). Returns indices to bubble to the top.
|
|
17
|
+
*/
|
|
18
|
+
import type Anthropic from "@anthropic-ai/sdk";
|
|
19
|
+
import type { z } from "zod/v4";
|
|
20
|
+
import { type JudgeCaptureFn } from "../../../lib/llm/judge";
|
|
21
|
+
import { MODAL_PRIORITY_SCHEMA } from "../../../lib/llm/schemas";
|
|
22
|
+
declare const MODAL_PRIORITY_SYSTEM_PROMPT = "You are a strict modal-priority judge for browser-automation. Given a list of UI elements observed on the page (with English descriptions), identify which ones are STRUCTURALLY blocking modal/dialog/overlay components that need to be dismissed before the underlying form can be interacted with.\n\nStrict criteria for marking an index as priority:\n- Cookie consent banners (block the page until accepted/dismissed) \u2014 PRIORITY.\n- Welcome / sign-in modals with a dismiss action \u2014 PRIORITY.\n- Floating sheet/flyout/dialog/popup/overlay UIs covering form content \u2014 PRIORITY.\n- Lightbox image viewers \u2014 PRIORITY when they cover the form.\n- Drawer components when they're modal (block underlying interaction) \u2014 PRIORITY.\n\nDo NOT mark as priority:\n- Sidebars and navigation panels that are always visible by design.\n- Sticky headers / footers that don't block form interaction.\n- Tooltips / popovers that auto-dismiss on click outside.\n- Slide-out panels in responsive layouts when they're statically open.\n\nThe descriptions are English prose generated by Stagehand. Class names mentioned in the description (e.g. cdk-overlay, app-modal) are stronger evidence than keywords. Site-specific app-prefixed dialog/modal classes count as priority.\n\nReturn the indices (0-based) of priority items in the order they appear in the input. Max 50 items. Include a one-sentence rationale citing the strongest signal.";
|
|
23
|
+
export interface JudgeModalPriorityInput {
|
|
24
|
+
/** Each entry as it appears in the unfocused-observe list. Indices are 0-based. */
|
|
25
|
+
observations: {
|
|
26
|
+
description: string;
|
|
27
|
+
selector: string;
|
|
28
|
+
}[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Run the modal-priority judge. Returns priority indices + a rationale.
|
|
32
|
+
* Returns null when the client is null (Bedrock-only) or the API call
|
|
33
|
+
* fails — callers fall back to leaving the original order untouched.
|
|
34
|
+
*/
|
|
35
|
+
export declare function judgeModalPriorityWithLLM(params: {
|
|
36
|
+
client: Anthropic | null;
|
|
37
|
+
input: JudgeModalPriorityInput;
|
|
38
|
+
captureFn?: JudgeCaptureFn;
|
|
39
|
+
}): Promise<z.infer<typeof MODAL_PRIORITY_SCHEMA> | null>;
|
|
40
|
+
export { MODAL_PRIORITY_SYSTEM_PROMPT };
|
|
41
|
+
//# sourceMappingURL=modal-priority.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal-priority.d.ts","sourceRoot":"","sources":["../../../../src/lib/llm/judges/modal-priority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,SAAS,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,QAAA,MAAM,4BAA4B,k6CAiBgI,CAAC;AAEnK,MAAM,WAAW,uBAAuB;IACtC,mFAAmF;IACnF,YAAY,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC3D;AAYD;;;;GAIG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE;IACtD,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,uBAAuB,CAAC;IAC/B,SAAS,CAAC,EAAE,cAAc,CAAC;CAC5B,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,GAAG,IAAI,CAAC,CAaxD;AAED,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
|