@apifuse/provider-sdk 2.1.0-beta.5 → 2.1.0-beta.8

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 (163) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +2 -2
  3. package/SUBMISSION.md +2 -1
  4. package/bin/apifuse-check.ts +60 -6
  5. package/bin/apifuse-dev.ts +48 -5
  6. package/bin/apifuse-perf.ts +50 -11
  7. package/bin/apifuse-record.ts +35 -11
  8. package/bin/apifuse-submit-check.ts +1425 -3
  9. package/dist/ceremonies/index.d.ts +41 -0
  10. package/dist/ceremonies/index.js +490 -0
  11. package/dist/choice-token.d.ts +24 -0
  12. package/dist/choice-token.js +74 -0
  13. package/dist/cli/commands.d.ts +10 -0
  14. package/dist/cli/commands.js +80 -0
  15. package/dist/cli/create.d.ts +47 -0
  16. package/dist/cli/create.js +762 -0
  17. package/dist/config/loader.d.ts +107 -0
  18. package/dist/config/loader.js +935 -0
  19. package/dist/contract-json.d.ts +9 -0
  20. package/dist/contract-json.js +51 -0
  21. package/dist/contract-serialization.d.ts +4 -0
  22. package/dist/contract-serialization.js +78 -0
  23. package/dist/contract-types.d.ts +49 -0
  24. package/dist/contract-types.js +1 -0
  25. package/dist/contract.d.ts +6 -0
  26. package/dist/contract.js +155 -0
  27. package/dist/define.d.ts +97 -0
  28. package/dist/define.js +1320 -0
  29. package/dist/dev.d.ts +9 -0
  30. package/dist/dev.js +15 -0
  31. package/dist/errors.d.ts +59 -0
  32. package/dist/errors.js +97 -0
  33. package/dist/i18n/catalog.d.ts +29 -0
  34. package/dist/i18n/catalog.js +159 -0
  35. package/dist/i18n/index.d.ts +2 -0
  36. package/dist/i18n/index.js +2 -0
  37. package/dist/i18n/keys.d.ts +10 -0
  38. package/dist/i18n/keys.js +34 -0
  39. package/dist/index.d.ts +41 -0
  40. package/dist/index.js +37 -0
  41. package/dist/lint.d.ts +73 -0
  42. package/dist/lint.js +702 -0
  43. package/dist/observability.d.ts +5 -0
  44. package/dist/observability.js +39 -0
  45. package/dist/provider.d.ts +9 -0
  46. package/dist/provider.js +8 -0
  47. package/dist/public-schema-field-lint.d.ts +2 -0
  48. package/dist/public-schema-field-lint.js +158 -0
  49. package/dist/recipes/gov-api.d.ts +19 -0
  50. package/dist/recipes/gov-api.js +72 -0
  51. package/dist/recipes/rest-api.d.ts +21 -0
  52. package/dist/recipes/rest-api.js +115 -0
  53. package/dist/runtime/auth-flow.d.ts +14 -0
  54. package/dist/runtime/auth-flow.js +44 -0
  55. package/dist/runtime/browser.d.ts +25 -0
  56. package/dist/runtime/browser.js +1034 -0
  57. package/dist/runtime/cache.d.ts +10 -0
  58. package/dist/runtime/cache.js +372 -0
  59. package/dist/runtime/choice.d.ts +15 -0
  60. package/dist/runtime/choice.js +435 -0
  61. package/dist/runtime/credential.d.ts +8 -0
  62. package/dist/runtime/credential.js +61 -0
  63. package/dist/runtime/env.d.ts +2 -0
  64. package/dist/runtime/env.js +10 -0
  65. package/dist/runtime/executor.d.ts +16 -0
  66. package/dist/runtime/executor.js +51 -0
  67. package/dist/runtime/http.d.ts +8 -0
  68. package/dist/runtime/http.js +706 -0
  69. package/dist/runtime/insights.d.ts +9 -0
  70. package/dist/runtime/insights.js +324 -0
  71. package/dist/runtime/instrumentation.d.ts +8 -0
  72. package/dist/runtime/instrumentation.js +269 -0
  73. package/dist/runtime/key-derivation.d.ts +24 -0
  74. package/dist/runtime/key-derivation.js +73 -0
  75. package/dist/runtime/keyring.d.ts +25 -0
  76. package/dist/runtime/keyring.js +93 -0
  77. package/dist/runtime/namespace.d.ts +9 -0
  78. package/dist/runtime/namespace.js +19 -0
  79. package/dist/runtime/otlp.d.ts +39 -0
  80. package/dist/runtime/otlp.js +103 -0
  81. package/dist/runtime/perf.d.ts +12 -0
  82. package/dist/runtime/perf.js +52 -0
  83. package/dist/runtime/prevalidate.d.ts +12 -0
  84. package/dist/runtime/prevalidate.js +173 -0
  85. package/dist/runtime/provider.d.ts +2 -0
  86. package/dist/runtime/provider.js +11 -0
  87. package/dist/runtime/proxy-errors.d.ts +21 -0
  88. package/dist/runtime/proxy-errors.js +83 -0
  89. package/dist/runtime/proxy-telemetry.d.ts +8 -0
  90. package/dist/runtime/proxy-telemetry.js +174 -0
  91. package/dist/runtime/redis.d.ts +17 -0
  92. package/dist/runtime/redis.js +82 -0
  93. package/dist/runtime/request-options.d.ts +3 -0
  94. package/dist/runtime/request-options.js +42 -0
  95. package/dist/runtime/state.d.ts +17 -0
  96. package/dist/runtime/state.js +344 -0
  97. package/dist/runtime/stealth.d.ts +18 -0
  98. package/dist/runtime/stealth.js +827 -0
  99. package/dist/runtime/stt.d.ts +22 -0
  100. package/dist/runtime/stt.js +480 -0
  101. package/dist/runtime/trace.d.ts +26 -0
  102. package/dist/runtime/trace.js +142 -0
  103. package/dist/runtime/waterfall.d.ts +12 -0
  104. package/dist/runtime/waterfall.js +147 -0
  105. package/dist/schema.d.ts +74 -0
  106. package/dist/schema.js +243 -0
  107. package/dist/serve.d.ts +1 -0
  108. package/dist/serve.js +1 -0
  109. package/dist/server/index.d.ts +3 -0
  110. package/dist/server/index.js +2 -0
  111. package/dist/server/serve.d.ts +64 -0
  112. package/dist/server/serve.js +1110 -0
  113. package/dist/server/types.d.ts +136 -0
  114. package/dist/server/types.js +86 -0
  115. package/dist/stealth/profiles.d.ts +4 -0
  116. package/dist/stealth/profiles.js +259 -0
  117. package/dist/stream.d.ts +44 -0
  118. package/dist/stream.js +151 -0
  119. package/dist/testing/helpers.d.ts +23 -0
  120. package/dist/testing/helpers.js +95 -0
  121. package/dist/testing/index.d.ts +2 -0
  122. package/dist/testing/index.js +2 -0
  123. package/dist/testing/run.d.ts +34 -0
  124. package/dist/testing/run.js +303 -0
  125. package/dist/types.d.ts +1324 -0
  126. package/dist/types.js +61 -0
  127. package/dist/utils/date.d.ts +6 -0
  128. package/dist/utils/date.js +101 -0
  129. package/dist/utils/parse.d.ts +16 -0
  130. package/dist/utils/parse.js +51 -0
  131. package/dist/utils/text.d.ts +4 -0
  132. package/dist/utils/text.js +14 -0
  133. package/dist/utils/transform.d.ts +8 -0
  134. package/dist/utils/transform.js +48 -0
  135. package/package.json +42 -25
  136. package/src/ceremonies/index.ts +8 -2
  137. package/src/choice-token.ts +1 -0
  138. package/src/cli/commands.ts +8 -5
  139. package/src/cli/create.ts +28 -0
  140. package/src/cli/templates/provider/operations/ping.ts.tpl +3 -2
  141. package/src/cli/templates/provider/schemas/ping.ts.tpl +8 -0
  142. package/src/config/loader.ts +19 -1
  143. package/src/contract-json.ts +75 -0
  144. package/src/contract-serialization.ts +89 -0
  145. package/src/contract-types.ts +52 -0
  146. package/src/contract.ts +215 -0
  147. package/src/define.ts +37 -2
  148. package/src/errors.ts +15 -0
  149. package/src/i18n/catalog.ts +156 -0
  150. package/src/index.ts +22 -1
  151. package/src/lint.ts +256 -37
  152. package/src/provider.ts +45 -2
  153. package/src/runtime/browser.ts +685 -30
  154. package/src/runtime/cache.ts +35 -89
  155. package/src/runtime/choice.ts +760 -0
  156. package/src/runtime/executor.ts +19 -2
  157. package/src/runtime/redis.ts +116 -0
  158. package/src/runtime/state.ts +487 -0
  159. package/src/runtime/stealth.ts +8 -1
  160. package/src/server/serve.ts +361 -46
  161. package/src/server/types.ts +2 -0
  162. package/src/testing/run.ts +16 -3
  163. package/src/types.ts +209 -6
package/src/index.ts CHANGED
@@ -9,6 +9,16 @@ export type {
9
9
  SessionConfig,
10
10
  } from "./config/loader";
11
11
  export { defineConfig, loadApiFuseConfig } from "./config/loader";
12
+ export {
13
+ canonicalJson,
14
+ digestProviderContract,
15
+ extractProviderContract,
16
+ type JsonPrimitive,
17
+ type JsonValue,
18
+ PROVIDER_CONTRACT_SCHEMA_VERSION,
19
+ type ProviderContractOperation,
20
+ type ProviderContractSnapshot,
21
+ } from "./contract";
12
22
  export {
13
23
  defineHealthJourney,
14
24
  defineOperation,
@@ -38,6 +48,12 @@ export {
38
48
  type ProviderCacheOptions,
39
49
  resetProviderCacheForTests,
40
50
  } from "./runtime/cache";
51
+ export {
52
+ type CreateProviderChoiceContextOptions,
53
+ createProviderChoiceContext,
54
+ createTestProviderChoiceContext,
55
+ PROVIDER_RUNTIME_CHOICE_TOKEN_MASTER_SECRET_ENV,
56
+ } from "./runtime/choice";
41
57
  export {
42
58
  type CreateCredentialContextOptions,
43
59
  createCredentialContext,
@@ -99,7 +115,8 @@ export type {
99
115
  AuthConfig,
100
116
  AuthContext,
101
117
  AuthFlowDefinition,
102
- AuthFlowHandler,
118
+ AuthFlowInputHandler,
119
+ AuthFlowStartHandler,
103
120
  AuthMode,
104
121
  AuthTurn,
105
122
  Bcp47Locale,
@@ -167,6 +184,10 @@ export type {
167
184
  ProviderCacheLookupMeta,
168
185
  ProviderCacheResponseMeta,
169
186
  ProviderCacheResult,
187
+ ProviderChoiceBindingOptions,
188
+ ProviderChoiceContext,
189
+ ProviderChoiceIssueOptions,
190
+ ProviderChoiceParseOptions,
170
191
  ProviderContext,
171
192
  ProviderDefinition,
172
193
  ProviderHealthMonitorConfig,
package/src/lint.ts CHANGED
@@ -20,6 +20,7 @@ type ProviderAuthLike = {
20
20
  continue?: unknown;
21
21
  poll?: unknown;
22
22
  abort?: unknown;
23
+ refresh?: unknown;
23
24
  };
24
25
  };
25
26
 
@@ -52,6 +53,18 @@ export interface LintDiagnostic {
52
53
  field?: string;
53
54
  }
54
55
 
56
+ export type ProviderLintMode = "official" | "standalone";
57
+
58
+ type ProviderLintOptions = {
59
+ mode?: ProviderLintMode;
60
+ };
61
+
62
+ type ProviderSourceLike = {
63
+ authFlowSource?: string;
64
+ providerSourceFiles?: Record<string, string>;
65
+ operations?: Record<string, { handler?: unknown; source?: string }>;
66
+ };
67
+
55
68
  function lintAllowedHosts(
56
69
  providerId: string | undefined,
57
70
  allowedHosts: readonly string[] | undefined,
@@ -126,6 +139,18 @@ function hasReusableSecretKeys(keys: readonly string[] | undefined): boolean {
126
139
  );
127
140
  }
128
141
 
142
+ function hasReusableReloginSecretKeys(
143
+ keys: readonly string[] | undefined,
144
+ ): boolean {
145
+ if (!keys) {
146
+ return false;
147
+ }
148
+
149
+ return keys.some((key) =>
150
+ /(password|passcode|secret|cookie|session)/i.test(key),
151
+ );
152
+ }
153
+
129
154
  function getAuthFlowSource(provider: {
130
155
  auth?: ProviderAuthLike;
131
156
  authFlowSource?: string;
@@ -139,6 +164,7 @@ function getAuthFlowSource(provider: {
139
164
  provider.auth?.flow?.continue,
140
165
  provider.auth?.flow?.poll,
141
166
  provider.auth?.flow?.abort,
167
+ provider.auth?.flow?.refresh,
142
168
  ];
143
169
 
144
170
  return parts
@@ -211,6 +237,20 @@ function lintAuthModel(provider: {
211
237
  });
212
238
  }
213
239
 
240
+ if (
241
+ typeof provider.auth?.flow?.refresh === "function" &&
242
+ hasReusableReloginSecretKeys(credentialKeys) &&
243
+ (!provider.credential?.storesReusableSecret ||
244
+ !provider.credential.justification)
245
+ ) {
246
+ diagnostics.push({
247
+ rule: "auth-refresh-reusable-secret",
248
+ level: "error",
249
+ field: "credential",
250
+ message: `${providerLabel} must set storesReusableSecret and justification when auth.flow.refresh may silently re-login with reusable credential secrets.`,
251
+ });
252
+ }
253
+
214
254
  if (authMode === "platform-managed" && credentialKeys.length > 0) {
215
255
  diagnostics.push({
216
256
  rule: "platform-managed-no-credential-keys",
@@ -621,6 +661,178 @@ function lintStealthTransportUsage(provider: {
621
661
  );
622
662
  }
623
663
 
664
+ function lintCredentialWriteUsage(provider: {
665
+ operations?: Record<string, { handler?: unknown; source?: string }>;
666
+ }): LintDiagnostic[] {
667
+ if (!provider.operations) {
668
+ return [];
669
+ }
670
+
671
+ return Object.entries(provider.operations).flatMap(
672
+ ([operationKey, operation]) => {
673
+ const source = getOperationSource(operation);
674
+ if (!/\bctx\.credential\.(?:set|setMany)\s*\(/.test(source)) {
675
+ return [];
676
+ }
677
+
678
+ return [
679
+ {
680
+ rule: "ctx-credential-write-forbidden-in-handler",
681
+ level: "error" as const,
682
+ field: `operations.${operationKey}.handler`,
683
+ message:
684
+ "Operation handlers must not mutate credentials; return refreshed credentials from auth.flow.refresh instead.",
685
+ },
686
+ ];
687
+ },
688
+ );
689
+ }
690
+
691
+ function lintPlaywrightDirectImports(provider: {
692
+ authFlowSource?: string;
693
+ providerSourceFiles?: Record<string, string>;
694
+ operations?: Record<string, { handler?: unknown; source?: string }>;
695
+ }): LintDiagnostic[] {
696
+ const diagnostics: LintDiagnostic[] = [];
697
+ const importPattern =
698
+ /(?:import\s+(?:type\s+)?[\s\S]*?\s+from\s+["'](?:playwright|playwright-core)["']|require\(\s*["'](?:playwright|playwright-core)["']\s*\)|import\(\s*["'](?:playwright|playwright-core)["']\s*\))/;
699
+
700
+ if (provider.authFlowSource && importPattern.test(provider.authFlowSource)) {
701
+ diagnostics.push({
702
+ rule: "playwright-direct-import",
703
+ level: "warn",
704
+ field: "auth.flow",
705
+ message:
706
+ "Provider auth flow imports playwright directly; use ctx.browser frame-aware methods so the SDK can enforce the CDP pool runtime.",
707
+ });
708
+ }
709
+
710
+ for (const [filePath, source] of Object.entries(
711
+ provider.providerSourceFiles ?? {},
712
+ )) {
713
+ if (!importPattern.test(source)) {
714
+ continue;
715
+ }
716
+
717
+ diagnostics.push({
718
+ rule: "playwright-direct-import",
719
+ level: "warn",
720
+ field: `sourceFiles.${filePath}`,
721
+ message:
722
+ "Provider source imports playwright directly; use ctx.browser frame-aware methods so the SDK can enforce the CDP pool runtime.",
723
+ });
724
+ }
725
+
726
+ if (!provider.operations) {
727
+ return diagnostics;
728
+ }
729
+
730
+ for (const [operationKey, operation] of Object.entries(provider.operations)) {
731
+ const source = getOperationSource(operation);
732
+ if (!importPattern.test(source)) {
733
+ continue;
734
+ }
735
+
736
+ diagnostics.push({
737
+ rule: "playwright-direct-import",
738
+ level: "warn",
739
+ field: `operations.${operationKey}.handler`,
740
+ message:
741
+ "Operation source imports playwright directly; use ctx.browser frame-aware methods so the SDK can enforce the CDP pool runtime.",
742
+ });
743
+ }
744
+
745
+ return diagnostics;
746
+ }
747
+
748
+ type SelfHostedBrowserPattern = {
749
+ rule: string;
750
+ pattern: RegExp;
751
+ message: string;
752
+ };
753
+
754
+ const SELF_HOSTED_BROWSER_MESSAGE =
755
+ "Official browser providers must use ctx.browser backed by the managed CDP Pool; do not launch or connect to provider-local Chrome/CDP runtimes.";
756
+
757
+ const SELF_HOSTED_BROWSER_PATTERNS: readonly SelfHostedBrowserPattern[] = [
758
+ {
759
+ rule: "browser-self-hosted-launch",
760
+ pattern: /\b(?:playwright|chromium|firefox|webkit|puppeteer)\.launch\s*\(/,
761
+ message: `${SELF_HOSTED_BROWSER_MESSAGE} Replace direct Playwright/Puppeteer launch calls with ctx.browser.newPage() or ctx.browser.withIsolatedContext().`,
762
+ },
763
+ {
764
+ rule: "browser-self-hosted-child-process",
765
+ pattern:
766
+ /(?:\b(?:spawn|spawnSync|exec|execSync|execFile|execFileSync)\s*\([\s\S]{0,240}\b(?:google-chrome|chrome|chromium|chromium-browser)\b|\b(?:Bun\.)?spawn(?:Sync)?\s*\([\s\S]{0,240}\b(?:google-chrome|chrome|chromium|chromium-browser)\b|\$`[\s\S]{0,240}\b(?:google-chrome|chrome|chromium|chromium-browser)\b)/,
767
+ message: `${SELF_HOSTED_BROWSER_MESSAGE} Provider pods must not start Chrome with child_process, Bun.spawn, or shell commands.`,
768
+ },
769
+ {
770
+ rule: "browser-self-hosted-remote-debugging-port",
771
+ pattern:
772
+ /(?:\b(?:google-chrome|chrome|chromium|chromium-browser)\b[\s\S]{0,240}--remote-debugging-port\b|--remote-debugging-port(?:=|\s+))/,
773
+ message: `${SELF_HOSTED_BROWSER_MESSAGE} Provider entrypoints, Dockerfiles, and scripts must not start Chrome with a remote debugging port; use the managed CDP Pool instead.`,
774
+ },
775
+ {
776
+ rule: "browser-direct-cdp-version-poll",
777
+ pattern: /\/json\/version\b/,
778
+ message: `${SELF_HOSTED_BROWSER_MESSAGE} Do not poll /json/version from provider code; the SDK manages CDP leases through APIFUSE__CDP_POOL__URL.`,
779
+ },
780
+ {
781
+ rule: "browser-provider-local-cdp-env",
782
+ pattern:
783
+ /\b(?!APIFUSE__CDP_POOL__URL\b)[A-Z][A-Z0-9_]*_CDP_URL\b|process\.env(?:\.(?!APIFUSE__CDP_POOL__URL\b)[A-Z0-9_]*_CDP_URL\b|\[\s*["'`](?!APIFUSE__CDP_POOL__URL\b)[A-Z0-9_]*_CDP_URL["'`]\s*\])/,
784
+ message: `${SELF_HOSTED_BROWSER_MESSAGE} Do not read provider-local CDP endpoint env vars including AMAZON_CDP_URL or custom *_CDP_URL names; production uses APIFUSE__CDP_POOL__URL through ctx.browser.`,
785
+ },
786
+ ];
787
+
788
+ function lintSelfHostedBrowserPatterns(
789
+ provider: ProviderSourceLike,
790
+ options: ProviderLintOptions,
791
+ ): LintDiagnostic[] {
792
+ const diagnostics: LintDiagnostic[] = [];
793
+ const level = options.mode === "standalone" ? "warn" : "error";
794
+ const sources: Array<{ field: string; source: string }> = [];
795
+
796
+ if (provider.authFlowSource) {
797
+ sources.push({ field: "auth.flow", source: provider.authFlowSource });
798
+ }
799
+
800
+ for (const [filePath, source] of Object.entries(
801
+ provider.providerSourceFiles ?? {},
802
+ )) {
803
+ sources.push({ field: `sourceFiles.${filePath}`, source });
804
+ }
805
+
806
+ for (const [operationKey, operation] of Object.entries(
807
+ provider.operations ?? {},
808
+ )) {
809
+ const source = getOperationSource(operation);
810
+ if (source) {
811
+ sources.push({
812
+ field: `operations.${operationKey}.handler`,
813
+ source,
814
+ });
815
+ }
816
+ }
817
+
818
+ for (const { field, source } of sources) {
819
+ for (const item of SELF_HOSTED_BROWSER_PATTERNS) {
820
+ item.pattern.lastIndex = 0;
821
+ if (!item.pattern.test(source)) {
822
+ continue;
823
+ }
824
+ diagnostics.push({
825
+ rule: item.rule,
826
+ level,
827
+ field,
828
+ message: item.message,
829
+ });
830
+ }
831
+ }
832
+
833
+ return diagnostics;
834
+ }
835
+
624
836
  export function lintOperation(op: {
625
837
  description?: string;
626
838
  descriptionKey?: string;
@@ -743,48 +955,55 @@ export function lintOperation(op: {
743
955
  return diagnostics;
744
956
  }
745
957
 
746
- export function lintProvider(provider: {
747
- id?: string;
748
- allowedHosts?: readonly string[];
749
- stealth?: unknown;
750
- auth?: ProviderAuthLike;
751
- credential?: {
752
- keys?: readonly string[];
753
- storesReusableSecret?: boolean;
754
- justification?: string;
755
- };
756
- context?: {
757
- keys?: readonly string[];
758
- };
759
- authFlowSource?: string;
760
- operations?: Record<
761
- string,
762
- {
763
- description?: string;
764
- descriptionKey?: string;
765
- whenToUse?: readonly string[];
766
- whenToUseKeys?: readonly string[];
767
- whenNotToUse?: readonly string[];
768
- whenNotToUseKeys?: readonly string[];
769
- input: unknown;
770
- output: unknown;
771
- fixtures?: unknown;
772
- inputExamples?: readonly unknown[];
773
- derivations?: Record<string, string>;
774
- handler?: unknown;
775
- source?: string;
776
- }
777
- >;
778
- meta?: {
779
- contract?: ProviderContractMetaLike;
780
- };
781
- reviewed?: string;
782
- }): LintDiagnostic[] {
958
+ export function lintProvider(
959
+ provider: {
960
+ id?: string;
961
+ allowedHosts?: readonly string[];
962
+ stealth?: unknown;
963
+ auth?: ProviderAuthLike;
964
+ credential?: {
965
+ keys?: readonly string[];
966
+ storesReusableSecret?: boolean;
967
+ justification?: string;
968
+ };
969
+ context?: {
970
+ keys?: readonly string[];
971
+ };
972
+ authFlowSource?: string;
973
+ providerSourceFiles?: Record<string, string>;
974
+ operations?: Record<
975
+ string,
976
+ {
977
+ description?: string;
978
+ descriptionKey?: string;
979
+ whenToUse?: readonly string[];
980
+ whenToUseKeys?: readonly string[];
981
+ whenNotToUse?: readonly string[];
982
+ whenNotToUseKeys?: readonly string[];
983
+ input: unknown;
984
+ output: unknown;
985
+ fixtures?: unknown;
986
+ inputExamples?: readonly unknown[];
987
+ derivations?: Record<string, string>;
988
+ handler?: unknown;
989
+ source?: string;
990
+ }
991
+ >;
992
+ meta?: {
993
+ contract?: ProviderContractMetaLike;
994
+ };
995
+ reviewed?: string;
996
+ },
997
+ options: ProviderLintOptions = {},
998
+ ): LintDiagnostic[] {
783
999
  const diagnostics: LintDiagnostic[] = [
784
1000
  ...lintAllowedHosts(provider.id, provider.allowedHosts),
785
1001
  ...lintReviewed(provider.id, provider.reviewed),
786
1002
  ...lintAuthModel(provider),
787
1003
  ...lintStealthTransportUsage(provider),
1004
+ ...lintCredentialWriteUsage(provider),
1005
+ ...lintPlaywrightDirectImports(provider),
1006
+ ...lintSelfHostedBrowserPatterns(provider, options),
788
1007
  ];
789
1008
 
790
1009
  if (!provider.operations) {
package/src/provider.ts CHANGED
@@ -14,8 +14,24 @@ export {
14
14
  defineSmsOtpMatcher,
15
15
  every,
16
16
  } from "./define";
17
- export { AuthError, ProviderError, ValidationError } from "./errors";
18
- export { providerLocaleKey, qualifyProviderLocaleKey } from "./i18n";
17
+ export {
18
+ AuthError,
19
+ ProviderError,
20
+ SessionExpiredError,
21
+ TransportError,
22
+ ValidationError,
23
+ } from "./errors";
24
+ export {
25
+ getProviderLocalePath,
26
+ providerLocaleKey,
27
+ qualifyProviderLocaleKey,
28
+ } from "./i18n";
29
+ export {
30
+ type CreateProviderChoiceContextOptions,
31
+ createProviderChoiceContext,
32
+ createTestProviderChoiceContext,
33
+ PROVIDER_RUNTIME_CHOICE_TOKEN_MASTER_SECRET_ENV,
34
+ } from "./runtime/choice";
19
35
  export {
20
36
  APIFUSE_DESCRIPTION_KEY_META_KEY,
21
37
  APIFUSE_REDACTION_MARKER,
@@ -34,7 +50,12 @@ export {
34
50
  z,
35
51
  } from "./schema";
36
52
  export type {
53
+ AuthMode,
37
54
  FlowContext,
55
+ HealthCheckAssertionContext,
56
+ HealthCheckCase,
57
+ HealthCheckSuite,
58
+ HealthCheckUnsupported,
38
59
  HealthJourneyDefinition,
39
60
  HealthJourneyEventContext,
40
61
  HealthJourneyManualTriggerPolicy,
@@ -43,16 +64,38 @@ export type {
43
64
  HttpRetryOptions,
44
65
  HttpRetrySummary,
45
66
  InferSchemaOutput,
67
+ OperationApprovalPolicy,
68
+ OperationContractMetadata,
46
69
  OperationDefinition,
70
+ OperationDocMeta,
71
+ OperationErrorCode,
72
+ OperationInputExample,
73
+ OperationLifecycle,
47
74
  OperationObservabilityConfig,
48
75
  OperationObservabilitySensitiveConfig,
76
+ OperationRelationships,
77
+ OperationRiskClass,
49
78
  OperationSensitivePath,
79
+ OperationToolRouterMetadata,
80
+ OperationTransport,
81
+ ProviderAccessVisibility,
82
+ ProviderChoiceBindingOptions,
83
+ ProviderChoiceContext,
84
+ ProviderChoiceIssueOptions,
85
+ ProviderChoiceParseOptions,
50
86
  ProviderContext,
87
+ ProviderDefinition,
88
+ ProviderLocale,
89
+ ProviderLocaleKey,
51
90
  ProviderLocaleKeyInput,
91
+ ProviderLogoProfile,
52
92
  ProviderProxyPolicy,
93
+ ProviderPublicConnectionMode,
94
+ ProviderPublicProfile,
53
95
  ProviderRuntimeState,
54
96
  ProviderStateDurationString,
55
97
  ProviderStateNamespace,
98
+ ProviderSupportLevel,
56
99
  SchemaLike,
57
100
  SmsOtpMatcherDefinition,
58
101
  StandardSchemaV1,