@arbidocs/blocks 0.4.72 → 0.4.73

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 (89) hide show
  1. package/dist/agents/index.cjs +400 -261
  2. package/dist/agents/index.js +6 -3
  3. package/dist/agents/tasks/TaskActivityTimeline.d.ts +1 -1
  4. package/dist/agents/tasks/WorkflowThreadStrip.d.ts +58 -0
  5. package/dist/agents/tasks/index.d.ts +1 -0
  6. package/dist/agents/workflows/WorkflowRunner.d.ts +70 -0
  7. package/dist/agents/workflows/index.d.ts +7 -1
  8. package/dist/agents/workflows/planSteps.d.ts +28 -0
  9. package/dist/agents/workflows/run.d.ts +97 -0
  10. package/dist/agents/workflows/skillMarkdown.d.ts +15 -0
  11. package/dist/agents/workflows/types.d.ts +109 -0
  12. package/dist/agents/workflows/useWorkflowPreview.d.ts +14 -0
  13. package/dist/agents/workflows/useWorkflowView.d.ts +54 -0
  14. package/dist/agents/workflows/workflow.d.ts +3 -1
  15. package/dist/chunk-2P3T23C7.js +1250 -0
  16. package/dist/chunk-2P3T23C7.js.map +1 -0
  17. package/dist/chunk-7D737FLE.cjs +43 -0
  18. package/dist/chunk-7D737FLE.cjs.map +1 -0
  19. package/dist/{chunk-LFGJAZ5H.js → chunk-DDF5GPIJ.js} +6 -36
  20. package/dist/chunk-DDF5GPIJ.js.map +1 -0
  21. package/dist/chunk-DETZZBG2.cjs +91 -0
  22. package/dist/chunk-DETZZBG2.cjs.map +1 -0
  23. package/dist/chunk-EVUEIBNU.js +89 -0
  24. package/dist/chunk-EVUEIBNU.js.map +1 -0
  25. package/dist/chunk-GTNUQBXI.cjs +1296 -0
  26. package/dist/chunk-GTNUQBXI.cjs.map +1 -0
  27. package/dist/{chunk-DH7C2UJO.cjs → chunk-IUR565UW.cjs} +297 -524
  28. package/dist/chunk-IUR565UW.cjs.map +1 -0
  29. package/dist/{chunk-THO7DZNN.cjs → chunk-MUMH3Z6K.cjs} +20 -15
  30. package/dist/chunk-MUMH3Z6K.cjs.map +1 -0
  31. package/dist/{chunk-KOXUBCLL.js → chunk-ORA2XE7U.js} +3 -3
  32. package/dist/{chunk-KOXUBCLL.js.map → chunk-ORA2XE7U.js.map} +1 -1
  33. package/dist/{chunk-5HOAOKZL.js → chunk-OYMWV45N.js} +21 -16
  34. package/dist/chunk-OYMWV45N.js.map +1 -0
  35. package/dist/{chunk-IMC2Z32C.js → chunk-QDNXEB3T.js} +268 -484
  36. package/dist/chunk-QDNXEB3T.js.map +1 -0
  37. package/dist/{chunk-G5QTGKDJ.cjs → chunk-WOYUXVVQ.cjs} +6 -6
  38. package/dist/{chunk-G5QTGKDJ.cjs.map → chunk-WOYUXVVQ.cjs.map} +1 -1
  39. package/dist/chunk-XD2M6LIG.js +41 -0
  40. package/dist/chunk-XD2M6LIG.js.map +1 -0
  41. package/dist/{chunk-WBDK4PIA.cjs → chunk-Z5VUZ6YD.cjs} +6 -37
  42. package/dist/chunk-Z5VUZ6YD.cjs.map +1 -0
  43. package/dist/connect/docx.cjs +2 -2
  44. package/dist/connect/docx.js +1 -1
  45. package/dist/connect/index.cjs +316 -23
  46. package/dist/connect/index.cjs.map +1 -1
  47. package/dist/connect/index.d.ts +1 -0
  48. package/dist/connect/index.js +300 -8
  49. package/dist/connect/index.js.map +1 -1
  50. package/dist/connection/ConnectedWorkflowBuilder.d.ts +44 -0
  51. package/dist/connection/ConnectedWorkflowRunner.d.ts +27 -0
  52. package/dist/connection/useWorkflowThread.d.ts +34 -0
  53. package/dist/facts/index.cjs +1 -1
  54. package/dist/facts/index.js +1 -1
  55. package/dist/files/index.cjs +9 -83
  56. package/dist/files/index.cjs.map +1 -1
  57. package/dist/files/index.js +6 -83
  58. package/dist/files/index.js.map +1 -1
  59. package/dist/home/index.cjs +22 -21
  60. package/dist/home/index.cjs.map +1 -1
  61. package/dist/home/index.js +4 -3
  62. package/dist/home/index.js.map +1 -1
  63. package/dist/index.cjs +450 -311
  64. package/dist/index.cjs.map +1 -1
  65. package/dist/index.js +7 -4
  66. package/dist/index.js.map +1 -1
  67. package/dist/shell/index.cjs +1 -1
  68. package/dist/shell/index.js +1 -1
  69. package/dist/studio/index.cjs +5 -5
  70. package/dist/studio/index.js +3 -3
  71. package/dist/workflow-canvas/StepInspector.d.ts +46 -0
  72. package/dist/workflow-canvas/TriggerInspector.d.ts +46 -0
  73. package/dist/workflow-canvas/WorkflowBuilder.d.ts +55 -0
  74. package/dist/workflow-canvas/WorkflowCanvas.d.ts +65 -0
  75. package/dist/workflow-canvas/edit.d.ts +54 -0
  76. package/dist/workflow-canvas/index.cjs +1609 -0
  77. package/dist/workflow-canvas/index.cjs.map +1 -0
  78. package/dist/workflow-canvas/index.d.ts +13 -0
  79. package/dist/workflow-canvas/index.js +1579 -0
  80. package/dist/workflow-canvas/index.js.map +1 -0
  81. package/dist/workflow-canvas/trigger.d.ts +51 -0
  82. package/package.json +25 -14
  83. package/src/workflow-canvas/canvas.css +113 -0
  84. package/dist/chunk-5HOAOKZL.js.map +0 -1
  85. package/dist/chunk-DH7C2UJO.cjs.map +0 -1
  86. package/dist/chunk-IMC2Z32C.js.map +0 -1
  87. package/dist/chunk-LFGJAZ5H.js.map +0 -1
  88. package/dist/chunk-THO7DZNN.cjs.map +0 -1
  89. package/dist/chunk-WBDK4PIA.cjs.map +0 -1
@@ -1,19 +1,22 @@
1
1
  "use client";
2
- export { AgentAvatarField, AgentBar, AgentBarIconButton, AgentBarMenu, AgentBarNotes, AgentBarProbeAnswer, AgentBarQueuedNote, AgentBarStatus, AgentCard, AgentCreateView, AgentCreatedView, AgentCreator, AgentEditView, AgentGallery, AgentMainView, AgentSelect, AgentTypeSelector, CapabilityGrid, CapabilityTile, ConfigField, ConfigForm, ConsentActions, ConsentBulletList, ConsentCard, ConsentFootnote, ConsentHeader, ConsentMessage, ConsentNotice, ConsentPage, ConsentPermissionList, ConsentSection, ConsentStrong, ConsentText, ConversationListView, ConversationTurnSpeaker, CopyableUrl, DEFAULT_AGENT_AVATAR_FIELD_LABELS, DEFAULT_AGENT_BAR_LABELS, DEFAULT_AGENT_CARD_LABELS, DEFAULT_AGENT_CREATOR_LABELS, DEFAULT_AGENT_GALLERY_LABELS, DEFAULT_AGENT_SELECT_LABELS, DEFAULT_AGENT_STEPS_LABELS, DEFAULT_AGENT_TYPE_SELECTOR_LABELS, DEFAULT_AUTHORIZE_AGENT_LABELS, DEFAULT_CONFIG_FIELD_LABELS, DEFAULT_CONFIG_FORM_LABELS, DEFAULT_CONSENT_ACTIONS_LABELS, DEFAULT_COPYABLE_URL_LABELS, DEFAULT_NEW_THREAD_DIALOG_LABELS, DEFAULT_PILL_SELECT_LABELS, DEFAULT_RECURRENCE, DEFAULT_RECURRENCE_BUILDER_LABELS, DEFAULT_SCHEMA_FORM_LABELS, DEFAULT_SKILL_CARD_LABELS, DEFAULT_SKILL_EDIT_FORM_LABELS, DEFAULT_SKILL_GENERATE_FORM_LABELS, DEFAULT_SKILL_GLOBAL_BADGE_LABELS, DEFAULT_SKILL_ROW_LABELS, DEFAULT_SKILL_VIEW_TOGGLE_LABELS, DEFAULT_SUBAGENT_ROSTER_LABELS, DEFAULT_TASKS_CHROME_LABELS, DEFAULT_TASK_ACTIVITY_LABELS, DEFAULT_TASK_COMPOSER_LABELS, DEFAULT_TASK_LIST_LABELS, DEFAULT_TASK_OUTPUTS_CELL_LABELS, DEFAULT_TASK_PLAN_LABELS, DEFAULT_TASK_RUNS_DIALOG_LABELS, DEFAULT_TASK_STATUS_PILL_LABELS, DEFAULT_TASK_THREAD_CHIP_LABELS, DEFAULT_TASK_TRIGGER_CHIP_LABELS, DEFAULT_TUPLE_ARRAY_FIELD_LABELS, DEFAULT_UPLOAD_TASK_ITEM_LABELS, DEFAULT_UPLOAD_TASK_LIST_LABELS, DEFAULT_WORKFLOWS_CHROME_LABELS, DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS, DEFAULT_WORKFLOW_LIST_LABELS, DERIVED_NAME_WORDS, EMPTY_NEW_THREAD, EMPTY_WORKFLOW_SCOPE, GoalCriteria, MAX_TASK_DEPTH, NewThreadDialog, PersonPill, PillSelect, RecurrenceBuilder, SKILL_PROMPT_FALLBACK_PLACEHOLDER, SKILL_PROMPT_LABEL, STATUS_LABELS, STATUS_ORDER, STATUS_TONE, SchemaForm, SkillActionButton, SkillCard, SkillDetail, SkillDetailSection, SkillEditForm, SkillFilterChips, SkillGenerateForm, SkillGlobalBadge, SkillRow, SkillTile, SkillTypeBadge, SkillViewToggle, StepDetail, StepNarration, StepOutcome, StepParams, StepRow, StepSummary, StepTrace, StepTraceSummary, SubAgentLane, SubStepGroup, SubagentRoster, TASK_COLUMN_ORDER, TRIGGER_LABELS, TaskActivityDialog, TaskActivityTimeline, TaskComposer, TaskFlow, TaskInbox, TaskMoveDialog, TaskOutputsCell, TaskPlan, TaskRunsDialog, TaskStartDialog, TaskStatusPill, TaskTable, TaskThreadChip, TaskTriggerChip, TasksToolbar, ThreadActivity, ThreadNotifyDialog, TupleArrayField, UploadTaskItem, UploadTaskList, WEEKDAYS, WORKFLOW_COLUMN_ORDER, WorkflowConfigDialog, WorkflowDocumentsField, WorkflowLauncher, WorkflowsTable, WorkflowsToolbar, agentConfigSectionToValues, agentCreatorToConfigSection, asTaskStatus, authModeFor, buildLaunch, buildRRule, buildTaskRows, buildWorkflowScopeSource, compactThreadActivity, composePersona, composeWorkflowPrompt, composerToTaskQuery, composerToWorkRequest, composerToWorkflowRequest, composerToWorkflowUpdate, createTaskColumns, createWorkflowColumns, createsWork, defaultInputs, defaultScopeRenderer, defaultTaskComposerValues, deriveAgentName, deriveWorkflowName, descendantIds, describeRRule, filterConversationRows, firstWords, formatElapsed, goalProgress, hasTaskFields, hasTrigger, humanizeSection, indexTasks, inferType, inputDocumentIds, inputsFromContext, isAgenticWorkflow, isEmptyWorkflowScope, isOutOfBounds, isPlainTodo, isSkillRow, isValidAgentName, isWorkflowScope, isoToLocalInput, localInputToIso, matchWorkflowScope, moveTargets, newThreadToRequest, nextCriterionId, ownerExtId, parseRRule, prettifyKey, promptFieldName, resolveScopeInputs, skillToWorkflow, stripPersonaPreamble, summarizeAgent, summarizeCapabilities, taskComposerToCreateRequest, taskComposerToUpdateRequest, taskNeedsAccess, taskToComposerValues, validateInputs, workflowAccepts, workflowFromFrontmatter, workflowStatus, workflowTaskFields, workflowToComposerValues, workflowTriggerType, workflowWhen, workflowsAccepting, workflowsForHost } from '../chunk-IMC2Z32C.js';
2
+ export { AgentAvatarField, AgentBar, AgentBarIconButton, AgentBarMenu, AgentBarNotes, AgentBarProbeAnswer, AgentBarQueuedNote, AgentBarStatus, AgentCard, AgentCreateView, AgentCreatedView, AgentCreator, AgentEditView, AgentGallery, AgentMainView, AgentSelect, AgentTypeSelector, CapabilityGrid, CapabilityTile, ConfigField, ConfigForm, ConsentActions, ConsentBulletList, ConsentCard, ConsentFootnote, ConsentHeader, ConsentMessage, ConsentNotice, ConsentPage, ConsentPermissionList, ConsentSection, ConsentStrong, ConsentText, ConversationListView, ConversationTurnSpeaker, CopyableUrl, DEFAULT_AGENT_AVATAR_FIELD_LABELS, DEFAULT_AGENT_BAR_LABELS, DEFAULT_AGENT_CARD_LABELS, DEFAULT_AGENT_CREATOR_LABELS, DEFAULT_AGENT_GALLERY_LABELS, DEFAULT_AGENT_SELECT_LABELS, DEFAULT_AGENT_STEPS_LABELS, DEFAULT_AGENT_TYPE_SELECTOR_LABELS, DEFAULT_AUTHORIZE_AGENT_LABELS, DEFAULT_CONFIG_FIELD_LABELS, DEFAULT_CONFIG_FORM_LABELS, DEFAULT_CONSENT_ACTIONS_LABELS, DEFAULT_COPYABLE_URL_LABELS, DEFAULT_NEW_THREAD_DIALOG_LABELS, DEFAULT_PILL_SELECT_LABELS, DEFAULT_RECURRENCE, DEFAULT_RECURRENCE_BUILDER_LABELS, DEFAULT_SKILL_CARD_LABELS, DEFAULT_SKILL_EDIT_FORM_LABELS, DEFAULT_SKILL_GENERATE_FORM_LABELS, DEFAULT_SKILL_GLOBAL_BADGE_LABELS, DEFAULT_SKILL_ROW_LABELS, DEFAULT_SKILL_VIEW_TOGGLE_LABELS, DEFAULT_SUBAGENT_ROSTER_LABELS, DEFAULT_TASKS_CHROME_LABELS, DEFAULT_TASK_ACTIVITY_LABELS, DEFAULT_TASK_COMPOSER_LABELS, DEFAULT_TASK_LIST_LABELS, DEFAULT_TASK_OUTPUTS_CELL_LABELS, DEFAULT_TASK_PLAN_LABELS, DEFAULT_TASK_RUNS_DIALOG_LABELS, DEFAULT_TASK_STATUS_PILL_LABELS, DEFAULT_TASK_THREAD_CHIP_LABELS, DEFAULT_TASK_TRIGGER_CHIP_LABELS, DEFAULT_TUPLE_ARRAY_FIELD_LABELS, DEFAULT_UPLOAD_TASK_ITEM_LABELS, DEFAULT_UPLOAD_TASK_LIST_LABELS, DEFAULT_WORKFLOWS_CHROME_LABELS, DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS, DEFAULT_WORKFLOW_LIST_LABELS, DEFAULT_WORKFLOW_THREAD_STRIP_LABELS, DERIVED_NAME_WORDS, EMPTY_NEW_THREAD, GoalCriteria, MAX_TASK_DEPTH, NewThreadDialog, PersonPill, PillSelect, RecurrenceBuilder, STATUS_LABELS, STATUS_ORDER, STATUS_TONE, SkillActionButton, SkillCard, SkillDetail, SkillDetailSection, SkillEditForm, SkillFilterChips, SkillGenerateForm, SkillGlobalBadge, SkillRow, SkillTile, SkillTypeBadge, SkillViewToggle, StepDetail, StepNarration, StepOutcome, StepParams, StepRow, StepSummary, StepTrace, StepTraceSummary, SubAgentLane, SubStepGroup, SubagentRoster, TASK_COLUMN_ORDER, TRIGGER_LABELS, TaskActivityDialog, TaskActivityTimeline, TaskComposer, TaskFlow, TaskInbox, TaskMoveDialog, TaskOutputsCell, TaskPlan, TaskRunsDialog, TaskStartDialog, TaskStatusPill, TaskTable, TaskThreadChip, TaskTriggerChip, TasksToolbar, ThreadActivity, ThreadNotifyDialog, TupleArrayField, UploadTaskItem, UploadTaskList, WEEKDAYS, WORKFLOW_COLUMN_ORDER, WorkflowConfigDialog, WorkflowDocumentsField, WorkflowLauncher, WorkflowThreadStrip, WorkflowsTable, WorkflowsToolbar, agentConfigSectionToValues, agentCreatorToConfigSection, asTaskStatus, authModeFor, buildRRule, buildTaskRows, buildWorkflowScopeSource, compactThreadActivity, composePersona, composerToTaskQuery, composerToWorkRequest, composerToWorkflowRequest, composerToWorkflowUpdate, createTaskColumns, createWorkflowColumns, createsWork, defaultScopeRenderer, defaultTaskComposerValues, deriveAgentName, deriveWorkflowName, descendantIds, describeRRule, filterConversationRows, firstWords, formatElapsed, goalProgress, groupThreadActivity, hasTaskFields, hasTrigger, humanizeSection, indexTasks, inferType, inputDocumentIds, isAgenticWorkflow, isOutOfBounds, isPlainTodo, isSkillRow, isValidAgentName, isoToLocalInput, localInputToIso, matchWorkflowScope, moveTargets, newThreadToRequest, nextCriterionId, ownerExtId, parseRRule, prettifyKey, resolveScopeInputs, skillSlug, stripPersonaPreamble, summarizeAgent, summarizeCapabilities, taskComposerToCreateRequest, taskComposerToUpdateRequest, taskNeedsAccess, taskToComposerValues, useWorkflowPreview, workflowFromSkillMarkdown, workflowStatus, workflowTaskFields, workflowToComposerValues, workflowToSkillMarkdown, workflowTriggerType, workflowWhen } from '../chunk-QDNXEB3T.js';
3
3
  import '../chunk-CKB64Z4R.js';
4
4
  import '../chunk-P6GHJSLR.js';
5
+ export { DEFAULT_SCHEMA_FORM_LABELS, DEFAULT_WORKFLOW_RUNNER_LABELS, EMPTY_WORKFLOW_SCOPE, SKILL_PROMPT_FALLBACK_PLACEHOLDER, SKILL_PROMPT_LABEL, SchemaForm, WorkflowRunner, buildLaunch, composeStepPrompt, composeWorkflowPrompt, defaultInputs, dependsOn, fieldToFrontmatter, fillRunText, fillStepInputs, fromPlanSteps, initialRunInputs, inputsFromContext, isEmptyWorkflowScope, isPersonStep, isRunFinished, isSteppedWorkflow, isWorkflowScope, layoutFromPlanSteps, nextAction, orderSteps, promptFieldName, reviewInstructions, runFields, runThreadTitle, skillToWorkflow, stepDependencies, stepLevels, stepPhase, stepStatesFromActivity, toPlanSteps, useWorkflowView, validateInputs, validateStep, validateWorkflowGraph, workflowAccepts, workflowFromFrontmatter, workflowSteps, workflowsAccepting, workflowsForHost } from '../chunk-2P3T23C7.js';
5
6
  import '../chunk-4WWM3GQ5.js';
6
7
  import '../chunk-RFXJYIDV.js';
7
8
  import '../chunk-DPLRHEJZ.js';
9
+ import '../chunk-EVUEIBNU.js';
8
10
  import '../chunk-BUHKUKKB.js';
9
11
  import '../chunk-YU2KUMGE.js';
10
- import '../chunk-LFGJAZ5H.js';
12
+ import '../chunk-DDF5GPIJ.js';
13
+ import '../chunk-XD2M6LIG.js';
11
14
  import '../chunk-S7PSMMRG.js';
12
- import '../chunk-76JDDMSP.js';
13
15
  import '../chunk-3VQYJBOI.js';
14
16
  import '../chunk-AA3PT6KR.js';
15
17
  import '../chunk-SLSBJRWW.js';
16
18
  import '../chunk-NPLYHR2E.js';
19
+ import '../chunk-76JDDMSP.js';
17
20
  import '../chunk-OXF2IFXG.js';
18
21
  import '../chunk-TX2ZICS7.js';
19
22
  import '../chunk-7F6CBP3Z.js';
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
- export type TaskActivityKind = 'created' | 'run_started' | 'awaiting_access' | 'access_granted' | 'done' | 'reopened' | 'failed' | 'participant_joined' | 'assistant_responded' | 'assistant_stopped' | 'artifact_created' | 'artifact_edited' | 'document_added' | 'document_removed' | 'notified';
2
+ export type TaskActivityKind = 'created' | 'run_started' | 'awaiting_access' | 'access_granted' | 'done' | 'reopened' | 'failed' | 'participant_joined' | 'assistant_responded' | 'assistant_stopped' | 'artifact_created' | 'artifact_edited' | 'document_added' | 'document_removed' | 'notified' | 'step_started' | 'step_done' | 'step_skipped' | 'step_failed';
3
3
  /** One event of a task's history, as the backend returns it (oldest first). */
4
4
  export interface TaskActivityEvent {
5
5
  external_id: string;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * The top bar of a thread that runs a workflow: the workflow's named steps (done, under way, still
3
+ * to come), with everything that actually happened in the thread attached to the step it happened
4
+ * during — the assistant's turns, a draft sent back, people's messages and edits, notifications.
5
+ * What happened before the first step or after the last stays as ordinary entries at either end.
6
+ * A thread without a workflow shows `TaskFlow` instead.
7
+ */
8
+ import type { ReactNode } from 'react';
9
+ import { type WorkflowStepPhase } from '../workflows/run';
10
+ import type { WorkflowStep, WorkflowStepState } from '../workflows/types';
11
+ import type { TaskFlowItem } from './TaskFlow';
12
+ /** An activity entry, with what the strip needs to place it. */
13
+ export interface WorkflowThreadItem extends TaskFlowItem {
14
+ /** The activity kind (`step_started`, `assistant_responded`, …). */
15
+ kind?: string;
16
+ /** For a step event: the step it is about. */
17
+ step?: string;
18
+ }
19
+ export interface GroupedThreadActivity<T> {
20
+ before: T[];
21
+ byStep: Record<string, T[]>;
22
+ after: T[];
23
+ }
24
+ /**
25
+ * Place each activity entry (oldest first): an entry belongs to the step whose event came last
26
+ * before it — or, once that step has finished, to the step the run now waits on (the first one not
27
+ * finished). Entries before any step event come before the steps, and entries once every step has
28
+ * finished come after them. Step events themselves are the steps' own status, not entries.
29
+ */
30
+ export declare function groupThreadActivity<T extends {
31
+ kind?: string;
32
+ step?: string;
33
+ }>(steps: WorkflowStep[], items: readonly T[]): GroupedThreadActivity<T>;
34
+ export interface WorkflowThreadStripLabels {
35
+ /** The popover heading of a step's entries; `{count}` is replaced. */
36
+ happened: string;
37
+ nothingYet: string;
38
+ skip: string;
39
+ }
40
+ export declare const DEFAULT_WORKFLOW_THREAD_STRIP_LABELS: WorkflowThreadStripLabels;
41
+ export interface WorkflowThreadStripProps {
42
+ steps: WorkflowStep[];
43
+ /** Each step's state (from `stepStatesFromActivity`). */
44
+ states: Record<string, WorkflowStepState>;
45
+ /** The thread's activity, oldest first, as `TaskFlow` items with their kind (and step). */
46
+ items: readonly WorkflowThreadItem[];
47
+ renderIcon?: (key: string) => ReactNode;
48
+ /**
49
+ * Skip a step (any unfinished one that is not running: the plan guides the thread, it does not
50
+ * hold it). Absent = no skipping here.
51
+ */
52
+ onSkip?: (stepId: string) => void;
53
+ /** The host's action for a person's step (fill in the form, approve…), shown in its popover. */
54
+ renderStepAction?: (step: WorkflowStep, phase: WorkflowStepPhase) => ReactNode;
55
+ labels?: Partial<WorkflowThreadStripLabels>;
56
+ className?: string;
57
+ }
58
+ export declare function WorkflowThreadStrip({ steps, states, items, renderIcon, onSkip, renderStepAction, labels, className, }: WorkflowThreadStripProps): import("react").JSX.Element;
@@ -23,6 +23,7 @@ export { TaskStatusPill, DEFAULT_TASK_STATUS_PILL_LABELS, type TaskStatusPillPro
23
23
  export { TaskActivityTimeline, DEFAULT_TASK_ACTIVITY_LABELS, type TaskActivityEvent, type TaskActivityKind, type TaskActivityLabels, type TaskActivityTimelineProps, } from './TaskActivityTimeline';
24
24
  export { TaskActivityDialog, type TaskActivityDialogProps } from './TaskActivityDialog';
25
25
  export { TaskFlow, ThreadActivity, type TaskFlowItem } from './TaskFlow';
26
+ export { WorkflowThreadStrip, groupThreadActivity, DEFAULT_WORKFLOW_THREAD_STRIP_LABELS, type WorkflowThreadItem, type WorkflowThreadStripProps, type WorkflowThreadStripLabels, type GroupedThreadActivity, } from './WorkflowThreadStrip';
26
27
  export { compactThreadActivity, type CompactThreadActivity } from './compact-thread-activity';
27
28
  export { TaskOutputsCell, DEFAULT_TASK_OUTPUTS_CELL_LABELS, type TaskOutput, type TaskOutputsCellProps, type TaskOutputsCellLabels, } from './TaskOutputsCell';
28
29
  export { TaskThreadChip, DEFAULT_TASK_THREAD_CHIP_LABELS, type TaskThreadChipProps, type TaskThreadChipLabels, } from './TaskThreadChip';
@@ -0,0 +1,70 @@
1
+ /**
2
+ * A stepped workflow run, end to end: the stepper, the step in view (a form, an upload, an agent
3
+ * step or a review) and moving on. The stepper lays the graph out by depth: a sequence is one row,
4
+ * steps side by side stack in a column. The run comes from `useWorkflowThread` (a thread on the
5
+ * server) or `useWorkflowPreview`; wording and the agent output's rendering come from the host.
6
+ */
7
+ import type { ReactNode } from 'react';
8
+ import { type SchemaFormProps } from './SchemaForm';
9
+ import type { WorkflowRunView } from './useWorkflowView';
10
+ import type { WorkflowAgentStep, WorkflowDefinition, WorkflowReviewStep, WorkflowStep, WorkflowStepState, WorkflowUploadStep } from './types';
11
+ export interface WorkflowRunnerLabels {
12
+ back: string;
13
+ next: string;
14
+ skip: string;
15
+ /** Skips the step in view (any unfinished step: the plan guides the thread, it does not hold it). */
16
+ skipStep: string;
17
+ finish: string;
18
+ approve: string;
19
+ working: string;
20
+ /** An agent step about to start (the run will pick it up). */
21
+ starting: string;
22
+ retry: string;
23
+ failed: string;
24
+ /** A step whose dependencies have not finished; `{steps}` is replaced with their titles. */
25
+ blocked: string;
26
+ awaitingReview: string;
27
+ approved: string;
28
+ skipped: string;
29
+ /** An agent step that runs off the main line and delivers its result to it. */
30
+ branch: string;
31
+ /** The default finish heading (the workflow's `completion.title` wins). */
32
+ complete: string;
33
+ restart: string;
34
+ /** The upload step's file list heading; `{count}` is replaced. */
35
+ filesHeading: string;
36
+ noFiles: string;
37
+ }
38
+ export declare const DEFAULT_WORKFLOW_RUNNER_LABELS: WorkflowRunnerLabels;
39
+ /** A file the upload step lists (what is already in the run's workspace). */
40
+ export interface WorkflowRunnerFile {
41
+ id: string;
42
+ name: string;
43
+ }
44
+ export interface WorkflowRunnerProps extends Pick<SchemaFormProps, 'renderScope' | 'renderDocuments' | 'renderIcon'> {
45
+ workflow: WorkflowDefinition;
46
+ run: WorkflowRunView;
47
+ /** An agent step's output (its answer, a drafted document). */
48
+ renderAgentOutput: (step: WorkflowAgentStep, state: WorkflowStepState | undefined) => ReactNode;
49
+ /** A review's extras while it waits (e.g. who to ask). */
50
+ renderReview?: (step: WorkflowReviewStep) => ReactNode;
51
+ /** Upload step: the host performs the upload into the run's workspace. */
52
+ onUpload?: (files: File[]) => void | Promise<void>;
53
+ uploading?: boolean;
54
+ /** What the run's workspace holds, listed on the upload step. */
55
+ files?: WorkflowRunnerFile[];
56
+ /** Replaces an upload step's body. */
57
+ renderUpload?: (step: WorkflowUploadStep) => ReactNode;
58
+ /** Extra content under a step's body (e.g. what a commit created). */
59
+ renderStepNote?: (step: WorkflowStep, run: WorkflowRunView) => ReactNode;
60
+ /** Replaces the finish screen. */
61
+ renderComplete?: (run: WorkflowRunView) => ReactNode;
62
+ labels?: Partial<WorkflowRunnerLabels>;
63
+ /**
64
+ * Test ids: `<prefix>-step-<id>` (pill), `<prefix>-<id>` (body), `<prefix>-field-<name>`,
65
+ * `<prefix>-next` / `-back`, `<prefix>-done`.
66
+ */
67
+ testIdPrefix?: string;
68
+ className?: string;
69
+ }
70
+ export declare function WorkflowRunner({ workflow, run, renderAgentOutput, renderReview, onUpload, uploading, files, renderUpload, renderStepNote, renderComplete, renderScope, renderDocuments, renderIcon, labels, testIdPrefix, className, }: WorkflowRunnerProps): import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  export * from './types';
2
- export { composeWorkflowPrompt, buildLaunch, defaultInputs, validateInputs, isWorkflowScope, isEmptyWorkflowScope, skillToWorkflow, promptFieldName, SKILL_PROMPT_LABEL, SKILL_PROMPT_FALLBACK_PLACEHOLDER, workflowFromFrontmatter, workflowAccepts, workflowsAccepting, workflowsForHost, inputsFromContext, type SkillLike, type WorkflowComposeContext, type WorkflowContext, } from './workflow';
2
+ export { composeWorkflowPrompt, buildLaunch, defaultInputs, validateInputs, isWorkflowScope, isEmptyWorkflowScope, skillToWorkflow, promptFieldName, SKILL_PROMPT_LABEL, SKILL_PROMPT_FALLBACK_PLACEHOLDER, workflowFromFrontmatter, fieldToFrontmatter, workflowAccepts, workflowsAccepting, workflowsForHost, inputsFromContext, type SkillLike, type WorkflowComposeContext, type WorkflowContext, } from './workflow';
3
3
  export { SchemaForm, DEFAULT_SCHEMA_FORM_LABELS, type SchemaFormProps, type SchemaFormLabels, } from './SchemaForm';
4
4
  export { AgentSelect, DEFAULT_AGENT_SELECT_LABELS, type AgentSelectProps, type AgentSelectLabels, type AgentOption, } from './AgentSelect';
5
5
  export { WorkflowConfigDialog, DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS, type WorkflowConfigDialogProps, type WorkflowConfigDialogLabels, type WorkflowScopeSource, } from './WorkflowConfigDialog';
@@ -7,3 +7,9 @@ export { defaultScopeRenderer, resolveScopeInputs } from './scopeRender';
7
7
  export { WorkflowLauncher, type WorkflowLauncherProps } from './WorkflowLauncher';
8
8
  export { buildWorkflowScopeSource, matchWorkflowScope, type WorkflowScopeDocument, type WorkflowScopeLabel, } from './workspaceScope';
9
9
  export { WorkflowDocumentsField, type WorkflowDocumentsFieldProps } from './WorkflowDocumentsField';
10
+ export { workflowSteps, isSteppedWorkflow, stepDependencies, dependsOn, orderSteps, validateWorkflowGraph, stepLevels, stepStatesFromActivity, runFields, initialRunInputs, stepPhase, isRunFinished, isPersonStep, nextAction, validateStep, fillRunText, fillStepInputs, runThreadTitle, reviewInstructions, composeStepPrompt, type StepComposeOptions, type WorkflowActivityEvent, type WorkflowGraphProblem, type WorkflowStepPhase, type WorkflowNextAction, } from './run';
11
+ export { toPlanSteps, fromPlanSteps, layoutFromPlanSteps, type TaskPlanStep, type ToPlanOptions, } from './planSteps';
12
+ export { workflowToSkillMarkdown, workflowFromSkillMarkdown, skillSlug } from './skillMarkdown';
13
+ export { useWorkflowView, type UseWorkflowViewOptions, type WorkflowRunView, } from './useWorkflowView';
14
+ export { useWorkflowPreview, type UseWorkflowPreviewOptions } from './useWorkflowPreview';
15
+ export { WorkflowRunner, DEFAULT_WORKFLOW_RUNNER_LABELS, type WorkflowRunnerProps, type WorkflowRunnerLabels, type WorkflowRunnerFile, } from './WorkflowRunner';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * A stepped workflow as the plan a run thread carries (`TaskPlan.steps`) and back. The server reads
3
+ * the structure to start each step: an agent step runs a skill (`skill` + `inputs` templates) or a
4
+ * prompt (filled from the run's inputs as it starts); everything only a client shows (form fields,
5
+ * icon, canvas position, which workflow a step names) rides along in `ui`.
6
+ */
7
+ import type { components } from '@arbidocs/client';
8
+ import { type StepComposeOptions } from './run';
9
+ import type { WorkflowDefinition, WorkflowInputs, WorkflowStep } from './types';
10
+ export type TaskPlanStep = components['schemas']['TaskPlanStep'];
11
+ export type TaskPlan = components['schemas']['TaskPlan'];
12
+ export interface ToPlanOptions extends StepComposeOptions {
13
+ /**
14
+ * The run's inputs when it starts: prompts are composed with them. Fields not given yet (or
15
+ * absent altogether, saving a workflow to run later) keep `{{field}}` placeholders, which the
16
+ * server fills from the run's inputs.
17
+ */
18
+ inputs?: WorkflowInputs;
19
+ }
20
+ /** The plan steps a run thread (or a saved workflow) carries for `workflow`. */
21
+ export declare function toPlanSteps(workflow: WorkflowDefinition, options?: ToPlanOptions): TaskPlanStep[];
22
+ /** Steps from a run's (or a saved workflow's) plan: what the runner, the builder and the top bar show. */
23
+ export declare function fromPlanSteps(steps: TaskPlanStep[] | null | undefined): WorkflowStep[];
24
+ /** Where each step sits on the builder's canvas, as the plan keeps it. */
25
+ export declare function layoutFromPlanSteps(steps: TaskPlanStep[] | null | undefined): Record<string, {
26
+ x: number;
27
+ y: number;
28
+ }> | undefined;
@@ -0,0 +1,97 @@
1
+ /**
2
+ * The model of a stepped workflow (`run: { kind: 'steps' }`): the steps form a graph (each waits
3
+ * for the steps in its `after`), and a run's progress is each step's `WorkflowStepState`, as the
4
+ * run's thread records it (`stepStatesFromActivity`). Pure functions, shared by the thread runner
5
+ * (`useWorkflowThread`), the builder's preview and the thread's top bar.
6
+ */
7
+ import type { WorkflowAgentStep, WorkflowDefinition, WorkflowErrors, WorkflowInputs, WorkflowReviewStep, WorkflowStep, WorkflowStepState } from './types';
8
+ /** A stepped workflow's steps; empty for a single-run one. */
9
+ export declare function workflowSteps(workflow: WorkflowDefinition): WorkflowStep[];
10
+ export declare const isSteppedWorkflow: (workflow: WorkflowDefinition) => boolean;
11
+ /** What a step waits for: its `after`, else the step before it in the list (a sequence). */
12
+ export declare function stepDependencies(steps: WorkflowStep[], id: string): string[];
13
+ /** `a` waits for `b`, directly or through other steps. */
14
+ export declare function dependsOn(steps: WorkflowStep[], a: string, b: string): boolean;
15
+ /**
16
+ * The steps in dependency order, keeping the given order wherever the graph allows (a stable
17
+ * topological sort). Every implicit dependency is written out as `after` first, so reordering
18
+ * never changes what a step waits for. Steps in a cycle keep their place at the end; validation
19
+ * reports them.
20
+ */
21
+ export declare function orderSteps(steps: WorkflowStep[]): WorkflowStep[];
22
+ export type WorkflowGraphProblem = {
23
+ code: 'duplicate';
24
+ step: string;
25
+ } | {
26
+ code: 'unknown';
27
+ step: string;
28
+ dependency: string;
29
+ } | {
30
+ code: 'cycle';
31
+ step: string;
32
+ } | {
33
+ code: 'order';
34
+ step: string;
35
+ dependency: string;
36
+ };
37
+ /** What makes a stepped workflow unrunnable. Empty = valid. */
38
+ export declare function validateWorkflowGraph(steps: WorkflowStep[]): WorkflowGraphProblem[];
39
+ /**
40
+ * The steps by depth (the longest chain before each): what the stepper shows side by side.
41
+ * A sequence is one step per level.
42
+ */
43
+ export declare function stepLevels(steps: WorkflowStep[]): WorkflowStep[][];
44
+ /** One entry of a thread's activity log, as far as steps are concerned. */
45
+ export interface WorkflowActivityEvent {
46
+ kind: string;
47
+ detail?: Record<string, unknown> | null;
48
+ }
49
+ /** Each step's state from the thread's activity log (oldest first): its latest step event wins. */
50
+ export declare function stepStatesFromActivity(events: WorkflowActivityEvent[]): Record<string, WorkflowStepState>;
51
+ /** Every field the run asks for: the launch form's, then each form step's. */
52
+ export declare function runFields(workflow: WorkflowDefinition): import("./types").WorkflowField[];
53
+ /** A fresh run's inputs: every field at its default, then the prefills. */
54
+ export declare function initialRunInputs(workflow: WorkflowDefinition, inputs?: WorkflowInputs): WorkflowInputs;
55
+ /**
56
+ * Where a step stands: `blocked` until everything it waits for has finished (done or skipped),
57
+ * then `ready`, then its own status.
58
+ */
59
+ export type WorkflowStepPhase = 'blocked' | 'ready' | 'running' | 'done' | 'skipped' | 'failed';
60
+ export declare function stepPhase(steps: WorkflowStep[], states: Record<string, WorkflowStepState>, id: string): WorkflowStepPhase;
61
+ export declare const isRunFinished: (steps: WorkflowStep[], states: Record<string, WorkflowStepState>) => boolean;
62
+ /** A step a person does (form, upload, review); agent steps run themselves. */
63
+ export declare const isPersonStep: (step: WorkflowStep) => boolean;
64
+ /**
65
+ * What the primary button does on the step in view:
66
+ * - `complete`: finish this form, upload or review (approve) and move on;
67
+ * - `move`: view the next step: this one is finished, or the next does not wait for it;
68
+ * - `skip`: give up on this agent step (it failed) so what waits for it can go on;
69
+ * - `finish`: show the completion (every step has finished);
70
+ * - `wait`: nothing yet (this step is under way and the next waits for it, or it is blocked).
71
+ */
72
+ export type WorkflowNextAction = 'complete' | 'move' | 'skip' | 'finish' | 'wait';
73
+ export declare function nextAction(steps: WorkflowStep[], states: Record<string, WorkflowStepState>, current: string | null): WorkflowNextAction;
74
+ /** A form step's problems (empty = it can move on); other steps have none. */
75
+ export declare function validateStep(step: WorkflowStep, inputs: WorkflowInputs): WorkflowErrors;
76
+ /**
77
+ * Fill a step's `with` templates from the run's inputs: `{{a}}`, `{{a || b}}` (first non-blank).
78
+ * A template that is exactly one bare reference passes the value through untouched.
79
+ */
80
+ export declare function fillStepInputs(templates: Record<string, string> | undefined, inputs: WorkflowInputs): WorkflowInputs;
81
+ /** A template over the run's inputs, as text (`{{a}}`, `{{a || b}}`). */
82
+ export declare function fillRunText(template: string, inputs: WorkflowInputs): string;
83
+ /** The run thread's title: the workflow's `threadTitle` template, else its title. */
84
+ export declare function runThreadTitle(workflow: WorkflowDefinition, inputs: WorkflowInputs): string;
85
+ /** What a review asks for: its instructions filled from the run, else its title. */
86
+ export declare function reviewInstructions(step: WorkflowReviewStep, inputs: WorkflowInputs): string;
87
+ export interface StepComposeOptions {
88
+ /** Looks up the workflow a step names (`step.workflow`). */
89
+ resolveWorkflow?: (id: string) => WorkflowDefinition | undefined;
90
+ /**
91
+ * The host's wording for `operation` runs: the named workflow's id (or the step's own id when it
92
+ * runs inline), its filled inputs, and the whole run's inputs (e.g. to ground it in the record).
93
+ */
94
+ compose?: (id: string, inputs: WorkflowInputs, runInputs: WorkflowInputs) => string | undefined;
95
+ }
96
+ /** The prompt an agent step of `workflow` sends; '' when nothing could compose it (no binding). */
97
+ export declare function composeStepPrompt(workflow: WorkflowDefinition, step: WorkflowAgentStep, runInputs: WorkflowInputs, { resolveWorkflow, compose }?: StepComposeOptions): string;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A skill's form and prompt as SKILL.md text and back: how a built-in becomes a skill of the user's
3
+ * own ("Make a copy"). A skill is one step; a flow of steps is a workflow (`toPlanSteps`).
4
+ *
5
+ * The frontmatter is the line-based `key: value` form the backend parser reads. `inputs` is one
6
+ * line of JSON (valid YAML flow style): the backend ignores keys it does not know, and
7
+ * `workflowFromSkillMarkdown` reads it back.
8
+ */
9
+ import type { WorkflowDefinition } from './types';
10
+ /** A skill slug: lowercase letters, digits and hyphens (what the backend accepts). */
11
+ export declare const skillSlug: (raw: string) => string;
12
+ /** SKILL.md text for a prompt workflow: frontmatter (name, description, form) then the prompt. */
13
+ export declare function workflowToSkillMarkdown(workflow: WorkflowDefinition): string;
14
+ /** Read a SKILL.md back into a workflow (the inverse of `workflowToSkillMarkdown`). */
15
+ export declare function workflowFromSkillMarkdown(id: string, text: string): WorkflowDefinition;
@@ -71,7 +71,115 @@ export type WorkflowRun =
71
71
  /** The host performs it (bound by workflow id), e.g. create a label then generate. */
72
72
  | {
73
73
  kind: 'operation';
74
+ }
75
+ /**
76
+ * A guided run of named steps that form a graph. A run is a work thread on the server: the
77
+ * thread's plan carries the steps (`toPlanSteps`), its activity log records each step's progress,
78
+ * and the work runner starts each agent step as a turn in the thread. A person does the form,
79
+ * upload and review steps (`useWorkflowThread` / `WorkflowRunner`). Not schedulable from a single
80
+ * form: a workflow (automation) carries the steps and its trigger (`WorkflowBuilder`).
81
+ */
82
+ | {
83
+ kind: 'steps';
84
+ /** The run thread's title, a template over the run's inputs; defaults to the workflow's. */
85
+ threadTitle?: string;
86
+ /** In dependency order: a step only waits for steps listed before it (`orderSteps`). */
87
+ steps: WorkflowStep[];
88
+ completion?: WorkflowCompletion;
89
+ /** Where each step sits on the builder's canvas, by step id. */
90
+ layout?: Record<string, {
91
+ x: number;
92
+ y: number;
93
+ }>;
74
94
  };
95
+ interface WorkflowStepBase {
96
+ /** Unique within the workflow (`[a-z][a-z0-9_-]*`): the thread's progress is keyed by it. */
97
+ id: string;
98
+ /** The step's name: the stepper and the thread's top bar show it. */
99
+ title: string;
100
+ /** One line under the step's heading. */
101
+ description?: string;
102
+ /** Key into the host's icon map. */
103
+ icon?: string;
104
+ /**
105
+ * The host commits this step before the run moves on (`commit[id]`), e.g. creates the record
106
+ * later steps work in. Once committed the step's inputs are locked.
107
+ */
108
+ commit?: boolean;
109
+ /** Primary button text while on this step (until it is committed); defaults to "Continue". */
110
+ nextLabel?: string;
111
+ /**
112
+ * The steps this one waits for. Absent: the step before it in the list, so a plain list is a
113
+ * sequence. `[]`: it starts with the run. A step waiting for several waits for them all.
114
+ */
115
+ after?: string[];
116
+ }
117
+ /** Ask for inputs. Every step's fields share the run's one input namespace (`{{name}}`). */
118
+ export interface WorkflowFormStep extends WorkflowStepBase {
119
+ kind: 'form';
120
+ inputs: WorkflowField[];
121
+ }
122
+ /** Add files to the run's workspace. Skippable unless `required`. */
123
+ export interface WorkflowUploadStep extends WorkflowStepBase {
124
+ kind: 'upload';
125
+ required?: boolean;
126
+ /** `accept` of the file picker, e.g. `.pdf,.docx`. */
127
+ accept?: string;
128
+ /** Small muted line under the drop target. */
129
+ hint?: string;
130
+ }
131
+ /**
132
+ * A turn the assistant takes in the run's thread. It runs a skill or another workflow
133
+ * (`workflow`, its inputs filled from `with`) or its own `run`. It continues the thread's main
134
+ * line, so it sees everything before it; a `branch` step runs off the main line instead and
135
+ * delivers only its result back to it.
136
+ */
137
+ export interface WorkflowAgentStep extends WorkflowStepBase {
138
+ kind: 'agent';
139
+ /** Id of the skill or workflow this step runs; its inputs come from `with`. */
140
+ workflow?: string;
141
+ /**
142
+ * The named workflow's inputs, each a template over the run's inputs: `{{client}}`, with
143
+ * `{{a || b}}` falling back to `b` when `a` is blank. A bare `{{name}}` passes the value as is.
144
+ */
145
+ with?: Record<string, string>;
146
+ /** Used when no `workflow` is named. `operation`: the host composes the prompt (`compose`). */
147
+ run?: Extract<WorkflowRun, {
148
+ kind: 'prompt';
149
+ } | {
150
+ kind: 'operation';
151
+ }>;
152
+ /** What the step shows: the answer (default) or the drafted document. */
153
+ output?: 'answer' | 'artifact';
154
+ /** Runs off the thread's main line and delivers only its result to it. */
155
+ branch?: boolean;
156
+ }
157
+ /** A person's review or approval: whoever completes it on the thread approves it. */
158
+ export interface WorkflowReviewStep extends WorkflowStepBase {
159
+ kind: 'review';
160
+ /** What to review, a template over the run's inputs. */
161
+ instructions?: string;
162
+ }
163
+ export type WorkflowStep = WorkflowFormStep | WorkflowUploadStep | WorkflowAgentStep | WorkflowReviewStep;
164
+ /** The finish screen of a stepped run. */
165
+ export interface WorkflowCompletion {
166
+ title: string;
167
+ description?: string;
168
+ icon?: string;
169
+ }
170
+ /**
171
+ * 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).
173
+ */
174
+ export type WorkflowStepStatus = 'pending' | 'running' | 'done' | 'skipped' | 'failed';
175
+ export interface WorkflowStepState {
176
+ status: WorkflowStepStatus;
177
+ /** The step's answer in the thread (an agent step), or the result a branch delivered. */
178
+ responseId?: string | null;
179
+ /** The answer's text, once read. */
180
+ text?: string;
181
+ error?: string | null;
182
+ }
75
183
  export interface WorkflowDefinition {
76
184
  /** Execute a document operation directly, without creating a chat. */
77
185
  documentAction?: 'annotate_documents' | 'email_documents';
@@ -127,3 +235,4 @@ export type WorkflowInputs = Record<string, WorkflowInputValue>;
127
235
  /** Validation problem of one field: the dialog maps the code to a label. */
128
236
  export type WorkflowFieldError = 'required' | 'min' | 'max' | 'number';
129
237
  export type WorkflowErrors = Record<string, WorkflowFieldError>;
238
+ export {};
@@ -0,0 +1,14 @@
1
+ /**
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.
4
+ */
5
+ import { type StepComposeOptions } from './run';
6
+ import type { WorkflowDefinition } from './types';
7
+ import { type WorkflowRunView } from './useWorkflowView';
8
+ export interface UseWorkflowPreviewOptions extends StepComposeOptions {
9
+ /** What a stand-in agent step answers; `{prompt}` is replaced with the prompt it would send. */
10
+ answer?: string;
11
+ /** How long a stand-in step takes. */
12
+ delayMs?: number;
13
+ }
14
+ export declare function useWorkflowPreview(workflow: WorkflowDefinition, { answer, delayMs, resolveWorkflow, compose }?: UseWorkflowPreviewOptions): WorkflowRunView;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * The screen side of a stepped run: which step is in view, form problems, and what the primary
3
+ * button does. The run itself happens elsewhere (the thread on the server, `useWorkflowThread`, or
4
+ * the builder's preview): this hook gets each step's state and the host's actions, so every host
5
+ * shows a run the same way (`WorkflowRunner`).
6
+ */
7
+ import { type WorkflowNextAction, type WorkflowStepPhase } from './run';
8
+ import type { WorkflowErrors, WorkflowInputValue, WorkflowInputs, WorkflowStep, WorkflowStepState } from './types';
9
+ export interface UseWorkflowViewOptions {
10
+ steps: WorkflowStep[];
11
+ /** Each step's state (missing = pending). */
12
+ states: Record<string, WorkflowStepState>;
13
+ inputs: WorkflowInputs;
14
+ setInput: (name: string, value: WorkflowInputValue) => void;
15
+ /** Finish a person's step (a form, an upload, a review's approval). A throw keeps the user on it. */
16
+ complete: (step: WorkflowStep) => Promise<void>;
17
+ /** Give up on a step so what waits for it can go on. */
18
+ skip: (stepId: string) => Promise<void>;
19
+ /** Run a failed agent step again. */
20
+ retry?: (stepId: string) => Promise<void>;
21
+ /** A form step whose inputs can no longer change (committed, or recorded on the thread). */
22
+ isLocked?: (stepId: string) => boolean;
23
+ }
24
+ /** What `WorkflowRunner` shows and does. */
25
+ export interface WorkflowRunView {
26
+ steps: WorkflowStep[];
27
+ /** The step in view; `undefined` once the run's completion is shown. */
28
+ step: WorkflowStep | undefined;
29
+ current: string | null;
30
+ isComplete: boolean;
31
+ inputs: WorkflowInputs;
32
+ setInput: (name: string, value: WorkflowInputValue) => void;
33
+ stateOf: (stepId: string) => WorkflowStepState | undefined;
34
+ phaseOf: (stepId: string) => WorkflowStepPhase;
35
+ isLocked: (stepId: string) => boolean;
36
+ /** The form step in view's problems, shown once moving on was attempted. */
37
+ errors: WorkflowErrors;
38
+ /** An action is under way (completing, skipping). */
39
+ busy: boolean;
40
+ actionError: string | null;
41
+ /** Some agent step is running. */
42
+ isRunning: boolean;
43
+ action: WorkflowNextAction;
44
+ canBack: boolean;
45
+ next: () => Promise<void>;
46
+ back: () => void;
47
+ /** View a step (one further down the plan too: it can be skipped from there). */
48
+ goTo: (stepId: string) => void;
49
+ skip: (stepId: string) => Promise<void>;
50
+ retry?: (stepId: string) => Promise<void>;
51
+ /** Show the run from the start again (a host that starts a new run resets its own state). */
52
+ restart: () => void;
53
+ }
54
+ export declare function useWorkflowView(options: UseWorkflowViewOptions): WorkflowRunView;
@@ -1,4 +1,4 @@
1
- import { type WorkflowDefinition, type WorkflowErrors, type WorkflowContextKind, type WorkflowInputs, type WorkflowLaunch, type WorkflowScope } from './types';
1
+ import { type WorkflowDefinition, type WorkflowErrors, type WorkflowField, type WorkflowContextKind, type WorkflowInputs, type WorkflowLaunch, type WorkflowScope } from './types';
2
2
  export declare const isWorkflowScope: (value: unknown) => value is WorkflowScope;
3
3
  export declare const isEmptyWorkflowScope: (scope: WorkflowScope) => boolean;
4
4
  /** The inputs a fresh form starts with: each field's default, else an empty value of its type. */
@@ -60,3 +60,5 @@ export declare function skillToWorkflow(skill: SkillLike): WorkflowDefinition;
60
60
  * template). The inverse of what the backend will publish; seeded workflows use the same shape.
61
61
  */
62
62
  export declare function workflowFromFrontmatter(id: string, frontmatter: Record<string, unknown>, body: string): WorkflowDefinition;
63
+ /** snake_case keys of the on-disk form of a field (what `workflowFromFrontmatter` reads). */
64
+ export declare function fieldToFrontmatter(field: WorkflowField): Record<string, unknown>;