@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.
Files changed (108) hide show
  1. package/AUTHORING.md +91 -36
  2. package/CHANGELOG.md +4 -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-vendors/capsolver.js +3 -3
  42. package/dist/runtime/resolver.js +3 -3
  43. package/dist/runtime/stealth.d.ts +13 -4
  44. package/dist/runtime/stealth.js +362 -85
  45. package/dist/runtime/trace-config.js +2 -1
  46. package/dist/runtime/trace.d.ts +5 -0
  47. package/dist/runtime/trace.js +43 -10
  48. package/dist/server/self-test.d.ts +1 -3
  49. package/dist/server/self-test.js +2 -12
  50. package/dist/server/serve-implementation.d.ts +6 -1
  51. package/dist/server/serve-implementation.js +55 -40
  52. package/dist/server/trace-output.d.ts +3 -1
  53. package/dist/server/trace-output.js +61 -2
  54. package/dist/stealth/profiles.d.ts +9 -8
  55. package/dist/stealth/profiles.js +123 -286
  56. package/dist/types.d.ts +111 -108
  57. package/package.json +2 -1
  58. package/src/cli/__tests__/fixtures/migrate-operation-declaration/approval-override.ts.txt +6 -0
  59. package/src/cli/__tests__/fixtures/migrate-operation-declaration/codemod-syntax.ts.txt +3 -0
  60. package/src/cli/__tests__/fixtures/migrate-operation-declaration/connection-precedence.ts.txt +10 -0
  61. package/src/cli/__tests__/fixtures/migrate-operation-declaration/docs-conflict.ts.txt +8 -0
  62. package/src/cli/__tests__/fixtures/migrate-operation-declaration/examples-map.ts.txt +5 -0
  63. package/src/cli/__tests__/fixtures/migrate-operation-declaration/examples-operation.ts.txt +16 -0
  64. package/src/cli/__tests__/fixtures/migrate-operation-declaration/factory-map.ts.txt +3 -0
  65. package/src/cli/__tests__/fixtures/migrate-operation-declaration/hoist-all.ts.txt +31 -0
  66. package/src/cli/__tests__/fixtures/migrate-operation-declaration/hoisted-const.ts.txt +11 -0
  67. package/src/cli/__tests__/fixtures/migrate-operation-declaration/imported-spread.ts.txt +11 -0
  68. package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-map.ts.txt +11 -0
  69. package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-spread-cast-tail.ts.txt +21 -0
  70. package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-spread-ekitan.ts.txt +11 -0
  71. package/src/cli/__tests__/fixtures/migrate-operation-declaration/inline-spread-override.ts.txt +14 -0
  72. package/src/cli/__tests__/fixtures/migrate-operation-declaration/missing-english-locale.ts.txt +7 -0
  73. package/src/cli/__tests__/fixtures/migrate-operation-declaration/no-safety.ts.txt +6 -0
  74. package/src/cli/__tests__/fixtures/migrate-operation-declaration/non-literal.ts.txt +7 -0
  75. package/src/cli/__tests__/fixtures/migrate-operation-declaration/redundant-approval.ts.txt +6 -0
  76. package/src/cli/__tests__/fixtures/migrate-operation-declaration/safety-conflict.ts.txt +7 -0
  77. package/src/cli/__tests__/fixtures/migrate-operation-declaration/stream.ts.txt +7 -0
  78. package/src/cli/__tests__/fixtures/migrate-operation-declaration/tool-router-spread.ts.txt +15 -0
  79. package/src/cli/__tests__/fixtures/migrate-operation-declaration/unparseable.ts.txt +4 -0
  80. package/src/cli/__tests__/fixtures/migrate-operation-declaration/verbatim-template.ts.txt +12 -0
  81. package/src/cli/commands.ts +13 -0
  82. package/src/cli/migrate-operation-declaration.ts +1654 -0
  83. package/src/cli/templates/provider/README.md.tpl +3 -3
  84. package/src/cli/templates/provider/operations/ping.ts.tpl +2 -0
  85. package/src/config/loader.ts +31 -6
  86. package/src/contract-types.ts +11 -5
  87. package/src/contract.ts +21 -10
  88. package/src/define.ts +107 -119
  89. package/src/dev.ts +4 -1
  90. package/src/engine.ts +279 -0
  91. package/src/index.ts +13 -5
  92. package/src/lint.ts +58 -92
  93. package/src/provider.ts +25 -3
  94. package/src/runtime/chrome149-header-order.ts +330 -0
  95. package/src/runtime/env.ts +13 -0
  96. package/src/runtime/executor.ts +7 -40
  97. package/src/runtime/insights.ts +2 -2
  98. package/src/runtime/otlp.ts +467 -21
  99. package/src/runtime/resolver-vendors/capsolver.ts +4 -3
  100. package/src/runtime/resolver.ts +3 -3
  101. package/src/runtime/stealth.ts +435 -103
  102. package/src/runtime/trace-config.ts +3 -2
  103. package/src/runtime/trace.ts +57 -17
  104. package/src/server/self-test.ts +2 -9
  105. package/src/server/serve-implementation.ts +89 -72
  106. package/src/server/trace-output.ts +99 -2
  107. package/src/stealth/profiles.ts +169 -327
  108. 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 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
 
@@ -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 interface StealthProfile {
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, `openWorld`, or Connection
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
- * Stealth transport certificate controls. Use only for proxy products that
1303
- * terminate CONNECT with a private CA instead of tunneling the origin
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?: { profile?: string }): StealthSession;
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: string;
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 ProviderContextFor<TConfig> =
2322
- Pick<ProviderContext, "trace" | "request">
2323
- & ("env" extends keyof TConfig ? Pick<ProviderContext, "env"> : Record<never, never>)
2324
- & ("credential" extends keyof TConfig ? Pick<ProviderContext, "credential"> : Record<never, never>)
2325
- & ("http" extends keyof TConfig ? Pick<ProviderContext, "http"> : Record<never, never>)
2326
- & ("files" extends keyof TConfig ? Pick<ProviderContext, "files"> : Record<never, never>)
2327
- & ("native" extends keyof TConfig ? Pick<ProviderContext, "native"> : Record<never, never>)
2328
- & ("cache" extends keyof TConfig ? Pick<ProviderContext, "cache"> : Record<never, never>)
2329
- & ("state" extends keyof TConfig ? Pick<ProviderContext, "state"> : Record<never, never>)
2330
- & ("stealth" extends keyof TConfig ? Pick<ProviderContext, "stealth"> : Record<never, never>)
2331
- & ("browser" extends keyof TConfig ? Pick<ProviderContext, "browser"> : Record<never, never>)
2332
- & ("auth" extends keyof TConfig ? Pick<ProviderContext, "auth"> : Record<never, never>)
2333
- & ("ocr" extends keyof TConfig ? Pick<ProviderContext, "ocr"> : Record<never, never>)
2334
- & ("stt" extends keyof TConfig ? Pick<ProviderContext, "stt"> : Record<never, never>)
2335
- & ("resolver" extends keyof TConfig ? Pick<ProviderContext, "resolver"> : Record<never, never>)
2336
- & ("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>;
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
- * Short English display title for the operation. The SDK passes it through
2398
- * verbatim; the APIFuse registry derives the operation's en locale title
2399
- * baseline from it (`docs.titleKey` remains available as an explicit key
2400
- * override).
2401
- */
2402
- title?: string;
2403
- /**
2404
- * Raw English operation description. The SDK passes it through verbatim;
2405
- * keyed descriptions via `descriptionKey` remain the primary flow, and
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
- docs?: OperationDocMeta;
2372
+ summaryKey?: ProviderLocaleKeyInput;
2373
+ markdownKey?: ProviderLocaleKeyInput;
2411
2374
  whenToUseKeys?: readonly ProviderLocaleKeyInput[];
2412
2375
  whenNotToUseKeys?: readonly ProviderLocaleKeyInput[];
2413
- derivations?: Record<string, string>;
2414
- inputExamples?: readonly OperationInputExample[];
2415
- annotations?: OperationAnnotations;
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;