clideck 1.25.7 → 1.25.8
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/activity.js +3 -1
- package/package.json +1 -1
- package/telemetry-receiver.js +28 -2
- package/workplan.txt +41 -26
package/activity.js
CHANGED
|
@@ -56,6 +56,8 @@ function isActive(id) {
|
|
|
56
56
|
return s ? (Date.now() - s.lastOutAt < 2000) : false;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
function lastOutputAt(id) { return stream[id]?.lastOutAt || 0; }
|
|
60
|
+
|
|
59
61
|
function clear(id) { delete net[id]; delete stream[id]; }
|
|
60
62
|
|
|
61
|
-
module.exports = { start, stop, trackIn, trackOut, isActive, clear };
|
|
63
|
+
module.exports = { start, stop, trackIn, trackOut, isActive, lastOutputAt, clear };
|
package/package.json
CHANGED
package/telemetry-receiver.js
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
// CLI agents export telemetry events here; we capture agent session IDs
|
|
3
3
|
// (for resume) and detect whether telemetry is configured (setup prompts).
|
|
4
4
|
|
|
5
|
+
const ioActivity = require('./activity');
|
|
5
6
|
const activity = new Map(); // sessionId → has received events
|
|
6
7
|
const pendingSetup = new Map(); // sessionId → timer (waiting for first event)
|
|
8
|
+
const pendingIdle = new Map(); // sessionId → timer (api_request → confirm idle after output silence)
|
|
7
9
|
let broadcastFn = null;
|
|
8
10
|
let sessionsFn = null;
|
|
9
11
|
|
|
@@ -69,6 +71,8 @@ function handleLogs(req, res) {
|
|
|
69
71
|
const attrs = parseAttrs(lr.attributes);
|
|
70
72
|
|
|
71
73
|
const eventName = attrs['event.name'];
|
|
74
|
+
// Debug telemetry logs — uncomment as needed, do not delete
|
|
75
|
+
// if (serviceName === 'claude-code' && eventName) console.log(`[telemetry:claude] ${eventName}`);
|
|
72
76
|
// if (serviceName === 'codex_cli_rs' && eventName) console.log(`[telemetry:codex] ${eventName}`);
|
|
73
77
|
// if (serviceName === 'gemini-cli' && eventName) console.log(`[telemetry:gemini] ${eventName}`);
|
|
74
78
|
|
|
@@ -77,11 +81,12 @@ function handleLogs(req, res) {
|
|
|
77
81
|
if (startEvents.has(eventName)) {
|
|
78
82
|
broadcastFn?.({ type: 'session.status', id: resolvedId, working: true, source: 'telemetry' });
|
|
79
83
|
}
|
|
80
|
-
// Claude: telemetry-only status.
|
|
84
|
+
// Claude: telemetry-only status. api_request → pending idle (confirm after 1s output silence, expire after 6s).
|
|
81
85
|
if (serviceName === 'claude-code' && eventName) {
|
|
82
86
|
if (eventName === 'api_request') {
|
|
83
|
-
|
|
87
|
+
startPendingIdle(resolvedId);
|
|
84
88
|
} else if (eventName !== 'user_prompt') {
|
|
89
|
+
cancelPendingIdle(resolvedId);
|
|
85
90
|
broadcastFn?.({ type: 'session.status', id: resolvedId, working: true, source: 'telemetry' });
|
|
86
91
|
}
|
|
87
92
|
}
|
|
@@ -142,8 +147,29 @@ function cancelPendingSetup(sessionId) {
|
|
|
142
147
|
}
|
|
143
148
|
}
|
|
144
149
|
|
|
150
|
+
// Pending idle: api_request starts a check loop. Confirm idle after 1s of output silence. Expire after 6s.
|
|
151
|
+
function startPendingIdle(id) {
|
|
152
|
+
cancelPendingIdle(id);
|
|
153
|
+
const started = Date.now();
|
|
154
|
+
const check = setInterval(() => {
|
|
155
|
+
const elapsed = Date.now() - started;
|
|
156
|
+
if (elapsed > 6000) { cancelPendingIdle(id); return; }
|
|
157
|
+
if (Date.now() - Math.max(started, ioActivity.lastOutputAt(id)) >= 1000) {
|
|
158
|
+
cancelPendingIdle(id);
|
|
159
|
+
broadcastFn?.({ type: 'session.status', id, working: false, source: 'telemetry' });
|
|
160
|
+
}
|
|
161
|
+
}, 250);
|
|
162
|
+
pendingIdle.set(id, check);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function cancelPendingIdle(id) {
|
|
166
|
+
const timer = pendingIdle.get(id);
|
|
167
|
+
if (timer) { clearInterval(timer); pendingIdle.delete(id); }
|
|
168
|
+
}
|
|
169
|
+
|
|
145
170
|
function clear(id) {
|
|
146
171
|
activity.delete(id);
|
|
172
|
+
cancelPendingIdle(id);
|
|
147
173
|
const pending = pendingSetup.get(id);
|
|
148
174
|
if (pending) { clearTimeout(pending.timer); pendingSetup.delete(id); }
|
|
149
175
|
}
|
package/workplan.txt
CHANGED
|
@@ -1,28 +1,43 @@
|
|
|
1
|
-
CliDeck —
|
|
1
|
+
CliDeck — Work Plan
|
|
2
2
|
======================
|
|
3
3
|
|
|
4
|
-
## Structured menu events
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
4
|
+
## Structured menu events — DONE
|
|
5
|
+
|
|
6
|
+
Moved interactive menu detection from mobile-side parsing to CliDeck desktop.
|
|
7
|
+
Menus detected server-side, broadcast as structured data, rendered on both desktop and mobile.
|
|
8
|
+
|
|
9
|
+
Implementation:
|
|
10
|
+
- transcript.js: detectMenu(lines, presetId) — walks upward from footer/esc anchor,
|
|
11
|
+
collects sequential numbered choices, requires agent-specific marker (❯/›/●) on at least one line.
|
|
12
|
+
Handles footerless Gemini menus via (esc) in choice text.
|
|
13
|
+
- handlers.js: after terminal.buffer capture, runs detectMenu, broadcasts session.menu
|
|
14
|
+
with structured choices. Forces idle when menu detected. Deduplicates via _menuKey on session.
|
|
15
|
+
- sessions.js: list() includes menu state for daemon reconnect.
|
|
16
|
+
- daemon.js: forwards session.menu to mobile, caches per-session menu state,
|
|
17
|
+
sends on subscribe, clears on working status.
|
|
18
|
+
- mobile index.html: renderMenu(choices) replaces 28-line updateChoices parser.
|
|
19
|
+
Menu state comes from session.menu event, no local parsing.
|
|
20
|
+
|
|
21
|
+
## Pending idle for Claude — DONE
|
|
22
|
+
|
|
23
|
+
Claude's api_request no longer flips to idle immediately. Instead:
|
|
24
|
+
- api_request → starts pending idle window (polls every 250ms)
|
|
25
|
+
- Confirm idle: 1s of no PTY output (measured from max(started, lastOutputAt))
|
|
26
|
+
- Cancel: any new telemetry event, or 6s timeout
|
|
27
|
+
- activity.js: exposes lastOutputAt(id) — timestamp of last PTY output per session
|
|
28
|
+
- telemetry-receiver.js: startPendingIdle/cancelPendingIdle manage the window
|
|
29
|
+
|
|
30
|
+
Why: api_request fires between tool calls mid-work, not just at end-of-turn.
|
|
31
|
+
Immediate idle caused false status flickers. The 1s output silence confirms
|
|
32
|
+
the agent is truly waiting for user input.
|
|
33
|
+
|
|
34
|
+
## Future: desktop sidebar menu preview
|
|
35
|
+
|
|
36
|
+
Show "please make a choice" or choice labels in the desktop session list
|
|
37
|
+
when a menu is active. Infrastructure is ready (session.menu broadcast exists).
|
|
38
|
+
|
|
39
|
+
## Future: OpenCode menu support
|
|
40
|
+
|
|
41
|
+
OpenCode not yet in MENU_MARKERS. Need to determine:
|
|
42
|
+
- Does OpenCode expose menu events via bridge plugin API?
|
|
43
|
+
- If not, what marker character does OpenCode use for interactive menus?
|