@arbidocs/blocks 0.4.75 → 0.4.77

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 (113) hide show
  1. package/dist/agents/index.cjs +341 -253
  2. package/dist/agents/index.js +3 -3
  3. package/dist/agents/tasks/TaskActivityTimeline.d.ts +1 -1
  4. package/dist/agents/tasks/WorkflowThreadStrip.d.ts +44 -1
  5. package/dist/agents/tasks/index.d.ts +2 -1
  6. package/dist/agents/tasks/linkedRuns.d.ts +31 -0
  7. package/dist/agents/workflows/SchemaForm.d.ts +6 -1
  8. package/dist/agents/workflows/StepParts.d.ts +109 -0
  9. package/dist/agents/workflows/WorkflowRunner.d.ts +11 -2
  10. package/dist/agents/workflows/index.d.ts +3 -2
  11. package/dist/agents/workflows/planSteps.d.ts +10 -1
  12. package/dist/agents/workflows/run.d.ts +61 -8
  13. package/dist/agents/workflows/types.d.ts +160 -4
  14. package/dist/agents/workflows/useWorkflowPreview.d.ts +2 -1
  15. package/dist/agents/workflows/useWorkflowView.d.ts +19 -0
  16. package/dist/chat/ChatPage.d.ts +1 -1
  17. package/dist/chat/WorkflowStepChip.d.ts +24 -0
  18. package/dist/chat/chat-page-types.d.ts +4 -0
  19. package/dist/chat/index.cjs +130 -122
  20. package/dist/chat/index.d.ts +1 -0
  21. package/dist/chat/index.js +2 -2
  22. package/dist/{chunk-YWYVIQ7T.js → chunk-34UW6XUQ.js} +948 -38
  23. package/dist/chunk-34UW6XUQ.js.map +1 -0
  24. package/dist/{chunk-P2RBE3FD.cjs → chunk-3XR3IEGU.cjs} +965 -35
  25. package/dist/chunk-3XR3IEGU.cjs.map +1 -0
  26. package/dist/{chunk-ZWA7UUZL.cjs → chunk-7YUFMNFW.cjs} +2 -54
  27. package/dist/chunk-7YUFMNFW.cjs.map +1 -0
  28. package/dist/chunk-A24C6BNA.js +92 -0
  29. package/dist/chunk-A24C6BNA.js.map +1 -0
  30. package/dist/chunk-AINNADMT.cjs +62 -0
  31. package/dist/chunk-AINNADMT.cjs.map +1 -0
  32. package/dist/{chunk-7CVF3DK2.cjs → chunk-EKIUMNCN.cjs} +5 -5
  33. package/dist/{chunk-7CVF3DK2.cjs.map → chunk-EKIUMNCN.cjs.map} +1 -1
  34. package/dist/chunk-FE4ULGOR.js +151 -0
  35. package/dist/chunk-FE4ULGOR.js.map +1 -0
  36. package/dist/chunk-FT5FFXSJ.js +60 -0
  37. package/dist/chunk-FT5FFXSJ.js.map +1 -0
  38. package/dist/{chunk-HITAN7JF.cjs → chunk-GTXOV7IJ.cjs} +4 -4
  39. package/dist/{chunk-HITAN7JF.cjs.map → chunk-GTXOV7IJ.cjs.map} +1 -1
  40. package/dist/{chunk-LT2UORRG.js → chunk-HEVVT6IT.js} +205 -38
  41. package/dist/chunk-HEVVT6IT.js.map +1 -0
  42. package/dist/{chunk-IPGKTUF7.cjs → chunk-HOD6OM7L.cjs} +68 -3
  43. package/dist/chunk-HOD6OM7L.cjs.map +1 -0
  44. package/dist/{chunk-F4LUD3YC.cjs → chunk-JFUN4D7D.cjs} +229 -60
  45. package/dist/chunk-JFUN4D7D.cjs.map +1 -0
  46. package/dist/{chunk-UIWLDSTF.js → chunk-NIP5BOP7.js} +68 -5
  47. package/dist/chunk-NIP5BOP7.js.map +1 -0
  48. package/dist/{chunk-MK6NJQGF.js → chunk-OEM5ARVM.js} +3 -3
  49. package/dist/{chunk-MK6NJQGF.js.map → chunk-OEM5ARVM.js.map} +1 -1
  50. package/dist/{chunk-5EBGRG3X.js → chunk-OPA2Y6YZ.js} +3 -54
  51. package/dist/chunk-OPA2Y6YZ.js.map +1 -0
  52. package/dist/chunk-TZR36PPP.cjs +95 -0
  53. package/dist/chunk-TZR36PPP.cjs.map +1 -0
  54. package/dist/{chunk-WJEKRSPH.js → chunk-UEU23PTW.js} +3 -3
  55. package/dist/{chunk-WJEKRSPH.js.map → chunk-UEU23PTW.js.map} +1 -1
  56. package/dist/chunk-ZVBPRMHJ.cjs +153 -0
  57. package/dist/chunk-ZVBPRMHJ.cjs.map +1 -0
  58. package/dist/connect/docx.cjs +10 -88
  59. package/dist/connect/docx.cjs.map +1 -1
  60. package/dist/connect/docx.js +6 -86
  61. package/dist/connect/docx.js.map +1 -1
  62. package/dist/connect/index.cjs +295 -32
  63. package/dist/connect/index.cjs.map +1 -1
  64. package/dist/connect/index.js +280 -17
  65. package/dist/connect/index.js.map +1 -1
  66. package/dist/connection/ConnectedWorkflowRunner.d.ts +16 -2
  67. package/dist/connection/WorkflowRunnerDialogs.d.ts +37 -0
  68. package/dist/connection/useWorkflowThread.d.ts +12 -0
  69. package/dist/document-tools/index.cjs +7 -143
  70. package/dist/document-tools/index.cjs.map +1 -1
  71. package/dist/document-tools/index.js +5 -144
  72. package/dist/document-tools/index.js.map +1 -1
  73. package/dist/docx/index.cjs +18 -17
  74. package/dist/docx/index.cjs.map +1 -1
  75. package/dist/docx/index.js +3 -2
  76. package/dist/docx/index.js.map +1 -1
  77. package/dist/facts/index.cjs +1 -1
  78. package/dist/facts/index.js +1 -1
  79. package/dist/files/index.cjs +1 -1
  80. package/dist/files/index.js +1 -1
  81. package/dist/home/index.cjs +1 -1
  82. package/dist/home/index.js +1 -1
  83. package/dist/index.cjs +631 -535
  84. package/dist/index.js +8 -8
  85. package/dist/settings/index.cjs +1 -1
  86. package/dist/settings/index.js +1 -1
  87. package/dist/shell/index.cjs +1 -1
  88. package/dist/shell/index.js +1 -1
  89. package/dist/studio/index.cjs +4 -4
  90. package/dist/studio/index.js +3 -3
  91. package/dist/workflow-canvas/SignalsEditor.d.ts +41 -0
  92. package/dist/workflow-canvas/StepActionSettings.d.ts +132 -0
  93. package/dist/workflow-canvas/StepInspector.d.ts +28 -2
  94. package/dist/workflow-canvas/TriggerInspector.d.ts +11 -2
  95. package/dist/workflow-canvas/WorkflowBuilder.d.ts +17 -4
  96. package/dist/workflow-canvas/WorkflowCanvas.d.ts +27 -2
  97. package/dist/workflow-canvas/edit.d.ts +9 -1
  98. package/dist/workflow-canvas/index.cjs +1282 -208
  99. package/dist/workflow-canvas/index.cjs.map +1 -1
  100. package/dist/workflow-canvas/index.d.ts +2 -1
  101. package/dist/workflow-canvas/index.js +1255 -188
  102. package/dist/workflow-canvas/index.js.map +1 -1
  103. package/dist/workflow-canvas/trigger.d.ts +20 -1
  104. package/package.json +4 -4
  105. package/src/workflow-canvas/canvas.css +9 -0
  106. package/dist/chunk-5EBGRG3X.js.map +0 -1
  107. package/dist/chunk-F4LUD3YC.cjs.map +0 -1
  108. package/dist/chunk-IPGKTUF7.cjs.map +0 -1
  109. package/dist/chunk-LT2UORRG.js.map +0 -1
  110. package/dist/chunk-P2RBE3FD.cjs.map +0 -1
  111. package/dist/chunk-UIWLDSTF.js.map +0 -1
  112. package/dist/chunk-YWYVIQ7T.js.map +0 -1
  113. package/dist/chunk-ZWA7UUZL.cjs.map +0 -1
@@ -6,7 +6,9 @@
6
6
  * `workflowFromFrontmatter`), so the backend can adopt it without a UI change. Blocks hold no
7
7
  * domain wording: titles, labels and prompt text are data supplied by the host.
8
8
  */
9
- export type WorkflowFieldType = 'text' | 'longtext' | 'boolean' | 'select' | 'number' | 'date' | 'scope' | 'documents';
9
+ export type WorkflowFieldType = 'text' | 'longtext' | 'boolean' | 'select' | 'number' | 'date' | 'scope' | 'documents'
10
+ /** A workspace member (`usr-…` / `agt-…`): what a step's assignee or a signer can name. */
11
+ | 'person';
10
12
  /**
11
13
  * What a launching surface can hand a workflow without asking the user: the files it is looking at
12
14
  * (`documents`), the text the user selected (`selection`), or the image on screen (`image`, a file
@@ -92,6 +94,31 @@ export type WorkflowRun =
92
94
  y: number;
93
95
  }>;
94
96
  };
97
+ /**
98
+ * When a step's signal is raised, tested against the step's outcome once it is done (a skipped or
99
+ * failed step never signals): a form field equals a value (case-insensitive text), the agent's
100
+ * answer contains a phrase or matches a regex, or a review is approved. Absent = whenever it is done.
101
+ */
102
+ export type WorkflowSignalWhen = {
103
+ field: string;
104
+ equals: string | number | boolean;
105
+ } | {
106
+ contains: string;
107
+ } | {
108
+ matches: string;
109
+ } | {
110
+ approved: true;
111
+ };
112
+ /**
113
+ * A named signal a step raises when it is done and its condition holds. Another workflow starts on
114
+ * it ("When a step signals") as its own thread linked to this one, so the if/then between
115
+ * workflows lives in the link and each workflow stays short.
116
+ */
117
+ export interface WorkflowSignal {
118
+ /** A slug (`[a-z0-9][a-z0-9_.-]*`), e.g. `risk-high`: what a linked workflow listens for. */
119
+ name: string;
120
+ when?: WorkflowSignalWhen;
121
+ }
95
122
  interface WorkflowStepBase {
96
123
  /** Unique within the workflow (`[a-z][a-z0-9_-]*`): the thread's progress is keyed by it. */
97
124
  id: string;
@@ -113,7 +140,76 @@ interface WorkflowStepBase {
113
140
  * sequence. `[]`: it starts with the run. A step waiting for several waits for them all.
114
141
  */
115
142
  after?: string[];
143
+ /** Signals the step raises when it is done and their condition holds. */
144
+ signals?: WorkflowSignal[];
145
+ /**
146
+ * Who the step is for (a person step, or a signature or email step): they are told when it is
147
+ * ready, and only they (or the run's owner) can do it. Absent: whoever is on the run.
148
+ */
149
+ assignee?: WorkflowAssignee;
150
+ /** A person step left this many hours is announced again (once). */
151
+ remindAfterHours?: number;
152
+ }
153
+ /**
154
+ * Who a step is for: a named member (`usr-…` / `agt-…`), whoever started the run, the person a
155
+ * form's `person` field names (`input`: its name), or the project's lead.
156
+ */
157
+ export type WorkflowAssignee = {
158
+ user: string;
159
+ } | {
160
+ runOwner: true;
161
+ } | {
162
+ input: string;
163
+ } | {
164
+ projectLead: true;
165
+ };
166
+ /**
167
+ * A document a step works on, named by where it comes from: what an earlier step produced or was
168
+ * given (an upload's files, an agent's draft, a signed copy, an edited version), what a run input
169
+ * names (a document pick), or one document by id (`doc-…`, optionally `@v<n>`).
170
+ */
171
+ export type WorkflowDocumentRef = {
172
+ step: string;
173
+ } | {
174
+ input: string;
175
+ } | {
176
+ id: string;
177
+ };
178
+ /** Ask people to e-sign a document. The step waits until every signer has signed. */
179
+ export interface WorkflowSignAction {
180
+ type: 'sign';
181
+ document?: WorkflowDocumentRef;
182
+ signers: WorkflowAssignee[];
183
+ /** Shown to the signers. */
184
+ message?: string;
185
+ /** Unsigned this long after it starts, the step fails. */
186
+ expiresAfterHours?: number;
187
+ }
188
+ /**
189
+ * Prepare an email in native mail, never sent by itself: its person sends it, and the step is done
190
+ * when they say so (or send it). Every text is a template over the run (`{{field}}`,
191
+ * `{{step.answer}}`).
192
+ */
193
+ export interface WorkflowEmailDraftAction {
194
+ type: 'email_draft';
195
+ to: string[];
196
+ cc?: string[];
197
+ subject: string;
198
+ body: string;
199
+ attachments?: WorkflowDocumentRef[];
200
+ }
201
+ /** Run review columns (labels with instructions) over documents, then open the grid. */
202
+ export interface WorkflowTabularReviewAction {
203
+ type: 'tabular_review';
204
+ /** Label (tag) ids: the columns. */
205
+ tags: string[];
206
+ /** Every file the run's uploads took, every document of the workspace, or these documents. */
207
+ documents: 'run_uploads' | 'workspace' | WorkflowDocumentRef[];
208
+ /** Fill cells that already have a value again. */
209
+ overwrite?: boolean;
116
210
  }
211
+ export type WorkflowAction = WorkflowSignAction | WorkflowEmailDraftAction | WorkflowTabularReviewAction;
212
+ export type WorkflowActionType = WorkflowAction['type'];
117
213
  /** Ask for inputs. Every step's fields share the run's one input namespace (`{{name}}`). */
118
214
  export interface WorkflowFormStep extends WorkflowStepBase {
119
215
  kind: 'form';
@@ -153,14 +249,29 @@ export interface WorkflowAgentStep extends WorkflowStepBase {
153
249
  output?: 'answer' | 'artifact';
154
250
  /** Runs off the thread's main line and delivers only its result to it. */
155
251
  branch?: boolean;
252
+ /**
253
+ * Edit this Word document with tracked changes (the instruction says what to change); the
254
+ * edited copy is its next version, to accept or reject change by change. Main line only.
255
+ */
256
+ editDocument?: WorkflowDocumentRef;
156
257
  }
157
258
  /** A person's review or approval: whoever completes it on the thread approves it. */
158
259
  export interface WorkflowReviewStep extends WorkflowStepBase {
159
260
  kind: 'review';
160
261
  /** What to review, a template over the run's inputs. */
161
262
  instructions?: string;
263
+ /** What the approver fills in when approving (e.g. a rating): they join the run's inputs. */
264
+ fields?: WorkflowField[];
162
265
  }
163
- export type WorkflowStep = WorkflowFormStep | WorkflowUploadStep | WorkflowAgentStep | WorkflowReviewStep;
266
+ /**
267
+ * A step that uses a platform feature rather than producing text: an e-signature, an email draft
268
+ * or a tabular review. It starts by itself; a signature and an email then wait for their people.
269
+ */
270
+ export interface WorkflowActionStep extends WorkflowStepBase {
271
+ kind: 'action';
272
+ action: WorkflowAction;
273
+ }
274
+ export type WorkflowStep = WorkflowFormStep | WorkflowUploadStep | WorkflowAgentStep | WorkflowReviewStep | WorkflowActionStep;
164
275
  /** The finish screen of a stepped run. */
165
276
  export interface WorkflowCompletion {
166
277
  title: string;
@@ -169,9 +280,33 @@ export interface WorkflowCompletion {
169
280
  }
170
281
  /**
171
282
  * Where a step of a run is, as the thread records it: not reached yet (`pending`), `running`,
172
- * `done`, `skipped`, or `failed` (it can be retried or skipped).
283
+ * `waiting` (an action step waiting on its signers or on its email being sent), `done`,
284
+ * `skipped`, or `failed` (it can be retried or skipped).
173
285
  */
174
- export type WorkflowStepStatus = 'pending' | 'running' | 'done' | 'skipped' | 'failed';
286
+ export type WorkflowStepStatus = 'pending' | 'running' | 'waiting' | 'done' | 'skipped' | 'failed';
287
+ /** What an action step waits on (ids only), as its latest event says. */
288
+ export interface WorkflowActionWaiting {
289
+ /** A signature: the document and version to sign, who signs, who has signed. */
290
+ doc_ext_id?: string;
291
+ version?: number;
292
+ signers?: string[];
293
+ signed?: string[];
294
+ expires_at?: string;
295
+ /** An email: the draft in native mail and whose mailbox it is in. */
296
+ draft_id?: string;
297
+ mailbox?: string;
298
+ [key: string]: unknown;
299
+ }
300
+ /** What a review recorded it approved: each step it waited for, as it stood then. */
301
+ export interface WorkflowApprovalEvidence {
302
+ step: string;
303
+ status: string;
304
+ /** That step's answer (a message in the thread). */
305
+ response_id?: string;
306
+ /** The document versions it had (`doc-…@v<n>`). */
307
+ documents?: string[];
308
+ output?: Record<string, unknown>;
309
+ }
175
310
  export interface WorkflowStepState {
176
311
  status: WorkflowStepStatus;
177
312
  /** The step's answer in the thread (an agent step), or the result a branch delivered. */
@@ -181,6 +316,27 @@ export interface WorkflowStepState {
181
316
  error?: string | null;
182
317
  /** When it started running (ISO), for the elapsed time while it runs. */
183
318
  startedAt?: string;
319
+ /** An action step's type, once it has started. */
320
+ action?: WorkflowActionType;
321
+ /** What a `waiting` action step waits on. */
322
+ waiting?: WorkflowActionWaiting;
323
+ /** What a done action step produced (ids: the signed version, the draft, the reviewed labels). */
324
+ output?: Record<string, unknown>;
325
+ /** The document versions the step produced or was given (`doc-…@v<n>`). */
326
+ documents?: string[];
327
+ /** Reopened by a send-back to this step and not touched since (`hasNote`: with a note). */
328
+ sentBack?: boolean;
329
+ hasNote?: boolean;
330
+ /** Who was told the step is ready (`usr-…` / `agt-…`), since it last changed. */
331
+ announcedTo?: string | null;
332
+ /** Who finished it (completed, approved, skipped, declined). */
333
+ by?: string | null;
334
+ /** When it finished (ISO). */
335
+ at?: string;
336
+ /** A review: what it approved. */
337
+ approved?: WorkflowApprovalEvidence[];
338
+ /** A declined signature: who declined. */
339
+ declinedBy?: string;
184
340
  }
185
341
  export interface WorkflowDefinition {
186
342
  /** Execute a document operation directly, without creating a chat. */
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * A stepped workflow run on screen only (the builder's preview): agent steps run one at a time,
3
- * the way the server does, and answer with the prompt they would send. No thread, no agent.
3
+ * the way the server does, and answer with the prompt they would send; action steps just finish.
4
+ * No thread, no agent.
4
5
  */
5
6
  import { type StepComposeOptions } from './run';
6
7
  import type { WorkflowDefinition } from './types';
@@ -20,6 +20,17 @@ export interface UseWorkflowViewOptions {
20
20
  retry?: (stepId: string) => Promise<void>;
21
21
  /** A form step whose inputs can no longer change (committed, or recorded on the thread). */
22
22
  isLocked?: (stepId: string) => boolean;
23
+ /**
24
+ * Whether `states` are known yet (a run opened later: its thread's log has arrived). Until then
25
+ * the view waits to open the run where it is, instead of at its first step. Default true.
26
+ */
27
+ loaded?: boolean;
28
+ /** Send the work back from a ready step to an earlier one, with a note. */
29
+ sendBack?: (stepId: string, to: string, note?: string) => Promise<void>;
30
+ /** A signer refuses a signature step, with a note. */
31
+ decline?: (stepId: string, note?: string) => Promise<void>;
32
+ /** A member's name by id (`usr-…` / `agt-…`): assignees and signers are shown by name. */
33
+ nameOf?: (id: string) => string | undefined;
23
34
  }
24
35
  /** What `WorkflowRunner` shows and does. */
25
36
  export interface WorkflowRunView {
@@ -48,6 +59,14 @@ export interface WorkflowRunView {
48
59
  goTo: (stepId: string) => void;
49
60
  skip: (stepId: string) => Promise<void>;
50
61
  retry?: (stepId: string) => Promise<void>;
62
+ /** Send the work back from `stepId` to `to` (it is then in view). Absent = not offered. */
63
+ sendBack?: (stepId: string, to: string, note?: string) => Promise<void>;
64
+ /** Decline a signature step. Absent = not offered. */
65
+ decline?: (stepId: string, note?: string) => Promise<void>;
66
+ /** A member's name by id. */
67
+ nameOf?: (id: string) => string | undefined;
68
+ /** Who a step is for, in words (a person step, a signature, an email), if anyone. */
69
+ assigneeOf: (stepId: string) => string | undefined;
51
70
  /** Show the run from the start again (a host that starts a new run resets its own state). */
52
71
  restart: () => void;
53
72
  }
@@ -16,4 +16,4 @@ import { type ChatPageProps } from './chat-page-types';
16
16
  * With `surface="page"` it claims the page-chat slot, so `useChatSurface()` tells the host's dock
17
17
  * to yield: one chat on screen, never two.
18
18
  */
19
- export declare function ChatPage({ chat, surface, header, headerActions, aside, prompts, documentsRequired, emptyTitle, emptyDescription, identity, renderContent, onOpenCitation, targetMessageId, asideBreakpoint, fillHeight, minHeight, compactHeader, accept, labels, className, testIds, }: ChatPageProps): import("react").JSX.Element;
19
+ export declare function ChatPage({ chat, surface, header, headerActions, aside, prompts, documentsRequired, emptyTitle, emptyDescription, identity, renderContent, onOpenCitation, workflowStepTitle, targetMessageId, asideBreakpoint, fillHeight, minHeight, compactHeader, accept, labels, className, testIds, }: ChatPageProps): import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * A message the server sent to start a workflow's step, shown as that step: a compact chip
3
+ * ("Workflow step · Draft the letter") that expands to the full instruction. Any chat that knows a
4
+ * message's step (its `tools.workflow_step`) renders this instead of the raw instruction.
5
+ */
6
+ export interface WorkflowStepChipLabels {
7
+ /** `{title}` is the step's title (its id when the title is not known). */
8
+ chip: string;
9
+ show: string;
10
+ hide: string;
11
+ }
12
+ export declare const DEFAULT_WORKFLOW_STEP_CHIP_LABELS: WorkflowStepChipLabels;
13
+ export interface WorkflowStepChipProps {
14
+ /** The step's id. */
15
+ step: string;
16
+ /** The step's title, when the host knows it (from the run's plan). */
17
+ title?: string;
18
+ /** The instruction the step sent. */
19
+ content: string;
20
+ labels?: Partial<WorkflowStepChipLabels>;
21
+ className?: string;
22
+ testId?: string;
23
+ }
24
+ export declare function WorkflowStepChip({ step, title, content, labels, className, testId, }: WorkflowStepChipProps): import("react").JSX.Element;
@@ -47,6 +47,8 @@ export interface ChatPageMessage {
47
47
  citations?: ReadonlyArray<ChatPageCitation>;
48
48
  /** The reader stopped the answer; `content` is what had streamed. */
49
49
  stopped?: boolean;
50
+ /** A user message that started a workflow step (its id): shown as that step's chip. */
51
+ workflowStep?: string;
50
52
  }
51
53
  export interface ChatPageThread {
52
54
  id: string;
@@ -175,6 +177,8 @@ export interface ChatPageProps {
175
177
  * shows the source and passage and offers no open action.
176
178
  */
177
179
  onOpenCitation?: (target: ChatCitationTarget) => void;
180
+ /** A workflow step's title by id: a message that started a step shows it (else the id). */
181
+ workflowStepTitle?: (stepId: string) => string | undefined;
178
182
  /**
179
183
  * Container width, in rem, from which `aside` is a column beside the chat; narrower, it is a
180
184
  * button-toggled panel over the transcript. Default 60.