effect-browserbase 0.1.0-beta.104 → 0.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -307
- package/dist/Account.d.mts +17 -19
- package/dist/Account.mjs +4 -9
- package/dist/Account.mjs.map +1 -1
- package/dist/{Acquisition-WBafHwXH.mjs → Acquisition-CAsTTXp4.mjs} +25 -70
- package/dist/Acquisition-CAsTTXp4.mjs.map +1 -0
- package/dist/Agents-5HpTp9YE.d.mts +155 -0
- package/dist/Agents.d.mts +3 -156
- package/dist/Agents.mjs +4 -20
- 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-DpSajNai.mjs +270 -0
- package/dist/Browser-DpSajNai.mjs.map +1 -0
- package/dist/Browser.d.mts +26 -143
- package/dist/Browser.mjs +3 -223
- package/dist/BrowserBinding.d.mts +7 -34
- package/dist/BrowserBinding.mjs +30 -1
- package/dist/BrowserBinding.mjs.map +1 -0
- package/dist/Certificates-D4NQmyeA.d.mts +34 -0
- package/dist/Certificates.d.mts +3 -35
- 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-4RMKIpL2.mjs} +12 -12
- package/dist/Client-4RMKIpL2.mjs.map +1 -0
- package/dist/{Client-Ca0zSg1n.d.mts → Client-B_f6bBLT.d.mts} +4 -5
- package/dist/Client.d.mts +3 -2
- package/dist/Client.mjs +1 -1
- package/dist/Connection-sxyxtwlk.mjs +56 -0
- package/dist/Connection-sxyxtwlk.mjs.map +1 -0
- package/dist/ContextCoordination.d.mts +5 -6
- package/dist/ContextCoordination.mjs +2 -9
- package/dist/ContextCoordination.mjs.map +1 -1
- package/dist/{ContextWriter-BrQmoXRg.mjs → ContextWriter-oKWFLHuP.mjs} +8 -12
- package/dist/ContextWriter-oKWFLHuP.mjs.map +1 -0
- package/dist/Contexts-DqdL7cyX.d.mts +31 -0
- package/dist/Contexts.d.mts +3 -32
- package/dist/Contexts.mjs +3 -9
- package/dist/Contexts.mjs.map +1 -1
- package/dist/Downloads-CdhiCO5X.d.mts +43 -0
- package/dist/Downloads.d.mts +3 -44
- 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-DBXuVM1f.d.mts +43 -0
- package/dist/{Extensions-ClZbYb1H.mjs → Extensions-Dg3jHOf0.mjs} +3 -9
- package/dist/Extensions-Dg3jHOf0.mjs.map +1 -0
- package/dist/Extensions.d.mts +3 -44
- package/dist/Extensions.mjs +1 -1
- package/dist/Functions-CsKMMUuZ.d.mts +226 -0
- package/dist/Functions.d.mts +3 -227
- package/dist/Functions.mjs +4 -18
- package/dist/Functions.mjs.map +1 -1
- package/dist/{Launch-BHcAEq05.mjs → Launch-cAdE2rrZ.mjs} +16 -12
- package/dist/Launch-cAdE2rrZ.mjs.map +1 -0
- package/dist/Launch.d.mts +127 -2
- package/dist/Launch.mjs +5 -13
- package/dist/Launch.mjs.map +1 -1
- package/dist/PageFetch-CAMqb5m8.d.mts +39 -0
- package/dist/PageFetch.d.mts +3 -40
- package/dist/PageFetch.mjs +2 -8
- package/dist/PageFetch.mjs.map +1 -1
- package/dist/Projects-tm5bTDH0.d.mts +38 -0
- package/dist/Projects.d.mts +3 -39
- package/dist/Projects.mjs +2 -8
- package/dist/Projects.mjs.map +1 -1
- package/dist/Recordings-bVI33sTq.d.mts +27 -0
- package/dist/Recordings.d.mts +3 -28
- 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-Bo-9xeLz.d.mts +27 -0
- package/dist/Replays.d.mts +3 -28
- package/dist/Replays.mjs +3 -5
- package/dist/Replays.mjs.map +1 -1
- package/dist/Search-1g6TUem7.d.mts +37 -0
- package/dist/Search.d.mts +3 -38
- 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-B8E4kMxo.d.mts → Sessions-BpZgjteE.d.mts} +8 -8
- package/dist/{Sessions-CtbseWEh.mjs → Sessions-suOLSym9.mjs} +34 -18
- package/dist/Sessions-suOLSym9.mjs.map +1 -0
- package/dist/Sessions.d.mts +4 -3
- package/dist/Sessions.mjs +1 -1
- package/dist/Testing.d.mts +119 -0
- package/dist/Testing.mjs +206 -0
- package/dist/Testing.mjs.map +1 -0
- 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-C2neBEpj.d.mts +28 -0
- package/dist/Uploads.d.mts +3 -29
- package/dist/Uploads.mjs +3 -5
- package/dist/Uploads.mjs.map +1 -1
- package/dist/Webhooks-BoeRAxzG.d.mts +59 -0
- package/dist/Webhooks.d.mts +3 -60
- package/dist/Webhooks.mjs +2 -11
- package/dist/Webhooks.mjs.map +1 -1
- package/dist/{WriterFacts-osvYAsIx.d.mts → WriterFacts-BBJRDZYY.d.mts} +8 -15
- package/dist/index.d.mts +27 -31
- package/dist/index.mjs +26 -31
- package/package.json +7 -28
- 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.mjs.map +0 -1
- package/dist/BrowserBinding-DlJTGYZL.mjs +0 -2508
- package/dist/BrowserBinding-DlJTGYZL.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-Bc0z9IAi.mjs +0 -571
- package/dist/Capture-Bc0z9IAi.mjs.map +0 -1
- package/dist/Capture-BvWI-l1A.d.mts +0 -168
- package/dist/Capture.d.mts +0 -2
- package/dist/Capture.mjs +0 -2
- package/dist/Client-D1_xYM9o.mjs.map +0 -1
- package/dist/ContextWriter-BrQmoXRg.mjs.map +0 -1
- package/dist/Extensions-ClZbYb1H.mjs.map +0 -1
- 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/LocalBrowser-BLancJ3R.d.mts +0 -79
- package/dist/LocalBrowser-DsQLWNL1.mjs +0 -439
- package/dist/LocalBrowser-DsQLWNL1.mjs.map +0 -1
- package/dist/LocalBrowser.d.mts +0 -2
- package/dist/LocalBrowser.mjs +0 -2
- 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/Session-D4nT9hOO.mjs +0 -1379
- package/dist/Session-D4nT9hOO.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":"Certificates.mjs","names":[],"sources":["../src/Certificates.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { CertificateError } from \"./Errors.ts\";\nimport { resource } from \"./internal/http/Resource.ts\";\nimport { Identifier } from \"./References.ts\";\nimport { SafeFilename } from \"./Transfers.ts\";\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\nconst MAX_CERTIFICATE_BYTES = 1024 * 1024;\n\n/** Select a certificate at launch with `provider.proxySettings.caCertificates: [certificateId]`. */\nexport class CertificateMetadata extends Schema.Class<CertificateMetadata>(\n \"BrowserbaseCertificateMetadata\",\n)({\n certificateId: Identifier,\n projectId: Identifier,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n}) {}\n\nexport interface CertificateUpload {\n /** PEM or DER bytes of one CA certificate. */\n readonly bytes: Uint8Array;\n /** Portable basename sent with the part; defaults to `certificate.pem`. */\n readonly filename?: string;\n readonly maxBytes?: number;\n readonly timeoutMillis?: number;\n}\n\nconst Upload = Schema.Struct({\n filename: Schema.optionalKey(SafeFilename),\n maxBytes: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: MAX_CERTIFICATE_BYTES })),\n ),\n timeoutMillis: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 600_000 })),\n ),\n});\n\nconst ProviderCertificate = Schema.Struct({\n id: Identifier,\n projectId: Identifier,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n});\n\n/** Proxy CA certificates. Registration is one bounded multipart mutation, never retried. */\nexport class BrowserbaseCertificates extends Context.Service<\n BrowserbaseCertificates,\n {\n readonly create: (\n upload: CertificateUpload,\n ) => Effect.Effect<CertificateMetadata, CertificateError>;\n readonly list: Effect.Effect<ReadonlyArray<CertificateMetadata>, CertificateError>;\n readonly retrieve: (\n certificateId: string,\n ) => Effect.Effect<CertificateMetadata, CertificateError>;\n readonly delete: (certificateId: string) => Effect.Effect<void, CertificateError>;\n }\n>()(\"effect-browserbase/Certificates\") {\n static readonly layer: Layer.Layer<BrowserbaseCertificates, never, BrowserbaseClient> =\n Layer.effect(\n BrowserbaseCertificates,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n const api = resource<CertificateError>(client, (failure) => CertificateError.make(failure));\n\n const own = (operation: CertificateError[\"operation\"], mutation: boolean) =>\n Effect.fnUntraced(function* (value: typeof ProviderCertificate.Type) {\n if (value.projectId !== client.projectId)\n return yield* api.malformed(operation, mutation);\n\n const { id, ...rest } = value;\n\n return CertificateMetadata.make({ certificateId: id, ...rest });\n });\n\n const create = Effect.fn(\"BrowserbaseCertificates.create\")(function* (\n upload: CertificateUpload,\n ) {\n const { bytes, ...options } = upload;\n const value = yield* api.input(Upload, options, \"certificate-create\");\n const owned = new Uint8Array(bytes);\n\n const raw = yield* client\n .upload(\n \"/v1/certificates\",\n {\n field: \"file\",\n filename: value.filename ?? \"certificate.pem\",\n mediaType: \"application/x-pem-file\",\n bytes: owned,\n },\n {\n maxBytes: value.maxBytes ?? 64 * 1024,\n ...(value.timeoutMillis === undefined\n ? {}\n : { timeoutMillis: value.timeoutMillis }),\n },\n )\n .pipe(Effect.mapError(api.fromClient(\"certificate-create\")));\n\n const created = yield* Schema.decodeUnknownEffect(ProviderCertificate)(raw).pipe(\n Effect.mapError(() => api.malformed(\"certificate-create\", true)),\n );\n\n return yield* own(\"certificate-create\", true)(created);\n });\n\n const list = api\n .request(\n \"GET\",\n \"/v1/certificates\",\n Schema.Array(ProviderCertificate).check(Schema.isMaxLength(1024)),\n \"certificate-list\",\n )\n .pipe(\n Effect.flatMap(Effect.forEach(own(\"certificate-list\", false))),\n Effect.withSpan(\"BrowserbaseCertificates.list\"),\n );\n\n const retrieve = Effect.fn(\"BrowserbaseCertificates.retrieve\")(function* (\n certificateId: string,\n ) {\n const id = yield* api.input(Identifier, certificateId, \"certificate-retrieve\");\n\n const value = yield* api.request(\n \"GET\",\n `/v1/certificates/${api.segment(id)}`,\n ProviderCertificate,\n \"certificate-retrieve\",\n );\n\n if (value.id !== id) return yield* api.malformed(\"certificate-retrieve\", false);\n\n return yield* own(\"certificate-retrieve\", false)(value);\n });\n\n const remove = Effect.fn(\"BrowserbaseCertificates.delete\")(function* (\n certificateId: string,\n ) {\n const id = yield* api.input(Identifier, certificateId, \"certificate-delete\");\n\n yield* api.remove(`/v1/certificates/${api.segment(id)}`, \"certificate-delete\");\n });\n\n return BrowserbaseCertificates.of({ create, list, retrieve, delete: remove });\n }),\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Certificates.mjs","names":[],"sources":["../src/Certificates.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { CertificateError } from \"./Errors.ts\";\nimport { resource } from \"./internal/http/Resource.ts\";\nimport { Identifier } from \"./References.ts\";\nimport { SafeFilename } from \"./Transfers.ts\";\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\nconst MAX_CERTIFICATE_BYTES = 1024 * 1024;\n\n/** Select a certificate at launch with `provider.proxySettings.caCertificates: [certificateId]`. */\nexport class CertificateMetadata extends Schema.Class<CertificateMetadata>(\n \"BrowserbaseCertificateMetadata\",\n)({\n certificateId: Identifier,\n projectId: Identifier,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n}) {}\n\nexport interface CertificateUpload {\n /** PEM or DER bytes of one CA certificate. */\n readonly bytes: Uint8Array;\n /** Portable basename sent with the part; defaults to `certificate.pem`. */\n readonly filename?: string;\n readonly maxBytes?: number;\n readonly timeoutMillis?: number;\n}\n\nconst Upload = Schema.Struct({\n filename: Schema.optionalKey(SafeFilename),\n maxBytes: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: MAX_CERTIFICATE_BYTES })),\n ),\n timeoutMillis: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 600_000 })),\n ),\n});\n\nconst ProviderCertificate = Schema.Struct({\n id: Identifier,\n projectId: Identifier,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n});\n\n/** Proxy CA certificates. Registration is one bounded multipart mutation, never retried. */\nexport class BrowserbaseCertificates extends Context.Service<\n BrowserbaseCertificates,\n {\n readonly create: (\n upload: CertificateUpload,\n ) => Effect.Effect<CertificateMetadata, CertificateError>;\n readonly list: Effect.Effect<ReadonlyArray<CertificateMetadata>, CertificateError>;\n readonly retrieve: (\n certificateId: string,\n ) => Effect.Effect<CertificateMetadata, CertificateError>;\n readonly delete: (certificateId: string) => Effect.Effect<void, CertificateError>;\n }\n>()(\"effect-browserbase/Certificates\") {\n static readonly layer: Layer.Layer<BrowserbaseCertificates, never, BrowserbaseClient> =\n Layer.effect(\n BrowserbaseCertificates,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n const api = resource<CertificateError>(client, (failure) => CertificateError.make(failure));\n\n const own = (operation: CertificateError[\"operation\"], mutation: boolean) =>\n Effect.fnUntraced(function* (value: typeof ProviderCertificate.Type) {\n if (value.projectId !== client.projectId)\n return yield* api.malformed(operation, mutation);\n\n const { id, ...rest } = value;\n\n return CertificateMetadata.make({ certificateId: id, ...rest });\n });\n\n const create = Effect.fn(\"BrowserbaseCertificates.create\")(function* (\n upload: CertificateUpload,\n ) {\n const { bytes, ...options } = upload;\n const value = yield* api.input(Upload, options, \"certificate-create\");\n const owned = new Uint8Array(bytes);\n\n const raw = yield* client\n .upload(\n \"/v1/certificates\",\n {\n field: \"file\",\n filename: value.filename ?? \"certificate.pem\",\n mediaType: \"application/x-pem-file\",\n bytes: owned,\n },\n {\n maxBytes: value.maxBytes ?? 64 * 1024,\n ...(value.timeoutMillis === undefined\n ? {}\n : { timeoutMillis: value.timeoutMillis }),\n },\n )\n .pipe(Effect.mapError(api.fromClient(\"certificate-create\")));\n\n const created = yield* Schema.decodeUnknownEffect(ProviderCertificate)(raw).pipe(\n Effect.mapError(() => api.malformed(\"certificate-create\", true)),\n );\n\n return yield* own(\"certificate-create\", true)(created);\n });\n\n const list = api\n .request(\n \"GET\",\n \"/v1/certificates\",\n Schema.Array(ProviderCertificate).check(Schema.isMaxLength(1024)),\n \"certificate-list\",\n )\n .pipe(\n Effect.flatMap(Effect.forEach(own(\"certificate-list\", false))),\n Effect.withSpan(\"BrowserbaseCertificates.list\"),\n );\n\n const retrieve = Effect.fn(\"BrowserbaseCertificates.retrieve\")(function* (\n certificateId: string,\n ) {\n const id = yield* api.input(Identifier, certificateId, \"certificate-retrieve\");\n\n const value = yield* api.request(\n \"GET\",\n `/v1/certificates/${api.segment(id)}`,\n ProviderCertificate,\n \"certificate-retrieve\",\n );\n\n if (value.id !== id) return yield* api.malformed(\"certificate-retrieve\", false);\n\n return yield* own(\"certificate-retrieve\", false)(value);\n });\n\n const remove = Effect.fn(\"BrowserbaseCertificates.delete\")(function* (\n certificateId: string,\n ) {\n const id = yield* api.input(Identifier, certificateId, \"certificate-delete\");\n\n yield* api.remove(`/v1/certificates/${api.segment(id)}`, \"certificate-delete\");\n });\n\n return BrowserbaseCertificates.of({ create, list, retrieve, delete: remove });\n }),\n );\n}\n"],"mappings":";;;;;;;AAQA,MAAM,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC;AAC5D,MAAM,wBAAwB;;AAG9B,IAAa,sBAAb,cAAyC,OAAO,MAC9C,gCACF,CAAC,CAAC;CACA,eAAe;CACf,WAAW;CACX,WAAW;CACX,WAAW;AACb,CAAC,CAAC,CAAC,CAAC;AAWJ,MAAM,SAAS,OAAO,OAAO;CAC3B,UAAU,OAAO,YAAY,YAAY;CACzC,UAAU,OAAO,YACf,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAA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AC,CAAC,GAAG,CAAC,CAAC,KAC1E,OAAO,eAAe,IAAI,UAAU,sBAAsB,IAAI,CAAC,CACjE;GAEA,OAAO,OAAO,IAAI,sBAAsB,IAAI,CAAC,CAAC,OAAO;EACvD,CAAC;EAED,MAAM,OAAO,IACV,QACC,OACA,oBACA,OAAO,MAAM,mBAAmB,CAAC,CAAC,MAAM,OAAO,YAAY,IAAI,CAAC,GAChE,kBACF,CAAC,CACA,KACC,OAAO,QAAQ,OAAO,QAAQ,IAAI,oBAAoB,KAAK,CAAC,CAAC,GAC7D,OAAO,SAAS,8BAA8B,CAChD;EAEF,MAAM,WAAW,OAAO,GAAG,kCAAkC,CAAC,CAAC,WAC7D,eACA;GACA,MAAM,KAAK,OAAO,IAAI,MAAM,YAAY,eAAe,sBAAsB;GAE7E,MAAM,QAAQ,OAAO,IAAI,QACvB,OACA,oBAAoB,IAAI,QAAQ,EAAE,KAClC,qBACA,sBACF;GAEA,IAAI,MAAM,OAAO,IAAI,OAAO,OAAO,IAAI,UAAU,wBAAwB,KAAK;GAE9E,OAAO,OAAO,IAAI,wBAAwB,KAAK,CAAC,CAAC,KAAK;EACxD,CAAC;EAED,MAAM,SAAS,OAAO,GAAG,gCAAgC,CAAC,CAAC,WACzD,eACA;GACA,MAAM,KAAK,OAAO,IAAI,MAAM,YAAY,eAAe,oBAAoB;GAE3E,OAAO,IAAI,OAAO,oBAAoB,IAAI,QAAQ,EAAE,KAAK,oBAAoB;EAC/E,CAAC;EAED,OAAO,wBAAwB,GAAG;GAAE;GAAQ;GAAM;GAAU,QAAQ;EAAO,CAAC;CAC9E,CAAC,CACH;AACJ"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as SessionReference } from "./References-DOH3Wu44.mjs";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
|
-
|
|
4
|
-
export { CleanupIssue, CleanupResult };
|
|
5
|
-
}
|
|
3
|
+
//#region src/Cleanup.d.ts
|
|
6
4
|
declare const CleanupIssue_base: Schema.Class<CleanupIssue, Schema.Struct<{
|
|
7
5
|
readonly step: Schema.Literals<readonly ["fence", "capture", "initialization", "disconnect", "release", "status"]>;
|
|
8
6
|
readonly reason: Schema.Literals<readonly ["timeout", "failed", "interrupted"]>;
|
|
@@ -20,5 +18,6 @@ declare const CleanupResult_base: Schema.Class<CleanupResult, Schema.Struct<{
|
|
|
20
18
|
/** Local disconnection, release acknowledgement, and terminal observation are separate facts. */
|
|
21
19
|
declare class CleanupResult extends CleanupResult_base {}
|
|
22
20
|
//#endregion
|
|
23
|
-
export { CleanupResult as n,
|
|
24
|
-
|
|
21
|
+
export { CleanupResult as n, CleanupIssue as t };
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=Cleanup-DMTDBir8.d.mts.map
|
package/dist/Cleanup.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { n as CleanupResult, t as CleanupIssue } from "./Cleanup-
|
|
2
|
-
export { CleanupIssue, CleanupResult };
|
|
1
|
+
import { n as CleanupResult, t as CleanupIssue } from "./Cleanup-DMTDBir8.mjs";
|
|
2
|
+
export { CleanupIssue, CleanupResult };
|
|
3
|
+
export {};
|
package/dist/Cleanup.mjs
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
1
|
import { SessionReference } from "./References.mjs";
|
|
3
2
|
import { SessionStatus } from "./SessionData.mjs";
|
|
4
3
|
import { Schema } from "effect";
|
|
5
4
|
//#region src/Cleanup.ts
|
|
6
|
-
var Cleanup_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
-
CleanupIssue: () => CleanupIssue,
|
|
8
|
-
CleanupResult: () => CleanupResult
|
|
9
|
-
});
|
|
10
5
|
var CleanupIssue = class extends Schema.Class("BrowserbaseCleanupIssue")({
|
|
11
6
|
step: Schema.Literals([
|
|
12
7
|
"fence",
|
|
@@ -43,6 +38,6 @@ var CleanupResult = class extends Schema.Class("BrowserbaseCleanupResult")({
|
|
|
43
38
|
issues: Schema.Array(CleanupIssue).check(Schema.isMaxLength(64))
|
|
44
39
|
}) {};
|
|
45
40
|
//#endregion
|
|
46
|
-
export { CleanupIssue, CleanupResult
|
|
41
|
+
export { CleanupIssue, CleanupResult };
|
|
47
42
|
|
|
48
43
|
//# sourceMappingURL=Cleanup.mjs.map
|
package/dist/Cleanup.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cleanup.mjs","names":[],"sources":["../src/Cleanup.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nimport { SessionReference } from \"./References.ts\";\nimport { SessionStatus } from \"./SessionData.ts\";\n\nexport class CleanupIssue extends Schema.Class<CleanupIssue>(\"BrowserbaseCleanupIssue\")({\n step: Schema.Literals([\"fence\", \"capture\", \"initialization\", \"disconnect\", \"release\", \"status\"]),\n reason: Schema.Literals([\"timeout\", \"failed\", \"interrupted\"]),\n}) {}\n\n/** Local disconnection, release acknowledgement, and terminal observation are separate facts. */\nexport class CleanupResult extends Schema.Class<CleanupResult>(\"BrowserbaseCleanupResult\")({\n reference: SessionReference,\n ownership: Schema.Literals([\"owned\", \"borrowed\"]),\n releaseRequested: Schema.Boolean,\n remote: Schema.Literals([\"confirmed\", \"pending\", \"unknown\", \"not-owned\"]),\n local: Schema.Literals([\"closed\", \"failed\", \"not-connected\", \"pending\"]),\n observedStatus: Schema.optionalKey(SessionStatus),\n issues: Schema.Array(CleanupIssue).check(Schema.isMaxLength(64)),\n}) {}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Cleanup.mjs","names":[],"sources":["../src/Cleanup.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nimport { SessionReference } from \"./References.ts\";\nimport { SessionStatus } from \"./SessionData.ts\";\n\nexport class CleanupIssue extends Schema.Class<CleanupIssue>(\"BrowserbaseCleanupIssue\")({\n step: Schema.Literals([\"fence\", \"capture\", \"initialization\", \"disconnect\", \"release\", \"status\"]),\n reason: Schema.Literals([\"timeout\", \"failed\", \"interrupted\"]),\n}) {}\n\n/** Local disconnection, release acknowledgement, and terminal observation are separate facts. */\nexport class CleanupResult extends Schema.Class<CleanupResult>(\"BrowserbaseCleanupResult\")({\n reference: SessionReference,\n ownership: Schema.Literals([\"owned\", \"borrowed\"]),\n releaseRequested: Schema.Boolean,\n remote: Schema.Literals([\"confirmed\", \"pending\", \"unknown\", \"not-owned\"]),\n local: Schema.Literals([\"closed\", \"failed\", \"not-connected\", \"pending\"]),\n observedStatus: Schema.optionalKey(SessionStatus),\n issues: Schema.Array(CleanupIssue).check(Schema.isMaxLength(64)),\n}) {}\n"],"mappings":";;;;AAKA,IAAa,eAAb,cAAkC,OAAO,MAAoB,yBAAyB,CAAC,CAAC;CACtF,MAAM,OAAO,SAAS;EAAC;EAAS;EAAW;EAAkB;EAAc;EAAW;CAAQ,CAAC;CAC/F,QAAQ,OAAO,SAAS;EAAC;EAAW;EAAU;CAAa,CAAC;AAC9D,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,gBAAb,cAAmC,OAAO,MAAqB,0BAA0B,CAAC,CAAC;CACzF,WAAW;CACX,WAAW,OAAO,SAAS,CAAC,SAAS,UAAU,CAAC;CAChD,kBAAkB,OAAO;CACzB,QAAQ,OAAO,SAAS;EAAC;EAAa;EAAW;EAAW;CAAW,CAAC;CACxE,OAAO,OAAO,SAAS;EAAC;EAAU;EAAU;EAAiB;CAAS,CAAC;CACvE,gBAAgB,OAAO,YAAY,aAAa;CAChD,QAAQ,OAAO,MAAM,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,EAAE,CAAC;AACjE,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
1
|
import { Identifier } from "./References.mjs";
|
|
3
2
|
import { ClientError } from "./Errors.mjs";
|
|
4
3
|
import { SafeFilename } from "./Transfers.mjs";
|
|
5
|
-
import { Clock, Config, Context, Duration, Effect, Layer, Redacted, Schema, Stream } from "effect";
|
|
4
|
+
import { Clock, Config, Context, Duration, Effect, Layer, Random, Redacted, Schema, Stream } from "effect";
|
|
6
5
|
import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/unstable/http";
|
|
7
6
|
//#region src/internal/http/Multipart.ts
|
|
8
7
|
const FIELD = /^[a-z][a-z0-9_]{0,31}$/;
|
|
@@ -11,9 +10,11 @@ const PRINTABLE_ASCII = /^[\x20-\x7e]+$/;
|
|
|
11
10
|
const isSafeFilename = Schema.is(SafeFilename);
|
|
12
11
|
/** Quoting is only safe for a portable, printable, quote-free basename. */
|
|
13
12
|
const quotable = (value) => isSafeFilename(value) && PRINTABLE_ASCII.test(value) && !value.includes("\"");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Sixteen bytes from the fiber's `Random`. A boundary needs no secrecy: the encoder checks that
|
|
15
|
+
* the content does not contain it, and draws another if it does.
|
|
16
|
+
*/
|
|
17
|
+
const randomBoundary = Effect.map(Effect.all(Array.from({ length: 16 }, () => Random.nextIntBetween(0, 255))), (bytes) => `effect-agent-browserbase-${bytes.map((byte) => byte.toString(16).padStart(2, "0")).join("")}`);
|
|
17
18
|
const contains = (haystack, needle) => {
|
|
18
19
|
const first = needle[0];
|
|
19
20
|
if (first === void 0 || needle.length > haystack.length) return false;
|
|
@@ -31,7 +32,7 @@ const contains = (haystack, needle) => {
|
|
|
31
32
|
* A deliberately small RFC 7578 encoder: one file part, an ASCII-quotable name and a
|
|
32
33
|
* delimiter proven absent from the content. It performs no filesystem or stream work.
|
|
33
34
|
*/
|
|
34
|
-
const encodeFilePart = (part, maxBytes, boundaries = randomBoundary)
|
|
35
|
+
const encodeFilePart = Effect.fnUntraced(function* (part, maxBytes, boundaries = randomBoundary) {
|
|
35
36
|
if (!FIELD.test(part.field) || !quotable(part.filename) || !MEDIA_TYPE.test(part.mediaType) || !Number.isSafeInteger(maxBytes) || maxBytes < 1 || maxBytes > 2 ** 31 - 1) return {
|
|
36
37
|
_tag: "Rejected",
|
|
37
38
|
reason: "configuration"
|
|
@@ -42,7 +43,7 @@ const encodeFilePart = (part, maxBytes, boundaries = randomBoundary) => {
|
|
|
42
43
|
};
|
|
43
44
|
const encoder = new TextEncoder();
|
|
44
45
|
for (let attempt = 0; attempt < 4; attempt++) {
|
|
45
|
-
const boundary = boundaries
|
|
46
|
+
const boundary = yield* boundaries;
|
|
46
47
|
if (!/^[A-Za-z0-9-]{1,70}$/.test(boundary)) continue;
|
|
47
48
|
const delimiter = encoder.encode(boundary);
|
|
48
49
|
if (contains(part.bytes, delimiter)) continue;
|
|
@@ -62,7 +63,7 @@ const encodeFilePart = (part, maxBytes, boundaries = randomBoundary) => {
|
|
|
62
63
|
_tag: "Rejected",
|
|
63
64
|
reason: "configuration"
|
|
64
65
|
};
|
|
65
|
-
};
|
|
66
|
+
});
|
|
66
67
|
//#endregion
|
|
67
68
|
//#region src/internal/http/Transport.ts
|
|
68
69
|
const API_ORIGIN = "https://api.browserbase.com";
|
|
@@ -272,7 +273,7 @@ const makeTransport = Effect.fnUntraced(function* (options) {
|
|
|
272
273
|
reason: "configuration",
|
|
273
274
|
outcome: "undispatched"
|
|
274
275
|
});
|
|
275
|
-
const encoded = encodeFilePart(part, limits.maxBytes);
|
|
276
|
+
const encoded = yield* encodeFilePart(part, limits.maxBytes);
|
|
276
277
|
if (encoded._tag === "Rejected") return yield* ClientError.make({
|
|
277
278
|
operation,
|
|
278
279
|
reason: encoded.reason,
|
|
@@ -392,7 +393,6 @@ const makeTransport = Effect.fnUntraced(function* (options) {
|
|
|
392
393
|
});
|
|
393
394
|
//#endregion
|
|
394
395
|
//#region src/Client.ts
|
|
395
|
-
var Client_exports = /* @__PURE__ */ __exportAll({ BrowserbaseClient: () => BrowserbaseClient });
|
|
396
396
|
/**
|
|
397
397
|
* One immutable Browserbase account and approved transport, shared by every resource Layer.
|
|
398
398
|
* Constructing the Layer performs no request and never loads the native browser peer.
|
|
@@ -419,6 +419,6 @@ var BrowserbaseClient = class BrowserbaseClient extends Context.Service()("effec
|
|
|
419
419
|
}
|
|
420
420
|
};
|
|
421
421
|
//#endregion
|
|
422
|
-
export {
|
|
422
|
+
export { BrowserbaseClient as t };
|
|
423
423
|
|
|
424
|
-
//# sourceMappingURL=Client-
|
|
424
|
+
//# sourceMappingURL=Client-4RMKIpL2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Client-4RMKIpL2.mjs","names":[],"sources":["../src/internal/http/Multipart.ts","../src/internal/http/Transport.ts","../src/Client.ts"],"sourcesContent":["import { Effect, Random, Schema } from \"effect\";\n\nimport type { MultipartFile } from \"../../Client.ts\";\nimport { SafeFilename } from \"../../Transfers.ts\";\n\n/** One file part is the only multipart shape this transport produces. */\nexport type MultipartResult =\n | {\n readonly _tag: \"Encoded\";\n readonly contentType: string;\n readonly body: Uint8Array;\n }\n | { readonly _tag: \"Rejected\"; readonly reason: \"configuration\" | \"limit\" };\n\nconst FIELD = /^[a-z][a-z0-9_]{0,31}$/;\nconst MEDIA_TYPE = /^[a-z0-9][a-z0-9!#$&^_+.-]{0,63}\\/[a-z0-9][a-z0-9!#$&^_+.-]{0,63}$/;\nconst PRINTABLE_ASCII = /^[\\x20-\\x7e]+$/;\n\nconst isSafeFilename = Schema.is(SafeFilename);\n\n/** Quoting is only safe for a portable, printable, quote-free basename. */\nconst quotable = (value: string): boolean =>\n isSafeFilename(value) && PRINTABLE_ASCII.test(value) && !value.includes('\"');\n\n/**\n * Sixteen bytes from the fiber's `Random`. A boundary needs no secrecy: the encoder checks that\n * the content does not contain it, and draws another if it does.\n */\nconst randomBoundary: Effect.Effect<string> = Effect.map(\n Effect.all(Array.from({ length: 16 }, () => Random.nextIntBetween(0, 255))),\n (bytes) =>\n `effect-agent-browserbase-${bytes.map((byte) => byte.toString(16).padStart(2, \"0\")).join(\"\")}`,\n);\n\nconst contains = (haystack: Uint8Array, needle: Uint8Array): boolean => {\n const first = needle[0];\n\n if (first === undefined || needle.length > haystack.length) return false;\n\n outer: for (let i = 0; i <= haystack.length - needle.length; i++) {\n if (haystack[i] !== first) continue;\n for (let j = 1; j < needle.length; j++) {\n const expected = needle[j];\n\n if (expected === undefined || haystack[i + j] !== expected) continue outer;\n }\n\n return true;\n }\n\n return false;\n};\n\n/**\n * A deliberately small RFC 7578 encoder: one file part, an ASCII-quotable name and a\n * delimiter proven absent from the content. It performs no filesystem or stream work.\n */\nexport const encodeFilePart = Effect.fnUntraced(function* (\n part: MultipartFile,\n maxBytes: number,\n boundaries: Effect.Effect<string> = randomBoundary,\n): Effect.fn.Return<MultipartResult> {\n if (\n !FIELD.test(part.field) ||\n !quotable(part.filename) ||\n !MEDIA_TYPE.test(part.mediaType) ||\n !Number.isSafeInteger(maxBytes) ||\n maxBytes < 1 ||\n maxBytes > 2 ** 31 - 1\n ) {\n return { _tag: \"Rejected\", reason: \"configuration\" };\n }\n if (part.bytes.byteLength > maxBytes) return { _tag: \"Rejected\", reason: \"limit\" };\n const encoder = new TextEncoder();\n\n for (let attempt = 0; attempt < 4; attempt++) {\n const boundary = yield* boundaries;\n\n if (!/^[A-Za-z0-9-]{1,70}$/.test(boundary)) continue;\n const delimiter = encoder.encode(boundary);\n\n if (contains(part.bytes, delimiter)) continue;\n\n const head = encoder.encode(\n `--${boundary}\\r\\nContent-Disposition: form-data; name=\"${part.field}\"; filename=\"${part.filename}\"\\r\\nContent-Type: ${part.mediaType}\\r\\n\\r\\n`,\n );\n\n const tail = encoder.encode(`\\r\\n--${boundary}--\\r\\n`);\n const body = new Uint8Array(head.byteLength + part.bytes.byteLength + tail.byteLength);\n\n body.set(head, 0);\n body.set(part.bytes, head.byteLength);\n body.set(tail, head.byteLength + part.bytes.byteLength);\n\n return {\n _tag: \"Encoded\",\n contentType: `multipart/form-data; boundary=${boundary}`,\n body,\n };\n }\n\n return { _tag: \"Rejected\", reason: \"configuration\" };\n});\n","import { Clock, Duration, Effect, Redacted, Schema, Stream } from \"effect\";\nimport {\n FetchHttpClient,\n HttpClient,\n HttpClientRequest,\n type HttpClientResponse,\n} from \"effect/unstable/http\";\n\nimport type { ClientMethod, ClientOptions, MultipartFile, UploadLimits } from \"../../Client.ts\";\nimport { ClientError } from \"../../Errors.ts\";\nimport { Identifier } from \"../../References.ts\";\nimport { encodeFilePart } from \"./Multipart.ts\";\n\nconst API_ORIGIN = \"https://api.browserbase.com\";\nconst MAX_JSON_BYTES = 1024 * 1024;\nconst MAX_JSON_DEPTH = 64;\n\nconst Options = Schema.Struct({\n projectId: Identifier,\n apiKey: Schema.Redacted(\n Schema.NonEmptyString.check(Schema.isMaxLength(8192), Schema.isPattern(/^[\\x21-\\x7e]+$/)),\n ),\n artifactOrigins: Schema.optionalKey(\n Schema.Array(Schema.String.check(Schema.isMaxLength(8192))).check(\n Schema.isMaxLength(32),\n Schema.isUnique(),\n ),\n ),\n requestTimeoutMillis: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 60_000 })),\n ),\n});\n\nconst nowMillis = Clock.monotonicTimeNanos.pipe(Effect.map((value) => Number(value) / 1_000_000));\n\nconst deadlineAfter = (millis: number) => nowMillis.pipe(Effect.map((now) => now + millis));\n\nconst within = <A, E, R>(\n effect: Effect.Effect<A, E, R>,\n deadline: number,\n operation: ClientError[\"operation\"],\n outcome?: \"undispatched\" | \"unknown\",\n): Effect.Effect<A, E | ClientError, R> =>\n Effect.suspend(() =>\n nowMillis.pipe(\n Effect.flatMap((now) => {\n const remaining = deadline - now;\n\n const timeout = () =>\n Effect.fail(\n ClientError.make({\n operation,\n reason: \"timeout\",\n ...(outcome === undefined ? {} : { outcome }),\n }),\n );\n\n return remaining <= 0\n ? timeout()\n : effect.pipe(\n Effect.timeoutOrElse({\n duration: Duration.millis(remaining),\n orElse: timeout,\n }),\n );\n }),\n ),\n );\n\nconst withinJsonDepth = (text: string): boolean => {\n let depth = 0;\n let quoted = false;\n let escaped = false;\n\n for (const character of text) {\n if (quoted) {\n if (escaped) escaped = false;\n else if (character === \"\\\\\") escaped = true;\n else if (character === '\"') quoted = false;\n } else if (character === '\"') quoted = true;\n else if (character === \"{\" || character === \"[\") {\n if (++depth > MAX_JSON_DEPTH) return false;\n } else if (character === \"}\" || character === \"]\") depth--;\n }\n\n return true;\n};\n\nconst mediaType = (value: string | undefined): string =>\n value?.split(\";\", 1)[0]?.trim().toLowerCase() ?? \"\";\n\nconst retryAfter = (value: string | undefined, now: number): number | undefined => {\n if (value === undefined || value.length > 128) return undefined;\n const seconds = Number(value);\n\n if (Number.isFinite(seconds) && seconds >= 0) return Math.min(60_000, seconds * 1000);\n const date = Date.parse(value);\n\n return Number.isFinite(date) ? Math.min(60_000, Math.max(0, date - now)) : undefined;\n};\n\nconst mutationOutcome = (\n method: ClientMethod,\n status?: number,\n): \"rejected\" | \"unknown\" | undefined => {\n if (method === \"GET\") return undefined;\n if (status !== undefined && [400, 401, 403, 404, 409, 410, 422, 429].includes(status)) {\n return \"rejected\";\n }\n\n return \"unknown\";\n};\n\nconst statusError = (\n method: ClientMethod,\n status: number,\n operation: ClientError[\"operation\"],\n after?: number,\n) =>\n ClientError.make({\n operation,\n reason:\n status === 401 || status === 403\n ? \"authorization\"\n : status === 429\n ? \"rate-limited\"\n : status === 409\n ? \"active\"\n : status === 410\n ? \"expired\"\n : status === 422\n ? \"disabled\"\n : status === 404\n ? \"not-found\"\n : \"provider\",\n status,\n ...(mutationOutcome(method, status) === undefined\n ? {}\n : { outcome: mutationOutcome(method, status) }),\n ...(after === undefined ? {} : { retryAfterMillis: after }),\n });\n\nconst collect = (\n stream: Stream.Stream<Uint8Array, ClientError>,\n maximum: number,\n operation: ClientError[\"operation\"],\n) =>\n Effect.gen(function* () {\n const chunks: Uint8Array[] = [];\n let total = 0;\n\n yield* Stream.runForEach(stream, (chunk) =>\n Effect.suspend(() => {\n if (chunk.byteLength > maximum - total) {\n return Effect.fail(ClientError.make({ operation, reason: \"limit\" }));\n }\n total += chunk.byteLength;\n chunks.push(chunk);\n\n return Effect.void;\n }),\n );\n\n const body = new Uint8Array(total);\n let offset = 0;\n\n for (const chunk of chunks) {\n body.set(chunk, offset);\n offset += chunk.byteLength;\n }\n\n return body;\n });\n\nconst validApiPath = (path: string): boolean =>\n path.startsWith(\"/v1/\") && !path.includes(\"\\\\\") && !path.includes(\"#\") && path.length <= 16_384;\n\nexport const makeTransport = Effect.fnUntraced(function* (options: ClientOptions) {\n const configured = yield* Schema.decodeEffect(Options)(options, {\n onExcessProperty: \"error\",\n }).pipe(\n Effect.mapError(() =>\n ClientError.make({\n operation: \"configure\",\n reason: \"configuration\",\n outcome: \"undispatched\",\n }),\n ),\n );\n\n const apiKey = Redacted.value(configured.apiKey);\n const requestTimeoutMillis = configured.requestTimeoutMillis ?? 10_000;\n const artifactOrigins = new Set<string>();\n\n for (const origin of configured.artifactOrigins ?? []) {\n const url = yield* Effect.try({\n try: () => new URL(origin),\n catch: () =>\n ClientError.make({\n operation: \"configure\",\n reason: \"configuration\",\n outcome: \"undispatched\",\n }),\n });\n\n if (url.protocol !== \"https:\" || url.origin !== origin || url.username || url.password) {\n return yield* ClientError.make({\n operation: \"configure\",\n reason: \"configuration\",\n outcome: \"undispatched\",\n });\n }\n artifactOrigins.add(origin);\n }\n\n const fetch = yield* FetchHttpClient.Fetch;\n const client = yield* HttpClient.HttpClient.pipe(Effect.provide(FetchHttpClient.layer));\n const scoped = HttpClient.withScope(client);\n\n const execute = (\n request: HttpClientRequest.HttpClientRequest,\n operation: ClientError[\"operation\"],\n outcome?: \"undispatched\" | \"unknown\",\n ) =>\n scoped.execute(request).pipe(\n Effect.provideService(FetchHttpClient.Fetch, fetch),\n Effect.provideService(FetchHttpClient.RequestInit, {\n redirect: \"manual\",\n credentials: \"omit\",\n cache: \"no-store\",\n referrerPolicy: \"no-referrer\",\n }),\n Effect.provideService(HttpClient.TracerDisabledWhen, () => true),\n Effect.provideService(HttpClient.TracerPropagationEnabled, false),\n Effect.withTracerEnabled(false),\n Effect.mapError(() =>\n ClientError.make({\n operation,\n reason: \"transport\",\n ...(outcome === undefined ? {} : { outcome }),\n }),\n ),\n );\n\n /** A rejected path is a typed, undispatched configuration failure, never a defect. */\n const apiRequest = (\n method: ClientMethod,\n path: string,\n accept: string,\n operation: ClientError[\"operation\"],\n ) =>\n validApiPath(path)\n ? Effect.succeed(\n HttpClientRequest.make(method)(`${API_ORIGIN}${path}`).pipe(\n HttpClientRequest.setHeader(\"x-bb-api-key\", apiKey),\n HttpClientRequest.setHeader(\"accept\", accept),\n ),\n )\n : Effect.fail(\n ClientError.make({ operation, reason: \"configuration\", outcome: \"undispatched\" }),\n );\n\n const inspectJson = Effect.fnUntraced(function* (\n method: ClientMethod,\n response: HttpClientResponse.HttpClientResponse,\n operation: ClientError[\"operation\"],\n ) {\n if (response.status !== 200 && response.status !== 201 && response.status !== 202) {\n return yield* statusError(\n method,\n response.status,\n operation,\n retryAfter(response.headers[\"retry-after\"], yield* Clock.currentTimeMillis),\n );\n }\n if (mediaType(response.headers[\"content-type\"]) !== \"application/json\") {\n return yield* ClientError.make({\n operation,\n reason: \"content-type\",\n ...(mutationOutcome(method) === undefined ? {} : { outcome: mutationOutcome(method) }),\n });\n }\n const length = response.headers[\"content-length\"];\n\n if (length !== undefined && (!/^\\d+$/.test(length) || Number(length) > MAX_JSON_BYTES)) {\n return yield* ClientError.make({\n operation,\n reason: \"limit\",\n ...(mutationOutcome(method) === undefined ? {} : { outcome: mutationOutcome(method) }),\n });\n }\n let received = 0;\n\n return response.stream.pipe(\n Stream.mapError(() =>\n ClientError.make({\n operation,\n reason: \"transport\",\n ...(mutationOutcome(method) === undefined ? {} : { outcome: mutationOutcome(method) }),\n }),\n ),\n Stream.mapEffect((chunk) =>\n Effect.suspend(() => {\n if (chunk.byteLength > MAX_JSON_BYTES - received) {\n return Effect.fail(\n ClientError.make({\n operation,\n reason: \"limit\",\n ...(mutationOutcome(method) === undefined\n ? {}\n : { outcome: mutationOutcome(method) }),\n }),\n );\n }\n received += chunk.byteLength;\n\n return Effect.succeed(new Uint8Array(chunk));\n }),\n ),\n );\n });\n\n const readJson = Effect.fnUntraced(function* (\n method: ClientMethod,\n response: HttpClientResponse.HttpClientResponse,\n operation: ClientError[\"operation\"],\n ) {\n const stream = yield* inspectJson(method, response, operation);\n const bytes = yield* collect(stream, MAX_JSON_BYTES, operation);\n\n const text = yield* Effect.try({\n try: () => new TextDecoder(\"utf-8\", { fatal: true }).decode(bytes),\n catch: () =>\n ClientError.make({\n operation,\n reason: \"malformed\",\n ...(mutationOutcome(method) === undefined ? {} : { outcome: mutationOutcome(method) }),\n }),\n });\n\n if (!withinJsonDepth(text)) {\n return yield* ClientError.make({\n operation,\n reason: \"limit\",\n ...(mutationOutcome(method) === undefined ? {} : { outcome: mutationOutcome(method) }),\n });\n }\n\n return yield* Schema.decodeEffect(Schema.fromJsonString(Schema.Json))(text).pipe(\n Effect.mapError(() =>\n ClientError.make({\n operation,\n reason: \"malformed\",\n ...(mutationOutcome(method) === undefined ? {} : { outcome: mutationOutcome(method) }),\n }),\n ),\n );\n });\n\n const jsonOnce = Effect.fnUntraced(function* (\n method: ClientMethod,\n path: string,\n body?: Schema.Json,\n ) {\n const operation = method === \"GET\" ? \"provider-read\" : \"provider-mutation\";\n let request = yield* apiRequest(method, path, \"application/json\", operation);\n\n if (body !== undefined) {\n request = yield* HttpClientRequest.bodyJson(request, body).pipe(\n Effect.mapError(() =>\n ClientError.make({\n operation,\n reason: \"configuration\",\n outcome: \"undispatched\",\n }),\n ),\n );\n }\n const response = yield* execute(request, operation, method === \"GET\" ? undefined : \"unknown\");\n\n return yield* readJson(method, response, operation);\n });\n\n /**\n * One bounded in-memory file part. The encoder proves its delimiter absent from the\n * content, and an accepted multipart mutation is never retried: a lost reply is unknown.\n */\n const upload = Effect.fnUntraced(function* (\n path: string,\n part: MultipartFile,\n limits: UploadLimits,\n outerDeadline?: number,\n ) {\n const operation = \"provider-upload\";\n const timeoutMillis = limits.timeoutMillis ?? 60_000;\n\n if (!Number.isSafeInteger(timeoutMillis) || timeoutMillis < 1 || timeoutMillis > 600_000) {\n return yield* ClientError.make({\n operation,\n reason: \"configuration\",\n outcome: \"undispatched\",\n });\n }\n\n const encoded = yield* encodeFilePart(part, limits.maxBytes);\n\n if (encoded._tag === \"Rejected\") {\n return yield* ClientError.make({\n operation,\n reason: encoded.reason,\n outcome: \"undispatched\",\n });\n }\n\n const request = HttpClientRequest.bodyUint8Array(\n yield* apiRequest(\"POST\", path, \"application/json\", operation),\n encoded.body,\n encoded.contentType,\n );\n\n const deadline = Math.min(yield* deadlineAfter(timeoutMillis), outerDeadline ?? Infinity);\n\n return yield* within(\n Effect.scoped(\n execute(request, operation, \"unknown\").pipe(\n Effect.flatMap((response) => readJson(\"POST\", response, operation)),\n ),\n ),\n deadline,\n operation,\n \"unknown\",\n );\n });\n\n const json = Effect.fnUntraced(function* (\n method: ClientMethod,\n path: string,\n body?: Schema.Json,\n outerDeadline?: number,\n ) {\n const deadline = Math.min(\n yield* deadlineAfter(requestTimeoutMillis),\n outerDeadline ?? Infinity,\n );\n\n for (let attempt = 0; ; attempt++) {\n const result = yield* within(\n Effect.scoped(jsonOnce(method, path, body)),\n deadline,\n // A request that times out is labelled like the same request failing any other way.\n method === \"GET\" ? \"provider-read\" : \"provider-mutation\",\n method === \"GET\" ? undefined : \"unknown\",\n ).pipe(Effect.result);\n\n if (result._tag === \"Success\") return result.success;\n const error = result.failure;\n\n const retryable =\n error.reason === \"transport\" ||\n error.reason === \"rate-limited\" ||\n (error.reason === \"provider\" && (error.status ?? 0) >= 500);\n\n if (method !== \"GET\" || !retryable || attempt >= 2) return yield* error;\n const delay = error.retryAfterMillis ?? (attempt + 1) * 150;\n\n if ((yield* nowMillis) + delay >= deadline) return yield* error;\n yield* Effect.sleep(delay);\n }\n });\n\n const noContent = Effect.fnUntraced(function* (\n method: Exclude<ClientMethod, \"GET\">,\n path: string,\n body?: Schema.Json,\n outerDeadline?: number,\n ) {\n const operation = \"provider-mutation\";\n let request = yield* apiRequest(method, path, \"*/*\", operation);\n\n if (body !== undefined) {\n request = yield* HttpClientRequest.bodyJson(request, body).pipe(\n Effect.mapError(() =>\n ClientError.make({\n operation,\n reason: \"configuration\",\n outcome: \"undispatched\",\n }),\n ),\n );\n }\n\n const deadline = Math.min(\n yield* deadlineAfter(requestTimeoutMillis),\n outerDeadline ?? Infinity,\n );\n\n const response = yield* within(\n Effect.scoped(execute(request, operation, \"unknown\")),\n deadline,\n operation,\n \"unknown\",\n );\n\n if (![200, 202, 204].includes(response.status)) {\n return yield* statusError(\n method,\n response.status,\n operation,\n retryAfter(response.headers[\"retry-after\"], yield* Clock.currentTimeMillis),\n );\n }\n });\n\n const inspectBytes = Effect.fnUntraced(function* (\n response: HttpClientResponse.HttpClientResponse,\n operation: ClientError[\"operation\"],\n types: ReadonlyArray<string>,\n maximum: number,\n ) {\n if (response.status !== 200 && response.status !== 206) {\n return yield* statusError(\n \"GET\",\n response.status,\n operation,\n retryAfter(response.headers[\"retry-after\"], yield* Clock.currentTimeMillis),\n );\n }\n if (!types.includes(mediaType(response.headers[\"content-type\"]))) {\n return yield* ClientError.make({ operation, reason: \"content-type\" });\n }\n const length = response.headers[\"content-length\"];\n\n if (length !== undefined && (!/^\\d+$/.test(length) || Number(length) > maximum)) {\n return yield* ClientError.make({ operation, reason: \"limit\" });\n }\n let received = 0;\n\n return response.stream.pipe(\n Stream.mapError(() => ClientError.make({ operation, reason: \"transport\" })),\n Stream.mapEffect((chunk) =>\n Effect.suspend(() => {\n if (chunk.byteLength > maximum - received) {\n return Effect.fail(ClientError.make({ operation, reason: \"limit\" }));\n }\n received += chunk.byteLength;\n\n return Effect.succeed(new Uint8Array(chunk));\n }),\n ),\n );\n });\n\n const bytes = (\n path: string,\n maximum: number,\n types: ReadonlyArray<string>,\n timeoutMillis = requestTimeoutMillis,\n outerDeadline?: number,\n ) =>\n Stream.unwrap(\n Effect.gen(function* () {\n // A bounded authenticated read. Resource services relabel it with their own operation.\n const operation = \"provider-read\";\n\n if (\n !Number.isSafeInteger(maximum) ||\n maximum < 1 ||\n maximum > 2 ** 31 - 1 ||\n !Number.isSafeInteger(timeoutMillis) ||\n timeoutMillis < 1 ||\n timeoutMillis > 600_000\n ) {\n return yield* ClientError.make({ operation, reason: \"configuration\" });\n }\n const deadline = Math.min(yield* deadlineAfter(timeoutMillis), outerDeadline ?? Infinity);\n\n const request = yield* apiRequest(\n \"GET\",\n path,\n types[0] ?? \"application/octet-stream\",\n operation,\n );\n\n const response = yield* within(execute(request, operation), deadline, operation);\n\n const stream = yield* inspectBytes(response, operation, types, maximum);\n\n return Stream.transformPull(stream, (pull) =>\n Effect.succeed(within(pull, deadline, operation)),\n );\n }),\n ).pipe(Stream.scoped);\n\n const text = (path: string, maximum: number, types: ReadonlyArray<string>) =>\n collect(bytes(path, maximum, types), maximum, \"provider-read\").pipe(\n Effect.flatMap((body) =>\n Effect.try({\n try: () => new TextDecoder(\"utf-8\", { fatal: true }).decode(body),\n catch: () => ClientError.make({ operation: \"provider-read\", reason: \"malformed\" }),\n }),\n ),\n Effect.timeoutOrElse({\n duration: Duration.millis(requestTimeoutMillis),\n orElse: () =>\n Effect.fail(ClientError.make({ operation: \"provider-read\", reason: \"timeout\" })),\n }),\n );\n\n const validateMediaUrl = (value: string): boolean => {\n try {\n const url = new URL(value);\n\n return (\n url.protocol === \"https:\" &&\n !url.username &&\n !url.password &&\n !url.hash &&\n artifactOrigins.has(url.origin) &&\n value.length <= 16_384\n );\n } catch {\n return false;\n }\n };\n\n const media = (\n url: Redacted.Redacted<string>,\n maximum: number,\n types: ReadonlyArray<string>,\n timeoutMillis = 60_000,\n outerDeadline?: number,\n ) =>\n Stream.unwrap(\n Effect.gen(function* () {\n const value = Redacted.value(url);\n\n if (\n !validateMediaUrl(value) ||\n !Number.isSafeInteger(maximum) ||\n maximum < 1 ||\n maximum > 2 ** 31 - 1 ||\n !Number.isSafeInteger(timeoutMillis) ||\n timeoutMillis < 1 ||\n timeoutMillis > 600_000\n ) {\n return yield* ClientError.make({ operation: \"media-download\", reason: \"unsafe-url\" });\n }\n const deadline = Math.min(yield* deadlineAfter(timeoutMillis), outerDeadline ?? Infinity);\n\n const response = yield* within(\n execute(HttpClientRequest.get(value), \"media-download\"),\n deadline,\n \"media-download\",\n );\n\n const stream = yield* inspectBytes(response, \"media-download\", types, maximum);\n\n return Stream.transformPull(stream, (pull) =>\n Effect.succeed(within(pull, deadline, \"media-download\")),\n );\n }),\n ).pipe(Stream.scoped);\n\n return {\n projectId: configured.projectId,\n json,\n noContent,\n upload,\n text,\n bytes,\n media,\n validateMediaUrl,\n };\n});\n","import { Config, Context, Effect, Layer, type Redacted, type Schema, type Stream } from \"effect\";\n\nimport type { ClientError } from \"./Errors.ts\";\nimport { makeTransport } from \"./internal/http/Transport.ts\";\n\n/** Account authority only. Launch recipes and browser-operation policy do not belong here. */\nexport interface ClientOptions {\n readonly projectId: string;\n readonly apiKey: Redacted.Redacted<string>;\n /** Exact HTTPS origins approved for credential-free media/artifact transfers. */\n readonly artifactOrigins?: ReadonlyArray<string>;\n readonly requestTimeoutMillis?: number;\n}\n\nexport type ClientMethod = \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n\n/** One bounded in-memory file part. A filesystem path is never a transport input. */\nexport interface MultipartFile {\n readonly field: string;\n readonly filename: string;\n readonly mediaType: string;\n readonly bytes: Uint8Array;\n}\n\n/** Upload bounds are caller-owned; an omitted timeout keeps the 60-second default. */\nexport interface UploadLimits {\n readonly maxBytes: number;\n readonly timeoutMillis?: number;\n}\n\n/**\n * One immutable Browserbase account and approved transport, shared by every resource Layer.\n * Constructing the Layer performs no request and never loads the native browser peer.\n */\nexport class BrowserbaseClient extends Context.Service<\n BrowserbaseClient,\n {\n readonly projectId: string;\n readonly json: (\n method: ClientMethod,\n path: string,\n body?: Schema.Json,\n outerDeadline?: number,\n ) => Effect.Effect<Schema.Json, ClientError>;\n readonly noContent: (\n method: Exclude<ClientMethod, \"GET\">,\n path: string,\n body?: Schema.Json,\n outerDeadline?: number,\n ) => Effect.Effect<void, ClientError>;\n /** One bounded multipart mutation. A lost reply stays unknown and is never retried. */\n readonly upload: (\n path: string,\n part: MultipartFile,\n limits: UploadLimits,\n outerDeadline?: number,\n ) => Effect.Effect<Schema.Json, ClientError>;\n readonly text: (\n path: string,\n maximum: number,\n types: ReadonlyArray<string>,\n ) => Effect.Effect<string, ClientError>;\n readonly bytes: (\n path: string,\n maximum: number,\n types: ReadonlyArray<string>,\n timeoutMillis?: number,\n outerDeadline?: number,\n ) => Stream.Stream<Uint8Array, ClientError>;\n readonly media: (\n url: Redacted.Redacted<string>,\n maximum: number,\n types: ReadonlyArray<string>,\n timeoutMillis?: number,\n outerDeadline?: number,\n ) => Stream.Stream<Uint8Array, ClientError>;\n readonly validateMediaUrl: (value: string) => boolean;\n }\n>()(\"effect-browserbase/Client\") {\n static layer(options: ClientOptions): Layer.Layer<BrowserbaseClient, ClientError> {\n return Layer.effect(\n BrowserbaseClient,\n makeTransport(options).pipe(\n Effect.map((client) => BrowserbaseClient.of(Object.freeze(client))),\n ),\n );\n }\n\n /**\n * Account authority from the application's `ConfigProvider` (the environment by default):\n * `BROWSERBASE_PROJECT_ID` and a redacted `BROWSERBASE_API_KEY`. Transport options stay\n * explicit. Configuration is read when the Layer is built, never at import.\n */\n static layerConfig(\n options: Omit<ClientOptions, \"projectId\" | \"apiKey\"> = {},\n ): Layer.Layer<BrowserbaseClient, ClientError | Config.ConfigError> {\n return Layer.unwrap(\n Effect.gen(function* () {\n const projectId = yield* Config.String(\"BROWSERBASE_PROJECT_ID\");\n const apiKey = yield* Config.Redacted(\"BROWSERBASE_API_KEY\");\n\n return BrowserbaseClient.layer({ ...options, projectId, apiKey });\n }),\n );\n }\n}\n"],"mappings":";;;;;;AAcA,MAAM,QAAQ;AACd,MAAM,aAAa;AACnB,MAAM,kBAAkB;AAExB,MAAM,iBAA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AAC;EAEtF,MAAM,WAAW,KAAK,IAAI,OAAO,cAAc,aAAa,GAAG,iBAAiB,QAAQ;EAExF,MAAM,WAAW,OAAO,OACtB,QAAQ,kBAAkB,IAAI,KAAK,GAAG,gBAAgB,GACtD,UACA,gBACF;EAEA,MAAM,SAAS,OAAO,aAAa,UAAU,kBAAkB,OAAO,OAAO;EAE7E,OAAO,OAAO,cAAc,SAAS,SACnC,OAAO,QAAQ,OAAO,MAAM,UAAU,gBAAgB,CAAC,CACzD;CACF,CAAC,CACH,CAAC,CAAC,KAAK,OAAO,MAAM;CAEtB,OAAO;EACL,WAAW,WAAW;EACtB;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF,CAAC;;;;;;;AC/nBD,IAAa,oBAAb,MAAa,0BAA0B,QAAQ,QA4C7C,CAAC,CAAC,2BAA2B,CAAC,CAAC;CAC/B,OAAO,MAAM,SAAqE;EAChF,OAAO,MAAM,OACX,mBACA,cAAc,OAAO,CAAC,CAAC,KACrB,OAAO,KAAK,WAAW,kBAAkB,GAAG,OAAO,OAAO,MAAM,CAAC,CAAC,CACpE,CACF;CACF;;;;;;CAOA,OAAO,YACL,UAAuD,CAAC,GACU;EAClE,OAAO,MAAM,OACX,OAAO,IAAI,aAAa;GACtB,MAAM,YAAY,OAAO,OAAO,OAAO,wBAAwB;GAC/D,MAAM,SAAS,OAAO,OAAO,SAAS,qBAAqB;GAE3D,OAAO,kBAAkB,MAAM;IAAE,GAAG;IAAS;IAAW;GAAO,CAAC;EAClE,CAAC,CACH;CACF;AACF"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { ClientError } from "./Errors.mjs";
|
|
2
2
|
import { Config, Context, Effect, Layer, Redacted, Schema, Stream } from "effect";
|
|
3
|
-
|
|
4
|
-
export { BrowserbaseClient, ClientMethod, ClientOptions, MultipartFile, UploadLimits };
|
|
5
|
-
}
|
|
3
|
+
//#region src/Client.d.ts
|
|
6
4
|
/** Account authority only. Launch recipes and browser-operation policy do not belong here. */
|
|
7
5
|
interface ClientOptions {
|
|
8
6
|
readonly projectId: string;
|
|
@@ -49,5 +47,6 @@ declare class BrowserbaseClient extends BrowserbaseClient_base {
|
|
|
49
47
|
static layerConfig(options?: Omit<ClientOptions, "projectId" | "apiKey">): Layer.Layer<BrowserbaseClient, ClientError | Config.ConfigError>;
|
|
50
48
|
}
|
|
51
49
|
//#endregion
|
|
52
|
-
export {
|
|
53
|
-
|
|
50
|
+
export { UploadLimits as a, MultipartFile as i, ClientMethod as n, ClientOptions as r, BrowserbaseClient as t };
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=Client-B_f6bBLT.d.mts.map
|
package/dist/Client.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { BrowserbaseClient, ClientMethod, ClientOptions, MultipartFile, UploadLimits };
|
|
1
|
+
import { a as UploadLimits, i as MultipartFile, n as ClientMethod, r as ClientOptions, t as BrowserbaseClient } from "./Client-B_f6bBLT.mjs";
|
|
2
|
+
export { BrowserbaseClient, ClientMethod, ClientOptions, MultipartFile, UploadLimits };
|
|
3
|
+
export {};
|
package/dist/Client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as BrowserbaseClient } from "./Client-
|
|
1
|
+
import { t as BrowserbaseClient } from "./Client-4RMKIpL2.mjs";
|
|
2
2
|
export { BrowserbaseClient };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { SessionReference } from "./References.mjs";
|
|
2
|
+
import { SessionError } from "./Errors.mjs";
|
|
3
|
+
import { ProviderSession } from "./SessionData.mjs";
|
|
4
|
+
import { n as nowMillis, r as until, t as deadlineAfter } from "./Deadline-CrViaogr.mjs";
|
|
5
|
+
import { Effect, Redacted, Schema } from "effect";
|
|
6
|
+
import { BrowserError, Reasons } from "effect-browser/errors";
|
|
7
|
+
//#region src/internal/provider/Connection.ts
|
|
8
|
+
const Connection = Schema.Struct({
|
|
9
|
+
...ProviderSession.fields,
|
|
10
|
+
connectUrl: Schema.String.check(Schema.isMaxLength(16384))
|
|
11
|
+
});
|
|
12
|
+
/** A provider-issued endpoint is authority, not a persisted session identifier. */
|
|
13
|
+
const connectionUrl = Schema.String.check(Schema.isMaxLength(16384), Schema.makeFilter((value) => {
|
|
14
|
+
try {
|
|
15
|
+
const url = new URL(value);
|
|
16
|
+
return url.protocol === "wss:" && !url.username && !url.password && !url.port && !url.hash && url.hostname.endsWith(".browserbase.com");
|
|
17
|
+
} catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}));
|
|
21
|
+
/** The provider endpoint is validated before any custom routing gets to observe it. */
|
|
22
|
+
const validateConnection = (connection) => {
|
|
23
|
+
if (typeof connection !== "string" || connection.length > 16384 || !URL.canParse(connection)) throw BrowserError.make({
|
|
24
|
+
operation: "connect",
|
|
25
|
+
reason: Reasons.Malformed.make({}),
|
|
26
|
+
outcome: "undispatched"
|
|
27
|
+
});
|
|
28
|
+
if (!Schema.is(connectionUrl)(connection)) throw BrowserError.make({
|
|
29
|
+
operation: "connect",
|
|
30
|
+
reason: Reasons.UnsafeUrl.make({}),
|
|
31
|
+
outcome: "undispatched"
|
|
32
|
+
});
|
|
33
|
+
return connection;
|
|
34
|
+
};
|
|
35
|
+
const connectionAddress = Effect.fnUntraced(function* (client, sessions, reference, remainingMillis) {
|
|
36
|
+
const timeoutMillis = Math.min(6e5, remainingMillis);
|
|
37
|
+
const fail = (reason) => SessionError.make({
|
|
38
|
+
operation: "session-connect",
|
|
39
|
+
reason
|
|
40
|
+
});
|
|
41
|
+
const ref = yield* Schema.decodeEffect(SessionReference)(reference).pipe(Effect.mapError(() => fail("configuration")));
|
|
42
|
+
if (ref.projectId !== client.projectId) return yield* fail("authorization");
|
|
43
|
+
const deadline = yield* deadlineAfter(timeoutMillis);
|
|
44
|
+
yield* sessions.waitUntilRunning(ref, { timeoutMillis });
|
|
45
|
+
if ((yield* nowMillis) >= deadline) return yield* fail("timeout");
|
|
46
|
+
const raw = yield* until(client.json("GET", `/v1/sessions/${encodeURIComponent(ref.sessionId)}`, void 0, deadline), deadline, () => fail("timeout")).pipe(Effect.mapError((error) => fail(error.reason)));
|
|
47
|
+
const value = yield* Schema.decodeUnknownEffect(Connection)(raw).pipe(Effect.mapError(() => fail("malformed")));
|
|
48
|
+
if (value.id !== ref.sessionId || value.projectId !== ref.projectId) return yield* fail("malformed");
|
|
49
|
+
if (value.status !== "RUNNING") return yield* fail("expired");
|
|
50
|
+
const url = yield* Schema.decodeEffect(connectionUrl)(value.connectUrl).pipe(Effect.mapError(() => fail("unsafe-url")));
|
|
51
|
+
return Redacted.make(url);
|
|
52
|
+
});
|
|
53
|
+
//#endregion
|
|
54
|
+
export { validateConnection as n, connectionAddress as t };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=Connection-sxyxtwlk.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Connection-sxyxtwlk.mjs","names":[],"sources":["../src/internal/provider/Connection.ts"],"sourcesContent":["import { Effect, Redacted, Schema } from \"effect\";\nimport { BrowserError, Reasons } from \"effect-browser/errors\";\n\nimport type { BrowserbaseClient } from \"../../Client.ts\";\nimport { SessionError } from \"../../Errors.ts\";\nimport { SessionReference } from \"../../References.ts\";\nimport { ProviderSession } from \"../../SessionData.ts\";\nimport type { BrowserbaseSessions } from \"../../Sessions.ts\";\nimport { deadlineAfter, nowMillis, until } from \"../Deadline.ts\";\n\nconst Connection = Schema.Struct({\n ...ProviderSession.fields,\n connectUrl: Schema.String.check(Schema.isMaxLength(16384)),\n});\n\n/** A provider-issued endpoint is authority, not a persisted session identifier. */\nexport const connectionUrl = Schema.String.check(\n Schema.isMaxLength(16384),\n Schema.makeFilter((value) => {\n try {\n const url = new URL(value);\n\n return (\n url.protocol === \"wss:\" &&\n !url.username &&\n !url.password &&\n !url.port &&\n !url.hash &&\n url.hostname.endsWith(\".browserbase.com\")\n );\n } catch {\n return false;\n }\n }),\n);\n\n/** The provider endpoint is validated before any custom routing gets to observe it. */\nexport const validateConnection = (connection: unknown): string => {\n if (typeof connection !== \"string\" || connection.length > 16384 || !URL.canParse(connection))\n throw BrowserError.make({\n operation: \"connect\",\n reason: Reasons.Malformed.make({}),\n outcome: \"undispatched\",\n });\n if (!Schema.is(connectionUrl)(connection))\n throw BrowserError.make({\n operation: \"connect\",\n reason: Reasons.UnsafeUrl.make({}),\n outcome: \"undispatched\",\n });\n\n return connection;\n};\n\nexport const connectionAddress = Effect.fnUntraced(function* (\n client: BrowserbaseClient[\"Service\"],\n sessions: BrowserbaseSessions[\"Service\"],\n reference: SessionReference,\n remainingMillis: number,\n) {\n const timeoutMillis = Math.min(600_000, remainingMillis);\n\n const fail = (reason: SessionError[\"reason\"]) =>\n SessionError.make({ operation: \"session-connect\", reason });\n\n const ref = yield* Schema.decodeEffect(SessionReference)(reference).pipe(\n Effect.mapError(() => fail(\"configuration\")),\n );\n\n if (ref.projectId !== client.projectId) return yield* fail(\"authorization\");\n const deadline = yield* deadlineAfter(timeoutMillis);\n\n yield* sessions.waitUntilRunning(ref, { timeoutMillis });\n if ((yield* nowMillis) >= deadline) return yield* fail(\"timeout\");\n\n const raw = yield* until(\n client.json(\"GET\", `/v1/sessions/${encodeURIComponent(ref.sessionId)}`, undefined, deadline),\n deadline,\n () => fail(\"timeout\"),\n ).pipe(Effect.mapError((error) => fail(error.reason)));\n\n const value = yield* Schema.decodeUnknownEffect(Connection)(raw).pipe(\n Effect.mapError(() => fail(\"malformed\")),\n );\n\n if (value.id !== ref.sessionId || value.projectId !== ref.projectId)\n return yield* fail(\"malformed\");\n if (value.status !== \"RUNNING\") return yield* fail(\"expired\");\n\n const url = yield* Schema.decodeEffect(connectionUrl)(value.connectUrl).pipe(\n Effect.mapError(() => fail(\"unsafe-url\")),\n );\n\n return Redacted.make(url);\n});\n"],"mappings":";;;;;;;AAUA,MAAM,aAAa,OAAO,OAAO;CAC/B,GAAG,gBAAgB;CACnB,YAAY,OAAO,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MAAM,OAAO,MACjB,OAAO,KAAK,OAAO,gBAAgB,mBAAmB,IAAI,SAAS,KAAK,KAAA,GAAW,QAAQ,GAC3F,gBACM,KAAK,SAAS,CACtB,CAAC,CAAC,KAAK,OAAO,UAAU,UAAU,KAAK,MAAM,MAAM,CAAC,CAAC;CAErD,MAAM,QAAQ,OAAO,OAAO,oBAAoB,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,KAC/D,OAAO,eAAe,KAAK,WAAW,CAAC,CACzC;CAEA,IAAI,MAAM,OAAO,IAAI,aAAa,MAAM,cAAc,IAAI,WACxD,OAAO,OAAO,KAAK,WAAW;CAChC,IAAI,MAAM,WAAW,WAAW,OAAO,OAAO,KAAK,SAAS;CAE5D,MAAM,MAAM,OAAO,OAAO,aAAa,aAAa,CAAC,CAAC,MAAM,UAAU,CAAC,CAAC,KACtE,OAAO,eAAe,KAAK,YAAY,CAAC,CAC1C;CAEA,OAAO,SAAS,KAAK,GAAG;AAC1B,CAAC"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { n as ContextReference } from "./References-
|
|
1
|
+
import { n as ContextReference } from "./References-DOH3Wu44.mjs";
|
|
2
2
|
import { ContextError } from "./Errors.mjs";
|
|
3
|
-
import { a as WriterLease, i as WriterAttemptFacts, n as ContextWriterPermit, o as WriterOptions, r as PersistenceEvidence, s as WriterSettlementFacts, t as ContextWriterBackend } from "./WriterFacts-
|
|
3
|
+
import { a as WriterLease, i as WriterAttemptFacts, n as ContextWriterPermit, o as WriterOptions, r as PersistenceEvidence, s as WriterSettlementFacts, t as ContextWriterBackend } from "./WriterFacts-BBJRDZYY.mjs";
|
|
4
4
|
import { Effect, Scope } from "effect";
|
|
5
|
-
|
|
6
|
-
export { ContextWriterBackend, ContextWriterPermit, PersistenceEvidence, WriterAttemptFacts, WriterLease, WriterOptions, WriterSettlementFacts, withWriter };
|
|
7
|
-
}
|
|
5
|
+
//#region src/ContextCoordination.d.ts
|
|
8
6
|
/**
|
|
9
7
|
* Owns the backend lease, child browser scopes, and exact attempt evidence. The backend must
|
|
10
8
|
* handle uncertain distributed lease acquisition itself. It must persist quarantine facts;
|
|
@@ -12,5 +10,6 @@ declare namespace ContextCoordination_d_exports {
|
|
|
12
10
|
*/
|
|
13
11
|
export declare const withWriter: <A, E, R, LeaseE, LeaseR, VerifyE = never, VerifyR = never>(backend: ContextWriterBackend<LeaseE, LeaseR>, reference: ContextReference, use: (permit: ContextWriterPermit) => Effect.Effect<A, E, R>, options?: WriterOptions<A, VerifyE, VerifyR>) => Effect.Effect<A, E | LeaseE | VerifyE | ContextError, Exclude<R | LeaseR | VerifyR, Scope.Scope>>;
|
|
14
12
|
//#endregion
|
|
15
|
-
export { type ContextWriterBackend, type ContextWriterPermit, PersistenceEvidence, WriterAttemptFacts, type WriterLease, type WriterOptions, WriterSettlementFacts
|
|
13
|
+
export { type ContextWriterBackend, type ContextWriterPermit, PersistenceEvidence, WriterAttemptFacts, type WriterLease, type WriterOptions, WriterSettlementFacts };
|
|
14
|
+
export {};
|
|
16
15
|
//# sourceMappingURL=ContextCoordination.d.mts.map
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
1
|
import { ContextReference } from "./References.mjs";
|
|
3
2
|
import { ContextError } from "./Errors.mjs";
|
|
4
|
-
import { a as PersistenceEvidence, n as isContextWriterBusy, o as WriterAttemptFacts, r as makeContextWriterPermit, s as WriterSettlementFacts, t as closeContextWriterPermit } from "./ContextWriter-
|
|
3
|
+
import { a as PersistenceEvidence, n as isContextWriterBusy, o as WriterAttemptFacts, r as makeContextWriterPermit, s as WriterSettlementFacts, t as closeContextWriterPermit } from "./ContextWriter-oKWFLHuP.mjs";
|
|
5
4
|
import { Clock, Effect, Exit, Schema } from "effect";
|
|
6
5
|
//#region src/ContextCoordination.ts
|
|
7
|
-
var ContextCoordination_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
-
PersistenceEvidence: () => PersistenceEvidence,
|
|
9
|
-
WriterAttemptFacts: () => WriterAttemptFacts,
|
|
10
|
-
WriterSettlementFacts: () => WriterSettlementFacts,
|
|
11
|
-
withWriter: () => withWriter
|
|
12
|
-
});
|
|
13
6
|
/**
|
|
14
7
|
* Owns the backend lease, child browser scopes, and exact attempt evidence. The backend must
|
|
15
8
|
* handle uncertain distributed lease acquisition itself. It must persist quarantine facts;
|
|
@@ -62,6 +55,6 @@ const withWriter = (backend, reference, use, options = {}) => Effect.scoped(Effe
|
|
|
62
55
|
return body.value;
|
|
63
56
|
})));
|
|
64
57
|
//#endregion
|
|
65
|
-
export { PersistenceEvidence, WriterAttemptFacts, WriterSettlementFacts,
|
|
58
|
+
export { PersistenceEvidence, WriterAttemptFacts, WriterSettlementFacts, withWriter };
|
|
66
59
|
|
|
67
60
|
//# sourceMappingURL=ContextCoordination.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextCoordination.mjs","names":[],"sources":["../src/ContextCoordination.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"ContextCoordination.mjs","names":[],"sources":["../src/ContextCoordination.ts"],"sourcesContent":["import { Clock, Effect, Exit, Schema, type Scope } from \"effect\";\n\nimport { ContextError } from \"./Errors.ts\";\nimport {\n makeContextWriterPermit,\n closeContextWriterPermit,\n isContextWriterBusy,\n} from \"./internal/session/ContextWriter.ts\";\nimport type {\n ContextWriterBackend,\n ContextWriterPermit,\n WriterOptions,\n} from \"./internal/session/WriterFacts.ts\";\nimport { ContextReference } from \"./References.ts\";\n\nexport {\n PersistenceEvidence,\n WriterAttemptFacts,\n WriterSettlementFacts,\n type ContextWriterBackend,\n type ContextWriterPermit,\n type WriterLease,\n type WriterOptions,\n} from \"./internal/session/WriterFacts.ts\";\n\n/**\n * Owns the backend lease, child browser scopes, and exact attempt evidence. The backend must\n * handle uncertain distributed lease acquisition itself. It must persist quarantine facts;\n * a local Scope closing is never permission to admit another remote writer.\n */\nexport const withWriter = <A, E, R, LeaseE, LeaseR, VerifyE = never, VerifyR = never>(\n backend: ContextWriterBackend<LeaseE, LeaseR>,\n reference: ContextReference,\n use: (permit: ContextWriterPermit) => Effect.Effect<A, E, R>,\n options: WriterOptions<A, VerifyE, VerifyR> = {},\n): Effect.Effect<\n A,\n E | LeaseE | VerifyE | ContextError,\n Exclude<R | LeaseR | VerifyR, Scope.Scope>\n> =>\n Effect.scoped(\n Effect.uninterruptibleMask((restore) =>\n Effect.gen(function* () {\n const ref = yield* Schema.decodeEffect(ContextReference)(reference, {\n onExcessProperty: \"error\",\n }).pipe(\n Effect.mapError(() =>\n ContextError.make({\n operation: \"writer\",\n reason: \"configuration\",\n outcome: \"undispatched\",\n }),\n ),\n );\n\n const timeout = options.settlementTimeoutMillis ?? 5000;\n\n if (\n !Number.isSafeInteger(timeout) ||\n timeout < 1 ||\n timeout > 60000 ||\n isContextWriterBusy(ref)\n ) {\n return yield* ContextError.make({\n operation: \"writer\",\n reason: isContextWriterBusy(ref) ? \"active\" : \"configuration\",\n outcome: \"undispatched\",\n });\n }\n const permit = yield* makeContextWriterPermit(ref);\n const acquired = yield* restore(backend.acquire(ref)).pipe(Effect.exit);\n\n if (Exit.isFailure(acquired)) {\n closeContextWriterPermit(permit, false);\n\n return yield* Effect.failCause(acquired.cause);\n }\n const lease = acquired.value;\n\n const body = yield* restore(Effect.scoped(Effect.suspend(() => use(permit)))).pipe(\n Effect.exit,\n );\n\n // Every remote-resource finalizer in use() has run before any settlement/readback below.\n if (Exit.isFailure(body)) yield* permit.quarantine;\n let verification: Exit.Exit<void, VerifyE | ContextError> = Exit.void;\n\n if (Exit.isSuccess(body) && options.verify !== undefined) {\n verification = yield* restore(Effect.scoped(options.verify(body.value))).pipe(\n Effect.exit,\n );\n if (Exit.isSuccess(verification)) {\n verification = yield* permit\n .confirmReadback(yield* Clock.currentTimeMillis)\n .pipe(Effect.exit);\n } else yield* permit.quarantine;\n }\n const facts = yield* permit.snapshot;\n\n const settlement = yield* restore(lease.settle(facts)).pipe(\n Effect.timeoutOrElse({\n duration: timeout,\n orElse: () =>\n Effect.fail(\n ContextError.make({\n operation: \"writer-settle\",\n reason: \"timeout\",\n outcome: \"unknown\",\n }),\n ),\n }),\n Effect.exit,\n );\n\n if (Exit.isFailure(settlement)) yield* permit.quarantine;\n closeContextWriterPermit(\n permit,\n Exit.isSuccess(settlement) && facts.disposition === \"release\",\n );\n // Preserve the primary cause; secondary failure is visible in the retained quarantine and\n // a content-free diagnostic. Never serialize arbitrary consumer/database error values.\n if (Exit.isFailure(body)) {\n if (Exit.isFailure(settlement))\n yield* Effect.logError(\"Browserbase writer settlement remained unconfirmed\");\n\n return yield* Effect.failCause(body.cause);\n }\n if (Exit.isFailure(verification)) return yield* Effect.failCause(verification.cause);\n if (Exit.isFailure(settlement)) return yield* Effect.failCause(settlement.cause);\n\n return body.value;\n }),\n ),\n );\n"],"mappings":";;;;;;;;;;AA8BA,MAAa,cACX,SACA,WACA,KACA,UAA8C,CAAC,MAM/C,OAAO,OACL,OAAO,qBAAqB,YAC1B,OAAO,IAAI,aAAa;CACtB,MAAM,MAAM,OAAO,OAAO,aAAa,gBAAgB,CAAC,CAAC,WAAW,EAClE,kBAAkB,QACpB,CAAC,CAAC,CAAC,KACD,OAAO,eACL,aAAa,KAAK;EAChB,WAAW;EACX,QAAQ;EACR,SAAS;CACX,CAAC,CACH,CACF;CAEA,MAAM,UAAU,QAAQ,2BAA2B;CAEnD,IACE,CAAC,OAAO,cAAc,OAAO,KAC7B,UAAU,KACV,UAAU,OACV,oBAAoB,GAAG,GAEvB,OAAO,OAAO,aAAa,KAAK;EAC9B,WAAW;EACX,QAAQ,oBAAoB,GAAG,IAAI,WAAW;EAC9C,SAAS;CACX,CAAC;CAEH,MAAM,SAAS,OAAO,wBAAwB,GAAG;CACjD,MAAM,WAAW,OAAO,QAAQ,QAAQ,QAAQ,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,IAAI;CAEtE,IAAI,KAAK,UAAU,QAAQ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AAU,WAAW,KAAK;CAE/E,OAAO,KAAK;AACd,CAAC,CACH,CACF"}
|
|
@@ -9,17 +9,13 @@ import { Effect, Schema } from "effect";
|
|
|
9
9
|
* `ContextCoordination` and `ContextWriter` both read this module, never each other.
|
|
10
10
|
*/
|
|
11
11
|
const PersistenceEvidence = Schema.Union([
|
|
12
|
-
Schema.
|
|
13
|
-
Schema.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
])
|
|
20
|
-
}),
|
|
21
|
-
Schema.Struct({
|
|
22
|
-
_tag: Schema.Literal("Observed"),
|
|
12
|
+
Schema.TaggedStruct("NotRequested", {}),
|
|
13
|
+
Schema.TaggedStruct("Unconfirmed", { reason: Schema.Literals([
|
|
14
|
+
"writer-active",
|
|
15
|
+
"writer-unknown",
|
|
16
|
+
"flush-unacknowledged"
|
|
17
|
+
]) }),
|
|
18
|
+
Schema.TaggedStruct("Observed", {
|
|
23
19
|
method: Schema.Literal("consumer-readback"),
|
|
24
20
|
observedAtMillis: Schema.Finite
|
|
25
21
|
})
|
|
@@ -184,4 +180,4 @@ const requireContextWriterPermit = (permit, reference) => Effect.suspend(() => {
|
|
|
184
180
|
//#endregion
|
|
185
181
|
export { PersistenceEvidence as a, requireContextWriterPermit as i, isContextWriterBusy as n, WriterAttemptFacts as o, makeContextWriterPermit as r, WriterSettlementFacts as s, closeContextWriterPermit as t };
|
|
186
182
|
|
|
187
|
-
//# sourceMappingURL=ContextWriter-
|
|
183
|
+
//# sourceMappingURL=ContextWriter-oKWFLHuP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextWriter-oKWFLHuP.mjs","names":[],"sources":["../src/internal/session/WriterFacts.ts","../src/internal/session/ContextWriter.ts"],"sourcesContent":["import { type Effect, Schema } from \"effect\";\n\nimport { CleanupResult } from \"../../Cleanup.ts\";\nimport { AllocationAttempt, ContextReference, SessionReference } from \"../../References.ts\";\n\n/**\n * The writer vocabulary both the public coordination entry point and the permit\n * implementation need. Keeping it here leaves one direction of dependency:\n * `ContextCoordination` and `ContextWriter` both read this module, never each other.\n */\nexport const PersistenceEvidence = Schema.Union([\n Schema.TaggedStruct(\"NotRequested\", {}),\n Schema.TaggedStruct(\"Unconfirmed\", {\n reason: Schema.Literals([\"writer-active\", \"writer-unknown\", \"flush-unacknowledged\"]),\n }),\n Schema.TaggedStruct(\"Observed\", {\n method: Schema.Literal(\"consumer-readback\"),\n observedAtMillis: Schema.Finite,\n }),\n]);\n\nexport type PersistenceEvidence = typeof PersistenceEvidence.Type;\n\nexport class WriterAttemptFacts extends Schema.Class<WriterAttemptFacts>(\n \"BrowserbaseWriterAttemptFacts\",\n)({\n attempt: AllocationAttempt,\n session: Schema.optionalKey(SessionReference),\n state: Schema.Literals([\"admitted\", \"rejected\", \"unknown\", \"terminal\"]),\n cleanup: Schema.optionalKey(CleanupResult),\n}) {}\n\nexport class WriterSettlementFacts extends Schema.Class<WriterSettlementFacts>(\n \"BrowserbaseWriterSettlementFacts\",\n)({\n reference: ContextReference,\n attempts: Schema.Array(WriterAttemptFacts).check(Schema.isMaxLength(64)),\n persistence: PersistenceEvidence,\n disposition: Schema.Literals([\"release\", \"quarantine\"]),\n}) {}\n\nexport interface WriterLease<E, R> {\n readonly settle: (facts: WriterSettlementFacts) => Effect.Effect<void, E, R>;\n}\n\nexport interface ContextWriterBackend<E, R> {\n readonly acquire: (reference: ContextReference) => Effect.Effect<WriterLease<E, R>, E, R>;\n}\n\nexport interface ContextWriterPermit {\n readonly _tag: \"ContextWriterPermit\";\n readonly reference: ContextReference;\n}\n\nexport interface WriterOptions<A, VerifyE, VerifyR> {\n /** Bounded consumer-controlled readback, not a provider-wide flush acknowledgement. */\n readonly verify?: (value: A) => Effect.Effect<void, VerifyE, VerifyR>;\n readonly settlementTimeoutMillis?: number;\n}\n","import { Effect } from \"effect\";\n\nimport type { CleanupResult } from \"../../Cleanup.ts\";\nimport { ContextError } from \"../../Errors.ts\";\nimport type { AllocationAttempt, ContextReference, SessionReference } from \"../../References.ts\";\nimport {\n type ContextWriterPermit,\n type PersistenceEvidence,\n WriterAttemptFacts,\n WriterSettlementFacts,\n} from \"./WriterFacts.ts\";\n\n/** There is one record per exact allocation attempt, not parallel uncorrelated arrays. */\ninterface AttemptRecord {\n readonly attempt: AllocationAttempt;\n session?: SessionReference;\n state: \"admitted\" | \"rejected\" | \"unknown\" | \"terminal\";\n cleanup?: CleanupResult;\n}\n\nexport interface ContextWriterPermitInternal extends ContextWriterPermit {\n readonly recordAttempt: (attempt: AllocationAttempt) => Effect.Effect<void, ContextError>;\n readonly recordSession: (attempt: AllocationAttempt, reference: SessionReference) => void;\n readonly rejected: (attempt: AllocationAttempt) => void;\n readonly uncertain: (attempt: AllocationAttempt) => void;\n readonly completed: (attempt: AllocationAttempt, cleanup: CleanupResult) => void;\n readonly confirmReadback: (atMillis: number) => Effect.Effect<void, ContextError>;\n readonly quarantine: Effect.Effect<void>;\n readonly snapshot: Effect.Effect<WriterSettlementFacts>;\n}\n\nconst authentic = new WeakMap<ContextWriterPermit, ContextWriterPermitInternal>();\nconst active = new Map<string, ContextWriterPermitInternal | \"quarantined\">();\nconst key = (ref: ContextReference) => `${ref.projectId}/${ref.contextId}`;\n\nexport const isContextWriterBusy = (ref: ContextReference): boolean => active.has(key(ref));\n\nexport const makeContextWriterPermit = (\n reference: ContextReference,\n): Effect.Effect<ContextWriterPermitInternal, ContextError> =>\n Effect.suspend(() => {\n if (active.has(key(reference)) || active.size >= 2048)\n return Effect.fail(\n ContextError.make({ operation: \"writer\", reason: \"active\", outcome: \"undispatched\" }),\n );\n const owned = Object.freeze(reference);\n const attempts = new Map<string, AttemptRecord>();\n\n let closed = false,\n quarantined = false;\n\n let persistence: PersistenceEvidence = { _tag: \"NotRequested\" };\n\n const unknown = () => {\n quarantined = true;\n persistence = { _tag: \"Unconfirmed\", reason: \"writer-unknown\" };\n };\n\n const noActive = () =>\n [...attempts.values()].every(\n (entry) => entry.state === \"rejected\" || entry.state === \"terminal\",\n );\n\n const permit: ContextWriterPermitInternal = {\n _tag: \"ContextWriterPermit\",\n reference: owned,\n recordAttempt: (attempt) =>\n Effect.suspend(() => {\n if (\n closed ||\n quarantined ||\n !noActive() ||\n attempt.projectId !== owned.projectId ||\n (attempts.size > 0 && persistence._tag === \"Unconfirmed\")\n ) {\n return Effect.fail(\n ContextError.make({\n operation: \"writer-admit\",\n reason: \"active\",\n outcome: \"undispatched\",\n }),\n );\n }\n if (attempts.has(attempt.attemptId) || attempts.size >= 64)\n return Effect.fail(\n ContextError.make({\n operation: \"writer-admit\",\n reason: \"limit\",\n outcome: \"undispatched\",\n }),\n );\n const copy = Object.freeze(attempt);\n\n attempts.set(copy.attemptId, { attempt: copy, state: \"admitted\" });\n persistence = { _tag: \"Unconfirmed\", reason: \"writer-active\" };\n\n return Effect.void;\n }),\n recordSession: (attempt, session) => {\n const record = attempts.get(attempt.attemptId);\n\n if (\n record === undefined ||\n record.attempt !== attempt ||\n session.projectId !== owned.projectId ||\n (record.session !== undefined && record.session.sessionId !== session.sessionId)\n ) {\n unknown();\n\n return;\n }\n // Retain identity even when cancellation/quarantine races a late allocation reply.\n record.session = Object.freeze(session);\n },\n rejected: (attempt) => {\n const record = attempts.get(attempt.attemptId);\n\n if (record === undefined || record.attempt !== attempt || record.session !== undefined) {\n unknown();\n\n return;\n }\n record.state = \"rejected\";\n if ([...attempts.values()].every((item) => item.state === \"rejected\"))\n persistence = { _tag: \"NotRequested\" };\n },\n uncertain: (attempt) => {\n const record = attempts.get(attempt.attemptId);\n\n if (record !== undefined && record.attempt === attempt) record.state = \"unknown\";\n unknown();\n },\n completed: (attempt, cleanup) => {\n const record = attempts.get(attempt.attemptId);\n\n if (\n record === undefined ||\n record.attempt !== attempt ||\n cleanup.ownership !== \"owned\" ||\n record.session === undefined ||\n record.session.sessionId !== cleanup.reference.sessionId ||\n cleanup.reference.projectId !== owned.projectId\n ) {\n unknown();\n\n return;\n }\n record.cleanup = cleanup;\n if (cleanup.remote !== \"confirmed\") {\n record.state = \"unknown\";\n unknown();\n\n return;\n }\n record.state = \"terminal\";\n if (cleanup.observedStatus !== \"COMPLETED\") {\n unknown();\n\n return;\n }\n if (!quarantined) persistence = { _tag: \"Unconfirmed\", reason: \"flush-unacknowledged\" };\n },\n confirmReadback: (atMillis) =>\n Effect.suspend(() => {\n if (\n closed ||\n quarantined ||\n !noActive() ||\n !Number.isFinite(atMillis) ||\n attempts.size === 0 ||\n [...attempts.values()].some(\n (entry) =>\n entry.state === \"terminal\" && entry.cleanup?.observedStatus !== \"COMPLETED\",\n )\n ) {\n return Effect.fail(\n ContextError.make({\n operation: \"writer-readback\",\n reason: \"active\",\n outcome: \"undispatched\",\n }),\n );\n }\n persistence = {\n _tag: \"Observed\",\n method: \"consumer-readback\",\n observedAtMillis: atMillis,\n };\n\n return Effect.void;\n }),\n quarantine: Effect.sync(unknown),\n snapshot: Effect.sync(() =>\n WriterSettlementFacts.make({\n reference: owned,\n attempts: [...attempts.values()].map((entry) =>\n WriterAttemptFacts.make({\n attempt: entry.attempt,\n state: entry.state,\n ...(entry.session === undefined ? {} : { session: entry.session }),\n ...(entry.cleanup === undefined ? {} : { cleanup: entry.cleanup }),\n }),\n ),\n persistence,\n disposition:\n quarantined || !noActive() || persistence._tag === \"Unconfirmed\"\n ? \"quarantine\"\n : \"release\",\n }),\n ),\n };\n\n Object.freeze(permit);\n authentic.set(permit, permit);\n active.set(key(owned), permit);\n // Explicit retirement closes admission without losing evidence attached to escaped permits.\n retirement.set(permit, (released) => {\n closed = true;\n if (active.get(key(owned)) !== permit) return;\n if (released) active.delete(key(owned));\n else active.set(key(owned), \"quarantined\");\n });\n\n return Effect.succeed(permit);\n });\n\nconst retirement = new WeakMap<ContextWriterPermitInternal, (released: boolean) => void>();\n\nexport const closeContextWriterPermit = (\n permit: ContextWriterPermitInternal,\n released: boolean,\n): void => retirement.get(permit)?.(released);\n\nexport const requireContextWriterPermit = (\n permit: ContextWriterPermit,\n reference: ContextReference,\n): Effect.Effect<ContextWriterPermitInternal, ContextError> =>\n Effect.suspend(() => {\n const actual = authentic.get(permit);\n\n return actual !== undefined &&\n active.get(key(reference)) === actual &&\n actual.reference.contextId === reference.contextId &&\n actual.reference.projectId === reference.projectId\n ? Effect.succeed(actual)\n : Effect.fail(\n ContextError.make({\n operation: \"writer-authority\",\n reason: \"authorization\",\n outcome: \"undispatched\",\n }),\n );\n });\n"],"mappings":";;;;;;;;;;AAUA,MAAa,sBAAsB,OAAO,MAAM;CAC9C,OAAO,aAAa,gBAAgB,CAAC,CAAC;CACtC,OAAO,aAAa,eAAe,EACjC,QAAQ,OAAO,SAAS;EAAC;EAAiB;EAAkB;CAAsB,CAAC,EACrF,CAAC;CACD,OAAO,aAAa,YAAY;EAC9B,QAAQ,OAAO,QAAQ,mBAAmB;EAC1C,kBAAkB,OAAO;CAC3B,CAAC;AACH,CAAC;AAID,IAAa,qBAAb,cAAwC,OAAO,MAC7C,+BACF,CAAC,CAAC;CACA,SAAS;CACT,SAAS,OAAO,YAAY,gBAAgB;CAC5C,OAAO,OAAO,SAAS;EAAC;EAAY;EAAY;EAAW;CAAU,CAAC;CACtE,SAAS,OAAO,YAAY,aAAa;AAC3C,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,wBAAb,cAA2C,OAAO,MAChD,kCACF,CAAC,CAAC;CACA,WAAW;CACX,UAAU,OAAO,MAAM,kBAAkB,CAAC,CAAC,MAAM,OAAO,YAAY,EAAE,CAAC;CACvE,aAAa;CACb,aAAa,OAAO,SAAS,CAAC,WAAW,YAAY,CAAC;AACxD,CAAC,CAAC,CAAC,CAAC;;;ACRJ,MAAM,4BAAY,IAAI,QAA0D;AAChF,MAAM,yBAAS,IAAI,IAAyD;AAC5E,MAAM,OAAO,QAA0B,GAAG,IAAI,UAAU,GAAG,IAAI;AAE/D,MAAa,uBAAuB,QAAmC,OAAO,IAAI,IAAI,GAAG,CAAC;AAE1F,MAAa,2BACX,cA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AU,aACzC,OAAO,UAAU,cAAc,UAAU,YACvC,OAAO,QAAQ,MAAM,IACrB,OAAO,KACL,aAAa,KAAK;EAChB,WAAW;EACX,QAAQ;EACR,SAAS;CACX,CAAC,CACH;AACN,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { n as ContextReference } from "./References-DOH3Wu44.mjs";
|
|
2
|
+
import { ContextError } from "./Errors.mjs";
|
|
3
|
+
import { t as BrowserbaseClient } from "./Client-B_f6bBLT.mjs";
|
|
4
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
5
|
+
//#region src/Contexts.d.ts
|
|
6
|
+
declare const ContextMetadata_base: Schema.Class<ContextMetadata, Schema.Struct<{
|
|
7
|
+
readonly reference: typeof ContextReference;
|
|
8
|
+
readonly createdAt: Schema.String;
|
|
9
|
+
readonly updatedAt: Schema.String;
|
|
10
|
+
readonly name: Schema.optionalKey<Schema.String>;
|
|
11
|
+
}>, {}>;
|
|
12
|
+
declare class ContextMetadata extends ContextMetadata_base {}
|
|
13
|
+
declare const ContextCreation_base: Schema.Class<ContextCreation, Schema.Struct<{
|
|
14
|
+
readonly reference: typeof ContextReference;
|
|
15
|
+
}>, {}>;
|
|
16
|
+
declare class ContextCreation extends ContextCreation_base {}
|
|
17
|
+
declare const BrowserbaseContexts_base: Context.ServiceClass<BrowserbaseContexts, "effect-browserbase/Contexts", {
|
|
18
|
+
readonly create: (options?: {
|
|
19
|
+
readonly name?: string;
|
|
20
|
+
}) => Effect.Effect<ContextCreation, ContextError>;
|
|
21
|
+
readonly retrieve: (reference: ContextReference) => Effect.Effect<ContextMetadata, ContextError>;
|
|
22
|
+
readonly delete: (reference: ContextReference) => Effect.Effect<void, ContextError>;
|
|
23
|
+
}>;
|
|
24
|
+
/** Context administration is independent of any live browser connection. */
|
|
25
|
+
declare class BrowserbaseContexts extends BrowserbaseContexts_base {
|
|
26
|
+
static readonly layer: Layer.Layer<BrowserbaseContexts, never, BrowserbaseClient>;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { ContextCreation as n, ContextMetadata as r, BrowserbaseContexts as t };
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=Contexts-DqdL7cyX.d.mts.map
|