effect-browserbase 0.2.0-beta.9 → 0.3.0-beta.5
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 +250 -317
- package/dist/Browserbase-FDltiz36.mjs +542 -0
- package/dist/Browserbase-FDltiz36.mjs.map +1 -0
- package/dist/Browserbase.d.mts +105 -0
- package/dist/Browserbase.mjs +3 -0
- package/dist/BrowserbaseClient-CtAQ2rg4.d.mts +195 -0
- package/dist/BrowserbaseClient.d.mts +2 -0
- package/dist/BrowserbaseClient.mjs +190 -0
- package/dist/BrowserbaseClient.mjs.map +1 -0
- package/dist/BrowserbaseError-D1EOrLNc.d.mts +79 -0
- package/dist/BrowserbaseError.d.mts +2 -0
- package/dist/BrowserbaseError.mjs +101 -0
- package/dist/BrowserbaseError.mjs.map +1 -0
- package/dist/ContextLease.d.mts +42 -0
- package/dist/ContextLease.mjs +80 -0
- package/dist/ContextLease.mjs.map +1 -0
- package/dist/index.d.mts +5 -27
- package/dist/index.mjs +5 -26
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/testing/index.d.mts +134 -0
- package/dist/testing/index.mjs +382 -0
- package/dist/testing/index.mjs.map +1 -0
- package/package.json +51 -121
- package/src/Browserbase.ts +698 -0
- package/src/BrowserbaseClient.ts +559 -0
- package/src/BrowserbaseError.ts +108 -0
- package/src/ContextLease.ts +118 -0
- package/src/index.ts +7 -0
- package/src/internal/captureConnection.ts +214 -0
- package/src/testing/BrowserbaseContract.ts +170 -0
- package/src/testing/TestBrowserbase.ts +445 -0
- package/src/testing/index.ts +7 -0
- package/dist/Account.d.mts +0 -32
- package/dist/Account.mjs +0 -36
- package/dist/Account.mjs.map +0 -1
- package/dist/Acquisition-BOABu_qJ.mjs +0 -244
- package/dist/Acquisition-BOABu_qJ.mjs.map +0 -1
- package/dist/Agents-CPaTOH_g.d.mts +0 -156
- package/dist/Agents.d.mts +0 -3
- package/dist/Agents.mjs +0 -292
- package/dist/Agents.mjs.map +0 -1
- package/dist/Allocation.d.mts +0 -97
- package/dist/Allocation.mjs +0 -27
- package/dist/Allocation.mjs.map +0 -1
- package/dist/Authorization-Ll5f_XNM.mjs +0 -12
- package/dist/Authorization-Ll5f_XNM.mjs.map +0 -1
- package/dist/Browser-ByrWJ0ss.mjs +0 -274
- package/dist/Browser-ByrWJ0ss.mjs.map +0 -1
- package/dist/Browser.d.mts +0 -83
- package/dist/Browser.mjs +0 -3
- package/dist/BrowserBinding.d.mts +0 -13
- package/dist/BrowserBinding.mjs +0 -31
- package/dist/BrowserBinding.mjs.map +0 -1
- package/dist/Certificates-D4NQmyeA.d.mts +0 -34
- package/dist/Certificates.d.mts +0 -3
- package/dist/Certificates.mjs +0 -85
- package/dist/Certificates.mjs.map +0 -1
- package/dist/Cleanup-DMTDBir8.d.mts +0 -23
- package/dist/Cleanup.d.mts +0 -3
- package/dist/Cleanup.mjs +0 -43
- package/dist/Cleanup.mjs.map +0 -1
- package/dist/Client-BEC4Q8ZS.mjs +0 -564
- package/dist/Client-BEC4Q8ZS.mjs.map +0 -1
- package/dist/Client-B_f6bBLT.d.mts +0 -52
- package/dist/Client.d.mts +0 -3
- package/dist/Client.mjs +0 -2
- package/dist/Connection-sxyxtwlk.mjs +0 -56
- package/dist/Connection-sxyxtwlk.mjs.map +0 -1
- package/dist/ContextCoordination.d.mts +0 -29
- package/dist/ContextCoordination.mjs +0 -94
- package/dist/ContextCoordination.mjs.map +0 -1
- package/dist/ContextWriter-CiEma24z.mjs +0 -204
- package/dist/ContextWriter-CiEma24z.mjs.map +0 -1
- package/dist/Contexts-DqdL7cyX.d.mts +0 -31
- package/dist/Contexts.d.mts +0 -3
- package/dist/Contexts.mjs +0 -97
- package/dist/Contexts.mjs.map +0 -1
- package/dist/Deadline-CrViaogr.mjs +0 -13
- package/dist/Deadline-CrViaogr.mjs.map +0 -1
- package/dist/Downloads-CX52GOFJ.d.mts +0 -43
- package/dist/Downloads.d.mts +0 -3
- package/dist/Downloads.mjs +0 -137
- package/dist/Downloads.mjs.map +0 -1
- package/dist/Errors.d.mts +0 -100
- package/dist/Errors.mjs +0 -194
- package/dist/Errors.mjs.map +0 -1
- package/dist/Extensions-BTUn9zhK.mjs +0 -231
- package/dist/Extensions-BTUn9zhK.mjs.map +0 -1
- package/dist/Extensions-DBXuVM1f.d.mts +0 -43
- package/dist/Extensions.d.mts +0 -3
- package/dist/Extensions.mjs +0 -2
- package/dist/Functions-CsKMMUuZ.d.mts +0 -226
- package/dist/Functions.d.mts +0 -3
- package/dist/Functions.mjs +0 -318
- package/dist/Functions.mjs.map +0 -1
- package/dist/Issued-DejqoMYL.mjs +0 -15
- package/dist/Issued-DejqoMYL.mjs.map +0 -1
- package/dist/Launch-cAdE2rrZ.mjs +0 -115
- package/dist/Launch-cAdE2rrZ.mjs.map +0 -1
- package/dist/Launch.d.mts +0 -127
- package/dist/Launch.mjs +0 -97
- package/dist/Launch.mjs.map +0 -1
- package/dist/PageFetch-CjAM_0DS.d.mts +0 -40
- package/dist/PageFetch.d.mts +0 -3
- package/dist/PageFetch.mjs +0 -59
- package/dist/PageFetch.mjs.map +0 -1
- package/dist/Projects-tm5bTDH0.d.mts +0 -38
- package/dist/Projects.d.mts +0 -3
- package/dist/Projects.mjs +0 -65
- package/dist/Projects.mjs.map +0 -1
- package/dist/Recordings-B9k5aODB.d.mts +0 -27
- package/dist/Recordings.d.mts +0 -3
- package/dist/Recordings.mjs +0 -144
- package/dist/Recordings.mjs.map +0 -1
- package/dist/References-DOH3Wu44.d.mts +0 -34
- package/dist/References.d.mts +0 -3
- package/dist/References.mjs +0 -33
- package/dist/References.mjs.map +0 -1
- package/dist/Replays-mV93WGtx.d.mts +0 -27
- package/dist/Replays.d.mts +0 -3
- package/dist/Replays.mjs +0 -107
- package/dist/Replays.mjs.map +0 -1
- package/dist/Resource-J7Kkk5mu.mjs +0 -54
- package/dist/Resource-J7Kkk5mu.mjs.map +0 -1
- package/dist/Search-B64e7g-h.d.mts +0 -37
- package/dist/Search.d.mts +0 -3
- package/dist/Search.mjs +0 -46
- package/dist/Search.mjs.map +0 -1
- package/dist/SessionData-5xYZDshJ.d.mts +0 -38
- package/dist/SessionData.d.mts +0 -3
- package/dist/SessionData.mjs +0 -48
- package/dist/SessionData.mjs.map +0 -1
- package/dist/Sessions-D2H5m6rF.mjs +0 -260
- package/dist/Sessions-D2H5m6rF.mjs.map +0 -1
- package/dist/Sessions-oJEUmZth.d.mts +0 -69
- package/dist/Sessions.d.mts +0 -4
- package/dist/Sessions.mjs +0 -3
- package/dist/Testing.d.mts +0 -119
- package/dist/Testing.mjs +0 -206
- package/dist/Testing.mjs.map +0 -1
- package/dist/TransferPolicy-DQ06i7SZ.mjs +0 -25
- package/dist/TransferPolicy-DQ06i7SZ.mjs.map +0 -1
- package/dist/Transfers-GVqzrDWl.d.mts +0 -89
- package/dist/Transfers.d.mts +0 -3
- package/dist/Transfers.mjs +0 -85
- package/dist/Transfers.mjs.map +0 -1
- package/dist/Uploads-C2_bACgv.d.mts +0 -28
- package/dist/Uploads.d.mts +0 -3
- package/dist/Uploads.mjs +0 -105
- package/dist/Uploads.mjs.map +0 -1
- package/dist/Webhooks-BoeRAxzG.d.mts +0 -59
- package/dist/Webhooks.d.mts +0 -3
- package/dist/Webhooks.mjs +0 -134
- package/dist/Webhooks.mjs.map +0 -1
- package/dist/WriterFacts-BBJRDZYY.d.mts +0 -54
package/dist/Errors.mjs
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { AllocationAttempt, SessionReference } from "./References.mjs";
|
|
2
|
-
import { Schema } from "effect";
|
|
3
|
-
//#region src/Errors.ts
|
|
4
|
-
const RequestReason = Schema.Literals([
|
|
5
|
-
"configuration",
|
|
6
|
-
"authorization",
|
|
7
|
-
"rate-limited",
|
|
8
|
-
"not-found",
|
|
9
|
-
"active",
|
|
10
|
-
"disabled",
|
|
11
|
-
"expired",
|
|
12
|
-
"provider",
|
|
13
|
-
"transport",
|
|
14
|
-
"timeout",
|
|
15
|
-
"malformed",
|
|
16
|
-
"limit",
|
|
17
|
-
"unsafe-url",
|
|
18
|
-
"content-type"
|
|
19
|
-
]);
|
|
20
|
-
/**
|
|
21
|
-
* Every control-plane error shares these fields, but never a vocabulary: each names only the
|
|
22
|
-
* operations its own service performs, so a caller can match on them exhaustively.
|
|
23
|
-
*/
|
|
24
|
-
const requestFields = (operations) => ({
|
|
25
|
-
operation: Schema.Literals(operations),
|
|
26
|
-
reason: RequestReason,
|
|
27
|
-
outcome: Schema.optionalKey(Schema.Literals([
|
|
28
|
-
"undispatched",
|
|
29
|
-
"rejected",
|
|
30
|
-
"unknown"
|
|
31
|
-
])),
|
|
32
|
-
status: Schema.optionalKey(Schema.Int),
|
|
33
|
-
retryAfterMillis: Schema.optionalKey(Schema.Natural)
|
|
34
|
-
});
|
|
35
|
-
/** Credential-free control-plane failures; response bodies and native causes never escape. */
|
|
36
|
-
var ClientError = class extends Schema.TaggedError()("ClientError", requestFields([
|
|
37
|
-
"configure",
|
|
38
|
-
"provider-read",
|
|
39
|
-
"provider-mutation",
|
|
40
|
-
"provider-upload",
|
|
41
|
-
"media-download"
|
|
42
|
-
])) {};
|
|
43
|
-
var SessionError = class extends Schema.TaggedError()("SessionError", requestFields([
|
|
44
|
-
"session-retrieve",
|
|
45
|
-
"session-list",
|
|
46
|
-
"session-release",
|
|
47
|
-
"session-wait",
|
|
48
|
-
"session-logs",
|
|
49
|
-
"session-live-view",
|
|
50
|
-
"session-connect",
|
|
51
|
-
"session-attach"
|
|
52
|
-
])) {};
|
|
53
|
-
var ContextError = class extends Schema.TaggedError()("ContextError", requestFields([
|
|
54
|
-
"context-create",
|
|
55
|
-
"context-retrieve",
|
|
56
|
-
"context-delete",
|
|
57
|
-
"writer",
|
|
58
|
-
"writer-admit",
|
|
59
|
-
"writer-authority",
|
|
60
|
-
"writer-readback",
|
|
61
|
-
"writer-settle",
|
|
62
|
-
"writer-reconcile"
|
|
63
|
-
])) {};
|
|
64
|
-
/**
|
|
65
|
-
* `extension-archive` is the local inspection of the bytes a caller supplied, before any
|
|
66
|
-
* request. Why an archive was refused is its reason, never a second operation.
|
|
67
|
-
*/
|
|
68
|
-
var ExtensionError = class extends Schema.TaggedError()("ExtensionError", {
|
|
69
|
-
...requestFields([
|
|
70
|
-
"extension-archive",
|
|
71
|
-
"extension-register",
|
|
72
|
-
"extension-retrieve",
|
|
73
|
-
"extension-delete"
|
|
74
|
-
]),
|
|
75
|
-
reason: Schema.Literals([...RequestReason.literals, "unsafe-filename"])
|
|
76
|
-
}) {};
|
|
77
|
-
/** Project inspection and usage. */
|
|
78
|
-
var ProjectError = class extends Schema.TaggedError()("ProjectError", requestFields([
|
|
79
|
-
"project-list",
|
|
80
|
-
"project-retrieve",
|
|
81
|
-
"project-usage"
|
|
82
|
-
])) {};
|
|
83
|
-
/** Proxy CA certificate administration. */
|
|
84
|
-
var CertificateError = class extends Schema.TaggedError()("CertificateError", requestFields([
|
|
85
|
-
"certificate-create",
|
|
86
|
-
"certificate-list",
|
|
87
|
-
"certificate-retrieve",
|
|
88
|
-
"certificate-delete"
|
|
89
|
-
])) {};
|
|
90
|
-
/**
|
|
91
|
-
* Browserbase platform services outside a browser session: Search, Fetch, Agents, Functions
|
|
92
|
-
* and Webhooks. `service` names which one; these are host APIs, never model-facing tools.
|
|
93
|
-
*/
|
|
94
|
-
var PlatformError = class extends Schema.TaggedError()("PlatformError", {
|
|
95
|
-
...requestFields([
|
|
96
|
-
"search-web",
|
|
97
|
-
"fetch",
|
|
98
|
-
"agent-create",
|
|
99
|
-
"agent-list",
|
|
100
|
-
"agent-retrieve",
|
|
101
|
-
"agent-update",
|
|
102
|
-
"agent-delete",
|
|
103
|
-
"agent-run",
|
|
104
|
-
"agent-run-list",
|
|
105
|
-
"agent-run-retrieve",
|
|
106
|
-
"agent-run-messages",
|
|
107
|
-
"agent-run-stop",
|
|
108
|
-
"agent-run-wait",
|
|
109
|
-
"function-list",
|
|
110
|
-
"function-retrieve",
|
|
111
|
-
"function-versions",
|
|
112
|
-
"function-version",
|
|
113
|
-
"function-builds",
|
|
114
|
-
"function-build",
|
|
115
|
-
"function-build-logs",
|
|
116
|
-
"function-invoke",
|
|
117
|
-
"function-invocations",
|
|
118
|
-
"function-invocation",
|
|
119
|
-
"function-invocation-logs",
|
|
120
|
-
"function-wait",
|
|
121
|
-
"webhook-create",
|
|
122
|
-
"webhook-list",
|
|
123
|
-
"webhook-retrieve",
|
|
124
|
-
"webhook-update",
|
|
125
|
-
"webhook-delete",
|
|
126
|
-
"webhook-rotate-secret"
|
|
127
|
-
]),
|
|
128
|
-
service: Schema.Literals([
|
|
129
|
-
"search",
|
|
130
|
-
"fetch",
|
|
131
|
-
"agents",
|
|
132
|
-
"functions",
|
|
133
|
-
"webhooks"
|
|
134
|
-
])
|
|
135
|
-
}) {};
|
|
136
|
-
var FileError = class extends Schema.TaggedError()("FileError", {
|
|
137
|
-
...requestFields([
|
|
138
|
-
"upload",
|
|
139
|
-
"downloads-list",
|
|
140
|
-
"download-metadata",
|
|
141
|
-
"download",
|
|
142
|
-
"download-wait",
|
|
143
|
-
"download-delete"
|
|
144
|
-
]),
|
|
145
|
-
reason: Schema.Literals([
|
|
146
|
-
...RequestReason.literals,
|
|
147
|
-
"unsafe-filename",
|
|
148
|
-
"ambiguous",
|
|
149
|
-
"checksum",
|
|
150
|
-
"unsupported"
|
|
151
|
-
])
|
|
152
|
-
}) {};
|
|
153
|
-
var ArtifactError = class extends Schema.TaggedError()("ArtifactError", {
|
|
154
|
-
...requestFields([
|
|
155
|
-
"recording-request",
|
|
156
|
-
"recording-status",
|
|
157
|
-
"recording-wait",
|
|
158
|
-
"recording",
|
|
159
|
-
"recording-download",
|
|
160
|
-
"replay-metadata",
|
|
161
|
-
"replay",
|
|
162
|
-
"replay-playlist",
|
|
163
|
-
"replay-media"
|
|
164
|
-
]),
|
|
165
|
-
reason: Schema.Literals([
|
|
166
|
-
...RequestReason.literals,
|
|
167
|
-
"failed",
|
|
168
|
-
"byos",
|
|
169
|
-
"assembly-unknown",
|
|
170
|
-
"unsupported",
|
|
171
|
-
"ambiguous"
|
|
172
|
-
])
|
|
173
|
-
}) {};
|
|
174
|
-
/** Creation has a known rejection or an uncertain effect; absence of a reply is not a rejection. */
|
|
175
|
-
var AllocationError = class extends Schema.TaggedError()("AllocationError", {
|
|
176
|
-
attempt: AllocationAttempt,
|
|
177
|
-
reference: Schema.optionalKey(SessionReference),
|
|
178
|
-
outcome: Schema.Literals(["rejected", "unknown"]),
|
|
179
|
-
reason: Schema.Literals([
|
|
180
|
-
"authorization",
|
|
181
|
-
"rate-limited",
|
|
182
|
-
"configuration",
|
|
183
|
-
"provider",
|
|
184
|
-
"transport",
|
|
185
|
-
"timeout",
|
|
186
|
-
"malformed"
|
|
187
|
-
]),
|
|
188
|
-
status: Schema.optionalKey(Schema.Int),
|
|
189
|
-
retryAfterMillis: Schema.optionalKey(Schema.Natural)
|
|
190
|
-
}) {};
|
|
191
|
-
//#endregion
|
|
192
|
-
export { AllocationError, ArtifactError, CertificateError, ClientError, ContextError, ExtensionError, FileError, PlatformError, ProjectError, SessionError };
|
|
193
|
-
|
|
194
|
-
//# sourceMappingURL=Errors.mjs.map
|
package/dist/Errors.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Errors.mjs","names":[],"sources":["../src/Errors.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nimport { AllocationAttempt, SessionReference } from \"./References.ts\";\n\nconst RequestReason = Schema.Literals([\n \"configuration\",\n \"authorization\",\n \"rate-limited\",\n \"not-found\",\n \"active\",\n \"disabled\",\n \"expired\",\n \"provider\",\n \"transport\",\n \"timeout\",\n \"malformed\",\n \"limit\",\n \"unsafe-url\",\n \"content-type\",\n]);\n\n/**\n * Every control-plane error shares these fields, but never a vocabulary: each names only the\n * operations its own service performs, so a caller can match on them exhaustively.\n */\nconst requestFields = <const Operations extends ReadonlyArray<string>>(operations: Operations) => ({\n operation: Schema.Literals(operations),\n reason: RequestReason,\n outcome: Schema.optionalKey(Schema.Literals([\"undispatched\", \"rejected\", \"unknown\"])),\n status: Schema.optionalKey(Schema.Int),\n retryAfterMillis: Schema.optionalKey(Schema.Natural),\n});\n\n/** Credential-free control-plane failures; response bodies and native causes never escape. */\nexport class ClientError extends Schema.TaggedError<ClientError>()(\n \"ClientError\",\n requestFields([\n \"configure\",\n \"provider-read\",\n \"provider-mutation\",\n \"provider-upload\",\n \"media-download\",\n ]),\n) {}\n\nexport class SessionError extends Schema.TaggedError<SessionError>()(\n \"SessionError\",\n requestFields([\n \"session-retrieve\",\n \"session-list\",\n \"session-release\",\n \"session-wait\",\n \"session-logs\",\n \"session-live-view\",\n \"session-connect\",\n \"session-attach\",\n ]),\n) {}\n\nexport class ContextError extends Schema.TaggedError<ContextError>()(\n \"ContextError\",\n requestFields([\n \"context-create\",\n \"context-retrieve\",\n \"context-delete\",\n \"writer\",\n \"writer-admit\",\n \"writer-authority\",\n \"writer-readback\",\n \"writer-settle\",\n \"writer-reconcile\",\n ]),\n) {}\n\n/**\n * `extension-archive` is the local inspection of the bytes a caller supplied, before any\n * request. Why an archive was refused is its reason, never a second operation.\n */\nexport class ExtensionError extends Schema.TaggedError<ExtensionError>()(\"ExtensionError\", {\n ...requestFields([\n \"extension-archive\",\n \"extension-register\",\n \"extension-retrieve\",\n \"extension-delete\",\n ]),\n reason: Schema.Literals([...RequestReason.literals, \"unsafe-filename\"]),\n}) {}\n\n/** Project inspection and usage. */\nexport class ProjectError extends Schema.TaggedError<ProjectError>()(\n \"ProjectError\",\n requestFields([\"project-list\", \"project-retrieve\", \"project-usage\"]),\n) {}\n\n/** Proxy CA certificate administration. */\nexport class CertificateError extends Schema.TaggedError<CertificateError>()(\n \"CertificateError\",\n requestFields([\n \"certificate-create\",\n \"certificate-list\",\n \"certificate-retrieve\",\n \"certificate-delete\",\n ]),\n) {}\n\n/**\n * Browserbase platform services outside a browser session: Search, Fetch, Agents, Functions\n * and Webhooks. `service` names which one; these are host APIs, never model-facing tools.\n */\nexport class PlatformError extends Schema.TaggedError<PlatformError>()(\"PlatformError\", {\n ...requestFields([\n \"search-web\",\n \"fetch\",\n \"agent-create\",\n \"agent-list\",\n \"agent-retrieve\",\n \"agent-update\",\n \"agent-delete\",\n \"agent-run\",\n \"agent-run-list\",\n \"agent-run-retrieve\",\n \"agent-run-messages\",\n \"agent-run-stop\",\n \"agent-run-wait\",\n \"function-list\",\n \"function-retrieve\",\n \"function-versions\",\n \"function-version\",\n \"function-builds\",\n \"function-build\",\n \"function-build-logs\",\n \"function-invoke\",\n \"function-invocations\",\n \"function-invocation\",\n \"function-invocation-logs\",\n \"function-wait\",\n \"webhook-create\",\n \"webhook-list\",\n \"webhook-retrieve\",\n \"webhook-update\",\n \"webhook-delete\",\n \"webhook-rotate-secret\",\n ]),\n service: Schema.Literals([\"search\", \"fetch\", \"agents\", \"functions\", \"webhooks\"]),\n}) {}\n\nexport class FileError extends Schema.TaggedError<FileError>()(\"FileError\", {\n ...requestFields([\n \"upload\",\n \"downloads-list\",\n \"download-metadata\",\n \"download\",\n \"download-wait\",\n \"download-delete\",\n ]),\n reason: Schema.Literals([\n ...RequestReason.literals,\n \"unsafe-filename\",\n \"ambiguous\",\n \"checksum\",\n \"unsupported\",\n ]),\n}) {}\n\nexport class ArtifactError extends Schema.TaggedError<ArtifactError>()(\"ArtifactError\", {\n ...requestFields([\n \"recording-request\",\n \"recording-status\",\n \"recording-wait\",\n \"recording\",\n \"recording-download\",\n \"replay-metadata\",\n \"replay\",\n \"replay-playlist\",\n \"replay-media\",\n ]),\n reason: Schema.Literals([\n ...RequestReason.literals,\n \"failed\",\n \"byos\",\n \"assembly-unknown\",\n \"unsupported\",\n \"ambiguous\",\n ]),\n}) {}\n\n/** Creation has a known rejection or an uncertain effect; absence of a reply is not a rejection. */\nexport class AllocationError extends Schema.TaggedError<AllocationError>()(\"AllocationError\", {\n attempt: AllocationAttempt,\n reference: Schema.optionalKey(SessionReference),\n outcome: Schema.Literals([\"rejected\", \"unknown\"]),\n reason: Schema.Literals([\n \"authorization\",\n \"rate-limited\",\n \"configuration\",\n \"provider\",\n \"transport\",\n \"timeout\",\n \"malformed\",\n ]),\n status: Schema.optionalKey(Schema.Int),\n retryAfterMillis: Schema.optionalKey(Schema.Natural),\n}) {}\n"],"mappings":";;;AAIA,MAAM,gBAAgB,OAAO,SAAS;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;AAMD,MAAM,iBAAiE,gBAA4B;CACjG,WAAW,OAAO,SAAS,UAAU;CACrC,QAAQ;CACR,SAAS,OAAO,YAAY,OAAO,SAAS;EAAC;EAAgB;EAAY;CAAS,CAAC,CAAC;CACpF,QAAQ,OAAO,YAAY,OAAO,GAAG;CACrC,kBAAkB,OAAO,YAAY,OAAO,OAAO;AACrD;;AAGA,IAAa,cAAb,cAAiC,OAAO,YAAyB,CAAC,CAChE,eACA,cAAc;CACZ;CACA;CACA;CACA;CACA;AACF,CAAC,CACH,CAAC,CAAC,CAAC;AAEH,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAClE,gBACA,cAAc;CACZ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CACH,CAAC,CAAC,CAAC;AAEH,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAClE,gBACA,cAAc;CACZ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CACH,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,iBAAb,cAAoC,OAAO,YAA4B,CAAC,CAAC,kBAAkB;CACzF,GAAG,cAAc;EACf;EACA;EACA;EACA;CACF,CAAC;CACD,QAAQ,OAAO,SAAS,CAAC,GAAG,cAAc,UAAU,iBAAiB,CAAC;AACxE,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAClE,gBACA,cAAc;CAAC;CAAgB;CA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AkB,OAAO,YAAY,OAAO,OAAO;AACrD,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import { ExtensionReference, Identifier } from "./References.mjs";
|
|
2
|
-
import { ExtensionError } from "./Errors.mjs";
|
|
3
|
-
import { r as span, t as BrowserbaseClient } from "./Client-BEC4Q8ZS.mjs";
|
|
4
|
-
import { SafeFilename } from "./Transfers.mjs";
|
|
5
|
-
import { Context, Effect, Layer, Schema } from "effect";
|
|
6
|
-
//#region src/internal/extension/Archive.ts
|
|
7
|
-
const MAX_ENTRIES = 4096;
|
|
8
|
-
const MAX_NAME_BYTES = 512;
|
|
9
|
-
const MAX_DECLARED_BYTES = 536870912;
|
|
10
|
-
const EOCD_SIZE = 22;
|
|
11
|
-
const LOCAL_HEADER_SIZE = 30;
|
|
12
|
-
const STORED = 0;
|
|
13
|
-
const DEFLATED = 8;
|
|
14
|
-
const LOCAL_HEADER = 67324752;
|
|
15
|
-
const CENTRAL_HEADER = 33639248;
|
|
16
|
-
const END_OF_CENTRAL_DIRECTORY = 101010256;
|
|
17
|
-
const rejected = (reason) => ({
|
|
18
|
-
_tag: "Rejected",
|
|
19
|
-
reason
|
|
20
|
-
});
|
|
21
|
-
const control = (name) => [...name].some((character) => character < " " || character === "");
|
|
22
|
-
/** Any `..` or rooted member would name a file outside the extension directory. */
|
|
23
|
-
const unsafeName = (name) => name.length === 0 || name.startsWith("/") || name.includes("\\") || name.includes("//") || /^[A-Za-z]:/.test(name) || control(name) || name.split("/").some((segment) => segment === "." || segment === "..");
|
|
24
|
-
const inspectExtensionArchive = (archive) => {
|
|
25
|
-
if (archive.byteLength < EOCD_SIZE) return rejected("malformed");
|
|
26
|
-
const view = new DataView(archive.buffer, archive.byteOffset, archive.byteLength);
|
|
27
|
-
const u16 = (offset) => view.getUint16(offset, true);
|
|
28
|
-
const u32 = (offset) => view.getUint32(offset, true);
|
|
29
|
-
if (u32(0) !== LOCAL_HEADER) return rejected("signature");
|
|
30
|
-
const earliest = Math.max(0, archive.byteLength - EOCD_SIZE - 65535);
|
|
31
|
-
let end = -1;
|
|
32
|
-
for (let offset = archive.byteLength - EOCD_SIZE; offset >= earliest; offset--) if (u32(offset) === END_OF_CENTRAL_DIRECTORY) {
|
|
33
|
-
end = offset;
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
if (end < 0) return rejected("malformed");
|
|
37
|
-
const entries = u16(end + 10);
|
|
38
|
-
const directorySize = u32(end + 12);
|
|
39
|
-
const directoryOffset = u32(end + 16);
|
|
40
|
-
const commentLength = u16(end + 20);
|
|
41
|
-
if (u16(end + 4) !== 0 || u16(end + 6) !== 0 || u16(end + 8) !== entries) return rejected("unsupported");
|
|
42
|
-
if (entries === 65535 || directorySize === 4294967295 || directoryOffset === 4294967295) return rejected("unsupported");
|
|
43
|
-
if (end + EOCD_SIZE + commentLength !== archive.byteLength) return rejected("malformed");
|
|
44
|
-
if (directoryOffset + directorySize > end) return rejected("malformed");
|
|
45
|
-
if (entries > MAX_ENTRIES) return rejected("limit");
|
|
46
|
-
const names = new TextDecoder("utf-8", { fatal: true });
|
|
47
|
-
const limit = directoryOffset + directorySize;
|
|
48
|
-
let offset = directoryOffset;
|
|
49
|
-
let declaredBytes = 0;
|
|
50
|
-
let manifest = false;
|
|
51
|
-
for (let index = 0; index < entries; index++) {
|
|
52
|
-
if (offset + 46 > limit || u32(offset) !== CENTRAL_HEADER) return rejected("malformed");
|
|
53
|
-
const flags = u16(offset + 8);
|
|
54
|
-
const method = u16(offset + 10);
|
|
55
|
-
const compressed = u32(offset + 20);
|
|
56
|
-
const declared = u32(offset + 24);
|
|
57
|
-
const nameLength = u16(offset + 28);
|
|
58
|
-
const extraLength = u16(offset + 30);
|
|
59
|
-
const entryCommentLength = u16(offset + 32);
|
|
60
|
-
const localOffset = u32(offset + 42);
|
|
61
|
-
if (declared === 4294967295 || compressed === 4294967295 || localOffset === 4294967295) return rejected("unsupported");
|
|
62
|
-
if ((flags & 1) !== 0 || method !== STORED && method !== DEFLATED) return rejected("unsupported");
|
|
63
|
-
if (nameLength === 0 || nameLength > MAX_NAME_BYTES) return rejected("name");
|
|
64
|
-
if (offset + 46 + nameLength + extraLength + entryCommentLength > limit) return rejected("malformed");
|
|
65
|
-
if (localOffset >= directoryOffset) return rejected("malformed");
|
|
66
|
-
let name;
|
|
67
|
-
try {
|
|
68
|
-
name = names.decode(archive.subarray(offset + 46, offset + 46 + nameLength));
|
|
69
|
-
} catch {
|
|
70
|
-
return rejected("name");
|
|
71
|
-
}
|
|
72
|
-
if (unsafeName(name)) return rejected("name");
|
|
73
|
-
if (localOffset + LOCAL_HEADER_SIZE > directoryOffset || u32(localOffset) !== LOCAL_HEADER) return rejected("malformed");
|
|
74
|
-
const localNameLength = u16(localOffset + 26);
|
|
75
|
-
const localStart = localOffset + LOCAL_HEADER_SIZE;
|
|
76
|
-
if ((u16(localOffset + 6) & 1) !== 0 || u16(localOffset + 8) !== method || localNameLength !== nameLength || localStart + localNameLength + u16(localOffset + 28) + compressed > directoryOffset) return rejected("malformed");
|
|
77
|
-
try {
|
|
78
|
-
if (names.decode(archive.subarray(localStart, localStart + localNameLength)) !== name) return rejected("malformed");
|
|
79
|
-
} catch {
|
|
80
|
-
return rejected("name");
|
|
81
|
-
}
|
|
82
|
-
if (name === "manifest.json") manifest = true;
|
|
83
|
-
declaredBytes += declared;
|
|
84
|
-
if (declaredBytes > MAX_DECLARED_BYTES) return rejected("limit");
|
|
85
|
-
offset += 46 + nameLength + extraLength + entryCommentLength;
|
|
86
|
-
}
|
|
87
|
-
if (offset !== limit) return rejected("malformed");
|
|
88
|
-
if (!manifest) return rejected("manifest");
|
|
89
|
-
return {
|
|
90
|
-
_tag: "Accepted",
|
|
91
|
-
facts: {
|
|
92
|
-
entries,
|
|
93
|
-
declaredBytes
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
};
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region src/Extensions.ts
|
|
99
|
-
const Timestamp = Schema.String.check(Schema.isMaxLength(64));
|
|
100
|
-
/** The provider documents a 100 MB archive; a caller may request less, never more. */
|
|
101
|
-
const MAX_ARCHIVE_BYTES = 104857600;
|
|
102
|
-
const ProviderExtension = Schema.Struct({
|
|
103
|
-
id: Identifier,
|
|
104
|
-
projectId: Identifier,
|
|
105
|
-
fileName: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),
|
|
106
|
-
createdAt: Schema.optionalKey(Timestamp),
|
|
107
|
-
updatedAt: Schema.optionalKey(Timestamp)
|
|
108
|
-
});
|
|
109
|
-
/** Only fields the provider actually returned are reported; absence is never invented. */
|
|
110
|
-
var ExtensionMetadata = class extends Schema.Class("BrowserbaseExtensionMetadata")({
|
|
111
|
-
reference: ExtensionReference,
|
|
112
|
-
fileName: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),
|
|
113
|
-
createdAt: Schema.optionalKey(Timestamp),
|
|
114
|
-
updatedAt: Schema.optionalKey(Timestamp)
|
|
115
|
-
}) {};
|
|
116
|
-
/** Registration evidence is what this package inspected, not a provider load receipt. */
|
|
117
|
-
var ExtensionRegistration = class extends Schema.Class("BrowserbaseExtensionRegistration")({
|
|
118
|
-
reference: ExtensionReference,
|
|
119
|
-
archiveBytes: Schema.Natural,
|
|
120
|
-
entries: Schema.Natural,
|
|
121
|
-
declaredBytes: Schema.Natural
|
|
122
|
-
}) {};
|
|
123
|
-
const Upload = Schema.Struct({
|
|
124
|
-
filename: Schema.optionalKey(SafeFilename.check(Schema.makeFilter((value) => value.toLowerCase().endsWith(".zip")))),
|
|
125
|
-
maxBytes: Schema.optionalKey(Schema.Int.check(Schema.isBetween({
|
|
126
|
-
minimum: 1,
|
|
127
|
-
maximum: MAX_ARCHIVE_BYTES
|
|
128
|
-
}))),
|
|
129
|
-
timeoutMillis: Schema.optionalKey(Schema.Int.check(Schema.isBetween({
|
|
130
|
-
minimum: 1,
|
|
131
|
-
maximum: 6e5
|
|
132
|
-
})))
|
|
133
|
-
});
|
|
134
|
-
const fromClient = (operation, error) => ExtensionError.make({
|
|
135
|
-
operation,
|
|
136
|
-
reason: error.reason,
|
|
137
|
-
...error.outcome === void 0 ? {} : { outcome: error.outcome },
|
|
138
|
-
...error.status === void 0 ? {} : { status: error.status },
|
|
139
|
-
...error.retryAfterMillis === void 0 ? {} : { retryAfterMillis: error.retryAfterMillis }
|
|
140
|
-
});
|
|
141
|
-
const configuration = (operation) => ExtensionError.make({
|
|
142
|
-
operation,
|
|
143
|
-
reason: "configuration",
|
|
144
|
-
outcome: "undispatched"
|
|
145
|
-
});
|
|
146
|
-
const malformed = (operation, mutation = false) => ExtensionError.make({
|
|
147
|
-
operation,
|
|
148
|
-
reason: "malformed",
|
|
149
|
-
...mutation ? { outcome: "unknown" } : {}
|
|
150
|
-
});
|
|
151
|
-
/**
|
|
152
|
-
* A provisioned extension is a durable project resource selected at launch, never uploaded
|
|
153
|
-
* again on connect. The archive is inspected before transport; loading remains the provider's.
|
|
154
|
-
*/
|
|
155
|
-
var BrowserbaseExtensions = class BrowserbaseExtensions extends Context.Service()("effect-browserbase/Extensions") {
|
|
156
|
-
static layer = Layer.effect(BrowserbaseExtensions, Effect.gen(function* () {
|
|
157
|
-
const client = yield* BrowserbaseClient;
|
|
158
|
-
const validate = Effect.fnUntraced(function* (reference, operation) {
|
|
159
|
-
const ref = yield* Schema.decodeEffect(ExtensionReference)(reference, { onExcessProperty: "error" }).pipe(Effect.mapError(() => configuration(operation)));
|
|
160
|
-
if (ref.projectId !== client.projectId) return yield* ExtensionError.make({
|
|
161
|
-
operation,
|
|
162
|
-
reason: "authorization",
|
|
163
|
-
outcome: "undispatched"
|
|
164
|
-
});
|
|
165
|
-
return ref;
|
|
166
|
-
});
|
|
167
|
-
const register = Effect.fnUntraced(function* (archive, options = {}) {
|
|
168
|
-
const value = yield* Schema.decodeEffect(Upload)(options, { onExcessProperty: "error" }).pipe(Effect.mapError(() => configuration("extension-register")));
|
|
169
|
-
if (!(archive instanceof Uint8Array)) return yield* configuration("extension-register");
|
|
170
|
-
const maxBytes = value.maxBytes ?? MAX_ARCHIVE_BYTES;
|
|
171
|
-
if (archive.byteLength < 1 || archive.byteLength > maxBytes) return yield* ExtensionError.make({
|
|
172
|
-
operation: "extension-archive",
|
|
173
|
-
reason: "limit",
|
|
174
|
-
outcome: "undispatched"
|
|
175
|
-
});
|
|
176
|
-
const owned = new Uint8Array(archive);
|
|
177
|
-
const inspected = inspectExtensionArchive(owned);
|
|
178
|
-
if (inspected._tag === "Rejected") return yield* ExtensionError.make({
|
|
179
|
-
operation: "extension-archive",
|
|
180
|
-
reason: inspected.reason === "limit" ? "limit" : inspected.reason === "name" ? "unsafe-filename" : "configuration",
|
|
181
|
-
outcome: "undispatched"
|
|
182
|
-
});
|
|
183
|
-
const raw = yield* client.upload("/v1/extensions", {
|
|
184
|
-
field: "file",
|
|
185
|
-
filename: value.filename ?? "extension.zip",
|
|
186
|
-
mediaType: "application/zip",
|
|
187
|
-
bytes: owned
|
|
188
|
-
}, {
|
|
189
|
-
maxBytes,
|
|
190
|
-
...value.timeoutMillis === void 0 ? {} : { timeoutMillis: value.timeoutMillis }
|
|
191
|
-
}).pipe(Effect.mapError((error) => fromClient("extension-register", error)));
|
|
192
|
-
const created = yield* Schema.decodeUnknownEffect(ProviderExtension)(raw).pipe(Effect.mapError(() => malformed("extension-register", true)));
|
|
193
|
-
if (created.projectId !== client.projectId) return yield* malformed("extension-register", true);
|
|
194
|
-
return ExtensionRegistration.make({
|
|
195
|
-
reference: ExtensionReference.make({
|
|
196
|
-
provider: "browserbase",
|
|
197
|
-
projectId: client.projectId,
|
|
198
|
-
extensionId: created.id
|
|
199
|
-
}),
|
|
200
|
-
archiveBytes: owned.byteLength,
|
|
201
|
-
entries: inspected.facts.entries,
|
|
202
|
-
declaredBytes: inspected.facts.declaredBytes
|
|
203
|
-
});
|
|
204
|
-
}, span("BrowserbaseExtensions.register"));
|
|
205
|
-
const retrieve = Effect.fnUntraced(function* (reference) {
|
|
206
|
-
const ref = yield* validate(reference, "extension-retrieve");
|
|
207
|
-
const raw = yield* client.json("GET", `/v1/extensions/${encodeURIComponent(ref.extensionId)}`).pipe(Effect.mapError((error) => fromClient("extension-retrieve", error)));
|
|
208
|
-
const value = yield* Schema.decodeUnknownEffect(ProviderExtension)(raw).pipe(Effect.mapError(() => malformed("extension-retrieve")));
|
|
209
|
-
if (value.id !== ref.extensionId || value.projectId !== ref.projectId) return yield* malformed("extension-retrieve");
|
|
210
|
-
return ExtensionMetadata.make({
|
|
211
|
-
reference: ref,
|
|
212
|
-
...value.fileName === void 0 ? {} : { fileName: value.fileName },
|
|
213
|
-
...value.createdAt === void 0 ? {} : { createdAt: value.createdAt },
|
|
214
|
-
...value.updatedAt === void 0 ? {} : { updatedAt: value.updatedAt }
|
|
215
|
-
});
|
|
216
|
-
}, span("BrowserbaseExtensions.retrieve"));
|
|
217
|
-
const remove = Effect.fnUntraced(function* (reference) {
|
|
218
|
-
const ref = yield* validate(reference, "extension-delete");
|
|
219
|
-
yield* client.noContent("DELETE", `/v1/extensions/${encodeURIComponent(ref.extensionId)}`).pipe(Effect.mapError((error) => fromClient("extension-delete", error)));
|
|
220
|
-
}, span("BrowserbaseExtensions.delete"));
|
|
221
|
-
return BrowserbaseExtensions.of({
|
|
222
|
-
register,
|
|
223
|
-
retrieve,
|
|
224
|
-
delete: remove
|
|
225
|
-
});
|
|
226
|
-
}));
|
|
227
|
-
};
|
|
228
|
-
//#endregion
|
|
229
|
-
export { ExtensionMetadata as n, ExtensionRegistration as r, BrowserbaseExtensions as t };
|
|
230
|
-
|
|
231
|
-
//# sourceMappingURL=Extensions-BTUn9zhK.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Extensions-BTUn9zhK.mjs","names":["Trace.span"],"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, ExtensionError } from \"./Errors.ts\";\nimport { inspectExtensionArchive } from \"./internal/extension/Archive.ts\";\nimport * as Trace from \"./internal/Trace.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.fnUntraced(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 }, Trace.span(\"BrowserbaseExtensions.register\"));\n\n const retrieve = Effect.fnUntraced(function* (reference: ExtensionReference) {\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 }, Trace.span(\"BrowserbaseExtensions.retrieve\"));\n\n const remove = Effect.fnUntraced(function* (reference: ExtensionReference) {\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 }, Trace.span(\"BrowserbaseExtensions.delete\"));\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;EAC5C,MAAM;EACN;CACF;CAEF,IAAI,MAAM,GAAG,OAAO,SAAS,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X,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,GAAGA,KAAW,gCAAgC,CAAC;EAE/C,MAAM,SAAS,OAAO,WAAW,WAAW,WAA+B;GACzE,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,GAAGA,KAAW,8BAA8B,CAAC;EAE7C,OAAO,sBAAsB,GAAG;GAAE;GAAU;GAAU,QAAQ;EAAO,CAAC;CACxE,CAAC,CACH;AACJ"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { r as ExtensionReference } from "./References-DOH3Wu44.mjs";
|
|
2
|
-
import { ExtensionError } from "./Errors.mjs";
|
|
3
|
-
import { t as BrowserbaseClient } from "./Client-B_f6bBLT.mjs";
|
|
4
|
-
import { Context, Effect, Layer, Schema } from "effect";
|
|
5
|
-
//#region src/Extensions.d.ts
|
|
6
|
-
declare const ExtensionMetadata_base: Schema.Class<ExtensionMetadata, Schema.Struct<{
|
|
7
|
-
readonly reference: typeof ExtensionReference;
|
|
8
|
-
readonly fileName: Schema.optionalKey<Schema.String>;
|
|
9
|
-
readonly createdAt: Schema.optionalKey<Schema.String>;
|
|
10
|
-
readonly updatedAt: Schema.optionalKey<Schema.String>;
|
|
11
|
-
}>, {}>;
|
|
12
|
-
/** Only fields the provider actually returned are reported; absence is never invented. */
|
|
13
|
-
declare class ExtensionMetadata extends ExtensionMetadata_base {}
|
|
14
|
-
declare const ExtensionRegistration_base: Schema.Class<ExtensionRegistration, Schema.Struct<{
|
|
15
|
-
readonly reference: typeof ExtensionReference;
|
|
16
|
-
readonly archiveBytes: Schema.Natural;
|
|
17
|
-
readonly entries: Schema.Natural;
|
|
18
|
-
readonly declaredBytes: Schema.Natural;
|
|
19
|
-
}>, {}>;
|
|
20
|
-
/** Registration evidence is what this package inspected, not a provider load receipt. */
|
|
21
|
-
declare class ExtensionRegistration extends ExtensionRegistration_base {}
|
|
22
|
-
interface ExtensionUploadOptions {
|
|
23
|
-
/** Portable basename sent with the part; defaults to `extension.zip`. */
|
|
24
|
-
readonly filename?: string;
|
|
25
|
-
readonly maxBytes?: number;
|
|
26
|
-
readonly timeoutMillis?: number;
|
|
27
|
-
}
|
|
28
|
-
declare const BrowserbaseExtensions_base: Context.ServiceClass<BrowserbaseExtensions, "effect-browserbase/Extensions", {
|
|
29
|
-
readonly register: (archive: Uint8Array, options?: ExtensionUploadOptions) => Effect.Effect<ExtensionRegistration, ExtensionError>;
|
|
30
|
-
readonly retrieve: (reference: ExtensionReference) => Effect.Effect<ExtensionMetadata, ExtensionError>;
|
|
31
|
-
readonly delete: (reference: ExtensionReference) => Effect.Effect<void, ExtensionError>;
|
|
32
|
-
}>;
|
|
33
|
-
/**
|
|
34
|
-
* A provisioned extension is a durable project resource selected at launch, never uploaded
|
|
35
|
-
* again on connect. The archive is inspected before transport; loading remains the provider's.
|
|
36
|
-
*/
|
|
37
|
-
declare class BrowserbaseExtensions extends BrowserbaseExtensions_base {
|
|
38
|
-
static readonly layer: Layer.Layer<BrowserbaseExtensions, never, BrowserbaseClient>;
|
|
39
|
-
}
|
|
40
|
-
//#endregion
|
|
41
|
-
export { ExtensionUploadOptions as i, ExtensionMetadata as n, ExtensionRegistration as r, BrowserbaseExtensions as t };
|
|
42
|
-
export {};
|
|
43
|
-
//# sourceMappingURL=Extensions-DBXuVM1f.d.mts.map
|
package/dist/Extensions.d.mts
DELETED
package/dist/Extensions.mjs
DELETED