@apifuse/provider-sdk 2.2.0-beta.2 → 2.2.0-beta.21
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 +487 -0
- package/CHANGELOG.md +90 -0
- package/README.md +49 -3
- package/SUBMISSION.md +1 -1
- package/bin/apifuse-check.ts +44 -59
- package/bin/apifuse-create.ts +1 -1
- package/bin/apifuse-dev.ts +27 -52
- package/bin/apifuse-pack-check.ts +14 -0
- package/bin/apifuse-pack-smoke.ts +36 -81
- package/bin/apifuse-pack-types.ts +305 -0
- package/bin/apifuse-perf.ts +45 -127
- package/bin/apifuse-record.ts +659 -111
- package/bin/apifuse-submit-check.ts +546 -48
- 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-semantics.ts +204 -0
- package/bin/submit-check-xml.ts +134 -0
- package/dist/auth-turn/index.d.ts +3 -3
- package/dist/auth.d.ts +2 -2
- package/dist/auth.js +9 -18
- package/dist/ceremonies/index.d.ts +9 -1
- package/dist/ceremonies/index.js +65 -18
- 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/config/loader.d.ts +176 -8
- package/dist/config/loader.js +424 -95
- package/dist/contract-serialization.d.ts +2 -2
- package/dist/contract-serialization.js +3 -6
- package/dist/contract-types.d.ts +2 -2
- package/dist/contract.d.ts +3 -3
- package/dist/contract.js +4 -6
- package/dist/define.d.ts +9 -1
- package/dist/define.js +304 -119
- package/dist/dev.d.ts +1 -1
- package/dist/dev.js +1 -1
- package/dist/error-resolution.d.ts +2 -0
- package/dist/error-resolution.js +90 -0
- package/dist/errors.d.ts +22 -1
- package/dist/errors.js +88 -0
- 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 +46 -42
- package/dist/index.js +41 -37
- package/dist/lint.d.ts +1 -1
- package/dist/lint.js +8 -15
- 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 +12 -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 +2 -1
- package/dist/runtime/auth-flow.js +4 -3
- package/dist/runtime/browser.d.ts +1 -1
- package/dist/runtime/browser.js +15 -29
- package/dist/runtime/cache.d.ts +1 -1
- package/dist/runtime/cache.js +4 -8
- package/dist/runtime/choice.d.ts +1 -1
- package/dist/runtime/choice.js +31 -35
- 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 +31 -4
- package/dist/runtime/http.d.ts +2 -2
- package/dist/runtime/http.js +387 -47
- 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 +345 -22
- package/dist/runtime/keyring.js +1 -1
- package/dist/runtime/namespace.js +1 -1
- package/dist/runtime/native-network.d.ts +127 -0
- package/dist/runtime/native-network.js +1298 -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 +55 -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 +2 -4
- package/dist/runtime/request-options.d.ts +68 -1
- package/dist/runtime/request-options.js +548 -0
- package/dist/runtime/secrets.d.ts +27 -0
- package/dist/runtime/secrets.js +51 -0
- package/dist/runtime/state.d.ts +2 -2
- package/dist/runtime/state.js +238 -26
- package/dist/runtime/stealth.d.ts +5 -3
- package/dist/runtime/stealth.js +423 -143
- package/dist/runtime/stt.d.ts +1 -1
- package/dist/runtime/stt.js +11 -15
- 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 +104 -3
- package/dist/server/self-test.js +673 -115
- package/dist/server/serve.d.ts +116 -4
- package/dist/server/serve.js +799 -128
- package/dist/server/types.d.ts +34 -9
- package/dist/server/types.js +8 -1
- package/dist/stateful/errors.d.ts +14 -0
- package/dist/stateful/errors.js +14 -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 +71 -0
- package/dist/stateful/stateful-provider-session-routing.js +353 -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 +5 -14
- package/dist/stream-evidence.d.ts +74 -0
- package/dist/stream-evidence.js +785 -0
- package/dist/stream.d.ts +1 -1
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +2 -2
- package/dist/testing/run.d.ts +32 -2
- package/dist/testing/run.js +478 -28
- package/dist/types.d.ts +342 -14
- package/dist/types.js +1 -0
- package/dist/user-input.d.ts +30 -0
- package/dist/user-input.js +66 -0
- package/package.json +16 -5
- package/src/auth-turn/index.ts +1 -1
- package/src/auth.ts +28 -86
- package/src/ceremonies/index.ts +103 -78
- 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/config/loader.ts +652 -204
- package/src/contract-serialization.ts +5 -11
- package/src/contract-types.ts +2 -2
- package/src/contract.ts +12 -28
- package/src/define.ts +499 -498
- package/src/dev.ts +4 -9
- package/src/error-resolution.ts +91 -0
- package/src/errors.ts +110 -5
- 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 +112 -42
- package/src/lint.ts +88 -152
- 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 +7 -7
- package/src/runtime/browser.ts +64 -187
- package/src/runtime/cache.ts +20 -67
- package/src/runtime/choice.ts +79 -132
- package/src/runtime/credential.ts +2 -2
- package/src/runtime/env.ts +1 -1
- package/src/runtime/executor.ts +43 -20
- package/src/runtime/http.ts +494 -57
- package/src/runtime/insights.ts +15 -53
- package/src/runtime/instrumentation.ts +495 -66
- package/src/runtime/keyring.ts +7 -19
- package/src/runtime/namespace.ts +2 -7
- package/src/runtime/native-network.ts +1686 -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 +79 -77
- package/src/runtime/redirects.ts +66 -0
- package/src/runtime/redis.ts +4 -12
- package/src/runtime/request-options.ts +679 -9
- package/src/runtime/secrets.ts +64 -0
- package/src/runtime/state.ts +353 -133
- package/src/runtime/stealth.ts +505 -154
- package/src/runtime/stt.ts +38 -94
- package/src/runtime/trace.ts +14 -44
- package/src/runtime/waterfall.ts +5 -18
- package/src/schema.ts +23 -84
- package/src/serve.ts +1 -1
- package/src/server/index.ts +29 -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 +857 -132
- package/src/server/serve.ts +1151 -328
- package/src/server/types.ts +12 -13
- package/src/stateful/README.md +146 -0
- package/src/stateful/errors.ts +23 -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 +555 -0
- package/src/stateful/stateful-provider-session-runtime.ts +403 -0
- package/src/stateful-signing.ts +46 -0
- package/src/stealth/profiles.ts +10 -26
- package/src/stream-evidence.ts +988 -0
- package/src/stream.ts +8 -19
- package/src/testing/index.ts +10 -2
- package/src/testing/run.ts +653 -74
- package/src/types.ts +408 -28
- 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. */
|
|
@@ -339,11 +342,11 @@ export type HealthScheduleRandomization =
|
|
|
339
342
|
| {
|
|
340
343
|
mode: "centered";
|
|
341
344
|
maxOffset: Iso8601Duration;
|
|
342
|
-
|
|
345
|
+
}
|
|
343
346
|
| {
|
|
344
347
|
mode: "delayed";
|
|
345
348
|
maxDelay: Iso8601Duration;
|
|
346
|
-
|
|
349
|
+
};
|
|
347
350
|
|
|
348
351
|
export interface HealthJourneyStep {
|
|
349
352
|
id: string;
|
|
@@ -458,7 +461,7 @@ export type HealthJourneyManualTriggerPolicy =
|
|
|
458
461
|
/** ISO 8601 duration. Minimum time between manual executions. */
|
|
459
462
|
minManualInterval: Iso8601Duration;
|
|
460
463
|
publicRationale: string;
|
|
461
|
-
|
|
464
|
+
};
|
|
462
465
|
|
|
463
466
|
export interface HealthJourneyRunResult {
|
|
464
467
|
status?: "ok" | "degraded" | "down" | "unknown";
|
|
@@ -718,9 +721,13 @@ export interface HealthMonitorProbeOverride {
|
|
|
718
721
|
degradedThresholdMs?: number;
|
|
719
722
|
}
|
|
720
723
|
|
|
724
|
+
export const VALID_OPERATION_ERROR_STATUSES = [400, 401, 404, 409, 410, 422, 429, 500, 502, 503, 504] as const;
|
|
725
|
+
|
|
726
|
+
export type ProviderErrorStatus = (typeof VALID_OPERATION_ERROR_STATUSES)[number];
|
|
727
|
+
|
|
721
728
|
export interface OperationErrorCode {
|
|
722
729
|
code: string;
|
|
723
|
-
status?:
|
|
730
|
+
status?: ProviderErrorStatus;
|
|
724
731
|
description: string;
|
|
725
732
|
retryable?: boolean;
|
|
726
733
|
}
|
|
@@ -759,7 +766,12 @@ export interface StealthProfile {
|
|
|
759
766
|
headerOrder?: string[];
|
|
760
767
|
}
|
|
761
768
|
|
|
762
|
-
export type AuthMode =
|
|
769
|
+
export type AuthMode =
|
|
770
|
+
| "none"
|
|
771
|
+
| "platform-managed"
|
|
772
|
+
| "credentials"
|
|
773
|
+
| "oauth2"
|
|
774
|
+
| "oauth2_proxied";
|
|
763
775
|
|
|
764
776
|
export type ConnectionMode = AuthMode;
|
|
765
777
|
|
|
@@ -769,7 +781,25 @@ export type ProviderAccessVisibility = "public" | "early_access";
|
|
|
769
781
|
|
|
770
782
|
export type ProviderProxyMode = "disabled" | "optional" | "required";
|
|
771
783
|
|
|
772
|
-
|
|
784
|
+
/**
|
|
785
|
+
* Proxy egress vendors. These are FOUR DISTINCT services — do not conflate them
|
|
786
|
+
* (a common mistake because the names collide with a well-known rebrand):
|
|
787
|
+
*
|
|
788
|
+
* - `smartproxy` — **api.smartproxy.org**, a residential proxy with an IP
|
|
789
|
+
* *extraction/allocation* API (app_key → a pool of raw `ip:port` CONNECT
|
|
790
|
+
* endpoints). This is our own vendor. It is NOT the company formerly named
|
|
791
|
+
* "Smartproxy". Credentials: `APIFUSE__PROXY__SMARTPROXY_APP_KEY`.
|
|
792
|
+
* - `nodemaven` — **gate.nodemaven.com**, a *gateway* proxy with static
|
|
793
|
+
* credentials; geo/session encoded in the username, no allocation API.
|
|
794
|
+
* - `decodo` — **decodo.com**, the *gateway* proxy that was named "Smartproxy"
|
|
795
|
+
* (smartproxy.com) before its 2025 rebrand to Decodo. Sticky sessions via
|
|
796
|
+
* username params. A different company from `smartproxy` above.
|
|
797
|
+
* **@deprecated** — unused; no managed adapter. Use `smartproxy`/`nodemaven`,
|
|
798
|
+
* or the `APIFUSE__PROXY__URL` bring-your-own escape hatch.
|
|
799
|
+
* - `custom` — **@deprecated** bring-your-own static proxy URL marker. The
|
|
800
|
+
* `APIFUSE__PROXY__URL` env still works without declaring this value.
|
|
801
|
+
*/
|
|
802
|
+
export type ProviderProxyProvider = "smartproxy" | "nodemaven" | "decodo" | "custom";
|
|
773
803
|
|
|
774
804
|
export type ProviderProxySessionAffinity =
|
|
775
805
|
| "request"
|
|
@@ -783,7 +813,18 @@ export interface ProviderProxyPolicy {
|
|
|
783
813
|
* certificate verification, and vendor allocator endpoints are SDK-owned.
|
|
784
814
|
*/
|
|
785
815
|
mode: ProviderProxyMode;
|
|
816
|
+
/**
|
|
817
|
+
* @deprecated Use `providers: [...]` to declare an ordered vendor fallback
|
|
818
|
+
* chain. A single-element `providers` list is equivalent to this field.
|
|
819
|
+
*/
|
|
786
820
|
provider?: ProviderProxyProvider;
|
|
821
|
+
/**
|
|
822
|
+
* Ordered proxy-vendor fallback chain. The SDK tries each vendor in order and
|
|
823
|
+
* fails over to the next when a vendor lacks credentials or its allocation /
|
|
824
|
+
* transport is exhausted. When omitted, `provider` (or the platform default)
|
|
825
|
+
* is used as a single-vendor chain.
|
|
826
|
+
*/
|
|
827
|
+
providers?: ProviderProxyProvider[];
|
|
787
828
|
geo?: {
|
|
788
829
|
/** ISO 3166-1 alpha-2 country code, for example KR or US. */
|
|
789
830
|
country?: Iso3166Alpha2CountryCode;
|
|
@@ -794,6 +835,12 @@ export interface ProviderProxyPolicy {
|
|
|
794
835
|
affinity?: ProviderProxySessionAffinity;
|
|
795
836
|
lifetimeMinutes?: number;
|
|
796
837
|
poolSize?: number;
|
|
838
|
+
/**
|
|
839
|
+
* Seconds before hard sticky expiry at which native connections receive
|
|
840
|
+
* the `expiring` event so the provider can drain and reconnect cleanly.
|
|
841
|
+
* Declared by the provider; the SDK does not assume a default cut point.
|
|
842
|
+
*/
|
|
843
|
+
drainLeadSeconds?: number;
|
|
797
844
|
};
|
|
798
845
|
}
|
|
799
846
|
|
|
@@ -804,9 +851,9 @@ export interface ProviderAccessConfig {
|
|
|
804
851
|
* Provider-level rollout visibility.
|
|
805
852
|
*
|
|
806
853
|
* - `public`: visible in public docs/catalog/OpenAPI and callable through
|
|
807
|
-
*
|
|
854
|
+
* the existing provider policy stack.
|
|
808
855
|
* - `early_access`: hidden from public discovery and callable only when the
|
|
809
|
-
*
|
|
856
|
+
* active customer organization has a provider-level access grant.
|
|
810
857
|
*
|
|
811
858
|
* This is intentionally provider-level only. It does not alter auth mode,
|
|
812
859
|
* operation schemas, health-check authoring, `openWorld`, or Connection
|
|
@@ -828,12 +875,12 @@ export type ProviderLogoProfile =
|
|
|
828
875
|
*/
|
|
829
876
|
url?: string;
|
|
830
877
|
background?: string;
|
|
831
|
-
|
|
878
|
+
}
|
|
832
879
|
| {
|
|
833
880
|
source: "monogram" | "none";
|
|
834
881
|
background?: string;
|
|
835
882
|
fallbackReason: string;
|
|
836
|
-
|
|
883
|
+
};
|
|
837
884
|
|
|
838
885
|
export type ProviderPublicConnectionMode =
|
|
839
886
|
| "apifuse_managed"
|
|
@@ -970,6 +1017,11 @@ export interface HttpRetrySummary {
|
|
|
970
1017
|
export interface RequestOptions {
|
|
971
1018
|
headers?: Record<string, string>;
|
|
972
1019
|
params?: RequestParams;
|
|
1020
|
+
/**
|
|
1021
|
+
* Query parameters whose values contain credentials or other secret material.
|
|
1022
|
+
* They are sent like `params`, but redacted from SDK errors, traces, and recorded fixtures.
|
|
1023
|
+
*/
|
|
1024
|
+
sensitiveParams?: Record<string, string>;
|
|
973
1025
|
proxy?: string;
|
|
974
1026
|
timeout?: number;
|
|
975
1027
|
/**
|
|
@@ -978,8 +1030,32 @@ export interface RequestOptions {
|
|
|
978
1030
|
*/
|
|
979
1031
|
throwOnHttpError?: boolean;
|
|
980
1032
|
retry?: boolean | HttpRetryPreset | HttpRetryOptions;
|
|
1033
|
+
/**
|
|
1034
|
+
* Opt-in redirect-hop enforcement for ctx.http. When present, redirects are
|
|
1035
|
+
* evaluated before the next request is issued. Existing callers that omit
|
|
1036
|
+
* this policy retain the native fetch redirect behavior.
|
|
1037
|
+
*/
|
|
1038
|
+
redirectPolicy?: HttpRedirectPolicy;
|
|
981
1039
|
}
|
|
982
1040
|
|
|
1041
|
+
export type RedirectRunReason =
|
|
1042
|
+
| "completed"
|
|
1043
|
+
| "stopped"
|
|
1044
|
+
| "max_hops"
|
|
1045
|
+
| "missing_location"
|
|
1046
|
+
| "loop";
|
|
1047
|
+
|
|
1048
|
+
export type HttpRedirectPolicyMode = "same-origin";
|
|
1049
|
+
|
|
1050
|
+
export interface HttpRedirectPolicy {
|
|
1051
|
+
/** Only follow redirects whose canonical scheme, host, and port match the initial URL. */
|
|
1052
|
+
mode: HttpRedirectPolicyMode;
|
|
1053
|
+
/** Maximum number of redirect hops that may be followed. Must be an integer from 0 to 20. */
|
|
1054
|
+
maxHops: number;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
export type HttpRedirectFailureReason = Exclude<RedirectRunReason, "completed">;
|
|
1058
|
+
|
|
983
1059
|
export type HttpMethod =
|
|
984
1060
|
| "HEAD"
|
|
985
1061
|
| "head"
|
|
@@ -998,10 +1074,16 @@ export type HttpMethod =
|
|
|
998
1074
|
| "PATCH"
|
|
999
1075
|
| "patch";
|
|
1000
1076
|
|
|
1001
|
-
export interface StealthFetchOptions extends RequestOptions {
|
|
1077
|
+
export interface StealthFetchOptions extends Omit<RequestOptions, "redirectPolicy"> {
|
|
1002
1078
|
method?: HttpMethod;
|
|
1003
1079
|
body?: string | Buffer;
|
|
1004
1080
|
redirect?: "follow" | "manual" | "error";
|
|
1081
|
+
/**
|
|
1082
|
+
* Maximum decoded response-body bytes to buffer. When set, the stealth
|
|
1083
|
+
* transport aborts the response and throws `response_too_large` if the
|
|
1084
|
+
* declared or streamed body exceeds this limit.
|
|
1085
|
+
*/
|
|
1086
|
+
maxBodyBytes?: number;
|
|
1005
1087
|
/**
|
|
1006
1088
|
* Offsets policy-managed proxy pool selection for caller-managed retries.
|
|
1007
1089
|
* Use when a request receives an upstream challenge page rather than a
|
|
@@ -1022,18 +1104,45 @@ export interface StealthFetchOptions extends RequestOptions {
|
|
|
1022
1104
|
}
|
|
1023
1105
|
|
|
1024
1106
|
export interface CookieJar {
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1107
|
+
/** URL-less reads use the jar's response URL or session base URL. */
|
|
1108
|
+
get(name: string, url?: string): string | undefined;
|
|
1109
|
+
getAll(url?: string): Record<string, string>;
|
|
1110
|
+
toString(url?: string): string;
|
|
1111
|
+
find?(predicate: (cookie: string) => boolean, url?: string): string | undefined;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
/**
|
|
1115
|
+
* Version 1 of the JSON-safe, attribute-preserving stealth cookie store.
|
|
1116
|
+
* The nested jar is tough-cookie's serialized form and retains cookie origin,
|
|
1117
|
+
* Path, Secure, expiry, host-only, and other RFC attributes.
|
|
1118
|
+
*/
|
|
1119
|
+
export interface StealthCookieStoreV1 {
|
|
1120
|
+
readonly version: 1;
|
|
1121
|
+
readonly jar: SerializedCookieJar;
|
|
1029
1122
|
}
|
|
1030
1123
|
|
|
1124
|
+
/** Cookie persistence formats understood by this SDK version. */
|
|
1125
|
+
export type StealthCookieStore = StealthCookieStoreV1;
|
|
1126
|
+
|
|
1031
1127
|
export interface StealthSessionCookies extends CookieJar {
|
|
1032
|
-
has(name: string): boolean;
|
|
1033
|
-
|
|
1034
|
-
|
|
1128
|
+
has(name: string, url?: string): boolean;
|
|
1129
|
+
/** URL-less writes are scoped to the session base URL. */
|
|
1130
|
+
setFromCookieStrings(cookieStrings: readonly string[], url?: string): void;
|
|
1131
|
+
toHeader(url?: string): string;
|
|
1132
|
+
/**
|
|
1133
|
+
* Returns every cookie as a flat name/value map, collapsing duplicate names.
|
|
1134
|
+
* @deprecated Use serialize() for lossless, attribute-preserving persistence.
|
|
1135
|
+
*/
|
|
1035
1136
|
snapshot(): Record<string, string>;
|
|
1137
|
+
/**
|
|
1138
|
+
* Restores flat values as host-only, Path=/ cookies on the session base URL.
|
|
1139
|
+
* @deprecated Use deserialize() with state produced by serialize().
|
|
1140
|
+
*/
|
|
1036
1141
|
restore(cookies: Record<string, string>): void;
|
|
1142
|
+
/** Returns a versioned, JSON-safe, attribute-preserving representation of every cookie. */
|
|
1143
|
+
serialize(): StealthCookieStoreV1;
|
|
1144
|
+
/** Replaces the jar with a previously serialized, attribute-preserving cookie store. */
|
|
1145
|
+
deserialize(state: StealthCookieStore): void;
|
|
1037
1146
|
clear(): void;
|
|
1038
1147
|
}
|
|
1039
1148
|
|
|
@@ -1078,8 +1187,14 @@ export interface StealthRedirectRunOptions
|
|
|
1078
1187
|
export interface StealthRedirectRunResult {
|
|
1079
1188
|
final: StealthResponse;
|
|
1080
1189
|
hops: StealthRedirectHop[];
|
|
1081
|
-
reason:
|
|
1190
|
+
reason: RedirectRunReason;
|
|
1191
|
+
/**
|
|
1192
|
+
* Complete flat view across all redirect hosts. Attributes and duplicate names are lost.
|
|
1193
|
+
* @deprecated Use cookieStore for lossless persistence.
|
|
1194
|
+
*/
|
|
1082
1195
|
cookies: Record<string, string>;
|
|
1196
|
+
/** Versioned, attribute-preserving cookie state accumulated across the redirect chain. */
|
|
1197
|
+
cookieStore: StealthCookieStoreV1;
|
|
1083
1198
|
}
|
|
1084
1199
|
|
|
1085
1200
|
export interface StealthSession {
|
|
@@ -1169,6 +1284,186 @@ export interface HttpClient {
|
|
|
1169
1284
|
): Promise<AsyncIterable<SseMessage>>;
|
|
1170
1285
|
}
|
|
1171
1286
|
|
|
1287
|
+
/** Request-scoped file reference accepted by provider operation inputs. */
|
|
1288
|
+
export interface ProviderFileRef {
|
|
1289
|
+
readonly type: "request_file";
|
|
1290
|
+
readonly id: string;
|
|
1291
|
+
readonly filename: string;
|
|
1292
|
+
readonly mime_type?: string;
|
|
1293
|
+
readonly size: number;
|
|
1294
|
+
readonly sha256?: string;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
/** File body resolved from a request-scoped {@link ProviderFileRef}. */
|
|
1298
|
+
export type ProviderResolvedFile = Omit<ProviderFileRef, "mime_type"> & {
|
|
1299
|
+
readonly mimeType?: string;
|
|
1300
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
1301
|
+
bytes(): Promise<Uint8Array>;
|
|
1302
|
+
stream(): ReadableStream<Uint8Array>;
|
|
1303
|
+
};
|
|
1304
|
+
|
|
1305
|
+
/** Resolver supplied by runtimes that accept request-scoped file inputs. */
|
|
1306
|
+
export interface ProviderFilesContext {
|
|
1307
|
+
has(input: string | ProviderFileRef): boolean;
|
|
1308
|
+
resolve(input: string | ProviderFileRef): Promise<ProviderResolvedFile>;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
export type NativeTcpTlsMode = "required" | "allowed" | "disabled";
|
|
1312
|
+
|
|
1313
|
+
export interface NativeTcpPortRange {
|
|
1314
|
+
readonly start: number;
|
|
1315
|
+
readonly end: number;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
/** Static native TCP egress declared by a provider. */
|
|
1319
|
+
export interface NativeTcpEgressRule {
|
|
1320
|
+
readonly host: string;
|
|
1321
|
+
readonly ports: readonly number[];
|
|
1322
|
+
readonly tls: NativeTcpTlsMode;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
/**
|
|
1326
|
+
* Bounded native TCP egress discovered through a declared bootstrap endpoint.
|
|
1327
|
+
* Host suffixes are exact DNS suffixes, not wildcard patterns.
|
|
1328
|
+
* Dynamic rules must declare at least one target host selector through
|
|
1329
|
+
* targetHostSuffixes, targetIpv4Cidrs, and/or targetIpv6Cidrs. Literal grant
|
|
1330
|
+
* sources and targets match only same-family selectors (except exact
|
|
1331
|
+
* sourceHost); DNS names match only host/suffix selectors. IPv4-mapped and
|
|
1332
|
+
* IPv4-compatible IPv6 literals are authorized only by IPv4 CIDRs.
|
|
1333
|
+
*
|
|
1334
|
+
* Dynamic rules are ordered. The first rule whose source, target, port, and TLS
|
|
1335
|
+
* selectors match exclusively owns the grant; its ttlMs and maxGrants bounds
|
|
1336
|
+
* apply, and an exhausted/shorter rule never falls through to a later overlap.
|
|
1337
|
+
* Every rule must declare a source host selector, source port list/range, and
|
|
1338
|
+
* target port list/range; omitted ttlMs/maxGrants remain unbounded.
|
|
1339
|
+
*/
|
|
1340
|
+
export interface NativeTcpDynamicEgressRule {
|
|
1341
|
+
readonly sourceHost?: string;
|
|
1342
|
+
readonly sourceHostSuffixes?: readonly string[];
|
|
1343
|
+
readonly sourceIpv4Cidrs?: readonly string[];
|
|
1344
|
+
readonly sourceIpv6Cidrs?: readonly string[];
|
|
1345
|
+
readonly sourcePorts?: readonly number[];
|
|
1346
|
+
readonly sourcePortRanges?: readonly NativeTcpPortRange[];
|
|
1347
|
+
readonly targetHostSuffixes?: readonly string[];
|
|
1348
|
+
readonly targetIpv4Cidrs?: readonly string[];
|
|
1349
|
+
readonly targetIpv6Cidrs?: readonly string[];
|
|
1350
|
+
readonly targetPorts?: readonly number[];
|
|
1351
|
+
readonly targetPortRanges?: readonly NativeTcpPortRange[];
|
|
1352
|
+
readonly tls: NativeTcpTlsMode;
|
|
1353
|
+
readonly ttlMs?: number;
|
|
1354
|
+
readonly maxGrants?: number;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
/** Common TCP/TLS connection input supported by the native runtime. */
|
|
1358
|
+
export interface NativeNetworkConnectInput {
|
|
1359
|
+
readonly host: string;
|
|
1360
|
+
readonly port: number;
|
|
1361
|
+
readonly serverName?: string;
|
|
1362
|
+
readonly rejectUnauthorized?: boolean;
|
|
1363
|
+
/**
|
|
1364
|
+
* Maximum time without a successful socket read before the connection is
|
|
1365
|
+
* closed. Opt-in; when absent, reads can remain pending indefinitely.
|
|
1366
|
+
*/
|
|
1367
|
+
readonly idleTimeoutMs?: number;
|
|
1368
|
+
/** Maximum time allowed to establish the TCP/SOCKS/TLS connection. */
|
|
1369
|
+
readonly timeoutMs?: number;
|
|
1370
|
+
readonly signal?: AbortSignal;
|
|
1371
|
+
/** Overrides the credential-derived sticky affinity key. */
|
|
1372
|
+
readonly affinityKey?: string;
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
export type NativeNetworkConnectOptions = Omit<
|
|
1376
|
+
NativeNetworkConnectInput,
|
|
1377
|
+
"serverName" | "rejectUnauthorized"
|
|
1378
|
+
>;
|
|
1379
|
+
|
|
1380
|
+
export type NativeTlsConnectOptions = NativeNetworkConnectInput;
|
|
1381
|
+
|
|
1382
|
+
export interface NativeNetworkDynamicGrantOptions {
|
|
1383
|
+
readonly sourceHost: string;
|
|
1384
|
+
readonly sourcePort: number;
|
|
1385
|
+
readonly host: string;
|
|
1386
|
+
readonly port: number;
|
|
1387
|
+
readonly tls: NativeTcpTlsMode;
|
|
1388
|
+
readonly ttlMs?: number;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
export interface NativeNetworkEgressGrant {
|
|
1392
|
+
revoke(): void;
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
/** Consumer-facing alias used by native TCP providers. */
|
|
1396
|
+
export type NativeTcpEgressGrant = NativeNetworkEgressGrant;
|
|
1397
|
+
|
|
1398
|
+
/** Resolved egress identity for a native connection routed through a proxy. */
|
|
1399
|
+
export interface NativeProxyEgressInfo {
|
|
1400
|
+
readonly vendor: ProviderProxyProvider;
|
|
1401
|
+
readonly sticky: boolean;
|
|
1402
|
+
/** Vendor sticky session id (sid). Absent for rotating sessions. */
|
|
1403
|
+
readonly sessionId?: string;
|
|
1404
|
+
/** Hard expiry of the sticky binding, ISO 8601. */
|
|
1405
|
+
readonly expiresAt?: string;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
export type NativeProxyExpiringReason = "sticky_expiry";
|
|
1409
|
+
|
|
1410
|
+
export interface NativeProxyExpiringEvent {
|
|
1411
|
+
readonly expiresAt: string;
|
|
1412
|
+
readonly leadSeconds: number;
|
|
1413
|
+
readonly reason: NativeProxyExpiringReason;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
/**
|
|
1417
|
+
* Cooperative drain handler. The SDK awaits this before closing a socket whose
|
|
1418
|
+
* sticky proxy binding is about to expire, then force-closes at hard expiry.
|
|
1419
|
+
*/
|
|
1420
|
+
export type NativeProxyDrainHandler = (
|
|
1421
|
+
event: NativeProxyExpiringEvent,
|
|
1422
|
+
) => void | Promise<void>;
|
|
1423
|
+
|
|
1424
|
+
/** Typed reason recorded when the SDK closes a native connection intentionally. */
|
|
1425
|
+
export interface NativeNetworkCloseReason {
|
|
1426
|
+
readonly code: string;
|
|
1427
|
+
readonly message: string;
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
/** Byte-oriented connection returned by the native TCP/TLS runtime. */
|
|
1431
|
+
export interface NativeNetworkConnection {
|
|
1432
|
+
/** Present when the connection was routed through a proxy. */
|
|
1433
|
+
readonly proxy?: NativeProxyEgressInfo;
|
|
1434
|
+
/** Present after an SDK-planned close, such as sticky proxy expiry. */
|
|
1435
|
+
readonly closeReason?: NativeNetworkCloseReason;
|
|
1436
|
+
/** Register a cooperative drain handler for sticky-expiry reconnects. */
|
|
1437
|
+
onExpiring?(handler: NativeProxyDrainHandler): void;
|
|
1438
|
+
read(): Promise<Uint8Array | null>;
|
|
1439
|
+
write(data: Uint8Array): Promise<void>;
|
|
1440
|
+
close(): Promise<void>;
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
export interface NativeNetworkClient {
|
|
1444
|
+
connectTcp(
|
|
1445
|
+
input: NativeNetworkConnectOptions,
|
|
1446
|
+
): Promise<NativeNetworkConnection>;
|
|
1447
|
+
connectTls(input: NativeTlsConnectOptions): Promise<NativeNetworkConnection>;
|
|
1448
|
+
grantTcpEgress(
|
|
1449
|
+
input: NativeNetworkDynamicGrantOptions,
|
|
1450
|
+
): NativeNetworkEgressGrant;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
export interface NativeContext {
|
|
1454
|
+
readonly network: NativeNetworkClient;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
/** Consumer-facing alias for the native capability on provider contexts. */
|
|
1458
|
+
export type NativeProviderContext = NativeContext;
|
|
1459
|
+
|
|
1460
|
+
export interface NativeProviderConfig {
|
|
1461
|
+
readonly network?: {
|
|
1462
|
+
readonly tcp?: readonly NativeTcpEgressRule[];
|
|
1463
|
+
readonly dynamicTcp?: readonly NativeTcpDynamicEgressRule[];
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1172
1467
|
export interface ProviderCacheKeyOptions {
|
|
1173
1468
|
/**
|
|
1174
1469
|
* Additional field names to omit from stable key material. The SDK always
|
|
@@ -1285,11 +1580,11 @@ export type BrowserResourceDecision =
|
|
|
1285
1580
|
readonly status?: number;
|
|
1286
1581
|
readonly headers?: Readonly<Record<string, string>>;
|
|
1287
1582
|
readonly body?: BrowserResourceBody;
|
|
1288
|
-
|
|
1583
|
+
}
|
|
1289
1584
|
| {
|
|
1290
1585
|
readonly action: "block";
|
|
1291
1586
|
readonly reason?: string;
|
|
1292
|
-
|
|
1587
|
+
};
|
|
1293
1588
|
|
|
1294
1589
|
export type BrowserResourceRoute = {
|
|
1295
1590
|
readonly match:
|
|
@@ -1401,7 +1696,7 @@ export interface ProviderChoiceBindingOptions {
|
|
|
1401
1696
|
export type ProviderChoiceStorageOptions =
|
|
1402
1697
|
| {
|
|
1403
1698
|
readonly mode: "inline";
|
|
1404
|
-
|
|
1699
|
+
}
|
|
1405
1700
|
| {
|
|
1406
1701
|
readonly mode: "server";
|
|
1407
1702
|
readonly namespace: string;
|
|
@@ -1410,7 +1705,7 @@ export type ProviderChoiceStorageOptions =
|
|
|
1410
1705
|
readonly maxEntries: number;
|
|
1411
1706
|
readonly maxValueBytes: number;
|
|
1412
1707
|
readonly unavailable?: "reject";
|
|
1413
|
-
|
|
1708
|
+
}
|
|
1414
1709
|
| {
|
|
1415
1710
|
readonly mode: "auto";
|
|
1416
1711
|
readonly namespace: string;
|
|
@@ -1420,7 +1715,7 @@ export type ProviderChoiceStorageOptions =
|
|
|
1420
1715
|
readonly maxEntries: number;
|
|
1421
1716
|
readonly maxValueBytes: number;
|
|
1422
1717
|
readonly unavailable?: "reject";
|
|
1423
|
-
|
|
1718
|
+
};
|
|
1424
1719
|
|
|
1425
1720
|
export interface ProviderChoiceIssueOptions<
|
|
1426
1721
|
TPayload extends Record<string, unknown>,
|
|
@@ -1564,11 +1859,11 @@ export interface AuthFlowTerminalContext {
|
|
|
1564
1859
|
}
|
|
1565
1860
|
>;
|
|
1566
1861
|
readonly expectedInput?: never;
|
|
1567
|
-
|
|
1862
|
+
}
|
|
1568
1863
|
| {
|
|
1569
1864
|
readonly expectedInput: Record<string, unknown>;
|
|
1570
1865
|
readonly fields?: never;
|
|
1571
|
-
|
|
1866
|
+
}
|
|
1572
1867
|
),
|
|
1573
1868
|
): AuthTurn;
|
|
1574
1869
|
nextPoll(options?: {
|
|
@@ -1581,11 +1876,15 @@ export interface AuthFlowTerminalContext {
|
|
|
1581
1876
|
}
|
|
1582
1877
|
|
|
1583
1878
|
export interface FlowContext {
|
|
1879
|
+
/** Gateway auth-flow id. Required by flow-scoped auth ceremonies. */
|
|
1880
|
+
flowId?: string;
|
|
1584
1881
|
connectionId?: string;
|
|
1585
1882
|
externalRef?: string;
|
|
1586
1883
|
tenantId: string;
|
|
1587
1884
|
providerId: string;
|
|
1588
1885
|
http: HttpClient;
|
|
1886
|
+
/** Present when the selected runtime supplies native network capabilities. */
|
|
1887
|
+
readonly native?: NativeProviderContext;
|
|
1589
1888
|
stealth: StealthClient;
|
|
1590
1889
|
env: EnvContext;
|
|
1591
1890
|
credential?: CredentialContext;
|
|
@@ -1705,6 +2004,10 @@ export interface ProviderContext {
|
|
|
1705
2004
|
credential: CredentialContext;
|
|
1706
2005
|
request?: ProviderRequestContext;
|
|
1707
2006
|
http: HttpClient;
|
|
2007
|
+
/** Present for requests carrying runtime-resolvable file references. */
|
|
2008
|
+
readonly files?: ProviderFilesContext;
|
|
2009
|
+
/** Present when the selected runtime supplies native network capabilities. */
|
|
2010
|
+
readonly native?: NativeProviderContext;
|
|
1708
2011
|
cache: ProviderCache;
|
|
1709
2012
|
state: ProviderRuntimeState;
|
|
1710
2013
|
stealth: StealthClient;
|
|
@@ -1715,8 +2018,21 @@ export interface ProviderContext {
|
|
|
1715
2018
|
choice: ProviderChoiceContext;
|
|
1716
2019
|
}
|
|
1717
2020
|
|
|
2021
|
+
export interface ProxiedOAuthConfig {
|
|
2022
|
+
authorizeUrl: string;
|
|
2023
|
+
tokenUrl: string;
|
|
2024
|
+
customScheme: string;
|
|
2025
|
+
rewriteProfile: string;
|
|
2026
|
+
clientIdEnvKey: string;
|
|
2027
|
+
pkce?: "S256" | "none";
|
|
2028
|
+
authorizeParams?: Record<string, string>;
|
|
2029
|
+
tokenParams?: Record<string, string>;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
1718
2032
|
export interface AuthConfig {
|
|
1719
2033
|
mode: AuthMode;
|
|
2034
|
+
/** Browser reverse-proxy contract for providers with custom-scheme OAuth callbacks. */
|
|
2035
|
+
proxied?: ProxiedOAuthConfig;
|
|
1720
2036
|
flow?: AuthFlowDefinition;
|
|
1721
2037
|
}
|
|
1722
2038
|
|
|
@@ -1759,6 +2075,19 @@ export interface OperationDefinition<
|
|
|
1759
2075
|
TInput extends SchemaLike = SchemaLike,
|
|
1760
2076
|
TOutput extends SchemaLike = SchemaLike,
|
|
1761
2077
|
> {
|
|
2078
|
+
/**
|
|
2079
|
+
* Short English display title for the operation. The SDK passes it through
|
|
2080
|
+
* verbatim; the APIFuse registry derives the operation's en locale title
|
|
2081
|
+
* baseline from it (`docs.titleKey` remains available as an explicit key
|
|
2082
|
+
* override).
|
|
2083
|
+
*/
|
|
2084
|
+
title?: string;
|
|
2085
|
+
/**
|
|
2086
|
+
* Raw English operation description. The SDK passes it through verbatim;
|
|
2087
|
+
* keyed descriptions via `descriptionKey` remain the primary flow, and
|
|
2088
|
+
* provider lint rules for raw prose descriptions still apply.
|
|
2089
|
+
*/
|
|
2090
|
+
description?: string;
|
|
1762
2091
|
descriptionKey?: ProviderLocaleKeyInput;
|
|
1763
2092
|
docs?: OperationDocMeta;
|
|
1764
2093
|
whenToUseKeys?: readonly ProviderLocaleKeyInput[];
|
|
@@ -1784,6 +2113,11 @@ export interface OperationDefinition<
|
|
|
1784
2113
|
fixtures?: {
|
|
1785
2114
|
request: InferSchemaOutput<TInput>;
|
|
1786
2115
|
response: InferSchemaOutput<TOutput>;
|
|
2116
|
+
/**
|
|
2117
|
+
* KST calendar date when `response` evidence was captured. Date fields in
|
|
2118
|
+
* the response align with this date, not a resolved relative request date.
|
|
2119
|
+
*/
|
|
2120
|
+
recordedAt?: string;
|
|
1787
2121
|
};
|
|
1788
2122
|
upstream?: {
|
|
1789
2123
|
baseUrl?: string;
|
|
@@ -1797,11 +2131,57 @@ export interface OperationDefinition<
|
|
|
1797
2131
|
healthCheckUnsupported?: HealthCheckUnsupported;
|
|
1798
2132
|
}
|
|
1799
2133
|
|
|
2134
|
+
/**
|
|
2135
|
+
* Author-declared deployment overrides accepted as the optional top-level
|
|
2136
|
+
* `deployment` key on `defineProvider()`.
|
|
2137
|
+
*
|
|
2138
|
+
* The SDK passes this object through VERBATIM onto the returned provider
|
|
2139
|
+
* definition — it is typed here but deliberately not deep-validated: the
|
|
2140
|
+
* APIFuse registry builder owns deployment validation and resolves omitted
|
|
2141
|
+
* fields against the runtime deployment profiles. The shape mirrors the
|
|
2142
|
+
* registry's `ProviderDeploymentOverrides` contract; every field is
|
|
2143
|
+
* optional. Note that the deployment `runtime` axis
|
|
2144
|
+
* (`shared`/`dedicated`/`browser`) is distinct from the provider execution
|
|
2145
|
+
* `runtime` (`standard`/`shared`/`browser`).
|
|
2146
|
+
*/
|
|
2147
|
+
export interface ProviderDeploymentOverrides {
|
|
2148
|
+
runtime?: "shared" | "dedicated" | "browser";
|
|
2149
|
+
language?: "typescript" | "python";
|
|
2150
|
+
replicas?: number;
|
|
2151
|
+
hpa?: {
|
|
2152
|
+
enabled: boolean;
|
|
2153
|
+
minReplicas?: number;
|
|
2154
|
+
maxReplicas?: number;
|
|
2155
|
+
targetCPUUtilizationPercentage?: number;
|
|
2156
|
+
};
|
|
2157
|
+
resources?: {
|
|
2158
|
+
cpu: string;
|
|
2159
|
+
memory: string;
|
|
2160
|
+
};
|
|
2161
|
+
cache?: {
|
|
2162
|
+
redis?: {
|
|
2163
|
+
enabled: boolean;
|
|
2164
|
+
url?: string;
|
|
2165
|
+
};
|
|
2166
|
+
};
|
|
2167
|
+
network?: {
|
|
2168
|
+
additionalTcpPorts?: number[];
|
|
2169
|
+
};
|
|
2170
|
+
buildContext?: string;
|
|
2171
|
+
}
|
|
2172
|
+
|
|
1800
2173
|
export interface ProviderDefinition {
|
|
1801
2174
|
id: string;
|
|
1802
2175
|
version: string;
|
|
1803
2176
|
runtime: "standard" | "shared" | "browser";
|
|
2177
|
+
/**
|
|
2178
|
+
* Optional deployment overrides, passed through verbatim from
|
|
2179
|
+
* `defineProvider({ deployment })`. Validation and profile resolution are
|
|
2180
|
+
* owned by the APIFuse registry builder, not the SDK.
|
|
2181
|
+
*/
|
|
2182
|
+
deployment?: ProviderDeploymentOverrides;
|
|
1804
2183
|
allowedHosts?: string[];
|
|
2184
|
+
native?: NativeProviderConfig;
|
|
1805
2185
|
stealth?: {
|
|
1806
2186
|
profile: string;
|
|
1807
2187
|
platform: StealthPlatform;
|