@apifuse/provider-sdk 2.2.0-beta.59 → 2.2.0-beta.61

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 (124) hide show
  1. package/AUTHORING.md +33 -16
  2. package/CHANGELOG.md +8 -0
  3. package/bin/apifuse-dev.ts +7 -8
  4. package/bin/apifuse-pack-types.ts +22 -0
  5. package/bin/apifuse-perf.ts +45 -10
  6. package/bin/apifuse-record.ts +6 -8
  7. package/bin/apifuse-submit-check.ts +2 -2
  8. package/dist/config/loader.js +13 -12
  9. package/dist/define.d.ts +3 -2
  10. package/dist/define.js +1 -1
  11. package/dist/dev.js +3 -1
  12. package/dist/engine.d.ts +7 -6
  13. package/dist/engine.js +6 -6
  14. package/dist/error-resolution.js +21 -4
  15. package/dist/errors.d.ts +3 -0
  16. package/dist/errors.js +9 -0
  17. package/dist/handle-meta.d.ts +39 -0
  18. package/dist/handle-meta.js +29 -0
  19. package/dist/handle.d.ts +187 -0
  20. package/dist/handle.js +254 -0
  21. package/dist/i18n/catalog.js +21 -1
  22. package/dist/index.d.ts +6 -4
  23. package/dist/index.js +4 -3
  24. package/dist/lint.d.ts +3 -0
  25. package/dist/lint.js +388 -62
  26. package/dist/provider.d.ts +4 -4
  27. package/dist/provider.js +3 -3
  28. package/dist/runtime/browser.js +2 -1
  29. package/dist/runtime/cache.js +3 -2
  30. package/dist/runtime/diagnostic-env-values.d.ts +5 -0
  31. package/dist/runtime/diagnostic-env-values.js +57 -0
  32. package/dist/runtime/diagnostic-env.d.ts +11 -0
  33. package/dist/runtime/diagnostic-env.js +35 -0
  34. package/dist/runtime/diagnostic-redactor.d.ts +49 -0
  35. package/dist/runtime/diagnostic-redactor.js +569 -0
  36. package/dist/runtime/egress-lease.d.ts +2 -0
  37. package/dist/runtime/egress-lease.js +4 -1
  38. package/dist/runtime/env.js +2 -1
  39. package/dist/runtime/handle-wordlist.d.ts +43 -0
  40. package/dist/runtime/{choice-wordlist.js → handle-wordlist.js} +127 -9
  41. package/dist/runtime/handle.d.ts +71 -0
  42. package/dist/runtime/handle.js +895 -0
  43. package/dist/runtime/instrumentation.js +3 -0
  44. package/dist/runtime/native-network.d.ts +10 -1
  45. package/dist/runtime/native-network.js +230 -29
  46. package/dist/runtime/native-telemetry.d.ts +142 -0
  47. package/dist/runtime/native-telemetry.js +231 -0
  48. package/dist/runtime/ocr.js +2 -1
  49. package/dist/runtime/otlp.js +5 -4
  50. package/dist/runtime/proxy-nodemaven.js +3 -2
  51. package/dist/runtime/request-options.d.ts +7 -0
  52. package/dist/runtime/request-options.js +62 -22
  53. package/dist/runtime/resolver-vendors/browser.js +0 -1
  54. package/dist/runtime/resolver.js +3 -2
  55. package/dist/runtime/state.d.ts +4 -1
  56. package/dist/runtime/state.js +32 -17
  57. package/dist/runtime/stt.js +3 -2
  58. package/dist/runtime/trace.d.ts +5 -0
  59. package/dist/runtime/trace.js +115 -20
  60. package/dist/schema.d.ts +11 -0
  61. package/dist/schema.js +56 -2
  62. package/dist/server/index.d.ts +1 -0
  63. package/dist/server/index.js +1 -0
  64. package/dist/server/self-test-redaction.js +8 -33
  65. package/dist/server/sensitive-values.d.ts +26 -0
  66. package/dist/server/sensitive-values.js +128 -0
  67. package/dist/server/serve-implementation.d.ts +4 -11
  68. package/dist/server/serve-implementation.js +305 -96
  69. package/dist/server/trace-output.d.ts +2 -1
  70. package/dist/server/trace-output.js +46 -14
  71. package/dist/testing/run.js +10 -7
  72. package/dist/trace-sanitization.d.ts +4 -3
  73. package/dist/trace-sanitization.js +45 -22
  74. package/dist/types.d.ts +4 -107
  75. package/package.json +2 -1
  76. package/src/config/loader.ts +13 -12
  77. package/src/define.ts +4 -3
  78. package/src/dev.ts +3 -1
  79. package/src/engine.ts +8 -8
  80. package/src/error-resolution.ts +21 -4
  81. package/src/errors.ts +13 -0
  82. package/src/handle-meta.ts +58 -0
  83. package/src/handle.ts +529 -0
  84. package/src/i18n/catalog.ts +23 -1
  85. package/src/index.ts +28 -13
  86. package/src/lint.ts +456 -71
  87. package/src/provider.ts +10 -20
  88. package/src/runtime/browser.ts +2 -1
  89. package/src/runtime/cache.ts +3 -2
  90. package/src/runtime/diagnostic-env-values.ts +56 -0
  91. package/src/runtime/diagnostic-env.ts +55 -0
  92. package/src/runtime/diagnostic-redactor.ts +662 -0
  93. package/src/runtime/egress-lease.ts +6 -1
  94. package/src/runtime/env.ts +2 -1
  95. package/src/runtime/{choice-wordlist.ts → handle-wordlist.ts} +130 -9
  96. package/src/runtime/handle.ts +1162 -0
  97. package/src/runtime/instrumentation.ts +3 -0
  98. package/src/runtime/native-network.ts +281 -33
  99. package/src/runtime/native-telemetry.ts +366 -0
  100. package/src/runtime/ocr.ts +2 -1
  101. package/src/runtime/otlp.ts +5 -4
  102. package/src/runtime/proxy-nodemaven.ts +3 -2
  103. package/src/runtime/request-options.ts +76 -28
  104. package/src/runtime/resolver-vendors/browser.ts +0 -1
  105. package/src/runtime/resolver.ts +3 -2
  106. package/src/runtime/state.ts +44 -16
  107. package/src/runtime/stt.ts +3 -2
  108. package/src/runtime/trace.ts +168 -26
  109. package/src/schema.ts +63 -2
  110. package/src/server/index.ts +17 -0
  111. package/src/server/self-test-redaction.ts +10 -40
  112. package/src/server/sensitive-values.ts +197 -0
  113. package/src/server/serve-implementation.ts +388 -128
  114. package/src/server/trace-output.ts +77 -17
  115. package/src/testing/run.ts +11 -7
  116. package/src/trace-sanitization.ts +70 -23
  117. package/src/types.ts +4 -137
  118. package/dist/choice-token.d.ts +0 -24
  119. package/dist/choice-token.js +0 -74
  120. package/dist/runtime/choice-wordlist.d.ts +0 -9
  121. package/dist/runtime/choice.d.ts +0 -27
  122. package/dist/runtime/choice.js +0 -801
  123. package/src/choice-token.ts +0 -165
  124. package/src/runtime/choice.ts +0 -1197
package/dist/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  // @apifuse/provider-sdk
2
2
  export * from "./auth.js";
3
3
  export * from "./ceremonies/index.js";
4
- export * from "./choice-token.js";
5
4
  export { defineConfig, loadApiFuseConfig, resolveProxy } from "./config/loader.js";
6
5
  export { canonicalJson, digestProviderContract, extractProviderContract, PROVIDER_CONTRACT_SCHEMA_VERSION, } from "./contract.js";
7
6
  export { centered, delayed, defineHealthJourney, defineOperation, defineProvider, defineSmsOtpMatcher, defineStreamOperation, every, } from "./define.js";
@@ -17,7 +16,8 @@ export * from "./recipes/gov-api.js";
17
16
  export * from "./recipes/rest-api.js";
18
17
  export { createFlowContext, createScratchpad } from "./runtime/auth-flow.js";
19
18
  export { APIFUSE__CACHE__KEY_PEPPER_ENV, createBypassProviderCache, createProviderCache, } from "./runtime/cache.js";
20
- export { createProviderChoiceContext, createTestProviderChoiceContext, PROVIDER_RUNTIME_CHOICE_TOKEN_MASTER_SECRET_ENV, } from "./runtime/choice.js";
19
+ export * from "./handle.js";
20
+ export { createHandleContext, createTestHandleContext, normalizeHandle, } from "./runtime/handle.js";
21
21
  export { createCredentialContext, } from "./runtime/credential.js";
22
22
  export { createEnvContext } from "./runtime/env.js";
23
23
  export { executeOperation } from "./runtime/executor.js";
@@ -36,7 +36,7 @@ export { createUnsupportedProviderRuntimeState, UnsupportedProviderStateError, }
36
36
  export { APIFUSE__OCR__API_KEY_ENV, APIFUSE__OCR__BACKEND_ENV, APIFUSE__OCR__BASE_URL_ENV, APIFUSE__OCR__CLOUDFLARE_API_TOKEN_ENV, APIFUSE__OCR__MODEL_ENV, CLOUDFLARE_ACCOUNT_ID_ENV, CLOUDFLARE_WORKERS_AI_OCR_BACKEND, createCloudflareWorkersAiOcrClient, createOcrClientFromEnv, createOpenAiCompatibleOcrClient, createUnsupportedOcrClient, DEFAULT_CLOUDFLARE_WORKERS_AI_OCR_MODEL, extractCaptchaCandidates, OPENAI_COMPATIBLE_OCR_BACKEND, } from "./runtime/ocr.js";
37
37
  export { APIFUSE__STT__BACKEND_ENV, APIFUSE__STT__CLOUDFLARE_API_TOKEN_ENV, APIFUSE__STT__MODEL_ENV, createSttClientFromEnv, createUnsupportedSttClient, extractVerificationCode, resolveSttPrompt, } from "./runtime/stt.js";
38
38
  export { createTraceContext, } from "./runtime/trace.js";
39
- export { APIFUSE_CONTENT_PROVENANCE_META_KEY, APIFUSE_CONTENT_TRUST_META_KEY, APIFUSE_DESCRIPTION_KEY_META_KEY, APIFUSE_REDACTION_MARKER, APIFUSE_SENSITIVE_KIND_META_KEY, APIFUSE_SENSITIVE_META_KEY, collectSensitivePaths, describeKey, field, fields, isSensitiveSchema, redactPayload, sensitive, untrustedContent, z, } from "./schema.js";
39
+ export { APIFUSE_CONTENT_PROVENANCE_META_KEY, APIFUSE_CONTENT_TRUST_META_KEY, APIFUSE_DESCRIPTION_KEY_META_KEY, APIFUSE_REDACTION_MARKER, APIFUSE_SENSITIVE_KIND_META_KEY, APIFUSE_SENSITIVE_META_KEY, collectSensitivePaths, describeKey, field, fields, isSensitiveSchema, publicField, redactPayload, sensitive, untrustedContent, z, } from "./schema.js";
40
40
  export { createServerApp, createServerAppAsync, ERROR_OBSERVABILITY_HEADER, serve, } from "./server/serve.js";
41
41
  export { DEFAULT_STEALTH_BROWSER, DEFAULT_STEALTH_OS, getStealthProfile, listStealthProfiles, } from "./stealth/profiles.js";
42
42
  export * from "./stream.js";
@@ -45,3 +45,4 @@ export * from "./utils/date.js";
45
45
  export * from "./utils/parse.js";
46
46
  export * from "./utils/text.js";
47
47
  export * from "./utils/transform.js";
48
+ export { NativeTelemetryCollector, } from "./runtime/native-telemetry.js";
package/dist/lint.d.ts CHANGED
@@ -80,6 +80,9 @@ export declare function lintProvider(provider: {
80
80
  contract?: ProviderContractMetaLike;
81
81
  };
82
82
  reviewed?: string;
83
+ /** Declared handle kinds (ADR-0012); read structurally, see readHandleKindDeclarations. */
84
+ handle?: unknown;
85
+ state?: unknown;
83
86
  }, options?: ProviderLintOptions): LintDiagnostic[];
84
87
  /** Internal detailed result used by the CLI to render suppression audits. */
85
88
  export declare function lintProviderWithInformation(provider: Parameters<typeof lintProvider>[0], options?: ProviderLintOptions): ProviderLintResult;
package/dist/lint.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { SDK_RUNTIME_OWNED_ERROR_CODES, SDK_STATUS_MAPPED_PROVIDER_ERROR_CODES, } from "./error-resolution.js";
3
+ import { APIFUSE_HANDLE_META_KEY, handleFieldDescription, isHandleFieldMeta, } from "./handle-meta.js";
3
4
  import { lintPublicSchemaFieldNames } from "./public-schema-field-lint.js";
4
5
  import { APIFUSE_DESCRIPTION_KEY_META_KEY, APIFUSE_SENSITIVE_META_KEY } from "./schema.js";
5
6
  const requireModule = createRequire(import.meta.url);
@@ -56,12 +57,7 @@ const AUTH_LIFECYCLE_SEGMENT_WORDS = new Set([
56
57
  "auth",
57
58
  ]);
58
59
  // Ambiguous as a prefix, unambiguous when they are the whole operation id.
59
- const AUTH_LIFECYCLE_WHOLE_ID_WORDS = new Set([
60
- "authorize",
61
- "revoke",
62
- "unlink",
63
- "disconnect",
64
- ]);
60
+ const AUTH_LIFECYCLE_WHOLE_ID_WORDS = new Set(["authorize", "revoke", "unlink", "disconnect"]);
65
61
  // A verb stem followed by a direction word across two segments: `sign-out`,
66
62
  // `user_sign_up_flow`, and the spelled-out `log-in` / `shop-log-out` forms
67
63
  // (their fused equivalents `login`/`logout` live in the segment set above).
@@ -304,15 +300,18 @@ function getObjectShape(schema) {
304
300
  }
305
301
  function getChildSchemas(schema) {
306
302
  const seen = new Map();
303
+ const origins = new Map();
307
304
  const def = getSchemaDef(schema);
308
- const add = (key, value) => {
305
+ const add = (key, value, origin = "structural") => {
309
306
  if (!isSchema(value)) {
310
307
  return;
311
308
  }
312
- seen.set(`${key}:${seen.size}`, value);
309
+ const id = `${key}:${seen.size}`;
310
+ seen.set(id, value);
311
+ origins.set(id, origin);
313
312
  };
314
313
  for (const [key, value] of Object.entries(getObjectShape(schema))) {
315
- add(key, value);
314
+ add(key, value, "shape");
316
315
  }
317
316
  add("element", schema.element);
318
317
  add("innerType", schema.innerType);
@@ -352,6 +351,9 @@ function getChildSchemas(schema) {
352
351
  "schema",
353
352
  "innerType",
354
353
  "type",
354
+ // zod v4 intersections keep their branches on the definition.
355
+ "left",
356
+ "right",
355
357
  "valueType",
356
358
  "keyType",
357
359
  "item",
@@ -375,22 +377,34 @@ function getChildSchemas(schema) {
375
377
  return Array.from(seen.entries()).map(([entryKey, child]) => ({
376
378
  key: entryKey.split(":")[0] ?? entryKey,
377
379
  schema: child,
380
+ origin: origins.get(entryKey) ?? "structural",
378
381
  }));
379
382
  }
380
383
  function uniqueFields(fields) {
381
384
  return Array.from(new Set(fields));
382
385
  }
383
- function isSensitiveSchema(schema) {
384
- if (!schema || typeof schema !== "object" || !("meta" in schema)) {
385
- return false;
386
+ function readSensitivityDeclaration(schema, seen = new Set()) {
387
+ // Declarations sit on the leaf; same-path wrappers such as .optional(),
388
+ // .nullable(), .pipe() or z.lazy() carry no metadata of their own, so look
389
+ // through them.
390
+ if (!isSchema(schema) || seen.has(schema))
391
+ return undefined;
392
+ seen.add(schema);
393
+ const value = Reflect.get(getSchemaMetadata(schema), APIFUSE_SENSITIVE_META_KEY);
394
+ if (typeof value === "boolean")
395
+ return value;
396
+ const def = getSchemaDef(schema);
397
+ const children = def.type === "pipe"
398
+ ? [def.in, def.out]
399
+ : def.type === "lazy" && typeof def.getter === "function"
400
+ ? [def.getter()]
401
+ : [def.innerType];
402
+ for (const child of children) {
403
+ const declaration = readSensitivityDeclaration(child, seen);
404
+ if (declaration !== undefined)
405
+ return declaration;
386
406
  }
387
- const meta = schema.meta;
388
- if (typeof meta !== "function")
389
- return false;
390
- const metadata = meta.call(schema);
391
- return (!!metadata &&
392
- typeof metadata === "object" &&
393
- Reflect.get(metadata, APIFUSE_SENSITIVE_META_KEY) === true);
407
+ return undefined;
394
408
  }
395
409
  function getSchemaMetadata(schema) {
396
410
  return schema.meta?.() ?? {};
@@ -416,9 +430,91 @@ const SENSITIVE_FIELD_NAMES = new Set([
416
430
  "phonenumber",
417
431
  "paymenturl",
418
432
  ]);
433
+ // Only phone-shaped keys can hold reviewed public data (facility phones); the
434
+ // rest are credentials, which a public declaration must not launder.
435
+ const PUBLIC_DECLARABLE_FIELD_NAMES = new Set(["phone", "phonenumber"]);
436
+ function normalizeFieldName(name) {
437
+ return name.toLowerCase().replace(/[-_\s]/g, "");
438
+ }
419
439
  function isSensitiveFieldName(name) {
420
- const normalized = name.toLowerCase().replace(/[-_\s]/g, "");
421
- return SENSITIVE_FIELD_NAMES.has(normalized);
440
+ return SENSITIVE_FIELD_NAMES.has(normalizeFieldName(name));
441
+ }
442
+ function isDeclaredSensitiveField(key, schema) {
443
+ const declaration = readSensitivityDeclaration(schema);
444
+ return (declaration === true ||
445
+ (declaration === false && PUBLIC_DECLARABLE_FIELD_NAMES.has(normalizeFieldName(key))));
446
+ }
447
+ // Child keys produced by getChildSchemas() that wrap a schema without adding a
448
+ // property path segment (optional/nullable/default/pipe/effects/etc.).
449
+ const SCHEMA_WRAPPER_NODE_KEYS = [
450
+ "unwrap",
451
+ "innerType",
452
+ "sourceType",
453
+ "schema",
454
+ "type",
455
+ "in",
456
+ "out",
457
+ "option",
458
+ "pipe",
459
+ "payload",
460
+ "item",
461
+ "rest",
462
+ "catchall",
463
+ "keyType",
464
+ "valueType",
465
+ // zod v4 intersection branches: transparent, the enclosing property key applies.
466
+ "left",
467
+ "right",
468
+ ];
469
+ function isSchemaWrapperNodeKey(key) {
470
+ return SCHEMA_WRAPPER_NODE_KEYS.includes(key) || key.startsWith("pipe.");
471
+ }
472
+ function getOwnHandleFieldMeta(schema) {
473
+ const value = Reflect.get(getSchemaMetadata(schema), APIFUSE_HANDLE_META_KEY);
474
+ return isHandleFieldMeta(value) ? value : undefined;
475
+ }
476
+ /**
477
+ * Handle meta placed by `kind.field()` lives on the string schema itself; zod
478
+ * wrappers (`.optional()`, `.nullable()`, `.default()`, pipes) do not inherit
479
+ * registry metadata, so look through wrapper nodes until a non-wrapper is hit.
480
+ */
481
+ function getHandleFieldMeta(schema, seen = new Set()) {
482
+ if (!isSchema(schema) || seen.has(schema))
483
+ return undefined;
484
+ seen.add(schema);
485
+ const own = getOwnHandleFieldMeta(schema);
486
+ if (own)
487
+ return own;
488
+ for (const child of getChildSchemas(schema)) {
489
+ if (child.origin === "shape" || !isSchemaWrapperNodeKey(child.key))
490
+ continue;
491
+ const found = getHandleFieldMeta(child.schema, seen);
492
+ if (found)
493
+ return found;
494
+ }
495
+ return undefined;
496
+ }
497
+ /**
498
+ * True when `schema` is a handle field (directly or through zod wrappers) whose
499
+ * description is still the SDK-generated wording and no wrapper adds its own
500
+ * description.
501
+ */
502
+ function isSdkOwnedHandleField(schema, seen = new Set()) {
503
+ if (!isSchema(schema) || seen.has(schema))
504
+ return false;
505
+ seen.add(schema);
506
+ const own = getOwnHandleFieldMeta(schema);
507
+ if (own)
508
+ return schema.description === handleFieldDescription(own);
509
+ if (schema.description)
510
+ return false;
511
+ for (const child of getChildSchemas(schema)) {
512
+ if (child.origin === "shape" || !isSchemaWrapperNodeKey(child.key))
513
+ continue;
514
+ if (isSdkOwnedHandleField(child.schema, seen))
515
+ return true;
516
+ }
517
+ return false;
422
518
  }
423
519
  function collectUnmarkedSensitiveFields(schema, basePath, seen = new Set()) {
424
520
  if (!isSchema(schema) || seen.has(schema)) {
@@ -428,7 +524,7 @@ function collectUnmarkedSensitiveFields(schema, basePath, seen = new Set()) {
428
524
  const out = [];
429
525
  for (const [key, child] of Object.entries(getObjectShape(schema))) {
430
526
  const childPath = basePath ? `${basePath}.${key}` : key;
431
- if (isSensitiveFieldName(key) && !isSensitiveSchema(child)) {
527
+ if (isSensitiveFieldName(key) && !isDeclaredSensitiveField(key, child)) {
432
528
  out.push(childPath);
433
529
  }
434
530
  out.push(...collectUnmarkedSensitiveFields(child, childPath, seen));
@@ -436,23 +532,7 @@ function collectUnmarkedSensitiveFields(schema, basePath, seen = new Set()) {
436
532
  for (const child of getChildSchemas(schema)) {
437
533
  if (Object.hasOwn(getObjectShape(schema), child.key))
438
534
  continue;
439
- const isWrapperNode = [
440
- "unwrap",
441
- "innerType",
442
- "sourceType",
443
- "schema",
444
- "type",
445
- "in",
446
- "out",
447
- "option",
448
- "pipe",
449
- "payload",
450
- "item",
451
- "rest",
452
- "catchall",
453
- "keyType",
454
- "valueType",
455
- ].includes(child.key);
535
+ const isWrapperNode = SCHEMA_WRAPPER_NODE_KEYS.includes(child.key);
456
536
  const childPath = child.key === "element" || child.key.startsWith("element.")
457
537
  ? `${basePath}[]`
458
538
  : isWrapperNode || child.key.startsWith("pipe.")
@@ -472,6 +552,14 @@ function collectSchemaDescriptionKeyDiagnostics(schema, basePath, seen = new Set
472
552
  const diagnostics = [];
473
553
  const currentPath = basePath || "schema";
474
554
  const hasDescriptionKey = getSchemaDescriptionKey(schema) !== undefined;
555
+ // Handle fields (`kind.field()`, ADR-0012) carry SDK-owned wording via
556
+ // .describe() plus x-apifuse-handle meta; they count as described and are
557
+ // leaves, so neither this node nor its wrapper chain needs a describeKey.
558
+ // A provider override of that wording (`.describe("…")` on the field or on
559
+ // a wrapper) is provider prose again and stays subject to the rules below.
560
+ if (isSdkOwnedHandleField(schema)) {
561
+ return diagnostics;
562
+ }
475
563
  if (schema.description && !hasDescriptionKey) {
476
564
  diagnostics.push({
477
565
  rule: "schema-description-raw-prose",
@@ -491,23 +579,7 @@ function collectSchemaDescriptionKeyDiagnostics(schema, basePath, seen = new Set
491
579
  });
492
580
  }
493
581
  for (const child of getChildSchemas(schema)) {
494
- const isWrapperNode = [
495
- "unwrap",
496
- "innerType",
497
- "sourceType",
498
- "schema",
499
- "type",
500
- "in",
501
- "out",
502
- "option",
503
- "pipe",
504
- "payload",
505
- "item",
506
- "rest",
507
- "catchall",
508
- "keyType",
509
- "valueType",
510
- ].includes(child.key);
582
+ const isWrapperNode = SCHEMA_WRAPPER_NODE_KEYS.includes(child.key);
511
583
  const isStructuralNode = isWrapperNode ||
512
584
  child.key.startsWith("pipe.") ||
513
585
  child.key === "element" ||
@@ -971,7 +1043,8 @@ function collectLiteralErrorCodeValues(args) {
971
1043
  after++;
972
1044
  }
973
1045
  const nextChar = after < args.length ? (args[after] ?? "") : "";
974
- if (!value.includes("\\") && (nextChar === "," || nextChar === "}" || nextChar === "")) {
1046
+ if (!value.includes("\\") &&
1047
+ (nextChar === "," || nextChar === "}" || nextChar === "")) {
975
1048
  codes.push(value);
976
1049
  }
977
1050
  index = end;
@@ -1061,6 +1134,259 @@ function lintUndeclaredThrownErrorCodes(provider) {
1061
1134
  }
1062
1135
  return diagnostics;
1063
1136
  }
1137
+ function collectHandleFields(schema, basePath, key = undefined, seen = new Set()) {
1138
+ if (!isSchema(schema))
1139
+ return [];
1140
+ // Record before the cycle guard so one `kind.field()` instance reused under
1141
+ // two property keys is still reported at both positions.
1142
+ const own = getOwnHandleFieldMeta(schema);
1143
+ if (own && key !== undefined) {
1144
+ return [{ path: basePath, key, meta: own }];
1145
+ }
1146
+ // Path-local cycle guard: the same wrapped schema instance may legitimately
1147
+ // appear under several property keys (`Kind.field().optional()` reused), and
1148
+ // each position must be checked. Only true ancestor cycles are cut.
1149
+ if (seen.has(schema))
1150
+ return [];
1151
+ seen.add(schema);
1152
+ try {
1153
+ return collectHandleFieldChildren(schema, basePath, key, seen);
1154
+ }
1155
+ finally {
1156
+ seen.delete(schema);
1157
+ }
1158
+ }
1159
+ function collectHandleFieldChildren(schema, basePath, key, seen) {
1160
+ const out = [];
1161
+ // zod exposes the same inner schema under several structural edges
1162
+ // (`unwrap`/`innerType`, `element`/`def.element`); traverse each structural
1163
+ // child object once. Shape children are always traversed: the same instance
1164
+ // under two property keys is two fields.
1165
+ const structuralSeen = new Set();
1166
+ for (const child of getChildSchemas(schema)) {
1167
+ if (child.origin !== "shape") {
1168
+ if (structuralSeen.has(child.schema))
1169
+ continue;
1170
+ structuralSeen.add(child.schema);
1171
+ }
1172
+ if (child.origin === "shape") {
1173
+ // Provider-chosen property key: always a real field, even when it is
1174
+ // spelled like a structural edge (`item`, `type`, `schema`, ...).
1175
+ out.push(...collectHandleFields(child.schema, `${basePath}.${child.key}`, child.key, seen));
1176
+ }
1177
+ else if (isSchemaWrapperNodeKey(child.key)) {
1178
+ out.push(...collectHandleFields(child.schema, basePath, key, seen));
1179
+ }
1180
+ else if (child.key === "element" || child.key.startsWith("element.")) {
1181
+ out.push(...collectHandleFields(child.schema, `${basePath}[]`, key, seen));
1182
+ }
1183
+ else if (/^\d+$/.test(child.key)) {
1184
+ out.push(...collectHandleFields(child.schema, `${basePath}[${child.key}]`, key, seen));
1185
+ }
1186
+ else {
1187
+ out.push(...collectHandleFields(child.schema, `${basePath}.${child.key}`, child.key, seen));
1188
+ }
1189
+ }
1190
+ return out;
1191
+ }
1192
+ /**
1193
+ * Reads `provider.handle` structurally. The declaration type is owned by
1194
+ * define.ts/types.ts; lint only needs the HandleKindDeclaration view, so
1195
+ * malformed entries are skipped rather than reported.
1196
+ */
1197
+ function readHandleKindDeclarations(value) {
1198
+ if (!Array.isArray(value))
1199
+ return [];
1200
+ return value.filter((entry) => {
1201
+ if (typeof entry !== "object" || entry === null)
1202
+ return false;
1203
+ const record = entry;
1204
+ return (typeof record.name === "string" &&
1205
+ (record.type === "cursor" || record.type === "draft") &&
1206
+ typeof record.fieldName === "string" &&
1207
+ (record.issuedBy === undefined || typeof record.issuedBy === "string"));
1208
+ });
1209
+ }
1210
+ /**
1211
+ * ADR-0012 handle rules: every `x-apifuse-handle` schema field must belong to
1212
+ * a declared kind under its declared property key; every declared kind must be
1213
+ * both issued (some output) and accepted (some input); `issuedBy` must name an
1214
+ * operation whose output carries the field; and `ctx.handle` needs `state`.
1215
+ */
1216
+ function lintHandleDeclarations(provider) {
1217
+ const diagnostics = [];
1218
+ const providerLabel = provider.id ? `Provider "${provider.id}"` : "Provider";
1219
+ const kinds = readHandleKindDeclarations(provider.handle);
1220
+ const kindByName = new Map(kinds.map((kind) => [kind.name, kind]));
1221
+ const operations = provider.operations ?? {};
1222
+ if (kinds.length > 0 && !provider.state) {
1223
+ diagnostics.push({
1224
+ rule: "handle-requires-state",
1225
+ level: "warn",
1226
+ field: "handle",
1227
+ message: `${providerLabel} declares handle kinds but not the state capability; ctx.handle stores records through ctx.state, so declare state: true.`,
1228
+ });
1229
+ }
1230
+ const kindsInInputs = new Set();
1231
+ const kindsInOutputs = new Set();
1232
+ const outputKindsByOperation = new Map();
1233
+ for (const [operationKey, operation] of Object.entries(operations)) {
1234
+ const positions = [
1235
+ { side: "input", fields: collectHandleFields(operation.input, "input") },
1236
+ { side: "output", fields: collectHandleFields(operation.output, "output") },
1237
+ ];
1238
+ for (const { side, fields } of positions) {
1239
+ for (const occurrence of fields) {
1240
+ const field = `operations.${operationKey}.${occurrence.path}`;
1241
+ const { kind, fieldName } = occurrence.meta;
1242
+ if (!kindByName.has(kind)) {
1243
+ diagnostics.push({
1244
+ rule: "handle-kind-undeclared",
1245
+ level: "error",
1246
+ field,
1247
+ message: `${providerLabel} operation "${operationKey}" ${side} field "${occurrence.path}" is a handle of kind "${kind}", which is not declared in provider.handle. Add the kind to handle: [...] or remove the field.`,
1248
+ });
1249
+ }
1250
+ if (occurrence.key !== fieldName) {
1251
+ diagnostics.push({
1252
+ rule: "handle-field-name",
1253
+ level: "error",
1254
+ field,
1255
+ message: `${providerLabel} operation "${operationKey}" ${side} declares handle kind "${kind}" under property "${occurrence.key}" but the kind's fieldName is "${fieldName}". Use the same key in every schema so the LLM sees one name.`,
1256
+ });
1257
+ }
1258
+ if (side === "input") {
1259
+ kindsInInputs.add(kind);
1260
+ }
1261
+ else {
1262
+ kindsInOutputs.add(kind);
1263
+ let outputKinds = outputKindsByOperation.get(operationKey);
1264
+ if (!outputKinds) {
1265
+ outputKinds = new Set();
1266
+ outputKindsByOperation.set(operationKey, outputKinds);
1267
+ }
1268
+ outputKinds.add(kind);
1269
+ }
1270
+ }
1271
+ }
1272
+ }
1273
+ for (const kind of kinds) {
1274
+ const field = `handle.${kind.name}`;
1275
+ const issued = kindsInOutputs.has(kind.name);
1276
+ const accepted = kindsInInputs.has(kind.name);
1277
+ if (!issued) {
1278
+ diagnostics.push({
1279
+ rule: "handle-field-parity",
1280
+ level: "error",
1281
+ field,
1282
+ message: `${providerLabel} handle kind "${kind.name}" is never issued: no operation output contains its field "${kind.fieldName}". Add ${kind.name}.field() to the issuing operation's output.`,
1283
+ });
1284
+ }
1285
+ if (!accepted) {
1286
+ diagnostics.push({
1287
+ rule: "handle-field-parity",
1288
+ level: "error",
1289
+ field,
1290
+ message: `${providerLabel} handle kind "${kind.name}" is never accepted: no operation input contains its field "${kind.fieldName}". Add ${kind.name}.field() to the consuming operation's input.`,
1291
+ });
1292
+ }
1293
+ if (kind.issuedBy === undefined)
1294
+ continue;
1295
+ if (!Object.hasOwn(operations, kind.issuedBy)) {
1296
+ diagnostics.push({
1297
+ rule: "handle-issued-by",
1298
+ level: "error",
1299
+ field,
1300
+ message: `${providerLabel} handle kind "${kind.name}" declares issuedBy "${kind.issuedBy}", which is not an operation key.`,
1301
+ });
1302
+ }
1303
+ else if (!outputKindsByOperation.get(kind.issuedBy)?.has(kind.name)) {
1304
+ diagnostics.push({
1305
+ rule: "handle-issued-by",
1306
+ level: "error",
1307
+ field,
1308
+ message: `${providerLabel} handle kind "${kind.name}" declares issuedBy "${kind.issuedBy}", but that operation's output has no "${kind.fieldName}" handle field.`,
1309
+ });
1310
+ }
1311
+ }
1312
+ return diagnostics;
1313
+ }
1314
+ const LEGACY_CHOICE_USAGE_PATTERN = /\bctx\.choice\b|\b(?:createProviderChoiceToken|parseProviderChoiceToken|ProviderChoiceTokenError|createTestProviderChoiceContext)\b/;
1315
+ const LEGACY_CHOICE_USAGE_MESSAGE = "Choice tokens were replaced by handles (ADR-0012). See docs/migrations/handle.md.";
1316
+ /**
1317
+ * The inline choice-token API was removed outright (no aliases). Any surviving
1318
+ * reference in provider source would fail at runtime, so report it at check time.
1319
+ */
1320
+ const LEGACY_CHOICE_IDENTIFIERS = new Set([
1321
+ "createProviderChoiceToken",
1322
+ "parseProviderChoiceToken",
1323
+ "ProviderChoiceTokenError",
1324
+ "createTestProviderChoiceContext",
1325
+ ]);
1326
+ /**
1327
+ * Finds the first legacy choice API reference in executable code. Uses the
1328
+ * TypeScript AST when available so comments, string and template literal text
1329
+ * never count (a migration note such as `// moved from ctx.choice` must not fail
1330
+ * the provider) while code inside `${}` interpolations still does. Falls back
1331
+ * to a raw-source regex when TypeScript is not installed.
1332
+ */
1333
+ function findLegacyChoiceUsage(source) {
1334
+ let ts;
1335
+ try {
1336
+ ts = getTypeScript();
1337
+ }
1338
+ catch {
1339
+ return LEGACY_CHOICE_USAGE_PATTERN.exec(source)?.[0];
1340
+ }
1341
+ const file = ts.createSourceFile("provider.ts", source, ts.ScriptTarget.Latest, false, ts.ScriptKind.TSX);
1342
+ let found;
1343
+ const visit = (node) => {
1344
+ if (found)
1345
+ return;
1346
+ if (ts.isIdentifier(node) && LEGACY_CHOICE_IDENTIFIERS.has(node.text)) {
1347
+ found = node.text;
1348
+ return;
1349
+ }
1350
+ if (ts.isPropertyAccessExpression(node) &&
1351
+ ts.isIdentifier(node.expression) &&
1352
+ node.expression.text === "ctx" &&
1353
+ node.name.text === "choice") {
1354
+ found = "ctx.choice";
1355
+ return;
1356
+ }
1357
+ ts.forEachChild(node, visit);
1358
+ };
1359
+ visit(file);
1360
+ return found;
1361
+ }
1362
+ function lintLegacyChoiceUsage(provider) {
1363
+ const sources = [];
1364
+ if (provider.authFlowSource) {
1365
+ sources.push({ field: "auth.flow", source: provider.authFlowSource });
1366
+ }
1367
+ for (const [filePath, source] of Object.entries(provider.providerSourceFiles ?? {})) {
1368
+ sources.push({ field: `sourceFiles.${filePath}`, source });
1369
+ }
1370
+ for (const [operationKey, operation] of Object.entries(provider.operations ?? {})) {
1371
+ const source = getOperationSource(operation);
1372
+ if (source) {
1373
+ sources.push({ field: `operations.${operationKey}.handler`, source });
1374
+ }
1375
+ }
1376
+ return sources.flatMap(({ field, source }) => {
1377
+ const match = findLegacyChoiceUsage(source);
1378
+ if (!match)
1379
+ return [];
1380
+ return [
1381
+ {
1382
+ rule: "legacy-choice-usage",
1383
+ level: "error",
1384
+ field,
1385
+ message: `Legacy choice API "${match}" is no longer supported. ${LEGACY_CHOICE_USAGE_MESSAGE}`,
1386
+ },
1387
+ ];
1388
+ });
1389
+ }
1064
1390
  export function lintOperation(op) {
1065
1391
  const diagnostics = [];
1066
1392
  const hasDescriptionKey = typeof op.descriptionKey === "string" && op.descriptionKey.length > 0;
@@ -1086,7 +1412,7 @@ export function lintOperation(op) {
1086
1412
  rule: "sensitive-field-unmarked",
1087
1413
  level: "warn",
1088
1414
  field,
1089
- message: `Schema field "${field}" looks sensitive; mark it with fields.*(), field(..., { sensitive: true }), or sensitive(...).`,
1415
+ message: `Schema field "${field}" looks sensitive; mark it with fields.*() or sensitive(...); publicField(...) is accepted only for reviewed public phone-shaped fields.`,
1090
1416
  });
1091
1417
  }
1092
1418
  for (const field of uniqueFields(collectUnmarkedSensitiveFields(op.output, "output"))) {
@@ -1094,7 +1420,7 @@ export function lintOperation(op) {
1094
1420
  rule: "sensitive-field-unmarked",
1095
1421
  level: "warn",
1096
1422
  field,
1097
- message: `Schema field "${field}" looks sensitive; mark it with fields.*(), field(..., { sensitive: true }), or sensitive(...).`,
1423
+ message: `Schema field "${field}" looks sensitive; mark it with fields.*() or sensitive(...); publicField(...) is accepted only for reviewed public phone-shaped fields.`,
1098
1424
  });
1099
1425
  }
1100
1426
  return diagnostics;
@@ -1160,6 +1486,8 @@ export function lintProviderWithInformation(provider, options = {}) {
1160
1486
  ...lintSelfHostedBrowserPatterns(provider, options),
1161
1487
  ...lintBrowserVersionLiterals(provider),
1162
1488
  ...lintUndeclaredThrownErrorCodes(provider),
1489
+ ...lintLegacyChoiceUsage(provider),
1490
+ ...lintHandleDeclarations(provider),
1163
1491
  ];
1164
1492
  if (provider.operations) {
1165
1493
  const authMode = provider.auth?.mode;
@@ -1186,9 +1514,7 @@ export function lintProviderWithInformation(provider, options = {}) {
1186
1514
  // Every authenticated mode owns an auth.flow; `oauth2_proxied` was
1187
1515
  // previously exempt, which let auth-lifecycle operations ship on
1188
1516
  // proxied providers unchecked.
1189
- if (authMode === "credentials" ||
1190
- authMode === "oauth2" ||
1191
- authMode === "oauth2_proxied") {
1517
+ if (authMode === "credentials" || authMode === "oauth2" || authMode === "oauth2_proxied") {
1192
1518
  for (const operationKey of Object.keys(provider.operations)) {
1193
1519
  if (isAuthLifecycleOperationId(operationKey, authMode)) {
1194
1520
  diagnostics.push({
@@ -1,7 +1,6 @@
1
1
  export { AuthAbortError, credentialsAuthChallenge, createAuthFlowHelpers, defineCredentialsAuth, } from "./auth.js";
2
2
  export type { CredentialsAuthChallengeDefinition, CredentialsAuthChallengeRequest, CredentialsAuthCompleteResult, CredentialsAuthCredential, CredentialsAuthField, CredentialsAuthFields, CredentialsAuthFieldType, CredentialsAuthInput, CredentialsAuthLoginResult, DefineCredentialsAuthOptions, DefinedCredentialsAuth, } from "./auth.js";
3
3
  export { createFormCeremony } from "./ceremonies/index.js";
4
- export { assertFreshProviderChoiceIssuedAt, createProviderChoiceToken, ProviderChoiceTokenError, type ProviderChoiceTokenErrorReason, type ProviderChoiceTokenPayload, parseProviderChoiceToken, } from "./choice-token.js";
5
4
  export { centered, delayed, defineHealthJourney, defineOperation, defineProvider, defineSmsOtpMatcher, every, } from "./define.js";
6
5
  export type { OperationDefinitionFor, ProviderBuilder, ProviderContextOf, ProviderDeclaration, ProviderDefinitionFor, } from "./define.js";
7
6
  export type { JsonPrimitive, JsonValue } from "./contract-json.js";
@@ -11,9 +10,10 @@ export { AuthError, HttpRedirectError, isProviderError, isSessionExpiredError, i
11
10
  export { createProviderEnvironment, createInProcessProviderEngine, ENGINE_OWNED_PROXY_CREDENTIAL_ENV_NAMES, ENGINE_OWNED_RESOLVER_CREDENTIAL_ENV_NAMES, ENGINE_OWNED_RUNTIME_ENV_NAMES, ENGINE_OWNED_TELEMETRY_ENV_NAMES, isEngineOwnedEnvName, isEngineOwnedProxyCredentialName, isEngineOwnedResolverCredentialName, isEngineOwnedRuntimeEnvName, isEngineOwnedTelemetryEnvName, PROVIDER_CAPABILITY_KEYS, PROVIDER_ENGINE_PROTOCOL_VERSION, readEngineProxyCredentials, } from "./engine.js";
12
11
  export type { ProviderCapabilityKey, ProviderEngine, ProviderEngineAttachmentInput, ProviderEngineBindingCandidates, ProviderEngineCapabilitySurface, ProviderEngineRequest, ProviderEngineResidentSurface, ProviderEngineSession, ProviderEngineTransport, } from "./engine.js";
13
12
  export { getProviderLocalePath, providerLocaleKey, qualifyProviderLocaleKey, } from "./i18n/index.js";
14
- export { type CreateProviderChoiceContextOptions, createProviderChoiceContext, createTestProviderChoiceContext, PROVIDER_RUNTIME_CHOICE_TOKEN_MASTER_SECRET_ENV, } from "./runtime/choice.js";
15
- export { APIFUSE_CONTENT_PROVENANCE_META_KEY, APIFUSE_CONTENT_TRUST_META_KEY, APIFUSE_DESCRIPTION_KEY_META_KEY, APIFUSE_REDACTION_MARKER, APIFUSE_SENSITIVE_KIND_META_KEY, APIFUSE_SENSITIVE_META_KEY, collectSensitivePaths, describeKey, field, fields, isSensitiveSchema, redactPayload, type SensitiveFieldKind, type SensitiveFieldOptions, type SensitivePath, sensitive, untrustedContent, z, } from "./schema.js";
16
- export type { AuthAbortData, AuthAbortRetry, AuthFlowTerminalContext, AuthMode, AuthSafeData, AuthSafeJson, FlowContext, HealthCheckAssertionContext, HealthCheckCase, HealthCheckSuite, HealthCheckUnsupported, HealthJourneyDefinition, HealthJourneyEventContext, HealthJourneyManualTriggerPolicy, HealthJourneyRunContext, HealthJourneyRunResult, HealthScheduleRandomization, HttpRedirectFailureReason, HttpRedirectPolicy, HttpRedirectPolicyMode, HttpRetryOptions, HttpRetrySummary, InferSchemaOutput, NativeContext, NativeNetworkClient, NativeNetworkCloseReason, NativeNetworkConnection, NativeNetworkConnectInput, NativeNetworkConnectOptions, NativeNetworkDynamicGrantOptions, NativeNetworkEgressGrant, NativeProviderConfig, NativeProxyDrainHandler, NativeProxyEgressInfo, NativeProxyExpiringEvent, NativeProxyExpiringReason, NativeTcpDynamicEgressRule, NativeTcpEgressGrant, NativeTcpEgressRule, NativeTcpPortRange, NativeTcpTlsMode, NativeTlsConnectOptions, OperationApprovalPolicy, OperationContractMetadata, OperationDefinition, OperationExample, OperationErrorCode, ProviderErrorStatus, OperationLifecycle, OperationObservabilityConfig, OperationObservabilitySensitiveConfig, OperationRelationships, OperationRiskClass, OperationSensitivePath, OperationTransport, ProviderAccessVisibility, ProviderChoiceBindingOptions, ProviderChoiceConsumeMode, ProviderChoiceConsumeResult, ProviderChoiceContext, ProviderChoiceExplicitParseResult, ProviderChoiceIssueOptions, ProviderChoiceParseOptions, ProviderContext, ProviderContextFor, ProviderDefinition, ProviderDeploymentOverrides, ProviderFileRef, ProviderFilesContext, ProviderLocale, ProviderLocaleKey, ProviderLocaleKeyInput, ProviderLogoProfile, ProviderProxyPolicy, ProxiedOAuthConfig, ProviderPublicConnectionMode, ProviderPublicProfile, ProviderResolvedFile, ProviderRuntimeTarget, ProviderRuntimeState, ProviderStealthConfig, ProviderStateDurationString, ProviderStateNamespace, ProviderSupportLevel, RedirectRunReason, SchemaLike, SmsOtpMatcherDefinition, StandardSchemaV1, StateCasResult, StateNamespaceOptions, StateNamespaceScope, StateValue, StateWriteOptions, StealthChallengeClassification, } from "./types.js";
13
+ export * from "./handle.js";
14
+ export { type CreateHandleContextOptions, type CreateTestHandleContextOptions, createHandleContext, createTestHandleContext, type HandleNormalizationClass, type NormalizedHandle, normalizeHandle, } from "./runtime/handle.js";
15
+ export { APIFUSE_CONTENT_PROVENANCE_META_KEY, APIFUSE_CONTENT_TRUST_META_KEY, APIFUSE_DESCRIPTION_KEY_META_KEY, APIFUSE_REDACTION_MARKER, APIFUSE_SENSITIVE_KIND_META_KEY, APIFUSE_SENSITIVE_META_KEY, collectSensitivePaths, describeKey, field, fields, isSensitiveSchema, publicField, redactPayload, type SensitiveFieldKind, type SensitiveFieldOptions, type SensitivePath, sensitive, untrustedContent, z, } from "./schema.js";
16
+ export type { AuthAbortData, AuthAbortRetry, AuthFlowTerminalContext, AuthMode, AuthSafeData, AuthSafeJson, FlowContext, HealthCheckAssertionContext, HealthCheckCase, HealthCheckSuite, HealthCheckUnsupported, HealthJourneyDefinition, HealthJourneyEventContext, HealthJourneyManualTriggerPolicy, HealthJourneyRunContext, HealthJourneyRunResult, HealthScheduleRandomization, HttpRedirectFailureReason, HttpRedirectPolicy, HttpRedirectPolicyMode, HttpRetryOptions, HttpRetrySummary, InferSchemaOutput, NativeContext, NativeNetworkClient, NativeNetworkCloseReason, NativeNetworkConnection, NativeNetworkConnectInput, NativeNetworkConnectOptions, NativeNetworkDynamicGrantOptions, NativeNetworkEgressGrant, NativeProviderConfig, NativeProxyDrainHandler, NativeProxyEgressInfo, NativeProxyExpiringEvent, NativeProxyExpiringReason, NativeTcpDynamicEgressRule, NativeTcpEgressGrant, NativeTcpEgressRule, NativeTcpPortRange, NativeTcpTlsMode, NativeTlsConnectOptions, OperationApprovalPolicy, OperationContractMetadata, OperationDefinition, OperationExample, OperationErrorCode, ProviderErrorStatus, OperationLifecycle, OperationObservabilityConfig, OperationObservabilitySensitiveConfig, OperationRelationships, OperationRiskClass, OperationSensitivePath, OperationTransport, ProviderAccessVisibility, ProviderContext, ProviderContextFor, ProviderDefinition, ProviderDeploymentOverrides, ProviderFileRef, ProviderFilesContext, ProviderLocale, ProviderLocaleKey, ProviderLocaleKeyInput, ProviderLogoProfile, ProviderProxyPolicy, ProxiedOAuthConfig, ProviderPublicConnectionMode, ProviderPublicProfile, ProviderResolvedFile, ProviderRuntimeTarget, ProviderRuntimeState, ProviderStealthConfig, ProviderStateDurationString, ProviderStateNamespace, ProviderSupportLevel, RedirectRunReason, SchemaLike, SmsOtpMatcherDefinition, StandardSchemaV1, StateCasResult, StateNamespaceOptions, StateNamespaceScope, StateValue, StateWriteOptions, StealthChallengeClassification, } from "./types.js";
17
17
  export { NativeEgressGrantExpiredError, NativeEgressNotDeclaredError, NativeIdleTimeoutError, NativeNetworkError, NativeProxyExpiredError, } from "./runtime/native-network-errors.js";
18
18
  export type { NativeGatewayProxy, NativeGatewayProxyResolutionInput, NativeGatewayProxySkipReason, NativeGatewayProxySynthesizer, NativeGatewayProxySynthesisResult, NativeGatewayProxySynthesisInput, NativeNetworkClientOptions, NativeNetworkErrorCode, VendorCredentialLookup, VendorCredentialResolver, } from "./runtime/native-network.js";
19
19
  export { HttpRetryAfterPolicy, HttpRetryDelayStrategy, HttpRetryJitter, HttpRetryPreset, HttpRetryUnsafeMethodPolicy, } from "./types.js";