effect-browserbase 0.1.0-beta.102 → 0.2.0-beta.0
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.
- package/README.md +61 -231
- package/dist/Account.d.mts +4 -6
- package/dist/Account.mjs +4 -9
- package/dist/Account.mjs.map +1 -1
- package/dist/{Acquisition-WBafHwXH.mjs → Acquisition-D8o4jtCg.mjs} +22 -68
- package/dist/Acquisition-D8o4jtCg.mjs.map +1 -0
- package/dist/Agents.d.mts +4 -6
- package/dist/Agents.mjs +3 -19
- package/dist/Agents.mjs.map +1 -1
- package/dist/Allocation.d.mts +9 -11
- package/dist/Allocation.mjs +2 -4
- package/dist/Allocation.mjs.map +1 -1
- package/dist/Browser.d.mts +25 -140
- package/dist/Browser.mjs +266 -1
- package/dist/Browser.mjs.map +1 -0
- package/dist/BrowserBinding.d.mts +7 -34
- package/dist/BrowserBinding.mjs +30 -1
- package/dist/BrowserBinding.mjs.map +1 -0
- package/dist/Certificates.d.mts +3 -5
- package/dist/Certificates.mjs +2 -7
- package/dist/Certificates.mjs.map +1 -1
- package/dist/{Cleanup-G2YpTCuU.d.mts → Cleanup-DMTDBir8.d.mts} +5 -6
- package/dist/Cleanup.d.mts +3 -2
- package/dist/Cleanup.mjs +1 -6
- package/dist/Cleanup.mjs.map +1 -1
- package/dist/{Client-D1_xYM9o.mjs → Client-BQteUePT.mjs} +2 -4
- package/dist/{Client-D1_xYM9o.mjs.map → Client-BQteUePT.mjs.map} +1 -1
- package/dist/Client.d.mts +51 -2
- package/dist/Client.mjs +1 -1
- package/dist/Connection-DcvJZEdc.mjs +65 -0
- package/dist/Connection-DcvJZEdc.mjs.map +1 -0
- package/dist/ContextCoordination.d.mts +5 -6
- package/dist/ContextCoordination.mjs +1 -8
- package/dist/ContextCoordination.mjs.map +1 -1
- package/dist/Contexts.d.mts +4 -6
- package/dist/Contexts.mjs +2 -8
- package/dist/Contexts.mjs.map +1 -1
- package/dist/Downloads.d.mts +6 -8
- package/dist/Downloads.mjs +3 -8
- package/dist/Downloads.mjs.map +1 -1
- package/dist/Errors.d.mts +3 -26
- package/dist/Errors.mjs +1 -137
- package/dist/Errors.mjs.map +1 -1
- package/dist/{Extensions-ClZbYb1H.mjs → Extensions-nMNMPGCc.mjs} +3 -9
- package/dist/{Extensions-ClZbYb1H.mjs.map → Extensions-nMNMPGCc.mjs.map} +1 -1
- package/dist/Extensions.d.mts +4 -6
- package/dist/Extensions.mjs +1 -1
- package/dist/Functions.d.mts +4 -6
- package/dist/Functions.mjs +3 -17
- package/dist/Functions.mjs.map +1 -1
- package/dist/{Launch-BHcAEq05.mjs → Launch-m0fxzJ49.mjs} +5 -5
- package/dist/Launch-m0fxzJ49.mjs.map +1 -0
- package/dist/Launch.d.mts +130 -2
- package/dist/Launch.mjs +4 -11
- package/dist/Launch.mjs.map +1 -1
- package/dist/PageFetch.d.mts +3 -5
- package/dist/PageFetch.mjs +2 -8
- package/dist/PageFetch.mjs.map +1 -1
- package/dist/Projects.d.mts +3 -5
- package/dist/Projects.mjs +2 -8
- package/dist/Projects.mjs.map +1 -1
- package/dist/Recordings.d.mts +6 -8
- package/dist/Recordings.mjs +3 -5
- package/dist/Recordings.mjs.map +1 -1
- package/dist/{References-URDAtapt.d.mts → References-DOH3Wu44.d.mts} +5 -6
- package/dist/References.d.mts +3 -2
- package/dist/References.mjs +10 -18
- package/dist/References.mjs.map +1 -1
- package/dist/Replays.d.mts +6 -8
- package/dist/Replays.mjs +3 -5
- package/dist/Replays.mjs.map +1 -1
- package/dist/Search.d.mts +3 -5
- package/dist/Search.mjs +2 -9
- package/dist/Search.mjs.map +1 -1
- package/dist/{SessionData-DRKcKCqw.d.mts → SessionData-5xYZDshJ.d.mts} +5 -6
- package/dist/SessionData.d.mts +3 -2
- package/dist/SessionData.mjs +1 -8
- package/dist/SessionData.mjs.map +1 -1
- package/dist/{Sessions-CtbseWEh.mjs → Sessions-DoQGg9nB.mjs} +34 -18
- package/dist/Sessions-DoQGg9nB.mjs.map +1 -0
- package/dist/{Sessions-B8E4kMxo.d.mts → Sessions-tFJYaXFq.d.mts} +8 -8
- package/dist/Sessions.d.mts +4 -3
- package/dist/Sessions.mjs +1 -1
- package/dist/{Transfers-Czv5IZzJ.d.mts → Transfers-GVqzrDWl.d.mts} +22 -9
- package/dist/Transfers.d.mts +3 -2
- package/dist/Transfers.mjs +12 -28
- package/dist/Transfers.mjs.map +1 -1
- package/dist/Uploads.d.mts +6 -8
- package/dist/Uploads.mjs +3 -5
- package/dist/Uploads.mjs.map +1 -1
- package/dist/Webhooks.d.mts +3 -5
- package/dist/Webhooks.mjs +2 -11
- package/dist/Webhooks.mjs.map +1 -1
- package/dist/{WriterFacts-osvYAsIx.d.mts → WriterFacts-5CPBGG1P.d.mts} +4 -3
- package/dist/index.d.mts +27 -30
- package/dist/index.mjs +26 -30
- package/package.json +3 -24
- package/dist/Acquisition-WBafHwXH.mjs.map +0 -1
- package/dist/Association-CEps4hYP.mjs +0 -10
- package/dist/Association-CEps4hYP.mjs.map +0 -1
- package/dist/Bootstrap-BXuzZojd.mjs +0 -194
- package/dist/Bootstrap-BXuzZojd.mjs.map +0 -1
- package/dist/Bootstrap-m7lHgj0D.d.mts +0 -177
- package/dist/Bootstrap.d.mts +0 -2
- package/dist/Bootstrap.mjs +0 -2
- package/dist/Browser-joE4Zgys.mjs +0 -1557
- package/dist/Browser-joE4Zgys.mjs.map +0 -1
- package/dist/BrowserBinding-qbQA6JhH.mjs +0 -2452
- package/dist/BrowserBinding-qbQA6JhH.mjs.map +0 -1
- package/dist/BrowserData-LpcAuAub.d.mts +0 -369
- package/dist/BrowserData.d.mts +0 -2
- package/dist/BrowserData.mjs +0 -442
- package/dist/BrowserData.mjs.map +0 -1
- package/dist/Capture-CZJPuD7b.mjs +0 -532
- package/dist/Capture-CZJPuD7b.mjs.map +0 -1
- package/dist/Capture-Dr5MkIJb.d.mts +0 -125
- package/dist/Capture.d.mts +0 -2
- package/dist/Capture.mjs +0 -2
- package/dist/Client-Ca0zSg1n.d.mts +0 -53
- package/dist/Images-DgscEfSf.mjs +0 -127
- package/dist/Images-DgscEfSf.mjs.map +0 -1
- package/dist/Launch-BHcAEq05.mjs.map +0 -1
- package/dist/Launch-C8CfaYxb.d.mts +0 -132
- package/dist/PageControl.d.mts +0 -16
- package/dist/PageControl.mjs +0 -36
- package/dist/PageControl.mjs.map +0 -1
- package/dist/PageControlAssociation-DabEg5AR.mjs +0 -10
- package/dist/PageControlAssociation-DabEg5AR.mjs.map +0 -1
- package/dist/Sessions-CtbseWEh.mjs.map +0 -1
- package/dist/rolldown-runtime-D7D4PA-g.mjs +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Extensions-ClZbYb1H.mjs","names":[],"sources":["../src/internal/extension/Archive.ts","../src/Extensions.ts"],"sourcesContent":["/**\n * A bounded, allocation-free inspection of an extension ZIP: enough to prove a root\n * `manifest.json` and reject traversal before an upload, never an extractor. No entry is\n * decompressed and no path is written; the provider remains the loader of record.\n */\nexport interface ArchiveFacts {\n readonly entries: number;\n /** Uncompressed size the central directory itself declares, not a measured expansion. */\n readonly declaredBytes: number;\n}\n\nexport type ArchiveRejection =\n | \"signature\"\n | \"malformed\"\n | \"unsupported\"\n | \"name\"\n | \"manifest\"\n | \"limit\";\n\nexport type ArchiveResult =\n | { readonly _tag: \"Accepted\"; readonly facts: ArchiveFacts }\n | { readonly _tag: \"Rejected\"; readonly reason: ArchiveRejection };\n\nconst MAX_ENTRIES = 4096;\nconst MAX_NAME_BYTES = 512;\nconst MAX_DECLARED_BYTES = 512 * 1024 * 1024;\nconst EOCD_SIZE = 22;\nconst LOCAL_HEADER_SIZE = 30;\nconst STORED = 0;\nconst DEFLATED = 8;\n\nconst LOCAL_HEADER = 0x04034b50;\nconst CENTRAL_HEADER = 0x02014b50;\nconst END_OF_CENTRAL_DIRECTORY = 0x06054b50;\n\nconst rejected = (reason: ArchiveRejection): ArchiveResult => ({ _tag: \"Rejected\", reason });\n\nconst control = (name: string): boolean =>\n [...name].some((character) => character < \" \" || character === \"\\x7f\");\n\n/** Any `..` or rooted member would name a file outside the extension directory. */\nconst unsafeName = (name: string): boolean =>\n name.length === 0 ||\n name.startsWith(\"/\") ||\n name.includes(\"\\\\\") ||\n name.includes(\"//\") ||\n /^[A-Za-z]:/.test(name) ||\n control(name) ||\n name.split(\"/\").some((segment) => segment === \".\" || segment === \"..\");\n\nexport const inspectExtensionArchive = (archive: Uint8Array): ArchiveResult => {\n if (archive.byteLength < EOCD_SIZE) return rejected(\"malformed\");\n const view = new DataView(archive.buffer, archive.byteOffset, archive.byteLength);\n const u16 = (offset: number) => view.getUint16(offset, true);\n const u32 = (offset: number) => view.getUint32(offset, true);\n\n if (u32(0) !== LOCAL_HEADER) return rejected(\"signature\");\n\n // The comment is bounded by its own 16-bit length, so the record cannot hide further back.\n const earliest = Math.max(0, archive.byteLength - EOCD_SIZE - 0xffff);\n let end = -1;\n\n for (let offset = archive.byteLength - EOCD_SIZE; offset >= earliest; offset--) {\n if (u32(offset) === END_OF_CENTRAL_DIRECTORY) {\n end = offset;\n break;\n }\n }\n if (end < 0) return rejected(\"malformed\");\n\n const entries = u16(end + 10);\n const directorySize = u32(end + 12);\n const directoryOffset = u32(end + 16);\n const commentLength = u16(end + 20);\n\n if (u16(end + 4) !== 0 || u16(end + 6) !== 0 || u16(end + 8) !== entries)\n return rejected(\"unsupported\");\n if (entries === 0xffff || directorySize === 0xffffffff || directoryOffset === 0xffffffff)\n return rejected(\"unsupported\");\n if (end + EOCD_SIZE + commentLength !== archive.byteLength) return rejected(\"malformed\");\n if (directoryOffset + directorySize > end) return rejected(\"malformed\");\n if (entries > MAX_ENTRIES) return rejected(\"limit\");\n\n const names = new TextDecoder(\"utf-8\", { fatal: true });\n const limit = directoryOffset + directorySize;\n let offset = directoryOffset;\n let declaredBytes = 0;\n let manifest = false;\n\n for (let index = 0; index < entries; index++) {\n if (offset + 46 > limit || u32(offset) !== CENTRAL_HEADER) return rejected(\"malformed\");\n const flags = u16(offset + 8);\n const method = u16(offset + 10);\n const compressed = u32(offset + 20);\n const declared = u32(offset + 24);\n const nameLength = u16(offset + 28);\n const extraLength = u16(offset + 30);\n const entryCommentLength = u16(offset + 32);\n const localOffset = u32(offset + 42);\n\n if (declared === 0xffffffff || compressed === 0xffffffff || localOffset === 0xffffffff)\n return rejected(\"unsupported\");\n // An encrypted or unusually compressed member is not something a browser will load.\n if ((flags & 1) !== 0 || (method !== STORED && method !== DEFLATED))\n return rejected(\"unsupported\");\n if (nameLength === 0 || nameLength > MAX_NAME_BYTES) return rejected(\"name\");\n if (offset + 46 + nameLength + extraLength + entryCommentLength > limit)\n return rejected(\"malformed\");\n if (localOffset >= directoryOffset) return rejected(\"malformed\");\n\n let name: string;\n\n try {\n name = names.decode(archive.subarray(offset + 46, offset + 46 + nameLength));\n } catch {\n return rejected(\"name\");\n }\n if (unsafeName(name)) return rejected(\"name\");\n\n // The directory must agree with the local header it points at: a member that describes\n // itself differently in two places has no single meaning worth uploading.\n if (localOffset + LOCAL_HEADER_SIZE > directoryOffset || u32(localOffset) !== LOCAL_HEADER)\n return rejected(\"malformed\");\n const localNameLength = u16(localOffset + 26);\n const localStart = localOffset + LOCAL_HEADER_SIZE;\n\n if (\n (u16(localOffset + 6) & 1) !== 0 ||\n u16(localOffset + 8) !== method ||\n localNameLength !== nameLength ||\n localStart + localNameLength + u16(localOffset + 28) + compressed > directoryOffset\n )\n return rejected(\"malformed\");\n\n try {\n if (names.decode(archive.subarray(localStart, localStart + localNameLength)) !== name)\n return rejected(\"malformed\");\n } catch {\n return rejected(\"name\");\n }\n if (name === \"manifest.json\") manifest = true;\n declaredBytes += declared;\n if (declaredBytes > MAX_DECLARED_BYTES) return rejected(\"limit\");\n offset += 46 + nameLength + extraLength + entryCommentLength;\n }\n if (offset !== limit) return rejected(\"malformed\");\n if (!manifest) return rejected(\"manifest\");\n\n return { _tag: \"Accepted\", facts: { entries, declaredBytes } };\n};\n","import { Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport type { ClientError } from \"./Errors.ts\";\nimport { ExtensionError } from \"./Errors.ts\";\nimport { inspectExtensionArchive } from \"./internal/extension/Archive.ts\";\nimport { ExtensionReference, Identifier } from \"./References.ts\";\nimport { SafeFilename } from \"./Transfers.ts\";\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\n\n/** The provider documents a 100 MB archive; a caller may request less, never more. */\nconst MAX_ARCHIVE_BYTES = 100 * 1024 * 1024;\n\nconst ProviderExtension = Schema.Struct({\n id: Identifier,\n projectId: Identifier,\n fileName: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),\n createdAt: Schema.optionalKey(Timestamp),\n updatedAt: Schema.optionalKey(Timestamp),\n});\n\n/** Only fields the provider actually returned are reported; absence is never invented. */\nexport class ExtensionMetadata extends Schema.Class<ExtensionMetadata>(\n \"BrowserbaseExtensionMetadata\",\n)({\n reference: ExtensionReference,\n fileName: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),\n createdAt: Schema.optionalKey(Timestamp),\n updatedAt: Schema.optionalKey(Timestamp),\n}) {}\n\n/** Registration evidence is what this package inspected, not a provider load receipt. */\nexport class ExtensionRegistration extends Schema.Class<ExtensionRegistration>(\n \"BrowserbaseExtensionRegistration\",\n)({\n reference: ExtensionReference,\n archiveBytes: Schema.Natural,\n entries: Schema.Natural,\n declaredBytes: Schema.Natural,\n}) {}\n\nexport interface ExtensionUploadOptions {\n /** Portable basename sent with the part; defaults to `extension.zip`. */\n readonly filename?: string;\n readonly maxBytes?: number;\n readonly timeoutMillis?: number;\n}\n\nconst Upload = Schema.Struct({\n filename: Schema.optionalKey(\n SafeFilename.check(Schema.makeFilter((value) => value.toLowerCase().endsWith(\".zip\"))),\n ),\n maxBytes: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: MAX_ARCHIVE_BYTES })),\n ),\n timeoutMillis: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 600_000 })),\n ),\n});\n\nconst fromClient = (operation: ExtensionError[\"operation\"], error: ClientError): ExtensionError =>\n ExtensionError.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: ExtensionError[\"operation\"]) =>\n ExtensionError.make({ operation, reason: \"configuration\", outcome: \"undispatched\" });\n\nconst malformed = (operation: ExtensionError[\"operation\"], mutation = false) =>\n ExtensionError.make({\n operation,\n reason: \"malformed\",\n ...(mutation ? { outcome: \"unknown\" as const } : {}),\n });\n\n/**\n * A provisioned extension is a durable project resource selected at launch, never uploaded\n * again on connect. The archive is inspected before transport; loading remains the provider's.\n */\nexport class BrowserbaseExtensions extends Context.Service<\n BrowserbaseExtensions,\n {\n readonly register: (\n archive: Uint8Array,\n options?: ExtensionUploadOptions,\n ) => Effect.Effect<ExtensionRegistration, ExtensionError>;\n readonly retrieve: (\n reference: ExtensionReference,\n ) => Effect.Effect<ExtensionMetadata, ExtensionError>;\n readonly delete: (reference: ExtensionReference) => Effect.Effect<void, ExtensionError>;\n }\n>()(\"effect-browserbase/Extensions\") {\n static readonly layer: Layer.Layer<BrowserbaseExtensions, never, BrowserbaseClient> =\n Layer.effect(\n BrowserbaseExtensions,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n\n const validate = Effect.fnUntraced(function* (\n reference: ExtensionReference,\n operation: ExtensionError[\"operation\"],\n ) {\n const ref = yield* Schema.decodeEffect(ExtensionReference)(reference, {\n onExcessProperty: \"error\",\n }).pipe(Effect.mapError(() => configuration(operation)));\n\n if (ref.projectId !== client.projectId)\n return yield* ExtensionError.make({\n operation,\n reason: \"authorization\",\n outcome: \"undispatched\",\n });\n\n return ref;\n });\n\n const register = Effect.fn(\"BrowserbaseExtensions.register\")(function* (\n archive: Uint8Array,\n options: ExtensionUploadOptions = {},\n ) {\n const value = yield* Schema.decodeEffect(Upload)(options, {\n onExcessProperty: \"error\",\n }).pipe(Effect.mapError(() => configuration(\"extension-register\")));\n\n if (!(archive instanceof Uint8Array)) return yield* configuration(\"extension-register\");\n const maxBytes = value.maxBytes ?? MAX_ARCHIVE_BYTES;\n\n if (archive.byteLength < 1 || archive.byteLength > maxBytes)\n return yield* ExtensionError.make({\n operation: \"extension-archive\",\n reason: \"limit\",\n outcome: \"undispatched\",\n });\n\n // Inspect and send the same immutable bytes: a caller cannot swap the\n // archive between its manifest check and the multipart encoding.\n const owned = new Uint8Array(archive);\n const inspected = inspectExtensionArchive(owned);\n\n if (inspected._tag === \"Rejected\") {\n return yield* ExtensionError.make({\n operation: \"extension-archive\",\n reason:\n inspected.reason === \"limit\"\n ? \"limit\"\n : inspected.reason === \"name\"\n ? \"unsafe-filename\"\n : \"configuration\",\n outcome: \"undispatched\",\n });\n }\n\n const raw = yield* client\n .upload(\n \"/v1/extensions\",\n {\n field: \"file\",\n filename: value.filename ?? \"extension.zip\",\n mediaType: \"application/zip\",\n bytes: owned,\n },\n {\n maxBytes,\n ...(value.timeoutMillis === undefined\n ? {}\n : { timeoutMillis: value.timeoutMillis }),\n },\n )\n .pipe(Effect.mapError((error) => fromClient(\"extension-register\", error)));\n\n const created = yield* Schema.decodeUnknownEffect(ProviderExtension)(raw).pipe(\n Effect.mapError(() => malformed(\"extension-register\", true)),\n );\n\n if (created.projectId !== client.projectId)\n return yield* malformed(\"extension-register\", true);\n\n return ExtensionRegistration.make({\n reference: ExtensionReference.make({\n provider: \"browserbase\",\n projectId: client.projectId,\n extensionId: created.id,\n }),\n archiveBytes: owned.byteLength,\n entries: inspected.facts.entries,\n declaredBytes: inspected.facts.declaredBytes,\n });\n });\n\n const retrieve = Effect.fn(\"BrowserbaseExtensions.retrieve\")(function* (\n reference: ExtensionReference,\n ) {\n const ref = yield* validate(reference, \"extension-retrieve\");\n\n const raw = yield* client\n .json(\"GET\", `/v1/extensions/${encodeURIComponent(ref.extensionId)}`)\n .pipe(Effect.mapError((error) => fromClient(\"extension-retrieve\", error)));\n\n const value = yield* Schema.decodeUnknownEffect(ProviderExtension)(raw).pipe(\n Effect.mapError(() => malformed(\"extension-retrieve\")),\n );\n\n if (value.id !== ref.extensionId || value.projectId !== ref.projectId)\n return yield* malformed(\"extension-retrieve\");\n\n return ExtensionMetadata.make({\n reference: ref,\n ...(value.fileName === undefined ? {} : { fileName: value.fileName }),\n ...(value.createdAt === undefined ? {} : { createdAt: value.createdAt }),\n ...(value.updatedAt === undefined ? {} : { updatedAt: value.updatedAt }),\n });\n });\n\n const remove = Effect.fn(\"BrowserbaseExtensions.delete\")(function* (\n reference: ExtensionReference,\n ) {\n const ref = yield* validate(reference, \"extension-delete\");\n\n yield* client\n .noContent(\"DELETE\", `/v1/extensions/${encodeURIComponent(ref.extensionId)}`)\n .pipe(Effect.mapError((error) => fromClient(\"extension-delete\", error)));\n });\n\n return BrowserbaseExtensions.of({ register, retrieve, delete: remove });\n }),\n );\n}\n"],"mappings":";;;;;;;AAuBA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AACvB,MAAM,qBAAqB;AAC3B,MAAM,YAAY;AAClB,MAAM,oBAAoB;AAC1B,MAAM,SAAS;AACf,MAAM,WAAW;AAEjB,MAAM,eAAe;AACrB,MAAM,iBAAiB;AACvB,MAAM,2BAA2B;AAEjC,MAAM,YAAY,YAA6C;CAAE,MAAM;CAAY;AAAO;AAE1F,MAAM,WAAW,SACf,CAAC,GAAG,IAAI,CAAC,CAAC,MAAM,cAAc,YAAY,OAAO,cAAc,GAAM;;AAGvE,MAAM,cAAc,SAClB,KAAK,WAAW,KAChB,KAAK,WAAW,GAAG,KACnB,KAAK,SAAS,IAAI,KAClB,KAAK,SAAS,IAAI,KAClB,aAAa,KAAK,IAAI,KACtB,QAAQ,IAAI,KACZ,KAAK,MAAM,GAAG,CAAC,CAAC,MAAM,YAAY,YAAY,OAA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/Extensions.ts"],"sourcesContent":["/**\n * A bounded, allocation-free inspection of an extension ZIP: enough to prove a root\n * `manifest.json` and reject traversal before an upload, never an extractor. No entry is\n * decompressed and no path is written; the provider remains the loader of record.\n */\nexport interface ArchiveFacts {\n readonly entries: number;\n /** Uncompressed size the central directory itself declares, not a measured expansion. */\n readonly declaredBytes: number;\n}\n\nexport type ArchiveRejection =\n | \"signature\"\n | \"malformed\"\n | \"unsupported\"\n | \"name\"\n | \"manifest\"\n | \"limit\";\n\nexport type ArchiveResult =\n | { readonly _tag: \"Accepted\"; readonly facts: ArchiveFacts }\n | { readonly _tag: \"Rejected\"; readonly reason: ArchiveRejection };\n\nconst MAX_ENTRIES = 4096;\nconst MAX_NAME_BYTES = 512;\nconst MAX_DECLARED_BYTES = 512 * 1024 * 1024;\nconst EOCD_SIZE = 22;\nconst LOCAL_HEADER_SIZE = 30;\nconst STORED = 0;\nconst DEFLATED = 8;\n\nconst LOCAL_HEADER = 0x04034b50;\nconst CENTRAL_HEADER = 0x02014b50;\nconst END_OF_CENTRAL_DIRECTORY = 0x06054b50;\n\nconst rejected = (reason: ArchiveRejection): ArchiveResult => ({ _tag: \"Rejected\", reason });\n\nconst control = (name: string): boolean =>\n [...name].some((character) => character < \" \" || character === \"\\x7f\");\n\n/** Any `..` or rooted member would name a file outside the extension directory. */\nconst unsafeName = (name: string): boolean =>\n name.length === 0 ||\n name.startsWith(\"/\") ||\n name.includes(\"\\\\\") ||\n name.includes(\"//\") ||\n /^[A-Za-z]:/.test(name) ||\n control(name) ||\n name.split(\"/\").some((segment) => segment === \".\" || segment === \"..\");\n\nexport const inspectExtensionArchive = (archive: Uint8Array): ArchiveResult => {\n if (archive.byteLength < EOCD_SIZE) return rejected(\"malformed\");\n const view = new DataView(archive.buffer, archive.byteOffset, archive.byteLength);\n const u16 = (offset: number) => view.getUint16(offset, true);\n const u32 = (offset: number) => view.getUint32(offset, true);\n\n if (u32(0) !== LOCAL_HEADER) return rejected(\"signature\");\n\n // The comment is bounded by its own 16-bit length, so the record cannot hide further back.\n const earliest = Math.max(0, archive.byteLength - EOCD_SIZE - 0xffff);\n let end = -1;\n\n for (let offset = archive.byteLength - EOCD_SIZE; offset >= earliest; offset--) {\n if (u32(offset) === END_OF_CENTRAL_DIRECTORY) {\n end = offset;\n break;\n }\n }\n if (end < 0) return rejected(\"malformed\");\n\n const entries = u16(end + 10);\n const directorySize = u32(end + 12);\n const directoryOffset = u32(end + 16);\n const commentLength = u16(end + 20);\n\n if (u16(end + 4) !== 0 || u16(end + 6) !== 0 || u16(end + 8) !== entries)\n return rejected(\"unsupported\");\n if (entries === 0xffff || directorySize === 0xffffffff || directoryOffset === 0xffffffff)\n return rejected(\"unsupported\");\n if (end + EOCD_SIZE + commentLength !== archive.byteLength) return rejected(\"malformed\");\n if (directoryOffset + directorySize > end) return rejected(\"malformed\");\n if (entries > MAX_ENTRIES) return rejected(\"limit\");\n\n const names = new TextDecoder(\"utf-8\", { fatal: true });\n const limit = directoryOffset + directorySize;\n let offset = directoryOffset;\n let declaredBytes = 0;\n let manifest = false;\n\n for (let index = 0; index < entries; index++) {\n if (offset + 46 > limit || u32(offset) !== CENTRAL_HEADER) return rejected(\"malformed\");\n const flags = u16(offset + 8);\n const method = u16(offset + 10);\n const compressed = u32(offset + 20);\n const declared = u32(offset + 24);\n const nameLength = u16(offset + 28);\n const extraLength = u16(offset + 30);\n const entryCommentLength = u16(offset + 32);\n const localOffset = u32(offset + 42);\n\n if (declared === 0xffffffff || compressed === 0xffffffff || localOffset === 0xffffffff)\n return rejected(\"unsupported\");\n // An encrypted or unusually compressed member is not something a browser will load.\n if ((flags & 1) !== 0 || (method !== STORED && method !== DEFLATED))\n return rejected(\"unsupported\");\n if (nameLength === 0 || nameLength > MAX_NAME_BYTES) return rejected(\"name\");\n if (offset + 46 + nameLength + extraLength + entryCommentLength > limit)\n return rejected(\"malformed\");\n if (localOffset >= directoryOffset) return rejected(\"malformed\");\n\n let name: string;\n\n try {\n name = names.decode(archive.subarray(offset + 46, offset + 46 + nameLength));\n } catch {\n return rejected(\"name\");\n }\n if (unsafeName(name)) return rejected(\"name\");\n\n // The directory must agree with the local header it points at: a member that describes\n // itself differently in two places has no single meaning worth uploading.\n if (localOffset + LOCAL_HEADER_SIZE > directoryOffset || u32(localOffset) !== LOCAL_HEADER)\n return rejected(\"malformed\");\n const localNameLength = u16(localOffset + 26);\n const localStart = localOffset + LOCAL_HEADER_SIZE;\n\n if (\n (u16(localOffset + 6) & 1) !== 0 ||\n u16(localOffset + 8) !== method ||\n localNameLength !== nameLength ||\n localStart + localNameLength + u16(localOffset + 28) + compressed > directoryOffset\n )\n return rejected(\"malformed\");\n\n try {\n if (names.decode(archive.subarray(localStart, localStart + localNameLength)) !== name)\n return rejected(\"malformed\");\n } catch {\n return rejected(\"name\");\n }\n if (name === \"manifest.json\") manifest = true;\n declaredBytes += declared;\n if (declaredBytes > MAX_DECLARED_BYTES) return rejected(\"limit\");\n offset += 46 + nameLength + extraLength + entryCommentLength;\n }\n if (offset !== limit) return rejected(\"malformed\");\n if (!manifest) return rejected(\"manifest\");\n\n return { _tag: \"Accepted\", facts: { entries, declaredBytes } };\n};\n","import { Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport type { ClientError } from \"./Errors.ts\";\nimport { ExtensionError } from \"./Errors.ts\";\nimport { inspectExtensionArchive } from \"./internal/extension/Archive.ts\";\nimport { ExtensionReference, Identifier } from \"./References.ts\";\nimport { SafeFilename } from \"./Transfers.ts\";\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\n\n/** The provider documents a 100 MB archive; a caller may request less, never more. */\nconst MAX_ARCHIVE_BYTES = 100 * 1024 * 1024;\n\nconst ProviderExtension = Schema.Struct({\n id: Identifier,\n projectId: Identifier,\n fileName: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),\n createdAt: Schema.optionalKey(Timestamp),\n updatedAt: Schema.optionalKey(Timestamp),\n});\n\n/** Only fields the provider actually returned are reported; absence is never invented. */\nexport class ExtensionMetadata extends Schema.Class<ExtensionMetadata>(\n \"BrowserbaseExtensionMetadata\",\n)({\n reference: ExtensionReference,\n fileName: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),\n createdAt: Schema.optionalKey(Timestamp),\n updatedAt: Schema.optionalKey(Timestamp),\n}) {}\n\n/** Registration evidence is what this package inspected, not a provider load receipt. */\nexport class ExtensionRegistration extends Schema.Class<ExtensionRegistration>(\n \"BrowserbaseExtensionRegistration\",\n)({\n reference: ExtensionReference,\n archiveBytes: Schema.Natural,\n entries: Schema.Natural,\n declaredBytes: Schema.Natural,\n}) {}\n\nexport interface ExtensionUploadOptions {\n /** Portable basename sent with the part; defaults to `extension.zip`. */\n readonly filename?: string;\n readonly maxBytes?: number;\n readonly timeoutMillis?: number;\n}\n\nconst Upload = Schema.Struct({\n filename: Schema.optionalKey(\n SafeFilename.check(Schema.makeFilter((value) => value.toLowerCase().endsWith(\".zip\"))),\n ),\n maxBytes: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: MAX_ARCHIVE_BYTES })),\n ),\n timeoutMillis: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 600_000 })),\n ),\n});\n\nconst fromClient = (operation: ExtensionError[\"operation\"], error: ClientError): ExtensionError =>\n ExtensionError.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: ExtensionError[\"operation\"]) =>\n ExtensionError.make({ operation, reason: \"configuration\", outcome: \"undispatched\" });\n\nconst malformed = (operation: ExtensionError[\"operation\"], mutation = false) =>\n ExtensionError.make({\n operation,\n reason: \"malformed\",\n ...(mutation ? { outcome: \"unknown\" as const } : {}),\n });\n\n/**\n * A provisioned extension is a durable project resource selected at launch, never uploaded\n * again on connect. The archive is inspected before transport; loading remains the provider's.\n */\nexport class BrowserbaseExtensions extends Context.Service<\n BrowserbaseExtensions,\n {\n readonly register: (\n archive: Uint8Array,\n options?: ExtensionUploadOptions,\n ) => Effect.Effect<ExtensionRegistration, ExtensionError>;\n readonly retrieve: (\n reference: ExtensionReference,\n ) => Effect.Effect<ExtensionMetadata, ExtensionError>;\n readonly delete: (reference: ExtensionReference) => Effect.Effect<void, ExtensionError>;\n }\n>()(\"effect-browserbase/Extensions\") {\n static readonly layer: Layer.Layer<BrowserbaseExtensions, never, BrowserbaseClient> =\n Layer.effect(\n BrowserbaseExtensions,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n\n const validate = Effect.fnUntraced(function* (\n reference: ExtensionReference,\n operation: ExtensionError[\"operation\"],\n ) {\n const ref = yield* Schema.decodeEffect(ExtensionReference)(reference, {\n onExcessProperty: \"error\",\n }).pipe(Effect.mapError(() => configuration(operation)));\n\n if (ref.projectId !== client.projectId)\n return yield* ExtensionError.make({\n operation,\n reason: \"authorization\",\n outcome: \"undispatched\",\n });\n\n return ref;\n });\n\n const register = Effect.fn(\"BrowserbaseExtensions.register\")(function* (\n archive: Uint8Array,\n options: ExtensionUploadOptions = {},\n ) {\n const value = yield* Schema.decodeEffect(Upload)(options, {\n onExcessProperty: \"error\",\n }).pipe(Effect.mapError(() => configuration(\"extension-register\")));\n\n if (!(archive instanceof Uint8Array)) return yield* configuration(\"extension-register\");\n const maxBytes = value.maxBytes ?? MAX_ARCHIVE_BYTES;\n\n if (archive.byteLength < 1 || archive.byteLength > maxBytes)\n return yield* ExtensionError.make({\n operation: \"extension-archive\",\n reason: \"limit\",\n outcome: \"undispatched\",\n });\n\n // Inspect and send the same immutable bytes: a caller cannot swap the\n // archive between its manifest check and the multipart encoding.\n const owned = new Uint8Array(archive);\n const inspected = inspectExtensionArchive(owned);\n\n if (inspected._tag === \"Rejected\") {\n return yield* ExtensionError.make({\n operation: \"extension-archive\",\n reason:\n inspected.reason === \"limit\"\n ? \"limit\"\n : inspected.reason === \"name\"\n ? \"unsafe-filename\"\n : \"configuration\",\n outcome: \"undispatched\",\n });\n }\n\n const raw = yield* client\n .upload(\n \"/v1/extensions\",\n {\n field: \"file\",\n filename: value.filename ?? \"extension.zip\",\n mediaType: \"application/zip\",\n bytes: owned,\n },\n {\n maxBytes,\n ...(value.timeoutMillis === undefined\n ? {}\n : { timeoutMillis: value.timeoutMillis }),\n },\n )\n .pipe(Effect.mapError((error) => fromClient(\"extension-register\", error)));\n\n const created = yield* Schema.decodeUnknownEffect(ProviderExtension)(raw).pipe(\n Effect.mapError(() => malformed(\"extension-register\", true)),\n );\n\n if (created.projectId !== client.projectId)\n return yield* malformed(\"extension-register\", true);\n\n return ExtensionRegistration.make({\n reference: ExtensionReference.make({\n provider: \"browserbase\",\n projectId: client.projectId,\n extensionId: created.id,\n }),\n archiveBytes: owned.byteLength,\n entries: inspected.facts.entries,\n declaredBytes: inspected.facts.declaredBytes,\n });\n });\n\n const retrieve = Effect.fn(\"BrowserbaseExtensions.retrieve\")(function* (\n reference: ExtensionReference,\n ) {\n const ref = yield* validate(reference, \"extension-retrieve\");\n\n const raw = yield* client\n .json(\"GET\", `/v1/extensions/${encodeURIComponent(ref.extensionId)}`)\n .pipe(Effect.mapError((error) => fromClient(\"extension-retrieve\", error)));\n\n const value = yield* Schema.decodeUnknownEffect(ProviderExtension)(raw).pipe(\n Effect.mapError(() => malformed(\"extension-retrieve\")),\n );\n\n if (value.id !== ref.extensionId || value.projectId !== ref.projectId)\n return yield* malformed(\"extension-retrieve\");\n\n return ExtensionMetadata.make({\n reference: ref,\n ...(value.fileName === undefined ? {} : { fileName: value.fileName }),\n ...(value.createdAt === undefined ? {} : { createdAt: value.createdAt }),\n ...(value.updatedAt === undefined ? {} : { updatedAt: value.updatedAt }),\n });\n });\n\n const remove = Effect.fn(\"BrowserbaseExtensions.delete\")(function* (\n reference: ExtensionReference,\n ) {\n const ref = yield* validate(reference, \"extension-delete\");\n\n yield* client\n .noContent(\"DELETE\", `/v1/extensions/${encodeURIComponent(ref.extensionId)}`)\n .pipe(Effect.mapError((error) => fromClient(\"extension-delete\", error)));\n });\n\n return BrowserbaseExtensions.of({ register, retrieve, delete: remove });\n }),\n );\n}\n"],"mappings":";;;;;;AAuBA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AACvB,MAAM,qBAAqB;AAC3B,MAAM,YAAY;AAClB,MAAM,oBAAoB;AAC1B,MAAM,SAAS;AACf,MAAM,WAAW;AAEjB,MAAM,eAAe;AACrB,MAAM,iBAAiB;AACvB,MAAM,2BAA2B;AAEjC,MAAM,YAAY,YAA6C;CAAE,MAAM;CAAY;AAAO;AAE1F,MAAM,WAAW,SACf,CAAC,GAAG,IAAI,CAAC,CAAC,MAAM,cAAc,YAAY,OAAO,cAAc,GAAM;;AAGvE,MAAM,cAAc,SAClB,KAAK,WAAW,KAChB,KAAK,WAAW,GAAG,KACnB,KAAK,SAAS,IAAI,KAClB,KAAK,SAAS,IAAI,KAClB,aAAa,KAAK,IAAI,KACtB,QAAQ,IAAI,KACZ,KAAK,MAAM,GAAG,CAAC,CAAC,MAAM,YAAY,YAAY,OAAO,YAAY,IAAI;AAEvE,MAAa,2BAA2B,YAAuC;CAC7E,IAAI,QAAQ,aAAa,WAAW,OAAO,SAAS,WAAW;CAC/D,MAAM,OAAO,IAAI,SAAS,QAAQ,QAAQ,QAAQ,YAAY,QAAQ,UAAU;CAChF,MAAM,OAAO,WAAmB,KAAK,UAAU,QAAQ,IAAI;CAC3D,MAAM,OAAO,WAAmB,KAAK,UAAU,QAAQ,IAAI;CAE3D,IAAI,IAAI,CAAC,MAAM,cAAc,OAAO,SAAS,WAAW;CAGxD,MAAM,WAAW,KAAK,IAAI,GAAG,QAAQ,aAAa,YAAY,KAAM;CACpE,IAAI,MAAM;CAEV,KAAK,IAAI,SAAS,QAAQ,aAAa,WAAW,UAAU,UAAU,UACpE,IAAI,IAAI,MAAM,MAAM,0BAA0B;EAC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OAAO,OAAO,UAAU,oBAAoB;GAE9C,OAAO,kBAAkB,KAAK;IAC5B,WAAW;IACX,GAAI,MAAM,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,MAAM,SAAS;IACnE,GAAI,MAAM,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,MAAM,UAAU;IACtE,GAAI,MAAM,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,MAAM,UAAU;GACxE,CAAC;EACH,CAAC;EAED,MAAM,SAAS,OAAO,GAAG,8BAA8B,CAAC,CAAC,WACvD,WACA;GACA,MAAM,MAAM,OAAO,SAAS,WAAW,kBAAkB;GAEzD,OAAO,OACJ,UAAU,UAAU,kBAAkB,mBAAmB,IAAI,WAAW,GAAG,CAAC,CAC5E,KAAK,OAAO,UAAU,UAAU,WAAW,oBAAoB,KAAK,CAAC,CAAC;EAC3E,CAAC;EAED,OAAO,sBAAsB,GAAG;GAAE;GAAU;GAAU,QAAQ;EAAO,CAAC;CACxE,CAAC,CACH;AACJ"}
|
package/dist/Extensions.d.mts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { r as ExtensionReference } from "./References-
|
|
1
|
+
import { r as ExtensionReference } from "./References-DOH3Wu44.mjs";
|
|
2
2
|
import { ExtensionError } from "./Errors.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { BrowserbaseClient } from "./Client.mjs";
|
|
4
4
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
5
|
-
|
|
6
|
-
export { BrowserbaseExtensions, ExtensionMetadata, ExtensionRegistration, ExtensionUploadOptions };
|
|
7
|
-
}
|
|
5
|
+
//#region src/Extensions.d.ts
|
|
8
6
|
declare const ExtensionMetadata_base: Schema.Class<ExtensionMetadata, Schema.Struct<{
|
|
9
7
|
readonly reference: typeof ExtensionReference;
|
|
10
8
|
readonly fileName: Schema.optionalKey<Schema.String>;
|
|
@@ -40,5 +38,5 @@ export declare class BrowserbaseExtensions extends BrowserbaseExtensions_base {
|
|
|
40
38
|
static readonly layer: Layer.Layer<BrowserbaseExtensions, never, BrowserbaseClient>;
|
|
41
39
|
}
|
|
42
40
|
//#endregion
|
|
43
|
-
export {
|
|
41
|
+
export {};
|
|
44
42
|
//# sourceMappingURL=Extensions.d.mts.map
|
package/dist/Extensions.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as ExtensionMetadata, r as ExtensionRegistration, t as BrowserbaseExtensions } from "./Extensions-
|
|
1
|
+
import { n as ExtensionMetadata, r as ExtensionRegistration, t as BrowserbaseExtensions } from "./Extensions-nMNMPGCc.mjs";
|
|
2
2
|
export { BrowserbaseExtensions, ExtensionMetadata, ExtensionRegistration };
|
package/dist/Functions.d.mts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { n as ContextReference } from "./References-
|
|
1
|
+
import { n as ContextReference } from "./References-DOH3Wu44.mjs";
|
|
2
2
|
import { PlatformError } from "./Errors.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { BrowserbaseClient } from "./Client.mjs";
|
|
4
4
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
5
|
-
|
|
6
|
-
export { BrowserbaseFunctions, FunctionBuild, FunctionInvocation, FunctionInvokeRequest, FunctionLogLine, FunctionMetadata, FunctionPageQuery, FunctionSessionParams, FunctionStatus, FunctionStatusQuery, FunctionVersion, FunctionWaitOptions, OffsetPage };
|
|
7
|
-
}
|
|
5
|
+
//#region src/Functions.d.ts
|
|
8
6
|
declare const Status: Schema.Literals<readonly ["PENDING", "RUNNING", "COMPLETED", "FAILED"]>;
|
|
9
7
|
export type FunctionStatus = typeof Status.Type;
|
|
10
8
|
declare const FunctionMetadata_base: Schema.Class<FunctionMetadata, Schema.Struct<{
|
|
@@ -223,5 +221,5 @@ export declare class BrowserbaseFunctions extends BrowserbaseFunctions_base {
|
|
|
223
221
|
static readonly layer: Layer.Layer<BrowserbaseFunctions, never, BrowserbaseClient>;
|
|
224
222
|
}
|
|
225
223
|
//#endregion
|
|
226
|
-
export {
|
|
224
|
+
export {};
|
|
227
225
|
//# sourceMappingURL=Functions.d.mts.map
|
package/dist/Functions.mjs
CHANGED
|
@@ -1,26 +1,12 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
1
|
import { ContextReference, Identifier } from "./References.mjs";
|
|
3
2
|
import { PlatformError } from "./Errors.mjs";
|
|
4
|
-
import { t as BrowserbaseClient } from "./Client-
|
|
3
|
+
import { t as BrowserbaseClient } from "./Client-BQteUePT.mjs";
|
|
5
4
|
import { t as resource } from "./Resource-DBksC4zB.mjs";
|
|
6
5
|
import { ProxyRule } from "./Launch.mjs";
|
|
7
|
-
import { n as proxy } from "./Launch-
|
|
6
|
+
import { n as proxy } from "./Launch-m0fxzJ49.mjs";
|
|
8
7
|
import { n as isContextWriterBusy } from "./ContextWriter-BrQmoXRg.mjs";
|
|
9
8
|
import { Clock, Context, Effect, Layer, Schema } from "effect";
|
|
10
9
|
//#region src/Functions.ts
|
|
11
|
-
var Functions_exports = /* @__PURE__ */ __exportAll({
|
|
12
|
-
BrowserbaseFunctions: () => BrowserbaseFunctions,
|
|
13
|
-
FunctionBuild: () => FunctionBuild,
|
|
14
|
-
FunctionInvocation: () => FunctionInvocation,
|
|
15
|
-
FunctionInvokeRequest: () => FunctionInvokeRequest,
|
|
16
|
-
FunctionLogLine: () => FunctionLogLine,
|
|
17
|
-
FunctionMetadata: () => FunctionMetadata,
|
|
18
|
-
FunctionPageQuery: () => FunctionPageQuery,
|
|
19
|
-
FunctionSessionParams: () => FunctionSessionParams,
|
|
20
|
-
FunctionStatusQuery: () => FunctionStatusQuery,
|
|
21
|
-
FunctionVersion: () => FunctionVersion,
|
|
22
|
-
FunctionWaitOptions: () => FunctionWaitOptions
|
|
23
|
-
});
|
|
24
10
|
const Timestamp = Schema.String.check(Schema.isMaxLength(64));
|
|
25
11
|
const JsonObject = Schema.Record(Schema.String, Schema.Json);
|
|
26
12
|
const Name = Schema.String.check(Schema.isMaxLength(1024));
|
|
@@ -327,6 +313,6 @@ var BrowserbaseFunctions = class BrowserbaseFunctions extends Context.Service()(
|
|
|
327
313
|
}));
|
|
328
314
|
};
|
|
329
315
|
//#endregion
|
|
330
|
-
export { BrowserbaseFunctions, FunctionBuild, FunctionInvocation, FunctionInvokeRequest, FunctionLogLine, FunctionMetadata, FunctionPageQuery, FunctionSessionParams, FunctionStatusQuery, FunctionVersion, FunctionWaitOptions
|
|
316
|
+
export { BrowserbaseFunctions, FunctionBuild, FunctionInvocation, FunctionInvokeRequest, FunctionLogLine, FunctionMetadata, FunctionPageQuery, FunctionSessionParams, FunctionStatusQuery, FunctionVersion, FunctionWaitOptions };
|
|
331
317
|
|
|
332
318
|
//# sourceMappingURL=Functions.mjs.map
|
package/dist/Functions.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Functions.mjs","names":[],"sources":["../src/Functions.ts"],"sourcesContent":["import { Clock, Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { PlatformError } from \"./Errors.ts\";\nimport { resource } from \"./internal/http/Resource.ts\";\nimport { proxy } from \"./internal/provider/Launch.ts\";\nimport { isContextWriterBusy } from \"./internal/session/ContextWriter.ts\";\nimport { ProxyRule } from \"./Launch.ts\";\nimport { ContextReference, Identifier } from \"./References.ts\";\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\nconst JsonObject = Schema.Record(Schema.String, Schema.Json);\nconst Name = Schema.String.check(Schema.isMaxLength(1024));\nconst Status = Schema.Literals([\"PENDING\", \"RUNNING\", \"COMPLETED\", \"FAILED\"]);\n\nexport type FunctionStatus = typeof Status.Type;\n\nexport class FunctionMetadata extends Schema.Class<FunctionMetadata>(\"BrowserbaseFunctionMetadata\")(\n {\n id: Identifier,\n projectId: Identifier,\n name: Name,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n },\n) {}\n\nexport class FunctionVersion extends Schema.Class<FunctionVersion>(\"BrowserbaseFunctionVersion\")({\n id: Identifier,\n projectId: Identifier,\n functionId: Identifier,\n functionBuildId: Identifier,\n sessionCreateParams: Schema.optionalKey(JsonObject),\n userParamsSchema: Schema.optionalKey(JsonObject),\n createdAt: Timestamp,\n updatedAt: Timestamp,\n}) {}\n\nexport class FunctionBuild extends Schema.Class<FunctionBuild>(\"BrowserbaseFunctionBuild\")({\n id: Identifier,\n projectId: Identifier,\n request: Schema.Struct({\n entrypoint: Name,\n functionNames: Schema.optionalKey(Schema.Array(Name).check(Schema.isMaxLength(1024))),\n }),\n status: Status,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n startedAt: Timestamp,\n endedAt: Schema.optionalKey(Timestamp),\n expiresAt: Timestamp,\n cause: Schema.optionalKey(\n Schema.Struct({\n code: Schema.String.check(Schema.isMaxLength(64)),\n message: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(4096))),\n }),\n ),\n}) {}\n\nexport class FunctionInvocation extends Schema.Class<FunctionInvocation>(\n \"BrowserbaseFunctionInvocation\",\n)({\n id: Identifier,\n projectId: Identifier,\n functionId: Identifier,\n versionId: Identifier,\n sessionId: Identifier,\n region: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(64))),\n params: Schema.optionalKey(JsonObject),\n status: Status,\n results: Schema.optionalKey(Schema.Json),\n cause: Schema.optionalKey(\n Schema.Struct({\n code: Schema.String.check(Schema.isMaxLength(64)),\n message: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(4096))),\n }),\n ),\n createdAt: Timestamp,\n updatedAt: Timestamp,\n startedAt: Timestamp,\n endedAt: Schema.optionalKey(Timestamp),\n expiresAt: Timestamp,\n}) {}\n\nexport class FunctionLogLine extends Schema.Class<FunctionLogLine>(\"BrowserbaseFunctionLogLine\")({\n message: Schema.String.check(Schema.isMaxLength(65_536)),\n timestamp: Schema.Finite,\n}) {}\n\n/** The session a Function invocation runs in; the provider's invoke-time subset. */\nexport const FunctionSessionParams = Schema.Struct({\n /** Seconds, 60–900; the provider defaults to 900. */\n timeout: Schema.optionalKey(Schema.Int.check(Schema.isBetween({ minimum: 60, maximum: 900 }))),\n extensionId: Schema.optionalKey(Identifier),\n context: Schema.optionalKey(\n Schema.Struct({ reference: ContextReference, persist: Schema.Boolean }),\n ),\n proxies: Schema.optionalKey(\n Schema.Union([Schema.Boolean, Schema.Array(ProxyRule).check(Schema.isMaxLength(64))]),\n ),\n proxySettings: Schema.optionalKey(\n Schema.Struct({\n caCertificates: Schema.optionalKey(\n Schema.Array(Identifier).check(Schema.isMaxLength(64), Schema.isUnique()),\n ),\n }),\n ),\n userMetadata: Schema.optionalKey(\n Schema.Record(Schema.String.check(Schema.isMaxLength(128)), Schema.Json),\n ),\n browserSettings: Schema.optionalKey(\n Schema.Struct({\n viewport: Schema.optionalKey(\n Schema.Struct({\n width: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 8192 })),\n ),\n height: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 8192 })),\n ),\n }),\n ),\n blockAds: Schema.optionalKey(Schema.Boolean),\n solveCaptchas: Schema.optionalKey(Schema.Boolean),\n recordSession: Schema.optionalKey(Schema.Boolean),\n logSession: Schema.optionalKey(Schema.Boolean),\n verified: Schema.optionalKey(Schema.Boolean),\n captchaImageSelector: Schema.optionalKey(\n Schema.NonEmptyString.check(Schema.isMaxLength(1024)),\n ),\n captchaInputSelector: Schema.optionalKey(\n Schema.NonEmptyString.check(Schema.isMaxLength(1024)),\n ),\n os: Schema.optionalKey(Schema.Literals([\"windows\", \"mac\", \"linux\", \"mobile\", \"tablet\"])),\n size: Schema.optionalKey(Schema.Literals([\"small\", \"medium\", \"large\"])),\n enableNativeSelectPolyfill: Schema.optionalKey(Schema.Boolean),\n enablePdfViewer: Schema.optionalKey(Schema.Boolean),\n extensions: Schema.optionalKey(\n Schema.Array(Schema.Literals([\"onepassword\", \"browser-events\"])).check(Schema.isUnique()),\n ),\n allowedDomains: Schema.optionalKey(\n Schema.Array(Schema.NonEmptyString.check(Schema.isMaxLength(1024))).check(\n Schema.isMaxLength(64),\n Schema.isUnique(),\n ),\n ),\n ignoreCertificateErrors: Schema.optionalKey(Schema.Boolean),\n }),\n ),\n});\n\nexport type FunctionSessionParams = typeof FunctionSessionParams.Type;\n\nexport const FunctionInvokeRequest = Schema.Struct({\n params: Schema.optionalKey(JsonObject),\n session: Schema.optionalKey(FunctionSessionParams),\n});\n\nexport type FunctionInvokeRequest = typeof FunctionInvokeRequest.Type;\n\nconst Offset = {\n offset: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 0, maximum: 1_000_000 })),\n ),\n limit: Schema.optionalKey(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 }))),\n};\n\nexport const FunctionPageQuery = Schema.Struct(Offset);\nexport type FunctionPageQuery = typeof FunctionPageQuery.Type;\n\nexport const FunctionStatusQuery = Schema.Struct({ ...Offset, status: Schema.optionalKey(Status) });\nexport type FunctionStatusQuery = typeof FunctionStatusQuery.Type;\n\nexport const FunctionWaitOptions = Schema.Struct({\n timeoutMillis: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 3_600_000 })),\n pollIntervalMillis: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 250, maximum: 60_000 })),\n ),\n});\n\nexport type FunctionWaitOptions = typeof FunctionWaitOptions.Type;\n\nexport interface OffsetPage<A> {\n readonly items: ReadonlyArray<A>;\n readonly total: number;\n}\n\nconst DataPage = <S extends Schema.Top>(item: S) =>\n Schema.Struct({ data: Schema.Array(item).check(Schema.isMaxLength(100)), total: Schema.Natural });\n\nconst ResultsPage = <S extends Schema.Top>(item: S) =>\n Schema.Struct({\n results: Schema.Array(item).check(Schema.isMaxLength(100)),\n total: Schema.Natural,\n });\n\nconst Logs = Schema.Struct({\n logs: Schema.Array(FunctionLogLine).check(Schema.isMaxLength(100_000)),\n total: Schema.Natural,\n});\n\nconst now = Clock.monotonicTimeNanos.pipe(Effect.map((value) => Number(value) / 1_000_000));\n\n/**\n * Browserbase Functions: deployed code invoked in a provider-allocated session. Deployment\n * happens through Browserbase's CLI; this service reads, invokes and observes. `invoke` is\n * never retried, and a lost reply is `outcome: \"unknown\"`.\n */\nexport class BrowserbaseFunctions extends Context.Service<\n BrowserbaseFunctions,\n {\n readonly list: (\n query?: FunctionPageQuery,\n ) => Effect.Effect<OffsetPage<FunctionMetadata>, PlatformError>;\n readonly retrieve: (functionId: string) => Effect.Effect<FunctionMetadata, PlatformError>;\n readonly invoke: (\n functionId: string,\n request?: FunctionInvokeRequest,\n ) => Effect.Effect<FunctionInvocation, PlatformError>;\n readonly versions: (\n functionId: string,\n query?: FunctionPageQuery,\n ) => Effect.Effect<OffsetPage<FunctionVersion>, PlatformError>;\n readonly version: (versionId: string) => Effect.Effect<FunctionVersion, PlatformError>;\n readonly invocations: (\n versionId: string,\n query?: FunctionStatusQuery,\n ) => Effect.Effect<OffsetPage<FunctionInvocation>, PlatformError>;\n readonly invocation: (invocationId: string) => Effect.Effect<FunctionInvocation, PlatformError>;\n readonly invocationLogs: (\n invocationId: string,\n ) => Effect.Effect<OffsetPage<FunctionLogLine>, PlatformError>;\n readonly builds: (\n query?: FunctionStatusQuery,\n ) => Effect.Effect<OffsetPage<FunctionBuild>, PlatformError>;\n readonly build: (buildId: string) => Effect.Effect<FunctionBuild, PlatformError>;\n readonly buildLogs: (\n buildId: string,\n ) => Effect.Effect<OffsetPage<FunctionLogLine>, PlatformError>;\n /** Polls until the invocation is terminal. Interrupting the wait does not cancel it. */\n readonly waitForInvocation: (\n invocationId: string,\n options: FunctionWaitOptions,\n ) => Effect.Effect<FunctionInvocation, PlatformError>;\n }\n>()(\"effect-browserbase/Functions\") {\n static readonly layer: Layer.Layer<BrowserbaseFunctions, never, BrowserbaseClient> = Layer.effect(\n BrowserbaseFunctions,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n\n const api = resource<PlatformError>(client, (failure) =>\n PlatformError.make({ ...failure, service: \"functions\" }),\n );\n\n /** Every record names its project; a foreign or mismatched one is malformed. */\n const owned =\n <A extends { readonly id: string; readonly projectId: string }>(\n operation: PlatformError[\"operation\"],\n mutation: boolean,\n expected?: string,\n ) =>\n (value: A): Effect.Effect<A, PlatformError> =>\n value.projectId === client.projectId && (expected === undefined || value.id === expected)\n ? Effect.succeed(value)\n : Effect.fail(api.malformed(operation, mutation));\n\n const id = (value: string, operation: PlatformError[\"operation\"]) =>\n api.input(Identifier, value, operation);\n\n const list = Effect.fn(\"BrowserbaseFunctions.list\")(function* (\n query: FunctionPageQuery = {},\n ) {\n const value = yield* api.input(FunctionPageQuery, query, \"function-list\");\n\n const page = yield* api.request(\n \"GET\",\n `/v1/functions${api.query(value)}`,\n DataPage(FunctionMetadata),\n \"function-list\",\n );\n\n return {\n items: yield* Effect.forEach(page.data, owned(\"function-list\", false)),\n total: page.total,\n };\n });\n\n const retrieve = Effect.fn(\"BrowserbaseFunctions.retrieve\")(function* (functionId: string) {\n const checked = yield* id(functionId, \"function-retrieve\");\n\n return yield* api\n .request(\n \"GET\",\n `/v1/functions/${api.segment(checked)}`,\n FunctionMetadata,\n \"function-retrieve\",\n )\n .pipe(Effect.flatMap(owned(\"function-retrieve\", false, checked)));\n });\n\n const invoke = Effect.fn(\"BrowserbaseFunctions.invoke\")(function* (\n functionId: string,\n request: FunctionInvokeRequest = {},\n ) {\n const checked = yield* id(functionId, \"function-invoke\");\n const value = yield* api.input(FunctionInvokeRequest, request, \"function-invoke\");\n const session = value.session;\n const context = session?.context;\n\n if (context !== undefined) {\n if (context.reference.projectId !== client.projectId)\n return yield* api.make({\n operation: \"function-invoke\",\n reason: \"authorization\",\n outcome: \"undispatched\",\n });\n if (context.persist && isContextWriterBusy(context.reference))\n return yield* api.make({\n operation: \"function-invoke\",\n reason: \"active\",\n outcome: \"undispatched\",\n });\n }\n\n const sessionCreateParams: Schema.Json | undefined =\n session === undefined\n ? undefined\n : {\n ...(session.timeout === undefined ? {} : { timeout: session.timeout }),\n ...(session.extensionId === undefined ? {} : { extensionId: session.extensionId }),\n ...(session.proxies === undefined\n ? {}\n : {\n proxies:\n typeof session.proxies === \"boolean\"\n ? session.proxies\n : session.proxies.map(proxy),\n }),\n ...(session.proxySettings === undefined\n ? {}\n : { proxySettings: session.proxySettings }),\n ...(session.userMetadata === undefined\n ? {}\n : { userMetadata: session.userMetadata }),\n ...(session.browserSettings === undefined && context === undefined\n ? {}\n : {\n browserSettings: {\n ...session.browserSettings,\n ...(context === undefined\n ? {}\n : {\n context: {\n id: context.reference.contextId,\n persist: context.persist,\n },\n }),\n },\n }),\n };\n\n return yield* api\n .request(\n \"POST\",\n `/v1/functions/${api.segment(checked)}/invoke`,\n FunctionInvocation,\n \"function-invoke\",\n {\n ...(value.params === undefined ? {} : { params: value.params }),\n ...(sessionCreateParams === undefined ? {} : { sessionCreateParams }),\n },\n )\n .pipe(Effect.flatMap(owned(\"function-invoke\", true)));\n });\n\n const versions = Effect.fn(\"BrowserbaseFunctions.versions\")(function* (\n functionId: string,\n query: FunctionPageQuery = {},\n ) {\n const checked = yield* id(functionId, \"function-versions\");\n const value = yield* api.input(FunctionPageQuery, query, \"function-versions\");\n\n const page = yield* api.request(\n \"GET\",\n `/v1/functions/${api.segment(checked)}/versions${api.query(value)}`,\n ResultsPage(FunctionVersion),\n \"function-versions\",\n );\n\n return {\n items: yield* Effect.forEach(page.results, owned(\"function-versions\", false)),\n total: page.total,\n };\n });\n\n const version = Effect.fn(\"BrowserbaseFunctions.version\")(function* (versionId: string) {\n const checked = yield* id(versionId, \"function-version\");\n\n return yield* api\n .request(\n \"GET\",\n `/v1/functions/versions/${api.segment(checked)}`,\n FunctionVersion,\n \"function-version\",\n )\n .pipe(Effect.flatMap(owned(\"function-version\", false, checked)));\n });\n\n const invocations = Effect.fn(\"BrowserbaseFunctions.invocations\")(function* (\n versionId: string,\n query: FunctionStatusQuery = {},\n ) {\n const checked = yield* id(versionId, \"function-invocations\");\n const value = yield* api.input(FunctionStatusQuery, query, \"function-invocations\");\n\n const page = yield* api.request(\n \"GET\",\n `/v1/functions/versions/${api.segment(checked)}/invocations${api.query(value)}`,\n ResultsPage(FunctionInvocation),\n \"function-invocations\",\n );\n\n return {\n items: yield* Effect.forEach(page.results, owned(\"function-invocations\", false)),\n total: page.total,\n };\n });\n\n const invocation = Effect.fn(\"BrowserbaseFunctions.invocation\")(function* (\n invocationId: string,\n ) {\n const checked = yield* id(invocationId, \"function-invocation\");\n\n return yield* api\n .request(\n \"GET\",\n `/v1/functions/invocations/${api.segment(checked)}`,\n FunctionInvocation,\n \"function-invocation\",\n )\n .pipe(Effect.flatMap(owned(\"function-invocation\", false, checked)));\n });\n\n const logs = (path: string, operation: PlatformError[\"operation\"]) =>\n api\n .request(\"GET\", path, Logs, operation)\n .pipe(Effect.map((value) => ({ items: value.logs, total: value.total })));\n\n const invocationLogs = Effect.fn(\"BrowserbaseFunctions.invocationLogs\")(function* (\n invocationId: string,\n ) {\n const checked = yield* id(invocationId, \"function-invocation-logs\");\n\n return yield* logs(\n `/v1/functions/invocations/${api.segment(checked)}/logs`,\n \"function-invocation-logs\",\n );\n });\n\n const builds = Effect.fn(\"BrowserbaseFunctions.builds\")(function* (\n query: FunctionStatusQuery = {},\n ) {\n const value = yield* api.input(FunctionStatusQuery, query, \"function-builds\");\n\n const page = yield* api.request(\n \"GET\",\n `/v1/functions/builds${api.query(value)}`,\n DataPage(FunctionBuild),\n \"function-builds\",\n );\n\n return {\n items: yield* Effect.forEach(page.data, owned(\"function-builds\", false)),\n total: page.total,\n };\n });\n\n const build = Effect.fn(\"BrowserbaseFunctions.build\")(function* (buildId: string) {\n const checked = yield* id(buildId, \"function-build\");\n\n return yield* api\n .request(\n \"GET\",\n `/v1/functions/builds/${api.segment(checked)}`,\n FunctionBuild,\n \"function-build\",\n )\n .pipe(Effect.flatMap(owned(\"function-build\", false, checked)));\n });\n\n const buildLogs = Effect.fn(\"BrowserbaseFunctions.buildLogs\")(function* (buildId: string) {\n const checked = yield* id(buildId, \"function-build-logs\");\n\n return yield* logs(\n `/v1/functions/builds/${api.segment(checked)}/logs`,\n \"function-build-logs\",\n );\n });\n\n const waitForInvocation = Effect.fn(\"BrowserbaseFunctions.waitForInvocation\")(function* (\n invocationId: string,\n options: FunctionWaitOptions,\n ) {\n const bounds = yield* api.input(FunctionWaitOptions, options, \"function-wait\");\n const deadline = (yield* now) + bounds.timeoutMillis;\n\n for (;;) {\n const current = yield* invocation(invocationId);\n\n if (current.status === \"COMPLETED\" || current.status === \"FAILED\") return current;\n const remaining = deadline - (yield* now);\n\n if (remaining <= 0)\n return yield* api.make({ operation: \"function-wait\", reason: \"timeout\" });\n yield* Effect.sleep(Math.min(bounds.pollIntervalMillis ?? 1_000, remaining));\n }\n });\n\n return BrowserbaseFunctions.of({\n list,\n retrieve,\n invoke,\n versions,\n version,\n invocations,\n invocation,\n invocationLogs,\n builds,\n build,\n buildLogs,\n waitForInvocation,\n });\n }),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC;AAC5D,MAAM,aAAa,OAAO,OAAO,OAAO,QAAQ,OAAO,IAAI;AAC3D,MAAM,OAAO,OAAO,OAAO,MAAM,OAAO,YAAY,IAAI,CAAC;AACzD,MAAM,SAAS,OAAO,SAAS;CAAC;CAAW;CAAW;CAAa;AAAQ,CAAC;AAI5E,IAAa,mBAAb,cAAsC,OAAO,MAAwB,6BAA6B,CAAC,CACjG;CACE,IAAI;CACJ,WAAW;CACX,MAAM;CACN,WAAW;CACX,WAAW;AACb,CACF,CAAC,CAAC,CAAC;AAEH,IAAa,kBAAb,cAAqC,OAAO,MAAuB,4BAA4B,CAAC,CAAC;CAC/F,IAAI;CACJ,WAAW;CACX,YAAY;CACZ,iBAAiB;CACjB,qBAAqB,OAAO,YAAY,UAAU;CAClD,kBAAkB,OAAO,YAAY,UAAU;CAC/C,W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AU,CAAC;IAC1E,OAAO,OAAO,MAAM,KAAK,IAAI,OAAO,sBAAsB,KAAO,SAAS,CAAC;GAC7E;EACF,CAAC;EAED,OAAO,qBAAqB,GAAG;GAC7B;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAAC;CACH,CAAC,CACH;AACF"}
|
|
1
|
+
{"version":3,"file":"Functions.mjs","names":[],"sources":["../src/Functions.ts"],"sourcesContent":["import { Clock, Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { PlatformError } from \"./Errors.ts\";\nimport { resource } from \"./internal/http/Resource.ts\";\nimport { proxy } from \"./internal/provider/Launch.ts\";\nimport { isContextWriterBusy } from \"./internal/session/ContextWriter.ts\";\nimport { ProxyRule } from \"./Launch.ts\";\nimport { ContextReference, Identifier } from \"./References.ts\";\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\nconst JsonObject = Schema.Record(Schema.String, Schema.Json);\nconst Name = Schema.String.check(Schema.isMaxLength(1024));\nconst Status = Schema.Literals([\"PENDING\", \"RUNNING\", \"COMPLETED\", \"FAILED\"]);\n\nexport type FunctionStatus = typeof Status.Type;\n\nexport class FunctionMetadata extends Schema.Class<FunctionMetadata>(\"BrowserbaseFunctionMetadata\")(\n {\n id: Identifier,\n projectId: Identifier,\n name: Name,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n },\n) {}\n\nexport class FunctionVersion extends Schema.Class<FunctionVersion>(\"BrowserbaseFunctionVersion\")({\n id: Identifier,\n projectId: Identifier,\n functionId: Identifier,\n functionBuildId: Identifier,\n sessionCreateParams: Schema.optionalKey(JsonObject),\n userParamsSchema: Schema.optionalKey(JsonObject),\n createdAt: Timestamp,\n updatedAt: Timestamp,\n}) {}\n\nexport class FunctionBuild extends Schema.Class<FunctionBuild>(\"BrowserbaseFunctionBuild\")({\n id: Identifier,\n projectId: Identifier,\n request: Schema.Struct({\n entrypoint: Name,\n functionNames: Schema.optionalKey(Schema.Array(Name).check(Schema.isMaxLength(1024))),\n }),\n status: Status,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n startedAt: Timestamp,\n endedAt: Schema.optionalKey(Timestamp),\n expiresAt: Timestamp,\n cause: Schema.optionalKey(\n Schema.Struct({\n code: Schema.String.check(Schema.isMaxLength(64)),\n message: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(4096))),\n }),\n ),\n}) {}\n\nexport class FunctionInvocation extends Schema.Class<FunctionInvocation>(\n \"BrowserbaseFunctionInvocation\",\n)({\n id: Identifier,\n projectId: Identifier,\n functionId: Identifier,\n versionId: Identifier,\n sessionId: Identifier,\n region: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(64))),\n params: Schema.optionalKey(JsonObject),\n status: Status,\n results: Schema.optionalKey(Schema.Json),\n cause: Schema.optionalKey(\n Schema.Struct({\n code: Schema.String.check(Schema.isMaxLength(64)),\n message: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(4096))),\n }),\n ),\n createdAt: Timestamp,\n updatedAt: Timestamp,\n startedAt: Timestamp,\n endedAt: Schema.optionalKey(Timestamp),\n expiresAt: Timestamp,\n}) {}\n\nexport class FunctionLogLine extends Schema.Class<FunctionLogLine>(\"BrowserbaseFunctionLogLine\")({\n message: Schema.String.check(Schema.isMaxLength(65_536)),\n timestamp: Schema.Finite,\n}) {}\n\n/** The session a Function invocation runs in; the provider's invoke-time subset. */\nexport const FunctionSessionParams = Schema.Struct({\n /** Seconds, 60–900; the provider defaults to 900. */\n timeout: Schema.optionalKey(Schema.Int.check(Schema.isBetween({ minimum: 60, maximum: 900 }))),\n extensionId: Schema.optionalKey(Identifier),\n context: Schema.optionalKey(\n Schema.Struct({ reference: ContextReference, persist: Schema.Boolean }),\n ),\n proxies: Schema.optionalKey(\n Schema.Union([Schema.Boolean, Schema.Array(ProxyRule).check(Schema.isMaxLength(64))]),\n ),\n proxySettings: Schema.optionalKey(\n Schema.Struct({\n caCertificates: Schema.optionalKey(\n Schema.Array(Identifier).check(Schema.isMaxLength(64), Schema.isUnique()),\n ),\n }),\n ),\n userMetadata: Schema.optionalKey(\n Schema.Record(Schema.String.check(Schema.isMaxLength(128)), Schema.Json),\n ),\n browserSettings: Schema.optionalKey(\n Schema.Struct({\n viewport: Schema.optionalKey(\n Schema.Struct({\n width: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 8192 })),\n ),\n height: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 8192 })),\n ),\n }),\n ),\n blockAds: Schema.optionalKey(Schema.Boolean),\n solveCaptchas: Schema.optionalKey(Schema.Boolean),\n recordSession: Schema.optionalKey(Schema.Boolean),\n logSession: Schema.optionalKey(Schema.Boolean),\n verified: Schema.optionalKey(Schema.Boolean),\n captchaImageSelector: Schema.optionalKey(\n Schema.NonEmptyString.check(Schema.isMaxLength(1024)),\n ),\n captchaInputSelector: Schema.optionalKey(\n Schema.NonEmptyString.check(Schema.isMaxLength(1024)),\n ),\n os: Schema.optionalKey(Schema.Literals([\"windows\", \"mac\", \"linux\", \"mobile\", \"tablet\"])),\n size: Schema.optionalKey(Schema.Literals([\"small\", \"medium\", \"large\"])),\n enableNativeSelectPolyfill: Schema.optionalKey(Schema.Boolean),\n enablePdfViewer: Schema.optionalKey(Schema.Boolean),\n extensions: Schema.optionalKey(\n Schema.Array(Schema.Literals([\"onepassword\", \"browser-events\"])).check(Schema.isUnique()),\n ),\n allowedDomains: Schema.optionalKey(\n Schema.Array(Schema.NonEmptyString.check(Schema.isMaxLength(1024))).check(\n Schema.isMaxLength(64),\n Schema.isUnique(),\n ),\n ),\n ignoreCertificateErrors: Schema.optionalKey(Schema.Boolean),\n }),\n ),\n});\n\nexport type FunctionSessionParams = typeof FunctionSessionParams.Type;\n\nexport const FunctionInvokeRequest = Schema.Struct({\n params: Schema.optionalKey(JsonObject),\n session: Schema.optionalKey(FunctionSessionParams),\n});\n\nexport type FunctionInvokeRequest = typeof FunctionInvokeRequest.Type;\n\nconst Offset = {\n offset: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 0, maximum: 1_000_000 })),\n ),\n limit: Schema.optionalKey(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 }))),\n};\n\nexport const FunctionPageQuery = Schema.Struct(Offset);\nexport type FunctionPageQuery = typeof FunctionPageQuery.Type;\n\nexport const FunctionStatusQuery = Schema.Struct({ ...Offset, status: Schema.optionalKey(Status) });\nexport type FunctionStatusQuery = typeof FunctionStatusQuery.Type;\n\nexport const FunctionWaitOptions = Schema.Struct({\n timeoutMillis: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 3_600_000 })),\n pollIntervalMillis: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 250, maximum: 60_000 })),\n ),\n});\n\nexport type FunctionWaitOptions = typeof FunctionWaitOptions.Type;\n\nexport interface OffsetPage<A> {\n readonly items: ReadonlyArray<A>;\n readonly total: number;\n}\n\nconst DataPage = <S extends Schema.Top>(item: S) =>\n Schema.Struct({ data: Schema.Array(item).check(Schema.isMaxLength(100)), total: Schema.Natural });\n\nconst ResultsPage = <S extends Schema.Top>(item: S) =>\n Schema.Struct({\n results: Schema.Array(item).check(Schema.isMaxLength(100)),\n total: Schema.Natural,\n });\n\nconst Logs = Schema.Struct({\n logs: Schema.Array(FunctionLogLine).check(Schema.isMaxLength(100_000)),\n total: Schema.Natural,\n});\n\nconst now = Clock.monotonicTimeNanos.pipe(Effect.map((value) => Number(value) / 1_000_000));\n\n/**\n * Browserbase Functions: deployed code invoked in a provider-allocated session. Deployment\n * happens through Browserbase's CLI; this service reads, invokes and observes. `invoke` is\n * never retried, and a lost reply is `outcome: \"unknown\"`.\n */\nexport class BrowserbaseFunctions extends Context.Service<\n BrowserbaseFunctions,\n {\n readonly list: (\n query?: FunctionPageQuery,\n ) => Effect.Effect<OffsetPage<FunctionMetadata>, PlatformError>;\n readonly retrieve: (functionId: string) => Effect.Effect<FunctionMetadata, PlatformError>;\n readonly invoke: (\n functionId: string,\n request?: FunctionInvokeRequest,\n ) => Effect.Effect<FunctionInvocation, PlatformError>;\n readonly versions: (\n functionId: string,\n query?: FunctionPageQuery,\n ) => Effect.Effect<OffsetPage<FunctionVersion>, PlatformError>;\n readonly version: (versionId: string) => Effect.Effect<FunctionVersion, PlatformError>;\n readonly invocations: (\n versionId: string,\n query?: FunctionStatusQuery,\n ) => Effect.Effect<OffsetPage<FunctionInvocation>, PlatformError>;\n readonly invocation: (invocationId: string) => Effect.Effect<FunctionInvocation, PlatformError>;\n readonly invocationLogs: (\n invocationId: string,\n ) => Effect.Effect<OffsetPage<FunctionLogLine>, PlatformError>;\n readonly builds: (\n query?: FunctionStatusQuery,\n ) => Effect.Effect<OffsetPage<FunctionBuild>, PlatformError>;\n readonly build: (buildId: string) => Effect.Effect<FunctionBuild, PlatformError>;\n readonly buildLogs: (\n buildId: string,\n ) => Effect.Effect<OffsetPage<FunctionLogLine>, PlatformError>;\n /** Polls until the invocation is terminal. Interrupting the wait does not cancel it. */\n readonly waitForInvocation: (\n invocationId: string,\n options: FunctionWaitOptions,\n ) => Effect.Effect<FunctionInvocation, PlatformError>;\n }\n>()(\"effect-browserbase/Functions\") {\n static readonly layer: Layer.Layer<BrowserbaseFunctions, never, BrowserbaseClient> = Layer.effect(\n BrowserbaseFunctions,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n\n const api = resource<PlatformError>(client, (failure) =>\n PlatformError.make({ ...failure, service: \"functions\" }),\n );\n\n /** Every record names its project; a foreign or mismatched one is malformed. */\n const owned =\n <A extends { readonly id: string; readonly projectId: string }>(\n operation: PlatformError[\"operation\"],\n mutation: boolean,\n expected?: string,\n ) =>\n (value: A): Effect.Effect<A, PlatformError> =>\n value.projectId === client.projectId && (expected === undefined || value.id === expected)\n ? Effect.succeed(value)\n : Effect.fail(api.malformed(operation, mutation));\n\n const id = (value: string, operation: PlatformError[\"operation\"]) =>\n api.input(Identifier, value, operation);\n\n const list = Effect.fn(\"BrowserbaseFunctions.list\")(function* (\n query: FunctionPageQuery = {},\n ) {\n const value = yield* api.input(FunctionPageQuery, query, \"function-list\");\n\n const page = yield* api.request(\n \"GET\",\n `/v1/functions${api.query(value)}`,\n DataPage(FunctionMetadata),\n \"function-list\",\n );\n\n return {\n items: yield* Effect.forEach(page.data, owned(\"function-list\", false)),\n total: page.total,\n };\n });\n\n const retrieve = Effect.fn(\"BrowserbaseFunctions.retrieve\")(function* (functionId: string) {\n const checked = yield* id(functionId, \"function-retrieve\");\n\n return yield* api\n .request(\n \"GET\",\n `/v1/functions/${api.segment(checked)}`,\n FunctionMetadata,\n \"function-retrieve\",\n )\n .pipe(Effect.flatMap(owned(\"function-retrieve\", false, checked)));\n });\n\n const invoke = Effect.fn(\"BrowserbaseFunctions.invoke\")(function* (\n functionId: string,\n request: FunctionInvokeRequest = {},\n ) {\n const checked = yield* id(functionId, \"function-invoke\");\n const value = yield* api.input(FunctionInvokeRequest, request, \"function-invoke\");\n const session = value.session;\n const context = session?.context;\n\n if (context !== undefined) {\n if (context.reference.projectId !== client.projectId)\n return yield* api.make({\n operation: \"function-invoke\",\n reason: \"authorization\",\n outcome: \"undispatched\",\n });\n if (context.persist && isContextWriterBusy(context.reference))\n return yield* api.make({\n operation: \"function-invoke\",\n reason: \"active\",\n outcome: \"undispatched\",\n });\n }\n\n const sessionCreateParams: Schema.Json | undefined =\n session === undefined\n ? undefined\n : {\n ...(session.timeout === undefined ? {} : { timeout: session.timeout }),\n ...(session.extensionId === undefined ? {} : { extensionId: session.extensionId }),\n ...(session.proxies === undefined\n ? {}\n : {\n proxies:\n typeof session.proxies === \"boolean\"\n ? session.proxies\n : session.proxies.map(proxy),\n }),\n ...(session.proxySettings === undefined\n ? {}\n : { proxySettings: session.proxySettings }),\n ...(session.userMetadata === undefined\n ? {}\n : { userMetadata: session.userMetadata }),\n ...(session.browserSettings === undefined && context === undefined\n ? {}\n : {\n browserSettings: {\n ...session.browserSettings,\n ...(context === undefined\n ? {}\n : {\n context: {\n id: context.reference.contextId,\n persist: context.persist,\n },\n }),\n },\n }),\n };\n\n return yield* api\n .request(\n \"POST\",\n `/v1/functions/${api.segment(checked)}/invoke`,\n FunctionInvocation,\n \"function-invoke\",\n {\n ...(value.params === undefined ? {} : { params: value.params }),\n ...(sessionCreateParams === undefined ? {} : { sessionCreateParams }),\n },\n )\n .pipe(Effect.flatMap(owned(\"function-invoke\", true)));\n });\n\n const versions = Effect.fn(\"BrowserbaseFunctions.versions\")(function* (\n functionId: string,\n query: FunctionPageQuery = {},\n ) {\n const checked = yield* id(functionId, \"function-versions\");\n const value = yield* api.input(FunctionPageQuery, query, \"function-versions\");\n\n const page = yield* api.request(\n \"GET\",\n `/v1/functions/${api.segment(checked)}/versions${api.query(value)}`,\n ResultsPage(FunctionVersion),\n \"function-versions\",\n );\n\n return {\n items: yield* Effect.forEach(page.results, owned(\"function-versions\", false)),\n total: page.total,\n };\n });\n\n const version = Effect.fn(\"BrowserbaseFunctions.version\")(function* (versionId: string) {\n const checked = yield* id(versionId, \"function-version\");\n\n return yield* api\n .request(\n \"GET\",\n `/v1/functions/versions/${api.segment(checked)}`,\n FunctionVersion,\n \"function-version\",\n )\n .pipe(Effect.flatMap(owned(\"function-version\", false, checked)));\n });\n\n const invocations = Effect.fn(\"BrowserbaseFunctions.invocations\")(function* (\n versionId: string,\n query: FunctionStatusQuery = {},\n ) {\n const checked = yield* id(versionId, \"function-invocations\");\n const value = yield* api.input(FunctionStatusQuery, query, \"function-invocations\");\n\n const page = yield* api.request(\n \"GET\",\n `/v1/functions/versions/${api.segment(checked)}/invocations${api.query(value)}`,\n ResultsPage(FunctionInvocation),\n \"function-invocations\",\n );\n\n return {\n items: yield* Effect.forEach(page.results, owned(\"function-invocations\", false)),\n total: page.total,\n };\n });\n\n const invocation = Effect.fn(\"BrowserbaseFunctions.invocation\")(function* (\n invocationId: string,\n ) {\n const checked = yield* id(invocationId, \"function-invocation\");\n\n return yield* api\n .request(\n \"GET\",\n `/v1/functions/invocations/${api.segment(checked)}`,\n FunctionInvocation,\n \"function-invocation\",\n )\n .pipe(Effect.flatMap(owned(\"function-invocation\", false, checked)));\n });\n\n const logs = (path: string, operation: PlatformError[\"operation\"]) =>\n api\n .request(\"GET\", path, Logs, operation)\n .pipe(Effect.map((value) => ({ items: value.logs, total: value.total })));\n\n const invocationLogs = Effect.fn(\"BrowserbaseFunctions.invocationLogs\")(function* (\n invocationId: string,\n ) {\n const checked = yield* id(invocationId, \"function-invocation-logs\");\n\n return yield* logs(\n `/v1/functions/invocations/${api.segment(checked)}/logs`,\n \"function-invocation-logs\",\n );\n });\n\n const builds = Effect.fn(\"BrowserbaseFunctions.builds\")(function* (\n query: FunctionStatusQuery = {},\n ) {\n const value = yield* api.input(FunctionStatusQuery, query, \"function-builds\");\n\n const page = yield* api.request(\n \"GET\",\n `/v1/functions/builds${api.query(value)}`,\n DataPage(FunctionBuild),\n \"function-builds\",\n );\n\n return {\n items: yield* Effect.forEach(page.data, owned(\"function-builds\", false)),\n total: page.total,\n };\n });\n\n const build = Effect.fn(\"BrowserbaseFunctions.build\")(function* (buildId: string) {\n const checked = yield* id(buildId, \"function-build\");\n\n return yield* api\n .request(\n \"GET\",\n `/v1/functions/builds/${api.segment(checked)}`,\n FunctionBuild,\n \"function-build\",\n )\n .pipe(Effect.flatMap(owned(\"function-build\", false, checked)));\n });\n\n const buildLogs = Effect.fn(\"BrowserbaseFunctions.buildLogs\")(function* (buildId: string) {\n const checked = yield* id(buildId, \"function-build-logs\");\n\n return yield* logs(\n `/v1/functions/builds/${api.segment(checked)}/logs`,\n \"function-build-logs\",\n );\n });\n\n const waitForInvocation = Effect.fn(\"BrowserbaseFunctions.waitForInvocation\")(function* (\n invocationId: string,\n options: FunctionWaitOptions,\n ) {\n const bounds = yield* api.input(FunctionWaitOptions, options, \"function-wait\");\n const deadline = (yield* now) + bounds.timeoutMillis;\n\n for (;;) {\n const current = yield* invocation(invocationId);\n\n if (current.status === \"COMPLETED\" || current.status === \"FAILED\") return current;\n const remaining = deadline - (yield* now);\n\n if (remaining <= 0)\n return yield* api.make({ operation: \"function-wait\", reason: \"timeout\" });\n yield* Effect.sleep(Math.min(bounds.pollIntervalMillis ?? 1_000, remaining));\n }\n });\n\n return BrowserbaseFunctions.of({\n list,\n retrieve,\n invoke,\n versions,\n version,\n invocations,\n invocation,\n invocationLogs,\n builds,\n build,\n buildLogs,\n waitForInvocation,\n });\n }),\n );\n}\n"],"mappings":";;;;;;;;;AAUA,MAAM,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC;AAC5D,MAAM,aAAa,OAAO,OAAO,OAAO,QAAQ,OAAO,IAAI;AAC3D,MAAM,OAAO,OAAO,OAAO,MAAM,OAAO,YAAY,IAAI,CAAC;AACzD,MAAM,SAAS,OAAO,SAAS;CAAC;CAAW;CAAW;CAAa;AAAQ,CAAC;AAI5E,IAAa,mBAAb,cAAsC,OAAO,MAAwB,6BAA6B,CAAC,CACjG;CACE,IAAI;CACJ,WAAW;CACX,MAAM;CACN,WAAW;CACX,WAAW;AACb,CACF,CAAC,CAAC,CAAC;AAEH,IAAa,kBAAb,cAAqC,OAAO,MAAuB,4BAA4B,CAAC,CAAC;CAC/F,IAAI;CACJ,WAAW;CACX,YAAY;CACZ,iBAAiB;CACjB,qBAAqB,OAAO,YAAY,UAAU;CAClD,kBAAkB,OAAO,YAAY,UAAU;CAC/C,WAAW;CACX,WAAW;AACb,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,gBAAb,cAAmC,OAAO,MAAqB,0BAA0B,CAAC,CAAC;CACzF,IAAI;CACJ,WAAW;CACX,SAAS,OAAO,OAAO;EACrB,YAAY;EACZ,eAAe,OAAO,YAAY,OAAO,MAAM,IAAI,CAAC,CAAC,MAAM,OAAO,YAAY,IAAI,CAAC,CAAC;CACtF,CAAC;CACD,QAAQ;CACR,WAAW;CACX,WAAW;CACX,WAAW;CACX,SAAS,OAAO,YAAY,SAAS;CACrC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,mBAAmB,KAAK,CAAC;IACvE,OAAO,KAAK;GACd;EACF,CAAC;EAED,MAAM,QAAQ,OAAO,GAAG,4BAA4B,CAAC,CAAC,WAAW,SAAiB;GAChF,MAAM,UAAU,OAAO,GAAG,SAAS,gBAAgB;GAEnD,OAAO,OAAO,IACX,QACC,OACA,wBAAwB,IAAI,QAAQ,OAAO,KAC3C,eACA,gBACF,CAAC,CACA,KAAK,OAAO,QAAQ,MAAM,kBAAkB,OAAO,OAAO,CAAC,CAAC;EACjE,CAAC;EAED,MAAM,YAAY,OAAO,GAAG,gCAAgC,CAAC,CAAC,WAAW,SAAiB;GACxF,MAAM,UAAU,OAAO,GAAG,SAAS,qBAAqB;GAExD,OAAO,OAAO,KACZ,wBAAwB,IAAI,QAAQ,OAAO,EAAE,QAC7C,qBACF;EACF,CAAC;EAED,MAAM,oBAAoB,OAAO,GAAG,wCAAwC,CAAC,CAAC,WAC5E,cACA,SACA;GACA,MAAM,SAAS,OAAO,IAAI,MAAM,qBAAqB,SAAS,eAAe;GAC7E,MAAM,YAAY,OAAO,OAAO,OAAO;GAEvC,SAAS;IACP,MAAM,UAAU,OAAO,WAAW,YAAY;IAE9C,IAAI,QAAQ,WAAW,eAAe,QAAQ,WAAW,UAAU,OAAO;IAC1E,MAAM,YAAY,YAAY,OAAO;IAErC,IAAI,aAAa,GACf,OAAO,OAAO,IAAI,KAAK;KAAE,WAAW;KAAiB,QAAQ;IAAU,CAAC;IAC1E,OAAO,OAAO,MAAM,KAAK,IAAI,OAAO,sBAAsB,KAAO,SAAS,CAAC;GAC7E;EACF,CAAC;EAED,OAAO,qBAAqB,GAAG;GAC7B;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAAC;CACH,CAAC,CACH;AACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AllocationAttempt } from "./References.mjs";
|
|
2
|
-
import { BrowserError } from "./Errors.mjs";
|
|
3
|
-
import { Viewport } from "./BrowserData.mjs";
|
|
4
2
|
import { LaunchRecipe } from "./Launch.mjs";
|
|
5
3
|
import { Effect, Redacted, Schema } from "effect";
|
|
4
|
+
import { Viewport } from "effect-browser/browser-data";
|
|
5
|
+
import { BrowserError, Reasons } from "effect-browser/errors";
|
|
6
6
|
//#region src/internal/provider/Launch.ts
|
|
7
7
|
const proxy = (rule) => rule.type === "external" ? {
|
|
8
8
|
type: rule.type,
|
|
@@ -22,7 +22,7 @@ const proxy = (rule) => rule.type === "external" ? {
|
|
|
22
22
|
const compileLaunch = Effect.fnUntraced(function* (input, identity) {
|
|
23
23
|
const recipe = yield* Schema.decodeUnknownEffect(LaunchRecipe)(input, { onExcessProperty: "error" }).pipe(Effect.mapError(() => BrowserError.make({
|
|
24
24
|
operation: "launch",
|
|
25
|
-
reason:
|
|
25
|
+
reason: Reasons.Configuration.make({}),
|
|
26
26
|
outcome: "undispatched"
|
|
27
27
|
})));
|
|
28
28
|
const attempt = Object.freeze(AllocationAttempt.make({
|
|
@@ -32,7 +32,7 @@ const compileLaunch = Effect.fnUntraced(function* (input, identity) {
|
|
|
32
32
|
const settings = recipe.provider.browserSettings ?? {};
|
|
33
33
|
const fail = () => BrowserError.make({
|
|
34
34
|
operation: "launch",
|
|
35
|
-
reason:
|
|
35
|
+
reason: Reasons.Configuration.make({}),
|
|
36
36
|
outcome: "undispatched"
|
|
37
37
|
});
|
|
38
38
|
if (recipe.context !== void 0 && recipe.context.reference.projectId !== attempt.projectId || recipe.extension !== void 0 && recipe.extension.projectId !== attempt.projectId || settings.verified === true && recipe.viewport._tag !== "ProviderManaged" || settings.os !== void 0 && settings.verified !== true) return yield* fail();
|
|
@@ -108,4 +108,4 @@ const compileLaunch = Effect.fnUntraced(function* (input, identity) {
|
|
|
108
108
|
//#endregion
|
|
109
109
|
export { proxy as n, compileLaunch as t };
|
|
110
110
|
|
|
111
|
-
//# sourceMappingURL=Launch-
|
|
111
|
+
//# sourceMappingURL=Launch-m0fxzJ49.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Launch-m0fxzJ49.mjs","names":[],"sources":["../src/internal/provider/Launch.ts"],"sourcesContent":["import { Effect, Redacted, Schema } from \"effect\";\nimport { Viewport } from \"effect-browser/browser-data\";\nimport { BrowserError, Reasons } from \"effect-browser/errors\";\n\nimport { LaunchRecipe, type ProxyRule } from \"../../Launch.ts\";\nimport { AllocationAttempt } from \"../../References.ts\";\n\nexport interface CompiledLaunch {\n readonly attempt: AllocationAttempt;\n readonly body: Schema.Json;\n readonly viewport: Viewport | undefined;\n readonly keepAlive: boolean;\n readonly context: { readonly id: string; readonly persist: boolean } | undefined;\n readonly recordSession: boolean;\n}\n\nexport const proxy = (rule: ProxyRule): Schema.Json =>\n rule.type === \"external\"\n ? {\n type: rule.type,\n server: rule.server,\n ...(rule.domainPattern === undefined ? {} : { domainPattern: rule.domainPattern }),\n ...(rule.username === undefined ? {} : { username: Redacted.value(rule.username) }),\n ...(rule.password === undefined ? {} : { password: Redacted.value(rule.password) }),\n }\n : rule.type === \"none\"\n ? {\n type: rule.type,\n ...(rule.domainPattern === undefined ? {} : { domainPattern: rule.domainPattern }),\n }\n : {\n type: rule.type,\n ...(rule.domainPattern === undefined ? {} : { domainPattern: rule.domainPattern }),\n ...(rule.geolocation === undefined ? {} : { geolocation: { ...rule.geolocation } }),\n };\n\n/** One validation/copy/compiler path. No legacy constructor or second default body exists. */\nexport const compileLaunch = Effect.fnUntraced(function* (\n input: unknown,\n identity: Pick<AllocationAttempt, \"projectId\" | \"attemptId\" | \"requestedAtMillis\">,\n): Effect.fn.Return<CompiledLaunch, BrowserError> {\n const recipe = yield* Schema.decodeUnknownEffect(LaunchRecipe)(input, {\n onExcessProperty: \"error\",\n }).pipe(\n Effect.mapError(() =>\n BrowserError.make({\n operation: \"launch\",\n reason: Reasons.Configuration.make({}),\n outcome: \"undispatched\",\n }),\n ),\n );\n\n const attempt = Object.freeze(\n AllocationAttempt.make({ ...identity, timeoutSeconds: recipe.remoteTimeoutSeconds }),\n );\n\n const settings = recipe.provider.browserSettings ?? {};\n\n const fail = () =>\n BrowserError.make({\n operation: \"launch\",\n reason: Reasons.Configuration.make({}),\n outcome: \"undispatched\",\n });\n\n // The qualified reference is the only extension spelling, so a foreign project cannot\n // reach POST and there is no second alias whose precedence would have to be invented.\n if (\n (recipe.context !== undefined && recipe.context.reference.projectId !== attempt.projectId) ||\n (recipe.extension !== undefined && recipe.extension.projectId !== attempt.projectId) ||\n (settings.verified === true && recipe.viewport._tag !== \"ProviderManaged\") ||\n (settings.os !== undefined && settings.verified !== true)\n )\n return yield* fail();\n\n const viewport =\n recipe.viewport._tag === \"Fixed\"\n ? yield* Schema.decodeEffect(Viewport)({\n width: recipe.viewport.width,\n height: recipe.viewport.height,\n }).pipe(Effect.mapError(fail))\n : undefined;\n\n if (Array.isArray(recipe.provider.proxies)) {\n for (const rule of recipe.provider.proxies) {\n if (\n rule.type === \"browserbase\" &&\n rule.geolocation?.state !== undefined &&\n rule.geolocation.country !== \"US\"\n )\n return yield* fail();\n if (rule.type === \"external\") {\n const valid = yield* Effect.try({\n try: () => {\n const url = new URL(rule.server);\n\n return (\n [\"http:\", \"https:\"].includes(url.protocol) &&\n !url.username &&\n !url.password &&\n !url.hash\n );\n },\n catch: fail,\n });\n\n if (!valid) return yield* fail();\n }\n }\n }\n for (const domain of settings.allowedDomains ?? []) {\n const valid = yield* Effect.try({\n try: () => {\n const url = new URL(`https://${domain}/`);\n\n return (\n !domain.includes(\"*\") &&\n url.hostname === domain &&\n !url.port &&\n !url.username &&\n !url.password\n );\n },\n catch: fail,\n });\n\n if (!valid) return yield* fail();\n }\n const metadata = recipe.provider.userMetadata ?? {};\n\n if (\n Object.keys(metadata).length > 32 ||\n Object.keys(metadata).some(\n (key) => key === \"effectAgentAttempt\" || key.startsWith(\"browserbaseIntegration\"),\n )\n )\n return yield* fail();\n const keepAlive = recipe.keepAlive ?? false;\n\n const context =\n recipe.context === undefined\n ? undefined\n : { id: recipe.context.reference.contextId, persist: recipe.context.persist };\n\n const recordSession = settings.recordSession ?? false;\n\n const body = {\n projectId: attempt.projectId,\n timeout: recipe.remoteTimeoutSeconds,\n keepAlive,\n ...(recipe.provider.region === undefined ? {} : { region: recipe.provider.region }),\n proxies: Array.isArray(recipe.provider.proxies)\n ? recipe.provider.proxies.map(proxy)\n : (recipe.provider.proxies ?? false),\n ...(recipe.provider.proxySettings === undefined\n ? {}\n : { proxySettings: recipe.provider.proxySettings }),\n ...(recipe.extension === undefined ? {} : { extensionId: recipe.extension.extensionId }),\n browserSettings: {\n ...settings,\n recordSession,\n logSession: settings.logSession ?? false,\n solveCaptchas: settings.solveCaptchas ?? false,\n ...(context === undefined ? {} : { context }),\n ...(viewport === undefined\n ? {}\n : { viewport: { width: viewport.width, height: viewport.height } }),\n },\n userMetadata: { ...metadata, browserbaseIntegrationAttempt: attempt.attemptId },\n };\n\n // Own all nested values, including arrays. The admitted body never observes later caller mutation.\n const encoded = yield* Effect.try({ try: () => JSON.stringify(body), catch: fail });\n\n if (new TextEncoder().encode(encoded).length > 64 * 1024) return yield* fail();\n\n const owned = yield* Schema.decodeEffect(Schema.fromJsonString(Schema.Json))(encoded).pipe(\n Effect.mapError(fail),\n );\n\n return { attempt, body: owned, viewport, keepAlive, context, recordSession };\n});\n"],"mappings":";;;;;;AAgBA,MAAa,SAAS,SACpB,KAAK,SAAS,aACV;CACE,MAAM,KAAK;CACX,QAAQ,KAAK;CACb,GAAI,KAAK,kBAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,eAAe,KAAK,cAAc;CAChF,GAAI,KAAK,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,SAAS,MAAM,KAAK,QAAQ,EAAE;CACjF,GAAI,KAAK,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,SAAS,MAAM,KAAK,QAAQ,EAAE;AACnF,IACA,KAAK,SAAS,SACZ;CACE,MAAM,KAAK;CACX,GAAI,KAAK,kBAAkB,KAAA,IA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A,IAAY,CAAC,IAAI,EAAE,QAAQ,OAAO,SAAS,OAAO;EACjF,SAAS,MAAM,QAAQ,OAAO,SAAS,OAAO,IAC1C,OAAO,SAAS,QAAQ,IAAI,KAAK,IAChC,OAAO,SAAS,WAAW;EAChC,GAAI,OAAO,SAAS,kBAAkB,KAAA,IAClC,CAAC,IACD,EAAE,eAAe,OAAO,SAAS,cAAc;EACnD,GAAI,OAAO,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa,OAAO,UAAU,YAAY;EACtF,iBAAiB;GACf,GAAG;GACH;GACA,YAAY,SAAS,cAAc;GACnC,eAAe,SAAS,iBAAiB;GACzC,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ;GAC3C,GAAI,aAAa,KAAA,IACb,CAAC,IACD,EAAE,UAAU;IAAE,OAAO,SAAS;IAAO,QAAQ,SAAS;GAAO,EAAE;EACrE;EACA,cAAc;GAAE,GAAG;GAAU,+BAA+B,QAAQ;EAAU;CAChF;CAGA,MAAM,UAAU,OAAO,OAAO,IAAI;EAAE,WAAW,KAAK,UAAU,IAAI;EAAG,OAAO;CAAK,CAAC;CAElF,IAAI,IAAI,YAAY,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,SAAS,OAAW,OAAO,OAAO,KAAK;CAM7E,OAAO;EAAE;EAAS,MAAM,OAJH,OAAO,aAAa,OAAO,eAAe,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KACpF,OAAO,SAAS,IAAI,CACtB;EAE+B;EAAU;EAAW;EAAS;CAAc;AAC7E,CAAC"}
|
package/dist/Launch.d.mts
CHANGED
|
@@ -1,2 +1,130 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { n as ContextReference, r as ExtensionReference } from "./References-DOH3Wu44.mjs";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
//#region src/Launch.d.ts
|
|
4
|
+
export declare const ProxyRule: Schema.Union<readonly [Schema.Struct<{
|
|
5
|
+
readonly type: Schema.Literal<"browserbase">;
|
|
6
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
7
|
+
readonly geolocation: Schema.optionalKey<Schema.Struct<{
|
|
8
|
+
readonly country: Schema.String;
|
|
9
|
+
readonly state: Schema.optionalKey<Schema.String>;
|
|
10
|
+
readonly city: Schema.optionalKey<Schema.NonEmptyString>;
|
|
11
|
+
}>>;
|
|
12
|
+
}>, Schema.Struct<{
|
|
13
|
+
readonly type: Schema.Literal<"external">;
|
|
14
|
+
readonly server: Schema.NonEmptyString;
|
|
15
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
16
|
+
readonly username: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
17
|
+
readonly password: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
18
|
+
}>, Schema.Struct<{
|
|
19
|
+
readonly type: Schema.Literal<"none">;
|
|
20
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
21
|
+
}>]>;
|
|
22
|
+
export type ProxyRule = typeof ProxyRule.Type;
|
|
23
|
+
/** SDK 2.20 browser subset. Names follow Browserbase; ownership-managed fields are excluded. */
|
|
24
|
+
export declare const ProviderLaunchOptions: Schema.Struct<{
|
|
25
|
+
readonly region: Schema.optionalKey<Schema.Literals<readonly ["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"]>>;
|
|
26
|
+
readonly proxies: Schema.optionalKey<Schema.Union<readonly [Schema.Boolean, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
27
|
+
readonly type: Schema.Literal<"browserbase">;
|
|
28
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
29
|
+
readonly geolocation: Schema.optionalKey<Schema.Struct<{
|
|
30
|
+
readonly country: Schema.String;
|
|
31
|
+
readonly state: Schema.optionalKey<Schema.String>;
|
|
32
|
+
readonly city: Schema.optionalKey<Schema.NonEmptyString>;
|
|
33
|
+
}>>;
|
|
34
|
+
}>, Schema.Struct<{
|
|
35
|
+
readonly type: Schema.Literal<"external">;
|
|
36
|
+
readonly server: Schema.NonEmptyString;
|
|
37
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
38
|
+
readonly username: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
39
|
+
readonly password: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
40
|
+
}>, Schema.Struct<{
|
|
41
|
+
readonly type: Schema.Literal<"none">;
|
|
42
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
43
|
+
}>]>>]>>;
|
|
44
|
+
readonly proxySettings: Schema.optionalKey<Schema.Struct<{
|
|
45
|
+
readonly caCertificates: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
|
|
46
|
+
}>>;
|
|
47
|
+
readonly browserSettings: Schema.optionalKey<Schema.Struct<{
|
|
48
|
+
readonly verified: Schema.optionalKey<Schema.Boolean>;
|
|
49
|
+
readonly os: Schema.optionalKey<Schema.Literals<readonly ["windows", "mac", "linux", "mobile", "tablet"]>>;
|
|
50
|
+
readonly allowedDomains: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
|
|
51
|
+
readonly blockAds: Schema.optionalKey<Schema.Boolean>;
|
|
52
|
+
readonly captchaImageSelector: Schema.optionalKey<Schema.NonEmptyString>;
|
|
53
|
+
readonly captchaInputSelector: Schema.optionalKey<Schema.NonEmptyString>;
|
|
54
|
+
readonly ignoreCertificateErrors: Schema.optionalKey<Schema.Boolean>;
|
|
55
|
+
readonly logSession: Schema.optionalKey<Schema.Boolean>;
|
|
56
|
+
readonly recordSession: Schema.optionalKey<Schema.Boolean>;
|
|
57
|
+
readonly solveCaptchas: Schema.optionalKey<Schema.Boolean>;
|
|
58
|
+
}>>;
|
|
59
|
+
readonly userMetadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
60
|
+
}>;
|
|
61
|
+
export type ProviderLaunchOptions = typeof ProviderLaunchOptions.Type;
|
|
62
|
+
/** Connection behavior and business budgets are not provider session lifetime. */
|
|
63
|
+
export declare const LaunchRecipe: Schema.Struct<{
|
|
64
|
+
readonly remoteTimeoutSeconds: Schema.Int;
|
|
65
|
+
readonly keepAlive: Schema.optionalKey<Schema.Boolean>;
|
|
66
|
+
readonly context: Schema.optionalKey<Schema.Struct<{
|
|
67
|
+
readonly reference: typeof ContextReference;
|
|
68
|
+
readonly persist: Schema.Boolean;
|
|
69
|
+
}>>;
|
|
70
|
+
/**
|
|
71
|
+
* Project-qualified selection of an already provisioned extension, never an upload. It is
|
|
72
|
+
* the only spelling: the compiler alone projects it to the provider's `extensionId`, so an
|
|
73
|
+
* unqualified identifier cannot reach the provider unchecked.
|
|
74
|
+
*/
|
|
75
|
+
readonly extension: Schema.optionalKey<typeof ExtensionReference>;
|
|
76
|
+
readonly viewport: Schema.Union<readonly [Schema.Struct<{
|
|
77
|
+
readonly _tag: Schema.Literal<"ProviderManaged">;
|
|
78
|
+
}>, Schema.Struct<{
|
|
79
|
+
readonly _tag: Schema.Literal<"Fixed">;
|
|
80
|
+
readonly width: Schema.Int;
|
|
81
|
+
readonly height: Schema.Int;
|
|
82
|
+
}>]>;
|
|
83
|
+
readonly provider: Schema.Struct<{
|
|
84
|
+
readonly region: Schema.optionalKey<Schema.Literals<readonly ["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"]>>;
|
|
85
|
+
readonly proxies: Schema.optionalKey<Schema.Union<readonly [Schema.Boolean, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
86
|
+
readonly type: Schema.Literal<"browserbase">;
|
|
87
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
88
|
+
readonly geolocation: Schema.optionalKey<Schema.Struct<{
|
|
89
|
+
readonly country: Schema.String;
|
|
90
|
+
readonly state: Schema.optionalKey<Schema.String>;
|
|
91
|
+
readonly city: Schema.optionalKey<Schema.NonEmptyString>;
|
|
92
|
+
}>>;
|
|
93
|
+
}>, Schema.Struct<{
|
|
94
|
+
readonly type: Schema.Literal<"external">;
|
|
95
|
+
readonly server: Schema.NonEmptyString;
|
|
96
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
97
|
+
readonly username: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
98
|
+
readonly password: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
99
|
+
}>, Schema.Struct<{
|
|
100
|
+
readonly type: Schema.Literal<"none">;
|
|
101
|
+
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
102
|
+
}>]>>]>>;
|
|
103
|
+
readonly proxySettings: Schema.optionalKey<Schema.Struct<{
|
|
104
|
+
readonly caCertificates: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
|
|
105
|
+
}>>;
|
|
106
|
+
readonly browserSettings: Schema.optionalKey<Schema.Struct<{
|
|
107
|
+
readonly verified: Schema.optionalKey<Schema.Boolean>;
|
|
108
|
+
readonly os: Schema.optionalKey<Schema.Literals<readonly ["windows", "mac", "linux", "mobile", "tablet"]>>;
|
|
109
|
+
readonly allowedDomains: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
|
|
110
|
+
readonly blockAds: Schema.optionalKey<Schema.Boolean>;
|
|
111
|
+
readonly captchaImageSelector: Schema.optionalKey<Schema.NonEmptyString>;
|
|
112
|
+
readonly captchaInputSelector: Schema.optionalKey<Schema.NonEmptyString>;
|
|
113
|
+
readonly ignoreCertificateErrors: Schema.optionalKey<Schema.Boolean>;
|
|
114
|
+
readonly logSession: Schema.optionalKey<Schema.Boolean>;
|
|
115
|
+
readonly recordSession: Schema.optionalKey<Schema.Boolean>;
|
|
116
|
+
readonly solveCaptchas: Schema.optionalKey<Schema.Boolean>;
|
|
117
|
+
}>>;
|
|
118
|
+
readonly userMetadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
119
|
+
}>;
|
|
120
|
+
}>;
|
|
121
|
+
export type LaunchRecipe = typeof LaunchRecipe.Type;
|
|
122
|
+
/**
|
|
123
|
+
* A recipe with the smallest reasonable choices filled in: a five-minute provider lifetime,
|
|
124
|
+
* a provider-managed viewport (which Verified requires) and no provider options. Privacy
|
|
125
|
+
* defaults are unchanged: recording, logging and captcha solving stay off unless requested.
|
|
126
|
+
*/
|
|
127
|
+
export declare const recipe: (options?: Partial<LaunchRecipe>) => LaunchRecipe;
|
|
128
|
+
//#endregion
|
|
129
|
+
export {};
|
|
130
|
+
//# sourceMappingURL=Launch.d.mts.map
|
package/dist/Launch.mjs
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ContextReference, ExtensionReference, Identifier } from "./References.mjs";
|
|
3
|
-
import { Viewport } from "./BrowserData.mjs";
|
|
1
|
+
import { ContextReference, ExtensionReference, Identifier as Identifier$1 } from "./References.mjs";
|
|
4
2
|
import { Schema } from "effect";
|
|
3
|
+
import { Viewport } from "effect-browser/browser-data";
|
|
5
4
|
//#region src/Launch.ts
|
|
6
|
-
var Launch_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
-
LaunchRecipe: () => LaunchRecipe,
|
|
8
|
-
ProviderLaunchOptions: () => ProviderLaunchOptions,
|
|
9
|
-
ProxyRule: () => ProxyRule,
|
|
10
|
-
recipe: () => recipe
|
|
11
|
-
});
|
|
12
5
|
const BoundedString = Schema.NonEmptyString.check(Schema.isMaxLength(1024));
|
|
13
6
|
const ProxySecret = Schema.Redacted(Schema.String.check(Schema.isMaxLength(8192)));
|
|
14
7
|
const Geolocation = Schema.Struct({
|
|
@@ -43,7 +36,7 @@ const ProviderLaunchOptions = Schema.Struct({
|
|
|
43
36
|
"ap-southeast-1"
|
|
44
37
|
])),
|
|
45
38
|
proxies: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Array(ProxyRule).check(Schema.isMaxLength(64))])),
|
|
46
|
-
proxySettings: Schema.optionalKey(Schema.Struct({ caCertificates: Schema.optionalKey(Schema.Array(Identifier).check(Schema.isMaxLength(64), Schema.isUnique())) })),
|
|
39
|
+
proxySettings: Schema.optionalKey(Schema.Struct({ caCertificates: Schema.optionalKey(Schema.Array(Identifier$1).check(Schema.isMaxLength(64), Schema.isUnique())) })),
|
|
47
40
|
browserSettings: Schema.optionalKey(Schema.Struct({
|
|
48
41
|
verified: Schema.optionalKey(Schema.Boolean),
|
|
49
42
|
os: Schema.optionalKey(Schema.Literals([
|
|
@@ -100,6 +93,6 @@ const recipe = (options = {}) => ({
|
|
|
100
93
|
...options
|
|
101
94
|
});
|
|
102
95
|
//#endregion
|
|
103
|
-
export { LaunchRecipe, ProviderLaunchOptions, ProxyRule, recipe
|
|
96
|
+
export { LaunchRecipe, ProviderLaunchOptions, ProxyRule, recipe };
|
|
104
97
|
|
|
105
98
|
//# sourceMappingURL=Launch.mjs.map
|
package/dist/Launch.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Launch.mjs","names":[],"sources":["../src/Launch.ts"],"sourcesContent":["import { Schema } from \"effect\";\
|
|
1
|
+
{"version":3,"file":"Launch.mjs","names":["Identifier"],"sources":["../src/Launch.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { Viewport } from \"effect-browser/browser-data\";\n\nimport { ContextReference, ExtensionReference, Identifier } from \"./References.ts\";\n\nconst BoundedString = Schema.NonEmptyString.check(Schema.isMaxLength(1024));\nconst ProxySecret = Schema.Redacted(Schema.String.check(Schema.isMaxLength(8192)));\n\nconst Geolocation = Schema.Struct({\n country: Schema.String.check(Schema.isPattern(/^[A-Z]{2}$/)),\n state: Schema.optionalKey(Schema.String.check(Schema.isPattern(/^[A-Z]{2}$/))),\n city: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(256))),\n});\n\nexport const ProxyRule = Schema.Union([\n Schema.Struct({\n type: Schema.Literal(\"browserbase\"),\n domainPattern: Schema.optionalKey(BoundedString),\n geolocation: Schema.optionalKey(Geolocation),\n }),\n Schema.Struct({\n type: Schema.Literal(\"external\"),\n server: BoundedString,\n domainPattern: Schema.optionalKey(BoundedString),\n username: Schema.optionalKey(ProxySecret),\n password: Schema.optionalKey(ProxySecret),\n }),\n Schema.Struct({ type: Schema.Literal(\"none\"), domainPattern: Schema.optionalKey(BoundedString) }),\n]);\n\nexport type ProxyRule = typeof ProxyRule.Type;\n\n/** SDK 2.20 browser subset. Names follow Browserbase; ownership-managed fields are excluded. */\nexport const ProviderLaunchOptions = Schema.Struct({\n region: Schema.optionalKey(\n Schema.Literals([\"us-west-2\", \"us-east-1\", \"eu-central-1\", \"ap-southeast-1\"]),\n ),\n proxies: Schema.optionalKey(\n Schema.Union([Schema.Boolean, Schema.Array(ProxyRule).check(Schema.isMaxLength(64))]),\n ),\n proxySettings: Schema.optionalKey(\n Schema.Struct({\n caCertificates: Schema.optionalKey(\n Schema.Array(Identifier).check(Schema.isMaxLength(64), Schema.isUnique()),\n ),\n }),\n ),\n browserSettings: Schema.optionalKey(\n Schema.Struct({\n verified: Schema.optionalKey(Schema.Boolean),\n os: Schema.optionalKey(Schema.Literals([\"windows\", \"mac\", \"linux\", \"mobile\", \"tablet\"])),\n allowedDomains: Schema.optionalKey(\n Schema.Array(BoundedString).check(Schema.isMaxLength(64), Schema.isUnique()),\n ),\n blockAds: Schema.optionalKey(Schema.Boolean),\n captchaImageSelector: Schema.optionalKey(BoundedString),\n captchaInputSelector: Schema.optionalKey(BoundedString),\n ignoreCertificateErrors: Schema.optionalKey(Schema.Boolean),\n logSession: Schema.optionalKey(Schema.Boolean),\n recordSession: Schema.optionalKey(Schema.Boolean),\n solveCaptchas: Schema.optionalKey(Schema.Boolean),\n }),\n ),\n userMetadata: Schema.optionalKey(\n Schema.Record(Schema.String.check(Schema.isMaxLength(128)), Schema.Json),\n ),\n});\n\nexport type ProviderLaunchOptions = typeof ProviderLaunchOptions.Type;\n\n/** Connection behavior and business budgets are not provider session lifetime. */\nexport const LaunchRecipe = Schema.Struct({\n remoteTimeoutSeconds: Schema.Int.check(Schema.isBetween({ minimum: 60, maximum: 21600 })),\n keepAlive: Schema.optionalKey(Schema.Boolean),\n context: Schema.optionalKey(\n Schema.Struct({ reference: ContextReference, persist: Schema.Boolean }),\n ),\n /**\n * Project-qualified selection of an already provisioned extension, never an upload. It is\n * the only spelling: the compiler alone projects it to the provider's `extensionId`, so an\n * unqualified identifier cannot reach the provider unchecked.\n */\n extension: Schema.optionalKey(ExtensionReference),\n viewport: Schema.Union([\n Schema.Struct({ _tag: Schema.Literal(\"ProviderManaged\") }),\n Schema.Struct({\n _tag: Schema.Literal(\"Fixed\"),\n width: Viewport.fields.width,\n height: Viewport.fields.height,\n }),\n ]),\n provider: ProviderLaunchOptions,\n});\n\nexport type LaunchRecipe = typeof LaunchRecipe.Type;\n\n/**\n * A recipe with the smallest reasonable choices filled in: a five-minute provider lifetime,\n * a provider-managed viewport (which Verified requires) and no provider options. Privacy\n * defaults are unchanged: recording, logging and captcha solving stay off unless requested.\n */\nexport const recipe = (options: Partial<LaunchRecipe> = {}): LaunchRecipe => ({\n remoteTimeoutSeconds: 300,\n viewport: { _tag: \"ProviderManaged\" },\n provider: {},\n ...options,\n});\n"],"mappings":";;;;AAKA,MAAM,gBAAgB,OAAO,eAAe,MAAM,OAAO,YAAY,IAAI,CAAC;AAC1E,MAAM,cAAc,OAAO,SAAS,OAAO,OAAO,MAAM,OAAO,YAAY,IAAI,CAAC,CAAC;AAEjF,MAAM,cAAc,OAAO,OAAO;CAChC,SAAS,OAAO,OAAO,MAAM,OAAO,UAAU,YAAY,CAAC;CAC3D,OAAO,OAAO,YAAY,OAAO,OAAO,MAAM,OAAO,UAAU,YAAY,CAAC,CAAC;CAC7E,MAAM,OAAO,YAAY,OAAO,eAAe,MAAM,OAAO,YAAY,GAAG,CAAC,CAAC;AAC/E,CAAC;AAED,MAAa,YAAY,OAAO,MAAM;CACpC,OAAO,OAAO;EACZ,MA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