@arbidocs/blocks 0.4.81 → 0.4.83

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.
Files changed (55) hide show
  1. package/dist/agents/index.cjs +278 -278
  2. package/dist/agents/index.js +3 -3
  3. package/dist/agents/workflows/StepBarFrame.d.ts +12 -4
  4. package/dist/{chunk-THCFZKTM.js → chunk-CONIA2ZA.js} +8 -8
  5. package/dist/chunk-CONIA2ZA.js.map +1 -0
  6. package/dist/{chunk-SWSVPQNB.js → chunk-RSKSXEPW.js} +199 -18
  7. package/dist/chunk-RSKSXEPW.js.map +1 -0
  8. package/dist/{chunk-I56ORHPY.js → chunk-RX35SMPR.js} +5 -5
  9. package/dist/{chunk-I56ORHPY.js.map → chunk-RX35SMPR.js.map} +1 -1
  10. package/dist/{chunk-BX7JWZWE.cjs → chunk-RYYYHPFU.cjs} +8 -8
  11. package/dist/chunk-RYYYHPFU.cjs.map +1 -0
  12. package/dist/{chunk-F5WIETZY.cjs → chunk-XA5S4776.cjs} +44 -44
  13. package/dist/chunk-XA5S4776.cjs.map +1 -0
  14. package/dist/{chunk-UA2AMDR6.cjs → chunk-ZQYE7J3J.cjs} +201 -13
  15. package/dist/chunk-ZQYE7J3J.cjs.map +1 -0
  16. package/dist/connect/index.cjs +49 -28
  17. package/dist/connect/index.cjs.map +1 -1
  18. package/dist/connect/index.js +34 -13
  19. package/dist/connect/index.js.map +1 -1
  20. package/dist/connection/ConnectedTagMatrix.d.ts +6 -3
  21. package/dist/connection/ConnectedWorkflowBuilder.d.ts +9 -2
  22. package/dist/facts/index.cjs +1 -1
  23. package/dist/facts/index.js +1 -1
  24. package/dist/files/index.cjs +20 -1
  25. package/dist/files/index.cjs.map +1 -1
  26. package/dist/files/index.js +20 -2
  27. package/dist/files/index.js.map +1 -1
  28. package/dist/files/views/TagFormParts.d.ts +8 -0
  29. package/dist/files/views/index.d.ts +1 -1
  30. package/dist/home/index.cjs +1 -1
  31. package/dist/home/index.js +1 -1
  32. package/dist/index.cjs +696 -398
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.js +279 -8
  35. package/dist/index.js.map +1 -1
  36. package/dist/shell/index.cjs +1 -1
  37. package/dist/shell/index.js +1 -1
  38. package/dist/studio/index.cjs +1 -1
  39. package/dist/studio/index.js +1 -1
  40. package/dist/tags/TagDetail.d.ts +38 -0
  41. package/dist/tags/TagMatrix.d.ts +31 -8
  42. package/dist/tags/TagsNav.d.ts +44 -0
  43. package/dist/tags/index.d.ts +9 -3
  44. package/dist/tags/tagMatrixDocx.d.ts +45 -0
  45. package/dist/tags/tagMatrixModel.d.ts +10 -6
  46. package/dist/workflow-canvas/index.cjs +81 -63
  47. package/dist/workflow-canvas/index.cjs.map +1 -1
  48. package/dist/workflow-canvas/index.js +39 -21
  49. package/dist/workflow-canvas/index.js.map +1 -1
  50. package/package.json +4 -4
  51. package/dist/chunk-BX7JWZWE.cjs.map +0 -1
  52. package/dist/chunk-F5WIETZY.cjs.map +0 -1
  53. package/dist/chunk-SWSVPQNB.js.map +0 -1
  54. package/dist/chunk-THCFZKTM.js.map +0 -1
  55. package/dist/chunk-UA2AMDR6.cjs.map +0 -1
@@ -7,11 +7,11 @@ var chunkTZR36PPP_cjs = require('../chunk-TZR36PPP.cjs');
7
7
  var chunkMUMH3Z6K_cjs = require('../chunk-MUMH3Z6K.cjs');
8
8
  var chunkZVBPRMHJ_cjs = require('../chunk-ZVBPRMHJ.cjs');
9
9
  require('../chunk-7YUFMNFW.cjs');
10
- var chunkUA2AMDR6_cjs = require('../chunk-UA2AMDR6.cjs');
11
- var chunkQVBZESYQ_cjs = require('../chunk-QVBZESYQ.cjs');
12
- var chunkBX7JWZWE_cjs = require('../chunk-BX7JWZWE.cjs');
10
+ var chunkZQYE7J3J_cjs = require('../chunk-ZQYE7J3J.cjs');
11
+ var chunkRYYYHPFU_cjs = require('../chunk-RYYYHPFU.cjs');
13
12
  require('../chunk-DETZZBG2.cjs');
14
13
  require('../chunk-7D737FLE.cjs');
14
+ var chunkQVBZESYQ_cjs = require('../chunk-QVBZESYQ.cjs');
15
15
  require('../chunk-ADOKTJHV.cjs');
16
16
  var chunkMP6FK43E_cjs = require('../chunk-MP6FK43E.cjs');
17
17
  require('../chunk-VGOFFCMT.cjs');
@@ -190,7 +190,7 @@ function StreamedArtifact({
190
190
  }
191
191
  var STARTING = /* @__PURE__ */ new Set(["pending", "running"]);
192
192
  function formValues(step, inputs) {
193
- const fields = chunkBX7JWZWE_cjs.stepFields(step);
193
+ const fields = chunkRYYYHPFU_cjs.stepFields(step);
194
194
  if (!fields.length) return void 0;
195
195
  if (step.kind === "form")
196
196
  return Object.fromEntries(fields.map((f) => [f.name, inputs[f.name] ?? ""]));
@@ -228,7 +228,7 @@ function useWorkflowThread(workflow, options = {}) {
228
228
  const { wsId } = chunkXMBYDLZQ_cjs.useWorkspaceDocs();
229
229
  const [threadId, setThreadId] = react.useState(options.conversationId);
230
230
  const [localInputs, setLocalInputs] = react.useState(
231
- () => chunkBX7JWZWE_cjs.initialRunInputs(workflow, options.initialInputs)
231
+ () => chunkRYYYHPFU_cjs.initialRunInputs(workflow, options.initialInputs)
232
232
  );
233
233
  const [edits, setEdits] = react.useState({});
234
234
  const [localStates, setLocalStates] = react.useState({});
@@ -248,12 +248,12 @@ function useWorkflowThread(workflow, options = {}) {
248
248
  );
249
249
  const conversation = conversations.data?.find((c) => c.external_id === threadId);
250
250
  const steps = react.useMemo(
251
- () => chunkBX7JWZWE_cjs.workflowSteps(workflow).length > 0 ? chunkBX7JWZWE_cjs.workflowSteps(workflow) : chunkBX7JWZWE_cjs.fromPlanSteps(conversation?.plan?.steps ?? []),
251
+ () => chunkRYYYHPFU_cjs.workflowSteps(workflow).length > 0 ? chunkRYYYHPFU_cjs.workflowSteps(workflow) : chunkRYYYHPFU_cjs.fromPlanSteps(conversation?.plan?.steps ?? []),
252
252
  [workflow, conversation?.plan?.steps]
253
253
  );
254
254
  const activity = react$1.useConversationActivity(threadId, { live: !!threadId });
255
255
  const serverStates = react.useMemo(
256
- () => chunkBX7JWZWE_cjs.stepStatesFromActivity(activity.data ?? []),
256
+ () => chunkRYYYHPFU_cjs.stepStatesFromActivity(activity.data ?? []),
257
257
  [activity.data]
258
258
  );
259
259
  const working = steps.some(
@@ -305,7 +305,7 @@ function useWorkflowThread(workflow, options = {}) {
305
305
  if (!id) {
306
306
  await ensureWorkspaceOpen();
307
307
  const created = await createWork.mutateAsync({
308
- title: chunkBX7JWZWE_cjs.runThreadTitle(workflow, values).slice(0, 60),
308
+ title: chunkRYYYHPFU_cjs.runThreadTitle(workflow, values).slice(0, 60),
309
309
  description: workflow.description || null,
310
310
  prompt: null,
311
311
  skill_ref: null,
@@ -317,7 +317,7 @@ function useWorkflowThread(workflow, options = {}) {
317
317
  criteria: [],
318
318
  max_passes: 3,
319
319
  documents: [],
320
- steps: chunkBX7JWZWE_cjs.toPlanSteps(workflow, {
320
+ steps: chunkRYYYHPFU_cjs.toPlanSteps(workflow, {
321
321
  inputs: values,
322
322
  resolveWorkflow: options.resolveWorkflow,
323
323
  compose: options.compose
@@ -372,7 +372,7 @@ function useWorkflowThread(workflow, options = {}) {
372
372
  [threadId, act]
373
373
  );
374
374
  const loaded = !options.conversationId || activity.isSuccess || activity.isError;
375
- const view = chunkBX7JWZWE_cjs.useWorkflowView({
375
+ const view = chunkRYYYHPFU_cjs.useWorkflowView({
376
376
  steps,
377
377
  states,
378
378
  inputs,
@@ -444,7 +444,7 @@ function WorkflowSignDialog({
444
444
  const arbi = react$1.useArbi();
445
445
  const { user, ensureWorkspaceOpen } = chunkMUMH3Z6K_cjs.useConnection();
446
446
  const tools = documentTools.useOptionalDocumentTools();
447
- const { id, version } = chunkBX7JWZWE_cjs.splitDocRef(docRef);
447
+ const { id, version } = chunkRYYYHPFU_cjs.splitDocRef(docRef);
448
448
  const [pdf, setPdf] = react.useState(null);
449
449
  const [failed, setFailed] = react.useState(false);
450
450
  react.useEffect(() => {
@@ -496,7 +496,7 @@ function WorkflowWordDialog({
496
496
  onClose,
497
497
  labels
498
498
  }) {
499
- const { id } = chunkBX7JWZWE_cjs.splitDocRef(docRef);
499
+ const { id } = chunkRYYYHPFU_cjs.splitDocRef(docRef);
500
500
  return /* @__PURE__ */ jsxRuntime.jsx(
501
501
  chunkULWRNGGE_cjs.ModalScaffold,
502
502
  {
@@ -630,7 +630,7 @@ function ConnectedWorkflowRunner({
630
630
  () => ({
631
631
  me: user?.externalId,
632
632
  openDocument: onOpenDocument && ((ref) => {
633
- const { id, version } = chunkBX7JWZWE_cjs.splitDocRef(ref);
633
+ const { id, version } = chunkRYYYHPFU_cjs.splitDocRef(ref);
634
634
  onOpenDocument(id, version);
635
635
  }),
636
636
  openDraft: onOpenDraft && ((draftId) => onOpenDraft(draftId)),
@@ -640,7 +640,7 @@ function ConnectedWorkflowRunner({
640
640
  const w = state.waiting;
641
641
  if (w?.doc_ext_id) setDialog({ kind: "sign", docRef: w.doc_ext_id });
642
642
  }),
643
- openRedline: hostActions?.openRedline ?? ((ref) => setDialog({ kind: "word", docRef: ref, title: nameOfDoc(chunkBX7JWZWE_cjs.splitDocRef(ref).id) ?? "" })),
643
+ openRedline: hostActions?.openRedline ?? ((ref) => setDialog({ kind: "word", docRef: ref, title: nameOfDoc(chunkRYYYHPFU_cjs.splitDocRef(ref).id) ?? "" })),
644
644
  openReview: hostActions?.openReview ?? ((tags, documents) => setDialog({ kind: "review", tags, documents }))
645
645
  }),
646
646
  [user?.externalId, onOpenDocument, onOpenDraft, onOpenMessage, hostActions, nameOfDoc, inThread]
@@ -776,7 +776,7 @@ function ConnectedWorkflowRunner({
776
776
  );
777
777
  };
778
778
  const runner = (compact) => /* @__PURE__ */ jsxRuntime.jsx(
779
- chunkBX7JWZWE_cjs.WorkflowRunner,
779
+ chunkRYYYHPFU_cjs.WorkflowRunner,
780
780
  {
781
781
  people,
782
782
  ...runnerProps,
@@ -822,10 +822,10 @@ function ConnectedWorkflowRunner({
822
822
  ) }),
823
823
  inThread && conversationId ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
824
824
  /* @__PURE__ */ jsxRuntime.jsx(
825
- chunkBX7JWZWE_cjs.WorkflowStepBar,
825
+ chunkRYYYHPFU_cjs.WorkflowStepBar,
826
826
  {
827
827
  run: view,
828
- levels: chunkBX7JWZWE_cjs.stepLevels(view.steps),
828
+ levels: chunkRYYYHPFU_cjs.stepLevels(view.steps),
829
829
  doneTitle: (workflow.run.kind === "steps" ? workflow.run.completion?.title : void 0) ?? runnerProps.labels?.complete ?? "Done",
830
830
  icon: (key) => key && runnerProps.renderIcon ? runnerProps.renderIcon(key) : void 0,
831
831
  tid: (suffix) => `${testIdPrefix}-${suffix}`
@@ -963,6 +963,7 @@ function ConnectedTagMatrix({
963
963
  linksLimit = 3,
964
964
  exportTitle,
965
965
  onExported,
966
+ downloadable = true,
966
967
  readOnly,
967
968
  ...props
968
969
  }) {
@@ -981,9 +982,19 @@ function ConnectedTagMatrix({
981
982
  label: [m.user.given_name, m.user.family_name].filter(Boolean).join(" ") || m.user.email
982
983
  }));
983
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 = chunkZQYE7J3J_cjs.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: chunkZQYE7J3J_cjs.DOCX_MIME_TYPE }), name };
994
+ };
984
995
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
985
996
  /* @__PURE__ */ jsxRuntime.jsx(
986
- chunkUA2AMDR6_cjs.TagMatrix,
997
+ chunkZQYE7J3J_cjs.TagMatrix,
987
998
  {
988
999
  ...props,
989
1000
  matrix: matrix.data,
@@ -1008,22 +1019,32 @@ function ConnectedTagMatrix({
1008
1019
  try {
1009
1020
  const data = matrix.data;
1010
1021
  if (!data) return;
1011
- const title = exportTitle ?? data.parent?.name ?? "Matrix";
1012
- const markdown = chunkUA2AMDR6_cjs.tagMatrixMarkdown(data, {
1013
- title,
1014
- nameOf: (id2) => people.find((p) => p.value === id2)?.label
1015
- });
1022
+ const { blob, name } = snapshot(data);
1016
1023
  await ensureWorkspaceOpen();
1017
- const stamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
1018
- const uploaded = await arbi.documents.uploadFile(
1019
- new Blob([markdown], { type: "text/markdown" }),
1020
- `${title} (${stamp}).md`
1021
- );
1024
+ const uploaded = await arbi.documents.uploadFile(blob, name);
1022
1025
  const id = uploaded?.doc_ext_ids?.[0];
1023
1026
  if (id) onExported(id);
1024
1027
  } catch (e) {
1025
1028
  fail(e);
1026
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
+ }
1027
1048
  } : void 0
1028
1049
  }
1029
1050
  ),