@mcp-b/react-components 0.7.1 → 0.8.0

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 (58) hide show
  1. package/dist/{CodeBlock-D9koxDA7.js → CodeBlock-XNQOupQ3.js} +1 -1
  2. package/dist/{FileTree-BdK93Uuu.js → FileTree-wMyZhhHO.js} +1 -1
  3. package/dist/{ModelSelector-MQvK-pNb.js → ModelSelector-9G_-GooI.js} +1 -1
  4. package/dist/{ThinkChatContext-CC94HL4u.d.ts → ThinkChatContext-BLAAb8J5.d.ts} +1 -1
  5. package/dist/components/Activity.js +1 -1
  6. package/dist/components/AgentChat.js +12 -7
  7. package/dist/components/AgentConnection.js +2 -2
  8. package/dist/components/Artifact.js +1 -1
  9. package/dist/components/BrowserLiveView.js +1 -1
  10. package/dist/components/BrowserReplay.js +1 -1
  11. package/dist/components/ChainOfThought.d.ts +1 -1
  12. package/dist/components/ChainOfThought.js +1 -1
  13. package/dist/components/ChatGptSignInScreen.js +2 -2
  14. package/dist/components/CodeBlock.js +1 -1
  15. package/dist/components/Commit.js +1 -1
  16. package/dist/components/ContextMenu.js +1 -1
  17. package/dist/components/Conversation.js +1 -1
  18. package/dist/components/Dialog.js +1 -1
  19. package/dist/components/EnvironmentVariables.js +1 -1
  20. package/dist/components/FileTree.js +1 -1
  21. package/dist/components/McpServerPicker.js +7 -5
  22. package/dist/components/Menubar.js +1 -1
  23. package/dist/components/Message.js +1 -1
  24. package/dist/components/MessageScroller.js +1 -1
  25. package/dist/components/ModelSelector.js +1 -1
  26. package/dist/components/NavigationMenu.js +1 -1
  27. package/dist/components/PromptInput.js +6 -5
  28. package/dist/components/Queue.js +1 -1
  29. package/dist/components/Reasoning.js +1 -1
  30. package/dist/components/Select.js +1 -1
  31. package/dist/components/Sources.js +1 -1
  32. package/dist/components/Stepper.js +1 -1
  33. package/dist/components/Task.js +1 -1
  34. package/dist/components/Terminal.js +4 -3
  35. package/dist/components/TestResults.js +1 -1
  36. package/dist/components/ThinkChat.d.ts +6 -8
  37. package/dist/components/ThinkChatActivity.js +4 -3
  38. package/dist/components/ThinkChatContext.d.ts +1 -1
  39. package/dist/components/ThinkChatToolPanels.js +1 -1
  40. package/dist/components/ThinkChatToolParts.js +4 -4
  41. package/dist/components/ThinkExecutionWorkbench.d.ts +27 -0
  42. package/dist/components/ThinkExecutionWorkbench.js +450 -0
  43. package/dist/components/ThinkFullApp.d.ts +47 -9
  44. package/dist/components/ThinkFullApp.js +155 -72
  45. package/dist/components/ThinkThreadPicker.d.ts +88 -0
  46. package/dist/components/ThinkThreadPicker.js +282 -0
  47. package/dist/components/WebPreview.js +1 -1
  48. package/dist/components/WorkspaceExplorer.js +5 -4
  49. package/dist/components/icons.d.ts +2 -2
  50. package/dist/components/icons.js +2 -2
  51. package/dist/{copy-button-TVhDAroI.js → copy-button-C6JSKtFE.js} +1 -1
  52. package/dist/{icons-BRI54ATJ.d.ts → icons-CbjtbIJK.d.ts} +2 -1
  53. package/dist/{icons-BAlTbWWP.js → icons-D2Q5n5C1.js} +11 -1
  54. package/dist/styles/index.css +1 -0
  55. package/dist/styles/think-full-app.css +439 -26
  56. package/dist/styles/think-thread-picker.css +449 -0
  57. package/dist/utils/mcp-server-catalog.d.ts +5 -2
  58. package/package.json +7 -8
@@ -0,0 +1,450 @@
1
+ import { t as cx } from "../class-names-9UtZwb0J.js";
2
+ import { A as SearchIcon, D as PlayIcon, L as XIcon, N as SquareIcon, T as PauseIcon, k as RefreshIcon, u as DotIcon } from "../icons-D2Q5n5C1.js";
3
+ import { Button } from "./Button.js";
4
+ import { Badge } from "./Badge.js";
5
+ import * as React from "react";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/components/ThinkExecutionWorkbench.tsx
8
+ const executionPanelPageSize = 20;
9
+ function formatTimestamp(value) {
10
+ if (value == null) return "Not recorded";
11
+ const date = value instanceof Date ? value : new Date(value);
12
+ return Number.isNaN(date.getTime()) ? "Not recorded" : date.toLocaleString();
13
+ }
14
+ function formatJson(value) {
15
+ return JSON.stringify(value, null, 2);
16
+ }
17
+ function getErrorMessage(error) {
18
+ return error instanceof Error ? error.message : String(error);
19
+ }
20
+ function submissionStatusColor(status) {
21
+ if (status === "completed") return "success";
22
+ if (status === "error") return "destructive";
23
+ if (status === "aborted" || status === "skipped") return "warning";
24
+ if (status === "running") return "primary";
25
+ return "neutral";
26
+ }
27
+ function workflowStatusColor(status) {
28
+ const value = String(status);
29
+ if (value === "complete") return "success";
30
+ if (value === "errored" || value === "terminated") return "destructive";
31
+ if (value === "paused" || value === "waiting") return "warning";
32
+ if (value === "running") return "primary";
33
+ return "neutral";
34
+ }
35
+ function StatusBadge({ children, color }) {
36
+ return /* @__PURE__ */ jsxs(Badge, {
37
+ className: "think-execution-workbench__status",
38
+ color,
39
+ size: "sm",
40
+ children: [/* @__PURE__ */ jsx(DotIcon, {}), /* @__PURE__ */ jsx("span", { children })]
41
+ });
42
+ }
43
+ function isSubmissionCancelable(status) {
44
+ return status === "pending" || status === "running";
45
+ }
46
+ function isWorkflowTerminal(status) {
47
+ const value = String(status);
48
+ return value === "complete" || value === "errored" || value === "terminated";
49
+ }
50
+ function ThinkExecutionWorkbench({ backButton, className, pageSize = executionPanelPageSize, ref, source, title = "Execution", ...props }) {
51
+ const inspectionId = React.useId();
52
+ const submissionsId = React.useId();
53
+ const executionsId = React.useId();
54
+ const [busyAction, setBusyAction] = React.useState("refresh");
55
+ const [error, setError] = React.useState(null);
56
+ const [submissions, setSubmissions] = React.useState([]);
57
+ const [workflows, setWorkflows] = React.useState(null);
58
+ const [selectedSubmission, setSelectedSubmission] = React.useState(null);
59
+ const [selectedWorkflow, setSelectedWorkflow] = React.useState(null);
60
+ const loadData = React.useCallback(async () => {
61
+ const [nextSubmissions, nextWorkflows] = await Promise.all([source.listSubmissions({ limit: pageSize }), source.getWorkflows({
62
+ limit: pageSize,
63
+ orderBy: "desc"
64
+ })]);
65
+ setSubmissions(nextSubmissions);
66
+ setWorkflows(nextWorkflows);
67
+ }, [pageSize, source]);
68
+ const refresh = React.useCallback(async () => {
69
+ setBusyAction("refresh");
70
+ setError(null);
71
+ try {
72
+ await loadData();
73
+ } catch (nextError) {
74
+ setError(getErrorMessage(nextError));
75
+ } finally {
76
+ setBusyAction(null);
77
+ }
78
+ }, [loadData]);
79
+ const runAction = React.useCallback(async (key, action) => {
80
+ setBusyAction(key);
81
+ setError(null);
82
+ try {
83
+ await action();
84
+ await loadData();
85
+ } catch (nextError) {
86
+ setError(getErrorMessage(nextError));
87
+ } finally {
88
+ setBusyAction(null);
89
+ }
90
+ }, [loadData]);
91
+ React.useEffect(() => {
92
+ refresh();
93
+ }, [refresh]);
94
+ return /* @__PURE__ */ jsxs("div", {
95
+ ref,
96
+ className: cx("think-execution-workbench", className),
97
+ ...props,
98
+ children: [
99
+ /* @__PURE__ */ jsxs("header", {
100
+ className: "think-execution-workbench__header",
101
+ children: [/* @__PURE__ */ jsxs("div", {
102
+ className: "think-execution-workbench__heading",
103
+ children: [backButton, /* @__PURE__ */ jsx("h2", {
104
+ className: "think-execution-workbench__title",
105
+ children: title
106
+ })]
107
+ }), /* @__PURE__ */ jsxs(Button, {
108
+ type: "button",
109
+ variant: "outline",
110
+ color: "neutral",
111
+ size: "sm",
112
+ className: "think-execution-workbench__refresh",
113
+ "aria-label": "Refresh execution records",
114
+ disabled: busyAction !== null,
115
+ onClick: () => void refresh(),
116
+ children: [/* @__PURE__ */ jsx(RefreshIcon, {}), /* @__PURE__ */ jsx("span", { children: "Refresh" })]
117
+ })]
118
+ }),
119
+ error ? /* @__PURE__ */ jsx("div", {
120
+ className: "think-execution-workbench__error",
121
+ role: "alert",
122
+ children: error
123
+ }) : null,
124
+ /* @__PURE__ */ jsxs("div", {
125
+ className: "think-execution-workbench__sections",
126
+ "aria-busy": busyAction !== null,
127
+ children: [/* @__PURE__ */ jsxs("div", {
128
+ className: "think-execution-workbench__lists",
129
+ children: [/* @__PURE__ */ jsxs("section", {
130
+ className: "think-execution-workbench__section",
131
+ "aria-labelledby": submissionsId,
132
+ children: [/* @__PURE__ */ jsxs("div", {
133
+ className: "think-execution-workbench__section-header",
134
+ children: [/* @__PURE__ */ jsx("h3", {
135
+ id: submissionsId,
136
+ children: "Submissions"
137
+ }), /* @__PURE__ */ jsx(Badge, {
138
+ color: "neutral",
139
+ size: "sm",
140
+ children: submissions.length
141
+ })]
142
+ }), busyAction === "refresh" && submissions.length === 0 ? /* @__PURE__ */ jsx("p", {
143
+ className: "think-execution-workbench__empty",
144
+ role: "status",
145
+ children: "Loading submissions..."
146
+ }) : submissions.length === 0 ? /* @__PURE__ */ jsx("p", {
147
+ className: "think-execution-workbench__empty",
148
+ children: "No submissions."
149
+ }) : /* @__PURE__ */ jsx("ul", {
150
+ className: "think-execution-workbench__list",
151
+ role: "list",
152
+ children: submissions.map((submission) => /* @__PURE__ */ jsxs("li", {
153
+ className: "think-execution-workbench__item",
154
+ "data-selected": selectedSubmission?.submissionId === submission.submissionId ? "true" : void 0,
155
+ children: [/* @__PURE__ */ jsxs("div", {
156
+ className: "think-execution-workbench__row-main",
157
+ children: [
158
+ /* @__PURE__ */ jsxs("div", {
159
+ className: "think-execution-workbench__item-topline",
160
+ children: [/* @__PURE__ */ jsx("code", { children: submission.submissionId }), /* @__PURE__ */ jsx(StatusBadge, {
161
+ color: submissionStatusColor(submission.status),
162
+ children: submission.status
163
+ })]
164
+ }),
165
+ /* @__PURE__ */ jsxs("p", {
166
+ className: "think-execution-workbench__row-meta",
167
+ children: [/* @__PURE__ */ jsxs("span", { children: ["Created ", formatTimestamp(submission.createdAt)] }), submission.idempotencyKey ? /* @__PURE__ */ jsxs("span", { children: ["Idempotency ", submission.idempotencyKey] }) : null]
168
+ }),
169
+ submission.error ? /* @__PURE__ */ jsx("p", {
170
+ className: "think-execution-workbench__item-error",
171
+ children: submission.error
172
+ }) : null
173
+ ]
174
+ }), /* @__PURE__ */ jsxs("div", {
175
+ className: "think-execution-workbench__actions",
176
+ children: [
177
+ /* @__PURE__ */ jsx(Button, {
178
+ type: "button",
179
+ variant: "ghost",
180
+ color: "neutral",
181
+ size: "icon-xs",
182
+ "aria-label": `Inspect submission ${submission.submissionId}`,
183
+ disabled: busyAction !== null,
184
+ onClick: () => void runAction(`inspect-submission:${submission.submissionId}`, async () => {
185
+ setSelectedWorkflow(null);
186
+ setSelectedSubmission(await source.inspectSubmission(submission.submissionId));
187
+ }),
188
+ children: /* @__PURE__ */ jsx(SearchIcon, {})
189
+ }),
190
+ isSubmissionCancelable(submission.status) ? /* @__PURE__ */ jsx(Button, {
191
+ type: "button",
192
+ variant: "ghost",
193
+ color: "neutral",
194
+ size: "icon-xs",
195
+ "aria-label": `Cancel submission ${submission.submissionId}`,
196
+ disabled: busyAction !== null,
197
+ onClick: () => void runAction(`cancel-submission:${submission.submissionId}`, () => source.cancelSubmission(submission.submissionId)),
198
+ children: /* @__PURE__ */ jsx(SquareIcon, {})
199
+ }) : null,
200
+ /* @__PURE__ */ jsx(Button, {
201
+ type: "button",
202
+ variant: "ghost",
203
+ color: "destructive",
204
+ size: "icon-xs",
205
+ "aria-label": `Delete submission ${submission.submissionId}`,
206
+ disabled: busyAction !== null,
207
+ onClick: () => void runAction(`delete-submission:${submission.submissionId}`, () => source.deleteSubmission(submission.submissionId)),
208
+ children: /* @__PURE__ */ jsx(XIcon, {})
209
+ })
210
+ ]
211
+ })]
212
+ }, submission.submissionId))
213
+ })]
214
+ }), /* @__PURE__ */ jsxs("section", {
215
+ className: "think-execution-workbench__section",
216
+ "aria-labelledby": executionsId,
217
+ children: [/* @__PURE__ */ jsxs("div", {
218
+ className: "think-execution-workbench__section-header",
219
+ children: [/* @__PURE__ */ jsx("h3", {
220
+ id: executionsId,
221
+ children: "Tracked workflows"
222
+ }), /* @__PURE__ */ jsx(Badge, {
223
+ color: "neutral",
224
+ size: "sm",
225
+ children: workflows?.total ?? 0
226
+ })]
227
+ }), busyAction === "refresh" && workflows === null ? /* @__PURE__ */ jsx("p", {
228
+ className: "think-execution-workbench__empty",
229
+ role: "status",
230
+ children: "Loading workflows..."
231
+ }) : !workflows || workflows.workflows.length === 0 ? /* @__PURE__ */ jsx("p", {
232
+ className: "think-execution-workbench__empty",
233
+ children: "No tracked workflows."
234
+ }) : /* @__PURE__ */ jsx("ul", {
235
+ className: "think-execution-workbench__list",
236
+ role: "list",
237
+ children: workflows.workflows.map((workflow) => {
238
+ const workflowStatus = String(workflow.status);
239
+ return /* @__PURE__ */ jsxs("li", {
240
+ className: "think-execution-workbench__item",
241
+ "data-selected": selectedWorkflow?.workflowId === workflow.workflowId ? "true" : void 0,
242
+ children: [/* @__PURE__ */ jsxs("div", {
243
+ className: "think-execution-workbench__row-main",
244
+ children: [
245
+ /* @__PURE__ */ jsxs("div", {
246
+ className: "think-execution-workbench__item-topline",
247
+ children: [/* @__PURE__ */ jsx("code", { children: workflow.workflowName }), /* @__PURE__ */ jsx(StatusBadge, {
248
+ color: workflowStatusColor(workflow.status),
249
+ children: workflowStatus
250
+ })]
251
+ }),
252
+ /* @__PURE__ */ jsxs("p", {
253
+ className: "think-execution-workbench__row-meta",
254
+ children: [/* @__PURE__ */ jsx("span", { children: workflow.workflowId }), /* @__PURE__ */ jsxs("span", { children: ["Updated ", formatTimestamp(workflow.updatedAt)] })]
255
+ }),
256
+ workflow.error ? /* @__PURE__ */ jsxs("p", {
257
+ className: "think-execution-workbench__item-error",
258
+ children: [
259
+ workflow.error.name,
260
+ ": ",
261
+ workflow.error.message
262
+ ]
263
+ }) : null
264
+ ]
265
+ }), /* @__PURE__ */ jsxs("div", {
266
+ className: "think-execution-workbench__actions",
267
+ children: [
268
+ /* @__PURE__ */ jsx(Button, {
269
+ type: "button",
270
+ variant: "ghost",
271
+ color: "neutral",
272
+ size: "icon-xs",
273
+ "aria-label": `Inspect workflow ${workflow.workflowId}`,
274
+ disabled: busyAction !== null,
275
+ onClick: () => void runAction(`inspect-workflow:${workflow.workflowId}`, async () => {
276
+ setSelectedSubmission(null);
277
+ setSelectedWorkflow(await source.getWorkflow(workflow.workflowId) ?? workflow);
278
+ }),
279
+ children: /* @__PURE__ */ jsx(SearchIcon, {})
280
+ }),
281
+ /* @__PURE__ */ jsx(Button, {
282
+ type: "button",
283
+ variant: "ghost",
284
+ color: "neutral",
285
+ size: "icon-xs",
286
+ "aria-label": `Sync workflow ${workflow.workflowId} status`,
287
+ disabled: busyAction !== null,
288
+ onClick: () => void runAction(`sync-workflow:${workflow.workflowId}`, () => source.getWorkflowStatus(workflow.workflowName, workflow.workflowId)),
289
+ children: /* @__PURE__ */ jsx(RefreshIcon, {})
290
+ }),
291
+ workflowStatus === "running" ? /* @__PURE__ */ jsx(Button, {
292
+ type: "button",
293
+ variant: "ghost",
294
+ color: "neutral",
295
+ size: "icon-xs",
296
+ "aria-label": `Pause workflow ${workflow.workflowId}`,
297
+ disabled: busyAction !== null,
298
+ onClick: () => void runAction(`pause-workflow:${workflow.workflowId}`, () => source.pauseWorkflow(workflow.workflowId)),
299
+ children: /* @__PURE__ */ jsx(PauseIcon, {})
300
+ }) : null,
301
+ workflowStatus === "paused" ? /* @__PURE__ */ jsx(Button, {
302
+ type: "button",
303
+ variant: "ghost",
304
+ color: "neutral",
305
+ size: "icon-xs",
306
+ "aria-label": `Resume workflow ${workflow.workflowId}`,
307
+ disabled: busyAction !== null,
308
+ onClick: () => void runAction(`resume-workflow:${workflow.workflowId}`, () => source.resumeWorkflow(workflow.workflowId)),
309
+ children: /* @__PURE__ */ jsx(PlayIcon, {})
310
+ }) : null,
311
+ isWorkflowTerminal(workflow.status) ? /* @__PURE__ */ jsx(Button, {
312
+ type: "button",
313
+ variant: "ghost",
314
+ color: "neutral",
315
+ size: "icon-xs",
316
+ "aria-label": `Restart workflow ${workflow.workflowId}`,
317
+ disabled: busyAction !== null,
318
+ onClick: () => void runAction(`restart-workflow:${workflow.workflowId}`, () => source.restartWorkflow(workflow.workflowId)),
319
+ children: /* @__PURE__ */ jsx(RefreshIcon, {})
320
+ }) : null,
321
+ workflowStatus === "running" ? /* @__PURE__ */ jsx(Button, {
322
+ type: "button",
323
+ variant: "ghost",
324
+ color: "destructive",
325
+ size: "icon-xs",
326
+ "aria-label": `Terminate workflow ${workflow.workflowId}`,
327
+ disabled: busyAction !== null,
328
+ onClick: () => void runAction(`terminate-workflow:${workflow.workflowId}`, () => source.terminateWorkflow(workflow.workflowId)),
329
+ children: /* @__PURE__ */ jsx(SquareIcon, {})
330
+ }) : null,
331
+ /* @__PURE__ */ jsx(Button, {
332
+ type: "button",
333
+ variant: "ghost",
334
+ color: "destructive",
335
+ size: "icon-xs",
336
+ "aria-label": `Delete workflow ${workflow.workflowId}`,
337
+ disabled: busyAction !== null,
338
+ onClick: () => void runAction(`delete-workflow:${workflow.workflowId}`, () => source.deleteWorkflow(workflow.workflowId)),
339
+ children: /* @__PURE__ */ jsx(XIcon, {})
340
+ })
341
+ ]
342
+ })]
343
+ }, workflow.workflowId);
344
+ })
345
+ })]
346
+ })]
347
+ }), /* @__PURE__ */ jsx("div", {
348
+ className: "think-execution-workbench__detail",
349
+ "aria-labelledby": inspectionId,
350
+ children: selectedSubmission ? /* @__PURE__ */ jsxs(Fragment, { children: [
351
+ /* @__PURE__ */ jsxs("div", {
352
+ className: "think-execution-workbench__detail-header",
353
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
354
+ className: "think-execution-workbench__eyebrow",
355
+ children: "Submission inspection"
356
+ }), /* @__PURE__ */ jsx("h3", {
357
+ id: inspectionId,
358
+ children: /* @__PURE__ */ jsx("code", { children: selectedSubmission.submissionId })
359
+ })] }), /* @__PURE__ */ jsx(StatusBadge, {
360
+ color: submissionStatusColor(selectedSubmission.status),
361
+ children: selectedSubmission.status
362
+ })]
363
+ }),
364
+ /* @__PURE__ */ jsxs("dl", {
365
+ className: "think-execution-workbench__meta think-execution-workbench__meta--detail",
366
+ children: [
367
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Created" }), /* @__PURE__ */ jsx("dd", { children: formatTimestamp(selectedSubmission.createdAt) })] }),
368
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Started" }), /* @__PURE__ */ jsx("dd", { children: formatTimestamp(selectedSubmission.startedAt) })] }),
369
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Completed" }), /* @__PURE__ */ jsx("dd", { children: formatTimestamp(selectedSubmission.completedAt) })] }),
370
+ selectedSubmission.requestId ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Request" }), /* @__PURE__ */ jsx("dd", { children: selectedSubmission.requestId })] }) : null,
371
+ selectedSubmission.idempotencyKey ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Idempotency" }), /* @__PURE__ */ jsx("dd", { children: selectedSubmission.idempotencyKey })] }) : null
372
+ ]
373
+ }),
374
+ selectedSubmission.error ? /* @__PURE__ */ jsx("p", {
375
+ className: "think-execution-workbench__item-error",
376
+ children: selectedSubmission.error
377
+ }) : null,
378
+ selectedSubmission.metadata ? /* @__PURE__ */ jsxs("div", {
379
+ className: "think-execution-workbench__inspection",
380
+ children: [/* @__PURE__ */ jsx("h4", { children: "Metadata" }), /* @__PURE__ */ jsx("pre", {
381
+ tabIndex: 0,
382
+ children: formatJson(selectedSubmission.metadata)
383
+ })]
384
+ }) : null,
385
+ /* @__PURE__ */ jsxs("div", {
386
+ className: "think-execution-workbench__inspection",
387
+ children: [/* @__PURE__ */ jsx("h4", { children: "Raw record" }), /* @__PURE__ */ jsx("pre", {
388
+ tabIndex: 0,
389
+ children: formatJson(selectedSubmission)
390
+ })]
391
+ })
392
+ ] }) : selectedWorkflow ? /* @__PURE__ */ jsxs(Fragment, { children: [
393
+ /* @__PURE__ */ jsxs("div", {
394
+ className: "think-execution-workbench__detail-header",
395
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
396
+ className: "think-execution-workbench__eyebrow",
397
+ children: "Workflow inspection"
398
+ }), /* @__PURE__ */ jsx("h3", {
399
+ id: inspectionId,
400
+ children: /* @__PURE__ */ jsx("code", { children: selectedWorkflow.workflowName })
401
+ })] }), /* @__PURE__ */ jsx(StatusBadge, {
402
+ color: workflowStatusColor(selectedWorkflow.status),
403
+ children: String(selectedWorkflow.status)
404
+ })]
405
+ }),
406
+ /* @__PURE__ */ jsxs("dl", {
407
+ className: "think-execution-workbench__meta think-execution-workbench__meta--detail",
408
+ children: [
409
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Instance" }), /* @__PURE__ */ jsx("dd", { children: selectedWorkflow.workflowId })] }),
410
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Created" }), /* @__PURE__ */ jsx("dd", { children: formatTimestamp(selectedWorkflow.createdAt) })] }),
411
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Updated" }), /* @__PURE__ */ jsx("dd", { children: formatTimestamp(selectedWorkflow.updatedAt) })] }),
412
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Completed" }), /* @__PURE__ */ jsx("dd", { children: formatTimestamp(selectedWorkflow.completedAt) })] })
413
+ ]
414
+ }),
415
+ selectedWorkflow.error ? /* @__PURE__ */ jsxs("p", {
416
+ className: "think-execution-workbench__item-error",
417
+ children: [
418
+ selectedWorkflow.error.name,
419
+ ": ",
420
+ selectedWorkflow.error.message
421
+ ]
422
+ }) : null,
423
+ selectedWorkflow.metadata ? /* @__PURE__ */ jsxs("div", {
424
+ className: "think-execution-workbench__inspection",
425
+ children: [/* @__PURE__ */ jsx("h4", { children: "Metadata" }), /* @__PURE__ */ jsx("pre", {
426
+ tabIndex: 0,
427
+ children: formatJson(selectedWorkflow.metadata)
428
+ })]
429
+ }) : null,
430
+ /* @__PURE__ */ jsxs("div", {
431
+ className: "think-execution-workbench__inspection",
432
+ children: [/* @__PURE__ */ jsx("h4", { children: "Raw record" }), /* @__PURE__ */ jsx("pre", {
433
+ tabIndex: 0,
434
+ children: formatJson(selectedWorkflow)
435
+ })]
436
+ })
437
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("h3", {
438
+ id: inspectionId,
439
+ children: "Inspection"
440
+ }), /* @__PURE__ */ jsx("p", {
441
+ className: "think-execution-workbench__empty think-execution-workbench__empty--detail",
442
+ children: "Inspect a submission or workflow."
443
+ })] })
444
+ })]
445
+ })
446
+ ]
447
+ });
448
+ }
449
+ //#endregion
450
+ export { ThinkExecutionWorkbench };
@@ -1,23 +1,61 @@
1
1
  import { WorkspaceSource } from "./WorkspaceExplorer.js";
2
- import { ThinkApprovalStub, ThinkChatMessagesProps, ThinkChatProviderProps } from "./ThinkChat.js";
2
+ import { ThinkChatMessagesProps } from "./ThinkChat.js";
3
+ import { ThinkExecutionAgent, ThinkExecutionWorkbench, ThinkExecutionWorkbenchProps, ThinkExecutionWorkbenchSource } from "./ThinkExecutionWorkbench.js";
3
4
  import * as React from "react";
5
+ import { useAgentChat } from "@cloudflare/think/react";
6
+ import { UIMessage } from "ai";
7
+ import { useAgent } from "agents/react";
8
+ import { Think } from "@cloudflare/think";
4
9
 
5
10
  //#region src/components/ThinkFullApp.d.ts
6
- interface ThinkFullAppProps extends React.HTMLAttributes<HTMLDivElement> {
7
- /** ThinkChat state and actions used by the chat surface. */
8
- chat: ThinkChatProviderProps["chat"];
9
- /** Optional Think agent stub used to resolve pending approval state. */
10
- agentStub?: ThinkApprovalStub;
11
+ type ThinkFullAppAgent<State = unknown> = Think<object, State>;
12
+ type ThinkFullAppWorkbenchView = "files" | "execution";
13
+ interface ThinkFullAppProps<AgentT extends ThinkFullAppAgent<State>, State = unknown> extends React.HTMLAttributes<HTMLDivElement> {
14
+ /** The `useAgent` value from `agents/react`; its stub drives approvals and execution records. */
15
+ agent: ReturnType<typeof useAgent<AgentT, State>>;
16
+ /** The `useAgentChat` value from `@cloudflare/think/react` used by the chat surface. */
17
+ chat: ReturnType<typeof useAgentChat<State, UIMessage>>;
11
18
  /** Optional workspace source shown in the file explorer pane. */
12
19
  workspace?: WorkspaceSource;
13
20
  /** Root path passed to the workspace explorer. */
14
21
  workspaceRoot?: string;
15
22
  /** Message rendering labels and approval overrides for ThinkChat. */
16
23
  messages?: ThinkChatMessagesProps;
24
+ /** Optional parent-owned thread picker/sidebar rendered beside the selected child app. */
25
+ threadSidebar?: React.ReactNode;
26
+ /** Whether the thread sidebar is open. Omit for internal state. */
27
+ threadSidebarOpen?: boolean;
28
+ /** Initial thread sidebar state when `threadSidebarOpen` is uncontrolled. */
29
+ defaultThreadSidebarOpen?: boolean;
30
+ /** Called when the thread sidebar is opened or closed. */
31
+ onThreadSidebarOpenChange?: (open: boolean) => void;
32
+ /** Selected workbench lane. Use this when the parent app stores the lane in route state. */
33
+ workbenchView?: ThinkFullAppWorkbenchView;
34
+ /** Initial workbench lane when `workbenchView` is uncontrolled. */
35
+ defaultWorkbenchView?: ThinkFullAppWorkbenchView;
36
+ /** Called when the shell toolbar asks to switch workbench lanes. */
37
+ onWorkbenchViewChange?: (view: ThinkFullAppWorkbenchView) => void;
17
38
  }
18
- /** Combines ThinkChat with an optional resizable workspace file explorer shell. */
19
- declare function ThinkFullApp(props: ThinkFullAppProps & {
39
+ /** Combines ThinkChat with an optional resizable workbench shell. */
40
+ declare function ThinkFullApp<AgentT extends ThinkFullAppAgent<State>, State = unknown>({
41
+ agent,
42
+ chat,
43
+ className,
44
+ defaultWorkbenchView,
45
+ defaultThreadSidebarOpen,
46
+ messages,
47
+ onThreadSidebarOpenChange,
48
+ onWorkbenchViewChange,
49
+ ref,
50
+ style,
51
+ threadSidebar,
52
+ threadSidebarOpen,
53
+ workbenchView,
54
+ workspace,
55
+ workspaceRoot,
56
+ ...props
57
+ }: ThinkFullAppProps<AgentT, State> & {
20
58
  ref?: React.Ref<HTMLDivElement>;
21
59
  }): React.JSX.Element;
22
60
  //#endregion
23
- export { ThinkFullApp, ThinkFullAppProps };
61
+ export { type ThinkExecutionAgent, ThinkExecutionWorkbench, type ThinkExecutionWorkbenchProps, type ThinkExecutionWorkbenchSource, ThinkFullApp, ThinkFullAppAgent, ThinkFullAppProps, ThinkFullAppWorkbenchView };