From 739323032bc4ae4520cb9408e362c47114ba5653 Mon Sep 17 00:00:00 2001 From: Alex Yang Date: Mon, 7 Apr 2025 00:50:16 -0700 Subject: [PATCH 1/4] feat: workflow-based llama-reader --- examples/readers/package.json | 1 + examples/readers/src/llamaparse-workflow.ts | 5 + packages/cloud/package.json | 16 ++ packages/cloud/src/reader-workflow.ts | 196 ++++++++++++++++++++ packages/cloud/src/schema.ts | 123 ++++++++++++ pnpm-lock.yaml | 42 +++++ 6 files changed, 383 insertions(+) create mode 100644 examples/readers/src/llamaparse-workflow.ts create mode 100644 packages/cloud/src/reader-workflow.ts create mode 100644 packages/cloud/src/schema.ts diff --git a/examples/readers/package.json b/examples/readers/package.json index 65269db2db..37c354dcaa 100644 --- a/examples/readers/package.json +++ b/examples/readers/package.json @@ -14,6 +14,7 @@ "start:assemblyai": "node --import tsx ./src/assemblyai.ts", "start:llamaparse-dir": "node --import tsx ./src/simple-directory-reader-with-llamaparse.ts", "start:llamaparse-json": "node --import tsx ./src/llamaparse-json.ts", + "start:llamaparse-workflow": "node --import tsx ./src/llamaparse-workflow.ts", "start:discord": "node --import tsx ./src/discord.ts", "start:json": "node --import tsx ./src/json.ts", "start:obsidian": "node --import tsx ./src/obsidian.ts" diff --git a/examples/readers/src/llamaparse-workflow.ts b/examples/readers/src/llamaparse-workflow.ts new file mode 100644 index 0000000000..b2548a1d60 --- /dev/null +++ b/examples/readers/src/llamaparse-workflow.ts @@ -0,0 +1,5 @@ +import { read } from "@llamaindex/cloud/reader-workflow"; + +read({ + input: "../data/basic.pdf", +}).then((md) => console.log("md", md)); diff --git a/packages/cloud/package.json b/packages/cloud/package.json index e1eb7b9e5c..ac6cec4665 100644 --- a/packages/cloud/package.json +++ b/packages/cloud/package.json @@ -47,6 +47,17 @@ "default": "./reader/dist/index.js" }, "default": "./reader/dist/index.js" + }, + "./reader-workflow": { + "require": { + "types": "./reader/dist/workflow.d.cts", + "default": "./reader/dist/workflow.cjs" + }, + "import": { + "types": "./reader/dist/workflow.d.ts", + "default": "./reader/dist/workflow.js" + }, + "default": "./reader/dist/workflow.js" } }, "repository": { @@ -64,5 +75,10 @@ "peerDependencies": { "@llamaindex/core": "workspace:*", "@llamaindex/env": "workspace:*" + }, + "dependencies": { + "fluere": "^0.3.3", + "stable-hash": "^0.0.5", + "zod": "^3.24.2" } } diff --git a/packages/cloud/src/reader-workflow.ts b/packages/cloud/src/reader-workflow.ts new file mode 100644 index 0000000000..ea4aa5db9e --- /dev/null +++ b/packages/cloud/src/reader-workflow.ts @@ -0,0 +1,196 @@ +import { createClient, createConfig } from "@hey-api/client-fetch"; +import { fs, getEnv, path } from "@llamaindex/env"; +import { + createWorkflow, + getContext, + type WorkflowEvent, + workflowEvent, + type WorkflowEventData, +} from "fluere"; +import { withStore } from "fluere/middleware/store"; +import { withTraceEvents } from "fluere/middleware/trace-events"; +import { collect } from "fluere/stream/consumer"; +import { until } from "fluere/stream/until"; +import { pRetryHandler } from "fluere/util/p-retry"; +import { zodEvent } from "fluere/util/zod"; +import hash from "stable-hash"; +import { z } from "zod"; +import { + type Body_upload_file_api_v1_parsing_upload_post, + getJobApiV1ParsingJobJobIdGet, + getJobResultApiV1ParsingJobJobIdResultMarkdownGet, + getJobTextResultApiV1ParsingJobJobIdResultTextGet, + type StatusEnum, + uploadFileApiV1ParsingUploadPost, +} from "./api"; +import { parseFormSchema } from "./schema"; + +type InferWorkflowEventData = + T extends WorkflowEventData + ? U + : T extends WorkflowEvent + ? U + : never; + +const startEvent = zodEvent( + z.object({ + input: z + .string() + .or(z.instanceof(File)) + .or(z.instanceof(Blob)) + .or(z.instanceof(Uint8Array)) + .describe("input"), + form: parseFormSchema.optional(), + }), +); + +const checkStatusEvent = workflowEvent(); +const checkStatusSuccessEvent = workflowEvent(); +const requestMarkdownEvent = workflowEvent(); +const requestTextEvent = workflowEvent(); +const markdownResultEvent = workflowEvent(); +const textResultEvent = workflowEvent(); + +export type LlamaParseWorkflowParams = { + region?: "us" | "eu" | "us-staging"; + apiKey?: string; +}; + +const URLS = { + us: "https://api.cloud.llamaindex.ai", + eu: "https://api.cloud.eu.llamaindex.ai", + "us-staging": "https://api.staging.llamaindex.ai", +} as const; + +const llamaParseWorkflow = withStore((params: LlamaParseWorkflowParams) => { + const apiKey = params.apiKey ?? getEnv("LLAMA_CLOUD_API_KEY"); + const region = params.region ?? "us"; + if (!apiKey) { + throw new Error("LLAMA_CLOUD_API_KEY is not set"); + } + return { + cache: {} as Record, + client: createClient( + createConfig({ + baseUrl: URLS[region], + headers: { + Authorization: `Bearer ${apiKey}`, + }, + }), + ), + }; +}, withTraceEvents(createWorkflow())); + +llamaParseWorkflow.handle([startEvent], async ({ data: { input, form } }) => { + const { sendEvent } = getContext(); + const store = llamaParseWorkflow.getStore(); + const isFilePath = typeof input === "string"; + const data = isFilePath ? await fs.readFile(input) : input; + const filename = isFilePath ? path.basename(input) : undefined; + const file: File | Blob = + globalThis.File && filename ? new File([data], filename) : new Blob([data]); + const { + data: { id, status }, + } = await uploadFileApiV1ParsingUploadPost({ + throwOnError: true, + body: { + ...form, + file, + } satisfies { + [Key in keyof Body_upload_file_api_v1_parsing_upload_post]: + | Body_upload_file_api_v1_parsing_upload_post[Key] + | undefined; + } as Body_upload_file_api_v1_parsing_upload_post, + client: store.client, + }); + store.cache[id] = status; + return checkStatusEvent.with(id); +}); + +llamaParseWorkflow.handle( + [checkStatusEvent], + pRetryHandler( + async ({ data: uuid }) => { + const store = llamaParseWorkflow.getStore(); + if (store.cache[uuid] === "SUCCESS") { + { + return checkStatusSuccessEvent.with(uuid); + } + } + const { + data: { status }, + } = await getJobApiV1ParsingJobJobIdGet({ + throwOnError: true, + path: { + job_id: uuid, + }, + client: store.client, + }); + store.cache[uuid] = status; + if (status === "SUCCESS") { + return checkStatusSuccessEvent.with(uuid); + } + throw new Error(`LLamaParse status: ${status}`); + }, + { + retries: 100, + }, + ), +); + +llamaParseWorkflow.handle([requestMarkdownEvent], async ({ data: job_id }) => { + const store = llamaParseWorkflow.getStore(); + const { data } = await getJobResultApiV1ParsingJobJobIdResultMarkdownGet({ + throwOnError: true, + path: { + job_id, + }, + client: store.client, + }); + return markdownResultEvent.with(data.markdown); +}); + +llamaParseWorkflow.handle([requestTextEvent], async ({ data: job_id }) => { + const store = llamaParseWorkflow.getStore(); + const { data } = await getJobTextResultApiV1ParsingJobJobIdResultTextGet({ + throwOnError: true, + path: { + job_id, + }, + client: store.client, + }); + return textResultEvent.with(data.text); +}); + +const cacheMap = new Map< + string, + ReturnType +>(); + +export const read = async ( + params: InferWorkflowEventData & LlamaParseWorkflowParams, +): Promise => { + const key = hash({ apiKey: params.apiKey, region: params.region }); + if (!cacheMap.has(key)) { + const context = llamaParseWorkflow.createContext(params); + cacheMap.set(key, context); + } + const { stream, sendEvent, createFilter } = cacheMap.get(key)!; + const ev = startEvent.with(params); + sendEvent(ev); + const ev1 = await collect( + until( + stream, + createFilter(ev, (ev) => checkStatusSuccessEvent.include(ev)), + ), + ); + const requestEv = requestMarkdownEvent.with(ev1.at(-1)!.data); + sendEvent(requestEv); + const ev2 = await collect( + until( + stream, + createFilter(requestEv, (ev) => markdownResultEvent.include(ev)), + ), + ); + return ev2.at(-1)!.data; +}; diff --git a/packages/cloud/src/schema.ts b/packages/cloud/src/schema.ts new file mode 100644 index 0000000000..920c548432 --- /dev/null +++ b/packages/cloud/src/schema.ts @@ -0,0 +1,123 @@ +import { ParserLanguages, ParsingMode } from "./api"; + +import { z } from "zod"; + +type Language = (typeof ParserLanguages)[keyof typeof ParserLanguages]; +const VALUES: [Language, ...Language[]] = [ + ParserLanguages.EN, + ...Object.values(ParserLanguages), +]; +const languageSchema = z.enum(VALUES); + +const PARSE_PRESETS = [ + "fast", + "balanced", + "premium", + "structured", + "auto", + "scientific", + "invoice", + "slides", + "_carlyle", +] as const; + +export const parsePresetSchema = z.enum(PARSE_PRESETS); + +export const parseFormSchema = z.object({ + adaptive_long_table: z.boolean().optional(), + annotate_links: z.boolean().optional(), + auto_mode: z.boolean().optional(), + auto_mode_trigger_on_image_in_page: z.boolean().optional(), + auto_mode_trigger_on_table_in_page: z.boolean().optional(), + auto_mode_trigger_on_text_in_page: z.string().optional(), + auto_mode_trigger_on_regexp_in_page: z.string().optional(), + azure_openai_api_version: z.string().optional(), + azure_openai_deployment_name: z.string().optional(), + azure_openai_endpoint: z.string().optional(), + azure_openai_key: z.string().optional(), + bbox_bottom: z.number().min(0).max(1).optional(), + bbox_left: z.number().min(0).max(1).optional(), + bbox_right: z.number().min(0).max(1).optional(), + bbox_top: z.number().min(0).max(1).optional(), + disable_ocr: z.boolean().optional(), + disable_reconstruction: z.boolean().optional(), + disable_image_extraction: z.boolean().optional(), + do_not_cache: z.coerce.boolean().optional(), + do_not_unroll_columns: z.coerce.boolean().optional(), + extract_charts: z.boolean().optional(), + guess_xlsx_sheet_name: z.boolean().optional(), + html_make_all_elements_visible: z.boolean().optional(), + html_remove_fixed_elements: z.boolean().optional(), + html_remove_navigation_elements: z.boolean().optional(), + http_proxy: z + .string() + .url( + 'Set a valid URL for the HTTP proxy, e.g., "http://proxy.example.com:8080"', + ) + .refine( + (url) => { + try { + const parsedUrl = new URL(url); + return ( + parsedUrl.protocol === "http:" || parsedUrl.protocol === "https:" + ); + } catch { + return false; + } + }, + { + message: "Invalid HTTP proxy URL", + }, + ) + .optional(), + input_s3_path: z.string().optional(), + input_s3_region: z.string().optional(), + input_url: z.string().optional(), + invalidate_cache: z.boolean().optional(), + language: z.array(languageSchema).optional(), + extract_layout: z.boolean().optional(), + max_pages: z.number().nullable().optional(), + output_pdf_of_document: z.boolean().optional(), + output_s3_path_prefix: z.string().optional(), + output_s3_region: z.string().optional(), + page_prefix: z.string().optional(), + page_separator: z.string().optional(), + page_suffix: z.string().optional(), + preserve_layout_alignment_across_pages: z.boolean().optional(), + skip_diagonal_text: z.boolean().optional(), + spreadsheet_extract_sub_tables: z.boolean().optional(), + structured_output: z.boolean().optional(), + structured_output_json_schema: z.string().optional(), + structured_output_json_schema_name: z.string().optional(), + take_screenshot: z.boolean().optional(), + target_pages: z.string().optional(), + vendor_multimodal_api_key: z.string().optional(), + vendor_multimodal_model_name: z.string().optional(), + model: z.string().optional(), + webhook_url: z.string().url().optional(), + parse_mode: z.nativeEnum(ParsingMode).nullable().optional(), + system_prompt: z.string().optional(), + system_prompt_append: z.string().optional(), + user_prompt: z.string().optional(), + job_timeout_in_seconds: z.number().optional(), + job_timeout_extra_time_per_page_in_seconds: z.number().optional(), + strict_mode_image_extraction: z.boolean().optional(), + strict_mode_image_ocr: z.boolean().optional(), + strict_mode_reconstruction: z.boolean().optional(), + strict_mode_buggy_font: z.boolean().optional(), + ignore_document_elements_for_layout_detection: z.boolean().optional(), + output_tables_as_HTML: z.boolean().optional(), + use_vendor_multimodal_model: z.boolean().optional(), + bounding_box: z.string().optional(), + gpt4o_mode: z.boolean().optional(), + gpt4o_api_key: z.string().optional(), + complemental_formatting_instruction: z.string().optional(), + content_guideline_instruction: z.string().optional(), + premium_mode: z.boolean().optional(), + is_formatting_instruction: z.boolean().optional(), + continuous_mode: z.boolean().optional(), + parsing_instruction: z.string().optional(), + fast_mode: z.boolean().optional(), + formatting_instruction: z.string().optional(), + preset: parsePresetSchema.optional(), +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7b358527d9..3d07a32de9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -863,6 +863,16 @@ importers: version: 4.19.3 packages/cloud: + dependencies: + fluere: + specifier: ^0.3.3 + version: 0.3.3(@modelcontextprotocol/sdk@1.8.0)(next@15.2.4(@opentelemetry/api@1.9.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(p-retry@6.2.1)(zod@3.24.2) + stable-hash: + specifier: ^0.0.5 + version: 0.0.5 + zod: + specifier: ^3.24.2 + version: 3.24.2 devDependencies: '@hey-api/client-fetch': specifier: ^0.6.0 @@ -8023,6 +8033,26 @@ packages: flatted@3.3.2: resolution: {integrity: sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==} + fluere@0.3.3: + resolution: {integrity: sha512-KCjG7PrAKDvCs/CfMdHceMcYJiuLizMitqmuLVE1+tiZUtXihk2lswKOQqbxCi+g1tFpFKm98Mxye6WvP7cnTg==} + peerDependencies: + '@modelcontextprotocol/sdk': ^1.7.0 + hono: ^4.7.4 + next: ^15.2.2 + p-retry: ^6.2.1 + zod: ^3.24.2 + peerDependenciesMeta: + '@modelcontextprotocol/sdk': + optional: true + hono: + optional: true + next: + optional: true + p-retry: + optional: true + zod: + optional: true + fn.name@1.1.0: resolution: {integrity: sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==} @@ -11742,6 +11772,9 @@ packages: stable-hash@0.0.4: resolution: {integrity: sha512-LjdcbuBeLcdETCrPn9i8AYAZ1eCtu4ECAWtP7UleOiZ9LzVxRzzUZEoZ8zB24nhkQnDWyET0I+3sWokSDS3E7g==} + stable-hash@0.0.5: + resolution: {integrity: sha512-+L3ccpzibovGXFK+Ap/f8LOS0ahMrHTf3xu7mMLSpEGU0EO9ucaysSylKo9eRDFNhWve/y275iPmIZ4z39a9iA==} + stack-trace@0.0.10: resolution: {integrity: sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==} @@ -20588,6 +20621,13 @@ snapshots: flatted@3.3.2: {} + fluere@0.3.3(@modelcontextprotocol/sdk@1.8.0)(next@15.2.4(@opentelemetry/api@1.9.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(p-retry@6.2.1)(zod@3.24.2): + optionalDependencies: + '@modelcontextprotocol/sdk': 1.8.0 + next: 15.2.4(@opentelemetry/api@1.9.0)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + p-retry: 6.2.1 + zod: 3.24.2 + fn.name@1.1.0: {} focus-trap@7.6.4: @@ -25471,6 +25511,8 @@ snapshots: stable-hash@0.0.4: {} + stable-hash@0.0.5: {} + stack-trace@0.0.10: {} stackback@0.0.2: {} From cd07b034bf8dda1518b462ffb09b7adacbba7aeb Mon Sep 17 00:00:00 2001 From: Alex Yang Date: Tue, 8 Apr 2025 12:28:30 -0700 Subject: [PATCH 2/4] feat: workflow-based llama-reader --- examples/readers/src/llamaparse-workflow.ts | 29 ++- packages/cloud/package.json | 1 + packages/cloud/src/reader-workflow.ts | 144 ++++++++++--- packages/cloud/tsconfig.json | 2 +- pnpm-lock.yaml | 226 ++++++++++---------- 5 files changed, 250 insertions(+), 152 deletions(-) diff --git a/examples/readers/src/llamaparse-workflow.ts b/examples/readers/src/llamaparse-workflow.ts index b2548a1d60..56339d5a6e 100644 --- a/examples/readers/src/llamaparse-workflow.ts +++ b/examples/readers/src/llamaparse-workflow.ts @@ -1,5 +1,26 @@ -import { read } from "@llamaindex/cloud/reader-workflow"; +import { uploadFile } from "@llamaindex/cloud/reader-workflow"; -read({ - input: "../data/basic.pdf", -}).then((md) => console.log("md", md)); +async function main() { + const job = await uploadFile({ + file: "../data/basic.pdf", + }); + console.log("job id", job.jobId); + + job.signal.addEventListener("abort", () => { + console.error("ERROR:", job.signal.reason); + }); + + const markdown = await job.markdown(); + console.log("--markdown--"); + console.log(markdown); + + const text = await job.text(); + console.log("--text--"); + console.log(text); + + const json = await job.json(); + console.log("--json--"); + console.log(json); +} + +main(); diff --git a/packages/cloud/package.json b/packages/cloud/package.json index ac6cec4665..f8907501e4 100644 --- a/packages/cloud/package.json +++ b/packages/cloud/package.json @@ -70,6 +70,7 @@ "@hey-api/openapi-ts": "^0.61.0", "@llamaindex/core": "workspace:*", "@llamaindex/env": "workspace:*", + "@types/node": "^22.14.0", "bunchee": "6.4.0" }, "peerDependencies": { diff --git a/packages/cloud/src/reader-workflow.ts b/packages/cloud/src/reader-workflow.ts index ea4aa5db9e..f5c15117cf 100644 --- a/packages/cloud/src/reader-workflow.ts +++ b/packages/cloud/src/reader-workflow.ts @@ -2,7 +2,6 @@ import { createClient, createConfig } from "@hey-api/client-fetch"; import { fs, getEnv, path } from "@llamaindex/env"; import { createWorkflow, - getContext, type WorkflowEvent, workflowEvent, type WorkflowEventData, @@ -18,6 +17,7 @@ import { z } from "zod"; import { type Body_upload_file_api_v1_parsing_upload_post, getJobApiV1ParsingJobJobIdGet, + getJobJsonResultApiV1ParsingJobJobIdResultJsonGet, getJobResultApiV1ParsingJobJobIdResultMarkdownGet, getJobTextResultApiV1ParsingJobJobIdResultTextGet, type StatusEnum, @@ -33,23 +33,30 @@ type InferWorkflowEventData = : never; const startEvent = zodEvent( - z.object({ - input: z - .string() - .or(z.instanceof(File)) - .or(z.instanceof(Blob)) - .or(z.instanceof(Uint8Array)) - .describe("input"), - form: parseFormSchema.optional(), - }), + parseFormSchema + .merge( + z.object({ + file: z + .string() + .or(z.instanceof(File)) + .or(z.instanceof(Blob)) + .or(z.instanceof(Uint8Array)) + .optional() + .describe("input"), + }), + ) + .optional(), ); const checkStatusEvent = workflowEvent(); const checkStatusSuccessEvent = workflowEvent(); const requestMarkdownEvent = workflowEvent(); const requestTextEvent = workflowEvent(); +const requestJsonEvent = workflowEvent(); + const markdownResultEvent = workflowEvent(); const textResultEvent = workflowEvent(); +const jsonResultEvent = workflowEvent(); export type LlamaParseWorkflowParams = { region?: "us" | "eu" | "us-staging"; @@ -81,21 +88,25 @@ const llamaParseWorkflow = withStore((params: LlamaParseWorkflowParams) => { }; }, withTraceEvents(createWorkflow())); -llamaParseWorkflow.handle([startEvent], async ({ data: { input, form } }) => { - const { sendEvent } = getContext(); +llamaParseWorkflow.handle([startEvent], async ({ data: form }) => { const store = llamaParseWorkflow.getStore(); - const isFilePath = typeof input === "string"; - const data = isFilePath ? await fs.readFile(input) : input; - const filename = isFilePath ? path.basename(input) : undefined; - const file: File | Blob = - globalThis.File && filename ? new File([data], filename) : new Blob([data]); + const file = form?.file; + const isFilePath = typeof file === "string"; + const data = isFilePath ? await fs.readFile(file) : file; + const filename: string | undefined = isFilePath + ? path.basename(file) + : undefined; const { data: { id, status }, } = await uploadFileApiV1ParsingUploadPost({ throwOnError: true, body: { ...form, - file, + file: data + ? globalThis.File && filename + ? new File([data], filename) + : new Blob([data]) + : undefined, } satisfies { [Key in keyof Body_upload_file_api_v1_parsing_upload_post]: | Body_upload_file_api_v1_parsing_upload_post[Key] @@ -162,35 +173,106 @@ llamaParseWorkflow.handle([requestTextEvent], async ({ data: job_id }) => { return textResultEvent.with(data.text); }); +llamaParseWorkflow.handle([requestJsonEvent], async ({ data: job_id }) => { + const store = llamaParseWorkflow.getStore(); + const { data } = await getJobJsonResultApiV1ParsingJobJobIdResultJsonGet({ + throwOnError: true, + path: { + job_id, + }, + client: store.client, + }); + return jsonResultEvent.with(data.pages); +}); + const cacheMap = new Map< string, ReturnType >(); -export const read = async ( +type Job = { + get jobId(): string; + get signal(): AbortSignal; + get context(): ReturnType; + get form(): InferWorkflowEventData; + + markdown(): Promise; + text(): Promise; + //eslint-disable-next-line @typescript-eslint/no-explicit-any + json(): Promise; +}; + +export const uploadFile = async ( params: InferWorkflowEventData & LlamaParseWorkflowParams, -): Promise => { +): Promise => { + //#region cache const key = hash({ apiKey: params.apiKey, region: params.region }); if (!cacheMap.has(key)) { const context = llamaParseWorkflow.createContext(params); cacheMap.set(key, context); } - const { stream, sendEvent, createFilter } = cacheMap.get(key)!; + //#endregion + + //#region upload event + const context = cacheMap.get(key)!; + const { stream, sendEvent, createFilter } = context; const ev = startEvent.with(params); sendEvent(ev); - const ev1 = await collect( + const uploadThread = await collect( until( stream, createFilter(ev, (ev) => checkStatusSuccessEvent.include(ev)), ), ); - const requestEv = requestMarkdownEvent.with(ev1.at(-1)!.data); - sendEvent(requestEv); - const ev2 = await collect( - until( - stream, - createFilter(requestEv, (ev) => markdownResultEvent.include(ev)), - ), - ); - return ev2.at(-1)!.data; + //#region + const jobId: string = uploadThread.at(-1)!.data; + return { + get signal() { + // lazy load + return context.signal; + }, + get jobId() { + return jobId; + }, + get form() { + return ev.data; + }, + get context() { + return context; + }, + async markdown(): Promise { + const requestEv = requestMarkdownEvent.with(jobId); + sendEvent(requestEv); + const markdownThread = await collect( + until( + stream, + createFilter(requestEv, (ev) => markdownResultEvent.include(ev)), + ), + ); + return markdownThread.at(-1)!.data; + }, + async text(): Promise { + const requestEv = requestTextEvent.with(jobId); + sendEvent(requestEv); + const textThread = await collect( + until( + stream, + createFilter(requestEv, (ev) => textResultEvent.include(ev)), + ), + ); + return textThread.at(-1)!.data; + }, + //eslint-disable-next-line @typescript-eslint/no-explicit-any + async json(): Promise { + const requestEv = requestJsonEvent.with(jobId); + sendEvent(requestEv); + const jsonThread = await collect( + until( + stream, + createFilter(requestEv, (ev) => jsonResultEvent.include(ev)), + ), + ); + return jsonThread.at(-1)!.data; + }, + }; }; diff --git a/packages/cloud/tsconfig.json b/packages/cloud/tsconfig.json index 54abb51161..3d942889e8 100644 --- a/packages/cloud/tsconfig.json +++ b/packages/cloud/tsconfig.json @@ -8,7 +8,7 @@ "moduleResolution": "Bundler", "skipLibCheck": true, "strict": true, - "types": [] + "types": ["node"] }, "include": ["./src"], "exclude": ["node_modules"], diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3d07a32de9..e18c02d318 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -62,7 +62,7 @@ importers: version: 8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3) vitest: specifier: ^3.1.1 - version: 3.1.1(@edge-runtime/vm@4.0.4)(@types/debug@4.1.12)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2) + version: 3.1.1(@edge-runtime/vm@4.0.4)(@types/debug@4.1.12)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2) apps/next: dependencies: @@ -380,7 +380,7 @@ importers: devDependencies: '@cloudflare/vitest-pool-workers': specifier: ^0.5.28 - version: 0.5.41(@cloudflare/workers-types@4.20250204.0)(@vitest/runner@2.1.5)(@vitest/snapshot@2.1.5)(bufferutil@4.0.9)(vitest@2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2)) + version: 0.5.41(@cloudflare/workers-types@4.20250204.0)(@vitest/runner@2.1.5)(@vitest/snapshot@2.1.5)(bufferutil@4.0.9)(vitest@2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2)) '@cloudflare/workers-types': specifier: ^4.20241112.0 version: 4.20250204.0 @@ -395,7 +395,7 @@ importers: version: 5.7.3 vitest: specifier: 2.1.5 - version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2) + version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2) wrangler: specifier: ^3.87.0 version: 3.108.1(@cloudflare/workers-types@4.20250204.0)(bufferutil@4.0.9) @@ -411,10 +411,10 @@ importers: version: 5.7.3 vite: specifier: ^5.4.16 - version: 5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) + version: 5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) vite-plugin-wasm: specifier: ^3.3.0 - version: 3.4.1(vite@5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2)) + version: 3.4.1(vite@5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2)) e2e/examples/nextjs-agent: dependencies: @@ -538,7 +538,7 @@ importers: version: 5.7.3 vite: specifier: ^5.4.16 - version: 5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) + version: 5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) e2e/examples/waku-query-engine: dependencies: @@ -559,7 +559,7 @@ importers: version: 19.0.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(webpack@5.97.1) waku: specifier: 0.21.20 - version: 0.21.20(@swc/helpers@0.5.15)(@types/node@22.13.5)(jiti@2.4.2)(lightningcss@1.29.1)(react-dom@19.0.0(react@19.0.0))(react-server-dom-webpack@19.0.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(webpack@5.97.1))(react@19.0.0)(terser@5.38.2)(tsx@4.19.3)(yaml@2.7.0) + version: 0.21.20(@swc/helpers@0.5.15)(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.29.1)(react-dom@19.0.0(react@19.0.0))(react-server-dom-webpack@19.0.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(webpack@5.97.1))(react@19.0.0)(terser@5.38.2)(tsx@4.19.3)(yaml@2.7.0) devDependencies: '@types/react': specifier: 19.0.10 @@ -886,6 +886,9 @@ importers: '@llamaindex/env': specifier: workspace:* version: link:../env + '@types/node': + specifier: ^22.14.0 + version: 22.14.0 bunchee: specifier: 6.4.0 version: 6.4.0(typescript@5.7.3) @@ -953,7 +956,7 @@ importers: version: link:.. vitest: specifier: ^2.1.5 - version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2) + version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2) packages/env: dependencies: @@ -1076,7 +1079,7 @@ importers: version: link:.. vitest: specifier: ^2.1.5 - version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2) + version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2) packages/node-parser: dependencies: @@ -1126,7 +1129,7 @@ importers: version: 6.4.0(typescript@5.7.3) vitest: specifier: ^2.1.5 - version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2) + version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2) packages/providers/clip: dependencies: @@ -1298,7 +1301,7 @@ importers: version: 6.4.0(typescript@5.7.3) vitest: specifier: ^2.1.5 - version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2) + version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2) packages/providers/mixedbread: dependencies: @@ -1503,7 +1506,7 @@ importers: version: 6.4.0(typescript@5.7.3) vitest: specifier: ^3.0.9 - version: 3.0.9(@edge-runtime/vm@4.0.4)(@types/debug@4.1.12)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2) + version: 3.0.9(@edge-runtime/vm@4.0.4)(@types/debug@4.1.12)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2) packages/providers/storage/firestore: dependencies: @@ -1544,7 +1547,7 @@ importers: version: 6.4.0(typescript@5.7.3) vitest: specifier: ^2.1.5 - version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2) + version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2) packages/providers/storage/mongodb: dependencies: @@ -1566,7 +1569,7 @@ importers: version: 10.1.4(@aws-sdk/credential-providers@3.744.0)(socks@2.8.4) vitest: specifier: 2.1.0 - version: 2.1.0(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2) + version: 2.1.0(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2) packages/providers/storage/pinecone: dependencies: @@ -1635,7 +1638,7 @@ importers: version: 6.4.0(typescript@5.7.3) vitest: specifier: ^2.1.5 - version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2) + version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2) packages/providers/storage/supabase: dependencies: @@ -1657,7 +1660,7 @@ importers: version: 6.4.0(typescript@5.7.3) vitest: specifier: 2.1.0 - version: 2.1.0(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2) + version: 2.1.0(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2) packages/providers/storage/upstash: dependencies: @@ -1721,7 +1724,7 @@ importers: version: 6.4.0(typescript@5.7.3) vitest: specifier: ^2.1.5 - version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2) + version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2) packages/providers/vllm: dependencies: @@ -2059,10 +2062,10 @@ importers: version: 19.0.4(@types/react@19.0.10) msw: specifier: ^2.6.5 - version: 2.7.0(@types/node@22.13.5)(typescript@5.7.3) + version: 2.7.0(@types/node@22.14.0)(typescript@5.7.3) vitest: specifier: ^2.1.5 - version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2) + version: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2) packages: @@ -5802,17 +5805,14 @@ packages: '@types/node@12.20.55': resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} - '@types/node@18.19.75': - resolution: {integrity: sha512-UIksWtThob6ZVSyxcOqCLOUNg/dyO1Qvx4McgeuhrEtHTLFTf7BBhEazaE4K806FGTPtzd/2sE90qn4fVr7cyw==} - '@types/node@18.19.76': resolution: {integrity: sha512-yvR7Q9LdPz2vGpmpJX5LolrgRdWvB67MJKDPSgIIzpFbaf9a1j/f5DnLp5VDyHGMR0QZHlTr1afsD87QCXFHKw==} '@types/node@20.17.25': resolution: {integrity: sha512-bT+r2haIlplJUYtlZrEanFHdPIZTeiMeh/fSOEbOOfWf9uTn+lg8g0KU6Q3iMgjd9FLuuMAgfCNSkjUbxL6E3Q==} - '@types/node@22.13.5': - resolution: {integrity: sha512-+lTU0PxZXn0Dr1NBtC7Y8cR21AJr87dLLU953CWA6pMxxv/UDc7jYAY90upcrie1nRcD6XNG5HOYEDtgW5TxAg==} + '@types/node@22.14.0': + resolution: {integrity: sha512-Kmpl+z84ILoG+3T/zQFyAJsU6EPTmOCj8/2+83fSN6djd6I4o7uOuGIH6vq3PrjY5BGitSbFuMN18j3iknubbA==} '@types/node@22.9.0': resolution: {integrity: sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==} @@ -12412,8 +12412,8 @@ packages: undici-types@6.19.8: resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} - undici-types@6.20.0: - resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} + undici-types@6.21.0: + resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} undici@5.28.5: resolution: {integrity: sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==} @@ -14298,7 +14298,7 @@ snapshots: dependencies: mime: 3.0.0 - '@cloudflare/vitest-pool-workers@0.5.41(@cloudflare/workers-types@4.20250204.0)(@vitest/runner@2.1.5)(@vitest/snapshot@2.1.5)(bufferutil@4.0.9)(vitest@2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2))': + '@cloudflare/vitest-pool-workers@0.5.41(@cloudflare/workers-types@4.20250204.0)(@vitest/runner@2.1.5)(@vitest/snapshot@2.1.5)(bufferutil@4.0.9)(vitest@2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2))': dependencies: '@vitest/runner': 2.1.5 '@vitest/snapshot': 2.1.5 @@ -14308,7 +14308,7 @@ snapshots: esbuild: 0.17.19 miniflare: 3.20241230.0(bufferutil@4.0.9) semver: 7.7.1 - vitest: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2) + vitest: 2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2) wrangler: 3.100.0(@cloudflare/workers-types@4.20250204.0)(bufferutil@4.0.9) zod: 3.24.2 transitivePeerDependencies: @@ -15183,12 +15183,12 @@ snapshots: '@img/sharp-win32-x64@0.33.5': optional: true - '@inquirer/confirm@5.1.5(@types/node@22.13.5)': + '@inquirer/confirm@5.1.5(@types/node@22.14.0)': dependencies: - '@inquirer/core': 10.1.6(@types/node@22.13.5) - '@inquirer/type': 3.0.4(@types/node@22.13.5) + '@inquirer/core': 10.1.6(@types/node@22.14.0) + '@inquirer/type': 3.0.4(@types/node@22.14.0) optionalDependencies: - '@types/node': 22.13.5 + '@types/node': 22.14.0 '@inquirer/confirm@5.1.5(@types/node@22.9.0)': dependencies: @@ -15198,10 +15198,10 @@ snapshots: '@types/node': 22.9.0 optional: true - '@inquirer/core@10.1.6(@types/node@22.13.5)': + '@inquirer/core@10.1.6(@types/node@22.14.0)': dependencies: '@inquirer/figures': 1.0.10 - '@inquirer/type': 3.0.4(@types/node@22.13.5) + '@inquirer/type': 3.0.4(@types/node@22.14.0) ansi-escapes: 4.3.2 cli-width: 4.1.0 mute-stream: 2.0.0 @@ -15209,7 +15209,7 @@ snapshots: wrap-ansi: 6.2.0 yoctocolors-cjs: 2.1.2 optionalDependencies: - '@types/node': 22.13.5 + '@types/node': 22.14.0 '@inquirer/core@10.1.6(@types/node@22.9.0)': dependencies: @@ -15227,9 +15227,9 @@ snapshots: '@inquirer/figures@1.0.10': {} - '@inquirer/type@3.0.4(@types/node@22.13.5)': + '@inquirer/type@3.0.4(@types/node@22.14.0)': optionalDependencies: - '@types/node': 22.13.5 + '@types/node': 22.14.0 '@inquirer/type@3.0.4(@types/node@22.9.0)': optionalDependencies: @@ -17646,10 +17646,6 @@ snapshots: '@types/node@12.20.55': {} - '@types/node@18.19.75': - dependencies: - undici-types: 5.26.5 - '@types/node@18.19.76': dependencies: undici-types: 5.26.5 @@ -17658,10 +17654,9 @@ snapshots: dependencies: undici-types: 6.19.8 - '@types/node@22.13.5': + '@types/node@22.14.0': dependencies: - undici-types: 6.20.0 - optional: true + undici-types: 6.21.0 '@types/node@22.9.0': dependencies: @@ -17740,10 +17735,10 @@ snapshots: '@types/node': 22.9.0 optional: true - '@typescript-eslint/eslint-plugin@8.24.0(@typescript-eslint/parser@8.24.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3))(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3)': + '@typescript-eslint/eslint-plugin@8.24.0(@typescript-eslint/parser@8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3))(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3)': dependencies: '@eslint-community/regexpp': 4.12.1 - '@typescript-eslint/parser': 8.24.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3) + '@typescript-eslint/parser': 8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3) '@typescript-eslint/scope-manager': 8.24.0 '@typescript-eslint/type-utils': 8.24.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3) '@typescript-eslint/utils': 8.24.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3) @@ -17896,14 +17891,14 @@ snapshots: transitivePeerDependencies: - utf-8-validate - '@vitejs/plugin-react@4.3.4(vite@6.1.0(@types/node@22.13.5)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.38.2)(tsx@4.19.3)(yaml@2.7.0))': + '@vitejs/plugin-react@4.3.4(vite@6.1.0(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.38.2)(tsx@4.19.3)(yaml@2.7.0))': dependencies: '@babel/core': 7.26.8 '@babel/plugin-transform-react-jsx-self': 7.25.9(@babel/core@7.26.8) '@babel/plugin-transform-react-jsx-source': 7.25.9(@babel/core@7.26.8) '@types/babel__core': 7.20.5 react-refresh: 0.14.2 - vite: 6.1.0(@types/node@22.13.5)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.38.2)(tsx@4.19.3)(yaml@2.7.0) + vite: 6.1.0(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.38.2)(tsx@4.19.3)(yaml@2.7.0) transitivePeerDependencies: - supports-color @@ -17935,23 +17930,23 @@ snapshots: chai: 5.2.0 tinyrainbow: 2.0.0 - '@vitest/mocker@2.1.0(@vitest/spy@2.1.0)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(vite@5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2))': + '@vitest/mocker@2.1.0(@vitest/spy@2.1.0)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(vite@5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2))': dependencies: '@vitest/spy': 2.1.0 estree-walker: 3.0.3 magic-string: 0.30.17 optionalDependencies: - msw: 2.7.0(@types/node@22.13.5)(typescript@5.7.3) - vite: 5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) + msw: 2.7.0(@types/node@22.14.0)(typescript@5.7.3) + vite: 5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) - '@vitest/mocker@2.1.5(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(vite@5.4.14(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2))': + '@vitest/mocker@2.1.5(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(vite@5.4.14(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2))': dependencies: '@vitest/spy': 2.1.5 estree-walker: 3.0.3 magic-string: 0.30.17 optionalDependencies: - msw: 2.7.0(@types/node@22.13.5)(typescript@5.7.3) - vite: 5.4.14(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) + msw: 2.7.0(@types/node@22.14.0)(typescript@5.7.3) + vite: 5.4.14(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) '@vitest/mocker@2.1.5(msw@2.7.0(@types/node@22.9.0)(typescript@5.7.3))(vite@5.4.14(@types/node@22.9.0)(lightningcss@1.29.1)(terser@5.38.2))': dependencies: @@ -17962,23 +17957,23 @@ snapshots: msw: 2.7.0(@types/node@22.9.0)(typescript@5.7.3) vite: 5.4.14(@types/node@22.9.0)(lightningcss@1.29.1)(terser@5.38.2) - '@vitest/mocker@3.0.9(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(vite@5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2))': + '@vitest/mocker@3.0.9(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(vite@5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2))': dependencies: '@vitest/spy': 3.0.9 estree-walker: 3.0.3 magic-string: 0.30.17 optionalDependencies: - msw: 2.7.0(@types/node@22.13.5)(typescript@5.7.3) - vite: 5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) + msw: 2.7.0(@types/node@22.14.0)(typescript@5.7.3) + vite: 5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) - '@vitest/mocker@3.1.1(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(vite@5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2))': + '@vitest/mocker@3.1.1(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(vite@5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2))': dependencies: '@vitest/spy': 3.1.1 estree-walker: 3.0.3 magic-string: 0.30.17 optionalDependencies: - msw: 2.7.0(@types/node@22.13.5)(typescript@5.7.3) - vite: 5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) + msw: 2.7.0(@types/node@22.14.0)(typescript@5.7.3) + vite: 5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) '@vitest/pretty-format@2.1.0': dependencies: @@ -19884,12 +19879,12 @@ snapshots: dependencies: '@next/eslint-plugin-next': 15.1.0 '@rushstack/eslint-patch': 1.10.5 - '@typescript-eslint/eslint-plugin': 8.24.0(@typescript-eslint/parser@8.24.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3))(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3) + '@typescript-eslint/eslint-plugin': 8.24.0(@typescript-eslint/parser@8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3))(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3) '@typescript-eslint/parser': 8.24.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3) eslint: 9.16.0(jiti@2.4.2) eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.7.0(eslint-plugin-import@2.31.0)(eslint@9.16.0(jiti@2.4.2)) - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.24.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3))(eslint-import-resolver-typescript@3.7.0)(eslint@9.16.0(jiti@2.4.2)) + eslint-import-resolver-typescript: 3.7.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3))(eslint@9.22.0(jiti@2.4.2)))(eslint@9.16.0(jiti@2.4.2)) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3))(eslint-import-resolver-typescript@3.7.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3))(eslint@9.22.0(jiti@2.4.2)))(eslint@9.16.0(jiti@2.4.2)))(eslint@9.16.0(jiti@2.4.2)) eslint-plugin-jsx-a11y: 6.10.2(eslint@9.16.0(jiti@2.4.2)) eslint-plugin-react: 7.37.2(eslint@9.16.0(jiti@2.4.2)) eslint-plugin-react-hooks: 5.1.0(eslint@9.16.0(jiti@2.4.2)) @@ -19958,7 +19953,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.7.0(eslint-plugin-import@2.31.0)(eslint@9.16.0(jiti@2.4.2)): + eslint-import-resolver-typescript@3.7.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3))(eslint@9.22.0(jiti@2.4.2)))(eslint@9.16.0(jiti@2.4.2)): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.4.0 @@ -19970,7 +19965,7 @@ snapshots: is-glob: 4.0.3 stable-hash: 0.0.4 optionalDependencies: - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.24.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3))(eslint-import-resolver-typescript@3.7.0)(eslint@9.16.0(jiti@2.4.2)) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3))(eslint-import-resolver-typescript@3.7.0)(eslint@9.22.0(jiti@2.4.2)) transitivePeerDependencies: - supports-color @@ -19990,14 +19985,14 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@8.24.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.7.0)(eslint@9.16.0(jiti@2.4.2)): + eslint-module-utils@2.12.0(@typescript-eslint/parser@8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.7.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3))(eslint@9.22.0(jiti@2.4.2)))(eslint@9.16.0(jiti@2.4.2)))(eslint@9.16.0(jiti@2.4.2)): dependencies: debug: 3.2.7 optionalDependencies: - '@typescript-eslint/parser': 8.24.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3) + '@typescript-eslint/parser': 8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3) eslint: 9.16.0(jiti@2.4.2) eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.7.0(eslint-plugin-import@2.31.0)(eslint@9.16.0(jiti@2.4.2)) + eslint-import-resolver-typescript: 3.7.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3))(eslint@9.22.0(jiti@2.4.2)))(eslint@9.16.0(jiti@2.4.2)) transitivePeerDependencies: - supports-color @@ -20012,7 +20007,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.24.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3))(eslint-import-resolver-typescript@3.7.0)(eslint@9.16.0(jiti@2.4.2)): + eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3))(eslint-import-resolver-typescript@3.7.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3))(eslint@9.22.0(jiti@2.4.2)))(eslint@9.16.0(jiti@2.4.2)))(eslint@9.16.0(jiti@2.4.2)): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -20023,7 +20018,7 @@ snapshots: doctrine: 2.1.0 eslint: 9.16.0(jiti@2.4.2) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.24.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.7.0)(eslint@9.16.0(jiti@2.4.2)) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.7.0(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3))(eslint@9.22.0(jiti@2.4.2)))(eslint@9.16.0(jiti@2.4.2)))(eslint@9.16.0(jiti@2.4.2)) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 @@ -20035,7 +20030,7 @@ snapshots: string.prototype.trimend: 1.0.9 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 8.24.0(eslint@9.16.0(jiti@2.4.2))(typescript@5.7.3) + '@typescript-eslint/parser': 8.24.0(eslint@9.22.0(jiti@2.4.2))(typescript@5.7.3) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack @@ -21178,7 +21173,7 @@ snapshots: groq-sdk@0.8.0: dependencies: - '@types/node': 18.19.75 + '@types/node': 18.19.76 '@types/node-fetch': 2.6.12 abort-controller: 3.0.0 agentkeepalive: 4.6.0 @@ -23374,12 +23369,12 @@ snapshots: ms@2.1.3: {} - msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3): + msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3): dependencies: '@bundled-es-modules/cookie': 2.0.1 '@bundled-es-modules/statuses': 1.0.1 '@bundled-es-modules/tough-cookie': 0.1.6 - '@inquirer/confirm': 5.1.5(@types/node@22.13.5) + '@inquirer/confirm': 5.1.5(@types/node@22.14.0) '@mswjs/interceptors': 0.37.6 '@open-draft/deferred-promise': 2.2.0 '@open-draft/until': 2.1.0 @@ -23753,7 +23748,7 @@ snapshots: openai@4.83.0(ws@8.18.0(bufferutil@4.0.9))(zod@3.24.2): dependencies: - '@types/node': 18.19.75 + '@types/node': 18.19.76 '@types/node-fetch': 2.6.12 abort-controller: 3.0.0 agentkeepalive: 4.6.0 @@ -26210,8 +26205,7 @@ snapshots: undici-types@6.19.8: {} - undici-types@6.20.0: - optional: true + undici-types@6.21.0: {} undici@5.28.5: dependencies: @@ -26452,12 +26446,12 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 - vite-node@2.1.0(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2): + vite-node@2.1.0(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2): dependencies: cac: 6.7.14 debug: 4.4.0 pathe: 1.1.2 - vite: 5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) + vite: 5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) transitivePeerDependencies: - '@types/node' - less @@ -26469,13 +26463,13 @@ snapshots: - supports-color - terser - vite-node@2.1.5(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2): + vite-node@2.1.5(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2): dependencies: cac: 6.7.14 debug: 4.4.0 es-module-lexer: 1.6.0 pathe: 1.1.2 - vite: 5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) + vite: 5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) transitivePeerDependencies: - '@types/node' - less @@ -26505,13 +26499,13 @@ snapshots: - supports-color - terser - vite-node@3.0.9(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2): + vite-node@3.0.9(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2): dependencies: cac: 6.7.14 debug: 4.4.0 es-module-lexer: 1.6.0 pathe: 2.0.3 - vite: 5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) + vite: 5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) transitivePeerDependencies: - '@types/node' - less @@ -26523,13 +26517,13 @@ snapshots: - supports-color - terser - vite-node@3.1.1(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2): + vite-node@3.1.1(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2): dependencies: cac: 6.7.14 debug: 4.4.0 es-module-lexer: 1.6.0 pathe: 2.0.3 - vite: 5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) + vite: 5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) transitivePeerDependencies: - '@types/node' - less @@ -26541,17 +26535,17 @@ snapshots: - supports-color - terser - vite-plugin-wasm@3.4.1(vite@5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2)): + vite-plugin-wasm@3.4.1(vite@5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2)): dependencies: - vite: 5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) + vite: 5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) - vite@5.4.14(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2): + vite@5.4.14(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2): dependencies: esbuild: 0.21.5 postcss: 8.5.3 rollup: 4.38.0 optionalDependencies: - '@types/node': 22.13.5 + '@types/node': 22.14.0 fsevents: 2.3.3 lightningcss: 1.29.1 terser: 5.38.2 @@ -26567,13 +26561,13 @@ snapshots: lightningcss: 1.29.1 terser: 5.38.2 - vite@5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2): + vite@5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2): dependencies: esbuild: 0.21.5 postcss: 8.5.3 rollup: 4.38.0 optionalDependencies: - '@types/node': 22.13.5 + '@types/node': 22.14.0 fsevents: 2.3.3 lightningcss: 1.29.1 terser: 5.38.2 @@ -26589,13 +26583,13 @@ snapshots: lightningcss: 1.29.1 terser: 5.38.2 - vite@6.1.0(@types/node@22.13.5)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.38.2)(tsx@4.19.3)(yaml@2.7.0): + vite@6.1.0(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.38.2)(tsx@4.19.3)(yaml@2.7.0): dependencies: esbuild: 0.24.2 postcss: 8.5.3 rollup: 4.38.0 optionalDependencies: - '@types/node': 22.13.5 + '@types/node': 22.14.0 fsevents: 2.3.3 jiti: 2.4.2 lightningcss: 1.29.1 @@ -26603,10 +26597,10 @@ snapshots: tsx: 4.19.3 yaml: 2.7.0 - vitest@2.1.0(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2): + vitest@2.1.0(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2): dependencies: '@vitest/expect': 2.1.0 - '@vitest/mocker': 2.1.0(@vitest/spy@2.1.0)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(vite@5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2)) + '@vitest/mocker': 2.1.0(@vitest/spy@2.1.0)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(vite@5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2)) '@vitest/pretty-format': 2.1.9 '@vitest/runner': 2.1.0 '@vitest/snapshot': 2.1.0 @@ -26621,12 +26615,12 @@ snapshots: tinyexec: 0.3.2 tinypool: 1.0.2 tinyrainbow: 1.2.0 - vite: 5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) - vite-node: 2.1.0(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) + vite: 5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) + vite-node: 2.1.0(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) why-is-node-running: 2.3.0 optionalDependencies: '@edge-runtime/vm': 4.0.4 - '@types/node': 22.13.5 + '@types/node': 22.14.0 happy-dom: 15.11.7 transitivePeerDependencies: - less @@ -26639,10 +26633,10 @@ snapshots: - supports-color - terser - vitest@2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2): + vitest@2.1.5(@edge-runtime/vm@4.0.4)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2): dependencies: '@vitest/expect': 2.1.5 - '@vitest/mocker': 2.1.5(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(vite@5.4.14(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2)) + '@vitest/mocker': 2.1.5(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(vite@5.4.14(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2)) '@vitest/pretty-format': 2.1.9 '@vitest/runner': 2.1.5 '@vitest/snapshot': 2.1.5 @@ -26658,12 +26652,12 @@ snapshots: tinyexec: 0.3.2 tinypool: 1.0.2 tinyrainbow: 1.2.0 - vite: 5.4.14(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) - vite-node: 2.1.5(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) + vite: 5.4.14(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) + vite-node: 2.1.5(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) why-is-node-running: 2.3.0 optionalDependencies: '@edge-runtime/vm': 4.0.4 - '@types/node': 22.13.5 + '@types/node': 22.14.0 happy-dom: 15.11.7 transitivePeerDependencies: - less @@ -26713,10 +26707,10 @@ snapshots: - supports-color - terser - vitest@3.0.9(@edge-runtime/vm@4.0.4)(@types/debug@4.1.12)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2): + vitest@3.0.9(@edge-runtime/vm@4.0.4)(@types/debug@4.1.12)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2): dependencies: '@vitest/expect': 3.0.9 - '@vitest/mocker': 3.0.9(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(vite@5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2)) + '@vitest/mocker': 3.0.9(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(vite@5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2)) '@vitest/pretty-format': 3.0.9 '@vitest/runner': 3.0.9 '@vitest/snapshot': 3.0.9 @@ -26732,13 +26726,13 @@ snapshots: tinyexec: 0.3.2 tinypool: 1.0.2 tinyrainbow: 2.0.0 - vite: 5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) - vite-node: 3.0.9(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) + vite: 5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) + vite-node: 3.0.9(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) why-is-node-running: 2.3.0 optionalDependencies: '@edge-runtime/vm': 4.0.4 '@types/debug': 4.1.12 - '@types/node': 22.13.5 + '@types/node': 22.14.0 happy-dom: 15.11.7 transitivePeerDependencies: - less @@ -26751,10 +26745,10 @@ snapshots: - supports-color - terser - vitest@3.1.1(@edge-runtime/vm@4.0.4)(@types/debug@4.1.12)(@types/node@22.13.5)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(terser@5.38.2): + vitest@3.1.1(@edge-runtime/vm@4.0.4)(@types/debug@4.1.12)(@types/node@22.14.0)(happy-dom@15.11.7)(lightningcss@1.29.1)(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(terser@5.38.2): dependencies: '@vitest/expect': 3.1.1 - '@vitest/mocker': 3.1.1(msw@2.7.0(@types/node@22.13.5)(typescript@5.7.3))(vite@5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2)) + '@vitest/mocker': 3.1.1(msw@2.7.0(@types/node@22.14.0)(typescript@5.7.3))(vite@5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2)) '@vitest/pretty-format': 3.1.1 '@vitest/runner': 3.1.1 '@vitest/snapshot': 3.1.1 @@ -26770,13 +26764,13 @@ snapshots: tinyexec: 0.3.2 tinypool: 1.0.2 tinyrainbow: 2.0.0 - vite: 5.4.16(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) - vite-node: 3.1.1(@types/node@22.13.5)(lightningcss@1.29.1)(terser@5.38.2) + vite: 5.4.16(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) + vite-node: 3.1.1(@types/node@22.14.0)(lightningcss@1.29.1)(terser@5.38.2) why-is-node-running: 2.3.0 optionalDependencies: '@edge-runtime/vm': 4.0.4 '@types/debug': 4.1.12 - '@types/node': 22.13.5 + '@types/node': 22.14.0 happy-dom: 15.11.7 transitivePeerDependencies: - less @@ -26824,18 +26818,18 @@ snapshots: w3c-keyname@2.2.8: {} - waku@0.21.20(@swc/helpers@0.5.15)(@types/node@22.13.5)(jiti@2.4.2)(lightningcss@1.29.1)(react-dom@19.0.0(react@19.0.0))(react-server-dom-webpack@19.0.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(webpack@5.97.1))(react@19.0.0)(terser@5.38.2)(tsx@4.19.3)(yaml@2.7.0): + waku@0.21.20(@swc/helpers@0.5.15)(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.29.1)(react-dom@19.0.0(react@19.0.0))(react-server-dom-webpack@19.0.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(webpack@5.97.1))(react@19.0.0)(terser@5.38.2)(tsx@4.19.3)(yaml@2.7.0): dependencies: '@hono/node-server': 1.13.8(hono@4.7.1) '@swc/core': 1.10.16(@swc/helpers@0.5.15) - '@vitejs/plugin-react': 4.3.4(vite@6.1.0(@types/node@22.13.5)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.38.2)(tsx@4.19.3)(yaml@2.7.0)) + '@vitejs/plugin-react': 4.3.4(vite@6.1.0(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.38.2)(tsx@4.19.3)(yaml@2.7.0)) dotenv: 16.4.7 hono: 4.7.1 react: 19.0.0 react-dom: 19.0.0(react@19.0.0) react-server-dom-webpack: 19.0.0(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(webpack@5.97.1) rsc-html-stream: 0.0.4 - vite: 6.1.0(@types/node@22.13.5)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.38.2)(tsx@4.19.3)(yaml@2.7.0) + vite: 6.1.0(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.38.2)(tsx@4.19.3)(yaml@2.7.0) transitivePeerDependencies: - '@swc/helpers' - '@types/node' From 6c75b13154f8380c8126e4699c5cb26c9ca91f39 Mon Sep 17 00:00:00 2001 From: Alex Yang Date: Tue, 8 Apr 2025 13:22:36 -0700 Subject: [PATCH 3/4] feat: fix type --- packages/cloud/src/reader-workflow.ts | 46 +++++++++++++++++---------- packages/cloud/src/schema.ts | 4 +-- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/packages/cloud/src/reader-workflow.ts b/packages/cloud/src/reader-workflow.ts index f5c15117cf..ae45018983 100644 --- a/packages/cloud/src/reader-workflow.ts +++ b/packages/cloud/src/reader-workflow.ts @@ -33,8 +33,8 @@ type InferWorkflowEventData = : never; const startEvent = zodEvent( - parseFormSchema - .merge( + z.union([ + parseFormSchema.merge( z.object({ file: z .string() @@ -44,8 +44,18 @@ const startEvent = zodEvent( .optional() .describe("input"), }), - ) - .optional(), + ), + parseFormSchema.merge( + z.object({ + input_s3_path: z.string().optional(), + }), + ), + parseFormSchema.merge( + z.object({ + input_url: z.string().optional(), + }), + ), + ]), ); const checkStatusEvent = workflowEvent(); @@ -90,23 +100,27 @@ const llamaParseWorkflow = withStore((params: LlamaParseWorkflowParams) => { llamaParseWorkflow.handle([startEvent], async ({ data: form }) => { const store = llamaParseWorkflow.getStore(); - const file = form?.file; - const isFilePath = typeof file === "string"; - const data = isFilePath ? await fs.readFile(file) : file; - const filename: string | undefined = isFilePath - ? path.basename(file) - : undefined; + const finalForm = { ...form } as Body_upload_file_api_v1_parsing_upload_post; + if ("file" in form) { + // support loads from the file system + const file = form?.file; + const isFilePath = typeof file === "string"; + const data = isFilePath ? await fs.readFile(file) : file; + const filename: string | undefined = isFilePath + ? path.basename(file) + : undefined; + finalForm.file = data + ? globalThis.File && filename + ? new File([data], filename) + : new Blob([data]) + : null; + } const { data: { id, status }, } = await uploadFileApiV1ParsingUploadPost({ throwOnError: true, body: { - ...form, - file: data - ? globalThis.File && filename - ? new File([data], filename) - : new Blob([data]) - : undefined, + ...finalForm, } satisfies { [Key in keyof Body_upload_file_api_v1_parsing_upload_post]: | Body_upload_file_api_v1_parsing_upload_post[Key] diff --git a/packages/cloud/src/schema.ts b/packages/cloud/src/schema.ts index 920c548432..90b9d02818 100644 --- a/packages/cloud/src/schema.ts +++ b/packages/cloud/src/schema.ts @@ -24,6 +24,7 @@ const PARSE_PRESETS = [ export const parsePresetSchema = z.enum(PARSE_PRESETS); export const parseFormSchema = z.object({ + input_s3_region: z.string().optional(), adaptive_long_table: z.boolean().optional(), annotate_links: z.boolean().optional(), auto_mode: z.boolean().optional(), @@ -70,9 +71,6 @@ export const parseFormSchema = z.object({ }, ) .optional(), - input_s3_path: z.string().optional(), - input_s3_region: z.string().optional(), - input_url: z.string().optional(), invalidate_cache: z.boolean().optional(), language: z.array(languageSchema).optional(), extract_layout: z.boolean().optional(), From def2b92686b26823df670bc0afc41d9dfef786b8 Mon Sep 17 00:00:00 2001 From: Alex Yang Date: Tue, 8 Apr 2025 13:34:14 -0700 Subject: [PATCH 4/4] fix: --- packages/cloud/src/reader-workflow.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/cloud/src/reader-workflow.ts b/packages/cloud/src/reader-workflow.ts index ae45018983..5604d778e3 100644 --- a/packages/cloud/src/reader-workflow.ts +++ b/packages/cloud/src/reader-workflow.ts @@ -204,7 +204,7 @@ const cacheMap = new Map< ReturnType >(); -type Job = { +export type ParseJob = { get jobId(): string; get signal(): AbortSignal; get context(): ReturnType; @@ -216,9 +216,9 @@ type Job = { json(): Promise; }; -export const uploadFile = async ( +export const upload = async ( params: InferWorkflowEventData & LlamaParseWorkflowParams, -): Promise => { +): Promise => { //#region cache const key = hash({ apiKey: params.apiKey, region: params.region }); if (!cacheMap.has(key)) { @@ -240,7 +240,7 @@ export const uploadFile = async ( ); //#region const jobId: string = uploadThread.at(-1)!.data; - return { + const job = { get signal() { // lazy load return context.signal; @@ -288,5 +288,13 @@ export const uploadFile = async ( ); return jsonThread.at(-1)!.data; }, + async images(): Promise { + const json = await job.json(); + const images = json.flatMap(({ images }) => images); + images.map((image) => { + // todo + }); + }, }; + return job; };