@arbidocs/blocks 0.5.2 → 0.5.4

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 (161) hide show
  1. package/dist/{ConnectedCallDock-NNX5PEPK.cjs → ConnectedCallDock-Q7GSQICC.cjs} +6 -6
  2. package/dist/{ConnectedCallDock-NNX5PEPK.cjs.map → ConnectedCallDock-Q7GSQICC.cjs.map} +1 -1
  3. package/dist/{ConnectedCallDock-UGGY6YUK.js → ConnectedCallDock-XCTBUJOT.js} +5 -5
  4. package/dist/{ConnectedCallDock-UGGY6YUK.js.map → ConnectedCallDock-XCTBUJOT.js.map} +1 -1
  5. package/dist/{ConnectedCallRoom-B7SZHQNV.cjs → ConnectedCallRoom-T6PGW6VC.cjs} +6 -6
  6. package/dist/{ConnectedCallRoom-B7SZHQNV.cjs.map → ConnectedCallRoom-T6PGW6VC.cjs.map} +1 -1
  7. package/dist/{ConnectedCallRoom-I4HPWMK2.js → ConnectedCallRoom-W2AHTPYR.js} +5 -5
  8. package/dist/{ConnectedCallRoom-I4HPWMK2.js.map → ConnectedCallRoom-W2AHTPYR.js.map} +1 -1
  9. package/dist/{ConnectedNativeDocxComparison-CWEW7GV3.js → ConnectedNativeDocxComparison-4MI22H2R.js} +10 -10
  10. package/dist/{ConnectedNativeDocxComparison-CWEW7GV3.js.map → ConnectedNativeDocxComparison-4MI22H2R.js.map} +1 -1
  11. package/dist/{ConnectedNativeDocxComparison-A7PMTYD7.cjs → ConnectedNativeDocxComparison-VZLB7WWW.cjs} +11 -11
  12. package/dist/{ConnectedNativeDocxComparison-A7PMTYD7.cjs.map → ConnectedNativeDocxComparison-VZLB7WWW.cjs.map} +1 -1
  13. package/dist/{ConnectedNativeDocxEditor-IWXEOAIF.cjs → ConnectedNativeDocxEditor-74PFGTMR.cjs} +11 -11
  14. package/dist/{ConnectedNativeDocxEditor-IWXEOAIF.cjs.map → ConnectedNativeDocxEditor-74PFGTMR.cjs.map} +1 -1
  15. package/dist/{ConnectedNativeDocxEditor-6EBF7U4E.js → ConnectedNativeDocxEditor-YBHAQQSY.js} +9 -9
  16. package/dist/{ConnectedNativeDocxEditor-6EBF7U4E.js.map → ConnectedNativeDocxEditor-YBHAQQSY.js.map} +1 -1
  17. package/dist/{ConnectedStreamedWordArtifact-WRGCCU5H.cjs → ConnectedStreamedWordArtifact-63ME4QD5.cjs} +11 -11
  18. package/dist/ConnectedStreamedWordArtifact-63ME4QD5.cjs.map +1 -0
  19. package/dist/{ConnectedStreamedWordArtifact-27ISQYHI.js → ConnectedStreamedWordArtifact-ELHQ2VYL.js} +10 -10
  20. package/dist/ConnectedStreamedWordArtifact-ELHQ2VYL.js.map +1 -0
  21. package/dist/agents/index.cjs +328 -328
  22. package/dist/agents/index.js +6 -6
  23. package/dist/calls/index.cjs +39 -39
  24. package/dist/calls/index.js +7 -7
  25. package/dist/chat/DraftingDocChip.d.ts +23 -7
  26. package/dist/chat/index.cjs +63 -63
  27. package/dist/chat/index.js +1 -1
  28. package/dist/{chunk-QK2HR3LC.js → chunk-2A2QX3MS.js} +3 -3
  29. package/dist/{chunk-QK2HR3LC.js.map → chunk-2A2QX3MS.js.map} +1 -1
  30. package/dist/{chunk-JBG5MFVX.cjs → chunk-2CTG4DHL.cjs} +5 -5
  31. package/dist/{chunk-JBG5MFVX.cjs.map → chunk-2CTG4DHL.cjs.map} +1 -1
  32. package/dist/{chunk-PSBZ65VU.cjs → chunk-2ETLLFQV.cjs} +4 -4
  33. package/dist/{chunk-PSBZ65VU.cjs.map → chunk-2ETLLFQV.cjs.map} +1 -1
  34. package/dist/{chunk-ULQV2NJT.js → chunk-3FKM4G2T.js} +46 -9
  35. package/dist/chunk-3FKM4G2T.js.map +1 -0
  36. package/dist/{chunk-VMXLNBHF.js → chunk-3IQUMSJI.js} +3 -3
  37. package/dist/{chunk-VMXLNBHF.js.map → chunk-3IQUMSJI.js.map} +1 -1
  38. package/dist/{chunk-LMXMUWPA.cjs → chunk-3LDVSHRD.cjs} +4 -4
  39. package/dist/{chunk-LMXMUWPA.cjs.map → chunk-3LDVSHRD.cjs.map} +1 -1
  40. package/dist/{chunk-5D32XL3E.cjs → chunk-54RSCDE6.cjs} +7 -7
  41. package/dist/{chunk-5D32XL3E.cjs.map → chunk-54RSCDE6.cjs.map} +1 -1
  42. package/dist/{chunk-ID2EVM5M.cjs → chunk-67L2XS3P.cjs} +4 -4
  43. package/dist/{chunk-ID2EVM5M.cjs.map → chunk-67L2XS3P.cjs.map} +1 -1
  44. package/dist/{chunk-2BNWISLH.cjs → chunk-6HPBSKXG.cjs} +4 -4
  45. package/dist/{chunk-2BNWISLH.cjs.map → chunk-6HPBSKXG.cjs.map} +1 -1
  46. package/dist/{chunk-25YFJLFP.cjs → chunk-6TJQTDQI.cjs} +2 -2
  47. package/dist/{chunk-25YFJLFP.cjs.map → chunk-6TJQTDQI.cjs.map} +1 -1
  48. package/dist/{chunk-ZC5MJIRC.js → chunk-7KAJKYA7.js} +3 -3
  49. package/dist/{chunk-ZC5MJIRC.js.map → chunk-7KAJKYA7.js.map} +1 -1
  50. package/dist/{chunk-2RSUVU5V.js → chunk-AQ2XKOQ7.js} +3 -3
  51. package/dist/{chunk-2RSUVU5V.js.map → chunk-AQ2XKOQ7.js.map} +1 -1
  52. package/dist/{chunk-QEE4DOEU.cjs → chunk-AY66THUZ.cjs} +18 -18
  53. package/dist/{chunk-QEE4DOEU.cjs.map → chunk-AY66THUZ.cjs.map} +1 -1
  54. package/dist/{chunk-UIZZFZ5Z.cjs → chunk-BYCGAAV5.cjs} +5 -5
  55. package/dist/{chunk-UIZZFZ5Z.cjs.map → chunk-BYCGAAV5.cjs.map} +1 -1
  56. package/dist/{chunk-YBB3KRTU.cjs → chunk-CIJUKCZI.cjs} +7 -7
  57. package/dist/{chunk-YBB3KRTU.cjs.map → chunk-CIJUKCZI.cjs.map} +1 -1
  58. package/dist/{chunk-P2ZB2WTE.js → chunk-D7YJY3JW.js} +3 -3
  59. package/dist/{chunk-P2ZB2WTE.js.map → chunk-D7YJY3JW.js.map} +1 -1
  60. package/dist/{chunk-DRLRR44Q.js → chunk-FEYRHZYB.js} +6 -6
  61. package/dist/{chunk-DRLRR44Q.js.map → chunk-FEYRHZYB.js.map} +1 -1
  62. package/dist/{chunk-CNHLPFFK.cjs → chunk-HSAEIBRA.cjs} +4 -4
  63. package/dist/{chunk-CNHLPFFK.cjs.map → chunk-HSAEIBRA.cjs.map} +1 -1
  64. package/dist/{chunk-MQIUL32N.cjs → chunk-IFEQSARV.cjs} +5 -5
  65. package/dist/{chunk-MQIUL32N.cjs.map → chunk-IFEQSARV.cjs.map} +1 -1
  66. package/dist/{chunk-OD3UJ7XR.js → chunk-IK4AWPDW.js} +3 -3
  67. package/dist/{chunk-OD3UJ7XR.js.map → chunk-IK4AWPDW.js.map} +1 -1
  68. package/dist/{chunk-JANBEB7P.js → chunk-K35QAFR7.js} +3 -3
  69. package/dist/{chunk-JANBEB7P.js.map → chunk-K35QAFR7.js.map} +1 -1
  70. package/dist/{chunk-PAW2PC2M.cjs → chunk-L22BJYHL.cjs} +11 -11
  71. package/dist/{chunk-PAW2PC2M.cjs.map → chunk-L22BJYHL.cjs.map} +1 -1
  72. package/dist/{chunk-PY5D6HBD.js → chunk-LSKTOCKN.js} +5 -5
  73. package/dist/{chunk-PY5D6HBD.js.map → chunk-LSKTOCKN.js.map} +1 -1
  74. package/dist/{chunk-ZSW6FZG5.cjs → chunk-M6Z7HTJ2.cjs} +8 -8
  75. package/dist/{chunk-ZSW6FZG5.cjs.map → chunk-M6Z7HTJ2.cjs.map} +1 -1
  76. package/dist/{chunk-LDD7NXIQ.js → chunk-M7EI5V6H.js} +3 -3
  77. package/dist/{chunk-LDD7NXIQ.js.map → chunk-M7EI5V6H.js.map} +1 -1
  78. package/dist/{chunk-J6JED6TA.cjs → chunk-M7LMEVXY.cjs} +52 -52
  79. package/dist/{chunk-J6JED6TA.cjs.map → chunk-M7LMEVXY.cjs.map} +1 -1
  80. package/dist/{chunk-BMFXDDJG.cjs → chunk-NJ72FUE2.cjs} +9 -9
  81. package/dist/{chunk-BMFXDDJG.cjs.map → chunk-NJ72FUE2.cjs.map} +1 -1
  82. package/dist/{chunk-KRNX2PVC.js → chunk-PG5A6DJY.js} +3 -3
  83. package/dist/{chunk-KRNX2PVC.js.map → chunk-PG5A6DJY.js.map} +1 -1
  84. package/dist/{chunk-YSNQWUQQ.js → chunk-PISYMKGS.js} +5 -5
  85. package/dist/{chunk-YSNQWUQQ.js.map → chunk-PISYMKGS.js.map} +1 -1
  86. package/dist/{chunk-GKM4EOH7.js → chunk-PKB4LBPC.js} +2 -2
  87. package/dist/{chunk-GKM4EOH7.js.map → chunk-PKB4LBPC.js.map} +1 -1
  88. package/dist/{chunk-MDFXGRLY.cjs → chunk-PSTA227J.cjs} +26 -26
  89. package/dist/{chunk-MDFXGRLY.cjs.map → chunk-PSTA227J.cjs.map} +1 -1
  90. package/dist/{chunk-F66OH26L.cjs → chunk-PU7CEHTL.cjs} +45 -8
  91. package/dist/chunk-PU7CEHTL.cjs.map +1 -0
  92. package/dist/{chunk-5DXTO7CE.cjs → chunk-QGSVHWXR.cjs} +6 -6
  93. package/dist/{chunk-5DXTO7CE.cjs.map → chunk-QGSVHWXR.cjs.map} +1 -1
  94. package/dist/{chunk-QE7MS7NA.js → chunk-QH4OY5GP.js} +3 -3
  95. package/dist/{chunk-QE7MS7NA.js.map → chunk-QH4OY5GP.js.map} +1 -1
  96. package/dist/{chunk-IFAIUKQQ.cjs → chunk-QIY3ZHD2.cjs} +4 -4
  97. package/dist/{chunk-IFAIUKQQ.cjs.map → chunk-QIY3ZHD2.cjs.map} +1 -1
  98. package/dist/{chunk-7GAS4N7L.js → chunk-RC2REIM4.js} +3 -3
  99. package/dist/{chunk-7GAS4N7L.js.map → chunk-RC2REIM4.js.map} +1 -1
  100. package/dist/{chunk-BWKBLCWC.js → chunk-S4KPVLHO.js} +3 -3
  101. package/dist/{chunk-BWKBLCWC.js.map → chunk-S4KPVLHO.js.map} +1 -1
  102. package/dist/{chunk-RMLU363Q.cjs → chunk-TUODUKDK.cjs} +4 -4
  103. package/dist/{chunk-RMLU363Q.cjs.map → chunk-TUODUKDK.cjs.map} +1 -1
  104. package/dist/{chunk-CSUKLEQH.js → chunk-TYOZWK4G.js} +4 -4
  105. package/dist/{chunk-CSUKLEQH.js.map → chunk-TYOZWK4G.js.map} +1 -1
  106. package/dist/{chunk-WYQKDE6S.js → chunk-TZHPRK4H.js} +3 -3
  107. package/dist/{chunk-WYQKDE6S.js.map → chunk-TZHPRK4H.js.map} +1 -1
  108. package/dist/{chunk-IMTJFBDC.cjs → chunk-VBMNPJDD.cjs} +4 -4
  109. package/dist/{chunk-IMTJFBDC.cjs.map → chunk-VBMNPJDD.cjs.map} +1 -1
  110. package/dist/{chunk-6YI6BC6L.js → chunk-VDWZL5WT.js} +3 -3
  111. package/dist/{chunk-6YI6BC6L.js.map → chunk-VDWZL5WT.js.map} +1 -1
  112. package/dist/{chunk-AU6ZSYW6.js → chunk-VX5I35HZ.js} +3 -3
  113. package/dist/{chunk-AU6ZSYW6.js.map → chunk-VX5I35HZ.js.map} +1 -1
  114. package/dist/{chunk-EBRYYVNH.cjs → chunk-WB4B6TSW.cjs} +14 -14
  115. package/dist/{chunk-EBRYYVNH.cjs.map → chunk-WB4B6TSW.cjs.map} +1 -1
  116. package/dist/{chunk-34LBKTII.js → chunk-X5FS27BM.js} +6 -6
  117. package/dist/{chunk-34LBKTII.js.map → chunk-X5FS27BM.js.map} +1 -1
  118. package/dist/{chunk-HTOYFP3D.js → chunk-Z7KGBVKI.js} +5 -5
  119. package/dist/{chunk-HTOYFP3D.js.map → chunk-Z7KGBVKI.js.map} +1 -1
  120. package/dist/{chunk-TXPOODAY.js → chunk-Z7PVDIUN.js} +3 -3
  121. package/dist/{chunk-TXPOODAY.js.map → chunk-Z7PVDIUN.js.map} +1 -1
  122. package/dist/{chunk-3XA7EDPS.cjs → chunk-ZOUVLJLV.cjs} +12 -12
  123. package/dist/{chunk-3XA7EDPS.cjs.map → chunk-ZOUVLJLV.cjs.map} +1 -1
  124. package/dist/citations/index.cjs +10 -10
  125. package/dist/citations/index.js +2 -2
  126. package/dist/connect/docx.cjs +13 -13
  127. package/dist/connect/docx.js +9 -9
  128. package/dist/connect/index.cjs +740 -719
  129. package/dist/connect/index.cjs.map +1 -1
  130. package/dist/connect/index.js +50 -29
  131. package/dist/connect/index.js.map +1 -1
  132. package/dist/connect/viewer.cjs +107 -78
  133. package/dist/connect/viewer.cjs.map +1 -1
  134. package/dist/connect/viewer.js +45 -16
  135. package/dist/connect/viewer.js.map +1 -1
  136. package/dist/facts/index.cjs +3 -3
  137. package/dist/facts/index.js +2 -2
  138. package/dist/files/index.cjs +223 -223
  139. package/dist/files/index.js +3 -3
  140. package/dist/home/index.cjs +30 -30
  141. package/dist/home/index.js +5 -5
  142. package/dist/index.cjs +512 -512
  143. package/dist/index.js +12 -12
  144. package/dist/provider/environment.d.ts +10 -3
  145. package/dist/retrieval/index.cjs +4 -4
  146. package/dist/retrieval/index.js +2 -2
  147. package/dist/shell/index.cjs +46 -46
  148. package/dist/shell/index.js +3 -3
  149. package/dist/studio/index.cjs +13 -13
  150. package/dist/studio/index.js +5 -5
  151. package/dist/workflow-canvas/index.cjs +26 -26
  152. package/dist/workflow-canvas/index.js +8 -8
  153. package/dist/workspaces/index.cjs +20 -20
  154. package/dist/workspaces/index.js +4 -4
  155. package/node_modules/@arbidocs/coedit/package.json +1 -1
  156. package/package.json +5 -5
  157. package/src/docx/README.md +10 -6
  158. package/dist/ConnectedStreamedWordArtifact-27ISQYHI.js.map +0 -1
  159. package/dist/ConnectedStreamedWordArtifact-WRGCCU5H.cjs.map +0 -1
  160. package/dist/chunk-F66OH26L.cjs.map +0 -1
  161. package/dist/chunk-ULQV2NJT.js.map +0 -1
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkLMXMUWPA_cjs = require('./chunk-LMXMUWPA.cjs');
4
+ var chunk3LDVSHRD_cjs = require('./chunk-3LDVSHRD.cjs');
5
5
  var chunkLHWKA2XI_cjs = require('./chunk-LHWKA2XI.cjs');
6
6
  var react$1 = require('react');
7
7
  var react = require('@arbidocs/react');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
9
 
10
10
  function useConnectedAiTask() {
11
- const { assistantConfig } = chunkLMXMUWPA_cjs.useConnection();
11
+ const { assistantConfig } = chunk3LDVSHRD_cjs.useConnection();
12
12
  const task = react.useAiTask();
13
13
  const kitRun = task.run;
14
14
  const run = react$1.useCallback(
@@ -18,15 +18,15 @@ function useConnectedAiTask() {
18
18
  return { ...task, run };
19
19
  }
20
20
  function useWorkspaceDocs() {
21
- const { workspaceId, fallbackWorkspaceId } = chunkLMXMUWPA_cjs.useConnection();
21
+ const { workspaceId, fallbackWorkspaceId } = chunk3LDVSHRD_cjs.useConnection();
22
22
  return react.useWorkspaceDocs(workspaceId ?? fallbackWorkspaceId);
23
23
  }
24
24
  function useSemanticSearch() {
25
- const { assistantConfig } = chunkLMXMUWPA_cjs.useConnection();
25
+ const { assistantConfig } = chunk3LDVSHRD_cjs.useConnection();
26
26
  return react.useSemanticSearch([], { model: assistantConfig });
27
27
  }
28
28
  function useConnectedChat(options) {
29
- const { workspaceId, fallbackWorkspaceId, assistantConfig, user, status, ensureWorkspaceOpen } = chunkLMXMUWPA_cjs.useConnection();
29
+ const { workspaceId, fallbackWorkspaceId, assistantConfig, user, status, ensureWorkspaceOpen } = chunk3LDVSHRD_cjs.useConnection();
30
30
  const wsId = workspaceId ?? fallbackWorkspaceId;
31
31
  const { data: members = [] } = react.useWorkspaceUsers(wsId, {
32
32
  enabled: status === "authenticated" && !!wsId,
@@ -78,5 +78,5 @@ exports.useConnectedAiTask = useConnectedAiTask;
78
78
  exports.useConnectedChat = useConnectedChat;
79
79
  exports.useSemanticSearch = useSemanticSearch;
80
80
  exports.useWorkspaceDocs = useWorkspaceDocs;
81
- //# sourceMappingURL=chunk-5D32XL3E.cjs.map
82
- //# sourceMappingURL=chunk-5D32XL3E.cjs.map
81
+ //# sourceMappingURL=chunk-54RSCDE6.cjs.map
82
+ //# sourceMappingURL=chunk-54RSCDE6.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/ai.tsx"],"names":["useConnection","useKitAiTask","useCallback","useKitWorkspaceDocs","useKitSemanticSearch","useWorkspaceUsers","buildMentionCandidates","useConversation","ConversationScope","jsx","AssistantDock"],"mappings":";;;;;;;;AAkCO,SAAS,kBAAA,GAAqB;AACnC,EAAA,MAAM,EAAE,eAAA,EAAgB,GAAIA,+BAAA,EAAc;AAC1C,EAAA,MAAM,OAAOC,eAAA,EAAa;AAC1B,EAAA,MAAM,SAAS,IAAA,CAAK,GAAA;AACpB,EAAA,MAAM,GAAA,GAAMC,mBAAA;AAAA,IACV,CAAC,QAAA,EAAkB,MAAA,EAAkB,IAAA,KACnC,OAAO,QAAA,EAAU,MAAA,EAAQ,EAAE,GAAG,IAAA,EAAM,KAAA,EAAO,IAAA,EAAM,KAAA,IAAS,iBAAiB,CAAA;AAAA,IAC7E,CAAC,QAAQ,eAAe;AAAA,GAC1B;AACA,EAAA,OAAO,EAAE,GAAG,IAAA,EAAM,GAAA,EAAI;AACxB;AAGO,SAAS,gBAAA,GAAmB;AACjC,EAAA,MAAM,EAAE,WAAA,EAAa,mBAAA,EAAoB,GAAIF,+BAAA,EAAc;AAC3D,EAAA,OAAOG,sBAAA,CAAoB,eAAe,mBAAmB,CAAA;AAC/D;AAGO,SAAS,iBAAA,GAAoB;AAClC,EAAA,MAAM,EAAE,eAAA,EAAgB,GAAIH,+BAAA,EAAc;AAC1C,EAAA,OAAOI,wBAAqB,EAAC,EAAG,EAAE,KAAA,EAAO,iBAAiB,CAAA;AAC5D;AAQO,SAAS,iBACd,OAAA,EAC8D;AAC9D,EAAA,MAAM,EAAE,aAAa,mBAAA,EAAqB,eAAA,EAAiB,MAAM,MAAA,EAAQ,mBAAA,KACvEJ,+BA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,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-5D32XL3E.cjs","sourcesContent":["/**\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 type { MentionCandidate } from '@arbidocs/react/shell'\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`).\n */\nexport function useConnectedChat(\n options?: Omit<UseConversationOptions, 'workspaceId'>\n): ArbiConversation & { mentionCandidates: MentionCandidate[] } {\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 mentionCandidates = buildMentionCandidates(\n status === 'authenticated' ? members : [],\n user?.externalId\n )\n const chat = useConversation({\n ...options,\n workspaceId: wsId,\n model: options?.model ?? assistantConfig,\n })\n return {\n ...chat,\n mentionCandidates,\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/ai.tsx"],"names":["useConnection","useKitAiTask","useCallback","useKitWorkspaceDocs","useKitSemanticSearch","useWorkspaceUsers","buildMentionCandidates","useConversation","ConversationScope","jsx","AssistantDock"],"mappings":";;;;;;;;AAkCO,SAAS,kBAAA,GAAqB;AACnC,EAAA,MAAM,EAAE,eAAA,EAAgB,GAAIA,+BAAA,EAAc;AAC1C,EAAA,MAAM,OAAOC,eAAA,EAAa;AAC1B,EAAA,MAAM,SAAS,IAAA,CAAK,GAAA;AACpB,EAAA,MAAM,GAAA,GAAMC,mBAAA;AAAA,IACV,CAAC,QAAA,EAAkB,MAAA,EAAkB,IAAA,KACnC,OAAO,QAAA,EAAU,MAAA,EAAQ,EAAE,GAAG,IAAA,EAAM,KAAA,EAAO,IAAA,EAAM,KAAA,IAAS,iBAAiB,CAAA;AAAA,IAC7E,CAAC,QAAQ,eAAe;AAAA,GAC1B;AACA,EAAA,OAAO,EAAE,GAAG,IAAA,EAAM,GAAA,EAAI;AACxB;AAGO,SAAS,gBAAA,GAAmB;AACjC,EAAA,MAAM,EAAE,WAAA,EAAa,mBAAA,EAAoB,GAAIF,+BAAA,EAAc;AAC3D,EAAA,OAAOG,sBAAA,CAAoB,eAAe,mBAAmB,CAAA;AAC/D;AAGO,SAAS,iBAAA,GAAoB;AAClC,EAAA,MAAM,EAAE,eAAA,EAAgB,GAAIH,+BAAA,EAAc;AAC1C,EAAA,OAAOI,wBAAqB,EAAC,EAAG,EAAE,KAAA,EAAO,iBAAiB,CAAA;AAC5D;AAQO,SAAS,iBACd,OAAA,EAC8D;AAC9D,EAAA,MAAM,EAAE,aAAa,mBAAA,EAAqB,eAAA,EAAiB,MAAM,MAAA,EAAQ,mBAAA,KACvEJ,+BAAA,EAAc;AAChB,EAAA,MAAM,OAAO,WAAA,IAAe,mBAAA;AAC5B,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,GAAU,EAAC,EAAE,GAAIK,wBAAkB,IAAA,EAAM;AAAA,IACrD,OAAA,EAAS,M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cjs","sourcesContent":["/**\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 type { MentionCandidate } from '@arbidocs/react/shell'\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`).\n */\nexport function useConnectedChat(\n options?: Omit<UseConversationOptions, 'workspaceId'>\n): ArbiConversation & { mentionCandidates: MentionCandidate[] } {\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 mentionCandidates = buildMentionCandidates(\n status === 'authenticated' ? members : [],\n user?.externalId\n )\n const chat = useConversation({\n ...options,\n workspaceId: wsId,\n model: options?.model ?? assistantConfig,\n })\n return {\n ...chat,\n mentionCandidates,\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,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunk25YFJLFP_cjs = require('./chunk-25YFJLFP.cjs');
4
+ var chunk6TJQTDQI_cjs = require('./chunk-6TJQTDQI.cjs');
5
5
  var react = require('react');
6
6
  var lucideReact = require('lucide-react');
7
7
  var ui = require('@arbidocs/react/ui');
@@ -29,7 +29,7 @@ var SearchHit = react.memo(function SearchHit2({
29
29
  className
30
30
  }) {
31
31
  const l = { ...DEFAULT_SEARCH_HIT_LABELS, ...labels };
32
- const { linkComponent: Link } = chunk25YFJLFP_cjs.useBlocksEnvironment();
32
+ const { linkComponent: Link } = chunk6TJQTDQI_cjs.useBlocksEnvironment();
33
33
  const [expanded, setExpanded] = react.useState(false);
34
34
  const [overflowing, setOverflowing] = react.useState(false);
35
35
  const bodyRef = react.useRef(null);
@@ -92,5 +92,5 @@ var SearchHit = react.memo(function SearchHit2({
92
92
 
93
93
  exports.DEFAULT_SEARCH_HIT_LABELS = DEFAULT_SEARCH_HIT_LABELS;
94
94
  exports.SearchHit = SearchHit;
95
- //# sourceMappingURL=chunk-ID2EVM5M.cjs.map
96
- //# sourceMappingURL=chunk-ID2EVM5M.cjs.map
95
+ //# sourceMappingURL=chunk-67L2XS3P.cjs.map
96
+ //# sourceMappingURL=chunk-67L2XS3P.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/retrieval/SearchHit.tsx"],"names":["memo","SearchHit","useBlocksEnvironment","useState","useRef","useLayoutEffect","jsx","PassageCard","cn","Eye"],"mappings":";;;;;;;;AAYO,IAAM,yBAAA,GAA6C;AAAA,EACxD,QAAA,EAAU,WAAA;AAAA,EACV,QAAA,EAAU;AACZ;AAEA,SAAS,gBAAgB,CAAA,EAAwB;AAC/C,EAAA,OAAO,CAAA,CAAE,WAAW,CAAA,IAAK,CAAA,CAAE,WAAW,CAAA,CAAE,OAAA,IAAW,CAAA,CAAE,QAAA,IAAY,CAAA,CAAE,MAAA;AACrE;AAgCO,IAAM,SAAA,GAAYA,UAAA,CAAK,SAASC,UAAAA,CAAU;AAAA,EAC/C,MAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,aAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA,GAAS,KAAA;AAAA,EACT,QAAA,GAAW,KA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js","sourcesContent":["import { memo, useLayoutEffect, useRef, useState, type MouseEvent, type ReactNode } from 'react'\nimport { Eye } from 'lucide-react'\n\nimport { cn, PassageCard } from '@arbidocs/react/ui'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport type { BlockLinkRenderProps } from '../components/blockLink'\n\nexport interface SearchHitLabels {\n showMore: string\n showLess: string\n}\n\nexport const DEFAULT_SEARCH_HIT_LABELS: SearchHitLabels = {\n showMore: 'Show more',\n showLess: 'Show less',\n}\n\nfunction isModifiedClick(e: MouseEvent): boolean {\n return e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey\n}\n\nexport interface SearchHitProps {\n /** Left side of the header row: a source pill or a small page label. */\n header: ReactNode\n /** Raw snippet text (passed through `renderSnippet`). */\n content: string\n /** Query terms to highlight; handed to `renderSnippet`. */\n terms: string[]\n /** Renders the snippet (markdown + highlight). The app owns the markdown pipeline. */\n renderSnippet: (content: string, terms: string[]) => ReactNode\n onClick: (e: MouseEvent) => void\n /** This passage is the one open in the viewer (yellow wash). */\n active?: boolean\n /** Marks the hit as the one currently open elsewhere (accent border + ring). */\n selected?: boolean\n /** Replaces the default open-eye on the right of the header. */\n headerRight?: ReactNode\n /**\n * Destination of the hit. Rendered as a real link (provider link component) so ctrl/cmd-click\n * opens it in a new tab; a plain click calls `onClick` and does not navigate.\n */\n href?: string\n labels?: Partial<SearchHitLabels>\n testId?: string\n className?: string\n}\n\n/**\n * Snippet-first search result: header over a 3-line clamped excerpt with a Show more toggle.\n * The card is a single click target; nothing interactive may sit inside its header.\n */\nexport const SearchHit = memo(function SearchHit({\n header,\n content,\n terms,\n renderSnippet,\n onClick,\n active = false,\n selected = false,\n headerRight,\n href,\n labels,\n testId,\n className,\n}: SearchHitProps) {\n const l = { ...DEFAULT_SEARCH_HIT_LABELS, ...labels }\n const { linkComponent: Link } = useBlocksEnvironment()\n const [expanded, setExpanded] = useState(false)\n const [overflowing, setOverflowing] = useState(false)\n const bodyRef = useRef<HTMLDivElement>(null)\n\n // Only offer \"Show more\" when the clamped snippet actually hides content.\n useLayoutEffect(() => {\n const el = bodyRef.current\n if (!el || expanded) return\n setOverflowing(el.scrollHeight > el.clientHeight + 1)\n }, [content, terms, expanded])\n\n const handleCardClick = (e: MouseEvent) => {\n if (href && isModifiedClick(e)) return\n if (href) e.preventDefault()\n onClick(e)\n }\n\n const card = (\n <PassageCard\n header={header}\n className={cn(\n // Plain `:hover` (not Tailwind `hover:`) so touchscreen laptops also get the border.\n '[&:hover]:border-primary',\n active && 'bg-yellow-100 dark:bg-yellow-800/40',\n className\n )}\n active={selected}\n headerRight={headerRight ?? <Eye className=\"size-4 text-muted-foreground\" aria-hidden />}\n onClick={handleCardClick}\n data-testid={testId}\n footer={\n (overflowing || expanded) && (\n <div className=\"flex justify-end\">\n <button\n type=\"button\"\n className=\"mt-1 text-xs font-medium text-primary hover:underline pointer-coarse:min-h-11\"\n onClick={(e) => {\n e.stopPropagation()\n e.preventDefault()\n setExpanded((v) => !v)\n }}\n >\n {expanded ? l.showLess : l.showMore}\n </button>\n </div>\n )\n }\n >\n <div\n ref={bodyRef}\n data-slot=\"search-hit\"\n className={cn('text-sm text-foreground/90', !expanded && 'line-clamp-3')}\n >\n {renderSnippet(content, terms)}\n </div>\n </PassageCard>\n )\n if (!href) return card\n const linkProps = {\n href,\n className: 'block',\n 'data-slot': 'search-hit-link',\n } as unknown as BlockLinkRenderProps\n return Link ? <Link {...linkProps}>{card}</Link> : <a {...linkProps}>{card}</a>\n})\n"]}
1
+ {"version":3,"sources":["../src/retrieval/SearchHit.tsx"],"names":["memo","SearchHit","useBlocksEnvironment","useState","useRef","useLayoutEffect","jsx","PassageCard","cn","Eye"],"mappings":";;;;;;;;AAYO,IAAM,yBAAA,GAA6C;AAAA,EACxD,QAAA,EAAU,WAAA;AAAA,EACV,QAAA,EAAU;AACZ;AAEA,SAAS,gBAAgB,CAAA,EAAwB;AAC/C,EAAA,OAAO,CAAA,CAAE,WAAW,CAAA,IAAK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AA,IACA,SAAA,EAAW,OAAA;AAAA,IACX,WAAA,EAAa;AAAA,GACf;AACA,EAAA,OAAO,IAAA,mBAAOF,cAAA,CAAC,IAAA,EAAA,EAAM,GAAG,SAAA,EAAY,QAAA,EAAA,IAAA,EAAK,CAAA,mBAAUA,cAAA,CAAC,GAAA,EAAA,EAAG,GAAG,SAAA,EAAY,QAAA,EAAA,IAAA,EAAK,CAAA;AAC7E,CAAC","file":"chunk-67L2XS3P.cjs","sourcesContent":["import { memo, useLayoutEffect, useRef, useState, type MouseEvent, type ReactNode } from 'react'\nimport { Eye } from 'lucide-react'\n\nimport { cn, PassageCard } from '@arbidocs/react/ui'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport type { BlockLinkRenderProps } from '../components/blockLink'\n\nexport interface SearchHitLabels {\n showMore: string\n showLess: string\n}\n\nexport const DEFAULT_SEARCH_HIT_LABELS: SearchHitLabels = {\n showMore: 'Show more',\n showLess: 'Show less',\n}\n\nfunction isModifiedClick(e: MouseEvent): boolean {\n return e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey\n}\n\nexport interface SearchHitProps {\n /** Left side of the header row: a source pill or a small page label. */\n header: ReactNode\n /** Raw snippet text (passed through `renderSnippet`). */\n content: string\n /** Query terms to highlight; handed to `renderSnippet`. */\n terms: string[]\n /** Renders the snippet (markdown + highlight). The app owns the markdown pipeline. */\n renderSnippet: (content: string, terms: string[]) => ReactNode\n onClick: (e: MouseEvent) => void\n /** This passage is the one open in the viewer (yellow wash). */\n active?: boolean\n /** Marks the hit as the one currently open elsewhere (accent border + ring). */\n selected?: boolean\n /** Replaces the default open-eye on the right of the header. */\n headerRight?: ReactNode\n /**\n * Destination of the hit. Rendered as a real link (provider link component) so ctrl/cmd-click\n * opens it in a new tab; a plain click calls `onClick` and does not navigate.\n */\n href?: string\n labels?: Partial<SearchHitLabels>\n testId?: string\n className?: string\n}\n\n/**\n * Snippet-first search result: header over a 3-line clamped excerpt with a Show more toggle.\n * The card is a single click target; nothing interactive may sit inside its header.\n */\nexport const SearchHit = memo(function SearchHit({\n header,\n content,\n terms,\n renderSnippet,\n onClick,\n active = false,\n selected = false,\n headerRight,\n href,\n labels,\n testId,\n className,\n}: SearchHitProps) {\n const l = { ...DEFAULT_SEARCH_HIT_LABELS, ...labels }\n const { linkComponent: Link } = useBlocksEnvironment()\n const [expanded, setExpanded] = useState(false)\n const [overflowing, setOverflowing] = useState(false)\n const bodyRef = useRef<HTMLDivElement>(null)\n\n // Only offer \"Show more\" when the clamped snippet actually hides content.\n useLayoutEffect(() => {\n const el = bodyRef.current\n if (!el || expanded) return\n setOverflowing(el.scrollHeight > el.clientHeight + 1)\n }, [content, terms, expanded])\n\n const handleCardClick = (e: MouseEvent) => {\n if (href && isModifiedClick(e)) return\n if (href) e.preventDefault()\n onClick(e)\n }\n\n const card = (\n <PassageCard\n header={header}\n className={cn(\n // Plain `:hover` (not Tailwind `hover:`) so touchscreen laptops also get the border.\n '[&:hover]:border-primary',\n active && 'bg-yellow-100 dark:bg-yellow-800/40',\n className\n )}\n active={selected}\n headerRight={headerRight ?? <Eye className=\"size-4 text-muted-foreground\" aria-hidden />}\n onClick={handleCardClick}\n data-testid={testId}\n footer={\n (overflowing || expanded) && (\n <div className=\"flex justify-end\">\n <button\n type=\"button\"\n className=\"mt-1 text-xs font-medium text-primary hover:underline pointer-coarse:min-h-11\"\n onClick={(e) => {\n e.stopPropagation()\n e.preventDefault()\n setExpanded((v) => !v)\n }}\n >\n {expanded ? l.showLess : l.showMore}\n </button>\n </div>\n )\n }\n >\n <div\n ref={bodyRef}\n data-slot=\"search-hit\"\n className={cn('text-sm text-foreground/90', !expanded && 'line-clamp-3')}\n >\n {renderSnippet(content, terms)}\n </div>\n </PassageCard>\n )\n if (!href) return card\n const linkProps = {\n href,\n className: 'block',\n 'data-slot': 'search-hit-link',\n } as unknown as BlockLinkRenderProps\n return Link ? <Link {...linkProps}>{card}</Link> : <a {...linkProps}>{card}</a>\n})\n"]}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkMDFXGRLY_cjs = require('./chunk-MDFXGRLY.cjs');
4
+ var chunkPSTA227J_cjs = require('./chunk-PSTA227J.cjs');
5
5
  var chunkZVJA66P7_cjs = require('./chunk-ZVJA66P7.cjs');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
 
@@ -9,10 +9,10 @@ function ConnectedNativeDocxComparison({
9
9
  fontBaseUrl,
10
10
  ...props
11
11
  }) {
12
- const adapter = chunkMDFXGRLY_cjs.useConnectedNativeDocxAdapter(fontBaseUrl);
12
+ const adapter = chunkPSTA227J_cjs.useConnectedNativeDocxAdapter(fontBaseUrl);
13
13
  return /* @__PURE__ */ jsxRuntime.jsx(chunkZVJA66P7_cjs.NativeDocxComparison, { ...props, adapter, onCompared: adapter.onVersionSaved });
14
14
  }
15
15
 
16
16
  exports.ConnectedNativeDocxComparison = ConnectedNativeDocxComparison;
17
- //# sourceMappingURL=chunk-2BNWISLH.cjs.map
18
- //# sourceMappingURL=chunk-2BNWISLH.cjs.map
17
+ //# sourceMappingURL=chunk-6HPBSKXG.cjs.map
18
+ //# sourceMappingURL=chunk-6HPBSKXG.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/docx/ConnectedNativeDocxComparison.tsx"],"names":["useConnectedNativeDocxAdapter","NativeDocxComparison"],"mappings":";;;;;;AAOO,SAAS,6BAAA,CAA8B;AAAA,EAC5C,WAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAyF;AACvF,EAAA,MAAM,OAAA,GAAUA,gDAA8B,WAAW,CAAA;AACzD,EAAA,sCAAQC,sCAAA,EAAA,EAAsB,GAAG,OAAO,OAAA,EAAkB,UAAA,EAAY,QAAQ,cAAA,EAAgB,CAAA;AAChG","file":"chunk-2BNWISLH.cjs","sourcesContent":["import {\n NativeDocxComparison,\n type NativeDocxComparisonProps,\n} from '../../docx/NativeDocxComparison'\nimport { useConnectedNativeDocxAdapter } from './ConnectedNativeDocxEditor'\n\n/** The Word redline of two documents or versions, on the signed-in session. */\nexport function ConnectedNativeDocxComparison({\n fontBaseUrl,\n ...props\n}: Omit<NativeDocxComparisonProps, 'adapter' | 'onCompared'> & { fontBaseUrl?: string }) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n return <NativeDocxComparison {...props} adapter={adapter} onCompared={adapter.onVersionSaved} />\n}\n"]}
1
+ {"version":3,"sources":["../src/connection/docx/ConnectedNativeDocxComparison.tsx"],"names":["useConnectedNativeDocxAdapter","NativeDocxComparison"],"mappings":";;;;;;AAOO,SAAS,6BAAA,CAA8B;AAAA,EAC5C,WAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAyF;AACvF,EAAA,MAAM,OAAA,GAAUA,gDAA8B,WAAW,CAAA;AACzD,EAAA,sCAAQC,sCAAA,EAAA,EAAsB,GAAG,OAAO,OAAA,EAAkB,UAAA,EAAY,QAAQ,cAAA,EAAgB,CAAA;AAChG","file":"chunk-6HPBSKXG.cjs","sourcesContent":["import {\n NativeDocxComparison,\n type NativeDocxComparisonProps,\n} from '../../docx/NativeDocxComparison'\nimport { useConnectedNativeDocxAdapter } from './ConnectedNativeDocxEditor'\n\n/** The Word redline of two documents or versions, on the signed-in session. */\nexport function ConnectedNativeDocxComparison({\n fontBaseUrl,\n ...props\n}: Omit<NativeDocxComparisonProps, 'adapter' | 'onCompared'> & { fontBaseUrl?: string }) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n return <NativeDocxComparison {...props} adapter={adapter} onCompared={adapter.onVersionSaved} />\n}\n"]}
@@ -156,5 +156,5 @@ function useBlocksEnvironment() {
156
156
  exports.requestSettingsSection = requestSettingsSection;
157
157
  exports.useBlocksEnvironment = useBlocksEnvironment;
158
158
  exports.useRequestedSettingsSection = useRequestedSettingsSection;
159
- //# sourceMappingURL=chunk-25YFJLFP.cjs.map
160
- //# sourceMappingURL=chunk-25YFJLFP.cjs.map
159
+ //# sourceMappingURL=chunk-6TJQTDQI.cjs.map
160
+ //# sourceMappingURL=chunk-6TJQTDQI.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/provider/dialogs.tsx","../src/provider/settings-section.ts","../src/provider/environment.ts"],"names":["request","useState","jsx","ModalScaffold","Info","AlertCircle","Button","resolve","useSyncExternalStore","notifyStore","useHostConfigRecord"],"mappings":";;;;;;;;;AA6CA,IAAM,gBAAA,GAAmB,GAAA;AAEzB,SAAS,YAAA,CAA+B;AAAA,EACtC,OAAA,EAAAA,QAAAA;AAAA,EACA;AACF,CAAA,EAGiB;AACf,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAIC,eAAS,IAAI,CAAA;AACrC,EAAA,MAAM,EAAE,SAAS,KAAA,GAAQ,SAAA,EAAW,SAAS,IAAA,GAAO,OAAA,EAAS,MAAA,GAAS,cAAA,EAAe,GAAID,QAAAA;AACzF,EAAA,MAAM,MAAA,GAAS,CAAC,KAAA,KAAoB;AAClC,IAAA,OAAA,CAAQ,KAAK,CAAA;AACb,IAAA,QAAA,CAAS,KAAK,CAAA;AAAA,EAChB,CAAA;AACA,EAAA,uBACEE,cAAA;AAAA,IAACC,+BAAA;AAAA,IAAA;AAAA,MACC,IAAA;AAAA,MACA,YAAA,EAAc,CAAC,IAAA,KAAS;AACtB,QAAA,IAAI,CAAC,IAAA,EAAM,MAAA,CAAO,IAAI,CAAA;AAAA,MACxB,CAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAA,EACE,IAAA,KAAS,MAAA,mBACPD,cAAA,CAACE,oBAAK,SAAA,EAAU,wBAAA,EAAyB,aAAA,EAAY,MAAA,EAAO,oBAE5DF,cAAA,CAACG,uBAAA,EAAA,EAAY,SAAA,EAAU,SAAA,EAAU,eAAY,MAAA,EAAO,CAAA;AAAA,MAGxD,WAAA,kBAAaH,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,uBAAuB,QAAA,EAAA,OAAA,EAAQ,CAAA;AAAA,MAC5D,eAAA,E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AAA,GAC3E;AAAA,EACA,SAAS,MAAM,MAAA;AAAA,EACf,YAAA,EAAc,IAAA;AAAA,EACd,gBAAA,EAAkB,IAAA;AAAA,EAClB,YAAA,EAAc,sBAAA;AAAA,EACd,WAAA,EAAa,IAAA;AAAA,EACb,YAAA,EAAc,IAAA;AAAA,EACd,mBAAA,EAAqB,IAAA;AAAA,EACrB,SAAA,EAAW,IAAA;AAAA,EACX,aAAA,EAAe;AACjB,CAAA;AAEA,IAAM,QAAA,uBAAe,OAAA,EAAmC;AAExD,SAAS,QAAQ,WAAA,EAA4D;AAC3E,EAAA,MAAM,EAAE,cAAa,GAAI,WAAA;AACzB,EAAA,OAAO;AAAA,IACL,GAAG,kBAAA;AAAA,IACH,GAAG,WAAA;AAAA;AAAA,IAEH,YAAA,EAAc,YAAA,GACV,CAAC,OAAA,KAAqB;AACpB,MAAA,sBAAA,CAAuB,OAAO,CAAA;AAC9B,MAAA,YAAA,CAAa,OAAO,CAAA;AAAA,IACtB,IACA,kBAAA,CAAmB;AAAA,GACzB;AACF;AAGO,SAAS,oBAAA,GAA0C;AACxD,EAAA,MAAM,WAAA,GAAcC,2BAAoB,CAAE,WAAA;AAC1C,EAAA,IAAI,CAAC,aAAa,OAAO,kBAAA;AACzB,EAAA,IAAI,KAAA,GAAQ,QAAA,CAAS,GAAA,CAAI,WAAW,CAAA;AACpC,EAAA,IAAI,CAAC,OAAO,QAAA,CAAS,GAAA,CAAI,aAAc,KAAA,GAAQ,OAAA,CAAQ,WAAW,CAAE,CAAA;AACpE,EAAA,OAAO,KAAA;AACT","file":"chunk-25YFJLFP.cjs","sourcesContent":["/**\n * Promise-based prompt dialogs — the blocks replacement for `window.confirm` / `window.alert`.\n * Each call mounts its own short-lived React root, so it works from any event handler with no\n * dialog host in the tree. Hosts reach these through `useBlocksEnvironment().confirm` / `.choose`\n * (the defaults), which lets an app swap in its own dialogs without touching callers.\n *\n * For a confirmation with a loading state, render the declarative {@link ConfirmDialog} instead.\n */\nimport { useState, type ReactElement } from 'react'\nimport { AlertCircle, Info } from 'lucide-react'\nimport { Button } from '@arbidocs/react/ui'\nimport { ModalScaffold } from '../settings/ModalScaffold'\n\ntype ChoiceVariant = 'default' | 'destructive' | 'outline'\n\nexport interface PromptChoice<T extends string> {\n label: string\n value: T\n variant?: ChoiceVariant\n}\n\n/** A dialog offering arbitrary choices (e.g. Overwrite / Skip / Cancel). */\nexport interface ChoiceRequest<T extends string> {\n message: string\n title?: string\n choices: PromptChoice<T>[]\n icon?: 'alert' | 'info'\n /** Dialog test id; each button is `${testId}-${value}-button`. Default `choice-modal`. */\n testId?: string\n}\n\n/**\n * `confirm` — Cancel / Confirm (destructive); `yesno` — No / Yes; `alert` — a single OK\n * (resolves true once acknowledged).\n */\nexport type ConfirmKind = 'confirm' | 'yesno' | 'alert'\n\nexport interface ConfirmRequest {\n message: string\n /** Default: \"Alert\" for `alert`, else \"Confirm\". */\n title?: string\n kind?: ConfirmKind\n}\n\n/** Close animation length before the root is unmounted. */\nconst UNMOUNT_DELAY_MS = 300\n\nfunction PromptDialog<T extends string>({\n request,\n onSettle,\n}: {\n request: ChoiceRequest<T>\n onSettle: (value: T | null) => void\n}): ReactElement {\n const [open, setOpen] = useState(true)\n const { message, title = 'Confirm', choices, icon = 'alert', testId = 'choice-modal' } = request\n const settle = (value: T | null) => {\n setOpen(false)\n onSettle(value)\n }\n return (\n <ModalScaffold\n open={open}\n onOpenChange={(next) => {\n if (!next) settle(null)\n }}\n title={title}\n icon={\n icon === 'info' ? (\n <Info className=\"h-5 w-5 text-blue-text\" aria-hidden=\"true\" />\n ) : (\n <AlertCircle className=\"h-5 w-5\" aria-hidden=\"true\" />\n )\n }\n description={<span className=\"whitespace-pre-line\">{message}</span>}\n showDescription\n testId={testId}\n >\n <ModalScaffold.Footer>\n {choices.map((choice) => (\n <Button\n key={choice.value}\n variant={choice.variant ?? 'default'}\n onClick={() => settle(choice.value)}\n data-testid={`${testId}-${choice.value.toLowerCase()}-button`}\n >\n {choice.label}\n </Button>\n ))}\n </ModalScaffold.Footer>\n </ModalScaffold>\n )\n}\n\n/** Show a choice dialog; resolves with the chosen `value`, or `null` when dismissed. */\nexport function choiceDialog<T extends string>(request: ChoiceRequest<T>): Promise<T | null> {\n if (typeof document === 'undefined') return Promise.resolve(null)\n return new Promise((resolve) => {\n const container = document.createElement('div')\n document.body.appendChild(container)\n let settled = false\n void import('react-dom/client').then(({ createRoot }) => {\n const root = createRoot(container)\n const onSettle = (value: T | null) => {\n if (settled) return\n settled = true\n resolve(value)\n setTimeout(() => {\n root.unmount()\n container.remove()\n }, UNMOUNT_DELAY_MS)\n }\n root.render(<PromptDialog request={request} onSettle={onSettle} />)\n })\n })\n}\n\nconst CONFIRM_CHOICES: Record<\n ConfirmKind,\n PromptChoice<'confirm' | 'cancel' | 'yes' | 'no' | 'ok'>[]\n> = {\n confirm: [\n { label: 'Cancel', value: 'cancel', variant: 'outline' },\n { label: 'Confirm', value: 'confirm', variant: 'destructive' },\n ],\n yesno: [\n { label: 'No', value: 'no', variant: 'outline' },\n { label: 'Yes', value: 'yes' },\n ],\n alert: [{ label: 'OK', value: 'ok' }],\n}\n\nconst CONFIRM_TEST_ID: Record<ConfirmKind, string> = {\n confirm: 'confirmation-modal',\n yesno: 'yes-no-modal',\n alert: 'alert-modal',\n}\n\n/** Show a confirmation; resolves true on Confirm / Yes / OK, false on cancel or dismissal. */\nexport async function confirmDialog(request: ConfirmRequest): Promise<boolean> {\n const kind = request.kind ?? 'confirm'\n const choice = await choiceDialog({\n message: request.message,\n title: request.title ?? (kind === 'alert' ? 'Alert' : 'Confirm'),\n choices: CONFIRM_CHOICES[kind],\n icon: kind === 'alert' ? 'info' : 'alert',\n testId: CONFIRM_TEST_ID[kind],\n })\n return choice === 'confirm' || choice === 'yes' || choice === 'ok'\n}\n","/**\n * The settings section asked for last, so `openSettings(section)` opens that section in every host.\n *\n * `BlocksEnvironment.openSettings` records the section here before the host shows its settings\n * (a panel, a route); a `ConnectedSettingsPage` without its own `section` prop opens at it and\n * follows every later request, even one for the section asked for before. A host that keeps the\n * open section itself (`section` + `onSectionChange`) routes `openSettings` to its own state.\n */\nimport { useSyncExternalStore } from 'react'\n\nexport interface SettingsSectionRequest {\n section: string\n /** Increases with every request, so asking again for the same section is a new request. */\n seq: number\n}\n\nlet request: SettingsSectionRequest | undefined\nconst listeners = new Set<() => void>()\n\n/** Ask for a settings section; no section asks for none (the page stays where it is). */\nexport function requestSettingsSection(section?: string): void {\n if (!section) return\n request = { section, seq: (request?.seq ?? 0) + 1 }\n listeners.forEach((listener) => listener())\n}\n\nfunction subscribe(listener: () => void): () => void {\n listeners.add(listener)\n return () => listeners.delete(listener)\n}\n\nconst snapshot = () => request\n\n/** The last settings-section request (`undefined` until there is one). */\nexport function useRequestedSettingsSection(): SettingsSectionRequest | undefined {\n return useSyncExternalStore(subscribe, snapshot, snapshot)\n}\n","import type { ReactNode } from 'react'\nimport {\n notify as notifyStore,\n useHostConfigRecord,\n type NotifyOptions,\n type NotifyVariant,\n} from '@arbidocs/react/shell'\nimport type { BlockLinkComponent } from '../components/blockLink'\nimport { choiceDialog, confirmDialog, type ChoiceRequest, type ConfirmRequest } from './dialogs'\nimport { requestSettingsSection } from './settings-section'\n\n/** What blocks need from the host's runtime configuration (the app's `config.json`). */\nexport interface BlocksRuntimeConfig {\n /** Origin of the ARBI API; `''` means the page's own origin. */\n apiBaseUrl: string\n /** The deployment's domain, e.g. `www.arbidocs.com` (deep links, key derivation, labels). */\n deploymentDomain: string\n}\n\nexport interface OpenDocumentOptions {\n /** 1-based page to scroll to. */\n page?: number\n /** Passage (chunk) to highlight. */\n passageId?: string\n /**\n * The workspace the document is in, when it is not the open one (a document an agent wrote in\n * its own workspace): the host opens that workspace first.\n */\n workspaceId?: string\n}\n\n/** Where files are added from: this device, links, or an email account. */\nexport type UploadSource = 'computer' | 'internet' | 'email'\n\n/** What `openShare` shares by email. */\nexport interface ShareRequest {\n resourceType: 'document' | 'conversation'\n resourceExtId: string\n workspaceExtId: string\n resourceName?: string\n /** Whether it is private to its owner now: the dialog offers to share it with the workspace. */\n isPrivate: boolean\n}\n\n/** What `openFiles` shows: some files selected, and the list narrowed. */\nexport interface OpenFilesOptions {\n /** Files to select. */\n select?: string[]\n /** Quick filters by key (a label id, `folder:<path>`, `folder:none`): show or hide those files. */\n filters?: Record<string, 'include' | 'exclude'>\n}\n\n/**\n * Something a kit links to (the target of an `open…` intent), for `hrefFor`. `workspaceId` is the\n * workspace it is in, when the kit knows it.\n */\nexport type LinkTarget =\n | { kind: 'document'; documentId: string; workspaceId?: string | null }\n | {\n kind: 'conversation'\n conversationId: string\n workspaceId?: string | null\n messageId?: string\n }\n | { kind: 'workspace'; workspaceId: string }\n\n/**\n * The only way blocks reach the host app's environment: the host configuration's `environment`\n * (`<ArbiHost config={{ environment: { navigate, notify, … } }}>`). Blocks never import a router, a\n * toast library or an app store; the host gives what it has, and every field has a safe default so\n * a block renders correctly with no host at all. A nested host overrides only the fields it gives\n * and inherits the rest.\n */\nexport interface BlocksEnvironment {\n /** Router-aware link (keeps navigation in-SPA). Default: a plain `<a href>`. */\n linkComponent?: BlockLinkComponent\n /** Imperative navigation for buttons and keyboard shortcuts. Default: `window.location.assign`. */\n navigate: (href: string) => void\n /** Surface a transient message (and record it in the notification centre). Default: the shared\n * `@arbidocs/react` notify store, rendered by its `<Toaster/>`. */\n notify: (message: ReactNode, kind?: NotifyVariant, options?: NotifyOptions) => void\n /** Ask the user to confirm. Default: the blocks prompt dialog. */\n confirm: (request: ConfirmRequest) => Promise<boolean>\n /** Ask the user to pick one of several choices; `null` when dismissed. Default: the blocks\n * prompt dialog. */\n choose: <T extends string>(request: ChoiceRequest<T>) => Promise<T | null>\n /** Deployment configuration. Default: same-origin API on the page's own host. */\n runtimeConfig: BlocksRuntimeConfig\n /**\n * The address of a target in the host's router, for a real link (open in a new tab, middle-click,\n * copy link) beside the matching `open…` intent: a kit never builds an app path itself, so its\n * links and its navigation agree on every site. `undefined`: no link (the row still opens on a\n * click). Default: none. ARBI-style paths (`/wrk-…/doc-…`): `deepLinkHref`.\n */\n hrefFor: (target: LinkTarget) => string | undefined\n /** Open a document (optionally at a page / passage) wherever the host shows documents.\n * Default: no-op. */\n openDocument: (documentId: string, options?: OpenDocumentOptions) => void\n /** Open a conversation thread, optionally scrolled to a message. Default: no-op. */\n openConversation: (conversationId: string, options?: { messageId?: string }) => void\n /**\n * Open the user's settings, optionally at a section (a `ConnectedSettingsPage` section id).\n * The section is always recorded for `ConnectedSettingsPage` first (`requestSettingsSection`);\n * the host's handler then shows its settings. Default: only that record.\n */\n openSettings: (section?: string) => void\n /** Open a project. Default: no-op. */\n openProject: (projectId: string) => void\n /**\n * Show the calendar page (`ConnectedCalendar`). A kit records what it opens on first (an event,\n * or the editor prefilled: `requestCalendarEvent` / `requestCalendarComposer`). Default: no-op.\n */\n openCalendar: () => void\n /**\n * Show a new, empty conversation (a launch then composes its first message into the session's\n * draft). Default: no-op.\n */\n openNewConversation: () => void\n /** Show the open workspace's files, optionally with some selected and the list narrowed. Default: no-op. */\n openFiles: (options?: OpenFilesOptions) => void\n /**\n * Add files the host's way (its upload dialog), optionally with some already picked, or from one\n * source. Absent: a kit that adds files uploads them itself.\n */\n openUpload?: (files?: File[], options?: { source?: UploadSource }) => void\n /** Open the host's skills browser, optionally at one skill. Absent: not offered. */\n openSkillsBrowser?: (skillSlug?: string) => void\n /** Share a document or a thread by email (the host's share dialog). Absent: not offered. */\n openShare?: (request: ShareRequest) => void\n /** Open an email draft in the host's mail. Absent: a kit offers no way to open one. */\n openMailDraft?: (draftId: string) => void\n /**\n * A React hook: how to open a workflow in the host's builder (no id: the Workflows page's list),\n * or `undefined` while the host has no Workflows page (a setting turns it off). Absent: never.\n */\n useOpenWorkflow?: () => ((workflowId?: string) => void) | undefined\n /**\n * Show a workspace (its own page). Under `defaultHost`'s sign-in layer the kits select it first\n * (`useConnectedWorkspace().openWorkspace`); a host that keeps its own session switches to it\n * here. `name` is for the host's messages. Default: no-op.\n */\n openWorkspace: (workspaceId: string, options?: { name?: string }) => void\n}\n\nconst noop = () => {}\n\nconst defaultEnvironment: BlocksEnvironment = {\n navigate: (href) => {\n if (typeof window !== 'undefined') window.location.assign(href)\n },\n notify: (message, kind = 'info', options) => {\n notifyStore[kind](message, options)\n },\n confirm: confirmDialog,\n choose: choiceDialog,\n runtimeConfig: {\n apiBaseUrl: '',\n deploymentDomain: typeof window !== 'undefined' ? window.location.host : '',\n },\n hrefFor: () => undefined,\n openDocument: noop,\n openConversation: noop,\n openSettings: requestSettingsSection,\n openProject: noop,\n openCalendar: noop,\n openNewConversation: noop,\n openFiles: noop,\n openWorkspace: noop,\n}\n\nconst resolved = new WeakMap<object, BlocksEnvironment>()\n\nfunction resolve(environment: Partial<BlocksEnvironment>): BlocksEnvironment {\n const { openSettings } = environment\n return {\n ...defaultEnvironment,\n ...environment,\n // The section is recorded for `ConnectedSettingsPage` before the host shows its settings.\n openSettings: openSettings\n ? (section?: string) => {\n requestSettingsSection(section)\n openSettings(section)\n }\n : defaultEnvironment.openSettings,\n }\n}\n\n/** The host's environment, every field filled in (the defaults where the host gives none). */\nexport function useBlocksEnvironment(): BlocksEnvironment {\n const environment = useHostConfigRecord().environment as Partial<BlocksEnvironment> | undefined\n if (!environment) return defaultEnvironment\n let value = resolved.get(environment)\n if (!value) resolved.set(environment, (value = resolve(environment)))\n return value\n}\n"]}
1
+ {"version":3,"sources":["../src/provider/dialogs.tsx","../src/provider/settings-section.ts","../src/provider/environment.ts"],"names":["request","useState","jsx","ModalScaffold","Info","AlertCircle","Button","resolve","useSyncExternalStore","notifyStore","useHostConfigRecord"],"mappings":";;;;;;;;;AA6CA,IAAM,gBAAA,GAAmB,GAAA;AAEzB,SAAS,YAAA,CAA+B;AAAA,EACtC,OAAA,EAAAA,QAAAA;AAAA,EACA;AACF,CAAA,EAGiB;AACf,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAIC,eAAS,IAAI,CAAA;AACrC,EAAA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BAAA;AAAA,IACH,GAAG,WAAA;AAAA;AAAA,IAEH,YAAA,EAAc,YAAA,GACV,CAAC,OAAA,KAAqB;AACpB,MAAA,sBAAA,CAAuB,OAAO,CAAA;AAC9B,MAAA,YAAA,CAAa,OAAO,CAAA;AAAA,IACtB,IACA,kBAAA,CAAmB;AAAA,GACzB;AACF;AAGO,SAAS,oBAAA,GAA0C;AACxD,EAAA,MAAM,WAAA,GAAcC,2BAAoB,CAAE,WAAA;AAC1C,EAAA,IAAI,CAAC,aAAa,OAAO,kBAAA;AACzB,EAAA,IAAI,KAAA,GAAQ,QAAA,CAAS,GAAA,CAAI,WAAW,CAAA;AACpC,EAAA,IAAI,CAAC,OAAO,QAAA,CAAS,GAAA,CAAI,aAAc,KAAA,GAAQ,OAAA,CAAQ,WAAW,CAAE,CAAA;AACpE,EAAA,OAAO,KAAA;AACT","file":"chunk-6TJQTDQI.cjs","sourcesContent":["/**\n * Promise-based prompt dialogs — the blocks replacement for `window.confirm` / `window.alert`.\n * Each call mounts its own short-lived React root, so it works from any event handler with no\n * dialog host in the tree. Hosts reach these through `useBlocksEnvironment().confirm` / `.choose`\n * (the defaults), which lets an app swap in its own dialogs without touching callers.\n *\n * For a confirmation with a loading state, render the declarative {@link ConfirmDialog} instead.\n */\nimport { useState, type ReactElement } from 'react'\nimport { AlertCircle, Info } from 'lucide-react'\nimport { Button } from '@arbidocs/react/ui'\nimport { ModalScaffold } from '../settings/ModalScaffold'\n\ntype ChoiceVariant = 'default' | 'destructive' | 'outline'\n\nexport interface PromptChoice<T extends string> {\n label: string\n value: T\n variant?: ChoiceVariant\n}\n\n/** A dialog offering arbitrary choices (e.g. Overwrite / Skip / Cancel). */\nexport interface ChoiceRequest<T extends string> {\n message: string\n title?: string\n choices: PromptChoice<T>[]\n icon?: 'alert' | 'info'\n /** Dialog test id; each button is `${testId}-${value}-button`. Default `choice-modal`. */\n testId?: string\n}\n\n/**\n * `confirm` — Cancel / Confirm (destructive); `yesno` — No / Yes; `alert` — a single OK\n * (resolves true once acknowledged).\n */\nexport type ConfirmKind = 'confirm' | 'yesno' | 'alert'\n\nexport interface ConfirmRequest {\n message: string\n /** Default: \"Alert\" for `alert`, else \"Confirm\". */\n title?: string\n kind?: ConfirmKind\n}\n\n/** Close animation length before the root is unmounted. */\nconst UNMOUNT_DELAY_MS = 300\n\nfunction PromptDialog<T extends string>({\n request,\n onSettle,\n}: {\n request: ChoiceRequest<T>\n onSettle: (value: T | null) => void\n}): ReactElement {\n const [open, setOpen] = useState(true)\n const { message, title = 'Confirm', choices, icon = 'alert', testId = 'choice-modal' } = request\n const settle = (value: T | null) => {\n setOpen(false)\n onSettle(value)\n }\n return (\n <ModalScaffold\n open={open}\n onOpenChange={(next) => {\n if (!next) settle(null)\n }}\n title={title}\n icon={\n icon === 'info' ? (\n <Info className=\"h-5 w-5 text-blue-text\" aria-hidden=\"true\" />\n ) : (\n <AlertCircle className=\"h-5 w-5\" aria-hidden=\"true\" />\n )\n }\n description={<span className=\"whitespace-pre-line\">{message}</span>}\n showDescription\n testId={testId}\n >\n <ModalScaffold.Footer>\n {choices.map((choice) => (\n <Button\n key={choice.value}\n variant={choice.variant ?? 'default'}\n onClick={() => settle(choice.value)}\n data-testid={`${testId}-${choice.value.toLowerCase()}-button`}\n >\n {choice.label}\n </Button>\n ))}\n </ModalScaffold.Footer>\n </ModalScaffold>\n )\n}\n\n/** Show a choice dialog; resolves with the chosen `value`, or `null` when dismissed. */\nexport function choiceDialog<T extends string>(request: ChoiceRequest<T>): Promise<T | null> {\n if (typeof document === 'undefined') return Promise.resolve(null)\n return new Promise((resolve) => {\n const container = document.createElement('div')\n document.body.appendChild(container)\n let settled = false\n void import('react-dom/client').then(({ createRoot }) => {\n const root = createRoot(container)\n const onSettle = (value: T | null) => {\n if (settled) return\n settled = true\n resolve(value)\n setTimeout(() => {\n root.unmount()\n container.remove()\n }, UNMOUNT_DELAY_MS)\n }\n root.render(<PromptDialog request={request} onSettle={onSettle} />)\n })\n })\n}\n\nconst CONFIRM_CHOICES: Record<\n ConfirmKind,\n PromptChoice<'confirm' | 'cancel' | 'yes' | 'no' | 'ok'>[]\n> = {\n confirm: [\n { label: 'Cancel', value: 'cancel', variant: 'outline' },\n { label: 'Confirm', value: 'confirm', variant: 'destructive' },\n ],\n yesno: [\n { label: 'No', value: 'no', variant: 'outline' },\n { label: 'Yes', value: 'yes' },\n ],\n alert: [{ label: 'OK', value: 'ok' }],\n}\n\nconst CONFIRM_TEST_ID: Record<ConfirmKind, string> = {\n confirm: 'confirmation-modal',\n yesno: 'yes-no-modal',\n alert: 'alert-modal',\n}\n\n/** Show a confirmation; resolves true on Confirm / Yes / OK, false on cancel or dismissal. */\nexport async function confirmDialog(request: ConfirmRequest): Promise<boolean> {\n const kind = request.kind ?? 'confirm'\n const choice = await choiceDialog({\n message: request.message,\n title: request.title ?? (kind === 'alert' ? 'Alert' : 'Confirm'),\n choices: CONFIRM_CHOICES[kind],\n icon: kind === 'alert' ? 'info' : 'alert',\n testId: CONFIRM_TEST_ID[kind],\n })\n return choice === 'confirm' || choice === 'yes' || choice === 'ok'\n}\n","/**\n * The settings section asked for last, so `openSettings(section)` opens that section in every host.\n *\n * `BlocksEnvironment.openSettings` records the section here before the host shows its settings\n * (a panel, a route); a `ConnectedSettingsPage` without its own `section` prop opens at it and\n * follows every later request, even one for the section asked for before. A host that keeps the\n * open section itself (`section` + `onSectionChange`) routes `openSettings` to its own state.\n */\nimport { useSyncExternalStore } from 'react'\n\nexport interface SettingsSectionRequest {\n section: string\n /** Increases with every request, so asking again for the same section is a new request. */\n seq: number\n}\n\nlet request: SettingsSectionRequest | undefined\nconst listeners = new Set<() => void>()\n\n/** Ask for a settings section; no section asks for none (the page stays where it is). */\nexport function requestSettingsSection(section?: string): void {\n if (!section) return\n request = { section, seq: (request?.seq ?? 0) + 1 }\n listeners.forEach((listener) => listener())\n}\n\nfunction subscribe(listener: () => void): () => void {\n listeners.add(listener)\n return () => listeners.delete(listener)\n}\n\nconst snapshot = () => request\n\n/** The last settings-section request (`undefined` until there is one). */\nexport function useRequestedSettingsSection(): SettingsSectionRequest | undefined {\n return useSyncExternalStore(subscribe, snapshot, snapshot)\n}\n","import type { ReactNode } from 'react'\nimport {\n notify as notifyStore,\n useHostConfigRecord,\n type NotifyOptions,\n type NotifyVariant,\n} from '@arbidocs/react/shell'\nimport type { BlockLinkComponent } from '../components/blockLink'\nimport { choiceDialog, confirmDialog, type ChoiceRequest, type ConfirmRequest } from './dialogs'\nimport { requestSettingsSection } from './settings-section'\n\n/** What blocks need from the host's runtime configuration (the app's `config.json`). */\nexport interface BlocksRuntimeConfig {\n /** Origin of the ARBI API; `''` means the page's own origin. */\n apiBaseUrl: string\n /** The deployment's domain, e.g. `www.arbidocs.com` (deep links, key derivation, labels). */\n deploymentDomain: string\n}\n\nexport interface OpenDocumentOptions {\n /** 1-based page to scroll to. */\n page?: number\n /** Passage (chunk) to highlight. */\n passageId?: string\n /**\n * The workspace the document is in, when it is not the open one (a document an agent wrote in\n * its own workspace): the host opens that workspace first.\n */\n workspaceId?: string\n}\n\n/** Where files are added from: this device, links, or an email account. */\nexport type UploadSource = 'computer' | 'internet' | 'email'\n\n/** What `openShare` shares by email. */\nexport interface ShareRequest {\n resourceType: 'document' | 'conversation'\n resourceExtId: string\n workspaceExtId: string\n resourceName?: string\n /** Whether it is private to its owner now: the dialog offers to share it with the workspace. */\n isPrivate: boolean\n}\n\n/** What `openFiles` shows: some files selected, and the list narrowed. */\nexport interface OpenFilesOptions {\n /** Files to select. */\n select?: string[]\n /** Quick filters by key (a label id, `folder:<path>`, `folder:none`): show or hide those files. */\n filters?: Record<string, 'include' | 'exclude'>\n}\n\n/**\n * Something a kit links to (the target of an `open…` intent), for `hrefFor`. `workspaceId` is the\n * workspace it is in, when the kit knows it.\n */\nexport type LinkTarget =\n | { kind: 'document'; documentId: string; workspaceId?: string | null }\n | {\n kind: 'conversation'\n conversationId: string\n workspaceId?: string | null\n messageId?: string\n }\n | { kind: 'workspace'; workspaceId: string }\n\n/**\n * The only way blocks reach the host app's environment: the host configuration's `environment`\n * (`<ArbiHost config={{ environment: { navigate, notify, … } }}>`). Blocks never import a router, a\n * toast library or an app store; the host gives what it has, and every field has a safe default so\n * a block renders correctly with no host at all. A nested host overrides only the fields it gives\n * and inherits the rest.\n */\nexport interface BlocksEnvironment {\n /** Router-aware link (keeps navigation in-SPA). Default: a plain `<a href>`. */\n linkComponent?: BlockLinkComponent\n /** Imperative navigation for buttons and keyboard shortcuts. Default: `window.location.assign`. */\n navigate: (href: string) => void\n /** Surface a transient message (and record it in the notification centre). Default: the shared\n * `@arbidocs/react` notify store, rendered by its `<Toaster/>`. */\n notify: (message: ReactNode, kind?: NotifyVariant, options?: NotifyOptions) => void\n /** Ask the user to confirm. Default: the blocks prompt dialog. */\n confirm: (request: ConfirmRequest) => Promise<boolean>\n /** Ask the user to pick one of several choices; `null` when dismissed. Default: the blocks\n * prompt dialog. */\n choose: <T extends string>(request: ChoiceRequest<T>) => Promise<T | null>\n /** Deployment configuration. Default: same-origin API on the page's own host. */\n runtimeConfig: BlocksRuntimeConfig\n /**\n * The address of a target in the host's router, for a real link (open in a new tab, middle-click,\n * copy link) beside the matching `open…` intent: a kit never builds an app path itself, so its\n * links and its navigation agree on every site. `undefined`: no link (the row still opens on a\n * click). Default: none. ARBI-style paths (`/wrk-…/doc-…`): `deepLinkHref`.\n */\n hrefFor: (target: LinkTarget) => string | undefined\n /** Open a document (optionally at a page / passage) wherever the host shows documents.\n * Default: no-op. */\n openDocument: (documentId: string, options?: OpenDocumentOptions) => void\n /**\n * Open a conversation thread, optionally scrolled to a message. `keepDocumentOpen`: the open\n * document stays on screen beside the thread (a thread about it). Default: no-op.\n */\n openConversation: (\n conversationId: string,\n options?: { messageId?: string; keepDocumentOpen?: boolean }\n ) => void\n /**\n * Open the user's settings, optionally at a section (a `ConnectedSettingsPage` section id).\n * The section is always recorded for `ConnectedSettingsPage` first (`requestSettingsSection`);\n * the host's handler then shows its settings. Default: only that record.\n */\n openSettings: (section?: string) => void\n /** Open a project. Default: no-op. */\n openProject: (projectId: string) => void\n /**\n * Show the calendar page (`ConnectedCalendar`). A kit records what it opens on first (an event,\n * or the editor prefilled: `requestCalendarEvent` / `requestCalendarComposer`). Default: no-op.\n */\n openCalendar: () => void\n /**\n * Show a new, empty conversation (a launch then composes its first message into the session's\n * draft); it starts unbound to any document. `keepDocumentOpen`: the open document stays on\n * screen beside it (a chat started from it). Default: no-op.\n */\n openNewConversation: (options?: { keepDocumentOpen?: boolean }) => void\n /** Show the open workspace's files, optionally with some selected and the list narrowed. Default: no-op. */\n openFiles: (options?: OpenFilesOptions) => void\n /**\n * Add files the host's way (its upload dialog), optionally with some already picked, or from one\n * source. Absent: a kit that adds files uploads them itself.\n */\n openUpload?: (files?: File[], options?: { source?: UploadSource }) => void\n /** Open the host's skills browser, optionally at one skill. Absent: not offered. */\n openSkillsBrowser?: (skillSlug?: string) => void\n /** Share a document or a thread by email (the host's share dialog). Absent: not offered. */\n openShare?: (request: ShareRequest) => void\n /** Open an email draft in the host's mail. Absent: a kit offers no way to open one. */\n openMailDraft?: (draftId: string) => void\n /**\n * A React hook: how to open a workflow in the host's builder (no id: the Workflows page's list),\n * or `undefined` while the host has no Workflows page (a setting turns it off). Absent: never.\n */\n useOpenWorkflow?: () => ((workflowId?: string) => void) | undefined\n /**\n * Show a workspace (its own page). Under `defaultHost`'s sign-in layer the kits select it first\n * (`useConnectedWorkspace().openWorkspace`); a host that keeps its own session switches to it\n * here. `name` is for the host's messages. Default: no-op.\n */\n openWorkspace: (workspaceId: string, options?: { name?: string }) => void\n}\n\nconst noop = () => {}\n\nconst defaultEnvironment: BlocksEnvironment = {\n navigate: (href) => {\n if (typeof window !== 'undefined') window.location.assign(href)\n },\n notify: (message, kind = 'info', options) => {\n notifyStore[kind](message, options)\n },\n confirm: confirmDialog,\n choose: choiceDialog,\n runtimeConfig: {\n apiBaseUrl: '',\n deploymentDomain: typeof window !== 'undefined' ? window.location.host : '',\n },\n hrefFor: () => undefined,\n openDocument: noop,\n openConversation: noop,\n openSettings: requestSettingsSection,\n openProject: noop,\n openCalendar: noop,\n openNewConversation: noop,\n openFiles: noop,\n openWorkspace: noop,\n}\n\nconst resolved = new WeakMap<object, BlocksEnvironment>()\n\nfunction resolve(environment: Partial<BlocksEnvironment>): BlocksEnvironment {\n const { openSettings } = environment\n return {\n ...defaultEnvironment,\n ...environment,\n // The section is recorded for `ConnectedSettingsPage` before the host shows its settings.\n openSettings: openSettings\n ? (section?: string) => {\n requestSettingsSection(section)\n openSettings(section)\n }\n : defaultEnvironment.openSettings,\n }\n}\n\n/** The host's environment, every field filled in (the defaults where the host gives none). */\nexport function useBlocksEnvironment(): BlocksEnvironment {\n const environment = useHostConfigRecord().environment as Partial<BlocksEnvironment> | undefined\n if (!environment) return defaultEnvironment\n let value = resolved.get(environment)\n if (!value) resolved.set(environment, (value = resolve(environment)))\n return value\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { useConnectedWorkspace } from './chunk-TXPOODAY.js';
2
+ import { useConnectedWorkspace } from './chunk-Z7PVDIUN.js';
3
3
  import { useHost } from './chunk-T4P237N6.js';
4
4
  import { useMemo } from 'react';
5
5
  import { useDocuments, useTags, useConversations } from '@arbidocs/react';
@@ -57,5 +57,5 @@ function useConnectedConversations(options) {
57
57
  }
58
58
 
59
59
  export { isListedDocument, listedDocuments, useConnectedConversations, useConnectedDocuments, useConnectedTags, useDocumentFilter, useListedDocuments };
60
- //# sourceMappingURL=chunk-ZC5MJIRC.js.map
61
- //# sourceMappingURL=chunk-ZC5MJIRC.js.map
60
+ //# sourceMappingURL=chunk-7KAJKYA7.js.map
61
+ //# sourceMappingURL=chunk-7KAJKYA7.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/connection/workspaceData.ts"],"names":[],"mappings":";;;;;AA8CO,SAAS,iBAAiB,QAAA,EAAgD;AAC/E,EAAA,OAAO,SAAS,OAAA,KAAY,OAAA;AAC9B;AAG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AK,IAAA,EAAM,eAAA,CAAgB,GAAA,CAAI,IAAA,EAAM,MAAM,CAAA,EAAE,CAAA,EAAI,CAAC,GAAA,EAAK,MAAM,CAAC,CAAA;AAC3F;AAGO,SAAS,gBAAA,GAAsD;AACpE,EAAA,MAAM,SAAA,GAAY,OAAA,EAAQ,CAAE,aAAA,EAAe,OAAA,IAAW,IAAA;AACtD,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,MAAM,EAAE,WAAA,EAAY,GAAI,qBAAA,EAAsB;AAC9C,EAAA,MAAM,GAAA,GAAM,QAAQ,WAAA,IAAe,MAAA,EAAW,EAAE,OAAA,EAAS,CAAC,QAAQ,CAAA;AAClE,EAAA,OAAO,OAAA,CAAQ,QAAQ,GAAG,CAAA;AAC5B;AAMO,SAAS,0BAA0B,OAAA,EAEQ;AAChD,EAAA,MAAM,EAAE,WAAA,EAAY,GAAI,qBAAA,EAAsB;AAC9C,EAAA,MAAM,EAAE,IAAA,EAAM,SAAA,EAAW,SAAQ,GAAI,gBAAA,CAAiB,eAAe,MAAA,EAAW;AAAA,IAC9E,MAAM,OAAA,EAAS;AAAA,GAChB,CAAA;AACD,EAAA,OAAO,OAAA;AAAA,IACL,OAAO,EAAE,IAAA,EAAM,QAAS,KAAA,EAAsC,MAAA,EAAQ,WAAW,OAAA,EAAQ,CAAA;AAAA,IACzF,CAAC,IAAA,EAAM,SAAA,EAAW,OAAO;AAAA,GAC3B;AACF","file":"chunk-ZC5MJIRC.js","sourcesContent":["/**\n * The open workspace's documents, tags and conversations for the connected kits. Each kit reads them\n * through the `@arbidocs/react` hooks: the documents from `useDocuments` (read once, progressively,\n * then patched in place by every write and event, so a kit never re-reads it) and the conversations\n * from `useConversations` (the one list every host and kit shares, patched by its writers). A host\n * that already keeps tags live in its own cache gives them once, as a hook in the host\n * configuration's `workspaceData`, so the kits show the same list and nothing is fetched twice.\n */\n\nimport { useMemo } from 'react'\nimport { useConversations, useDocuments, useTags } from '@arbidocs/react'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useHost } from '../provider/host'\n\nexport type ConnectedDocument = NonNullable<ReturnType<typeof useDocuments>['data']>[number]\nexport type ConnectedTag = NonNullable<ReturnType<typeof useTags>['data']>[number]\nexport type ConnectedConversationRow = NonNullable<\n ReturnType<typeof useConversations>['data']\n>[number]\n\n/**\n * A list the host keeps: its rows, whether it has arrived, and how to read it again (absent: the\n * host keeps it current itself, so a kit never re-reads it).\n */\nexport interface ConnectedList<T> {\n data: T[] | undefined\n isFetched: boolean\n refetch?: () => unknown\n}\n\n/** The lists a host keeps live for the open workspace, as hooks (each fixed for the host's life). */\nexport interface ConnectedWorkspaceData {\n useTags?: () => ConnectedList<ConnectedTag>\n /**\n * Which documents the browsing kits list: Files, the dashboard's recent files and the file\n * pickers (a workflow's documents, cross-references). Kits that act on given ids still see every\n * document. Default: `isListedDocument` (all but skill files); a host narrowing it further\n * usually keeps that too: `(d) => isListedDocument(d) && mine(d)`.\n */\n documentFilter?: (document: ConnectedDocument) => boolean\n}\n\n/**\n * The default `documentFilter`: every document but a skill's files (`wp_type: 'skill'`, under\n * `skills/<name>/`). They are how a skill is stored; the skills library shows them as skills.\n */\nexport function isListedDocument(document: { wp_type?: string | null }): boolean {\n return document.wp_type !== 'skill'\n}\n\n/** The host's `documentFilter` (default `isListedDocument`). */\nexport function useDocumentFilter(): (document: ConnectedDocument) => boolean {\n return useHost().workspaceData?.documentFilter ?? isListedDocument\n}\n\n/** Keep the listed documents; the same array when nothing is left out (stable for memos). */\nexport function listedDocuments<D>(\n documents: D[],\n filter: (document: ConnectedDocument) => boolean\n): D[] {\n // A kit's own row type is the same document list (a view of `DocResponse`).\n const kept = documents.filter(filter as unknown as (document: D) => boolean)\n return kept.length === documents.length ? documents : kept\n}\n\nconst NONE = () => undefined\n\nexport interface ConnectedListResult<T> {\n data: T[]\n loaded: boolean\n /** Read the list again after a change made here; absent when the host keeps it current. */\n refetch?: () => unknown\n}\n\nconst EMPTY: never[] = []\n\nfunction useList<T>(\n hosted: ConnectedList<T> | undefined,\n own: { data?: T[]; isFetched: boolean; refetch: () => unknown }\n): ConnectedListResult<T> {\n const source = hosted ?? own\n const data = source.data ?? (EMPTY as T[])\n const refetch = hosted ? hosted.refetch : own.refetch\n return useMemo(\n () => ({ data, loaded: source.isFetched, refetch }),\n [data, source.isFetched, refetch]\n )\n}\n\n/** The open workspace's documents (`useDocuments`: the one list every host and kit shares). */\nexport function useConnectedDocuments(): ConnectedListResult<ConnectedDocument> {\n const { workspaceId } = useConnectedWorkspace()\n const { data, isFetched } = useDocuments(workspaceId)\n return useMemo(\n () => ({ data: data ?? (EMPTY as ConnectedDocument[]), loaded: isFetched }),\n [data, isFetched]\n )\n}\n\n/** The open workspace's documents a person browses (the host's `documentFilter`). */\nexport function useListedDocuments(): ConnectedListResult<ConnectedDocument> {\n const all = useConnectedDocuments()\n const filter = useDocumentFilter()\n return useMemo(() => ({ ...all, data: listedDocuments(all.data, filter) }), [all, filter])\n}\n\n/** The open workspace's tags: the host's list when it gives one, else read here. */\nexport function useConnectedTags(): ConnectedListResult<ConnectedTag> {\n const useHosted = useHost().workspaceData?.useTags ?? NONE\n const hosted = useHosted()\n const { workspaceId } = useConnectedWorkspace()\n const own = useTags(workspaceId ?? undefined, { enabled: !hosted })\n return useList(hosted, own)\n}\n\n/**\n * The open workspace's conversations (threads and tasks): the shared list (`live`: re-read while\n * shown, as a run moves on by itself).\n */\nexport function useConnectedConversations(options?: {\n live?: boolean\n}): ConnectedListResult<ConnectedConversationRow> {\n const { workspaceId } = useConnectedWorkspace()\n const { data, isFetched, refetch } = useConversations(workspaceId ?? undefined, {\n live: options?.live,\n })\n return useMemo(\n () => ({ data: data ?? (EMPTY as ConnectedConversationRow[]), loaded: isFetched, refetch }),\n [data, isFetched, refetch]\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/connection/workspaceData.ts"],"names":[],"mappings":";;;;;AA8CO,SAAS,iBAAiB,QAAA,EAAgD;AAC/E,EAAA,OA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AAO,OAAA,CAAQ,OAAO,EAAE,GAAG,KAAK,IAAA,EAAM,eAAA,CAAgB,GAAA,CAAI,IAAA,EAAM,MAAM,CAAA,EAAE,CAAA,EAAI,CAAC,GAAA,EAAK,MAAM,CAAC,CAAA;AAC3F;AAGO,SAAS,gBAAA,GAAsD;AACpE,EAAA,MAAM,SAAA,GAAY,OAAA,EAAQ,CAAE,aAAA,EAAe,OAAA,IAAW,IAAA;AACtD,EAAA,MAAM,SAAS,SAAA,EAAU;AACzB,EAAA,MAAM,EAAE,WAAA,EAAY,GAAI,qBAAA,EAAsB;AAC9C,EAAA,MAAM,GAAA,GAAM,QAAQ,WAAA,IAAe,MAAA,EAAW,EAAE,OAAA,EAAS,CAAC,QAAQ,CAAA;AAClE,EAAA,OAAO,OAAA,CAAQ,QAAQ,GAAG,CAAA;AAC5B;AAMO,SAAS,0BAA0B,OAAA,EAEQ;AAChD,EAAA,MAAM,EAAE,WAAA,EAAY,GAAI,qBAAA,EAAsB;AAC9C,EAAA,MAAM,EAAE,IAAA,EAAM,SAAA,EAAW,SAAQ,GAAI,gBAAA,CAAiB,eAAe,MAAA,EAAW;AAAA,IAC9E,MAAM,OAAA,EAAS;AAAA,GAChB,CAAA;AACD,EAAA,OAAO,OAAA;AAAA,IACL,OAAO,EAAE,IAAA,EAAM,QAAS,KAAA,EAAsC,MAAA,EAAQ,WAAW,OAAA,EAAQ,CAAA;AAAA,IACzF,CAAC,IAAA,EAAM,SAAA,EAAW,OAAO;AAAA,GAC3B;AACF","file":"chunk-7KAJKYA7.js","sourcesContent":["/**\n * The open workspace's documents, tags and conversations for the connected kits. Each kit reads them\n * through the `@arbidocs/react` hooks: the documents from `useDocuments` (read once, progressively,\n * then patched in place by every write and event, so a kit never re-reads it) and the conversations\n * from `useConversations` (the one list every host and kit shares, patched by its writers). A host\n * that already keeps tags live in its own cache gives them once, as a hook in the host\n * configuration's `workspaceData`, so the kits show the same list and nothing is fetched twice.\n */\n\nimport { useMemo } from 'react'\nimport { useConversations, useDocuments, useTags } from '@arbidocs/react'\nimport { useConnectedWorkspace } from './ConnectionProvider'\nimport { useHost } from '../provider/host'\n\nexport type ConnectedDocument = NonNullable<ReturnType<typeof useDocuments>['data']>[number]\nexport type ConnectedTag = NonNullable<ReturnType<typeof useTags>['data']>[number]\nexport type ConnectedConversationRow = NonNullable<\n ReturnType<typeof useConversations>['data']\n>[number]\n\n/**\n * A list the host keeps: its rows, whether it has arrived, and how to read it again (absent: the\n * host keeps it current itself, so a kit never re-reads it).\n */\nexport interface ConnectedList<T> {\n data: T[] | undefined\n isFetched: boolean\n refetch?: () => unknown\n}\n\n/** The lists a host keeps live for the open workspace, as hooks (each fixed for the host's life). */\nexport interface ConnectedWorkspaceData {\n useTags?: () => ConnectedList<ConnectedTag>\n /**\n * Which documents the browsing kits list: Files, the dashboard's recent files and the file\n * pickers (a workflow's documents, cross-references). Kits that act on given ids still see every\n * document. Default: `isListedDocument` (all but skill files); a host narrowing it further\n * usually keeps that too: `(d) => isListedDocument(d) && mine(d)`.\n */\n documentFilter?: (document: ConnectedDocument) => boolean\n}\n\n/**\n * The default `documentFilter`: every document but a skill's files (`wp_type: 'skill'`, under\n * `skills/<name>/`). They are how a skill is stored; the skills library shows them as skills.\n */\nexport function isListedDocument(document: { wp_type?: string | null }): boolean {\n return document.wp_type !== 'skill'\n}\n\n/** The host's `documentFilter` (default `isListedDocument`). */\nexport function useDocumentFilter(): (document: ConnectedDocument) => boolean {\n return useHost().workspaceData?.documentFilter ?? isListedDocument\n}\n\n/** Keep the listed documents; the same array when nothing is left out (stable for memos). */\nexport function listedDocuments<D>(\n documents: D[],\n filter: (document: ConnectedDocument) => boolean\n): D[] {\n // A kit's own row type is the same document list (a view of `DocResponse`).\n const kept = documents.filter(filter as unknown as (document: D) => boolean)\n return kept.length === documents.length ? documents : kept\n}\n\nconst NONE = () => undefined\n\nexport interface ConnectedListResult<T> {\n data: T[]\n loaded: boolean\n /** Read the list again after a change made here; absent when the host keeps it current. */\n refetch?: () => unknown\n}\n\nconst EMPTY: never[] = []\n\nfunction useList<T>(\n hosted: ConnectedList<T> | undefined,\n own: { data?: T[]; isFetched: boolean; refetch: () => unknown }\n): ConnectedListResult<T> {\n const source = hosted ?? own\n const data = source.data ?? (EMPTY as T[])\n const refetch = hosted ? hosted.refetch : own.refetch\n return useMemo(\n () => ({ data, loaded: source.isFetched, refetch }),\n [data, source.isFetched, refetch]\n )\n}\n\n/** The open workspace's documents (`useDocuments`: the one list every host and kit shares). */\nexport function useConnectedDocuments(): ConnectedListResult<ConnectedDocument> {\n const { workspaceId } = useConnectedWorkspace()\n const { data, isFetched } = useDocuments(workspaceId)\n return useMemo(\n () => ({ data: data ?? (EMPTY as ConnectedDocument[]), loaded: isFetched }),\n [data, isFetched]\n )\n}\n\n/** The open workspace's documents a person browses (the host's `documentFilter`). */\nexport function useListedDocuments(): ConnectedListResult<ConnectedDocument> {\n const all = useConnectedDocuments()\n const filter = useDocumentFilter()\n return useMemo(() => ({ ...all, data: listedDocuments(all.data, filter) }), [all, filter])\n}\n\n/** The open workspace's tags: the host's list when it gives one, else read here. */\nexport function useConnectedTags(): ConnectedListResult<ConnectedTag> {\n const useHosted = useHost().workspaceData?.useTags ?? NONE\n const hosted = useHosted()\n const { workspaceId } = useConnectedWorkspace()\n const own = useTags(workspaceId ?? undefined, { enabled: !hosted })\n return useList(hosted, own)\n}\n\n/**\n * The open workspace's conversations (threads and tasks): the shared list (`live`: re-read while\n * shown, as a run moves on by itself).\n */\nexport function useConnectedConversations(options?: {\n live?: boolean\n}): ConnectedListResult<ConnectedConversationRow> {\n const { workspaceId } = useConnectedWorkspace()\n const { data, isFetched, refetch } = useConversations(workspaceId ?? undefined, {\n live: options?.live,\n })\n return useMemo(\n () => ({ data: data ?? (EMPTY as ConnectedConversationRow[]), loaded: isFetched, refetch }),\n [data, isFetched, refetch]\n )\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  import { RowNavigatorControls, LabelPickerList } from './chunk-JMQLTMJ7.js';
3
3
  import { DetailLoading, DetailBody, DetailSection, DetailFields, DetailField, DetailLinkList, DetailLinkItem, DetailEmpty } from './chunk-ZCOVDK2E.js';
4
4
  import { page, minuteUtc, cell, paragraph, documentXml, docxPackage, TABLE_DOCUMENT_STYLES, groupDefinitions, compareDefinitions } from './chunk-DIB4JYUY.js';
5
- import { taskActivityHeadline, DEFAULT_TASK_ACTIVITY_LABELS } from './chunk-DRLRR44Q.js';
5
+ import { taskActivityHeadline, DEFAULT_TASK_ACTIVITY_LABELS } from './chunk-FEYRHZYB.js';
6
6
  import { DocumentPicker } from './chunk-NUSBINUM.js';
7
7
  import { ModalHeader } from './chunk-TX2ZICS7.js';
8
8
  import { VisibilityToggle, cn, Textarea, Input, Button, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuItem, Checkbox, getEntityLabel, tagKindNouns, tagKindTitle, Popover, PopoverTrigger, PopoverContent, getEntityColor, isImageDocument, getDocumentTitle, Dialog, DialogContent, DialogTitle, DialogDescription } from '@arbidocs/react/ui';
@@ -2042,5 +2042,5 @@ function ExtractEntitiesDialog({
2042
2042
  }
2043
2043
 
2044
2044
  export { DEFAULT_GLOSSARY_LABELS, DEFAULT_TAG_COLUMNS_EDITOR_LABELS, DEFAULT_TAG_DETAIL_LABELS, DEFAULT_TAG_TABLE_DOCX_LABELS, DEFAULT_TAG_TABLE_LABELS, DEFAULT_THREAD_FOLLOW_LABELS, DEFAULT_WORKSPACE_ACTIVITY_LABELS, DEFAULT_WORKSPACE_NOTIFICATION_MENU_LABELS, EXTRACT_LIMIT, EntityIdentityBar, EntityTooltip, EntityTooltipHeader, EntityTooltipHint, EntityTooltipSection, EntityTooltipStats, ExtractEntitiesDialog, GridRowNavigator, IDENTITY_NAME_MAX_LENGTH, LoadingIndicator, SharedCell, TAG_TABLE_DOCX_LANDSCAPE_AFTER, TagColumnsEditor, TagDetail, TagPicker, TagTable, TagTableCell, ThreadFollowButton, ThreadFollowMenuItem, WorkspaceActivityList, WorkspaceNotificationMenu, cellText, cellValue, documentCount, entitiesPhrase, fieldWrites, glossaryDocumentXml, glossaryDocx, glossaryEntries, glossaryFileName, glossaryMarkdown, isGap, parseCell, rowLinks, tagDetailLabels, tagKindDescription, tagNoteLabel, tagTableDocumentXml, tagTableDocx, tagTableLabels, tagTableMarkdown, tagsPageNouns, workspaceActivityHeadline, workspaceActivityTarget };
2045
- //# sourceMappingURL=chunk-2RSUVU5V.js.map
2046
- //# sourceMappingURL=chunk-2RSUVU5V.js.map
2045
+ //# sourceMappingURL=chunk-AQ2XKOQ7.js.map
2046
+ //# sourceMappingURL=chunk-AQ2XKOQ7.js.map