@field-studio/sdk 0.0.0-stage → 0.1.1

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 (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +131 -2
  3. package/dist/index.d.ts +97 -0
  4. package/dist/index.js +129 -0
  5. package/dist/node/identity.d.ts +68 -0
  6. package/dist/node/identity.js +1 -0
  7. package/dist/node/index.d.ts +41 -0
  8. package/dist/node/index.js +165 -0
  9. package/dist/react/agent/AgentEditor.d.ts +16 -0
  10. package/dist/react/agent/AgentEditor.js +51 -0
  11. package/dist/react/agent/MCPManager.d.ts +12 -0
  12. package/dist/react/agent/MCPManager.js +72 -0
  13. package/dist/react/agent/SkillImport.d.ts +8 -0
  14. package/dist/react/agent/SkillImport.js +31 -0
  15. package/dist/react/agent/SkillViewer.d.ts +7 -0
  16. package/dist/react/agent/SkillViewer.js +61 -0
  17. package/dist/react/agent/catalog.css +205 -0
  18. package/dist/react/agent/index.d.ts +7 -0
  19. package/dist/react/agent/index.js +5 -0
  20. package/dist/react/agent/skillTitle.d.ts +3 -0
  21. package/dist/react/agent/skillTitle.js +4 -0
  22. package/dist/react/agent/types.d.ts +46 -0
  23. package/dist/react/agent/types.js +1 -0
  24. package/dist/react/assistant/AssistantPanel.d.ts +15 -0
  25. package/dist/react/assistant/AssistantPanel.js +144 -0
  26. package/dist/react/assistant/AssistantProvider.d.ts +119 -0
  27. package/dist/react/assistant/AssistantProvider.js +427 -0
  28. package/dist/react/assistant/QuestionPanel.d.ts +8 -0
  29. package/dist/react/assistant/QuestionPanel.js +32 -0
  30. package/dist/react/assistant/TaskComposer.d.ts +25 -0
  31. package/dist/react/assistant/TaskComposer.js +354 -0
  32. package/dist/react/assistant/TaskFiles.d.ts +24 -0
  33. package/dist/react/assistant/TaskFiles.js +107 -0
  34. package/dist/react/assistant/assistant.css +428 -0
  35. package/dist/react/assistant/composer.css +116 -0
  36. package/dist/react/assistant/files.css +19 -0
  37. package/dist/react/assistant/index.d.ts +10 -0
  38. package/dist/react/assistant/index.js +6 -0
  39. package/dist/react/assistant/layout.d.ts +7 -0
  40. package/dist/react/assistant/layout.js +19 -0
  41. package/dist/react/assistant/messages.d.ts +355 -0
  42. package/dist/react/assistant/messages.js +239 -0
  43. package/dist/react/assistant/questions.css +6 -0
  44. package/dist/react/assistant/types.d.ts +85 -0
  45. package/dist/react/assistant/types.js +1 -0
  46. package/dist/react/auth/AuthShell.d.ts +35 -0
  47. package/dist/react/auth/AuthShell.js +197 -0
  48. package/dist/react/auth/RoleManager.d.ts +23 -0
  49. package/dist/react/auth/RoleManager.js +95 -0
  50. package/dist/react/auth/auth.css +70 -0
  51. package/dist/react/auth/index.d.ts +2 -0
  52. package/dist/react/auth/index.js +1 -0
  53. package/dist/react/index.d.ts +57 -0
  54. package/dist/react/index.js +177 -0
  55. package/dist/react/ui/Controls.d.ts +78 -0
  56. package/dist/react/ui/Controls.js +234 -0
  57. package/dist/react/ui/base.css +261 -0
  58. package/dist/react/ui/controls.css +35 -0
  59. package/dist/react/ui/index.d.ts +2 -0
  60. package/dist/react/ui/index.js +2 -0
  61. package/dist/workspace.d.ts +107 -0
  62. package/dist/workspace.js +139 -0
  63. package/package.json +86 -3
@@ -0,0 +1,427 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { usePlatform, usePlatformActions } from '../index.js';
3
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
4
+ import { CHAT_MIN_WIDTH, chatMaxWidth, clampChatWidth, readChatLayout } from './layout.js';
5
+ import { AssistantDisplayContext, chinese, english } from './messages.js';
6
+ import { submitWithAttachments } from './TaskFiles.js';
7
+ const AssistantContext = createContext(null);
8
+ /** Register the assistant once per host page tree. */
9
+ export function AssistantProvider({ storageKey = 'field-studio-chat-layout', name = 'Assistant', locale = 'en', messages: overrides, children, }) {
10
+ const display = useMemo(() => {
11
+ const defaults = locale.split('-')[0].toLowerCase() === 'zh' ? chinese : english;
12
+ return { name: name.trim() || 'Assistant', locale, messages: overrides ? { ...defaults, ...overrides } : defaults };
13
+ }, [name, locale, overrides]);
14
+ const { messages } = display;
15
+ const errorMessages = useRef(messages);
16
+ useEffect(() => { errorMessages.current = messages; }, [messages]);
17
+ const platform = usePlatform();
18
+ const uiActions = usePlatformActions();
19
+ const [page, setPage] = useState({
20
+ pageContext: { page: '' },
21
+ taskInput: {},
22
+ contextScope: '',
23
+ contextOptions: [],
24
+ fingerprint: '',
25
+ pageTitle: '',
26
+ hasDraft: false,
27
+ suggestions: [],
28
+ });
29
+ const taskSelectedRef = useRef(undefined);
30
+ const [viewInstanceId] = useState(() => `view-${crypto.randomUUID()}`);
31
+ const viewState = useRef({
32
+ view_instance_id: viewInstanceId,
33
+ revision: 0,
34
+ fingerprint: '',
35
+ });
36
+ const [open, setOpen] = useState(false);
37
+ const [width, setWidth] = useState(() => readChatLayout(storageKey).width);
38
+ const [resizing, setResizing] = useState(false);
39
+ const [tasks, setTasks] = useState([]);
40
+ const [activeTaskId, setActiveTaskId] = useState(null);
41
+ const [prompt, setPrompt] = useState('');
42
+ const [attachments, setAttachments] = useState([]);
43
+ const [uploadStatus, setUploadStatus] = useState('');
44
+ const [composerVersion, setComposerVersion] = useState(0);
45
+ const [excludedContexts, setExcludedContexts] = useState(() => new Set());
46
+ const [catalog, setCatalog] = useState({
47
+ agents: [],
48
+ skills: [],
49
+ config: {},
50
+ });
51
+ const [busy, setBusy] = useState(false);
52
+ const [error, setError] = useState('');
53
+ const [toast, setToast] = useState('');
54
+ const historyInitialized = useRef(false);
55
+ const task = tasks.find((t) => t.id === activeTaskId);
56
+ const aiAvailable = Boolean(catalog.config.ai_available);
57
+ const pendingProposals = task?.proposals?.filter((proposal) => proposal.status === 'pending').length ?? 0;
58
+ const awaitingReply = Boolean(task && ['queued', 'running'].includes(task.status));
59
+ const canSend = aiAvailable && !awaitingReply && !pendingProposals;
60
+ const composerDraft = Boolean(prompt.trim() || attachments.length) || page.hasDraft;
61
+ const selectedSections = page.contextOptions
62
+ .filter((option) => !excludedContexts.has(`${page.contextScope}:${option.id}`))
63
+ .map((option) => option.id);
64
+ const selection = { ...page.pageContext, sections: selectedSections };
65
+ const internalFingerprint = JSON.stringify([
66
+ page.fingerprint,
67
+ [...excludedContexts].sort(),
68
+ ]);
69
+ if (viewState.current.fingerprint !== internalFingerprint) {
70
+ viewState.current = {
71
+ ...viewState.current,
72
+ fingerprint: internalFingerprint,
73
+ revision: viewState.current.revision + 1,
74
+ };
75
+ }
76
+ const bindPage = useCallback((next, onTaskSelected) => {
77
+ taskSelectedRef.current = onTaskSelected;
78
+ setPage((current) => JSON.stringify({
79
+ pageContext: current.pageContext,
80
+ taskInput: current.taskInput,
81
+ contextScope: current.contextScope,
82
+ contextOptions: current.contextOptions,
83
+ fingerprint: current.fingerprint,
84
+ pageTitle: current.pageTitle,
85
+ hasDraft: current.hasDraft,
86
+ suggestions: current.suggestions.map((s) => s.text),
87
+ }) ===
88
+ JSON.stringify({
89
+ pageContext: next.pageContext,
90
+ taskInput: next.taskInput,
91
+ contextScope: next.contextScope,
92
+ contextOptions: next.contextOptions,
93
+ fingerprint: next.fingerprint,
94
+ pageTitle: next.pageTitle,
95
+ hasDraft: next.hasDraft,
96
+ suggestions: next.suggestions.map((s) => s.text),
97
+ })
98
+ ? current
99
+ : next);
100
+ }, []);
101
+ const refresh = useCallback(async () => {
102
+ const [history, snapshot] = await Promise.all([
103
+ platform.request('/tasks'),
104
+ platform.catalog.get(),
105
+ ]);
106
+ setTasks(history);
107
+ setCatalog(snapshot);
108
+ if (!historyInitialized.current) {
109
+ historyInitialized.current = true;
110
+ const latest = history[0];
111
+ if (latest) {
112
+ setActiveTaskId(latest.id);
113
+ taskSelectedRef.current?.(latest);
114
+ }
115
+ }
116
+ }, [platform]);
117
+ useEffect(() => {
118
+ void refresh().catch((e) => setError(e instanceof Error ? e.message : errorMessages.current.connectionError));
119
+ }, [refresh]);
120
+ useEffect(() => {
121
+ const timer = setInterval(() => {
122
+ void refresh().catch(() => undefined);
123
+ }, tasks.some((t) => t.status === 'running' || t.status === 'queued')
124
+ ? 1500
125
+ : 15000);
126
+ return () => clearInterval(timer);
127
+ }, [tasks, refresh]);
128
+ useEffect(() => {
129
+ if (!toast)
130
+ return;
131
+ const id = setTimeout(() => setToast(''), 4000);
132
+ return () => clearTimeout(id);
133
+ }, [toast]);
134
+ useEffect(() => {
135
+ try {
136
+ window.localStorage.setItem(storageKey, JSON.stringify({ v: 3, width }));
137
+ }
138
+ catch {
139
+ /* Storage may be unavailable in a restricted browser. */
140
+ }
141
+ }, [width, storageKey]);
142
+ useEffect(() => {
143
+ const clamp = () => {
144
+ if (window.innerWidth > 760)
145
+ setWidth((current) => clampChatWidth(current));
146
+ };
147
+ window.addEventListener('resize', clamp);
148
+ clamp();
149
+ return () => window.removeEventListener('resize', clamp);
150
+ }, []);
151
+ useEffect(() => {
152
+ document.body.classList.toggle('sidepanel-resizing', resizing);
153
+ return () => document.body.classList.remove('sidepanel-resizing');
154
+ }, [resizing]);
155
+ useEffect(() => {
156
+ if (!task)
157
+ return;
158
+ for (const event of task.events ?? []) {
159
+ if (event.stage !== 'ui.action.requested' || !event.data)
160
+ continue;
161
+ void uiActions
162
+ .handleAction(task.id, event.data)
163
+ .catch((e) => setError(e instanceof Error ? e.message : errorMessages.current.pageActionFailed));
164
+ }
165
+ }, [uiActions, task]);
166
+ const mutate = async (action, message) => {
167
+ setBusy(true);
168
+ setError('');
169
+ try {
170
+ await action();
171
+ if (message)
172
+ setToast(message);
173
+ }
174
+ catch (e) {
175
+ setError(e instanceof Error ? e.message : messages.actionFailed);
176
+ }
177
+ finally {
178
+ setBusy(false);
179
+ }
180
+ };
181
+ const run = async (text, agentId, includeAttachments = false, skillIds = [], workspaceFileIds = [], delegateTo = []) => {
182
+ if (!text.trim())
183
+ return;
184
+ if (task && !agentId && includeAttachments) {
185
+ if (!canSend)
186
+ return;
187
+ await mutate(async () => {
188
+ const context = await platform.contexts.publish({
189
+ view_instance_id: viewInstanceId,
190
+ revision: ++viewState.current.revision,
191
+ input: {
192
+ ...page.taskInput,
193
+ page_context: selection,
194
+ },
195
+ });
196
+ const next = await submitWithAttachments(attachments, (ids) => platform.request(`/tasks/${task.id}/messages`, {
197
+ method: 'POST',
198
+ headers: { 'Content-Type': 'application/json' },
199
+ body: JSON.stringify({
200
+ prompt: text.trim(),
201
+ agent_id: task.agent_id,
202
+ attachment_ids: ids,
203
+ skill_ids: skillIds,
204
+ workspace_file_ids: workspaceFileIds,
205
+ ...(delegateTo.length ? { delegate_to: delegateTo } : {}),
206
+ page_context: selection,
207
+ context_id: context.context_id,
208
+ }),
209
+ }), setUploadStatus, platform, messages);
210
+ setTasks((previous) => [
211
+ next,
212
+ ...previous.filter((item) => item.id !== next.id),
213
+ ]);
214
+ setActiveTaskId(next.id);
215
+ setPrompt('');
216
+ setAttachments([]);
217
+ setComposerVersion((v) => v + 1);
218
+ });
219
+ return;
220
+ }
221
+ if (agentId) {
222
+ const agent = catalog.agents.find((e) => e.id === agentId);
223
+ if (!agent?.enabled || agent.archived) {
224
+ setError(messages.selectAgent);
225
+ return;
226
+ }
227
+ }
228
+ await mutate(async () => {
229
+ const context = await platform.contexts.publish({
230
+ view_instance_id: viewInstanceId,
231
+ revision: ++viewState.current.revision,
232
+ input: {
233
+ ...page.taskInput,
234
+ ...(includeAttachments ? { page_context: selection } : {}),
235
+ },
236
+ });
237
+ const conversation = await platform.conversations.open({
238
+ context_id: context.context_id,
239
+ });
240
+ const next = await submitWithAttachments(includeAttachments ? attachments : [], (ids) => platform.conversations.send(conversation.id, {
241
+ ...page.taskInput,
242
+ ...(ids.length ? { attachment_ids: ids } : {}),
243
+ prompt: text.trim(),
244
+ ...(skillIds.length ? { skill_ids: skillIds } : {}),
245
+ ...(workspaceFileIds.length
246
+ ? { workspace_file_ids: workspaceFileIds }
247
+ : {}),
248
+ ...(delegateTo.length ? { delegate_to: delegateTo } : {}),
249
+ ...(agentId ? { agent_id: agentId } : {}),
250
+ ...(includeAttachments ? { page_context: selection } : {}),
251
+ context_id: context.context_id,
252
+ }), setUploadStatus, platform, messages);
253
+ setTasks((prev) => [next, ...prev]);
254
+ setActiveTaskId(next.id);
255
+ setPrompt('');
256
+ if (includeAttachments) {
257
+ setAttachments([]);
258
+ setComposerVersion((v) => v + 1);
259
+ }
260
+ setOpen(true);
261
+ });
262
+ };
263
+ const updateTask = async (action) => {
264
+ if (!task)
265
+ return;
266
+ await mutate(() => platform.request(`/tasks/${task.id}/${action}`, {
267
+ method: 'POST',
268
+ headers: { 'Content-Type': 'application/json' },
269
+ body: JSON.stringify({}),
270
+ }), action === 'cancel' ? messages.taskCancelled : messages.taskRequeued);
271
+ };
272
+ const decide = async (proposalId, decision) => {
273
+ if (!task)
274
+ return;
275
+ await mutate(async () => {
276
+ const result = await platform.request(`/tasks/${task.id}/proposals/${proposalId}/${decision}`, {
277
+ method: 'POST',
278
+ headers: { 'Content-Type': 'application/json' },
279
+ body: JSON.stringify({ expected_version: task.version }),
280
+ });
281
+ const updated = 'task' in result ? result.task : result;
282
+ setTasks((previous) => previous.map((item) => (item.id === updated.id ? updated : item)));
283
+ setToast('task' in result && result.receipt
284
+ ? result.receipt.message
285
+ : messages.proposalRejected);
286
+ });
287
+ };
288
+ const review = async (decision, comment) => {
289
+ if (!task)
290
+ return;
291
+ setBusy(true);
292
+ setError('');
293
+ try {
294
+ const reviewed = await platform.tasks.review(task.id, { expected_version: task.version, decision, comment });
295
+ setTasks((previous) => {
296
+ const values = new Map(previous.map((item) => [item.id, item]));
297
+ values.set(reviewed.task.id, reviewed.task);
298
+ if (reviewed.follow_up)
299
+ values.set(reviewed.follow_up.id, reviewed.follow_up);
300
+ return [...values.values()];
301
+ });
302
+ if (reviewed.follow_up)
303
+ setActiveTaskId(reviewed.follow_up.id);
304
+ await refresh();
305
+ }
306
+ catch (e) {
307
+ setError(e instanceof Error ? e.message : messages.actionFailed);
308
+ }
309
+ finally {
310
+ setBusy(false);
311
+ }
312
+ };
313
+ const answerInput = async (requestId, answers) => {
314
+ if (!task)
315
+ return;
316
+ await mutate(() => platform.request(`/tasks/${task.id}/input`, {
317
+ method: 'POST',
318
+ headers: { 'Content-Type': 'application/json' },
319
+ body: JSON.stringify({ request_id: requestId, answers }),
320
+ }));
321
+ };
322
+ const openTask = useCallback((taskId) => {
323
+ setActiveTaskId(taskId);
324
+ const selected = tasks.find((t) => t.id === taskId);
325
+ if (selected)
326
+ taskSelectedRef.current?.(selected);
327
+ }, [tasks]);
328
+ const newConversation = useCallback(() => {
329
+ setActiveTaskId(null);
330
+ setPrompt('');
331
+ }, []);
332
+ const toggleContext = useCallback((key, checked) => {
333
+ setExcludedContexts((previous) => {
334
+ const next = new Set(previous);
335
+ if (checked)
336
+ next.delete(key);
337
+ else
338
+ next.add(key);
339
+ return next;
340
+ });
341
+ }, []);
342
+ const viewStateSnapshot = useCallback(() => ({
343
+ view_instance_id: viewState.current.view_instance_id,
344
+ revision: viewState.current.revision,
345
+ }), []);
346
+ const bumpRevision = useCallback(() => {
347
+ viewState.current.revision += 1;
348
+ }, []);
349
+ const responderName = (agentId) => agentId === 'assistant'
350
+ ? display.name
351
+ : (catalog.agents.find((e) => e.id === agentId)?.name ?? agentId ?? '');
352
+ const api = {
353
+ open,
354
+ setOpen,
355
+ width,
356
+ setWidth,
357
+ resizing,
358
+ setResizing,
359
+ minWidth: CHAT_MIN_WIDTH,
360
+ maxWidth: chatMaxWidth(),
361
+ tasks,
362
+ task,
363
+ openTask,
364
+ newConversation,
365
+ run,
366
+ prompt,
367
+ setPrompt,
368
+ attachments,
369
+ setAttachments,
370
+ uploadStatus,
371
+ composerVersion,
372
+ clearComposer: (resetAttachments = true) => {
373
+ setPrompt('');
374
+ if (resetAttachments) {
375
+ setAttachments([]);
376
+ setComposerVersion((v) => v + 1);
377
+ }
378
+ },
379
+ catalog,
380
+ responderName,
381
+ canSend,
382
+ aiAvailable,
383
+ awaitingReply,
384
+ pendingProposals,
385
+ busy,
386
+ error,
387
+ setError,
388
+ toast,
389
+ updateTask,
390
+ decide,
391
+ review,
392
+ answerInput,
393
+ excludedContexts,
394
+ toggleContext,
395
+ selectedSections,
396
+ viewStateSnapshot,
397
+ bumpRevision,
398
+ composerDraft,
399
+ refresh,
400
+ config: {
401
+ contextScope: page.contextScope,
402
+ contextOptions: page.contextOptions,
403
+ pageTitle: page.pageTitle,
404
+ suggestions: page.suggestions,
405
+ },
406
+ };
407
+ return (_jsx(AssistantDisplayContext.Provider, { value: display, children: _jsxs(AssistantContext.Provider, { value: api, children: [_jsx(BindContext.Provider, { value: bindPage, children: children }), toast && _jsx("div", { className: "toast", role: "status", lang: locale, children: toast })] }) }));
408
+ }
409
+ const BindContext = createContext(null);
410
+ /** Feed the current page identity into the assistant from inside the tree. */
411
+ export function AssistantPageBinding({ hasDraft = false, taskInput = {}, onTaskSelected, suggestions = [], ...rest }) {
412
+ const bindPage = useContext(BindContext);
413
+ if (!bindPage)
414
+ throw new Error('AssistantPageBinding requires AssistantProvider');
415
+ const bound = { ...rest, taskInput, hasDraft, suggestions };
416
+ useEffect(() => {
417
+ // bindPage skips no-op updates internally, so every render may call it.
418
+ bindPage(bound, onTaskSelected);
419
+ });
420
+ return null;
421
+ }
422
+ export function useAssistant() {
423
+ const value = useContext(AssistantContext);
424
+ if (!value)
425
+ throw new Error('useAssistant requires AssistantProvider');
426
+ return value;
427
+ }
@@ -0,0 +1,8 @@
1
+ import type { PendingInput } from './types.js';
2
+ import './questions.css';
3
+ /** Render task-owned Codex questions and require an explicit answer to each one. */
4
+ export default function QuestionPanel({ request, busy, onSubmit }: {
5
+ request: PendingInput;
6
+ busy: boolean;
7
+ onSubmit: (answers: Record<string, string[]>) => Promise<void>;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import './questions.css';
4
+ import { useAssistantDisplay } from './messages.js';
5
+ import { RadioGroup } from '../ui/index.js';
6
+ /** Render task-owned Codex questions and require an explicit answer to each one. */
7
+ export default function QuestionPanel({ request, busy, onSubmit }) {
8
+ const { messages } = useAssistantDisplay();
9
+ const [choices, setChoices] = useState({});
10
+ const [texts, setTexts] = useState({});
11
+ const [sending, setSending] = useState(false);
12
+ const [error, setError] = useState('');
13
+ const value = (id) => choices[id] === '__other__' || !request.questions.find(q => q.id === id)?.options?.length ? texts[id]?.trim() : choices[id];
14
+ const disabled = busy || sending;
15
+ return _jsxs("form", { className: "question-panel", "aria-label": messages.agentQuestions, onSubmit: async (event) => {
16
+ event.preventDefault();
17
+ if (disabled || request.questions.some(q => !value(q.id)))
18
+ return;
19
+ setSending(true);
20
+ setError('');
21
+ try {
22
+ await onSubmit(Object.fromEntries(request.questions.map(q => [q.id, [value(q.id)]])));
23
+ }
24
+ catch (e) {
25
+ setError(e instanceof Error ? e.message : messages.answerError);
26
+ }
27
+ finally {
28
+ setSending(false);
29
+ }
30
+ }, children: [_jsx("p", { className: "question-intro", children: messages.moreInformation }), request.questions.map(q => _jsxs("fieldset", { disabled: disabled, children: [_jsx("legend", { children: q.question }), Boolean(q.options?.length) && _jsx(RadioGroup, { "aria-label": messages.questionOptions(q.question), disabled: disabled, value: choices[q.id], onChange: answer => setChoices(previous => ({ ...previous, [q.id]: answer })), options: [...(q.options ?? []).map(option => ({ value: option.label, label: option.label, description: option.description })),
31
+ ...(q.isOther ? [{ value: '__other__', label: messages.otherAnswer }] : [])] }), (!q.options?.length || choices[q.id] === '__other__') && _jsx("input", { className: "question-text", "aria-label": q.question, type: q.isSecret ? 'password' : 'text', autoComplete: "off", maxLength: 4000, value: texts[q.id] ?? '', onChange: e => setTexts(previous => ({ ...previous, [q.id]: e.target.value })) })] }, q.id)), error && _jsx("p", { role: "alert", className: "error-banner", children: error }), _jsx("button", { className: "button primary", type: "submit", disabled: disabled || request.questions.some(q => !value(q.id)), children: sending ? messages.submitting : messages.submitAnswer })] });
32
+ }
@@ -0,0 +1,25 @@
1
+ import type { Skill } from './types.js';
2
+ import './composer.css';
3
+ type Props = {
4
+ prompt: string;
5
+ onPrompt: (value: string) => void;
6
+ attachments: File[];
7
+ onAttachments: (files: File[]) => void;
8
+ skills: Skill[];
9
+ /** Enabled AI agents offered alongside files by the @ trigger. */
10
+ agents?: {
11
+ id: string;
12
+ name: string;
13
+ }[];
14
+ busy: boolean;
15
+ available: boolean;
16
+ sandbox: boolean;
17
+ uploadStatus: string;
18
+ /** While true the send slot becomes a stop control for the active task. */
19
+ running?: boolean;
20
+ onStop?: () => void;
21
+ onSubmit: (skills: string[], files: string[], agents: string[]) => void;
22
+ };
23
+ /** Compose a task with explicit skills and immutable references to persistent workspace files. */
24
+ export default function TaskComposer({ prompt, onPrompt, attachments, onAttachments, skills, agents, busy, available, sandbox, uploadStatus, running, onStop, onSubmit, }: Props): import("react").JSX.Element;
25
+ export {};