@michengai/dsh-automation 0.1.25 → 0.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (19) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/CHANGELOG.zh-CN.md +8 -0
  3. package/lib/client.js +45 -7
  4. package/lib/client.js.map +2 -2
  5. package/lib/index.js +250 -246
  6. package/lib/types/client/runtime.d.ts +3 -0
  7. package/lib/types/client/schedule-rail-model.d.ts +6 -2
  8. package/lib/types/executor.d.ts +7 -1
  9. package/package.json +16 -16
  10. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/00-/351/230/205/350/257/273/345/257/274/350/210/252.md +0 -11
  11. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/01-/351/241/271/347/233/256/346/246/202/350/247/210.md +0 -22
  12. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/02-/345/275/223/345/211/215/347/212/266/346/200/201.md +0 -9
  13. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/03-/345/276/205/345/212/236/344/270/216/351/230/273/345/241/236.md +0 -7
  14. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/04-/350/277/255/344/273/243/350/267/257/347/272/277/345/233/276.md +0 -5
  15. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/05-/346/212/200/346/234/257/346/236/266/346/236/204/345/237/272/347/272/277.md +0 -10
  16. package/docs/00-/344/272/244/346/216/245/345/205/245/345/217/243/06-/346/226/207/346/241/243/347/274/226/345/206/231/350/247/204/350/214/203.md +0 -8
  17. package/docs/01-/345/275/223/345/211/215/345/267/245/344/275/234/I001-/344/273/273/345/212/241/350/207/252/345/212/250/345/214/226/346/217/222/344/273/266/00-/350/277/255/344/273/243/346/200/273/350/247/210.md +0 -56
  18. package/docs/03-/346/212/200/346/234/257/346/236/266/346/236/204/00-/351/242/206/345/237/237/347/264/242/345/274/225.md +0 -5
  19. package/docs/03-/346/212/200/346/234/257/346/236/266/346/236/204/01-/350/260/203/345/272/246/344/270/216/346/211/247/350/241/214/346/250/241/345/236/213.md +0 -30
package/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@
4
4
 
5
5
  The five most recent published versions are listed below. Git tags and GitHub Releases now mirror these entries; historical sections retain links to their original release commits.
6
6
 
7
+ ## 0.1.27 — 2026-09-03
8
+
9
+ - Fixed the scheduled execution-record list staying empty after a run until the sidebar was switched several times. New runs now stay visible even when the Host session index has not caught up yet, the snapshot refreshes immediately when the open session is a scheduled run, and polling speeds up while a run is queued or running.
10
+
11
+ ## 0.1.26 — 2026-09-03
12
+
13
+ - Added compatibility with DeepSeek Harness `0.1.2-rc.1`, keeping scheduled automations responsive to session events in current Hosts.
14
+
7
15
  ## 0.1.25 — 2026-09-03
8
16
 
9
17
  - Fixed scheduled-task select menus so their backgrounds, borders, shadows, and hover states follow the DSH theme. Time options now remain readable in light mode.
@@ -4,6 +4,14 @@
4
4
 
5
5
  以下记录最近发布的五个版本。Git 标签与 GitHub Release 现已和这些条目同步;历史条目继续保留原始发布提交链接。
6
6
 
7
+ ## 0.1.27 — 2026-09-03
8
+
9
+ - 修复定时任务已经执行、但侧栏执行记录要多次切换后才出现的问题。宿主会话簿尚未收录时仍显示新记录,当前打开的若是定时会话会立即刷新快照,排队或执行中时加快轮询。
10
+
11
+ ## 0.1.26 — 2026-09-03
12
+
13
+ - 支持 DeepSeek Harness `0.1.2-rc.1`,确保定时自动化在新版 DSH 中继续响应会话事件。
14
+
7
15
  ## 0.1.25 — 2026-09-03
8
16
 
9
17
  - 修复定时任务下拉菜单的背景、边框、阴影和悬停态未跟随 DSH 主题的问题,浅色模式下的时间选项恢复清晰可读。
package/lib/client.js CHANGED
@@ -1373,7 +1373,11 @@ function unwrapRpcResult(value) {
1373
1373
 
1374
1374
  // src/client/runtime.ts
1375
1375
  var CHANNEL = "/dsh-automation";
1376
- var POLL_INTERVAL_MS = 15e3;
1376
+ var IDLE_POLL_INTERVAL_MS = 15e3;
1377
+ var ACTIVE_POLL_INTERVAL_MS = 2e3;
1378
+ function snapshotPollIntervalMs(runs) {
1379
+ return (runs ?? []).some((run) => run.status === "running" || run.status === "queued") ? ACTIVE_POLL_INTERVAL_MS : IDLE_POLL_INTERVAL_MS;
1380
+ }
1377
1381
  function isTransportError(error) {
1378
1382
  const message = error instanceof Error ? error.message : String(error);
1379
1383
  return /failed to fetch|networkerror|load failed|network request failed/i.test(message);
@@ -1383,8 +1387,20 @@ function createAutomationRuntime(rpc) {
1383
1387
  let refreshPromise;
1384
1388
  let pollTimer;
1385
1389
  const listeners2 = /* @__PURE__ */ new Set();
1390
+ const armPoll = () => {
1391
+ if (pollTimer !== void 0) clearInterval(pollTimer);
1392
+ if (listeners2.size === 0) {
1393
+ pollTimer = void 0;
1394
+ return;
1395
+ }
1396
+ pollTimer = setInterval(() => {
1397
+ void refresh().catch(() => void 0);
1398
+ }, snapshotPollIntervalMs(state.snapshot?.runs));
1399
+ };
1386
1400
  const publish = (next) => {
1401
+ const previousInterval = snapshotPollIntervalMs(state.snapshot?.runs);
1387
1402
  state = next;
1403
+ if (listeners2.size > 0 && previousInterval !== snapshotPollIntervalMs(state.snapshot?.runs)) armPoll();
1388
1404
  for (const listener of [...listeners2]) listener();
1389
1405
  };
1390
1406
  const source = {
@@ -1395,9 +1411,7 @@ function createAutomationRuntime(rpc) {
1395
1411
  queueMicrotask(() => {
1396
1412
  if (listeners2.size > 0) void refresh().catch(() => void 0);
1397
1413
  });
1398
- pollTimer = setInterval(() => {
1399
- void refresh().catch(() => void 0);
1400
- }, POLL_INTERVAL_MS);
1414
+ armPoll();
1401
1415
  }
1402
1416
  return () => {
1403
1417
  listeners2.delete(listener);
@@ -2656,11 +2670,15 @@ function deriveTaskOverviewRows(automations, runs) {
2656
2670
  };
2657
2671
  });
2658
2672
  }
2659
- function keepScheduledSessionLink(sessionId, archived, presentIds) {
2673
+ function keepScheduledSessionLink(sessionId, archived, _presentIds) {
2660
2674
  if (sessionId === void 0 || sessionId === "") return false;
2661
2675
  if (archived.has(sessionId)) return false;
2662
- if (presentIds === void 0) return true;
2663
- return presentIds.has(sessionId);
2676
+ return true;
2677
+ }
2678
+ function scheduledSessionNeedsSnapshotRefresh(sessionId, runs) {
2679
+ if (sessionId === void 0 || sessionId === null || sessionId === "") return false;
2680
+ if (!sessionId.startsWith(AUTOMATION_SESSION_PREFIX)) return false;
2681
+ return !(runs ?? []).some((run) => run.sessionId === sessionId);
2664
2682
  }
2665
2683
  function collectScheduledSessionIds(runs) {
2666
2684
  const ids = /* @__PURE__ */ new Set();
@@ -3104,6 +3122,7 @@ function NativeScheduleSessionList(props) {
3104
3122
  const [sort, setSort] = (0, import_react9.useState)("time");
3105
3123
  const [groupMode, setGroupMode] = (0, import_react9.useState)("workspace");
3106
3124
  const [view, setView] = (0, import_react9.useState)("runs");
3125
+ const snapshotRefreshFor = (0, import_react9.useRef)(null);
3107
3126
  const archived = (0, import_react9.useMemo)(() => new Set(archivedIds), [archivedIds]);
3108
3127
  const listedIds = useSessions ? useSessions((snap) => Array.isArray(snap.ids) ? snap.ids : void 0) : void 0;
3109
3128
  const presentIds = (0, import_react9.useMemo)(() => {
@@ -3127,6 +3146,15 @@ function NativeScheduleSessionList(props) {
3127
3146
  })
3128
3147
  })).filter((group) => group.sessions.length > 0);
3129
3148
  }, [archived, presentIds, sessionById, state.snapshot]);
3149
+ (0, import_react9.useEffect)(() => {
3150
+ if (!scheduledSessionNeedsSnapshotRefresh(selectedId, state.snapshot?.runs)) {
3151
+ snapshotRefreshFor.current = null;
3152
+ return;
3153
+ }
3154
+ if (snapshotRefreshFor.current === selectedId) return;
3155
+ snapshotRefreshFor.current = selectedId;
3156
+ void runtime.refresh().catch(() => void 0);
3157
+ }, [runtime, selectedId, state.snapshot?.runs]);
3130
3158
  const visibleGroups = (0, import_react9.useMemo)(() => applyWorkspaceBrowserQuery(groups.map((group) => ({ ...group, name: group.name })), query, sort, groupMode), [groups, query, sort, groupMode]);
3131
3159
  (0, import_react9.useEffect)(() => {
3132
3160
  if (typeof document === "undefined" || typeof MutationObserver === "undefined") return;
@@ -3581,6 +3609,16 @@ function NativeScheduleShell({
3581
3609
  const currentId = useSessions?.((state) => state?.current ?? null);
3582
3610
  const automationState = (0, import_react10.useSyncExternalStore)(runtime.source.subscribe, runtime.source.getSnapshot, runtime.source.getSnapshot);
3583
3611
  const scheduledIds = (0, import_react10.useMemo)(() => collectScheduledSessionIds(automationState.snapshot?.runs), [automationState.snapshot]);
3612
+ const snapshotRefreshFor = (0, import_react10.useRef)(null);
3613
+ (0, import_react10.useEffect)(() => {
3614
+ if (!scheduledSessionNeedsSnapshotRefresh(currentId, automationState.snapshot?.runs)) {
3615
+ snapshotRefreshFor.current = null;
3616
+ return;
3617
+ }
3618
+ if (snapshotRefreshFor.current === currentId) return;
3619
+ snapshotRefreshFor.current = currentId ?? null;
3620
+ void runtime.refresh().catch(() => void 0);
3621
+ }, [automationState.snapshot?.runs, currentId, runtime]);
3584
3622
  const useFilteredSessions = (0, import_react10.useCallback)((selector, eq) => {
3585
3623
  if (useSessions === void 0) return selector({ ids: [], byId: {}, current: null });
3586
3624
  return useSessions((state) => selector(filterTaskSessionState(state, scheduledIds)), eq);