@schlenkr/ragents 0.1.13 → 0.1.14

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 (47) hide show
  1. package/apps/server/src/provider.ts +8 -2
  2. package/apps/server/src/title-compactor.ts +1 -1
  3. package/apps/web/dist/assets/{highlighted-body-KPVGNVTW-CpPi6QLr.js → highlighted-body-KPVGNVTW-BslIwn_y.js} +1 -1
  4. package/apps/web/dist/assets/main-BUN8m8SW.js +11 -0
  5. package/apps/web/dist/assets/{mermaid-HWGCJPDP-q-mf1kLN.js → mermaid-HWGCJPDP-B1erZlFM.js} +4 -4
  6. package/apps/web/dist/assets/{runPanel-nk_aMxSn.js → runPanel-s8gGpr9M.js} +1 -1
  7. package/apps/web/dist/help/mini-app.css +9 -0
  8. package/apps/web/dist/host-web.json +7 -7
  9. package/apps/web/dist/index.html +2 -2
  10. package/apps/web/dist/run-panel.html +2 -2
  11. package/apps/web/src/App.tsx +12 -1
  12. package/apps/web/src/PluginRegistry.tsx +2 -2
  13. package/apps/web/src/SessionList.tsx +7 -6
  14. package/apps/web/src/SettingsModal.tsx +3 -3
  15. package/apps/web/src/actor-programs/client-ui/FilePicker.tsx +1 -1
  16. package/apps/web/src/api.ts +2 -0
  17. package/apps/web/src/run-overview.ts +1 -1
  18. package/apps/web/src/ui/relative-time.ts +1 -1
  19. package/bundles/ragents.documents/ragents-bundle.json +2 -2
  20. package/bundles/ragents.documents/web/classes.json +1 -1
  21. package/bundles/ragents.documents/web/index.js +1 -1
  22. package/bundles/ragents.documents/web/index.js.map +2 -2
  23. package/bundles/ragents.orchestration/ragents-bundle.json +2 -2
  24. package/bundles/ragents.orchestration/web/index.js +3 -3
  25. package/bundles/ragents.orchestration/web/index.js.map +2 -2
  26. package/bundles/ragents.overseer/ragents-bundle.json +4 -3
  27. package/bundles/ragents.overseer/web/classes.json +1 -1
  28. package/bundles/ragents.overseer/web/index.js +1 -1
  29. package/bundles/ragents.overseer/web/index.js.map +4 -4
  30. package/bundles/ragents.processes/ragents-bundle.json +2 -2
  31. package/bundles/ragents.processes/web/classes.json +1 -1
  32. package/bundles/ragents.processes/web/index.js +1 -1
  33. package/bundles/ragents.processes/web/index.js.map +2 -2
  34. package/bundles/ragents.workspace/ragents-bundle.json +2 -2
  35. package/bundles/ragents.workspace/web/classes.json +1 -1
  36. package/bundles/ragents.workspace/web/index.js +1 -1
  37. package/bundles/ragents.workspace/web/index.js.map +2 -2
  38. package/package.json +2 -2
  39. package/plugins/ragents.documents/web/DocumentViewer.tsx +2 -2
  40. package/plugins/ragents.orchestration/web/ExecutionsPanel.tsx +1 -1
  41. package/plugins/ragents.orchestration/web/FlowInspector.tsx +1 -1
  42. package/plugins/ragents.orchestration/web/JournalStatus.tsx +1 -1
  43. package/plugins/ragents.orchestration/web/format.ts +1 -1
  44. package/plugins/ragents.overseer/web/index.tsx +51 -3
  45. package/plugins/ragents.processes/web/processes.ts +1 -1
  46. package/plugins/ragents.workspace/web/FileBrowser.tsx +1 -1
  47. package/apps/web/dist/assets/main-DJmCHGzM.js +0 -11
@@ -1,4 +1,4 @@
1
- import{a as U,H as D,u as G,r as o,j as e,B as k,I as Te,J as Ae,v as _e,l as ze,m as Fe,t as Me,k as Ue,P as De,G as ce,K as He,p as J,q as de,i as $e,L as ue,N as re,O as Be,T as Ve,A as oe,V as qe,Y as Je,Z as Ge,_ as Ke,s as Qe,$ as We,e as Ye,a0 as Ze,a1 as Xe,x as et,y as tt,a2 as nt,a3 as st,a4 as rt,z as ot,Q as at,a5 as it,a6 as lt,F as ct}from"./mermaid-HWGCJPDP-q-mf1kLN.js";/**
1
+ import{a as U,H as D,u as G,r as o,j as e,B as k,I as Te,J as Ae,v as _e,l as ze,m as Fe,t as Me,k as Ue,P as De,G as ce,K as He,p as J,q as de,i as $e,L as ue,N as re,O as Be,T as Ve,A as oe,V as qe,Y as Je,Z as Ge,_ as Ke,s as Qe,$ as We,e as Ye,a0 as Ze,a1 as Xe,x as et,y as tt,a2 as nt,a3 as st,a4 as rt,z as ot,Q as at,a5 as it,a6 as lt,F as ct}from"./mermaid-HWGCJPDP-B1erZlFM.js";/**
2
2
  * @license lucide-react v1.46.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -564,6 +564,12 @@
564
564
  -webkit-box-orient: vertical;
565
565
  -webkit-line-clamp: 2;
566
566
  }
567
+ .line-clamp-3 {
568
+ overflow: hidden;
569
+ display: -webkit-box;
570
+ -webkit-box-orient: vertical;
571
+ -webkit-line-clamp: 3;
572
+ }
567
573
  .block {
568
574
  display: block;
569
575
  }
@@ -747,6 +753,9 @@
747
753
  .max-h-\[180px\] {
748
754
  max-height: 180px;
749
755
  }
756
+ .max-h-\[240px\] {
757
+ max-height: 240px;
758
+ }
750
759
  .max-h-\[520px\] {
751
760
  max-height: 520px;
752
761
  }
@@ -15,8 +15,8 @@
15
15
  "apps/web/src/access-token.ts": "d3040d9148dd31395da920e2c933d5066c20a249aa967200716070a2b1ecfcce",
16
16
  "apps/web/src/AccessContext.tsx": "38cffefabf8dd2bfb7171d1f1c6474c2cf6834c4134469fce460d1942d0ddfb4",
17
17
  "apps/web/src/actor-conversation.ts": "73063988356134a2dbf0f83c5cadbe7301870a29aebaf0163301bde792b96b24",
18
- "apps/web/src/api.ts": "cc80688566ba4beaf6a22bd083afd2f107c286fc0c5a2bd5755eedf6c1cec93f",
19
- "apps/web/src/App.tsx": "c47d5b1c56f2ec5ac479403366d6a27160008f1247c9d85379e97d5066419091",
18
+ "apps/web/src/api.ts": "13d17fb25c05aaf53220fe96be0bce9c7155270b7e3e22a0c605c3bd967bddd6",
19
+ "apps/web/src/App.tsx": "95f5eee9b1cb1a359fecc11c6322484842f6cf7f545a29d11764a98d3bcab8d2",
20
20
  "apps/web/src/chat-view-settings.tsx": "8a8bd0a77093c0c657c401efd52143c88825b085c06b34bf37440a115e9b3ad5",
21
21
  "apps/web/src/chat/chat-target.ts": "44303252e87f172b93194fe0c0eba84217992cb17a438cb2cd2ba00fefccf012",
22
22
  "apps/web/src/chat/QuasselHost.tsx": "66b3e2f3549537b8daaf955251ae3ef8254229b92953b9583557d46c3515a486",
@@ -48,7 +48,7 @@
48
48
  "apps/web/src/PluginActivation.ts": "4e2fa7ca943f3b4dae1f0eee5b1543971cb2cf81a5a5e29df374f9b1c066c3ec",
49
49
  "apps/web/src/PluginChat.tsx": "769d216a285ace4951df7f7488517e4e39808ea1f049ccf5909d2e8296d15f1b",
50
50
  "apps/web/src/PluginFailureNotice.tsx": "5443e628f50389ff6cc4f09be8b73f3d481efce5976f8955f853058c569bd932",
51
- "apps/web/src/PluginRegistry.tsx": "4decbdd6b591c0baf20d52e5ca0fa9fa045c38dc5ac38cbcff4bd77eaf803f0e",
51
+ "apps/web/src/PluginRegistry.tsx": "6eed3989ea350d4cc21b91c820824385c14c99489f97f87e92e8f27c323fdba6",
52
52
  "apps/web/src/product/model-settings.ts": "445b05f8dd34e8145b474d04825408c4b7a2527559ec3ee549f9dba61ef91e13",
53
53
  "apps/web/src/product/ModelControl.tsx": "c3467c74fd0c595054b8be92f8df2cbf4be53cdceaac8f3337c96f3da547077a",
54
54
  "apps/web/src/product/ProductModelSettings.tsx": "e8513da26228da46ed04a5913967b5453d1276b712e26fa0d663369c904fb608",
@@ -56,7 +56,7 @@
56
56
  "apps/web/src/product/SystemPromptControl.tsx": "fcbabb5ae84ef29c89826e968bc3583075dba96423fdd003125bf23605920383",
57
57
  "apps/web/src/rpc.ts": "586f9307afa85f11f11faef801bb731230f2099685649aa7d9f666a851c490b5",
58
58
  "apps/web/src/rpc/client.ts": "5c50be675f7534b8a20a4e7db25cbe82444886b0f30a0aeed562e380c656f43a",
59
- "apps/web/src/run-overview.ts": "12b1c2fd4a7df1efff42e32abc813b24a25d551cfca96ccb900a36f772ac3d95",
59
+ "apps/web/src/run-overview.ts": "d87b462aecfbb4eff5292c3cdafb8bf6b46a6d823ddc305eacc243acddaefc61",
60
60
  "apps/web/src/run-panel.tsx": "aa28c092fc3c58bb2efd0f1ad9cb913c985fe71e6d4476c0f81b198e23347d34",
61
61
  "apps/web/src/run-panel/clipboard.ts": "844b2bd9d7982df158183ee131992d1d19d332f2eab3064981d9d5082dc89aba",
62
62
  "apps/web/src/run-panel/host-contract.ts": "d2d23b2f20345adc9cd2739ad73f2812a28fec65fc6a4d1c06bcdb4477727292",
@@ -76,9 +76,9 @@
76
76
  "apps/web/src/run-view.ts": "2f87b3d8a4e8b8dd613bc24def2e9a77b6058c6b527f37a7b90bc1b6d96ca49b",
77
77
  "apps/web/src/RunPreparationChat.tsx": "cd0eb63781cc60c68adb7ed2410fb52b1646fb1d0907a22dbbd6bb508e10616e",
78
78
  "apps/web/src/RunStore.ts": "3ca3b947521e8e5df5a11ced352d37f90fccbede5889fb873e9ab0157a1d4299",
79
- "apps/web/src/SessionList.tsx": "ca95ca51f88dff8595b09df42aabe1d69f323c03bef49c62c419688c942532a8",
79
+ "apps/web/src/SessionList.tsx": "456fb59bd476ac480debc2eb21aafd5c6ac1a9e4bbcb9e471d18c02dc599148a",
80
80
  "apps/web/src/settings-contributions.ts": "5b5427293dde48cd85cbb99d1169823e0c89609d320363582bd131eb874ce893",
81
- "apps/web/src/SettingsModal.tsx": "b6d0633c03a31f241c43dfb567f2487521f227ac7d04169328271f193a2dbb0c",
81
+ "apps/web/src/SettingsModal.tsx": "014c227bdbdbe9029db720368b4a1aa826560474dc3f3992938345cbb0efef76",
82
82
  "apps/web/src/SourceCode.tsx": "bc80927cba80ac589dd89c8e0f9d1108dcf48d88a78e650051b084b9364c5001",
83
83
  "apps/web/src/StartOptions.tsx": "6c5d1407d2d3b72d5562ca094057d2f28b10b970c00baa17c66e67a1892fe3cc",
84
84
  "apps/web/src/StartSelection.tsx": "2b510e3a22ab099c795f47763043ee70294f663c442628d333aaa432ab7e0f08",
@@ -109,7 +109,7 @@
109
109
  "apps/web/src/ui/popover.tsx": "4cbf781de247770d3f24406d6322d1b3e159e38135ea45db2ab477f661417f2d",
110
110
  "apps/web/src/ui/progress.tsx": "bae4a2c7eded93a8da9e3237042011743572ac42b526b1be3054d95dc6626cc1",
111
111
  "apps/web/src/ui/radio-group.tsx": "62a1fa46c54ebbb71c84f09ebc5941dec41b0c75be3699b969eb5aae5820616d",
112
- "apps/web/src/ui/relative-time.ts": "0e60796bfa9171f5ce65c801143698937a8796c13721528a39c77c361b3f64fc",
112
+ "apps/web/src/ui/relative-time.ts": "5cf50e2d60afa8f397c8f86c0779b9c2ca9143e039d39e8bae4f346a4aab0100",
113
113
  "apps/web/src/ui/SectionLabel.tsx": "12396e7568f5507d47a6e303c0ea451e918f555cc7c1ee6fe97929dfd2ae4da4",
114
114
  "apps/web/src/ui/select.tsx": "932699e2bee1fe16ea4783eaa2acf2be0c133e0926a7d298650a0ae10c1c6912",
115
115
  "apps/web/src/ui/separator.tsx": "8a1d9397433ccf70631104f377b0e778754582a74c93a57cf13a2f2dcba778bf",
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <link rel="stylesheet" href="/ragents.css" />
7
7
  <title>RAgents</title>
8
- <script type="module" crossorigin src="/assets/main-DJmCHGzM.js"></script>
9
- <link rel="modulepreload" crossorigin href="/assets/mermaid-HWGCJPDP-q-mf1kLN.js">
8
+ <script type="module" crossorigin src="/assets/main-BUN8m8SW.js"></script>
9
+ <link rel="modulepreload" crossorigin href="/assets/mermaid-HWGCJPDP-B1erZlFM.js">
10
10
  <link rel="stylesheet" crossorigin href="/assets/mermaid-HWGCJPDP-BPn4aV2r.css">
11
11
  </head>
12
12
  <body>
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <link rel="stylesheet" href="/ragents.css" />
7
7
  <title>RAgents Panel</title>
8
- <script type="module" crossorigin src="/assets/runPanel-nk_aMxSn.js"></script>
9
- <link rel="modulepreload" crossorigin href="/assets/mermaid-HWGCJPDP-q-mf1kLN.js">
8
+ <script type="module" crossorigin src="/assets/runPanel-s8gGpr9M.js"></script>
9
+ <link rel="modulepreload" crossorigin href="/assets/mermaid-HWGCJPDP-B1erZlFM.js">
10
10
  <link rel="stylesheet" crossorigin href="/assets/mermaid-HWGCJPDP-BPn4aV2r.css">
11
11
  </head>
12
12
  <body>
@@ -170,8 +170,9 @@ export function App() {
170
170
 
171
171
  const registry = pluginActivation.registry;
172
172
  const availablePanels = registry.overviewPanels.filter((panel) => panel.readRight === undefined || access.can(panel.readRight));
173
- const panels = availablePanels.filter((panel) => panel.placement !== "toolbar");
173
+ const panels = availablePanels.filter((panel) => (panel.placement ?? "overview") === "overview");
174
174
  const toolbarPanels = availablePanels.filter((panel) => panel.placement === "toolbar");
175
+ const idlePanel = readRuns ? availablePanels.find((panel) => panel.placement === "idle") : undefined;
175
176
  const overviewAvailable = readRuns || panels.length > 0;
176
177
  const busy = panels.some((panel) => busyPanels.has(panel.id));
177
178
  const userLocation = chatUserLocation(readRuns ? activeId : undefined, overviewOpen, runLocation);
@@ -234,6 +235,16 @@ export function App() {
234
235
  session={activeSession ?? { id: activeId, title: "New run", updatedAt: Date.now() }}
235
236
  />
236
237
  )
238
+ : idlePanel
239
+ ? (
240
+ <div className={chatWorkspaceClass}>
241
+ <ToolbarPanelHost
242
+ id={idlePanel.id} key={idlePanel.id} onBusy={setPanelBusy} onClose={() => {}} onOpen={() => {}}
243
+ open={!overviewOpen && !settingsOpen && !helpOpen && !draft && !toolbarPanel} Panel={idlePanel.Panel} registry={registry}
244
+ userLocation={userLocation}
245
+ />
246
+ </div>
247
+ )
237
248
  : (
238
249
  <div className={chatWorkspaceClass}>
239
250
  <div className="m-auto text-center text-muted-foreground">{readRuns ? writeRuns ? "Open the overview at the top left to choose a run or start a new one." : "Open the overview at the top left to choose a run. You have read access." : "No runs are shared with this user account."}</div>
@@ -230,7 +230,7 @@ export interface SessionStatusContribution {
230
230
  Status: ComponentType<SessionHeaderContext>;
231
231
  }
232
232
 
233
- /** A persistent application contribution in the overview or toolbar. */
233
+ /** A persistent application contribution in the overview, in the toolbar, or in the main area while no run is open (idle). */
234
234
  export interface OverviewPanelContext {
235
235
  registry: PluginRegistry;
236
236
  userLocation?: ChatUserLocation;
@@ -243,7 +243,7 @@ export interface OverviewPanelContext {
243
243
  }
244
244
 
245
245
  export interface OverviewPanelContribution {
246
- placement?: "overview" | "toolbar";
246
+ placement?: "overview" | "toolbar" | "idle";
247
247
  id: string;
248
248
  order: number;
249
249
  /** Right a user needs to see the panel; without it the panel is shown to everyone. */
@@ -28,8 +28,8 @@ const formatTimestamp = (time: number): string => {
28
28
  const today = new Date();
29
29
  const sameDay = date.toDateString() === today.toDateString();
30
30
  return sameDay
31
- ? date.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit" })
32
- : date.toLocaleDateString("en-US", { day: "2-digit", month: "2-digit" });
31
+ ? date.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit" })
32
+ : date.toLocaleDateString(undefined, { day: "2-digit", month: "2-digit" });
33
33
  };
34
34
 
35
35
  /** Running, unread, locked and resting runs differ only in their accent color; the card layout stays the same. */
@@ -111,7 +111,7 @@ export function SessionList({
111
111
  aria-current={session.id === activeId ? "true" : undefined}
112
112
  aria-pressed={selectMode ? selectedIds.has(session.id) : undefined}
113
113
  className={cn(
114
- "flex min-h-[148px] min-w-0 flex-1 cursor-pointer flex-col items-stretch gap-2.5 rounded-[11px] px-4 pb-4 text-left focus-visible:outline-2 focus-visible:outline-primary focus-visible:outline-offset-2 disabled:cursor-default",
114
+ "flex max-h-[240px] min-h-[148px] min-w-0 flex-1 cursor-pointer flex-col items-stretch gap-2.5 overflow-hidden rounded-[11px] px-4 pb-4 text-left focus-visible:outline-2 focus-visible:outline-primary focus-visible:outline-offset-2 disabled:cursor-default",
115
115
  selectMode && "pl-9",
116
116
  )}
117
117
  disabled={session.locked !== undefined && !selectMode}
@@ -119,7 +119,7 @@ export function SessionList({
119
119
  type="button"
120
120
  >
121
121
  <span className={cn("-mx-4 flex flex-col gap-2.5 rounded-t-[11px] border-t-[3px] px-4 pt-3.5 pb-3", tone.head, selectMode && "-ml-9 pl-9")}>
122
- <span className="pr-6 text-[0.9rem] leading-[1.45] font-semibold [overflow-wrap:anywhere]" title={session.title}>{session.title}</span>
122
+ <span className="line-clamp-2 pr-6 text-[0.9rem] leading-[1.45] font-semibold [overflow-wrap:anywhere]" title={session.title}>{session.title}</span>
123
123
  <span className="flex min-h-[18px] flex-wrap items-center gap-x-3.5 gap-y-1.5">
124
124
  <span className={cn("flex items-center gap-[7px] text-[0.75rem]", tone.text)}>
125
125
  {session.running ? <Spinner aria-hidden className="size-3" /> : <span aria-hidden className="size-[7px] flex-none rounded-full bg-current" />}
@@ -131,14 +131,15 @@ export function SessionList({
131
131
  </span>
132
132
  </span>
133
133
  {session.locked !== undefined
134
- ? <span className="text-[0.75rem] leading-[1.45] text-destructive [overflow-wrap:anywhere]">{session.locked}</span>
134
+ ? <span className="line-clamp-3 text-[0.75rem] leading-[1.45] text-destructive [overflow-wrap:anywhere]" title={session.locked}>{session.locked}</span>
135
135
  : registry.sessionMetadata.map(({ id, Metadata }) => (
136
136
  <Metadata key={id} placement="list" session={session} />
137
137
  ))}
138
138
  <span className="mt-auto grid gap-0.5 text-muted-foreground">
139
139
  {session.createdAt !== undefined && <span className="text-[0.7rem] tabular-nums">Created <time dateTime={new Date(session.createdAt).toISOString()}>
140
- {new Date(session.createdAt).toLocaleString("en-US", { day: "2-digit", month: "2-digit", year: "numeric", hour: "2-digit", minute: "2-digit" })}
140
+ {new Date(session.createdAt).toLocaleString(undefined, { day: "2-digit", month: "2-digit", year: "numeric", hour: "2-digit", minute: "2-digit" })}
141
141
  </time></span>}
142
+ {session.ownerLabel !== undefined && <span className="text-[0.7rem] [overflow-wrap:anywhere]">Created by {session.ownerLabel}</span>}
142
143
  <span className="text-[0.7rem] tabular-nums">Last activity {formatTimestamp(session.updatedAt)}</span>
143
144
  </span>
144
145
  </button>
@@ -931,10 +931,10 @@ const skillFileText = (file: SettingsSkillFile) =>
931
931
 
932
932
  const formatDuration = (milliseconds: number) => {
933
933
  const seconds = milliseconds / 1000;
934
- if (seconds < 60) return `${seconds.toLocaleString("en-US")} s`;
934
+ if (seconds < 60) return `${seconds.toLocaleString()} s`;
935
935
  const minutes = seconds / 60;
936
- if (minutes < 60) return `${minutes.toLocaleString("en-US")} min`;
937
- return `${(minutes / 60).toLocaleString("en-US")} h`;
936
+ if (minutes < 60) return `${minutes.toLocaleString()} min`;
937
+ return `${(minutes / 60).toLocaleString()} h`;
938
938
  };
939
939
 
940
940
  const sensitiveKey = (key: string) => /secret|token|password|credential|api.?key|authorization|cookie/i.test(key);
@@ -57,7 +57,7 @@ export function FilePicker({ label, files, onChange, disabled, showPreview = tru
57
57
  </div>
58
58
  {error && <p className="mt-2 text-sm text-destructive" role="alert">{error}</p>}
59
59
  {files.length > 0 && <ul className="mt-2 divide-y">{files.map((file, index) => <li className="py-2" key={`${file.name}:${file.size}:${file.lastModified}:${index}`}>
60
- <div className="flex items-start justify-between gap-3"><span className="min-w-0 break-words"><strong>{file.name}</strong> <small className="block text-muted-foreground">{new Intl.NumberFormat("en-US").format(file.size)} bytes</small></span>
60
+ <div className="flex items-start justify-between gap-3"><span className="min-w-0 break-words"><strong>{file.name}</strong> <small className="block text-muted-foreground">{new Intl.NumberFormat().format(file.size)} bytes</small></span>
61
61
  <Button aria-label={`Remove ${file.name}`} disabled={blocked} onClick={() => { void change(() => files.filter((_, position) => position !== index)); }} size="sm" variant="outline">Remove</Button></div>
62
62
  {showPreview && <FilePreview file={file} />}
63
63
  </li>)}</ul>}
@@ -43,6 +43,8 @@ export interface SessionInfo {
43
43
  running?: boolean;
44
44
  /** Whether the viewer can reach the run's workspace; missing as long as the server has not listed the run yet. */
45
45
  workspaceAccessible?: boolean;
46
+ /** Display name of the user who created the run; missing for a run created without sign-in. */
47
+ ownerLabel?: string;
46
48
  metadata?: Readonly<Record<string, unknown>>;
47
49
  /** Why a metadata contribution has no value: failed or did not answer in time. */
48
50
  metadataUnavailable?: Readonly<Record<string, string>>;
@@ -18,7 +18,7 @@ export function groupRunsByActivity(sessions: readonly SessionInfo[], now = new
18
18
  const key = dayKey(date);
19
19
  const group = groups.get(key) ?? {
20
20
  date: key,
21
- label: key === today ? "Today" : key === dayKey(yesterday) ? "Yesterday" : date.toLocaleDateString("en-US", { weekday: "long", day: "numeric", month: "long", ...(date.getFullYear() === now.getFullYear() ? {} : { year: "numeric" }) }),
21
+ label: key === today ? "Today" : key === dayKey(yesterday) ? "Yesterday" : date.toLocaleDateString(undefined, { weekday: "long", day: "numeric", month: "long", ...(date.getFullYear() === now.getFullYear() ? {} : { year: "numeric" }) }),
22
22
  sessions: [],
23
23
  };
24
24
  group.sessions.push(session);
@@ -4,7 +4,7 @@ const DAY = 24 * HOUR;
4
4
  const WEEK = 7 * DAY;
5
5
 
6
6
  const date = (at: number, year: boolean): string =>
7
- new Date(at).toLocaleDateString("en-US", year ? { day: "2-digit", month: "2-digit", year: "numeric" } : { day: "2-digit", month: "2-digit" });
7
+ new Date(at).toLocaleDateString(undefined, year ? { day: "2-digit", month: "2-digit", year: "numeric" } : { day: "2-digit", month: "2-digit" });
8
8
 
9
9
  /** The time in the list: now, 5 min, 3 h, 2 d, from seven days on the date. Without "ago", without a special case for yesterday. */
10
10
  export const shortTime = (at: number, now: number = Date.now()): string => {
@@ -100,8 +100,8 @@
100
100
  ]
101
101
  }
102
102
  },
103
- "revision": "05ca6d8d04b7d78376a9726d2472099d2150a1a9e62f5999dacf88aa62a336b0",
104
- "sourceRevision": "938d5980baa92e0c773c6211d146279da316f8805559e96a169292d19c536b8c",
103
+ "revision": "3fdba8c39f30027176229901cf731b778170f0e1597c287ad94f7e48a430b5e8",
104
+ "sourceRevision": "3f8cba204a1cc01725fa7dd006e39766cc5dabe502d40a1ab9c7b620566019dd",
105
105
  "server": "server/index.js",
106
106
  "web": {
107
107
  "entry": "web/index.js",
@@ -1 +1 @@
1
- ["--background","--card","--foreground","--primary","[scrollbar-width:thin]","activate","active","activeId","activeTabId","additionalProperties","alive","alt","and","are","args","aria-expanded","aria-hidden","aria-label","aria-pressed","aria-pressed:bg-[color-mix(in_srgb,var(--background)_91%,var(--primary))]","aria-pressed:border-primary/50","artifact","as","bg-[color-mix(in_srgb,var(--background)_95%,var(--primary))]","bg-[color-mix(in_srgb,var(--foreground)_8%,var(--background))]","bg-[color-mix(in_srgb,var(--foreground)_9%,var(--background))]","bg-[color-mix(in_srgb,var(--primary)_12%,var(--background))]","bg-[color-mix(in_srgb,var(--primary)_16%,var(--background))]","bg-card","bg-destructive/8","bg-primary/12","bg-white","bin","binary","block","boolean","border","border-0","border-b","border-b-border-soft","border-border","border-border-soft","border-l","border-primary/25","border-t-0","border-x-0","break-words","button","cache","catch","cause","chat","chatDocumentFrom","className","collect","configuredPlugin","const","contains","content","contentUrl","contribution","conversations","copyClass","count","createContext","createdAt","currentColor","cx","cy","data-[status=error]:border-destructive/45","data-status","date","day","defineOperation","description","descriptor","destructive","directory","document","documentMessages","documentMessagesFrom","documents","documentsApiPrefix","documentsContracts","documentsFrom","docx","dot","download","duration-100","else","en-US","entityPresenters","entry","error","eslint-disable-next-line","export","false","fetchRunFiles","file","fileDocument","fileEntry","filePath","files","filesListing","fill","flex","flex-1","flex-col","focus-visible:border-primary/50","focus-visible:outline-2","focus-visible:outline-offset-2","focus-visible:outline-primary/55","font-bold","font-semibold","for","format","formatByExtension","formatBytes","formatFromName","formatLabels","formatOf","formatTime","from","full","function","gap-0","gap-0.5","gap-1","gap-2","gap-2.5","gap-3","gap-3.5","gap-px","gif","grid","grid-cols-[14px_26px_minmax(0,1fr)_auto]","grid-cols-[24px_minmax(0,1fr)_auto]","grid-cols-[42px_minmax(0,1fr)_auto]","grid-cols-[auto_minmax(0,1fr)_auto]","group-data-[status=error]/call:text-destructive","group-hover/entry:opacity-100","group/call","group/entry","groupBadgeClass","groups","gz","h-12","h-full","handle","handles","height","hour","hover:-translate-y-px","hover:bg-[color-mix(in_srgb,var(--background)_91%,var(--primary))]","hover:bg-[color-mix(in_srgb,var(--primary)_7%,var(--card))]","hover:bg-primary/7","hover:border-primary/50","hover:border-primary/55","hover:shadow-md","href","htm","html","icon","icon-sm","id","if","image","import","in","input","instanceof","interface","is","isError","iso","items-center","jpeg","jpg","json","justify-center","key","kind","label","leading-[1.35]","leading-[1.65]","leading-[1.6]","length","let","library","line","lineCount","lines","list-none","listing","load","loaded","loose","lucide-react","m9","markdown","matter","max-[620px]:gap-2.5","max-[620px]:grid-cols-[38px_minmax(0,1fr)_auto]","max-[620px]:h-11","max-[620px]:px-2.5","max-[620px]:py-2.5","max-[620px]:sr-only","max-[620px]:w-[38px]","max-w-full","maxLength","md","mediaType","message","messages","meta","metaClass","min-h-0","min-h-30","min-h-full","min-w-0","minLength","minimum","minute","ml-[23px]","modifiedAt","month","more","mt-0.5","mt-1.5","name","needsRunView","new","next","no-store","none","not","number","onClick","onClose","onOpen","onOpenChange","onSelect","only","opacity-0","open","order","outline","overflow-y-auto","overview","p-0","p-7","p-9","parts","path","pathArgumentsFrom","pathDocumentFrom","pathDocumentsFromMessages","pb-10","pb-4.5","pdf","per","pl-2.5","plugin","png","preview","pt-2.5","pt-5","px-2","px-2.5","px-3.5","px-[clamp(18px,4vw,54px)]","px-workspace-inset","py-2","py-2.5","py-3","py-4","quassel","quassel/events","react","react-hooks/exhaustive-deps","read","readable","readonly","ready","rebuilt","relative","render","result","resultSection","results","return","reveal","rights","role","rotate-90","round","rounded-[10px]","rounded-[9px]","rounded-full","rounded-lg","rounded-none","rounded-panel","rounded-xl","routePrefix","rpc","run","runFileContentUrl","runId","running","s","sandbox","scope","secondary","sections","sectionsFrom","selection","session","setCache","setCollapsed","setError","setListing","setModalOpen","shadow-pop","shadow-sm","showCloseButton","show_document","shown","shrink-0","size","size-3","size-7","size-8","sm","sourceClass","src","srcDoc","state","status","statusLabel","store","string","stroke","strokeLinecap","strokeLinejoin","strokeWidth","sum","svg","tabId","tabular-nums","tar","text","text-[0.62rem]","text-[0.68rem]","text-[0.72rem]","text-[0.76rem]","text-[0.79rem]","text-[0.7rem]","text-[0.82rem]","text-[0.84rem]","text-[0.85rem]","text-[12px]","text-[13.5px]","text-[13px]","text-foreground","text-left","text-muted-foreground","text-primary","text-sm","textual","than","the","these","this","throw","timer","title","titleClass","to","toggle","tool","toolName","toolPresenters","tracking-[0.02em]","tracking-[0.05em]","transition-[background-color,border-color,box-shadow,transform]","transition-colors","transition-opacity","transition-transform","truncate","truncated","try","type","typebox","typeof","undefined","unknown","uppercase","url","useDocumentContent","useRunFiles","useRunFilesContext","useState","value","variant","view","viewBox","void","w-[42px]","w-[min(100%,620px)]","w-[min(1080px,calc(100%-2*clamp(16px,5vw,72px)))]","w-full","webPlugin","webp","whitespace-pre-wrap","width","workspaceTabs","xlsx","xml","yet","zip"]
1
+ ["--background","--card","--foreground","--primary","[scrollbar-width:thin]","activate","active","activeId","activeTabId","additionalProperties","alive","alt","and","are","args","aria-expanded","aria-hidden","aria-label","aria-pressed","aria-pressed:bg-[color-mix(in_srgb,var(--background)_91%,var(--primary))]","aria-pressed:border-primary/50","artifact","as","bg-[color-mix(in_srgb,var(--background)_95%,var(--primary))]","bg-[color-mix(in_srgb,var(--foreground)_8%,var(--background))]","bg-[color-mix(in_srgb,var(--foreground)_9%,var(--background))]","bg-[color-mix(in_srgb,var(--primary)_12%,var(--background))]","bg-[color-mix(in_srgb,var(--primary)_16%,var(--background))]","bg-card","bg-destructive/8","bg-primary/12","bg-white","bin","binary","block","boolean","border","border-0","border-b","border-b-border-soft","border-border","border-border-soft","border-l","border-primary/25","border-t-0","border-x-0","break-words","button","cache","catch","cause","chat","chatDocumentFrom","className","collect","configuredPlugin","const","contains","content","contentUrl","contribution","conversations","copyClass","count","createContext","createdAt","currentColor","cx","cy","data-[status=error]:border-destructive/45","data-status","date","day","defineOperation","description","descriptor","destructive","directory","document","documentMessages","documentMessagesFrom","documents","documentsApiPrefix","documentsContracts","documentsFrom","docx","dot","download","duration-100","else","entityPresenters","entry","error","eslint-disable-next-line","export","false","fetchRunFiles","file","fileDocument","fileEntry","filePath","files","filesListing","fill","flex","flex-1","flex-col","focus-visible:border-primary/50","focus-visible:outline-2","focus-visible:outline-offset-2","focus-visible:outline-primary/55","font-bold","font-semibold","for","format","formatByExtension","formatBytes","formatFromName","formatLabels","formatOf","formatTime","from","full","function","gap-0","gap-0.5","gap-1","gap-2","gap-2.5","gap-3","gap-3.5","gap-px","gif","grid","grid-cols-[14px_26px_minmax(0,1fr)_auto]","grid-cols-[24px_minmax(0,1fr)_auto]","grid-cols-[42px_minmax(0,1fr)_auto]","grid-cols-[auto_minmax(0,1fr)_auto]","group-data-[status=error]/call:text-destructive","group-hover/entry:opacity-100","group/call","group/entry","groupBadgeClass","groups","gz","h-12","h-full","handle","handles","height","hour","hover:-translate-y-px","hover:bg-[color-mix(in_srgb,var(--background)_91%,var(--primary))]","hover:bg-[color-mix(in_srgb,var(--primary)_7%,var(--card))]","hover:bg-primary/7","hover:border-primary/50","hover:border-primary/55","hover:shadow-md","href","htm","html","icon","icon-sm","id","if","image","import","in","input","instanceof","interface","is","isError","iso","items-center","jpeg","jpg","json","justify-center","key","kind","label","leading-[1.35]","leading-[1.65]","leading-[1.6]","length","let","library","line","lineCount","lines","list-none","listing","load","loaded","loose","lucide-react","m9","markdown","matter","max-[620px]:gap-2.5","max-[620px]:grid-cols-[38px_minmax(0,1fr)_auto]","max-[620px]:h-11","max-[620px]:px-2.5","max-[620px]:py-2.5","max-[620px]:sr-only","max-[620px]:w-[38px]","max-w-full","maxLength","md","mediaType","message","messages","meta","metaClass","min-h-0","min-h-30","min-h-full","min-w-0","minLength","minimum","minute","ml-[23px]","modifiedAt","month","more","mt-0.5","mt-1.5","name","needsRunView","new","next","no-store","none","not","number","onClick","onClose","onOpen","onOpenChange","onSelect","only","opacity-0","open","order","outline","overflow-y-auto","overview","p-0","p-7","p-9","parts","path","pathArgumentsFrom","pathDocumentFrom","pathDocumentsFromMessages","pb-10","pb-4.5","pdf","per","pl-2.5","plugin","png","preview","pt-2.5","pt-5","px-2","px-2.5","px-3.5","px-[clamp(18px,4vw,54px)]","px-workspace-inset","py-2","py-2.5","py-3","py-4","quassel","quassel/events","react","react-hooks/exhaustive-deps","read","readable","readonly","ready","rebuilt","relative","render","result","resultSection","results","return","reveal","rights","role","rotate-90","round","rounded-[10px]","rounded-[9px]","rounded-full","rounded-lg","rounded-none","rounded-panel","rounded-xl","routePrefix","rpc","run","runFileContentUrl","runId","running","s","sandbox","scope","secondary","sections","sectionsFrom","selection","session","setCache","setCollapsed","setError","setListing","setModalOpen","shadow-pop","shadow-sm","showCloseButton","show_document","shown","shrink-0","size","size-3","size-7","size-8","sm","sourceClass","src","srcDoc","state","status","statusLabel","store","string","stroke","strokeLinecap","strokeLinejoin","strokeWidth","sum","svg","tabId","tabular-nums","tar","text","text-[0.62rem]","text-[0.68rem]","text-[0.72rem]","text-[0.76rem]","text-[0.79rem]","text-[0.7rem]","text-[0.82rem]","text-[0.84rem]","text-[0.85rem]","text-[12px]","text-[13.5px]","text-[13px]","text-foreground","text-left","text-muted-foreground","text-primary","text-sm","textual","than","the","these","this","throw","timer","title","titleClass","to","toggle","tool","toolName","toolPresenters","tracking-[0.02em]","tracking-[0.05em]","transition-[background-color,border-color,box-shadow,transform]","transition-colors","transition-opacity","transition-transform","truncate","truncated","try","type","typebox","typeof","undefined","unknown","uppercase","url","useDocumentContent","useRunFiles","useRunFilesContext","useState","value","variant","view","viewBox","void","w-[42px]","w-[min(100%,620px)]","w-[min(1080px,calc(100%-2*clamp(16px,5vw,72px)))]","w-full","webPlugin","webp","whitespace-pre-wrap","width","workspaceTabs","xlsx","xml","yet","zip"]
@@ -1,4 +1,4 @@
1
- var u=(e,a)=>{let r=globalThis.__ragentsHostModules?.[e];if(r===void 0)throw new Error(`The host does not provide ${e}`);if(!(a in r))throw new Error(`The host does not provide ${a} from ${e}; the bundle was built against a newer host`);return r[a]};var D=u("react","createContext");var S=u("react","createElement");var B=u("react","forwardRef");var X=u("react","useCallback");var M=u("react","useContext");var P=u("react","useEffect");var C=u("react","useMemo");var g=u("react","useState");var ne=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function ce(e,a,r=[]){if(a==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:ne(e),size:24,node:a,...r.length>0?{aliases:r}:{}}}var pe=e=>{let a="",r=!1;for(let o of e){if(o==="-"||o==="_"||o<=" "){r=a.length>0;continue}a.length===0?a+=o.toLowerCase():a+=r?o.toUpperCase():o,r=!1}return a};var me=e=>{let a=pe(e);return a.charAt(0).toUpperCase()+a.slice(1)};var F=(...e)=>e.filter((a,r,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===r).join(" ").trim();var h={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function K(e){return e!=null}function Le(e,a={}){let r=a.attributeNames??{},o=m=>r[m]??m,d=e.size??e.width??h.width,l=e.size??e.height??h.height,f=e.aliases?.filter(m=>typeof m=="string"&&m.trim()!=="").map(m=>`lucide-${m}`)??[],n=[...e.name?[`lucide-${e.name}`]:[],...f],L=a.className?.split(" ").filter(Boolean)??[],c=a.includeDefaultClasses===!1?F(...L):F("lucide",...n,...L),x=a.absoluteStrokeWidth?Number(a.strokeWidth??h["stroke-width"])*Number(e.size??e.width??h.width)/Number(a.size??a.width??h.width):a.strokeWidth??h["stroke-width"];return["svg",{...Object.entries(h).reduce((m,[p,w])=>(m[o(p)]=w,m),{}),..."color"in a&&a.color&&{[o("stroke")]:a.color},..."size"in a&&K(a.size)&&{[o("width")]:a.size,[o("height")]:a.size},..."width"in a&&K(a.width)&&{[o("width")]:a.width},..."height"in a&&K(a.height)&&{[o("height")]:a.height},[o("stroke-width")]:x,...c&&{[o("class")]:c},[o("viewBox")]:`0 0 ${d} ${l}`,...a.hasA11yProp===!1?{[o("aria-hidden")]:"true"}:{},..."attributes"in a&&a.attributes},e.node.map(m=>{let[p,w,E]=m,G=a.nonScalingStroke?{[o("vector-effect")]:"non-scaling-stroke",...w}:w;return E?[p,G,E]:[p,G]})]}function xe(e,a={}){return Le(e,{...a,attributeNames:{...a.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var Ie=e=>{for(let a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1};var je=D({});var Ce=()=>M(je);var ge=B(({color:e,size:a,width:r,height:o,strokeWidth:d,absoluteStrokeWidth:l,nonScalingStroke:f,className:n="",children:L,iconNode:c=[],icon:x={node:c,aliases:[],size:24},...s},m)=>{let{size:p=24,strokeWidth:w=2,absoluteStrokeWidth:E=!1,nonScalingStroke:G=!1,color:Ve="currentColor",className:Ne=""}=Ce()??{},ze=!!L||Ie(s),[Xe,Ke,Ze=[]]=xe(x,{color:e??Ve,width:r??a??p,height:o??a??p,strokeWidth:d??w,absoluteStrokeWidth:l??E,nonScalingStroke:f??G,className:F(Ne,n),hasA11yProp:ze,attributes:s});return S(Xe,{ref:m,...Ke},[...Ze.map(([_e,Qe])=>S(_e,Qe)),...Array.isArray(L)?L:[L]])});function W(e,a=[],r=[]){let o=typeof e=="string"?ce(e,a,r):e,d=B(({className:l,...f},n)=>S(ge,{ref:n,icon:o,className:l,...f}));return o.name&&(d.displayName=me(o.name)),d}var he={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};he.node;var y=W(he);var Se={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};Se.node;var b=W(Se);var Z=u("@ragents/web/ui","Alert");var R=u("@ragents/web/ui","Badge");var A=u("@ragents/web/ui","Button");var _=u("@ragents/web/ui","Dialog");var Q=u("@ragents/web/ui","DialogContent");var j=u("@ragents/web/ui","DialogTitle");var T=u("@ragents/web/ui","Empty");var J=u("@ragents/web/ui","EmptyContent");var V=u("@ragents/web/ui","EmptyDescription");var q=u("@ragents/web/ui","EmptyHeader");var v=u("@ragents/web/ui","EmptyMedia");var U=u("@ragents/web/ui","EmptyTitle");var N=u("@ragents/web/ui","Spinner");var $=u("quassel","Markdown");var z=u("@ragents/web/lib/format","formatBytes");var Y=u("@ragents/web/SourceCode","SourceCode");var O=u("react/jsx-runtime","Fragment");var t=u("react/jsx-runtime","jsx");var i=u("react/jsx-runtime","jsxs");var ke="grid min-w-0 gap-px",Je="truncate text-[0.82rem] font-semibold",we="text-[0.68rem] text-muted-foreground tabular-nums",$e="min-w-0 p-0 text-[12px] whitespace-pre-wrap break-words",ee="flex size-7 items-center justify-center rounded-[9px] text-[0.62rem] font-bold tracking-[0.02em]",ae={markdown:"Markdown",text:"Text",html:"HTML",image:"Image",binary:"File"},Ye={".md":"markdown",".markdown":"markdown",".html":"html",".htm":"html",".png":"image",".jpg":"image",".jpeg":"image",".gif":"image",".svg":"image",".webp":"image",".pdf":"binary",".zip":"binary",".gz":"binary",".tar":"binary",".xlsx":"binary",".docx":"binary",".bin":"binary"},te=e=>{let a=e.lastIndexOf(".");return a<0?"text":Ye[e.slice(a).toLowerCase()]??"text"},Pe=e=>e.includes("html")?"html":e.includes("markdown")?"markdown":e.startsWith("image/")?"image":e.startsWith("text/")||e.includes("json")||e.includes("xml")?"text":"binary",Ae=e=>{let a=new Date(e);return Number.isNaN(a.getTime())?e:a.toLocaleString("en-US",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})},De=(e,a={})=>[...new Map([...Object.values(a).flat(),...e].filter(r=>r.tool?.name==="show_document").map(r=>[r.tool.id,r])).values()],oe=e=>e.flatMap(a=>{let r=a.tool;if(r?.name!=="show_document")return[];try{let o=JSON.parse(r.arguments);if(typeof o.title!="string"||typeof o.content!="string")return[];let d=o.format==="text"||o.format==="html"?o.format:"markdown";return[{id:r.id,title:o.title,content:o.content,format:d}]}catch{return[]}}),Be=e=>{let[a,r]=g({}),o=e?.format==="markdown"||e?.format==="text"||e?.format==="html",d=e?.content===void 0&&o?e?.contentUrl:void 0;if(P(()=>{if(!d||a[d])return;let l=!0;return fetch(d,{cache:"no-store"}).then(async f=>{if(!f.ok)throw new Error(`Status ${f.status}`);return f.text()}).then(f=>l&&r(n=>({...n,[d]:{text:f}}))).catch(f=>l&&r(n=>({...n,[d]:{error:f instanceof Error?f.message:String(f)}}))),()=>{l=!1}},[d,a]),!!e)return e.content!==void 0?{text:e.content}:o?d?a[d]:void 0:{text:""}};function Me({active:e,document:a,onOpen:r,status:o}){let d=C(()=>a.content?a.content.split(/\r\n|\r|\n/).length:0,[a.content]),l=o==="error"?"Error":o==="running"?"Opening":e?"Opened":"Open";return i("button",{"aria-pressed":e,className:"group/call grid w-[min(100%,620px)] grid-cols-[42px_minmax(0,1fr)_auto] items-center gap-3 rounded-xl border border-border bg-[color-mix(in_srgb,var(--background)_95%,var(--primary))] px-3.5 py-3 text-left shadow-sm transition-[background-color,border-color,box-shadow,transform] duration-100 hover:-translate-y-px hover:border-primary/50 hover:bg-[color-mix(in_srgb,var(--background)_91%,var(--primary))] hover:shadow-md focus-visible:border-primary/50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary/55 aria-pressed:border-primary/50 aria-pressed:bg-[color-mix(in_srgb,var(--background)_91%,var(--primary))] data-[status=error]:border-destructive/45 max-[620px]:grid-cols-[38px_minmax(0,1fr)_auto] max-[620px]:gap-2.5 max-[620px]:px-2.5 max-[620px]:py-2.5","data-status":o,onClick:r,type:"button",children:[t("span",{className:"flex h-12 w-[42px] items-center justify-center rounded-lg border border-primary/25 bg-primary/12 text-primary group-data-[status=error]/call:text-destructive max-[620px]:h-11 max-[620px]:w-[38px]",children:t(H,{size:22})}),i("span",{className:"flex min-w-0 flex-col gap-0.5",children:[t("span",{className:"text-[0.62rem] font-semibold tracking-[0.05em] text-primary uppercase",children:"Document"}),t("strong",{className:"truncate text-[0.84rem] leading-[1.35]",title:a.title,children:a.title}),i("span",{className:"text-[0.7rem] leading-[1.35] text-muted-foreground",children:[ae[a.format],", ",d.toLocaleString("en-US")," ",d===1?"line":"lines"]})]}),i("span",{className:"flex items-center gap-1 text-[0.7rem] font-semibold text-primary group-data-[status=error]/call:text-destructive",children:[t("span",{className:"max-[620px]:sr-only",children:l}),o==="running"?t(N,{className:"size-3"}):o==="error"?t(Te,{}):t(Re,{})]})]})}function Fe({document:e,loaded:a}){return e.format==="image"&&e.contentUrl?t("img",{alt:e.title,className:"block max-w-full rounded-lg border border-border",src:e.contentUrl}):e.format==="binary"&&e.contentUrl?i(T,{className:"min-h-30 gap-2 p-7",children:[i(q,{children:[t(v,{children:t(H,{})}),t(U,{children:"No preview for this format"})]}),t(J,{children:t(A,{render:t("a",{download:e.title,href:e.contentUrl}),size:"sm",variant:"outline",children:"Download"})})]}):a?"error"in a?t(T,{className:"min-h-30 gap-2 p-7",children:i(q,{children:[t(v,{children:t(Te,{})}),t(U,{children:"Content not readable"}),t(V,{children:a.error})]})}):e.format==="html"?t("iframe",{className:"h-full min-h-full w-full border-0 bg-white",sandbox:"",srcDoc:a.text,title:e.title}):e.format==="text"?t(Y,{className:$e,content:a.text,path:e.title}):t($,{text:a.text}):i("div",{className:"flex items-center justify-center gap-2.5 p-9 text-[0.76rem] text-muted-foreground",children:[t(N,{className:"size-3"}),t("span",{children:"Loading"})]})}function ye({document:e}){let a=[ae[e.format],e.size!==void 0?z(e.size):void 0,e.createdAt?Ae(e.createdAt):void 0,e.meta].filter(Boolean);return i(O,{children:[t("strong",{className:Je,title:e.title,children:e.title}),t("span",{className:we,children:a.join(" \xB7 ")})]})}function ea({document:e,onClose:a}){let r=Be(e);return t(_,{open:!0,onOpenChange:o=>{o||a()},children:i(Q,{className:"w-[min(1080px,calc(100%-2*clamp(16px,5vw,72px)))] gap-0 rounded-panel border border-border bg-card p-0 shadow-pop",scope:"run",showCloseButton:!1,size:"full",children:[i("header",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 border-b border-border px-3.5 py-3",children:[t("span",{className:"flex size-8 items-center justify-center rounded-[10px] bg-[color-mix(in_srgb,var(--primary)_12%,var(--background))] text-primary",children:t(H,{size:20})}),t(j,{className:ke,render:t("span",{}),children:t(ye,{document:e})}),t(A,{"aria-label":"Close",className:"rounded-full",onClick:a,size:"icon",title:"Close",variant:"outline",children:t(b,{})})]}),t("div",{className:"min-h-0 flex-1 overflow-y-auto px-[clamp(18px,4vw,54px)] pt-5 pb-10 text-[13.5px] leading-[1.65]",children:t(Fe,{document:e,loaded:r})})]})})}function be({activeId:e,sections:a,truncated:r,onSelect:o}){let d=a.flatMap(s=>s.documents).find(s=>s.id===e),l=Be(d),[f,n]=g(!1),[L,c]=g(()=>new Set),x=X(s=>{c(m=>{let p=new Set(m);return p.has(s)?p.delete(s):p.add(s),p})},[]);return P(()=>{d||n(!1)},[d]),a.every(s=>s.documents.length===0)?t(T,{className:"h-full gap-2 p-7",children:i(q,{children:[t(v,{children:t(H,{})}),t(U,{children:"No documents yet"}),t(V,{children:"Files from the run's store, results, and documents shown in chat collect here."})]})}):d?i("div",{className:"flex h-full min-h-0 flex-col",children:[i("header",{className:"grid shrink-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border-soft px-workspace-inset py-2.5",children:[t(A,{"aria-label":"Back to overview",onClick:()=>o(void 0),size:"icon-sm",title:"Back to overview",variant:"outline",children:t(y,{})}),t("span",{className:ke,children:t(ye,{document:d})}),t(A,{onClick:()=>n(!0),size:"sm",variant:"outline",children:"Large"})]}),t("div",{className:"min-h-0 flex-1 overflow-y-auto px-workspace-inset py-4 text-[13px] leading-[1.6]",children:t(Fe,{document:d,loaded:l})}),f&&t(ea,{document:d,onClose:()=>n(!1)})]}):i("div",{className:"flex h-full flex-col gap-3.5 overflow-y-auto px-workspace-inset pt-2.5 pb-4.5 [scrollbar-width:thin]",children:[a.filter(s=>s.documents.length>0).map(s=>{let m=!L.has(s.id);return i("section",{children:[i("button",{"aria-expanded":m,className:"grid w-full grid-cols-[14px_26px_minmax(0,1fr)_auto] items-center gap-2.5 rounded-lg px-2 py-2 text-left hover:bg-primary/7",onClick:()=>x(s.id),type:"button",children:[t("span",{"aria-hidden":!0,className:`flex text-muted-foreground transition-transform duration-150${m?" rotate-90":""}`,children:t(aa,{})}),s.kind==="store"&&t("span",{"aria-hidden":!0,className:`${ee} bg-[color-mix(in_srgb,var(--foreground)_8%,var(--background))] text-[0.85rem] text-foreground`,children:"#"}),s.kind==="results"&&t("span",{"aria-hidden":!0,className:`${ee} bg-[color-mix(in_srgb,var(--primary)_16%,var(--background))] text-primary`,children:t(oa,{})}),s.kind==="chat"&&t("span",{"aria-hidden":!0,className:`${ee} bg-[color-mix(in_srgb,var(--foreground)_9%,var(--background))] text-muted-foreground`,children:t(ta,{})}),t("span",{className:"truncate text-sm font-semibold",title:s.label,children:s.label}),t(R,{className:"tabular-nums",variant:"secondary",children:s.documents.length})]}),m&&t("div",{className:"ml-[23px] border-l border-border-soft pl-2.5",children:t("ul",{className:"mt-0.5 list-none",children:s.documents.map(p=>t("li",{children:i("button",{className:"group/entry mt-1.5 grid w-full grid-cols-[24px_minmax(0,1fr)_auto] items-center gap-2.5 rounded-lg border border-border bg-card px-2.5 py-2.5 text-left transition-colors duration-100 hover:border-primary/55 hover:bg-[color-mix(in_srgb,var(--primary)_7%,var(--card))]",onClick:()=>o(p.id),type:"button",children:[t("span",{className:"flex text-primary",children:t(H,{size:18})}),i("span",{className:"grid min-w-0 gap-0.5",children:[t("strong",{className:"truncate text-[0.79rem] font-semibold",title:p.title,children:p.title}),t("small",{className:we,children:[ae[p.format],p.size!==void 0?z(p.size):void 0,p.createdAt?Ae(p.createdAt):void 0,p.meta].filter(Boolean).join(" \xB7 ")})]}),t("span",{"aria-hidden":!0,className:"flex text-muted-foreground opacity-0 transition-opacity duration-100 group-hover/entry:opacity-100",children:t(Re,{})})]})},p.id))})})]},s.id)}),r&&t("p",{className:"text-[0.72rem] text-muted-foreground",children:"The store contains more files than are shown here."})]})}function H({size:e=28}){return i("svg",{"aria-hidden":!0,fill:"none",height:e,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",viewBox:"0 0 24 24",width:e,children:[t("path",{d:"M6 3h8l4 4v14H6z"}),t("path",{d:"M14 3v5h4M9 13h6M9 17h4"})]})}function Re(){return t("svg",{"aria-hidden":!0,fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8",viewBox:"0 0 24 24",width:"14",children:t("path",{d:"m9 18 6-6-6-6"})})}function aa(){return t("svg",{"aria-hidden":!0,fill:"none",height:"12",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"12",children:t("path",{d:"m9 18 6-6-6-6"})})}function ta(){return t("svg",{"aria-hidden":!0,fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8",viewBox:"0 0 24 24",width:"14",children:t("path",{d:"M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.4A8 8 0 1 1 21 12z"})})}function oa(){return t("svg",{"aria-hidden":!0,fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8",viewBox:"0 0 24 24",width:"14",children:t("path",{d:"M20 6 9 17l-5-5"})})}function Te(){return i("svg",{"aria-hidden":!0,fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8",viewBox:"0 0 24 24",width:"14",children:[t("circle",{cx:"12",cy:"12",r:"9"}),t("path",{d:"M12 7v6M12 17h.01"})]})}var ue=u("@ragents/web/rpc","rpc");var I=u("typebox","Type");var re=u("@ragents/engine/src/rpc/contract","defineOperation");var qe=I.Object({path:I.String({minLength:1}),size:I.Integer({minimum:0}),modifiedAt:I.String({minLength:1})},{additionalProperties:!1}),ua=I.Object({groups:I.Array(I.Object({directory:I.String({minLength:1}),files:I.Array(qe)},{additionalProperties:!1})),loose:I.Array(qe),truncated:I.Boolean()},{additionalProperties:!1}),ve={files:re({id:"ragents.documents.files",description:"A run's file store as groups and loose files. Right: runs.read.",rights:["runs.read"],input:I.Object({runId:I.String({minLength:1,maxLength:64,description:"Run id"})},{additionalProperties:!1}),result:ua})};var de=(e,a,r)=>`${e}/runs/${encodeURIComponent(a)}/files/content?path=${encodeURIComponent(r)}`,Ue=e=>ue.call(ve.files,{runId:e});var le=u("@ragents/web/run-view","runArtifactContentUrl");var fe=u("@ragents/web/run-view","runViewFrom");var se=u("@ragents/web/PluginRegistry","pluginRoutePrefixFrom");var ra="ragents.documents",k="ragents.documents.library",da=e=>{if(e.name==="show_document")try{let a=JSON.parse(e.arguments);return typeof a.title!="string"||typeof a.path!="string"||typeof a.content=="string"?void 0:{title:a.title,path:a.path,...typeof a.format=="string"?{format:a.format}:{}}}catch{return}},Ee=(e,a,r)=>{let o=da(e);if(!o)return;let d=o.format==="markdown"||o.format==="text"||o.format==="html"?o.format:te(o.path);return{id:e.id,title:o.title,format:d,contentUrl:de(a,r,o.path)}},Ge=(e,a,r)=>oe([{key:e.id,role:"tool",text:e.name,tool:e}])[0]??Ee(e,a,r),la=(e,a,r)=>e.flatMap(o=>{let d=o.tool;if(!d)return[];let l=Ee(d,a,r);return l?[l]:[]}),We=D(void 0),Oe=()=>{let e=M(We);if(!e)throw new Error("Documents plugin is not active");return e},fa=e=>{let[a,r]=g(),[o,d]=g(),l=e.session.id;return P(()=>{let f=!0,n=()=>{Ue(l).then(c=>{f&&(r(c),d(void 0))}).catch(c=>f&&d(c instanceof Error?c.message:String(c)))};if(n(),!e.running)return()=>{f=!1};let L=setInterval(n,5e3);return()=>{f=!1,clearInterval(L)}},[l,e.running]),C(()=>({listing:a,error:o}),[a,o])};function sa({children:e,session:a}){let r=fa(a);return t(We.Provider,{value:r,children:e})}var ia=(e,a)=>{let r=new Map(a.actors.map(o=>[o.id,o.handle]));return{id:"results",label:"Results",kind:"results",documents:a.artifacts.map(o=>{let d=r.get(o.createdBy);return{id:o.id,title:o.title,format:Pe(o.mediaType),contentUrl:le(e,o.id),createdAt:o.createdAt,size:o.size,...d?{meta:`@${d}`}:{}}})}},He=(e,a,r)=>{let o=a.session.id,d=fe(a.runView),l=(c,x)=>{let s=c?`${c}/${x.path}`:x.path;return{id:`file:${s}`,title:x.path,format:te(x.path),contentUrl:`${de(e,o,s)}&v=${encodeURIComponent(x.modifiedAt)}`,createdAt:x.modifiedAt,size:x.size}},f=[...(r?.groups??[]).map(c=>({id:`store/${c.directory}`,label:c.directory,kind:"store",documents:c.files.map(x=>l(c.directory,x))})),...r&&r.loose.length>0?[{id:"store",label:"Store",kind:"store",documents:r.loose.map(c=>l(void 0,c))}]:[],...d&&d.artifacts.length>0?[ia(o,d)]:[]],n=De(a.messages,a.actorConversations),L=[...oe(n),...la(n,e,a.session.id)];return L.length>0&&f.push({id:"chat",label:"Shown in chat",kind:"chat",documents:L}),{sections:f,truncated:r?.truncated??!1}},na=e=>{function a({navigation:o,selection:d,session:l}){let{listing:f,error:n}=Oe(),{sections:L,truncated:c}=C(()=>He(e,l,f),[l.messages,l.actorConversations,l.runView,l.session.id,f]);return i(O,{children:[n&&t(Z,{className:"shrink-0 rounded-none border-x-0 border-t-0 border-b-border-soft bg-destructive/8 px-2.5 py-2 text-[0.68rem]",variant:"destructive",children:n}),t(be,{activeId:typeof d=="string"?d:void 0,sections:L,truncated:c,onSelect:x=>o.openTab(k,x??null)})]})}function r({session:o}){let{listing:d}=Oe(),{sections:l}=C(()=>He(e,o,d),[o.messages,o.actorConversations,o.runView,o.session.id,d]),f=l.reduce((n,L)=>n+L.documents.length,0);return f>0?t(R,{className:"tabular-nums",variant:"secondary",children:f}):null}return{DocumentsPanelContribution:a,DocumentsBadge:r}};function ca({navigation:e,session:a,tool:r,routePrefix:o}){let d=Ge(r,o,a.session.id);if(!d)return null;let l=r.isError?"error":r.result===void 0?"running":"ready";return t(Me,{active:e.activeTabId===k&&e.selectionFor(k)===d.id,document:d,onOpen:()=>e.openTab(k,d.id),status:l})}function pa(){return t("svg",{"aria-hidden":!0,fill:"none",height:"15",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.7",viewBox:"0 0 24 24",width:"15",children:t("path",{d:"M6 3h8l4 4v14H6zM14 3v5h4M9 13h6M9 17h4"})})}var ma=(e,a)=>{let{DocumentsPanelContribution:r,DocumentsBadge:o}=na(a);return{...e,needsRunView:!0,SessionProvider:sa,workspaceTabs:[{id:k,label:"Documents",order:200,Icon:pa,Panel:r,Badge:o}],toolPresenters:[{toolName:"show_document",Inline:d=>t(ca,{...d,routePrefix:a}),reveal:(d,l)=>Ge(d,a,l.session.id)?{tabId:k,selection:d.id}:void 0}],entityPresenters:[{reveal:d=>d.type==="artifact"?{tabId:k,selection:d.id}:void 0}]}},ie={id:ra},gu={...ie,activate:e=>ma(ie,se(ie.id,e))};export{ra as DOCUMENTS_PLUGIN_ID,k as DOCUMENTS_TAB_ID,gu as webPlugin};
1
+ var u=(e,a)=>{let r=globalThis.__ragentsHostModules?.[e];if(r===void 0)throw new Error(`The host does not provide ${e}`);if(!(a in r))throw new Error(`The host does not provide ${a} from ${e}; the bundle was built against a newer host`);return r[a]};var D=u("react","createContext");var S=u("react","createElement");var B=u("react","forwardRef");var X=u("react","useCallback");var M=u("react","useContext");var P=u("react","useEffect");var C=u("react","useMemo");var g=u("react","useState");var ne=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function ce(e,a,r=[]){if(a==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:ne(e),size:24,node:a,...r.length>0?{aliases:r}:{}}}var pe=e=>{let a="",r=!1;for(let o of e){if(o==="-"||o==="_"||o<=" "){r=a.length>0;continue}a.length===0?a+=o.toLowerCase():a+=r?o.toUpperCase():o,r=!1}return a};var me=e=>{let a=pe(e);return a.charAt(0).toUpperCase()+a.slice(1)};var F=(...e)=>e.filter((a,r,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===r).join(" ").trim();var h={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function K(e){return e!=null}function Le(e,a={}){let r=a.attributeNames??{},o=m=>r[m]??m,d=e.size??e.width??h.width,l=e.size??e.height??h.height,f=e.aliases?.filter(m=>typeof m=="string"&&m.trim()!=="").map(m=>`lucide-${m}`)??[],n=[...e.name?[`lucide-${e.name}`]:[],...f],L=a.className?.split(" ").filter(Boolean)??[],c=a.includeDefaultClasses===!1?F(...L):F("lucide",...n,...L),x=a.absoluteStrokeWidth?Number(a.strokeWidth??h["stroke-width"])*Number(e.size??e.width??h.width)/Number(a.size??a.width??h.width):a.strokeWidth??h["stroke-width"];return["svg",{...Object.entries(h).reduce((m,[p,w])=>(m[o(p)]=w,m),{}),..."color"in a&&a.color&&{[o("stroke")]:a.color},..."size"in a&&K(a.size)&&{[o("width")]:a.size,[o("height")]:a.size},..."width"in a&&K(a.width)&&{[o("width")]:a.width},..."height"in a&&K(a.height)&&{[o("height")]:a.height},[o("stroke-width")]:x,...c&&{[o("class")]:c},[o("viewBox")]:`0 0 ${d} ${l}`,...a.hasA11yProp===!1?{[o("aria-hidden")]:"true"}:{},..."attributes"in a&&a.attributes},e.node.map(m=>{let[p,w,E]=m,G=a.nonScalingStroke?{[o("vector-effect")]:"non-scaling-stroke",...w}:w;return E?[p,G,E]:[p,G]})]}function xe(e,a={}){return Le(e,{...a,attributeNames:{...a.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var Ie=e=>{for(let a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1};var je=D({});var Ce=()=>M(je);var ge=B(({color:e,size:a,width:r,height:o,strokeWidth:d,absoluteStrokeWidth:l,nonScalingStroke:f,className:n="",children:L,iconNode:c=[],icon:x={node:c,aliases:[],size:24},...s},m)=>{let{size:p=24,strokeWidth:w=2,absoluteStrokeWidth:E=!1,nonScalingStroke:G=!1,color:Ve="currentColor",className:Ne=""}=Ce()??{},ze=!!L||Ie(s),[Xe,Ke,Ze=[]]=xe(x,{color:e??Ve,width:r??a??p,height:o??a??p,strokeWidth:d??w,absoluteStrokeWidth:l??E,nonScalingStroke:f??G,className:F(Ne,n),hasA11yProp:ze,attributes:s});return S(Xe,{ref:m,...Ke},[...Ze.map(([_e,Qe])=>S(_e,Qe)),...Array.isArray(L)?L:[L]])});function W(e,a=[],r=[]){let o=typeof e=="string"?ce(e,a,r):e,d=B(({className:l,...f},n)=>S(ge,{ref:n,icon:o,className:l,...f}));return o.name&&(d.displayName=me(o.name)),d}var he={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};he.node;var y=W(he);var Se={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};Se.node;var b=W(Se);var Z=u("@ragents/web/ui","Alert");var R=u("@ragents/web/ui","Badge");var A=u("@ragents/web/ui","Button");var _=u("@ragents/web/ui","Dialog");var Q=u("@ragents/web/ui","DialogContent");var j=u("@ragents/web/ui","DialogTitle");var T=u("@ragents/web/ui","Empty");var J=u("@ragents/web/ui","EmptyContent");var V=u("@ragents/web/ui","EmptyDescription");var q=u("@ragents/web/ui","EmptyHeader");var v=u("@ragents/web/ui","EmptyMedia");var U=u("@ragents/web/ui","EmptyTitle");var N=u("@ragents/web/ui","Spinner");var $=u("quassel","Markdown");var z=u("@ragents/web/lib/format","formatBytes");var Y=u("@ragents/web/SourceCode","SourceCode");var O=u("react/jsx-runtime","Fragment");var t=u("react/jsx-runtime","jsx");var i=u("react/jsx-runtime","jsxs");var ke="grid min-w-0 gap-px",Je="truncate text-[0.82rem] font-semibold",we="text-[0.68rem] text-muted-foreground tabular-nums",$e="min-w-0 p-0 text-[12px] whitespace-pre-wrap break-words",ee="flex size-7 items-center justify-center rounded-[9px] text-[0.62rem] font-bold tracking-[0.02em]",ae={markdown:"Markdown",text:"Text",html:"HTML",image:"Image",binary:"File"},Ye={".md":"markdown",".markdown":"markdown",".html":"html",".htm":"html",".png":"image",".jpg":"image",".jpeg":"image",".gif":"image",".svg":"image",".webp":"image",".pdf":"binary",".zip":"binary",".gz":"binary",".tar":"binary",".xlsx":"binary",".docx":"binary",".bin":"binary"},te=e=>{let a=e.lastIndexOf(".");return a<0?"text":Ye[e.slice(a).toLowerCase()]??"text"},Pe=e=>e.includes("html")?"html":e.includes("markdown")?"markdown":e.startsWith("image/")?"image":e.startsWith("text/")||e.includes("json")||e.includes("xml")?"text":"binary",Ae=e=>{let a=new Date(e);return Number.isNaN(a.getTime())?e:a.toLocaleString(void 0,{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})},De=(e,a={})=>[...new Map([...Object.values(a).flat(),...e].filter(r=>r.tool?.name==="show_document").map(r=>[r.tool.id,r])).values()],oe=e=>e.flatMap(a=>{let r=a.tool;if(r?.name!=="show_document")return[];try{let o=JSON.parse(r.arguments);if(typeof o.title!="string"||typeof o.content!="string")return[];let d=o.format==="text"||o.format==="html"?o.format:"markdown";return[{id:r.id,title:o.title,content:o.content,format:d}]}catch{return[]}}),Be=e=>{let[a,r]=g({}),o=e?.format==="markdown"||e?.format==="text"||e?.format==="html",d=e?.content===void 0&&o?e?.contentUrl:void 0;if(P(()=>{if(!d||a[d])return;let l=!0;return fetch(d,{cache:"no-store"}).then(async f=>{if(!f.ok)throw new Error(`Status ${f.status}`);return f.text()}).then(f=>l&&r(n=>({...n,[d]:{text:f}}))).catch(f=>l&&r(n=>({...n,[d]:{error:f instanceof Error?f.message:String(f)}}))),()=>{l=!1}},[d,a]),!!e)return e.content!==void 0?{text:e.content}:o?d?a[d]:void 0:{text:""}};function Me({active:e,document:a,onOpen:r,status:o}){let d=C(()=>a.content?a.content.split(/\r\n|\r|\n/).length:0,[a.content]),l=o==="error"?"Error":o==="running"?"Opening":e?"Opened":"Open";return i("button",{"aria-pressed":e,className:"group/call grid w-[min(100%,620px)] grid-cols-[42px_minmax(0,1fr)_auto] items-center gap-3 rounded-xl border border-border bg-[color-mix(in_srgb,var(--background)_95%,var(--primary))] px-3.5 py-3 text-left shadow-sm transition-[background-color,border-color,box-shadow,transform] duration-100 hover:-translate-y-px hover:border-primary/50 hover:bg-[color-mix(in_srgb,var(--background)_91%,var(--primary))] hover:shadow-md focus-visible:border-primary/50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary/55 aria-pressed:border-primary/50 aria-pressed:bg-[color-mix(in_srgb,var(--background)_91%,var(--primary))] data-[status=error]:border-destructive/45 max-[620px]:grid-cols-[38px_minmax(0,1fr)_auto] max-[620px]:gap-2.5 max-[620px]:px-2.5 max-[620px]:py-2.5","data-status":o,onClick:r,type:"button",children:[t("span",{className:"flex h-12 w-[42px] items-center justify-center rounded-lg border border-primary/25 bg-primary/12 text-primary group-data-[status=error]/call:text-destructive max-[620px]:h-11 max-[620px]:w-[38px]",children:t(H,{size:22})}),i("span",{className:"flex min-w-0 flex-col gap-0.5",children:[t("span",{className:"text-[0.62rem] font-semibold tracking-[0.05em] text-primary uppercase",children:"Document"}),t("strong",{className:"truncate text-[0.84rem] leading-[1.35]",title:a.title,children:a.title}),i("span",{className:"text-[0.7rem] leading-[1.35] text-muted-foreground",children:[ae[a.format],", ",d.toLocaleString()," ",d===1?"line":"lines"]})]}),i("span",{className:"flex items-center gap-1 text-[0.7rem] font-semibold text-primary group-data-[status=error]/call:text-destructive",children:[t("span",{className:"max-[620px]:sr-only",children:l}),o==="running"?t(N,{className:"size-3"}):o==="error"?t(Te,{}):t(Re,{})]})]})}function Fe({document:e,loaded:a}){return e.format==="image"&&e.contentUrl?t("img",{alt:e.title,className:"block max-w-full rounded-lg border border-border",src:e.contentUrl}):e.format==="binary"&&e.contentUrl?i(T,{className:"min-h-30 gap-2 p-7",children:[i(q,{children:[t(v,{children:t(H,{})}),t(U,{children:"No preview for this format"})]}),t(J,{children:t(A,{render:t("a",{download:e.title,href:e.contentUrl}),size:"sm",variant:"outline",children:"Download"})})]}):a?"error"in a?t(T,{className:"min-h-30 gap-2 p-7",children:i(q,{children:[t(v,{children:t(Te,{})}),t(U,{children:"Content not readable"}),t(V,{children:a.error})]})}):e.format==="html"?t("iframe",{className:"h-full min-h-full w-full border-0 bg-white",sandbox:"",srcDoc:a.text,title:e.title}):e.format==="text"?t(Y,{className:$e,content:a.text,path:e.title}):t($,{text:a.text}):i("div",{className:"flex items-center justify-center gap-2.5 p-9 text-[0.76rem] text-muted-foreground",children:[t(N,{className:"size-3"}),t("span",{children:"Loading"})]})}function ye({document:e}){let a=[ae[e.format],e.size!==void 0?z(e.size):void 0,e.createdAt?Ae(e.createdAt):void 0,e.meta].filter(Boolean);return i(O,{children:[t("strong",{className:Je,title:e.title,children:e.title}),t("span",{className:we,children:a.join(" \xB7 ")})]})}function ea({document:e,onClose:a}){let r=Be(e);return t(_,{open:!0,onOpenChange:o=>{o||a()},children:i(Q,{className:"w-[min(1080px,calc(100%-2*clamp(16px,5vw,72px)))] gap-0 rounded-panel border border-border bg-card p-0 shadow-pop",scope:"run",showCloseButton:!1,size:"full",children:[i("header",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 border-b border-border px-3.5 py-3",children:[t("span",{className:"flex size-8 items-center justify-center rounded-[10px] bg-[color-mix(in_srgb,var(--primary)_12%,var(--background))] text-primary",children:t(H,{size:20})}),t(j,{className:ke,render:t("span",{}),children:t(ye,{document:e})}),t(A,{"aria-label":"Close",className:"rounded-full",onClick:a,size:"icon",title:"Close",variant:"outline",children:t(b,{})})]}),t("div",{className:"min-h-0 flex-1 overflow-y-auto px-[clamp(18px,4vw,54px)] pt-5 pb-10 text-[13.5px] leading-[1.65]",children:t(Fe,{document:e,loaded:r})})]})})}function be({activeId:e,sections:a,truncated:r,onSelect:o}){let d=a.flatMap(s=>s.documents).find(s=>s.id===e),l=Be(d),[f,n]=g(!1),[L,c]=g(()=>new Set),x=X(s=>{c(m=>{let p=new Set(m);return p.has(s)?p.delete(s):p.add(s),p})},[]);return P(()=>{d||n(!1)},[d]),a.every(s=>s.documents.length===0)?t(T,{className:"h-full gap-2 p-7",children:i(q,{children:[t(v,{children:t(H,{})}),t(U,{children:"No documents yet"}),t(V,{children:"Files from the run's store, results, and documents shown in chat collect here."})]})}):d?i("div",{className:"flex h-full min-h-0 flex-col",children:[i("header",{className:"grid shrink-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border-soft px-workspace-inset py-2.5",children:[t(A,{"aria-label":"Back to overview",onClick:()=>o(void 0),size:"icon-sm",title:"Back to overview",variant:"outline",children:t(y,{})}),t("span",{className:ke,children:t(ye,{document:d})}),t(A,{onClick:()=>n(!0),size:"sm",variant:"outline",children:"Large"})]}),t("div",{className:"min-h-0 flex-1 overflow-y-auto px-workspace-inset py-4 text-[13px] leading-[1.6]",children:t(Fe,{document:d,loaded:l})}),f&&t(ea,{document:d,onClose:()=>n(!1)})]}):i("div",{className:"flex h-full flex-col gap-3.5 overflow-y-auto px-workspace-inset pt-2.5 pb-4.5 [scrollbar-width:thin]",children:[a.filter(s=>s.documents.length>0).map(s=>{let m=!L.has(s.id);return i("section",{children:[i("button",{"aria-expanded":m,className:"grid w-full grid-cols-[14px_26px_minmax(0,1fr)_auto] items-center gap-2.5 rounded-lg px-2 py-2 text-left hover:bg-primary/7",onClick:()=>x(s.id),type:"button",children:[t("span",{"aria-hidden":!0,className:`flex text-muted-foreground transition-transform duration-150${m?" rotate-90":""}`,children:t(aa,{})}),s.kind==="store"&&t("span",{"aria-hidden":!0,className:`${ee} bg-[color-mix(in_srgb,var(--foreground)_8%,var(--background))] text-[0.85rem] text-foreground`,children:"#"}),s.kind==="results"&&t("span",{"aria-hidden":!0,className:`${ee} bg-[color-mix(in_srgb,var(--primary)_16%,var(--background))] text-primary`,children:t(oa,{})}),s.kind==="chat"&&t("span",{"aria-hidden":!0,className:`${ee} bg-[color-mix(in_srgb,var(--foreground)_9%,var(--background))] text-muted-foreground`,children:t(ta,{})}),t("span",{className:"truncate text-sm font-semibold",title:s.label,children:s.label}),t(R,{className:"tabular-nums",variant:"secondary",children:s.documents.length})]}),m&&t("div",{className:"ml-[23px] border-l border-border-soft pl-2.5",children:t("ul",{className:"mt-0.5 list-none",children:s.documents.map(p=>t("li",{children:i("button",{className:"group/entry mt-1.5 grid w-full grid-cols-[24px_minmax(0,1fr)_auto] items-center gap-2.5 rounded-lg border border-border bg-card px-2.5 py-2.5 text-left transition-colors duration-100 hover:border-primary/55 hover:bg-[color-mix(in_srgb,var(--primary)_7%,var(--card))]",onClick:()=>o(p.id),type:"button",children:[t("span",{className:"flex text-primary",children:t(H,{size:18})}),i("span",{className:"grid min-w-0 gap-0.5",children:[t("strong",{className:"truncate text-[0.79rem] font-semibold",title:p.title,children:p.title}),t("small",{className:we,children:[ae[p.format],p.size!==void 0?z(p.size):void 0,p.createdAt?Ae(p.createdAt):void 0,p.meta].filter(Boolean).join(" \xB7 ")})]}),t("span",{"aria-hidden":!0,className:"flex text-muted-foreground opacity-0 transition-opacity duration-100 group-hover/entry:opacity-100",children:t(Re,{})})]})},p.id))})})]},s.id)}),r&&t("p",{className:"text-[0.72rem] text-muted-foreground",children:"The store contains more files than are shown here."})]})}function H({size:e=28}){return i("svg",{"aria-hidden":!0,fill:"none",height:e,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",viewBox:"0 0 24 24",width:e,children:[t("path",{d:"M6 3h8l4 4v14H6z"}),t("path",{d:"M14 3v5h4M9 13h6M9 17h4"})]})}function Re(){return t("svg",{"aria-hidden":!0,fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8",viewBox:"0 0 24 24",width:"14",children:t("path",{d:"m9 18 6-6-6-6"})})}function aa(){return t("svg",{"aria-hidden":!0,fill:"none",height:"12",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"12",children:t("path",{d:"m9 18 6-6-6-6"})})}function ta(){return t("svg",{"aria-hidden":!0,fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8",viewBox:"0 0 24 24",width:"14",children:t("path",{d:"M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.4A8 8 0 1 1 21 12z"})})}function oa(){return t("svg",{"aria-hidden":!0,fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8",viewBox:"0 0 24 24",width:"14",children:t("path",{d:"M20 6 9 17l-5-5"})})}function Te(){return i("svg",{"aria-hidden":!0,fill:"none",height:"14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8",viewBox:"0 0 24 24",width:"14",children:[t("circle",{cx:"12",cy:"12",r:"9"}),t("path",{d:"M12 7v6M12 17h.01"})]})}var ue=u("@ragents/web/rpc","rpc");var I=u("typebox","Type");var re=u("@ragents/engine/src/rpc/contract","defineOperation");var qe=I.Object({path:I.String({minLength:1}),size:I.Integer({minimum:0}),modifiedAt:I.String({minLength:1})},{additionalProperties:!1}),ua=I.Object({groups:I.Array(I.Object({directory:I.String({minLength:1}),files:I.Array(qe)},{additionalProperties:!1})),loose:I.Array(qe),truncated:I.Boolean()},{additionalProperties:!1}),ve={files:re({id:"ragents.documents.files",description:"A run's file store as groups and loose files. Right: runs.read.",rights:["runs.read"],input:I.Object({runId:I.String({minLength:1,maxLength:64,description:"Run id"})},{additionalProperties:!1}),result:ua})};var de=(e,a,r)=>`${e}/runs/${encodeURIComponent(a)}/files/content?path=${encodeURIComponent(r)}`,Ue=e=>ue.call(ve.files,{runId:e});var le=u("@ragents/web/run-view","runArtifactContentUrl");var fe=u("@ragents/web/run-view","runViewFrom");var se=u("@ragents/web/PluginRegistry","pluginRoutePrefixFrom");var ra="ragents.documents",k="ragents.documents.library",da=e=>{if(e.name==="show_document")try{let a=JSON.parse(e.arguments);return typeof a.title!="string"||typeof a.path!="string"||typeof a.content=="string"?void 0:{title:a.title,path:a.path,...typeof a.format=="string"?{format:a.format}:{}}}catch{return}},Ee=(e,a,r)=>{let o=da(e);if(!o)return;let d=o.format==="markdown"||o.format==="text"||o.format==="html"?o.format:te(o.path);return{id:e.id,title:o.title,format:d,contentUrl:de(a,r,o.path)}},Ge=(e,a,r)=>oe([{key:e.id,role:"tool",text:e.name,tool:e}])[0]??Ee(e,a,r),la=(e,a,r)=>e.flatMap(o=>{let d=o.tool;if(!d)return[];let l=Ee(d,a,r);return l?[l]:[]}),We=D(void 0),Oe=()=>{let e=M(We);if(!e)throw new Error("Documents plugin is not active");return e},fa=e=>{let[a,r]=g(),[o,d]=g(),l=e.session.id;return P(()=>{let f=!0,n=()=>{Ue(l).then(c=>{f&&(r(c),d(void 0))}).catch(c=>f&&d(c instanceof Error?c.message:String(c)))};if(n(),!e.running)return()=>{f=!1};let L=setInterval(n,5e3);return()=>{f=!1,clearInterval(L)}},[l,e.running]),C(()=>({listing:a,error:o}),[a,o])};function sa({children:e,session:a}){let r=fa(a);return t(We.Provider,{value:r,children:e})}var ia=(e,a)=>{let r=new Map(a.actors.map(o=>[o.id,o.handle]));return{id:"results",label:"Results",kind:"results",documents:a.artifacts.map(o=>{let d=r.get(o.createdBy);return{id:o.id,title:o.title,format:Pe(o.mediaType),contentUrl:le(e,o.id),createdAt:o.createdAt,size:o.size,...d?{meta:`@${d}`}:{}}})}},He=(e,a,r)=>{let o=a.session.id,d=fe(a.runView),l=(c,x)=>{let s=c?`${c}/${x.path}`:x.path;return{id:`file:${s}`,title:x.path,format:te(x.path),contentUrl:`${de(e,o,s)}&v=${encodeURIComponent(x.modifiedAt)}`,createdAt:x.modifiedAt,size:x.size}},f=[...(r?.groups??[]).map(c=>({id:`store/${c.directory}`,label:c.directory,kind:"store",documents:c.files.map(x=>l(c.directory,x))})),...r&&r.loose.length>0?[{id:"store",label:"Store",kind:"store",documents:r.loose.map(c=>l(void 0,c))}]:[],...d&&d.artifacts.length>0?[ia(o,d)]:[]],n=De(a.messages,a.actorConversations),L=[...oe(n),...la(n,e,a.session.id)];return L.length>0&&f.push({id:"chat",label:"Shown in chat",kind:"chat",documents:L}),{sections:f,truncated:r?.truncated??!1}},na=e=>{function a({navigation:o,selection:d,session:l}){let{listing:f,error:n}=Oe(),{sections:L,truncated:c}=C(()=>He(e,l,f),[l.messages,l.actorConversations,l.runView,l.session.id,f]);return i(O,{children:[n&&t(Z,{className:"shrink-0 rounded-none border-x-0 border-t-0 border-b-border-soft bg-destructive/8 px-2.5 py-2 text-[0.68rem]",variant:"destructive",children:n}),t(be,{activeId:typeof d=="string"?d:void 0,sections:L,truncated:c,onSelect:x=>o.openTab(k,x??null)})]})}function r({session:o}){let{listing:d}=Oe(),{sections:l}=C(()=>He(e,o,d),[o.messages,o.actorConversations,o.runView,o.session.id,d]),f=l.reduce((n,L)=>n+L.documents.length,0);return f>0?t(R,{className:"tabular-nums",variant:"secondary",children:f}):null}return{DocumentsPanelContribution:a,DocumentsBadge:r}};function ca({navigation:e,session:a,tool:r,routePrefix:o}){let d=Ge(r,o,a.session.id);if(!d)return null;let l=r.isError?"error":r.result===void 0?"running":"ready";return t(Me,{active:e.activeTabId===k&&e.selectionFor(k)===d.id,document:d,onOpen:()=>e.openTab(k,d.id),status:l})}function pa(){return t("svg",{"aria-hidden":!0,fill:"none",height:"15",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.7",viewBox:"0 0 24 24",width:"15",children:t("path",{d:"M6 3h8l4 4v14H6zM14 3v5h4M9 13h6M9 17h4"})})}var ma=(e,a)=>{let{DocumentsPanelContribution:r,DocumentsBadge:o}=na(a);return{...e,needsRunView:!0,SessionProvider:sa,workspaceTabs:[{id:k,label:"Documents",order:200,Icon:pa,Panel:r,Badge:o}],toolPresenters:[{toolName:"show_document",Inline:d=>t(ca,{...d,routePrefix:a}),reveal:(d,l)=>Ge(d,a,l.session.id)?{tabId:k,selection:d.id}:void 0}],entityPresenters:[{reveal:d=>d.type==="artifact"?{tabId:k,selection:d.id}:void 0}]}},ie={id:ra},gu={...ie,activate:e=>ma(ie,se(ie.id,e))};export{ra as DOCUMENTS_PLUGIN_ID,k as DOCUMENTS_TAB_ID,gu as webPlugin};
2
2
  /*! Bundled license information:
3
3
 
4
4
  lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs: