@arbidocs/react 0.5.44 → 0.5.46

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.
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkONGNP4JM_cjs = require('../chunk-ONGNP4JM.cjs');
4
+ var chunkRRWAX52L_cjs = require('../chunk-RRWAX52L.cjs');
4
5
  var chunkSUZORMAB_cjs = require('../chunk-SUZORMAB.cjs');
5
6
  var chunk2IJP73ZG_cjs = require('../chunk-2IJP73ZG.cjs');
6
- var chunkRRWAX52L_cjs = require('../chunk-RRWAX52L.cjs');
7
7
  var chunkZWFMFOGP_cjs = require('../chunk-ZWFMFOGP.cjs');
8
8
  require('../chunk-VOFNX4P6.cjs');
9
9
  require('../chunk-WYZJLZ67.cjs');
10
- require('../chunk-HJDR5HEO.cjs');
11
10
  require('../chunk-Z3LLUO32.cjs');
11
+ require('../chunk-HJDR5HEO.cjs');
12
12
  require('../chunk-S6A6FSG7.cjs');
13
13
  require('../chunk-YIUUTRMQ.cjs');
14
14
  require('../chunk-RCKA7BEF.cjs');
@@ -1,14 +1,14 @@
1
1
  import { fetchDocumentFile, fetchDocumentPdf, DocumentFetchError, useDocumentTools, SIGNED_LOCKED_REASON, fetchMarkupPdf } from '../chunk-KOLCL4KV.js';
2
2
  export { DocumentFetchError, DocumentToolsProvider, MarkupDownloadError, SIGNED_LOCKED_REASON, certificateLink, clientUpload, contentDispositionFileName, currentHasMarkup, defaultCertificateUrl, downloadBlob, fetchDocumentFile, fetchDocumentPdf, fetchMarkupPdf, isSignedVersion, uploadQueryString, useDocumentTools, useOptionalDocumentTools } from '../chunk-KOLCL4KV.js';
3
- import { mergeLayers, AnnotationStoreOfflineError } from '../chunk-T4CLW3DN.js';
4
- import { parseLayer, emptyLayer, LAYER_SCHEMA_VERSION } from '../chunk-T3USOSVN.js';
5
3
  import { documentBytesKey, arbiQueryKeys } from '../chunk-PBXJFMES.js';
6
4
  export { documentBytesKey } from '../chunk-PBXJFMES.js';
5
+ import { mergeLayers, AnnotationStoreOfflineError } from '../chunk-T4CLW3DN.js';
6
+ import { parseLayer, emptyLayer, LAYER_SCHEMA_VERSION } from '../chunk-T3USOSVN.js';
7
7
  import { parseVersionRef } from '../chunk-NNWMHMEC.js';
8
8
  import '../chunk-WUTL62MC.js';
9
9
  import '../chunk-YNNAJJ5Z.js';
10
- import '../chunk-47CCGUWR.js';
11
10
  import '../chunk-QRCMKEE6.js';
11
+ import '../chunk-47CCGUWR.js';
12
12
  import '../chunk-SN5YV6FF.js';
13
13
  import '../chunk-MB34NKBZ.js';
14
14
  import '../chunk-CPZ36AQS.js';
package/dist/index.cjs CHANGED
@@ -15,8 +15,8 @@ var chunkEEIYXVM4_cjs = require('./chunk-EEIYXVM4.cjs');
15
15
  var chunkOC7F5SNA_cjs = require('./chunk-OC7F5SNA.cjs');
16
16
  var chunkKC474WVG_cjs = require('./chunk-KC474WVG.cjs');
17
17
  var chunkWYZJLZ67_cjs = require('./chunk-WYZJLZ67.cjs');
18
- var chunkHJDR5HEO_cjs = require('./chunk-HJDR5HEO.cjs');
19
18
  var chunkZ3LLUO32_cjs = require('./chunk-Z3LLUO32.cjs');
19
+ var chunkHJDR5HEO_cjs = require('./chunk-HJDR5HEO.cjs');
20
20
  var chunkS6A6FSG7_cjs = require('./chunk-S6A6FSG7.cjs');
21
21
  var chunkTMPDW7J5_cjs = require('./chunk-TMPDW7J5.cjs');
22
22
  var chunkYIUUTRMQ_cjs = require('./chunk-YIUUTRMQ.cjs');
@@ -485,11 +485,15 @@ function useUploadSkillFiles() {
485
485
  for (const entry of entries) assertSkillFolder(entry.folder);
486
486
  const results = [];
487
487
  for (const entry of entries) {
488
- const result = await arbi.documents.uploadFile(entry.content, entry.fileName, {
488
+ const options = {
489
489
  folder: entry.folder,
490
490
  wpType: "skill",
491
491
  shared: entry.shared ?? false
492
- });
492
+ };
493
+ const result = entry.workspaceId ? await arbi.documents.upload(
494
+ [new File([entry.content], entry.fileName, { type: entry.content.type })],
495
+ { ...options, workspaceExtId: entry.workspaceId }
496
+ ) : await arbi.documents.uploadFile(entry.content, entry.fileName, options);
493
497
  throwOnSkipped(result);
494
498
  results.push(result);
495
499
  }
@@ -6264,6 +6268,53 @@ var ChatBubble = React.memo(function ChatBubble2({
6264
6268
  }
6265
6269
  );
6266
6270
  });
6271
+ var installs = /* @__PURE__ */ new WeakMap();
6272
+ function useInstallSkillPack(pack) {
6273
+ const arbi = chunkYIUUTRMQ_cjs.useArbi();
6274
+ const upload = useUploadSkillFiles();
6275
+ return reactQuery.useMutation({
6276
+ mutationFn: ({ workspaceId }) => {
6277
+ const signal = arbi.getConnectionInfo()?.signal;
6278
+ if (!signal) return Promise.reject(new Error("Skill installation needs a signed-in session."));
6279
+ const checkContext = () => {
6280
+ if (signal.aborted || arbi.getConnectionInfo()?.signal !== signal || arbi.getWorkspaceId() !== workspaceId)
6281
+ throw new DOMException(
6282
+ "The skill installation session or workspace changed.",
6283
+ "AbortError"
6284
+ );
6285
+ };
6286
+ checkContext();
6287
+ let sessions = installs.get(arbi);
6288
+ if (!sessions) installs.set(arbi, sessions = /* @__PURE__ */ new WeakMap());
6289
+ let pending = sessions.get(signal);
6290
+ if (!pending) sessions.set(signal, pending = /* @__PURE__ */ new Map());
6291
+ const key = JSON.stringify([workspaceId, pack.id, pack.version]);
6292
+ const running = pending.get(key);
6293
+ if (running) return running;
6294
+ const install = (async () => {
6295
+ const listed = await arbi.assistant.listSkills({ includeHidden: true });
6296
+ checkContext();
6297
+ const present = new Set(listed.map((skill) => skill.slug));
6298
+ const current = listed.find((skill) => skill.slug === pack.marker.slug)?.description === pack.version;
6299
+ const due = pack.skills.filter((skill) => !current || !present.has(skill.slug));
6300
+ for (const skill of [...due, ...!current ? [pack.marker] : []]) {
6301
+ checkContext();
6302
+ await upload.mutateAsync([
6303
+ {
6304
+ folder: `skills/${skill.slug}`,
6305
+ workspaceId,
6306
+ fileName: "SKILL.md",
6307
+ content: new Blob([skill.markdown], { type: "text/markdown" }),
6308
+ shared: skill.shared ?? true
6309
+ }
6310
+ ]);
6311
+ }
6312
+ })().finally(() => pending.delete(key));
6313
+ pending.set(key, install);
6314
+ return install;
6315
+ }
6316
+ });
6317
+ }
6267
6318
 
6268
6319
  // src/websocket/reconnect.ts
6269
6320
  var INITIAL_RECONNECT_DELAY_MS = 1e3;
@@ -15225,6 +15276,18 @@ Object.defineProperty(exports, "buttonVariants", {
15225
15276
  enumerable: true,
15226
15277
  get: function () { return chunkWYZJLZ67_cjs.buttonVariants; }
15227
15278
  });
15279
+ Object.defineProperty(exports, "closeOpenEmphasis", {
15280
+ enumerable: true,
15281
+ get: function () { return chunkZ3LLUO32_cjs.closeOpenEmphasis; }
15282
+ });
15283
+ Object.defineProperty(exports, "normalizeCitationMarkup", {
15284
+ enumerable: true,
15285
+ get: function () { return chunkZ3LLUO32_cjs.normalizeCitationMarkup; }
15286
+ });
15287
+ Object.defineProperty(exports, "trimOpenCitation", {
15288
+ enumerable: true,
15289
+ get: function () { return chunkZ3LLUO32_cjs.trimOpenCitation; }
15290
+ });
15228
15291
  Object.defineProperty(exports, "DropdownMenu", {
15229
15292
  enumerable: true,
15230
15293
  get: function () { return chunkHJDR5HEO_cjs.DropdownMenu; }
@@ -15293,18 +15356,6 @@ Object.defineProperty(exports, "usePortalContainer", {
15293
15356
  enumerable: true,
15294
15357
  get: function () { return chunkHJDR5HEO_cjs.usePortalContainer; }
15295
15358
  });
15296
- Object.defineProperty(exports, "closeOpenEmphasis", {
15297
- enumerable: true,
15298
- get: function () { return chunkZ3LLUO32_cjs.closeOpenEmphasis; }
15299
- });
15300
- Object.defineProperty(exports, "normalizeCitationMarkup", {
15301
- enumerable: true,
15302
- get: function () { return chunkZ3LLUO32_cjs.normalizeCitationMarkup; }
15303
- });
15304
- Object.defineProperty(exports, "trimOpenCitation", {
15305
- enumerable: true,
15306
- get: function () { return chunkZ3LLUO32_cjs.trimOpenCitation; }
15307
- });
15308
15359
  Object.defineProperty(exports, "cn", {
15309
15360
  enumerable: true,
15310
15361
  get: function () { return chunkS6A6FSG7_cjs.cn; }
@@ -15797,6 +15848,7 @@ exports.useImportCalendar = useImportCalendar;
15797
15848
  exports.useImportContacts = useImportContacts;
15798
15849
  exports.useImportDatabase = useImportDatabase;
15799
15850
  exports.useImportDatabaseRows = useImportDatabaseRows;
15851
+ exports.useInstallSkillPack = useInstallSkillPack;
15800
15852
  exports.useInvalidateAfterTransfer = useInvalidateAfterTransfer;
15801
15853
  exports.useInvalidateProjects = useInvalidateProjects;
15802
15854
  exports.useInvalidateStorage = useInvalidateStorage;