@apifuse/provider-sdk 2.2.0-beta.47 → 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.
Files changed (114) hide show
  1. package/AUTHORING.md +91 -36
  2. package/CHANGELOG.md +8 -0
  3. package/README.md +11 -9
  4. package/SUBMISSION.md +1 -1
  5. package/bin/apifuse-dev.ts +24 -13
  6. package/bin/apifuse-migrate-operation-declaration.ts +55 -0
  7. package/bin/apifuse-pack-smoke.ts +1 -1
  8. package/bin/apifuse-pack-types.ts +2 -1
  9. package/bin/apifuse-record.ts +30 -16
  10. package/bin/apifuse-submit-check.ts +20 -35
  11. package/dist/cli/commands.d.ts +1 -1
  12. package/dist/cli/commands.js +11 -0
  13. package/dist/cli/migrate-operation-declaration.d.ts +59 -0
  14. package/dist/cli/migrate-operation-declaration.js +1178 -0
  15. package/dist/cli/templates/provider/README.md.tpl +3 -3
  16. package/dist/cli/templates/provider/operations/ping.ts.tpl +2 -0
  17. package/dist/config/loader.d.ts +2 -0
  18. package/dist/config/loader.js +18 -7
  19. package/dist/contract-types.d.ts +11 -5
  20. package/dist/contract.js +21 -10
  21. package/dist/define.d.ts +25 -22
  22. package/dist/define.js +49 -75
  23. package/dist/dev.d.ts +3 -0
  24. package/dist/dev.js +1 -1
  25. package/dist/engine.d.ts +78 -0
  26. package/dist/engine.js +133 -0
  27. package/dist/index.d.ts +3 -2
  28. package/dist/index.js +2 -1
  29. package/dist/lint.d.ts +7 -15
  30. package/dist/lint.js +45 -70
  31. package/dist/provider.d.ts +3 -1
  32. package/dist/provider.js +1 -0
  33. package/dist/runtime/chrome149-header-order.d.ts +58 -0
  34. package/dist/runtime/chrome149-header-order.js +289 -0
  35. package/dist/runtime/env.js +12 -0
  36. package/dist/runtime/executor.d.ts +2 -1
  37. package/dist/runtime/executor.js +3 -36
  38. package/dist/runtime/insights.js +2 -2
  39. package/dist/runtime/otlp.d.ts +71 -2
  40. package/dist/runtime/otlp.js +397 -16
  41. package/dist/runtime/resolver-public.d.ts +1 -1
  42. package/dist/runtime/resolver-public.js +1 -1
  43. package/dist/runtime/resolver-vendors/capsolver.js +9 -3
  44. package/dist/runtime/resolver-vendors/twocaptcha.js +1 -0
  45. package/dist/runtime/resolver.d.ts +12 -0
  46. package/dist/runtime/resolver.js +45 -11
  47. package/dist/runtime/stealth.d.ts +13 -4
  48. package/dist/runtime/stealth.js +362 -85
  49. package/dist/runtime/trace-config.js +2 -1
  50. package/dist/runtime/trace.d.ts +5 -0
  51. package/dist/runtime/trace.js +43 -10
  52. package/dist/server/self-test.d.ts +1 -3
  53. package/dist/server/self-test.js +2 -12
  54. package/dist/server/serve-implementation.d.ts +6 -1
  55. package/dist/server/serve-implementation.js +55 -40
  56. package/dist/server/trace-output.d.ts +3 -1
  57. package/dist/server/trace-output.js +61 -2
  58. package/dist/stealth/profiles.d.ts +9 -8
  59. package/dist/stealth/profiles.js +123 -286
  60. package/dist/types.d.ts +116 -108
  61. package/package.json +2 -1
  62. package/src/cli/__tests__/fixtures/migrate-operation-declaration/approval-override.ts.txt +6 -0
  63. package/src/cli/__tests__/fixtures/migrate-operation-declaration/codemod-syntax.ts.txt +3 -0
  64. package/src/cli/__tests__/fixtures/migrate-operation-declaration/connection-precedence.ts.txt +10 -0
  65. package/src/cli/__tests__/fixtures/migrate-operation-declaration/docs-conflict.ts.txt +8 -0
  66. package/src/cli/__tests__/fixtures/migrate-operation-declaration/examples-map.ts.txt +5 -0
  67. package/src/cli/__tests__/fixtures/migrate-operation-declaration/examples-operation.ts.txt +16 -0
  68. package/src/cli/__tests__/fixtures/migrate-operation-declaration/factory-map.ts.txt +3 -0
  69. package/src/cli/__tests__/fixtures/migrate-operation-declaration/hoist-all.ts.txt +31 -0
  70. package/src/cli/__tests__/fixtures/migrate-operation-declaration/hoisted-const.ts.txt +11 -0
  71. package/src/cli/__tests__/fixtures/migrate-operation-declaration/imported-spread.ts.txt +11 -0
  72. package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-map.ts.txt +11 -0
  73. package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-spread-cast-tail.ts.txt +21 -0
  74. package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-spread-ekitan.ts.txt +11 -0
  75. package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-spread-override.ts.txt +14 -0
  76. package/src/cli/__tests__/fixtures/migrate-operation-declaration/missing-english-locale.ts.txt +7 -0
  77. package/src/cli/__tests__/fixtures/migrate-operation-declaration/no-safety.ts.txt +6 -0
  78. package/src/cli/__tests__/fixtures/migrate-operation-declaration/non-literal.ts.txt +7 -0
  79. package/src/cli/__tests__/fixtures/migrate-operation-declaration/redundant-approval.ts.txt +6 -0
  80. package/src/cli/__tests__/fixtures/migrate-operation-declaration/safety-conflict.ts.txt +7 -0
  81. package/src/cli/__tests__/fixtures/migrate-operation-declaration/stream.ts.txt +7 -0
  82. package/src/cli/__tests__/fixtures/migrate-operation-declaration/tool-router-spread.ts.txt +15 -0
  83. package/src/cli/__tests__/fixtures/migrate-operation-declaration/unparseable.ts.txt +4 -0
  84. package/src/cli/__tests__/fixtures/migrate-operation-declaration/verbatim-template.ts.txt +12 -0
  85. package/src/cli/commands.ts +13 -0
  86. package/src/cli/migrate-operation-declaration.ts +1654 -0
  87. package/src/cli/templates/provider/README.md.tpl +3 -3
  88. package/src/cli/templates/provider/operations/ping.ts.tpl +2 -0
  89. package/src/config/loader.ts +31 -6
  90. package/src/contract-types.ts +11 -5
  91. package/src/contract.ts +21 -10
  92. package/src/define.ts +107 -119
  93. package/src/dev.ts +4 -1
  94. package/src/engine.ts +279 -0
  95. package/src/index.ts +13 -5
  96. package/src/lint.ts +58 -92
  97. package/src/provider.ts +25 -3
  98. package/src/runtime/chrome149-header-order.ts +330 -0
  99. package/src/runtime/env.ts +13 -0
  100. package/src/runtime/executor.ts +7 -40
  101. package/src/runtime/insights.ts +2 -2
  102. package/src/runtime/otlp.ts +467 -21
  103. package/src/runtime/resolver-public.ts +3 -0
  104. package/src/runtime/resolver-vendors/capsolver.ts +12 -4
  105. package/src/runtime/resolver-vendors/twocaptcha.ts +1 -0
  106. package/src/runtime/resolver.ts +68 -19
  107. package/src/runtime/stealth.ts +435 -103
  108. package/src/runtime/trace-config.ts +3 -2
  109. package/src/runtime/trace.ts +57 -17
  110. package/src/server/self-test.ts +2 -9
  111. package/src/server/serve-implementation.ts +89 -72
  112. package/src/server/trace-output.ts +99 -2
  113. package/src/stealth/profiles.ts +169 -327
  114. package/src/types.ts +114 -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 OperationInputExample {
47
- scenario: string;
46
+ export interface OperationExample {
47
+ scenarioKey: ProviderLocaleKeyInput;
48
48
  input: unknown;
49
- rationale?: string;
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
 
@@ -409,6 +362,11 @@ export type ChallengeSolution =
409
362
  readonly userAgent: string;
410
363
  /** Epoch seconds copied from the upstream cookie's own expiry attribute; never a constant. */
411
364
  readonly expires?: number;
365
+ /**
366
+ * Epoch seconds conservatively estimated by the SDK when a resolver vendor omits
367
+ * the upstream cookie's expiry. `expires` takes precedence when both are present.
368
+ */
369
+ readonly sdkEstimatedExpires?: number;
412
370
  };
413
371
 
414
372
  export interface ProviderResolverConfig {
@@ -926,19 +884,27 @@ export interface OperationErrorCode {
926
884
  retryable?: boolean;
927
885
  }
928
886
 
929
- export interface OperationDocMeta {
930
- titleKey?: ProviderLocaleKeyInput;
931
- descriptionKey?: ProviderLocaleKeyInput;
932
- summaryKey?: ProviderLocaleKeyInput;
933
- markdownKey?: ProviderLocaleKeyInput;
934
- normalizationNotesKeys?: ProviderLocaleKeyInput[];
935
- requestExample?: Record<string, unknown>;
936
- responseExample?: unknown;
937
- errorCodes?: OperationErrorCode[];
938
- }
939
-
940
887
  export type StealthPlatform = "macos" | "windows" | "linux" | "android" | "ios";
941
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
+
942
908
  export type BrowserEngine = "playwright-stealth" | "nodriver" | "selenium-uc";
943
909
  export interface BrowserOptions {
944
910
  headless?: boolean;
@@ -948,9 +914,7 @@ export interface BrowserOptions {
948
914
  requireCdpPool?: boolean;
949
915
  }
950
916
 
951
- export interface StealthProfile {
952
- name: string;
953
- platform: StealthPlatform;
917
+ export type StealthProfile = StealthProfileDescriptor & {
954
918
  version: string;
955
919
  userAgent: string;
956
920
  tlsClientIdentifier?: string;
@@ -958,7 +922,7 @@ export interface StealthProfile {
958
922
  ja4?: string;
959
923
  h2Settings?: Record<string, unknown>;
960
924
  headerOrder?: string[];
961
- }
925
+ };
962
926
 
963
927
  export type AuthMode =
964
928
  | "none"
@@ -1052,8 +1016,7 @@ export interface ProviderAccessConfig {
1052
1016
  * active customer organization has a provider-level access grant.
1053
1017
  *
1054
1018
  * This is intentionally provider-level only. It does not alter auth mode,
1055
- * operation schemas, health-check authoring, `openWorld`, or Connection
1056
- * requirements.
1019
+ * operation schemas, health-check authoring, or Connection requirements.
1057
1020
  */
1058
1021
  visibility?: ProviderAccessVisibility;
1059
1022
  }
@@ -1274,7 +1237,12 @@ export type HttpMethod =
1274
1237
  | "PATCH"
1275
1238
  | "patch";
1276
1239
 
1277
- 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[]>;
1278
1246
  method?: HttpMethod;
1279
1247
  body?: string | Buffer;
1280
1248
  redirect?: "follow" | "manual" | "error";
@@ -1291,14 +1259,18 @@ export interface StealthFetchOptions extends Omit<RequestOptions, "redirectPolic
1291
1259
  * operation-affinity proxy.
1292
1260
  */
1293
1261
  proxyAttemptOffset?: number;
1294
- /** Override the configured browser-like stealth profile for this request. */
1295
- profile?: string;
1296
1262
  /**
1297
- * Stealth transport certificate controls. Use only for proxy products that
1298
- * terminate CONNECT with a private CA instead of tunneling the origin
1299
- * certificate chain.
1263
+ * SDK-specific stealth controls. Standard HTTP metadata such as language,
1264
+ * referrer, and content type belongs in `headers`.
1300
1265
  */
1301
- 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
+ */
1302
1274
  insecureSkipVerify?: boolean;
1303
1275
  };
1304
1276
  }
@@ -1508,6 +1480,9 @@ export interface ProviderFilesContext {
1508
1480
  resolve(input: string | ProviderFileRef): Promise<ProviderResolvedFile>;
1509
1481
  }
1510
1482
 
1483
+ /** Where provider business logic executes relative to the capability engine. */
1484
+ export type ProviderRuntimeTarget = "vanilla" | "engine";
1485
+
1511
1486
  export type NativeTcpTlsMode = "required" | "allowed" | "disabled";
1512
1487
 
1513
1488
  export interface NativeTcpPortRange {
@@ -1725,7 +1700,7 @@ export interface ProviderCache {
1725
1700
 
1726
1701
  export interface StealthClient {
1727
1702
  fetch(url: string, options?: StealthFetchOptions): Promise<StealthResponse>;
1728
- createSession(opts?: { profile?: string }): StealthSession;
1703
+ createSession(opts?: { stealth?: StealthProfileSelection }): StealthSession;
1729
1704
  close?(): void;
1730
1705
  }
1731
1706
 
@@ -1883,7 +1858,7 @@ export interface TraceConfig {
1883
1858
  exporter?: "console" | "json" | "otlp" | "none";
1884
1859
  endpoint?: string;
1885
1860
  otlp?: {
1886
- endpoint: string;
1861
+ endpoint?: string;
1887
1862
  headers?: Record<string, string>;
1888
1863
  timeout?: number;
1889
1864
  };
@@ -2287,48 +2262,43 @@ export interface ProviderRuntimeState {
2287
2262
  ): ProviderStateNamespace;
2288
2263
  }
2289
2264
 
2290
- export interface ProviderContext {
2291
- env: EnvContext;
2292
- credential: CredentialContext;
2293
- request?: ProviderRequestContext;
2294
- http: HttpClient;
2295
- /** Present for requests carrying runtime-resolvable file references. */
2296
- readonly files?: ProviderFilesContext;
2297
- /** Native network capability selected by declaration-derived contexts. */
2298
- readonly native: NativeContext;
2299
- cache: ProviderCache;
2300
- state: ProviderRuntimeState;
2301
- stealth: StealthClient;
2302
- browser: BrowserClient;
2303
- trace: TraceContext;
2304
- auth: AuthContext;
2305
- ocr: OcrContext;
2306
- stt: SttContext;
2307
- resolver: ResolverContext;
2308
- choice: ProviderChoiceContext;
2309
- }
2310
-
2311
2265
  /**
2312
2266
  * The operation context exposed for one provider declaration. Capability
2313
2267
  * bindings are present only when their corresponding declaration is present;
2314
- * 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.
2315
2270
  */
2316
- export type ProviderContextFor<TConfig> =
2317
- Pick<ProviderContext, "trace" | "request">
2318
- & ("env" extends keyof TConfig ? Pick<ProviderContext, "env"> : Record<never, never>)
2319
- & ("credential" extends keyof TConfig ? Pick<ProviderContext, "credential"> : Record<never, never>)
2320
- & ("http" extends keyof TConfig ? Pick<ProviderContext, "http"> : Record<never, never>)
2321
- & ("files" extends keyof TConfig ? Pick<ProviderContext, "files"> : Record<never, never>)
2322
- & ("native" extends keyof TConfig ? Pick<ProviderContext, "native"> : Record<never, never>)
2323
- & ("cache" extends keyof TConfig ? Pick<ProviderContext, "cache"> : Record<never, never>)
2324
- & ("state" extends keyof TConfig ? Pick<ProviderContext, "state"> : Record<never, never>)
2325
- & ("stealth" extends keyof TConfig ? Pick<ProviderContext, "stealth"> : Record<never, never>)
2326
- & ("browser" extends keyof TConfig ? Pick<ProviderContext, "browser"> : Record<never, never>)
2327
- & ("auth" extends keyof TConfig ? Pick<ProviderContext, "auth"> : Record<never, never>)
2328
- & ("ocr" extends keyof TConfig ? Pick<ProviderContext, "ocr"> : Record<never, never>)
2329
- & ("stt" extends keyof TConfig ? Pick<ProviderContext, "stt"> : Record<never, never>)
2330
- & ("resolver" extends keyof TConfig ? Pick<ProviderContext, "resolver"> : Record<never, never>)
2331
- & ("choice" extends keyof TConfig ? Pick<ProviderContext, "choice"> : Record<never, never>);
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>;
2332
2302
 
2333
2303
  export interface ProxiedOAuthConfig {
2334
2304
  authorizeUrl: string;
@@ -2388,33 +2358,29 @@ export interface OperationDefinition<
2388
2358
  TOutput extends SchemaLike = SchemaLike,
2389
2359
  TContext = ProviderContext,
2390
2360
  > {
2391
- /**
2392
- * Short English display title for the operation. The SDK passes it through
2393
- * verbatim; the APIFuse registry derives the operation's en locale title
2394
- * baseline from it (`docs.titleKey` remains available as an explicit key
2395
- * override).
2396
- */
2397
- title?: string;
2398
- /**
2399
- * Raw English operation description. The SDK passes it through verbatim;
2400
- * keyed descriptions via `descriptionKey` remain the primary flow, and
2401
- * provider lint rules for raw prose descriptions still apply.
2402
- */
2403
- 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;
2404
2371
  descriptionKey?: ProviderLocaleKeyInput;
2405
- docs?: OperationDocMeta;
2372
+ summaryKey?: ProviderLocaleKeyInput;
2373
+ markdownKey?: ProviderLocaleKeyInput;
2406
2374
  whenToUseKeys?: readonly ProviderLocaleKeyInput[];
2407
2375
  whenNotToUseKeys?: readonly ProviderLocaleKeyInput[];
2408
- derivations?: Record<string, string>;
2409
- inputExamples?: readonly OperationInputExample[];
2410
- annotations?: OperationAnnotations;
2376
+ normalizationNotesKeys?: readonly ProviderLocaleKeyInput[];
2377
+ errorCodes?: readonly OperationErrorCode[];
2378
+ examples?: readonly OperationExample[];
2411
2379
  contract?: OperationContractMetadata;
2412
2380
  tags?: readonly string[];
2413
2381
  relatedOperations?: OperationRelationships;
2414
- toolRouter?: OperationToolRouterMetadata;
2415
2382
  observability?: OperationObservabilityConfig;
2416
2383
  transport?: OperationTransport;
2417
- retryOnAuthRefresh?: boolean;
2418
2384
  input: TInput;
2419
2385
  output: TOutput;
2420
2386
  handler(
@@ -2487,18 +2453,24 @@ export interface ProviderDefinition<TContext = ProviderContext> {
2487
2453
  id: string;
2488
2454
  version: string;
2489
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;
2490
2464
  /**
2491
2465
  * Optional deployment overrides, passed through verbatim from
2492
2466
  * `defineProvider({ deployment })`. Validation and profile resolution are
2493
2467
  * owned by the APIFuse registry builder, not the SDK.
2494
2468
  */
2495
2469
  deployment?: ProviderDeploymentOverrides;
2470
+ http?: Record<string, never> | true;
2496
2471
  allowedHosts?: string[];
2497
2472
  native?: NativeProviderConfig;
2498
- stealth?: {
2499
- profile: string;
2500
- platform: StealthPlatform;
2501
- };
2473
+ stealth?: StealthProfileSelection;
2502
2474
  proxy?: ProviderProxyConfig;
2503
2475
  ocr?: ProviderOcrConfig;
2504
2476
  stt?: ProviderSttConfig;
@@ -2507,11 +2479,16 @@ export interface ProviderDefinition<TContext = ProviderContext> {
2507
2479
  engine: BrowserEngine;
2508
2480
  };
2509
2481
  auth?: AuthConfig;
2482
+ choice?: Record<string, never> | true;
2510
2483
  reviewed?: ProviderReviewed;
2511
2484
  access?: ProviderAccessConfig;
2512
2485
  secrets?: ProviderSecretDeclaration[];
2486
+ env?: Record<string, never> | true;
2513
2487
  credential?: CredentialDeclaration;
2514
2488
  context?: ContextDeclaration;
2489
+ state?: Record<string, never> | true;
2490
+ cache?: Record<string, never> | true;
2491
+ files?: Record<string, never> | true;
2515
2492
  meta: ProviderMeta;
2516
2493
  operations: Record<string, OperationDefinition<SchemaLike, SchemaLike, TContext>>;
2517
2494
  healthMonitor?: ProviderHealthMonitorConfig;