@icebreakers/monorepo-templates 1.0.10 → 1.0.11

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.
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable */
2
2
  // Generated by Wrangler by running `wrangler types` (hash: 047568eb9ed6843cb5540fa33180da01)
3
- // Runtime types generated with workerd@1.20260526.1 2025-10-16 nodejs_compat
3
+ // Runtime types generated with workerd@1.20260609.1 2025-10-16 nodejs_compat
4
4
  interface __BaseEnv_Env {
5
5
  }
6
6
  declare namespace Cloudflare {
@@ -3481,6 +3481,229 @@ declare abstract class Span {
3481
3481
  get isTraced(): boolean;
3482
3482
  setAttribute(key: string, value?: (boolean | number | string)): void;
3483
3483
  }
3484
+ // ============================================================================
3485
+ // Agent Memory
3486
+ //
3487
+ // Public type surface for user Workers binding to an Agent Memory namespace.
3488
+ // ============================================================================
3489
+ /** Memory type — every memory is classified into exactly one. */
3490
+ type AgentMemoryMemoryType = "fact" | "event" | "instruction" | "task";
3491
+ /** Search intensity for recall. */
3492
+ type AgentMemoryThinkingLevel = "low" | "medium" | "high";
3493
+ /** Response verbosity for recall. */
3494
+ type AgentMemoryResponseLength = "short" | "medium" | "long";
3495
+ /** A conversation message passed to ingest(). */
3496
+ interface AgentMemoryMessage {
3497
+ role: "system" | "user" | "assistant";
3498
+ content: string;
3499
+ /** Optional message timestamp. */
3500
+ timestamp?: Date;
3501
+ }
3502
+ /** Raw memory content passed to remember(). */
3503
+ interface AgentMemoryIncomingMemory {
3504
+ /** Raw memory content. The service classifies and summarizes automatically. */
3505
+ content: string;
3506
+ /** Optional session identifier to associate with this memory. */
3507
+ sessionId?: string | null | undefined;
3508
+ }
3509
+ /** A stored memory returned from remember(), get(), and delete(). */
3510
+ interface AgentMemoryMemory {
3511
+ /** Memory ID. */
3512
+ id: string;
3513
+ /** Memory type. */
3514
+ type: AgentMemoryMemoryType;
3515
+ /** Text summary. */
3516
+ summary: string;
3517
+ /** Memory text. */
3518
+ content: string;
3519
+ /** Session that created this memory. */
3520
+ sessionId: string | null;
3521
+ /** Memory creation time. */
3522
+ createdAt: Date;
3523
+ /** Memory last-update time. */
3524
+ updatedAt: Date;
3525
+ }
3526
+ /** Single entry in a list() response. Same shape as Memory minus full content. */
3527
+ type AgentMemoryMemoryListEntry = Omit<AgentMemoryMemory, "content">;
3528
+ /** A scored memory candidate in a recall result. */
3529
+ interface AgentMemoryScoredCandidate {
3530
+ /** Candidate ID. */
3531
+ id: string;
3532
+ /** Text summary. */
3533
+ summary: string;
3534
+ /** Session that created this candidate, when known. */
3535
+ sessionId: string | null;
3536
+ /** Relevance score (higher is better). Comparable only within a single query. */
3537
+ score: number;
3538
+ }
3539
+ /** Options for the ingest() method. */
3540
+ interface AgentMemoryIngestOptions {
3541
+ /** Session identifier to associate with memories created during ingestion. */
3542
+ sessionId?: string | null | undefined;
3543
+ }
3544
+ /** Options for the getSummary() method. */
3545
+ interface AgentMemoryGetSummaryOptions {
3546
+ /** Session identifier to retrieve session summary for. */
3547
+ sessionId?: string | null | undefined;
3548
+ }
3549
+ /** Response from the getSummary() method. */
3550
+ interface AgentMemoryGetSummaryResponse {
3551
+ /** Markdown summary. */
3552
+ summary: string;
3553
+ }
3554
+ /**
3555
+ * Options for the recall() method.
3556
+ *
3557
+ * `referenceDate` accepts a Date object, an ISO-8601 date string
3558
+ * (YYYY-MM-DD), or a full ISO-8601 datetime string. When provided, this
3559
+ * date is used as "today" for resolving relative time references
3560
+ * ("how many days ago", "last week") instead of the server's wall-clock time.
3561
+ */
3562
+ interface AgentMemoryRecallOptions {
3563
+ /** Recall intensity: "low" (default), "medium", or "high". */
3564
+ thinkingLevel?: AgentMemoryThinkingLevel;
3565
+ /** Response verbosity: "short", "medium" (default), or "long". */
3566
+ responseLength?: AgentMemoryResponseLength;
3567
+ /** Temporal anchor for date arithmetic. */
3568
+ referenceDate?: Date | string;
3569
+ }
3570
+ /** Response from the recall() method. */
3571
+ interface AgentMemoryRecallResult {
3572
+ /** Number of memories retrieved. */
3573
+ count: number;
3574
+ /** LLM-generated answer synthesizing the matching memories. */
3575
+ answer: string;
3576
+ /** Matching memories ranked by relevance. */
3577
+ candidates: AgentMemoryScoredCandidate[];
3578
+ }
3579
+ /**
3580
+ * Options for the list() method.
3581
+ *
3582
+ * `cursor` is the opaque continuation token returned by the previous page;
3583
+ * pass it back unchanged to fetch the next page. `sessionId` and `type`
3584
+ * are exact-match filters; combining them is allowed.
3585
+ */
3586
+ interface AgentMemoryListMemoriesOptions {
3587
+ /** Maximum number of memories to return. Default 20, max 500. */
3588
+ limit?: number;
3589
+ /** Opaque cursor from a previous page. */
3590
+ cursor?: string;
3591
+ /** Exact-match session filter. */
3592
+ sessionId?: string;
3593
+ /** Exact-match memory-type filter. */
3594
+ type?: AgentMemoryMemoryType;
3595
+ }
3596
+ /** Response from the list() method. */
3597
+ interface AgentMemoryListMemoriesResult {
3598
+ memories: AgentMemoryMemoryListEntry[];
3599
+ /** Continuation cursor; absent when this page exhausted the result set. */
3600
+ cursor?: string;
3601
+ }
3602
+ /**
3603
+ * A single Agent Memory profile, scoped to a profile name.
3604
+ *
3605
+ * Returned by {@link AgentMemoryNamespace.getProfile}.
3606
+ */
3607
+ declare abstract class AgentMemoryProfile {
3608
+ /**
3609
+ * Retrieve a memory by ID.
3610
+ *
3611
+ * @param memoryId - ULID of the memory to retrieve.
3612
+ * @throws if the memory does not exist.
3613
+ */
3614
+ get(memoryId: string): Promise<AgentMemoryMemory>;
3615
+ /**
3616
+ * Delete a memory by ID.
3617
+ *
3618
+ * Removes the memory and any source messages linked by the memory's
3619
+ * source message IDs.
3620
+ *
3621
+ * @param memoryId - ULID of the memory to delete.
3622
+ * @throws if the memory does not exist.
3623
+ */
3624
+ delete(memoryId: string): Promise<AgentMemoryMemory>;
3625
+ /**
3626
+ * Store a memory in this profile. The content is automatically classified,
3627
+ * summarized, and indexed.
3628
+ *
3629
+ * @param memory - Raw memory content to persist.
3630
+ */
3631
+ remember(memory: AgentMemoryIncomingMemory): Promise<AgentMemoryMemory>;
3632
+ /**
3633
+ * Extract memories from a conversation.
3634
+ *
3635
+ * @param messages - Conversation messages to extract memories from.
3636
+ * @param options - Optional ingest options.
3637
+ */
3638
+ ingest(messages: Iterable<AgentMemoryMessage>, options?: AgentMemoryIngestOptions): Promise<void>;
3639
+ /**
3640
+ * Get a profile summary.
3641
+ *
3642
+ * @param options - Optional getSummary options.
3643
+ */
3644
+ getSummary(options?: AgentMemoryGetSummaryOptions): Promise<AgentMemoryGetSummaryResponse>;
3645
+ /**
3646
+ * Recall memories in this profile.
3647
+ *
3648
+ * @param query - Recall query matched against memory content and keywords.
3649
+ * @param options - Optional recall parameters.
3650
+ * @returns Matching memories with relevance scores and a synthesized answer.
3651
+ */
3652
+ recall(query: string, options?: AgentMemoryRecallOptions): Promise<AgentMemoryRecallResult>;
3653
+ /**
3654
+ * List active memories in this profile.
3655
+ *
3656
+ * Returns a paginated, filterable view of stored memories. Superseded
3657
+ * versions are excluded. Use the returned `cursor` (when present) to
3658
+ * fetch the next page.
3659
+ *
3660
+ * @param options - Optional pagination and filter options.
3661
+ */
3662
+ list(options?: AgentMemoryListMemoriesOptions): Promise<AgentMemoryListMemoriesResult>;
3663
+ /**
3664
+ * Soft-delete every memory and message in this profile that is tagged
3665
+ * with `sessionId`.
3666
+ *
3667
+ * Idempotent: deleting a sessionId that has no rows is a no-op.
3668
+ *
3669
+ * @param sessionId - Session to delete.
3670
+ */
3671
+ deleteSession(sessionId: string): Promise<void>;
3672
+ }
3673
+ /**
3674
+ * Namespace-level Agent Memory binding.
3675
+ *
3676
+ * Used as the type of an `env.MEMORY`-style binding backed by the Agent
3677
+ * Memory product.
3678
+ *
3679
+ * @example
3680
+ * ```ts
3681
+ * export default {
3682
+ * async fetch(_request: Request, env: Env): Promise<Response> {
3683
+ * const profile = await env.MEMORY.getProfile("wrangler-e2e");
3684
+ * const summary = await profile.getSummary();
3685
+ * return Response.json(summary);
3686
+ * },
3687
+ * };
3688
+ * ```
3689
+ */
3690
+ declare abstract class AgentMemoryNamespace {
3691
+ /**
3692
+ * Get a memory profile by name. Profiles are isolated by namespace and
3693
+ * addressed by a compound key (namespaceId:profileName).
3694
+ *
3695
+ * @param profileName - Profile name (validated against naming rules).
3696
+ * @returns RPC target for interacting with the profile.
3697
+ */
3698
+ getProfile(profileName: string): Promise<AgentMemoryProfile>;
3699
+ /**
3700
+ * Soft-delete a profile and schedule deferred purge. Marks all
3701
+ * memories and messages as deleted.
3702
+ *
3703
+ * @param profileName - Name of the profile to delete.
3704
+ */
3705
+ deleteProfile(profileName: string): Promise<void>;
3706
+ }
3484
3707
  // ============ AI Search Error Interfaces ============
3485
3708
  interface AiSearchInternalError extends Error {
3486
3709
  }
@@ -10403,6 +10626,452 @@ declare abstract class AutoRAG {
10403
10626
  */
10404
10627
  aiSearch(params: AutoRagAiSearchRequest): Promise<AutoRagAiSearchResponse | Response>;
10405
10628
  }
10629
+ type BrowserRunLifecycleEvent = 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
10630
+ type BrowserRunResourceType = 'document' | 'stylesheet' | 'image' | 'media' | 'font' | 'script' | 'texttrack' | 'xhr' | 'fetch' | 'prefetch' | 'eventsource' | 'websocket' | 'manifest' | 'signedexchange' | 'ping' | 'cspviolationreport' | 'preflight' | 'other';
10631
+ /** Options fields shared by all quick actions. */
10632
+ interface BrowserRunBaseOptions {
10633
+ /** Adds `<script>` tags into the page with the desired URL or content.
10634
+ * @see https://pptr.dev/api/puppeteer.frameaddscripttagoptions
10635
+ */
10636
+ addScriptTag?: Array<{
10637
+ content?: string;
10638
+ url?: string;
10639
+ type?: string;
10640
+ id?: string;
10641
+ }>;
10642
+ /** Adds `<link rel="stylesheet">` or `<style>` tags into the page.
10643
+ * @see https://pptr.dev/api/puppeteer.frameaddstyletagoptions
10644
+ */
10645
+ addStyleTag?: Array<{
10646
+ content?: string;
10647
+ url?: string;
10648
+ }>;
10649
+ /** Provide credentials for HTTP authentication. @see https://pptr.dev/api/puppeteer.credentials */
10650
+ authenticate?: {
10651
+ username: string;
10652
+ password: string;
10653
+ };
10654
+ /** Set cookies before navigating. @see https://pptr.dev/api/puppeteer.cookieparam */
10655
+ cookies?: Array<{
10656
+ name: string;
10657
+ value: string;
10658
+ url?: string;
10659
+ domain?: string;
10660
+ path?: string;
10661
+ secure?: boolean;
10662
+ httpOnly?: boolean;
10663
+ sameSite?: 'Strict' | 'Lax' | 'None';
10664
+ expires?: number;
10665
+ priority?: 'Low' | 'Medium' | 'High';
10666
+ sameParty?: boolean;
10667
+ sourceScheme?: 'Unset' | 'NonSecure' | 'Secure';
10668
+ sourcePort?: number;
10669
+ partitionKey?: string;
10670
+ }>;
10671
+ /** Emulate a specific CSS media type (e.g. `"screen"`, `"print"`). */
10672
+ emulateMediaType?: string;
10673
+ /** Navigation options. @see https://pptr.dev/api/puppeteer.gotooptions */
10674
+ gotoOptions?: {
10675
+ /** Navigation timeout in milliseconds (max 60 000). @default 30000 */
10676
+ timeout?: number;
10677
+ /** When to consider navigation complete. @default "domcontentloaded" */
10678
+ waitUntil?: BrowserRunLifecycleEvent | BrowserRunLifecycleEvent[];
10679
+ referer?: string;
10680
+ referrerPolicy?: string;
10681
+ };
10682
+ /** Block requests matching these regex patterns. Mutually exclusive with `allowRequestPattern`. */
10683
+ rejectRequestPattern?: string[];
10684
+ /** Only allow requests matching these regex patterns. Mutually exclusive with `rejectRequestPattern`. */
10685
+ allowRequestPattern?: string[];
10686
+ /** Block requests of these resource types. Mutually exclusive with `allowResourceTypes`. */
10687
+ rejectResourceTypes?: BrowserRunResourceType[];
10688
+ /** Only allow requests of these resource types. Mutually exclusive with `rejectResourceTypes`. */
10689
+ allowResourceTypes?: BrowserRunResourceType[];
10690
+ /** Additional HTTP headers sent with every request. */
10691
+ setExtraHTTPHeaders?: Record<string, string>;
10692
+ /** Whether JavaScript is enabled on the page. */
10693
+ setJavaScriptEnabled?: boolean;
10694
+ /** Override the default user agent string.
10695
+ * @default "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
10696
+ * */
10697
+ userAgent?: string;
10698
+ /** Set the browser viewport size.
10699
+ * @see https://pptr.dev/api/puppeteer.viewport
10700
+ * @default {width:1920,height:1080}
10701
+ * */
10702
+ viewport?: {
10703
+ width: number;
10704
+ height: number;
10705
+ deviceScaleFactor?: number;
10706
+ isMobile?: boolean;
10707
+ isLandscape?: boolean;
10708
+ hasTouch?: boolean;
10709
+ };
10710
+ /** Wait for a CSS selector to appear in the page before proceeding.
10711
+ * @see https://pptr.dev/api/puppeteer.waitforselectoroptions
10712
+ */
10713
+ waitForSelector?: {
10714
+ selector: string;
10715
+ hidden?: true;
10716
+ visible?: true;
10717
+ /** Timeout in milliseconds. Max 120000 */
10718
+ timeout?: number;
10719
+ };
10720
+ /** Wait for a fixed delay in milliseconds before proceeding. Max 120000 */
10721
+ waitForTimeout?: number;
10722
+ /** When true, continue on best-effort when awaited events fail or timeout. */
10723
+ bestAttempt?: boolean;
10724
+ /** Maximum duration in milliseconds for the browser action after page load. Max 120000 */
10725
+ actionTimeout?: number;
10726
+ /** Cache time to live in seconds (0-86400). Set to 0 to disable.
10727
+ * @default 5
10728
+ */
10729
+ cacheTTL?: number;
10730
+ }
10731
+ /** Common options shared by all quick actions. Exactly one of `url` or `html` must be provided.*/
10732
+ type BrowserRunCommonOptions = (BrowserRunBaseOptions & {
10733
+ /** URL to navigate to, e.g. `"https://example.com"`. */
10734
+ url: string;
10735
+ }) | (BrowserRunBaseOptions & {
10736
+ /** Set the HTML content of the page directly. */
10737
+ html: string;
10738
+ });
10739
+ type BrowserRunPuppeteerScreenshotOptions = {
10740
+ /** @default "png" */
10741
+ type?: 'png' | 'jpeg' | 'webp';
10742
+ /** @default "binary" */
10743
+ encoding?: 'binary' | 'base64';
10744
+ quality?: number;
10745
+ fullPage?: boolean;
10746
+ clip?: {
10747
+ x: number;
10748
+ y: number;
10749
+ width: number;
10750
+ height: number;
10751
+ scale?: number;
10752
+ };
10753
+ omitBackground?: boolean;
10754
+ optimizeForSpeed?: boolean;
10755
+ captureBeyondViewport?: boolean;
10756
+ fromSurface?: boolean;
10757
+ };
10758
+ type BrowserRunScreenshotOptions = BrowserRunCommonOptions & {
10759
+ /** CSS selector of the element to screenshot. */
10760
+ selector?: string;
10761
+ /** When true, scroll the entire page before taking the screenshot. */
10762
+ scrollPage?: boolean;
10763
+ /** @see https://pptr.dev/api/puppeteer.screenshotoptions */
10764
+ screenshotOptions?: BrowserRunPuppeteerScreenshotOptions;
10765
+ };
10766
+ type BrowserRunPDFOptions = BrowserRunCommonOptions & {
10767
+ /** @see https://pptr.dev/api/puppeteer.pdfoptions */
10768
+ pdfOptions?: {
10769
+ /** @default 1 */
10770
+ scale?: number;
10771
+ /** @default false */
10772
+ displayHeaderFooter?: boolean;
10773
+ headerTemplate?: string;
10774
+ footerTemplate?: string;
10775
+ /** @default false */
10776
+ printBackground?: boolean;
10777
+ /** @default false */
10778
+ landscape?: boolean;
10779
+ pageRanges?: string;
10780
+ /** @default "letter" */
10781
+ format?: 'letter' | 'legal' | 'tabloid' | 'ledger' | 'a0' | 'a1' | 'a2' | 'a3' | 'a4' | 'a5' | 'a6';
10782
+ width?: string | number;
10783
+ height?: string | number;
10784
+ /** @default false */
10785
+ preferCSSPageSize?: boolean;
10786
+ margin?: {
10787
+ top?: string | number;
10788
+ right?: string | number;
10789
+ bottom?: string | number;
10790
+ left?: string | number;
10791
+ };
10792
+ /** @default false */
10793
+ omitBackground?: boolean;
10794
+ /** @default true */
10795
+ tagged?: boolean;
10796
+ /** @default false */
10797
+ outline?: boolean;
10798
+ /** @default 30000 */
10799
+ timeout?: number;
10800
+ };
10801
+ };
10802
+ type BrowserRunScrapeOptions = BrowserRunCommonOptions & {
10803
+ /** CSS selectors to scrape. At least one element is required. */
10804
+ elements: Array<{
10805
+ selector: string;
10806
+ }>;
10807
+ };
10808
+ type BrowserRunLinksOptions = BrowserRunCommonOptions & {
10809
+ /** When true, only return links that are visible on the page. @default false */
10810
+ visibleLinksOnly?: boolean;
10811
+ /** When true, exclude links pointing to external domains. @default false */
10812
+ excludeExternalLinks?: boolean;
10813
+ };
10814
+ type BrowserRunSnapshotOptions = BrowserRunCommonOptions & {
10815
+ /** @see https://pptr.dev/api/puppeteer.screenshotoptions */
10816
+ screenshotOptions?: Omit<BrowserRunPuppeteerScreenshotOptions, 'encoding'>;
10817
+ };
10818
+ interface BrowserRunJsonBaseOptions {
10819
+ /** Custom AI models to try in order. Max 3. Falls back to next on error. */
10820
+ custom_ai?: Array<{
10821
+ /** Model ID in `<provider>/<model_name>` format, e.g. `"workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast"`. */
10822
+ model: string;
10823
+ /** Bearer token. Not needed for workers-ai models. */
10824
+ authorization?: string;
10825
+ }>;
10826
+ }
10827
+ /**
10828
+ * Options for the `json` quick action.
10829
+ * At least one of `prompt` or `response_format` must be provided.
10830
+ */
10831
+ type BrowserRunJsonOptions = BrowserRunCommonOptions & BrowserRunJsonBaseOptions & ({
10832
+ /** Natural-language prompt describing what data to extract. */
10833
+ prompt: string;
10834
+ /** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
10835
+ response_format?: AiTextGenerationResponseFormat;
10836
+ } | {
10837
+ /** Natural-language prompt describing what data to extract. */
10838
+ prompt?: string;
10839
+ /** Structured output schema for the AI model. @see https://developers.cloudflare.com/workers-ai/json-mode/ */
10840
+ response_format: AiTextGenerationResponseFormat;
10841
+ });
10842
+ type BrowserRunContentOptions = BrowserRunCommonOptions;
10843
+ type BrowserRunMarkdownOptions = BrowserRunCommonOptions;
10844
+ type BrowserRunResponseMeta = {
10845
+ /** HTTP status code of the rendered page */
10846
+ status: number;
10847
+ /** Page title */
10848
+ title: string;
10849
+ };
10850
+ /** Success response for `content` action. */
10851
+ type BrowserRunContentSuccessResponse = {
10852
+ success: true;
10853
+ /** Extracted HTML content */
10854
+ result: string;
10855
+ meta: BrowserRunResponseMeta;
10856
+ };
10857
+ /** Success response for `links` action. */
10858
+ type BrowserRunLinksSuccessResponse = {
10859
+ success: true;
10860
+ /** Extracted links */
10861
+ result: string[];
10862
+ };
10863
+ /** Success response for `scrape` action. */
10864
+ type BrowserRunScrapeSuccessResponse = {
10865
+ success: true;
10866
+ result: Array<{
10867
+ /** The CSS selector used to find elements. */
10868
+ selector: string;
10869
+ /** Array of elements matching the selector. */
10870
+ results: Array<{
10871
+ /** Outer HTML of the element. */
10872
+ html: string;
10873
+ /** Text content of the element. */
10874
+ text: string;
10875
+ /** Width of the element in pixels. */
10876
+ width: number;
10877
+ /** Height of the element in pixels. */
10878
+ height: number;
10879
+ /** Top position of the element relative to the viewport in pixels. */
10880
+ top: number;
10881
+ /** Left position of the element relative to the viewport in pixels. */
10882
+ left: number;
10883
+ /** Array of HTML attributes on the element. */
10884
+ attributes: Array<{
10885
+ /** Attribute name. */
10886
+ name: string;
10887
+ /** Attribute value. */
10888
+ value: string;
10889
+ }>;
10890
+ }>;
10891
+ }>;
10892
+ };
10893
+ /** Success response for `snapshot` action. */
10894
+ type BrowserRunSnapshotSuccessResponse = {
10895
+ success: true;
10896
+ result: {
10897
+ /** HTML content of the page. */
10898
+ content: string;
10899
+ /** Base64-encoded screenshot image. */
10900
+ screenshot: string;
10901
+ };
10902
+ meta: BrowserRunResponseMeta;
10903
+ };
10904
+ /** Success response for `json` action. */
10905
+ type BrowserRunJsonSuccessResponse = {
10906
+ success: true;
10907
+ /** JSON data extracted from the page using an AI model */
10908
+ result: Record<string, unknown>;
10909
+ };
10910
+ /** Success response for `markdown` action. */
10911
+ type BrowserRunMarkdownSuccessResponse = {
10912
+ success: true;
10913
+ /** Extracted markdown content */
10914
+ result: string;
10915
+ };
10916
+ /** Error response for BrowserRun actions. */
10917
+ type BrowserRunErrorResponse = {
10918
+ success: false;
10919
+ errors: {
10920
+ message: string;
10921
+ code?: number;
10922
+ detail?: string;
10923
+ path?: string;
10924
+ }[];
10925
+ };
10926
+ /** Error response for BrowserRun `json` action. */
10927
+ type BrowserRunJsonErrorResponse = BrowserRunErrorResponse & {
10928
+ /** Raw AI response text for debugging */
10929
+ rawAiResponse?: string;
10930
+ };
10931
+ /**
10932
+ * Browser Run API binding for automating headless browsers.
10933
+ * @see https://developers.cloudflare.com/browser-run/
10934
+ */
10935
+ declare abstract class BrowserRun {
10936
+ /**
10937
+ * Send a raw HTTP request to the Browser Run API.
10938
+ * Used by libraries like `@cloudflare/puppeteer` to acquire and connect to a browser instance.
10939
+ * @see https://developers.cloudflare.com/browser-run/
10940
+ */
10941
+ fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
10942
+ /**
10943
+ * Take a screenshot of a web page.
10944
+ * @param action - Must be `'screenshot'`.
10945
+ * @param options - Screenshot options including viewport, selectors, and image format.
10946
+ * @returns A `Response` containing one of:
10947
+ *
10948
+ * **Success (HTTP 200):**
10949
+ * - Binary image data with `Content-Type: image/png`, `image/jpeg`, or `image/webp` (when `encoding: 'binary'`, the default)
10950
+ * - Data URI string with `Content-Type: text/plain` (when `encoding: 'base64'`)
10951
+ *
10952
+ * **Error:**
10953
+ * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
10954
+ *
10955
+ * **Headers:**
10956
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
10957
+ */
10958
+ quickAction(action: 'screenshot', options: BrowserRunScreenshotOptions): Promise<Response>;
10959
+ /**
10960
+ * Generate a PDF of a web page.
10961
+ * @param action - Must be `'pdf'`.
10962
+ * @param options - PDF generation options including page size, margins, and headers/footers.
10963
+ * @returns A `Response` containing one of:
10964
+ *
10965
+ * **Success (HTTP 200):**
10966
+ * - Binary PDF data with `Content-Type: application/pdf`
10967
+ *
10968
+ * **Error:**
10969
+ * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
10970
+ *
10971
+ * **Headers:**
10972
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
10973
+ */
10974
+ quickAction(action: 'pdf', options: BrowserRunPDFOptions): Promise<Response>;
10975
+ /**
10976
+ * Get the HTML content of a web page.
10977
+ * @param action - Must be `'content'`.
10978
+ * @param options - Navigation and page interaction options.
10979
+ * @returns A `Response` containing one of:
10980
+ *
10981
+ * **Success (HTTP 200):**
10982
+ * - `BrowserRunContentSuccessResponse` JSON with `Content-Type: application/json`
10983
+ *
10984
+ * **Error:**
10985
+ * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
10986
+ *
10987
+ * **Headers:**
10988
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
10989
+ */
10990
+ quickAction(action: 'content', options: BrowserRunContentOptions): Promise<Response>;
10991
+ /**
10992
+ * Scrape elements from a web page by CSS selector.
10993
+ * @param action - Must be `'scrape'`.
10994
+ * @param options - Scrape options with CSS selectors for elements to extract.
10995
+ * @returns A `Response` containing one of:
10996
+ *
10997
+ * **Success (HTTP 200):**
10998
+ * - `BrowserRunScrapeSuccessResponse` JSON with `Content-Type: application/json`
10999
+ *
11000
+ * **Error:**
11001
+ * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
11002
+ *
11003
+ * **Headers:**
11004
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
11005
+ */
11006
+ quickAction(action: 'scrape', options: BrowserRunScrapeOptions): Promise<Response>;
11007
+ /**
11008
+ * Extract all links from a web page.
11009
+ * @param action - Must be `'links'`.
11010
+ * @param options - Options to filter visible or internal links only.
11011
+ * @returns A `Response` containing one of:
11012
+ *
11013
+ * **Success (HTTP 200):**
11014
+ * - `BrowserRunLinksSuccessResponse` JSON with `Content-Type: application/json`
11015
+ *
11016
+ * **Error:**
11017
+ * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
11018
+ *
11019
+ * **Headers:**
11020
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
11021
+ */
11022
+ quickAction(action: 'links', options: BrowserRunLinksOptions): Promise<Response>;
11023
+ /**
11024
+ * Get both the HTML content and a base64-encoded screenshot of a web page.
11025
+ * @param action - Must be `'snapshot'`.
11026
+ * @param options - Snapshot options including screenshot settings (encoding is always base64).
11027
+ * @returns A `Response` containing one of:
11028
+ *
11029
+ * **Success (HTTP 200):**
11030
+ * - `BrowserRunSnapshotSuccessResponse` JSON with `Content-Type: application/json`
11031
+ *
11032
+ * **Error:**
11033
+ * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
11034
+ *
11035
+ * **Headers:**
11036
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
11037
+ */
11038
+ quickAction(action: 'snapshot', options: BrowserRunSnapshotOptions): Promise<Response>;
11039
+ /**
11040
+ * Extract structured JSON data from a web page using AI.
11041
+ * @param action - Must be `'json'`.
11042
+ * @param options - JSON extraction options with prompt or response_format schema.
11043
+ * @returns A `Response` containing one of:
11044
+ *
11045
+ * **Success (HTTP 200):**
11046
+ * - `BrowserRunJsonSuccessResponse` JSON with `Content-Type: application/json`
11047
+ *
11048
+ * **Error:**
11049
+ * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
11050
+ * - HTTP 422 with code `2012` for HTML-to-markdown conversion failures
11051
+ * - HTTP 422/500 for AI extraction failures (may include `rawAiResponse` field)
11052
+ *
11053
+ * **Headers:**
11054
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
11055
+ */
11056
+ quickAction(action: 'json', options: BrowserRunJsonOptions): Promise<Response>;
11057
+ /**
11058
+ * Convert a web page to Markdown.
11059
+ * @param action - Must be `'markdown'`.
11060
+ * @param options - Navigation and page interaction options.
11061
+ * @returns A `Response` containing one of:
11062
+ *
11063
+ * **Success (HTTP 200):**
11064
+ * - `BrowserRunMarkdownSuccessResponse` JSON with `Content-Type: application/json`
11065
+ *
11066
+ * **Error:**
11067
+ * - `BrowserRunErrorResponse` JSON with appropriate HTTP status code (400, 422, 429, 500, 503)
11068
+ * - HTTP 422 with code `2012` for HTML-to-markdown conversion failures
11069
+ *
11070
+ * **Headers:**
11071
+ * - `X-Browser-Ms-Used`: Browser time consumed in milliseconds (set when status < 500)
11072
+ */
11073
+ quickAction(action: 'markdown', options: BrowserRunMarkdownOptions): Promise<Response>;
11074
+ }
10406
11075
  interface BasicImageTransformations {
10407
11076
  /**
10408
11077
  * Maximum width in image pixels. The value must be an integer.
@@ -10591,6 +11260,22 @@ interface RequestInitCfPropertiesImageDraw extends BasicImageTransformations {
10591
11260
  * (form a line).
10592
11261
  */
10593
11262
  repeat?: true | "x" | "y";
11263
+ /**
11264
+ * How to combine the foreground and backdrop pixels to create the result
11265
+ */
11266
+ composite?:
11267
+ /** Foreground drawn on top of backdrop (default) */
11268
+ 'over'
11269
+ /** Foreground shown only where backdrop is opaque */
11270
+ | 'in'
11271
+ /** Foreground drawn on top, but clipped to the backdrop's shape */
11272
+ | 'atop'
11273
+ /** Foreground shown only where backdrop is transparent */
11274
+ | 'out'
11275
+ /** Foreground and backdrop visible only where the other is not */
11276
+ | 'xor'
11277
+ /** Foreground and backdrop channels added (brightening) */
11278
+ | 'lighter';
10594
11279
  /**
10595
11280
  * Position of the overlay image relative to a given edge. Each property is
10596
11281
  * an offset in pixels. 0 aligns exactly to the edge. For example, left: 10
@@ -11128,6 +11813,32 @@ interface IncomingRequestCfPropertiesTLSClientAuth {
11128
11813
  * @example "Dec 22 19:39:00 2018 GMT"
11129
11814
  */
11130
11815
  certNotAfter: string;
11816
+ /**
11817
+ * The client leaf certificate in [RFC 9440](https://www.rfc-editor.org/rfc/rfc9440)
11818
+ * format (`:base64-DER:`). Empty if no client certificate was presented or if
11819
+ * the leaf certificate exceeded 10 KB (see {@link certRFC9440TooLarge}).
11820
+ *
11821
+ * Suitable for forwarding to an origin via the `Client-Cert` HTTP header.
11822
+ */
11823
+ certRFC9440: string;
11824
+ /**
11825
+ * `true` if the leaf certificate exceeded 10 KB and was omitted from
11826
+ * {@link certRFC9440}.
11827
+ */
11828
+ certRFC9440TooLarge: boolean;
11829
+ /**
11830
+ * The intermediate certificate chain in [RFC 9440](https://www.rfc-editor.org/rfc/rfc9440)
11831
+ * format as a comma-separated list. Empty if no intermediates were sent or
11832
+ * if the chain exceeded 16 KB (see {@link certChainRFC9440TooLarge}).
11833
+ *
11834
+ * Suitable for forwarding to an origin via the `Client-Cert-Chain` HTTP header.
11835
+ */
11836
+ certChainRFC9440: string;
11837
+ /**
11838
+ * `true` if the intermediate chain exceeded 16 KB and was omitted from
11839
+ * {@link certChainRFC9440}.
11840
+ */
11841
+ certChainRFC9440TooLarge: boolean;
11131
11842
  }
11132
11843
  /** Placeholder values for TLS Client Authorization */
11133
11844
  interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
@@ -11148,6 +11859,10 @@ interface IncomingRequestCfPropertiesTLSClientAuthPlaceholder {
11148
11859
  certFingerprintSHA256: "";
11149
11860
  certNotBefore: "";
11150
11861
  certNotAfter: "";
11862
+ certRFC9440: "";
11863
+ certRFC9440TooLarge: false;
11864
+ certChainRFC9440: "";
11865
+ certChainRFC9440TooLarge: false;
11151
11866
  }
11152
11867
  /** Possible outcomes of TLS verification */
11153
11868
  declare type CertVerificationStatus =
@@ -11602,11 +12317,25 @@ type ImageTransform = {
11602
12317
  type ImageDrawOptions = {
11603
12318
  opacity?: number;
11604
12319
  repeat?: boolean | string;
12320
+ composite?: ImageCompositeMode;
11605
12321
  top?: number;
11606
12322
  left?: number;
11607
12323
  bottom?: number;
11608
12324
  right?: number;
11609
12325
  };
12326
+ type ImageCompositeMode =
12327
+ /** Foreground drawn on top of backdrop (default) */
12328
+ 'over'
12329
+ /** Foreground shown only where backdrop is opaque */
12330
+ | 'in'
12331
+ /** Foreground drawn on top, but clipped to the backdrop's shape */
12332
+ | 'atop'
12333
+ /** Foreground shown only where backdrop is transparent */
12334
+ | 'out'
12335
+ /** Foreground and backdrop visible only where the other is not */
12336
+ | 'xor'
12337
+ /** Foreground and backdrop channels added (brightening) */
12338
+ | 'lighter';
11610
12339
  type ImageInputOptions = {
11611
12340
  encoding?: 'base64';
11612
12341
  };
@@ -12182,6 +12911,7 @@ declare namespace CloudflareWorkersModule {
12182
12911
  export type WorkflowTimeoutDuration = WorkflowSleepDuration;
12183
12912
  export type WorkflowRetentionDuration = WorkflowSleepDuration;
12184
12913
  export type WorkflowBackoff = 'constant' | 'linear' | 'exponential';
12914
+ export type WorkflowStepSensitivity = 'output';
12185
12915
  export type WorkflowStepConfig = {
12186
12916
  retries?: {
12187
12917
  limit: number;
@@ -12189,16 +12919,26 @@ declare namespace CloudflareWorkersModule {
12189
12919
  backoff?: WorkflowBackoff;
12190
12920
  };
12191
12921
  timeout?: WorkflowTimeoutDuration | number;
12922
+ sensitive?: WorkflowStepSensitivity;
12923
+ };
12924
+ export type WorkflowCronSchedule = {
12925
+ /** Cron expression that triggered this event. */
12926
+ cron: string;
12927
+ /** Timestamp of the scheduled trigger, in milliseconds since the Unix epoch. */
12928
+ scheduledTime: number;
12192
12929
  };
12193
12930
  export type WorkflowEvent<T> = {
12194
12931
  payload: Readonly<T>;
12195
12932
  timestamp: Date;
12196
12933
  instanceId: string;
12934
+ workflowName: string;
12935
+ schedule?: WorkflowCronSchedule;
12197
12936
  };
12198
12937
  export type WorkflowStepEvent<T> = {
12199
12938
  payload: Readonly<T>;
12200
12939
  timestamp: Date;
12201
12940
  type: string;
12941
+ sensitive?: WorkflowStepSensitivity;
12202
12942
  };
12203
12943
  export type WorkflowStepContext = {
12204
12944
  step: {