@mcp-b/react-components 0.17.0 → 0.18.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.
- package/dist/{AgentActivity-BNUNrP9O.d.ts → AgentActivity-D2SHSGFX.d.ts} +1 -1
- package/dist/{AgentChat-CRuMi1Pb.d.ts → AgentChat-ClxViuUM.d.ts} +1 -20
- package/dist/{Button-FX_hpqxm.d.ts → Button-DLGzHsjc.d.ts} +13 -7
- package/dist/{CodeBlock-Co1noLbC.js → CodeBlock-Bfp5PAg3.js} +9 -6
- package/dist/{CodeBlock-Dnpr88ZQ.d.ts → CodeBlock-gV4kZeCI.d.ts} +2 -9
- package/dist/{FileTree-B7bBsUyU.js → FileTree-3zYtrddG.js} +42 -16
- package/dist/{Message-C4eYRogZ.js → Message-BXtmfc9Q.js} +13 -20
- package/dist/{ModelSelector-BNrZlY_Y.js → ModelSelector-Cqw_qrUG.js} +15 -22
- package/dist/{PromptInput-OLfXPuHM.d.ts → PromptInput-Bdh9pqlo.d.ts} +4 -6
- package/dist/{Select-CwSqP07Y.d.ts → Select-B_13gg_J.d.ts} +2 -2
- package/dist/{Tabs-9zddXDQo.d.ts → Tabs-ColWK-XA.d.ts} +10 -2
- package/dist/{ThinkChat-DInElus-.js → ThinkChat-15EhfvYJ.js} +84 -61
- package/dist/{ThinkChatActivity-BgesTfZ4.d.ts → ThinkChatActivity-Bzot45kX.d.ts} +4 -7
- package/dist/{ThinkChatActivitySummary-BPmu9a-c.d.ts → ThinkChatActivitySummary-D1xOrNrq.d.ts} +1 -1
- package/dist/{Toggle-DaXpe1Lc.d.ts → Toggle-JKZ43D5S.d.ts} +1 -1
- package/dist/{ToggleGroup-yseEWkOC.d.ts → ToggleGroup-DNd6cDJZ.d.ts} +2 -2
- package/dist/Workspace-Jez8ffUj.d.ts +274 -0
- package/dist/{WorkspaceExplorer-sZewzT2O.d.ts → WorkspaceExplorer-B9dQWNVK.d.ts} +2 -2
- package/dist/{WorkspaceFile-C8UzuSH4.d.ts → WorkspaceFile-CzyHnESE.d.ts} +1 -1
- package/dist/{WorkspaceFileView-DNdGAEiX.js → WorkspaceFileView-C68Ub8S8.js} +120 -127
- package/dist/{WorkspaceLink-B1ykV1dS.js → WorkspaceLink-BYYeTQLf.js} +6 -27
- package/dist/{WorkspaceLink-DK1DWMHe.d.ts → WorkspaceLink-O-EBKUJ8.d.ts} +6 -9
- package/dist/{class-names-Bk-QLWWI.js → class-names-BiMDVpUo.js} +4 -1
- package/dist/components/Accordion.js +7 -2
- package/dist/components/Activity.js +2 -2
- package/dist/components/AgentActivity.d.ts +1 -1
- package/dist/components/AgentActivity.js +4 -5
- package/dist/components/AgentActivityPreview.d.ts +9 -9
- package/dist/components/AgentActivityPreview.js +8 -12
- package/dist/components/AgentAttention.d.ts +1 -1
- package/dist/components/AgentAttention.js +1 -1
- package/dist/components/AgentChat.d.ts +1 -1
- package/dist/components/AgentChat.js +94 -62
- package/dist/components/AgentChatMessageEditor.js +2 -2
- package/dist/components/AgentChatTurnError.js +2 -2
- package/dist/components/AgentConnection.js +3 -3
- package/dist/components/AgentMessageParts.js +1 -1
- package/dist/components/AgentToolDetail.d.ts +6 -4
- package/dist/components/AgentToolDetail.js +12 -10
- package/dist/components/AlertDialog.js +1 -1
- package/dist/components/AppTopBar.d.ts +24 -7
- package/dist/components/AppTopBar.js +32 -8
- package/dist/components/Approval.js +4 -4
- package/dist/components/Artifact.d.ts +1 -1
- package/dist/components/Artifact.js +6 -4
- package/dist/components/Autocomplete.js +1 -1
- package/dist/components/Avatar.d.ts +1 -1
- package/dist/components/Avatar.js +2 -2
- package/dist/components/Badge.js +3 -0
- package/dist/components/BrowserLiveView.js +27 -12
- package/dist/components/BrowserReplay.js +4 -3
- package/dist/components/BrowserRunPanel.js +5 -5
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Button.js +14 -11
- package/dist/components/Card.d.ts +7 -8
- package/dist/components/Card.js +19 -10
- package/dist/components/ChainOfThought.d.ts +1 -1
- package/dist/components/ChainOfThought.js +2 -2
- package/dist/components/ChatGptSignInScreen.js +8 -8
- package/dist/components/Checkbox.js +2 -2
- package/dist/components/CheckboxGroup.js +1 -1
- package/dist/components/Checkpoint.js +2 -2
- package/dist/components/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock.js +1 -1
- package/dist/components/CodexModelSelector.js +2 -2
- package/dist/components/Collapsible.js +2 -2
- package/dist/components/Combobox.js +1 -1
- package/dist/components/Commit.d.ts +1 -1
- package/dist/components/Commit.js +3 -3
- package/dist/components/Context.js +1 -1
- package/dist/components/ContextMenu.js +2 -2
- package/dist/components/Conversation.d.ts +1 -1
- package/dist/components/Conversation.js +5 -4
- package/dist/components/DescriptionListParts.js +1 -1
- package/dist/components/Dialog.js +1 -1
- package/dist/components/EnvironmentVariables.d.ts +1 -1
- package/dist/components/EnvironmentVariables.js +3 -3
- package/dist/components/Field.js +5 -2
- package/dist/components/Fieldset.js +1 -1
- package/dist/components/FileTree.d.ts +6 -0
- package/dist/components/FileTree.js +1 -1
- package/dist/components/Form.js +1 -1
- package/dist/components/GithubMotionMark.js +1 -1
- package/dist/components/IconButton.d.ts +2 -3
- package/dist/components/IconButton.js +2 -1
- package/dist/components/InlineCitation.js +1 -1
- package/dist/components/Input.js +1 -1
- package/dist/components/Marker.js +1 -1
- package/dist/components/McpConnectionRequest.js +2 -2
- package/dist/components/McpServerPicker.js +2 -2
- package/dist/components/MediaPreviewCard.d.ts +103 -0
- package/dist/components/MediaPreviewCard.js +193 -0
- package/dist/components/Menu.js +1 -1
- package/dist/components/Menubar.js +2 -2
- package/dist/components/Message.d.ts +4 -1
- package/dist/components/Message.js +1 -1
- package/dist/components/MessageScroller.d.ts +1 -1
- package/dist/components/MessageScroller.js +5 -4
- package/dist/components/Meter.js +1 -1
- package/dist/components/ModelSelector.d.ts +4 -3
- package/dist/components/ModelSelector.js +1 -1
- package/dist/components/NavigationMenu.js +1 -1
- package/dist/components/NumberField.js +1 -1
- package/dist/components/Plan.js +2 -2
- package/dist/components/Popover.js +1 -1
- package/dist/components/PreviewCard.js +1 -1
- package/dist/components/PricingBillingToggle.js +1 -1
- package/dist/components/PricingFAQ.js +1 -1
- package/dist/components/PricingPage.js +2 -1
- package/dist/components/PricingPlanCard.js +4 -3
- package/dist/components/PricingUsageCalculator.js +2 -2
- package/dist/components/Progress.js +1 -1
- package/dist/components/PromptInput.d.ts +1 -1
- package/dist/components/PromptInput.js +33 -20
- package/dist/components/Queue.d.ts +1 -1
- package/dist/components/Queue.js +2 -3
- package/dist/components/RadioGroup.js +1 -1
- package/dist/components/Reasoning.js +3 -6
- package/dist/components/ResizableSidePanel.js +1 -1
- package/dist/components/ResponsiveSidebarShell.js +16 -10
- package/dist/components/ScrollArea.js +2 -1
- package/dist/components/SearchField.d.ts +43 -0
- package/dist/components/SearchField.js +52 -0
- package/dist/components/Select.d.ts +1 -1
- package/dist/components/Select.js +5 -6
- package/dist/components/Separator.js +1 -1
- package/dist/components/Slider.js +1 -1
- package/dist/components/Sources.js +2 -2
- package/dist/components/Stepper.js +16 -9
- package/dist/components/SubagentRunDetails.js +1 -1
- package/dist/components/SubagentRunIndicator.js +2 -2
- package/dist/components/SubagentRunList.d.ts +3 -5
- package/dist/components/SubagentRunList.js +3 -4
- package/dist/components/SubagentRunSelector.d.ts +8 -12
- package/dist/components/SubagentRunSelector.js +17 -20
- package/dist/components/Switch.d.ts +2 -2
- package/dist/components/Switch.js +4 -5
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tabs.js +12 -3
- package/dist/components/Task.js +2 -2
- package/dist/components/Terminal.d.ts +2 -2
- package/dist/components/Terminal.js +5 -4
- package/dist/components/TestResults.js +10 -6
- package/dist/components/Textarea.js +1 -1
- package/dist/components/ThemeModeControl.js +1 -1
- package/dist/components/ThinkChat.d.ts +33 -20
- package/dist/components/ThinkChat.js +4 -4
- package/dist/components/ThinkChatActivity.d.ts +2 -2
- package/dist/components/ThinkChatActivity.js +8 -10
- package/dist/components/ThinkChatActivitySummary.d.ts +1 -1
- package/dist/components/ThinkChatActivitySummary.js +7 -3
- package/dist/components/ThinkChatToolPanels.js +26 -16
- package/dist/components/ThinkExecutionDetail.js +2 -2
- package/dist/components/ThinkExecutionStatus.js +2 -2
- package/dist/components/ThinkExecutionWorkbench.d.ts +30 -8
- package/dist/components/ThinkExecutionWorkbench.js +70 -134
- package/dist/components/ThinkFullApp.d.ts +36 -35
- package/dist/components/ThinkFullApp.js +156 -109
- package/dist/components/ThinkFullAppViewSwitch.d.ts +1 -1
- package/dist/components/ThinkFullAppViewSwitch.js +1 -1
- package/dist/components/ThinkRecoveryNotice.js +18 -12
- package/dist/components/ThinkRoutineBrowser.d.ts +17 -9
- package/dist/components/ThinkRoutineBrowser.js +33 -40
- package/dist/components/ThinkRoutineDetail.d.ts +5 -2
- package/dist/components/ThinkRoutineDetail.js +4 -4
- package/dist/components/ThinkRoutineForm.d.ts +3 -2
- package/dist/components/ThinkRoutineForm.js +11 -10
- package/dist/components/ThinkRoutineLibrary.d.ts +24 -31
- package/dist/components/ThinkRoutineLibrary.js +57 -80
- package/dist/components/ThinkRoutineRuns.d.ts +3 -2
- package/dist/components/ThinkRoutineRuns.js +31 -24
- package/dist/components/ThinkThreadPicker.d.ts +17 -11
- package/dist/components/ThinkThreadPicker.js +163 -39
- package/dist/components/Toast.js +1 -1
- package/dist/components/Toggle.d.ts +1 -1
- package/dist/components/Toggle.js +9 -7
- package/dist/components/ToggleGroup.d.ts +1 -1
- package/dist/components/ToggleGroup.js +15 -13
- package/dist/components/ToolInvocation.js +1 -1
- package/dist/components/Toolbar.js +1 -1
- package/dist/components/Tooltip.d.ts +8 -1
- package/dist/components/Tooltip.js +11 -2
- package/dist/components/TransitionSurface.d.ts +27 -0
- package/dist/components/TransitionSurface.js +20 -0
- package/dist/components/WebPreview.d.ts +5 -5
- package/dist/components/WebPreview.js +68 -54
- package/dist/components/Workspace.d.ts +2 -2
- package/dist/components/Workspace.js +358 -328
- package/dist/components/WorkspaceBrowser.d.ts +4 -7
- package/dist/components/WorkspaceBrowser.js +15 -25
- package/dist/components/WorkspaceExplorer.d.ts +5 -5
- package/dist/components/WorkspaceExplorer.js +19 -32
- package/dist/components/WorkspaceFile.d.ts +1 -1
- package/dist/components/WorkspaceFileView.d.ts +14 -2
- package/dist/components/WorkspaceFileView.js +1 -1
- package/dist/components/WorkspaceHeader.d.ts +0 -8
- package/dist/components/WorkspaceHeader.js +3 -15
- package/dist/components/WorkspaceLink.d.ts +1 -1
- package/dist/components/WorkspaceLink.js +1 -1
- package/dist/components/icons.d.ts +2 -2
- package/dist/components/icons.js +2 -2
- package/dist/{copy-button-CQx3LQAC.d.ts → copy-button-D7aAYA-2.d.ts} +1 -1
- package/dist/{copy-button-cYsJBauI.js → copy-button-DeK6KXEV.js} +3 -2
- package/dist/{icons--FqCZEc3.js → icons-CQJ-aMnI.js} +6 -3
- package/dist/{icons-DpUqY8Mp.d.ts → icons-CYXmvKlJ.d.ts} +17 -2
- package/dist/navigation-link-Cob7KBlM.js +19 -0
- package/dist/styles/accordion.css +4 -19
- package/dist/styles/activity.css +48 -56
- package/dist/styles/agent-activity-preview.css +2 -0
- package/dist/styles/agent-chat.css +14 -22
- package/dist/styles/alert-dialog.css +16 -18
- package/dist/styles/app-top-bar.css +17 -9
- package/dist/styles/approval.css +11 -6
- package/dist/styles/artifact.css +6 -6
- package/dist/styles/autocomplete.css +2 -1
- package/dist/styles/avatar.css +35 -30
- package/dist/styles/badge.css +10 -10
- package/dist/styles/base-ui-motion.css +94 -39
- package/dist/styles/browser-control-overlay.css +0 -1
- package/dist/styles/browser-live-view.css +39 -22
- package/dist/styles/browser-replay.css +1 -1
- package/dist/styles/browser-run-panel.css +8 -4
- package/dist/styles/button.css +36 -33
- package/dist/styles/card.css +5 -6
- package/dist/styles/chain-of-thought.css +22 -16
- package/dist/styles/checkbox.css +18 -5
- package/dist/styles/codex-model-selector.css +3 -7
- package/dist/styles/collapsible.css +10 -10
- package/dist/styles/combobox.css +3 -2
- package/dist/styles/commit.css +19 -18
- package/dist/styles/composition-motion.css +83 -0
- package/dist/styles/context-menu.css +3 -3
- package/dist/styles/context.css +11 -10
- package/dist/styles/conversation.css +18 -23
- package/dist/styles/dialog.css +15 -15
- package/dist/styles/field.css +32 -12
- package/dist/styles/file-tree.css +69 -9
- package/dist/styles/form.css +1 -1
- package/dist/styles/index.css +5 -0
- package/dist/styles/input.css +2 -2
- package/dist/styles/marker.css +14 -13
- package/dist/styles/mcp-server-picker.css +20 -17
- package/dist/styles/media-preview-card.css +160 -0
- package/dist/styles/menu.css +11 -11
- package/dist/styles/menubar.css +12 -11
- package/dist/styles/message.css +27 -21
- package/dist/styles/meter.css +2 -2
- package/dist/styles/model-selector.css +16 -14
- package/dist/styles/motion-reduction.css +29 -0
- package/dist/styles/navigation-menu.css +14 -30
- package/dist/styles/number-field.css +22 -4
- package/dist/styles/plan.css +5 -0
- package/dist/styles/popover.css +15 -16
- package/dist/styles/preview-card.css +2 -32
- package/dist/styles/progress.css +8 -3
- package/dist/styles/prompt-input.css +75 -75
- package/dist/styles/queue.css +48 -32
- package/dist/styles/radio.css +19 -12
- package/dist/styles/reasoning.css +2 -1
- package/dist/styles/recipes.css +109 -37
- package/dist/styles/resizable-side-panel.css +4 -10
- package/dist/styles/responsive-sidebar-shell.css +16 -15
- package/dist/styles/scroll-area.css +32 -15
- package/dist/styles/search-field.css +21 -0
- package/dist/styles/select.css +19 -12
- package/dist/styles/slider.css +25 -29
- package/dist/styles/sources.css +3 -3
- package/dist/styles/stepper.css +36 -26
- package/dist/styles/subagent-run.css +1 -1
- package/dist/styles/switch.css +32 -29
- package/dist/styles/tabs.css +79 -23
- package/dist/styles/task.css +13 -9
- package/dist/styles/test-results.css +29 -23
- package/dist/styles/theme-mode-control.css +8 -0
- package/dist/styles/think-execution-workbench.css +18 -15
- package/dist/styles/think-full-app.css +45 -68
- package/dist/styles/think-routine-library.css +43 -24
- package/dist/styles/think-thread-picker.css +193 -51
- package/dist/styles/toast.css +48 -27
- package/dist/styles/toggle-group.css +2 -36
- package/dist/styles/toggle.css +29 -5
- package/dist/styles/toolbar.css +25 -27
- package/dist/styles/tooltip.css +2 -32
- package/dist/styles/transition-surface.css +55 -0
- package/dist/styles/workspace-explorer.css +99 -44
- package/dist/summarize-tool-input-CqTcGRYy.js +15 -0
- package/dist/utils/mcp-server-catalog.d.ts +132 -0
- package/dist/utils/mcp-server-catalog.js +90 -0
- package/dist/utils/structured-code.d.ts +1 -1
- package/package.json +13 -7
- package/dist/Workspace-C9RFoxcu.d.ts +0 -62
- package/dist/summarize-tool-input-BUJsENSn.js +0 -12
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-BiMDVpUo.js";
|
|
2
|
+
import { B as PlusIcon } from "../icons-CQJ-aMnI.js";
|
|
3
|
+
import { t as NavigationLink } from "../navigation-link-Cob7KBlM.js";
|
|
4
|
+
import { buttonVariants } from "./Button.js";
|
|
4
5
|
import { Tooltip } from "./Tooltip.js";
|
|
5
|
-
import {
|
|
6
|
+
import { SearchField } from "./SearchField.js";
|
|
6
7
|
import { ToggleGroup } from "./ToggleGroup.js";
|
|
7
8
|
import { getThinkRoutineNextRun } from "./ThinkRoutine.js";
|
|
8
9
|
import * as React from "react";
|
|
@@ -18,16 +19,10 @@ function filterRoutines(routines, filter, query) {
|
|
|
18
19
|
});
|
|
19
20
|
}
|
|
20
21
|
/** Searchable, filterable navigation for an app-owned collection of Think routines. */
|
|
21
|
-
function ThinkRoutineBrowser({ className, routines, selectedRoutineId,
|
|
22
|
+
function ThinkRoutineBrowser({ className, routines, selectedRoutineId, showOwner = true, renderRoutineLink, createRoutineLink, onRoutineLinkClick, ref, ...props }) {
|
|
22
23
|
const [filter, setFilter] = React.useState("all");
|
|
23
24
|
const [query, setQuery] = React.useState("");
|
|
24
25
|
const visibleRoutines = filterRoutines(routines, filter, query);
|
|
25
|
-
const retainVisibleSelection = (nextVisibleRoutines) => {
|
|
26
|
-
if (selectedRoutineId && !nextVisibleRoutines.some((routine) => routine.id === selectedRoutineId)) {
|
|
27
|
-
const nextSelectedId = nextVisibleRoutines[0]?.id;
|
|
28
|
-
if (nextSelectedId) onSelectedRoutineIdChange?.(nextSelectedId);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
26
|
return /* @__PURE__ */ jsxs("nav", {
|
|
32
27
|
ref,
|
|
33
28
|
className: cx("think-routine-browser", "think-routine-library__browser", className),
|
|
@@ -48,7 +43,6 @@ function ThinkRoutineBrowser({ className, routines, selectedRoutineId, onSelecte
|
|
|
48
43
|
const nextFilter = nextValue[0];
|
|
49
44
|
if (!nextFilter) return;
|
|
50
45
|
setFilter(nextFilter);
|
|
51
|
-
retainVisibleSelection(filterRoutines(routines, nextFilter, query));
|
|
52
46
|
},
|
|
53
47
|
children: [
|
|
54
48
|
"all",
|
|
@@ -59,14 +53,16 @@ function ThinkRoutineBrowser({ className, routines, selectedRoutineId, onSelecte
|
|
|
59
53
|
value,
|
|
60
54
|
children: value.charAt(0).toUpperCase() + value.slice(1)
|
|
61
55
|
}, value))
|
|
62
|
-
}),
|
|
63
|
-
render: /* @__PURE__ */ jsx(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
}), createRoutineLink ? /* @__PURE__ */ jsxs(Tooltip.Root, { children: [/* @__PURE__ */ jsx(Tooltip.Trigger, {
|
|
57
|
+
render: /* @__PURE__ */ jsx(NavigationLink, {
|
|
58
|
+
render: createRoutineLink,
|
|
59
|
+
className: buttonVariants({
|
|
60
|
+
variant: "ghost",
|
|
61
|
+
color: "neutral",
|
|
62
|
+
size: "sm"
|
|
63
|
+
}),
|
|
64
|
+
"data-icon-only": "",
|
|
65
|
+
"aria-label": "New schedule"
|
|
70
66
|
}),
|
|
71
67
|
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
72
68
|
}), /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
|
|
@@ -75,23 +71,17 @@ function ThinkRoutineBrowser({ className, routines, selectedRoutineId, onSelecte
|
|
|
75
71
|
children: /* @__PURE__ */ jsx(Tooltip.Popup, { children: "Create schedule" })
|
|
76
72
|
}) })] }) : null]
|
|
77
73
|
}),
|
|
78
|
-
/* @__PURE__ */ jsxs(
|
|
74
|
+
/* @__PURE__ */ jsxs(SearchField.Root, {
|
|
79
75
|
className: "think-routine-library__search",
|
|
80
76
|
name: "routine-search",
|
|
81
|
-
children: [/* @__PURE__ */ jsx(
|
|
77
|
+
children: [/* @__PURE__ */ jsx(SearchField.Label, {
|
|
82
78
|
className: "think-routine-library__title sigvelo-visually-hidden",
|
|
83
79
|
children: "Search schedules"
|
|
84
|
-
}), /* @__PURE__ */
|
|
85
|
-
className: "think-routine-browser__search-control",
|
|
86
|
-
type: "search",
|
|
80
|
+
}), /* @__PURE__ */ jsx(SearchField.Control, {
|
|
87
81
|
value: query,
|
|
88
82
|
placeholder: "Search schedules",
|
|
89
|
-
onChange: (event) =>
|
|
90
|
-
|
|
91
|
-
setQuery(nextQuery);
|
|
92
|
-
retainVisibleSelection(filterRoutines(routines, filter, nextQuery));
|
|
93
|
-
}
|
|
94
|
-
})] })]
|
|
83
|
+
onChange: (event) => setQuery(event.currentTarget.value)
|
|
84
|
+
})]
|
|
95
85
|
}),
|
|
96
86
|
/* @__PURE__ */ jsxs("p", {
|
|
97
87
|
className: "think-routine-library__status sigvelo-visually-hidden",
|
|
@@ -111,14 +101,16 @@ function ThinkRoutineBrowser({ className, routines, selectedRoutineId, onSelecte
|
|
|
111
101
|
const selected = routine.id === selectedRoutineId;
|
|
112
102
|
return /* @__PURE__ */ jsx("li", {
|
|
113
103
|
"data-selected": selected || void 0,
|
|
114
|
-
children: /* @__PURE__ */ jsxs(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
104
|
+
children: /* @__PURE__ */ jsxs(NavigationLink, {
|
|
105
|
+
render: renderRoutineLink(routine),
|
|
106
|
+
className: buttonVariants({
|
|
107
|
+
variant: "ghost",
|
|
108
|
+
color: "neutral",
|
|
109
|
+
size: "sm",
|
|
110
|
+
className: "think-routine-browser__routine"
|
|
111
|
+
}),
|
|
120
112
|
"aria-current": selected ? "page" : void 0,
|
|
121
|
-
onClick:
|
|
113
|
+
onClick: onRoutineLinkClick,
|
|
122
114
|
children: [
|
|
123
115
|
/* @__PURE__ */ jsx("span", {
|
|
124
116
|
className: "think-routine-library__routine-status",
|
|
@@ -135,8 +127,9 @@ function ThinkRoutineBrowser({ className, routines, selectedRoutineId, onSelecte
|
|
|
135
127
|
/* @__PURE__ */ jsx("strong", { children: routine.name }),
|
|
136
128
|
/* @__PURE__ */ jsx("span", { children: routine.task.schedule }),
|
|
137
129
|
/* @__PURE__ */ jsxs("small", { children: [
|
|
138
|
-
routine.owner.name,
|
|
139
|
-
"
|
|
130
|
+
showOwner ? `${routine.owner.name} · ` : null,
|
|
131
|
+
"Next",
|
|
132
|
+
" ",
|
|
140
133
|
getThinkRoutineNextRun(routine)
|
|
141
134
|
] })
|
|
142
135
|
]
|
|
@@ -5,16 +5,19 @@ import * as React from "react";
|
|
|
5
5
|
interface ThinkRoutineDetailProps<TRoutine extends ThinkRoutine = ThinkRoutine> extends React.HTMLAttributes<HTMLElement> {
|
|
6
6
|
routine: TRoutine;
|
|
7
7
|
busy?: boolean;
|
|
8
|
+
showOwner?: boolean;
|
|
8
9
|
onEnabledChange?: (enabled: boolean) => void;
|
|
9
|
-
|
|
10
|
+
/** App-authored TanStack Router Link for each recent execution. */
|
|
11
|
+
renderRunLink?: (run: ThinkRoutineRunOf<TRoutine>) => React.ReactElement;
|
|
10
12
|
}
|
|
11
13
|
/** Readable definition, schedule settings, and recent executions for one routine. */
|
|
12
14
|
declare function ThinkRoutineDetail<TRoutine extends ThinkRoutine = ThinkRoutine>({
|
|
13
15
|
busy,
|
|
14
16
|
className,
|
|
15
17
|
routine,
|
|
18
|
+
showOwner,
|
|
16
19
|
onEnabledChange,
|
|
17
|
-
|
|
20
|
+
renderRunLink,
|
|
18
21
|
ref,
|
|
19
22
|
...props
|
|
20
23
|
}: ThinkRoutineDetailProps<TRoutine> & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
1
|
+
import { t as cx } from "../class-names-BiMDVpUo.js";
|
|
2
2
|
import { Badge } from "./Badge.js";
|
|
3
3
|
import { Switch } from "./Switch.js";
|
|
4
4
|
import { getThinkRoutineNextRun } from "./ThinkRoutine.js";
|
|
@@ -10,7 +10,7 @@ function taskInstructions(routine) {
|
|
|
10
10
|
return typeof routine.task.prompt === "string" ? routine.task.prompt : "Runs an app-defined scheduled handler.";
|
|
11
11
|
}
|
|
12
12
|
/** Readable definition, schedule settings, and recent executions for one routine. */
|
|
13
|
-
function ThinkRoutineDetail({ busy = false, className, routine, onEnabledChange,
|
|
13
|
+
function ThinkRoutineDetail({ busy = false, className, routine, showOwner = true, onEnabledChange, renderRunLink, ref, ...props }) {
|
|
14
14
|
const titleId = React.useId();
|
|
15
15
|
const definitionId = React.useId();
|
|
16
16
|
const settingsId = React.useId();
|
|
@@ -72,7 +72,7 @@ function ThinkRoutineDetail({ busy = false, className, routine, onEnabledChange,
|
|
|
72
72
|
children: [
|
|
73
73
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Repeats" }), /* @__PURE__ */ jsx("dd", { children: routine.task.schedule })] }),
|
|
74
74
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Next run" }), /* @__PURE__ */ jsx("dd", { children: getThinkRoutineNextRun(routine) })] }),
|
|
75
|
-
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Agent" }), /* @__PURE__ */ jsx("dd", { children: routine.owner.name })] })
|
|
75
|
+
showOwner ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Agent" }), /* @__PURE__ */ jsx("dd", { children: routine.owner.name })] }) : null
|
|
76
76
|
]
|
|
77
77
|
}),
|
|
78
78
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -93,7 +93,7 @@ function ThinkRoutineDetail({ busy = false, className, routine, onEnabledChange,
|
|
|
93
93
|
}),
|
|
94
94
|
/* @__PURE__ */ jsx(ThinkRoutineRuns, {
|
|
95
95
|
runs: routine.runs,
|
|
96
|
-
|
|
96
|
+
renderRunLink
|
|
97
97
|
})
|
|
98
98
|
]
|
|
99
99
|
});
|
|
@@ -12,15 +12,16 @@ interface ThinkRoutineFormProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
12
12
|
* `getDefaultTimezone()` own wall-clock fallback behavior.
|
|
13
13
|
*/
|
|
14
14
|
schedules: readonly ThinkScheduledTaskSchedule[];
|
|
15
|
-
|
|
15
|
+
/** App-authored TanStack Router Link to the routine catalog. */
|
|
16
|
+
cancelLink?: React.ReactElement;
|
|
16
17
|
onCreate: (request: ThinkRoutineCreateRequest) => void;
|
|
17
18
|
}
|
|
18
19
|
/** Authoring surface for a serializable, prompt-based Think scheduled task. */
|
|
19
20
|
declare function ThinkRoutineForm({
|
|
20
21
|
busy,
|
|
22
|
+
cancelLink,
|
|
21
23
|
className,
|
|
22
24
|
owners,
|
|
23
|
-
onCancel,
|
|
24
25
|
onCreate,
|
|
25
26
|
schedules,
|
|
26
27
|
ref,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-BiMDVpUo.js";
|
|
2
|
+
import { G as SpinnerIcon } from "../icons-CQJ-aMnI.js";
|
|
3
|
+
import { t as NavigationLink } from "../navigation-link-Cob7KBlM.js";
|
|
4
|
+
import { Button, buttonVariants } from "./Button.js";
|
|
4
5
|
import { Field } from "./Field.js";
|
|
5
6
|
import { Form } from "./Form.js";
|
|
6
7
|
import { Textarea } from "./Textarea.js";
|
|
@@ -32,7 +33,7 @@ function RoutineSelect({ label, onValueChange, options, value }) {
|
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
35
|
/** Authoring surface for a serializable, prompt-based Think scheduled task. */
|
|
35
|
-
function ThinkRoutineForm({ busy = false, className, owners,
|
|
36
|
+
function ThinkRoutineForm({ busy = false, cancelLink, className, owners, onCreate, schedules, ref, ...props }) {
|
|
36
37
|
const [name, setName] = React.useState("");
|
|
37
38
|
const [ownerId, setOwnerId] = React.useState(owners[0]?.id ?? "");
|
|
38
39
|
const [prompt, setPrompt] = React.useState("");
|
|
@@ -131,12 +132,12 @@ function ThinkRoutineForm({ busy = false, className, owners, onCancel, onCreate,
|
|
|
131
132
|
})
|
|
132
133
|
] }), /* @__PURE__ */ jsxs("footer", {
|
|
133
134
|
className: "think-routine-library__form-actions",
|
|
134
|
-
children: [
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
children: [cancelLink ? /* @__PURE__ */ jsx(NavigationLink, {
|
|
136
|
+
render: cancelLink,
|
|
137
|
+
className: buttonVariants({
|
|
138
|
+
variant: "ghost",
|
|
139
|
+
color: "neutral"
|
|
140
|
+
}),
|
|
140
141
|
children: "Cancel"
|
|
141
142
|
}) : null, /* @__PURE__ */ jsxs(Button, {
|
|
142
143
|
type: "submit",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { t as ThinkExecutionRun } from "../ThinkExecutionRun-ChhWhOoU.js";
|
|
2
2
|
import { ThinkRoutine, ThinkRoutineCreateRequest, ThinkRoutineOwner, ThinkRoutineRunOf } from "./ThinkRoutine.js";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { ThinkScheduledTaskSchedule } from "@cloudflare/think";
|
|
5
4
|
|
|
6
5
|
//#region src/components/ThinkRoutineLibrary.d.ts
|
|
7
6
|
interface ThinkRoutineLibraryDetailRenderProps<TRoutine extends ThinkRoutine = ThinkRoutine> {
|
|
@@ -12,37 +11,33 @@ interface ThinkRoutineLibraryDetailRenderProps<TRoutine extends ThinkRoutine = T
|
|
|
12
11
|
/** Custom detail surfaces must honor this while invoking the supplied actions. */
|
|
13
12
|
busy: boolean;
|
|
14
13
|
onEnabledChange?: (enabled: boolean) => void;
|
|
15
|
-
|
|
14
|
+
renderRunLink?: (run: ThinkRoutineRunOf<TRoutine>) => React.ReactElement;
|
|
16
15
|
}
|
|
17
16
|
interface ThinkRoutineLibraryProps<TRoutine extends ThinkRoutine = ThinkRoutine> extends Omit<React.HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
|
18
17
|
/** App-owned routine catalog assembled from native Think and Agents records. */
|
|
19
18
|
routines: readonly TRoutine[];
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
|
|
19
|
+
/** Routine selected by the current application route. */
|
|
20
|
+
selectedRoutineId: string | null;
|
|
21
|
+
/** App-authored TanStack Router Link for every routine destination. */
|
|
22
|
+
renderRoutineLink: (routine: TRoutine) => React.ReactElement;
|
|
23
|
+
/** App-authored TanStack Router Link to the routine creation route. */
|
|
24
|
+
createRoutineLink?: React.ReactElement;
|
|
25
|
+
/** App-authored TanStack Router Link to edit the selected routine. */
|
|
26
|
+
renderEditRoutineLink?: (routine: TRoutine) => React.ReactElement;
|
|
27
|
+
/** App-authored TanStack Router Link for recent execution destinations. */
|
|
28
|
+
renderRunLink?: (routine: TRoutine, run: ThinkRoutineRunOf<TRoutine>) => React.ReactElement;
|
|
29
|
+
/** Whether to show routine owners in the browser and detail. Defaults to true. */
|
|
30
|
+
showOwner?: boolean;
|
|
31
|
+
/** Host-owned catalog error shown above the library without replacing loaded routines. */
|
|
32
|
+
error?: React.ReactNode;
|
|
30
33
|
/** Product navigation rendered after the built-in schedule navigation control. */
|
|
31
34
|
appBarLeading?: React.ReactNode;
|
|
32
|
-
/** Opens a host-owned create route instead of the library's built-in form. */
|
|
33
|
-
onCreateRoutineRequest?: () => void;
|
|
34
|
-
/** Creates an app-owned routine from a whole native Think scheduled task. */
|
|
35
|
-
onCreateRoutine?: (request: ThinkRoutineCreateRequest) => void | Promise<void>;
|
|
36
|
-
/** Opens a host-owned editor for the selected routine. */
|
|
37
|
-
onEditRoutine?: (routine: TRoutine) => void;
|
|
38
35
|
/** Starts the selected routine immediately. */
|
|
39
36
|
onRunRoutine?: (routine: TRoutine) => void | Promise<void>;
|
|
40
37
|
/** Activates or pauses the selected app-owned routine. */
|
|
41
38
|
onRoutineEnabledChange?: (routine: TRoutine, enabled: boolean) => void | Promise<void>;
|
|
42
39
|
/** Permanently removes the selected app-owned routine. */
|
|
43
40
|
onDeleteRoutine?: (routine: TRoutine) => void | Promise<void>;
|
|
44
|
-
/** Opens one native Workflow or submission from the selected routine history. */
|
|
45
|
-
onRunSelect?: (routine: TRoutine, run: ThinkRoutineRunOf<TRoutine>) => void;
|
|
46
41
|
/**
|
|
47
42
|
* Replaces only the selected-routine surface while preserving the library
|
|
48
43
|
* shell, navigation, actions, async state, and upstream routine contract.
|
|
@@ -52,29 +47,27 @@ interface ThinkRoutineLibraryProps<TRoutine extends ThinkRoutine = ThinkRoutine>
|
|
|
52
47
|
/**
|
|
53
48
|
* Full-page, cross-agent routine library. This intentionally does not live in
|
|
54
49
|
* ThinkFullApp's per-thread workbench: the host app owns aggregation, routes,
|
|
55
|
-
* authoring
|
|
50
|
+
* authoring routes, and the association between schedules and native runs.
|
|
56
51
|
* The application shell composes `ThinkRoutineBrowser`, `ThinkRoutineDetail`,
|
|
57
|
-
*
|
|
58
|
-
* surfaces independently.
|
|
52
|
+
* and `ThinkRoutineRuns`; consumers compose `ThinkRoutineForm` in their create
|
|
53
|
+
* route and may also use these surfaces independently.
|
|
59
54
|
*/
|
|
60
55
|
declare function ThinkRoutineLibrary<TRoutine extends ThinkRoutine = ThinkRoutine>({
|
|
61
56
|
appBarLeading,
|
|
62
57
|
className,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
onCreateRoutineRequest,
|
|
58
|
+
createRoutineLink,
|
|
59
|
+
error: catalogError,
|
|
66
60
|
onDeleteRoutine,
|
|
67
|
-
onEditRoutine,
|
|
68
61
|
onRoutineEnabledChange,
|
|
69
62
|
onRunRoutine,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
owners,
|
|
63
|
+
renderEditRoutineLink,
|
|
64
|
+
renderRoutineLink,
|
|
73
65
|
renderRoutineDetail,
|
|
74
|
-
|
|
66
|
+
renderRunLink,
|
|
75
67
|
ref,
|
|
76
68
|
routines,
|
|
77
69
|
selectedRoutineId,
|
|
70
|
+
showOwner,
|
|
78
71
|
...props
|
|
79
72
|
}: ThinkRoutineLibraryProps<TRoutine> & {
|
|
80
73
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { t as cx } from "../class-names-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as cx } from "../class-names-BiMDVpUo.js";
|
|
2
|
+
import { G as SpinnerIcon, Z as WarningIcon, u as ChevronDownIcon, v as EllipsisIcon, z as PlayIcon } from "../icons-CQJ-aMnI.js";
|
|
3
|
+
import { t as NavigationLink } from "../navigation-link-Cob7KBlM.js";
|
|
4
|
+
import { Button, buttonVariants } from "./Button.js";
|
|
4
5
|
import { Menu } from "./Menu.js";
|
|
5
6
|
import { AppTopBar } from "./AppTopBar.js";
|
|
6
7
|
import { AlertDialog } from "./AlertDialog.js";
|
|
7
8
|
import { ResponsiveSidebarShell } from "./ResponsiveSidebarShell.js";
|
|
8
9
|
import { ThinkRoutineBrowser } from "./ThinkRoutineBrowser.js";
|
|
9
10
|
import { ThinkRoutineDetail } from "./ThinkRoutineDetail.js";
|
|
10
|
-
import { ThinkRoutineForm } from "./ThinkRoutineForm.js";
|
|
11
11
|
import * as React from "react";
|
|
12
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
//#region src/components/ThinkRoutineLibrary.tsx
|
|
14
14
|
function errorMessage(error) {
|
|
15
15
|
return error instanceof Error ? error.message : String(error);
|
|
16
16
|
}
|
|
17
|
-
function RoutineTopBarActions({ busy, onDelete,
|
|
17
|
+
function RoutineTopBarActions({ busy, onDelete, editLink, onRun, routineName }) {
|
|
18
18
|
const [deleteOpen, setDeleteOpen] = React.useState(false);
|
|
19
19
|
const moreActionsRef = React.useRef(null);
|
|
20
|
-
const hasMenu = Boolean(
|
|
20
|
+
const hasMenu = Boolean(editLink || onDelete);
|
|
21
21
|
if (!onRun && !hasMenu) return null;
|
|
22
22
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(AppTopBar.Trailing, {
|
|
23
23
|
"aria-label": "Schedule actions",
|
|
@@ -39,8 +39,8 @@ function RoutineTopBarActions({ busy, onDelete, onEdit, onRun, routineName }) {
|
|
|
39
39
|
}), /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
40
40
|
align: "end",
|
|
41
41
|
sideOffset: 4,
|
|
42
|
-
children: /* @__PURE__ */ jsxs(Menu.Popup, { children: [
|
|
43
|
-
|
|
42
|
+
children: /* @__PURE__ */ jsxs(Menu.Popup, { children: [editLink ? /* @__PURE__ */ jsx(Menu.Item, {
|
|
43
|
+
render: editLink,
|
|
44
44
|
children: "Edit schedule"
|
|
45
45
|
}) : null, onDelete ? /* @__PURE__ */ jsx(Menu.Item, {
|
|
46
46
|
variant: "destructive",
|
|
@@ -77,33 +77,25 @@ function RoutineTopBarActions({ busy, onDelete, onEdit, onRun, routineName }) {
|
|
|
77
77
|
/**
|
|
78
78
|
* Full-page, cross-agent routine library. This intentionally does not live in
|
|
79
79
|
* ThinkFullApp's per-thread workbench: the host app owns aggregation, routes,
|
|
80
|
-
* authoring
|
|
80
|
+
* authoring routes, and the association between schedules and native runs.
|
|
81
81
|
* The application shell composes `ThinkRoutineBrowser`, `ThinkRoutineDetail`,
|
|
82
|
-
*
|
|
83
|
-
* surfaces independently.
|
|
82
|
+
* and `ThinkRoutineRuns`; consumers compose `ThinkRoutineForm` in their create
|
|
83
|
+
* route and may also use these surfaces independently.
|
|
84
84
|
*/
|
|
85
|
-
function ThinkRoutineLibrary({ appBarLeading, className,
|
|
86
|
-
const [view, setView] = React.useState("library");
|
|
87
|
-
const [innerSelectedId, setInnerSelectedId] = React.useState(defaultSelectedRoutineId ?? routines[0]?.id ?? "");
|
|
85
|
+
function ThinkRoutineLibrary({ appBarLeading, className, createRoutineLink, error: catalogError, onDeleteRoutine, onRoutineEnabledChange, onRunRoutine, renderEditRoutineLink, renderRoutineLink, renderRoutineDetail, renderRunLink, ref, routines, selectedRoutineId, showOwner = true, ...props }) {
|
|
88
86
|
const [busy, setBusy] = React.useState(false);
|
|
89
87
|
const [announcement, setAnnouncement] = React.useState("");
|
|
90
|
-
const [
|
|
91
|
-
const
|
|
92
|
-
const selectedRoutine = routines.find((routine) => routine.id === activeId) ?? (selectedRoutineId === void 0 ? routines[0] : void 0);
|
|
93
|
-
const requestCreate = onCreateRoutineRequest ?? (onCreateRoutine ? () => setView("create") : void 0);
|
|
94
|
-
const selectRoutine = (id) => {
|
|
95
|
-
if (selectedRoutineId === void 0) setInnerSelectedId(id);
|
|
96
|
-
onSelectedRoutineIdChange?.(id);
|
|
97
|
-
};
|
|
88
|
+
const [actionError, setActionError] = React.useState(null);
|
|
89
|
+
const selectedRoutine = selectedRoutineId ? routines.find((routine) => routine.id === selectedRoutineId) : void 0;
|
|
98
90
|
const perform = async (action, message) => {
|
|
99
91
|
setBusy(true);
|
|
100
|
-
|
|
92
|
+
setActionError(null);
|
|
101
93
|
try {
|
|
102
94
|
await action();
|
|
103
95
|
setAnnouncement(message);
|
|
104
96
|
return true;
|
|
105
97
|
} catch (nextError) {
|
|
106
|
-
|
|
98
|
+
setActionError(errorMessage(nextError));
|
|
107
99
|
return false;
|
|
108
100
|
} finally {
|
|
109
101
|
setBusy(false);
|
|
@@ -112,82 +104,60 @@ function ThinkRoutineLibrary({ appBarLeading, className, defaultSelectedRoutineI
|
|
|
112
104
|
const detailProps = selectedRoutine ? {
|
|
113
105
|
routine: selectedRoutine,
|
|
114
106
|
busy,
|
|
115
|
-
|
|
107
|
+
renderRunLink: renderRunLink ? (run) => renderRunLink(selectedRoutine, run) : void 0,
|
|
116
108
|
onEnabledChange: onRoutineEnabledChange ? (enabled) => void perform(() => onRoutineEnabledChange(selectedRoutine, enabled), `${selectedRoutine.name} ${enabled ? "activated" : "paused"}.`) : void 0
|
|
117
109
|
} : void 0;
|
|
118
|
-
if (view === "create") return /* @__PURE__ */ jsxs("div", {
|
|
119
|
-
ref,
|
|
120
|
-
className: cx("think-routine-library", className),
|
|
121
|
-
...props,
|
|
122
|
-
children: [
|
|
123
|
-
error ? /* @__PURE__ */ jsxs("div", {
|
|
124
|
-
className: "think-routine-library__error",
|
|
125
|
-
role: "alert",
|
|
126
|
-
children: [/* @__PURE__ */ jsx(WarningIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", { children: error })]
|
|
127
|
-
}) : null,
|
|
128
|
-
/* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
129
|
-
"aria-label": "Schedule editor controls",
|
|
130
|
-
children: [/* @__PURE__ */ jsxs(AppTopBar.Leading, { children: [/* @__PURE__ */ jsx(AppTopBar.Button, {
|
|
131
|
-
label: "Back to schedules",
|
|
132
|
-
onClick: () => setView("library"),
|
|
133
|
-
children: /* @__PURE__ */ jsx(ArrowLeftIcon, {})
|
|
134
|
-
}), appBarLeading] }), /* @__PURE__ */ jsx(AppTopBar.Title, { children: "New schedule" })]
|
|
135
|
-
}),
|
|
136
|
-
/* @__PURE__ */ jsx(ThinkRoutineForm, {
|
|
137
|
-
busy,
|
|
138
|
-
owners,
|
|
139
|
-
schedules,
|
|
140
|
-
onCancel: () => setView("library"),
|
|
141
|
-
onCreate: (request) => {
|
|
142
|
-
if (!onCreateRoutine) return;
|
|
143
|
-
perform(() => onCreateRoutine(request), `Created ${request.name}.`).then((created) => {
|
|
144
|
-
if (created) setView("library");
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}),
|
|
148
|
-
/* @__PURE__ */ jsx("div", {
|
|
149
|
-
className: "think-routine-library__status sigvelo-visually-hidden",
|
|
150
|
-
role: "status",
|
|
151
|
-
"aria-atomic": "true",
|
|
152
|
-
children: announcement
|
|
153
|
-
})
|
|
154
|
-
]
|
|
155
|
-
});
|
|
156
110
|
return /* @__PURE__ */ jsxs("div", {
|
|
157
111
|
ref,
|
|
158
112
|
className: cx("think-routine-library", className),
|
|
159
113
|
...props,
|
|
160
114
|
children: [
|
|
161
|
-
|
|
115
|
+
catalogError || actionError ? /* @__PURE__ */ jsxs("div", {
|
|
162
116
|
className: "think-routine-library__error",
|
|
163
117
|
role: "alert",
|
|
164
|
-
children: [/* @__PURE__ */ jsx(WarningIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", { children:
|
|
118
|
+
children: [/* @__PURE__ */ jsx(WarningIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", { children: catalogError || actionError })]
|
|
165
119
|
}) : null,
|
|
166
120
|
/* @__PURE__ */ jsx(ResponsiveSidebarShell, {
|
|
167
121
|
className: "think-routine-library__layout",
|
|
168
122
|
sidebarLabel: "schedules",
|
|
123
|
+
defaultSidebarOpen: false,
|
|
169
124
|
toolbarLabel: "Schedule navigation controls",
|
|
170
125
|
showMainLabel: "Show selected schedule",
|
|
171
|
-
topBar: ({ sidebarToggle }) => /* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
126
|
+
topBar: ({ sidebarId, sidebarOpen, sidebarToggle, toggleSidebar }) => /* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
172
127
|
"aria-label": "Schedule controls",
|
|
173
128
|
children: [
|
|
174
129
|
/* @__PURE__ */ jsxs(AppTopBar.Leading, { children: [sidebarToggle, appBarLeading] }),
|
|
175
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ jsxs(AppTopBar.Title, { children: [/* @__PURE__ */ jsx("span", {
|
|
131
|
+
className: "think-routine-library__app-title",
|
|
132
|
+
children: selectedRoutine?.name ?? "Schedules"
|
|
133
|
+
}), selectedRoutine ? /* @__PURE__ */ jsxs(Button, {
|
|
134
|
+
type: "button",
|
|
135
|
+
variant: "ghost",
|
|
136
|
+
color: "neutral",
|
|
137
|
+
size: "sm",
|
|
138
|
+
className: "think-routine-library__schedule-trigger",
|
|
139
|
+
"aria-controls": sidebarId,
|
|
140
|
+
"aria-expanded": sidebarOpen,
|
|
141
|
+
onClick: (event) => toggleSidebar(event.currentTarget),
|
|
142
|
+
children: [/* @__PURE__ */ jsx("span", { children: selectedRoutine.name }), /* @__PURE__ */ jsx(ChevronDownIcon, { "aria-hidden": "true" })]
|
|
143
|
+
}) : null] }),
|
|
176
144
|
/* @__PURE__ */ jsx(RoutineTopBarActions, {
|
|
177
145
|
busy,
|
|
178
146
|
routineName: selectedRoutine?.name ?? "schedule",
|
|
147
|
+
editLink: selectedRoutine && renderEditRoutineLink ? renderEditRoutineLink(selectedRoutine) : void 0,
|
|
179
148
|
onRun: selectedRoutine && onRunRoutine ? () => void perform(() => onRunRoutine(selectedRoutine), `Started ${selectedRoutine.name}.`) : void 0,
|
|
180
|
-
onEdit: selectedRoutine && onEditRoutine ? () => onEditRoutine(selectedRoutine) : void 0,
|
|
181
149
|
onDelete: selectedRoutine && onDeleteRoutine ? () => void perform(() => onDeleteRoutine(selectedRoutine), `Deleted ${selectedRoutine.name}.`) : void 0
|
|
182
150
|
})
|
|
183
151
|
]
|
|
184
152
|
}),
|
|
185
153
|
sidebar: ({ closeSidebarOnCompact }) => /* @__PURE__ */ jsx(ThinkRoutineBrowser, {
|
|
186
154
|
routines,
|
|
187
|
-
selectedRoutineId
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
155
|
+
selectedRoutineId,
|
|
156
|
+
showOwner,
|
|
157
|
+
renderRoutineLink,
|
|
158
|
+
createRoutineLink,
|
|
159
|
+
onRoutineLinkClick: (event) => {
|
|
160
|
+
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.currentTarget.target === "_blank") return;
|
|
191
161
|
closeSidebarOnCompact();
|
|
192
162
|
}
|
|
193
163
|
}),
|
|
@@ -195,17 +165,24 @@ function ThinkRoutineLibrary({ appBarLeading, className, defaultSelectedRoutineI
|
|
|
195
165
|
className: "think-routine-library__main",
|
|
196
166
|
children: detailProps ? /* @__PURE__ */ jsx(React.Fragment, { children: renderRoutineDetail ? renderRoutineDetail({
|
|
197
167
|
...detailProps,
|
|
198
|
-
defaultDetail: /* @__PURE__ */ jsx(ThinkRoutineDetail, {
|
|
199
|
-
|
|
168
|
+
defaultDetail: /* @__PURE__ */ jsx(ThinkRoutineDetail, {
|
|
169
|
+
...detailProps,
|
|
170
|
+
showOwner
|
|
171
|
+
})
|
|
172
|
+
}) : /* @__PURE__ */ jsx(ThinkRoutineDetail, {
|
|
173
|
+
...detailProps,
|
|
174
|
+
showOwner
|
|
175
|
+
}) }, detailProps.routine.id) : /* @__PURE__ */ jsxs("div", {
|
|
200
176
|
className: "think-routine-library__empty-detail",
|
|
201
177
|
children: [
|
|
202
|
-
/* @__PURE__ */ jsx("h1", { children: routines.length ? "
|
|
178
|
+
/* @__PURE__ */ jsx("h1", { children: selectedRoutineId ? "Schedule unavailable" : routines.length ? "Select a schedule" : "No schedules yet" }),
|
|
203
179
|
/* @__PURE__ */ jsx("p", { children: routines.length ? "Select an available schedule." : "Create a schedule to run recurring Think prompts." }),
|
|
204
|
-
!routines.length &&
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
180
|
+
!routines.length && createRoutineLink ? /* @__PURE__ */ jsx(NavigationLink, {
|
|
181
|
+
render: createRoutineLink,
|
|
182
|
+
className: buttonVariants({
|
|
183
|
+
color: "primary",
|
|
184
|
+
className: "think-routine-library__empty-action"
|
|
185
|
+
}),
|
|
209
186
|
children: "Create schedule"
|
|
210
187
|
}) : null
|
|
211
188
|
]
|
|
@@ -6,7 +6,8 @@ interface ThinkRoutineRunsProps<TRun extends ThinkExecutionRun = ThinkExecutionR
|
|
|
6
6
|
runs: readonly TRun[];
|
|
7
7
|
title?: React.ReactNode;
|
|
8
8
|
emptyState?: React.ReactNode;
|
|
9
|
-
|
|
9
|
+
/** App-authored TanStack Router Link for each durable execution destination. */
|
|
10
|
+
renderRunLink?: (run: TRun) => React.ReactElement;
|
|
10
11
|
}
|
|
11
12
|
/** Compact execution history shared by routine detail surfaces. */
|
|
12
13
|
declare function ThinkRoutineRuns<TRun extends ThinkExecutionRun = ThinkExecutionRun>({
|
|
@@ -14,7 +15,7 @@ declare function ThinkRoutineRuns<TRun extends ThinkExecutionRun = ThinkExecutio
|
|
|
14
15
|
runs,
|
|
15
16
|
title,
|
|
16
17
|
emptyState,
|
|
17
|
-
|
|
18
|
+
renderRunLink,
|
|
18
19
|
ref,
|
|
19
20
|
...props
|
|
20
21
|
}: ThinkRoutineRunsProps<TRun> & {
|