@arbidocs/blocks 0.4.80 → 0.4.82
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/dist/agents/index.cjs +281 -281
- package/dist/agents/index.js +6 -6
- package/dist/agents/workflows/WorkflowRunner.d.ts +35 -3
- package/dist/agents/workflows/run.d.ts +10 -0
- package/dist/agents/workflows/types.d.ts +4 -2
- package/dist/chat/index.cjs +125 -125
- package/dist/chat/index.js +3 -3
- package/dist/{chunk-MFDGNUKX.cjs → chunk-5XVWGJ2H.cjs} +3 -3
- package/dist/{chunk-MFDGNUKX.cjs.map → chunk-5XVWGJ2H.cjs.map} +1 -1
- package/dist/{chunk-2FEQGDW2.cjs → chunk-BX7JWZWE.cjs} +97 -5
- package/dist/chunk-BX7JWZWE.cjs.map +1 -0
- package/dist/{chunk-SWSVPQNB.js → chunk-COP6GVKN.js} +148 -5
- package/dist/chunk-COP6GVKN.js.map +1 -0
- package/dist/{chunk-P5ST47VY.js → chunk-DDF5GPIJ.js} +3 -3
- package/dist/{chunk-P5ST47VY.js.map → chunk-DDF5GPIJ.js.map} +1 -1
- package/dist/{chunk-PFA43QNX.js → chunk-EWSEQEPL.js} +3 -3
- package/dist/{chunk-PFA43QNX.js.map → chunk-EWSEQEPL.js.map} +1 -1
- package/dist/{chunk-LBE36YNZ.js → chunk-ICBAFX5B.js} +3 -3
- package/dist/{chunk-LBE36YNZ.js.map → chunk-ICBAFX5B.js.map} +1 -1
- package/dist/{chunk-C3DRLFU7.cjs → chunk-IF6VAYIA.cjs} +5 -5
- package/dist/{chunk-C3DRLFU7.cjs.map → chunk-IF6VAYIA.cjs.map} +1 -1
- package/dist/{chunk-A5WCK6ZG.js → chunk-IRG5LPDP.js} +29 -14
- package/dist/chunk-IRG5LPDP.js.map +1 -0
- package/dist/{chunk-UA2AMDR6.cjs → chunk-LRRJ2HBW.cjs} +151 -3
- package/dist/chunk-LRRJ2HBW.cjs.map +1 -0
- package/dist/{chunk-O5NDG4EA.cjs → chunk-MP6FK43E.cjs} +3 -3
- package/dist/{chunk-O5NDG4EA.cjs.map → chunk-MP6FK43E.cjs.map} +1 -1
- package/dist/{chunk-E367ZUHE.js → chunk-O35LRB3P.js} +3 -3
- package/dist/{chunk-E367ZUHE.js.map → chunk-O35LRB3P.js.map} +1 -1
- package/dist/{chunk-QFA3NCWL.js → chunk-THCFZKTM.js} +95 -6
- package/dist/chunk-THCFZKTM.js.map +1 -0
- package/dist/{chunk-LGDX34UR.cjs → chunk-VWK24TEY.cjs} +67 -52
- package/dist/chunk-VWK24TEY.cjs.map +1 -0
- package/dist/{chunk-HUJLKDWX.cjs → chunk-XMBYDLZQ.cjs} +4 -4
- package/dist/{chunk-HUJLKDWX.cjs.map → chunk-XMBYDLZQ.cjs.map} +1 -1
- package/dist/{chunk-WDD255XQ.js → chunk-XQDM6T6C.js} +3 -3
- package/dist/{chunk-WDD255XQ.js.map → chunk-XQDM6T6C.js.map} +1 -1
- package/dist/{chunk-ZV3BKLFY.cjs → chunk-Z5VUZ6YD.cjs} +3 -3
- package/dist/{chunk-ZV3BKLFY.cjs.map → chunk-Z5VUZ6YD.cjs.map} +1 -1
- package/dist/connect/index.cjs +187 -87
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +138 -38
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/ConnectedTagMatrix.d.ts +6 -3
- package/dist/connection/ConnectedWorkflowRunner.d.ts +16 -5
- package/dist/facts/index.cjs +2 -2
- package/dist/facts/index.js +2 -2
- package/dist/files/index.cjs +4 -4
- package/dist/files/index.js +4 -4
- package/dist/home/index.cjs +18 -18
- package/dist/home/index.js +4 -4
- package/dist/index.cjs +660 -644
- package/dist/index.js +14 -14
- package/dist/retrieval/index.cjs +1 -1
- package/dist/retrieval/index.js +1 -1
- package/dist/settings/index.cjs +36 -36
- package/dist/settings/index.js +3 -3
- package/dist/shell/index.cjs +1 -1
- package/dist/shell/index.js +1 -1
- package/dist/studio/index.cjs +5 -5
- package/dist/studio/index.js +4 -4
- package/dist/tags/TagMatrix.d.ts +7 -3
- package/dist/tags/index.d.ts +1 -0
- package/dist/tags/tagMatrixDocx.d.ts +42 -0
- package/dist/workflow-canvas/index.cjs +49 -49
- package/dist/workflow-canvas/index.js +6 -6
- package/dist/workspaces/index.cjs +1 -1
- package/dist/workspaces/index.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-2FEQGDW2.cjs.map +0 -1
- package/dist/chunk-A5WCK6ZG.js.map +0 -1
- package/dist/chunk-LGDX34UR.cjs.map +0 -1
- package/dist/chunk-QFA3NCWL.js.map +0 -1
- package/dist/chunk-SWSVPQNB.js.map +0 -1
- package/dist/chunk-UA2AMDR6.cjs.map +0 -1
package/dist/connect/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { SettingsSection, ProfileCard, AvatarPicker, IdentityVerificationCard, IdentityVerificationDialog, RequireVerified, SettingsCard, SettingsActionRow, PasswordChangeDialog, EMAIL_NOTIFICATION_KEYS, EMAIL_NOTIFICATION_CATEGORIES, NotificationCategoryList, toNotificationCategories, toActiveSessionViews, SettingsRow, ActiveSessionsDialog, LogoutDialog, toLogoutSessionViews, SettingsDangerZone, DeleteAccountDialog, toDeleteBlockerViews } from '../chunk-
|
|
3
|
-
import { useWorkspaceDocs } from '../chunk-
|
|
4
|
-
export { ConnectedAssistantDock, redlineStats, textToArtifact, toRedlineMarkdown, useConnectedAiTask, useConnectedChat, useSemanticSearch, useWorkspaceDocs } from '../chunk-
|
|
2
|
+
import { SettingsSection, ProfileCard, AvatarPicker, IdentityVerificationCard, IdentityVerificationDialog, RequireVerified, SettingsCard, SettingsActionRow, PasswordChangeDialog, EMAIL_NOTIFICATION_KEYS, EMAIL_NOTIFICATION_CATEGORIES, NotificationCategoryList, toNotificationCategories, toActiveSessionViews, SettingsRow, ActiveSessionsDialog, LogoutDialog, toLogoutSessionViews, SettingsDangerZone, DeleteAccountDialog, toDeleteBlockerViews } from '../chunk-O35LRB3P.js';
|
|
3
|
+
import { useWorkspaceDocs } from '../chunk-XQDM6T6C.js';
|
|
4
|
+
export { ConnectedAssistantDock, redlineStats, textToArtifact, toRedlineMarkdown, useConnectedAiTask, useConnectedChat, useSemanticSearch, useWorkspaceDocs } from '../chunk-XQDM6T6C.js';
|
|
5
5
|
import { ConnectedNativeDocxEditor } from '../chunk-A24C6BNA.js';
|
|
6
6
|
import { ConnectionProvider, useConnection } from '../chunk-OYMWV45N.js';
|
|
7
7
|
export { ConnectionProvider, SESSION_EXPIRED_MESSAGE, isAuthenticated, useConnection } from '../chunk-OYMWV45N.js';
|
|
8
8
|
import { SignDocumentDialog } from '../chunk-FE4ULGOR.js';
|
|
9
9
|
import '../chunk-OPA2Y6YZ.js';
|
|
10
|
-
import { TagMatrix,
|
|
11
|
-
import { splitDocRef, WorkflowStepBar, stepLevels, WorkflowRunner, initialRunInputs, workflowSteps, fromPlanSteps, stepStatesFromActivity, toPlanSteps, runThreadTitle, useWorkflowView, stepFields } from '../chunk-
|
|
10
|
+
import { TagMatrix, tagMatrixDocx, DOCX_MIME_TYPE } from '../chunk-COP6GVKN.js';
|
|
11
|
+
import { splitDocRef, WorkflowStepBar, stepLevels, WorkflowRunner, initialRunInputs, workflowSteps, fromPlanSteps, stepStatesFromActivity, toPlanSteps, runThreadTitle, useWorkflowView, stepFields } from '../chunk-THCFZKTM.js';
|
|
12
12
|
import '../chunk-EVUEIBNU.js';
|
|
13
13
|
import '../chunk-XD2M6LIG.js';
|
|
14
14
|
import { StreamedArtifactFrame } from '../chunk-LOJVUGBJ.js';
|
|
15
15
|
import '../chunk-VILAPTCB.js';
|
|
16
|
-
import {
|
|
16
|
+
import { ModalScaffold } from '../chunk-TX2ZICS7.js';
|
|
17
|
+
import { ChatPage } from '../chunk-EWSEQEPL.js';
|
|
17
18
|
import '../chunk-KZJAG7T3.js';
|
|
18
19
|
import '../chunk-HOXKR26S.js';
|
|
19
20
|
import '../chunk-AA3PT6KR.js';
|
|
20
21
|
import '../chunk-NPLYHR2E.js';
|
|
21
|
-
import { ModalScaffold } from '../chunk-TX2ZICS7.js';
|
|
22
|
-
import '../chunk-7F6CBP3Z.js';
|
|
23
22
|
import { initials } from '../chunk-OXF2IFXG.js';
|
|
23
|
+
import '../chunk-7F6CBP3Z.js';
|
|
24
24
|
import '../chunk-VUNV25KB.js';
|
|
25
25
|
import { lazy, useState, Suspense, useEffect, useRef, useCallback, useMemo } from 'react';
|
|
26
26
|
import { QueryClient, QueryClientProvider, useQueryClient, useQuery } from '@tanstack/react-query';
|
|
@@ -593,6 +593,7 @@ function ConnectedWorkflowRunner({
|
|
|
593
593
|
emptyHint,
|
|
594
594
|
connectedLabels,
|
|
595
595
|
onOpenDocument,
|
|
596
|
+
onOpenCitation,
|
|
596
597
|
onOpenDraft,
|
|
597
598
|
onOpenMessage,
|
|
598
599
|
actions: hostActions,
|
|
@@ -608,8 +609,9 @@ function ConnectedWorkflowRunner({
|
|
|
608
609
|
const { ensureWorkspaceOpen, user } = useConnection();
|
|
609
610
|
const { wsId } = useWorkspaceDocs();
|
|
610
611
|
const { data: docs = [], refetch } = useDocuments(wsId);
|
|
611
|
-
const [
|
|
612
|
+
const [sending, setSending] = useState([]);
|
|
612
613
|
const [added, setAdded] = useState({});
|
|
614
|
+
const [addedNames, setAddedNames] = useState({});
|
|
613
615
|
const addedRef = useRef(added);
|
|
614
616
|
addedRef.current = added;
|
|
615
617
|
const { view, conversationId, people } = useWorkflowThread(workflow, {
|
|
@@ -643,24 +645,86 @@ function ConnectedWorkflowRunner({
|
|
|
643
645
|
}),
|
|
644
646
|
[user?.externalId, onOpenDocument, onOpenDraft, onOpenMessage, hostActions, nameOfDoc, inThread]
|
|
645
647
|
);
|
|
646
|
-
const
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
648
|
+
const openCitation = useMemo(
|
|
649
|
+
() => onOpenCitation ?? (onOpenDocument && ((t) => {
|
|
650
|
+
const docId = t.documentId ?? t.passage?.documentId;
|
|
651
|
+
if (docId) onOpenDocument(docId, void 0, t.page ?? t.passage?.page ?? void 0);
|
|
652
|
+
})),
|
|
653
|
+
[onOpenCitation, onOpenDocument]
|
|
654
|
+
);
|
|
655
|
+
const uploadSeq = useRef(0);
|
|
656
|
+
const sendingRef = useRef(sending);
|
|
657
|
+
sendingRef.current = sending;
|
|
658
|
+
const send = useCallback(
|
|
659
|
+
async (batch) => {
|
|
660
|
+
if (!batch.length) return;
|
|
661
|
+
const keys = new Set(batch.map((p) => p.key));
|
|
662
|
+
const mark = (key, patch) => setSending(
|
|
663
|
+
(all) => patch === null ? all.filter((p) => p.key !== key) : all.map((p) => p.key === key ? { ...p, ...patch } : p)
|
|
664
|
+
);
|
|
665
|
+
setSending((all) => [
|
|
666
|
+
...all.filter((p) => !keys.has(p.key)),
|
|
667
|
+
...batch.map((p) => ({ ...p, status: "uploading", error: void 0 }))
|
|
668
|
+
]);
|
|
650
669
|
try {
|
|
651
670
|
await ensureWorkspaceOpen();
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
671
|
+
} catch (e) {
|
|
672
|
+
for (const p of batch) mark(p.key, { status: "failed", error: uploadError(e) });
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
for (const p of batch) {
|
|
676
|
+
try {
|
|
677
|
+
const { doc_ext_ids = [] } = await arbi.documents.uploadFile(p.file, p.file.name) ?? {};
|
|
678
|
+
if (!doc_ext_ids.length) throw new Error("No document came back");
|
|
679
|
+
setAdded((a) => ({
|
|
680
|
+
...a,
|
|
681
|
+
...Object.fromEntries(doc_ext_ids.map((id) => [id, p.stepId]))
|
|
682
|
+
}));
|
|
683
|
+
setAddedNames((n) => ({
|
|
684
|
+
...n,
|
|
685
|
+
...Object.fromEntries(doc_ext_ids.map((id) => [id, p.file.name]))
|
|
686
|
+
}));
|
|
687
|
+
mark(p.key, null);
|
|
688
|
+
} catch (e) {
|
|
689
|
+
mark(p.key, { status: "failed", error: uploadError(e) });
|
|
655
690
|
}
|
|
656
|
-
await refetch();
|
|
657
|
-
} finally {
|
|
658
|
-
setUploading(false);
|
|
659
691
|
}
|
|
692
|
+
await refetch();
|
|
660
693
|
},
|
|
661
694
|
[arbi, ensureWorkspaceOpen, refetch]
|
|
662
695
|
);
|
|
663
|
-
const
|
|
696
|
+
const onUpload = useCallback(
|
|
697
|
+
(files2, step) => send(
|
|
698
|
+
files2.map((file) => ({
|
|
699
|
+
key: `upload-${++uploadSeq.current}`,
|
|
700
|
+
file,
|
|
701
|
+
stepId: step.id,
|
|
702
|
+
status: "uploading"
|
|
703
|
+
}))
|
|
704
|
+
),
|
|
705
|
+
[send]
|
|
706
|
+
);
|
|
707
|
+
const onRetryUpload = useCallback(
|
|
708
|
+
(file) => {
|
|
709
|
+
const p = sendingRef.current.find((x) => x.key === file.id);
|
|
710
|
+
if (p) void send([p]);
|
|
711
|
+
},
|
|
712
|
+
[send]
|
|
713
|
+
);
|
|
714
|
+
const onRemoveUpload = useCallback(
|
|
715
|
+
(file) => setSending((all) => all.filter((p) => p.key !== file.id)),
|
|
716
|
+
[]
|
|
717
|
+
);
|
|
718
|
+
const files = [
|
|
719
|
+
...sending.map((p) => ({
|
|
720
|
+
id: p.key,
|
|
721
|
+
name: p.file.name,
|
|
722
|
+
status: p.status === "failed" ? "upload-failed" : "uploading",
|
|
723
|
+
error: p.error,
|
|
724
|
+
addedFor: p.stepId
|
|
725
|
+
})),
|
|
726
|
+
...runnerFiles(docs, added, fileFilter, addedNames)
|
|
727
|
+
];
|
|
664
728
|
const reading = files.some((f) => f.addedFor && f.status === "processing");
|
|
665
729
|
useEffect(() => {
|
|
666
730
|
if (!reading) return;
|
|
@@ -729,8 +793,10 @@ function ConnectedWorkflowRunner({
|
|
|
729
793
|
}
|
|
730
794
|
) : null,
|
|
731
795
|
onUpload,
|
|
732
|
-
uploading,
|
|
796
|
+
uploading: sending.some((p) => p.status === "uploading"),
|
|
733
797
|
files,
|
|
798
|
+
onRetryUpload,
|
|
799
|
+
onRemoveUpload,
|
|
734
800
|
actions,
|
|
735
801
|
nameOfDoc,
|
|
736
802
|
testIdPrefix,
|
|
@@ -772,6 +838,7 @@ function ConnectedWorkflowRunner({
|
|
|
772
838
|
workspaceId: wsId,
|
|
773
839
|
stepTitle: (id) => view.steps.find((s) => s.id === id)?.title,
|
|
774
840
|
targetMessageId: target,
|
|
841
|
+
onOpenCitation: openCitation,
|
|
775
842
|
labels: { workflows: l.currentStep },
|
|
776
843
|
aside: runner(true)
|
|
777
844
|
}
|
|
@@ -800,13 +867,25 @@ function ConnectedWorkflowRunner({
|
|
|
800
867
|
] });
|
|
801
868
|
}
|
|
802
869
|
var READ_POLL_MS = 3e3;
|
|
803
|
-
function
|
|
804
|
-
return
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
870
|
+
function uploadError(e) {
|
|
871
|
+
return e instanceof Error && e.message ? e.message : String(e || "Upload failed");
|
|
872
|
+
}
|
|
873
|
+
function runnerFiles(docs, added, fileFilter, names = {}) {
|
|
874
|
+
const listed = new Set(docs.map((d) => d.external_id));
|
|
875
|
+
return [
|
|
876
|
+
...docs.filter((d) => !fileFilter || added[d.external_id] || fileFilter(d)).map((d) => ({
|
|
877
|
+
id: d.external_id,
|
|
878
|
+
name: d.file_name ?? d.external_id,
|
|
879
|
+
status: fileStatus(d.status),
|
|
880
|
+
addedFor: added[d.external_id]
|
|
881
|
+
})),
|
|
882
|
+
...Object.entries(added).filter(([id]) => !listed.has(id)).map(([id, stepId]) => ({
|
|
883
|
+
id,
|
|
884
|
+
name: names[id] ?? id,
|
|
885
|
+
status: "processing",
|
|
886
|
+
addedFor: stepId
|
|
887
|
+
}))
|
|
888
|
+
];
|
|
810
889
|
}
|
|
811
890
|
function fileStatus(status) {
|
|
812
891
|
const s = status?.toLowerCase();
|
|
@@ -884,6 +963,7 @@ function ConnectedTagMatrix({
|
|
|
884
963
|
linksLimit = 3,
|
|
885
964
|
exportTitle,
|
|
886
965
|
onExported,
|
|
966
|
+
downloadable = true,
|
|
887
967
|
readOnly,
|
|
888
968
|
...props
|
|
889
969
|
}) {
|
|
@@ -902,6 +982,16 @@ function ConnectedTagMatrix({
|
|
|
902
982
|
label: [m.user.given_name, m.user.family_name].filter(Boolean).join(" ") || m.user.email
|
|
903
983
|
}));
|
|
904
984
|
const fail = (e) => setError(e instanceof Error ? e.message : String(e));
|
|
985
|
+
const snapshot = (data) => {
|
|
986
|
+
const title = exportTitle ?? data.parent?.name ?? "Matrix";
|
|
987
|
+
const bytes = tagMatrixDocx(data, {
|
|
988
|
+
title,
|
|
989
|
+
nameOf: (id) => people.find((p) => p.value === id)?.label
|
|
990
|
+
});
|
|
991
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
992
|
+
const name = `${title.replace(/[\\/:*?"<>|]+/g, "-")} (${stamp}).docx`;
|
|
993
|
+
return { blob: new Blob([bytes], { type: DOCX_MIME_TYPE }), name };
|
|
994
|
+
};
|
|
905
995
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
906
996
|
/* @__PURE__ */ jsx(
|
|
907
997
|
TagMatrix,
|
|
@@ -929,22 +1019,32 @@ function ConnectedTagMatrix({
|
|
|
929
1019
|
try {
|
|
930
1020
|
const data = matrix.data;
|
|
931
1021
|
if (!data) return;
|
|
932
|
-
const
|
|
933
|
-
const markdown = tagMatrixMarkdown(data, {
|
|
934
|
-
title,
|
|
935
|
-
nameOf: (id2) => people.find((p) => p.value === id2)?.label
|
|
936
|
-
});
|
|
1022
|
+
const { blob, name } = snapshot(data);
|
|
937
1023
|
await ensureWorkspaceOpen();
|
|
938
|
-
const
|
|
939
|
-
const uploaded = await arbi.documents.uploadFile(
|
|
940
|
-
new Blob([markdown], { type: "text/markdown" }),
|
|
941
|
-
`${title} (${stamp}).md`
|
|
942
|
-
);
|
|
1024
|
+
const uploaded = await arbi.documents.uploadFile(blob, name);
|
|
943
1025
|
const id = uploaded?.doc_ext_ids?.[0];
|
|
944
1026
|
if (id) onExported(id);
|
|
945
1027
|
} catch (e) {
|
|
946
1028
|
fail(e);
|
|
947
1029
|
}
|
|
1030
|
+
} : void 0,
|
|
1031
|
+
onDownload: downloadable && matrix.data ? () => {
|
|
1032
|
+
setError(null);
|
|
1033
|
+
try {
|
|
1034
|
+
const data = matrix.data;
|
|
1035
|
+
if (!data) return;
|
|
1036
|
+
const { blob, name } = snapshot(data);
|
|
1037
|
+
const url = URL.createObjectURL(blob);
|
|
1038
|
+
const link = document.createElement("a");
|
|
1039
|
+
link.href = url;
|
|
1040
|
+
link.download = name;
|
|
1041
|
+
document.body.appendChild(link);
|
|
1042
|
+
link.click();
|
|
1043
|
+
link.remove();
|
|
1044
|
+
setTimeout(() => URL.revokeObjectURL(url), 0);
|
|
1045
|
+
} catch (e) {
|
|
1046
|
+
fail(e);
|
|
1047
|
+
}
|
|
948
1048
|
} : void 0
|
|
949
1049
|
}
|
|
950
1050
|
),
|