forge-openclaw-plugin 0.2.100 → 0.2.102

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 (189) hide show
  1. package/dist/assets/{activity-page-5oyCFOns.js → activity-page-CgF7K2ww.js} +1 -1
  2. package/dist/assets/ai-surface-workspace-xtB5RFQu.js +1 -0
  3. package/dist/assets/atlas-panel-B3dPHCmZ.js +1 -0
  4. package/dist/assets/{board-BkDRaMp6.js → board-DqHzdCPQ.js} +1 -1
  5. package/dist/assets/{calendar-page-Bo2iua-a.js → calendar-page-C1Wfd2Fy.js} +1 -1
  6. package/dist/assets/{calendar-rules-DA1g3QUk.js → calendar-rules-CaZXtlxt.js} +1 -1
  7. package/dist/assets/calendar-week-toolbar-BZ_-X3Wb.js +1 -0
  8. package/dist/assets/{charts-P7EVhIog.js → charts-FcU0F3XV.js} +8 -8
  9. package/dist/assets/{companion-sync-lab-page-CosNknOK.js → companion-sync-lab-page-NgeK-O-P.js} +1 -1
  10. package/dist/assets/daily-metrics-dashboard-BMyL0Qr4.js +1 -0
  11. package/dist/assets/{entity-note-count-link-BmGDB572.js → entity-note-count-link-BrS1-O0o.js} +1 -1
  12. package/dist/assets/entity-notes-surface-CBylYDwy.js +1 -0
  13. package/dist/assets/{execution-board-CDRXQB85.js → execution-board-CpO2ch6v.js} +1 -1
  14. package/dist/assets/faceted-token-search-D7xPWfOl.js +1 -0
  15. package/dist/assets/flagship-signal-deck-BEFKOhvx.js +1 -0
  16. package/dist/assets/{floating-action-menu-CJkI2iFy.js → floating-action-menu-zzC2r0Ob.js} +1 -1
  17. package/dist/assets/{forms-BFlTgZ3W.js → forms-CmLAyGqz.js} +1 -1
  18. package/dist/assets/{goal-detail-page-cJvHaLMQ.js → goal-detail-page-JK_Nva8e.js} +1 -1
  19. package/dist/assets/goals-page-yeoJ06Vw.js +1 -0
  20. package/dist/assets/{graph-D6JLqDbD.js → graph-BTa79qum.js} +14 -14
  21. package/dist/assets/{habits-page-DKb96_mj.js → habits-page-Dx5EhkJi.js} +1 -1
  22. package/dist/assets/index-BHIKoiZ6.js +19 -0
  23. package/dist/assets/index-H8R-ABM3.css +1 -0
  24. package/dist/assets/insight-flow-dialog-BtIQXXsS.js +1 -0
  25. package/dist/assets/{insights-page-Dc9oFltJ.js → insights-page-CujrosD_.js} +1 -1
  26. package/dist/assets/{kanban-page-JAxerYh6.js → kanban-page-Q9NuIz5w.js} +1 -1
  27. package/dist/assets/knowledge-graph-page-DaJmlvvM.js +1 -0
  28. package/dist/assets/{life-force-page-BGDbQuVh.js → life-force-page-BGDkKfbJ.js} +1 -1
  29. package/dist/assets/{life-force-workspace-B1fYSXRC.js → life-force-workspace-CLVexVnb.js} +1 -1
  30. package/dist/assets/{maps-ClgJoCjz.js → maps-CF1RagUX.js} +1 -1
  31. package/dist/assets/metric-tile-4iMd_WnJ.js +1 -0
  32. package/dist/assets/{motion-BeD44FeG.js → motion-CfdU2F35.js} +1 -1
  33. package/dist/assets/movement-page-ClaoTNuX.js +1 -0
  34. package/dist/assets/note-markdown-CsGQhQXF.js +3 -0
  35. package/dist/assets/note-tags-input-DdZi93tj.js +1 -0
  36. package/dist/assets/notes-page-DYI8s3NN.js +1 -0
  37. package/dist/assets/{open-in-graph-button-Cg5VrKsC.js → open-in-graph-button-C0TGev7c.js} +1 -1
  38. package/dist/assets/orbit-map-DVXkfQdd.js +1 -0
  39. package/dist/assets/overview-page-BwMlFQKX.js +1 -0
  40. package/dist/assets/page-hero-oFHaAjtL.js +1 -0
  41. package/dist/assets/pill-cluster-7UZd_lHp.js +1 -0
  42. package/dist/assets/{preference-entity-handoff-button-D4WAs9pC.js → preference-entity-handoff-button-DOKV9bZc.js} +1 -1
  43. package/dist/assets/preferences-page-BrKEkmfD.js +1 -0
  44. package/dist/assets/{project-collections-DvaX20q_.js → project-collections-CZagCmeH.js} +1 -1
  45. package/dist/assets/{project-detail-page-drPIFZGb.js → project-detail-page-DogvVNEn.js} +1 -1
  46. package/dist/assets/{project-management-hierarchy-page-BUbRXvny.js → project-management-hierarchy-page-Dr7hW9PW.js} +1 -1
  47. package/dist/assets/{project-management-section-nav-C2Ud8Zdd.js → project-management-section-nav-BLdAgTge.js} +1 -1
  48. package/dist/assets/{projects-page-BGzEZUtg.js → projects-page-UKrby_5-.js} +1 -1
  49. package/dist/assets/psyche-behaviors-page-BeVlXvbj.js +5 -0
  50. package/dist/assets/psyche-flashcards-page-CqAWCO4E.js +1 -0
  51. package/dist/assets/psyche-goal-map-page-IyNnbk_W.js +1 -0
  52. package/dist/assets/psyche-graph-IkUQRaDK.js +1 -0
  53. package/dist/assets/{psyche-metrics-page-zYTJDbyZ.js → psyche-metrics-page-uai0a7Lx.js} +1 -1
  54. package/dist/assets/psyche-mode-guide-page-C7p-ABiF.js +1 -0
  55. package/dist/assets/psyche-modes-page-CLQ5V3w0.js +1 -0
  56. package/dist/assets/psyche-page-NQBHkkpU.js +1 -0
  57. package/dist/assets/psyche-patterns-page-BkRiNpI_.js +5 -0
  58. package/dist/assets/psyche-questionnaire-builder-page-Du-7HwPC.js +1 -0
  59. package/dist/assets/psyche-questionnaire-detail-page-C5-yf8MF.js +1 -0
  60. package/dist/assets/psyche-questionnaire-run-detail-page-CoSH5O6R.js +1 -0
  61. package/dist/assets/psyche-questionnaire-run-page-ChI7c1wy.js +1 -0
  62. package/dist/assets/psyche-questionnaires-page-xUcJJzbI.js +1 -0
  63. package/dist/assets/psyche-report-detail-page-BPrZCFZS.js +3 -0
  64. package/dist/assets/psyche-reports-page-D2EXJmm6.js +1 -0
  65. package/dist/assets/{psyche-schemas-HFmg37Wj.js → psyche-schemas-RcZYaokx.js} +1 -1
  66. package/dist/assets/psyche-schemas-beliefs-page-h0ooZ1lp.js +9 -0
  67. package/dist/assets/psyche-screen-time-page-_3-4LikV.js +1 -0
  68. package/dist/assets/psyche-self-observation-page-BdbCsgR5.js +1 -0
  69. package/dist/assets/psyche-values-page-DuUVki5e.js +5 -0
  70. package/dist/assets/report-chain-fields-BBMz0sGI.js +1 -0
  71. package/dist/assets/{rewards-page-C2HQjIAf.js → rewards-page-PZFPa6rR.js} +1 -1
  72. package/dist/assets/{scheduling-rules-editor-BHOpHOrV.js → scheduling-rules-editor-B9KNKsQz.js} +1 -1
  73. package/dist/assets/schema-badge-D93RcG36.js +1 -0
  74. package/dist/assets/schema-visuals-CvC9a3i6.js +1 -0
  75. package/dist/assets/select-menu-Cdq7foRu.js +1 -0
  76. package/dist/assets/{settings-agents-page-VuYXTiyc.js → settings-agents-page-DPx2F6wf.js} +3 -3
  77. package/dist/assets/{settings-bin-page-BNzvYaOk.js → settings-bin-page-COwP3gjo.js} +1 -1
  78. package/dist/assets/settings-calendar-page-C-ghE0YT.js +5 -0
  79. package/dist/assets/{settings-data-page-CGSlryuI.js → settings-data-page-CBubzKBw.js} +1 -1
  80. package/dist/assets/{settings-logs-page-BTK5fine.js → settings-logs-page-uOuXMeBm.js} +1 -1
  81. package/dist/assets/{settings-mobile-page-CRaObOGo.js → settings-mobile-page-C5rfj8_r.js} +1 -1
  82. package/dist/assets/settings-models-page-DijmUWdU.js +1 -0
  83. package/dist/assets/{settings-page-BP81Mb5R.js → settings-page-B4u5TR5g.js} +1 -1
  84. package/dist/assets/{settings-rewards-page-CDJ1PH2G.js → settings-rewards-page-COiTwkMH.js} +1 -1
  85. package/dist/assets/{settings-section-nav-CCFm27r2.js → settings-section-nav-Dc4IeVBt.js} +1 -1
  86. package/dist/assets/{settings-users-page-TdUocFPa.js → settings-users-page-DEGa5DNn.js} +1 -1
  87. package/dist/assets/settings-wiki-page-Cvsiz5_e.js +1 -0
  88. package/dist/assets/{sleep-page-cI1GMVzk.js → sleep-page-BnSOwkEU.js} +1 -1
  89. package/dist/assets/{sports-page-06LTqp0V.js → sports-page-l1RqXzA_.js} +1 -1
  90. package/dist/assets/{state-B-4sS1xO.js → state-VYvD1QVP.js} +1 -1
  91. package/dist/assets/{strategies-page-DXP9Kx8s.js → strategies-page-DEnPlpAs.js} +1 -1
  92. package/dist/assets/{strategy-detail-page-D6mx_Mik.js → strategy-detail-page-Ls8bxKeH.js} +1 -1
  93. package/dist/assets/strategy-dialog-DMyRKrWf.js +1 -0
  94. package/dist/assets/surface-Bfz_sLX6.js +1 -0
  95. package/dist/assets/{table-WfAPUppN.js → table-C0VTeqw0.js} +1 -1
  96. package/dist/assets/task-detail-page-CgrYgQLD.js +1 -0
  97. package/dist/assets/{timebox-planning-dialog-CaCnoslG.js → timebox-planning-dialog-Ww0NGLLo.js} +1 -1
  98. package/dist/assets/today-page-CIuFHMi1.js +1 -0
  99. package/dist/assets/training-load-page-BIwc648i.js +1 -0
  100. package/dist/assets/{ui-C13Nbgas.js → ui-CsEkP2V8.js} +4 -4
  101. package/dist/assets/use-psyche-focus-target-qxT5Oy_z.js +1 -0
  102. package/dist/assets/{vendor-DHkYh85p.js → vendor-kIz9EZnX.js} +237 -222
  103. package/dist/assets/{vitals-page-BQvEjTc6.js → vitals-page-Dz1Jt5H8.js} +1 -1
  104. package/dist/assets/{weekly-review-page-Tp6Q9CRj.js → weekly-review-page-BFpBe1kI.js} +1 -1
  105. package/dist/assets/weight-loss-page-BgMoBpBt.js +5 -0
  106. package/dist/assets/{wiki-article-markdown-DQYohmW2.js → wiki-article-markdown-gsPTXTg1.js} +1 -1
  107. package/dist/assets/{wiki-editor-page-Dem_3eZv.js → wiki-editor-page-BpAZHooY.js} +7 -7
  108. package/dist/assets/{wiki-ingest-history-page-BxoOcCoJ.js → wiki-ingest-history-page-C-ig8O22.js} +1 -1
  109. package/dist/assets/{wiki-ingest-modal-DhguKk3J.js → wiki-ingest-modal-BK4eQgqs.js} +1 -1
  110. package/dist/assets/{wiki-page-BLRxVXkl.js → wiki-page-CMTZ60Zt.js} +1 -1
  111. package/dist/assets/workbench-flow-page-BIpWUcLJ.js +5 -0
  112. package/dist/assets/workbench-page-CtCjYSRe.js +1 -0
  113. package/dist/assets/workout-detail-page-DD9IGN6l.js +2 -0
  114. package/dist/index.html +9 -9
  115. package/dist/openclaw/local-runtime.js +41 -14
  116. package/dist/server/server/migrations/067_weight_loss_daily_active_overrides.sql +13 -0
  117. package/dist/server/server/src/app.js +103 -30
  118. package/dist/server/server/src/health-weight-loss.js +457 -55
  119. package/dist/server/server/src/health.js +12 -4
  120. package/dist/server/server/src/movement.js +84 -1
  121. package/dist/server/server/src/openapi.js +123 -18
  122. package/dist/server/server/src/repositories/model-settings.js +12 -9
  123. package/dist/server/server/src/repositories/settings.js +19 -5
  124. package/dist/server/server/src/watch-mobile.js +22 -10
  125. package/dist/server/src/components/ui/info-tooltip.js +6 -6
  126. package/dist/server/src/lib/api.js +14 -4
  127. package/dist/server/src/lib/theme-system.js +8 -0
  128. package/openclaw.plugin.json +1 -1
  129. package/package.json +3 -3
  130. package/server/migrations/067_weight_loss_daily_active_overrides.sql +13 -0
  131. package/skills/forge-openclaw/SKILL.md +13 -0
  132. package/skills/forge-openclaw/entity_conversation_playbooks.md +7 -1
  133. package/dist/assets/ai-surface-workspace-qgk_B57-.js +0 -1
  134. package/dist/assets/atlas-panel-rfH2qOez.js +0 -1
  135. package/dist/assets/calendar-week-toolbar-DU1Q4RYj.js +0 -1
  136. package/dist/assets/daily-metrics-dashboard-LjuGAB3f.js +0 -1
  137. package/dist/assets/entity-notes-surface-DgEgicaE.js +0 -1
  138. package/dist/assets/faceted-token-search-CE1YauRd.js +0 -1
  139. package/dist/assets/flagship-signal-deck-DDds90Gl.js +0 -1
  140. package/dist/assets/goals-page-f_39hvUV.js +0 -1
  141. package/dist/assets/index-BHTUu_4M.js +0 -19
  142. package/dist/assets/index-CZbuZQjw.css +0 -1
  143. package/dist/assets/insight-flow-dialog-pzAzyayN.js +0 -1
  144. package/dist/assets/knowledge-graph-page-UQ3skqEi.js +0 -1
  145. package/dist/assets/metric-tile-DX6TclqM.js +0 -1
  146. package/dist/assets/movement-page-6HP6nGJx.js +0 -1
  147. package/dist/assets/note-markdown-DiW2-5d3.js +0 -3
  148. package/dist/assets/note-tags-input-DDLXf54U.js +0 -1
  149. package/dist/assets/notes-page-BuguDjhz.js +0 -1
  150. package/dist/assets/orbit-map-GD05-0oS.js +0 -1
  151. package/dist/assets/overview-page-DuOs2OCB.js +0 -1
  152. package/dist/assets/page-hero-CQWo1Mm_.js +0 -1
  153. package/dist/assets/pill-cluster-BJogDRDJ.js +0 -1
  154. package/dist/assets/preferences-page-BaJTMU1I.js +0 -1
  155. package/dist/assets/psyche-behaviors-page-Dmm_Io9D.js +0 -5
  156. package/dist/assets/psyche-flashcards-page-BgNKJ6QJ.js +0 -1
  157. package/dist/assets/psyche-goal-map-page-DXJs98Vr.js +0 -1
  158. package/dist/assets/psyche-graph-CFgs_Bqc.js +0 -1
  159. package/dist/assets/psyche-mode-guide-page-XPgRfCOf.js +0 -1
  160. package/dist/assets/psyche-modes-page-B-GA8oRF.js +0 -1
  161. package/dist/assets/psyche-page--r6a3e1t.js +0 -1
  162. package/dist/assets/psyche-patterns-page-BM5-3bMm.js +0 -5
  163. package/dist/assets/psyche-questionnaire-builder-page-CJshQ-mg.js +0 -1
  164. package/dist/assets/psyche-questionnaire-detail-page-USmR5G5A.js +0 -1
  165. package/dist/assets/psyche-questionnaire-run-detail-page-D7iBCmTi.js +0 -1
  166. package/dist/assets/psyche-questionnaire-run-page-Cpil-kDh.js +0 -1
  167. package/dist/assets/psyche-questionnaires-page-C-_y3VwS.js +0 -1
  168. package/dist/assets/psyche-report-detail-page--dkSPRaj.js +0 -3
  169. package/dist/assets/psyche-reports-page-CUaOXmIN.js +0 -1
  170. package/dist/assets/psyche-schemas-beliefs-page-BX6xaap3.js +0 -9
  171. package/dist/assets/psyche-screen-time-page-CAAI4mD7.js +0 -1
  172. package/dist/assets/psyche-self-observation-page-BZ6FLuwa.js +0 -1
  173. package/dist/assets/psyche-values-page-yEV6MGt8.js +0 -5
  174. package/dist/assets/report-chain-fields-fZ8Xd4H6.js +0 -1
  175. package/dist/assets/schema-badge-DyKbxb51.js +0 -1
  176. package/dist/assets/schema-visuals-D6nxjbYC.js +0 -1
  177. package/dist/assets/select-menu-BX-pZNqL.js +0 -1
  178. package/dist/assets/settings-calendar-page-CjSFB53S.js +0 -5
  179. package/dist/assets/settings-models-page-DFshpYF8.js +0 -1
  180. package/dist/assets/settings-wiki-page-B2zX0QQG.js +0 -1
  181. package/dist/assets/strategy-dialog-BvzomTaF.js +0 -1
  182. package/dist/assets/task-detail-page-BIWIggdp.js +0 -1
  183. package/dist/assets/today-page-DO2mRPT2.js +0 -1
  184. package/dist/assets/training-load-page-CyZ0mlEr.js +0 -1
  185. package/dist/assets/use-psyche-focus-target-C1C_XjYG.js +0 -1
  186. package/dist/assets/weight-loss-page-BBzlhLVV.js +0 -1
  187. package/dist/assets/workbench-flow-page-DqMkCCTy.js +0 -5
  188. package/dist/assets/workbench-page-BWd02wPw.js +0 -1
  189. package/dist/assets/workout-detail-page-BD8u7GyL.js +0 -2
@@ -1,6 +1,6 @@
1
- import{r as v,j as e,df as _e,aK as qe,bl as Ce,c8 as Oe,b8 as De,b4 as Ee,dg as Be,cw as He,cx as Ue}from"./vendor-DHkYh85p.js";import{j as Ke,i as F,k as I}from"./state-B-4sS1xO.js";import{Q as Se,dH as ze,j as M,F as u,I as C,T as $e,c as g,B as P,dI as We,dJ as Qe,dK as Xe,dL as Ge,dM as Ye,dN as Je,dO as Ze,dP as Ve,S as et,E as ye,C as k,V as Z,b as tt,dx as st,b$ as at,dQ as it,dR as nt,dS as rt,dT as ot,dU as lt}from"./index-BHTUu_4M.js";import{R as dt,P as ct,O as ht,C as pt,T as xt,D as mt,a as ut}from"./ui-C13Nbgas.js";import{m as gt}from"./motion-BeD44FeG.js";import{S as vt}from"./settings-section-nav-CCFm27r2.js";import{P as bt}from"./page-hero-CQWo1Mm_.js";import{M as W}from"./metric-tile-DX6TclqM.js";import"./board-BkDRaMp6.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";const G=["read","write","insights","rewards.manage","psyche.read","psyche.write","psyche.note","psyche.insight","psyche.mode"],wt=[{value:"read",label:"Read",description:"Inspect goals, projects, tasks, reviews, and metrics."},{value:"write",label:"Write",description:"Create and update work through the versioned API."},{value:"insights",label:"Insights",description:"Store structured findings, rationale, and feedback."},{value:"rewards.manage",label:"Rewards",description:"Tune reward rules and issue explainable bonus XP grants."},{value:"psyche.read",label:"Psyche read",description:"Read sensitive values, patterns, and trigger analyses."},{value:"psyche.write",label:"Psyche write",description:"Create and update sensitive therapeutic records."},{value:"psyche.note",label:"Psyche note",description:"Create and edit Markdown notes linked to reflective records."},{value:"psyche.insight",label:"Psyche insight",description:"Store therapeutic insights on Psyche entities."},{value:"psyche.mode",label:"Psyche mode",description:"Name, refine, and map mode profiles and guided mode results."}],se={mode:"active_only",goalsLimit:5,projectsLimit:8,tasksLimit:10,habitsLimit:6,strategiesLimit:4,peoplePageLimit:4,includePeoplePages:!0},X={userIds:[],projectIds:[],tagIds:[]};function V(a){return a==="review"?{mode:"active_only",goalsLimit:3,projectsLimit:5,tasksLimit:6,habitsLimit:4,strategiesLimit:3,peoplePageLimit:0,includePeoplePages:!1}:a==="operator"?{...se}:a==="autonomous"?{mode:"scoped",goalsLimit:10,projectsLimit:14,tasksLimit:16,habitsLimit:10,strategiesLimit:8,peoplePageLimit:6,includePeoplePages:!0}:{...se}}function ee(a){return Array.from(new Set(a.split(",").map(n=>n.trim()).filter(n=>n.length>0)))}function Ae(a,n,l){return n==="review"?{...a,preset:n,trustLevel:"trusted",autonomyMode:"approval_required",approvalMode:"approval_by_default",scopes:[...l],bootstrapPolicy:V(n),scopePolicy:{...X}}:n==="operator"?{...a,preset:n,trustLevel:"trusted",autonomyMode:"scoped_write",approvalMode:"high_impact_only",scopes:[...G],bootstrapPolicy:V(n),scopePolicy:{...X}}:n==="autonomous"?{...a,preset:n,trustLevel:"autonomous",autonomyMode:"autonomous",approvalMode:"none",scopes:[...G],bootstrapPolicy:V(n),scopePolicy:{...X}}:{...a,preset:n}}function fe(a,n,l){const m={preset:a,label:"Forge Pilot Token",agentLabel:n,agentType:"assistant",description:"Collaborative planning agent.",trustLevel:"trusted",autonomyMode:"scoped_write",approvalMode:"high_impact_only",scopes:[...G],bootstrapPolicy:{...se},scopePolicy:{...X}};return Ae(m,a,l)}function jt({open:a,onOpenChange:n,pending:l=!1,initialPreset:m="operator",defaultAgentLabel:p="OpenClaw",recommendedScopes:b=[...G],onSubmit:f}){const[h,j]=v.useState(()=>fe(m,p,b)),[_,w]=v.useState(null);v.useEffect(()=>{a&&(j(fe(m,p,b)),w(null))},[a,m,p,b]);const A=[{id:"preset",eyebrow:"Agent token",title:"Choose a starting point for this token",description:"Each preset locks in a sensible trust, autonomy, and approval policy. You can tune any setting in the next steps.",render:(i,r)=>e.jsx(M,{columns:3,value:i.preset,onChange:s=>r(Ae(i,s,b)),options:[{value:"review",label:"Review-first",description:"Every action waits for your approval. Safe starting point for a new agent you have not yet trusted."},{value:"operator",label:"Full operator",description:"Trusted collaborator with full scopes. High-impact actions still ask for approval."},{value:"autonomous",label:"Autonomous pilot",description:"No approval gates. Use only for agents you have fully verified in a controlled setup."},{value:"custom",label:"Custom",description:"Start from a blank slate and configure every dimension yourself."}]})},{id:"identity",eyebrow:"Agent identity",title:"Name the agent and this token",description:"The agent name appears in logs, approval requests, and audit trails. The token label is for your reference.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"Agent name",labelHelp:"This label identifies the agent in every log entry, approval notification, and XP attribution. Pick something memorable.",children:e.jsx(C,{value:i.agentLabel,placeholder:"OpenClaw",onChange:s=>r({agentLabel:s.target.value})})}),e.jsx(u,{label:"Token label",description:"A short name for this credential — mainly for your reference in the token list.",children:e.jsx(C,{value:i.label,placeholder:"Forge Pilot Token",onChange:s=>r({label:s.target.value})})}),e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsx(u,{label:"Agent type",labelHelp:"Use 'assistant' for interactive agents. Use 'automation' for scripts or scheduled jobs with no conversational layer.",children:e.jsxs("select",{className:"rounded-[14px] bg-white/[0.06] px-3 py-3 text-white",value:i.agentType,onChange:s=>r({agentType:s.target.value}),children:[e.jsx("option",{value:"assistant",children:"assistant"}),e.jsx("option",{value:"automation",children:"automation"}),e.jsx("option",{value:"observer",children:"observer"})]})}),e.jsx(u,{label:"Description",description:"Optional note about what this agent does.",children:e.jsx(C,{value:i.description,placeholder:"Collaborative planning agent.",onChange:s=>r({description:s.target.value})})})]})]})},{id:"policy",eyebrow:"Access policy",title:"Set trust level and approval behaviour",description:"These three settings control how much autonomy the agent has and when it needs your sign-off. The preset you chose filled sensible defaults — adjust only if needed.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"Trust level",labelHelp:"Standard agents are sandboxed readers. Trusted agents can write with policy guardrails. Autonomous agents bypass all trust checks — use with care.",children:e.jsx(M,{columns:3,value:i.trustLevel,onChange:s=>r({trustLevel:s}),options:[{value:"standard",label:"Standard",description:"Read-only by default, limited write surface."},{value:"trusted",label:"Trusted",description:"Full write surface with policy guardrails active."},{value:"autonomous",label:"Autonomous",description:"All checks bypassed — maximum capability."}]})}),e.jsx(u,{label:"Autonomy mode",labelHelp:"Approval-required means every mutation is held for review. Scoped write lets the agent act within its scopes. Autonomous skips all gates.",children:e.jsx(M,{columns:3,value:i.autonomyMode,onChange:s=>r({autonomyMode:s}),options:[{value:"approval_required",label:"Approval required",description:"Every write action queues for your review."},{value:"scoped_write",label:"Scoped write",description:"Acts freely within its assigned scopes."},{value:"autonomous",label:"Autonomous",description:"No gates — full freedom to write."}]})}),e.jsx(u,{label:"Approval policy",labelHelp:"Controls which actions trigger the approval queue. High-impact-only is the balanced default: routine writes go through, large mutations get reviewed.",children:e.jsx(M,{columns:3,value:i.approvalMode,onChange:s=>r({approvalMode:s}),options:[{value:"approval_by_default",label:"Approve by default",description:"Everything needs a sign-off unless explicitly exempt."},{value:"high_impact_only",label:"High impact only",description:"Routine writes pass through; high-stakes actions are held."},{value:"none",label:"None",description:"No approval gates — actions execute immediately."}]})})]})},{id:"scopes",eyebrow:"Scopes",title:"Select what this agent can access",description:"Scope selection follows the principle of least privilege — only grant what the agent actually needs. The full operator bundle covers every capability.",render:(i,r)=>e.jsxs(u,{label:"Capabilities",labelHelp:"Read lets the agent inspect the system. Write lets it create and update work. Rewards and Psyche scopes unlock more sensitive subsystems.",children:[e.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:wt.map(s=>{const y=i.scopes.includes(s.value);return e.jsxs("button",{type:"button",className:`rounded-[18px] border px-4 py-4 text-left transition ${y?"border-[rgba(192,193,255,0.28)] bg-[rgba(192,193,255,0.14)] text-white":"border-white/8 bg-white/[0.04] text-white/58 hover:bg-white/[0.08]"}`,onClick:()=>{if(y){if(i.scopes.length===1)return;r({scopes:i.scopes.filter(S=>S!==s.value)})}else r({scopes:[...i.scopes,s.value]})},children:[e.jsx("div",{className:"font-medium",children:s.label}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-white/58",children:s.description})]},s.value)})}),e.jsxs("div",{className:"mt-2 text-xs text-white/40",children:[i.scopes.length," scope",i.scopes.length!==1?"s":""," ","selected"]})]})},{id:"default-scope",eyebrow:"Default read scope",title:"Decide which owners and slices this agent sees by default",description:"Leave these blank for broad reads. When set, Forge automatically narrows overview, context, and bootstrap reads for this token unless the request narrows further.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"Default user IDs",description:"Comma-separated owner ids such as user_operator or user_forge_bot.",labelHelp:"If you set user ids here, this token only sees that owner slice by default. Explicit userIds in a request can narrow further, but they will not silently widen beyond this list.",children:e.jsx(C,{value:i.scopePolicy.userIds.join(", "),placeholder:"user_operator, user_forge_bot",onChange:s=>r({scopePolicy:{...i.scopePolicy,userIds:ee(s.target.value)}})})}),e.jsx(u,{label:"Project IDs",description:"Optional project-level boundary for overview, context, and bootstrap reads.",children:e.jsx(C,{value:i.scopePolicy.projectIds.join(", "),placeholder:"project_123, project_456",onChange:s=>r({scopePolicy:{...i.scopePolicy,projectIds:ee(s.target.value)}})})}),e.jsx(u,{label:"Tag IDs",description:"Optional tag-level boundary for overview, context, and bootstrap reads.",children:e.jsx(C,{value:i.scopePolicy.tagIds.join(", "),placeholder:"tag_focus, tag_client",onChange:s=>r({scopePolicy:{...i.scopePolicy,tagIds:ee(s.target.value)}})})}),e.jsxs("div",{className:"rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm leading-6 text-white/62",children:["Default scope summary:"," ",i.scopePolicy.userIds.length>0?`${i.scopePolicy.userIds.length} user slice${i.scopePolicy.userIds.length===1?"":"s"}`:"all visible users",i.scopePolicy.projectIds.length>0?` · ${i.scopePolicy.projectIds.length} project ${i.scopePolicy.projectIds.length===1?"boundary":"boundaries"}`:"",i.scopePolicy.tagIds.length>0?` · ${i.scopePolicy.tagIds.length} tag ${i.scopePolicy.tagIds.length===1?"boundary":"boundaries"}`:""]})]})},{id:"bootstrap",eyebrow:"Bootstrap",title:"Decide how much Forge context is injected at session start",description:"This controls the automatic BOOTSTRAP snapshot for agent sessions. Keep it lean unless the agent genuinely needs broad context on every new session.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"Bootstrap mode",labelHelp:"Disabled injects nothing. Active-only keeps a compact current-work snapshot. Scoped keeps budgets but not status filters. Full mirrors the legacy broad bootstrap.",children:e.jsx(M,{columns:3,value:i.bootstrapPolicy.mode,onChange:s=>r({bootstrapPolicy:{...i.bootstrapPolicy,mode:s}}),options:[{value:"disabled",label:"Disabled",description:"No automatic Forge snapshot is injected."},{value:"active_only",label:"Active only",description:"Only active projects, focus tasks, due habits, and bounded summaries."},{value:"scoped",label:"Scoped",description:"Bounded lists without forcing only active items."},{value:"full",label:"Full",description:"Legacy broad bootstrap. Highest context cost."}]})}),e.jsx("div",{className:"grid gap-5 md:grid-cols-3",children:[["goalsLimit","Goals"],["projectsLimit","Projects"],["tasksLimit","Tasks"],["habitsLimit","Habits"],["strategiesLimit","Strategies"],["peoplePageLimit","People pages"]].map(([s,y])=>e.jsx(u,{label:y,children:e.jsx(C,{type:"number",min:0,max:s==="peoplePageLimit"?50:100,value:i.bootstrapPolicy[s],onChange:S=>r({bootstrapPolicy:{...i.bootstrapPolicy,[s]:Number(S.target.value||0)}})})},s))}),e.jsxs("label",{className:"flex items-center gap-3 rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm text-white/70",children:[e.jsx("input",{type:"checkbox",checked:i.bootstrapPolicy.includePeoplePages,onChange:s=>r({bootstrapPolicy:{...i.bootstrapPolicy,includePeoplePages:s.target.checked}})}),"Include People wiki pages in the bootstrap snapshot"]})]})}];return e.jsx(Se,{open:a,onOpenChange:n,eyebrow:"Agent setup",title:"Issue an agent token",description:"Configure a new agent token step by step. The preset fills sensible defaults — adjust what you need.",value:h,onChange:j,draftPersistenceKey:"settings.agent-token.new",steps:A,submitLabel:"Issue token",pending:l,pendingLabel:"Issuing token…",error:_,onSubmit:async()=>{w(null);const i=ze.safeParse({label:h.label,agentLabel:h.agentLabel,agentType:h.agentType,description:h.description,trustLevel:h.trustLevel,autonomyMode:h.autonomyMode,approvalMode:h.approvalMode,scopes:h.scopes,bootstrapPolicy:h.bootstrapPolicy,scopePolicy:h.scopePolicy});if(!i.success){const r=i.error.issues[0];w((r==null?void 0:r.message)??"Check the agent name and at least one scope before issuing.");return}try{await f(i.data),n(!1)}catch(r){w(r instanceof Error?r.message:"Could not issue the token right now.")}}})}function Ne(a){return{source:"new",taskId:"",title:"",description:"",owner:a,projectId:"",status:"done",points:40}}function yt({open:a,onOpenChange:n,pending:l=!1,defaultOwner:m="",availableTasks:p=[],availableProjects:b=[],onSubmit:f}){const[h,j]=v.useState(()=>Ne(m)),[_,w]=v.useState(null);v.useEffect(()=>{a&&(j(Ne(m)),w(null))},[a,m]);const A=[{id:"source",eyebrow:"Log work",title:"Is this work already tracked?",description:"If a task exists, link the work to it so Forge can update the record with the right status and XP. If not, a new task will be created from what you describe.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(M,{columns:2,value:i.source,onChange:s=>r({source:s,taskId:""}),options:[{value:"new",label:"New task",description:"The work is not tracked yet — Forge will create a task and log the time against it."},{value:"existing",label:"Existing task",description:"Pick a task already in the board. The log will update its record and award XP."}]}),i.source==="existing"&&p.length>0?e.jsx(u,{label:"Pick the task",description:"Select the task this work belongs to.",children:e.jsxs("select",{className:"rounded-[14px] bg-white/[0.06] px-3 py-3 text-white",value:i.taskId,onChange:s=>r({taskId:s.target.value}),children:[e.jsx("option",{value:"",children:"— choose a task —"}),p.map(s=>e.jsxs("option",{value:s.id,children:[s.title," · ",s.status.replaceAll("_"," ")]},s.id))]})}):i.source==="existing"&&p.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3 text-sm text-white/58",children:'No tasks are loaded yet. Switch to "New task" to create one from scratch.'}):null]})},{id:"details",eyebrow:"Work details",title:"Describe what was done",description:"Give the work a clear title and enough context to understand it later. These become the task record if you are creating a new one.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"Title",labelHelp:"Write the title like a short achievement: what was completed, not what was started.",children:e.jsx(C,{value:i.title,placeholder:"Write postmortem draft",onChange:s=>r({title:s.target.value})})}),e.jsx(u,{label:"Owner",description:"Who did this work? Defaults to the operator name.",children:e.jsx(C,{value:i.owner,placeholder:"Your name",onChange:s=>r({owner:s.target.value})})}),e.jsx(u,{label:"Description",description:"What moved forward? What should remain visible in the project history?",children:e.jsx($e,{className:"min-h-28",value:i.description,placeholder:"Wrote the full incident timeline and drafted the three key learnings for the team retrospective.",onChange:s=>r({description:s.target.value})})})]})},{id:"placement",eyebrow:"Placement",title:"Set the context and XP value",description:"Assign the work to a project and choose its final status. The XP value controls how much this work contributes to the operator's progress curve.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsx(u,{label:"Project",description:"Link this work to an active project if it belongs to one.",children:e.jsxs("select",{className:"rounded-[14px] bg-white/[0.06] px-3 py-3 text-white",value:i.projectId,onChange:s=>r({projectId:s.target.value}),children:[e.jsx("option",{value:"",children:"No project link"}),b.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))]})}),e.jsx(u,{label:"Final status",labelHelp:"'Done' is the most common choice. Use 'In progress' if the work was real but the task is still open.",children:e.jsx(M,{columns:2,value:i.status,onChange:s=>r({status:s}),options:[{value:"done",label:"Done",description:"Work is complete."},{value:"in_progress",label:"In progress",description:"Still active but already worth logging."},{value:"focus",label:"Focus",description:"Moved into focus."},{value:"blocked",label:"Blocked",description:"Work hit a wall."}]})})]}),e.jsx(u,{label:"XP value",labelHelp:"Typical task XP ranges from 20 to 100. Use 40 for routine tasks, 80+ for complex deliverables.",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(C,{type:"number",min:5,max:500,className:"w-36",value:i.points,onChange:s=>r({points:Number(s.target.value)})}),e.jsx("div",{className:"flex gap-2",children:[20,40,80,120].map(s=>e.jsxs("button",{type:"button",className:`rounded-full px-3 py-1.5 text-xs transition ${i.points===s?"bg-white/18 text-white":"bg-white/[0.06] text-white/55 hover:bg-white/[0.10]"}`,onClick:()=>r({points:s}),children:[s," xp"]},s))})]})})]})}];return e.jsx(Se,{open:a,onOpenChange:n,eyebrow:"Log work",title:"Log retroactive work",description:"Capture work that happened outside the timer so it counts toward progress and XP.",value:h,onChange:j,draftPersistenceKey:"settings.log-work",steps:A,submitLabel:"Log work",pending:l,pendingLabel:"Logging work…",error:_,onSubmit:async()=>{if(w(null),h.source==="new"&&h.title.trim().length===0){w("Add a title so Forge knows what work to create.");return}if(h.source==="existing"&&!h.taskId){w("Pick an existing task or switch to New task.");return}try{await f({taskId:h.source==="existing"&&h.taskId?h.taskId:void 0,title:h.source==="new"&&h.title.trim()?h.title.trim():void 0,description:h.description.trim()||void 0,owner:h.owner.trim()||void 0,projectId:h.projectId||null,status:h.status,points:h.points}),n(!1)}catch(i){w(i instanceof Error?i.message:"Could not log the work right now.")}}})}function Te({text:a}){const[n,l]=v.useState(!1),m=async()=>{try{await navigator.clipboard.writeText(a),l(!0),setTimeout(()=>l(!1),2200)}catch{}};return e.jsxs("button",{type:"button",onClick:()=>void m(),className:"flex items-center gap-1.5 rounded-full bg-white/[0.07] px-3 py-1.5 text-xs font-medium text-white/65 transition hover:bg-white/[0.12] hover:text-white",children:[n?e.jsx(Ce,{className:"size-3 text-emerald-400"}):e.jsx(Oe,{className:"size-3"}),n?"Copied":"Copy"]})}function te({label:a,children:n,copyText:l}){return e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:a}),e.jsx(Te,{text:l??n})]}),e.jsx("pre",{className:"mt-3 overflow-x-auto rounded-[14px] bg-[rgba(8,13,28,0.78)] p-3 text-xs leading-6 text-white/78",children:e.jsx("code",{children:n})})]})}function ft({open:a,onOpenChange:n,state:l}){if(!l)return null;const{tokenString:m,agentLabel:p,onboarding:b}=l,f=JSON.stringify({baseUrl:b.forgeBaseUrl,apiToken:m,actorLabel:p,timeoutMs:b.defaultTimeoutMs},null,2),h=[`curl -s ${b.healthUrl} \\`,` -H "Authorization: Bearer ${m}" \\`,' -H "X-Forge-Source: agent" \\',` -H "X-Forge-Actor: ${p}"`].join(`
1
+ import{r as v,j as e,de as _e,aK as qe,bl as Ce,c8 as Oe,b8 as De,b4 as Ee,df as Be,cw as He,cx as Ue}from"./vendor-kIz9EZnX.js";import{j as Ke,i as F,k as I}from"./state-VYvD1QVP.js";import{Q as Se,dF as $e,j as M,F as u,I as C,T as ze,c as g,B as P,dG as We,dH as Qe,dI as Xe,dJ as Ge,dK as Ye,dL as Je,dM as Ze,dN as Ve,S as et,E as ye,C as k,V as Z,b as tt,du as st,dv as at,dO as it,dP as nt,dQ as rt,dR as ot,dS as lt}from"./index-BHIKoiZ6.js";import{R as dt,P as ct,O as ht,C as mt,T as pt,D as xt,a as ut}from"./ui-CsEkP2V8.js";import{m as gt}from"./motion-CfdU2F35.js";import{S as vt}from"./settings-section-nav-Dc4IeVBt.js";import{P as wt}from"./page-hero-oFHaAjtL.js";import{M as W}from"./metric-tile-4iMd_WnJ.js";import"./forms-CmLAyGqz.js";import"./board-DqHzdCPQ.js";import"./graph-BTa79qum.js";const G=["read","write","insights","rewards.manage","psyche.read","psyche.write","psyche.note","psyche.insight","psyche.mode"],bt=[{value:"read",label:"Read",description:"Inspect goals, projects, tasks, reviews, and metrics."},{value:"write",label:"Write",description:"Create and update work through the versioned API."},{value:"insights",label:"Insights",description:"Store structured findings, rationale, and feedback."},{value:"rewards.manage",label:"Rewards",description:"Tune reward rules and issue explainable bonus XP grants."},{value:"psyche.read",label:"Psyche read",description:"Read sensitive values, patterns, and trigger analyses."},{value:"psyche.write",label:"Psyche write",description:"Create and update sensitive therapeutic records."},{value:"psyche.note",label:"Psyche note",description:"Create and edit Markdown notes linked to reflective records."},{value:"psyche.insight",label:"Psyche insight",description:"Store therapeutic insights on Psyche entities."},{value:"psyche.mode",label:"Psyche mode",description:"Name, refine, and map mode profiles and guided mode results."}],se={mode:"active_only",goalsLimit:5,projectsLimit:8,tasksLimit:10,habitsLimit:6,strategiesLimit:4,peoplePageLimit:4,includePeoplePages:!0},X={userIds:[],projectIds:[],tagIds:[]};function V(a){return a==="review"?{mode:"active_only",goalsLimit:3,projectsLimit:5,tasksLimit:6,habitsLimit:4,strategiesLimit:3,peoplePageLimit:0,includePeoplePages:!1}:a==="operator"?{...se}:a==="autonomous"?{mode:"scoped",goalsLimit:10,projectsLimit:14,tasksLimit:16,habitsLimit:10,strategiesLimit:8,peoplePageLimit:6,includePeoplePages:!0}:{...se}}function ee(a){return Array.from(new Set(a.split(",").map(n=>n.trim()).filter(n=>n.length>0)))}function Ae(a,n,l){return n==="review"?{...a,preset:n,trustLevel:"trusted",autonomyMode:"approval_required",approvalMode:"approval_by_default",scopes:[...l],bootstrapPolicy:V(n),scopePolicy:{...X}}:n==="operator"?{...a,preset:n,trustLevel:"trusted",autonomyMode:"scoped_write",approvalMode:"high_impact_only",scopes:[...G],bootstrapPolicy:V(n),scopePolicy:{...X}}:n==="autonomous"?{...a,preset:n,trustLevel:"autonomous",autonomyMode:"autonomous",approvalMode:"none",scopes:[...G],bootstrapPolicy:V(n),scopePolicy:{...X}}:{...a,preset:n}}function fe(a,n,l){const x={preset:a,label:"Forge Pilot Token",agentLabel:n,agentType:"assistant",description:"Collaborative planning agent.",trustLevel:"trusted",autonomyMode:"scoped_write",approvalMode:"high_impact_only",scopes:[...G],bootstrapPolicy:{...se},scopePolicy:{...X}};return Ae(x,a,l)}function jt({open:a,onOpenChange:n,pending:l=!1,initialPreset:x="operator",defaultAgentLabel:m="OpenClaw",recommendedScopes:w=[...G],onSubmit:f}){const[h,j]=v.useState(()=>fe(x,m,w)),[_,b]=v.useState(null);v.useEffect(()=>{a&&(j(fe(x,m,w)),b(null))},[a,x,m,w]);const A=[{id:"preset",eyebrow:"Agent token",title:"Choose a starting point for this token",description:"Each preset locks in a sensible trust, autonomy, and approval policy. You can tune any setting in the next steps.",render:(i,r)=>e.jsx(M,{columns:3,value:i.preset,onChange:s=>r(Ae(i,s,w)),options:[{value:"review",label:"Review-first",description:"Every action waits for your approval. Safe starting point for a new agent you have not yet trusted."},{value:"operator",label:"Full operator",description:"Trusted collaborator with full scopes. High-impact actions still ask for approval."},{value:"autonomous",label:"Autonomous pilot",description:"No approval gates. Use only for agents you have fully verified in a controlled setup."},{value:"custom",label:"Custom",description:"Start from a blank slate and configure every dimension yourself."}]})},{id:"identity",eyebrow:"Agent identity",title:"Name the agent and this token",description:"The agent name appears in logs, approval requests, and audit trails. The token label is for your reference.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"Agent name",labelHelp:"This label identifies the agent in every log entry, approval notification, and XP attribution. Pick something memorable.",children:e.jsx(C,{value:i.agentLabel,placeholder:"OpenClaw",onChange:s=>r({agentLabel:s.target.value})})}),e.jsx(u,{label:"Token label",description:"A short name for this credential — mainly for your reference in the token list.",children:e.jsx(C,{value:i.label,placeholder:"Forge Pilot Token",onChange:s=>r({label:s.target.value})})}),e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsx(u,{label:"Agent type",labelHelp:"Use 'assistant' for interactive agents. Use 'automation' for scripts or scheduled jobs with no conversational layer.",children:e.jsxs("select",{className:"rounded-[14px] bg-white/[0.06] px-3 py-3 text-white",value:i.agentType,onChange:s=>r({agentType:s.target.value}),children:[e.jsx("option",{value:"assistant",children:"assistant"}),e.jsx("option",{value:"automation",children:"automation"}),e.jsx("option",{value:"observer",children:"observer"})]})}),e.jsx(u,{label:"Description",description:"Optional note about what this agent does.",children:e.jsx(C,{value:i.description,placeholder:"Collaborative planning agent.",onChange:s=>r({description:s.target.value})})})]})]})},{id:"policy",eyebrow:"Access policy",title:"Set trust level and approval behaviour",description:"These three settings control how much autonomy the agent has and when it needs your sign-off. The preset you chose filled sensible defaults — adjust only if needed.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"Trust level",labelHelp:"Standard agents are sandboxed readers. Trusted agents can write with policy guardrails. Autonomous agents bypass all trust checks — use with care.",children:e.jsx(M,{columns:3,value:i.trustLevel,onChange:s=>r({trustLevel:s}),options:[{value:"standard",label:"Standard",description:"Read-only by default, limited write surface."},{value:"trusted",label:"Trusted",description:"Full write surface with policy guardrails active."},{value:"autonomous",label:"Autonomous",description:"All checks bypassed — maximum capability."}]})}),e.jsx(u,{label:"Autonomy mode",labelHelp:"Approval-required means every mutation is held for review. Scoped write lets the agent act within its scopes. Autonomous skips all gates.",children:e.jsx(M,{columns:3,value:i.autonomyMode,onChange:s=>r({autonomyMode:s}),options:[{value:"approval_required",label:"Approval required",description:"Every write action queues for your review."},{value:"scoped_write",label:"Scoped write",description:"Acts freely within its assigned scopes."},{value:"autonomous",label:"Autonomous",description:"No gates — full freedom to write."}]})}),e.jsx(u,{label:"Approval policy",labelHelp:"Controls which actions trigger the approval queue. High-impact-only is the balanced default: routine writes go through, large mutations get reviewed.",children:e.jsx(M,{columns:3,value:i.approvalMode,onChange:s=>r({approvalMode:s}),options:[{value:"approval_by_default",label:"Approve by default",description:"Everything needs a sign-off unless explicitly exempt."},{value:"high_impact_only",label:"High impact only",description:"Routine writes pass through; high-stakes actions are held."},{value:"none",label:"None",description:"No approval gates — actions execute immediately."}]})})]})},{id:"scopes",eyebrow:"Scopes",title:"Select what this agent can access",description:"Scope selection follows the principle of least privilege — only grant what the agent actually needs. The full operator bundle covers every capability.",render:(i,r)=>e.jsxs(u,{label:"Capabilities",labelHelp:"Read lets the agent inspect the system. Write lets it create and update work. Rewards and Psyche scopes unlock more sensitive subsystems.",children:[e.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:bt.map(s=>{const y=i.scopes.includes(s.value);return e.jsxs("button",{type:"button",className:`rounded-[18px] border px-4 py-4 text-left transition ${y?"border-[rgba(192,193,255,0.28)] bg-[rgba(192,193,255,0.14)] text-white":"border-white/8 bg-white/[0.04] text-white/58 hover:bg-white/[0.08]"}`,onClick:()=>{if(y){if(i.scopes.length===1)return;r({scopes:i.scopes.filter(S=>S!==s.value)})}else r({scopes:[...i.scopes,s.value]})},children:[e.jsx("div",{className:"font-medium",children:s.label}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-white/58",children:s.description})]},s.value)})}),e.jsxs("div",{className:"mt-2 text-xs text-white/40",children:[i.scopes.length," scope",i.scopes.length!==1?"s":""," ","selected"]})]})},{id:"default-scope",eyebrow:"Default read scope",title:"Decide which owners and slices this agent sees by default",description:"Leave these blank for broad reads. When set, Forge automatically narrows overview, context, and bootstrap reads for this token unless the request narrows further.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"Default user IDs",description:"Comma-separated owner ids such as user_operator or user_forge_bot.",labelHelp:"If you set user ids here, this token only sees that owner slice by default. Explicit userIds in a request can narrow further, but they will not silently widen beyond this list.",children:e.jsx(C,{value:i.scopePolicy.userIds.join(", "),placeholder:"user_operator, user_forge_bot",onChange:s=>r({scopePolicy:{...i.scopePolicy,userIds:ee(s.target.value)}})})}),e.jsx(u,{label:"Project IDs",description:"Optional project-level boundary for overview, context, and bootstrap reads.",children:e.jsx(C,{value:i.scopePolicy.projectIds.join(", "),placeholder:"project_123, project_456",onChange:s=>r({scopePolicy:{...i.scopePolicy,projectIds:ee(s.target.value)}})})}),e.jsx(u,{label:"Tag IDs",description:"Optional tag-level boundary for overview, context, and bootstrap reads.",children:e.jsx(C,{value:i.scopePolicy.tagIds.join(", "),placeholder:"tag_focus, tag_client",onChange:s=>r({scopePolicy:{...i.scopePolicy,tagIds:ee(s.target.value)}})})}),e.jsxs("div",{className:"rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm leading-6 text-white/62",children:["Default scope summary:"," ",i.scopePolicy.userIds.length>0?`${i.scopePolicy.userIds.length} user slice${i.scopePolicy.userIds.length===1?"":"s"}`:"all visible users",i.scopePolicy.projectIds.length>0?` · ${i.scopePolicy.projectIds.length} project ${i.scopePolicy.projectIds.length===1?"boundary":"boundaries"}`:"",i.scopePolicy.tagIds.length>0?` · ${i.scopePolicy.tagIds.length} tag ${i.scopePolicy.tagIds.length===1?"boundary":"boundaries"}`:""]})]})},{id:"bootstrap",eyebrow:"Bootstrap",title:"Decide how much Forge context is injected at session start",description:"This controls the automatic BOOTSTRAP snapshot for agent sessions. Keep it lean unless the agent genuinely needs broad context on every new session.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"Bootstrap mode",labelHelp:"Disabled injects nothing. Active-only keeps a compact current-work snapshot. Scoped keeps budgets but not status filters. Full mirrors the legacy broad bootstrap.",children:e.jsx(M,{columns:3,value:i.bootstrapPolicy.mode,onChange:s=>r({bootstrapPolicy:{...i.bootstrapPolicy,mode:s}}),options:[{value:"disabled",label:"Disabled",description:"No automatic Forge snapshot is injected."},{value:"active_only",label:"Active only",description:"Only active projects, focus tasks, due habits, and bounded summaries."},{value:"scoped",label:"Scoped",description:"Bounded lists without forcing only active items."},{value:"full",label:"Full",description:"Legacy broad bootstrap. Highest context cost."}]})}),e.jsx("div",{className:"grid gap-5 md:grid-cols-3",children:[["goalsLimit","Goals"],["projectsLimit","Projects"],["tasksLimit","Tasks"],["habitsLimit","Habits"],["strategiesLimit","Strategies"],["peoplePageLimit","People pages"]].map(([s,y])=>e.jsx(u,{label:y,children:e.jsx(C,{type:"number",min:0,max:s==="peoplePageLimit"?50:100,value:i.bootstrapPolicy[s],onChange:S=>r({bootstrapPolicy:{...i.bootstrapPolicy,[s]:Number(S.target.value||0)}})})},s))}),e.jsxs("label",{className:"flex items-center gap-3 rounded-[16px] bg-white/[0.04] px-4 py-3 text-sm text-white/70",children:[e.jsx("input",{type:"checkbox",checked:i.bootstrapPolicy.includePeoplePages,onChange:s=>r({bootstrapPolicy:{...i.bootstrapPolicy,includePeoplePages:s.target.checked}})}),"Include People wiki pages in the bootstrap snapshot"]})]})}];return e.jsx(Se,{open:a,onOpenChange:n,eyebrow:"Agent setup",title:"Issue an agent token",description:"Configure a new agent token step by step. The preset fills sensible defaults — adjust what you need.",value:h,onChange:j,draftPersistenceKey:"settings.agent-token.new",steps:A,submitLabel:"Issue token",pending:l,pendingLabel:"Issuing token…",error:_,onSubmit:async()=>{b(null);const i=$e.safeParse({label:h.label,agentLabel:h.agentLabel,agentType:h.agentType,description:h.description,trustLevel:h.trustLevel,autonomyMode:h.autonomyMode,approvalMode:h.approvalMode,scopes:h.scopes,bootstrapPolicy:h.bootstrapPolicy,scopePolicy:h.scopePolicy});if(!i.success){const r=i.error.issues[0];b((r==null?void 0:r.message)??"Check the agent name and at least one scope before issuing.");return}try{await f(i.data),n(!1)}catch(r){b(r instanceof Error?r.message:"Could not issue the token right now.")}}})}function Ne(a){return{source:"new",taskId:"",title:"",description:"",owner:a,projectId:"",status:"done",points:40}}function yt({open:a,onOpenChange:n,pending:l=!1,defaultOwner:x="",availableTasks:m=[],availableProjects:w=[],onSubmit:f}){const[h,j]=v.useState(()=>Ne(x)),[_,b]=v.useState(null);v.useEffect(()=>{a&&(j(Ne(x)),b(null))},[a,x]);const A=[{id:"source",eyebrow:"Log work",title:"Is this work already tracked?",description:"If a task exists, link the work to it so Forge can update the record with the right status and XP. If not, a new task will be created from what you describe.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(M,{columns:2,value:i.source,onChange:s=>r({source:s,taskId:""}),options:[{value:"new",label:"New task",description:"The work is not tracked yet — Forge will create a task and log the time against it."},{value:"existing",label:"Existing task",description:"Pick a task already in the board. The log will update its record and award XP."}]}),i.source==="existing"&&m.length>0?e.jsx(u,{label:"Pick the task",description:"Select the task this work belongs to.",children:e.jsxs("select",{className:"rounded-[14px] bg-white/[0.06] px-3 py-3 text-white",value:i.taskId,onChange:s=>r({taskId:s.target.value}),children:[e.jsx("option",{value:"",children:"— choose a task —"}),m.map(s=>e.jsxs("option",{value:s.id,children:[s.title," · ",s.status.replaceAll("_"," ")]},s.id))]})}):i.source==="existing"&&m.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-3 text-sm text-white/58",children:'No tasks are loaded yet. Switch to "New task" to create one from scratch.'}):null]})},{id:"details",eyebrow:"Work details",title:"Describe what was done",description:"Give the work a clear title and enough context to understand it later. These become the task record if you are creating a new one.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsx(u,{label:"Title",labelHelp:"Write the title like a short achievement: what was completed, not what was started.",children:e.jsx(C,{value:i.title,placeholder:"Write postmortem draft",onChange:s=>r({title:s.target.value})})}),e.jsx(u,{label:"Owner",description:"Who did this work? Defaults to the operator name.",children:e.jsx(C,{value:i.owner,placeholder:"Your name",onChange:s=>r({owner:s.target.value})})}),e.jsx(u,{label:"Description",description:"What moved forward? What should remain visible in the project history?",children:e.jsx(ze,{className:"min-h-28",value:i.description,placeholder:"Wrote the full incident timeline and drafted the three key learnings for the team retrospective.",onChange:s=>r({description:s.target.value})})})]})},{id:"placement",eyebrow:"Placement",title:"Set the context and XP value",description:"Assign the work to a project and choose its final status. The XP value controls how much this work contributes to the operator's progress curve.",render:(i,r)=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[e.jsx(u,{label:"Project",description:"Link this work to an active project if it belongs to one.",children:e.jsxs("select",{className:"rounded-[14px] bg-white/[0.06] px-3 py-3 text-white",value:i.projectId,onChange:s=>r({projectId:s.target.value}),children:[e.jsx("option",{value:"",children:"No project link"}),w.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))]})}),e.jsx(u,{label:"Final status",labelHelp:"'Done' is the most common choice. Use 'In progress' if the work was real but the task is still open.",children:e.jsx(M,{columns:2,value:i.status,onChange:s=>r({status:s}),options:[{value:"done",label:"Done",description:"Work is complete."},{value:"in_progress",label:"In progress",description:"Still active but already worth logging."},{value:"focus",label:"Focus",description:"Moved into focus."},{value:"blocked",label:"Blocked",description:"Work hit a wall."}]})})]}),e.jsx(u,{label:"XP value",labelHelp:"Typical task XP ranges from 20 to 100. Use 40 for routine tasks, 80+ for complex deliverables.",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(C,{type:"number",min:5,max:500,className:"w-36",value:i.points,onChange:s=>r({points:Number(s.target.value)})}),e.jsx("div",{className:"flex gap-2",children:[20,40,80,120].map(s=>e.jsxs("button",{type:"button",className:`rounded-full px-3 py-1.5 text-xs transition ${i.points===s?"bg-white/18 text-white":"bg-white/[0.06] text-white/55 hover:bg-white/[0.10]"}`,onClick:()=>r({points:s}),children:[s," xp"]},s))})]})})]})}];return e.jsx(Se,{open:a,onOpenChange:n,eyebrow:"Log work",title:"Log retroactive work",description:"Capture work that happened outside the timer so it counts toward progress and XP.",value:h,onChange:j,draftPersistenceKey:"settings.log-work",steps:A,submitLabel:"Log work",pending:l,pendingLabel:"Logging work…",error:_,onSubmit:async()=>{if(b(null),h.source==="new"&&h.title.trim().length===0){b("Add a title so Forge knows what work to create.");return}if(h.source==="existing"&&!h.taskId){b("Pick an existing task or switch to New task.");return}try{await f({taskId:h.source==="existing"&&h.taskId?h.taskId:void 0,title:h.source==="new"&&h.title.trim()?h.title.trim():void 0,description:h.description.trim()||void 0,owner:h.owner.trim()||void 0,projectId:h.projectId||null,status:h.status,points:h.points}),n(!1)}catch(i){b(i instanceof Error?i.message:"Could not log the work right now.")}}})}function Te({text:a}){const[n,l]=v.useState(!1),x=async()=>{try{await navigator.clipboard.writeText(a),l(!0),setTimeout(()=>l(!1),2200)}catch{}};return e.jsxs("button",{type:"button",onClick:()=>void x(),className:"flex items-center gap-1.5 rounded-full bg-white/[0.07] px-3 py-1.5 text-xs font-medium text-white/65 transition hover:bg-white/[0.12] hover:text-white",children:[n?e.jsx(Ce,{className:"size-3 text-emerald-400"}):e.jsx(Oe,{className:"size-3"}),n?"Copied":"Copy"]})}function te({label:a,children:n,copyText:l}){return e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:a}),e.jsx(Te,{text:l??n})]}),e.jsx("pre",{className:"mt-3 overflow-x-auto rounded-[14px] bg-[rgba(8,13,28,0.78)] p-3 text-xs leading-6 text-white/78",children:e.jsx("code",{children:n})})]})}function ft({open:a,onOpenChange:n,state:l}){if(!l)return null;const{tokenString:x,agentLabel:m,onboarding:w}=l,f=JSON.stringify({baseUrl:w.forgeBaseUrl,apiToken:x,actorLabel:m,timeoutMs:w.defaultTimeoutMs},null,2),h=[`curl -s ${w.healthUrl} \\`,` -H "Authorization: Bearer ${x}" \\`,' -H "X-Forge-Source: agent" \\',` -H "X-Forge-Actor: ${m}"`].join(`
2
2
  `),j=["openclaw gateway restart",'openclaw agent --message "forge_get_operator_overview"'].join(`
3
- `);return e.jsx(dt,{open:a,onOpenChange:n,children:e.jsxs(ct,{children:[e.jsx(ht,{className:"fixed inset-0 z-40 bg-[rgba(4,8,18,0.82)] backdrop-blur-xl"}),e.jsxs(pt,{className:"fixed left-1/2 top-1/2 z-50 flex h-[min(52rem,calc(100vh-1rem))] w-[min(52rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-[34px] border border-[rgba(192,193,255,0.14)] bg-[linear-gradient(180deg,rgba(21,28,44,0.99),rgba(12,17,30,0.99))] shadow-[0_30px_90px_rgba(3,8,18,0.55)]",children:[e.jsx(xt,{className:"sr-only",children:"Token issued — setup instructions"}),e.jsx(mt,{className:"sr-only",children:"Your new agent token has been issued. Copy it now and follow the setup guide."}),e.jsxs("div",{className:"flex shrink-0 items-start justify-between gap-4 border-b border-white/8 px-6 py-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-full bg-[rgba(192,193,255,0.12)]",children:e.jsx(_e,{className:"size-5 text-[rgba(192,193,255,0.85)]"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Token issued"}),e.jsx("div",{className:"mt-0.5 font-display text-xl text-white",children:"Save your token now"})]})]}),e.jsx(ut,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Close",className:"rounded-full bg-white/6 p-2 text-white/55 transition hover:bg-white/10 hover:text-white",children:e.jsx(qe,{className:"size-4"})})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-5",children:e.jsxs(gt.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:"grid gap-5",children:[e.jsxs("div",{className:"rounded-[20px] border border-amber-400/18 bg-amber-400/[0.07] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(g,{className:"text-amber-300",children:"One-time reveal"}),e.jsx("span",{className:"text-sm text-white/60",children:"This value will not be shown again."})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3 rounded-[14px] bg-[rgba(8,13,28,0.78)] px-4 py-3",children:[e.jsx("code",{className:"min-w-0 flex-1 break-all text-xs text-white/90",children:m}),e.jsx(Te,{text:m})]}),e.jsx("div",{className:"mt-2 text-xs text-white/45",children:"Forge stores only a hash — the raw token is unrecoverable after you close this dialog. If lost, rotate the token from the Agents settings page."})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"flex size-5 items-center justify-center rounded-full bg-white/12 text-xs font-semibold text-white",children:"1"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Add the token to your OpenClaw plugin config"})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4 text-sm leading-6 text-white/62",children:["Open your ",e.jsx("code",{className:"rounded-md bg-white/[0.08] px-1.5 py-0.5 text-xs text-white/82",children:"openclaw.json"})," file and find the"," ",e.jsx("code",{className:"rounded-md bg-white/[0.08] px-1.5 py-0.5 text-xs text-white/82",children:"forge"})," plugin entry under"," ",e.jsx("code",{className:"rounded-md bg-white/[0.08] px-1.5 py-0.5 text-xs text-white/82",children:"plugins"}),". Add or replace its"," ",e.jsx("code",{className:"rounded-md bg-white/[0.08] px-1.5 py-0.5 text-xs text-white/82",children:"params"})," with the config block below."]}),e.jsx("div",{className:"mt-3",children:e.jsx(te,{label:"Plugin params — paste into openclaw.json → plugins → forge → params",copyText:f,children:f})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"flex size-5 items-center justify-center rounded-full bg-white/12 text-xs font-semibold text-white",children:"2"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Restart the gateway and confirm the agent can connect"})]}),e.jsx(te,{label:"Run in terminal",copyText:j,children:j})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"flex size-5 items-center justify-center rounded-full bg-white/12 text-xs font-semibold text-white",children:"3"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Verify the token is accepted by the API"})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4 text-sm leading-6 text-white/62",children:["Run the curl below. A"," ",e.jsx("code",{className:"rounded-md bg-white/[0.08] px-1.5 py-0.5 text-xs text-emerald-300",children:"200 OK"})," response means the token works and the agent"," ",e.jsx("strong",{className:"text-white/80",children:p})," is authenticated."]}),e.jsx("div",{className:"mt-3",children:e.jsx(te,{label:"Verify token — run in terminal",copyText:h,children:h})})]}),e.jsxs("div",{className:"rounded-[18px] border border-white/6 bg-white/[0.03] px-4 py-3 text-sm leading-6 text-white/50",children:[e.jsx("strong",{className:"text-white/68",children:"Tip:"})," If you ever lose this token, go to ",e.jsx("strong",{className:"text-white/68",children:"Settings → Agents → Agent tokens"}),", find the entry, and click"," ",e.jsx("strong",{className:"text-white/68",children:"Rotate & reveal"})," to get a fresh value without creating a new agent identity."]})]})}),e.jsx("div",{className:"shrink-0 border-t border-white/8 px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm text-white/45",children:"Token saved? Close this dialog when you are ready."}),e.jsxs(P,{onClick:()=>n(!1),children:[e.jsx(Ce,{className:"size-4"}),"Done"]})]})})]})]})})}function Q(a,n){return n.every(l=>a.scopes.includes(l))}function $(a){if(!a)return"Never";try{return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(a))}catch{return a}}function ke(a){return a==="connected"?"text-emerald-300":a==="stale"||a==="reconnecting"?"text-amber-300":a==="error"?"text-rose-300":"text-white/45"}function Nt(a){return a.some(n=>n.status==="connected")?"connected":a.some(n=>n.status==="reconnecting")?"reconnecting":a.some(n=>n.status==="error")?"error":a.some(n=>n.status==="stale")?"stale":"disconnected"}function kt(a){const n=new Map;for(const l of a){const m=l.agentId??`${l.provider}:${l.agentLabel}`,p=n.get(m);if(!p){n.set(m,{key:m,agentId:l.agentId,agentLabel:l.agentLabel,provider:l.provider,status:l.status,primary:l,sessions:[l],actionCount:l.actionCount,eventCount:l.eventCount});continue}p.sessions.push(l),p.actionCount+=l.actionCount,p.eventCount+=l.eventCount,p.sessions.sort((b,f)=>Date.parse(f.lastHeartbeatAt)-Date.parse(b.lastHeartbeatAt)),p.primary=p.sessions[0]??p.primary,p.status=Nt(p.sessions)}return Array.from(n.values()).sort((l,m)=>Date.parse(m.primary.lastHeartbeatAt)-Date.parse(l.primary.lastHeartbeatAt))}function Pe(a){return a.replaceAll("_"," ")}function Pt(a){const n=[];return a.scopePolicy.userIds.length>0?n.push(`${a.scopePolicy.userIds.length} user${a.scopePolicy.userIds.length===1?"":"s"}`):n.push("all visible users"),a.scopePolicy.projectIds.length>0&&n.push(`${a.scopePolicy.projectIds.length} project${a.scopePolicy.projectIds.length===1?"":"s"}`),a.scopePolicy.tagIds.length>0&&n.push(`${a.scopePolicy.tagIds.length} tag${a.scopePolicy.tagIds.length===1?"":"s"}`),n.join(" · ")}function Ot(){var ue,ge,ve,be,we,je;const a=Ke(),[n,l]=v.useState(!1),[m,p]=v.useState("operator"),[b,f]=v.useState(null),[h,j]=v.useState(!1),[_,w]=v.useState(!1),[A,i]=v.useState(!1),[r,s]=v.useState(null),y=F({queryKey:["forge-operator-session"],queryFn:st}),S=y.isSuccess,q=F({queryKey:["forge-settings"],queryFn:at,enabled:S}),Le=F({queryKey:["forge-approval-requests"],queryFn:it,enabled:S}),ae=F({queryKey:["forge-agent-onboarding"],queryFn:nt}),Y=F({queryKey:["forge-agent-runtime-sessions"],queryFn:rt,enabled:S}),J=F({queryKey:["forge-agent-runtime-session-history",r],queryFn:()=>ot(r),enabled:S&&!!r}),Ie=F({queryKey:["forge-operator-context"],queryFn:lt,enabled:S}),T=async()=>{await Promise.all([a.invalidateQueries({queryKey:["forge-operator-session"]}),a.invalidateQueries({queryKey:["forge-settings"]}),a.invalidateQueries({queryKey:["forge-approval-requests"]}),a.invalidateQueries({queryKey:["forge-agent-onboarding"]}),a.invalidateQueries({queryKey:["forge-agent-runtime-sessions"]}),a.invalidateQueries({queryKey:["forge-agent-runtime-session-history"]}),a.invalidateQueries({queryKey:["forge-operator-context"]})])},ie=I({mutationFn:t=>We(t),onSuccess:T}),ne=I({mutationFn:t=>Qe(t),onSuccess:async t=>{if(await T(),o){const d=t.token;f({tokenString:d.token,agentLabel:d.tokenSummary.agentLabel??"forge-agent",onboarding:o}),j(!0)}}}),re=I({mutationFn:t=>Xe(t),onSuccess:T}),oe=I({mutationFn:t=>Ge(t),onSuccess:T}),le=I({mutationFn:t=>Ye(t),onSuccess:T}),de=I({mutationFn:({sessionId:t,note:d})=>Je(t,d),onSuccess:T}),ce=I({mutationFn:({sessionId:t,note:d,lastError:c})=>Ze(t,{note:d,lastError:c}),onSuccess:T}),O=I({mutationFn:Ve,onSuccess:T}),N=(ue=q.data)==null?void 0:ue.settings,D=((ge=Le.data)==null?void 0:ge.approvalRequests)??[],o=(ve=ae.data)==null?void 0:ve.onboarding,he=v.useMemo(()=>{var t;return((t=Y.data)==null?void 0:t.sessions)??[]},[(be=Y.data)==null?void 0:be.sessions]),E=v.useMemo(()=>kt(he),[he]),R=J.data,x=(we=Ie.data)==null?void 0:we.context,L=(N==null?void 0:N.agentTokens.filter(t=>t.status==="active"))??[],pe=(o==null?void 0:o.recommendedScopes)??[],B=L.some(t=>Q(t,pe)),H=L.some(t=>Q(t,["rewards.manage"])),U=L.some(t=>Q(t,["psyche.write"])),K=L.some(t=>t.autonomyMode!=="approval_required"&&Q(t,["write"])),z=L.length>0,xe=E.filter(t=>t.status==="connected"),me=E.filter(t=>t.status==="stale"),Re=v.useMemo(()=>{if(!x)return[];const t=[...x.focusTasks,...x.currentBoard.backlog,...x.currentBoard.focus,...x.currentBoard.inProgress,...x.currentBoard.blocked,...x.currentBoard.done],d=new Map;for(const c of t)d.set(c.id,c);return[...d.values()]},[x]),Fe=(N==null?void 0:N.profile.operatorName)??"",Me=[{label:"Operator session",ok:!0,badge:"active",badgeTone:"emerald",detail:(je=y.data)!=null&&je.session?`Session open as ${y.data.session.actorLabel}. Works for localhost and Tailscale without a token.`:"Passwordless session is active for local and Tailscale access.",action:null},{label:"Agent token",ok:z,badge:z?`${L.length} active`:"none issued",badgeTone:z?"emerald":"amber",detail:z?`${L.length} active token${L.length===1?"":"s"} allow external agents and scripts to authenticate.`:"No token yet. Issue one to let external agents connect via the API.",action:z?null:{label:"Issue token",preset:"operator",onClick:()=>{p("operator"),l(!0)}}},{label:"Full operator bundle",ok:B,badge:B?"ready":"optional",badgeTone:B?"emerald":"neutral",detail:B?"A token covers all recommended scopes for full operator collaboration.":"No token covers the full recommended scope bundle. Issue one to unlock complete agent collaboration.",action:B?null:{label:"Set up",preset:"operator",onClick:()=>{p("operator"),l(!0)}}},{label:"Reward control",ok:H,badge:H?"ready":"optional",badgeTone:H?"emerald":"neutral",detail:H?"An agent can tune reward rules and issue bonus XP grants.":"No token has rewards.manage — agents cannot adjust XP rules or issue bonuses.",action:H?null:{label:"Add scope",preset:"operator",onClick:()=>{p("operator"),l(!0)}}},{label:"Psyche writes",ok:U,badge:U?"ready":"optional",badgeTone:U?"emerald":"neutral",detail:U?"Sensitive Psyche collaboration is enabled — agents can create and update therapeutic records.":"No token has psyche.write — agent collaboration on sensitive Psyche records is disabled.",action:U?null:{label:"Add scope",preset:"operator",onClick:()=>{p("operator"),l(!0)}}},{label:"Scoped writes",ok:K,badge:K?"ready":"optional",badgeTone:K?"emerald":"neutral",detail:K?"A trusted agent can write without constant approval prompts.":"All write tokens are approval-required. Agents must queue every mutation for your review.",action:K?null:{label:"Configure",preset:"operator",onClick:()=>{p("operator"),l(!0)}}}];return y.isLoading||q.isLoading?e.jsx(et,{eyebrow:"Settings · Agents",title:"Loading agent console",description:"Establishing the operator session and loading agent configuration.",columns:2,blocks:6}):y.isError?e.jsx(ye,{eyebrow:"Settings · Agents",error:y.error,onRetry:()=>void y.refetch()}):q.isError||!N?e.jsx(ye,{eyebrow:"Settings · Agents",error:q.error??new Error("Could not load settings."),onRetry:()=>void q.refetch()}):e.jsxs("div",{className:"mx-auto grid w-full max-w-[1220px] gap-5",children:[e.jsx(bt,{title:"Agents",description:"Connection status, capability access, tokens, approval queue, and work logging."}),e.jsx(vt,{}),e.jsx(jt,{open:n,onOpenChange:l,pending:ie.isPending,initialPreset:m,defaultAgentLabel:(o==null?void 0:o.defaultActorLabel)??"OpenClaw",recommendedScopes:pe,onSubmit:async t=>{const d=await ie.mutateAsync(t);l(!1),o&&(f({tokenString:d.token.token,agentLabel:t.agentLabel,onboarding:o}),j(!0))}}),e.jsx(ft,{open:h,onOpenChange:j,state:b}),e.jsx(yt,{open:_,onOpenChange:w,pending:O.isPending,defaultOwner:Fe,availableTasks:Re,availableProjects:(x==null?void 0:x.activeProjects)??[],onSubmit:async t=>{await O.mutateAsync(t)}}),e.jsxs("div",{className:"grid gap-5",children:[x?e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[e.jsx(W,{label:"Active sessions",value:xe.length,tone:"core"}),e.jsx(W,{label:"Stale sessions",value:me.length,tone:"core"}),e.jsx(W,{label:"Pending approvals",value:D.filter(t=>t.status==="pending").length,tone:"core"}),e.jsx(W,{label:"Operator level",value:x.xp.profile.level,tone:"core",detail:`${x.xp.profile.totalXp} total XP`})]}):null,e.jsxs(k,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Capability status"}),e.jsx("div",{className:"mt-4 grid gap-3",children:Me.map(t=>e.jsxs("div",{className:"flex items-start justify-between gap-4 rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"font-medium text-white",children:t.label}),e.jsx(g,{className:t.badgeTone==="emerald"?"text-emerald-300":t.badgeTone==="amber"?"text-amber-300":"text-white/45",children:t.badge})]}),e.jsx("div",{className:"mt-1 text-sm leading-6 text-white/55",children:t.detail})]}),t.action?e.jsxs("button",{type:"button",onClick:t.action.onClick,className:"mt-0.5 flex shrink-0 items-center gap-1.5 rounded-full bg-white/[0.07] px-3 py-1.5 text-xs font-medium text-white/72 transition hover:bg-white/[0.12] hover:text-white",children:[t.action.label,e.jsx(De,{className:"size-3"})]}):null]},t.label))})]}),e.jsxs(k,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Runtime sessions"}),e.jsx("div",{className:"mt-1 text-sm text-white/55",children:"Live OpenClaw, Hermes, and Codex sessions registered against this Forge runtime, with stale detection and reconnect guidance."})]}),E.length>0?e.jsxs(g,{className:"text-white/60",children:[xe.length," live · ",me.length," stale"]}):null]}),e.jsx("div",{className:"mt-4 grid gap-3",children:Y.isLoading?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/55",children:"Loading agent runtime sessions…"}):E.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/55",children:"No runtime sessions have registered yet. OpenClaw, Hermes, and Codex now self-register here when their Forge adapter starts."}):E.map(t=>{const d=t.primary;return e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"font-medium text-white",children:t.agentLabel}),e.jsx(g,{className:ke(t.status),children:t.status})]}),e.jsxs("div",{className:"mt-1 text-sm text-white/52",children:[t.provider," · ",d.connectionMode.replaceAll("_"," ")," · last heartbeat"," ",$(d.lastHeartbeatAt)]}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-white/42",children:[e.jsxs("span",{children:[t.sessions.length," runtime session",t.sessions.length===1?"":"s"]}),e.jsxs("span",{children:["Current key ",d.sessionKey]}),e.jsxs("span",{children:[t.actionCount," recorded actions"]}),e.jsxs("span",{children:[t.eventCount," session events"]})]}),d.lastError?e.jsx("div",{className:"mt-3 text-sm text-rose-200/82",children:d.lastError}):null]}),e.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2",children:[t.status!=="connected"?e.jsx(P,{variant:"secondary",size:"sm",pending:de.isPending,pendingLabel:"Requesting",onClick:()=>void de.mutateAsync({sessionId:d.id}),children:"Reconnect"}):null,e.jsx(P,{variant:"secondary",size:"sm",onClick:()=>s(c=>c===d.id?null:d.id),children:r===d.id?"Hide history":"View history"}),t.status!=="disconnected"?e.jsx(P,{variant:"ghost",size:"sm",pending:ce.isPending,pendingLabel:"Closing",onClick:()=>void ce.mutateAsync({sessionId:d.id,note:"Marked disconnected from the Forge agents console."}),children:"Mark offline"}):null]})]}),d.recentEvents.length>0?e.jsx("div",{className:"mt-4 grid gap-2",children:d.recentEvents.slice(0,3).map(c=>e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[16px] bg-[rgba(255,255,255,0.03)] px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-white",children:c.title}),e.jsx("div",{className:"mt-0.5 text-xs leading-5 text-white/48",children:c.summary||c.eventType})]}),e.jsx("div",{className:"shrink-0 text-xs text-white/35",children:$(c.createdAt)})]},c.id))}):null,e.jsxs("div",{className:"mt-4 rounded-[16px] bg-[rgba(8,13,28,0.52)] p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:"Reconnect plan"}),e.jsx("div",{className:"mt-2 text-sm text-white/62",children:d.reconnectPlan.summary}),e.jsx("pre",{className:"mt-3 overflow-x-auto text-xs leading-6 text-white/70",children:e.jsx("code",{children:d.reconnectPlan.commands.join(`
4
- `)})})]}),t.sessions.length>1?e.jsxs("div",{className:"mt-4 rounded-[16px] bg-[rgba(8,13,28,0.38)] p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:"Session history under this agent"}),e.jsx("div",{className:"mt-2 grid gap-2",children:t.sessions.slice(0,6).map(c=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-[12px] bg-white/[0.035] px-3 py-2 text-xs text-white/50",children:[e.jsx("span",{className:"min-w-0 truncate",children:c.sessionKey}),e.jsxs("span",{className:ke(c.status),children:[c.status," · ",$(c.lastHeartbeatAt)]})]},c.id))})]}):null,r===d.id?e.jsxs("div",{className:"mt-4 rounded-[16px] bg-[rgba(8,13,28,0.52)] p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:"Work history"}),J.isLoading?e.jsx("div",{className:"mt-3 text-sm text-white/55",children:"Loading session history…"}):J.isError?e.jsx("div",{className:"mt-3 text-sm text-rose-200/82",children:"Could not load session history."}):(R==null?void 0:R.session.id)===d.id?e.jsxs("div",{className:"mt-3 grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:"Agent actions"}),e.jsx("div",{className:"mt-2 grid gap-2",children:R.actions.length>0?R.actions.map(c=>e.jsxs("div",{className:"rounded-[14px] bg-white/[0.04] px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"text-sm text-white",children:c.title}),e.jsx(g,{className:"text-white/55",children:c.status})]}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-white/48",children:c.summary||c.actionType}),e.jsx("div",{className:"mt-1 text-xs text-white/35",children:$(c.createdAt)})]},c.id)):e.jsx("div",{className:"rounded-[14px] bg-white/[0.04] px-3 py-2.5 text-sm text-white/50",children:"No recorded agent actions for this session yet."})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:"Session events"}),e.jsx("div",{className:"mt-2 grid gap-2",children:R.events.length>0?R.events.map(c=>e.jsxs("div",{className:"rounded-[14px] bg-white/[0.04] px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"text-sm text-white",children:c.title}),e.jsx(g,{className:"text-white/55",children:c.level})]}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-white/48",children:c.summary||c.eventType}),e.jsx("div",{className:"mt-1 text-xs text-white/35",children:$(c.createdAt)})]},c.id)):e.jsx("div",{className:"rounded-[14px] bg-white/[0.04] px-3 py-2.5 text-sm text-white/50",children:"No session events recorded yet."})})]})]}):null]}):null]},t.key)})})]}),e.jsxs(k,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Agent tokens"}),e.jsxs(P,{size:"sm",variant:"secondary",onClick:()=>{p("operator"),l(!0)},children:[e.jsx(Ee,{className:"size-3.5"}),"Issue token"]})]}),e.jsx("div",{className:"mt-4 grid gap-3",children:N.agentTokens.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/55",children:"No tokens yet. Issue one to let external agents or scripts authenticate with Forge."}):N.agentTokens.map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-white",children:t.label}),e.jsxs("div",{className:"mt-0.5 text-sm text-white/50",children:[t.agentLabel??"Unassigned agent"," ·"," ",e.jsx("span",{className:"font-mono text-xs",children:t.tokenPrefix})]})]}),e.jsx(g,{className:t.status==="active"?"text-emerald-300":"text-white/45",children:t.status})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-xs text-white/55",children:[e.jsx("span",{children:t.trustLevel}),e.jsx("span",{children:"·"}),e.jsx("span",{children:t.autonomyMode.replaceAll("_"," ")}),e.jsx("span",{children:"·"}),e.jsx("span",{children:t.approvalMode.replaceAll("_"," ")})]}),e.jsxs("div",{className:"mt-2 text-xs text-white/45",children:["Bootstrap: ",Pe(t.bootstrapPolicy.mode)," · ",t.bootstrapPolicy.projectsLimit," projects"," · ",t.bootstrapPolicy.tasksLimit," tasks",t.bootstrapPolicy.includePeoplePages?` · ${t.bootstrapPolicy.peoplePageLimit} people pages`:" · no people pages"]}),e.jsxs("div",{className:"mt-1 text-xs text-white/45",children:["Default read scope: ",Pt(t)]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:["write","rewards.manage","psyche.write"].map(d=>e.jsx(g,{className:t.scopes.includes(d)?"text-emerald-300":"text-white/30",children:d},d))}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(P,{variant:"secondary",size:"sm",pending:ne.isPending,pendingLabel:"Rotating",onClick:()=>void ne.mutateAsync(t.id),children:"Rotate & reveal new token"}),e.jsx(P,{variant:"ghost",size:"sm",pending:re.isPending,pendingLabel:"Revoking",onClick:()=>void re.mutateAsync(t.id),children:"Revoke"})]})]},t.id))}),e.jsx("div",{className:"mt-3 px-1 text-xs text-white/35",children:"Raw token values are shown once and are never recoverable. If a token is lost, rotate or issue a new one."})]}),N.agents.length>0?e.jsxs(k,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Connected agents"}),e.jsx("div",{className:"mt-4 grid gap-3",children:N.agents.map(t=>e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-white",children:t.label}),t.description?e.jsx("div",{className:"mt-1 text-sm text-white/52",children:t.description}):null,t.linkedUsers.length>0?e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:t.linkedUsers.map(d=>{var c;return e.jsx(g,{className:"text-white/55",children:((c=d.user)==null?void 0:c.displayName)??d.userId},d.userId)})}):null,e.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-sm text-white/55",children:[e.jsx("span",{children:t.agentType}),t.identityKey?e.jsx("span",{className:"font-mono text-xs",children:t.identityKey}):null,e.jsx("span",{children:t.autonomyMode.replaceAll("_"," ")}),e.jsxs("span",{children:[t.activeTokenCount," active token",t.activeTokenCount!==1?"s":""]})]})]}),e.jsx(g,{className:"text-white/60",children:t.trustLevel})]},t.id))})]}):null,x?e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1.05fr)_minmax(0,0.95fr)]",children:[e.jsxs(k,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Recommended next move"}),x.recommendedNextTask?e.jsxs("div",{className:"mt-4 grid gap-2",children:[e.jsx(Z,{kind:"task",label:x.recommendedNextTask.title,variant:"heading",size:"lg"}),e.jsx("div",{className:"text-sm leading-6 text-white/58",children:x.recommendedNextTask.description||"No extra notes yet."}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-2",children:[e.jsx(g,{children:x.recommendedNextTask.status.replaceAll("_"," ")}),e.jsxs(g,{children:[x.recommendedNextTask.points," xp"]}),e.jsx(g,{children:x.recommendedNextTask.owner})]})]}):e.jsx("div",{className:"mt-4 text-sm text-white/55",children:"Board is clear. No recommended task right now."})]}),e.jsxs(k,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Board pulse"}),e.jsx("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[{label:"Backlog",value:x.currentBoard.backlog.length},{label:"Focus",value:x.currentBoard.focus.length},{label:"In progress",value:x.currentBoard.inProgress.length},{label:"Blocked",value:x.currentBoard.blocked.length}].map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:t.label}),e.jsx("div",{className:"mt-2 font-display text-3xl text-white",children:t.value})]},t.label))})]})]}):null,x&&x.activeProjects.length>0?e.jsxs(k,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Active projects"}),e.jsx("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:x.activeProjects.slice(0,6).map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx(Z,{kind:"project",label:t.title}),e.jsxs(g,{children:[t.progress,"%"]})]}),e.jsx("div",{className:"mt-2",children:e.jsx(tt,{kind:"goal",label:t.goalTitle,compact:!0,gradient:!1})}),e.jsxs("div",{className:"mt-2 text-xs text-white/38",children:[t.activeTaskCount," active ·"," ",t.completedTaskCount," done"]})]},t.id))})]}):null,e.jsxs(k,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Approval queue"}),D.filter(t=>t.status==="pending").length>0?e.jsxs(g,{className:"text-amber-300",children:[D.filter(t=>t.status==="pending").length," pending"]}):null]}),e.jsx("div",{className:"mt-4 grid gap-3",children:D.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/55",children:"No pending approvals. Agent actions are flowing through."}):D.map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-white",children:t.title}),e.jsx("div",{className:"mt-0.5 text-sm text-white/55",children:t.summary||t.actionType})]}),e.jsx(g,{className:t.status==="pending"?"text-amber-300":"text-white/45",children:t.status})]}),t.status==="pending"?e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(P,{variant:"secondary",size:"sm",pending:oe.isPending,pendingLabel:"Approving",onClick:()=>void oe.mutateAsync(t.id),children:"Approve"}),e.jsx(P,{variant:"ghost",size:"sm",pending:le.isPending,pendingLabel:"Rejecting",onClick:()=>void le.mutateAsync(t.id),children:"Reject"})]}):null]},t.id))})]}),e.jsxs(k,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Retroactive work log"}),e.jsx("div",{className:"mt-1 text-sm text-white/55",children:"Capture work done outside the timer so it counts toward progress and XP."})]}),e.jsxs(P,{variant:"secondary",size:"sm",onClick:()=>w(!0),children:[e.jsx(Be,{className:"size-3.5"}),"Log work"]})]}),O.data?e.jsxs("div",{className:"mt-4 rounded-[18px] bg-[rgba(192,193,255,0.10)] px-4 py-3 text-sm text-white",children:["Logged"," ",e.jsx("span",{className:"inline-block align-middle",children:e.jsx(Z,{kind:"task",label:O.data.task.title,showKind:!1})}),". Operator XP updated to ",O.data.xp.profile.totalXp,"."]}):null]}),e.jsxs(k,{children:[e.jsxs("button",{type:"button",className:"flex w-full items-center justify-between gap-4 text-left",onClick:()=>i(t=>!t),children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Connection & onboarding"}),o?e.jsx("div",{className:"mt-1 text-sm text-white/55",children:o.forgeBaseUrl}):null]}),A?e.jsx(He,{className:"size-4 shrink-0 text-white/38"}):e.jsx(Ue,{className:"size-4 shrink-0 text-white/38"})]}),A&&o?e.jsxs("div",{className:"mt-5 grid gap-4",children:[e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Forge API"}),e.jsx("div",{className:"mt-2 break-all text-sm text-white",children:o.forgeBaseUrl})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Web app"}),e.jsx("div",{className:"mt-2 break-all text-sm text-white",children:o.webAppUrl})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"OpenAPI spec"}),e.jsx("div",{className:"mt-2 break-all text-sm text-white",children:o.openApiUrl})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Default policy"}),e.jsxs("div",{className:"mt-2 text-sm text-white",children:[o.recommendedTrustLevel," ·"," ",o.recommendedAutonomyMode.replaceAll("_"," ")," ·"," ",o.recommendedApprovalMode.replaceAll("_"," ")]}),e.jsxs("div",{className:"mt-2 text-xs text-white/45",children:["Bootstrap default:"," ",Pe(o.defaultBootstrapPolicy.mode)," · ",o.defaultBootstrapPolicy.projectsLimit," projects"," · ",o.defaultBootstrapPolicy.tasksLimit," tasks"]})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"font-medium text-white",children:o.authModes.operatorSession.label}),e.jsx(g,{className:"mt-1 text-emerald-300",children:o.defaultConnectionMode==="operator_session"?"default":"available"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:o.authModes.operatorSession.summary}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:o.authModes.operatorSession.trustedTargets.map(t=>e.jsx(g,{className:"text-white/65",children:t},t))})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"font-medium text-white",children:o.authModes.managedToken.label}),e.jsx(g,{className:"mt-1 text-white/55",children:"optional"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:o.authModes.managedToken.summary}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/48",children:o.tokenRecovery.rotationSummary})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Shared runtime"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:"Keep Forge, OpenClaw, Hermes, and the browser on the same runtime when they should see one shared user directory, one strategy graph, and one task history."}),e.jsxs("div",{className:"mt-3 text-xs leading-5 text-white/46",children:["Base URL: ",o.forgeBaseUrl]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Agent identity"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:"Create each agent as a bot user, then write with that user's `userId`. The relationship graph in Settings -> Users controls what each direction can see, message, share, plan, and affect."}),e.jsx("div",{className:"mt-3 text-xs leading-5 text-white/46",children:"Cross-owner links stay valid even when ownership differs."})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Contract timing"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:"Leave strategies editable while humans and bots refine the graph. Lock them only when the plan becomes the contract the alignment metrics should judge."}),e.jsx("div",{className:"mt-3 text-xs leading-5 text-white/46",children:"Coverage, sequencing, scope discipline, and quality all contribute to alignment now."})]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Fast onboarding checklist"}),e.jsxs("div",{className:"mt-3 grid gap-2 text-sm leading-6 text-white/60",children:[e.jsx("div",{children:"1. Create the human and bot users in Settings -> Users."}),e.jsx("div",{children:"2. Keep the default graph permissive until collaboration is flowing cleanly."}),e.jsx("div",{children:"3. Point OpenClaw and Hermes at the same Forge runtime and storage root when they should collaborate."}),e.jsx("div",{children:"4. Give each adapter a distinct actor label so activity stays readable."}),e.jsx("div",{children:"5. Build strategies as drafts first, then lock when the plan is ready to become the contract."})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Rights language"}),e.jsxs("div",{className:"mt-3 grid gap-2 text-sm leading-6 text-white/60",children:[e.jsx("div",{children:"`See` means discover, search, and read another owner."}),e.jsx("div",{children:"`Message` means coordinate and hand off through Forge."}),e.jsx("div",{children:"`Plan` means draft or edit that owner's strategies."}),e.jsx("div",{children:"`Affect` means create or mutate that owner's work."})]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Strategy lifecycle"}),e.jsxs("div",{className:"mt-3 grid gap-2 text-sm leading-6 text-white/60",children:[e.jsx("div",{children:"1. Save an incomplete draft while the plan is still being negotiated."}),e.jsx("div",{children:"2. Let humans and bots refine targets, nodes, and sequence together."}),e.jsx("div",{children:"3. Lock only when the graph becomes the contract for alignment."}),e.jsx("div",{children:"4. Unlock only when the contract itself is being renegotiated."})]})]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Quick-connect verification"}),e.jsx("pre",{className:"mt-3 overflow-x-auto rounded-[16px] bg-[rgba(8,13,28,0.78)] p-4 text-xs leading-6 text-white/72",children:e.jsx("code",{children:[`curl -s ${o.healthUrl}`,"openclaw plugins install ./projects/forge","openclaw gateway restart"].join(`
3
+ `);return e.jsx(dt,{open:a,onOpenChange:n,children:e.jsxs(ct,{children:[e.jsx(ht,{className:"fixed inset-0 z-40 bg-[rgba(4,8,18,0.82)] backdrop-blur-xl"}),e.jsxs(mt,{className:"fixed left-1/2 top-1/2 z-50 flex h-[min(52rem,calc(100vh-1rem))] w-[min(52rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-[34px] border border-[rgba(192,193,255,0.14)] bg-[linear-gradient(180deg,rgba(21,28,44,0.99),rgba(12,17,30,0.99))] shadow-[0_30px_90px_rgba(3,8,18,0.55)]",children:[e.jsx(pt,{className:"sr-only",children:"Token issued — setup instructions"}),e.jsx(xt,{className:"sr-only",children:"Your new agent token has been issued. Copy it now and follow the setup guide."}),e.jsxs("div",{className:"flex shrink-0 items-start justify-between gap-4 border-b border-white/8 px-6 py-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-full bg-[rgba(192,193,255,0.12)]",children:e.jsx(_e,{className:"size-5 text-[rgba(192,193,255,0.85)]"})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/42",children:"Token issued"}),e.jsx("div",{className:"mt-0.5 font-display text-xl text-white",children:"Save your token now"})]})]}),e.jsx(ut,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"Close",className:"rounded-full bg-white/6 p-2 text-white/55 transition hover:bg-white/10 hover:text-white",children:e.jsx(qe,{className:"size-4"})})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-6 py-5",children:e.jsxs(gt.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:"grid gap-5",children:[e.jsxs("div",{className:"rounded-[20px] border border-amber-400/18 bg-amber-400/[0.07] p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(g,{className:"text-amber-300",children:"One-time reveal"}),e.jsx("span",{className:"text-sm text-white/60",children:"This value will not be shown again."})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-3 rounded-[14px] bg-[rgba(8,13,28,0.78)] px-4 py-3",children:[e.jsx("code",{className:"min-w-0 flex-1 break-all text-xs text-white/90",children:x}),e.jsx(Te,{text:x})]}),e.jsx("div",{className:"mt-2 text-xs text-white/45",children:"Forge stores only a hash — the raw token is unrecoverable after you close this dialog. If lost, rotate the token from the Agents settings page."})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"flex size-5 items-center justify-center rounded-full bg-white/12 text-xs font-semibold text-white",children:"1"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Add the token to your OpenClaw plugin config"})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4 text-sm leading-6 text-white/62",children:["Open your ",e.jsx("code",{className:"rounded-md bg-white/[0.08] px-1.5 py-0.5 text-xs text-white/82",children:"openclaw.json"})," file and find the"," ",e.jsx("code",{className:"rounded-md bg-white/[0.08] px-1.5 py-0.5 text-xs text-white/82",children:"forge"})," plugin entry under"," ",e.jsx("code",{className:"rounded-md bg-white/[0.08] px-1.5 py-0.5 text-xs text-white/82",children:"plugins"}),". Add or replace its"," ",e.jsx("code",{className:"rounded-md bg-white/[0.08] px-1.5 py-0.5 text-xs text-white/82",children:"params"})," with the config block below."]}),e.jsx("div",{className:"mt-3",children:e.jsx(te,{label:"Plugin params — paste into openclaw.json → plugins → forge → params",copyText:f,children:f})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"flex size-5 items-center justify-center rounded-full bg-white/12 text-xs font-semibold text-white",children:"2"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Restart the gateway and confirm the agent can connect"})]}),e.jsx(te,{label:"Run in terminal",copyText:j,children:j})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"flex size-5 items-center justify-center rounded-full bg-white/12 text-xs font-semibold text-white",children:"3"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Verify the token is accepted by the API"})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4 text-sm leading-6 text-white/62",children:["Run the curl below. A"," ",e.jsx("code",{className:"rounded-md bg-white/[0.08] px-1.5 py-0.5 text-xs text-emerald-300",children:"200 OK"})," response means the token works and the agent"," ",e.jsx("strong",{className:"text-white/80",children:m})," is authenticated."]}),e.jsx("div",{className:"mt-3",children:e.jsx(te,{label:"Verify token — run in terminal",copyText:h,children:h})})]}),e.jsxs("div",{className:"rounded-[18px] border border-white/6 bg-white/[0.03] px-4 py-3 text-sm leading-6 text-white/50",children:[e.jsx("strong",{className:"text-white/68",children:"Tip:"})," If you ever lose this token, go to ",e.jsx("strong",{className:"text-white/68",children:"Settings → Agents → Agent tokens"}),", find the entry, and click"," ",e.jsx("strong",{className:"text-white/68",children:"Rotate & reveal"})," to get a fresh value without creating a new agent identity."]})]})}),e.jsx("div",{className:"shrink-0 border-t border-white/8 px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm text-white/45",children:"Token saved? Close this dialog when you are ready."}),e.jsxs(P,{onClick:()=>n(!1),children:[e.jsx(Ce,{className:"size-4"}),"Done"]})]})})]})]})})}function Q(a,n){return n.every(l=>a.scopes.includes(l))}function z(a){if(!a)return"Never";try{return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(a))}catch{return a}}function ke(a){return a==="connected"?"text-emerald-300":a==="stale"||a==="reconnecting"?"text-amber-300":a==="error"?"text-rose-300":"text-white/45"}function Nt(a){return a.some(n=>n.status==="connected")?"connected":a.some(n=>n.status==="reconnecting")?"reconnecting":a.some(n=>n.status==="error")?"error":a.some(n=>n.status==="stale")?"stale":"disconnected"}function kt(a){const n=new Map;for(const l of a){const x=l.agentId??`${l.provider}:${l.agentLabel}`,m=n.get(x);if(!m){n.set(x,{key:x,agentId:l.agentId,agentLabel:l.agentLabel,provider:l.provider,status:l.status,primary:l,sessions:[l],actionCount:l.actionCount,eventCount:l.eventCount});continue}m.sessions.push(l),m.actionCount+=l.actionCount,m.eventCount+=l.eventCount,m.sessions.sort((w,f)=>Date.parse(f.lastHeartbeatAt)-Date.parse(w.lastHeartbeatAt)),m.primary=m.sessions[0]??m.primary,m.status=Nt(m.sessions)}return Array.from(n.values()).sort((l,x)=>Date.parse(x.primary.lastHeartbeatAt)-Date.parse(l.primary.lastHeartbeatAt))}function Pe(a){return a.replaceAll("_"," ")}function Pt(a){const n=[];return a.scopePolicy.userIds.length>0?n.push(`${a.scopePolicy.userIds.length} user${a.scopePolicy.userIds.length===1?"":"s"}`):n.push("all visible users"),a.scopePolicy.projectIds.length>0&&n.push(`${a.scopePolicy.projectIds.length} project${a.scopePolicy.projectIds.length===1?"":"s"}`),a.scopePolicy.tagIds.length>0&&n.push(`${a.scopePolicy.tagIds.length} tag${a.scopePolicy.tagIds.length===1?"":"s"}`),n.join(" · ")}function Ot(){var ue,ge,ve,we,be,je;const a=Ke(),[n,l]=v.useState(!1),[x,m]=v.useState("operator"),[w,f]=v.useState(null),[h,j]=v.useState(!1),[_,b]=v.useState(!1),[A,i]=v.useState(!1),[r,s]=v.useState(null),y=F({queryKey:["forge-operator-session"],queryFn:st}),S=y.isSuccess,q=F({queryKey:["forge-settings"],queryFn:at,enabled:S}),Le=F({queryKey:["forge-approval-requests"],queryFn:it,enabled:S}),ae=F({queryKey:["forge-agent-onboarding"],queryFn:nt}),Y=F({queryKey:["forge-agent-runtime-sessions"],queryFn:rt,enabled:S}),J=F({queryKey:["forge-agent-runtime-session-history",r],queryFn:()=>ot(r),enabled:S&&!!r}),Ie=F({queryKey:["forge-operator-context"],queryFn:lt,enabled:S}),T=async()=>{await Promise.all([a.invalidateQueries({queryKey:["forge-operator-session"]}),a.invalidateQueries({queryKey:["forge-settings"]}),a.invalidateQueries({queryKey:["forge-approval-requests"]}),a.invalidateQueries({queryKey:["forge-agent-onboarding"]}),a.invalidateQueries({queryKey:["forge-agent-runtime-sessions"]}),a.invalidateQueries({queryKey:["forge-agent-runtime-session-history"]}),a.invalidateQueries({queryKey:["forge-operator-context"]})])},ie=I({mutationFn:t=>We(t),onSuccess:T}),ne=I({mutationFn:t=>Qe(t),onSuccess:async t=>{if(await T(),o){const d=t.token;f({tokenString:d.token,agentLabel:d.tokenSummary.agentLabel??"forge-agent",onboarding:o}),j(!0)}}}),re=I({mutationFn:t=>Xe(t),onSuccess:T}),oe=I({mutationFn:t=>Ge(t),onSuccess:T}),le=I({mutationFn:t=>Ye(t),onSuccess:T}),de=I({mutationFn:({sessionId:t,note:d})=>Je(t,d),onSuccess:T}),ce=I({mutationFn:({sessionId:t,note:d,lastError:c})=>Ze(t,{note:d,lastError:c}),onSuccess:T}),O=I({mutationFn:Ve,onSuccess:T}),N=(ue=q.data)==null?void 0:ue.settings,D=((ge=Le.data)==null?void 0:ge.approvalRequests)??[],o=(ve=ae.data)==null?void 0:ve.onboarding,he=v.useMemo(()=>{var t;return((t=Y.data)==null?void 0:t.sessions)??[]},[(we=Y.data)==null?void 0:we.sessions]),E=v.useMemo(()=>kt(he),[he]),R=J.data,p=(be=Ie.data)==null?void 0:be.context,L=(N==null?void 0:N.agentTokens.filter(t=>t.status==="active"))??[],me=(o==null?void 0:o.recommendedScopes)??[],B=L.some(t=>Q(t,me)),H=L.some(t=>Q(t,["rewards.manage"])),U=L.some(t=>Q(t,["psyche.write"])),K=L.some(t=>t.autonomyMode!=="approval_required"&&Q(t,["write"])),$=L.length>0,pe=E.filter(t=>t.status==="connected"),xe=E.filter(t=>t.status==="stale"),Re=v.useMemo(()=>{if(!p)return[];const t=[...p.focusTasks,...p.currentBoard.backlog,...p.currentBoard.focus,...p.currentBoard.inProgress,...p.currentBoard.blocked,...p.currentBoard.done],d=new Map;for(const c of t)d.set(c.id,c);return[...d.values()]},[p]),Fe=(N==null?void 0:N.profile.operatorName)??"",Me=[{label:"Operator session",ok:!0,badge:"active",badgeTone:"emerald",detail:(je=y.data)!=null&&je.session?`Session open as ${y.data.session.actorLabel}. Works for localhost and Tailscale without a token.`:"Passwordless session is active for local and Tailscale access.",action:null},{label:"Agent token",ok:$,badge:$?`${L.length} active`:"none issued",badgeTone:$?"emerald":"amber",detail:$?`${L.length} active token${L.length===1?"":"s"} allow external agents and scripts to authenticate.`:"No token yet. Issue one to let external agents connect via the API.",action:$?null:{label:"Issue token",preset:"operator",onClick:()=>{m("operator"),l(!0)}}},{label:"Full operator bundle",ok:B,badge:B?"ready":"optional",badgeTone:B?"emerald":"neutral",detail:B?"A token covers all recommended scopes for full operator collaboration.":"No token covers the full recommended scope bundle. Issue one to unlock complete agent collaboration.",action:B?null:{label:"Set up",preset:"operator",onClick:()=>{m("operator"),l(!0)}}},{label:"Reward control",ok:H,badge:H?"ready":"optional",badgeTone:H?"emerald":"neutral",detail:H?"An agent can tune reward rules and issue bonus XP grants.":"No token has rewards.manage — agents cannot adjust XP rules or issue bonuses.",action:H?null:{label:"Add scope",preset:"operator",onClick:()=>{m("operator"),l(!0)}}},{label:"Psyche writes",ok:U,badge:U?"ready":"optional",badgeTone:U?"emerald":"neutral",detail:U?"Sensitive Psyche collaboration is enabled — agents can create and update therapeutic records.":"No token has psyche.write — agent collaboration on sensitive Psyche records is disabled.",action:U?null:{label:"Add scope",preset:"operator",onClick:()=>{m("operator"),l(!0)}}},{label:"Scoped writes",ok:K,badge:K?"ready":"optional",badgeTone:K?"emerald":"neutral",detail:K?"A trusted agent can write without constant approval prompts.":"All write tokens are approval-required. Agents must queue every mutation for your review.",action:K?null:{label:"Configure",preset:"operator",onClick:()=>{m("operator"),l(!0)}}}];return y.isLoading||q.isLoading?e.jsx(et,{eyebrow:"Settings · Agents",title:"Loading agent console",description:"Establishing the operator session and loading agent configuration.",columns:2,blocks:6}):y.isError?e.jsx(ye,{eyebrow:"Settings · Agents",error:y.error,onRetry:()=>void y.refetch()}):q.isError||!N?e.jsx(ye,{eyebrow:"Settings · Agents",error:q.error??new Error("Could not load settings."),onRetry:()=>void q.refetch()}):e.jsxs("div",{className:"mx-auto grid w-full max-w-[1220px] gap-5",children:[e.jsx(wt,{title:"Agents",description:"Connection status, capability access, tokens, approval queue, and work logging."}),e.jsx(vt,{}),e.jsx(jt,{open:n,onOpenChange:l,pending:ie.isPending,initialPreset:x,defaultAgentLabel:(o==null?void 0:o.defaultActorLabel)??"OpenClaw",recommendedScopes:me,onSubmit:async t=>{const d=await ie.mutateAsync(t);l(!1),o&&(f({tokenString:d.token.token,agentLabel:t.agentLabel,onboarding:o}),j(!0))}}),e.jsx(ft,{open:h,onOpenChange:j,state:w}),e.jsx(yt,{open:_,onOpenChange:b,pending:O.isPending,defaultOwner:Fe,availableTasks:Re,availableProjects:(p==null?void 0:p.activeProjects)??[],onSubmit:async t=>{await O.mutateAsync(t)}}),e.jsxs("div",{className:"grid gap-5",children:[p?e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[e.jsx(W,{label:"Active sessions",value:pe.length,tone:"core"}),e.jsx(W,{label:"Stale sessions",value:xe.length,tone:"core"}),e.jsx(W,{label:"Pending approvals",value:D.filter(t=>t.status==="pending").length,tone:"core"}),e.jsx(W,{label:"Operator level",value:p.xp.profile.level,tone:"core",detail:`${p.xp.profile.totalXp} total XP`})]}):null,e.jsxs(k,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Capability status"}),e.jsx("div",{className:"mt-4 grid gap-3",children:Me.map(t=>e.jsxs("div",{className:"flex items-start justify-between gap-4 rounded-[18px] bg-white/[0.04] px-4 py-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"font-medium text-white",children:t.label}),e.jsx(g,{className:t.badgeTone==="emerald"?"text-emerald-300":t.badgeTone==="amber"?"text-amber-300":"text-white/45",children:t.badge})]}),e.jsx("div",{className:"mt-1 text-sm leading-6 text-white/55",children:t.detail})]}),t.action?e.jsxs("button",{type:"button",onClick:t.action.onClick,className:"mt-0.5 flex shrink-0 items-center gap-1.5 rounded-full bg-white/[0.07] px-3 py-1.5 text-xs font-medium text-white/72 transition hover:bg-white/[0.12] hover:text-white",children:[t.action.label,e.jsx(De,{className:"size-3"})]}):null]},t.label))})]}),e.jsxs(k,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Runtime sessions"}),e.jsx("div",{className:"mt-1 text-sm text-white/55",children:"Live OpenClaw, Hermes, and Codex sessions registered against this Forge runtime, with stale detection and reconnect guidance."})]}),E.length>0?e.jsxs(g,{className:"text-white/60",children:[pe.length," live ·"," ",xe.length," stale"]}):null]}),e.jsx("div",{className:"mt-4 grid gap-3",children:Y.isLoading?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/55",children:"Loading agent runtime sessions…"}):E.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/55",children:"No runtime sessions have registered yet. OpenClaw, Hermes, and Codex now self-register here when their Forge adapter starts."}):E.map(t=>{const d=t.primary;return e.jsxs("div",{className:"min-w-0 rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"font-medium text-white",children:t.agentLabel}),e.jsx(g,{className:ke(t.status),children:t.status})]}),e.jsxs("div",{className:"mt-1 text-sm text-white/52",children:[t.provider," ·"," ",d.connectionMode.replaceAll("_"," ")," · last heartbeat ",z(d.lastHeartbeatAt)]}),e.jsxs("div",{className:"mt-2 flex min-w-0 flex-wrap gap-x-4 gap-y-1 text-xs text-white/42",children:[e.jsxs("span",{children:[t.sessions.length," runtime session",t.sessions.length===1?"":"s"]}),e.jsxs("span",{className:"min-w-0 break-all",children:["Current key ",d.sessionKey]}),e.jsxs("span",{children:[t.actionCount," recorded actions"]}),e.jsxs("span",{children:[t.eventCount," session events"]})]}),d.lastError?e.jsx("div",{className:"mt-3 text-sm text-rose-200/82",children:d.lastError}):null]}),e.jsxs("div",{className:"flex min-w-0 flex-wrap gap-2 lg:shrink-0 lg:justify-end",children:[t.status!=="connected"?e.jsx(P,{variant:"secondary",size:"sm",className:"flex-1 sm:flex-none",pending:de.isPending,pendingLabel:"Requesting",onClick:()=>void de.mutateAsync({sessionId:d.id}),children:"Reconnect"}):null,e.jsx(P,{variant:"secondary",size:"sm",className:"flex-1 sm:flex-none",onClick:()=>s(c=>c===d.id?null:d.id),children:r===d.id?"Hide history":"View history"}),t.status!=="disconnected"?e.jsx(P,{variant:"ghost",size:"sm",className:"flex-1 sm:flex-none",pending:ce.isPending,pendingLabel:"Closing",onClick:()=>void ce.mutateAsync({sessionId:d.id,note:"Marked disconnected from the Forge agents console."}),children:"Mark offline"}):null]})]}),d.recentEvents.length>0?e.jsx("div",{className:"mt-4 grid gap-2",children:d.recentEvents.slice(0,3).map(c=>e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[16px] bg-[rgba(255,255,255,0.03)] px-3 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-white",children:c.title}),e.jsx("div",{className:"mt-0.5 text-xs leading-5 text-white/48",children:c.summary||c.eventType})]}),e.jsx("div",{className:"shrink-0 text-xs text-white/35",children:z(c.createdAt)})]},c.id))}):null,e.jsxs("div",{className:"mt-4 rounded-[16px] bg-[rgba(8,13,28,0.52)] p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:"Reconnect plan"}),e.jsx("div",{className:"mt-2 text-sm text-white/62",children:d.reconnectPlan.summary}),e.jsx("pre",{className:"mt-3 whitespace-pre-wrap break-words text-xs leading-6 text-white/70 md:overflow-x-auto md:whitespace-pre",children:e.jsx("code",{className:"break-words",children:d.reconnectPlan.commands.join(`
4
+ `)})})]}),t.sessions.length>1?e.jsxs("div",{className:"mt-4 rounded-[16px] bg-[rgba(8,13,28,0.38)] p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:"Session history under this agent"}),e.jsx("div",{className:"mt-2 grid gap-2",children:t.sessions.slice(0,6).map(c=>e.jsxs("div",{className:"grid min-w-0 gap-1 rounded-[12px] bg-white/[0.035] px-3 py-2 text-xs text-white/50 sm:flex sm:items-center sm:justify-between sm:gap-2",children:[e.jsx("span",{className:"min-w-0 break-all sm:truncate",children:c.sessionKey}),e.jsxs("span",{className:`${ke(c.status)} min-w-0 break-words sm:shrink-0`,children:[c.status," ·"," ",z(c.lastHeartbeatAt)]})]},c.id))})]}):null,r===d.id?e.jsxs("div",{className:"mt-4 rounded-[16px] bg-[rgba(8,13,28,0.52)] p-3",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:"Work history"}),J.isLoading?e.jsx("div",{className:"mt-3 text-sm text-white/55",children:"Loading session history…"}):J.isError?e.jsx("div",{className:"mt-3 text-sm text-rose-200/82",children:"Could not load session history."}):(R==null?void 0:R.session.id)===d.id?e.jsxs("div",{className:"mt-3 grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:"Agent actions"}),e.jsx("div",{className:"mt-2 grid gap-2",children:R.actions.length>0?R.actions.map(c=>e.jsxs("div",{className:"rounded-[14px] bg-white/[0.04] px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"text-sm text-white",children:c.title}),e.jsx(g,{className:"text-white/55",children:c.status})]}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-white/48",children:c.summary||c.actionType}),e.jsx("div",{className:"mt-1 text-xs text-white/35",children:z(c.createdAt)})]},c.id)):e.jsx("div",{className:"rounded-[14px] bg-white/[0.04] px-3 py-2.5 text-sm text-white/50",children:"No recorded agent actions for this session yet."})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:"Session events"}),e.jsx("div",{className:"mt-2 grid gap-2",children:R.events.length>0?R.events.map(c=>e.jsxs("div",{className:"rounded-[14px] bg-white/[0.04] px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"text-sm text-white",children:c.title}),e.jsx(g,{className:"text-white/55",children:c.level})]}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-white/48",children:c.summary||c.eventType}),e.jsx("div",{className:"mt-1 text-xs text-white/35",children:z(c.createdAt)})]},c.id)):e.jsx("div",{className:"rounded-[14px] bg-white/[0.04] px-3 py-2.5 text-sm text-white/50",children:"No session events recorded yet."})})]})]}):null]}):null]},t.key)})})]}),e.jsxs(k,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Agent tokens"}),e.jsxs(P,{size:"sm",variant:"secondary",onClick:()=>{m("operator"),l(!0)},children:[e.jsx(Ee,{className:"size-3.5"}),"Issue token"]})]}),e.jsx("div",{className:"mt-4 grid gap-3",children:N.agentTokens.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/55",children:"No tokens yet. Issue one to let external agents or scripts authenticate with Forge."}):N.agentTokens.map(t=>e.jsxs("div",{className:"min-w-0 rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-white",children:t.label}),e.jsxs("div",{className:"mt-0.5 text-sm text-white/50",children:[t.agentLabel??"Unassigned agent"," ·"," ",e.jsx("span",{className:"break-all font-mono text-xs",children:t.tokenPrefix})]})]}),e.jsx(g,{className:`${t.status==="active"?"text-emerald-300":"text-white/45"} self-start`,children:t.status})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-xs text-white/55",children:[e.jsx("span",{children:t.trustLevel}),e.jsx("span",{children:"·"}),e.jsx("span",{children:t.autonomyMode.replaceAll("_"," ")}),e.jsx("span",{children:"·"}),e.jsx("span",{children:t.approvalMode.replaceAll("_"," ")})]}),e.jsxs("div",{className:"mt-2 text-xs text-white/45",children:["Bootstrap: ",Pe(t.bootstrapPolicy.mode)," · ",t.bootstrapPolicy.projectsLimit," projects"," · ",t.bootstrapPolicy.tasksLimit," tasks",t.bootstrapPolicy.includePeoplePages?` · ${t.bootstrapPolicy.peoplePageLimit} people pages`:" · no people pages"]}),e.jsxs("div",{className:"mt-1 text-xs text-white/45",children:["Default read scope: ",Pt(t)]}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:["write","rewards.manage","psyche.write"].map(d=>e.jsx(g,{className:t.scopes.includes(d)?"text-emerald-300":"text-white/30",children:d},d))}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(P,{variant:"secondary",size:"sm",pending:ne.isPending,pendingLabel:"Rotating",onClick:()=>void ne.mutateAsync(t.id),children:"Rotate & reveal new token"}),e.jsx(P,{variant:"ghost",size:"sm",pending:re.isPending,pendingLabel:"Revoking",onClick:()=>void re.mutateAsync(t.id),children:"Revoke"})]})]},t.id))}),e.jsx("div",{className:"mt-3 px-1 text-xs text-white/35",children:"Raw token values are shown once and are never recoverable. If a token is lost, rotate or issue a new one."})]}),N.agents.length>0?e.jsxs(k,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Connected agents"}),e.jsx("div",{className:"mt-4 grid gap-3",children:N.agents.map(t=>e.jsxs("div",{className:"flex min-w-0 flex-col gap-3 rounded-[18px] bg-white/[0.04] p-4 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-white",children:t.label}),t.description?e.jsx("div",{className:"mt-1 text-sm text-white/52",children:t.description}):null,t.linkedUsers.length>0?e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:t.linkedUsers.map(d=>{var c;return e.jsx(g,{className:"text-white/55",children:((c=d.user)==null?void 0:c.displayName)??d.userId},d.userId)})}):null,e.jsxs("div",{className:"mt-2 flex min-w-0 flex-wrap gap-x-4 gap-y-1 text-sm text-white/55",children:[e.jsx("span",{children:t.agentType}),t.identityKey?e.jsx("span",{className:"min-w-0 break-all font-mono text-xs",children:t.identityKey}):null,e.jsx("span",{children:t.autonomyMode.replaceAll("_"," ")}),e.jsxs("span",{children:[t.activeTokenCount," active token",t.activeTokenCount!==1?"s":""]})]})]}),e.jsx(g,{className:"self-start text-white/60",children:t.trustLevel})]},t.id))})]}):null,p?e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1.05fr)_minmax(0,0.95fr)]",children:[e.jsxs(k,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Recommended next move"}),p.recommendedNextTask?e.jsxs("div",{className:"mt-4 grid gap-2",children:[e.jsx(Z,{kind:"task",label:p.recommendedNextTask.title,variant:"heading",size:"lg"}),e.jsx("div",{className:"text-sm leading-6 text-white/58",children:p.recommendedNextTask.description||"No extra notes yet."}),e.jsxs("div",{className:"mt-1 flex flex-wrap gap-2",children:[e.jsx(g,{children:p.recommendedNextTask.status.replaceAll("_"," ")}),e.jsxs(g,{children:[p.recommendedNextTask.points," xp"]}),e.jsx(g,{children:p.recommendedNextTask.owner})]})]}):e.jsx("div",{className:"mt-4 text-sm text-white/55",children:"Board is clear. No recommended task right now."})]}),e.jsxs(k,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Board pulse"}),e.jsx("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[{label:"Backlog",value:p.currentBoard.backlog.length},{label:"Focus",value:p.currentBoard.focus.length},{label:"In progress",value:p.currentBoard.inProgress.length},{label:"Blocked",value:p.currentBoard.blocked.length}].map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/38",children:t.label}),e.jsx("div",{className:"mt-2 font-display text-3xl text-white",children:t.value})]},t.label))})]})]}):null,p&&p.activeProjects.length>0?e.jsxs(k,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Active projects"}),e.jsx("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:p.activeProjects.slice(0,6).map(t=>e.jsxs("div",{className:"min-w-0 rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[e.jsx("div",{className:"min-w-0",children:e.jsx(Z,{kind:"project",label:t.title})}),e.jsxs(g,{className:"self-start",children:[t.progress,"%"]})]}),e.jsx("div",{className:"mt-2",children:e.jsx(tt,{kind:"goal",label:t.goalTitle,compact:!0,gradient:!1})}),e.jsxs("div",{className:"mt-2 text-xs text-white/38",children:[t.activeTaskCount," active ·"," ",t.completedTaskCount," done"]})]},t.id))})]}):null,e.jsxs(k,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Approval queue"}),D.filter(t=>t.status==="pending").length>0?e.jsxs(g,{className:"text-amber-300",children:[D.filter(t=>t.status==="pending").length," pending"]}):null]}),e.jsx("div",{className:"mt-4 grid gap-3",children:D.length===0?e.jsx("div",{className:"rounded-[18px] bg-white/[0.04] px-4 py-4 text-sm text-white/55",children:"No pending approvals. Agent actions are flowing through."}):D.map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-white",children:t.title}),e.jsx("div",{className:"mt-0.5 text-sm text-white/55",children:t.summary||t.actionType})]}),e.jsx(g,{className:t.status==="pending"?"text-amber-300":"text-white/45",children:t.status})]}),t.status==="pending"?e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(P,{variant:"secondary",size:"sm",pending:oe.isPending,pendingLabel:"Approving",onClick:()=>void oe.mutateAsync(t.id),children:"Approve"}),e.jsx(P,{variant:"ghost",size:"sm",pending:le.isPending,pendingLabel:"Rejecting",onClick:()=>void le.mutateAsync(t.id),children:"Reject"})]}):null]},t.id))})]}),e.jsxs(k,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Retroactive work log"}),e.jsx("div",{className:"mt-1 text-sm text-white/55",children:"Capture work done outside the timer so it counts toward progress and XP."})]}),e.jsxs(P,{variant:"secondary",size:"sm",onClick:()=>b(!0),children:[e.jsx(Be,{className:"size-3.5"}),"Log work"]})]}),O.data?e.jsxs("div",{className:"mt-4 rounded-[18px] bg-[rgba(192,193,255,0.10)] px-4 py-3 text-sm text-white",children:["Logged"," ",e.jsx("span",{className:"inline-block align-middle",children:e.jsx(Z,{kind:"task",label:O.data.task.title,showKind:!1})}),". Operator XP updated to ",O.data.xp.profile.totalXp,"."]}):null]}),e.jsxs(k,{children:[e.jsxs("button",{type:"button",className:"flex w-full items-center justify-between gap-4 text-left",onClick:()=>i(t=>!t),children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Connection & onboarding"}),o?e.jsx("div",{className:"mt-1 text-sm text-white/55",children:o.forgeBaseUrl}):null]}),A?e.jsx(He,{className:"size-4 shrink-0 text-white/38"}):e.jsx(Ue,{className:"size-4 shrink-0 text-white/38"})]}),A&&o?e.jsxs("div",{className:"mt-5 grid gap-4",children:[e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Forge API"}),e.jsx("div",{className:"mt-2 break-all text-sm text-white",children:o.forgeBaseUrl})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Web app"}),e.jsx("div",{className:"mt-2 break-all text-sm text-white",children:o.webAppUrl})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"OpenAPI spec"}),e.jsx("div",{className:"mt-2 break-all text-sm text-white",children:o.openApiUrl})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Default policy"}),e.jsxs("div",{className:"mt-2 text-sm text-white",children:[o.recommendedTrustLevel," ·"," ",o.recommendedAutonomyMode.replaceAll("_"," ")," ·"," ",o.recommendedApprovalMode.replaceAll("_"," ")]}),e.jsxs("div",{className:"mt-2 text-xs text-white/45",children:["Bootstrap default:"," ",Pe(o.defaultBootstrapPolicy.mode)," · ",o.defaultBootstrapPolicy.projectsLimit," projects"," · ",o.defaultBootstrapPolicy.tasksLimit," tasks"]})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"font-medium text-white",children:o.authModes.operatorSession.label}),e.jsx(g,{className:"mt-1 text-emerald-300",children:o.defaultConnectionMode==="operator_session"?"default":"available"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:o.authModes.operatorSession.summary}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:o.authModes.operatorSession.trustedTargets.map(t=>e.jsx(g,{className:"text-white/65",children:t},t))})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"font-medium text-white",children:o.authModes.managedToken.label}),e.jsx(g,{className:"mt-1 text-white/55",children:"optional"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:o.authModes.managedToken.summary}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/48",children:o.tokenRecovery.rotationSummary})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Shared runtime"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:"Keep Forge, OpenClaw, Hermes, and the browser on the same runtime when they should see one shared user directory, one strategy graph, and one task history."}),e.jsxs("div",{className:"mt-3 text-xs leading-5 text-white/46",children:["Base URL: ",o.forgeBaseUrl]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Agent identity"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:"Create each agent as a bot user, then write with that user's `userId`. The relationship graph in Settings -> Users controls what each direction can see, message, share, plan, and affect."}),e.jsx("div",{className:"mt-3 text-xs leading-5 text-white/46",children:"Cross-owner links stay valid even when ownership differs."})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Contract timing"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:"Leave strategies editable while humans and bots refine the graph. Lock them only when the plan becomes the contract the alignment metrics should judge."}),e.jsx("div",{className:"mt-3 text-xs leading-5 text-white/46",children:"Coverage, sequencing, scope discipline, and quality all contribute to alignment now."})]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Fast onboarding checklist"}),e.jsxs("div",{className:"mt-3 grid gap-2 text-sm leading-6 text-white/60",children:[e.jsx("div",{children:"1. Create the human and bot users in Settings -> Users."}),e.jsx("div",{children:"2. Keep the default graph permissive until collaboration is flowing cleanly."}),e.jsx("div",{children:"3. Point OpenClaw and Hermes at the same Forge runtime and storage root when they should collaborate."}),e.jsx("div",{children:"4. Give each adapter a distinct actor label so activity stays readable."}),e.jsx("div",{children:"5. Build strategies as drafts first, then lock when the plan is ready to become the contract."})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Rights language"}),e.jsxs("div",{className:"mt-3 grid gap-2 text-sm leading-6 text-white/60",children:[e.jsx("div",{children:"`See` means discover, search, and read another owner."}),e.jsx("div",{children:"`Message` means coordinate and hand off through Forge."}),e.jsx("div",{children:"`Plan` means draft or edit that owner's strategies."}),e.jsx("div",{children:"`Affect` means create or mutate that owner's work."})]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Strategy lifecycle"}),e.jsxs("div",{className:"mt-3 grid gap-2 text-sm leading-6 text-white/60",children:[e.jsx("div",{children:"1. Save an incomplete draft while the plan is still being negotiated."}),e.jsx("div",{children:"2. Let humans and bots refine targets, nodes, and sequence together."}),e.jsx("div",{children:"3. Lock only when the graph becomes the contract for alignment."}),e.jsx("div",{children:"4. Unlock only when the contract itself is being renegotiated."})]})]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Quick-connect verification"}),e.jsx("pre",{className:"mt-3 overflow-x-auto rounded-[16px] bg-[rgba(8,13,28,0.78)] p-4 text-xs leading-6 text-white/72",children:e.jsx("code",{children:[`curl -s ${o.healthUrl}`,"openclaw plugins install ./projects/forge","openclaw gateway restart"].join(`
5
5
  `)})})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Required API headers"}),e.jsxs("div",{className:"mt-3 grid gap-1 text-sm text-white/60",children:[e.jsx("div",{children:o.requiredHeaders.authorization}),e.jsx("div",{children:o.requiredHeaders.source}),e.jsx("div",{children:o.requiredHeaders.actor})]})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Session registry"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:o.sessionRegistry.summary}),e.jsxs("div",{className:"mt-3 grid gap-1 text-xs leading-5 text-white/46",children:[e.jsxs("div",{children:["Register: ",o.sessionRegistry.registerUrl]}),e.jsxs("div",{children:["Heartbeat: ",o.sessionRegistry.heartbeatUrl]}),e.jsxs("div",{children:["Events: ",o.sessionRegistry.eventsUrl]})]})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-3",children:[o.connectionGuides.openclaw,o.connectionGuides.hermes,o.connectionGuides.codex].map(t=>e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"font-medium text-white",children:t.label}),e.jsx("div",{className:"mt-3 grid gap-2 text-sm leading-6 text-white/60",children:t.installSteps.map(d=>e.jsx("div",{children:d},d))}),e.jsx("pre",{className:"mt-4 overflow-x-auto rounded-[16px] bg-[rgba(8,13,28,0.78)] p-4 text-xs leading-6 text-white/72",children:e.jsx("code",{children:t.verifyCommands.join(`
6
6
  `)})}),e.jsx("div",{className:"mt-3 grid gap-1 text-sm leading-6 text-white/48",children:t.configNotes.map(d=>e.jsx("div",{children:d},d))})]},t.label))}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Multi-user model"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:o.multiUserModel.summary}),e.jsx("div",{className:"mt-3 grid gap-1 text-sm leading-6 text-white/48",children:o.multiUserModel.routeScoping.map(t=>e.jsx("div",{children:t},t))})]}),e.jsxs("div",{className:"rounded-[18px] bg-white/[0.04] p-4",children:[e.jsx("div",{className:"text-xs uppercase tracking-[0.14em] text-white/40",children:"Strategy contracts"}),e.jsx("div",{className:"mt-3 text-sm leading-6 text-white/60",children:o.strategyContractModel.lockSummary}),e.jsx("div",{className:"mt-3 grid gap-1 text-sm leading-6 text-white/48",children:o.strategyContractModel.metricBreakdown.map(t=>e.jsx("div",{children:t},t))})]})]})]}):A&&ae.isError?e.jsx("div",{className:"mt-4 rounded-[18px] bg-[rgba(120,33,33,0.22)] px-4 py-3 text-sm text-rose-100/80",children:"Could not load the onboarding contract. Check the API bridge."}):A?e.jsx("div",{className:"mt-4 text-sm text-white/50",children:"Loading…"}):null]})]})]})}export{Ot as SettingsAgentsPage};
@@ -1 +1 @@
1
- import{r as p,j as e,b3 as z,d0 as k,c7 as T}from"./vendor-DHkYh85p.js";import{j as q,i as E,k as h}from"./state-B-4sS1xO.js";import{S as F}from"./settings-section-nav-CCFm27r2.js";import{dV as R,dW as C,S as Q,E as B,C as g,I as K,Z as $,B as x,b as W,dx as H,dX as V}from"./index-BHTUu_4M.js";import{P as G}from"./page-hero-CQWo1Mm_.js";import"./board-BkDRaMp6.js";import"./ui-C13Nbgas.js";import"./motion-BeD44FeG.js";import"./forms-BFlTgZ3W.js";import"./graph-D6JLqDbD.js";const r={goal:"Goals",project:"Projects",task:"Tasks",strategy:"Strategies",habit:"Habits",tag:"Tags",note:"Notes",insight:"Insights",psyche_value:"Values",behavior_pattern:"Patterns",behavior:"Behaviors",belief_entry:"Beliefs",mode_profile:"Modes",mode_guide_session:"Mode guides",flashcard:"Flashcards",event_type:"Event types",emotion_definition:"Emotions",trigger_report:"Reports",calendar_event:"Calendar events",work_block_template:"Work blocks",task_timebox:"Timeboxes",preference_catalog:"Preference catalogs",preference_catalog_item:"Preference catalog items",preference_context:"Preference contexts",preference_item:"Preference items",questionnaire_instrument:"Questionnaires",sleep_session:"Sleep sessions",workout_session:"Workout sessions"},Y={goal:"goal",project:"project",task:"task",strategy:"strategy",habit:"habit",tag:null,note:null,insight:"report",psyche_value:"value",behavior_pattern:"pattern",behavior:"behavior",belief_entry:"belief",mode_profile:"mode",mode_guide_session:"mode",flashcard:"flashcard",event_type:null,emotion_definition:null,trigger_report:"report",calendar_event:null,work_block_template:null,task_timebox:null,preference_catalog:null,preference_catalog_item:null,preference_context:null,preference_item:null,questionnaire_instrument:null,sleep_session:null,workout_session:null};function O(y){return new Date(y).toLocaleString()}function re(){var N,S;const y=q(),[f,A]=p.useState(""),[l,D]=p.useState([]),d=E({queryKey:["forge-operator-session"],queryFn:H}),P=d.isSuccess,o=E({queryKey:["forge-settings-bin"],queryFn:V,enabled:P}),m=async()=>{await y.invalidateQueries({predicate:t=>Array.isArray(t.queryKey)&&typeof t.queryKey[0]=="string"&&t.queryKey[0].startsWith("forge-")})},b=h({mutationFn:t=>R({operations:[{entityType:t.entityType,id:t.entityId}]}),onSuccess:m}),v=h({mutationFn:t=>C({operations:[{entityType:t.entityType,id:t.entityId,mode:"hard"}]}),onSuccess:m}),j=h({mutationFn:t=>R({operations:t.map(s=>({entityType:s.entityType,id:s.entityId}))}),onSuccess:m}),w=h({mutationFn:t=>C({operations:t.map(s=>({entityType:s.entityType,id:s.entityId,mode:"hard"}))}),onSuccess:m}),c=((N=o.data)==null?void 0:N.bin.records)??[],u=f.trim().toLowerCase(),a=p.useMemo(()=>c.filter(t=>l.length===0||l.includes(t.entityType)?u?[t.title,t.subtitle??"",t.entityType,t.entityId,t.deletedByActor??"",t.deletedSource??"",t.deleteReason??""].join(" ").toLowerCase().includes(u):!0:!1),[u,c,l]),_=p.useMemo(()=>{const t=new Map;for(const s of a){const i=t.get(s.entityType)??[];i.push(s),t.set(s.entityType,i)}return[...t.entries()].sort((s,i)=>r[s[0]].localeCompare(r[i[0]]))},[a]),L=p.useMemo(()=>[...new Set(c.map(t=>t.entityType))].sort((t,s)=>r[t].localeCompare(r[s])),[c]);function M(t){D(s=>s.includes(t)?s.filter(i=>i!==t):[...s,t])}async function I(){a.length===0||!window.confirm(`Permanently delete ${a.length} item${a.length===1?"":"s"} from the bin? This cannot be undone.`)||await w.mutateAsync(a)}return d.isLoading||o.isLoading?e.jsx(Q,{eyebrow:"Settings",title:"Loading bin",description:"Loading deleted items and restore controls.",columns:2,blocks:6}):d.isError?e.jsx(B,{eyebrow:"Settings",error:d.error,onRetry:()=>void d.refetch()}):o.isError?e.jsx(B,{eyebrow:"Settings",error:o.error,onRetry:()=>void o.refetch()}):e.jsxs("div",{className:"mx-auto grid w-full max-w-[1220px] gap-5",children:[e.jsx(G,{title:"Bin",description:"Restore soft-deleted items or permanently remove them when you really mean it.",badge:`${((S=o.data)==null?void 0:S.bin.totalCount)??0} deleted items`}),e.jsx(F,{}),e.jsxs(g,{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-start",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Find deleted items"}),e.jsxs("div",{className:"relative",children:[e.jsx(z,{className:"pointer-events-none absolute left-4 top-1/2 size-4 -translate-y-1/2 text-white/35"}),e.jsx(K,{value:f,onChange:t=>A(t.target.value),placeholder:"Search title, id, reason, or source",className:"pl-11"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:L.map(t=>{const s=l.includes(t);return e.jsx("button",{type:"button",onClick:()=>M(t),className:$("rounded-full border px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.14em] transition",s?"border-[var(--primary)]/30 bg-[var(--primary)]/[0.16] text-[var(--primary)]":"border-white/10 bg-white/[0.04] text-white/58 hover:bg-white/[0.08] hover:text-white"),children:r[t]},t)})})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 lg:max-w-[22rem] lg:justify-end",children:[e.jsxs(x,{variant:"secondary",size:"sm",disabled:a.length===0,pending:j.isPending,pendingLabel:"Restoring",onClick:()=>void j.mutateAsync(a),children:[e.jsx(k,{className:"size-4"}),e.jsx("span",{children:"Restore visible"})]}),e.jsxs(x,{variant:"secondary",size:"sm",disabled:a.length===0,pending:w.isPending,pendingLabel:"Deleting",onClick:()=>void I(),children:[e.jsx(T,{className:"size-4"}),e.jsx("span",{children:"Delete visible forever"})]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 text-sm text-white/55",children:[e.jsxs("span",{children:[a.length," visible"]}),l.length>0?e.jsxs("span",{children:[l.length," type filters active"]}):null,u?e.jsxs("span",{children:["Search: “",f.trim(),"”"]}):null]})]}),c.length===0?e.jsxs(g,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Deleted items"}),e.jsx("div",{className:"mt-4 text-white/72",children:"Nothing is in the bin right now."})]}):_.length===0?e.jsxs(g,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Deleted items"}),e.jsx("div",{className:"mt-4 text-white/72",children:"No deleted items match the current search or filters."})]}):e.jsx("div",{className:"grid gap-5",children:_.map(([t,s])=>{const i=Y[t];return e.jsxs(g,{children:[e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[i?e.jsx(W,{kind:i,label:r[t],compact:!0}):null,i?null:e.jsx("div",{className:"rounded-full border border-white/10 bg-white/[0.05] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-white/55",children:r[t]}),e.jsxs("div",{className:"text-sm text-white/55",children:[s.length," deleted"]})]})}),e.jsx("div",{className:"mt-4 grid gap-3",children:s.map(n=>e.jsxs("div",{className:"grid gap-3 rounded-[22px] border border-white/8 bg-white/[0.04] p-4 lg:grid-cols-[minmax(0,1fr)_auto]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-medium text-white",children:n.title}),n.subtitle?e.jsx("div",{className:"mt-1 text-sm text-white/62",children:n.subtitle}):null,e.jsxs("div",{className:"mt-3 flex flex-wrap gap-3 text-xs text-white/45",children:[e.jsxs("span",{children:["Deleted ",O(n.deletedAt)]}),n.deletedByActor?e.jsxs("span",{children:["By ",n.deletedByActor]}):null,n.deletedSource?e.jsxs("span",{children:["Source ",n.deletedSource]}):null,n.deleteReason?e.jsxs("span",{children:["Reason: ",n.deleteReason]}):null]})]}),e.jsxs("div",{className:"flex flex-wrap items-start justify-end gap-2",children:[e.jsxs(x,{variant:"secondary",size:"sm",pending:b.isPending,pendingLabel:"Restoring",onClick:()=>void b.mutateAsync(n),children:[e.jsx(k,{className:"size-4"}),e.jsx("span",{children:"Restore"})]}),e.jsxs(x,{variant:"secondary",size:"sm",pending:v.isPending,pendingLabel:"Deleting",onClick:()=>void v.mutateAsync(n),children:[e.jsx(T,{className:"size-4"}),e.jsx("span",{children:"Delete forever"})]})]})]},`${n.entityType}:${n.entityId}`))})]},t)})})]})}export{re as SettingsBinPage};
1
+ import{r as p,j as e,b3 as z,c$ as k,c7 as T}from"./vendor-kIz9EZnX.js";import{j as q,i as E,k as h}from"./state-VYvD1QVP.js";import{S as F}from"./settings-section-nav-Dc4IeVBt.js";import{dT as R,dU as C,S as Q,E as B,C as g,I as K,Z as $,B as x,b as H,du as V,dV as W}from"./index-BHIKoiZ6.js";import{P as G}from"./page-hero-oFHaAjtL.js";import"./motion-CfdU2F35.js";import"./ui-CsEkP2V8.js";import"./forms-CmLAyGqz.js";import"./board-DqHzdCPQ.js";import"./graph-BTa79qum.js";const r={goal:"Goals",project:"Projects",task:"Tasks",strategy:"Strategies",habit:"Habits",tag:"Tags",note:"Notes",insight:"Insights",psyche_value:"Values",behavior_pattern:"Patterns",behavior:"Behaviors",belief_entry:"Beliefs",mode_profile:"Modes",mode_guide_session:"Mode guides",flashcard:"Flashcards",event_type:"Event types",emotion_definition:"Emotions",trigger_report:"Reports",calendar_event:"Calendar events",work_block_template:"Work blocks",task_timebox:"Timeboxes",preference_catalog:"Preference catalogs",preference_catalog_item:"Preference catalog items",preference_context:"Preference contexts",preference_item:"Preference items",questionnaire_instrument:"Questionnaires",sleep_session:"Sleep sessions",workout_session:"Workout sessions"},Y={goal:"goal",project:"project",task:"task",strategy:"strategy",habit:"habit",tag:null,note:null,insight:"report",psyche_value:"value",behavior_pattern:"pattern",behavior:"behavior",belief_entry:"belief",mode_profile:"mode",mode_guide_session:"mode",flashcard:"flashcard",event_type:null,emotion_definition:null,trigger_report:"report",calendar_event:null,work_block_template:null,task_timebox:null,preference_catalog:null,preference_catalog_item:null,preference_context:null,preference_item:null,questionnaire_instrument:null,sleep_session:null,workout_session:null};function O(y){return new Date(y).toLocaleString()}function re(){var N,S;const y=q(),[f,A]=p.useState(""),[l,D]=p.useState([]),d=E({queryKey:["forge-operator-session"],queryFn:V}),P=d.isSuccess,o=E({queryKey:["forge-settings-bin"],queryFn:W,enabled:P}),m=async()=>{await y.invalidateQueries({predicate:t=>Array.isArray(t.queryKey)&&typeof t.queryKey[0]=="string"&&t.queryKey[0].startsWith("forge-")})},b=h({mutationFn:t=>R({operations:[{entityType:t.entityType,id:t.entityId}]}),onSuccess:m}),v=h({mutationFn:t=>C({operations:[{entityType:t.entityType,id:t.entityId,mode:"hard"}]}),onSuccess:m}),j=h({mutationFn:t=>R({operations:t.map(s=>({entityType:s.entityType,id:s.entityId}))}),onSuccess:m}),w=h({mutationFn:t=>C({operations:t.map(s=>({entityType:s.entityType,id:s.entityId,mode:"hard"}))}),onSuccess:m}),c=((N=o.data)==null?void 0:N.bin.records)??[],u=f.trim().toLowerCase(),a=p.useMemo(()=>c.filter(t=>l.length===0||l.includes(t.entityType)?u?[t.title,t.subtitle??"",t.entityType,t.entityId,t.deletedByActor??"",t.deletedSource??"",t.deleteReason??""].join(" ").toLowerCase().includes(u):!0:!1),[u,c,l]),_=p.useMemo(()=>{const t=new Map;for(const s of a){const i=t.get(s.entityType)??[];i.push(s),t.set(s.entityType,i)}return[...t.entries()].sort((s,i)=>r[s[0]].localeCompare(r[i[0]]))},[a]),L=p.useMemo(()=>[...new Set(c.map(t=>t.entityType))].sort((t,s)=>r[t].localeCompare(r[s])),[c]);function M(t){D(s=>s.includes(t)?s.filter(i=>i!==t):[...s,t])}async function I(){a.length===0||!window.confirm(`Permanently delete ${a.length} item${a.length===1?"":"s"} from the bin? This cannot be undone.`)||await w.mutateAsync(a)}return d.isLoading||o.isLoading?e.jsx(Q,{eyebrow:"Settings",title:"Loading bin",description:"Loading deleted items and restore controls.",columns:2,blocks:6}):d.isError?e.jsx(B,{eyebrow:"Settings",error:d.error,onRetry:()=>void d.refetch()}):o.isError?e.jsx(B,{eyebrow:"Settings",error:o.error,onRetry:()=>void o.refetch()}):e.jsxs("div",{className:"mx-auto grid w-full max-w-[1220px] gap-5",children:[e.jsx(G,{title:"Bin",description:"Restore soft-deleted items or permanently remove them when you really mean it.",badge:`${((S=o.data)==null?void 0:S.bin.totalCount)??0} deleted items`}),e.jsx(F,{}),e.jsxs(g,{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-start",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Find deleted items"}),e.jsxs("div",{className:"relative",children:[e.jsx(z,{className:"pointer-events-none absolute left-4 top-1/2 size-4 -translate-y-1/2 text-white/35"}),e.jsx(K,{value:f,onChange:t=>A(t.target.value),placeholder:"Search title, id, reason, or source",className:"pl-11"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:L.map(t=>{const s=l.includes(t);return e.jsx("button",{type:"button",onClick:()=>M(t),className:$("rounded-full border px-3 py-1.5 text-[11px] font-semibold uppercase tracking-[0.14em] transition",s?"border-[var(--primary)]/30 bg-[var(--primary)]/[0.16] text-[var(--primary)]":"border-white/10 bg-white/[0.04] text-white/58 hover:bg-white/[0.08] hover:text-white"),children:r[t]},t)})})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 lg:max-w-[22rem] lg:justify-end",children:[e.jsxs(x,{variant:"secondary",size:"sm",disabled:a.length===0,pending:j.isPending,pendingLabel:"Restoring",onClick:()=>void j.mutateAsync(a),children:[e.jsx(k,{className:"size-4"}),e.jsx("span",{children:"Restore visible"})]}),e.jsxs(x,{variant:"secondary",size:"sm",disabled:a.length===0,pending:w.isPending,pendingLabel:"Deleting",onClick:()=>void I(),children:[e.jsx(T,{className:"size-4"}),e.jsx("span",{children:"Delete visible forever"})]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 text-sm text-white/55",children:[e.jsxs("span",{children:[a.length," visible"]}),l.length>0?e.jsxs("span",{children:[l.length," type filters active"]}):null,u?e.jsxs("span",{children:["Search: “",f.trim(),"”"]}):null]})]}),c.length===0?e.jsxs(g,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Deleted items"}),e.jsx("div",{className:"mt-4 text-white/72",children:"Nothing is in the bin right now."})]}):_.length===0?e.jsxs(g,{children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-white/45",children:"Deleted items"}),e.jsx("div",{className:"mt-4 text-white/72",children:"No deleted items match the current search or filters."})]}):e.jsx("div",{className:"grid gap-5",children:_.map(([t,s])=>{const i=Y[t];return e.jsxs(g,{children:[e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[i?e.jsx(H,{kind:i,label:r[t],compact:!0}):null,i?null:e.jsx("div",{className:"rounded-full border border-white/10 bg-white/[0.05] px-3 py-1 text-[11px] uppercase tracking-[0.16em] text-white/55",children:r[t]}),e.jsxs("div",{className:"text-sm text-white/55",children:[s.length," deleted"]})]})}),e.jsx("div",{className:"mt-4 grid gap-3",children:s.map(n=>e.jsxs("div",{className:"grid gap-3 rounded-[22px] border border-white/8 bg-white/[0.04] p-4 lg:grid-cols-[minmax(0,1fr)_auto]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-lg font-medium text-white",children:n.title}),n.subtitle?e.jsx("div",{className:"mt-1 text-sm text-white/62",children:n.subtitle}):null,e.jsxs("div",{className:"mt-3 flex flex-wrap gap-3 text-xs text-white/45",children:[e.jsxs("span",{children:["Deleted ",O(n.deletedAt)]}),n.deletedByActor?e.jsxs("span",{children:["By ",n.deletedByActor]}):null,n.deletedSource?e.jsxs("span",{children:["Source ",n.deletedSource]}):null,n.deleteReason?e.jsxs("span",{children:["Reason: ",n.deleteReason]}):null]})]}),e.jsxs("div",{className:"flex flex-wrap items-start justify-end gap-2",children:[e.jsxs(x,{variant:"secondary",size:"sm",pending:b.isPending,pendingLabel:"Restoring",onClick:()=>void b.mutateAsync(n),children:[e.jsx(k,{className:"size-4"}),e.jsx("span",{children:"Restore"})]}),e.jsxs(x,{variant:"secondary",size:"sm",pending:v.isPending,pendingLabel:"Deleting",onClick:()=>void v.mutateAsync(n),children:[e.jsx(T,{className:"size-4"}),e.jsx("span",{children:"Delete forever"})]})]})]},`${n.entityType}:${n.entityId}`))})]},t)})})]})}export{re as SettingsBinPage};