turbollm 1.14.2 → 1.14.3

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 (129) hide show
  1. package/README.md +4 -1
  2. package/dist/code-routes.js +20 -3
  3. package/dist/webdist/assets/{AgentEditPage-tnUusLAh.js → AgentEditPage-CjfaBnD4.js} +1 -1
  4. package/dist/webdist/assets/{ChatScreen-CVxY8mMP.js → ChatScreen-DY8g12qe.js} +18 -18
  5. package/dist/webdist/assets/{CodeComposer-B6CpZqDi.js → CodeComposer-O6uw_dEo.js} +1 -1
  6. package/dist/webdist/assets/CodeHomeScreen-D9uSHUf-.js +1 -0
  7. package/dist/webdist/assets/{CodeSessionScreen-Dorqtv3D.js → CodeSessionScreen-D_rhtCFs.js} +1 -1
  8. package/dist/webdist/assets/{CustomizeScreen-DAbZ0eB4.js → CustomizeScreen-BcFX9Q_V.js} +3 -3
  9. package/dist/webdist/assets/{EnginesScreen-1NQSnakW.js → EnginesScreen-D6uiILFx.js} +1 -1
  10. package/dist/webdist/assets/{HardwareSection-D96Q5CZG.js → HardwareSection-Cy6agZys.js} +1 -1
  11. package/dist/webdist/assets/{JevPlaygroundScreen-0gTNSPQK.js → JevPlaygroundScreen-CCRmBZsL.js} +1 -1
  12. package/dist/webdist/assets/{ModelDetailDialog-B7JlKrJO.js → ModelDetailDialog-2CnxrgyZ.js} +1 -1
  13. package/dist/webdist/assets/{ModelLoadMenu-BnlNJNw-.js → ModelLoadMenu-B55tUUUo.js} +1 -1
  14. package/dist/webdist/assets/{ModelsScreen-DGpFp6S-.js → ModelsScreen-C3ZGHSfD.js} +1 -1
  15. package/dist/webdist/assets/{OnboardingScreen-CCIJnIi5.js → OnboardingScreen-DibAVHbl.js} +1 -1
  16. package/dist/webdist/assets/{RoutineEditPage-Co4_3XhP.js → RoutineEditPage-DGx2VNfw.js} +1 -1
  17. package/dist/webdist/assets/{RoutinesPanel-zJF-E6mo.js → RoutinesPanel-D-EiZue1.js} +1 -1
  18. package/dist/webdist/assets/{SettingsScreen-D5cIWfQJ.js → SettingsScreen-PSqejyv-.js} +2 -2
  19. package/dist/webdist/assets/{SidebarResizeHandle-Dq_U6yuG.js → SidebarResizeHandle-BEMfZ_M-.js} +1 -1
  20. package/dist/webdist/assets/{SkillEditPage-Ba2xDoam.js → SkillEditPage-a4L48IZM.js} +1 -1
  21. package/dist/webdist/assets/{TextClassificationRuntimeLabel-BpYt4W5O.js → TextClassificationRuntimeLabel-BKeaXzVJ.js} +1 -1
  22. package/dist/webdist/assets/{ToolApprovalBar-DaK8QffX.js → ToolApprovalBar-RNePIRp-.js} +17 -17
  23. package/dist/webdist/assets/{WorkspaceModeTabs-DTf4E0GA.js → WorkspaceModeTabs-DZdY2nBf.js} +1 -1
  24. package/dist/webdist/assets/WorkspaceScreen-kicamjr8.js +1 -0
  25. package/dist/webdist/assets/{abnfDiagram-N423BO3Z-B1QGUB6J.js → abnfDiagram-N423BO3Z-CxAOKJF6.js} +1 -1
  26. package/dist/webdist/assets/{agent-api-BEBWhAbY.js → agent-api-BFbPafmn.js} +1 -1
  27. package/dist/webdist/assets/{arc-DLvgYZ6e.js → arc-C5Jiw2Ow.js} +1 -1
  28. package/dist/webdist/assets/{architectureDiagram-T3A2C74G-BmkrXymW.js → architectureDiagram-T3A2C74G-CMYZ8ScY.js} +1 -1
  29. package/dist/webdist/assets/{arrow-down-DkZ95RMq.js → arrow-down-CzMySSLm.js} +1 -1
  30. package/dist/webdist/assets/{arrow-up-w6zrcoir.js → arrow-up-CvkWv_kZ.js} +1 -1
  31. package/dist/webdist/assets/{badge-DVKueHPN.js → badge-D4mMa17X.js} +1 -1
  32. package/dist/webdist/assets/{blockDiagram-VBNYF7ZC-LbNZcnRe.js → blockDiagram-VBNYF7ZC-wmetya9r.js} +1 -1
  33. package/dist/webdist/assets/{c4Diagram-5PPSVZJV-De5pN9xg.js → c4Diagram-5PPSVZJV-BeV5yKwp.js} +1 -1
  34. package/dist/webdist/assets/channel-lZjnTXKq.js +1 -0
  35. package/dist/webdist/assets/{chat-api-Dv-oqejk.js → chat-api-BwO7wZOQ.js} +1 -1
  36. package/dist/webdist/assets/{chat-queries-CewwIh0J.js → chat-queries-D_0kcurv.js} +1 -1
  37. package/dist/webdist/assets/{chevron-down-DcmMmTn-.js → chevron-down-BOfiL1lz.js} +1 -1
  38. package/dist/webdist/assets/{chevron-left-CoiCxQA4.js → chevron-left-DSRtQQFP.js} +1 -1
  39. package/dist/webdist/assets/{chevron-right-CmS3eOCE.js → chevron-right-CVHs_Q7w.js} +1 -1
  40. package/dist/webdist/assets/{chunk-2GRJ4B5K-DeY68X39.js → chunk-2GRJ4B5K-DjaqqqCb.js} +1 -1
  41. package/dist/webdist/assets/{chunk-2Q5K7J3B-CuJ1CtX2.js → chunk-2Q5K7J3B-VCgCCKpJ.js} +1 -1
  42. package/dist/webdist/assets/{chunk-5RXB4S5H-B8Zw950n.js → chunk-5RXB4S5H-CvqiK9Tg.js} +1 -1
  43. package/dist/webdist/assets/{chunk-5VM5RSS4-KlDl74CQ.js → chunk-5VM5RSS4-DtTCp1C3.js} +1 -1
  44. package/dist/webdist/assets/{chunk-6Q2QTUOP-BnNne1Os.js → chunk-6Q2QTUOP-Dsic3APl.js} +1 -1
  45. package/dist/webdist/assets/{chunk-GF5L2VYU-BDPSRdQv.js → chunk-GF5L2VYU-D8N4oTtR.js} +1 -1
  46. package/dist/webdist/assets/{chunk-JWPE2WC7-C2LUzMMw.js → chunk-JWPE2WC7-R8PEhhHq.js} +1 -1
  47. package/dist/webdist/assets/{chunk-KBJHAD2P-D84e5RM_.js → chunk-KBJHAD2P-czwHsnCK.js} +1 -1
  48. package/dist/webdist/assets/{chunk-RYQCIY6F-B7nPmyRB.js → chunk-RYQCIY6F-CoDqOb16.js} +1 -1
  49. package/dist/webdist/assets/{chunk-XXDRQBXY-AmYmEQJP.js → chunk-XXDRQBXY-Cldsz5dr.js} +1 -1
  50. package/dist/webdist/assets/{circle-check-BRqW4CsL.js → circle-check-djJJrY1O.js} +1 -1
  51. package/dist/webdist/assets/{circle-x-BN-0hIbm.js → circle-x-CArlOKoo.js} +1 -1
  52. package/dist/webdist/assets/classDiagram-JCYQIIEL-s5vmZBiR.js +1 -0
  53. package/dist/webdist/assets/classDiagram-v2-OCEON4UE-s5vmZBiR.js +1 -0
  54. package/dist/webdist/assets/{collapsible-__N4cdCZ.js → collapsible-DEDu6inL.js} +1 -1
  55. package/dist/webdist/assets/{common-BQq8WPIb.js → common-DHTYD56P.js} +1 -1
  56. package/dist/webdist/assets/{cose-bilkent-JH36ORCC-DhnDWmuW.js → cose-bilkent-JH36ORCC-DJJu2A8A.js} +1 -1
  57. package/dist/webdist/assets/{cynefin-VYW2F7L2-e0jhu0MI.js → cynefin-VYW2F7L2-B8S78-EI.js} +1 -1
  58. package/dist/webdist/assets/{cynefinDiagram-MW4NZA55-DqjgK_iL.js → cynefinDiagram-MW4NZA55-nCDMW2vi.js} +1 -1
  59. package/dist/webdist/assets/{dagre-VZM6K2ZE-BGNsCCES.js → dagre-VZM6K2ZE-DgF7Th-o.js} +1 -1
  60. package/dist/webdist/assets/{diagram-7IWD3JNH-CW6Q0snt.js → diagram-7IWD3JNH-ByjqDhlh.js} +1 -1
  61. package/dist/webdist/assets/{diagram-B4RE2ZJO-B5c5yRvK.js → diagram-B4RE2ZJO-CdtoVUcH.js} +1 -1
  62. package/dist/webdist/assets/{diagram-LBJQPF4R-BIvlaKtx.js → diagram-LBJQPF4R-Bz8cz8Iw.js} +1 -1
  63. package/dist/webdist/assets/{diagram-Q27KOJAE-Czf-ye04.js → diagram-Q27KOJAE-C0jR_yOk.js} +1 -1
  64. package/dist/webdist/assets/{diagram-UB23O5K3-DE3kHe-N.js → diagram-UB23O5K3-NerVDH9H.js} +1 -1
  65. package/dist/webdist/assets/{dropdown-menu-COm_GkV7.js → dropdown-menu-BrTbP2Ms.js} +1 -1
  66. package/dist/webdist/assets/{ebnfDiagram-BXEA7PRR-CqZvsQuG.js → ebnfDiagram-BXEA7PRR-U50-9H7G.js} +1 -1
  67. package/dist/webdist/assets/{erDiagram-JOGREHBK-yvYG3ngv.js → erDiagram-JOGREHBK-C3st41PU.js} +1 -1
  68. package/dist/webdist/assets/{file-text-B6FA7Q1h.js → file-text-DnQANfo2.js} +1 -1
  69. package/dist/webdist/assets/{flask-conical-CaJ49MUq.js → flask-conical-Dqj5KaQl.js} +1 -1
  70. package/dist/webdist/assets/{flowDiagram-UKHOOZJN-Dnq_UKUn.js → flowDiagram-UKHOOZJN-DpI16qBt.js} +1 -1
  71. package/dist/webdist/assets/{folder-input-TSd2AuPT.js → folder-input-Do7bM16X.js} +1 -1
  72. package/dist/webdist/assets/{folder-plus-DphE2jL5.js → folder-plus-DU6plWQY.js} +1 -1
  73. package/dist/webdist/assets/{ganttDiagram-PKOTCBZU-CoRR11PO.js → ganttDiagram-PKOTCBZU-ChfxmXjs.js} +1 -1
  74. package/dist/webdist/assets/{git-branch-CJq3lkZm.js → git-branch-DFW4sRVn.js} +1 -1
  75. package/dist/webdist/assets/{gitGraphDiagram-DS77QQ5N-BErio5T0.js → gitGraphDiagram-DS77QQ5N-B7uz0MiG.js} +1 -1
  76. package/dist/webdist/assets/{globe-B1_rJR_Q.js → globe-CN3jxwvA.js} +1 -1
  77. package/dist/webdist/assets/{index-ClfLzd40.js → index-DRdg25dC.js} +2 -2
  78. package/dist/webdist/assets/index-DXD5wL5z.css +1 -0
  79. package/dist/webdist/assets/{infoDiagram-6WML65LV-Cb2MPW4j.js → infoDiagram-6WML65LV-CBNjKj7C.js} +1 -1
  80. package/dist/webdist/assets/{ishikawaDiagram-WSZJBQD7-5H19GA8p.js → ishikawaDiagram-WSZJBQD7-tWioVCgq.js} +1 -1
  81. package/dist/webdist/assets/{journeyDiagram-NVQOT4AX-C5SgRgwd.js → journeyDiagram-NVQOT4AX-Cm6j912_.js} +1 -1
  82. package/dist/webdist/assets/{kanban-definition-27J2QSJJ-Ihe735zx.js → kanban-definition-27J2QSJJ-MYnXca-f.js} +1 -1
  83. package/dist/webdist/assets/{linear-BEPlpGMB.js → linear-DRAAYH9X.js} +1 -1
  84. package/dist/webdist/assets/{lock-BV0OSbIx.js → lock-CW0VPUGW.js} +1 -1
  85. package/dist/webdist/assets/{mermaid.core-Bt6veX0C.js → mermaid.core-CtkhOarB.js} +4 -4
  86. package/dist/webdist/assets/{mindmap-definition-FAOFIHXS-DHHRM1bQ.js → mindmap-definition-FAOFIHXS-C5e6iYOC.js} +1 -1
  87. package/dist/webdist/assets/{monitor-Balfhcw2.js → monitor-hFoP-Pxj.js} +1 -1
  88. package/dist/webdist/assets/{pegDiagram-VL7TDLO6-BLdGJ-f0.js → pegDiagram-VL7TDLO6-BQ_Voj5w.js} +1 -1
  89. package/dist/webdist/assets/{pencil-CN48KHVw.js → pencil-D2iXjVbD.js} +1 -1
  90. package/dist/webdist/assets/personas-BWGXiudT.js +109 -0
  91. package/dist/webdist/assets/{pieDiagram-7S7Q4E2Y-BpObnryv.js → pieDiagram-7S7Q4E2Y-DXM9gFZw.js} +1 -1
  92. package/dist/webdist/assets/{quadrantDiagram-CIZ2JOQS-CJOorRuX.js → quadrantDiagram-CIZ2JOQS-BRa9W3tx.js} +1 -1
  93. package/dist/webdist/assets/{railroadDiagram-AXF67PYL-BOkSU2J5.js → railroadDiagram-AXF67PYL-BVDEirWs.js} +1 -1
  94. package/dist/webdist/assets/{refresh-cw-CpaENY74.js → refresh-cw-Cm6Ic0_8.js} +1 -1
  95. package/dist/webdist/assets/{remote-failure-Le7JhpD3.js → remote-failure-BLjio7b3.js} +1 -1
  96. package/dist/webdist/assets/{requirementDiagram-LRYGKXZP-tCLGfIhr.js → requirementDiagram-LRYGKXZP-C74l9A1E.js} +1 -1
  97. package/dist/webdist/assets/{rocket-D7qZYT9O.js → rocket-C-pxXPXZ.js} +1 -1
  98. package/dist/webdist/assets/{rotate-ccw-DybvLiz1.js → rotate-ccw-BRymq87L.js} +1 -1
  99. package/dist/webdist/assets/{sankeyDiagram-W5VNT64P-DzcuXSnA.js → sankeyDiagram-W5VNT64P-BsH8Eu-e.js} +1 -1
  100. package/dist/webdist/assets/{sequenceDiagram-SI44F4Z6-LJnZ3bL-.js → sequenceDiagram-SI44F4Z6-B9XE2EdE.js} +1 -1
  101. package/dist/webdist/assets/{sheet-DdZKjOeh.js → sheet-C2_P3xP2.js} +1 -1
  102. package/dist/webdist/assets/{sizeCapture-X5ZJPWSS-B1_bl0TL.js → sizeCapture-X5ZJPWSS-UMEN2RGV.js} +1 -1
  103. package/dist/webdist/assets/{skeleton-CglyWPQw.js → skeleton-B3RpKtmw.js} +1 -1
  104. package/dist/webdist/assets/{sliders-horizontal-Xkfwi1fI.js → sliders-horizontal-Tbar8Iuv.js} +1 -1
  105. package/dist/webdist/assets/{sparkles-AwLaRfcP.js → sparkles-DobYQL8n.js} +1 -1
  106. package/dist/webdist/assets/{star-CT3XRE-k.js → star-EZSc11Fy.js} +1 -1
  107. package/dist/webdist/assets/{stateDiagram-OKZ733FA-CMVmr7Zf.js → stateDiagram-OKZ733FA-BYmvfWXV.js} +1 -1
  108. package/dist/webdist/assets/stateDiagram-v2-UEYNNEHI-hXGYjhv4.js +1 -0
  109. package/dist/webdist/assets/{swimlanes-SLNWSIFB-o7LqgRkn.js → swimlanes-SLNWSIFB-BXgBtl96.js} +2 -2
  110. package/dist/webdist/assets/swimlanesDiagram-ULZ7WXOC-Bz4WUleA.js +8 -0
  111. package/dist/webdist/assets/{switch-fLgUmJgY.js → switch-BkYO439N.js} +1 -1
  112. package/dist/webdist/assets/{terminal-D2nV3CrY.js → terminal-wAhyejeF.js} +1 -1
  113. package/dist/webdist/assets/{timeline-definition-Z64GVDOM-NGvuXBQN.js → timeline-definition-Z64GVDOM-HxbgMsz2.js} +1 -1
  114. package/dist/webdist/assets/{trash-2-CV5t0bZP.js → trash-2-BeJEd3dS.js} +1 -1
  115. package/dist/webdist/assets/{vennDiagram-T6HMQDX7-CnPGhl_y.js → vennDiagram-T6HMQDX7-BS199h5Z.js} +1 -1
  116. package/dist/webdist/assets/{wardleyDiagram-T6FBY63Y-Q_r2y2GO.js → wardleyDiagram-T6FBY63Y-CiSNOVyM.js} +1 -1
  117. package/dist/webdist/assets/{wrench-BtzWmTcQ.js → wrench-Cb_10Xfp.js} +1 -1
  118. package/dist/webdist/assets/{xychartDiagram-ELKLHX3M-qU8UaZIt.js → xychartDiagram-ELKLHX3M-DcWM8BQj.js} +1 -1
  119. package/dist/webdist/index.html +2 -2
  120. package/package.json +1 -1
  121. package/dist/webdist/assets/CodeHomeScreen-CZ4K1TeC.js +0 -1
  122. package/dist/webdist/assets/WorkspaceScreen-9HSZ7UHW.js +0 -1
  123. package/dist/webdist/assets/channel-mutI49t2.js +0 -1
  124. package/dist/webdist/assets/classDiagram-JCYQIIEL-Bmu-KUGL.js +0 -1
  125. package/dist/webdist/assets/classDiagram-v2-OCEON4UE-Bmu-KUGL.js +0 -1
  126. package/dist/webdist/assets/index-DZoGFHn8.css +0 -1
  127. package/dist/webdist/assets/personas-Cdtcei1Q.js +0 -109
  128. package/dist/webdist/assets/stateDiagram-v2-UEYNNEHI-nLHfPOlr.js +0 -1
  129. package/dist/webdist/assets/swimlanesDiagram-ULZ7WXOC-BiRBhEgu.js +0 -8
package/README.md CHANGED
@@ -249,7 +249,10 @@ the detail:
249
249
  **prefill t/s**, **time-to-first-token**, **total time**, exact **token counts**, and a
250
250
  **context-usage meter** (filled / max) on every reply.
251
251
  - **Thinking control** — toggle reasoning **off** for a direct answer, or leave it **on** with
252
- collapsible, timed "thought for N s" blocks.
252
+ collapsible, timed "thought for N s" blocks that grow with the reasoning; drag a block's bottom
253
+ edge to size it once and every block remembers it.
254
+ - **Find in chat** — **Ctrl/Cmd+F** (or the header's search button) searches the open conversation:
255
+ "3 of 17", Enter or the up/down buttons jump between matches and pan the chat to each, Esc closes.
253
256
  - **Markdown + syntax-highlighted code** with one-click copy — plus **inline Unicode charts**
254
257
  the model draws when a comparison, trend, or hierarchy is genuinely worth a visual.
255
258
  - **Live artifacts** — `html`, `svg`, and `mermaid` replies render as **sandboxed, offline
@@ -465,6 +465,21 @@ async function body(c) {
465
465
  }
466
466
  }
467
467
  var VALID_MODES = /* @__PURE__ */ new Set(["auto", "plan", "ask"]);
468
+ var MAX_SESSION_TITLE_LENGTH = 120;
469
+ var MAX_SESSION_TITLE_INPUT = 1e4;
470
+ function cleanSessionTitle(value) {
471
+ if (typeof value !== "string") return "";
472
+ const oneLine = value.slice(0, MAX_SESSION_TITLE_INPUT).replace(/\s+/g, " ").trim();
473
+ let title = "";
474
+ let codePoints = 0;
475
+ for (const { segment } of new Intl.Segmenter().segment(oneLine)) {
476
+ const size = Array.from(segment).length;
477
+ if (codePoints + size > MAX_SESSION_TITLE_LENGTH) break;
478
+ title += segment;
479
+ codePoints += size;
480
+ }
481
+ return title.trimEnd();
482
+ }
468
483
  function resolveRevertCut(messages, messageId) {
469
484
  const idx = messages.findIndex((m) => m.id === messageId);
470
485
  if (idx === -1) return { ok: false, error: "not_found" };
@@ -543,6 +558,7 @@ function registerCodeRoutes(app, d, codeRuns) {
543
558
  const b = await body(c);
544
559
  const repoRoot = (b.repoRoot ?? "").trim();
545
560
  const task = (b.task ?? "").trim();
561
+ const chosenTitle = cleanSessionTitle(b.title);
546
562
  const mode = b.mode ?? "auto";
547
563
  if (!repoRoot) return err(c, 400, "invalid_input", "repoRoot is required.");
548
564
  if (!task) return err(c, 400, "invalid_input", "A task description is required.");
@@ -564,7 +580,7 @@ function registerCodeRoutes(app, d, codeRuns) {
564
580
  const codeAgent = d.store.snapshot().code.defaultAgent;
565
581
  const run = db.createAgentRun({
566
582
  convId: conv.id,
567
- title: task.slice(0, 60),
583
+ title: chosenTitle || task.slice(0, 60),
568
584
  allowedTools: [],
569
585
  repoRoot,
570
586
  repoBranch: b.repoBranch,
@@ -578,6 +594,7 @@ function registerCodeRoutes(app, d, codeRuns) {
578
594
  worktreePath,
579
595
  codeAgent
580
596
  });
597
+ if (chosenTitle) db.updateAgentRun(run.id, { titleAutoSynced: true });
581
598
  db.addMessage(conv.id, "user", task, { textAttachments: b.contextFiles });
582
599
  return c.json({ sessionId: run.id, convId: conv.id }, 201);
583
600
  });
@@ -699,9 +716,9 @@ function registerCodeRoutes(app, d, codeRuns) {
699
716
  const run = db.getAgentRun(id);
700
717
  if (!run) return err(c, 404, "not_found", "Session not found.");
701
718
  const b = await body(c);
702
- const title = (b.title ?? "").trim();
719
+ const title = cleanSessionTitle(b.title);
703
720
  if (!title) return err(c, 400, "invalid_input", "title is required.");
704
- db.updateAgentRun(id, { title });
721
+ db.updateAgentRun(id, { title, titleAutoSynced: true });
705
722
  return c.json({ ok: true, title });
706
723
  });
707
724
  app.post("/api/v1/code/sessions/:id/archive", async (c) => {
@@ -1 +1 @@
1
- import{j as e}from"./radix-KD8-DhVi.js";import{b as W,u as $,r as b}from"./vendor-DbyaiIiX.js";import{u as G,e as H,f as Y,g as J,h as U,b as z,B as C,t as j,c as q,d as h,A as _}from"./index-ClfLzd40.js";import{f as V}from"./chat-api-Dv-oqejk.js";import{f as X,a as Z}from"./agent-api-BEBWhAbY.js";import{P as B}from"./personas-Cdtcei1Q.js";import{C as ee}from"./chevron-left-CoiCxQA4.js";import{R as te}from"./rotate-ccw-DybvLiz1.js";import{T as se}from"./trash-2-CV5t0bZP.js";import{C as ne}from"./chevron-right-CmS3eOCE.js";import"./dropdown-menu-COm_GkV7.js";const ae=()=>({name:"",description:"",systemPrompt:"",skillIds:[],tools:[]});function oe(s){const d=[],x=new Map;for(const n of s){const a=/^mcp__([^_]+(?:_[^_]+)*)__/.exec(n.name);if(!a){d.push(n);continue}const i=a[1],p=/^\[([^\]]+)\]/.exec(n.description),c=p?p[1]:i.replace(/_/g," ");x.has(i)||x.set(i,{key:i,label:c,tools:[]}),x.get(i).tools.push(n)}return{builtin:d,groups:[...x.values()].sort((n,a)=>n.label.localeCompare(a.label))}}function le(s){return s.replace(/^mcp__[^_]+(?:_[^_]+)*__/,"")}function re(s){return s.replace(/^\[[^\]]+\]\s*/,"")}function D({tool:s,checked:d,onToggle:x}){return e.jsxs("label",{className:"flex cursor-pointer items-start gap-2 text-[12px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:d,onChange:x}),e.jsxs("span",{className:"flex flex-col",children:[e.jsx("span",{className:"font-mono text-ink",children:le(s.name)}),s.description&&e.jsx("span",{className:"text-faint",children:re(s.description)})]})]})}function ie({group:s,selected:d,onToggleAll:x,onToggleOne:n}){const[a,i]=b.useState(!1),p=s.tools.map(l=>l.name),c=p.filter(l=>d.has(l)).length,o=c===p.length,g=c>0&&!o,u=b.useRef(null);return b.useEffect(()=>{u.current&&(u.current.indeterminate=g)},[g]),e.jsxs("div",{className:"rounded-md border border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2",children:[e.jsx("input",{ref:u,type:"checkbox",checked:o,onChange:()=>x(p,!o)}),e.jsxs("button",{type:"button",onClick:()=>{j("agents","toggle_agent_tool_group"),i(l=>!l)},className:"flex flex-1 items-center gap-1.5 text-left text-[13px] text-ink",children:[e.jsx(ne,{size:12,className:q("shrink-0 text-faint transition-transform",a&&"rotate-90")}),s.label,e.jsxs("span",{className:"text-[11px] text-faint",children:["(",c,"/",p.length,")"]})]})]}),a&&e.jsx("div",{className:"flex flex-col gap-1.5 border-t border-border px-3 py-2 pl-9",children:s.tools.map(l=>e.jsx(D,{tool:l,checked:d.has(l.name),onToggle:()=>n(l.name)},l.name))})]})}function ce({tools:s,selected:d,onChange:x}){const n=new Set(d),{builtin:a,groups:i}=oe(s),p=o=>x(n.has(o)?d.filter(g=>g!==o):[...d,o]),c=(o,g)=>{const u=d.filter(l=>!o.includes(l));x(g?[...u,...o]:u)};return s.length===0?e.jsx("p",{className:"text-[12px] text-faint",children:"No tools available yet."}):e.jsxs("div",{className:"flex flex-col gap-2",children:[a.length>0&&e.jsx("div",{className:"flex flex-col gap-2 rounded-md border border-border bg-panel-2 p-3",children:a.map(o=>e.jsx(D,{tool:o,checked:n.has(o.name),onToggle:()=>p(o.name)},o.name))}),i.map(o=>e.jsx(ie,{group:o,selected:n,onToggleAll:c,onToggleOne:p},o.key))]})}function je(){const{agentId:s="new"}=W(),d=$(),x=G(),n=s==="new",a=!n&&B.some(t=>t.id===s),i=a?B.find(t=>t.id===s):void 0,p=H(),c=!n&&!a?(p.data??[]).find(t=>t.id===s):void 0,o=Y(),g=J(),u=U(),l=a?g.data?.[s]:void 0,I=z({queryKey:Z.list(),queryFn:X,staleTime:0}),k=I.data??[],w=z({queryKey:["available-tools"],queryFn:V}),N=w.data??[],[m,f]=b.useState(ae()),[S,T]=b.useState(!1),[A,P]=b.useState(!1),[L,R]=b.useState(!1),[E,Q]=b.useState("skills");n&&!S&&(k.length||N.length)&&(f(t=>({...t,skillIds:k.map(r=>r.id),tools:N.map(r=>r.name)})),T(!0)),!n&&!a&&!S&&c&&(f({name:c.name,description:c.description,systemPrompt:c.systemPrompt,skillIds:c.skillIds,tools:c.tools}),T(!0)),a&&!S&&i&&g.isSuccess&&(k.length||N.length)&&(f({name:l?.name??i.name,description:l?.description??i.description,systemPrompt:l?.systemPrompt??i.systemPrompt,skillIds:l?.skillIds??k.map(t=>t.id),tools:l?.tools??N.map(t=>t.name)}),T(!0));const y=()=>{j("agents","back_to_agents"),d("/customize")},O=t=>f(r=>({...r,skillIds:r.skillIds.includes(t)?r.skillIds.filter(v=>v!==t):[...r.skillIds,t]})),F=()=>{if(!m.name.trim()){h.error("Name is required.");return}P(!0);const t={name:m.name.trim(),description:m.description.trim(),systemPrompt:m.systemPrompt,skillIds:m.skillIds,tools:m.tools};if(a){u.save.mutate({id:s,override:t},{onSuccess:()=>{h.success("Agent saved."),y()},onError:v=>{h.error(v instanceof _?v.message:"Could not save agent."),P(!1)}});return}const r={onSuccess:()=>{x.invalidateQueries({queryKey:["chat-agents"]}),h.success(n?"Agent created.":"Agent saved."),y()},onError:v=>{h.error(v instanceof _?v.message:"Could not save agent."),P(!1)}};n?o.add.mutate(t,r):o.update.mutate({id:s,patch:t},r)},K=()=>{u.reset.mutate(s,{onSuccess:()=>{h.success("Reset to default."),i&&f({name:i.name,description:i.description,systemPrompt:i.systemPrompt,skillIds:k.map(t=>t.id),tools:N.map(t=>t.name)})},onError:t=>h.error(t instanceof _?t.message:"Could not reset agent.")})},M=()=>{o.remove.mutate(s,{onSuccess:()=>{h.success("Agent deleted."),y()},onError:t=>h.error(t instanceof _?t.message:"Could not delete agent.")})};return!n&&!a&&p.isSuccess&&!c?e.jsxs("div",{className:"flex w-full flex-col items-center gap-3 px-8 py-16",children:[e.jsx("p",{className:"text-[14px] text-muted",children:"That agent no longer exists."}),e.jsx(C,{size:"sm",variant:"outline",onClick:y,children:"Back to agents"})]}):e.jsxs("div",{className:"flex w-full max-w-4xl flex-col gap-5 px-4 py-6 md:px-8",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("button",{type:"button",onClick:y,className:"text-faint hover:text-ink",title:"Back to agents",children:e.jsx(ee,{size:18})}),e.jsx("span",{className:"text-[15px] font-medium text-ink",children:n?"New agent":a?l?"Edit agent (modified built-in)":"Edit agent (built-in)":"Edit agent"}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a&&e.jsxs(C,{size:"sm",variant:"outline",onClick:()=>{j("agents","reset_agent_to_default"),K()},disabled:u.reset.isPending,children:[e.jsx(te,{size:13})," Reset to default"]}),e.jsx(C,{size:"sm",variant:"outline",onClick:y,children:"Cancel"}),e.jsx(C,{size:"sm",onClick:()=>{j("agents","save_agent"),F()},disabled:A||!m.name.trim(),children:A?"Saving…":"Save"})]})]}),a&&e.jsx("p",{className:"rounded-md border border-border bg-panel px-3 py-2 text-[12px] text-muted",children:"Built-in agents can be edited in place — Reset to default discards your changes and restores TurboLLM's original prompt and access."}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-[12px] font-medium text-muted",children:"Name"}),e.jsx("input",{className:"rounded-md border border-border bg-bg px-3 py-1.5 text-[13px] text-ink outline-none focus:border-accent placeholder:text-faint",placeholder:"Release Notes Writer",value:m.name,onChange:t=>f(r=>({...r,name:t.target.value}))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-[12px] font-medium text-muted",children:"Description"}),e.jsx("input",{className:"rounded-md border border-border bg-bg px-3 py-1.5 text-[13px] text-ink outline-none focus:border-accent placeholder:text-faint",placeholder:"What this agent is for, in one line",value:m.description,onChange:t=>f(r=>({...r,description:t.target.value}))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-[12px] font-medium text-muted",children:"System prompt"}),e.jsx("textarea",{className:"min-h-[160px] resize-y rounded-md border border-border bg-bg px-3 py-2 font-mono text-[12px] leading-relaxed text-ink outline-none focus:border-accent placeholder:text-faint",placeholder:"You are…",value:m.systemPrompt,onChange:t=>f(r=>({...r,systemPrompt:t.target.value}))})]}),e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsx("div",{className:"inline-flex w-fit rounded-md border border-border p-0.5",children:["skills","tools"].map(t=>e.jsx("button",{type:"button",onClick:()=>{j("agents","switch_agent_form_tab"),Q(t)},className:q("rounded px-3 py-1.5 text-[13px] font-medium transition-colors",E===t?"bg-accent/12 text-accent":"text-muted hover:text-ink"),children:t==="skills"?`Skills (${m.skillIds.length})`:`Tools (${m.tools.length})`},t))}),E==="skills"?I.isLoading?e.jsx("p",{className:"text-[12px] text-faint",children:"Loading…"}):k.length===0?e.jsx("p",{className:"text-[12px] text-faint",children:"No skills yet — create one under Customize → Skills."}):e.jsx("div",{className:"flex flex-col gap-2 rounded-md border border-border bg-panel-2 p-3",children:k.map(t=>e.jsxs("label",{className:"flex cursor-pointer items-start gap-2 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:m.skillIds.includes(t.id),onChange:()=>O(t.id)}),e.jsxs("span",{className:"flex flex-col",children:[e.jsx("span",{className:"text-ink",children:t.name}),t.description&&e.jsx("span",{className:"text-[12px] text-muted",children:t.description})]})]},t.id))}):w.isLoading?e.jsx("p",{className:"text-[12px] text-faint",children:"Loading…"}):e.jsx(ce,{tools:N,selected:m.tools,onChange:t=>f(r=>({...r,tools:t}))})]}),!n&&!a&&(L?e.jsxs("div",{className:"flex items-center gap-2 self-start rounded-md border border-border bg-panel p-2 text-[12px]",children:[e.jsx("span",{className:"flex-1 text-muted",children:"Delete this agent?"}),e.jsx("button",{type:"button",onClick:()=>{j("agents","delete_agent"),M()},className:"rounded px-2 py-1 text-[color:var(--err)] hover:bg-[color:color-mix(in_srgb,var(--err)_12%,transparent)]",children:"Delete"}),e.jsx("button",{type:"button",onClick:()=>{j("agents","cancel_delete_agent"),R(!1)},className:"rounded px-2 py-1 text-faint hover:text-ink",children:"Cancel"})]}):e.jsxs("button",{type:"button",onClick:()=>R(!0),className:"flex items-center gap-1.5 self-start text-[12px] text-faint hover:text-[color:var(--err)]",children:[e.jsx(se,{size:13})," Delete agent"]}))]})}export{je as AgentEditPage};
1
+ import{j as e}from"./radix-KD8-DhVi.js";import{b as W,u as $,r as b}from"./vendor-DbyaiIiX.js";import{u as G,e as H,f as Y,g as J,h as U,b as z,B as C,t as j,c as q,d as h,A as _}from"./index-DRdg25dC.js";import{f as V}from"./chat-api-BwO7wZOQ.js";import{f as X,a as Z}from"./agent-api-BFbPafmn.js";import{P as B}from"./personas-BWGXiudT.js";import{C as ee}from"./chevron-left-DSRtQQFP.js";import{R as te}from"./rotate-ccw-BRymq87L.js";import{T as se}from"./trash-2-BeJEd3dS.js";import{C as ne}from"./chevron-right-CVHs_Q7w.js";import"./dropdown-menu-BrTbP2Ms.js";const ae=()=>({name:"",description:"",systemPrompt:"",skillIds:[],tools:[]});function oe(s){const d=[],x=new Map;for(const n of s){const a=/^mcp__([^_]+(?:_[^_]+)*)__/.exec(n.name);if(!a){d.push(n);continue}const i=a[1],p=/^\[([^\]]+)\]/.exec(n.description),c=p?p[1]:i.replace(/_/g," ");x.has(i)||x.set(i,{key:i,label:c,tools:[]}),x.get(i).tools.push(n)}return{builtin:d,groups:[...x.values()].sort((n,a)=>n.label.localeCompare(a.label))}}function le(s){return s.replace(/^mcp__[^_]+(?:_[^_]+)*__/,"")}function re(s){return s.replace(/^\[[^\]]+\]\s*/,"")}function D({tool:s,checked:d,onToggle:x}){return e.jsxs("label",{className:"flex cursor-pointer items-start gap-2 text-[12px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:d,onChange:x}),e.jsxs("span",{className:"flex flex-col",children:[e.jsx("span",{className:"font-mono text-ink",children:le(s.name)}),s.description&&e.jsx("span",{className:"text-faint",children:re(s.description)})]})]})}function ie({group:s,selected:d,onToggleAll:x,onToggleOne:n}){const[a,i]=b.useState(!1),p=s.tools.map(l=>l.name),c=p.filter(l=>d.has(l)).length,o=c===p.length,g=c>0&&!o,u=b.useRef(null);return b.useEffect(()=>{u.current&&(u.current.indeterminate=g)},[g]),e.jsxs("div",{className:"rounded-md border border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-2",children:[e.jsx("input",{ref:u,type:"checkbox",checked:o,onChange:()=>x(p,!o)}),e.jsxs("button",{type:"button",onClick:()=>{j("agents","toggle_agent_tool_group"),i(l=>!l)},className:"flex flex-1 items-center gap-1.5 text-left text-[13px] text-ink",children:[e.jsx(ne,{size:12,className:q("shrink-0 text-faint transition-transform",a&&"rotate-90")}),s.label,e.jsxs("span",{className:"text-[11px] text-faint",children:["(",c,"/",p.length,")"]})]})]}),a&&e.jsx("div",{className:"flex flex-col gap-1.5 border-t border-border px-3 py-2 pl-9",children:s.tools.map(l=>e.jsx(D,{tool:l,checked:d.has(l.name),onToggle:()=>n(l.name)},l.name))})]})}function ce({tools:s,selected:d,onChange:x}){const n=new Set(d),{builtin:a,groups:i}=oe(s),p=o=>x(n.has(o)?d.filter(g=>g!==o):[...d,o]),c=(o,g)=>{const u=d.filter(l=>!o.includes(l));x(g?[...u,...o]:u)};return s.length===0?e.jsx("p",{className:"text-[12px] text-faint",children:"No tools available yet."}):e.jsxs("div",{className:"flex flex-col gap-2",children:[a.length>0&&e.jsx("div",{className:"flex flex-col gap-2 rounded-md border border-border bg-panel-2 p-3",children:a.map(o=>e.jsx(D,{tool:o,checked:n.has(o.name),onToggle:()=>p(o.name)},o.name))}),i.map(o=>e.jsx(ie,{group:o,selected:n,onToggleAll:c,onToggleOne:p},o.key))]})}function je(){const{agentId:s="new"}=W(),d=$(),x=G(),n=s==="new",a=!n&&B.some(t=>t.id===s),i=a?B.find(t=>t.id===s):void 0,p=H(),c=!n&&!a?(p.data??[]).find(t=>t.id===s):void 0,o=Y(),g=J(),u=U(),l=a?g.data?.[s]:void 0,I=z({queryKey:Z.list(),queryFn:X,staleTime:0}),k=I.data??[],w=z({queryKey:["available-tools"],queryFn:V}),N=w.data??[],[m,f]=b.useState(ae()),[S,T]=b.useState(!1),[A,P]=b.useState(!1),[L,R]=b.useState(!1),[E,Q]=b.useState("skills");n&&!S&&(k.length||N.length)&&(f(t=>({...t,skillIds:k.map(r=>r.id),tools:N.map(r=>r.name)})),T(!0)),!n&&!a&&!S&&c&&(f({name:c.name,description:c.description,systemPrompt:c.systemPrompt,skillIds:c.skillIds,tools:c.tools}),T(!0)),a&&!S&&i&&g.isSuccess&&(k.length||N.length)&&(f({name:l?.name??i.name,description:l?.description??i.description,systemPrompt:l?.systemPrompt??i.systemPrompt,skillIds:l?.skillIds??k.map(t=>t.id),tools:l?.tools??N.map(t=>t.name)}),T(!0));const y=()=>{j("agents","back_to_agents"),d("/customize")},O=t=>f(r=>({...r,skillIds:r.skillIds.includes(t)?r.skillIds.filter(v=>v!==t):[...r.skillIds,t]})),F=()=>{if(!m.name.trim()){h.error("Name is required.");return}P(!0);const t={name:m.name.trim(),description:m.description.trim(),systemPrompt:m.systemPrompt,skillIds:m.skillIds,tools:m.tools};if(a){u.save.mutate({id:s,override:t},{onSuccess:()=>{h.success("Agent saved."),y()},onError:v=>{h.error(v instanceof _?v.message:"Could not save agent."),P(!1)}});return}const r={onSuccess:()=>{x.invalidateQueries({queryKey:["chat-agents"]}),h.success(n?"Agent created.":"Agent saved."),y()},onError:v=>{h.error(v instanceof _?v.message:"Could not save agent."),P(!1)}};n?o.add.mutate(t,r):o.update.mutate({id:s,patch:t},r)},K=()=>{u.reset.mutate(s,{onSuccess:()=>{h.success("Reset to default."),i&&f({name:i.name,description:i.description,systemPrompt:i.systemPrompt,skillIds:k.map(t=>t.id),tools:N.map(t=>t.name)})},onError:t=>h.error(t instanceof _?t.message:"Could not reset agent.")})},M=()=>{o.remove.mutate(s,{onSuccess:()=>{h.success("Agent deleted."),y()},onError:t=>h.error(t instanceof _?t.message:"Could not delete agent.")})};return!n&&!a&&p.isSuccess&&!c?e.jsxs("div",{className:"flex w-full flex-col items-center gap-3 px-8 py-16",children:[e.jsx("p",{className:"text-[14px] text-muted",children:"That agent no longer exists."}),e.jsx(C,{size:"sm",variant:"outline",onClick:y,children:"Back to agents"})]}):e.jsxs("div",{className:"flex w-full max-w-4xl flex-col gap-5 px-4 py-6 md:px-8",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("button",{type:"button",onClick:y,className:"text-faint hover:text-ink",title:"Back to agents",children:e.jsx(ee,{size:18})}),e.jsx("span",{className:"text-[15px] font-medium text-ink",children:n?"New agent":a?l?"Edit agent (modified built-in)":"Edit agent (built-in)":"Edit agent"}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[a&&e.jsxs(C,{size:"sm",variant:"outline",onClick:()=>{j("agents","reset_agent_to_default"),K()},disabled:u.reset.isPending,children:[e.jsx(te,{size:13})," Reset to default"]}),e.jsx(C,{size:"sm",variant:"outline",onClick:y,children:"Cancel"}),e.jsx(C,{size:"sm",onClick:()=>{j("agents","save_agent"),F()},disabled:A||!m.name.trim(),children:A?"Saving…":"Save"})]})]}),a&&e.jsx("p",{className:"rounded-md border border-border bg-panel px-3 py-2 text-[12px] text-muted",children:"Built-in agents can be edited in place — Reset to default discards your changes and restores TurboLLM's original prompt and access."}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-[12px] font-medium text-muted",children:"Name"}),e.jsx("input",{className:"rounded-md border border-border bg-bg px-3 py-1.5 text-[13px] text-ink outline-none focus:border-accent placeholder:text-faint",placeholder:"Release Notes Writer",value:m.name,onChange:t=>f(r=>({...r,name:t.target.value}))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-[12px] font-medium text-muted",children:"Description"}),e.jsx("input",{className:"rounded-md border border-border bg-bg px-3 py-1.5 text-[13px] text-ink outline-none focus:border-accent placeholder:text-faint",placeholder:"What this agent is for, in one line",value:m.description,onChange:t=>f(r=>({...r,description:t.target.value}))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{className:"text-[12px] font-medium text-muted",children:"System prompt"}),e.jsx("textarea",{className:"min-h-[160px] resize-y rounded-md border border-border bg-bg px-3 py-2 font-mono text-[12px] leading-relaxed text-ink outline-none focus:border-accent placeholder:text-faint",placeholder:"You are…",value:m.systemPrompt,onChange:t=>f(r=>({...r,systemPrompt:t.target.value}))})]}),e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsx("div",{className:"inline-flex w-fit rounded-md border border-border p-0.5",children:["skills","tools"].map(t=>e.jsx("button",{type:"button",onClick:()=>{j("agents","switch_agent_form_tab"),Q(t)},className:q("rounded px-3 py-1.5 text-[13px] font-medium transition-colors",E===t?"bg-accent/12 text-accent":"text-muted hover:text-ink"),children:t==="skills"?`Skills (${m.skillIds.length})`:`Tools (${m.tools.length})`},t))}),E==="skills"?I.isLoading?e.jsx("p",{className:"text-[12px] text-faint",children:"Loading…"}):k.length===0?e.jsx("p",{className:"text-[12px] text-faint",children:"No skills yet — create one under Customize → Skills."}):e.jsx("div",{className:"flex flex-col gap-2 rounded-md border border-border bg-panel-2 p-3",children:k.map(t=>e.jsxs("label",{className:"flex cursor-pointer items-start gap-2 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:m.skillIds.includes(t.id),onChange:()=>O(t.id)}),e.jsxs("span",{className:"flex flex-col",children:[e.jsx("span",{className:"text-ink",children:t.name}),t.description&&e.jsx("span",{className:"text-[12px] text-muted",children:t.description})]})]},t.id))}):w.isLoading?e.jsx("p",{className:"text-[12px] text-faint",children:"Loading…"}):e.jsx(ce,{tools:N,selected:m.tools,onChange:t=>f(r=>({...r,tools:t}))})]}),!n&&!a&&(L?e.jsxs("div",{className:"flex items-center gap-2 self-start rounded-md border border-border bg-panel p-2 text-[12px]",children:[e.jsx("span",{className:"flex-1 text-muted",children:"Delete this agent?"}),e.jsx("button",{type:"button",onClick:()=>{j("agents","delete_agent"),M()},className:"rounded px-2 py-1 text-[color:var(--err)] hover:bg-[color:color-mix(in_srgb,var(--err)_12%,transparent)]",children:"Delete"}),e.jsx("button",{type:"button",onClick:()=>{j("agents","cancel_delete_agent"),R(!1)},className:"rounded px-2 py-1 text-faint hover:text-ink",children:"Cancel"})]}):e.jsxs("button",{type:"button",onClick:()=>R(!0),className:"flex items-center gap-1.5 self-start text-[12px] text-faint hover:text-[color:var(--err)]",children:[e.jsx(se,{size:13})," Delete agent"]}))]})}export{je as AgentEditPage};