effect-browserbase 0.1.0-beta.104 → 0.2.0-beta.1

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 (158) hide show
  1. package/README.md +106 -307
  2. package/dist/Account.d.mts +17 -19
  3. package/dist/Account.mjs +4 -9
  4. package/dist/Account.mjs.map +1 -1
  5. package/dist/{Acquisition-WBafHwXH.mjs → Acquisition-CAsTTXp4.mjs} +25 -70
  6. package/dist/Acquisition-CAsTTXp4.mjs.map +1 -0
  7. package/dist/Agents-5HpTp9YE.d.mts +155 -0
  8. package/dist/Agents.d.mts +3 -156
  9. package/dist/Agents.mjs +4 -20
  10. package/dist/Agents.mjs.map +1 -1
  11. package/dist/Allocation.d.mts +9 -11
  12. package/dist/Allocation.mjs +2 -4
  13. package/dist/Allocation.mjs.map +1 -1
  14. package/dist/Browser-DpSajNai.mjs +270 -0
  15. package/dist/Browser-DpSajNai.mjs.map +1 -0
  16. package/dist/Browser.d.mts +26 -143
  17. package/dist/Browser.mjs +3 -223
  18. package/dist/BrowserBinding.d.mts +7 -34
  19. package/dist/BrowserBinding.mjs +30 -1
  20. package/dist/BrowserBinding.mjs.map +1 -0
  21. package/dist/Certificates-D4NQmyeA.d.mts +34 -0
  22. package/dist/Certificates.d.mts +3 -35
  23. package/dist/Certificates.mjs +2 -7
  24. package/dist/Certificates.mjs.map +1 -1
  25. package/dist/{Cleanup-G2YpTCuU.d.mts → Cleanup-DMTDBir8.d.mts} +5 -6
  26. package/dist/Cleanup.d.mts +3 -2
  27. package/dist/Cleanup.mjs +1 -6
  28. package/dist/Cleanup.mjs.map +1 -1
  29. package/dist/{Client-D1_xYM9o.mjs → Client-4RMKIpL2.mjs} +12 -12
  30. package/dist/Client-4RMKIpL2.mjs.map +1 -0
  31. package/dist/{Client-Ca0zSg1n.d.mts → Client-B_f6bBLT.d.mts} +4 -5
  32. package/dist/Client.d.mts +3 -2
  33. package/dist/Client.mjs +1 -1
  34. package/dist/Connection-sxyxtwlk.mjs +56 -0
  35. package/dist/Connection-sxyxtwlk.mjs.map +1 -0
  36. package/dist/ContextCoordination.d.mts +5 -6
  37. package/dist/ContextCoordination.mjs +2 -9
  38. package/dist/ContextCoordination.mjs.map +1 -1
  39. package/dist/{ContextWriter-BrQmoXRg.mjs → ContextWriter-oKWFLHuP.mjs} +8 -12
  40. package/dist/ContextWriter-oKWFLHuP.mjs.map +1 -0
  41. package/dist/Contexts-DqdL7cyX.d.mts +31 -0
  42. package/dist/Contexts.d.mts +3 -32
  43. package/dist/Contexts.mjs +3 -9
  44. package/dist/Contexts.mjs.map +1 -1
  45. package/dist/Downloads-CdhiCO5X.d.mts +43 -0
  46. package/dist/Downloads.d.mts +3 -44
  47. package/dist/Downloads.mjs +3 -8
  48. package/dist/Downloads.mjs.map +1 -1
  49. package/dist/Errors.d.mts +3 -26
  50. package/dist/Errors.mjs +1 -137
  51. package/dist/Errors.mjs.map +1 -1
  52. package/dist/Extensions-DBXuVM1f.d.mts +43 -0
  53. package/dist/{Extensions-ClZbYb1H.mjs → Extensions-Dg3jHOf0.mjs} +3 -9
  54. package/dist/Extensions-Dg3jHOf0.mjs.map +1 -0
  55. package/dist/Extensions.d.mts +3 -44
  56. package/dist/Extensions.mjs +1 -1
  57. package/dist/Functions-CsKMMUuZ.d.mts +226 -0
  58. package/dist/Functions.d.mts +3 -227
  59. package/dist/Functions.mjs +4 -18
  60. package/dist/Functions.mjs.map +1 -1
  61. package/dist/{Launch-BHcAEq05.mjs → Launch-cAdE2rrZ.mjs} +16 -12
  62. package/dist/Launch-cAdE2rrZ.mjs.map +1 -0
  63. package/dist/Launch.d.mts +127 -2
  64. package/dist/Launch.mjs +5 -13
  65. package/dist/Launch.mjs.map +1 -1
  66. package/dist/PageFetch-CAMqb5m8.d.mts +39 -0
  67. package/dist/PageFetch.d.mts +3 -40
  68. package/dist/PageFetch.mjs +2 -8
  69. package/dist/PageFetch.mjs.map +1 -1
  70. package/dist/Projects-tm5bTDH0.d.mts +38 -0
  71. package/dist/Projects.d.mts +3 -39
  72. package/dist/Projects.mjs +2 -8
  73. package/dist/Projects.mjs.map +1 -1
  74. package/dist/Recordings-bVI33sTq.d.mts +27 -0
  75. package/dist/Recordings.d.mts +3 -28
  76. package/dist/Recordings.mjs +3 -5
  77. package/dist/Recordings.mjs.map +1 -1
  78. package/dist/{References-URDAtapt.d.mts → References-DOH3Wu44.d.mts} +5 -6
  79. package/dist/References.d.mts +3 -2
  80. package/dist/References.mjs +10 -18
  81. package/dist/References.mjs.map +1 -1
  82. package/dist/Replays-Bo-9xeLz.d.mts +27 -0
  83. package/dist/Replays.d.mts +3 -28
  84. package/dist/Replays.mjs +3 -5
  85. package/dist/Replays.mjs.map +1 -1
  86. package/dist/Search-1g6TUem7.d.mts +37 -0
  87. package/dist/Search.d.mts +3 -38
  88. package/dist/Search.mjs +2 -9
  89. package/dist/Search.mjs.map +1 -1
  90. package/dist/{SessionData-DRKcKCqw.d.mts → SessionData-5xYZDshJ.d.mts} +5 -6
  91. package/dist/SessionData.d.mts +3 -2
  92. package/dist/SessionData.mjs +1 -8
  93. package/dist/SessionData.mjs.map +1 -1
  94. package/dist/{Sessions-B8E4kMxo.d.mts → Sessions-BpZgjteE.d.mts} +8 -8
  95. package/dist/{Sessions-CtbseWEh.mjs → Sessions-suOLSym9.mjs} +34 -18
  96. package/dist/Sessions-suOLSym9.mjs.map +1 -0
  97. package/dist/Sessions.d.mts +4 -3
  98. package/dist/Sessions.mjs +1 -1
  99. package/dist/Testing.d.mts +119 -0
  100. package/dist/Testing.mjs +206 -0
  101. package/dist/Testing.mjs.map +1 -0
  102. package/dist/{Transfers-Czv5IZzJ.d.mts → Transfers-GVqzrDWl.d.mts} +22 -9
  103. package/dist/Transfers.d.mts +3 -2
  104. package/dist/Transfers.mjs +12 -28
  105. package/dist/Transfers.mjs.map +1 -1
  106. package/dist/Uploads-C2neBEpj.d.mts +28 -0
  107. package/dist/Uploads.d.mts +3 -29
  108. package/dist/Uploads.mjs +3 -5
  109. package/dist/Uploads.mjs.map +1 -1
  110. package/dist/Webhooks-BoeRAxzG.d.mts +59 -0
  111. package/dist/Webhooks.d.mts +3 -60
  112. package/dist/Webhooks.mjs +2 -11
  113. package/dist/Webhooks.mjs.map +1 -1
  114. package/dist/{WriterFacts-osvYAsIx.d.mts → WriterFacts-BBJRDZYY.d.mts} +8 -15
  115. package/dist/index.d.mts +27 -31
  116. package/dist/index.mjs +26 -31
  117. package/package.json +7 -28
  118. package/dist/Acquisition-WBafHwXH.mjs.map +0 -1
  119. package/dist/Association-CEps4hYP.mjs +0 -10
  120. package/dist/Association-CEps4hYP.mjs.map +0 -1
  121. package/dist/Bootstrap-BXuzZojd.mjs +0 -194
  122. package/dist/Bootstrap-BXuzZojd.mjs.map +0 -1
  123. package/dist/Bootstrap-m7lHgj0D.d.mts +0 -177
  124. package/dist/Bootstrap.d.mts +0 -2
  125. package/dist/Bootstrap.mjs +0 -2
  126. package/dist/Browser.mjs.map +0 -1
  127. package/dist/BrowserBinding-DlJTGYZL.mjs +0 -2508
  128. package/dist/BrowserBinding-DlJTGYZL.mjs.map +0 -1
  129. package/dist/BrowserData-LpcAuAub.d.mts +0 -369
  130. package/dist/BrowserData.d.mts +0 -2
  131. package/dist/BrowserData.mjs +0 -442
  132. package/dist/BrowserData.mjs.map +0 -1
  133. package/dist/Capture-Bc0z9IAi.mjs +0 -571
  134. package/dist/Capture-Bc0z9IAi.mjs.map +0 -1
  135. package/dist/Capture-BvWI-l1A.d.mts +0 -168
  136. package/dist/Capture.d.mts +0 -2
  137. package/dist/Capture.mjs +0 -2
  138. package/dist/Client-D1_xYM9o.mjs.map +0 -1
  139. package/dist/ContextWriter-BrQmoXRg.mjs.map +0 -1
  140. package/dist/Extensions-ClZbYb1H.mjs.map +0 -1
  141. package/dist/Images-DgscEfSf.mjs +0 -127
  142. package/dist/Images-DgscEfSf.mjs.map +0 -1
  143. package/dist/Launch-BHcAEq05.mjs.map +0 -1
  144. package/dist/Launch-C8CfaYxb.d.mts +0 -132
  145. package/dist/LocalBrowser-BLancJ3R.d.mts +0 -79
  146. package/dist/LocalBrowser-DsQLWNL1.mjs +0 -439
  147. package/dist/LocalBrowser-DsQLWNL1.mjs.map +0 -1
  148. package/dist/LocalBrowser.d.mts +0 -2
  149. package/dist/LocalBrowser.mjs +0 -2
  150. package/dist/PageControl.d.mts +0 -16
  151. package/dist/PageControl.mjs +0 -36
  152. package/dist/PageControl.mjs.map +0 -1
  153. package/dist/PageControlAssociation-DabEg5AR.mjs +0 -10
  154. package/dist/PageControlAssociation-DabEg5AR.mjs.map +0 -1
  155. package/dist/Session-D4nT9hOO.mjs +0 -1379
  156. package/dist/Session-D4nT9hOO.mjs.map +0 -1
  157. package/dist/Sessions-CtbseWEh.mjs.map +0 -1
  158. package/dist/rolldown-runtime-D7D4PA-g.mjs +0 -13
@@ -1,32 +1,3 @@
1
- import { n as ContextReference } from "./References-URDAtapt.mjs";
2
- import { ContextError } from "./Errors.mjs";
3
- import { t as BrowserbaseClient } from "./Client-Ca0zSg1n.mjs";
4
- import { Context, Effect, Layer, Schema } from "effect";
5
- declare namespace Contexts_d_exports {
6
- export { BrowserbaseContexts, ContextCreation, ContextMetadata };
7
- }
8
- declare const ContextMetadata_base: Schema.Class<ContextMetadata, Schema.Struct<{
9
- readonly reference: typeof ContextReference;
10
- readonly createdAt: Schema.String;
11
- readonly updatedAt: Schema.String;
12
- readonly name: Schema.optionalKey<Schema.String>;
13
- }>, {}>;
14
- export declare class ContextMetadata extends ContextMetadata_base {}
15
- declare const ContextCreation_base: Schema.Class<ContextCreation, Schema.Struct<{
16
- readonly reference: typeof ContextReference;
17
- }>, {}>;
18
- export declare class ContextCreation extends ContextCreation_base {}
19
- declare const BrowserbaseContexts_base: Context.ServiceClass<BrowserbaseContexts, "effect-browserbase/Contexts", {
20
- readonly create: (options?: {
21
- readonly name?: string;
22
- }) => Effect.Effect<ContextCreation, ContextError>;
23
- readonly retrieve: (reference: ContextReference) => Effect.Effect<ContextMetadata, ContextError>;
24
- readonly delete: (reference: ContextReference) => Effect.Effect<void, ContextError>;
25
- }>;
26
- /** Context administration is independent of any live browser connection. */
27
- export declare class BrowserbaseContexts extends BrowserbaseContexts_base {
28
- static readonly layer: Layer.Layer<BrowserbaseContexts, never, BrowserbaseClient>;
29
- }
30
- //#endregion
31
- export { Contexts_d_exports as t };
32
- //# sourceMappingURL=Contexts.d.mts.map
1
+ import { n as ContextCreation, r as ContextMetadata, t as BrowserbaseContexts } from "./Contexts-DqdL7cyX.mjs";
2
+ export { BrowserbaseContexts, ContextCreation, ContextMetadata };
3
+ export {};
package/dist/Contexts.mjs CHANGED
@@ -1,15 +1,9 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
1
  import { ContextReference, Identifier } from "./References.mjs";
3
2
  import { ContextError } from "./Errors.mjs";
4
- import { t as BrowserbaseClient } from "./Client-D1_xYM9o.mjs";
5
- import { n as isContextWriterBusy } from "./ContextWriter-BrQmoXRg.mjs";
3
+ import { t as BrowserbaseClient } from "./Client-4RMKIpL2.mjs";
4
+ import { n as isContextWriterBusy } from "./ContextWriter-oKWFLHuP.mjs";
6
5
  import { Context, Effect, Layer, Schema } from "effect";
7
6
  //#region src/Contexts.ts
8
- var Contexts_exports = /* @__PURE__ */ __exportAll({
9
- BrowserbaseContexts: () => BrowserbaseContexts,
10
- ContextCreation: () => ContextCreation,
11
- ContextMetadata: () => ContextMetadata
12
- });
13
7
  const Timestamp = Schema.String.check(Schema.isMaxLength(64));
14
8
  const ContextName = Schema.NonEmptyString.check(Schema.isMaxLength(1024), Schema.makeFilter((value) => value.trim().length > 0));
15
9
  const ProviderContext = Schema.Struct({
@@ -98,6 +92,6 @@ var BrowserbaseContexts = class BrowserbaseContexts extends Context.Service()("e
98
92
  }));
99
93
  };
100
94
  //#endregion
101
- export { BrowserbaseContexts, ContextCreation, ContextMetadata, Contexts_exports as t };
95
+ export { BrowserbaseContexts, ContextCreation, ContextMetadata };
102
96
 
103
97
  //# sourceMappingURL=Contexts.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Contexts.mjs","names":[],"sources":["../src/Contexts.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport type { ClientError } from \"./Errors.ts\";\nimport { ContextError } from \"./Errors.ts\";\nimport { isContextWriterBusy } from \"./internal/session/ContextWriter.ts\";\nimport { ContextReference, Identifier } from \"./References.ts\";\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\n\nconst ContextName = Schema.NonEmptyString.check(\n Schema.isMaxLength(1024),\n Schema.makeFilter((value) => value.trim().length > 0),\n);\n\nconst ProviderContext = Schema.Struct({\n id: Identifier,\n projectId: Identifier,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n name: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),\n});\n\nexport class ContextMetadata extends Schema.Class<ContextMetadata>(\"BrowserbaseContextMetadata\")({\n reference: ContextReference,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n name: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),\n}) {}\n\nexport class ContextCreation extends Schema.Class<ContextCreation>(\"BrowserbaseContextCreation\")({\n reference: ContextReference,\n}) {}\n\nconst fromClient = (operation: ContextError[\"operation\"], error: ClientError): ContextError =>\n ContextError.make({\n operation,\n reason: error.reason,\n ...(error.outcome === undefined ? {} : { outcome: error.outcome }),\n ...(error.status === undefined ? {} : { status: error.status }),\n ...(error.retryAfterMillis === undefined ? {} : { retryAfterMillis: error.retryAfterMillis }),\n });\n\nconst configuration = (operation: ContextError[\"operation\"]) =>\n ContextError.make({ operation, reason: \"configuration\", outcome: \"undispatched\" });\n\nconst malformed = (operation: ContextError[\"operation\"], mutation = false) =>\n ContextError.make({\n operation,\n reason: \"malformed\",\n ...(mutation ? { outcome: \"unknown\" as const } : {}),\n });\n\n/** Context administration is independent of any live browser connection. */\nexport class BrowserbaseContexts extends Context.Service<\n BrowserbaseContexts,\n {\n readonly create: (options?: {\n readonly name?: string;\n }) => Effect.Effect<ContextCreation, ContextError>;\n readonly retrieve: (\n reference: ContextReference,\n ) => Effect.Effect<ContextMetadata, ContextError>;\n readonly delete: (reference: ContextReference) => Effect.Effect<void, ContextError>;\n }\n>()(\"effect-browserbase/Contexts\") {\n static readonly layer: Layer.Layer<BrowserbaseContexts, never, BrowserbaseClient> = Layer.effect(\n BrowserbaseContexts,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n\n const validate = Effect.fnUntraced(function* (\n reference: ContextReference,\n operation: ContextError[\"operation\"],\n ) {\n const ref = yield* Schema.decodeEffect(ContextReference)(reference, {\n onExcessProperty: \"error\",\n }).pipe(Effect.mapError(() => configuration(operation)));\n\n if (ref.projectId !== client.projectId)\n return yield* ContextError.make({\n operation,\n reason: \"authorization\",\n outcome: \"undispatched\",\n });\n\n return ref;\n });\n\n const create = Effect.fn(\"BrowserbaseContexts.create\")(function* (\n options: { readonly name?: string } = {},\n ) {\n const value = yield* Schema.decodeEffect(\n Schema.Struct({ name: Schema.optionalKey(ContextName) }),\n )(options, { onExcessProperty: \"error\" }).pipe(\n Effect.mapError(() => configuration(\"context-create\")),\n );\n\n const raw = yield* client\n .json(\"POST\", \"/v1/contexts\", {\n projectId: client.projectId,\n ...(value.name === undefined ? {} : { name: value.name.trim() }),\n })\n .pipe(Effect.mapError((error) => fromClient(\"context-create\", error)));\n\n const created = yield* Schema.decodeUnknownEffect(Schema.Struct({ id: Identifier }))(\n raw,\n ).pipe(Effect.mapError(() => malformed(\"context-create\", true)));\n\n return ContextCreation.make({\n reference: ContextReference.make({\n provider: \"browserbase\",\n projectId: client.projectId,\n contextId: created.id,\n }),\n });\n });\n\n const retrieve = Effect.fn(\"BrowserbaseContexts.retrieve\")(function* (\n reference: ContextReference,\n ) {\n const ref = yield* validate(reference, \"context-retrieve\");\n\n const raw = yield* client\n .json(\"GET\", `/v1/contexts/${encodeURIComponent(ref.contextId)}`)\n .pipe(Effect.mapError((error) => fromClient(\"context-retrieve\", error)));\n\n const value = yield* Schema.decodeUnknownEffect(ProviderContext)(raw).pipe(\n Effect.mapError(() => malformed(\"context-retrieve\")),\n );\n\n if (value.id !== ref.contextId || value.projectId !== ref.projectId)\n return yield* malformed(\"context-retrieve\");\n\n return ContextMetadata.make({\n reference: ref,\n createdAt: value.createdAt,\n updatedAt: value.updatedAt,\n ...(value.name === undefined ? {} : { name: value.name }),\n });\n });\n\n const remove = Effect.fn(\"BrowserbaseContexts.delete\")(function* (\n reference: ContextReference,\n ) {\n const ref = yield* validate(reference, \"context-delete\");\n\n if (isContextWriterBusy(ref))\n return yield* ContextError.make({\n operation: \"context-delete\",\n reason: \"active\",\n outcome: \"undispatched\",\n });\n yield* client\n .noContent(\"DELETE\", `/v1/contexts/${encodeURIComponent(ref.contextId)}`)\n .pipe(Effect.mapError((error) => fromClient(\"context-delete\", error)));\n });\n\n return BrowserbaseContexts.of({ create, retrieve, delete: remove });\n }),\n );\n}\n"],"mappings":";;;;;;;;;;;;AAQA,MAAM,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC;AAE5D,MAAM,cAAc,OAAO,eAAe,MACxC,OAAO,YAAY,IAAI,GACvB,OAAO,YAAY,UAAU,MAAM,KAAK,CAAC,CAAC,SAAS,CAAC,CACtD;AAEA,MAAM,kBAAkB,OAAO,OAAO;CACpC,IAAI;CACJ,WAAW;CACX,WAAW;CACX,WAAW;CACX,MAAM,OAAO,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,IAAI,CAAC,CAAC;AACxE,CAAC;AAED,IAAa,kBAAb,cAAqC,OAAO,MAAuB,4BAA4B,CAAC,CAAC;CAC/F,WAAW;CACX,WAAW;CACX,WAAW;CACX,MAAM,OAAO,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,IAAI,CAAC,CAAC;AACxE,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,kBAAb,cAAqC,OAAO,MAAu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M,MAAM,KAAK;GACzD,CAAC;EACH,CAAC;EAED,MAAM,SAAS,OAAO,GAAG,4BAA4B,CAAC,CAAC,WACrD,WACA;GACA,MAAM,MAAM,OAAO,SAAS,WAAW,gBAAgB;GAEvD,IAAI,oBAAoB,GAAG,GACzB,OAAO,OAAO,aAAa,KAAK;IAC9B,WAAW;IACX,QAAQ;IACR,SAAS;GACX,CAAC;GACH,OAAO,OACJ,UAAU,UAAU,gBAAgB,mBAAmB,IAAI,SAAS,GAAG,CAAC,CACxE,KAAK,OAAO,UAAU,UAAU,WAAW,kBAAkB,KAAK,CAAC,CAAC;EACzE,CAAC;EAED,OAAO,oBAAoB,GAAG;GAAE;GAAQ;GAAU,QAAQ;EAAO,CAAC;CACpE,CAAC,CACH;AACF"}
1
+ {"version":3,"file":"Contexts.mjs","names":[],"sources":["../src/Contexts.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { type ClientError, ContextError } from \"./Errors.ts\";\nimport { isContextWriterBusy } from \"./internal/session/ContextWriter.ts\";\nimport { ContextReference, Identifier } from \"./References.ts\";\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\n\nconst ContextName = Schema.NonEmptyString.check(\n Schema.isMaxLength(1024),\n Schema.makeFilter((value) => value.trim().length > 0),\n);\n\nconst ProviderContext = Schema.Struct({\n id: Identifier,\n projectId: Identifier,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n name: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),\n});\n\nexport class ContextMetadata extends Schema.Class<ContextMetadata>(\"BrowserbaseContextMetadata\")({\n reference: ContextReference,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n name: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),\n}) {}\n\nexport class ContextCreation extends Schema.Class<ContextCreation>(\"BrowserbaseContextCreation\")({\n reference: ContextReference,\n}) {}\n\nconst fromClient = (operation: ContextError[\"operation\"], error: ClientError): ContextError =>\n ContextError.make({\n operation,\n reason: error.reason,\n ...(error.outcome === undefined ? {} : { outcome: error.outcome }),\n ...(error.status === undefined ? {} : { status: error.status }),\n ...(error.retryAfterMillis === undefined ? {} : { retryAfterMillis: error.retryAfterMillis }),\n });\n\nconst configuration = (operation: ContextError[\"operation\"]) =>\n ContextError.make({ operation, reason: \"configuration\", outcome: \"undispatched\" });\n\nconst malformed = (operation: ContextError[\"operation\"], mutation = false) =>\n ContextError.make({\n operation,\n reason: \"malformed\",\n ...(mutation ? { outcome: \"unknown\" as const } : {}),\n });\n\n/** Context administration is independent of any live browser connection. */\nexport class BrowserbaseContexts extends Context.Service<\n BrowserbaseContexts,\n {\n readonly create: (options?: {\n readonly name?: string;\n }) => Effect.Effect<ContextCreation, ContextError>;\n readonly retrieve: (\n reference: ContextReference,\n ) => Effect.Effect<ContextMetadata, ContextError>;\n readonly delete: (reference: ContextReference) => Effect.Effect<void, ContextError>;\n }\n>()(\"effect-browserbase/Contexts\") {\n static readonly layer: Layer.Layer<BrowserbaseContexts, never, BrowserbaseClient> = Layer.effect(\n BrowserbaseContexts,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n\n const validate = Effect.fnUntraced(function* (\n reference: ContextReference,\n operation: ContextError[\"operation\"],\n ) {\n const ref = yield* Schema.decodeEffect(ContextReference)(reference, {\n onExcessProperty: \"error\",\n }).pipe(Effect.mapError(() => configuration(operation)));\n\n if (ref.projectId !== client.projectId)\n return yield* ContextError.make({\n operation,\n reason: \"authorization\",\n outcome: \"undispatched\",\n });\n\n return ref;\n });\n\n const create = Effect.fn(\"BrowserbaseContexts.create\")(function* (\n options: { readonly name?: string } = {},\n ) {\n const value = yield* Schema.decodeEffect(\n Schema.Struct({ name: Schema.optionalKey(ContextName) }),\n )(options, { onExcessProperty: \"error\" }).pipe(\n Effect.mapError(() => configuration(\"context-create\")),\n );\n\n const raw = yield* client\n .json(\"POST\", \"/v1/contexts\", {\n projectId: client.projectId,\n ...(value.name === undefined ? {} : { name: value.name.trim() }),\n })\n .pipe(Effect.mapError((error) => fromClient(\"context-create\", error)));\n\n const created = yield* Schema.decodeUnknownEffect(Schema.Struct({ id: Identifier }))(\n raw,\n ).pipe(Effect.mapError(() => malformed(\"context-create\", true)));\n\n return ContextCreation.make({\n reference: ContextReference.make({\n provider: \"browserbase\",\n projectId: client.projectId,\n contextId: created.id,\n }),\n });\n });\n\n const retrieve = Effect.fn(\"BrowserbaseContexts.retrieve\")(function* (\n reference: ContextReference,\n ) {\n const ref = yield* validate(reference, \"context-retrieve\");\n\n const raw = yield* client\n .json(\"GET\", `/v1/contexts/${encodeURIComponent(ref.contextId)}`)\n .pipe(Effect.mapError((error) => fromClient(\"context-retrieve\", error)));\n\n const value = yield* Schema.decodeUnknownEffect(ProviderContext)(raw).pipe(\n Effect.mapError(() => malformed(\"context-retrieve\")),\n );\n\n if (value.id !== ref.contextId || value.projectId !== ref.projectId)\n return yield* malformed(\"context-retrieve\");\n\n return ContextMetadata.make({\n reference: ref,\n createdAt: value.createdAt,\n updatedAt: value.updatedAt,\n ...(value.name === undefined ? {} : { name: value.name }),\n });\n });\n\n const remove = Effect.fn(\"BrowserbaseContexts.delete\")(function* (\n reference: ContextReference,\n ) {\n const ref = yield* validate(reference, \"context-delete\");\n\n if (isContextWriterBusy(ref))\n return yield* ContextError.make({\n operation: \"context-delete\",\n reason: \"active\",\n outcome: \"undispatched\",\n });\n yield* client\n .noContent(\"DELETE\", `/v1/contexts/${encodeURIComponent(ref.contextId)}`)\n .pipe(Effect.mapError((error) => fromClient(\"context-delete\", error)));\n });\n\n return BrowserbaseContexts.of({ create, retrieve, delete: remove });\n }),\n );\n}\n"],"mappings":";;;;;;AAOA,MAAM,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC;AAE5D,MAAM,cAAc,OAAO,eAAe,MACxC,OAAO,YAAY,IAAI,GACvB,OAAO,YAAY,UAAU,MAAM,KAAK,CAAC,CAAC,SAAS,CAAC,CAC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KAAK,OAAO,UAAU,UAAU,WAAW,oBAAoB,KAAK,CAAC,CAAC;GAEzE,MAAM,QAAQ,OAAO,OAAO,oBAAoB,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,KACpE,OAAO,eAAe,UAAU,kBAAkB,CAAC,CACrD;GAEA,IAAI,MAAM,OAAO,IAAI,aAAa,MAAM,cAAc,IAAI,WACxD,OAAO,OAAO,UAAU,kBAAkB;GAE5C,OAAO,gBAAgB,KAAK;IAC1B,WAAW;IACX,WAAW,MAAM;IACjB,WAAW,MAAM;IACjB,GAAI,MAAM,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,MAAM,KAAK;GACzD,CAAC;EACH,CAAC;EAED,MAAM,SAAS,OAAO,GAAG,4BAA4B,CAAC,CAAC,WACrD,WACA;GACA,MAAM,MAAM,OAAO,SAAS,WAAW,gBAAgB;GAEvD,IAAI,oBAAoB,GAAG,GACzB,OAAO,OAAO,aAAa,KAAK;IAC9B,WAAW;IACX,QAAQ;IACR,SAAS;GACX,CAAC;GACH,OAAO,OACJ,UAAU,UAAU,gBAAgB,mBAAmB,IAAI,SAAS,GAAG,CAAC,CACxE,KAAK,OAAO,UAAU,UAAU,WAAW,kBAAkB,KAAK,CAAC,CAAC;EACzE,CAAC;EAED,OAAO,oBAAoB,GAAG;GAAE;GAAQ;GAAU,QAAQ;EAAO,CAAC;CACpE,CAAC,CACH;AACF"}
@@ -0,0 +1,43 @@
1
+ import { a as SessionReference } from "./References-DOH3Wu44.mjs";
2
+ import { FileError } from "./Errors.mjs";
3
+ import { t as BrowserbaseClient } from "./Client-B_f6bBLT.mjs";
4
+ import { t as BrowserbaseSessions } from "./Sessions-BpZgjteE.mjs";
5
+ import { n as DownloadMetadata, t as ArtifactTransferPolicy } from "./Transfers-GVqzrDWl.mjs";
6
+ import { Context, Effect, Layer, Schema, Stream } from "effect";
7
+ //#region src/Downloads.d.ts
8
+ interface DownloadPolicy extends ArtifactTransferPolicy {
9
+ readonly mimeTypes: ReadonlyArray<string>;
10
+ }
11
+ interface DownloadListing {
12
+ readonly downloads: ReadonlyArray<DownloadMetadata>;
13
+ readonly total: number;
14
+ readonly offset: number;
15
+ readonly complete: boolean;
16
+ }
17
+ /** Provider-side filters over one session's files; every bound is optional. */
18
+ declare const DownloadQuery: Schema.Struct<{
19
+ readonly offset: Schema.optionalKey<Schema.Int>;
20
+ readonly filename: Schema.optionalKey<Schema.NonEmptyString>;
21
+ readonly mimeType: Schema.optionalKey<Schema.NonEmptyString>;
22
+ readonly minSize: Schema.optionalKey<Schema.Natural>;
23
+ readonly maxSize: Schema.optionalKey<Schema.Natural>;
24
+ readonly createdAfter: Schema.optionalKey<Schema.String>;
25
+ readonly createdBefore: Schema.optionalKey<Schema.String>;
26
+ }>;
27
+ type DownloadQuery = typeof DownloadQuery.Type;
28
+ declare const BrowserbaseDownloads_base: Context.ServiceClass<BrowserbaseDownloads, "effect-browserbase/Downloads", {
29
+ readonly list: (reference: SessionReference, query?: DownloadQuery) => Effect.Effect<DownloadListing, FileError>;
30
+ readonly metadata: (reference: SessionReference, downloadId: string) => Effect.Effect<DownloadMetadata, FileError>;
31
+ readonly stream: (reference: SessionReference, downloadId: string, policy: DownloadPolicy) => Stream.Stream<Uint8Array, FileError>;
32
+ /** Deletes one stored file. A lost reply is `outcome: "unknown"` and is never retried. */
33
+ readonly delete: (reference: SessionReference, downloadId: string) => Effect.Effect<void, FileError>;
34
+ readonly waitForNew: (reference: SessionReference, previousIds: ReadonlyArray<string>, timeoutMillis?: number) => Effect.Effect<ReadonlyArray<DownloadMetadata>, FileError>;
35
+ }>;
36
+ /** Website files are not session-recording MP4s. They retain their own provider download ID. */
37
+ declare class BrowserbaseDownloads extends BrowserbaseDownloads_base {
38
+ static readonly layer: Layer.Layer<BrowserbaseDownloads, never, BrowserbaseClient | BrowserbaseSessions>;
39
+ }
40
+ //#endregion
41
+ export { DownloadQuery as i, DownloadListing as n, DownloadPolicy as r, BrowserbaseDownloads as t };
42
+ export {};
43
+ //# sourceMappingURL=Downloads-CdhiCO5X.d.mts.map
@@ -1,44 +1,3 @@
1
- import { o as SessionReference } from "./References-URDAtapt.mjs";
2
- import { FileError } from "./Errors.mjs";
3
- import { t as BrowserbaseClient } from "./Client-Ca0zSg1n.mjs";
4
- import { t as BrowserbaseSessions } from "./Sessions-B8E4kMxo.mjs";
5
- import { n as DownloadMetadata, t as ArtifactTransferPolicy } from "./Transfers-Czv5IZzJ.mjs";
6
- import { Context, Effect, Layer, Schema, Stream } from "effect";
7
- declare namespace Downloads_d_exports {
8
- export { BrowserbaseDownloads, DownloadListing, DownloadPolicy, DownloadQuery };
9
- }
10
- export interface DownloadPolicy extends ArtifactTransferPolicy {
11
- readonly mimeTypes: ReadonlyArray<string>;
12
- }
13
- export interface DownloadListing {
14
- readonly downloads: ReadonlyArray<DownloadMetadata>;
15
- readonly total: number;
16
- readonly offset: number;
17
- readonly complete: boolean;
18
- }
19
- /** Provider-side filters over one session's files; every bound is optional. */
20
- export declare const DownloadQuery: Schema.Struct<{
21
- readonly offset: Schema.optionalKey<Schema.Int>;
22
- readonly filename: Schema.optionalKey<Schema.NonEmptyString>;
23
- readonly mimeType: Schema.optionalKey<Schema.NonEmptyString>;
24
- readonly minSize: Schema.optionalKey<Schema.Natural>;
25
- readonly maxSize: Schema.optionalKey<Schema.Natural>;
26
- readonly createdAfter: Schema.optionalKey<Schema.String>;
27
- readonly createdBefore: Schema.optionalKey<Schema.String>;
28
- }>;
29
- export type DownloadQuery = typeof DownloadQuery.Type;
30
- declare const BrowserbaseDownloads_base: Context.ServiceClass<BrowserbaseDownloads, "effect-browserbase/Downloads", {
31
- readonly list: (reference: SessionReference, query?: DownloadQuery) => Effect.Effect<DownloadListing, FileError>;
32
- readonly metadata: (reference: SessionReference, downloadId: string) => Effect.Effect<DownloadMetadata, FileError>;
33
- readonly stream: (reference: SessionReference, downloadId: string, policy: DownloadPolicy) => Stream.Stream<Uint8Array, FileError>;
34
- /** Deletes one stored file. A lost reply is `outcome: "unknown"` and is never retried. */
35
- readonly delete: (reference: SessionReference, downloadId: string) => Effect.Effect<void, FileError>;
36
- readonly waitForNew: (reference: SessionReference, previousIds: ReadonlyArray<string>, timeoutMillis?: number) => Effect.Effect<ReadonlyArray<DownloadMetadata>, FileError>;
37
- }>;
38
- /** Website files are not session-recording MP4s. They retain their own provider download ID. */
39
- export declare class BrowserbaseDownloads extends BrowserbaseDownloads_base {
40
- static readonly layer: Layer.Layer<BrowserbaseDownloads, never, BrowserbaseClient | BrowserbaseSessions>;
41
- }
42
- //#endregion
43
- export { Downloads_d_exports as t };
44
- //# sourceMappingURL=Downloads.d.mts.map
1
+ import { i as DownloadQuery, n as DownloadListing, r as DownloadPolicy, t as BrowserbaseDownloads } from "./Downloads-CdhiCO5X.mjs";
2
+ export { BrowserbaseDownloads, DownloadListing, DownloadPolicy, DownloadQuery };
3
+ export {};
@@ -1,17 +1,12 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
1
  import { Identifier } from "./References.mjs";
3
2
  import { FileError } from "./Errors.mjs";
4
3
  import { DownloadMetadata } from "./Transfers.mjs";
5
- import { t as BrowserbaseClient } from "./Client-D1_xYM9o.mjs";
4
+ import { t as BrowserbaseClient } from "./Client-4RMKIpL2.mjs";
6
5
  import { t as downloadTransferPolicy } from "./TransferPolicy-DQ06i7SZ.mjs";
7
6
  import { n as nowMillis, r as until, t as deadlineAfter } from "./Deadline-CrViaogr.mjs";
8
- import { t as BrowserbaseSessions } from "./Sessions-CtbseWEh.mjs";
7
+ import { t as BrowserbaseSessions } from "./Sessions-suOLSym9.mjs";
9
8
  import { Context, Effect, Layer, Schema, Stream } from "effect";
10
9
  //#region src/Downloads.ts
11
- var Downloads_exports = /* @__PURE__ */ __exportAll({
12
- BrowserbaseDownloads: () => BrowserbaseDownloads,
13
- DownloadQuery: () => DownloadQuery
14
- });
15
10
  const Timestamp = Schema.String.check(Schema.isMaxLength(64));
16
11
  /** Provider-side filters over one session's files; every bound is optional. */
17
12
  const DownloadQuery = Schema.Struct({
@@ -137,6 +132,6 @@ var BrowserbaseDownloads = class BrowserbaseDownloads extends Context.Service()(
137
132
  }));
138
133
  };
139
134
  //#endregion
140
- export { BrowserbaseDownloads, DownloadQuery, Downloads_exports as t };
135
+ export { BrowserbaseDownloads, DownloadQuery };
141
136
 
142
137
  //# sourceMappingURL=Downloads.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Downloads.mjs","names":[],"sources":["../src/Downloads.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema, Stream } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { type ClientError, FileError } from \"./Errors.ts\";\nimport { downloadTransferPolicy } from \"./internal/artifact/TransferPolicy.ts\";\nimport { deadlineAfter, nowMillis, until } from \"./internal/Deadline.ts\";\nimport { Identifier, type SessionReference } from \"./References.ts\";\nimport { BrowserbaseSessions } from \"./Sessions.ts\";\nimport { type ArtifactTransferPolicy, DownloadMetadata } from \"./Transfers.ts\";\n\nexport interface DownloadPolicy extends ArtifactTransferPolicy {\n readonly mimeTypes: ReadonlyArray<string>;\n}\n\nexport interface DownloadListing {\n readonly downloads: ReadonlyArray<DownloadMetadata>;\n readonly total: number;\n readonly offset: number;\n readonly complete: boolean;\n}\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\n\n/** Provider-side filters over one session's files; every bound is optional. */\nexport const DownloadQuery = Schema.Struct({\n offset: Schema.optionalKey(Schema.Int.check(Schema.isBetween({ minimum: 0, maximum: 10_000 }))),\n filename: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1024))),\n mimeType: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(256))),\n minSize: Schema.optionalKey(Schema.Natural),\n maxSize: Schema.optionalKey(Schema.Natural),\n createdAfter: Schema.optionalKey(Timestamp),\n createdBefore: Schema.optionalKey(Timestamp),\n});\n\nexport type DownloadQuery = typeof DownloadQuery.Type;\n\nconst Listing = Schema.Struct({\n downloads: Schema.Array(DownloadMetadata).check(Schema.isMaxLength(100)),\n total: Schema.Natural,\n});\n\nconst failure = (operation: FileError[\"operation\"], reason: FileError[\"reason\"]) =>\n FileError.make({ operation, reason });\n\nconst fromClient = (operation: FileError[\"operation\"]) => (error: ClientError) =>\n FileError.make({\n operation,\n reason: error.reason,\n ...(error.outcome === undefined ? {} : { outcome: error.outcome }),\n ...(error.status === undefined ? {} : { status: error.status }),\n ...(error.retryAfterMillis === undefined ? {} : { retryAfterMillis: error.retryAfterMillis }),\n });\n\nconst within = <A, E, R>(\n effect: Effect.Effect<A, E, R>,\n deadline: number,\n operation: FileError[\"operation\"],\n) => until(effect, deadline, () => failure(operation, \"timeout\"));\n\n/** Website files are not session-recording MP4s. They retain their own provider download ID. */\nexport class BrowserbaseDownloads extends Context.Service<\n BrowserbaseDownloads,\n {\n readonly list: (\n reference: SessionReference,\n query?: DownloadQuery,\n ) => Effect.Effect<DownloadListing, FileError>;\n readonly metadata: (\n reference: SessionReference,\n downloadId: string,\n ) => Effect.Effect<DownloadMetadata, FileError>;\n readonly stream: (\n reference: SessionReference,\n downloadId: string,\n policy: DownloadPolicy,\n ) => Stream.Stream<Uint8Array, FileError>;\n /** Deletes one stored file. A lost reply is `outcome: \"unknown\"` and is never retried. */\n readonly delete: (\n reference: SessionReference,\n downloadId: string,\n ) => Effect.Effect<void, FileError>;\n readonly waitForNew: (\n reference: SessionReference,\n previousIds: ReadonlyArray<string>,\n timeoutMillis?: number,\n ) => Effect.Effect<ReadonlyArray<DownloadMetadata>, FileError>;\n }\n>()(\"effect-browserbase/Downloads\") {\n static readonly layer: Layer.Layer<\n BrowserbaseDownloads,\n never,\n BrowserbaseClient | BrowserbaseSessions\n > = Layer.effect(\n BrowserbaseDownloads,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n const sessions = yield* BrowserbaseSessions;\n\n // Files are readable while the session runs; only the exact owning session is admitted.\n const owned = (ref: SessionReference, operation: FileError[\"operation\"]) =>\n sessions.retrieve(ref).pipe(\n Effect.mapError((error) => FileError.make({ operation, reason: error.reason })),\n Effect.asVoid,\n );\n\n const list = Effect.fnUntraced(function* (ref: SessionReference, query: DownloadQuery = {}) {\n const checked = yield* Schema.decodeEffect(DownloadQuery)(query, {\n onExcessProperty: \"error\",\n }).pipe(Effect.mapError(() => failure(\"downloads-list\", \"configuration\")));\n\n const offset = checked.offset ?? 0;\n\n yield* owned(ref, \"downloads-list\");\n\n const search = new URLSearchParams({\n sessionId: ref.sessionId,\n limit: \"100\",\n offset: String(offset),\n });\n\n for (const key of [\n \"filename\",\n \"mimeType\",\n \"minSize\",\n \"maxSize\",\n \"createdAfter\",\n \"createdBefore\",\n ] as const) {\n const value = checked[key];\n\n if (value !== undefined) search.set(key, String(value));\n }\n\n const raw = yield* client.json(\"GET\", `/v1/downloads?${search}`).pipe(\n Effect.mapError(fromClient(\"downloads-list\")),\n Effect.flatMap((value) =>\n Schema.decodeUnknownEffect(Listing)(value).pipe(\n Effect.mapError(() => failure(\"downloads-list\", \"malformed\")),\n ),\n ),\n );\n\n if (\n raw.downloads.some((entry) => entry.sessionId !== ref.sessionId) ||\n new Set(raw.downloads.map((entry) => entry.id)).size !== raw.downloads.length\n ) {\n return yield* failure(\"downloads-list\", \"malformed\");\n }\n\n return { ...raw, offset, complete: offset + raw.downloads.length >= raw.total };\n });\n\n const metadata = Effect.fnUntraced(function* (ref: SessionReference, id: string) {\n yield* Schema.decodeEffect(Identifier)(id).pipe(\n Effect.mapError(() => failure(\"download-metadata\", \"configuration\")),\n );\n\n yield* owned(ref, \"download-metadata\");\n\n const value = yield* client.json(\"GET\", `/v1/downloads/${encodeURIComponent(id)}`).pipe(\n Effect.mapError(fromClient(\"download-metadata\")),\n Effect.flatMap((raw) =>\n Schema.decodeUnknownEffect(DownloadMetadata)(raw).pipe(\n Effect.mapError(() => failure(\"download-metadata\", \"malformed\")),\n ),\n ),\n );\n\n if (value.id !== id || value.sessionId !== ref.sessionId)\n return yield* failure(\"download-metadata\", \"malformed\");\n\n return value;\n });\n\n const stream = (ref: SessionReference, id: string, policy: DownloadPolicy) =>\n Stream.unwrap(\n Effect.gen(function* () {\n const { maxBytes, timeoutMillis, mimeTypes } = yield* downloadTransferPolicy(\n policy,\n () => failure(\"download\", \"configuration\"),\n );\n\n const deadline = yield* deadlineAfter(timeoutMillis);\n const file = yield* within(metadata(ref, id), deadline, \"download\");\n\n if (!mimeTypes.includes(file.mimeType.toLowerCase()))\n return yield* failure(\"download\", \"content-type\");\n if (file.size > maxBytes) return yield* failure(\"download\", \"limit\");\n let received = 0;\n\n return client\n .bytes(\n `/v1/downloads/${encodeURIComponent(id)}`,\n maxBytes,\n [\"application/octet-stream\", file.mimeType.toLowerCase()],\n timeoutMillis,\n deadline,\n )\n .pipe(\n Stream.mapError(fromClient(\"download\")),\n Stream.tap((chunk) =>\n Effect.sync(() => {\n received += chunk.byteLength;\n }),\n ),\n Stream.concat(\n Stream.fromEffect(\n Effect.suspend(() =>\n received === file.size\n ? Effect.void\n : Effect.fail(failure(\"download\", \"malformed\")),\n ),\n ).pipe(Stream.drain),\n ),\n );\n }),\n );\n\n const waitForNew = Effect.fnUntraced(function* (\n ref: SessionReference,\n previousIds: ReadonlyArray<string>,\n timeoutMillis = 30_000,\n ) {\n if (\n previousIds.length > 10_000 ||\n !Number.isSafeInteger(timeoutMillis) ||\n timeoutMillis < 1 ||\n timeoutMillis > 300_000\n ) {\n return yield* failure(\"download-wait\", \"configuration\");\n }\n const previous = new Set(previousIds);\n const deadline = yield* deadlineAfter(timeoutMillis);\n\n do {\n const result = yield* within(list(ref), deadline, \"download-wait\");\n\n // Never claim a complete candidate set from a partial listing.\n if (!result.complete) return yield* failure(\"download-wait\", \"limit\");\n const fresh = result.downloads.filter((entry) => !previous.has(entry.id));\n\n if (fresh.length > 0) return fresh;\n const remaining = deadline - (yield* nowMillis);\n\n if (remaining <= 0) break;\n yield* Effect.sleep(Math.min(500, remaining));\n } while ((yield* nowMillis) < deadline);\n\n return yield* failure(\"download-wait\", \"timeout\");\n });\n\n const remove = Effect.fnUntraced(function* (ref: SessionReference, id: string) {\n yield* Schema.decodeEffect(Identifier)(id).pipe(\n Effect.mapError(() =>\n FileError.make({\n operation: \"download-delete\",\n reason: \"configuration\",\n outcome: \"undispatched\",\n }),\n ),\n );\n\n // Ownership is proved by reading the file's session before any mutation.\n yield* metadata(ref, id).pipe(\n Effect.mapError((error) =>\n FileError.make({\n operation: \"download-delete\",\n reason: error.reason,\n outcome: \"undispatched\",\n ...(error.status === undefined ? {} : { status: error.status }),\n ...(error.retryAfterMillis === undefined\n ? {}\n : { retryAfterMillis: error.retryAfterMillis }),\n }),\n ),\n );\n\n yield* client\n .noContent(\"DELETE\", `/v1/downloads/${encodeURIComponent(id)}`)\n .pipe(Effect.mapError(fromClient(\"download-delete\")));\n });\n\n return BrowserbaseDownloads.of({ list, metadata, stream, waitForNew, delete: remove });\n }),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,MAAM,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC;;AAG5D,MAAa,gBAAgB,OAAO,OAAO;CACzC,QAAQ,OAAO,YAAY,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAAS;EAAG,SAAS;CAAO,CAAC,CAAC,CAAC;CAC9F,UAAU,OAAO,YAAY,OAAO,eAAe,MAAM,OAAO,YAAY,IAAI,CAAC,CAAC;CAClF,UAAU,OAAO,YAAY,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC,CAAC;CACjF,SAAS,OAAO,YAAY,OAAO,OAAO;CAC1C,SAAS,OAAO,YAAY,OAAO,OAAO;CAC1C,cAAc,OAAO,YAAY,SAAS;CAC1C,eAAe,OAAO,YAAY,SAAS;AAC7C,CAAC;AAID,MAAM,UAAU,OAAO,OAAO;CAC5B,WAAW,OAAO,MAAM,gBAAgB,CAAC,CAAC,MAAM,OAAO,YAAY,GAAG,CAAC;CACvE,OAAO,OAAO;AAChB,CAAC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,SAAS,IAAI,MAAM,EAAE,CAAC;IAExE,IAAI,MAAM,SAAS,GAAG,OAAO;IAC7B,MAAM,YAAY,YAAY,OAAO;IAErC,IAAI,aAAa,GAAG;IACpB,OAAO,OAAO,MAAM,KAAK,IAAI,KAAK,SAAS,CAAC;GAC9C,UAAU,OAAO,aAAa;GAE9B,OAAO,OAAO,QAAQ,iBAAiB,SAAS;EAClD,CAAC;EAED,MAAM,SAAS,OAAO,WAAW,WAAW,KAAuB,IAAY;GAC7E,OAAO,OAAO,aAAa,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,KACzC,OAAO,eACL,UAAU,KAAK;IACb,WAAW;IACX,QAAQ;IACR,SAAS;GACX,CAAC,CACH,CACF;GAGA,OAAO,SAAS,KAAK,EAAE,CAAC,CAAC,KACvB,OAAO,UAAU,UACf,UAAU,KAAK;IACb,WAAW;IACX,QAAQ,MAAM;IACd,SAAS;IACT,GAAI,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;IAC7D,GAAI,MAAM,qBAAqB,KAAA,IAC3B,CAAC,IACD,EAAE,kBAAkB,MAAM,iBAAiB;GACjD,CAAC,CACH,CACF;GAEA,OAAO,OACJ,UAAU,UAAU,iBAAiB,mBAAmB,EAAE,GAAG,CAAC,CAC9D,KAAK,OAAO,SAAS,WAAW,iBAAiB,CAAC,CAAC;EACxD,CAAC;EAED,OAAO,qBAAqB,GAAG;GAAE;GAAM;GAAU;GAAQ;GAAY,QAAQ;EAAO,CAAC;CACvF,CAAC,CACH;AACF"}
1
+ {"version":3,"file":"Downloads.mjs","names":[],"sources":["../src/Downloads.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema, Stream } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { type ClientError, FileError } from \"./Errors.ts\";\nimport { downloadTransferPolicy } from \"./internal/artifact/TransferPolicy.ts\";\nimport { deadlineAfter, nowMillis, until } from \"./internal/Deadline.ts\";\nimport { Identifier, type SessionReference } from \"./References.ts\";\nimport { BrowserbaseSessions } from \"./Sessions.ts\";\nimport { type ArtifactTransferPolicy, DownloadMetadata } from \"./Transfers.ts\";\n\nexport interface DownloadPolicy extends ArtifactTransferPolicy {\n readonly mimeTypes: ReadonlyArray<string>;\n}\n\nexport interface DownloadListing {\n readonly downloads: ReadonlyArray<DownloadMetadata>;\n readonly total: number;\n readonly offset: number;\n readonly complete: boolean;\n}\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\n\n/** Provider-side filters over one session's files; every bound is optional. */\nexport const DownloadQuery = Schema.Struct({\n offset: Schema.optionalKey(Schema.Int.check(Schema.isBetween({ minimum: 0, maximum: 10_000 }))),\n filename: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1024))),\n mimeType: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(256))),\n minSize: Schema.optionalKey(Schema.Natural),\n maxSize: Schema.optionalKey(Schema.Natural),\n createdAfter: Schema.optionalKey(Timestamp),\n createdBefore: Schema.optionalKey(Timestamp),\n});\n\nexport type DownloadQuery = typeof DownloadQuery.Type;\n\nconst Listing = Schema.Struct({\n downloads: Schema.Array(DownloadMetadata).check(Schema.isMaxLength(100)),\n total: Schema.Natural,\n});\n\nconst failure = (operation: FileError[\"operation\"], reason: FileError[\"reason\"]) =>\n FileError.make({ operation, reason });\n\nconst fromClient = (operation: FileError[\"operation\"]) => (error: ClientError) =>\n FileError.make({\n operation,\n reason: error.reason,\n ...(error.outcome === undefined ? {} : { outcome: error.outcome }),\n ...(error.status === undefined ? {} : { status: error.status }),\n ...(error.retryAfterMillis === undefined ? {} : { retryAfterMillis: error.retryAfterMillis }),\n });\n\nconst within = <A, E, R>(\n effect: Effect.Effect<A, E, R>,\n deadline: number,\n operation: FileError[\"operation\"],\n) => until(effect, deadline, () => failure(operation, \"timeout\"));\n\n/** Website files are not session-recording MP4s. They retain their own provider download ID. */\nexport class BrowserbaseDownloads extends Context.Service<\n BrowserbaseDownloads,\n {\n readonly list: (\n reference: SessionReference,\n query?: DownloadQuery,\n ) => Effect.Effect<DownloadListing, FileError>;\n readonly metadata: (\n reference: SessionReference,\n downloadId: string,\n ) => Effect.Effect<DownloadMetadata, FileError>;\n readonly stream: (\n reference: SessionReference,\n downloadId: string,\n policy: DownloadPolicy,\n ) => Stream.Stream<Uint8Array, FileError>;\n /** Deletes one stored file. A lost reply is `outcome: \"unknown\"` and is never retried. */\n readonly delete: (\n reference: SessionReference,\n downloadId: string,\n ) => Effect.Effect<void, FileError>;\n readonly waitForNew: (\n reference: SessionReference,\n previousIds: ReadonlyArray<string>,\n timeoutMillis?: number,\n ) => Effect.Effect<ReadonlyArray<DownloadMetadata>, FileError>;\n }\n>()(\"effect-browserbase/Downloads\") {\n static readonly layer: Layer.Layer<\n BrowserbaseDownloads,\n never,\n BrowserbaseClient | BrowserbaseSessions\n > = Layer.effect(\n BrowserbaseDownloads,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n const sessions = yield* BrowserbaseSessions;\n\n // Files are readable while the session runs; only the exact owning session is admitted.\n const owned = (ref: SessionReference, operation: FileError[\"operation\"]) =>\n sessions.retrieve(ref).pipe(\n Effect.mapError((error) => FileError.make({ operation, reason: error.reason })),\n Effect.asVoid,\n );\n\n const list = Effect.fnUntraced(function* (ref: SessionReference, query: DownloadQuery = {}) {\n const checked = yield* Schema.decodeEffect(DownloadQuery)(query, {\n onExcessProperty: \"error\",\n }).pipe(Effect.mapError(() => failure(\"downloads-list\", \"configuration\")));\n\n const offset = checked.offset ?? 0;\n\n yield* owned(ref, \"downloads-list\");\n\n const search = new URLSearchParams({\n sessionId: ref.sessionId,\n limit: \"100\",\n offset: String(offset),\n });\n\n for (const key of [\n \"filename\",\n \"mimeType\",\n \"minSize\",\n \"maxSize\",\n \"createdAfter\",\n \"createdBefore\",\n ] as const) {\n const value = checked[key];\n\n if (value !== undefined) search.set(key, String(value));\n }\n\n const raw = yield* client.json(\"GET\", `/v1/downloads?${search}`).pipe(\n Effect.mapError(fromClient(\"downloads-list\")),\n Effect.flatMap((value) =>\n Schema.decodeUnknownEffect(Listing)(value).pipe(\n Effect.mapError(() => failure(\"downloads-list\", \"malformed\")),\n ),\n ),\n );\n\n if (\n raw.downloads.some((entry) => entry.sessionId !== ref.sessionId) ||\n new Set(raw.downloads.map((entry) => entry.id)).size !== raw.downloads.length\n ) {\n return yield* failure(\"downloads-list\", \"malformed\");\n }\n\n return { ...raw, offset, complete: offset + raw.downloads.length >= raw.total };\n });\n\n const metadata = Effect.fnUntraced(function* (ref: SessionReference, id: string) {\n yield* Schema.decodeEffect(Identifier)(id).pipe(\n Effect.mapError(() => failure(\"download-metadata\", \"configuration\")),\n );\n\n yield* owned(ref, \"download-metadata\");\n\n const value = yield* client.json(\"GET\", `/v1/downloads/${encodeURIComponent(id)}`).pipe(\n Effect.mapError(fromClient(\"download-metadata\")),\n Effect.flatMap((raw) =>\n Schema.decodeUnknownEffect(DownloadMetadata)(raw).pipe(\n Effect.mapError(() => failure(\"download-metadata\", \"malformed\")),\n ),\n ),\n );\n\n if (value.id !== id || value.sessionId !== ref.sessionId)\n return yield* failure(\"download-metadata\", \"malformed\");\n\n return value;\n });\n\n const stream = (ref: SessionReference, id: string, policy: DownloadPolicy) =>\n Stream.unwrap(\n Effect.gen(function* () {\n const { maxBytes, timeoutMillis, mimeTypes } = yield* downloadTransferPolicy(\n policy,\n () => failure(\"download\", \"configuration\"),\n );\n\n const deadline = yield* deadlineAfter(timeoutMillis);\n const file = yield* within(metadata(ref, id), deadline, \"download\");\n\n if (!mimeTypes.includes(file.mimeType.toLowerCase()))\n return yield* failure(\"download\", \"content-type\");\n if (file.size > maxBytes) return yield* failure(\"download\", \"limit\");\n let received = 0;\n\n return client\n .bytes(\n `/v1/downloads/${encodeURIComponent(id)}`,\n maxBytes,\n [\"application/octet-stream\", file.mimeType.toLowerCase()],\n timeoutMillis,\n deadline,\n )\n .pipe(\n Stream.mapError(fromClient(\"download\")),\n Stream.tap((chunk) =>\n Effect.sync(() => {\n received += chunk.byteLength;\n }),\n ),\n Stream.concat(\n Stream.fromEffect(\n Effect.suspend(() =>\n received === file.size\n ? Effect.void\n : Effect.fail(failure(\"download\", \"malformed\")),\n ),\n ).pipe(Stream.drain),\n ),\n );\n }),\n );\n\n const waitForNew = Effect.fnUntraced(function* (\n ref: SessionReference,\n previousIds: ReadonlyArray<string>,\n timeoutMillis: number = 30_000,\n ) {\n if (\n previousIds.length > 10_000 ||\n !Number.isSafeInteger(timeoutMillis) ||\n timeoutMillis < 1 ||\n timeoutMillis > 300_000\n ) {\n return yield* failure(\"download-wait\", \"configuration\");\n }\n const previous = new Set(previousIds);\n const deadline = yield* deadlineAfter(timeoutMillis);\n\n do {\n const result = yield* within(list(ref), deadline, \"download-wait\");\n\n // Never claim a complete candidate set from a partial listing.\n if (!result.complete) return yield* failure(\"download-wait\", \"limit\");\n const fresh = result.downloads.filter((entry) => !previous.has(entry.id));\n\n if (fresh.length > 0) return fresh;\n const remaining = deadline - (yield* nowMillis);\n\n if (remaining <= 0) break;\n yield* Effect.sleep(Math.min(500, remaining));\n } while ((yield* nowMillis) < deadline);\n\n return yield* failure(\"download-wait\", \"timeout\");\n });\n\n const remove = Effect.fnUntraced(function* (ref: SessionReference, id: string) {\n yield* Schema.decodeEffect(Identifier)(id).pipe(\n Effect.mapError(() =>\n FileError.make({\n operation: \"download-delete\",\n reason: \"configuration\",\n outcome: \"undispatched\",\n }),\n ),\n );\n\n // Ownership is proved by reading the file's session before any mutation.\n yield* metadata(ref, id).pipe(\n Effect.mapError((error) =>\n FileError.make({\n operation: \"download-delete\",\n reason: error.reason,\n outcome: \"undispatched\",\n ...(error.status === undefined ? {} : { status: error.status }),\n ...(error.retryAfterMillis === undefined\n ? {}\n : { retryAfterMillis: error.retryAfterMillis }),\n }),\n ),\n );\n\n yield* client\n .noContent(\"DELETE\", `/v1/downloads/${encodeURIComponent(id)}`)\n .pipe(Effect.mapError(fromClient(\"download-delete\")));\n });\n\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IACb,WAAW;IACX,QAAQ,MAAM;IACd,SAAS;IACT,GAAI,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;IAC7D,GAAI,MAAM,qBAAqB,KAAA,IAC3B,CAAC,IACD,EAAE,kBAAkB,MAAM,iBAAiB;GACjD,CAAC,CACH,CACF;GAEA,OAAO,OACJ,UAAU,UAAU,iBAAiB,mBAAmB,EAAE,GAAG,CAAC,CAC9D,KAAK,OAAO,SAAS,WAAW,iBAAiB,CAAC,CAAC;EACxD,CAAC;EAED,OAAO,qBAAqB,GAAG;GAAE;GAAM;GAAU;GAAQ;GAAY,QAAQ;EAAO,CAAC;CACvF,CAAC,CACH;AACF"}
package/dist/Errors.d.mts CHANGED
@@ -1,23 +1,6 @@
1
- import { o as SessionReference, t as AllocationAttempt } from "./References-URDAtapt.mjs";
1
+ import { a as SessionReference, t as AllocationAttempt } from "./References-DOH3Wu44.mjs";
2
2
  import { Schema } from "effect";
3
- declare namespace Errors_d_exports {
4
- export { AllocationError, ArtifactError, BrowserError, BrowserOperation, CertificateError, ClientError, ContextError, ExtensionError, FileError, InitializationError, PlatformError, ProjectError, SessionError };
5
- }
6
- /**
7
- * What a caller asked the owned browser to do. The vocabulary is closed: the owner stamps it
8
- * when it admits an operation, so a native step's own name can never become API, and a new
9
- * spelling is a deliberate edit here rather than a string that merely compiles.
10
- */
11
- export declare const BrowserOperation: Schema.Literals<readonly ["configure", "launch", "connect", "reconnect", "detach", "disconnect", "close", "handoff", "resume", "live-view", "target", "handle", "list-pages", "list-frames", "select-page", "select-frame", "new-page", "close-page", "resize", "ready", "observe", "checkpoint", "control-facts", "revalidate", "read-text", "screenshot", "wait", "navigate", "navigate-stop", "click", "fill", "scroll", "click-and-wait", "download-action", "select-files", "file-chooser", "action-result", "pointer-move", "hover", "wheel", "press", "type", "page-control", "page-state", "page-suspend", "page-resume", "capture", "capture-start", "capture-stop", "capture-consume"]>;
12
- export type BrowserOperation = typeof BrowserOperation.Type;
13
- declare const BrowserError_base: Schema.Class<BrowserError, Schema.TaggedStruct<"BrowserError", {
14
- readonly operation: Schema.Literals<readonly ["configure", "launch", "connect", "reconnect", "detach", "disconnect", "close", "handoff", "resume", "live-view", "target", "handle", "list-pages", "list-frames", "select-page", "select-frame", "new-page", "close-page", "resize", "ready", "observe", "checkpoint", "control-facts", "revalidate", "read-text", "screenshot", "wait", "navigate", "navigate-stop", "click", "fill", "scroll", "click-and-wait", "download-action", "select-files", "file-chooser", "action-result", "pointer-move", "hover", "wheel", "press", "type", "page-control", "page-state", "page-suspend", "page-resume", "capture", "capture-start", "capture-stop", "capture-consume"]>;
15
- readonly reason: Schema.Literals<readonly ["configuration", "unsupported", "busy", "closed", "stale", "not-found", "ambiguous", "malformed", "limit", "timeout", "transport", "provider", "authorization", "rate-limited", "disconnected", "active", "disabled", "expired", "failed", "unsafe-url", "content-type", "timestamp", "resized", "target-changed", "interrupted", "context-lease", "not-visible", "denied", "not-focused"]>;
16
- readonly outcome: Schema.optionalKey<Schema.Literals<readonly ["undispatched", "rejected", "unknown"]>>;
17
- readonly status: Schema.optionalKey<Schema.Int>;
18
- readonly retryAfterMillis: Schema.optionalKey<Schema.Natural>;
19
- }>, import("effect/Cause").YieldableError>;
20
- export declare class BrowserError extends BrowserError_base {}
3
+ //#region src/Errors.d.ts
21
4
  declare const ClientError_base: Schema.Class<ClientError, Schema.TaggedStruct<"ClientError", {
22
5
  operation: Schema.Literals<readonly ["configure", "provider-read", "provider-mutation", "provider-upload", "media-download"]>;
23
6
  reason: Schema.Literals<readonly ["configuration", "authorization", "rate-limited", "not-found", "active", "disabled", "expired", "provider", "transport", "timeout", "malformed", "limit", "unsafe-url", "content-type"]>;
@@ -102,12 +85,6 @@ declare const ArtifactError_base: Schema.Class<ArtifactError, Schema.TaggedStruc
102
85
  readonly reason: Schema.Literals<readonly ["configuration", "authorization", "rate-limited", "not-found", "active", "disabled", "expired", "provider", "transport", "timeout", "malformed", "limit", "unsafe-url", "content-type", "failed", "byos", "assembly-unknown", "unsupported", "ambiguous"]>;
103
86
  }>, import("effect/Cause").YieldableError>;
104
87
  export declare class ArtifactError extends ArtifactError_base {}
105
- declare const InitializationError_base: Schema.Class<InitializationError, Schema.TaggedStruct<"InitializationError", {
106
- readonly operation: Schema.Literals<readonly ["configure", "register", "ready", "callback", "dispose"]>;
107
- readonly step: Schema.String;
108
- readonly reason: Schema.Literals<readonly ["configuration", "unsupported", "origin", "stale", "busy", "closed", "timeout", "input", "output", "native"]>;
109
- }>, import("effect/Cause").YieldableError>;
110
- export declare class InitializationError extends InitializationError_base {}
111
88
  declare const AllocationError_base: Schema.Class<AllocationError, Schema.TaggedStruct<"AllocationError", {
112
89
  readonly attempt: typeof AllocationAttempt;
113
90
  readonly reference: Schema.optionalKey<typeof SessionReference>;
@@ -119,5 +96,5 @@ declare const AllocationError_base: Schema.Class<AllocationError, Schema.TaggedS
119
96
  /** Creation has a known rejection or an uncertain effect; absence of a reply is not a rejection. */
120
97
  export declare class AllocationError extends AllocationError_base {}
121
98
  //#endregion
122
- export { Errors_d_exports as t };
99
+ export {};
123
100
  //# sourceMappingURL=Errors.d.mts.map
package/dist/Errors.mjs CHANGED
@@ -1,120 +1,6 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
1
  import { AllocationAttempt, SessionReference } from "./References.mjs";
3
2
  import { Schema } from "effect";
4
3
  //#region src/Errors.ts
5
- var Errors_exports = /* @__PURE__ */ __exportAll({
6
- AllocationError: () => AllocationError,
7
- ArtifactError: () => ArtifactError,
8
- BrowserError: () => BrowserError,
9
- BrowserOperation: () => BrowserOperation,
10
- CertificateError: () => CertificateError,
11
- ClientError: () => ClientError,
12
- ContextError: () => ContextError,
13
- ExtensionError: () => ExtensionError,
14
- FileError: () => FileError,
15
- InitializationError: () => InitializationError,
16
- PlatformError: () => PlatformError,
17
- ProjectError: () => ProjectError,
18
- SessionError: () => SessionError
19
- });
20
- /**
21
- * What a caller asked the owned browser to do. The vocabulary is closed: the owner stamps it
22
- * when it admits an operation, so a native step's own name can never become API, and a new
23
- * spelling is a deliberate edit here rather than a string that merely compiles.
24
- */
25
- const BrowserOperation = Schema.Literals([
26
- "configure",
27
- "launch",
28
- "connect",
29
- "reconnect",
30
- "detach",
31
- "disconnect",
32
- "close",
33
- "handoff",
34
- "resume",
35
- "live-view",
36
- "target",
37
- "handle",
38
- "list-pages",
39
- "list-frames",
40
- "select-page",
41
- "select-frame",
42
- "new-page",
43
- "close-page",
44
- "resize",
45
- "ready",
46
- "observe",
47
- "checkpoint",
48
- "control-facts",
49
- "revalidate",
50
- "read-text",
51
- "screenshot",
52
- "wait",
53
- "navigate",
54
- "navigate-stop",
55
- "click",
56
- "fill",
57
- "scroll",
58
- "click-and-wait",
59
- "download-action",
60
- "select-files",
61
- "file-chooser",
62
- "action-result",
63
- "pointer-move",
64
- "hover",
65
- "wheel",
66
- "press",
67
- "type",
68
- "page-control",
69
- "page-state",
70
- "page-suspend",
71
- "page-resume",
72
- "capture",
73
- "capture-start",
74
- "capture-stop",
75
- "capture-consume"
76
- ]);
77
- var BrowserError = class extends Schema.TaggedError()("BrowserError", {
78
- operation: BrowserOperation,
79
- reason: Schema.Literals([
80
- "configuration",
81
- "unsupported",
82
- "busy",
83
- "closed",
84
- "stale",
85
- "not-found",
86
- "ambiguous",
87
- "malformed",
88
- "limit",
89
- "timeout",
90
- "transport",
91
- "provider",
92
- "authorization",
93
- "rate-limited",
94
- "disconnected",
95
- "active",
96
- "disabled",
97
- "expired",
98
- "failed",
99
- "unsafe-url",
100
- "content-type",
101
- "timestamp",
102
- "resized",
103
- "target-changed",
104
- "interrupted",
105
- "context-lease",
106
- "not-visible",
107
- "denied",
108
- "not-focused"
109
- ]),
110
- outcome: Schema.optionalKey(Schema.Literals([
111
- "undispatched",
112
- "rejected",
113
- "unknown"
114
- ])),
115
- status: Schema.optionalKey(Schema.Int),
116
- retryAfterMillis: Schema.optionalKey(Schema.Natural)
117
- }) {};
118
4
  const RequestReason = Schema.Literals([
119
5
  "configuration",
120
6
  "authorization",
@@ -284,28 +170,6 @@ var ArtifactError = class extends Schema.TaggedError()("ArtifactError", {
284
170
  "ambiguous"
285
171
  ])
286
172
  }) {};
287
- var InitializationError = class extends Schema.TaggedError()("InitializationError", {
288
- operation: Schema.Literals([
289
- "configure",
290
- "register",
291
- "ready",
292
- "callback",
293
- "dispose"
294
- ]),
295
- step: Schema.String.check(Schema.isMaxLength(128)),
296
- reason: Schema.Literals([
297
- "configuration",
298
- "unsupported",
299
- "origin",
300
- "stale",
301
- "busy",
302
- "closed",
303
- "timeout",
304
- "input",
305
- "output",
306
- "native"
307
- ])
308
- }) {};
309
173
  /** Creation has a known rejection or an uncertain effect; absence of a reply is not a rejection. */
310
174
  var AllocationError = class extends Schema.TaggedError()("AllocationError", {
311
175
  attempt: AllocationAttempt,
@@ -324,6 +188,6 @@ var AllocationError = class extends Schema.TaggedError()("AllocationError", {
324
188
  retryAfterMillis: Schema.optionalKey(Schema.Natural)
325
189
  }) {};
326
190
  //#endregion
327
- export { AllocationError, ArtifactError, BrowserError, BrowserOperation, CertificateError, ClientError, ContextError, ExtensionError, FileError, InitializationError, PlatformError, ProjectError, SessionError, Errors_exports as t };
191
+ export { AllocationError, ArtifactError, CertificateError, ClientError, ContextError, ExtensionError, FileError, PlatformError, ProjectError, SessionError };
328
192
 
329
193
  //# sourceMappingURL=Errors.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Errors.mjs","names":[],"sources":["../src/Errors.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nimport { AllocationAttempt, SessionReference } from \"./References.ts\";\n\n/**\n * What a caller asked the owned browser to do. The vocabulary is closed: the owner stamps it\n * when it admits an operation, so a native step's own name can never become API, and a new\n * spelling is a deliberate edit here rather than a string that merely compiles.\n */\nexport const BrowserOperation = Schema.Literals([\n // configuration and lifetime\n \"configure\",\n \"launch\",\n \"connect\",\n \"reconnect\",\n \"detach\",\n \"disconnect\",\n \"close\",\n \"handoff\",\n \"resume\",\n \"live-view\",\n // targets\n \"target\",\n \"handle\",\n \"list-pages\",\n \"list-frames\",\n \"select-page\",\n \"select-frame\",\n \"new-page\",\n \"close-page\",\n \"resize\",\n // reading\n \"ready\",\n \"observe\",\n \"checkpoint\",\n \"control-facts\",\n \"revalidate\",\n \"read-text\",\n \"screenshot\",\n \"wait\",\n // input\n \"navigate\",\n \"navigate-stop\",\n \"click\",\n \"fill\",\n \"scroll\",\n \"click-and-wait\",\n \"download-action\",\n \"select-files\",\n \"file-chooser\",\n \"action-result\",\n // native pointer input\n \"pointer-move\",\n \"hover\",\n \"wheel\",\n // native key input\n \"press\",\n \"type\",\n // page control\n \"page-control\",\n \"page-state\",\n \"page-suspend\",\n \"page-resume\",\n // capture\n \"capture\",\n \"capture-start\",\n \"capture-stop\",\n \"capture-consume\",\n]);\n\nexport type BrowserOperation = typeof BrowserOperation.Type;\n\nexport class BrowserError extends Schema.TaggedError<BrowserError>()(\"BrowserError\", {\n operation: BrowserOperation,\n reason: Schema.Literals([\n \"configuration\",\n \"unsupported\",\n \"busy\",\n \"closed\",\n \"stale\",\n \"not-found\",\n \"ambiguous\",\n \"malformed\",\n \"limit\",\n \"timeout\",\n \"transport\",\n \"provider\",\n \"authorization\",\n \"rate-limited\",\n \"disconnected\",\n \"active\",\n \"disabled\",\n \"expired\",\n \"failed\",\n \"unsafe-url\",\n \"content-type\",\n \"timestamp\",\n \"resized\",\n \"target-changed\",\n \"interrupted\",\n \"context-lease\",\n // The pointer cannot be placed on it: outside the viewport, without area, or covered.\n \"not-visible\",\n // The host's own admission policy refused it, on facts read just before any input.\n \"denied\",\n // Keys would not reach it: neither it nor anything inside it has focus.\n \"not-focused\",\n ]),\n outcome: Schema.optionalKey(Schema.Literals([\"undispatched\", \"rejected\", \"unknown\"])),\n status: Schema.optionalKey(Schema.Int),\n retryAfterMillis: Schema.optionalKey(Schema.Natural),\n}) {}\n\nconst RequestReason = Schema.Literals([\n \"configuration\",\n \"authorization\",\n \"rate-limited\",\n \"not-found\",\n \"active\",\n \"disabled\",\n \"expired\",\n \"provider\",\n \"transport\",\n \"timeout\",\n \"malformed\",\n \"limit\",\n \"unsafe-url\",\n \"content-type\",\n]);\n\n/**\n * Every control-plane error shares these fields, but never a vocabulary: each names only the\n * operations its own service performs, so a caller can match on them exhaustively.\n */\nconst requestFields = <const Operations extends ReadonlyArray<string>>(operations: Operations) => ({\n operation: Schema.Literals(operations),\n reason: RequestReason,\n outcome: Schema.optionalKey(Schema.Literals([\"undispatched\", \"rejected\", \"unknown\"])),\n status: Schema.optionalKey(Schema.Int),\n retryAfterMillis: Schema.optionalKey(Schema.Natural),\n});\n\n/** Credential-free control-plane failures; response bodies and native causes never escape. */\nexport class ClientError extends Schema.TaggedError<ClientError>()(\n \"ClientError\",\n requestFields([\n \"configure\",\n \"provider-read\",\n \"provider-mutation\",\n \"provider-upload\",\n \"media-download\",\n ]),\n) {}\n\nexport class SessionError extends Schema.TaggedError<SessionError>()(\n \"SessionError\",\n requestFields([\n \"session-retrieve\",\n \"session-list\",\n \"session-release\",\n \"session-wait\",\n \"session-logs\",\n \"session-live-view\",\n \"session-connect\",\n \"session-attach\",\n ]),\n) {}\n\nexport class ContextError extends Schema.TaggedError<ContextError>()(\n \"ContextError\",\n requestFields([\n \"context-create\",\n \"context-retrieve\",\n \"context-delete\",\n \"writer\",\n \"writer-admit\",\n \"writer-authority\",\n \"writer-readback\",\n \"writer-settle\",\n ]),\n) {}\n\n/**\n * `extension-archive` is the local inspection of the bytes a caller supplied, before any\n * request. Why an archive was refused is its reason, never a second operation.\n */\nexport class ExtensionError extends Schema.TaggedError<ExtensionError>()(\"ExtensionError\", {\n ...requestFields([\n \"extension-archive\",\n \"extension-register\",\n \"extension-retrieve\",\n \"extension-delete\",\n ]),\n reason: Schema.Literals([...RequestReason.literals, \"unsafe-filename\"]),\n}) {}\n\n/** Project inspection and usage. */\nexport class ProjectError extends Schema.TaggedError<ProjectError>()(\n \"ProjectError\",\n requestFields([\"project-list\", \"project-retrieve\", \"project-usage\"]),\n) {}\n\n/** Proxy CA certificate administration. */\nexport class CertificateError extends Schema.TaggedError<CertificateError>()(\n \"CertificateError\",\n requestFields([\n \"certificate-create\",\n \"certificate-list\",\n \"certificate-retrieve\",\n \"certificate-delete\",\n ]),\n) {}\n\n/**\n * Browserbase platform services outside a browser session: Search, Fetch, Agents, Functions\n * and Webhooks. `service` names which one; these are host APIs, never model-facing tools.\n */\nexport class PlatformError extends Schema.TaggedError<PlatformError>()(\"PlatformError\", {\n ...requestFields([\n \"search-web\",\n \"fetch\",\n \"agent-create\",\n \"agent-list\",\n \"agent-retrieve\",\n \"agent-update\",\n \"agent-delete\",\n \"agent-run\",\n \"agent-run-list\",\n \"agent-run-retrieve\",\n \"agent-run-messages\",\n \"agent-run-stop\",\n \"agent-run-wait\",\n \"function-list\",\n \"function-retrieve\",\n \"function-versions\",\n \"function-version\",\n \"function-builds\",\n \"function-build\",\n \"function-build-logs\",\n \"function-invoke\",\n \"function-invocations\",\n \"function-invocation\",\n \"function-invocation-logs\",\n \"function-wait\",\n \"webhook-create\",\n \"webhook-list\",\n \"webhook-retrieve\",\n \"webhook-update\",\n \"webhook-delete\",\n \"webhook-rotate-secret\",\n ]),\n service: Schema.Literals([\"search\", \"fetch\", \"agents\", \"functions\", \"webhooks\"]),\n}) {}\n\nexport class FileError extends Schema.TaggedError<FileError>()(\"FileError\", {\n ...requestFields([\n \"upload\",\n \"downloads-list\",\n \"download-metadata\",\n \"download\",\n \"download-wait\",\n \"download-delete\",\n ]),\n reason: Schema.Literals([\n ...RequestReason.literals,\n \"unsafe-filename\",\n \"ambiguous\",\n \"checksum\",\n \"unsupported\",\n ]),\n}) {}\n\nexport class ArtifactError extends Schema.TaggedError<ArtifactError>()(\"ArtifactError\", {\n ...requestFields([\n \"recording-request\",\n \"recording-status\",\n \"recording-wait\",\n \"recording\",\n \"recording-download\",\n \"replay-metadata\",\n \"replay\",\n \"replay-playlist\",\n \"replay-media\",\n ]),\n reason: Schema.Literals([\n ...RequestReason.literals,\n \"failed\",\n \"byos\",\n \"assembly-unknown\",\n \"unsupported\",\n \"ambiguous\",\n ]),\n}) {}\n\nexport class InitializationError extends Schema.TaggedError<InitializationError>()(\n \"InitializationError\",\n {\n operation: Schema.Literals([\"configure\", \"register\", \"ready\", \"callback\", \"dispose\"]),\n step: Schema.String.check(Schema.isMaxLength(128)),\n reason: Schema.Literals([\n \"configuration\",\n \"unsupported\",\n \"origin\",\n \"stale\",\n \"busy\",\n \"closed\",\n \"timeout\",\n \"input\",\n \"output\",\n \"native\",\n ]),\n },\n) {}\n\n/** Creation has a known rejection or an uncertain effect; absence of a reply is not a rejection. */\nexport class AllocationError extends Schema.TaggedError<AllocationError>()(\"AllocationError\", {\n attempt: AllocationAttempt,\n reference: Schema.optionalKey(SessionReference),\n outcome: Schema.Literals([\"rejected\", \"unknown\"]),\n reason: Schema.Literals([\n \"authorization\",\n \"rate-limited\",\n \"configuration\",\n \"provider\",\n \"transport\",\n \"timeout\",\n \"malformed\",\n ]),\n status: Schema.optionalKey(Schema.Int),\n retryAfterMillis: Schema.optionalKey(Schema.Natural),\n}) {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAa,mBAAmB,OAAO,SAAS;CAE9C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;AACF,CAAC;AAID,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAAC,gBAAgB;CACnF,WAAW;CACX,QAAQ,OAAO,SAAS;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;E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;EACA;EACA;EACA;CACF,CAAC;AACH,CACF,CAAC,CAAC,CAAC;;AAGH,IAAa,kBAAb,cAAqC,OAAO,YAA6B,CAAC,CAAC,mBAAmB;CAC5F,SAAS;CACT,WAAW,OAAO,YAAY,gBAAgB;CAC9C,SAAS,OAAO,SAAS,CAAC,YAAY,SAAS,CAAC;CAChD,QAAQ,OAAO,SAAS;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,QAAQ,OAAO,YAAY,OAAO,GAAG;CACrC,kBAAkB,OAAO,YAAY,OAAO,OAAO;AACrD,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"Errors.mjs","names":[],"sources":["../src/Errors.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nimport { AllocationAttempt, SessionReference } from \"./References.ts\";\n\nconst RequestReason = Schema.Literals([\n \"configuration\",\n \"authorization\",\n \"rate-limited\",\n \"not-found\",\n \"active\",\n \"disabled\",\n \"expired\",\n \"provider\",\n \"transport\",\n \"timeout\",\n \"malformed\",\n \"limit\",\n \"unsafe-url\",\n \"content-type\",\n]);\n\n/**\n * Every control-plane error shares these fields, but never a vocabulary: each names only the\n * operations its own service performs, so a caller can match on them exhaustively.\n */\nconst requestFields = <const Operations extends ReadonlyArray<string>>(operations: Operations) => ({\n operation: Schema.Literals(operations),\n reason: RequestReason,\n outcome: Schema.optionalKey(Schema.Literals([\"undispatched\", \"rejected\", \"unknown\"])),\n status: Schema.optionalKey(Schema.Int),\n retryAfterMillis: Schema.optionalKey(Schema.Natural),\n});\n\n/** Credential-free control-plane failures; response bodies and native causes never escape. */\nexport class ClientError extends Schema.TaggedError<ClientError>()(\n \"ClientError\",\n requestFields([\n \"configure\",\n \"provider-read\",\n \"provider-mutation\",\n \"provider-upload\",\n \"media-download\",\n ]),\n) {}\n\nexport class SessionError extends Schema.TaggedError<SessionError>()(\n \"SessionError\",\n requestFields([\n \"session-retrieve\",\n \"session-list\",\n \"session-release\",\n \"session-wait\",\n \"session-logs\",\n \"session-live-view\",\n \"session-connect\",\n \"session-attach\",\n ]),\n) {}\n\nexport class ContextError extends Schema.TaggedError<ContextError>()(\n \"ContextError\",\n requestFields([\n \"context-create\",\n \"context-retrieve\",\n \"context-delete\",\n \"writer\",\n \"writer-admit\",\n \"writer-authority\",\n \"writer-readback\",\n \"writer-settle\",\n ]),\n) {}\n\n/**\n * `extension-archive` is the local inspection of the bytes a caller supplied, before any\n * request. Why an archive was refused is its reason, never a second operation.\n */\nexport class ExtensionError extends Schema.TaggedError<ExtensionError>()(\"ExtensionError\", {\n ...requestFields([\n \"extension-archive\",\n \"extension-register\",\n \"extension-retrieve\",\n \"extension-delete\",\n ]),\n reason: Schema.Literals([...RequestReason.literals, \"unsafe-filename\"]),\n}) {}\n\n/** Project inspection and usage. */\nexport class ProjectError extends Schema.TaggedError<ProjectError>()(\n \"ProjectError\",\n requestFields([\"project-list\", \"project-retrieve\", \"project-usage\"]),\n) {}\n\n/** Proxy CA certificate administration. */\nexport class CertificateError extends Schema.TaggedError<CertificateError>()(\n \"CertificateError\",\n requestFields([\n \"certificate-create\",\n \"certificate-list\",\n \"certificate-retrieve\",\n \"certificate-delete\",\n ]),\n) {}\n\n/**\n * Browserbase platform services outside a browser session: Search, Fetch, Agents, Functions\n * and Webhooks. `service` names which one; these are host APIs, never model-facing tools.\n */\nexport class PlatformError extends Schema.TaggedError<PlatformError>()(\"PlatformError\", {\n ...requestFields([\n \"search-web\",\n \"fetch\",\n \"agent-create\",\n \"agent-list\",\n \"agent-retrieve\",\n \"agent-update\",\n \"agent-delete\",\n \"agent-run\",\n \"agent-run-list\",\n \"agent-run-retrieve\",\n \"agent-run-messages\",\n \"agent-run-stop\",\n \"agent-run-wait\",\n \"function-list\",\n \"function-retrieve\",\n \"function-versions\",\n \"function-version\",\n \"function-builds\",\n \"function-build\",\n \"function-build-logs\",\n \"function-invoke\",\n \"function-invocations\",\n \"function-invocation\",\n \"function-invocation-logs\",\n \"function-wait\",\n \"webhook-create\",\n \"webhook-list\",\n \"webhook-retrieve\",\n \"webhook-update\",\n \"webhook-delete\",\n \"webhook-rotate-secret\",\n ]),\n service: Schema.Literals([\"search\", \"fetch\", \"agents\", \"functions\", \"webhooks\"]),\n}) {}\n\nexport class FileError extends Schema.TaggedError<FileError>()(\"FileError\", {\n ...requestFields([\n \"upload\",\n \"downloads-list\",\n \"download-metadata\",\n \"download\",\n \"download-wait\",\n \"download-delete\",\n ]),\n reason: Schema.Literals([\n ...RequestReason.literals,\n \"unsafe-filename\",\n \"ambiguous\",\n \"checksum\",\n \"unsupported\",\n ]),\n}) {}\n\nexport class ArtifactError extends Schema.TaggedError<ArtifactError>()(\"ArtifactError\", {\n ...requestFields([\n \"recording-request\",\n \"recording-status\",\n \"recording-wait\",\n \"recording\",\n \"recording-download\",\n \"replay-metadata\",\n \"replay\",\n \"replay-playlist\",\n \"replay-media\",\n ]),\n reason: Schema.Literals([\n ...RequestReason.literals,\n \"failed\",\n \"byos\",\n \"assembly-unknown\",\n \"unsupported\",\n \"ambiguous\",\n ]),\n}) {}\n\n/** Creation has a known rejection or an uncertain effect; absence of a reply is not a rejection. */\nexport class AllocationError extends Schema.TaggedError<AllocationError>()(\"AllocationError\", {\n attempt: AllocationAttempt,\n reference: Schema.optionalKey(SessionReference),\n outcome: Schema.Literals([\"rejected\", \"unknown\"]),\n reason: Schema.Literals([\n \"authorization\",\n \"rate-limited\",\n \"configuration\",\n \"provider\",\n \"transport\",\n \"timeout\",\n \"malformed\",\n ]),\n status: Schema.optionalKey(Schema.Int),\n retryAfterMillis: Schema.optionalKey(Schema.Natural),\n}) {}\n"],"mappings":";;;AAIA,MAAM,gBAAgB,OAAO,SAAS;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;AAMD,MAAM,iBAAiE,gBAA4B;CACjG,WAAW,OAAO,SAAS,UAAU;CACrC,QAAQ;CACR,SAAS,OAAO,YAAY,OAAO,SAAS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;EAAU;EAAS;EAAU;EAAa;CAAU,CAAC;AACjF,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,YAAb,cAA+B,OAAO,YAAuB,CAAC,CAAC,aAAa;CAC1E,GAAG,cAAc;EACf;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,QAAQ,OAAO,SAAS;EACtB,GAAG,cAAc;EACjB;EACA;EACA;EACA;CACF,CAAC;AACH,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,gBAAb,cAAmC,OAAO,YAA2B,CAAC,CAAC,iBAAiB;CACtF,GAAG,cAAc;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,QAAQ,OAAO,SAAS;EACtB,GAAG,cAAc;EACjB;EACA;EACA;EACA;EACA;CACF,CAAC;AACH,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,kBAAb,cAAqC,OAAO,YAA6B,CAAC,CAAC,mBAAmB;CAC5F,SAAS;CACT,WAAW,OAAO,YAAY,gBAAgB;CAC9C,SAAS,OAAO,SAAS,CAAC,YAAY,SAAS,CAAC;CAChD,QAAQ,OAAO,SAAS;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,QAAQ,OAAO,YAAY,OAAO,GAAG;CACrC,kBAAkB,OAAO,YAAY,OAAO,OAAO;AACrD,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { r as ExtensionReference } from "./References-DOH3Wu44.mjs";
2
+ import { ExtensionError } from "./Errors.mjs";
3
+ import { t as BrowserbaseClient } from "./Client-B_f6bBLT.mjs";
4
+ import { Context, Effect, Layer, Schema } from "effect";
5
+ //#region src/Extensions.d.ts
6
+ declare const ExtensionMetadata_base: Schema.Class<ExtensionMetadata, Schema.Struct<{
7
+ readonly reference: typeof ExtensionReference;
8
+ readonly fileName: Schema.optionalKey<Schema.String>;
9
+ readonly createdAt: Schema.optionalKey<Schema.String>;
10
+ readonly updatedAt: Schema.optionalKey<Schema.String>;
11
+ }>, {}>;
12
+ /** Only fields the provider actually returned are reported; absence is never invented. */
13
+ declare class ExtensionMetadata extends ExtensionMetadata_base {}
14
+ declare const ExtensionRegistration_base: Schema.Class<ExtensionRegistration, Schema.Struct<{
15
+ readonly reference: typeof ExtensionReference;
16
+ readonly archiveBytes: Schema.Natural;
17
+ readonly entries: Schema.Natural;
18
+ readonly declaredBytes: Schema.Natural;
19
+ }>, {}>;
20
+ /** Registration evidence is what this package inspected, not a provider load receipt. */
21
+ declare class ExtensionRegistration extends ExtensionRegistration_base {}
22
+ interface ExtensionUploadOptions {
23
+ /** Portable basename sent with the part; defaults to `extension.zip`. */
24
+ readonly filename?: string;
25
+ readonly maxBytes?: number;
26
+ readonly timeoutMillis?: number;
27
+ }
28
+ declare const BrowserbaseExtensions_base: Context.ServiceClass<BrowserbaseExtensions, "effect-browserbase/Extensions", {
29
+ readonly register: (archive: Uint8Array, options?: ExtensionUploadOptions) => Effect.Effect<ExtensionRegistration, ExtensionError>;
30
+ readonly retrieve: (reference: ExtensionReference) => Effect.Effect<ExtensionMetadata, ExtensionError>;
31
+ readonly delete: (reference: ExtensionReference) => Effect.Effect<void, ExtensionError>;
32
+ }>;
33
+ /**
34
+ * A provisioned extension is a durable project resource selected at launch, never uploaded
35
+ * again on connect. The archive is inspected before transport; loading remains the provider's.
36
+ */
37
+ declare class BrowserbaseExtensions extends BrowserbaseExtensions_base {
38
+ static readonly layer: Layer.Layer<BrowserbaseExtensions, never, BrowserbaseClient>;
39
+ }
40
+ //#endregion
41
+ export { ExtensionUploadOptions as i, ExtensionMetadata as n, ExtensionRegistration as r, BrowserbaseExtensions as t };
42
+ export {};
43
+ //# sourceMappingURL=Extensions-DBXuVM1f.d.mts.map