claude-code-session-manager 0.133.0 → 0.134.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/assets/AgentLibrary-C9KFGJQq.js +2 -0
- package/dist/assets/{AppSettings-BHKM_AKh.js → AppSettings-CvVQ6ot5.js} +2 -2
- package/dist/assets/{Button-CmO1wmPw.js → Button-BHvploNk.js} +1 -1
- package/dist/assets/DocumentEditorPane-DaX4xag_.js +1 -0
- package/dist/assets/{Extensions-Boo21B3b.js → Extensions-DbRY-KEz.js} +2 -2
- package/dist/assets/{History-C4epd1hp.js → History-BE_mjM24.js} +2 -2
- package/dist/assets/{Library-CrgzRQzL.js → Library-I37dQ6pB.js} +1 -1
- package/dist/assets/{ListDetail-DA7y1DQ-.js → ListDetail-DJYMWYQd.js} +1 -1
- package/dist/assets/{Panel-D-WMBhKH.js → Panel-DP8eSKSs.js} +1 -1
- package/dist/assets/{ProjectClaudeConfig-CuUADpIu.js → ProjectClaudeConfig-Cw8lc3Qi.js} +5 -5
- package/dist/assets/{ProvenanceBadge-B7AsoRk6.js → ProvenanceBadge-DUwhsmdA.js} +1 -1
- package/dist/assets/Scheduler-B9D2gZqs.js +16 -0
- package/dist/assets/Settings-DSk7bn-1.js +2 -0
- package/dist/assets/{SkillReferenceGraph-DX4ZgvlY.js → SkillReferenceGraph-DtJcJJHR.js} +1 -1
- package/dist/assets/{Skills-DqKI37yi.js → Skills-BPZnSjsB.js} +10 -10
- package/dist/assets/{SourceChip-C974LROr.js → SourceChip-DUxulNOp.js} +1 -1
- package/dist/assets/{SystemPrompt-C502jIwO.js → SystemPrompt-BXAugVle.js} +1 -1
- package/dist/assets/{TiptapBody-DwNXN6Ki.js → TiptapBody-CDC1vrOo.js} +28 -28
- package/dist/assets/{Toggle-C2OsxnPK.js → Toggle-CrgM7OTR.js} +1 -1
- package/dist/assets/{ViewTabs-DBxKGbAK.js → ViewTabs-DLwaU9RB.js} +1 -1
- package/dist/assets/{VoiceButton-C680wpmX.js → VoiceButton-C4hIBxIP.js} +1 -1
- package/dist/assets/geist-sans-latin-300-normal-C3kkMBb6.woff2 +0 -0
- package/dist/assets/geist-sans-latin-400-normal-gapTbOY8.woff2 +0 -0
- package/dist/assets/geist-sans-latin-500-normal-uokXdC-Q.woff2 +0 -0
- package/dist/assets/geist-sans-latin-600-normal-DFOURf8L.woff2 +0 -0
- package/dist/assets/geist-sans-latin-700-normal-BmN9tIp5.woff2 +0 -0
- package/dist/assets/{historyTotals-Cz-VYPEc.js → historyTotals-itA00dXm.js} +1 -1
- package/dist/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
- package/dist/assets/{index-CMwAikUb.css → index-Cjt8B7H9.css} +1 -1
- package/dist/assets/index-Cznhnxhq.js +3116 -0
- package/dist/assets/newsreader-latin-400-italic-CEihAR-f.woff2 +0 -0
- package/dist/assets/newsreader-latin-400-normal-BFBkh4jY.woff2 +0 -0
- package/dist/assets/newsreader-latin-500-normal-B66TYsaK.woff2 +0 -0
- package/dist/assets/newsreader-latin-600-normal-30OJ_TG_.woff2 +0 -0
- package/dist/assets/newsreader-latin-700-normal-rIgV_oaK.woff2 +0 -0
- package/dist/index.html +2 -5
- package/dist-web/app.css +1 -1
- package/dist-web/app.js +413 -408
- package/dist-web/index.html +0 -3
- package/package.json +4 -2
- package/scripts/README.md +1 -0
- package/scripts/scheduler-mcp-server.cjs +31 -0
- package/src/main/agentLibrary.cjs +27 -4
- package/src/main/build-info.json +4 -4
- package/src/main/chatRunner.cjs +9 -0
- package/src/main/config.cjs +22 -0
- package/src/main/crashDiagnostics.cjs +10 -2
- package/src/main/index.cjs +34 -25
- package/src/main/ipcSchemas.cjs +6 -0
- package/src/main/lib/agent-cli/agentCliEvents.cjs +8 -0
- package/src/main/lib/demo-video-kit/capture.cjs +4 -37
- package/src/main/lib/demo-video-kit/character.cjs +20 -2
- package/src/main/lib/demo-video-kit/checks.cjs +82 -1
- package/src/main/lib/demo-video-kit/frames.cjs +3 -28
- package/src/main/lib/demo-video-kit/playwrightLoader.cjs +67 -0
- package/src/main/lib/demo-video-kit/seedKit.cjs +2 -2
- package/src/main/lib/demo-video-kit/sound.cjs +5 -2
- package/src/main/lib/epic/epicMint.cjs +1 -3
- package/src/main/lib/epic/promptSessionsCreateEpic.cjs +37 -4
- package/src/main/lib/epic/restorableSessions.cjs +88 -0
- package/src/main/lib/feedback-remote/customerFeedbackAdminRoutes.cjs +56 -1
- package/src/main/lib/feedback-remote/customerFeedbackIpc.cjs +21 -3
- package/src/main/lib/feedback-remote/remoteAssets.cjs +25 -1
- package/src/main/lib/mcpToolCatalog.cjs +15 -0
- package/src/main/lib/persona-macro/agentPersonaSchema.cjs +10 -1
- package/src/main/lib/persona-macro/builtinMacros.cjs +3 -2
- package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
- package/src/main/lib/prd/listPrdsSingleFlight.cjs +79 -0
- package/src/main/lib/prd/prdAgentType.cjs +17 -7
- package/src/main/lib/telemetry/crashTelemetry.cjs +10 -5
- package/src/main/lib/telemetry/telemetryBoot.cjs +77 -4
- package/src/main/lib/telemetry/telemetryClient.cjs +54 -9
- package/src/main/lib/telemetry/telemetryConsent.cjs +3 -0
- package/src/main/lib/telemetry/telemetryCounters.cjs +7 -2
- package/src/main/lib/telemetry/telemetrySettings.cjs +5 -0
- package/src/main/pty.cjs +2 -2
- package/src/main/scheduler/prdParser.cjs +1 -1
- package/src/main/scheduler.cjs +19 -3
- package/src/main/seedAgentPersonas.cjs +24 -0
- package/src/main/seedStatus.cjs +5 -2
- package/src/main/telemetryIpc.cjs +1 -5
- package/src/preload/api.d.ts +29 -14
- package/src/preload/apiSurface.json +7 -0
- package/src/preload/index.cjs +3 -1
- package/src/seed/agents/demo-video-builder.md +7 -2
- package/dist/assets/AgentLibrary-DOAG-mcG.js +0 -2
- package/dist/assets/DocumentEditorPane-8QMNrNRt.js +0 -1
- package/dist/assets/Scheduler-C86gRh51.js +0 -16
- package/dist/assets/Settings-B4Q9DwVS.js +0 -2
- package/dist/assets/index-Dh5geJe3.js +0 -3111
- package/src/main/lib/telemetry/telemetryBacklog.cjs +0 -607
|
@@ -51,7 +51,7 @@ const BUILTIN_MACROS = Object.freeze([
|
|
|
51
51
|
tag: 'project-home-builder',
|
|
52
52
|
surface: 'project-home',
|
|
53
53
|
projects: ['*'],
|
|
54
|
-
builtinVersion:
|
|
54
|
+
builtinVersion: 8,
|
|
55
55
|
job: Object.freeze({
|
|
56
56
|
estimateMinutes: 60,
|
|
57
57
|
entryKind: 'video',
|
|
@@ -64,9 +64,10 @@ const BUILTIN_MACROS = Object.freeze([
|
|
|
64
64
|
"Generate a character and cute animated JavaScript video: a 30-second demo of this project as one self-contained HTML/JavaScript animation. Ground everything in what you read in the repository — invent an original mascot character whose look, name and personality match the project's theme and purpose, and tell the project's real goals and key features through it. The character, story and visuals must match the project's theme and purpose as read from the repository. Write the narration script first (hook, problem, solution, three features, call to action), then build every scene to match its line, with fun dynamic elements per the persona. Use the style named on a 'Video style: <name>' line in the additional instructions — Professional, Fun, Animated whiteboard, or Kinetic typography — otherwise pick the one that best fits the project. Narrate with Kokoro (kokoro-onnx) using a natural female (af_heart) or male (am_michael) voice per the audio policy in the persona. Save it with a single project_demo_video_write call passing htmlPath.",
|
|
65
65
|
"Generate a character and cute animated JavaScript video: a demo of this project as one self-contained HTML/JavaScript animation, 60 seconds long when the additional instructions carry a 'Video length: 60' line and 30 seconds otherwise. Ground everything in what you read in the repository — invent an original mascot character whose look, name and personality match the project's theme and purpose, and tell the project's real goals and key features through it. The character, story and visuals must match the project's theme and purpose as read from the repository. Write the narration script first (hook, problem, solution, key features, call to action), then build every keystone to match its lines, with the pacing and fun dynamic elements per the persona. Use the style named on a 'Video style: <name>' line in the additional instructions — Professional, Fun, Animated whiteboard, or Kinetic typography — otherwise pick the one that best fits the project. Narrate with Kokoro (kokoro-onnx) using a natural female (af_heart) or male (am_michael) voice per the audio policy in the persona. Save it with a single project_demo_video_write call passing htmlPath.",
|
|
66
66
|
"Generate a character and cute animated JavaScript video as one self-contained HTML/JavaScript animation, 60 seconds long when the additional instructions carry a 'Video length: 60' line and 30 seconds otherwise. The video kind is named on a 'Video kind: <name>' line in the additional instructions: Blog post (a video that presents the blog post named on the 'Video target:' line — a post path in this repository or a URL; read it and tell its real content) or Feature (a video about the feature named on the 'Video target:' line, found in the repository); with no Video kind line, make a Project demo of the whole project's main goals and key features. Ground everything in what you read in the repository (and the target) — invent an original mascot character whose look, name and personality match the subject's theme and purpose, and tell its real story through it. Write the narration script first (hook, problem, solution, key points, call to action), then build every keystone to match its lines, with the pacing and fun dynamic elements per the persona. Use the style named on a 'Video style: <name>' line in the additional instructions — Professional, Fun, Animated whiteboard, or Kinetic typography — otherwise pick the one that best fits. Narrate with Kokoro (kokoro-onnx) using a natural female (af_heart) or male (am_michael) voice per the audio policy in the persona. Save it with a single project_video_write call passing the htmlPath and the id on the 'Entry id' line.",
|
|
67
|
+
"Generate a character and cute animated JavaScript video as one self-contained HTML/JavaScript animation, 60 seconds long when the additional instructions carry a 'Video length: 60' line and 30 seconds otherwise; a 'Video length: 30' line means 30 seconds. The video kind is named on a 'Video kind: <name>' line in the additional instructions: Blog post (a video that presents the blog post named on the 'Video target:' line — a post path in this repository or a URL; read it and tell its real content) or Feature (a video about the feature named on the 'Video target:' line, found in the repository); with no Video kind line, make a Project demo of the whole project's main goals and key features. A 'Video kind: Project demo' line means that same whole-project demo. Ground everything in what you read in the repository (and the target) — invent an original mascot character whose look, name and personality match the subject's theme and purpose, and tell its real story through it. A 'Character: off' line means no mascot: make a type-led animation in the chosen style that tells the same real story through moving type and shapes, skip the character wherever the persona uses one (design, _character, project_character_write, lip-sync, the character self-check) and save meta.character as null; a 'Character: on' line or no Character line keeps the mascot. Write the narration script first (hook, problem, solution, key points, call to action), then build every keystone to match its lines, with the pacing and fun dynamic elements per the persona. Use the style named on a 'Video style: <name>' line in the additional instructions — Professional, Fun, Animated whiteboard, or Kinetic typography — otherwise pick the one that best fits. A 'Video style: Auto' line means the same: pick the style that best fits. Narrate with Kokoro (kokoro-onnx) using a natural female (af_heart) or male (am_michael) voice per the audio policy in the persona. Save it with a single project_video_write call passing the htmlPath and the id on the 'Entry id' line.",
|
|
67
68
|
]),
|
|
68
69
|
prompt:
|
|
69
|
-
"Generate a
|
|
70
|
+
"Generate a cute animated JavaScript video with an original mascot character unless a Character: off line says otherwise, as one self-contained HTML/JavaScript animation, 60 seconds long when the additional instructions carry a 'Video length: 60' line and 30 seconds otherwise; a 'Video length: 30' line means 30 seconds. The video kind is named on a 'Video kind: <name>' line in the additional instructions: Blog post (a video that presents the blog post named on the 'Video target:' line — a post path in this repository or a URL; read it and tell its real content) or Feature (a video about the feature named on the 'Video target:' line, found in the repository); with no Video kind line, make a Project demo of the whole project's main goals and key features. A 'Video kind: Project demo' line means that same whole-project demo. Ground everything in what you read in the repository (and the target) — invent an original mascot character whose look, name and personality match the subject's theme and purpose, and tell its real story through it. A 'Character: off' line means no mascot: make a type-led animation in the chosen style that tells the same real story through moving type and shapes, skip the character wherever the persona uses one (design, _character, project_character_write, lip-sync, the character self-check) and save meta.character as null; a 'Character: on' line or no Character line keeps the mascot. Write the narration script first (hook, problem, solution, key points, call to action), then build every keystone to match its lines, with the pacing and fun dynamic elements per the persona. Use the style named on a 'Video style: <name>' line in the additional instructions — Professional, Fun, Animated whiteboard, or Kinetic typography — otherwise pick the one that best fits. A 'Video style: Auto' line means the same: pick the style that best fits. Narrate with Kokoro (kokoro-onnx) using a natural female (af_heart) or male (am_michael) voice per the audio policy in the persona. Save it with a single project_video_write call passing the htmlPath and the id on the 'Entry id' line.",
|
|
70
71
|
}),
|
|
71
72
|
Object.freeze({
|
|
72
73
|
id: 'builtin-review-md-network',
|
|
@@ -499,6 +499,17 @@ const SHIPPED_PERSONA_SEEDS = deepFreeze({
|
|
|
499
499
|
effort: "max",
|
|
500
500
|
},
|
|
501
501
|
},
|
|
502
|
+
{
|
|
503
|
+
commit: "persona-stop-on-kit-failure",
|
|
504
|
+
bodySha256: "a7c0865ff50d55941a559dbae2d4e066545641e5925d7e68784002c39638ce5b",
|
|
505
|
+
fm: {
|
|
506
|
+
description: "30-second or 1-minute self-contained HTML/JS demo video for Project Home, saved via project_video_write.",
|
|
507
|
+
tools: "Read, Grep, Glob, Bash, Write, Edit, mcp__session-manager-scheduler__project_demo_video_write, mcp__session-manager-scheduler__project_video_write, mcp__session-manager-scheduler__project_character_write",
|
|
508
|
+
title: "Project Home — Demo Video",
|
|
509
|
+
model: "opus",
|
|
510
|
+
effort: "max",
|
|
511
|
+
},
|
|
512
|
+
},
|
|
502
513
|
],
|
|
503
514
|
"blender-artist": [
|
|
504
515
|
{
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* listPrdsSingleFlight.cjs — single-flight wrapper + string flattening for
|
|
3
|
+
* scheduler.cjs's listPrdsInternal() (PRD 3063).
|
|
4
|
+
*
|
|
5
|
+
* Why: the 2026-11-08 main-process heap snapshot held ~21 overlapping
|
|
6
|
+
* machine-wide `schedule:list-prds` scans at once; 1.62 GB of the 1.75 GB
|
|
7
|
+
* live heap was PRD file text kept alive by V8 sliced strings (title,
|
|
8
|
+
* dependsOn, ...) that each scan's entries pointed into. Two fixes live here:
|
|
9
|
+
*
|
|
10
|
+
* - createSingleFlight(fn, keyOf): concurrent calls with the same key share
|
|
11
|
+
* ONE in-flight promise; the slot clears when it settles (resolve OR
|
|
12
|
+
* reject), so the next call starts a fresh scan / retries a failure.
|
|
13
|
+
* - flatString / flattenPrdEntry: copy every string that came from file text
|
|
14
|
+
* into a fresh flat string, so an entry never retains the parsed file.
|
|
15
|
+
*
|
|
16
|
+
* Pure — no fs, no electron — so it is unit-testable under vitest.
|
|
17
|
+
*/
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
const MACHINE_WIDE_KEY = '*';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @param {(arg: any) => Promise<any>} fn
|
|
24
|
+
* @param {(arg: any) => string} keyOf
|
|
25
|
+
*/
|
|
26
|
+
function createSingleFlight(fn, keyOf) {
|
|
27
|
+
const inFlight = new Map();
|
|
28
|
+
function shared(arg) {
|
|
29
|
+
const key = keyOf(arg);
|
|
30
|
+
const existing = inFlight.get(key);
|
|
31
|
+
if (existing) return existing;
|
|
32
|
+
// fn may throw synchronously; the async IIFE turns that into a rejection.
|
|
33
|
+
const p = (async () => fn(arg))();
|
|
34
|
+
inFlight.set(key, p);
|
|
35
|
+
// Clear AFTER set (a sync throw would otherwise run cleanup before the
|
|
36
|
+
// slot exists and strand a rejected promise in it). Registered before any
|
|
37
|
+
// caller's await, so the slot is gone by the time a caller resumes.
|
|
38
|
+
const clear = () => { if (inFlight.get(key) === p) inFlight.delete(key); };
|
|
39
|
+
p.then(clear, clear);
|
|
40
|
+
return p;
|
|
41
|
+
}
|
|
42
|
+
shared.inFlight = inFlight;
|
|
43
|
+
return shared;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Key for a list-prds call: normalized non-empty cwd, else the machine-wide key. */
|
|
47
|
+
function listKeyFor(cwd) {
|
|
48
|
+
return typeof cwd === 'string' && cwd.length > 0 ? cwd : MACHINE_WIDE_KEY;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Return a flat copy of `s` that shares no backing store with its parent
|
|
53
|
+
* (a Buffer round-trip always materializes a new sequential string).
|
|
54
|
+
* Non-strings pass through untouched.
|
|
55
|
+
*/
|
|
56
|
+
function flatString(s) {
|
|
57
|
+
if (typeof s !== 'string') return s;
|
|
58
|
+
if (s.length === 0) return '';
|
|
59
|
+
return Buffer.from(s, 'utf8').toString('utf8');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Flatten every string field, and every string item of every array field, in place. */
|
|
63
|
+
function flattenPrdEntry(entry) {
|
|
64
|
+
if (!entry || typeof entry !== 'object') return entry;
|
|
65
|
+
for (const k of Object.keys(entry)) {
|
|
66
|
+
const v = entry[k];
|
|
67
|
+
if (typeof v === 'string') entry[k] = flatString(v);
|
|
68
|
+
else if (Array.isArray(v)) entry[k] = v.map((x) => flatString(x));
|
|
69
|
+
}
|
|
70
|
+
return entry;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
module.exports = {
|
|
74
|
+
MACHINE_WIDE_KEY,
|
|
75
|
+
createSingleFlight,
|
|
76
|
+
listKeyFor,
|
|
77
|
+
flatString,
|
|
78
|
+
flattenPrdEntry,
|
|
79
|
+
};
|
|
@@ -21,25 +21,35 @@ const fs = require('node:fs');
|
|
|
21
21
|
/** PRD execution's documented default persona (dev-lead.md's own frontmatter role). */
|
|
22
22
|
const DEFAULT_PRD_AGENT_TYPE = 'dev-lead';
|
|
23
23
|
|
|
24
|
-
// READ side of the FK — logged at most once per
|
|
25
|
-
// reconcile/list pass re-parsing the same on-disk
|
|
26
|
-
//
|
|
24
|
+
// READ side of the FK — logged at most once per agentType per process so a
|
|
25
|
+
// hot reconcile/list pass re-parsing the same on-disk PRDs every tick (across
|
|
26
|
+
// many cwds — job worktrees each count as one) doesn't flood opsErrorLog's
|
|
27
|
+
// daily file or the remote warns chart. Mirrors agentModelResolve.cjs's
|
|
27
28
|
// loggedDanglingPersonas set.
|
|
28
29
|
const loggedDanglingAgentTypes = new Set();
|
|
29
30
|
|
|
31
|
+
/** True when the PRD being read is archived — a retired persona there is expected, not a warn. */
|
|
32
|
+
function isArchivedPrd(deps) {
|
|
33
|
+
if (deps.archived === true) return true;
|
|
34
|
+
const p = typeof deps.filePath === 'string' ? deps.filePath.replace(/\\/g, '/') : '';
|
|
35
|
+
return p.includes('/prds-archived/');
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
/**
|
|
31
39
|
* Read-time tolerance check: a PRD on disk whose persona was renamed or
|
|
32
40
|
* deleted after the PRD was written must still load. Never throws — logs at
|
|
33
|
-
* most once via opsErrorLog when `agentType` is set
|
|
41
|
+
* most once per agentType per process via opsErrorLog when `agentType` is set
|
|
42
|
+
* but unresolvable. Silent for archived PRDs (`deps.archived === true`, or
|
|
43
|
+
* `deps.filePath` under `prds-archived/`): their personas are routinely retired.
|
|
34
44
|
*/
|
|
35
45
|
function reportDanglingAgentTypeOnce(cwd, agentType, deps = {}) {
|
|
36
46
|
if (!cwd || !agentType) return;
|
|
37
47
|
try {
|
|
48
|
+
if (isArchivedPrd(deps)) return;
|
|
49
|
+
if (loggedDanglingAgentTypes.has(agentType)) return;
|
|
38
50
|
const checkPersonaExists = deps.personaExists || personaFileExists;
|
|
39
51
|
if (checkPersonaExists(cwd, agentType, deps)) return;
|
|
40
|
-
|
|
41
|
-
if (loggedDanglingAgentTypes.has(key)) return;
|
|
42
|
-
loggedDanglingAgentTypes.add(key);
|
|
52
|
+
loggedDanglingAgentTypes.add(agentType);
|
|
43
53
|
// Required lazily, same rationale as agentModelResolve.cjs's
|
|
44
54
|
// logDanglingPersonaOnce: pay for this leaf module only on the (rare)
|
|
45
55
|
// miss path.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Named 'crash.<reason>' so an OOM report (reason: 'oom'), a renderer segfault
|
|
12
12
|
* (reason: 'crashed'), and the unclean-shutdown postmortem (reason:
|
|
13
|
-
* 'unclean-shutdown') are distinguishable in aggregate without parsing free
|
|
13
|
+
* 'unclean-shutdown:<likelyCause>', e.g. 'unclean-shutdown:os-restart') are distinguishable in aggregate without parsing free
|
|
14
14
|
* text. telemetryClient.reportError already stamps the full attribution
|
|
15
15
|
* (appVersion/platform/arch/machineDigest) on every record — that's the
|
|
16
16
|
* whole reason this module exists: these reports are frequently the ONLY
|
|
@@ -45,16 +45,21 @@ const isNum = (v) => typeof v === 'number' && Number.isFinite(v);
|
|
|
45
45
|
/**
|
|
46
46
|
* Turns the previous run's evidence into a likely cause. Launcher evidence
|
|
47
47
|
* (stderr tail, exit record) outranks the sample-based rules. silentGapSec is
|
|
48
|
-
* accepted for the caller's meta but does not change the verdict.
|
|
49
|
-
*
|
|
50
|
-
*
|
|
48
|
+
* accepted for the caller's meta but does not change the verdict. When the
|
|
49
|
+
* machine's uptime (bootUptimeSec) is shorter than the age of the last sample
|
|
50
|
+
* (lastSampleAgeSec), the OS booted after the app last ran — a reboot or power
|
|
51
|
+
* loss, not an app crash — so that is 'os-restart' (ranked below
|
|
52
|
+
* memory-pressure, above 'unknown').
|
|
53
|
+
* @param {{ lastLoopDelayMaxMs?: unknown, lastTotalMb?: unknown, silentGapSec?: unknown, bootUptimeSec?: unknown, lastSampleAgeSec?: unknown, exitRecord?: { signal?: unknown } | null, stderrTail?: unknown }} [sample]
|
|
54
|
+
* @returns {string} 'compositor-disconnect' | `signal:<NAME>` | 'main-hang' | 'memory-pressure' | 'os-restart' | 'unknown'
|
|
51
55
|
*/
|
|
52
|
-
function classifyUncleanShutdown({ lastLoopDelayMaxMs, lastTotalMb, exitRecord, stderrTail } = {}) {
|
|
56
|
+
function classifyUncleanShutdown({ lastLoopDelayMaxMs, lastTotalMb, bootUptimeSec, lastSampleAgeSec, exitRecord, stderrTail } = {}) {
|
|
53
57
|
if (typeof stderrTail === 'string' && stderrTail.includes('Fatal Wayland communication error')) return 'compositor-disconnect';
|
|
54
58
|
const sig = exitRecord && exitRecord.signal;
|
|
55
59
|
if (typeof sig === 'string' && /^[A-Z0-9]{2,16}$/.test(sig)) return `signal:${sig}`;
|
|
56
60
|
if (isNum(lastLoopDelayMaxMs) && lastLoopDelayMaxMs >= HANG_LOOP_DELAY_MS) return 'main-hang';
|
|
57
61
|
if (isNum(lastTotalMb) && lastTotalMb >= MEMORY_PRESSURE_MB) return 'memory-pressure';
|
|
62
|
+
if (isNum(bootUptimeSec) && isNum(lastSampleAgeSec) && bootUptimeSec < lastSampleAgeSec) return 'os-restart';
|
|
58
63
|
return 'unknown';
|
|
59
64
|
}
|
|
60
65
|
|
|
@@ -25,9 +25,29 @@ function resolveDeps(deps = {}) {
|
|
|
25
25
|
buildMachineProfile: deps.buildMachineProfile || require('../machineProfile.cjs').buildMachineProfile,
|
|
26
26
|
telemetryCounters: deps.telemetryCounters || require('./telemetryCounters.cjs'),
|
|
27
27
|
getSeedStatus: deps.getSeedStatus || (() => require('../../seedStatus.cjs').getSeedStatus()),
|
|
28
|
+
fsp: deps.fsp || require('node:fs/promises'),
|
|
29
|
+
homedir: deps.homedir || require('node:os').homedir,
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
/**
|
|
34
|
+
* removeLegacyWatermarks({ fsp, homedir }) — one-shot migration for the
|
|
35
|
+
* retired errors-<date>.jsonl backlog replay: its delivery
|
|
36
|
+
* watermarks file has no reader any more. Best-effort: resolves true when a
|
|
37
|
+
* file was removed, false otherwise (absent, unreadable home, EACCES, ...).
|
|
38
|
+
* Never throws — telemetry housekeeping must not break boot.
|
|
39
|
+
*/
|
|
40
|
+
async function removeLegacyWatermarks({ fsp, homedir } = {}) {
|
|
41
|
+
try {
|
|
42
|
+
const path = require('node:path');
|
|
43
|
+
const file = path.join(homedir(), '.claude', 'session-manager', 'telemetry-watermarks.json');
|
|
44
|
+
await fsp.unlink(file);
|
|
45
|
+
return true;
|
|
46
|
+
} catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
31
51
|
/**
|
|
32
52
|
* Maps getSeedStatus() to enum-only strings (never the fix text or a path).
|
|
33
53
|
* Any failure or malformed shape yields null — never a throw.
|
|
@@ -49,6 +69,16 @@ function buildSeeds(getSeedStatus) {
|
|
|
49
69
|
}
|
|
50
70
|
}
|
|
51
71
|
|
|
72
|
+
/**
|
|
73
|
+
* seedsJson(seeds) — the single serialization of a buildSeeds() result that is
|
|
74
|
+
* persisted as telemetrySettings.lastSeedsReported and compared against it.
|
|
75
|
+
* Both upsert paths (bootSequence, reportSeedsIfChanged) use this so they
|
|
76
|
+
* write the identical string. A null seeds snapshot yields null.
|
|
77
|
+
*/
|
|
78
|
+
function seedsJson(seeds) {
|
|
79
|
+
return seeds ? JSON.stringify(seeds) : null;
|
|
80
|
+
}
|
|
81
|
+
|
|
52
82
|
/**
|
|
53
83
|
* bootSequence({ now, appVersion, installChannel, deps }) — call once per
|
|
54
84
|
* process from app.whenReady.
|
|
@@ -63,7 +93,9 @@ function buildSeeds(getSeedStatus) {
|
|
|
63
93
|
* the 30-day liveness heartbeat). lastMachineReportAt/Version are only
|
|
64
94
|
* persisted when reportInstall() reports success — a failed/dropped
|
|
65
95
|
* upsert stays due so the next boot retries, rather than being marked
|
|
66
|
-
* done regardless of outcome.
|
|
96
|
+
* done regardless of outcome. On acceptance it also persists
|
|
97
|
+
* lastSeedsReported (seedsJson of the seeds it sent), so
|
|
98
|
+
* reportSeedsIfChanged skips an identical re-send.
|
|
67
99
|
* This lands in bilko.run's app_installs table (the sole source for
|
|
68
100
|
* every install-shaped number on the site). It replaces the former
|
|
69
101
|
* track('install.machine', profile) call, which duplicated the same
|
|
@@ -71,10 +103,12 @@ function buildSeeds(getSeedStatus) {
|
|
|
71
103
|
* destination for a machine profile.
|
|
72
104
|
* 4. app.launch — one counter event per boot, via telemetryCounters so the
|
|
73
105
|
* shape lives in exactly one place across every counter this PRD adds.
|
|
106
|
+
* 5. removeLegacyWatermarks — deletes the retired backlog's watermarks file
|
|
107
|
+
* if one is still on disk (best-effort, never throws).
|
|
74
108
|
*/
|
|
75
109
|
async function bootSequence({ now = Date.now(), appVersion, installChannel, deps: depsOverride } = {}) {
|
|
76
110
|
const deps = resolveDeps(depsOverride);
|
|
77
|
-
const { telemetrySettings, telemetryClient, buildMachineProfile, telemetryCounters, getSeedStatus } = deps;
|
|
111
|
+
const { telemetrySettings, telemetryClient, buildMachineProfile, telemetryCounters, getSeedStatus, fsp, homedir } = deps;
|
|
78
112
|
|
|
79
113
|
const settings = await telemetrySettings.load();
|
|
80
114
|
const versionChanged = settings.lastMachineReportVersion !== appVersion;
|
|
@@ -85,17 +119,56 @@ async function bootSequence({ now = Date.now(), appVersion, installChannel, deps
|
|
|
85
119
|
}
|
|
86
120
|
|
|
87
121
|
if (telemetrySettings.isMachineReportDue(settings, { now, appVersion })) {
|
|
88
|
-
const
|
|
122
|
+
const seeds = buildSeeds(getSeedStatus);
|
|
123
|
+
const profile = { ...(await buildMachineProfile()), seeds };
|
|
89
124
|
const reportResult = await telemetryClient.reportInstall(profile);
|
|
90
125
|
if (reportResult && reportResult.accepted) {
|
|
126
|
+
// Record the seeds this upsert delivered so reportSeedsIfChanged does not
|
|
127
|
+
// re-send an identical install record once the seeders settle.
|
|
128
|
+
const sentSeedsJson = seedsJson(seeds);
|
|
91
129
|
await telemetrySettings.save({
|
|
92
130
|
lastMachineReportAt: new Date(now).toISOString(),
|
|
93
131
|
lastMachineReportVersion: appVersion,
|
|
132
|
+
...(sentSeedsJson ? { lastSeedsReported: sentSeedsJson } : {}),
|
|
94
133
|
});
|
|
95
134
|
}
|
|
96
135
|
}
|
|
97
136
|
|
|
98
137
|
telemetryCounters.trackAppLaunch({ installChannel, appVersion });
|
|
138
|
+
|
|
139
|
+
await removeLegacyWatermarks({ fsp, homedir });
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* reportSeedsIfChanged({ deps }) — call once the boot seeders settle.
|
|
144
|
+
*
|
|
145
|
+
* bootSequence snapshots getSeedStatus() before the seeders finish, so a fresh
|
|
146
|
+
* install's first upsert reports every step 'pending', and the next upsert
|
|
147
|
+
* would only come on a version bump or the 30-day heartbeat. This re-sends the
|
|
148
|
+
* install record whenever the settled seeds differ from the last ones an
|
|
149
|
+
* upsert delivered (telemetrySettings.lastSeedsReported, JSON of the 3 enum
|
|
150
|
+
* values). lastSeedsReported is persisted only when reportInstall() reports
|
|
151
|
+
* accepted, so a dropped/failed upsert retries on the next settle.
|
|
152
|
+
* Resolves { sent, accepted }.
|
|
153
|
+
*/
|
|
154
|
+
async function reportSeedsIfChanged({ deps: depsOverride } = {}) {
|
|
155
|
+
const deps = resolveDeps(depsOverride);
|
|
156
|
+
const { telemetrySettings, telemetryClient, buildMachineProfile, getSeedStatus } = deps;
|
|
157
|
+
|
|
158
|
+
const seeds = buildSeeds(getSeedStatus);
|
|
159
|
+
if (!seeds) return { sent: false, accepted: false };
|
|
160
|
+
const currentSeedsJson = seedsJson(seeds);
|
|
161
|
+
|
|
162
|
+
const settings = await telemetrySettings.load();
|
|
163
|
+
if (settings && settings.lastSeedsReported === currentSeedsJson) return { sent: false, accepted: false };
|
|
164
|
+
|
|
165
|
+
const profile = { ...(await buildMachineProfile()), seeds };
|
|
166
|
+
const reportResult = await telemetryClient.reportInstall(profile);
|
|
167
|
+
const accepted = !!(reportResult && reportResult.accepted);
|
|
168
|
+
if (accepted) {
|
|
169
|
+
await telemetrySettings.save({ lastSeedsReported: currentSeedsJson });
|
|
170
|
+
}
|
|
171
|
+
return { sent: true, accepted };
|
|
99
172
|
}
|
|
100
173
|
|
|
101
|
-
module.exports = { bootSequence, buildSeeds };
|
|
174
|
+
module.exports = { bootSequence, buildSeeds, removeLegacyWatermarks, reportSeedsIfChanged };
|
|
@@ -84,6 +84,7 @@ const S = {
|
|
|
84
84
|
disabledForProcess: false,
|
|
85
85
|
dedupedAppends: 0,
|
|
86
86
|
evictedCount: 0,
|
|
87
|
+
rejectedCount: 0,
|
|
87
88
|
recent: [],
|
|
88
89
|
errSeen: new Map(),
|
|
89
90
|
dailyTimer: null,
|
|
@@ -478,6 +479,9 @@ async function track(name, props) {
|
|
|
478
479
|
const wire = {
|
|
479
480
|
app: 'session-manager',
|
|
480
481
|
name: safeStr(name, 200),
|
|
482
|
+
// Captured at track time so the server can date the event by when it
|
|
483
|
+
// happened, not when a (possibly days-late) flush delivered it.
|
|
484
|
+
ts: Date.now(),
|
|
481
485
|
props: meta,
|
|
482
486
|
session_id: S.sessionId,
|
|
483
487
|
visitor_id: S.settings.installId,
|
|
@@ -660,6 +664,13 @@ function describeFailureStatus(status) {
|
|
|
660
664
|
return status === 0 ? 'network error' : `HTTP ${status}`;
|
|
661
665
|
}
|
|
662
666
|
|
|
667
|
+
/**
|
|
668
|
+
* Classifies a failed send and applies its side effects. Returns:
|
|
669
|
+
* - 'backoff' — 429 / network / 5xx: retryable; stop the flush, keep the batch.
|
|
670
|
+
* - 'disabled' — 401 / 403: auth contract broken; stop sending for this process, keep the batch.
|
|
671
|
+
* - 'rejected' — any other 4xx: this batch is poison; the caller drops it and moves on,
|
|
672
|
+
* so it doesn't block other channels or fail again every boot.
|
|
673
|
+
*/
|
|
663
674
|
function applyFailureBackoff(status, channel) {
|
|
664
675
|
if (status === 429 || status === 0 || status >= 500) {
|
|
665
676
|
S.consecutiveFailures += 1;
|
|
@@ -667,14 +678,25 @@ function applyFailureBackoff(status, channel) {
|
|
|
667
678
|
S.backoffUntil = Date.now() + ms;
|
|
668
679
|
S.lastError = { status, message: describeFailureStatus(status), at: Date.now() };
|
|
669
680
|
logWarn('telemetry send failed', { channel, status, consecutiveFailures: S.consecutiveFailures, backoffMs: ms });
|
|
670
|
-
return;
|
|
681
|
+
return 'backoff';
|
|
671
682
|
}
|
|
672
|
-
|
|
673
|
-
|
|
683
|
+
S.lastError = { status, message: describeFailureStatus(status), at: Date.now() };
|
|
684
|
+
if (status === 401 || status === 403) {
|
|
674
685
|
S.disabledForProcess = true;
|
|
675
|
-
|
|
676
|
-
|
|
686
|
+
logWarn('telemetry disabled for process', { channel, status });
|
|
687
|
+
return 'disabled';
|
|
688
|
+
}
|
|
689
|
+
return 'rejected';
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/** Drops a server-rejected (non-retryable 4xx) batch from the queue. */
|
|
693
|
+
function rejectRecords(records, channel, status, result) {
|
|
694
|
+
for (const r of records) {
|
|
695
|
+
removeFromQueue(r.recordId);
|
|
696
|
+
result.rejected.push(r.recordId);
|
|
677
697
|
}
|
|
698
|
+
S.rejectedCount += records.length;
|
|
699
|
+
logWarn('telemetry batch rejected by server; dropped', { channel, status, count: records.length });
|
|
678
700
|
}
|
|
679
701
|
|
|
680
702
|
/**
|
|
@@ -692,7 +714,7 @@ function flush(reason) {
|
|
|
692
714
|
|
|
693
715
|
async function flushImpl(reason) {
|
|
694
716
|
const safeReason = VALID_REASONS.has(reason) ? reason : 'manual';
|
|
695
|
-
const result = { sent: [], failed: [], reason: safeReason };
|
|
717
|
+
const result = { sent: [], failed: [], rejected: [], reason: safeReason };
|
|
696
718
|
try {
|
|
697
719
|
await ensureInit();
|
|
698
720
|
if (!telemetrySettings.isEnabled(S.settings)) return result;
|
|
@@ -704,12 +726,15 @@ async function flushImpl(reason) {
|
|
|
704
726
|
if (byChannel[r.channel]) byChannel[r.channel].push(r);
|
|
705
727
|
}
|
|
706
728
|
|
|
729
|
+
// Highest-value channels first so a backoff on bulk events never starves crash reports.
|
|
707
730
|
let sawFailure = false;
|
|
708
|
-
for (const channel of ['
|
|
731
|
+
for (const channel of ['error', 'install', 'log', 'event']) {
|
|
709
732
|
if (sawFailure) break;
|
|
733
|
+
if (!telemetrySettings.isEnabled(S.settings)) break;
|
|
710
734
|
const records = byChannel[channel];
|
|
711
735
|
if (channel === 'install') {
|
|
712
736
|
for (const r of records) {
|
|
737
|
+
if (!telemetrySettings.isEnabled(S.settings)) break;
|
|
713
738
|
const res = await sendSingle('install', r.wire);
|
|
714
739
|
if (res.ok) {
|
|
715
740
|
S.consecutiveFailures = 0;
|
|
@@ -719,8 +744,11 @@ async function flushImpl(reason) {
|
|
|
719
744
|
addToSent(r.recordId);
|
|
720
745
|
result.sent.push(r.recordId);
|
|
721
746
|
} else {
|
|
747
|
+
if (applyFailureBackoff(res.status, channel) === 'rejected') {
|
|
748
|
+
rejectRecords([r], channel, res.status, result);
|
|
749
|
+
continue;
|
|
750
|
+
}
|
|
722
751
|
result.failed.push(r.recordId);
|
|
723
|
-
applyFailureBackoff(res.status, channel);
|
|
724
752
|
sawFailure = true;
|
|
725
753
|
break;
|
|
726
754
|
}
|
|
@@ -728,6 +756,8 @@ async function flushImpl(reason) {
|
|
|
728
756
|
continue;
|
|
729
757
|
}
|
|
730
758
|
for (let i = 0; i < records.length; i += MAX_BATCH) {
|
|
759
|
+
// Re-check per batch: an opt-out landing mid-flush stops further sends.
|
|
760
|
+
if (!telemetrySettings.isEnabled(S.settings)) break;
|
|
731
761
|
const batch = records.slice(i, i + MAX_BATCH);
|
|
732
762
|
const res = await sendBatch(channel, batch.map((r) => r.wire));
|
|
733
763
|
if (res.ok) {
|
|
@@ -740,8 +770,11 @@ async function flushImpl(reason) {
|
|
|
740
770
|
result.sent.push(r.recordId);
|
|
741
771
|
}
|
|
742
772
|
} else {
|
|
773
|
+
if (applyFailureBackoff(res.status, channel) === 'rejected') {
|
|
774
|
+
rejectRecords(batch, channel, res.status, result);
|
|
775
|
+
continue;
|
|
776
|
+
}
|
|
743
777
|
for (const r of batch) result.failed.push(r.recordId);
|
|
744
|
-
applyFailureBackoff(res.status, channel);
|
|
745
778
|
sawFailure = true;
|
|
746
779
|
break;
|
|
747
780
|
}
|
|
@@ -762,6 +795,16 @@ async function flushImpl(reason) {
|
|
|
762
795
|
return result;
|
|
763
796
|
}
|
|
764
797
|
|
|
798
|
+
/**
|
|
799
|
+
* Pushes a freshly-saved settings object into the live client so a consent
|
|
800
|
+
* change (telemetryConsent.applyConsentUpdate) takes effect at once — without
|
|
801
|
+
* it the client keeps checking the copy it cached at init, so an opt-out
|
|
802
|
+
* would still accept and send until restart.
|
|
803
|
+
*/
|
|
804
|
+
function applySettings(cfg) {
|
|
805
|
+
if (cfg && typeof cfg === 'object') S.settings = cfg;
|
|
806
|
+
}
|
|
807
|
+
|
|
765
808
|
function shutdown() {
|
|
766
809
|
if (S.dailyTimer) {
|
|
767
810
|
clearInterval(S.dailyTimer);
|
|
@@ -775,6 +818,7 @@ function status() {
|
|
|
775
818
|
sentCount: S.sentIds.size,
|
|
776
819
|
dedupedAppends: S.dedupedAppends,
|
|
777
820
|
evictedCount: S.evictedCount,
|
|
821
|
+
rejectedCount: S.rejectedCount,
|
|
778
822
|
disabledForProcess: S.disabledForProcess,
|
|
779
823
|
consecutiveFailures: S.consecutiveFailures,
|
|
780
824
|
backoffUntil: S.backoffUntil,
|
|
@@ -829,6 +873,7 @@ module.exports = {
|
|
|
829
873
|
reportError,
|
|
830
874
|
reportInstall,
|
|
831
875
|
flush,
|
|
876
|
+
applySettings,
|
|
832
877
|
shutdown,
|
|
833
878
|
status,
|
|
834
879
|
recentRecords,
|
|
@@ -25,6 +25,9 @@ async function applyConsentUpdate(cfg, depsOverride) {
|
|
|
25
25
|
const deps = resolveDeps(depsOverride);
|
|
26
26
|
const before = await deps.telemetrySettings.load();
|
|
27
27
|
const saved = await deps.telemetrySettings.save(cfg);
|
|
28
|
+
// Live client caches settings at init; push the saved copy so opt-out
|
|
29
|
+
// stops ingest + egress immediately and a re-enable resumes in-process.
|
|
30
|
+
if (typeof deps.telemetryClient.applySettings === 'function') deps.telemetryClient.applySettings(saved);
|
|
28
31
|
if (before.enabled && !saved.enabled) {
|
|
29
32
|
await deps.telemetryClient.clearQueue();
|
|
30
33
|
}
|
|
@@ -25,8 +25,13 @@ function trackAppLaunch({ installChannel, appVersion } = {}, deps) {
|
|
|
25
25
|
track('app.launch', { installChannel: installChannel || null, appVersion: appVersion || null }, deps);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
// Which view opened the session: a fresh PTY spawn ('terminal', pty.cjs) or a
|
|
29
|
+
// Chat turn that starts a brand-new CLI session via --session-id ('chat',
|
|
30
|
+
// chatRunner.cjs). Closed set — anything else is sent as null.
|
|
31
|
+
const SESSION_SURFACES = ['terminal', 'chat'];
|
|
32
|
+
|
|
33
|
+
function trackSessionOpen({ surface } = {}, deps) {
|
|
34
|
+
track('session.open', { surface: SESSION_SURFACES.includes(surface) ? surface : null }, deps);
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
// Enum mappers — user-authored values never leave the machine; only the closed
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* lastMachineReportAt: string|null,
|
|
11
11
|
* lastMachineReportVersion: string,
|
|
12
12
|
* lastDailyFlushAt: string|null,
|
|
13
|
+
* lastSeedsReported: string|null, // JSON of the 3 seed enum values last accepted by an install upsert
|
|
13
14
|
* schemaVersion: 1
|
|
14
15
|
* }
|
|
15
16
|
*
|
|
@@ -40,6 +41,7 @@ const DEFAULTS = Object.freeze({
|
|
|
40
41
|
lastMachineReportAt: null,
|
|
41
42
|
lastMachineReportVersion: '',
|
|
42
43
|
lastDailyFlushAt: null,
|
|
44
|
+
lastSeedsReported: null,
|
|
43
45
|
schemaVersion: SCHEMA_VERSION,
|
|
44
46
|
});
|
|
45
47
|
|
|
@@ -67,6 +69,7 @@ function isValid(cfg) {
|
|
|
67
69
|
if (cfg.lastMachineReportAt !== null && typeof cfg.lastMachineReportAt !== 'string') return false;
|
|
68
70
|
if (typeof cfg.lastMachineReportVersion !== 'string') return false;
|
|
69
71
|
if (cfg.lastDailyFlushAt !== null && typeof cfg.lastDailyFlushAt !== 'string') return false;
|
|
72
|
+
if (cfg.lastSeedsReported !== undefined && cfg.lastSeedsReported !== null && typeof cfg.lastSeedsReported !== 'string') return false;
|
|
70
73
|
if (cfg.schemaVersion !== SCHEMA_VERSION) return false;
|
|
71
74
|
return true;
|
|
72
75
|
}
|
|
@@ -80,6 +83,7 @@ function normalize(cfg) {
|
|
|
80
83
|
lastMachineReportAt: typeof cfg.lastMachineReportAt === 'string' ? cfg.lastMachineReportAt : null,
|
|
81
84
|
lastMachineReportVersion: typeof cfg.lastMachineReportVersion === 'string' ? cfg.lastMachineReportVersion : '',
|
|
82
85
|
lastDailyFlushAt: typeof cfg.lastDailyFlushAt === 'string' ? cfg.lastDailyFlushAt : null,
|
|
86
|
+
lastSeedsReported: typeof cfg.lastSeedsReported === 'string' ? cfg.lastSeedsReported : null,
|
|
83
87
|
schemaVersion: SCHEMA_VERSION,
|
|
84
88
|
};
|
|
85
89
|
}
|
|
@@ -185,6 +189,7 @@ module.exports = {
|
|
|
185
189
|
save,
|
|
186
190
|
storePath,
|
|
187
191
|
isValid,
|
|
192
|
+
normalize,
|
|
188
193
|
isEnabled,
|
|
189
194
|
resolveEndpoint,
|
|
190
195
|
isDailyFlushDue,
|
package/src/main/pty.cjs
CHANGED
|
@@ -169,7 +169,7 @@ class PtyManager {
|
|
|
169
169
|
// is acceptable for a dev reload.
|
|
170
170
|
//
|
|
171
171
|
// Telemetry: this branch deliberately does NOT call
|
|
172
|
-
// telemetryCounters.trackSessionOpen() (see below, after the real spawn).
|
|
172
|
+
// telemetryCounters.trackSessionOpen({ surface: 'terminal' }) (see below, after the real spawn).
|
|
173
173
|
// Tab = claudeSessionId is a 1:1 mapping (CLAUDE.md domain model) — a
|
|
174
174
|
// reattach is the SAME session process still running, not a new one, so
|
|
175
175
|
// counting it here would double-count every renderer reload and every
|
|
@@ -300,7 +300,7 @@ class PtyManager {
|
|
|
300
300
|
return { pid: null, cwd, reattached: false, error: String(err?.message || 'spawn-failed') };
|
|
301
301
|
}
|
|
302
302
|
console.log('[pty] spawned pid=', proc.pid, 'for tabId=', tabId);
|
|
303
|
-
telemetryCounters.trackSessionOpen();
|
|
303
|
+
telemetryCounters.trackSessionOpen({ surface: 'terminal' });
|
|
304
304
|
|
|
305
305
|
const spawnedAt = Date.now();
|
|
306
306
|
let gotData = false;
|
|
@@ -65,7 +65,7 @@ async function parsePrdRaw(filePath) {
|
|
|
65
65
|
// read — prdAgentType.cjs's header): a persona renamed/deleted after this
|
|
66
66
|
// PRD was written must not stop the PRD from loading. Best-effort only —
|
|
67
67
|
// never lets a logging failure affect parsing.
|
|
68
|
-
if (fm.agentType && cwd) reportDanglingAgentTypeOnce(cwd, fm.agentType);
|
|
68
|
+
if (fm.agentType && cwd) reportDanglingAgentTypeOnce(cwd, fm.agentType, { filePath });
|
|
69
69
|
|
|
70
70
|
return {
|
|
71
71
|
slug: base,
|