@arbidocs/react 0.5.56 → 0.5.58
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 +9 -0
- package/dist/artifacts/index.cjs +14 -14
- package/dist/artifacts/index.js +4 -4
- package/dist/calls/livekit/index.cjs +49 -49
- package/dist/calls/livekit/index.js +4 -4
- package/dist/{chunk-V64EETLS.cjs → chunk-3QK4VVPG.cjs} +4 -4
- package/dist/{chunk-V64EETLS.cjs.map → chunk-3QK4VVPG.cjs.map} +1 -1
- package/dist/{chunk-WRMA2JYX.js → chunk-7VENKMLD.js} +5 -5
- package/dist/{chunk-WRMA2JYX.js.map → chunk-7VENKMLD.js.map} +1 -1
- package/dist/{chunk-2JQ7QNOO.cjs → chunk-A675AQXL.cjs} +154 -69
- package/dist/chunk-A675AQXL.cjs.map +1 -0
- package/dist/{chunk-KUGZXI7V.js → chunk-CE4RY7VA.js} +3 -3
- package/dist/{chunk-KUGZXI7V.js.map → chunk-CE4RY7VA.js.map} +1 -1
- package/dist/{chunk-RRWAX52L.cjs → chunk-G76ASVVH.cjs} +6 -2
- package/dist/chunk-G76ASVVH.cjs.map +1 -0
- package/dist/{chunk-PVUZULHI.js → chunk-J33GSXDT.js} +92 -12
- package/dist/chunk-J33GSXDT.js.map +1 -0
- package/dist/{chunk-3CVY5SGY.cjs → chunk-JNS3BOPU.cjs} +65 -65
- package/dist/{chunk-3CVY5SGY.cjs.map → chunk-JNS3BOPU.cjs.map} +1 -1
- package/dist/{chunk-UKEUDTOE.cjs → chunk-LCSUCZVX.cjs} +46 -46
- package/dist/{chunk-UKEUDTOE.cjs.map → chunk-LCSUCZVX.cjs.map} +1 -1
- package/dist/{chunk-4TKNUJKD.js → chunk-M2SZQBCO.js} +3 -3
- package/dist/{chunk-4TKNUJKD.js.map → chunk-M2SZQBCO.js.map} +1 -1
- package/dist/{chunk-DFZECLD3.js → chunk-R7YNABZY.js} +2 -2
- package/dist/chunk-R7YNABZY.js.map +1 -0
- package/dist/{chunk-JFL7BBZ6.js → chunk-S2W3ZOWG.js} +4 -4
- package/dist/{chunk-JFL7BBZ6.js.map → chunk-S2W3ZOWG.js.map} +1 -1
- package/dist/{chunk-FSPLYO52.cjs → chunk-SOOLC65L.cjs} +3 -3
- package/dist/{chunk-FSPLYO52.cjs.map → chunk-SOOLC65L.cjs.map} +1 -1
- package/dist/{chunk-PBXJFMES.js → chunk-U64WCQP3.js} +6 -2
- package/dist/chunk-U64WCQP3.js.map +1 -0
- package/dist/{chunk-YRY6DGRU.cjs → chunk-Y7S2SQH3.cjs} +2 -2
- package/dist/chunk-Y7S2SQH3.cjs.map +1 -0
- package/dist/document-tools/index.cjs +60 -60
- package/dist/document-tools/index.d.cts +2 -2
- package/dist/document-tools/index.d.ts +2 -2
- package/dist/document-tools/index.js +5 -5
- package/dist/index.cjs +2569 -1343
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1672 -1085
- package/dist/index.d.ts +1672 -1085
- package/dist/index.js +1228 -64
- package/dist/index.js.map +1 -1
- package/dist/{query-keys.d-DM2N5pzN.d.cts → query-keys.d-DEEMzkLz.d.cts} +4 -0
- package/dist/{query-keys.d-DM2N5pzN.d.ts → query-keys.d-DEEMzkLz.d.ts} +4 -0
- package/dist/ui/index.cjs +164 -164
- package/dist/ui/index.js +2 -2
- package/dist/viewers/index.cjs +2 -2
- package/dist/viewers/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-2JQ7QNOO.cjs.map +0 -1
- package/dist/chunk-DFZECLD3.js.map +0 -1
- package/dist/chunk-PBXJFMES.js.map +0 -1
- package/dist/chunk-PVUZULHI.js.map +0 -1
- package/dist/chunk-RRWAX52L.cjs.map +0 -1
- package/dist/chunk-YRY6DGRU.cjs.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunkRRWAX52L_cjs = require('./chunk-RRWAX52L.cjs');
|
|
4
3
|
var chunkN73IMVFF_cjs = require('./chunk-N73IMVFF.cjs');
|
|
4
|
+
var chunkG76ASVVH_cjs = require('./chunk-G76ASVVH.cjs');
|
|
5
5
|
var chunkZWFMFOGP_cjs = require('./chunk-ZWFMFOGP.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkY7S2SQH3_cjs = require('./chunk-Y7S2SQH3.cjs');
|
|
7
7
|
var client = require('@arbidocs/client');
|
|
8
8
|
var react = require('react');
|
|
9
9
|
var reactQuery = require('@tanstack/react-query');
|
|
@@ -279,6 +279,77 @@ function createArbiLayoutStore({ persist } = {}) {
|
|
|
279
279
|
};
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
+
// src/session/workspace.ts
|
|
283
|
+
function createArbiWorkspaceStore({
|
|
284
|
+
storage,
|
|
285
|
+
workspaceId = storage?.load() ?? null
|
|
286
|
+
} = {}) {
|
|
287
|
+
let state = { workspaceId, workspaceStatus: "closed" };
|
|
288
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
289
|
+
const update = (patch) => {
|
|
290
|
+
state = { ...state, ...patch };
|
|
291
|
+
listeners.forEach((listener) => listener());
|
|
292
|
+
};
|
|
293
|
+
const setWorkspaceId = (id) => {
|
|
294
|
+
storage?.save(id);
|
|
295
|
+
if (state.workspaceId !== id) update({ workspaceId: id });
|
|
296
|
+
};
|
|
297
|
+
return {
|
|
298
|
+
getState: () => state,
|
|
299
|
+
subscribe: (listener) => {
|
|
300
|
+
listeners.add(listener);
|
|
301
|
+
return () => listeners.delete(listener);
|
|
302
|
+
},
|
|
303
|
+
setWorkspaceId,
|
|
304
|
+
setWorkspaceStatus: (workspaceStatus) => {
|
|
305
|
+
if (state.workspaceStatus !== workspaceStatus) update({ workspaceStatus });
|
|
306
|
+
},
|
|
307
|
+
reset: () => {
|
|
308
|
+
storage?.save(null);
|
|
309
|
+
if (state.workspaceId !== null || state.workspaceStatus !== "closed")
|
|
310
|
+
update({ workspaceId: null, workspaceStatus: "closed" });
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
var WORKSPACE_STORAGE_KEY = "arbi_workspace_id";
|
|
315
|
+
var WORKSPACE_LAST_OPENED_KEY = "arbi_workspace_last_opened";
|
|
316
|
+
function browserWorkspaceStorage({
|
|
317
|
+
key = WORKSPACE_STORAGE_KEY,
|
|
318
|
+
lastOpenedKey = WORKSPACE_LAST_OPENED_KEY
|
|
319
|
+
} = {}) {
|
|
320
|
+
return {
|
|
321
|
+
load() {
|
|
322
|
+
try {
|
|
323
|
+
return window.sessionStorage.getItem(key);
|
|
324
|
+
} catch {
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
save(workspaceId) {
|
|
329
|
+
try {
|
|
330
|
+
if (!workspaceId) {
|
|
331
|
+
window.sessionStorage.removeItem(key);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
window.sessionStorage.setItem(key, workspaceId);
|
|
335
|
+
const lastOpened = readWorkspaceLastOpened(lastOpenedKey);
|
|
336
|
+
lastOpened[workspaceId] = Date.now();
|
|
337
|
+
window.localStorage.setItem(lastOpenedKey, JSON.stringify(lastOpened));
|
|
338
|
+
} catch {
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
function readWorkspaceLastOpened(lastOpenedKey = WORKSPACE_LAST_OPENED_KEY) {
|
|
344
|
+
try {
|
|
345
|
+
const raw = window.localStorage.getItem(lastOpenedKey);
|
|
346
|
+
const parsed = raw ? JSON.parse(raw) : null;
|
|
347
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
348
|
+
} catch {
|
|
349
|
+
return {};
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
282
353
|
// src/chat/run-state.ts
|
|
283
354
|
var MIN_QUEUED_MESSAGE_VISIBILITY_MS = 800;
|
|
284
355
|
var mapQueues = (queues, update) => Object.fromEntries(Object.entries(queues).map(([id, messages]) => [id, update(messages)]));
|
|
@@ -438,15 +509,26 @@ function withoutNew(record) {
|
|
|
438
509
|
const { new: _new, ...saved } = record;
|
|
439
510
|
return saved;
|
|
440
511
|
}
|
|
441
|
-
function createArbiSessionStore(initial = {}, {
|
|
512
|
+
function createArbiSessionStore(initial = {}, {
|
|
513
|
+
draftStorage,
|
|
514
|
+
persist,
|
|
515
|
+
workspace = createArbiWorkspaceStore({ workspaceId: initial.workspaceId ?? null })
|
|
516
|
+
} = {}) {
|
|
442
517
|
const layout = createArbiLayoutStore({ persist });
|
|
443
|
-
|
|
518
|
+
if (initial.workspaceStatus) workspace.setWorkspaceStatus(initial.workspaceStatus);
|
|
519
|
+
let state = {
|
|
520
|
+
...EMPTY_SESSION_STATE,
|
|
521
|
+
...layout.getLayout(),
|
|
522
|
+
...initial,
|
|
523
|
+
...workspace.getState()
|
|
524
|
+
};
|
|
444
525
|
const listeners = /* @__PURE__ */ new Set();
|
|
445
526
|
const update = (patch) => {
|
|
446
527
|
state = { ...state, ...patch };
|
|
447
528
|
listeners.forEach((listener) => listener());
|
|
448
529
|
};
|
|
449
530
|
layout.subscribe(() => update(layout.getLayout()));
|
|
531
|
+
workspace.subscribe(() => update(workspace.getState()));
|
|
450
532
|
let preEdit = { draft: "", cursor: null };
|
|
451
533
|
let draftsRestored = !draftStorage;
|
|
452
534
|
let draftsOwner = draftStorage?.owner() ?? null;
|
|
@@ -499,16 +581,14 @@ function createArbiSessionStore(initial = {}, { draftStorage, persist } = {}) {
|
|
|
499
581
|
return () => listeners.delete(listener);
|
|
500
582
|
},
|
|
501
583
|
setWorkspaceId: (workspaceId) => {
|
|
502
|
-
|
|
584
|
+
workspace.setWorkspaceId(workspaceId);
|
|
503
585
|
restoreDrafts();
|
|
504
586
|
},
|
|
505
|
-
setWorkspaceStatus: (workspaceStatus) =>
|
|
506
|
-
if (state.workspaceStatus !== workspaceStatus) update({ workspaceStatus });
|
|
507
|
-
},
|
|
587
|
+
setWorkspaceStatus: (workspaceStatus) => workspace.setWorkspaceStatus(workspaceStatus),
|
|
508
588
|
leaveWorkspace: () => {
|
|
509
589
|
Object.values(state.generating).forEach((generation) => generation.abortController?.abort());
|
|
590
|
+
workspace.setWorkspaceStatus("closed");
|
|
510
591
|
update({
|
|
511
|
-
workspaceStatus: "closed",
|
|
512
592
|
conversationId: null,
|
|
513
593
|
cursor: null,
|
|
514
594
|
viewingDocument: null,
|
|
@@ -873,7 +953,7 @@ var createOwnStore = (host) => createArbiSessionStore(
|
|
|
873
953
|
var moduleDefault = null;
|
|
874
954
|
var defaultStore = () => moduleDefault ??= createArbiSessionStore();
|
|
875
955
|
function useArbiSessionStore() {
|
|
876
|
-
const host =
|
|
956
|
+
const host = chunkY7S2SQH3_cjs.useArbiHost();
|
|
877
957
|
if (host.session) return host.session;
|
|
878
958
|
const own = host[chunkN73IMVFF_cjs.OWN_SESSION_SLOT];
|
|
879
959
|
if (own) return own.current ??= createOwnStore(host);
|
|
@@ -912,7 +992,7 @@ var SIGNED_OUT = {
|
|
|
912
992
|
var noSubscription = () => () => {
|
|
913
993
|
};
|
|
914
994
|
function useArbiSession() {
|
|
915
|
-
return useSignedInSession(
|
|
995
|
+
return useSignedInSession(chunkY7S2SQH3_cjs.useArbiHost().arbi?.session ?? null);
|
|
916
996
|
}
|
|
917
997
|
function useSignedInSession(session) {
|
|
918
998
|
const state = react.useSyncExternalStore(
|
|
@@ -1040,26 +1120,26 @@ function isUsageMetered(usage, subscription) {
|
|
|
1040
1120
|
return !(empty && subscription === "dev");
|
|
1041
1121
|
}
|
|
1042
1122
|
function useWorkspaces(options) {
|
|
1043
|
-
const arbi =
|
|
1123
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1044
1124
|
return reactQuery.useQuery({
|
|
1045
|
-
queryKey:
|
|
1125
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.workspaces(),
|
|
1046
1126
|
queryFn: () => arbi.workspaces.list(),
|
|
1047
1127
|
enabled: (options?.enabled ?? true) && arbi.isLoggedIn
|
|
1048
1128
|
});
|
|
1049
1129
|
}
|
|
1050
1130
|
function useDocumentVersionList(docId, options) {
|
|
1051
|
-
const arbi =
|
|
1131
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1052
1132
|
return reactQuery.useQuery({
|
|
1053
|
-
queryKey:
|
|
1133
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.documentVersions(docId ?? ""),
|
|
1054
1134
|
queryFn: () => arbi.documents.versions(docId),
|
|
1055
1135
|
enabled: (options?.enabled ?? true) && !!docId && arbi.hasWorkspace
|
|
1056
1136
|
});
|
|
1057
1137
|
}
|
|
1058
1138
|
function useConversations(workspaceId, options) {
|
|
1059
|
-
const arbi =
|
|
1139
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1060
1140
|
const live = options?.live === true;
|
|
1061
1141
|
return reactQuery.useQuery({
|
|
1062
|
-
queryKey:
|
|
1142
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.conversations(workspaceId ?? ""),
|
|
1063
1143
|
queryFn: () => arbi.readInWorkspace(workspaceId, () => arbi.conversations.list()),
|
|
1064
1144
|
enabled: (options?.enabled ?? true) && !!workspaceId && arbi.hasWorkspace,
|
|
1065
1145
|
placeholderData: (previous) => previous,
|
|
@@ -1069,9 +1149,9 @@ function useConversations(workspaceId, options) {
|
|
|
1069
1149
|
});
|
|
1070
1150
|
}
|
|
1071
1151
|
function useBuiltinCommands() {
|
|
1072
|
-
const arbi =
|
|
1152
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1073
1153
|
const query = reactQuery.useQuery({
|
|
1074
|
-
queryKey:
|
|
1154
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.assistantCommands(),
|
|
1075
1155
|
queryFn: () => arbi.assistant.commands(),
|
|
1076
1156
|
staleTime: 30 * 1e3,
|
|
1077
1157
|
enabled: arbi.isLoggedIn
|
|
@@ -1080,18 +1160,18 @@ function useBuiltinCommands() {
|
|
|
1080
1160
|
return { commands, isLoading: query.isLoading };
|
|
1081
1161
|
}
|
|
1082
1162
|
function useMessageDetails(messageId, options) {
|
|
1083
|
-
const arbi =
|
|
1163
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1084
1164
|
return reactQuery.useQuery({
|
|
1085
|
-
queryKey:
|
|
1165
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.messageDetails(messageId ?? ""),
|
|
1086
1166
|
queryFn: () => arbi.conversations.getMessage(messageId),
|
|
1087
1167
|
enabled: (options?.enabled ?? true) && !!messageId && arbi.isLoggedIn
|
|
1088
1168
|
});
|
|
1089
1169
|
}
|
|
1090
1170
|
function useConversationThreads(conversationId, options) {
|
|
1091
|
-
const arbi =
|
|
1171
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1092
1172
|
const session = useArbiSessionStore();
|
|
1093
1173
|
return reactQuery.useQuery({
|
|
1094
|
-
queryKey:
|
|
1174
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.conversationThreads(conversationId ?? ""),
|
|
1095
1175
|
queryFn: async () => {
|
|
1096
1176
|
try {
|
|
1097
1177
|
return await arbi.conversations.getThreads(conversationId);
|
|
@@ -1116,30 +1196,30 @@ var tagListKey = (query) => [
|
|
|
1116
1196
|
query.linksLimit !== void 0 ? `links:${query.linksLimit}` : ""
|
|
1117
1197
|
].filter(Boolean).join("|");
|
|
1118
1198
|
function useTags(workspaceId, options) {
|
|
1119
|
-
const arbi =
|
|
1199
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1120
1200
|
const { enabled, ...query } = options ?? {};
|
|
1121
1201
|
const workspace = workspaceId ?? (arbi.hasWorkspace ? arbi.getWorkspaceId() : "");
|
|
1122
1202
|
const key = tagListKey(query);
|
|
1123
1203
|
return reactQuery.useQuery({
|
|
1124
|
-
queryKey: key ?
|
|
1204
|
+
queryKey: key ? chunkG76ASVVH_cjs.arbiQueryKeys.tagList(workspace, key) : chunkG76ASVVH_cjs.arbiQueryKeys.tags(workspace),
|
|
1125
1205
|
queryFn: () => arbi.readInWorkspace(workspace, () => arbi.tags.list(key ? query : void 0)),
|
|
1126
1206
|
enabled: (enabled ?? true) && !!workspace && arbi.hasWorkspace && (query.ids === void 0 || query.ids.length > 0),
|
|
1127
1207
|
...key ? {} : { staleTime: Infinity }
|
|
1128
1208
|
});
|
|
1129
1209
|
}
|
|
1130
1210
|
function useThumbnails(docIds, options) {
|
|
1131
|
-
const arbi =
|
|
1211
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1132
1212
|
return reactQuery.useQuery({
|
|
1133
|
-
queryKey:
|
|
1213
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.thumbnails(docIds),
|
|
1134
1214
|
queryFn: () => arbi.documents.getThumbnails(docIds),
|
|
1135
1215
|
enabled: (options?.enabled ?? true) && docIds.length > 0 && arbi.hasWorkspace,
|
|
1136
1216
|
staleTime: 5 * 6e4
|
|
1137
1217
|
});
|
|
1138
1218
|
}
|
|
1139
1219
|
function useParsedDocument(docId, stage = "final", options) {
|
|
1140
|
-
const arbi =
|
|
1220
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1141
1221
|
return reactQuery.useQuery({
|
|
1142
|
-
queryKey:
|
|
1222
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.parsedDoc(docId ?? "", stage),
|
|
1143
1223
|
queryFn: () => {
|
|
1144
1224
|
const { docId: id, version } = chunkZWFMFOGP_cjs.parseVersionRef(docId);
|
|
1145
1225
|
return arbi.documents.getParsedContent(
|
|
@@ -1152,84 +1232,84 @@ function useParsedDocument(docId, stage = "final", options) {
|
|
|
1152
1232
|
});
|
|
1153
1233
|
}
|
|
1154
1234
|
function useAssistantQuery() {
|
|
1155
|
-
const arbi =
|
|
1235
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1156
1236
|
return reactQuery.useMutation({
|
|
1157
1237
|
mutationFn: ({ request, handlers }) => arbi.assistant.ask(request, handlers)
|
|
1158
1238
|
});
|
|
1159
1239
|
}
|
|
1160
1240
|
function useAgents(options) {
|
|
1161
|
-
const arbi =
|
|
1241
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1162
1242
|
return reactQuery.useQuery({
|
|
1163
|
-
queryKey:
|
|
1243
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.agents(),
|
|
1164
1244
|
queryFn: () => arbi.agents.list(),
|
|
1165
1245
|
enabled: (options?.enabled ?? true) && arbi.isLoggedIn
|
|
1166
1246
|
});
|
|
1167
1247
|
}
|
|
1168
1248
|
function useDeleteAgents() {
|
|
1169
|
-
const arbi =
|
|
1249
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1170
1250
|
const qc = reactQuery.useQueryClient();
|
|
1171
1251
|
return reactQuery.useMutation({
|
|
1172
1252
|
mutationFn: ({ agentExtIds }) => arbi.agents.delete(agentExtIds),
|
|
1173
1253
|
onSuccess: (_result, { agentExtIds }) => {
|
|
1174
1254
|
for (const id of agentExtIds) {
|
|
1175
|
-
qc.removeQueries({ queryKey:
|
|
1176
|
-
qc.removeQueries({ queryKey:
|
|
1255
|
+
qc.removeQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.agentConfig(id) });
|
|
1256
|
+
qc.removeQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.agentWorkspaces(id) });
|
|
1177
1257
|
}
|
|
1178
1258
|
return Promise.all([
|
|
1179
|
-
qc.invalidateQueries({ queryKey:
|
|
1180
|
-
qc.invalidateQueries({ queryKey:
|
|
1181
|
-
qc.invalidateQueries({ queryKey:
|
|
1182
|
-
qc.invalidateQueries({ queryKey:
|
|
1259
|
+
qc.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.agents() }),
|
|
1260
|
+
qc.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.workflows() }),
|
|
1261
|
+
qc.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.allConversations() }),
|
|
1262
|
+
qc.invalidateQueries({ queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.configs() })
|
|
1183
1263
|
]);
|
|
1184
1264
|
}
|
|
1185
1265
|
});
|
|
1186
1266
|
}
|
|
1187
1267
|
function useHealth(options) {
|
|
1188
|
-
const arbi =
|
|
1268
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1189
1269
|
return reactQuery.useQuery({
|
|
1190
|
-
queryKey:
|
|
1270
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.health(),
|
|
1191
1271
|
queryFn: () => arbi.health.check(),
|
|
1192
1272
|
enabled: options?.enabled
|
|
1193
1273
|
});
|
|
1194
1274
|
}
|
|
1195
1275
|
function useAvailableModels(options) {
|
|
1196
|
-
const arbi =
|
|
1276
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1197
1277
|
return reactQuery.useQuery({
|
|
1198
|
-
queryKey:
|
|
1278
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.availableModels(),
|
|
1199
1279
|
queryFn: () => arbi.health.models(),
|
|
1200
1280
|
staleTime: Infinity,
|
|
1201
1281
|
enabled: (options?.enabled ?? true) && arbi.isLoggedIn
|
|
1202
1282
|
});
|
|
1203
1283
|
}
|
|
1204
1284
|
function useConfigs(options) {
|
|
1205
|
-
const arbi =
|
|
1285
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1206
1286
|
return reactQuery.useQuery({
|
|
1207
|
-
queryKey:
|
|
1287
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.configVersions(),
|
|
1208
1288
|
queryFn: () => arbi.agentConfig.list(),
|
|
1209
1289
|
enabled: options?.enabled ?? arbi.isLoggedIn
|
|
1210
1290
|
});
|
|
1211
1291
|
}
|
|
1212
1292
|
function useConfig(configId, options) {
|
|
1213
|
-
const arbi =
|
|
1293
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1214
1294
|
return reactQuery.useQuery({
|
|
1215
|
-
queryKey:
|
|
1295
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.config(configId ?? ""),
|
|
1216
1296
|
queryFn: () => arbi.agentConfig.get(configId),
|
|
1217
1297
|
staleTime: 10 * 60 * 1e3,
|
|
1218
1298
|
enabled: (options?.enabled ?? true) && !!configId && arbi.isLoggedIn
|
|
1219
1299
|
});
|
|
1220
1300
|
}
|
|
1221
1301
|
function useActivity(options) {
|
|
1222
|
-
const arbi =
|
|
1302
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1223
1303
|
return reactQuery.useQuery({
|
|
1224
|
-
queryKey:
|
|
1304
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.activity(),
|
|
1225
1305
|
queryFn: () => arbi.dm.listActivity({ limit: options?.limit, offset: options?.offset }),
|
|
1226
1306
|
enabled: options?.enabled ?? arbi.isLoggedIn
|
|
1227
1307
|
});
|
|
1228
1308
|
}
|
|
1229
1309
|
function useWorkspaceActivity(workspaceId, options) {
|
|
1230
|
-
const arbi =
|
|
1310
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1231
1311
|
return reactQuery.useInfiniteQuery({
|
|
1232
|
-
queryKey:
|
|
1312
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.workspaceActivity(workspaceId ?? ""),
|
|
1233
1313
|
queryFn: async ({ pageParam }) => {
|
|
1234
1314
|
await options?.beforeFetch?.();
|
|
1235
1315
|
return arbi.workspaces.activity(workspaceId, {
|
|
@@ -1243,17 +1323,17 @@ function useWorkspaceActivity(workspaceId, options) {
|
|
|
1243
1323
|
});
|
|
1244
1324
|
}
|
|
1245
1325
|
function useProjects(options) {
|
|
1246
|
-
const arbi =
|
|
1326
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1247
1327
|
return reactQuery.useQuery({
|
|
1248
|
-
queryKey:
|
|
1328
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.projects(),
|
|
1249
1329
|
queryFn: () => arbi.projects.list(),
|
|
1250
1330
|
enabled: options?.enabled ?? arbi.isLoggedIn
|
|
1251
1331
|
});
|
|
1252
1332
|
}
|
|
1253
1333
|
function useProjectUsage(projectExtId, monthsBack = 0, options) {
|
|
1254
|
-
const arbi =
|
|
1334
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1255
1335
|
const usage = reactQuery.useQuery({
|
|
1256
|
-
queryKey:
|
|
1336
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.projectUsage(projectExtId ?? "", monthsBack),
|
|
1257
1337
|
queryFn: () => arbi.projects.usage(projectExtId, monthsBack),
|
|
1258
1338
|
enabled: (options?.enabled ?? true) && !!projectExtId && arbi.isLoggedIn
|
|
1259
1339
|
});
|
|
@@ -1263,12 +1343,12 @@ function useProjectUsage(projectExtId, monthsBack = 0, options) {
|
|
|
1263
1343
|
return { ...usage, metered };
|
|
1264
1344
|
}
|
|
1265
1345
|
function useProjectsUsage(projectExtIds, monthsBack = 0, options) {
|
|
1266
|
-
const arbi =
|
|
1346
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1267
1347
|
const enabled = (options?.enabled ?? true) && arbi.isLoggedIn;
|
|
1268
1348
|
const projects = useProjects({ enabled: enabled && projectExtIds.length > 0 });
|
|
1269
1349
|
const results = reactQuery.useQueries({
|
|
1270
1350
|
queries: projectExtIds.map((id) => ({
|
|
1271
|
-
queryKey:
|
|
1351
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.projectUsage(id, monthsBack),
|
|
1272
1352
|
queryFn: () => arbi.projects.usage(id, monthsBack),
|
|
1273
1353
|
enabled: enabled && !!id
|
|
1274
1354
|
}))
|
|
@@ -1337,17 +1417,17 @@ function useProjectsUsage(projectExtIds, monthsBack = 0, options) {
|
|
|
1337
1417
|
}, [signature]);
|
|
1338
1418
|
}
|
|
1339
1419
|
function useProjectInvoices(projectExtId, options) {
|
|
1340
|
-
const arbi =
|
|
1420
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1341
1421
|
return reactQuery.useQuery({
|
|
1342
|
-
queryKey:
|
|
1422
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.projectInvoices(projectExtId ?? ""),
|
|
1343
1423
|
queryFn: () => arbi.projects.invoices(projectExtId),
|
|
1344
1424
|
enabled: (options?.enabled ?? true) && !!projectExtId && arbi.isLoggedIn
|
|
1345
1425
|
});
|
|
1346
1426
|
}
|
|
1347
1427
|
function useCurrentUser(options) {
|
|
1348
|
-
const arbi =
|
|
1428
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1349
1429
|
return reactQuery.useQuery({
|
|
1350
|
-
queryKey:
|
|
1430
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.currentUser(),
|
|
1351
1431
|
queryFn: () => arbi.user.me(),
|
|
1352
1432
|
enabled: options?.enabled ?? arbi.isLoggedIn,
|
|
1353
1433
|
refetchOnWindowFocus: true,
|
|
@@ -1355,9 +1435,9 @@ function useCurrentUser(options) {
|
|
|
1355
1435
|
});
|
|
1356
1436
|
}
|
|
1357
1437
|
function useFirmPool(options) {
|
|
1358
|
-
const arbi =
|
|
1438
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1359
1439
|
return reactQuery.useQuery({
|
|
1360
|
-
queryKey:
|
|
1440
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.firmPool(),
|
|
1361
1441
|
queryFn: () => arbi.firm.pool(),
|
|
1362
1442
|
enabled: (options?.enabled ?? true) && arbi.isLoggedIn,
|
|
1363
1443
|
retry: false,
|
|
@@ -1371,12 +1451,12 @@ function useBoxRole(options = {}) {
|
|
|
1371
1451
|
return { isBox, isBoxAdmin: isBox && !!data?.can_top_up };
|
|
1372
1452
|
}
|
|
1373
1453
|
function useTopUpFirmPool() {
|
|
1374
|
-
const arbi =
|
|
1454
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1375
1455
|
const queryClient = reactQuery.useQueryClient();
|
|
1376
1456
|
return reactQuery.useMutation({
|
|
1377
1457
|
mutationFn: (aiAddons) => arbi.firm.topUp(aiAddons),
|
|
1378
1458
|
onSuccess: (result) => {
|
|
1379
|
-
queryClient.setQueryData(
|
|
1459
|
+
queryClient.setQueryData(chunkG76ASVVH_cjs.arbiQueryKeys.firmPool(), result.pool);
|
|
1380
1460
|
}
|
|
1381
1461
|
});
|
|
1382
1462
|
}
|
|
@@ -1396,9 +1476,9 @@ function useCanCreateProjects() {
|
|
|
1396
1476
|
return user.data?.can_create_projects;
|
|
1397
1477
|
}
|
|
1398
1478
|
function useUserUsageToday(options) {
|
|
1399
|
-
const arbi =
|
|
1479
|
+
const arbi = chunkY7S2SQH3_cjs.useArbi();
|
|
1400
1480
|
return reactQuery.useQuery({
|
|
1401
|
-
queryKey:
|
|
1481
|
+
queryKey: chunkG76ASVVH_cjs.arbiQueryKeys.userUsageToday(),
|
|
1402
1482
|
queryFn: () => arbi.user.usageToday(),
|
|
1403
1483
|
enabled: (options?.enabled ?? true) && arbi.isLoggedIn,
|
|
1404
1484
|
refetchOnWindowFocus: true,
|
|
@@ -1412,12 +1492,16 @@ exports.EMPTY_SESSION_STATE = EMPTY_SESSION_STATE;
|
|
|
1412
1492
|
exports.MAX_THREAD_TABS = MAX_THREAD_TABS;
|
|
1413
1493
|
exports.MIN_QUEUED_MESSAGE_VISIBILITY_MS = MIN_QUEUED_MESSAGE_VISIBILITY_MS;
|
|
1414
1494
|
exports.PROJECT_CREATION_DENIED_REASON = PROJECT_CREATION_DENIED_REASON;
|
|
1495
|
+
exports.WORKSPACE_LAST_OPENED_KEY = WORKSPACE_LAST_OPENED_KEY;
|
|
1496
|
+
exports.WORKSPACE_STORAGE_KEY = WORKSPACE_STORAGE_KEY;
|
|
1415
1497
|
exports.agentControl = agentControl;
|
|
1498
|
+
exports.browserWorkspaceStorage = browserWorkspaceStorage;
|
|
1416
1499
|
exports.clearSealedDrafts = clearSealedDrafts;
|
|
1417
1500
|
exports.closePanelIn = closePanelIn;
|
|
1418
1501
|
exports.conversationKey = conversationKey;
|
|
1419
1502
|
exports.createArbiLayoutStore = createArbiLayoutStore;
|
|
1420
1503
|
exports.createArbiSessionStore = createArbiSessionStore;
|
|
1504
|
+
exports.createArbiWorkspaceStore = createArbiWorkspaceStore;
|
|
1421
1505
|
exports.createDebouncedWriter = createDebouncedWriter;
|
|
1422
1506
|
exports.createSealedDraftStorage = createSealedDraftStorage;
|
|
1423
1507
|
exports.createStoragePersist = createStoragePersist;
|
|
@@ -1432,6 +1516,7 @@ exports.openPanelIn = openPanelIn;
|
|
|
1432
1516
|
exports.panelPlace = panelPlace;
|
|
1433
1517
|
exports.parseSavedLayout = parseSavedLayout;
|
|
1434
1518
|
exports.queuedMessages = queuedMessages;
|
|
1519
|
+
exports.readWorkspaceLastOpened = readWorkspaceLastOpened;
|
|
1435
1520
|
exports.restoreLayout = restoreLayout;
|
|
1436
1521
|
exports.savedLayoutOf = savedLayoutOf;
|
|
1437
1522
|
exports.selectDraft = selectDraft;
|
|
@@ -1473,5 +1558,5 @@ exports.useTransientView = useTransientView;
|
|
|
1473
1558
|
exports.useUserUsageToday = useUserUsageToday;
|
|
1474
1559
|
exports.useWorkspaceActivity = useWorkspaceActivity;
|
|
1475
1560
|
exports.useWorkspaces = useWorkspaces;
|
|
1476
|
-
//# sourceMappingURL=chunk-
|
|
1477
|
-
//# sourceMappingURL=chunk-
|
|
1561
|
+
//# sourceMappingURL=chunk-A675AQXL.cjs.map
|
|
1562
|
+
//# sourceMappingURL=chunk-A675AQXL.cjs.map
|