forge-openclaw-plugin 0.3.15 → 0.3.16

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 (362) hide show
  1. package/README.md +6 -6
  2. package/dist/assets/{action-bar-B9MYlps2.js → action-bar-DgrmzFrI.js} +1 -1
  3. package/dist/assets/{activity-page-DbzbChcE.js → activity-page-CF451ueg.js} +1 -1
  4. package/dist/assets/{ai-surface-workspace-CF0257Hs.js → ai-surface-workspace-DtwybxJB.js} +1 -1
  5. package/dist/assets/{atlas-panel-CO3RYAKn.js → atlas-panel-CB3uYk_K.js} +1 -1
  6. package/dist/assets/{calendar-page-BuuHKEHC.js → calendar-page-BYsDuLnh.js} +1 -1
  7. package/dist/assets/{calendar-rules-DKftgNx5.js → calendar-rules-DXuOv2J-.js} +1 -1
  8. package/dist/assets/{calendar-week-toolbar-ChIpkT-G.js → calendar-week-toolbar-8PJmiUE_.js} +1 -1
  9. package/dist/assets/{companion-sync-lab-page-BZRX4Btw.js → companion-sync-lab-page-DzWNOaBh.js} +1 -1
  10. package/dist/assets/{daily-metrics-dashboard-CXDsaAQd.js → daily-metrics-dashboard-CHcYxDhs.js} +1 -1
  11. package/dist/assets/{define-workbench-box-CpG0Zb1L.js → define-workbench-box-DcI0_QKW.js} +1 -1
  12. package/dist/assets/{entity-link-multiselect-Dl4rZqdg.js → entity-link-multiselect-C--AiCMb.js} +1 -1
  13. package/dist/assets/{entity-note-count-link-Bs1aKYyD.js → entity-note-count-link-xne6mshj.js} +1 -1
  14. package/dist/assets/{entity-notes-surface-B56XSw7M.js → entity-notes-surface-jy6Psist.js} +1 -1
  15. package/dist/assets/{execution-board-D66C_ikW.js → execution-board-BSUZCIIx.js} +1 -1
  16. package/dist/assets/{faceted-token-search-Dg2rjknH.js → faceted-token-search-BMQ1Wwzt.js} +1 -1
  17. package/dist/assets/{flagship-signal-deck-C6KVPhmM.js → flagship-signal-deck-DjcskRwF.js} +1 -1
  18. package/dist/assets/{floating-action-menu-DAFAEBcA.js → floating-action-menu-cGhbJ2tc.js} +1 -1
  19. package/dist/assets/{generic-node-view-C6DK5hJ6.js → generic-node-view-DNVwfqqq.js} +1 -1
  20. package/dist/assets/{goal-detail-page-CC4VXud6.js → goal-detail-page-dAbyCilO.js} +1 -1
  21. package/dist/assets/{goal-dialog-15hD8EBp.js → goal-dialog-DH50D0tP.js} +1 -1
  22. package/dist/assets/{goals-page-CQ2lJMzI.js → goals-page-DkMy9mPD.js} +1 -1
  23. package/dist/assets/{habits-page-a7KVPaQp.js → habits-page-CCQR8rg6.js} +1 -1
  24. package/dist/assets/{health-boxes-DqgvIYoL.js → health-boxes-BPTgGM6G.js} +1 -1
  25. package/dist/assets/index-VzCGTBS_.css +1 -0
  26. package/dist/assets/{index-FpGANF9S.js → index-izRKx6JK.js} +2 -2
  27. package/dist/assets/{inline-note-fields-COgzxr_7.js → inline-note-fields-D4mCM1gO.js} +1 -1
  28. package/dist/assets/{insight-flow-dialog-Dmb6NSGp.js → insight-flow-dialog-Btp6bkbV.js} +1 -1
  29. package/dist/assets/{insights-page-OnqR4cYI.js → insights-page-1qM4mxjS.js} +1 -1
  30. package/dist/assets/{kanban-boxes-BWUzntCV.js → kanban-boxes-u_A-UJG-.js} +1 -1
  31. package/dist/assets/{kanban-page-BI16Gzp_.js → kanban-page-CKCa_3Qb.js} +1 -1
  32. package/dist/assets/{knowledge-graph-page-DxEBaEke.js → knowledge-graph-page-BZOxRv19.js} +1 -1
  33. package/dist/assets/{life-force-page-CDEXEQai.js → life-force-page-BZlyA144.js} +1 -1
  34. package/dist/assets/{life-force-workspace-C7UOnJEf.js → life-force-workspace-CtAWZXNw.js} +1 -1
  35. package/dist/assets/{metric-tile-boeHB1R1.js → metric-tile-Bkx2btO2.js} +1 -1
  36. package/dist/assets/{movement-boxes-BUSqaTL2.js → movement-boxes-QZ2EIS9q.js} +1 -1
  37. package/dist/assets/{movement-page-DcbO0497.js → movement-page-B-3ihggI.js} +1 -1
  38. package/dist/assets/{note-markdown-DXXI3W3V.js → note-markdown-BWedRE3c.js} +1 -1
  39. package/dist/assets/{note-tags-input-CYh3TVW2.js → note-tags-input-DZkCqI1w.js} +1 -1
  40. package/dist/assets/{notes-boxes-CMJXX2K0.js → notes-boxes-DGFmt7Dp.js} +1 -1
  41. package/dist/assets/{notes-page-DvHMcQey.js → notes-page-DYkn04tz.js} +1 -1
  42. package/dist/assets/{open-in-graph-button-4UYrp1XP.js → open-in-graph-button-CjvkEj1P.js} +1 -1
  43. package/dist/assets/{orbit-map-BwK7sDaC.js → orbit-map-CRHSPenk.js} +1 -1
  44. package/dist/assets/{overview-page-Z5vaUTm3.js → overview-page-D6LsjPWe.js} +1 -1
  45. package/dist/assets/{page-hero-DvrM83_C.js → page-hero-BLhM8FF3.js} +1 -1
  46. package/dist/assets/{pill-cluster-DYI3Ibj8.js → pill-cluster-B5bYs_e2.js} +1 -1
  47. package/dist/assets/{preference-entity-handoff-button-C2ATjvws.js → preference-entity-handoff-button-CfCQl3cW.js} +1 -1
  48. package/dist/assets/{preferences-page-BAexXHye.js → preferences-page-OltGdsQ2.js} +1 -1
  49. package/dist/assets/{project-collections-B9nr-Ts-.js → project-collections-FfBIVwXu.js} +1 -1
  50. package/dist/assets/{project-detail-page-B9PqyPu9.js → project-detail-page-CCm3iZPQ.js} +1 -1
  51. package/dist/assets/{project-dialog-CBA-D65n.js → project-dialog-B_J1ESMk.js} +1 -1
  52. package/dist/assets/{project-management-hierarchy-page-DXK14jn0.js → project-management-hierarchy-page-BNzvtNZj.js} +1 -1
  53. package/dist/assets/{project-management-section-nav-DJ3QKCtr.js → project-management-section-nav-DBNHt9p5.js} +1 -1
  54. package/dist/assets/{projects-boxes-iBu_PRqe.js → projects-boxes-BvlVsO5q.js} +1 -1
  55. package/dist/assets/{projects-page-CdAk-ByT.js → projects-page-BUf7KV-_.js} +1 -1
  56. package/dist/assets/{psyche-behaviors-page-CbhhTfU2.js → psyche-behaviors-page-jtyhdpJ1.js} +1 -1
  57. package/dist/assets/{psyche-flashcards-page-DQaw_vUQ.js → psyche-flashcards-page-05606-97.js} +1 -1
  58. package/dist/assets/{psyche-goal-map-page-C-ZTVOEP.js → psyche-goal-map-page-Cw-aqS3Y.js} +1 -1
  59. package/dist/assets/{psyche-graph-DYzeClxn.js → psyche-graph-0E22QHPe.js} +1 -1
  60. package/dist/assets/{psyche-metrics-page-C9hKn10A.js → psyche-metrics-page-DBFVPeMa.js} +1 -1
  61. package/dist/assets/{psyche-mode-guide-page-CR8e984W.js → psyche-mode-guide-page-DI-LNEDT.js} +1 -1
  62. package/dist/assets/psyche-modes-page-CaMupyfi.js +1 -0
  63. package/dist/assets/{psyche-page-CTdIDkw9.js → psyche-page-CFBq0YKf.js} +1 -1
  64. package/dist/assets/{psyche-patterns-page-Drgm-f7I.js → psyche-patterns-page-sp4ikoef.js} +1 -1
  65. package/dist/assets/{psyche-questionnaire-builder-page-gRwdGXde.js → psyche-questionnaire-builder-page-DEt0UDsz.js} +1 -1
  66. package/dist/assets/{psyche-questionnaire-detail-page-CIP9b2UI.js → psyche-questionnaire-detail-page-BXQbOE6A.js} +1 -1
  67. package/dist/assets/{psyche-questionnaire-run-detail-page-SYndwtF3.js → psyche-questionnaire-run-detail-page-Cd3ClsSK.js} +1 -1
  68. package/dist/assets/{psyche-questionnaire-run-page-CXiJyd5i.js → psyche-questionnaire-run-page-D_EokOQm.js} +1 -1
  69. package/dist/assets/{psyche-questionnaires-page-CFPKwA3O.js → psyche-questionnaires-page-D1Ov2L4n.js} +1 -1
  70. package/dist/assets/{psyche-report-detail-page-dU30a2WE.js → psyche-report-detail-page-9HyPr8BJ.js} +1 -1
  71. package/dist/assets/{psyche-reports-page-Cn0EBndy.js → psyche-reports-page-BeyJg5fb.js} +1 -1
  72. package/dist/assets/{psyche-schemas-beliefs-page-Bab4xSWv.js → psyche-schemas-beliefs-page-DNmf-Vma.js} +1 -1
  73. package/dist/assets/{psyche-screen-time-page-lIe6GQxJ.js → psyche-screen-time-page-DJMDR5oo.js} +1 -1
  74. package/dist/assets/{psyche-self-observation-page-BTE3KfIl.js → psyche-self-observation-page-DFKXG1Yv.js} +1 -1
  75. package/dist/assets/{psyche-values-page-DclBZ9xw.js → psyche-values-page-TWKth89J.js} +1 -1
  76. package/dist/assets/{question-flow-dialog-Ded2E85L.js → question-flow-dialog-D-_EvoAt.js} +1 -1
  77. package/dist/assets/{report-chain-fields-DY640iqL.js → report-chain-fields-Dy-jBQDn.js} +1 -1
  78. package/dist/assets/{rewards-page-FxUXB76B.js → rewards-page-D3ymEd2X.js} +1 -1
  79. package/dist/assets/{scheduling-rules-editor-jakFfxqF.js → scheduling-rules-editor-CAd290IE.js} +1 -1
  80. package/dist/assets/{schema-badge-30B5syHA.js → schema-badge-BLaVI1D7.js} +1 -1
  81. package/dist/assets/{schemas-Db29G8NU.js → schemas-B0Pa-V-A.js} +1 -1
  82. package/dist/assets/{select-menu-BF2zI3RW.js → select-menu-DcS4Ukjf.js} +1 -1
  83. package/dist/assets/{settings-agents-page-Bh-Bv6FQ.js → settings-agents-page-Bt38HhEJ.js} +1 -1
  84. package/dist/assets/{settings-bin-page-DT8JJero.js → settings-bin-page-DqyVI1i1.js} +1 -1
  85. package/dist/assets/{settings-calendar-page-BA4_Qqiu.js → settings-calendar-page-DPSSZV3s.js} +1 -1
  86. package/dist/assets/{settings-data-page-K4kpmQJY.js → settings-data-page-BdHsD1C_.js} +1 -1
  87. package/dist/assets/{settings-logs-page-DkuNPAZo.js → settings-logs-page-D9OnWoFq.js} +1 -1
  88. package/dist/assets/{settings-mobile-page-4pCNwD91.js → settings-mobile-page-DFpsXA4M.js} +1 -1
  89. package/dist/assets/{settings-models-page-CZHG3t7W.js → settings-models-page-DaFXLp-O.js} +1 -1
  90. package/dist/assets/{settings-page-B_Be0vOY.js → settings-page-m_3iYPwU.js} +1 -1
  91. package/dist/assets/{settings-rewards-page-C6nFTWJu.js → settings-rewards-page-B2aBm-dA.js} +1 -1
  92. package/dist/assets/{settings-section-nav-Lo-VKCfZ.js → settings-section-nav-CMeU19Rx.js} +1 -1
  93. package/dist/assets/{settings-users-page-CVzNp4-m.js → settings-users-page-D8jyewJl.js} +1 -1
  94. package/dist/assets/{settings-wiki-page-DXM--7BB.js → settings-wiki-page-DjOgQJAh.js} +1 -1
  95. package/dist/assets/{sleep-page-DvPdZMKx.js → sleep-page-D8-dA4bE.js} +1 -1
  96. package/dist/assets/{sports-page-DjuZlOur.js → sports-page-CK3PgPKB.js} +1 -1
  97. package/dist/assets/{strategies-page-PE1IlatS.js → strategies-page-aFpJath-.js} +1 -1
  98. package/dist/assets/{strategy-detail-page-C4KiEGCI.js → strategy-detail-page-CobF5qLv.js} +1 -1
  99. package/dist/assets/{strategy-dialog-Cwf7Y3P5.js → strategy-dialog-Fgoaoob5.js} +1 -1
  100. package/dist/assets/{surface-ubuOfukq.js → surface-D0dqgX-k.js} +1 -1
  101. package/dist/assets/{task-detail-page-B3SMFZQ3.js → task-detail-page-CDK79bzk.js} +1 -1
  102. package/dist/assets/{task-dialog-CI_Fy_FW.js → task-dialog-eCDTF8xe.js} +4 -4
  103. package/dist/assets/{timebox-planning-dialog-BtFuVoA1.js → timebox-planning-dialog-CNZIGSpd.js} +1 -1
  104. package/dist/assets/{today-boxes-CYuxSkZf.js → today-boxes-CYfskVrM.js} +1 -1
  105. package/dist/assets/{today-page-CHGpLEZ3.js → today-page-Bnh8wopq.js} +1 -1
  106. package/dist/assets/{training-load-page-GZJF-Yy5.js → training-load-page-C7lq-jqy.js} +1 -1
  107. package/dist/assets/{user-badge-ByhC6bMU.js → user-badge-MEZuJiir.js} +1 -1
  108. package/dist/assets/{utility-widgets-ilORjDmg.js → utility-widgets-h5eG2jvc.js} +1 -1
  109. package/dist/assets/{vitals-page-mdEqIm_9.js → vitals-page-eoFnQ3XL.js} +1 -1
  110. package/dist/assets/{weekly-review-page-C8W-yg5r.js → weekly-review-page-C7BU1gkK.js} +1 -1
  111. package/dist/assets/{weight-loss-page-BApTknCn.js → weight-loss-page-Cc7Do3XY.js} +1 -1
  112. package/dist/assets/{wiki-article-markdown-DBccllQg.js → wiki-article-markdown-CCKoSptz.js} +1 -1
  113. package/dist/assets/{wiki-editor-page-BfRfH1O3.js → wiki-editor-page-BpbxZrgz.js} +1 -1
  114. package/dist/assets/{wiki-ingest-history-page-C-6H3MU6.js → wiki-ingest-history-page-D5Wfr8pc.js} +1 -1
  115. package/dist/assets/{wiki-ingest-modal-DnlhByD_.js → wiki-ingest-modal-DhRVsEwC.js} +1 -1
  116. package/dist/assets/{wiki-page-DPZ55e3x.js → wiki-page-1vf-HErs.js} +1 -1
  117. package/dist/assets/{workbench-flow-page-_-NKIx5R.js → workbench-flow-page-y9FxDbKO.js} +1 -1
  118. package/dist/assets/{workbench-page-NIAzggwX.js → workbench-page-Da16AZvN.js} +1 -1
  119. package/dist/assets/{workout-detail-page-3fxr6HL4.js → workout-detail-page-Cq0YamXF.js} +1 -1
  120. package/dist/index.html +2 -2
  121. package/dist/openclaw/api-client.js +28 -2
  122. package/dist/openclaw/local-runtime.js +31 -14
  123. package/dist/server/{server → apps/api}/src/app.js +1 -1
  124. package/dist/server/{server → apps/api}/src/connectors/box-registry.js +3 -3
  125. package/dist/server/{server → apps/api}/src/db.js +23 -4
  126. package/dist/server/{server → apps/api}/src/health-weight-loss.js +1 -1
  127. package/dist/server/{server → apps/api}/src/questionnaire-seeds.js +1 -1
  128. package/dist/server/{server → apps/api}/src/repositories/ai-connectors.js +1 -1
  129. package/dist/server/{server → apps/api}/src/repositories/habits.js +1 -1
  130. package/dist/server/{server → apps/api}/src/services/companion-iroh.js +4 -1
  131. package/dist/server/{server → apps/api}/src/services/doctor.js +3 -3
  132. package/dist/server/{server → apps/api}/src/services/gamification-assets.js +1 -1
  133. package/dist/server/{server → apps/api}/src/services/gamification.js +1 -1
  134. package/dist/server/{server → apps/api}/src/services/knowledge-graph.js +3 -3
  135. package/dist/server/{server → apps/api}/src/types.js +2 -2
  136. package/dist/server/{server → apps/api}/src/watch-mobile.js +1 -1
  137. package/openclaw.plugin.json +1 -1
  138. package/package.json +3 -3
  139. package/server/index.js +3 -3
  140. package/skills/forge-openclaw/SKILL.md +5 -5
  141. package/dist/assets/index-ClJbJhca.css +0 -1
  142. package/dist/assets/psyche-modes-page-lQdpAcY3.js +0 -1
  143. /package/dist/server/{server → apps/api}/migrations/001_core.sql +0 -0
  144. /package/dist/server/{server → apps/api}/migrations/002_psyche.sql +0 -0
  145. /package/dist/server/{server → apps/api}/migrations/003_habits.sql +0 -0
  146. /package/dist/server/{server → apps/api}/migrations/004_habit_links.sql +0 -0
  147. /package/dist/server/{server → apps/api}/migrations/005_habit_psyche_links.sql +0 -0
  148. /package/dist/server/{server → apps/api}/migrations/006_work_adjustments.sql +0 -0
  149. /package/dist/server/{server → apps/api}/migrations/007_weekly_review_closures.sql +0 -0
  150. /package/dist/server/{server → apps/api}/migrations/008_calendar_execution.sql +0 -0
  151. /package/dist/server/{server → apps/api}/migrations/009_true_calendar_events.sql +0 -0
  152. /package/dist/server/{server → apps/api}/migrations/010_calendar_selection_state.sql +0 -0
  153. /package/dist/server/{server → apps/api}/migrations/011_calendar_timezone_backfill.sql +0 -0
  154. /package/dist/server/{server → apps/api}/migrations/012_work_block_ranges.sql +0 -0
  155. /package/dist/server/{server → apps/api}/migrations/013_microsoft_local_auth_settings.sql +0 -0
  156. /package/dist/server/{server → apps/api}/migrations/014_note_tags_and_ephemeral.sql +0 -0
  157. /package/dist/server/{server → apps/api}/migrations/015_multi_user_and_strategies.sql +0 -0
  158. /package/dist/server/{server → apps/api}/migrations/016_health_companion.sql +0 -0
  159. /package/dist/server/{server → apps/api}/migrations/016_strategy_contracts_and_user_graph.sql +0 -0
  160. /package/dist/server/{server → apps/api}/migrations/017_preferences.sql +0 -0
  161. /package/dist/server/{server → apps/api}/migrations/018_preference_catalogs.sql +0 -0
  162. /package/dist/server/{server → apps/api}/migrations/019_wiki_memory.sql +0 -0
  163. /package/dist/server/{server → apps/api}/migrations/020_wiki_page_hierarchy.sql +0 -0
  164. /package/dist/server/{server → apps/api}/migrations/021_hide_evidence_from_wiki_index.sql +0 -0
  165. /package/dist/server/{server → apps/api}/migrations/022_wiki_ingest_background.sql +0 -0
  166. /package/dist/server/{server → apps/api}/migrations/023_diagnostic_logs.sql +0 -0
  167. /package/dist/server/{server → apps/api}/migrations/024_questionnaires.sql +0 -0
  168. /package/dist/server/{server → apps/api}/migrations/025_ai_model_connections.sql +0 -0
  169. /package/dist/server/{server → apps/api}/migrations/026_custom_theme_settings.sql +0 -0
  170. /package/dist/server/{server → apps/api}/migrations/027_ai_processors.sql +0 -0
  171. /package/dist/server/{server → apps/api}/migrations/028_movement_domain.sql +0 -0
  172. /package/dist/server/{server → apps/api}/migrations/029_watch_micro_capture.sql +0 -0
  173. /package/dist/server/{server → apps/api}/migrations/030_surface_layouts.sql +0 -0
  174. /package/dist/server/{server → apps/api}/migrations/031_ai_processor_runtime_upgrades.sql +0 -0
  175. /package/dist/server/{server → apps/api}/migrations/032_ai_connectors.sql +0 -0
  176. /package/dist/server/{server → apps/api}/migrations/033_movement_trip_point_sync.sql +0 -0
  177. /package/dist/server/{server → apps/api}/migrations/034_movement_segment_sync.sql +0 -0
  178. /package/dist/server/{server → apps/api}/migrations/035_google_local_auth_settings.sql +0 -0
  179. /package/dist/server/{server → apps/api}/migrations/036_google_local_auth_client_secret.sql +0 -0
  180. /package/dist/server/{server → apps/api}/migrations/037_workbench_public_inputs_and_run_inputs.sql +0 -0
  181. /package/dist/server/{server → apps/api}/migrations/038_data_management_settings.sql +0 -0
  182. /package/dist/server/{server → apps/api}/migrations/039_life_force_and_action_points.sql +0 -0
  183. /package/dist/server/{server → apps/api}/migrations/040_screen_time_domain.sql +0 -0
  184. /package/dist/server/{server → apps/api}/migrations/041_companion_source_states.sql +0 -0
  185. /package/dist/server/{server → apps/api}/migrations/042_movement_boxes.sql +0 -0
  186. /package/dist/server/{server → apps/api}/migrations/043_movement_box_overlap_overrides.sql +0 -0
  187. /package/dist/server/{server → apps/api}/migrations/044_macos_local_calendar_provider.sql +0 -0
  188. /package/dist/server/{server → apps/api}/migrations/045_sleep_nights_and_raw_segments.sql +0 -0
  189. /package/dist/server/{server → apps/api}/migrations/046_work_item_hierarchy.sql +0 -0
  190. /package/dist/server/{server → apps/api}/migrations/047_sleep_source_records.sql +0 -0
  191. /package/dist/server/{server → apps/api}/migrations/048_task_run_git_context.sql +0 -0
  192. /package/dist/server/{server → apps/api}/migrations/049_agent_runtime_sessions.sql +0 -0
  193. /package/dist/server/{server → apps/api}/migrations/050_agent_token_bootstrap_policy.sql +0 -0
  194. /package/dist/server/{server → apps/api}/migrations/051_agent_token_scope_policy.sql +0 -0
  195. /package/dist/server/{server → apps/api}/migrations/052_agent_identity_tightening.sql +0 -0
  196. /package/dist/server/{server → apps/api}/migrations/053_agent_runtime_session_canonical_labels.sql +0 -0
  197. /package/dist/server/{server → apps/api}/migrations/054_sqlite_backed_wiki_memory.sql +0 -0
  198. /package/dist/server/{server → apps/api}/migrations/055_gamification_progression.sql +0 -0
  199. /package/dist/server/{server → apps/api}/migrations/056_gamification_equipment.sql +0 -0
  200. /package/dist/server/{server → apps/api}/migrations/057_gamification_catalog_cleanup.sql +0 -0
  201. /package/dist/server/{server → apps/api}/migrations/058_gamification_theme_preference.sql +0 -0
  202. /package/dist/server/{server → apps/api}/migrations/059_data_backup_retention.sql +0 -0
  203. /package/dist/server/{server → apps/api}/migrations/060_psyche_devrage_metrics.sql +0 -0
  204. /package/dist/server/{server → apps/api}/migrations/061_health_workout_raw_evidence.sql +0 -0
  205. /package/dist/server/{server → apps/api}/migrations/062_health_mobile_sync_sessions.sql +0 -0
  206. /package/dist/server/{server → apps/api}/migrations/063_psyche_flashcards.sql +0 -0
  207. /package/dist/server/{server → apps/api}/migrations/064_health_workout_time_series_identity.sql +0 -0
  208. /package/dist/server/{server → apps/api}/migrations/065_weight_loss_nutrition_insights.sql +0 -0
  209. /package/dist/server/{server → apps/api}/migrations/066_watch_action_receipts.sql +0 -0
  210. /package/dist/server/{server → apps/api}/migrations/067_weight_loss_daily_active_overrides.sql +0 -0
  211. /package/dist/server/{server → apps/api}/migrations/068_remove_generated_movement_wiki_logs.sql +0 -0
  212. /package/dist/server/{server → apps/api}/migrations/069_psyche_devrage_cumulative_rage.sql +0 -0
  213. /package/dist/server/{server → apps/api}/migrations/070_health_mobile_sync_completion_index.sql +0 -0
  214. /package/dist/server/{server → apps/api}/migrations/071_agent_runtime_claude_identity.sql +0 -0
  215. /package/dist/server/{server → apps/api}/src/data-management-types.js +0 -0
  216. /package/dist/server/{server → apps/api}/src/debug.js +0 -0
  217. /package/dist/server/{server → apps/api}/src/demo-data.js +0 -0
  218. /package/dist/server/{server → apps/api}/src/discovery-advertiser.js +0 -0
  219. /package/dist/server/{server → apps/api}/src/e2e-server.js +0 -0
  220. /package/dist/server/{server → apps/api}/src/errors.js +0 -0
  221. /package/dist/server/{server → apps/api}/src/health-workout-adapters.js +0 -0
  222. /package/dist/server/{server → apps/api}/src/health-workout-analytics.js +0 -0
  223. /package/dist/server/{server → apps/api}/src/health.js +0 -0
  224. /package/dist/server/{server → apps/api}/src/index.js +0 -0
  225. /package/dist/server/{server → apps/api}/src/managers/base.js +0 -0
  226. /package/dist/server/{server → apps/api}/src/managers/contracts.js +0 -0
  227. /package/dist/server/{server → apps/api}/src/managers/platform/api-gateway-manager.js +0 -0
  228. /package/dist/server/{server → apps/api}/src/managers/platform/audit-manager.js +0 -0
  229. /package/dist/server/{server → apps/api}/src/managers/platform/authentication-manager.js +0 -0
  230. /package/dist/server/{server → apps/api}/src/managers/platform/authorization-manager.js +0 -0
  231. /package/dist/server/{server → apps/api}/src/managers/platform/background-job-manager.js +0 -0
  232. /package/dist/server/{server → apps/api}/src/managers/platform/configuration-manager.js +0 -0
  233. /package/dist/server/{server → apps/api}/src/managers/platform/database-manager.js +0 -0
  234. /package/dist/server/{server → apps/api}/src/managers/platform/event-bus-manager.js +0 -0
  235. /package/dist/server/{server → apps/api}/src/managers/platform/external-service-manager.js +0 -0
  236. /package/dist/server/{server → apps/api}/src/managers/platform/health-manager.js +0 -0
  237. /package/dist/server/{server → apps/api}/src/managers/platform/llm-manager.js +0 -0
  238. /package/dist/server/{server → apps/api}/src/managers/platform/migration-manager.js +0 -0
  239. /package/dist/server/{server → apps/api}/src/managers/platform/mock-workbench-provider.js +0 -0
  240. /package/dist/server/{server → apps/api}/src/managers/platform/openai-responses-provider.js +0 -0
  241. /package/dist/server/{server → apps/api}/src/managers/platform/search-index-manager.js +0 -0
  242. /package/dist/server/{server → apps/api}/src/managers/platform/secrets-manager.js +0 -0
  243. /package/dist/server/{server → apps/api}/src/managers/platform/session-manager.js +0 -0
  244. /package/dist/server/{server → apps/api}/src/managers/platform/storage-manager.js +0 -0
  245. /package/dist/server/{server → apps/api}/src/managers/platform/token-manager.js +0 -0
  246. /package/dist/server/{server → apps/api}/src/managers/platform/transaction-manager.js +0 -0
  247. /package/dist/server/{server → apps/api}/src/managers/platform/trusted-network.js +0 -0
  248. /package/dist/server/{server → apps/api}/src/managers/runtime.js +0 -0
  249. /package/dist/server/{server → apps/api}/src/managers/type-guards.js +0 -0
  250. /package/dist/server/{server → apps/api}/src/movement.js +0 -0
  251. /package/dist/server/{server → apps/api}/src/openapi.js +0 -0
  252. /package/dist/server/{server → apps/api}/src/preferences-seeds.js +0 -0
  253. /package/dist/server/{server → apps/api}/src/preferences-types.js +0 -0
  254. /package/dist/server/{server → apps/api}/src/psyche-types.js +0 -0
  255. /package/dist/server/{server → apps/api}/src/questionnaire-flow.js +0 -0
  256. /package/dist/server/{server → apps/api}/src/questionnaire-types.js +0 -0
  257. /package/dist/server/{server → apps/api}/src/repositories/activity-events.js +0 -0
  258. /package/dist/server/{server → apps/api}/src/repositories/agent-runtime-sessions.js +0 -0
  259. /package/dist/server/{server → apps/api}/src/repositories/ai-processors.js +0 -0
  260. /package/dist/server/{server → apps/api}/src/repositories/calendar.js +0 -0
  261. /package/dist/server/{server → apps/api}/src/repositories/collaboration.js +0 -0
  262. /package/dist/server/{server → apps/api}/src/repositories/deleted-entities.js +0 -0
  263. /package/dist/server/{server → apps/api}/src/repositories/diagnostic-logs.js +0 -0
  264. /package/dist/server/{server → apps/api}/src/repositories/domains.js +0 -0
  265. /package/dist/server/{server → apps/api}/src/repositories/entity-ownership.js +0 -0
  266. /package/dist/server/{server → apps/api}/src/repositories/event-log.js +0 -0
  267. /package/dist/server/{server → apps/api}/src/repositories/gamification.js +0 -0
  268. /package/dist/server/{server → apps/api}/src/repositories/goals.js +0 -0
  269. /package/dist/server/{server → apps/api}/src/repositories/model-settings.js +0 -0
  270. /package/dist/server/{server → apps/api}/src/repositories/notes.js +0 -0
  271. /package/dist/server/{server → apps/api}/src/repositories/preferences.js +0 -0
  272. /package/dist/server/{server → apps/api}/src/repositories/projects.js +0 -0
  273. /package/dist/server/{server → apps/api}/src/repositories/psyche.js +0 -0
  274. /package/dist/server/{server → apps/api}/src/repositories/questionnaires.js +0 -0
  275. /package/dist/server/{server → apps/api}/src/repositories/rewards.js +0 -0
  276. /package/dist/server/{server → apps/api}/src/repositories/settings.js +0 -0
  277. /package/dist/server/{server → apps/api}/src/repositories/strategies.js +0 -0
  278. /package/dist/server/{server → apps/api}/src/repositories/surface-layouts.js +0 -0
  279. /package/dist/server/{server → apps/api}/src/repositories/tags.js +0 -0
  280. /package/dist/server/{server → apps/api}/src/repositories/task-runs.js +0 -0
  281. /package/dist/server/{server → apps/api}/src/repositories/tasks.js +0 -0
  282. /package/dist/server/{server → apps/api}/src/repositories/users.js +0 -0
  283. /package/dist/server/{server → apps/api}/src/repositories/weekly-reviews.js +0 -0
  284. /package/dist/server/{server → apps/api}/src/repositories/wiki-memory.js +0 -0
  285. /package/dist/server/{server → apps/api}/src/repositories/work-adjustments.js +0 -0
  286. /package/dist/server/{server → apps/api}/src/runtime-data-root.js +0 -0
  287. /package/dist/server/{server → apps/api}/src/screen-time.js +0 -0
  288. /package/dist/server/{server → apps/api}/src/seed-demo.js +0 -0
  289. /package/dist/server/{server → apps/api}/src/services/calendar-runtime.js +0 -0
  290. /package/dist/server/{server → apps/api}/src/services/context.js +0 -0
  291. /package/dist/server/{server → apps/api}/src/services/dashboard.js +0 -0
  292. /package/dist/server/{server → apps/api}/src/services/data-management.js +0 -0
  293. /package/dist/server/{server → apps/api}/src/services/devrage-scanner.js +0 -0
  294. /package/dist/server/{server → apps/api}/src/services/devrage.js +0 -0
  295. /package/dist/server/{server → apps/api}/src/services/entity-crud.js +0 -0
  296. /package/dist/server/{server → apps/api}/src/services/git-helper.js +0 -0
  297. /package/dist/server/{server → apps/api}/src/services/google-calendar-oauth-config.js +0 -0
  298. /package/dist/server/{server → apps/api}/src/services/insights.js +0 -0
  299. /package/dist/server/{server → apps/api}/src/services/legacy-wiki-markdown-import.js +0 -0
  300. /package/dist/server/{server → apps/api}/src/services/life-force-model.js +0 -0
  301. /package/dist/server/{server → apps/api}/src/services/life-force.js +0 -0
  302. /package/dist/server/{server → apps/api}/src/services/macos-calendar-helper.js +0 -0
  303. /package/dist/server/{server → apps/api}/src/services/openai-codex-oauth.js +0 -0
  304. /package/dist/server/{server → apps/api}/src/services/projects.js +0 -0
  305. /package/dist/server/{server → apps/api}/src/services/psyche-observation-calendar.js +0 -0
  306. /package/dist/server/{server → apps/api}/src/services/psyche.js +0 -0
  307. /package/dist/server/{server → apps/api}/src/services/relations.js +0 -0
  308. /package/dist/server/{server → apps/api}/src/services/reviews.js +0 -0
  309. /package/dist/server/{server → apps/api}/src/services/run-recovery.js +0 -0
  310. /package/dist/server/{server → apps/api}/src/services/tagging.js +0 -0
  311. /package/dist/server/{server → apps/api}/src/services/task-run-watchdog.js +0 -0
  312. /package/dist/server/{server → apps/api}/src/services/work-time.js +0 -0
  313. /package/dist/server/{server → apps/api}/src/web.js +0 -0
  314. /package/dist/server/{src → apps/web/src}/components/customization/utility-widgets.js +0 -0
  315. /package/dist/server/{src → apps/web/src}/components/ui/info-tooltip.js +0 -0
  316. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/calendar/calendar-boxes.js +0 -0
  317. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/goals/goals-boxes.js +0 -0
  318. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/habits/habits-boxes.js +0 -0
  319. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/health/health-boxes.js +0 -0
  320. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/insights/insights-boxes.js +0 -0
  321. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/kanban/kanban-boxes.js +0 -0
  322. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/movement/movement-boxes.js +0 -0
  323. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/notes/notes-boxes.js +0 -0
  324. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/overview/overview-boxes.js +0 -0
  325. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/preferences/preferences-boxes.js +0 -0
  326. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/projects/projects-boxes.js +0 -0
  327. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/psyche/psyche-boxes.js +0 -0
  328. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/questionnaires/questionnaires-boxes.js +0 -0
  329. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/review/review-boxes.js +0 -0
  330. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/shared/define-workbench-box.js +0 -0
  331. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/shared/generic-node-view.js +0 -0
  332. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/strategies/strategies-boxes.js +0 -0
  333. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/tasks/tasks-boxes.js +0 -0
  334. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/today/today-boxes.js +0 -0
  335. /package/dist/server/{src → apps/web/src}/components/workbench-boxes/wiki/wiki-boxes.js +0 -0
  336. /package/dist/server/{src → apps/web/src}/lib/api-error.js +0 -0
  337. /package/dist/server/{src → apps/web/src}/lib/api.js +0 -0
  338. /package/dist/server/{src → apps/web/src}/lib/calendar-name-deduper.js +0 -0
  339. /package/dist/server/{src → apps/web/src}/lib/data-management-types.js +0 -0
  340. /package/dist/server/{src → apps/web/src}/lib/date-keys.js +0 -0
  341. /package/dist/server/{src → apps/web/src}/lib/diagnostics.js +0 -0
  342. /package/dist/server/{src → apps/web/src}/lib/entity-visuals.js +0 -0
  343. /package/dist/server/{src → apps/web/src}/lib/gamification-catalog.js +0 -0
  344. /package/dist/server/{src → apps/web/src}/lib/knowledge-graph-types.js +0 -0
  345. /package/dist/server/{src → apps/web/src}/lib/knowledge-graph.js +0 -0
  346. /package/dist/server/{src → apps/web/src}/lib/psyche-schemas.js +0 -0
  347. /package/dist/server/{src → apps/web/src}/lib/psyche-types.js +0 -0
  348. /package/dist/server/{src → apps/web/src}/lib/questionnaire-types.js +0 -0
  349. /package/dist/server/{src → apps/web/src}/lib/runtime-paths.js +0 -0
  350. /package/dist/server/{src → apps/web/src}/lib/schemas.js +0 -0
  351. /package/dist/server/{src → apps/web/src}/lib/snapshot-normalizer.js +0 -0
  352. /package/dist/server/{src → apps/web/src}/lib/theme-system.js +0 -0
  353. /package/dist/server/{src → apps/web/src}/lib/types.js +0 -0
  354. /package/dist/server/{src → apps/web/src}/lib/utils.js +0 -0
  355. /package/dist/server/{src → apps/web/src}/lib/weight-loss-energy-model.js +0 -0
  356. /package/dist/server/{src → apps/web/src}/lib/weight-loss-types.js +0 -0
  357. /package/dist/server/{src → apps/web/src}/lib/workbench/boxes.js +0 -0
  358. /package/dist/server/{src → apps/web/src}/lib/workbench/contracts.js +0 -0
  359. /package/dist/server/{src → apps/web/src}/lib/workbench/nodes.js +0 -0
  360. /package/dist/server/{src → apps/web/src}/lib/workbench/registry.js +0 -0
  361. /package/dist/server/{src → apps/web/src}/lib/workbench/runtime.js +0 -0
  362. /package/dist/server/{src → apps/web/src}/lib/workbench/tool-catalog.js +0 -0
@@ -1,6 +1,6 @@
1
- import{r as m,j as e,aP as be,b7 as Ie,cN as he,aK as je,bV as Se,bD as Ce,cO as $e,bX as Ae}from"./vendor-BwL6m4SE.js";import{Q as Me,F as g,a as H}from"./question-flow-dialog-Ded2E85L.js";import{cd as Te,ce as Fe,B as ge,I as F,k as ye,u as We,b as xe,c as De,T as Q,a9 as Re,a8 as Pe,cf as Ge}from"./index-FpGANF9S.js";import{defaultGoalValues as Ee}from"./goal-dialog-15hD8EBp.js";import{I as He}from"./inline-note-fields-COgzxr_7.js";import{defaultProjectValues as ze}from"./project-dialog-CBA-D65n.js";import{U as Oe}from"./user-select-field-fx129Uh6.js";import{q as Be}from"./schemas-Db29G8NU.js";import{a as Le}from"./user-ownership-DJGl4rAj.js";import"./ui-B9TWEtCx.js";import"./motion-DcgUnXhY.js";import"./state-Bpe5dF3T.js";import"./board-CuxQRKPJ.js";import"./forms-D1qJ3oOP.js";import"./user-badge-ByhC6bMU.js";function le(t){return typeof t=="string"?t.trim():""}function Ue(t,d){const c=d.find(b=>b.refType===t.refType&&b.refValue===t.refValue&&b.repository===t.repository)??null;return{id:(c==null?void 0:c.id)??`draft-${t.refType}-${t.refValue.replace(/[^a-zA-Z0-9]+/g,"-")}`,workItemId:(c==null?void 0:c.workItemId)??"",refType:t.refType,provider:t.provider,repository:t.repository,refValue:t.refValue,url:t.url,displayTitle:t.displayTitle}}function Ke(t){return t==="branch"?be:t==="pull_request"?Ce:$e}function qe({selectedRefs:t,onChange:d}){const[c,b]=m.useState(null),[I,j]=m.useState(null),[s,i]=m.useState(!1),[C,z]=m.useState("branch"),[f,k]=m.useState(""),[w,v]=m.useState(""),[N,U]=m.useState([]),[V,Z]=m.useState([]),[u,D]=m.useState(!1),[S,A]=m.useState(null);m.useEffect(()=>{let o=!1;return i(!0),Te().then(h=>{o||(b(h.git),v(y=>y.trim().length>0?y:h.git.repository||y),j(null))}).catch(h=>{o||j(h instanceof Error?h.message:"Forge could not load git helper context.")}).finally(()=>{o||i(!1)}),()=>{o=!0}},[]),m.useEffect(()=>{let o=!1;return D(!0),Fe({kind:C,query:f,repository:w}).then(h=>{o||(U(h.git.refs),Z(h.git.warnings),A(null))}).catch(h=>{o||(A(h instanceof Error?h.message:"Forge could not search git refs right now."),U([]))}).finally(()=>{o||D(!1)}),()=>{o=!0}},[C,f,w]);const Y=m.useMemo(()=>{const o=le(c==null?void 0:c.currentBranch),h=le(w)||le(c==null?void 0:c.repository);return o?{key:`branch:${o}`,refType:"branch",provider:h?"github":"git",repository:h,refValue:o,url:h&&o?`https://github.com/${h}/tree/${encodeURIComponent(o)}`:null,displayTitle:o,subtitle:"Current local branch"}:null},[c==null?void 0:c.currentBranch,c==null?void 0:c.repository,w]),W=o=>{const h=Ue(o,t);t.some(y=>y.refType===h.refType&&y.refValue===h.refValue&&y.repository===h.repository)||d([...t,h])},p=o=>{d(t.filter(h=>h.id!==o.id))};return e.jsxs("div",{className:"grid gap-3 rounded-[20px] border border-white/8 bg-white/[0.03] p-4",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:"type-label text-white/45",children:"Git links"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:"Pick the live branch, commits, or pull requests from the local repo instead of typing raw hashes."})]}),Y?e.jsxs(ge,{type:"button",variant:"secondary",size:"sm",onClick:()=>W(Y),children:[e.jsx(be,{className:"size-4"}),"Use current branch"]}):null]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[10rem_minmax(0,1fr)]",children:[e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"type-label text-white/45",children:"Type"}),e.jsxs("select",{value:C,onChange:o=>z(o.target.value),className:"min-h-10 rounded-[var(--radius-control)] border border-white/10 bg-white/[0.04] px-3 py-2 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.3)]",children:[e.jsx("option",{value:"branch",children:"Branch"}),e.jsx("option",{value:"commit",children:"Commit"}),e.jsx("option",{value:"pull_request",children:"Pull request"})]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"type-label text-white/45",children:"Repository"}),e.jsx(F,{value:w,onChange:o=>v(o.target.value),placeholder:(c==null?void 0:c.repository)||"owner/repo"})]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"type-label text-white/45",children:"Search"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ie,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-white/32"}),e.jsx(F,{value:f,onChange:o=>k(o.target.value),placeholder:C==="branch"?"Search branches":C==="pull_request"?"Search pull requests":"Search commits",className:"pl-10"})]})]}),t.length>0?e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"type-label text-white/45",children:"Selected links"}),e.jsx("div",{className:"grid gap-2",children:t.map(o=>e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[16px] border border-white/8 bg-white/[0.04] px-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ye,{className:"bg-white/[0.08] text-white/72",children:o.refType.replaceAll("_"," ")}),e.jsx("div",{className:"truncate text-sm text-white/84",children:o.displayTitle||o.refValue})]}),e.jsx("div",{className:"mt-1 text-xs text-white/46",children:[o.repository,o.refValue].filter(Boolean).join(" · ")})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[o.url?e.jsx("a",{href:o.url,target:"_blank",rel:"noreferrer",className:"inline-flex size-8 items-center justify-center rounded-full text-white/55 transition hover:bg-white/[0.08] hover:text-white",children:e.jsx(he,{className:"size-4"})}):null,e.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-full text-white/55 transition hover:bg-white/[0.08] hover:text-white",onClick:()=>p(o),children:e.jsx(je,{className:"size-4"})})]})]},o.id))})]}):null,e.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-white/8 bg-white/[0.02] p-2",children:[s||u?e.jsxs("div",{className:"flex items-center gap-2 px-2 py-4 text-sm text-white/52",children:[e.jsx(Se,{className:"size-4 animate-spin"}),"Loading git suggestions…"]}):null,I?e.jsx("div",{className:"rounded-[14px] bg-rose-500/10 px-3 py-2 text-sm text-rose-200",children:I}):null,S?e.jsx("div",{className:"rounded-[14px] bg-rose-500/10 px-3 py-2 text-sm text-rose-200",children:S}):null,[...(c==null?void 0:c.warnings)??[],...V].filter(Boolean).slice(0,2).map(o=>e.jsx("div",{className:"rounded-[14px] bg-amber-400/10 px-3 py-2 text-sm text-amber-100",children:o},o)),!u&&!S&&N.length===0?e.jsx("div",{className:"px-2 py-4 text-sm text-white/45",children:"No matching git refs found."}):null,N.map(o=>{const h=Ke(C),y=t.some(M=>M.refType===o.refType&&M.refValue===o.refValue&&M.repository===o.repository);return e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[14px] px-2 py-2 transition hover:bg-white/[0.04]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-white/82",children:[e.jsx(h,{className:"size-4 shrink-0 text-[var(--primary)]"}),e.jsx("span",{className:"truncate",children:o.displayTitle||o.refValue})]}),e.jsx("div",{className:"mt-1 text-xs text-white/46",children:[o.repository,o.subtitle].filter(Boolean).join(" · ")})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[o.url?e.jsx("a",{href:o.url,target:"_blank",rel:"noreferrer",className:"inline-flex size-8 items-center justify-center rounded-full text-white/55 transition hover:bg-white/[0.08] hover:text-white",children:e.jsx(he,{className:"size-4"})}):null,e.jsx(ge,{type:"button",size:"sm",variant:"secondary",disabled:y,onClick:()=>W(o),children:y?"Added":"Add"})]})]},o.key)})]})]})}const X={title:"",description:"",level:"task",owner:"Albert",userId:null,assigneeUserIds:[],goalId:"",projectId:"",parentWorkItemId:null,priority:"medium",status:"focus",effort:"deep",energy:"steady",dueDate:"",points:60,plannedDurationSeconds:86400,actionCostBand:"standard",aiInstructions:"",executionMode:null,acceptanceCriteria:[],blockerLinks:[],completionReport:null,gitRefs:[],tagIds:[],notes:[]},_e=[];function Qe(t){return t.split(`
2
- `).map(d=>d.trim()).filter(d=>d.length>0)}function ie(t){return t.modifiedFiles.length===0&&t.workSummary.trim().length===0&&t.linkedGitRefIds.length===0?null:{modifiedFiles:t.modifiedFiles,workSummary:t.workSummary,linkedGitRefIds:t.linkedGitRefIds}}function Xe(t,d){return ie({modifiedFiles:(d==null?void 0:d.modifiedFiles)??[],workSummary:(d==null?void 0:d.workSummary)??"",linkedGitRefIds:t.map(c=>c.id).filter(c=>typeof c=="string")})}function $(t){return t.trim().toLowerCase()}function Ve(t){return t==="issue"?["goal","project"]:t==="task"?["goal","project","issue"]:["goal","project","task"]}function Ye(t){return t==="issue"?["goal","project"]:t==="task"?["goal","project","issue"]:["goal","project"]}function fe(t){return t==="task"?"task":t}function Ze(t){var v;const{editingTask:d,initialGoalId:c,initialLevel:b,initialParentWorkItemId:I,initialProjectId:j,defaultUserId:s,projects:i,users:C,workItems:z}=t;if(d)return at(d);const f=I?z.find(N=>N.id===I)??null:null,k=i.find(N=>N.id===((f==null?void 0:f.projectId)??j))??null,w=(k==null?void 0:k.userId)??s??null;return{...X,level:b??((f==null?void 0:f.level)==="issue"?"task":(f==null?void 0:f.level)==="task"?"subtask":X.level),owner:((v=C.find(N=>N.id===w))==null?void 0:v.displayName)??X.owner,userId:w,goalId:(f==null?void 0:f.goalId)??(k==null?void 0:k.goalId)??c??"",projectId:(k==null?void 0:k.id)??"",parentWorkItemId:(f==null?void 0:f.id)??null}}function Je(t){const{draft:d,goals:c,projects:b,workItems:I}=t,j=[];if(d.goalId){const s=c.find(i=>i.id===d.goalId);s&&j.push({id:`goal:${s.id}`,kind:"goal",mode:"existing",entityId:s.id,label:s.title,description:"Goal",searchText:$(`${s.title} ${s.description}`),goalId:s.id,projectId:null,parentWorkItemId:null})}if(d.projectId){const s=b.find(i=>i.id===d.projectId);s&&j.push({id:`project:${s.id}`,kind:"project",mode:"existing",entityId:s.id,label:s.title,description:"Project",searchText:$(`${s.title} ${s.description} ${s.goalTitle}`),goalId:s.goalId,projectId:s.id,parentWorkItemId:null})}if(d.parentWorkItemId){const s=I.find(i=>i.id===d.parentWorkItemId);s&&j.push({id:`${s.level}:${s.id}`,kind:s.level==="issue"?"issue":"task",mode:"existing",entityId:s.id,label:s.title,description:s.level==="issue"?"Issue":"Task",searchText:$(`${s.title} ${s.description} ${s.aiInstructions}`),goalId:s.goalId,projectId:s.projectId,parentWorkItemId:s.parentWorkItemId})}return j}function et(t){const{goals:d,projects:c,workItems:b,allowedKinds:I,editingTaskId:j}=t,s=[];return I.includes("goal")&&s.push(...d.map(i=>({id:`goal:${i.id}`,kind:"goal",mode:"existing",entityId:i.id,label:i.title,description:"Goal",searchText:$(`${i.title} ${i.description}`),goalId:i.id,projectId:null,parentWorkItemId:null}))),I.includes("project")&&s.push(...c.map(i=>({id:`project:${i.id}`,kind:"project",mode:"existing",entityId:i.id,label:i.title,description:`Project · ${i.goalTitle}`,searchText:$(`${i.title} ${i.description} ${i.goalTitle} ${i.productRequirementsDocument}`),goalId:i.goalId,projectId:i.id,parentWorkItemId:null}))),I.includes("issue")&&s.push(...b.filter(i=>i.level==="issue"&&i.id!==j).map(i=>({id:`issue:${i.id}`,kind:"issue",mode:"existing",entityId:i.id,label:i.title,description:"Issue",searchText:$(`${i.title} ${i.description} ${i.aiInstructions} ${i.executionMode??""}`),goalId:i.goalId,projectId:i.projectId,parentWorkItemId:null}))),I.includes("task")&&s.push(...b.filter(i=>i.level==="task"&&i.id!==j).map(i=>({id:`task:${i.id}`,kind:"task",mode:"existing",entityId:i.id,label:i.title,description:"Task",searchText:$(`${i.title} ${i.description} ${i.aiInstructions} ${i.executionMode??""}`),goalId:i.goalId,projectId:i.projectId,parentWorkItemId:i.parentWorkItemId}))),s}function tt(t,d,c){if(d.kind==="goal"){const b=t.projectId?c.find(j=>j.projectId===t.projectId)??null:null,I=!t.projectId||(b==null?void 0:b.goalId)===d.entityId||d.goalId===t.goalId;return{goalId:d.entityId,projectId:I?t.projectId:"",parentWorkItemId:I?t.parentWorkItemId:null}}if(d.kind==="project"){const b=t.parentWorkItemId?c.find(I=>I.id===t.parentWorkItemId)??null:null;return{goalId:d.goalId??t.goalId,projectId:d.entityId,parentWorkItemId:!b||b.projectId===d.entityId?t.parentWorkItemId:null}}return{goalId:d.goalId??t.goalId,projectId:d.projectId??t.projectId,parentWorkItemId:d.entityId}}function rt(t){return t==="goal"?{goalId:"",projectId:"",parentWorkItemId:null}:t==="project"?{projectId:"",parentWorkItemId:null}:{parentWorkItemId:null}}function at(t){var d;return{title:t.title,description:t.description,level:t.level,owner:t.owner,userId:t.userId??null,assigneeUserIds:t.assigneeUserIds??[],goalId:t.goalId??"",projectId:t.projectId??"",parentWorkItemId:t.parentWorkItemId??null,priority:t.priority,status:t.status,effort:t.effort,energy:t.energy,dueDate:t.dueDate??"",points:t.points,plannedDurationSeconds:t.plannedDurationSeconds??86400,actionCostBand:((d=t.actionPointSummary)==null?void 0:d.costBand)??"standard",aiInstructions:t.aiInstructions,executionMode:t.executionMode,acceptanceCriteria:t.acceptanceCriteria,blockerLinks:t.blockerLinks,completionReport:t.completionReport,gitRefs:t.gitRefs,tagIds:t.tagIds,notes:[]}}function jt({open:t,goals:d,projects:c,workItems:b,tags:I,users:j,editingTask:s,initialProjectId:i,initialGoalId:C,initialParentWorkItemId:z,initialLevel:f,initialStepId:k,defaultUserId:w=null,onRefreshEntities:v,currentCreditedSeconds:N,onOpenChange:U,onAdjustTrackedTime:V,onSubmit:Z}){const{t:u}=We(),D=d??[],S=c??[],A=b??_e,Y=I??[],W=j??[],[p,o]=m.useState(X),[h,y]=m.useState(null),[M,J]=m.useState({}),[R,ee]=m.useState(""),[ve,P]=m.useState(!1),[te,O]=m.useState(0),[oe,G]=m.useState(null),[st,re]=m.useState(null),[ae,ne]=m.useState(0),ke=a=>{J(Object.fromEntries(Object.entries(a).map(([n,r])=>[n,r==null?void 0:r[0]])))};m.useEffect(()=>{t&&(y(null),J({}),ee(""),P(!1),O(0),G(null),re(null),ne(s?Math.max(0,Math.floor((N??s.time.totalCreditedSeconds)/60)):0),o(Ze({editingTask:s,initialGoalId:C,initialLevel:f,initialParentWorkItemId:z,initialProjectId:i,defaultUserId:w,projects:S,users:W,workItems:A})))},[w,s,C,f,z,i,t,S,W,A,N]);const de=s?Math.max(0,Math.floor((N??s.time.totalCreditedSeconds)/60)):0,B=s?ae-de:0,T=m.useMemo(()=>S.find(a=>a.id===p.projectId)??null,[p.projectId,S]),ce=m.useMemo(()=>Ve(p.level),[p.level]),ue=m.useMemo(()=>Ye(p.level),[p.level]),K=m.useMemo(()=>Je({draft:p,goals:D,projects:S,workItems:A}),[p,D,S,A]),se=m.useMemo(()=>et({goals:D,projects:S,workItems:A,allowedKinds:ce,editingTaskId:s==null?void 0:s.id}),[ce,s==null?void 0:s.id,D,S,A]),L=m.useMemo(()=>{const a=$(R),n=a.length===0?se.slice(0,8):se.filter(l=>l.searchText.includes(a)).slice(0,8);if(a.length===0)return n;const r=ue.map(l=>l==="project"&&!p.goalId?{id:`create:${l}:${a}`,kind:l,mode:"create",label:R.trim(),description:"Pick or create a goal first, then create a project here.",disabled:!0,disabledReason:"Pick or create a goal first."}:l==="issue"&&!p.projectId?{id:`create:${l}:${a}`,kind:l,mode:"create",label:R.trim(),description:"Pick or create a project first, then create an issue here.",disabled:!0,disabledReason:"Pick or create a project first."}:{id:`create:${l}:${a}`,kind:l,mode:"create",label:R.trim(),description:`Create a new ${l} from "${R.trim()}".`});return[...n,...r]},[R,se,ue,p.goalId,p.projectId]),we=W.find(a=>a.id===((T==null?void 0:T.userId)??w))??null;m.useEffect(()=>{T&&p.goalId!==T.goalId&&o(a=>({...a,goalId:T.goalId}))},[p.goalId,T]);const q=a=>{o(n=>({...n,...tt(n,a,A)})),ee(""),G(null),O(0),P(!1)},me=a=>{o(n=>({...n,...rt(a)})),G(null)},pe=async a=>{if(a.disabled){G(a.disabledReason??a.description);return}const n=a.label.trim();if(n){re(a.id),G(null);try{if(a.kind==="goal"){const r=await Re({...Ee,title:n,userId:p.userId??null});await(v==null?void 0:v()),q({id:`goal:${r.goal.id}`,kind:"goal",mode:"existing",entityId:r.goal.id,label:r.goal.title,description:"Goal",searchText:$(`${r.goal.title} ${r.goal.description}`),goalId:r.goal.id,projectId:null,parentWorkItemId:null});return}if(a.kind==="project"){if(!p.goalId)throw new Error("Pick or create a goal first.");const r=await Pe({...ze,goalId:p.goalId,title:n,userId:p.userId??null,assigneeUserIds:p.assigneeUserIds});await(v==null?void 0:v()),q({id:`project:${r.project.id}`,kind:"project",mode:"existing",entityId:r.project.id,label:r.project.title,description:"Project",searchText:$(`${r.project.title} ${r.project.description}`),goalId:r.project.goalId,projectId:r.project.id,parentWorkItemId:null});return}if(a.kind==="issue"){if(!p.projectId)throw new Error("Pick or create a project first.");const r=await Ge({...X,level:"issue",title:n,owner:p.owner,userId:p.userId??null,assigneeUserIds:p.assigneeUserIds,goalId:p.goalId,projectId:p.projectId,executionMode:"afk"});await(v==null?void 0:v()),q({id:`issue:${r.workItem.id}`,kind:"issue",mode:"existing",entityId:r.workItem.id,label:r.workItem.title,description:"Issue",searchText:$(`${r.workItem.title} ${r.workItem.description}`),goalId:r.workItem.goalId,projectId:r.workItem.projectId,parentWorkItemId:null})}}catch(r){G(r instanceof Error?r.message:"Unable to create that linked entity right now.")}finally{re(null)}}},Ne=[{id:"anchor",eyebrow:"Placement",title:"Choose where this work belongs",description:"Anchor the work through the hierarchy. Tasks can carry a goal, project, and issue parent together so the chain of meaning stays explicit.",render:(a,n)=>{var r;return e.jsxs(e.Fragment,{children:[e.jsx(g,{label:"Hierarchy anchors",labelHelp:"Pick the goal and project anchors, then choose the real parent where needed. Tasks can live under issues, subtasks under tasks.",error:M.projectId??null,children:e.jsx("div",{className:"grid gap-3",children:e.jsxs("div",{className:"rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[K.length>0?e.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:K.map(l=>e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-2.5 py-1.5",children:[e.jsx(xe,{kind:fe(l.kind),label:l.label,compact:!0,gradient:!1,className:"max-w-[16rem]"}),e.jsx("button",{type:"button",className:"rounded-full text-[var(--ui-ink-soft)] transition hover:text-[var(--ui-ink-strong)]",onClick:()=>me(l.kind),"aria-label":`Remove ${l.label}`,children:e.jsx(je,{className:"size-3.5"})})]},l.id))}):null,e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-3 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsx(Ie,{className:"size-4 text-[var(--ui-ink-faint)]"}),e.jsx("input",{value:R,onChange:l=>{ee(l.target.value),P(!0),O(0),G(null)},onFocus:()=>P(!0),onBlur:()=>{window.setTimeout(()=>P(!1),120)},onKeyDown:l=>{if(l.key==="Backspace"&&!R&&K.length>0){me(K[K.length-1].kind);return}if(l.key==="ArrowDown"){l.preventDefault(),P(!0),O(x=>L.length===0?0:Math.min(L.length-1,x+1));return}if(l.key==="ArrowUp"){l.preventDefault(),O(x=>Math.max(0,x-1));return}if(l.key==="Escape"){P(!1);return}if(l.key==="Enter"&&L[te]){l.preventDefault();const x=L[te];x.mode==="existing"?q(x):pe(x)}},placeholder:'Search or create Goal, Project, or parent Issue like Goal + "Creative system"',className:"min-w-0 flex-1 bg-transparent text-sm text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-faint)] focus:outline-none"})]}),ve?e.jsx("div",{className:"absolute top-full z-20 mt-2 w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] p-2 shadow-[var(--ui-shadow-floating)] backdrop-blur-xl",children:L.length>0?L.map((l,x)=>e.jsxs("button",{type:"button",disabled:l.mode==="create"&&l.disabled,className:De("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",x===te?"bg-[var(--ui-surface-active)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]",l.mode==="create"&&l.disabled&&"cursor-not-allowed opacity-45"),onMouseEnter:()=>O(x),onMouseDown:E=>E.preventDefault(),onClick:()=>{if(l.mode==="existing"){q(l);return}pe(l)},children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(xe,{kind:fe(l.kind),label:l.mode==="create"?`Create ${l.kind}`:l.label,compact:!0,gradient:!1}),l.mode==="create"?e.jsxs(ye,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:['"',l.label,'"']}):null]}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-[var(--ui-ink-faint)]",children:l.description})]}),l.mode==="create"?e.jsx("span",{className:"rounded-full bg-[var(--primary)]/12 p-2 text-[var(--primary)]",children:e.jsx(Ae,{className:"size-3.5"})}):null]},l.id)):e.jsx("div",{className:"px-3 py-2.5 text-sm text-[var(--ui-ink-faint)]",children:"Type to find an existing anchor or create a new one."})}):null]}),oe?e.jsx("div",{className:"mt-3 rounded-[16px] border border-[color-mix(in_srgb,var(--danger)_22%,transparent)] bg-[var(--ui-danger-soft)] px-3 py-2 text-sm text-[var(--danger)]",children:oe}):null]})})}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsx(g,{label:"Resolved project",children:e.jsx(F,{readOnly:!0,value:(T==null?void 0:T.title)??"",placeholder:"Select or create a project anchor"})}),e.jsx(g,{label:"Resolved goal",children:e.jsx(F,{readOnly:!0,value:((r=D.find(l=>l.id===a.goalId))==null?void 0:r.title)??"",placeholder:"Select or create a goal anchor"})})]})]})}},{id:"shape",eyebrow:"Shape",title:"Define the next concrete move",description:"Keep the task small enough to be actionable and strong enough to clearly move the project forward.",render:(a,n)=>e.jsxs(e.Fragment,{children:[e.jsx(g,{label:"Hierarchy level",error:M.level??null,children:e.jsx(H,{value:a.level,onChange:r=>n({level:r}),options:[{value:"issue",label:"Issue",description:"Vertical slice with AFK or HITL execution mode."},{value:"task",label:"Task",description:"One focused AI session with direct instructions."},{value:"subtask",label:"Subtask",description:"A lightweight child step under a task."}]})}),e.jsx(g,{label:u("common.dialogs.task.title"),error:M.title??null,children:e.jsx(F,{value:a.title,onChange:r=>n({title:r.target.value}),placeholder:"Draft the first mode atlas sketch"})}),e.jsx(g,{label:u("common.dialogs.task.descriptionLabel"),children:e.jsx(Q,{value:a.description,onChange:r=>n({description:r.target.value}),placeholder:"Write the task description in Markdown. Keep it short or turn it into a full acceptance doc."})}),a.level==="issue"||a.level==="task"?e.jsxs(e.Fragment,{children:[e.jsx(g,{label:"Execution mode",children:e.jsx(H,{value:a.executionMode??"afk",onChange:r=>n({executionMode:r}),options:[{value:"afk",label:"AFK",description:"AI can complete the issue flow without waiting on a human decision."},{value:"hitl",label:"HITL",description:"A human decision is required somewhere in the slice."}]})}),e.jsx(g,{label:"Acceptance criteria",children:e.jsx(Q,{value:a.acceptanceCriteria.join(`
1
+ import{r as p,j as e,aP as be,b7 as Ie,cN as he,aK as je,bV as Se,bD as Ce,cO as $e,bX as Ae}from"./vendor-BwL6m4SE.js";import{Q as Me,F as g,a as H}from"./question-flow-dialog-D-_EvoAt.js";import{cd as Te,ce as Fe,B as ge,I as F,k as ye,u as We,b as xe,c as De,T as Q,a9 as Re,a8 as Pe,cf as Ge}from"./index-izRKx6JK.js";import{defaultGoalValues as Ee}from"./goal-dialog-DH50D0tP.js";import{I as He}from"./inline-note-fields-D4mCM1gO.js";import{defaultProjectValues as ze}from"./project-dialog-B_J1ESMk.js";import{U as Oe}from"./user-select-field-fx129Uh6.js";import{q as Be}from"./schemas-B0Pa-V-A.js";import{a as Le}from"./user-ownership-DJGl4rAj.js";import"./ui-B9TWEtCx.js";import"./motion-DcgUnXhY.js";import"./state-Bpe5dF3T.js";import"./board-CuxQRKPJ.js";import"./forms-D1qJ3oOP.js";import"./user-badge-MEZuJiir.js";function le(t){return typeof t=="string"?t.trim():""}function Ue(t,d){const c=d.find(b=>b.refType===t.refType&&b.refValue===t.refValue&&b.repository===t.repository)??null;return{id:(c==null?void 0:c.id)??`draft-${t.refType}-${t.refValue.replace(/[^a-zA-Z0-9]+/g,"-")}`,workItemId:(c==null?void 0:c.workItemId)??"",refType:t.refType,provider:t.provider,repository:t.repository,refValue:t.refValue,url:t.url,displayTitle:t.displayTitle}}function Ke(t){return t==="branch"?be:t==="pull_request"?Ce:$e}function qe({selectedRefs:t,onChange:d}){const[c,b]=p.useState(null),[I,j]=p.useState(null),[s,i]=p.useState(!1),[C,z]=p.useState("branch"),[f,k]=p.useState(""),[w,v]=p.useState(""),[N,U]=p.useState([]),[V,Z]=p.useState([]),[u,D]=p.useState(!1),[S,A]=p.useState(null);p.useEffect(()=>{let o=!1;return i(!0),Te().then(h=>{o||(b(h.git),v(y=>y.trim().length>0?y:h.git.repository||y),j(null))}).catch(h=>{o||j(h instanceof Error?h.message:"Forge could not load git helper context.")}).finally(()=>{o||i(!1)}),()=>{o=!0}},[]),p.useEffect(()=>{let o=!1;return D(!0),Fe({kind:C,query:f,repository:w}).then(h=>{o||(U(h.git.refs),Z(h.git.warnings),A(null))}).catch(h=>{o||(A(h instanceof Error?h.message:"Forge could not search git refs right now."),U([]))}).finally(()=>{o||D(!1)}),()=>{o=!0}},[C,f,w]);const Y=p.useMemo(()=>{const o=le(c==null?void 0:c.currentBranch),h=le(w)||le(c==null?void 0:c.repository);return o?{key:`branch:${o}`,refType:"branch",provider:h?"github":"git",repository:h,refValue:o,url:h&&o?`https://github.com/${h}/tree/${encodeURIComponent(o)}`:null,displayTitle:o,subtitle:"Current local branch"}:null},[c==null?void 0:c.currentBranch,c==null?void 0:c.repository,w]),W=o=>{const h=Ue(o,t);t.some(y=>y.refType===h.refType&&y.refValue===h.refValue&&y.repository===h.repository)||d([...t,h])},m=o=>{d(t.filter(h=>h.id!==o.id))};return e.jsxs("div",{className:"grid gap-3 rounded-[20px] border border-white/8 bg-white/[0.03] p-4",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:"type-label text-white/45",children:"Git links"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-white/58",children:"Pick the live branch, commits, or pull requests from the local repo instead of typing raw hashes."})]}),Y?e.jsxs(ge,{type:"button",variant:"secondary",size:"sm",onClick:()=>W(Y),children:[e.jsx(be,{className:"size-4"}),"Use current branch"]}):null]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[10rem_minmax(0,1fr)]",children:[e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"type-label text-white/45",children:"Type"}),e.jsxs("select",{value:C,onChange:o=>z(o.target.value),className:"min-h-10 rounded-[var(--radius-control)] border border-white/10 bg-white/[0.04] px-3 py-2 text-sm text-white outline-none transition focus:border-[rgba(192,193,255,0.3)]",children:[e.jsx("option",{value:"branch",children:"Branch"}),e.jsx("option",{value:"commit",children:"Commit"}),e.jsx("option",{value:"pull_request",children:"Pull request"})]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"type-label text-white/45",children:"Repository"}),e.jsx(F,{value:w,onChange:o=>v(o.target.value),placeholder:(c==null?void 0:c.repository)||"owner/repo"})]})]}),e.jsxs("label",{className:"grid gap-2",children:[e.jsx("span",{className:"type-label text-white/45",children:"Search"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ie,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-white/32"}),e.jsx(F,{value:f,onChange:o=>k(o.target.value),placeholder:C==="branch"?"Search branches":C==="pull_request"?"Search pull requests":"Search commits",className:"pl-10"})]})]}),t.length>0?e.jsxs("div",{className:"grid gap-2",children:[e.jsx("div",{className:"type-label text-white/45",children:"Selected links"}),e.jsx("div",{className:"grid gap-2",children:t.map(o=>e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[16px] border border-white/8 bg-white/[0.04] px-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ye,{className:"bg-white/[0.08] text-white/72",children:o.refType.replaceAll("_"," ")}),e.jsx("div",{className:"truncate text-sm text-white/84",children:o.displayTitle||o.refValue})]}),e.jsx("div",{className:"mt-1 text-xs text-white/46",children:[o.repository,o.refValue].filter(Boolean).join(" · ")})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[o.url?e.jsx("a",{href:o.url,target:"_blank",rel:"noreferrer",className:"inline-flex size-8 items-center justify-center rounded-full text-white/55 transition hover:bg-white/[0.08] hover:text-white",children:e.jsx(he,{className:"size-4"})}):null,e.jsx("button",{type:"button",className:"inline-flex size-8 items-center justify-center rounded-full text-white/55 transition hover:bg-white/[0.08] hover:text-white",onClick:()=>m(o),children:e.jsx(je,{className:"size-4"})})]})]},o.id))})]}):null,e.jsxs("div",{className:"grid gap-2 rounded-[16px] border border-white/8 bg-white/[0.02] p-2",children:[s||u?e.jsxs("div",{className:"flex items-center gap-2 px-2 py-4 text-sm text-white/52",children:[e.jsx(Se,{className:"size-4 animate-spin"}),"Loading git suggestions…"]}):null,I?e.jsx("div",{className:"rounded-[14px] bg-rose-500/10 px-3 py-2 text-sm text-rose-200",children:I}):null,S?e.jsx("div",{className:"rounded-[14px] bg-rose-500/10 px-3 py-2 text-sm text-rose-200",children:S}):null,[...(c==null?void 0:c.warnings)??[],...V].filter(Boolean).slice(0,2).map(o=>e.jsx("div",{className:"rounded-[14px] bg-amber-400/10 px-3 py-2 text-sm text-amber-100",children:o},o)),!u&&!S&&N.length===0?e.jsx("div",{className:"px-2 py-4 text-sm text-white/45",children:"No matching git refs found."}):null,N.map(o=>{const h=Ke(C),y=t.some(M=>M.refType===o.refType&&M.refValue===o.refValue&&M.repository===o.repository);return e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[14px] px-2 py-2 transition hover:bg-white/[0.04]",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-white/82",children:[e.jsx(h,{className:"size-4 shrink-0 text-[var(--primary)]"}),e.jsx("span",{className:"truncate",children:o.displayTitle||o.refValue})]}),e.jsx("div",{className:"mt-1 text-xs text-white/46",children:[o.repository,o.subtitle].filter(Boolean).join(" · ")})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[o.url?e.jsx("a",{href:o.url,target:"_blank",rel:"noreferrer",className:"inline-flex size-8 items-center justify-center rounded-full text-white/55 transition hover:bg-white/[0.08] hover:text-white",children:e.jsx(he,{className:"size-4"})}):null,e.jsx(ge,{type:"button",size:"sm",variant:"secondary",disabled:y,onClick:()=>W(o),children:y?"Added":"Add"})]})]},o.key)})]})]})}const X={title:"",description:"",level:"task",owner:"Albert",userId:null,assigneeUserIds:[],goalId:"",projectId:"",parentWorkItemId:null,priority:"medium",status:"focus",effort:"deep",energy:"steady",dueDate:"",points:60,plannedDurationSeconds:86400,actionCostBand:"standard",aiInstructions:"",executionMode:null,acceptanceCriteria:[],blockerLinks:[],completionReport:null,gitRefs:[],tagIds:[],notes:[]},_e=[];function Qe(t){return t.split(`
2
+ `).map(d=>d.trim()).filter(d=>d.length>0)}function ie(t){return t.modifiedFiles.length===0&&t.workSummary.trim().length===0&&t.linkedGitRefIds.length===0?null:{modifiedFiles:t.modifiedFiles,workSummary:t.workSummary,linkedGitRefIds:t.linkedGitRefIds}}function Xe(t,d){return ie({modifiedFiles:(d==null?void 0:d.modifiedFiles)??[],workSummary:(d==null?void 0:d.workSummary)??"",linkedGitRefIds:t.map(c=>c.id).filter(c=>typeof c=="string")})}function $(t){return t.trim().toLowerCase()}function Ve(t){return t==="issue"?["goal","project"]:t==="task"?["goal","project","issue"]:["goal","project","task"]}function Ye(t){return t==="issue"?["goal","project"]:t==="task"?["goal","project","issue"]:["goal","project"]}function fe(t){return t==="task"?"task":t}function Ze(t){var v;const{editingTask:d,initialGoalId:c,initialLevel:b,initialParentWorkItemId:I,initialProjectId:j,defaultUserId:s,projects:i,users:C,workItems:z}=t;if(d)return at(d);const f=I?z.find(N=>N.id===I)??null:null,k=i.find(N=>N.id===((f==null?void 0:f.projectId)??j))??null,w=(k==null?void 0:k.userId)??s??null;return{...X,level:b??((f==null?void 0:f.level)==="issue"?"task":(f==null?void 0:f.level)==="task"?"subtask":X.level),owner:((v=C.find(N=>N.id===w))==null?void 0:v.displayName)??X.owner,userId:w,goalId:(f==null?void 0:f.goalId)??(k==null?void 0:k.goalId)??c??"",projectId:(k==null?void 0:k.id)??"",parentWorkItemId:(f==null?void 0:f.id)??null}}function Je(t){const{draft:d,goals:c,projects:b,workItems:I}=t,j=[];if(d.goalId){const s=c.find(i=>i.id===d.goalId);s&&j.push({id:`goal:${s.id}`,kind:"goal",mode:"existing",entityId:s.id,label:s.title,description:"Goal",searchText:$(`${s.title} ${s.description}`),goalId:s.id,projectId:null,parentWorkItemId:null})}if(d.projectId){const s=b.find(i=>i.id===d.projectId);s&&j.push({id:`project:${s.id}`,kind:"project",mode:"existing",entityId:s.id,label:s.title,description:"Project",searchText:$(`${s.title} ${s.description} ${s.goalTitle}`),goalId:s.goalId,projectId:s.id,parentWorkItemId:null})}if(d.parentWorkItemId){const s=I.find(i=>i.id===d.parentWorkItemId);s&&j.push({id:`${s.level}:${s.id}`,kind:s.level==="issue"?"issue":"task",mode:"existing",entityId:s.id,label:s.title,description:s.level==="issue"?"Issue":"Task",searchText:$(`${s.title} ${s.description} ${s.aiInstructions}`),goalId:s.goalId,projectId:s.projectId,parentWorkItemId:s.parentWorkItemId})}return j}function et(t){const{goals:d,projects:c,workItems:b,allowedKinds:I,editingTaskId:j}=t,s=[];return I.includes("goal")&&s.push(...d.map(i=>({id:`goal:${i.id}`,kind:"goal",mode:"existing",entityId:i.id,label:i.title,description:"Goal",searchText:$(`${i.title} ${i.description}`),goalId:i.id,projectId:null,parentWorkItemId:null}))),I.includes("project")&&s.push(...c.map(i=>({id:`project:${i.id}`,kind:"project",mode:"existing",entityId:i.id,label:i.title,description:`Project · ${i.goalTitle}`,searchText:$(`${i.title} ${i.description} ${i.goalTitle} ${i.productRequirementsDocument}`),goalId:i.goalId,projectId:i.id,parentWorkItemId:null}))),I.includes("issue")&&s.push(...b.filter(i=>i.level==="issue"&&i.id!==j).map(i=>({id:`issue:${i.id}`,kind:"issue",mode:"existing",entityId:i.id,label:i.title,description:"Issue",searchText:$(`${i.title} ${i.description} ${i.aiInstructions} ${i.executionMode??""}`),goalId:i.goalId,projectId:i.projectId,parentWorkItemId:null}))),I.includes("task")&&s.push(...b.filter(i=>i.level==="task"&&i.id!==j).map(i=>({id:`task:${i.id}`,kind:"task",mode:"existing",entityId:i.id,label:i.title,description:"Task",searchText:$(`${i.title} ${i.description} ${i.aiInstructions} ${i.executionMode??""}`),goalId:i.goalId,projectId:i.projectId,parentWorkItemId:i.parentWorkItemId}))),s}function tt(t,d,c){if(d.kind==="goal"){const b=t.projectId?c.find(j=>j.projectId===t.projectId)??null:null,I=!t.projectId||(b==null?void 0:b.goalId)===d.entityId||d.goalId===t.goalId;return{goalId:d.entityId,projectId:I?t.projectId:"",parentWorkItemId:I?t.parentWorkItemId:null}}if(d.kind==="project"){const b=t.parentWorkItemId?c.find(I=>I.id===t.parentWorkItemId)??null:null;return{goalId:d.goalId??t.goalId,projectId:d.entityId,parentWorkItemId:!b||b.projectId===d.entityId?t.parentWorkItemId:null}}return{goalId:d.goalId??t.goalId,projectId:d.projectId??t.projectId,parentWorkItemId:d.entityId}}function rt(t){return t==="goal"?{goalId:"",projectId:"",parentWorkItemId:null}:t==="project"?{projectId:"",parentWorkItemId:null}:{parentWorkItemId:null}}function at(t){var d;return{title:t.title,description:t.description,level:t.level,owner:t.owner,userId:t.userId??null,assigneeUserIds:t.assigneeUserIds??[],goalId:t.goalId??"",projectId:t.projectId??"",parentWorkItemId:t.parentWorkItemId??null,priority:t.priority,status:t.status,effort:t.effort,energy:t.energy,dueDate:t.dueDate??"",points:t.points,plannedDurationSeconds:t.plannedDurationSeconds??86400,actionCostBand:((d=t.actionPointSummary)==null?void 0:d.costBand)??"standard",aiInstructions:t.aiInstructions,executionMode:t.executionMode,acceptanceCriteria:t.acceptanceCriteria,blockerLinks:t.blockerLinks,completionReport:t.completionReport,gitRefs:t.gitRefs,tagIds:t.tagIds,notes:[]}}function jt({open:t,goals:d,projects:c,workItems:b,tags:I,users:j,editingTask:s,initialProjectId:i,initialGoalId:C,initialParentWorkItemId:z,initialLevel:f,initialStepId:k,defaultUserId:w=null,onRefreshEntities:v,currentCreditedSeconds:N,onOpenChange:U,onAdjustTrackedTime:V,onSubmit:Z}){const{t:u}=We(),D=d??[],S=c??[],A=b??_e,Y=I??[],W=j??[],[m,o]=p.useState(X),[h,y]=p.useState(null),[M,J]=p.useState({}),[R,ee]=p.useState(""),[ve,P]=p.useState(!1),[te,O]=p.useState(0),[oe,G]=p.useState(null),[st,re]=p.useState(null),[ae,ne]=p.useState(0),ke=a=>{J(Object.fromEntries(Object.entries(a).map(([n,r])=>[n,r==null?void 0:r[0]])))};p.useEffect(()=>{t&&(y(null),J({}),ee(""),P(!1),O(0),G(null),re(null),ne(s?Math.max(0,Math.floor((N??s.time.totalCreditedSeconds)/60)):0),o(Ze({editingTask:s,initialGoalId:C,initialLevel:f,initialParentWorkItemId:z,initialProjectId:i,defaultUserId:w,projects:S,users:W,workItems:A})))},[w,s,C,f,z,i,t,S,W,A,N]);const de=s?Math.max(0,Math.floor((N??s.time.totalCreditedSeconds)/60)):0,B=s?ae-de:0,T=p.useMemo(()=>S.find(a=>a.id===m.projectId)??null,[m.projectId,S]),ce=p.useMemo(()=>Ve(m.level),[m.level]),ue=p.useMemo(()=>Ye(m.level),[m.level]),K=p.useMemo(()=>Je({draft:m,goals:D,projects:S,workItems:A}),[m,D,S,A]),se=p.useMemo(()=>et({goals:D,projects:S,workItems:A,allowedKinds:ce,editingTaskId:s==null?void 0:s.id}),[ce,s==null?void 0:s.id,D,S,A]),L=p.useMemo(()=>{const a=$(R),n=a.length===0?se.slice(0,8):se.filter(l=>l.searchText.includes(a)).slice(0,8);if(a.length===0)return n;const r=ue.map(l=>l==="project"&&!m.goalId?{id:`create:${l}:${a}`,kind:l,mode:"create",label:R.trim(),description:"Pick or create a goal first, then create a project here.",disabled:!0,disabledReason:"Pick or create a goal first."}:l==="issue"&&!m.projectId?{id:`create:${l}:${a}`,kind:l,mode:"create",label:R.trim(),description:"Pick or create a project first, then create an issue here.",disabled:!0,disabledReason:"Pick or create a project first."}:{id:`create:${l}:${a}`,kind:l,mode:"create",label:R.trim(),description:`Create a new ${l} from "${R.trim()}".`});return[...n,...r]},[R,se,ue,m.goalId,m.projectId]),we=W.find(a=>a.id===((T==null?void 0:T.userId)??w))??null;p.useEffect(()=>{T&&m.goalId!==T.goalId&&o(a=>({...a,goalId:T.goalId}))},[m.goalId,T]);const q=a=>{o(n=>({...n,...tt(n,a,A)})),ee(""),G(null),O(0),P(!1)},pe=a=>{o(n=>({...n,...rt(a)})),G(null)},me=async a=>{if(a.disabled){G(a.disabledReason??a.description);return}const n=a.label.trim();if(n){re(a.id),G(null);try{if(a.kind==="goal"){const r=await Re({...Ee,title:n,userId:m.userId??null});await(v==null?void 0:v()),q({id:`goal:${r.goal.id}`,kind:"goal",mode:"existing",entityId:r.goal.id,label:r.goal.title,description:"Goal",searchText:$(`${r.goal.title} ${r.goal.description}`),goalId:r.goal.id,projectId:null,parentWorkItemId:null});return}if(a.kind==="project"){if(!m.goalId)throw new Error("Pick or create a goal first.");const r=await Pe({...ze,goalId:m.goalId,title:n,userId:m.userId??null,assigneeUserIds:m.assigneeUserIds});await(v==null?void 0:v()),q({id:`project:${r.project.id}`,kind:"project",mode:"existing",entityId:r.project.id,label:r.project.title,description:"Project",searchText:$(`${r.project.title} ${r.project.description}`),goalId:r.project.goalId,projectId:r.project.id,parentWorkItemId:null});return}if(a.kind==="issue"){if(!m.projectId)throw new Error("Pick or create a project first.");const r=await Ge({...X,level:"issue",title:n,owner:m.owner,userId:m.userId??null,assigneeUserIds:m.assigneeUserIds,goalId:m.goalId,projectId:m.projectId,executionMode:"afk"});await(v==null?void 0:v()),q({id:`issue:${r.workItem.id}`,kind:"issue",mode:"existing",entityId:r.workItem.id,label:r.workItem.title,description:"Issue",searchText:$(`${r.workItem.title} ${r.workItem.description}`),goalId:r.workItem.goalId,projectId:r.workItem.projectId,parentWorkItemId:null})}}catch(r){G(r instanceof Error?r.message:"Unable to create that linked entity right now.")}finally{re(null)}}},Ne=[{id:"anchor",eyebrow:"Placement",title:"Choose where this work belongs",description:"Anchor the work through the hierarchy. Tasks can carry a goal, project, and issue parent together so the chain of meaning stays explicit.",render:(a,n)=>{var r;return e.jsxs(e.Fragment,{children:[e.jsx(g,{label:"Hierarchy anchors",labelHelp:"Pick the goal and project anchors, then choose the real parent where needed. Tasks can live under issues, subtasks under tasks.",error:M.projectId??null,children:e.jsx("div",{className:"grid gap-3",children:e.jsxs("div",{className:"rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-4",children:[K.length>0?e.jsx("div",{className:"mb-3 flex flex-wrap gap-2",children:K.map(l=>e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-2.5 py-1.5",children:[e.jsx(xe,{kind:fe(l.kind),label:l.label,compact:!0,gradient:!1,className:"max-w-[16rem]"}),e.jsx("button",{type:"button",className:"rounded-full text-[var(--ui-ink-soft)] transition hover:text-[var(--ui-ink-strong)]",onClick:()=>pe(l.kind),"aria-label":`Remove ${l.label}`,children:e.jsx(je,{className:"size-3.5"})})]},l.id))}):null,e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-3 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3",children:[e.jsx(Ie,{className:"size-4 text-[var(--ui-ink-faint)]"}),e.jsx("input",{value:R,onChange:l=>{ee(l.target.value),P(!0),O(0),G(null)},onFocus:()=>P(!0),onBlur:()=>{window.setTimeout(()=>P(!1),120)},onKeyDown:l=>{if(l.key==="Backspace"&&!R&&K.length>0){pe(K[K.length-1].kind);return}if(l.key==="ArrowDown"){l.preventDefault(),P(!0),O(x=>L.length===0?0:Math.min(L.length-1,x+1));return}if(l.key==="ArrowUp"){l.preventDefault(),O(x=>Math.max(0,x-1));return}if(l.key==="Escape"){P(!1);return}if(l.key==="Enter"&&L[te]){l.preventDefault();const x=L[te];x.mode==="existing"?q(x):me(x)}},placeholder:'Search or create Goal, Project, or parent Issue like Goal + "Creative system"',className:"min-w-0 flex-1 bg-transparent text-sm text-[var(--ui-ink-strong)] placeholder:text-[var(--ui-ink-faint)] focus:outline-none"})]}),ve?e.jsx("div",{className:"absolute top-full z-20 mt-2 w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-popover)] p-2 shadow-[var(--ui-shadow-floating)] backdrop-blur-xl",children:L.length>0?L.map((l,x)=>e.jsxs("button",{type:"button",disabled:l.mode==="create"&&l.disabled,className:De("flex w-full items-start justify-between gap-3 rounded-[18px] px-3 py-2.5 text-left transition",x===te?"bg-[var(--ui-surface-active)] text-[var(--ui-ink-strong)]":"text-[var(--ui-ink-soft)] hover:bg-[var(--ui-surface-2)] hover:text-[var(--ui-ink-strong)]",l.mode==="create"&&l.disabled&&"cursor-not-allowed opacity-45"),onMouseEnter:()=>O(x),onMouseDown:E=>E.preventDefault(),onClick:()=>{if(l.mode==="existing"){q(l);return}me(l)},children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(xe,{kind:fe(l.kind),label:l.mode==="create"?`Create ${l.kind}`:l.label,compact:!0,gradient:!1}),l.mode==="create"?e.jsxs(ye,{className:"bg-[var(--ui-surface-2)] text-[var(--ui-ink-soft)]",children:['"',l.label,'"']}):null]}),e.jsx("div",{className:"mt-1 text-xs leading-5 text-[var(--ui-ink-faint)]",children:l.description})]}),l.mode==="create"?e.jsx("span",{className:"rounded-full bg-[var(--primary)]/12 p-2 text-[var(--primary)]",children:e.jsx(Ae,{className:"size-3.5"})}):null]},l.id)):e.jsx("div",{className:"px-3 py-2.5 text-sm text-[var(--ui-ink-faint)]",children:"Type to find an existing anchor or create a new one."})}):null]}),oe?e.jsx("div",{className:"mt-3 rounded-[16px] border border-[color-mix(in_srgb,var(--danger)_22%,transparent)] bg-[var(--ui-danger-soft)] px-3 py-2 text-sm text-[var(--danger)]",children:oe}):null]})})}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsx(g,{label:"Resolved project",children:e.jsx(F,{readOnly:!0,value:(T==null?void 0:T.title)??"",placeholder:"Select or create a project anchor"})}),e.jsx(g,{label:"Resolved goal",children:e.jsx(F,{readOnly:!0,value:((r=D.find(l=>l.id===a.goalId))==null?void 0:r.title)??"",placeholder:"Select or create a goal anchor"})})]})]})}},{id:"shape",eyebrow:"Shape",title:"Define the next concrete move",description:"Keep the task small enough to be actionable and strong enough to clearly move the project forward.",render:(a,n)=>e.jsxs(e.Fragment,{children:[e.jsx(g,{label:"Hierarchy level",error:M.level??null,children:e.jsx(H,{value:a.level,onChange:r=>n({level:r}),options:[{value:"issue",label:"Issue",description:"Vertical slice with AFK or HITL execution mode."},{value:"task",label:"Task",description:"One focused AI session with direct instructions."},{value:"subtask",label:"Subtask",description:"A lightweight child step under a task."}]})}),e.jsx(g,{label:u("common.dialogs.task.title"),error:M.title??null,children:e.jsx(F,{value:a.title,onChange:r=>n({title:r.target.value}),placeholder:"Draft the first mode atlas sketch"})}),e.jsx(g,{label:u("common.dialogs.task.descriptionLabel"),children:e.jsx(Q,{value:a.description,onChange:r=>n({description:r.target.value}),placeholder:"Write the task description in Markdown. Keep it short or turn it into a full acceptance doc."})}),a.level==="issue"||a.level==="task"?e.jsxs(e.Fragment,{children:[e.jsx(g,{label:"Execution mode",children:e.jsx(H,{value:a.executionMode??"afk",onChange:r=>n({executionMode:r}),options:[{value:"afk",label:"AFK",description:"AI can complete the issue flow without waiting on a human decision."},{value:"hitl",label:"HITL",description:"A human decision is required somewhere in the slice."}]})}),e.jsx(g,{label:"Acceptance criteria",children:e.jsx(Q,{value:a.acceptanceCriteria.join(`
3
3
  `),onChange:r=>n({acceptanceCriteria:r.target.value.split(`
4
4
  `).map(l=>l.trim()).filter(l=>l.length>0)}),placeholder:"Given ... / When ... / Then ..."})})]}):null,a.level!=="issue"?e.jsx(g,{label:"AI instructions",children:e.jsx(Q,{value:a.aiInstructions,onChange:r=>n({aiInstructions:r.target.value}),placeholder:"Tell the executing agent which files and patterns matter, and what finished work looks like."})}):null,e.jsx(g,{label:u("common.dialogs.task.owner"),labelHelp:"The owner is the person or role expected to carry this task.",error:M.owner??null,children:e.jsx(F,{value:a.owner,onChange:r=>n({owner:r.target.value}),placeholder:"Albert"})}),e.jsx(Oe,{value:a.userId,users:W,onChange:r=>{var l;return n({userId:r,owner:((l=W.find(x=>x.id===r))==null?void 0:l.displayName)??a.owner})},label:"Owner user",defaultLabel:Le(we),help:"Tasks can belong to a human or bot user. The linked project owner is suggested first so cross-user task routing stays explicit."}),e.jsx(g,{label:"Assignees",children:e.jsx("select",{multiple:!0,value:a.assigneeUserIds,onChange:r=>n({assigneeUserIds:Array.from(r.target.selectedOptions,l=>l.value)}),className:"min-h-28 rounded-[var(--radius-control)] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2 text-sm text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--primary)]",children:W.map(r=>e.jsxs("option",{value:r.id,children:[r.displayName," · ",r.kind]},r.id))})})]})},{id:"execution",eyebrow:"Execution",title:"Set priority, status, effort, and energy",description:"This is the minimum the execution engine needs in order to place the task well and show the right next move.",render:(a,n)=>e.jsxs(e.Fragment,{children:[e.jsx(g,{label:u("common.dialogs.task.priority"),labelHelp:"Priority controls how strongly Forge should surface this task in the board and daily views.",children:e.jsx(H,{value:a.priority,onChange:r=>n({priority:r}),options:[{value:"low",label:u("common.enums.priority.low")},{value:"medium",label:u("common.enums.priority.medium")},{value:"high",label:u("common.enums.priority.high")},{value:"critical",label:u("common.enums.priority.critical")}]})}),e.jsx(g,{label:u("common.dialogs.task.status"),labelHelp:"Status tells Forge whether the task is waiting, ready for focus, active, blocked, or done.",children:e.jsx(H,{value:a.status,onChange:r=>n({status:r}),options:[{value:"backlog",label:u("common.enums.taskStatus.backlog")},{value:"focus",label:u("common.enums.taskStatus.focus")},{value:"in_progress",label:u("common.enums.taskStatus.in_progress")},{value:"blocked",label:u("common.enums.taskStatus.blocked")}]})}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(g,{label:u("common.dialogs.task.effort"),labelHelp:"Effort describes how much concentration and time this task usually needs.",children:e.jsx(H,{value:a.effort,onChange:r=>n({effort:r}),options:[{value:"light",label:u("common.enums.effort.light")},{value:"deep",label:u("common.enums.effort.deep")},{value:"marathon",label:u("common.enums.effort.marathon")}]})}),e.jsx(g,{label:u("common.dialogs.task.energy"),labelHelp:"Energy helps you match this task to a low-energy, steady, or high-energy moment.",children:e.jsx(H,{value:a.energy,onChange:r=>n({energy:r}),options:[{value:"low",label:u("common.enums.energy.low")},{value:"steady",label:u("common.enums.energy.steady")},{value:"high",label:u("common.enums.energy.high")}]})})]})]})},{id:"signal",eyebrow:"Reward and timing",title:"Set the reward and timing details",description:"This keeps the daily surfaces honest without forcing you through a bloated last-mile form.",render:(a,n)=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(g,{label:u("common.dialogs.task.xp"),labelHelp:"XP is the reward weight for finishing this task. Higher XP should mean more meaningful work.",error:M.points??null,children:e.jsx(F,{type:"number",value:a.points,onChange:r=>n({points:Number(r.target.value)||0}),placeholder:"60"})}),e.jsx(g,{label:u("common.dialogs.task.dueDate"),labelHelp:"Only add a due date when timing really matters for this task.",children:e.jsx(F,{type:"date",value:a.dueDate,onChange:r=>n({dueDate:r.target.value})})})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(g,{label:"Expected duration",labelHelp:"Life Force uses this as the expected shape of the task. The default is one day.",error:M.plannedDurationSeconds??null,children:e.jsx(F,{type:"number",min:15,max:10080,step:15,value:Math.max(15,Math.round((a.plannedDurationSeconds??86400)/60)),onChange:r=>n({plannedDurationSeconds:Math.max(60,(Number(r.target.value)||1440)*60)})})}),s?e.jsx(g,{label:"Tracked minutes",labelHelp:"Change the current credited work total without starting a live run. Forge records the difference as a work adjustment when you save.",children:e.jsx(F,{type:"number",min:0,step:1,value:ae,onChange:r=>ne(Math.max(0,Math.trunc(Number(r.target.value)||0)))})}):null,e.jsx(g,{label:"Action cost",labelHelp:"Choose a simple AP band now. Advanced AP editing can happen later inside the task.",children:e.jsx(H,{value:a.actionCostBand??"standard",onChange:r=>n({actionCostBand:r}),options:[{value:"tiny",label:"Tiny"},{value:"light",label:"Light"},{value:"standard",label:"Standard"},{value:"heavy",label:"Heavy"},{value:"brutal",label:"Brutal"}]})})]}),s?e.jsxs("div",{className:"rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:["Currently recorded: ",de," min."," ",B===0?"Saving this edit keeps the tracked total unchanged.":`Saving this edit will ${B>0?"add":"remove"} ${Math.abs(B)} minute${Math.abs(B)===1?"":"s"} from the task history.`]}):null,e.jsx(g,{label:u("common.dialogs.task.tags"),children:e.jsx("div",{className:"flex flex-wrap gap-2",children:Y.map(r=>{const l=a.tagIds.includes(r.id);return e.jsx("button",{type:"button",className:`rounded-full px-3 py-2 text-sm transition ${l?"bg-[var(--ui-surface-active)] 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:()=>n({tagIds:l?a.tagIds.filter(x=>x!==r.id):[...a.tagIds,r.id]}),children:r.name},r.id)})})})]})},{id:"notes",eyebrow:"Closeout",title:"Capture what changed when the work is done",description:"Completion stays truthful when the closeout records modified files, a concise work summary, and the associated commit refs.",render:(a,n)=>{var r,l;return e.jsxs(e.Fragment,{children:[a.level!=="issue"?e.jsxs(e.Fragment,{children:[e.jsx(g,{label:"Work summary",children:e.jsx(Q,{value:((r=a.completionReport)==null?void 0:r.workSummary)??"",onChange:x=>{var E,_;return n({completionReport:ie({modifiedFiles:((E=a.completionReport)==null?void 0:E.modifiedFiles)??[],workSummary:x.target.value,linkedGitRefIds:((_=a.completionReport)==null?void 0:_.linkedGitRefIds)??[]})})},placeholder:"Summarize what changed in this session and what is now true."})}),e.jsx(g,{label:"Modified files",children:e.jsx(Q,{value:(((l=a.completionReport)==null?void 0:l.modifiedFiles)??[]).join(`
5
- `),onChange:x=>{var E,_;return n({completionReport:ie({modifiedFiles:Qe(x.target.value),workSummary:((E=a.completionReport)==null?void 0:E.workSummary)??"",linkedGitRefIds:((_=a.completionReport)==null?void 0:_.linkedGitRefIds)??[]})})},placeholder:`src/pages/kanban-page.tsx
6
- server/src/repositories/tasks.ts`})}),e.jsx(g,{label:"Git links",children:e.jsx(qe,{selectedRefs:a.gitRefs,onChange:x=>n({gitRefs:x,completionReport:Xe(x,a.completionReport)})})})]}):null,e.jsx(g,{label:"Creation notes",children:e.jsx(He,{notes:a.notes,onChange:x=>n({notes:x}),entityLabel:"task"})})]})}},{id:"notes-evidence",eyebrow:"Evidence",title:"Capture launch context if this task needs a durable work note",description:"These notes become linked Markdown evidence on the task immediately, which helps preserve setup context, blockers, or handoff detail.",render:(a,n)=>e.jsx("div",{className:"text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Use the previous step for completion closeout. Use linked notes here only when you want durable extra context, setup detail, or handoff evidence beyond the structured completion report."})}];return e.jsx(Me,{open:t,onOpenChange:U,eyebrow:u("common.dialogs.task.eyebrow"),title:u(s?"common.dialogs.task.editTitle":"common.dialogs.task.createTitle"),description:u("common.dialogs.task.description"),value:p,onChange:o,draftPersistenceKey:s?`task.${s.id}`:"task.new",steps:Ne,initialStepId:k,submitLabel:u(s?"common.dialogs.task.save":"common.dialogs.task.create"),error:h,onSubmit:async()=>{if(y(null),s&&ae<0){y("Tracked minutes cannot be negative.");return}const a=Be.safeParse(p);if(!a.success){ke(a.error.flatten().fieldErrors),y("A few task details still need attention before this move can be saved.");return}J({});try{await Z(a.data,s==null?void 0:s.id),s&&V&&B!==0&&await V({entityType:"task",entityId:s.id,deltaMinutes:B,note:"Adjusted from task editor."}),U(!1)}catch(n){y(n instanceof Error?n.message:"Unable to save this task right now.")}}})}export{jt as TaskDialog,X as defaultTaskValues};
5
+ `),onChange:x=>{var E,_;return n({completionReport:ie({modifiedFiles:Qe(x.target.value),workSummary:((E=a.completionReport)==null?void 0:E.workSummary)??"",linkedGitRefIds:((_=a.completionReport)==null?void 0:_.linkedGitRefIds)??[]})})},placeholder:`apps/web/src/pages/kanban-page.tsx
6
+ apps/api/src/repositories/tasks.ts`})}),e.jsx(g,{label:"Git links",children:e.jsx(qe,{selectedRefs:a.gitRefs,onChange:x=>n({gitRefs:x,completionReport:Xe(x,a.completionReport)})})})]}):null,e.jsx(g,{label:"Creation notes",children:e.jsx(He,{notes:a.notes,onChange:x=>n({notes:x}),entityLabel:"task"})})]})}},{id:"notes-evidence",eyebrow:"Evidence",title:"Capture launch context if this task needs a durable work note",description:"These notes become linked Markdown evidence on the task immediately, which helps preserve setup context, blockers, or handoff detail.",render:(a,n)=>e.jsx("div",{className:"text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Use the previous step for completion closeout. Use linked notes here only when you want durable extra context, setup detail, or handoff evidence beyond the structured completion report."})}];return e.jsx(Me,{open:t,onOpenChange:U,eyebrow:u("common.dialogs.task.eyebrow"),title:u(s?"common.dialogs.task.editTitle":"common.dialogs.task.createTitle"),description:u("common.dialogs.task.description"),value:m,onChange:o,draftPersistenceKey:s?`task.${s.id}`:"task.new",steps:Ne,initialStepId:k,submitLabel:u(s?"common.dialogs.task.save":"common.dialogs.task.create"),error:h,onSubmit:async()=>{if(y(null),s&&ae<0){y("Tracked minutes cannot be negative.");return}const a=Be.safeParse(m);if(!a.success){ke(a.error.flatten().fieldErrors),y("A few task details still need attention before this move can be saved.");return}J({});try{await Z(a.data,s==null?void 0:s.id),s&&V&&B!==0&&await V({entityType:"task",entityId:s.id,deltaMinutes:B,note:"Adjusted from task editor."}),U(!1)}catch(n){y(n instanceof Error?n.message:"Unable to save this task right now.")}}})}export{jt as TaskDialog,X as defaultTaskValues};
@@ -1 +1 @@
1
- import{r as j,j as e,aG as Ie}from"./vendor-BwL6m4SE.js";import{S as Re}from"./scheduling-rules-editor-jakFfxqF.js";import{aA as _e,C as ye,B as Y,x as ae,o as q,k as h,n as z,I as C,m as se,c6 as Ee,N as Le}from"./index-FpGANF9S.js";import{i as je}from"./state-Bpe5dF3T.js";import{F as y,a as Me,Q as Fe}from"./question-flow-dialog-Ded2E85L.js";import{f as $e}from"./calendar-ui-Cy1XRwzV.js";function Je({open:s,onOpenChange:o,tasks:m,onSave:v}){const c=j.useMemo(()=>m.filter(f=>f.status!=="done"),[m]),[I,k]=j.useState("");j.useEffect(()=>{if(s){if(c.length===0){k("");return}k(f=>f&&c.some(g=>g.id===f)?f:c[0].id)}},[c,s]);const N=c.find(f=>f.id===I)??null;return e.jsx(_e,{open:s,onOpenChange:o,eyebrow:"Calendar",title:"Adjust task scheduling rules",description:"Choose a task, then tell Forge which work blocks, calendar conditions, or keywords should allow or block that work.",children:e.jsxs("div",{className:"grid min-w-0 gap-4",children:[e.jsx(ye,{className:"min-w-0 overflow-hidden rounded-[28px] border border-[var(--ui-border-subtle)] !bg-[var(--ui-surface-1)]",children:e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("div",{className:"rounded-[18px] bg-[var(--primary)]/14 p-3 text-[var(--primary)]",children:e.jsx(Ie,{className:"size-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:"Guided rule editing"}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Use this when a task should only run in certain blocks such as Secondary Activity, or should stay blocked during clinic, rest, or other provider events."})]})]})}),c.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"grid min-w-0 gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Task"}),e.jsx("select",{value:I,onChange:f=>k(f.target.value),className:"w-full min-w-0 max-w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3 text-[15px] text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--ui-border-strong)] focus:ring-2 focus:ring-[var(--primary)]/20",children:c.map(f=>e.jsx("option",{value:f.id,children:f.title},f.id))})]}),N?e.jsx(Re,{title:"Task rules",subtitle:"These rules are saved directly on the task. They drive blocked-now checks and future timebox recommendations.",initialRules:N.schedulingRules,initialPlannedDurationSeconds:N.plannedDurationSeconds,allowPlannedDuration:!0,saveLabel:"Save task rules",onSave:async({schedulingRules:f,plannedDurationSeconds:g})=>{await v({taskId:N.id,schedulingRules:f,plannedDurationSeconds:g===void 0?N.plannedDurationSeconds:g??null}),o(!1)}}):null]}):e.jsxs(ye,{className:"min-w-0 overflow-hidden rounded-[28px] border border-[var(--ui-border-subtle)] !bg-[var(--ui-surface-1)]",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:"No schedulable tasks yet"}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Create or reopen a task first, then come back here to define work-block and calendar eligibility."}),e.jsx("div",{className:"mt-4",children:e.jsx(Y,{variant:"secondary",onClick:()=>o(!1),children:"Close"})})]})]})})}function E(s){return s.slice(0,10)}function Ke(s){return new Date(`${s}T00:00:00`).toISOString()}function He(s){return new Date(`${s}T23:59:59.999`).toISOString()}function re(s,o,m){return s<o?o:s>m?m:s}function we(s,o){const m=E(s),v=E(o),c=new Date(`${m}T12:00:00`);return c.setDate(c.getDate()+1),re(E(c.toISOString()),m,v)}function be(s){return String(s).padStart(2,"0")}function G(s){return`${be(s.getHours())}:${be(s.getMinutes())}`}function ke(s,o){if(!s||!o)return null;const m=new Date(`${s}T${o}:00`);return Number.isNaN(m.getTime())?null:m}function U(s,o,m){if(m){const k=new Date(m.startsAt),N=new Date(m.endsAt);return{startTime:G(k),endTime:G(N)}}const v=new Date(`${s}T09:00:00`),c=Math.max(1800,Math.min(o??3600,360*60)),I=new Date(v.getTime()+c*1e3);return{startTime:G(v),endTime:G(I)}}function Ne(s,o){return`${new Date(s).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} - ${new Date(o).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`}function J(s,o){return`${$e(new Date(s))} · ${Ne(s,o)}`}const Se="rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)]",ne="rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",p="bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",ee="rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3 text-[15px] text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--ui-border-strong)] focus:ring-2 focus:ring-[var(--primary)]/20";function te({title:s,subtitle:o,emptyLabel:m,children:v}){const c=Array.isArray(v)?v:v?[v]:[];return e.jsxs("div",{className:`${Se} p-4`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:o})]}),e.jsx(h,{className:p,children:c.length})]}),e.jsx("div",{className:"mt-3 grid gap-2",children:c.length>0?c:e.jsx("div",{className:"rounded-[18px] border border-dashed border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-3 text-sm text-[var(--ui-ink-muted)]",children:m})})]})}function Be({event:s}){return e.jsxs("div",{className:`${ne} px-3 py-3`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s.title}),e.jsx(h,{className:p,children:s.availability})]}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:J(s.startAt,s.endAt)})]})}function Oe({block:s}){return e.jsxs("div",{className:`${ne} px-3 py-3`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s.title}),e.jsx(h,{className:p,children:s.blockingState})]}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:J(s.startAt,s.endAt)})]})}function We({timebox:s}){const o=ae(s);return e.jsxs("div",{className:`${ne} px-3 py-3`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s.title}),e.jsx(h,{className:p,children:s.source})]}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:J(s.startsAt,s.endsAt)}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[e.jsx(h,{className:p,children:se(o.rateApPerHour)}),e.jsx(h,{className:p,children:z(o.totalAp)})]})]})}function Xe({open:s,onOpenChange:o,tasks:m,from:v,to:c,onCreateTimebox:I,onUpdateTimebox:k,onDeleteTimebox:N,initialTaskId:f,lockedTaskId:g,editingTimebox:t,userIds:le}){var he,pe,fe,ve,ge,xe;const L=!!t,w=j.useMemo(()=>{const a=g??(t==null?void 0:t.taskId)??null,d=m.filter(u=>u.status!=="done"||u.id===a);if(!a)return d;const r=d.find(u=>u.id===a);return r?[r]:[]},[t==null?void 0:t.taskId,g,m]),M=E(v),F=E(c),ie=t?re(E(t.startsAt),M,F):we(v,c),oe=g??(t==null?void 0:t.taskId)??f??((he=w[0])==null?void 0:he.id)??"",$=w.find(a=>a.id===oe)??w[0]??null,de=U(ie,$==null?void 0:$.plannedDurationSeconds,t?{startsAt:t.startsAt,endsAt:t.endsAt}:null),[i,O]=j.useState({taskId:oe,preferredDate:ie,plannerMode:t?"manual":"suggested",selectedTimeboxId:"",activityPresetKey:((pe=t==null?void 0:t.actionProfile)==null?void 0:pe.profileKey)??"task_inherited",customSustainRateApPerHour:((fe=t==null?void 0:t.actionProfile)==null?void 0:fe.sourceMethod)==="manual"?t.actionProfile.sustainRateApPerHour:null,manualStartTime:de.startTime,manualEndTime:de.endTime,manualTitle:(t==null?void 0:t.title)??($==null?void 0:$.title)??"",overrideReason:(t==null?void 0:t.overrideReason)??""}),[Ae,b]=j.useState(null),[Pe,W]=j.useState(!1),[De,ce]=j.useState(!1);j.useEffect(()=>{var _,H,B;if(!s)return;const a=g??f??((_=w[0])==null?void 0:_.id)??"",d=(t==null?void 0:t.taskId)??a,r=w.find(x=>x.id===d)??w[0]??null,u=t?re(E(t.startsAt),M,F):we(v,c),n=U(u,r==null?void 0:r.plannedDurationSeconds,t?{startsAt:t.startsAt,endsAt:t.endsAt}:null);b(null),O({taskId:d,preferredDate:u,plannerMode:t?"manual":"suggested",selectedTimeboxId:"",activityPresetKey:((H=t==null?void 0:t.actionProfile)==null?void 0:H.profileKey)??"task_inherited",customSustainRateApPerHour:((B=t==null?void 0:t.actionProfile)==null?void 0:B.sourceMethod)==="manual"?t.actionProfile.sustainRateApPerHour:null,manualStartTime:n.startTime,manualEndTime:n.endTime,manualTitle:(t==null?void 0:t.title)??(r==null?void 0:r.title)??"",overrideReason:(t==null?void 0:t.overrideReason)??""})},[w,t,v,f,g,F,M,s,c]);const l=w.find(a=>a.id===i.taskId)??null,P=j.useMemo(()=>({from:Ke(i.preferredDate),to:He(i.preferredDate)}),[i.preferredDate]),D=je({queryKey:["forge-calendar-suggestions-dialog",i.taskId,P.from,P.to],queryFn:()=>Ee({taskId:i.taskId,from:P.from,to:P.to,limit:8}),enabled:s&&i.taskId.length>0}),X=je({queryKey:["forge-calendar-timebox-dialog-day",P.from,P.to,...le??[]],queryFn:()=>Le({from:P.from,to:P.to,userIds:le}),enabled:s});j.useEffect(()=>{var d;if(!s)return;const a=((d=D.data)==null?void 0:d.timeboxes)??[];if(!a.length){O(r=>r.selectedTimeboxId?{...r,selectedTimeboxId:""}:r);return}O(r=>r.selectedTimeboxId&&a.some(u=>u.id===r.selectedTimeboxId)?r:{...r,selectedTimeboxId:a[0].id})},[s,D.data]);const A=(ve=X.data)==null?void 0:ve.calendar,Z=(A==null?void 0:A.events)??[],V=(A==null?void 0:A.workBlockInstances)??[],T=(A==null?void 0:A.timeboxes)??[],K=(((ge=D.data)==null?void 0:ge.timeboxes)??[]).find(a=>a.id===i.selectedTimeboxId),S=ke(i.preferredDate,i.manualStartTime),R=ke(i.preferredDate,i.manualEndTime),Q=S&&R?ae({startsAt:S.toISOString(),endsAt:R.toISOString(),actionProfile:i.customSustainRateApPerHour!==null||i.activityPresetKey!=="task_inherited"?{id:"manual-preview",profileKey:"manual-preview",title:i.manualTitle||(l==null?void 0:l.title)||"Manual timebox",entityType:"task_timebox",mode:"container",startupAp:0,totalCostAp:0,expectedDurationSeconds:null,sustainRateApPerHour:i.customSustainRateApPerHour??((xe=q().find(a=>a.key===i.activityPresetKey))==null?void 0:xe.defaultRateApPerHour)??100/24,demandWeights:{activation:.1,focus:.3,vigor:.1,composure:.1,flow:.4},doubleCountPolicy:"container_only",sourceMethod:"manual",costBand:"light",recoveryEffect:0,metadata:{},createdAt:S.toISOString(),updatedAt:S.toISOString()}:null}):null,ue=L?"Review the task tied to this scheduled block":g?"Review the task you are planning":"Choose the task you want to place into the calendar",me=L?"The timebox stays linked to this task. Update the day, hours, title, or AP profile without leaving the planning flow.":g?"Forge will use this task's current duration target and scheduling rules while it looks for viable slots.":"Forge will use the task's current planned duration and scheduling rules when it searches for valid slots.",Ce=j.useMemo(()=>[{id:"task",eyebrow:"Planning",title:ue,description:me,render:(a,d)=>e.jsxs("div",{className:"grid min-w-0 max-w-full gap-4 overflow-hidden",children:[g?null:e.jsx(y,{label:"Task",children:e.jsx("select",{value:a.taskId,onChange:r=>(()=>{const u=w.find(_=>_.id===r.target.value),n=U(a.preferredDate,u==null?void 0:u.plannedDurationSeconds);d({taskId:r.target.value,selectedTimeboxId:"",activityPresetKey:"task_inherited",customSustainRateApPerHour:null,manualStartTime:n.startTime,manualEndTime:n.endTime,manualTitle:(u==null?void 0:u.title)??a.manualTitle})})(),className:ee,children:w.map(r=>e.jsx("option",{value:r.id,children:r.title},r.id))})}),l?e.jsxs("div",{className:"min-w-0 max-w-full overflow-hidden rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5 shadow-[var(--ui-shadow-soft)]",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:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Time Box"}),e.jsx("div",{className:"mt-2 break-words font-display text-[1.4rem] leading-tight text-[var(--ui-ink-strong)]",children:l.title})]}),e.jsx(h,{className:p,children:l.status})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(h,{className:p,children:l.plannedDurationSeconds?`${Math.round(l.plannedDurationSeconds/60)} min target`:"No duration yet"}),e.jsx(h,{className:p,children:l.schedulingRules?"Task-specific rules":"Uses project rules"}),e.jsxs(h,{className:p,children:[l.points," xp"]}),l.plannedDurationSeconds?e.jsxs(h,{className:p,children:[z(l.plannedDurationSeconds/3600/24*100)," ","target load"]}):null]}),e.jsx("p",{className:"mt-4 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Pick a day first, then either accept one of Forge's suggested slots or set the block manually."}),L&&t&&N?e.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3 rounded-[20px] border border-[color-mix(in_srgb,var(--danger)_24%,var(--ui-border-subtle)_76%)] bg-[var(--ui-danger-soft)] px-4 py-3",children:[e.jsx("div",{className:"text-sm leading-6 text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",children:"Remove this planned timebox if you no longer want it in the calendar."}),e.jsx(Y,{type:"button",variant:"ghost",className:"text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)] hover:bg-[var(--ui-danger-soft)]",pending:De,pendingLabel:"Deleting",onClick:()=>void(async()=>{b(null),ce(!0);try{await N(t.id),o(!1)}catch(r){b(r instanceof Error?r.message:"Forge could not delete this timebox.")}finally{ce(!1)}})(),children:"Delete timebox"})]}):null]}):null]})},{id:"day",eyebrow:"Calendar",title:"Choose the day and review what is already there",description:"Forge reads the real day first so the timebox stays grounded in your provider events, work blocks, and already-planned work.",render:(a,d)=>e.jsx("div",{className:"grid gap-5",children:e.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,16rem)_minmax(0,1fr)]",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsx(y,{label:"Date",description:"Choose the day you want to protect for this task.",children:e.jsx(C,{type:"date",min:M,max:F,value:a.preferredDate,onChange:r=>{const u=U(r.target.value,l==null?void 0:l.plannedDurationSeconds,t?{startsAt:`${r.target.value}T${a.manualStartTime}:00`,endsAt:`${r.target.value}T${a.manualEndTime}:00`}:null);d({preferredDate:r.target.value,selectedTimeboxId:"",manualStartTime:u.startTime,manualEndTime:u.endTime})}})}),e.jsx(y,{label:"Planning style",description:"Take Forge's slot recommendation when it fits, or set the block yourself.",children:e.jsx(Me,{value:a.plannerMode,onChange:r=>d({plannerMode:r}),options:[{value:"suggested",label:"Use suggestions",description:"Forge proposes slots that fit the task rules and the selected day."},{value:"manual",label:"Set it manually",description:"You choose the exact start and end time yourself."}]})})]}),e.jsxs("div",{className:"rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Selected day"}),e.jsx("div",{className:"mt-2 font-display text-[1.3rem] leading-tight text-[var(--ui-ink-strong)]",children:a.preferredDate?new Date(`${a.preferredDate}T12:00:00`).toLocaleDateString([],{weekday:"long",month:"long",day:"numeric"}):"Choose a day"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(h,{className:p,children:[Z.length," events"]}),e.jsxs(h,{className:p,children:[V.length," work blocks"]}),e.jsxs(h,{className:p,children:[T.length," timeboxes"]})]})]}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"This is the context Forge will use while recommending a slot. You can still place the block manually if you want something more exact."}),X.isLoading?e.jsx("div",{className:"mt-4 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-4 text-sm text-[var(--ui-ink-soft)]",children:"Loading the selected day…"}):e.jsxs("div",{className:"mt-4 grid gap-4 xl:grid-cols-3",children:[e.jsx(te,{title:"Provider events",subtitle:"Busy or free events already on the day.",emptyLabel:"No mirrored events on this day.",children:Z.slice(0,4).map(r=>e.jsx(Be,{event:r},r.id))}),e.jsx(te,{title:"Work blocks",subtitle:"Recurring allowed or blocked containers.",emptyLabel:"No work blocks land on this day.",children:V.slice(0,4).map(r=>e.jsx(Oe,{block:r},r.id))}),e.jsx(te,{title:"Planned timeboxes",subtitle:"Existing owned work already placed there.",emptyLabel:"No other planned timeboxes yet.",children:T.slice(0,4).map(r=>e.jsx(We,{timebox:r},r.id))})]})]})]})})},{id:"slot",eyebrow:i.plannerMode==="suggested"?"Suggestion":"Manual",title:i.plannerMode==="suggested"?"Choose one of Forge's suggested slots":"Set the exact timebox yourself",description:i.plannerMode==="suggested"?"Forge proposes slots that fit the selected day, the task rules, and the current calendar picture.":"Use manual mode when the right block is obvious to you or when you want to place the timebox despite imperfect recommendations.",render:(a,d)=>{var u;if(a.plannerMode==="manual")return e.jsxs("div",{className:"grid gap-5",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(y,{label:"Day",description:"Pick the day for the block. Forge defaults to a future day, but you can move it.",children:e.jsx(C,{type:"date",min:M,max:F,value:a.preferredDate,onChange:n=>d({preferredDate:n.target.value})})}),e.jsx(y,{label:"Start time",description:"Choose when the protected work block should begin.",children:e.jsx(C,{type:"time",step:300,value:a.manualStartTime,onChange:n=>d({manualStartTime:n.target.value})})}),e.jsx(y,{label:"End time",description:"Choose when the work block should end.",children:e.jsx(C,{type:"time",step:300,value:a.manualEndTime,onChange:n=>d({manualEndTime:n.target.value})})})]}),e.jsx(y,{label:"Title",description:"By default Forge uses the task title. Tighten it only if a shorter calendar label would help.",children:e.jsx(C,{value:a.manualTitle,onChange:n=>d({manualTitle:n.target.value}),placeholder:(l==null?void 0:l.title)??"Task timebox"})}),e.jsx(y,{label:"Override reason",description:"Optional. Add a short reason only if you are intentionally placing the block despite the normal rules or calendar shape.",children:e.jsx(C,{value:a.overrideReason,onChange:n=>d({overrideReason:n.target.value}),placeholder:"Protected writing block before clinic."})}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(y,{label:"Activity profile",children:e.jsx("select",{value:a.activityPresetKey??"task_inherited",onChange:n=>d({activityPresetKey:n.target.value}),className:ee,children:q().map(n=>e.jsx("option",{value:n.key,children:n.label},n.key))})}),e.jsx(y,{label:"Custom AP per hour",children:e.jsx(C,{type:"number",min:0,step:.5,value:a.customSustainRateApPerHour??"",onChange:n=>d({customSustainRateApPerHour:n.target.value.trim()===""?null:Number(n.target.value)}),placeholder:"Leave empty to use the activity profile"})})]}),e.jsxs("div",{className:`${Se} p-4`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:a.manualTitle||(l==null?void 0:l.title)||"Manual timebox"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:S&&R?`${S.toLocaleDateString([],{weekday:"long",month:"short",day:"numeric"})} · ${Ne(S.toISOString(),R.toISOString())}`:"Choose a start and end time."})]}),e.jsx(h,{className:p,children:"manual"})]}),Q?e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(h,{className:p,children:se(Q.rateApPerHour)}),e.jsx(h,{className:p,children:z(Q.totalAp)})]}):null]})]});const r=((u=D.data)==null?void 0:u.timeboxes)??[];return D.isLoading?e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Looking for valid slots on the selected day…"}):r.length?e.jsx("div",{className:"grid gap-3",children:r.map(n=>{var B;const _=a.selectedTimeboxId===n.id,H=ae({...n,actionProfile:a.customSustainRateApPerHour!==null||a.activityPresetKey!=="task_inherited"?{id:"suggested-preview",profileKey:"suggested-preview",title:n.title,entityType:"task_timebox",mode:"container",startupAp:0,totalCostAp:0,expectedDurationSeconds:null,sustainRateApPerHour:a.customSustainRateApPerHour??((B=q().find(x=>x.key===a.activityPresetKey))==null?void 0:B.defaultRateApPerHour)??100/24,demandWeights:{activation:.1,focus:.3,vigor:.1,composure:.1,flow:.4},doubleCountPolicy:"container_only",sourceMethod:"manual",costBand:"light",recoveryEffect:0,metadata:{},createdAt:n.startsAt,updatedAt:n.startsAt}:null});return e.jsxs("button",{type:"button",onClick:()=>d({selectedTimeboxId:n.id}),className:`rounded-[24px] border px-4 py-4 text-left transition ${_?"border-[color-mix(in_srgb,var(--primary)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)] shadow-[var(--ui-shadow-soft)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)] hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]"}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium",children:n.title}),e.jsx(h,{className:p,children:n.source})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:J(n.startsAt,n.endsAt)}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(h,{className:p,children:se(H.rateApPerHour)}),e.jsx(h,{className:p,children:z(H.totalAp)})]}),_?e.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-2",children:[e.jsx(y,{label:"Activity profile",children:e.jsx("select",{value:a.activityPresetKey??"task_inherited",onChange:x=>d({activityPresetKey:x.target.value}),className:ee,children:q().map(x=>e.jsx("option",{value:x.key,children:x.label},x.key))})}),e.jsx(y,{label:"Custom AP per hour",children:e.jsx(C,{type:"number",min:0,step:.5,value:a.customSustainRateApPerHour??"",onChange:x=>d({customSustainRateApPerHour:x.target.value.trim()===""?null:Number(x.target.value)}),placeholder:"Leave empty to use the activity profile"})})]}):null]},n.id)})}):e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:"rounded-[24px] border border-[color-mix(in_srgb,var(--warning)_24%,var(--ui-border-subtle)_76%)] bg-[var(--ui-warning-soft)] px-4 py-4 text-sm leading-6 text-[color-mix(in_srgb,var(--warning)_72%,var(--ui-ink-strong)_28%)]",children:"Forge could not find a valid slot on this day. Try another day, adjust the task rules, or switch to manual placement if you already know the right block."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Y,{variant:"secondary",onClick:()=>void D.refetch(),children:"Refresh suggestions"}),e.jsx(Y,{variant:"secondary",onClick:()=>d({plannerMode:"manual"}),children:"Switch to manual"})]})]})}}],[w,X.isLoading,V,Z,T,i.plannerMode,t,v,g,F,Q,M,l,D.data,D.isLoading,me,ue,c]);return e.jsx(Fe,{open:s,onOpenChange:o,eyebrow:"Calendar",title:L?"Edit timebox":"Plan work",description:L?"Update the day, hour range, title, and AP profile for this scheduled block without leaving the task or calendar view.":"Review the day, let Forge recommend valid slots, and place a real timebox on the task without leaving the detail view.",value:i,onChange:O,draftPersistenceKey:t?`calendar.timebox.${t.id}`:`calendar.timebox.new.${(l==null?void 0:l.id)??"unscoped"}`,steps:Ce,submitLabel:L?"Save timebox":"Schedule timebox",pending:Pe,pendingLabel:"Scheduling",error:Ae,contentClassName:"md:w-[min(70rem,calc(100vw-1.5rem))]",onSubmit:async()=>{if(!l){b("Choose a task before scheduling a timebox.");return}if(i.plannerMode==="manual"){if(!S||!R){b("Choose a valid manual start and end time.");return}if(R<=S){b("The manual timebox needs an end time after the start time.");return}b(null),W(!0);try{const a={title:i.manualTitle.trim()||l.title,startsAt:S.toISOString(),endsAt:R.toISOString(),overrideReason:i.overrideReason.trim()||null,activityPresetKey:i.activityPresetKey,customSustainRateApPerHour:i.customSustainRateApPerHour};t&&k?await k(t.id,a):await I({taskId:l.id,projectId:l.projectId,...a,source:"manual"}),o(!1)}catch(a){b(a instanceof Error?a.message:"Forge could not create the manual timebox.")}finally{W(!1)}return}if(!K){b("Pick one suggested slot before scheduling the timebox.");return}b(null),W(!0);try{const a={title:K.title,startsAt:K.startsAt,endsAt:K.endsAt,activityPresetKey:i.activityPresetKey,customSustainRateApPerHour:i.customSustainRateApPerHour};t&&k?await k(t.id,a):await I({taskId:l.id,projectId:l.projectId,...a,source:K.source}),o(!1)}catch(a){b(a instanceof Error?a.message:"Forge could not create the selected timebox.")}finally{W(!1)}}})}export{Je as T,Xe as a};
1
+ import{r as j,j as e,aG as Ie}from"./vendor-BwL6m4SE.js";import{S as Re}from"./scheduling-rules-editor-CAd290IE.js";import{aA as _e,C as ye,B as Y,x as ae,o as q,k as h,n as z,I as C,m as se,c6 as Ee,N as Le}from"./index-izRKx6JK.js";import{i as je}from"./state-Bpe5dF3T.js";import{F as y,a as Me,Q as Fe}from"./question-flow-dialog-D-_EvoAt.js";import{f as $e}from"./calendar-ui-Cy1XRwzV.js";function Je({open:s,onOpenChange:o,tasks:m,onSave:v}){const c=j.useMemo(()=>m.filter(f=>f.status!=="done"),[m]),[I,k]=j.useState("");j.useEffect(()=>{if(s){if(c.length===0){k("");return}k(f=>f&&c.some(g=>g.id===f)?f:c[0].id)}},[c,s]);const N=c.find(f=>f.id===I)??null;return e.jsx(_e,{open:s,onOpenChange:o,eyebrow:"Calendar",title:"Adjust task scheduling rules",description:"Choose a task, then tell Forge which work blocks, calendar conditions, or keywords should allow or block that work.",children:e.jsxs("div",{className:"grid min-w-0 gap-4",children:[e.jsx(ye,{className:"min-w-0 overflow-hidden rounded-[28px] border border-[var(--ui-border-subtle)] !bg-[var(--ui-surface-1)]",children:e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx("div",{className:"rounded-[18px] bg-[var(--primary)]/14 p-3 text-[var(--primary)]",children:e.jsx(Ie,{className:"size-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:"Guided rule editing"}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Use this when a task should only run in certain blocks such as Secondary Activity, or should stay blocked during clinic, rest, or other provider events."})]})]})}),c.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"grid min-w-0 gap-2",children:[e.jsx("span",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Task"}),e.jsx("select",{value:I,onChange:f=>k(f.target.value),className:"w-full min-w-0 max-w-full rounded-[22px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3 text-[15px] text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--ui-border-strong)] focus:ring-2 focus:ring-[var(--primary)]/20",children:c.map(f=>e.jsx("option",{value:f.id,children:f.title},f.id))})]}),N?e.jsx(Re,{title:"Task rules",subtitle:"These rules are saved directly on the task. They drive blocked-now checks and future timebox recommendations.",initialRules:N.schedulingRules,initialPlannedDurationSeconds:N.plannedDurationSeconds,allowPlannedDuration:!0,saveLabel:"Save task rules",onSave:async({schedulingRules:f,plannedDurationSeconds:g})=>{await v({taskId:N.id,schedulingRules:f,plannedDurationSeconds:g===void 0?N.plannedDurationSeconds:g??null}),o(!1)}}):null]}):e.jsxs(ye,{className:"min-w-0 overflow-hidden rounded-[28px] border border-[var(--ui-border-subtle)] !bg-[var(--ui-surface-1)]",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:"No schedulable tasks yet"}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Create or reopen a task first, then come back here to define work-block and calendar eligibility."}),e.jsx("div",{className:"mt-4",children:e.jsx(Y,{variant:"secondary",onClick:()=>o(!1),children:"Close"})})]})]})})}function E(s){return s.slice(0,10)}function Ke(s){return new Date(`${s}T00:00:00`).toISOString()}function He(s){return new Date(`${s}T23:59:59.999`).toISOString()}function re(s,o,m){return s<o?o:s>m?m:s}function we(s,o){const m=E(s),v=E(o),c=new Date(`${m}T12:00:00`);return c.setDate(c.getDate()+1),re(E(c.toISOString()),m,v)}function be(s){return String(s).padStart(2,"0")}function G(s){return`${be(s.getHours())}:${be(s.getMinutes())}`}function ke(s,o){if(!s||!o)return null;const m=new Date(`${s}T${o}:00`);return Number.isNaN(m.getTime())?null:m}function U(s,o,m){if(m){const k=new Date(m.startsAt),N=new Date(m.endsAt);return{startTime:G(k),endTime:G(N)}}const v=new Date(`${s}T09:00:00`),c=Math.max(1800,Math.min(o??3600,360*60)),I=new Date(v.getTime()+c*1e3);return{startTime:G(v),endTime:G(I)}}function Ne(s,o){return`${new Date(s).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} - ${new Date(o).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`}function J(s,o){return`${$e(new Date(s))} · ${Ne(s,o)}`}const Se="rounded-[24px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)]",ne="rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",p="bg-[var(--ui-surface-1)] text-[var(--ui-ink-medium)]",ee="rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-4 py-3 text-[15px] text-[var(--ui-ink-strong)] outline-none transition focus:border-[var(--ui-border-strong)] focus:ring-2 focus:ring-[var(--primary)]/20";function te({title:s,subtitle:o,emptyLabel:m,children:v}){const c=Array.isArray(v)?v:v?[v]:[];return e.jsxs("div",{className:`${Se} p-4`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:o})]}),e.jsx(h,{className:p,children:c.length})]}),e.jsx("div",{className:"mt-3 grid gap-2",children:c.length>0?c:e.jsx("div",{className:"rounded-[18px] border border-dashed border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-3 text-sm text-[var(--ui-ink-muted)]",children:m})})]})}function Be({event:s}){return e.jsxs("div",{className:`${ne} px-3 py-3`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s.title}),e.jsx(h,{className:p,children:s.availability})]}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:J(s.startAt,s.endAt)})]})}function Oe({block:s}){return e.jsxs("div",{className:`${ne} px-3 py-3`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s.title}),e.jsx(h,{className:p,children:s.blockingState})]}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:J(s.startAt,s.endAt)})]})}function We({timebox:s}){const o=ae(s);return e.jsxs("div",{className:`${ne} px-3 py-3`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:s.title}),e.jsx(h,{className:p,children:s.source})]}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:J(s.startsAt,s.endsAt)}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[e.jsx(h,{className:p,children:se(o.rateApPerHour)}),e.jsx(h,{className:p,children:z(o.totalAp)})]})]})}function Xe({open:s,onOpenChange:o,tasks:m,from:v,to:c,onCreateTimebox:I,onUpdateTimebox:k,onDeleteTimebox:N,initialTaskId:f,lockedTaskId:g,editingTimebox:t,userIds:le}){var he,pe,fe,ve,ge,xe;const L=!!t,w=j.useMemo(()=>{const a=g??(t==null?void 0:t.taskId)??null,d=m.filter(u=>u.status!=="done"||u.id===a);if(!a)return d;const r=d.find(u=>u.id===a);return r?[r]:[]},[t==null?void 0:t.taskId,g,m]),M=E(v),F=E(c),ie=t?re(E(t.startsAt),M,F):we(v,c),oe=g??(t==null?void 0:t.taskId)??f??((he=w[0])==null?void 0:he.id)??"",$=w.find(a=>a.id===oe)??w[0]??null,de=U(ie,$==null?void 0:$.plannedDurationSeconds,t?{startsAt:t.startsAt,endsAt:t.endsAt}:null),[i,O]=j.useState({taskId:oe,preferredDate:ie,plannerMode:t?"manual":"suggested",selectedTimeboxId:"",activityPresetKey:((pe=t==null?void 0:t.actionProfile)==null?void 0:pe.profileKey)??"task_inherited",customSustainRateApPerHour:((fe=t==null?void 0:t.actionProfile)==null?void 0:fe.sourceMethod)==="manual"?t.actionProfile.sustainRateApPerHour:null,manualStartTime:de.startTime,manualEndTime:de.endTime,manualTitle:(t==null?void 0:t.title)??($==null?void 0:$.title)??"",overrideReason:(t==null?void 0:t.overrideReason)??""}),[Ae,b]=j.useState(null),[Pe,W]=j.useState(!1),[De,ce]=j.useState(!1);j.useEffect(()=>{var _,H,B;if(!s)return;const a=g??f??((_=w[0])==null?void 0:_.id)??"",d=(t==null?void 0:t.taskId)??a,r=w.find(x=>x.id===d)??w[0]??null,u=t?re(E(t.startsAt),M,F):we(v,c),n=U(u,r==null?void 0:r.plannedDurationSeconds,t?{startsAt:t.startsAt,endsAt:t.endsAt}:null);b(null),O({taskId:d,preferredDate:u,plannerMode:t?"manual":"suggested",selectedTimeboxId:"",activityPresetKey:((H=t==null?void 0:t.actionProfile)==null?void 0:H.profileKey)??"task_inherited",customSustainRateApPerHour:((B=t==null?void 0:t.actionProfile)==null?void 0:B.sourceMethod)==="manual"?t.actionProfile.sustainRateApPerHour:null,manualStartTime:n.startTime,manualEndTime:n.endTime,manualTitle:(t==null?void 0:t.title)??(r==null?void 0:r.title)??"",overrideReason:(t==null?void 0:t.overrideReason)??""})},[w,t,v,f,g,F,M,s,c]);const l=w.find(a=>a.id===i.taskId)??null,P=j.useMemo(()=>({from:Ke(i.preferredDate),to:He(i.preferredDate)}),[i.preferredDate]),D=je({queryKey:["forge-calendar-suggestions-dialog",i.taskId,P.from,P.to],queryFn:()=>Ee({taskId:i.taskId,from:P.from,to:P.to,limit:8}),enabled:s&&i.taskId.length>0}),X=je({queryKey:["forge-calendar-timebox-dialog-day",P.from,P.to,...le??[]],queryFn:()=>Le({from:P.from,to:P.to,userIds:le}),enabled:s});j.useEffect(()=>{var d;if(!s)return;const a=((d=D.data)==null?void 0:d.timeboxes)??[];if(!a.length){O(r=>r.selectedTimeboxId?{...r,selectedTimeboxId:""}:r);return}O(r=>r.selectedTimeboxId&&a.some(u=>u.id===r.selectedTimeboxId)?r:{...r,selectedTimeboxId:a[0].id})},[s,D.data]);const A=(ve=X.data)==null?void 0:ve.calendar,Z=(A==null?void 0:A.events)??[],V=(A==null?void 0:A.workBlockInstances)??[],T=(A==null?void 0:A.timeboxes)??[],K=(((ge=D.data)==null?void 0:ge.timeboxes)??[]).find(a=>a.id===i.selectedTimeboxId),S=ke(i.preferredDate,i.manualStartTime),R=ke(i.preferredDate,i.manualEndTime),Q=S&&R?ae({startsAt:S.toISOString(),endsAt:R.toISOString(),actionProfile:i.customSustainRateApPerHour!==null||i.activityPresetKey!=="task_inherited"?{id:"manual-preview",profileKey:"manual-preview",title:i.manualTitle||(l==null?void 0:l.title)||"Manual timebox",entityType:"task_timebox",mode:"container",startupAp:0,totalCostAp:0,expectedDurationSeconds:null,sustainRateApPerHour:i.customSustainRateApPerHour??((xe=q().find(a=>a.key===i.activityPresetKey))==null?void 0:xe.defaultRateApPerHour)??100/24,demandWeights:{activation:.1,focus:.3,vigor:.1,composure:.1,flow:.4},doubleCountPolicy:"container_only",sourceMethod:"manual",costBand:"light",recoveryEffect:0,metadata:{},createdAt:S.toISOString(),updatedAt:S.toISOString()}:null}):null,ue=L?"Review the task tied to this scheduled block":g?"Review the task you are planning":"Choose the task you want to place into the calendar",me=L?"The timebox stays linked to this task. Update the day, hours, title, or AP profile without leaving the planning flow.":g?"Forge will use this task's current duration target and scheduling rules while it looks for viable slots.":"Forge will use the task's current planned duration and scheduling rules when it searches for valid slots.",Ce=j.useMemo(()=>[{id:"task",eyebrow:"Planning",title:ue,description:me,render:(a,d)=>e.jsxs("div",{className:"grid min-w-0 max-w-full gap-4 overflow-hidden",children:[g?null:e.jsx(y,{label:"Task",children:e.jsx("select",{value:a.taskId,onChange:r=>(()=>{const u=w.find(_=>_.id===r.target.value),n=U(a.preferredDate,u==null?void 0:u.plannedDurationSeconds);d({taskId:r.target.value,selectedTimeboxId:"",activityPresetKey:"task_inherited",customSustainRateApPerHour:null,manualStartTime:n.startTime,manualEndTime:n.endTime,manualTitle:(u==null?void 0:u.title)??a.manualTitle})})(),className:ee,children:w.map(r=>e.jsx("option",{value:r.id,children:r.title},r.id))})}),l?e.jsxs("div",{className:"min-w-0 max-w-full overflow-hidden rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5 shadow-[var(--ui-shadow-soft)]",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:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Time Box"}),e.jsx("div",{className:"mt-2 break-words font-display text-[1.4rem] leading-tight text-[var(--ui-ink-strong)]",children:l.title})]}),e.jsx(h,{className:p,children:l.status})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(h,{className:p,children:l.plannedDurationSeconds?`${Math.round(l.plannedDurationSeconds/60)} min target`:"No duration yet"}),e.jsx(h,{className:p,children:l.schedulingRules?"Task-specific rules":"Uses project rules"}),e.jsxs(h,{className:p,children:[l.points," xp"]}),l.plannedDurationSeconds?e.jsxs(h,{className:p,children:[z(l.plannedDurationSeconds/3600/24*100)," ","target load"]}):null]}),e.jsx("p",{className:"mt-4 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"Pick a day first, then either accept one of Forge's suggested slots or set the block manually."}),L&&t&&N?e.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3 rounded-[20px] border border-[color-mix(in_srgb,var(--danger)_24%,var(--ui-border-subtle)_76%)] bg-[var(--ui-danger-soft)] px-4 py-3",children:[e.jsx("div",{className:"text-sm leading-6 text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)]",children:"Remove this planned timebox if you no longer want it in the calendar."}),e.jsx(Y,{type:"button",variant:"ghost",className:"text-[color-mix(in_srgb,var(--danger)_76%,var(--ui-ink-strong)_24%)] hover:bg-[var(--ui-danger-soft)]",pending:De,pendingLabel:"Deleting",onClick:()=>void(async()=>{b(null),ce(!0);try{await N(t.id),o(!1)}catch(r){b(r instanceof Error?r.message:"Forge could not delete this timebox.")}finally{ce(!1)}})(),children:"Delete timebox"})]}):null]}):null]})},{id:"day",eyebrow:"Calendar",title:"Choose the day and review what is already there",description:"Forge reads the real day first so the timebox stays grounded in your provider events, work blocks, and already-planned work.",render:(a,d)=>e.jsx("div",{className:"grid gap-5",children:e.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,16rem)_minmax(0,1fr)]",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsx(y,{label:"Date",description:"Choose the day you want to protect for this task.",children:e.jsx(C,{type:"date",min:M,max:F,value:a.preferredDate,onChange:r=>{const u=U(r.target.value,l==null?void 0:l.plannedDurationSeconds,t?{startsAt:`${r.target.value}T${a.manualStartTime}:00`,endsAt:`${r.target.value}T${a.manualEndTime}:00`}:null);d({preferredDate:r.target.value,selectedTimeboxId:"",manualStartTime:u.startTime,manualEndTime:u.endTime})}})}),e.jsx(y,{label:"Planning style",description:"Take Forge's slot recommendation when it fits, or set the block yourself.",children:e.jsx(Me,{value:a.plannerMode,onChange:r=>d({plannerMode:r}),options:[{value:"suggested",label:"Use suggestions",description:"Forge proposes slots that fit the task rules and the selected day."},{value:"manual",label:"Set it manually",description:"You choose the exact start and end time yourself."}]})})]}),e.jsxs("div",{className:"rounded-[28px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-muted)]",children:"Selected day"}),e.jsx("div",{className:"mt-2 font-display text-[1.3rem] leading-tight text-[var(--ui-ink-strong)]",children:a.preferredDate?new Date(`${a.preferredDate}T12:00:00`).toLocaleDateString([],{weekday:"long",month:"long",day:"numeric"}):"Choose a day"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(h,{className:p,children:[Z.length," events"]}),e.jsxs(h,{className:p,children:[V.length," work blocks"]}),e.jsxs(h,{className:p,children:[T.length," timeboxes"]})]})]}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-[var(--ui-ink-soft)]",children:"This is the context Forge will use while recommending a slot. You can still place the block manually if you want something more exact."}),X.isLoading?e.jsx("div",{className:"mt-4 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] px-4 py-4 text-sm text-[var(--ui-ink-soft)]",children:"Loading the selected day…"}):e.jsxs("div",{className:"mt-4 grid gap-4 xl:grid-cols-3",children:[e.jsx(te,{title:"Provider events",subtitle:"Busy or free events already on the day.",emptyLabel:"No mirrored events on this day.",children:Z.slice(0,4).map(r=>e.jsx(Be,{event:r},r.id))}),e.jsx(te,{title:"Work blocks",subtitle:"Recurring allowed or blocked containers.",emptyLabel:"No work blocks land on this day.",children:V.slice(0,4).map(r=>e.jsx(Oe,{block:r},r.id))}),e.jsx(te,{title:"Planned timeboxes",subtitle:"Existing owned work already placed there.",emptyLabel:"No other planned timeboxes yet.",children:T.slice(0,4).map(r=>e.jsx(We,{timebox:r},r.id))})]})]})]})})},{id:"slot",eyebrow:i.plannerMode==="suggested"?"Suggestion":"Manual",title:i.plannerMode==="suggested"?"Choose one of Forge's suggested slots":"Set the exact timebox yourself",description:i.plannerMode==="suggested"?"Forge proposes slots that fit the selected day, the task rules, and the current calendar picture.":"Use manual mode when the right block is obvious to you or when you want to place the timebox despite imperfect recommendations.",render:(a,d)=>{var u;if(a.plannerMode==="manual")return e.jsxs("div",{className:"grid gap-5",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsx(y,{label:"Day",description:"Pick the day for the block. Forge defaults to a future day, but you can move it.",children:e.jsx(C,{type:"date",min:M,max:F,value:a.preferredDate,onChange:n=>d({preferredDate:n.target.value})})}),e.jsx(y,{label:"Start time",description:"Choose when the protected work block should begin.",children:e.jsx(C,{type:"time",step:300,value:a.manualStartTime,onChange:n=>d({manualStartTime:n.target.value})})}),e.jsx(y,{label:"End time",description:"Choose when the work block should end.",children:e.jsx(C,{type:"time",step:300,value:a.manualEndTime,onChange:n=>d({manualEndTime:n.target.value})})})]}),e.jsx(y,{label:"Title",description:"By default Forge uses the task title. Tighten it only if a shorter calendar label would help.",children:e.jsx(C,{value:a.manualTitle,onChange:n=>d({manualTitle:n.target.value}),placeholder:(l==null?void 0:l.title)??"Task timebox"})}),e.jsx(y,{label:"Override reason",description:"Optional. Add a short reason only if you are intentionally placing the block despite the normal rules or calendar shape.",children:e.jsx(C,{value:a.overrideReason,onChange:n=>d({overrideReason:n.target.value}),placeholder:"Protected writing block before clinic."})}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsx(y,{label:"Activity profile",children:e.jsx("select",{value:a.activityPresetKey??"task_inherited",onChange:n=>d({activityPresetKey:n.target.value}),className:ee,children:q().map(n=>e.jsx("option",{value:n.key,children:n.label},n.key))})}),e.jsx(y,{label:"Custom AP per hour",children:e.jsx(C,{type:"number",min:0,step:.5,value:a.customSustainRateApPerHour??"",onChange:n=>d({customSustainRateApPerHour:n.target.value.trim()===""?null:Number(n.target.value)}),placeholder:"Leave empty to use the activity profile"})})]}),e.jsxs("div",{className:`${Se} p-4`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:a.manualTitle||(l==null?void 0:l.title)||"Manual timebox"}),e.jsx("div",{className:"mt-1 text-sm text-[var(--ui-ink-soft)]",children:S&&R?`${S.toLocaleDateString([],{weekday:"long",month:"short",day:"numeric"})} · ${Ne(S.toISOString(),R.toISOString())}`:"Choose a start and end time."})]}),e.jsx(h,{className:p,children:"manual"})]}),Q?e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(h,{className:p,children:se(Q.rateApPerHour)}),e.jsx(h,{className:p,children:z(Q.totalAp)})]}):null]})]});const r=((u=D.data)==null?void 0:u.timeboxes)??[];return D.isLoading?e.jsx("div",{className:"text-sm text-[var(--ui-ink-soft)]",children:"Looking for valid slots on the selected day…"}):r.length?e.jsx("div",{className:"grid gap-3",children:r.map(n=>{var B;const _=a.selectedTimeboxId===n.id,H=ae({...n,actionProfile:a.customSustainRateApPerHour!==null||a.activityPresetKey!=="task_inherited"?{id:"suggested-preview",profileKey:"suggested-preview",title:n.title,entityType:"task_timebox",mode:"container",startupAp:0,totalCostAp:0,expectedDurationSeconds:null,sustainRateApPerHour:a.customSustainRateApPerHour??((B=q().find(x=>x.key===a.activityPresetKey))==null?void 0:B.defaultRateApPerHour)??100/24,demandWeights:{activation:.1,focus:.3,vigor:.1,composure:.1,flow:.4},doubleCountPolicy:"container_only",sourceMethod:"manual",costBand:"light",recoveryEffect:0,metadata:{},createdAt:n.startsAt,updatedAt:n.startsAt}:null});return e.jsxs("button",{type:"button",onClick:()=>d({selectedTimeboxId:n.id}),className:`rounded-[24px] border px-4 py-4 text-left transition ${_?"border-[color-mix(in_srgb,var(--primary)_30%,var(--ui-border-subtle)_70%)] bg-[var(--ui-accent-soft)] text-[var(--ui-ink-strong)] shadow-[var(--ui-shadow-soft)]":"border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] text-[var(--ui-ink-medium)] hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)]"}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium",children:n.title}),e.jsx(h,{className:p,children:n.source})]}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:J(n.startsAt,n.endsAt)}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(h,{className:p,children:se(H.rateApPerHour)}),e.jsx(h,{className:p,children:z(H.totalAp)})]}),_?e.jsxs("div",{className:"mt-4 grid gap-4 md:grid-cols-2",children:[e.jsx(y,{label:"Activity profile",children:e.jsx("select",{value:a.activityPresetKey??"task_inherited",onChange:x=>d({activityPresetKey:x.target.value}),className:ee,children:q().map(x=>e.jsx("option",{value:x.key,children:x.label},x.key))})}),e.jsx(y,{label:"Custom AP per hour",children:e.jsx(C,{type:"number",min:0,step:.5,value:a.customSustainRateApPerHour??"",onChange:x=>d({customSustainRateApPerHour:x.target.value.trim()===""?null:Number(x.target.value)}),placeholder:"Leave empty to use the activity profile"})})]}):null]},n.id)})}):e.jsxs("div",{className:"grid gap-3",children:[e.jsx("div",{className:"rounded-[24px] border border-[color-mix(in_srgb,var(--warning)_24%,var(--ui-border-subtle)_76%)] bg-[var(--ui-warning-soft)] px-4 py-4 text-sm leading-6 text-[color-mix(in_srgb,var(--warning)_72%,var(--ui-ink-strong)_28%)]",children:"Forge could not find a valid slot on this day. Try another day, adjust the task rules, or switch to manual placement if you already know the right block."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(Y,{variant:"secondary",onClick:()=>void D.refetch(),children:"Refresh suggestions"}),e.jsx(Y,{variant:"secondary",onClick:()=>d({plannerMode:"manual"}),children:"Switch to manual"})]})]})}}],[w,X.isLoading,V,Z,T,i.plannerMode,t,v,g,F,Q,M,l,D.data,D.isLoading,me,ue,c]);return e.jsx(Fe,{open:s,onOpenChange:o,eyebrow:"Calendar",title:L?"Edit timebox":"Plan work",description:L?"Update the day, hour range, title, and AP profile for this scheduled block without leaving the task or calendar view.":"Review the day, let Forge recommend valid slots, and place a real timebox on the task without leaving the detail view.",value:i,onChange:O,draftPersistenceKey:t?`calendar.timebox.${t.id}`:`calendar.timebox.new.${(l==null?void 0:l.id)??"unscoped"}`,steps:Ce,submitLabel:L?"Save timebox":"Schedule timebox",pending:Pe,pendingLabel:"Scheduling",error:Ae,contentClassName:"md:w-[min(70rem,calc(100vw-1.5rem))]",onSubmit:async()=>{if(!l){b("Choose a task before scheduling a timebox.");return}if(i.plannerMode==="manual"){if(!S||!R){b("Choose a valid manual start and end time.");return}if(R<=S){b("The manual timebox needs an end time after the start time.");return}b(null),W(!0);try{const a={title:i.manualTitle.trim()||l.title,startsAt:S.toISOString(),endsAt:R.toISOString(),overrideReason:i.overrideReason.trim()||null,activityPresetKey:i.activityPresetKey,customSustainRateApPerHour:i.customSustainRateApPerHour};t&&k?await k(t.id,a):await I({taskId:l.id,projectId:l.projectId,...a,source:"manual"}),o(!1)}catch(a){b(a instanceof Error?a.message:"Forge could not create the manual timebox.")}finally{W(!1)}return}if(!K){b("Pick one suggested slot before scheduling the timebox.");return}b(null),W(!0);try{const a={title:K.title,startsAt:K.startsAt,endsAt:K.endsAt,activityPresetKey:i.activityPresetKey,customSustainRateApPerHour:i.customSustainRateApPerHour};t&&k?await k(t.id,a):await I({taskId:l.id,projectId:l.projectId,...a,source:K.source}),o(!1)}catch(a){b(a instanceof Error?a.message:"Forge could not create the selected timebox.")}finally{W(!1)}}})}export{Je as T,Xe as a};
@@ -1 +1 @@
1
- import{j as y}from"./vendor-BwL6m4SE.js";import{a as r,j as i,e as m,d as l,g as f,b as x,f as h,c as p}from"./generic-node-view-C6DK5hJ6.js";import{d as S}from"./define-workbench-box-CpG0Zb1L.js";function k({children:e}){return y.jsx(y.Fragment,{children:e})}function t(e,o,c,b,T,s,n=[],a){const d=(a==null?void 0:a.inputs)??[],u=(a==null?void 0:a.params)??[];return S(k,{id:e,surfaceId:"today",routePath:"/today",title:o,icon:"today",description:c,category:"Today",tags:b,inputs:d,params:u,output:s,tools:n,NodeView:p({title:o,description:c,inputs:d,params:u,output:s,tools:n}),execute:T})}const v=t("surface:today:hero","Today hero","Daily execution header and directive.",["today","hero"],e=>i(e,null,"Daily execution header."),[r({label:"Today summary",description:"High-level framing for today's execution."})]),w=t("surface:today:metrics","Live metrics","Daily XP, level, and momentum metrics.",["today","metrics"],e=>i(e,null,"Daily metrics."),[r({label:"Metrics summary",description:"Summary of today's XP, level, and momentum metrics."})]),g=t("surface:today:runway","Runway","Execution lane and current work.",["today","execution"],e=>h(e,{query:"",entityTypes:["task","habit"],limit:16}),x({itemKind:"execution_item",itemLabel:"Execution item"}),[f("Search today's active tasks and habits by query and entity types.")],{inputs:l({itemKind:"execution_item",itemLabel:"Execution item",defaultEntityTypes:["task","habit"],defaultLimit:16}),params:m()}),C=t("surface:today:calendar","Calendar","Calendar context for today.",["today","calendar"],e=>i(e,null,"Today's calendar context."),[r({label:"Calendar summary",description:"Summary of today's calendar context."})]),j=t("surface:today:focus","Current focus","Today priorities and focus context.",["today","focus"],e=>h(e,{query:"",entityTypes:["task","habit"],limit:16}),x({itemKind:"focus_item",itemLabel:"Focus item"}),[f("Search today's priority tasks and habits by query and entity types.")],{inputs:l({itemKind:"focus_item",itemLabel:"Focus item",defaultEntityTypes:["task","habit"],defaultLimit:16}),params:m()});export{v as T,w as a,g as b,C as c,j as d};
1
+ import{j as y}from"./vendor-BwL6m4SE.js";import{a as r,j as i,e as m,d as l,g as f,b as x,f as h,c as p}from"./generic-node-view-DNVwfqqq.js";import{d as S}from"./define-workbench-box-DcI0_QKW.js";function k({children:e}){return y.jsx(y.Fragment,{children:e})}function t(e,o,c,b,T,s,n=[],a){const d=(a==null?void 0:a.inputs)??[],u=(a==null?void 0:a.params)??[];return S(k,{id:e,surfaceId:"today",routePath:"/today",title:o,icon:"today",description:c,category:"Today",tags:b,inputs:d,params:u,output:s,tools:n,NodeView:p({title:o,description:c,inputs:d,params:u,output:s,tools:n}),execute:T})}const v=t("surface:today:hero","Today hero","Daily execution header and directive.",["today","hero"],e=>i(e,null,"Daily execution header."),[r({label:"Today summary",description:"High-level framing for today's execution."})]),w=t("surface:today:metrics","Live metrics","Daily XP, level, and momentum metrics.",["today","metrics"],e=>i(e,null,"Daily metrics."),[r({label:"Metrics summary",description:"Summary of today's XP, level, and momentum metrics."})]),g=t("surface:today:runway","Runway","Execution lane and current work.",["today","execution"],e=>h(e,{query:"",entityTypes:["task","habit"],limit:16}),x({itemKind:"execution_item",itemLabel:"Execution item"}),[f("Search today's active tasks and habits by query and entity types.")],{inputs:l({itemKind:"execution_item",itemLabel:"Execution item",defaultEntityTypes:["task","habit"],defaultLimit:16}),params:m()}),C=t("surface:today:calendar","Calendar","Calendar context for today.",["today","calendar"],e=>i(e,null,"Today's calendar context."),[r({label:"Calendar summary",description:"Summary of today's calendar context."})]),j=t("surface:today:focus","Current focus","Today priorities and focus context.",["today","focus"],e=>h(e,{query:"",entityTypes:["task","habit"],limit:16}),x({itemKind:"focus_item",itemLabel:"Focus item"}),[f("Search today's priority tasks and habits by query and entity types.")],{inputs:l({itemKind:"focus_item",itemLabel:"Focus item",defaultEntityTypes:["task","habit"],defaultLimit:16}),params:m()});export{v as T,w as a,g as b,C as c,j as d};
@@ -1 +1 @@
1
- import{j as e,aC as b,bW as L,b9 as C,bF as X,b6 as F,r as D,aV as O,cv as M}from"./vendor-BwL6m4SE.js";import{i as U}from"./state-Bpe5dF3T.js";import{A as z}from"./ai-surface-workspace-CF0257Hs.js";import{T as Q,W as V,M as q,S as K,Q as G}from"./utility-widgets-ilORjDmg.js";import{E as H}from"./entity-note-count-link-Bs1aKYyD.js";import{u as _,a4 as I,k as x,R as Y,b as S,E,B as J,c as Z,d as ee,h as te,C as k,P as se,N as ae}from"./index-FpGANF9S.js";import{S as $}from"./surface-ubuOfukq.js";import{a as ie}from"./life-force-workspace-C7UOnJEf.js";import{P}from"./page-hero-DvrM83_C.js";import{T as ne,a as re,b as oe,c as le,d as de}from"./today-boxes-CYuxSkZf.js";import"./board-CuxQRKPJ.js";import"./generic-node-view-C6DK5hJ6.js";import"./graph-BF4IsheG.js";import"./motion-DcgUnXhY.js";import"./ui-B9TWEtCx.js";import"./forms-D1qJ3oOP.js";import"./floating-action-menu-DAFAEBcA.js";import"./charts-BzT4pUPg.js";import"./define-workbench-box-CpG0Zb1L.js";function A(s,t){return t.find(c=>c.id===s.goalId)??null}function ce(s,t){return s.tagIds.map(c=>t.find(d=>d.id===c)).filter(Boolean)}function me(s,t){(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),t())}function ue(s,t){switch(s.status){case"backlog":return{label:t.backlog,action:"start",icon:C};case"focus":return{label:t.focus,action:"start",icon:C};case"in_progress":return{label:t.in_progress,nextStatus:"done",action:"move",icon:X};case"blocked":return{label:t.blocked,action:"start",icon:C};default:return null}}function xe({tasks:s,timeline:t,goals:c,tags:d,notesSummaryByEntity:N,selectedTaskId:j,onSelectTask:r,onMove:p,onStartTask:f}){const{t:o,formatDate:w}=_(),T={backlog:o("common.dailyRunway.actionBacklog"),focus:o("common.dailyRunway.actionFocus"),in_progress:o("common.dailyRunway.actionProgress"),blocked:o("common.dailyRunway.actionBlocked")};return e.jsxs("div",{className:"grid min-w-0 gap-4 2xl:grid-cols-[minmax(0,1.3fr)_minmax(17rem,0.9fr)]",children:[e.jsxs($,{className:"min-w-0 rounded-[24px]",children:[e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:o("common.dailyRunway.runwayEyebrow")}),e.jsx(I,{content:"These are the tasks that matter most for today. Click a card to open the task details. Use Start to begin work immediately."})]}),e.jsx("h4",{className:"mt-2 font-display text-2xl text-[var(--ui-ink-strong)]",children:o("common.dailyRunway.runwayTitle")})]}),e.jsx(x,{className:"shrink-0 text-[var(--primary)]",children:o(s.length===1?"common.dailyRunway.prioritiesOne":"common.dailyRunway.prioritiesOther",{count:s.length})})]}),e.jsx("div",{className:"mt-4 grid min-w-0 gap-3",children:s.map((a,y)=>{const l=ue(a,T),i=ce(a,d).slice(0,2),n=A(a,c),h=j===a.id,B=Y(N,"task",a.id).count;return e.jsxs("article",{role:"button",tabIndex:0,"aria-pressed":h,className:Z("grid w-full gap-3 rounded-[22px] border px-4 py-4 text-left transition",h?"border-[var(--primary)]/28 bg-[var(--ui-accent-soft)] shadow-[var(--ui-shadow-soft)]":"border-transparent bg-[var(--ui-surface-1)] hover:border-[var(--ui-border-subtle)] hover:bg-[var(--ui-surface-hover)]"),onClick:()=>r(a.id),onKeyDown:m=>me(m,()=>r(a.id)),children:[e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:o("common.dailyRunway.runwayItem",{index:y+1})}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[n?e.jsx(b,{to:`/goals/${n.id}`,className:"min-w-0 max-w-full transition hover:opacity-85",onClick:m=>m.stopPropagation(),children:e.jsx(S,{kind:"goal",label:n.title,compact:!0,gradient:!1})}):e.jsx(S,{kind:"goal",label:o("common.dailyRunway.unassigned"),compact:!0,gradient:!1}),a.time.activeRunCount>0?e.jsx(x,{className:"border-[color-mix(in_srgb,#10b981_24%,transparent)] bg-[color-mix(in_srgb,#10b981_16%,var(--ui-surface-1))] text-[color-mix(in_srgb,#10b981_80%,var(--ui-ink-strong)_20%)]",children:"Live"}):null]}),e.jsx("div",{className:"mt-2",children:e.jsx(b,{to:`/tasks/${a.id}`,className:"block min-w-0 max-w-full transition hover:opacity-85",onClick:m=>m.stopPropagation(),children:e.jsx(E,{kind:"task",label:a.title,variant:"heading",size:"md"})})}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:a.description||o("common.dailyRunway.noNote")})]}),e.jsx(x,{className:"shrink-0 self-start",children:a.status.replaceAll("_"," ")})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(x,{className:"bg-[var(--primary)]/14 text-[var(--primary)]",children:[a.points," xp"]}),e.jsx(H,{entityType:"task",entityId:a.id,count:B}),a.time.totalCreditedSeconds>0?e.jsxs(x,{tone:"meta",children:[Math.floor(a.time.totalCreditedSeconds/60)," min tracked"]}):null,e.jsx(x,{tone:"meta",children:a.effort}),e.jsx(x,{tone:"meta",children:w(a.dueDate)}),i.map(m=>e.jsx(x,{className:"bg-[var(--ui-surface-2)]",style:{color:m.color},children:m.name},m.id))]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:a.owner}),l?e.jsxs(J,{variant:l.action==="start"?"primary":"secondary",className:"px-3 py-2 text-[11px] uppercase tracking-[0.16em]",onClick:async m=>{if(m.stopPropagation(),l.action==="start"){await f(a.id);return}l.nextStatus&&await p(a.id,l.nextStatus)},children:[e.jsx(l.icon,{className:"mr-2 size-3.5"}),l.label]}):null]})]},a.id)})})]}),e.jsxs($,{className:"min-w-0 rounded-[24px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:o("common.dailyRunway.timelineEyebrow")}),e.jsx(I,{content:"This groups today's tasks by status, so you can see what is already moving, what is ready to start, what is blocked, and what is done."})]}),e.jsx("h4",{className:"mt-2 font-display text-2xl text-[var(--ui-ink-strong)]",children:o("common.dailyRunway.timelineTitle")}),e.jsx("div",{className:"mt-4 grid min-w-0 gap-3",children:t.map(a=>e.jsxs($,{muted:!0,className:"min-w-0 overflow-hidden rounded-[20px]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:a.label}),e.jsx(x,{tone:"meta",children:a.tasks.length})]}),e.jsxs("div",{className:"mt-3 grid gap-2",children:[a.tasks.slice(0,3).map(y=>{const l=A(y,c);return e.jsxs(b,{to:`/tasks/${y.id}`,className:"flex min-w-0 items-center justify-between gap-3 overflow-hidden rounded-[16px] bg-[var(--ui-surface-1)] px-3 py-3 text-left transition hover:bg-[var(--ui-surface-hover)]",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(E,{kind:"task",label:y.title,className:"max-w-full",labelClassName:"[overflow-wrap:anywhere]"}),e.jsx("div",{className:"mt-2",children:e.jsx(S,{kind:"goal",label:(l==null?void 0:l.title)??o("common.dailyRunway.unassigned"),compact:!0,gradient:!1})})]}),e.jsx(L,{className:"size-4 shrink-0 text-[var(--ui-ink-faint)]"})]},y.id)}),a.tasks.length===0?e.jsx("div",{className:"text-sm text-[var(--ui-ink-faint)]",children:o("common.dailyRunway.emptyBucket")}):null]})]},a.id))})]})]})}const he=5,g="text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",u="text-[var(--ui-ink-soft)]",v="text-[var(--ui-ink-strong)]",R="min-w-0 rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] shadow-[var(--ui-shadow-soft)]",W="min-w-0 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",pe="inline-flex min-h-10 max-w-full shrink-0 items-center justify-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2 text-xs font-medium text-[var(--ui-ink-medium)] shadow-[var(--ui-shadow-soft)] transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]";function fe(){const s=new Date;s.setHours(0,0,0,0);const t=new Date(s);return t.setDate(t.getDate()+1),{start:s,end:t,from:s.toISOString(),to:t.toISOString()}}function ye(s,t){const c=new Date(s.startAt),d=new Date(s.endAt);return c<t.end&&d>t.start}function ge(s){if(s.isAllDay)return"All day";const t=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"});return`${t.format(new Date(s.startAt))} - ${t.format(new Date(s.endAt))}`}function Be(){var l;const{t:s}=_(),t=ee(),c=F(),d=D.useMemo(()=>fe(),[]),N=Array.isArray(t.selectedUserIds)?t.selectedUserIds:[],j=U({queryKey:["forge-calendar-overview",d.from,d.to,...N],queryFn:()=>ae({from:d.from,to:d.to,userIds:N})}),r=t.snapshot.today.directive.task,p=t.snapshot.today.milestoneRewards.find(i=>!i.completed)??t.snapshot.today.milestoneRewards[0]??null,f=t.snapshot.risk.blockedTasks[0]??t.snapshot.risk.overdueTasks[0]??null,o=Math.max(0,t.snapshot.metrics.nextLevelXp-t.snapshot.metrics.currentLevelXp),w=D.useMemo(()=>{var i;return(((i=j.data)==null?void 0:i.calendar.events)??[]).filter(n=>!n.deletedAt&&n.status!=="cancelled"&&ye(n,d)).sort((n,h)=>new Date(n.startAt).getTime()-new Date(h.startAt).getTime())},[(l=j.data)==null?void 0:l.calendar.events,d]),T=w.slice(0,he);if(!(t.snapshot.lifeForce!==void 0||r!==null||t.snapshot.overview.topTasks.length>0||t.snapshot.today.dueHabits.length>0||t.snapshot.today.dailyQuests.length>0||t.snapshot.today.milestoneRewards.length>0||w.length>0)&&!j.isLoading)return e.jsxs("div",{className:"grid gap-4",children:[e.jsx(P,{title:"Today",titleText:"Today",description:"Start a task, earn XP, and keep today's work clear.",badge:`${t.snapshot.metrics.weeklyXp} weekly xp`}),e.jsx(te,{eyebrow:s("common.todayPage.heroEyebrow"),title:s("common.todayPage.emptyTitle"),description:s("common.todayPage.emptyDescription"),action:e.jsx(b,{to:"/goals",className:"inline-flex min-h-10 min-w-max shrink-0 items-center justify-center rounded-full bg-[var(--primary)] px-4 py-2 text-sm font-medium whitespace-nowrap text-[var(--ui-ink-on-accent)] transition hover:opacity-90",children:s("common.todayPage.emptyAction")})})]});const y=[{id:"hero",title:"Today",description:"Compact page header.",defaultWidth:12,defaultHeight:2,removable:!1,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:()=>e.jsx(ne,{children:e.jsx(P,{title:"Today",titleText:"Today",description:(r==null?void 0:r.description)??"Start one real task, collect XP, and keep today's work moving.",badge:`${t.snapshot.metrics.weeklyXp} weekly xp`})})},{id:"life-force",title:"Life Force",description:"Instant headroom, AP use today, and tiredness signals.",defaultWidth:12,defaultHeight:3,minWidth:5,render:()=>e.jsx(ie,{selectedUserIds:t.selectedUserIds,fallbackLifeForce:t.snapshot.lifeForce,onRefresh:t.refresh})},{id:"metrics",title:"Live metrics",description:"XP, level, and momentum stay visible but lighter than before.",defaultWidth:5,defaultHeight:4,minWidth:4,render:({compact:i})=>e.jsx(re,{children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs(k,{className:"min-w-0 p-4",children:[e.jsx("div",{className:g,children:"Weekly XP"}),e.jsx("div",{className:"mt-2 break-words font-display text-4xl text-[var(--primary)]",children:t.snapshot.metrics.weeklyXp}),e.jsxs("div",{className:`mt-1 text-sm ${u}`,children:[t.snapshot.metrics.totalXp," total XP"]})]}),e.jsxs(k,{className:"min-w-0 p-4",children:[e.jsx("div",{className:g,children:"Level"}),e.jsx("div",{className:`mt-2 font-display text-4xl ${v}`,children:t.snapshot.metrics.level}),e.jsxs("div",{className:`mt-1 text-sm ${u}`,children:[o," xp to the next level"]}),i?null:e.jsx("div",{className:"mt-3",children:e.jsx(se,{value:t.snapshot.metrics.currentLevelXp/t.snapshot.metrics.nextLevelXp*100,tone:"tertiary"})})]}),e.jsxs(k,{className:"min-w-0 p-4",children:[e.jsx("div",{className:g,children:"Momentum"}),e.jsxs("div",{className:`mt-2 font-display text-4xl ${v}`,children:[t.snapshot.metrics.momentumScore,"%"]}),e.jsxs("div",{className:`mt-1 text-sm ${u}`,children:[t.snapshot.metrics.streakDays," day streak"]})]}),e.jsxs(k,{className:"min-w-0 p-4",children:[e.jsx("div",{className:g,children:"Next reward"}),e.jsx("div",{className:`mt-2 break-words text-base font-semibold ${v}`,children:(p==null?void 0:p.title)??"Keep showing up"}),e.jsx("div",{className:`mt-1 text-sm ${u}`,children:(p==null?void 0:p.progressLabel)??"The next visible win comes from a task completion or aligned habit check-in."})]})]})})},{id:"runway",title:"Runway",description:"The execution lane itself can be widened or narrowed.",defaultWidth:7,defaultHeight:6,minWidth:5,render:()=>e.jsx(oe,{children:e.jsx(xe,{tasks:t.snapshot.overview.topTasks,timeline:t.snapshot.today.timeline,goals:t.snapshot.goals,tags:t.snapshot.tags,notesSummaryByEntity:t.snapshot.dashboard.notesSummaryByEntity,selectedTaskId:(r==null?void 0:r.id)??null,onSelectTask:i=>c(`/tasks/${i}`),onStartTask:async i=>{await t.startTaskNow(i)},onMove:async(i,n)=>{await t.patchTaskStatus(i,n)}})})},{id:"calendar",title:"Calendar",description:"Today's events stay grouped with their results instead of splitting search from outcome.",defaultWidth:5,defaultHeight:5,minWidth:4,render:({compact:i})=>e.jsx(le,{children:e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("div",{className:"inline-flex size-10 shrink-0 items-center justify-center rounded-2xl bg-[var(--primary)]/14 text-[var(--primary)]",children:e.jsx(O,{className:"size-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:g,children:"Today's calendar"}),e.jsx("div",{className:`text-sm font-semibold ${v}`,children:new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric"}).format(d.start)}),e.jsxs("div",{className:`text-sm ${u}`,children:[w.length," event",w.length===1?"":"s"]})]})]}),e.jsxs(b,{to:"/calendar",className:pe,children:["Open calendar",e.jsx(M,{className:"size-3.5"})]})]}),w.length===0?e.jsx("div",{className:`${W} px-4 py-4 text-sm ${u}`,children:"Nothing is scheduled yet for today."}):T.map(n=>e.jsxs("button",{type:"button",className:`${W} grid gap-2 px-3 py-3 text-left transition hover:bg-[var(--ui-surface-hover)]`,onClick:()=>c("/calendar"),children:[e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:`truncate text-sm font-medium ${v}`,children:n.title}),e.jsx("div",{className:`mt-1 text-sm ${u}`,children:ge(n)})]}),e.jsx(x,{className:"shrink-0 bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:n.originType==="native"?"Forge":n.originType})]}),!i&&n.description?e.jsx("div",{className:`line-clamp-2 text-sm leading-6 ${u}`,children:n.description}):null]},n.id))]})})},{id:"focus",title:"Current focus",description:"Current task, comeback task, and due habits stay in one movable stack.",defaultWidth:12,defaultHeight:4,minWidth:6,render:({compact:i})=>{var n;return e.jsx(de,{children:e.jsxs("div",{className:"grid min-w-0 gap-4 xl:grid-cols-[minmax(0,1.2fr)_minmax(0,0.8fr)]",children:[e.jsxs("div",{className:`${R} p-4`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:g,children:"Current task"}),r?e.jsx(H,{entityType:"task",entityId:r.id,count:((n=t.snapshot.dashboard.notesSummaryByEntity[`task:${r.id}`])==null?void 0:n.count)??0}):null]}),e.jsx("div",{className:`mt-3 break-words text-base font-semibold ${v}`,children:(r==null?void 0:r.title)??"Pick a task from the runway"}),e.jsx("div",{className:`mt-2 text-sm leading-6 ${u}`,children:(r==null?void 0:r.description)??"Once a task is active, the timer rail and this panel stay aligned."}),r?e.jsx("button",{type:"button",className:"mt-4 inline-flex min-h-10 max-w-full items-center justify-center rounded-2xl border border-[color-mix(in_srgb,var(--primary)_24%,transparent)] bg-[var(--ui-accent-soft)] px-3.5 py-2 text-sm font-medium text-[var(--primary)] shadow-[var(--ui-shadow-soft)] transition hover:bg-[var(--ui-accent-soft-hover)]",onClick:async()=>{await t.startTaskNow(r.id)},children:"Start work"}):null]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:`${R} p-4`,children:[e.jsx("div",{className:g,children:"Recovery task"}),e.jsx("div",{className:`mt-3 break-words text-sm font-semibold ${v}`,children:(f==null?void 0:f.title)??"No blocked or overdue task is dominating today"}),i?null:e.jsx("div",{className:`mt-2 text-sm leading-6 ${u}`,children:(f==null?void 0:f.description)??"If something slips, it will surface here as the clean comeback move."})]}),e.jsxs("div",{className:`${R} p-4`,children:[e.jsx("div",{className:g,children:"Due habits"}),e.jsx("div",{className:"mt-3 grid gap-2",children:t.snapshot.today.dueHabits.slice(0,i?2:3).map(h=>e.jsxs("div",{className:`${W} flex items-center justify-between gap-3 px-3 py-2.5`,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:`truncate text-sm font-medium ${v}`,children:h.title}),i?null:e.jsx("div",{className:`text-sm ${u}`,children:h.frequency})]}),e.jsxs(x,{className:"shrink-0 bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_78%,var(--ui-ink-strong)_22%)]",children:[h.rewardXp," xp"]})]},h.id))})]})]})]})})}},{id:"time",title:"Clock",description:"Optional utility widget.",defaultWidth:3,defaultHeight:2,defaultHidden:!0,render:({compact:i})=>e.jsx(Q,{compact:i})},{id:"weather",title:"Weather",description:"Optional utility widget.",defaultWidth:3,defaultHeight:2,defaultHidden:!0,render:({compact:i})=>e.jsx(V,{compact:i})},{id:"mini-calendar",title:"Mini calendar",description:"Optional utility widget.",defaultWidth:4,defaultHeight:3,defaultHidden:!0,render:({compact:i})=>e.jsx(q,{compact:i})},{id:"spotify",title:"Spotify",description:"Optional utility widget.",defaultWidth:4,defaultHeight:2,defaultHidden:!0,render:()=>e.jsx(K,{surfaceId:"today"})},{id:"quick-capture",title:"Quick capture",description:"Save a note or wiki draft without leaving Today.",defaultWidth:5,defaultHeight:3,defaultHidden:!0,render:({compact:i})=>{var n;return e.jsx(G,{compact:i,defaultUserId:t.selectedUserIds[0]??((n=t.snapshot.users[0])==null?void 0:n.id)??null})}}];return e.jsx(z,{surfaceId:"today",baseWidgets:y})}export{Be as TodayPage};
1
+ import{j as e,aC as b,bW as L,b9 as C,bF as X,b6 as F,r as D,aV as O,cv as M}from"./vendor-BwL6m4SE.js";import{i as U}from"./state-Bpe5dF3T.js";import{A as z}from"./ai-surface-workspace-DtwybxJB.js";import{T as Q,W as V,M as q,S as K,Q as G}from"./utility-widgets-h5eG2jvc.js";import{E as H}from"./entity-note-count-link-xne6mshj.js";import{u as _,a4 as I,k as x,R as Y,b as S,E,B as J,c as Z,d as ee,h as te,C as k,P as se,N as ae}from"./index-izRKx6JK.js";import{S as $}from"./surface-D0dqgX-k.js";import{a as ie}from"./life-force-workspace-CtAWZXNw.js";import{P}from"./page-hero-BLhM8FF3.js";import{T as ne,a as re,b as oe,c as le,d as de}from"./today-boxes-CYfskVrM.js";import"./board-CuxQRKPJ.js";import"./generic-node-view-DNVwfqqq.js";import"./graph-BF4IsheG.js";import"./motion-DcgUnXhY.js";import"./ui-B9TWEtCx.js";import"./forms-D1qJ3oOP.js";import"./floating-action-menu-cGhbJ2tc.js";import"./charts-BzT4pUPg.js";import"./define-workbench-box-DcI0_QKW.js";function A(s,t){return t.find(c=>c.id===s.goalId)??null}function ce(s,t){return s.tagIds.map(c=>t.find(d=>d.id===c)).filter(Boolean)}function me(s,t){(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),t())}function ue(s,t){switch(s.status){case"backlog":return{label:t.backlog,action:"start",icon:C};case"focus":return{label:t.focus,action:"start",icon:C};case"in_progress":return{label:t.in_progress,nextStatus:"done",action:"move",icon:X};case"blocked":return{label:t.blocked,action:"start",icon:C};default:return null}}function xe({tasks:s,timeline:t,goals:c,tags:d,notesSummaryByEntity:N,selectedTaskId:j,onSelectTask:r,onMove:p,onStartTask:f}){const{t:o,formatDate:w}=_(),T={backlog:o("common.dailyRunway.actionBacklog"),focus:o("common.dailyRunway.actionFocus"),in_progress:o("common.dailyRunway.actionProgress"),blocked:o("common.dailyRunway.actionBlocked")};return e.jsxs("div",{className:"grid min-w-0 gap-4 2xl:grid-cols-[minmax(0,1.3fr)_minmax(17rem,0.9fr)]",children:[e.jsxs($,{className:"min-w-0 rounded-[24px]",children:[e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:o("common.dailyRunway.runwayEyebrow")}),e.jsx(I,{content:"These are the tasks that matter most for today. Click a card to open the task details. Use Start to begin work immediately."})]}),e.jsx("h4",{className:"mt-2 font-display text-2xl text-[var(--ui-ink-strong)]",children:o("common.dailyRunway.runwayTitle")})]}),e.jsx(x,{className:"shrink-0 text-[var(--primary)]",children:o(s.length===1?"common.dailyRunway.prioritiesOne":"common.dailyRunway.prioritiesOther",{count:s.length})})]}),e.jsx("div",{className:"mt-4 grid min-w-0 gap-3",children:s.map((a,y)=>{const l=ue(a,T),i=ce(a,d).slice(0,2),n=A(a,c),h=j===a.id,B=Y(N,"task",a.id).count;return e.jsxs("article",{role:"button",tabIndex:0,"aria-pressed":h,className:Z("grid w-full gap-3 rounded-[22px] border px-4 py-4 text-left transition",h?"border-[var(--primary)]/28 bg-[var(--ui-accent-soft)] shadow-[var(--ui-shadow-soft)]":"border-transparent bg-[var(--ui-surface-1)] hover:border-[var(--ui-border-subtle)] hover:bg-[var(--ui-surface-hover)]"),onClick:()=>r(a.id),onKeyDown:m=>me(m,()=>r(a.id)),children:[e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:o("common.dailyRunway.runwayItem",{index:y+1})}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[n?e.jsx(b,{to:`/goals/${n.id}`,className:"min-w-0 max-w-full transition hover:opacity-85",onClick:m=>m.stopPropagation(),children:e.jsx(S,{kind:"goal",label:n.title,compact:!0,gradient:!1})}):e.jsx(S,{kind:"goal",label:o("common.dailyRunway.unassigned"),compact:!0,gradient:!1}),a.time.activeRunCount>0?e.jsx(x,{className:"border-[color-mix(in_srgb,#10b981_24%,transparent)] bg-[color-mix(in_srgb,#10b981_16%,var(--ui-surface-1))] text-[color-mix(in_srgb,#10b981_80%,var(--ui-ink-strong)_20%)]",children:"Live"}):null]}),e.jsx("div",{className:"mt-2",children:e.jsx(b,{to:`/tasks/${a.id}`,className:"block min-w-0 max-w-full transition hover:opacity-85",onClick:m=>m.stopPropagation(),children:e.jsx(E,{kind:"task",label:a.title,variant:"heading",size:"md"})})}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-[var(--ui-ink-soft)]",children:a.description||o("common.dailyRunway.noNote")})]}),e.jsx(x,{className:"shrink-0 self-start",children:a.status.replaceAll("_"," ")})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(x,{className:"bg-[var(--primary)]/14 text-[var(--primary)]",children:[a.points," xp"]}),e.jsx(H,{entityType:"task",entityId:a.id,count:B}),a.time.totalCreditedSeconds>0?e.jsxs(x,{tone:"meta",children:[Math.floor(a.time.totalCreditedSeconds/60)," min tracked"]}):null,e.jsx(x,{tone:"meta",children:a.effort}),e.jsx(x,{tone:"meta",children:w(a.dueDate)}),i.map(m=>e.jsx(x,{className:"bg-[var(--ui-surface-2)]",style:{color:m.color},children:m.name},m.id))]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",children:a.owner}),l?e.jsxs(J,{variant:l.action==="start"?"primary":"secondary",className:"px-3 py-2 text-[11px] uppercase tracking-[0.16em]",onClick:async m=>{if(m.stopPropagation(),l.action==="start"){await f(a.id);return}l.nextStatus&&await p(a.id,l.nextStatus)},children:[e.jsx(l.icon,{className:"mr-2 size-3.5"}),l.label]}):null]})]},a.id)})})]}),e.jsxs($,{className:"min-w-0 rounded-[24px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"font-label text-[11px] uppercase tracking-[0.18em] text-[var(--ui-ink-faint)]",children:o("common.dailyRunway.timelineEyebrow")}),e.jsx(I,{content:"This groups today's tasks by status, so you can see what is already moving, what is ready to start, what is blocked, and what is done."})]}),e.jsx("h4",{className:"mt-2 font-display text-2xl text-[var(--ui-ink-strong)]",children:o("common.dailyRunway.timelineTitle")}),e.jsx("div",{className:"mt-4 grid min-w-0 gap-3",children:t.map(a=>e.jsxs($,{muted:!0,className:"min-w-0 overflow-hidden rounded-[20px]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"font-medium text-[var(--ui-ink-strong)]",children:a.label}),e.jsx(x,{tone:"meta",children:a.tasks.length})]}),e.jsxs("div",{className:"mt-3 grid gap-2",children:[a.tasks.slice(0,3).map(y=>{const l=A(y,c);return e.jsxs(b,{to:`/tasks/${y.id}`,className:"flex min-w-0 items-center justify-between gap-3 overflow-hidden rounded-[16px] bg-[var(--ui-surface-1)] px-3 py-3 text-left transition hover:bg-[var(--ui-surface-hover)]",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(E,{kind:"task",label:y.title,className:"max-w-full",labelClassName:"[overflow-wrap:anywhere]"}),e.jsx("div",{className:"mt-2",children:e.jsx(S,{kind:"goal",label:(l==null?void 0:l.title)??o("common.dailyRunway.unassigned"),compact:!0,gradient:!1})})]}),e.jsx(L,{className:"size-4 shrink-0 text-[var(--ui-ink-faint)]"})]},y.id)}),a.tasks.length===0?e.jsx("div",{className:"text-sm text-[var(--ui-ink-faint)]",children:o("common.dailyRunway.emptyBucket")}):null]})]},a.id))})]})]})}const he=5,g="text-[11px] uppercase tracking-[0.16em] text-[var(--ui-ink-faint)]",u="text-[var(--ui-ink-soft)]",v="text-[var(--ui-ink-strong)]",R="min-w-0 rounded-[20px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-2)] shadow-[var(--ui-shadow-soft)]",W="min-w-0 rounded-[18px] border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)]",pe="inline-flex min-h-10 max-w-full shrink-0 items-center justify-center gap-2 rounded-full border border-[var(--ui-border-subtle)] bg-[var(--ui-surface-1)] px-3 py-2 text-xs font-medium text-[var(--ui-ink-medium)] shadow-[var(--ui-shadow-soft)] transition hover:border-[var(--ui-border-strong)] hover:bg-[var(--ui-surface-hover)] hover:text-[var(--ui-ink-strong)]";function fe(){const s=new Date;s.setHours(0,0,0,0);const t=new Date(s);return t.setDate(t.getDate()+1),{start:s,end:t,from:s.toISOString(),to:t.toISOString()}}function ye(s,t){const c=new Date(s.startAt),d=new Date(s.endAt);return c<t.end&&d>t.start}function ge(s){if(s.isAllDay)return"All day";const t=new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"});return`${t.format(new Date(s.startAt))} - ${t.format(new Date(s.endAt))}`}function Be(){var l;const{t:s}=_(),t=ee(),c=F(),d=D.useMemo(()=>fe(),[]),N=Array.isArray(t.selectedUserIds)?t.selectedUserIds:[],j=U({queryKey:["forge-calendar-overview",d.from,d.to,...N],queryFn:()=>ae({from:d.from,to:d.to,userIds:N})}),r=t.snapshot.today.directive.task,p=t.snapshot.today.milestoneRewards.find(i=>!i.completed)??t.snapshot.today.milestoneRewards[0]??null,f=t.snapshot.risk.blockedTasks[0]??t.snapshot.risk.overdueTasks[0]??null,o=Math.max(0,t.snapshot.metrics.nextLevelXp-t.snapshot.metrics.currentLevelXp),w=D.useMemo(()=>{var i;return(((i=j.data)==null?void 0:i.calendar.events)??[]).filter(n=>!n.deletedAt&&n.status!=="cancelled"&&ye(n,d)).sort((n,h)=>new Date(n.startAt).getTime()-new Date(h.startAt).getTime())},[(l=j.data)==null?void 0:l.calendar.events,d]),T=w.slice(0,he);if(!(t.snapshot.lifeForce!==void 0||r!==null||t.snapshot.overview.topTasks.length>0||t.snapshot.today.dueHabits.length>0||t.snapshot.today.dailyQuests.length>0||t.snapshot.today.milestoneRewards.length>0||w.length>0)&&!j.isLoading)return e.jsxs("div",{className:"grid gap-4",children:[e.jsx(P,{title:"Today",titleText:"Today",description:"Start a task, earn XP, and keep today's work clear.",badge:`${t.snapshot.metrics.weeklyXp} weekly xp`}),e.jsx(te,{eyebrow:s("common.todayPage.heroEyebrow"),title:s("common.todayPage.emptyTitle"),description:s("common.todayPage.emptyDescription"),action:e.jsx(b,{to:"/goals",className:"inline-flex min-h-10 min-w-max shrink-0 items-center justify-center rounded-full bg-[var(--primary)] px-4 py-2 text-sm font-medium whitespace-nowrap text-[var(--ui-ink-on-accent)] transition hover:opacity-90",children:s("common.todayPage.emptyAction")})})]});const y=[{id:"hero",title:"Today",description:"Compact page header.",defaultWidth:12,defaultHeight:2,removable:!1,surfaceChrome:"none",defaultTitleVisible:!1,defaultDescriptionVisible:!1,render:()=>e.jsx(ne,{children:e.jsx(P,{title:"Today",titleText:"Today",description:(r==null?void 0:r.description)??"Start one real task, collect XP, and keep today's work moving.",badge:`${t.snapshot.metrics.weeklyXp} weekly xp`})})},{id:"life-force",title:"Life Force",description:"Instant headroom, AP use today, and tiredness signals.",defaultWidth:12,defaultHeight:3,minWidth:5,render:()=>e.jsx(ie,{selectedUserIds:t.selectedUserIds,fallbackLifeForce:t.snapshot.lifeForce,onRefresh:t.refresh})},{id:"metrics",title:"Live metrics",description:"XP, level, and momentum stay visible but lighter than before.",defaultWidth:5,defaultHeight:4,minWidth:4,render:({compact:i})=>e.jsx(re,{children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs(k,{className:"min-w-0 p-4",children:[e.jsx("div",{className:g,children:"Weekly XP"}),e.jsx("div",{className:"mt-2 break-words font-display text-4xl text-[var(--primary)]",children:t.snapshot.metrics.weeklyXp}),e.jsxs("div",{className:`mt-1 text-sm ${u}`,children:[t.snapshot.metrics.totalXp," total XP"]})]}),e.jsxs(k,{className:"min-w-0 p-4",children:[e.jsx("div",{className:g,children:"Level"}),e.jsx("div",{className:`mt-2 font-display text-4xl ${v}`,children:t.snapshot.metrics.level}),e.jsxs("div",{className:`mt-1 text-sm ${u}`,children:[o," xp to the next level"]}),i?null:e.jsx("div",{className:"mt-3",children:e.jsx(se,{value:t.snapshot.metrics.currentLevelXp/t.snapshot.metrics.nextLevelXp*100,tone:"tertiary"})})]}),e.jsxs(k,{className:"min-w-0 p-4",children:[e.jsx("div",{className:g,children:"Momentum"}),e.jsxs("div",{className:`mt-2 font-display text-4xl ${v}`,children:[t.snapshot.metrics.momentumScore,"%"]}),e.jsxs("div",{className:`mt-1 text-sm ${u}`,children:[t.snapshot.metrics.streakDays," day streak"]})]}),e.jsxs(k,{className:"min-w-0 p-4",children:[e.jsx("div",{className:g,children:"Next reward"}),e.jsx("div",{className:`mt-2 break-words text-base font-semibold ${v}`,children:(p==null?void 0:p.title)??"Keep showing up"}),e.jsx("div",{className:`mt-1 text-sm ${u}`,children:(p==null?void 0:p.progressLabel)??"The next visible win comes from a task completion or aligned habit check-in."})]})]})})},{id:"runway",title:"Runway",description:"The execution lane itself can be widened or narrowed.",defaultWidth:7,defaultHeight:6,minWidth:5,render:()=>e.jsx(oe,{children:e.jsx(xe,{tasks:t.snapshot.overview.topTasks,timeline:t.snapshot.today.timeline,goals:t.snapshot.goals,tags:t.snapshot.tags,notesSummaryByEntity:t.snapshot.dashboard.notesSummaryByEntity,selectedTaskId:(r==null?void 0:r.id)??null,onSelectTask:i=>c(`/tasks/${i}`),onStartTask:async i=>{await t.startTaskNow(i)},onMove:async(i,n)=>{await t.patchTaskStatus(i,n)}})})},{id:"calendar",title:"Calendar",description:"Today's events stay grouped with their results instead of splitting search from outcome.",defaultWidth:5,defaultHeight:5,minWidth:4,render:({compact:i})=>e.jsx(le,{children:e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("div",{className:"inline-flex size-10 shrink-0 items-center justify-center rounded-2xl bg-[var(--primary)]/14 text-[var(--primary)]",children:e.jsx(O,{className:"size-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:g,children:"Today's calendar"}),e.jsx("div",{className:`text-sm font-semibold ${v}`,children:new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric"}).format(d.start)}),e.jsxs("div",{className:`text-sm ${u}`,children:[w.length," event",w.length===1?"":"s"]})]})]}),e.jsxs(b,{to:"/calendar",className:pe,children:["Open calendar",e.jsx(M,{className:"size-3.5"})]})]}),w.length===0?e.jsx("div",{className:`${W} px-4 py-4 text-sm ${u}`,children:"Nothing is scheduled yet for today."}):T.map(n=>e.jsxs("button",{type:"button",className:`${W} grid gap-2 px-3 py-3 text-left transition hover:bg-[var(--ui-surface-hover)]`,onClick:()=>c("/calendar"),children:[e.jsxs("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:`truncate text-sm font-medium ${v}`,children:n.title}),e.jsx("div",{className:`mt-1 text-sm ${u}`,children:ge(n)})]}),e.jsx(x,{className:"shrink-0 bg-[var(--ui-surface-3)] text-[var(--ui-ink-medium)]",children:n.originType==="native"?"Forge":n.originType})]}),!i&&n.description?e.jsx("div",{className:`line-clamp-2 text-sm leading-6 ${u}`,children:n.description}):null]},n.id))]})})},{id:"focus",title:"Current focus",description:"Current task, comeback task, and due habits stay in one movable stack.",defaultWidth:12,defaultHeight:4,minWidth:6,render:({compact:i})=>{var n;return e.jsx(de,{children:e.jsxs("div",{className:"grid min-w-0 gap-4 xl:grid-cols-[minmax(0,1.2fr)_minmax(0,0.8fr)]",children:[e.jsxs("div",{className:`${R} p-4`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:g,children:"Current task"}),r?e.jsx(H,{entityType:"task",entityId:r.id,count:((n=t.snapshot.dashboard.notesSummaryByEntity[`task:${r.id}`])==null?void 0:n.count)??0}):null]}),e.jsx("div",{className:`mt-3 break-words text-base font-semibold ${v}`,children:(r==null?void 0:r.title)??"Pick a task from the runway"}),e.jsx("div",{className:`mt-2 text-sm leading-6 ${u}`,children:(r==null?void 0:r.description)??"Once a task is active, the timer rail and this panel stay aligned."}),r?e.jsx("button",{type:"button",className:"mt-4 inline-flex min-h-10 max-w-full items-center justify-center rounded-2xl border border-[color-mix(in_srgb,var(--primary)_24%,transparent)] bg-[var(--ui-accent-soft)] px-3.5 py-2 text-sm font-medium text-[var(--primary)] shadow-[var(--ui-shadow-soft)] transition hover:bg-[var(--ui-accent-soft-hover)]",onClick:async()=>{await t.startTaskNow(r.id)},children:"Start work"}):null]}),e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:`${R} p-4`,children:[e.jsx("div",{className:g,children:"Recovery task"}),e.jsx("div",{className:`mt-3 break-words text-sm font-semibold ${v}`,children:(f==null?void 0:f.title)??"No blocked or overdue task is dominating today"}),i?null:e.jsx("div",{className:`mt-2 text-sm leading-6 ${u}`,children:(f==null?void 0:f.description)??"If something slips, it will surface here as the clean comeback move."})]}),e.jsxs("div",{className:`${R} p-4`,children:[e.jsx("div",{className:g,children:"Due habits"}),e.jsx("div",{className:"mt-3 grid gap-2",children:t.snapshot.today.dueHabits.slice(0,i?2:3).map(h=>e.jsxs("div",{className:`${W} flex items-center justify-between gap-3 px-3 py-2.5`,children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:`truncate text-sm font-medium ${v}`,children:h.title}),i?null:e.jsx("div",{className:`text-sm ${u}`,children:h.frequency})]}),e.jsxs(x,{className:"shrink-0 bg-[var(--ui-success-soft)] text-[color-mix(in_srgb,var(--success)_78%,var(--ui-ink-strong)_22%)]",children:[h.rewardXp," xp"]})]},h.id))})]})]})]})})}},{id:"time",title:"Clock",description:"Optional utility widget.",defaultWidth:3,defaultHeight:2,defaultHidden:!0,render:({compact:i})=>e.jsx(Q,{compact:i})},{id:"weather",title:"Weather",description:"Optional utility widget.",defaultWidth:3,defaultHeight:2,defaultHidden:!0,render:({compact:i})=>e.jsx(V,{compact:i})},{id:"mini-calendar",title:"Mini calendar",description:"Optional utility widget.",defaultWidth:4,defaultHeight:3,defaultHidden:!0,render:({compact:i})=>e.jsx(q,{compact:i})},{id:"spotify",title:"Spotify",description:"Optional utility widget.",defaultWidth:4,defaultHeight:2,defaultHidden:!0,render:()=>e.jsx(K,{surfaceId:"today"})},{id:"quick-capture",title:"Quick capture",description:"Save a note or wiki draft without leaving Today.",defaultWidth:5,defaultHeight:3,defaultHidden:!0,render:({compact:i})=>{var n;return e.jsx(G,{compact:i,defaultUserId:t.selectedUserIds[0]??((n=t.snapshot.users[0])==null?void 0:n.id)??null})}}];return e.jsx(z,{surfaceId:"today",baseWidgets:y})}export{Be as TodayPage};