@mcp-b/react-components 0.64.1 → 0.66.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/AgentComputer-2uYB8kmu.js +8084 -0
- package/dist/{ExecutionResult-CXnGcmM4.js → ExecutionResult-C7SzVquo.js} +1 -1
- package/dist/WallpaperPicker-C-FItmDS.d.ts +34 -0
- package/dist/WorkspaceBrowser-Dz48H-7X.d.ts +89 -0
- package/dist/{WorkspaceFileCommands-SNIjRgtU.d.ts → WorkspaceFileCommands-1s9Ol8CG.d.ts} +11 -3
- package/dist/{WorkspaceMessageResponse-CXGOQgpo.js → WorkspaceMessageResponse-BoeeltJM.js} +1 -1
- package/dist/assets/wallpapers/README.md +31 -0
- package/dist/assets/wallpapers/alpine.webp +0 -0
- package/dist/assets/wallpapers/dusk.webp +0 -0
- package/dist/assets/wallpapers/ember.webp +0 -0
- package/dist/assets/wallpapers/graphite.webp +0 -0
- package/dist/assets/wallpapers/sigvelo.webp +0 -0
- package/dist/assets/wallpapers/tide.webp +0 -0
- package/dist/automations-host-DPORjdc7.js +17 -0
- package/dist/components/agents-sdk/AgentComputer.d.ts +7 -1
- package/dist/components/agents-sdk/AgentComputer.js +1 -8044
- package/dist/components/agents-sdk/AgentScreenSwitcher.js +1 -0
- package/dist/components/agents-sdk/BrowserLiveScreen.d.ts +7 -1
- package/dist/components/agents-sdk/BrowserLiveScreen.js +259 -257
- package/dist/components/agents-sdk/BrowserRunPanel.d.ts +2 -0
- package/dist/components/agents-sdk/BrowserRunPanel.js +1 -0
- package/dist/components/agents-sdk/ComputerAutomations.d.ts +70 -0
- package/dist/components/agents-sdk/ComputerAutomations.js +1410 -0
- package/dist/components/agents-sdk/ComputerCalendar.d.ts +7 -0
- package/dist/components/agents-sdk/ComputerCalendar.js +1344 -0
- package/dist/components/agents-sdk/ComputerFiles.d.ts +153 -0
- package/dist/components/agents-sdk/ComputerFiles.js +2401 -0
- package/dist/components/agents-sdk/ComputerHome.d.ts +15 -0
- package/dist/components/agents-sdk/ComputerHome.js +90 -0
- package/dist/components/agents-sdk/ComputerNotifications.d.ts +54 -0
- package/dist/components/agents-sdk/ComputerNotifications.js +692 -0
- package/dist/components/agents-sdk/ComputerScreen.d.ts +78 -0
- package/dist/components/agents-sdk/ComputerScreen.js +750 -0
- package/dist/components/agents-sdk/ComputerSettings.d.ts +69 -0
- package/dist/components/agents-sdk/ComputerSettings.js +1371 -0
- package/dist/components/agents-sdk/ComputerSpotlight.d.ts +29 -0
- package/dist/components/agents-sdk/ComputerSpotlight.js +232 -0
- package/dist/components/agents-sdk/ComputerViewer.d.ts +51 -0
- package/dist/components/agents-sdk/ComputerViewer.js +339 -0
- package/dist/components/agents-sdk/ComputerWallpapers.d.ts +11 -0
- package/dist/components/agents-sdk/ComputerWallpapers.js +43 -0
- package/dist/components/agents-sdk/EmployeeApp.js +1 -1
- package/dist/components/agents-sdk/EmployeeChat.js +1 -1
- package/dist/components/agents-sdk/EmployeeChrome.js +4 -4
- package/dist/components/agents-sdk/EmployeeSchedules.js +3 -3
- package/dist/components/agents-sdk/EmployeeStartScreen.js +1 -1
- package/dist/components/agents-sdk/ExecutionBoard.js +1 -1
- package/dist/components/agents-sdk/ManagerOffice.js +1 -1
- package/dist/components/agents-sdk/ManagerOfficeScreens.js +1 -1
- package/dist/components/agents-sdk/McpPluginCatalog.js +1 -1
- package/dist/components/agents-sdk/ModelSelector.js +1 -1
- package/dist/components/agents-sdk/ThinkChat.js +1 -1
- package/dist/components/agents-sdk/ThinkChatActivitySummary.js +1 -1
- package/dist/components/agents-sdk/ThinkChatToolPanels.js +5 -5
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +3 -3
- package/dist/components/agents-sdk/ThinkFullApp.d.ts +13 -0
- package/dist/components/agents-sdk/ThinkFullApp.js +13 -0
- package/dist/components/agents-sdk/ThinkScheduleActions.js +1 -1
- package/dist/components/agents-sdk/ThinkScheduleDetail.js +3 -3
- package/dist/components/agents-sdk/ThinkScheduleForm.js +4 -4
- package/dist/components/agents-sdk/WorkspaceAutomation.js +4 -4
- package/dist/components/agents-sdk/WorkspaceAutomationTable.js +1 -1
- package/dist/components/agents-sdk/WorkspaceBrowser.d.ts +2 -88
- package/dist/components/agents-sdk/WorkspaceCorrespondence.js +1 -1
- package/dist/components/agents-sdk/WorkspaceDesktop.d.ts +1 -1
- package/dist/components/agents-sdk/WorkspaceDocumentFrame.d.ts +17 -0
- package/dist/components/agents-sdk/WorkspaceDocumentFrame.js +90 -0
- package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +4 -1
- package/dist/components/agents-sdk/WorkspaceExplorer.js +70 -66
- package/dist/components/agents-sdk/WorkspaceFileCommands.d.ts +2 -2
- package/dist/components/agents-sdk/WorkspaceFileCommands.js +346 -316
- package/dist/components/agents-sdk/WorkspaceFileView.d.ts +7 -1
- package/dist/components/agents-sdk/WorkspaceFileView.js +83 -71
- package/dist/components/agents-sdk/WorkspaceLink.js +1 -1
- package/dist/components/agents-sdk/WorkspaceLive.d.ts +2 -4
- package/dist/components/agents-sdk/WorkspaceLive.js +18 -11
- package/dist/components/agents-sdk/WorkspaceMessageResponse.js +1 -1
- package/dist/components/agents-sdk/WorkspaceProject.d.ts +2 -1
- package/dist/components/agents-sdk/WorkspaceProject.js +7 -4
- package/dist/components/ai-sdk/ConnectedAppCards.js +1 -1
- package/dist/components/ai-sdk/Goal.d.ts +1 -2
- package/dist/components/ai-sdk/Goal.js +1 -2
- package/dist/components/extension/FirstRunSetup.d.ts +132 -37
- package/dist/components/extension/FirstRunSetup.js +1920 -1567
- package/dist/components/general-purpose/CommandPalette.d.ts +6 -1
- package/dist/components/general-purpose/CommandPalette.js +90 -82
- package/dist/components/general-purpose/ResponsiveSidebarShell.js +1 -1
- package/dist/components/general-purpose/StatusScreen.d.ts +6 -1
- package/dist/components/general-purpose/StatusScreen.js +44 -36
- package/dist/components/general-purpose/ThemeModeControl.js +1 -1
- package/dist/components/general-purpose/WallpaperPicker.d.ts +2 -33
- package/dist/components/nanites/AgentConnection.js +1 -1
- package/dist/parts-BxJC0QVb.js +112 -0
- package/dist/styles/agent-computer.css +28 -0
- package/dist/styles/base.css +6 -0
- package/dist/styles/chatgpt-sign-in-screen.css +2 -0
- package/dist/styles/computer-app-tile.css +20 -0
- package/dist/styles/computer-automations.css +454 -0
- package/dist/styles/computer-calendar.css +648 -0
- package/dist/styles/computer-files.css +566 -0
- package/dist/styles/computer-home.css +90 -0
- package/dist/styles/computer-notifications.css +242 -0
- package/dist/styles/computer-screen.css +89 -0
- package/dist/styles/computer-settings.css +550 -0
- package/dist/styles/computer-spotlight.css +7 -0
- package/dist/styles/computer-viewer.css +130 -0
- package/dist/styles/first-run-setup.css +107 -96
- package/dist/styles/index.css +11 -0
- package/dist/styles/recipes.css +42 -0
- package/dist/styles/select.css +2 -1
- package/dist/styles/switch.css +20 -5
- package/dist/styles/workspace-document-frame.css +31 -0
- package/package.json +2 -2
- package/dist/{ManagerOffice-T79utm-P.js → ManagerOffice-kSK7vTBl.js} +1 -1
- package/dist/{WorkspaceLink-DDkj-Tq5.js → WorkspaceLink-DK9kdMUH.js} +1 -1
- package/dist/{connected-app-drafts-Bocdg3Z-.js → connected-app-drafts-C49343p9.js} +1 -1
|
@@ -0,0 +1,1410 @@
|
|
|
1
|
+
import { desktopArtwork } from "../../utils/desktop-artwork.js";
|
|
2
|
+
import { $ as QueueIcon, I as ListIcon, J as PencilIcon, O as FileIcon, f as CalendarIcon, h as ChevronLeftIcon } from "../../icons-nLTnB9kd.js";
|
|
3
|
+
import { Button } from "../foundations/Button.js";
|
|
4
|
+
import { IconButton } from "../foundations/IconButton.js";
|
|
5
|
+
import { AppIcon } from "../foundations/AppIcon.js";
|
|
6
|
+
import { Tabs } from "../foundations/Tabs.js";
|
|
7
|
+
import { AlertDialog } from "../foundations/AlertDialog.js";
|
|
8
|
+
import { n as useAgentComputerActions } from "../../AgentComputer-2uYB8kmu.js";
|
|
9
|
+
import { Menubar } from "../foundations/Menubar.js";
|
|
10
|
+
import { getThinkExecutionRunId } from "./ThinkExecutionRun.js";
|
|
11
|
+
import { ThinkExecutionRunSummary } from "./ThinkExecutionStatus.js";
|
|
12
|
+
import { ThinkExecutionDetail } from "./ThinkExecutionDetail.js";
|
|
13
|
+
import { r as createAppBarOutlet, t as ContentAppBarOutletContext } from "../../app-bar-outlet-BEIGl9iF.js";
|
|
14
|
+
import { AppTopBar } from "../general-purpose/AppTopBar.js";
|
|
15
|
+
import { ResponsiveSidebarAppBar, ResponsiveSidebarShell, useResponsiveSidebarShell } from "../general-purpose/ResponsiveSidebarShell.js";
|
|
16
|
+
import { WorkspaceAutomationsPanel } from "./WorkspaceAutomation.js";
|
|
17
|
+
import { LinkButton } from "../foundations/LinkButton.js";
|
|
18
|
+
import { StatusScreen } from "../general-purpose/StatusScreen.js";
|
|
19
|
+
import { n as useComputerAutomationsContext, r as zonedFormat, t as ComputerAutomationsContext } from "../../automations-host-DPORjdc7.js";
|
|
20
|
+
import { n as computerAppTile, t as computerAppParts } from "../../parts-BxJC0QVb.js";
|
|
21
|
+
import { ThinkScheduleActions, useThinkScheduleActions } from "./ThinkScheduleActions.js";
|
|
22
|
+
import { ThinkScheduleBrowser } from "./ThinkScheduleBrowser.js";
|
|
23
|
+
import { ThinkScheduleDetail } from "./ThinkScheduleDetail.js";
|
|
24
|
+
import { ThinkScheduleForm } from "./ThinkScheduleForm.js";
|
|
25
|
+
import { ScreenStack } from "../general-purpose/ScreenStack.js";
|
|
26
|
+
import { c } from "react/compiler-runtime";
|
|
27
|
+
import * as React from "react";
|
|
28
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
29
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
30
|
+
import { useQuery } from "@tanstack/react-query";
|
|
31
|
+
import { createPortal } from "react-dom";
|
|
32
|
+
//#region src/components/_internal/computer-apps/schedules.tsx
|
|
33
|
+
/** The schedule list, closing the compact drawer once a schedule is chosen. */
|
|
34
|
+
function ScheduleSidebar(props) {
|
|
35
|
+
const $ = c(3);
|
|
36
|
+
const { closeSidebarOnCompact } = useResponsiveSidebarShell();
|
|
37
|
+
let t0;
|
|
38
|
+
if ($[0] !== closeSidebarOnCompact || $[1] !== props) {
|
|
39
|
+
t0 = /* @__PURE__ */ jsx(ThinkScheduleBrowser, {
|
|
40
|
+
...props,
|
|
41
|
+
onScheduleLinkClick: closeSidebarOnCompact
|
|
42
|
+
});
|
|
43
|
+
$[0] = closeSidebarOnCompact;
|
|
44
|
+
$[1] = props;
|
|
45
|
+
$[2] = t0;
|
|
46
|
+
} else t0 = $[2];
|
|
47
|
+
return t0;
|
|
48
|
+
}
|
|
49
|
+
/** The detail reads the selected schedule's action scope, so it mounts inside the Root. */
|
|
50
|
+
function SelectedSchedule(t0) {
|
|
51
|
+
const $ = c(7);
|
|
52
|
+
const { host, schedule, automation } = t0;
|
|
53
|
+
const actions = useThinkScheduleActions();
|
|
54
|
+
let t1;
|
|
55
|
+
if ($[0] !== host) {
|
|
56
|
+
t1 = (run) => host.renderLink({
|
|
57
|
+
section: "runs",
|
|
58
|
+
run: getThinkExecutionRunId(run)
|
|
59
|
+
});
|
|
60
|
+
$[0] = host;
|
|
61
|
+
$[1] = t1;
|
|
62
|
+
} else t1 = $[1];
|
|
63
|
+
let t2;
|
|
64
|
+
if ($[2] !== actions || $[3] !== automation || $[4] !== schedule || $[5] !== t1) {
|
|
65
|
+
t2 = /* @__PURE__ */ jsx(ThinkScheduleDetail, {
|
|
66
|
+
schedule,
|
|
67
|
+
automation,
|
|
68
|
+
showOwner: false,
|
|
69
|
+
renderRunLink: t1,
|
|
70
|
+
...actions
|
|
71
|
+
});
|
|
72
|
+
$[2] = actions;
|
|
73
|
+
$[3] = automation;
|
|
74
|
+
$[4] = schedule;
|
|
75
|
+
$[5] = t1;
|
|
76
|
+
$[6] = t2;
|
|
77
|
+
} else t2 = $[6];
|
|
78
|
+
return t2;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Schedules: the runtime's own Schedules screen in a window — the schedule
|
|
82
|
+
* browser beside the selected schedule, run / edit / delete in the bar — and the
|
|
83
|
+
* editor it pushes. Every change goes to the host; the editor, its draft and
|
|
84
|
+
* the discard confirmation are the window's own.
|
|
85
|
+
*/
|
|
86
|
+
function useComputerSchedules(t0) {
|
|
87
|
+
const $ = c(79);
|
|
88
|
+
const { host, automations, automationsError, automationsLoading } = t0;
|
|
89
|
+
const { schedules } = host;
|
|
90
|
+
const selectedId = host.selection.schedule;
|
|
91
|
+
let t1;
|
|
92
|
+
if ($[0] !== host) {
|
|
93
|
+
t1 = (scheduleId) => host.onNavigate({
|
|
94
|
+
section: "schedules",
|
|
95
|
+
schedule: scheduleId
|
|
96
|
+
});
|
|
97
|
+
$[0] = host;
|
|
98
|
+
$[1] = t1;
|
|
99
|
+
} else t1 = $[1];
|
|
100
|
+
const setSelectedId = t1;
|
|
101
|
+
const [editing, setEditing] = useState(null);
|
|
102
|
+
const [automationDraft, setAutomationDraft] = useState();
|
|
103
|
+
const [dirty, setDirty] = useState(false);
|
|
104
|
+
const [confirming, setConfirming] = useState(false);
|
|
105
|
+
const confirmation = useRef(null);
|
|
106
|
+
const editorRef = useRef(null);
|
|
107
|
+
const keepEditingRef = useRef(null);
|
|
108
|
+
const editButtonRef = useRef(null);
|
|
109
|
+
const confirmingWindow = useRef(null);
|
|
110
|
+
const focusEditorAfterMenu = useRef(false);
|
|
111
|
+
const [requestKey, setRequestKey] = useState(_temp$1);
|
|
112
|
+
let t2;
|
|
113
|
+
if ($[2] !== schedules || $[3] !== selectedId) {
|
|
114
|
+
let t3;
|
|
115
|
+
if ($[5] !== selectedId) {
|
|
116
|
+
t3 = (schedule) => schedule.id === selectedId;
|
|
117
|
+
$[5] = selectedId;
|
|
118
|
+
$[6] = t3;
|
|
119
|
+
} else t3 = $[6];
|
|
120
|
+
t2 = schedules.find(t3);
|
|
121
|
+
$[2] = schedules;
|
|
122
|
+
$[3] = selectedId;
|
|
123
|
+
$[4] = t2;
|
|
124
|
+
} else t2 = $[4];
|
|
125
|
+
const selected = t2;
|
|
126
|
+
let t3;
|
|
127
|
+
if ($[7] !== editing || $[8] !== schedules) {
|
|
128
|
+
t3 = editing?.kind === "existing" ? schedules.find((schedule_0) => schedule_0.id === editing.scheduleId) : null;
|
|
129
|
+
$[7] = editing;
|
|
130
|
+
$[8] = schedules;
|
|
131
|
+
$[9] = t3;
|
|
132
|
+
} else t3 = $[9];
|
|
133
|
+
const editingSchedule = t3;
|
|
134
|
+
let t4;
|
|
135
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
136
|
+
t4 = () => {
|
|
137
|
+
const editor = editorRef.current;
|
|
138
|
+
const appWindow = editor?.closest("[data-slot=\"computer-window\"]") ?? confirmingWindow.current;
|
|
139
|
+
if (!appWindow || appWindow.closest("[data-slot=\"agent-computer\"][data-phone]") || appWindow.closest("[inert]")) return;
|
|
140
|
+
confirmingWindow.current = appWindow;
|
|
141
|
+
if (editor) editor.querySelector("[name=\"name\"]")?.focus({ preventScroll: true });
|
|
142
|
+
else if (document.activeElement === document.body || appWindow.contains(document.activeElement)) (editButtonRef.current ?? appWindow).focus({ preventScroll: true });
|
|
143
|
+
};
|
|
144
|
+
$[10] = t4;
|
|
145
|
+
} else t4 = $[10];
|
|
146
|
+
let t5;
|
|
147
|
+
if ($[11] !== editing) {
|
|
148
|
+
t5 = [editing];
|
|
149
|
+
$[11] = editing;
|
|
150
|
+
$[12] = t5;
|
|
151
|
+
} else t5 = $[12];
|
|
152
|
+
useLayoutEffect(t4, t5);
|
|
153
|
+
let t6;
|
|
154
|
+
let t7;
|
|
155
|
+
if ($[13] !== dirty) {
|
|
156
|
+
t6 = () => {
|
|
157
|
+
if (!dirty) return;
|
|
158
|
+
const protectDraft = _temp2$1;
|
|
159
|
+
window.addEventListener("beforeunload", protectDraft);
|
|
160
|
+
return () => window.removeEventListener("beforeunload", protectDraft);
|
|
161
|
+
};
|
|
162
|
+
t7 = [dirty];
|
|
163
|
+
$[13] = dirty;
|
|
164
|
+
$[14] = t6;
|
|
165
|
+
$[15] = t7;
|
|
166
|
+
} else {
|
|
167
|
+
t6 = $[14];
|
|
168
|
+
t7 = $[15];
|
|
169
|
+
}
|
|
170
|
+
useEffect(t6, t7);
|
|
171
|
+
let t8;
|
|
172
|
+
if ($[16] !== dirty) {
|
|
173
|
+
t8 = function confirmDiscard() {
|
|
174
|
+
if (!dirty) return Promise.resolve(true);
|
|
175
|
+
if (confirmation.current) return confirmation.current.promise;
|
|
176
|
+
let resolve;
|
|
177
|
+
const promise = new Promise((done) => {
|
|
178
|
+
resolve = done;
|
|
179
|
+
});
|
|
180
|
+
confirmation.current = {
|
|
181
|
+
promise,
|
|
182
|
+
resolve
|
|
183
|
+
};
|
|
184
|
+
confirmingWindow.current = editorRef.current?.closest("[data-slot=\"computer-window\"]") ?? null;
|
|
185
|
+
setConfirming(true);
|
|
186
|
+
return promise;
|
|
187
|
+
};
|
|
188
|
+
$[16] = dirty;
|
|
189
|
+
$[17] = t8;
|
|
190
|
+
} else t8 = $[17];
|
|
191
|
+
const confirmDiscard = t8;
|
|
192
|
+
let t9;
|
|
193
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
194
|
+
t9 = function answerDiscard(discard) {
|
|
195
|
+
const pending = confirmation.current;
|
|
196
|
+
confirmation.current = null;
|
|
197
|
+
setConfirming(false);
|
|
198
|
+
pending?.resolve(discard);
|
|
199
|
+
};
|
|
200
|
+
$[18] = t9;
|
|
201
|
+
} else t9 = $[18];
|
|
202
|
+
const answerDiscard = t9;
|
|
203
|
+
let t10;
|
|
204
|
+
if ($[19] !== confirmDiscard) {
|
|
205
|
+
t10 = async function leaveEditor() {
|
|
206
|
+
if (!await confirmDiscard()) return false;
|
|
207
|
+
setEditing(null);
|
|
208
|
+
setDirty(false);
|
|
209
|
+
setAutomationDraft(void 0);
|
|
210
|
+
return true;
|
|
211
|
+
};
|
|
212
|
+
$[19] = confirmDiscard;
|
|
213
|
+
$[20] = t10;
|
|
214
|
+
} else t10 = $[20];
|
|
215
|
+
const leaveEditor = t10;
|
|
216
|
+
let t11;
|
|
217
|
+
if ($[21] !== leaveEditor || $[22] !== schedules || $[23] !== setSelectedId) {
|
|
218
|
+
t11 = async function openSchedule(id) {
|
|
219
|
+
if (!schedules.some((schedule_1) => schedule_1.id === id) || !await leaveEditor()) return false;
|
|
220
|
+
setSelectedId(id);
|
|
221
|
+
return true;
|
|
222
|
+
};
|
|
223
|
+
$[21] = leaveEditor;
|
|
224
|
+
$[22] = schedules;
|
|
225
|
+
$[23] = setSelectedId;
|
|
226
|
+
$[24] = t11;
|
|
227
|
+
} else t11 = $[24];
|
|
228
|
+
const openSchedule = t11;
|
|
229
|
+
let t12;
|
|
230
|
+
if ($[25] !== leaveEditor) {
|
|
231
|
+
t12 = async function createSchedule() {
|
|
232
|
+
if (!await leaveEditor()) return false;
|
|
233
|
+
setEditing({ kind: "new" });
|
|
234
|
+
return true;
|
|
235
|
+
};
|
|
236
|
+
$[25] = leaveEditor;
|
|
237
|
+
$[26] = t12;
|
|
238
|
+
} else t12 = $[26];
|
|
239
|
+
const createSchedule = t12;
|
|
240
|
+
let t13;
|
|
241
|
+
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
242
|
+
t13 = function save() {
|
|
243
|
+
editorRef.current?.querySelector("form")?.requestSubmit();
|
|
244
|
+
};
|
|
245
|
+
$[27] = t13;
|
|
246
|
+
} else t13 = $[27];
|
|
247
|
+
const save = t13;
|
|
248
|
+
let t14;
|
|
249
|
+
if ($[28] !== automations || $[29] !== leaveEditor) {
|
|
250
|
+
t14 = async function openAutomationSchedule(path) {
|
|
251
|
+
if (!await leaveEditor()) return false;
|
|
252
|
+
const automation = automations.find((candidate) => candidate.path === path);
|
|
253
|
+
setAutomationDraft({
|
|
254
|
+
path,
|
|
255
|
+
args: automation ? Object.fromEntries(automation.parameters.flatMap(_temp3$1)) : void 0
|
|
256
|
+
});
|
|
257
|
+
setEditing({ kind: "new" });
|
|
258
|
+
return true;
|
|
259
|
+
};
|
|
260
|
+
$[28] = automations;
|
|
261
|
+
$[29] = leaveEditor;
|
|
262
|
+
$[30] = t14;
|
|
263
|
+
} else t14 = $[30];
|
|
264
|
+
const openAutomationSchedule = t14;
|
|
265
|
+
let t15;
|
|
266
|
+
if ($[31] !== editing?.kind || $[32] !== editingSchedule || $[33] !== host || $[34] !== requestKey || $[35] !== setSelectedId) {
|
|
267
|
+
t15 = async (value) => {
|
|
268
|
+
if (editing?.kind === "existing") {
|
|
269
|
+
if (!editingSchedule) throw new Error("The schedule being edited is no longer available.");
|
|
270
|
+
await host.onUpdateSchedule(editingSchedule, value);
|
|
271
|
+
await setSelectedId(editingSchedule.id);
|
|
272
|
+
} else {
|
|
273
|
+
const { id: id_0 } = await host.onCreateSchedule(value, requestKey);
|
|
274
|
+
setRequestKey(crypto.randomUUID());
|
|
275
|
+
await setSelectedId(id_0);
|
|
276
|
+
}
|
|
277
|
+
setDirty(false);
|
|
278
|
+
setAutomationDraft(void 0);
|
|
279
|
+
setEditing(null);
|
|
280
|
+
};
|
|
281
|
+
$[31] = editing?.kind;
|
|
282
|
+
$[32] = editingSchedule;
|
|
283
|
+
$[33] = host;
|
|
284
|
+
$[34] = requestKey;
|
|
285
|
+
$[35] = setSelectedId;
|
|
286
|
+
$[36] = t15;
|
|
287
|
+
} else t15 = $[36];
|
|
288
|
+
const submit = t15;
|
|
289
|
+
let t16;
|
|
290
|
+
if ($[37] !== host || $[38] !== schedules || $[39] !== setSelectedId) {
|
|
291
|
+
t16 = async (schedule_2) => {
|
|
292
|
+
const index = schedules.findIndex((item) => item.id === schedule_2.id);
|
|
293
|
+
const remaining = schedules.filter((item_0) => item_0.id !== schedule_2.id);
|
|
294
|
+
await host.onDeleteSchedule(schedule_2);
|
|
295
|
+
setSelectedId((remaining[index] ?? remaining[index - 1])?.id ?? null);
|
|
296
|
+
setEditing(null);
|
|
297
|
+
};
|
|
298
|
+
$[37] = host;
|
|
299
|
+
$[38] = schedules;
|
|
300
|
+
$[39] = setSelectedId;
|
|
301
|
+
$[40] = t16;
|
|
302
|
+
} else t16 = $[40];
|
|
303
|
+
const remove = t16;
|
|
304
|
+
let t17;
|
|
305
|
+
if ($[41] !== editing) {
|
|
306
|
+
t17 = (event_0) => {
|
|
307
|
+
if (editing && (event_0.ctrlKey || event_0.metaKey) && !event_0.altKey && !event_0.shiftKey && event_0.key.toLowerCase() === "s") {
|
|
308
|
+
event_0.preventDefault();
|
|
309
|
+
save();
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
$[41] = editing;
|
|
313
|
+
$[42] = t17;
|
|
314
|
+
} else t17 = $[42];
|
|
315
|
+
let t18;
|
|
316
|
+
if ($[43] !== editing || $[44] !== leaveEditor || $[45] !== selected) {
|
|
317
|
+
t18 = () => /* @__PURE__ */ jsxs(Menubar.Menu, { children: [/* @__PURE__ */ jsx(Menubar.Trigger, { children: "File" }), /* @__PURE__ */ jsx(Menubar.Portal, { children: /* @__PURE__ */ jsx(Menubar.Positioner, {
|
|
318
|
+
align: "start",
|
|
319
|
+
sideOffset: 4,
|
|
320
|
+
children: /* @__PURE__ */ jsxs(Menubar.Popup, {
|
|
321
|
+
finalFocus: () => {
|
|
322
|
+
if (!focusEditorAfterMenu.current) return true;
|
|
323
|
+
focusEditorAfterMenu.current = false;
|
|
324
|
+
return editorRef.current?.querySelector("[name=\"name\"]") ?? true;
|
|
325
|
+
},
|
|
326
|
+
children: [
|
|
327
|
+
/* @__PURE__ */ jsx(Menubar.Item, {
|
|
328
|
+
disabled: editing !== null,
|
|
329
|
+
onClick: () => {
|
|
330
|
+
focusEditorAfterMenu.current = true;
|
|
331
|
+
setEditing({ kind: "new" });
|
|
332
|
+
},
|
|
333
|
+
children: "New schedule"
|
|
334
|
+
}),
|
|
335
|
+
/* @__PURE__ */ jsx(Menubar.Item, {
|
|
336
|
+
disabled: editing !== null || !selected,
|
|
337
|
+
onClick: () => {
|
|
338
|
+
focusEditorAfterMenu.current = true;
|
|
339
|
+
setEditing({
|
|
340
|
+
kind: "existing",
|
|
341
|
+
scheduleId: selected.id
|
|
342
|
+
});
|
|
343
|
+
},
|
|
344
|
+
children: "Edit schedule"
|
|
345
|
+
}),
|
|
346
|
+
/* @__PURE__ */ jsxs(Menubar.Item, {
|
|
347
|
+
disabled: !editing,
|
|
348
|
+
onClick: save,
|
|
349
|
+
"aria-keyshortcuts": "Control+S Meta+S",
|
|
350
|
+
children: ["Save schedule ", /* @__PURE__ */ jsx(Menubar.Shortcut, { children: "⌘S" })]
|
|
351
|
+
}),
|
|
352
|
+
/* @__PURE__ */ jsx(Menubar.Item, {
|
|
353
|
+
disabled: !editing,
|
|
354
|
+
onClick: () => void leaveEditor(),
|
|
355
|
+
children: "Back to schedules"
|
|
356
|
+
})
|
|
357
|
+
]
|
|
358
|
+
})
|
|
359
|
+
}) })] });
|
|
360
|
+
$[43] = editing;
|
|
361
|
+
$[44] = leaveEditor;
|
|
362
|
+
$[45] = selected;
|
|
363
|
+
$[46] = t18;
|
|
364
|
+
} else t18 = $[46];
|
|
365
|
+
let t19;
|
|
366
|
+
if ($[47] !== editing || $[48] !== leaveEditor) {
|
|
367
|
+
t19 = editing ? (t20) => {
|
|
368
|
+
const { phone } = t20;
|
|
369
|
+
return phone ? null : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(IconButton, {
|
|
370
|
+
"data-nav-back": "",
|
|
371
|
+
label: "Schedules",
|
|
372
|
+
variant: "ghost",
|
|
373
|
+
color: "neutral",
|
|
374
|
+
size: "sm",
|
|
375
|
+
onClick: () => void leaveEditor(),
|
|
376
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
|
|
377
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
378
|
+
className: "sigvelo-truncate",
|
|
379
|
+
children: editing?.kind === "existing" ? "Edit schedule" : "New schedule"
|
|
380
|
+
})] });
|
|
381
|
+
} : void 0;
|
|
382
|
+
$[47] = editing;
|
|
383
|
+
$[48] = leaveEditor;
|
|
384
|
+
$[49] = t19;
|
|
385
|
+
} else t19 = $[49];
|
|
386
|
+
let t20;
|
|
387
|
+
if ($[50] !== automationDraft || $[51] !== automations || $[52] !== automationsError || $[53] !== automationsLoading || $[54] !== confirming || $[55] !== createSchedule || $[56] !== editing || $[57] !== editingSchedule || $[58] !== host || $[59] !== leaveEditor || $[60] !== remove || $[61] !== schedules || $[62] !== selected || $[63] !== selectedId || $[64] !== submit) {
|
|
388
|
+
t20 = (t21) => {
|
|
389
|
+
const { phone: phone_0 } = t21;
|
|
390
|
+
const selectedAutomationPath = selected && "automation" in selected.task ? selected.task.automation.path : void 0;
|
|
391
|
+
const editor_0 = /* @__PURE__ */ jsx(ThinkScheduleForm, {
|
|
392
|
+
ref: editorRef,
|
|
393
|
+
header: "none",
|
|
394
|
+
initialAutomation: editing?.kind === "new" ? automationDraft : void 0,
|
|
395
|
+
automations,
|
|
396
|
+
automationsLoading,
|
|
397
|
+
automationsError,
|
|
398
|
+
schedule: editing?.kind === "existing" ? editingSchedule ?? void 0 : void 0,
|
|
399
|
+
onSubmit: submit,
|
|
400
|
+
onDirtyChange: setDirty
|
|
401
|
+
}, editing?.kind === "existing" ? editing.scheduleId : "new");
|
|
402
|
+
const browser = /* @__PURE__ */ jsx(ResponsiveSidebarShell, {
|
|
403
|
+
"data-nav-bar": phone_0 ? "" : void 0,
|
|
404
|
+
sidebarLabel: "schedules",
|
|
405
|
+
showMainLabel: "Show selected schedule",
|
|
406
|
+
bar: {
|
|
407
|
+
label: "Schedule controls",
|
|
408
|
+
title: phone_0 ? selected?.name ?? "Schedules" : "All schedules",
|
|
409
|
+
compactTitleTrigger: schedules.length ? /* @__PURE__ */ jsx("span", { children: phone_0 ? selected?.name ?? "Schedules" : "All schedules" }) : void 0,
|
|
410
|
+
actions: selected ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
411
|
+
/* @__PURE__ */ jsx(ThinkScheduleActions.Run, {}),
|
|
412
|
+
/* @__PURE__ */ jsx(AppTopBar.Button, {
|
|
413
|
+
ref: editButtonRef,
|
|
414
|
+
label: "Edit schedule",
|
|
415
|
+
onClick: () => setEditing({
|
|
416
|
+
kind: "existing",
|
|
417
|
+
scheduleId: selected.id
|
|
418
|
+
}),
|
|
419
|
+
children: /* @__PURE__ */ jsx(PencilIcon, {})
|
|
420
|
+
}),
|
|
421
|
+
/* @__PURE__ */ jsx(ThinkScheduleActions.Delete, {})
|
|
422
|
+
] }) : null
|
|
423
|
+
},
|
|
424
|
+
sidebar: /* @__PURE__ */ jsx(ScheduleSidebar, {
|
|
425
|
+
schedules,
|
|
426
|
+
selectedScheduleId: selectedId,
|
|
427
|
+
showOwner: false,
|
|
428
|
+
renderScheduleLink: (schedule_3) => host.renderLink({
|
|
429
|
+
section: "schedules",
|
|
430
|
+
schedule: schedule_3.id
|
|
431
|
+
}),
|
|
432
|
+
newScheduleLink: /* @__PURE__ */ jsx("button", {
|
|
433
|
+
type: "button",
|
|
434
|
+
onClick: () => void createSchedule()
|
|
435
|
+
})
|
|
436
|
+
}),
|
|
437
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
438
|
+
className: "computer-schedules-content",
|
|
439
|
+
children: selected ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
440
|
+
/* @__PURE__ */ jsx(ThinkScheduleActions.Error, {}),
|
|
441
|
+
/* @__PURE__ */ jsx(SelectedSchedule, {
|
|
442
|
+
schedule: selected,
|
|
443
|
+
automation: selectedAutomationPath ? automations.find((automation_0) => automation_0.path === selectedAutomationPath) : void 0,
|
|
444
|
+
host
|
|
445
|
+
}),
|
|
446
|
+
/* @__PURE__ */ jsx(ThinkScheduleActions.Status, {})
|
|
447
|
+
] }) : /* @__PURE__ */ jsx(StatusScreen, {
|
|
448
|
+
title: selectedId && schedules.length ? "Schedule not found" : "No schedules yet",
|
|
449
|
+
description: selectedId && schedules.length ? "This schedule is no longer available." : "Create a schedule to run work automatically.",
|
|
450
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
451
|
+
onClick: () => setEditing({ kind: "new" }),
|
|
452
|
+
children: "Create schedule"
|
|
453
|
+
})
|
|
454
|
+
})
|
|
455
|
+
})
|
|
456
|
+
});
|
|
457
|
+
const composition = selected ? /* @__PURE__ */ jsx(ThinkScheduleActions.Root, {
|
|
458
|
+
schedule: selected,
|
|
459
|
+
sourceKey: host.sourceKey,
|
|
460
|
+
onRun: host.onRunSchedule,
|
|
461
|
+
onEnabledChange: host.onScheduleEnabledChange,
|
|
462
|
+
onDelete: remove,
|
|
463
|
+
children: browser
|
|
464
|
+
}) : browser;
|
|
465
|
+
const discardDialog = /* @__PURE__ */ jsx(AlertDialog.Root, {
|
|
466
|
+
open: confirming,
|
|
467
|
+
onOpenChange: (open) => {
|
|
468
|
+
if (!open) answerDiscard(false);
|
|
469
|
+
},
|
|
470
|
+
children: /* @__PURE__ */ jsxs(AlertDialog.Portal, { children: [/* @__PURE__ */ jsx(AlertDialog.Backdrop, {}), /* @__PURE__ */ jsx(AlertDialog.Viewport, { children: /* @__PURE__ */ jsxs(AlertDialog.Popup, {
|
|
471
|
+
size: "sm",
|
|
472
|
+
initialFocus: keepEditingRef,
|
|
473
|
+
finalFocus: () => {
|
|
474
|
+
const target = editorRef.current?.querySelector("[name=\"name\"]") ?? editButtonRef.current ?? confirmingWindow.current;
|
|
475
|
+
if (target && !target.closest("[inert]")) return target;
|
|
476
|
+
return true;
|
|
477
|
+
},
|
|
478
|
+
children: [
|
|
479
|
+
/* @__PURE__ */ jsx(AlertDialog.Title, { children: "Discard schedule changes?" }),
|
|
480
|
+
/* @__PURE__ */ jsx(AlertDialog.Description, { children: "Your changes have not been saved." }),
|
|
481
|
+
/* @__PURE__ */ jsxs(AlertDialog.Footer, { children: [/* @__PURE__ */ jsx(AlertDialog.Close, {
|
|
482
|
+
ref: keepEditingRef,
|
|
483
|
+
children: "Keep editing"
|
|
484
|
+
}), /* @__PURE__ */ jsx(AlertDialog.Close, {
|
|
485
|
+
color: "destructive",
|
|
486
|
+
onClick: () => answerDiscard(true),
|
|
487
|
+
children: "Discard changes"
|
|
488
|
+
})] })
|
|
489
|
+
]
|
|
490
|
+
}) })] })
|
|
491
|
+
});
|
|
492
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(ScreenStack.Root, {
|
|
493
|
+
className: "computer-schedules-stack",
|
|
494
|
+
"data-plane": editing ? void 0 : "page",
|
|
495
|
+
onPop: phone_0 ? () => void leaveEditor() : void 0,
|
|
496
|
+
children: [/* @__PURE__ */ jsx(ScreenStack.Screen, { children: composition }, "schedules"), editing ? /* @__PURE__ */ jsx(ScreenStack.Screen, { children: /* @__PURE__ */ jsxs("div", {
|
|
497
|
+
className: "computer-schedules-screen",
|
|
498
|
+
children: [phone_0 ? /* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
499
|
+
"aria-label": editing?.kind === "existing" ? "Edit schedule" : "New schedule",
|
|
500
|
+
"data-nav-bar": "",
|
|
501
|
+
children: [/* @__PURE__ */ jsx(AppTopBar.Leading, { children: /* @__PURE__ */ jsx(AppTopBar.Button, {
|
|
502
|
+
"data-nav-back": "",
|
|
503
|
+
label: "Schedules",
|
|
504
|
+
onClick: () => void leaveEditor(),
|
|
505
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
|
|
506
|
+
}) }), /* @__PURE__ */ jsx(AppTopBar.Title, { children: editing?.kind === "existing" ? "Edit schedule" : "New schedule" })]
|
|
507
|
+
}) : null, editor_0]
|
|
508
|
+
}) }, `editor:${editing.kind}:${editing.kind === "existing" ? editing.scheduleId : "new"}`) : null]
|
|
509
|
+
}), discardDialog] });
|
|
510
|
+
};
|
|
511
|
+
$[50] = automationDraft;
|
|
512
|
+
$[51] = automations;
|
|
513
|
+
$[52] = automationsError;
|
|
514
|
+
$[53] = automationsLoading;
|
|
515
|
+
$[54] = confirming;
|
|
516
|
+
$[55] = createSchedule;
|
|
517
|
+
$[56] = editing;
|
|
518
|
+
$[57] = editingSchedule;
|
|
519
|
+
$[58] = host;
|
|
520
|
+
$[59] = leaveEditor;
|
|
521
|
+
$[60] = remove;
|
|
522
|
+
$[61] = schedules;
|
|
523
|
+
$[62] = selected;
|
|
524
|
+
$[63] = selectedId;
|
|
525
|
+
$[64] = submit;
|
|
526
|
+
$[65] = t20;
|
|
527
|
+
} else t20 = $[65];
|
|
528
|
+
let t21;
|
|
529
|
+
if ($[66] !== leaveEditor || $[67] !== t17 || $[68] !== t18 || $[69] !== t19 || $[70] !== t20) {
|
|
530
|
+
t21 = {
|
|
531
|
+
beforeQuit: leaveEditor,
|
|
532
|
+
onKeyDown: t17,
|
|
533
|
+
renderMenus: t18,
|
|
534
|
+
renderTitle: t19,
|
|
535
|
+
render: t20
|
|
536
|
+
};
|
|
537
|
+
$[66] = leaveEditor;
|
|
538
|
+
$[67] = t17;
|
|
539
|
+
$[68] = t18;
|
|
540
|
+
$[69] = t19;
|
|
541
|
+
$[70] = t20;
|
|
542
|
+
$[71] = t21;
|
|
543
|
+
} else t21 = $[71];
|
|
544
|
+
const model = t21;
|
|
545
|
+
const t22 = editing !== null;
|
|
546
|
+
let t23;
|
|
547
|
+
if ($[72] !== createSchedule || $[73] !== leaveEditor || $[74] !== model || $[75] !== openAutomationSchedule || $[76] !== openSchedule || $[77] !== t22) {
|
|
548
|
+
t23 = {
|
|
549
|
+
model,
|
|
550
|
+
editing: t22,
|
|
551
|
+
openAutomationSchedule,
|
|
552
|
+
openSchedule,
|
|
553
|
+
createSchedule,
|
|
554
|
+
leaveEditor
|
|
555
|
+
};
|
|
556
|
+
$[72] = createSchedule;
|
|
557
|
+
$[73] = leaveEditor;
|
|
558
|
+
$[74] = model;
|
|
559
|
+
$[75] = openAutomationSchedule;
|
|
560
|
+
$[76] = openSchedule;
|
|
561
|
+
$[77] = t22;
|
|
562
|
+
$[78] = t23;
|
|
563
|
+
} else t23 = $[78];
|
|
564
|
+
return t23;
|
|
565
|
+
}
|
|
566
|
+
function _temp3$1(parameter) {
|
|
567
|
+
return parameter.value === void 0 ? [] : [[parameter.name, parameter.value]];
|
|
568
|
+
}
|
|
569
|
+
function _temp2$1(event) {
|
|
570
|
+
return event.preventDefault();
|
|
571
|
+
}
|
|
572
|
+
function _temp$1() {
|
|
573
|
+
return crypto.randomUUID();
|
|
574
|
+
}
|
|
575
|
+
//#endregion
|
|
576
|
+
//#region src/components/agents-sdk/ComputerAutomations.tsx
|
|
577
|
+
function UpcomingAgenda(t0) {
|
|
578
|
+
const $ = c(11);
|
|
579
|
+
const { schedules, timeZone } = t0;
|
|
580
|
+
const titleId = React.useId();
|
|
581
|
+
let t1;
|
|
582
|
+
if ($[0] !== schedules || $[1] !== timeZone || $[2] !== titleId) {
|
|
583
|
+
const time = zonedFormat(timeZone, {
|
|
584
|
+
hour: "numeric",
|
|
585
|
+
minute: "2-digit"
|
|
586
|
+
});
|
|
587
|
+
const upcoming = schedules.filter(_temp).toSorted(_temp2);
|
|
588
|
+
let t2;
|
|
589
|
+
if ($[4] !== titleId) {
|
|
590
|
+
t2 = /* @__PURE__ */ jsx("span", {
|
|
591
|
+
id: titleId,
|
|
592
|
+
children: "Next up"
|
|
593
|
+
});
|
|
594
|
+
$[4] = titleId;
|
|
595
|
+
$[5] = t2;
|
|
596
|
+
} else t2 = $[5];
|
|
597
|
+
const t3 = upcoming.length ? `${upcoming.length} confirmed occurrence${upcoming.length === 1 ? "" : "s"}` : "Nothing scheduled";
|
|
598
|
+
let t4;
|
|
599
|
+
if ($[6] !== t3) {
|
|
600
|
+
t4 = /* @__PURE__ */ jsx("span", { children: t3 });
|
|
601
|
+
$[6] = t3;
|
|
602
|
+
$[7] = t4;
|
|
603
|
+
} else t4 = $[7];
|
|
604
|
+
let t5;
|
|
605
|
+
if ($[8] !== t2 || $[9] !== t4) {
|
|
606
|
+
t5 = /* @__PURE__ */ jsxs("summary", {
|
|
607
|
+
className: "computer-automations__section-heading",
|
|
608
|
+
children: [t2, t4]
|
|
609
|
+
});
|
|
610
|
+
$[8] = t2;
|
|
611
|
+
$[9] = t4;
|
|
612
|
+
$[10] = t5;
|
|
613
|
+
} else t5 = $[10];
|
|
614
|
+
t1 = /* @__PURE__ */ jsxs("details", {
|
|
615
|
+
className: "computer-automations__agenda",
|
|
616
|
+
"aria-labelledby": titleId,
|
|
617
|
+
children: [t5, upcoming.length ? /* @__PURE__ */ jsx("ol", { children: upcoming.map((schedule_0) => {
|
|
618
|
+
const date = /* @__PURE__ */ new Date(schedule_0.alarm.time * 1e3);
|
|
619
|
+
return /* @__PURE__ */ jsxs("li", { children: [
|
|
620
|
+
/* @__PURE__ */ jsxs("div", {
|
|
621
|
+
className: "computer-automations__agenda-date",
|
|
622
|
+
children: [/* @__PURE__ */ jsx("span", { children: zonedFormat(timeZone, { weekday: "short" }).format(date) }), /* @__PURE__ */ jsx("strong", { children: zonedFormat(timeZone, { day: "numeric" }).format(date) })]
|
|
623
|
+
}),
|
|
624
|
+
/* @__PURE__ */ jsx("time", {
|
|
625
|
+
dateTime: date.toISOString(),
|
|
626
|
+
children: time.format(date)
|
|
627
|
+
}),
|
|
628
|
+
/* @__PURE__ */ jsx("span", {
|
|
629
|
+
className: "computer-automations__agenda-mark",
|
|
630
|
+
"aria-hidden": "true"
|
|
631
|
+
}),
|
|
632
|
+
/* @__PURE__ */ jsxs("span", {
|
|
633
|
+
className: "computer-automations__agenda-copy",
|
|
634
|
+
children: [/* @__PURE__ */ jsx("strong", { children: schedule_0.name }), schedule_0.description ? /* @__PURE__ */ jsx("small", { children: schedule_0.description }) : null]
|
|
635
|
+
})
|
|
636
|
+
] }, schedule_0.id);
|
|
637
|
+
}) }) : /* @__PURE__ */ jsx("p", { children: "No upcoming runs." })]
|
|
638
|
+
});
|
|
639
|
+
$[0] = schedules;
|
|
640
|
+
$[1] = timeZone;
|
|
641
|
+
$[2] = titleId;
|
|
642
|
+
$[3] = t1;
|
|
643
|
+
} else t1 = $[3];
|
|
644
|
+
return t1;
|
|
645
|
+
}
|
|
646
|
+
function _temp2(first, second) {
|
|
647
|
+
return first.alarm.time - second.alarm.time;
|
|
648
|
+
}
|
|
649
|
+
function _temp(schedule) {
|
|
650
|
+
return schedule.enabled && schedule.alarm != null;
|
|
651
|
+
}
|
|
652
|
+
function WorkflowOutputs(t0) {
|
|
653
|
+
const $ = c(14);
|
|
654
|
+
const { onOpenFile, recentOutputs, workflows } = t0;
|
|
655
|
+
const titleId = React.useId();
|
|
656
|
+
let t1;
|
|
657
|
+
if ($[0] !== recentOutputs || $[1] !== workflows) {
|
|
658
|
+
const retained = workflows.flatMap(_temp3);
|
|
659
|
+
let t2;
|
|
660
|
+
if ($[3] !== workflows) {
|
|
661
|
+
t2 = (t3) => {
|
|
662
|
+
const { run: run_0, workflowPath } = t3;
|
|
663
|
+
const workflow_0 = workflows.find((candidate) => candidate.path === workflowPath);
|
|
664
|
+
return workflow_0 ? [{
|
|
665
|
+
run: run_0,
|
|
666
|
+
workflow: workflow_0
|
|
667
|
+
}] : [];
|
|
668
|
+
};
|
|
669
|
+
$[3] = workflows;
|
|
670
|
+
$[4] = t2;
|
|
671
|
+
} else t2 = $[4];
|
|
672
|
+
const recent = recentOutputs.flatMap(t2);
|
|
673
|
+
t1 = [...recent, ...retained.filter((t3) => {
|
|
674
|
+
const { run: run_1, workflow: workflow_1 } = t3;
|
|
675
|
+
return !recent.some((candidate_0) => candidate_0.workflow.path === workflow_1.path && candidate_0.run.path === run_1.path);
|
|
676
|
+
})];
|
|
677
|
+
$[0] = recentOutputs;
|
|
678
|
+
$[1] = workflows;
|
|
679
|
+
$[2] = t1;
|
|
680
|
+
} else t1 = $[2];
|
|
681
|
+
const outputs = t1;
|
|
682
|
+
let t2;
|
|
683
|
+
if ($[5] !== titleId) {
|
|
684
|
+
t2 = /* @__PURE__ */ jsx("h2", {
|
|
685
|
+
id: titleId,
|
|
686
|
+
children: "Automation outputs"
|
|
687
|
+
});
|
|
688
|
+
$[5] = titleId;
|
|
689
|
+
$[6] = t2;
|
|
690
|
+
} else t2 = $[6];
|
|
691
|
+
let t3;
|
|
692
|
+
if ($[7] !== onOpenFile || $[8] !== outputs) {
|
|
693
|
+
t3 = outputs.length ? /* @__PURE__ */ jsx("ul", {
|
|
694
|
+
role: "list",
|
|
695
|
+
children: outputs.map((t4) => {
|
|
696
|
+
const { run: run_2, workflow: workflow_2 } = t4;
|
|
697
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(Button, {
|
|
698
|
+
className: "computer-automations__run",
|
|
699
|
+
variant: "ghost",
|
|
700
|
+
color: "neutral",
|
|
701
|
+
onClick: () => onOpenFile(run_2.path),
|
|
702
|
+
children: [/* @__PURE__ */ jsx(FileIcon, {
|
|
703
|
+
className: "computer-automations__run-icon",
|
|
704
|
+
"aria-hidden": "true"
|
|
705
|
+
}), /* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("strong", { children: workflow_2.name }), /* @__PURE__ */ jsx("small", { children: run_2.label })] })]
|
|
706
|
+
}) }, `${workflow_2.path}:${run_2.path}`);
|
|
707
|
+
})
|
|
708
|
+
}) : /* @__PURE__ */ jsx("p", { children: "No automation outputs yet." });
|
|
709
|
+
$[7] = onOpenFile;
|
|
710
|
+
$[8] = outputs;
|
|
711
|
+
$[9] = t3;
|
|
712
|
+
} else t3 = $[9];
|
|
713
|
+
let t4;
|
|
714
|
+
if ($[10] !== t2 || $[11] !== t3 || $[12] !== titleId) {
|
|
715
|
+
t4 = /* @__PURE__ */ jsxs("section", {
|
|
716
|
+
className: "computer-automations__run-group",
|
|
717
|
+
"aria-labelledby": titleId,
|
|
718
|
+
children: [t2, t3]
|
|
719
|
+
});
|
|
720
|
+
$[10] = t2;
|
|
721
|
+
$[11] = t3;
|
|
722
|
+
$[12] = titleId;
|
|
723
|
+
$[13] = t4;
|
|
724
|
+
} else t4 = $[13];
|
|
725
|
+
return t4;
|
|
726
|
+
}
|
|
727
|
+
function _temp3(workflow) {
|
|
728
|
+
return (workflow.runs ?? []).map((run) => ({
|
|
729
|
+
run,
|
|
730
|
+
workflow
|
|
731
|
+
}));
|
|
732
|
+
}
|
|
733
|
+
function ScheduleRuns(t0) {
|
|
734
|
+
const $ = c(6);
|
|
735
|
+
const { host, schedules } = t0;
|
|
736
|
+
const titleId = React.useId();
|
|
737
|
+
let t1;
|
|
738
|
+
if ($[0] !== host || $[1] !== schedules || $[2] !== titleId) {
|
|
739
|
+
const runs = schedules.flatMap(_temp4);
|
|
740
|
+
let t2;
|
|
741
|
+
if ($[4] !== titleId) {
|
|
742
|
+
t2 = /* @__PURE__ */ jsx("h2", {
|
|
743
|
+
id: titleId,
|
|
744
|
+
children: "Scheduled runs"
|
|
745
|
+
});
|
|
746
|
+
$[4] = titleId;
|
|
747
|
+
$[5] = t2;
|
|
748
|
+
} else t2 = $[5];
|
|
749
|
+
t1 = /* @__PURE__ */ jsxs("section", {
|
|
750
|
+
className: "computer-automations__run-group",
|
|
751
|
+
"aria-labelledby": titleId,
|
|
752
|
+
children: [t2, runs.length ? /* @__PURE__ */ jsx("ul", {
|
|
753
|
+
role: "list",
|
|
754
|
+
children: runs.map((t3) => {
|
|
755
|
+
const { schedule: schedule_0, run: run_0 } = t3;
|
|
756
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(LinkButton, {
|
|
757
|
+
className: "computer-automations__run",
|
|
758
|
+
variant: "ghost",
|
|
759
|
+
color: "neutral",
|
|
760
|
+
render: host.renderLink({
|
|
761
|
+
section: "runs",
|
|
762
|
+
run: getThinkExecutionRunId(run_0)
|
|
763
|
+
}),
|
|
764
|
+
children: /* @__PURE__ */ jsx(ThinkExecutionRunSummary, {
|
|
765
|
+
run: run_0,
|
|
766
|
+
title: schedule_0.name
|
|
767
|
+
})
|
|
768
|
+
}) }, `${schedule_0.id}:${getThinkExecutionRunId(run_0)}`);
|
|
769
|
+
})
|
|
770
|
+
}) : /* @__PURE__ */ jsx("p", { children: "No scheduled runs yet." })]
|
|
771
|
+
});
|
|
772
|
+
$[0] = host;
|
|
773
|
+
$[1] = schedules;
|
|
774
|
+
$[2] = titleId;
|
|
775
|
+
$[3] = t1;
|
|
776
|
+
} else t1 = $[3];
|
|
777
|
+
return t1;
|
|
778
|
+
}
|
|
779
|
+
function _temp4(schedule) {
|
|
780
|
+
return schedule.runs.map((run) => ({
|
|
781
|
+
schedule,
|
|
782
|
+
run
|
|
783
|
+
}));
|
|
784
|
+
}
|
|
785
|
+
function AutomationRuns(t0) {
|
|
786
|
+
const $ = c(33);
|
|
787
|
+
const { onBack, onOpenFile, host, recentOutputs, schedules, selectedRun, workflows } = t0;
|
|
788
|
+
if (selectedRun) {
|
|
789
|
+
let t1;
|
|
790
|
+
if ($[0] !== host || $[1] !== selectedRun) {
|
|
791
|
+
t1 = host.conversationForRun(selectedRun);
|
|
792
|
+
$[0] = host;
|
|
793
|
+
$[1] = selectedRun;
|
|
794
|
+
$[2] = t1;
|
|
795
|
+
} else t1 = $[2];
|
|
796
|
+
const conversation = t1;
|
|
797
|
+
let t2;
|
|
798
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
799
|
+
t2 = /* @__PURE__ */ jsx(ChevronLeftIcon, {});
|
|
800
|
+
$[3] = t2;
|
|
801
|
+
} else t2 = $[3];
|
|
802
|
+
let t3;
|
|
803
|
+
if ($[4] !== onBack) {
|
|
804
|
+
t3 = /* @__PURE__ */ jsx(AppTopBar.Button, {
|
|
805
|
+
label: "Runs",
|
|
806
|
+
onClick: onBack,
|
|
807
|
+
children: t2
|
|
808
|
+
});
|
|
809
|
+
$[4] = onBack;
|
|
810
|
+
$[5] = t3;
|
|
811
|
+
} else t3 = $[5];
|
|
812
|
+
let t4;
|
|
813
|
+
if ($[6] !== conversation || $[7] !== host) {
|
|
814
|
+
t4 = conversation ? /* @__PURE__ */ jsx(Button, {
|
|
815
|
+
size: "sm",
|
|
816
|
+
variant: "surface",
|
|
817
|
+
color: "neutral",
|
|
818
|
+
onClick: () => host.onOpenConversation(conversation),
|
|
819
|
+
children: "Open conversation"
|
|
820
|
+
}) : null;
|
|
821
|
+
$[6] = conversation;
|
|
822
|
+
$[7] = host;
|
|
823
|
+
$[8] = t4;
|
|
824
|
+
} else t4 = $[8];
|
|
825
|
+
let t5;
|
|
826
|
+
if ($[9] !== t3 || $[10] !== t4) {
|
|
827
|
+
t5 = /* @__PURE__ */ jsx(ResponsiveSidebarAppBar, {
|
|
828
|
+
label: "Run detail",
|
|
829
|
+
leading: t3,
|
|
830
|
+
title: "Run detail",
|
|
831
|
+
actions: t4
|
|
832
|
+
});
|
|
833
|
+
$[9] = t3;
|
|
834
|
+
$[10] = t4;
|
|
835
|
+
$[11] = t5;
|
|
836
|
+
} else t5 = $[11];
|
|
837
|
+
let t6;
|
|
838
|
+
if ($[12] !== schedules || $[13] !== selectedRun) {
|
|
839
|
+
t6 = schedules.find((schedule) => schedule.runs.includes(selectedRun))?.name;
|
|
840
|
+
$[12] = schedules;
|
|
841
|
+
$[13] = selectedRun;
|
|
842
|
+
$[14] = t6;
|
|
843
|
+
} else t6 = $[14];
|
|
844
|
+
let t7;
|
|
845
|
+
if ($[15] !== selectedRun || $[16] !== t6) {
|
|
846
|
+
t7 = /* @__PURE__ */ jsx(ThinkExecutionDetail, {
|
|
847
|
+
run: selectedRun,
|
|
848
|
+
title: t6
|
|
849
|
+
});
|
|
850
|
+
$[15] = selectedRun;
|
|
851
|
+
$[16] = t6;
|
|
852
|
+
$[17] = t7;
|
|
853
|
+
} else t7 = $[17];
|
|
854
|
+
let t8;
|
|
855
|
+
if ($[18] !== t5 || $[19] !== t7) {
|
|
856
|
+
t8 = /* @__PURE__ */ jsxs("div", {
|
|
857
|
+
className: "computer-automations__run-detail",
|
|
858
|
+
children: [t5, t7]
|
|
859
|
+
});
|
|
860
|
+
$[18] = t5;
|
|
861
|
+
$[19] = t7;
|
|
862
|
+
$[20] = t8;
|
|
863
|
+
} else t8 = $[20];
|
|
864
|
+
return t8;
|
|
865
|
+
}
|
|
866
|
+
if (!(recentOutputs.length > 0 || workflows.some(_temp5) || schedules.some(_temp6))) {
|
|
867
|
+
let t1;
|
|
868
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
869
|
+
t1 = /* @__PURE__ */ jsx(StatusScreen, {
|
|
870
|
+
title: "No runs yet",
|
|
871
|
+
description: "Run an automation or wait for a confirmed schedule to keep its result here."
|
|
872
|
+
});
|
|
873
|
+
$[21] = t1;
|
|
874
|
+
} else t1 = $[21];
|
|
875
|
+
return t1;
|
|
876
|
+
}
|
|
877
|
+
let t1;
|
|
878
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
879
|
+
t1 = /* @__PURE__ */ jsx(ResponsiveSidebarAppBar, {
|
|
880
|
+
label: "Runs",
|
|
881
|
+
title: "Runs"
|
|
882
|
+
});
|
|
883
|
+
$[22] = t1;
|
|
884
|
+
} else t1 = $[22];
|
|
885
|
+
let t2;
|
|
886
|
+
if ($[23] !== onOpenFile || $[24] !== recentOutputs || $[25] !== workflows) {
|
|
887
|
+
t2 = /* @__PURE__ */ jsx(WorkflowOutputs, {
|
|
888
|
+
workflows,
|
|
889
|
+
recentOutputs,
|
|
890
|
+
onOpenFile
|
|
891
|
+
});
|
|
892
|
+
$[23] = onOpenFile;
|
|
893
|
+
$[24] = recentOutputs;
|
|
894
|
+
$[25] = workflows;
|
|
895
|
+
$[26] = t2;
|
|
896
|
+
} else t2 = $[26];
|
|
897
|
+
let t3;
|
|
898
|
+
if ($[27] !== host || $[28] !== schedules) {
|
|
899
|
+
t3 = /* @__PURE__ */ jsx(ScheduleRuns, {
|
|
900
|
+
schedules,
|
|
901
|
+
host
|
|
902
|
+
});
|
|
903
|
+
$[27] = host;
|
|
904
|
+
$[28] = schedules;
|
|
905
|
+
$[29] = t3;
|
|
906
|
+
} else t3 = $[29];
|
|
907
|
+
let t4;
|
|
908
|
+
if ($[30] !== t2 || $[31] !== t3) {
|
|
909
|
+
t4 = /* @__PURE__ */ jsxs("div", {
|
|
910
|
+
className: "computer-automations__run-browser",
|
|
911
|
+
children: [t1, /* @__PURE__ */ jsxs("div", {
|
|
912
|
+
className: "computer-automations__runs",
|
|
913
|
+
children: [t2, t3]
|
|
914
|
+
})]
|
|
915
|
+
});
|
|
916
|
+
$[30] = t2;
|
|
917
|
+
$[31] = t3;
|
|
918
|
+
$[32] = t4;
|
|
919
|
+
} else t4 = $[32];
|
|
920
|
+
return t4;
|
|
921
|
+
}
|
|
922
|
+
function _temp6(r) {
|
|
923
|
+
return r.runs.length;
|
|
924
|
+
}
|
|
925
|
+
function _temp5(workflow) {
|
|
926
|
+
return workflow.runs?.length;
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* Automations' unified toolbar: the section switcher centred, and the open
|
|
930
|
+
* pane's Back, name and actions around it. The switcher itself stays in the
|
|
931
|
+
* content's tab set and is portalled into `sections`, so tabs and panels keep
|
|
932
|
+
* one owner.
|
|
933
|
+
*/
|
|
934
|
+
function AutomationsToolbar(t0) {
|
|
935
|
+
const $ = c(14);
|
|
936
|
+
const { outlet, sections } = t0;
|
|
937
|
+
const pane = React.useSyncExternalStore(outlet.subscribe, outlet.getSnapshot, outlet.getSnapshot);
|
|
938
|
+
const t1 = pane?.leading;
|
|
939
|
+
let t2;
|
|
940
|
+
if ($[0] !== pane) {
|
|
941
|
+
t2 = pane?.leading != null ? /* @__PURE__ */ jsx("span", {
|
|
942
|
+
className: "sigvelo-truncate",
|
|
943
|
+
children: pane.title
|
|
944
|
+
}) : null;
|
|
945
|
+
$[0] = pane;
|
|
946
|
+
$[1] = t2;
|
|
947
|
+
} else t2 = $[1];
|
|
948
|
+
let t3;
|
|
949
|
+
if ($[2] !== t1 || $[3] !== t2) {
|
|
950
|
+
t3 = /* @__PURE__ */ jsxs(AppTopBar.Leading, { children: [t1, t2] });
|
|
951
|
+
$[2] = t1;
|
|
952
|
+
$[3] = t2;
|
|
953
|
+
$[4] = t3;
|
|
954
|
+
} else t3 = $[4];
|
|
955
|
+
let t4;
|
|
956
|
+
if ($[5] !== sections) {
|
|
957
|
+
t4 = /* @__PURE__ */ jsx(AppTopBar.Title, { ref: sections });
|
|
958
|
+
$[5] = sections;
|
|
959
|
+
$[6] = t4;
|
|
960
|
+
} else t4 = $[6];
|
|
961
|
+
const t5 = pane?.actions;
|
|
962
|
+
const t6 = pane?.primary;
|
|
963
|
+
let t7;
|
|
964
|
+
if ($[7] !== t5 || $[8] !== t6) {
|
|
965
|
+
t7 = /* @__PURE__ */ jsxs(AppTopBar.Trailing, { children: [t5, t6] });
|
|
966
|
+
$[7] = t5;
|
|
967
|
+
$[8] = t6;
|
|
968
|
+
$[9] = t7;
|
|
969
|
+
} else t7 = $[9];
|
|
970
|
+
let t8;
|
|
971
|
+
if ($[10] !== t3 || $[11] !== t4 || $[12] !== t7) {
|
|
972
|
+
t8 = /* @__PURE__ */ jsxs(AppTopBar.Root, {
|
|
973
|
+
className: "computer-automations-toolbar",
|
|
974
|
+
"aria-label": "Automations controls",
|
|
975
|
+
children: [
|
|
976
|
+
t3,
|
|
977
|
+
t4,
|
|
978
|
+
t7
|
|
979
|
+
]
|
|
980
|
+
});
|
|
981
|
+
$[10] = t3;
|
|
982
|
+
$[11] = t4;
|
|
983
|
+
$[12] = t7;
|
|
984
|
+
$[13] = t8;
|
|
985
|
+
} else t8 = $[13];
|
|
986
|
+
return t8;
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* Automations: saved workflows, the schedules Calendar also shows, and their
|
|
990
|
+
* runs, as the side panel's Automations and Schedules show them.
|
|
991
|
+
*/
|
|
992
|
+
function useAutomationsModel() {
|
|
993
|
+
const $ = c(57);
|
|
994
|
+
const { host, schedules } = useComputerAutomationsContext();
|
|
995
|
+
const { openApp } = useAgentComputerActions();
|
|
996
|
+
const { section, workflow: selectedWorkflowPath, run: runId } = host.selection;
|
|
997
|
+
const navigate = host.onNavigate;
|
|
998
|
+
let t0;
|
|
999
|
+
if ($[0] !== navigate) {
|
|
1000
|
+
t0 = (next) => void navigate({ section: next });
|
|
1001
|
+
$[0] = navigate;
|
|
1002
|
+
$[1] = t0;
|
|
1003
|
+
} else t0 = $[1];
|
|
1004
|
+
const setSection = t0;
|
|
1005
|
+
let t1;
|
|
1006
|
+
if ($[2] !== navigate) {
|
|
1007
|
+
t1 = (path) => void navigate({
|
|
1008
|
+
section: "workflows",
|
|
1009
|
+
workflow: path
|
|
1010
|
+
});
|
|
1011
|
+
$[2] = navigate;
|
|
1012
|
+
$[3] = t1;
|
|
1013
|
+
} else t1 = $[3];
|
|
1014
|
+
const setSelectedWorkflowPath = t1;
|
|
1015
|
+
let t2;
|
|
1016
|
+
if ($[4] !== navigate) {
|
|
1017
|
+
t2 = (run) => void navigate({
|
|
1018
|
+
section: "runs",
|
|
1019
|
+
run: run ? getThinkExecutionRunId(run) : void 0
|
|
1020
|
+
});
|
|
1021
|
+
$[4] = navigate;
|
|
1022
|
+
$[5] = t2;
|
|
1023
|
+
} else t2 = $[5];
|
|
1024
|
+
const setSelectedRun = t2;
|
|
1025
|
+
let t3;
|
|
1026
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1027
|
+
t3 = [];
|
|
1028
|
+
$[6] = t3;
|
|
1029
|
+
} else t3 = $[6];
|
|
1030
|
+
const [recentWorkflowOutputs, setRecentWorkflowOutputs] = React.useState(t3);
|
|
1031
|
+
let t4;
|
|
1032
|
+
if ($[7] !== host || $[8] !== openApp) {
|
|
1033
|
+
t4 = (path_0) => {
|
|
1034
|
+
host.onOpenFile(path_0);
|
|
1035
|
+
openApp("files");
|
|
1036
|
+
};
|
|
1037
|
+
$[7] = host;
|
|
1038
|
+
$[8] = openApp;
|
|
1039
|
+
$[9] = t4;
|
|
1040
|
+
} else t4 = $[9];
|
|
1041
|
+
const openWorkspaceFile = t4;
|
|
1042
|
+
const { openAutomationSchedule } = schedules;
|
|
1043
|
+
const workflows = useQuery(host.automations.queryOptions);
|
|
1044
|
+
const { onRun } = host.automations;
|
|
1045
|
+
let t5;
|
|
1046
|
+
if ($[10] !== openWorkspaceFile || $[11] !== setSelectedWorkflowPath || $[12] !== workflows) {
|
|
1047
|
+
t5 = (path_1) => workflows.data?.some((automation) => automation.path === path_1) ? setSelectedWorkflowPath(path_1) : openWorkspaceFile(path_1);
|
|
1048
|
+
$[10] = openWorkspaceFile;
|
|
1049
|
+
$[11] = setSelectedWorkflowPath;
|
|
1050
|
+
$[12] = workflows;
|
|
1051
|
+
$[13] = t5;
|
|
1052
|
+
} else t5 = $[13];
|
|
1053
|
+
let t6;
|
|
1054
|
+
if ($[14] !== openAutomationSchedule || $[15] !== setSection) {
|
|
1055
|
+
t6 = async (path_2) => {
|
|
1056
|
+
if (await openAutomationSchedule(path_2)) setSection("schedules");
|
|
1057
|
+
};
|
|
1058
|
+
$[14] = openAutomationSchedule;
|
|
1059
|
+
$[15] = setSection;
|
|
1060
|
+
$[16] = t6;
|
|
1061
|
+
} else t6 = $[16];
|
|
1062
|
+
let t7;
|
|
1063
|
+
if ($[17] !== onRun) {
|
|
1064
|
+
t7 = onRun ? async (invocation) => {
|
|
1065
|
+
const outcome = await onRun(invocation);
|
|
1066
|
+
const [output] = outcome.files;
|
|
1067
|
+
if (output) setRecentWorkflowOutputs((current) => [{
|
|
1068
|
+
workflowPath: invocation.path,
|
|
1069
|
+
run: output
|
|
1070
|
+
}, ...current.filter((candidate) => candidate.workflowPath !== invocation.path || candidate.run.path !== output.path)]);
|
|
1071
|
+
return outcome;
|
|
1072
|
+
} : void 0;
|
|
1073
|
+
$[17] = onRun;
|
|
1074
|
+
$[18] = t7;
|
|
1075
|
+
} else t7 = $[18];
|
|
1076
|
+
let t8;
|
|
1077
|
+
if ($[19] !== host.automations || $[20] !== t5 || $[21] !== t6 || $[22] !== t7) {
|
|
1078
|
+
t8 = {
|
|
1079
|
+
...host.automations,
|
|
1080
|
+
onOpen: t5,
|
|
1081
|
+
onSchedule: t6,
|
|
1082
|
+
onRun: t7
|
|
1083
|
+
};
|
|
1084
|
+
$[19] = host.automations;
|
|
1085
|
+
$[20] = t5;
|
|
1086
|
+
$[21] = t6;
|
|
1087
|
+
$[22] = t7;
|
|
1088
|
+
$[23] = t8;
|
|
1089
|
+
} else t8 = $[23];
|
|
1090
|
+
const source = t8;
|
|
1091
|
+
let t9;
|
|
1092
|
+
if ($[24] !== host.schedules || $[25] !== runId) {
|
|
1093
|
+
t9 = host.schedules.flatMap(_temp7).find((run_0) => getThinkExecutionRunId(run_0) === runId) ?? null;
|
|
1094
|
+
$[24] = host.schedules;
|
|
1095
|
+
$[25] = runId;
|
|
1096
|
+
$[26] = t9;
|
|
1097
|
+
} else t9 = $[26];
|
|
1098
|
+
const selectedRun = t9;
|
|
1099
|
+
const scheduleApp = schedules.model;
|
|
1100
|
+
const [outlet] = React.useState(createAppBarOutlet);
|
|
1101
|
+
const [sections, setSections] = React.useState(null);
|
|
1102
|
+
let t10;
|
|
1103
|
+
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1104
|
+
t10 = /* @__PURE__ */ jsxs(Tabs.Tab, {
|
|
1105
|
+
unstyled: true,
|
|
1106
|
+
value: "workflows",
|
|
1107
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
1108
|
+
className: "computer-automations__tab",
|
|
1109
|
+
size: "xs",
|
|
1110
|
+
variant: "ghost",
|
|
1111
|
+
color: "neutral"
|
|
1112
|
+
}),
|
|
1113
|
+
children: [/* @__PURE__ */ jsx(QueueIcon, { "aria-hidden": "true" }), "Automations"]
|
|
1114
|
+
});
|
|
1115
|
+
$[27] = t10;
|
|
1116
|
+
} else t10 = $[27];
|
|
1117
|
+
let t11;
|
|
1118
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1119
|
+
t11 = /* @__PURE__ */ jsxs(Tabs.Tab, {
|
|
1120
|
+
unstyled: true,
|
|
1121
|
+
value: "schedules",
|
|
1122
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
1123
|
+
className: "computer-automations__tab",
|
|
1124
|
+
size: "xs",
|
|
1125
|
+
variant: "ghost",
|
|
1126
|
+
color: "neutral"
|
|
1127
|
+
}),
|
|
1128
|
+
children: [/* @__PURE__ */ jsx(CalendarIcon, { "aria-hidden": "true" }), "Schedules"]
|
|
1129
|
+
});
|
|
1130
|
+
$[28] = t11;
|
|
1131
|
+
} else t11 = $[28];
|
|
1132
|
+
let t12;
|
|
1133
|
+
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1134
|
+
t12 = /* @__PURE__ */ jsxs(Tabs.List, {
|
|
1135
|
+
unstyled: true,
|
|
1136
|
+
className: "computer-automations__tabs",
|
|
1137
|
+
"aria-label": "Automations",
|
|
1138
|
+
children: [
|
|
1139
|
+
t10,
|
|
1140
|
+
t11,
|
|
1141
|
+
/* @__PURE__ */ jsxs(Tabs.Tab, {
|
|
1142
|
+
unstyled: true,
|
|
1143
|
+
value: "runs",
|
|
1144
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
1145
|
+
className: "computer-automations__tab",
|
|
1146
|
+
size: "xs",
|
|
1147
|
+
variant: "ghost",
|
|
1148
|
+
color: "neutral"
|
|
1149
|
+
}),
|
|
1150
|
+
children: [/* @__PURE__ */ jsx(ListIcon, { "aria-hidden": "true" }), "Runs"]
|
|
1151
|
+
})
|
|
1152
|
+
]
|
|
1153
|
+
});
|
|
1154
|
+
$[29] = t12;
|
|
1155
|
+
} else t12 = $[29];
|
|
1156
|
+
const sectionList = t12;
|
|
1157
|
+
const t13 = section === "schedules" ? scheduleApp.renderMenus : void 0;
|
|
1158
|
+
let t14;
|
|
1159
|
+
if ($[30] !== outlet || $[31] !== scheduleApp.renderTitle || $[32] !== schedules.editing) {
|
|
1160
|
+
t14 = schedules.editing ? scheduleApp.renderTitle : (t15) => {
|
|
1161
|
+
const { phone } = t15;
|
|
1162
|
+
return phone ? "Automations" : /* @__PURE__ */ jsx(AutomationsToolbar, {
|
|
1163
|
+
outlet,
|
|
1164
|
+
sections: setSections
|
|
1165
|
+
});
|
|
1166
|
+
};
|
|
1167
|
+
$[30] = outlet;
|
|
1168
|
+
$[31] = scheduleApp.renderTitle;
|
|
1169
|
+
$[32] = schedules.editing;
|
|
1170
|
+
$[33] = t14;
|
|
1171
|
+
} else t14 = $[33];
|
|
1172
|
+
let t15;
|
|
1173
|
+
if ($[34] !== host || $[35] !== openWorkspaceFile || $[36] !== outlet || $[37] !== recentWorkflowOutputs || $[38] !== runId || $[39] !== scheduleApp || $[40] !== schedules.editing || $[41] !== section || $[42] !== sections || $[43] !== selectedRun || $[44] !== selectedWorkflowPath || $[45] !== setSection || $[46] !== setSelectedRun || $[47] !== setSelectedWorkflowPath || $[48] !== source || $[49] !== workflows) {
|
|
1174
|
+
t15 = (context) => {
|
|
1175
|
+
const paneOutlet = (pane) => !context.phone && section === pane ? outlet : null;
|
|
1176
|
+
return schedules.editing ? scheduleApp.render(context) : /* @__PURE__ */ jsxs(Tabs.Root, {
|
|
1177
|
+
className: "computer-automations",
|
|
1178
|
+
value: section,
|
|
1179
|
+
onValueChange: (nextSection) => setSection(nextSection),
|
|
1180
|
+
children: [context.phone ? /* @__PURE__ */ jsx("div", {
|
|
1181
|
+
className: "computer-automations__location-bar",
|
|
1182
|
+
children: sectionList
|
|
1183
|
+
}) : sections ? createPortal(sectionList, sections) : null, /* @__PURE__ */ jsxs(Tabs.Panels, {
|
|
1184
|
+
className: "computer-automations__panels",
|
|
1185
|
+
children: [
|
|
1186
|
+
/* @__PURE__ */ jsx(Tabs.Panel, {
|
|
1187
|
+
keepMounted: true,
|
|
1188
|
+
className: "computer-automations__panel computer-automations__panel--workflows",
|
|
1189
|
+
value: "workflows",
|
|
1190
|
+
children: /* @__PURE__ */ jsx(ContentAppBarOutletContext, {
|
|
1191
|
+
value: paneOutlet("workflows"),
|
|
1192
|
+
children: /* @__PURE__ */ jsx(WorkspaceAutomationsPanel, {
|
|
1193
|
+
"aria-label": workflows.data?.find((automation_0) => automation_0.path === selectedWorkflowPath)?.name ?? "Automation library",
|
|
1194
|
+
source,
|
|
1195
|
+
selectedPath: selectedWorkflowPath,
|
|
1196
|
+
onBack: () => setSelectedWorkflowPath(void 0)
|
|
1197
|
+
})
|
|
1198
|
+
})
|
|
1199
|
+
}),
|
|
1200
|
+
/* @__PURE__ */ jsx(Tabs.Panel, {
|
|
1201
|
+
keepMounted: true,
|
|
1202
|
+
className: "computer-automations__panel",
|
|
1203
|
+
value: "schedules",
|
|
1204
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1205
|
+
className: "computer-automations__schedule-view",
|
|
1206
|
+
children: [/* @__PURE__ */ jsx(UpcomingAgenda, {
|
|
1207
|
+
schedules: host.schedules,
|
|
1208
|
+
timeZone: host.timeZone
|
|
1209
|
+
}), scheduleApp.render(context)]
|
|
1210
|
+
})
|
|
1211
|
+
}),
|
|
1212
|
+
/* @__PURE__ */ jsx(Tabs.Panel, {
|
|
1213
|
+
keepMounted: true,
|
|
1214
|
+
className: "computer-automations__panel",
|
|
1215
|
+
value: "runs",
|
|
1216
|
+
children: runId && !selectedRun ? /* @__PURE__ */ jsx(StatusScreen, {
|
|
1217
|
+
title: "Run not found",
|
|
1218
|
+
description: "This run is no longer available.",
|
|
1219
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
1220
|
+
onClick: () => setSelectedRun(null),
|
|
1221
|
+
children: "All runs"
|
|
1222
|
+
})
|
|
1223
|
+
}) : /* @__PURE__ */ jsx(ContentAppBarOutletContext, {
|
|
1224
|
+
value: paneOutlet("runs"),
|
|
1225
|
+
children: /* @__PURE__ */ jsx(AutomationRuns, {
|
|
1226
|
+
workflows: workflows.data ?? [],
|
|
1227
|
+
schedules: host.schedules,
|
|
1228
|
+
selectedRun,
|
|
1229
|
+
recentOutputs: recentWorkflowOutputs,
|
|
1230
|
+
host,
|
|
1231
|
+
onBack: () => setSelectedRun(null),
|
|
1232
|
+
onOpenFile: openWorkspaceFile
|
|
1233
|
+
})
|
|
1234
|
+
})
|
|
1235
|
+
})
|
|
1236
|
+
]
|
|
1237
|
+
})]
|
|
1238
|
+
});
|
|
1239
|
+
};
|
|
1240
|
+
$[34] = host;
|
|
1241
|
+
$[35] = openWorkspaceFile;
|
|
1242
|
+
$[36] = outlet;
|
|
1243
|
+
$[37] = recentWorkflowOutputs;
|
|
1244
|
+
$[38] = runId;
|
|
1245
|
+
$[39] = scheduleApp;
|
|
1246
|
+
$[40] = schedules.editing;
|
|
1247
|
+
$[41] = section;
|
|
1248
|
+
$[42] = sections;
|
|
1249
|
+
$[43] = selectedRun;
|
|
1250
|
+
$[44] = selectedWorkflowPath;
|
|
1251
|
+
$[45] = setSection;
|
|
1252
|
+
$[46] = setSelectedRun;
|
|
1253
|
+
$[47] = setSelectedWorkflowPath;
|
|
1254
|
+
$[48] = source;
|
|
1255
|
+
$[49] = workflows;
|
|
1256
|
+
$[50] = t15;
|
|
1257
|
+
} else t15 = $[50];
|
|
1258
|
+
let t16;
|
|
1259
|
+
if ($[51] !== scheduleApp.beforeQuit || $[52] !== scheduleApp.onKeyDown || $[53] !== t13 || $[54] !== t14 || $[55] !== t15) {
|
|
1260
|
+
t16 = {
|
|
1261
|
+
beforeQuit: scheduleApp.beforeQuit,
|
|
1262
|
+
onKeyDown: scheduleApp.onKeyDown,
|
|
1263
|
+
renderMenus: t13,
|
|
1264
|
+
renderTitle: t14,
|
|
1265
|
+
render: t15
|
|
1266
|
+
};
|
|
1267
|
+
$[51] = scheduleApp.beforeQuit;
|
|
1268
|
+
$[52] = scheduleApp.onKeyDown;
|
|
1269
|
+
$[53] = t13;
|
|
1270
|
+
$[54] = t14;
|
|
1271
|
+
$[55] = t15;
|
|
1272
|
+
$[56] = t16;
|
|
1273
|
+
} else t16 = $[56];
|
|
1274
|
+
return t16;
|
|
1275
|
+
}
|
|
1276
|
+
function _temp7(schedule) {
|
|
1277
|
+
return schedule.runs;
|
|
1278
|
+
}
|
|
1279
|
+
const automationsParts = computerAppParts(useAutomationsModel, {
|
|
1280
|
+
title: true,
|
|
1281
|
+
menus: true
|
|
1282
|
+
});
|
|
1283
|
+
/**
|
|
1284
|
+
* The shared state Automations and Calendar read, mounted above the computer
|
|
1285
|
+
* so either app can open the other's selection. It runs the schedule editor
|
|
1286
|
+
* once, so Calendar's New and Open land in the editor Automations shows.
|
|
1287
|
+
*/
|
|
1288
|
+
function Host(t0) {
|
|
1289
|
+
const $ = c(27);
|
|
1290
|
+
const { value, children } = t0;
|
|
1291
|
+
const host = value;
|
|
1292
|
+
const workflows = useQuery(host.automations.queryOptions);
|
|
1293
|
+
let t1;
|
|
1294
|
+
if ($[0] !== workflows.data) {
|
|
1295
|
+
t1 = workflows.data ?? [];
|
|
1296
|
+
$[0] = workflows.data;
|
|
1297
|
+
$[1] = t1;
|
|
1298
|
+
} else t1 = $[1];
|
|
1299
|
+
const t2 = workflows.error?.message;
|
|
1300
|
+
let t3;
|
|
1301
|
+
if ($[2] !== host || $[3] !== t1 || $[4] !== t2 || $[5] !== workflows.isPending) {
|
|
1302
|
+
t3 = {
|
|
1303
|
+
host,
|
|
1304
|
+
automations: t1,
|
|
1305
|
+
automationsLoading: workflows.isPending,
|
|
1306
|
+
automationsError: t2
|
|
1307
|
+
};
|
|
1308
|
+
$[2] = host;
|
|
1309
|
+
$[3] = t1;
|
|
1310
|
+
$[4] = t2;
|
|
1311
|
+
$[5] = workflows.isPending;
|
|
1312
|
+
$[6] = t3;
|
|
1313
|
+
} else t3 = $[6];
|
|
1314
|
+
const schedules = useComputerSchedules(t3);
|
|
1315
|
+
let t4;
|
|
1316
|
+
if ($[7] !== host) {
|
|
1317
|
+
t4 = () => void host.onNavigate({ section: "schedules" });
|
|
1318
|
+
$[7] = host;
|
|
1319
|
+
$[8] = t4;
|
|
1320
|
+
} else t4 = $[8];
|
|
1321
|
+
const showSchedules = t4;
|
|
1322
|
+
let t5;
|
|
1323
|
+
let t6;
|
|
1324
|
+
if ($[9] !== schedules || $[10] !== showSchedules) {
|
|
1325
|
+
t5 = async (id) => {
|
|
1326
|
+
if (!await schedules.openSchedule(id)) return false;
|
|
1327
|
+
showSchedules();
|
|
1328
|
+
return true;
|
|
1329
|
+
};
|
|
1330
|
+
t6 = async () => {
|
|
1331
|
+
if (!await schedules.createSchedule()) return false;
|
|
1332
|
+
showSchedules();
|
|
1333
|
+
return true;
|
|
1334
|
+
};
|
|
1335
|
+
$[9] = schedules;
|
|
1336
|
+
$[10] = showSchedules;
|
|
1337
|
+
$[11] = t5;
|
|
1338
|
+
$[12] = t6;
|
|
1339
|
+
} else {
|
|
1340
|
+
t5 = $[11];
|
|
1341
|
+
t6 = $[12];
|
|
1342
|
+
}
|
|
1343
|
+
let t7;
|
|
1344
|
+
if ($[13] !== host || $[14] !== schedules) {
|
|
1345
|
+
t7 = async (run) => {
|
|
1346
|
+
if (!await schedules.leaveEditor()) return false;
|
|
1347
|
+
host.onNavigate({
|
|
1348
|
+
section: "runs",
|
|
1349
|
+
run: getThinkExecutionRunId(run)
|
|
1350
|
+
});
|
|
1351
|
+
return true;
|
|
1352
|
+
};
|
|
1353
|
+
$[13] = host;
|
|
1354
|
+
$[14] = schedules;
|
|
1355
|
+
$[15] = t7;
|
|
1356
|
+
} else t7 = $[15];
|
|
1357
|
+
let t8;
|
|
1358
|
+
if ($[16] !== t5 || $[17] !== t6 || $[18] !== t7) {
|
|
1359
|
+
t8 = {
|
|
1360
|
+
openSchedule: t5,
|
|
1361
|
+
createSchedule: t6,
|
|
1362
|
+
openRun: t7
|
|
1363
|
+
};
|
|
1364
|
+
$[16] = t5;
|
|
1365
|
+
$[17] = t6;
|
|
1366
|
+
$[18] = t7;
|
|
1367
|
+
$[19] = t8;
|
|
1368
|
+
} else t8 = $[19];
|
|
1369
|
+
let t9;
|
|
1370
|
+
if ($[20] !== host || $[21] !== schedules || $[22] !== t8) {
|
|
1371
|
+
t9 = {
|
|
1372
|
+
host,
|
|
1373
|
+
schedules,
|
|
1374
|
+
calendar: t8
|
|
1375
|
+
};
|
|
1376
|
+
$[20] = host;
|
|
1377
|
+
$[21] = schedules;
|
|
1378
|
+
$[22] = t8;
|
|
1379
|
+
$[23] = t9;
|
|
1380
|
+
} else t9 = $[23];
|
|
1381
|
+
const context = t9;
|
|
1382
|
+
let t10;
|
|
1383
|
+
if ($[24] !== children || $[25] !== context) {
|
|
1384
|
+
t10 = /* @__PURE__ */ jsx(ComputerAutomationsContext, {
|
|
1385
|
+
value: context,
|
|
1386
|
+
children
|
|
1387
|
+
});
|
|
1388
|
+
$[24] = children;
|
|
1389
|
+
$[25] = context;
|
|
1390
|
+
$[26] = t10;
|
|
1391
|
+
} else t10 = $[26];
|
|
1392
|
+
return t10;
|
|
1393
|
+
}
|
|
1394
|
+
/** Automations in the Dock, and the Host it shares with Calendar. */
|
|
1395
|
+
const ComputerAutomations = {
|
|
1396
|
+
Host,
|
|
1397
|
+
app: {
|
|
1398
|
+
id: "automations",
|
|
1399
|
+
label: "Automations",
|
|
1400
|
+
icon: computerAppTile(/* @__PURE__ */ jsx(AppIcon.Image, {
|
|
1401
|
+
src: desktopArtwork.automations,
|
|
1402
|
+
alt: ""
|
|
1403
|
+
})),
|
|
1404
|
+
launcher: "favorite",
|
|
1405
|
+
titleBar: "unified",
|
|
1406
|
+
...automationsParts
|
|
1407
|
+
}
|
|
1408
|
+
};
|
|
1409
|
+
//#endregion
|
|
1410
|
+
export { ComputerAutomations };
|