@arbidocs/blocks 0.4.26 → 0.4.28
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.
- package/README.md +17 -0
- package/dist/agents/index.cjs +224 -212
- package/dist/agents/index.js +6 -6
- package/dist/agents/tasks/TaskRowMenu.d.ts +4 -1
- package/dist/agents/tasks/TaskRunsDialog.d.ts +3 -1
- package/dist/agents/tasks/taskRows.d.ts +2 -0
- package/dist/agents/workflows/WorkflowDocumentsField.d.ts +12 -0
- package/dist/agents/workflows/index.d.ts +2 -0
- package/dist/agents/workflows/workspaceScope.d.ts +18 -0
- package/dist/chat/ChatPage.d.ts +1 -1
- package/dist/chat/chat-page-types.d.ts +12 -1
- package/dist/chat/index.cjs +180 -180
- package/dist/chat/index.js +5 -5
- package/dist/{chunk-CPJBU5XQ.js → chunk-3NZR6PAG.js} +8 -120
- package/dist/chunk-3NZR6PAG.js.map +1 -0
- package/dist/chunk-4XJZ6AAY.js +407 -0
- package/dist/chunk-4XJZ6AAY.js.map +1 -0
- package/dist/{chunk-UOLMFC5K.js → chunk-6YVI74BC.js} +498 -108
- package/dist/chunk-6YVI74BC.js.map +1 -0
- package/dist/{chunk-5LUI4G5R.js → chunk-BV7FEMSI.js} +3 -3
- package/dist/{chunk-5LUI4G5R.js.map → chunk-BV7FEMSI.js.map} +1 -1
- package/dist/{chunk-ZEIOREJY.js → chunk-EHXSBH6U.js} +37 -6
- package/dist/chunk-EHXSBH6U.js.map +1 -0
- package/dist/chunk-EYPPB5CY.cjs +85 -0
- package/dist/chunk-EYPPB5CY.cjs.map +1 -0
- package/dist/{chunk-LZ4O2JPP.cjs → chunk-FRRDPYBR.cjs} +8 -123
- package/dist/chunk-FRRDPYBR.cjs.map +1 -0
- package/dist/chunk-KF4EC5XU.js +68 -0
- package/dist/chunk-KF4EC5XU.js.map +1 -0
- package/dist/{chunk-DHMAJ5LC.cjs → chunk-NSZAHL23.cjs} +158 -39
- package/dist/chunk-NSZAHL23.cjs.map +1 -0
- package/dist/{chunk-MLI6MCIE.js → chunk-QMUI2MGT.js} +155 -39
- package/dist/chunk-QMUI2MGT.js.map +1 -0
- package/dist/chunk-S5HZBXZA.cjs +430 -0
- package/dist/chunk-S5HZBXZA.cjs.map +1 -0
- package/dist/{chunk-JCVZKCXC.cjs → chunk-TLQQV7WW.cjs} +37 -6
- package/dist/chunk-TLQQV7WW.cjs.map +1 -0
- package/dist/{chunk-NNH7N62N.cjs → chunk-VMCOH3AY.cjs} +497 -105
- package/dist/chunk-VMCOH3AY.cjs.map +1 -0
- package/dist/{chunk-JLPYOPCX.js → chunk-WSJVHSGN.js} +225 -36
- package/dist/chunk-WSJVHSGN.js.map +1 -0
- package/dist/{chunk-TO4FAMQP.cjs → chunk-XKSFJYOD.cjs} +3 -3
- package/dist/{chunk-TO4FAMQP.cjs.map → chunk-XKSFJYOD.cjs.map} +1 -1
- package/dist/{chunk-J22DXUJY.cjs → chunk-ZHLMDJCO.cjs} +226 -34
- package/dist/chunk-ZHLMDJCO.cjs.map +1 -0
- package/dist/connect/docx.cjs +26 -8
- package/dist/connect/docx.cjs.map +1 -1
- package/dist/connect/docx.d.ts +1 -0
- package/dist/connect/docx.js +24 -7
- package/dist/connect/docx.js.map +1 -1
- package/dist/connect/index.cjs +281 -39
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +4 -0
- package/dist/connect/index.js +261 -23
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/ConnectedAgentChatPanel.d.ts +7 -0
- package/dist/connection/ConnectedNativeDocxEditor.d.ts +2 -1
- package/dist/connection/ConnectedSkillUpload.d.ts +2 -0
- package/dist/connection/ConnectedStreamedWordArtifact.d.ts +4 -0
- package/dist/connection/ConnectedTaskAccessRequest.d.ts +4 -0
- package/dist/connection/ai.d.ts +4 -1
- package/dist/connection/useConnectedWorkNotifications.d.ts +21 -0
- package/dist/docx/DocxMentions.d.ts +9 -2
- package/dist/docx/NativeDocxEditor.d.ts +11 -3
- package/dist/docx/StreamedWordArtifact.d.ts +15 -0
- package/dist/docx/index.cjs +16 -8
- package/dist/docx/index.d.ts +3 -2
- package/dist/docx/index.js +2 -2
- package/dist/docx/streamWordDocument.d.ts +12 -0
- package/dist/facts/index.cjs +2 -2
- package/dist/facts/index.js +2 -2
- package/dist/files/index.cjs +5 -5
- package/dist/files/index.js +5 -5
- package/dist/home/index.cjs +1 -1
- package/dist/home/index.js +1 -1
- package/dist/index.cjs +953 -941
- package/dist/index.js +20 -20
- package/dist/settings/index.cjs +44 -234
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.js +8 -204
- package/dist/settings/index.js.map +1 -1
- package/dist/shell/index.cjs +26 -26
- package/dist/shell/index.js +4 -4
- package/dist/studio/index.cjs +7 -6
- package/dist/studio/index.cjs.map +1 -1
- package/dist/studio/index.js +5 -4
- package/dist/studio/index.js.map +1 -1
- package/dist/workspaces/index.cjs +1 -1
- package/dist/workspaces/index.js +1 -1
- package/package.json +3 -3
- package/src/docx/styles.css +13 -0
- package/dist/chunk-5TRALRWN.js +0 -42
- package/dist/chunk-5TRALRWN.js.map +0 -1
- package/dist/chunk-CPJBU5XQ.js.map +0 -1
- package/dist/chunk-CQCC7LE7.js +0 -210
- package/dist/chunk-CQCC7LE7.js.map +0 -1
- package/dist/chunk-DHMAJ5LC.cjs.map +0 -1
- package/dist/chunk-EUOGPUMJ.cjs +0 -59
- package/dist/chunk-EUOGPUMJ.cjs.map +0 -1
- package/dist/chunk-J22DXUJY.cjs.map +0 -1
- package/dist/chunk-JCVZKCXC.cjs.map +0 -1
- package/dist/chunk-JLPYOPCX.js.map +0 -1
- package/dist/chunk-LZ4O2JPP.cjs.map +0 -1
- package/dist/chunk-MLI6MCIE.js.map +0 -1
- package/dist/chunk-NNH7N62N.cjs.map +0 -1
- package/dist/chunk-RFIBUWLF.cjs +0 -232
- package/dist/chunk-RFIBUWLF.cjs.map +0 -1
- package/dist/chunk-UOLMFC5K.js.map +0 -1
- package/dist/chunk-ZEIOREJY.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/connection/ConnectedNativeDocxEditor.tsx"],"names":["useArbi","useConnection","useQueryClient","useQuery","useMemo","loadDocxFonts","arbiQueryKeys","notify","
|
|
1
|
+
{"version":3,"sources":["../../src/connection/ConnectedNativeDocxEditor.tsx","../../src/connection/ConnectedStreamedWordArtifact.tsx"],"names":["jsx","NativeDocxEditor","useArbi","useConnection","useQueryClient","useQuery","useMemo","loadDocxFonts","arbiQueryKeys","notify","StreamedWordArtifact"],"mappings":";;;;;;;;;;;AAYO,SAAS,yBAAA,CAA0B;AAAA,EACxC,WAAA,GAAc,oBAAA;AAAA,EACd,GAAG;AACL,CAAA,EAAsE;AACpE,EAAA,MAAM,OAAA,GAAU,8BAA8B,WAAW,CAAA;AACzD,EAAA,uBAAOA,cAAA,CAACC,kCAAA,EAAA,EAAkB,GAAG,KAAA,EAAO,OAAA,EAAkB,CAAA;AACxD;AAEO,SAAS,6BAAA,CAA8B,cAAc,oBAAA,EAAsB;AAChF,EAAA,MAAM,OAAOC,aAAA,EAAQ;AACrB,EAAA,MAAM,EAAE,WAAA,EAAa,MAAA,EAAQ,IAAA,EAAM,mBAAA,KAAwBC,+BAAA,EAAc;AACzE,EAAA,MAAM,UAAUC,yBAAA,EAAe;AAC/B,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAQ,GAAIC,mBAAA,CAAS;AAAA,IACjC,UAAU,CAAC,qBAAA,EAAuB,MAAA,EAAQ,IAAA,EAAM,YAAY,WAAW,CAAA;AAAA,IACvE,OAAA,EAAS,IAAA,CAAK,UAAA,IAAc,CAAC,CAAC,WAAA;AAAA,IAC9B,SAAS,YAAY;AACnB,MAAA,MAAM,mBAAA,EAAoB;AAC1B,MAAA,OAAO,IAAA,CAAK,WAAW,SAAA,EAAU;AAAA,IACnC;AAAA,GACD,CAAA;AACD,EAAA,MAAM,OAAA,GAAUC,eAAA;AAAA,IACd,OA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ACnB,YAAY,OAAA,CAAQ,SAAA;AAAA,YACpB,aAAa,OAAA,CAAQ,WAAA;AAAA,YACrB,YAAY,OAAA,CAAQ,SAAA;AAAA,YACpB,eAAe,OAAA,CAAQ;AAAA,WACxB;AAAA,SACF,CAAA;AACD,QAAA,MAAM,QAAA,GAAY,MAAM,QAAA,CAAS,IAAA,EAAK;AACtC,QAAAA,YAAA,CAAO,QAAQ,oBAAoB,CAAA;AACnC,QAAA,OAAO,EAAE,WAAA,EAAa,QAAA,CAAS,YAAA,IAAgB,EAAC,EAAE;AAAA,MACpD,CAAA;AAAA,MACA,cAAA,EAAgB,OAAO,UAAA,KAAA,CAAgB,MAAM,KAAK,SAAA,CAAU,WAAA,CAAY,UAAU,CAAA,EAAG;AAAA,KACvF,CAAA;AAAA,IACA,CAAC,MAAM,MAAA,EAAQ,IAAA,EAAM,MAAM,OAAA,EAAS,mBAAA,EAAqB,WAAA,EAAa,OAAA,EAAS,WAAW;AAAA,GAC5F;AACA,EAAA,OAAO,OAAA;AACT;AC9FO,SAAS,6BAAA,CAA8B;AAAA,EAC5C,WAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA0E;AACxE,EAAA,MAAM,OAAA,GAAU,8BAA8B,WAAW,CAAA;AACzD,EAAA,uBAAOT,cAAAA,CAACU,sCAAA,EAAA,EAAsB,GAAG,OAAO,OAAA,EAAkB,CAAA;AAC5D","file":"docx.cjs","sourcesContent":["import { useMemo } from 'react'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport { useArbi, notify, arbiQueryKeys } from '@arbidocs/react'\nimport { useConnection } from './ConnectionProvider'\nimport {\n NativeDocxEditor,\n type NativeDocxAdapter,\n type NativeDocxEditorProps,\n} from '../docx/NativeDocxEditor'\nimport { loadDocxFonts } from '../docx/fonts'\n\n/** Native Word widget bound to the standard blocks connection and SDK session. */\nexport function ConnectedNativeDocxEditor({\n fontBaseUrl = '/native-docx/fonts',\n ...props\n}: Omit<NativeDocxEditorProps, 'adapter'> & { fontBaseUrl?: string }) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n return <NativeDocxEditor {...props} adapter={adapter} />\n}\n\nexport function useConnectedNativeDocxAdapter(fontBaseUrl = '/native-docx/fonts') {\n const arbi = useArbi()\n const { workspaceId, apiUrl, user, ensureWorkspaceOpen } = useConnection()\n const queries = useQueryClient()\n const { data: members } = useQuery({\n queryKey: ['native-docx-members', apiUrl, user?.externalId, workspaceId],\n enabled: arbi.isLoggedIn && !!workspaceId,\n queryFn: async () => {\n await ensureWorkspaceOpen()\n return arbi.workspaces.listUsers()\n },\n })\n const adapter = useMemo<NativeDocxAdapter>(\n () => ({\n request: async (path, options) => {\n await ensureWorkspaceOpen()\n return arbi.editor.request(path, options)\n },\n open: async (id) => {\n await ensureWorkspaceOpen()\n return (\n await arbi.editor.request(`/${encodeURIComponent(id)}/session`, { method: 'POST' })\n ).json()\n },\n save: async (id, state) =>\n (\n await arbi.editor.request(`/${encodeURIComponent(id)}/save`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ state }),\n })\n ).json(),\n loadFonts: () => loadDocxFonts(fontBaseUrl),\n baseUrl: apiUrl,\n author: user?.name || 'You',\n onVersionSaved: async (id) => {\n if (!workspaceId) return\n const key = arbiQueryKeys.documents(workspaceId)\n try {\n const documents = await arbi.documents.get([id])\n if (!documents.length) throw new Error('The saved version is not available yet.')\n queries.setQueryData<Awaited<ReturnType<typeof arbi.documents.list>>>(key, (previous) => [\n ...documents,\n ...(previous || []).filter(\n (doc) => !documents.some((saved) => saved.external_id === doc.external_id)\n ),\n ])\n } catch {\n await queries.invalidateQueries({ queryKey: key })\n }\n },\n notify: (message, kind) => notify[kind](message),\n mentions: members?.map(({ user: member }) => ({\n id: member.external_id,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n kind: member.external_id.startsWith('agt-') ? 'agent' : 'human',\n })),\n requestAgent: async (id, request) => {\n const response = await arbi.editor.request(`/${encodeURIComponent(id)}/mentions`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n comment_id: request.commentId,\n instruction: request.instruction,\n request_id: request.requestId,\n recipient_ids: request.recipientIds,\n }),\n })\n const delivery = (await response.json()) as { response_ids: string[] }\n notify.success('Mention delivered.')\n return { responseIds: delivery.response_ids || [] }\n },\n getAgentStatus: async (responseId) => (await arbi.assistant.getResponse(responseId)).status,\n }),\n [arbi, apiUrl, user?.name, members, ensureWorkspaceOpen, fontBaseUrl, queries, workspaceId]\n )\n return adapter\n}\n","import { useConnectedNativeDocxAdapter } from './ConnectedNativeDocxEditor'\nimport { StreamedWordArtifact, type StreamedWordArtifactProps } from '../docx/StreamedWordArtifact'\n\nexport function ConnectedStreamedWordArtifact({\n fontBaseUrl,\n ...props\n}: Omit<StreamedWordArtifactProps, 'adapter'> & { fontBaseUrl?: string }) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n return <StreamedWordArtifact {...props} adapter={adapter} />\n}\n"]}
|
package/dist/connect/docx.d.ts
CHANGED
package/dist/connect/docx.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { useConnection } from '../chunk-EHXSBH6U.js';
|
|
3
|
+
import { NativeDocxEditor, loadDocxFonts, StreamedWordArtifact } from '../chunk-6YVI74BC.js';
|
|
3
4
|
import '../chunk-AA3PT6KR.js';
|
|
4
|
-
import { useConnection } from '../chunk-ZEIOREJY.js';
|
|
5
5
|
import '../chunk-7F6CBP3Z.js';
|
|
6
6
|
import { useMemo } from 'react';
|
|
7
7
|
import { useQueryClient, useQuery } from '@tanstack/react-query';
|
|
@@ -12,6 +12,10 @@ function ConnectedNativeDocxEditor({
|
|
|
12
12
|
fontBaseUrl = "/native-docx/fonts",
|
|
13
13
|
...props
|
|
14
14
|
}) {
|
|
15
|
+
const adapter = useConnectedNativeDocxAdapter(fontBaseUrl);
|
|
16
|
+
return /* @__PURE__ */ jsx(NativeDocxEditor, { ...props, adapter });
|
|
17
|
+
}
|
|
18
|
+
function useConnectedNativeDocxAdapter(fontBaseUrl = "/native-docx/fonts") {
|
|
15
19
|
const arbi = useArbi();
|
|
16
20
|
const { workspaceId, apiUrl, user, ensureWorkspaceOpen } = useConnection();
|
|
17
21
|
const queries = useQueryClient();
|
|
@@ -25,7 +29,10 @@ function ConnectedNativeDocxEditor({
|
|
|
25
29
|
});
|
|
26
30
|
const adapter = useMemo(
|
|
27
31
|
() => ({
|
|
28
|
-
request:
|
|
32
|
+
request: async (path, options) => {
|
|
33
|
+
await ensureWorkspaceOpen();
|
|
34
|
+
return arbi.editor.request(path, options);
|
|
35
|
+
},
|
|
29
36
|
open: async (id) => {
|
|
30
37
|
await ensureWorkspaceOpen();
|
|
31
38
|
return (await arbi.editor.request(`/${encodeURIComponent(id)}/session`, { method: "POST" })).json();
|
|
@@ -61,7 +68,7 @@ function ConnectedNativeDocxEditor({
|
|
|
61
68
|
kind: member.external_id.startsWith("agt-") ? "agent" : "human"
|
|
62
69
|
})),
|
|
63
70
|
requestAgent: async (id, request) => {
|
|
64
|
-
await arbi.editor.request(`/${encodeURIComponent(id)}/mentions`, {
|
|
71
|
+
const response = await arbi.editor.request(`/${encodeURIComponent(id)}/mentions`, {
|
|
65
72
|
method: "POST",
|
|
66
73
|
headers: { "Content-Type": "application/json" },
|
|
67
74
|
body: JSON.stringify({
|
|
@@ -71,14 +78,24 @@ function ConnectedNativeDocxEditor({
|
|
|
71
78
|
recipient_ids: request.recipientIds
|
|
72
79
|
})
|
|
73
80
|
});
|
|
81
|
+
const delivery = await response.json();
|
|
74
82
|
notify.success("Mention delivered.");
|
|
75
|
-
|
|
83
|
+
return { responseIds: delivery.response_ids || [] };
|
|
84
|
+
},
|
|
85
|
+
getAgentStatus: async (responseId) => (await arbi.assistant.getResponse(responseId)).status
|
|
76
86
|
}),
|
|
77
87
|
[arbi, apiUrl, user?.name, members, ensureWorkspaceOpen, fontBaseUrl, queries, workspaceId]
|
|
78
88
|
);
|
|
79
|
-
return
|
|
89
|
+
return adapter;
|
|
90
|
+
}
|
|
91
|
+
function ConnectedStreamedWordArtifact({
|
|
92
|
+
fontBaseUrl,
|
|
93
|
+
...props
|
|
94
|
+
}) {
|
|
95
|
+
const adapter = useConnectedNativeDocxAdapter(fontBaseUrl);
|
|
96
|
+
return /* @__PURE__ */ jsx(StreamedWordArtifact, { ...props, adapter });
|
|
80
97
|
}
|
|
81
98
|
|
|
82
|
-
export { ConnectedNativeDocxEditor };
|
|
99
|
+
export { ConnectedNativeDocxEditor, ConnectedStreamedWordArtifact };
|
|
83
100
|
//# sourceMappingURL=docx.js.map
|
|
84
101
|
//# sourceMappingURL=docx.js.map
|
package/dist/connect/docx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/connection/ConnectedNativeDocxEditor.tsx"],"names":[],"mappings":";;;;;;;;;AAYO,SAAS,yBAAA,CAA0B;AAAA,EACxC,WAAA,GAAc,oBAAA;AAAA,EACd,GAAG;AACL,CAAA,EAAsE;AACpE,EAAA,MAAM,OAAO,OAAA,EAAQ;AACrB,EAAA,MAAM,EAAE,WAAA,EAAa,MAAA,EAAQ,IAAA,EAAM,mBAAA,KAAwB,aAAA,EAAc;AACzE,EAAA,MAAM,UAAU,cAAA,EAAe;AAC/B,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAQ,GAAI,QAAA,CAAS;AAAA,IACjC,UAAU,CAAC,qBAAA,EAAuB,MAAA,EAAQ,IAAA,EAAM,YAAY,WAAW,CAAA;AAAA,IACvE,OAAA,EAAS,IAAA,CAAK,UAAA,IAAc,CAAC,CAAC,WAAA;AAAA,IAC9B,SAAS,YAAY;AACnB,MAAA,MAAM,mBAAA,EAAoB;AAC1B,MAAA,OAAO,IAAA,CAAK,WAAW,SAAA,EAAU;AAAA,IACnC;AAAA,GACD,CAAA;AACD,EAAA,MAAM,OAAA,GAAU,OAAA;AAAA,IACd,OAAO;AAAA,MACL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AAoB,CAAA;AACnC,QAAA,OAAO,EAAE,WAAA,EAAa,QAAA,CAAS,YAAA,IAAgB,EAAC,EAAE;AAAA,MACpD,CAAA;AAAA,MACA,cAAA,EAAgB,OAAO,UAAA,KAAA,CAAgB,MAAM,KAAK,SAAA,CAAU,WAAA,CAAY,UAAU,CAAA,EAAG;AAAA,KACvF,CAAA;AAAA,IACA,CAAC,MAAM,MAAA,EAAQ,IAAA,EAAM,MAAM,OAAA,EAAS,mBAAA,EAAqB,WAAA,EAAa,OAAA,EAAS,WAAW;AAAA,GAC5F;AACA,EAAA,OAAO,OAAA;AACT;AC9FO,SAAS,6BAAA,CAA8B;AAAA,EAC5C,WAAA;AAAA,EACA,GAAG;AACL,CAAA,EAA0E;AACxE,EAAA,MAAM,OAAA,GAAU,8BAA8B,WAAW,CAAA;AACzD,EAAA,uBAAOA,GAAAA,CAAC,oBAAA,EAAA,EAAsB,GAAG,OAAO,OAAA,EAAkB,CAAA;AAC5D","file":"docx.js","sourcesContent":["import { useMemo } from 'react'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport { useArbi, notify, arbiQueryKeys } from '@arbidocs/react'\nimport { useConnection } from './ConnectionProvider'\nimport {\n NativeDocxEditor,\n type NativeDocxAdapter,\n type NativeDocxEditorProps,\n} from '../docx/NativeDocxEditor'\nimport { loadDocxFonts } from '../docx/fonts'\n\n/** Native Word widget bound to the standard blocks connection and SDK session. */\nexport function ConnectedNativeDocxEditor({\n fontBaseUrl = '/native-docx/fonts',\n ...props\n}: Omit<NativeDocxEditorProps, 'adapter'> & { fontBaseUrl?: string }) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n return <NativeDocxEditor {...props} adapter={adapter} />\n}\n\nexport function useConnectedNativeDocxAdapter(fontBaseUrl = '/native-docx/fonts') {\n const arbi = useArbi()\n const { workspaceId, apiUrl, user, ensureWorkspaceOpen } = useConnection()\n const queries = useQueryClient()\n const { data: members } = useQuery({\n queryKey: ['native-docx-members', apiUrl, user?.externalId, workspaceId],\n enabled: arbi.isLoggedIn && !!workspaceId,\n queryFn: async () => {\n await ensureWorkspaceOpen()\n return arbi.workspaces.listUsers()\n },\n })\n const adapter = useMemo<NativeDocxAdapter>(\n () => ({\n request: async (path, options) => {\n await ensureWorkspaceOpen()\n return arbi.editor.request(path, options)\n },\n open: async (id) => {\n await ensureWorkspaceOpen()\n return (\n await arbi.editor.request(`/${encodeURIComponent(id)}/session`, { method: 'POST' })\n ).json()\n },\n save: async (id, state) =>\n (\n await arbi.editor.request(`/${encodeURIComponent(id)}/save`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ state }),\n })\n ).json(),\n loadFonts: () => loadDocxFonts(fontBaseUrl),\n baseUrl: apiUrl,\n author: user?.name || 'You',\n onVersionSaved: async (id) => {\n if (!workspaceId) return\n const key = arbiQueryKeys.documents(workspaceId)\n try {\n const documents = await arbi.documents.get([id])\n if (!documents.length) throw new Error('The saved version is not available yet.')\n queries.setQueryData<Awaited<ReturnType<typeof arbi.documents.list>>>(key, (previous) => [\n ...documents,\n ...(previous || []).filter(\n (doc) => !documents.some((saved) => saved.external_id === doc.external_id)\n ),\n ])\n } catch {\n await queries.invalidateQueries({ queryKey: key })\n }\n },\n notify: (message, kind) => notify[kind](message),\n mentions: members?.map(({ user: member }) => ({\n id: member.external_id,\n name: [member.given_name, member.family_name].filter(Boolean).join(' '),\n kind: member.external_id.startsWith('agt-') ? 'agent' : 'human',\n })),\n requestAgent: async (id, request) => {\n const response = await arbi.editor.request(`/${encodeURIComponent(id)}/mentions`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n comment_id: request.commentId,\n instruction: request.instruction,\n request_id: request.requestId,\n recipient_ids: request.recipientIds,\n }),\n })\n const delivery = (await response.json()) as { response_ids: string[] }\n notify.success('Mention delivered.')\n return { responseIds: delivery.response_ids || [] }\n },\n getAgentStatus: async (responseId) => (await arbi.assistant.getResponse(responseId)).status,\n }),\n [arbi, apiUrl, user?.name, members, ensureWorkspaceOpen, fontBaseUrl, queries, workspaceId]\n )\n return adapter\n}\n","import { useConnectedNativeDocxAdapter } from './ConnectedNativeDocxEditor'\nimport { StreamedWordArtifact, type StreamedWordArtifactProps } from '../docx/StreamedWordArtifact'\n\nexport function ConnectedStreamedWordArtifact({\n fontBaseUrl,\n ...props\n}: Omit<StreamedWordArtifactProps, 'adapter'> & { fontBaseUrl?: string }) {\n const adapter = useConnectedNativeDocxAdapter(fontBaseUrl)\n return <StreamedWordArtifact {...props} adapter={adapter} />\n}\n"]}
|
package/dist/connect/index.cjs
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
var chunkEYPPB5CY_cjs = require('../chunk-EYPPB5CY.cjs');
|
|
4
5
|
var chunkYVIOCITQ_cjs = require('../chunk-YVIOCITQ.cjs');
|
|
5
|
-
var chunkEUOGPUMJ_cjs = require('../chunk-EUOGPUMJ.cjs');
|
|
6
6
|
var chunkQVBZESYQ_cjs = require('../chunk-QVBZESYQ.cjs');
|
|
7
7
|
require('../chunk-ADOKTJHV.cjs');
|
|
8
|
-
require('../chunk-
|
|
8
|
+
var chunkZHLMDJCO_cjs = require('../chunk-ZHLMDJCO.cjs');
|
|
9
9
|
require('../chunk-VGOFFCMT.cjs');
|
|
10
10
|
require('../chunk-PPCATBOY.cjs');
|
|
11
11
|
var chunkKDG6FER6_cjs = require('../chunk-KDG6FER6.cjs');
|
|
12
12
|
require('../chunk-DCDVWPMB.cjs');
|
|
13
|
-
var
|
|
13
|
+
var chunkTLQQV7WW_cjs = require('../chunk-TLQQV7WW.cjs');
|
|
14
|
+
require('../chunk-7UTB4PHM.cjs');
|
|
14
15
|
require('../chunk-MHVNT4J3.cjs');
|
|
15
16
|
var react = require('react');
|
|
16
17
|
var reactQuery = require('@tanstack/react-query');
|
|
17
18
|
var react$1 = require('@arbidocs/react');
|
|
18
19
|
var jsxRuntime = require('react/jsx-runtime');
|
|
20
|
+
var ui = require('@arbidocs/react/ui');
|
|
19
21
|
var artifacts = require('@arbidocs/react/artifacts');
|
|
20
22
|
var lucideReact = require('lucide-react');
|
|
21
|
-
var ui = require('@arbidocs/react/ui');
|
|
22
23
|
var shell = require('@arbidocs/react/shell');
|
|
23
24
|
|
|
24
25
|
function ConnectionBoundWebSocket({ children }) {
|
|
25
|
-
const { status } =
|
|
26
|
+
const { status } = chunkTLQQV7WW_cjs.useConnection();
|
|
26
27
|
return /* @__PURE__ */ jsxRuntime.jsx(react$1.ArbiWebSocketProvider, { enabled: status === "authenticated", children });
|
|
27
28
|
}
|
|
28
29
|
function ArbiAppProvider({
|
|
@@ -35,7 +36,76 @@ function ArbiAppProvider({
|
|
|
35
36
|
})
|
|
36
37
|
);
|
|
37
38
|
const providerUrl = config.apiUrl || config.demoApiUrl || "https://demo.arbi.local";
|
|
38
|
-
return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.ArbiProvider, { url: providerUrl, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
39
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.ArbiProvider, { url: providerUrl, children: /* @__PURE__ */ jsxRuntime.jsx(chunkTLQQV7WW_cjs.ConnectionProvider, { config, children: /* @__PURE__ */ jsxRuntime.jsx(ConnectionBoundWebSocket, { children }) }) }) });
|
|
40
|
+
}
|
|
41
|
+
function ConnectedTaskAccessRequest({ conversationId }) {
|
|
42
|
+
const { workspaceId } = chunkTLQQV7WW_cjs.useConnection();
|
|
43
|
+
const tasks = react$1.useConversations(workspaceId ?? void 0, { live: true });
|
|
44
|
+
const run = react$1.useRunConversation();
|
|
45
|
+
const task = tasks.data?.find((item) => item.external_id === conversationId);
|
|
46
|
+
if (!task?.pending_auth_request_id || !task.is_owner) return null;
|
|
47
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
48
|
+
"section",
|
|
49
|
+
{
|
|
50
|
+
className: "flex flex-wrap items-center gap-3 rounded-lg border bg-card p-3",
|
|
51
|
+
"data-testid": "task-chat-access-request",
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "flex-1 text-sm", children: "This task is waiting for temporary workspace access." }),
|
|
54
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
55
|
+
ui.Button,
|
|
56
|
+
{
|
|
57
|
+
disabled: run.isPending,
|
|
58
|
+
onClick: () => run.mutate(task.external_id),
|
|
59
|
+
"data-testid": "task-chat-allow-access",
|
|
60
|
+
children: run.isPending ? "Allowing access\u2026" : "Allow access and run"
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
run.error && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", className: "w-full text-sm text-destructive", children: run.error.message })
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function ConnectedSkillUpload() {
|
|
69
|
+
const [name, setName] = react.useState("");
|
|
70
|
+
const [file, setFile] = react.useState(null);
|
|
71
|
+
const upload = react$1.useUploadSkillFiles();
|
|
72
|
+
const slug = name.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
73
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "space-y-3 rounded-lg border p-4", "data-testid": "skill-upload", children: [
|
|
74
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-sm font-semibold", children: "Add a skill" }),
|
|
75
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Upload a SKILL.md file containing the instructions your assistant should follow." }),
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "skill-upload-name", children: "Skill name" }),
|
|
77
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
78
|
+
ui.Input,
|
|
79
|
+
{
|
|
80
|
+
id: "skill-upload-name",
|
|
81
|
+
value: name,
|
|
82
|
+
onChange: (event) => setName(event.target.value),
|
|
83
|
+
placeholder: "disclosure-review",
|
|
84
|
+
"data-testid": "skill-upload-name"
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
88
|
+
ui.Input,
|
|
89
|
+
{
|
|
90
|
+
type: "file",
|
|
91
|
+
accept: ".md",
|
|
92
|
+
"aria-label": "Skill instructions file",
|
|
93
|
+
onChange: (event) => setFile(event.target.files?.[0] ?? null),
|
|
94
|
+
"data-testid": "skill-upload-file"
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
98
|
+
ui.Button,
|
|
99
|
+
{
|
|
100
|
+
disabled: !slug || !file || upload.isPending,
|
|
101
|
+
onClick: () => file && upload.mutate([{ folder: `skills/${slug}`, fileName: "SKILL.md", content: file }]),
|
|
102
|
+
"data-testid": "skill-upload-submit",
|
|
103
|
+
children: upload.isPending ? "Uploading\u2026" : "Upload skill"
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
upload.isSuccess && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "status", className: "text-sm", children: "Uploaded. The skill will appear once processing finishes." }),
|
|
107
|
+
upload.error && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", className: "text-sm text-destructive", children: upload.error.message })
|
|
108
|
+
] });
|
|
39
109
|
}
|
|
40
110
|
var StreamedArtifactEditor = react.lazy(() => import('../StreamedArtifactEditor-L2AZZORU.cjs'));
|
|
41
111
|
function StreamedArtifact({
|
|
@@ -109,7 +179,7 @@ function StreamedArtifact({
|
|
|
109
179
|
);
|
|
110
180
|
}
|
|
111
181
|
function useConnectedShellWorkspaces(options = {}) {
|
|
112
|
-
const { workspaceId, setWorkspace } =
|
|
182
|
+
const { workspaceId, setWorkspace } = chunkTLQQV7WW_cjs.useConnection();
|
|
113
183
|
const query = react$1.useWorkspaces();
|
|
114
184
|
return react$1.useShellWorkspaces({
|
|
115
185
|
...options,
|
|
@@ -129,21 +199,21 @@ var AVATAR_PROBLEMS = {
|
|
|
129
199
|
"too-large": "Image must be 5 MB or smaller",
|
|
130
200
|
unreadable: "Couldn't read that image \u2014 try a different file"
|
|
131
201
|
};
|
|
132
|
-
function ConnectedProfileCard({ notify:
|
|
202
|
+
function ConnectedProfileCard({ notify: notify3, title = "Profile" }) {
|
|
133
203
|
const { data: profile } = react$1.useProfile();
|
|
134
204
|
const updateProfile = react$1.useUpdateProfile();
|
|
135
205
|
const requestEmailChange = react$1.useRequestEmailChange();
|
|
136
206
|
const confirmEmailChange = react$1.useConfirmEmailChange();
|
|
137
|
-
const { user } =
|
|
207
|
+
const { user } = chunkTLQQV7WW_cjs.useConnection();
|
|
138
208
|
const name = react$1.useNameEditor({
|
|
139
209
|
givenName: profile?.givenName,
|
|
140
210
|
familyName: profile?.familyName,
|
|
141
211
|
save: async (next) => {
|
|
142
212
|
try {
|
|
143
213
|
await updateProfile.mutateAsync(next);
|
|
144
|
-
|
|
214
|
+
notify3?.("Name updated", "success");
|
|
145
215
|
} catch (e) {
|
|
146
|
-
|
|
216
|
+
notify3?.("Failed to update name", "error");
|
|
147
217
|
throw e;
|
|
148
218
|
}
|
|
149
219
|
}
|
|
@@ -152,30 +222,30 @@ function ConnectedProfileCard({ notify: notify2, title = "Profile" }) {
|
|
|
152
222
|
upload: async (picture) => {
|
|
153
223
|
try {
|
|
154
224
|
await updateProfile.mutateAsync({ picture });
|
|
155
|
-
|
|
225
|
+
notify3?.("Profile picture updated", "success");
|
|
156
226
|
} catch (e) {
|
|
157
|
-
|
|
227
|
+
notify3?.("Failed to update picture", "error");
|
|
158
228
|
throw e;
|
|
159
229
|
}
|
|
160
230
|
},
|
|
161
|
-
onProblem: (problem) =>
|
|
231
|
+
onProblem: (problem) => notify3?.(AVATAR_PROBLEMS[problem], "error")
|
|
162
232
|
});
|
|
163
233
|
const email = react$1.useEmailChange({
|
|
164
234
|
requestCode: async (address) => {
|
|
165
235
|
try {
|
|
166
236
|
await requestEmailChange.mutateAsync(address);
|
|
167
|
-
|
|
237
|
+
notify3?.("Verification code sent to your new email", "success");
|
|
168
238
|
} catch (e) {
|
|
169
|
-
|
|
239
|
+
notify3?.(errorText(e, "Failed to send verification code"), "error");
|
|
170
240
|
throw e;
|
|
171
241
|
}
|
|
172
242
|
},
|
|
173
243
|
confirm: async (args) => {
|
|
174
244
|
try {
|
|
175
245
|
await confirmEmailChange.mutateAsync(args);
|
|
176
|
-
|
|
246
|
+
notify3?.("Email address updated", "success");
|
|
177
247
|
} catch (e) {
|
|
178
|
-
|
|
248
|
+
notify3?.(errorText(e, "Invalid or expired verification code"), "error");
|
|
179
249
|
throw e;
|
|
180
250
|
}
|
|
181
251
|
}
|
|
@@ -226,7 +296,7 @@ function defaultUnmetPasswordRequirement(password) {
|
|
|
226
296
|
return null;
|
|
227
297
|
}
|
|
228
298
|
function ConnectedSecuritySection({
|
|
229
|
-
notify:
|
|
299
|
+
notify: notify3,
|
|
230
300
|
getUnmetRequirement = defaultUnmetPasswordRequirement,
|
|
231
301
|
renderRecoveryKey,
|
|
232
302
|
children
|
|
@@ -239,7 +309,7 @@ function ConnectedSecuritySection({
|
|
|
239
309
|
getUnmetRequirement,
|
|
240
310
|
submit: async (vars) => {
|
|
241
311
|
const result = await change.mutateAsync(vars);
|
|
242
|
-
|
|
312
|
+
notify3?.("Password changed successfully", "success");
|
|
243
313
|
return result;
|
|
244
314
|
},
|
|
245
315
|
onClose: () => setOpen(false)
|
|
@@ -304,7 +374,7 @@ function ConnectedNotificationPreferences({
|
|
|
304
374
|
) }) });
|
|
305
375
|
}
|
|
306
376
|
function ConnectedSessionsRow({
|
|
307
|
-
notify:
|
|
377
|
+
notify: notify3,
|
|
308
378
|
confirm,
|
|
309
379
|
renderSessionIcon
|
|
310
380
|
}) {
|
|
@@ -358,7 +428,7 @@ function ConnectedSessionsRow({
|
|
|
358
428
|
try {
|
|
359
429
|
await terminate.mutateAsync(id);
|
|
360
430
|
} catch {
|
|
361
|
-
|
|
431
|
+
notify3?.("Failed to end session. Please try again.", "error");
|
|
362
432
|
}
|
|
363
433
|
})();
|
|
364
434
|
}
|
|
@@ -372,7 +442,7 @@ function ConnectedLogoutDialog({
|
|
|
372
442
|
isOnline = true,
|
|
373
443
|
renderSessionIcon
|
|
374
444
|
}) {
|
|
375
|
-
const { logout } =
|
|
445
|
+
const { logout } = chunkTLQQV7WW_cjs.useConnection();
|
|
376
446
|
const sessions = react$1.useSessions({ enabled: open });
|
|
377
447
|
const logoutAll = react$1.useLogoutAllSessions();
|
|
378
448
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -395,17 +465,17 @@ function ConnectedLogoutDialog({
|
|
|
395
465
|
}
|
|
396
466
|
);
|
|
397
467
|
}
|
|
398
|
-
function ConnectedDangerZone({ notify:
|
|
468
|
+
function ConnectedDangerZone({ notify: notify3, renderSubscriptionLink }) {
|
|
399
469
|
const [zoneOpen, setZoneOpen] = react.useState(false);
|
|
400
470
|
const [dialogOpen, setDialogOpen] = react.useState(false);
|
|
401
|
-
const { user, logout } =
|
|
471
|
+
const { user, logout } = chunkTLQQV7WW_cjs.useConnection();
|
|
402
472
|
const remove = react$1.useDeleteAccount();
|
|
403
473
|
const flow = react$1.useDeleteAccountFlow({
|
|
404
474
|
userEmail: user?.email ?? "",
|
|
405
475
|
remove: () => remove.mutateAsync(),
|
|
406
476
|
onClose: () => setDialogOpen(false),
|
|
407
477
|
onDeleted: logout,
|
|
408
|
-
onError: () =>
|
|
478
|
+
onError: () => notify3?.("Failed to delete account. Please try again.", "error")
|
|
409
479
|
});
|
|
410
480
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
411
481
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -448,7 +518,7 @@ function ConnectedDangerZone({ notify: notify2, renderSubscriptionLink }) {
|
|
|
448
518
|
}
|
|
449
519
|
function useConnectedDocxNotifications(onOpen) {
|
|
450
520
|
const arbi = react$1.useArbi();
|
|
451
|
-
const { status, user, apiUrl } =
|
|
521
|
+
const { status, user, apiUrl } = chunkTLQQV7WW_cjs.useConnection();
|
|
452
522
|
const queries = reactQuery.useQueryClient();
|
|
453
523
|
const source = `docx-mentions:${apiUrl}:${user?.externalId || ""}`;
|
|
454
524
|
const queryKey = ["docx-mentions", apiUrl, user?.externalId];
|
|
@@ -511,65 +581,237 @@ function useConnectedDocxNotifications(onOpen) {
|
|
|
511
581
|
}
|
|
512
582
|
};
|
|
513
583
|
}
|
|
584
|
+
function useConnectedWorkNotifications(onOpen) {
|
|
585
|
+
const { status, user, apiUrl } = chunkTLQQV7WW_cjs.useConnection();
|
|
586
|
+
const source = `work-notifications:${apiUrl}:${user?.externalId || ""}`;
|
|
587
|
+
const { data = [], markRead: persistRead } = react$1.useWorkNotifications({
|
|
588
|
+
apiUrl,
|
|
589
|
+
userId: user?.externalId,
|
|
590
|
+
enabled: status === "authenticated"
|
|
591
|
+
});
|
|
592
|
+
react.useEffect(() => {
|
|
593
|
+
const items = [];
|
|
594
|
+
if (status === "authenticated")
|
|
595
|
+
for (const note of data) {
|
|
596
|
+
if (note.recipient.external_id !== user?.externalId) continue;
|
|
597
|
+
const mapped = mapWorkNotification(note);
|
|
598
|
+
if (!mapped) continue;
|
|
599
|
+
items.push({
|
|
600
|
+
id: `work:${note.external_id}`,
|
|
601
|
+
title: mapped.title,
|
|
602
|
+
variant: note.type === "workflow_failed" ? "error" : note.type === "conversation_done" ? "success" : "info",
|
|
603
|
+
ts: Date.parse(note.created_at),
|
|
604
|
+
read: note.read,
|
|
605
|
+
source,
|
|
606
|
+
onSelect: () => {
|
|
607
|
+
void Promise.resolve().then(() => onOpen(mapped.target)).catch(
|
|
608
|
+
(error) => react$1.notify.error(
|
|
609
|
+
error instanceof Error ? error.message : "Could not open this notification."
|
|
610
|
+
)
|
|
611
|
+
);
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
shell.useNotify.getState().syncSource(source, items);
|
|
616
|
+
return () => shell.useNotify.getState().syncSource(source, []);
|
|
617
|
+
}, [data, status, user?.externalId, source, onOpen]);
|
|
618
|
+
const markRead = async (ids) => {
|
|
619
|
+
if (!ids.length) return;
|
|
620
|
+
try {
|
|
621
|
+
await persistRead(ids);
|
|
622
|
+
} catch {
|
|
623
|
+
react$1.notify.error("Could not mark work notifications read.");
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
return {
|
|
627
|
+
onMarkRead: (id) => {
|
|
628
|
+
if (data.some(
|
|
629
|
+
(note) => `work:${note.external_id}` === id && note.recipient.external_id === user?.externalId && mapWorkNotification(note)
|
|
630
|
+
))
|
|
631
|
+
void markRead([id.slice(5)]);
|
|
632
|
+
},
|
|
633
|
+
onMarkAllRead: () => {
|
|
634
|
+
void markRead(
|
|
635
|
+
data.filter(
|
|
636
|
+
(note) => !note.read && note.recipient.external_id === user?.externalId && mapWorkNotification(note)
|
|
637
|
+
).map((note) => note.external_id)
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
function mapWorkNotification(note) {
|
|
643
|
+
const sender = [note.sender.given_name, note.sender.family_name].filter(Boolean).join(" ") || note.sender.email;
|
|
644
|
+
if (note.type === "workflow_failed") {
|
|
645
|
+
try {
|
|
646
|
+
const payload = JSON.parse(note.content || "{}");
|
|
647
|
+
if (!payload.workflow_ext_id?.match(/^wfl-[a-zA-Z0-9]+$/)) return null;
|
|
648
|
+
if (note.workspace_ext_id?.match(/^wrk-[a-zA-Z0-9]+$/) && note.conversation_ext_id?.match(/^con-[a-zA-Z0-9]+$/)) {
|
|
649
|
+
return {
|
|
650
|
+
title: "A workflow failed to run",
|
|
651
|
+
target: {
|
|
652
|
+
kind: "conversation",
|
|
653
|
+
workspaceId: note.workspace_ext_id,
|
|
654
|
+
conversationId: note.conversation_ext_id
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
return {
|
|
659
|
+
title: "A workflow failed to run",
|
|
660
|
+
target: {
|
|
661
|
+
kind: "workflow",
|
|
662
|
+
workflowId: payload.workflow_ext_id,
|
|
663
|
+
workspaceId: note.workspace_ext_id || void 0
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
} catch {
|
|
667
|
+
return null;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
const titles = {
|
|
671
|
+
mention: `${sender} mentioned you in a conversation`,
|
|
672
|
+
workspace_access_request: `${sender} needs workspace access to run a task`,
|
|
673
|
+
conversation_ready_for_review: `${sender} has a task ready for your review`,
|
|
674
|
+
conversation_approval_request: `${sender} asked you to approve a task`,
|
|
675
|
+
conversation_done: `${sender} marked a task done`
|
|
676
|
+
};
|
|
677
|
+
const title = titles[note.type];
|
|
678
|
+
if (!title || !note.workspace_ext_id || !note.conversation_ext_id?.match(/^con-[a-zA-Z0-9]+$/))
|
|
679
|
+
return null;
|
|
680
|
+
return {
|
|
681
|
+
title,
|
|
682
|
+
target: {
|
|
683
|
+
kind: "conversation",
|
|
684
|
+
workspaceId: note.workspace_ext_id,
|
|
685
|
+
conversationId: note.conversation_ext_id,
|
|
686
|
+
...note.message_ext_id ? { messageId: note.message_ext_id } : {}
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
function ActiveChat({ agentId, workspaceId }) {
|
|
691
|
+
const chat = react$1.useArbiChat({ agentId, workspaceId });
|
|
692
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
693
|
+
chunkZHLMDJCO_cjs.ChatPage,
|
|
694
|
+
{
|
|
695
|
+
chat: { ...chat, assistantMode: void 0, setAssistantMode: void 0 },
|
|
696
|
+
documentsRequired: false,
|
|
697
|
+
compactHeader: true,
|
|
698
|
+
surface: "dock",
|
|
699
|
+
emptyTitle: "What would you like me to do?",
|
|
700
|
+
emptyDescription: "This agent works through its own login. Upload files here to stage them in its sandbox.",
|
|
701
|
+
className: "h-[min(65vh,650px)] min-h-[380px]"
|
|
702
|
+
}
|
|
703
|
+
);
|
|
704
|
+
}
|
|
705
|
+
function ConnectedAgentChatPanel({
|
|
706
|
+
agentId,
|
|
707
|
+
workspaceId,
|
|
708
|
+
agentName = "Agent"
|
|
709
|
+
}) {
|
|
710
|
+
const session = react$1.useAgentSession(agentId);
|
|
711
|
+
const start = react$1.useStartAgentSession();
|
|
712
|
+
const close = react$1.useCloseAgentSession();
|
|
713
|
+
const ready = session.data?.active && session.data.workspace_ext_id === workspaceId;
|
|
714
|
+
const busy = start.isPending || close.isPending;
|
|
715
|
+
const error = start.error ?? close.error ?? session.error;
|
|
716
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "space-y-3", "data-testid": "agent-chat-panel", children: [
|
|
717
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
718
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm", "data-testid": "agent-chat-session-status", children: [
|
|
719
|
+
agentName,
|
|
720
|
+
" \xB7",
|
|
721
|
+
" ",
|
|
722
|
+
ready ? "Signed in to this workspace" : session.data?.active ? `Signed in to ${session.data.workspace_name ?? "another workspace"}` : "Signed out"
|
|
723
|
+
] }),
|
|
724
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
725
|
+
!ready && /* @__PURE__ */ jsxRuntime.jsx(
|
|
726
|
+
ui.Button,
|
|
727
|
+
{
|
|
728
|
+
type: "button",
|
|
729
|
+
disabled: busy || session.isLoading,
|
|
730
|
+
onClick: () => start.mutate({ agentId, workspaceId }),
|
|
731
|
+
"data-testid": "agent-chat-login",
|
|
732
|
+
children: start.isPending ? "Signing in\u2026" : "Sign in here"
|
|
733
|
+
}
|
|
734
|
+
),
|
|
735
|
+
session.data?.active && /* @__PURE__ */ jsxRuntime.jsx(
|
|
736
|
+
ui.Button,
|
|
737
|
+
{
|
|
738
|
+
type: "button",
|
|
739
|
+
variant: "outline",
|
|
740
|
+
disabled: busy,
|
|
741
|
+
onClick: () => close.mutate(agentId),
|
|
742
|
+
"data-testid": "agent-chat-logout",
|
|
743
|
+
children: close.isPending ? "Signing out\u2026" : "Sign out agent"
|
|
744
|
+
}
|
|
745
|
+
)
|
|
746
|
+
] })
|
|
747
|
+
] }),
|
|
748
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", className: "text-sm text-destructive", children: error.message }),
|
|
749
|
+
ready && /* @__PURE__ */ jsxRuntime.jsx(ActiveChat, { agentId, workspaceId }, `${agentId}:${workspaceId}`)
|
|
750
|
+
] });
|
|
751
|
+
}
|
|
514
752
|
|
|
515
753
|
Object.defineProperty(exports, "ConnectedAssistantDock", {
|
|
516
754
|
enumerable: true,
|
|
517
|
-
get: function () { return
|
|
755
|
+
get: function () { return chunkEYPPB5CY_cjs.ConnectedAssistantDock; }
|
|
518
756
|
});
|
|
519
757
|
Object.defineProperty(exports, "redlineStats", {
|
|
520
758
|
enumerable: true,
|
|
521
|
-
get: function () { return
|
|
759
|
+
get: function () { return chunkEYPPB5CY_cjs.redlineStats; }
|
|
522
760
|
});
|
|
523
761
|
Object.defineProperty(exports, "textToArtifact", {
|
|
524
762
|
enumerable: true,
|
|
525
|
-
get: function () { return
|
|
763
|
+
get: function () { return chunkEYPPB5CY_cjs.textToArtifact; }
|
|
526
764
|
});
|
|
527
765
|
Object.defineProperty(exports, "toRedlineMarkdown", {
|
|
528
766
|
enumerable: true,
|
|
529
|
-
get: function () { return
|
|
767
|
+
get: function () { return chunkEYPPB5CY_cjs.toRedlineMarkdown; }
|
|
530
768
|
});
|
|
531
769
|
Object.defineProperty(exports, "useConnectedAiTask", {
|
|
532
770
|
enumerable: true,
|
|
533
|
-
get: function () { return
|
|
771
|
+
get: function () { return chunkEYPPB5CY_cjs.useConnectedAiTask; }
|
|
534
772
|
});
|
|
535
773
|
Object.defineProperty(exports, "useConnectedChat", {
|
|
536
774
|
enumerable: true,
|
|
537
|
-
get: function () { return
|
|
775
|
+
get: function () { return chunkEYPPB5CY_cjs.useConnectedChat; }
|
|
538
776
|
});
|
|
539
777
|
Object.defineProperty(exports, "useSemanticSearch", {
|
|
540
778
|
enumerable: true,
|
|
541
|
-
get: function () { return
|
|
779
|
+
get: function () { return chunkEYPPB5CY_cjs.useSemanticSearch; }
|
|
542
780
|
});
|
|
543
781
|
Object.defineProperty(exports, "useWorkspaceDocs", {
|
|
544
782
|
enumerable: true,
|
|
545
|
-
get: function () { return
|
|
783
|
+
get: function () { return chunkEYPPB5CY_cjs.useWorkspaceDocs; }
|
|
546
784
|
});
|
|
547
785
|
Object.defineProperty(exports, "ConnectionProvider", {
|
|
548
786
|
enumerable: true,
|
|
549
|
-
get: function () { return
|
|
787
|
+
get: function () { return chunkTLQQV7WW_cjs.ConnectionProvider; }
|
|
550
788
|
});
|
|
551
789
|
Object.defineProperty(exports, "SESSION_EXPIRED_MESSAGE", {
|
|
552
790
|
enumerable: true,
|
|
553
|
-
get: function () { return
|
|
791
|
+
get: function () { return chunkTLQQV7WW_cjs.SESSION_EXPIRED_MESSAGE; }
|
|
554
792
|
});
|
|
555
793
|
Object.defineProperty(exports, "isAuthenticated", {
|
|
556
794
|
enumerable: true,
|
|
557
|
-
get: function () { return
|
|
795
|
+
get: function () { return chunkTLQQV7WW_cjs.isAuthenticated; }
|
|
558
796
|
});
|
|
559
797
|
Object.defineProperty(exports, "useConnection", {
|
|
560
798
|
enumerable: true,
|
|
561
|
-
get: function () { return
|
|
799
|
+
get: function () { return chunkTLQQV7WW_cjs.useConnection; }
|
|
562
800
|
});
|
|
563
801
|
exports.ArbiAppProvider = ArbiAppProvider;
|
|
802
|
+
exports.ConnectedAgentChatPanel = ConnectedAgentChatPanel;
|
|
564
803
|
exports.ConnectedDangerZone = ConnectedDangerZone;
|
|
565
804
|
exports.ConnectedLogoutDialog = ConnectedLogoutDialog;
|
|
566
805
|
exports.ConnectedNotificationPreferences = ConnectedNotificationPreferences;
|
|
567
806
|
exports.ConnectedProfileCard = ConnectedProfileCard;
|
|
568
807
|
exports.ConnectedSecuritySection = ConnectedSecuritySection;
|
|
569
808
|
exports.ConnectedSessionsRow = ConnectedSessionsRow;
|
|
809
|
+
exports.ConnectedSkillUpload = ConnectedSkillUpload;
|
|
810
|
+
exports.ConnectedTaskAccessRequest = ConnectedTaskAccessRequest;
|
|
570
811
|
exports.StreamedArtifact = StreamedArtifact;
|
|
571
812
|
exports.defaultUnmetPasswordRequirement = defaultUnmetPasswordRequirement;
|
|
572
813
|
exports.useConnectedDocxNotifications = useConnectedDocxNotifications;
|
|
573
814
|
exports.useConnectedShellWorkspaces = useConnectedShellWorkspaces;
|
|
815
|
+
exports.useConnectedWorkNotifications = useConnectedWorkNotifications;
|
|
574
816
|
//# sourceMappingURL=index.cjs.map
|
|
575
817
|
//# sourceMappingURL=index.cjs.map
|