@apifuse/provider-sdk 2.2.0-beta.48 → 2.2.0-beta.49
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 +91 -36
- package/CHANGELOG.md +4 -0
- package/README.md +11 -9
- package/SUBMISSION.md +1 -1
- package/bin/apifuse-dev.ts +24 -13
- package/bin/apifuse-migrate-operation-declaration.ts +55 -0
- package/bin/apifuse-pack-smoke.ts +1 -1
- package/bin/apifuse-pack-types.ts +2 -1
- package/bin/apifuse-record.ts +30 -16
- package/bin/apifuse-submit-check.ts +20 -35
- package/dist/cli/commands.d.ts +1 -1
- package/dist/cli/commands.js +11 -0
- package/dist/cli/migrate-operation-declaration.d.ts +59 -0
- package/dist/cli/migrate-operation-declaration.js +1178 -0
- package/dist/cli/templates/provider/README.md.tpl +3 -3
- package/dist/cli/templates/provider/operations/ping.ts.tpl +2 -0
- package/dist/config/loader.d.ts +2 -0
- package/dist/config/loader.js +18 -7
- package/dist/contract-types.d.ts +11 -5
- package/dist/contract.js +21 -10
- package/dist/define.d.ts +25 -22
- package/dist/define.js +49 -75
- package/dist/dev.d.ts +3 -0
- package/dist/dev.js +1 -1
- package/dist/engine.d.ts +78 -0
- package/dist/engine.js +133 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/lint.d.ts +7 -15
- package/dist/lint.js +45 -70
- package/dist/provider.d.ts +3 -1
- package/dist/provider.js +1 -0
- package/dist/runtime/chrome149-header-order.d.ts +58 -0
- package/dist/runtime/chrome149-header-order.js +289 -0
- package/dist/runtime/env.js +12 -0
- package/dist/runtime/executor.d.ts +2 -1
- package/dist/runtime/executor.js +3 -36
- package/dist/runtime/insights.js +2 -2
- package/dist/runtime/otlp.d.ts +71 -2
- package/dist/runtime/otlp.js +397 -16
- package/dist/runtime/resolver-vendors/capsolver.js +3 -3
- package/dist/runtime/resolver.js +3 -3
- package/dist/runtime/stealth.d.ts +13 -4
- package/dist/runtime/stealth.js +362 -85
- package/dist/runtime/trace-config.js +2 -1
- package/dist/runtime/trace.d.ts +5 -0
- package/dist/runtime/trace.js +43 -10
- package/dist/server/self-test.d.ts +1 -3
- package/dist/server/self-test.js +2 -12
- package/dist/server/serve-implementation.d.ts +6 -1
- package/dist/server/serve-implementation.js +55 -40
- package/dist/server/trace-output.d.ts +3 -1
- package/dist/server/trace-output.js +61 -2
- package/dist/stealth/profiles.d.ts +9 -8
- package/dist/stealth/profiles.js +123 -286
- package/dist/types.d.ts +111 -108
- package/package.json +2 -1
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/approval-override.ts.txt +6 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/codemod-syntax.ts.txt +3 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/connection-precedence.ts.txt +10 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/docs-conflict.ts.txt +8 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/examples-map.ts.txt +5 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/examples-operation.ts.txt +16 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/factory-map.ts.txt +3 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/hoist-all.ts.txt +31 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/hoisted-const.ts.txt +11 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/imported-spread.ts.txt +11 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-map.ts.txt +11 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-spread-cast-tail.ts.txt +21 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-spread-ekitan.ts.txt +11 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-spread-override.ts.txt +14 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/missing-english-locale.ts.txt +7 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/no-safety.ts.txt +6 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/non-literal.ts.txt +7 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/redundant-approval.ts.txt +6 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/safety-conflict.ts.txt +7 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/stream.ts.txt +7 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/tool-router-spread.ts.txt +15 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/unparseable.ts.txt +4 -0
- package/src/cli/__tests__/fixtures/migrate-operation-declaration/verbatim-template.ts.txt +12 -0
- package/src/cli/commands.ts +13 -0
- package/src/cli/migrate-operation-declaration.ts +1654 -0
- package/src/cli/templates/provider/README.md.tpl +3 -3
- package/src/cli/templates/provider/operations/ping.ts.tpl +2 -0
- package/src/config/loader.ts +31 -6
- package/src/contract-types.ts +11 -5
- package/src/contract.ts +21 -10
- package/src/define.ts +107 -119
- package/src/dev.ts +4 -1
- package/src/engine.ts +279 -0
- package/src/index.ts +13 -5
- package/src/lint.ts +58 -92
- package/src/provider.ts +25 -3
- package/src/runtime/chrome149-header-order.ts +330 -0
- package/src/runtime/env.ts +13 -0
- package/src/runtime/executor.ts +7 -40
- package/src/runtime/insights.ts +2 -2
- package/src/runtime/otlp.ts +467 -21
- package/src/runtime/resolver-vendors/capsolver.ts +4 -3
- package/src/runtime/resolver.ts +3 -3
- package/src/runtime/stealth.ts +435 -103
- package/src/runtime/trace-config.ts +3 -2
- package/src/runtime/trace.ts +57 -17
- package/src/server/self-test.ts +2 -9
- package/src/server/serve-implementation.ts +89 -72
- package/src/server/trace-output.ts +99 -2
- package/src/stealth/profiles.ts +169 -327
- package/src/types.ts +109 -137
package/src/types.ts
CHANGED
|
@@ -43,10 +43,10 @@ export type InferSchemaOutput<TSchema extends SchemaLike> =
|
|
|
43
43
|
? Output
|
|
44
44
|
: unknown;
|
|
45
45
|
|
|
46
|
-
export interface
|
|
47
|
-
|
|
46
|
+
export interface OperationExample {
|
|
47
|
+
scenarioKey: ProviderLocaleKeyInput;
|
|
48
48
|
input: unknown;
|
|
49
|
-
|
|
49
|
+
rationaleKey?: ProviderLocaleKeyInput;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export type OperationRiskClass =
|
|
@@ -57,21 +57,6 @@ export type OperationRiskClass =
|
|
|
57
57
|
|
|
58
58
|
export type OperationApprovalPolicy = "never" | "risk-based" | "always";
|
|
59
59
|
|
|
60
|
-
export interface OperationToolRouterMetadata {
|
|
61
|
-
/** Optional MCP-safe override. Defaults to providerId__operationId. */
|
|
62
|
-
name?: string;
|
|
63
|
-
/** Safety class exposed to Tool Router clients and approval policy. */
|
|
64
|
-
riskClass?: OperationRiskClass;
|
|
65
|
-
/** OpenAI remote-MCP approval hint. Defaults from riskClass. */
|
|
66
|
-
approval?: OperationApprovalPolicy;
|
|
67
|
-
/** Canonical operation-level connection requirement consumed by the registry and Gateway. */
|
|
68
|
-
connectionMode?: "none" | "optional" | "required";
|
|
69
|
-
/** Override connection requirement when provider auth + openWorld inference is insufficient. */
|
|
70
|
-
requiresConnection?: boolean;
|
|
71
|
-
/** Public argument used to resolve the tenant-owned connection. Defaults to externalRef. */
|
|
72
|
-
connectionExternalRefParam?: string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
60
|
export type OperationSensitivePath = string;
|
|
76
61
|
|
|
77
62
|
export interface OperationObservabilitySensitiveConfig {
|
|
@@ -96,38 +81,6 @@ export interface OperationObservabilityConfig {
|
|
|
96
81
|
sensitive?: OperationObservabilitySensitiveConfig;
|
|
97
82
|
}
|
|
98
83
|
|
|
99
|
-
export interface OperationAnnotations {
|
|
100
|
-
readOnly?: boolean;
|
|
101
|
-
destructive?: boolean;
|
|
102
|
-
idempotent?: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Marks the operation as callable without provider-level authentication.
|
|
105
|
-
*
|
|
106
|
-
* Provider-level `auth.mode` describes the **majority** auth model of a
|
|
107
|
-
* provider; individual operations can still opt out via `openWorld: true`
|
|
108
|
-
* when their handler does not consume `ctx.credential`. This is the
|
|
109
|
-
* canonical way to declare "this operation is public, even though the
|
|
110
|
-
* provider is `credentials`-mode" without splitting the provider into two.
|
|
111
|
-
*
|
|
112
|
-
* Health-check projections treat `openWorld: true` operations as
|
|
113
|
-
* connection-free probes (no `requiresConnection` required, no SA token
|
|
114
|
-
* lookup). Future gateway work MAY extend this annotation to bypass
|
|
115
|
-
* `X-ApiFuse-Connection-Id` enforcement at proxy time.
|
|
116
|
-
*
|
|
117
|
-
* Example: Naver Map's `search`, `geocode`, and directions operations
|
|
118
|
-
* call public Naver endpoints with no cookies, while `collections` and
|
|
119
|
-
* `export` consume the user's session cookie — the provider declares
|
|
120
|
-
* `auth.mode: "credentials"` (for the latter) and the former mark
|
|
121
|
-
* `openWorld: true`.
|
|
122
|
-
*/
|
|
123
|
-
openWorld?: boolean;
|
|
124
|
-
rateLimit?: {
|
|
125
|
-
calls: number;
|
|
126
|
-
window: "minute" | "hour" | "day";
|
|
127
|
-
};
|
|
128
|
-
timeoutMs?: number;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
84
|
export const OPERATION_TIMEOUT_MS_MIN = 1;
|
|
132
85
|
export const OPERATION_TIMEOUT_MS_MAX = 60_000;
|
|
133
86
|
|
|
@@ -931,19 +884,27 @@ export interface OperationErrorCode {
|
|
|
931
884
|
retryable?: boolean;
|
|
932
885
|
}
|
|
933
886
|
|
|
934
|
-
export interface OperationDocMeta {
|
|
935
|
-
titleKey?: ProviderLocaleKeyInput;
|
|
936
|
-
descriptionKey?: ProviderLocaleKeyInput;
|
|
937
|
-
summaryKey?: ProviderLocaleKeyInput;
|
|
938
|
-
markdownKey?: ProviderLocaleKeyInput;
|
|
939
|
-
normalizationNotesKeys?: ProviderLocaleKeyInput[];
|
|
940
|
-
requestExample?: Record<string, unknown>;
|
|
941
|
-
responseExample?: unknown;
|
|
942
|
-
errorCodes?: OperationErrorCode[];
|
|
943
|
-
}
|
|
944
|
-
|
|
945
887
|
export type StealthPlatform = "macos" | "windows" | "linux" | "android" | "ios";
|
|
946
888
|
|
|
889
|
+
export type StealthBrowser = "chrome" | "firefox" | "safari";
|
|
890
|
+
|
|
891
|
+
export type StealthOS = "windows" | "macos" | "linux" | "ios";
|
|
892
|
+
|
|
893
|
+
/** A supported, fully resolved browser/OS fingerprint pair. */
|
|
894
|
+
export type StealthProfileDescriptor =
|
|
895
|
+
| { browser: "chrome"; os: "windows" | "macos" | "linux" }
|
|
896
|
+
| { browser: "firefox"; os: "windows" | "macos" | "linux" }
|
|
897
|
+
| { browser: "safari"; os: "macos" | "ios" };
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* Browser/OS fingerprint selection. Chrome and macOS are the named defaults
|
|
901
|
+
* when their respective axes are omitted.
|
|
902
|
+
*/
|
|
903
|
+
export type StealthProfileSelection =
|
|
904
|
+
| { browser?: "chrome"; os?: "windows" | "macos" | "linux" }
|
|
905
|
+
| { browser: "firefox"; os?: "windows" | "macos" | "linux" }
|
|
906
|
+
| { browser: "safari"; os?: "macos" | "ios" };
|
|
907
|
+
|
|
947
908
|
export type BrowserEngine = "playwright-stealth" | "nodriver" | "selenium-uc";
|
|
948
909
|
export interface BrowserOptions {
|
|
949
910
|
headless?: boolean;
|
|
@@ -953,9 +914,7 @@ export interface BrowserOptions {
|
|
|
953
914
|
requireCdpPool?: boolean;
|
|
954
915
|
}
|
|
955
916
|
|
|
956
|
-
export
|
|
957
|
-
name: string;
|
|
958
|
-
platform: StealthPlatform;
|
|
917
|
+
export type StealthProfile = StealthProfileDescriptor & {
|
|
959
918
|
version: string;
|
|
960
919
|
userAgent: string;
|
|
961
920
|
tlsClientIdentifier?: string;
|
|
@@ -963,7 +922,7 @@ export interface StealthProfile {
|
|
|
963
922
|
ja4?: string;
|
|
964
923
|
h2Settings?: Record<string, unknown>;
|
|
965
924
|
headerOrder?: string[];
|
|
966
|
-
}
|
|
925
|
+
};
|
|
967
926
|
|
|
968
927
|
export type AuthMode =
|
|
969
928
|
| "none"
|
|
@@ -1057,8 +1016,7 @@ export interface ProviderAccessConfig {
|
|
|
1057
1016
|
* active customer organization has a provider-level access grant.
|
|
1058
1017
|
*
|
|
1059
1018
|
* This is intentionally provider-level only. It does not alter auth mode,
|
|
1060
|
-
* operation schemas, health-check authoring,
|
|
1061
|
-
* requirements.
|
|
1019
|
+
* operation schemas, health-check authoring, or Connection requirements.
|
|
1062
1020
|
*/
|
|
1063
1021
|
visibility?: ProviderAccessVisibility;
|
|
1064
1022
|
}
|
|
@@ -1279,7 +1237,12 @@ export type HttpMethod =
|
|
|
1279
1237
|
| "PATCH"
|
|
1280
1238
|
| "patch";
|
|
1281
1239
|
|
|
1282
|
-
export interface StealthFetchOptions extends Omit<RequestOptions, "redirectPolicy"> {
|
|
1240
|
+
export interface StealthFetchOptions extends Omit<RequestOptions, "redirectPolicy" | "headers"> {
|
|
1241
|
+
/**
|
|
1242
|
+
* Request headers. Array values and case-insensitive duplicate names are
|
|
1243
|
+
* combined in caller order using `", "`, matching Chrome's Fetch behavior.
|
|
1244
|
+
*/
|
|
1245
|
+
headers?: Record<string, string | string[]>;
|
|
1283
1246
|
method?: HttpMethod;
|
|
1284
1247
|
body?: string | Buffer;
|
|
1285
1248
|
redirect?: "follow" | "manual" | "error";
|
|
@@ -1296,14 +1259,18 @@ export interface StealthFetchOptions extends Omit<RequestOptions, "redirectPolic
|
|
|
1296
1259
|
* operation-affinity proxy.
|
|
1297
1260
|
*/
|
|
1298
1261
|
proxyAttemptOffset?: number;
|
|
1299
|
-
/** Override the configured browser-like stealth profile for this request. */
|
|
1300
|
-
profile?: string;
|
|
1301
1262
|
/**
|
|
1302
|
-
*
|
|
1303
|
-
*
|
|
1304
|
-
* certificate chain.
|
|
1263
|
+
* SDK-specific stealth controls. Standard HTTP metadata such as language,
|
|
1264
|
+
* referrer, and content type belongs in `headers`.
|
|
1305
1265
|
*/
|
|
1306
|
-
stealth?: {
|
|
1266
|
+
stealth?: StealthProfileSelection & {
|
|
1267
|
+
/** Override the configured browser and/or OS for this request. */
|
|
1268
|
+
/** Declare the Chrome request class when it cannot be inferred from the method. */
|
|
1269
|
+
requestClass?: "navigation" | "xhr" | "post";
|
|
1270
|
+
/**
|
|
1271
|
+
* Use only for proxy products that terminate CONNECT with a private CA
|
|
1272
|
+
* instead of tunneling the origin certificate chain.
|
|
1273
|
+
*/
|
|
1307
1274
|
insecureSkipVerify?: boolean;
|
|
1308
1275
|
};
|
|
1309
1276
|
}
|
|
@@ -1513,6 +1480,9 @@ export interface ProviderFilesContext {
|
|
|
1513
1480
|
resolve(input: string | ProviderFileRef): Promise<ProviderResolvedFile>;
|
|
1514
1481
|
}
|
|
1515
1482
|
|
|
1483
|
+
/** Where provider business logic executes relative to the capability engine. */
|
|
1484
|
+
export type ProviderRuntimeTarget = "vanilla" | "engine";
|
|
1485
|
+
|
|
1516
1486
|
export type NativeTcpTlsMode = "required" | "allowed" | "disabled";
|
|
1517
1487
|
|
|
1518
1488
|
export interface NativeTcpPortRange {
|
|
@@ -1730,7 +1700,7 @@ export interface ProviderCache {
|
|
|
1730
1700
|
|
|
1731
1701
|
export interface StealthClient {
|
|
1732
1702
|
fetch(url: string, options?: StealthFetchOptions): Promise<StealthResponse>;
|
|
1733
|
-
createSession(opts?: {
|
|
1703
|
+
createSession(opts?: { stealth?: StealthProfileSelection }): StealthSession;
|
|
1734
1704
|
close?(): void;
|
|
1735
1705
|
}
|
|
1736
1706
|
|
|
@@ -1888,7 +1858,7 @@ export interface TraceConfig {
|
|
|
1888
1858
|
exporter?: "console" | "json" | "otlp" | "none";
|
|
1889
1859
|
endpoint?: string;
|
|
1890
1860
|
otlp?: {
|
|
1891
|
-
endpoint
|
|
1861
|
+
endpoint?: string;
|
|
1892
1862
|
headers?: Record<string, string>;
|
|
1893
1863
|
timeout?: number;
|
|
1894
1864
|
};
|
|
@@ -2292,48 +2262,43 @@ export interface ProviderRuntimeState {
|
|
|
2292
2262
|
): ProviderStateNamespace;
|
|
2293
2263
|
}
|
|
2294
2264
|
|
|
2295
|
-
export interface ProviderContext {
|
|
2296
|
-
env: EnvContext;
|
|
2297
|
-
credential: CredentialContext;
|
|
2298
|
-
request?: ProviderRequestContext;
|
|
2299
|
-
http: HttpClient;
|
|
2300
|
-
/** Present for requests carrying runtime-resolvable file references. */
|
|
2301
|
-
readonly files?: ProviderFilesContext;
|
|
2302
|
-
/** Native network capability selected by declaration-derived contexts. */
|
|
2303
|
-
readonly native: NativeContext;
|
|
2304
|
-
cache: ProviderCache;
|
|
2305
|
-
state: ProviderRuntimeState;
|
|
2306
|
-
stealth: StealthClient;
|
|
2307
|
-
browser: BrowserClient;
|
|
2308
|
-
trace: TraceContext;
|
|
2309
|
-
auth: AuthContext;
|
|
2310
|
-
ocr: OcrContext;
|
|
2311
|
-
stt: SttContext;
|
|
2312
|
-
resolver: ResolverContext;
|
|
2313
|
-
choice: ProviderChoiceContext;
|
|
2314
|
-
}
|
|
2315
|
-
|
|
2316
2265
|
/**
|
|
2317
2266
|
* The operation context exposed for one provider declaration. Capability
|
|
2318
2267
|
* bindings are present only when their corresponding declaration is present;
|
|
2319
|
-
* trace and request remain ambient runtime bindings.
|
|
2268
|
+
* trace and request remain ambient runtime bindings. Omitting the type
|
|
2269
|
+
* parameter preserves the legacy full context shape for existing annotations.
|
|
2320
2270
|
*/
|
|
2321
|
-
export type
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
& ("
|
|
2326
|
-
& ("
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
& ("
|
|
2330
|
-
& ("
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
& ("
|
|
2336
|
-
|
|
2271
|
+
export type ProviderContext<TConfig = Record<string, unknown>> = {
|
|
2272
|
+
request?: ProviderRequestContext;
|
|
2273
|
+
trace: TraceContext;
|
|
2274
|
+
}
|
|
2275
|
+
& ("env" extends keyof TConfig ? { env: EnvContext } : Record<never, never>)
|
|
2276
|
+
& ("credential" extends keyof TConfig
|
|
2277
|
+
? { credential: CredentialContext }
|
|
2278
|
+
: Record<never, never>)
|
|
2279
|
+
& ("http" extends keyof TConfig ? { http: HttpClient } : Record<never, never>)
|
|
2280
|
+
& ("files" extends keyof TConfig
|
|
2281
|
+
? string extends keyof TConfig
|
|
2282
|
+
? { readonly files?: ProviderFilesContext }
|
|
2283
|
+
: { readonly files: ProviderFilesContext }
|
|
2284
|
+
: Record<never, never>)
|
|
2285
|
+
& ("native" extends keyof TConfig
|
|
2286
|
+
? { readonly native: NativeContext }
|
|
2287
|
+
: Record<never, never>)
|
|
2288
|
+
& ("cache" extends keyof TConfig ? { cache: ProviderCache } : Record<never, never>)
|
|
2289
|
+
& ("state" extends keyof TConfig ? { state: ProviderRuntimeState } : Record<never, never>)
|
|
2290
|
+
& ("stealth" extends keyof TConfig ? { stealth: StealthClient } : Record<never, never>)
|
|
2291
|
+
& ("browser" extends keyof TConfig ? { browser: BrowserClient } : Record<never, never>)
|
|
2292
|
+
& ("auth" extends keyof TConfig ? { auth: AuthContext } : Record<never, never>)
|
|
2293
|
+
& ("ocr" extends keyof TConfig ? { ocr: OcrContext } : Record<never, never>)
|
|
2294
|
+
& ("stt" extends keyof TConfig ? { stt: SttContext } : Record<never, never>)
|
|
2295
|
+
& ("resolver" extends keyof TConfig ? { resolver: ResolverContext } : Record<never, never>)
|
|
2296
|
+
& ("choice" extends keyof TConfig
|
|
2297
|
+
? { choice: ProviderChoiceContext }
|
|
2298
|
+
: Record<never, never>);
|
|
2299
|
+
|
|
2300
|
+
/** Backwards-compatible name for a declaration-derived provider context. */
|
|
2301
|
+
export type ProviderContextFor<TConfig> = ProviderContext<TConfig>;
|
|
2337
2302
|
|
|
2338
2303
|
export interface ProxiedOAuthConfig {
|
|
2339
2304
|
authorizeUrl: string;
|
|
@@ -2393,33 +2358,29 @@ export interface OperationDefinition<
|
|
|
2393
2358
|
TOutput extends SchemaLike = SchemaLike,
|
|
2394
2359
|
TContext = ProviderContext,
|
|
2395
2360
|
> {
|
|
2396
|
-
/**
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
* provider lint rules for raw prose descriptions still apply.
|
|
2407
|
-
*/
|
|
2408
|
-
description?: string;
|
|
2361
|
+
/** Canonical operation-level connection requirement. */
|
|
2362
|
+
connectionMode?: "none" | "optional" | "required";
|
|
2363
|
+
/** Public argument used to resolve the tenant-owned connection. Defaults to externalRef. */
|
|
2364
|
+
connectionExternalRefParam?: string;
|
|
2365
|
+
/** Safety source of truth exposed to clients and approval policy. */
|
|
2366
|
+
riskClass: OperationRiskClass;
|
|
2367
|
+
/** Approval override. Omit when the risk-class default is correct. */
|
|
2368
|
+
approval?: OperationApprovalPolicy;
|
|
2369
|
+
timeoutMs?: number;
|
|
2370
|
+
titleKey?: ProviderLocaleKeyInput;
|
|
2409
2371
|
descriptionKey?: ProviderLocaleKeyInput;
|
|
2410
|
-
|
|
2372
|
+
summaryKey?: ProviderLocaleKeyInput;
|
|
2373
|
+
markdownKey?: ProviderLocaleKeyInput;
|
|
2411
2374
|
whenToUseKeys?: readonly ProviderLocaleKeyInput[];
|
|
2412
2375
|
whenNotToUseKeys?: readonly ProviderLocaleKeyInput[];
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2376
|
+
normalizationNotesKeys?: readonly ProviderLocaleKeyInput[];
|
|
2377
|
+
errorCodes?: readonly OperationErrorCode[];
|
|
2378
|
+
examples?: readonly OperationExample[];
|
|
2416
2379
|
contract?: OperationContractMetadata;
|
|
2417
2380
|
tags?: readonly string[];
|
|
2418
2381
|
relatedOperations?: OperationRelationships;
|
|
2419
|
-
toolRouter?: OperationToolRouterMetadata;
|
|
2420
2382
|
observability?: OperationObservabilityConfig;
|
|
2421
2383
|
transport?: OperationTransport;
|
|
2422
|
-
retryOnAuthRefresh?: boolean;
|
|
2423
2384
|
input: TInput;
|
|
2424
2385
|
output: TOutput;
|
|
2425
2386
|
handler(
|
|
@@ -2492,18 +2453,24 @@ export interface ProviderDefinition<TContext = ProviderContext> {
|
|
|
2492
2453
|
id: string;
|
|
2493
2454
|
version: string;
|
|
2494
2455
|
runtime: "standard" | "shared" | "browser";
|
|
2456
|
+
/**
|
|
2457
|
+
* `vanilla` executes provider business logic outside the engine; `engine`
|
|
2458
|
+
* keeps session-bearing provider logic in the engine process.
|
|
2459
|
+
*
|
|
2460
|
+
* Omitted only for definitions authored before the engine migration. New
|
|
2461
|
+
* providers should declare the target explicitly.
|
|
2462
|
+
*/
|
|
2463
|
+
runtimeTarget?: ProviderRuntimeTarget;
|
|
2495
2464
|
/**
|
|
2496
2465
|
* Optional deployment overrides, passed through verbatim from
|
|
2497
2466
|
* `defineProvider({ deployment })`. Validation and profile resolution are
|
|
2498
2467
|
* owned by the APIFuse registry builder, not the SDK.
|
|
2499
2468
|
*/
|
|
2500
2469
|
deployment?: ProviderDeploymentOverrides;
|
|
2470
|
+
http?: Record<string, never> | true;
|
|
2501
2471
|
allowedHosts?: string[];
|
|
2502
2472
|
native?: NativeProviderConfig;
|
|
2503
|
-
stealth?:
|
|
2504
|
-
profile: string;
|
|
2505
|
-
platform: StealthPlatform;
|
|
2506
|
-
};
|
|
2473
|
+
stealth?: StealthProfileSelection;
|
|
2507
2474
|
proxy?: ProviderProxyConfig;
|
|
2508
2475
|
ocr?: ProviderOcrConfig;
|
|
2509
2476
|
stt?: ProviderSttConfig;
|
|
@@ -2512,11 +2479,16 @@ export interface ProviderDefinition<TContext = ProviderContext> {
|
|
|
2512
2479
|
engine: BrowserEngine;
|
|
2513
2480
|
};
|
|
2514
2481
|
auth?: AuthConfig;
|
|
2482
|
+
choice?: Record<string, never> | true;
|
|
2515
2483
|
reviewed?: ProviderReviewed;
|
|
2516
2484
|
access?: ProviderAccessConfig;
|
|
2517
2485
|
secrets?: ProviderSecretDeclaration[];
|
|
2486
|
+
env?: Record<string, never> | true;
|
|
2518
2487
|
credential?: CredentialDeclaration;
|
|
2519
2488
|
context?: ContextDeclaration;
|
|
2489
|
+
state?: Record<string, never> | true;
|
|
2490
|
+
cache?: Record<string, never> | true;
|
|
2491
|
+
files?: Record<string, never> | true;
|
|
2520
2492
|
meta: ProviderMeta;
|
|
2521
2493
|
operations: Record<string, OperationDefinition<SchemaLike, SchemaLike, TContext>>;
|
|
2522
2494
|
healthMonitor?: ProviderHealthMonitorConfig;
|