@arbidocs/blocks 0.4.80 → 0.4.81
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 +280 -280
- package/dist/agents/index.js +5 -5
- 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-B3WCKBJ7.cjs} +3 -3
- package/dist/{chunk-MFDGNUKX.cjs.map → chunk-B3WCKBJ7.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-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-LGDX34UR.cjs → chunk-F5WIETZY.cjs} +66 -51
- package/dist/chunk-F5WIETZY.cjs.map +1 -0
- package/dist/{chunk-E367ZUHE.js → chunk-GJV2G4FC.js} +3 -3
- package/dist/{chunk-E367ZUHE.js.map → chunk-GJV2G4FC.js.map} +1 -1
- package/dist/{chunk-A5WCK6ZG.js → chunk-I56ORHPY.js} +28 -13
- package/dist/chunk-I56ORHPY.js.map +1 -0
- 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-O5NDG4EA.cjs → chunk-MP6FK43E.cjs} +3 -3
- package/dist/{chunk-O5NDG4EA.cjs.map → chunk-MP6FK43E.cjs.map} +1 -1
- package/dist/{chunk-QFA3NCWL.js → chunk-THCFZKTM.js} +95 -6
- package/dist/chunk-THCFZKTM.js.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 +154 -75
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +106 -27
- package/dist/connect/index.js.map +1 -1
- 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 +2 -2
- package/dist/files/index.js +2 -2
- package/dist/home/index.cjs +18 -18
- package/dist/home/index.js +4 -4
- package/dist/index.cjs +503 -503
- package/dist/index.js +9 -9
- package/dist/retrieval/index.cjs +1 -1
- package/dist/retrieval/index.js +1 -1
- package/dist/settings/index.cjs +35 -35
- package/dist/settings/index.js +2 -2
- 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/workflow-canvas/index.cjs +48 -48
- package/dist/workflow-canvas/index.js +5 -5
- package/dist/workspaces/index.cjs +2 -2
- package/dist/workspaces/index.js +2 -2
- 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/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-GJV2G4FC.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
10
|
import { TagMatrix, tagMatrixMarkdown } from '../chunk-SWSVPQNB.js';
|
|
11
|
-
import {
|
|
11
|
+
import { StreamedArtifactFrame } from '../chunk-LOJVUGBJ.js';
|
|
12
|
+
import { splitDocRef, WorkflowStepBar, stepLevels, WorkflowRunner, initialRunInputs, workflowSteps, fromPlanSteps, stepStatesFromActivity, toPlanSteps, runThreadTitle, useWorkflowView, stepFields } from '../chunk-THCFZKTM.js';
|
|
12
13
|
import '../chunk-EVUEIBNU.js';
|
|
13
14
|
import '../chunk-XD2M6LIG.js';
|
|
14
|
-
import { StreamedArtifactFrame } from '../chunk-LOJVUGBJ.js';
|
|
15
15
|
import '../chunk-VILAPTCB.js';
|
|
16
|
-
import { ChatPage } from '../chunk-
|
|
16
|
+
import { ChatPage } from '../chunk-EWSEQEPL.js';
|
|
17
17
|
import '../chunk-KZJAG7T3.js';
|
|
18
18
|
import '../chunk-HOXKR26S.js';
|
|
19
19
|
import '../chunk-AA3PT6KR.js';
|
|
20
20
|
import '../chunk-NPLYHR2E.js';
|
|
21
|
+
import { initials } from '../chunk-OXF2IFXG.js';
|
|
21
22
|
import { ModalScaffold } from '../chunk-TX2ZICS7.js';
|
|
22
23
|
import '../chunk-7F6CBP3Z.js';
|
|
23
|
-
import { initials } from '../chunk-OXF2IFXG.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();
|