@johnnren/dsh-zen 1.0.0 → 1.0.1
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/lib/client.js +19 -24
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -333,29 +333,6 @@ function createTracker(ctx) {
|
|
|
333
333
|
}
|
|
334
334
|
store.set({ sessions: kept });
|
|
335
335
|
}
|
|
336
|
-
function ensureSession(sessionId, title, running) {
|
|
337
|
-
store.update((prev) => {
|
|
338
|
-
if (prev.sessions[sessionId]) {
|
|
339
|
-
const existing = prev.sessions[sessionId];
|
|
340
|
-
if (existing.sessionEndMs === null && !running) {
|
|
341
|
-
return { sessions: { ...prev.sessions, [sessionId]: { ...existing, title, sessionEndMs: Date.now() } } };
|
|
342
|
-
}
|
|
343
|
-
if (existing.sessionEndMs !== null && running) {
|
|
344
|
-
return { sessions: { ...prev.sessions, [sessionId]: { ...existing, title, sessionEndMs: null } } };
|
|
345
|
-
}
|
|
346
|
-
if (existing.title !== title) {
|
|
347
|
-
return { sessions: { ...prev.sessions, [sessionId]: { ...existing, title } } };
|
|
348
|
-
}
|
|
349
|
-
return prev;
|
|
350
|
-
}
|
|
351
|
-
return {
|
|
352
|
-
sessions: {
|
|
353
|
-
...prev.sessions,
|
|
354
|
-
[sessionId]: { foregroundMs: 0, runningMs: 0, sessionStartMs: Date.now(), sessionEndMs: running ? null : Date.now(), title, days: {} }
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
336
|
function reevaluate() {
|
|
360
337
|
const isZenTabActive = typeof document !== "undefined" && document.querySelector(".dsh-zen-root") !== null;
|
|
361
338
|
const isWindowVisible = !isZenTabActive && typeof document !== "undefined" && !document.hidden;
|
|
@@ -363,9 +340,27 @@ function createTracker(ctx) {
|
|
|
363
340
|
const currentId = listSnap.current ?? null;
|
|
364
341
|
const currentSession = currentId ? listSnap.byId[currentId] : null;
|
|
365
342
|
const isRunning = (currentSession?.running ?? false) && !currentSession?.pendingInteraction;
|
|
343
|
+
let next = state;
|
|
366
344
|
for (const [id, summary] of Object.entries(listSnap.byId)) {
|
|
367
|
-
|
|
345
|
+
const title = summary.displayTitle;
|
|
346
|
+
const existing = next.sessions[id];
|
|
347
|
+
if (!existing) {
|
|
348
|
+
next = { sessions: { ...next.sessions, [id]: { foregroundMs: 0, runningMs: 0, sessionStartMs: Date.now(), sessionEndMs: summary.running ? null : Date.now(), title, days: {} } } };
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
351
|
+
if (existing.sessionEndMs === null && !summary.running) {
|
|
352
|
+
next = { sessions: { ...next.sessions, [id]: { ...existing, title, sessionEndMs: Date.now() } } };
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
if (existing.sessionEndMs !== null && summary.running) {
|
|
356
|
+
next = { sessions: { ...next.sessions, [id]: { ...existing, title, sessionEndMs: null } } };
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
if (existing.title !== title) {
|
|
360
|
+
next = { sessions: { ...next.sessions, [id]: { ...existing, title } } };
|
|
361
|
+
}
|
|
368
362
|
}
|
|
363
|
+
if (next !== state) store.set(next);
|
|
369
364
|
if (currentId !== activeSessionId) {
|
|
370
365
|
if (activeSessionId !== null) flush(activeSessionId, runSegStart, fgSegStart);
|
|
371
366
|
activeSessionId = currentId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnnren/dsh-zen",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Zen Mode view tab + foreground time tracker for DeepSeek Harness: a calm minimal surface (status message, latest user message, live activity hints, markdown AI reply, one-line turn stats) while the agent works, with screen-watching time tracking, daily/weekly Zen scores, a chat-hide toggle, auto enter/exit and an Alt+Z shortcut — pure client-side, no network. dsh-zen 禅模式插件:智能体后台运行时提供极简的 Zen 视图标签页(状态文案、用户消息、动态提示、Markdown 最终回复、单行轮次统计),并统计前台盯屏时长、给出每日/每周禅值,支持隐藏中间过程、自动进出禅与 Alt+Z 快捷键——纯前端、无网络请求。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|