@arbidocs/blocks 0.5.144 → 0.5.145

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 (114) hide show
  1. package/dist/{ConnectedCallDock-FHKM7MAL.cjs → ConnectedCallDock-JVLJEWLJ.cjs} +21 -21
  2. package/dist/{ConnectedCallDock-FHKM7MAL.cjs.map → ConnectedCallDock-JVLJEWLJ.cjs.map} +1 -1
  3. package/dist/{ConnectedCallRoom-QNMZJMLB.cjs → ConnectedCallRoom-7YQRDIS3.cjs} +14 -14
  4. package/dist/{ConnectedCallRoom-QNMZJMLB.cjs.map → ConnectedCallRoom-7YQRDIS3.cjs.map} +1 -1
  5. package/dist/{ConnectedNativeDocxComparison-SWY7327V.cjs → ConnectedNativeDocxComparison-KKX27IGJ.cjs} +17 -17
  6. package/dist/{ConnectedNativeDocxComparison-SWY7327V.cjs.map → ConnectedNativeDocxComparison-KKX27IGJ.cjs.map} +1 -1
  7. package/dist/{ConnectedPresentation-XPMQQ3E2.cjs → ConnectedPresentation-JJXQBIV2.cjs} +16 -16
  8. package/dist/{ConnectedPresentation-XPMQQ3E2.cjs.map → ConnectedPresentation-JJXQBIV2.cjs.map} +1 -1
  9. package/dist/{ConnectedProductionSetDialog-GM5D7IUG.cjs → ConnectedProductionSetDialog-EOWZQ6J3.cjs} +3 -3
  10. package/dist/{ConnectedProductionSetDialog-GM5D7IUG.cjs.map → ConnectedProductionSetDialog-EOWZQ6J3.cjs.map} +1 -1
  11. package/dist/{ConnectedSlidesTab-OOTWJBDV.cjs → ConnectedSlidesTab-BLR762KY.cjs} +14 -14
  12. package/dist/{ConnectedSlidesTab-OOTWJBDV.cjs.map → ConnectedSlidesTab-BLR762KY.cjs.map} +1 -1
  13. package/dist/{ConnectedStreamedWordArtifact-TU5GEHEV.cjs → ConnectedStreamedWordArtifact-HAHRU4DQ.cjs} +17 -17
  14. package/dist/{ConnectedStreamedWordArtifact-TU5GEHEV.cjs.map → ConnectedStreamedWordArtifact-HAHRU4DQ.cjs.map} +1 -1
  15. package/dist/{DocumentReviewCard-BCWIW7PU.cjs → DocumentReviewCard-ENCPTGJE.cjs} +15 -15
  16. package/dist/{DocumentReviewCard-BCWIW7PU.cjs.map → DocumentReviewCard-ENCPTGJE.cjs.map} +1 -1
  17. package/dist/{FilesViewerDialog-UX7LNBJI.cjs → FilesViewerDialog-VJYQ7XZA.cjs} +46 -46
  18. package/dist/{FilesViewerDialog-UX7LNBJI.cjs.map → FilesViewerDialog-VJYQ7XZA.cjs.map} +1 -1
  19. package/dist/{WorkspaceTableView-NW3ANGBX.cjs → WorkspaceTableView-2RH33X3U.cjs} +8 -8
  20. package/dist/{WorkspaceTableView-NW3ANGBX.cjs.map → WorkspaceTableView-2RH33X3U.cjs.map} +1 -1
  21. package/dist/agents/index.cjs +297 -297
  22. package/dist/agents/tasks/WorkflowThreadStrip.js +8 -11
  23. package/dist/agents/tasks/WorkflowThreadStrip.js.map +2 -2
  24. package/dist/agents/workflows/StepBarFrame.js +12 -0
  25. package/dist/agents/workflows/StepBarFrame.js.map +2 -2
  26. package/dist/{ai-T2BDBHI3.cjs → ai-YX3OAC4F.cjs} +25 -25
  27. package/dist/ai-YX3OAC4F.cjs.map +1 -0
  28. package/dist/calls/index.cjs +121 -121
  29. package/dist/chat/index.cjs +1 -1
  30. package/dist/{chunk-ZJS2BM7D.cjs → chunk-2VEQKLNN.cjs} +6 -6
  31. package/dist/{chunk-ZJS2BM7D.cjs.map → chunk-2VEQKLNN.cjs.map} +1 -1
  32. package/dist/{chunk-F47B75LV.cjs → chunk-2XZ3HBAA.cjs} +12 -12
  33. package/dist/{chunk-F47B75LV.cjs.map → chunk-2XZ3HBAA.cjs.map} +1 -1
  34. package/dist/{chunk-FM46VQ5D.cjs → chunk-32HVYK4Q.cjs} +47 -38
  35. package/dist/chunk-32HVYK4Q.cjs.map +1 -0
  36. package/dist/{chunk-FYNNNQ6H.cjs → chunk-33GOYI3O.cjs} +4 -4
  37. package/dist/{chunk-FYNNNQ6H.cjs.map → chunk-33GOYI3O.cjs.map} +1 -1
  38. package/dist/{chunk-7KEB3VZ5.cjs → chunk-464TFVQ7.cjs} +4 -4
  39. package/dist/{chunk-7KEB3VZ5.cjs.map → chunk-464TFVQ7.cjs.map} +1 -1
  40. package/dist/{chunk-FWD4WSGR.cjs → chunk-73ECBDG7.cjs} +3 -3
  41. package/dist/{chunk-FWD4WSGR.cjs.map → chunk-73ECBDG7.cjs.map} +1 -1
  42. package/dist/{chunk-N5UI363Q.cjs → chunk-ECSOXKJQ.cjs} +3 -3
  43. package/dist/{chunk-N5UI363Q.cjs.map → chunk-ECSOXKJQ.cjs.map} +1 -1
  44. package/dist/{chunk-Q77OKXYM.cjs → chunk-EYXU32D7.cjs} +6 -6
  45. package/dist/{chunk-Q77OKXYM.cjs.map → chunk-EYXU32D7.cjs.map} +1 -1
  46. package/dist/{chunk-PWGHCEJK.cjs → chunk-FK7MBD5H.cjs} +6 -6
  47. package/dist/{chunk-PWGHCEJK.cjs.map → chunk-FK7MBD5H.cjs.map} +1 -1
  48. package/dist/{chunk-JXSSR6T3.cjs → chunk-GF3I3SA4.cjs} +7 -7
  49. package/dist/{chunk-JXSSR6T3.cjs.map → chunk-GF3I3SA4.cjs.map} +1 -1
  50. package/dist/{chunk-SDSK7RWP.cjs → chunk-I5L24HOC.cjs} +11 -11
  51. package/dist/{chunk-SDSK7RWP.cjs.map → chunk-I5L24HOC.cjs.map} +1 -1
  52. package/dist/{chunk-EY23TOPI.cjs → chunk-IFJBE7M5.cjs} +11 -11
  53. package/dist/{chunk-EY23TOPI.cjs.map → chunk-IFJBE7M5.cjs.map} +1 -1
  54. package/dist/{chunk-YQRACWAS.cjs → chunk-JJDJLAC7.cjs} +48 -48
  55. package/dist/{chunk-YQRACWAS.cjs.map → chunk-JJDJLAC7.cjs.map} +1 -1
  56. package/dist/{chunk-RYVZDFVO.cjs → chunk-JJZOL5MG.cjs} +3 -3
  57. package/dist/{chunk-RYVZDFVO.cjs.map → chunk-JJZOL5MG.cjs.map} +1 -1
  58. package/dist/{chunk-BT2QTDZ4.cjs → chunk-KP7BQIZL.cjs} +35 -35
  59. package/dist/{chunk-BT2QTDZ4.cjs.map → chunk-KP7BQIZL.cjs.map} +1 -1
  60. package/dist/{chunk-JXZM5ODS.cjs → chunk-MBXXWTKT.cjs} +28 -28
  61. package/dist/{chunk-JXZM5ODS.cjs.map → chunk-MBXXWTKT.cjs.map} +1 -1
  62. package/dist/{chunk-NM2WDBXH.cjs → chunk-MC34TXSS.cjs} +13 -13
  63. package/dist/{chunk-NM2WDBXH.cjs.map → chunk-MC34TXSS.cjs.map} +1 -1
  64. package/dist/{chunk-PQQA34ZR.cjs → chunk-N3H3YAKY.cjs} +4 -4
  65. package/dist/{chunk-PQQA34ZR.cjs.map → chunk-N3H3YAKY.cjs.map} +1 -1
  66. package/dist/{chunk-F7IBUDD5.cjs → chunk-NPRNR54M.cjs} +6 -6
  67. package/dist/{chunk-F7IBUDD5.cjs.map → chunk-NPRNR54M.cjs.map} +1 -1
  68. package/dist/{chunk-SJTLHWFC.cjs → chunk-OE36OY64.cjs} +15 -15
  69. package/dist/{chunk-SJTLHWFC.cjs.map → chunk-OE36OY64.cjs.map} +1 -1
  70. package/dist/{chunk-Q67V6O4R.cjs → chunk-P2AZ2HX7.cjs} +76 -76
  71. package/dist/{chunk-Q67V6O4R.cjs.map → chunk-P2AZ2HX7.cjs.map} +1 -1
  72. package/dist/{chunk-DH5NOQCU.cjs → chunk-QW6NCUR7.cjs} +5 -5
  73. package/dist/{chunk-DH5NOQCU.cjs.map → chunk-QW6NCUR7.cjs.map} +1 -1
  74. package/dist/{chunk-ANFDJIJP.cjs → chunk-S2NQS4RC.cjs} +4 -4
  75. package/dist/{chunk-ANFDJIJP.cjs.map → chunk-S2NQS4RC.cjs.map} +1 -1
  76. package/dist/{chunk-TIBTTITZ.cjs → chunk-SK6LFIU2.cjs} +3 -3
  77. package/dist/{chunk-TIBTTITZ.cjs.map → chunk-SK6LFIU2.cjs.map} +1 -1
  78. package/dist/{chunk-AJTHOVCM.cjs → chunk-TMZS7IKQ.cjs} +64 -64
  79. package/dist/{chunk-AJTHOVCM.cjs.map → chunk-TMZS7IKQ.cjs.map} +1 -1
  80. package/dist/{chunk-RDBUQCAS.cjs → chunk-U6XMZG6G.cjs} +3 -3
  81. package/dist/{chunk-RDBUQCAS.cjs.map → chunk-U6XMZG6G.cjs.map} +1 -1
  82. package/dist/{chunk-LYDPVFNS.cjs → chunk-UD56Y6UA.cjs} +4 -4
  83. package/dist/{chunk-LYDPVFNS.cjs.map → chunk-UD56Y6UA.cjs.map} +1 -1
  84. package/dist/{chunk-JDQIZFDO.cjs → chunk-UNBORYTW.cjs} +7 -7
  85. package/dist/{chunk-JDQIZFDO.cjs.map → chunk-UNBORYTW.cjs.map} +1 -1
  86. package/dist/{chunk-7HU2NQVO.cjs → chunk-VCDD763Y.cjs} +3 -3
  87. package/dist/{chunk-7HU2NQVO.cjs.map → chunk-VCDD763Y.cjs.map} +1 -1
  88. package/dist/{chunk-HG72AVXX.cjs → chunk-VF26CUE3.cjs} +3 -3
  89. package/dist/{chunk-HG72AVXX.cjs.map → chunk-VF26CUE3.cjs.map} +1 -1
  90. package/dist/{chunk-ZCSX5SMV.cjs → chunk-WQEWVZGO.cjs} +50 -50
  91. package/dist/{chunk-ZCSX5SMV.cjs.map → chunk-WQEWVZGO.cjs.map} +1 -1
  92. package/dist/{chunk-BXLY2UQM.cjs → chunk-XAW22O2S.cjs} +4 -4
  93. package/dist/{chunk-BXLY2UQM.cjs.map → chunk-XAW22O2S.cjs.map} +1 -1
  94. package/dist/{chunk-2Q32RXY2.cjs → chunk-YST6GVN5.cjs} +3 -3
  95. package/dist/{chunk-2Q32RXY2.cjs.map → chunk-YST6GVN5.cjs.map} +1 -1
  96. package/dist/{chunk-BSZ45U3F.cjs → chunk-YZ25NAR3.cjs} +3 -3
  97. package/dist/{chunk-BSZ45U3F.cjs.map → chunk-YZ25NAR3.cjs.map} +1 -1
  98. package/dist/{chunk-N7B5OAI5.cjs → chunk-ZPIZINH2.cjs} +4 -4
  99. package/dist/{chunk-N7B5OAI5.cjs.map → chunk-ZPIZINH2.cjs.map} +1 -1
  100. package/dist/connect/docx.cjs +20 -20
  101. package/dist/connect/index.cjs +995 -995
  102. package/dist/connect/viewer.cjs +34 -34
  103. package/dist/dashboards/index.cjs +1 -1
  104. package/dist/embed/index.cjs +39 -39
  105. package/dist/files/index.cjs +224 -224
  106. package/dist/index.cjs +1731 -1731
  107. package/dist/settings/index.cjs +146 -146
  108. package/dist/shell/index.cjs +87 -87
  109. package/dist/studio/index.cjs +28 -28
  110. package/dist/workflow-canvas/index.cjs +54 -54
  111. package/node_modules/@arbidocs/coedit/package.json +1 -1
  112. package/package.json +5 -5
  113. package/dist/ai-T2BDBHI3.cjs.map +0 -1
  114. package/dist/chunk-FM46VQ5D.cjs.map +0 -1
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunk2Q32RXY2_cjs = require('./chunk-2Q32RXY2.cjs');
5
- var chunkPWGHCEJK_cjs = require('./chunk-PWGHCEJK.cjs');
4
+ var chunkYST6GVN5_cjs = require('./chunk-YST6GVN5.cjs');
5
+ var chunkFK7MBD5H_cjs = require('./chunk-FK7MBD5H.cjs');
6
6
  var chunk7D4WXUBS_cjs = require('./chunk-7D4WXUBS.cjs');
7
- var chunkBSZ45U3F_cjs = require('./chunk-BSZ45U3F.cjs');
8
- var chunkXPQR2PJX_cjs = require('./chunk-XPQR2PJX.cjs');
7
+ var chunkYZ25NAR3_cjs = require('./chunk-YZ25NAR3.cjs');
9
8
  var chunk3YZKDCWY_cjs = require('./chunk-3YZKDCWY.cjs');
9
+ var chunkXPQR2PJX_cjs = require('./chunk-XPQR2PJX.cjs');
10
10
  var chunkLIKDQBNJ_cjs = require('./chunk-LIKDQBNJ.cjs');
11
11
  var browser = require('@arbidocs/sdk/browser');
12
12
  var react = require('@arbidocs/react');
@@ -49,11 +49,11 @@ function useLaunchWorkflow({
49
49
  } = {}) {
50
50
  const { data: documents = [] } = react.useDocuments();
51
51
  const { data: workspaceTags = [] } = react.useTags();
52
- const tags = react$1.useMemo(() => chunkBSZ45U3F_cjs.documentScopeLabels(workspaceTags), [workspaceTags]);
52
+ const tags = react$1.useMemo(() => chunkYZ25NAR3_cjs.documentScopeLabels(workspaceTags), [workspaceTags]);
53
53
  const createTag = react.useCreateTag();
54
54
  const updateTag = react.useUpdateTag();
55
55
  const generate = react.useGenerateDocTags();
56
- const { create: createTask } = chunk2Q32RXY2_cjs.useWorkflowTasks();
56
+ const { create: createTask } = chunkYST6GVN5_cjs.useWorkflowTasks();
57
57
  const applyModel = react.useApplyChatModel();
58
58
  const session = react.useArbiSessionStore();
59
59
  const { notify, openFiles, openNewConversation } = chunkLIKDQBNJ_cjs.useBlocksEnvironment();
@@ -61,7 +61,7 @@ function useLaunchWorkflow({
61
61
  async ({ inputs, scope }) => {
62
62
  const description = text(inputs, "description");
63
63
  const name = text(inputs, "name") || chunk7D4WXUBS_cjs.deriveAnnotationName(description);
64
- const matching = chunkBSZ45U3F_cjs.matchWorkflowScope(documents, scope);
64
+ const matching = chunkYZ25NAR3_cjs.matchWorkflowScope(documents, scope);
65
65
  if (!name || !description || matching.length === 0) return;
66
66
  try {
67
67
  const existing = tags.find((t) => t.name.toLowerCase() === name.toLowerCase());
@@ -161,7 +161,7 @@ function useLaunchWorkflow({
161
161
  const binding = PROMPT_BINDINGS[workflow.id];
162
162
  const prepare = () => {
163
163
  if (binding?.attachScope !== false && !chunkXPQR2PJX_cjs.isEmptyWorkflowScope(scope)) {
164
- const ids = chunkBSZ45U3F_cjs.matchWorkflowScope(documents, scope).map((d) => d.external_id);
164
+ const ids = chunkYZ25NAR3_cjs.matchWorkflowScope(documents, scope).map((d) => d.external_id);
165
165
  if (ids.length > 0) {
166
166
  session.setConversationDocuments(
167
167
  inPlace ? session.getState().conversationId ?? "new" : "new",
@@ -215,7 +215,7 @@ function ConnectedWorkflowStart({
215
215
  );
216
216
  const { openUpload } = chunkLIKDQBNJ_cjs.useBlocksEnvironment();
217
217
  const { data: workspaceTags = [] } = react.useTags();
218
- const tags = react$1.useMemo(() => chunkBSZ45U3F_cjs.documentScopeLabels(workspaceTags), [workspaceTags]);
218
+ const tags = react$1.useMemo(() => chunkYZ25NAR3_cjs.documentScopeLabels(workspaceTags), [workspaceTags]);
219
219
  const fieldPlaceholder = react$1.useCallback(
220
220
  (field, inputs, workflow) => {
221
221
  if (workflow.id !== chunk7D4WXUBS_cjs.ANNOTATE_ID || field.name !== "name") return void 0;
@@ -225,7 +225,7 @@ function ConnectedWorkflowStart({
225
225
  []
226
226
  );
227
227
  return /* @__PURE__ */ jsxRuntime.jsx(
228
- chunkPWGHCEJK_cjs.ConnectedWorkflowLauncher,
228
+ chunkFK7MBD5H_cjs.ConnectedWorkflowLauncher,
229
229
  {
230
230
  ...rest,
231
231
  workflows,
@@ -265,5 +265,5 @@ function ConnectedWorkflowStart({
265
265
  exports.ConnectedWorkflowStart = ConnectedWorkflowStart;
266
266
  exports.PROMPT_BINDINGS = PROMPT_BINDINGS;
267
267
  exports.useLaunchWorkflow = useLaunchWorkflow;
268
- //# sourceMappingURL=chunk-F47B75LV.cjs.map
269
- //# sourceMappingURL=chunk-F47B75LV.cjs.map
268
+ //# sourceMappingURL=chunk-2XZ3HBAA.cjs.map
269
+ //# sourceMappingURL=chunk-2XZ3HBAA.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/workflows/launch-bindings.ts","../src/connection/workflows/useLaunchWorkflow.ts","../src/connection/workflows/ConnectedWorkflowStart.tsx"],"names":["GENERATE_IMAGE_ID","buildRetrievalChunkTool","buildRetrievalFullContextTool","IMAGE_ASPECT_AUTO","useDocuments","useTags","useMemo","documentScopeLabels","useCreateTag","useUpdateTag","useGenerateDocTags","useWorkflowTasks","useApplyChatModel","useArbiSessionStore","useBlocksEnvironment","useCallback","deriveAnnotationName","matchWorkflowScope","ANNOTATE_ID","recordWorkflowUse","getDocumentTitle","composeWorkflowPrompt","isEmptyWorkflowScope","useHost","renderWorkflowIcon","jsx","ConnectedWorkflowLauncher","jsxs","TriangleAlert"],"mappings":";;;;;;;;;;;;;;;;AAwBA,IAAM,YAAA,GAAe,CAAC,MAAA,KAAqC;AACzD,EAAA,MAAM,QAAQ,MAAA,CAAO,UAAA;AACrB,EAAA,OAAO,KAAA,EAAO,aAAa,EAAC;AAC9B,CAAA;AAEO,IAAM,eAAA,GAAiD;AAAA,EAC5D,CAACA,mCAAiB,GAAG;AAAA,IACnB,WAAA,EAAa,KAAA;AAAA,IACb,KAAA,EAAO,CAAC,MAAA,KAAW;AACjB,MAAA,MAAM,cAAc,OAAO,MAAA,CAAO,YAAA,KAAiB,QAAA,GAAW,OAAO,YAAA,GAAe,EAAA;AACpF,MAAA,OAAO;AAAA,QACL,eAAA,EAAiBC,+BAAA,CAAwB,EAAE,CAAA;AAAA,QAC3C,sBAAA,EAAwBC,qCAAA,CAA8B,YAAA,CAAa,MAAM,CAAC,CAAA;AAAA,QAC1E,GAAI,WAAA,IAAe,WAAA,KAAgBC,mCAAA,GAC/B;AAAA,UACE,gBAAA,EAAkB;AAAA,YAChB,IAAA,EAAM,kBAAA;AAAA,YACN,WAAA,EAAa,kBAAA;AAAA,YACb,SAAA,EAAW,EAAE,YAAA,EAAc,WAAA,EAAY;AAAA,YACvC,gBAAgB;AAAC;AACnB,YAEF;AAAC,OACP;AAAA,IACF;AAAA;AAEJ;ACQA,IAAM,IAAA,GAAO,CAAC,MAAA,EAAwB,IAAA,KAAyB;AAC7D,EAAA,MAAM,CAAA,GAAI,OAAO,IAAI,CAAA;AACrB,EAAA,OAAO,OAAO,CAAA,KAAM,QAAA,GAAW,CAAA,CAAE,MAAK,GAAI,EAAA;AAC5C,CAAA;AAEO,SAAS,iBAAA,CAAkB;AAAA,EAChC,OAAA,EAAS,cAAA;AAAA,EACT;AACF,CAAA,GAA8B,EAAC,EA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A;AAAA,YACL,aAAA,EAAY,iCAAA;AAAA,YAEZ,QAAA,EAAA;AAAA,8BAAAF,cAAA,CAACG,yBAAA,EAAA,EAAc,WAAU,uCAAA,EAAwC,CAAA;AAAA,8CAChE,MAAA,EAAA,EAAK,QAAA,EAAA;AAAA,gBAAA,uBAAA;AAAA,gCACiBH,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,aAAA,EAAe,mBAAS,IAAA,EAAK,CAAA;AAAA,gBAAO;AAAA,eAAA,EAG3E;AAAA;AAAA;AAAA,SACF;AAAA,MAEJ;AAAA;AAAA,GACF;AAEJ","file":"chunk-F47B75LV.cjs","sourcesContent":["/**\n * Host bindings of prompt workflows that need more than words on send. Bound by workflow id, the\n * same way the annotation operation is: blocks and the registry stay declarative, and the one\n * place that knows the wire shape is here.\n *\n * Generate image: the reference images and the aspect ratio ride structured tool arguments\n * (`retrieval_full_context` over every reference, `image_generation.aspect_ratio`), never the\n * prompt text: the image model does not reliably honour a shape or sources worded into the prompt,\n * and the references go to the separate image model in its own request, so (unlike the app's\n * one-at-a-time pinned document) several of them do not compound against the agent's context.\n */\n\nimport type { WorkflowInputs, WorkflowScope } from '../../agents/workflows/types'\nimport { buildRetrievalChunkTool, buildRetrievalFullContextTool } from '@arbidocs/sdk/browser'\nimport type { TurnTools } from '@arbidocs/react'\nimport { GENERATE_IMAGE_ID, IMAGE_ASPECT_AUTO } from '../../agents/workflows/catalogue/seed'\n\nexport interface PromptBinding {\n /** Attach the scoped files to the chat (default true). Off when the files are tool inputs. */\n attachScope: boolean\n /** Structured tools for the one send, from the form's inputs. */\n tools?: (inputs: WorkflowInputs) => TurnTools\n}\n\nconst referencesOf = (inputs: WorkflowInputs): string[] => {\n const value = inputs.references as WorkflowScope | undefined\n return value?.documents ?? []\n}\n\nexport const PROMPT_BINDINGS: Record<string, PromptBinding> = {\n [GENERATE_IMAGE_ID]: {\n attachScope: false,\n tools: (inputs) => {\n const aspectRatio = typeof inputs.aspect_ratio === 'string' ? inputs.aspect_ratio : ''\n return {\n retrieval_chunk: buildRetrievalChunkTool([]),\n retrieval_full_context: buildRetrievalFullContextTool(referencesOf(inputs)),\n ...(aspectRatio && aspectRatio !== IMAGE_ASPECT_AUTO\n ? {\n image_generation: {\n name: 'image_generation' as const,\n description: 'image generation',\n tool_args: { aspect_ratio: aspectRatio },\n tool_responses: {},\n },\n }\n : {}),\n }\n },\n },\n}\n","/**\n * The host side of the launch contract: `onLaunch({workflow, inputs, scope, agentId})`.\n *\n * Blocks only say WHAT to run; this performs it, so workspace isolation stays host-side:\n *\n * - prompt workflow, my assistant: open a fresh chat (or stay in this one when `inPlace`), scope\n * its documents, set the composed draft and ask for it to be sent (`autoSendDraft`). The host's\n * send waits for the new chat's documents to be seeded, so a scoped run is never sent with the\n * wrong files. Order matters: `openNewConversation` resets the draft, so it is set after it.\n * - prompt workflow, another agent: a run-now task assigned to that agent (the interactive chat\n * query has no agent parameter), created through the same path as the task composer.\n * - operation workflow (tier B): the handler bound to its id (annotation).\n * - a workflow's own model becomes the chat's (`useApplyChatModel`).\n *\n * The prompt is composed in exactly one place: `composeWorkflowPrompt(workflow, inputs)`.\n */\n\nimport {\n useApplyChatModel,\n useArbiSessionStore,\n useCreateTag,\n useDocuments,\n useGenerateDocTags,\n useTags,\n useUpdateTag,\n} from '@arbidocs/react'\nimport { getDocumentTitle } from '@arbidocs/react/ui'\nimport { useCallback, useMemo } from 'react'\nimport { composeWorkflowPrompt, isEmptyWorkflowScope } from '../../agents/workflows/workflow'\nimport { documentScopeLabels, matchWorkflowScope } from '../../agents/workflows/workspaceScope'\nimport {\n type WorkflowInputs,\n type WorkflowLanding,\n type WorkflowLaunch,\n} from '../../agents/workflows/types'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { PROMPT_BINDINGS } from './launch-bindings'\nimport { ANNOTATE_ID } from '../../agents/workflows/catalogue/seed'\nimport { useWorkflowTasks } from './useWorkflowTasks'\nimport { recordWorkflowUse } from '../../agents/workflows/catalogue/workflow-usage'\n\nexport interface UseLaunchWorkflowOptions {\n /**\n * Where launches from this surface land, over each workflow's own default. The empty chat and\n * the slash menu send into the conversation on screen (`current-chat`); everything else opens a\n * fresh one. A single launch can still override it (`WorkflowLaunch.landing`).\n */\n landing?: WorkflowLanding\n /**\n * A prompt run on the user's own assistant is sent here instead of through the session's draft:\n * the surface's own chat (`ChatPage`) or its own ask (the document ask). Everything else is the\n * same: the file scope, the workflow's model and its bound tools are set on the session in scope\n * (before a send in place, after a send that opens a fresh chat), so the turn carries them.\n */\n send?: (prompt: string) => void\n}\n\nconst text = (inputs: WorkflowInputs, name: string): string => {\n const v = inputs[name]\n return typeof v === 'string' ? v.trim() : ''\n}\n\nexport function useLaunchWorkflow({\n landing: surfaceLanding,\n send,\n}: UseLaunchWorkflowOptions = {}) {\n const { data: documents = [] } = useDocuments()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n const createTag = useCreateTag()\n const updateTag = useUpdateTag()\n const generate = useGenerateDocTags()\n const { create: createTask } = useWorkflowTasks()\n const applyModel = useApplyChatModel()\n const session = useArbiSessionStore()\n const { notify, openFiles, openNewConversation } = useBlocksEnvironment()\n\n /** Annotation: create (or reuse) the label, start the AI run, land on Files filtered to the set. */\n const annotate = useCallback(\n async ({ inputs, scope }: WorkflowLaunch) => {\n const description = text(inputs, 'description')\n const name = text(inputs, 'name') || deriveAnnotationName(description)\n const matching = matchWorkflowScope(documents, scope)\n if (!name || !description || matching.length === 0) return\n try {\n // A same-named label is reused rather than duplicated, the rule the Files page's\n // label-creation paths follow.\n const existing = tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n let tagId: string\n if (existing) {\n tagId = existing.external_id\n await updateTag.mutateAsync({\n tagId: tagId,\n change: { instruction: description },\n })\n } else {\n const created = await createTag.mutateAsync({\n name,\n tagType: { type: 'text', options: [] },\n shared: true,\n instruction: description,\n })\n const createdId = (created as { external_id?: string } | undefined)?.external_id\n if (!createdId) throw new Error('tag create returned no id')\n tagId = createdId\n }\n const docIds = matching.map((d) => d.external_id)\n // overwrite=true so a re-run on an existing field refreshes stale values, matching the\n // Files page's default review behaviour.\n await generate.mutateAsync({ tagIds: [tagId], docIds: docIds, overwrite: true })\n // Land on Files with those documents selected and the view narrowed to the annotated set\n // through the same tri-state quick filter the pickers write to. An empty scope selected\n // every file, so no filter is applied.\n const filters: Record<string, 'include'> = {}\n scope.folders.forEach((folder) => {\n filters[folder === '' ? 'folder:none' : `folder:${folder}`] = 'include'\n })\n scope.labels.forEach((labelId) => {\n filters[labelId] = 'include'\n })\n openFiles({ select: docIds, filters })\n } catch (error) {\n notify('Could not start the annotation', 'error')\n throw error\n }\n },\n [documents, tags, createTag, updateTag, generate, openFiles, notify]\n )\n\n return useCallback(\n async (launch: WorkflowLaunch) => {\n const { workflow, inputs, scope, agentId } = launch\n if (workflow.run.kind === 'operation') {\n if (workflow.id === ANNOTATE_ID) {\n await annotate(launch)\n recordWorkflowUse(workflow.id)\n return\n }\n throw new Error(`No host handler for workflow \"${workflow.id}\"`)\n }\n\n // Names for the wording: a `documents` field quotes the files it picked.\n const documentTitles = Object.fromEntries(\n documents.map((d) => [d.external_id, getDocumentTitle(d, d.external_id)])\n )\n const prompt = composeWorkflowPrompt(workflow, inputs, { documentTitles })\n if (!prompt) return\n recordWorkflowUse(workflow.id)\n\n if (agentId) {\n try {\n const created = await createTask({\n workflow,\n values: {\n assignee: 'agent',\n workflowId: workflow.id,\n inputs,\n when: 'now',\n runAt: '',\n rrule: '',\n timezone: 'UTC',\n eventKind: '',\n afterTaskId: '',\n parentTaskId: '',\n shared: true,\n description: '',\n dueAt: '',\n agentId,\n name: '',\n notifyOnComplete: true,\n access: 'ask_each_run',\n },\n })\n const ran = created.kind === 'work' ? created.ran : null\n const title = created.kind === 'work' ? created.task.title : created.workflow.name\n notify(\n ran === false\n ? 'Task created, but the run could not start'\n : `Running \\u201c${title ?? workflow.title}\\u201d`,\n ran === false ? 'warning' : 'success'\n )\n } catch (error) {\n notify(\n error instanceof Error && error.message.startsWith('Open a workspace')\n ? error.message\n : 'Could not start the run',\n 'error'\n )\n throw error\n }\n return\n }\n\n const landing = launch.landing ?? surfaceLanding ?? workflow.landing\n const inPlace = landing === 'current-chat'\n const binding = PROMPT_BINDINGS[workflow.id]\n /** The run's setup on the session in scope: its file scope, its model, its bound tools. */\n const prepare = () => {\n // Scope the chat to the chosen files when a restriction was made; otherwise the\n // workspace's usual \"all documents\" attachment (useDocumentAutoAdd) applies.\n if (binding?.attachScope !== false && !isEmptyWorkflowScope(scope)) {\n const ids = matchWorkflowScope(documents, scope).map((d) => d.external_id)\n if (ids.length > 0) {\n session.setConversationDocuments(\n inPlace ? (session.getState().conversationId ?? 'new') : 'new',\n ids.map((docId) => ({ docId, isPinned: false }))\n )\n }\n }\n if (workflow.model) void applyModel(workflow.model, `Workflow - ${workflow.title}`)\n // The tools ride the next send of the session in scope.\n session.setPendingTools(binding?.tools?.(inputs) ?? null)\n }\n // A fresh chat's reset clears the draft and the model, so the setup follows it. A surface\n // with its own send sends in its chat (set up first) or opens a fresh one (set up after).\n if (send) {\n if (inPlace) prepare()\n send(prompt)\n if (!inPlace) prepare()\n return\n }\n if (!inPlace) openNewConversation()\n prepare()\n session.setDraft(prompt)\n session.setAutoSendDraft(true)\n },\n [\n annotate,\n applyModel,\n createTask,\n documents,\n surfaceLanding,\n session,\n notify,\n openNewConversation,\n send,\n ]\n )\n}\n","/**\n * The workflow launcher, wired to run what it launches: `ConnectedWorkflowLauncher` (the\n * workspace's files behind scope and file fields, the user's agents behind \"Run as\") with the one\n * launch handler (`useLaunchWorkflow`), the host's upload dialog for adding files\n * (`environment.openUpload`), and the touches of the annotation operation (its derived name and\n * overwrite warning, \"Annotate N documents\").\n *\n * The dashboard's Start band, Files (\"Create new\") and, headless, the slash menu use it.\n */\n\nimport { useTags } from '@arbidocs/react'\nimport { useCallback, useMemo, type ReactNode } from 'react'\nimport { TriangleAlert } from 'lucide-react'\nimport { documentScopeLabels } from '../../agents/workflows/workspaceScope'\nimport {\n type OnWorkflowLaunch,\n type WorkflowDefinition,\n type WorkflowField,\n type WorkflowInputs,\n type WorkflowLanding,\n} from '../../agents/workflows/types'\nimport { ConnectedWorkflowLauncher } from '../ConnectedWorkflowLauncher'\nimport { type StartTile } from '../../home/StartTiles'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useHost } from '../../provider/host'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { ANNOTATE_ID, renderWorkflowIcon } from '../../agents/workflows/catalogue/seed'\nimport { useLaunchWorkflow } from './useLaunchWorkflow'\n\n// The agent picker names the person it hands the work to: the default \"Run as\" / \"My assistant\"\n// copy did not say who an assistant is.\nconst AGENT_LABELS = { label: 'Who this runs for', myAssistant: 'Me (your own assistant)' }\n\nexport interface ConnectedWorkflowStartProps {\n workflows: WorkflowDefinition[]\n /** Which of `workflows` get a tile (a filtered or capped view). */\n tileWorkflows?: WorkflowDefinition[]\n /** Render the Start band (off when another surface opens the dialog). */\n showTiles?: boolean\n caption?: string\n captionTestId?: string\n testId?: string\n /** Plain tiles appended to the band (e.g. the \"Create a file\" menu). */\n extraTiles?: StartTile[]\n /** Controlled open workflow id. */\n activeId?: string | null\n onActiveIdChange?: (id: string | null) => void\n initialInputsFor?: (workflow: WorkflowDefinition) => Partial<WorkflowInputs> | undefined\n /** Where launches land, over each workflow's default (`current-chat` = the chat on screen). */\n landing?: WorkflowLanding\n /** A prompt run's own send (a chat that is not the session's conversation). See `useLaunchWorkflow`. */\n send?: (prompt: string) => void\n /**\n * Run a launch here instead of the usual way (`useLaunchWorkflow`): a surface that wants the\n * result itself, e.g. the presentation, which adds a generated image to its clips. The dialog\n * shows it running until it resolves, closes then, and stays open if it throws.\n */\n onLaunch?: OnWorkflowLaunch\n /**\n * Files added from a `documents` field are uploaded right in the field instead of through the\n * host's upload dialog: for a dialog in a popped-out window, where the host's dialog would open\n * in the app's window, out of sight, and block this one.\n */\n uploadInPlace?: boolean\n /** The host's own \"Add\" control, offered when a workflow needs files and there are none. */\n addFilesAction?: ReactNode\n tileTestId?: (workflow: WorkflowDefinition) => string | undefined\n disabledReason?: (workflow: WorkflowDefinition) => string | undefined\n}\n\nexport function ConnectedWorkflowStart({\n workflows,\n landing,\n send,\n addFilesAction,\n onLaunch: launchHere,\n uploadInPlace = false,\n ...rest\n}: ConnectedWorkflowStartProps) {\n const launchUsually = useLaunchWorkflow({ landing, send })\n const onLaunch = launchHere ?? launchUsually\n // The host's icons first (a skill pack names its own), then the kit's, then the skill icon.\n const hostIcon = useHost().workflows?.renderIcon\n const renderIcon = useCallback(\n (key: string) => hostIcon?.(key) ?? renderWorkflowIcon(key) ?? renderWorkflowIcon('skill'),\n [hostIcon]\n )\n const { openUpload } = useBlocksEnvironment()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n\n // The annotation's name is optional: left blank it is taken from the question, which the\n // field's placeholder shows before anything runs.\n const fieldPlaceholder = useCallback(\n (field: WorkflowField, inputs: WorkflowInputs, workflow: WorkflowDefinition) => {\n if (workflow.id !== ANNOTATE_ID || field.name !== 'name') return undefined\n const derived = deriveAnnotationName(String(inputs.description ?? ''))\n return derived ? `Otherwise “${derived}”` : 'Taken from the description'\n },\n []\n )\n\n return (\n <ConnectedWorkflowLauncher\n {...rest}\n workflows={workflows}\n onLaunch={onLaunch}\n renderIcon={renderIcon}\n onAddFiles={uploadInPlace ? undefined : openUpload}\n agentLabels={AGENT_LABELS}\n addFilesAction={addFilesAction}\n fieldPlaceholder={fieldPlaceholder}\n submitLabel={({ workflow, matchedCount }) =>\n workflow.id === ANNOTATE_ID && matchedCount !== null\n ? `Annotate ${matchedCount} document${matchedCount !== 1 ? 's' : ''}`\n : undefined\n }\n renderNotice={({ workflow, inputs }) => {\n if (workflow.id !== ANNOTATE_ID) return null\n // A same-named label is reused: warn that this overwrites its stored description and the\n // cell values for the selected documents.\n const name =\n String(inputs.name ?? '').trim() || deriveAnnotationName(String(inputs.description ?? ''))\n const existing = name\n ? tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n : undefined\n if (!existing) return null\n return (\n <div\n className=\"flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-amber-800 dark:text-amber-200\"\n role=\"status\"\n data-testid=\"workflow-existing-label-warning\"\n >\n <TriangleAlert className=\"mt-0.5 size-4 shrink-0 text-amber-500\" />\n <span>\n An annotation called <span className=\"font-medium\">{existing.name}</span> already\n exists. Annotating will overwrite its description and the current cell values for the\n selected files.\n </span>\n </div>\n )\n }}\n />\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/connection/workflows/launch-bindings.ts","../src/connection/workflows/useLaunchWorkflow.ts","../src/connection/workflows/ConnectedWorkflowStart.tsx"],"names":["GENERATE_IMAGE_ID","buildRetrievalChunkTool","buildRetrievalFullContextTool","IMAGE_ASPECT_AUTO","useDocuments","useTags","useMemo","documentScopeLabels","useCreateTag","useUpdateTag","useGenerateDocTags","useWorkflowTasks","useApplyChatModel","useArbiSessionStore","useBlocksEnvironment","useCallback","deriveAnnotationName","matchWorkflowScope","ANNOTATE_ID","recordWorkflowUse","getDocumentTitle","composeWorkflowPrompt","isEmptyWorkflowScope","useHost","renderWorkflowIcon","jsx","ConnectedWorkflowLauncher","jsxs","TriangleAlert"],"mappings":";;;;;;;;;;;;;;;;AAwBA,IAAM,YAAA,GAAe,CAAC,MAAA,KAAqC;AACzD,EAAA,MAAM,QAAQ,MAAA,CAAO,UAAA;AACrB,EAAA,OAAO,KAAA,EAAO,aAAa,EAAC;AAC9B,CAAA;AAEO,IAAM,eAAA,GAAiD;AAAA,EAC5D,CAACA,mCAAiB,GAAG;AAAA,IACnB,WAAA,EAAa,KAAA;AAAA,IACb,KAAA,EAAO,CAAC,MAAA,KAAW;AACjB,MAAA,MAAM,cAAc,OA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* same way the annotation operation is: blocks and the registry stay declarative, and the one\n * place that knows the wire shape is here.\n *\n * Generate image: the reference images and the aspect ratio ride structured tool arguments\n * (`retrieval_full_context` over every reference, `image_generation.aspect_ratio`), never the\n * prompt text: the image model does not reliably honour a shape or sources worded into the prompt,\n * and the references go to the separate image model in its own request, so (unlike the app's\n * one-at-a-time pinned document) several of them do not compound against the agent's context.\n */\n\nimport type { WorkflowInputs, WorkflowScope } from '../../agents/workflows/types'\nimport { buildRetrievalChunkTool, buildRetrievalFullContextTool } from '@arbidocs/sdk/browser'\nimport type { TurnTools } from '@arbidocs/react'\nimport { GENERATE_IMAGE_ID, IMAGE_ASPECT_AUTO } from '../../agents/workflows/catalogue/seed'\n\nexport interface PromptBinding {\n /** Attach the scoped files to the chat (default true). Off when the files are tool inputs. */\n attachScope: boolean\n /** Structured tools for the one send, from the form's inputs. */\n tools?: (inputs: WorkflowInputs) => TurnTools\n}\n\nconst referencesOf = (inputs: WorkflowInputs): string[] => {\n const value = inputs.references as WorkflowScope | undefined\n return value?.documents ?? []\n}\n\nexport const PROMPT_BINDINGS: Record<string, PromptBinding> = {\n [GENERATE_IMAGE_ID]: {\n attachScope: false,\n tools: (inputs) => {\n const aspectRatio = typeof inputs.aspect_ratio === 'string' ? inputs.aspect_ratio : ''\n return {\n retrieval_chunk: buildRetrievalChunkTool([]),\n retrieval_full_context: buildRetrievalFullContextTool(referencesOf(inputs)),\n ...(aspectRatio && aspectRatio !== IMAGE_ASPECT_AUTO\n ? {\n image_generation: {\n name: 'image_generation' as const,\n description: 'image generation',\n tool_args: { aspect_ratio: aspectRatio },\n tool_responses: {},\n },\n }\n : {}),\n }\n },\n },\n}\n","/**\n * The host side of the launch contract: `onLaunch({workflow, inputs, scope, agentId})`.\n *\n * Blocks only say WHAT to run; this performs it, so workspace isolation stays host-side:\n *\n * - prompt workflow, my assistant: open a fresh chat (or stay in this one when `inPlace`), scope\n * its documents, set the composed draft and ask for it to be sent (`autoSendDraft`). The host's\n * send waits for the new chat's documents to be seeded, so a scoped run is never sent with the\n * wrong files. Order matters: `openNewConversation` resets the draft, so it is set after it.\n * - prompt workflow, another agent: a run-now task assigned to that agent (the interactive chat\n * query has no agent parameter), created through the same path as the task composer.\n * - operation workflow (tier B): the handler bound to its id (annotation).\n * - a workflow's own model becomes the chat's (`useApplyChatModel`).\n *\n * The prompt is composed in exactly one place: `composeWorkflowPrompt(workflow, inputs)`.\n */\n\nimport {\n useApplyChatModel,\n useArbiSessionStore,\n useCreateTag,\n useDocuments,\n useGenerateDocTags,\n useTags,\n useUpdateTag,\n} from '@arbidocs/react'\nimport { getDocumentTitle } from '@arbidocs/react/ui'\nimport { useCallback, useMemo } from 'react'\nimport { composeWorkflowPrompt, isEmptyWorkflowScope } from '../../agents/workflows/workflow'\nimport { documentScopeLabels, matchWorkflowScope } from '../../agents/workflows/workspaceScope'\nimport {\n type WorkflowInputs,\n type WorkflowLanding,\n type WorkflowLaunch,\n} from '../../agents/workflows/types'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { PROMPT_BINDINGS } from './launch-bindings'\nimport { ANNOTATE_ID } from '../../agents/workflows/catalogue/seed'\nimport { useWorkflowTasks } from './useWorkflowTasks'\nimport { recordWorkflowUse } from '../../agents/workflows/catalogue/workflow-usage'\n\nexport interface UseLaunchWorkflowOptions {\n /**\n * Where launches from this surface land, over each workflow's own default. The empty chat and\n * the slash menu send into the conversation on screen (`current-chat`); everything else opens a\n * fresh one. A single launch can still override it (`WorkflowLaunch.landing`).\n */\n landing?: WorkflowLanding\n /**\n * A prompt run on the user's own assistant is sent here instead of through the session's draft:\n * the surface's own chat (`ChatPage`) or its own ask (the document ask). Everything else is the\n * same: the file scope, the workflow's model and its bound tools are set on the session in scope\n * (before a send in place, after a send that opens a fresh chat), so the turn carries them.\n */\n send?: (prompt: string) => void\n}\n\nconst text = (inputs: WorkflowInputs, name: string): string => {\n const v = inputs[name]\n return typeof v === 'string' ? v.trim() : ''\n}\n\nexport function useLaunchWorkflow({\n landing: surfaceLanding,\n send,\n}: UseLaunchWorkflowOptions = {}) {\n const { data: documents = [] } = useDocuments()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n const createTag = useCreateTag()\n const updateTag = useUpdateTag()\n const generate = useGenerateDocTags()\n const { create: createTask } = useWorkflowTasks()\n const applyModel = useApplyChatModel()\n const session = useArbiSessionStore()\n const { notify, openFiles, openNewConversation } = useBlocksEnvironment()\n\n /** Annotation: create (or reuse) the label, start the AI run, land on Files filtered to the set. */\n const annotate = useCallback(\n async ({ inputs, scope }: WorkflowLaunch) => {\n const description = text(inputs, 'description')\n const name = text(inputs, 'name') || deriveAnnotationName(description)\n const matching = matchWorkflowScope(documents, scope)\n if (!name || !description || matching.length === 0) return\n try {\n // A same-named label is reused rather than duplicated, the rule the Files page's\n // label-creation paths follow.\n const existing = tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n let tagId: string\n if (existing) {\n tagId = existing.external_id\n await updateTag.mutateAsync({\n tagId: tagId,\n change: { instruction: description },\n })\n } else {\n const created = await createTag.mutateAsync({\n name,\n tagType: { type: 'text', options: [] },\n shared: true,\n instruction: description,\n })\n const createdId = (created as { external_id?: string } | undefined)?.external_id\n if (!createdId) throw new Error('tag create returned no id')\n tagId = createdId\n }\n const docIds = matching.map((d) => d.external_id)\n // overwrite=true so a re-run on an existing field refreshes stale values, matching the\n // Files page's default review behaviour.\n await generate.mutateAsync({ tagIds: [tagId], docIds: docIds, overwrite: true })\n // Land on Files with those documents selected and the view narrowed to the annotated set\n // through the same tri-state quick filter the pickers write to. An empty scope selected\n // every file, so no filter is applied.\n const filters: Record<string, 'include'> = {}\n scope.folders.forEach((folder) => {\n filters[folder === '' ? 'folder:none' : `folder:${folder}`] = 'include'\n })\n scope.labels.forEach((labelId) => {\n filters[labelId] = 'include'\n })\n openFiles({ select: docIds, filters })\n } catch (error) {\n notify('Could not start the annotation', 'error')\n throw error\n }\n },\n [documents, tags, createTag, updateTag, generate, openFiles, notify]\n )\n\n return useCallback(\n async (launch: WorkflowLaunch) => {\n const { workflow, inputs, scope, agentId } = launch\n if (workflow.run.kind === 'operation') {\n if (workflow.id === ANNOTATE_ID) {\n await annotate(launch)\n recordWorkflowUse(workflow.id)\n return\n }\n throw new Error(`No host handler for workflow \"${workflow.id}\"`)\n }\n\n // Names for the wording: a `documents` field quotes the files it picked.\n const documentTitles = Object.fromEntries(\n documents.map((d) => [d.external_id, getDocumentTitle(d, d.external_id)])\n )\n const prompt = composeWorkflowPrompt(workflow, inputs, { documentTitles })\n if (!prompt) return\n recordWorkflowUse(workflow.id)\n\n if (agentId) {\n try {\n const created = await createTask({\n workflow,\n values: {\n assignee: 'agent',\n workflowId: workflow.id,\n inputs,\n when: 'now',\n runAt: '',\n rrule: '',\n timezone: 'UTC',\n eventKind: '',\n afterTaskId: '',\n parentTaskId: '',\n shared: true,\n description: '',\n dueAt: '',\n agentId,\n name: '',\n notifyOnComplete: true,\n access: 'ask_each_run',\n },\n })\n const ran = created.kind === 'work' ? created.ran : null\n const title = created.kind === 'work' ? created.task.title : created.workflow.name\n notify(\n ran === false\n ? 'Task created, but the run could not start'\n : `Running \\u201c${title ?? workflow.title}\\u201d`,\n ran === false ? 'warning' : 'success'\n )\n } catch (error) {\n notify(\n error instanceof Error && error.message.startsWith('Open a workspace')\n ? error.message\n : 'Could not start the run',\n 'error'\n )\n throw error\n }\n return\n }\n\n const landing = launch.landing ?? surfaceLanding ?? workflow.landing\n const inPlace = landing === 'current-chat'\n const binding = PROMPT_BINDINGS[workflow.id]\n /** The run's setup on the session in scope: its file scope, its model, its bound tools. */\n const prepare = () => {\n // Scope the chat to the chosen files when a restriction was made; otherwise the\n // workspace's usual \"all documents\" attachment (useDocumentAutoAdd) applies.\n if (binding?.attachScope !== false && !isEmptyWorkflowScope(scope)) {\n const ids = matchWorkflowScope(documents, scope).map((d) => d.external_id)\n if (ids.length > 0) {\n session.setConversationDocuments(\n inPlace ? (session.getState().conversationId ?? 'new') : 'new',\n ids.map((docId) => ({ docId, isPinned: false }))\n )\n }\n }\n if (workflow.model) void applyModel(workflow.model, `Workflow - ${workflow.title}`)\n // The tools ride the next send of the session in scope.\n session.setPendingTools(binding?.tools?.(inputs) ?? null)\n }\n // A fresh chat's reset clears the draft and the model, so the setup follows it. A surface\n // with its own send sends in its chat (set up first) or opens a fresh one (set up after).\n if (send) {\n if (inPlace) prepare()\n send(prompt)\n if (!inPlace) prepare()\n return\n }\n if (!inPlace) openNewConversation()\n prepare()\n session.setDraft(prompt)\n session.setAutoSendDraft(true)\n },\n [\n annotate,\n applyModel,\n createTask,\n documents,\n surfaceLanding,\n session,\n notify,\n openNewConversation,\n send,\n ]\n )\n}\n","/**\n * The workflow launcher, wired to run what it launches: `ConnectedWorkflowLauncher` (the\n * workspace's files behind scope and file fields, the user's agents behind \"Run as\") with the one\n * launch handler (`useLaunchWorkflow`), the host's upload dialog for adding files\n * (`environment.openUpload`), and the touches of the annotation operation (its derived name and\n * overwrite warning, \"Annotate N documents\").\n *\n * The dashboard's Start band, Files (\"Create new\") and, headless, the slash menu use it.\n */\n\nimport { useTags } from '@arbidocs/react'\nimport { useCallback, useMemo, type ReactNode } from 'react'\nimport { TriangleAlert } from 'lucide-react'\nimport { documentScopeLabels } from '../../agents/workflows/workspaceScope'\nimport {\n type OnWorkflowLaunch,\n type WorkflowDefinition,\n type WorkflowField,\n type WorkflowInputs,\n type WorkflowLanding,\n} from '../../agents/workflows/types'\nimport { ConnectedWorkflowLauncher } from '../ConnectedWorkflowLauncher'\nimport { type StartTile } from '../../home/StartTiles'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useHost } from '../../provider/host'\nimport { deriveAnnotationName } from '../../agents/workflows/catalogue/annotation-name'\nimport { ANNOTATE_ID, renderWorkflowIcon } from '../../agents/workflows/catalogue/seed'\nimport { useLaunchWorkflow } from './useLaunchWorkflow'\n\n// The agent picker names the person it hands the work to: the default \"Run as\" / \"My assistant\"\n// copy did not say who an assistant is.\nconst AGENT_LABELS = { label: 'Who this runs for', myAssistant: 'Me (your own assistant)' }\n\nexport interface ConnectedWorkflowStartProps {\n workflows: WorkflowDefinition[]\n /** Which of `workflows` get a tile (a filtered or capped view). */\n tileWorkflows?: WorkflowDefinition[]\n /** Render the Start band (off when another surface opens the dialog). */\n showTiles?: boolean\n caption?: string\n captionTestId?: string\n testId?: string\n /** Plain tiles appended to the band (e.g. the \"Create a file\" menu). */\n extraTiles?: StartTile[]\n /** Controlled open workflow id. */\n activeId?: string | null\n onActiveIdChange?: (id: string | null) => void\n initialInputsFor?: (workflow: WorkflowDefinition) => Partial<WorkflowInputs> | undefined\n /** Where launches land, over each workflow's default (`current-chat` = the chat on screen). */\n landing?: WorkflowLanding\n /** A prompt run's own send (a chat that is not the session's conversation). See `useLaunchWorkflow`. */\n send?: (prompt: string) => void\n /**\n * Run a launch here instead of the usual way (`useLaunchWorkflow`): a surface that wants the\n * result itself, e.g. the presentation, which adds a generated image to its clips. The dialog\n * shows it running until it resolves, closes then, and stays open if it throws.\n */\n onLaunch?: OnWorkflowLaunch\n /**\n * Files added from a `documents` field are uploaded right in the field instead of through the\n * host's upload dialog: for a dialog in a popped-out window, where the host's dialog would open\n * in the app's window, out of sight, and block this one.\n */\n uploadInPlace?: boolean\n /** The host's own \"Add\" control, offered when a workflow needs files and there are none. */\n addFilesAction?: ReactNode\n tileTestId?: (workflow: WorkflowDefinition) => string | undefined\n disabledReason?: (workflow: WorkflowDefinition) => string | undefined\n}\n\nexport function ConnectedWorkflowStart({\n workflows,\n landing,\n send,\n addFilesAction,\n onLaunch: launchHere,\n uploadInPlace = false,\n ...rest\n}: ConnectedWorkflowStartProps) {\n const launchUsually = useLaunchWorkflow({ landing, send })\n const onLaunch = launchHere ?? launchUsually\n // The host's icons first (a skill pack names its own), then the kit's, then the skill icon.\n const hostIcon = useHost().workflows?.renderIcon\n const renderIcon = useCallback(\n (key: string) => hostIcon?.(key) ?? renderWorkflowIcon(key) ?? renderWorkflowIcon('skill'),\n [hostIcon]\n )\n const { openUpload } = useBlocksEnvironment()\n const { data: workspaceTags = [] } = useTags()\n const tags = useMemo(() => documentScopeLabels(workspaceTags), [workspaceTags])\n\n // The annotation's name is optional: left blank it is taken from the question, which the\n // field's placeholder shows before anything runs.\n const fieldPlaceholder = useCallback(\n (field: WorkflowField, inputs: WorkflowInputs, workflow: WorkflowDefinition) => {\n if (workflow.id !== ANNOTATE_ID || field.name !== 'name') return undefined\n const derived = deriveAnnotationName(String(inputs.description ?? ''))\n return derived ? `Otherwise “${derived}”` : 'Taken from the description'\n },\n []\n )\n\n return (\n <ConnectedWorkflowLauncher\n {...rest}\n workflows={workflows}\n onLaunch={onLaunch}\n renderIcon={renderIcon}\n onAddFiles={uploadInPlace ? undefined : openUpload}\n agentLabels={AGENT_LABELS}\n addFilesAction={addFilesAction}\n fieldPlaceholder={fieldPlaceholder}\n submitLabel={({ workflow, matchedCount }) =>\n workflow.id === ANNOTATE_ID && matchedCount !== null\n ? `Annotate ${matchedCount} document${matchedCount !== 1 ? 's' : ''}`\n : undefined\n }\n renderNotice={({ workflow, inputs }) => {\n if (workflow.id !== ANNOTATE_ID) return null\n // A same-named label is reused: warn that this overwrites its stored description and the\n // cell values for the selected documents.\n const name =\n String(inputs.name ?? '').trim() || deriveAnnotationName(String(inputs.description ?? ''))\n const existing = name\n ? tags.find((t) => t.name.toLowerCase() === name.toLowerCase())\n : undefined\n if (!existing) return null\n return (\n <div\n className=\"flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-amber-800 dark:text-amber-200\"\n role=\"status\"\n data-testid=\"workflow-existing-label-warning\"\n >\n <TriangleAlert className=\"mt-0.5 size-4 shrink-0 text-amber-500\" />\n <span>\n An annotation called <span className=\"font-medium\">{existing.name}</span> already\n exists. Annotating will overwrite its description and the current cell values for the\n selected files.\n </span>\n </div>\n )\n }}\n />\n )\n}\n"]}
@@ -2,29 +2,29 @@
2
2
  'use strict';
3
3
 
4
4
  var chunkCYN66TBO_cjs = require('./chunk-CYN66TBO.cjs');
5
- var chunkFWD4WSGR_cjs = require('./chunk-FWD4WSGR.cjs');
5
+ var chunk73ECBDG7_cjs = require('./chunk-73ECBDG7.cjs');
6
6
  var chunkI4IS6ST6_cjs = require('./chunk-I4IS6ST6.cjs');
7
7
  var chunk7D4WXUBS_cjs = require('./chunk-7D4WXUBS.cjs');
8
- var chunkIN6ILI5A_cjs = require('./chunk-IN6ILI5A.cjs');
9
- var chunkKMOIE2XH_cjs = require('./chunk-KMOIE2XH.cjs');
10
8
  var chunkOYXWQTHF_cjs = require('./chunk-OYXWQTHF.cjs');
11
9
  var chunkS237ORM3_cjs = require('./chunk-S237ORM3.cjs');
12
10
  var chunkII2OEXHW_cjs = require('./chunk-II2OEXHW.cjs');
13
- var chunkFX3K6LNZ_cjs = require('./chunk-FX3K6LNZ.cjs');
14
- var chunkRYVZDFVO_cjs = require('./chunk-RYVZDFVO.cjs');
11
+ var chunkJJZOL5MG_cjs = require('./chunk-JJZOL5MG.cjs');
15
12
  var chunk3YEXZX4H_cjs = require('./chunk-3YEXZX4H.cjs');
16
- var chunkBSZ45U3F_cjs = require('./chunk-BSZ45U3F.cjs');
13
+ var chunkYZ25NAR3_cjs = require('./chunk-YZ25NAR3.cjs');
17
14
  var chunkAHDJXIUB_cjs = require('./chunk-AHDJXIUB.cjs');
18
- var chunkS5OGPQSB_cjs = require('./chunk-S5OGPQSB.cjs');
19
15
  var chunkRL2HI6NP_cjs = require('./chunk-RL2HI6NP.cjs');
20
16
  var chunk6UZC4XVV_cjs = require('./chunk-6UZC4XVV.cjs');
21
- var chunkI2LJ7RZ2_cjs = require('./chunk-I2LJ7RZ2.cjs');
22
- var chunkXPQR2PJX_cjs = require('./chunk-XPQR2PJX.cjs');
17
+ var chunkS5OGPQSB_cjs = require('./chunk-S5OGPQSB.cjs');
23
18
  var chunkOUGRCQM7_cjs = require('./chunk-OUGRCQM7.cjs');
24
- var chunkIPSHAMO2_cjs = require('./chunk-IPSHAMO2.cjs');
25
19
  var chunkZVEW3JBT_cjs = require('./chunk-ZVEW3JBT.cjs');
26
20
  var chunkSJSGSHIT_cjs = require('./chunk-SJSGSHIT.cjs');
27
21
  var chunkZW6FPIFC_cjs = require('./chunk-ZW6FPIFC.cjs');
22
+ var chunkIN6ILI5A_cjs = require('./chunk-IN6ILI5A.cjs');
23
+ var chunkKMOIE2XH_cjs = require('./chunk-KMOIE2XH.cjs');
24
+ var chunkFX3K6LNZ_cjs = require('./chunk-FX3K6LNZ.cjs');
25
+ var chunkI2LJ7RZ2_cjs = require('./chunk-I2LJ7RZ2.cjs');
26
+ var chunkXPQR2PJX_cjs = require('./chunk-XPQR2PJX.cjs');
27
+ var chunkIPSHAMO2_cjs = require('./chunk-IPSHAMO2.cjs');
28
28
  var chunkLIKDQBNJ_cjs = require('./chunk-LIKDQBNJ.cjs');
29
29
  var chunkYZBDHBKI_cjs = require('./chunk-YZBDHBKI.cjs');
30
30
  var chunkCVPV4I7Z_cjs = require('./chunk-CVPV4I7Z.cjs');
@@ -467,11 +467,21 @@ function StepBarFrame({
467
467
  keyMoved.current = false;
468
468
  box.current?.querySelector("[data-role] button")?.focus();
469
469
  }, [win.start]);
470
+ const pickedFromList = react.useRef(false);
470
471
  const select = (id) => {
472
+ pickedFromList.current = listOpen !== null;
471
473
  setListOpen(null);
472
474
  setStart(null);
473
475
  onSelect(id);
474
476
  };
477
+ const keepFocusOnPick = (e) => {
478
+ const picked = pickedFromList.current;
479
+ pickedFromList.current = false;
480
+ const focused = document.activeElement;
481
+ const list = e.currentTarget instanceof Node ? e.currentTarget : null;
482
+ if (picked && focused && focused !== document.body && !list?.contains(focused))
483
+ e.preventDefault();
484
+ };
475
485
  const onKeyDown = (e) => {
476
486
  if (!box.current?.contains(e.target)) return;
477
487
  const to = e.key === "ArrowLeft" ? win.start - 1 : e.key === "ArrowRight" ? win.start + 1 : e.key === "Home" ? 0 : e.key === "End" ? win.levels.length : null;
@@ -566,6 +576,7 @@ function StepBarFrame({
566
576
  align: "end",
567
577
  className: "max-h-[min(24rem,70vh)] w-72 overflow-y-auto p-1",
568
578
  onOpenAutoFocus: focusCurrent,
579
+ onCloseAutoFocus: keepFocusOnPick,
569
580
  "data-testid": tid("all-steps"),
570
581
  children: stepList()
571
582
  }
@@ -591,6 +602,7 @@ function StepBarFrame({
591
602
  align: side === "before" ? "start" : "end",
592
603
  className: "max-h-[min(24rem,70vh)] w-80 overflow-y-auto p-1",
593
604
  onOpenAutoFocus: focusCurrent,
605
+ onCloseAutoFocus: keepFocusOnPick,
594
606
  "data-testid": tid("all-steps"),
595
607
  children: stepList(side)
596
608
  }
@@ -1453,7 +1465,7 @@ function WorkflowRunner({
1453
1465
  /* @__PURE__ */ jsxRuntime.jsx(SentBackNote, { state: run.stateOf(step.id), l: pl, testId: tid(step.id) }),
1454
1466
  /* @__PURE__ */ jsxRuntime.jsx(AssigneeLine, { run, stepId: step.id, l: pl, testId: tid(step.id) }),
1455
1467
  /* @__PURE__ */ jsxRuntime.jsx("fieldset", { disabled: run.isLocked(step.id), className: "contents", children: /* @__PURE__ */ jsxRuntime.jsx(
1456
- chunkBSZ45U3F_cjs.SchemaForm,
1468
+ chunkYZ25NAR3_cjs.SchemaForm,
1457
1469
  {
1458
1470
  fields: step.inputs,
1459
1471
  values: run.inputs,
@@ -1503,7 +1515,7 @@ function WorkflowRunner({
1503
1515
  /* @__PURE__ */ jsxRuntime.jsx(AssigneeLine, { run, stepId: step.id, l: pl, testId: tid(step.id) }),
1504
1516
  !(run.phaseOf(step.id) === "done" && run.stateOf(step.id)?.by) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", "data-testid": tid(`${step.id}-status`), children: run.phaseOf(step.id) === "done" ? l.approved : run.phaseOf(step.id) === "skipped" ? l.skipped : l.awaitingReview }),
1505
1517
  (step.fields ?? []).length > 0 && run.phaseOf(step.id) === "ready" && /* @__PURE__ */ jsxRuntime.jsx(
1506
- chunkBSZ45U3F_cjs.SchemaForm,
1518
+ chunkYZ25NAR3_cjs.SchemaForm,
1507
1519
  {
1508
1520
  fields: step.fields ?? [],
1509
1521
  values: run.inputs,
@@ -2285,7 +2297,7 @@ function StepAction({
2285
2297
  const errors = chunkXPQR2PJX_cjs.validateInputs(asForm(step), values);
2286
2298
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2 p-1", "data-testid": tid, children: [
2287
2299
  /* @__PURE__ */ jsxRuntime.jsx(
2288
- chunkBSZ45U3F_cjs.SchemaForm,
2300
+ chunkYZ25NAR3_cjs.SchemaForm,
2289
2301
  {
2290
2302
  fields,
2291
2303
  values,
@@ -4492,16 +4504,16 @@ var DEFAULT_RECURRENCE_BUILDER_LABELS = {
4492
4504
  var pad2 = (n) => String(n).padStart(2, "0");
4493
4505
  function RecurrenceBuilder({ rrule, onChange, testIds, labels }) {
4494
4506
  const l = { ...DEFAULT_RECURRENCE_BUILDER_LABELS, ...labels };
4495
- const [advanced, setAdvanced] = react.useState(() => !!rrule && chunkFWD4WSGR_cjs.parseRRule(rrule) === null);
4507
+ const [advanced, setAdvanced] = react.useState(() => !!rrule && chunk73ECBDG7_cjs.parseRRule(rrule) === null);
4496
4508
  const [preset, setPreset] = react.useState(
4497
- () => chunkFWD4WSGR_cjs.parseRRule(rrule) ?? chunkFWD4WSGR_cjs.DEFAULT_RECURRENCE
4509
+ () => chunk73ECBDG7_cjs.parseRRule(rrule) ?? chunk73ECBDG7_cjs.DEFAULT_RECURRENCE
4498
4510
  );
4499
4511
  react.useEffect(() => {
4500
- if (!rrule) onChange(chunkFWD4WSGR_cjs.buildRRule(chunkFWD4WSGR_cjs.DEFAULT_RECURRENCE));
4512
+ if (!rrule) onChange(chunk73ECBDG7_cjs.buildRRule(chunk73ECBDG7_cjs.DEFAULT_RECURRENCE));
4501
4513
  }, []);
4502
4514
  const update = (next) => {
4503
4515
  setPreset(next);
4504
- onChange(chunkFWD4WSGR_cjs.buildRRule(next));
4516
+ onChange(chunk73ECBDG7_cjs.buildRRule(next));
4505
4517
  };
4506
4518
  const toggleWeekday = (day) => {
4507
4519
  const has = preset.weekdays.includes(day);
@@ -4531,9 +4543,9 @@ function RecurrenceBuilder({ rrule, onChange, testIds, labels }) {
4531
4543
  type: "button",
4532
4544
  className: "text-sm text-muted-foreground hover:text-foreground",
4533
4545
  onClick: () => {
4534
- const parsed = chunkFWD4WSGR_cjs.parseRRule(rrule);
4535
- setPreset(parsed ?? chunkFWD4WSGR_cjs.DEFAULT_RECURRENCE);
4536
- if (!parsed) onChange(chunkFWD4WSGR_cjs.buildRRule(chunkFWD4WSGR_cjs.DEFAULT_RECURRENCE));
4546
+ const parsed = chunk73ECBDG7_cjs.parseRRule(rrule);
4547
+ setPreset(parsed ?? chunk73ECBDG7_cjs.DEFAULT_RECURRENCE);
4548
+ if (!parsed) onChange(chunk73ECBDG7_cjs.buildRRule(chunk73ECBDG7_cjs.DEFAULT_RECURRENCE));
4537
4549
  setAdvanced(false);
4538
4550
  },
4539
4551
  "data-testid": chunkPLIF5CUV_cjs.testIdOr(testIds?.simple, { testId: "task-recurrence-simple" }),
@@ -4611,7 +4623,7 @@ function RecurrenceBuilder({ rrule, onChange, testIds, labels }) {
4611
4623
  ] }),
4612
4624
  preset.frequency === "weekly" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
4613
4625
  /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { children: l.on }),
4614
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1", children: chunkFWD4WSGR_cjs.WEEKDAYS.map((day) => /* @__PURE__ */ jsxRuntime.jsx(
4626
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1", children: chunk73ECBDG7_cjs.WEEKDAYS.map((day) => /* @__PURE__ */ jsxRuntime.jsx(
4615
4627
  ui.Button,
4616
4628
  {
4617
4629
  type: "button",
@@ -5364,7 +5376,7 @@ function TaskTable(props) {
5364
5376
  isMe: mine
5365
5377
  };
5366
5378
  };
5367
- const renderPerson = (person) => /* @__PURE__ */ jsxRuntime.jsx(chunkRYVZDFVO_cjs.PersonPill, { person });
5379
+ const renderPerson = (person) => /* @__PURE__ */ jsxRuntime.jsx(chunkJJZOL5MG_cjs.PersonPill, { person });
5368
5380
  const q = (query.trim() || (props.filterText ?? "").trim()).toLowerCase();
5369
5381
  const counts = react.useMemo(() => {
5370
5382
  const map = new Map(STATUS_ORDER.map((s) => [s, 0]));
@@ -6046,7 +6058,7 @@ function ConversationListView(p) {
6046
6058
  }
6047
6059
  ),
6048
6060
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0", children: liveProps.current.renderThread ? liveProps.current.renderThread(data) : /* @__PURE__ */ jsxRuntime.jsx(
6049
- chunkFWD4WSGR_cjs.EntityChip,
6061
+ chunk73ECBDG7_cjs.EntityChip,
6050
6062
  {
6051
6063
  icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageSquare, { className: "size-4", "aria-hidden": true }),
6052
6064
  label: data.title?.trim() || "Untitled thread",
@@ -7144,13 +7156,12 @@ function WorkflowThreadStrip({
7144
7156
  const barL = { ...DEFAULT_STEP_BAR_LABELS, ...barLabels };
7145
7157
  const grouped = groupThreadActivity(steps, items);
7146
7158
  const strays = signals.filter((s) => !steps.some((step) => step.id === s.step));
7147
- const [picked, setPicked] = react.useState(null);
7148
- const selected = current !== void 0 ? current : picked;
7159
+ const [open, setOpen] = react.useState(null);
7160
+ const selected = current !== void 0 ? current : open;
7149
7161
  const setSelected = (id) => {
7150
- setPicked(id);
7162
+ setOpen(id);
7151
7163
  onSelectStep?.(id);
7152
7164
  };
7153
- const [open, setOpen] = react.useState(null);
7154
7165
  const phaseOf = (id) => chunkI2LJ7RZ2_cjs.stepPhase(steps, states, id);
7155
7166
  const iconOf = (step) => step.icon && renderIcon ? renderIcon(step.icon) : void 0;
7156
7167
  const glyphOf = (step) => {
@@ -7180,8 +7191,8 @@ function WorkflowThreadStrip({
7180
7191
  {
7181
7192
  open: open === step.id,
7182
7193
  onOpenChange: (o) => {
7183
- setOpen(o ? step.id : null);
7184
7194
  if (o) setSelected(step.id);
7195
+ else setOpen((was) => was === step.id ? null : was);
7185
7196
  },
7186
7197
  children: [
7187
7198
  /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -7258,7 +7269,8 @@ function WorkflowThreadStrip({
7258
7269
  (happened.length > 0 || !finished) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-1 text-xs font-medium text-muted-foreground", children: happened.length ? l.happened.replace("{count}", String(happened.length)) : l.nothingYet }),
7259
7270
  happened.map((item) => /* @__PURE__ */ jsxRuntime.jsx(Entry, { item }, item.id)),
7260
7271
  renderStepAction?.(step, phase),
7261
- onSkip && ["ready", "blocked", "failed", "waiting"].includes(phase) && /* @__PURE__ */ jsxRuntime.jsx(
7272
+ onSkip && ["ready", "blocked", "failed", "waiting"].includes(phase) && // Skipping is done with the step: its popover closes and the bar follows the run.
7273
+ /* @__PURE__ */ jsxRuntime.jsx(ui.PopoverClose, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
7262
7274
  "button",
7263
7275
  {
7264
7276
  type: "button",
@@ -7267,7 +7279,7 @@ function WorkflowThreadStrip({
7267
7279
  "data-testid": `workflow-thread-step-${step.id}-skip`,
7268
7280
  children: l.skip
7269
7281
  }
7270
- )
7282
+ ) })
7271
7283
  ]
7272
7284
  }
7273
7285
  )
@@ -7326,10 +7338,7 @@ function WorkflowThreadStrip({
7326
7338
  levels: chunkI2LJ7RZ2_cjs.stepLevels(steps),
7327
7339
  phaseOf,
7328
7340
  current: selected,
7329
- onSelect: (id) => {
7330
- setSelected(id);
7331
- setOpen(id);
7332
- },
7341
+ onSelect: setSelected,
7333
7342
  renderStep: (step, _level, win) => pill(step, step.id === win.levels[win.currentLevel]?.primary.id || step.id === selected),
7334
7343
  renderAfter: (level) => signals.filter((s) => level.steps.some((step) => step.id === s.step)).map((s) => /* @__PURE__ */ jsxRuntime.jsx(SignalPill, { signal: s, l }, `${s.step}-${s.signal}`)),
7335
7344
  leading,
@@ -7840,7 +7849,7 @@ function WorkflowComposer({
7840
7849
  }
7841
7850
  ),
7842
7851
  !noFiles && workflow && fields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
7843
- chunkBSZ45U3F_cjs.SchemaForm,
7852
+ chunkYZ25NAR3_cjs.SchemaForm,
7844
7853
  {
7845
7854
  fields,
7846
7855
  values: values.inputs,
@@ -8472,7 +8481,7 @@ function WorkTaskComposer({
8472
8481
  )
8473
8482
  ] }),
8474
8483
  workflow && fields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
8475
- chunkBSZ45U3F_cjs.SchemaForm,
8484
+ chunkYZ25NAR3_cjs.SchemaForm,
8476
8485
  {
8477
8486
  fields,
8478
8487
  values: values.inputs,
@@ -10080,5 +10089,5 @@ exports.useWorkflowView = useWorkflowView;
10080
10089
  exports.withLabelIds = withLabelIds;
10081
10090
  exports.workflowFromSkillMarkdown = workflowFromSkillMarkdown;
10082
10091
  exports.workflowToSkillMarkdown = workflowToSkillMarkdown;
10083
- //# sourceMappingURL=chunk-FM46VQ5D.cjs.map
10084
- //# sourceMappingURL=chunk-FM46VQ5D.cjs.map
10092
+ //# sourceMappingURL=chunk-32HVYK4Q.cjs.map
10093
+ //# sourceMappingURL=chunk-32HVYK4Q.cjs.map