@arbidocs/blocks 0.5.185 → 0.5.187

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 (80) hide show
  1. package/dist/{ConnectedCallDock-CKJUL7HZ.cjs → ConnectedCallDock-PZJRO54J.cjs} +5 -5
  2. package/dist/{ConnectedCallDock-CKJUL7HZ.cjs.map → ConnectedCallDock-PZJRO54J.cjs.map} +1 -1
  3. package/dist/{ConnectedCallRoom-CDOGHVES.cjs → ConnectedCallRoom-NGSUG6MI.cjs} +5 -5
  4. package/dist/{ConnectedCallRoom-CDOGHVES.cjs.map → ConnectedCallRoom-NGSUG6MI.cjs.map} +1 -1
  5. package/dist/{ConnectedMailInviteCard-ZNBHPFKF.cjs → ConnectedMailInviteCard-DDGB4LLC.cjs} +8 -8
  6. package/dist/{ConnectedMailInviteCard-ZNBHPFKF.cjs.map → ConnectedMailInviteCard-DDGB4LLC.cjs.map} +1 -1
  7. package/dist/{ConnectedNativeDocxComparison-YP7SASIP.cjs → ConnectedNativeDocxComparison-3KTHPCMT.cjs} +8 -8
  8. package/dist/{ConnectedNativeDocxComparison-YP7SASIP.cjs.map → ConnectedNativeDocxComparison-3KTHPCMT.cjs.map} +1 -1
  9. package/dist/{ConnectedPresentation-RFUH3MXL.cjs → ConnectedPresentation-LNDESKYE.cjs} +10 -10
  10. package/dist/{ConnectedPresentation-RFUH3MXL.cjs.map → ConnectedPresentation-LNDESKYE.cjs.map} +1 -1
  11. package/dist/{ConnectedSlidesTab-CCJWFSCX.cjs → ConnectedSlidesTab-SYDDGJWM.cjs} +10 -10
  12. package/dist/{ConnectedSlidesTab-CCJWFSCX.cjs.map → ConnectedSlidesTab-SYDDGJWM.cjs.map} +1 -1
  13. package/dist/{ConnectedStreamedWordArtifact-GVVIWKFH.cjs → ConnectedStreamedWordArtifact-LUM6WE7F.cjs} +8 -8
  14. package/dist/{ConnectedStreamedWordArtifact-GVVIWKFH.cjs.map → ConnectedStreamedWordArtifact-LUM6WE7F.cjs.map} +1 -1
  15. package/dist/{DocumentReviewCard-QD6VVDAE.cjs → DocumentReviewCard-NKCKBY3P.cjs} +3 -3
  16. package/dist/{DocumentReviewCard-QD6VVDAE.cjs.map → DocumentReviewCard-NKCKBY3P.cjs.map} +1 -1
  17. package/dist/{FilesViewerDialog-S5KRHOFU.cjs → FilesViewerDialog-T4SOKUKO.cjs} +15 -15
  18. package/dist/{FilesViewerDialog-S5KRHOFU.cjs.map → FilesViewerDialog-T4SOKUKO.cjs.map} +1 -1
  19. package/dist/{WorkspaceTableView-TPL6EWXL.cjs → WorkspaceTableView-QT63XYII.cjs} +3 -3
  20. package/dist/{WorkspaceTableView-TPL6EWXL.cjs.map → WorkspaceTableView-QT63XYII.cjs.map} +1 -1
  21. package/dist/agents/index.cjs +175 -175
  22. package/dist/{ai-6K5DTBLO.cjs → ai-CTJWECJ5.cjs} +16 -16
  23. package/dist/ai-CTJWECJ5.cjs.map +1 -0
  24. package/dist/calls/index.cjs +2 -2
  25. package/dist/{chunk-LUOL7TEY.cjs → chunk-3EIO4ZH5.cjs} +6 -6
  26. package/dist/{chunk-LUOL7TEY.cjs.map → chunk-3EIO4ZH5.cjs.map} +1 -1
  27. package/dist/{chunk-CF3WPB7T.cjs → chunk-3YPVXIFF.cjs} +4 -4
  28. package/dist/{chunk-CF3WPB7T.cjs.map → chunk-3YPVXIFF.cjs.map} +1 -1
  29. package/dist/{chunk-RDEUBZ3Z.cjs → chunk-4H5DPHZ2.cjs} +8 -8
  30. package/dist/{chunk-RDEUBZ3Z.cjs.map → chunk-4H5DPHZ2.cjs.map} +1 -1
  31. package/dist/{chunk-WQMIBHSQ.cjs → chunk-4TCOUQMC.cjs} +6 -6
  32. package/dist/{chunk-WQMIBHSQ.cjs.map → chunk-4TCOUQMC.cjs.map} +1 -1
  33. package/dist/{chunk-U2T66I7C.cjs → chunk-5FSULBPE.cjs} +3 -3
  34. package/dist/{chunk-U2T66I7C.cjs.map → chunk-5FSULBPE.cjs.map} +1 -1
  35. package/dist/{chunk-R27P7TYW.cjs → chunk-7GVKG3G4.cjs} +4 -4
  36. package/dist/{chunk-R27P7TYW.cjs.map → chunk-7GVKG3G4.cjs.map} +1 -1
  37. package/dist/{chunk-FAFA56ZL.cjs → chunk-A4HOEGDI.cjs} +4 -4
  38. package/dist/{chunk-FAFA56ZL.cjs.map → chunk-A4HOEGDI.cjs.map} +1 -1
  39. package/dist/{chunk-EYOZNVQK.cjs → chunk-AZP4ABNL.cjs} +4 -4
  40. package/dist/{chunk-EYOZNVQK.cjs.map → chunk-AZP4ABNL.cjs.map} +1 -1
  41. package/dist/{chunk-EEB63QUE.cjs → chunk-DWUWPF2A.cjs} +8 -8
  42. package/dist/{chunk-EEB63QUE.cjs.map → chunk-DWUWPF2A.cjs.map} +1 -1
  43. package/dist/{chunk-X5PH6PM7.cjs → chunk-DXOYRQKH.cjs} +3 -3
  44. package/dist/{chunk-X5PH6PM7.cjs.map → chunk-DXOYRQKH.cjs.map} +1 -1
  45. package/dist/{chunk-2EDVEP2X.cjs → chunk-HH5MKRBL.cjs} +6 -6
  46. package/dist/{chunk-2EDVEP2X.cjs.map → chunk-HH5MKRBL.cjs.map} +1 -1
  47. package/dist/{chunk-AS2FZ2T7.cjs → chunk-HHZDURXN.cjs} +3 -3
  48. package/dist/{chunk-AS2FZ2T7.cjs.map → chunk-HHZDURXN.cjs.map} +1 -1
  49. package/dist/{chunk-26KJYXYH.cjs → chunk-HUAABZ2C.cjs} +3 -3
  50. package/dist/{chunk-26KJYXYH.cjs.map → chunk-HUAABZ2C.cjs.map} +1 -1
  51. package/dist/{chunk-L6WEKQTV.cjs → chunk-HYULUR6E.cjs} +28 -28
  52. package/dist/{chunk-L6WEKQTV.cjs.map → chunk-HYULUR6E.cjs.map} +1 -1
  53. package/dist/{chunk-PDKTW4L2.cjs → chunk-LRBX4VIG.cjs} +5 -5
  54. package/dist/{chunk-PDKTW4L2.cjs.map → chunk-LRBX4VIG.cjs.map} +1 -1
  55. package/dist/{chunk-7KUTY4N5.cjs → chunk-OHWYQI3B.cjs} +9 -9
  56. package/dist/{chunk-7KUTY4N5.cjs.map → chunk-OHWYQI3B.cjs.map} +1 -1
  57. package/dist/{chunk-QU3OCUVF.cjs → chunk-PUCYBYBY.cjs} +8 -8
  58. package/dist/{chunk-QU3OCUVF.cjs.map → chunk-PUCYBYBY.cjs.map} +1 -1
  59. package/dist/{chunk-ZKXZKIPE.cjs → chunk-TLEEVRYB.cjs} +10 -10
  60. package/dist/{chunk-ZKXZKIPE.cjs.map → chunk-TLEEVRYB.cjs.map} +1 -1
  61. package/dist/{chunk-HS626TSS.cjs → chunk-WIQDXRRB.cjs} +5 -5
  62. package/dist/{chunk-HS626TSS.cjs.map → chunk-WIQDXRRB.cjs.map} +1 -1
  63. package/dist/{chunk-HPIB5YRV.cjs → chunk-XKXKEVHH.cjs} +5 -5
  64. package/dist/{chunk-HPIB5YRV.cjs.map → chunk-XKXKEVHH.cjs.map} +1 -1
  65. package/dist/{chunk-6IABKQKX.cjs → chunk-ZTLPUUZB.cjs} +6 -6
  66. package/dist/{chunk-6IABKQKX.cjs.map → chunk-ZTLPUUZB.cjs.map} +1 -1
  67. package/dist/connect/docx.cjs +11 -11
  68. package/dist/connect/index.cjs +439 -439
  69. package/dist/connect/viewer.cjs +6 -6
  70. package/dist/databases/index.cjs +71 -71
  71. package/dist/embed/index.cjs +13 -13
  72. package/dist/facts/index.cjs +8 -8
  73. package/dist/index.cjs +228 -228
  74. package/dist/pages/index.cjs +23 -23
  75. package/dist/settings/index.cjs +9 -9
  76. package/dist/studio/index.cjs +7 -7
  77. package/dist/workflow-canvas/index.cjs +19 -19
  78. package/node_modules/@arbidocs/coedit/package.json +1 -1
  79. package/package.json +5 -5
  80. package/dist/ai-6K5DTBLO.cjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkR27P7TYW_cjs = require('./chunk-R27P7TYW.cjs');
4
+ var chunk7GVKG3G4_cjs = require('./chunk-7GVKG3G4.cjs');
5
5
  var chunkWDL3TOMX_cjs = require('./chunk-WDL3TOMX.cjs');
6
6
  var chunkM55XUF4L_cjs = require('./chunk-M55XUF4L.cjs');
7
7
  var chunkVWSOHZK2_cjs = require('./chunk-VWSOHZK2.cjs');
@@ -12,9 +12,9 @@ var shell = require('@arbidocs/react/shell');
12
12
  var jsxRuntime = require('react/jsx-runtime');
13
13
 
14
14
  function useChatSlash(send) {
15
- const { items, canBrowseSkills } = chunkR27P7TYW_cjs.useSlashMenuItems(chunkM55XUF4L_cjs.BUILTIN_SKILLS);
15
+ const { items, canBrowseSkills } = chunk7GVKG3G4_cjs.useSlashMenuItems(chunkM55XUF4L_cjs.BUILTIN_SKILLS);
16
16
  const { openSkillsBrowser } = chunkHN56WWBR_cjs.useBlocksEnvironment();
17
- const { openFor, openForDraft, launcher } = chunkR27P7TYW_cjs.useSlashSkillWorkflows({
17
+ const { openFor, openForDraft, launcher } = chunk7GVKG3G4_cjs.useSlashSkillWorkflows({
18
18
  landing: "current-chat",
19
19
  send
20
20
  });
@@ -106,5 +106,5 @@ exports.useConnectedAiTask = useConnectedAiTask;
106
106
  exports.useConnectedChat = useConnectedChat;
107
107
  exports.useSemanticSearch = useSemanticSearch;
108
108
  exports.useWorkspaceDocs = useWorkspaceDocs;
109
- //# sourceMappingURL=chunk-PDKTW4L2.cjs.map
110
- //# sourceMappingURL=chunk-PDKTW4L2.cjs.map
109
+ //# sourceMappingURL=chunk-LRBX4VIG.cjs.map
110
+ //# sourceMappingURL=chunk-LRBX4VIG.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/conversation/useChatSlash.ts","../src/connection/ai.tsx"],"names":["useSlashMenuItems","BUILTIN_SKILLS","useBlocksEnvironment","useSlashSkillWorkflows","useMemo","useConnection","useKitAiTask","useCallback","useKitWorkspaceDocs","useKitSemanticSearch","useWorkspaceUsers","useAssistantName","buildMentionCandidates","useConversation","ConversationScope","jsx","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IACA,QAAA,EAAU,IAAA,CAAK,QAAA,CAAS,GAAA,CAAI,CAAC,OAAA,MAAa;AAAA,MACxC,GAAG,OAAA;AAAA,MACH,GAAI,QAAQ,QAAA,GACR;AAAA,QACE,WAAW,CAAC,CAAC,MAAM,UAAA,IAAc,OAAA,CAAQ,aAAa,IAAA,CAAK,UAAA;AAAA,QAC3D,YACE,OAAA,CAAQ,QAAA,KAAa,IAAA,EAAM,UAAA,GACvB,MAAM,IAAA,IAAQ,IAAA,EAAM,KAAA,GACpB,iBAAA,CAAkB,KAAK,CAAC,SAAA,KAAc,UAAU,EAAA,KAAO,OAAA,CAAQ,QAAQ,CAAA,EAAG;AAAA,UAElF;AAAC,KACP,CAAE;AAAA,GACJ;AACF;AAOO,SAAS,uBAAuB,KAAA,EAAyC;AAC9E,EAAA,sCACGO,uBAAA,EAAA,EACC,QAAA,kBAAAC,cAAA,CAAC,mBAAA,EAAA,EAAqB,GAAG,OAAO,CAAA,EAClC,CAAA;AAEJ;AAEA,SAAS,oBAAoB,KAAA,EAAyC;AACpE,EAAA,MAAM,OAAO,gBAAA,EAAiB;AAC9B,EAAA,uBAAOA,cAAA,CAACC,+BAAA,EAAA,EAAe,GAAG,KAAA,EAAO,IAAA,EAAY,CAAA;AAC/C","file":"chunk-PDKTW4L2.cjs","sourcesContent":["/**\n * `ChatPage`'s `/` menu bound to the connection: the same rows as every other composer\n * (`useSlashMenuItems`) and the same skill form (`useSlashSkillWorkflows`), whose run is sent in\n * this chat through its own `send`, as a typed message is.\n */\nimport { useMemo } from 'react'\nimport type { ChatPageSlash } from '../../chat/chat-page-types'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useSlashSkillWorkflows } from '../workflows/useSlashSkillWorkflows'\nimport { useSlashMenuItems } from './useSlashItems'\nimport { BUILTIN_SKILLS } from '../../agents/workflows/catalogue/seed'\n\nexport function useChatSlash(send: (prompt: string) => void): ChatPageSlash {\n const { items, canBrowseSkills } = useSlashMenuItems(BUILTIN_SKILLS)\n const { openSkillsBrowser } = useBlocksEnvironment()\n const { openFor, openForDraft, launcher } = useSlashSkillWorkflows({\n landing: 'current-chat',\n send,\n })\n return useMemo(\n () => ({\n items,\n pick: openFor,\n startDraft: openForDraft,\n onBrowse: canBrowseSkills && openSkillsBrowser ? () => openSkillsBrowser() : undefined,\n launcher,\n }),\n [items, openFor, openForDraft, canBrowseSkills, openSkillsBrowser, launcher]\n )\n}\n","/**\n * The connected agent hooks — thin adapters over the reusable AI kit in\n * `@arbidocs/react`. The streaming/accumulation/search plumbing lives once in\n * the SDK; these hooks only bind the *workspace source* (from the connection\n * context, falling back to the configured workspace) and inject the host's\n * default assistant *configuration* so call sites needn't know the config\n * ext_id. An explicit `opts.model` still wins.\n */\nimport { useCallback } from 'react'\nimport {\n useAiTask as useKitAiTask,\n useWorkspaceDocs as useKitWorkspaceDocs,\n useSemanticSearch as useKitSemanticSearch,\n useConversation,\n useWorkspaceUsers,\n buildMentionCandidates,\n ConversationScope,\n type ArbiConversation,\n type UseConversationOptions,\n type AiRunOptions,\n} from '@arbidocs/react'\nimport { useConnection } from './ConnectionProvider'\nimport { AssistantDock, type AssistantDockProps } from '../chat/AssistantDock'\nimport { MentionCandidate, useAssistantName } from '@arbidocs/react/shell'\nimport type { ChatPageSlash } from '../chat/chat-page-types'\nimport { useChatSlash } from './conversation/useChatSlash'\n\nexport type { AiTaskStatus, AiRunOptions, SearchChunk, ArtifactEvent } from '@arbidocs/react'\n\n/** Client-side redlining, re-exported so a host app has one import surface. */\nexport { toRedlineMarkdown, redlineStats, textToArtifact } from '@arbidocs/react'\n\n/**\n * The kit's `useAiTask` with the host's default assistant configuration\n * injected, so call sites needn't know the config ext_id.\n */\nexport function useConnectedAiTask() {\n const { assistantConfig } = useConnection()\n const task = useKitAiTask()\n const kitRun = task.run\n const run = useCallback(\n (question: string, docIds: string[], opts?: AiRunOptions) =>\n kitRun(question, docIds, { ...opts, model: opts?.model ?? assistantConfig }),\n [kitRun, assistantConfig]\n )\n return { ...task, run }\n}\n\n/** Resolve the active workspace + its document ids (what we ground the agent on). */\nexport function useWorkspaceDocs() {\n const { workspaceId, fallbackWorkspaceId } = useConnection()\n return useKitWorkspaceDocs(workspaceId ?? fallbackWorkspaceId)\n}\n\n/** Search the active workspace's documents (all of them) and return the top matching passages. */\nexport function useSemanticSearch() {\n const { assistantConfig } = useConnection()\n return useKitSemanticSearch([], { model: assistantConfig })\n}\n\n/**\n * The chat engine for `ChatPage` bound to the connection: the active workspace and the host's\n * default assistant configuration are injected, so a host writes\n * `<ChatPage chat={useConnectedChat()} />`. It works on the open conversation of the session in\n * scope (wrap a second chat on the page in `ConversationScope`), with the same `/` menu as every\n * other composer.\n */\nexport function useConnectedChat(\n options?: Omit<UseConversationOptions, 'workspaceId'>\n): ArbiConversation & { mentionCandidates: MentionCandidate[]; slash: ChatPageSlash } {\n const { workspaceId, fallbackWorkspaceId, assistantConfig, user, status, ensureWorkspaceOpen } =\n useConnection()\n const wsId = workspaceId ?? fallbackWorkspaceId\n const { data: members = [] } = useWorkspaceUsers(wsId, {\n enabled: status === 'authenticated' && !!wsId,\n beforeFetch: ensureWorkspaceOpen,\n })\n // The engine's own candidates: what the composer inserts is what a send routes on.\n const assistantName = useAssistantName()\n const mentionCandidates = buildMentionCandidates(\n status === 'authenticated' ? members : [],\n user?.externalId,\n assistantName\n )\n const chat = useConversation({\n ...options,\n workspaceId: wsId,\n model: options?.model ?? assistantConfig,\n })\n // The composer's `/` menu: commands, the host's skill packs and the user's skills, their runs\n // sent in this chat.\n const { send } = chat\n const sendPrompt = useCallback((prompt: string) => void send(prompt), [send])\n const slash = useChatSlash(sendPrompt)\n return {\n ...chat,\n mentionCandidates,\n slash,\n messages: chat.messages.map((message) => ({\n ...message,\n ...(message.authorId\n ? {\n fromOther: !!user?.externalId && message.authorId !== user.externalId,\n senderName:\n message.authorId === user?.externalId\n ? user?.name || user?.email\n : mentionCandidates.find((candidate) => candidate.id === message.authorId)?.label,\n }\n : {}),\n })),\n }\n}\n\n/**\n * The assistant dock bound to the connection: mount it once in the layout (`Shell.Root`'s `aside`)\n * and put `AssistantDockToggle` in the topbar. Its chat keeps its own open conversation (and\n * survives closing the dock).\n */\nexport function ConnectedAssistantDock(props: Omit<AssistantDockProps, 'chat'>) {\n return (\n <ConversationScope>\n <ScopedAssistantDock {...props} />\n </ConversationScope>\n )\n}\n\nfunction ScopedAssistantDock(props: Omit<AssistantDockProps, 'chat'>) {\n const chat = useConnectedChat()\n return <AssistantDock {...props} chat={chat} />\n}\n"]}
1
+ {"version":3,"sources":["../src/connection/conversation/useChatSlash.ts","../src/connection/ai.tsx"],"names":["useSlashMenuItems","BUILTIN_SKILLS","useBlocksEnvironment","useSlashSkillWorkflows","useMemo","useConnection","useKitAiTask","useCallback","useKitWorkspaceDocs","useKitSemanticSearch","useWorkspaceUsers","useAssistantName","buildMentionCandidates","useConversation","ConversationScope","jsx","AssistantDock"],"mappings":";;;;;;;;;;;;AAYO,SAAS,aAAa,IAAA,EAA+C;AAC1E,EAAA,MAAM,EAAE,KAAA,EAAO,eAAA,EAAgB,GAAIA,oCAAkBC,gCAAc,CAAA;AACnE,EAAA,MAAM,EAAE,iBAAA,EAAkB,GAAIC,sCAAA,EAAqB;AACnD,EAAA,MAAM,EAAE,OAAA,EAAS,YAAA,EAAc,QAAA,KAAaC,wCAAA,CAAuB;AAAA,IACjE,OAAA,EAAS,cAAA;AAAA,IACT;AAAA,GACD,CAAA;AACD,EAAA,OAAOC,eAAA;AAAA,IACL,OAAO;AAAA,MACL,KAAA;AAAA,MACA,IAAA,EAAM,OAAA;AAAA,MACN,UAAA,EAAY,YAAA;AAAA,MACZ,QAAA,EAAU,eAAA,IAAmB,iBAAA,GAAoB,MAAM,mBAAkB,GAAI,MAAA;AAAA,MAC7E;AAAA,KACF,CAAA;AAAA,IACA,CAAC,KAAA,EAAO,OAAA,EAAS,YAAA,EAAc,eAAA,EAAiB,mBAAmB,QAAQ;AAAA,GAC7E;AACF;ACOO,SAAS,kBA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BAAA,EAAiB;AAC9B,EAAA,uBAAOA,cAAA,CAACC,+BAAA,EAAA,EAAe,GAAG,KAAA,EAAO,IAAA,EAAY,CAAA;AAC/C","file":"chunk-LRBX4VIG.cjs","sourcesContent":["/**\n * `ChatPage`'s `/` menu bound to the connection: the same rows as every other composer\n * (`useSlashMenuItems`) and the same skill form (`useSlashSkillWorkflows`), whose run is sent in\n * this chat through its own `send`, as a typed message is.\n */\nimport { useMemo } from 'react'\nimport type { ChatPageSlash } from '../../chat/chat-page-types'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useSlashSkillWorkflows } from '../workflows/useSlashSkillWorkflows'\nimport { useSlashMenuItems } from './useSlashItems'\nimport { BUILTIN_SKILLS } from '../../agents/workflows/catalogue/seed'\n\nexport function useChatSlash(send: (prompt: string) => void): ChatPageSlash {\n const { items, canBrowseSkills } = useSlashMenuItems(BUILTIN_SKILLS)\n const { openSkillsBrowser } = useBlocksEnvironment()\n const { openFor, openForDraft, launcher } = useSlashSkillWorkflows({\n landing: 'current-chat',\n send,\n })\n return useMemo(\n () => ({\n items,\n pick: openFor,\n startDraft: openForDraft,\n onBrowse: canBrowseSkills && openSkillsBrowser ? () => openSkillsBrowser() : undefined,\n launcher,\n }),\n [items, openFor, openForDraft, canBrowseSkills, openSkillsBrowser, launcher]\n )\n}\n","/**\n * The connected agent hooks — thin adapters over the reusable AI kit in\n * `@arbidocs/react`. The streaming/accumulation/search plumbing lives once in\n * the SDK; these hooks only bind the *workspace source* (from the connection\n * context, falling back to the configured workspace) and inject the host's\n * default assistant *configuration* so call sites needn't know the config\n * ext_id. An explicit `opts.model` still wins.\n */\nimport { useCallback } from 'react'\nimport {\n useAiTask as useKitAiTask,\n useWorkspaceDocs as useKitWorkspaceDocs,\n useSemanticSearch as useKitSemanticSearch,\n useConversation,\n useWorkspaceUsers,\n buildMentionCandidates,\n ConversationScope,\n type ArbiConversation,\n type UseConversationOptions,\n type AiRunOptions,\n} from '@arbidocs/react'\nimport { useConnection } from './ConnectionProvider'\nimport { AssistantDock, type AssistantDockProps } from '../chat/AssistantDock'\nimport { MentionCandidate, useAssistantName } from '@arbidocs/react/shell'\nimport type { ChatPageSlash } from '../chat/chat-page-types'\nimport { useChatSlash } from './conversation/useChatSlash'\n\nexport type { AiTaskStatus, AiRunOptions, SearchChunk, ArtifactEvent } from '@arbidocs/react'\n\n/** Client-side redlining, re-exported so a host app has one import surface. */\nexport { toRedlineMarkdown, redlineStats, textToArtifact } from '@arbidocs/react'\n\n/**\n * The kit's `useAiTask` with the host's default assistant configuration\n * injected, so call sites needn't know the config ext_id.\n */\nexport function useConnectedAiTask() {\n const { assistantConfig } = useConnection()\n const task = useKitAiTask()\n const kitRun = task.run\n const run = useCallback(\n (question: string, docIds: string[], opts?: AiRunOptions) =>\n kitRun(question, docIds, { ...opts, model: opts?.model ?? assistantConfig }),\n [kitRun, assistantConfig]\n )\n return { ...task, run }\n}\n\n/** Resolve the active workspace + its document ids (what we ground the agent on). */\nexport function useWorkspaceDocs() {\n const { workspaceId, fallbackWorkspaceId } = useConnection()\n return useKitWorkspaceDocs(workspaceId ?? fallbackWorkspaceId)\n}\n\n/** Search the active workspace's documents (all of them) and return the top matching passages. */\nexport function useSemanticSearch() {\n const { assistantConfig } = useConnection()\n return useKitSemanticSearch([], { model: assistantConfig })\n}\n\n/**\n * The chat engine for `ChatPage` bound to the connection: the active workspace and the host's\n * default assistant configuration are injected, so a host writes\n * `<ChatPage chat={useConnectedChat()} />`. It works on the open conversation of the session in\n * scope (wrap a second chat on the page in `ConversationScope`), with the same `/` menu as every\n * other composer.\n */\nexport function useConnectedChat(\n options?: Omit<UseConversationOptions, 'workspaceId'>\n): ArbiConversation & { mentionCandidates: MentionCandidate[]; slash: ChatPageSlash } {\n const { workspaceId, fallbackWorkspaceId, assistantConfig, user, status, ensureWorkspaceOpen } =\n useConnection()\n const wsId = workspaceId ?? fallbackWorkspaceId\n const { data: members = [] } = useWorkspaceUsers(wsId, {\n enabled: status === 'authenticated' && !!wsId,\n beforeFetch: ensureWorkspaceOpen,\n })\n // The engine's own candidates: what the composer inserts is what a send routes on.\n const assistantName = useAssistantName()\n const mentionCandidates = buildMentionCandidates(\n status === 'authenticated' ? members : [],\n user?.externalId,\n assistantName\n )\n const chat = useConversation({\n ...options,\n workspaceId: wsId,\n model: options?.model ?? assistantConfig,\n })\n // The composer's `/` menu: commands, the host's skill packs and the user's skills, their runs\n // sent in this chat.\n const { send } = chat\n const sendPrompt = useCallback((prompt: string) => void send(prompt), [send])\n const slash = useChatSlash(sendPrompt)\n return {\n ...chat,\n mentionCandidates,\n slash,\n messages: chat.messages.map((message) => ({\n ...message,\n ...(message.authorId\n ? {\n fromOther: !!user?.externalId && message.authorId !== user.externalId,\n senderName:\n message.authorId === user?.externalId\n ? user?.name || user?.email\n : mentionCandidates.find((candidate) => candidate.id === message.authorId)?.label,\n }\n : {}),\n })),\n }\n}\n\n/**\n * The assistant dock bound to the connection: mount it once in the layout (`Shell.Root`'s `aside`)\n * and put `AssistantDockToggle` in the topbar. Its chat keeps its own open conversation (and\n * survives closing the dock).\n */\nexport function ConnectedAssistantDock(props: Omit<AssistantDockProps, 'chat'>) {\n return (\n <ConversationScope>\n <ScopedAssistantDock {...props} />\n </ConversationScope>\n )\n}\n\nfunction ScopedAssistantDock(props: Omit<AssistantDockProps, 'chat'>) {\n const chat = useConnectedChat()\n return <AssistantDock {...props} chat={chat} />\n}\n"]}
@@ -2,9 +2,9 @@
2
2
  'use strict';
3
3
 
4
4
  var chunkER2MRSLT_cjs = require('./chunk-ER2MRSLT.cjs');
5
- var chunkLUOL7TEY_cjs = require('./chunk-LUOL7TEY.cjs');
5
+ var chunk3EIO4ZH5_cjs = require('./chunk-3EIO4ZH5.cjs');
6
6
  var chunkM55XUF4L_cjs = require('./chunk-M55XUF4L.cjs');
7
- var chunkU2T66I7C_cjs = require('./chunk-U2T66I7C.cjs');
7
+ var chunk5FSULBPE_cjs = require('./chunk-5FSULBPE.cjs');
8
8
  var chunkSQCCQU3K_cjs = require('./chunk-SQCCQU3K.cjs');
9
9
  var chunk3YZKDCWY_cjs = require('./chunk-3YZKDCWY.cjs');
10
10
  var chunkHN56WWBR_cjs = require('./chunk-HN56WWBR.cjs');
@@ -49,7 +49,7 @@ function useLaunchWorkflow({
49
49
  } = {}) {
50
50
  const { data: documents = [] } = react.useDocuments();
51
51
  const { data: workspaceTags = [] } = react.useTags();
52
- const tags = react$1.useMemo(() => chunkU2T66I7C_cjs.documentScopeLabels(workspaceTags), [workspaceTags]);
52
+ const tags = react$1.useMemo(() => chunk5FSULBPE_cjs.documentScopeLabels(workspaceTags), [workspaceTags]);
53
53
  const createTag = react.useCreateTag();
54
54
  const updateTag = react.useUpdateTag();
55
55
  const generate = react.useGenerateDocTags();
@@ -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") || chunkM55XUF4L_cjs.deriveAnnotationName(description);
64
- const matching = chunkU2T66I7C_cjs.matchWorkflowScope(documents, scope);
64
+ const matching = chunk5FSULBPE_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 && !chunkSQCCQU3K_cjs.isEmptyWorkflowScope(scope)) {
164
- const ids = chunkU2T66I7C_cjs.matchWorkflowScope(documents, scope).map((d) => d.external_id);
164
+ const ids = chunk5FSULBPE_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 } = chunkHN56WWBR_cjs.useBlocksEnvironment();
217
217
  const { data: workspaceTags = [] } = react.useTags();
218
- const tags = react$1.useMemo(() => chunkU2T66I7C_cjs.documentScopeLabels(workspaceTags), [workspaceTags]);
218
+ const tags = react$1.useMemo(() => chunk5FSULBPE_cjs.documentScopeLabels(workspaceTags), [workspaceTags]);
219
219
  const fieldPlaceholder = react$1.useCallback(
220
220
  (field, inputs, workflow) => {
221
221
  if (workflow.id !== chunkM55XUF4L_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
- chunkLUOL7TEY_cjs.ConnectedWorkflowLauncher,
228
+ chunk3EIO4ZH5_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-7KUTY4N5.cjs.map
269
- //# sourceMappingURL=chunk-7KUTY4N5.cjs.map
268
+ //# sourceMappingURL=chunk-OHWYQI3B.cjs.map
269
+ //# sourceMappingURL=chunk-OHWYQI3B.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","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G,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-7KUTY4N5.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 /** The band's layout: reflowing columns (default) or one sideways-scrolling row (a carousel). */\n tilesLayout?: 'grid' | 'carousel'\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,OAAO,MAAA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AOR,6BAAA,IAAe,YAAA,KAAiB,IAAA,GAC5C,YAAY,YAAY,CAAA,SAAA,EAAY,iBAAiB,CAAA,GAAI,GAAA,GAAM,EAAE,CAAA,CAAA,GACjE,MAAA;AAAA,MAEN,YAAA,EAAc,CAAC,EAAE,QAAA,EAAU,QAAO,KAAM;AACtC,QAAA,IAAI,QAAA,CAAS,EAAA,KAAOA,6BAAA,EAAa,OAAO,IAAA;AAGxC,QAAA,MAAM,IAAA,GACJ,MAAA,CAAO,MAAA,CAAO,IAAA,IAAQ,EAAE,CAAA,CAAE,IAAA,EAAK,IAAKF,sCAAA,CAAqB,MAAA,CAAO,MAAA,CAAO,WAAA,IAAe,EAAE,CAAC,CAAA;AAC3F,QAAA,MAAM,QAAA,GAAW,IAAA,GACb,IAAA,CAAK,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,IAAA,CAAK,WAAA,EAAY,KAAM,IAAA,CAAK,WAAA,EAAa,CAAA,GAC5D,MAAA;AACJ,QAAA,IAAI,CAAC,UAAU,OAAO,IAAA;AACtB,QAAA,uBACEW,eAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAU,mIAAA;AAAA,YACV,IAAA,EAAK,QAAA;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-OHWYQI3B.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 /** The band's layout: reflowing columns (default) or one sideways-scrolling row (a carousel). */\n tilesLayout?: 'grid' | 'carousel'\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,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunk26KJYXYH_cjs = require('./chunk-26KJYXYH.cjs');
4
+ var chunkHUAABZ2C_cjs = require('./chunk-HUAABZ2C.cjs');
5
5
  var chunkGISMY7J7_cjs = require('./chunk-GISMY7J7.cjs');
6
6
  var chunkV5P5MRSR_cjs = require('./chunk-V5P5MRSR.cjs');
7
7
  var chunkSNUBQMIS_cjs = require('./chunk-SNUBQMIS.cjs');
@@ -565,7 +565,7 @@ function LabelsCell({ value, titles, labels, onChange, rowHeight }) {
565
565
  const ids = cellIds(value);
566
566
  if (labels && onChange) {
567
567
  return /* @__PURE__ */ jsxRuntime.jsx(
568
- chunk26KJYXYH_cjs.FactLabelsCell,
568
+ chunkHUAABZ2C_cjs.FactLabelsCell,
569
569
  {
570
570
  options: labels.options,
571
571
  selectedIds: ids,
@@ -582,9 +582,9 @@ function LabelsCell({ value, titles, labels, onChange, rowHeight }) {
582
582
  "div",
583
583
  {
584
584
  className: rowHeight === void 0 ? "flex min-w-0 flex-wrap items-center gap-1" : "flex min-w-0 flex-wrap content-start gap-1 overflow-hidden",
585
- style: rowHeight === void 0 ? void 0 : { maxHeight: chunk26KJYXYH_cjs.labelChipsMaxHeight(rowHeight, true) },
585
+ style: rowHeight === void 0 ? void 0 : { maxHeight: chunkHUAABZ2C_cjs.labelChipsMaxHeight(rowHeight, true) },
586
586
  title: rowHeight === void 0 ? void 0 : ids.map((id) => titleOf(id, titles)).join(", "),
587
- children: ids.map((id) => /* @__PURE__ */ jsxRuntime.jsx(chunk26KJYXYH_cjs.LabelChip, { name: titleOf(id, titles), color: ui.getEntityColor(id, "medium") }, id))
587
+ children: ids.map((id) => /* @__PURE__ */ jsxRuntime.jsx(chunkHUAABZ2C_cjs.LabelChip, { name: titleOf(id, titles), color: ui.getEntityColor(id, "medium") }, id))
588
588
  }
589
589
  );
590
590
  }
@@ -703,7 +703,7 @@ function SourcesField({ value, titles, onOpenDocument, testId }) {
703
703
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": testId, className: "flex min-w-0 flex-col gap-2", children: cites.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: "No sources" }) : cites.map((c, i) => {
704
704
  const count = c.chunks?.length ?? 0;
705
705
  return /* @__PURE__ */ jsxRuntime.jsx(
706
- chunk26KJYXYH_cjs.FactSourceGroup,
706
+ chunkHUAABZ2C_cjs.FactSourceGroup,
707
707
  {
708
708
  docId: citationTestId(cites, i),
709
709
  document: /* @__PURE__ */ jsxRuntime.jsx(
@@ -750,7 +750,7 @@ function DateSpanField({ value, onCommit, idPrefix }) {
750
750
  if (e.key === "Escape") cancelled.current = true;
751
751
  },
752
752
  children: /* @__PURE__ */ jsxRuntime.jsx(
753
- chunk26KJYXYH_cjs.FactDateInput,
753
+ chunkHUAABZ2C_cjs.FactDateInput,
754
754
  {
755
755
  value: draft,
756
756
  onChange: setDraft,
@@ -3752,5 +3752,5 @@ exports.storedLayoutAfter = storedLayoutAfter;
3752
3752
  exports.titleOf = titleOf;
3753
3753
  exports.toApiValue = toApiValue;
3754
3754
  exports.withUndatedFilter = withUndatedFilter;
3755
- //# sourceMappingURL=chunk-QU3OCUVF.cjs.map
3756
- //# sourceMappingURL=chunk-QU3OCUVF.cjs.map
3755
+ //# sourceMappingURL=chunk-PUCYBYBY.cjs.map
3756
+ //# sourceMappingURL=chunk-PUCYBYBY.cjs.map