Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

chore: upgrade to ai-sdk-tool 1.2.0

Brad Barbinc2cda538479f
diff --git a/apps/erp/app/components/Chat/ChatHeader.tsx b/apps/erp/app/components/Chat/ChatHeader.tsx
index 00529a481f..074888a4b9 100644
--- a/apps/erp/app/components/Chat/ChatHeader.tsx
+++ b/apps/erp/app/components/Chat/ChatHeader.tsx
@@ -6,6 +6,12 @@ export function ChatHeader() {
<div className="flex items-center justify-start pl-9 relative h-8">
<ChatNavigation />
<ChatTitle />
+ {/* {!isHome && (
+ <div className="absolute right-0 flex items-center gap-4">
+ <NewChatButton />
+ <ChatHistory />
+ </div>
+ )} */}
</div>
);
}
diff --git a/apps/erp/app/components/Chat/ChatInput.tsx b/apps/erp/app/components/Chat/ChatInput.tsx
index 51746e037b..4a49a1a250 100644
--- a/apps/erp/app/components/Chat/ChatInput.tsx
+++ b/apps/erp/app/components/Chat/ChatInput.tsx
@@ -1,5 +1,10 @@
import { useArtifacts } from "@ai-sdk-tools/artifacts/client";
-import { useChatActions, useChatId, useChatStatus } from "@ai-sdk-tools/store";
+import {
+ useChatActions,
+ useChatId,
+ useChatStatus,
+ useDataPart,
+} from "@ai-sdk-tools/store";
import { cn } from "@carbon/react";
import { forwardRef, useRef } from "react";
import { CommandMenu } from "./CommandMenu";
@@ -40,6 +45,10 @@ export const ChatInput = forwardRef<RecordButtonRef, ChatInputProps>(
const { sendMessage, stop } = useChatActions();
const chatId = useChatId();
+ const [, clearSuggestions] = useDataPart<{ prompts: string[] }>(
+ "suggestions"
+ );
+
const { current } = useArtifacts({
exclude: ["chat-title", "followup-questions"],
});
@@ -118,6 +127,8 @@ export const ChatInput = forwardRef<RecordButtonRef, ChatInputProps>(
// Execute command through the store
if (!chatId) return;
+ clearSuggestions();
+
sendMessage({
role: "user",
parts: [
@@ -141,6 +152,14 @@ export const ChatInput = forwardRef<RecordButtonRef, ChatInputProps>(
if (e.key === "Enter" && !showCommands) {
e.preventDefault();
if (input.trim()) {
+ if (status === "streaming" || status === "submitted") {
+ stop?.();
+ // Continue to send the new message after stopping
+ }
+
+ // Clear old suggestions
+ clearSuggestions();
+
sendMessage({
text: input,
files: [],
diff --git a/apps/erp/app/components/Chat/ChatInterface.tsx b/apps/erp/app/components/Chat/ChatInterface.tsx
index d11e897cec..200299f36a 100644
--- a/apps/erp/app/components/Chat/ChatInterface.tsx
+++ b/apps/erp/app/components/Chat/ChatInterface.tsx
@@ -1,10 +1,10 @@
import { useArtifacts } from "@ai-sdk-tools/artifacts/client";
-import { useChat, useDataPart } from "@ai-sdk-tools/store";
+import { useChat, useChatActions, useDataPart } from "@ai-sdk-tools/store";
import { useCarbon } from "@carbon/auth";
import { cn } from "@carbon/react";
import { useLocale } from "@react-aria/i18n";
import { DefaultChatTransport, generateId } from "ai";
-import { useMemo, useRef } from "react";
+import { useEffect, useMemo, useRef } from "react";
import { Greeting } from "~/components/Greeting";
import { useUser } from "~/hooks";
import { path } from "~/utils/path";
@@ -37,6 +37,28 @@ export function ChatInterface({ geo }: Props) {
const recordButtonRef = useRef<RecordButtonRef>(null);
const chatId = useMemo(() => routeChatId ?? generateId(), [routeChatId]);
+ const { reset } = useChatActions();
+ const prevChatIdRef = useRef<string | null>(routeChatId);
+ const [, clearSuggestions] = useDataPart<{ prompts: string[] }>(
+ "suggestions"
+ );
+
+ // Reset chat state when navigating away from a chat (sidebar, browser back, etc.)
+ useEffect(() => {
+ const prevChatId = prevChatIdRef.current;
+ const currentChatId = routeChatId;
+
+ // If we had a chatId before and now we don't (navigated away), reset
+ // Or if we're switching to a different chatId, reset
+ if (prevChatId && prevChatId !== currentChatId) {
+ reset();
+ clearSuggestions();
+ }
+
+ // Update the ref for next comparison
+ prevChatIdRef.current = currentChatId;
+ }, [routeChatId, reset, clearSuggestions]);
+
const { locale } = useLocale();
const { accessToken } = useCarbon();
const {
diff --git a/apps/erp/app/components/Chat/SuggestedActions.tsx b/apps/erp/app/components/Chat/SuggestedActions.tsx
index ab2859e072..7d731638bf 100644
--- a/apps/erp/app/components/Chat/SuggestedActions.tsx
+++ b/apps/erp/app/components/Chat/SuggestedActions.tsx
@@ -41,7 +41,13 @@ export function SuggestedActions() {
title: string;
description: string;
}
- > = {};
+ > = {
+ // "get-runway": {
+ // icon: Icons.Speed,
+ // title: "Runway",
+ // description: "Show me my runway",
+ // },
+ };
const suggestedActions: SuggestedAction[] = [];
diff --git a/apps/erp/package.json b/apps/erp/package.json
index 8b3209d856..105cbf78fd 100644
--- a/apps/erp/package.json
+++ b/apps/erp/package.json
@@ -2,12 +2,12 @@
"name": "erp",
"type": "module",
"dependencies": {
- "@ai-sdk-tools/agents": "1.0.8",
- "@ai-sdk-tools/artifacts": "1.0.8",
- "@ai-sdk-tools/devtools": "1.0.8",
- "@ai-sdk-tools/cache": "1.0.8",
- "@ai-sdk-tools/memory": "1.0.8",
- "@ai-sdk-tools/store": "1.0.8",
+ "@ai-sdk-tools/agents": "1.2.0",
+ "@ai-sdk-tools/artifacts": "1.2.0",
+ "@ai-sdk-tools/devtools": "1.2.0",
+ "@ai-sdk-tools/cache": "1.2.0",
+ "@ai-sdk-tools/memory": "1.2.0",
+ "@ai-sdk-tools/store": "1.2.0",
"@ai-sdk/anthropic": "^2.0.41",
"@ai-sdk/openai": "^2.0.60",
"@ai-sdk/react": "^2.0.86",
diff --git a/package-lock.json b/package-lock.json
index a69d85c3e1..d8b60e0c03 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -91,12 +91,12 @@
},
"apps/erp": {
"dependencies": {
- "@ai-sdk-tools/agents": "1.0.8",
- "@ai-sdk-tools/artifacts": "1.0.8",
- "@ai-sdk-tools/cache": "1.0.8",
- "@ai-sdk-tools/devtools": "1.0.8",
- "@ai-sdk-tools/memory": "1.0.8",
- "@ai-sdk-tools/store": "1.0.8",
+ "@ai-sdk-tools/agents": "1.2.0",
+ "@ai-sdk-tools/artifacts": "1.2.0",
+ "@ai-sdk-tools/cache": "1.2.0",
+ "@ai-sdk-tools/devtools": "1.2.0",
+ "@ai-sdk-tools/memory": "1.2.0",
+ "@ai-sdk-tools/store": "1.2.0",
"@ai-sdk/anthropic": "^2.0.41",
"@ai-sdk/openai": "^2.0.60",
"@ai-sdk/react": "^2.0.86",
@@ -772,9 +772,9 @@
}
},
"node_modules/@ai-sdk-tools/agents": {
- "version": "1.0.8",
- "resolved": "https://registry.npmjs.org/@ai-sdk-tools/agents/-/agents-1.0.8.tgz",
- "integrity": "sha512-001FU1XnU4DcJrJZp4nbyzJYGwPFSO/wwW2rVjIThFIc2IKQX23vtmH2vpKQv39BObB9TVxYcP8SGC1TAc+iiA==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@ai-sdk-tools/agents/-/agents-1.2.0.tgz",
+ "integrity": "sha512-x1cTxnWDy/1Y63Ca875LDQXgy6dycTZ5BikMmCwRs5zHn4WOcudFfEgdFZndGA8wZFntk8V5LiUlJ7rSwYCp1g==",
"license": "MIT",
"peerDependencies": {
"ai": ">=5.0.0",
@@ -790,9 +790,9 @@
}
},
"node_modules/@ai-sdk-tools/artifacts": {
- "version": "1.0.8",
- "resolved": "https://registry.npmjs.org/@ai-sdk-tools/artifacts/-/artifacts-1.0.8.tgz",
- "integrity": "sha512-TXMvzzb2ZUxfTHQrt59nONMkY/bhZ66gw2uk4jrkUcfSpdKOvU89BZ1WqNFhom1R69hCpRXTlXrWMBvOq/YbOA==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@ai-sdk-tools/artifacts/-/artifacts-1.2.0.tgz",
+ "integrity": "sha512-BqvfpnluKVbZjF0rCAX4Oe/yhtiE2PgeII2FN0j+AOX4WBiEUVzydM3oQkT6BS/olG0b5Xgnj3WjMd7Q7hC6uQ==",
"license": "MIT",
"dependencies": {
"zod": "^4.1.12"
@@ -812,9 +812,9 @@
}
},
"node_modules/@ai-sdk-tools/cache": {
- "version": "1.0.8",
- "resolved": "https://registry.npmjs.org/@ai-sdk-tools/cache/-/cache-1.0.8.tgz",
- "integrity": "sha512-EqzdgCH+uOoMJFpdxiXIA5eMAKUCnKyFvnzgUGgpOhwBVixUzVCeIP9kP1YU+rcqTCRyqaEAUUWWgHwAZvTtLA==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@ai-sdk-tools/cache/-/cache-1.2.0.tgz",
+ "integrity": "sha512-ZjcP002ZsaK8y2H9FI/qSUEhMEjq3pZ6S9ZXNMNb7l9P99x29zzBn4R491PtliSEG9AZR0CSLDBbmwLwh5FY5w==",
"license": "MIT",
"peerDependencies": {
"ai": "^5.0.82"
@@ -826,9 +826,9 @@
}
},
"node_modules/@ai-sdk-tools/devtools": {
- "version": "1.0.8",
- "resolved": "https://registry.npmjs.org/@ai-sdk-tools/devtools/-/devtools-1.0.8.tgz",
- "integrity": "sha512-YaDN6/wkvYSbLycHyo19JKhE9zwPfsBlYsU39yI4zR35P/wGxnfL7sr1oEXiCnPbEE1nd0uSYTMmiznmfMUc/Q==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@ai-sdk-tools/devtools/-/devtools-1.2.0.tgz",
+ "integrity": "sha512-LfDFuPR2p/SrLFs+hKdm9Ct8RZ3Mzq3GqvhHWsFl/LjRYsnsl1TDY0tIVXsLLleQwBz8O7QOzzImvtN8na8rqQ==",
"license": "MIT",
"dependencies": {
"@emotion/react": "^11.14.0",
@@ -854,9 +854,9 @@
}
},
"node_modules/@ai-sdk-tools/memory": {
- "version": "1.0.8",
- "resolved": "https://registry.npmjs.org/@ai-sdk-tools/memory/-/memory-1.0.8.tgz",
- "integrity": "sha512-+JXSEq+mDLcMVZJQ0jo7RdNCJqfDTyncCfblZMp3FfX341TLeS2JDb8xhVQHwOJkyfddbcQ+wKFzxG0wLSyzQA==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@ai-sdk-tools/memory/-/memory-1.2.0.tgz",
+ "integrity": "sha512-ET8CQMyHsdEMVSYnBjopHWwR6j6W6tmB+djMybFiloPLF9NfsFr9bXt2hb7+/oFyE9zKAGWQXqUY+Z+kUueR2w==",
"dependencies": {
"zod": "^4.1.12"
},
@@ -895,12 +895,13 @@
}
},
"node_modules/@ai-sdk-tools/store": {
- "version": "1.0.8",
- "resolved": "https://registry.npmjs.org/@ai-sdk-tools/store/-/store-1.0.8.tgz",
- "integrity": "sha512-JwDP3HRw5tV8ETnSg0NsaqXhwwit8yv4PKqQ+RzryB0AdnwDs7egql5EGpqKq79ZO7KU2Bmg9ApCnr6kmqry+Q==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@ai-sdk-tools/store/-/store-1.2.0.tgz",
+ "integrity": "sha512-/R01/2KA3fOyjDGDDaRSgYn6TPsGS1gO7dTYlmdC36QrCTVkN4Aqx4T3PcwUnnp4i4/nhEZb0Ar2/mpYEsQvfw==",
"license": "MIT",
"dependencies": {
- "ai": "^5.0.87"
+ "@types/node": "^24.10.1",
+ "ai": "^5.0.97"
},
"peerDependencies": {
"@ai-sdk/react": ">=2.0.0",
@@ -908,6 +909,65 @@
"zustand": ">=5.0.0"
}
},
+ "node_modules/@ai-sdk-tools/store/node_modules/@ai-sdk/gateway": {
+ "version": "2.0.13",
+ "resolved": "https://registry.npmjs.org/@ai-sdk/gateway/-/gateway-2.0.13.tgz",
+ "integrity": "sha512-q8M+7+VEKp91I295cjNDgQ4LyGImKj5cDLVARDay7nBTXGjIRZOlthYE7K6Rbz2yHKFyTmKH7MMkYavAM7L/UQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@ai-sdk/provider": "2.0.0",
+ "@ai-sdk/provider-utils": "3.0.17",
+ "@vercel/oidc": "3.0.5"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.76 || ^4.1.8"
+ }
+ },
+ "node_modules/@ai-sdk-tools/store/node_modules/@types/node": {
+ "version": "24.10.1",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz",
+ "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==",
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~7.16.0"
+ }
+ },
+ "node_modules/@ai-sdk-tools/store/node_modules/@vercel/oidc": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/@vercel/oidc/-/oidc-3.0.5.tgz",
+ "integrity": "sha512-fnYhv671l+eTTp48gB4zEsTW/YtRgRPnkI2nT7x6qw5rkI1Lq2hTmQIpHPgyThI0znLK+vX2n9XxKdXZ7BUbbw==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">= 20"
+ }
+ },
+ "node_modules/@ai-sdk-tools/store/node_modules/ai": {
+ "version": "5.0.98",
+ "resolved": "https://registry.npmjs.org/ai/-/ai-5.0.98.tgz",
+ "integrity": "sha512-RpMnwnml68Swblobvk6IdF7HLZrog72Ve6H5J3aN+A/JPg4y5CjCXeQyK1N4wJStyuTa6AoKYfJR5F4e/aVpHQ==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@ai-sdk/gateway": "2.0.13",
+ "@ai-sdk/provider": "2.0.0",
+ "@ai-sdk/provider-utils": "3.0.17",
+ "@opentelemetry/api": "1.9.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "zod": "^3.25.76 || ^4.1.8"
+ }
+ },
+ "node_modules/@ai-sdk-tools/store/node_modules/undici-types": {
+ "version": "7.16.0",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
+ "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
+ "license": "MIT"
+ },
"node_modules/@ai-sdk/anthropic": {
"version": "2.0.44",
"resolved": "https://registry.npmjs.org/@ai-sdk/anthropic/-/anthropic-2.0.44.tgz",