local-operator-ui 0.15.1 → 0.16.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 (73) hide show
  1. package/bin/linux-sandbox.js +471 -0
  2. package/bin/local-operator-ui.js +91 -3
  3. package/bin/postinstall.js +120 -0
  4. package/out/main/index.js +133 -21
  5. package/out/renderer/assets/{_basePickBy-CfllbLPT.js → _basePickBy-Bw7mQqmp.js} +1 -1
  6. package/out/renderer/assets/{_baseUniq-t3IzOokH.js → _baseUniq-BnazTPmS.js} +1 -1
  7. package/out/renderer/assets/{agent-details-page-BU1kYKxK.js → agent-details-page-BtWGsmjK.js} +7 -2
  8. package/out/renderer/assets/{agent-hub-page-DrFYnBSt.js → agent-hub-page-w823LFh-.js} +3 -3
  9. package/out/renderer/assets/agents-page-B7ZWTJyU.js +2 -0
  10. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-DZdNjiiw.js → architectureDiagram-IEHRJDOE-D2ubQTOC.js} +1 -1
  11. package/out/renderer/assets/{blockDiagram-JOT3LUYC-DfSTYCE8.js → blockDiagram-JOT3LUYC-ByU_ahgT.js} +1 -1
  12. package/out/renderer/assets/{c4Diagram-VJAJSXHY-kj8ONcdJ.js → c4Diagram-VJAJSXHY-BC3KE4lQ.js} +1 -1
  13. package/out/renderer/assets/channel-CBntux_E.js +1 -0
  14. package/out/renderer/assets/{chunk-4BMEZGHF-DTEIsOQ8.js → chunk-4BMEZGHF-yCczBk2C.js} +1 -1
  15. package/out/renderer/assets/{chunk-A2AXSNBT-H5FcAjIP.js → chunk-A2AXSNBT-hQtr2CYL.js} +1 -1
  16. package/out/renderer/assets/{chunk-AEK57VVT-Ckh1RshY.js → chunk-AEK57VVT-BF7FMjiN.js} +1 -1
  17. package/out/renderer/assets/{chunk-D6G4REZN-BI15Ho6z.js → chunk-D6G4REZN-D1ZkK01q.js} +1 -1
  18. package/out/renderer/assets/{chunk-RZ5BOZE2-B4XztrFv.js → chunk-RZ5BOZE2-CF-6knpx.js} +1 -1
  19. package/out/renderer/assets/{chunk-XZIHB7SX-RYtDnxT5.js → chunk-XZIHB7SX-wxUXF_xN.js} +1 -1
  20. package/out/renderer/assets/classDiagram-GIVACNV2-7UDlKgfd.js +1 -0
  21. package/out/renderer/assets/classDiagram-v2-COTLJTTW-7UDlKgfd.js +1 -0
  22. package/out/renderer/assets/clone-DkhUgY-v.js +1 -0
  23. package/out/renderer/assets/compact-pagination-D9Y6NSdy.js +1 -0
  24. package/out/renderer/assets/{dagre-OKDRZEBW-CVqq_Qpq.js → dagre-OKDRZEBW-CmhmcUUf.js} +1 -1
  25. package/out/renderer/assets/{diagram-SSKATNLV-7I1hPrEB.js → diagram-SSKATNLV-Zehvro6p.js} +1 -1
  26. package/out/renderer/assets/{diagram-VNBRO52H-B4In8mRQ.js → diagram-VNBRO52H-BarSLhrS.js} +1 -1
  27. package/out/renderer/assets/{erDiagram-Q7BY3M3F-D8m7xWyt.js → erDiagram-Q7BY3M3F-DPeXV5YU.js} +1 -1
  28. package/out/renderer/assets/{flowDiagram-4HSFHLVR-HzyvxZJ_.js → flowDiagram-4HSFHLVR-CN5KLBDn.js} +1 -1
  29. package/out/renderer/assets/{ganttDiagram-APWFNJXF-D9VGOeKz.js → ganttDiagram-APWFNJXF-BZoKoMXG.js} +1 -1
  30. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-bCjN7hkh.js → gitGraphDiagram-7IBYFJ6S-qg18taCn.js} +1 -1
  31. package/out/renderer/assets/{graph-Bm4dxGQt.js → graph-OhiwQ8kq.js} +1 -1
  32. package/out/renderer/assets/icon-CvlWlLiK.css +1 -0
  33. package/out/renderer/assets/{icon-BIaTDBQz.js → icon-DREivh6T.js} +1 -1
  34. package/out/renderer/assets/{index-B1ky8xLm.js → index-BAltHHlD.js} +1 -1
  35. package/out/renderer/assets/{index-fNnd2qrg.js → index-D5Z_uzU-.js} +296 -329
  36. package/out/renderer/assets/{index-C_toWewb.js → index-kC3Gu5qg.js} +1 -1
  37. package/out/renderer/assets/{infoDiagram-PH2N3AL5-B2JkP-Hd.js → infoDiagram-PH2N3AL5-D9zrB_S2.js} +1 -1
  38. package/out/renderer/assets/{installer-DYZ22Cfq.js → installer-BRKNGt5t.js} +3 -3
  39. package/out/renderer/assets/{journeyDiagram-U35MCT3I-NnbVNsik.js → journeyDiagram-U35MCT3I-CiKGQ8ZZ.js} +1 -1
  40. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-DBgR7W50.js → kanban-definition-NDS4AKOZ-CMVH6spE.js} +1 -1
  41. package/out/renderer/assets/{layout-CE8ShubG.js → layout-neDpz9Oy.js} +1 -1
  42. package/out/renderer/assets/legacy-agents-page-Bjs1Z9g8.js +43 -0
  43. package/out/renderer/assets/{mermaid.core-CExbFl-7.js → mermaid.core-1bIbhsqM.js} +5 -5
  44. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-ag_HQs7G.js → mindmap-definition-ALO5MXBD-COKGXFAt.js} +1 -1
  45. package/out/renderer/assets/{page-header-GWjqQg3-.js → page-header-CtwhpX97.js} +1 -1
  46. package/out/renderer/assets/{parseISO-LV1Yh_aZ.js → parseISO-DoGRsp53.js} +2 -2
  47. package/out/renderer/assets/{pieDiagram-IB7DONF6-DJ-5Rt4W.js → pieDiagram-IB7DONF6-G5934Pyw.js} +1 -1
  48. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-BQceCClO.js → quadrantDiagram-7GDLP6J5-CXu2hVFd.js} +1 -1
  49. package/out/renderer/assets/{radar-MK3ICKWK-D2qI0wBa.js → radar-MK3ICKWK-C99cc5bu.js} +1 -1
  50. package/out/renderer/assets/radient-auth-buttons-D3fZKkWZ.js +6 -0
  51. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-Bd6T_ndu.js → requirementDiagram-KVF5MWMF-BWEMU0o3.js} +1 -1
  52. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-CnMYNt__.js → sankeyDiagram-QLVOVGJD-IBOCcssn.js} +1 -1
  53. package/out/renderer/assets/{schedules-page-DqrcIxzB.js → schedules-page-D4a05UgL.js} +1 -1
  54. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-SiFK0EWD.js → sequenceDiagram-X6HHIX6F-CqE6tvSG.js} +1 -1
  55. package/out/renderer/assets/{settings-page-D_JWK3qq.js → settings-page-BAZmRT08.js} +29 -29
  56. package/out/renderer/assets/{square-pen-sK57wlY1.js → square-pen-C0syRM6p.js} +2 -2
  57. package/out/renderer/assets/{stateDiagram-DGXRK772-BrX4XGdu.js → stateDiagram-DGXRK772-ZQrc2AeF.js} +1 -1
  58. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-D7ygFjc0.js +1 -0
  59. package/out/renderer/assets/{timeline-definition-BDJGKUSR-CtwXxKAC.js → timeline-definition-BDJGKUSR-C8wsYt9c.js} +1 -1
  60. package/out/renderer/assets/use-agent-like-mutation-DdWy2oKh.js +1 -0
  61. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-BUx2vked.js → xychartDiagram-VJFVF3MP-pTqLOs-T.js} +1 -1
  62. package/out/renderer/index.html +3 -3
  63. package/out/renderer/installer.html +3 -3
  64. package/package.json +6 -5
  65. package/out/renderer/assets/agents-page-cq-zLmOE.js +0 -18
  66. package/out/renderer/assets/channel-Dy-Y0W96.js +0 -1
  67. package/out/renderer/assets/classDiagram-GIVACNV2-BZfvXxWD.js +0 -1
  68. package/out/renderer/assets/classDiagram-v2-COTLJTTW-BZfvXxWD.js +0 -1
  69. package/out/renderer/assets/clone-Dd3fQGFQ.js +0 -1
  70. package/out/renderer/assets/icon-CtRkDz9c.css +0 -1
  71. package/out/renderer/assets/settings-section-yqdH5CNp.js +0 -6
  72. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-CEzipxL2.js +0 -1
  73. package/out/renderer/assets/use-agent-like-mutation-f9aYefiU.js +0 -1
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Restore the setuid bit on Electron's chrome-sandbox helper after install.
5
+ *
6
+ * npm strips setuid bits from package contents by design, so the helper lands
7
+ * root:root 0755 and Chromium aborts for a non-root user (issue #91). We fix it
8
+ * here because `sudo npm install -g` — the ordinary way to install a global CLI
9
+ * — runs this script as root, which is the one moment in the lifecycle where we
10
+ * hold the privilege the fix needs.
11
+ *
12
+ * THIS SCRIPT MUST NEVER FAIL THE INSTALL. An unprivileged `npm install -g`
13
+ * (prefix in $HOME), a container without CAP_CHOWN, macOS and Windows where the
14
+ * helper does not exist, and an install where the optional Electron download was
15
+ * skipped are all normal situations in which the repair cannot happen. Leaving
16
+ * the user with no package at all would be a worse defect than the one being
17
+ * fixed, so every failure path exits 0. Where the repair does not happen, the
18
+ * launcher's post-mortem guidance (bin/local-operator-ui.js) covers it with the
19
+ * exact commands.
20
+ *
21
+ * It is quiet on success for the same reason npm scripts generally are: the
22
+ * common case is a working install and noise there trains people to ignore it.
23
+ */
24
+
25
+ const process = require("node:process");
26
+
27
+ // Silence is the contract on non-Linux: the helper is a Linux-only artifact, so
28
+ // there is nothing to repair and nothing worth printing on a Mac.
29
+ //
30
+ // LOCAL_OPERATOR_UI_FORCE_POSTINSTALL exists so the test suite can reach the
31
+ // repair path on a macOS developer machine and on CI's ubuntu runner alike.
32
+ // Without it the only assertion this script's test could make on darwin was
33
+ // "exit 0", which it satisfies by returning here before doing anything -- a
34
+ // vacuous test that passed while the whole body was mutated away. It is read
35
+ // only, never written by us, and namespaced so it cannot be set by accident.
36
+ if (
37
+ process.platform !== "linux" &&
38
+ process.env.LOCAL_OPERATOR_UI_FORCE_POSTINSTALL !== "1"
39
+ ) {
40
+ process.exit(0);
41
+ }
42
+
43
+ const main = () => {
44
+ const path = require("node:path");
45
+ const {
46
+ ensureElectronDist,
47
+ repairSandboxHelper,
48
+ } = require("./linux-sandbox.js");
49
+
50
+ // Do NOT resolve the helper through require("electron"). npm runs this script
51
+ // BEFORE electron's own postinstall downloads dist/, so at this point that
52
+ // call throws and the helper does not exist yet. ensureElectronDist() drives
53
+ // electron's installer first; see the long note on it for the measurements.
54
+ const packageRoot = path.join(__dirname, "..");
55
+ if (!ensureElectronDist(packageRoot)) {
56
+ // No Electron to repair: optional install skipped, or the download failed.
57
+ // The launcher reports that case with its own guidance.
58
+ return;
59
+ }
60
+
61
+ const helper = path.join(
62
+ packageRoot,
63
+ "node_modules",
64
+ "electron",
65
+ "dist",
66
+ "chrome-sandbox",
67
+ );
68
+ const result = repairSandboxHelper(helper);
69
+
70
+ if (result.outcome === "unsafe") {
71
+ // The helper path is a symlink or not a regular file. We refuse to chown
72
+ // and chmod 4755 through it as root -- that would apply the setuid bit to
73
+ // whatever the link points at (see the O_NOFOLLOW note in linux-sandbox.js).
74
+ // Say so loudly: this is not a normal install state, and it is the one case
75
+ // here that warrants suspicion rather than a shrug.
76
+ console.log(
77
+ "local-operator-ui: refusing to modify the Chromium sandbox helper" +
78
+ " because it is not a regular file (possible symlink). Nothing was" +
79
+ " changed. Please report this.",
80
+ );
81
+ return;
82
+ }
83
+
84
+ if (result.outcome === "not-permitted") {
85
+ // Distinguish the two ways this branch is reached. An unprivileged install
86
+ // genuinely cannot chown, and that is expected. Reaching it AS ROOT means
87
+ // the repair itself is broken -- which is exactly what a chmod-before-chown
88
+ // ordering bug produces, since chown clears the setuid bit again -- and
89
+ // reporting that as "not running as root" would send the reader to
90
+ // diagnose their permissions instead of our code.
91
+ const asRoot =
92
+ typeof process.getuid === "function" && process.getuid() === 0;
93
+ if (asRoot) {
94
+ console.log(
95
+ "local-operator-ui: the Chromium sandbox helper is still not setuid" +
96
+ " after running as root; this is a packaging defect, please report it.",
97
+ );
98
+ } else {
99
+ console.log(
100
+ "local-operator-ui: could not set the Chromium sandbox helper setuid" +
101
+ " (this install is not running as root).",
102
+ );
103
+ }
104
+ console.log(
105
+ "If the app fails to start on Linux, it will print the exact commands to fix it.",
106
+ );
107
+ }
108
+ };
109
+
110
+ try {
111
+ main();
112
+ } catch (err) {
113
+ // Defensive: nothing above is expected to throw, and if something does the
114
+ // install must still succeed. See the header.
115
+ console.log(
116
+ `local-operator-ui: skipped the Chromium sandbox check (${err.message}).`,
117
+ );
118
+ }
119
+
120
+ process.exit(0);
package/out/main/index.js CHANGED
@@ -95,7 +95,7 @@ async function requestDesktopMedia(input, bytes, backendUrl, token) {
95
95
  if (bytes && bytes.byteLength > MAX_UPLOAD_BYTES) {
96
96
  return { status: 413, kind: "error", detail: "This file is too large." };
97
97
  }
98
- const target = endpoint(request);
98
+ const target2 = endpoint(request);
99
99
  let body;
100
100
  let contentType;
101
101
  if (request.op === "agent.export") {
@@ -120,8 +120,8 @@ async function requestDesktopMedia(input, bytes, backendUrl, token) {
120
120
  body = form;
121
121
  }
122
122
  try {
123
- const response = await fetch(new URL(target.path, backendUrl), {
124
- method: target.method,
123
+ const response = await fetch(new URL(target2.path, backendUrl), {
124
+ method: target2.method,
125
125
  headers: {
126
126
  Accept: "application/json, audio/*, application/octet-stream",
127
127
  ...contentType ? { "Content-Type": contentType } : {},
@@ -311,6 +311,34 @@ const sessionImage = zod.z.object({
311
311
  data_b64: zod.z.string().min(1).max(1e6),
312
312
  mime_type: zod.z.enum(["image/png", "image/jpeg", "image/gif", "image/webp"])
313
313
  }).strict();
314
+ const profileName = zod.z.string().min(1).max(128).refine(
315
+ (name) => name !== "." && name !== ".." && !name.includes("/") && !name.includes("\\") && [...name].every(
316
+ (character) => character.charCodeAt(0) >= 32 && character.charCodeAt(0) !== 127
317
+ )
318
+ );
319
+ const target = zod.z.object({ kind: zod.z.enum(["agent", "team"]), name: profileName }).strict();
320
+ const profileFields = zod.z.object({
321
+ kind: zod.z.enum(["role", "specialist"]).optional(),
322
+ description: zod.z.string().max(8e3).optional(),
323
+ instructions: zod.z.string().max(8e3).optional(),
324
+ tools: zod.z.array(zod.z.string().min(1).max(128)).max(256).optional(),
325
+ effort: zod.z.string().max(64).optional(),
326
+ delegate: zod.z.boolean().optional()
327
+ }).strict();
328
+ const teamFields = zod.z.object({
329
+ name: zod.z.string().min(1).max(64).optional(),
330
+ description: zod.z.string().max(8e3).optional(),
331
+ manager: profileName.optional(),
332
+ members: zod.z.array(
333
+ zod.z.object({
334
+ role: profileName,
335
+ count: zod.z.number().int().min(1).max(16),
336
+ kind: zod.z.enum(["agent", "team"])
337
+ }).strict()
338
+ ).max(128).optional(),
339
+ instructions: zod.z.string().max(8e3).optional(),
340
+ project: zod.z.string().max(8e3).optional()
341
+ }).strict();
314
342
  const chains = zod.z.record(zod.z.array(zod.z.string().max(1024)).max(100));
315
343
  const scheduleUnit = zod.z.enum(["minutes", "hours", "days"]);
316
344
  const variableKey = zod.z.string().min(1).max(128).regex(/^[a-zA-Z0-9_-]+$/);
@@ -330,6 +358,37 @@ const configUpdate = zod.z.object({
330
358
  }).strict();
331
359
  const desktopRequestSchema = zod.z.discriminatedUnion("op", [
332
360
  zod.z.object({ op: zod.z.literal("capabilities") }).strict(),
361
+ zod.z.object({ op: zod.z.literal("profiles.list") }).strict(),
362
+ zod.z.object({ op: zod.z.literal("profiles.get"), name: profileName }).strict(),
363
+ zod.z.object({ op: zod.z.literal("profiles.install"), name: profileName, requestId }).strict(),
364
+ zod.z.object({
365
+ op: zod.z.literal("profiles.create"),
366
+ name: profileName,
367
+ requestId,
368
+ fields: profileFields.extend({
369
+ description: zod.z.string().max(8e3),
370
+ instructions: zod.z.string().min(1).max(8e3)
371
+ })
372
+ }).strict(),
373
+ zod.z.object({
374
+ op: zod.z.literal("profiles.update"),
375
+ name: profileName,
376
+ requestId,
377
+ fields: profileFields
378
+ }).strict(),
379
+ zod.z.object({ op: zod.z.literal("teams.list") }).strict(),
380
+ zod.z.object({ op: zod.z.literal("teams.get"), name: profileName }).strict(),
381
+ zod.z.object({
382
+ op: zod.z.literal("teams.create"),
383
+ requestId,
384
+ fields: teamFields.extend({ name: zod.z.string().min(1).max(64) })
385
+ }).strict(),
386
+ zod.z.object({
387
+ op: zod.z.literal("teams.update"),
388
+ name: profileName,
389
+ requestId,
390
+ fields: teamFields
391
+ }).strict(),
333
392
  zod.z.object({
334
393
  op: zod.z.literal("sessions.list"),
335
394
  limit: zod.z.number().int().min(1).max(500).optional()
@@ -337,7 +396,8 @@ const desktopRequestSchema = zod.z.discriminatedUnion("op", [
337
396
  zod.z.object({
338
397
  op: zod.z.literal("sessions.create"),
339
398
  requestId,
340
- cwd: zod.z.string().min(1).max(4096)
399
+ cwd: zod.z.string().min(1).max(4096),
400
+ target: target.optional()
341
401
  }).strict(),
342
402
  zod.z.object({ op: zod.z.literal("sessions.get"), sessionId }).strict(),
343
403
  zod.z.object({
@@ -690,6 +750,54 @@ function desktopEndpoint(request) {
690
750
  switch (request.op) {
691
751
  case "capabilities":
692
752
  return { path: "/v1/capabilities", method: "GET" };
753
+ case "profiles.list":
754
+ return { path: "/v1/desktop/profiles", method: "GET" };
755
+ case "profiles.get":
756
+ return {
757
+ path: `/v1/desktop/profiles/${encodeURIComponent(request.name)}`,
758
+ method: "GET"
759
+ };
760
+ case "profiles.install":
761
+ return {
762
+ path: "/v1/desktop/profiles/install",
763
+ method: "POST",
764
+ body: { request_id: request.requestId, name: request.name }
765
+ };
766
+ case "profiles.create":
767
+ return {
768
+ path: "/v1/desktop/profiles",
769
+ method: "POST",
770
+ body: {
771
+ request_id: request.requestId,
772
+ name: request.name,
773
+ ...request.fields
774
+ }
775
+ };
776
+ case "profiles.update":
777
+ return {
778
+ path: `/v1/desktop/profiles/${encodeURIComponent(request.name)}`,
779
+ method: "PATCH",
780
+ body: { request_id: request.requestId, ...request.fields }
781
+ };
782
+ case "teams.list":
783
+ return { path: "/v1/desktop/teams", method: "GET" };
784
+ case "teams.get":
785
+ return {
786
+ path: `/v1/desktop/teams/${encodeURIComponent(request.name)}`,
787
+ method: "GET"
788
+ };
789
+ case "teams.create":
790
+ return {
791
+ path: "/v1/desktop/teams",
792
+ method: "POST",
793
+ body: { request_id: request.requestId, ...request.fields }
794
+ };
795
+ case "teams.update":
796
+ return {
797
+ path: `/v1/desktop/teams/${encodeURIComponent(request.name)}`,
798
+ method: "PATCH",
799
+ body: { request_id: request.requestId, ...request.fields }
800
+ };
693
801
  case "sessions.list":
694
802
  return {
695
803
  path: `/v1/desktop/sessions?limit=${request.limit ?? 100}`,
@@ -699,7 +807,11 @@ function desktopEndpoint(request) {
699
807
  return {
700
808
  path: "/v1/desktop/sessions",
701
809
  method: "POST",
702
- body: { request_id: request.requestId, cwd: request.cwd }
810
+ body: {
811
+ request_id: request.requestId,
812
+ cwd: request.cwd,
813
+ ...request.target ? { target: request.target } : {}
814
+ }
703
815
  };
704
816
  case "sessions.get":
705
817
  return {
@@ -1099,17 +1211,17 @@ async function requestDesktop(input, backendUrl, token) {
1099
1211
  }
1100
1212
  };
1101
1213
  }
1102
- const target = desktopEndpoint(request);
1214
+ const target2 = desktopEndpoint(request);
1103
1215
  try {
1104
- const body = target.body === void 0 ? void 0 : JSON.stringify(target.body);
1216
+ const body = target2.body === void 0 ? void 0 : JSON.stringify(target2.body);
1105
1217
  if (body && Buffer.byteLength(body) > 262144) {
1106
1218
  return {
1107
1219
  status: 413,
1108
1220
  body: { detail: "This desktop request is too large." }
1109
1221
  };
1110
1222
  }
1111
- const response = await fetch(new URL(target.path, backendUrl), {
1112
- method: target.method,
1223
+ const response = await fetch(new URL(target2.path, backendUrl), {
1224
+ method: target2.method,
1113
1225
  headers: {
1114
1226
  Accept: "application/json",
1115
1227
  ...body ? { "Content-Type": "application/json" } : {},
@@ -3725,19 +3837,19 @@ function registerDesktopIPC(window, expectedUrl, request, streams, media, notifi
3725
3837
  }
3726
3838
  const response = await request({ op: "auth.status", id: operationId });
3727
3839
  const result = response.body;
3728
- const target = result?.result?.auth_url;
3729
- if (response.status !== 200 || typeof target !== "string")
3840
+ const target2 = result?.result?.auth_url;
3841
+ if (response.status !== 200 || typeof target2 !== "string")
3730
3842
  throw new Error("This sign-in is no longer waiting for a browser.");
3731
- const url = new URL(target);
3843
+ const url = new URL(target2);
3732
3844
  if (url.username || url.password || url.protocol !== "https:" && !(url.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(url.hostname))) {
3733
3845
  throw new Error("The provider returned an invalid sign-in address.");
3734
3846
  }
3735
- if (!reopen && opened.get(operationId) === target) return;
3736
- opened.set(operationId, target);
3847
+ if (!reopen && opened.get(operationId) === target2) return;
3848
+ opened.set(operationId, target2);
3737
3849
  while (opened.size > 32)
3738
3850
  opened.delete(opened.keys().next().value);
3739
3851
  try {
3740
- await electron.shell.openExternal(target);
3852
+ await electron.shell.openExternal(target2);
3741
3853
  } catch {
3742
3854
  opened.delete(operationId);
3743
3855
  throw new Error("The sign-in page could not be opened. Try again.");
@@ -3869,12 +3981,12 @@ class DesktopNotifier {
3869
3981
  silent: false
3870
3982
  });
3871
3983
  notification.on("click", () => {
3872
- const target = this.window();
3873
- if (!target) return;
3874
- if (target.isMinimized()) target.restore();
3875
- target.show();
3876
- target.focus();
3877
- target.webContents.send("desktop-open-conversation", { sessionId: sessionId2 });
3984
+ const target2 = this.window();
3985
+ if (!target2) return;
3986
+ if (target2.isMinimized()) target2.restore();
3987
+ target2.show();
3988
+ target2.focus();
3989
+ target2.webContents.send("desktop-open-conversation", { sessionId: sessionId2 });
3878
3990
  });
3879
3991
  notification.show();
3880
3992
  }
@@ -1 +1 @@
1
- import{e as o,c as b,g as v,k as O,h as P,j as p,l as w,m as A,n as x,t as c,o as N}from"./_baseUniq-t3IzOokH.js";import{as as g,aa as y,at as E,au as F,av as M,aw as I,ax as _,ay as $,az as B,aA as T}from"./mermaid.core-CExbFl-7.js";var S=/\s/;function z(n){for(var r=n.length;r--&&S.test(n.charAt(r)););return r}var G=/^\s+/;function H(n){return n&&n.slice(0,z(n)+1).replace(G,"")}var m=NaN,L=/^[-+]0x[0-9a-f]+$/i,R=/^0b[01]+$/i,q=/^0o[0-7]+$/i,C=parseInt;function K(n){if(typeof n=="number")return n;if(o(n))return m;if(g(n)){var r=typeof n.valueOf=="function"?n.valueOf():n;n=g(r)?r+"":r}if(typeof n!="string")return n===0?n:+n;n=H(n);var t=R.test(n);return t||q.test(n)?C(n.slice(2),t?2:8):L.test(n)?m:+n}var W=1/0,X=17976931348623157e292;function Y(n){if(!n)return n===0?n:0;if(n=K(n),n===W||n===-1/0){var r=n<0?-1:1;return r*X}return n===n?n:0}function D(n){var r=Y(n),t=r%1;return r===r?t?r-t:r:0}function fn(n){var r=n==null?0:n.length;return r?b(n):[]}var l=Object.prototype,J=l.hasOwnProperty,dn=y(function(n,r){n=Object(n);var t=-1,e=r.length,a=e>2?r[2]:void 0;for(a&&E(r[0],r[1],a)&&(e=1);++t<e;)for(var f=r[t],i=F(f),s=-1,d=i.length;++s<d;){var u=i[s],h=n[u];(h===void 0||M(h,l[u])&&!J.call(n,u))&&(n[u]=f[u])}return n});function un(n){var r=n==null?0:n.length;return r?n[r-1]:void 0}function Q(n){return function(r,t,e){var a=Object(r);if(!I(r)){var f=v(t);r=O(r),t=function(s){return f(a[s],s,a)}}var i=n(r,t,e);return i>-1?a[f?r[i]:i]:void 0}}var U=Math.max;function Z(n,r,t){var e=n==null?0:n.length;if(!e)return-1;var a=t==null?0:D(t);return a<0&&(a=U(e+a,0)),P(n,v(r),a)}var hn=Q(Z);function V(n,r){var t=-1,e=I(n)?Array(n.length):[];return p(n,function(a,f,i){e[++t]=r(a,f,i)}),e}function gn(n,r){var t=_(n)?w:V;return t(n,v(r))}var j=Object.prototype,k=j.hasOwnProperty;function nn(n,r){return n!=null&&k.call(n,r)}function vn(n,r){return n!=null&&A(n,r,nn)}function rn(n,r){return n<r}function tn(n,r,t){for(var e=-1,a=n.length;++e<a;){var f=n[e],i=r(f);if(i!=null&&(s===void 0?i===i&&!o(i):t(i,s)))var s=i,d=f}return d}function mn(n){return n&&n.length?tn(n,$,rn):void 0}function an(n,r,t,e){if(!g(n))return n;r=x(r,n);for(var a=-1,f=r.length,i=f-1,s=n;s!=null&&++a<f;){var d=c(r[a]),u=t;if(d==="__proto__"||d==="constructor"||d==="prototype")return n;if(a!=i){var h=s[d];u=void 0,u===void 0&&(u=g(h)?h:B(r[a+1])?[]:{})}T(s,d,u),s=s[d]}return n}function on(n,r,t){for(var e=-1,a=r.length,f={};++e<a;){var i=r[e],s=N(n,i);t(s,i)&&an(f,x(i,n),s)}return f}export{rn as a,tn as b,V as c,on as d,mn as e,fn as f,hn as g,vn as h,dn as i,D as j,un as l,gn as m,Y as t};
1
+ import{e as o,c as b,g as v,k as O,h as P,j as p,l as w,m as A,n as x,t as c,o as N}from"./_baseUniq-BnazTPmS.js";import{as as g,aa as y,at as E,au as F,av as M,aw as I,ax as _,ay as $,az as B,aA as T}from"./mermaid.core-1bIbhsqM.js";var S=/\s/;function z(n){for(var r=n.length;r--&&S.test(n.charAt(r)););return r}var G=/^\s+/;function H(n){return n&&n.slice(0,z(n)+1).replace(G,"")}var m=NaN,L=/^[-+]0x[0-9a-f]+$/i,R=/^0b[01]+$/i,q=/^0o[0-7]+$/i,C=parseInt;function K(n){if(typeof n=="number")return n;if(o(n))return m;if(g(n)){var r=typeof n.valueOf=="function"?n.valueOf():n;n=g(r)?r+"":r}if(typeof n!="string")return n===0?n:+n;n=H(n);var t=R.test(n);return t||q.test(n)?C(n.slice(2),t?2:8):L.test(n)?m:+n}var W=1/0,X=17976931348623157e292;function Y(n){if(!n)return n===0?n:0;if(n=K(n),n===W||n===-1/0){var r=n<0?-1:1;return r*X}return n===n?n:0}function D(n){var r=Y(n),t=r%1;return r===r?t?r-t:r:0}function fn(n){var r=n==null?0:n.length;return r?b(n):[]}var l=Object.prototype,J=l.hasOwnProperty,dn=y(function(n,r){n=Object(n);var t=-1,e=r.length,a=e>2?r[2]:void 0;for(a&&E(r[0],r[1],a)&&(e=1);++t<e;)for(var f=r[t],i=F(f),s=-1,d=i.length;++s<d;){var u=i[s],h=n[u];(h===void 0||M(h,l[u])&&!J.call(n,u))&&(n[u]=f[u])}return n});function un(n){var r=n==null?0:n.length;return r?n[r-1]:void 0}function Q(n){return function(r,t,e){var a=Object(r);if(!I(r)){var f=v(t);r=O(r),t=function(s){return f(a[s],s,a)}}var i=n(r,t,e);return i>-1?a[f?r[i]:i]:void 0}}var U=Math.max;function Z(n,r,t){var e=n==null?0:n.length;if(!e)return-1;var a=t==null?0:D(t);return a<0&&(a=U(e+a,0)),P(n,v(r),a)}var hn=Q(Z);function V(n,r){var t=-1,e=I(n)?Array(n.length):[];return p(n,function(a,f,i){e[++t]=r(a,f,i)}),e}function gn(n,r){var t=_(n)?w:V;return t(n,v(r))}var j=Object.prototype,k=j.hasOwnProperty;function nn(n,r){return n!=null&&k.call(n,r)}function vn(n,r){return n!=null&&A(n,r,nn)}function rn(n,r){return n<r}function tn(n,r,t){for(var e=-1,a=n.length;++e<a;){var f=n[e],i=r(f);if(i!=null&&(s===void 0?i===i&&!o(i):t(i,s)))var s=i,d=f}return d}function mn(n){return n&&n.length?tn(n,$,rn):void 0}function an(n,r,t,e){if(!g(n))return n;r=x(r,n);for(var a=-1,f=r.length,i=f-1,s=n;s!=null&&++a<f;){var d=c(r[a]),u=t;if(d==="__proto__"||d==="constructor"||d==="prototype")return n;if(a!=i){var h=s[d];u=void 0,u===void 0&&(u=g(h)?h:B(r[a+1])?[]:{})}T(s,d,u),s=s[d]}return n}function on(n,r,t){for(var e=-1,a=r.length,f={};++e<a;){var i=r[e],s=N(n,i);t(s,i)&&an(f,x(i,n),s)}return f}export{rn as a,tn as b,V as c,on as d,mn as e,fn as f,hn as g,vn as h,dn as i,D as j,un as l,gn as m,Y as t};
@@ -1 +1 @@
1
- import{aH as S,aI as Rn,ax as T,aJ as w,aK as xn,aL as Mn,aw as sn,aM as mn,aN as un,aO as x,au as U,aP as Cn,aQ as on,aR as Fn,aS as E,aF as gn,aT as R,as as ln,aU as Dn,aV as D,aW as Gn,aX as Un,aY as _,aA as Nn,aZ as Bn,av as Kn,a_ as X,a$ as Hn,b0 as jn,az as Yn,ay as cn,aD as Zn,b1 as m}from"./mermaid.core-CExbFl-7.js";var qn="[object Symbol]";function N(n){return typeof n=="symbol"||S(n)&&Rn(n)==qn}function dn(n,r){for(var e=-1,t=n==null?0:n.length,a=Array(t);++e<t;)a[e]=r(n[e],e,n);return a}var J=w?w.prototype:void 0,Q=J?J.toString:void 0;function pn(n){if(typeof n=="string")return n;if(T(n))return dn(n,pn)+"";if(N(n))return Q?Q.call(n):"";var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function Xn(){}function An(n,r){for(var e=-1,t=n==null?0:n.length;++e<t&&r(n[e],e,n)!==!1;);return n}function Jn(n,r,e,t){for(var a=n.length,i=e+-1;++i<a;)if(r(n[i],i,n))return i;return-1}function Qn(n){return n!==n}function Wn(n,r,e){for(var t=e-1,a=n.length;++t<a;)if(n[t]===r)return t;return-1}function zn(n,r,e){return r===r?Wn(n,r,e):Jn(n,Qn,e)}function Vn(n,r){var e=n==null?0:n.length;return!!e&&zn(n,r,0)>-1}function $(n){return sn(n)?xn(n):Mn(n)}var kn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nr=/^\w*$/;function B(n,r){if(T(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||N(n)?!0:nr.test(n)||!kn.test(n)||r!=null&&n in Object(r)}var rr=500;function er(n){var r=mn(n,function(t){return e.size===rr&&e.clear(),t}),e=r.cache;return r}var tr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ir=/\\(\\)?/g,ar=er(function(n){var r=[];return n.charCodeAt(0)===46&&r.push(""),n.replace(tr,function(e,t,a,i){r.push(a?i.replace(ir,"$1"):t||e)}),r});function fr(n){return n==null?"":pn(n)}function yn(n,r){return T(n)?n:B(n,r)?[n]:ar(fr(n))}function M(n){if(typeof n=="string"||N(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function bn(n,r){r=yn(r,n);for(var e=0,t=r.length;n!=null&&e<t;)n=n[M(r[e++])];return e&&e==t?n:void 0}function sr(n,r,e){var t=n==null?void 0:bn(n,r);return t===void 0?e:t}function K(n,r){for(var e=-1,t=r.length,a=n.length;++e<t;)n[a+e]=r[e];return n}var W=w?w.isConcatSpreadable:void 0;function ur(n){return T(n)||un(n)||!!(W&&n&&n[W])}function Ot(n,r,e,t,a){var i=-1,f=n.length;for(e||(e=ur),a||(a=[]);++i<f;){var s=n[i];e(s)?K(a,s):t||(a[a.length]=s)}return a}function or(n,r,e,t){var a=-1,i=n==null?0:n.length;for(t&&i&&(e=n[++a]);++a<i;)e=r(e,n[a],a,n);return e}function gr(n,r){return n&&x(r,$(r),n)}function lr(n,r){return n&&x(r,U(r),n)}function Tn(n,r){for(var e=-1,t=n==null?0:n.length,a=0,i=[];++e<t;){var f=n[e];r(f,e,n)&&(i[a++]=f)}return i}function hn(){return[]}var cr=Object.prototype,dr=cr.propertyIsEnumerable,z=Object.getOwnPropertySymbols,H=z?function(n){return n==null?[]:(n=Object(n),Tn(z(n),function(r){return dr.call(n,r)}))}:hn;function pr(n,r){return x(n,H(n),r)}var Ar=Object.getOwnPropertySymbols,wn=Ar?function(n){for(var r=[];n;)K(r,H(n)),n=Cn(n);return r}:hn;function yr(n,r){return x(n,wn(n),r)}function On(n,r,e){var t=r(n);return T(n)?t:K(t,e(n))}function G(n){return On(n,$,H)}function br(n){return On(n,U,wn)}var Tr=Object.prototype,hr=Tr.hasOwnProperty;function wr(n){var r=n.length,e=new n.constructor(r);return r&&typeof n[0]=="string"&&hr.call(n,"index")&&(e.index=n.index,e.input=n.input),e}function Or(n,r){var e=r?on(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.byteLength)}var $r=/\w*$/;function _r(n){var r=new n.constructor(n.source,$r.exec(n));return r.lastIndex=n.lastIndex,r}var V=w?w.prototype:void 0,k=V?V.valueOf:void 0;function Sr(n){return k?Object(k.call(n)):{}}var Er="[object Boolean]",Ir="[object Date]",Pr="[object Map]",vr="[object Number]",Lr="[object RegExp]",Rr="[object Set]",xr="[object String]",Mr="[object Symbol]",mr="[object ArrayBuffer]",Cr="[object DataView]",Fr="[object Float32Array]",Dr="[object Float64Array]",Gr="[object Int8Array]",Ur="[object Int16Array]",Nr="[object Int32Array]",Br="[object Uint8Array]",Kr="[object Uint8ClampedArray]",Hr="[object Uint16Array]",jr="[object Uint32Array]";function Yr(n,r,e){var t=n.constructor;switch(r){case mr:return on(n);case Er:case Ir:return new t(+n);case Cr:return Or(n,e);case Fr:case Dr:case Gr:case Ur:case Nr:case Br:case Kr:case Hr:case jr:return Fn(n,e);case Pr:return new t;case vr:case xr:return new t(n);case Lr:return _r(n);case Rr:return new t;case Mr:return Sr(n)}}var Zr="[object Map]";function qr(n){return S(n)&&E(n)==Zr}var nn=R&&R.isMap,Xr=nn?gn(nn):qr,Jr="[object Set]";function Qr(n){return S(n)&&E(n)==Jr}var rn=R&&R.isSet,Wr=rn?gn(rn):Qr,zr=1,Vr=2,kr=4,$n="[object Arguments]",ne="[object Array]",re="[object Boolean]",ee="[object Date]",te="[object Error]",_n="[object Function]",ie="[object GeneratorFunction]",ae="[object Map]",fe="[object Number]",Sn="[object Object]",se="[object RegExp]",ue="[object Set]",oe="[object String]",ge="[object Symbol]",le="[object WeakMap]",ce="[object ArrayBuffer]",de="[object DataView]",pe="[object Float32Array]",Ae="[object Float64Array]",ye="[object Int8Array]",be="[object Int16Array]",Te="[object Int32Array]",he="[object Uint8Array]",we="[object Uint8ClampedArray]",Oe="[object Uint16Array]",$e="[object Uint32Array]",g={};g[$n]=g[ne]=g[ce]=g[de]=g[re]=g[ee]=g[pe]=g[Ae]=g[ye]=g[be]=g[Te]=g[ae]=g[fe]=g[Sn]=g[se]=g[ue]=g[oe]=g[ge]=g[he]=g[we]=g[Oe]=g[$e]=!0;g[te]=g[_n]=g[le]=!1;function C(n,r,e,t,a,i){var f,s=r&zr,u=r&Vr,d=r&kr;if(f!==void 0)return f;if(!ln(n))return n;var l=T(n);if(l){if(f=wr(n),!s)return Dn(n,f)}else{var o=E(n),c=o==_n||o==ie;if(D(n))return Gn(n,s);if(o==Sn||o==$n||c&&!a){if(f=u||c?{}:Un(n),!s)return u?yr(n,lr(f,n)):pr(n,gr(f,n))}else{if(!g[o])return a?n:{};f=Yr(n,o,s)}}i||(i=new _);var h=i.get(n);if(h)return h;i.set(n,f),Wr(n)?n.forEach(function(p){f.add(C(p,r,e,p,n,i))}):Xr(n)&&n.forEach(function(p,A){f.set(A,C(p,r,e,A,n,i))});var y=d?u?br:G:u?U:$,b=l?void 0:y(n);return An(b||n,function(p,A){b&&(A=p,p=n[A]),Nn(f,A,C(p,r,e,A,n,i))}),f}var _e="__lodash_hash_undefined__";function Se(n){return this.__data__.set(n,_e),this}function Ee(n){return this.__data__.has(n)}function I(n){var r=-1,e=n==null?0:n.length;for(this.__data__=new Bn;++r<e;)this.add(n[r])}I.prototype.add=I.prototype.push=Se;I.prototype.has=Ee;function Ie(n,r){for(var e=-1,t=n==null?0:n.length;++e<t;)if(r(n[e],e,n))return!0;return!1}function En(n,r){return n.has(r)}var Pe=1,ve=2;function In(n,r,e,t,a,i){var f=e&Pe,s=n.length,u=r.length;if(s!=u&&!(f&&u>s))return!1;var d=i.get(n),l=i.get(r);if(d&&l)return d==r&&l==n;var o=-1,c=!0,h=e&ve?new I:void 0;for(i.set(n,r),i.set(r,n);++o<s;){var y=n[o],b=r[o];if(t)var p=f?t(b,y,o,r,n,i):t(y,b,o,n,r,i);if(p!==void 0){if(p)continue;c=!1;break}if(h){if(!Ie(r,function(A,O){if(!En(h,O)&&(y===A||a(y,A,e,t,i)))return h.push(O)})){c=!1;break}}else if(!(y===b||a(y,b,e,t,i))){c=!1;break}}return i.delete(n),i.delete(r),c}function Le(n){var r=-1,e=Array(n.size);return n.forEach(function(t,a){e[++r]=[a,t]}),e}function j(n){var r=-1,e=Array(n.size);return n.forEach(function(t){e[++r]=t}),e}var Re=1,xe=2,Me="[object Boolean]",me="[object Date]",Ce="[object Error]",Fe="[object Map]",De="[object Number]",Ge="[object RegExp]",Ue="[object Set]",Ne="[object String]",Be="[object Symbol]",Ke="[object ArrayBuffer]",He="[object DataView]",en=w?w.prototype:void 0,F=en?en.valueOf:void 0;function je(n,r,e,t,a,i,f){switch(e){case He:if(n.byteLength!=r.byteLength||n.byteOffset!=r.byteOffset)return!1;n=n.buffer,r=r.buffer;case Ke:return!(n.byteLength!=r.byteLength||!i(new X(n),new X(r)));case Me:case me:case De:return Kn(+n,+r);case Ce:return n.name==r.name&&n.message==r.message;case Ge:case Ne:return n==r+"";case Fe:var s=Le;case Ue:var u=t&Re;if(s||(s=j),n.size!=r.size&&!u)return!1;var d=f.get(n);if(d)return d==r;t|=xe,f.set(n,r);var l=In(s(n),s(r),t,a,i,f);return f.delete(n),l;case Be:if(F)return F.call(n)==F.call(r)}return!1}var Ye=1,Ze=Object.prototype,qe=Ze.hasOwnProperty;function Xe(n,r,e,t,a,i){var f=e&Ye,s=G(n),u=s.length,d=G(r),l=d.length;if(u!=l&&!f)return!1;for(var o=u;o--;){var c=s[o];if(!(f?c in r:qe.call(r,c)))return!1}var h=i.get(n),y=i.get(r);if(h&&y)return h==r&&y==n;var b=!0;i.set(n,r),i.set(r,n);for(var p=f;++o<u;){c=s[o];var A=n[c],O=r[c];if(t)var q=f?t(O,A,c,r,n,i):t(A,O,c,n,r,i);if(!(q===void 0?A===O||a(A,O,e,t,i):q)){b=!1;break}p||(p=c=="constructor")}if(b&&!p){var P=n.constructor,v=r.constructor;P!=v&&"constructor"in n&&"constructor"in r&&!(typeof P=="function"&&P instanceof P&&typeof v=="function"&&v instanceof v)&&(b=!1)}return i.delete(n),i.delete(r),b}var Je=1,tn="[object Arguments]",an="[object Array]",L="[object Object]",Qe=Object.prototype,fn=Qe.hasOwnProperty;function We(n,r,e,t,a,i){var f=T(n),s=T(r),u=f?an:E(n),d=s?an:E(r);u=u==tn?L:u,d=d==tn?L:d;var l=u==L,o=d==L,c=u==d;if(c&&D(n)){if(!D(r))return!1;f=!0,l=!1}if(c&&!l)return i||(i=new _),f||Hn(n)?In(n,r,e,t,a,i):je(n,r,u,e,t,a,i);if(!(e&Je)){var h=l&&fn.call(n,"__wrapped__"),y=o&&fn.call(r,"__wrapped__");if(h||y){var b=h?n.value():n,p=y?r.value():r;return i||(i=new _),a(b,p,e,t,i)}}return c?(i||(i=new _),Xe(n,r,e,t,a,i)):!1}function Y(n,r,e,t,a){return n===r?!0:n==null||r==null||!S(n)&&!S(r)?n!==n&&r!==r:We(n,r,e,t,Y,a)}var ze=1,Ve=2;function ke(n,r,e,t){var a=e.length,i=a;if(n==null)return!i;for(n=Object(n);a--;){var f=e[a];if(f[2]?f[1]!==n[f[0]]:!(f[0]in n))return!1}for(;++a<i;){f=e[a];var s=f[0],u=n[s],d=f[1];if(f[2]){if(u===void 0&&!(s in n))return!1}else{var l=new _,o;if(!(o===void 0?Y(d,u,ze|Ve,t,l):o))return!1}}return!0}function Pn(n){return n===n&&!ln(n)}function nt(n){for(var r=$(n),e=r.length;e--;){var t=r[e],a=n[t];r[e]=[t,a,Pn(a)]}return r}function vn(n,r){return function(e){return e==null?!1:e[n]===r&&(r!==void 0||n in Object(e))}}function rt(n){var r=nt(n);return r.length==1&&r[0][2]?vn(r[0][0],r[0][1]):function(e){return e===n||ke(e,n,r)}}function et(n,r){return n!=null&&r in Object(n)}function tt(n,r,e){r=yn(r,n);for(var t=-1,a=r.length,i=!1;++t<a;){var f=M(r[t]);if(!(i=n!=null&&e(n,f)))break;n=n[f]}return i||++t!=a?i:(a=n==null?0:n.length,!!a&&jn(a)&&Yn(f,a)&&(T(n)||un(n)))}function it(n,r){return n!=null&&tt(n,r,et)}var at=1,ft=2;function st(n,r){return B(n)&&Pn(r)?vn(M(n),r):function(e){var t=sr(e,n);return t===void 0&&t===r?it(e,n):Y(r,t,at|ft)}}function ut(n){return function(r){return r?.[n]}}function ot(n){return function(r){return bn(r,n)}}function gt(n){return B(n)?ut(M(n)):ot(n)}function Ln(n){return typeof n=="function"?n:n==null?cn:typeof n=="object"?T(n)?st(n[0],n[1]):rt(n):gt(n)}function lt(n,r){return n&&Zn(n,r,$)}function ct(n,r){return function(e,t){if(e==null)return e;if(!sn(e))return n(e,t);for(var a=e.length,i=-1,f=Object(e);++i<a&&t(f[i],i,f)!==!1;);return e}}var Z=ct(lt);function dt(n){return typeof n=="function"?n:cn}function $t(n,r){var e=T(n)?An:Z;return e(n,dt(r))}function pt(n,r){var e=[];return Z(n,function(t,a,i){r(t,a,i)&&e.push(t)}),e}function _t(n,r){var e=T(n)?Tn:pt;return e(n,Ln(r))}function At(n,r){return dn(r,function(e){return n[e]})}function St(n){return n==null?[]:At(n,$(n))}function Et(n){return n===void 0}function yt(n,r,e,t,a){return a(n,function(i,f,s){e=t?(t=!1,i):r(e,i,f,s)}),e}function It(n,r,e){var t=T(n)?or:yt,a=arguments.length<3;return t(n,Ln(r),e,a,Z)}var bt=1/0,Tt=m&&1/j(new m([,-0]))[1]==bt?function(n){return new m(n)}:Xn,ht=200;function Pt(n,r,e){var t=-1,a=Vn,i=n.length,f=!0,s=[],u=s;if(i>=ht){var d=r?null:Tt(n);if(d)return j(d);f=!1,a=En,u=new I}else u=r?[]:s;n:for(;++t<i;){var l=n[t],o=r?r(l):l;if(l=l!==0?l:0,f&&o===o){for(var c=u.length;c--;)if(u[c]===o)continue n;r&&u.push(o),s.push(l)}else a(u,o,e)||(u!==s&&u.push(o),s.push(l))}return s}export{Tn as A,pt as B,Ie as C,Xn as D,I as S,Pt as a,C as b,Ot as c,$t as d,N as e,_t as f,Ln as g,Jn as h,Et as i,Z as j,$ as k,dn as l,tt as m,yn as n,bn as o,dt as p,lt as q,It as r,it as s,M as t,fr as u,St as v,Vn as w,En as x,zn as y,br as z};
1
+ import{aH as S,aI as Rn,ax as T,aJ as w,aK as xn,aL as Mn,aw as sn,aM as mn,aN as un,aO as x,au as U,aP as Cn,aQ as on,aR as Fn,aS as E,aF as gn,aT as R,as as ln,aU as Dn,aV as D,aW as Gn,aX as Un,aY as _,aA as Nn,aZ as Bn,av as Kn,a_ as X,a$ as Hn,b0 as jn,az as Yn,ay as cn,aD as Zn,b1 as m}from"./mermaid.core-1bIbhsqM.js";var qn="[object Symbol]";function N(n){return typeof n=="symbol"||S(n)&&Rn(n)==qn}function dn(n,r){for(var e=-1,t=n==null?0:n.length,a=Array(t);++e<t;)a[e]=r(n[e],e,n);return a}var J=w?w.prototype:void 0,Q=J?J.toString:void 0;function pn(n){if(typeof n=="string")return n;if(T(n))return dn(n,pn)+"";if(N(n))return Q?Q.call(n):"";var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function Xn(){}function An(n,r){for(var e=-1,t=n==null?0:n.length;++e<t&&r(n[e],e,n)!==!1;);return n}function Jn(n,r,e,t){for(var a=n.length,i=e+-1;++i<a;)if(r(n[i],i,n))return i;return-1}function Qn(n){return n!==n}function Wn(n,r,e){for(var t=e-1,a=n.length;++t<a;)if(n[t]===r)return t;return-1}function zn(n,r,e){return r===r?Wn(n,r,e):Jn(n,Qn,e)}function Vn(n,r){var e=n==null?0:n.length;return!!e&&zn(n,r,0)>-1}function $(n){return sn(n)?xn(n):Mn(n)}var kn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nr=/^\w*$/;function B(n,r){if(T(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||N(n)?!0:nr.test(n)||!kn.test(n)||r!=null&&n in Object(r)}var rr=500;function er(n){var r=mn(n,function(t){return e.size===rr&&e.clear(),t}),e=r.cache;return r}var tr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ir=/\\(\\)?/g,ar=er(function(n){var r=[];return n.charCodeAt(0)===46&&r.push(""),n.replace(tr,function(e,t,a,i){r.push(a?i.replace(ir,"$1"):t||e)}),r});function fr(n){return n==null?"":pn(n)}function yn(n,r){return T(n)?n:B(n,r)?[n]:ar(fr(n))}function M(n){if(typeof n=="string"||N(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function bn(n,r){r=yn(r,n);for(var e=0,t=r.length;n!=null&&e<t;)n=n[M(r[e++])];return e&&e==t?n:void 0}function sr(n,r,e){var t=n==null?void 0:bn(n,r);return t===void 0?e:t}function K(n,r){for(var e=-1,t=r.length,a=n.length;++e<t;)n[a+e]=r[e];return n}var W=w?w.isConcatSpreadable:void 0;function ur(n){return T(n)||un(n)||!!(W&&n&&n[W])}function Ot(n,r,e,t,a){var i=-1,f=n.length;for(e||(e=ur),a||(a=[]);++i<f;){var s=n[i];e(s)?K(a,s):t||(a[a.length]=s)}return a}function or(n,r,e,t){var a=-1,i=n==null?0:n.length;for(t&&i&&(e=n[++a]);++a<i;)e=r(e,n[a],a,n);return e}function gr(n,r){return n&&x(r,$(r),n)}function lr(n,r){return n&&x(r,U(r),n)}function Tn(n,r){for(var e=-1,t=n==null?0:n.length,a=0,i=[];++e<t;){var f=n[e];r(f,e,n)&&(i[a++]=f)}return i}function hn(){return[]}var cr=Object.prototype,dr=cr.propertyIsEnumerable,z=Object.getOwnPropertySymbols,H=z?function(n){return n==null?[]:(n=Object(n),Tn(z(n),function(r){return dr.call(n,r)}))}:hn;function pr(n,r){return x(n,H(n),r)}var Ar=Object.getOwnPropertySymbols,wn=Ar?function(n){for(var r=[];n;)K(r,H(n)),n=Cn(n);return r}:hn;function yr(n,r){return x(n,wn(n),r)}function On(n,r,e){var t=r(n);return T(n)?t:K(t,e(n))}function G(n){return On(n,$,H)}function br(n){return On(n,U,wn)}var Tr=Object.prototype,hr=Tr.hasOwnProperty;function wr(n){var r=n.length,e=new n.constructor(r);return r&&typeof n[0]=="string"&&hr.call(n,"index")&&(e.index=n.index,e.input=n.input),e}function Or(n,r){var e=r?on(n.buffer):n.buffer;return new n.constructor(e,n.byteOffset,n.byteLength)}var $r=/\w*$/;function _r(n){var r=new n.constructor(n.source,$r.exec(n));return r.lastIndex=n.lastIndex,r}var V=w?w.prototype:void 0,k=V?V.valueOf:void 0;function Sr(n){return k?Object(k.call(n)):{}}var Er="[object Boolean]",Ir="[object Date]",Pr="[object Map]",vr="[object Number]",Lr="[object RegExp]",Rr="[object Set]",xr="[object String]",Mr="[object Symbol]",mr="[object ArrayBuffer]",Cr="[object DataView]",Fr="[object Float32Array]",Dr="[object Float64Array]",Gr="[object Int8Array]",Ur="[object Int16Array]",Nr="[object Int32Array]",Br="[object Uint8Array]",Kr="[object Uint8ClampedArray]",Hr="[object Uint16Array]",jr="[object Uint32Array]";function Yr(n,r,e){var t=n.constructor;switch(r){case mr:return on(n);case Er:case Ir:return new t(+n);case Cr:return Or(n,e);case Fr:case Dr:case Gr:case Ur:case Nr:case Br:case Kr:case Hr:case jr:return Fn(n,e);case Pr:return new t;case vr:case xr:return new t(n);case Lr:return _r(n);case Rr:return new t;case Mr:return Sr(n)}}var Zr="[object Map]";function qr(n){return S(n)&&E(n)==Zr}var nn=R&&R.isMap,Xr=nn?gn(nn):qr,Jr="[object Set]";function Qr(n){return S(n)&&E(n)==Jr}var rn=R&&R.isSet,Wr=rn?gn(rn):Qr,zr=1,Vr=2,kr=4,$n="[object Arguments]",ne="[object Array]",re="[object Boolean]",ee="[object Date]",te="[object Error]",_n="[object Function]",ie="[object GeneratorFunction]",ae="[object Map]",fe="[object Number]",Sn="[object Object]",se="[object RegExp]",ue="[object Set]",oe="[object String]",ge="[object Symbol]",le="[object WeakMap]",ce="[object ArrayBuffer]",de="[object DataView]",pe="[object Float32Array]",Ae="[object Float64Array]",ye="[object Int8Array]",be="[object Int16Array]",Te="[object Int32Array]",he="[object Uint8Array]",we="[object Uint8ClampedArray]",Oe="[object Uint16Array]",$e="[object Uint32Array]",g={};g[$n]=g[ne]=g[ce]=g[de]=g[re]=g[ee]=g[pe]=g[Ae]=g[ye]=g[be]=g[Te]=g[ae]=g[fe]=g[Sn]=g[se]=g[ue]=g[oe]=g[ge]=g[he]=g[we]=g[Oe]=g[$e]=!0;g[te]=g[_n]=g[le]=!1;function C(n,r,e,t,a,i){var f,s=r&zr,u=r&Vr,d=r&kr;if(f!==void 0)return f;if(!ln(n))return n;var l=T(n);if(l){if(f=wr(n),!s)return Dn(n,f)}else{var o=E(n),c=o==_n||o==ie;if(D(n))return Gn(n,s);if(o==Sn||o==$n||c&&!a){if(f=u||c?{}:Un(n),!s)return u?yr(n,lr(f,n)):pr(n,gr(f,n))}else{if(!g[o])return a?n:{};f=Yr(n,o,s)}}i||(i=new _);var h=i.get(n);if(h)return h;i.set(n,f),Wr(n)?n.forEach(function(p){f.add(C(p,r,e,p,n,i))}):Xr(n)&&n.forEach(function(p,A){f.set(A,C(p,r,e,A,n,i))});var y=d?u?br:G:u?U:$,b=l?void 0:y(n);return An(b||n,function(p,A){b&&(A=p,p=n[A]),Nn(f,A,C(p,r,e,A,n,i))}),f}var _e="__lodash_hash_undefined__";function Se(n){return this.__data__.set(n,_e),this}function Ee(n){return this.__data__.has(n)}function I(n){var r=-1,e=n==null?0:n.length;for(this.__data__=new Bn;++r<e;)this.add(n[r])}I.prototype.add=I.prototype.push=Se;I.prototype.has=Ee;function Ie(n,r){for(var e=-1,t=n==null?0:n.length;++e<t;)if(r(n[e],e,n))return!0;return!1}function En(n,r){return n.has(r)}var Pe=1,ve=2;function In(n,r,e,t,a,i){var f=e&Pe,s=n.length,u=r.length;if(s!=u&&!(f&&u>s))return!1;var d=i.get(n),l=i.get(r);if(d&&l)return d==r&&l==n;var o=-1,c=!0,h=e&ve?new I:void 0;for(i.set(n,r),i.set(r,n);++o<s;){var y=n[o],b=r[o];if(t)var p=f?t(b,y,o,r,n,i):t(y,b,o,n,r,i);if(p!==void 0){if(p)continue;c=!1;break}if(h){if(!Ie(r,function(A,O){if(!En(h,O)&&(y===A||a(y,A,e,t,i)))return h.push(O)})){c=!1;break}}else if(!(y===b||a(y,b,e,t,i))){c=!1;break}}return i.delete(n),i.delete(r),c}function Le(n){var r=-1,e=Array(n.size);return n.forEach(function(t,a){e[++r]=[a,t]}),e}function j(n){var r=-1,e=Array(n.size);return n.forEach(function(t){e[++r]=t}),e}var Re=1,xe=2,Me="[object Boolean]",me="[object Date]",Ce="[object Error]",Fe="[object Map]",De="[object Number]",Ge="[object RegExp]",Ue="[object Set]",Ne="[object String]",Be="[object Symbol]",Ke="[object ArrayBuffer]",He="[object DataView]",en=w?w.prototype:void 0,F=en?en.valueOf:void 0;function je(n,r,e,t,a,i,f){switch(e){case He:if(n.byteLength!=r.byteLength||n.byteOffset!=r.byteOffset)return!1;n=n.buffer,r=r.buffer;case Ke:return!(n.byteLength!=r.byteLength||!i(new X(n),new X(r)));case Me:case me:case De:return Kn(+n,+r);case Ce:return n.name==r.name&&n.message==r.message;case Ge:case Ne:return n==r+"";case Fe:var s=Le;case Ue:var u=t&Re;if(s||(s=j),n.size!=r.size&&!u)return!1;var d=f.get(n);if(d)return d==r;t|=xe,f.set(n,r);var l=In(s(n),s(r),t,a,i,f);return f.delete(n),l;case Be:if(F)return F.call(n)==F.call(r)}return!1}var Ye=1,Ze=Object.prototype,qe=Ze.hasOwnProperty;function Xe(n,r,e,t,a,i){var f=e&Ye,s=G(n),u=s.length,d=G(r),l=d.length;if(u!=l&&!f)return!1;for(var o=u;o--;){var c=s[o];if(!(f?c in r:qe.call(r,c)))return!1}var h=i.get(n),y=i.get(r);if(h&&y)return h==r&&y==n;var b=!0;i.set(n,r),i.set(r,n);for(var p=f;++o<u;){c=s[o];var A=n[c],O=r[c];if(t)var q=f?t(O,A,c,r,n,i):t(A,O,c,n,r,i);if(!(q===void 0?A===O||a(A,O,e,t,i):q)){b=!1;break}p||(p=c=="constructor")}if(b&&!p){var P=n.constructor,v=r.constructor;P!=v&&"constructor"in n&&"constructor"in r&&!(typeof P=="function"&&P instanceof P&&typeof v=="function"&&v instanceof v)&&(b=!1)}return i.delete(n),i.delete(r),b}var Je=1,tn="[object Arguments]",an="[object Array]",L="[object Object]",Qe=Object.prototype,fn=Qe.hasOwnProperty;function We(n,r,e,t,a,i){var f=T(n),s=T(r),u=f?an:E(n),d=s?an:E(r);u=u==tn?L:u,d=d==tn?L:d;var l=u==L,o=d==L,c=u==d;if(c&&D(n)){if(!D(r))return!1;f=!0,l=!1}if(c&&!l)return i||(i=new _),f||Hn(n)?In(n,r,e,t,a,i):je(n,r,u,e,t,a,i);if(!(e&Je)){var h=l&&fn.call(n,"__wrapped__"),y=o&&fn.call(r,"__wrapped__");if(h||y){var b=h?n.value():n,p=y?r.value():r;return i||(i=new _),a(b,p,e,t,i)}}return c?(i||(i=new _),Xe(n,r,e,t,a,i)):!1}function Y(n,r,e,t,a){return n===r?!0:n==null||r==null||!S(n)&&!S(r)?n!==n&&r!==r:We(n,r,e,t,Y,a)}var ze=1,Ve=2;function ke(n,r,e,t){var a=e.length,i=a;if(n==null)return!i;for(n=Object(n);a--;){var f=e[a];if(f[2]?f[1]!==n[f[0]]:!(f[0]in n))return!1}for(;++a<i;){f=e[a];var s=f[0],u=n[s],d=f[1];if(f[2]){if(u===void 0&&!(s in n))return!1}else{var l=new _,o;if(!(o===void 0?Y(d,u,ze|Ve,t,l):o))return!1}}return!0}function Pn(n){return n===n&&!ln(n)}function nt(n){for(var r=$(n),e=r.length;e--;){var t=r[e],a=n[t];r[e]=[t,a,Pn(a)]}return r}function vn(n,r){return function(e){return e==null?!1:e[n]===r&&(r!==void 0||n in Object(e))}}function rt(n){var r=nt(n);return r.length==1&&r[0][2]?vn(r[0][0],r[0][1]):function(e){return e===n||ke(e,n,r)}}function et(n,r){return n!=null&&r in Object(n)}function tt(n,r,e){r=yn(r,n);for(var t=-1,a=r.length,i=!1;++t<a;){var f=M(r[t]);if(!(i=n!=null&&e(n,f)))break;n=n[f]}return i||++t!=a?i:(a=n==null?0:n.length,!!a&&jn(a)&&Yn(f,a)&&(T(n)||un(n)))}function it(n,r){return n!=null&&tt(n,r,et)}var at=1,ft=2;function st(n,r){return B(n)&&Pn(r)?vn(M(n),r):function(e){var t=sr(e,n);return t===void 0&&t===r?it(e,n):Y(r,t,at|ft)}}function ut(n){return function(r){return r?.[n]}}function ot(n){return function(r){return bn(r,n)}}function gt(n){return B(n)?ut(M(n)):ot(n)}function Ln(n){return typeof n=="function"?n:n==null?cn:typeof n=="object"?T(n)?st(n[0],n[1]):rt(n):gt(n)}function lt(n,r){return n&&Zn(n,r,$)}function ct(n,r){return function(e,t){if(e==null)return e;if(!sn(e))return n(e,t);for(var a=e.length,i=-1,f=Object(e);++i<a&&t(f[i],i,f)!==!1;);return e}}var Z=ct(lt);function dt(n){return typeof n=="function"?n:cn}function $t(n,r){var e=T(n)?An:Z;return e(n,dt(r))}function pt(n,r){var e=[];return Z(n,function(t,a,i){r(t,a,i)&&e.push(t)}),e}function _t(n,r){var e=T(n)?Tn:pt;return e(n,Ln(r))}function At(n,r){return dn(r,function(e){return n[e]})}function St(n){return n==null?[]:At(n,$(n))}function Et(n){return n===void 0}function yt(n,r,e,t,a){return a(n,function(i,f,s){e=t?(t=!1,i):r(e,i,f,s)}),e}function It(n,r,e){var t=T(n)?or:yt,a=arguments.length<3;return t(n,Ln(r),e,a,Z)}var bt=1/0,Tt=m&&1/j(new m([,-0]))[1]==bt?function(n){return new m(n)}:Xn,ht=200;function Pt(n,r,e){var t=-1,a=Vn,i=n.length,f=!0,s=[],u=s;if(i>=ht){var d=r?null:Tt(n);if(d)return j(d);f=!1,a=En,u=new I}else u=r?[]:s;n:for(;++t<i;){var l=n[t],o=r?r(l):l;if(l=l!==0?l:0,f&&o===o){for(var c=u.length;c--;)if(u[c]===o)continue n;r&&u.push(o),s.push(l)}else a(u,o,e)||(u!==s&&u.push(o),s.push(l))}return s}export{Tn as A,pt as B,Ie as C,Xn as D,I as S,Pt as a,C as b,Ot as c,$t as d,N as e,_t as f,Ln as g,Jn as h,Et as i,Z as j,$ as k,dn as l,tt as m,yn as n,bn as o,dt as p,lt as q,It as r,it as s,M as t,fr as u,St as v,Vn as w,En as x,zn as y,br as z};
@@ -1,6 +1,11 @@
1
- import{c as H,r as S,j as e,L as J,T as U,B as c,S as L,b as R,A as F,d as q,e as x,X as V,f as j,a as B}from"./icon-BIaTDBQz.js";import{n as $,J as G,q as P,u as f,r as E,K as _,M,O as ee,P as te,Q as se,R as ae,T as I,U as W,V as ne,W as Y,X as ie,Y as re,Z as oe,_ as le,$ as ce,a0 as de,a1 as me,a2 as ue,a3 as xe,a4 as he,a5 as ge,a6 as je,a7 as fe,a8 as O,a9 as ye,aa as pe,ab as be}from"./index-fNnd2qrg.js";import{S as we}from"./square-pen-sK57wlY1.js";import{u as ve,a as Ce,b as Ne,c as Ae}from"./use-agent-like-mutation-f9aYefiU.js";/**
1
+ import{a as $,r as S,j as e,L as Z,T as B,B as c,S as L,b as R,d as F,e as q,f as x,X as G,g as j,c as U}from"./icon-DREivh6T.js";import{g as W,a0 as V,f as E,J as f,M as P,a1 as _,a2 as M,a3 as ee,a4 as te,a5 as se,a6 as ae,a7 as I,a8 as H,a9 as ne,h as Y,aa as ie,ab as re,u as oe,ac as le,ad as ce,ae as de,af as me,B as ue,ag as xe,ah as he,ai as ge,aj as je,ak as O,al as fe,am as ye,an as pe}from"./index-D5Z_uzU-.js";import{S as be}from"./square-pen-C0syRM6p.js";import{u as we,a as ve,b as Ce,c as Ne}from"./use-agent-like-mutation-DdWy2oKh.js";/**
2
2
  * @license lucide-react v0.507.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const ke=[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]],De=H("message-circle",ke),N={all:["agent-comments"],list:t=>[...N.all,"list",t]},Se=({agentId:t,enabled:r=!0})=>$({queryKey:N.list(t||"invalid"),queryFn:async()=>{if(!t)throw new Error("Agent ID is required to fetch comments.");return(await G(t)).result},enabled:!!t&&r,staleTime:2*60*1e3,gcTime:5*60*1e3,refetchOnWindowFocus:!0}),Fe=()=>{const t=P(),{isAuthenticated:r}=f();return E({mutationFn:async a=>{const{agentId:i,data:s}=a;if(!r)throw new Error("Authentication required.");return ee(i,s)},onSuccess:(a,i)=>{t.invalidateQueries({queryKey:N.list(i.agentId)}),M("Comment posted")},onError:a=>{_(`Failed to post comment: ${a.message}`)}})},qe=()=>{const t=P(),{isAuthenticated:r}=f();return E({mutationFn:async a=>{const{agentId:i,commentId:s,data:o}=a;if(!r)throw new Error("Authentication required.");return te(i,s,o)},onSuccess:(a,i)=>{t.invalidateQueries({queryKey:N.list(i.agentId)}),M("Comment updated")},onError:a=>{_(`Failed to update comment: ${a.message}`)}})},Le=()=>{const t=P(),{isAuthenticated:r}=f();return E({mutationFn:async a=>{const{agentId:i,commentId:s}=a;if(!r)throw new Error("Authentication required.");return se(i,s)},onSuccess:(a,i)=>{t.invalidateQueries({queryKey:N.list(i.agentId)}),M("Comment deleted")},onError:a=>{_(`Failed to delete comment: ${a.message}`)}})},Pe=({agentId:t})=>{const{isAuthenticated:r,user:a}=f(),[i,s]=S.useState(""),[o,y]=S.useState(null),[d,m]=S.useState(""),{data:T,isLoading:A,error:p}=Se({agentId:t}),k=T?.records??[],b=Fe(),w=qe(),v=Le(),C=async n=>{if(n.preventDefault(),!(!i.trim()||!r||!t))try{await b.mutateAsync({agentId:t,data:{text:i}}),s("")}catch(l){console.error("Submit comment error caught in component:",l)}},h=(n,l)=>{y(n),m(l)},u=()=>{y(null),m("")},z=async()=>{if(!(!o||!d.trim()||!r||!t))try{await w.mutateAsync({agentId:t,commentId:o,data:{text:d}}),u()}catch(n){console.error("Update comment error caught in component:",n)}},g=async n=>{if(!(!r||!t)&&window.confirm("Are you sure you want to delete this comment?"))try{await v.mutateAsync({agentId:t,commentId:n})}catch(l){console.error("Delete comment error caught in component:",l)}},D=n=>r&&a?.radientUser?.account?.id===n.account_id;return e.jsxs("div",{className:"mt-6",children:[e.jsx("h2",{className:"mb-4 font-semibold text-heading text-ink",children:"Comments"}),r?e.jsxs("div",{className:"mb-4 flex flex-col gap-1.5",children:[e.jsxs(J,{htmlFor:"new-comment",children:[e.jsx(De,{size:14,"aria-hidden":"true"}),"Leave a comment"]}),e.jsxs("form",{onSubmit:C,className:"flex flex-col gap-3",children:[e.jsx(U,{id:"new-comment",placeholder:"Share your thoughts...",rows:3,value:i,onChange:n=>s(n.target.value),required:!0}),e.jsx(c,{type:"submit",variant:"primary",disabled:b.isPending||!i.trim(),className:"self-end",children:b.isPending?e.jsx(L,{size:"sm",label:"Posting comment"}):"Post comment"})]})]}):e.jsx("p",{className:"mt-6 mb-4 text-body-sm text-ink-muted",children:"Sign in to leave comments."}),e.jsx(R,{className:"my-6"}),A&&e.jsx("ul",{className:"flex flex-col",children:[...Array(3)].map((n,l)=>e.jsxs("li",{className:"flex gap-3 pb-6",children:[e.jsx(F,{children:e.jsx(q,{children:e.jsx(x,{className:"size-full"})})}),e.jsxs("div",{className:"flex w-full flex-col gap-1.5",children:[e.jsx(x,{className:"h-3.5 w-24"}),e.jsx(x,{className:"h-3 w-15"}),e.jsx(x,{className:"mt-2 h-3.5 w-full"}),e.jsx(x,{className:"h-3.5 w-4/5"})]})]},`skeleton-${l}`))}),p&&e.jsxs("p",{role:"alert",className:"my-6 text-body-sm text-danger",children:["Failed to load comments: ",p.message]}),!A&&!p&&e.jsx("ul",{className:"flex flex-col gap-6",children:k.length===0?e.jsx("li",{className:"text-body-sm text-ink-muted",children:"No comments yet. Yours would be the first."}):k.map(n=>o===n.id?e.jsxs("li",{className:"flex gap-3",children:[e.jsx(F,{children:e.jsx(q,{children:n.account_metadata?.name?.charAt(0).toUpperCase()||"?"})}),e.jsxs("div",{className:"flex w-full flex-col gap-2",children:[e.jsx(U,{rows:3,value:d,onChange:l=>m(l.target.value),autoFocus:!0,"aria-label":"Edit comment"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(c,{variant:"secondary",size:"sm",onClick:u,children:[e.jsx(V,{}),"Cancel"]}),e.jsxs(c,{variant:"primary",size:"sm",onClick:z,disabled:w.isPending||!d.trim(),children:[w.isPending?e.jsx(L,{size:"xs",label:"Saving comment"}):e.jsx(ae,{}),"Save"]})]})]})]},n.id):e.jsxs("li",{className:"flex gap-3",children:[e.jsx(F,{children:e.jsx(q,{children:n.account_metadata?.name?.charAt(0).toUpperCase()||"?"})}),e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-body text-ink",children:n.account_metadata?.name||"Anonymous"}),e.jsxs("p",{className:"text-ink-muted text-meta",children:[I(new Date(n.created_at))," ","ago"]})]}),D(n)&&e.jsxs("div",{className:"flex gap-0.5",children:[e.jsx(j,{content:"Edit comment",children:e.jsx(c,{variant:"ghost",size:"icon-sm",onClick:()=>h(n.id,n.text),disabled:!!o,"aria-label":"Edit comment",children:e.jsx(we,{})})}),e.jsx(j,{content:"Delete comment",children:e.jsx(c,{variant:"ghost",size:"icon-sm",onClick:()=>g(n.id),disabled:!!o,"aria-label":"Delete comment",children:e.jsx(W,{})})})]})]}),e.jsx("p",{className:"mt-2 text-body-sm text-ink whitespace-pre-wrap",children:n.text})]})]},n.id))})]})},K={all:["agent-details"],detail:t=>[...K.all,t]},Ee=({agentId:t,enabled:r=!0})=>$({queryKey:K.detail(t||"invalid"),queryFn:async()=>{if(!t)throw new Error("Agent ID is required to fetch details.");return await ne(t)},select:i=>i.result,enabled:!!t&&r,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1}),_e=()=>{const t=P(),r=Y(),{isAuthenticated:a}=f();return E({mutationFn:async({agentId:s})=>{if(!a)throw new Error("Authentication required to delist an agent.");if(!s)throw new Error("Agent ID is required to delist.");return re(s)},onSuccess:(s,o)=>{M("Agent delisted"),t.invalidateQueries({queryKey:K.detail(o.agentId)}),t.invalidateQueries({queryKey:ie.list(1,20)}),r("/agent-hub")},onError:s=>{_(`Failed to delist agent: ${s.message}`),console.error("Delist agent error:",s)}})},Q=({children:t})=>e.jsx("span",{className:"inline-flex h-4 min-w-5 items-center text-meta text-ink-muted",children:t}),Ie=()=>{const{agentId:t}=oe(),r=Y(),{isAuthenticated:a,user:i}=f(),{data:s,isLoading:o,error:y}=Ee({agentId:t??"",enabled:!!t}),{isLiked:d}=ve({agentId:t??"",enabled:!!t&&a}),{isFavourited:m}=Ce({agentId:t??"",enabled:!!t&&a}),{data:T,isLoading:A}=le({agentId:t??"",enabled:!!t}),{data:p,isLoading:k}=ce({agentId:t??"",enabled:!!t}),{data:b,isLoading:w}=de({agentId:t??"",enabled:!!t}),v=Ne(),C=Ae(),h=me(),u=_e(),[z,g]=S.useState(!1),D=!!i&&!!s&&i.radientUser?.account?.id===s.account_id,n=()=>{!t||!a||v.isPending||v.mutate({agentId:t,isCurrentlyLiked:d})},l=()=>{!t||!a||C.isPending||C.mutate({agentId:t,isCurrentlyFavourited:m})},X=()=>{!t||!s||h.isPending||h.mutate({agentId:s.id,agentName:s.name})},Z=()=>{r("/agent-hub")};return o?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(L,{label:"Loading agent details"})}):y?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsxs("p",{className:"text-body-sm text-danger",children:["Failed to load agent details: ",y.message]})}):s?e.jsxs("div",{className:"m-6 flex flex-1 flex-col rounded-lg border border-hairline bg-surface p-8",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[e.jsx(c,{variant:"ghost",size:"icon",onClick:Z,"aria-label":"Back to Agent hub",children:e.jsx(ue,{})}),e.jsx(F,{className:"size-11 shrink-0",children:e.jsx(q,{children:e.jsx(xe,{size:22,"aria-hidden":"true"})})}),e.jsx("h1",{className:"truncate text-display text-ink",children:s.name})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsx(j,{content:"Sign in to Radient to use this feature",disabled:a,children:e.jsx("span",{children:e.jsxs(c,{variant:"ghost",size:"sm",onClick:n,disabled:!a||v.isPending,"aria-label":d?"Unlike agent":"Like agent",className:B(d&&"text-danger"),children:[e.jsx(he,{fill:d?"currentColor":"none"}),e.jsx(Q,{children:A?e.jsx(x,{className:"h-3.5 w-5"}):T??0})]})})}),e.jsx(j,{content:"Sign in to Radient to use this feature",disabled:a,children:e.jsx("span",{children:e.jsxs(c,{variant:"ghost",size:"sm",onClick:l,disabled:!a||C.isPending,"aria-label":m?"Unfavourite agent":"Favourite agent",className:B(m&&"text-warning"),children:[e.jsx(ge,{fill:m?"currentColor":"none"}),e.jsx(Q,{children:k?e.jsx(x,{className:"h-3.5 w-5"}):p??0})]})})}),e.jsx(j,{content:"Download agent to your computer",children:e.jsx("span",{children:e.jsxs(c,{variant:"ghost",size:"icon",onClick:X,disabled:h.isPending,"aria-label":"Download agent",className:"ml-1",children:[e.jsx(je,{}),e.jsx(Q,{children:w||h.isPending?e.jsx(x,{className:"h-3.5 w-5"}):b??0})]})})}),D&&e.jsx(j,{content:"Permanently delist this agent from Agent hub",children:e.jsx("span",{children:e.jsx(c,{variant:"ghost",size:"icon",onClick:()=>g(!0),disabled:u.isPending,"aria-label":"Delist agent",className:"ml-1 text-danger hover:bg-danger-wash hover:text-danger",children:e.jsx(W,{})})})})]})]}),e.jsx(fe,{tags:s.tags,categories:s.categories}),e.jsxs("div",{className:"mt-4 mb-6 flex flex-col gap-2 text-body-sm text-ink-muted",children:[e.jsxs("p",{children:["Created by: ",s.account_metadata?.name??"Unknown"," (",s.account_metadata?.email??"No email",")"]}),e.jsxs("p",{children:["Created: ",I(new Date(s.created_at))," ago (",O(s.created_at),")"]}),e.jsxs("p",{children:["Last modified: ",I(new Date(s.updated_at))," ","ago (",O(s.updated_at),")"]})]}),e.jsx("div",{className:"mt-2 mb-8 leading-relaxed text-body text-ink",children:s.description||"No description provided."}),e.jsx(R,{className:"my-6"}),e.jsx(Pe,{agentId:s.id}),e.jsx(ye,{open:z,onClose:()=>g(!1),title:"Delist this agent?",maxWidth:"xs",actions:e.jsxs(e.Fragment,{children:[e.jsx(pe,{onClick:()=>g(!1),children:"Cancel"}),e.jsx(be,{onClick:()=>{!t||!D||u.isPending||(u.mutate({agentId:t}),g(!1))},disabled:u.isPending,children:u.isPending?e.jsx(L,{size:"sm",label:"Delisting agent"}):"Delist"})]}),dialogProps:{"aria-describedby":"delist-dialog-description"},children:e.jsxs("div",{id:"delist-dialog-description",className:"text-body text-ink-muted",children:['This takes "',s.name,'" off the hub straight away, and nobody will be able to download it. You can upload it again later.']})})]}):e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx("p",{className:"text-body text-ink",children:"Agent not found."})})};export{Ie as AgentDetailsPage};
6
+ */const Ae=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ke=$("arrow-left",Ae);/**
7
+ * @license lucide-react v0.507.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const De=[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]],Se=$("message-circle",De),N={all:["agent-comments"],list:t=>[...N.all,"list",t]},Fe=({agentId:t,enabled:r=!0})=>W({queryKey:N.list(t||"invalid"),queryFn:async()=>{if(!t)throw new Error("Agent ID is required to fetch comments.");return(await V(t)).result},enabled:!!t&&r,staleTime:2*60*1e3,gcTime:5*60*1e3,refetchOnWindowFocus:!0}),qe=()=>{const t=E(),{isAuthenticated:r}=f();return P({mutationFn:async a=>{const{agentId:i,data:s}=a;if(!r)throw new Error("Authentication required.");return ee(i,s)},onSuccess:(a,i)=>{t.invalidateQueries({queryKey:N.list(i.agentId)}),M("Comment posted")},onError:a=>{_(`Failed to post comment: ${a.message}`)}})},Le=()=>{const t=E(),{isAuthenticated:r}=f();return P({mutationFn:async a=>{const{agentId:i,commentId:s,data:o}=a;if(!r)throw new Error("Authentication required.");return te(i,s,o)},onSuccess:(a,i)=>{t.invalidateQueries({queryKey:N.list(i.agentId)}),M("Comment updated")},onError:a=>{_(`Failed to update comment: ${a.message}`)}})},Ee=()=>{const t=E(),{isAuthenticated:r}=f();return P({mutationFn:async a=>{const{agentId:i,commentId:s}=a;if(!r)throw new Error("Authentication required.");return se(i,s)},onSuccess:(a,i)=>{t.invalidateQueries({queryKey:N.list(i.agentId)}),M("Comment deleted")},onError:a=>{_(`Failed to delete comment: ${a.message}`)}})},Pe=({agentId:t})=>{const{isAuthenticated:r,user:a}=f(),[i,s]=S.useState(""),[o,y]=S.useState(null),[d,m]=S.useState(""),{data:z,isLoading:A,error:p}=Fe({agentId:t}),k=z?.records??[],b=qe(),w=Le(),v=Ee(),C=async n=>{if(n.preventDefault(),!(!i.trim()||!r||!t))try{await b.mutateAsync({agentId:t,data:{text:i}}),s("")}catch(l){console.error("Submit comment error caught in component:",l)}},h=(n,l)=>{y(n),m(l)},u=()=>{y(null),m("")},T=async()=>{if(!(!o||!d.trim()||!r||!t))try{await w.mutateAsync({agentId:t,commentId:o,data:{text:d}}),u()}catch(n){console.error("Update comment error caught in component:",n)}},g=async n=>{if(!(!r||!t)&&window.confirm("Are you sure you want to delete this comment?"))try{await v.mutateAsync({agentId:t,commentId:n})}catch(l){console.error("Delete comment error caught in component:",l)}},D=n=>r&&a?.radientUser?.account?.id===n.account_id;return e.jsxs("div",{className:"mt-6",children:[e.jsx("h2",{className:"mb-4 font-semibold text-heading text-ink",children:"Comments"}),r?e.jsxs("div",{className:"mb-4 flex flex-col gap-1.5",children:[e.jsxs(Z,{htmlFor:"new-comment",children:[e.jsx(Se,{size:14,"aria-hidden":"true"}),"Leave a comment"]}),e.jsxs("form",{onSubmit:C,className:"flex flex-col gap-3",children:[e.jsx(B,{id:"new-comment",placeholder:"Share your thoughts...",rows:3,value:i,onChange:n=>s(n.target.value),required:!0}),e.jsx(c,{type:"submit",variant:"primary",disabled:b.isPending||!i.trim(),className:"self-end",children:b.isPending?e.jsx(L,{size:"sm",label:"Posting comment"}):"Post comment"})]})]}):e.jsx("p",{className:"mt-6 mb-4 text-body-sm text-ink-muted",children:"Sign in to leave comments."}),e.jsx(R,{className:"my-6"}),A&&e.jsx("ul",{className:"flex flex-col",children:[...Array(3)].map((n,l)=>e.jsxs("li",{className:"flex gap-3 pb-6",children:[e.jsx(F,{children:e.jsx(q,{children:e.jsx(x,{className:"size-full"})})}),e.jsxs("div",{className:"flex w-full flex-col gap-1.5",children:[e.jsx(x,{className:"h-3.5 w-24"}),e.jsx(x,{className:"h-3 w-15"}),e.jsx(x,{className:"mt-2 h-3.5 w-full"}),e.jsx(x,{className:"h-3.5 w-4/5"})]})]},`skeleton-${l}`))}),p&&e.jsxs("p",{role:"alert",className:"my-6 text-body-sm text-danger",children:["Failed to load comments: ",p.message]}),!A&&!p&&e.jsx("ul",{className:"flex flex-col gap-6",children:k.length===0?e.jsx("li",{className:"text-body-sm text-ink-muted",children:"No comments yet. Yours would be the first."}):k.map(n=>o===n.id?e.jsxs("li",{className:"flex gap-3",children:[e.jsx(F,{children:e.jsx(q,{children:n.account_metadata?.name?.charAt(0).toUpperCase()||"?"})}),e.jsxs("div",{className:"flex w-full flex-col gap-2",children:[e.jsx(B,{rows:3,value:d,onChange:l=>m(l.target.value),autoFocus:!0,"aria-label":"Edit comment"}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(c,{variant:"secondary",size:"sm",onClick:u,children:[e.jsx(G,{}),"Cancel"]}),e.jsxs(c,{variant:"primary",size:"sm",onClick:T,disabled:w.isPending||!d.trim(),children:[w.isPending?e.jsx(L,{size:"xs",label:"Saving comment"}):e.jsx(ae,{}),"Save"]})]})]})]},n.id):e.jsxs("li",{className:"flex gap-3",children:[e.jsx(F,{children:e.jsx(q,{children:n.account_metadata?.name?.charAt(0).toUpperCase()||"?"})}),e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-body text-ink",children:n.account_metadata?.name||"Anonymous"}),e.jsxs("p",{className:"text-ink-muted text-meta",children:[I(new Date(n.created_at))," ","ago"]})]}),D(n)&&e.jsxs("div",{className:"flex gap-0.5",children:[e.jsx(j,{content:"Edit comment",children:e.jsx(c,{variant:"ghost",size:"icon-sm",onClick:()=>h(n.id,n.text),disabled:!!o,"aria-label":"Edit comment",children:e.jsx(be,{})})}),e.jsx(j,{content:"Delete comment",children:e.jsx(c,{variant:"ghost",size:"icon-sm",onClick:()=>g(n.id),disabled:!!o,"aria-label":"Delete comment",children:e.jsx(H,{})})})]})]}),e.jsx("p",{className:"mt-2 text-body-sm text-ink whitespace-pre-wrap",children:n.text})]})]},n.id))})]})},K={all:["agent-details"],detail:t=>[...K.all,t]},_e=({agentId:t,enabled:r=!0})=>W({queryKey:K.detail(t||"invalid"),queryFn:async()=>{if(!t)throw new Error("Agent ID is required to fetch details.");return await ne(t)},select:i=>i.result,enabled:!!t&&r,staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1}),Me=()=>{const t=E(),r=Y(),{isAuthenticated:a}=f();return P({mutationFn:async({agentId:s})=>{if(!a)throw new Error("Authentication required to delist an agent.");if(!s)throw new Error("Agent ID is required to delist.");return re(s)},onSuccess:(s,o)=>{M("Agent delisted"),t.invalidateQueries({queryKey:K.detail(o.agentId)}),t.invalidateQueries({queryKey:ie.list(1,20)}),r("/agent-hub")},onError:s=>{_(`Failed to delist agent: ${s.message}`),console.error("Delist agent error:",s)}})},Q=({children:t})=>e.jsx("span",{className:"inline-flex h-4 min-w-5 items-center text-meta text-ink-muted",children:t}),Ke=()=>{const{agentId:t}=oe(),r=Y(),{isAuthenticated:a,user:i}=f(),{data:s,isLoading:o,error:y}=_e({agentId:t??"",enabled:!!t}),{isLiked:d}=we({agentId:t??"",enabled:!!t&&a}),{isFavourited:m}=ve({agentId:t??"",enabled:!!t&&a}),{data:z,isLoading:A}=le({agentId:t??"",enabled:!!t}),{data:p,isLoading:k}=ce({agentId:t??"",enabled:!!t}),{data:b,isLoading:w}=de({agentId:t??"",enabled:!!t}),v=Ce(),C=Ne(),h=me(),u=Me(),[T,g]=S.useState(!1),D=!!i&&!!s&&i.radientUser?.account?.id===s.account_id,n=()=>{!t||!a||v.isPending||v.mutate({agentId:t,isCurrentlyLiked:d})},l=()=>{!t||!a||C.isPending||C.mutate({agentId:t,isCurrentlyFavourited:m})},J=()=>{!t||!s||h.isPending||h.mutate({agentId:s.id,agentName:s.name})},X=()=>{r("/agent-hub")};return o?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(L,{label:"Loading agent details"})}):y?e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsxs("p",{className:"text-body-sm text-danger",children:["Failed to load agent details: ",y.message]})}):s?e.jsxs("div",{className:"m-6 flex flex-1 flex-col rounded-lg border border-hairline bg-surface p-8",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[e.jsx(c,{variant:"ghost",size:"icon",onClick:X,"aria-label":"Back to Agent hub",children:e.jsx(ke,{})}),e.jsx(F,{className:"size-11 shrink-0",children:e.jsx(q,{children:e.jsx(ue,{size:22,"aria-hidden":"true"})})}),e.jsx("h1",{className:"truncate text-display text-ink",children:s.name})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsx(j,{content:"Sign in to Radient to use this feature",disabled:a,children:e.jsx("span",{children:e.jsxs(c,{variant:"ghost",size:"sm",onClick:n,disabled:!a||v.isPending,"aria-label":d?"Unlike agent":"Like agent",className:U(d&&"text-danger"),children:[e.jsx(xe,{fill:d?"currentColor":"none"}),e.jsx(Q,{children:A?e.jsx(x,{className:"h-3.5 w-5"}):z??0})]})})}),e.jsx(j,{content:"Sign in to Radient to use this feature",disabled:a,children:e.jsx("span",{children:e.jsxs(c,{variant:"ghost",size:"sm",onClick:l,disabled:!a||C.isPending,"aria-label":m?"Unfavourite agent":"Favourite agent",className:U(m&&"text-warning"),children:[e.jsx(he,{fill:m?"currentColor":"none"}),e.jsx(Q,{children:k?e.jsx(x,{className:"h-3.5 w-5"}):p??0})]})})}),e.jsx(j,{content:"Download agent to your computer",children:e.jsx("span",{children:e.jsxs(c,{variant:"ghost",size:"icon",onClick:J,disabled:h.isPending,"aria-label":"Download agent",className:"ml-1",children:[e.jsx(ge,{}),e.jsx(Q,{children:w||h.isPending?e.jsx(x,{className:"h-3.5 w-5"}):b??0})]})})}),D&&e.jsx(j,{content:"Permanently delist this agent from Agent hub",children:e.jsx("span",{children:e.jsx(c,{variant:"ghost",size:"icon",onClick:()=>g(!0),disabled:u.isPending,"aria-label":"Delist agent",className:"ml-1 text-danger hover:bg-danger-wash hover:text-danger",children:e.jsx(H,{})})})})]})]}),e.jsx(je,{tags:s.tags,categories:s.categories}),e.jsxs("div",{className:"mt-4 mb-6 flex flex-col gap-2 text-body-sm text-ink-muted",children:[e.jsxs("p",{children:["Created by: ",s.account_metadata?.name??"Unknown"," (",s.account_metadata?.email??"No email",")"]}),e.jsxs("p",{children:["Created: ",I(new Date(s.created_at))," ago (",O(s.created_at),")"]}),e.jsxs("p",{children:["Last modified: ",I(new Date(s.updated_at))," ","ago (",O(s.updated_at),")"]})]}),e.jsx("div",{className:"mt-2 mb-8 leading-relaxed text-body text-ink",children:s.description||"No description provided."}),e.jsx(R,{className:"my-6"}),e.jsx(Pe,{agentId:s.id}),e.jsx(fe,{open:T,onClose:()=>g(!1),title:"Delist this agent?",maxWidth:"xs",actions:e.jsxs(e.Fragment,{children:[e.jsx(ye,{onClick:()=>g(!1),children:"Cancel"}),e.jsx(pe,{onClick:()=>{!t||!D||u.isPending||(u.mutate({agentId:t}),g(!1))},disabled:u.isPending,children:u.isPending?e.jsx(L,{size:"sm",label:"Delisting agent"}):"Delist"})]}),dialogProps:{"aria-describedby":"delist-dialog-description"},children:e.jsxs("div",{id:"delist-dialog-description",className:"text-body text-ink-muted",children:['This takes "',s.name,'" off the hub straight away, and nobody will be able to download it. You can upload it again later.']})})]}):e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx("p",{className:"text-body text-ink",children:"Agent not found."})})};export{Ke as AgentDetailsPage};
@@ -1,11 +1,11 @@
1
- import{c as p,j as e,a as j,r as m,S as y}from"./icon-BIaTDBQz.js";import{u as k,D as v,F as h,G as b,S as A,H as L}from"./index-fNnd2qrg.js";import{P as N}from"./page-header-GWjqQg3-.js";import{u as C,a as P,b as w,c as F}from"./use-agent-like-mutation-f9aYefiU.js";/**
1
+ import{a as p,j as e,c as j,r as m,S as y}from"./icon-DREivh6T.js";import{C as k}from"./compact-pagination-D9Y6NSdy.js";import{P as v}from"./page-header-CtwhpX97.js";import{J as b,X as A,Y as h,Z as L,$ as N}from"./index-D5Z_uzU-.js";import{u as C,a as P,b as w,c as M}from"./use-agent-like-mutation-DdWy2oKh.js";/**
2
2
  * @license lucide-react v0.507.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const M=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]],S=p("circle-ellipsis",M);/**
6
+ */const F=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]],S=p("circle-ellipsis",F);/**
7
7
  * @license lucide-react v0.507.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const I=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],z=p("layers",I),_=({agent:a})=>{const{isAuthenticated:t}=k(),{isLiked:i,isLoading:s}=C({agentId:a.id,enabled:t}),{isFavourited:n,isLoading:l}=P({agentId:a.id,enabled:t}),r=w(),o=F(),c=()=>{!t||s||r.isPending||r.mutate({agentId:a.id,isCurrentlyLiked:i})},u=()=>{!t||l||o.isPending||o.mutate({agentId:a.id,isCurrentlyFavourited:n})},g=s||r.isPending,x=l||o.isPending;return e.jsx(v,{agent:a,isLiked:t?i:!1,isFavourited:t?n:!1,onLikeToggle:c,onFavouriteToggle:u,isLikeActionLoading:g,isFavouriteActionLoading:x,showActions:t})},f=({selected:a,onClick:t,children:i,...s})=>e.jsx("button",{type:"button",onClick:t,"aria-pressed":a,className:j("flex w-full cursor-pointer items-center gap-2.5 rounded-sm px-3 py-1.5 text-left","text-body-sm transition-colors duration-fast ease-out-quart",a?"bg-accent-wash font-semibold text-accent":"text-ink hover:bg-elevated"),...s,children:i}),T=({selectedCategory:a,onSelectCategory:t})=>{const i=Object.keys(h);return e.jsxs("div",{className:"flex h-full flex-col overflow-y-auto",children:[e.jsx("h2",{className:"mb-2 px-3 font-medium text-ink-dim text-meta",children:"Categories"}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs(f,{selected:a===null,onClick:()=>t(null),"data-testid":"category-all",children:[e.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:e.jsx(z,{size:16,"aria-hidden":"true"})}),"All categories"]}),i.map(s=>{const n=h[s],l=s==="other"?e.jsx(S,{size:16}):n.icon;return e.jsxs(f,{selected:a===s,onClick:()=>t(s),"data-testid":`category-${s}`,children:[e.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:l}),n.label]},s)})]})]})},H=()=>{const[a,t]=m.useState(1),[i]=m.useState(12),[s,n]=m.useState(null),{data:l,isLoading:r,error:o,pagination:c}=b({page:a,perPage:i,categories:s?[s]:void 0}),u=l?.records??[],g=d=>{t(d)},x=d=>{n(d),t(1)};return e.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[e.jsx(N,{title:"Agent hub",subtitle:"Discover and download community agents on Radient",icon:A}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-row overflow-hidden",children:[e.jsx("div",{className:"mr-6 hidden w-60 shrink-0 md:block","data-tour-tag":"agent-hub-sidebar-container",children:e.jsx(T,{selectedCategory:s,onSelectCategory:x})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-y-auto",children:[r&&e.jsx("div",{className:"flex min-h-50 flex-1 items-center justify-center",children:e.jsx(y,{label:"Loading agents"})}),o&&e.jsx("div",{className:"flex min-h-50 flex-1 items-center justify-center",children:e.jsxs("p",{className:"text-body-sm text-danger",children:["Failed to load agents: ",o.message]})}),!r&&!o&&e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(17.5rem,1fr))] gap-6",children:u.length===0?e.jsx("p",{className:"col-span-full text-center text-body text-ink",children:"No public agents found."}):u.map(d=>e.jsx(_,{agent:d},d.id))}),c&&c.totalPages>1&&e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx(L,{count:c.totalPages,page:c.page,onChange:g})})]})]})]})};export{H as AgentHubPage};
11
+ */const I=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],z=p("layers",I),_=({agent:a})=>{const{isAuthenticated:t}=b(),{isLiked:i,isLoading:s}=C({agentId:a.id,enabled:t}),{isFavourited:n,isLoading:l}=P({agentId:a.id,enabled:t}),r=w(),o=M(),c=()=>{!t||s||r.isPending||r.mutate({agentId:a.id,isCurrentlyLiked:i})},u=()=>{!t||l||o.isPending||o.mutate({agentId:a.id,isCurrentlyFavourited:n})},g=s||r.isPending,x=l||o.isPending;return e.jsx(A,{agent:a,isLiked:t?i:!1,isFavourited:t?n:!1,onLikeToggle:c,onFavouriteToggle:u,isLikeActionLoading:g,isFavouriteActionLoading:x,showActions:t})},f=({selected:a,onClick:t,children:i,...s})=>e.jsx("button",{type:"button",onClick:t,"aria-pressed":a,className:j("flex w-full cursor-pointer items-center gap-2.5 rounded-sm px-3 py-1.5 text-left","text-body-sm transition-colors duration-fast ease-out-quart",a?"bg-accent-wash font-semibold text-accent":"text-ink hover:bg-elevated"),...s,children:i}),T=({selectedCategory:a,onSelectCategory:t})=>{const i=Object.keys(h);return e.jsxs("div",{className:"flex h-full flex-col overflow-y-auto",children:[e.jsx("h2",{className:"mb-2 px-3 font-medium text-ink-dim text-meta",children:"Categories"}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs(f,{selected:a===null,onClick:()=>t(null),"data-testid":"category-all",children:[e.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:e.jsx(z,{size:16,"aria-hidden":"true"})}),"All categories"]}),i.map(s=>{const n=h[s],l=s==="other"?e.jsx(S,{size:16}):n.icon;return e.jsxs(f,{selected:a===s,onClick:()=>t(s),"data-testid":`category-${s}`,children:[e.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center",children:l}),n.label]},s)})]})]})},$=()=>{const[a,t]=m.useState(1),[i]=m.useState(12),[s,n]=m.useState(null),{data:l,isLoading:r,error:o,pagination:c}=L({page:a,perPage:i,categories:s?[s]:void 0}),u=l?.records??[],g=d=>{t(d)},x=d=>{n(d),t(1)};return e.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[e.jsx(v,{title:"Agent hub",subtitle:"Discover and download community agents on Radient",icon:N}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-row overflow-hidden",children:[e.jsx("div",{className:"mr-6 hidden w-60 shrink-0 md:block","data-tour-tag":"agent-hub-sidebar-container",children:e.jsx(T,{selectedCategory:s,onSelectCategory:x})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-y-auto",children:[r&&e.jsx("div",{className:"flex min-h-50 flex-1 items-center justify-center",children:e.jsx(y,{label:"Loading agents"})}),o&&e.jsx("div",{className:"flex min-h-50 flex-1 items-center justify-center",children:e.jsxs("p",{className:"text-body-sm text-danger",children:["Failed to load agents: ",o.message]})}),!r&&!o&&e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(17.5rem,1fr))] gap-6",children:u.length===0?e.jsx("p",{className:"col-span-full text-center text-body text-ink",children:"No public agents found."}):u.map(d=>e.jsx(_,{agent:d},d.id))}),c&&c.totalPages>1&&e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsx(k,{count:c.totalPages,page:c.page,onChange:g})})]})]})]})};export{$ as AgentHubPage};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./legacy-agents-page-Bjs1Z9g8.js","./icon-DREivh6T.js","./icon-CvlWlLiK.css","./page-header-CtwhpX97.js","./index-D5Z_uzU-.js","./index-DikLkf3S.css","./radient-auth-buttons-D3fZKkWZ.js","./compact-pagination-D9Y6NSdy.js"])))=>i.map(i=>d[i]);
2
+ import{u as O,a as Q,b as J,d as V,c as W,e as G,f as H,g as X,B as Y,U as Z,P as ee,_ as te,h as $,i as z,j as U}from"./index-D5Z_uzU-.js";import{j as e,r as n,B as u,c as P}from"./icon-DREivh6T.js";const ae=n.lazy(()=>te(()=>import("./legacy-agents-page-Bjs1Z9g8.js"),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url).then(t=>({default:t.LegacyAgentsPage}))),d="w-full rounded-md border border-control bg-surface px-3 py-2 text-body-sm text-ink";function T({profile:t,creating:v,onSaved:g}){const[r,k]=n.useState(!1),[o,m]=n.useState(v),[p,b]=n.useState(t?.name??""),[x,C]=n.useState(t?.kind??"role"),[h,y]=n.useState(t?.description??""),[j,S]=n.useState(t?.instructions??""),[_,D]=n.useState(t?.tools?.join(", ")??""),[I,N]=n.useState(t?.effort??"inherit"),[R,L]=n.useState(t?.delegate??!1),[f,a]=n.useState(!1),[c,l]=n.useState(null),i=n.useRef(null),w=$(),E=v||r,K=async s=>{if(s.preventDefault(),f)return;const M={kind:x,description:h,instructions:j,tools:_.split(",").map(q=>q.trim()).filter(Boolean),effort:I,delegate:R},A=JSON.stringify({name:p,fields:M,fresh:E});if(i.current&&i.current.body!==A){l("The previous save has not been confirmed. Retry it unchanged or reload the profile to reconcile before editing again.");return}i.current??={id:crypto.randomUUID(),body:A},a(!0),l(null);try{const q=await U({op:E?"profiles.create":"profiles.update",requestId:i.current.id,name:p,fields:M});i.current=null,m(!1),g(q.name)}catch(q){l(q instanceof Error?q.message:"Profile could not be saved.")}finally{a(!1)}},F=async()=>{if(!(!t||f)){a(!0),l(null);try{const s=await U({op:"profiles.install",name:t.name,requestId:crypto.randomUUID()});m(!1),k(!1),i.current=null,b(s.name),C(s.kind),y(s.description??""),S(s.instructions??""),D(s.tools?.join(", ")??""),N(s.effort??"inherit"),L(s.delegate??!1),g(s.name)}catch(s){l(s instanceof Error?s.message:"Profile could not be installed.")}finally{a(!1)}}};return e.jsxs("div",{className:"max-w-3xl space-y-6",children:[e.jsxs("header",{children:[e.jsx("h1",{className:"text-title",children:E?r?"Extend agent":"Create agent":t?.name}),e.jsx("p",{className:"mt-2 text-body-sm text-ink-muted",children:"Reusable instructions shared by agent commands, subagents and teams. Chats remain separate."})]}),t&&!E&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"text-meta text-ink-muted",children:[t.source==="builtin"?"Built-in":t.source==="installed"?"Installed":"Custom",t.divergent_fields?.length?" · Modified":""," ·"," ",t.kind]}),t.source==="builtin"?e.jsx(u,{variant:"outline",onClick:F,disabled:f,children:"Install"}):e.jsx(u,{variant:"outline",onClick:()=>m(!0),children:"Edit"}),e.jsx(u,{variant:"outline",onClick:()=>{k(!0),m(!0),b(""),i.current=null},children:"Extend"}),e.jsx(u,{onClick:()=>{z.getState().stageDraft({kind:"agent",name:t.name}),w("/chat")},children:"New chat"})]}),c&&e.jsx("p",{role:"alert",className:"text-body-sm text-danger",children:c}),!o&&t?.source==="builtin"&&e.jsx("p",{id:"builtin-readonly",className:"text-body-sm text-ink-muted",children:"Built-in agents are read-only. Install this one to edit it, or Extend it to start a separate agent from its instructions."}),e.jsxs("form",{onSubmit:K,className:"space-y-4",children:[e.jsxs("fieldset",{disabled:!o||f,className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-1 text-body-sm",children:[e.jsx("span",{children:"Name"}),e.jsx("input",{className:d,value:p,disabled:!E,required:!0,"aria-describedby":t?.source==="builtin"?"builtin-readonly":void 0,onChange:s=>b(s.target.value)})]}),e.jsxs("label",{className:"block space-y-1 text-body-sm",children:[e.jsx("span",{children:"Kind"}),e.jsxs("select",{className:d,value:x,disabled:!E,onChange:s=>C(s.target.value),children:[e.jsx("option",{value:"role",children:"Role"}),e.jsx("option",{value:"specialist",children:"Specialist"})]})]}),e.jsxs("label",{className:"block space-y-1 text-body-sm",children:[e.jsx("span",{children:"When to use this agent"}),e.jsx("input",{className:d,value:h,maxLength:8e3,onChange:s=>y(s.target.value)})]}),e.jsxs("label",{className:"block space-y-1 text-body-sm",children:[e.jsx("span",{children:"Instructions"}),e.jsx("textarea",{className:P(d,"min-h-52"),value:j,required:!0,maxLength:8e3,onChange:s=>S(s.target.value)})]}),x==="role"&&e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"block space-y-1 text-body-sm",children:[e.jsx("span",{children:"Allowed tools"}),e.jsx("input",{className:d,value:_,onChange:s=>D(s.target.value),placeholder:"All tools when empty; otherwise comma-separated names"})]}),e.jsxs("label",{className:"block space-y-1 text-body-sm",children:[e.jsx("span",{children:"Effort tier"}),e.jsx("input",{className:d,value:I,onChange:s=>N(s.target.value),"aria-describedby":"effort-help"}),e.jsx("span",{id:"effort-help",className:"text-meta text-ink-muted",children:"Use inherit, or a tier configured in backend settings. Unsupported tiers are rejected before saving."})]}),e.jsxs("label",{className:"flex items-center gap-2 text-body-sm",children:[e.jsx("input",{type:"checkbox",checked:R,onChange:s=>L(s.target.checked)}),"May delegate to subagents"]})]})]}),o&&e.jsx(u,{type:"submit",disabled:f,children:f?"Saving…":E?"Create agent":"Save changes"})]}),!o&&t?.packaged_instructions&&t.divergent_fields?.length?e.jsxs("details",{className:"text-body-sm",children:[e.jsx("summary",{children:"Compare packaged instructions"}),e.jsx("pre",{className:"mt-2 whitespace-pre-wrap text-body-sm text-ink-muted",children:t.packaged_instructions})]}):null]})}function B({team:t,onSaved:v}){const[g,r]=n.useState(t?.name??""),[k,o]=n.useState(t?.description??""),[m,p]=n.useState(t?.manager??"manager"),[b,x]=n.useState((t?.members??[]).map(a=>({...a,key:crypto.randomUUID()}))),[C,h]=n.useState(t?.instructions??""),[y,j]=n.useState(t?.project??""),[S,_]=n.useState(!1),[D,I]=n.useState(null),N=n.useRef(null),R=$(),L=async a=>{if(a.preventDefault(),S)return;const c={name:g,description:k,manager:m,members:b.map(({key:i,...w})=>w),instructions:C,project:y},l=JSON.stringify(c);if(N.current&&N.current.body!==l){I("The previous save has not been confirmed. Reload the team before changing that request.");return}N.current??={id:crypto.randomUUID(),body:l},_(!0),I(null);try{const i=t?await U({op:"teams.update",name:t.name,requestId:N.current.id,fields:c}):await U({op:"teams.create",requestId:N.current.id,fields:c});N.current=null,v(i.name)}catch(i){I(i instanceof Error?i.message:"Team could not be saved.")}finally{_(!1)}},f=(a,c)=>x(l=>l.map((i,w)=>w===a?{...i,...c}:i));return e.jsxs("div",{className:"max-w-3xl space-y-6",children:[e.jsxs("header",{children:[e.jsx("h1",{className:"text-title",children:t?t.name:"Create team"}),e.jsx("p",{className:"mt-2 text-body-sm text-ink-muted",children:"The manager leads the chat. Members retain their own instructions and start only when delegated work."})]}),t&&e.jsx(u,{onClick:()=>{z.getState().stageDraft({kind:"team",name:t.name}),R("/chat")},children:"New team chat"}),D&&e.jsx("p",{role:"alert",className:"text-body-sm text-danger",children:D}),e.jsxs("form",{onSubmit:L,className:"space-y-4",children:[e.jsxs("fieldset",{disabled:S,className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-1 text-body-sm",children:[e.jsx("span",{children:"Name"}),e.jsx("input",{className:d,required:!0,maxLength:64,value:g,onChange:a=>r(a.target.value)})]}),e.jsxs("label",{className:"block space-y-1 text-body-sm",children:[e.jsx("span",{children:"Description"}),e.jsx("input",{className:d,value:k,onChange:a=>o(a.target.value)})]}),e.jsxs("label",{className:"block space-y-1 text-body-sm",children:[e.jsx("span",{children:"Manager agent"}),e.jsx("input",{className:d,required:!0,value:m,onChange:a=>p(a.target.value)})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx("h2",{className:"text-heading",children:"Members"}),b.map((a,c)=>e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("input",{className:P(d,"w-48 flex-1"),"aria-label":`Member ${c+1} name`,required:!0,value:a.role,onChange:l=>f(c,{role:l.target.value})}),e.jsxs("select",{className:P(d,"w-32"),"aria-label":`Member ${c+1} kind`,value:a.kind,onChange:l=>f(c,{kind:l.target.value}),children:[e.jsx("option",{value:"agent",children:"Agent"}),e.jsx("option",{value:"team",children:"Nested team"})]}),e.jsx("input",{className:P(d,"w-20"),"aria-label":`Member ${c+1} count`,type:"number",min:1,max:16,value:a.count,onChange:l=>f(c,{count:Number(l.target.value)})}),e.jsx(u,{type:"button",variant:"ghost",onClick:()=>x(l=>l.filter((i,w)=>w!==c)),children:"Remove"})]},a.key)),e.jsx(u,{type:"button",variant:"outline",onClick:()=>x(a=>[...a,{role:"",count:1,kind:"agent",key:crypto.randomUUID()}]),children:"Add member"})]}),e.jsxs("label",{className:"block space-y-1 text-body-sm",children:[e.jsx("span",{children:"Collaboration instructions"}),e.jsx("textarea",{className:P(d,"min-h-36"),maxLength:8e3,value:C,onChange:a=>h(a.target.value)})]}),e.jsxs("label",{className:"block space-y-1 text-body-sm",children:[e.jsx("span",{children:"Project brief"}),e.jsx("textarea",{className:P(d,"min-h-36"),maxLength:8e3,value:y,onChange:a=>j(a.target.value)})]})]}),e.jsx(u,{type:"submit",disabled:S,children:S?"Saving…":t?"Save team":"Create team"})]})]})}function re(){const{agentId:t}=O(),[v,g]=Q(),r=v.get("kind")==="team"||v.get("create")==="team",k=v.has("create"),o=v.get("name"),m=J(),p=V(m.data,r?"team_catalogue":"profile_catalogue"),b=W(p&&!r),x=G(p&&r),C=H(),h=X({queryKey:["desktop",r?"team":"profile",o],enabled:p&&!!o&&!k,queryFn:()=>U({op:r?"teams.get":"profiles.get",name:o??""}),retry:!1}),y=async j=>{await C.invalidateQueries({queryKey:["desktop"]}),g({kind:r?"team":"agent",name:j})};return t?e.jsx(n.Suspense,{fallback:e.jsx("p",{className:"p-6 text-body",children:"Loading saved agent…"}),children:e.jsx(ae,{})}):e.jsxs("div",{className:"flex h-full min-h-0 bg-canvas text-ink",children:[e.jsxs("aside",{className:"flex w-64 shrink-0 flex-col gap-4 border-r border-hairline bg-surface p-4",children:[e.jsx("h1",{className:"text-heading",children:"Agents and teams"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(u,{variant:r?"ghost":"outline",onClick:()=>g({kind:"agent"}),children:[e.jsx(Y,{className:"size-4"}),"Agents"]}),e.jsxs(u,{variant:r?"outline":"ghost",onClick:()=>g({kind:"team"}),children:[e.jsx(Z,{className:"size-4"}),"Teams"]})]}),e.jsxs(u,{variant:"outline",disabled:!p,onClick:()=>g({create:r?"team":"agent"}),children:[e.jsx(ee,{className:"size-4"}),r?"Create team":"Create agent"]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:(r?x.data:b.data)?.map(j=>e.jsx("button",{type:"button",className:P("flex h-8 w-full items-center rounded-md px-2 text-left text-body-sm hover:bg-elevated",j.name===o&&"bg-accent-wash"),onClick:()=>g({kind:r?"team":"agent",name:j.name}),children:e.jsx("span",{className:"truncate",children:j.name})},j.name))})]}),e.jsx("main",{className:"min-w-0 flex-1 overflow-auto p-6",children:p?b.error||x.error||h.error?e.jsxs("div",{role:"alert",children:[e.jsx("p",{className:"text-danger",children:b.error?.message||x.error?.message||h.error?.message}),e.jsx(u,{variant:"outline",onClick:()=>{b.refetch(),x.refetch(),h.refetch()},children:"Retry"})]}):k?r?e.jsx(B,{onSaved:y},"create-team"):e.jsx(T,{creating:!0,onSaved:y},"create-agent"):o&&h.isLoading?e.jsx("p",{"aria-live":"polite",children:"Loading details…"}):o&&h.data?r?e.jsx(B,{team:h.data,onSaved:y},o):e.jsx(T,{profile:h.data,creating:!1,onSaved:y},`${o}:${h.data.source}`):e.jsxs("div",{children:[e.jsx("h2",{className:"text-title",children:r?"Reusable teams":"Reusable agents"}),e.jsx("p",{className:"mt-2 text-body text-ink-muted",children:"Select a definition to view or edit it. A new chat does not change its definition."})]}):e.jsxs("div",{"aria-live":"polite",className:"space-y-3 text-body-sm",children:[e.jsx("p",{children:m.isLoading?"Connecting to the backend…":m.error?m.error.message:"Update the backend to manage reusable agents and teams. Saved chats are unchanged."}),e.jsx(u,{variant:"outline",onClick:()=>void m.refetch(),children:"Retry connection"})]})})]})}export{re as AgentsPage};