forge-openclaw-plugin 0.2.118 → 0.3.1

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 (119) hide show
  1. package/dist/assets/{activity-page-DPPiiyLO.js → activity-page-DRRbpVK-.js} +1 -1
  2. package/dist/assets/{ai-surface-workspace-B_fV9C4s.js → ai-surface-workspace-DJPt-OaW.js} +1 -1
  3. package/dist/assets/{atlas-panel-BPTJyMcI.js → atlas-panel-G3wGxjYf.js} +1 -1
  4. package/dist/assets/{calendar-page-D4DcRQv7.js → calendar-page-y8G1ige8.js} +1 -1
  5. package/dist/assets/{calendar-rules-Cl_xMrBn.js → calendar-rules-CRhXqGQu.js} +1 -1
  6. package/dist/assets/{calendar-week-toolbar-BARSOEO9.js → calendar-week-toolbar-CWSK5hJl.js} +1 -1
  7. package/dist/assets/{companion-sync-lab-page-COFYDI3w.js → companion-sync-lab-page-kEgOF3c6.js} +1 -1
  8. package/dist/assets/daily-metrics-dashboard-BJjUIZVA.js +1 -0
  9. package/dist/assets/{entity-note-count-link-BX93WYgh.js → entity-note-count-link-ef3ZOpKM.js} +1 -1
  10. package/dist/assets/{entity-notes-surface-CBlKc-x-.js → entity-notes-surface-CaCjjUaq.js} +1 -1
  11. package/dist/assets/{execution-board-Dh41UeKR.js → execution-board-RRWm2srb.js} +1 -1
  12. package/dist/assets/{faceted-token-search-BgxYH_gW.js → faceted-token-search-CZmtyJTT.js} +1 -1
  13. package/dist/assets/{flagship-signal-deck-bolzzK8q.js → flagship-signal-deck-DxRfmfpN.js} +1 -1
  14. package/dist/assets/{floating-action-menu-C5H-Wr2B.js → floating-action-menu-cKjNsPYD.js} +1 -1
  15. package/dist/assets/{goal-detail-page-CQeFnGDJ.js → goal-detail-page-BgQlK7yT.js} +1 -1
  16. package/dist/assets/{goals-page-BTg9crEK.js → goals-page-Cz2i3pVy.js} +1 -1
  17. package/dist/assets/{habits-page-C4vqk346.js → habits-page-BmEmWCGv.js} +1 -1
  18. package/dist/assets/index-Bcem7l5u.css +1 -0
  19. package/dist/assets/{index-By3tQxiE.js → index-QJkjKYzZ.js} +2 -2
  20. package/dist/assets/{insight-flow-dialog-JPYCsTKI.js → insight-flow-dialog-CdYMHwMP.js} +1 -1
  21. package/dist/assets/{insights-page-CFhVMlVL.js → insights-page-DHG-o9P_.js} +1 -1
  22. package/dist/assets/{kanban-page-DC3IDsnh.js → kanban-page-C6S_fJRc.js} +1 -1
  23. package/dist/assets/{knowledge-graph-page-DucyRYTZ.js → knowledge-graph-page-juA9QCy0.js} +1 -1
  24. package/dist/assets/{life-force-page-UrXfxaSO.js → life-force-page-ChTIA4mV.js} +1 -1
  25. package/dist/assets/{life-force-workspace-BhPNH7ad.js → life-force-workspace-sszLD-Yn.js} +1 -1
  26. package/dist/assets/{metric-tile-DtRPjN4V.js → metric-tile-B-tDTcBt.js} +1 -1
  27. package/dist/assets/{movement-page-DCIdTQEN.js → movement-page-Dx3T3HrG.js} +1 -1
  28. package/dist/assets/{note-markdown-CepDxj3v.js → note-markdown-CCyyE85h.js} +1 -1
  29. package/dist/assets/{note-tags-input-BXYaDkOr.js → note-tags-input-BS14YXHn.js} +1 -1
  30. package/dist/assets/{notes-page-Bl1LlCLo.js → notes-page-D3yGl8TN.js} +1 -1
  31. package/dist/assets/{open-in-graph-button-C263zl5l.js → open-in-graph-button-CMjJZX7G.js} +1 -1
  32. package/dist/assets/{orbit-map-Cb_AJyIj.js → orbit-map-v2Pv9RU_.js} +1 -1
  33. package/dist/assets/{overview-page-C2yLity7.js → overview-page-DSOpBpHf.js} +1 -1
  34. package/dist/assets/{page-hero-5RTqAI88.js → page-hero-CONuJu5J.js} +1 -1
  35. package/dist/assets/{pill-cluster-CBrrtZBm.js → pill-cluster-W2fY48OM.js} +1 -1
  36. package/dist/assets/{preference-entity-handoff-button-BQzg2J4k.js → preference-entity-handoff-button-CKDxCnbl.js} +1 -1
  37. package/dist/assets/{preferences-page-DekYF-Yz.js → preferences-page-Br3zrLlH.js} +1 -1
  38. package/dist/assets/{project-collections-BVXB8PPF.js → project-collections-NBwk6yV-.js} +1 -1
  39. package/dist/assets/{project-detail-page-CQlrLEn9.js → project-detail-page-BIU9_TRN.js} +1 -1
  40. package/dist/assets/{project-management-hierarchy-page--mzM_zRE.js → project-management-hierarchy-page-C2H620xD.js} +1 -1
  41. package/dist/assets/{project-management-section-nav-DQl0qRWy.js → project-management-section-nav-DRPVS1Eh.js} +1 -1
  42. package/dist/assets/{projects-page-Dr_0NdVP.js → projects-page-w7a_L2-z.js} +1 -1
  43. package/dist/assets/{psyche-behaviors-page-DOUaCWON.js → psyche-behaviors-page-Dt4CMC-q.js} +1 -1
  44. package/dist/assets/{psyche-flashcards-page-BA84fO_X.js → psyche-flashcards-page-rXz06dqO.js} +1 -1
  45. package/dist/assets/{psyche-goal-map-page-DpXAg1Vf.js → psyche-goal-map-page-BCcD6Jkl.js} +1 -1
  46. package/dist/assets/{psyche-graph-BxcbAbXt.js → psyche-graph-CXlAj4ED.js} +1 -1
  47. package/dist/assets/psyche-metrics-page-B1otiir6.js +1 -0
  48. package/dist/assets/{psyche-mode-guide-page-CBlIS5N_.js → psyche-mode-guide-page-C6AdVIAv.js} +1 -1
  49. package/dist/assets/{psyche-modes-page-DE6KDK_1.js → psyche-modes-page-DoUqz2mR.js} +1 -1
  50. package/dist/assets/psyche-page-BJNLQn8W.js +1 -0
  51. package/dist/assets/{psyche-patterns-page-DbCNRuww.js → psyche-patterns-page-CzpMSAPu.js} +1 -1
  52. package/dist/assets/{psyche-questionnaire-builder-page-DnraDj1H.js → psyche-questionnaire-builder-page-DjzatGVZ.js} +1 -1
  53. package/dist/assets/{psyche-questionnaire-detail-page-DQ6zNQkk.js → psyche-questionnaire-detail-page-B0Qfowfg.js} +1 -1
  54. package/dist/assets/{psyche-questionnaire-run-detail-page-BGrOIX0B.js → psyche-questionnaire-run-detail-page-B2dNj4jJ.js} +1 -1
  55. package/dist/assets/{psyche-questionnaire-run-page-Bg3BhBHb.js → psyche-questionnaire-run-page-DyD9Ui-g.js} +1 -1
  56. package/dist/assets/{psyche-questionnaires-page-BEreTNjG.js → psyche-questionnaires-page-BxfKcoi3.js} +1 -1
  57. package/dist/assets/{psyche-report-detail-page-Br9KlJBG.js → psyche-report-detail-page-Ci14mNUK.js} +1 -1
  58. package/dist/assets/{psyche-reports-page-Bk6QpAEF.js → psyche-reports-page-ALhNueiV.js} +1 -1
  59. package/dist/assets/{psyche-schemas-beliefs-page-Db8d2ga7.js → psyche-schemas-beliefs-page-C0P2Vw6-.js} +1 -1
  60. package/dist/assets/{psyche-screen-time-page-NazHUAkT.js → psyche-screen-time-page-BYnaT3cb.js} +1 -1
  61. package/dist/assets/{psyche-self-observation-page-H6FToucM.js → psyche-self-observation-page-eM9vpwIB.js} +1 -1
  62. package/dist/assets/{psyche-values-page-DqM382-6.js → psyche-values-page-BqrGIDok.js} +1 -1
  63. package/dist/assets/{report-chain-fields-nW4zndrM.js → report-chain-fields-CbkT7WOO.js} +1 -1
  64. package/dist/assets/{rewards-page-C-tZVnIK.js → rewards-page-DpAJ8IxE.js} +1 -1
  65. package/dist/assets/{scheduling-rules-editor-DGF-044c.js → scheduling-rules-editor-BUGnZJ0g.js} +1 -1
  66. package/dist/assets/{schema-badge-57AJ3FY-.js → schema-badge-CLAA4p-b.js} +1 -1
  67. package/dist/assets/{select-menu-mfaklv7r.js → select-menu-Cqs5t3ng.js} +1 -1
  68. package/dist/assets/{settings-agents-page-CPJeeYg0.js → settings-agents-page-pmkVrOO8.js} +1 -1
  69. package/dist/assets/{settings-bin-page-D3eX5aNf.js → settings-bin-page-BwtLrweW.js} +1 -1
  70. package/dist/assets/{settings-calendar-page-Bgx8NIsP.js → settings-calendar-page-BBjAMOCf.js} +1 -1
  71. package/dist/assets/{settings-data-page-BuMSUjpp.js → settings-data-page-Bqy5SukM.js} +1 -1
  72. package/dist/assets/{settings-logs-page-CHb2GNUM.js → settings-logs-page-8khtrf4T.js} +1 -1
  73. package/dist/assets/{settings-mobile-page-ClUvXhJg.js → settings-mobile-page-BcyRjEU_.js} +1 -1
  74. package/dist/assets/{settings-models-page-njK6D7zc.js → settings-models-page-DlSnO9WX.js} +1 -1
  75. package/dist/assets/{settings-page-Dm--cx6B.js → settings-page-CyBQ2qcB.js} +1 -1
  76. package/dist/assets/{settings-rewards-page-3aShLM3A.js → settings-rewards-page-BBX2WtVM.js} +1 -1
  77. package/dist/assets/{settings-section-nav-BWox23Qv.js → settings-section-nav-Co0AaDG-.js} +1 -1
  78. package/dist/assets/{settings-users-page-D-hEPpgQ.js → settings-users-page-JSnfFFPu.js} +1 -1
  79. package/dist/assets/{settings-wiki-page-CC-rOtDm.js → settings-wiki-page--nT23Fdy.js} +1 -1
  80. package/dist/assets/{sleep-page-Cm_Ei2w1.js → sleep-page-CGMi3MtV.js} +1 -1
  81. package/dist/assets/{sports-page-CqSI-j-H.js → sports-page-Kv5bBoLr.js} +1 -1
  82. package/dist/assets/{strategies-page-BuJ4zLLv.js → strategies-page-Br7RdUJO.js} +1 -1
  83. package/dist/assets/{strategy-detail-page-CLmy0jbW.js → strategy-detail-page-CBWXjUhC.js} +1 -1
  84. package/dist/assets/{strategy-dialog-DnJix1ys.js → strategy-dialog-BTwkaSxI.js} +1 -1
  85. package/dist/assets/{surface-DRNu5Fpz.js → surface-CyWI7e1R.js} +1 -1
  86. package/dist/assets/{task-detail-page-DTnNjW33.js → task-detail-page-Qis9354n.js} +1 -1
  87. package/dist/assets/{timebox-planning-dialog-DckIr1K4.js → timebox-planning-dialog-DB8snOBD.js} +1 -1
  88. package/dist/assets/{today-page-Cgk4HBPK.js → today-page-D9A5PU0S.js} +1 -1
  89. package/dist/assets/{training-load-page-C-7iINaB.js → training-load-page-Bpd4DQAh.js} +1 -1
  90. package/dist/assets/vitals-page-CVYC-4RG.js +1 -0
  91. package/dist/assets/{weekly-review-page-DFmuzzig.js → weekly-review-page-BP7N3fNB.js} +1 -1
  92. package/dist/assets/{weight-loss-page-CWtgeuti.js → weight-loss-page-_fX3N1UK.js} +1 -1
  93. package/dist/assets/{wiki-article-markdown-BkQg8Hne.js → wiki-article-markdown-Bi02AsVt.js} +1 -1
  94. package/dist/assets/{wiki-editor-page-BYKcdX5I.js → wiki-editor-page-OZf9l4Tg.js} +1 -1
  95. package/dist/assets/{wiki-ingest-history-page-D_p4myw1.js → wiki-ingest-history-page-CzeNSL7N.js} +1 -1
  96. package/dist/assets/{wiki-ingest-modal-C-CidueO.js → wiki-ingest-modal-Ig_xnyc6.js} +1 -1
  97. package/dist/assets/wiki-page-B4xuNgY4.js +1 -0
  98. package/dist/assets/{workbench-flow-page-Q3r2IJty.js → workbench-flow-page-BhRJCALC.js} +1 -1
  99. package/dist/assets/{workbench-page-BFfWMGm6.js → workbench-page-DxVs2AOY.js} +1 -1
  100. package/dist/assets/{workout-detail-page-DeDyz1Kk.js → workout-detail-page-D4wfkE98.js} +1 -1
  101. package/dist/index.html +2 -2
  102. package/dist/server/server/migrations/069_psyche_devrage_cumulative_rage.sql +5 -0
  103. package/dist/server/server/src/app.js +3 -2
  104. package/dist/server/server/src/openapi.js +48 -8
  105. package/dist/server/server/src/psyche-types.js +18 -4
  106. package/dist/server/server/src/services/devrage-scanner.js +115 -10
  107. package/dist/server/server/src/services/devrage.js +61 -11
  108. package/openclaw.plugin.json +1 -1
  109. package/package.json +1 -1
  110. package/server/migrations/069_psyche_devrage_cumulative_rage.sql +5 -0
  111. package/skills/forge-openclaw/SKILL.md +7 -0
  112. package/skills/forge-openclaw/entity_conversation_playbooks.md +23 -0
  113. package/skills/forge-openclaw/psyche_entity_playbooks.md +32 -0
  114. package/dist/assets/daily-metrics-dashboard-BNGQlJkQ.js +0 -1
  115. package/dist/assets/index-BAXYM89v.css +0 -1
  116. package/dist/assets/psyche-metrics-page-D8JQEoOl.js +0 -1
  117. package/dist/assets/psyche-page-Dkh7R2Dc.js +0 -1
  118. package/dist/assets/vitals-page-CqE4bYMf.js +0 -1
  119. package/dist/assets/wiki-page-DYpg9ZEO.js +0 -1
@@ -1 +0,0 @@
1
- import{j as e}from"./vendor-Dnkkx2co.js";import{i as g}from"./state-vCcAT5Hq.js";import{L as h,E as p,ch as w,C as i,c as m,Z as u,cv as y}from"./index-By3tQxiE.js";import{P as j}from"./page-hero-5RTqAI88.js";import{S as o,f as v,m as f,M as b}from"./daily-metrics-dashboard-BNGQlJkQ.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";import"./charts-DFnEuIMB.js";function a(t){return new Intl.NumberFormat().format(Math.round(t))}function c(t){return`${t.toFixed(t>=10?1:2)}%`}function N(t){return t.summary.categoryBreakdown.map(s=>({...s,metrics:t.metrics.filter(n=>n.category===s.category)}))}function P(){return e.jsxs(i,{className:"rounded-[30px] border-white/8 bg-[linear-gradient(180deg,rgba(14,20,32,0.96),rgba(9,13,24,0.98))] p-6",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"No daily metrics yet"}),e.jsx("div",{className:"mt-2 text-2xl font-semibold text-white",children:"Psyche metrics will appear after the first local backfill finds conversations."}),e.jsx("p",{className:"mt-3 max-w-3xl text-sm leading-6 text-white/58",children:"This surface stays quiet until Forge has stored daily metric rows. It does not run the scanner while rendering the page."})]})}function q(){const t=g({queryKey:["forge-psyche-metrics-view"],queryFn:async()=>(await y()).metrics});if(t.isLoading)return e.jsx(h,{title:"Loading Psyche metrics",description:"Reading stored daily metric rows and summary statistics."});if(t.isError||!t.data)return e.jsx(p,{eyebrow:"Psyche metrics",error:t.error??new Error("Psyche metrics unavailable"),onRetry:()=>void t.refetch()});const s=t.data,n=N(s),l=s.metrics.find(r=>r.metric==="devrageSwearCount")??null,x=s.metrics.find(r=>r.metric==="swearingMessagePercent")??null;return e.jsxs("div",{className:"mx-auto grid w-full max-w-[1380px] gap-5",children:[e.jsx(j,{title:"Psyche Metrics",titleText:"Psyche Metrics",description:"Daily Psyche measurements from stored history, presented with the same operational shape as Vitals.",badge:s.summary.hasData?`${s.summary.metricCount} daily metrics`:"No daily metrics yet"}),e.jsx(w,{}),s.summary.hasData?e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"grid gap-4 xl:grid-cols-4",children:[e.jsx(o,{title:"Devrage count",description:"Raw daily swear count across scanned user messages.",metric:l}),e.jsx(o,{title:"Swearing rate",description:"Percentage of user messages that contained at least one tracked swear.",metric:x}),e.jsxs(i,{className:"rounded-[28px] border border-amber-200/12 bg-[linear-gradient(180deg,rgba(39,31,17,0.96),rgba(19,21,17,0.95))] p-5",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-amber-100/72",children:"Seven-day averages"}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-[18px] bg-white/[0.045] px-4 py-3",children:[e.jsx("span",{className:"text-sm text-white/58",children:"Swears"}),e.jsx("span",{className:"text-xl font-semibold text-white",children:a(s.context.weeklyAverage.rawSwearCount)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-[18px] bg-white/[0.045] px-4 py-3",children:[e.jsx("span",{className:"text-sm text-white/58",children:"Swearing messages"}),e.jsx("span",{className:"text-xl font-semibold text-white",children:c(s.context.weeklyAverage.swearingMessagePercent)})]})]})]}),e.jsxs(i,{className:"rounded-[28px] border border-white/8 bg-[linear-gradient(180deg,rgba(13,19,37,0.96),rgba(10,14,30,0.96))] p-5",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Stored coverage"}),e.jsxs("div",{className:"mt-3 text-2xl font-semibold text-white",children:[s.summary.trackedDays," days"]}),e.jsxs("div",{className:"mt-3 grid gap-2 text-sm text-white/62",children:[e.jsxs("div",{children:[a(s.context.conversationsScanned)," conversations"]}),e.jsxs("div",{children:[a(s.context.messagesScanned)," user messages"]}),e.jsxs("div",{children:[s.context.sourceCount," source families"]})]})]})]}),e.jsxs("section",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.1fr)_minmax(340px,0.9fr)]",children:[e.jsxs(i,{className:"overflow-hidden rounded-[30px] border-white/8 bg-[radial-gradient(circle_at_top_left,rgba(251,191,36,0.14),transparent_36%),linear-gradient(180deg,rgba(20,18,31,0.98),rgba(10,13,26,0.98))] p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Coverage"}),e.jsxs("div",{className:"text-2xl font-semibold text-white",children:[s.summary.trackedDays," tracked days across ",s.summary.metricCount," metrics"]}),e.jsx("div",{className:"max-w-3xl text-sm leading-6 text-white/58",children:"Devrage is stored as daily Psyche measurements, so this view reads history from SQLite instead of rescanning conversations during page load."})]}),e.jsxs(m,{className:"bg-white/[0.08] text-white/72",children:["Latest snapshot ",v(s.summary.latestDateKey)]})]}),e.jsx("div",{className:"mt-5 grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:s.summary.categoryBreakdown.map(r=>{const d=f(r.category);return e.jsxs("div",{className:u("rounded-[22px] border bg-white/[0.03] p-4",d.ring),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(m,{className:d.badge,children:r.category}),e.jsxs("div",{className:"text-xs text-white/44",children:[r.coverageDays," days"]})]}),e.jsx("div",{className:"mt-3 text-2xl font-semibold text-white",children:r.metricCount}),e.jsxs("div",{className:"mt-1 text-sm text-white/58",children:["active metric",r.metricCount===1?"":"s"]})]},r.category)})})]}),e.jsx(i,{className:"rounded-[30px] border-white/8 bg-[linear-gradient(180deg,rgba(13,19,37,0.96),rgba(10,14,30,0.96))] p-6",children:e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Summary statistics"}),e.jsxs("div",{className:"text-lg font-semibold text-white",children:[a(s.context.totalSwears)," total swears across stored history."]}),e.jsxs("div",{className:"grid gap-3 text-sm leading-6 text-white/58",children:[e.jsxs("div",{children:["Daily average: ",a(s.context.dailyAverage.rawSwearCount)," swears and ",c(s.context.dailyAverage.swearingMessagePercent)," swearing messages."]}),e.jsxs("div",{children:["Weekly average: ",a(s.context.weeklyAverage.rawSwearCount)," swears and ",c(s.context.weeklyAverage.swearingMessagePercent)," swearing messages."]}),e.jsxs("div",{children:[a(s.context.messagesWithSwears)," user messages contained at least one tracked swear."]})]}),e.jsxs("div",{className:"mt-2 rounded-[22px] border border-white/8 bg-white/[0.035] p-4 text-sm text-white/70",children:[s.summary.latestMetricCount," metrics updated on the latest tracked day."]})]})})]}),e.jsx(b,{groups:n})]}):e.jsx(P,{})]})}export{q as PsycheMetricsPage};
@@ -1 +0,0 @@
1
- import{b5 as Q,r as g,j as e,aC as y,c2 as U}from"./vendor-Dnkkx2co.js";import{i as G}from"./state-vCcAT5Hq.js";import{A as z}from"./ai-surface-workspace-B_fV9C4s.js";import{b as Z,P as J}from"./psyche-graph-BxcbAbXt.js";import{u as H,Q as X,j as Y,F as ee,b as N,C as P,Z as K,S as te,E as se,a8 as re,ch as ae,B as ie,V as ne,c as I,cj as oe,ad as le,ck as de}from"./index-By3tQxiE.js";import{P as ce}from"./page-hero-5RTqAI88.js";import"./board-dIX6etHh.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./graph-DDUZNRsO.js";const D={intent:"trigger_report",linkedGoalId:"",linkedProjectId:"",linkedTaskId:""};function ue({open:t,onOpenChange:o}){const d=Q(),l=H(),[c,b]=g.useState(D),k=[{id:"intent",eyebrow:"Reflect",title:"What do you want to reflect on?",description:"Choose the entrypoint first. Forge will route you into the right guided flow instead of dropping you into a generic form.",render:(i,r)=>e.jsx(Y,{columns:3,value:i.intent,onChange:s=>r({intent:s}),options:[{value:"trigger_report",label:"A situation",description:"Start a Spark-to-Pivot report about something that happened."},{value:"behavior",label:"A behavior",description:"Trace an away move, committed action, or recovery path."},{value:"belief",label:"A belief script",description:"Capture or refine the belief beneath the reaction."},{value:"pattern",label:"A recurring pattern",description:"Map the loop, payoff, cost, and better response."},{value:"value",label:"A blocked value",description:"Clarify which value is being challenged or needs support."},{value:"execution_tension",label:"A goal tension",description:"Reflect on a goal, project, or task that carries friction."}]})},{id:"placement",eyebrow:"Placement",title:"Attach the reflection to the wider system",description:"This keeps the reflection connected to values, behaviors, and live work instead of becoming an isolated note.",render:(i,r)=>e.jsx("div",{className:"grid gap-4",children:e.jsx(ee,{label:"Goal / project / task tension",children:e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(N,{kind:"goal",label:"Goal",compact:!0,gradient:!1}),e.jsx(N,{kind:"project",label:"Project",compact:!0,gradient:!1}),e.jsx(N,{kind:"task",label:"Task",compact:!0,gradient:!1})]}),e.jsxs("select",{className:"rounded-[18px] border border-white/8 bg-white/6 px-4 py-3 text-sm text-white",value:i.linkedGoalId,onChange:s=>r({linkedGoalId:s.target.value}),children:[e.jsx("option",{value:"",children:"No goal selected"}),l.snapshot.goals.map(s=>e.jsxs("option",{value:s.id,children:["Goal · ",s.title]},s.id))]}),e.jsxs("select",{className:"rounded-[18px] border border-white/8 bg-white/6 px-4 py-3 text-sm text-white",value:i.linkedProjectId,onChange:s=>r({linkedProjectId:s.target.value}),children:[e.jsx("option",{value:"",children:"No project selected"}),l.snapshot.dashboard.projects.map(s=>e.jsxs("option",{value:s.id,children:["Project · ",s.title]},s.id))]}),e.jsxs("select",{className:"rounded-[18px] border border-white/8 bg-white/6 px-4 py-3 text-sm text-white",value:i.linkedTaskId,onChange:s=>r({linkedTaskId:s.target.value}),children:[e.jsx("option",{value:"",children:"No task selected"}),l.snapshot.tasks.slice(0,40).map(s=>e.jsxs("option",{value:s.id,children:["Task · ",s.title]},s.id))]})]})})})}],h=async()=>{const i=new URLSearchParams({create:"1",intent:c.intent});switch(c.linkedGoalId&&i.set("goalId",c.linkedGoalId),c.linkedProjectId&&i.set("projectId",c.linkedProjectId),c.linkedTaskId&&i.set("taskId",c.linkedTaskId),c.intent){case"behavior":d(`/psyche/behaviors?${i.toString()}`);break;case"belief":d(`/psyche/schemas-beliefs?${i.toString()}`);break;case"pattern":d(`/psyche/patterns?${i.toString()}`);break;case"value":d(`/psyche/values?${i.toString()}`);break;case"execution_tension":case"trigger_report":default:d(`/psyche/reports?${i.toString()}`);break}o(!1),b(D)};return e.jsx(X,{open:t,onOpenChange:o,eyebrow:"Reflect",title:"Start from the right reflective doorway",description:"Choose what you want to reflect on first. Forge will take you into the right guided flow instead of leaving you in a generic form.",value:c,onChange:b,draftPersistenceKey:"psyche.reflect.launcher",steps:k,submitLabel:"Open guided reflection",onSubmit:h})}function _({to:t,children:o,className:d}){return e.jsx(y,{to:t,className:"group block transition-transform duration-[var(--motion-medium)] ease-[var(--ease-standard)] hover:-translate-y-0.5 focus-visible:outline-none",children:e.jsx(P,{className:K("transition-[transform,box-shadow,background,border-color] duration-[var(--motion-medium)] ease-[var(--ease-standard)] group-hover:border-[var(--ui-border-strong)] group-hover:bg-[var(--ui-surface-hover)] group-hover:shadow-[var(--card-shadow-hover)] group-focus-visible:shadow-[var(--card-shadow-hover)]",d),children:o})})}function C(t){return`${t.toFixed(t>=10?0:1)}%`}function f(t){return new Intl.NumberFormat().format(Math.round(t))}const W="inline-flex min-h-10 min-w-0 max-w-full items-center justify-center rounded-[var(--radius-control)] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-2 text-sm font-medium whitespace-nowrap text-[var(--ui-ink-medium)] transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]",me="bg-[linear-gradient(135deg,color-mix(in_srgb,var(--primary)_34%,var(--ui-surface-2)_66%),color-mix(in_srgb,var(--primary)_18%,var(--ui-surface-1)_82%))] text-[var(--ui-ink-strong)]";function M(t,o){return o==="percent"?C(t):f(t)}function pe({metric:t}){const o=t.history.slice(0,7).reverse(),d=Math.max(1,...o.map(l=>l.rawSwearCount));return e.jsxs(P,{className:"min-w-0 border border-[color-mix(in_srgb,var(--warning)_24%,var(--ui-border-subtle)_76%)] bg-[color-mix(in_srgb,var(--ui-warning-soft)_48%,var(--ui-surface-1)_52%)] p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--warning)]",children:"Devrage metric"}),e.jsxs("div",{className:"mt-2 break-words font-display text-[clamp(1.4rem,2.5vw,2.15rem)] leading-none text-[var(--ui-ink-strong)]",children:[f(t.rawSwearCount)," swears"]})]}),e.jsx(I,{className:"bg-[var(--ui-warning-soft)] text-[var(--warning)]",children:t.latestDateKey??"No history"})]}),e.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-3",children:[e.jsxs("div",{className:"min-w-0 rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsx("div",{className:"text-xs text-[var(--ui-ink-faint)]",children:"Swearing messages"}),e.jsx("div",{className:"mt-1 break-words text-2xl font-semibold text-[var(--ui-ink-strong)]",children:C(t.swearingMessagePercent)})]}),e.jsxs("div",{className:"min-w-0 rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsx("div",{className:"text-xs text-[var(--ui-ink-faint)]",children:"Daily average"}),e.jsx("div",{className:"mt-1 break-words text-2xl font-semibold text-[var(--ui-ink-strong)]",children:M(t.dailyAverage.rawSwearCount,"count")})]}),e.jsxs("div",{className:"min-w-0 rounded-[18px] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsx("div",{className:"text-xs text-[var(--ui-ink-faint)]",children:"Weekly average"}),e.jsx("div",{className:"mt-1 break-words text-2xl font-semibold text-[var(--ui-ink-strong)]",children:M(t.weeklyAverage.rawSwearCount,"count")})]})]}),e.jsx("div",{className:"mt-4 flex h-16 items-end gap-1.5",children:o.length>0?o.map(l=>e.jsx("div",{className:"min-w-0 flex-1 rounded-t-[6px] bg-[var(--warning)]/50",style:{height:`${Math.max(8,l.rawSwearCount/d*64)}px`},title:`${l.dateKey}: ${f(l.rawSwearCount)} swears, ${C(l.swearingMessagePercent)} swearing messages`},l.dateKey)):e.jsx("div",{className:"self-center text-sm text-[var(--ui-ink-faint)]",children:"History will appear after the first local backfill."})}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2 text-xs text-[var(--ui-ink-soft)]",children:[e.jsxs("span",{children:[f(t.conversationsScanned)," conversations"]}),e.jsxs("span",{children:[f(t.messagesScanned)," messages"]}),e.jsxs("span",{children:[f(t.messagesWithSwears)," flagged"]})]}),e.jsx(y,{to:"/psyche/metrics",className:"mt-4 inline-flex min-h-10 items-center justify-center rounded-[var(--radius-control)] border border-[color-mix(in_srgb,var(--warning)_24%,transparent)] bg-[var(--ui-warning-soft)] px-4 py-2 text-sm font-medium text-[var(--warning)] transition hover:bg-[color-mix(in_srgb,var(--warning)_20%,transparent)]",children:"Open metrics"})]})}function Se(){var A,T;const t=H(),[o,d]=U(),[l,c]=g.useState(o.get("reflect")==="1"),[b,k]=g.useState(null),h=G({queryKey:["forge-psyche-overview"],queryFn:le}),i=G({queryKey:["forge-psyche-questionnaires-hub"],queryFn:()=>de()}),r=(A=h.data)==null?void 0:A.overview,s=g.useMemo(()=>r?t.snapshot.goals.slice(0,3).map(a=>{const m=r.values.filter(u=>u.linkedGoalIds.includes(a.id)),S=t.snapshot.dashboard.projects.filter(u=>u.goalId===a.id),F=t.snapshot.habits.filter(u=>u.linkedGoalIds.includes(a.id)||u.linkedValueIds.some(w=>m.some(j=>j.id===w))),O=r.reports.filter(u=>u.linkedGoalIds.includes(a.id)),L=r.behaviors.filter(u=>u.linkedValueIds.some(w=>m.some(j=>j.id===w))),V=r.beliefs.filter(u=>u.linkedValueIds.some(w=>m.some(j=>j.id===w)));return{goal:a,linkedValues:m,linkedProjects:S,linkedHabits:F,linkedReports:O,linkedBehaviors:L,linkedBeliefs:V}}):[],[r,t.snapshot.dashboard.projects,t.snapshot.goals,t.snapshot.habits]),p=g.useMemo(()=>Z(s,{compact:!0}),[s]);if(g.useEffect(()=>{k(p.defaultSelectedId)},[p.defaultSelectedId]),h.isLoading)return e.jsx(te,{});if(h.isError||!r)return e.jsx(se,{eyebrow:"Psyche",error:h.error,onRetry:()=>void h.refetch()});const n=p.inspectors[b??p.defaultSelectedId]??p.inspectors[p.defaultSelectedId],v=r.patterns[0]??null,R=r.reports[0]??null,x=[...((T=i.data)==null?void 0:T.instruments)??[]].sort((a,m)=>{const S=a.latestRunAt?new Date(a.latestRunAt).getTime():0;return(m.latestRunAt?new Date(m.latestRunAt).getTime():0)-S})[0]??null,E="Values, patterns, behaviors, beliefs, habits, and reports in one live field.",$=r.devrageMetric.hasData||r.devrageMetric.conversationsScanned>0||r.devrageMetric.history.length>0,q=e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[e.jsx(re,{metrics:t.snapshot.metrics}),e.jsx(y,{to:"/psyche/goal-map",className:W,children:"Open goal map"})]}),B=[{id:"hero",title:"Psyche",description:"Top route composition",defaultWidth:12,defaultHeight:1,removable:!1,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:()=>e.jsx(ce,{title:"Psyche",titleText:"Psyche",description:E,actions:q})},{id:"sections",title:"Psyche sections",description:"Section switcher",defaultWidth:12,defaultHeight:1,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:()=>e.jsx(ae,{})},{id:"field",title:"Live field",description:"Graph and inspector stay as movable widgets.",defaultWidth:8,defaultHeight:5,minWidth:6,render:()=>e.jsx(J,{testId:"psyche-hub-graph",compact:!0,title:"Reflective pulse and live entity field",hint:"Select any goal, value, habit, belief, behavior, project, or report.",nodes:p.nodes,edges:p.edges,fields:p.fields,selectedNodeId:b,onSelectNode:k,minHeightClassName:"min-h-[20rem] sm:min-h-[24rem] lg:min-h-[34rem]",legend:[{label:"Goals",kind:"goal"},{label:"Values",kind:"value"},{label:"Habits",kind:"habit"},{label:"Behaviors",kind:"behavior"}],action:e.jsxs(e.Fragment,{children:[e.jsx(y,{to:"/psyche/goal-map",className:W,children:"Open goal map"}),e.jsx(ie,{size:"sm",className:"min-w-0 sm:min-w-[6.5rem]",onClick:()=>c(!0),children:"Reflect"})]})})},{id:"inspector",title:"Inspector",description:"Selected-node inspector widget.",defaultWidth:4,defaultHeight:5,minWidth:4,render:()=>e.jsxs(P,{className:"h-full min-w-0",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:n.entityKind?e.jsx(N,{kind:n.entityKind,compact:!0,gradient:!1,iconOnly:!0}):e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:n.eyebrow})}),e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:n.entityKind?e.jsx(ne,{kind:n.entityKind,label:n.title,variant:"heading",size:"lg",showKind:!1}):e.jsx("h2",{className:"break-words font-display text-[clamp(1.25rem,2.2vw,1.8rem)] leading-none text-[var(--ui-ink-strong)]",children:n.title})}),e.jsx("p",{className:"mt-3 break-words text-sm leading-6 text-[var(--ui-ink-soft)]",children:n.summary}),n.chips.length>0?e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:n.chips.map(a=>e.jsx(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:a},a))}):null,n.stats.length>0?e.jsx("div",{className:"mt-4 grid gap-2",children:n.stats.map(a=>e.jsx("div",{className:"min-w-0 rounded-[18px] bg-[var(--ui-surface-1)] px-3 py-3 text-sm text-[var(--ui-ink-medium)] break-words",children:a},a))}):null,e.jsx("div",{className:"mt-5",children:e.jsx(y,{to:n.href,className:K("inline-flex min-h-11 w-full items-center justify-center rounded-[var(--radius-control)] px-4 py-2.5 text-sm font-medium whitespace-nowrap shadow-[var(--ui-shadow-soft)]",n.entityKind?oe(n.entityKind,!0):me),children:n.ctaLabel})})]})},...$?[{id:"devrage",title:"Devrage metric",description:"Daily user-message frustration metric.",defaultWidth:4,defaultHeight:3,minWidth:4,render:()=>e.jsx(pe,{metric:r.devrageMetric})}]:[],{id:"actions",title:"Open threads",description:"Action and pulse cards.",defaultWidth:8,defaultHeight:3,render:()=>e.jsxs("div",{className:"grid min-w-0 gap-4 lg:grid-cols-[minmax(0,1.05fr)_minmax(0,0.95fr)]",children:[e.jsxs(_,{to:"/psyche/behaviors",className:"rounded-[28px] border border-[color-mix(in_srgb,var(--success)_22%,var(--ui-border-subtle)_78%)] bg-[color-mix(in_srgb,var(--ui-success-soft)_44%,var(--ui-surface-1)_56%)] p-5",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--success)]",children:"Best next reflective move"}),e.jsx("div",{className:"mt-3 break-words font-display text-[clamp(1.45rem,2.2vw,2rem)] leading-none text-[var(--ui-ink-strong)]",children:(v==null?void 0:v.preferredResponse)||"Map the active loop, then name the committed move that brings you back."}),e.jsx("p",{className:"mt-3 break-words text-sm leading-6 text-[var(--ui-ink-soft)]",children:(v==null?void 0:v.targetBehavior)||"When the loop is explicit, the return path stops feeling abstract."})]}),e.jsxs(_,{to:R?`/psyche/reports/${R.id}`:"/psyche/reports",className:"rounded-[28px] border border-[color-mix(in_srgb,var(--primary)_22%,var(--ui-border-subtle)_78%)] bg-[color-mix(in_srgb,var(--ui-accent-soft)_46%,var(--ui-surface-1)_54%)] p-5",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--primary)]",children:"Open threads"}),e.jsxs("div",{className:"mt-3 grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"min-w-0 rounded-[22px] bg-[var(--ui-surface-1)] px-4 py-4",children:[e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Insights"}),e.jsx("div",{className:"mt-2 break-words font-display text-4xl text-[var(--ui-ink-strong)]",children:r.openInsights})]}),e.jsxs("div",{className:"min-w-0 rounded-[22px] bg-[var(--ui-surface-1)] px-4 py-4",children:[e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Notes"}),e.jsx("div",{className:"mt-2 break-words font-display text-4xl text-[var(--ui-ink-strong)]",children:r.openNotes})]})]})]})]})},{id:"questionnaires",title:"Questionnaire pulse",description:"Recent questionnaire state.",defaultWidth:12,defaultHeight:2,render:()=>{var a;return e.jsxs(_,{to:x!=null&&x.latestRunId?`/psyche/questionnaire-runs/${x.latestRunId}`:"/psyche/questionnaires",className:"rounded-[28px] border border-[color-mix(in_srgb,var(--info)_22%,var(--ui-border-subtle)_78%)] bg-[color-mix(in_srgb,var(--ui-info-soft)_42%,var(--ui-surface-1)_58%)] p-5",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--info)]",children:"Questionnaire pulse"}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"min-w-0 break-words font-display text-[clamp(1.4rem,2.2vw,2rem)] leading-none text-[var(--ui-ink-strong)]",children:(x==null?void 0:x.title)??"Questionnaire library ready"}),e.jsxs(I,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)]",children:[(((a=i.data)==null?void 0:a.instruments)??[]).length," available"]})]})]})}}];return e.jsxs("div",{className:"grid min-w-0 gap-4 overflow-x-clip",children:[e.jsx(z,{surfaceId:"psyche",baseWidgets:B}),e.jsx(ue,{open:l,onOpenChange:a=>{c(a);const m=new URLSearchParams(o);m.delete("reflect"),d(m,{replace:!0})}})]})}export{Se as PsychePage};
@@ -1 +0,0 @@
1
- import{j as e}from"./vendor-Dnkkx2co.js";import{i as x}from"./state-vCcAT5Hq.js";import{P as v}from"./page-hero-5RTqAI88.js";import{u as f,L as j,E as b,C as y,c as l,Z as N,bN as M,cv as k}from"./index-By3tQxiE.js";import{S as o,f as C,m as D,M as u}from"./daily-metrics-dashboard-BNGQlJkQ.js";import"./motion-Lt5B1XuE.js";import"./ui-C1iwpj2-.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";import"./charts-DFnEuIMB.js";const R=["restingHeartRate","heartRateVariabilitySDNN","vo2Max","oxygenSaturation","bodyMass","stepCount"];function p(t,a){return a.map(r=>({...r,metrics:t.filter(s=>s.category===r.category)}))}function S(t){return t}function V({metrics:t}){if(!t.summary.hasData||t.metrics.length===0)return null;const a=p(t.metrics,t.summary.categoryBreakdown),r=t.metrics.find(n=>n.metric==="devrageSwearCount")??null,s=t.metrics.find(n=>n.metric==="swearingMessagePercent")??null;return e.jsxs("section",{className:"grid gap-4",children:[e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/38",children:"Psyche metrics"}),e.jsx("div",{className:"mt-1 text-2xl font-semibold text-white",children:"Conversation tone alongside body signals"})]}),e.jsxs(l,{className:"bg-amber-200/10 text-amber-50",children:[t.summary.trackedDays," tracked days"]})]}),e.jsxs("div",{className:"grid gap-4 xl:grid-cols-2",children:[e.jsx(o,{title:"Devrage count",description:"Daily user-message swear count from stored conversation history.",metric:r}),e.jsx(o,{title:"Swearing rate",description:"Share of scanned user messages that contained at least one tracked swear.",metric:s})]}),e.jsx(u,{groups:a})]})}function I(){var h;const t=f(),a=x({queryKey:["forge-vitals-view",...t.selectedUserIds],queryFn:async()=>(await M(t.selectedUserIds)).vitals}),r=x({queryKey:["forge-psyche-metrics-vitals-view"],queryFn:async()=>(await k()).metrics});if(a.isLoading)return e.jsx(j,{title:"Loading body signals",description:"Reading recent HealthKit body metrics, recovery signals, and daily aggregates."});if(a.isError||!a.data)return e.jsx(b,{error:a.error??new Error("Vitals data unavailable"),onRetry:()=>void a.refetch()});const s=a.data,n=s.metrics.map(S),c=R.map(i=>n.find(d=>d.metric===i)??null),m=s.summary.categoryBreakdown,w=p(n,m),g=!r.isError&&((h=r.data)!=null&&h.summary.hasData)?r.data:null;return e.jsxs("div",{className:"mx-auto grid w-full max-w-[1380px] gap-5",children:[e.jsx(v,{title:"Vitals",description:"Forge now keeps a daily body-signals layer across recovery, cardio fitness, breathing, composition, temperature, and activity. Use this surface to spot drift early, not just admire numbers late.",badge:`${s.summary.metricCount} live metrics`}),e.jsxs("section",{className:"grid gap-4 xl:grid-cols-4",children:[e.jsx(o,{title:"Recovery pulse",description:"Resting heart rate and HRV are the fastest read on load, stress, and whether today needs a gentler edge.",metric:c[0]??c[1]}),e.jsx(o,{title:"Cardio engine",description:"VO2 max and walking heart rate show whether baseline fitness is improving or whether your effort is costing more than usual.",metric:c[2]}),e.jsx(o,{title:"Breath and oxygen",description:"Respiratory rate and oxygen saturation help catch nights or stretches where recovery quality starts to slip.",metric:c[3]}),e.jsx(o,{title:"Body composition",description:"Mass and composition stay close to the daily story so progress is visible without flattening everything into weight alone.",metric:c[4]})]}),e.jsxs("section",{className:"grid gap-4 xl:grid-cols-[minmax(0,1.1fr)_minmax(340px,0.9fr)]",children:[e.jsxs(y,{className:"overflow-hidden rounded-[30px] border-white/8 bg-[radial-gradient(circle_at_top_left,rgba(108,99,255,0.16),transparent_36%),linear-gradient(180deg,rgba(15,19,38,0.98),rgba(9,13,28,0.98))] p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Coverage"}),e.jsxs("div",{className:"text-2xl font-semibold text-white",children:[s.summary.trackedDays," tracked days across ",s.summary.metricCount," metrics"]}),e.jsx("div",{className:"max-w-3xl text-sm leading-6 text-white/58",children:"The companion is compressing HealthKit into daily signal bands, so what you see here is designed for decisions: how your recovery is trending, where your physiology is changing, and which body systems are actually being observed consistently."})]}),e.jsxs(l,{className:"bg-white/[0.08] text-white/72",children:["Latest snapshot ",C(s.summary.latestDateKey)]})]}),e.jsx("div",{className:"mt-5 grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:m.map(i=>{const d=D(i.category);return e.jsxs("div",{className:N("rounded-[22px] border bg-white/[0.03] p-4",d.ring),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(l,{className:d.badge,children:i.category}),e.jsxs("div",{className:"text-xs text-white/44",children:[i.coverageDays," days"]})]}),e.jsx("div",{className:"mt-3 text-2xl font-semibold text-white",children:i.metricCount}),e.jsxs("div",{className:"mt-1 text-sm text-white/58",children:["active metric",i.metricCount===1?"":"s"]})]},i.category)})})]}),e.jsx(y,{className:"rounded-[30px] border-white/8 bg-[linear-gradient(180deg,rgba(13,19,37,0.96),rgba(10,14,30,0.96))] p-6",children:e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-white/40",children:"Daily interpretation"}),e.jsx("div",{className:"text-lg font-semibold text-white",children:"Body signals should feel operational, not medical-chart dead."}),e.jsxs("div",{className:"grid gap-3 text-sm leading-6 text-white/58",children:[e.jsx("div",{children:"Lower resting heart rate paired with stable or rising HRV usually means recovery is holding."}),e.jsx("div",{children:"Rising walking heart rate, falling HRV, or a jump in respiratory rate usually means you are carrying more load than the calendar admits."}),e.jsx("div",{children:"Composition and temperature metrics move slower, but they make the fast signals easier to trust because you can see the surrounding body context."})]}),e.jsxs("div",{className:"mt-2 rounded-[22px] border border-white/8 bg-white/[0.035] p-4 text-sm text-white/70",children:[s.summary.latestMetricCount," metrics updated on the latest tracked day."]})]})})]}),e.jsx(u,{groups:w}),g?e.jsx(V,{metrics:g}):null]})}export{I as VitalsPage};
@@ -1 +0,0 @@
1
- import{b5 as Ce,cc as Se,c2 as Ee,r as c,j as e,b3 as Pe,cx as ae,aG as ie,cG as We,cL as Re,c7 as Ke,b4 as Le,aC as le,aK as ce,bl as $e}from"./vendor-Dnkkx2co.js";import{R as de,P as ue,O as pe,C as me,T as xe,a as ge,D as ze}from"./ui-C1iwpj2-.js";import{j as qe,i as R,k as Ue}from"./state-vCcAT5Hq.js";import{u as Fe,a9 as Te,bq as De,f6 as Oe,L as O,E as ne,a as Be,b as oe,a8 as Me,B as U,Z as N,cL as Qe,I as Je,c as _e,bY as Ae,f7 as He,f8 as Ge,f9 as Ye,fa as Ve}from"./index-By3tQxiE.js";import{O as Xe}from"./open-in-graph-button-C263zl5l.js";import{W as Ze}from"./wiki-article-markdown-BkQg8Hne.js";import{W as es}from"./wiki-ingest-modal-C-CidueO.js";import"./motion-Lt5B1XuE.js";import"./forms-hB0SqEh-.js";import"./board-dIX6etHh.js";import"./graph-DDUZNRsO.js";function ss(m){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(new Date(m))}function ts(m){return m.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function he({nodes:m,activeSlug:o,spaceId:p,depth:i=0}){return e.jsx("ul",{className:N("grid gap-1",i>0&&"mt-1"),children:m.map(n=>{const h=n.page.slug===o;return e.jsxs("li",{className:"grid gap-1",children:[e.jsx(le,{to:{pathname:n.page.slug==="index"?"/wiki":`/wiki/page/${encodeURIComponent(n.page.slug)}`,search:`?spaceId=${encodeURIComponent(p)}`},className:N("rounded-lg px-2 py-1.5 text-[12px] leading-5 transition",h?"bg-[var(--ui-surface-2)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-1)] hover:text-[var(--ui-ink-strong)]"),style:{paddingLeft:`${.5+i*.7}rem`},children:n.page.title}),n.children.length>0?e.jsx(he,{nodes:n.children,activeSlug:o,spaceId:p,depth:i+1}):null]},n.page.id)})})}function rs({open:m,onOpenChange:o,spaces:p,activeSpaceId:i,onSelect:n}){var I;const h=((I=p.find(d=>d.visibility==="shared"))==null?void 0:I.id)??"";return e.jsx(de,{open:m,onOpenChange:o,children:e.jsxs(ue,{children:[e.jsx(pe,{className:"fixed inset-0 z-50 surface-overlay backdrop-blur-sm"}),e.jsxs(me,{className:"fixed left-1/2 top-[14vh] z-50 w-[min(28rem,calc(100vw-1.5rem))] -translate-x-1/2 rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] p-4 shadow-[var(--ui-shadow-floating)] sm:p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(xe,{className:"font-display text-[1.2rem] tracking-[-0.04em] text-[var(--ui-ink-strong)]",children:"Choose KarpaWiki space"}),e.jsx(ze,{className:"mt-1 text-[13px] leading-6 text-[var(--ui-ink-soft)]",children:"Switch the reading space without leaving the article surface."})]}),e.jsx(ge,{asChild:!0,children:e.jsx("button",{type:"button",className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-2 text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]","aria-label":"Close space picker",children:e.jsx(ce,{className:"size-4"})})})]}),e.jsx("div",{className:"mt-4 grid gap-2",children:p.map(d=>{const K=d.id===i,L=d.id===h;return e.jsxs("button",{type:"button",className:N("flex items-center justify-between gap-3 rounded-[22px] border px-4 py-3 text-left transition",K?"border-[color-mix(in_srgb,var(--primary)_26%,transparent)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)] hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]"),onClick:()=>{n(d.id),o(!1)},children:[e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-[14px] font-semibold text-inherit",children:d.label}),e.jsx("span",{className:"mt-1 block text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:d.description||`/${d.slug}`}),L?e.jsx("span",{className:"mt-2 inline-flex rounded-full bg-amber-200/90 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-stone-950",children:"Recovered pages"}):null]}),K?e.jsx($e,{className:"size-4 shrink-0 text-[var(--primary)]"}):null]},d.id)})})]})]})})}function gs(){var A,H,G,Y,V,X,Z,ee,se,te;const m=Fe(),o=Ce(),p=qe(),{slug:i}=Se(),[n,h]=Ee(),[I,d]=c.useState(!1),[K,L]=c.useState(!1),[F,C]=c.useState(!1),[f,fe]=c.useState("hybrid"),[S,be]=c.useState(""),[E,B]=c.useState(""),M=c.useRef(null),T=n.get("spaceId")??"",ve=n.get("ingest")==="1",Q=n.get("ingestJobId"),l=R({queryKey:["forge-wiki-settings"],queryFn:Ae}),t=T||((H=(A=l.data)==null?void 0:A.settings.spaces[0])==null?void 0:H.id)||"",P=((G=l.data)==null?void 0:G.settings.embeddingProfiles.filter(s=>s.enabled))??[];c.useEffect(()=>{var s;!E&&((s=P[0])!=null&&s.id)&&B(P[0].id)},[P,E]),c.useEffect(()=>{var s,a;if(!T&&((a=(s=l.data)==null?void 0:s.settings.spaces[0])!=null&&a.id)){const x=new URLSearchParams(n);x.set("spaceId",l.data.settings.spaces[0].id),h(x,{replace:!0})}},[n,T,h,l.data]);const y=R({queryKey:["forge-wiki-home",t],queryFn:()=>He({spaceId:t||void 0}),enabled:!!t&&!i}),g=R({queryKey:["forge-wiki-page-by-slug",t,i],queryFn:()=>Ge({slug:i??"index",spaceId:t||void 0}),enabled:!!t&&!!i}),W=R({queryKey:["forge-wiki-tree",t],queryFn:()=>Ye({spaceId:t||void 0,kind:"wiki"}),enabled:!!t}),j=R({queryKey:["forge-wiki-modal-search",t,f,S,E],queryFn:()=>Ve({spaceId:t||void 0,mode:f,query:S.trim(),profileId:(f==="semantic"||f==="hybrid")&&E||void 0,limit:30}),enabled:I&&!!t&&S.trim().length>0}),$=i?g.data??null:y.data??null,[ke,ye]=c.useState(null);c.useEffect(()=>{$&&ye($)},[$]);const z=!!t&&(i?g.isFetching:y.isFetching),b=$??(z?ke:null),r=(b==null?void 0:b.page)??null,u=((Y=l.data)==null?void 0:Y.settings.spaces.find(s=>s.id===t))??null,v=((V=l.data)==null?void 0:V.settings.spaces.find(s=>s.visibility==="shared"))??null,je=!!v&&!!u&&(u==null?void 0:u.id)!==(v==null?void 0:v.id)&&(u==null?void 0:u.visibility)==="personal",q=(r==null?void 0:r.slug)!=="index",k=i&&g.error instanceof Te&&g.error.status===404?i.trim():null;c.useEffect(()=>{if(!t||!k)return;const s=new URLSearchParams;s.set("spaceId",t),s.set("title",k);const a=ts(k);a&&s.set("slug",a),o(`/wiki/new?${s.toString()}`,{replace:!0})},[t,k,o]);const J=c.useMemo(()=>((r==null?void 0:r.links)??[]).map(s=>({id:`${s.entityType}:${s.entityId}`,href:De(s.entityType,s.entityId),label:`${s.entityType} · ${s.entityId}`})),[r==null?void 0:r.links]),w=Ue({mutationFn:async s=>Oe(s),onSuccess:async()=>{await Promise.all([p.invalidateQueries({queryKey:["forge-wiki-tree"]}),p.invalidateQueries({queryKey:["forge-wiki-home"]}),p.invalidateQueries({queryKey:["forge-wiki-page-by-slug"]}),p.invalidateQueries({queryKey:["forge-wiki-modal-search"]})]),o(`/wiki${t?`?spaceId=${encodeURIComponent(t)}`:""}`)}}),D=(s,a=!1)=>{const x=new URLSearchParams(n);s(x),h(x,{replace:a})},_=s=>{D(a=>{a.set("ingest","1"),s?a.set("ingestJobId",s):a.delete("ingestJobId"),t&&a.set("spaceId",t)})},we=()=>{D(s=>{s.delete("ingest"),s.delete("ingestJobId")})},Ne=s=>{D(a=>{a.set("ingest","1"),s?a.set("ingestJobId",s):a.delete("ingestJobId"),t&&a.set("spaceId",t)})},Ie=()=>{!r||!q||w.isPending||!window.confirm(`Delete KarpaWiki page "${r.title}"? You can restore it later from the bin.`)||w.mutateAsync(r.id)};return c.useEffect(()=>{if(!F)return;const s=x=>{var re;(re=M.current)!=null&&re.contains(x.target)||C(!1)},a=x=>{x.key==="Escape"&&C(!1)};return document.addEventListener("pointerdown",s),document.addEventListener("keydown",a),()=>{document.removeEventListener("pointerdown",s),document.removeEventListener("keydown",a)}},[F]),!r&&(l.isLoading||W.isLoading||!i&&y.isLoading||i&&g.isLoading)?e.jsx(O,{eyebrow:"KarpaWiki",title:"Loading the article",description:"Preparing the current space, article, and KarpaWiki index."}):!r&&!k&&(l.isError||y.isError||g.isError||W.isError)?e.jsx(ne,{eyebrow:"KarpaWiki",error:l.error??y.error??g.error??W.error,onRetry:()=>{l.refetch(),y.refetch(),g.refetch(),W.refetch()}}):r?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 py-4 sm:px-5 lg:px-6",children:e.jsxs("div",{className:"mx-auto flex w-full max-w-[1680px] flex-col gap-4",children:[e.jsxs("section",{className:"wiki-frame px-3 py-3 sm:px-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(oe,{kind:"wiki_page",label:"KarpaWiki page",compact:!0,gradient:!1}),u?e.jsx(oe,{kind:"wiki_space",label:u.label,compact:!0,gradient:!1,wrap:!0,className:"max-w-[20rem]"}):null,e.jsx("span",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:ss(r.updatedAt)}),e.jsx(Me,{metrics:m.snapshot.metrics,className:"ml-auto"})]}),e.jsxs("div",{className:"mt-3 flex flex-col gap-2 lg:flex-row lg:items-center",children:[e.jsxs("button",{type:"button",className:"wiki-search-launch flex min-h-[2.9rem] w-full items-center gap-3 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 text-left text-[14px] text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)] lg:flex-1",onClick:()=>d(!0),children:[e.jsx(Pe,{className:"size-4 shrink-0 text-[var(--ui-ink-faint)]"}),e.jsx("span",{children:"Search KarpaWiki"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 lg:shrink-0",children:[e.jsxs("button",{type:"button",className:"wiki-space-trigger inline-flex min-h-[2.9rem] items-center gap-2 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 text-[13px] font-medium text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]",onClick:()=>L(!0),children:[e.jsx("span",{className:"text-[11px] uppercase tracking-[0.14em] text-[var(--ui-ink-faint)]",children:"Space"}),e.jsx("span",{className:"max-w-[16rem] truncate",children:(u==null?void 0:u.label)??"KarpaWiki space"}),e.jsx(ae,{className:"size-3.5 text-[var(--ui-ink-faint)]"})]}),e.jsxs("div",{className:"relative",ref:M,children:[e.jsxs(U,{variant:"secondary",size:"sm",className:"min-h-[2.9rem]",onClick:()=>C(s=>!s),children:[e.jsx(ie,{className:"size-3.5"}),"Ingest",e.jsx(ae,{className:"size-3.5"})]}),F?e.jsxs("div",{className:"absolute right-0 top-[calc(100%+0.5rem)] z-20 grid min-w-[15rem] gap-2 rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] p-2 shadow-[var(--ui-shadow-floating)]",children:[e.jsxs("button",{type:"button",className:"flex items-start gap-3 rounded-[18px] px-3 py-3 text-left transition hover:bg-[var(--ui-surface-2)]",onClick:()=>{C(!1),_()},children:[e.jsx(ie,{className:"mt-0.5 size-4 shrink-0 text-[var(--primary)]"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium text-[var(--ui-ink-strong)]",children:"New ingest"}),e.jsx("span",{className:"mt-1 block text-xs leading-5 text-[var(--ui-ink-faint)]",children:"Start a fresh import from files, URLs, or pasted text."})]})]}),e.jsxs("button",{type:"button",className:"flex items-start gap-3 rounded-[18px] px-3 py-3 text-left transition hover:bg-[var(--ui-surface-2)]",onClick:()=>{C(!1),o(`/wiki/ingest-history${t?`?spaceId=${encodeURIComponent(t)}`:""}`)},children:[e.jsx(We,{className:"mt-0.5 size-4 shrink-0 text-[var(--secondary)]"}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium text-[var(--ui-ink-strong)]",children:"History"}),e.jsx("span",{className:"mt-1 block text-xs leading-5 text-[var(--ui-ink-faint)]",children:"Browse prior ingests, reopen reviews, and delete old ingest records."})]})]})]}):null]}),e.jsxs(U,{variant:"secondary",size:"sm",className:"min-h-[2.9rem]",onClick:()=>o(`/wiki/edit/${encodeURIComponent(r.id)}?spaceId=${encodeURIComponent(t)}`,{state:{initialPage:r}}),children:[e.jsx(Re,{className:"size-3.5"}),"Edit"]}),e.jsx(Xe,{entityType:"note",entityId:r.id,label:"Open in graph",size:"sm"}),e.jsxs(U,{variant:"secondary",size:"sm",className:N("min-h-[2.9rem] border border-rose-400/18 bg-rose-500/10 text-rose-100 hover:bg-rose-500/18",!q&&"opacity-60"),onClick:Ie,pending:w.isPending,pendingLabel:"Deleting",disabled:!q,title:q?"Delete this KarpaWiki page":"The KarpaWiki home page cannot be deleted",children:[e.jsx(Ke,{className:"size-3.5"}),"Delete"]}),e.jsxs(U,{size:"sm",className:"min-h-[2.9rem]",onClick:()=>o(`/wiki/new?spaceId=${encodeURIComponent(t)}`),children:[e.jsx(Le,{className:"size-3.5"}),"New page"]})]})]}),je&&v?e.jsxs("div",{className:"mt-3 flex flex-col gap-3 rounded-[22px] border border-amber-300/20 bg-amber-300/[0.08] px-4 py-3 text-[13px] leading-6 text-amber-50 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("span",{children:["You are viewing the personal starter wiki. The recovered people, story, and conversation pages are in"," ",e.jsx("strong",{children:v.label}),"."]}),e.jsx("button",{type:"button",className:"inline-flex min-h-10 shrink-0 items-center justify-center rounded-2xl bg-amber-200 px-4 text-[12px] font-semibold uppercase tracking-[0.14em] text-stone-950 transition hover:bg-amber-100",onClick:()=>{o({pathname:"/wiki",search:`?spaceId=${encodeURIComponent(v.id)}`})},children:"Open shared memory"})]}):null]}),e.jsxs("section",{className:"grid gap-4 lg:grid-cols-[15rem_minmax(0,1fr)] xl:grid-cols-[16rem_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"wiki-frame h-fit px-2 py-3 sm:px-3 lg:sticky lg:top-[5.75rem]",children:[e.jsx("div",{className:"px-2 pb-2 text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Index"}),e.jsx(he,{nodes:((X=W.data)==null?void 0:X.tree)??[],activeSlug:r.slug,spaceId:t})]}),e.jsxs("article",{"aria-busy":z,className:N("wiki-frame relative overflow-hidden px-4 py-5 transition-[opacity,transform] duration-200 sm:px-6 sm:py-6",z&&"opacity-[0.985]"),children:[z?e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-px bg-[color-mix(in_srgb,var(--primary)_70%,transparent)] opacity-90"}):null,e.jsxs("div",{className:"wiki-reading-copy wiki-reading-flow mx-auto max-w-[76rem]",children:[w.isError?e.jsx("div",{className:"mb-4 rounded-[18px] border border-rose-400/20 bg-rose-500/10 px-4 py-3 text-sm text-rose-100",children:w.error instanceof Error?w.error.message:"Forge could not delete this KarpaWiki page."}):null,e.jsx(Ze,{markdown:r.contentMarkdown,spaceId:t}),r.summary.trim()?e.jsx("p",{className:"mt-5 border-t border-[var(--ui-border-subtle)] pt-4 text-[13px] leading-6 text-[var(--ui-ink-soft)]",children:r.summary}):null,J.length>0?e.jsxs("section",{className:"mt-8 border-t border-[var(--ui-border-subtle)] pt-4",children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Forge links"}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:J.map(s=>e.jsx("a",{href:s.href?Qe(s.href):void 0,className:"rounded-full bg-[var(--ui-surface-2)] px-3 py-1.5 text-[12px] text-[var(--ui-ink-medium)] transition hover:bg-[var(--ui-surface-3)] hover:text-[var(--ui-ink-strong)]",children:s.label},s.id))})]}):null,b!=null&&b.backlinkSourceNotes.length?e.jsxs("section",{className:"mt-8 border-t border-[var(--ui-border-subtle)] pt-4",children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:"Linked here"}),e.jsx("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:b.backlinkSourceNotes.map(s=>e.jsxs(le,{to:{pathname:s.slug==="index"?"/wiki":`/wiki/page/${encodeURIComponent(s.slug)}`,search:`?spaceId=${encodeURIComponent(s.spaceId)}`},className:"rounded-xl border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3 transition hover:bg-[var(--ui-surface-2)]",children:[e.jsx("div",{className:"text-[13px] font-semibold text-[var(--ui-ink-strong)]",children:s.title}),s.summary?e.jsx("div",{className:"mt-1 text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:s.summary}):null]},s.id))})]}):null]})]})]})]})}),e.jsx(de,{open:I,onOpenChange:d,children:e.jsxs(ue,{children:[e.jsx(pe,{className:"fixed inset-0 z-50 surface-overlay backdrop-blur-sm"}),e.jsxs(me,{className:"fixed left-1/2 top-[8vh] z-50 w-[min(54rem,calc(100vw-1.5rem))] -translate-x-1/2 rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] p-4 shadow-[var(--ui-shadow-floating)] sm:p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("div",{children:e.jsx(xe,{className:"font-display text-[1.35rem] tracking-[-0.04em] text-[var(--ui-ink-strong)]",children:"Search the wiki"})}),e.jsx(ge,{asChild:!0,children:e.jsx("button",{type:"button",className:"rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-2 text-[var(--ui-ink-soft)] transition hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]","aria-label":"Close search",children:e.jsx(ce,{className:"size-4"})})})]}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[e.jsx(Je,{autoFocus:!0,value:S,onChange:s=>be(s.target.value),placeholder:"Search KarpaWiki pages",className:"h-11 rounded-2xl border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] text-[14px] text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-faint)]"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[["text","hybrid","semantic","entity"].map(s=>e.jsx("button",{type:"button",className:N("rounded-full px-3 py-1.5 text-[12px] font-medium uppercase tracking-[0.14em] transition",f===s?"bg-[var(--ui-surface-3)] text-[var(--ui-ink-strong)]":"bg-[var(--ui-surface-1)] text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]"),onClick:()=>fe(s),children:s},s)),(f==="semantic"||f==="hybrid")&&P.length>0?e.jsx("select",{className:"ml-auto rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-1.5 text-[12px] text-[var(--ui-ink-strong)]",value:E,onChange:s=>B(s.target.value),children:P.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))}):null]})]}),e.jsx("div",{className:"mt-4 max-h-[60vh] overflow-y-auto",children:S.trim()?j.isLoading?e.jsx(O,{eyebrow:"KarpaWiki search",title:"Searching",description:"Ranking matching pages for this query."}):j.isError?e.jsx(ne,{eyebrow:"KarpaWiki search",error:j.error,onRetry:()=>void j.refetch()}):(Z=j.data)!=null&&Z.results.length?e.jsx("div",{className:"grid gap-2",children:j.data.results.map(s=>e.jsx("button",{type:"button",className:"rounded-2xl border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3 text-left transition hover:bg-[var(--ui-surface-2)]",onClick:()=>{d(!1),o({pathname:s.page.slug==="index"?"/wiki":`/wiki/page/${encodeURIComponent(s.page.slug)}`,search:`?spaceId=${encodeURIComponent(s.page.spaceId)}`})},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:"text-[14px] font-semibold text-[var(--ui-ink-strong)]",children:s.page.title}),s.page.summary?e.jsx("div",{className:"mt-1 text-[12px] leading-5 text-[var(--ui-ink-soft)]",children:s.page.summary}):null]}),e.jsx(_e,{size:"sm",tone:"meta",children:s.score.toFixed(2)})]})},s.page.id))}):e.jsx("div",{className:"rounded-2xl border border-dashed border-[var(--ui-border-subtle)] px-4 py-10 text-center text-[13px] leading-6 text-[var(--ui-ink-faint)]",children:"No pages matched this search."}):e.jsx("div",{className:"rounded-2xl border border-dashed border-[var(--ui-border-subtle)] px-4 py-10 text-center text-[13px] leading-6 text-[var(--ui-ink-faint)]",children:"Start typing to search the current KarpaWiki space."})})]})]})}),e.jsx(rs,{open:K,onOpenChange:L,spaces:((ee=l.data)==null?void 0:ee.settings.spaces)??[],activeSpaceId:t,onSelect:s=>{o({pathname:"/wiki",search:`?spaceId=${encodeURIComponent(s)}`},{replace:!0})}}),e.jsx(es,{open:ve,onOpenChange:s=>{if(s){_(Q);return}we()},spaces:((se=l.data)==null?void 0:se.settings.spaces)??[],llmProfiles:((te=l.data)==null?void 0:te.settings.llmProfiles)??[],initialSpaceId:t,selectedJobId:Q,onJobSelected:Ne,linkedEntityHints:r.links.map(s=>({entityType:s.entityType,entityId:s.entityId,anchorKey:null}))??[]})]}):k?e.jsx(O,{eyebrow:"KarpaWiki",title:"Opening a new page",description:`Creating a draft for ${k}.`}):e.jsx(Be,{eyebrow:"KarpaWiki",title:"Article not found",description:"This page does not exist in the selected space."})}export{gs as WikiPage};