@arbidocs/blocks 0.5.194 → 0.5.195

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-7GGYYQNK.cjs → ConnectedCallDock-L2ER6N2P.cjs} +11 -11
  2. package/dist/{ConnectedCallDock-7GGYYQNK.cjs.map → ConnectedCallDock-L2ER6N2P.cjs.map} +1 -1
  3. package/dist/{ConnectedCallRoom-ZZ7RBGGY.cjs → ConnectedCallRoom-R6SHBOKX.cjs} +11 -11
  4. package/dist/{ConnectedCallRoom-ZZ7RBGGY.cjs.map → ConnectedCallRoom-R6SHBOKX.cjs.map} +1 -1
  5. package/dist/{ConnectedNativeDocxComparison-PPVXDQY3.cjs → ConnectedNativeDocxComparison-JNOAKSPK.cjs} +9 -9
  6. package/dist/{ConnectedNativeDocxComparison-PPVXDQY3.cjs.map → ConnectedNativeDocxComparison-JNOAKSPK.cjs.map} +1 -1
  7. package/dist/{ConnectedPresentation-LNDESKYE.cjs → ConnectedPresentation-ZSB7454J.cjs} +12 -12
  8. package/dist/{ConnectedPresentation-LNDESKYE.cjs.map → ConnectedPresentation-ZSB7454J.cjs.map} +1 -1
  9. package/dist/{ConnectedSlidesTab-SYDDGJWM.cjs → ConnectedSlidesTab-LCA3ZX5W.cjs} +12 -12
  10. package/dist/{ConnectedSlidesTab-SYDDGJWM.cjs.map → ConnectedSlidesTab-LCA3ZX5W.cjs.map} +1 -1
  11. package/dist/{ConnectedStreamedWordArtifact-GAACBGTY.cjs → ConnectedStreamedWordArtifact-J5HVQMUS.cjs} +9 -9
  12. package/dist/{ConnectedStreamedWordArtifact-GAACBGTY.cjs.map → ConnectedStreamedWordArtifact-J5HVQMUS.cjs.map} +1 -1
  13. package/dist/{FilesViewerDialog-W2HPT3JS.cjs → FilesViewerDialog-O3ZTKELI.cjs} +18 -18
  14. package/dist/{FilesViewerDialog-W2HPT3JS.cjs.map → FilesViewerDialog-O3ZTKELI.cjs.map} +1 -1
  15. package/dist/agents/index.cjs +383 -367
  16. package/dist/agents/tasks/WorkflowThreadStrip.d.ts +3 -1
  17. package/dist/agents/tasks/WorkflowThreadStrip.js +29 -0
  18. package/dist/agents/tasks/WorkflowThreadStrip.js.map +2 -2
  19. package/dist/agents/workflows/StepBarFrame.d.ts +11 -1
  20. package/dist/agents/workflows/StepBarFrame.js +40 -2
  21. package/dist/agents/workflows/StepBarFrame.js.map +2 -2
  22. package/dist/agents/workflows/WorkflowOverview.d.ts +78 -0
  23. package/dist/agents/workflows/WorkflowOverview.js +150 -0
  24. package/dist/agents/workflows/WorkflowOverview.js.map +7 -0
  25. package/dist/agents/workflows/WorkflowRunner.d.ts +2 -0
  26. package/dist/agents/workflows/WorkflowRunner.js +22 -0
  27. package/dist/agents/workflows/WorkflowRunner.js.map +2 -2
  28. package/dist/agents/workflows/WorkflowStepBar.d.ts +5 -1
  29. package/dist/agents/workflows/WorkflowStepBar.js +33 -1
  30. package/dist/agents/workflows/WorkflowStepBar.js.map +2 -2
  31. package/dist/agents/workflows/index.d.ts +1 -0
  32. package/dist/agents/workflows/index.js +10 -0
  33. package/dist/agents/workflows/index.js.map +2 -2
  34. package/dist/agents/workflows/planSteps.js +21 -4
  35. package/dist/agents/workflows/planSteps.js.map +2 -2
  36. package/dist/agents/workflows/run.js +2 -1
  37. package/dist/agents/workflows/run.js.map +2 -2
  38. package/dist/agents/workflows/suggest.d.ts +15 -0
  39. package/dist/agents/workflows/suggest.js +51 -0
  40. package/dist/agents/workflows/suggest.js.map +7 -0
  41. package/dist/agents/workflows/types.d.ts +27 -2
  42. package/dist/agents/workflows/types.js.map +1 -1
  43. package/dist/{ai-A5YTWIEC.cjs → ai-I7QIW5OA.cjs} +23 -23
  44. package/dist/ai-I7QIW5OA.cjs.map +1 -0
  45. package/dist/calls/index.cjs +2 -2
  46. package/dist/chat/index.cjs +59 -59
  47. package/dist/{chunk-GLNL5AL5.cjs → chunk-3GI3UM2T.cjs} +76 -76
  48. package/dist/{chunk-GLNL5AL5.cjs.map → chunk-3GI3UM2T.cjs.map} +1 -1
  49. package/dist/{chunk-PIJPM5RA.cjs → chunk-3YGSCNXQ.cjs} +6 -6
  50. package/dist/{chunk-PIJPM5RA.cjs.map → chunk-3YGSCNXQ.cjs.map} +1 -1
  51. package/dist/{chunk-RNQ3MDTR.cjs → chunk-5WCQ5Y77.cjs} +9 -9
  52. package/dist/{chunk-RNQ3MDTR.cjs.map → chunk-5WCQ5Y77.cjs.map} +1 -1
  53. package/dist/{chunk-JEUHT7XH.cjs → chunk-6CXTLIGJ.cjs} +6 -6
  54. package/dist/{chunk-JEUHT7XH.cjs.map → chunk-6CXTLIGJ.cjs.map} +1 -1
  55. package/dist/{chunk-5RUY5THD.cjs → chunk-6EATJW7T.cjs} +8 -8
  56. package/dist/{chunk-5RUY5THD.cjs.map → chunk-6EATJW7T.cjs.map} +1 -1
  57. package/dist/{chunk-HS7TUDEM.cjs → chunk-6HP6SQWC.cjs} +7 -7
  58. package/dist/{chunk-HS7TUDEM.cjs.map → chunk-6HP6SQWC.cjs.map} +1 -1
  59. package/dist/{chunk-ER2MRSLT.cjs → chunk-6LNTU7DA.cjs} +16 -16
  60. package/dist/{chunk-ER2MRSLT.cjs.map → chunk-6LNTU7DA.cjs.map} +1 -1
  61. package/dist/{chunk-Y3GJBLAI.cjs → chunk-FSTIAEJW.cjs} +10 -9
  62. package/dist/chunk-FSTIAEJW.cjs.map +1 -0
  63. package/dist/{chunk-HO2AURAQ.cjs → chunk-H4ZKASMT.cjs} +6 -6
  64. package/dist/{chunk-HO2AURAQ.cjs.map → chunk-H4ZKASMT.cjs.map} +1 -1
  65. package/dist/{chunk-J46Y2L26.cjs → chunk-HBY5PEMC.cjs} +4 -4
  66. package/dist/{chunk-J46Y2L26.cjs.map → chunk-HBY5PEMC.cjs.map} +1 -1
  67. package/dist/{chunk-3EIO4ZH5.cjs → chunk-HGH5FLYS.cjs} +6 -6
  68. package/dist/{chunk-3EIO4ZH5.cjs.map → chunk-HGH5FLYS.cjs.map} +1 -1
  69. package/dist/{chunk-65NQW4RR.cjs → chunk-HJAI3QNK.cjs} +17 -17
  70. package/dist/{chunk-65NQW4RR.cjs.map → chunk-HJAI3QNK.cjs.map} +1 -1
  71. package/dist/{chunk-2K5DLB7B.cjs → chunk-IOGN5UAT.cjs} +35 -18
  72. package/dist/chunk-IOGN5UAT.cjs.map +1 -0
  73. package/dist/{chunk-5FSULBPE.cjs → chunk-KC3HRFSO.cjs} +11 -11
  74. package/dist/{chunk-5FSULBPE.cjs.map → chunk-KC3HRFSO.cjs.map} +1 -1
  75. package/dist/{chunk-WDPHYI7S.cjs → chunk-KHT2YJ5N.cjs} +5 -5
  76. package/dist/{chunk-WDPHYI7S.cjs.map → chunk-KHT2YJ5N.cjs.map} +1 -1
  77. package/dist/{chunk-XKXKEVHH.cjs → chunk-NSL5BCGH.cjs} +6 -6
  78. package/dist/{chunk-XKXKEVHH.cjs.map → chunk-NSL5BCGH.cjs.map} +1 -1
  79. package/dist/{chunk-WHU7ABQE.cjs → chunk-NYNHFDVW.cjs} +18 -18
  80. package/dist/{chunk-WHU7ABQE.cjs.map → chunk-NYNHFDVW.cjs.map} +1 -1
  81. package/dist/{chunk-JSP3WTFF.cjs → chunk-P5DNNAUY.cjs} +71 -71
  82. package/dist/{chunk-JSP3WTFF.cjs.map → chunk-P5DNNAUY.cjs.map} +1 -1
  83. package/dist/{chunk-M55XUF4L.cjs → chunk-QFSFTO7I.cjs} +7 -7
  84. package/dist/{chunk-M55XUF4L.cjs.map → chunk-QFSFTO7I.cjs.map} +1 -1
  85. package/dist/{chunk-KZH6HMJL.cjs → chunk-QXIWLWR2.cjs} +4 -4
  86. package/dist/{chunk-KZH6HMJL.cjs.map → chunk-QXIWLWR2.cjs.map} +1 -1
  87. package/dist/{chunk-IRDL2EC6.cjs → chunk-SDID4WK7.cjs} +9 -9
  88. package/dist/{chunk-IRDL2EC6.cjs.map → chunk-SDID4WK7.cjs.map} +1 -1
  89. package/dist/{chunk-GWWX3FZ7.cjs → chunk-SYUVP52B.cjs} +8 -8
  90. package/dist/{chunk-GWWX3FZ7.cjs.map → chunk-SYUVP52B.cjs.map} +1 -1
  91. package/dist/{chunk-7GVKG3G4.cjs → chunk-V4XARTJ4.cjs} +17 -17
  92. package/dist/{chunk-7GVKG3G4.cjs.map → chunk-V4XARTJ4.cjs.map} +1 -1
  93. package/dist/{chunk-VJHDCYKE.cjs → chunk-V5VFRRLL.cjs} +7 -7
  94. package/dist/{chunk-VJHDCYKE.cjs.map → chunk-V5VFRRLL.cjs.map} +1 -1
  95. package/dist/{chunk-SQCCQU3K.cjs → chunk-VOGIYFNN.cjs} +2 -2
  96. package/dist/chunk-VOGIYFNN.cjs.map +1 -0
  97. package/dist/{chunk-QDIIOZBP.cjs → chunk-X3SUQFY7.cjs} +439 -140
  98. package/dist/chunk-X3SUQFY7.cjs.map +1 -0
  99. package/dist/{chunk-GZPNBSRE.cjs → chunk-YPSCG6ZW.cjs} +15 -15
  100. package/dist/{chunk-GZPNBSRE.cjs.map → chunk-YPSCG6ZW.cjs.map} +1 -1
  101. package/dist/{chunk-HH5MKRBL.cjs → chunk-YYK2CCMC.cjs} +10 -10
  102. package/dist/{chunk-HH5MKRBL.cjs.map → chunk-YYK2CCMC.cjs.map} +1 -1
  103. package/dist/{chunk-BH322H5B.cjs → chunk-ZLMWMAID.cjs} +6 -6
  104. package/dist/{chunk-BH322H5B.cjs.map → chunk-ZLMWMAID.cjs.map} +1 -1
  105. package/dist/{chunk-OHWYQI3B.cjs → chunk-ZTR3SUN4.cjs} +27 -27
  106. package/dist/{chunk-OHWYQI3B.cjs.map → chunk-ZTR3SUN4.cjs.map} +1 -1
  107. package/dist/connect/docx.cjs +12 -12
  108. package/dist/connect/index.cjs +536 -448
  109. package/dist/connect/index.cjs.map +1 -1
  110. package/dist/connect/viewer.cjs +7 -7
  111. package/dist/connection/ConnectedWorkflowBuilder.d.ts +1 -1
  112. package/dist/connection/ConnectedWorkflowBuilder.js.map +2 -2
  113. package/dist/connection/report-problem/ConnectedReportProblem.js +3 -0
  114. package/dist/connection/report-problem/ConnectedReportProblem.js.map +2 -2
  115. package/dist/connection/report-problem/ReportProblemDialog.d.ts +4 -1
  116. package/dist/connection/report-problem/ReportProblemDialog.js +2 -0
  117. package/dist/connection/report-problem/ReportProblemDialog.js.map +2 -2
  118. package/dist/connection/report-problem/SupportVideoEvidence.d.ts +4 -1
  119. package/dist/connection/report-problem/SupportVideoEvidence.js +54 -0
  120. package/dist/connection/report-problem/SupportVideoEvidence.js.map +2 -2
  121. package/dist/connection/report-problem/useSaveRecordingToWorkspace.d.ts +16 -0
  122. package/dist/connection/report-problem/useSaveRecordingToWorkspace.js +39 -0
  123. package/dist/connection/report-problem/useSaveRecordingToWorkspace.js.map +7 -0
  124. package/dist/embed/index.cjs +19 -19
  125. package/dist/index.cjs +488 -472
  126. package/dist/office/index.cjs +5 -5
  127. package/dist/pages/index.cjs +19 -19
  128. package/dist/record/index.cjs +2 -2
  129. package/dist/record/index.cjs.map +1 -1
  130. package/dist/record/index.js +2 -2
  131. package/dist/record/index.js.map +1 -1
  132. package/dist/record/runs.d.ts +1 -1
  133. package/dist/studio/index.cjs +14 -14
  134. package/dist/styles.css +1 -1
  135. package/dist/workflow-canvas/StepActionSettings.d.ts +3 -0
  136. package/dist/workflow-canvas/StepActionSettings.js +48 -2
  137. package/dist/workflow-canvas/StepActionSettings.js.map +2 -2
  138. package/dist/workflow-canvas/StepInspector.d.ts +9 -0
  139. package/dist/workflow-canvas/StepInspector.js +18 -1
  140. package/dist/workflow-canvas/StepInspector.js.map +2 -2
  141. package/dist/workflow-canvas/WorkflowBuilder.d.ts +11 -1
  142. package/dist/workflow-canvas/WorkflowBuilder.js +54 -3
  143. package/dist/workflow-canvas/WorkflowBuilder.js.map +2 -2
  144. package/dist/workflow-canvas/WorkflowOutline.d.ts +55 -0
  145. package/dist/workflow-canvas/WorkflowOutline.js +331 -0
  146. package/dist/workflow-canvas/WorkflowOutline.js.map +7 -0
  147. package/dist/workflow-canvas/edit.d.ts +7 -0
  148. package/dist/workflow-canvas/edit.js +22 -1
  149. package/dist/workflow-canvas/edit.js.map +2 -2
  150. package/dist/workflow-canvas/index.cjs +1324 -894
  151. package/dist/workflow-canvas/index.cjs.map +1 -1
  152. package/dist/workflow-canvas/index.d.ts +2 -1
  153. package/dist/workflow-canvas/index.js +10 -0
  154. package/dist/workflow-canvas/index.js.map +2 -2
  155. package/node_modules/@arbidocs/coedit/package.json +1 -1
  156. package/package.json +6 -5
  157. package/record/recording_clock.py +58 -0
  158. package/dist/ai-A5YTWIEC.cjs.map +0 -1
  159. package/dist/chunk-2K5DLB7B.cjs.map +0 -1
  160. package/dist/chunk-QDIIOZBP.cjs.map +0 -1
  161. package/dist/chunk-SQCCQU3K.cjs.map +0 -1
  162. package/dist/chunk-Y3GJBLAI.cjs.map +0 -1
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var chunkEVZH6Z5O_cjs = require('./chunk-EVZH6Z5O.cjs');
5
- var chunkSQCCQU3K_cjs = require('./chunk-SQCCQU3K.cjs');
5
+ var chunkVOGIYFNN_cjs = require('./chunk-VOGIYFNN.cjs');
6
6
  var lucideReact = require('lucide-react');
7
7
  var shell = require('@arbidocs/react/shell');
8
8
  var jsxRuntime = require('react/jsx-runtime');
@@ -22,7 +22,7 @@ function skillPackWorkflows(pack) {
22
22
  const cached = cache.get(pack);
23
23
  if (cached) return cached;
24
24
  const workflows = pack.skills.map((skill) => {
25
- const own = chunkSQCCQU3K_cjs.fieldsFromFrontmatter(skill.inputs);
25
+ const own = chunkVOGIYFNN_cjs.fieldsFromFrontmatter(skill.inputs);
26
26
  const placed = (name) => new RegExp(`\\{\\{\\s*${name}\\s*\\}\\}`).test(skill.instructions);
27
27
  const listed = own.filter((f) => f.name !== "request" && !placed(f.name));
28
28
  const request = own.find((f) => f.name === "request") ?? SKILL_PACK_REQUEST_FIELD;
@@ -405,7 +405,7 @@ function nameBuiltinWorkflows(workflows, copy) {
405
405
 
406
406
  // src/agents/workflows/catalogue/registry.ts
407
407
  var WORKFLOW_REGISTRY = [...BUILTIN_SKILLS, ...chunkEVZH6Z5O_cjs.WORD_WORKFLOWS];
408
- var WEB_WORKFLOWS = chunkSQCCQU3K_cjs.workflowsForHost(WORKFLOW_REGISTRY, "web");
408
+ var WEB_WORKFLOWS = chunkVOGIYFNN_cjs.workflowsForHost(WORKFLOW_REGISTRY, "web");
409
409
  var STORAGE_KEY = "arbi.workflow-usage.v1";
410
410
  var EMPTY = {};
411
411
  var cache2 = null;
@@ -536,7 +536,7 @@ function workflowTaskFields(workflow, inputs, name, context) {
536
536
  }
537
537
  const typed = name?.trim();
538
538
  if (workflow.options?.agent === false) {
539
- const message = chunkSQCCQU3K_cjs.composeWorkflowPrompt(workflow, inputs, context);
539
+ const message = chunkVOGIYFNN_cjs.composeWorkflowPrompt(workflow, inputs, context);
540
540
  return { name: typed || message, prompt: "", skill_ref: null, skill_inputs: null };
541
541
  }
542
542
  const derived = typed || deriveWorkflowName(workflow, inputs);
@@ -550,7 +550,7 @@ function workflowTaskFields(workflow, inputs, name, context) {
550
550
  }
551
551
  return {
552
552
  name: derived,
553
- prompt: chunkSQCCQU3K_cjs.composeWorkflowPrompt(workflow, inputs, context),
553
+ prompt: chunkVOGIYFNN_cjs.composeWorkflowPrompt(workflow, inputs, context),
554
554
  skill_ref: null,
555
555
  // The files a run is bound to travel in the saved inputs, whatever the template: the server binds
556
556
  // the run to the ids listed under any input's `documents`.
@@ -863,5 +863,5 @@ exports.useWorkflowUsage = useWorkflowUsage;
863
863
  exports.workflowTaskFields = workflowTaskFields;
864
864
  exports.workflowToComposerValues = workflowToComposerValues;
865
865
  exports.workflowWhen = workflowWhen;
866
- //# sourceMappingURL=chunk-M55XUF4L.cjs.map
867
- //# sourceMappingURL=chunk-M55XUF4L.cjs.map
866
+ //# sourceMappingURL=chunk-QFSFTO7I.cjs.map
867
+ //# sourceMappingURL=chunk-QFSFTO7I.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/agents/workflows/skillPack.ts","../src/agents/workflows/catalogue/seed.tsx","../src/agents/workflows/catalogue/registry.ts","../src/agents/workflows/catalogue/workflow-usage.ts","../src/agents/workflows/catalogue/annotation-name.ts","../src/agents/tasks/taskRequest.ts"],"names":["fieldsFromFrontmatter","assistantCopy","Telescope","GanttChartSquare","NotebookPen","FileText","Languages","Clock","Image","Library","Sparkles","jsx","WORD_WORKFLOWS","workflowsForHost","cache","useSyncExternalStore","composeWorkflowPrompt"],"mappings":";;;;;;;;;;AAUO,IAAM,wBAAA,GAA0C;AAAA,EACrD,IAAA,EAAM,SAAA;AAAA,EACN,IAAA,EAAM,UAAA;AAAA,EACN,KAAA,EAAO,SAAA;AAAA,EACP,WAAA,EAAa;AACf;AAQO,IAAM,mBAAA,GAAsB,CAAC,QAAA,KAClC,MAAA,IAAU,YAAY,OAAQ,QAAA,CAA+B,MAAM,EAAA,KAAO;AAG5E,IAAM,UAAA,GAAa,CAAC,CAAA,EAAuB,CAAA,KACzC,EAAE,QAAA,KAAa,CAAA,CAAE,WACb,CAAA,GACA,CAAA,CAAE,aAAa,MAAA,GACb,CAAA,GACA,EAAE,QAAA,KAAa,MAAA,GACb,KACA,CAAA,CAAE,QAAA,CAAS,aAAA,CAAc,CAAA,CAAE,QAAQ,CAAA;AAE7C,IAAM,KAAA,uBAAY,OAAA,EAA+C;AAO1D,SAAS,mBAAmB,IAAA,EAA6C;AAC9E,EAAA,MAAM,MAAA,GAAS,KAAA,CAAM,GAAA,CAAI,IAAI,CAAA;AAC7B,EAAA,IAAI,QAAQ,OAAO,MAAA;AACnB,EAAA,MAAM,SAAA,GAAY,IAAA,CAAK,MAAA,CACpB,GAAA,CAAI,CAAC,KAAA,KAA6B;AACjC,IAAA,MAAM,GAAA,GAAMA,uCAAA,CAAsB,KAAA,CAAM,MAAM,CAAA;AAC9C,IAAA,MAAM,MAAA,GAAS,CAAC,I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,KAAA,GAAQ,MAAA,CAAO,KAAA,CAAM,IAAA,EAAK;AAChC,EAAA,MAAM,IAAA,GAAoB;AAAA,IACxB,GAAI,KAAA,GAAQ,EAAE,KAAA,KAAU,EAAC;AAAA,IACzB,QAAQ,MAAA,CAAO,KAAA,GAAQ,eAAA,CAAgB,MAAA,CAAO,KAAK,CAAA,GAAI,IAAA;AAAA,IACvD,0BAAA,EAA4B,OAAO,QAAA,IAAY,IAAA;AAAA,IAC/C,QAAQ,MAAA,CAAO;AAAA,GACjB;AACA,EAAA,IAAI,CAAC,OAAO,SAAA,EAAW;AACrB,IAAA,MAAM,IAAA,GAAO,KAAA,IAAS,eAAA,CAAgB,KAAK,CAAA;AAC3C,IAAA,OAAO;AAAA,MACL,KAAA;AAAA,MACA,QAAQ,MAAA,CAAO,MAAA;AAAA,MACf,IAAA;AAAA,MACA,cAAA,EAAgB,KAAA;AAAA,MAChB,IAAA,EAAM,EAAE,KAAA,EAAO,IAAA,EAAM,aAAa,KAAA,KAAU,IAAA,GAAO,KAAK,KAAA;AAAM,KAChE;AAAA,EACF;AACA,EAAA,OAAO,EAAE,KAAA,EAAO,MAAA,EAAQ,OAAO,MAAA,EAAQ,IAAA,EAAM,gBAAgB,IAAA,EAAK;AACpE","file":"chunk-M55XUF4L.cjs","sourcesContent":["/**\n * A host's skill pack (`defineSkillPack`, `@arbidocs/react`) as the kit's workflows: prompt skills\n * like the built-ins, so the `/` menu, the skill form and the launch treat them the same. Each\n * keeps its pack's id and label, which the menu uses as its group.\n */\nimport type { DefinedSkillPack } from '@arbidocs/react'\nimport type { WorkflowDefinition, WorkflowField } from './types'\nimport { fieldsFromFrontmatter } from './workflow'\n\n/** The free-text field every pack skill opens with: what `/slug some text` fills in. */\nexport const SKILL_PACK_REQUEST_FIELD: WorkflowField = {\n name: 'request',\n type: 'longtext',\n label: 'Request',\n placeholder: 'Anything to add (optional)',\n}\n\n/** A pack skill as a workflow, with the pack it came from. */\nexport interface SkillPackWorkflow extends WorkflowDefinition {\n pack: { id: string; label?: string }\n}\n\n/** True for a workflow that came from a host's skill pack. */\nexport const isSkillPackWorkflow = (workflow: WorkflowDefinition): workflow is SkillPackWorkflow =>\n 'pack' in workflow && typeof (workflow as SkillPackWorkflow).pack?.id === 'string'\n\n/** Categories in order, then the skills without one (the pack's own section) last. */\nconst byCategory = (a: WorkflowDefinition, b: WorkflowDefinition): number =>\n a.category === b.category\n ? 0\n : a.category === undefined\n ? 1\n : b.category === undefined\n ? -1\n : a.category.localeCompare(b.category)\n\nconst cache = new WeakMap<DefinedSkillPack, SkillPackWorkflow[]>()\n\n/**\n * The pack's skills as prompt workflows, in menu order (by category, those without one last, then\n * title). The prompt is the skill's instructions, then any input its text does not already place\n * (`- Label: {{name}}`), then the request. Stable per pack object, so lists built from it memoise.\n */\nexport function skillPackWorkflows(pack: DefinedSkillPack): SkillPackWorkflow[] {\n const cached = cache.get(pack)\n if (cached) return cached\n const workflows = pack.skills\n .map((skill): SkillPackWorkflow => {\n const own = fieldsFromFrontmatter(skill.inputs)\n const placed = (name: string) =>\n new RegExp(`\\\\{\\\\{\\\\s*${name}\\\\s*\\\\}\\\\}`).test(skill.instructions)\n const listed = own.filter((f) => f.name !== 'request' && !placed(f.name))\n const request = own.find((f) => f.name === 'request') ?? SKILL_PACK_REQUEST_FIELD\n const promptTemplate = [\n skill.instructions,\n listed.length > 0 &&\n `## Inputs\\n${listed.map((f) => `- ${f.label}: {{${f.name}}}`).join('\\n')}`,\n !placed('request') && '{{request}}',\n ]\n .filter(Boolean)\n .join('\\n\\n')\n return {\n id: skill.slug,\n title: skill.title,\n description: skill.description,\n // The skill icon unless the host names its own (drawn by `host.workflows.renderIcon`).\n icon: skill.icon ?? 'skill',\n category: skill.category,\n builtin: true,\n inputs: [request, ...own.filter((f) => f.name !== 'request')],\n run: { kind: 'prompt', promptTemplate },\n landing: 'chat',\n pack: { id: pack.id, label: pack.label },\n }\n })\n .sort((a, b) => byCategory(a, b) || a.title.localeCompare(b.title))\n cache.set(pack, workflows)\n return workflows\n}\n","/**\n * The seeded workflows, as data. This is the client-side registry the dashboard tiles, the slash\n * menu, tasks and agents all read; it has exactly the shape of a skill with declared `inputs`\n * (see docs/design/workflows.md), so each entry can move into a SKILL.md document later with no\n * UI change. It is the default catalogue: a host offers it as is, a slice of it, or its own.\n *\n * Prompt wording avoids phrasings that put the agent in documents-only mode (\"based on these\n * documents\", \"in the documents\"), which would switch the web off.\n */\n\nimport type { ReactNode } from 'react'\nimport {\n Clock,\n FileText,\n GanttChartSquare,\n Image,\n Library,\n Languages,\n NotebookPen,\n Sparkles,\n Telescope,\n} from 'lucide-react'\nimport { assistantCopy, type AssistantCopy } from '@arbidocs/react/shell'\nimport type { WorkflowDefinition } from '../types'\n\n/** ARBI's own phrases: the seeded text below. */\nconst ARBI = assistantCopy()\n\n/** The timeline instruction. The scope picks the files; this never names a folder or label. */\nexport const TIMELINE_PROMPT =\n 'Build a timeline from the selected files. Record every dated event ' +\n 'as its own fact: put the date in the fact’s date field at exactly the ' +\n 'precision the file gives, cite the file you took it from, and label them all ' +\n '“Main Events”. Then show me the chronology, oldest first.'\n\nexport const DEEP_RESEARCH_ID = 'deep-research'\nexport const TIMELINE_ID = 'timeline'\nexport const SUMMARISE_ID = 'summarise'\nexport const TRANSLATE_ID = 'translate'\nexport const CHRONOLOGY_ID = 'chronology'\nexport const GENERATE_IMAGE_ID = 'generate-image'\nexport const ANNOTATE_ID = 'annotate'\n/** Task-only entries: a free instruction, and a plain reminder. */\nexport const CUSTOM_TASK_ID = '__custom__'\nexport const REMIND_TASK_ID = '__remind__'\n\n/** Tier C: workflows (skills) launch an agent run; the inputs are its parameters. */\nexport const DEEP_RESEARCH: WorkflowDefinition = {\n id: DEEP_RESEARCH_ID,\n builtin: true,\n title: 'Deep research',\n description: ARBI.deepResearch.description,\n details: ARBI.deepResearch.details,\n icon: 'research',\n startLabel: 'Research',\n inputs: [\n {\n name: 'topic',\n type: 'text',\n label: 'What do you want to research about?',\n placeholder: 'e.g. Q3 runway, competitive landscape, open risks in our contracts…',\n required: true,\n },\n {\n name: 'web',\n type: 'boolean',\n label: 'Search the web',\n default: true,\n // With the web off the wording changes rather than dropping a clause: the agent is told to\n // stay in the workspace and say when the files fall short, so a thin answer reads as a gap\n // in the files rather than as research quietly skipped.\n trueText:\n 'Search my workspace files first, then the web for what they don’t cover: read the best sources and cite them. Cite file sources and web sources separately, and tell me if you could not reach the web.',\n falseText:\n 'Use only my workspace files — do not search the web. Read the relevant files and cite them. Tell me plainly where the files do not answer the question.',\n },\n ],\n run: { kind: 'prompt', promptTemplate: 'Research: {{topic}}. {{web}}' },\n landing: 'chat',\n schedulable: true,\n}\n\nexport const TIMELINE: WorkflowDefinition = {\n id: TIMELINE_ID,\n builtin: true,\n title: 'Build a timeline',\n description: 'Turn the dates in your files into facts you can see on a timeline',\n details:\n 'Choose which files to include — folders, labels, or leave it empty to use every file in the workspace.',\n icon: 'timeline',\n startLabel: 'Build timeline',\n requiresFiles: true,\n inputs: [\n { name: 'scope', type: 'scope', label: 'Files' },\n {\n name: 'instruction',\n type: 'longtext',\n label: 'What the timeline should cover',\n default: TIMELINE_PROMPT,\n required: true,\n advanced: true,\n },\n ],\n run: { kind: 'prompt', promptTemplate: '{{instruction}}' },\n landing: 'chat',\n schedulable: true,\n}\n\n/**\n * The former prompt templates, now ordinary workflows. The wording is the old template wording,\n * word for word (the unit tests pin it); the file name(s) the old forms put in the prompt come from\n * the `documents` field, quoted by `composeWorkflowPrompt`.\n */\nexport const SUMMARISE: WorkflowDefinition = {\n id: SUMMARISE_ID,\n builtin: true,\n title: 'Summarise',\n description: 'Create a customised summary of any document',\n icon: 'summarise',\n startLabel: 'Summarise',\n requiresFiles: true,\n // The stronger model the old template switched to for this run.\n model: 'Wise',\n inputs: [\n {\n name: 'document',\n type: 'documents',\n label: 'Document',\n required: true,\n context: 'documents',\n },\n {\n name: 'length',\n type: 'select',\n label: 'Summary length',\n default: 'standard',\n options: [\n {\n value: 'brief',\n label: 'Brief (1 paragraph)',\n text: 'provide a brief summary in a single paragraph. Focus on the core message, key conclusions, and any critical actions or decisions. Keep it concise — no more than 5-6 sentences.',\n },\n {\n value: 'standard',\n label: 'Standard',\n text: 'provide a structured summary. Include the following sections using markdown headings:\\n\\n## Overview\\nA short paragraph describing what the document is about, its purpose, and context.\\n\\n## Key Points\\nA bulleted list of the main arguments, findings, or topics covered.\\n\\n## Conclusions & Recommendations\\nAny conclusions drawn, decisions made, or recommended next steps mentioned in the document.\\n\\nKeep each section focused and concise.',\n },\n {\n value: 'detailed',\n label: 'Detailed',\n text: 'provide a thorough and well-structured summary. Include the following sections using markdown headings:\\n\\n## Overview\\nDescribe the document type, purpose, author/source context, and intended audience.\\n\\n## Background & Context\\nSummarise any background information, prior events, or context the document references.\\n\\n## Key Points & Arguments\\nProvide a detailed bulleted breakdown of all major points, arguments, findings, and evidence presented. Group related points under sub-headings where appropriate.\\n\\n## Data & Evidence\\nHighlight any specific data, statistics, figures, dates, or factual claims made in the document.\\n\\n## Conclusions & Recommendations\\nSummarise all conclusions, decisions, action items, or recommended next steps.\\n\\n## Open Questions\\nNote any unresolved issues, ambiguities, or areas that may require further clarification.\\n\\nBe comprehensive — do not omit significant details.',\n },\n ],\n },\n {\n name: 'focus',\n type: 'text',\n label: 'Anything to focus on',\n placeholder: 'e.g. Focus on payment terms and deadlines.',\n },\n ],\n run: {\n kind: 'prompt',\n promptTemplate:\n 'Please read the full text of the document {{document}} and {{length}}\\n\\n{{focus}}',\n },\n landing: 'chat',\n}\n\nexport const TRANSLATE_LANGUAGES = [\n 'English',\n 'Spanish',\n 'French',\n 'German',\n 'Chinese',\n 'Japanese',\n 'Korean',\n 'Russian',\n 'Arabic',\n 'Portuguese',\n 'Italian',\n 'Dutch',\n 'Polish',\n]\n\nexport const TRANSLATE: WorkflowDefinition = {\n id: TRANSLATE_ID,\n builtin: true,\n title: 'Translate',\n description:\n 'A new editable document, translated passage by passage: side by side with the original, or the translation alone',\n icon: 'translate',\n startLabel: 'Translate',\n requiresFiles: true,\n inputs: [\n {\n name: 'document',\n type: 'documents',\n label: 'Document',\n required: true,\n context: 'documents',\n },\n {\n name: 'language',\n type: 'select',\n label: 'Target language',\n default: 'English',\n options: TRANSLATE_LANGUAGES.map((value) => ({ value, label: value })),\n },\n {\n name: 'layout',\n type: 'select',\n label: 'Layout',\n default: 'two-column',\n options: [\n {\n value: 'two-column',\n label: 'Side by side',\n description: 'Original left, translation right',\n text: 'Put the original and the translation side by side.',\n },\n {\n value: 'translation-only',\n label: 'Translation only',\n description: 'Just the translated text',\n text: 'Give only the translation.',\n },\n ],\n },\n ],\n run: {\n kind: 'prompt',\n promptTemplate:\n 'Translate the document {{document}} into {{language}} as a new document. {{layout}}',\n },\n landing: 'chat',\n // Runs as a task or a step of a scheduled workflow: the prompt reaches the agent's translation tool.\n schedulable: true,\n}\n\n/**\n * Chronology stays its own workflow rather than folding into \"Build a timeline\": the timeline\n * WRITES dated facts (with citations and a label) to the workspace and then shows them, while\n * chronology only ANSWERS with a read-only markdown table of the files themselves (title and\n * subject, ordered by date). Different side effects, different unit (events vs documents), so\n * different consent: one is a read, the other a change to the workspace.\n */\nexport const CHRONOLOGY: WorkflowDefinition = {\n id: CHRONOLOGY_ID,\n builtin: true,\n title: 'Chronology',\n description: 'Sort documents by date with title and subject',\n icon: 'chronology',\n startLabel: 'Sort by date',\n requiresFiles: true,\n model: 'Wise',\n inputs: [{ name: 'scope', type: 'scope', label: 'Files', context: 'documents' }],\n run: {\n kind: 'prompt',\n promptTemplate:\n 'Read all available documents and prepare a markdown table ordered by Date, earliest first. Include title and subject columns. Sort each document by its start date; where a document gives only a range or period, put the start date in the Date column and state the range in the subject.',\n },\n landing: 'chat',\n}\n\nexport const IMAGE_ASPECT_RATIOS: { value: string; label: string }[] = [\n { value: '1:1', label: '1:1 — Square' },\n { value: '16:9', label: '16:9 — Widescreen' },\n { value: '9:16', label: '9:16 — Portrait' },\n { value: '4:3', label: '4:3 — Landscape' },\n { value: '3:4', label: '3:4 — Portrait' },\n { value: '3:2', label: '3:2 — Landscape' },\n { value: '2:3', label: '2:3 — Portrait' },\n { value: '5:4', label: '5:4 — Landscape' },\n { value: '4:5', label: '4:5 — Portrait' },\n { value: '21:9', label: '21:9 — Ultrawide' },\n]\n/** The aspect-ratio value that sends no shape at all (the model decides). */\nexport const IMAGE_ASPECT_AUTO = 'auto'\n\n/**\n * Generate image. The prompt is `/image <description>`; the reference images and the aspect ratio\n * are NOT worded into it (the image model does not reliably honour wording): the host sends them\n * as structured tool arguments (`launch-bindings.ts`), exactly as the old modal did.\n */\nexport const GENERATE_IMAGE: WorkflowDefinition = {\n id: GENERATE_IMAGE_ID,\n builtin: true,\n title: 'Generate image',\n description: 'Create or edit an image from a text prompt',\n icon: 'image',\n startLabel: 'Generate',\n inputs: [\n {\n name: 'prompt',\n type: 'longtext',\n label: 'What do you want to generate?',\n placeholder: 'A red bicycle on a beach at sunset...',\n required: true,\n },\n {\n name: 'references',\n type: 'documents',\n label: 'Source images',\n description: 'Pick images to edit or combine. Leave empty to generate from scratch.',\n accept: 'image',\n max: 8,\n context: 'image',\n },\n {\n name: 'aspect_ratio',\n type: 'select',\n label: 'Aspect ratio',\n default: IMAGE_ASPECT_AUTO,\n options: [\n { value: IMAGE_ASPECT_AUTO, label: 'Auto (model default)' },\n ...IMAGE_ASPECT_RATIOS,\n ],\n },\n ],\n run: { kind: 'prompt', promptTemplate: '/image {{prompt}}' },\n landing: 'chat',\n}\n\n/** Tier B: a bounded operation launcher (not a skill, not an agent run). */\nexport const ANNOTATE: WorkflowDefinition = {\n id: ANNOTATE_ID,\n title: 'AI annotation',\n description: 'Ask one question, get the answer for every file as a column',\n details: ARBI.annotate.details,\n icon: 'annotate',\n startLabel: 'Annotate',\n requiresFiles: true,\n inputs: [\n {\n name: 'description',\n type: 'longtext',\n label: 'Description',\n placeholder: ARBI.annotate.placeholder,\n required: true,\n },\n { name: 'name', type: 'text', label: 'Name' },\n { name: 'scope', type: 'scope', label: 'Files' },\n ],\n run: { kind: 'operation' },\n landing: 'files',\n options: { agent: false },\n}\n\n/**\n * The built-in SKILLS: same shape as a marketplace skill, listed in the same list and the same\n * slash menu (one `/slug` path), pinned and not deletable. A same-slug skill of the user's own\n * shadows the built-in (the backend's own-shadows-global rule), which is how a built-in is forked\n * and customised. Delete this list once the backend ships them as real marketplace SKILL.md\n * documents (docs/design/workflows.md).\n */\nexport const BUILTIN_SKILLS: WorkflowDefinition[] = [\n DEEP_RESEARCH,\n SUMMARISE,\n TRANSLATE,\n TIMELINE,\n CHRONOLOGY,\n GENERATE_IMAGE,\n]\n\n/**\n * The dashboard's Start band is a curated VIEW over the skill list, not a code path: pin and order\n * are data. Ids resolve against the live list, so a shadowing skill replaces its tile. Tier B\n * operation launchers (annotation) sit in the band too; tier A actions are added by the host.\n */\nexport const DASHBOARD_PINNED: string[] = [DEEP_RESEARCH_ID, TIMELINE_ID]\nexport const DASHBOARD_OPERATIONS: WorkflowDefinition[] = [ANNOTATE]\n\n/** Tasks can also run a free instruction or just remind. */\nexport const CUSTOM_TASK: WorkflowDefinition = {\n id: CUSTOM_TASK_ID,\n generic: true,\n title: 'My own instruction',\n description: 'Tell the agent what to do, in your own words.',\n inputs: [\n {\n name: 'instruction',\n type: 'longtext',\n label: 'Instruction',\n placeholder: 'Summarise what is new in my workspace and message me the result.',\n required: true,\n },\n ],\n run: { kind: 'prompt', promptTemplate: '{{instruction}}' },\n landing: 'chat',\n schedulable: true,\n}\n\nexport const REMIND_TASK: WorkflowDefinition = {\n id: REMIND_TASK_ID,\n generic: true,\n title: 'Remind me',\n description: 'Send me a notification, no agent work.',\n inputs: [\n {\n name: 'message',\n type: 'text',\n label: 'Reminder',\n placeholder: 'Review the weekly numbers',\n required: true,\n },\n ],\n run: { kind: 'prompt', promptTemplate: '{{message}}' },\n landing: 'chat',\n schedulable: true,\n options: { agent: false },\n}\n\nconst ICONS: Record<string, typeof Telescope> = {\n research: Telescope,\n timeline: GanttChartSquare,\n annotate: NotebookPen,\n summarise: FileText,\n translate: Languages,\n chronology: Clock,\n image: Image,\n library: Library,\n /** Skills that bring no icon of their own (the user's and the marketplace's). */\n skill: Sparkles,\n}\n\n/** Maps a workflow/option icon key to its mark. Unknown keys render nothing. */\nexport function renderWorkflowIcon(key: string): ReactNode {\n const Icon = ICONS[key]\n return Icon ? <Icon className=\"size-5\" /> : null\n}\n\n/**\n * The seeded workflows in the host's words (`useAssistantCopy()`): a seeded entry that names the\n * assistant takes the copy's phrases; anything else (a skill that shadows it, the host's own) is\n * left as it is. With ARBI's name the list is returned unchanged.\n */\nexport function nameBuiltinWorkflows(\n workflows: ReadonlyArray<WorkflowDefinition>,\n copy: AssistantCopy\n): WorkflowDefinition[] {\n if (copy.name === ARBI.name) return [...workflows]\n return workflows.map((w) =>\n w === DEEP_RESEARCH\n ? { ...w, ...copy.deepResearch }\n : w === ANNOTATE\n ? {\n ...w,\n details: copy.annotate.details,\n inputs: w.inputs.map((field) =>\n field.name === 'description'\n ? { ...field, placeholder: copy.annotate.placeholder }\n : field\n ),\n }\n : w\n )\n}\n","/** The default catalogue as one registry, and the web host's slice of it. */\nimport type { WorkflowDefinition } from '../types'\nimport { workflowsForHost } from '../workflow'\nimport { BUILTIN_SKILLS } from './seed'\nimport { WORD_WORKFLOWS } from './word-workflows'\n\n/** Everything the registry holds; each host offers its own slice (`workflowsForHost`). */\nexport const WORKFLOW_REGISTRY: WorkflowDefinition[] = [...BUILTIN_SKILLS, ...WORD_WORKFLOWS]\n\n/** The web app's slice of the registry: the built-ins every skill list starts from. */\nexport const WEB_WORKFLOWS: WorkflowDefinition[] = workflowsForHost(WORKFLOW_REGISTRY, 'web')\n","/**\n * A cheap local usage counter for workflows: how often and how recently each one was started on\n * this device. It only orders the Start section (recent first, then name); nothing is sent to a\n * server and nothing breaks when storage is unavailable.\n */\n\nimport { useSyncExternalStore } from 'react'\n\nconst STORAGE_KEY = 'arbi.workflow-usage.v1'\n\nexport interface WorkflowUsageEntry {\n count: number\n /** Epoch ms of the latest start. */\n last: number\n}\n\nexport type WorkflowUsage = Record<string, WorkflowUsageEntry>\n\nconst EMPTY: WorkflowUsage = {}\nlet cache: WorkflowUsage | null = null\nconst listeners = new Set<() => void>()\n\nfunction read(): WorkflowUsage {\n if (cache) return cache\n try {\n const raw = window.localStorage.getItem(STORAGE_KEY)\n const parsed = raw ? (JSON.parse(raw) as unknown) : null\n cache = parsed && typeof parsed === 'object' ? (parsed as WorkflowUsage) : EMPTY\n } catch {\n cache = EMPTY\n }\n return cache\n}\n\n/** Count one start of `workflowId` now. */\nexport function recordWorkflowUse(workflowId: string, now: number = Date.now()): void {\n const prev = read()[workflowId]\n cache = { ...read(), [workflowId]: { count: (prev?.count ?? 0) + 1, last: now } }\n try {\n window.localStorage.setItem(STORAGE_KEY, JSON.stringify(cache))\n } catch {\n // Storage full or blocked: the in-memory counter still orders this session.\n }\n listeners.forEach((l) => l())\n}\n\nexport function useWorkflowUsage(): WorkflowUsage {\n return useSyncExternalStore(\n (listener) => {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n read,\n () => EMPTY\n )\n}\n\n/** Most recently used first; never-used ones follow, by title. Stable and pure. */\nexport function sortByRecentUse<T extends { id: string; title: string }>(\n items: T[],\n usage: WorkflowUsage\n): T[] {\n return [...items].sort((a, b) => {\n const la = usage[a.id]?.last ?? 0\n const lb = usage[b.id]?.last ?? 0\n if (la !== lb) return lb - la\n return a.title.localeCompare(b.title)\n })\n}\n\n/** Test seam: forget the cached value (and storage). */\nexport function resetWorkflowUsage(): void {\n cache = null\n try {\n window.localStorage.removeItem(STORAGE_KEY)\n } catch {\n // ignore\n }\n listeners.forEach((l) => l())\n}\n","/**\n * Names an annotation's column from the question it asks, for when the user\n * leaves the name blank.\n *\n * Deliberately mechanical rather than clever: there is no naming endpoint to\n * ask, so the rule has to be one the user can predict. The dialog shows the\n * result in the name field's placeholder before anything runs, so the column's\n * title is never a surprise — and typing over it always wins.\n */\n\n/** Question words that would otherwise head the column: \"What currency…\" → \"Currency…\". */\nconst LEADING_INTERROGATIVE =\n /^(what(?:'s)?|which|who(?:se|m)?|when|where|why|how|is|are|was|were|does|do|did|can|could|should|would|will|has|have)\\s+/i\n\n/** Words kept from the question — enough to tell two columns apart, short enough to head one. */\nconst MAX_WORDS = 4\nconst MAX_CHARS = 40\n\nexport function deriveAnnotationName(description: string): string {\n const cleaned = description\n .trim()\n .replace(/\\s+/g, ' ')\n .replace(/[?.!,;:]+$/, '')\n if (!cleaned) return ''\n\n // Drop the interrogative only when something survives it — \"What?\" alone\n // should still name a column rather than nothing.\n const withoutLead = cleaned.replace(LEADING_INTERROGATIVE, '')\n const source = withoutLead.trim() || cleaned\n\n let name = source.split(' ').slice(0, MAX_WORDS).join(' ')\n if (name.length > MAX_CHARS) name = name.slice(0, MAX_CHARS).trimEnd()\n\n return name.charAt(0).toUpperCase() + name.slice(1)\n}\n","/**\n * TaskComposer values to API requests (and back): the pure mapping every host would write the same\n * way. No SDK call is made here; hand the result to the hooks from `@arbidocs/react`.\n *\n * \"Now\" (or a plain to-do) creates work: a conversation with a status (`useCreateWork`). Any other\n * start (a date, a repeat, an event, after another task) saves a workflow (`useCreateWorkflow`) that\n * creates the work when it fires.\n */\nimport type { components } from '@arbidocs/client'\nimport { composeWorkflowPrompt, type WorkflowComposeContext } from '../workflows/workflow'\nimport type { WorkflowDefinition, WorkflowInputs } from '../workflows/types'\nimport type { TaskComposerValues, TaskWhen } from './taskComposerTypes'\nimport type { MessageMentionRef } from '@arbidocs/react/shell'\n\ntype Schemas = components['schemas']\ntype ConversationResponse = Schemas['ConversationResponse']\ntype CreateWorkRequest = Schemas['CreateWorkRequest']\ntype CreateWorkflowRequest = Schemas['CreateWorkflowRequest']\ntype TaskPlan = Schemas['TaskPlan']\ntype TaskOptions = Schemas['TaskOptions']\ntype UpdateConversationRequest = Schemas['UpdateConversationRequest']\ntype UpdateWorkflowRequest = Schemas['UpdateWorkflowRequest']\ntype WorkflowResponse = Schemas['WorkflowResponse']\n\n/** The authorization tier of a run (the same three values for work and for workflows). */\nexport type TaskAuthMode = CreateWorkRequest['auth_mode']\n\n/**\n * The plain-language access choice becomes the backend authorisation tier: run-now work is\n * authorised for that one run, a workflow either keeps standing access or asks each run.\n */\nexport function authModeFor(values: Pick<TaskComposerValues, 'when' | 'access'>): TaskAuthMode {\n if (values.when === 'now' || values.when === 'manual') return 'run_now_temp'\n return values.access === 'standing' ? 'scheduled_permanent' : 'scheduled_require_auth'\n}\n\n/** `datetime-local` value (no zone) to an ISO instant. Throws on an empty or invalid value. */\nexport function localInputToIso(local: string): string {\n const d = new Date(local)\n if (!local || Number.isNaN(d.getTime())) throw new Error('Pick a valid date and time.')\n return d.toISOString()\n}\n\n/** An ISO instant to the `datetime-local` value the composer edits; empty for none or invalid. */\nexport function isoToLocalInput(iso: string | null | undefined): string {\n if (!iso) return ''\n const d = new Date(iso)\n if (Number.isNaN(d.getTime())) return ''\n return new Date(d.getTime() - d.getTimezoneOffset() * 60000).toISOString().slice(0, 16)\n}\n\nexport interface WorkflowTaskFields {\n /** The title of the work or the name of the workflow. */\n name: string\n action?: Schemas['DocumentAutomationAction']\n prompt: string\n skill_ref: string | null\n /** The skill's saved inputs (only for a skill). */\n skill_inputs: WorkflowInputs | null\n}\n\n/** How many words of an instruction a derived name keeps. */\nexport const DERIVED_NAME_WORDS = 6\n\n/** The first `count` words of a text, with an ellipsis when there is more; empty for blank text. */\nexport function firstWords(text: string, count = DERIVED_NAME_WORDS): string {\n const words = text.trim().split(/\\s+/).filter(Boolean)\n if (words.length <= count) return words.join(' ')\n return `${words.slice(0, count).join(' ')}…`\n}\n\n/**\n * The name a workflow (or task) gets when its owner types none: the template's title or, for a template\n * that is a free-text instruction or reminder (its form is just an `instruction` or `message`), the\n * first few words of what was written, falling back to the title while it is still blank.\n */\nexport function deriveWorkflowName(workflow: WorkflowDefinition, inputs: WorkflowInputs): string {\n for (const field of ['instruction', 'message']) {\n if (workflow.inputs.some((i) => i.name === field)) {\n const written = inputs[field]\n return (typeof written === 'string' && firstWords(written)) || workflow.title\n }\n }\n return workflow.title\n}\n\n/**\n * How a workflow definition becomes an action:\n * - `options.agent === false` is a reminder: the composed text is the title and there is no prompt or\n * skill (the backend makes a to-do and notifies the owner);\n * - a definition with a `skill` runs that skill, its `args` input being the arguments;\n * - anything else is an agent prompt, the composed workflow prompt.\n * `name` (typed by the user) wins over the derived one (see {@link deriveWorkflowName}).\n */\n/** Does any input name files (an explicit pick, or a resolved scope)? Those bind the run. */\nconst hasDocumentInputs = (inputs: WorkflowInputs): boolean =>\n Object.values(inputs).some(\n (v) =>\n v !== null &&\n typeof v === 'object' &&\n Array.isArray((v as { documents?: unknown }).documents) &&\n ((v as { documents: unknown[] }).documents.length ?? 0) > 0\n )\n\nexport function workflowTaskFields(\n workflow: WorkflowDefinition,\n inputs: WorkflowInputs,\n name?: string,\n context?: WorkflowComposeContext\n): WorkflowTaskFields {\n if (workflow.documentAction) {\n const scope =\n inputs.scope && typeof inputs.scope === 'object' ? inputs.scope : { labels: [], folders: [] }\n return {\n name: name?.trim() || workflow.title,\n prompt: '',\n skill_ref: null,\n skill_inputs: inputs,\n action: {\n type: workflow.documentAction,\n documents: {\n doc_ext_ids: scope.documents ?? [],\n label_ext_ids: scope.labels ?? [],\n latest: inputs.latest === true,\n },\n tag_ext_ids: typeof inputs.output === 'string' && inputs.output ? [inputs.output] : [],\n overwrite: inputs.overwrite === true,\n },\n }\n }\n for (const value of Object.values(inputs)) {\n if (!value || typeof value !== 'object') continue\n const scope = value as { documents?: unknown[]; folders?: unknown[]; labels?: unknown[] }\n if (\n Array.isArray(scope.documents) &&\n !scope.documents.length &&\n ((scope.folders?.length ?? 0) > 0 || (scope.labels?.length ?? 0) > 0)\n ) {\n throw new Error(\n 'The selected file scope has no documents. Choose a scope containing files before running.'\n )\n }\n }\n const typed = name?.trim()\n if (workflow.options?.agent === false) {\n const message = composeWorkflowPrompt(workflow, inputs, context)\n return { name: typed || message, prompt: '', skill_ref: null, skill_inputs: null }\n }\n const derived = typed || deriveWorkflowName(workflow, inputs)\n if (workflow.skill) {\n return {\n name: derived,\n prompt: typeof inputs.args === 'string' ? inputs.args.trim() : '',\n skill_ref: workflow.skill,\n skill_inputs: inputs,\n }\n }\n return {\n name: derived,\n prompt: composeWorkflowPrompt(workflow, inputs, context),\n skill_ref: null,\n // The files a run is bound to travel in the saved inputs, whatever the template: the server binds\n // the run to the ids listed under any input's `documents`.\n skill_inputs: hasDocumentInputs(inputs) ? inputs : null,\n }\n}\n\n/** Does this workflow need a workspace to run (everything except a plain reminder)? */\nexport const isAgenticWorkflow = (workflow: WorkflowDefinition): boolean =>\n workflow.options?.agent !== false\n\nexport interface TaskRequestContext {\n /** File names for the prompt's wording (\"the document <name>\"), by file id. */\n documentTitles?: Record<string, string>\n workflow: WorkflowDefinition\n values: TaskComposerValues\n /** The goal checklist drafted for agent work, if any. */\n plan?: TaskPlan | null\n}\n\n/** Does this composer submission create work straight away (rather than save a workflow)? */\nexport const createsWork = (values: Pick<TaskComposerValues, 'assignee' | 'when'>): boolean =>\n values.assignee === 'me' || values.when === 'now' || values.when === 'manual'\n\n/**\n * The create-work request: a plain to-do (a title, no agent) or agent work that starts now. Agent work\n * throws when there is no workspace open.\n */\nexport function composerToWorkRequest(\n { workflow, values, plan, documentTitles }: TaskRequestContext,\n workspaceId: string | undefined\n): CreateWorkRequest {\n const common = {\n description: values.description.trim(),\n due_at: values.dueAt ? localInputToIso(values.dueAt) : null,\n parent_conversation_ext_id: values.parentTaskId || null,\n shared: values.shared,\n }\n // A task for me is a plain to-do: a title, no prompt and no agent (`auth_mode` is required, and only\n // matters for a run).\n if (values.assignee === 'me') {\n return { ...common, title: values.name.trim(), auth_mode: 'run_now_temp' }\n }\n const fields = workflowTaskFields(workflow, values.inputs, values.name, { documentTitles })\n if (isAgenticWorkflow(workflow) && !workspaceId) {\n throw new Error('Open a workspace to run an agent task.')\n }\n return {\n ...common,\n title: fields.name,\n prompt: fields.prompt || null,\n skill_ref: fields.skill_ref,\n ...(fields.skill_inputs ? { skill_inputs: fields.skill_inputs } : {}),\n agent_ext_id: values.agentId || null,\n auth_mode: 'run_now_temp',\n ...(fields.skill_ref === null && fields.prompt && plan ? { plan } : {}),\n }\n}\n\n/**\n * Run now is a plain assistant query that carries `task` options: the thread it starts becomes a task\n * (generating, then open again). The query is the person's own run, so there is no agent and no\n * access tier. The host turns this into a `POST /v1/responses` body.\n */\nexport interface TaskQuery {\n /** The message sent: the prompt, or `/skill-name arguments` for a skill. */\n input: string\n workspaceId: string\n /** Files the run is bound to (the ids under any input's `documents`). */\n docIds: string[]\n /** People @mentioned in the prompt: the server shares the thread with them and notifies them. */\n mentions?: MessageMentionRef[]\n task: TaskOptions\n}\n\n/** A thread to start: a task's query, or (no `task`) a plain conversation. */\nexport type ThreadQuery = Omit<TaskQuery, 'task'> & { task?: TaskOptions }\n\n/** The ids of the files a form's inputs name (an explicit pick, or a resolved scope), without repeats. */\nexport function inputDocumentIds(inputs: WorkflowInputs): string[] {\n const ids = new Set<string>()\n for (const v of Object.values(inputs)) {\n const docs =\n v !== null && typeof v === 'object' ? (v as { documents?: unknown }).documents : null\n if (Array.isArray(docs)) for (const d of docs) if (typeof d === 'string') ids.add(d)\n }\n return [...ids]\n}\n\n/** The query that runs agent work now (a prompt or a skill) as the person asking. Throws without a workspace. */\nexport function composerToTaskQuery(\n { workflow, values, plan, documentTitles }: TaskRequestContext,\n workspaceId: string | undefined\n): TaskQuery {\n if (!workspaceId) throw new Error('Open a workspace to run an agent task.')\n const fields = workflowTaskFields(workflow, values.inputs, values.name, { documentTitles })\n const input = fields.skill_ref\n ? `/${fields.skill_ref}${fields.prompt ? ` ${fields.prompt}` : ''}`\n : fields.prompt\n return {\n input,\n workspaceId,\n docIds: inputDocumentIds(values.inputs),\n task: {\n title: fields.name,\n description: values.description.trim(),\n due_at: values.dueAt ? localInputToIso(values.dueAt) : null,\n parent_conversation_ext_id: values.parentTaskId || null,\n shared: values.shared,\n ...(fields.skill_ref === null && fields.prompt && plan ? { plan } : {}),\n },\n }\n}\n\n/** The fields shared by creating and updating a workflow: the trigger. Others stay `null` on an update. */\nfunction workflowTrigger(values: TaskComposerValues, clearOthers: boolean) {\n const none = clearOthers ? null : undefined\n return {\n rrule: values.when === 'repeat' ? values.rrule.trim() : none,\n run_at: values.when === 'once' ? localInputToIso(values.runAt) : none,\n event_kind: values.when === 'event' ? values.eventKind.trim() : none,\n event_filter: values.when === 'event' ? (values.eventFilter ?? none) : none,\n after_conversation_ext_id: values.when === 'task' ? values.afterTaskId : none,\n // Saving a run-now template creates an on-demand workflow; other triggers clear it.\n on_demand: values.when === 'now' || values.when === 'manual',\n }\n}\n\nconst withoutUndefined = <T extends object>(o: T): T =>\n Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined)) as T\n\n/**\n * The create-workflow request: exactly one trigger (a date, a repeat, an event, or another task being\n * done) and the action it runs. An agent workflow throws when there is no workspace open.\n */\nexport function composerToWorkflowRequest(\n { workflow, values, plan, documentTitles }: TaskRequestContext,\n workspaceId: string | undefined\n): CreateWorkflowRequest {\n const fields = workflowTaskFields(workflow, values.inputs, values.name, { documentTitles })\n // A workflow belongs to a workspace, a reminder included.\n if (!workspaceId) throw new Error('Open a workspace to save a workflow.')\n return withoutUndefined({\n name: fields.name,\n description: values.description.trim(),\n active: true,\n shared: values.shared,\n timezone: values.timezone,\n ...workflowTrigger(values, false),\n ...(fields.action ? { action: fields.action } : {}),\n prompt: fields.prompt,\n skill_ref: fields.skill_ref,\n skill_inputs: fields.skill_inputs,\n agent_ext_id: values.agentId || null,\n auth_mode: authModeFor(values),\n workspace_ext_id: workspaceId,\n // The plan grades every run of a free-instruction workflow (a skill's run is not a goal run).\n ...(fields.skill_ref === null && fields.prompt && plan ? { plan } : {}),\n })\n}\n\n/** What a composer submission asks the host to do. */\nexport type ComposerCreate =\n | { kind: 'work'; body: CreateWorkRequest }\n | { kind: 'query'; query: TaskQuery }\n | { kind: 'workflow'; body: CreateWorkflowRequest }\n\n/**\n * Route a submission: agent work now is an assistant query, a plain to-do or reminder creates work,\n * every other start creates a workflow.\n * `forceWorkflow` is for the workflow dialog, where even a reminder is saved as a workflow.\n */\nexport function taskComposerToCreateRequest(\n ctx: TaskRequestContext,\n workspaceId: string | undefined,\n forceWorkflow = false\n): ComposerCreate {\n if (forceWorkflow || ctx.workflow.documentAction || !createsWork(ctx.values)) {\n return { kind: 'workflow', body: composerToWorkflowRequest(ctx, workspaceId) }\n }\n // A to-do for me, or a reminder, is a plain task; agent work run now is an assistant query.\n return ctx.values.assignee === 'me' || !isAgenticWorkflow(ctx.workflow)\n ? { kind: 'work', body: composerToWorkRequest(ctx, workspaceId) }\n : { kind: 'query', query: composerToTaskQuery(ctx, workspaceId) }\n}\n\n/**\n * The patch for editing a task (`PATCH /v1/conversation/{id}`): title, description, due date, parent\n * (`null` detaches) and sharing. What the agent was told to do stays as created.\n */\nexport function taskComposerToUpdateRequest({\n values,\n plan,\n}: TaskRequestContext): UpdateConversationRequest {\n return {\n title: values.name.trim(),\n description: values.description.trim(),\n due_at: values.dueAt ? localInputToIso(values.dueAt) : null,\n shared: values.shared,\n parent_conversation_ext_id: values.parentTaskId || null,\n ...(plan !== undefined ? { plan } : {}),\n }\n}\n\n/** The patch for editing a workflow: name, trigger (the other triggers are cleared) and action. */\nexport function composerToWorkflowUpdate({\n workflow,\n values,\n plan,\n documentTitles,\n}: TaskRequestContext): UpdateWorkflowRequest {\n const fields = workflowTaskFields(workflow, values.inputs, values.name, { documentTitles })\n return {\n name: fields.name,\n description: values.description.trim(),\n shared: values.shared,\n timezone: values.timezone,\n ...workflowTrigger(values, true),\n action: fields.action ?? null,\n prompt: fields.prompt,\n skill_ref: fields.skill_ref,\n skill_inputs: fields.skill_inputs,\n agent_ext_id: values.agentId || null,\n auth_mode: authModeFor(values),\n // Omission preserves the plan; explicit null removes a stored free-instruction plan.\n ...(fields.skill_ref === null && fields.prompt && plan !== undefined ? { plan } : {}),\n }\n}\n\n/** Does the task need the owner to authorise workspace access before it can run? */\nexport const taskNeedsAccess = (\n task: Pick<ConversationResponse, 'pending_auth_request_id'>\n): boolean => !!task.pending_auth_request_id\n\nexport interface TaskValuesWorkflows {\n /** The workflow that stands for an instruction task (its first input is `instruction`). */\n customWorkflowId: string\n /** The workflow that stands for a reminder (its first input is `message`). */\n reminderWorkflowId: string\n /** The definitions a saved skill can be matched to (by `skill`), to restore a skill workflow's form. */\n definitions?: WorkflowDefinition[]\n}\n\n/** What an existing task (a conversation with a status) looks like when reopened in the composer. */\nexport function taskToComposerValues(\n task: ConversationResponse,\n workflows: TaskValuesWorkflows\n): Partial<TaskComposerValues> {\n const forMe = !task.agent_ext_id && !task.skill_ref && !task.has_agent_action\n return {\n assignee: forMe ? 'me' : 'agent',\n workflowId: forMe ? workflows.reminderWorkflowId : workflows.customWorkflowId,\n inputs: {},\n when: 'now',\n parentTaskId: task.parent_conversation_ext_id ?? '',\n shared: task.is_shared ?? true,\n description: task.description ?? '',\n dueAt: isoToLocalInput(task.due_at),\n agentId: task.agent_ext_id ?? '',\n name: task.title ?? '',\n }\n}\n\n/** Which start a saved workflow has. */\nexport function workflowWhen(workflow: WorkflowResponse): TaskWhen {\n if (workflow.on_demand) return 'now'\n if (workflow.after_conversation_ext_id) return 'task'\n if (workflow.event_kind) return 'event'\n if (workflow.rrule) return 'repeat'\n return workflow.run_at ? 'once' : 'now'\n}\n\n/** What an existing workflow looks like when reopened in the workflow dialog. */\nexport function workflowToComposerValues(\n workflow: WorkflowResponse,\n workflows: TaskValuesWorkflows\n): Partial<TaskComposerValues> {\n const reminder = !workflow.prompt && !workflow.skill_ref\n const skill = workflow.skill_ref\n ? workflows.definitions?.find((d) => d.skill === workflow.skill_ref)\n : undefined\n const base = {\n assignee: 'agent' as const,\n when: workflowWhen(workflow),\n runAt: isoToLocalInput(workflow.run_at),\n rrule: workflow.rrule ?? '',\n timezone: workflow.timezone,\n eventKind: workflow.event_kind ?? 'mention',\n eventFilter: (workflow.event_filter ?? null) as TaskComposerValues['eventFilter'],\n afterTaskId: workflow.after_conversation_ext_id ?? '',\n shared: workflow.shared,\n description: workflow.description ?? '',\n agentId: workflow.agent_ext_id ?? '',\n name: workflow.name,\n access:\n workflow.auth_mode === 'scheduled_permanent'\n ? ('standing' as const)\n : ('ask_each_run' as const),\n }\n if (workflow.action) {\n const definition = workflows.definitions?.find(\n (d) => d.documentAction === workflow.action?.type\n )\n return {\n ...base,\n workflowId: definition?.id ?? workflows.customWorkflowId,\n inputs: {\n scope: {\n folders: [],\n labels: workflow.action.documents?.label_ext_ids ?? [],\n documents: workflow.action.documents?.doc_ext_ids ?? [],\n },\n output: workflow.action.tag_ext_ids?.[0] ?? '',\n overwrite: workflow.action.overwrite ?? false,\n latest: workflow.action.documents?.latest ?? false,\n },\n }\n }\n if (skill) {\n return {\n ...base,\n workflowId: skill.id,\n inputs: (workflow.skill_inputs as WorkflowInputs | null | undefined) ?? {\n args: workflow.prompt,\n },\n }\n }\n return reminder\n ? { ...base, workflowId: workflows.reminderWorkflowId, inputs: { message: workflow.name } }\n : {\n ...base,\n // A name made from the instruction follows it when the instruction is edited.\n name: workflow.name === firstWords(workflow.prompt ?? '') ? '' : workflow.name,\n workflowId: workflows.customWorkflowId,\n inputs: {\n ...((workflow.skill_inputs as WorkflowInputs | null | undefined) ?? {}),\n instruction: workflow.prompt,\n },\n }\n}\n\n/** What the New task dialog collects: a prompt, who sees it, and optional task details. */\nexport interface NewThreadValues {\n /** What to ask or get done: the first message, which the assistant answers. The title is made from it. */\n prompt: string\n /** A name instead of the generated one. Optional. */\n title: string\n /** Shared with the workspace's members (the default), or private to its creator. */\n shared: boolean\n /** datetime-local value; empty = none. A task field. */\n dueAt: string\n /** The task this is a sub-task of (`con-…`); `''` = none. A task field. */\n parentId: string\n /** Whether the assistant starts on the prompt now. Off: it is a to-do, tracked and not run. */\n assistant: boolean\n}\n\nexport const EMPTY_NEW_THREAD: NewThreadValues = {\n prompt: '',\n title: '',\n shared: false,\n dueAt: '',\n parentId: '',\n assistant: true,\n}\n\n/** Is any task detail filled in (the dialog opens its details when one is preset)? */\nexport const hasTaskFields = (v: NewThreadValues): boolean => Boolean(v.dueAt || v.parentId)\n\n/** A new task: the prompt as the first message (the assistant answers it) and the task's options. */\nexport interface NewThreadRequest {\n input: string\n shared: boolean\n task: TaskOptions\n /** False: nothing is asked of the assistant: the host adds a plain to-do from `todo`. */\n startAssistant: boolean\n /** The to-do to add when `startAssistant` is false: a title and the rest of what the person wrote. */\n todo?: { title: string; description: string }\n}\n\n/** The first line of a prompt, kept to a title's length. */\nexport function titleFromPrompt(prompt: string, max = 80): string {\n const first = prompt.trim().split('\\n')[0].trim()\n return first.length > max ? `${first.slice(0, max - 1).trimEnd()}…` : first\n}\n\n/**\n * The request for a New task submission. Every ask is a task, so the options always ride along; the due\n * date and parent are only set when filled in. The title is only sent when the person wrote one;\n * otherwise the server names the task from the prompt. With the assistant switched off nothing is run: it\n * is a to-do.\n */\nexport function newThreadToRequest(values: NewThreadValues): NewThreadRequest {\n const input = values.prompt.trim()\n const title = values.title.trim()\n const task: TaskOptions = {\n ...(title ? { title } : {}),\n due_at: values.dueAt ? localInputToIso(values.dueAt) : null,\n parent_conversation_ext_id: values.parentId || null,\n shared: values.shared,\n }\n if (!values.assistant) {\n const name = title || titleFromPrompt(input)\n return {\n input,\n shared: values.shared,\n task,\n startAssistant: false,\n todo: { title: name, description: input === name ? '' : input },\n }\n }\n return { input, shared: values.shared, task, startAssistant: true }\n}\n"]}
1
+ {"version":3,"sources":["../src/agents/workflows/skillPack.ts","../src/agents/workflows/catalogue/seed.tsx","../src/agents/workflows/catalogue/registry.ts","../src/agents/workflows/catalogue/workflow-usage.ts","../src/agents/workflows/catalogue/annotation-name.ts","../src/agents/tasks/taskRequest.ts"],"names":["fieldsFromFrontmatter","assistantCopy","Telescope","GanttChartSquare","NotebookPen","FileText","Languages","Clock","Image","Library","Sparkles","jsx","WORD_WORKFLOWS","workflowsForHost","cache","useSyncExternalSt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,CAAC,OAAO,SAAA,EAAW;AACrB,IAAA,MAAM,IAAA,GAAO,KAAA,IAAS,eAAA,CAAgB,KAAK,CAAA;AAC3C,IAAA,OAAO;AAAA,MACL,KAAA;AAAA,MACA,QAAQ,MAAA,CAAO,MAAA;AAAA,MACf,IAAA;AAAA,MACA,cAAA,EAAgB,KAAA;AAAA,MAChB,IAAA,EAAM,EAAE,KAAA,EAAO,IAAA,EAAM,aAAa,KAAA,KAAU,IAAA,GAAO,KAAK,KAAA;AAAM,KAChE;AAAA,EACF;AACA,EAAA,OAAO,EAAE,KAAA,EAAO,MAAA,EAAQ,OAAO,MAAA,EAAQ,IAAA,EAAM,gBAAgB,IAAA,EAAK;AACpE","file":"chunk-QFSFTO7I.cjs","sourcesContent":["/**\n * A host's skill pack (`defineSkillPack`, `@arbidocs/react`) as the kit's workflows: prompt skills\n * like the built-ins, so the `/` menu, the skill form and the launch treat them the same. Each\n * keeps its pack's id and label, which the menu uses as its group.\n */\nimport type { DefinedSkillPack } from '@arbidocs/react'\nimport type { WorkflowDefinition, WorkflowField } from './types'\nimport { fieldsFromFrontmatter } from './workflow'\n\n/** The free-text field every pack skill opens with: what `/slug some text` fills in. */\nexport const SKILL_PACK_REQUEST_FIELD: WorkflowField = {\n name: 'request',\n type: 'longtext',\n label: 'Request',\n placeholder: 'Anything to add (optional)',\n}\n\n/** A pack skill as a workflow, with the pack it came from. */\nexport interface SkillPackWorkflow extends WorkflowDefinition {\n pack: { id: string; label?: string }\n}\n\n/** True for a workflow that came from a host's skill pack. */\nexport const isSkillPackWorkflow = (workflow: WorkflowDefinition): workflow is SkillPackWorkflow =>\n 'pack' in workflow && typeof (workflow as SkillPackWorkflow).pack?.id === 'string'\n\n/** Categories in order, then the skills without one (the pack's own section) last. */\nconst byCategory = (a: WorkflowDefinition, b: WorkflowDefinition): number =>\n a.category === b.category\n ? 0\n : a.category === undefined\n ? 1\n : b.category === undefined\n ? -1\n : a.category.localeCompare(b.category)\n\nconst cache = new WeakMap<DefinedSkillPack, SkillPackWorkflow[]>()\n\n/**\n * The pack's skills as prompt workflows, in menu order (by category, those without one last, then\n * title). The prompt is the skill's instructions, then any input its text does not already place\n * (`- Label: {{name}}`), then the request. Stable per pack object, so lists built from it memoise.\n */\nexport function skillPackWorkflows(pack: DefinedSkillPack): SkillPackWorkflow[] {\n const cached = cache.get(pack)\n if (cached) return cached\n const workflows = pack.skills\n .map((skill): SkillPackWorkflow => {\n const own = fieldsFromFrontmatter(skill.inputs)\n const placed = (name: string) =>\n new RegExp(`\\\\{\\\\{\\\\s*${name}\\\\s*\\\\}\\\\}`).test(skill.instructions)\n const listed = own.filter((f) => f.name !== 'request' && !placed(f.name))\n const request = own.find((f) => f.name === 'request') ?? SKILL_PACK_REQUEST_FIELD\n const promptTemplate = [\n skill.instructions,\n listed.length > 0 &&\n `## Inputs\\n${listed.map((f) => `- ${f.label}: {{${f.name}}}`).join('\\n')}`,\n !placed('request') && '{{request}}',\n ]\n .filter(Boolean)\n .join('\\n\\n')\n return {\n id: skill.slug,\n title: skill.title,\n description: skill.description,\n // The skill icon unless the host names its own (drawn by `host.workflows.renderIcon`).\n icon: skill.icon ?? 'skill',\n category: skill.category,\n builtin: true,\n inputs: [request, ...own.filter((f) => f.name !== 'request')],\n run: { kind: 'prompt', promptTemplate },\n landing: 'chat',\n pack: { id: pack.id, label: pack.label },\n }\n })\n .sort((a, b) => byCategory(a, b) || a.title.localeCompare(b.title))\n cache.set(pack, workflows)\n return workflows\n}\n","/**\n * The seeded workflows, as data. This is the client-side registry the dashboard tiles, the slash\n * menu, tasks and agents all read; it has exactly the shape of a skill with declared `inputs`\n * (see docs/design/workflows.md), so each entry can move into a SKILL.md document later with no\n * UI change. It is the default catalogue: a host offers it as is, a slice of it, or its own.\n *\n * Prompt wording avoids phrasings that put the agent in documents-only mode (\"based on these\n * documents\", \"in the documents\"), which would switch the web off.\n */\n\nimport type { ReactNode } from 'react'\nimport {\n Clock,\n FileText,\n GanttChartSquare,\n Image,\n Library,\n Languages,\n NotebookPen,\n Sparkles,\n Telescope,\n} from 'lucide-react'\nimport { assistantCopy, type AssistantCopy } from '@arbidocs/react/shell'\nimport type { WorkflowDefinition } from '../types'\n\n/** ARBI's own phrases: the seeded text below. */\nconst ARBI = assistantCopy()\n\n/** The timeline instruction. The scope picks the files; this never names a folder or label. */\nexport const TIMELINE_PROMPT =\n 'Build a timeline from the selected files. Record every dated event ' +\n 'as its own fact: put the date in the fact’s date field at exactly the ' +\n 'precision the file gives, cite the file you took it from, and label them all ' +\n '“Main Events”. Then show me the chronology, oldest first.'\n\nexport const DEEP_RESEARCH_ID = 'deep-research'\nexport const TIMELINE_ID = 'timeline'\nexport const SUMMARISE_ID = 'summarise'\nexport const TRANSLATE_ID = 'translate'\nexport const CHRONOLOGY_ID = 'chronology'\nexport const GENERATE_IMAGE_ID = 'generate-image'\nexport const ANNOTATE_ID = 'annotate'\n/** Task-only entries: a free instruction, and a plain reminder. */\nexport const CUSTOM_TASK_ID = '__custom__'\nexport const REMIND_TASK_ID = '__remind__'\n\n/** Tier C: workflows (skills) launch an agent run; the inputs are its parameters. */\nexport const DEEP_RESEARCH: WorkflowDefinition = {\n id: DEEP_RESEARCH_ID,\n builtin: true,\n title: 'Deep research',\n description: ARBI.deepResearch.description,\n details: ARBI.deepResearch.details,\n icon: 'research',\n startLabel: 'Research',\n inputs: [\n {\n name: 'topic',\n type: 'text',\n label: 'What do you want to research about?',\n placeholder: 'e.g. Q3 runway, competitive landscape, open risks in our contracts…',\n required: true,\n },\n {\n name: 'web',\n type: 'boolean',\n label: 'Search the web',\n default: true,\n // With the web off the wording changes rather than dropping a clause: the agent is told to\n // stay in the workspace and say when the files fall short, so a thin answer reads as a gap\n // in the files rather than as research quietly skipped.\n trueText:\n 'Search my workspace files first, then the web for what they don’t cover: read the best sources and cite them. Cite file sources and web sources separately, and tell me if you could not reach the web.',\n falseText:\n 'Use only my workspace files — do not search the web. Read the relevant files and cite them. Tell me plainly where the files do not answer the question.',\n },\n ],\n run: { kind: 'prompt', promptTemplate: 'Research: {{topic}}. {{web}}' },\n landing: 'chat',\n schedulable: true,\n}\n\nexport const TIMELINE: WorkflowDefinition = {\n id: TIMELINE_ID,\n builtin: true,\n title: 'Build a timeline',\n description: 'Turn the dates in your files into facts you can see on a timeline',\n details:\n 'Choose which files to include — folders, labels, or leave it empty to use every file in the workspace.',\n icon: 'timeline',\n startLabel: 'Build timeline',\n requiresFiles: true,\n inputs: [\n { name: 'scope', type: 'scope', label: 'Files' },\n {\n name: 'instruction',\n type: 'longtext',\n label: 'What the timeline should cover',\n default: TIMELINE_PROMPT,\n required: true,\n advanced: true,\n },\n ],\n run: { kind: 'prompt', promptTemplate: '{{instruction}}' },\n landing: 'chat',\n schedulable: true,\n}\n\n/**\n * The former prompt templates, now ordinary workflows. The wording is the old template wording,\n * word for word (the unit tests pin it); the file name(s) the old forms put in the prompt come from\n * the `documents` field, quoted by `composeWorkflowPrompt`.\n */\nexport const SUMMARISE: WorkflowDefinition = {\n id: SUMMARISE_ID,\n builtin: true,\n title: 'Summarise',\n description: 'Create a customised summary of any document',\n icon: 'summarise',\n startLabel: 'Summarise',\n requiresFiles: true,\n // The stronger model the old template switched to for this run.\n model: 'Wise',\n inputs: [\n {\n name: 'document',\n type: 'documents',\n label: 'Document',\n required: true,\n context: 'documents',\n },\n {\n name: 'length',\n type: 'select',\n label: 'Summary length',\n default: 'standard',\n options: [\n {\n value: 'brief',\n label: 'Brief (1 paragraph)',\n text: 'provide a brief summary in a single paragraph. Focus on the core message, key conclusions, and any critical actions or decisions. Keep it concise — no more than 5-6 sentences.',\n },\n {\n value: 'standard',\n label: 'Standard',\n text: 'provide a structured summary. Include the following sections using markdown headings:\\n\\n## Overview\\nA short paragraph describing what the document is about, its purpose, and context.\\n\\n## Key Points\\nA bulleted list of the main arguments, findings, or topics covered.\\n\\n## Conclusions & Recommendations\\nAny conclusions drawn, decisions made, or recommended next steps mentioned in the document.\\n\\nKeep each section focused and concise.',\n },\n {\n value: 'detailed',\n label: 'Detailed',\n text: 'provide a thorough and well-structured summary. Include the following sections using markdown headings:\\n\\n## Overview\\nDescribe the document type, purpose, author/source context, and intended audience.\\n\\n## Background & Context\\nSummarise any background information, prior events, or context the document references.\\n\\n## Key Points & Arguments\\nProvide a detailed bulleted breakdown of all major points, arguments, findings, and evidence presented. Group related points under sub-headings where appropriate.\\n\\n## Data & Evidence\\nHighlight any specific data, statistics, figures, dates, or factual claims made in the document.\\n\\n## Conclusions & Recommendations\\nSummarise all conclusions, decisions, action items, or recommended next steps.\\n\\n## Open Questions\\nNote any unresolved issues, ambiguities, or areas that may require further clarification.\\n\\nBe comprehensive — do not omit significant details.',\n },\n ],\n },\n {\n name: 'focus',\n type: 'text',\n label: 'Anything to focus on',\n placeholder: 'e.g. Focus on payment terms and deadlines.',\n },\n ],\n run: {\n kind: 'prompt',\n promptTemplate:\n 'Please read the full text of the document {{document}} and {{length}}\\n\\n{{focus}}',\n },\n landing: 'chat',\n}\n\nexport const TRANSLATE_LANGUAGES = [\n 'English',\n 'Spanish',\n 'French',\n 'German',\n 'Chinese',\n 'Japanese',\n 'Korean',\n 'Russian',\n 'Arabic',\n 'Portuguese',\n 'Italian',\n 'Dutch',\n 'Polish',\n]\n\nexport const TRANSLATE: WorkflowDefinition = {\n id: TRANSLATE_ID,\n builtin: true,\n title: 'Translate',\n description:\n 'A new editable document, translated passage by passage: side by side with the original, or the translation alone',\n icon: 'translate',\n startLabel: 'Translate',\n requiresFiles: true,\n inputs: [\n {\n name: 'document',\n type: 'documents',\n label: 'Document',\n required: true,\n context: 'documents',\n },\n {\n name: 'language',\n type: 'select',\n label: 'Target language',\n default: 'English',\n options: TRANSLATE_LANGUAGES.map((value) => ({ value, label: value })),\n },\n {\n name: 'layout',\n type: 'select',\n label: 'Layout',\n default: 'two-column',\n options: [\n {\n value: 'two-column',\n label: 'Side by side',\n description: 'Original left, translation right',\n text: 'Put the original and the translation side by side.',\n },\n {\n value: 'translation-only',\n label: 'Translation only',\n description: 'Just the translated text',\n text: 'Give only the translation.',\n },\n ],\n },\n ],\n run: {\n kind: 'prompt',\n promptTemplate:\n 'Translate the document {{document}} into {{language}} as a new document. {{layout}}',\n },\n landing: 'chat',\n // Runs as a task or a step of a scheduled workflow: the prompt reaches the agent's translation tool.\n schedulable: true,\n}\n\n/**\n * Chronology stays its own workflow rather than folding into \"Build a timeline\": the timeline\n * WRITES dated facts (with citations and a label) to the workspace and then shows them, while\n * chronology only ANSWERS with a read-only markdown table of the files themselves (title and\n * subject, ordered by date). Different side effects, different unit (events vs documents), so\n * different consent: one is a read, the other a change to the workspace.\n */\nexport const CHRONOLOGY: WorkflowDefinition = {\n id: CHRONOLOGY_ID,\n builtin: true,\n title: 'Chronology',\n description: 'Sort documents by date with title and subject',\n icon: 'chronology',\n startLabel: 'Sort by date',\n requiresFiles: true,\n model: 'Wise',\n inputs: [{ name: 'scope', type: 'scope', label: 'Files', context: 'documents' }],\n run: {\n kind: 'prompt',\n promptTemplate:\n 'Read all available documents and prepare a markdown table ordered by Date, earliest first. Include title and subject columns. Sort each document by its start date; where a document gives only a range or period, put the start date in the Date column and state the range in the subject.',\n },\n landing: 'chat',\n}\n\nexport const IMAGE_ASPECT_RATIOS: { value: string; label: string }[] = [\n { value: '1:1', label: '1:1 — Square' },\n { value: '16:9', label: '16:9 — Widescreen' },\n { value: '9:16', label: '9:16 — Portrait' },\n { value: '4:3', label: '4:3 — Landscape' },\n { value: '3:4', label: '3:4 — Portrait' },\n { value: '3:2', label: '3:2 — Landscape' },\n { value: '2:3', label: '2:3 — Portrait' },\n { value: '5:4', label: '5:4 — Landscape' },\n { value: '4:5', label: '4:5 — Portrait' },\n { value: '21:9', label: '21:9 — Ultrawide' },\n]\n/** The aspect-ratio value that sends no shape at all (the model decides). */\nexport const IMAGE_ASPECT_AUTO = 'auto'\n\n/**\n * Generate image. The prompt is `/image <description>`; the reference images and the aspect ratio\n * are NOT worded into it (the image model does not reliably honour wording): the host sends them\n * as structured tool arguments (`launch-bindings.ts`), exactly as the old modal did.\n */\nexport const GENERATE_IMAGE: WorkflowDefinition = {\n id: GENERATE_IMAGE_ID,\n builtin: true,\n title: 'Generate image',\n description: 'Create or edit an image from a text prompt',\n icon: 'image',\n startLabel: 'Generate',\n inputs: [\n {\n name: 'prompt',\n type: 'longtext',\n label: 'What do you want to generate?',\n placeholder: 'A red bicycle on a beach at sunset...',\n required: true,\n },\n {\n name: 'references',\n type: 'documents',\n label: 'Source images',\n description: 'Pick images to edit or combine. Leave empty to generate from scratch.',\n accept: 'image',\n max: 8,\n context: 'image',\n },\n {\n name: 'aspect_ratio',\n type: 'select',\n label: 'Aspect ratio',\n default: IMAGE_ASPECT_AUTO,\n options: [\n { value: IMAGE_ASPECT_AUTO, label: 'Auto (model default)' },\n ...IMAGE_ASPECT_RATIOS,\n ],\n },\n ],\n run: { kind: 'prompt', promptTemplate: '/image {{prompt}}' },\n landing: 'chat',\n}\n\n/** Tier B: a bounded operation launcher (not a skill, not an agent run). */\nexport const ANNOTATE: WorkflowDefinition = {\n id: ANNOTATE_ID,\n title: 'AI annotation',\n description: 'Ask one question, get the answer for every file as a column',\n details: ARBI.annotate.details,\n icon: 'annotate',\n startLabel: 'Annotate',\n requiresFiles: true,\n inputs: [\n {\n name: 'description',\n type: 'longtext',\n label: 'Description',\n placeholder: ARBI.annotate.placeholder,\n required: true,\n },\n { name: 'name', type: 'text', label: 'Name' },\n { name: 'scope', type: 'scope', label: 'Files' },\n ],\n run: { kind: 'operation' },\n landing: 'files',\n options: { agent: false },\n}\n\n/**\n * The built-in SKILLS: same shape as a marketplace skill, listed in the same list and the same\n * slash menu (one `/slug` path), pinned and not deletable. A same-slug skill of the user's own\n * shadows the built-in (the backend's own-shadows-global rule), which is how a built-in is forked\n * and customised. Delete this list once the backend ships them as real marketplace SKILL.md\n * documents (docs/design/workflows.md).\n */\nexport const BUILTIN_SKILLS: WorkflowDefinition[] = [\n DEEP_RESEARCH,\n SUMMARISE,\n TRANSLATE,\n TIMELINE,\n CHRONOLOGY,\n GENERATE_IMAGE,\n]\n\n/**\n * The dashboard's Start band is a curated VIEW over the skill list, not a code path: pin and order\n * are data. Ids resolve against the live list, so a shadowing skill replaces its tile. Tier B\n * operation launchers (annotation) sit in the band too; tier A actions are added by the host.\n */\nexport const DASHBOARD_PINNED: string[] = [DEEP_RESEARCH_ID, TIMELINE_ID]\nexport const DASHBOARD_OPERATIONS: WorkflowDefinition[] = [ANNOTATE]\n\n/** Tasks can also run a free instruction or just remind. */\nexport const CUSTOM_TASK: WorkflowDefinition = {\n id: CUSTOM_TASK_ID,\n generic: true,\n title: 'My own instruction',\n description: 'Tell the agent what to do, in your own words.',\n inputs: [\n {\n name: 'instruction',\n type: 'longtext',\n label: 'Instruction',\n placeholder: 'Summarise what is new in my workspace and message me the result.',\n required: true,\n },\n ],\n run: { kind: 'prompt', promptTemplate: '{{instruction}}' },\n landing: 'chat',\n schedulable: true,\n}\n\nexport const REMIND_TASK: WorkflowDefinition = {\n id: REMIND_TASK_ID,\n generic: true,\n title: 'Remind me',\n description: 'Send me a notification, no agent work.',\n inputs: [\n {\n name: 'message',\n type: 'text',\n label: 'Reminder',\n placeholder: 'Review the weekly numbers',\n required: true,\n },\n ],\n run: { kind: 'prompt', promptTemplate: '{{message}}' },\n landing: 'chat',\n schedulable: true,\n options: { agent: false },\n}\n\nconst ICONS: Record<string, typeof Telescope> = {\n research: Telescope,\n timeline: GanttChartSquare,\n annotate: NotebookPen,\n summarise: FileText,\n translate: Languages,\n chronology: Clock,\n image: Image,\n library: Library,\n /** Skills that bring no icon of their own (the user's and the marketplace's). */\n skill: Sparkles,\n}\n\n/** Maps a workflow/option icon key to its mark. Unknown keys render nothing. */\nexport function renderWorkflowIcon(key: string): ReactNode {\n const Icon = ICONS[key]\n return Icon ? <Icon className=\"size-5\" /> : null\n}\n\n/**\n * The seeded workflows in the host's words (`useAssistantCopy()`): a seeded entry that names the\n * assistant takes the copy's phrases; anything else (a skill that shadows it, the host's own) is\n * left as it is. With ARBI's name the list is returned unchanged.\n */\nexport function nameBuiltinWorkflows(\n workflows: ReadonlyArray<WorkflowDefinition>,\n copy: AssistantCopy\n): WorkflowDefinition[] {\n if (copy.name === ARBI.name) return [...workflows]\n return workflows.map((w) =>\n w === DEEP_RESEARCH\n ? { ...w, ...copy.deepResearch }\n : w === ANNOTATE\n ? {\n ...w,\n details: copy.annotate.details,\n inputs: w.inputs.map((field) =>\n field.name === 'description'\n ? { ...field, placeholder: copy.annotate.placeholder }\n : field\n ),\n }\n : w\n )\n}\n","/** The default catalogue as one registry, and the web host's slice of it. */\nimport type { WorkflowDefinition } from '../types'\nimport { workflowsForHost } from '../workflow'\nimport { BUILTIN_SKILLS } from './seed'\nimport { WORD_WORKFLOWS } from './word-workflows'\n\n/** Everything the registry holds; each host offers its own slice (`workflowsForHost`). */\nexport const WORKFLOW_REGISTRY: WorkflowDefinition[] = [...BUILTIN_SKILLS, ...WORD_WORKFLOWS]\n\n/** The web app's slice of the registry: the built-ins every skill list starts from. */\nexport const WEB_WORKFLOWS: WorkflowDefinition[] = workflowsForHost(WORKFLOW_REGISTRY, 'web')\n","/**\n * A cheap local usage counter for workflows: how often and how recently each one was started on\n * this device. It only orders the Start section (recent first, then name); nothing is sent to a\n * server and nothing breaks when storage is unavailable.\n */\n\nimport { useSyncExternalStore } from 'react'\n\nconst STORAGE_KEY = 'arbi.workflow-usage.v1'\n\nexport interface WorkflowUsageEntry {\n count: number\n /** Epoch ms of the latest start. */\n last: number\n}\n\nexport type WorkflowUsage = Record<string, WorkflowUsageEntry>\n\nconst EMPTY: WorkflowUsage = {}\nlet cache: WorkflowUsage | null = null\nconst listeners = new Set<() => void>()\n\nfunction read(): WorkflowUsage {\n if (cache) return cache\n try {\n const raw = window.localStorage.getItem(STORAGE_KEY)\n const parsed = raw ? (JSON.parse(raw) as unknown) : null\n cache = parsed && typeof parsed === 'object' ? (parsed as WorkflowUsage) : EMPTY\n } catch {\n cache = EMPTY\n }\n return cache\n}\n\n/** Count one start of `workflowId` now. */\nexport function recordWorkflowUse(workflowId: string, now: number = Date.now()): void {\n const prev = read()[workflowId]\n cache = { ...read(), [workflowId]: { count: (prev?.count ?? 0) + 1, last: now } }\n try {\n window.localStorage.setItem(STORAGE_KEY, JSON.stringify(cache))\n } catch {\n // Storage full or blocked: the in-memory counter still orders this session.\n }\n listeners.forEach((l) => l())\n}\n\nexport function useWorkflowUsage(): WorkflowUsage {\n return useSyncExternalStore(\n (listener) => {\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n read,\n () => EMPTY\n )\n}\n\n/** Most recently used first; never-used ones follow, by title. Stable and pure. */\nexport function sortByRecentUse<T extends { id: string; title: string }>(\n items: T[],\n usage: WorkflowUsage\n): T[] {\n return [...items].sort((a, b) => {\n const la = usage[a.id]?.last ?? 0\n const lb = usage[b.id]?.last ?? 0\n if (la !== lb) return lb - la\n return a.title.localeCompare(b.title)\n })\n}\n\n/** Test seam: forget the cached value (and storage). */\nexport function resetWorkflowUsage(): void {\n cache = null\n try {\n window.localStorage.removeItem(STORAGE_KEY)\n } catch {\n // ignore\n }\n listeners.forEach((l) => l())\n}\n","/**\n * Names an annotation's column from the question it asks, for when the user\n * leaves the name blank.\n *\n * Deliberately mechanical rather than clever: there is no naming endpoint to\n * ask, so the rule has to be one the user can predict. The dialog shows the\n * result in the name field's placeholder before anything runs, so the column's\n * title is never a surprise — and typing over it always wins.\n */\n\n/** Question words that would otherwise head the column: \"What currency…\" → \"Currency…\". */\nconst LEADING_INTERROGATIVE =\n /^(what(?:'s)?|which|who(?:se|m)?|when|where|why|how|is|are|was|were|does|do|did|can|could|should|would|will|has|have)\\s+/i\n\n/** Words kept from the question — enough to tell two columns apart, short enough to head one. */\nconst MAX_WORDS = 4\nconst MAX_CHARS = 40\n\nexport function deriveAnnotationName(description: string): string {\n const cleaned = description\n .trim()\n .replace(/\\s+/g, ' ')\n .replace(/[?.!,;:]+$/, '')\n if (!cleaned) return ''\n\n // Drop the interrogative only when something survives it — \"What?\" alone\n // should still name a column rather than nothing.\n const withoutLead = cleaned.replace(LEADING_INTERROGATIVE, '')\n const source = withoutLead.trim() || cleaned\n\n let name = source.split(' ').slice(0, MAX_WORDS).join(' ')\n if (name.length > MAX_CHARS) name = name.slice(0, MAX_CHARS).trimEnd()\n\n return name.charAt(0).toUpperCase() + name.slice(1)\n}\n","/**\n * TaskComposer values to API requests (and back): the pure mapping every host would write the same\n * way. No SDK call is made here; hand the result to the hooks from `@arbidocs/react`.\n *\n * \"Now\" (or a plain to-do) creates work: a conversation with a status (`useCreateWork`). Any other\n * start (a date, a repeat, an event, after another task) saves a workflow (`useCreateWorkflow`) that\n * creates the work when it fires.\n */\nimport type { components } from '@arbidocs/client'\nimport { composeWorkflowPrompt, type WorkflowComposeContext } from '../workflows/workflow'\nimport type { WorkflowDefinition, WorkflowInputs } from '../workflows/types'\nimport type { TaskComposerValues, TaskWhen } from './taskComposerTypes'\nimport type { MessageMentionRef } from '@arbidocs/react/shell'\n\ntype Schemas = components['schemas']\ntype ConversationResponse = Schemas['ConversationResponse']\ntype CreateWorkRequest = Schemas['CreateWorkRequest']\ntype CreateWorkflowRequest = Schemas['CreateWorkflowRequest']\ntype TaskPlan = Schemas['TaskPlan']\ntype TaskOptions = Schemas['TaskOptions']\ntype UpdateConversationRequest = Schemas['UpdateConversationRequest']\ntype UpdateWorkflowRequest = Schemas['UpdateWorkflowRequest']\ntype WorkflowResponse = Schemas['WorkflowResponse']\n\n/** The authorization tier of a run (the same three values for work and for workflows). */\nexport type TaskAuthMode = CreateWorkRequest['auth_mode']\n\n/**\n * The plain-language access choice becomes the backend authorisation tier: run-now work is\n * authorised for that one run, a workflow either keeps standing access or asks each run.\n */\nexport function authModeFor(values: Pick<TaskComposerValues, 'when' | 'access'>): TaskAuthMode {\n if (values.when === 'now' || values.when === 'manual') return 'run_now_temp'\n return values.access === 'standing' ? 'scheduled_permanent' : 'scheduled_require_auth'\n}\n\n/** `datetime-local` value (no zone) to an ISO instant. Throws on an empty or invalid value. */\nexport function localInputToIso(local: string): string {\n const d = new Date(local)\n if (!local || Number.isNaN(d.getTime())) throw new Error('Pick a valid date and time.')\n return d.toISOString()\n}\n\n/** An ISO instant to the `datetime-local` value the composer edits; empty for none or invalid. */\nexport function isoToLocalInput(iso: string | null | undefined): string {\n if (!iso) return ''\n const d = new Date(iso)\n if (Number.isNaN(d.getTime())) return ''\n return new Date(d.getTime() - d.getTimezoneOffset() * 60000).toISOString().slice(0, 16)\n}\n\nexport interface WorkflowTaskFields {\n /** The title of the work or the name of the workflow. */\n name: string\n action?: Schemas['DocumentAutomationAction']\n prompt: string\n skill_ref: string | null\n /** The skill's saved inputs (only for a skill). */\n skill_inputs: WorkflowInputs | null\n}\n\n/** How many words of an instruction a derived name keeps. */\nexport const DERIVED_NAME_WORDS = 6\n\n/** The first `count` words of a text, with an ellipsis when there is more; empty for blank text. */\nexport function firstWords(text: string, count = DERIVED_NAME_WORDS): string {\n const words = text.trim().split(/\\s+/).filter(Boolean)\n if (words.length <= count) return words.join(' ')\n return `${words.slice(0, count).join(' ')}…`\n}\n\n/**\n * The name a workflow (or task) gets when its owner types none: the template's title or, for a template\n * that is a free-text instruction or reminder (its form is just an `instruction` or `message`), the\n * first few words of what was written, falling back to the title while it is still blank.\n */\nexport function deriveWorkflowName(workflow: WorkflowDefinition, inputs: WorkflowInputs): string {\n for (const field of ['instruction', 'message']) {\n if (workflow.inputs.some((i) => i.name === field)) {\n const written = inputs[field]\n return (typeof written === 'string' && firstWords(written)) || workflow.title\n }\n }\n return workflow.title\n}\n\n/**\n * How a workflow definition becomes an action:\n * - `options.agent === false` is a reminder: the composed text is the title and there is no prompt or\n * skill (the backend makes a to-do and notifies the owner);\n * - a definition with a `skill` runs that skill, its `args` input being the arguments;\n * - anything else is an agent prompt, the composed workflow prompt.\n * `name` (typed by the user) wins over the derived one (see {@link deriveWorkflowName}).\n */\n/** Does any input name files (an explicit pick, or a resolved scope)? Those bind the run. */\nconst hasDocumentInputs = (inputs: WorkflowInputs): boolean =>\n Object.values(inputs).some(\n (v) =>\n v !== null &&\n typeof v === 'object' &&\n Array.isArray((v as { documents?: unknown }).documents) &&\n ((v as { documents: unknown[] }).documents.length ?? 0) > 0\n )\n\nexport function workflowTaskFields(\n workflow: WorkflowDefinition,\n inputs: WorkflowInputs,\n name?: string,\n context?: WorkflowComposeContext\n): WorkflowTaskFields {\n if (workflow.documentAction) {\n const scope =\n inputs.scope && typeof inputs.scope === 'object' ? inputs.scope : { labels: [], folders: [] }\n return {\n name: name?.trim() || workflow.title,\n prompt: '',\n skill_ref: null,\n skill_inputs: inputs,\n action: {\n type: workflow.documentAction,\n documents: {\n doc_ext_ids: scope.documents ?? [],\n label_ext_ids: scope.labels ?? [],\n latest: inputs.latest === true,\n },\n tag_ext_ids: typeof inputs.output === 'string' && inputs.output ? [inputs.output] : [],\n overwrite: inputs.overwrite === true,\n },\n }\n }\n for (const value of Object.values(inputs)) {\n if (!value || typeof value !== 'object') continue\n const scope = value as { documents?: unknown[]; folders?: unknown[]; labels?: unknown[] }\n if (\n Array.isArray(scope.documents) &&\n !scope.documents.length &&\n ((scope.folders?.length ?? 0) > 0 || (scope.labels?.length ?? 0) > 0)\n ) {\n throw new Error(\n 'The selected file scope has no documents. Choose a scope containing files before running.'\n )\n }\n }\n const typed = name?.trim()\n if (workflow.options?.agent === false) {\n const message = composeWorkflowPrompt(workflow, inputs, context)\n return { name: typed || message, prompt: '', skill_ref: null, skill_inputs: null }\n }\n const derived = typed || deriveWorkflowName(workflow, inputs)\n if (workflow.skill) {\n return {\n name: derived,\n prompt: typeof inputs.args === 'string' ? inputs.args.trim() : '',\n skill_ref: workflow.skill,\n skill_inputs: inputs,\n }\n }\n return {\n name: derived,\n prompt: composeWorkflowPrompt(workflow, inputs, context),\n skill_ref: null,\n // The files a run is bound to travel in the saved inputs, whatever the template: the server binds\n // the run to the ids listed under any input's `documents`.\n skill_inputs: hasDocumentInputs(inputs) ? inputs : null,\n }\n}\n\n/** Does this workflow need a workspace to run (everything except a plain reminder)? */\nexport const isAgenticWorkflow = (workflow: WorkflowDefinition): boolean =>\n workflow.options?.agent !== false\n\nexport interface TaskRequestContext {\n /** File names for the prompt's wording (\"the document <name>\"), by file id. */\n documentTitles?: Record<string, string>\n workflow: WorkflowDefinition\n values: TaskComposerValues\n /** The goal checklist drafted for agent work, if any. */\n plan?: TaskPlan | null\n}\n\n/** Does this composer submission create work straight away (rather than save a workflow)? */\nexport const createsWork = (values: Pick<TaskComposerValues, 'assignee' | 'when'>): boolean =>\n values.assignee === 'me' || values.when === 'now' || values.when === 'manual'\n\n/**\n * The create-work request: a plain to-do (a title, no agent) or agent work that starts now. Agent work\n * throws when there is no workspace open.\n */\nexport function composerToWorkRequest(\n { workflow, values, plan, documentTitles }: TaskRequestContext,\n workspaceId: string | undefined\n): CreateWorkRequest {\n const common = {\n description: values.description.trim(),\n due_at: values.dueAt ? localInputToIso(values.dueAt) : null,\n parent_conversation_ext_id: values.parentTaskId || null,\n shared: values.shared,\n }\n // A task for me is a plain to-do: a title, no prompt and no agent (`auth_mode` is required, and only\n // matters for a run).\n if (values.assignee === 'me') {\n return { ...common, title: values.name.trim(), auth_mode: 'run_now_temp' }\n }\n const fields = workflowTaskFields(workflow, values.inputs, values.name, { documentTitles })\n if (isAgenticWorkflow(workflow) && !workspaceId) {\n throw new Error('Open a workspace to run an agent task.')\n }\n return {\n ...common,\n title: fields.name,\n prompt: fields.prompt || null,\n skill_ref: fields.skill_ref,\n ...(fields.skill_inputs ? { skill_inputs: fields.skill_inputs } : {}),\n agent_ext_id: values.agentId || null,\n auth_mode: 'run_now_temp',\n ...(fields.skill_ref === null && fields.prompt && plan ? { plan } : {}),\n }\n}\n\n/**\n * Run now is a plain assistant query that carries `task` options: the thread it starts becomes a task\n * (generating, then open again). The query is the person's own run, so there is no agent and no\n * access tier. The host turns this into a `POST /v1/responses` body.\n */\nexport interface TaskQuery {\n /** The message sent: the prompt, or `/skill-name arguments` for a skill. */\n input: string\n workspaceId: string\n /** Files the run is bound to (the ids under any input's `documents`). */\n docIds: string[]\n /** People @mentioned in the prompt: the server shares the thread with them and notifies them. */\n mentions?: MessageMentionRef[]\n task: TaskOptions\n}\n\n/** A thread to start: a task's query, or (no `task`) a plain conversation. */\nexport type ThreadQuery = Omit<TaskQuery, 'task'> & { task?: TaskOptions }\n\n/** The ids of the files a form's inputs name (an explicit pick, or a resolved scope), without repeats. */\nexport function inputDocumentIds(inputs: WorkflowInputs): string[] {\n const ids = new Set<string>()\n for (const v of Object.values(inputs)) {\n const docs =\n v !== null && typeof v === 'object' ? (v as { documents?: unknown }).documents : null\n if (Array.isArray(docs)) for (const d of docs) if (typeof d === 'string') ids.add(d)\n }\n return [...ids]\n}\n\n/** The query that runs agent work now (a prompt or a skill) as the person asking. Throws without a workspace. */\nexport function composerToTaskQuery(\n { workflow, values, plan, documentTitles }: TaskRequestContext,\n workspaceId: string | undefined\n): TaskQuery {\n if (!workspaceId) throw new Error('Open a workspace to run an agent task.')\n const fields = workflowTaskFields(workflow, values.inputs, values.name, { documentTitles })\n const input = fields.skill_ref\n ? `/${fields.skill_ref}${fields.prompt ? ` ${fields.prompt}` : ''}`\n : fields.prompt\n return {\n input,\n workspaceId,\n docIds: inputDocumentIds(values.inputs),\n task: {\n title: fields.name,\n description: values.description.trim(),\n due_at: values.dueAt ? localInputToIso(values.dueAt) : null,\n parent_conversation_ext_id: values.parentTaskId || null,\n shared: values.shared,\n ...(fields.skill_ref === null && fields.prompt && plan ? { plan } : {}),\n },\n }\n}\n\n/** The fields shared by creating and updating a workflow: the trigger. Others stay `null` on an update. */\nfunction workflowTrigger(values: TaskComposerValues, clearOthers: boolean) {\n const none = clearOthers ? null : undefined\n return {\n rrule: values.when === 'repeat' ? values.rrule.trim() : none,\n run_at: values.when === 'once' ? localInputToIso(values.runAt) : none,\n event_kind: values.when === 'event' ? values.eventKind.trim() : none,\n event_filter: values.when === 'event' ? (values.eventFilter ?? none) : none,\n after_conversation_ext_id: values.when === 'task' ? values.afterTaskId : none,\n // Saving a run-now template creates an on-demand workflow; other triggers clear it.\n on_demand: values.when === 'now' || values.when === 'manual',\n }\n}\n\nconst withoutUndefined = <T extends object>(o: T): T =>\n Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined)) as T\n\n/**\n * The create-workflow request: exactly one trigger (a date, a repeat, an event, or another task being\n * done) and the action it runs. An agent workflow throws when there is no workspace open.\n */\nexport function composerToWorkflowRequest(\n { workflow, values, plan, documentTitles }: TaskRequestContext,\n workspaceId: string | undefined\n): CreateWorkflowRequest {\n const fields = workflowTaskFields(workflow, values.inputs, values.name, { documentTitles })\n // A workflow belongs to a workspace, a reminder included.\n if (!workspaceId) throw new Error('Open a workspace to save a workflow.')\n return withoutUndefined({\n name: fields.name,\n description: values.description.trim(),\n active: true,\n shared: values.shared,\n timezone: values.timezone,\n ...workflowTrigger(values, false),\n ...(fields.action ? { action: fields.action } : {}),\n prompt: fields.prompt,\n skill_ref: fields.skill_ref,\n skill_inputs: fields.skill_inputs,\n agent_ext_id: values.agentId || null,\n auth_mode: authModeFor(values),\n workspace_ext_id: workspaceId,\n // The plan grades every run of a free-instruction workflow (a skill's run is not a goal run).\n ...(fields.skill_ref === null && fields.prompt && plan ? { plan } : {}),\n })\n}\n\n/** What a composer submission asks the host to do. */\nexport type ComposerCreate =\n | { kind: 'work'; body: CreateWorkRequest }\n | { kind: 'query'; query: TaskQuery }\n | { kind: 'workflow'; body: CreateWorkflowRequest }\n\n/**\n * Route a submission: agent work now is an assistant query, a plain to-do or reminder creates work,\n * every other start creates a workflow.\n * `forceWorkflow` is for the workflow dialog, where even a reminder is saved as a workflow.\n */\nexport function taskComposerToCreateRequest(\n ctx: TaskRequestContext,\n workspaceId: string | undefined,\n forceWorkflow = false\n): ComposerCreate {\n if (forceWorkflow || ctx.workflow.documentAction || !createsWork(ctx.values)) {\n return { kind: 'workflow', body: composerToWorkflowRequest(ctx, workspaceId) }\n }\n // A to-do for me, or a reminder, is a plain task; agent work run now is an assistant query.\n return ctx.values.assignee === 'me' || !isAgenticWorkflow(ctx.workflow)\n ? { kind: 'work', body: composerToWorkRequest(ctx, workspaceId) }\n : { kind: 'query', query: composerToTaskQuery(ctx, workspaceId) }\n}\n\n/**\n * The patch for editing a task (`PATCH /v1/conversation/{id}`): title, description, due date, parent\n * (`null` detaches) and sharing. What the agent was told to do stays as created.\n */\nexport function taskComposerToUpdateRequest({\n values,\n plan,\n}: TaskRequestContext): UpdateConversationRequest {\n return {\n title: values.name.trim(),\n description: values.description.trim(),\n due_at: values.dueAt ? localInputToIso(values.dueAt) : null,\n shared: values.shared,\n parent_conversation_ext_id: values.parentTaskId || null,\n ...(plan !== undefined ? { plan } : {}),\n }\n}\n\n/** The patch for editing a workflow: name, trigger (the other triggers are cleared) and action. */\nexport function composerToWorkflowUpdate({\n workflow,\n values,\n plan,\n documentTitles,\n}: TaskRequestContext): UpdateWorkflowRequest {\n const fields = workflowTaskFields(workflow, values.inputs, values.name, { documentTitles })\n return {\n name: fields.name,\n description: values.description.trim(),\n shared: values.shared,\n timezone: values.timezone,\n ...workflowTrigger(values, true),\n action: fields.action ?? null,\n prompt: fields.prompt,\n skill_ref: fields.skill_ref,\n skill_inputs: fields.skill_inputs,\n agent_ext_id: values.agentId || null,\n auth_mode: authModeFor(values),\n // Omission preserves the plan; explicit null removes a stored free-instruction plan.\n ...(fields.skill_ref === null && fields.prompt && plan !== undefined ? { plan } : {}),\n }\n}\n\n/** Does the task need the owner to authorise workspace access before it can run? */\nexport const taskNeedsAccess = (\n task: Pick<ConversationResponse, 'pending_auth_request_id'>\n): boolean => !!task.pending_auth_request_id\n\nexport interface TaskValuesWorkflows {\n /** The workflow that stands for an instruction task (its first input is `instruction`). */\n customWorkflowId: string\n /** The workflow that stands for a reminder (its first input is `message`). */\n reminderWorkflowId: string\n /** The definitions a saved skill can be matched to (by `skill`), to restore a skill workflow's form. */\n definitions?: WorkflowDefinition[]\n}\n\n/** What an existing task (a conversation with a status) looks like when reopened in the composer. */\nexport function taskToComposerValues(\n task: ConversationResponse,\n workflows: TaskValuesWorkflows\n): Partial<TaskComposerValues> {\n const forMe = !task.agent_ext_id && !task.skill_ref && !task.has_agent_action\n return {\n assignee: forMe ? 'me' : 'agent',\n workflowId: forMe ? workflows.reminderWorkflowId : workflows.customWorkflowId,\n inputs: {},\n when: 'now',\n parentTaskId: task.parent_conversation_ext_id ?? '',\n shared: task.is_shared ?? true,\n description: task.description ?? '',\n dueAt: isoToLocalInput(task.due_at),\n agentId: task.agent_ext_id ?? '',\n name: task.title ?? '',\n }\n}\n\n/** Which start a saved workflow has. */\nexport function workflowWhen(workflow: WorkflowResponse): TaskWhen {\n if (workflow.on_demand) return 'now'\n if (workflow.after_conversation_ext_id) return 'task'\n if (workflow.event_kind) return 'event'\n if (workflow.rrule) return 'repeat'\n return workflow.run_at ? 'once' : 'now'\n}\n\n/** What an existing workflow looks like when reopened in the workflow dialog. */\nexport function workflowToComposerValues(\n workflow: WorkflowResponse,\n workflows: TaskValuesWorkflows\n): Partial<TaskComposerValues> {\n const reminder = !workflow.prompt && !workflow.skill_ref\n const skill = workflow.skill_ref\n ? workflows.definitions?.find((d) => d.skill === workflow.skill_ref)\n : undefined\n const base = {\n assignee: 'agent' as const,\n when: workflowWhen(workflow),\n runAt: isoToLocalInput(workflow.run_at),\n rrule: workflow.rrule ?? '',\n timezone: workflow.timezone,\n eventKind: workflow.event_kind ?? 'mention',\n eventFilter: (workflow.event_filter ?? null) as TaskComposerValues['eventFilter'],\n afterTaskId: workflow.after_conversation_ext_id ?? '',\n shared: workflow.shared,\n description: workflow.description ?? '',\n agentId: workflow.agent_ext_id ?? '',\n name: workflow.name,\n access:\n workflow.auth_mode === 'scheduled_permanent'\n ? ('standing' as const)\n : ('ask_each_run' as const),\n }\n if (workflow.action) {\n const definition = workflows.definitions?.find(\n (d) => d.documentAction === workflow.action?.type\n )\n return {\n ...base,\n workflowId: definition?.id ?? workflows.customWorkflowId,\n inputs: {\n scope: {\n folders: [],\n labels: workflow.action.documents?.label_ext_ids ?? [],\n documents: workflow.action.documents?.doc_ext_ids ?? [],\n },\n output: workflow.action.tag_ext_ids?.[0] ?? '',\n overwrite: workflow.action.overwrite ?? false,\n latest: workflow.action.documents?.latest ?? false,\n },\n }\n }\n if (skill) {\n return {\n ...base,\n workflowId: skill.id,\n inputs: (workflow.skill_inputs as WorkflowInputs | null | undefined) ?? {\n args: workflow.prompt,\n },\n }\n }\n return reminder\n ? { ...base, workflowId: workflows.reminderWorkflowId, inputs: { message: workflow.name } }\n : {\n ...base,\n // A name made from the instruction follows it when the instruction is edited.\n name: workflow.name === firstWords(workflow.prompt ?? '') ? '' : workflow.name,\n workflowId: workflows.customWorkflowId,\n inputs: {\n ...((workflow.skill_inputs as WorkflowInputs | null | undefined) ?? {}),\n instruction: workflow.prompt,\n },\n }\n}\n\n/** What the New task dialog collects: a prompt, who sees it, and optional task details. */\nexport interface NewThreadValues {\n /** What to ask or get done: the first message, which the assistant answers. The title is made from it. */\n prompt: string\n /** A name instead of the generated one. Optional. */\n title: string\n /** Shared with the workspace's members (the default), or private to its creator. */\n shared: boolean\n /** datetime-local value; empty = none. A task field. */\n dueAt: string\n /** The task this is a sub-task of (`con-…`); `''` = none. A task field. */\n parentId: string\n /** Whether the assistant starts on the prompt now. Off: it is a to-do, tracked and not run. */\n assistant: boolean\n}\n\nexport const EMPTY_NEW_THREAD: NewThreadValues = {\n prompt: '',\n title: '',\n shared: false,\n dueAt: '',\n parentId: '',\n assistant: true,\n}\n\n/** Is any task detail filled in (the dialog opens its details when one is preset)? */\nexport const hasTaskFields = (v: NewThreadValues): boolean => Boolean(v.dueAt || v.parentId)\n\n/** A new task: the prompt as the first message (the assistant answers it) and the task's options. */\nexport interface NewThreadRequest {\n input: string\n shared: boolean\n task: TaskOptions\n /** False: nothing is asked of the assistant: the host adds a plain to-do from `todo`. */\n startAssistant: boolean\n /** The to-do to add when `startAssistant` is false: a title and the rest of what the person wrote. */\n todo?: { title: string; description: string }\n}\n\n/** The first line of a prompt, kept to a title's length. */\nexport function titleFromPrompt(prompt: string, max = 80): string {\n const first = prompt.trim().split('\\n')[0].trim()\n return first.length > max ? `${first.slice(0, max - 1).trimEnd()}…` : first\n}\n\n/**\n * The request for a New task submission. Every ask is a task, so the options always ride along; the due\n * date and parent are only set when filled in. The title is only sent when the person wrote one;\n * otherwise the server names the task from the prompt. With the assistant switched off nothing is run: it\n * is a to-do.\n */\nexport function newThreadToRequest(values: NewThreadValues): NewThreadRequest {\n const input = values.prompt.trim()\n const title = values.title.trim()\n const task: TaskOptions = {\n ...(title ? { title } : {}),\n due_at: values.dueAt ? localInputToIso(values.dueAt) : null,\n parent_conversation_ext_id: values.parentId || null,\n shared: values.shared,\n }\n if (!values.assistant) {\n const name = title || titleFromPrompt(input)\n return {\n input,\n shared: values.shared,\n task,\n startAssistant: false,\n todo: { title: name, description: input === name ? '' : input },\n }\n }\n return { input, shared: values.shared, task, startAssistant: true }\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var chunkTBDQGSFI_cjs = require('./chunk-TBDQGSFI.cjs');
5
- var chunkVJHDCYKE_cjs = require('./chunk-VJHDCYKE.cjs');
5
+ var chunkV5VFRRLL_cjs = require('./chunk-V5VFRRLL.cjs');
6
6
  var react = require('@arbidocs/react');
7
7
  var jsxRuntime = require('react/jsx-runtime');
8
8
 
@@ -10,7 +10,7 @@ function ConnectedNativeDocxComparison({
10
10
  fontBaseUrl,
11
11
  ...props
12
12
  }) {
13
- const adapter = chunkVJHDCYKE_cjs.useConnectedNativeDocxAdapter(fontBaseUrl);
13
+ const adapter = chunkV5VFRRLL_cjs.useConnectedNativeDocxAdapter(fontBaseUrl);
14
14
  const { data: documents, isLoading } = react.useDocuments();
15
15
  const morePages = react.useDocumentsLoading();
16
16
  if (isLoading || morePages)
@@ -27,5 +27,5 @@ function ConnectedNativeDocxComparison({
27
27
  }
28
28
 
29
29
  exports.ConnectedNativeDocxComparison = ConnectedNativeDocxComparison;
30
- //# sourceMappingURL=chunk-KZH6HMJL.cjs.map
31
- //# sourceMappingURL=chunk-KZH6HMJL.cjs.map
30
+ //# sourceMappingURL=chunk-QXIWLWR2.cjs.map
31
+ //# sourceMappingURL=chunk-QXIWLWR2.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/docx/ConnectedNativeDocxComparison.tsx"],"names":["useConnectedNativeDocxAdapter","useDocuments","useDocumentsLoading","jsx","NativeDocxComparison"],"mappings":";;;;;;;AAYO,SAAS,6BAAA,CAA8B;AAAA,EAC5C,WAAA;AAAA,EACA,GAAG;AACL,CAAA,EAEG;AACD,EAAA,MAAM,OAAA,GAAUA,gDAA8B,WAAW,CAAA;AACzD,EAAA,MAAM,EAAE,IAAA,EAAM,SAAA,EAAW,SAAA,KAAcC,kBAAA,EAAa;AAEpD,EAAA,MAAM,YAAYC,yBAAA,EAAoB;AAEtC,EAAA,IAAI,SAAA,IAAa,SAAA;AACf,IAAA,sCACG,KAAA,EAAA,EAAI,SAAA,EAAU,mBAAA,EAAoB,IAAA,EAAK,UAAS,QAAA,EAAA,gCAAA,EAEjD,CAAA;AAEJ,EAAA,uBACEC,cAAA;AAAA,IAACC,sCAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,OAAA;AAAA,MACA,SAAA;AAAA,MACA,YAAY,OAAA,CAAQ;AAAA;AAAA,GACtB;AAEJ","file":"chunk-KZH6HMJL.cjs","sourcesContent":["import { useDocuments, useDocumentsLoading } from '@arbidocs/react'\nimport {\n NativeDocxComparison,\n type NativeDocxComparisonProps,\n} from '../../docx/NativeDocxComparison'\nimport { useConnectedNativeDocxAdapter } from './ConnectedNativeDocxEditor'\n\n/**\n * The Word redline of two documents or versions, on the signed-in session. The unedited redline\n * saved earlier from the same versions is opened again (found in the workspace's documents, once\n * all their pages are read), so opening a comparison saves at most one.\n */\nexport function ConnectedNativeDocxComparison({\n fontBaseUrl,\n ...props\n}: Omit<NativeDocxComparisonProps, 'adapter' | 'onCompared' | 'documents'> & {\n fontBaseUrl?: string\n}) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n const { data: documents, isLoading } = useDocuments()\n // Every page: the first holds only the oldest documents, and a redline is often newer.\n const morePages = useDocumentsLoading()\n // Until the documents are read, a saved redline can't be found: wait rather than save another.\n if (isLoading || morePages)\n return (\n <div className=\"native-docx-error\" role=\"status\">\n Comparing Word documents…\n </div>\n )\n return (\n <NativeDocxComparison\n {...props}\n adapter={adapter}\n documents={documents}\n onCompared={adapter.onVersionSaved}\n />\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/connection/docx/ConnectedNativeDocxComparison.tsx"],"names":["useConnectedNativeDocxAdapter","useDocuments","useDocumentsLoading","jsx","NativeDocxComparison"],"mappings":";;;;;;;AAYO,SAAS,6BAAA,CAA8B;AAAA,EAC5C,WAAA;AAAA,EACA,GAAG;AACL,CAAA,EAEG;AACD,EAAA,MAAM,OAAA,GAAUA,gDAA8B,WAAW,CAAA;AACzD,EAAA,MAAM,EAAE,IAAA,EAAM,SAAA,EAAW,SAAA,KAAcC,kBAAA,EAAa;AAEpD,EAAA,MAAM,YAAYC,yBAAA,EAAoB;AAEtC,EAAA,IAAI,SAAA,IAAa,SAAA;AACf,IAAA,sCACG,KAAA,EAAA,EAAI,SAAA,EAAU,mBAAA,EAAoB,IAAA,EAAK,UAAS,QAAA,EAAA,gCAAA,EAEjD,CAAA;AAEJ,EAAA,uBACEC,cAAA;AAAA,IAACC,sCAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,OAAA;AAAA,MACA,SAAA;AAAA,MACA,YAAY,OAAA,CAAQ;AAAA;AAAA,GACtB;AAEJ","file":"chunk-QXIWLWR2.cjs","sourcesContent":["import { useDocuments, useDocumentsLoading } from '@arbidocs/react'\nimport {\n NativeDocxComparison,\n type NativeDocxComparisonProps,\n} from '../../docx/NativeDocxComparison'\nimport { useConnectedNativeDocxAdapter } from './ConnectedNativeDocxEditor'\n\n/**\n * The Word redline of two documents or versions, on the signed-in session. The unedited redline\n * saved earlier from the same versions is opened again (found in the workspace's documents, once\n * all their pages are read), so opening a comparison saves at most one.\n */\nexport function ConnectedNativeDocxComparison({\n fontBaseUrl,\n ...props\n}: Omit<NativeDocxComparisonProps, 'adapter' | 'onCompared' | 'documents'> & {\n fontBaseUrl?: string\n}) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n const { data: documents, isLoading } = useDocuments()\n // Every page: the first holds only the oldest documents, and a redline is often newer.\n const morePages = useDocumentsLoading()\n // Until the documents are read, a saved redline can't be found: wait rather than save another.\n if (isLoading || morePages)\n return (\n <div className=\"native-docx-error\" role=\"status\">\n Comparing Word documents…\n </div>\n )\n return (\n <NativeDocxComparison\n {...props}\n adapter={adapter}\n documents={documents}\n onCompared={adapter.onVersionSaved}\n />\n )\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkHS7TUDEM_cjs = require('./chunk-HS7TUDEM.cjs');
4
+ var chunk6HP6SQWC_cjs = require('./chunk-6HP6SQWC.cjs');
5
5
  var chunkVZOOGA47_cjs = require('./chunk-VZOOGA47.cjs');
6
6
  var chunkXQPJWPWE_cjs = require('./chunk-XQPJWPWE.cjs');
7
7
  var chunkOAIOOVFN_cjs = require('./chunk-OAIOOVFN.cjs');
@@ -741,12 +741,12 @@ function WebinarChat({ chat }) {
741
741
  end.current?.scrollIntoView?.({ block: "end" });
742
742
  }, [count]);
743
743
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-0 flex-1 flex-col", "data-testid": "webinar-chat", children: [
744
- /* @__PURE__ */ jsxRuntime.jsxs(chunkHS7TUDEM_cjs.MessageListRoot, { className: "min-h-0 flex-1 overflow-y-auto py-2", testId: "webinar-chat-list", children: [
745
- count === 0 ? /* @__PURE__ */ jsxRuntime.jsx(chunkHS7TUDEM_cjs.MessageListEmpty, { className: "h-32 text-sm", children: "No messages yet." }) : chat.lines.map((line, i) => {
744
+ /* @__PURE__ */ jsxRuntime.jsxs(chunk6HP6SQWC_cjs.MessageListRoot, { className: "min-h-0 flex-1 overflow-y-auto py-2", testId: "webinar-chat-list", children: [
745
+ count === 0 ? /* @__PURE__ */ jsxRuntime.jsx(chunk6HP6SQWC_cjs.MessageListEmpty, { className: "h-32 text-sm", children: "No messages yet." }) : chat.lines.map((line, i) => {
746
746
  const startsRun = !line.mine && chat.lines[i - 1]?.senderIdentity !== line.senderIdentity;
747
747
  const id = `${line.senderIdentity}-${line.id}`;
748
- return /* @__PURE__ */ jsxRuntime.jsx(chunkHS7TUDEM_cjs.MessageRoot, { role: "user", messageId: id, className: "px-3", children: /* @__PURE__ */ jsxRuntime.jsxs(chunkHS7TUDEM_cjs.MessageContent, { role: "user", messageId: id, align: line.mine ? "end" : "start", children: [
749
- startsRun && /* @__PURE__ */ jsxRuntime.jsx(chunkHS7TUDEM_cjs.MessageAuthor, { children: /* @__PURE__ */ jsxRuntime.jsx(
748
+ return /* @__PURE__ */ jsxRuntime.jsx(chunk6HP6SQWC_cjs.MessageRoot, { role: "user", messageId: id, className: "px-3", children: /* @__PURE__ */ jsxRuntime.jsxs(chunk6HP6SQWC_cjs.MessageContent, { role: "user", messageId: id, align: line.mine ? "end" : "start", children: [
749
+ startsRun && /* @__PURE__ */ jsxRuntime.jsx(chunk6HP6SQWC_cjs.MessageAuthor, { children: /* @__PURE__ */ jsxRuntime.jsx(
750
750
  chunkZ574BY3H_cjs.CallUserPill,
751
751
  {
752
752
  identity: line.senderIdentity,
@@ -755,12 +755,12 @@ function WebinarChat({ chat }) {
755
755
  }
756
756
  ) }),
757
757
  /* @__PURE__ */ jsxRuntime.jsx(
758
- chunkHS7TUDEM_cjs.MessageBubble,
758
+ chunk6HP6SQWC_cjs.MessageBubble,
759
759
  {
760
760
  role: "user",
761
761
  messageId: id,
762
762
  className: line.mine ? void 0 : "border border-border bg-card",
763
- children: /* @__PURE__ */ jsxRuntime.jsx(chunkHS7TUDEM_cjs.MessageBody, { messageId: id, className: "whitespace-pre-wrap text-sm", children: line.text })
763
+ children: /* @__PURE__ */ jsxRuntime.jsx(chunk6HP6SQWC_cjs.MessageBody, { messageId: id, className: "whitespace-pre-wrap text-sm", children: line.text })
764
764
  }
765
765
  )
766
766
  ] }) }, id);
@@ -1642,5 +1642,5 @@ function ConnectingOverlay() {
1642
1642
  }
1643
1643
 
1644
1644
  exports.ConnectedCallRoom = ConnectedCallRoom;
1645
- //# sourceMappingURL=chunk-IRDL2EC6.cjs.map
1646
- //# sourceMappingURL=chunk-IRDL2EC6.cjs.map
1645
+ //# sourceMappingURL=chunk-SDID4WK7.cjs.map
1646
+ //# sourceMappingURL=chunk-SDID4WK7.cjs.map