@cuongtran001/kanna 1.99.0 → 1.100.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/client/assets/{BoardsPage-CPdXl_9L.js → BoardsPage-CmbikRTr.js} +1 -1
  2. package/dist/client/assets/{BoardsRoutePage-DrTFjpAZ.js → BoardsRoutePage-_rJbfIMr.js} +1 -1
  3. package/dist/client/assets/ChatPage-BjV_AUfU.js +35 -0
  4. package/dist/client/assets/{CronJobsPage-B7o8EhRk.js → CronJobsPage-CGatKovf.js} +1 -1
  5. package/dist/client/assets/{FilePreviewSheet-CfXThsQp.js → FilePreviewSheet-2UmZcGM1.js} +1 -1
  6. package/dist/client/assets/{FlowSurface-CdVOTRYI.js → FlowSurface-Jp2Kduwr.js} +1 -1
  7. package/dist/client/assets/{GenUIBlock-B3QE4V69.js → GenUIBlock-Hd59sRnA.js} +2 -2
  8. package/dist/client/assets/{InboundHandlerFields-CDVZGRJq.js → InboundHandlerFields-xC0A_8v_.js} +1 -1
  9. package/dist/client/assets/InboxPage-Dn2m132s.js +1 -0
  10. package/dist/client/assets/{LocalProjectsPage-BYEjT-DZ.js → LocalProjectsPage-N2TVe-i_.js} +1 -1
  11. package/dist/client/assets/SettingsPage-Dhu8DAcu.js +19 -0
  12. package/dist/client/assets/{StackBoardsRoutePage-D8OwGaO7.js → StackBoardsRoutePage-C9yKY11W.js} +1 -1
  13. package/dist/client/assets/{ToolCallMessage-BFqfgkCH.js → ToolCallMessage-ClZ4WAIx.js} +1 -1
  14. package/dist/client/assets/{VChartSurface-CMQoKhau.js → VChartSurface-CRAXE2rk.js} +1 -1
  15. package/dist/client/assets/{WebhooksPage-DMmDX-ms.js → WebhooksPage-BuCku5bb.js} +2 -2
  16. package/dist/client/assets/{WorkflowsPage-DvfGbRlt.js → WorkflowsPage-BpxtJmbm.js} +1 -1
  17. package/dist/client/assets/{arrow-left-CjtboDsu.js → arrow-left-CRDaVzUE.js} +1 -1
  18. package/dist/client/assets/{beacon-alias-rXxwPHhZ.js → beacon-alias-DBmQZorE.js} +3 -3
  19. package/dist/client/assets/{code-xml-C3fKotSy.js → code-xml-CaBEm79a.js} +1 -1
  20. package/dist/client/assets/{commandFeedback-C8JG7P5C.js → commandFeedback-B5BGVwSB.js} +1 -1
  21. package/dist/client/assets/{contextWindow-h4X5oJjz.js → contextWindow-CqnhCAQk.js} +1 -1
  22. package/dist/client/assets/{copyFeedbackStore-DAsM7m9s.js → copyFeedbackStore-UJ3E0KbP.js} +1 -1
  23. package/dist/client/assets/{createScopedStore-VWkEjqnA.js → createScopedStore-D2lbC79H.js} +1 -1
  24. package/dist/client/assets/cronJobsStore-Behp08jC.js +1 -0
  25. package/dist/client/assets/{file-plus-corner-TXCx13rk.js → file-plus-corner-sS8XtTpH.js} +1 -1
  26. package/dist/client/assets/inboxAutonomy-CVXpCH_7.js +1 -0
  27. package/dist/client/assets/index-CC0TKorl.js +85 -0
  28. package/dist/client/assets/{info-Dc1D2lOq.js → info-B7wlVBQp.js} +1 -1
  29. package/dist/client/assets/{input-B23WM9u5.js → input-BZJyxEQz.js} +1 -1
  30. package/dist/client/assets/keybindings-41ps1wsi.js +1 -0
  31. package/dist/client/assets/log-DcaAv2P-.js +1 -0
  32. package/dist/client/assets/minus-C-1JDOYd.js +1 -0
  33. package/dist/client/assets/{monitor-CnCS7O8D.js → monitor-CAW3GuOJ.js} +1 -1
  34. package/dist/client/assets/pathUtils-BU6_uBbH.js +1 -0
  35. package/dist/client/assets/{pencil-DbIlj5g0.js → pencil-W5Mvains.js} +1 -1
  36. package/dist/client/assets/{pendingActionsStore-Bks-EsV3.js → pendingActionsStore-B2OEQn-G.js} +1 -1
  37. package/dist/client/assets/{plus-BmhG7IUi.js → plus-Bx5-gSoQ.js} +1 -1
  38. package/dist/client/assets/{refresh-cw-BxmkSO32.js → refresh-cw-Bo-jP7s_.js} +1 -1
  39. package/dist/client/assets/runDetached-Dxeuy0Xm.js +1 -0
  40. package/dist/client/assets/{search-BUOQUhrF.js → search-Be54lslZ.js} +1 -1
  41. package/dist/client/assets/{searchable-select-ByMK5CZ8.js → searchable-select-B14f1zjT.js} +1 -1
  42. package/dist/client/assets/{segmented-control-BXlWFDM8.js → segmented-control-wLWD50j6.js} +1 -1
  43. package/dist/client/assets/select-BJDX6TdM.js +1 -0
  44. package/dist/client/assets/{settings-header-button-DQUmCPE_.js → settings-header-button-DmnKH2op.js} +1 -1
  45. package/dist/client/assets/{state-mark-Hjx5ToFs.js → state-mark-f_phjXlo.js} +1 -1
  46. package/dist/client/assets/{terminal-gOELI9ta.js → terminal-DORTRQ_P.js} +1 -1
  47. package/dist/client/assets/{timer.adapter-DgrMEqxC.js → timer.adapter-9BKWtt0n.js} +1 -1
  48. package/dist/client/assets/tool-call-types-CwtgEvJ1.js +1 -0
  49. package/dist/client/assets/tools-C0Aj9UbG.js +1 -0
  50. package/dist/client/assets/{triangle-alert-DnqNE8_X.js → triangle-alert-D79NzF0R.js} +1 -1
  51. package/dist/client/assets/types-DReu_iAS.js +1 -0
  52. package/dist/client/assets/useAppGlobalState-BtWLnyp9.js +1 -0
  53. package/dist/client/assets/useProviderCatalog-SYUUySe_.js +3 -0
  54. package/dist/client/assets/{useTheme-BWGWet54.js → useTheme-B1Q9JJXX.js} +1 -1
  55. package/dist/client/index.html +33 -33
  56. package/dist/client/sw-notifications.js +55 -0
  57. package/dist/client/sw.js +38 -31
  58. package/package.json +1 -1
  59. package/src/server/agent-app-settings-view.ts +2 -0
  60. package/src/server/auth.test.ts +1 -1
  61. package/src/server/auth.ts +10 -7
  62. package/src/server/claude-inbox-guard.test.ts +67 -0
  63. package/src/server/claude-inbox-guard.ts +52 -0
  64. package/src/server/claude-session-spawner.test.ts +75 -0
  65. package/src/server/claude-session-spawner.ts +6 -1
  66. package/src/server/claude-session-start.ts +15 -7
  67. package/src/server/claude-session-state.ts +1 -0
  68. package/src/server/claude-turn-starter.test.ts +6 -0
  69. package/src/server/claude-turn-starter.ts +1 -0
  70. package/src/server/http-dispatcher.test.ts +55 -1
  71. package/src/server/http-dispatcher.ts +19 -4
  72. package/src/server/inbound/deliver-inbound.ts +1 -4
  73. package/src/server/inbound/inbox-reply.ts +3 -2
  74. package/src/server/inbound/referenced-chat-ids.test.ts +2 -0
  75. package/src/server/inbox/inbox-autonomy.test.ts +61 -0
  76. package/src/server/inbox/inbox-autonomy.ts +62 -0
  77. package/src/server/inbox/inbox-autopilot.test.ts +243 -0
  78. package/src/server/inbox/inbox-autopilot.ts +218 -0
  79. package/src/server/inbox/inbox-boot.test.ts +31 -3
  80. package/src/server/inbox/inbox-boot.ts +66 -5
  81. package/src/server/inbox/inbox-outbox.ts +19 -7
  82. package/src/server/inbox/inbox-projection.ts +29 -0
  83. package/src/server/inbox/inbox-push.test.ts +144 -0
  84. package/src/server/inbox/inbox-registry.test.ts +82 -0
  85. package/src/server/inbox/inbox-registry.ts +133 -20
  86. package/src/server/inbox/proposal-approve-http.test.ts +109 -0
  87. package/src/server/inbox/proposal-approve-http.ts +37 -0
  88. package/src/server/kanna-mcp-inbox.ts +12 -4
  89. package/src/server/mcp-sources/mcp-source-runner.test.ts +3 -0
  90. package/src/server/mcp-sources-settings.test.ts +74 -0
  91. package/src/server/mcp-sources-settings.ts +29 -2
  92. package/src/server/push/push-manager.ts +37 -11
  93. package/src/server/push/push-service-worker.test.ts +210 -0
  94. package/src/server/request-origin-guard.test.ts +194 -0
  95. package/src/server/request-origin-guard.ts +99 -0
  96. package/src/server/server.test.ts +1 -0
  97. package/src/server/server.ts +14 -5
  98. package/src/server/test-helpers/autopilot-clock.ts +28 -0
  99. package/src/server/ws-router-command-results.test.ts +8 -0
  100. package/src/server/ws-router-inbox.ts +31 -0
  101. package/src/shared/app-settings-types.ts +10 -0
  102. package/src/shared/beacon-protocol.ts +1 -0
  103. package/src/shared/commands/inbox.ts +39 -2
  104. package/src/shared/commands/results/inbox.ts +1 -1
  105. package/src/shared/http-routes.ts +8 -0
  106. package/src/shared/inbound/handler-turn.test.ts +17 -0
  107. package/src/shared/inbound/handler-turn.ts +36 -0
  108. package/src/shared/inbound/handler.schema.ts +1 -0
  109. package/src/shared/inbound/handler.ts +1 -0
  110. package/src/shared/inbound/template.ts +1 -1
  111. package/src/shared/inbox/autonomy.ts +124 -0
  112. package/src/shared/inbox/events.ts +35 -2
  113. package/src/shared/inbox/outbound-text.test.ts +30 -0
  114. package/src/shared/inbox/outbound-text.ts +19 -0
  115. package/src/shared/inbox/policy.test.ts +9 -1
  116. package/src/shared/inbox/policy.ts +23 -1
  117. package/src/shared/inbox/push.ts +9 -0
  118. package/src/shared/inbox/types.schema.ts +24 -0
  119. package/src/shared/inbox/types.ts +39 -12
  120. package/src/shared/mcp-sources/types.schema.ts +19 -0
  121. package/src/shared/mcp-sources/types.ts +4 -0
  122. package/src/shared/mcp-sources/validate.ts +2 -0
  123. package/src/shared/types.ts +9 -1
  124. package/dist/client/assets/ChatPage-CGQoeYXf.js +0 -35
  125. package/dist/client/assets/InboxPage-C29v9zbq.js +0 -1
  126. package/dist/client/assets/SettingsPage-Bl7lDxe0.js +0 -17
  127. package/dist/client/assets/appSettingsStore-BkV1YU8S.js +0 -1
  128. package/dist/client/assets/cronJobsStore-DBkn33E8.js +0 -1
  129. package/dist/client/assets/inboxStore-CC3pAzZZ.js +0 -1
  130. package/dist/client/assets/index-R-jfstMQ.js +0 -85
  131. package/dist/client/assets/log-DL1J6840.js +0 -1
  132. package/dist/client/assets/minus-DpXqEYpv.js +0 -1
  133. package/dist/client/assets/pathUtils-DTWwEzHK.js +0 -1
  134. package/dist/client/assets/runDetached-BTPJqi-A.js +0 -1
  135. package/dist/client/assets/select-B-SEd4I2.js +0 -1
  136. package/dist/client/assets/tool-call-types-CtytAxam.js +0 -1
  137. package/dist/client/assets/tools-MfK2-0IV.js +0 -1
  138. package/dist/client/assets/useAppGlobalState-BTVDcR0Z.js +0 -1
  139. package/dist/client/assets/useProviderCatalog-CxmLsNAf.js +0 -3
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{t as n}from"./jsx-runtime-BB9-612F.js";import{d as r,f as i,i as a,l as o,n as s,r as c,t as l}from"./pendingActionsStore-Bks-EsV3.js";import{t as u}from"./plus-BmhG7IUi.js";import{f as d,i as f,l as p,t as m}from"./log-DL1J6840.js";import{t as h}from"./input-B23WM9u5.js";import{bt as g,gn as _,vt as v,yt as y}from"./index-R-jfstMQ.js";import{f as b,h as x,m as S,p as C}from"./ChatPage-CGQoeYXf.js";var w=e(t(),1),T=[],E=d()(e=>({templates:T,templatesStatus:`loading`,openMenuId:null,picking:!1,renamingId:null,error:null,setTemplates:t=>e({templates:Array.isArray(t)?t:[],templatesStatus:`ready`}),beginTemplatesLoad:()=>e({templatesStatus:`loading`}),failTemplatesLoad:()=>e({templatesStatus:`failed`}),openMenu:t=>e({openMenuId:t}),closeMenu:()=>e({openMenuId:null}),openPicker:()=>e({picking:!0,error:null}),closePicker:()=>e({picking:!1}),startRename:t=>e({renamingId:t,picking:!1,openMenuId:null}),stopRename:()=>e({renamingId:null}),setError:t=>e({error:t})}));function D(e){return e.templates}var O=e(n(),1),k=[`board.update`,`board.duplicate`,`board.saveAsTemplate`,`board.archive`];function A(e){return a(t=>k.some(n=>t.inFlight[l(n,e)]===!0))}function j({ownerKind:e,ownerId:t,ownerName:n,socket:r,onOpenBoard:i}){let a=C(e,t),d=x(S(a)),h=E(D),g=E(e=>e.picking),_=E(e=>e.renamingId),v=E(e=>e.error),y=E(e=>e.templatesStatus),b=l(`board.create`,a),T=c(b),{openPicker:k,closePicker:A,startRename:j,stopRename:N,setError:P,setTemplates:I}=E.getState();(0,w.useEffect)(()=>r.subscribe({type:`boards`,ownerKind:e,ownerId:t},e=>{x.getState().setBoards(C(e.ownerKind,e.ownerId),e.boards)}),[e,t,r]),(0,w.useEffect)(()=>{let e=!1,t=E.getState();return t.templatesStatus!==`ready`&&t.beginTemplatesLoad(),r.command({type:`board.templates.list`}).then(t=>{e||I(t)},f(t=>{m.error(p,`board.templates.list failed`,t),e||E.getState().failTemplatesLoad()})),()=>{e=!0}},[r,I]);let L=(0,w.useCallback)(async e=>{try{return await r.command(e),P(null),!0}catch(e){return P(e instanceof Error?e.message:`That did not work.`),!1}},[r,P]),R=(0,w.useCallback)(n=>{s(b,async()=>{await L({type:`board.create`,ownerKind:e,ownerId:t,title:n?n.name:`Untitled board`,templateId:n?.id??null})&&A()})},[A,b,e,t,L]),z=(0,w.useCallback)((e,t)=>{N();let n=t.trim();n!==``&&s(l(`board.update`,e),()=>L({type:`board.update`,boardId:e,title:n}))},[L,N]),B=g||d.length===0;return(0,O.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-background`,children:[(0,O.jsxs)(`header`,{className:`flex items-end justify-between gap-4 border-b border-border px-6 py-4`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`h1`,{className:`text-lg font-medium leading-tight tracking-[-0.01em] text-foreground`,children:`Boards`}),(0,O.jsxs)(`p`,{className:`truncate text-13 text-muted-foreground`,children:[n,d.length>0?(0,O.jsxs)(`span`,{className:`tabular-nums`,children:[` · `,d.length,` boards`]}):null]})]}),d.length>0?(0,O.jsxs)(o,{size:`sm`,onClick:k,pending:T,children:[(0,O.jsx)(u,{className:`size-3.5`}),`New board`]}):null]}),v?(0,O.jsx)(`p`,{className:`border-b border-border px-6 py-2 text-13 text-destructive-text`,children:v}):null,(0,O.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[B?(0,O.jsx)(F,{templates:h,templatesStatus:y,creating:T,firstRun:d.length===0,onPick:R,onCancel:A}):null,d.length>0?(0,O.jsx)(`ul`,{className:`px-4 py-1`,children:d.map(e=>(0,O.jsx)(M,{board:e,renaming:_===e.id,onOpen:i,onStartRename:j,onRename:z,onCancelRename:N,onCommand:L},e.id))}):null]})]})}function M({board:e,renaming:t,onOpen:n,onStartRename:r,onRename:i,onCancelRename:a,onCommand:o}){let s=A(e.id),c=(0,w.useCallback)(()=>n(e.id),[e.id,n]),l=(0,w.useCallback)(t=>{t.key===`Enter`&&i(e.id,t.currentTarget.value),t.key===`Escape`&&a()},[e.id,a,i]),u=(0,w.useCallback)(t=>i(e.id,t.currentTarget.value),[e.id,i]);return(0,O.jsxs)(`li`,{"aria-busy":s||void 0,className:`group grid grid-cols-[1fr_auto_auto] items-center gap-5 border-b border-border px-3 py-3 last:border-b-0 hover:bg-secondary`,children:[(0,O.jsx)(`div`,{className:`min-w-0`,children:t?(0,O.jsx)(h,{autoFocus:!0,defaultValue:e.title,onKeyDown:l,onBlur:u,className:`h-7 max-w-sm`,"aria-label":`Board name`}):(0,O.jsxs)(`button`,{type:`button`,onClick:c,className:`block w-full text-left`,children:[(0,O.jsx)(`span`,{className:`block truncate text-15 font-semibold tracking-[-0.005em] text-foreground`,children:e.title}),e.description?(0,O.jsx)(`span`,{className:`mt-0.5 block truncate text-13 text-muted-foreground`,children:e.description}):null]})}),(0,O.jsxs)(`div`,{className:`flex items-center gap-4 text-xs text-muted-foreground`,children:[(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`b`,{className:`font-medium tabular-nums text-foreground`,children:e.columnCount}),` columns`]}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`b`,{className:`font-medium tabular-nums text-foreground`,children:e.cardCount}),` cards`]})]}),(0,O.jsx)(N,{board:e,pending:s,onStartRename:r,onCommand:o})]})}function N({board:e,pending:t,onStartRename:n,onCommand:a}){let o=E(t=>t.openMenuId===e.id),{openMenu:c,closeMenu:u}=E.getState(),d=(0,w.useCallback)(t=>{t?c(e.id):u()},[e.id,u,c]),f=(0,w.useCallback)(()=>{u(),n(e.id)},[e.id,u,n]),p=(0,w.useCallback)(()=>{u(),s(l(`board.duplicate`,e.id),()=>a({type:`board.duplicate`,boardId:e.id,title:`${e.title} copy`}))},[e.id,e.title,u,a]),m=(0,w.useCallback)(()=>{u(),s(l(`board.saveAsTemplate`,e.id),()=>a({type:`board.saveAsTemplate`,boardId:e.id,name:e.title}))},[e.id,e.title,u,a]),h=(0,w.useCallback)(()=>{u(),s(l(`board.archive`,e.id),()=>a({type:`board.archive`,boardId:e.id}))},[e.id,u,a]);return(0,O.jsxs)(v,{open:o,onOpenChange:d,children:[(0,O.jsx)(g,{asChild:!0,children:(0,O.jsx)(`button`,{type:`button`,"aria-label":`Actions for ${e.title}`,disabled:t,"aria-busy":t||void 0,className:i(`rounded-md px-1.5 py-1 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100`,t&&`opacity-100`),children:t?(0,O.jsx)(r,{className:`size-4`}):(0,O.jsx)(_,{className:`size-4`})})}),(0,O.jsxs)(y,{align:`end`,className:`w-56 p-1`,children:[(0,O.jsx)(P,{onClick:f,children:`Rename`}),(0,O.jsx)(P,{onClick:p,children:`Duplicate structure`}),(0,O.jsx)(P,{onClick:m,children:`Save as template`}),(0,O.jsx)(`div`,{className:`my-1 h-px bg-border`}),(0,O.jsx)(P,{onClick:h,tone:`destructive`,children:`Archive`})]})]})}function P({onClick:e,children:t,tone:n}){return(0,O.jsx)(`button`,{type:`button`,onClick:e,className:i(`flex w-full items-center rounded-sm px-2 py-1.5 text-left text-xs font-medium hover:bg-secondary`,n===`destructive`&&`text-destructive-text`),children:t})}function F({templates:e,templatesStatus:t,creating:n,firstRun:i,onPick:a,onCancel:s}){let c=(0,w.useCallback)(()=>a(null),[a]);return(0,O.jsxs)(`div`,{className:`px-6 py-8`,children:[i?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`h2`,{className:`text-15 font-semibold text-foreground`,children:`No boards yet.`}),(0,O.jsx)(`p`,{className:`mt-1 max-w-[58ch] text-sm text-muted-foreground`,children:`A board turns issues into work your agents can pick up. Start from a shape, or import an existing tracker.`})]}):(0,O.jsx)(`h2`,{className:`text-15 font-semibold text-foreground`,children:`Start from a shape`}),(0,O.jsxs)(`div`,{className:`mt-4 max-w-xl rounded-lg border border-border`,"aria-busy":n||void 0,children:[e.map(e=>(0,O.jsx)(I,{template:e,disabled:n,onPick:a},e.id)),t===`loading`?(0,O.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 px-3.5 py-2.5 text-xs text-muted-foreground`,children:[(0,O.jsx)(r,{}),`Loading templates…`]}):null,t===`failed`?(0,O.jsx)(`p`,{className:`px-3.5 py-2.5 text-xs text-muted-foreground`,children:`Couldn't load templates.`}):null,(0,O.jsx)(`button`,{type:`button`,onClick:c,disabled:n,className:`flex w-full items-center border-t border-border px-3.5 py-2.5 text-left hover:bg-secondary disabled:pointer-events-none disabled:opacity-60`,children:(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:`Empty board`}),(0,O.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Name your own columns`})]})})]}),n?(0,O.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,O.jsx)(r,{}),`Creating board…`]}):null,i?null:(0,O.jsx)(o,{variant:`ghost`,size:`sm`,className:`mt-3`,onClick:s,children:`Cancel`})]})}function I({template:e,disabled:t,onPick:n}){let r=(0,w.useCallback)(()=>n(e),[n,e]),a=e.definition.columns;return(0,O.jsxs)(`button`,{type:`button`,onClick:r,disabled:t,className:`flex w-full items-center gap-3 border-b border-border px-3.5 py-2.5 text-left last:border-b-0 hover:bg-secondary disabled:pointer-events-none disabled:opacity-60`,children:[(0,O.jsxs)(`span`,{className:`min-w-0`,children:[(0,O.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.name}),(0,O.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:a.map(e=>e.title).join(` · `)})]}),(0,O.jsx)(`span`,{"aria-hidden":!0,className:`ml-auto flex shrink-0 gap-1`,children:a.map((t,n)=>(0,O.jsx)(`span`,{className:i(`size-1.5 rounded-full`,t.colorToken?b[t.colorToken]:`bg-muted-icon`)},`${e.id}-${String(n)}`))})]})}export{j as t};
1
+ import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{t as n}from"./jsx-runtime-BB9-612F.js";import{d as r,f as i,i as a,l as o,n as s,r as c,t as l}from"./pendingActionsStore-B2OEQn-G.js";import{t as u}from"./plus-Bx5-gSoQ.js";import{f as d,i as f,l as p,t as m}from"./log-DcaAv2P-.js";import{t as h}from"./input-BZJyxEQz.js";import{_n as g,bt as _,xt as v,yt as y}from"./index-CC0TKorl.js";import{g as b,h as x,m as S,p as C}from"./ChatPage-BjV_AUfU.js";var w=e(t(),1),T=[],E=d()(e=>({templates:T,templatesStatus:`loading`,openMenuId:null,picking:!1,renamingId:null,error:null,setTemplates:t=>e({templates:Array.isArray(t)?t:[],templatesStatus:`ready`}),beginTemplatesLoad:()=>e({templatesStatus:`loading`}),failTemplatesLoad:()=>e({templatesStatus:`failed`}),openMenu:t=>e({openMenuId:t}),closeMenu:()=>e({openMenuId:null}),openPicker:()=>e({picking:!0,error:null}),closePicker:()=>e({picking:!1}),startRename:t=>e({renamingId:t,picking:!1,openMenuId:null}),stopRename:()=>e({renamingId:null}),setError:t=>e({error:t})}));function D(e){return e.templates}var O=e(n(),1),k=[`board.update`,`board.duplicate`,`board.saveAsTemplate`,`board.archive`];function A(e){return a(t=>k.some(n=>t.inFlight[l(n,e)]===!0))}function j({ownerKind:e,ownerId:t,ownerName:n,socket:r,onOpenBoard:i}){let a=S(e,t),d=b(x(a)),h=E(D),g=E(e=>e.picking),_=E(e=>e.renamingId),v=E(e=>e.error),y=E(e=>e.templatesStatus),C=l(`board.create`,a),T=c(C),{openPicker:k,closePicker:A,startRename:j,stopRename:N,setError:P,setTemplates:I}=E.getState();(0,w.useEffect)(()=>r.subscribe({type:`boards`,ownerKind:e,ownerId:t},e=>{b.getState().setBoards(S(e.ownerKind,e.ownerId),e.boards)}),[e,t,r]),(0,w.useEffect)(()=>{let e=!1,t=E.getState();return t.templatesStatus!==`ready`&&t.beginTemplatesLoad(),r.command({type:`board.templates.list`}).then(t=>{e||I(t)},f(t=>{m.error(p,`board.templates.list failed`,t),e||E.getState().failTemplatesLoad()})),()=>{e=!0}},[r,I]);let L=(0,w.useCallback)(async e=>{try{return await r.command(e),P(null),!0}catch(e){return P(e instanceof Error?e.message:`That did not work.`),!1}},[r,P]),R=(0,w.useCallback)(n=>{s(C,async()=>{await L({type:`board.create`,ownerKind:e,ownerId:t,title:n?n.name:`Untitled board`,templateId:n?.id??null})&&A()})},[A,C,e,t,L]),z=(0,w.useCallback)((e,t)=>{N();let n=t.trim();n!==``&&s(l(`board.update`,e),()=>L({type:`board.update`,boardId:e,title:n}))},[L,N]),B=g||d.length===0;return(0,O.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-background`,children:[(0,O.jsxs)(`header`,{className:`flex items-end justify-between gap-4 border-b border-border px-6 py-4`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`h1`,{className:`text-lg font-medium leading-tight tracking-[-0.01em] text-foreground`,children:`Boards`}),(0,O.jsxs)(`p`,{className:`truncate text-13 text-muted-foreground`,children:[n,d.length>0?(0,O.jsxs)(`span`,{className:`tabular-nums`,children:[` · `,d.length,` boards`]}):null]})]}),d.length>0?(0,O.jsxs)(o,{size:`sm`,onClick:k,pending:T,children:[(0,O.jsx)(u,{className:`size-3.5`}),`New board`]}):null]}),v?(0,O.jsx)(`p`,{className:`border-b border-border px-6 py-2 text-13 text-destructive-text`,children:v}):null,(0,O.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[B?(0,O.jsx)(F,{templates:h,templatesStatus:y,creating:T,firstRun:d.length===0,onPick:R,onCancel:A}):null,d.length>0?(0,O.jsx)(`ul`,{className:`px-4 py-1`,children:d.map(e=>(0,O.jsx)(M,{board:e,renaming:_===e.id,onOpen:i,onStartRename:j,onRename:z,onCancelRename:N,onCommand:L},e.id))}):null]})]})}function M({board:e,renaming:t,onOpen:n,onStartRename:r,onRename:i,onCancelRename:a,onCommand:o}){let s=A(e.id),c=(0,w.useCallback)(()=>n(e.id),[e.id,n]),l=(0,w.useCallback)(t=>{t.key===`Enter`&&i(e.id,t.currentTarget.value),t.key===`Escape`&&a()},[e.id,a,i]),u=(0,w.useCallback)(t=>i(e.id,t.currentTarget.value),[e.id,i]);return(0,O.jsxs)(`li`,{"aria-busy":s||void 0,className:`group grid grid-cols-[1fr_auto_auto] items-center gap-5 border-b border-border px-3 py-3 last:border-b-0 hover:bg-secondary`,children:[(0,O.jsx)(`div`,{className:`min-w-0`,children:t?(0,O.jsx)(h,{autoFocus:!0,defaultValue:e.title,onKeyDown:l,onBlur:u,className:`h-7 max-w-sm`,"aria-label":`Board name`}):(0,O.jsxs)(`button`,{type:`button`,onClick:c,className:`block w-full text-left`,children:[(0,O.jsx)(`span`,{className:`block truncate text-15 font-semibold tracking-[-0.005em] text-foreground`,children:e.title}),e.description?(0,O.jsx)(`span`,{className:`mt-0.5 block truncate text-13 text-muted-foreground`,children:e.description}):null]})}),(0,O.jsxs)(`div`,{className:`flex items-center gap-4 text-xs text-muted-foreground`,children:[(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`b`,{className:`font-medium tabular-nums text-foreground`,children:e.columnCount}),` columns`]}),(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`b`,{className:`font-medium tabular-nums text-foreground`,children:e.cardCount}),` cards`]})]}),(0,O.jsx)(N,{board:e,pending:s,onStartRename:r,onCommand:o})]})}function N({board:e,pending:t,onStartRename:n,onCommand:a}){let o=E(t=>t.openMenuId===e.id),{openMenu:c,closeMenu:u}=E.getState(),d=(0,w.useCallback)(t=>{t?c(e.id):u()},[e.id,u,c]),f=(0,w.useCallback)(()=>{u(),n(e.id)},[e.id,u,n]),p=(0,w.useCallback)(()=>{u(),s(l(`board.duplicate`,e.id),()=>a({type:`board.duplicate`,boardId:e.id,title:`${e.title} copy`}))},[e.id,e.title,u,a]),m=(0,w.useCallback)(()=>{u(),s(l(`board.saveAsTemplate`,e.id),()=>a({type:`board.saveAsTemplate`,boardId:e.id,name:e.title}))},[e.id,e.title,u,a]),h=(0,w.useCallback)(()=>{u(),s(l(`board.archive`,e.id),()=>a({type:`board.archive`,boardId:e.id}))},[e.id,u,a]);return(0,O.jsxs)(y,{open:o,onOpenChange:d,children:[(0,O.jsx)(v,{asChild:!0,children:(0,O.jsx)(`button`,{type:`button`,"aria-label":`Actions for ${e.title}`,disabled:t,"aria-busy":t||void 0,className:i(`rounded-md px-1.5 py-1 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100`,t&&`opacity-100`),children:t?(0,O.jsx)(r,{className:`size-4`}):(0,O.jsx)(g,{className:`size-4`})})}),(0,O.jsxs)(_,{align:`end`,className:`w-56 p-1`,children:[(0,O.jsx)(P,{onClick:f,children:`Rename`}),(0,O.jsx)(P,{onClick:p,children:`Duplicate structure`}),(0,O.jsx)(P,{onClick:m,children:`Save as template`}),(0,O.jsx)(`div`,{className:`my-1 h-px bg-border`}),(0,O.jsx)(P,{onClick:h,tone:`destructive`,children:`Archive`})]})]})}function P({onClick:e,children:t,tone:n}){return(0,O.jsx)(`button`,{type:`button`,onClick:e,className:i(`flex w-full items-center rounded-sm px-2 py-1.5 text-left text-xs font-medium hover:bg-secondary`,n===`destructive`&&`text-destructive-text`),children:t})}function F({templates:e,templatesStatus:t,creating:n,firstRun:i,onPick:a,onCancel:s}){let c=(0,w.useCallback)(()=>a(null),[a]);return(0,O.jsxs)(`div`,{className:`px-6 py-8`,children:[i?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`h2`,{className:`text-15 font-semibold text-foreground`,children:`No boards yet.`}),(0,O.jsx)(`p`,{className:`mt-1 max-w-[58ch] text-sm text-muted-foreground`,children:`A board turns issues into work your agents can pick up. Start from a shape, or import an existing tracker.`})]}):(0,O.jsx)(`h2`,{className:`text-15 font-semibold text-foreground`,children:`Start from a shape`}),(0,O.jsxs)(`div`,{className:`mt-4 max-w-xl rounded-lg border border-border`,"aria-busy":n||void 0,children:[e.map(e=>(0,O.jsx)(I,{template:e,disabled:n,onPick:a},e.id)),t===`loading`?(0,O.jsxs)(`p`,{role:`status`,className:`flex items-center gap-2 px-3.5 py-2.5 text-xs text-muted-foreground`,children:[(0,O.jsx)(r,{}),`Loading templates…`]}):null,t===`failed`?(0,O.jsx)(`p`,{className:`px-3.5 py-2.5 text-xs text-muted-foreground`,children:`Couldn't load templates.`}):null,(0,O.jsx)(`button`,{type:`button`,onClick:c,disabled:n,className:`flex w-full items-center border-t border-border px-3.5 py-2.5 text-left hover:bg-secondary disabled:pointer-events-none disabled:opacity-60`,children:(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:`Empty board`}),(0,O.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Name your own columns`})]})})]}),n?(0,O.jsxs)(`p`,{role:`status`,className:`mt-3 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,O.jsx)(r,{}),`Creating board…`]}):null,i?null:(0,O.jsx)(o,{variant:`ghost`,size:`sm`,className:`mt-3`,onClick:s,children:`Cancel`})]})}function I({template:e,disabled:t,onPick:n}){let r=(0,w.useCallback)(()=>n(e),[n,e]),a=e.definition.columns;return(0,O.jsxs)(`button`,{type:`button`,onClick:r,disabled:t,className:`flex w-full items-center gap-3 border-b border-border px-3.5 py-2.5 text-left last:border-b-0 hover:bg-secondary disabled:pointer-events-none disabled:opacity-60`,children:[(0,O.jsxs)(`span`,{className:`min-w-0`,children:[(0,O.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.name}),(0,O.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:a.map(e=>e.title).join(` · `)})]}),(0,O.jsx)(`span`,{"aria-hidden":!0,className:`ml-auto flex shrink-0 gap-1`,children:a.map((t,n)=>(0,O.jsx)(`span`,{className:i(`size-1.5 rounded-full`,t.colorToken?C[t.colorToken]:`bg-muted-icon`)},`${e.id}-${String(n)}`))})]})}export{j as t};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{l as n,u as r}from"./chunk-6KYCQHYJ-C0N1h4Su.js";import{t as i}from"./jsx-runtime-BB9-612F.js";import{n as a}from"./pathUtils-DTWwEzHK.js";import{_t as o}from"./index-R-jfstMQ.js";import{t as s}from"./BoardsPage-CPdXl_9L.js";var c=e(t(),1),l=e(i(),1);function u({projectId:e}){let t=r(),i=n(),u=o(t.sidebarData).find(t=>t.groupKey===e),d=u?a(u.localPath):`Project`,f=(0,c.useCallback)(t=>{i(`/boards/${e}/${t}`)},[i,e]);return(0,l.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,l.jsx)(s,{ownerKind:`project`,ownerId:e,ownerName:d,socket:t.socket,onOpenBoard:f})})}export{u as BoardsRoutePage};
1
+ import{o as e}from"./rolldown-runtime-BCiCTKAo.js";import{t}from"./react-BWPDF9mI.js";import{l as n,u as r}from"./chunk-6KYCQHYJ-C0N1h4Su.js";import{t as i}from"./jsx-runtime-BB9-612F.js";import{n as a}from"./pathUtils-BU6_uBbH.js";import{vt as o}from"./index-CC0TKorl.js";import{t as s}from"./BoardsPage-CmbikRTr.js";var c=e(t(),1),l=e(i(),1);function u({projectId:e}){let t=r(),i=n(),u=o(t.sidebarData).find(t=>t.groupKey===e),d=u?a(u.localPath):`Project`,f=(0,c.useCallback)(t=>{i(`/boards/${e}/${t}`)},[i,e]);return(0,l.jsx)(`div`,{className:`relative flex min-h-0 min-w-0 flex-1 flex-col`,children:(0,l.jsx)(s,{ownerKind:`project`,ownerId:e,ownerName:d,socket:t.socket,onOpenBoard:f})})}export{u as BoardsRoutePage};