@tangle-network/agent-app 0.61.4 → 0.62.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 (307) hide show
  1. package/dist/{DesignCanvas-L6J72JQ2.js → DesignCanvas-IQKYAEC4.js} +3 -2
  2. package/dist/{DesignCanvasEditor-QFQD63MR.js → DesignCanvasEditor-O7OCZTGC.js} +5 -4
  3. package/dist/{TimelineEditor-7KBPJQLT.js → TimelineEditor-VB2UJ34D.js} +4 -2
  4. package/dist/VaultPane-AYW7CO33.js +8 -0
  5. package/dist/agent-profiles/d1.js +1 -1
  6. package/dist/agent-profiles/index.d.ts +0 -82
  7. package/dist/agent-profiles/index.js +1 -21
  8. package/dist/agent-profiles/self-management.d.ts +0 -55
  9. package/dist/alerting/index.d.ts +1 -1
  10. package/dist/alerting/index.js +1 -3
  11. package/dist/alerting/slack.d.ts +6 -79
  12. package/dist/app-auth/drizzle.d.ts +17 -271
  13. package/dist/app-auth/drizzle.js +6 -2
  14. package/dist/app-auth/drizzle.js.map +1 -1
  15. package/dist/app-auth/index.js +3 -3
  16. package/dist/assets/types.d.ts +2 -1
  17. package/dist/assistant/AssistantPanel.d.ts +1 -1
  18. package/dist/assistant/index.js +635 -392
  19. package/dist/assistant/index.js.map +1 -1
  20. package/dist/billing/identity-locks.d.ts +5 -0
  21. package/dist/billing/index.js +1 -1
  22. package/dist/brand-extraction/index.js.map +1 -1
  23. package/dist/brand-extraction/types.d.ts +2 -1
  24. package/dist/chat-react/index.js +6 -5
  25. package/dist/chat-routes/attachment-write-safety.d.ts +4 -0
  26. package/dist/chat-routes/draft-persistence.d.ts +2 -14
  27. package/dist/chat-routes/index.d.ts +1 -0
  28. package/dist/chat-routes/index.js +853 -773
  29. package/dist/chat-routes/index.js.map +1 -1
  30. package/dist/chat-routes/sandbox-model-source.d.ts +20 -0
  31. package/dist/chat-routes/stored-attachments.d.ts +18 -0
  32. package/dist/chat-routes/turn-admission.d.ts +1 -1
  33. package/dist/chat-routes/turn-execution.d.ts +2 -2
  34. package/dist/chat-routes/turn-route-contracts.d.ts +3 -29
  35. package/dist/chat-store/core.d.ts +19 -1
  36. package/dist/chat-store/index.js.map +1 -1
  37. package/dist/chat-store/store.d.ts +3 -29
  38. package/dist/{chunk-ATQQCG4I.js → chunk-2VJLLRVV.js} +2 -2
  39. package/dist/{chunk-R4X5474U.js → chunk-52SDU43B.js} +12 -27
  40. package/dist/chunk-52SDU43B.js.map +1 -0
  41. package/dist/{chunk-MDRH3SDA.js → chunk-54YIL7WM.js} +3 -3
  42. package/dist/{chunk-6QJ3GB3A.js → chunk-5GSZGTPJ.js} +2 -2
  43. package/dist/{chunk-5IM2CLYX.js → chunk-6JEDSKFH.js} +232 -218
  44. package/dist/chunk-6JEDSKFH.js.map +1 -0
  45. package/dist/{chunk-6PRQ45QE.js → chunk-6OG4244Y.js} +1 -1
  46. package/dist/chunk-6OG4244Y.js.map +1 -0
  47. package/dist/{chunk-ZDPUC6CM.js → chunk-6ZVSMA4T.js} +3 -3
  48. package/dist/{chunk-TXUAGSFR.js → chunk-76MPX7JQ.js} +47 -1
  49. package/dist/chunk-76MPX7JQ.js.map +1 -0
  50. package/dist/{chunk-BOQ4HVVH.js → chunk-7ISHKBAD.js} +61 -52
  51. package/dist/chunk-7ISHKBAD.js.map +1 -0
  52. package/dist/chunk-7PULOECS.js +22 -0
  53. package/dist/chunk-7PULOECS.js.map +1 -0
  54. package/dist/{chunk-KJODHPWM.js → chunk-CPVGRQ43.js} +511 -339
  55. package/dist/chunk-CPVGRQ43.js.map +1 -0
  56. package/dist/{chunk-LO6VQ35O.js → chunk-CQZVJVME.js} +2 -2
  57. package/dist/{chunk-Y43PXON2.js → chunk-EFQUAWWF.js} +577 -546
  58. package/dist/chunk-EFQUAWWF.js.map +1 -0
  59. package/dist/{chunk-FPNZMIAW.js → chunk-ELX5YITO.js} +1 -1
  60. package/dist/chunk-ELX5YITO.js.map +1 -0
  61. package/dist/chunk-FGAROAUF.js +19 -0
  62. package/dist/chunk-FGAROAUF.js.map +1 -0
  63. package/dist/{chunk-HN6MZ2XL.js → chunk-FTNGGR37.js} +641 -466
  64. package/dist/chunk-FTNGGR37.js.map +1 -0
  65. package/dist/{chunk-G4F2NWZH.js → chunk-FZ3ZFVAC.js} +4 -4
  66. package/dist/{chunk-UCCSJX64.js → chunk-GIEUZBQQ.js} +1112 -644
  67. package/dist/chunk-GIEUZBQQ.js.map +1 -0
  68. package/dist/{chunk-MEKOWH5E.js → chunk-IVBREL7A.js} +785 -526
  69. package/dist/chunk-IVBREL7A.js.map +1 -0
  70. package/dist/{chunk-WSEXFTN4.js → chunk-JBXNU5WD.js} +26 -26
  71. package/dist/chunk-JBXNU5WD.js.map +1 -0
  72. package/dist/{chunk-F2VX6TTJ.js → chunk-JRCZHDRG.js} +2 -41
  73. package/dist/chunk-JRCZHDRG.js.map +1 -0
  74. package/dist/{chunk-LXYQOOXU.js → chunk-JRW6LCIA.js} +552 -302
  75. package/dist/chunk-JRW6LCIA.js.map +1 -0
  76. package/dist/{chunk-TVPH5T4F.js → chunk-KS4I7KVC.js} +16 -22
  77. package/dist/{chunk-TVPH5T4F.js.map → chunk-KS4I7KVC.js.map} +1 -1
  78. package/dist/{chunk-J2BBYVGF.js → chunk-MRZP65DZ.js} +1 -117
  79. package/dist/chunk-MRZP65DZ.js.map +1 -0
  80. package/dist/{chunk-4ZSLX3LY.js → chunk-OODZCBSM.js} +1 -1
  81. package/dist/chunk-OODZCBSM.js.map +1 -0
  82. package/dist/chunk-P4RRC4AO.js +47 -0
  83. package/dist/chunk-P4RRC4AO.js.map +1 -0
  84. package/dist/{chunk-ORQD4AUO.js → chunk-PCAY23GS.js} +1 -6
  85. package/dist/chunk-PCAY23GS.js.map +1 -0
  86. package/dist/{chunk-NMZUW6VJ.js → chunk-PEJ5OP5B.js} +3 -3
  87. package/dist/chunk-PEJ5OP5B.js.map +1 -0
  88. package/dist/{chunk-NHYRIM4I.js → chunk-PIPNDZ6H.js} +304 -194
  89. package/dist/chunk-PIPNDZ6H.js.map +1 -0
  90. package/dist/{chunk-L7LQRJGD.js → chunk-TCJ4TMOW.js} +37 -33
  91. package/dist/{chunk-L7LQRJGD.js.map → chunk-TCJ4TMOW.js.map} +1 -1
  92. package/dist/chunk-UHSUY6H6.js +79 -0
  93. package/dist/chunk-UHSUY6H6.js.map +1 -0
  94. package/dist/{chunk-PDD5A43Y.js → chunk-UTL6TEN6.js} +3 -3
  95. package/dist/{chunk-VJBFCNAU.js → chunk-UW2DKTEM.js} +123 -130
  96. package/dist/chunk-UW2DKTEM.js.map +1 -0
  97. package/dist/{chunk-S27DKRI6.js → chunk-VDYEVCQQ.js} +2 -2
  98. package/dist/{chunk-UFQM46NV.js → chunk-VK3F4N4U.js} +2 -2
  99. package/dist/{chunk-6ZIC6OG5.js → chunk-VYBTQK25.js} +126 -122
  100. package/dist/chunk-VYBTQK25.js.map +1 -0
  101. package/dist/{chunk-RL3Z747H.js → chunk-W2BV2XOC.js} +1491 -700
  102. package/dist/chunk-W2BV2XOC.js.map +1 -0
  103. package/dist/{chunk-FUZETA6Z.js → chunk-X6SZGQTK.js} +2 -2
  104. package/dist/{chunk-CD2LQXY6.js → chunk-XOHE6SKU.js} +14 -16
  105. package/dist/{chunk-CD2LQXY6.js.map → chunk-XOHE6SKU.js.map} +1 -1
  106. package/dist/{chunk-ZBB5KQ6B.js → chunk-Y3GO6SG3.js} +73 -66
  107. package/dist/chunk-Y3GO6SG3.js.map +1 -0
  108. package/dist/chunk-ZAMHLXNS.js +56 -0
  109. package/dist/chunk-ZAMHLXNS.js.map +1 -0
  110. package/dist/{chunk-RHFN7TUV.js → chunk-ZDHCV462.js} +47 -44
  111. package/dist/{chunk-RHFN7TUV.js.map → chunk-ZDHCV462.js.map} +1 -1
  112. package/dist/chunk-ZOS3D26Z.js +72 -0
  113. package/dist/chunk-ZOS3D26Z.js.map +1 -0
  114. package/dist/design-canvas/index.js +32 -32
  115. package/dist/design-canvas/index.js.map +1 -1
  116. package/dist/design-canvas-react/components/DesignCanvas.d.ts +1 -1
  117. package/dist/design-canvas-react/components/Workspace.d.ts +1 -1
  118. package/dist/design-canvas-react/components/glyphs.d.ts +31 -40
  119. package/dist/design-canvas-react/components/transform-math.d.ts +0 -8
  120. package/dist/design-canvas-react/components/use-workspace-keyboard.d.ts +2 -2
  121. package/dist/design-canvas-react/contracts.d.ts +2 -2
  122. package/dist/design-canvas-react/engine.js +1 -1
  123. package/dist/design-canvas-react/index.js +9 -7
  124. package/dist/design-canvas-react/index.js.map +1 -1
  125. package/dist/design-canvas-react/lazy.js +1 -1
  126. package/dist/eval/calibration.d.ts +1 -38
  127. package/dist/eval/index.d.ts +2 -4
  128. package/dist/eval/index.js +0 -84
  129. package/dist/eval/index.js.map +1 -1
  130. package/dist/harness/index.d.ts +1 -1
  131. package/dist/harness/index.js +1 -1
  132. package/dist/harness/session-selection.d.ts +2 -2
  133. package/dist/hub-approvals/index.js +1 -1
  134. package/dist/hub-approvals/result.d.ts +1 -1
  135. package/dist/hub-approvals-react/index.js +4 -4
  136. package/dist/hub-approvals-react/index.js.map +1 -1
  137. package/dist/hub-approvals-react/parts.d.ts +1 -1
  138. package/dist/launch-invariants/cli.js +4 -4
  139. package/dist/launch-invariants/index.js +3 -3
  140. package/dist/launch-invariants/testing.js +4 -4
  141. package/dist/legibility/cli.js +1 -1
  142. package/dist/legibility/index.js +1 -1
  143. package/dist/{mention-editor-B23OMFT2.js → mention-editor-4BKBMWIK.js} +83 -57
  144. package/dist/mention-editor-4BKBMWIK.js.map +1 -0
  145. package/dist/missions/index.js +144 -137
  146. package/dist/missions/index.js.map +1 -1
  147. package/dist/operator/index.js +1 -1
  148. package/dist/peer-floors/check.js +1 -1
  149. package/dist/peer-floors/cli.js +6 -14
  150. package/dist/peer-floors/cli.js.map +1 -1
  151. package/dist/peer-floors/source-entries.d.ts +6 -0
  152. package/dist/platform/index.js +10 -10
  153. package/dist/preset-cloudflare/index.js +1 -1
  154. package/dist/profile/index.d.ts +0 -1
  155. package/dist/profile/index.js +1 -422
  156. package/dist/profile/index.js.map +1 -1
  157. package/dist/profile-editor/server.d.ts +0 -1
  158. package/dist/profile-editor/server.js +0 -1
  159. package/dist/profile-editor/server.js.map +1 -1
  160. package/dist/public-consultation/index.d.ts +2 -2
  161. package/dist/public-consultation/index.js +6 -6
  162. package/dist/record/drizzle.js +156 -148
  163. package/dist/record/drizzle.js.map +1 -1
  164. package/dist/runtime/index.js +4 -4
  165. package/dist/runtime/router-turn.js +3 -3
  166. package/dist/sandbox/index.js +5 -5
  167. package/dist/sequences/drizzle.js +5 -15
  168. package/dist/sequences/drizzle.js.map +1 -1
  169. package/dist/sequences/index.d.ts +1 -0
  170. package/dist/sequences/index.js +18 -14
  171. package/dist/sequences/index.js.map +1 -1
  172. package/dist/sequences/row-mapping.d.ts +7 -0
  173. package/dist/sequences-react/components/TimelineEditor.d.ts +0 -40
  174. package/dist/sequences-react/components/TimelineHistory.d.ts +31 -0
  175. package/dist/sequences-react/components/glyphs.d.ts +12 -21
  176. package/dist/sequences-react/components/index.d.ts +0 -2
  177. package/dist/sequences-react/components/interaction-math.d.ts +3 -3
  178. package/dist/sequences-react/contracts.d.ts +1 -1
  179. package/dist/sequences-react/engine/snap.d.ts +2 -2
  180. package/dist/sequences-react/index.js +4 -4
  181. package/dist/sequences-react/index.js.map +1 -1
  182. package/dist/settings-react/index.js +13 -30
  183. package/dist/settings-react/index.js.map +1 -1
  184. package/dist/settings-react/timezone-picker.d.ts +0 -6
  185. package/dist/signoff/browser-budget.d.ts +6 -1
  186. package/dist/signoff/cli.d.ts +0 -7
  187. package/dist/signoff/cli.js +1 -2
  188. package/dist/signoff/cli.js.map +1 -1
  189. package/dist/signoff/index.js +1 -1
  190. package/dist/skills/index.d.ts +1 -1
  191. package/dist/skills/index.js +5 -25
  192. package/dist/skills/marketplace.d.ts +1 -75
  193. package/dist/skills-placement/box.js +3 -4
  194. package/dist/skills-placement/box.js.map +1 -1
  195. package/dist/skills-placement/index.js +3 -4
  196. package/dist/spend/cli-args.d.ts +1 -1
  197. package/dist/spend/cli.js +3 -3
  198. package/dist/spend/cli.js.map +1 -1
  199. package/dist/spend/index.js +1 -1
  200. package/dist/stories/design-canvas/fixtures.d.ts +1 -14
  201. package/dist/stream/index.js +17 -17
  202. package/dist/studio/generation.d.ts +1 -1
  203. package/dist/studio/index.js +1 -1
  204. package/dist/studio-react/index.js +353 -184
  205. package/dist/studio-react/index.js.map +1 -1
  206. package/dist/studio-react/studio-composer.d.ts +1 -5
  207. package/dist/studio-react/studio-history-screen.d.ts +1 -1
  208. package/dist/teams/invitations-api.d.ts +3 -3
  209. package/dist/teams/invitations-api.js +74 -72
  210. package/dist/teams/invitations-api.js.map +1 -1
  211. package/dist/teams/member-sync.d.ts +2 -0
  212. package/dist/teams/members-api.d.ts +2 -2
  213. package/dist/teams/members-api.js +1 -1
  214. package/dist/teams-react/index.js +28 -45
  215. package/dist/teams-react/index.js.map +1 -1
  216. package/dist/tools/index.js +1 -1
  217. package/dist/tools/mcp-arguments.d.ts +1 -1
  218. package/dist/trace/index.d.ts +1 -18
  219. package/dist/trace/index.js +1 -36
  220. package/dist/trace/index.js.map +1 -1
  221. package/dist/trace/mission-flow.d.ts +1 -59
  222. package/dist/turn-health/index.d.ts +1 -1
  223. package/dist/turn-health/index.js +2 -2
  224. package/dist/turn-health/sink.d.ts +2 -1
  225. package/dist/turn-trace/index.js +2 -4
  226. package/dist/turn-trace/recorder.d.ts +0 -2
  227. package/dist/vault/VaultPane.d.ts +0 -20
  228. package/dist/vault/VaultPaneOperations.d.ts +318 -0
  229. package/dist/vault/index.js +2 -1
  230. package/dist/vault/index.js.map +1 -1
  231. package/dist/vault/lazy.js +1 -1
  232. package/dist/web-react/agent-profile-editor.d.ts +1 -2
  233. package/dist/web-react/agent-profile-editor.js +6 -5
  234. package/dist/web-react/chat-composer.d.ts +1 -1
  235. package/dist/web-react/durable-plan-flow.d.ts +6 -1
  236. package/dist/web-react/editor-glyphs.d.ts +12 -0
  237. package/dist/web-react/focus-navigation.d.ts +12 -0
  238. package/dist/web-react/history-controls.d.ts +37 -0
  239. package/dist/web-react/index.js +36 -34
  240. package/dist/web-react/interaction-question-card.d.ts +1 -1
  241. package/dist/web-react/record-grid-writes.d.ts +31 -0
  242. package/dist/web-react/record-grid.d.ts +1 -48
  243. package/dist/web-react/session-history-panel.d.ts +1 -9
  244. package/dist/web-react/use-document-dark.d.ts +1 -0
  245. package/dist/workspace-export/engine.d.ts +1 -6
  246. package/dist/workspace-export/index.js +198 -185
  247. package/dist/workspace-export/index.js.map +1 -1
  248. package/dist/workspace-export/routes.d.ts +1 -1
  249. package/dist/workspace-react/index.js +9 -8
  250. package/dist/workspace-react/index.js.map +1 -1
  251. package/package.json +1 -11
  252. package/dist/VaultPane-RXL3WLA2.js +0 -7
  253. package/dist/agent-profiles/reaper.d.ts +0 -31
  254. package/dist/agent-profiles/reaper.js +0 -29
  255. package/dist/agent-profiles/reaper.js.map +0 -1
  256. package/dist/chunk-4ZSLX3LY.js.map +0 -1
  257. package/dist/chunk-5IM2CLYX.js.map +0 -1
  258. package/dist/chunk-6OSJNJA2.js +0 -251
  259. package/dist/chunk-6OSJNJA2.js.map +0 -1
  260. package/dist/chunk-6PRQ45QE.js.map +0 -1
  261. package/dist/chunk-6ZIC6OG5.js.map +0 -1
  262. package/dist/chunk-BDEBQ4WO.js +0 -38
  263. package/dist/chunk-BDEBQ4WO.js.map +0 -1
  264. package/dist/chunk-BOQ4HVVH.js.map +0 -1
  265. package/dist/chunk-F2VX6TTJ.js.map +0 -1
  266. package/dist/chunk-FPNZMIAW.js.map +0 -1
  267. package/dist/chunk-HN6MZ2XL.js.map +0 -1
  268. package/dist/chunk-J2BBYVGF.js.map +0 -1
  269. package/dist/chunk-KJODHPWM.js.map +0 -1
  270. package/dist/chunk-LTWJYNEC.js +0 -100
  271. package/dist/chunk-LTWJYNEC.js.map +0 -1
  272. package/dist/chunk-LXYQOOXU.js.map +0 -1
  273. package/dist/chunk-MEKOWH5E.js.map +0 -1
  274. package/dist/chunk-NHYRIM4I.js.map +0 -1
  275. package/dist/chunk-NMZUW6VJ.js.map +0 -1
  276. package/dist/chunk-ORQD4AUO.js.map +0 -1
  277. package/dist/chunk-R4X5474U.js.map +0 -1
  278. package/dist/chunk-RL3Z747H.js.map +0 -1
  279. package/dist/chunk-TXUAGSFR.js.map +0 -1
  280. package/dist/chunk-UCCSJX64.js.map +0 -1
  281. package/dist/chunk-VJBFCNAU.js.map +0 -1
  282. package/dist/chunk-WSEXFTN4.js.map +0 -1
  283. package/dist/chunk-Y43PXON2.js.map +0 -1
  284. package/dist/chunk-ZBB5KQ6B.js.map +0 -1
  285. package/dist/eval/parity.d.ts +0 -74
  286. package/dist/mention-editor-B23OMFT2.js.map +0 -1
  287. package/dist/profile/humanizer-skill.d.ts +0 -23
  288. package/dist/profile/humanizer-skill.vendored.d.ts +0 -4
  289. package/dist/sequences-react/components/BrandMark.d.ts +0 -10
  290. package/dist/skills/marketplace-drizzle.d.ts +0 -121
  291. package/dist/skills/marketplace-drizzle.js +0 -34
  292. package/dist/skills/marketplace-drizzle.js.map +0 -1
  293. package/dist/teams-react/components/BrandMark.d.ts +0 -10
  294. /package/dist/{DesignCanvas-L6J72JQ2.js.map → DesignCanvas-IQKYAEC4.js.map} +0 -0
  295. /package/dist/{DesignCanvasEditor-QFQD63MR.js.map → DesignCanvasEditor-O7OCZTGC.js.map} +0 -0
  296. /package/dist/{TimelineEditor-7KBPJQLT.js.map → TimelineEditor-VB2UJ34D.js.map} +0 -0
  297. /package/dist/{VaultPane-RXL3WLA2.js.map → VaultPane-AYW7CO33.js.map} +0 -0
  298. /package/dist/{chunk-ATQQCG4I.js.map → chunk-2VJLLRVV.js.map} +0 -0
  299. /package/dist/{chunk-MDRH3SDA.js.map → chunk-54YIL7WM.js.map} +0 -0
  300. /package/dist/{chunk-6QJ3GB3A.js.map → chunk-5GSZGTPJ.js.map} +0 -0
  301. /package/dist/{chunk-ZDPUC6CM.js.map → chunk-6ZVSMA4T.js.map} +0 -0
  302. /package/dist/{chunk-LO6VQ35O.js.map → chunk-CQZVJVME.js.map} +0 -0
  303. /package/dist/{chunk-G4F2NWZH.js.map → chunk-FZ3ZFVAC.js.map} +0 -0
  304. /package/dist/{chunk-PDD5A43Y.js.map → chunk-UTL6TEN6.js.map} +0 -0
  305. /package/dist/{chunk-S27DKRI6.js.map → chunk-VDYEVCQQ.js.map} +0 -0
  306. /package/dist/{chunk-UFQM46NV.js.map → chunk-VK3F4N4U.js.map} +0 -0
  307. /package/dist/{chunk-FUZETA6Z.js.map → chunk-X6SZGQTK.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  HarnessPicker,
3
3
  filterAcceptedFiles
4
- } from "./chunk-G4F2NWZH.js";
4
+ } from "./chunk-FZ3ZFVAC.js";
5
5
  import {
6
6
  EffortPicker,
7
7
  ModelPicker,
@@ -9,7 +9,7 @@ import {
9
9
  POPOVER_OPTION_FOCUS,
10
10
  PopoverSurface,
11
11
  effortLevelsFromIds
12
- } from "./chunk-R4X5474U.js";
12
+ } from "./chunk-52SDU43B.js";
13
13
  import {
14
14
  isCommitSha,
15
15
  parseGitHubLocation,
@@ -19,7 +19,7 @@ import {
19
19
  import {
20
20
  isModelCompatibleWithHarness,
21
21
  snapModelToHarness
22
- } from "./chunk-FPNZMIAW.js";
22
+ } from "./chunk-ELX5YITO.js";
23
23
 
24
24
  // src/web-react/agent-profile-editor.tsx
25
25
  import { useEffect as useEffect4, useId as useId5, useMemo as useMemo3, useState as useState7 } from "react";
@@ -1276,7 +1276,7 @@ function defaultThinkingLevels({ harness, model }) {
1276
1276
  const efforts = harness ? reasoningEffortsFor(harness, { supportsReasoning: model?.supportsReasoning !== false }) : REASONING_EFFORTS;
1277
1277
  return [{ id: "auto", label: "Auto" }, ...effortLevelsFromIds(efforts)];
1278
1278
  }
1279
- function AgentProfileEditor({
1279
+ function useAgentProfileEditorViewState({
1280
1280
  value,
1281
1281
  onChange,
1282
1282
  disabled = false,
@@ -1474,433 +1474,312 @@ function AgentProfileEditor({
1474
1474
  }
1475
1475
  ) });
1476
1476
  }
1477
- const github = config?.github;
1478
- function refFromCheck(check, name) {
1479
- return github?.storage === "inline" ? { kind: "inline", name, content: check.content } : { kind: "github", repository: check.repository, path: check.path, ref: check.commit.sha, ...name ? { name } : {} };
1480
- }
1481
- function addRef(section, ref, index) {
1482
- const refs = section === "skills" ? skills : toolFiles;
1483
- const issue = section === "skills" ? skillIssue(ref, refs, index ?? refs.length) : githubRefIssue(ref, requireGitHubCommitSha);
1484
- if (issue) {
1485
- setError(issue);
1486
- return false;
1487
- }
1488
- const next = index === void 0 ? [...refs, ref] : refs.map((item, position) => position === index ? ref : item);
1489
- return resources(section, next);
1490
- }
1491
- function addFile(mount, index) {
1492
- const issue = fileIssue(mount, index ?? files.length);
1493
- if (issue) {
1494
- setError(issue);
1495
- return false;
1496
- }
1497
- return setFiles(index === void 0 ? [...files, mount] : files.map((item, position) => position === index ? mount : item));
1498
- }
1499
- function nameField(check, section) {
1500
- const fieldId = `${id}-${section}-github-name`;
1501
- const suggested = check ? section === "skills" ? suggestedSkillName(check) : basename(check.path) : "";
1502
- const name = githubName.touched ? githubName.value : suggested;
1503
- const problem = section === "skills" && requireUniqueSkillNames && name ? skillIssue({ kind: "inline", name, content: "" }, skills) : null;
1504
- return /* @__PURE__ */ jsx7(
1505
- Field,
1506
- {
1507
- label: section === "skills" ? "Skill name" : "File name",
1508
- htmlFor: fieldId,
1509
- error: problem,
1510
- hint: section === "skills" && !problem ? "Shown to the agent in its skill list." : void 0,
1511
- children: /* @__PURE__ */ jsx7(
1512
- Input5,
1513
- {
1514
- id: fieldId,
1515
- size: "compact",
1516
- value: name,
1517
- disabled: editingDisabled || !check,
1518
- ...noAutofill,
1519
- "aria-invalid": problem ? true : void 0,
1520
- "aria-describedby": fieldMessageId(fieldId),
1521
- onChange: (event) => setGithubName({ value: event.target.value, touched: true })
1522
- }
1523
- )
1524
- }
1525
- );
1526
- }
1527
- function githubNameValue(check, section) {
1528
- return (githubName.touched ? githubName.value : section === "skills" ? suggestedSkillName(check) : basename(check.path)).trim();
1529
- }
1530
- function inlineEditor(section, index) {
1531
- const prefix = `${id}-${section}-inline`;
1532
- const isSkill = section === "skills";
1533
- const isFile = section === "files";
1534
- const name = inlineDraft.name.trim();
1535
- const frontmatter = isSkill && inlineDraft.content.trim() ? readSkillFrontmatter(inlineDraft.content) : null;
1536
- const mount = isFile ? {
1537
- path: inlineDraft.path.trim(),
1538
- resource: { kind: "inline", name: name || basename(inlineDraft.path.trim()), content: inlineDraft.content },
1539
- ...inlineDraft.executable ? { executable: true } : {}
1540
- } : null;
1541
- const problem = isFile ? inlineDraft.path.trim() ? fileIssue(mount, index ?? files.length) : null : isSkill && name ? skillIssue({ kind: "inline", name, content: inlineDraft.content }, skills, index ?? skills.length) : null;
1542
- const ready = !editingDisabled && !problem && (isFile ? inlineDraft.path.trim() !== "" : name !== "");
1543
- return /* @__PURE__ */ jsxs7("div", { className: "space-y-4 rounded-lg border border-border bg-muted/30 p-4", children: [
1544
- isFile ? /* @__PURE__ */ jsx7(
1545
- Field,
1477
+ const {
1478
+ github,
1479
+ refFromCheck,
1480
+ addRef,
1481
+ addFile,
1482
+ nameField,
1483
+ githubNameValue,
1484
+ inlineEditor,
1485
+ githubEditor,
1486
+ rowActions: rowActions2,
1487
+ refList,
1488
+ addButtons
1489
+ } = createProfileResourceEditors({
1490
+ config,
1491
+ skills,
1492
+ toolFiles,
1493
+ skillIssue,
1494
+ requireGitHubCommitSha,
1495
+ setError,
1496
+ resources,
1497
+ fileIssue,
1498
+ files,
1499
+ setFiles,
1500
+ id,
1501
+ githubName,
1502
+ requireUniqueSkillNames,
1503
+ editingDisabled,
1504
+ setGithubName,
1505
+ inlineDraft,
1506
+ workspaceFilePrefix,
1507
+ setInlineDraft,
1508
+ allowExecutableFiles,
1509
+ openPanel,
1510
+ panel
1511
+ });
1512
+ const countLabel = (count, noun) => count ? `${count} ${noun}${count === 1 ? "" : "s"}` : void 0;
1513
+ const toolNames = Object.keys(value.tools ?? {});
1514
+ return {
1515
+ className,
1516
+ error,
1517
+ jsonDirty,
1518
+ unsupportedResources,
1519
+ value,
1520
+ constrainedEntryCount,
1521
+ invalidMcpCount,
1522
+ show,
1523
+ config,
1524
+ id,
1525
+ editingDisabled,
1526
+ emit,
1527
+ prompt,
1528
+ moreOpen,
1529
+ setMoreOpen,
1530
+ modelField,
1531
+ harness,
1532
+ changeHarness,
1533
+ catalog,
1534
+ thinkingLevels,
1535
+ model,
1536
+ modelNotice,
1537
+ countLabel,
1538
+ toolNames,
1539
+ showAllTools,
1540
+ setShowAllTools,
1541
+ newTool,
1542
+ setNewTool,
1543
+ setError,
1544
+ skills,
1545
+ panel,
1546
+ refList,
1547
+ addButtons,
1548
+ registry,
1549
+ skillIssue,
1550
+ resources,
1551
+ toolFiles,
1552
+ publicHttpsMcpOnly,
1553
+ setMcpPending,
1554
+ files,
1555
+ fileIssue,
1556
+ rowActions: rowActions2,
1557
+ github,
1558
+ githubEditor,
1559
+ inlineEditor,
1560
+ workspaceFilePrefix,
1561
+ openPanel,
1562
+ setFiles,
1563
+ disabled,
1564
+ json,
1565
+ setJson,
1566
+ setJsonDirty,
1567
+ applyJson
1568
+ };
1569
+ }
1570
+ function AgentProfileEditor(props) {
1571
+ const view = useAgentProfileEditorViewState(props);
1572
+ return /* @__PURE__ */ jsx7(AgentProfileEditorView, { ...view });
1573
+ }
1574
+ function AgentProfileEditorView({
1575
+ className,
1576
+ error,
1577
+ jsonDirty,
1578
+ unsupportedResources,
1579
+ value,
1580
+ constrainedEntryCount,
1581
+ invalidMcpCount,
1582
+ show,
1583
+ config,
1584
+ id,
1585
+ editingDisabled,
1586
+ emit,
1587
+ prompt,
1588
+ moreOpen,
1589
+ setMoreOpen,
1590
+ modelField,
1591
+ harness,
1592
+ changeHarness,
1593
+ catalog,
1594
+ thinkingLevels,
1595
+ model,
1596
+ modelNotice,
1597
+ countLabel,
1598
+ toolNames,
1599
+ showAllTools,
1600
+ setShowAllTools,
1601
+ newTool,
1602
+ setNewTool,
1603
+ setError,
1604
+ skills,
1605
+ panel,
1606
+ refList,
1607
+ addButtons,
1608
+ registry,
1609
+ skillIssue,
1610
+ resources,
1611
+ toolFiles,
1612
+ publicHttpsMcpOnly,
1613
+ setMcpPending,
1614
+ files,
1615
+ fileIssue,
1616
+ rowActions: rowActions2,
1617
+ github,
1618
+ githubEditor,
1619
+ inlineEditor,
1620
+ workspaceFilePrefix,
1621
+ openPanel,
1622
+ setFiles,
1623
+ disabled,
1624
+ json,
1625
+ setJson,
1626
+ setJsonDirty,
1627
+ applyJson
1628
+ }) {
1629
+ return /* @__PURE__ */ jsx7(TooltipProvider, { delayDuration: 150, children: /* @__PURE__ */ jsxs7("div", { className: `@container/profile-editor min-w-0 space-y-4 ${className ?? ""}`, "aria-label": "Agent profile editor", children: [
1630
+ error && /* @__PURE__ */ jsx7(Notice, { tone: "error", children: error }),
1631
+ jsonDirty && /* @__PURE__ */ jsx7(Notice, { tone: "info", children: "Apply or discard your Advanced JSON edits before changing other fields." }),
1632
+ unsupportedResources.length > 0 && /* @__PURE__ */ jsxs7(Notice, { tone: "error", children: [
1633
+ "This profile has resources this product does not use: ",
1634
+ unsupportedResources.map((kind) => `${RESOURCE_KIND_LABELS[kind]} (${configuredResourceCount(value, kind)})`).join(", "),
1635
+ ". Remove them in Advanced JSON before saving."
1636
+ ] }),
1637
+ constrainedEntryCount > 0 && /* @__PURE__ */ jsxs7(Notice, { tone: "error", children: [
1638
+ constrainedEntryCount === 1 ? "One resource needs" : `${constrainedEntryCount} resources need`,
1639
+ " a fix before this profile can be saved. The affected rows say what to change."
1640
+ ] }),
1641
+ invalidMcpCount > 0 && /* @__PURE__ */ jsxs7(Notice, { tone: "error", children: [
1642
+ invalidMcpCount === 1 ? "One MCP server needs" : `${invalidMcpCount} MCP servers need`,
1643
+ " a public HTTPS address before this profile can be saved."
1644
+ ] }),
1645
+ show.identity && /* @__PURE__ */ jsx7(Section, { title: "Identity", children: /* @__PURE__ */ jsxs7("div", { className: formRow, children: [
1646
+ config?.identity?.nameEditable !== false && /* @__PURE__ */ jsx7(Field, { label: "Name", htmlFor: `${id}-name`, children: /* @__PURE__ */ jsx7(
1647
+ Input5,
1546
1648
  {
1547
- label: "Workspace path",
1548
- htmlFor: `${prefix}-path`,
1549
- error: problem,
1550
- hint: !problem && workspaceFilePrefix ? `Files go under ${workspaceFilePrefix}` : void 0,
1551
- children: /* @__PURE__ */ jsx7(
1552
- Input5,
1553
- {
1554
- id: `${prefix}-path`,
1555
- size: "compact",
1556
- value: inlineDraft.path,
1557
- disabled: editingDisabled,
1558
- ...noAutofill,
1559
- placeholder: (workspaceFilePrefix ?? "") + "guide.md",
1560
- "aria-invalid": problem ? true : void 0,
1561
- "aria-describedby": fieldMessageId(`${prefix}-path`),
1562
- onChange: (event) => setInlineDraft({ ...inlineDraft, path: event.target.value })
1563
- }
1564
- )
1649
+ id: `${id}-name`,
1650
+ size: "compact",
1651
+ disabled: editingDisabled,
1652
+ value: value.name ?? "",
1653
+ ...noAutofill,
1654
+ onChange: (event) => emit({ ...value, name: event.target.value })
1565
1655
  }
1566
- ) : /* @__PURE__ */ jsx7(Field, { label: isSkill ? "Skill name" : "File name", htmlFor: `${prefix}-name`, error: problem, children: /* @__PURE__ */ jsx7(
1656
+ ) }),
1657
+ /* @__PURE__ */ jsx7(Field, { label: "Description", htmlFor: `${id}-description`, children: /* @__PURE__ */ jsx7(
1567
1658
  Input5,
1568
1659
  {
1569
- id: `${prefix}-name`,
1660
+ id: `${id}-description`,
1570
1661
  size: "compact",
1571
- value: inlineDraft.name,
1572
1662
  disabled: editingDisabled,
1663
+ value: value.description ?? "",
1573
1664
  ...noAutofill,
1574
- placeholder: isSkill ? "research" : "search.ts",
1575
- "aria-invalid": problem ? true : void 0,
1576
- "aria-describedby": fieldMessageId(`${prefix}-name`),
1577
- onChange: (event) => setInlineDraft({ ...inlineDraft, name: event.target.value })
1665
+ onChange: (event) => emit({ ...value, description: event.target.value })
1578
1666
  }
1579
- ) }),
1580
- /* @__PURE__ */ jsx7(
1667
+ ) })
1668
+ ] }) }),
1669
+ show.prompts && /* @__PURE__ */ jsxs7(Section, { title: "Instructions", description: "What the agent is told before every conversation.", children: [
1670
+ config?.prompts?.appendSystemPrompt !== false && /* @__PURE__ */ jsx7(
1581
1671
  Field,
1582
1672
  {
1583
- label: "Content",
1584
- htmlFor: `${prefix}-content`,
1585
- hint: frontmatter && !frontmatter.ok ? "Start the skill with frontmatter that sets name and description, so the agent knows when to use it." : void 0,
1673
+ label: "Additional instructions",
1674
+ htmlFor: `${id}-append`,
1675
+ info: "Added after the agent's built-in prompt, which stays in force. Leave it empty to add nothing.",
1586
1676
  children: /* @__PURE__ */ jsx7(
1587
1677
  Textarea,
1588
1678
  {
1589
- id: `${prefix}-content`,
1590
- className: "min-h-40 font-mono text-sm leading-6",
1679
+ id: `${id}-append`,
1680
+ className: "min-h-40 text-sm leading-6",
1591
1681
  disabled: editingDisabled,
1592
- value: inlineDraft.content,
1593
- onChange: (event) => setInlineDraft({ ...inlineDraft, content: event.target.value })
1682
+ value: value.prompt?.appendSystemPrompt ?? "",
1683
+ onChange: (event) => prompt({ ...value.prompt, appendSystemPrompt: event.target.value })
1594
1684
  }
1595
1685
  )
1596
1686
  }
1597
1687
  ),
1598
- isFile && (allowExecutableFiles || inlineDraft.executable) && /* @__PURE__ */ jsxs7("label", { className: `flex items-center gap-3 ${formText.body}`, children: [
1599
- /* @__PURE__ */ jsx7(
1600
- Switch2,
1688
+ (config?.prompts?.systemPrompt !== false || config?.prompts?.instructions !== false) && /* @__PURE__ */ jsxs7("details", { className: "group/more", open: moreOpen, onToggle: (event) => setMoreOpen(event.currentTarget.open), children: [
1689
+ /* @__PURE__ */ jsxs7("summary", { className: "flex w-fit cursor-pointer list-none items-center gap-1.5 rounded-md text-sm font-medium text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden", children: [
1690
+ /* @__PURE__ */ jsx7("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", className: "size-4 transition-transform group-open/more:rotate-90", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx7("path", { d: "m9 6 6 6-6 6" }) }),
1691
+ "More instructions"
1692
+ ] }),
1693
+ /* @__PURE__ */ jsxs7("div", { className: "mt-4 space-y-4", children: [
1694
+ config?.prompts?.systemPrompt !== false && /* @__PURE__ */ jsx7(
1695
+ Field,
1696
+ {
1697
+ label: "Replacement system prompt",
1698
+ htmlFor: `${id}-system`,
1699
+ info: "Replaces the agent's built-in prompt entirely. Leave it empty to keep the built-in prompt.",
1700
+ children: /* @__PURE__ */ jsx7(
1701
+ Textarea,
1702
+ {
1703
+ id: `${id}-system`,
1704
+ size: "compact",
1705
+ className: "min-h-24 text-sm leading-6",
1706
+ disabled: editingDisabled,
1707
+ value: value.prompt?.systemPrompt ?? "",
1708
+ "aria-describedby": value.prompt?.systemPrompt ? `${id}-system-replaces` : void 0,
1709
+ onChange: (event) => prompt({ ...value.prompt, systemPrompt: event.target.value })
1710
+ }
1711
+ )
1712
+ }
1713
+ ),
1714
+ config?.prompts?.systemPrompt !== false && value.prompt?.systemPrompt && /* @__PURE__ */ jsxs7(StatusLine, { id: `${id}-system-replaces`, tone: "warning", children: [
1715
+ "The built-in prompt is replaced.",
1716
+ config?.prompts?.appendSystemPrompt !== false && " The agent receives this text, then the additional instructions."
1717
+ ] }),
1718
+ config?.prompts?.instructions !== false && /* @__PURE__ */ jsxs7("div", { role: "group", "aria-labelledby": `${id}-instructions-label`, className: "space-y-2", children: [
1719
+ /* @__PURE__ */ jsx7("div", { className: "flex items-center gap-1.5", children: /* @__PURE__ */ jsx7("span", { id: `${id}-instructions-label`, className: formText.label, children: "Project instructions" }) }),
1720
+ /* @__PURE__ */ jsx7("p", { className: formText.muted, children: "Lower-priority guidance the agent reads like a project file." }),
1721
+ (value.prompt?.instructions ?? []).map((instruction, index) => /* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-2", children: [
1722
+ /* @__PURE__ */ jsx7(
1723
+ Textarea,
1724
+ {
1725
+ "aria-label": `Instruction ${index + 1}`,
1726
+ size: "compact",
1727
+ className: "min-h-20 text-sm leading-6",
1728
+ disabled: editingDisabled,
1729
+ value: instruction,
1730
+ onChange: (event) => prompt({ ...value.prompt, instructions: (value.prompt?.instructions ?? []).map((item, i) => i === index ? event.target.value : item) })
1731
+ }
1732
+ ),
1733
+ /* @__PURE__ */ jsx7(
1734
+ Button5,
1735
+ {
1736
+ type: "button",
1737
+ size: "compact",
1738
+ variant: "ghost",
1739
+ className: "text-destructive hover:text-destructive",
1740
+ disabled: editingDisabled,
1741
+ "aria-label": `Remove instruction ${index + 1}`,
1742
+ onClick: () => prompt({ ...value.prompt, instructions: (value.prompt?.instructions ?? []).filter((_, i) => i !== index) }),
1743
+ children: "Remove"
1744
+ }
1745
+ )
1746
+ ] }, index)),
1747
+ /* @__PURE__ */ jsx7(
1748
+ Button5,
1749
+ {
1750
+ type: "button",
1751
+ size: "compact",
1752
+ variant: "outline",
1753
+ disabled: editingDisabled,
1754
+ onClick: () => prompt({ ...value.prompt, instructions: [...value.prompt?.instructions ?? [], ""] }),
1755
+ children: "Add instruction"
1756
+ }
1757
+ )
1758
+ ] })
1759
+ ] })
1760
+ ] })
1761
+ ] }),
1762
+ show.model && /* @__PURE__ */ jsxs7(Section, { title: "Model and runtime", description: "Defaults for conversations and automations that do not choose their own.", children: [
1763
+ /* @__PURE__ */ jsxs7("div", { className: formRow, children: [
1764
+ modelField("Default model", "default", "Runs when a conversation or automation does not pick a model."),
1765
+ config?.harnesses && config.harnesses.length > 0 && /* @__PURE__ */ jsx7(
1766
+ Field,
1601
1767
  {
1602
- disabled: editingDisabled || !allowExecutableFiles && !inlineDraft.executable,
1603
- checked: inlineDraft.executable,
1604
- onCheckedChange: (executable) => setInlineDraft({ ...inlineDraft, executable })
1605
- }
1606
- ),
1607
- "Executable"
1608
- ] }),
1609
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap gap-2", children: [
1610
- /* @__PURE__ */ jsx7(Button5, { type: "button", size: "compact", disabled: !ready, onClick: () => {
1611
- const saved = isFile ? addFile(mount, index) : addRef(section, { kind: "inline", name, content: inlineDraft.content }, index);
1612
- if (saved) openPanel(null);
1613
- }, children: index === void 0 ? isSkill ? "Add skill" : "Add file" : "Save" }),
1614
- /* @__PURE__ */ jsx7(Button5, { type: "button", size: "compact", variant: "ghost", onClick: () => openPanel(null), children: "Cancel" })
1615
- ] })
1616
- ] });
1617
- }
1618
- function githubEditor(section, index) {
1619
- if (!github) return null;
1620
- const existing = index === void 0 ? void 0 : section === "files" ? files[index]?.resource : (section === "skills" ? skills : toolFiles)[index];
1621
- const initial = existing?.kind === "github" ? { repository: existing.repository, path: existing.path, ref: existing.ref } : void 0;
1622
- const isFile = section === "files";
1623
- const pathId = `${id}-${section}-github-path`;
1624
- return /* @__PURE__ */ jsx7("div", { className: "rounded-lg border border-border bg-muted/30 p-4", children: /* @__PURE__ */ jsx7(
1625
- GitHubSourcePicker,
1626
- {
1627
- port: github.port,
1628
- purpose: section === "skills" ? "skill" : "file",
1629
- disabled: editingDisabled,
1630
- connectHref: github.connectHref,
1631
- initial,
1632
- onCancel: () => openPanel(null),
1633
- actionLabel: index !== void 0 ? "Save" : section === "skills" ? "Add skill" : "Add file",
1634
- blocked: isFile && inlineDraft.path.trim() === "" ? "Enter a workspace path." : null,
1635
- onChoose: ({ check }) => {
1636
- if (isFile) {
1637
- const path = inlineDraft.path.trim() || (workspaceFilePrefix ?? "") + basename(check.path);
1638
- if (addFile({ path, resource: refFromCheck(check, basename(check.path)) }, index)) openPanel(null);
1639
- return;
1640
- }
1641
- const name = githubNameValue(check, section);
1642
- if (addRef(section, refFromCheck(check, name), index)) openPanel(null);
1643
- },
1644
- children: (check) => isFile ? /* @__PURE__ */ jsx7(
1645
- GitHubFilePath,
1646
- {
1647
- check,
1648
- id: pathId,
1649
- value: inlineDraft.path,
1650
- prefix: workspaceFilePrefix ?? "",
1651
- disabled: editingDisabled,
1652
- onChange: (path) => setInlineDraft((current) => ({ ...current, path })),
1653
- issue: inlineDraft.path.trim() && check ? fileIssue({ path: inlineDraft.path.trim(), resource: refFromCheck(check, basename(check.path)) }, index ?? files.length) : null
1654
- }
1655
- ) : nameField(check, section)
1656
- }
1657
- ) });
1658
- }
1659
- function rowActions2(label, section, index, ref) {
1660
- const canEdit = ref.kind === "inline" || Boolean(github);
1661
- return /* @__PURE__ */ jsxs7("div", { className: rowActions, children: [
1662
- canEdit && /* @__PURE__ */ jsx7(
1663
- Button5,
1664
- {
1665
- type: "button",
1666
- size: "compact",
1667
- variant: "ghost",
1668
- disabled: editingDisabled,
1669
- "aria-label": `Edit ${label}`,
1670
- onClick: () => openPanel({ kind: "edit", section, index }),
1671
- children: "Edit"
1672
- }
1673
- ),
1674
- /* @__PURE__ */ jsx7(
1675
- Button5,
1676
- {
1677
- type: "button",
1678
- size: "compact",
1679
- variant: "ghost",
1680
- className: "text-destructive hover:text-destructive",
1681
- disabled: editingDisabled,
1682
- "aria-label": `Remove ${label}`,
1683
- onClick: () => {
1684
- const removed = section === "files" ? setFiles(files.filter((_, item) => item !== index)) : resources(section, (section === "skills" ? skills : toolFiles).filter((_, item) => item !== index));
1685
- if (removed && panel?.kind === "edit" && panel.section === section) openPanel(null);
1686
- },
1687
- children: "Remove"
1688
- }
1689
- )
1690
- ] });
1691
- }
1692
- function refList(section, refs, noun) {
1693
- if (refs.length === 0) return /* @__PURE__ */ jsxs7("p", { className: formText.muted, children: [
1694
- "No ",
1695
- noun,
1696
- "s yet."
1697
- ] });
1698
- return /* @__PURE__ */ jsx7("ul", { className: "divide-y divide-border rounded-lg border border-border", children: refs.map((ref, index) => {
1699
- const title = ref.name || (ref.kind === "github" ? basename(ref.path) : `${noun} ${index + 1}`);
1700
- const issue = section === "skills" ? skillIssue(ref, refs, index) : githubRefIssue(ref, requireGitHubCommitSha);
1701
- const described = ref.kind === "inline" && section === "skills" ? inlineSkillSummary(ref.content) : null;
1702
- const words = (text) => text.toLowerCase().replace(/[-_\s]+/g, " ").trim();
1703
- const summary = described && words(described) !== words(title) ? described : null;
1704
- const editing = panel?.kind === "edit" && panel.section === section && panel.index === index;
1705
- return /* @__PURE__ */ jsxs7("li", { className: "space-y-3 p-3", "aria-label": `${noun} ${title}`, children: [
1706
- /* @__PURE__ */ jsxs7("div", { className: listRow, children: [
1707
- /* @__PURE__ */ jsxs7("div", { className: "min-w-0", children: [
1708
- /* @__PURE__ */ jsx7("p", { className: `break-words ${formText.label}`, children: title }),
1709
- summary && /* @__PURE__ */ jsx7("p", { className: `line-clamp-2 ${formText.muted}`, children: summary }),
1710
- (ref.kind === "github" || !summary) && /* @__PURE__ */ jsx7("p", { className: `break-words ${formText.muted}`, children: sourceLine(ref) }),
1711
- issue && /* @__PURE__ */ jsx7("p", { className: formText.error, children: issue })
1712
- ] }),
1713
- rowActions2(title, section, index, ref)
1714
- ] }),
1715
- editing && (ref.kind === "github" && github ? githubEditor(section, index) : inlineEditor(section, index))
1716
- ] }, `${section}-${index}`);
1717
- }) });
1718
- }
1719
- function addButtons(section, writeLabel) {
1720
- if (panel && panel.kind !== "edit" && panel.section === section) {
1721
- return panel.kind === "add-github" ? githubEditor(section) : inlineEditor(section);
1722
- }
1723
- return /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap gap-2", children: [
1724
- github && /* @__PURE__ */ jsx7(
1725
- Button5,
1726
- {
1727
- type: "button",
1728
- size: "compact",
1729
- variant: "outline",
1730
- disabled: editingDisabled,
1731
- onClick: () => openPanel({ kind: "add-github", section }),
1732
- children: "Add from GitHub"
1733
- }
1734
- ),
1735
- /* @__PURE__ */ jsx7(
1736
- Button5,
1737
- {
1738
- type: "button",
1739
- size: "compact",
1740
- variant: "outline",
1741
- disabled: editingDisabled,
1742
- onClick: () => openPanel({ kind: "add-inline", section }),
1743
- children: writeLabel
1744
- }
1745
- )
1746
- ] });
1747
- }
1748
- const countLabel = (count, noun) => count ? `${count} ${noun}${count === 1 ? "" : "s"}` : void 0;
1749
- const toolNames = Object.keys(value.tools ?? {});
1750
- return /* @__PURE__ */ jsx7(TooltipProvider, { delayDuration: 150, children: /* @__PURE__ */ jsxs7("div", { className: `@container/profile-editor min-w-0 space-y-4 ${className ?? ""}`, "aria-label": "Agent profile editor", children: [
1751
- error && /* @__PURE__ */ jsx7(Notice, { tone: "error", children: error }),
1752
- jsonDirty && /* @__PURE__ */ jsx7(Notice, { tone: "info", children: "Apply or discard your Advanced JSON edits before changing other fields." }),
1753
- unsupportedResources.length > 0 && /* @__PURE__ */ jsxs7(Notice, { tone: "error", children: [
1754
- "This profile has resources this product does not use: ",
1755
- unsupportedResources.map((kind) => `${RESOURCE_KIND_LABELS[kind]} (${configuredResourceCount(value, kind)})`).join(", "),
1756
- ". Remove them in Advanced JSON before saving."
1757
- ] }),
1758
- constrainedEntryCount > 0 && /* @__PURE__ */ jsxs7(Notice, { tone: "error", children: [
1759
- constrainedEntryCount === 1 ? "One resource needs" : `${constrainedEntryCount} resources need`,
1760
- " a fix before this profile can be saved. The affected rows say what to change."
1761
- ] }),
1762
- invalidMcpCount > 0 && /* @__PURE__ */ jsxs7(Notice, { tone: "error", children: [
1763
- invalidMcpCount === 1 ? "One MCP server needs" : `${invalidMcpCount} MCP servers need`,
1764
- " a public HTTPS address before this profile can be saved."
1765
- ] }),
1766
- show.identity && /* @__PURE__ */ jsx7(Section, { title: "Identity", children: /* @__PURE__ */ jsxs7("div", { className: formRow, children: [
1767
- config?.identity?.nameEditable !== false && /* @__PURE__ */ jsx7(Field, { label: "Name", htmlFor: `${id}-name`, children: /* @__PURE__ */ jsx7(
1768
- Input5,
1769
- {
1770
- id: `${id}-name`,
1771
- size: "compact",
1772
- disabled: editingDisabled,
1773
- value: value.name ?? "",
1774
- ...noAutofill,
1775
- onChange: (event) => emit({ ...value, name: event.target.value })
1776
- }
1777
- ) }),
1778
- /* @__PURE__ */ jsx7(Field, { label: "Description", htmlFor: `${id}-description`, children: /* @__PURE__ */ jsx7(
1779
- Input5,
1780
- {
1781
- id: `${id}-description`,
1782
- size: "compact",
1783
- disabled: editingDisabled,
1784
- value: value.description ?? "",
1785
- ...noAutofill,
1786
- onChange: (event) => emit({ ...value, description: event.target.value })
1787
- }
1788
- ) })
1789
- ] }) }),
1790
- show.prompts && /* @__PURE__ */ jsxs7(Section, { title: "Instructions", description: "What the agent is told before every conversation.", children: [
1791
- config?.prompts?.appendSystemPrompt !== false && /* @__PURE__ */ jsx7(
1792
- Field,
1793
- {
1794
- label: "Additional instructions",
1795
- htmlFor: `${id}-append`,
1796
- info: "Added after the agent's built-in prompt, which stays in force. Leave it empty to add nothing.",
1797
- children: /* @__PURE__ */ jsx7(
1798
- Textarea,
1799
- {
1800
- id: `${id}-append`,
1801
- className: "min-h-40 text-sm leading-6",
1802
- disabled: editingDisabled,
1803
- value: value.prompt?.appendSystemPrompt ?? "",
1804
- onChange: (event) => prompt({ ...value.prompt, appendSystemPrompt: event.target.value })
1805
- }
1806
- )
1807
- }
1808
- ),
1809
- (config?.prompts?.systemPrompt !== false || config?.prompts?.instructions !== false) && /* @__PURE__ */ jsxs7("details", { className: "group/more", open: moreOpen, onToggle: (event) => setMoreOpen(event.currentTarget.open), children: [
1810
- /* @__PURE__ */ jsxs7("summary", { className: "flex w-fit cursor-pointer list-none items-center gap-1.5 rounded-md text-sm font-medium text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden", children: [
1811
- /* @__PURE__ */ jsx7("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", className: "size-4 transition-transform group-open/more:rotate-90", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx7("path", { d: "m9 6 6 6-6 6" }) }),
1812
- "More instructions"
1813
- ] }),
1814
- /* @__PURE__ */ jsxs7("div", { className: "mt-4 space-y-4", children: [
1815
- config?.prompts?.systemPrompt !== false && /* @__PURE__ */ jsx7(
1816
- Field,
1817
- {
1818
- label: "Replacement system prompt",
1819
- htmlFor: `${id}-system`,
1820
- info: "Replaces the agent's built-in prompt entirely. Leave it empty to keep the built-in prompt.",
1821
- children: /* @__PURE__ */ jsx7(
1822
- Textarea,
1823
- {
1824
- id: `${id}-system`,
1825
- size: "compact",
1826
- className: "min-h-24 text-sm leading-6",
1827
- disabled: editingDisabled,
1828
- value: value.prompt?.systemPrompt ?? "",
1829
- "aria-describedby": value.prompt?.systemPrompt ? `${id}-system-replaces` : void 0,
1830
- onChange: (event) => prompt({ ...value.prompt, systemPrompt: event.target.value })
1831
- }
1832
- )
1833
- }
1834
- ),
1835
- config?.prompts?.systemPrompt !== false && value.prompt?.systemPrompt && /* @__PURE__ */ jsxs7(StatusLine, { id: `${id}-system-replaces`, tone: "warning", children: [
1836
- "The built-in prompt is replaced.",
1837
- config?.prompts?.appendSystemPrompt !== false && " The agent receives this text, then the additional instructions."
1838
- ] }),
1839
- config?.prompts?.instructions !== false && /* @__PURE__ */ jsxs7("div", { role: "group", "aria-labelledby": `${id}-instructions-label`, className: "space-y-2", children: [
1840
- /* @__PURE__ */ jsx7("div", { className: "flex items-center gap-1.5", children: /* @__PURE__ */ jsx7("span", { id: `${id}-instructions-label`, className: formText.label, children: "Project instructions" }) }),
1841
- /* @__PURE__ */ jsx7("p", { className: formText.muted, children: "Lower-priority guidance the agent reads like a project file." }),
1842
- (value.prompt?.instructions ?? []).map((instruction, index) => /* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-2", children: [
1843
- /* @__PURE__ */ jsx7(
1844
- Textarea,
1845
- {
1846
- "aria-label": `Instruction ${index + 1}`,
1847
- size: "compact",
1848
- className: "min-h-20 text-sm leading-6",
1849
- disabled: editingDisabled,
1850
- value: instruction,
1851
- onChange: (event) => prompt({ ...value.prompt, instructions: (value.prompt?.instructions ?? []).map((item, i) => i === index ? event.target.value : item) })
1852
- }
1853
- ),
1854
- /* @__PURE__ */ jsx7(
1855
- Button5,
1856
- {
1857
- type: "button",
1858
- size: "compact",
1859
- variant: "ghost",
1860
- className: "text-destructive hover:text-destructive",
1861
- disabled: editingDisabled,
1862
- "aria-label": `Remove instruction ${index + 1}`,
1863
- onClick: () => prompt({ ...value.prompt, instructions: (value.prompt?.instructions ?? []).filter((_, i) => i !== index) }),
1864
- children: "Remove"
1865
- }
1866
- )
1867
- ] }, index)),
1868
- /* @__PURE__ */ jsx7(
1869
- Button5,
1870
- {
1871
- type: "button",
1872
- size: "compact",
1873
- variant: "outline",
1874
- disabled: editingDisabled,
1875
- onClick: () => prompt({ ...value.prompt, instructions: [...value.prompt?.instructions ?? [], ""] }),
1876
- children: "Add instruction"
1877
- }
1878
- )
1879
- ] })
1880
- ] })
1881
- ] })
1882
- ] }),
1883
- show.model && /* @__PURE__ */ jsxs7(Section, { title: "Model and runtime", description: "Defaults for conversations and automations that do not choose their own.", children: [
1884
- /* @__PURE__ */ jsxs7("div", { className: formRow, children: [
1885
- modelField("Default model", "default", "Runs when a conversation or automation does not pick a model."),
1886
- config?.harnesses && config.harnesses.length > 0 && /* @__PURE__ */ jsx7(
1887
- Field,
1888
- {
1889
- label: "Harness",
1890
- htmlFor: `${id}-harness`,
1891
- info: "The agent runtime that runs this profile, such as OpenCode or Codex.",
1892
- children: /* @__PURE__ */ jsx7(
1893
- HarnessPicker,
1894
- {
1895
- id: `${id}-harness`,
1896
- variant: "field",
1897
- value: harness ?? "",
1898
- onChange: changeHarness,
1899
- available: config.harnesses,
1900
- defaultOption: { label: catalog?.defaultLabel ?? "Product default" },
1901
- disabled: editingDisabled
1902
- }
1903
- )
1768
+ label: "Harness",
1769
+ htmlFor: `${id}-harness`,
1770
+ info: "The agent runtime that runs this profile, such as OpenCode or Codex.",
1771
+ children: /* @__PURE__ */ jsx7(
1772
+ HarnessPicker,
1773
+ {
1774
+ id: `${id}-harness`,
1775
+ variant: "field",
1776
+ value: harness ?? "",
1777
+ onChange: changeHarness,
1778
+ available: config.harnesses,
1779
+ defaultOption: { label: catalog?.defaultLabel ?? "Product default" },
1780
+ disabled: editingDisabled
1781
+ }
1782
+ )
1904
1783
  }
1905
1784
  ),
1906
1785
  /* @__PURE__ */ jsx7(Field, { label: "Thinking", htmlFor: `${id}-thinking`, info: "How hard the agent reasons before answering. Auto lets the harness decide.", children: /* @__PURE__ */ jsx7(
@@ -2144,67 +2023,363 @@ function AgentProfileEditor({
2144
2023
  }
2145
2024
  }
2146
2025
  )
2147
- ]
2148
- }
2149
- ),
2150
- show.advanced && /* @__PURE__ */ jsxs7(Section, { title: "Advanced JSON", description: "The complete profile, including hooks, modes, connections, and extensions.", collapsible: true, children: [
2151
- /* @__PURE__ */ jsx7("label", { htmlFor: `${id}-json`, className: "sr-only", children: "Full profile JSON" }),
2026
+ ]
2027
+ }
2028
+ ),
2029
+ show.advanced && /* @__PURE__ */ jsxs7(Section, { title: "Advanced JSON", description: "The complete profile, including hooks, modes, connections, and extensions.", collapsible: true, children: [
2030
+ /* @__PURE__ */ jsx7("label", { htmlFor: `${id}-json`, className: "sr-only", children: "Full profile JSON" }),
2031
+ /* @__PURE__ */ jsx7(
2032
+ Textarea,
2033
+ {
2034
+ id: `${id}-json`,
2035
+ className: "min-h-72 font-mono text-sm leading-6",
2036
+ spellCheck: false,
2037
+ disabled,
2038
+ value: json,
2039
+ onChange: (event) => {
2040
+ setJson(event.target.value);
2041
+ setJsonDirty(true);
2042
+ }
2043
+ }
2044
+ ),
2045
+ /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-center gap-2", children: [
2046
+ /* @__PURE__ */ jsx7(Button5, { type: "button", size: "compact", variant: "outline", disabled: disabled || !jsonDirty, onClick: applyJson, children: "Apply JSON" }),
2047
+ jsonDirty && /* @__PURE__ */ jsx7(
2048
+ Button5,
2049
+ {
2050
+ type: "button",
2051
+ size: "compact",
2052
+ variant: "ghost",
2053
+ className: "text-destructive hover:text-destructive",
2054
+ disabled,
2055
+ onClick: () => {
2056
+ setJson(JSON.stringify(value, null, 2));
2057
+ setJsonDirty(false);
2058
+ setError(null);
2059
+ },
2060
+ children: "Discard JSON edits"
2061
+ }
2062
+ )
2063
+ ] }),
2064
+ /* @__PURE__ */ jsx7("p", { className: formText.muted, children: "Reference credentials by secret name; never paste them into a profile." })
2065
+ ] })
2066
+ ] }) });
2067
+ }
2068
+ function GitHubFilePath({ check, id, value, prefix, disabled, onChange, issue }) {
2069
+ const suggested = check ? prefix + basename(check.path) : "";
2070
+ useEffect4(() => {
2071
+ if (suggested && !value) onChange(suggested);
2072
+ }, [suggested]);
2073
+ return /* @__PURE__ */ jsx7(Field, { label: "Workspace path", htmlFor: id, error: issue, hint: !issue && prefix ? `Files go under ${prefix}` : void 0, children: /* @__PURE__ */ jsx7(
2074
+ Input5,
2075
+ {
2076
+ id,
2077
+ size: "compact",
2078
+ value,
2079
+ disabled: disabled || !check,
2080
+ placeholder: prefix + "guide.md",
2081
+ ...noAutofill,
2082
+ "aria-invalid": issue ? true : void 0,
2083
+ "aria-describedby": fieldMessageId(id),
2084
+ onChange: (event) => onChange(event.target.value)
2085
+ }
2086
+ ) });
2087
+ }
2088
+ function createProfileResourceEditors({
2089
+ config,
2090
+ skills,
2091
+ toolFiles,
2092
+ skillIssue,
2093
+ requireGitHubCommitSha,
2094
+ setError,
2095
+ resources,
2096
+ fileIssue,
2097
+ files,
2098
+ setFiles,
2099
+ id,
2100
+ githubName,
2101
+ requireUniqueSkillNames,
2102
+ editingDisabled,
2103
+ setGithubName,
2104
+ inlineDraft,
2105
+ workspaceFilePrefix,
2106
+ setInlineDraft,
2107
+ allowExecutableFiles,
2108
+ openPanel,
2109
+ panel
2110
+ }) {
2111
+ const github = config?.github;
2112
+ function refFromCheck(check, name) {
2113
+ return github?.storage === "inline" ? { kind: "inline", name, content: check.content } : { kind: "github", repository: check.repository, path: check.path, ref: check.commit.sha, ...name ? { name } : {} };
2114
+ }
2115
+ function addRef(section, ref, index) {
2116
+ const refs = section === "skills" ? skills : toolFiles;
2117
+ const issue = section === "skills" ? skillIssue(ref, refs, index ?? refs.length) : githubRefIssue(ref, requireGitHubCommitSha);
2118
+ if (issue) {
2119
+ setError(issue);
2120
+ return false;
2121
+ }
2122
+ const next = index === void 0 ? [...refs, ref] : refs.map((item, position) => position === index ? ref : item);
2123
+ return resources(section, next);
2124
+ }
2125
+ function addFile(mount, index) {
2126
+ const issue = fileIssue(mount, index ?? files.length);
2127
+ if (issue) {
2128
+ setError(issue);
2129
+ return false;
2130
+ }
2131
+ return setFiles(index === void 0 ? [...files, mount] : files.map((item, position) => position === index ? mount : item));
2132
+ }
2133
+ function nameField(check, section) {
2134
+ const fieldId = `${id}-${section}-github-name`;
2135
+ const suggested = check ? section === "skills" ? suggestedSkillName(check) : basename(check.path) : "";
2136
+ const name = githubName.touched ? githubName.value : suggested;
2137
+ const problem = section === "skills" && requireUniqueSkillNames && name ? skillIssue({ kind: "inline", name, content: "" }, skills) : null;
2138
+ return /* @__PURE__ */ jsx7(
2139
+ Field,
2140
+ {
2141
+ label: section === "skills" ? "Skill name" : "File name",
2142
+ htmlFor: fieldId,
2143
+ error: problem,
2144
+ hint: section === "skills" && !problem ? "Shown to the agent in its skill list." : void 0,
2145
+ children: /* @__PURE__ */ jsx7(
2146
+ Input5,
2147
+ {
2148
+ id: fieldId,
2149
+ size: "compact",
2150
+ value: name,
2151
+ disabled: editingDisabled || !check,
2152
+ ...noAutofill,
2153
+ "aria-invalid": problem ? true : void 0,
2154
+ "aria-describedby": fieldMessageId(fieldId),
2155
+ onChange: (event) => setGithubName({ value: event.target.value, touched: true })
2156
+ }
2157
+ )
2158
+ }
2159
+ );
2160
+ }
2161
+ function githubNameValue(check, section) {
2162
+ return (githubName.touched ? githubName.value : section === "skills" ? suggestedSkillName(check) : basename(check.path)).trim();
2163
+ }
2164
+ function inlineEditor(section, index) {
2165
+ const prefix = `${id}-${section}-inline`;
2166
+ const isSkill = section === "skills";
2167
+ const isFile = section === "files";
2168
+ const name = inlineDraft.name.trim();
2169
+ const frontmatter = isSkill && inlineDraft.content.trim() ? readSkillFrontmatter(inlineDraft.content) : null;
2170
+ const mount = isFile ? {
2171
+ path: inlineDraft.path.trim(),
2172
+ resource: { kind: "inline", name: name || basename(inlineDraft.path.trim()), content: inlineDraft.content },
2173
+ ...inlineDraft.executable ? { executable: true } : {}
2174
+ } : null;
2175
+ const problem = isFile ? inlineDraft.path.trim() ? fileIssue(mount, index ?? files.length) : null : isSkill && name ? skillIssue({ kind: "inline", name, content: inlineDraft.content }, skills, index ?? skills.length) : null;
2176
+ const ready = !editingDisabled && !problem && (isFile ? inlineDraft.path.trim() !== "" : name !== "");
2177
+ return /* @__PURE__ */ jsxs7("div", { className: "space-y-4 rounded-lg border border-border bg-muted/30 p-4", children: [
2178
+ isFile ? /* @__PURE__ */ jsx7(
2179
+ Field,
2180
+ {
2181
+ label: "Workspace path",
2182
+ htmlFor: `${prefix}-path`,
2183
+ error: problem,
2184
+ hint: !problem && workspaceFilePrefix ? `Files go under ${workspaceFilePrefix}` : void 0,
2185
+ children: /* @__PURE__ */ jsx7(
2186
+ Input5,
2187
+ {
2188
+ id: `${prefix}-path`,
2189
+ size: "compact",
2190
+ value: inlineDraft.path,
2191
+ disabled: editingDisabled,
2192
+ ...noAutofill,
2193
+ placeholder: (workspaceFilePrefix ?? "") + "guide.md",
2194
+ "aria-invalid": problem ? true : void 0,
2195
+ "aria-describedby": fieldMessageId(`${prefix}-path`),
2196
+ onChange: (event) => setInlineDraft({ ...inlineDraft, path: event.target.value })
2197
+ }
2198
+ )
2199
+ }
2200
+ ) : /* @__PURE__ */ jsx7(Field, { label: isSkill ? "Skill name" : "File name", htmlFor: `${prefix}-name`, error: problem, children: /* @__PURE__ */ jsx7(
2201
+ Input5,
2202
+ {
2203
+ id: `${prefix}-name`,
2204
+ size: "compact",
2205
+ value: inlineDraft.name,
2206
+ disabled: editingDisabled,
2207
+ ...noAutofill,
2208
+ placeholder: isSkill ? "research" : "search.ts",
2209
+ "aria-invalid": problem ? true : void 0,
2210
+ "aria-describedby": fieldMessageId(`${prefix}-name`),
2211
+ onChange: (event) => setInlineDraft({ ...inlineDraft, name: event.target.value })
2212
+ }
2213
+ ) }),
2152
2214
  /* @__PURE__ */ jsx7(
2153
- Textarea,
2215
+ Field,
2154
2216
  {
2155
- id: `${id}-json`,
2156
- className: "min-h-72 font-mono text-sm leading-6",
2157
- spellCheck: false,
2158
- disabled,
2159
- value: json,
2160
- onChange: (event) => {
2161
- setJson(event.target.value);
2162
- setJsonDirty(true);
2163
- }
2217
+ label: "Content",
2218
+ htmlFor: `${prefix}-content`,
2219
+ hint: frontmatter && !frontmatter.ok ? "Start the skill with frontmatter that sets name and description, so the agent knows when to use it." : void 0,
2220
+ children: /* @__PURE__ */ jsx7(
2221
+ Textarea,
2222
+ {
2223
+ id: `${prefix}-content`,
2224
+ className: "min-h-40 font-mono text-sm leading-6",
2225
+ disabled: editingDisabled,
2226
+ value: inlineDraft.content,
2227
+ onChange: (event) => setInlineDraft({ ...inlineDraft, content: event.target.value })
2228
+ }
2229
+ )
2164
2230
  }
2165
2231
  ),
2166
- /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-center gap-2", children: [
2167
- /* @__PURE__ */ jsx7(Button5, { type: "button", size: "compact", variant: "outline", disabled: disabled || !jsonDirty, onClick: applyJson, children: "Apply JSON" }),
2168
- jsonDirty && /* @__PURE__ */ jsx7(
2169
- Button5,
2232
+ isFile && (allowExecutableFiles || inlineDraft.executable) && /* @__PURE__ */ jsxs7("label", { className: `flex items-center gap-3 ${formText.body}`, children: [
2233
+ /* @__PURE__ */ jsx7(
2234
+ Switch2,
2170
2235
  {
2171
- type: "button",
2172
- size: "compact",
2173
- variant: "ghost",
2174
- className: "text-destructive hover:text-destructive",
2175
- disabled,
2176
- onClick: () => {
2177
- setJson(JSON.stringify(value, null, 2));
2178
- setJsonDirty(false);
2179
- setError(null);
2180
- },
2181
- children: "Discard JSON edits"
2236
+ disabled: editingDisabled || !allowExecutableFiles && !inlineDraft.executable,
2237
+ checked: inlineDraft.executable,
2238
+ onCheckedChange: (executable) => setInlineDraft({ ...inlineDraft, executable })
2182
2239
  }
2183
- )
2240
+ ),
2241
+ "Executable"
2184
2242
  ] }),
2185
- /* @__PURE__ */ jsx7("p", { className: formText.muted, children: "Reference credentials by secret name; never paste them into a profile." })
2186
- ] })
2187
- ] }) });
2188
- }
2189
- function GitHubFilePath({ check, id, value, prefix, disabled, onChange, issue }) {
2190
- const suggested = check ? prefix + basename(check.path) : "";
2191
- useEffect4(() => {
2192
- if (suggested && !value) onChange(suggested);
2193
- }, [suggested]);
2194
- return /* @__PURE__ */ jsx7(Field, { label: "Workspace path", htmlFor: id, error: issue, hint: !issue && prefix ? `Files go under ${prefix}` : void 0, children: /* @__PURE__ */ jsx7(
2195
- Input5,
2196
- {
2197
- id,
2198
- size: "compact",
2199
- value,
2200
- disabled: disabled || !check,
2201
- placeholder: prefix + "guide.md",
2202
- ...noAutofill,
2203
- "aria-invalid": issue ? true : void 0,
2204
- "aria-describedby": fieldMessageId(id),
2205
- onChange: (event) => onChange(event.target.value)
2243
+ /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap gap-2", children: [
2244
+ /* @__PURE__ */ jsx7(Button5, { type: "button", size: "compact", disabled: !ready, onClick: () => {
2245
+ const saved = isFile ? addFile(mount, index) : addRef(section, { kind: "inline", name, content: inlineDraft.content }, index);
2246
+ if (saved) openPanel(null);
2247
+ }, children: index === void 0 ? isSkill ? "Add skill" : "Add file" : "Save" }),
2248
+ /* @__PURE__ */ jsx7(Button5, { type: "button", size: "compact", variant: "ghost", onClick: () => openPanel(null), children: "Cancel" })
2249
+ ] })
2250
+ ] });
2251
+ }
2252
+ function githubEditor(section, index) {
2253
+ if (!github) return null;
2254
+ const existing = index === void 0 ? void 0 : section === "files" ? files[index]?.resource : (section === "skills" ? skills : toolFiles)[index];
2255
+ const initial = existing?.kind === "github" ? { repository: existing.repository, path: existing.path, ref: existing.ref } : void 0;
2256
+ const isFile = section === "files";
2257
+ const pathId = `${id}-${section}-github-path`;
2258
+ return /* @__PURE__ */ jsx7("div", { className: "rounded-lg border border-border bg-muted/30 p-4", children: /* @__PURE__ */ jsx7(
2259
+ GitHubSourcePicker,
2260
+ {
2261
+ port: github.port,
2262
+ purpose: section === "skills" ? "skill" : "file",
2263
+ disabled: editingDisabled,
2264
+ connectHref: github.connectHref,
2265
+ initial,
2266
+ onCancel: () => openPanel(null),
2267
+ actionLabel: index !== void 0 ? "Save" : section === "skills" ? "Add skill" : "Add file",
2268
+ blocked: isFile && inlineDraft.path.trim() === "" ? "Enter a workspace path." : null,
2269
+ onChoose: ({ check }) => {
2270
+ if (isFile) {
2271
+ const path = inlineDraft.path.trim() || (workspaceFilePrefix ?? "") + basename(check.path);
2272
+ if (addFile({ path, resource: refFromCheck(check, basename(check.path)) }, index)) openPanel(null);
2273
+ return;
2274
+ }
2275
+ const name = githubNameValue(check, section);
2276
+ if (addRef(section, refFromCheck(check, name), index)) openPanel(null);
2277
+ },
2278
+ children: (check) => isFile ? /* @__PURE__ */ jsx7(
2279
+ GitHubFilePath,
2280
+ {
2281
+ check,
2282
+ id: pathId,
2283
+ value: inlineDraft.path,
2284
+ prefix: workspaceFilePrefix ?? "",
2285
+ disabled: editingDisabled,
2286
+ onChange: (path) => setInlineDraft((current) => ({ ...current, path })),
2287
+ issue: inlineDraft.path.trim() && check ? fileIssue({ path: inlineDraft.path.trim(), resource: refFromCheck(check, basename(check.path)) }, index ?? files.length) : null
2288
+ }
2289
+ ) : nameField(check, section)
2290
+ }
2291
+ ) });
2292
+ }
2293
+ function rowActions2(label, section, index, ref) {
2294
+ const canEdit = ref.kind === "inline" || Boolean(github);
2295
+ return /* @__PURE__ */ jsxs7("div", { className: rowActions, children: [
2296
+ canEdit && /* @__PURE__ */ jsx7(
2297
+ Button5,
2298
+ {
2299
+ type: "button",
2300
+ size: "compact",
2301
+ variant: "ghost",
2302
+ disabled: editingDisabled,
2303
+ "aria-label": `Edit ${label}`,
2304
+ onClick: () => openPanel({ kind: "edit", section, index }),
2305
+ children: "Edit"
2306
+ }
2307
+ ),
2308
+ /* @__PURE__ */ jsx7(
2309
+ Button5,
2310
+ {
2311
+ type: "button",
2312
+ size: "compact",
2313
+ variant: "ghost",
2314
+ className: "text-destructive hover:text-destructive",
2315
+ disabled: editingDisabled,
2316
+ "aria-label": `Remove ${label}`,
2317
+ onClick: () => {
2318
+ const removed = section === "files" ? setFiles(files.filter((_, item) => item !== index)) : resources(section, (section === "skills" ? skills : toolFiles).filter((_, item) => item !== index));
2319
+ if (removed && panel?.kind === "edit" && panel.section === section) openPanel(null);
2320
+ },
2321
+ children: "Remove"
2322
+ }
2323
+ )
2324
+ ] });
2325
+ }
2326
+ function refList(section, refs, noun) {
2327
+ if (refs.length === 0) return /* @__PURE__ */ jsxs7("p", { className: formText.muted, children: [
2328
+ "No ",
2329
+ noun,
2330
+ "s yet."
2331
+ ] });
2332
+ return /* @__PURE__ */ jsx7("ul", { className: "divide-y divide-border rounded-lg border border-border", children: refs.map((ref, index) => {
2333
+ const title = ref.name || (ref.kind === "github" ? basename(ref.path) : `${noun} ${index + 1}`);
2334
+ const issue = section === "skills" ? skillIssue(ref, refs, index) : githubRefIssue(ref, requireGitHubCommitSha);
2335
+ const described = ref.kind === "inline" && section === "skills" ? inlineSkillSummary(ref.content) : null;
2336
+ const words = (text) => text.toLowerCase().replace(/[-_\s]+/g, " ").trim();
2337
+ const summary = described && words(described) !== words(title) ? described : null;
2338
+ const editing = panel?.kind === "edit" && panel.section === section && panel.index === index;
2339
+ return /* @__PURE__ */ jsxs7("li", { className: "space-y-3 p-3", "aria-label": `${noun} ${title}`, children: [
2340
+ /* @__PURE__ */ jsxs7("div", { className: listRow, children: [
2341
+ /* @__PURE__ */ jsxs7("div", { className: "min-w-0", children: [
2342
+ /* @__PURE__ */ jsx7("p", { className: `break-words ${formText.label}`, children: title }),
2343
+ summary && /* @__PURE__ */ jsx7("p", { className: `line-clamp-2 ${formText.muted}`, children: summary }),
2344
+ (ref.kind === "github" || !summary) && /* @__PURE__ */ jsx7("p", { className: `break-words ${formText.muted}`, children: sourceLine(ref) }),
2345
+ issue && /* @__PURE__ */ jsx7("p", { className: formText.error, children: issue })
2346
+ ] }),
2347
+ rowActions2(title, section, index, ref)
2348
+ ] }),
2349
+ editing && (ref.kind === "github" && github ? githubEditor(section, index) : inlineEditor(section, index))
2350
+ ] }, `${section}-${index}`);
2351
+ }) });
2352
+ }
2353
+ function addButtons(section, writeLabel) {
2354
+ if (panel && panel.kind !== "edit" && panel.section === section) {
2355
+ return panel.kind === "add-github" ? githubEditor(section) : inlineEditor(section);
2206
2356
  }
2207
- ) });
2357
+ return /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap gap-2", children: [
2358
+ github && /* @__PURE__ */ jsx7(
2359
+ Button5,
2360
+ {
2361
+ type: "button",
2362
+ size: "compact",
2363
+ variant: "outline",
2364
+ disabled: editingDisabled,
2365
+ onClick: () => openPanel({ kind: "add-github", section }),
2366
+ children: "Add from GitHub"
2367
+ }
2368
+ ),
2369
+ /* @__PURE__ */ jsx7(
2370
+ Button5,
2371
+ {
2372
+ type: "button",
2373
+ size: "compact",
2374
+ variant: "outline",
2375
+ disabled: editingDisabled,
2376
+ onClick: () => openPanel({ kind: "add-inline", section }),
2377
+ children: writeLabel
2378
+ }
2379
+ )
2380
+ ] });
2381
+ }
2382
+ return { github, refFromCheck, addRef, addFile, nameField, githubNameValue, inlineEditor, githubEditor, rowActions: rowActions2, refList, addButtons };
2208
2383
  }
2209
2384
 
2210
2385
  export {
@@ -2212,4 +2387,4 @@ export {
2212
2387
  AGENT_PROFILE_EDITOR_SECTIONS,
2213
2388
  AgentProfileEditor
2214
2389
  };
2215
- //# sourceMappingURL=chunk-HN6MZ2XL.js.map
2390
+ //# sourceMappingURL=chunk-FTNGGR37.js.map