@arbidocs/blocks 0.5.56 → 0.5.57

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 (162) hide show
  1. package/dist/{ConnectedCallDock-SPG5XOPH.cjs → ConnectedCallDock-PXETJN7A.cjs} +8 -8
  2. package/dist/{ConnectedCallDock-SPG5XOPH.cjs.map → ConnectedCallDock-PXETJN7A.cjs.map} +1 -1
  3. package/dist/{ConnectedCallDock-7SQ5MX6C.js → ConnectedCallDock-Q52GHY6G.js} +7 -7
  4. package/dist/{ConnectedCallDock-7SQ5MX6C.js.map → ConnectedCallDock-Q52GHY6G.js.map} +1 -1
  5. package/dist/{ConnectedCallRoom-K6QLTTZM.js → ConnectedCallRoom-TUTRI4Y2.js} +7 -7
  6. package/dist/{ConnectedCallRoom-K6QLTTZM.js.map → ConnectedCallRoom-TUTRI4Y2.js.map} +1 -1
  7. package/dist/{ConnectedCallRoom-GFZLXFRF.cjs → ConnectedCallRoom-XCD5R4ES.cjs} +8 -8
  8. package/dist/{ConnectedCallRoom-GFZLXFRF.cjs.map → ConnectedCallRoom-XCD5R4ES.cjs.map} +1 -1
  9. package/dist/{ConnectedNativeDocxComparison-FRWPDSCF.cjs → ConnectedNativeDocxComparison-5PZ6WSQZ.cjs} +17 -17
  10. package/dist/{ConnectedNativeDocxComparison-FRWPDSCF.cjs.map → ConnectedNativeDocxComparison-5PZ6WSQZ.cjs.map} +1 -1
  11. package/dist/{ConnectedStreamedWordArtifact-RBYGJJRG.js → ConnectedNativeDocxComparison-XDXJY7BE.js} +16 -16
  12. package/dist/{ConnectedNativeDocxComparison-KF66UDAF.js.map → ConnectedNativeDocxComparison-XDXJY7BE.js.map} +1 -1
  13. package/dist/{ConnectedNativeDocxEditor-56H656VV.js → ConnectedNativeDocxEditor-LCG54CN6.js} +14 -14
  14. package/dist/{ConnectedNativeDocxEditor-56H656VV.js.map → ConnectedNativeDocxEditor-LCG54CN6.js.map} +1 -1
  15. package/dist/{ConnectedNativeDocxEditor-SFBUJLCE.cjs → ConnectedNativeDocxEditor-QPIT6V7X.cjs} +16 -16
  16. package/dist/{ConnectedNativeDocxEditor-SFBUJLCE.cjs.map → ConnectedNativeDocxEditor-QPIT6V7X.cjs.map} +1 -1
  17. package/dist/{ConnectedStreamedWordArtifact-SC5P4I6K.cjs → ConnectedStreamedWordArtifact-27HU7JG2.cjs} +17 -17
  18. package/dist/ConnectedStreamedWordArtifact-27HU7JG2.cjs.map +1 -0
  19. package/dist/{ConnectedNativeDocxComparison-KF66UDAF.js → ConnectedStreamedWordArtifact-DJ2S2U5U.js} +16 -16
  20. package/dist/ConnectedStreamedWordArtifact-DJ2S2U5U.js.map +1 -0
  21. package/dist/{DocumentReviewCard-YMBLUCOJ.js → DocumentReviewCard-IOM476M4.js} +9 -9
  22. package/dist/{DocumentReviewCard-YMBLUCOJ.js.map → DocumentReviewCard-IOM476M4.js.map} +1 -1
  23. package/dist/{DocumentReviewCard-ZD76R6VW.cjs → DocumentReviewCard-S3ULXYVN.cjs} +14 -14
  24. package/dist/{DocumentReviewCard-ZD76R6VW.cjs.map → DocumentReviewCard-S3ULXYVN.cjs.map} +1 -1
  25. package/dist/{NativeDocxEditor-HJTKCPX2.js → NativeDocxEditor-D6Z7BXTA.js} +4 -4
  26. package/dist/{NativeDocxEditor-HJTKCPX2.js.map → NativeDocxEditor-D6Z7BXTA.js.map} +1 -1
  27. package/dist/{NativeDocxEditor-TVZ6O6YS.cjs → NativeDocxEditor-HE4PQV5F.cjs} +8 -8
  28. package/dist/{NativeDocxEditor-TVZ6O6YS.cjs.map → NativeDocxEditor-HE4PQV5F.cjs.map} +1 -1
  29. package/dist/{WorkspaceTableView-4DZ4YODA.js → WorkspaceTableView-F4PZMXN5.js} +4 -4
  30. package/dist/{WorkspaceTableView-4DZ4YODA.js.map → WorkspaceTableView-F4PZMXN5.js.map} +1 -1
  31. package/dist/{WorkspaceTableView-XHEVFCRP.cjs → WorkspaceTableView-OUPRGWRJ.cjs} +4 -4
  32. package/dist/{WorkspaceTableView-XHEVFCRP.cjs.map → WorkspaceTableView-OUPRGWRJ.cjs.map} +1 -1
  33. package/dist/agents/index.cjs +340 -340
  34. package/dist/agents/index.js +10 -10
  35. package/dist/calls/index.cjs +3 -3
  36. package/dist/calls/index.js +3 -3
  37. package/dist/chat/index.cjs +81 -81
  38. package/dist/chat/index.js +4 -4
  39. package/dist/{chunk-UF7YJ2N6.js → chunk-32SVMYRM.js} +4 -4
  40. package/dist/{chunk-UF7YJ2N6.js.map → chunk-32SVMYRM.js.map} +1 -1
  41. package/dist/{chunk-VFSHI7IX.js → chunk-5TFI4YW2.js} +3 -3
  42. package/dist/{chunk-VFSHI7IX.js.map → chunk-5TFI4YW2.js.map} +1 -1
  43. package/dist/{chunk-VM6UCMII.cjs → chunk-77U3DP44.cjs} +5 -5
  44. package/dist/{chunk-VM6UCMII.cjs.map → chunk-77U3DP44.cjs.map} +1 -1
  45. package/dist/{chunk-K7ZDC5A2.js → chunk-B2GL46SB.js} +3 -3
  46. package/dist/{chunk-K7ZDC5A2.js.map → chunk-B2GL46SB.js.map} +1 -1
  47. package/dist/chunk-BJT4TWWX.cjs +18 -0
  48. package/dist/{chunk-MVMQWERS.cjs.map → chunk-BJT4TWWX.cjs.map} +1 -1
  49. package/dist/{chunk-YTB6DLAD.cjs → chunk-BRYHW3OL.cjs} +4 -4
  50. package/dist/{chunk-YTB6DLAD.cjs.map → chunk-BRYHW3OL.cjs.map} +1 -1
  51. package/dist/{chunk-PSRMPGQU.js → chunk-C2J6FBLB.js} +3 -3
  52. package/dist/{chunk-PSRMPGQU.js.map → chunk-C2J6FBLB.js.map} +1 -1
  53. package/dist/{chunk-QXOB5BV3.cjs → chunk-CPQRQEJL.cjs} +3 -3
  54. package/dist/{chunk-QXOB5BV3.cjs.map → chunk-CPQRQEJL.cjs.map} +1 -1
  55. package/dist/{chunk-YXDHJC4P.js → chunk-DK4NN46N.js} +3 -3
  56. package/dist/{chunk-YXDHJC4P.js.map → chunk-DK4NN46N.js.map} +1 -1
  57. package/dist/{chunk-GPQDC2DG.js → chunk-FKWQAXG6.js} +4 -4
  58. package/dist/{chunk-GPQDC2DG.js.map → chunk-FKWQAXG6.js.map} +1 -1
  59. package/dist/{chunk-MLR3FOS7.js → chunk-GRMMUVQG.js} +4 -4
  60. package/dist/{chunk-MLR3FOS7.js.map → chunk-GRMMUVQG.js.map} +1 -1
  61. package/dist/{chunk-Y4B4BJGA.cjs → chunk-I3ITXJRO.cjs} +21 -21
  62. package/dist/{chunk-Y4B4BJGA.cjs.map → chunk-I3ITXJRO.cjs.map} +1 -1
  63. package/dist/{chunk-WM4JKQTL.cjs → chunk-I6CGE7RZ.cjs} +10 -10
  64. package/dist/{chunk-WM4JKQTL.cjs.map → chunk-I6CGE7RZ.cjs.map} +1 -1
  65. package/dist/{chunk-RXOEQQLW.js → chunk-JIXJR6L2.js} +4 -4
  66. package/dist/{chunk-RXOEQQLW.js.map → chunk-JIXJR6L2.js.map} +1 -1
  67. package/dist/{chunk-K4ZKREVK.js → chunk-JV2CJGHV.js} +3 -3
  68. package/dist/{chunk-K4ZKREVK.js.map → chunk-JV2CJGHV.js.map} +1 -1
  69. package/dist/{chunk-IVGOB4RW.cjs → chunk-KD6ECCAN.cjs} +3 -3
  70. package/dist/{chunk-IVGOB4RW.cjs.map → chunk-KD6ECCAN.cjs.map} +1 -1
  71. package/dist/chunk-KHUWQL2Q.cjs +18 -0
  72. package/dist/{chunk-NOQ3NSBD.cjs.map → chunk-KHUWQL2Q.cjs.map} +1 -1
  73. package/dist/{chunk-N4ARBAL6.cjs → chunk-KO3CME7Z.cjs} +9 -9
  74. package/dist/{chunk-N4ARBAL6.cjs.map → chunk-KO3CME7Z.cjs.map} +1 -1
  75. package/dist/{chunk-75Z5AUMM.js → chunk-KTC6OVQD.js} +3 -3
  76. package/dist/{chunk-75Z5AUMM.js.map → chunk-KTC6OVQD.js.map} +1 -1
  77. package/dist/{chunk-L7KXNEBC.cjs → chunk-L6KTANY2.cjs} +37 -37
  78. package/dist/{chunk-L7KXNEBC.cjs.map → chunk-L6KTANY2.cjs.map} +1 -1
  79. package/dist/{chunk-4NI6CVBC.cjs → chunk-L7ROIPS7.cjs} +27 -27
  80. package/dist/{chunk-4NI6CVBC.cjs.map → chunk-L7ROIPS7.cjs.map} +1 -1
  81. package/dist/{chunk-R42KJSBH.js → chunk-M24OG3RP.js} +6 -6
  82. package/dist/{chunk-R42KJSBH.js.map → chunk-M24OG3RP.js.map} +1 -1
  83. package/dist/{chunk-BTTUZZN3.js → chunk-NIA4H7QN.js} +3 -3
  84. package/dist/{chunk-BTTUZZN3.js.map → chunk-NIA4H7QN.js.map} +1 -1
  85. package/dist/{chunk-YQYA2XP3.cjs → chunk-NT2PELCF.cjs} +18 -18
  86. package/dist/{chunk-YQYA2XP3.cjs.map → chunk-NT2PELCF.cjs.map} +1 -1
  87. package/dist/{chunk-AEXFUPO7.js → chunk-ORFP3QJQ.js} +3 -3
  88. package/dist/{chunk-AEXFUPO7.js.map → chunk-ORFP3QJQ.js.map} +1 -1
  89. package/dist/{chunk-J25HZUGJ.js → chunk-PJJZEDR3.js} +3 -3
  90. package/dist/{chunk-J25HZUGJ.js.map → chunk-PJJZEDR3.js.map} +1 -1
  91. package/dist/{chunk-DV725PNE.cjs → chunk-Q6N56ZBF.cjs} +10 -10
  92. package/dist/{chunk-DV725PNE.cjs.map → chunk-Q6N56ZBF.cjs.map} +1 -1
  93. package/dist/{chunk-YTLDM4S5.js → chunk-QE7VE7HV.js} +9 -9
  94. package/dist/{chunk-YTLDM4S5.js.map → chunk-QE7VE7HV.js.map} +1 -1
  95. package/dist/{chunk-C5Y5AQ5B.js → chunk-QWVZTX2P.js} +3 -3
  96. package/dist/{chunk-C5Y5AQ5B.js.map → chunk-QWVZTX2P.js.map} +1 -1
  97. package/dist/{chunk-UIKLUVKV.js → chunk-RAK4EBNU.js} +3 -3
  98. package/dist/{chunk-UIKLUVKV.js.map → chunk-RAK4EBNU.js.map} +1 -1
  99. package/dist/{chunk-TTSSW6CH.js → chunk-RK2T6RFL.js} +3 -3
  100. package/dist/{chunk-TTSSW6CH.js.map → chunk-RK2T6RFL.js.map} +1 -1
  101. package/dist/{chunk-LMD5WNZB.js → chunk-RLTTVBCT.js} +6 -6
  102. package/dist/{chunk-LMD5WNZB.js.map → chunk-RLTTVBCT.js.map} +1 -1
  103. package/dist/{chunk-JBQ4NYDD.cjs → chunk-RZUZBHIH.cjs} +3 -3
  104. package/dist/{chunk-JBQ4NYDD.cjs.map → chunk-RZUZBHIH.cjs.map} +1 -1
  105. package/dist/{chunk-43KLNPR5.cjs → chunk-SRD5YJJI.cjs} +3 -3
  106. package/dist/{chunk-43KLNPR5.cjs.map → chunk-SRD5YJJI.cjs.map} +1 -1
  107. package/dist/{chunk-2XOTUCZ5.js → chunk-TM6YSWH5.js} +3 -3
  108. package/dist/{chunk-2XOTUCZ5.js.map → chunk-TM6YSWH5.js.map} +1 -1
  109. package/dist/{chunk-RXREIA7W.cjs → chunk-TX3JM4EI.cjs} +11 -11
  110. package/dist/{chunk-RXREIA7W.cjs.map → chunk-TX3JM4EI.cjs.map} +1 -1
  111. package/dist/{chunk-YD3RN2FY.cjs → chunk-UZCHVJ6L.cjs} +3 -3
  112. package/dist/{chunk-YD3RN2FY.cjs.map → chunk-UZCHVJ6L.cjs.map} +1 -1
  113. package/dist/{chunk-IEMN3P5Q.cjs → chunk-VY3JLGRZ.cjs} +7 -7
  114. package/dist/{chunk-IEMN3P5Q.cjs.map → chunk-VY3JLGRZ.cjs.map} +1 -1
  115. package/dist/{chunk-H7FV7YSG.js → chunk-WDJRMPRI.js} +3 -3
  116. package/dist/{chunk-H7FV7YSG.js.map → chunk-WDJRMPRI.js.map} +1 -1
  117. package/dist/{chunk-GKHIRR5A.cjs → chunk-WDR6FO22.cjs} +5 -5
  118. package/dist/{chunk-GKHIRR5A.cjs.map → chunk-WDR6FO22.cjs.map} +1 -1
  119. package/dist/{chunk-WVRAMYDQ.js → chunk-X5QOPSXT.js} +3 -3
  120. package/dist/{chunk-WVRAMYDQ.js.map → chunk-X5QOPSXT.js.map} +1 -1
  121. package/dist/{chunk-4ASLRHJC.cjs → chunk-XZVAKOE2.cjs} +4 -4
  122. package/dist/{chunk-4ASLRHJC.cjs.map → chunk-XZVAKOE2.cjs.map} +1 -1
  123. package/dist/{chunk-EP4K4YQG.cjs → chunk-YMZAHBFL.cjs} +6 -6
  124. package/dist/{chunk-EP4K4YQG.cjs.map → chunk-YMZAHBFL.cjs.map} +1 -1
  125. package/dist/{chunk-KYNWO6EC.js → chunk-YS7MLS4U.js} +4 -4
  126. package/dist/{chunk-KYNWO6EC.js.map → chunk-YS7MLS4U.js.map} +1 -1
  127. package/dist/{chunk-PICGTGEB.cjs → chunk-Z6DNYFVM.cjs} +3 -3
  128. package/dist/{chunk-PICGTGEB.cjs.map → chunk-Z6DNYFVM.cjs.map} +1 -1
  129. package/dist/{chunk-XTRV2JHZ.cjs → chunk-ZDX7X7R5.cjs} +35 -35
  130. package/dist/{chunk-XTRV2JHZ.cjs.map → chunk-ZDX7X7R5.cjs.map} +1 -1
  131. package/dist/connect/docx.cjs +20 -20
  132. package/dist/connect/docx.js +16 -16
  133. package/dist/connect/index.cjs +663 -663
  134. package/dist/connect/index.js +40 -40
  135. package/dist/connect/viewer.cjs +60 -60
  136. package/dist/connect/viewer.js +13 -13
  137. package/dist/docx/index.cjs +51 -51
  138. package/dist/docx/index.js +4 -4
  139. package/dist/facts/index.cjs +57 -57
  140. package/dist/facts/index.js +5 -5
  141. package/dist/files/index.cjs +236 -236
  142. package/dist/files/index.js +4 -4
  143. package/dist/home/index.cjs +29 -29
  144. package/dist/home/index.js +4 -4
  145. package/dist/index.cjs +658 -658
  146. package/dist/index.js +18 -18
  147. package/dist/settings/index.cjs +2 -2
  148. package/dist/settings/index.js +2 -2
  149. package/dist/shell/index.cjs +1 -1
  150. package/dist/shell/index.js +1 -1
  151. package/dist/site/index.cjs +21 -21
  152. package/dist/site/index.js +1 -1
  153. package/dist/studio/index.cjs +6 -6
  154. package/dist/studio/index.js +5 -5
  155. package/dist/workflow-canvas/index.cjs +41 -41
  156. package/dist/workflow-canvas/index.js +16 -16
  157. package/node_modules/@arbidocs/coedit/package.json +1 -1
  158. package/package.json +5 -5
  159. package/dist/ConnectedStreamedWordArtifact-RBYGJJRG.js.map +0 -1
  160. package/dist/ConnectedStreamedWordArtifact-SC5P4I6K.cjs.map +0 -1
  161. package/dist/chunk-MVMQWERS.cjs +0 -18
  162. package/dist/chunk-NOQ3NSBD.cjs +0 -18
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { DocumentUser } from './chunk-WVRAMYDQ.js';
3
- import { useOpenWorkflow, useConnectedWorkflowScopeSource, ConnectedWorkflowDocumentsField, useConnectedWorkspaceRole } from './chunk-UIKLUVKV.js';
4
- import { useWorkflowUsage, WEB_WORKFLOWS, DASHBOARD_PINNED, CUSTOM_TASK, REMIND_TASK, DASHBOARD_OPERATIONS, sortByRecentUse, taskComposerToCreateRequest, taskComposerToUpdateRequest, composerToWorkflowUpdate, moveTargets, workflowToComposerValues, REMIND_TASK_ID, CUSTOM_TASK_ID, taskToComposerValues, TaskComposer, renderWorkflowIcon, AUTOMATION_EVENTS, TaskPlan, TaskRunsDialog, TaskActivityDialog } from './chunk-YTLDM4S5.js';
5
- import { PersonPill } from './chunk-R42KJSBH.js';
2
+ import { DocumentUser } from './chunk-X5QOPSXT.js';
3
+ import { useOpenWorkflow, useConnectedWorkflowScopeSource, ConnectedWorkflowDocumentsField, useConnectedWorkspaceRole } from './chunk-RAK4EBNU.js';
6
4
  import { listTimeZones, detectTimeZone } from './chunk-OJIX5NBN.js';
5
+ import { useWorkflowUsage, WEB_WORKFLOWS, DASHBOARD_PINNED, CUSTOM_TASK, REMIND_TASK, DASHBOARD_OPERATIONS, sortByRecentUse, taskComposerToCreateRequest, taskComposerToUpdateRequest, composerToWorkflowUpdate, moveTargets, workflowToComposerValues, REMIND_TASK_ID, CUSTOM_TASK_ID, taskToComposerValues, TaskComposer, renderWorkflowIcon, AUTOMATION_EVENTS, TaskPlan, TaskRunsDialog, TaskActivityDialog } from './chunk-QE7VE7HV.js';
6
+ import { PersonPill } from './chunk-M24OG3RP.js';
7
7
  import { useConnectedWorkspace } from './chunk-HPXE4BWW.js';
8
8
  import { mergeSkillWorkflows } from './chunk-FZ56BSMQ.js';
9
9
  import { fmtDate } from './chunk-5VYJP6XD.js';
@@ -631,5 +631,5 @@ function useWorkflowsPageState({
631
631
  }
632
632
 
633
633
  export { ConnectedTaskActivityDialog, ConnectedTaskComposer, ConnectedWorkflowHistory, useRenderTaskPerson, useSkillsEnabled, useTaskPeople, useWorkflowDefinitions, useWorkflowTasks, useWorkflowsPageState, workflowRunView };
634
- //# sourceMappingURL=chunk-LMD5WNZB.js.map
635
- //# sourceMappingURL=chunk-LMD5WNZB.js.map
634
+ //# sourceMappingURL=chunk-RLTTVBCT.js.map
635
+ //# sourceMappingURL=chunk-RLTTVBCT.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/workflows/useSkillsEnabled.ts","../src/connection/workflows/useWorkflowDefinitions.ts","../src/connection/workflows/useWorkflowTasks.ts","../src/connection/tasks/ConnectedTaskComposer.tsx","../src/connection/ConnectedWorkflowHistory.tsx","../src/connection/tasks/useTaskPeople.tsx","../src/connection/workflows/useWorkflowsPageState.ts"],"names":["useMemo","useDocuments","useArbiSessionState","jsx","useAgents","useCallback","useWorkflows","useState","useEffect"],"mappings":";;;;;;;;;;;;;;;AASO,SAAS,gBAAA,GAA4B;AAC1C,EAAA,MAAM,EAAE,IAAA,EAAM,YAAA,EAAa,GAAI,eAAA,EAAgB;AAC/C,EAAA,OAAO,cAAc,WAAA,IAAe,KAAA;AACtC;ACwBO,SAAS,sBAAA,GAAuD;AACrE,EAAA,MAAM,EAAE,IAAA,EAAM,QAAA,EAAS,GAAI,SAAA,EAAU;AACrC,EAAA,MAAM,QAAQ,gBAAA,EAAiB;AAC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AC,CAAA;AAAA,EAChC,CAAA,EAAG,EAAE,CAAA;AAEL,EAAAG,UAAU,MAAM;AACd,IAAA,MAAM,WAAW,SAAA,CAAU,IAAA,CAAK,CAAC,IAAA,KAAS,IAAA,CAAK,gBAAgB,iBAAiB,CAAA;AAChF,IAAA,IAAI,CAAC,QAAA,EAAU;AACf,IAAA,WAAA,CAAY,QAAQ,CAAA;AACpB,IAAA,yBAAA,IAA4B;AAAA,EAC9B,GAAG,CAAC,iBAAA,EAAmB,yBAAA,EAA2B,WAAA,EAAa,SAAS,CAAC,CAAA;AAEzE,EAAA,OAAO;AAAA,IACL,SAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA,EAAc,MAAM,UAAA,CAAW,IAAI,CAAA;AAAA,IACnC,YAAA,EAAc,CAAC,EAAA,KAAe,UAAA,CAAW,EAAE,IAAA,EAAM,OAAA,EAAS,IAAI,CAAA;AAAA,IAC9D,UAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,gBAAA,EAAkB;AAAA,GACpB;AACF","file":"chunk-LMD5WNZB.js","sourcesContent":["/**\n * The one gate for everything skill-shaped in the app: the empty chat's Start list, the skill\n * entries of the slash menu, the sidebar's Skills item, the Skills browser's entry points and the\n * typed `/skill` interception. It is the personal `show_skills` user setting, default off; the\n * switch lives in Settings, Experimental (developers only), so today only developers have it.\n */\n\nimport { useUserSettings } from '@arbidocs/react'\n\nexport function useSkillsEnabled(): boolean {\n const { data: userSettings } = useUserSettings()\n return userSettings?.show_skills ?? false\n}\n","/**\n * The one list of workflows: the seeded ones plus every skill the user can invoke (each degraded\n * to a single-field form from its `arg_hint`). The dashboard tiles, the slash menu, tasks and\n * agents all read this.\n */\n\nimport { useMemo } from 'react'\nimport { useSkills } from '@arbidocs/react'\nimport { mergeSkillWorkflows } from '../../agents/workflows/workflow'\nimport { type WorkflowDefinition } from '../../agents/workflows/types'\nimport {\n CUSTOM_TASK,\n DASHBOARD_OPERATIONS,\n DASHBOARD_PINNED,\n REMIND_TASK,\n} from '../../agents/workflows/catalogue/seed'\nimport { useSkillsEnabled } from './useSkillsEnabled'\nimport { sortByRecentUse, useWorkflowUsage } from '../../agents/workflows/catalogue/workflow-usage'\nimport { WEB_WORKFLOWS } from '../../agents/workflows/catalogue/registry'\n\nexport interface UseWorkflowDefinitionsResult {\n /** Every skill workflow of this host: built-ins plus the user's and the marketplace's (one list). */\n skills: WorkflowDefinition[]\n /** The user has skills switched on (`show_skills`): the gate of every skill-shaped surface. */\n skillsEnabled: boolean\n /**\n * The empty chat's Start section: built-ins first (their own order), then the user's own and\n * marketplace skills by recent use, then name. EMPTY for users without skills enabled.\n */\n start: WorkflowDefinition[]\n /** The dashboard Start band: pinned skills in order, then the operation launchers. */\n dashboard: WorkflowDefinition[]\n /** What a task can run: schedulable skills plus a free instruction and a reminder. */\n forTasks: WorkflowDefinition[]\n}\n\nexport function useWorkflowDefinitions(): UseWorkflowDefinitionsResult {\n const { data: listings } = useSkills()\n const usage = useWorkflowUsage()\n const skillsEnabled = useSkillsEnabled()\n return useMemo(() => {\n // An uploaded skill of a built-in's slug is used instead of it.\n const { host: builtins, skills: fromServer } = mergeSkillWorkflows(\n WEB_WORKFLOWS,\n listings ?? []\n )\n const all = [...builtins, ...fromServer]\n const byId = new Map(all.map((w) => [w.id, w]))\n const pinned = DASHBOARD_PINNED.flatMap((id) => {\n const w = byId.get(id)\n return w ? [w] : []\n })\n return {\n skills: all,\n skillsEnabled,\n start: skillsEnabled ? [...builtins, ...sortByRecentUse(fromServer, usage)] : [],\n dashboard: [...pinned, ...DASHBOARD_OPERATIONS],\n forTasks: [CUSTOM_TASK, ...all.filter((w) => w.schedulable), REMIND_TASK],\n }\n }, [listings, usage, skillsEnabled])\n}\n","/**\n * Creating and updating work and workflows from the composer, in one place.\n *\n * \"Now\" is an assistant query with task options (the person's own run: the thread becomes a task); a plain\n * to-do creates work with no run. Any other start (a date, a repeat, an event, after another task) saves a workflow\n * that creates the work when it fires. The request mapping is shared with every host (and tested in\n * blocks): `taskComposerToCreateRequest` decides which.\n *\n * Workspace authorization is a per-run, least-privilege choice (`auth_mode`) composed over the shipped\n * workspace-access-request + grant machinery:\n * - Now -> no tier: the query runs as the person asking, with their own access.\n * - Workflow -> `scheduled_require_auth` by default (asks at run time), or `scheduled_permanent`\n * (\"keep access\"): standing membership so unattended runs can decrypt while the owner\n * is away. Only this tier grants membership.\n */\n\nimport {\n useCreateWorkflow,\n useGrantAgentAccess,\n useRunWorkflow,\n useUpdateWorkflow,\n useDocuments,\n useArbiSessionState,\n useCreateWork,\n useStartTaskQuery,\n useUpdateConversation,\n} from '@arbidocs/react'\nimport { getDocumentTitle } from '@arbidocs/react/ui'\nimport type { components } from '@arbidocs/client'\nimport { useCallback, useMemo } from 'react'\nimport {\n composerToWorkflowUpdate,\n taskComposerToCreateRequest,\n taskComposerToUpdateRequest,\n} from '../../agents/tasks/taskRequest'\nimport { type TaskComposerValues } from '../../agents/tasks/taskComposerTypes'\nimport { type WorkflowDefinition } from '../../agents/workflows/types'\nimport type { TaskPlan } from '../../agents/workflows/planSteps'\nimport { useBlocksEnvironment } from '../../provider/environment'\n\ntype Task = components['schemas']['ConversationResponse']\ntype Workflow = components['schemas']['WorkflowResponse']\n\nexport interface TaskSubmitContext {\n workflow: WorkflowDefinition\n values: TaskComposerValues\n /** Goal checklist for agent work, if one was drafted. */\n plan?: TaskPlan | null\n}\n\n/** What a composer submission created. `ran` is null for work no agent runs. */\nexport type CreateOutcome =\n | { kind: 'work'; task: Pick<Task, 'title'> & { external_id?: string }; ran: boolean | null }\n | { kind: 'workflow'; workflow: Workflow }\n\nexport function useWorkflowTasks() {\n const createWork = useCreateWork()\n const runWorkflow = useRunWorkflow()\n const startQuery = useStartTaskQuery()\n const createWorkflow = useCreateWorkflow()\n const updateConversation = useUpdateConversation()\n const updateWorkflowMutation = useUpdateWorkflow()\n const activeWorkspaceId = useArbiSessionState((s) => s.workspaceId)\n const { openFiles } = useBlocksEnvironment()\n\n // Standing access for a workflow's agent, so its unattended runs can read the workspace. An agent\n // that is already a member makes the server refuse the re-grant: that is no failure here.\n const { mutateAsync: grant } = useGrantAgentAccess()\n const grantAgentAccess = useCallback(\n (agentExtId: string, workspaceId: string) =>\n grant({ agentExtId, workspaceId }).then(\n () => undefined,\n () => undefined\n ),\n [grant]\n )\n // File names for the prompt's wording (\"the document <name>\"): the server is told the ids as well.\n const { data: documents = [] } = useDocuments()\n const documentTitles = useMemo(\n () =>\n Object.fromEntries(documents.map((d) => [d.external_id, getDocumentTitle(d, d.external_id)])),\n [documents]\n )\n\n /**\n * Create work or a workflow. `forceWorkflow` is for the workflow dialog, where even a reminder is\n * saved as a workflow.\n */\n const create = useCallback(\n async (ctx: TaskSubmitContext, forceWorkflow = false): Promise<CreateOutcome> => {\n const request = taskComposerToCreateRequest(\n { ...ctx, documentTitles, plan: ctx.plan ?? null },\n activeWorkspaceId ?? undefined,\n forceWorkflow\n )\n if (request.kind === 'workflow') {\n const workflow = await createWorkflow.mutateAsync(request.body)\n // Keep access: deposit the key for the agent the server assigned (the Assistant when none was\n // picked), while the owner is here, so unattended runs start on their own.\n const workspaceId = workflow.workspace_ext_id ?? request.body.workspace_ext_id\n if (\n workflow.auth_mode === 'scheduled_permanent' &&\n !workflow.on_demand &&\n workflow.agent_ext_id &&\n workspaceId\n ) {\n await grantAgentAccess(workflow.agent_ext_id, workspaceId)\n }\n if (ctx.workflow.documentAction && ctx.values.when === 'now' && !forceWorkflow) {\n const result = await runWorkflow.mutateAsync(workflow.external_id)\n if (result.error) throw new Error(result.error)\n openFiles()\n }\n return { kind: 'workflow', workflow }\n }\n if (request.kind === 'query') {\n // Run now is the person's own assistant query: it makes the thread a task and runs it.\n const { conversationId } = await startQuery.start(request.query)\n return {\n kind: 'work',\n task: { external_id: conversationId, title: request.query.task.title ?? null },\n ran: true,\n }\n }\n // A plain to-do (or reminder): a task with no run.\n const task = await createWork.mutateAsync(request.body)\n return { kind: 'work', task, ran: null }\n },\n [\n activeWorkspaceId,\n createWork,\n createWorkflow,\n documentTitles,\n grantAgentAccess,\n startQuery,\n runWorkflow,\n openFiles,\n ]\n )\n\n /** PATCH the editable fields of a task (the instruction, workspace and agent stay as created). */\n const update = useCallback(\n async (task: Pick<Task, 'external_id'> & { is_owner?: boolean }, ctx: TaskSubmitContext) => {\n const patch = taskComposerToUpdateRequest({ ...ctx, plan: ctx.plan ?? null })\n // Who can see a task is its owner's to change: an editor's save leaves it out.\n if (task.is_owner === false) delete patch.shared\n await updateConversation.mutateAsync({ conversationId: task.external_id, patch })\n },\n [updateConversation]\n )\n\n /** PATCH a workflow: its name, trigger and action. */\n const updateWorkflow = useCallback(\n async (\n workflow: Pick<Workflow, 'external_id' | 'agent_ext_id' | 'workspace_ext_id'> & {\n is_owner?: boolean\n },\n ctx: TaskSubmitContext\n ) => {\n const patch = composerToWorkflowUpdate({ ...ctx, documentTitles, plan: ctx.plan ?? null })\n // Sharing a workflow is its owner's: an editor's save leaves it out.\n if (workflow.is_owner === false) delete patch.shared\n const workspaceId = workflow.workspace_ext_id ?? activeWorkspaceId\n const updated = await updateWorkflowMutation.mutateAsync({\n workflowId: workflow.external_id,\n patch,\n })\n // The agent the server keeps (the Assistant when none was picked) gets the key for unattended runs.\n const agentId = updated.agent_ext_id ?? patch.agent_ext_id ?? workflow.agent_ext_id\n if (\n updated.auth_mode === 'scheduled_permanent' &&\n !updated.on_demand &&\n agentId &&\n workspaceId\n ) {\n await grantAgentAccess(agentId, workspaceId)\n }\n },\n [activeWorkspaceId, documentTitles, grantAgentAccess, updateWorkflowMutation]\n )\n\n return {\n create,\n update,\n updateWorkflow,\n isPending:\n createWork.isPending ||\n startQuery.isPending ||\n createWorkflow.isPending ||\n updateConversation.isPending ||\n updateWorkflowMutation.isPending,\n }\n}\n","/**\n * Create / edit a task, or create / edit a workflow: the `TaskComposer` block, connected.\n *\n * A task is a conversation with a status. \"Now\" (or a plain to-do) creates it; any other start (at a\n * time, on an event, after another task) saves a workflow that creates it when it fires. Pick the\n * workflow definition (or write your own instruction), fill its form, choose when, and who does it.\n * Everything the backend needs beyond that (authorization tier, name, notification, goal checklist)\n * is derived or folded under \"More options\". The API mapping lives in `useWorkflowTasks`, shared with\n * \"launch as another agent\". With `kind=\"workflow\"` it is the workflow dialog the Workflows page uses.\n */\n\nimport {\n useAgents,\n useAgentWorkspaces,\n useArbiSessionState,\n useDocuments,\n usePlanWork,\n useTags,\n useWorkflows,\n useWorkItems,\n useWorkspaces,\n} from '@arbidocs/react'\nimport type { components } from '@arbidocs/client'\nimport { useEffect, useMemo, useState } from 'react'\nimport { Button } from '@arbidocs/react/ui'\nimport { TaskComposer } from '../../agents/tasks/TaskComposer'\nimport { TaskPlan as TaskPlanForm } from '../../agents/tasks/TaskPlan'\nimport type { TaskPlan } from '../../agents/workflows/planSteps'\nimport { moveTargets, type TaskListRow } from '../../agents/tasks/taskRows'\nimport { taskToComposerValues, workflowToComposerValues } from '../../agents/tasks/taskRequest'\nimport { type AgentOption } from '../../agents/workflows/AgentSelect'\nimport { type TaskComposerValues } from '../../agents/tasks/taskComposerTypes'\nimport { ArbiApiError } from '@arbidocs/sdk/browser'\nimport { detectTimeZone, listTimeZones } from '../../calendar/zone'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useOpenWorkflow } from '../workflows/useOpenWorkflow'\n\ntype Task = components['schemas']['ConversationResponse']\ntype Workflow = components['schemas']['WorkflowResponse']\nimport {\n CUSTOM_TASK_ID,\n REMIND_TASK_ID,\n renderWorkflowIcon,\n} from '../../agents/workflows/catalogue/seed'\nimport { useWorkflowDefinitions } from '../workflows/useWorkflowDefinitions'\nimport { useWorkflowTasks } from '../workflows/useWorkflowTasks'\nimport { AUTOMATION_EVENTS } from '../../agents/tasks/taskHelpers'\nimport {\n ConnectedWorkflowDocumentsField,\n useConnectedWorkflowScopeSource,\n} from '../ConnectedWorkflowLauncher'\n\nexport interface ConnectedTaskComposerProps {\n open: boolean\n onOpenChange: (open: boolean) => void\n /** `workflow` is the workflow dialog (new, or `workflow` to edit); the default adds a task. */\n kind?: 'work' | 'workflow'\n /** Save an on-demand recipe instead of running immediately. */\n saveOnly?: boolean\n /** Present -> edit this task; absent -> create. */\n task?: Task | null\n /** `kind=\"workflow\"` only: present -> edit this workflow. */\n workflow?: Workflow | null\n /** Create-mode default assignee (the Agents page's \"Assign task\"). */\n initialAgentExtId?: string\n /** `kind=\"workflow\"` create-mode template: opens with this workflow definition (a skill's) selected. */\n initialWorkflowId?: string\n /** `kind=\"workflow\"` create-mode: open on the Run later view (when, which agent, access). */\n startLater?: boolean\n /** A prompt carried from the quick task launcher into scheduling. */\n initialShared?: boolean\n initialPrompt?: string\n /** A saved recipe copied into a new schedule; the original is not edited. */\n launchWorkflow?: Workflow\n /** Create-mode parent: opens as \"Add sub-task\" under this task. */\n initialParentTaskExtId?: string\n}\n\n/** What \"always allowed\" means: the workspaces the agent will hold standing access to. */\nfunction StandingAccessNote({\n agentId,\n activeWorkspaceName,\n}: {\n agentId: string\n activeWorkspaceName: string | null\n}) {\n const { data: held = [] } = useAgentWorkspaces(agentId, { enabled: agentId !== '' })\n const names = new Set(held.map((w) => w.name))\n if (activeWorkspaceName) names.add(activeWorkspaceName)\n return (\n <p className=\"text-xs text-muted-foreground\" data-testid=\"task-standing-access\">\n {agentId === '' ? 'Your own assistant needs no grant.' : 'It will hold standing access to: '}\n {agentId !== '' && (\n <span className=\"font-medium text-foreground\">\n {[...names].join(', ') || 'no workspace yet'}\n </span>\n )}\n </p>\n )\n}\n\nexport function ConnectedTaskComposer({\n open,\n onOpenChange,\n kind = 'work',\n saveOnly = false,\n task,\n workflow: editingWorkflow,\n initialWorkflowId,\n startLater: startLaterProp,\n initialPrompt,\n initialShared,\n launchWorkflow,\n initialAgentExtId,\n initialParentTaskExtId,\n}: ConnectedTaskComposerProps) {\n const { notify, openConversation, openUpload } = useBlocksEnvironment()\n // Scheduling (\"Run later\") belongs to Workflows: offered while the host has its page.\n const openWorkflow = useOpenWorkflow()\n const automationsEnabled = openWorkflow !== undefined\n const startLater = startLaterProp && automationsEnabled\n const isWorkflow = kind === 'workflow'\n const isEdit = isWorkflow ? !!editingWorkflow : !!task\n const { forTasks: baseSkills, skills } = useWorkflowDefinitions()\n const { data: reviewFields = [] } = useTags()\n const scheduledSkills = useMemo(\n () => [\n ...baseSkills,\n {\n id: '__document_review__',\n title: 'AI Review',\n description: 'Write answers and citations into document fields.',\n documentAction: 'annotate_documents' as const,\n run: { kind: 'operation' as const },\n landing: 'files' as const,\n inputs: [\n { name: 'scope', type: 'scope' as const, label: 'Documents', by: ['labels' as const] },\n {\n name: 'output',\n type: 'select' as const,\n label: 'Review field',\n required: true,\n description:\n 'Choose a field with saved AI instructions. Create one using AI Review in Files.',\n options: reviewFields\n .filter((field) => field.instruction)\n .map((field) => ({ value: field.external_id, label: field.name })),\n },\n {\n name: 'overwrite',\n type: 'boolean' as const,\n label: 'Regenerate existing answers',\n default: false,\n },\n ],\n },\n {\n id: '__document_email__',\n title: 'Email latest documents',\n description: 'Email me links to documents added since the previous successful digest.',\n documentAction: 'email_documents' as const,\n run: { kind: 'operation' as const },\n landing: 'files' as const,\n inputs: [\n { name: 'scope', type: 'scope' as const, label: 'Documents', by: ['labels' as const] },\n {\n name: 'latest',\n type: 'boolean' as const,\n label: 'Only documents added since the last digest',\n default: true,\n },\n ],\n },\n ],\n [baseSkills, reviewFields]\n )\n // A skill opened from the library runs now even if it cannot be scheduled: offer it as a template too.\n const forTasks = useMemo(() => {\n const picked = initialWorkflowId ? skills.find((w) => w.id === initialWorkflowId) : undefined\n return picked &&\n !scheduledSkills.some((w) => w.id === picked.id) &&\n picked.run.kind === 'prompt'\n ? [...scheduledSkills, picked]\n : scheduledSkills\n }, [scheduledSkills, skills, initialWorkflowId])\n const { data: workspaceAutomations = [] } = useWorkflows()\n const { data: agents = [] } = useAgents()\n const { data: workspaces = [] } = useWorkspaces()\n const planWork = usePlanWork()\n const { tasks: allTasks } = useWorkItems()\n const { data: documents = [] } = useDocuments()\n const { create, update, updateWorkflow, isPending } = useWorkflowTasks()\n // The files behind a template's file fields: the same pieces the skill launcher wires.\n const scopeSource = useConnectedWorkflowScopeSource()\n const activeWorkspaceId = useArbiSessionState((s) => s.workspaceId)\n const activeWorkspace = useMemo(\n () => workspaces.find((w) => w.external_id === activeWorkspaceId) ?? null,\n [workspaces, activeWorkspaceId]\n )\n const timezones = useMemo(() => listTimeZones(), [])\n // The plan lists documents by id; show their names.\n const documentNames = useMemo(\n () =>\n Object.fromEntries(\n documents.flatMap((d) => (d.file_name ? [[d.external_id, d.file_name]] : []))\n ),\n [documents]\n )\n // Tasks a new task can be part of: any other task that keeps the sub-task tree within its maximum\n // depth and (when editing) is not the task itself or one of its descendants. A workflow can wait on\n // any task, finished ones included (they re-open and finish again).\n const taskOptions = useMemo(() => {\n const label = (t: TaskListRow) => t.title?.trim() || 'Untitled task'\n if (isWorkflow) return allTasks.map((t) => ({ id: t.external_id, name: label(t) }))\n const subject: TaskListRow = task ?? { external_id: '__new__' }\n return moveTargets<TaskListRow>(\n [...allTasks.filter((t) => t.external_id !== subject.external_id), subject],\n subject\n ).map((t) => ({ id: t.external_id, name: label(t) }))\n }, [allTasks, task, isWorkflow])\n // The owner's main agent: what a scheduled workflow runs as unless another is picked.\n const defaultAgentId = useMemo(\n () => (agents.find((a) => a.given_name === 'Assistant') ?? agents[0])?.external_id,\n [agents]\n )\n const agentOptions = useMemo<AgentOption[]>(\n () => agents.map((a) => ({ id: a.external_id, label: a.given_name || a.email })),\n [agents]\n )\n\n // What the composer opens with: the edit target, or (create) the preset assignee.\n const initialValues = useMemo(() => {\n const ids = {\n customWorkflowId: CUSTOM_TASK_ID,\n reminderWorkflowId: REMIND_TASK_ID,\n definitions: forTasks,\n }\n const base = launchWorkflow\n ? {\n ...workflowToComposerValues(launchWorkflow, ids),\n when: 'once' as const,\n runAt: '',\n rrule: '',\n eventKind: '',\n afterTaskId: '',\n name: '',\n }\n : editingWorkflow\n ? workflowToComposerValues(editingWorkflow, ids)\n : task\n ? taskToComposerValues(task, ids)\n : isWorkflow\n ? {\n // Run now is the default start; scheduling is the fallback in the same field.\n assignee: 'agent' as const,\n workflowId: initialWorkflowId ?? CUSTOM_TASK_ID,\n when: startLater ? ('once' as const) : ('now' as const),\n ...(initialPrompt\n ? {\n inputs: {\n [initialWorkflowId === REMIND_TASK_ID ? 'message' : 'instruction']:\n initialPrompt,\n },\n }\n : {}),\n // A scheduled run needs an agent: the owner's Assistant unless another is picked.\n ...(startLater && defaultAgentId ? { agentId: defaultAgentId } : {}),\n }\n : initialAgentExtId\n ? // Assigning an agent means agentic work: the free instruction, and tell me when done.\n { agentId: initialAgentExtId, workflowId: CUSTOM_TASK_ID, notifyOnComplete: true }\n : {}\n return {\n timezone: detectTimeZone(),\n ...base,\n ...(initialShared !== undefined && !task && !editingWorkflow\n ? { shared: initialShared }\n : {}),\n ...(!task && !isWorkflow && initialParentTaskExtId\n ? { parentTaskId: initialParentTaskExtId }\n : {}),\n }\n }, [\n forTasks,\n task,\n editingWorkflow,\n isWorkflow,\n initialWorkflowId,\n startLater,\n initialPrompt,\n initialShared,\n launchWorkflow,\n defaultAgentId,\n initialAgentExtId,\n initialParentTaskExtId,\n ])\n\n const [plan, setPlan] = useState<TaskPlan | null>(null)\n useEffect(() => {\n if (open) setPlan(task?.plan ?? editingWorkflow?.plan ?? launchWorkflow?.plan ?? null) // the stored plan when editing agent work\n }, [open, task, editingWorkflow, launchWorkflow])\n\n const handleGeneratePlan = async (values: TaskComposerValues) => {\n if (!activeWorkspace) {\n notify('Open a workspace first — the plan is scoped to it', 'warning')\n return\n }\n const objective = String(values.inputs.instruction ?? '').trim()\n if (!objective) {\n notify('Write the instruction first — it’s the planner’s objective', 'warning')\n return\n }\n try {\n const drafted = await planWork.mutateAsync({\n objective,\n max_passes: plan?.max_passes ?? 3,\n })\n setPlan(drafted)\n notify('Drafted a plan — review the checklist', 'success')\n } catch {\n notify('Could not draft a plan', 'error')\n }\n }\n\n const submit = async (submitted: TaskComposerValues, options?: { runOnce?: boolean }) => {\n // A task for me is a plain to-do and runs no workflow.\n const chosen =\n forTasks.find((w) => w.id === submitted.workflowId) ??\n (submitted.assignee === 'me' ? forTasks[0] : undefined)\n if (!chosen) return\n if (plan && !plan.goal.trim()) {\n notify('The plan needs a goal', 'warning')\n return\n }\n if (plan && plan.criteria.some((c) => !c.text.trim())) {\n notify('Every checklist criterion needs text (or remove it)', 'warning')\n return\n }\n const ctx = {\n workflow: chosen,\n values: submitted,\n plan: chosen.id === CUSTOM_TASK_ID ? plan : null,\n }\n try {\n if (isWorkflow && editingWorkflow && !options?.runOnce) {\n await updateWorkflow(editingWorkflow, ctx)\n notify(`Updated “${editingWorkflow.name}”`, 'success')\n } else if (isEdit && task) {\n await update(task, ctx)\n notify(`Updated “${task.title ?? 'task'}”`, 'success')\n } else {\n const created = await create(ctx, saveOnly && !options?.runOnce)\n if (created.kind === 'workflow') {\n notify(`Saved “${created.workflow.name}”.`, 'success')\n // The saved workflow, on the Workflows page.\n openWorkflow?.()\n } else {\n const name = created.task.title ?? 'task'\n if ((created.ran || options?.runOnce) && created.task.external_id) {\n // The run is a thread: go and watch it, rather than leave a toast to say it started.\n openConversation(created.task.external_id)\n } else {\n notify(\n created.ran === null\n ? `Added “${name}”`\n : 'Task created, but the run could not start',\n created.ran === false ? 'warning' : 'success'\n )\n }\n }\n }\n onOpenChange(false)\n } catch (error) {\n const what = `Failed to ${isEdit ? 'update' : 'create'} the ${isWorkflow ? 'workflow' : 'task'}`\n notify(\n error instanceof Error && error.message.startsWith('Open a workspace')\n ? error.message\n : error instanceof ArbiApiError && error.detail\n ? `${what}: ${error.detail}`\n : what,\n 'error'\n )\n }\n }\n\n return (\n <TaskComposer\n key={editingWorkflow?.external_id ?? task?.external_id ?? 'new'}\n open={open}\n onOpenChange={onOpenChange}\n kind={kind}\n saveOnly={saveOnly}\n hideRunLater={!automationsEnabled}\n defaultAgentId={defaultAgentId}\n isEdit={isEdit}\n workflows={forTasks}\n agents={agentOptions}\n tasks={taskOptions}\n initialValues={initialValues}\n timezones={timezones}\n eventOptions={AUTOMATION_EVENTS}\n eventWorkflowOptions={workspaceAutomations\n .filter((item) => item.external_id !== editingWorkflow?.external_id)\n .map((item) => ({ id: item.external_id, label: item.name }))}\n isPending={isPending}\n planDrafting={planWork.isPending}\n hasPlan={plan !== null}\n renderIcon={renderWorkflowIcon}\n scopeSource={scopeSource}\n renderDocuments={(field, value, onChange) => (\n <ConnectedWorkflowDocumentsField\n field={field}\n value={value}\n onChange={onChange}\n onAddFiles={openUpload}\n />\n )}\n addFilesAction={\n openUpload && (\n <Button size=\"sm\" onClick={() => openUpload()} data-testid=\"workflow-add-files-first\">\n Add files\n </Button>\n )\n }\n onDropFiles={openUpload && ((files) => openUpload(files))}\n standingAccess={(values) => (\n <StandingAccessNote\n agentId={values.agentId}\n activeWorkspaceName={activeWorkspace?.name ?? null}\n />\n )}\n labels={{\n ...(isWorkflow\n ? {\n titleNewWorkflow: 'New workflow',\n titleEditWorkflow: 'Edit workflow',\n workflowNamePlaceholder: 'Name this workflow',\n createWorkflow: 'Create workflow',\n saveWorkflow: 'Save workflow',\n descriptionWorkflow: 'Choose what happens and when this workflow starts.',\n eventHint: 'Choose the workspace event that starts this workflow.',\n runAsAgentHint: 'Scheduled AI work runs as your chosen assistant when you are away.',\n }\n : {}),\n ...(plan\n ? { addAndStart: 'Approve plan and start', addAndSchedule: 'Approve plan and schedule' }\n : {}),\n }}\n onSubmit={submit}\n goal={(values) =>\n values.workflowId === CUSTOM_TASK_ID ? (\n <TaskPlanForm\n plan={plan}\n onChange={setPlan}\n onGenerate={() => handleGeneratePlan(values)}\n isGenerating={planWork.isPending}\n workspaceName={activeWorkspace?.name ?? null}\n documentNames={documentNames}\n objective={String(values.inputs.instruction ?? '')}\n />\n ) : null\n }\n />\n )\n}\n","/**\n * A saved workflow's history and a task's activity, bound to the connection.\n *\n * - `ConnectedWorkflowHistory`: every run of a workflow (re-read while shown), each with when, what\n * it was (a thread, an email, an AI review, a reminder) and how it went; a run's thread opens\n * through the environment's `openConversation`, a document action's result through the host.\n * - `ConnectedTaskActivityDialog`: a task's timeline (re-read while it runs), with who did what.\n */\n\nimport { useCallback, type ReactNode } from 'react'\nimport { useAgents, useConversationActivity, useWorkflowRuns } from '@arbidocs/react'\nimport { formatRelativeTime } from '@arbidocs/react/ui'\nimport {\n TaskRunsDialog,\n type TaskRunView,\n type TaskRunsDialogLabels,\n} from '../agents/tasks/TaskRunsDialog'\nimport { TaskActivityDialog } from '../agents/tasks/TaskActivityDialog'\nimport type { TaskActivityEvent } from '../agents/tasks/TaskActivityTimeline'\nimport { PersonPill, type TaskPerson } from '../agents/tasks/PersonPill'\nimport { fmtDate } from '../lib/format'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedWorkspaceRole } from './ConnectedWorkflowsTable'\n\ntype WorkflowRun = NonNullable<ReturnType<typeof useWorkflowRuns>['data']>[number]\n\n/** What a run was, in a word. */\nconst RUN_KIND: Record<string, string> = {\n email_documents: 'Email',\n annotate_documents: 'AI Review',\n reminder: 'Reminder',\n}\nconst DOCUMENT_ACTIONS = new Set(['email_documents', 'annotate_documents'])\n\n/** A run as the history lists it: when, what, on how many documents. */\nexport function workflowRunView(\n run: WorkflowRun,\n formatDate: (iso: string) => string\n): TaskRunView {\n const documents = DOCUMENT_ACTIONS.has(run.action_type)\n ? ` · ${run.document_ext_ids.length} documents`\n : ''\n return {\n id: `execution-${run.id}`,\n // An AI review that finished has a result to open (its fields over its documents).\n resultId:\n run.action_type === 'annotate_documents' && run.status === 'completed'\n ? String(run.id)\n : undefined,\n status: run.status,\n when: `${formatDate(run.created_at)} · ${RUN_KIND[run.action_type] ?? 'Thread'}${documents}`,\n error: run.error,\n conversationId: run.conversation_ext_id ?? undefined,\n }\n}\n\nexport interface ConnectedWorkflowHistoryProps {\n /** The workflow (`null`: closed). */\n workflow: { external_id: string; name: string } | null\n onOpenChange: (open: boolean) => void\n /** In the page rather than a dialog. */\n inline?: boolean\n hideHeader?: boolean\n formatDate?: (iso: string) => string\n /** Open a document action's result (an AI review's fields): the host's. Absent: no Open. */\n onOpenResult?: (run: WorkflowRun) => void\n /** Under a failed run: e.g. a way to report it. */\n renderErrorReport?: (run: TaskRunView) => ReactNode\n labels?: Partial<TaskRunsDialogLabels>\n}\n\nexport function ConnectedWorkflowHistory({\n workflow,\n onOpenChange,\n inline,\n hideHeader,\n formatDate = fmtDate,\n onOpenResult,\n renderErrorReport,\n labels,\n}: ConnectedWorkflowHistoryProps) {\n const { openConversation } = useBlocksEnvironment()\n const { data: runs = [], isLoading } = useWorkflowRuns(workflow?.external_id)\n return (\n <TaskRunsDialog\n inline={inline}\n hideHeader={hideHeader}\n open={!!workflow}\n onOpenChange={onOpenChange}\n taskName={workflow?.name}\n renderErrorReport={renderErrorReport}\n isLoading={isLoading}\n labels={{\n title: (name) => `History — ${name}`,\n description: 'Executions and results of this workflow.',\n empty: 'This workflow hasn’t run yet.',\n ...labels,\n }}\n runs={runs.map((run) => workflowRunView(run, formatDate))}\n onOpenResult={\n onOpenResult &&\n ((id) => {\n const run = runs.find((r) => String(r.id) === id)\n if (run) onOpenResult(run)\n })\n }\n onOpenRun={(conversationId) => openConversation(conversationId)}\n />\n )\n}\n\n/** Relative time, compact for list rows. */\nconst relativeTime = (iso: string) => formatRelativeTime(iso, { style: 'short' })\n\nexport interface ConnectedTaskActivityDialogProps {\n conversationId: string\n taskName: string\n /** The run is generating right now: the timeline then re-reads itself every few seconds. */\n live?: boolean\n onClose: () => void\n /** How a person shows (the host's own pill). Default: the shared pill with their name. */\n renderPerson?: (person: TaskPerson) => ReactNode\n formatExact?: (iso: string) => string\n}\n\nexport function ConnectedTaskActivityDialog({\n conversationId,\n taskName,\n live,\n onClose,\n renderPerson: renderTaskPerson,\n formatExact = fmtDate,\n}: ConnectedTaskActivityDialogProps) {\n const activity = useConversationActivity(conversationId, { live })\n const { data: agents = [] } = useAgents()\n const { userId } = useConnectedWorkspace()\n const { members } = useConnectedWorkspaceRole()\n const renderPerson = useCallback(\n (id: string | null | undefined) => {\n const isMe = !!id && id === userId\n const member = members.find((m) => m.user.external_id === id)?.user\n const name =\n (member && [member.given_name, member.family_name].filter(Boolean).join(' ')) ||\n member?.email\n const person = { id, label: isMe ? 'You' : name || 'Someone', isMe }\n return renderTaskPerson ? renderTaskPerson(person) : <PersonPill person={person} />\n },\n [renderTaskPerson, userId, members]\n )\n const agentName = useCallback(\n (agentId: string) => agents.find((a) => a.external_id === agentId)?.given_name ?? undefined,\n [agents]\n )\n return (\n <TaskActivityDialog\n open\n onOpenChange={(open) => !open && onClose()}\n taskName={taskName}\n events={activity.data as TaskActivityEvent[] | undefined}\n isLoading={activity.isLoading}\n isError={activity.isError}\n renderPerson={renderPerson}\n agentName={agentName}\n formatRelative={relativeTime}\n formatExact={formatExact}\n />\n )\n}\n","import { useCallback, useMemo, type ReactNode } from 'react'\nimport { useAgents, useArbiSession, useWorkspaceUsers } from '@arbidocs/react'\nimport { getUserDisplayName, isAgent } from '@arbidocs/react/ui'\nimport { PersonPill, type TaskPerson } from '../../agents/tasks/PersonPill'\nimport { DocumentUser } from '../files/fields/DocumentUser'\n\n/** The workspace roles that can edit it. */\nconst EDITOR_ROLES: readonly string[] = ['owner', 'collaborator']\n\n/**\n * People who can own tasks here: humans (never agents) who can edit the workspace, other than me\n * (the task list shows me as \"Me\"). They name each task's owner.\n */\nexport function useTaskPeople(): { id: string; label: string }[] {\n const { data: members = [] } = useWorkspaceUsers()\n const currentUserExtId = useArbiSession().user?.external_id\n return useMemo(\n () =>\n members\n .filter(\n (m) =>\n !isAgent(m.user) &&\n m.user.external_id !== currentUserExtId &&\n EDITOR_ROLES.includes(m.role)\n )\n .map((m) => ({ id: m.user.external_id, label: getUserDisplayName(m.user) })),\n [members, currentUserExtId]\n )\n}\n\n/**\n * How the Tasks table draws a person: the host's own user pill (presence, a click to message, the\n * rich tooltip) when the person is a member or agent we know, else the plain shared pill.\n */\nexport function useRenderTaskPerson(): (person: TaskPerson) => ReactNode {\n const { data: members = [] } = useWorkspaceUsers()\n const { data: agents = [] } = useAgents()\n const byId = useMemo(() => {\n const map = new Map(members.map((m) => [m.user.external_id, m.user]))\n for (const agent of agents) if (!map.has(agent.external_id)) map.set(agent.external_id, agent)\n return map\n }, [members, agents])\n return useCallback(\n (person: TaskPerson) => {\n const user = person.id ? byId.get(person.id) : undefined\n return user ? <DocumentUser user={user} variant=\"pill\" /> : <PersonPill person={person} />\n },\n [byId]\n )\n}\n","import { useCallback, useEffect, useState } from 'react'\nimport { useWorkflows, type WorkflowResponse } from '@arbidocs/react'\n\n/** A saved workflow, a new one, or a host catalogue entry opened as a template. */\nexport type WorkflowBuilderSelection =\n { kind: 'saved'; id: string } | { kind: 'new' } | { kind: 'template'; id: string }\n\nexport interface WorkflowsPageStateOptions {\n initialBuilder?: WorkflowBuilderSelection\n /** A host deep link to consume once the saved workflow has loaded. */\n historyWorkflowId?: string | null\n onHistoryWorkflowConsumed?: () => void\n}\n\n/** Shared selection lifecycle for workflow tables, builders and history views. No routing or layout. */\nexport function useWorkflowsPageState({\n initialBuilder,\n historyWorkflowId,\n onHistoryWorkflowConsumed,\n}: WorkflowsPageStateOptions = {}) {\n const { data: workflows = [] } = useWorkflows({ live: true })\n const [builder, setBuilder] = useState<WorkflowBuilderSelection | null>(initialBuilder ?? null)\n const [builderKey, setBuilderKey] = useState(0)\n const [historyIds, setHistoryIds] = useState<string[]>([])\n const [activeHistoryId, setActiveHistoryId] = useState<string | null>(null)\n // Resolve against current query data: renaming/deleting a workflow cannot leave a stale dialog.\n const historyFor = workflows.find((workflow) => workflow.external_id === activeHistoryId) ?? null\n const historyTabs = historyIds.flatMap((id) => {\n const workflow = workflows.find((item) => item.external_id === id)\n return workflow ? [workflow] : []\n })\n\n const openHistory = useCallback((workflow: WorkflowResponse | null) => {\n const id = workflow?.external_id ?? null\n if (id) setHistoryIds((ids) => (ids.includes(id) ? ids : [...ids, id]))\n setActiveHistoryId(id)\n }, [])\n const closeHistoryTab = useCallback((id: string) => {\n setHistoryIds((ids) => ids.filter((item) => item !== id))\n setActiveHistoryId((active) => (active === id ? null : active))\n }, [])\n const openBuilder = useCallback((selection: WorkflowBuilderSelection) => {\n setBuilder(selection)\n // Reopening a template/new/saved selection resets its unsaved canvas; saving does not.\n setBuilderKey((key) => key + 1)\n }, [])\n\n useEffect(() => {\n const workflow = workflows.find((item) => item.external_id === historyWorkflowId)\n if (!workflow) return\n openHistory(workflow)\n onHistoryWorkflowConsumed?.()\n }, [historyWorkflowId, onHistoryWorkflowConsumed, openHistory, workflows])\n\n return {\n workflows,\n builder,\n builderKey,\n openBuilder,\n closeBuilder: () => setBuilder(null),\n builderSaved: (id: string) => setBuilder({ kind: 'saved', id }),\n historyFor,\n historyTabs,\n activeHistoryId,\n openHistory,\n closeHistoryTab,\n selectHistoryTab: setActiveHistoryId,\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/connection/workflows/useSkillsEnabled.ts","../src/connection/workflows/useWorkflowDefinitions.ts","../src/connection/workflows/useWorkflowTasks.ts","../src/connection/tasks/ConnectedTaskComposer.tsx","../src/connection/ConnectedWorkflowHistory.tsx","../src/connection/tasks/useTaskPeople.tsx","../src/connection/workflows/useWorkflowsPageState.ts"],"names":["useMemo","useDocuments","useArbiSessionState","jsx","useAgents","useCallback","useWorkflows","useState","useEffect"],"mappings":";;;;;;;;;;;;;;;AASO,SAAS,gBAAA,GAA4B;AAC1C,EAAA,MAAM,EAAE,IAAA,EAAM,YAAA,EAAa,GAAI,eAAA,EAAgB;AAC/C,EAAA,OAAO,cAAc,WAAA,IAAe,KAAA;AACtC;ACwBO,SAAS,sBAAA,GAAuD;AACrE,EAAA,MAAM,EAAE,IAAA,EAAM,QAAA,EAAS,GAAI,SAAA,EAAU;AACrC,EAAA,MAAM,QAAQ,gBA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GAAA,GAAM,CAAC,CAAA;AAAA,EAChC,CAAA,EAAG,EAAE,CAAA;AAEL,EAAAG,UAAU,MAAM;AACd,IAAA,MAAM,WAAW,SAAA,CAAU,IAAA,CAAK,CAAC,IAAA,KAAS,IAAA,CAAK,gBAAgB,iBAAiB,CAAA;AAChF,IAAA,IAAI,CAAC,QAAA,EAAU;AACf,IAAA,WAAA,CAAY,QAAQ,CAAA;AACpB,IAAA,yBAAA,IAA4B;AAAA,EAC9B,GAAG,CAAC,iBAAA,EAAmB,yBAAA,EAA2B,WAAA,EAAa,SAAS,CAAC,CAAA;AAEzE,EAAA,OAAO;AAAA,IACL,SAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA,EAAc,MAAM,UAAA,CAAW,IAAI,CAAA;AAAA,IACnC,YAAA,EAAc,CAAC,EAAA,KAAe,UAAA,CAAW,EAAE,IAAA,EAAM,OAAA,EAAS,IAAI,CAAA;AAAA,IAC9D,UAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,gBAAA,EAAkB;AAAA,GACpB;AACF","file":"chunk-RLTTVBCT.js","sourcesContent":["/**\n * The one gate for everything skill-shaped in the app: the empty chat's Start list, the skill\n * entries of the slash menu, the sidebar's Skills item, the Skills browser's entry points and the\n * typed `/skill` interception. It is the personal `show_skills` user setting, default off; the\n * switch lives in Settings, Experimental (developers only), so today only developers have it.\n */\n\nimport { useUserSettings } from '@arbidocs/react'\n\nexport function useSkillsEnabled(): boolean {\n const { data: userSettings } = useUserSettings()\n return userSettings?.show_skills ?? false\n}\n","/**\n * The one list of workflows: the seeded ones plus every skill the user can invoke (each degraded\n * to a single-field form from its `arg_hint`). The dashboard tiles, the slash menu, tasks and\n * agents all read this.\n */\n\nimport { useMemo } from 'react'\nimport { useSkills } from '@arbidocs/react'\nimport { mergeSkillWorkflows } from '../../agents/workflows/workflow'\nimport { type WorkflowDefinition } from '../../agents/workflows/types'\nimport {\n CUSTOM_TASK,\n DASHBOARD_OPERATIONS,\n DASHBOARD_PINNED,\n REMIND_TASK,\n} from '../../agents/workflows/catalogue/seed'\nimport { useSkillsEnabled } from './useSkillsEnabled'\nimport { sortByRecentUse, useWorkflowUsage } from '../../agents/workflows/catalogue/workflow-usage'\nimport { WEB_WORKFLOWS } from '../../agents/workflows/catalogue/registry'\n\nexport interface UseWorkflowDefinitionsResult {\n /** Every skill workflow of this host: built-ins plus the user's and the marketplace's (one list). */\n skills: WorkflowDefinition[]\n /** The user has skills switched on (`show_skills`): the gate of every skill-shaped surface. */\n skillsEnabled: boolean\n /**\n * The empty chat's Start section: built-ins first (their own order), then the user's own and\n * marketplace skills by recent use, then name. EMPTY for users without skills enabled.\n */\n start: WorkflowDefinition[]\n /** The dashboard Start band: pinned skills in order, then the operation launchers. */\n dashboard: WorkflowDefinition[]\n /** What a task can run: schedulable skills plus a free instruction and a reminder. */\n forTasks: WorkflowDefinition[]\n}\n\nexport function useWorkflowDefinitions(): UseWorkflowDefinitionsResult {\n const { data: listings } = useSkills()\n const usage = useWorkflowUsage()\n const skillsEnabled = useSkillsEnabled()\n return useMemo(() => {\n // An uploaded skill of a built-in's slug is used instead of it.\n const { host: builtins, skills: fromServer } = mergeSkillWorkflows(\n WEB_WORKFLOWS,\n listings ?? []\n )\n const all = [...builtins, ...fromServer]\n const byId = new Map(all.map((w) => [w.id, w]))\n const pinned = DASHBOARD_PINNED.flatMap((id) => {\n const w = byId.get(id)\n return w ? [w] : []\n })\n return {\n skills: all,\n skillsEnabled,\n start: skillsEnabled ? [...builtins, ...sortByRecentUse(fromServer, usage)] : [],\n dashboard: [...pinned, ...DASHBOARD_OPERATIONS],\n forTasks: [CUSTOM_TASK, ...all.filter((w) => w.schedulable), REMIND_TASK],\n }\n }, [listings, usage, skillsEnabled])\n}\n","/**\n * Creating and updating work and workflows from the composer, in one place.\n *\n * \"Now\" is an assistant query with task options (the person's own run: the thread becomes a task); a plain\n * to-do creates work with no run. Any other start (a date, a repeat, an event, after another task) saves a workflow\n * that creates the work when it fires. The request mapping is shared with every host (and tested in\n * blocks): `taskComposerToCreateRequest` decides which.\n *\n * Workspace authorization is a per-run, least-privilege choice (`auth_mode`) composed over the shipped\n * workspace-access-request + grant machinery:\n * - Now -> no tier: the query runs as the person asking, with their own access.\n * - Workflow -> `scheduled_require_auth` by default (asks at run time), or `scheduled_permanent`\n * (\"keep access\"): standing membership so unattended runs can decrypt while the owner\n * is away. Only this tier grants membership.\n */\n\nimport {\n useCreateWorkflow,\n useGrantAgentAccess,\n useRunWorkflow,\n useUpdateWorkflow,\n useDocuments,\n useArbiSessionState,\n useCreateWork,\n useStartTaskQuery,\n useUpdateConversation,\n} from '@arbidocs/react'\nimport { getDocumentTitle } from '@arbidocs/react/ui'\nimport type { components } from '@arbidocs/client'\nimport { useCallback, useMemo } from 'react'\nimport {\n composerToWorkflowUpdate,\n taskComposerToCreateRequest,\n taskComposerToUpdateRequest,\n} from '../../agents/tasks/taskRequest'\nimport { type TaskComposerValues } from '../../agents/tasks/taskComposerTypes'\nimport { type WorkflowDefinition } from '../../agents/workflows/types'\nimport type { TaskPlan } from '../../agents/workflows/planSteps'\nimport { useBlocksEnvironment } from '../../provider/environment'\n\ntype Task = components['schemas']['ConversationResponse']\ntype Workflow = components['schemas']['WorkflowResponse']\n\nexport interface TaskSubmitContext {\n workflow: WorkflowDefinition\n values: TaskComposerValues\n /** Goal checklist for agent work, if one was drafted. */\n plan?: TaskPlan | null\n}\n\n/** What a composer submission created. `ran` is null for work no agent runs. */\nexport type CreateOutcome =\n | { kind: 'work'; task: Pick<Task, 'title'> & { external_id?: string }; ran: boolean | null }\n | { kind: 'workflow'; workflow: Workflow }\n\nexport function useWorkflowTasks() {\n const createWork = useCreateWork()\n const runWorkflow = useRunWorkflow()\n const startQuery = useStartTaskQuery()\n const createWorkflow = useCreateWorkflow()\n const updateConversation = useUpdateConversation()\n const updateWorkflowMutation = useUpdateWorkflow()\n const activeWorkspaceId = useArbiSessionState((s) => s.workspaceId)\n const { openFiles } = useBlocksEnvironment()\n\n // Standing access for a workflow's agent, so its unattended runs can read the workspace. An agent\n // that is already a member makes the server refuse the re-grant: that is no failure here.\n const { mutateAsync: grant } = useGrantAgentAccess()\n const grantAgentAccess = useCallback(\n (agentExtId: string, workspaceId: string) =>\n grant({ agentExtId, workspaceId }).then(\n () => undefined,\n () => undefined\n ),\n [grant]\n )\n // File names for the prompt's wording (\"the document <name>\"): the server is told the ids as well.\n const { data: documents = [] } = useDocuments()\n const documentTitles = useMemo(\n () =>\n Object.fromEntries(documents.map((d) => [d.external_id, getDocumentTitle(d, d.external_id)])),\n [documents]\n )\n\n /**\n * Create work or a workflow. `forceWorkflow` is for the workflow dialog, where even a reminder is\n * saved as a workflow.\n */\n const create = useCallback(\n async (ctx: TaskSubmitContext, forceWorkflow = false): Promise<CreateOutcome> => {\n const request = taskComposerToCreateRequest(\n { ...ctx, documentTitles, plan: ctx.plan ?? null },\n activeWorkspaceId ?? undefined,\n forceWorkflow\n )\n if (request.kind === 'workflow') {\n const workflow = await createWorkflow.mutateAsync(request.body)\n // Keep access: deposit the key for the agent the server assigned (the Assistant when none was\n // picked), while the owner is here, so unattended runs start on their own.\n const workspaceId = workflow.workspace_ext_id ?? request.body.workspace_ext_id\n if (\n workflow.auth_mode === 'scheduled_permanent' &&\n !workflow.on_demand &&\n workflow.agent_ext_id &&\n workspaceId\n ) {\n await grantAgentAccess(workflow.agent_ext_id, workspaceId)\n }\n if (ctx.workflow.documentAction && ctx.values.when === 'now' && !forceWorkflow) {\n const result = await runWorkflow.mutateAsync(workflow.external_id)\n if (result.error) throw new Error(result.error)\n openFiles()\n }\n return { kind: 'workflow', workflow }\n }\n if (request.kind === 'query') {\n // Run now is the person's own assistant query: it makes the thread a task and runs it.\n const { conversationId } = await startQuery.start(request.query)\n return {\n kind: 'work',\n task: { external_id: conversationId, title: request.query.task.title ?? null },\n ran: true,\n }\n }\n // A plain to-do (or reminder): a task with no run.\n const task = await createWork.mutateAsync(request.body)\n return { kind: 'work', task, ran: null }\n },\n [\n activeWorkspaceId,\n createWork,\n createWorkflow,\n documentTitles,\n grantAgentAccess,\n startQuery,\n runWorkflow,\n openFiles,\n ]\n )\n\n /** PATCH the editable fields of a task (the instruction, workspace and agent stay as created). */\n const update = useCallback(\n async (task: Pick<Task, 'external_id'> & { is_owner?: boolean }, ctx: TaskSubmitContext) => {\n const patch = taskComposerToUpdateRequest({ ...ctx, plan: ctx.plan ?? null })\n // Who can see a task is its owner's to change: an editor's save leaves it out.\n if (task.is_owner === false) delete patch.shared\n await updateConversation.mutateAsync({ conversationId: task.external_id, patch })\n },\n [updateConversation]\n )\n\n /** PATCH a workflow: its name, trigger and action. */\n const updateWorkflow = useCallback(\n async (\n workflow: Pick<Workflow, 'external_id' | 'agent_ext_id' | 'workspace_ext_id'> & {\n is_owner?: boolean\n },\n ctx: TaskSubmitContext\n ) => {\n const patch = composerToWorkflowUpdate({ ...ctx, documentTitles, plan: ctx.plan ?? null })\n // Sharing a workflow is its owner's: an editor's save leaves it out.\n if (workflow.is_owner === false) delete patch.shared\n const workspaceId = workflow.workspace_ext_id ?? activeWorkspaceId\n const updated = await updateWorkflowMutation.mutateAsync({\n workflowId: workflow.external_id,\n patch,\n })\n // The agent the server keeps (the Assistant when none was picked) gets the key for unattended runs.\n const agentId = updated.agent_ext_id ?? patch.agent_ext_id ?? workflow.agent_ext_id\n if (\n updated.auth_mode === 'scheduled_permanent' &&\n !updated.on_demand &&\n agentId &&\n workspaceId\n ) {\n await grantAgentAccess(agentId, workspaceId)\n }\n },\n [activeWorkspaceId, documentTitles, grantAgentAccess, updateWorkflowMutation]\n )\n\n return {\n create,\n update,\n updateWorkflow,\n isPending:\n createWork.isPending ||\n startQuery.isPending ||\n createWorkflow.isPending ||\n updateConversation.isPending ||\n updateWorkflowMutation.isPending,\n }\n}\n","/**\n * Create / edit a task, or create / edit a workflow: the `TaskComposer` block, connected.\n *\n * A task is a conversation with a status. \"Now\" (or a plain to-do) creates it; any other start (at a\n * time, on an event, after another task) saves a workflow that creates it when it fires. Pick the\n * workflow definition (or write your own instruction), fill its form, choose when, and who does it.\n * Everything the backend needs beyond that (authorization tier, name, notification, goal checklist)\n * is derived or folded under \"More options\". The API mapping lives in `useWorkflowTasks`, shared with\n * \"launch as another agent\". With `kind=\"workflow\"` it is the workflow dialog the Workflows page uses.\n */\n\nimport {\n useAgents,\n useAgentWorkspaces,\n useArbiSessionState,\n useDocuments,\n usePlanWork,\n useTags,\n useWorkflows,\n useWorkItems,\n useWorkspaces,\n} from '@arbidocs/react'\nimport type { components } from '@arbidocs/client'\nimport { useEffect, useMemo, useState } from 'react'\nimport { Button } from '@arbidocs/react/ui'\nimport { TaskComposer } from '../../agents/tasks/TaskComposer'\nimport { TaskPlan as TaskPlanForm } from '../../agents/tasks/TaskPlan'\nimport type { TaskPlan } from '../../agents/workflows/planSteps'\nimport { moveTargets, type TaskListRow } from '../../agents/tasks/taskRows'\nimport { taskToComposerValues, workflowToComposerValues } from '../../agents/tasks/taskRequest'\nimport { type AgentOption } from '../../agents/workflows/AgentSelect'\nimport { type TaskComposerValues } from '../../agents/tasks/taskComposerTypes'\nimport { ArbiApiError } from '@arbidocs/sdk/browser'\nimport { detectTimeZone, listTimeZones } from '../../calendar/zone'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useOpenWorkflow } from '../workflows/useOpenWorkflow'\n\ntype Task = components['schemas']['ConversationResponse']\ntype Workflow = components['schemas']['WorkflowResponse']\nimport {\n CUSTOM_TASK_ID,\n REMIND_TASK_ID,\n renderWorkflowIcon,\n} from '../../agents/workflows/catalogue/seed'\nimport { useWorkflowDefinitions } from '../workflows/useWorkflowDefinitions'\nimport { useWorkflowTasks } from '../workflows/useWorkflowTasks'\nimport { AUTOMATION_EVENTS } from '../../agents/tasks/taskHelpers'\nimport {\n ConnectedWorkflowDocumentsField,\n useConnectedWorkflowScopeSource,\n} from '../ConnectedWorkflowLauncher'\n\nexport interface ConnectedTaskComposerProps {\n open: boolean\n onOpenChange: (open: boolean) => void\n /** `workflow` is the workflow dialog (new, or `workflow` to edit); the default adds a task. */\n kind?: 'work' | 'workflow'\n /** Save an on-demand recipe instead of running immediately. */\n saveOnly?: boolean\n /** Present -> edit this task; absent -> create. */\n task?: Task | null\n /** `kind=\"workflow\"` only: present -> edit this workflow. */\n workflow?: Workflow | null\n /** Create-mode default assignee (the Agents page's \"Assign task\"). */\n initialAgentExtId?: string\n /** `kind=\"workflow\"` create-mode template: opens with this workflow definition (a skill's) selected. */\n initialWorkflowId?: string\n /** `kind=\"workflow\"` create-mode: open on the Run later view (when, which agent, access). */\n startLater?: boolean\n /** A prompt carried from the quick task launcher into scheduling. */\n initialShared?: boolean\n initialPrompt?: string\n /** A saved recipe copied into a new schedule; the original is not edited. */\n launchWorkflow?: Workflow\n /** Create-mode parent: opens as \"Add sub-task\" under this task. */\n initialParentTaskExtId?: string\n}\n\n/** What \"always allowed\" means: the workspaces the agent will hold standing access to. */\nfunction StandingAccessNote({\n agentId,\n activeWorkspaceName,\n}: {\n agentId: string\n activeWorkspaceName: string | null\n}) {\n const { data: held = [] } = useAgentWorkspaces(agentId, { enabled: agentId !== '' })\n const names = new Set(held.map((w) => w.name))\n if (activeWorkspaceName) names.add(activeWorkspaceName)\n return (\n <p className=\"text-xs text-muted-foreground\" data-testid=\"task-standing-access\">\n {agentId === '' ? 'Your own assistant needs no grant.' : 'It will hold standing access to: '}\n {agentId !== '' && (\n <span className=\"font-medium text-foreground\">\n {[...names].join(', ') || 'no workspace yet'}\n </span>\n )}\n </p>\n )\n}\n\nexport function ConnectedTaskComposer({\n open,\n onOpenChange,\n kind = 'work',\n saveOnly = false,\n task,\n workflow: editingWorkflow,\n initialWorkflowId,\n startLater: startLaterProp,\n initialPrompt,\n initialShared,\n launchWorkflow,\n initialAgentExtId,\n initialParentTaskExtId,\n}: ConnectedTaskComposerProps) {\n const { notify, openConversation, openUpload } = useBlocksEnvironment()\n // Scheduling (\"Run later\") belongs to Workflows: offered while the host has its page.\n const openWorkflow = useOpenWorkflow()\n const automationsEnabled = openWorkflow !== undefined\n const startLater = startLaterProp && automationsEnabled\n const isWorkflow = kind === 'workflow'\n const isEdit = isWorkflow ? !!editingWorkflow : !!task\n const { forTasks: baseSkills, skills } = useWorkflowDefinitions()\n const { data: reviewFields = [] } = useTags()\n const scheduledSkills = useMemo(\n () => [\n ...baseSkills,\n {\n id: '__document_review__',\n title: 'AI Review',\n description: 'Write answers and citations into document fields.',\n documentAction: 'annotate_documents' as const,\n run: { kind: 'operation' as const },\n landing: 'files' as const,\n inputs: [\n { name: 'scope', type: 'scope' as const, label: 'Documents', by: ['labels' as const] },\n {\n name: 'output',\n type: 'select' as const,\n label: 'Review field',\n required: true,\n description:\n 'Choose a field with saved AI instructions. Create one using AI Review in Files.',\n options: reviewFields\n .filter((field) => field.instruction)\n .map((field) => ({ value: field.external_id, label: field.name })),\n },\n {\n name: 'overwrite',\n type: 'boolean' as const,\n label: 'Regenerate existing answers',\n default: false,\n },\n ],\n },\n {\n id: '__document_email__',\n title: 'Email latest documents',\n description: 'Email me links to documents added since the previous successful digest.',\n documentAction: 'email_documents' as const,\n run: { kind: 'operation' as const },\n landing: 'files' as const,\n inputs: [\n { name: 'scope', type: 'scope' as const, label: 'Documents', by: ['labels' as const] },\n {\n name: 'latest',\n type: 'boolean' as const,\n label: 'Only documents added since the last digest',\n default: true,\n },\n ],\n },\n ],\n [baseSkills, reviewFields]\n )\n // A skill opened from the library runs now even if it cannot be scheduled: offer it as a template too.\n const forTasks = useMemo(() => {\n const picked = initialWorkflowId ? skills.find((w) => w.id === initialWorkflowId) : undefined\n return picked &&\n !scheduledSkills.some((w) => w.id === picked.id) &&\n picked.run.kind === 'prompt'\n ? [...scheduledSkills, picked]\n : scheduledSkills\n }, [scheduledSkills, skills, initialWorkflowId])\n const { data: workspaceAutomations = [] } = useWorkflows()\n const { data: agents = [] } = useAgents()\n const { data: workspaces = [] } = useWorkspaces()\n const planWork = usePlanWork()\n const { tasks: allTasks } = useWorkItems()\n const { data: documents = [] } = useDocuments()\n const { create, update, updateWorkflow, isPending } = useWorkflowTasks()\n // The files behind a template's file fields: the same pieces the skill launcher wires.\n const scopeSource = useConnectedWorkflowScopeSource()\n const activeWorkspaceId = useArbiSessionState((s) => s.workspaceId)\n const activeWorkspace = useMemo(\n () => workspaces.find((w) => w.external_id === activeWorkspaceId) ?? null,\n [workspaces, activeWorkspaceId]\n )\n const timezones = useMemo(() => listTimeZones(), [])\n // The plan lists documents by id; show their names.\n const documentNames = useMemo(\n () =>\n Object.fromEntries(\n documents.flatMap((d) => (d.file_name ? [[d.external_id, d.file_name]] : []))\n ),\n [documents]\n )\n // Tasks a new task can be part of: any other task that keeps the sub-task tree within its maximum\n // depth and (when editing) is not the task itself or one of its descendants. A workflow can wait on\n // any task, finished ones included (they re-open and finish again).\n const taskOptions = useMemo(() => {\n const label = (t: TaskListRow) => t.title?.trim() || 'Untitled task'\n if (isWorkflow) return allTasks.map((t) => ({ id: t.external_id, name: label(t) }))\n const subject: TaskListRow = task ?? { external_id: '__new__' }\n return moveTargets<TaskListRow>(\n [...allTasks.filter((t) => t.external_id !== subject.external_id), subject],\n subject\n ).map((t) => ({ id: t.external_id, name: label(t) }))\n }, [allTasks, task, isWorkflow])\n // The owner's main agent: what a scheduled workflow runs as unless another is picked.\n const defaultAgentId = useMemo(\n () => (agents.find((a) => a.given_name === 'Assistant') ?? agents[0])?.external_id,\n [agents]\n )\n const agentOptions = useMemo<AgentOption[]>(\n () => agents.map((a) => ({ id: a.external_id, label: a.given_name || a.email })),\n [agents]\n )\n\n // What the composer opens with: the edit target, or (create) the preset assignee.\n const initialValues = useMemo(() => {\n const ids = {\n customWorkflowId: CUSTOM_TASK_ID,\n reminderWorkflowId: REMIND_TASK_ID,\n definitions: forTasks,\n }\n const base = launchWorkflow\n ? {\n ...workflowToComposerValues(launchWorkflow, ids),\n when: 'once' as const,\n runAt: '',\n rrule: '',\n eventKind: '',\n afterTaskId: '',\n name: '',\n }\n : editingWorkflow\n ? workflowToComposerValues(editingWorkflow, ids)\n : task\n ? taskToComposerValues(task, ids)\n : isWorkflow\n ? {\n // Run now is the default start; scheduling is the fallback in the same field.\n assignee: 'agent' as const,\n workflowId: initialWorkflowId ?? CUSTOM_TASK_ID,\n when: startLater ? ('once' as const) : ('now' as const),\n ...(initialPrompt\n ? {\n inputs: {\n [initialWorkflowId === REMIND_TASK_ID ? 'message' : 'instruction']:\n initialPrompt,\n },\n }\n : {}),\n // A scheduled run needs an agent: the owner's Assistant unless another is picked.\n ...(startLater && defaultAgentId ? { agentId: defaultAgentId } : {}),\n }\n : initialAgentExtId\n ? // Assigning an agent means agentic work: the free instruction, and tell me when done.\n { agentId: initialAgentExtId, workflowId: CUSTOM_TASK_ID, notifyOnComplete: true }\n : {}\n return {\n timezone: detectTimeZone(),\n ...base,\n ...(initialShared !== undefined && !task && !editingWorkflow\n ? { shared: initialShared }\n : {}),\n ...(!task && !isWorkflow && initialParentTaskExtId\n ? { parentTaskId: initialParentTaskExtId }\n : {}),\n }\n }, [\n forTasks,\n task,\n editingWorkflow,\n isWorkflow,\n initialWorkflowId,\n startLater,\n initialPrompt,\n initialShared,\n launchWorkflow,\n defaultAgentId,\n initialAgentExtId,\n initialParentTaskExtId,\n ])\n\n const [plan, setPlan] = useState<TaskPlan | null>(null)\n useEffect(() => {\n if (open) setPlan(task?.plan ?? editingWorkflow?.plan ?? launchWorkflow?.plan ?? null) // the stored plan when editing agent work\n }, [open, task, editingWorkflow, launchWorkflow])\n\n const handleGeneratePlan = async (values: TaskComposerValues) => {\n if (!activeWorkspace) {\n notify('Open a workspace first — the plan is scoped to it', 'warning')\n return\n }\n const objective = String(values.inputs.instruction ?? '').trim()\n if (!objective) {\n notify('Write the instruction first — it’s the planner’s objective', 'warning')\n return\n }\n try {\n const drafted = await planWork.mutateAsync({\n objective,\n max_passes: plan?.max_passes ?? 3,\n })\n setPlan(drafted)\n notify('Drafted a plan — review the checklist', 'success')\n } catch {\n notify('Could not draft a plan', 'error')\n }\n }\n\n const submit = async (submitted: TaskComposerValues, options?: { runOnce?: boolean }) => {\n // A task for me is a plain to-do and runs no workflow.\n const chosen =\n forTasks.find((w) => w.id === submitted.workflowId) ??\n (submitted.assignee === 'me' ? forTasks[0] : undefined)\n if (!chosen) return\n if (plan && !plan.goal.trim()) {\n notify('The plan needs a goal', 'warning')\n return\n }\n if (plan && plan.criteria.some((c) => !c.text.trim())) {\n notify('Every checklist criterion needs text (or remove it)', 'warning')\n return\n }\n const ctx = {\n workflow: chosen,\n values: submitted,\n plan: chosen.id === CUSTOM_TASK_ID ? plan : null,\n }\n try {\n if (isWorkflow && editingWorkflow && !options?.runOnce) {\n await updateWorkflow(editingWorkflow, ctx)\n notify(`Updated “${editingWorkflow.name}”`, 'success')\n } else if (isEdit && task) {\n await update(task, ctx)\n notify(`Updated “${task.title ?? 'task'}”`, 'success')\n } else {\n const created = await create(ctx, saveOnly && !options?.runOnce)\n if (created.kind === 'workflow') {\n notify(`Saved “${created.workflow.name}”.`, 'success')\n // The saved workflow, on the Workflows page.\n openWorkflow?.()\n } else {\n const name = created.task.title ?? 'task'\n if ((created.ran || options?.runOnce) && created.task.external_id) {\n // The run is a thread: go and watch it, rather than leave a toast to say it started.\n openConversation(created.task.external_id)\n } else {\n notify(\n created.ran === null\n ? `Added “${name}”`\n : 'Task created, but the run could not start',\n created.ran === false ? 'warning' : 'success'\n )\n }\n }\n }\n onOpenChange(false)\n } catch (error) {\n const what = `Failed to ${isEdit ? 'update' : 'create'} the ${isWorkflow ? 'workflow' : 'task'}`\n notify(\n error instanceof Error && error.message.startsWith('Open a workspace')\n ? error.message\n : error instanceof ArbiApiError && error.detail\n ? `${what}: ${error.detail}`\n : what,\n 'error'\n )\n }\n }\n\n return (\n <TaskComposer\n key={editingWorkflow?.external_id ?? task?.external_id ?? 'new'}\n open={open}\n onOpenChange={onOpenChange}\n kind={kind}\n saveOnly={saveOnly}\n hideRunLater={!automationsEnabled}\n defaultAgentId={defaultAgentId}\n isEdit={isEdit}\n workflows={forTasks}\n agents={agentOptions}\n tasks={taskOptions}\n initialValues={initialValues}\n timezones={timezones}\n eventOptions={AUTOMATION_EVENTS}\n eventWorkflowOptions={workspaceAutomations\n .filter((item) => item.external_id !== editingWorkflow?.external_id)\n .map((item) => ({ id: item.external_id, label: item.name }))}\n isPending={isPending}\n planDrafting={planWork.isPending}\n hasPlan={plan !== null}\n renderIcon={renderWorkflowIcon}\n scopeSource={scopeSource}\n renderDocuments={(field, value, onChange) => (\n <ConnectedWorkflowDocumentsField\n field={field}\n value={value}\n onChange={onChange}\n onAddFiles={openUpload}\n />\n )}\n addFilesAction={\n openUpload && (\n <Button size=\"sm\" onClick={() => openUpload()} data-testid=\"workflow-add-files-first\">\n Add files\n </Button>\n )\n }\n onDropFiles={openUpload && ((files) => openUpload(files))}\n standingAccess={(values) => (\n <StandingAccessNote\n agentId={values.agentId}\n activeWorkspaceName={activeWorkspace?.name ?? null}\n />\n )}\n labels={{\n ...(isWorkflow\n ? {\n titleNewWorkflow: 'New workflow',\n titleEditWorkflow: 'Edit workflow',\n workflowNamePlaceholder: 'Name this workflow',\n createWorkflow: 'Create workflow',\n saveWorkflow: 'Save workflow',\n descriptionWorkflow: 'Choose what happens and when this workflow starts.',\n eventHint: 'Choose the workspace event that starts this workflow.',\n runAsAgentHint: 'Scheduled AI work runs as your chosen assistant when you are away.',\n }\n : {}),\n ...(plan\n ? { addAndStart: 'Approve plan and start', addAndSchedule: 'Approve plan and schedule' }\n : {}),\n }}\n onSubmit={submit}\n goal={(values) =>\n values.workflowId === CUSTOM_TASK_ID ? (\n <TaskPlanForm\n plan={plan}\n onChange={setPlan}\n onGenerate={() => handleGeneratePlan(values)}\n isGenerating={planWork.isPending}\n workspaceName={activeWorkspace?.name ?? null}\n documentNames={documentNames}\n objective={String(values.inputs.instruction ?? '')}\n />\n ) : null\n }\n />\n )\n}\n","/**\n * A saved workflow's history and a task's activity, bound to the connection.\n *\n * - `ConnectedWorkflowHistory`: every run of a workflow (re-read while shown), each with when, what\n * it was (a thread, an email, an AI review, a reminder) and how it went; a run's thread opens\n * through the environment's `openConversation`, a document action's result through the host.\n * - `ConnectedTaskActivityDialog`: a task's timeline (re-read while it runs), with who did what.\n */\n\nimport { useCallback, type ReactNode } from 'react'\nimport { useAgents, useConversationActivity, useWorkflowRuns } from '@arbidocs/react'\nimport { formatRelativeTime } from '@arbidocs/react/ui'\nimport {\n TaskRunsDialog,\n type TaskRunView,\n type TaskRunsDialogLabels,\n} from '../agents/tasks/TaskRunsDialog'\nimport { TaskActivityDialog } from '../agents/tasks/TaskActivityDialog'\nimport type { TaskActivityEvent } from '../agents/tasks/TaskActivityTimeline'\nimport { PersonPill, type TaskPerson } from '../agents/tasks/PersonPill'\nimport { fmtDate } from '../lib/format'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useConnectedWorkspaceRole } from './ConnectedWorkflowsTable'\n\ntype WorkflowRun = NonNullable<ReturnType<typeof useWorkflowRuns>['data']>[number]\n\n/** What a run was, in a word. */\nconst RUN_KIND: Record<string, string> = {\n email_documents: 'Email',\n annotate_documents: 'AI Review',\n reminder: 'Reminder',\n}\nconst DOCUMENT_ACTIONS = new Set(['email_documents', 'annotate_documents'])\n\n/** A run as the history lists it: when, what, on how many documents. */\nexport function workflowRunView(\n run: WorkflowRun,\n formatDate: (iso: string) => string\n): TaskRunView {\n const documents = DOCUMENT_ACTIONS.has(run.action_type)\n ? ` · ${run.document_ext_ids.length} documents`\n : ''\n return {\n id: `execution-${run.id}`,\n // An AI review that finished has a result to open (its fields over its documents).\n resultId:\n run.action_type === 'annotate_documents' && run.status === 'completed'\n ? String(run.id)\n : undefined,\n status: run.status,\n when: `${formatDate(run.created_at)} · ${RUN_KIND[run.action_type] ?? 'Thread'}${documents}`,\n error: run.error,\n conversationId: run.conversation_ext_id ?? undefined,\n }\n}\n\nexport interface ConnectedWorkflowHistoryProps {\n /** The workflow (`null`: closed). */\n workflow: { external_id: string; name: string } | null\n onOpenChange: (open: boolean) => void\n /** In the page rather than a dialog. */\n inline?: boolean\n hideHeader?: boolean\n formatDate?: (iso: string) => string\n /** Open a document action's result (an AI review's fields): the host's. Absent: no Open. */\n onOpenResult?: (run: WorkflowRun) => void\n /** Under a failed run: e.g. a way to report it. */\n renderErrorReport?: (run: TaskRunView) => ReactNode\n labels?: Partial<TaskRunsDialogLabels>\n}\n\nexport function ConnectedWorkflowHistory({\n workflow,\n onOpenChange,\n inline,\n hideHeader,\n formatDate = fmtDate,\n onOpenResult,\n renderErrorReport,\n labels,\n}: ConnectedWorkflowHistoryProps) {\n const { openConversation } = useBlocksEnvironment()\n const { data: runs = [], isLoading } = useWorkflowRuns(workflow?.external_id)\n return (\n <TaskRunsDialog\n inline={inline}\n hideHeader={hideHeader}\n open={!!workflow}\n onOpenChange={onOpenChange}\n taskName={workflow?.name}\n renderErrorReport={renderErrorReport}\n isLoading={isLoading}\n labels={{\n title: (name) => `History — ${name}`,\n description: 'Executions and results of this workflow.',\n empty: 'This workflow hasn’t run yet.',\n ...labels,\n }}\n runs={runs.map((run) => workflowRunView(run, formatDate))}\n onOpenResult={\n onOpenResult &&\n ((id) => {\n const run = runs.find((r) => String(r.id) === id)\n if (run) onOpenResult(run)\n })\n }\n onOpenRun={(conversationId) => openConversation(conversationId)}\n />\n )\n}\n\n/** Relative time, compact for list rows. */\nconst relativeTime = (iso: string) => formatRelativeTime(iso, { style: 'short' })\n\nexport interface ConnectedTaskActivityDialogProps {\n conversationId: string\n taskName: string\n /** The run is generating right now: the timeline then re-reads itself every few seconds. */\n live?: boolean\n onClose: () => void\n /** How a person shows (the host's own pill). Default: the shared pill with their name. */\n renderPerson?: (person: TaskPerson) => ReactNode\n formatExact?: (iso: string) => string\n}\n\nexport function ConnectedTaskActivityDialog({\n conversationId,\n taskName,\n live,\n onClose,\n renderPerson: renderTaskPerson,\n formatExact = fmtDate,\n}: ConnectedTaskActivityDialogProps) {\n const activity = useConversationActivity(conversationId, { live })\n const { data: agents = [] } = useAgents()\n const { userId } = useConnectedWorkspace()\n const { members } = useConnectedWorkspaceRole()\n const renderPerson = useCallback(\n (id: string | null | undefined) => {\n const isMe = !!id && id === userId\n const member = members.find((m) => m.user.external_id === id)?.user\n const name =\n (member && [member.given_name, member.family_name].filter(Boolean).join(' ')) ||\n member?.email\n const person = { id, label: isMe ? 'You' : name || 'Someone', isMe }\n return renderTaskPerson ? renderTaskPerson(person) : <PersonPill person={person} />\n },\n [renderTaskPerson, userId, members]\n )\n const agentName = useCallback(\n (agentId: string) => agents.find((a) => a.external_id === agentId)?.given_name ?? undefined,\n [agents]\n )\n return (\n <TaskActivityDialog\n open\n onOpenChange={(open) => !open && onClose()}\n taskName={taskName}\n events={activity.data as TaskActivityEvent[] | undefined}\n isLoading={activity.isLoading}\n isError={activity.isError}\n renderPerson={renderPerson}\n agentName={agentName}\n formatRelative={relativeTime}\n formatExact={formatExact}\n />\n )\n}\n","import { useCallback, useMemo, type ReactNode } from 'react'\nimport { useAgents, useArbiSession, useWorkspaceUsers } from '@arbidocs/react'\nimport { getUserDisplayName, isAgent } from '@arbidocs/react/ui'\nimport { PersonPill, type TaskPerson } from '../../agents/tasks/PersonPill'\nimport { DocumentUser } from '../files/fields/DocumentUser'\n\n/** The workspace roles that can edit it. */\nconst EDITOR_ROLES: readonly string[] = ['owner', 'collaborator']\n\n/**\n * People who can own tasks here: humans (never agents) who can edit the workspace, other than me\n * (the task list shows me as \"Me\"). They name each task's owner.\n */\nexport function useTaskPeople(): { id: string; label: string }[] {\n const { data: members = [] } = useWorkspaceUsers()\n const currentUserExtId = useArbiSession().user?.external_id\n return useMemo(\n () =>\n members\n .filter(\n (m) =>\n !isAgent(m.user) &&\n m.user.external_id !== currentUserExtId &&\n EDITOR_ROLES.includes(m.role)\n )\n .map((m) => ({ id: m.user.external_id, label: getUserDisplayName(m.user) })),\n [members, currentUserExtId]\n )\n}\n\n/**\n * How the Tasks table draws a person: the host's own user pill (presence, a click to message, the\n * rich tooltip) when the person is a member or agent we know, else the plain shared pill.\n */\nexport function useRenderTaskPerson(): (person: TaskPerson) => ReactNode {\n const { data: members = [] } = useWorkspaceUsers()\n const { data: agents = [] } = useAgents()\n const byId = useMemo(() => {\n const map = new Map(members.map((m) => [m.user.external_id, m.user]))\n for (const agent of agents) if (!map.has(agent.external_id)) map.set(agent.external_id, agent)\n return map\n }, [members, agents])\n return useCallback(\n (person: TaskPerson) => {\n const user = person.id ? byId.get(person.id) : undefined\n return user ? <DocumentUser user={user} variant=\"pill\" /> : <PersonPill person={person} />\n },\n [byId]\n )\n}\n","import { useCallback, useEffect, useState } from 'react'\nimport { useWorkflows, type WorkflowResponse } from '@arbidocs/react'\n\n/** A saved workflow, a new one, or a host catalogue entry opened as a template. */\nexport type WorkflowBuilderSelection =\n { kind: 'saved'; id: string } | { kind: 'new' } | { kind: 'template'; id: string }\n\nexport interface WorkflowsPageStateOptions {\n initialBuilder?: WorkflowBuilderSelection\n /** A host deep link to consume once the saved workflow has loaded. */\n historyWorkflowId?: string | null\n onHistoryWorkflowConsumed?: () => void\n}\n\n/** Shared selection lifecycle for workflow tables, builders and history views. No routing or layout. */\nexport function useWorkflowsPageState({\n initialBuilder,\n historyWorkflowId,\n onHistoryWorkflowConsumed,\n}: WorkflowsPageStateOptions = {}) {\n const { data: workflows = [] } = useWorkflows({ live: true })\n const [builder, setBuilder] = useState<WorkflowBuilderSelection | null>(initialBuilder ?? null)\n const [builderKey, setBuilderKey] = useState(0)\n const [historyIds, setHistoryIds] = useState<string[]>([])\n const [activeHistoryId, setActiveHistoryId] = useState<string | null>(null)\n // Resolve against current query data: renaming/deleting a workflow cannot leave a stale dialog.\n const historyFor = workflows.find((workflow) => workflow.external_id === activeHistoryId) ?? null\n const historyTabs = historyIds.flatMap((id) => {\n const workflow = workflows.find((item) => item.external_id === id)\n return workflow ? [workflow] : []\n })\n\n const openHistory = useCallback((workflow: WorkflowResponse | null) => {\n const id = workflow?.external_id ?? null\n if (id) setHistoryIds((ids) => (ids.includes(id) ? ids : [...ids, id]))\n setActiveHistoryId(id)\n }, [])\n const closeHistoryTab = useCallback((id: string) => {\n setHistoryIds((ids) => ids.filter((item) => item !== id))\n setActiveHistoryId((active) => (active === id ? null : active))\n }, [])\n const openBuilder = useCallback((selection: WorkflowBuilderSelection) => {\n setBuilder(selection)\n // Reopening a template/new/saved selection resets its unsaved canvas; saving does not.\n setBuilderKey((key) => key + 1)\n }, [])\n\n useEffect(() => {\n const workflow = workflows.find((item) => item.external_id === historyWorkflowId)\n if (!workflow) return\n openHistory(workflow)\n onHistoryWorkflowConsumed?.()\n }, [historyWorkflowId, onHistoryWorkflowConsumed, openHistory, workflows])\n\n return {\n workflows,\n builder,\n builderKey,\n openBuilder,\n closeBuilder: () => setBuilder(null),\n builderSaved: (id: string) => setBuilder({ kind: 'saved', id }),\n historyFor,\n historyTabs,\n activeHistoryId,\n openHistory,\n closeHistoryTab,\n selectHistoryTab: setActiveHistoryId,\n }\n}\n"]}
@@ -2,8 +2,8 @@
2
2
  'use strict';
3
3
 
4
4
  var chunk4U7VMABU_cjs = require('./chunk-4U7VMABU.cjs');
5
- var chunkUFEXJIEY_cjs = require('./chunk-UFEXJIEY.cjs');
6
5
  var chunkPPCATBOY_cjs = require('./chunk-PPCATBOY.cjs');
6
+ var chunkUFEXJIEY_cjs = require('./chunk-UFEXJIEY.cjs');
7
7
  var chunkMHVNT4J3_cjs = require('./chunk-MHVNT4J3.cjs');
8
8
  var lucideReact = require('lucide-react');
9
9
  var ui = require('@arbidocs/react/ui');
@@ -516,5 +516,5 @@ exports.SectionHeader = SectionHeader;
516
516
  exports.SectionLabel = SectionLabel;
517
517
  exports.StartTiles = StartTiles;
518
518
  exports.useScopeSelection = useScopeSelection;
519
- //# sourceMappingURL=chunk-JBQ4NYDD.cjs.map
520
- //# sourceMappingURL=chunk-JBQ4NYDD.cjs.map
519
+ //# sourceMappingURL=chunk-RZUZBHIH.cjs.map
520
+ //# sourceMappingURL=chunk-RZUZBHIH.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/home/FoldSection.tsx","../src/home/AddFilesFirst.tsx","../src/home/QuickActionDialogHeader.tsx","../src/lib/useScopeSelection.ts","../src/home/ScopePicker.tsx","../src/home/sections.tsx","../src/lib/balanced-columns.ts","../src/home/StartTiles.tsx"],"names":["jsxs","Collapsible","CollapsibleTrigger","jsx","ChevronDown","cn","CollapsibleContent","FolderPlus","DialogHeader","DialogTitle","DialogDescription","useMemo","formatCount","Minus","Check","useState","testIdOr","Fragment","prefixedTestId","FileCheck2","ActionLink","Plus","useRef","useEffect","observeResize"],"mappings":";;;;;;;;;;;AAsBO,SAAS,WAAA,CAAY;AAAA,EAC1B,KAAA;AAAA,EACA,KAAA,GAAQ,CAAA;AAAA,EACR,IAAA;AAAA,EACA,IAAA;AAAA,EACA,YAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAAqB;AACnB,EAAA,uBACEA,eAAA,CAACC,cAAA,EAAA,EAAY,IAAA,EAAY,YAAA,EAA4B,aAAU,cAAA,EAC7D,QAAA,EAAA;AAAA,oBAAAD,eAAA;AAAA,MAACE,qBAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAU,wMAAA;AAAA,QACV,aAAA,EAAa,MAAA;AAAA,QAEb,QAAA,EAAA;AAAA,0BAAAC,cAAA;AAAA,YAACC,uBAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAWC,KAAA,CAAG,sCAAA,EAAwC,CAAC,QAAQ,YAAY;AAAA;AAAA,WAC7E;AAAA,0BACAF,cAAA,CAAC,UAAM,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,UACZ,QAAQ,CAAA,oBAAKA,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,8CAA8C,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,UACjF,QAAQ,CAAC,IAAA,mCACP,MAAA,EAA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,kGAAA;AAAA,oBACA,yEAAA;AAAA,oBACA,iGAAA;AAAA,oBACA;AAAA,mBACF;AAAA,kBACA,WAAA,EAAU,YAAA;AAAA,kBACV,eAAa,IAAA,CAAK,MAAA;AAAA,kBAEjB,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAK,2BACJF,cAAAA,CAAC,UAAK,SAAA,EAAU,qCAAA,EAAsC,eAAY,MAAA,EAC/D,QAAA,EAAA,IAAA,CAAK,QAAA,EACR,CAAA,GAEA,wBAAQA,cAAAA,CAAC,QAAK,SAAA,EAAU,6BAAA,EAA8B,eAAY,MAAA,EAAO,CAAA;AAAA,oCAE3EH,eAAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,SAAA,EACd,QAAA,EAAA;AAAA,sCAAAG,cAAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,6CAAA,EAA+C,eAAK,KAAA,EAAM,CAAA;AAAA,sCAC1EA,cAAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,uDAAA,EACb,QAAA,EAAA,IAAA,CAAK,QAAA,IAAY,IAAA,CAAK,cAAA,GAAiB,IAAA,CAAK,cAAA,GAAiB,IAAA,CAAK,WAAA,EACrE;AAAA,qBAAA,EACF;AAAA;AAAA,iBAAA;AAAA,gBA3BK,IAAA,CAAK;AAAA,eA4BZ;AAAA,YAEJ,CAAC;AAAA;AAAA;AACH;AAAA;AAAA,GACF;AAEJ","file":"chunk-JBQ4NYDD.cjs","sourcesContent":["import type { ReactNode } from 'react'\nimport { ChevronDown } from 'lucide-react'\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger, cn } from '@arbidocs/react/ui'\n\nexport interface FoldSectionProps {\n label: string\n /** Shown as plain muted text beside the name; omit or pass 0 to hide. */\n count?: number\n /** A word or two of state for sections a count cannot summarise (shown while shut). */\n hint?: string\n open: boolean\n onOpenChange: (open: boolean) => void\n /** Trigger test id; the caller owns the naming. */\n testId: string\n children: ReactNode\n}\n\n/**\n * One foldable block of a dialog. The chevron and the name are the whole hit\n * target (44px on touch), and the count keeps the selection readable while the\n * section is shut, so you need not re-open it to check.\n */\nexport function FoldSection({\n label,\n count = 0,\n hint,\n open,\n onOpenChange,\n testId,\n children,\n}: FoldSectionProps) {\n return (\n <Collapsible open={open} onOpenChange={onOpenChange} data-slot=\"fold-section\">\n <CollapsibleTrigger\n className=\"mb-1.5 flex w-full items-center gap-1.5 rounded-md text-sm font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&:hover]:text-muted-foreground pointer-coarse:min-h-11\"\n data-testid={testId}\n >\n <ChevronDown\n className={cn('size-4 shrink-0 transition-transform', !open && '-rotate-90')}\n />\n <span>{label}</span>\n {count > 0 && <span className=\"text-xs tabular-nums text-muted-foreground\">{count}</span>}\n {hint && !open && (\n <span className=\"min-w-0 truncate text-xs font-normal text-muted-foreground\">{hint}</span>\n )}\n </CollapsibleTrigger>\n <CollapsibleContent>{children}</CollapsibleContent>\n </Collapsible>\n )\n}\n","import type { ReactNode } from 'react'\nimport { FolderPlus } from 'lucide-react'\n\n/** Fixed strings of the empty-files state. */\nexport interface AddFilesFirstLabels {\n heading: string\n}\n\nexport const DEFAULT_ADD_FILES_FIRST_LABELS: AddFilesFirstLabels = {\n heading: 'Add files first',\n}\n\nexport interface AddFilesFirstProps {\n /** Why this action needs files, in the action's own words. */\n reason: string\n /** The host's own \"Add\" control. */\n action: ReactNode\n testId?: string\n labels?: Partial<AddFilesFirstLabels>\n}\n\n/**\n * What a quick-action dialog shows when the workspace has no files yet.\n *\n * Greying the action out says you cannot do it without saying how to get\n * there. Offering the same \"Add\" menu the Files view carries turns the dead\n * end into the first step: add files here, then run the action.\n */\nexport function AddFilesFirst({ reason, action, testId, labels }: AddFilesFirstProps) {\n const l = { ...DEFAULT_ADD_FILES_FIRST_LABELS, ...labels }\n return (\n <div\n className=\"flex flex-col items-center gap-3 rounded-lg border border-border bg-card shadow-xs px-4 py-8 text-center\"\n data-slot=\"add-files-first\"\n data-testid={testId}\n >\n <span className=\"flex size-11 items-center justify-center rounded-full bg-ai-soft text-ai-ink\">\n <FolderPlus className=\"size-5\" aria-hidden=\"true\" />\n </span>\n <div className=\"flex flex-col gap-1\">\n <p className=\"text-sm font-semibold text-foreground\">{l.heading}</p>\n <p className=\"text-xs leading-relaxed text-muted-foreground\">{reason}</p>\n </div>\n {action}\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport { DialogDescription, DialogHeader, DialogTitle } from '@arbidocs/react/ui'\n\nexport interface QuickActionDialogHeaderProps {\n /** The tile's glyph, sized by the caller at `size-5`. */\n icon: ReactNode\n title: string\n /** One sentence on what the dialog does. Keep it to a line or two. */\n description: ReactNode\n /** Test id for the description, where a test asserts on the copy. */\n descriptionTestId?: string\n}\n\n/**\n * The header every \"Start\" quick-action dialog wears: the tile's own mark in\n * its disc, the action's name, and one line saying what the dialog will do.\n *\n * - The disc centres on the TITLE row, so it reads as the title's mark.\n * - The description keeps the title's left edge (`pl-13` = disc + gap), so the\n * header is one text column beside the mark rather than an L.\n * - `max-w-prose` + `text-pretty` cap the measure and stop two-word orphans.\n * - `pr-8` keeps the copy clear of the close button.\n */\nexport function QuickActionDialogHeader({\n icon,\n title,\n description,\n descriptionTestId,\n}: QuickActionDialogHeaderProps) {\n return (\n <DialogHeader className=\"space-y-0 text-left\" data-slot=\"quick-action-dialog-header\">\n <div className=\"flex items-center gap-3 pr-8\">\n <div className=\"flex size-10 shrink-0 items-center justify-center rounded-full bg-ai-soft text-ai-ink\">\n {icon}\n </div>\n <DialogTitle className=\"text-xl font-semibold leading-tight\">{title}</DialogTitle>\n </div>\n <DialogDescription\n className=\"mt-2 max-w-prose pl-13 pr-8 text-sm leading-relaxed text-pretty\"\n data-testid={descriptionTestId}\n >\n {description}\n </DialogDescription>\n </DialogHeader>\n )\n}\n","import { useMemo } from 'react'\n\n/** Which folders and labels a run is limited to. Empty = everything. */\nexport interface DocumentScope {\n /** Folder paths; `''` is the \"unfiled\" bucket. */\n folders: string[]\n /** Label (tag) ids. */\n labels: string[]\n}\n\nexport interface UseScopeSelectionOptions {\n /** Every folder path in the tree (not including the unfiled bucket). */\n folderPaths: string[]\n /** Whether the unfiled bucket is shown as a row. */\n hasUnfiled: boolean\n scope: DocumentScope\n onScopeChange: (scope: DocumentScope) => void\n}\n\n/**\n * Headless selection logic for a folder + label scope picker.\n *\n * Folders use hierarchical selection: ticking \"contracts\" also ticks\n * \"contracts/2024\", and unticking removes the whole subtree. \"All\" ticks every\n * row, which is NOT the same as an empty scope: empty means \"the whole\n * workspace, whatever lands in it later\", all-ticked means \"these folders, as\n * they are now\".\n */\nexport function useScopeSelection({\n folderPaths,\n hasUnfiled,\n scope,\n onScopeChange,\n}: UseScopeSelectionOptions) {\n const selectedFolders = useMemo(() => new Set(scope.folders), [scope.folders])\n const selectedLabels = useMemo(() => new Set(scope.labels), [scope.labels])\n\n /** Every row the folder list shows, \"unfiled\" included. */\n const allRowPaths = useMemo(\n () => [...(hasUnfiled ? [''] : []), ...folderPaths],\n [folderPaths, hasUnfiled]\n )\n const allSelected = allRowPaths.length > 0 && allRowPaths.every((p) => selectedFolders.has(p))\n const someSelected = selectedFolders.size > 0 && !allSelected\n\n const descendants = (path: string) => folderPaths.filter((p) => p.startsWith(path + '/'))\n\n const toggleFolder = (path: string) => {\n const next = new Set(selectedFolders)\n const family = [path, ...descendants(path)]\n if (next.has(path)) for (const p of family) next.delete(p)\n else for (const p of family) next.add(p)\n onScopeChange({ folders: [...next], labels: scope.labels })\n }\n\n const toggleAllFolders = () => {\n onScopeChange({ folders: allSelected ? [] : allRowPaths, labels: scope.labels })\n }\n\n const toggleLabel = (labelId: string) => {\n const next = new Set(selectedLabels)\n if (next.has(labelId)) next.delete(labelId)\n else next.add(labelId)\n onScopeChange({ folders: scope.folders, labels: [...next] })\n }\n\n return {\n selectedFolders,\n selectedLabels,\n allSelected,\n someSelected,\n hasSelection: scope.folders.length > 0 || scope.labels.length > 0,\n toggleFolder,\n toggleAllFolders,\n toggleLabel,\n }\n}\n","import { useMemo, useState } from 'react'\nimport { Check, FileCheck2, Minus } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { prefixedTestId, testIdOr } from '../chat/test-id'\nimport { useScopeSelection, type DocumentScope } from '../lib/useScopeSelection'\nimport { formatCount } from '../lib/format'\nimport { FoldSection } from './FoldSection'\n\n/**\n * Fixed strings of the picker. Passed as `uiLabels`: the `labels` prop is already the list of\n * document labels to scope by.\n */\nexport interface ScopePickerLabels {\n folders: string\n /** The Labels section heading. */\n labelsHeading: string\n all: string\n unfiled: string\n noFoldersYet: string\n noLabelsYet: string\n filesToInclude: string\n /** \"3 of 10 files\". */\n matchedOfTotal: (matched: number, total: number) => string\n selectedSuffix: string\n folderCount: (count: number) => string\n labelCount: (count: number) => string\n left: (count: number) => string\n /** \"All 10 files\". */\n allFiles: (total: number) => string\n includedSuffix: string\n}\n\nconst pluralize = (n: number, word: string) => `${n} ${word}${n !== 1 ? 's' : ''}`\n\nexport const DEFAULT_SCOPE_PICKER_LABELS: ScopePickerLabels = {\n folders: 'Folders',\n labelsHeading: 'Labels',\n all: 'All',\n unfiled: 'Unfiled',\n noFoldersYet: 'No folders yet',\n noLabelsYet: 'No labels yet — label files from the Files page to scope by them here.',\n filesToInclude: 'Files to include',\n matchedOfTotal: (matched, total) =>\n `${matched} of ${formatCount(total, { one: 'file', other: 'files' })}`,\n selectedSuffix: ' selected',\n folderCount: (count) => pluralize(count, 'folder'),\n labelCount: (count) => pluralize(count, 'label'),\n left: (count) => `${count} left`,\n allFiles: (total) => `All ${pluralize(total, 'file')}`,\n includedSuffix: ' in the workspace will be included',\n}\n\nexport interface ScopeFolder {\n /** Full path, e.g. `contracts/2024`. */\n path: string\n /** Last segment, shown. */\n label: string\n /** Documents under this folder. */\n count: number\n depth: number\n}\n\nexport interface ScopeLabel {\n id: string\n name: string\n /** Any CSS colour for the dot. */\n color: string\n /** Documents carrying this label. */\n count: number\n}\n\nexport interface ScopePickerProps {\n folders: ScopeFolder[]\n /** Documents with no folder; the \"Unfiled\" row is hidden at 0. */\n unfiledCount: number\n labels: ScopeLabel[]\n /** All documents the picker is scoping. */\n totalCount: number\n /** Documents the current scope matches (computed by the caller). */\n matchedCount: number\n scope: DocumentScope\n onScopeChange: (scope: DocumentScope) => void\n /** Reword the picker's fixed strings. */\n uiLabels?: Partial<ScopePickerLabels>\n /** Sub-element ids; defaults are the current ids. `labelChip` is a prefix (`<prefix>-<label id>`). */\n testIds?: Partial<\n Record<'foldersToggle' | 'labelsToggle' | 'noLabels' | 'labelChip' | 'summary', string>\n >\n}\n\ninterface FolderRowProps {\n label: string\n count: number\n depth: number\n isActive: boolean\n indeterminate?: boolean\n muted?: boolean\n onToggle: () => void\n}\n\n/** A checkbox row: the row is the checkbox (a nested real one would swallow the click). */\nfunction FolderRow({\n label,\n count,\n depth,\n isActive,\n indeterminate,\n muted,\n onToggle,\n}: FolderRowProps) {\n return (\n <button\n type=\"button\"\n onClick={onToggle}\n role=\"checkbox\"\n aria-checked={indeterminate ? 'mixed' : isActive}\n style={{ paddingLeft: `${4 + depth * 14}px` }}\n className={cn(\n 'flex w-full items-center gap-1 rounded-sm py-1 pr-2 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&:hover]:bg-accent pointer-coarse:min-h-11',\n isActive && 'bg-primary/10',\n muted && !isActive && 'text-muted-foreground'\n )}\n data-slot=\"scope-folder-row\"\n >\n <span className=\"flex w-4 shrink-0 items-center justify-center\">\n <span\n className={cn(\n 'flex size-3.5 items-center justify-center rounded-[3px] border transition-colors',\n isActive || indeterminate\n ? 'border-primary bg-primary text-primary-foreground'\n : 'border-muted-foreground/40'\n )}\n >\n {indeterminate ? (\n <Minus className=\"size-2.5\" />\n ) : (\n isActive && <Check className=\"size-2.5\" />\n )}\n </span>\n </span>\n {label !== '' && (\n <span className={cn('min-w-0 truncate', isActive && 'font-semibold text-primary')}>\n {label}\n </span>\n )}\n <span className=\"ml-auto pl-2 text-sm font-semibold text-muted-foreground\">{count}</span>\n </button>\n )\n}\n\n/**\n * Pick a folder + label scope for a run over documents. Controlled: the caller\n * owns the scope and computes `matchedCount`, so the submit button lives with\n * the caller. Both sections start shut: the default (every file) is what most\n * runs want, and the summary states it plainly.\n */\nexport function ScopePicker({\n folders,\n unfiledCount,\n labels,\n totalCount,\n matchedCount,\n scope,\n onScopeChange,\n uiLabels,\n testIds,\n}: ScopePickerProps) {\n const l = { ...DEFAULT_SCOPE_PICKER_LABELS, ...uiLabels }\n const [foldersOpen, setFoldersOpen] = useState(false)\n const [labelsOpen, setLabelsOpen] = useState(false)\n\n const folderPaths = useMemo(() => folders.map((f) => f.path), [folders])\n const selection = useScopeSelection({\n folderPaths,\n hasUnfiled: unfiledCount > 0,\n scope,\n onScopeChange,\n })\n const hasRows = folders.length > 0 || unfiledCount > 0\n\n return (\n <div className=\"flex flex-col gap-4\" data-slot=\"scope-picker\">\n <FoldSection\n label={l.folders}\n count={scope.folders.length}\n open={foldersOpen}\n onOpenChange={setFoldersOpen}\n testId={testIdOr(testIds?.foldersToggle, { testId: 'scope-picker-folders-toggle' })}\n >\n <div className=\"max-h-[180px] overflow-y-auto rounded-md border border-border p-1\">\n {hasRows && (\n <>\n <FolderRow\n label={l.all}\n count={totalCount}\n depth={0}\n isActive={selection.allSelected}\n indeterminate={selection.someSelected}\n onToggle={selection.toggleAllFolders}\n />\n <div className=\"my-1 border-t border-border\" />\n </>\n )}\n {unfiledCount > 0 && (\n <>\n <FolderRow\n label={l.unfiled}\n count={unfiledCount}\n depth={0}\n isActive={selection.selectedFolders.has('')}\n muted\n onToggle={() => selection.toggleFolder('')}\n />\n {folders.length > 0 && <div className=\"my-1 border-t border-border\" />}\n </>\n )}\n {folders.map((folder) => (\n <FolderRow\n key={folder.path}\n label={folder.label}\n count={folder.count}\n depth={folder.depth}\n isActive={selection.selectedFolders.has(folder.path)}\n onToggle={() => selection.toggleFolder(folder.path)}\n />\n ))}\n {!hasRows && <p className=\"px-2 py-1 text-sm text-muted-foreground\">{l.noFoldersYet}</p>}\n </div>\n </FoldSection>\n\n {/* Always present, like Folders: a workspace with no labels yet reads as\n \"you have not labelled anything\", not \"this cannot scope by label\". */}\n <FoldSection\n label={l.labelsHeading}\n count={scope.labels.length}\n open={labelsOpen}\n onOpenChange={setLabelsOpen}\n testId={testIdOr(testIds?.labelsToggle, { testId: 'scope-picker-labels-toggle' })}\n >\n {labels.length === 0 ? (\n <p\n className=\"px-2 py-1 text-sm text-muted-foreground\"\n data-testid={testIdOr(testIds?.noLabels, { testId: 'scope-picker-no-labels' })}\n >\n {l.noLabelsYet}\n </p>\n ) : (\n <div className=\"flex flex-wrap gap-1.5\">\n {labels.map((label) => {\n const isActive = selection.selectedLabels.has(label.id)\n return (\n <button\n key={label.id}\n type=\"button\"\n onClick={() => selection.toggleLabel(label.id)}\n aria-pressed={isActive}\n data-testid={prefixedTestId(testIds?.labelChip, label.id, {\n testId: `scope-picker-label-chip-${label.id}`,\n })}\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-h-11',\n isActive\n ? 'border-primary/40 bg-primary/10 text-primary'\n : 'border-border [&:hover]:bg-accent [&:hover]:text-accent-foreground'\n )}\n >\n <span\n className=\"size-2.5 shrink-0 rounded-full\"\n style={{ backgroundColor: label.color }}\n />\n <span className=\"truncate\">{label.name}</span>\n <span className=\"shrink-0 text-xs text-muted-foreground\">({label.count})</span>\n {isActive && <Check className=\"size-3.5 shrink-0\" />}\n </button>\n )\n })}\n </div>\n )}\n </FoldSection>\n\n <div\n className=\"rounded-lg bg-muted p-3\"\n data-testid={testIdOr(testIds?.summary, { testId: 'scope-picker-summary' })}\n >\n <div className=\"mb-2 flex items-center gap-1.5 text-xs font-medium text-muted-foreground\">\n <FileCheck2 className=\"size-4\" />\n {l.filesToInclude}\n </div>\n {selection.hasSelection ? (\n <div className=\"text-sm text-muted-foreground\">\n <span className=\"text-base font-semibold text-foreground\">\n {l.matchedOfTotal(matchedCount, totalCount)}\n </span>\n {l.selectedSuffix}\n {scope.folders.length > 0 && <span> — {l.folderCount(scope.folders.length)}</span>}\n {scope.folders.length > 0 && scope.labels.length > 0 && <span>, </span>}\n {scope.labels.length > 0 && <span>{l.labelCount(scope.labels.length)}</span>}\n <span className=\"text-xs\">\n {' · '}\n {l.left(totalCount - matchedCount)}\n </span>\n </div>\n ) : (\n <div className=\"text-sm text-muted-foreground\">\n <span className=\"text-base font-semibold text-foreground\">\n {l.allFiles(totalCount)}\n </span>\n {l.includedSuffix}\n </div>\n )}\n </div>\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport { Plus, type LucideIcon } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { ActionLink } from '../components/ActionLink'\n\n/** The small label that names a band of a page (\"Start\", \"Recent\"). */\nexport function SectionLabel({\n children,\n className,\n testId,\n}: {\n children: ReactNode\n className?: string\n testId?: string\n}) {\n return (\n <p\n className={cn(\n 'flex items-center gap-3 text-sm font-semibold text-foreground after:h-px after:flex-1 after:bg-border',\n className\n )}\n data-slot=\"section-label\"\n data-testid={testId}\n >\n {children}\n </p>\n )\n}\n\nexport interface SectionHeaderProps {\n icon?: LucideIcon\n title: string\n count?: number\n /** Makes the title a button (open the full list). Omit for a static title. */\n onOpen?: () => void\n /** Real link target of the title; `onOpen` still fires on a plain click. */\n openHref?: string\n /** Test id of the title button. */\n openTestId?: string\n /** The section's one quiet action, rendered at the trailing edge. */\n action?: ReactNode\n className?: string\n}\n\n/** Title + count + one quiet action: the head of a list section. */\nexport function SectionHeader({\n icon: Icon,\n title,\n count,\n onOpen,\n openHref,\n openTestId,\n action,\n className,\n}: SectionHeaderProps) {\n return (\n <div\n className={cn('flex items-center justify-between gap-2', className)}\n data-slot=\"section-header\"\n >\n <ActionLink\n href={openHref}\n onSelect={onOpen}\n disabled={!onOpen && !openHref}\n className=\"flex min-w-0 cursor-pointer items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-default disabled:hover:text-foreground pointer-coarse:min-h-11\"\n data-testid={openTestId}\n >\n {Icon && <Icon className=\"size-4 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />}\n <span className=\"whitespace-nowrap text-sm font-semibold text-foreground\">{title}</span>\n {count !== undefined && (\n <span className=\"text-sm tabular-nums text-muted-foreground\">{count}</span>\n )}\n </ActionLink>\n {action && <div className=\"shrink-0\">{action}</div>}\n </div>\n )\n}\n\nexport interface EmptyStripProps {\n icon?: LucideIcon\n label: ReactNode\n description?: ReactNode\n onSelect?: () => void\n testId?: string\n}\n\n/** One tonal strip that stands in for an empty section: an invitation, not a void. */\nexport function EmptyStrip({\n icon: Icon = Plus,\n label,\n description,\n onSelect,\n testId,\n}: EmptyStripProps) {\n return (\n <button\n type=\"button\"\n onClick={onSelect}\n disabled={!onSelect}\n className=\"flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left border border-border bg-card shadow-xs transition-colors hover:border-ring/50 hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-default disabled:hover:bg-card disabled:hover:border-border pointer-coarse:min-h-11\"\n data-slot=\"empty-strip\"\n data-testid={testId}\n >\n <Icon className=\"size-5 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block text-sm font-semibold text-foreground\">{label}</span>\n {description && (\n <span className=\"block text-sm leading-snug text-muted-foreground\">{description}</span>\n )}\n </span>\n </button>\n )\n}\n","/**\n * The column count for a grid of `count` equal tiles in `width` pixels, chosen so the last row is\n * never left with a lone orphan: of the counts that fit (each column at least `minTile` wide),\n * take the one that leaves the fewest empty cells in the last row, preferring more columns on a\n * tie (never fewer than two columns when two fit). Four tiles resolve to 2x2 where three would fit\n * and 4 across when there is room for four; six resolve to 3x2.\n */\nexport function balancedColumns(count: number, width: number, minTile = 200, gap = 12): number {\n if (count <= 1) return 1\n const fit = Math.max(1, Math.min(count, Math.floor((width + gap) / (minTile + gap))))\n if (fit < 2) return 1\n let best = 2\n let bestEmpty = Number.POSITIVE_INFINITY\n for (let columns = 2; columns <= fit; columns++) {\n const empty = (columns - (count % columns)) % columns\n if (empty < bestEmpty || (empty === bestEmpty && columns > best)) {\n best = columns\n bestEmpty = empty\n }\n }\n return best\n}\n","import { useEffect, useRef, useState, type ReactNode } from 'react'\nimport type { LucideIcon } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { ActionLink } from '../components/ActionLink'\nimport { balancedColumns } from '../lib/balanced-columns'\nimport { observeResize } from '../lib/observe-resize'\nimport { SectionLabel } from './sections'\n\n/** One \"start something\" tile: an AI-driven action, one click from underway. */\nexport interface StartTile {\n id: string\n /** A Lucide glyph; `iconNode` wins when both are given. */\n icon?: LucideIcon\n /** A ready-made mark (host icon maps), wearing the same AI ink. */\n iconNode?: ReactNode\n title: string\n description: string\n onSelect: () => void\n /** Real link target (ctrl-click / new tab, in-SPA through the host environment's `linkComponent`). `onSelect` still fires on a plain click. */\n href?: string\n /** Rendered non-interactive and dimmed; `disabledReason` replaces the description. */\n disabled?: boolean\n disabledReason?: string\n testId?: string\n}\n\nexport interface StartTilesProps {\n items: StartTile[]\n /** Optional band label above the tiles (\"Start\"). */\n caption?: string\n captionTestId?: string\n className?: string\n testId?: string\n}\n\n/**\n * A band of tonal action tiles. The glyph wears the AI ink, because these are\n * the AI-driven starts. Nothing is hover-only: tiles are always rendered, hover\n * only nudges tone, and touch targets are at least 44px.\n */\nexport function StartTiles({ items, caption, captionTestId, className, testId }: StartTilesProps) {\n // The tiles reflow by their own container width (a docked tablet sidebar narrows it without\n // changing the viewport), choosing a column count that never leaves one tile alone on a row.\n const gridRef = useRef<HTMLDivElement>(null)\n const [columns, setColumns] = useState<number | null>(null)\n const count = items.length\n useEffect(() => {\n const grid = gridRef.current\n if (!grid || count === 0) return\n const measure = () => setColumns(balancedColumns(count, grid.clientWidth))\n measure()\n return observeResize(grid, measure)\n }, [count])\n\n if (count === 0) return null\n return (\n <section\n className={cn('flex flex-col gap-3', className)}\n data-slot=\"start-tiles\"\n data-testid={testId}\n >\n {caption && <SectionLabel testId={captionTestId}>{caption}</SectionLabel>}\n <div\n ref={gridRef}\n data-slot=\"start-tiles-grid\"\n data-columns={columns ?? undefined}\n className=\"grid gap-3\"\n style={{\n gridTemplateColumns:\n columns === null\n ? 'repeat(auto-fit, minmax(200px, 1fr))'\n : `repeat(${columns}, minmax(0, 1fr))`,\n }}\n >\n {items.map((item) => {\n const Icon = item.icon\n return (\n <ActionLink\n key={item.id}\n href={item.href}\n onSelect={item.onSelect}\n disabled={item.disabled}\n title={item.disabled ? item.disabledReason : undefined}\n className={cn(\n 'flex h-full flex-col items-start gap-3 rounded-lg p-4 text-left',\n 'border border-border bg-card shadow-xs transition-colors hover:border-ring/50 hover:bg-accent/40',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n 'disabled:cursor-default disabled:opacity-55 disabled:hover:bg-card disabled:hover:border-border',\n 'pointer-coarse:min-h-11'\n )}\n data-slot=\"start-tile\"\n data-testid={item.testId}\n >\n {item.iconNode ? (\n <span className=\"shrink-0 text-ai-ink [&>svg]:size-5\" aria-hidden=\"true\">\n {item.iconNode}\n </span>\n ) : (\n Icon && <Icon className=\"size-5 shrink-0 text-ai-ink\" aria-hidden=\"true\" />\n )}\n <span className=\"min-w-0\">\n <span className=\"block text-sm font-semibold text-foreground\">{item.title}</span>\n <span className=\"mt-1 block text-sm leading-snug text-muted-foreground\">\n {item.disabled && item.disabledReason ? item.disabledReason : item.description}\n </span>\n </span>\n </ActionLink>\n )\n })}\n </div>\n </section>\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/home/FoldSection.tsx","../src/home/AddFilesFirst.tsx","../src/home/QuickActionDialogHeader.tsx","../src/lib/useScopeSelection.ts","../src/home/ScopePicker.tsx","../src/home/sections.tsx","../src/lib/balanced-columns.ts","../src/home/StartTiles.tsx"],"names":["jsxs","Collapsible","CollapsibleTrigger","jsx","ChevronDown","cn","CollapsibleContent","FolderPlus","DialogHeader","DialogTitle","DialogDescription","useMemo","formatCount","Minus","Check","useState","testIdOr","Fragment","prefixedTestId","FileCheck2","ActionLink","Plus","useRef","useEffect","observeResize"],"mappings":";;;;;;;;;;;AAsBO,SAAS,WAAA,CAAY;AAAA,EAC1B,KAAA;AAAA,EACA,KAAA,GAAQ,CAAA;AAAA,EACR,IAAA;AAAA,EACA,IAAA;AAAA,EACA,YAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAAqB;AACnB,EAAA,uBACEA,eAAA,CAACC,cAAA,EAAA,EAAY,IAAA,EAAY,YAAA,EAA4B,aAAU,cAAA,EAC7D,QAAA,EAAA;AAAA,oBAAAD,eAAA;AAAA,MAACE,qBAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAU,wMAAA;AAAA,QACV,aAAA,EAAa,MAAA;AAAA,QAEb,QAAA,EAAA;AAAA,0BAAAC,cAAA;AAAA,YAACC,uBAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAWC,KAAA,CAAG,sCAAA,EAAwC,CAAC,QAAQ,YAAY;AAAA;AAAA,WAC7E;AAAA,0BACAF,cAAA,CAAC,UAAM,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,UACZ,QAAQ,CAAA,oBAAKA,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,8CAA8C,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,UACjF,QAAQ,CAAC,IAAA,mCACP,MAAA,EAAA,EAAK,SAAA,EAAU,8DAA8D,QAAA,EAAA,IAAA,EAAK;AAAA;AAAA;AAAA,KAEvF;AAAA,oBACAA,cAAA,CAACG,yBAAoB,QAAA,EAAS;AAAA,GAAA,EAChC,CAAA;AAEJ;ACzCO,IAAM,8BAAA,GAAsD;AAAA,EACjE,OAAA,EAAS;AACX;AAkB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AAA,EAAU,qCAAA,EAAsC,eAAY,MAAA,EAC/D,QAAA,EAAA,IAAA,CAAK,QAAA,EACR,CAAA,GAEA,wBAAQA,cAAAA,CAAC,QAAK,SAAA,EAAU,6BAAA,EAA8B,eAAY,MAAA,EAAO,CAAA;AAAA,oCAE3EH,eAAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,SAAA,EACd,QAAA,EAAA;AAAA,sCAAAG,cAAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,6CAAA,EAA+C,eAAK,KAAA,EAAM,CAAA;AAAA,sCAC1EA,cAAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,uDAAA,EACb,QAAA,EAAA,IAAA,CAAK,QAAA,IAAY,IAAA,CAAK,cAAA,GAAiB,IAAA,CAAK,cAAA,GAAiB,IAAA,CAAK,WAAA,EACrE;AAAA,qBAAA,EACF;AAAA;AAAA,iBAAA;AAAA,gBA3BK,IAAA,CAAK;AAAA,eA4BZ;AAAA,YAEJ,CAAC;AAAA;AAAA;AACH;AAAA;AAAA,GACF;AAEJ","file":"chunk-RZUZBHIH.cjs","sourcesContent":["import type { ReactNode } from 'react'\nimport { ChevronDown } from 'lucide-react'\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger, cn } from '@arbidocs/react/ui'\n\nexport interface FoldSectionProps {\n label: string\n /** Shown as plain muted text beside the name; omit or pass 0 to hide. */\n count?: number\n /** A word or two of state for sections a count cannot summarise (shown while shut). */\n hint?: string\n open: boolean\n onOpenChange: (open: boolean) => void\n /** Trigger test id; the caller owns the naming. */\n testId: string\n children: ReactNode\n}\n\n/**\n * One foldable block of a dialog. The chevron and the name are the whole hit\n * target (44px on touch), and the count keeps the selection readable while the\n * section is shut, so you need not re-open it to check.\n */\nexport function FoldSection({\n label,\n count = 0,\n hint,\n open,\n onOpenChange,\n testId,\n children,\n}: FoldSectionProps) {\n return (\n <Collapsible open={open} onOpenChange={onOpenChange} data-slot=\"fold-section\">\n <CollapsibleTrigger\n className=\"mb-1.5 flex w-full items-center gap-1.5 rounded-md text-sm font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&:hover]:text-muted-foreground pointer-coarse:min-h-11\"\n data-testid={testId}\n >\n <ChevronDown\n className={cn('size-4 shrink-0 transition-transform', !open && '-rotate-90')}\n />\n <span>{label}</span>\n {count > 0 && <span className=\"text-xs tabular-nums text-muted-foreground\">{count}</span>}\n {hint && !open && (\n <span className=\"min-w-0 truncate text-xs font-normal text-muted-foreground\">{hint}</span>\n )}\n </CollapsibleTrigger>\n <CollapsibleContent>{children}</CollapsibleContent>\n </Collapsible>\n )\n}\n","import type { ReactNode } from 'react'\nimport { FolderPlus } from 'lucide-react'\n\n/** Fixed strings of the empty-files state. */\nexport interface AddFilesFirstLabels {\n heading: string\n}\n\nexport const DEFAULT_ADD_FILES_FIRST_LABELS: AddFilesFirstLabels = {\n heading: 'Add files first',\n}\n\nexport interface AddFilesFirstProps {\n /** Why this action needs files, in the action's own words. */\n reason: string\n /** The host's own \"Add\" control. */\n action: ReactNode\n testId?: string\n labels?: Partial<AddFilesFirstLabels>\n}\n\n/**\n * What a quick-action dialog shows when the workspace has no files yet.\n *\n * Greying the action out says you cannot do it without saying how to get\n * there. Offering the same \"Add\" menu the Files view carries turns the dead\n * end into the first step: add files here, then run the action.\n */\nexport function AddFilesFirst({ reason, action, testId, labels }: AddFilesFirstProps) {\n const l = { ...DEFAULT_ADD_FILES_FIRST_LABELS, ...labels }\n return (\n <div\n className=\"flex flex-col items-center gap-3 rounded-lg border border-border bg-card shadow-xs px-4 py-8 text-center\"\n data-slot=\"add-files-first\"\n data-testid={testId}\n >\n <span className=\"flex size-11 items-center justify-center rounded-full bg-ai-soft text-ai-ink\">\n <FolderPlus className=\"size-5\" aria-hidden=\"true\" />\n </span>\n <div className=\"flex flex-col gap-1\">\n <p className=\"text-sm font-semibold text-foreground\">{l.heading}</p>\n <p className=\"text-xs leading-relaxed text-muted-foreground\">{reason}</p>\n </div>\n {action}\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport { DialogDescription, DialogHeader, DialogTitle } from '@arbidocs/react/ui'\n\nexport interface QuickActionDialogHeaderProps {\n /** The tile's glyph, sized by the caller at `size-5`. */\n icon: ReactNode\n title: string\n /** One sentence on what the dialog does. Keep it to a line or two. */\n description: ReactNode\n /** Test id for the description, where a test asserts on the copy. */\n descriptionTestId?: string\n}\n\n/**\n * The header every \"Start\" quick-action dialog wears: the tile's own mark in\n * its disc, the action's name, and one line saying what the dialog will do.\n *\n * - The disc centres on the TITLE row, so it reads as the title's mark.\n * - The description keeps the title's left edge (`pl-13` = disc + gap), so the\n * header is one text column beside the mark rather than an L.\n * - `max-w-prose` + `text-pretty` cap the measure and stop two-word orphans.\n * - `pr-8` keeps the copy clear of the close button.\n */\nexport function QuickActionDialogHeader({\n icon,\n title,\n description,\n descriptionTestId,\n}: QuickActionDialogHeaderProps) {\n return (\n <DialogHeader className=\"space-y-0 text-left\" data-slot=\"quick-action-dialog-header\">\n <div className=\"flex items-center gap-3 pr-8\">\n <div className=\"flex size-10 shrink-0 items-center justify-center rounded-full bg-ai-soft text-ai-ink\">\n {icon}\n </div>\n <DialogTitle className=\"text-xl font-semibold leading-tight\">{title}</DialogTitle>\n </div>\n <DialogDescription\n className=\"mt-2 max-w-prose pl-13 pr-8 text-sm leading-relaxed text-pretty\"\n data-testid={descriptionTestId}\n >\n {description}\n </DialogDescription>\n </DialogHeader>\n )\n}\n","import { useMemo } from 'react'\n\n/** Which folders and labels a run is limited to. Empty = everything. */\nexport interface DocumentScope {\n /** Folder paths; `''` is the \"unfiled\" bucket. */\n folders: string[]\n /** Label (tag) ids. */\n labels: string[]\n}\n\nexport interface UseScopeSelectionOptions {\n /** Every folder path in the tree (not including the unfiled bucket). */\n folderPaths: string[]\n /** Whether the unfiled bucket is shown as a row. */\n hasUnfiled: boolean\n scope: DocumentScope\n onScopeChange: (scope: DocumentScope) => void\n}\n\n/**\n * Headless selection logic for a folder + label scope picker.\n *\n * Folders use hierarchical selection: ticking \"contracts\" also ticks\n * \"contracts/2024\", and unticking removes the whole subtree. \"All\" ticks every\n * row, which is NOT the same as an empty scope: empty means \"the whole\n * workspace, whatever lands in it later\", all-ticked means \"these folders, as\n * they are now\".\n */\nexport function useScopeSelection({\n folderPaths,\n hasUnfiled,\n scope,\n onScopeChange,\n}: UseScopeSelectionOptions) {\n const selectedFolders = useMemo(() => new Set(scope.folders), [scope.folders])\n const selectedLabels = useMemo(() => new Set(scope.labels), [scope.labels])\n\n /** Every row the folder list shows, \"unfiled\" included. */\n const allRowPaths = useMemo(\n () => [...(hasUnfiled ? [''] : []), ...folderPaths],\n [folderPaths, hasUnfiled]\n )\n const allSelected = allRowPaths.length > 0 && allRowPaths.every((p) => selectedFolders.has(p))\n const someSelected = selectedFolders.size > 0 && !allSelected\n\n const descendants = (path: string) => folderPaths.filter((p) => p.startsWith(path + '/'))\n\n const toggleFolder = (path: string) => {\n const next = new Set(selectedFolders)\n const family = [path, ...descendants(path)]\n if (next.has(path)) for (const p of family) next.delete(p)\n else for (const p of family) next.add(p)\n onScopeChange({ folders: [...next], labels: scope.labels })\n }\n\n const toggleAllFolders = () => {\n onScopeChange({ folders: allSelected ? [] : allRowPaths, labels: scope.labels })\n }\n\n const toggleLabel = (labelId: string) => {\n const next = new Set(selectedLabels)\n if (next.has(labelId)) next.delete(labelId)\n else next.add(labelId)\n onScopeChange({ folders: scope.folders, labels: [...next] })\n }\n\n return {\n selectedFolders,\n selectedLabels,\n allSelected,\n someSelected,\n hasSelection: scope.folders.length > 0 || scope.labels.length > 0,\n toggleFolder,\n toggleAllFolders,\n toggleLabel,\n }\n}\n","import { useMemo, useState } from 'react'\nimport { Check, FileCheck2, Minus } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { prefixedTestId, testIdOr } from '../chat/test-id'\nimport { useScopeSelection, type DocumentScope } from '../lib/useScopeSelection'\nimport { formatCount } from '../lib/format'\nimport { FoldSection } from './FoldSection'\n\n/**\n * Fixed strings of the picker. Passed as `uiLabels`: the `labels` prop is already the list of\n * document labels to scope by.\n */\nexport interface ScopePickerLabels {\n folders: string\n /** The Labels section heading. */\n labelsHeading: string\n all: string\n unfiled: string\n noFoldersYet: string\n noLabelsYet: string\n filesToInclude: string\n /** \"3 of 10 files\". */\n matchedOfTotal: (matched: number, total: number) => string\n selectedSuffix: string\n folderCount: (count: number) => string\n labelCount: (count: number) => string\n left: (count: number) => string\n /** \"All 10 files\". */\n allFiles: (total: number) => string\n includedSuffix: string\n}\n\nconst pluralize = (n: number, word: string) => `${n} ${word}${n !== 1 ? 's' : ''}`\n\nexport const DEFAULT_SCOPE_PICKER_LABELS: ScopePickerLabels = {\n folders: 'Folders',\n labelsHeading: 'Labels',\n all: 'All',\n unfiled: 'Unfiled',\n noFoldersYet: 'No folders yet',\n noLabelsYet: 'No labels yet — label files from the Files page to scope by them here.',\n filesToInclude: 'Files to include',\n matchedOfTotal: (matched, total) =>\n `${matched} of ${formatCount(total, { one: 'file', other: 'files' })}`,\n selectedSuffix: ' selected',\n folderCount: (count) => pluralize(count, 'folder'),\n labelCount: (count) => pluralize(count, 'label'),\n left: (count) => `${count} left`,\n allFiles: (total) => `All ${pluralize(total, 'file')}`,\n includedSuffix: ' in the workspace will be included',\n}\n\nexport interface ScopeFolder {\n /** Full path, e.g. `contracts/2024`. */\n path: string\n /** Last segment, shown. */\n label: string\n /** Documents under this folder. */\n count: number\n depth: number\n}\n\nexport interface ScopeLabel {\n id: string\n name: string\n /** Any CSS colour for the dot. */\n color: string\n /** Documents carrying this label. */\n count: number\n}\n\nexport interface ScopePickerProps {\n folders: ScopeFolder[]\n /** Documents with no folder; the \"Unfiled\" row is hidden at 0. */\n unfiledCount: number\n labels: ScopeLabel[]\n /** All documents the picker is scoping. */\n totalCount: number\n /** Documents the current scope matches (computed by the caller). */\n matchedCount: number\n scope: DocumentScope\n onScopeChange: (scope: DocumentScope) => void\n /** Reword the picker's fixed strings. */\n uiLabels?: Partial<ScopePickerLabels>\n /** Sub-element ids; defaults are the current ids. `labelChip` is a prefix (`<prefix>-<label id>`). */\n testIds?: Partial<\n Record<'foldersToggle' | 'labelsToggle' | 'noLabels' | 'labelChip' | 'summary', string>\n >\n}\n\ninterface FolderRowProps {\n label: string\n count: number\n depth: number\n isActive: boolean\n indeterminate?: boolean\n muted?: boolean\n onToggle: () => void\n}\n\n/** A checkbox row: the row is the checkbox (a nested real one would swallow the click). */\nfunction FolderRow({\n label,\n count,\n depth,\n isActive,\n indeterminate,\n muted,\n onToggle,\n}: FolderRowProps) {\n return (\n <button\n type=\"button\"\n onClick={onToggle}\n role=\"checkbox\"\n aria-checked={indeterminate ? 'mixed' : isActive}\n style={{ paddingLeft: `${4 + depth * 14}px` }}\n className={cn(\n 'flex w-full items-center gap-1 rounded-sm py-1 pr-2 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&:hover]:bg-accent pointer-coarse:min-h-11',\n isActive && 'bg-primary/10',\n muted && !isActive && 'text-muted-foreground'\n )}\n data-slot=\"scope-folder-row\"\n >\n <span className=\"flex w-4 shrink-0 items-center justify-center\">\n <span\n className={cn(\n 'flex size-3.5 items-center justify-center rounded-[3px] border transition-colors',\n isActive || indeterminate\n ? 'border-primary bg-primary text-primary-foreground'\n : 'border-muted-foreground/40'\n )}\n >\n {indeterminate ? (\n <Minus className=\"size-2.5\" />\n ) : (\n isActive && <Check className=\"size-2.5\" />\n )}\n </span>\n </span>\n {label !== '' && (\n <span className={cn('min-w-0 truncate', isActive && 'font-semibold text-primary')}>\n {label}\n </span>\n )}\n <span className=\"ml-auto pl-2 text-sm font-semibold text-muted-foreground\">{count}</span>\n </button>\n )\n}\n\n/**\n * Pick a folder + label scope for a run over documents. Controlled: the caller\n * owns the scope and computes `matchedCount`, so the submit button lives with\n * the caller. Both sections start shut: the default (every file) is what most\n * runs want, and the summary states it plainly.\n */\nexport function ScopePicker({\n folders,\n unfiledCount,\n labels,\n totalCount,\n matchedCount,\n scope,\n onScopeChange,\n uiLabels,\n testIds,\n}: ScopePickerProps) {\n const l = { ...DEFAULT_SCOPE_PICKER_LABELS, ...uiLabels }\n const [foldersOpen, setFoldersOpen] = useState(false)\n const [labelsOpen, setLabelsOpen] = useState(false)\n\n const folderPaths = useMemo(() => folders.map((f) => f.path), [folders])\n const selection = useScopeSelection({\n folderPaths,\n hasUnfiled: unfiledCount > 0,\n scope,\n onScopeChange,\n })\n const hasRows = folders.length > 0 || unfiledCount > 0\n\n return (\n <div className=\"flex flex-col gap-4\" data-slot=\"scope-picker\">\n <FoldSection\n label={l.folders}\n count={scope.folders.length}\n open={foldersOpen}\n onOpenChange={setFoldersOpen}\n testId={testIdOr(testIds?.foldersToggle, { testId: 'scope-picker-folders-toggle' })}\n >\n <div className=\"max-h-[180px] overflow-y-auto rounded-md border border-border p-1\">\n {hasRows && (\n <>\n <FolderRow\n label={l.all}\n count={totalCount}\n depth={0}\n isActive={selection.allSelected}\n indeterminate={selection.someSelected}\n onToggle={selection.toggleAllFolders}\n />\n <div className=\"my-1 border-t border-border\" />\n </>\n )}\n {unfiledCount > 0 && (\n <>\n <FolderRow\n label={l.unfiled}\n count={unfiledCount}\n depth={0}\n isActive={selection.selectedFolders.has('')}\n muted\n onToggle={() => selection.toggleFolder('')}\n />\n {folders.length > 0 && <div className=\"my-1 border-t border-border\" />}\n </>\n )}\n {folders.map((folder) => (\n <FolderRow\n key={folder.path}\n label={folder.label}\n count={folder.count}\n depth={folder.depth}\n isActive={selection.selectedFolders.has(folder.path)}\n onToggle={() => selection.toggleFolder(folder.path)}\n />\n ))}\n {!hasRows && <p className=\"px-2 py-1 text-sm text-muted-foreground\">{l.noFoldersYet}</p>}\n </div>\n </FoldSection>\n\n {/* Always present, like Folders: a workspace with no labels yet reads as\n \"you have not labelled anything\", not \"this cannot scope by label\". */}\n <FoldSection\n label={l.labelsHeading}\n count={scope.labels.length}\n open={labelsOpen}\n onOpenChange={setLabelsOpen}\n testId={testIdOr(testIds?.labelsToggle, { testId: 'scope-picker-labels-toggle' })}\n >\n {labels.length === 0 ? (\n <p\n className=\"px-2 py-1 text-sm text-muted-foreground\"\n data-testid={testIdOr(testIds?.noLabels, { testId: 'scope-picker-no-labels' })}\n >\n {l.noLabelsYet}\n </p>\n ) : (\n <div className=\"flex flex-wrap gap-1.5\">\n {labels.map((label) => {\n const isActive = selection.selectedLabels.has(label.id)\n return (\n <button\n key={label.id}\n type=\"button\"\n onClick={() => selection.toggleLabel(label.id)}\n aria-pressed={isActive}\n data-testid={prefixedTestId(testIds?.labelChip, label.id, {\n testId: `scope-picker-label-chip-${label.id}`,\n })}\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring pointer-coarse:min-h-11',\n isActive\n ? 'border-primary/40 bg-primary/10 text-primary'\n : 'border-border [&:hover]:bg-accent [&:hover]:text-accent-foreground'\n )}\n >\n <span\n className=\"size-2.5 shrink-0 rounded-full\"\n style={{ backgroundColor: label.color }}\n />\n <span className=\"truncate\">{label.name}</span>\n <span className=\"shrink-0 text-xs text-muted-foreground\">({label.count})</span>\n {isActive && <Check className=\"size-3.5 shrink-0\" />}\n </button>\n )\n })}\n </div>\n )}\n </FoldSection>\n\n <div\n className=\"rounded-lg bg-muted p-3\"\n data-testid={testIdOr(testIds?.summary, { testId: 'scope-picker-summary' })}\n >\n <div className=\"mb-2 flex items-center gap-1.5 text-xs font-medium text-muted-foreground\">\n <FileCheck2 className=\"size-4\" />\n {l.filesToInclude}\n </div>\n {selection.hasSelection ? (\n <div className=\"text-sm text-muted-foreground\">\n <span className=\"text-base font-semibold text-foreground\">\n {l.matchedOfTotal(matchedCount, totalCount)}\n </span>\n {l.selectedSuffix}\n {scope.folders.length > 0 && <span> — {l.folderCount(scope.folders.length)}</span>}\n {scope.folders.length > 0 && scope.labels.length > 0 && <span>, </span>}\n {scope.labels.length > 0 && <span>{l.labelCount(scope.labels.length)}</span>}\n <span className=\"text-xs\">\n {' · '}\n {l.left(totalCount - matchedCount)}\n </span>\n </div>\n ) : (\n <div className=\"text-sm text-muted-foreground\">\n <span className=\"text-base font-semibold text-foreground\">\n {l.allFiles(totalCount)}\n </span>\n {l.includedSuffix}\n </div>\n )}\n </div>\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport { Plus, type LucideIcon } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { ActionLink } from '../components/ActionLink'\n\n/** The small label that names a band of a page (\"Start\", \"Recent\"). */\nexport function SectionLabel({\n children,\n className,\n testId,\n}: {\n children: ReactNode\n className?: string\n testId?: string\n}) {\n return (\n <p\n className={cn(\n 'flex items-center gap-3 text-sm font-semibold text-foreground after:h-px after:flex-1 after:bg-border',\n className\n )}\n data-slot=\"section-label\"\n data-testid={testId}\n >\n {children}\n </p>\n )\n}\n\nexport interface SectionHeaderProps {\n icon?: LucideIcon\n title: string\n count?: number\n /** Makes the title a button (open the full list). Omit for a static title. */\n onOpen?: () => void\n /** Real link target of the title; `onOpen` still fires on a plain click. */\n openHref?: string\n /** Test id of the title button. */\n openTestId?: string\n /** The section's one quiet action, rendered at the trailing edge. */\n action?: ReactNode\n className?: string\n}\n\n/** Title + count + one quiet action: the head of a list section. */\nexport function SectionHeader({\n icon: Icon,\n title,\n count,\n onOpen,\n openHref,\n openTestId,\n action,\n className,\n}: SectionHeaderProps) {\n return (\n <div\n className={cn('flex items-center justify-between gap-2', className)}\n data-slot=\"section-header\"\n >\n <ActionLink\n href={openHref}\n onSelect={onOpen}\n disabled={!onOpen && !openHref}\n className=\"flex min-w-0 cursor-pointer items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-default disabled:hover:text-foreground pointer-coarse:min-h-11\"\n data-testid={openTestId}\n >\n {Icon && <Icon className=\"size-4 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />}\n <span className=\"whitespace-nowrap text-sm font-semibold text-foreground\">{title}</span>\n {count !== undefined && (\n <span className=\"text-sm tabular-nums text-muted-foreground\">{count}</span>\n )}\n </ActionLink>\n {action && <div className=\"shrink-0\">{action}</div>}\n </div>\n )\n}\n\nexport interface EmptyStripProps {\n icon?: LucideIcon\n label: ReactNode\n description?: ReactNode\n onSelect?: () => void\n testId?: string\n}\n\n/** One tonal strip that stands in for an empty section: an invitation, not a void. */\nexport function EmptyStrip({\n icon: Icon = Plus,\n label,\n description,\n onSelect,\n testId,\n}: EmptyStripProps) {\n return (\n <button\n type=\"button\"\n onClick={onSelect}\n disabled={!onSelect}\n className=\"flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left border border-border bg-card shadow-xs transition-colors hover:border-ring/50 hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-default disabled:hover:bg-card disabled:hover:border-border pointer-coarse:min-h-11\"\n data-slot=\"empty-strip\"\n data-testid={testId}\n >\n <Icon className=\"size-5 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block text-sm font-semibold text-foreground\">{label}</span>\n {description && (\n <span className=\"block text-sm leading-snug text-muted-foreground\">{description}</span>\n )}\n </span>\n </button>\n )\n}\n","/**\n * The column count for a grid of `count` equal tiles in `width` pixels, chosen so the last row is\n * never left with a lone orphan: of the counts that fit (each column at least `minTile` wide),\n * take the one that leaves the fewest empty cells in the last row, preferring more columns on a\n * tie (never fewer than two columns when two fit). Four tiles resolve to 2x2 where three would fit\n * and 4 across when there is room for four; six resolve to 3x2.\n */\nexport function balancedColumns(count: number, width: number, minTile = 200, gap = 12): number {\n if (count <= 1) return 1\n const fit = Math.max(1, Math.min(count, Math.floor((width + gap) / (minTile + gap))))\n if (fit < 2) return 1\n let best = 2\n let bestEmpty = Number.POSITIVE_INFINITY\n for (let columns = 2; columns <= fit; columns++) {\n const empty = (columns - (count % columns)) % columns\n if (empty < bestEmpty || (empty === bestEmpty && columns > best)) {\n best = columns\n bestEmpty = empty\n }\n }\n return best\n}\n","import { useEffect, useRef, useState, type ReactNode } from 'react'\nimport type { LucideIcon } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { ActionLink } from '../components/ActionLink'\nimport { balancedColumns } from '../lib/balanced-columns'\nimport { observeResize } from '../lib/observe-resize'\nimport { SectionLabel } from './sections'\n\n/** One \"start something\" tile: an AI-driven action, one click from underway. */\nexport interface StartTile {\n id: string\n /** A Lucide glyph; `iconNode` wins when both are given. */\n icon?: LucideIcon\n /** A ready-made mark (host icon maps), wearing the same AI ink. */\n iconNode?: ReactNode\n title: string\n description: string\n onSelect: () => void\n /** Real link target (ctrl-click / new tab, in-SPA through the host environment's `linkComponent`). `onSelect` still fires on a plain click. */\n href?: string\n /** Rendered non-interactive and dimmed; `disabledReason` replaces the description. */\n disabled?: boolean\n disabledReason?: string\n testId?: string\n}\n\nexport interface StartTilesProps {\n items: StartTile[]\n /** Optional band label above the tiles (\"Start\"). */\n caption?: string\n captionTestId?: string\n className?: string\n testId?: string\n}\n\n/**\n * A band of tonal action tiles. The glyph wears the AI ink, because these are\n * the AI-driven starts. Nothing is hover-only: tiles are always rendered, hover\n * only nudges tone, and touch targets are at least 44px.\n */\nexport function StartTiles({ items, caption, captionTestId, className, testId }: StartTilesProps) {\n // The tiles reflow by their own container width (a docked tablet sidebar narrows it without\n // changing the viewport), choosing a column count that never leaves one tile alone on a row.\n const gridRef = useRef<HTMLDivElement>(null)\n const [columns, setColumns] = useState<number | null>(null)\n const count = items.length\n useEffect(() => {\n const grid = gridRef.current\n if (!grid || count === 0) return\n const measure = () => setColumns(balancedColumns(count, grid.clientWidth))\n measure()\n return observeResize(grid, measure)\n }, [count])\n\n if (count === 0) return null\n return (\n <section\n className={cn('flex flex-col gap-3', className)}\n data-slot=\"start-tiles\"\n data-testid={testId}\n >\n {caption && <SectionLabel testId={captionTestId}>{caption}</SectionLabel>}\n <div\n ref={gridRef}\n data-slot=\"start-tiles-grid\"\n data-columns={columns ?? undefined}\n className=\"grid gap-3\"\n style={{\n gridTemplateColumns:\n columns === null\n ? 'repeat(auto-fit, minmax(200px, 1fr))'\n : `repeat(${columns}, minmax(0, 1fr))`,\n }}\n >\n {items.map((item) => {\n const Icon = item.icon\n return (\n <ActionLink\n key={item.id}\n href={item.href}\n onSelect={item.onSelect}\n disabled={item.disabled}\n title={item.disabled ? item.disabledReason : undefined}\n className={cn(\n 'flex h-full flex-col items-start gap-3 rounded-lg p-4 text-left',\n 'border border-border bg-card shadow-xs transition-colors hover:border-ring/50 hover:bg-accent/40',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',\n 'disabled:cursor-default disabled:opacity-55 disabled:hover:bg-card disabled:hover:border-border',\n 'pointer-coarse:min-h-11'\n )}\n data-slot=\"start-tile\"\n data-testid={item.testId}\n >\n {item.iconNode ? (\n <span className=\"shrink-0 text-ai-ink [&>svg]:size-5\" aria-hidden=\"true\">\n {item.iconNode}\n </span>\n ) : (\n Icon && <Icon className=\"size-5 shrink-0 text-ai-ink\" aria-hidden=\"true\" />\n )}\n <span className=\"min-w-0\">\n <span className=\"block text-sm font-semibold text-foreground\">{item.title}</span>\n <span className=\"mt-1 block text-sm leading-snug text-muted-foreground\">\n {item.disabled && item.disabledReason ? item.disabledReason : item.description}\n </span>\n </span>\n </ActionLink>\n )\n })}\n </div>\n </section>\n )\n}\n"]}