@yielded/agent-platform-cloudflare 0.1.0-beta.167 → 0.1.0-beta.169
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/dist/{Alarm-B0ODr1NE.mjs → Alarm-BMEAZo3p.mjs} +261 -159
- package/dist/Alarm-BMEAZo3p.mjs.map +1 -0
- package/dist/Alarm.d.mts +29 -36
- package/dist/Alarm.mjs +2 -2
- package/dist/BrowserCredentials-C5IWfi7f.d.mts +91 -0
- package/dist/BrowserCredentials.d.mts +2 -91
- package/dist/BrowserRestCapture.mjs +3 -3
- package/dist/BrowserRestCapture.mjs.map +1 -1
- package/dist/BrowserRestCrawl.mjs +6 -6
- package/dist/BrowserRestCrawl.mjs.map +1 -1
- package/dist/{BrowserSession-RfIzxGCH.mjs → BrowserSession-BfNmyayH.mjs} +5 -5
- package/dist/BrowserSession-BfNmyayH.mjs.map +1 -0
- package/dist/{BrowserSession-B969Xg-2.d.mts → BrowserSession-Bx0V1-6_.d.mts} +6 -3
- package/dist/BrowserSession.d.mts +1 -1
- package/dist/BrowserSession.mjs +2 -2
- package/dist/BrowserUse-Bc2JdLW2.mjs +1528 -0
- package/dist/BrowserUse-Bc2JdLW2.mjs.map +1 -0
- package/dist/BrowserUse.d.mts +83 -0
- package/dist/BrowserUse.mjs +2 -0
- package/dist/CloudflareBindings.d.mts +8 -1
- package/dist/CloudflareBindings.mjs +2 -2
- package/dist/CloudflareBindings.mjs.map +1 -1
- package/dist/{CloudflareBrowser-5an6m-Qb.mjs → CloudflareBrowser-Vt8qTdYW.mjs} +11 -13
- package/dist/CloudflareBrowser-Vt8qTdYW.mjs.map +1 -0
- package/dist/CloudflareBrowser.mjs +1 -1
- package/dist/CloudflareCodeMode.mjs +1 -1
- package/dist/CloudflareCodeMode.mjs.map +1 -1
- package/dist/{CloudflareConfig-qDrRLofL.d.mts → CloudflareConfig-C9MvPbX8.d.mts} +9 -11
- package/dist/CloudflareConfig.d.mts +1 -1
- package/dist/CloudflareConfig.mjs +9 -12
- package/dist/CloudflareConfig.mjs.map +1 -1
- package/dist/CloudflareMemory.d.mts +3 -25
- package/dist/CloudflareMemory.mjs +33 -31
- package/dist/CloudflareMemory.mjs.map +1 -1
- package/dist/CloudflareScheduling.mjs +8 -15
- package/dist/CloudflareScheduling.mjs.map +1 -1
- package/dist/CloudflareSubscriptions.mjs +9 -16
- package/dist/CloudflareSubscriptions.mjs.map +1 -1
- package/dist/CloudflareThreadClient-CLZpN9zU.mjs +588 -0
- package/dist/CloudflareThreadClient-CLZpN9zU.mjs.map +1 -0
- package/dist/CloudflareThreadClient-QsVzLGGZ.d.mts +2033 -0
- package/dist/CloudflareThreadClient.d.mts +2 -1796
- package/dist/CloudflareThreadClient.mjs +2 -382
- package/dist/{InteractiveBrowser-BbG3kGA9.mjs → InteractiveBrowser-LdKzQeLR.mjs} +18 -19
- package/dist/InteractiveBrowser-LdKzQeLR.mjs.map +1 -0
- package/dist/InteractiveBrowser.mjs +1 -1
- package/dist/{ThreadObject-BcfXbzSO.d.mts → ThreadObject-7s5XnlH-.d.mts} +103 -79
- package/dist/{ThreadObject-DHjrnlX4.mjs → ThreadObject-CgXZMlr4.mjs} +265 -66
- package/dist/ThreadObject-CgXZMlr4.mjs.map +1 -0
- package/dist/ThreadObject.d.mts +2 -2
- package/dist/ThreadObject.mjs +2 -3
- package/dist/WakeScheduler.d.mts +6 -5
- package/dist/WakeScheduler.mjs +15 -11
- package/dist/WakeScheduler.mjs.map +1 -1
- package/dist/index.d.mts +7 -6
- package/dist/index.mjs +7 -6
- package/dist/page-function-CmUCcyNP.mjs +11 -0
- package/dist/page-function-CmUCcyNP.mjs.map +1 -0
- package/dist/{prepared-admission-DMX5p9dC.mjs → prepared-admission-B61A7y6O.mjs} +3 -3
- package/dist/{prepared-admission-DMX5p9dC.mjs.map → prepared-admission-B61A7y6O.mjs.map} +1 -1
- package/package.json +1 -1
- package/src/Alarm.ts +512 -279
- package/src/BrowserRestCapture.ts +2 -2
- package/src/BrowserRestCrawl.ts +10 -14
- package/src/BrowserSession.ts +10 -2
- package/src/BrowserUse.ts +1591 -0
- package/src/CloudflareBindings.ts +13 -4
- package/src/CloudflareCodeMode.ts +1 -1
- package/src/CloudflareConfig.ts +9 -12
- package/src/CloudflareMemory.ts +21 -28
- package/src/CloudflareScheduling.ts +7 -15
- package/src/CloudflareSubscriptions.ts +11 -20
- package/src/CloudflareThreadClient.ts +289 -9
- package/src/InteractiveBrowser.ts +325 -323
- package/src/ThreadObject.ts +172 -52
- package/src/WakeScheduler.ts +29 -18
- package/src/index.ts +1 -0
- package/src/internal/browser-dom.ts +886 -0
- package/src/internal/browser-file-selection.ts +8 -1
- package/src/internal/browser-jev-dom.ts +362 -0
- package/src/internal/browser-quick-action.ts +7 -8
- package/src/internal/browser-session-lifecycle.ts +2 -5
- package/src/internal/crypto.ts +41 -0
- package/src/internal/due-queue.ts +5 -69
- package/src/internal/layers.ts +100 -17
- package/src/internal/live-text-protocol.ts +51 -0
- package/src/internal/live-text.ts +256 -0
- package/src/internal/page-function.ts +12 -0
- package/src/internal/prepared-admission.ts +1 -1
- package/src/internal/progress-wait.ts +19 -24
- package/src/internal/transport.ts +1 -1
- package/dist/Alarm-B0ODr1NE.mjs.map +0 -1
- package/dist/BrowserSession-RfIzxGCH.mjs.map +0 -1
- package/dist/CloudflareBrowser-5an6m-Qb.mjs.map +0 -1
- package/dist/CloudflareThreadClient.mjs.map +0 -1
- package/dist/InteractiveBrowser-BbG3kGA9.mjs.map +0 -1
- package/dist/ThreadObject-DHjrnlX4.mjs.map +0 -1
|
@@ -199,7 +199,7 @@ const isJsonResponse = (headers: Readonly<Record<string, string | undefined>>):
|
|
|
199
199
|
return mediaType === "application/json" || mediaType?.endsWith("+json") === true;
|
|
200
200
|
};
|
|
201
201
|
|
|
202
|
-
const readBoundedResponse = Effect.
|
|
202
|
+
const readBoundedResponse = Effect.fnUntraced(function* (
|
|
203
203
|
response: { readonly stream: Stream.Stream<Uint8Array, HttpClientError.HttpClientError> },
|
|
204
204
|
request: PageCaptureRequest,
|
|
205
205
|
): Effect.fn.Return<string, PageCaptureError> {
|
|
@@ -308,7 +308,7 @@ const makeCapture = (
|
|
|
308
308
|
options: BrowserRestCaptureOptions,
|
|
309
309
|
workersAi?: BrowserQuickActionWorkersAiPolicy,
|
|
310
310
|
): PageCaptureCapture =>
|
|
311
|
-
Effect.
|
|
311
|
+
Effect.fnUntraced(function* (
|
|
312
312
|
request: PageCaptureRequest,
|
|
313
313
|
): Effect.fn.Return<PageCaptureResult, PageCaptureError> {
|
|
314
314
|
const usesWorkersAi = request.action._tag === "CapturePageStructured";
|
package/src/BrowserRestCrawl.ts
CHANGED
|
@@ -160,7 +160,7 @@ const endpoint = (options: BrowserRestCrawlOptions, jobId?: string): string =>
|
|
|
160
160
|
jobId === undefined ? "" : `/${encodeURIComponent(jobId)}`
|
|
161
161
|
}`;
|
|
162
162
|
|
|
163
|
-
const readBoundedResponse = Effect.
|
|
163
|
+
const readBoundedResponse = Effect.fnUntraced(function* (
|
|
164
164
|
response: HttpClientResponse.HttpClientResponse,
|
|
165
165
|
maximum: number,
|
|
166
166
|
): Effect.fn.Return<string, PageCrawlProtocolError> {
|
|
@@ -206,16 +206,13 @@ const readBoundedResponse = Effect.fn("BrowserRestCrawl.readBoundedResponse")(fu
|
|
|
206
206
|
});
|
|
207
207
|
});
|
|
208
208
|
|
|
209
|
-
const deadlineFailure = Effect.
|
|
210
|
-
request: PageCrawlRequest,
|
|
211
|
-
startedAt: number,
|
|
212
|
-
) {
|
|
209
|
+
const deadlineFailure = Effect.fnUntraced(function* (request: PageCrawlRequest, startedAt: number) {
|
|
213
210
|
const now = yield* Effect.clockWith((clock) => clock.currentTimeMillis);
|
|
214
211
|
|
|
215
212
|
return yield* limitError(request, "deadline", Math.max(0, now - startedAt));
|
|
216
213
|
});
|
|
217
214
|
|
|
218
|
-
const withinDeadline = Effect.
|
|
215
|
+
const withinDeadline = Effect.fnUntraced(function* <A, E, R>(
|
|
219
216
|
effect: Effect.Effect<A, E, R>,
|
|
220
217
|
request: PageCrawlRequest,
|
|
221
218
|
startedAt: number,
|
|
@@ -234,10 +231,7 @@ const withinDeadline = Effect.fn("BrowserRestCrawl.withinDeadline")(function* <A
|
|
|
234
231
|
);
|
|
235
232
|
});
|
|
236
233
|
|
|
237
|
-
const checkDeadline = Effect.
|
|
238
|
-
request: PageCrawlRequest,
|
|
239
|
-
startedAt: number,
|
|
240
|
-
) {
|
|
234
|
+
const checkDeadline = Effect.fnUntraced(function* (request: PageCrawlRequest, startedAt: number) {
|
|
241
235
|
const now = yield* Effect.clockWith((clock) => clock.currentTimeMillis);
|
|
242
236
|
const elapsed = Math.max(0, now - startedAt);
|
|
243
237
|
|
|
@@ -268,9 +262,11 @@ const makeCrawl =
|
|
|
268
262
|
const startedAt = yield* Effect.clockWith((clock) => clock.currentTimeMillis);
|
|
269
263
|
const startHost = new URL(input.startUrl).host;
|
|
270
264
|
|
|
271
|
-
const executeJson = Effect.
|
|
272
|
-
|
|
273
|
-
|
|
265
|
+
const executeJson = Effect.fnUntraced(function* <S extends Schema.Top>(
|
|
266
|
+
request: HttpClientRequest.HttpClientRequest,
|
|
267
|
+
schema: S,
|
|
268
|
+
maximum: number,
|
|
269
|
+
) {
|
|
274
270
|
const authorized = HttpClientRequest.bearerToken(request, options.apiToken).pipe(
|
|
275
271
|
HttpClientRequest.acceptJson,
|
|
276
272
|
);
|
|
@@ -409,7 +405,7 @@ const makeCrawl =
|
|
|
409
405
|
),
|
|
410
406
|
);
|
|
411
407
|
|
|
412
|
-
const fetchResult = Effect.
|
|
408
|
+
const fetchResult = Effect.fnUntraced(function* (
|
|
413
409
|
cursor: Option.Option<string>,
|
|
414
410
|
statusOnly: boolean,
|
|
415
411
|
) {
|
package/src/BrowserSession.ts
CHANGED
|
@@ -103,10 +103,12 @@ export interface BrowserSession {
|
|
|
103
103
|
* Check current authority under the lock before native dispatch. A settled SDK rejection leaves
|
|
104
104
|
* the session available for inspection, but may have changed the website; never retry blindly.
|
|
105
105
|
* Timeout/interruption fences outstanding SDK work and terminates the exact browser.
|
|
106
|
+
* An optional timeoutMillis narrows the command deadline, for example for bounded preparation.
|
|
106
107
|
*/
|
|
107
108
|
readonly run: <A, E, R>(
|
|
108
109
|
authorize: Effect.Effect<void, E, R>,
|
|
109
110
|
action: (page: Page) => Promise<A>,
|
|
111
|
+
options?: { readonly timeoutMillis: number },
|
|
110
112
|
) => Effect.Effect<A, E | BrowserSessionError, R>;
|
|
111
113
|
/**
|
|
112
114
|
* Resolves host-owned material under fresh credential grants. Never submits or retries a write.
|
|
@@ -414,6 +416,7 @@ export class BrowserSessions extends Context.Service<
|
|
|
414
416
|
authorize: Effect.Effect<void, E, R>,
|
|
415
417
|
action: (page: Page) => Promise<A>,
|
|
416
418
|
terminateOnError = false,
|
|
419
|
+
timeoutMillis?: number,
|
|
417
420
|
) =>
|
|
418
421
|
runEffect((commandTimeoutMillis) =>
|
|
419
422
|
authorize.pipe(
|
|
@@ -431,7 +434,7 @@ export class BrowserSessions extends Context.Service<
|
|
|
431
434
|
),
|
|
432
435
|
),
|
|
433
436
|
Effect.timeoutOrElse({
|
|
434
|
-
duration: commandTimeoutMillis,
|
|
437
|
+
duration: Math.min(commandTimeoutMillis, timeoutMillis ?? commandTimeoutMillis),
|
|
435
438
|
orElse: () =>
|
|
436
439
|
terminate.pipe(
|
|
437
440
|
Effect.flatMap((closed) =>
|
|
@@ -466,7 +469,12 @@ export class BrowserSessions extends Context.Service<
|
|
|
466
469
|
|
|
467
470
|
const session: BrowserSession = {
|
|
468
471
|
reference,
|
|
469
|
-
run,
|
|
472
|
+
run: (authorize, action, options) =>
|
|
473
|
+
options === undefined
|
|
474
|
+
? run(authorize, action)
|
|
475
|
+
: decode(PositiveMillis, options.timeoutMillis).pipe(
|
|
476
|
+
Effect.flatMap((timeoutMillis) => run(authorize, action, false, timeoutMillis)),
|
|
477
|
+
),
|
|
470
478
|
fillCredential: (request) =>
|
|
471
479
|
runEffect((commandTimeoutMillis) =>
|
|
472
480
|
fillCredential(request).pipe(
|