@michengai/dsh-automation 0.1.43 → 0.1.45
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/CHANGELOG.md +13 -0
- package/CHANGELOG.zh-CN.md +13 -0
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/lib/client.js +241 -166
- package/lib/client.js.map +3 -3
- package/lib/index.js +16 -1
- package/lib/types/client/contracts.d.ts +8 -1
- package/lib/types/client/icons.d.ts +0 -3
- package/lib/types/client/locales.d.ts +7 -0
- package/lib/types/client/native-group-actions.d.ts +14 -1
- package/lib/types/client/native-session-list.d.ts +0 -1
- package/lib/types/client/native-session-menu.d.ts +0 -40
- package/lib/types/client/schedule-rail-model.d.ts +22 -0
- package/package.json +37 -37
package/lib/client.js
CHANGED
|
@@ -551,6 +551,63 @@ function filterTaskSessionState(state, scheduledIds = /* @__PURE__ */ new Set())
|
|
|
551
551
|
if (typeof src === "object" && src !== null) taskFilterCache.set(src, { key, result });
|
|
552
552
|
return result;
|
|
553
553
|
}
|
|
554
|
+
function resolveCurrentSessionId(snapshot) {
|
|
555
|
+
const current = snapshot?.current;
|
|
556
|
+
if (typeof current === "string" && current !== "") return current;
|
|
557
|
+
const byId = snapshot?.byId ?? {};
|
|
558
|
+
for (const [id, session] of Object.entries(byId)) {
|
|
559
|
+
if ((session?.retainedBy?.mainView ?? 0) > 0) {
|
|
560
|
+
const explicit = session.id?.trim();
|
|
561
|
+
return explicit !== void 0 && explicit !== "" ? explicit : id;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
return null;
|
|
565
|
+
}
|
|
566
|
+
function asUiWorkspace(value) {
|
|
567
|
+
if (value === null || typeof value !== "object") return void 0;
|
|
568
|
+
const openSession = value.openSession;
|
|
569
|
+
if (typeof openSession !== "function") return void 0;
|
|
570
|
+
return { openSession: (id) => {
|
|
571
|
+
openSession.call(value, id);
|
|
572
|
+
} };
|
|
573
|
+
}
|
|
574
|
+
function probeService(ctx, name2) {
|
|
575
|
+
const reflectGet = ctx.reflect?.get;
|
|
576
|
+
if (typeof reflectGet === "function") {
|
|
577
|
+
try {
|
|
578
|
+
return reflectGet.call(ctx.reflect, name2);
|
|
579
|
+
} catch {
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
if (typeof ctx.get === "function") {
|
|
583
|
+
try {
|
|
584
|
+
return ctx.get(name2);
|
|
585
|
+
} catch {
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
return void 0;
|
|
589
|
+
}
|
|
590
|
+
function resolveClientSessionOpenAccess(ctx) {
|
|
591
|
+
const uiWorkspace = asUiWorkspace(probeService(ctx, "uiWorkspace"));
|
|
592
|
+
return {
|
|
593
|
+
...uiWorkspace === void 0 ? {} : { uiWorkspace },
|
|
594
|
+
...ctx.sessions === void 0 ? {} : { sessions: ctx.sessions }
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
function canOpenClientSession(access) {
|
|
598
|
+
return typeof access.uiWorkspace?.openSession === "function" || typeof access.sessions?.open === "function";
|
|
599
|
+
}
|
|
600
|
+
function openClientSession(access, id) {
|
|
601
|
+
if (typeof access.uiWorkspace?.openSession === "function") {
|
|
602
|
+
access.uiWorkspace.openSession(id);
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
if (typeof access.sessions?.open === "function") {
|
|
606
|
+
access.sessions.open(id);
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
throw new Error("no client session opener");
|
|
610
|
+
}
|
|
554
611
|
function openScheduledSession(id, openRuntime, openHost) {
|
|
555
612
|
if (id === "") return false;
|
|
556
613
|
const attempts = id.startsWith(AUTOMATION_SESSION_PREFIX) || id.startsWith("im:") ? [openRuntime, openHost] : [openHost, openRuntime];
|
|
@@ -765,25 +822,9 @@ function FolderOpenIcon(props) {
|
|
|
765
822
|
function ChevronIcon(props) {
|
|
766
823
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { viewBox: "0 0 14 14", width: props.width || 14, height: props.height || 14, fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "currentColor", d: "M4.25 2.828v8.344c0 .49.592.735.939.389l4.172-4.172a.55.55 0 0 0 0-.778L5.189 2.439c-.347-.347-.939-.101-.939.389Z" }) });
|
|
767
824
|
}
|
|
768
|
-
function EllipsisIcon(props) {
|
|
769
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FillIcon, { ...props, children: [
|
|
770
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "currentColor", d: "M4.55146 8.00001C4.55146 8.63513 4.03659 9.15001 3.40146 9.15001C2.76634 9.15001 2.25146 8.63513 2.25146 8.00001C2.25146 7.36488 2.76634 6.85001 3.40146 6.85001C4.03659 6.85001 4.55146 7.36488 4.55146 8.00001Z" }),
|
|
771
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "currentColor", d: "M9.1476 8.00001C9.1476 8.63513 8.63273 9.15001 7.9976 9.15001C7.36248 9.15001 6.8476 8.63513 6.8476 8.00001C6.8476 7.36488 7.36248 6.85001 7.9976 6.85001C8.63273 6.85001 9.1476 7.36488 9.1476 8.00001Z" }),
|
|
772
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "currentColor", d: "M13.7486 8.00001C13.7486 8.63513 13.2338 9.15001 12.5986 9.15001C11.9635 9.15001 11.4486 8.63513 11.4486 8.00001C11.4486 7.36488 11.9635 6.85001 12.5986 6.85001C13.2338 6.85001 13.7486 7.36488 13.7486 8.00001Z" })
|
|
773
|
-
] });
|
|
774
|
-
}
|
|
775
825
|
function PencilIcon(props) {
|
|
776
826
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FillIcon, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "currentColor", d: "M9.941 1.349a2.54 2.54 0 0 1 2.473 0c.292.171.555.442.897.784.341.341.612.604.783.896a2.54 2.54 0 0 1 0 2.473c-.171.292-.442.555-.784.896L6.659 13.05c-.378.378-.652.661-.994.86-.341.199-.722.298-1.238.44l-1.183.326c-.469.13-.899.25-1.243.292-.349.043-.821.033-1.19-.336-.369-.369-.379-.841-.336-1.19.042-.344.163-.774.292-1.243l.326-1.183c.143-.516.242-.897.44-1.238.199-.342.482-.615.86-.994l6.652-6.651c.341-.342.604-.613.896-.784Zm1.759 1.222a1.16 1.16 0 0 0-1.045 0c-.095.056-.206.158-.61.562L9.456 3.721l2.265 2.265.589-.588c.404-.403.507-.515.562-.61a1.16 1.16 0 0 0 0-1.045c-.056-.095-.158-.206-.562-.61-.404-.404-.515-.507-.61-.562ZM3.394 9.784c-.429.429-.551.56-.637.706-.085.147-.138.318-.3.903l-.326 1.183c-.129.468-.209.766-.242.978.212-.033.51-.112.979-.241l1.183-.327c.585-.161.756-.214.902-.3.147-.085.277-.208.706-.636l5.062-5.063-2.265-2.265-5.062 5.062Z" }) });
|
|
777
827
|
}
|
|
778
|
-
function BranchIcon(props) {
|
|
779
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FillIcon, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd", d: "M13.076 1.372c1.008 0 1.826.819 1.826 1.827s-.818 1.826-1.826 1.826c-.78 0-1.444-.488-1.706-1.175H4.355c.439.415.804.915 1.062 1.485l1.69 3.733a4.83 4.83 0 0 0 4.312 2.97c.29-.626.923-1.061 1.658-1.061 1.008 0 1.826.818 1.826 1.826s-.818 1.826-1.826 1.826c-.823 0-1.519-.545-1.747-1.293a6.34 6.34 0 0 1-5.406-3.731L4.232 5.871A3.83 3.83 0 0 0 1.098 3.85V2.549h10.272c.263-.687.927-1.177 1.706-1.177Zm0 10.904a.525.525 0 1 0 0 1.052.525.525 0 0 0 0-1.052Zm0-9.603a.526.526 0 1 0 0 1.053.526.526 0 0 0 0-1.053Z" }) });
|
|
780
|
-
}
|
|
781
|
-
function ArchiveIcon(props) {
|
|
782
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { viewBox: "0 0 20 20", width: props.width || 16, height: props.height || 16, fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
|
|
783
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd", d: "M15.866 2.06a2.526 2.526 0 0 1 2.525 2.525v.902c0 .54-.172 1.04-.461 1.45l.009.085v5.866c0 .746 0 1.35-.039 1.837-.035.434-.106.825-.262 1.189l-.072.154a3.03 3.03 0 0 1-1.262 1.366l-.236.132c-.408.208-.848.294-1.344.334-.488.04-1.091.04-1.837.04H7.111c-.746 0-1.35 0-1.837-.04-.434-.035-.825-.105-1.189-.261l-.154-.073a3.03 3.03 0 0 1-1.366-1.262l-.132-.235a2.53 2.53 0 0 1-.335-1.344c-.04-.487-.039-1.091-.039-1.837V7.022c0-.029.005-.057.008-.086A2.48 2.48 0 0 1 1.609 5.487v-.902A2.526 2.526 0 0 1 4.134 2.06h11.732Zm.632 5.87a2.48 2.48 0 0 1-.632.083H4.134a2.48 2.48 0 0 1-.634-.083v4.959c0 .77 0 1.304.034 1.72.034.406.095.635.182.806l.076.137c.191.311.465.565.792.731l.141.061c.156.055.361.096.666.121.415.034.95.035 1.72.035h5.775c.77 0 1.305 0 1.72-.035.407-.033.636-.095.807-.182l.138-.077c.311-.191.565-.464.731-.791l.06-.142c.056-.155.097-.36.122-.665.034-.415.034-.95.034-1.72V7.93ZM4.134 3.5a1.086 1.086 0 0 0-1.085 1.085v.902c0 .599.486 1.085 1.085 1.085h11.732c.599 0 1.085-.486 1.085-1.085v-.902A1.086 1.086 0 0 0 15.866 3.5H4.134Z" }),
|
|
784
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { fill: "currentColor", d: "M12.796 12.566v-1.483H7.205v1.483h5.591Z" })
|
|
785
|
-
] });
|
|
786
|
-
}
|
|
787
828
|
var RUNNING_CELLS = [
|
|
788
829
|
[0, 0],
|
|
789
830
|
[4, 0],
|
|
@@ -2545,6 +2586,13 @@ var en = {
|
|
|
2545
2586
|
"session.archiveGroupFailed": "Some conversations could not be archived: {message}",
|
|
2546
2587
|
"session.archiveGroupClose": "Close",
|
|
2547
2588
|
"session.archiveGroupCancel": "Cancel",
|
|
2589
|
+
"session.deleteSession": "Delete session",
|
|
2590
|
+
"session.deleteSessionConfirm": "Delete session",
|
|
2591
|
+
"session.deleteSessionDescription": "This permanently deletes session \u201C{name}\u201D, its child agents (including any that are still running), and all of its records (conversation, stats, cache). This cannot be undone.",
|
|
2592
|
+
"session.deleteSessionPending": "Deleting session\u2026",
|
|
2593
|
+
"session.deleteSessionFailed": "Could not delete the session: {message}",
|
|
2594
|
+
"session.deleteSessionClose": "Close",
|
|
2595
|
+
"session.deleteSessionCancel": "Cancel",
|
|
2548
2596
|
"session.idle": "Idle",
|
|
2549
2597
|
"session.runningStatus": "Running",
|
|
2550
2598
|
"session.delete": "Remove from Scheduled",
|
|
@@ -2763,6 +2811,13 @@ var zh = {
|
|
|
2763
2811
|
"session.archiveGroupFailed": "\u90E8\u5206\u4F1A\u8BDD\u5F52\u6863\u5931\u8D25\uFF1A{message}",
|
|
2764
2812
|
"session.archiveGroupClose": "\u5173\u95ED",
|
|
2765
2813
|
"session.archiveGroupCancel": "\u53D6\u6D88",
|
|
2814
|
+
"session.deleteSession": "\u5220\u9664\u4F1A\u8BDD",
|
|
2815
|
+
"session.deleteSessionConfirm": "\u5220\u9664\u4F1A\u8BDD",
|
|
2816
|
+
"session.deleteSessionDescription": "\u5C06\u6C38\u4E45\u5220\u9664\u4F1A\u8BDD\u201C{name}\u201D\u53CA\u5176\u5B50\u4EE3\u7406\uFF08\u542B\u6B63\u5728\u8FD0\u884C\u7684\uFF09\u548C\u5168\u90E8\u8BB0\u5F55\uFF08\u5BF9\u8BDD\u5185\u5BB9\u3001\u7EDF\u8BA1\u3001\u7F13\u5B58\uFF09\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002",
|
|
2817
|
+
"session.deleteSessionPending": "\u6B63\u5728\u5220\u9664\u4F1A\u8BDD\u2026",
|
|
2818
|
+
"session.deleteSessionFailed": "\u5220\u9664\u4F1A\u8BDD\u5931\u8D25\uFF1A{message}",
|
|
2819
|
+
"session.deleteSessionClose": "\u5173\u95ED",
|
|
2820
|
+
"session.deleteSessionCancel": "\u53D6\u6D88",
|
|
2766
2821
|
"session.idle": "\u7A7A\u95F2",
|
|
2767
2822
|
"session.runningStatus": "\u8FD0\u884C\u4E2D",
|
|
2768
2823
|
"session.delete": "\u4ECE\u5B9A\u65F6\u9875\u79FB\u9664",
|
|
@@ -3005,60 +3060,49 @@ function isForeignSidebarHost(component) {
|
|
|
3005
3060
|
return getNativeTabRegistry(component) !== void 0;
|
|
3006
3061
|
}
|
|
3007
3062
|
|
|
3008
|
-
// src/client/native-
|
|
3009
|
-
var
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
// src/client/native-session-menu.ts
|
|
3014
|
-
function resolveEventElement(target) {
|
|
3015
|
-
if (target == null || typeof target !== "object") return null;
|
|
3016
|
-
const node = target;
|
|
3017
|
-
if (node.nodeType === 3 || node.nodeType === 8) {
|
|
3018
|
-
return node.parentElement ?? null;
|
|
3019
|
-
}
|
|
3020
|
-
return node;
|
|
3063
|
+
// src/client/native-group-actions.ts
|
|
3064
|
+
var ARCHIVE_MANAGER_PLUGIN = "@michengai/dsh-archive-manager";
|
|
3065
|
+
function hasArchiveManagerPlugin(root) {
|
|
3066
|
+
return root?.querySelector(`[data-plugin="${ARCHIVE_MANAGER_PLUGIN}"]`) != null;
|
|
3021
3067
|
}
|
|
3022
|
-
function
|
|
3023
|
-
|
|
3024
|
-
if (el == null) return true;
|
|
3025
|
-
return !keepInside.some((root) => {
|
|
3026
|
-
if (root == null || typeof root !== "object") return false;
|
|
3027
|
-
if (root === el) return true;
|
|
3028
|
-
const box = root;
|
|
3029
|
-
return typeof box.contains === "function" && box.contains(el);
|
|
3030
|
-
});
|
|
3068
|
+
function asSessionAction(value) {
|
|
3069
|
+
return typeof value === "function" ? value : void 0;
|
|
3031
3070
|
}
|
|
3032
|
-
function
|
|
3033
|
-
const
|
|
3034
|
-
const
|
|
3071
|
+
function scheduledListHostActions(props) {
|
|
3072
|
+
const source = props ?? {};
|
|
3073
|
+
const renameSession = asSessionAction(source.renameSession);
|
|
3074
|
+
const archiveSession = asSessionAction(source.archiveSession);
|
|
3075
|
+
const deleteSession = asSessionAction(source.deleteSession);
|
|
3076
|
+
const forkSession = asSessionAction(source.forkSession);
|
|
3035
3077
|
return {
|
|
3036
|
-
|
|
3037
|
-
|
|
3078
|
+
...renameSession === void 0 ? {} : { renameSession },
|
|
3079
|
+
...archiveSession === void 0 ? {} : { archiveSession },
|
|
3080
|
+
...deleteSession === void 0 ? {} : { deleteSession },
|
|
3081
|
+
...forkSession === void 0 ? {} : { forkSession }
|
|
3038
3082
|
};
|
|
3039
3083
|
}
|
|
3040
|
-
function
|
|
3041
|
-
|
|
3042
|
-
const vw = viewport.width || width + pad * 2;
|
|
3043
|
-
const vh = viewport.height || height + pad * 2;
|
|
3044
|
-
return {
|
|
3045
|
-
x: Math.max(pad, Math.min(x, Math.max(pad, vw - width - pad))),
|
|
3046
|
-
y: Math.max(pad, Math.min(y, Math.max(pad, vh - height - pad)))
|
|
3047
|
-
};
|
|
3084
|
+
function canDeleteScheduledSession(archiveManagerInstalled, deleteSession) {
|
|
3085
|
+
return archiveManagerInstalled && deleteSession !== void 0;
|
|
3048
3086
|
}
|
|
3049
|
-
function
|
|
3050
|
-
|
|
3051
|
-
return { id: clicked, x: point.x, y: point.y };
|
|
3087
|
+
function scheduledSessionMenuActions(canDelete) {
|
|
3088
|
+
return canDelete ? ["rename", "fork", "archive", "delete-session"] : ["rename", "fork", "archive"];
|
|
3052
3089
|
}
|
|
3053
|
-
function
|
|
3054
|
-
|
|
3055
|
-
return {
|
|
3056
|
-
position: "fixed",
|
|
3057
|
-
zIndex: 4e3,
|
|
3058
|
-
left: `${Math.round(pos.x)}px`,
|
|
3059
|
-
top: `${Math.round(pos.y)}px`
|
|
3060
|
-
};
|
|
3090
|
+
function scheduledGroupShowsActiveFolder(sessionIds, selectedId) {
|
|
3091
|
+
return selectedId !== null && sessionIds.includes(selectedId);
|
|
3061
3092
|
}
|
|
3093
|
+
function scheduledSessionOmitsStatusSlot(flat, running) {
|
|
3094
|
+
return flat && !running;
|
|
3095
|
+
}
|
|
3096
|
+
async function archiveScheduledGroup(sessionIds, archiveSession) {
|
|
3097
|
+
for (const sessionId of sessionIds) await archiveSession(sessionId);
|
|
3098
|
+
}
|
|
3099
|
+
|
|
3100
|
+
// src/client/native-session-list.tsx
|
|
3101
|
+
var import_react9 = require("react");
|
|
3102
|
+
var import_react_dom3 = require("react-dom");
|
|
3103
|
+
var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
3104
|
+
|
|
3105
|
+
// src/client/native-session-menu.ts
|
|
3062
3106
|
function nativeSessionHoverStyle(row, card, viewport) {
|
|
3063
3107
|
const pad = 8;
|
|
3064
3108
|
const left = row.right + pad;
|
|
@@ -3082,18 +3126,6 @@ function relativeTime(value, t, now = Date.now()) {
|
|
|
3082
3126
|
return t("time.dayAgo", { count: Math.floor(hour / 24) });
|
|
3083
3127
|
}
|
|
3084
3128
|
|
|
3085
|
-
// src/client/native-group-actions.ts
|
|
3086
|
-
var ARCHIVE_MANAGER_PLUGIN = "@michengai/dsh-archive-manager";
|
|
3087
|
-
function hasArchiveManagerPlugin(root) {
|
|
3088
|
-
return root?.querySelector(`[data-plugin="${ARCHIVE_MANAGER_PLUGIN}"]`) != null;
|
|
3089
|
-
}
|
|
3090
|
-
function scheduledGroupShowsActiveFolder(expanded, sessionIds, selectedId) {
|
|
3091
|
-
return expanded && selectedId !== null && sessionIds.includes(selectedId);
|
|
3092
|
-
}
|
|
3093
|
-
async function archiveScheduledGroup(sessionIds, archiveSession) {
|
|
3094
|
-
for (const sessionId of sessionIds) await archiveSession(sessionId);
|
|
3095
|
-
}
|
|
3096
|
-
|
|
3097
3129
|
// src/client/schedule-overview.tsx
|
|
3098
3130
|
var import_react7 = require("react");
|
|
3099
3131
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
@@ -3326,17 +3358,20 @@ function FilterRow({
|
|
|
3326
3358
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3327
3359
|
var EMPTY_SESSION_BY_ID = {};
|
|
3328
3360
|
function NativeScheduleSessionList(props) {
|
|
3329
|
-
const { t, runtime, openSession, useSessions, useWorkspaces, renameSession, archiveSession, forkSession, openTaskSettings } = props;
|
|
3361
|
+
const { t, runtime, openSession, useSessions, useWorkspaces, renameSession, archiveSession, deleteSession, forkSession, openTaskSettings } = props;
|
|
3330
3362
|
const state = (0, import_react9.useSyncExternalStore)(runtime.source.subscribe, runtime.source.getSnapshot, runtime.source.getSnapshot);
|
|
3331
|
-
const selectedId = useSessions ? useSessions((snap) => snap
|
|
3363
|
+
const selectedId = useSessions ? useSessions((snap) => resolveCurrentSessionId(snap)) : null;
|
|
3332
3364
|
const sessionById = useSessions ? useSessions((snap) => snap.byId ?? EMPTY_SESSION_BY_ID) : EMPTY_SESSION_BY_ID;
|
|
3333
3365
|
const archivedIds = useWorkspaces ? useWorkspaces((snap) => snap.archivedSessionIds ?? []) : [];
|
|
3334
3366
|
const [folded, setFolded] = (0, import_react9.useState)({});
|
|
3335
|
-
const [openMenu, setOpenMenu] = (0, import_react9.useState)(
|
|
3367
|
+
const [openMenu, setOpenMenu] = (0, import_react9.useState)();
|
|
3336
3368
|
const [openGroupMenu, setOpenGroupMenu] = (0, import_react9.useState)();
|
|
3337
3369
|
const [archiveGroupTarget, setArchiveGroupTarget] = (0, import_react9.useState)();
|
|
3338
3370
|
const [archiveGroupBusy, setArchiveGroupBusy] = (0, import_react9.useState)(false);
|
|
3339
3371
|
const [archiveGroupError, setArchiveGroupError] = (0, import_react9.useState)();
|
|
3372
|
+
const [deleteSessionTarget, setDeleteSessionTarget] = (0, import_react9.useState)();
|
|
3373
|
+
const [deleteSessionBusy, setDeleteSessionBusy] = (0, import_react9.useState)(false);
|
|
3374
|
+
const [deleteSessionError, setDeleteSessionError] = (0, import_react9.useState)();
|
|
3340
3375
|
const [archiveManagerInstalled, setArchiveManagerInstalled] = (0, import_react9.useState)(() => typeof document !== "undefined" && hasArchiveManagerPlugin(document));
|
|
3341
3376
|
const [query, setQuery] = (0, import_react9.useState)("");
|
|
3342
3377
|
const [sort, setSort] = (0, import_react9.useState)("time");
|
|
@@ -3390,6 +3425,7 @@ function NativeScheduleSessionList(props) {
|
|
|
3390
3425
|
};
|
|
3391
3426
|
}, []);
|
|
3392
3427
|
const canArchiveGroup = archiveManagerInstalled && archiveSession !== void 0;
|
|
3428
|
+
const canDeleteSession = canDeleteScheduledSession(archiveManagerInstalled, deleteSession);
|
|
3393
3429
|
const confirmArchiveGroup = () => {
|
|
3394
3430
|
if (archiveGroupTarget === void 0 || archiveSession === void 0 || archiveGroupBusy) return;
|
|
3395
3431
|
const target = archiveGroupTarget;
|
|
@@ -3403,6 +3439,19 @@ function NativeScheduleSessionList(props) {
|
|
|
3403
3439
|
setArchiveGroupBusy(false);
|
|
3404
3440
|
});
|
|
3405
3441
|
};
|
|
3442
|
+
const confirmDeleteSession = () => {
|
|
3443
|
+
if (deleteSessionTarget === void 0 || deleteSession === void 0 || deleteSessionBusy) return;
|
|
3444
|
+
const target = deleteSessionTarget;
|
|
3445
|
+
setDeleteSessionBusy(true);
|
|
3446
|
+
setDeleteSessionError(void 0);
|
|
3447
|
+
void Promise.resolve(deleteSession(target.id)).then(() => {
|
|
3448
|
+
setDeleteSessionTarget(void 0);
|
|
3449
|
+
}).catch((caught) => {
|
|
3450
|
+
setDeleteSessionError(caught instanceof Error ? caught.message : t("error.action"));
|
|
3451
|
+
}).finally(() => {
|
|
3452
|
+
setDeleteSessionBusy(false);
|
|
3453
|
+
});
|
|
3454
|
+
};
|
|
3406
3455
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "dsh-st-n", children: [
|
|
3407
3456
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScheduleViewSwitch, { t, view, onChange: setView }),
|
|
3408
3457
|
view === "overview" ? state.snapshot === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "dsh-st-n-empty", children: state.phase === "loading" ? t("loading") : t("overview.empty") }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
@@ -3416,12 +3465,12 @@ function NativeScheduleSessionList(props) {
|
|
|
3416
3465
|
}
|
|
3417
3466
|
) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
3418
3467
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(WorkspaceToolbar, { t, query, sort, groupMode, onQueryChange: setQuery, onSortChange: setSort, onGroupModeChange: setGroupMode }),
|
|
3419
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "dsh-st-n-tree", role: "tree", children: [
|
|
3468
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "dsh-st-n-list-area", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "dsh-st-n-tree", role: "tree", children: [
|
|
3420
3469
|
state.phase === "loading" && visibleGroups.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "dsh-st-n-empty", children: t("loading") }),
|
|
3421
3470
|
visibleGroups.length === 0 && state.phase !== "loading" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "dsh-st-n-empty", children: t("sidebar.empty") }),
|
|
3422
3471
|
visibleGroups.map((group) => {
|
|
3423
3472
|
const expanded = folded[group.id] !== true;
|
|
3424
|
-
const hasCurrentSession = scheduledGroupShowsActiveFolder(
|
|
3473
|
+
const hasCurrentSession = scheduledGroupShowsActiveFolder(group.sessions.map((session) => session.id), selectedId);
|
|
3425
3474
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "dsh-st-n-group", children: [
|
|
3426
3475
|
groupMode === "workspace" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3427
3476
|
NativeScheduleGroupRow,
|
|
@@ -3436,7 +3485,7 @@ function NativeScheduleSessionList(props) {
|
|
|
3436
3485
|
canArchiveGroup,
|
|
3437
3486
|
onToggle: () => setFolded((current) => ({ ...current, [group.id]: expanded })),
|
|
3438
3487
|
onMenuChange: (open) => {
|
|
3439
|
-
setOpenMenu(
|
|
3488
|
+
setOpenMenu(void 0);
|
|
3440
3489
|
setOpenGroupMenu(open ? group.id : void 0);
|
|
3441
3490
|
},
|
|
3442
3491
|
onTaskSettings: () => {
|
|
@@ -3452,23 +3501,30 @@ function NativeScheduleSessionList(props) {
|
|
|
3452
3501
|
NativeSessionRow,
|
|
3453
3502
|
{
|
|
3454
3503
|
t,
|
|
3504
|
+
flat: groupMode === "list",
|
|
3455
3505
|
id: session.id,
|
|
3456
3506
|
title: session.title,
|
|
3457
3507
|
hoverTitle: String(sessionById[session.id]?.displayTitle ?? sessionById[session.id]?.title ?? group.name),
|
|
3458
3508
|
updatedAt: session.updatedAt,
|
|
3459
3509
|
running: session.running,
|
|
3460
3510
|
selected: selectedId === session.id,
|
|
3461
|
-
menuOpen: openMenu
|
|
3462
|
-
|
|
3463
|
-
|
|
3511
|
+
menuOpen: openMenu === session.id,
|
|
3512
|
+
canDelete: canDeleteSession,
|
|
3513
|
+
onMenuChange: (open) => {
|
|
3464
3514
|
setOpenGroupMenu(void 0);
|
|
3465
|
-
setOpenMenu(
|
|
3515
|
+
setOpenMenu(open ? session.id : void 0);
|
|
3466
3516
|
},
|
|
3467
|
-
onCloseMenu: () => setOpenMenu((current) => current?.id === session.id ? null : current),
|
|
3468
3517
|
onOpen: () => {
|
|
3469
|
-
setOpenMenu(
|
|
3518
|
+
setOpenMenu(void 0);
|
|
3470
3519
|
openSession?.(session.id);
|
|
3471
3520
|
},
|
|
3521
|
+
onDeleteSession: () => {
|
|
3522
|
+
setDeleteSessionError(void 0);
|
|
3523
|
+
setDeleteSessionTarget({
|
|
3524
|
+
id: session.id,
|
|
3525
|
+
title: String(sessionById[session.id]?.displayTitle ?? sessionById[session.id]?.title ?? session.title)
|
|
3526
|
+
});
|
|
3527
|
+
},
|
|
3472
3528
|
...renameSession === void 0 ? {} : { renameSession },
|
|
3473
3529
|
...archiveSession === void 0 ? {} : { archiveSession },
|
|
3474
3530
|
...forkSession === void 0 ? {} : { forkSession }
|
|
@@ -3477,7 +3533,7 @@ function NativeScheduleSessionList(props) {
|
|
|
3477
3533
|
))
|
|
3478
3534
|
] }, group.id);
|
|
3479
3535
|
})
|
|
3480
|
-
] })
|
|
3536
|
+
] }) })
|
|
3481
3537
|
] }),
|
|
3482
3538
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3483
3539
|
import_dsh_client_ui_primitives3.Modal,
|
|
@@ -3503,6 +3559,31 @@ function NativeScheduleSessionList(props) {
|
|
|
3503
3559
|
archiveGroupError !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "dsh-st-n-dialog-error", role: "alert", children: t("session.archiveGroupFailed", { message: archiveGroupError }) })
|
|
3504
3560
|
]
|
|
3505
3561
|
}
|
|
3562
|
+
),
|
|
3563
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3564
|
+
import_dsh_client_ui_primitives3.Modal,
|
|
3565
|
+
{
|
|
3566
|
+
open: deleteSessionTarget !== void 0,
|
|
3567
|
+
onClose: () => {
|
|
3568
|
+
if (deleteSessionBusy) return;
|
|
3569
|
+
setDeleteSessionTarget(void 0);
|
|
3570
|
+
setDeleteSessionError(void 0);
|
|
3571
|
+
},
|
|
3572
|
+
closeLabel: t("session.deleteSessionClose"),
|
|
3573
|
+
title: t("session.deleteSession"),
|
|
3574
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "dsh-st-n-dialog-actions", children: [
|
|
3575
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", disabled: deleteSessionBusy, onClick: () => {
|
|
3576
|
+
setDeleteSessionTarget(void 0);
|
|
3577
|
+
setDeleteSessionError(void 0);
|
|
3578
|
+
}, children: t("session.deleteSessionCancel") }),
|
|
3579
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", className: "dsh-st-n-danger-button", disabled: deleteSessionBusy, onClick: confirmDeleteSession, children: t("session.deleteSessionConfirm") })
|
|
3580
|
+
] }),
|
|
3581
|
+
children: [
|
|
3582
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "dsh-st-n-dialog-copy", children: deleteSessionTarget === void 0 ? "" : t("session.deleteSessionDescription", { name: deleteSessionTarget.title }) }),
|
|
3583
|
+
deleteSessionBusy && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "dsh-st-n-dialog-status", role: "status", children: t("session.deleteSessionPending") }),
|
|
3584
|
+
deleteSessionError !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "dsh-st-n-dialog-error", role: "alert", children: t("session.deleteSessionFailed", { message: deleteSessionError }) })
|
|
3585
|
+
]
|
|
3586
|
+
}
|
|
3506
3587
|
)
|
|
3507
3588
|
] });
|
|
3508
3589
|
}
|
|
@@ -3526,7 +3607,8 @@ function NativeScheduleGroupRow(props) {
|
|
|
3526
3607
|
onClick: onToggle,
|
|
3527
3608
|
children: [
|
|
3528
3609
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dsh-st-n-slot dsh-st-n-folder", children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FolderOpenIcon, { width: 16, height: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FolderClosedIcon, { width: 16, height: 16 }) }),
|
|
3529
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dsh-st-n-
|
|
3610
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dsh-st-n-slot dsh-st-n-chevron", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ChevronIcon, { width: 14, height: 14, className: "dsh-st-n-arrow" + (expanded ? " is-open" : "") }) }),
|
|
3611
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dsh-st-n-project-text", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dsh-st-n-title", children: name2 }) }),
|
|
3530
3612
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dsh-st-n-acts", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3531
3613
|
import_dsh_client_ui_primitives3.Menu,
|
|
3532
3614
|
{
|
|
@@ -3541,8 +3623,7 @@ function NativeScheduleGroupRow(props) {
|
|
|
3541
3623
|
if (action === "archive-group") onArchiveGroup();
|
|
3542
3624
|
},
|
|
3543
3625
|
portal: true,
|
|
3544
|
-
|
|
3545
|
-
compact: true,
|
|
3626
|
+
closeOnPointerLeave: true,
|
|
3546
3627
|
anchor: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3547
3628
|
"button",
|
|
3548
3629
|
{
|
|
@@ -3566,50 +3647,18 @@ function NativeScheduleGroupRow(props) {
|
|
|
3566
3647
|
);
|
|
3567
3648
|
}
|
|
3568
3649
|
function NativeSessionRow(props) {
|
|
3569
|
-
const { t, id, title, hoverTitle, updatedAt, running, selected, menuOpen,
|
|
3650
|
+
const { t, flat, id, title, hoverTitle, updatedAt, running, selected, menuOpen, canDelete, onMenuChange, onOpen, onDeleteSession, renameSession, archiveSession, forkSession } = props;
|
|
3651
|
+
const omitStatusSlot = scheduledSessionOmitsStatusSlot(flat, running);
|
|
3570
3652
|
const rowRef = (0, import_react9.useRef)(null);
|
|
3571
|
-
const menuRef = (0, import_react9.useRef)(null);
|
|
3572
3653
|
const hoverRef = (0, import_react9.useRef)(null);
|
|
3573
3654
|
const [hoverOpen, setHoverOpen] = (0, import_react9.useState)(false);
|
|
3574
3655
|
const [hoverStyle, setHoverStyle] = (0, import_react9.useState)({});
|
|
3575
3656
|
const hoverTimer = (0, import_react9.useRef)(void 0);
|
|
3576
3657
|
const [renaming, setRenaming] = (0, import_react9.useState)(false);
|
|
3577
3658
|
const [draft, setDraft] = (0, import_react9.useState)(title);
|
|
3578
|
-
const [menuStyle, setMenuStyle] = (0, import_react9.useState)({});
|
|
3579
3659
|
(0, import_react9.useEffect)(() => {
|
|
3580
3660
|
setDraft(title);
|
|
3581
3661
|
}, [title]);
|
|
3582
|
-
(0, import_react9.useEffect)(() => {
|
|
3583
|
-
if (!menuOpen) return;
|
|
3584
|
-
const close = (event) => {
|
|
3585
|
-
if (!shouldCloseNativeSessionMenu(event.target, [rowRef.current, menuRef.current])) return;
|
|
3586
|
-
onCloseMenu();
|
|
3587
|
-
};
|
|
3588
|
-
const onKey = (event) => {
|
|
3589
|
-
if (event.key === "Escape") onCloseMenu();
|
|
3590
|
-
};
|
|
3591
|
-
document.addEventListener("mousedown", close);
|
|
3592
|
-
document.addEventListener("keydown", onKey);
|
|
3593
|
-
return () => {
|
|
3594
|
-
document.removeEventListener("mousedown", close);
|
|
3595
|
-
document.removeEventListener("keydown", onKey);
|
|
3596
|
-
};
|
|
3597
|
-
}, [menuOpen, onCloseMenu]);
|
|
3598
|
-
(0, import_react9.useLayoutEffect)(() => {
|
|
3599
|
-
if (!menuOpen) return;
|
|
3600
|
-
const update = () => {
|
|
3601
|
-
const el = menuRef.current;
|
|
3602
|
-
const size = el === null ? { width: 218, height: 176 } : { width: el.offsetWidth, height: el.offsetHeight };
|
|
3603
|
-
setMenuStyle(nativeSessionMenuStyle(menuPoint, size, { width: window.innerWidth, height: window.innerHeight }));
|
|
3604
|
-
};
|
|
3605
|
-
update();
|
|
3606
|
-
window.addEventListener("resize", update);
|
|
3607
|
-
document.addEventListener("scroll", update, true);
|
|
3608
|
-
return () => {
|
|
3609
|
-
window.removeEventListener("resize", update);
|
|
3610
|
-
document.removeEventListener("scroll", update, true);
|
|
3611
|
-
};
|
|
3612
|
-
}, [menuOpen, menuPoint]);
|
|
3613
3662
|
(0, import_react9.useEffect)(() => {
|
|
3614
3663
|
if (!hoverOpen || menuOpen) return;
|
|
3615
3664
|
const update = () => {
|
|
@@ -3642,7 +3691,7 @@ function NativeSessionRow(props) {
|
|
|
3642
3691
|
if (hoverTimer.current !== void 0) window.clearTimeout(hoverTimer.current);
|
|
3643
3692
|
setHoverOpen(false);
|
|
3644
3693
|
};
|
|
3645
|
-
const rowClass = "dsh-st-n-sess" + (selected ? " is-on" : "") + (menuOpen ? " is-menu" : "");
|
|
3694
|
+
const rowClass = "dsh-st-n-sess" + (selected ? " is-on" : "") + (menuOpen ? " is-menu" : "") + (omitStatusSlot ? " is-flat-idle" : "");
|
|
3646
3695
|
if (renaming) {
|
|
3647
3696
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: rowClass, ref: rowRef, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("input", { className: "dsh-st-n-rename", value: draft, autoFocus: true, "aria-label": t("session.rename"), onChange: (event) => setDraft(event.target.value), onClick: (event) => event.stopPropagation(), onKeyDown: (event) => {
|
|
3648
3697
|
if (event.key === "Enter") {
|
|
@@ -3660,23 +3709,12 @@ function NativeSessionRow(props) {
|
|
|
3660
3709
|
if (draft.trim() !== "" && draft.trim() !== title) run(() => renameSession?.(id, draft.trim()));
|
|
3661
3710
|
} }) });
|
|
3662
3711
|
}
|
|
3663
|
-
const
|
|
3664
|
-
{ id:
|
|
3665
|
-
|
|
3666
|
-
} }
|
|
3667
|
-
{ id:
|
|
3668
|
-
|
|
3669
|
-
];
|
|
3670
|
-
const menu = menuOpen && typeof document !== "undefined" ? (0, import_react_dom3.createPortal)(
|
|
3671
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { ref: menuRef, className: "dsh-st-n-menu is-float", "data-n-menu": id, style: menuStyle, onMouseDown: (event) => event.stopPropagation(), onClick: (event) => event.stopPropagation(), children: menuItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("button", { type: "button", className: void 0, onClick: () => {
|
|
3672
|
-
onCloseMenu();
|
|
3673
|
-
item.go();
|
|
3674
|
-
}, children: [
|
|
3675
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dsh-st-n-mi", children: item.icon }),
|
|
3676
|
-
item.label
|
|
3677
|
-
] }, item.id)) }),
|
|
3678
|
-
document.body
|
|
3679
|
-
) : null;
|
|
3712
|
+
const items = scheduledSessionMenuActions(canDelete).map((action) => {
|
|
3713
|
+
if (action === "rename") return { id: action, label: t("session.rename"), icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_dsh_client_ui_primitives3.IconEditOutline16, {}) };
|
|
3714
|
+
if (action === "fork") return { id: action, label: t("session.fork"), icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_dsh_client_ui_primitives3.IconBranchOutline16, {}) };
|
|
3715
|
+
if (action === "archive") return { id: action, label: t("session.archive"), icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_dsh_client_ui_primitives3.IconArchiveOutline20, { size: 16 }) };
|
|
3716
|
+
return { id: action, label: t("session.deleteSession"), icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_dsh_client_ui_primitives3.IconTrashOutline16, {}), danger: true };
|
|
3717
|
+
});
|
|
3680
3718
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: rowClass, ref: rowRef, role: "treeitem", tabIndex: 0, "aria-selected": selected, "data-n-menu-root": id, onClick: onOpen, onMouseEnter: showHover, onMouseLeave: hideHover, onKeyDown: (event) => {
|
|
3681
3719
|
if (event.key === "Enter" || event.key === " ") {
|
|
3682
3720
|
event.preventDefault();
|
|
@@ -3685,17 +3723,48 @@ function NativeSessionRow(props) {
|
|
|
3685
3723
|
}, onContextMenu: (event) => {
|
|
3686
3724
|
event.preventDefault();
|
|
3687
3725
|
event.stopPropagation();
|
|
3688
|
-
|
|
3726
|
+
hideHover();
|
|
3727
|
+
onMenuChange(true);
|
|
3689
3728
|
}, children: [
|
|
3690
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dsh-st-n-slot", children: running ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RunningStateDot, {}) : null }),
|
|
3729
|
+
!omitStatusSlot && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dsh-st-n-slot", children: running ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RunningStateDot, {}) : null }),
|
|
3691
3730
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dsh-st-n-title", children: title }),
|
|
3692
3731
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dsh-st-n-time", children: relativeTime(updatedAt, t) }),
|
|
3693
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dsh-st-n-acts", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3732
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "dsh-st-n-acts", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3733
|
+
import_dsh_client_ui_primitives3.Menu,
|
|
3734
|
+
{
|
|
3735
|
+
open: menuOpen,
|
|
3736
|
+
onClose: () => {
|
|
3737
|
+
onMenuChange(false);
|
|
3738
|
+
},
|
|
3739
|
+
items,
|
|
3740
|
+
onSelect: (action) => {
|
|
3741
|
+
onMenuChange(false);
|
|
3742
|
+
if (action === "rename") setRenaming(true);
|
|
3743
|
+
if (action === "fork") run(() => forkSession?.(id));
|
|
3744
|
+
if (action === "archive") run(() => archiveSession?.(id));
|
|
3745
|
+
if (action === "delete-session") onDeleteSession?.();
|
|
3746
|
+
},
|
|
3747
|
+
portal: true,
|
|
3748
|
+
closeOnPointerLeave: true,
|
|
3749
|
+
anchor: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3750
|
+
"button",
|
|
3751
|
+
{
|
|
3752
|
+
type: "button",
|
|
3753
|
+
className: "dsh-st-n-ico",
|
|
3754
|
+
"aria-label": t("session.moreActions", { title }),
|
|
3755
|
+
onMouseDown: (event) => {
|
|
3756
|
+
event.stopPropagation();
|
|
3757
|
+
},
|
|
3758
|
+
onClick: (event) => {
|
|
3759
|
+
event.stopPropagation();
|
|
3760
|
+
hideHover();
|
|
3761
|
+
onMenuChange(!menuOpen);
|
|
3762
|
+
},
|
|
3763
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_dsh_client_ui_primitives3.IconEllipsisOutline16, { size: 16 })
|
|
3764
|
+
}
|
|
3765
|
+
)
|
|
3766
|
+
}
|
|
3767
|
+
) }),
|
|
3699
3768
|
hoverOpen && !menuOpen && typeof document !== "undefined" && (0, import_react_dom3.createPortal)(
|
|
3700
3769
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { ref: hoverRef, className: "dsh-st-n-hover", style: hoverStyle, onMouseEnter: showHover, onMouseLeave: hideHover, children: [
|
|
3701
3770
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "dsh-st-n-hover-title", children: (hoverTitle ?? title).trim() || title }),
|
|
@@ -3827,7 +3896,7 @@ function NativeScheduleShell({
|
|
|
3827
3896
|
},
|
|
3828
3897
|
() => false
|
|
3829
3898
|
);
|
|
3830
|
-
const currentId = useSessions?.((state) => state
|
|
3899
|
+
const currentId = useSessions?.((state) => resolveCurrentSessionId(state));
|
|
3831
3900
|
const automationState = (0, import_react10.useSyncExternalStore)(runtime.source.subscribe, runtime.source.getSnapshot, runtime.source.getSnapshot);
|
|
3832
3901
|
const scheduledIds = (0, import_react10.useMemo)(() => collectScheduledSessionIds(automationState.snapshot?.runs), [automationState.snapshot]);
|
|
3833
3902
|
const snapshotRefreshFor = (0, import_react10.useRef)(null);
|
|
@@ -3891,7 +3960,7 @@ function NativeScheduleShell({
|
|
|
3891
3960
|
extraTabIds: ownedSidebarTabIds({ extraTabIds: foreignTabs.map((item) => item.id), channelsReady })
|
|
3892
3961
|
});
|
|
3893
3962
|
const hostedSchedule = extraTabs.find((item) => item.id === "schedule");
|
|
3894
|
-
const scheduleBody = hostedSchedule === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NativeScheduleSessionList, { t, runtime, ...openSession === void 0 ? {} : { openSession }, ...openTaskSettings === void 0 ? {} : { openTaskSettings }, ...useSessions === void 0 ? {} : { useSessions }, ...useWorkspaces === void 0 ? {} : { useWorkspaces } }) : hostedSchedule.render({ ...hostProps ?? {}, openSession, open: openSession, useSessions, wide: true });
|
|
3963
|
+
const scheduleBody = hostedSchedule === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NativeScheduleSessionList, { t, runtime, ...openSession === void 0 ? {} : { openSession }, ...openTaskSettings === void 0 ? {} : { openTaskSettings }, ...useSessions === void 0 ? {} : { useSessions }, ...useWorkspaces === void 0 ? {} : { useWorkspaces }, ...scheduledListHostActions(hostProps) }) : hostedSchedule.render({ ...hostProps ?? {}, openSession, open: openSession, useSessions, wide: true });
|
|
3895
3964
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "dsh-st-shell-rail", children: [
|
|
3896
3965
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "dsh-st-shell-tabs", role: "tablist", "aria-label": t("sidebar.tabs"), children: [
|
|
3897
3966
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", role: "tab", "aria-selected": visibleTab === "tasks", className: visibleTab === "tasks" ? "is-on" : void 0, onClick: () => setTab("tasks"), children: t("sidebar.tasksTab") }),
|
|
@@ -3911,6 +3980,7 @@ function NativeTaskRail({
|
|
|
3911
3980
|
const snap = useSessions === void 0 ? { ids: [], byId: {}, current: null } : useSessions((state) => state ?? { ids: [], byId: {}, current: null });
|
|
3912
3981
|
const workspaces = useWorkspaces === void 0 ? void 0 : useWorkspaces((state) => state ?? { items: [], archivedSessionIds: [] });
|
|
3913
3982
|
const groups = groupNativeTaskSessions(snap, workspaces, t("sidebar.ungrouped"));
|
|
3983
|
+
const currentId = resolveCurrentSessionId(snap);
|
|
3914
3984
|
if (groups.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "dsh-st-rail-empty", children: t("sidebar.tasksEmpty") });
|
|
3915
3985
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "dsh-st-rail", children: groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("section", { className: "dsh-st-rail-group", children: [
|
|
3916
3986
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "dsh-st-rail-head is-static", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "dsh-st-rail-title", children: group.label }) }),
|
|
@@ -3918,7 +3988,7 @@ function NativeTaskRail({
|
|
|
3918
3988
|
"button",
|
|
3919
3989
|
{
|
|
3920
3990
|
type: "button",
|
|
3921
|
-
className: `dsh-st-rail-session${
|
|
3991
|
+
className: `dsh-st-rail-session${currentId === item.id ? " is-on" : ""}`,
|
|
3922
3992
|
onClick: () => {
|
|
3923
3993
|
if (item.id !== void 0) openSession?.(item.id);
|
|
3924
3994
|
},
|
|
@@ -4137,14 +4207,21 @@ var CSS_TEXT = `
|
|
|
4137
4207
|
.dsh-st-shell-body>*{min-width:0;flex:1}.dsh-st-official-tree{display:flex;min-height:0;flex:1;overflow:hidden}.dsh-st-official-tree>*{min-width:0;flex:1}
|
|
4138
4208
|
.dsh-st-rail-head.is-static{cursor:default;font-weight:600}
|
|
4139
4209
|
.dsh-st-rail-session.is-on{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
|
|
4140
|
-
.dsh-st-n,.dsh-st-n *{box-sizing:border-box}.dsh-st-n{box-sizing:border-box;display:flex;flex:1;min-width:0;
|
|
4141
|
-
.dsh-st-n-
|
|
4210
|
+
.dsh-st-n,.dsh-st-n *{box-sizing:border-box}.dsh-st-n{--dsh-session-list-edge-inset:var(--dsh-sidebar-inline-padding,12px);--dsh-session-list-scrollbar-width:8px;--dsh-session-list-scrollbar-offset:2px;box-sizing:border-box;display:flex;flex:1;min-width:0;min-height:0;flex-direction:column;padding:0;padding-right:var(--dsh-session-list-edge-inset);color:var(--dsw-alias-label-primary,inherit);font:14px/20px inherit;overflow:hidden}.dsh-st-n-toolbar{box-sizing:border-box;flex:none;height:36px;margin:2px -4px 4px 0;padding-left:4px;display:flex;justify-content:flex-end;align-items:center;gap:4px;overflow:visible;position:relative;z-index:2;color:var(--dsw-alias-label-tertiary,#81858C);border-radius:12px}.dsh-st-n-head-label{white-space:nowrap;min-width:0;max-width:45%;flex:none;line-height:20px;font-size:14px;overflow:hidden;transition:max-width .18s var(--ds-ease-in-out,ease),margin-right .18s var(--ds-ease-in-out,ease),opacity .12s var(--ds-ease-in-out,ease),transform .18s var(--ds-ease-in-out,ease),visibility 0s linear}.dsh-st-n-toolbar.is-search .dsh-st-n-head-label{opacity:0;visibility:hidden;max-width:0;margin-right:-4px;transform:translate(-4px);transition-delay:0s,0s,0s,0s,.18s}.dsh-st-n-search-slot{box-sizing:border-box;min-width:28px;max-width:28px;transition:max-width .18s var(--ds-ease-in-out,ease);flex:none;align-items:center;margin-left:auto;display:flex;position:relative;z-index:2}.dsh-st-n-toolbar.is-search .dsh-st-n-search-slot{flex:1;min-width:0;max-width:100%}.dsh-st-n-search{box-sizing:border-box;cursor:text;width:100%;height:28px;color:var(--dsw-alias-label-secondary);transition:width .18s var(--ds-ease-in-out,ease),padding .18s var(--ds-ease-in-out,ease),border-color .18s var(--ds-ease-in-out,ease);background:transparent;border:none;border-radius:50%;flex:none;align-items:center;margin:0;padding:0;display:flex;overflow:hidden}.dsh-st-n-toolbar.is-search .dsh-st-n-search{border:.5px solid var(--dsw-alias-border-l4);width:calc(100% + 4px);height:30px;color:var(--dsw-alias-label-caption);border-radius:10px;margin-inline:-2px;padding:0 4px 0 0}.dsh-st-n-search-btn,.dsh-st-n-head-btn{cursor:pointer;width:28px;height:28px;min-width:28px;min-height:28px;position:relative;z-index:1;color:var(--dsw-alias-label-secondary);background:transparent;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.dsh-st-n-toolbar.is-search .dsh-st-n-search-btn{width:28px;height:30px}.dsh-st-n-search-btn:hover,.dsh-st-n-head-btn:hover,.dsh-st-n-head-btn.is-on{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06));color:var(--dsw-alias-label-primary,inherit)}.dsh-st-n-toolbar.is-search .dsh-st-n-search-btn:hover{background:transparent}.dsh-st-n-head-acts{opacity:1;visibility:visible;max-width:32px;transition:max-width .18s var(--ds-ease-in-out,ease),opacity .12s var(--ds-ease-in-out,ease),transform .18s var(--ds-ease-in-out,ease),visibility 0s linear;flex:none;align-items:center;gap:4px;display:flex;overflow:visible;position:relative}.dsh-st-n-toolbar.is-search .dsh-st-n-head-acts{opacity:0;visibility:hidden;pointer-events:none;max-width:0;transform:translate(4px);transition-delay:0s,0s,0s,.18s}.dsh-st-n-head-filter{position:relative}.dsh-st-n-search-input{display:none;opacity:0;pointer-events:none;width:0;min-width:0;flex:none;color:var(--dsw-alias-label-primary,inherit);transition:opacity .12s var(--ds-ease-in-out,ease);background:transparent;border:none;outline:none;flex:1;font-size:13px;line-height:18px}.dsh-st-n-toolbar.is-search .dsh-st-n-search-input{display:block;opacity:1;pointer-events:auto;margin-left:-2px;width:auto;flex:1;min-width:0}.dsh-st-n-search-input::placeholder{color:var(--dsw-alias-label-tertiary,#81858C)}.dsh-st-n-search-clear{cursor:pointer;width:24px;height:24px;color:var(--dsw-alias-label-secondary);background:transparent;border:none;border-radius:50%;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.dsh-st-n-search-clear:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}@media (prefers-reduced-motion:reduce){.dsh-st-n-head-label,.dsh-st-n-search-slot,.dsh-st-n-search,.dsh-st-n-head-acts,.dsh-st-n-search-input{transition:none}}.dsh-st-n-filter-menu{position:absolute;right:0;top:calc(100% + 6px);z-index:30;min-width:196px;padding:8px 6px;border:1px solid var(--dsw-alias-border-inverted,rgba(255,255,255,.12));border-radius:12px;background:var(--dsw-specific-menu,#1c2128);box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.36))}.dsh-st-n-filter-label{padding:6px 10px 4px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,#81858C)}.dsh-st-n-filter-split{height:1px;margin:6px 8px;background:var(--dsw-alias-border-l2,rgba(255,255,255,.1))}.dsh-st-n-filter-menu button{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:36px;padding:6px 10px;border:0;border-radius:8px;background:transparent;color:var(--dsw-alias-label-primary,inherit);font:14px/20px inherit;cursor:pointer;text-align:left}.dsh-st-n-filter-menu button:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}.dsh-st-n-filter-tick{width:16px;height:16px;flex:none}.dsh-st-n-list-area{min-height:0;margin-left:-4px;margin-right:calc(-1 * var(--dsh-session-list-edge-inset));flex-direction:column;flex:1;padding-left:4px;display:flex;overflow:visible}.dsh-st-n-tree{flex:1;min-width:0;min-height:0;overflow-x:hidden;overflow-y:auto;user-select:none;margin-left:-4px;margin-right:var(--dsh-session-list-scrollbar-offset);padding-top:0;padding-bottom:16px;padding-left:4px;padding-right:calc(var(--dsh-session-list-edge-inset) - var(--dsh-session-list-scrollbar-width) - var(--dsh-session-list-scrollbar-offset));scrollbar-gutter:stable}.dsh-st-n-empty{padding:16px 12px;color:var(--dsw-alias-label-tertiary,#8b8f98);font-size:13px}.dsh-st-n-group{position:relative;min-width:0;max-width:100%}.dsh-st-n-row,.dsh-st-n-sess{display:flex;align-items:center;max-width:100%;border-radius:8px;padding:0 8px;padding-inline-start:calc(8px + var(--dsh-workspace-indent,0px));cursor:pointer;user-select:none;border:0;background:transparent;color:var(--dsw-alias-label-primary,inherit);text-align:left;font:14px/20px inherit;gap:6px}.dsh-st-n-row{height:34px;gap:6px}.dsh-st-n-sess{height:32px;gap:0;position:relative;width:100%;appearance:none}.dsh-st-n-row:hover,.dsh-st-n-sess:hover,.dsh-st-n-sess.is-on,.dsh-st-n-sess.is-menu{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}.dsh-st-n-slot{flex:none;width:16px;height:20px;color:var(--dsw-alias-label-tertiary,#81858C);display:inline-flex;align-items:center;justify-content:center}.dsh-st-n-folder{color:inherit}.dsh-st-n-lead{color:var(--dsw-alias-label-tertiary,#81858C)}.dsh-st-n-corner{color:var(--dsw-alias-label-caption,#ADB2B8);width:8px}.dsh-st-n-title{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;line-height:20px}.dsh-st-n-sess .dsh-st-n-title{margin:0 6px 0 4px;scroll-behavior:smooth;flex:1}.dsh-st-n-sess.is-flat-idle .dsh-st-n-title{margin-left:0}@media (hover:hover){.dsh-st-n-sess:hover .dsh-st-n-title{text-overflow:clip}}.dsh-st-n-time{flex:none;font-size:12px;line-height:20px;color:var(--dsw-alias-label-tertiary,#81858C);white-space:nowrap}.dsh-st-n-acts{flex:none;display:none;align-items:center;gap:12px}.dsh-st-n-row:hover .dsh-st-n-acts,.dsh-st-n-sess:hover .dsh-st-n-acts,.dsh-st-n-row.is-menu .dsh-st-n-acts,.dsh-st-n-sess.is-menu .dsh-st-n-acts{display:inline-flex}.dsh-st-n-sess:hover .dsh-st-n-time,.dsh-st-n-sess.is-menu .dsh-st-n-time{display:none}.dsh-st-n-ico{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border:0;border-radius:4px;background:transparent;color:var(--dsw-alias-label-tertiary,#81858C);padding:0;cursor:pointer}.dsh-st-n-ico:hover{color:var(--dsw-alias-label-primary,inherit)}.dsh-st-n-hover{position:fixed;z-index:4100;box-sizing:border-box;display:flex;flex-direction:column;gap:8px;width:244px;padding:12px 16px;border:0;border-radius:12px;background:#2C2C2E;box-shadow:var(--dsw-shadow-lv3,0 8px 24px rgba(0,0,0,.36));color:#fff}.dsh-st-n-hover-title{overflow-wrap:break-word;font-size:14px;line-height:20px;font-weight:400;color:#fff}.dsh-st-n-hover-time{font-size:12px;line-height:16px;color:#cfd3d6}.dsh-st-n-hover-state{display:flex;align-items:center;gap:8px;font-size:12px;line-height:20px;color:#adb2b8}.dsh-st-n-hover-dot{width:10px;height:10px;border-radius:50%;background:#34c759;flex:none}.dsh-st-n-hover-dot.is-run{background:#4c8dff}.dsh-st-n-rename{flex:1;min-width:0;margin:0 6px 0 4px;border:.5px solid var(--dsw-alias-border-l4);border-radius:4px;outline:none;background:var(--dsw-alias-button-elevated-fill,rgba(255,255,255,.04));color:inherit;padding:0 2px;font-size:14px;line-height:20px}
|
|
4211
|
+
.dsh-st-n-group>*+*{margin-top:2px}
|
|
4212
|
+
.dsh-st-n-group+.dsh-st-n-group{margin-top:4px}
|
|
4213
|
+
.dsh-st-n-row{box-sizing:border-box}
|
|
4214
|
+
.dsh-st-n-row .dsh-st-n-acts{height:20px}
|
|
4142
4215
|
.dsh-st-n-row.is-menu{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06))}
|
|
4143
4216
|
.dsh-st-overview-sort .dsh-st-n-head-btn.is-open{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.06));color:var(--dsw-alias-label-primary,inherit)}
|
|
4144
|
-
.dsh-st-n-row
|
|
4217
|
+
.dsh-st-n-row.has-current-session .dsh-st-n-folder{color:var(--dsw-alias-state-business-primary,#4c8dff)}
|
|
4218
|
+
.dsh-st-n-chevron{display:none;color:var(--dsw-alias-label-caption,#ADB2B8)}
|
|
4219
|
+
.dsh-st-n-row:hover .dsh-st-n-chevron{display:inline-flex}
|
|
4220
|
+
.dsh-st-n-row:hover .dsh-st-n-folder{display:none}
|
|
4221
|
+
.dsh-st-n-arrow{transition:transform .15s var(--ds-ease-in-out,ease)}
|
|
4222
|
+
.dsh-st-n-arrow.is-open{transform:rotate(90deg)}
|
|
4223
|
+
.dsh-st-n-project-text{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}
|
|
4145
4224
|
.dsh-st-n-sess:focus{outline:none}.dsh-st-n-sess:focus-visible:not(.is-on){box-shadow:inset 0 0 0 2px var(--dsw-alias-state-business-primary,#4c8dff)}
|
|
4146
|
-
.dsh-st-n-row>.dsh-st-n-acts{display:inline-flex;opacity:0;visibility:hidden;pointer-events:none}
|
|
4147
|
-
.dsh-st-n-row:hover>.dsh-st-n-acts,.dsh-st-n-row:focus-within>.dsh-st-n-acts,.dsh-st-n-row.is-menu>.dsh-st-n-acts{opacity:1;visibility:visible;pointer-events:auto}
|
|
4148
4225
|
.dsh-st-n-dialog-actions{display:flex;justify-content:flex-end;gap:8px}
|
|
4149
4226
|
.dsh-st-n-dialog-copy{margin:0;color:var(--dsw-alias-label-secondary);font-size:14px;line-height:22px}
|
|
4150
4227
|
.dsh-st-n-dialog-status{margin-top:12px;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}
|
|
@@ -4725,10 +4802,7 @@ function apply(ctx) {
|
|
|
4725
4802
|
openSession: opener,
|
|
4726
4803
|
...isSessionSelector(props.useSessions) ? { useSessions: props.useSessions } : {},
|
|
4727
4804
|
...isWorkspaceSelector(props.useWorkspaces) ? { useWorkspaces: props.useWorkspaces } : {},
|
|
4728
|
-
...
|
|
4729
|
-
...typeof props.archiveSession === "function" ? { archiveSession: props.archiveSession } : {},
|
|
4730
|
-
...typeof props.deleteSession === "function" ? { deleteSession: props.deleteSession } : {},
|
|
4731
|
-
...typeof props.forkSession === "function" ? { forkSession: props.forkSession } : {},
|
|
4805
|
+
...scheduledListHostActions(props),
|
|
4732
4806
|
openTaskSettings
|
|
4733
4807
|
});
|
|
4734
4808
|
}
|
|
@@ -4845,17 +4919,18 @@ function apply(ctx) {
|
|
|
4845
4919
|
}
|
|
4846
4920
|
function createScheduledSessionOpener(ctx, runtime, hostOpen) {
|
|
4847
4921
|
return (sessionId) => {
|
|
4922
|
+
const access = resolveClientSessionOpenAccess(ctx);
|
|
4848
4923
|
void ensureOpenScheduledSession({
|
|
4849
4924
|
id: sessionId,
|
|
4850
4925
|
adopt: (id) => runtime.adoptSession(id),
|
|
4851
4926
|
listed: (id) => {
|
|
4852
4927
|
const snap = ctx.sessions?.list?.getSnapshot();
|
|
4853
|
-
return
|
|
4928
|
+
return (snap?.ids ?? []).includes(id) || snap?.byId?.[id] !== void 0;
|
|
4854
4929
|
},
|
|
4855
4930
|
...ctx.sessions?.refresh === void 0 ? {} : { refresh: () => ctx.sessions.refresh() },
|
|
4856
|
-
...
|
|
4857
|
-
|
|
4858
|
-
} },
|
|
4931
|
+
...canOpenClientSession(access) ? { openRuntime: (id) => {
|
|
4932
|
+
openClientSession(access, id);
|
|
4933
|
+
} } : {},
|
|
4859
4934
|
...hostOpen === void 0 ? {} : { openHost: hostOpen }
|
|
4860
4935
|
});
|
|
4861
4936
|
};
|