@arbidocs/blocks 0.4.73 → 0.4.75
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 +2 -1
- package/dist/agents/index.cjs +255 -254
- package/dist/agents/index.js +5 -4
- package/dist/agents/workflows/WorkflowRunner.d.ts +20 -4
- package/dist/agents/workflows/WorkflowStepBar.d.ts +23 -0
- package/dist/agents/workflows/run.d.ts +1 -0
- package/dist/agents/workflows/types.d.ts +2 -0
- package/dist/chat/index.cjs +124 -124
- package/dist/chat/index.js +3 -3
- package/dist/{chunk-3SFFTSOI.cjs → chunk-7CVF3DK2.cjs} +5 -5
- package/dist/{chunk-3SFFTSOI.cjs.map → chunk-7CVF3DK2.cjs.map} +1 -1
- package/dist/{chunk-V3L5DONY.cjs → chunk-B4SRYJLM.cjs} +31 -2
- package/dist/chunk-B4SRYJLM.cjs.map +1 -0
- package/dist/{chunk-IUR565UW.cjs → chunk-F4LUD3YC.cjs} +49 -48
- package/dist/chunk-F4LUD3YC.cjs.map +1 -0
- package/dist/{chunk-WOYUXVVQ.cjs → chunk-HITAN7JF.cjs} +4 -4
- package/dist/{chunk-WOYUXVVQ.cjs.map → chunk-HITAN7JF.cjs.map} +1 -1
- package/dist/{chunk-3VQYJBOI.js → chunk-HOXKR26S.js} +31 -4
- package/dist/chunk-HOXKR26S.js.map +1 -0
- package/dist/{chunk-KJ3QEKOJ.cjs → chunk-IPGKTUF7.cjs} +7 -33
- package/dist/chunk-IPGKTUF7.cjs.map +1 -0
- package/dist/{chunk-IA7RTPT3.cjs → chunk-IXALYQT7.cjs} +2 -200
- package/dist/chunk-IXALYQT7.cjs.map +1 -0
- package/dist/{chunk-QDNXEB3T.js → chunk-LT2UORRG.js} +7 -6
- package/dist/chunk-LT2UORRG.js.map +1 -0
- package/dist/{chunk-ORA2XE7U.js → chunk-MK6NJQGF.js} +3 -3
- package/dist/{chunk-ORA2XE7U.js.map → chunk-MK6NJQGF.js.map} +1 -1
- package/dist/chunk-NUNKSZKU.js +203 -0
- package/dist/chunk-NUNKSZKU.js.map +1 -0
- package/dist/{chunk-6OL5S7MJ.cjs → chunk-NYBIKDWI.cjs} +5 -2
- package/dist/chunk-NYBIKDWI.cjs.map +1 -0
- package/dist/{chunk-GTNUQBXI.cjs → chunk-P2RBE3FD.cjs} +254 -102
- package/dist/chunk-P2RBE3FD.cjs.map +1 -0
- package/dist/{chunk-D46ZAPEE.js → chunk-R3PDNQYT.js} +5 -2
- package/dist/chunk-R3PDNQYT.js.map +1 -0
- package/dist/{chunk-G5DP27DU.js → chunk-UIWLDSTF.js} +3 -29
- package/dist/chunk-UIWLDSTF.js.map +1 -0
- package/dist/chunk-V4ISCZJ7.cjs +207 -0
- package/dist/chunk-V4ISCZJ7.cjs.map +1 -0
- package/dist/{chunk-VRPRAU3J.js → chunk-WJEKRSPH.js} +3 -3
- package/dist/{chunk-VRPRAU3J.js.map → chunk-WJEKRSPH.js.map} +1 -1
- package/dist/{chunk-2P3T23C7.js → chunk-YWYVIQ7T.js} +256 -104
- package/dist/chunk-YWYVIQ7T.js.map +1 -0
- package/dist/{chunk-BUHKUKKB.js → chunk-ZPLG7QYF.js} +4 -199
- package/dist/chunk-ZPLG7QYF.js.map +1 -0
- package/dist/connect/index.cjs +96 -37
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +81 -22
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/ConnectedWorkflowRunner.d.ts +5 -1
- package/dist/connection/useWorkflowThread.d.ts +4 -0
- package/dist/databases/DatabaseColumnDialog.d.ts +43 -0
- package/dist/databases/DatabaseList.d.ts +28 -0
- package/dist/databases/DatabaseTable.d.ts +38 -0
- package/dist/databases/DatabaseToolbar.d.ts +38 -0
- package/dist/databases/NewDatabaseDialog.d.ts +25 -0
- package/dist/databases/SelectCellEditor.d.ts +6 -0
- package/dist/databases/SelectChip.d.ts +4 -0
- package/dist/databases/column-types.d.ts +58 -0
- package/dist/databases/databaseColumns.d.ts +28 -0
- package/dist/databases/index.cjs +1081 -0
- package/dist/databases/index.cjs.map +1 -0
- package/dist/databases/index.d.ts +13 -0
- package/dist/databases/index.js +1055 -0
- package/dist/databases/index.js.map +1 -0
- package/dist/facts/index.cjs +7 -6
- package/dist/facts/index.cjs.map +1 -1
- package/dist/facts/index.js +3 -2
- package/dist/facts/index.js.map +1 -1
- package/dist/files/index.cjs +14 -13
- package/dist/files/index.cjs.map +1 -1
- package/dist/files/index.js +4 -2
- package/dist/files/index.js.map +1 -1
- package/dist/index.cjs +632 -631
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -11
- package/dist/index.js.map +1 -1
- package/dist/settings/index.cjs +1 -1
- package/dist/settings/index.js +1 -1
- package/dist/shell/ActionCluster.d.ts +3 -1
- package/dist/shell/index.cjs +45 -45
- package/dist/shell/index.js +1 -1
- package/dist/studio/index.cjs +4 -4
- package/dist/studio/index.js +3 -3
- package/dist/workflow-canvas/StepInspector.d.ts +11 -0
- package/dist/workflow-canvas/WorkflowCanvas.d.ts +6 -2
- package/dist/workflow-canvas/index.cjs +202 -91
- package/dist/workflow-canvas/index.cjs.map +1 -1
- package/dist/workflow-canvas/index.js +170 -59
- package/dist/workflow-canvas/index.js.map +1 -1
- package/dist/workflow-canvas/viewport.d.ts +47 -0
- package/package.json +9 -4
- package/dist/chunk-2P3T23C7.js.map +0 -1
- package/dist/chunk-3VQYJBOI.js.map +0 -1
- package/dist/chunk-6OL5S7MJ.cjs.map +0 -1
- package/dist/chunk-BUHKUKKB.js.map +0 -1
- package/dist/chunk-D46ZAPEE.js.map +0 -1
- package/dist/chunk-G5DP27DU.js.map +0 -1
- package/dist/chunk-GTNUQBXI.cjs.map +0 -1
- package/dist/chunk-IA7RTPT3.cjs.map +0 -1
- package/dist/chunk-IUR565UW.cjs.map +0 -1
- package/dist/chunk-KJ3QEKOJ.cjs.map +0 -1
- package/dist/chunk-QDNXEB3T.js.map +0 -1
- package/dist/chunk-V3L5DONY.cjs.map +0 -1
package/dist/connect/index.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
"use client";
|
|
2
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-
|
|
4
|
-
export { ConnectedAssistantDock, redlineStats, textToArtifact, toRedlineMarkdown, useConnectedAiTask, useConnectedChat, useSemanticSearch, useWorkspaceDocs } from '../chunk-
|
|
3
|
+
import { useWorkspaceDocs } from '../chunk-MK6NJQGF.js';
|
|
4
|
+
export { ConnectedAssistantDock, redlineStats, textToArtifact, toRedlineMarkdown, useConnectedAiTask, useConnectedChat, useSemanticSearch, useWorkspaceDocs } from '../chunk-MK6NJQGF.js';
|
|
5
5
|
import { ConnectionProvider, useConnection } from '../chunk-OYMWV45N.js';
|
|
6
6
|
export { ConnectionProvider, SESSION_EXPIRED_MESSAGE, isAuthenticated, useConnection } from '../chunk-OYMWV45N.js';
|
|
7
|
-
import { WorkflowRunner, initialRunInputs, workflowSteps, fromPlanSteps, stepStatesFromActivity, toPlanSteps, runThreadTitle, useWorkflowView } from '../chunk-2P3T23C7.js';
|
|
8
|
-
import '../chunk-EVUEIBNU.js';
|
|
9
|
-
import '../chunk-XD2M6LIG.js';
|
|
10
7
|
import { StreamedArtifactFrame } from '../chunk-LOJVUGBJ.js';
|
|
11
8
|
import '../chunk-VILAPTCB.js';
|
|
12
|
-
import {
|
|
9
|
+
import { WorkflowRunner, initialRunInputs, workflowSteps, fromPlanSteps, stepStatesFromActivity, toPlanSteps, runThreadTitle, useWorkflowView } from '../chunk-YWYVIQ7T.js';
|
|
10
|
+
import '../chunk-EVUEIBNU.js';
|
|
11
|
+
import '../chunk-XD2M6LIG.js';
|
|
12
|
+
import { ChatPage } from '../chunk-UIWLDSTF.js';
|
|
13
13
|
import '../chunk-KZJAG7T3.js';
|
|
14
|
-
import '../chunk-
|
|
14
|
+
import '../chunk-HOXKR26S.js';
|
|
15
15
|
import '../chunk-AA3PT6KR.js';
|
|
16
16
|
import '../chunk-NPLYHR2E.js';
|
|
17
17
|
import { initials } from '../chunk-OXF2IFXG.js';
|
|
18
18
|
import '../chunk-TX2ZICS7.js';
|
|
19
19
|
import '../chunk-7F6CBP3Z.js';
|
|
20
20
|
import '../chunk-VUNV25KB.js';
|
|
21
|
-
import { lazy, useState, Suspense, useCallback, useMemo,
|
|
21
|
+
import { lazy, useState, Suspense, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
22
22
|
import { QueryClient, QueryClientProvider, useQueryClient, useQuery } from '@tanstack/react-query';
|
|
23
23
|
import { ArbiProvider, useConversations, useRunConversation, useUploadSkillFiles, ArtifactCanvas, useArbi, useDocuments, useWorkspaceUsers, useWorkspaces, useShellWorkspaces, useProfile, useUpdateProfile, useRequestEmailChange, useConfirmEmailChange, useNameEditor, useAvatarCrop, useEmailChange, ImageCropModal, useIdentityVerification, usePasswordChange, usePasswordChangeForm, useNotificationPreferences, useSessions, useCurrentSessionId, useTerminateSession, useLogoutAllSessions, useDeleteAccount, useDeleteAccountFlow, useArbiWebSocket, notify, useWorkNotifications, useAgentSession, useStartAgentSession, useCloseAgentSession, AiAnswer, ArbiWebSocketProvider, useCreateWork, useActOnStep, useConversationActivity, useConversationThreads, useArbiChat } from '@arbidocs/react';
|
|
24
24
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
25
25
|
import { Button, Label, Input, cn } from '@arbidocs/react/ui';
|
|
26
26
|
import { useStreamedArtifact } from '@arbidocs/react/artifacts';
|
|
27
|
-
import { ExternalLink, UserCircle, KeyRound, Radio } from 'lucide-react';
|
|
27
|
+
import { ExternalLink, UserCircle, KeyRound, Radio, Loader2 } from 'lucide-react';
|
|
28
28
|
import { useNotify } from '@arbidocs/react/shell';
|
|
29
29
|
|
|
30
30
|
function ConnectionBoundWebSocket({ children }) {
|
|
@@ -188,6 +188,28 @@ function formValues(step, inputs) {
|
|
|
188
188
|
if (step.kind !== "form") return void 0;
|
|
189
189
|
return Object.fromEntries(step.inputs.map((f) => [f.name, inputs[f.name] ?? ""]));
|
|
190
190
|
}
|
|
191
|
+
var ANSWER_RETRY_CAP = 16;
|
|
192
|
+
function answerRetryDelay(attempt) {
|
|
193
|
+
return attempt === 0 ? 0 : Math.min(1e3 * 2 ** (attempt - 1), 15e3);
|
|
194
|
+
}
|
|
195
|
+
function useAnswerRetry(missing, refetch) {
|
|
196
|
+
const [attempt, setAttempt] = useState(0);
|
|
197
|
+
const [prev, setPrev] = useState(missing);
|
|
198
|
+
if (prev !== missing) {
|
|
199
|
+
setPrev(missing);
|
|
200
|
+
setAttempt(0);
|
|
201
|
+
}
|
|
202
|
+
const refetchRef = useRef(refetch);
|
|
203
|
+
refetchRef.current = refetch;
|
|
204
|
+
useEffect(() => {
|
|
205
|
+
if (!missing || attempt >= ANSWER_RETRY_CAP) return;
|
|
206
|
+
const t = setTimeout(() => {
|
|
207
|
+
void refetchRef.current();
|
|
208
|
+
setAttempt((a) => a + 1);
|
|
209
|
+
}, answerRetryDelay(attempt));
|
|
210
|
+
return () => clearTimeout(t);
|
|
211
|
+
}, [missing, attempt]);
|
|
212
|
+
}
|
|
191
213
|
function useWorkflowThread(workflow, options = {}) {
|
|
192
214
|
const arbi = useArbi();
|
|
193
215
|
const { ensureWorkspaceOpen } = useConnection();
|
|
@@ -218,16 +240,14 @@ function useWorkflowThread(workflow, options = {}) {
|
|
|
218
240
|
const answers = useMemo(() => {
|
|
219
241
|
const byId = /* @__PURE__ */ new Map();
|
|
220
242
|
for (const t of threads.data?.threads ?? [])
|
|
221
|
-
for (const m of t.history)
|
|
243
|
+
for (const m of t.history)
|
|
244
|
+
if (m.role === "assistant" && m.content?.trim()) byId.set(m.external_id, m.content);
|
|
222
245
|
return byId;
|
|
223
246
|
}, [threads.data]);
|
|
224
|
-
const
|
|
225
|
-
(st) => st.status === "done" &&
|
|
226
|
-
);
|
|
227
|
-
|
|
228
|
-
useEffect(() => {
|
|
229
|
-
if (answerMissing) void refetchThreads();
|
|
230
|
-
}, [answerMissing, activity.data, refetchThreads]);
|
|
247
|
+
const missing = Object.values(serverStates).flatMap(
|
|
248
|
+
(st) => st.status === "done" && st.responseId && !answers.has(st.responseId) ? [st.responseId] : []
|
|
249
|
+
).sort().join(" ");
|
|
250
|
+
useAnswerRetry(missing, threads.refetch);
|
|
231
251
|
const states = useMemo(() => {
|
|
232
252
|
if (!threadId) return localStates;
|
|
233
253
|
const out = {};
|
|
@@ -323,7 +343,8 @@ function useWorkflowThread(workflow, options = {}) {
|
|
|
323
343
|
var DEFAULT_CONNECTED_WORKFLOW_RUNNER_LABELS = {
|
|
324
344
|
notify: "Ask to approve",
|
|
325
345
|
notified: "Notified.",
|
|
326
|
-
openThread: "Open the thread"
|
|
346
|
+
openThread: "Open the thread",
|
|
347
|
+
loadingAnswer: "Fetching the answer\u2026"
|
|
327
348
|
};
|
|
328
349
|
function ConnectedWorkflowRunner({
|
|
329
350
|
workflow,
|
|
@@ -341,13 +362,17 @@ function ConnectedWorkflowRunner({
|
|
|
341
362
|
const { data: docs = [], refetch } = useDocuments(wsId);
|
|
342
363
|
const [uploading, setUploading] = useState(false);
|
|
343
364
|
const { view, conversationId } = useWorkflowThread(workflow, options);
|
|
365
|
+
const [added, setAdded] = useState({});
|
|
344
366
|
const onUpload = useCallback(
|
|
345
|
-
async (
|
|
346
|
-
if (!
|
|
367
|
+
async (files2, step) => {
|
|
368
|
+
if (!files2.length) return;
|
|
347
369
|
setUploading(true);
|
|
348
370
|
try {
|
|
349
371
|
await ensureWorkspaceOpen();
|
|
350
|
-
for (const f of
|
|
372
|
+
for (const f of files2) {
|
|
373
|
+
const { doc_ext_ids = [] } = await arbi.documents.uploadFile(f, f.name) ?? {};
|
|
374
|
+
setAdded((a) => ({ ...a, ...Object.fromEntries(doc_ext_ids.map((id) => [id, step.id])) }));
|
|
375
|
+
}
|
|
351
376
|
await refetch();
|
|
352
377
|
} finally {
|
|
353
378
|
setUploading(false);
|
|
@@ -355,9 +380,35 @@ function ConnectedWorkflowRunner({
|
|
|
355
380
|
},
|
|
356
381
|
[arbi, ensureWorkspaceOpen, refetch]
|
|
357
382
|
);
|
|
383
|
+
const files = docs.map((d) => ({
|
|
384
|
+
id: d.external_id,
|
|
385
|
+
name: d.file_name ?? d.external_id,
|
|
386
|
+
status: fileStatus(d.status),
|
|
387
|
+
addedFor: added[d.external_id]
|
|
388
|
+
}));
|
|
389
|
+
const reading = files.some((f) => f.addedFor && f.status === "processing");
|
|
390
|
+
useEffect(() => {
|
|
391
|
+
if (!reading) return;
|
|
392
|
+
const t = setInterval(() => void refetch(), READ_POLL_MS);
|
|
393
|
+
return () => clearInterval(t);
|
|
394
|
+
}, [reading, refetch]);
|
|
358
395
|
const renderAgentOutput = (step, state) => {
|
|
359
396
|
const status = state?.status;
|
|
360
397
|
if (!state?.text && status !== "done") return null;
|
|
398
|
+
if (!state?.text && state?.responseId) {
|
|
399
|
+
return /* @__PURE__ */ jsxs(
|
|
400
|
+
"p",
|
|
401
|
+
{
|
|
402
|
+
className: "flex items-center gap-2 text-sm text-muted-foreground",
|
|
403
|
+
"data-testid": `${testIdPrefix}-${step.id}-answer-loading`,
|
|
404
|
+
children: [
|
|
405
|
+
/* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }),
|
|
406
|
+
" ",
|
|
407
|
+
l.loadingAnswer
|
|
408
|
+
]
|
|
409
|
+
}
|
|
410
|
+
);
|
|
411
|
+
}
|
|
361
412
|
return /* @__PURE__ */ jsx(
|
|
362
413
|
AiAnswer,
|
|
363
414
|
{
|
|
@@ -401,12 +452,20 @@ function ConnectedWorkflowRunner({
|
|
|
401
452
|
) : null,
|
|
402
453
|
onUpload,
|
|
403
454
|
uploading,
|
|
404
|
-
files
|
|
455
|
+
files,
|
|
405
456
|
testIdPrefix
|
|
406
457
|
}
|
|
407
458
|
)
|
|
408
459
|
] });
|
|
409
460
|
}
|
|
461
|
+
var READ_POLL_MS = 3e3;
|
|
462
|
+
function fileStatus(status) {
|
|
463
|
+
const s = status?.toLowerCase();
|
|
464
|
+
if (!s) return void 0;
|
|
465
|
+
if (s === "failed") return "failed";
|
|
466
|
+
if (s === "completed" || s === "empty" || s === "low-content") return "ready";
|
|
467
|
+
return "processing";
|
|
468
|
+
}
|
|
410
469
|
function ReviewNotify({
|
|
411
470
|
conversationId,
|
|
412
471
|
workspaceId,
|