@rpcbase/agents-sdk 0.7.0 → 0.9.0

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.
Files changed (75) hide show
  1. package/dist/api/chat/handler.d.ts.map +1 -1
  2. package/dist/api/chat/historyCompaction.d.ts +29 -0
  3. package/dist/api/chat/historyCompaction.d.ts.map +1 -0
  4. package/dist/api/chat/models.d.ts +1 -0
  5. package/dist/api/chat/models.d.ts.map +1 -1
  6. package/dist/api/chat/runtimeConfig.d.ts +43 -0
  7. package/dist/api/chat/runtimeConfig.d.ts.map +1 -1
  8. package/dist/api/chatDb.d.ts +4 -0
  9. package/dist/api/chatDb.d.ts.map +1 -1
  10. package/dist/chat-models.browser.js +2 -2
  11. package/dist/chat-models.d.ts +1 -1
  12. package/dist/chat-models.d.ts.map +1 -1
  13. package/dist/chat-models.js +2 -2
  14. package/dist/{chatDb-DdX0Vtyt.js → chatDb-BSiHIyn9.js} +25 -18
  15. package/dist/{chatDb-CcAjAGX7.js → chatDb-YfeABtn-.js} +25 -18
  16. package/dist/client-routes.browser.js +94 -75
  17. package/dist/client-routes.d.ts +7 -1
  18. package/dist/client-routes.d.ts.map +1 -1
  19. package/dist/client-routes.js +94 -75
  20. package/dist/components/agents-chat-route-layout.d.ts +5 -2
  21. package/dist/components/agents-chat-route-layout.d.ts.map +1 -1
  22. package/dist/components/artifact-messages.d.ts +3 -2
  23. package/dist/components/artifact-messages.d.ts.map +1 -1
  24. package/dist/components/artifact.d.ts +6 -2
  25. package/dist/components/artifact.d.ts.map +1 -1
  26. package/dist/components/chat.d.ts +6 -2
  27. package/dist/components/chat.d.ts.map +1 -1
  28. package/dist/components/message.d.ts +3 -2
  29. package/dist/components/message.d.ts.map +1 -1
  30. package/dist/components/messages.d.ts +3 -2
  31. package/dist/components/messages.d.ts.map +1 -1
  32. package/dist/components/multimodal-input.d.ts +4 -1
  33. package/dist/components/multimodal-input.d.ts.map +1 -1
  34. package/dist/components/sidebar-history-item.d.ts +4 -5
  35. package/dist/components/sidebar-history-item.d.ts.map +1 -1
  36. package/dist/components/sidebar-history.d.ts +6 -3
  37. package/dist/components/sidebar-history.d.ts.map +1 -1
  38. package/dist/{data-stream-handler-BW4eCG7d.js → data-stream-handler-DXAHFC5k.js} +462 -427
  39. package/dist/{data-stream-handler-Bd_oM4r9.js → data-stream-handler-lr4wJ3vt.js} +462 -427
  40. package/dist/{handler-D7f8iAy5.js → handler-5n-YwiF3.js} +1 -1
  41. package/dist/{handler-CGV7uuUA.js → handler-B3uUDuTR.js} +1 -1
  42. package/dist/{handler-BLG0AYVC.js → handler-BMeUL2iE.js} +1 -1
  43. package/dist/{handler-C6u7vLAb.js → handler-BgYHL3BZ.js} +9 -9
  44. package/dist/{handler-dVlpopfq.js → handler-By86dyTJ.js} +1 -1
  45. package/dist/{handler-BeWk8pDD.js → handler-C0MO52d9.js} +1 -1
  46. package/dist/{handler-mbDBRYl8.js → handler-C8gaYgmy.js} +1 -1
  47. package/dist/{handler-ClWOGjB_.js → handler-DE8agLBS.js} +438 -268
  48. package/dist/{handler-CEk1hut1.js → handler-DMwBT4bK.js} +1 -1
  49. package/dist/{handler-DPuJK6ft.js → handler-DSncMeo4.js} +352 -182
  50. package/dist/{handler-BY5bgBEh.js → handler-DdKB5P3H.js} +1 -1
  51. package/dist/{handler-BBCbPLLC.js → handler-Dy536I3-.js} +1 -1
  52. package/dist/{handler-BKT8Hl0a.js → handler-Jua6SU39.js} +9 -9
  53. package/dist/{handler-CZSMkZnQ.js → handler-YmuAR8ei.js} +1 -1
  54. package/dist/{handler-P40GjJry.js → handler-hah8tVEE.js} +1 -1
  55. package/dist/{handler-DbjPd3w4.js → handler-svaSKC2q.js} +1 -1
  56. package/dist/index.browser.js +4 -3
  57. package/dist/index.d.ts +2 -0
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +4 -3
  60. package/dist/lib/ai/models.d.ts +6 -0
  61. package/dist/lib/ai/models.d.ts.map +1 -1
  62. package/dist/lib/types.d.ts +23 -0
  63. package/dist/lib/types.d.ts.map +1 -1
  64. package/dist/{models-DUt7W9lV.js → models-DphUIx22.js} +13 -2
  65. package/dist/pages/ChatNewPage.d.ts +6 -1
  66. package/dist/pages/ChatNewPage.d.ts.map +1 -1
  67. package/dist/pages/ChatPage.d.ts +6 -1
  68. package/dist/pages/ChatPage.d.ts.map +1 -1
  69. package/dist/routes.browser.js +8 -8
  70. package/dist/routes.js +8 -8
  71. package/dist/runtime.d.ts +2 -2
  72. package/dist/runtime.d.ts.map +1 -1
  73. package/dist/runtime.js +1 -1
  74. package/dist/tailwind-source.js +1 -1
  75. package/package.json +1 -1
@@ -1,25 +1,25 @@
1
- import { c as e, h as t, l as n, n as r, o as i, r as a, s as o, t as s } from "./data-stream-handler-Bd_oM4r9.js";
2
- import "./models-DUt7W9lV.js";
3
- import { Link as c, Route as l, redirect as u, useLoaderData as d, useRouteLoaderData as f } from "@rpcbase/router";
4
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
5
- import { RouteErrorBoundary as g } from "@rpcbase/client";
1
+ import { c as e, h as t, l as n, n as r, o as i, r as a, s as o, t as s } from "./data-stream-handler-lr4wJ3vt.js";
2
+ import { s as c } from "./models-DphUIx22.js";
3
+ import { Link as l, Route as u, redirect as d, useLoaderData as f, useRouteLoaderData as p } from "@rpcbase/router";
4
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
5
+ import { RouteErrorBoundary as _ } from "@rpcbase/client";
6
6
  //#region src/components/AppErrorExtra.tsx
7
- var _ = (e) => /* @__PURE__ */ m("span", {
7
+ var v = (e) => /* @__PURE__ */ h("span", {
8
8
  className: "agents-sdk contents",
9
- children: /* @__PURE__ */ m("a", {
9
+ children: /* @__PURE__ */ h("a", {
10
10
  href: "/",
11
11
  className: "rounded-md bg-primary px-3.5 py-2.5 text-primary-foreground text-sm font-semibold shadow-sm transition hover:bg-primary/90 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
12
- children: /* @__PURE__ */ m("span", { children: "Retour à l’accueil" })
12
+ children: /* @__PURE__ */ h("span", { children: "Retour à l’accueil" })
13
13
  })
14
- }), v = "http://localhost:9292", y = (e) => {
14
+ }), y = "http://localhost:9292", b = (e) => {
15
15
  let t = e?.req?.get?.("host") || e?.req?.headers?.host, n = e?.req?.protocol || "http";
16
- return t ? `${n}://${t}` : (typeof window < "u" ? window.location?.origin : null) || (typeof process < "u" ? process.env.AGENT_SDK_APP_BASE_URL : null) || v;
17
- }, b = (e) => n(e.request?.url || e?.ctx?.req?.originalUrl || e?.ctx?.req?.url) ?? o(), x = (t, n) => {
16
+ return t ? `${n}://${t}` : (typeof window < "u" ? window.location?.origin : null) || (typeof process < "u" ? process.env.AGENT_SDK_APP_BASE_URL : null) || y;
17
+ }, x = (e) => n(e.request?.url || e?.ctx?.req?.originalUrl || e?.ctx?.req?.url) ?? o(), S = (t, n) => {
18
18
  let r = { ...e(n) }, i = t?.req?.headers?.cookie;
19
19
  return i && (r.cookie = i), r;
20
- }, S = async ({ ctx: e, requestPath: t, tenantId: n }) => {
21
- let r = y(e), i = new URL(t, r), a = await fetch(i, {
22
- headers: x(e, n),
20
+ }, C = async ({ ctx: e, requestPath: t, tenantId: n }) => {
21
+ let r = b(e), i = new URL(t, r), a = await fetch(i, {
22
+ headers: S(e, n),
23
23
  credentials: "include",
24
24
  cache: "no-store"
25
25
  });
@@ -27,17 +27,17 @@ var _ = (e) => /* @__PURE__ */ m("span", {
27
27
  response: a,
28
28
  json: await a.json().catch(() => null)
29
29
  };
30
- }, C = async (e) => {
30
+ }, w = async (e) => {
31
31
  let t = e?.params?.id;
32
- if (typeof t != "string" || t.trim() === "") throw u("..");
33
- let n = b(e), { response: r, json: a } = await S({
32
+ if (typeof t != "string" || t.trim() === "") throw d("..");
33
+ let n = x(e), { response: r, json: a } = await C({
34
34
  ctx: e?.ctx,
35
35
  requestPath: `/api/rb/agents/chat?id=${encodeURIComponent(t)}`,
36
36
  tenantId: n
37
37
  });
38
- if (r.status === 404) throw u("..");
38
+ if (r.status === 404) throw d("..");
39
39
  if (!r.ok) throw Error(`Failed to load chat ${t}`);
40
- let { response: o, json: s } = await S({
40
+ let { response: o, json: s } = await C({
41
41
  ctx: e?.ctx,
42
42
  requestPath: `/api/rb/agents/chat/messages?id=${encodeURIComponent(t)}`,
43
43
  tenantId: n
@@ -48,64 +48,76 @@ var _ = (e) => /* @__PURE__ */ m("span", {
48
48
  initialChatModel: typeof a?.selectedChatModel == "string" && a.selectedChatModel.trim() ? a.selectedChatModel.trim() : null,
49
49
  initialMessages: i(Array.isArray(s) ? s : [])
50
50
  };
51
- }, w = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
51
+ }, T = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
52
52
  let t = Math.floor(Math.random() * 16);
53
53
  return (e === "x" ? t : t & 3 | 8).toString(16);
54
- }), T = () => {
54
+ }), E = () => {
55
55
  let e = globalThis.crypto;
56
- return e && "randomUUID" in e && typeof e.randomUUID == "function" ? e.randomUUID() : w();
57
- }, E = async () => ({ chatId: T() });
56
+ return e && "randomUUID" in e && typeof e.randomUUID == "function" ? e.randomUUID() : T();
57
+ }, D = async () => ({ chatId: E() });
58
58
  //#endregion
59
59
  //#region src/pages/ChatNewPage.tsx
60
- function D({ suggestedActions: e, title1: t, title2: n }) {
61
- let { chatId: i } = d();
62
- return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(r, {
60
+ function O({ chatModels: e, defaultChatModel: t, renderMessagePart: n, suggestedActions: i, title1: a, title2: o }) {
61
+ let { chatId: l } = f(), u = p("root"), d = c({
62
+ defaultChatModel: t,
63
+ models: e
64
+ });
65
+ return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(r, {
66
+ chatModels: e,
67
+ defaultChatModel: t,
63
68
  autoResume: !1,
64
- id: i,
65
- initialChatModel: f("root")?.chatModel ?? "openai/gpt-5.4-mini",
69
+ id: l,
70
+ initialChatModel: u?.chatModel ?? d,
66
71
  initialMessages: [],
67
72
  isReadonly: !1,
68
- suggestedActions: e,
69
- title1: t,
70
- title2: n
71
- }, i), /* @__PURE__ */ m(s, {})] });
73
+ renderMessagePart: n,
74
+ suggestedActions: i,
75
+ title1: a,
76
+ title2: o
77
+ }, l), /* @__PURE__ */ h(s, {})] });
72
78
  }
73
79
  //#endregion
74
80
  //#region src/pages/ChatPage.tsx
75
- function O({ suggestedActions: e, title1: t, title2: n }) {
76
- let { chatId: i, initialChatModel: a, initialMessages: o } = d(), c = f("root");
77
- return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(r, {
81
+ function k({ chatModels: e, defaultChatModel: t, renderMessagePart: n, suggestedActions: i, title1: a, title2: o }) {
82
+ let { chatId: l, initialChatModel: u, initialMessages: d } = f(), _ = p("root"), v = c({
83
+ defaultChatModel: t,
84
+ models: e
85
+ });
86
+ return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(r, {
87
+ chatModels: e,
88
+ defaultChatModel: t,
78
89
  autoResume: !0,
79
- id: i,
80
- initialChatModel: a ?? c?.chatModel ?? "openai/gpt-5.4-mini",
81
- initialMessages: o,
90
+ id: l,
91
+ initialChatModel: u ?? _?.chatModel ?? v,
92
+ initialMessages: d,
82
93
  isReadonly: !1,
83
- suggestedActions: e,
84
- title1: t,
85
- title2: n
86
- }), /* @__PURE__ */ m(s, {})] });
94
+ renderMessagePart: n,
95
+ suggestedActions: i,
96
+ title1: a,
97
+ title2: o
98
+ }), /* @__PURE__ */ h(s, {})] });
87
99
  }
88
100
  //#endregion
89
101
  //#region src/pages/NotFoundPage.tsx
90
- function k() {
102
+ function A() {
91
103
  let { getNewChatPath: e } = t();
92
- return /* @__PURE__ */ m("div", {
104
+ return /* @__PURE__ */ h("div", {
93
105
  className: "h-full min-h-0 p-6",
94
- children: /* @__PURE__ */ h("div", {
106
+ children: /* @__PURE__ */ g("div", {
95
107
  className: "mx-auto max-w-2xl space-y-3",
96
108
  children: [
97
- /* @__PURE__ */ m("h1", {
109
+ /* @__PURE__ */ h("h1", {
98
110
  className: "text-xl font-semibold",
99
- children: /* @__PURE__ */ m("span", { children: "404" })
111
+ children: /* @__PURE__ */ h("span", { children: "404" })
100
112
  }),
101
- /* @__PURE__ */ m("p", {
113
+ /* @__PURE__ */ h("p", {
102
114
  className: "text-sm text-muted-foreground",
103
- children: /* @__PURE__ */ m("span", { children: "Page introuvable." })
115
+ children: /* @__PURE__ */ h("span", { children: "Page introuvable." })
104
116
  }),
105
- /* @__PURE__ */ m(c, {
117
+ /* @__PURE__ */ h(l, {
106
118
  className: "text-sm font-semibold text-foreground underline",
107
119
  to: e(),
108
- children: /* @__PURE__ */ m("span", { children: "Retour" })
120
+ children: /* @__PURE__ */ h("span", { children: "Retour" })
109
121
  })
110
122
  ]
111
123
  })
@@ -113,42 +125,49 @@ function k() {
113
125
  }
114
126
  //#endregion
115
127
  //#region src/client-routes.tsx
116
- function A({ sidebarActions: e, suggestedActions: t, theme: n, title: r, title1: i, title2: o } = {}) {
117
- return /* @__PURE__ */ m(l, {
118
- errorElement: /* @__PURE__ */ m(g, { renderErrorExtra: (e) => /* @__PURE__ */ m(_, { state: e }) }),
119
- children: /* @__PURE__ */ h(l, {
120
- element: /* @__PURE__ */ m(a, {
121
- sidebarActions: e,
122
- theme: n,
123
- title: r
128
+ function j({ chatModels: e, defaultChatModel: t, renderMessagePart: n, renderSidebarChat: r, sidebarActions: i, suggestedActions: o, theme: s, title: c, title1: l, title2: d } = {}) {
129
+ return /* @__PURE__ */ h(u, {
130
+ errorElement: /* @__PURE__ */ h(_, { renderErrorExtra: (e) => /* @__PURE__ */ h(v, { state: e }) }),
131
+ children: /* @__PURE__ */ g(u, {
132
+ element: /* @__PURE__ */ h(a, {
133
+ renderSidebarChat: r,
134
+ sidebarActions: i,
135
+ theme: s,
136
+ title: c
124
137
  }),
125
138
  children: [
126
- /* @__PURE__ */ m(l, {
127
- element: /* @__PURE__ */ m(D, {
128
- suggestedActions: t,
129
- title1: i,
130
- title2: o
139
+ /* @__PURE__ */ h(u, {
140
+ element: /* @__PURE__ */ h(O, {
141
+ chatModels: e,
142
+ defaultChatModel: t,
143
+ renderMessagePart: n,
144
+ suggestedActions: o,
145
+ title1: l,
146
+ title2: d
131
147
  }),
132
148
  index: !0,
133
- loader: E
149
+ loader: D
134
150
  }),
135
- /* @__PURE__ */ m(l, {
136
- element: /* @__PURE__ */ m(O, {
137
- suggestedActions: t,
138
- title1: i,
139
- title2: o
151
+ /* @__PURE__ */ h(u, {
152
+ element: /* @__PURE__ */ h(k, {
153
+ chatModels: e,
154
+ defaultChatModel: t,
155
+ renderMessagePart: n,
156
+ suggestedActions: o,
157
+ title1: l,
158
+ title2: d
140
159
  }),
141
- loader: C,
160
+ loader: w,
142
161
  path: "chat/:id"
143
162
  }),
144
- /* @__PURE__ */ m(l, {
145
- element: /* @__PURE__ */ m(k, {}),
163
+ /* @__PURE__ */ h(u, {
164
+ element: /* @__PURE__ */ h(A, {}),
146
165
  path: "*"
147
166
  })
148
167
  ]
149
168
  })
150
169
  });
151
170
  }
152
- var j = A();
171
+ var M = j();
153
172
  //#endregion
154
- export { j as agentsSdkClientRoutes, j as default, A as createAgentsSdkClientRoutes };
173
+ export { M as agentsSdkClientRoutes, M as default, j as createAgentsSdkClientRoutes };
@@ -1,7 +1,13 @@
1
1
  import "./agents-sdk.css";
2
2
  import type { ReactNode } from "react";
3
3
  import type { AgentsSdkTheme } from "@/components/theme-provider";
4
+ import type { AgentsSdkRenderMessagePart, AgentsSdkRenderSidebarChat } from "@/lib/types";
5
+ import type { ChatModel } from "@/lib/ai/models";
4
6
  export type AgentsSdkClientRoutesOptions = {
7
+ chatModels?: readonly ChatModel[];
8
+ defaultChatModel?: string;
9
+ renderMessagePart?: AgentsSdkRenderMessagePart;
10
+ renderSidebarChat?: AgentsSdkRenderSidebarChat;
5
11
  sidebarActions?: ReactNode;
6
12
  suggestedActions?: readonly string[];
7
13
  theme?: AgentsSdkTheme;
@@ -9,7 +15,7 @@ export type AgentsSdkClientRoutesOptions = {
9
15
  title1?: string;
10
16
  title2?: string;
11
17
  };
12
- export declare function createAgentsSdkClientRoutes({ sidebarActions, suggestedActions, theme, title, title1, title2, }?: AgentsSdkClientRoutesOptions): import("react").JSX.Element;
18
+ export declare function createAgentsSdkClientRoutes({ chatModels, defaultChatModel, renderMessagePart, renderSidebarChat, sidebarActions, suggestedActions, theme, title, title1, title2, }?: AgentsSdkClientRoutesOptions): import("react").JSX.Element;
13
19
  export declare const agentsSdkClientRoutes: import("react").JSX.Element;
14
20
  export default agentsSdkClientRoutes;
15
21
  //# sourceMappingURL=client-routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client-routes.d.ts","sourceRoot":"","sources":["../src/client-routes.tsx"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAQjE,MAAM,MAAM,4BAA4B,GAAG;IACzC,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAA;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,cAAc,EACd,gBAAgB,EAChB,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,GACP,GAAE,4BAAiC,+BA4CnC;AAED,eAAO,MAAM,qBAAqB,6BAAgC,CAAA;AAElE,eAAe,qBAAqB,CAAA"}
1
+ {"version":3,"file":"client-routes.d.ts","sourceRoot":"","sources":["../src/client-routes.tsx"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAMjE,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAGhD,MAAM,MAAM,4BAA4B,GAAG;IACzC,UAAU,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,0BAA0B,CAAC;IAC/C,iBAAiB,CAAC,EAAE,0BAA0B,CAAC;IAC/C,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAA;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,KAAK,EACL,KAAK,EACL,MAAM,EACN,MAAM,GACP,GAAE,4BAAiC,+BAmDnC;AAED,eAAO,MAAM,qBAAqB,6BAAgC,CAAA;AAElE,eAAe,qBAAqB,CAAA"}
@@ -1,25 +1,25 @@
1
- import { c as e, h as t, l as n, n as r, o as i, r as a, s as o, t as s } from "./data-stream-handler-BW4eCG7d.js";
2
- import "./models-DUt7W9lV.js";
3
- import { Link as c, Route as l, redirect as u, useLoaderData as d, useRouteLoaderData as f } from "@rpcbase/router";
4
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
5
- import { RouteErrorBoundary as g } from "@rpcbase/client";
1
+ import { c as e, h as t, l as n, n as r, o as i, r as a, s as o, t as s } from "./data-stream-handler-DXAHFC5k.js";
2
+ import { s as c } from "./models-DphUIx22.js";
3
+ import { Link as l, Route as u, redirect as d, useLoaderData as f, useRouteLoaderData as p } from "@rpcbase/router";
4
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
5
+ import { RouteErrorBoundary as _ } from "@rpcbase/client";
6
6
  //#region src/components/AppErrorExtra.tsx
7
- var _ = (e) => /* @__PURE__ */ m("span", {
7
+ var v = (e) => /* @__PURE__ */ h("span", {
8
8
  className: "agents-sdk contents",
9
- children: /* @__PURE__ */ m("a", {
9
+ children: /* @__PURE__ */ h("a", {
10
10
  href: "/",
11
11
  className: "rounded-md bg-primary px-3.5 py-2.5 text-primary-foreground text-sm font-semibold shadow-sm transition hover:bg-primary/90 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
12
- children: /* @__PURE__ */ m("span", { children: "Retour à l’accueil" })
12
+ children: /* @__PURE__ */ h("span", { children: "Retour à l’accueil" })
13
13
  })
14
- }), v = "http://localhost:9292", y = (e) => {
14
+ }), y = "http://localhost:9292", b = (e) => {
15
15
  let t = e?.req?.get?.("host") || e?.req?.headers?.host, n = e?.req?.protocol || "http";
16
- return t ? `${n}://${t}` : (typeof window < "u" ? window.location?.origin : null) || (typeof process < "u" ? process.env.AGENT_SDK_APP_BASE_URL : null) || v;
17
- }, b = (e) => n(e.request?.url || e?.ctx?.req?.originalUrl || e?.ctx?.req?.url) ?? o(), x = (t, n) => {
16
+ return t ? `${n}://${t}` : (typeof window < "u" ? window.location?.origin : null) || (typeof process < "u" ? process.env.AGENT_SDK_APP_BASE_URL : null) || y;
17
+ }, x = (e) => n(e.request?.url || e?.ctx?.req?.originalUrl || e?.ctx?.req?.url) ?? o(), S = (t, n) => {
18
18
  let r = { ...e(n) }, i = t?.req?.headers?.cookie;
19
19
  return i && (r.cookie = i), r;
20
- }, S = async ({ ctx: e, requestPath: t, tenantId: n }) => {
21
- let r = y(e), i = new URL(t, r), a = await fetch(i, {
22
- headers: x(e, n),
20
+ }, C = async ({ ctx: e, requestPath: t, tenantId: n }) => {
21
+ let r = b(e), i = new URL(t, r), a = await fetch(i, {
22
+ headers: S(e, n),
23
23
  credentials: "include",
24
24
  cache: "no-store"
25
25
  });
@@ -27,17 +27,17 @@ var _ = (e) => /* @__PURE__ */ m("span", {
27
27
  response: a,
28
28
  json: await a.json().catch(() => null)
29
29
  };
30
- }, C = async (e) => {
30
+ }, w = async (e) => {
31
31
  let t = e?.params?.id;
32
- if (typeof t != "string" || t.trim() === "") throw u("..");
33
- let n = b(e), { response: r, json: a } = await S({
32
+ if (typeof t != "string" || t.trim() === "") throw d("..");
33
+ let n = x(e), { response: r, json: a } = await C({
34
34
  ctx: e?.ctx,
35
35
  requestPath: `/api/rb/agents/chat?id=${encodeURIComponent(t)}`,
36
36
  tenantId: n
37
37
  });
38
- if (r.status === 404) throw u("..");
38
+ if (r.status === 404) throw d("..");
39
39
  if (!r.ok) throw Error(`Failed to load chat ${t}`);
40
- let { response: o, json: s } = await S({
40
+ let { response: o, json: s } = await C({
41
41
  ctx: e?.ctx,
42
42
  requestPath: `/api/rb/agents/chat/messages?id=${encodeURIComponent(t)}`,
43
43
  tenantId: n
@@ -48,64 +48,76 @@ var _ = (e) => /* @__PURE__ */ m("span", {
48
48
  initialChatModel: typeof a?.selectedChatModel == "string" && a.selectedChatModel.trim() ? a.selectedChatModel.trim() : null,
49
49
  initialMessages: i(Array.isArray(s) ? s : [])
50
50
  };
51
- }, w = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
51
+ }, T = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
52
52
  let t = Math.floor(Math.random() * 16);
53
53
  return (e === "x" ? t : t & 3 | 8).toString(16);
54
- }), T = () => {
54
+ }), E = () => {
55
55
  let e = globalThis.crypto;
56
- return e && "randomUUID" in e && typeof e.randomUUID == "function" ? e.randomUUID() : w();
57
- }, E = async () => ({ chatId: T() });
56
+ return e && "randomUUID" in e && typeof e.randomUUID == "function" ? e.randomUUID() : T();
57
+ }, D = async () => ({ chatId: E() });
58
58
  //#endregion
59
59
  //#region src/pages/ChatNewPage.tsx
60
- function D({ suggestedActions: e, title1: t, title2: n }) {
61
- let { chatId: i } = d();
62
- return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(r, {
60
+ function O({ chatModels: e, defaultChatModel: t, renderMessagePart: n, suggestedActions: i, title1: a, title2: o }) {
61
+ let { chatId: l } = f(), u = p("root"), d = c({
62
+ defaultChatModel: t,
63
+ models: e
64
+ });
65
+ return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(r, {
66
+ chatModels: e,
67
+ defaultChatModel: t,
63
68
  autoResume: !1,
64
- id: i,
65
- initialChatModel: f("root")?.chatModel ?? "openai/gpt-5.4-mini",
69
+ id: l,
70
+ initialChatModel: u?.chatModel ?? d,
66
71
  initialMessages: [],
67
72
  isReadonly: !1,
68
- suggestedActions: e,
69
- title1: t,
70
- title2: n
71
- }, i), /* @__PURE__ */ m(s, {})] });
73
+ renderMessagePart: n,
74
+ suggestedActions: i,
75
+ title1: a,
76
+ title2: o
77
+ }, l), /* @__PURE__ */ h(s, {})] });
72
78
  }
73
79
  //#endregion
74
80
  //#region src/pages/ChatPage.tsx
75
- function O({ suggestedActions: e, title1: t, title2: n }) {
76
- let { chatId: i, initialChatModel: a, initialMessages: o } = d(), c = f("root");
77
- return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(r, {
81
+ function k({ chatModels: e, defaultChatModel: t, renderMessagePart: n, suggestedActions: i, title1: a, title2: o }) {
82
+ let { chatId: l, initialChatModel: u, initialMessages: d } = f(), _ = p("root"), v = c({
83
+ defaultChatModel: t,
84
+ models: e
85
+ });
86
+ return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(r, {
87
+ chatModels: e,
88
+ defaultChatModel: t,
78
89
  autoResume: !0,
79
- id: i,
80
- initialChatModel: a ?? c?.chatModel ?? "openai/gpt-5.4-mini",
81
- initialMessages: o,
90
+ id: l,
91
+ initialChatModel: u ?? _?.chatModel ?? v,
92
+ initialMessages: d,
82
93
  isReadonly: !1,
83
- suggestedActions: e,
84
- title1: t,
85
- title2: n
86
- }), /* @__PURE__ */ m(s, {})] });
94
+ renderMessagePart: n,
95
+ suggestedActions: i,
96
+ title1: a,
97
+ title2: o
98
+ }), /* @__PURE__ */ h(s, {})] });
87
99
  }
88
100
  //#endregion
89
101
  //#region src/pages/NotFoundPage.tsx
90
- function k() {
102
+ function A() {
91
103
  let { getNewChatPath: e } = t();
92
- return /* @__PURE__ */ m("div", {
104
+ return /* @__PURE__ */ h("div", {
93
105
  className: "h-full min-h-0 p-6",
94
- children: /* @__PURE__ */ h("div", {
106
+ children: /* @__PURE__ */ g("div", {
95
107
  className: "mx-auto max-w-2xl space-y-3",
96
108
  children: [
97
- /* @__PURE__ */ m("h1", {
109
+ /* @__PURE__ */ h("h1", {
98
110
  className: "text-xl font-semibold",
99
- children: /* @__PURE__ */ m("span", { children: "404" })
111
+ children: /* @__PURE__ */ h("span", { children: "404" })
100
112
  }),
101
- /* @__PURE__ */ m("p", {
113
+ /* @__PURE__ */ h("p", {
102
114
  className: "text-sm text-muted-foreground",
103
- children: /* @__PURE__ */ m("span", { children: "Page introuvable." })
115
+ children: /* @__PURE__ */ h("span", { children: "Page introuvable." })
104
116
  }),
105
- /* @__PURE__ */ m(c, {
117
+ /* @__PURE__ */ h(l, {
106
118
  className: "text-sm font-semibold text-foreground underline",
107
119
  to: e(),
108
- children: /* @__PURE__ */ m("span", { children: "Retour" })
120
+ children: /* @__PURE__ */ h("span", { children: "Retour" })
109
121
  })
110
122
  ]
111
123
  })
@@ -113,42 +125,49 @@ function k() {
113
125
  }
114
126
  //#endregion
115
127
  //#region src/client-routes.tsx
116
- function A({ sidebarActions: e, suggestedActions: t, theme: n, title: r, title1: i, title2: o } = {}) {
117
- return /* @__PURE__ */ m(l, {
118
- errorElement: /* @__PURE__ */ m(g, { renderErrorExtra: (e) => /* @__PURE__ */ m(_, { state: e }) }),
119
- children: /* @__PURE__ */ h(l, {
120
- element: /* @__PURE__ */ m(a, {
121
- sidebarActions: e,
122
- theme: n,
123
- title: r
128
+ function j({ chatModels: e, defaultChatModel: t, renderMessagePart: n, renderSidebarChat: r, sidebarActions: i, suggestedActions: o, theme: s, title: c, title1: l, title2: d } = {}) {
129
+ return /* @__PURE__ */ h(u, {
130
+ errorElement: /* @__PURE__ */ h(_, { renderErrorExtra: (e) => /* @__PURE__ */ h(v, { state: e }) }),
131
+ children: /* @__PURE__ */ g(u, {
132
+ element: /* @__PURE__ */ h(a, {
133
+ renderSidebarChat: r,
134
+ sidebarActions: i,
135
+ theme: s,
136
+ title: c
124
137
  }),
125
138
  children: [
126
- /* @__PURE__ */ m(l, {
127
- element: /* @__PURE__ */ m(D, {
128
- suggestedActions: t,
129
- title1: i,
130
- title2: o
139
+ /* @__PURE__ */ h(u, {
140
+ element: /* @__PURE__ */ h(O, {
141
+ chatModels: e,
142
+ defaultChatModel: t,
143
+ renderMessagePart: n,
144
+ suggestedActions: o,
145
+ title1: l,
146
+ title2: d
131
147
  }),
132
148
  index: !0,
133
- loader: E
149
+ loader: D
134
150
  }),
135
- /* @__PURE__ */ m(l, {
136
- element: /* @__PURE__ */ m(O, {
137
- suggestedActions: t,
138
- title1: i,
139
- title2: o
151
+ /* @__PURE__ */ h(u, {
152
+ element: /* @__PURE__ */ h(k, {
153
+ chatModels: e,
154
+ defaultChatModel: t,
155
+ renderMessagePart: n,
156
+ suggestedActions: o,
157
+ title1: l,
158
+ title2: d
140
159
  }),
141
- loader: C,
160
+ loader: w,
142
161
  path: "chat/:id"
143
162
  }),
144
- /* @__PURE__ */ m(l, {
145
- element: /* @__PURE__ */ m(k, {}),
163
+ /* @__PURE__ */ h(u, {
164
+ element: /* @__PURE__ */ h(A, {}),
146
165
  path: "*"
147
166
  })
148
167
  ]
149
168
  })
150
169
  });
151
170
  }
152
- var j = A();
171
+ var M = j();
153
172
  //#endregion
154
- export { j as agentsSdkClientRoutes, j as default, A as createAgentsSdkClientRoutes };
173
+ export { M as agentsSdkClientRoutes, M as default, j as createAgentsSdkClientRoutes };
@@ -1,19 +1,22 @@
1
1
  import { type ReactNode } from "react";
2
2
  import { type SidebarHistoryState } from "@/components/sidebar-history";
3
3
  import { type AgentsSdkTheme } from "@/components/theme-provider";
4
+ import type { AgentsSdkRenderSidebarChat } from "@/lib/types";
4
5
  type AgentsChatRouteLayoutProps = {
6
+ renderSidebarChat?: AgentsSdkRenderSidebarChat;
5
7
  sidebarActions?: ReactNode;
6
8
  theme?: AgentsSdkTheme;
7
9
  title?: string;
8
10
  };
9
- export declare function AgentsChatRouteLayout({ sidebarActions, theme, title, }: AgentsChatRouteLayoutProps): import("react").JSX.Element;
11
+ export declare function AgentsChatRouteLayout({ renderSidebarChat, sidebarActions, theme, title, }: AgentsChatRouteLayoutProps): import("react").JSX.Element;
10
12
  type AgentsChatSidebarPanelProps = {
11
13
  historyState: SidebarHistoryState;
12
14
  mode: "docked" | "floating" | "mobile";
13
15
  onActiveChatTitleChange: (title: string | null) => void;
16
+ renderSidebarChat?: AgentsSdkRenderSidebarChat;
14
17
  sidebarActions?: ReactNode;
15
18
  startNewChat: () => void;
16
19
  };
17
- export declare function AgentsChatSidebarPanel({ historyState, mode, onActiveChatTitleChange, sidebarActions, startNewChat, }: AgentsChatSidebarPanelProps): import("react").JSX.Element;
20
+ export declare function AgentsChatSidebarPanel({ historyState, mode, onActiveChatTitleChange, renderSidebarChat, sidebarActions, startNewChat, }: AgentsChatSidebarPanelProps): import("react").JSX.Element;
18
21
  export {};
19
22
  //# sourceMappingURL=agents-chat-route-layout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agents-chat-route-layout.d.ts","sourceRoot":"","sources":["../../src/components/agents-chat-route-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAmB3D,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAkB1F,KAAK,0BAA0B,GAAG;IAChC,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAA;AA8BD,wBAAgB,qBAAqB,CAAC,EACpC,cAAc,EACd,KAAK,EACL,KAAgB,GACjB,EAAE,0BAA0B,+BA+E5B;AA+LD,KAAK,2BAA2B,GAAG;IACjC,YAAY,EAAE,mBAAmB,CAAC;IAClC,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;IACvC,uBAAuB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAA;AAED,wBAAgB,sBAAsB,CAAC,EACrC,YAAY,EACZ,IAAI,EACJ,uBAAuB,EACvB,cAAc,EACd,YAAY,GACb,EAAE,2BAA2B,+BAgC7B"}
1
+ {"version":3,"file":"agents-chat-route-layout.d.ts","sourceRoot":"","sources":["../../src/components/agents-chat-route-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAmB3D,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC1F,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AAkB7D,KAAK,0BAA0B,GAAG;IAChC,iBAAiB,CAAC,EAAE,0BAA0B,CAAC;IAC/C,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAA;AA8BD,wBAAgB,qBAAqB,CAAC,EACpC,iBAAiB,EACjB,cAAc,EACd,KAAK,EACL,KAAgB,GACjB,EAAE,0BAA0B,+BAgF5B;AAuMD,KAAK,2BAA2B,GAAG;IACjC,YAAY,EAAE,mBAAmB,CAAC;IAClC,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;IACvC,uBAAuB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,iBAAiB,CAAC,EAAE,0BAA0B,CAAC;IAC/C,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAA;AAED,wBAAgB,sBAAsB,CAAC,EACrC,YAAY,EACZ,IAAI,EACJ,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,YAAY,GACb,EAAE,2BAA2B,+BAiC7B"}
@@ -1,6 +1,6 @@
1
1
  import type { UseChatHelpers } from "@ai-sdk/react";
2
2
  import type { Vote } from "@/lib/db/schema";
3
- import type { ChatMessage } from "@/lib/types";
3
+ import type { AgentsSdkRenderMessagePart, ChatMessage } from "@/lib/types";
4
4
  import type { UIArtifact } from "./artifact";
5
5
  type ArtifactMessagesProps = {
6
6
  addToolApprovalResponse: UseChatHelpers<ChatMessage>["addToolApprovalResponse"];
@@ -8,12 +8,13 @@ type ArtifactMessagesProps = {
8
8
  status: UseChatHelpers<ChatMessage>["status"];
9
9
  votes: Vote[] | undefined;
10
10
  messages: ChatMessage[];
11
+ renderMessagePart?: AgentsSdkRenderMessagePart;
11
12
  setMessages: UseChatHelpers<ChatMessage>["setMessages"];
12
13
  regenerate: UseChatHelpers<ChatMessage>["regenerate"];
13
14
  isReadonly: boolean;
14
15
  artifactStatus: UIArtifact["status"];
15
16
  };
16
- declare function PureArtifactMessages({ addToolApprovalResponse, chatId, status, votes, messages, setMessages, regenerate, isReadonly, }: ArtifactMessagesProps): import("react").JSX.Element;
17
+ declare function PureArtifactMessages({ addToolApprovalResponse, chatId, status, votes, messages, renderMessagePart, setMessages, regenerate, isReadonly, }: ArtifactMessagesProps): import("react").JSX.Element;
17
18
  export declare const ArtifactMessages: import("react").MemoExoticComponent<typeof PureArtifactMessages>;
18
19
  export {};
19
20
  //# sourceMappingURL=artifact-messages.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"artifact-messages.d.ts","sourceRoot":"","sources":["../../src/components/artifact-messages.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAMnD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAI5C,KAAK,qBAAqB,GAAG;IAC3B,uBAAuB,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,yBAAyB,CAAC,CAAC;IAChF,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC9C,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,WAAW,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,aAAa,CAAC,CAAC;IACxD,UAAU,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,CAAC;IACtD,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;CACtC,CAAC;AAEF,iBAAS,oBAAoB,CAAC,EAC5B,uBAAuB,EACvB,MAAM,EACN,MAAM,EACN,KAAK,EACL,QAAQ,EACR,WAAW,EACX,UAAU,EACV,UAAU,GACX,EAAE,qBAAqB,+BAsDvB;AA6BD,eAAO,MAAM,gBAAgB,kEAAuC,CAAA"}
1
+ {"version":3,"file":"artifact-messages.d.ts","sourceRoot":"","sources":["../../src/components/artifact-messages.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAMnD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,0BAA0B,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAI5C,KAAK,qBAAqB,GAAG;IAC3B,uBAAuB,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,yBAAyB,CAAC,CAAC;IAChF,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC9C,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;IAC1B,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,iBAAiB,CAAC,EAAE,0BAA0B,CAAC;IAC/C,WAAW,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,aAAa,CAAC,CAAC;IACxD,UAAU,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,CAAC;IACtD,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;CACtC,CAAC;AAEF,iBAAS,oBAAoB,CAAC,EAC5B,uBAAuB,EACvB,MAAM,EACN,MAAM,EACN,KAAK,EACL,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,UAAU,EACV,UAAU,GACX,EAAE,qBAAqB,+BAuDvB;AAgCD,eAAO,MAAM,gBAAgB,kEAAuC,CAAA"}
@@ -1,7 +1,8 @@
1
1
  import type { UseChatHelpers } from "@ai-sdk/react";
2
2
  import { type Dispatch, type SetStateAction } from "react";
3
+ import type { ChatModel } from "@/lib/ai/models";
3
4
  import type { Vote } from "@/lib/db/schema";
4
- import type { Attachment, ChatMessage } from "@/lib/types";
5
+ import type { AgentsSdkRenderMessagePart, Attachment, ChatMessage } from "@/lib/types";
5
6
  export declare const artifactDefinitions: (import("./create-artifact").Artifact<"text", {
6
7
  suggestions: import("@/lib/db/schema").Suggestion[];
7
8
  }> | import("./create-artifact").Artifact<"code", {
@@ -22,7 +23,7 @@ export type UIArtifact = {
22
23
  height: number;
23
24
  };
24
25
  };
25
- declare function PureArtifact({ addToolApprovalResponse, chatId, input, setInput, status, stop, attachments, setAttachments, sendMessage, messages, setMessages, regenerate, votes, isReadonly, selectedModelId, suggestedActions, }: {
26
+ declare function PureArtifact({ addToolApprovalResponse, chatId, input, setInput, status, stop, attachments, setAttachments, chatModels, defaultChatModel, sendMessage, messages, setMessages, regenerate, renderMessagePart, votes, isReadonly, selectedModelId, suggestedActions, }: {
26
27
  addToolApprovalResponse: UseChatHelpers<ChatMessage>["addToolApprovalResponse"];
27
28
  chatId: string;
28
29
  input: string;
@@ -31,11 +32,14 @@ declare function PureArtifact({ addToolApprovalResponse, chatId, input, setInput
31
32
  stop: UseChatHelpers<ChatMessage>["stop"];
32
33
  attachments: Attachment[];
33
34
  setAttachments: Dispatch<SetStateAction<Attachment[]>>;
35
+ chatModels?: readonly ChatModel[];
36
+ defaultChatModel: string;
34
37
  messages: ChatMessage[];
35
38
  setMessages: UseChatHelpers<ChatMessage>["setMessages"];
36
39
  votes: Vote[] | undefined;
37
40
  sendMessage: UseChatHelpers<ChatMessage>["sendMessage"];
38
41
  regenerate: UseChatHelpers<ChatMessage>["regenerate"];
42
+ renderMessagePart?: AgentsSdkRenderMessagePart;
39
43
  isReadonly: boolean;
40
44
  selectedModelId: string;
41
45
  suggestedActions?: readonly string[];
@@ -1 +1 @@
1
- {"version":3,"file":"artifact.d.ts","sourceRoot":"","sources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