@arbidocs/blocks 0.4.16 → 0.4.17

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 (98) hide show
  1. package/dist/agents/index.cjs +369 -171
  2. package/dist/agents/index.js +4 -2
  3. package/dist/agents/tasks/DueDateMenu.d.ts +32 -0
  4. package/dist/agents/tasks/NewThreadDialog.d.ts +53 -0
  5. package/dist/agents/tasks/PersonPill.d.ts +22 -0
  6. package/dist/agents/tasks/PillSelect.d.ts +39 -0
  7. package/dist/agents/tasks/TaskActivityDialog.d.ts +14 -0
  8. package/dist/agents/tasks/TaskActivityTimeline.d.ts +54 -0
  9. package/dist/agents/tasks/TaskComposer.d.ts +6 -106
  10. package/dist/agents/tasks/TaskMoveDialog.d.ts +25 -0
  11. package/dist/agents/tasks/TaskOutputsCell.d.ts +23 -0
  12. package/dist/agents/tasks/TaskPlan.d.ts +4 -2
  13. package/dist/agents/tasks/TaskReviewActions.d.ts +44 -0
  14. package/dist/agents/tasks/TaskRowMenu.d.ts +28 -0
  15. package/dist/agents/tasks/TaskStatusPill.d.ts +24 -0
  16. package/dist/agents/tasks/TaskTable.d.ts +99 -0
  17. package/dist/agents/tasks/TaskThreadChip.d.ts +19 -0
  18. package/dist/agents/tasks/TaskTriggerChip.d.ts +24 -0
  19. package/dist/agents/tasks/TasksChrome.d.ts +17 -17
  20. package/dist/agents/tasks/WorkflowComposer.d.ts +10 -0
  21. package/dist/agents/tasks/WorkflowsTable.d.ts +72 -0
  22. package/dist/agents/tasks/gridWidth.d.ts +11 -0
  23. package/dist/agents/tasks/index.d.ts +23 -7
  24. package/dist/agents/tasks/taskColumns.d.ts +39 -63
  25. package/dist/agents/tasks/taskComposerTypes.d.ts +217 -0
  26. package/dist/agents/tasks/taskLabels.d.ts +27 -10
  27. package/dist/agents/tasks/taskRequest.d.ts +151 -25
  28. package/dist/agents/tasks/taskRows.d.ts +111 -0
  29. package/dist/agents/tasks/taskTableLabels.d.ts +64 -0
  30. package/dist/agents/tasks/workflowColumns.d.ts +23 -0
  31. package/dist/agents/tasks/workflowRows.d.ts +44 -0
  32. package/dist/agents/tasks/workflowTableLabels.d.ts +53 -0
  33. package/dist/agents/workflows/WorkflowConfigDialog.d.ts +5 -0
  34. package/dist/agents/workflows/index.d.ts +1 -0
  35. package/dist/agents/workflows/scopeRender.d.ts +10 -0
  36. package/dist/agents/workflows/types.d.ts +2 -0
  37. package/dist/chat/AssistantModeToggle.d.ts +25 -0
  38. package/dist/chat/MentionMenu.d.ts +52 -0
  39. package/dist/chat/index.cjs +119 -63
  40. package/dist/chat/index.d.ts +4 -0
  41. package/dist/chat/index.js +1 -1
  42. package/dist/chat/mentions.d.ts +64 -0
  43. package/dist/chat/useMentionAutocomplete.d.ts +33 -0
  44. package/dist/{chunk-IMA6I73C.js → chunk-ABSII3ND.js} +336 -4
  45. package/dist/chunk-ABSII3ND.js.map +1 -0
  46. package/dist/{chunk-22T6KHGB.cjs → chunk-C2V6HQKG.cjs} +348 -2
  47. package/dist/chunk-C2V6HQKG.cjs.map +1 -0
  48. package/dist/chunk-IC2VHFWR.js +158 -0
  49. package/dist/chunk-IC2VHFWR.js.map +1 -0
  50. package/dist/{chunk-67HGXV4I.cjs → chunk-IWOOGRNG.cjs} +4276 -855
  51. package/dist/chunk-IWOOGRNG.cjs.map +1 -0
  52. package/dist/{chunk-D6XY3C4O.cjs → chunk-JGZTRLKL.cjs} +207 -139
  53. package/dist/chunk-JGZTRLKL.cjs.map +1 -0
  54. package/dist/{chunk-H7OD4CHN.js → chunk-NUPVHEJW.js} +208 -140
  55. package/dist/chunk-NUPVHEJW.js.map +1 -0
  56. package/dist/{chunk-CVFBSUXL.js → chunk-OMF7444S.js} +4223 -851
  57. package/dist/chunk-OMF7444S.js.map +1 -0
  58. package/dist/chunk-ZPERNIMP.cjs +162 -0
  59. package/dist/chunk-ZPERNIMP.cjs.map +1 -0
  60. package/dist/connection/ai.d.ts +4 -1
  61. package/dist/facts/FactRowActions.d.ts +5 -1
  62. package/dist/facts/factColumns.d.ts +1 -1
  63. package/dist/facts/index.cjs +19 -10
  64. package/dist/facts/index.cjs.map +1 -1
  65. package/dist/facts/index.js +14 -5
  66. package/dist/facts/index.js.map +1 -1
  67. package/dist/files/GridView.d.ts +5 -0
  68. package/dist/files/index.cjs +18 -18
  69. package/dist/files/index.js +4 -5
  70. package/dist/files/index.js.map +1 -1
  71. package/dist/index.cjs +539 -287
  72. package/dist/index.js +6 -6
  73. package/dist/settings/ConversationSettingsParts.d.ts +5 -1
  74. package/dist/settings/index.cjs +8 -3
  75. package/dist/settings/index.cjs.map +1 -1
  76. package/dist/settings/index.js +8 -3
  77. package/dist/settings/index.js.map +1 -1
  78. package/dist/shell/index.cjs +1 -1
  79. package/dist/shell/index.js +1 -1
  80. package/dist/site/index.cjs +9 -9
  81. package/dist/site/index.js +1 -1
  82. package/dist/workspaces/index.cjs +1 -1
  83. package/dist/workspaces/index.cjs.map +1 -1
  84. package/dist/workspaces/index.js +1 -1
  85. package/dist/workspaces/index.js.map +1 -1
  86. package/package.json +3 -3
  87. package/dist/agents/tasks/LiveRunsBanner.d.ts +0 -26
  88. package/dist/agents/tasks/TaskRowActions.d.ts +0 -43
  89. package/dist/chunk-22T6KHGB.cjs.map +0 -1
  90. package/dist/chunk-67HGXV4I.cjs.map +0 -1
  91. package/dist/chunk-CVFBSUXL.js.map +0 -1
  92. package/dist/chunk-D6XY3C4O.cjs.map +0 -1
  93. package/dist/chunk-H7OD4CHN.js.map +0 -1
  94. package/dist/chunk-IMA6I73C.js.map +0 -1
  95. package/dist/chunk-NUNKSZKU.js +0 -203
  96. package/dist/chunk-NUNKSZKU.js.map +0 -1
  97. package/dist/chunk-V4ISCZJ7.cjs +0 -207
  98. package/dist/chunk-V4ISCZJ7.cjs.map +0 -1
@@ -1,19 +1,29 @@
1
1
  /**
2
2
  * TaskComposer values to API requests (and back): the pure mapping every host would write the same
3
- * way. No SDK call is made here; hand the result to `useCreateTask` / `useUpdateTask` from
4
- * `@arbidocs/react`.
3
+ * way. No SDK call is made here; hand the result to the hooks from `@arbidocs/react`.
4
+ *
5
+ * "Now" (or a plain to-do) creates work: a conversation with a status (`useCreateWork`). Any other
6
+ * start (a date, a repeat, an event, after another task) saves a workflow (`useCreateWorkflow`) that
7
+ * creates the work when it fires.
5
8
  */
6
9
  import type { components } from '@arbidocs/client';
10
+ import { type WorkflowComposeContext } from '../workflows/workflow';
7
11
  import type { WorkflowDefinition, WorkflowInputs } from '../workflows/types';
8
- import type { TaskComposerValues } from './TaskComposer';
9
- type CreateTaskRequest = components['schemas']['CreateTaskRequest'];
10
- type UpdateTaskRequest = components['schemas']['UpdateTaskRequest'];
11
- type TaskResponse = components['schemas']['TaskResponse'];
12
- export type TaskAuthMode = NonNullable<CreateTaskRequest['auth_mode']>;
13
- export type TaskActionKind = NonNullable<CreateTaskRequest['action_type']>;
12
+ import type { TaskComposerValues, TaskWhen } from './taskComposerTypes';
13
+ type Schemas = components['schemas'];
14
+ type ConversationResponse = Schemas['ConversationResponse'];
15
+ type CreateWorkRequest = Schemas['CreateWorkRequest'];
16
+ type CreateWorkflowRequest = Schemas['CreateWorkflowRequest'];
17
+ type TaskPlan = Schemas['TaskPlan'];
18
+ type TaskOptions = Schemas['TaskOptions'];
19
+ type UpdateConversationRequest = Schemas['UpdateConversationRequest'];
20
+ type UpdateWorkflowRequest = Schemas['UpdateWorkflowRequest'];
21
+ type WorkflowResponse = Schemas['WorkflowResponse'];
22
+ /** The authorization tier of a run (the same three values for work and for workflows). */
23
+ export type TaskAuthMode = CreateWorkRequest['auth_mode'];
14
24
  /**
15
- * The plain-language access choice becomes the backend authorisation tier: a run-now task is
16
- * authorised for that one run, a scheduled one either keeps standing access or asks each run.
25
+ * The plain-language access choice becomes the backend authorisation tier: run-now work is
26
+ * authorised for that one run, a workflow either keeps standing access or asks each run.
17
27
  */
18
28
  export declare function authModeFor(values: Pick<TaskComposerValues, 'when' | 'access'>): TaskAuthMode;
19
29
  /** `datetime-local` value (no zone) to an ISO instant. Throws on an empty or invalid value. */
@@ -21,41 +31,157 @@ export declare function localInputToIso(local: string): string;
21
31
  /** An ISO instant to the `datetime-local` value the composer edits; empty for none or invalid. */
22
32
  export declare function isoToLocalInput(iso: string | null | undefined): string;
23
33
  export interface WorkflowTaskFields {
34
+ /** The title of the work or the name of the workflow. */
24
35
  name: string;
25
- action_type: TaskActionKind;
26
36
  prompt: string;
27
37
  skill_ref: string | null;
38
+ /** The skill's saved inputs (only for a skill). */
39
+ skill_inputs: WorkflowInputs | null;
28
40
  }
41
+ /** How many words of an instruction a derived name keeps. */
42
+ export declare const DERIVED_NAME_WORDS = 6;
43
+ /** The first `count` words of a text, with an ellipsis when there is more; empty for blank text. */
44
+ export declare function firstWords(text: string, count?: number): string;
29
45
  /**
30
- * How a workflow becomes the body of a task:
31
- * - `options.agent === false` is a reminder (`notify`): the composed text is the notification;
32
- * - a workflow with a `skill` runs that skill, its `args` input being the arguments;
46
+ * The name a workflow (or task) gets when its owner types none: the template's title or, for a template
47
+ * that is a free-text instruction or reminder (its form is just an `instruction` or `message`), the
48
+ * first few words of what was written, falling back to the title while it is still blank.
49
+ */
50
+ export declare function deriveWorkflowName(workflow: WorkflowDefinition, inputs: WorkflowInputs): string;
51
+ /**
52
+ * How a workflow definition becomes an action:
53
+ * - `options.agent === false` is a reminder: the composed text is the title and there is no prompt or
54
+ * skill (the backend makes a to-do and notifies the owner);
55
+ * - a definition with a `skill` runs that skill, its `args` input being the arguments;
33
56
  * - anything else is an agent prompt, the composed workflow prompt.
34
- * `name` (typed by the user) wins over the derived one.
57
+ * `name` (typed by the user) wins over the derived one (see {@link deriveWorkflowName}).
35
58
  */
36
- export declare function workflowTaskFields(workflow: WorkflowDefinition, inputs: WorkflowInputs, name?: string): WorkflowTaskFields;
59
+ /** Does any input name files (an explicit pick, or a resolved scope)? Those bind the run. */
60
+ export declare const hasDocumentInputs: (inputs: WorkflowInputs) => boolean;
61
+ export declare function workflowTaskFields(workflow: WorkflowDefinition, inputs: WorkflowInputs, name?: string, context?: WorkflowComposeContext): WorkflowTaskFields;
37
62
  /** Does this workflow need a workspace to run (everything except a plain reminder)? */
38
63
  export declare const isAgenticWorkflow: (workflow: WorkflowDefinition) => boolean;
39
64
  export interface TaskRequestContext {
65
+ /** File names for the prompt's wording ("the document <name>"), by file id. */
66
+ documentTitles?: Record<string, string>;
40
67
  workflow: WorkflowDefinition;
41
68
  values: TaskComposerValues;
69
+ /** The goal checklist drafted for agent work, if any. */
70
+ plan?: TaskPlan | null;
71
+ }
72
+ /** Does this composer submission create work straight away (rather than save a workflow)? */
73
+ export declare const createsWork: (values: Pick<TaskComposerValues, "assignee" | "when">) => boolean;
74
+ /**
75
+ * The create-work request: a plain to-do (a title, no agent) or agent work that starts now. Agent work
76
+ * throws when there is no workspace open.
77
+ */
78
+ export declare function composerToWorkRequest({ workflow, values, plan, documentTitles }: TaskRequestContext, workspaceId: string | undefined): CreateWorkRequest;
79
+ /**
80
+ * Run now is a plain assistant query that carries `task` options: the thread it starts becomes a task
81
+ * (generating, then ready for review). The query is the person's own run, so there is no agent and no
82
+ * access tier. The host turns this into a `POST /v1/responses` body.
83
+ */
84
+ export interface TaskQuery {
85
+ /** The message sent: the prompt, or `/skill-name arguments` for a skill. */
86
+ input: string;
87
+ workspaceId: string;
88
+ /** Files the run is bound to (the ids under any input's `documents`). */
89
+ docIds: string[];
90
+ task: TaskOptions;
42
91
  }
92
+ /** A thread to start: a task's query, or (no `task`) a plain conversation. */
93
+ export type ThreadQuery = Omit<TaskQuery, 'task'> & {
94
+ task?: TaskOptions;
95
+ };
96
+ /** The ids of the files a form's inputs name (an explicit pick, or a resolved scope), without repeats. */
97
+ export declare function inputDocumentIds(inputs: WorkflowInputs): string[];
98
+ /** The query that runs agent work now (a prompt or a skill) as the person asking. Throws without a workspace. */
99
+ export declare function composerToTaskQuery({ workflow, values, plan, documentTitles }: TaskRequestContext, workspaceId: string | undefined): TaskQuery;
100
+ /**
101
+ * The create-workflow request: exactly one trigger (a date, a repeat, an event, or another task being
102
+ * done) and the action it runs. An agent workflow throws when there is no workspace open.
103
+ */
104
+ export declare function composerToWorkflowRequest({ workflow, values, plan, documentTitles }: TaskRequestContext, workspaceId: string | undefined): CreateWorkflowRequest;
105
+ /** What a composer submission asks the host to do. */
106
+ export type ComposerCreate = {
107
+ kind: 'work';
108
+ body: CreateWorkRequest;
109
+ } | {
110
+ kind: 'query';
111
+ query: TaskQuery;
112
+ } | {
113
+ kind: 'workflow';
114
+ body: CreateWorkflowRequest;
115
+ };
116
+ /**
117
+ * Route a submission: agent work now is an assistant query, a plain to-do or reminder creates work,
118
+ * every other start creates a workflow.
119
+ * `forceWorkflow` is for the workflow dialog, where even a reminder is saved as a workflow.
120
+ */
121
+ export declare function taskComposerToCreateRequest(ctx: TaskRequestContext, workspaceId: string | undefined, forceWorkflow?: boolean): ComposerCreate;
43
122
  /**
44
- * The create request for a composer submission. An agent task is bound to `workspaceId` (throws
45
- * when there is none); a reminder is not. A run-now task is a one-time task due immediately: the
46
- * host starts it explicitly with `useRunTask` after creating it.
123
+ * The patch for editing a task (`PATCH /v1/conversation/{id}`): title, description, due date, sign-off
124
+ * person, parent (`null` detaches) and sharing. What the agent was told to do stays as created.
47
125
  */
48
- export declare function taskComposerToCreateRequest({ workflow, values }: TaskRequestContext, workspaceId: string | undefined): CreateTaskRequest;
49
- /** The patch for editing a task (the trigger kind, workspace and agent stay as created). */
50
- export declare function taskComposerToUpdateRequest({ workflow, values, }: TaskRequestContext): UpdateTaskRequest;
126
+ export declare function taskComposerToUpdateRequest({ values, plan, }: TaskRequestContext): UpdateConversationRequest;
127
+ /** The patch for editing a workflow: name, trigger (the other triggers are cleared) and action. */
128
+ export declare function composerToWorkflowUpdate({ workflow, values, plan, documentTitles, }: TaskRequestContext): UpdateWorkflowRequest;
51
129
  /** Does the task need the owner to authorise workspace access before it can run? */
52
- export declare const taskNeedsAccess: (task: Pick<TaskResponse, "pending_auth_request_id">) => boolean;
130
+ export declare const taskNeedsAccess: (task: Pick<ConversationResponse, "pending_auth_request_id">) => boolean;
53
131
  export interface TaskValuesWorkflows {
54
132
  /** The workflow that stands for an instruction task (its first input is `instruction`). */
55
133
  customWorkflowId: string;
56
134
  /** The workflow that stands for a reminder (its first input is `message`). */
57
135
  reminderWorkflowId: string;
136
+ /** The definitions a saved skill can be matched to (by `skill`), to restore a skill workflow's form. */
137
+ definitions?: WorkflowDefinition[];
138
+ }
139
+ /** What an existing task (a conversation with a status) looks like when reopened in the composer. */
140
+ export declare function taskToComposerValues(task: ConversationResponse, workflows: TaskValuesWorkflows): Partial<TaskComposerValues>;
141
+ /** Which start a saved workflow has. */
142
+ export declare function workflowWhen(workflow: WorkflowResponse): TaskWhen;
143
+ /** What an existing workflow looks like when reopened in the workflow dialog. */
144
+ export declare function workflowToComposerValues(workflow: WorkflowResponse, workflows: TaskValuesWorkflows): Partial<TaskComposerValues>;
145
+ /** What the New task dialog collects: a prompt, who sees it, and optional task details. */
146
+ export interface NewThreadValues {
147
+ /** What to ask or get done: the first message, which the assistant answers. The title is made from it. */
148
+ prompt: string;
149
+ /** A name instead of the generated one. Optional. */
150
+ title: string;
151
+ /** Shared with the workspace's members (the default), or private to its creator. */
152
+ shared: boolean;
153
+ /** The person who has the next step (`usr-…`); `''` = me. A task field. */
154
+ ownerId: string;
155
+ /** datetime-local value; empty = none. A task field. */
156
+ dueAt: string;
157
+ /** The task this is a sub-task of (`con-…`); `''` = none. A task field. */
158
+ parentId: string;
159
+ /** Whether the assistant starts on the prompt now. Off: it is a to-do, tracked and not run. */
160
+ assistant: boolean;
161
+ }
162
+ export declare const EMPTY_NEW_THREAD: NewThreadValues;
163
+ /** Is any task detail filled in (the dialog opens its details when one is preset)? */
164
+ export declare const hasTaskFields: (v: NewThreadValues) => boolean;
165
+ /** A new task: the prompt as the first message (the assistant answers it) and the task's options. */
166
+ export interface NewThreadRequest {
167
+ input: string;
168
+ shared: boolean;
169
+ task: TaskOptions;
170
+ /** False: nothing is asked of the assistant: the host adds a plain to-do from `todo`. */
171
+ startAssistant: boolean;
172
+ /** The to-do to add when `startAssistant` is false: a title and the rest of what the person wrote. */
173
+ todo?: {
174
+ title: string;
175
+ description: string;
176
+ };
58
177
  }
59
- /** What an existing task looks like when reopened in the composer. */
60
- export declare function taskToComposerValues(task: TaskResponse, workflows: TaskValuesWorkflows): Partial<TaskComposerValues>;
178
+ /** The first line of a prompt, kept to a title's length. */
179
+ export declare function titleFromPrompt(prompt: string, max?: number): string;
180
+ /**
181
+ * The request for a New task submission. Every ask is a task, so the options always ride along; the owner,
182
+ * due date and parent are only set when filled in. The title is only sent when the person wrote one;
183
+ * otherwise the server names the task from the prompt. With the assistant switched off nothing is run: it
184
+ * is a to-do.
185
+ */
186
+ export declare function newThreadToRequest(values: NewThreadValues): NewThreadRequest;
61
187
  export {};
@@ -0,0 +1,111 @@
1
+ import { type TaskStatusKey } from './taskLabels';
2
+ /**
3
+ * The deepest a task may nest, counting the top-level task as level 1 (a task, its sub-tasks, their
4
+ * sub-tasks, and so on). The table indents no further than the last level, and "Move to…" offers
5
+ * only parents that keep the moved subtree within it. The backend is asked to enforce the same cap.
6
+ */
7
+ export declare const MAX_TASK_DEPTH = 5;
8
+ /**
9
+ * The fields of a task the table reads. A task is a conversation with a `status`
10
+ * (`GET /v1/conversation/list`); callers' richer conversation types are accepted as-is, and the
11
+ * host keeps only the rows whose `status` is set (a chat has none).
12
+ */
13
+ export interface TaskListRow {
14
+ external_id: string;
15
+ /** The conversation title; null until a run (which holds the key) names it. */
16
+ title?: string | null;
17
+ description?: string | null;
18
+ /** `todo | generating | ready_for_review | done`; null for a plain chat. */
19
+ status?: string | null;
20
+ in_progress?: boolean | null;
21
+ run_started_at?: string | null;
22
+ due_at?: string | null;
23
+ last_error?: string | null;
24
+ /** Set while a run waits for the owner to grant access. */
25
+ pending_auth_request_id?: string | null;
26
+ goal_state?: unknown;
27
+ /** Shared with the workspace's members (false = private to its owner). */
28
+ is_shared?: boolean | null;
29
+ /** False for a teammate's shared task: they can finish it, but not run, edit or delete it. */
30
+ is_owner?: boolean | null;
31
+ /** The person who created the task (it is assigned to them when no agent works on it). */
32
+ owner_ext_id?: string | null;
33
+ /** The task this is a sub-task of. */
34
+ parent_conversation_ext_id?: string | null;
35
+ /** The workflow that created it, if any. */
36
+ workflow_ext_id?: string | null;
37
+ /** The agent that prepares the work (none for a plain to-do). */
38
+ agent_ext_id?: string | null;
39
+ skill_ref?: string | null;
40
+ /** The person who signs the task off; `can_signoff` is true when that is the viewer. */
41
+ signoff_ext_id?: string | null;
42
+ can_signoff?: boolean | null;
43
+ /** Who started the thread. */
44
+ created_by_ext_id?: string | null;
45
+ message_count?: number | null;
46
+ updated_at?: string | null;
47
+ }
48
+ /**
49
+ * Who has the next step on a task: its sign-off person if there is one, else its creator. They are
50
+ * notified when the previous step finishes, and they approve. Not necessarily the creator, and never
51
+ * the agent that did the work.
52
+ */
53
+ export declare const ownerExtId: (task: TaskListRow) => string | null;
54
+ /** A plain to-do (no agent, no skill): a person marks it done without a review. */
55
+ export declare const isPlainTodo: (task: TaskListRow) => boolean;
56
+ export type TaskFilter = 'all' | TaskStatusKey;
57
+ /** One line of the table: a task, how deep it sits under its parent and what its children add up to. */
58
+ export interface TaskGridRow<T extends TaskListRow> {
59
+ external_id: string;
60
+ task: T;
61
+ depth: number;
62
+ /** Present when the task has sub-tasks (all of them, whatever the filter shows). */
63
+ childStats?: {
64
+ done: number;
65
+ total: number;
66
+ };
67
+ expanded: boolean;
68
+ parentId: string | null;
69
+ /** Number of siblings shown at this level, and this row's 1-based place among them. */
70
+ setSize: number;
71
+ posInSet: number;
72
+ /** Shown only as the ancestor of a match (the filter or search did not select it itself). */
73
+ context: boolean;
74
+ }
75
+ /** The parent/child index of a task list. A parent that is not in the list (hidden, deleted) is ignored. */
76
+ export interface TaskTree<T extends TaskListRow> {
77
+ byId: Map<string, T>;
78
+ kids: Map<string, T[]>;
79
+ parentOf: Map<string, string>;
80
+ }
81
+ export declare function indexTasks<T extends TaskListRow>(tasks: T[]): TaskTree<T>;
82
+ /** Every task below `id`, at any depth (collapsed or filtered out included), without repeats. */
83
+ export declare function descendantIds<T extends TaskListRow>(tree: TaskTree<T>, id: string): string[];
84
+ /**
85
+ * The tasks `task` can be moved under: any other task that is not one of its own descendants and
86
+ * keeps the moved subtree within {@link MAX_TASK_DEPTH}.
87
+ */
88
+ export declare function moveTargets<T extends TaskListRow>(tasks: T[], task: T): T[];
89
+ export interface BuildTaskRowsOptions<T extends TaskListRow> {
90
+ /** Case-insensitive text matched against the title and description. */
91
+ query?: string;
92
+ /** The text shown for a task (defaults to its title): what the search reads. */
93
+ titleOf?: (task: T) => string;
94
+ /**
95
+ * Rows built last time, by id. A row whose task, depth, place and counts are unchanged is reused
96
+ * (same object), so the grid only refreshes the rows that really changed. Updated in place.
97
+ */
98
+ cache?: Map<string, TaskGridRow<T>>;
99
+ }
100
+ /**
101
+ * The table's lines, in order. The full view is the sub-task forest grouped by the status of each root
102
+ * (what needs review first, then what an agent is generating, to-dos, and finally what is done). A
103
+ * status filter or a search keeps every match together with its ancestors, which show as `context`
104
+ * rows rather than leaving their children orphaned. A task whose parent is not in the list (not
105
+ * visible, or deleted) is top-level, and a collapsed task hides its sub-tasks.
106
+ *
107
+ * With `compare` (the user sorted a column) tasks are sorted within their own level: roots among roots
108
+ * (no longer grouped by status) and each task's sub-tasks among themselves, so a sub-task never leaves
109
+ * its parent. AG Grid cannot do this itself without its Enterprise tree data.
110
+ */
111
+ export declare function buildTaskRows<T extends TaskListRow>(tasks: T[], filter: TaskFilter, collapsed: ReadonlySet<string>, compare?: (a: T, b: T) => number, options?: BuildTaskRowsOptions<T>): TaskGridRow<T>[];
@@ -0,0 +1,64 @@
1
+ import type { TaskStatusKey } from './taskLabels';
2
+ export interface TaskListLabels {
3
+ agent: string;
4
+ filterAll: string;
5
+ emptyTitle: string;
6
+ emptyMessage: string;
7
+ noMatches: string;
8
+ due: (when: string) => string;
9
+ overdue: (when: string) => string;
10
+ colTask: string;
11
+ colOwner: string;
12
+ ownerHint: string;
13
+ colOutputs: string;
14
+ changeOwner: string;
15
+ changeOwnerTitle: (taskName: string) => string;
16
+ changeOwnerMe: string;
17
+ preparedBy: (agentName: string) => string;
18
+ colDue: string;
19
+ colStatus: string;
20
+ me: string;
21
+ someone: string;
22
+ noDue: string;
23
+ colShared: string;
24
+ shared: string;
25
+ sharedOwnerOnly: string;
26
+ deleteOwnerOnly: string;
27
+ goalMet: (met: number, total: number) => string;
28
+ subtasksDone: (done: number, total: number) => string;
29
+ expandSubtasks: string;
30
+ collapseSubtasks: string;
31
+ selectAll: string;
32
+ selectTask: (name: string) => string;
33
+ markDone: string;
34
+ reopen: string;
35
+ markDoneMany: string;
36
+ markDoneManyHint: string;
37
+ deleteMany: string;
38
+ approve: string;
39
+ moveTo: string;
40
+ untitled: string;
41
+ fromWorkflow: (workflowName: string) => string;
42
+ searchLabel: string;
43
+ searchPlaceholder: string;
44
+ expandAll: string;
45
+ collapseAll: string;
46
+ moveToTitle: (taskName: string) => string;
47
+ moveToNone: string;
48
+ moveToSearch: string;
49
+ moveToEmpty: string;
50
+ moveToCancel: string;
51
+ subtasksSelected: (count: number) => string;
52
+ addSubtask: string;
53
+ edit: string;
54
+ rename: string;
55
+ delete: string;
56
+ grantAccess: string;
57
+ allowAccess: string;
58
+ moreActions: string;
59
+ activity: string;
60
+ /** Status tooltip: the latest step, how long ago, and who it is for. */
61
+ statusHint: (status: string, ago: string, forWho?: string) => string;
62
+ status: Partial<Record<TaskStatusKey, string>>;
63
+ }
64
+ export declare const DEFAULT_TASK_LIST_LABELS: TaskListLabels;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Column definitions for the Workflows grid. Every column has an explicit `colId` (AG Grid persists
3
+ * column state by id: see CLAUDE.md). The table supplies the cells that need behaviour through slots,
4
+ * which must be stable functions so the definitions are built once.
5
+ */
6
+ import type { ReactNode } from 'react';
7
+ import type { ColDef } from 'ag-grid-community';
8
+ import { type WorkflowListRow } from './workflowRows';
9
+ import type { WorkflowListLabels } from './workflowTableLabels';
10
+ export declare const WORKFLOW_COLUMN_ORDER: readonly ["name", "trigger", "last_run", "status", "shared", "actions"];
11
+ export type WorkflowColumnId = (typeof WORKFLOW_COLUMN_ORDER)[number];
12
+ export interface CreateWorkflowColumnsOptions<T extends WorkflowListRow> {
13
+ labels: WorkflowListLabels;
14
+ renderName: (workflow: T) => ReactNode;
15
+ renderTrigger: (workflow: T) => ReactNode;
16
+ renderStatus: (workflow: T) => ReactNode;
17
+ renderShared: (workflow: T) => ReactNode;
18
+ renderLastRun: (workflow: T) => ReactNode;
19
+ renderActions: (workflow: T) => ReactNode;
20
+ /** Plain text of the trigger cell, for sorting and the clipboard. */
21
+ getTriggerText: (workflow: T) => string;
22
+ }
23
+ export declare function createWorkflowColumns<T extends WorkflowListRow>(o: CreateWorkflowColumnsOptions<T>): ColDef<T>[];
@@ -0,0 +1,44 @@
1
+ import type { WorkflowTriggerType } from './taskLabels';
2
+ /**
3
+ * A row of the Workflows table: a saved workflow, or a skill (a virtual row: skills are global, not in
4
+ * the workflows table, and run on demand). Callers' richer types (`WorkflowResponse`) are accepted as-is.
5
+ */
6
+ export interface WorkflowListRow {
7
+ external_id: string;
8
+ name: string;
9
+ /** `skill` for a skill row; anything else is a saved workflow. */
10
+ kind?: 'workflow' | 'skill' | null;
11
+ description?: string | null;
12
+ /** Active: the trigger can start it. A spent one-shot pauses itself. Skills ignore it. */
13
+ active: boolean;
14
+ /** Shared with the workspace's members (false = private to its owner). */
15
+ shared?: boolean | null;
16
+ rrule?: string | null;
17
+ run_at?: string | null;
18
+ event_kind?: string | null;
19
+ after_conversation_ext_id?: string | null;
20
+ /** No trigger of its own: it only runs when someone presses Run. */
21
+ on_demand?: boolean | null;
22
+ prompt?: string | null;
23
+ skill_ref?: string | null;
24
+ agent_ext_id?: string | null;
25
+ last_fired_at?: string | null;
26
+ next_fire_at?: string | null;
27
+ last_error?: string | null;
28
+ /** False for a teammate's shared workflow: they can see it, but not change who sees it or delete it. */
29
+ is_owner?: boolean | null;
30
+ owner_ext_id?: string | null;
31
+ /** The user who created it (for the creator-or-workspace-owner rule). */
32
+ created_by_ext_id?: string | null;
33
+ }
34
+ export type WorkflowStatusKey = 'active' | 'paused' | 'on_demand';
35
+ export declare const isSkillRow: (row: WorkflowListRow) => boolean;
36
+ /** Does it start by itself (a time, a repeat, an event, or another task finishing)? */
37
+ export declare const hasTrigger: (row: WorkflowListRow) => boolean;
38
+ /**
39
+ * What a row is doing: a skill, or a workflow with no trigger of its own, only runs when someone presses
40
+ * Run (`on_demand`, no on/off switch); one with a trigger is `active` or `paused`.
41
+ */
42
+ export declare function workflowStatus(row: WorkflowListRow): WorkflowStatusKey;
43
+ /** What starts a workflow: another task being done, an event, a repeat, a single moment, or nothing. */
44
+ export declare function workflowTriggerType(workflow: WorkflowListRow): WorkflowTriggerType;
@@ -0,0 +1,53 @@
1
+ export interface WorkflowListLabels {
2
+ colName: string;
3
+ colType: string;
4
+ colTrigger: string;
5
+ colAction: string;
6
+ colAgent: string;
7
+ colStatus: string;
8
+ colShared: string;
9
+ colLastRun: string;
10
+ colNextRun: string;
11
+ shared: string;
12
+ sharedOwnerOnly: string;
13
+ deleteOwnerOnly: string;
14
+ typeSkill: string;
15
+ typeWorkflow: string;
16
+ statusActive: string;
17
+ statusPaused: string;
18
+ statusOnDemand: string;
19
+ activeSwitch: (name: string) => string;
20
+ agent: string;
21
+ myAssistant: string;
22
+ me: string;
23
+ someone: string;
24
+ never: string;
25
+ none: string;
26
+ reminder: string;
27
+ failed: string;
28
+ lastRunFailed: string;
29
+ openLastRun: string;
30
+ editWorkflow: string;
31
+ run: string;
32
+ runLater: string;
33
+ runNow: string;
34
+ runs: string;
35
+ delete: string;
36
+ moreActions: string;
37
+ searchLabel: string;
38
+ searchPlaceholder: string;
39
+ emptyTitle: string;
40
+ emptyMessage: string;
41
+ firstRun: string;
42
+ noMatches: string;
43
+ filterAll: string;
44
+ filterSkills: string;
45
+ filterWorkflows: string;
46
+ filterActive: string;
47
+ filterPaused: string;
48
+ makeActive: string;
49
+ makePaused: string;
50
+ selectAll: string;
51
+ selectWorkflow: (name: string) => string;
52
+ }
53
+ export declare const DEFAULT_WORKFLOW_LIST_LABELS: WorkflowListLabels;
@@ -11,6 +11,11 @@ export interface WorkflowScopeSource {
11
11
  totalCount: number;
12
12
  /** How many files a scope selects. */
13
13
  countMatching: (scope: WorkflowScope) => number;
14
+ /**
15
+ * The ids of the files a scope selects. A run is bound to explicit file ids, so a folder/label pick is
16
+ * resolved here, on the client, before anything is sent.
17
+ */
18
+ resolveDocuments?: (scope: WorkflowScope) => string[];
14
19
  }
15
20
  export interface WorkflowConfigDialogLabels {
16
21
  /** Primary button when the workflow gives no label of its own. */
@@ -3,4 +3,5 @@ export { composeWorkflowPrompt, buildLaunch, defaultInputs, validateInputs, isWo
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';
6
+ export { defaultScopeRenderer, resolveScopeInputs } from './scopeRender';
6
7
  export { WorkflowLauncher, type WorkflowLauncherProps } from './WorkflowLauncher';
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { WorkflowScopeSource } from './WorkflowConfigDialog';
3
+ import type { WorkflowDefinition, WorkflowField, WorkflowInputs, WorkflowScope } from './types';
4
+ /** The folder/label picker over the workspace's files: what a `scope` field renders by default. */
5
+ export declare function defaultScopeRenderer(scopeSource: WorkflowScopeSource | undefined): ((field: WorkflowField, value: WorkflowScope, onChange: (s: WorkflowScope) => void) => ReactNode) | undefined;
6
+ /**
7
+ * The inputs with every `scope` field resolved to explicit file ids (`documents`), so what is sent says
8
+ * exactly which files a run is bound to. The folders and labels stay, for showing the pick again.
9
+ */
10
+ export declare function resolveScopeInputs(workflow: Pick<WorkflowDefinition, 'inputs'>, inputs: WorkflowInputs, scopeSource: Pick<WorkflowScopeSource, 'resolveDocuments'> | undefined): WorkflowInputs;
@@ -100,6 +100,8 @@ export interface WorkflowDefinition {
100
100
  requiresFiles?: boolean;
101
101
  /** Default agent; absent = the user's own assistant. */
102
102
  defaultAgentId?: string;
103
+ /** A free-form entry ("my own instruction", "remind me"), not a named skill: it does not name the dialog. */
104
+ generic?: boolean;
103
105
  /** Can be the body of a task (unattended). `action` workflows are not. */
104
106
  schedulable?: boolean;
105
107
  /** Run options the form offers (all shown by default). */
@@ -0,0 +1,25 @@
1
+ /** When the assistant answers in a conversation (the API's `AssistantMode`). */
2
+ export type AssistantMode = 'always' | 'mentioned';
3
+ /** Every fixed string of the toggle. Pass a partial `labels` to reword. */
4
+ export interface AssistantModeToggleLabels {
5
+ always: string;
6
+ mentioned: string;
7
+ /** Tooltip / accessible description per mode. */
8
+ alwaysHint: string;
9
+ mentionedHint: string;
10
+ }
11
+ export declare const DEFAULT_ASSISTANT_MODE_TOGGLE_LABELS: AssistantModeToggleLabels;
12
+ export interface AssistantModeToggleProps {
13
+ mode: AssistantMode;
14
+ onModeChange: (mode: AssistantMode) => void;
15
+ disabled?: boolean;
16
+ labels?: Partial<AssistantModeToggleLabels>;
17
+ className?: string;
18
+ /** Test id (default `assistant-mode-toggle`); the current mode lands on `data-mode`. */
19
+ testId?: string;
20
+ }
21
+ /**
22
+ * Composer-toolbar switch between an ordinary chat (`always`: every message gets an answer) and a
23
+ * thread (`mentioned`: the assistant only answers when @mentioned).
24
+ */
25
+ export declare function AssistantModeToggle({ mode, onModeChange, disabled, labels, className, testId, }: AssistantModeToggleProps): import("react").JSX.Element;
@@ -0,0 +1,52 @@
1
+ import type { MentionCandidate, MentionKind } from './mentions';
2
+ /** Every fixed string of the mention menu and chips. Pass a partial `labels` to reword. */
3
+ export interface MentionLabels {
4
+ hint: string;
5
+ /** Accessible name of the list. */
6
+ list: string;
7
+ /** Polite count announced as the menu opens or narrows. */
8
+ resultCount: (count: number) => string;
9
+ /** Badge next to the assistant row. */
10
+ assistantBadge: string;
11
+ /** Chip tooltip: who a mention points at. */
12
+ chipTitle: (label: string, kind: MentionKind) => string;
13
+ }
14
+ export declare const DEFAULT_MENTION_LABELS: MentionLabels;
15
+ export interface MentionMenuProps {
16
+ open: boolean;
17
+ /** The chat composer sits at the bottom (menu above); a top-of-page field opens below. */
18
+ placement?: 'above' | 'below';
19
+ items: ReadonlyArray<MentionCandidate>;
20
+ /** Highlighted row (see `useListKeyNav`). */
21
+ selectedIndex: number;
22
+ setSelectedIndex: (i: number) => void;
23
+ /** Listbox id from `useListKeyNav`, so the textarea's `aria-controls` points here. */
24
+ listboxId?: string;
25
+ onSelect: (item: MentionCandidate) => void;
26
+ className?: string;
27
+ labels?: Partial<MentionLabels>;
28
+ /** Test id of the menu (default `mention-menu`). */
29
+ testId?: string;
30
+ /** Row prefix (`<prefix>-<id>`); default `mention-item`. */
31
+ itemTestIdPrefix?: string;
32
+ }
33
+ /**
34
+ * `@mention` autocomplete that floats over the composer. Presentational: the host (or
35
+ * {@link useMentionAutocomplete}) owns the query, the candidates and what picking does.
36
+ */
37
+ export declare const MentionMenu: import("react").NamedExoticComponent<MentionMenuProps>;
38
+ export interface MentionChipProps {
39
+ /** Text shown after the `@`. */
40
+ label: string;
41
+ kind: MentionKind;
42
+ /** Mentioned user's id (or `assistant`); lands on `data-mention-id`. */
43
+ id?: string;
44
+ /** Highlights a mention of the person reading. */
45
+ isSelf?: boolean;
46
+ labels?: Partial<MentionLabels>;
47
+ className?: string;
48
+ /** Test id; default `mention-chip-<id>`. */
49
+ testId?: string;
50
+ }
51
+ /** An `@mention` inside message text. Inline, so it sits in a markdown paragraph. */
52
+ export declare function MentionChip({ label, kind, id, isSelf, labels, className, testId, }: MentionChipProps): import("react").JSX.Element;