diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b1a06d50d..16be6b94e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,10 +26,10 @@ jobs: run: pnpm build env: NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: 'pk_test_c3VtbWFyeS13YWxydXMtMjUuY2xlcmsuYWNjb3VudHMuZGV2JA' - NEXT_PUBLIC_API_URL: 'http://localhost:8081' - NEXT_PUBLIC_AI_API_URL: 'http://localhost:8081' NEXT_PUBLIC_AUTH_API_URL: 'http://localhost:8080' - NEXT_PUBLIC_WS_URL: 'ws://localhost:8000' + NEXT_PUBLIC_API_URL: 'http://localhost:8081' + NEXT_PUBLIC_MODGPT_API_URL: 'http://localhost:8082' + NEXT_PUBLIC_CODEMODAI_API_URL: 'http://localhost:8091' HUBSPOT_CONTACT_FORM_ID: ${{ secrets.HUBSPOT_CONTACT_FORM_ID }} HUBSPOT_JOB_FORM_ID: ${{ secrets.HUBSPOT_JOB_FORM_ID }} HUBSPOT_NEWSLETTER_FORM_ID: ${{ secrets.HUBSPOT_NEWSLETTER_FORM_ID }} diff --git a/apps/backend/package.json b/apps/backend/package.json index 928440b1b..58426c941 100644 --- a/apps/backend/package.json +++ b/apps/backend/package.json @@ -1,6 +1,6 @@ { "name": "@codemod-com/backend", - "version": "0.0.157", + "version": "0.0.159", "scripts": { "build": "tsc && node esbuild.config.js", "start": "node build/index.js", @@ -13,11 +13,10 @@ "@codemod-com/telemetry": "workspace:*", "@codemod-com/tsconfig": "workspace:*", "@faker-js/faker": "catalog:", - "@total-typescript/ts-reset": "catalog:", "@types/node": "20.10.5", "@types/parse-github-url": "catalog:", "@types/pg": "catalog:", - "@types/semver": "7.5.8", + "@types/semver": "catalog:", "@types/supertest": "catalog:", "@types/ws": "^8.5.11", "dotenv-cli": "catalog:", @@ -59,7 +58,7 @@ "parse-github-url": "catalog:", "pg": "catalog:", "replicate": "catalog:", - "semver": "7.6.0", + "semver": "catalog:", "tar": "^6.2.0", "valibot": "catalog:", "ws": "^8.18.0", diff --git a/apps/backend/src/schemata/schema.ts b/apps/backend/src/schemata/schema.ts index 8edf48737..2f0fc8c4f 100644 --- a/apps/backend/src/schemata/schema.ts +++ b/apps/backend/src/schemata/schema.ts @@ -141,8 +141,7 @@ export const ivObjectSchema = object({ export const parseIv = (input: unknown) => parse(ivObjectSchema, input); export const diffCreationBodySchema = object({ - before: string(), - after: string(), + diffs: array(object({ before: string(), after: string() })), source: union([literal("cli"), literal("studio")]), name: optional(string(), "untitled"), }); @@ -154,6 +153,17 @@ export const getCodeDiffSchema = object({ id: string(), }); +export const beforeAfterDiffSchema = object({ + before: string(), + after: string(), +}); + +export const parseBeforeAfterDiff = (input: unknown) => + parse(beforeAfterDiffSchema, input); + +export const parseBeforeAfterDiffArray = (input: unknown) => + parse(array(beforeAfterDiffSchema), input); + export const parseGetCodeDiffParams = (input: unknown) => parse(getCodeDiffSchema, input); diff --git a/apps/backend/src/server.ts b/apps/backend/src/server.ts index 33137d4d4..679ad83e7 100644 --- a/apps/backend/src/server.ts +++ b/apps/backend/src/server.ts @@ -1,5 +1,10 @@ import { randomBytes } from "node:crypto"; -import type { CodemodListResponse } from "@codemod-com/api-types"; +import { + type ApiResponse, + BAD_REQUEST, + type CodemodListResponse, + INTERNAL_SERVER_ERROR, +} from "@codemod-com/api-types"; import { getAuthPlugin } from "@codemod-com/auth"; import { prisma } from "@codemod-com/database"; import { decryptWithIv, encryptWithIv } from "@codemod-com/utilities"; @@ -10,6 +15,7 @@ import Fastify, { type FastifyPluginCallback, type FastifyRequest, } from "fastify"; +import type { InferOutput } from "valibot"; import { type GetCodemodDownloadLinkResponse, getCodemodDownloadLink, @@ -25,6 +31,8 @@ import { publishHandler, } from "./publishHandler.js"; import { + type beforeAfterDiffSchema, + parseBeforeAfterDiffArray, parseCreateIssueBody, parseCreateIssueParams, parseDiffCreationBody, @@ -189,48 +197,46 @@ const routes: FastifyPluginCallback = (instance, _opts, done) => { getCodemodsListHandler, ); - instance.get<{ Reply: { before: string; after: string } }>( - "/diffs/:id", - async (request, reply) => { - const { id } = parseGetCodeDiffParams(request.params); - const { iv: ivStr } = parseIv(request.query); + instance.get<{ + Reply: ApiResponse<{ diffs: InferOutput[] }>; + }>("/diffs/:id", async (request, reply) => { + const { id } = parseGetCodeDiffParams(request.params); + const { iv: ivStr } = parseIv(request.query); - const key = Buffer.from(environment.ENCRYPTION_KEY, "base64url"); - const iv = Buffer.from(ivStr, "base64url"); + const key = Buffer.from(environment.ENCRYPTION_KEY, "base64url"); + const iv = Buffer.from(ivStr, "base64url"); - const codeDiff = await prisma.codeDiff.findUnique({ - where: { id }, - }); + const codeDiff = await prisma.codeDiff.findUnique({ + where: { id }, + }); - if (!codeDiff) { - reply.code(400).send(); - return; - } + if (!codeDiff) { + return reply + .code(400) + .send({ errorText: "Code diff not found", error: BAD_REQUEST }); + } - let before: string; - let after: string; - try { - before = decryptWithIv( - "aes-256-cbc", - { key, iv }, - Buffer.from(codeDiff.before, "base64url"), - ).toString(); - after = decryptWithIv( - "aes-256-cbc", - { key, iv }, - Buffer.from(codeDiff.after, "base64url"), - ).toString(); - } catch (err) { - reply.code(400).send(); - return; - } + try { + const diffs = parseBeforeAfterDiffArray( + JSON.parse( + decryptWithIv( + "aes-256-cbc", + { key, iv }, + Buffer.from(codeDiff.diffs, "base64url"), + ).toString(), + ), + ); - reply.type("application/json").code(200); - return { before, after }; - }, - ); + reply.type("application/json").code(200).send({ diffs }); + } catch (err) { + return reply.code(400).send({ + errorText: `Failed to decrypt the diffs array: ${(err as Error).message}`, + error: INTERNAL_SERVER_ERROR, + }); + } + }); - instance.post<{ Reply: { id: string; iv: string } }>( + instance.post<{ Reply: ApiResponse<{ id: string; iv: string }> }>( "/diffs", async (request, reply) => { const body = parseDiffCreationBody(request.body); @@ -242,21 +248,18 @@ const routes: FastifyPluginCallback = (instance, _opts, done) => { data: { name: body.name, source: body.source, - before: encryptWithIv( + diffs: encryptWithIv( "aes-256-cbc", { key, iv }, - Buffer.from(body.before), - ).toString("base64url"), - after: encryptWithIv( - "aes-256-cbc", - { key, iv }, - Buffer.from(body.after), + Buffer.from(JSON.stringify(body.diffs)), ).toString("base64url"), }, }); - reply.type("application/json").code(200); - return { id: codeDiff.id, iv: iv.toString("base64url") }; + return reply + .type("application/json") + .code(200) + .send({ id: codeDiff.id, iv: iv.toString("base64url") }); }, ); diff --git a/apps/cli/build.js b/apps/cli/build.js index 4e5da638f..5076fc59b 100644 --- a/apps/cli/build.js +++ b/apps/cli/build.js @@ -4,22 +4,31 @@ import { hideBin } from "yargs/helpers"; // Build envs for local production build, can be used by running `pnpm build --prod` const localProdBuildEnvs = { "process.env.NODE_ENV": '"production"', + "process.env.IGNORE_TELEMETRY": "true", + "process.env.BACKEND_URL": '"https://backend.codemod.com"', "process.env.AUTH_BACKEND_URL": '"https://backend.codemod.com/auth"', + "process.env.RUNNER_URL": '"http://backend.codemod.com/run"', + "process.env.MODGPT_URL": '"http://backend.codemod.com/modgpt"', + "process.env.CODEMODAI_URL": '"http://backend.codemod.com/ai"', + "process.env.CODEMOD_HOME_PAGE_URL": '"https://codemod.com"', "process.env.CODEMOD_STUDIO_URL": '"https://codemod.com/studio"', - "process.env.IGNORE_TELEMETRY": "true", - "process.env.RUNNER_URL": '"https://backend.codemod.com/run"', }; // Build envs for staging, it is the default when running `pnpm build` const stagingBuildEnvs = { "process.env.NODE_ENV": '"staging"', + "process.env.IGNORE_TELEMETRY": "true", + "process.env.BACKEND_URL": '"https://staging-backend.codemod.com"', "process.env.AUTH_BACKEND_URL": '"https://staging-backend.codemod.com/auth"', + "process.env.RUNNER_URL": '"http://staging-backend.codemod.com/run"', + "process.env.MODGPT_URL": '"http://staging-backend.codemod.com/modgpt"', + "process.env.CODEMODAI_URL": '"http://staging-backend.codemod.com/ai"', + "process.env.CODEMOD_HOME_PAGE_URL": '"https://staging.codemod.com"', "process.env.CODEMOD_STUDIO_URL": '"https://staging.codemod.com/studio"', - "process.env.IGNORE_TELEMETRY": "true", }; // Build envs for publishing to npm, it would usually happen during prepublishOnly script @@ -32,12 +41,16 @@ const publishEnvs = { // Can be used by running `pnpm build --local` const localEnvs = { "process.env.NODE_ENV": '"development"', + "process.env.IGNORE_TELEMETRY": "true", + "process.env.BACKEND_URL": '"http://localhost:8081"', "process.env.AUTH_BACKEND_URL": '"http://localhost:8080"', + "process.env.RUNNER_URL": '"http://localhost:8083"', + "process.env.MODGPT_URL": '"http://localhost:8084"', + "process.env.CODEMODAI_URL": '"http://localhost:8091"', + "process.env.CODEMOD_HOME_PAGE_URL": '"http://localhost:3000"', "process.env.CODEMOD_STUDIO_URL": '"http://localhost:3000/studio"', - "process.env.IGNORE_TELEMETRY": "true", - "process.env.RUNNER_URL": '"http://localhost:8083"', }; const argv = hideBin(process.argv); diff --git a/apps/cli/env.d.ts b/apps/cli/env.d.ts index 3146175b7..a7efcb8fd 100644 --- a/apps/cli/env.d.ts +++ b/apps/cli/env.d.ts @@ -2,11 +2,16 @@ declare global { namespace NodeJS { interface ProcessEnv { NODE_ENV: "development" | "production"; + IGNORE_TELEMETRY: boolean; + BACKEND_URL: string; AUTH_BACKEND_URL: string; + RUNNER_URL: string; + MODGPT_URL: string; + CODEMODAI_URL: string + CODEMOD_HOME_PAGE_URL: string; CODEMOD_STUDIO_URL: string; - IGNORE_TELEMETRY: boolean; } } } diff --git a/apps/cli/package.json b/apps/cli/package.json index 270a88bff..54e600ff9 100644 --- a/apps/cli/package.json +++ b/apps/cli/package.json @@ -4,7 +4,7 @@ "imports": { "#*": "./src/*" }, - "version": "0.13.7", + "version": "0.14.0", "description": "A codemod engine for Node.js libraries (jscodeshift, ts-morph, etc.)", "type": "module", "exports": null, @@ -47,7 +47,7 @@ "@types/inquirer": "catalog:", "@types/node": "18.11.9", "@types/prettyjson": "catalog:", - "@types/semver": "^7.5.8", + "@types/semver": "catalog:", "@types/yargs": "catalog:", "@vitest/coverage-v8": "catalog:", "axios": "catalog:", @@ -61,7 +61,7 @@ "open": "catalog:", "prettier": "^3.2.5", "prettyjson": "catalog:", - "semver": "^7.6.2", + "semver": "catalog:", "terminal-link": "catalog:", "ts-morph": "18.0.0", "valibot": "catalog:", diff --git a/apps/cli/src/api.ts b/apps/cli/src/api.ts index b711e6931..503a931b9 100644 --- a/apps/cli/src/api.ts +++ b/apps/cli/src/api.ts @@ -1,5 +1,5 @@ import { Octokit } from "@octokit/rest"; -import Axios, { AxiosError, type RawAxiosRequestHeaders } from "axios"; +import axios, { AxiosError, type RawAxiosRequestHeaders } from "axios"; import type { CodemodDownloadLinkResponse, @@ -9,6 +9,8 @@ import type { GetUserDataResponse, VerifyTokenResponse, } from "@codemod-com/api-types"; +import type { LLMEngine } from "@codemod-com/utilities"; +import { streamingFetch } from "#utils/download.js"; export const extractPrintableApiError = (err: unknown): string => { if (!(err instanceof Error)) { @@ -23,7 +25,7 @@ export const getCLIAccessToken = async ( ): Promise => { const url = new URL(`${process.env.AUTH_BACKEND_URL}/appToken`); - const res = await Axios.get(url.toString(), { + const res = await axios.get(url.toString(), { headers: { Authorization: `Bearer ${accessToken}` }, timeout: 10000, }); @@ -34,7 +36,7 @@ export const getCLIAccessToken = async ( export const validateCLIToken = async ( accessToken: string, ): Promise => { - const res = await Axios.get( + const res = await axios.get( `${process.env.AUTH_BACKEND_URL}/verifyToken`, { headers: { Authorization: `Bearer ${accessToken}` }, @@ -49,7 +51,7 @@ export const getUserData = async ( accessToken: string, ): Promise => { try { - const { data } = await Axios.get( + const { data } = await axios.get( `${process.env.AUTH_BACKEND_URL}/userData`, { headers: { Authorization: `Bearer ${accessToken}` }, @@ -71,7 +73,7 @@ export const publish = async ( accessToken: string, formData: FormData, ): Promise => { - await Axios.post(`${process.env.BACKEND_URL}/publish`, formData, { + await axios.post(`${process.env.BACKEND_URL}/publish`, formData, { headers: { Authorization: `Bearer ${accessToken}`, "Content-Type": "multipart/form-data", @@ -84,7 +86,7 @@ export const unpublish = async ( accessToken: string, name: string, ): Promise => { - await Axios.post( + await axios.post( `${process.env.BACKEND_URL}/unpublish`, { name }, { @@ -95,7 +97,7 @@ export const unpublish = async ( }; export const revokeCLIToken = async (accessToken: string): Promise => { - return Axios.delete(`${process.env.AUTH_BACKEND_URL}/revokeToken`, { + return axios.delete(`${process.env.AUTH_BACKEND_URL}/revokeToken`, { headers: { Authorization: `Bearer ${accessToken}` }, timeout: 10000, }); @@ -112,7 +114,7 @@ export const getCodemod = async ( headers.Authorization = `Bearer ${accessToken}`; } - const res = await Axios.get(url.toString(), { + const res = await axios.get(url.toString(), { headers, timeout: 10000, }); @@ -123,7 +125,7 @@ export const getCodemod = async ( export const getGithubAPIKey = async ( accessToken: string, ): Promise => { - const res = await Axios.get<{ token?: string }>( + const res = await axios.get<{ token?: string }>( `${process.env.AUTH_BACKEND_URL}/oAuthToken`, { headers: { Authorization: `Bearer ${accessToken}` }, @@ -169,7 +171,7 @@ export const getCodemodDownloadURI = async ( headers.Authorization = `Bearer ${accessToken}`; } - const res = await Axios.get(url.toString(), { + const res = await axios.get(url.toString(), { headers, timeout: 10000, }); @@ -203,7 +205,7 @@ export const getCodemodList = async (options?: { url.searchParams.set("all", "true"); } - const res = await Axios.get(url.toString(), { + const res = await axios.get(url.toString(), { headers, timeout: 10000, }); @@ -217,7 +219,7 @@ type UserLoginIntentResponse = { }; export const generateUserLoginIntent = async (): Promise => { - const res = await Axios.post( + const res = await axios.post( `${process.env.AUTH_BACKEND_URL}/intents`, {}, ); @@ -232,7 +234,7 @@ export const confirmUserLoggedIn = async ( sessionId: string, iv: string, ): Promise => { - const res = await Axios.get( + const res = await axios.get( `${process.env.AUTH_BACKEND_URL}/intents/${sessionId}?iv=${iv}`, ); @@ -243,18 +245,51 @@ type CreateCodeDiffResponse = { id: string; iv: string; }; -export const createCodeDiff = async (body: { - beforeSnippet: string; - afterSnippet: string; -}): Promise => { - const res = await Axios.post( +export const createCodeDiff = async ( + diffs: { before: string; after: string }[], +): Promise => { + const res = await axios.post( `${process.env.BACKEND_URL}/diffs`, - { - before: body.beforeSnippet, - after: body.afterSnippet, - source: "cli", - }, + { diffs, source: "cli" }, ); return res.data; }; + +// @TODO: use types from feat/insights-fe branch (insights feature backend) +export const sendCodemodAIRequest = (options: { + accessToken: string; + prompt: string; + engine?: LLMEngine; + signal?: AbortSignal; +}) => { + const { accessToken, signal, prompt, engine = "gpt-4o" } = options; + + return streamingFetch(() => + fetch(process.env.CODEMODAI_URL, { + method: "POST", + body: JSON.stringify({ messages: [prompt], engine }), + headers: { Authorization: `Bearer ${accessToken}` }, + signal, + }), + ); +}; + +// @TODO: use types from feat/insights-fe branch (insights feature backend) +export const sendModGPTRequest = (options: { + accessToken: string; + prompt: string; + engine?: LLMEngine; + signal?: AbortSignal; +}) => { + const { accessToken, signal, prompt, engine = "gpt-4o" } = options; + + return streamingFetch(() => + fetch(`${process.env.MODGPT_URL}/sendChat`, { + method: "GET", + body: JSON.stringify({ messages: [prompt], engine }), + headers: { Authorization: `Bearer ${accessToken}` }, + signal, + }), + ); +}; diff --git a/apps/cli/src/commands/learn.ts b/apps/cli/src/commands/learn.ts index ca54c228a..14b98370f 100644 --- a/apps/cli/src/commands/learn.ts +++ b/apps/cli/src/commands/learn.ts @@ -1,61 +1,37 @@ -import { execSync } from "node:child_process"; -import { dirname, extname } from "node:path"; -import open from "open"; -import { Project } from "ts-morph"; - +import { readFile } from "node:fs/promises"; +import { dirname, extname, resolve, sep } from "node:path"; import { type Printer, chalk } from "@codemod-com/printer"; +import { getCodemodExecutable } from "@codemod-com/runner"; import { type KnownEngines, doubleQuotify, - isJavaScriptName, - isJsxName, + getCodemodRc, } from "@codemod-com/utilities"; -import { createCodeDiff } from "#api.js"; +import { AxiosError } from "axios"; +import inquirer from "inquirer"; +import open from "open"; + +import { createCodeDiff, sendCodemodAIRequest } from "#api.js"; import { - findLastlyModifiedFile, findModifiedFiles, + getFileFromCommit, getGitDiffForFile, getLatestCommitHash, isFileInGitDirectory, } from "#git.js"; +import { getCurrentUserOrLogin } from "#utils/auth.js"; // remove all special characters and whitespaces const removeSpecialCharacters = (str: string) => str.replace(/[{}()[\]:;,/?'"<>|=`!]/g, "").replace(/\s/g, ""); +const isJSorTS = (name: string) => + name.startsWith(".ts") || name.startsWith(".js"); + const getFileExtension = (filePath: string) => { return extname(filePath).toLowerCase(); }; -const getOldSourceFile = (commitHash: string, filePath: string) => { - try { - const commitWithFileName = doubleQuotify(`${commitHash}:${filePath}`); - const output = execSync(`git show ${commitWithFileName}`).toString(); - - const project = new Project({ - useInMemoryFileSystem: true, - compilerOptions: { - allowJs: true, - }, - }); - - return project.createSourceFile(filePath, output); - } catch (error) { - console.error(error); - return null; - } -}; - -const getSourceFile = (filePath: string) => { - const project = new Project({ - compilerOptions: { - allowJs: true, - }, - }); - - return project.addSourceFileAtPathIfExists(filePath) ?? null; -}; - const UrlParamKeys = { Engine: "engine" as const, DiffId: "diffId" as const, @@ -93,8 +69,10 @@ const createCodemodStudioURL = ({ export const handleLearnCliCommand = async (options: { printer: Printer; target: string | null; + source: string | null; + engine: string | null; }) => { - const { printer, target } = options; + const { printer, target, source, engine } = options; if (target !== null && !isFileInGitDirectory(target)) { printer.printOperationMessage({ @@ -105,9 +83,9 @@ export const handleLearnCliCommand = async (options: { return; } - const dirtyPath = target ?? (await findLastlyModifiedFile()); + const modifiedPaths = findModifiedFiles(); - if (dirtyPath === null) { + if (modifiedPaths === null || modifiedPaths.length === 0) { printer.printOperationMessage({ kind: "error", message: "We could not find any modified file to run the command on.", @@ -115,39 +93,44 @@ export const handleLearnCliCommand = async (options: { return; } - const path = dirtyPath.replace(/\$/g, "\\$").replace(/\^/g, "\\^"); - - const fileExtension = getFileExtension(path); + const skipped: string[] = []; + let paths = modifiedPaths.filter((path) => { + if (isJSorTS(getFileExtension(path))) { + return true; + } - const isValidFile = - isJavaScriptName(fileExtension) || isJsxName(fileExtension); + skipped.push(resolve(path)); + return false; + }); - if (!isValidFile) { + if (skipped.length > 0) { printer.printOperationMessage({ kind: "error", - message: - "At this moment, we are supporting only Jscodeshift engine, so the file must be either a JavaScript or TypeScript file (.js, .ts, .mjs, .cjs, .mts, .cts, .jsx, .tsx).\n" + - "Soon, we will support other engines and hence other extensions including .md, .mdx and more!", + message: chalk( + "This feature currently only supports codemod generation using jscodeshift engine, so the files must be either a JavaScript or TypeScript file (.js, .jsx, .ts, .tsx).", + `\nThe following files will not be processed:\n${skipped + .map((path) => ` - ${chalk.bold(path)}`) + .join("\n")}`, + "\nSoon, we will support other engines and hence other extensions including .md, .mdx and more!", + ), }); - return; } - const latestCommitHash = getLatestCommitHash(dirname(path)); - if (latestCommitHash === null) { - printer.printOperationMessage({ - kind: "error", - message: - "Unexpected error occurred while getting the latest commit hash.", + if (paths.length > 1) { + const { paths: userSelectedPaths } = await inquirer.prompt<{ + paths: string[]; + }>({ + type: "checkbox", + name: "paths", + message: "Select the files you want to learn the diffs from", + choices: paths.map((path) => ({ + name: path.split(sep).slice(-2).join(sep), + value: path, + checked: true, + })), }); - return; - } - const modifiedFiles = findModifiedFiles(); - if (modifiedFiles !== null && modifiedFiles.length > 1) { - printer.printConsoleMessage( - "warn", - "Only the changes in the most recently edited file will be processed.", - ); + paths = userSelectedPaths; } printer.printConsoleMessage( @@ -155,103 +138,184 @@ export const handleLearnCliCommand = async (options: { chalk.cyan( "Learning", chalk.bold(doubleQuotify("git diff")), - "at", - chalk.bold(path), "has begun...", "\n", ), ); - const gitDiff = getGitDiffForFile(latestCommitHash, path); - if (gitDiff === null) { - printer.printOperationMessage({ - kind: "error", - message: "Unexpected error occurred while running `git diff` command.", - }); - return; - } - - if (gitDiff.length === 0) { - printer.printOperationMessage({ - kind: "error", - message: - "There is no difference between the status of the file and that at the previous commit.", - }); - return; - } + const diffs: Record = {}; - const oldSourceFile = getOldSourceFile(latestCommitHash, path); - const sourceFile = getSourceFile(dirtyPath); - - if (oldSourceFile === null || sourceFile === null) { - printer.printOperationMessage({ - kind: "error", - message: "Unexpected error occurred while getting AST of the file.", - }); - return; - } - - const beforeNodeTexts = new Set(); - const afterNodeTexts = new Set(); + for (const dirtyPath of paths) { + const latestCommitHash = getLatestCommitHash(dirname(dirtyPath)); + if (latestCommitHash === null) { + printer.printOperationMessage({ + kind: "error", + message: `Unexpected error occurred while getting the latest commit hash. - ${dirtyPath}`, + }); + continue; + } - const lines = gitDiff.split("\n"); + const path = dirtyPath.replace(/\$/g, "\\$").replace(/\^/g, "\\^"); - for (const line of lines) { - if (!line.startsWith("-") && !line.startsWith("+")) { + const gitDiff = getGitDiffForFile(latestCommitHash, path); + if (gitDiff === null) { + printer.printOperationMessage({ + kind: "error", + message: `Unexpected error occurred while running ${chalk.bold( + "git diff", + )} command. - ${path}`, + }); continue; } - const codeString = line.substring(1).trim(); - if (removeSpecialCharacters(codeString).length === 0) { + if (gitDiff.length === 0) { continue; } - if (line.startsWith("-")) { - oldSourceFile.forEachChild((node) => { - const content = node.getFullText(); - - if (content.includes(codeString) && !beforeNodeTexts.has(content)) { - beforeNodeTexts.add(content); - } + const hunkPattern = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/gm; + const hunks: { + header: string; + hunk: string; + details: { + removed: { at: number; count: number } | null; + added: { at: number; count: number } | null; + } | null; + }[] = []; + let match = hunkPattern.exec(gitDiff); + + while (match !== null) { + const hunkStart = match.index; + + // Find the next hunk or end of diff + const nextHunkIndex = gitDiff.indexOf("@@", hunkPattern.lastIndex); + const hunkEnd = nextHunkIndex !== -1 ? nextHunkIndex : gitDiff.length; + const hunkContent = gitDiff.substring(hunkStart, hunkEnd); + + hunks.push({ + header: match[0], + hunk: hunkContent, + details: { + removed: match[1] + ? { + at: Number.parseInt(match[1], 10), + count: match[2] ? Number.parseInt(match[2], 10) : 1, + } + : null, + added: match[3] + ? { + at: Number.parseInt(match[3], 10), + count: match[4] ? Number.parseInt(match[4], 10) : 1, + } + : null, + }, }); + + hunkPattern.lastIndex = hunkEnd; + match = hunkPattern.exec(gitDiff); } - if (line.startsWith("+")) { - sourceFile.forEachChild((node) => { - const content = node.getFullText(); - if (content.includes(codeString) && !afterNodeTexts.has(content)) { - afterNodeTexts.add(content); - } + const oldFile = await getFileFromCommit(latestCommitHash, path); + const newFile = await readFile(path, "utf-8"); + + if (!oldFile || !newFile) { + printer.printOperationMessage({ + kind: "error", + message: "Unexpected error occurred while reading the file.", }); + + return; } + + diffs[path] = hunks.map(({ header, hunk, details }) => { + const { removed, added } = details ?? { removed: null, added: null }; + + return { + before: removed + ? oldFile + .split("\n") + .slice(removed.at - 1, removed.at + removed.count) + .join("\n") + : "", + after: added + ? newFile + .split("\n") + .slice(added.at - 1, added.at + added.count) + .join("\n") + : "", + }; + }); } - const irrelevantNodeTexts = new Set(); + if (Object.keys(diffs).length === 0) { + printer.printOperationMessage({ + kind: "error", + message: chalk.yellow("No diffs found in selected files. Aborting..."), + }); + return; + } + + printer.printConsoleMessage( + "info", + chalk.cyan(`A total of ${diffs.length} diffs found in the files.`), + ); + + // Improve existing codemod + if (source !== null) { + const userData = await getCurrentUserOrLogin({ + message: "Please login to continue.", + printer, + }); - beforeNodeTexts.forEach((text) => { - if (afterNodeTexts.has(text)) { - irrelevantNodeTexts.add(text); + const { config } = await getCodemodRc({ source, throwOnNotFound: true }); + + if (config.engine !== "jscodeshift") { + return printer.printOperationMessage({ + kind: "error", + message: "Recipe codemods are not supported for improving.", + }); } - }); - irrelevantNodeTexts.forEach((text) => { - beforeNodeTexts.delete(text); - afterNodeTexts.delete(text); - }); + const sourceCode = await getCodemodExecutable(source); + + // const prompt = getCodemodPrompt({ + // type: "improve", + // testCases: Object.values(diffs).flat(), + // existingCodemodSource: sourceCode, + // }); + + const chatSpinner = printer.withLoaderMessage("Improving your codemod..."); + + try { + // 1. send request to AI service + for await (const chunk of sendCodemodAIRequest({ + accessToken: userData.token, + prompt: "empty", + })) { + } + + // 2. update the codemod in the source by adding the test fixture and updating the source code + + chatSpinner.succeed(); + } catch (err) { + chatSpinner.fail(); + const error = err as AxiosError<{ message: string }> | Error; + + return printer.printConsoleMessage( + "error", + `Failed to send an API request to the AI service:\n ${ + error instanceof AxiosError + ? error.response?.data.errorText + : error.message + }`, + ); + } + + return; + } + + // Regular studio flow as before (will require multiple diffs support implemented in studio) + const { id: diffId, iv } = await createCodeDiff(Object.values(diffs).flat()); - const beforeSnippet = Array.from(beforeNodeTexts) - .join("") - // remove all occurrences of `\n` at the beginning - .replace(/^\n+/, ""); - const afterSnippet = Array.from(afterNodeTexts) - .join("") - // remove all occurrences of `\n` at the beginning - .replace(/^\n+/, ""); - - const { id: diffId, iv } = await createCodeDiff({ - beforeSnippet, - afterSnippet, - }); const url = createCodemodStudioURL({ // TODO: Support other engines in the future engine: "jscodeshift", @@ -273,7 +337,6 @@ export const handleLearnCliCommand = async (options: { ); const success = open(url); - if (!success) { printer.printOperationMessage({ kind: "error", diff --git a/apps/cli/src/commands/login.ts b/apps/cli/src/commands/login.ts index e1a05f12e..9dacdbcf6 100644 --- a/apps/cli/src/commands/login.ts +++ b/apps/cli/src/commands/login.ts @@ -7,11 +7,11 @@ import { generateUserLoginIntent, getCLIAccessToken, } from "#api.js"; -import { getCurrentUserData } from "#auth-utils.js"; import { CredentialsStorageType, credentialsStorage, } from "#credentials-storage.js"; +import { getCurrentUserData } from "#utils/auth.js"; const ACCESS_TOKEN_REQUESTED_BY_CLI_KEY = "accessTokenRequestedByCLI"; diff --git a/apps/cli/src/git.ts b/apps/cli/src/git.ts index 30e3079ec..bb8a6d6f0 100644 --- a/apps/cli/src/git.ts +++ b/apps/cli/src/git.ts @@ -3,7 +3,7 @@ import { existsSync, lstatSync } from "node:fs"; import { stat } from "node:fs/promises"; import { join } from "node:path"; -import { doubleQuotify } from "@codemod-com/utilities"; +import { doubleQuotify, execPromise } from "@codemod-com/utilities"; export const isGitDirectory = (directoryPath: string): boolean => { const gitPath = join(directoryPath, ".git"); @@ -37,6 +37,24 @@ export const getGitDiffForFile = ( } }; +export const getFileFromCommit = async ( + commitHash: string, + filePath: string, +): Promise => { + try { + const { stdout } = await execPromise( + `git show ${commitHash}:${doubleQuotify(filePath)}`, + ); + return stdout.toString(); + } catch (error) { + if (!(error instanceof Error)) { + return null; + } + console.error("Error while getting file from commit:", error.message); + return null; + } +}; + export const getLatestCommitHash = (directoryPath: string): string | null => { try { const gitLog = execSync( @@ -54,10 +72,11 @@ export const getLatestCommitHash = (directoryPath: string): string | null => { export const findModifiedFiles = (): string[] | null => { try { - const modifiedFiles = execSync("git ls-files --modified", { - encoding: "utf-8", - }); - return modifiedFiles.trim().split("\n"); + const modifiedFiles = execSync( + "git ls-files $(git rev-parse --show-toplevel) --modified", + { encoding: "utf-8" }, + ); + return modifiedFiles.trim().split("\n").filter(Boolean); } catch (error) { console.error("Error finding the modified files:", error); return null; diff --git a/apps/cli/src/main.ts b/apps/cli/src/main.ts index c879e25d6..39a16497f 100644 --- a/apps/cli/src/main.ts +++ b/apps/cli/src/main.ts @@ -196,11 +196,22 @@ export const main = async () => { "learn", "exports the current `git diff` in a file to before/after panels in the Codemod Studio", (y) => - y.option("target", { - alias: "t", - type: "string", - description: "path to the file to be learned", - }), + y + .option("target", { + alias: "t", + type: "string", + description: "path to the file to be learned", + }) + .option("source", { + alias: "s", + type: "string", + description: "path to the codemod to improve on top of", + }) + .option("engine", { + type: "string", + description: "the engine to use with the standalone codemod", + hidden: true, + }), async (args) => { const { executeCliCommand, printer } = await initializeDependencies(args); @@ -209,6 +220,8 @@ export const main = async () => { handleLearnCliCommand({ printer, target: args.target ?? null, + source: args.target ?? null, + engine: args.engine ?? null, }), ); }, diff --git a/apps/cli/src/auth-utils.ts b/apps/cli/src/utils/auth.ts similarity index 100% rename from apps/cli/src/auth-utils.ts rename to apps/cli/src/utils/auth.ts diff --git a/apps/cli/src/utils/constants.ts b/apps/cli/src/utils/constants.ts index f050f6dc5..957c0bce6 100644 --- a/apps/cli/src/utils/constants.ts +++ b/apps/cli/src/utils/constants.ts @@ -7,3 +7,224 @@ export const originalStdoutWrite = process.stdout.write; export const codemodDirectoryPath = join(os.homedir(), ".codemod"); export const oraCheckmark = chalk.green("✔"); export const oraCross = chalk.red("✖"); + +// const generateCodemodContext = `### Context +// - You will be provided with BEFORE and AFTER code snippet pairs. +// - Write a single jscodeshift codemod that transforms each BEFORE snippet into the AFTER snippet. +// - Identify common patterns and create a generic codemod to handle all cases. +// - Use only jscodeshift and TypeScript. +// - If comments in AFTER snippets describe the transformation, do not preserve them. +// - Only include a code block in your response, no extra explanations. +// - Comment your code following best practices. +// - Do not import 'namedTypes' or 'builders' from jscodeshift. +// - Always narrow node types using typeguards before accessing their properties. +// `; + +// const improveCodemodContext = `### Context +// - You will be provided with BEFORE and AFTER code snippet pairs and an existing codemod that might or might not satisfy them. +// - An existing codemod is located in a zip archive sent to you. +// - Use the provided jscodeshift codemod and see whether it would turn each BEFORE snippet into corresponding AFTER snippet. +// - Identify common patterns and improve the codemod to handle all cases. +// - Use only jscodeshift and TypeScript. +// - If comments in AFTER snippets describe the transformation, do not preserve them. +// - Only include the download link for the archive with updated code in your response, no extra explanations or text. +// - Comment your code following best practices. +// - Do not import 'namedTypes' or 'builders' from jscodeshift. +// - Always narrow node types using typeguards before accessing their properties. +// `; + +// const jscodeshiftUsageExamples = `Here are two examples of using typeguards to check whether the import source is a string literal: +// \`\`\`typescript +// if (j.Literal.check(node.source)) { // CORRECT +// // rest of the code +// } +// if (j.Literal.check(node.source) && typeof node.source.value === 'string') { // CORRECT +// // rest of the code +// } +// \`\`\` +// - Never check the node type without using typeguards. The following example is INCORRECT: +// \`\`\`typescript +// if (node.source.type === 'Literal') { // INCORRECT +// // rest of the code +// } +// \`\`\` +// ### Examples +// #### Example 1 +// **BEFORE**: +// \`\`\`typescript +// import { A } from '@ember/array'; +// let arr = new A(); +// \`\`\` +// **AFTER**: +// \`\`\`typescript +// import { A as emberA } from '@ember/array'; +// let arr = A(); +// \`\`\` +// **CODEMOD**: +// \`\`\`typescript +// export default function transform(file, api) { +// const j = api.jscodeshift; +// const root = j(file.source); +// root.find(j.NewExpression, { callee: { name: "A" } }).replaceWith(() => { +// root.find(j.ImportSpecifier, { +// imported: { name: "A" }, +// local: { name: "A" } +// }).replaceWith(() => { +// return j.importSpecifier(j.identifier("A"), j.identifier("emberA")); +// }); +// return j.callExpression(j.identifier("A"), []); +// }); +// return root.toSource(); +// } +// \`\`\` +// #### Example 2 +// **BEFORE**: +// \`\`\`typescript +// import { Route, Router } from 'react-router-dom'; +// const MyApp = () => ( +// +// +// +// +// +// +// ); +// \`\`\` +// **AFTER**: +// \`\`\`typescript +// import { Route, Router } from 'react-router-dom'; +// const MyApp = () => ( +// +// +// +// +// +// +// +// +// ); +// \`\`\` +// **CODEMOD**: +// \`\`\`typescript +// import type { API, FileInfo, Options, Transform } from "jscodeshift"; +// function transform(file: FileInfo, api: API, options: Options): string | undefined { +// const j = api.jscodeshift; +// const root = j(file.source); +// root.find(j.JSXElement, { +// openingElement: { name: { name: "Router" } } +// }).forEach((path) => { +// const hasSwitch = root.findJSXElements("Switch").length > 0; +// if (hasSwitch) { +// return; +// } +// const children = path.value.children; +// const newEl = j.jsxElement( +// j.jsxOpeningElement(j.jsxIdentifier("Switch"), [], false), +// j.jsxClosingElement(j.jsxIdentifier("Switch")), +// children +// ); +// path.value.children = [j.jsxText("\\n "), newEl, j.jsxText("\\n")]; +// }); +// return root.toSource(options); +// } +// export default transform; +// \`\`\` +// #### Example 3 +// **BEFORE**: +// \`\`\`typescript +// import { Redirect, Route } from 'react-router'; +// \`\`\` +// **AFTER**: +// \`\`\`typescript +// import { Redirect, Route } from 'react-router-dom'; +// \`\`\` +// **CODEMOD**: +// \`\`\`typescript +// import type { API, FileInfo, Options, Transform } from 'jscodeshift'; +// function transform(file: FileInfo, api: API, options: Options): string | undefined { +// const j = api.jscodeshift; +// const root = j(file.source); +// root.find(j.ImportDeclaration, { +// source: { value: 'react-router' } +// }).forEach((path) => { +// path.value.source.value = 'react-router-dom'; +// }); +// return root.toSource(options); +// } +// export default transform; +// \`\`\` +// ## Additional API about jscodeshift +// ### closestScope: Finds the closest enclosing scope of a node. Useful for determining the scope context of variables and functions. +// \`\`\`typescript +// const closestScopes = j.find(j.Identifier).closestScope(); +// \`\`\` +// ### some: checks if at least one element in the collection passes the test implemented by the provided function. +// \`\`\`typescript +// const hasVariableA = root.find(j.VariableDeclarator).some(path => path.node.id.name === 'a'); +// \`\`\` +// ### map: Maps each node in the collection to a new value. +// \`\`\`typescript +// const variableNames = j.find(j.VariableDeclaration).map(path => path.node.declarations.map(decl => decl.id.name)); +// \`\`\` +// ### paths: Returns the paths of the found nodes. +// \`\`\`typescript +// const paths = j.find(j.VariableDeclaration).paths(); +// \`\`\` +// ### get: Gets the first node in the collection. +// \`\`\`typescript +// const firstVariableDeclaration = j.find(j.VariableDeclaration).get(); +// \`\`\` +// ### at: Navigates to a specific path in the AST. +// \`\`\`typescript +// const secondVariableDeclaration = j.find(j.VariableDeclaration).at(1); +// \`\`\` +// ### isOfType: checks if the node in the collection is of a specific type. +// \`\`\`typescript +// const isVariableDeclarator = root.find(j.VariableDeclarator).at(0).isOfType('VariableDeclarator'); +// \`\`\` +// `; + +// export function getCodemodPrompt(options: { +// type: "generate"; +// testCases: { before: string; after: string }[]; +// }): string; +// export function getCodemodPrompt(options: { +// type: "improve"; +// testCases: { before: string; after: string }[]; +// existingCodemodSource: string; +// }): string; +// export function getCodemodPrompt(options: { +// type: "improve" | "generate"; +// testCases: { before: string; after: string }[]; +// existingCodemodSource?: string; +// }) { +// const { type, testCases, existingCodemodSource } = options; + +// return `${type === "generate" ? generateCodemodContext : improveCodemodContext} +// ${ +// type === "improve" +// ? `\n\n### Existing Codemod +// \`\`\`typescript +// ${existingCodemodSource} +// \`\`\` +// ` +// : "" +// } +// ### Input Snippets +// ${testCases +// .map( +// ({ before, after }, i) => `## Input ${i + 1} +// **BEFORE**: +// \`\`\`typescript +// ${before} +// \`\`\` +// **AFTER**: +// \`\`\`typescript +// ${after} +// \`\`\` +// `, +// ) +// .join("\n")} +// ${jscodeshiftUsageExamples} +// `; +// } diff --git a/apps/cli/src/utils/download.ts b/apps/cli/src/utils/download.ts index 21ba6eab3..52be3ce0a 100644 --- a/apps/cli/src/utils/download.ts +++ b/apps/cli/src/utils/download.ts @@ -35,3 +35,19 @@ export const downloadFile = async (options: { return { data: buffer, path, cached: false }; }; + +export async function* streamingFetch(fetchCall: () => Promise) { + const response = await fetchCall(); + // Attach Reader + const reader = response.body?.getReader(); + if (!reader) return; + + while (true) { + // wait for next encoded chunk + const { done, value } = await reader.read(); + // check if stream is done + if (done) break; + // Decodes data chunk and yields it + yield value; + } +} diff --git a/apps/frontend/.env.example b/apps/frontend/.env.example index 04bf796c2..2d333bab0 100644 --- a/apps/frontend/.env.example +++ b/apps/frontend/.env.example @@ -1,18 +1,19 @@ -NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="YOUR_CLERK_PUBLISHABLE_KEY" -NEXT_PUBLIC_AUTH_API_URL='http://localhost:8080' +NEXT_PUBLIC_AUTH_API_URL="http://localhost:8080" NEXT_PUBLIC_API_URL="http://localhost:8081" -NEXT_PUBLIC_AUTH_API_URL='http://localhost:8082' -NEXT_PUBLIC_WS_URL='ws://localhost:8000' -X_CODEMODCOM_ACCESS_TOKEN="ACCESS_TOKEN" -DUBCO_WORKSPACE_ID="ws_abcde123" -DUBCO_API_TOKEN="qweasdzxc123" +NEXT_PUBLIC_MODGPT_API_URL="http://localhost:8082" +NEXT_PUBLIC_CODEMODAI_API_URL="http://localhost:8091" + +NEXT_PUBLIC_BASE_URL="" +NEXT_PUBLIC_CODEMOD_AUTOMATIONS_LIST_ENDPOINT="" +NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="" + +DUBCO_WORKSPACE_ID="" +DUBCO_API_TOKEN="" HUBSPOT_CONTACT_FORM_ID="" HUBSPOT_JOB_FORM_ID="" HUBSPOT_NEWSLETTER_FORM_ID="" HUBSPOT_PORTAL_ID="" -NEXT_PUBLIC_BASE_URL="" -NEXT_PUBLIC_CODEMOD_AUTOMATIONS_LIST_ENDPOINT="" NEXT_PUBLIC_SANITY_DATASET="" NEXT_PUBLIC_SANITY_PROJECT_ID="" NX_DAEMON="" @@ -20,8 +21,8 @@ SANITY_API_TOKEN="" SANITY_API_WRITE_TOKEN="" TURBO_REMOTE_ONLY="" TURBO_RUN_SUMMARY="" -VERCEL="1" -VERCEL_ENV="development" +VERCEL="" +VERCEL_ENV="" VERCEL_GIT_COMMIT_AUTHOR_LOGIN="" VERCEL_GIT_COMMIT_AUTHOR_NAME="" VERCEL_GIT_COMMIT_MESSAGE="" diff --git a/apps/frontend/env.ts b/apps/frontend/env.ts index 095126fd3..5bfe688aa 100644 --- a/apps/frontend/env.ts +++ b/apps/frontend/env.ts @@ -26,7 +26,9 @@ export const env = createEnv({ NEXT_PUBLIC_API_URL: z.string(), NEXT_PUBLIC_AUTH_API_URL: z.string(), NEXT_PUBLIC_AI_API_URL: z.string(), - NEXT_PUBLIC_WS_URL: z.string(), + NEXT_PUBLIC_MODGPT_API_URL: z.string(), + NEXT_PUBLIC_CODEMODAI_API_URL: z.string(), + NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: z.string(), NEXT_PUBLIC_SANITY_PROJECT_ID: z.string(), NEXT_PUBLIC_SANITY_DATASET: z.string(), @@ -41,13 +43,15 @@ export const env = createEnv({ * middlewares) or client-side so we need to destruct manually. */ runtimeEnv: { - NODE_ENV: process.env.NODE_ENV, - DUBCO_WORKSPACE_ID: process.env.DUBCO_WORKSPACE_ID, - DUBCO_API_TOKEN: process.env.DUBCO_API_TOKEN, NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL, NEXT_PUBLIC_AUTH_API_URL: process.env.NEXT_PUBLIC_AUTH_API_URL, NEXT_PUBLIC_AI_API_URL: process.env.NEXT_PUBLIC_AI_API_URL, - NEXT_PUBLIC_WS_URL: process.env.NEXT_PUBLIC_WS_URL, + NEXT_PUBLIC_MODGPT_API_URL: process.env.NEXT_PUBLIC_MODGPT_API_URL, + NEXT_PUBLIC_CODEMODAI_API_URL: process.env.NEXT_PUBLIC_CODEMODAI_API_URL, + + NODE_ENV: process.env.NODE_ENV, + DUBCO_WORKSPACE_ID: process.env.DUBCO_WORKSPACE_ID, + DUBCO_API_TOKEN: process.env.DUBCO_API_TOKEN, NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY, SANITY_API_TOKEN: process.env.SANITY_API_TOKEN, diff --git a/apps/frontend/package.json b/apps/frontend/package.json index 75af2b0ba..c4b3c6e0e 100644 --- a/apps/frontend/package.json +++ b/apps/frontend/package.json @@ -75,7 +75,7 @@ "@types/ramda": "catalog:", "@vercel/analytics": "catalog:", "@vercel/stega": "catalog:", - "ai": "^2.1.32", + "ai": "catalog:", "ast-node-builder": "catalog:", "ast-types": "catalog:", "axios": "catalog:", @@ -134,7 +134,7 @@ "sanity-plugin-documents-pane": "catalog:", "sanity-plugin-media": "catalog:", "sanity-plugin-mux-input": "catalog:", - "semver": "^7.6.2", + "semver": "catalog:", "server-only": "catalog:", "socket.io": "catalog:", "socket.io-client": "catalog:", @@ -171,7 +171,7 @@ "@types/react-syntax-highlighter": "catalog:", "@types/react-treeview": "catalog:", "@types/react-virtualized-auto-sizer": "catalog:", - "@types/semver": "^7.5.8", + "@types/semver": "catalog:", "@types/testing-library__jest-dom": "catalog:", "assert": "catalog:", "autoprefixer": "catalog:", diff --git a/apps/modgpt/Dockerfile b/apps/modgpt/Dockerfile index 25eb106fa..bb772e0eb 100644 --- a/apps/modgpt/Dockerfile +++ b/apps/modgpt/Dockerfile @@ -7,6 +7,7 @@ RUN npm install -g pnpm COPY package.json turbo.json pnpm-workspace.yaml pnpm-lock.yaml ./ COPY apps/modgpt/package.json apps/modgpt/ +COPY apps/modgpt/reset.d.ts apps/modgpt/ COPY packages/tsconfig packages/tsconfig/ COPY packages/utilities packages/utilities/ COPY packages/filemod packages/filemod/ diff --git a/apps/modgpt/package.json b/apps/modgpt/package.json index 1180c5343..7add50dfa 100644 --- a/apps/modgpt/package.json +++ b/apps/modgpt/package.json @@ -10,16 +10,17 @@ "author": "Codemod inc.", "license": "ISC", "dependencies": { + "@codemod-com/api-types": "workspace:*", "@codemod-com/auth": "workspace:*", "@fastify/cors": "catalog:", "@fastify/multipart": "catalog:", "@fastify/rate-limit": "catalog:", - "ai": "2.2.29", + "ai": "catalog:", "axios": "catalog:", "chatgpt": "catalog:", "dotenv": "catalog:", "fastify": "catalog:", - "openai-edge": "catalog:", + "openai": "catalog:", "replicate": "catalog:", "ts-node": "^10.9.2", "ts-node-dev": "catalog:", diff --git a/apps/modgpt/reset.d.ts b/apps/modgpt/reset.d.ts new file mode 100644 index 000000000..e6307a6aa --- /dev/null +++ b/apps/modgpt/reset.d.ts @@ -0,0 +1,2 @@ +// Do not add any other lines of code to this file! +import "@total-typescript/ts-reset"; \ No newline at end of file diff --git a/apps/modgpt/src/routes/sendChat.ts b/apps/modgpt/src/routes/sendChat.ts index 62b2ebab7..309a9d14e 100644 --- a/apps/modgpt/src/routes/sendChat.ts +++ b/apps/modgpt/src/routes/sendChat.ts @@ -1,95 +1,129 @@ import type { IncomingMessage, ServerResponse } from "node:http"; import { OpenAIStream } from "ai"; -import { ChatGPTAPI, type ChatMessage } from "chatgpt"; -import * as openAiEdge from "openai-edge"; +import OpenAI from "openai"; + +import { + type ApiResponse, + BAD_REQUEST, + INTERNAL_SERVER_ERROR, +} from "@codemod-com/api-types"; +import type { MultipartFile } from "@fastify/multipart"; +import { corsDisableHeaders } from "src/dev-utils/cors.js"; import { environment } from "../dev-utils/configs.js"; -import { corsDisableHeaders } from "../dev-utils/cors.js"; import type { Instance } from "../fastifyInstance.js"; -import { parseSendChatBody, roles } from "../schemata/schema.js"; +import { parseSendChatBody } from "../schemata/schema.js"; import { ClaudeService } from "../services/claudeService.js"; import { ReplicateService } from "../services/replicateService.js"; const { OPEN_AI_API_KEY, CLAUDE_API_KEY, REPLICATE_API_KEY, NODE_ENV } = environment; -const OpenAIConfiguration = openAiEdge.Configuration; - -const COMPLETION_PARAMS = { - top_p: 0.1, - temperature: 0.2, - model: "gpt-4", -}; +const claudeService = new ClaudeService(CLAUDE_API_KEY, 1024); +const replicateService = new ReplicateService(REPLICATE_API_KEY); -const chatGptApi = new ChatGPTAPI({ +const openai = new OpenAI({ apiKey: OPEN_AI_API_KEY, - completionParams: COMPLETION_PARAMS, }); -const claudeService = new ClaudeService(CLAUDE_API_KEY, 1024); -const replicateService = new ReplicateService(REPLICATE_API_KEY); -const openAiEdgeApi = new openAiEdge.OpenAIApi( - new OpenAIConfiguration({ apiKey: OPEN_AI_API_KEY }), -); export const getSendChatPath = (instance: Instance) => - instance.post( + instance.post<{ + Reply: ApiResponse< + Awaited> | string + >; + }>( "/sendChat", { preHandler: instance.authenticate }, async (request, reply) => { const { messages, engine } = parseSendChatBody(request.body); - if (!messages[0]) { - return reply.code(400).send(); - } - const systemPrompt = { - role: roles[0], + const systemPrompt: (typeof messages)[number] = { + role: "system", content: "Please focus on providing assistance primarily with code-related tasks, including but not limited to programming, debugging, software, algorithm design, code optimization, code migration, and codemod generation. Additionally, address related topics such as best practices, tool recommendations, technical documentation, and explanations of programming concepts. Avoid discussions unrelated to coding and technical topics unless they are to clarify or enhance the understanding of the code-related matter at hand.", }; messages.unshift(systemPrompt); - let completion: string | ChatMessage | null = null; + let completion: + | Awaited> + | string + | null = null; + try { - if (engine === "claude-2.0" || engine === "claude-instant-1.2") { - completion = await claudeService.complete( - engine, - messages[0].content, - ); - } else if (engine === "replit-code-v1-3b") { - completion = await replicateService.complete(messages[0].content); - } else if (engine === "gpt-4-with-chroma") { - const prompt = messages - .map(({ content, role }) => `${role}: ${content}`) - .join("\n"); - completion = await chatGptApi.sendMessage(prompt); - } else if (openAiEdgeApi) { - const response = await openAiEdgeApi.createChatCompletion({ - ...COMPLETION_PARAMS, - model: engine, - messages: messages.map((msg) => ({ - role: msg.role, - content: msg.content, - })), - stream: true, + switch (engine) { + case "claude-2.0": + case "claude-instant-1.2": + completion = await claudeService.complete( + engine, + messages[0].content, + ); + break; + case "replit-code-v1-3b": + completion = await replicateService.complete(messages[0].content); + break; + case "gpt-4-with-chroma": + completion = await openai.chat.completions.create({ + messages, + model: engine ?? "gpt-4", + }); + break; + } + + if (completion) { + return reply.type("text/plain; charset=utf-8").send(completion); + } + + const files: MultipartFile[] = []; + for await (const multipartFile of request.files({ + // 15 MB + limits: { fileSize: 1024 * 1024 * 15 }, + })) { + files.push(multipartFile); + } + + if (files.length > 1) { + return reply.status(400).send({ + errorText: "Only one file is allowed", + error: BAD_REQUEST, + }); + } + + if (files[0]) { + await openai.files.create({ + file: await OpenAI.toFile(files[0].toBuffer(), "codemod.zip"), + purpose: "fine-tune", }); - const headers = corsDisableHeaders; - - const stream = OpenAIStream(response); - reply.raw.writeHead(200, headers); - reply.hijack(); - const reader = stream.getReader(); - await pushStreamToReply(reader, reply.raw); - } else { - throw new Error( - "You need to provide the OPEN_AI_API_KEY to use this endpoint", - ); } - if (!reply.sent && completion) { - reply.type("text/plain; charset=utf-8").send(completion); + const response = await openai.chat.completions.create({ + top_p: 0.1, + temperature: 0.2, + model: engine ?? "gpt-4", + messages, + stream: true, + }); + + const headers = corsDisableHeaders; + const stream = OpenAIStream(response); + reply.raw.writeHead(200, headers); + reply.hijack(); + + const reader = stream.getReader(); + while (true) { + const { done, value } = await reader.read(); + + if (done) { + break; + } + reply.raw.write(value); } + + return reply.raw.end() as any; } catch (error) { console.error(error); - reply.send(error); + reply.send({ + errorText: (error as Error).message, + error: INTERNAL_SERVER_ERROR, + }); } }, ); diff --git a/apps/modgpt/src/schemata/schema.ts b/apps/modgpt/src/schemata/schema.ts index 991c25ac6..29c2ad837 100644 --- a/apps/modgpt/src/schemata/schema.ts +++ b/apps/modgpt/src/schemata/schema.ts @@ -1,24 +1,33 @@ import { - array, literal, object, optional, parse, string, + tupleWithRest, union, } from "valibot"; -export const roles = ["system", "user", "assistant", "function"] as const; +export const roles = ["system", "user", "assistant"] as const; +export const rolesWithName = ["function"] as const; +export const allRoles = [...roles, ...rolesWithName] as const; + +const chatMessageSchema = union([ + object({ + content: string(), + role: union(rolesWithName.map((r) => literal(r))), + name: string(), + }), + object({ + content: string(), + role: union(roles.map((r) => literal(r))), + name: optional(string()), + }), +]); export const sendChatBodySchema = object({ - messages: array( - object({ - content: string(), - role: union(roles.map((role) => literal(role))), - name: optional(string()), - }), - ), - engine: string(), + messages: tupleWithRest([chatMessageSchema], chatMessageSchema), + engine: optional(string()), }); export const parseSendChatBody = (input: unknown) => diff --git a/apps/modgpt/tsconfig.json b/apps/modgpt/tsconfig.json index 7a35fef97..88280da79 100644 --- a/apps/modgpt/tsconfig.json +++ b/apps/modgpt/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "baseUrl": "." }, - "include": ["src/**/*"], + "include": ["reset.d.ts", "src/**/*"], "exclude": ["node_modules", "**/*.spec.ts"], "extends": "@codemod-com/tsconfig/backend.json" } diff --git a/apps/vsce/package.json b/apps/vsce/package.json index 7c9201e0f..84ed65ff8 100644 --- a/apps/vsce/package.json +++ b/apps/vsce/package.json @@ -187,12 +187,11 @@ "package": "vsce package --no-dependencies --no-yarn" }, "devDependencies": { - "@total-typescript/ts-reset": "catalog:", "@types/chai": "catalog:", "@types/diff": "catalog:", "@types/glob": "catalog:", "@types/node": "18.11.18", - "@types/semver": "^7.3.13", + "@types/semver": "catalog:", "@types/vscode": "catalog:", "@vscode/test-electron": "catalog:", "chai": "catalog:", @@ -224,7 +223,7 @@ "newtype-ts": "catalog:", "nock": "catalog:", "redux-persist": "catalog:", - "semver": "^7.3.8", + "semver": "catalog:", "ts-morph": "^19.0.0", "universal-base64url": "catalog:", "valibot": "catalog:" diff --git a/package.json b/package.json index c3915f5d7..3661b78fb 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "@biomejs/biome": "^1.6.4", "@codemod-com/tsconfig": "workspace:*", "@codemod-com/utilities": "workspace:*", - "@total-typescript/ts-reset": "^0.4.2", + "@total-typescript/ts-reset": "catalog:", "@types/node": "^20.5.1", "@vitest/coverage-v8": "^1.0.1", "commitizen": "^4.3.0", diff --git a/packages/api-types/src/errors.ts b/packages/api-types/src/errors.ts index 0aca0f21b..c68f2ce9f 100644 --- a/packages/api-types/src/errors.ts +++ b/packages/api-types/src/errors.ts @@ -1,3 +1,4 @@ +export const BAD_REQUEST = "BAD_REQUEST"; export const UNAUTHORIZED = "UNAUTHORIZED"; export const INTERNAL_SERVER_ERROR = "INTERNAL_SERVER_ERROR"; diff --git a/packages/database/prisma/migrations/20240817021641_multiple_diffs/migration.sql b/packages/database/prisma/migrations/20240817021641_multiple_diffs/migration.sql new file mode 100644 index 000000000..6647c77cb --- /dev/null +++ b/packages/database/prisma/migrations/20240817021641_multiple_diffs/migration.sql @@ -0,0 +1,12 @@ +/* + Warnings: + + - You are about to drop the column `after` on the `CodeDiff` table. All the data in the column will be lost. + - You are about to drop the column `before` on the `CodeDiff` table. All the data in the column will be lost. + - Added the required column `diffs` to the `CodeDiff` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE "CodeDiff" DROP COLUMN "after", +DROP COLUMN "before", +ADD COLUMN "diffs" TEXT NOT NULL; diff --git a/packages/database/prisma/schema.prisma b/packages/database/prisma/schema.prisma index c41f22ae5..70b7ba6d9 100644 --- a/packages/database/prisma/schema.prisma +++ b/packages/database/prisma/schema.prisma @@ -86,8 +86,8 @@ model CodeDiff { id String @id @unique @default(dbgenerated("uuid_generate_v4()")) @db.Uuid name String? @db.VarChar(255) source String @db.VarChar(255) - before String @db.Text - after String @db.Text + // Stringified encoded JSON + diffs String createdAt DateTime @default(now()) updatedAt DateTime @default(now()) @updatedAt } diff --git a/packages/utilities/package.json b/packages/utilities/package.json index a0dd746e0..97eb9b511 100644 --- a/packages/utilities/package.json +++ b/packages/utilities/package.json @@ -33,7 +33,7 @@ "@types/ms": "catalog:", "@types/node": "20.10.3", "@types/pako": "catalog:", - "@types/semver": "^7.5.8", + "@types/semver": "catalog:", "@types/tar": "catalog:", "@types/tar-stream": "catalog:", "@types/unzipper": "catalog:", @@ -52,7 +52,7 @@ "ms": "catalog:", "pako": "catalog:", "prettier": "^3.2.5", - "semver": "^7.6.2", + "semver": "catalog:", "tar": "^6.1.15", "tar-stream": "catalog:", "unzipper": "catalog:", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0d46c8861..51b5811f7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -330,6 +330,9 @@ catalogs: adm-zip: specifier: ^0.5.14 version: 0.5.14 + ai: + specifier: ^3.3.9 + version: 3.3.9 applicationinsights: specifier: ^2.9.1 version: 2.9.5 @@ -586,8 +589,8 @@ catalogs: specifier: ^8.4.2 version: 8.4.2 openai: - specifier: 4.23.0 - version: 4.23.0 + specifier: ^4.56.0 + version: 4.56.0 openai-edge: specifier: 1.2.2 version: 1.2.2 @@ -1017,7 +1020,7 @@ importers: version: 5.2.5 chromadb: specifier: 'catalog:' - version: 1.7.2(openai@4.23.0) + version: 1.7.2(openai@4.56.0(zod@3.22.3)) cron: specifier: 'catalog:' version: 3.1.7 @@ -1035,10 +1038,10 @@ importers: version: 5.4.1 langchain: specifier: 'catalog:' - version: 0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) + version: 0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) openai: specifier: 'catalog:' - version: 4.23.0 + version: 4.56.0(zod@3.22.3) openai-edge: specifier: 'catalog:' version: 1.2.2 @@ -1408,8 +1411,8 @@ importers: specifier: 'catalog:' version: 0.1.2 ai: - specifier: ^2.1.32 - version: 2.2.29(react@18.2.0)(solid-js@1.8.17)(svelte@4.2.18)(vue@3.4.30(typescript@5.5.3)) + specifier: 'catalog:' + version: 3.3.9(openai@4.56.0(zod@3.22.3))(react@18.2.0)(solid-js@1.8.17)(sswr@2.1.0(svelte@4.2.18))(svelte@4.2.18)(vue@3.4.30(typescript@5.5.3))(zod@3.22.3) ast-node-builder: specifier: 'catalog:' version: 4.2.1 @@ -1760,8 +1763,8 @@ importers: specifier: 'catalog:' version: 9.0.1 ai: - specifier: 2.2.29 - version: 2.2.29(react@18.2.0)(solid-js@1.8.17)(svelte@4.2.18)(vue@3.4.30(typescript@5.5.3)) + specifier: 'catalog:' + version: 3.3.9(openai@4.56.0(zod@3.23.8))(react@18.2.0)(solid-js@1.8.17)(sswr@2.1.0(svelte@4.2.18))(svelte@4.2.18)(vue@3.4.30(typescript@5.5.3))(zod@3.23.8) axios: specifier: 'catalog:' version: 1.7.2 @@ -6616,7 +6619,7 @@ importers: version: 0.30.10 openai: specifier: 'catalog:' - version: 4.23.0 + version: 4.56.0(zod@3.23.8) prettier: specifier: ^3.2.5 version: 3.3.2 @@ -6660,6 +6663,67 @@ packages: '@adobe/css-tools@4.4.0': resolution: {integrity: sha512-Ff9+ksdQQB3rMncgqDK78uLznstjyfIf2Arnh22pW8kBpLs6rpKDwgnZT46hin5Hl1WzazzK64DOrhSwYpS7bQ==} + '@ai-sdk/provider-utils@1.0.13': + resolution: {integrity: sha512-NDQUUBDQoWk9aGn2pOA5wiM5CdO57KeYTEph7PpKGEU8IyqI0d+CiYKISOia6Omy17d+Dw/ZM6KP98F89BGJ5A==} + engines: {node: '>=18'} + peerDependencies: + zod: ^3.0.0 + peerDependenciesMeta: + zod: + optional: true + + '@ai-sdk/provider@0.0.20': + resolution: {integrity: sha512-nCQZRUTi/+y+kf1ep9rujpbQEtsIwySzlQAudiFeVhzzDi9rYvWp5tOSVu8/ArT+i1xSc2tw40akxb1TX73ofQ==} + engines: {node: '>=18'} + + '@ai-sdk/react@0.0.45': + resolution: {integrity: sha512-rPsjHtJ+qsWoRV88xzEpvPXhqRBF2wljGjWrsFcao4p48hKwZkuhW/zzpxZj3A4ZPy6jpDHRTYtqMuPHVpc9Eg==} + engines: {node: '>=18'} + peerDependencies: + react: ^18 || ^19 + zod: ^3.0.0 + peerDependenciesMeta: + react: + optional: true + zod: + optional: true + + '@ai-sdk/solid@0.0.36': + resolution: {integrity: sha512-pm57goMQczSpPTNrUrwbab5BybZYofBRZ10UkTi2KgJP5i+S/sGHSh/xtgZz+xNpUt42pk8aYvOiNDN1ppjkDA==} + engines: {node: '>=18'} + peerDependencies: + solid-js: ^1.7.7 + peerDependenciesMeta: + solid-js: + optional: true + + '@ai-sdk/svelte@0.0.38': + resolution: {integrity: sha512-sTNkxzhS1B0TDdVWZR6yXG+3qQGYAxMwcEKzMVjm1VdpGlZits1PxF39aVvPldaWM8QB4MrVE+H5b5dTA43D0Q==} + engines: {node: '>=18'} + peerDependencies: + svelte: ^3.0.0 || ^4.0.0 + peerDependenciesMeta: + svelte: + optional: true + + '@ai-sdk/ui-utils@0.0.33': + resolution: {integrity: sha512-2oZjZzZG3AGQihO1d3mWqgFuywTtjBtkUEeE7d8nicw3QQv9m1MwrbQqRhhKbbBetBke6V9o5FQ5wngmb/+3iw==} + engines: {node: '>=18'} + peerDependencies: + zod: ^3.0.0 + peerDependenciesMeta: + zod: + optional: true + + '@ai-sdk/vue@0.0.37': + resolution: {integrity: sha512-m7dMi6qRoWPuru9TyWUm5jXAPGSDb1SHZp/Q+uYjhNY1dZwgsZxJvSeakogzR37uhiRCg3Kg8fCypQJe+dikPA==} + engines: {node: '>=18'} + peerDependencies: + vue: ^3.3.4 + peerDependenciesMeta: + vue: + optional: true + '@alloc/quick-lru@5.2.0': resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==} engines: {node: '>=10'} @@ -11928,6 +11992,9 @@ packages: '@types/debug@4.1.12': resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==} + '@types/diff-match-patch@1.0.36': + resolution: {integrity: sha512-xFdR6tkm0MWvBfO8xXCSsinYxHcqkQUlcHeSpMC2ukzOb6lwQAfDmW+Qt0AvlGd8HpsS28qKsB+oPeJn9I39jg==} + '@types/diff@5.2.1': resolution: {integrity: sha512-uxpcuwWJGhe2AR1g8hD9F5OYGCqjqWnBUQFD8gMZsDbv8oPHzxJF6iMO6n8Tk0AdzlxoaaoQhOYlIg/PukVU8g==} @@ -12584,6 +12651,27 @@ packages: vue: optional: true + ai@3.3.9: + resolution: {integrity: sha512-PS6xHzYIH+iVLG3xd/jwsqZW7+X8GrSrsJwVB4ACMbxhZN8KRs4yUcnGEDPcvRkEL3PqHHJFUo9iVysdZwOUwg==} + engines: {node: '>=18'} + peerDependencies: + openai: ^4.42.0 + react: ^18 || ^19 + sswr: ^2.1.0 + svelte: ^3.0.0 || ^4.0.0 + zod: ^3.0.0 + peerDependenciesMeta: + openai: + optional: true + react: + optional: true + sswr: + optional: true + svelte: + optional: true + zod: + optional: true + ajv-formats@2.1.1: resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} peerDependencies: @@ -15798,6 +15886,9 @@ packages: json-schema-typed@8.0.1: resolution: {integrity: sha512-XQmWYj2Sm4kn4WeTYvmpKEbyPsL7nBsb647c7pMe6l02/yx2+Jfc4dT6UZkEXnIUb5LhD55r2HPsJ1milQ4rDg==} + json-schema@0.4.0: + resolution: {integrity: sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==} + json-stable-stringify-without-jsonify@1.0.1: resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} @@ -15816,6 +15907,11 @@ packages: jsonc-parser@3.2.1: resolution: {integrity: sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==} + jsondiffpatch@0.6.0: + resolution: {integrity: sha512-3QItJOXp2AP1uv7waBkao5nCvhEv+QmJAd38Ybq7wNI74Q+BBmnLn4EDKz6yI9xGAIQoUF87qHt+kc1IVxB4zQ==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} @@ -17268,9 +17364,14 @@ packages: resolution: {integrity: sha512-ey2CXh1OTcTUa0AWZWuTpgA9t5GuAG3DVU1MofCRUI7fQJij8XJ3Sr0VtgxoAE69C9wbHBMCux8Z/IQZfSwHiA==} hasBin: true - openai@4.52.0: - resolution: {integrity: sha512-xmiNcdA9QJ5wffHpZDpIsge6AsPTETJ6h5iqDNuFQ7qGSNtonHn8Qe0VHy4UwLE8rBWiSqh4j+iSvuYZSeKkPg==} + openai@4.56.0: + resolution: {integrity: sha512-zcag97+3bG890MNNa0DQD9dGmmTWL8unJdNkulZzWRXrl+QeD+YkBI4H58rJcwErxqGK6a0jVPZ4ReJjhDGcmw==} hasBin: true + peerDependencies: + zod: ^3.23.8 + peerDependenciesMeta: + zod: + optional: true openapi-types@12.1.3: resolution: {integrity: sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==} @@ -19186,6 +19287,11 @@ packages: peerDependencies: svelte: ^4.0.0 + sswr@2.1.0: + resolution: {integrity: sha512-Cqc355SYlTAaUt8iDPaC/4DPPXK925PePLMxyBKuWd5kKc5mwsG3nT9+Mq2tyguL5s7b4Jg+IRMpTRsNTAfpSQ==} + peerDependencies: + svelte: ^4.0.0 || ^5.0.0-next.0 + stack-chain@1.3.7: resolution: {integrity: sha512-D8cWtWVdIe/jBA7v5p5Hwl5yOSOrmZPWDPe2KxQ5UAGD+nxbxU0lKXA4h85Ta6+qgdKVL3vUxsbIZjc1kBG7ug==} @@ -20753,6 +20859,11 @@ packages: peerDependencies: zod: ^3.20.0 + zod-to-json-schema@3.22.5: + resolution: {integrity: sha512-+akaPo6a0zpVCCseDed504KBJUQpEW5QZw7RMneNmKw+fGaML1Z9tUNLnHHAC8x6dzVRO1eB2oEMyZRnuBZg7Q==} + peerDependencies: + zod: ^3.22.4 + zod-to-json-schema@3.23.1: resolution: {integrity: sha512-oT9INvydob1XV0v1d2IadrR74rLtDInLvDFfAa1CG0Pmg/vxATk7I2gSelfj271mbzeM4Da0uuDQE/Nkj3DWNw==} peerDependencies: @@ -20786,6 +20897,124 @@ snapshots: '@adobe/css-tools@4.4.0': {} + '@ai-sdk/provider-utils@1.0.13(zod@3.22.3)': + dependencies: + '@ai-sdk/provider': 0.0.20 + eventsource-parser: 1.1.2 + nanoid: 3.3.6 + secure-json-parse: 2.7.0 + optionalDependencies: + zod: 3.22.3 + + '@ai-sdk/provider-utils@1.0.13(zod@3.23.8)': + dependencies: + '@ai-sdk/provider': 0.0.20 + eventsource-parser: 1.1.2 + nanoid: 3.3.6 + secure-json-parse: 2.7.0 + optionalDependencies: + zod: 3.23.8 + + '@ai-sdk/provider@0.0.20': + dependencies: + json-schema: 0.4.0 + + '@ai-sdk/react@0.0.45(react@18.2.0)(zod@3.22.3)': + dependencies: + '@ai-sdk/provider-utils': 1.0.13(zod@3.22.3) + '@ai-sdk/ui-utils': 0.0.33(zod@3.22.3) + swr: 2.2.5(react@18.2.0) + optionalDependencies: + react: 18.2.0 + zod: 3.22.3 + + '@ai-sdk/react@0.0.45(react@18.2.0)(zod@3.23.8)': + dependencies: + '@ai-sdk/provider-utils': 1.0.13(zod@3.23.8) + '@ai-sdk/ui-utils': 0.0.33(zod@3.23.8) + swr: 2.2.5(react@18.2.0) + optionalDependencies: + react: 18.2.0 + zod: 3.23.8 + + '@ai-sdk/solid@0.0.36(solid-js@1.8.17)(zod@3.22.3)': + dependencies: + '@ai-sdk/provider-utils': 1.0.13(zod@3.22.3) + '@ai-sdk/ui-utils': 0.0.33(zod@3.22.3) + optionalDependencies: + solid-js: 1.8.17 + transitivePeerDependencies: + - zod + + '@ai-sdk/solid@0.0.36(solid-js@1.8.17)(zod@3.23.8)': + dependencies: + '@ai-sdk/provider-utils': 1.0.13(zod@3.23.8) + '@ai-sdk/ui-utils': 0.0.33(zod@3.23.8) + optionalDependencies: + solid-js: 1.8.17 + transitivePeerDependencies: + - zod + + '@ai-sdk/svelte@0.0.38(svelte@4.2.18)(zod@3.22.3)': + dependencies: + '@ai-sdk/provider-utils': 1.0.13(zod@3.22.3) + '@ai-sdk/ui-utils': 0.0.33(zod@3.22.3) + sswr: 2.1.0(svelte@4.2.18) + optionalDependencies: + svelte: 4.2.18 + transitivePeerDependencies: + - zod + + '@ai-sdk/svelte@0.0.38(svelte@4.2.18)(zod@3.23.8)': + dependencies: + '@ai-sdk/provider-utils': 1.0.13(zod@3.23.8) + '@ai-sdk/ui-utils': 0.0.33(zod@3.23.8) + sswr: 2.1.0(svelte@4.2.18) + optionalDependencies: + svelte: 4.2.18 + transitivePeerDependencies: + - zod + + '@ai-sdk/ui-utils@0.0.33(zod@3.22.3)': + dependencies: + '@ai-sdk/provider': 0.0.20 + '@ai-sdk/provider-utils': 1.0.13(zod@3.22.3) + json-schema: 0.4.0 + secure-json-parse: 2.7.0 + zod-to-json-schema: 3.22.5(zod@3.22.3) + optionalDependencies: + zod: 3.22.3 + + '@ai-sdk/ui-utils@0.0.33(zod@3.23.8)': + dependencies: + '@ai-sdk/provider': 0.0.20 + '@ai-sdk/provider-utils': 1.0.13(zod@3.23.8) + json-schema: 0.4.0 + secure-json-parse: 2.7.0 + zod-to-json-schema: 3.22.5(zod@3.23.8) + optionalDependencies: + zod: 3.23.8 + + '@ai-sdk/vue@0.0.37(vue@3.4.30(typescript@5.5.3))(zod@3.22.3)': + dependencies: + '@ai-sdk/provider-utils': 1.0.13(zod@3.22.3) + '@ai-sdk/ui-utils': 0.0.33(zod@3.22.3) + swrv: 1.0.4(vue@3.4.30(typescript@5.5.3)) + optionalDependencies: + vue: 3.4.30(typescript@5.5.3) + transitivePeerDependencies: + - zod + + '@ai-sdk/vue@0.0.37(vue@3.4.30(typescript@5.5.3))(zod@3.23.8)': + dependencies: + '@ai-sdk/provider-utils': 1.0.13(zod@3.23.8) + '@ai-sdk/ui-utils': 0.0.33(zod@3.23.8) + swrv: 1.0.4(vue@3.4.30(typescript@5.5.3)) + optionalDependencies: + vue: 3.4.30(typescript@5.5.3) + transitivePeerDependencies: + - zod + '@alloc/quick-lru@5.2.0': {} '@ampproject/remapping@2.3.0': @@ -23844,13 +24073,13 @@ snapshots: '@kwsites/promise-deferred@1.1.1': {} - '@langchain/community@0.0.57(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(chromadb@1.7.2(openai@4.23.0))(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0)': + '@langchain/community@0.0.57(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0)': dependencies: - '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0) - '@langchain/openai': 0.0.34(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0)) + '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.22.3)) + '@langchain/openai': 0.0.34(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0)) expr-eval: 2.0.2 flat: 5.0.2 - langsmith: 0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0) + langsmith: 0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.22.3)))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.22.3)) uuid: 9.0.1 zod: 3.23.8 zod-to-json-schema: 3.23.1(zod@3.23.8) @@ -23858,7 +24087,7 @@ snapshots: '@aws-crypto/sha256-js': 5.2.0 '@aws-sdk/credential-provider-node': 3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0) '@smithy/util-utf8': 2.3.0 - chromadb: 1.7.2(openai@4.23.0) + chromadb: 1.7.2(openai@4.56.0(zod@3.22.3)) ioredis: 5.4.1 jsdom: 23.2.0 jsonwebtoken: 9.0.2 @@ -23871,13 +24100,13 @@ snapshots: - langchain - openai - '@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0)': + '@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.22.3))': dependencies: ansi-styles: 5.2.0 camelcase: 6.3.0 decamelize: 1.2.0 js-tiktoken: 1.0.12 - langsmith: 0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0) + langsmith: 0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.22.3)))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.22.3)) ml-distance: 4.0.1 mustache: 4.2.0 p-queue: 6.6.2 @@ -23889,13 +24118,13 @@ snapshots: - langchain - openai - '@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0)': + '@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.23.8))': dependencies: ansi-styles: 5.2.0 camelcase: 6.3.0 decamelize: 1.2.0 js-tiktoken: 1.0.12 - langsmith: 0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0) + langsmith: 0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.23.8)))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.23.8)) ml-distance: 4.0.1 mustache: 4.2.0 p-queue: 6.6.2 @@ -23907,11 +24136,11 @@ snapshots: - langchain - openai - '@langchain/openai@0.0.34(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))': + '@langchain/openai@0.0.34(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))': dependencies: - '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0) + '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.23.8)) js-tiktoken: 1.0.12 - openai: 4.52.0 + openai: 4.56.0(zod@3.23.8) zod: 3.23.8 zod-to-json-schema: 3.23.1(zod@3.23.8) transitivePeerDependencies: @@ -26735,6 +26964,8 @@ snapshots: dependencies: '@types/ms': 0.7.34 + '@types/diff-match-patch@1.0.36': {} + '@types/diff@5.2.1': {} '@types/eslint-scope@3.7.7': @@ -27659,6 +27890,58 @@ snapshots: svelte: 4.2.18 vue: 3.4.30(typescript@5.5.3) + ai@3.3.9(openai@4.56.0(zod@3.22.3))(react@18.2.0)(solid-js@1.8.17)(sswr@2.1.0(svelte@4.2.18))(svelte@4.2.18)(vue@3.4.30(typescript@5.5.3))(zod@3.22.3): + dependencies: + '@ai-sdk/provider': 0.0.20 + '@ai-sdk/provider-utils': 1.0.13(zod@3.22.3) + '@ai-sdk/react': 0.0.45(react@18.2.0)(zod@3.22.3) + '@ai-sdk/solid': 0.0.36(solid-js@1.8.17)(zod@3.22.3) + '@ai-sdk/svelte': 0.0.38(svelte@4.2.18)(zod@3.22.3) + '@ai-sdk/ui-utils': 0.0.33(zod@3.22.3) + '@ai-sdk/vue': 0.0.37(vue@3.4.30(typescript@5.5.3))(zod@3.22.3) + '@opentelemetry/api': 1.9.0 + eventsource-parser: 1.1.2 + json-schema: 0.4.0 + jsondiffpatch: 0.6.0 + nanoid: 3.3.6 + secure-json-parse: 2.7.0 + zod-to-json-schema: 3.22.5(zod@3.22.3) + optionalDependencies: + openai: 4.56.0(zod@3.22.3) + react: 18.2.0 + sswr: 2.1.0(svelte@4.2.18) + svelte: 4.2.18 + zod: 3.22.3 + transitivePeerDependencies: + - solid-js + - vue + + ai@3.3.9(openai@4.56.0(zod@3.23.8))(react@18.2.0)(solid-js@1.8.17)(sswr@2.1.0(svelte@4.2.18))(svelte@4.2.18)(vue@3.4.30(typescript@5.5.3))(zod@3.23.8): + dependencies: + '@ai-sdk/provider': 0.0.20 + '@ai-sdk/provider-utils': 1.0.13(zod@3.23.8) + '@ai-sdk/react': 0.0.45(react@18.2.0)(zod@3.23.8) + '@ai-sdk/solid': 0.0.36(solid-js@1.8.17)(zod@3.23.8) + '@ai-sdk/svelte': 0.0.38(svelte@4.2.18)(zod@3.23.8) + '@ai-sdk/ui-utils': 0.0.33(zod@3.23.8) + '@ai-sdk/vue': 0.0.37(vue@3.4.30(typescript@5.5.3))(zod@3.23.8) + '@opentelemetry/api': 1.9.0 + eventsource-parser: 1.1.2 + json-schema: 0.4.0 + jsondiffpatch: 0.6.0 + nanoid: 3.3.6 + secure-json-parse: 2.7.0 + zod-to-json-schema: 3.22.5(zod@3.23.8) + optionalDependencies: + openai: 4.56.0(zod@3.23.8) + react: 18.2.0 + sswr: 2.1.0(svelte@4.2.18) + svelte: 4.2.18 + zod: 3.23.8 + transitivePeerDependencies: + - solid-js + - vue + ajv-formats@2.1.1(ajv@8.16.0): optionalDependencies: ajv: 8.16.0 @@ -28334,12 +28617,12 @@ snapshots: chownr@3.0.0: {} - chromadb@1.7.2(openai@4.23.0): + chromadb@1.7.2(openai@4.56.0(zod@3.22.3)): dependencies: cliui: 8.0.1 isomorphic-fetch: 3.0.0 optionalDependencies: - openai: 4.23.0 + openai: 4.56.0(zod@3.22.3) transitivePeerDependencies: - encoding @@ -31474,6 +31757,8 @@ snapshots: json-schema-typed@8.0.1: {} + json-schema@0.4.0: {} + json-stable-stringify-without-jsonify@1.0.1: {} json-stringify-safe@5.0.1: {} @@ -31486,6 +31771,12 @@ snapshots: jsonc-parser@3.2.1: {} + jsondiffpatch@0.6.0: + dependencies: + '@types/diff-match-patch': 1.0.36 + chalk: 5.3.0 + diff-match-patch: 1.0.5 + jsonfile@6.1.0: dependencies: universalify: 2.0.1 @@ -31570,12 +31861,12 @@ snapshots: kolorist@1.8.0: {} - langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0): + langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0): dependencies: '@anthropic-ai/sdk': 0.9.1 - '@langchain/community': 0.0.57(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(chromadb@1.7.2(openai@4.23.0))(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) - '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0) - '@langchain/openai': 0.0.34(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0)) + '@langchain/community': 0.0.57(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) + '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.22.3)) + '@langchain/openai': 0.0.34(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0)) binary-extensions: 2.3.0 expr-eval: 2.0.2 js-tiktoken: 1.0.12 @@ -31595,7 +31886,7 @@ snapshots: '@aws-sdk/credential-provider-node': 3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0) axios: 1.7.2 cheerio: 1.0.0-rc.12 - chromadb: 1.7.2(openai@4.23.0) + chromadb: 1.7.2(openai@4.56.0(zod@3.22.3)) ignore: 5.3.1 ioredis: 5.4.1 jsdom: 23.2.0 @@ -31681,7 +31972,7 @@ snapshots: p-retry: 4.6.2 uuid: 9.0.1 - langsmith@0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0): + langsmith@0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.22.3)))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.22.3)): dependencies: '@types/uuid': 9.0.8 commander: 10.0.1 @@ -31689,11 +31980,11 @@ snapshots: p-retry: 4.6.2 uuid: 9.0.1 optionalDependencies: - '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.23.0) - langchain: 0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) - openai: 4.23.0 + '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.22.3)) + langchain: 0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) + openai: 4.56.0(zod@3.22.3) - langsmith@0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0): + langsmith@0.1.32(@langchain/core@0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.23.8)))(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.23.8)): dependencies: '@types/uuid': 9.0.8 commander: 10.0.1 @@ -31701,9 +31992,9 @@ snapshots: p-retry: 4.6.2 uuid: 9.0.1 optionalDependencies: - '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.52.0) - langchain: 0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.23.0))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.23.0)(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) - openai: 4.52.0 + '@langchain/core': 0.1.63(langchain@0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0))(openai@4.56.0(zod@3.23.8)) + langchain: 0.0.209(@aws-crypto/sha256-js@5.2.0)(@aws-sdk/client-s3@3.600.0)(@aws-sdk/credential-provider-node@3.600.0(@aws-sdk/client-sso-oidc@3.600.0)(@aws-sdk/client-sts@3.600.0))(@smithy/util-utf8@2.3.0)(axios@1.7.2)(cheerio@1.0.0-rc.12)(chromadb@1.7.2(openai@4.56.0(zod@3.22.3)))(ignore@5.3.1)(ioredis@5.4.1)(jsdom@23.2.0)(jsonwebtoken@9.0.2)(lodash@4.17.21)(openai@4.56.0(zod@3.22.3))(pg@8.12.0)(replicate@0.25.2)(ws@8.18.0) + openai: 4.56.0(zod@3.23.8) language-subtag-registry@0.3.23: {} @@ -33260,7 +33551,7 @@ snapshots: transitivePeerDependencies: - encoding - openai@4.52.0: + openai@4.56.0(zod@3.22.3): dependencies: '@types/node': 18.11.18 '@types/node-fetch': 2.6.11 @@ -33269,7 +33560,22 @@ snapshots: form-data-encoder: 1.7.2 formdata-node: 4.4.1 node-fetch: 2.7.0 - web-streams-polyfill: 3.3.3 + optionalDependencies: + zod: 3.22.3 + transitivePeerDependencies: + - encoding + + openai@4.56.0(zod@3.23.8): + dependencies: + '@types/node': 18.11.18 + '@types/node-fetch': 2.6.11 + abort-controller: 3.0.0 + agentkeepalive: 4.5.0 + form-data-encoder: 1.7.2 + formdata-node: 4.4.1 + node-fetch: 2.7.0 + optionalDependencies: + zod: 3.23.8 transitivePeerDependencies: - encoding @@ -35516,6 +35822,11 @@ snapshots: svelte: 4.2.18 swrev: 4.0.0 + sswr@2.1.0(svelte@4.2.18): + dependencies: + svelte: 4.2.18 + swrev: 4.0.0 + stack-chain@1.3.7: {} stack-generator@2.0.10: @@ -37762,6 +38073,14 @@ snapshots: dependencies: zod: 3.23.8 + zod-to-json-schema@3.22.5(zod@3.22.3): + dependencies: + zod: 3.22.3 + + zod-to-json-schema@3.22.5(zod@3.23.8): + dependencies: + zod: 3.23.8 + zod-to-json-schema@3.23.1(zod@3.23.8): dependencies: zod: 3.23.8 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 16205216b..35d3f9c32 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -95,6 +95,7 @@ catalog: "@types/react-treeview": ^0.4.3 "@types/react-virtualized": ^9.21.21 "@types/react-virtualized-auto-sizer": ^1.0.1 + "@types/semver": ^7.5.8 "@types/supertest": ^6.0.2 "@types/tar": ^6.1.11 "@types/tar-stream": ^3.1.3 @@ -112,6 +113,7 @@ catalog: "@vscode/webview-ui-toolkit": ^1.2.2 "@vue/compiler-sfc": ^3.4.21 adm-zip: ^0.5.14 + ai: ^3.3.9 applicationinsights: ^2.9.1 assert: ^2.0.0 ast-node-builder: ^4.2.1 @@ -197,7 +199,7 @@ catalog: node-fetch: ^3.3.2 null-loader: ^4.0.1 open: ^8.4.2 - openai: 4.23.0 + openai: ^4.56.0 openai-edge: 1.2.2 ora: ^8.0.1 os-browserify: ^0.3.0 @@ -242,6 +244,7 @@ catalog: sanity-plugin-media: ^2.2.5 sanity-plugin-mux-input: ^2.2.4 server-only: 0.0.1 + semver: ^7.6.0 simple-git: ^3.24.0 sinon: ^15.0.1 socket.io: ^4.7.5