From a07e5c6ec15aec393c311ff372e9cf93464b130e Mon Sep 17 00:00:00 2001 From: Abhin Rustagi Date: Thu, 10 Sep 2026 12:48:37 +0530 Subject: [PATCH 1/4] Add artifactTool on @openuidev/lang-core/cloud Move the Cloud artifact tool helper off thesys-server so callers can import it from lang-core without pulling Cloud APIs onto the main parser export. --- docs/app/api/openui-cloud/chat/route.ts | 2 +- docs/package.json | 1 - packages/lang-core/README.md | 17 ++++ packages/lang-core/package.json | 17 ++++ .../lang-core/src/__tests__/cloud.test.ts | 77 +++++++++++++++ packages/lang-core/src/cloud.ts | 95 +++++++++++++++++++ packages/lang-core/tsdown.config.ts | 2 +- pnpm-lock.yaml | 8 -- 8 files changed, 208 insertions(+), 11 deletions(-) create mode 100644 packages/lang-core/src/__tests__/cloud.test.ts create mode 100644 packages/lang-core/src/cloud.ts diff --git a/docs/app/api/openui-cloud/chat/route.ts b/docs/app/api/openui-cloud/chat/route.ts index 4dfe8f064..d4519e9ee 100644 --- a/docs/app/api/openui-cloud/chat/route.ts +++ b/docs/app/api/openui-cloud/chat/route.ts @@ -3,7 +3,7 @@ import { unavailableResponse } from "@/lib/openui-cloud/errors"; import { resolveRequestedModel } from "@/lib/openui-cloud/models"; import { hasAllowedOrigin, hasJsonContentType, readLimitedJson } from "@/lib/openui-cloud/request"; import { generateSystemPrompt } from "@openuidev/lang-core"; -import { artifactTool } from "@openuidev/thesys-server"; +import { artifactTool } from "@openuidev/lang-core/cloud"; import OpenAI from "openai"; import type { ResponseInputItem } from "openai/resources/responses/responses"; diff --git a/docs/package.json b/docs/package.json index f42c2d6cf..b31650421 100644 --- a/docs/package.json +++ b/docs/package.json @@ -24,7 +24,6 @@ "@openuidev/react-lang": "workspace:^", "@openuidev/react-ui": "workspace:^", "@openuidev/thesys": "0.3.2", - "@openuidev/thesys-server": "0.1.4", "@phosphor-icons/react": "^2.1.10", "@radix-ui/react-dialog": "1.1.15", "@radix-ui/react-tooltip": "1.2.7", diff --git a/packages/lang-core/README.md b/packages/lang-core/README.md index cbf42ced0..2755f25fe 100644 --- a/packages/lang-core/README.md +++ b/packages/lang-core/README.md @@ -96,6 +96,17 @@ const myLibraryPrompt = generateSystemPrompt({ }); ``` +Enable managed slides and reports with `artifactTool` from the Cloud subpath: + +```ts +import { artifactTool } from "@openuidev/lang-core/cloud"; + +const tools = [ + artifactTool({ artifacts: ["slides", "report"] }), + { type: "web_search" }, +]; +``` + ### Merge incremental edits ```ts @@ -128,6 +139,12 @@ const merged = mergeStatements(original, patch); **`ToolSpec`** describes a tool for prompt generation (name, description, inputSchema, outputSchema). Shape inspired by MCP's tool schema. +### OpenUI Cloud + +| Export | Description | +| :--- | :--- | +| `artifactTool(options?)` | From `@openuidev/lang-core/cloud`. Responses `tools[]` entry for Cloud's managed slides/report artifacts. | + ## Telemetry Lang Core sends pseudonymous installation telemetry during `postinstall`. diff --git a/packages/lang-core/package.json b/packages/lang-core/package.json index 21cd5a8df..59cc54b1b 100644 --- a/packages/lang-core/package.json +++ b/packages/lang-core/package.json @@ -7,6 +7,13 @@ "main": "dist/index.cjs", "module": "dist/index.mjs", "types": "dist/index.d.cts", + "typesVersions": { + "*": { + "cloud": [ + "dist/cloud.d.cts" + ] + } + }, "sideEffects": false, "files": [ "dist", @@ -23,6 +30,16 @@ "types": "./dist/index.d.cts", "default": "./dist/index.cjs" } + }, + "./cloud": { + "import": { + "types": "./dist/cloud.d.mts", + "default": "./dist/cloud.mjs" + }, + "require": { + "types": "./dist/cloud.d.cts", + "default": "./dist/cloud.cjs" + } } }, "scripts": { diff --git a/packages/lang-core/src/__tests__/cloud.test.ts b/packages/lang-core/src/__tests__/cloud.test.ts new file mode 100644 index 000000000..34e7fb3b7 --- /dev/null +++ b/packages/lang-core/src/__tests__/cloud.test.ts @@ -0,0 +1,77 @@ +import { describe, expect, it } from "vitest"; +import { artifactTool, REPORT_LIBRARY_VERSION, SLIDES_LIBRARY_VERSION } from "../cloud"; + +const CLOUD_SUPPORTED_ARTIFACT_TYPES = ["slides", "report"]; + +describe("artifactTool — defaults", () => { + const ALL_WITH_VERSION = { + type: "artifact", + artifacts: [ + { artifact_type: "slides", library_version: SLIDES_LIBRARY_VERSION }, + { artifact_type: "report", library_version: REPORT_LIBRARY_VERSION }, + ], + }; + + it("no options → all types WITH library_version", () => { + expect(artifactTool()).toEqual(ALL_WITH_VERSION); + }); + + it("empty options → all types WITH library_version too", () => { + expect(artifactTool({})).toEqual(ALL_WITH_VERSION); + }); +}); + +describe("artifactTool — restriction", () => { + it("'slides' shorthand → entry with pinned version", () => { + expect(artifactTool({ artifacts: ["slides"] })).toEqual({ + type: "artifact", + artifacts: [{ artifact_type: "slides", library_version: SLIDES_LIBRARY_VERSION }], + }); + }); + + it("'report' shorthand → entry with pinned version", () => { + expect(artifactTool({ artifacts: ["report"] })).toEqual({ + type: "artifact", + artifacts: [{ artifact_type: "report", library_version: REPORT_LIBRARY_VERSION }], + }); + }); + + it("mixed shorthand + object entries, order preserved", () => { + const entry = artifactTool({ + artifacts: [{ type: "slides", instruction: "Use the corporate template." }, "report"], + }); + expect(entry.artifacts?.map((a) => a.artifact_type)).toEqual(["slides", "report"]); + expect(entry.artifacts?.[0]?.instruction).toBe("Use the corporate template."); + expect(entry.artifacts?.[1]).not.toHaveProperty("instruction"); + }); + + it("every emitted artifact_type is Cloud-supported", () => { + const entry = artifactTool({ artifacts: ["slides", "report"] }); + for (const a of entry.artifacts ?? []) { + expect(CLOUD_SUPPORTED_ARTIFACT_TYPES).toContain(a.artifact_type); + } + }); + + it("libraryVersion override wins over the pinned constant", () => { + const entry = artifactTool({ + artifacts: [{ type: "report", libraryVersion: "2.3.0" }], + }); + expect(entry.artifacts?.[0]?.library_version).toBe("2.3.0"); + }); +}); + +describe("artifactTool — validation", () => { + it("empty artifacts array throws (omit to enable all)", () => { + expect(() => artifactTool({ artifacts: [] })).toThrow(/must not be empty/); + }); + + it("duplicate artifact kinds throw", () => { + expect(() => artifactTool({ artifacts: ["report", { type: "report" }] })).toThrow(/duplicate/); + }); + + it("unknown artifact kind throws — incl. 'presentation' (not wire vocabulary)", () => { + expect(() => artifactTool({ artifacts: ["presentation" as never] })).toThrow( + /unknown artifact type 'presentation'/, + ); + }); +}); diff --git a/packages/lang-core/src/cloud.ts b/packages/lang-core/src/cloud.ts new file mode 100644 index 000000000..ff03efba5 --- /dev/null +++ b/packages/lang-core/src/cloud.ts @@ -0,0 +1,95 @@ +export type ArtifactKind = "slides" | "report"; + +export interface ArtifactOption { + type: ArtifactKind; + /** Per-artifact instruction, folded into the Cloud tool description. */ + instruction?: string; + /** Override this package's pinned library version for this artifact. */ + libraryVersion?: string; +} + +export interface ArtifactToolOptions { + /** Which artifacts to enable. Omit to enable all artifact types. */ + artifacts?: Array; +} + +export interface ArtifactWireEntry { + artifact_type: ArtifactKind; + instruction?: string; + library_version?: string; +} + +/** The Responses `tools[]` entry enabling OpenUI Cloud's managed artifact tool. */ +export interface ResponsesArtifactToolEntry { + type: "artifact"; + /** Absent → all supported artifact types enabled. */ + artifacts?: ArtifactWireEntry[]; +} + +/** + * Wire pins for OpenUI Cloud's managed artifact libraries. Cloud rejects a + * non-numeric or too-old version. + */ +export const SLIDES_LIBRARY_VERSION = "0.1.0"; +export const REPORT_LIBRARY_VERSION = "0.1.0"; + +const DEFAULT_LIBRARY_VERSION: Record = { + slides: SLIDES_LIBRARY_VERSION, + report: REPORT_LIBRARY_VERSION, +}; + +/** + * Build the Responses `tools[]` entry that enables Cloud's managed artifact tool. + * + * tools: [artifactTool()] // all artifact types + * tools: [artifactTool({ artifacts: ["report"] })] // report only + * tools: [artifactTool({ + * artifacts: [ + * { type: "slides", instruction: "Use the corporate template." }, + * "report", + * ], + * })] + * + * Pass at most one artifactTool() entry per request — Cloud keys the + * artifact config by tool type, so a second entry silently replaces the first. + */ +export function artifactTool(options: ArtifactToolOptions = {}): ResponsesArtifactToolEntry { + const { artifacts } = options; + if (artifacts === undefined) { + // Emit every supported type WITH its library_version so Cloud resolves to + // the OpenUI Lang format. A bare `{ type: "artifact" }` with no + // library_version is the legacy shape — not what a lang-core caller wants. + return { + type: "artifact", + artifacts: (Object.keys(DEFAULT_LIBRARY_VERSION) as ArtifactKind[]).map((kind) => ({ + artifact_type: kind, + library_version: DEFAULT_LIBRARY_VERSION[kind], + })), + }; + } + if (artifacts.length === 0) { + throw new Error( + "artifactTool: `artifacts` must not be empty — omit it to enable all artifact types.", + ); + } + + const seen = new Set(); + const entries: ArtifactWireEntry[] = artifacts.map((artifact) => { + const opt: ArtifactOption = typeof artifact === "string" ? { type: artifact } : artifact; + if (!(opt.type in DEFAULT_LIBRARY_VERSION)) { + throw new Error( + `artifactTool: unknown artifact type '${opt.type}'. Supported: ${Object.keys(DEFAULT_LIBRARY_VERSION).join(", ")}.`, + ); + } + if (seen.has(opt.type)) { + throw new Error(`artifactTool: duplicate artifact '${opt.type}'.`); + } + seen.add(opt.type); + return { + artifact_type: opt.type, + ...(opt.instruction && { instruction: opt.instruction }), + library_version: opt.libraryVersion ?? DEFAULT_LIBRARY_VERSION[opt.type], + }; + }); + return { type: "artifact", artifacts: entries }; +} diff --git a/packages/lang-core/tsdown.config.ts b/packages/lang-core/tsdown.config.ts index b805735df..49bc42591 100644 --- a/packages/lang-core/tsdown.config.ts +++ b/packages/lang-core/tsdown.config.ts @@ -2,7 +2,7 @@ import { defineConfig } from "tsdown"; import packageJson from "./package.json" with { type: "json" }; export default defineConfig({ - entry: ["src/index.ts", "src/postinstall.ts"], + entry: ["src/index.ts", "src/postinstall.ts", "src/cloud.ts"], format: ["esm", "cjs"], dts: true, sourcemap: true, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 581f841e3..63518008f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -84,9 +84,6 @@ importers: '@openuidev/thesys': specifier: 0.3.2 version: 0.3.2(@openuidev/lang-core@packages+lang-core)(@openuidev/react-headless@packages+react-headless)(@openuidev/react-lang@packages+react-lang)(@openuidev/react-ui@packages+react-ui)(@radix-ui/react-tooltip@1.2.7(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.2.4(react@19.2.4))(react@19.2.4))(@tiptap/core@2.27.2(@tiptap/pm@2.27.2))(@tiptap/pm@2.27.2)(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(zod@4.4.3)(zustand@4.5.7(@types/react@19.2.17)(react@19.2.4)) - '@openuidev/thesys-server': - specifier: 0.1.4 - version: 0.1.4 '@phosphor-icons/react': specifier: ^2.1.10 version: 2.1.10(react-dom@19.2.4(react@19.2.4))(react@19.2.4) @@ -2188,9 +2185,6 @@ packages: resolution: {integrity: sha512-eSYWTm620tTk45EKSedaUL8MFYI8hW164hIXsgIHyxu3VobUB3fFCu5t0hQby6OoWRPsG1KkKUG2M5UadiLiVg==} engines: {node: '>=14'} - '@openuidev/thesys-server@0.1.4': - resolution: {integrity: sha512-kRP54tk5608IuTU0Rjwo4wE8oCpWIxLAphhBkNGHaeZd7hAXwLGmT/vcIZBIr8KQM3Riq/pczrOa/ksyXXtcvQ==} - '@openuidev/thesys@0.3.2': resolution: {integrity: sha512-bVnVy2OcGawikt+R5QR4EBKtRvd0Y2PD9+Z94EClD5fSVtfi9VT9yztBp9a+r104SdB1GZuRuO3J/U+UALZgyg==} engines: {node: '>=20'} @@ -11639,8 +11633,6 @@ snapshots: '@opentelemetry/semantic-conventions@1.43.0': optional: true - '@openuidev/thesys-server@0.1.4': {} - '@openuidev/thesys@0.3.2(@openuidev/lang-core@packages+lang-core)(@openuidev/react-headless@packages+react-headless)(@openuidev/react-lang@packages+react-lang)(@openuidev/react-ui@packages+react-ui)(@radix-ui/react-tooltip@1.2.7(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.2.4(react@19.2.4))(react@19.2.4))(@tiptap/core@2.27.2(@tiptap/pm@2.27.2))(@tiptap/pm@2.27.2)(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(zod@4.4.3)(zustand@4.5.7(@types/react@19.2.17)(react@19.2.4))': dependencies: '@floating-ui/react-dom': 2.1.3(react-dom@19.2.4(react@19.2.4))(react@19.2.4) From 4cbdf7625a0ffbbc6bc2305aca1bbeda8aa21101 Mon Sep 17 00:00:00 2001 From: Abhin Rustagi Date: Thu, 10 Sep 2026 12:58:39 +0530 Subject: [PATCH 2/4] Switch Cloud templates off thesys-server artifactTool now comes from @openuidev/lang-core/cloud, so the Cloud starter and LangGraph overlay no longer need a separate server package. --- templates/openui-cloud/README.md | 3 +-- .../openui-cloud/overlays/langgraph/package-lock.json | 7 ------- templates/openui-cloud/overlays/langgraph/src/agent.ts | 2 +- .../openui-cloud/overlays/vercel-ai-sdk/package-lock.json | 7 ------- .../openui-cloud/overlays/vercel-eve/package-lock.json | 7 ------- templates/openui-cloud/package-lock.json | 7 ------- templates/openui-cloud/package.json | 1 - templates/openui-cloud/src/app/api/chat/route.ts | 2 +- 8 files changed, 3 insertions(+), 33 deletions(-) diff --git a/templates/openui-cloud/README.md b/templates/openui-cloud/README.md index 290592430..084038d48 100644 --- a/templates/openui-cloud/README.md +++ b/templates/openui-cloud/README.md @@ -58,8 +58,7 @@ list](https://models.dev/providers/openrouter/). ## SDK packages -- `@openuidev/lang-core` — `generateSystemPrompt({ cloud: true })` used by the `/api/chat` route. -- `@openuidev/thesys-server` — `artifactTool` used by the `/api/chat` route. +- `@openuidev/lang-core` — `generateSystemPrompt({ cloud: true })` and `artifactTool` from `@openuidev/lang-core/cloud`. - `@openuidev/thesys` — the React component library (`chatLibrary`, `Presentation`, `Report`) used by the client page and artifact renderers. - `@openuidev/react-ui` — the chat UI runtime (`AgentInterface`, `fetchLLM`, diff --git a/templates/openui-cloud/overlays/langgraph/package-lock.json b/templates/openui-cloud/overlays/langgraph/package-lock.json index 1d247fd8f..2e9186543 100644 --- a/templates/openui-cloud/overlays/langgraph/package-lock.json +++ b/templates/openui-cloud/overlays/langgraph/package-lock.json @@ -15,7 +15,6 @@ "@openuidev/react-lang": "^0.2.15", "@openuidev/react-ui": "^0.13.10", "@openuidev/thesys": "^0.3.2", - "@openuidev/thesys-server": "0.1.3", "langchain": "^1.5.5", "lucide-react": "^0.575.0", "next": "^16.3.0", @@ -2874,12 +2873,6 @@ "zustand": "^4.5.5" } }, - "node_modules/@openuidev/thesys-server": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@openuidev/thesys-server/-/thesys-server-0.1.3.tgz", - "integrity": "sha512-hIa1jvw4K7V97Z5drtk7pI0qmo2E/uLzm/buZzSTF/R9+JcKEdiD3JR9+KriIEdLNGa+1H3QsNNES+yQSQ3YwA==", - "license": "MIT" - }, "node_modules/@openuidev/thesys/node_modules/lucide-react": { "version": "0.562.0", "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.562.0.tgz", diff --git a/templates/openui-cloud/overlays/langgraph/src/agent.ts b/templates/openui-cloud/overlays/langgraph/src/agent.ts index b37fda0db..7ec740ea8 100644 --- a/templates/openui-cloud/overlays/langgraph/src/agent.ts +++ b/templates/openui-cloud/overlays/langgraph/src/agent.ts @@ -3,7 +3,7 @@ import { type ServerTool, tool } from "@langchain/core/tools"; import { StateSchema } from "@langchain/langgraph"; import { ChatOpenAI } from "@langchain/openai"; import { generateSystemPrompt } from "@openuidev/lang-core"; -import { artifactTool } from "@openuidev/thesys-server"; +import { artifactTool } from "@openuidev/lang-core/cloud"; import { createAgent, createMiddleware } from "langchain"; import { z } from "zod"; import { requiredEnv } from "./lib/env"; diff --git a/templates/openui-cloud/overlays/vercel-ai-sdk/package-lock.json b/templates/openui-cloud/overlays/vercel-ai-sdk/package-lock.json index 0935e32f9..fb49d61c1 100644 --- a/templates/openui-cloud/overlays/vercel-ai-sdk/package-lock.json +++ b/templates/openui-cloud/overlays/vercel-ai-sdk/package-lock.json @@ -13,7 +13,6 @@ "@openuidev/react-lang": "^0.2.15", "@openuidev/react-ui": "^0.13.10", "@openuidev/thesys": "^0.3.2", - "@openuidev/thesys-server": "0.1.3", "ai": "^6.0.246", "lucide-react": "^0.575.0", "next": "^16.3.0", @@ -2801,12 +2800,6 @@ "zustand": "^4.5.5" } }, - "node_modules/@openuidev/thesys-server": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@openuidev/thesys-server/-/thesys-server-0.1.3.tgz", - "integrity": "sha512-hIa1jvw4K7V97Z5drtk7pI0qmo2E/uLzm/buZzSTF/R9+JcKEdiD3JR9+KriIEdLNGa+1H3QsNNES+yQSQ3YwA==", - "license": "MIT" - }, "node_modules/@openuidev/thesys/node_modules/lucide-react": { "version": "0.562.0", "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.562.0.tgz", diff --git a/templates/openui-cloud/overlays/vercel-eve/package-lock.json b/templates/openui-cloud/overlays/vercel-eve/package-lock.json index f5a55bedb..0f94a1429 100644 --- a/templates/openui-cloud/overlays/vercel-eve/package-lock.json +++ b/templates/openui-cloud/overlays/vercel-eve/package-lock.json @@ -14,7 +14,6 @@ "@openuidev/react-lang": "^0.2.15", "@openuidev/react-ui": "^0.13.10", "@openuidev/thesys": "^0.3.2", - "@openuidev/thesys-server": "0.1.3", "@vercel/connect": "0.2.2", "ai": "7.0.0-beta.178", "eve": "^0.11.7", @@ -2985,12 +2984,6 @@ "zustand": "^4.5.5" } }, - "node_modules/@openuidev/thesys-server": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@openuidev/thesys-server/-/thesys-server-0.1.3.tgz", - "integrity": "sha512-hIa1jvw4K7V97Z5drtk7pI0qmo2E/uLzm/buZzSTF/R9+JcKEdiD3JR9+KriIEdLNGa+1H3QsNNES+yQSQ3YwA==", - "license": "MIT" - }, "node_modules/@openuidev/thesys/node_modules/lucide-react": { "version": "0.562.0", "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.562.0.tgz", diff --git a/templates/openui-cloud/package-lock.json b/templates/openui-cloud/package-lock.json index b8ed13658..196a01047 100644 --- a/templates/openui-cloud/package-lock.json +++ b/templates/openui-cloud/package-lock.json @@ -12,7 +12,6 @@ "@openuidev/react-lang": "^0.2.15", "@openuidev/react-ui": "^0.13.10", "@openuidev/thesys": "^0.3.2", - "@openuidev/thesys-server": "0.1.3", "lucide-react": "^0.575.0", "next": "^16.3.0", "openai": "^6.49.0", @@ -2698,12 +2697,6 @@ "zustand": "^4.5.5" } }, - "node_modules/@openuidev/thesys-server": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@openuidev/thesys-server/-/thesys-server-0.1.3.tgz", - "integrity": "sha512-hIa1jvw4K7V97Z5drtk7pI0qmo2E/uLzm/buZzSTF/R9+JcKEdiD3JR9+KriIEdLNGa+1H3QsNNES+yQSQ3YwA==", - "license": "MIT" - }, "node_modules/@openuidev/thesys/node_modules/lucide-react": { "version": "0.562.0", "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.562.0.tgz", diff --git a/templates/openui-cloud/package.json b/templates/openui-cloud/package.json index 97ebc7873..45992cf39 100644 --- a/templates/openui-cloud/package.json +++ b/templates/openui-cloud/package.json @@ -15,7 +15,6 @@ "@openuidev/react-lang": "^0.2.15", "@openuidev/react-ui": "^0.13.10", "@openuidev/thesys": "^0.3.2", - "@openuidev/thesys-server": "0.1.3", "lucide-react": "^0.575.0", "next": "^16.3.0", "openai": "^6.49.0", diff --git a/templates/openui-cloud/src/app/api/chat/route.ts b/templates/openui-cloud/src/app/api/chat/route.ts index e39add5c2..3f1a53f79 100644 --- a/templates/openui-cloud/src/app/api/chat/route.ts +++ b/templates/openui-cloud/src/app/api/chat/route.ts @@ -3,7 +3,7 @@ import { resolveRequestedModel } from "@/lib/models"; import { runFunctionToolLoop } from "@/lib/tool-loop"; import { executeGetWeather, getWeatherTool } from "@/lib/tools/get-weather"; import { generateSystemPrompt } from "@openuidev/lang-core"; -import { artifactTool } from "@openuidev/thesys-server"; +import { artifactTool } from "@openuidev/lang-core/cloud"; import { NextResponse } from "next/server"; import OpenAI from "openai"; import type { From bdcccabb27813de368a651f3020b33595abe538e Mon Sep 17 00:00:00 2001 From: Abhin Rustagi Date: Thu, 10 Sep 2026 13:05:09 +0530 Subject: [PATCH 3/4] Bump lang-core to 0.2.18 Ship the new @openuidev/lang-core/cloud export as its own version so templates and callers can pin it after publish. --- packages/lang-core/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lang-core/package.json b/packages/lang-core/package.json index 59cc54b1b..3427c9204 100644 --- a/packages/lang-core/package.json +++ b/packages/lang-core/package.json @@ -1,6 +1,6 @@ { "name": "@openuidev/lang-core", - "version": "0.2.17", + "version": "0.2.18", "description": "Framework-agnostic core for OpenUI Lang: parser, prompt generation, validation, and type definitions", "license": "MIT", "type": "module", From 655536005a6a07dfa0938449240bd842c9d66e18 Mon Sep 17 00:00:00 2001 From: Abhin Rustagi Date: Thu, 10 Sep 2026 15:03:16 +0530 Subject: [PATCH 4/4] Revert "Switch Cloud templates off thesys-server" This reverts commit 4cbdf7625a0ffbbc6bc2305aca1bbeda8aa21101. --- templates/openui-cloud/README.md | 3 ++- .../openui-cloud/overlays/langgraph/package-lock.json | 7 +++++++ templates/openui-cloud/overlays/langgraph/src/agent.ts | 2 +- .../openui-cloud/overlays/vercel-ai-sdk/package-lock.json | 7 +++++++ .../openui-cloud/overlays/vercel-eve/package-lock.json | 7 +++++++ templates/openui-cloud/package-lock.json | 7 +++++++ templates/openui-cloud/package.json | 1 + templates/openui-cloud/src/app/api/chat/route.ts | 2 +- 8 files changed, 33 insertions(+), 3 deletions(-) diff --git a/templates/openui-cloud/README.md b/templates/openui-cloud/README.md index 084038d48..290592430 100644 --- a/templates/openui-cloud/README.md +++ b/templates/openui-cloud/README.md @@ -58,7 +58,8 @@ list](https://models.dev/providers/openrouter/). ## SDK packages -- `@openuidev/lang-core` — `generateSystemPrompt({ cloud: true })` and `artifactTool` from `@openuidev/lang-core/cloud`. +- `@openuidev/lang-core` — `generateSystemPrompt({ cloud: true })` used by the `/api/chat` route. +- `@openuidev/thesys-server` — `artifactTool` used by the `/api/chat` route. - `@openuidev/thesys` — the React component library (`chatLibrary`, `Presentation`, `Report`) used by the client page and artifact renderers. - `@openuidev/react-ui` — the chat UI runtime (`AgentInterface`, `fetchLLM`, diff --git a/templates/openui-cloud/overlays/langgraph/package-lock.json b/templates/openui-cloud/overlays/langgraph/package-lock.json index 2e9186543..1d247fd8f 100644 --- a/templates/openui-cloud/overlays/langgraph/package-lock.json +++ b/templates/openui-cloud/overlays/langgraph/package-lock.json @@ -15,6 +15,7 @@ "@openuidev/react-lang": "^0.2.15", "@openuidev/react-ui": "^0.13.10", "@openuidev/thesys": "^0.3.2", + "@openuidev/thesys-server": "0.1.3", "langchain": "^1.5.5", "lucide-react": "^0.575.0", "next": "^16.3.0", @@ -2873,6 +2874,12 @@ "zustand": "^4.5.5" } }, + "node_modules/@openuidev/thesys-server": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@openuidev/thesys-server/-/thesys-server-0.1.3.tgz", + "integrity": "sha512-hIa1jvw4K7V97Z5drtk7pI0qmo2E/uLzm/buZzSTF/R9+JcKEdiD3JR9+KriIEdLNGa+1H3QsNNES+yQSQ3YwA==", + "license": "MIT" + }, "node_modules/@openuidev/thesys/node_modules/lucide-react": { "version": "0.562.0", "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.562.0.tgz", diff --git a/templates/openui-cloud/overlays/langgraph/src/agent.ts b/templates/openui-cloud/overlays/langgraph/src/agent.ts index 7ec740ea8..b37fda0db 100644 --- a/templates/openui-cloud/overlays/langgraph/src/agent.ts +++ b/templates/openui-cloud/overlays/langgraph/src/agent.ts @@ -3,7 +3,7 @@ import { type ServerTool, tool } from "@langchain/core/tools"; import { StateSchema } from "@langchain/langgraph"; import { ChatOpenAI } from "@langchain/openai"; import { generateSystemPrompt } from "@openuidev/lang-core"; -import { artifactTool } from "@openuidev/lang-core/cloud"; +import { artifactTool } from "@openuidev/thesys-server"; import { createAgent, createMiddleware } from "langchain"; import { z } from "zod"; import { requiredEnv } from "./lib/env"; diff --git a/templates/openui-cloud/overlays/vercel-ai-sdk/package-lock.json b/templates/openui-cloud/overlays/vercel-ai-sdk/package-lock.json index fb49d61c1..0935e32f9 100644 --- a/templates/openui-cloud/overlays/vercel-ai-sdk/package-lock.json +++ b/templates/openui-cloud/overlays/vercel-ai-sdk/package-lock.json @@ -13,6 +13,7 @@ "@openuidev/react-lang": "^0.2.15", "@openuidev/react-ui": "^0.13.10", "@openuidev/thesys": "^0.3.2", + "@openuidev/thesys-server": "0.1.3", "ai": "^6.0.246", "lucide-react": "^0.575.0", "next": "^16.3.0", @@ -2800,6 +2801,12 @@ "zustand": "^4.5.5" } }, + "node_modules/@openuidev/thesys-server": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@openuidev/thesys-server/-/thesys-server-0.1.3.tgz", + "integrity": "sha512-hIa1jvw4K7V97Z5drtk7pI0qmo2E/uLzm/buZzSTF/R9+JcKEdiD3JR9+KriIEdLNGa+1H3QsNNES+yQSQ3YwA==", + "license": "MIT" + }, "node_modules/@openuidev/thesys/node_modules/lucide-react": { "version": "0.562.0", "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.562.0.tgz", diff --git a/templates/openui-cloud/overlays/vercel-eve/package-lock.json b/templates/openui-cloud/overlays/vercel-eve/package-lock.json index 0f94a1429..f5a55bedb 100644 --- a/templates/openui-cloud/overlays/vercel-eve/package-lock.json +++ b/templates/openui-cloud/overlays/vercel-eve/package-lock.json @@ -14,6 +14,7 @@ "@openuidev/react-lang": "^0.2.15", "@openuidev/react-ui": "^0.13.10", "@openuidev/thesys": "^0.3.2", + "@openuidev/thesys-server": "0.1.3", "@vercel/connect": "0.2.2", "ai": "7.0.0-beta.178", "eve": "^0.11.7", @@ -2984,6 +2985,12 @@ "zustand": "^4.5.5" } }, + "node_modules/@openuidev/thesys-server": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@openuidev/thesys-server/-/thesys-server-0.1.3.tgz", + "integrity": "sha512-hIa1jvw4K7V97Z5drtk7pI0qmo2E/uLzm/buZzSTF/R9+JcKEdiD3JR9+KriIEdLNGa+1H3QsNNES+yQSQ3YwA==", + "license": "MIT" + }, "node_modules/@openuidev/thesys/node_modules/lucide-react": { "version": "0.562.0", "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.562.0.tgz", diff --git a/templates/openui-cloud/package-lock.json b/templates/openui-cloud/package-lock.json index 196a01047..b8ed13658 100644 --- a/templates/openui-cloud/package-lock.json +++ b/templates/openui-cloud/package-lock.json @@ -12,6 +12,7 @@ "@openuidev/react-lang": "^0.2.15", "@openuidev/react-ui": "^0.13.10", "@openuidev/thesys": "^0.3.2", + "@openuidev/thesys-server": "0.1.3", "lucide-react": "^0.575.0", "next": "^16.3.0", "openai": "^6.49.0", @@ -2697,6 +2698,12 @@ "zustand": "^4.5.5" } }, + "node_modules/@openuidev/thesys-server": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@openuidev/thesys-server/-/thesys-server-0.1.3.tgz", + "integrity": "sha512-hIa1jvw4K7V97Z5drtk7pI0qmo2E/uLzm/buZzSTF/R9+JcKEdiD3JR9+KriIEdLNGa+1H3QsNNES+yQSQ3YwA==", + "license": "MIT" + }, "node_modules/@openuidev/thesys/node_modules/lucide-react": { "version": "0.562.0", "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.562.0.tgz", diff --git a/templates/openui-cloud/package.json b/templates/openui-cloud/package.json index 45992cf39..97ebc7873 100644 --- a/templates/openui-cloud/package.json +++ b/templates/openui-cloud/package.json @@ -15,6 +15,7 @@ "@openuidev/react-lang": "^0.2.15", "@openuidev/react-ui": "^0.13.10", "@openuidev/thesys": "^0.3.2", + "@openuidev/thesys-server": "0.1.3", "lucide-react": "^0.575.0", "next": "^16.3.0", "openai": "^6.49.0", diff --git a/templates/openui-cloud/src/app/api/chat/route.ts b/templates/openui-cloud/src/app/api/chat/route.ts index 3f1a53f79..e39add5c2 100644 --- a/templates/openui-cloud/src/app/api/chat/route.ts +++ b/templates/openui-cloud/src/app/api/chat/route.ts @@ -3,7 +3,7 @@ import { resolveRequestedModel } from "@/lib/models"; import { runFunctionToolLoop } from "@/lib/tool-loop"; import { executeGetWeather, getWeatherTool } from "@/lib/tools/get-weather"; import { generateSystemPrompt } from "@openuidev/lang-core"; -import { artifactTool } from "@openuidev/lang-core/cloud"; +import { artifactTool } from "@openuidev/thesys-server"; import { NextResponse } from "next/server"; import OpenAI from "openai"; import type {