@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,5 +1,5 @@
1
1
  import { t as e } from "./apiErrors-FdS4Eh1H.js";
2
- import { m as t, r as n, s as r } from "./chatDb-DdX0Vtyt.js";
2
+ import { m as t, r as n, s as r } from "./chatDb-BSiHIyn9.js";
3
3
  import { z as i } from "zod";
4
4
  //#region src/api/document/index.ts
5
5
  var a = "/api/rb/agents/document";
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./chatCtx-BWOFI93u.js";
2
2
  import { t } from "./apiErrors-FdS4Eh1H.js";
3
- import { o as n, t as r } from "./chatDb-DdX0Vtyt.js";
3
+ import { o as n, t as r } from "./chatDb-BSiHIyn9.js";
4
4
  import { z as i } from "zod";
5
5
  //#region src/api/history/index.ts
6
6
  var a = "/api/rb/agents/history";
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./apiErrors-CFUx-UrE.js";
2
- import { d as t, x as n } from "./chatDb-CcAjAGX7.js";
2
+ import { S as t, d as n } from "./chatDb-YfeABtn-.js";
3
3
  import { z as r } from "zod";
4
4
  //#region src/api/vote/index.ts
5
5
  var i = "/api/rb/agents/vote";
@@ -9,9 +9,9 @@ r.any(), r.any();
9
9
  var a = (e) => {
10
10
  let t = e.query?.chatId, n = Array.isArray(t) ? t[0] : t;
11
11
  return typeof n == "string" && n.trim() !== "" ? n : null;
12
- }, o = async (n, r) => {
12
+ }, o = async (t, r) => {
13
13
  let i = a(r.req);
14
- return i ? t(r, i) : e(r, "bad_request:api", "Parameter chatId is required.");
14
+ return i ? n(r, i) : e(r, "bad_request:api", "Parameter chatId is required.");
15
15
  }, s = (e) => {
16
16
  if (e && typeof e == "object") return e;
17
17
  if (typeof e == "string" && e.trim() !== "") try {
@@ -21,14 +21,14 @@ var a = (e) => {
21
21
  }
22
22
  return null;
23
23
  }, c = (e) => {
24
- e.get(i, o), e.use(i, async (e, t, r) => {
24
+ e.get(i, o), e.use(i, async (e, n, r) => {
25
25
  if (e.method !== "PATCH") {
26
26
  r();
27
27
  return;
28
28
  }
29
29
  let i = s(e.body), a = typeof i?.chatId == "string" ? i.chatId : null, o = typeof i?.messageId == "string" ? i.messageId : null, c = i?.type === "up" || i?.type === "down" ? i.type : null;
30
30
  if (!a || !o || !c) {
31
- t.status(400).json({
31
+ n.status(400).json({
32
32
  code: "bad_request:api",
33
33
  message: "bad_request:api",
34
34
  cause: "Parameters chatId, messageId, and type are required."
@@ -36,23 +36,23 @@ var a = (e) => {
36
36
  return;
37
37
  }
38
38
  try {
39
- await n({
39
+ await t({
40
40
  req: e,
41
- res: t
41
+ res: n
42
42
  }, {
43
43
  chatId: a,
44
44
  messageId: o,
45
45
  type: c
46
46
  });
47
47
  } catch (e) {
48
- console.error(e), t.status(500).json({
48
+ console.error(e), n.status(500).json({
49
49
  code: "internal:api",
50
50
  message: "internal:api",
51
51
  cause: "Failed to vote message."
52
52
  });
53
53
  return;
54
54
  }
55
- t.status(200).send("Message voted");
55
+ n.status(200).send("Message voted");
56
56
  });
57
57
  };
58
58
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./apiErrors-FdS4Eh1H.js";
2
- import { u as t } from "./chatDb-DdX0Vtyt.js";
2
+ import { u as t } from "./chatDb-BSiHIyn9.js";
3
3
  import { z as n } from "zod";
4
4
  //#region src/api/suggestions/index.ts
5
5
  var r = "/api/rb/agents/suggestions";
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./apiErrors-FdS4Eh1H.js";
2
- import { a as t, c as n, i as r } from "./chatDb-DdX0Vtyt.js";
2
+ import { a as t, c as n, i as r } from "./chatDb-BSiHIyn9.js";
3
3
  import { z as i } from "zod";
4
4
  //#region src/api/chat/messages/trailing/index.ts
5
5
  var a = "/api/rb/agents/chat/messages/trailing";
@@ -1,4 +1,4 @@
1
- import { f as e } from "./chatDb-DdX0Vtyt.js";
1
+ import { f as e } from "./chatDb-YfeABtn-.js";
2
2
  import { z as t } from "zod";
3
3
  //#region src/api/test/reset/index.ts
4
4
  var n = "/api/rb/agents/test/reset";
@@ -1,5 +1,6 @@
1
- import { a as e, d as t, f as n, h as r, i, m as a, n as o, p as s, r as c, t as l, u } from "./data-stream-handler-Bd_oM4r9.js";
1
+ import { a as e, d as t, f as n, h as r, i, m as a, n as o, p as s, r as c, t as l, u } from "./data-stream-handler-lr4wJ3vt.js";
2
+ import { a as d, i as f, n as p, o as m, r as h, s as g, t as _ } from "./models-DphUIx22.js";
2
3
  //#region src/index.ts
3
- var d = () => "hello world";
4
+ var v = () => "hello world";
4
5
  //#endregion
5
- export { e as AgentsChatHistory, t as AgentsChatNavigationProvider, c as AgentsChatRouteLayout, i as AgentsChatSidebarPanel, o as Chat, l as DataStreamHandler, u as DataStreamProvider, n as getAgentsChatBasePath, s as getChatIdFromPathname, d as helloWorld, a as joinAgentsChatPath, r as useAgentsChatNavigation };
6
+ export { e as AgentsChatHistory, t as AgentsChatNavigationProvider, c as AgentsChatRouteLayout, i as AgentsChatSidebarPanel, o as Chat, _ as DEFAULT_CHAT_MODEL, l as DataStreamHandler, u as DataStreamProvider, p as allowedModelIds, h as chatModels, n as getAgentsChatBasePath, f as getAllowedModelIds, s as getChatIdFromPathname, d as getModelsByProvider, v as helloWorld, a as joinAgentsChatPath, m as modelsByProvider, g as resolveDefaultChatModel, r as useAgentsChatNavigation };
package/dist/index.d.ts CHANGED
@@ -6,4 +6,6 @@ export { Chat } from "./components/chat";
6
6
  export { DataStreamHandler } from "./components/data-stream-handler";
7
7
  export { DataStreamProvider } from "./components/data-stream-provider";
8
8
  export { SidebarHistory as AgentsChatHistory } from "./components/sidebar-history";
9
+ export { allowedModelIds, chatModels, DEFAULT_CHAT_MODEL, getAllowedModelIds, getModelsByProvider, modelsByProvider, resolveDefaultChatModel, type ChatModel, } from "./lib/ai/models";
10
+ export type { AgentsSdkRenderMessagePart, AgentsSdkRenderMessagePartInput, AgentsSdkRenderSidebarChat, AgentsSdkRenderSidebarChatInput, AgentsSdkSidebarChat, ChatMessage, } from "./lib/types";
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAA;AAGzB,eAAO,MAAM,UAAU,cAAsB,CAAA;AAE7C,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,oBAAoB,GAC1B,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAA;AAGzB,eAAO,MAAM,UAAU,cAAsB,CAAA;AAE7C,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,KAAK,oBAAoB,GAC1B,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAClF,OAAO,EACL,eAAe,EACf,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,KAAK,SAAS,GACf,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACV,0BAA0B,EAC1B,+BAA+B,EAC/B,0BAA0B,EAC1B,+BAA+B,EAC/B,oBAAoB,EACpB,WAAW,GACZ,MAAM,aAAa,CAAA"}
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
- import { a as e, d as t, f as n, h as r, i, m as a, n as o, p as s, r as c, t as l, u } from "./data-stream-handler-BW4eCG7d.js";
1
+ import { a as e, d as t, f as n, h as r, i, m as a, n as o, p as s, r as c, t as l, u } from "./data-stream-handler-DXAHFC5k.js";
2
+ import { a as d, i as f, n as p, o as m, r as h, s as g, t as _ } from "./models-DphUIx22.js";
2
3
  //#region src/index.ts
3
- var d = () => "hello world";
4
+ var v = () => "hello world";
4
5
  //#endregion
5
- export { e as AgentsChatHistory, t as AgentsChatNavigationProvider, c as AgentsChatRouteLayout, i as AgentsChatSidebarPanel, o as Chat, l as DataStreamHandler, u as DataStreamProvider, n as getAgentsChatBasePath, s as getChatIdFromPathname, d as helloWorld, a as joinAgentsChatPath, r as useAgentsChatNavigation };
6
+ export { e as AgentsChatHistory, t as AgentsChatNavigationProvider, c as AgentsChatRouteLayout, i as AgentsChatSidebarPanel, o as Chat, _ as DEFAULT_CHAT_MODEL, l as DataStreamHandler, u as DataStreamProvider, p as allowedModelIds, h as chatModels, n as getAgentsChatBasePath, f as getAllowedModelIds, s as getChatIdFromPathname, d as getModelsByProvider, v as helloWorld, a as joinAgentsChatPath, m as modelsByProvider, g as resolveDefaultChatModel, r as useAgentsChatNavigation };
@@ -7,5 +7,11 @@ export type ChatModel = {
7
7
  };
8
8
  export declare const chatModels: ChatModel[];
9
9
  export declare const allowedModelIds: Set<string>;
10
+ export declare function getModelsByProvider(models?: readonly ChatModel[]): Record<string, ChatModel[]>;
11
+ export declare function getAllowedModelIds(models?: readonly ChatModel[]): Set<string>;
12
+ export declare function resolveDefaultChatModel(input?: {
13
+ defaultChatModel?: string;
14
+ models?: readonly ChatModel[];
15
+ }): string;
10
16
  export declare const modelsByProvider: Record<string, ChatModel[]>;
11
17
  //# sourceMappingURL=models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/lib/ai/models.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,wBAAwB,CAAA;AAEvD,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,SAAS,EAyBjC,CAAA;AAED,eAAO,MAAM,eAAe,aAA+C,CAAA;AAG3E,eAAO,MAAM,gBAAgB,6BAS5B,CAAA"}
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/lib/ai/models.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,wBAAwB,CAAA;AAEvD,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,SAAS,EAyBjC,CAAA;AAED,eAAO,MAAM,eAAe,aAA+C,CAAA;AAE3E,wBAAgB,mBAAmB,CAAC,MAAM,GAAE,SAAS,SAAS,EAAe,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAW1G;AAED,wBAAgB,kBAAkB,CAAC,MAAM,GAAE,SAAS,SAAS,EAAe,GAAG,GAAG,CAAC,MAAM,CAAC,CAEzF;AAED,wBAAgB,uBAAuB,CAAC,KAAK,GAAE;IAC7C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;CAC1B,GAAG,MAAM,CAcd;AAED,eAAO,MAAM,gBAAgB,6BAAkC,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import type { UIMessage, UITool } from "ai";
2
+ import type { ReactNode } from "react";
2
3
  import { z } from "zod";
3
4
  import type { ArtifactKind } from "@/components/artifact";
4
5
  import type { Suggestion } from "./db/schema";
@@ -26,6 +27,28 @@ export type CustomUIDataTypes = {
26
27
  "chat-title": string;
27
28
  };
28
29
  export type ChatMessage = UIMessage<MessageMetadata, CustomUIDataTypes, ChatTools>;
30
+ export type AgentsSdkRenderMessagePartInput = {
31
+ isLoading: boolean;
32
+ isReadonly: boolean;
33
+ message: ChatMessage;
34
+ part: ChatMessage["parts"][number];
35
+ };
36
+ export type AgentsSdkRenderMessagePart = (input: AgentsSdkRenderMessagePartInput) => ReactNode | undefined;
37
+ export type AgentsSdkSidebarChat = {
38
+ _id?: string;
39
+ id: string;
40
+ createdAt?: string | Date;
41
+ title: string;
42
+ userId?: string;
43
+ isStreaming?: boolean;
44
+ };
45
+ export type AgentsSdkRenderSidebarChatInput = {
46
+ chat: AgentsSdkSidebarChat;
47
+ isActive: boolean;
48
+ isStreaming: boolean;
49
+ title: string;
50
+ };
51
+ export type AgentsSdkRenderSidebarChat = (input: AgentsSdkRenderSidebarChatInput) => ReactNode | undefined;
29
52
  export type Attachment = {
30
53
  name: string;
31
54
  url: string;
@@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AO,CAAC;IACpB,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,CACvC,KAAK,EAAE,+BAA+B,KACnC,SAAS,GAAG,SAAS,CAAC;AAE3B,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,oBAAoB,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,CACvC,KAAK,EAAE,+BAA+B,KACnC,SAAS,GAAG,SAAS,CAAC;AAE3B,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC"}
@@ -24,6 +24,17 @@ var e = "openai/gpt-5.4-mini", t = [
24
24
  provider: "reasoning",
25
25
  description: "Latest xAI flagship model with configurable reasoning"
26
26
  }
27
- ], n = new Set(t.map((e) => e.id)), r = t.reduce((e, t) => (e[t.provider] || (e[t.provider] = []), e[t.provider].push(t), e), {});
27
+ ], n = new Set(t.map((e) => e.id));
28
+ function r(e = t) {
29
+ return e.reduce((e, t) => (e[t.provider] || (e[t.provider] = []), e[t.provider].push(t), e), {});
30
+ }
31
+ function i(e = t) {
32
+ return new Set(e.map((e) => e.id));
33
+ }
34
+ function a(n = {}) {
35
+ let r = n.models && n.models.length > 0 ? n.models : t, a = i(r), o = n.defaultChatModel?.trim();
36
+ return o && a.has(o) ? o : a.has("openai/gpt-5.4-mini") ? e : r[0]?.id ?? "openai/gpt-5.4-mini";
37
+ }
38
+ var o = r(t);
28
39
  //#endregion
29
- export { r as i, n, t as r, e as t };
40
+ export { r as a, i, n, o, t as r, a as s, e as t };
@@ -1,8 +1,13 @@
1
+ import { type ChatModel } from "@/lib/ai/models";
2
+ import type { AgentsSdkRenderMessagePart } from "@/lib/types";
1
3
  type ChatNewPageProps = {
4
+ chatModels?: readonly ChatModel[];
5
+ defaultChatModel?: string;
6
+ renderMessagePart?: AgentsSdkRenderMessagePart;
2
7
  suggestedActions?: readonly string[];
3
8
  title1?: string;
4
9
  title2?: string;
5
10
  };
6
- export default function ChatNewPage({ suggestedActions, title1, title2, }: ChatNewPageProps): import("react").JSX.Element;
11
+ export default function ChatNewPage({ chatModels, defaultChatModel, renderMessagePart, suggestedActions, title1, title2, }: ChatNewPageProps): import("react").JSX.Element;
7
12
  export {};
8
13
  //# sourceMappingURL=ChatNewPage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatNewPage.d.ts","sourceRoot":"","sources":["../../src/pages/ChatNewPage.tsx"],"names":[],"mappings":"AASA,KAAK,gBAAgB,GAAG;IACtB,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,gBAAgB,EAChB,MAAM,EACN,MAAM,GACP,EAAE,gBAAgB,+BAqBlB"}
1
+ {"version":3,"file":"ChatNewPage.d.ts","sourceRoot":"","sources":["../../src/pages/ChatNewPage.tsx"],"names":[],"mappings":"AAKA,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEzE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AAG7D,KAAK,gBAAgB,GAAG;IACtB,UAAU,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,0BAA0B,CAAC;IAC/C,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,EACN,MAAM,GACP,EAAE,gBAAgB,+BA4BlB"}
@@ -1,8 +1,13 @@
1
+ import { type ChatModel } from "@/lib/ai/models";
2
+ import type { AgentsSdkRenderMessagePart } from "@/lib/types";
1
3
  type ChatPageProps = {
4
+ chatModels?: readonly ChatModel[];
5
+ defaultChatModel?: string;
6
+ renderMessagePart?: AgentsSdkRenderMessagePart;
2
7
  suggestedActions?: readonly string[];
3
8
  title1?: string;
4
9
  title2?: string;
5
10
  };
6
- export default function ChatPage({ suggestedActions, title1, title2, }: ChatPageProps): import("react").JSX.Element;
11
+ export default function ChatPage({ chatModels, defaultChatModel, renderMessagePart, suggestedActions, title1, title2, }: ChatPageProps): import("react").JSX.Element;
7
12
  export {};
8
13
  //# sourceMappingURL=ChatPage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatPage.d.ts","sourceRoot":"","sources":["../../src/pages/ChatPage.tsx"],"names":[],"mappings":"AASA,KAAK,aAAa,GAAG;IACnB,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,gBAAgB,EAChB,MAAM,EACN,MAAM,GACP,EAAE,aAAa,+BAsBf"}
1
+ {"version":3,"file":"ChatPage.d.ts","sourceRoot":"","sources":["../../src/pages/ChatPage.tsx"],"names":[],"mappings":"AAKA,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEzE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AAG7D,KAAK,aAAa,GAAG;IACnB,UAAU,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,0BAA0B,CAAC;IAC/C,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,EACN,MAAM,GACP,EAAE,aAAa,+BA6Bf"}
@@ -1,19 +1,19 @@
1
1
  //#region src/routes.ts
2
2
  var e = Object.entries({ .../* @__PURE__ */ Object.assign({
3
- "./api/chat/handler.ts": () => import("./handler-ClWOGjB_.js"),
4
- "./api/chat/messages/handler.ts": () => import("./handler-mbDBRYl8.js"),
5
- "./api/chat/messages/trailing/handler.ts": () => import("./handler-dVlpopfq.js"),
3
+ "./api/chat/handler.ts": () => import("./handler-DE8agLBS.js"),
4
+ "./api/chat/messages/handler.ts": () => import("./handler-C8gaYgmy.js"),
5
+ "./api/chat/messages/trailing/handler.ts": () => import("./handler-By86dyTJ.js"),
6
6
  "./api/chat/stream/handler.ts": () => import("./handler-uF8GJoVX.js"),
7
- "./api/document/handler.ts": () => import("./handler-BeWk8pDD.js"),
8
- "./api/history/handler.ts": () => import("./handler-CGV7uuUA.js"),
7
+ "./api/document/handler.ts": () => import("./handler-C0MO52d9.js"),
8
+ "./api/history/handler.ts": () => import("./handler-B3uUDuTR.js"),
9
9
  "./api/ping/handler.ts": () => import("./handler-DF3WRSDj.js"),
10
10
  "./api/session/current/handler.ts": () => import("./handler-BdCGoVUM.js"),
11
11
  "./api/session/tenant/handler.ts": () => import("./handler-D752oOcY.js"),
12
12
  "./api/stream-test/handler.ts": () => import("./handler-BdXUC9Rg.js"),
13
- "./api/suggestions/handler.ts": () => import("./handler-BLG0AYVC.js"),
14
- "./api/test/reset/handler.ts": () => import("./handler-CEk1hut1.js"),
13
+ "./api/suggestions/handler.ts": () => import("./handler-BMeUL2iE.js"),
14
+ "./api/test/reset/handler.ts": () => import("./handler-svaSKC2q.js"),
15
15
  "./api/upload/handler.ts": () => import("./handler-D74Wi6e9.js"),
16
- "./api/vote/handler.ts": () => import("./handler-BKT8Hl0a.js")
16
+ "./api/vote/handler.ts": () => import("./handler-Jua6SU39.js")
17
17
  }) }).reduce((e, [t, n]) => (e[t.replace("./api/", "@rpcbase/agents-sdk/api/")] = n, e), {});
18
18
  //#endregion
19
19
  export { e as routes };
package/dist/routes.js CHANGED
@@ -1,19 +1,19 @@
1
1
  //#region src/routes.ts
2
2
  var e = Object.entries({ .../* @__PURE__ */ Object.assign({
3
- "./api/chat/handler.ts": () => import("./handler-DPuJK6ft.js").then((e) => e.t),
4
- "./api/chat/messages/handler.ts": () => import("./handler-D7f8iAy5.js"),
5
- "./api/chat/messages/trailing/handler.ts": () => import("./handler-P40GjJry.js"),
3
+ "./api/chat/handler.ts": () => import("./handler-DSncMeo4.js").then((e) => e.t),
4
+ "./api/chat/messages/handler.ts": () => import("./handler-5n-YwiF3.js"),
5
+ "./api/chat/messages/trailing/handler.ts": () => import("./handler-hah8tVEE.js"),
6
6
  "./api/chat/stream/handler.ts": () => import("./handler-lUriE7jY.js"),
7
- "./api/document/handler.ts": () => import("./handler-BY5bgBEh.js"),
8
- "./api/history/handler.ts": () => import("./handler-BBCbPLLC.js"),
7
+ "./api/document/handler.ts": () => import("./handler-DdKB5P3H.js"),
8
+ "./api/history/handler.ts": () => import("./handler-Dy536I3-.js"),
9
9
  "./api/ping/handler.ts": () => import("./handler-DF3WRSDj.js"),
10
10
  "./api/session/current/handler.ts": () => import("./handler-B8Twsrmo.js"),
11
11
  "./api/session/tenant/handler.ts": () => import("./handler-6yb49c5-.js"),
12
12
  "./api/stream-test/handler.ts": () => import("./handler-BdXUC9Rg.js"),
13
- "./api/suggestions/handler.ts": () => import("./handler-CZSMkZnQ.js"),
14
- "./api/test/reset/handler.ts": () => import("./handler-DbjPd3w4.js"),
13
+ "./api/suggestions/handler.ts": () => import("./handler-YmuAR8ei.js"),
14
+ "./api/test/reset/handler.ts": () => import("./handler-DMwBT4bK.js"),
15
15
  "./api/upload/handler.ts": () => import("./handler-D74Wi6e9.js"),
16
- "./api/vote/handler.ts": () => import("./handler-C6u7vLAb.js")
16
+ "./api/vote/handler.ts": () => import("./handler-BgYHL3BZ.js")
17
17
  }) }).reduce((e, [t, n]) => (e[t.replace("./api/", "@rpcbase/agents-sdk/api/")] = n, e), {});
18
18
  //#endregion
19
19
  export { e as routes };
package/dist/runtime.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { configureAgentRuntime, getAgentRuntimeConfig, type AgentDefinition, type AgentRuntimeConfig, type AgentRuntimeIdentity, type AgentRuntimeMode, type AgentRuntimeUsageContext, type AgentRuntimeUsageContextInput } from "./api/chat/runtimeConfig";
1
+ import { configureAgentRuntime, getAgentRuntimeConfig, type AgentDefinition, type AgentRuntimeChatMessage, type AgentRuntimeChatModel, type AgentRuntimeConfig, type AgentRuntimeHistoryCompactionConfig, type AgentRuntimeHistoryCompactionInput, type AgentRuntimeHistoryCompactionLimits, type AgentRuntimeHistoryCompactionResult, type AgentRuntimeHistoryCompactionState, type AgentRuntimeIdentity, type AgentRuntimeMode, type AgentRuntimeUsageContext, type AgentRuntimeUsageContextInput } from "./api/chat/runtimeConfig";
2
2
  import { runAgentLoop, type RunAgentLoopInput, type RunAgentLoopResult } from "./api/chat/handler";
3
3
  export type AgentRtsMessagePayload = {
4
4
  chatId: string;
@@ -16,5 +16,5 @@ export type AgentRtsMessageTransport = {
16
16
  }) => void | Promise<void>;
17
17
  };
18
18
  export declare const createRtsMessageTransport: () => AgentRtsMessageTransport;
19
- export { configureAgentRuntime, getAgentRuntimeConfig, runAgentLoop, type AgentDefinition, type AgentRuntimeConfig, type AgentRuntimeIdentity, type AgentRuntimeMode, type AgentRuntimeUsageContext, type AgentRuntimeUsageContextInput, type RunAgentLoopInput, type RunAgentLoopResult, };
19
+ export { configureAgentRuntime, getAgentRuntimeConfig, runAgentLoop, type AgentDefinition, type AgentRuntimeChatMessage, type AgentRuntimeChatModel, type AgentRuntimeConfig, type AgentRuntimeHistoryCompactionConfig, type AgentRuntimeHistoryCompactionInput, type AgentRuntimeHistoryCompactionLimits, type AgentRuntimeHistoryCompactionResult, type AgentRuntimeHistoryCompactionState, type AgentRuntimeIdentity, type AgentRuntimeMode, type AgentRuntimeUsageContext, type AgentRuntimeUsageContextInput, type RunAgentLoopInput, type RunAgentLoopResult, };
20
20
  //# sourceMappingURL=runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EACnC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAGlG,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;A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;CACf,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,aAAa,CAAA;IACnB,OAAO,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACpH,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAO,wBAK5C,CAAA;AAED,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,mCAAmC,EACxC,KAAK,kCAAkC,EACvC,KAAK,mCAAmC,EACxC,KAAK,mCAAmC,EACxC,KAAK,kCAAkC,EACvC,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACxB,CAAA"}
package/dist/runtime.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { i as e, r as t } from "./chatCtx-BWOFI93u.js";
2
- import { n } from "./handler-DPuJK6ft.js";
2
+ import { n } from "./handler-DSncMeo4.js";
3
3
  import { publishRtsMessage as r } from "@rpcbase/server/rts";
4
4
  //#region src/runtime.ts
5
5
  var i = () => ({