@apifuse/provider-sdk 2.2.0-beta.3 → 2.2.0-beta.31
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/AUTHORING.md +493 -5
- package/CHANGELOG.md +131 -1
- package/README.md +52 -6
- package/SUBMISSION.md +1 -1
- package/bin/apifuse-check.ts +106 -62
- package/bin/apifuse-create.ts +1 -1
- package/bin/apifuse-dev.ts +63 -55
- package/bin/apifuse-pack-check.ts +22 -2
- package/bin/apifuse-pack-smoke.ts +78 -82
- package/bin/apifuse-pack-types.ts +583 -0
- package/bin/apifuse-perf.ts +59 -140
- package/bin/apifuse-record.ts +698 -113
- package/bin/apifuse-submit-check.ts +517 -44
- package/bin/apifuse-sync-assets.ts +117 -0
- package/bin/apifuse.ts +1 -1
- package/bin/submit-check-delimited-text.ts +50 -0
- package/bin/submit-check-xml.ts +1 -1
- package/dist/auth-turn/index.d.ts +4 -4
- package/dist/auth-turn/index.js +1 -1
- package/dist/auth.d.ts +16 -2
- package/dist/auth.js +76 -18
- package/dist/ceremonies/index.d.ts +9 -1
- package/dist/ceremonies/index.js +117 -29
- package/dist/cli/commands.d.ts +1 -1
- package/dist/cli/commands.js +8 -0
- package/dist/cli/create.d.ts +3 -0
- package/dist/cli/create.js +34 -35
- package/dist/cli/prompt-assets.d.ts +80 -0
- package/dist/cli/prompt-assets.js +743 -0
- package/dist/cli/templates/provider/AGENTS.md.tpl +17 -8
- package/dist/cli/templates/provider/README.md.tpl +4 -4
- package/dist/config/loader.d.ts +176 -17
- package/dist/config/loader.js +434 -161
- package/dist/contract-serialization.d.ts +2 -2
- package/dist/contract-serialization.js +7 -14
- package/dist/contract-types.d.ts +3 -2
- package/dist/contract.d.ts +3 -3
- package/dist/contract.js +6 -6
- package/dist/declaration-validation.d.ts +23 -0
- package/dist/declaration-validation.js +159 -0
- package/dist/define.d.ts +13 -1
- package/dist/define.js +391 -122
- package/dist/dev.d.ts +1 -1
- package/dist/dev.js +1 -1
- package/dist/error-resolution.d.ts +4 -0
- package/dist/error-resolution.js +123 -0
- package/dist/errors.d.ts +19 -1
- package/dist/errors.js +41 -3
- package/dist/fixture-sanitization.d.ts +26 -0
- package/dist/fixture-sanitization.js +216 -0
- package/dist/i18n/catalog.d.ts +2 -2
- package/dist/i18n/catalog.js +4 -10
- package/dist/i18n/index.d.ts +2 -2
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/keys.d.ts +2 -2
- package/dist/index.d.ts +50 -42
- package/dist/index.js +41 -37
- package/dist/lint.d.ts +6 -1
- package/dist/lint.js +370 -18
- package/dist/native-address.d.ts +43 -0
- package/dist/native-address.js +281 -0
- package/dist/native-egress-policy.d.ts +31 -0
- package/dist/native-egress-policy.js +288 -0
- package/dist/observability.d.ts +5 -2
- package/dist/observability.js +48 -1
- package/dist/provider.d.ts +13 -11
- package/dist/provider.js +10 -9
- package/dist/public-schema-field-lint.d.ts +1 -1
- package/dist/recipes/gov-api.js +1 -1
- package/dist/runtime/auth-flow.d.ts +3 -1
- package/dist/runtime/auth-flow.js +8 -3
- package/dist/runtime/browser.d.ts +1 -1
- package/dist/runtime/browser.js +138 -40
- package/dist/runtime/cache.d.ts +2 -1
- package/dist/runtime/cache.js +173 -23
- package/dist/runtime/choice-wordlist.d.ts +9 -0
- package/dist/runtime/choice-wordlist.js +138 -0
- package/dist/runtime/choice.d.ts +14 -1
- package/dist/runtime/choice.js +566 -101
- package/dist/runtime/credential.d.ts +1 -1
- package/dist/runtime/credential.js +1 -1
- package/dist/runtime/env.d.ts +1 -1
- package/dist/runtime/executor.d.ts +1 -1
- package/dist/runtime/executor.js +25 -3
- package/dist/runtime/http.d.ts +3 -2
- package/dist/runtime/http.js +517 -55
- package/dist/runtime/insights.d.ts +1 -1
- package/dist/runtime/insights.js +6 -13
- package/dist/runtime/instrumentation.d.ts +2 -2
- package/dist/runtime/instrumentation.js +371 -23
- package/dist/runtime/keyring.js +1 -1
- package/dist/runtime/namespace.js +1 -1
- package/dist/runtime/native-network-errors.d.ts +33 -0
- package/dist/runtime/native-network-errors.js +69 -0
- package/dist/runtime/native-network.d.ts +96 -0
- package/dist/runtime/native-network.js +1232 -0
- package/dist/runtime/ocr.d.ts +29 -0
- package/dist/runtime/ocr.js +440 -0
- package/dist/runtime/otlp.d.ts +1 -1
- package/dist/runtime/perf.d.ts +1 -1
- package/dist/runtime/provider.d.ts +1 -1
- package/dist/runtime/provider.js +1 -2
- package/dist/runtime/proxy-errors.d.ts +1 -1
- package/dist/runtime/proxy-errors.js +9 -7
- package/dist/runtime/proxy-nodemaven.d.ts +56 -0
- package/dist/runtime/proxy-nodemaven.js +146 -0
- package/dist/runtime/proxy-retry-policy.d.ts +2 -2
- package/dist/runtime/proxy-retry-policy.js +2 -2
- package/dist/runtime/proxy-telemetry.d.ts +2 -1
- package/dist/runtime/proxy-telemetry.js +58 -52
- package/dist/runtime/redirects.d.ts +29 -0
- package/dist/runtime/redirects.js +36 -0
- package/dist/runtime/redis.d.ts +1 -1
- package/dist/runtime/redis.js +5 -5
- package/dist/runtime/request-options.d.ts +68 -1
- package/dist/runtime/request-options.js +548 -0
- package/dist/runtime/resolver-config.d.ts +6 -0
- package/dist/runtime/resolver-config.js +6 -0
- package/dist/runtime/resolver-public.d.ts +1 -0
- package/dist/runtime/resolver-public.js +1 -0
- package/dist/runtime/resolver-shared.d.ts +3 -0
- package/dist/runtime/resolver-shared.js +12 -0
- package/dist/runtime/resolver-vendors/bindings.d.ts +48 -0
- package/dist/runtime/resolver-vendors/bindings.js +40 -0
- package/dist/runtime/resolver-vendors/browser.d.ts +20 -0
- package/dist/runtime/resolver-vendors/browser.js +282 -0
- package/dist/runtime/resolver-vendors/hosts.d.ts +2 -0
- package/dist/runtime/resolver-vendors/hosts.js +33 -0
- package/dist/runtime/resolver-vendors/twocaptcha.d.ts +24 -0
- package/dist/runtime/resolver-vendors/twocaptcha.js +368 -0
- package/dist/runtime/resolver-vendors/types.d.ts +83 -0
- package/dist/runtime/resolver-vendors/types.js +69 -0
- package/dist/runtime/resolver.d.ts +59 -0
- package/dist/runtime/resolver.js +705 -0
- package/dist/runtime/secrets.d.ts +27 -0
- package/dist/runtime/secrets.js +51 -0
- package/dist/runtime/state.d.ts +5 -2
- package/dist/runtime/state.js +280 -74
- package/dist/runtime/stealth-cookies.d.ts +20 -0
- package/dist/runtime/stealth-cookies.js +111 -0
- package/dist/runtime/stealth.d.ts +30 -5
- package/dist/runtime/stealth.js +523 -259
- package/dist/runtime/stt.d.ts +1 -1
- package/dist/runtime/stt.js +12 -27
- package/dist/runtime/timeout.d.ts +5 -0
- package/dist/runtime/timeout.js +12 -0
- package/dist/runtime/trace.d.ts +2 -2
- package/dist/runtime/trace.js +2 -4
- package/dist/runtime/waterfall.d.ts +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +7 -15
- package/dist/serve.d.ts +1 -1
- package/dist/serve.js +1 -1
- package/dist/server/index.d.ts +7 -7
- package/dist/server/index.js +6 -6
- package/dist/server/self-test-input-tokens.d.ts +2 -1
- package/dist/server/self-test-input-tokens.js +18 -14
- package/dist/server/self-test-redaction.d.ts +1 -1
- package/dist/server/self-test-redaction.js +1 -1
- package/dist/server/self-test.d.ts +117 -3
- package/dist/server/self-test.js +787 -151
- package/dist/server/serve-implementation.d.ts +210 -0
- package/dist/server/serve-implementation.js +2078 -0
- package/dist/server/serve.d.ts +1 -70
- package/dist/server/serve.js +1 -1143
- package/dist/server/types.d.ts +34 -9
- package/dist/server/types.js +8 -1
- package/dist/stateful/errors.d.ts +19 -0
- package/dist/stateful/errors.js +24 -0
- package/dist/stateful/http-provider-event-emitter.d.ts +40 -0
- package/dist/stateful/http-provider-event-emitter.js +237 -0
- package/dist/stateful/http-session-owner-registry.d.ts +44 -0
- package/dist/stateful/http-session-owner-registry.js +210 -0
- package/dist/stateful/index.d.ts +18 -0
- package/dist/stateful/index.js +18 -0
- package/dist/stateful/provider-event-delivery-failures.d.ts +32 -0
- package/dist/stateful/provider-event-delivery-failures.js +43 -0
- package/dist/stateful/provider-event-pipeline-metrics.d.ts +46 -0
- package/dist/stateful/provider-event-pipeline-metrics.js +48 -0
- package/dist/stateful/provider-event-pipeline.d.ts +50 -0
- package/dist/stateful/provider-event-pipeline.js +1 -0
- package/dist/stateful/provider-events.d.ts +101 -0
- package/dist/stateful/provider-events.js +289 -0
- package/dist/stateful/session-key.d.ts +15 -0
- package/dist/stateful/session-key.js +86 -0
- package/dist/stateful/stateful-provider-adapter-context.d.ts +5 -0
- package/dist/stateful/stateful-provider-adapter-context.js +42 -0
- package/dist/stateful/stateful-provider-adapter-metrics.d.ts +15 -0
- package/dist/stateful/stateful-provider-adapter-metrics.js +21 -0
- package/dist/stateful/stateful-provider-adapter.d.ts +98 -0
- package/dist/stateful/stateful-provider-adapter.js +287 -0
- package/dist/stateful/stateful-provider-observability.d.ts +62 -0
- package/dist/stateful/stateful-provider-observability.js +161 -0
- package/dist/stateful/stateful-provider-owner-forwarder.d.ts +41 -0
- package/dist/stateful/stateful-provider-owner-forwarder.js +215 -0
- package/dist/stateful/stateful-provider-runtime-context.d.ts +32 -0
- package/dist/stateful/stateful-provider-runtime-context.js +60 -0
- package/dist/stateful/stateful-provider-runtime-executor.d.ts +34 -0
- package/dist/stateful/stateful-provider-runtime-executor.js +52 -0
- package/dist/stateful/stateful-provider-session-routing.d.ts +67 -0
- package/dist/stateful/stateful-provider-session-routing.js +345 -0
- package/dist/stateful/stateful-provider-session-runtime.d.ts +98 -0
- package/dist/stateful/stateful-provider-session-runtime.js +245 -0
- package/dist/stateful-signing.d.ts +18 -0
- package/dist/stateful-signing.js +27 -0
- package/dist/stealth/profiles.d.ts +1 -1
- package/dist/stealth/profiles.js +21 -21
- package/dist/stream-evidence.d.ts +74 -0
- package/dist/stream-evidence.js +785 -0
- package/dist/stream.d.ts +1 -1
- package/dist/stream.js +7 -1
- package/dist/testing/index.d.ts +3 -2
- package/dist/testing/index.js +3 -2
- package/dist/testing/run.d.ts +32 -2
- package/dist/testing/run.js +488 -28
- package/dist/types.d.ts +566 -19
- package/dist/types.js +1 -0
- package/dist/user-input.d.ts +30 -0
- package/dist/user-input.js +66 -0
- package/package.json +42 -7
- package/src/auth-turn/index.ts +2 -2
- package/src/auth.ts +146 -86
- package/src/ceremonies/index.ts +167 -92
- package/src/cli/commands.ts +10 -0
- package/src/cli/create.ts +42 -35
- package/src/cli/prompt-assets.ts +865 -0
- package/src/cli/templates/provider/AGENTS.md.tpl +17 -8
- package/src/cli/templates/provider/README.md.tpl +4 -4
- package/src/config/loader.ts +667 -289
- package/src/contract-serialization.ts +10 -18
- package/src/contract-types.ts +3 -2
- package/src/contract.ts +14 -28
- package/src/declaration-validation.ts +202 -0
- package/src/define.ts +631 -495
- package/src/dev.ts +4 -9
- package/src/error-resolution.ts +128 -0
- package/src/errors.ts +56 -11
- package/src/fixture-sanitization.ts +247 -0
- package/src/i18n/catalog.ts +10 -32
- package/src/i18n/index.ts +2 -2
- package/src/i18n/keys.ts +5 -11
- package/src/index.ts +158 -44
- package/src/lint.ts +488 -154
- package/src/native-address.ts +340 -0
- package/src/native-egress-policy.ts +358 -0
- package/src/observability.ts +51 -1
- package/src/provider.ts +66 -11
- package/src/public-schema-field-lint.ts +7 -33
- package/src/recipes/gov-api.ts +2 -5
- package/src/runtime/auth-flow.ts +13 -7
- package/src/runtime/browser.ts +252 -207
- package/src/runtime/cache.ts +209 -81
- package/src/runtime/choice-wordlist.ts +145 -0
- package/src/runtime/choice.ts +758 -197
- package/src/runtime/credential.ts +2 -2
- package/src/runtime/env.ts +1 -1
- package/src/runtime/executor.ts +37 -19
- package/src/runtime/http.ts +645 -65
- package/src/runtime/insights.ts +15 -53
- package/src/runtime/instrumentation.ts +530 -67
- package/src/runtime/keyring.ts +7 -19
- package/src/runtime/namespace.ts +2 -7
- package/src/runtime/native-network-errors.ts +99 -0
- package/src/runtime/native-network.ts +1605 -0
- package/src/runtime/ocr.ts +523 -0
- package/src/runtime/otlp.ts +12 -23
- package/src/runtime/perf.ts +1 -1
- package/src/runtime/provider.ts +4 -9
- package/src/runtime/proxy-errors.ts +29 -42
- package/src/runtime/proxy-nodemaven.ts +221 -0
- package/src/runtime/proxy-retry-policy.ts +3 -3
- package/src/runtime/proxy-telemetry.ts +84 -77
- package/src/runtime/redirects.ts +66 -0
- package/src/runtime/redis.ts +10 -13
- package/src/runtime/request-options.ts +679 -9
- package/src/runtime/resolver-config.ts +6 -0
- package/src/runtime/resolver-public.ts +18 -0
- package/src/runtime/resolver-shared.ts +17 -0
- package/src/runtime/resolver-vendors/bindings.ts +56 -0
- package/src/runtime/resolver-vendors/browser.ts +408 -0
- package/src/runtime/resolver-vendors/hosts.ts +38 -0
- package/src/runtime/resolver-vendors/twocaptcha.ts +500 -0
- package/src/runtime/resolver-vendors/types.ts +173 -0
- package/src/runtime/resolver.ts +1060 -0
- package/src/runtime/secrets.ts +64 -0
- package/src/runtime/state.ts +399 -161
- package/src/runtime/stealth-cookies.ts +132 -0
- package/src/runtime/stealth.ts +681 -295
- package/src/runtime/stt.ts +39 -113
- package/src/runtime/timeout.ts +18 -0
- package/src/runtime/trace.ts +14 -44
- package/src/runtime/waterfall.ts +5 -18
- package/src/schema.ts +23 -84
- package/src/serve.ts +6 -1
- package/src/server/index.ts +30 -7
- package/src/server/self-test-input-tokens.ts +29 -14
- package/src/server/self-test-redaction.ts +2 -2
- package/src/server/self-test.ts +1030 -180
- package/src/server/serve-implementation.ts +3062 -0
- package/src/server/serve.ts +1 -1781
- package/src/server/types.ts +12 -13
- package/src/stateful/README.md +146 -0
- package/src/stateful/errors.ts +35 -0
- package/src/stateful/http-provider-event-emitter.ts +314 -0
- package/src/stateful/http-session-owner-registry.ts +306 -0
- package/src/stateful/index.ts +18 -0
- package/src/stateful/provider-event-delivery-failures.ts +80 -0
- package/src/stateful/provider-event-pipeline-metrics.ts +95 -0
- package/src/stateful/provider-event-pipeline.ts +61 -0
- package/src/stateful/provider-events.ts +462 -0
- package/src/stateful/session-key.ts +111 -0
- package/src/stateful/stateful-provider-adapter-context.ts +59 -0
- package/src/stateful/stateful-provider-adapter-metrics.ts +48 -0
- package/src/stateful/stateful-provider-adapter.ts +562 -0
- package/src/stateful/stateful-provider-observability.ts +261 -0
- package/src/stateful/stateful-provider-owner-forwarder.ts +287 -0
- package/src/stateful/stateful-provider-runtime-context.ts +92 -0
- package/src/stateful/stateful-provider-runtime-executor.ts +96 -0
- package/src/stateful/stateful-provider-session-routing.ts +546 -0
- package/src/stateful/stateful-provider-session-runtime.ts +403 -0
- package/src/stateful-signing.ts +46 -0
- package/src/stealth/profiles.ts +27 -33
- package/src/stream-evidence.ts +988 -0
- package/src/stream.ts +16 -20
- package/src/testing/index.ts +11 -2
- package/src/testing/run.ts +668 -74
- package/src/types.ts +665 -35
- package/src/user-input.ts +118 -0
- package/dist/cli/templates/provider/CLAUDE.md.tpl +0 -1
- package/src/cli/templates/provider/CLAUDE.md.tpl +0 -1
- /package/dist/cli/templates/provider/{skills → .agents/skills}/fixtures-and-recording/SKILL.md.tpl +0 -0
- /package/dist/cli/templates/provider/{skills → .agents/skills}/health-checks-and-fail-closed/SKILL.md.tpl +0 -0
- /package/dist/cli/templates/provider/{skills → .agents/skills}/normalization-standards/SKILL.md.tpl +0 -0
- /package/dist/cli/templates/provider/{skills → .agents/skills}/pagination-and-counts/SKILL.md.tpl +0 -0
- /package/dist/cli/templates/provider/{skills → .agents/skills}/upstream-contract-verification/SKILL.md.tpl +0 -0
- /package/dist/cli/templates/provider/{skills → .agents/skills}/upstream-notes/README.md.tpl +0 -0
- /package/src/cli/templates/provider/{skills → .agents/skills}/fixtures-and-recording/SKILL.md.tpl +0 -0
- /package/src/cli/templates/provider/{skills → .agents/skills}/health-checks-and-fail-closed/SKILL.md.tpl +0 -0
- /package/src/cli/templates/provider/{skills → .agents/skills}/normalization-standards/SKILL.md.tpl +0 -0
- /package/src/cli/templates/provider/{skills → .agents/skills}/pagination-and-counts/SKILL.md.tpl +0 -0
- /package/src/cli/templates/provider/{skills → .agents/skills}/upstream-contract-verification/SKILL.md.tpl +0 -0
- /package/src/cli/templates/provider/{skills → .agents/skills}/upstream-notes/README.md.tpl +0 -0
package/src/types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type ms from "ms";
|
|
2
|
+
import type { SerializedCookieJar } from "tough-cookie";
|
|
2
3
|
|
|
3
4
|
import type { infer as ZodInfer, ZodType } from "zod";
|
|
4
5
|
|
|
@@ -62,6 +63,8 @@ export interface OperationToolRouterMetadata {
|
|
|
62
63
|
riskClass?: OperationRiskClass;
|
|
63
64
|
/** OpenAI remote-MCP approval hint. Defaults from riskClass. */
|
|
64
65
|
approval?: OperationApprovalPolicy;
|
|
66
|
+
/** Canonical operation-level connection requirement consumed by the registry and Gateway. */
|
|
67
|
+
connectionMode?: "none" | "optional" | "required";
|
|
65
68
|
/** Override connection requirement when provider auth + openWorld inference is insufficient. */
|
|
66
69
|
requiresConnection?: boolean;
|
|
67
70
|
/** Public argument used to resolve the tenant-owned connection. Defaults to externalRef. */
|
|
@@ -210,14 +213,14 @@ export type SmsOrigin =
|
|
|
210
213
|
kind: "e164";
|
|
211
214
|
value: E164PhoneNumber;
|
|
212
215
|
display?: string;
|
|
213
|
-
|
|
216
|
+
}
|
|
214
217
|
| {
|
|
215
218
|
/** Country-local service sender, for example KR 1661-5270. */
|
|
216
219
|
kind: "nationalServiceCode";
|
|
217
220
|
country: Iso3166Alpha2CountryCode;
|
|
218
221
|
value: string;
|
|
219
222
|
display?: string;
|
|
220
|
-
|
|
223
|
+
};
|
|
221
224
|
|
|
222
225
|
export interface SmsOtpExtractionPattern {
|
|
223
226
|
/** RegExp or source string containing exactly one usable OTP capture. */
|
|
@@ -240,6 +243,61 @@ export interface SmsOtpMatcherDefinition {
|
|
|
240
243
|
extractOtp(body: string): string | null;
|
|
241
244
|
}
|
|
242
245
|
|
|
246
|
+
export interface ProviderOcrConfig {
|
|
247
|
+
readonly mode: "required" | "optional";
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export type OcrImageInput =
|
|
251
|
+
| { readonly kind: "base64"; readonly data: string; readonly mediaType?: string }
|
|
252
|
+
| { readonly kind: "url"; readonly url: string };
|
|
253
|
+
|
|
254
|
+
export interface OcrRecognizeRequest {
|
|
255
|
+
readonly image: OcrImageInput;
|
|
256
|
+
readonly hint?: "captcha" | "document" | "generic";
|
|
257
|
+
readonly prompt?: string;
|
|
258
|
+
readonly maxTokens?: number;
|
|
259
|
+
readonly timeoutMs?: number;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface OcrWarning {
|
|
263
|
+
readonly code: string;
|
|
264
|
+
readonly message: string;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export interface OcrResult {
|
|
268
|
+
readonly text: string;
|
|
269
|
+
readonly model: string;
|
|
270
|
+
readonly warnings?: readonly OcrWarning[];
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export interface OcrCaptchaOptions {
|
|
274
|
+
readonly length?: number;
|
|
275
|
+
/** Allowed characters. A RegExp is applied to each character, not to the whole text. */
|
|
276
|
+
readonly charset?: string | RegExp;
|
|
277
|
+
readonly caseSensitive?: boolean;
|
|
278
|
+
readonly maxCandidates?: number;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export interface OcrCaptchaCandidate {
|
|
282
|
+
readonly text: string;
|
|
283
|
+
readonly satisfiesConstraints: boolean;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export interface OcrCaptchaResult {
|
|
287
|
+
readonly text: string;
|
|
288
|
+
readonly candidates: readonly OcrCaptchaCandidate[];
|
|
289
|
+
readonly satisfiesConstraints: boolean;
|
|
290
|
+
readonly model: string;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export interface OcrContext {
|
|
294
|
+
recognize(request: OcrRecognizeRequest): Promise<OcrResult>;
|
|
295
|
+
extractCaptchaText(
|
|
296
|
+
image: OcrImageInput,
|
|
297
|
+
options?: OcrCaptchaOptions,
|
|
298
|
+
): Promise<OcrCaptchaResult>;
|
|
299
|
+
}
|
|
300
|
+
|
|
243
301
|
export type SttTranscribeMode = "general" | "otp";
|
|
244
302
|
export type SttPromptPolicy = "none" | "default-hint" | "custom-hint";
|
|
245
303
|
export type SttUnsupportedOptionPolicy = "warn" | "error";
|
|
@@ -249,6 +307,123 @@ export interface ProviderSttConfig {
|
|
|
249
307
|
mode: ProviderSttMode;
|
|
250
308
|
}
|
|
251
309
|
|
|
310
|
+
/**
|
|
311
|
+
* `browser` is the in-house CDP pool (`apps/cdp-pool`, reached through
|
|
312
|
+
* `createBrowserClient`) and is a first-class vendor rather than an escape hatch:
|
|
313
|
+
* for fingerprint-family kinds, it was measured faster than a paid vendor
|
|
314
|
+
* (4.5 s vs 17.5 s) at zero marginal cost.
|
|
315
|
+
*
|
|
316
|
+
* `2captcha` is the vendor already carrying production traffic in
|
|
317
|
+
* `apifuse-provider-tabelog`.
|
|
318
|
+
*
|
|
319
|
+
* Union order is documentation only; the effective fallback order is whatever
|
|
320
|
+
* `ProviderResolverConfig.vendors` declares.
|
|
321
|
+
*/
|
|
322
|
+
export type ProviderResolverVendor =
|
|
323
|
+
| "browser"
|
|
324
|
+
| "capsolver"
|
|
325
|
+
| "capmonster"
|
|
326
|
+
| "2captcha"
|
|
327
|
+
| "custom";
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Token-family kinds resolve to `{ form: "token" }`. Cookie-family kinds resolve
|
|
331
|
+
* to `{ form: "cookies" }`; network-identity binding is defined per kind. `aws_waf`
|
|
332
|
+
* was measured portable across residential leases on buyee, while `cf_clearance`
|
|
333
|
+
* remains unmeasured here and is treated as identity-scoped because it is widely
|
|
334
|
+
* described as IP-bound.
|
|
335
|
+
*/
|
|
336
|
+
export type ProviderChallenge =
|
|
337
|
+
| {
|
|
338
|
+
readonly kind: "turnstile";
|
|
339
|
+
readonly siteKey: string;
|
|
340
|
+
readonly pageUrl: string;
|
|
341
|
+
readonly action?: string;
|
|
342
|
+
readonly cdata?: string;
|
|
343
|
+
}
|
|
344
|
+
| {
|
|
345
|
+
readonly kind: "recaptcha_v2";
|
|
346
|
+
readonly siteKey: string;
|
|
347
|
+
readonly pageUrl: string;
|
|
348
|
+
}
|
|
349
|
+
| {
|
|
350
|
+
readonly kind: "recaptcha_v3";
|
|
351
|
+
readonly siteKey: string;
|
|
352
|
+
readonly pageUrl: string;
|
|
353
|
+
readonly action: string;
|
|
354
|
+
readonly minScore?: number;
|
|
355
|
+
}
|
|
356
|
+
| {
|
|
357
|
+
readonly kind: "hcaptcha";
|
|
358
|
+
readonly siteKey: string;
|
|
359
|
+
readonly pageUrl: string;
|
|
360
|
+
}
|
|
361
|
+
| {
|
|
362
|
+
readonly kind: "cloudflare_interstitial";
|
|
363
|
+
readonly pageUrl: string;
|
|
364
|
+
readonly blockedHtml?: string;
|
|
365
|
+
}
|
|
366
|
+
| {
|
|
367
|
+
readonly kind: "aws_waf";
|
|
368
|
+
readonly pageUrl: string;
|
|
369
|
+
/** `window.gokuProps.key`; solver vendors require it, while `"browser"` does not. */
|
|
370
|
+
readonly siteKey?: string;
|
|
371
|
+
readonly captchaScript?: string;
|
|
372
|
+
readonly context?: string;
|
|
373
|
+
readonly iv?: string;
|
|
374
|
+
}
|
|
375
|
+
| {
|
|
376
|
+
readonly kind: "akamai_sec_cpt";
|
|
377
|
+
readonly pageUrl: string;
|
|
378
|
+
/** The admitted challenge document, needed for tile/context extraction. */
|
|
379
|
+
readonly challengeHtml?: string;
|
|
380
|
+
}
|
|
381
|
+
| {
|
|
382
|
+
readonly kind: "akamai_sensor";
|
|
383
|
+
readonly pageUrl: string;
|
|
384
|
+
/** Upstream sensor script URL the payload must be POSTed to. */
|
|
385
|
+
readonly scriptUrl: string;
|
|
386
|
+
/** Current `_abck` cookie value, rotates each round. */
|
|
387
|
+
readonly abck?: string;
|
|
388
|
+
/** Current `bm_sz` / `ak_bmsc` value when the upstream set one. */
|
|
389
|
+
readonly bmsz?: string;
|
|
390
|
+
/** Bot Manager major version when known ("3" measured on zozo.jp). */
|
|
391
|
+
readonly version?: string;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
export type ProviderChallengeKind = ProviderChallenge["kind"];
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Token solutions carry no network-identity binding. Cookie-solution binding is
|
|
398
|
+
* per challenge kind: `aws_waf` was measured portable across residential leases
|
|
399
|
+
* on buyee, while `cf_clearance` is unmeasured here and treated as scoped to the
|
|
400
|
+
* identity that produced it. The provider attaches the returned cookies to its
|
|
401
|
+
* own requests.
|
|
402
|
+
*/
|
|
403
|
+
export type ChallengeSolution =
|
|
404
|
+
| { readonly form: "token"; readonly token: string }
|
|
405
|
+
| {
|
|
406
|
+
readonly form: "cookies";
|
|
407
|
+
readonly cookies: Readonly<Record<string, string>>;
|
|
408
|
+
readonly userAgent: string;
|
|
409
|
+
/** Epoch seconds copied from the upstream cookie's own expiry attribute; never a constant. */
|
|
410
|
+
readonly expires?: number;
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
export interface ProviderResolverConfig {
|
|
414
|
+
/** Ordered vendor fallback chain, tried first to last. */
|
|
415
|
+
readonly vendors: readonly ProviderResolverVendor[];
|
|
416
|
+
/** Challenge kinds this provider is permitted to request. */
|
|
417
|
+
readonly kinds: readonly ProviderChallengeKind[];
|
|
418
|
+
/**
|
|
419
|
+
* Client fingerprint profile the SDK must use when reaching this upstream.
|
|
420
|
+
* Measured on zozo.jp: Chrome/Firefox profiles are refused 403 before any
|
|
421
|
+
* challenge is served, while a Safari profile is admitted. Provider-declared
|
|
422
|
+
* because only the provider knows its upstream's admission rule.
|
|
423
|
+
*/
|
|
424
|
+
readonly clientProfile?: string;
|
|
425
|
+
}
|
|
426
|
+
|
|
252
427
|
export type SttAudioInput = {
|
|
253
428
|
kind: "base64";
|
|
254
429
|
data: string;
|
|
@@ -327,6 +502,10 @@ export interface SttContext {
|
|
|
327
502
|
): VerificationCodeExtractionResult;
|
|
328
503
|
}
|
|
329
504
|
|
|
505
|
+
export interface ResolverContext {
|
|
506
|
+
solve(challenge: ProviderChallenge, signal?: AbortSignal): Promise<ChallengeSolution>;
|
|
507
|
+
}
|
|
508
|
+
|
|
330
509
|
export interface HealthJourneySchedule {
|
|
331
510
|
kind: "interval";
|
|
332
511
|
/** ISO 8601 duration, for example PT8H. */
|
|
@@ -339,11 +518,11 @@ export type HealthScheduleRandomization =
|
|
|
339
518
|
| {
|
|
340
519
|
mode: "centered";
|
|
341
520
|
maxOffset: Iso8601Duration;
|
|
342
|
-
|
|
521
|
+
}
|
|
343
522
|
| {
|
|
344
523
|
mode: "delayed";
|
|
345
524
|
maxDelay: Iso8601Duration;
|
|
346
|
-
|
|
525
|
+
};
|
|
347
526
|
|
|
348
527
|
export interface HealthJourneyStep {
|
|
349
528
|
id: string;
|
|
@@ -458,7 +637,7 @@ export type HealthJourneyManualTriggerPolicy =
|
|
|
458
637
|
/** ISO 8601 duration. Minimum time between manual executions. */
|
|
459
638
|
minManualInterval: Iso8601Duration;
|
|
460
639
|
publicRationale: string;
|
|
461
|
-
|
|
640
|
+
};
|
|
462
641
|
|
|
463
642
|
export interface HealthJourneyRunResult {
|
|
464
643
|
status?: "ok" | "degraded" | "down" | "unknown";
|
|
@@ -478,9 +657,13 @@ export interface HealthJourneyDefinition {
|
|
|
478
657
|
requiredSecrets?: readonly string[];
|
|
479
658
|
manualTrigger?: HealthJourneyManualTriggerPolicy;
|
|
480
659
|
steps: readonly [HealthJourneyStep, ...HealthJourneyStep[]];
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
660
|
+
/**
|
|
661
|
+
* Required: a journey always declares `coversOperations`, and the health
|
|
662
|
+
* monitor reports a run-less journey as `journey_run_missing`. Declaration
|
|
663
|
+
* validation rejects a missing `run` (`health-journey-executable`), so this
|
|
664
|
+
* is typed required to fail at compile time rather than at boot.
|
|
665
|
+
*/
|
|
666
|
+
run: (ctx: HealthJourneyRunContext) => Promise<HealthJourneyRunResult | undefined>;
|
|
484
667
|
}
|
|
485
668
|
|
|
486
669
|
/**
|
|
@@ -718,9 +901,13 @@ export interface HealthMonitorProbeOverride {
|
|
|
718
901
|
degradedThresholdMs?: number;
|
|
719
902
|
}
|
|
720
903
|
|
|
904
|
+
export const VALID_OPERATION_ERROR_STATUSES = [400, 401, 404, 409, 410, 422, 429, 500, 502, 503, 504] as const;
|
|
905
|
+
|
|
906
|
+
export type ProviderErrorStatus = (typeof VALID_OPERATION_ERROR_STATUSES)[number];
|
|
907
|
+
|
|
721
908
|
export interface OperationErrorCode {
|
|
722
909
|
code: string;
|
|
723
|
-
status?:
|
|
910
|
+
status?: ProviderErrorStatus;
|
|
724
911
|
description: string;
|
|
725
912
|
retryable?: boolean;
|
|
726
913
|
}
|
|
@@ -759,7 +946,12 @@ export interface StealthProfile {
|
|
|
759
946
|
headerOrder?: string[];
|
|
760
947
|
}
|
|
761
948
|
|
|
762
|
-
export type AuthMode =
|
|
949
|
+
export type AuthMode =
|
|
950
|
+
| "none"
|
|
951
|
+
| "platform-managed"
|
|
952
|
+
| "credentials"
|
|
953
|
+
| "oauth2"
|
|
954
|
+
| "oauth2_proxied";
|
|
763
955
|
|
|
764
956
|
export type ConnectionMode = AuthMode;
|
|
765
957
|
|
|
@@ -769,7 +961,27 @@ export type ProviderAccessVisibility = "public" | "early_access";
|
|
|
769
961
|
|
|
770
962
|
export type ProviderProxyMode = "disabled" | "optional" | "required";
|
|
771
963
|
|
|
772
|
-
|
|
964
|
+
/**
|
|
965
|
+
* Proxy egress vendors. These are FOUR DISTINCT services — do not conflate them
|
|
966
|
+
* (a common mistake because the names collide with a well-known rebrand):
|
|
967
|
+
*
|
|
968
|
+
* - `smartproxy` — **api.smartproxy.org**, a residential proxy with an IP
|
|
969
|
+
* *extraction/allocation* API (app_key → a pool of raw `ip:port` CONNECT
|
|
970
|
+
* endpoints). This is our own vendor. It is NOT the company formerly named
|
|
971
|
+
* "Smartproxy". Credentials: `APIFUSE__PROXY__SMARTPROXY_APP_KEY`.
|
|
972
|
+
* - `nodemaven` — **gate.nodemaven.com**, a *gateway* proxy with static
|
|
973
|
+
* credentials; geo/session encoded in the username, no allocation API.
|
|
974
|
+
* - `decodo` — **decodo.com**, the *gateway* proxy that was named "Smartproxy"
|
|
975
|
+
* (smartproxy.com) before its 2025 rebrand to Decodo. Sticky sessions via
|
|
976
|
+
* username params. A different company from `smartproxy` above.
|
|
977
|
+
* **@deprecated** — unused; no managed adapter. Declare a
|
|
978
|
+
* `ProviderProxyPolicy` using `smartproxy` or `nodemaven` instead; the
|
|
979
|
+
* `smartproxy` allocator requires `APIFUSE__PROXY__SMARTPROXY_APP_KEY`.
|
|
980
|
+
* - `custom` — **@deprecated** static proxy marker with no managed adapter.
|
|
981
|
+
* Use `ProviderProxyPolicy` with `smartproxy`/`nodemaven`; the `smartproxy`
|
|
982
|
+
* allocator requires `APIFUSE__PROXY__SMARTPROXY_APP_KEY`.
|
|
983
|
+
*/
|
|
984
|
+
export type ProviderProxyProvider = "smartproxy" | "nodemaven" | "decodo" | "custom";
|
|
773
985
|
|
|
774
986
|
export type ProviderProxySessionAffinity =
|
|
775
987
|
| "request"
|
|
@@ -783,7 +995,18 @@ export interface ProviderProxyPolicy {
|
|
|
783
995
|
* certificate verification, and vendor allocator endpoints are SDK-owned.
|
|
784
996
|
*/
|
|
785
997
|
mode: ProviderProxyMode;
|
|
998
|
+
/**
|
|
999
|
+
* @deprecated Use `providers: [...]` to declare an ordered vendor fallback
|
|
1000
|
+
* chain. A single-element `providers` list is equivalent to this field.
|
|
1001
|
+
*/
|
|
786
1002
|
provider?: ProviderProxyProvider;
|
|
1003
|
+
/**
|
|
1004
|
+
* Ordered proxy-vendor fallback chain. The SDK tries each vendor in order and
|
|
1005
|
+
* fails over to the next when a vendor lacks credentials or its allocation /
|
|
1006
|
+
* transport is exhausted. When omitted, `provider` (or the platform default)
|
|
1007
|
+
* is used as a single-vendor chain.
|
|
1008
|
+
*/
|
|
1009
|
+
providers?: ProviderProxyProvider[];
|
|
787
1010
|
geo?: {
|
|
788
1011
|
/** ISO 3166-1 alpha-2 country code, for example KR or US. */
|
|
789
1012
|
country?: Iso3166Alpha2CountryCode;
|
|
@@ -794,6 +1017,12 @@ export interface ProviderProxyPolicy {
|
|
|
794
1017
|
affinity?: ProviderProxySessionAffinity;
|
|
795
1018
|
lifetimeMinutes?: number;
|
|
796
1019
|
poolSize?: number;
|
|
1020
|
+
/**
|
|
1021
|
+
* Seconds before hard sticky expiry at which native connections receive
|
|
1022
|
+
* the `expiring` event so the provider can drain and reconnect cleanly.
|
|
1023
|
+
* Declared by the provider; the SDK does not assume a default cut point.
|
|
1024
|
+
*/
|
|
1025
|
+
drainLeadSeconds?: number;
|
|
797
1026
|
};
|
|
798
1027
|
}
|
|
799
1028
|
|
|
@@ -804,9 +1033,9 @@ export interface ProviderAccessConfig {
|
|
|
804
1033
|
* Provider-level rollout visibility.
|
|
805
1034
|
*
|
|
806
1035
|
* - `public`: visible in public docs/catalog/OpenAPI and callable through
|
|
807
|
-
*
|
|
1036
|
+
* the existing provider policy stack.
|
|
808
1037
|
* - `early_access`: hidden from public discovery and callable only when the
|
|
809
|
-
*
|
|
1038
|
+
* active customer organization has a provider-level access grant.
|
|
810
1039
|
*
|
|
811
1040
|
* This is intentionally provider-level only. It does not alter auth mode,
|
|
812
1041
|
* operation schemas, health-check authoring, `openWorld`, or Connection
|
|
@@ -828,12 +1057,12 @@ export type ProviderLogoProfile =
|
|
|
828
1057
|
*/
|
|
829
1058
|
url?: string;
|
|
830
1059
|
background?: string;
|
|
831
|
-
|
|
1060
|
+
}
|
|
832
1061
|
| {
|
|
833
1062
|
source: "monogram" | "none";
|
|
834
1063
|
background?: string;
|
|
835
1064
|
fallbackReason: string;
|
|
836
|
-
|
|
1065
|
+
};
|
|
837
1066
|
|
|
838
1067
|
export type ProviderPublicConnectionMode =
|
|
839
1068
|
| "apifuse_managed"
|
|
@@ -970,6 +1199,11 @@ export interface HttpRetrySummary {
|
|
|
970
1199
|
export interface RequestOptions {
|
|
971
1200
|
headers?: Record<string, string>;
|
|
972
1201
|
params?: RequestParams;
|
|
1202
|
+
/**
|
|
1203
|
+
* Query parameters whose values contain credentials or other secret material.
|
|
1204
|
+
* They are sent like `params`, but redacted from SDK errors, traces, and recorded fixtures.
|
|
1205
|
+
*/
|
|
1206
|
+
sensitiveParams?: Record<string, string>;
|
|
973
1207
|
proxy?: string;
|
|
974
1208
|
timeout?: number;
|
|
975
1209
|
/**
|
|
@@ -978,8 +1212,32 @@ export interface RequestOptions {
|
|
|
978
1212
|
*/
|
|
979
1213
|
throwOnHttpError?: boolean;
|
|
980
1214
|
retry?: boolean | HttpRetryPreset | HttpRetryOptions;
|
|
1215
|
+
/**
|
|
1216
|
+
* Opt-in redirect-hop enforcement for ctx.http. When present, redirects are
|
|
1217
|
+
* evaluated before the next request is issued. Existing callers that omit
|
|
1218
|
+
* this policy retain the native fetch redirect behavior.
|
|
1219
|
+
*/
|
|
1220
|
+
redirectPolicy?: HttpRedirectPolicy;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
export type RedirectRunReason =
|
|
1224
|
+
| "completed"
|
|
1225
|
+
| "stopped"
|
|
1226
|
+
| "max_hops"
|
|
1227
|
+
| "missing_location"
|
|
1228
|
+
| "loop";
|
|
1229
|
+
|
|
1230
|
+
export type HttpRedirectPolicyMode = "same-origin";
|
|
1231
|
+
|
|
1232
|
+
export interface HttpRedirectPolicy {
|
|
1233
|
+
/** Only follow redirects whose canonical scheme, host, and port match the initial URL. */
|
|
1234
|
+
mode: HttpRedirectPolicyMode;
|
|
1235
|
+
/** Maximum number of redirect hops that may be followed. Must be an integer from 0 to 20. */
|
|
1236
|
+
maxHops: number;
|
|
981
1237
|
}
|
|
982
1238
|
|
|
1239
|
+
export type HttpRedirectFailureReason = Exclude<RedirectRunReason, "completed">;
|
|
1240
|
+
|
|
983
1241
|
export type HttpMethod =
|
|
984
1242
|
| "HEAD"
|
|
985
1243
|
| "head"
|
|
@@ -998,10 +1256,16 @@ export type HttpMethod =
|
|
|
998
1256
|
| "PATCH"
|
|
999
1257
|
| "patch";
|
|
1000
1258
|
|
|
1001
|
-
export interface StealthFetchOptions extends RequestOptions {
|
|
1259
|
+
export interface StealthFetchOptions extends Omit<RequestOptions, "redirectPolicy"> {
|
|
1002
1260
|
method?: HttpMethod;
|
|
1003
1261
|
body?: string | Buffer;
|
|
1004
1262
|
redirect?: "follow" | "manual" | "error";
|
|
1263
|
+
/**
|
|
1264
|
+
* Maximum decoded response-body bytes to buffer. When set, the stealth
|
|
1265
|
+
* transport aborts the response and throws `response_too_large` if the
|
|
1266
|
+
* declared or streamed body exceeds this limit.
|
|
1267
|
+
*/
|
|
1268
|
+
maxBodyBytes?: number;
|
|
1005
1269
|
/**
|
|
1006
1270
|
* Offsets policy-managed proxy pool selection for caller-managed retries.
|
|
1007
1271
|
* Use when a request receives an upstream challenge page rather than a
|
|
@@ -1022,18 +1286,45 @@ export interface StealthFetchOptions extends RequestOptions {
|
|
|
1022
1286
|
}
|
|
1023
1287
|
|
|
1024
1288
|
export interface CookieJar {
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1289
|
+
/** URL-less reads use the jar's response URL or session base URL. */
|
|
1290
|
+
get(name: string, url?: string): string | undefined;
|
|
1291
|
+
getAll(url?: string): Record<string, string>;
|
|
1292
|
+
toString(url?: string): string;
|
|
1293
|
+
find?(predicate: (cookie: string) => boolean, url?: string): string | undefined;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
/**
|
|
1297
|
+
* Version 1 of the JSON-safe, attribute-preserving stealth cookie store.
|
|
1298
|
+
* The nested jar is tough-cookie's serialized form and retains cookie origin,
|
|
1299
|
+
* Path, Secure, expiry, host-only, and other RFC attributes.
|
|
1300
|
+
*/
|
|
1301
|
+
export interface StealthCookieStoreV1 {
|
|
1302
|
+
readonly version: 1;
|
|
1303
|
+
readonly jar: SerializedCookieJar;
|
|
1029
1304
|
}
|
|
1030
1305
|
|
|
1306
|
+
/** Cookie persistence formats understood by this SDK version. */
|
|
1307
|
+
export type StealthCookieStore = StealthCookieStoreV1;
|
|
1308
|
+
|
|
1031
1309
|
export interface StealthSessionCookies extends CookieJar {
|
|
1032
|
-
has(name: string): boolean;
|
|
1033
|
-
|
|
1034
|
-
|
|
1310
|
+
has(name: string, url?: string): boolean;
|
|
1311
|
+
/** URL-less writes are scoped to the session base URL. */
|
|
1312
|
+
setFromCookieStrings(cookieStrings: readonly string[], url?: string): void;
|
|
1313
|
+
toHeader(url?: string): string;
|
|
1314
|
+
/**
|
|
1315
|
+
* Returns every cookie as a flat name/value map, collapsing duplicate names.
|
|
1316
|
+
* @deprecated Use serialize() for lossless, attribute-preserving persistence.
|
|
1317
|
+
*/
|
|
1035
1318
|
snapshot(): Record<string, string>;
|
|
1319
|
+
/**
|
|
1320
|
+
* Restores flat values as host-only, Path=/ cookies on the session base URL.
|
|
1321
|
+
* @deprecated Use deserialize() with state produced by serialize().
|
|
1322
|
+
*/
|
|
1036
1323
|
restore(cookies: Record<string, string>): void;
|
|
1324
|
+
/** Returns a versioned, JSON-safe, attribute-preserving representation of every cookie. */
|
|
1325
|
+
serialize(): StealthCookieStoreV1;
|
|
1326
|
+
/** Replaces the jar with a previously serialized, attribute-preserving cookie store. */
|
|
1327
|
+
deserialize(state: StealthCookieStore): void;
|
|
1037
1328
|
clear(): void;
|
|
1038
1329
|
}
|
|
1039
1330
|
|
|
@@ -1078,8 +1369,14 @@ export interface StealthRedirectRunOptions
|
|
|
1078
1369
|
export interface StealthRedirectRunResult {
|
|
1079
1370
|
final: StealthResponse;
|
|
1080
1371
|
hops: StealthRedirectHop[];
|
|
1081
|
-
reason:
|
|
1372
|
+
reason: RedirectRunReason;
|
|
1373
|
+
/**
|
|
1374
|
+
* Complete flat view across all redirect hosts. Attributes and duplicate names are lost.
|
|
1375
|
+
* @deprecated Use cookieStore for lossless persistence.
|
|
1376
|
+
*/
|
|
1082
1377
|
cookies: Record<string, string>;
|
|
1378
|
+
/** Versioned, attribute-preserving cookie state accumulated across the redirect chain. */
|
|
1379
|
+
cookieStore: StealthCookieStoreV1;
|
|
1083
1380
|
}
|
|
1084
1381
|
|
|
1085
1382
|
export interface StealthSession {
|
|
@@ -1169,11 +1466,191 @@ export interface HttpClient {
|
|
|
1169
1466
|
): Promise<AsyncIterable<SseMessage>>;
|
|
1170
1467
|
}
|
|
1171
1468
|
|
|
1469
|
+
/** Request-scoped file reference accepted by provider operation inputs. */
|
|
1470
|
+
export interface ProviderFileRef {
|
|
1471
|
+
readonly type: "request_file";
|
|
1472
|
+
readonly id: string;
|
|
1473
|
+
readonly filename: string;
|
|
1474
|
+
readonly mime_type?: string;
|
|
1475
|
+
readonly size: number;
|
|
1476
|
+
readonly sha256?: string;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
/** File body resolved from a request-scoped {@link ProviderFileRef}. */
|
|
1480
|
+
export type ProviderResolvedFile = Omit<ProviderFileRef, "mime_type"> & {
|
|
1481
|
+
readonly mimeType?: string;
|
|
1482
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1483
|
+
bytes(): Promise<Uint8Array>;
|
|
1484
|
+
stream(): ReadableStream<Uint8Array>;
|
|
1485
|
+
};
|
|
1486
|
+
|
|
1487
|
+
/** Resolver supplied by runtimes that accept request-scoped file inputs. */
|
|
1488
|
+
export interface ProviderFilesContext {
|
|
1489
|
+
has(input: string | ProviderFileRef): boolean;
|
|
1490
|
+
resolve(input: string | ProviderFileRef): Promise<ProviderResolvedFile>;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
export type NativeTcpTlsMode = "required" | "allowed" | "disabled";
|
|
1494
|
+
|
|
1495
|
+
export interface NativeTcpPortRange {
|
|
1496
|
+
readonly start: number;
|
|
1497
|
+
readonly end: number;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
/** Static native TCP egress declared by a provider. */
|
|
1501
|
+
export interface NativeTcpEgressRule {
|
|
1502
|
+
readonly host: string;
|
|
1503
|
+
readonly ports: readonly number[];
|
|
1504
|
+
readonly tls: NativeTcpTlsMode;
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
/**
|
|
1508
|
+
* Bounded native TCP egress discovered through a declared bootstrap endpoint.
|
|
1509
|
+
* Host suffixes are exact DNS suffixes, not wildcard patterns.
|
|
1510
|
+
* Dynamic rules must declare at least one target host selector through
|
|
1511
|
+
* targetHostSuffixes, targetIpv4Cidrs, and/or targetIpv6Cidrs. Literal grant
|
|
1512
|
+
* sources and targets match only same-family selectors (except exact
|
|
1513
|
+
* sourceHost); DNS names match only host/suffix selectors. IPv4-mapped and
|
|
1514
|
+
* IPv4-compatible IPv6 literals are authorized only by IPv4 CIDRs.
|
|
1515
|
+
*
|
|
1516
|
+
* Dynamic rules are ordered. The first rule whose source, target, port, and TLS
|
|
1517
|
+
* selectors match exclusively owns the grant; its ttlMs and maxGrants bounds
|
|
1518
|
+
* apply, and an exhausted/shorter rule never falls through to a later overlap.
|
|
1519
|
+
* Every rule must declare a source host selector, source port list/range, and
|
|
1520
|
+
* target port list/range; omitted ttlMs/maxGrants remain unbounded.
|
|
1521
|
+
*/
|
|
1522
|
+
export interface NativeTcpDynamicEgressRule {
|
|
1523
|
+
readonly sourceHost?: string;
|
|
1524
|
+
readonly sourceHostSuffixes?: readonly string[];
|
|
1525
|
+
readonly sourceIpv4Cidrs?: readonly string[];
|
|
1526
|
+
readonly sourceIpv6Cidrs?: readonly string[];
|
|
1527
|
+
readonly sourcePorts?: readonly number[];
|
|
1528
|
+
readonly sourcePortRanges?: readonly NativeTcpPortRange[];
|
|
1529
|
+
readonly targetHostSuffixes?: readonly string[];
|
|
1530
|
+
readonly targetIpv4Cidrs?: readonly string[];
|
|
1531
|
+
readonly targetIpv6Cidrs?: readonly string[];
|
|
1532
|
+
readonly targetPorts?: readonly number[];
|
|
1533
|
+
readonly targetPortRanges?: readonly NativeTcpPortRange[];
|
|
1534
|
+
readonly tls: NativeTcpTlsMode;
|
|
1535
|
+
readonly ttlMs?: number;
|
|
1536
|
+
readonly maxGrants?: number;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
/** Common TCP/TLS connection input supported by the native runtime. */
|
|
1540
|
+
export interface NativeNetworkConnectInput {
|
|
1541
|
+
readonly host: string;
|
|
1542
|
+
readonly port: number;
|
|
1543
|
+
readonly serverName?: string;
|
|
1544
|
+
readonly rejectUnauthorized?: boolean;
|
|
1545
|
+
/**
|
|
1546
|
+
* Maximum time without a successful socket read before the connection is
|
|
1547
|
+
* closed. Opt-in; when absent, reads can remain pending indefinitely.
|
|
1548
|
+
*/
|
|
1549
|
+
readonly idleTimeoutMs?: number;
|
|
1550
|
+
/** Maximum time allowed to establish the TCP/SOCKS/TLS connection. */
|
|
1551
|
+
readonly timeoutMs?: number;
|
|
1552
|
+
readonly signal?: AbortSignal;
|
|
1553
|
+
/** Overrides the credential-derived sticky affinity key. */
|
|
1554
|
+
readonly affinityKey?: string;
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
export type NativeNetworkConnectOptions = Omit<
|
|
1558
|
+
NativeNetworkConnectInput,
|
|
1559
|
+
"serverName" | "rejectUnauthorized"
|
|
1560
|
+
>;
|
|
1561
|
+
|
|
1562
|
+
export type NativeTlsConnectOptions = NativeNetworkConnectInput;
|
|
1563
|
+
|
|
1564
|
+
export interface NativeNetworkDynamicGrantOptions {
|
|
1565
|
+
readonly sourceHost: string;
|
|
1566
|
+
readonly sourcePort: number;
|
|
1567
|
+
readonly host: string;
|
|
1568
|
+
readonly port: number;
|
|
1569
|
+
readonly tls: NativeTcpTlsMode;
|
|
1570
|
+
readonly ttlMs?: number;
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
export interface NativeNetworkEgressGrant {
|
|
1574
|
+
revoke(): void;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
/** Consumer-facing alias used by native TCP providers. */
|
|
1578
|
+
export type NativeTcpEgressGrant = NativeNetworkEgressGrant;
|
|
1579
|
+
|
|
1580
|
+
/** Resolved egress identity for a native connection routed through a proxy. */
|
|
1581
|
+
export interface NativeProxyEgressInfo {
|
|
1582
|
+
readonly vendor: ProviderProxyProvider;
|
|
1583
|
+
readonly sticky: boolean;
|
|
1584
|
+
/** Vendor sticky session id (sid). Absent for rotating sessions. */
|
|
1585
|
+
readonly sessionId?: string;
|
|
1586
|
+
/** Hard expiry of the sticky binding, ISO 8601. */
|
|
1587
|
+
readonly expiresAt?: string;
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
export type NativeProxyExpiringReason = "sticky_expiry";
|
|
1591
|
+
|
|
1592
|
+
export interface NativeProxyExpiringEvent {
|
|
1593
|
+
readonly expiresAt: string;
|
|
1594
|
+
readonly leadSeconds: number;
|
|
1595
|
+
readonly reason: NativeProxyExpiringReason;
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
/**
|
|
1599
|
+
* Cooperative drain handler. The SDK awaits this before closing a socket whose
|
|
1600
|
+
* sticky proxy binding is about to expire, then force-closes at hard expiry.
|
|
1601
|
+
*/
|
|
1602
|
+
export type NativeProxyDrainHandler = (
|
|
1603
|
+
event: NativeProxyExpiringEvent,
|
|
1604
|
+
) => void | Promise<void>;
|
|
1605
|
+
|
|
1606
|
+
/** Typed reason recorded when the SDK closes a native connection intentionally. */
|
|
1607
|
+
export interface NativeNetworkCloseReason {
|
|
1608
|
+
readonly code: string;
|
|
1609
|
+
readonly message: string;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
/** Byte-oriented connection returned by the native TCP/TLS runtime. */
|
|
1613
|
+
export interface NativeNetworkConnection {
|
|
1614
|
+
/** Present when the connection was routed through a proxy. */
|
|
1615
|
+
readonly proxy?: NativeProxyEgressInfo;
|
|
1616
|
+
/** Present after an SDK-planned close, such as sticky proxy expiry. */
|
|
1617
|
+
readonly closeReason?: NativeNetworkCloseReason;
|
|
1618
|
+
/** Register a cooperative drain handler for sticky-expiry reconnects. */
|
|
1619
|
+
onExpiring?(handler: NativeProxyDrainHandler): void;
|
|
1620
|
+
read(): Promise<Uint8Array | null>;
|
|
1621
|
+
write(data: Uint8Array): Promise<void>;
|
|
1622
|
+
close(): Promise<void>;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
export interface NativeNetworkClient {
|
|
1626
|
+
connectTcp(
|
|
1627
|
+
input: NativeNetworkConnectOptions,
|
|
1628
|
+
): Promise<NativeNetworkConnection>;
|
|
1629
|
+
connectTls(input: NativeTlsConnectOptions): Promise<NativeNetworkConnection>;
|
|
1630
|
+
grantTcpEgress(
|
|
1631
|
+
input: NativeNetworkDynamicGrantOptions,
|
|
1632
|
+
): NativeNetworkEgressGrant;
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
export interface NativeContext {
|
|
1636
|
+
readonly network: NativeNetworkClient;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
/** Consumer-facing alias for the native capability on provider contexts. */
|
|
1640
|
+
export type NativeProviderContext = NativeContext;
|
|
1641
|
+
|
|
1642
|
+
export interface NativeProviderConfig {
|
|
1643
|
+
readonly network?: {
|
|
1644
|
+
readonly tcp?: readonly NativeTcpEgressRule[];
|
|
1645
|
+
readonly dynamicTcp?: readonly NativeTcpDynamicEgressRule[];
|
|
1646
|
+
};
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1172
1649
|
export interface ProviderCacheKeyOptions {
|
|
1173
1650
|
/**
|
|
1174
|
-
* Additional field names
|
|
1175
|
-
*
|
|
1176
|
-
* cookie, token, password, and secret.
|
|
1651
|
+
* Additional field names whose values are hashed in stable key material. The
|
|
1652
|
+
* SDK always hashes values under known secret-bearing names such as serviceKey,
|
|
1653
|
+
* authorization, cookie, token, password, and secret.
|
|
1177
1654
|
*/
|
|
1178
1655
|
redactFields?: string[];
|
|
1179
1656
|
}
|
|
@@ -1268,6 +1745,18 @@ export interface BrowserFrame {
|
|
|
1268
1745
|
locator(selector: string): BrowserLocator;
|
|
1269
1746
|
}
|
|
1270
1747
|
|
|
1748
|
+
export interface BrowserCookie {
|
|
1749
|
+
readonly name: string;
|
|
1750
|
+
readonly value: string;
|
|
1751
|
+
readonly domain: string;
|
|
1752
|
+
readonly path: string;
|
|
1753
|
+
/** Unix seconds. Absent for a session cookie. */
|
|
1754
|
+
readonly expires?: number;
|
|
1755
|
+
readonly httpOnly: boolean;
|
|
1756
|
+
readonly secure: boolean;
|
|
1757
|
+
readonly sameSite?: "Strict" | "Lax" | "None";
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1271
1760
|
export type BrowserResourceMethod = "GET" | "HEAD";
|
|
1272
1761
|
|
|
1273
1762
|
export type BrowserResourceRequest = {
|
|
@@ -1285,11 +1774,11 @@ export type BrowserResourceDecision =
|
|
|
1285
1774
|
readonly status?: number;
|
|
1286
1775
|
readonly headers?: Readonly<Record<string, string>>;
|
|
1287
1776
|
readonly body?: BrowserResourceBody;
|
|
1288
|
-
|
|
1777
|
+
}
|
|
1289
1778
|
| {
|
|
1290
1779
|
readonly action: "block";
|
|
1291
1780
|
readonly reason?: string;
|
|
1292
|
-
|
|
1781
|
+
};
|
|
1293
1782
|
|
|
1294
1783
|
export type BrowserResourceRoute = {
|
|
1295
1784
|
readonly match:
|
|
@@ -1309,6 +1798,11 @@ export type BrowserResourcePolicy = {
|
|
|
1309
1798
|
|
|
1310
1799
|
export interface BrowserPage extends BrowserFrame {
|
|
1311
1800
|
close(): Promise<void>;
|
|
1801
|
+
/**
|
|
1802
|
+
* Reads the browser context's cookie jar, including httpOnly cookies.
|
|
1803
|
+
* Cookie expiry values are Unix seconds and are absent for session cookies.
|
|
1804
|
+
*/
|
|
1805
|
+
cookies(): Promise<readonly BrowserCookie[]>;
|
|
1312
1806
|
fill(selector: string, text: string): Promise<void>;
|
|
1313
1807
|
goto(url: string): Promise<void>;
|
|
1314
1808
|
pageId?: string;
|
|
@@ -1398,10 +1892,32 @@ export interface ProviderChoiceBindingOptions {
|
|
|
1398
1892
|
credentialKeys?: readonly string[];
|
|
1399
1893
|
}
|
|
1400
1894
|
|
|
1895
|
+
export type ProviderChoiceConsumeMode = "never" | "on-parse" | "explicit";
|
|
1896
|
+
|
|
1897
|
+
export type ProviderChoiceConsumeResult =
|
|
1898
|
+
| { readonly status: "consumed" }
|
|
1899
|
+
| { readonly status: "already-consumed" }
|
|
1900
|
+
| { readonly status: "unsupported" };
|
|
1901
|
+
|
|
1902
|
+
export type ProviderChoiceExplicitParseResult =
|
|
1903
|
+
| {
|
|
1904
|
+
readonly status: "active";
|
|
1905
|
+
readonly payload: Record<string, unknown>;
|
|
1906
|
+
/** Stable, opaque key for provider-owned idempotency records. */
|
|
1907
|
+
readonly replayKey: string;
|
|
1908
|
+
/** Atomically claims a word token. Legacy managed tokens report unsupported. */
|
|
1909
|
+
consume(): Promise<ProviderChoiceConsumeResult>;
|
|
1910
|
+
}
|
|
1911
|
+
| {
|
|
1912
|
+
readonly status: "consumed";
|
|
1913
|
+
/** Use this key to read the provider-owned result before returning an error. */
|
|
1914
|
+
readonly replayKey: string;
|
|
1915
|
+
};
|
|
1916
|
+
|
|
1401
1917
|
export type ProviderChoiceStorageOptions =
|
|
1402
1918
|
| {
|
|
1403
1919
|
readonly mode: "inline";
|
|
1404
|
-
|
|
1920
|
+
}
|
|
1405
1921
|
| {
|
|
1406
1922
|
readonly mode: "server";
|
|
1407
1923
|
readonly namespace: string;
|
|
@@ -1410,7 +1926,7 @@ export type ProviderChoiceStorageOptions =
|
|
|
1410
1926
|
readonly maxEntries: number;
|
|
1411
1927
|
readonly maxValueBytes: number;
|
|
1412
1928
|
readonly unavailable?: "reject";
|
|
1413
|
-
|
|
1929
|
+
}
|
|
1414
1930
|
| {
|
|
1415
1931
|
readonly mode: "auto";
|
|
1416
1932
|
readonly namespace: string;
|
|
@@ -1420,7 +1936,7 @@ export type ProviderChoiceStorageOptions =
|
|
|
1420
1936
|
readonly maxEntries: number;
|
|
1421
1937
|
readonly maxValueBytes: number;
|
|
1422
1938
|
readonly unavailable?: "reject";
|
|
1423
|
-
|
|
1939
|
+
};
|
|
1424
1940
|
|
|
1425
1941
|
export interface ProviderChoiceIssueOptions<
|
|
1426
1942
|
TPayload extends Record<string, unknown>,
|
|
@@ -1431,6 +1947,8 @@ export interface ProviderChoiceIssueOptions<
|
|
|
1431
1947
|
ttlMs: number;
|
|
1432
1948
|
nowMs?: number;
|
|
1433
1949
|
bind?: ProviderChoiceBindingOptions;
|
|
1950
|
+
/** Server storage only: standard emits four words; high emits five. */
|
|
1951
|
+
strength?: "standard" | "high";
|
|
1434
1952
|
storage?: ProviderChoiceStorageOptions;
|
|
1435
1953
|
}
|
|
1436
1954
|
|
|
@@ -1443,6 +1961,8 @@ export interface ProviderChoiceParseOptions {
|
|
|
1443
1961
|
futureToleranceMs?: number;
|
|
1444
1962
|
bind?: ProviderChoiceBindingOptions;
|
|
1445
1963
|
storage?: ProviderChoiceStorageOptions;
|
|
1964
|
+
/** Defaults to never, matching legacy managed-token parse semantics. */
|
|
1965
|
+
consume?: ProviderChoiceConsumeMode;
|
|
1446
1966
|
}
|
|
1447
1967
|
|
|
1448
1968
|
export interface ProviderChoiceContext {
|
|
@@ -1470,6 +1990,9 @@ export interface ProviderChoiceContext {
|
|
|
1470
1990
|
issue<TPayload extends Record<string, unknown>>(
|
|
1471
1991
|
options: ProviderChoiceIssueOptions<TPayload>,
|
|
1472
1992
|
): string | Promise<string>;
|
|
1993
|
+
parse(
|
|
1994
|
+
options: ProviderChoiceParseOptions & { readonly consume: "explicit" },
|
|
1995
|
+
): Promise<ProviderChoiceExplicitParseResult>;
|
|
1473
1996
|
parse(
|
|
1474
1997
|
options: ProviderChoiceParseOptions & {
|
|
1475
1998
|
readonly storage?: { readonly mode: "inline" };
|
|
@@ -1491,7 +2014,11 @@ export interface ProviderChoiceContext {
|
|
|
1491
2014
|
>;
|
|
1492
2015
|
},
|
|
1493
2016
|
): Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
1494
|
-
parse(
|
|
2017
|
+
parse(
|
|
2018
|
+
options: ProviderChoiceParseOptions,
|
|
2019
|
+
):
|
|
2020
|
+
| Record<string, unknown>
|
|
2021
|
+
| Promise<Record<string, unknown> | ProviderChoiceExplicitParseResult>;
|
|
1495
2022
|
}
|
|
1496
2023
|
|
|
1497
2024
|
export interface ContextScratchpad {
|
|
@@ -1564,11 +2091,11 @@ export interface AuthFlowTerminalContext {
|
|
|
1564
2091
|
}
|
|
1565
2092
|
>;
|
|
1566
2093
|
readonly expectedInput?: never;
|
|
1567
|
-
|
|
2094
|
+
}
|
|
1568
2095
|
| {
|
|
1569
2096
|
readonly expectedInput: Record<string, unknown>;
|
|
1570
2097
|
readonly fields?: never;
|
|
1571
|
-
|
|
2098
|
+
}
|
|
1572
2099
|
),
|
|
1573
2100
|
): AuthTurn;
|
|
1574
2101
|
nextPoll(options?: {
|
|
@@ -1581,16 +2108,22 @@ export interface AuthFlowTerminalContext {
|
|
|
1581
2108
|
}
|
|
1582
2109
|
|
|
1583
2110
|
export interface FlowContext {
|
|
2111
|
+
/** Gateway auth-flow id. Required by flow-scoped auth ceremonies. */
|
|
2112
|
+
flowId?: string;
|
|
1584
2113
|
connectionId?: string;
|
|
1585
2114
|
externalRef?: string;
|
|
1586
2115
|
tenantId: string;
|
|
1587
2116
|
providerId: string;
|
|
1588
2117
|
http: HttpClient;
|
|
2118
|
+
/** Present when the selected runtime supplies native network capabilities. */
|
|
2119
|
+
readonly native?: NativeProviderContext;
|
|
1589
2120
|
stealth: StealthClient;
|
|
1590
2121
|
env: EnvContext;
|
|
1591
2122
|
credential?: CredentialContext;
|
|
1592
2123
|
context: ContextScratchpad;
|
|
2124
|
+
ocr: OcrContext;
|
|
1593
2125
|
stt: SttContext;
|
|
2126
|
+
resolver: ResolverContext;
|
|
1594
2127
|
auth: AuthFlowTerminalContext;
|
|
1595
2128
|
}
|
|
1596
2129
|
|
|
@@ -1633,7 +2166,14 @@ export type ProviderStateDurationString =
|
|
|
1633
2166
|
| `${number}${"ms" | "s" | "m" | "h" | "d"}`
|
|
1634
2167
|
| `PT${string}`;
|
|
1635
2168
|
|
|
2169
|
+
export type StateNamespaceScope = "connection" | "provider";
|
|
2170
|
+
|
|
1636
2171
|
export interface StateNamespaceOptions {
|
|
2172
|
+
/**
|
|
2173
|
+
* State isolation boundary. Connection scope is the default; provider scope
|
|
2174
|
+
* must be selected explicitly for provider-wide coordination state.
|
|
2175
|
+
*/
|
|
2176
|
+
scope?: StateNamespaceScope;
|
|
1637
2177
|
/** Default TTL used when a write omits ttl. Required to avoid unbounded state. */
|
|
1638
2178
|
defaultTtl: ProviderStateDurationString;
|
|
1639
2179
|
/** Maximum allowed TTL; writes are rejected when they exceed this policy. */
|
|
@@ -1694,6 +2234,11 @@ export interface ProviderStateNamespace {
|
|
|
1694
2234
|
}
|
|
1695
2235
|
|
|
1696
2236
|
export interface ProviderRuntimeState {
|
|
2237
|
+
/**
|
|
2238
|
+
* Returns an immutable view bound to one request connection. An unresolved
|
|
2239
|
+
* connection uses an isolated reserved sentinel, never the provider-global scope.
|
|
2240
|
+
*/
|
|
2241
|
+
forConnection(connectionId: string | undefined): ProviderRuntimeState;
|
|
1697
2242
|
namespace(
|
|
1698
2243
|
name: string,
|
|
1699
2244
|
options: StateNamespaceOptions,
|
|
@@ -1705,18 +2250,37 @@ export interface ProviderContext {
|
|
|
1705
2250
|
credential: CredentialContext;
|
|
1706
2251
|
request?: ProviderRequestContext;
|
|
1707
2252
|
http: HttpClient;
|
|
2253
|
+
/** Present for requests carrying runtime-resolvable file references. */
|
|
2254
|
+
readonly files?: ProviderFilesContext;
|
|
2255
|
+
/** Present when the selected runtime supplies native network capabilities. */
|
|
2256
|
+
readonly native?: NativeProviderContext;
|
|
1708
2257
|
cache: ProviderCache;
|
|
1709
2258
|
state: ProviderRuntimeState;
|
|
1710
2259
|
stealth: StealthClient;
|
|
1711
2260
|
browser: BrowserClient;
|
|
1712
2261
|
trace: TraceContext;
|
|
1713
2262
|
auth: AuthContext;
|
|
2263
|
+
ocr: OcrContext;
|
|
1714
2264
|
stt: SttContext;
|
|
2265
|
+
resolver: ResolverContext;
|
|
1715
2266
|
choice: ProviderChoiceContext;
|
|
1716
2267
|
}
|
|
1717
2268
|
|
|
2269
|
+
export interface ProxiedOAuthConfig {
|
|
2270
|
+
authorizeUrl: string;
|
|
2271
|
+
tokenUrl: string;
|
|
2272
|
+
customScheme: string;
|
|
2273
|
+
rewriteProfile: string;
|
|
2274
|
+
clientIdEnvKey: string;
|
|
2275
|
+
pkce?: "S256" | "none";
|
|
2276
|
+
authorizeParams?: Record<string, string>;
|
|
2277
|
+
tokenParams?: Record<string, string>;
|
|
2278
|
+
}
|
|
2279
|
+
|
|
1718
2280
|
export interface AuthConfig {
|
|
1719
2281
|
mode: AuthMode;
|
|
2282
|
+
/** Browser reverse-proxy contract for providers with custom-scheme OAuth callbacks. */
|
|
2283
|
+
proxied?: ProxiedOAuthConfig;
|
|
1720
2284
|
flow?: AuthFlowDefinition;
|
|
1721
2285
|
}
|
|
1722
2286
|
|
|
@@ -1759,6 +2323,19 @@ export interface OperationDefinition<
|
|
|
1759
2323
|
TInput extends SchemaLike = SchemaLike,
|
|
1760
2324
|
TOutput extends SchemaLike = SchemaLike,
|
|
1761
2325
|
> {
|
|
2326
|
+
/**
|
|
2327
|
+
* Short English display title for the operation. The SDK passes it through
|
|
2328
|
+
* verbatim; the APIFuse registry derives the operation's en locale title
|
|
2329
|
+
* baseline from it (`docs.titleKey` remains available as an explicit key
|
|
2330
|
+
* override).
|
|
2331
|
+
*/
|
|
2332
|
+
title?: string;
|
|
2333
|
+
/**
|
|
2334
|
+
* Raw English operation description. The SDK passes it through verbatim;
|
|
2335
|
+
* keyed descriptions via `descriptionKey` remain the primary flow, and
|
|
2336
|
+
* provider lint rules for raw prose descriptions still apply.
|
|
2337
|
+
*/
|
|
2338
|
+
description?: string;
|
|
1762
2339
|
descriptionKey?: ProviderLocaleKeyInput;
|
|
1763
2340
|
docs?: OperationDocMeta;
|
|
1764
2341
|
whenToUseKeys?: readonly ProviderLocaleKeyInput[];
|
|
@@ -1784,6 +2361,11 @@ export interface OperationDefinition<
|
|
|
1784
2361
|
fixtures?: {
|
|
1785
2362
|
request: InferSchemaOutput<TInput>;
|
|
1786
2363
|
response: InferSchemaOutput<TOutput>;
|
|
2364
|
+
/**
|
|
2365
|
+
* KST calendar date when `response` evidence was captured. Date fields in
|
|
2366
|
+
* the response align with this date, not a resolved relative request date.
|
|
2367
|
+
*/
|
|
2368
|
+
recordedAt?: string;
|
|
1787
2369
|
};
|
|
1788
2370
|
upstream?: {
|
|
1789
2371
|
baseUrl?: string;
|
|
@@ -1797,17 +2379,65 @@ export interface OperationDefinition<
|
|
|
1797
2379
|
healthCheckUnsupported?: HealthCheckUnsupported;
|
|
1798
2380
|
}
|
|
1799
2381
|
|
|
2382
|
+
/**
|
|
2383
|
+
* Author-declared deployment overrides accepted as the optional top-level
|
|
2384
|
+
* `deployment` key on `defineProvider()`.
|
|
2385
|
+
*
|
|
2386
|
+
* The SDK passes this object through VERBATIM onto the returned provider
|
|
2387
|
+
* definition — it is typed here but deliberately not deep-validated: the
|
|
2388
|
+
* APIFuse registry builder owns deployment validation and resolves omitted
|
|
2389
|
+
* fields against the runtime deployment profiles. The shape mirrors the
|
|
2390
|
+
* registry's `ProviderDeploymentOverrides` contract; every field is
|
|
2391
|
+
* optional. Note that the deployment `runtime` axis
|
|
2392
|
+
* (`shared`/`dedicated`/`browser`) is distinct from the provider execution
|
|
2393
|
+
* `runtime` (`standard`/`shared`/`browser`).
|
|
2394
|
+
*/
|
|
2395
|
+
export interface ProviderDeploymentOverrides {
|
|
2396
|
+
runtime?: "shared" | "dedicated" | "browser";
|
|
2397
|
+
language?: "typescript" | "python";
|
|
2398
|
+
replicas?: number;
|
|
2399
|
+
hpa?: {
|
|
2400
|
+
enabled: boolean;
|
|
2401
|
+
minReplicas?: number;
|
|
2402
|
+
maxReplicas?: number;
|
|
2403
|
+
targetCPUUtilizationPercentage?: number;
|
|
2404
|
+
};
|
|
2405
|
+
resources?: {
|
|
2406
|
+
cpu: string;
|
|
2407
|
+
memory: string;
|
|
2408
|
+
};
|
|
2409
|
+
cache?: {
|
|
2410
|
+
redis?: {
|
|
2411
|
+
enabled: boolean;
|
|
2412
|
+
url?: string;
|
|
2413
|
+
};
|
|
2414
|
+
};
|
|
2415
|
+
network?: {
|
|
2416
|
+
additionalTcpPorts?: number[];
|
|
2417
|
+
};
|
|
2418
|
+
buildContext?: string;
|
|
2419
|
+
}
|
|
2420
|
+
|
|
1800
2421
|
export interface ProviderDefinition {
|
|
1801
2422
|
id: string;
|
|
1802
2423
|
version: string;
|
|
1803
2424
|
runtime: "standard" | "shared" | "browser";
|
|
2425
|
+
/**
|
|
2426
|
+
* Optional deployment overrides, passed through verbatim from
|
|
2427
|
+
* `defineProvider({ deployment })`. Validation and profile resolution are
|
|
2428
|
+
* owned by the APIFuse registry builder, not the SDK.
|
|
2429
|
+
*/
|
|
2430
|
+
deployment?: ProviderDeploymentOverrides;
|
|
1804
2431
|
allowedHosts?: string[];
|
|
2432
|
+
native?: NativeProviderConfig;
|
|
1805
2433
|
stealth?: {
|
|
1806
2434
|
profile: string;
|
|
1807
2435
|
platform: StealthPlatform;
|
|
1808
2436
|
};
|
|
1809
2437
|
proxy?: ProviderProxyConfig;
|
|
2438
|
+
ocr?: ProviderOcrConfig;
|
|
1810
2439
|
stt?: ProviderSttConfig;
|
|
2440
|
+
resolver?: ProviderResolverConfig;
|
|
1811
2441
|
browser?: {
|
|
1812
2442
|
engine: BrowserEngine;
|
|
1813
2443
|
};
|