@langgraph-js/ui 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langgraph-js/ui",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
package/vite.config.ts CHANGED
@@ -2,42 +2,41 @@ import react from "@vitejs/plugin-react";
2
2
  import { defineConfig, Plugin } from "vite";
3
3
  import basicSsl from "@vitejs/plugin-basic-ssl";
4
4
  import tailwindcss from "@tailwindcss/vite";
5
- import { app } from "@langgraph-js/open-smith/dist/app.js";
6
5
  import { Readable } from "stream";
7
6
  const OpenSmithPlugin = () =>
8
7
  ({
9
8
  name: "open-smith",
10
9
  configureServer(server) {
11
- process.env.NODE_ENV === "development" &&
12
- server.middlewares.use("/api/open-smith", async (req, res, next) => {
13
- try {
14
- const body = Readable.toWeb(req);
15
- // Build a compatible Request for Fetch API
16
- const url = `http://localhost${req.url}`;
17
- const fetchRequest = new Request(url, {
18
- method: req.method,
19
- headers: req.headers as any,
20
- body: req.method && !["GET", "HEAD"].includes(req.method.toUpperCase()) && body ? body : undefined,
21
- ...(req.method && !["GET", "HEAD"].includes(req.method.toUpperCase()) && body ? { duplex: "half" as const } : {}),
22
- });
10
+ server.middlewares.use("/api/open-smith", async (req, res, next) => {
11
+ const { app } = await import("@langgraph-js/open-smith/dist/app.js");
12
+ try {
13
+ const body = Readable.toWeb(req);
14
+ // Build a compatible Request for Fetch API
15
+ const url = `http://localhost${req.url}`;
16
+ const fetchRequest = new Request(url, {
17
+ method: req.method,
18
+ headers: req.headers as any,
19
+ body: req.method && !["GET", "HEAD"].includes(req.method.toUpperCase()) && body ? body : undefined,
20
+ ...(req.method && !["GET", "HEAD"].includes(req.method.toUpperCase()) && body ? { duplex: "half" as const } : {}),
21
+ });
23
22
 
24
- // Proxy the request to app.basePath handler
25
- const response = await app.basePath("/api/open-smith").fetch(fetchRequest);
23
+ // Proxy the request to app.basePath handler
24
+ const response = await app.basePath("/api/open-smith").fetch(fetchRequest);
26
25
 
27
- // Set status and headers
28
- res.statusCode = response.status;
29
- // @ts-ignore
30
- for (const [key, value] of response.headers.entries()) {
31
- res.setHeader(key, value);
32
- }
33
-
34
- // Send the response body
35
- const arrayBuffer = await response.arrayBuffer();
36
- res.end(Buffer.from(arrayBuffer));
37
- } catch (error) {
38
- console.log(error);
26
+ // Set status and headers
27
+ res.statusCode = response.status;
28
+ // @ts-ignore
29
+ for (const [key, value] of response.headers.entries()) {
30
+ res.setHeader(key, value);
39
31
  }
40
- });
32
+
33
+ // Send the response body
34
+ const arrayBuffer = await response.arrayBuffer();
35
+ res.end(Buffer.from(arrayBuffer));
36
+ } catch (error) {
37
+ console.log(error);
38
+ }
39
+ });
41
40
  },
42
41
  }) as Plugin;
43
42
 
@@ -45,7 +44,7 @@ const OpenSmithPlugin = () =>
45
44
  export default defineConfig(({ mode }) => {
46
45
  const isHttps = mode === "https";
47
46
  return {
48
- plugins: [react(), tailwindcss(), isHttps ? basicSsl() : undefined, OpenSmithPlugin()],
47
+ plugins: [react(), tailwindcss(), isHttps ? basicSsl() : undefined, process.env.NODE_ENV === "development" && OpenSmithPlugin()],
49
48
  resolve: {
50
49
  alias: {
51
50
  "@langgraph-js/sdk": new URL("../langgraph-client/src", import.meta.url).pathname,
Binary file
Binary file