@pcircle/memesh 4.9.4 → 4.10.2
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/AGENTS.md +75 -13
- package/README.de.md +5 -5
- package/README.md +5 -5
- package/README.zh-TW.md +5 -5
- package/dashboard/dist/index.html +8 -8
- package/dist/cli/view-live.d.ts.map +1 -1
- package/dist/cli/view-live.js +0 -427
- package/dist/cli/view-live.js.map +1 -1
- package/dist/core/agent-message-inbox.d.ts +6 -0
- package/dist/core/agent-message-inbox.d.ts.map +1 -1
- package/dist/core/agent-message-inbox.js +28 -1
- package/dist/core/agent-message-inbox.js.map +1 -1
- package/dist/core/briefing-index.d.ts +30 -0
- package/dist/core/briefing-index.d.ts.map +1 -0
- package/dist/core/briefing-index.js +140 -0
- package/dist/core/briefing-index.js.map +1 -0
- package/dist/core/briefing-level.d.ts +22 -0
- package/dist/core/briefing-level.d.ts.map +1 -0
- package/dist/core/briefing-level.js +75 -0
- package/dist/core/briefing-level.js.map +1 -0
- package/dist/core/briefing.d.ts +7 -0
- package/dist/core/briefing.d.ts.map +1 -1
- package/dist/core/briefing.js +72 -12
- package/dist/core/briefing.js.map +1 -1
- package/dist/core/capture-liveness.d.ts +137 -0
- package/dist/core/capture-liveness.d.ts.map +1 -0
- package/dist/core/capture-liveness.js +448 -0
- package/dist/core/capture-liveness.js.map +1 -0
- package/dist/core/config.d.ts +2 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +5 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/delegation.d.ts +47 -0
- package/dist/core/delegation.d.ts.map +1 -0
- package/dist/core/delegation.js +174 -0
- package/dist/core/delegation.js.map +1 -0
- package/dist/core/doctor-fixes.d.ts +1 -0
- package/dist/core/doctor-fixes.d.ts.map +1 -1
- package/dist/core/doctor-fixes.js +21 -0
- package/dist/core/doctor-fixes.js.map +1 -1
- package/dist/core/doctor.d.ts +8 -0
- package/dist/core/doctor.d.ts.map +1 -1
- package/dist/core/doctor.js +148 -3
- package/dist/core/doctor.js.map +1 -1
- package/dist/core/note-derive.d.ts +14 -0
- package/dist/core/note-derive.d.ts.map +1 -0
- package/dist/core/note-derive.js +66 -0
- package/dist/core/note-derive.js.map +1 -0
- package/dist/core/note-ingest.d.ts +34 -0
- package/dist/core/note-ingest.d.ts.map +1 -0
- package/dist/core/note-ingest.js +445 -0
- package/dist/core/note-ingest.js.map +1 -0
- package/dist/core/operations.d.ts +10 -1
- package/dist/core/operations.d.ts.map +1 -1
- package/dist/core/operations.js +129 -14
- package/dist/core/operations.js.map +1 -1
- package/dist/core/paths.d.ts +1 -0
- package/dist/core/paths.d.ts.map +1 -1
- package/dist/core/paths.js +4 -0
- package/dist/core/paths.js.map +1 -1
- package/dist/core/schema-export.d.ts.map +1 -1
- package/dist/core/schema-export.js +15 -5
- package/dist/core/schema-export.js.map +1 -1
- package/dist/core/serializer.d.ts +2 -0
- package/dist/core/serializer.d.ts.map +1 -1
- package/dist/core/serializer.js +119 -3
- package/dist/core/serializer.js.map +1 -1
- package/dist/core/session-insight.d.ts +44 -0
- package/dist/core/session-insight.d.ts.map +1 -0
- package/dist/core/session-insight.js +216 -0
- package/dist/core/session-insight.js.map +1 -0
- package/dist/core/task-state-store.d.ts +4 -0
- package/dist/core/task-state-store.d.ts.map +1 -1
- package/dist/core/task-state-store.js +18 -5
- package/dist/core/task-state-store.js.map +1 -1
- package/dist/core/task-state.d.ts +5 -0
- package/dist/core/task-state.d.ts.map +1 -1
- package/dist/core/task-state.js +70 -0
- package/dist/core/task-state.js.map +1 -1
- package/dist/core/turn-signal.d.ts +22 -0
- package/dist/core/turn-signal.d.ts.map +1 -0
- package/dist/core/turn-signal.js +89 -0
- package/dist/core/turn-signal.js.map +1 -0
- package/dist/core/types.d.ts +14 -3
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/update-entrypoint.d.ts +19 -0
- package/dist/core/update-entrypoint.d.ts.map +1 -0
- package/dist/core/update-entrypoint.js +222 -0
- package/dist/core/update-entrypoint.js.map +1 -0
- package/dist/core/update-notice.d.ts +69 -0
- package/dist/core/update-notice.d.ts.map +1 -0
- package/dist/core/update-notice.js +188 -0
- package/dist/core/update-notice.js.map +1 -0
- package/dist/core/work-topology.d.ts +1 -0
- package/dist/core/work-topology.d.ts.map +1 -1
- package/dist/core/work-topology.js +3 -0
- package/dist/core/work-topology.js.map +1 -1
- package/dist/host-runtime/codex-session.d.ts +10 -0
- package/dist/host-runtime/codex-session.d.ts.map +1 -1
- package/dist/host-runtime/codex-session.js +1 -1
- package/dist/host-runtime/codex-session.js.map +1 -1
- package/dist/knowledge-graph.d.ts.map +1 -1
- package/dist/knowledge-graph.js +24 -3
- package/dist/knowledge-graph.js.map +1 -1
- package/dist/mcp/THIRD_PARTY_NOTICES.txt +2 -2
- package/dist/mcp/server.js +1438 -122
- package/dist/mcp/server.js.map +3 -3
- package/dist/skills-manifest.json +61 -36
- package/dist/storage/fts-index.d.ts +1 -0
- package/dist/storage/fts-index.d.ts.map +1 -1
- package/dist/storage/fts-index.js +5 -0
- package/dist/storage/fts-index.js.map +1 -1
- package/dist/transports/cli/cli.d.ts.map +1 -1
- package/dist/transports/cli/cli.js +7846 -5613
- package/dist/transports/cli/cli.js.map +3 -3
- package/dist/transports/http/server.d.ts.map +1 -1
- package/dist/transports/http/server.js +48 -28
- package/dist/transports/http/server.js.map +1 -1
- package/dist/transports/mcp/handlers.d.ts +31 -7
- package/dist/transports/mcp/handlers.d.ts.map +1 -1
- package/dist/transports/mcp/handlers.js +49 -7
- package/dist/transports/mcp/handlers.js.map +1 -1
- package/dist/transports/schemas.d.ts +5 -2
- package/dist/transports/schemas.d.ts.map +1 -1
- package/dist/transports/schemas.js +30 -3
- package/dist/transports/schemas.js.map +1 -1
- package/docs/platforms/README.md +1 -0
- package/docs/platforms/agent-messaging.md +39 -8
- package/package.json +11 -6
- package/scripts/hooks/_generated/agent-message-inbox.js +28 -1
- package/scripts/hooks/_generated/briefing-index.js +147 -0
- package/scripts/hooks/_generated/briefing-level.js +82 -0
- package/scripts/hooks/_generated/capture-liveness.js +455 -0
- package/scripts/hooks/_generated/core-paths.js +4 -0
- package/scripts/hooks/_generated/fts-index.js +5 -0
- package/scripts/hooks/_generated/task-state.js +70 -0
- package/scripts/hooks/_generated/update-notice.js +195 -0
- package/scripts/hooks/_generated/work-topology.js +3 -0
- package/scripts/hooks/_shared.js +923 -27
- package/scripts/hooks/_stop-notes.js +504 -0
- package/scripts/hooks/auto-update-runner.mjs +22 -0
- package/scripts/hooks/decision-nudge.js +32 -5
- package/scripts/hooks/guard-check.js +30 -3
- package/scripts/hooks/post-commit.js +329 -133
- package/scripts/hooks/pre-compact.js +17 -2
- package/scripts/hooks/pre-edit-recall.js +416 -64
- package/scripts/hooks/session-start.js +617 -150
- package/scripts/hooks/session-summary.js +217 -41
- package/scripts/hooks/user-prompt-intent.js +124 -22
- package/scripts/upgrade-plugin.sh +3 -4
- package/skills/memesh/SKILL.md +45 -23
- package/dist/cli/assets/d3.v7.min.js +0 -2
- package/dist/core/graph.d.ts +0 -26
- package/dist/core/graph.d.ts.map +0 -1
- package/dist/core/graph.js +0 -74
- package/dist/core/graph.js.map +0 -1
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { createHash } from 'crypto';
|
|
2
|
+
import { getDatabase } from '../db.js';
|
|
3
|
+
import { remember } from './operations.js';
|
|
4
|
+
import { redactSecrets } from './paths.js';
|
|
5
|
+
export const DELEGATION_TYPE = 'delegation';
|
|
6
|
+
export const DELEGATION_SOURCE = 'deepseek-worker';
|
|
7
|
+
export const DELEGATION_VERDICTS = ['unreviewed', 'accepted', 'rejected'];
|
|
8
|
+
export const ENVELOPE_MAX_BYTES = 4 * 1024 * 1024;
|
|
9
|
+
const SHA256_RE = /^[0-9a-f]{64}$/;
|
|
10
|
+
const USAGE_KEYS = ['prompt_tokens', 'completion_tokens', 'total_tokens'];
|
|
11
|
+
export class DelegationInputError extends Error {
|
|
12
|
+
}
|
|
13
|
+
function clean(value, max = 120) {
|
|
14
|
+
return redactSecrets(value.replace(/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g, '')).slice(0, max);
|
|
15
|
+
}
|
|
16
|
+
export function summarizeEnvelope(raw) {
|
|
17
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
18
|
+
throw new DelegationInputError('the envelope must be a JSON object');
|
|
19
|
+
}
|
|
20
|
+
const env = raw;
|
|
21
|
+
if (typeof env.ok !== 'boolean') {
|
|
22
|
+
throw new DelegationInputError('the envelope has no boolean "ok" — this is not a worker envelope');
|
|
23
|
+
}
|
|
24
|
+
let allowedTools = null;
|
|
25
|
+
if (env.allowed_tools !== undefined) {
|
|
26
|
+
if (!Array.isArray(env.allowed_tools) || !env.allowed_tools.every((t) => typeof t === 'string')) {
|
|
27
|
+
throw new DelegationInputError('"allowed_tools" must be an array of strings');
|
|
28
|
+
}
|
|
29
|
+
allowedTools = env.allowed_tools.map((t) => clean(t, 64)).slice(0, 50);
|
|
30
|
+
}
|
|
31
|
+
const usage = {};
|
|
32
|
+
if (env.usage && typeof env.usage === 'object' && !Array.isArray(env.usage)) {
|
|
33
|
+
for (const key of USAGE_KEYS) {
|
|
34
|
+
const v = env.usage[key];
|
|
35
|
+
if (typeof v === 'number' && Number.isFinite(v) && v >= 0)
|
|
36
|
+
usage[key] = Math.floor(v);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
ok: env.ok,
|
|
41
|
+
mode: typeof env.task_id === 'string' ? 'harness' : 'direct',
|
|
42
|
+
model: typeof env.model === 'string' && env.model ? clean(env.model) : null,
|
|
43
|
+
finishReason: typeof env.finish_reason === 'string' && env.finish_reason ? clean(env.finish_reason, 40) : null,
|
|
44
|
+
allowedTools,
|
|
45
|
+
usage,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function storedProvenance(metadata) {
|
|
49
|
+
try {
|
|
50
|
+
const parsed = metadata ? JSON.parse(metadata) : {};
|
|
51
|
+
return parsed.provenance && typeof parsed.provenance === 'object' ? parsed.provenance : {};
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function trustFor(verdict) {
|
|
58
|
+
switch (verdict) {
|
|
59
|
+
case 'accepted': return 'verified';
|
|
60
|
+
case 'rejected': return 'rejected';
|
|
61
|
+
default: return 'untrusted-until-verified';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function verdictLine(verdict, at, note) {
|
|
65
|
+
const base = verdict === 'unreviewed'
|
|
66
|
+
? 'Verdict: unreviewed — the worker output is untrusted until the orchestrator verifies it'
|
|
67
|
+
: `Verdict: ${verdict} by the orchestrator at ${at}`;
|
|
68
|
+
return note ? `${base}. Note: ${clean(note, 500)}` : base;
|
|
69
|
+
}
|
|
70
|
+
export function recordDelegation(input) {
|
|
71
|
+
if (!SHA256_RE.test(input.promptSha256)) {
|
|
72
|
+
throw new DelegationInputError('the prompt hash must be 64 lowercase hex characters (sha256)');
|
|
73
|
+
}
|
|
74
|
+
if (Buffer.byteLength(input.envelopeText, 'utf8') > ENVELOPE_MAX_BYTES) {
|
|
75
|
+
throw new DelegationInputError(`the envelope is larger than ${ENVELOPE_MAX_BYTES} bytes`);
|
|
76
|
+
}
|
|
77
|
+
let parsed;
|
|
78
|
+
try {
|
|
79
|
+
parsed = JSON.parse(input.envelopeText);
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
throw new DelegationInputError(`the envelope is not JSON: ${err instanceof Error ? err.message : String(err)}`);
|
|
83
|
+
}
|
|
84
|
+
const summary = summarizeEnvelope(parsed);
|
|
85
|
+
const verdict = input.verdict ?? 'unreviewed';
|
|
86
|
+
const trust = trustFor(verdict);
|
|
87
|
+
const envelopeSha256 = createHash('sha256').update(input.envelopeText).digest('hex');
|
|
88
|
+
const name = `delegation-${input.promptSha256.slice(0, 12)}-${envelopeSha256.slice(0, 8)}`;
|
|
89
|
+
const existing = getDatabase().prepare('SELECT metadata FROM entities WHERE name = ?').get(name);
|
|
90
|
+
if (existing) {
|
|
91
|
+
const stored = storedProvenance(existing.metadata);
|
|
92
|
+
const storedVerdict = DELEGATION_VERDICTS.includes(stored.verdict)
|
|
93
|
+
? stored.verdict : 'unreviewed';
|
|
94
|
+
return { stored: false, name, verdict: storedVerdict, trust: trustFor(storedVerdict), summary };
|
|
95
|
+
}
|
|
96
|
+
const granted = input.grantedTools?.map((t) => clean(t, 64)).slice(0, 50);
|
|
97
|
+
const allowedTools = granted ?? summary.allowedTools;
|
|
98
|
+
let allowedSource = null;
|
|
99
|
+
if (granted)
|
|
100
|
+
allowedSource = 'orchestrator';
|
|
101
|
+
else if (summary.allowedTools)
|
|
102
|
+
allowedSource = 'envelope';
|
|
103
|
+
const toolsLine = allowedTools === null
|
|
104
|
+
? 'Allowed tools: not reported in the envelope'
|
|
105
|
+
: `Allowed tools: ${allowedTools.length ? allowedTools.join(', ') : 'none'}${granted ? ' (granted by the orchestrator)' : ''}`;
|
|
106
|
+
const envelopeDisagrees = granted && summary.allowedTools
|
|
107
|
+
&& [...granted].sort().join('\0') !== [...summary.allowedTools].sort().join('\0');
|
|
108
|
+
const at = new Date().toISOString();
|
|
109
|
+
const usageText = USAGE_KEYS.filter((k) => summary.usage[k] !== undefined)
|
|
110
|
+
.map((k) => `${k}=${summary.usage[k]}`).join(', ');
|
|
111
|
+
remember({
|
|
112
|
+
name,
|
|
113
|
+
type: DELEGATION_TYPE,
|
|
114
|
+
title: `${at.slice(0, 10)} delegation to ${summary.model ?? 'worker'} (${summary.mode})`,
|
|
115
|
+
observations: [
|
|
116
|
+
`Delegated to ${summary.model ?? 'an unnamed model'} (${summary.mode} mode); prompt sha256 ${input.promptSha256}`,
|
|
117
|
+
toolsLine,
|
|
118
|
+
...(envelopeDisagrees
|
|
119
|
+
? [`Allowed tools mismatch: the envelope reports ${summary.allowedTools.join(', ') || 'none'}`] : []),
|
|
120
|
+
`Result: ok=${summary.ok}, finish_reason=${summary.finishReason ?? 'none'}`,
|
|
121
|
+
usageText ? `Usage: ${usageText}` : 'Usage: not reported in the envelope',
|
|
122
|
+
verdictLine(verdict, at),
|
|
123
|
+
...(input.followUp ? [`Follow-up: ${clean(input.followUp, 500)}`] : []),
|
|
124
|
+
],
|
|
125
|
+
tags: [`source:${DELEGATION_SOURCE}`, `project:${input.project}`],
|
|
126
|
+
trustOverride: verdict === 'accepted' ? 'trusted' : 'untrusted',
|
|
127
|
+
provenanceOverride: {
|
|
128
|
+
source: DELEGATION_SOURCE,
|
|
129
|
+
trust,
|
|
130
|
+
verdict,
|
|
131
|
+
...(verdict !== 'unreviewed' ? { verified_at: at } : {}),
|
|
132
|
+
prompt_sha256: input.promptSha256,
|
|
133
|
+
envelope_sha256: envelopeSha256,
|
|
134
|
+
model: summary.model,
|
|
135
|
+
mode: summary.mode,
|
|
136
|
+
allowed_tools: allowedTools,
|
|
137
|
+
allowed_tools_source: allowedSource,
|
|
138
|
+
...(granted && summary.allowedTools ? { envelope_allowed_tools: summary.allowedTools } : {}),
|
|
139
|
+
usage: summary.usage,
|
|
140
|
+
finish_reason: summary.finishReason,
|
|
141
|
+
ok: summary.ok,
|
|
142
|
+
},
|
|
143
|
+
sourceHost: 'cli',
|
|
144
|
+
});
|
|
145
|
+
return { stored: true, name, verdict, trust, summary };
|
|
146
|
+
}
|
|
147
|
+
export function setDelegationVerdict(input) {
|
|
148
|
+
const row = getDatabase()
|
|
149
|
+
.prepare('SELECT type, metadata FROM entities WHERE name = ?')
|
|
150
|
+
.get(input.name);
|
|
151
|
+
if (!row)
|
|
152
|
+
throw new DelegationInputError(`no memory named "${input.name}"`);
|
|
153
|
+
const provenance = storedProvenance(row.metadata);
|
|
154
|
+
if (row.type !== DELEGATION_TYPE || provenance.source !== DELEGATION_SOURCE) {
|
|
155
|
+
throw new DelegationInputError(`"${input.name}" is not a delegation record`);
|
|
156
|
+
}
|
|
157
|
+
const at = new Date().toISOString();
|
|
158
|
+
const trust = trustFor(input.verdict);
|
|
159
|
+
remember({
|
|
160
|
+
name: input.name,
|
|
161
|
+
type: DELEGATION_TYPE,
|
|
162
|
+
observations: [verdictLine(input.verdict, at, input.note)],
|
|
163
|
+
trustOverride: input.verdict === 'accepted' ? 'trusted' : 'untrusted',
|
|
164
|
+
provenanceOverride: { ...provenance, trust, verdict: input.verdict, verified_at: at },
|
|
165
|
+
sourceHost: 'cli',
|
|
166
|
+
});
|
|
167
|
+
return {
|
|
168
|
+
name: input.name,
|
|
169
|
+
previousVerdict: typeof provenance.verdict === 'string' ? provenance.verdict : null,
|
|
170
|
+
verdict: input.verdict,
|
|
171
|
+
trust,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=delegation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegation.js","sourceRoot":"","sources":["../../src/core/delegation.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAC5C,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,YAAY,EAAE,UAAU,EAAE,UAAU,CAAU,CAAC;AAKnF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAClD,MAAM,SAAS,GAAG,gBAAgB,CAAC;AACnC,MAAM,UAAU,GAAG,CAAC,eAAe,EAAE,mBAAmB,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CAAC,IAAI,CAAC,CAAC;QAC1D,aAAa,EAAE,KAAK,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW;QACrE,kBAAkB,EAAE,EAAE,GAAG,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;QACrF,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;IACH,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,eAAe,EAAE,OAAO,UAAU,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;QACnF,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -12,6 +12,7 @@ export interface PluginRefreshResult {
|
|
|
12
12
|
output: string;
|
|
13
13
|
restartRequired: true;
|
|
14
14
|
}
|
|
15
|
+
export declare function isDoctorFixPermissionError(error: unknown): boolean;
|
|
15
16
|
export declare function pluginHostFromDoctorCheck(check: {
|
|
16
17
|
params?: Record<string, string | number>;
|
|
17
18
|
}): 'claude-code' | 'codex';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor-fixes.d.ts","sourceRoot":"","sources":["../../src/core/doctor-fixes.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAOD,wBAAgB,uBAAuB,IAAI,0BAA0B,CA+CpE;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,IAAI,CAAC;CACvB;AASD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;CAAE,GAAG,aAAa,GAAG,OAAO,CAItH;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,GAAG,mBAAmB,CAmC1G"}
|
|
1
|
+
{"version":3,"file":"doctor-fixes.d.ts","sourceRoot":"","sources":["../../src/core/doctor-fixes.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAOD,wBAAgB,uBAAuB,IAAI,0BAA0B,CA+CpE;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,IAAI,CAAC;CACvB;AAQD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAyBlE;AASD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;CAAE,GAAG,aAAa,GAAG,OAAO,CAItH;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,GAAG,mBAAmB,CAmC1G"}
|
|
@@ -56,6 +56,27 @@ export function removeRetiredConfigKeys() {
|
|
|
56
56
|
}
|
|
57
57
|
return { changed: true, removed, backupPath, configPath };
|
|
58
58
|
}
|
|
59
|
+
export function isDoctorFixPermissionError(error) {
|
|
60
|
+
const record = error && typeof error === 'object'
|
|
61
|
+
? error
|
|
62
|
+
: null;
|
|
63
|
+
if (record && typeof record.code === 'string' && ['EACCES', 'EPERM', 'EROFS'].includes(record.code)) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
const detail = [
|
|
67
|
+
record?.message,
|
|
68
|
+
typeof record?.stderr === 'string' || Buffer.isBuffer(record?.stderr) ? String(record.stderr) : undefined,
|
|
69
|
+
].filter((value) => typeof value === 'string').join('\n');
|
|
70
|
+
if (/\b(?:EACCES|EPERM|EROFS)\b|permission denied|operation not permitted|read-only file system/i.test(detail)) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
if (/could not create the upgrade lock at [^\n]+/i.test(detail)
|
|
74
|
+
&& /its parent must exist and be writable:/i.test(detail))
|
|
75
|
+
return true;
|
|
76
|
+
return record?.cause !== undefined && record.cause !== error
|
|
77
|
+
? isDoctorFixPermissionError(record.cause)
|
|
78
|
+
: false;
|
|
79
|
+
}
|
|
59
80
|
function safeOutput(value) {
|
|
60
81
|
return value.replace(/(?:\/Users\/[^\s'"`]+|\/home\/[^\s'"`]+|[A-Za-z]:\\[^\s'"`]+)/g, '<local-path>')
|
|
61
82
|
.replace(/(Bearer\s+|sk-|ghp_)[A-Za-z0-9._-]+/gi, '$1<redacted>')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor-fixes.js","sourceRoot":"","sources":["../../src/core/doctor-fixes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,a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C;QACX,MAAM,EAAE,UAAU,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;QACxD,eAAe,EAAE,IAAI;KACtB,CAAC;AACJ,CAAC"}
|
package/dist/core/doctor.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { getConfigPath } from './config.js';
|
|
|
3
3
|
import { openDatabase, closeDatabase, isDatabaseOpen } from '../db.js';
|
|
4
4
|
import { getUpdateCheck } from './version-check.js';
|
|
5
5
|
import { getCurrentInstallChannel, getInstallChannelSupport } from './install-channel.js';
|
|
6
|
+
import { type CaptureLivenessStatus, type HookLivenessSummary, type TypeTrend } from './capture-liveness.js';
|
|
6
7
|
export type DoctorCheckStatus = 'pass' | 'warn' | 'fail';
|
|
7
8
|
export type DoctorOverallStatus = 'PASS' | 'PASS_WITH_CONCERNS' | 'FAIL';
|
|
8
9
|
export interface DoctorCheck {
|
|
@@ -19,6 +20,13 @@ export interface DoctorCheck {
|
|
|
19
20
|
export interface DoctorResult {
|
|
20
21
|
status: DoctorOverallStatus;
|
|
21
22
|
checks: DoctorCheck[];
|
|
23
|
+
capture?: CaptureLivenessReport;
|
|
24
|
+
}
|
|
25
|
+
export interface CaptureLivenessReport {
|
|
26
|
+
status: CaptureLivenessStatus;
|
|
27
|
+
hooks: HookLivenessSummary[];
|
|
28
|
+
types: TypeTrend[];
|
|
29
|
+
neverRan: string[];
|
|
22
30
|
}
|
|
23
31
|
interface DoctorOptions {
|
|
24
32
|
packageRoot: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/core/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAOpB,OAAO,EAAyB,aAAa,EAAc,MAAM,aAAa,CAAC;AAC/E,OAAO,EACL,YAAY,EAAE,aAAa,EAAE,cAAc,EAC5C,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cA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,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,OAAO,EAAE,CAAC,UAAU,EACpC,gBAAgB,EAAE,OAAO,EAAE,CAAC,YAAY,EACxC,WAAW,GAAE,MAAwB,EACrC,SAAS,GAAE,MAAiC,EAC5C,iBAAiB,GAAE,MAAM,OAA0B,GAClD,WAAW,CAqDb;AAWD,wBAAgB,gBAAgB,IAAI,OAAO,CAO1C;AAmjCD,wBAAsB,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAme7E;AAaD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,CAgBzF"}
|
package/dist/core/doctor.js
CHANGED
|
@@ -19,6 +19,7 @@ import { MemeshDatabase } from '../storage/sqlite.js';
|
|
|
19
19
|
import { AUTO_CAPTURE_TAG } from './types.js';
|
|
20
20
|
import { parseSqliteUtcMs } from './time-utils.js';
|
|
21
21
|
import { autoCaptureDecision } from './capture-flag.js';
|
|
22
|
+
import { captureLivenessVerdict, parseHookOutcomes, summarizeHookOutcomes, summarizeTypeTrends, FAIL_ELIGIBLE_HOOKS, HOOK_OUTCOMES_FILENAME, NEVER_RAN_GRACE_HOURS, SILENT_HOOK_MIN_RUNS, } from './capture-liveness.js';
|
|
22
23
|
import { guardFromMetadata } from './guards.js';
|
|
23
24
|
import { getAgentMessageStorageReport } from './agent-message-storage.js';
|
|
24
25
|
import { readHostConfigFile } from '../host-runtime/config.js';
|
|
@@ -509,6 +510,146 @@ function inspectHookActivity(openDatabaseImpl, closeDatabaseImpl, existsSyncImpl
|
|
|
509
510
|
catch { }
|
|
510
511
|
}
|
|
511
512
|
}
|
|
513
|
+
function inspectCaptureLiveness(openDatabaseImpl, closeDatabaseImpl, readFileSyncImpl = fs.readFileSync, memeshDirImpl = getMemeshDirFromDbPath, captureWired = true) {
|
|
514
|
+
const TITLE = 'Capture liveness';
|
|
515
|
+
if (autoCaptureOffSource() !== null) {
|
|
516
|
+
return {
|
|
517
|
+
check: createCheck('capture-liveness', TITLE, 'pass', 'Automatic capture is turned off, so there is nothing to keep alive. Re-enable it to resume capturing.'),
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
let raw;
|
|
521
|
+
try {
|
|
522
|
+
raw = readFileSyncImpl(path.join(memeshDirImpl(), HOOK_OUTCOMES_FILENAME), 'utf8');
|
|
523
|
+
}
|
|
524
|
+
catch {
|
|
525
|
+
raw = null;
|
|
526
|
+
}
|
|
527
|
+
const hooks = summarizeHookOutcomes(parseHookOutcomes(raw));
|
|
528
|
+
let db = null;
|
|
529
|
+
let types;
|
|
530
|
+
let neverRan;
|
|
531
|
+
let measuringHours;
|
|
532
|
+
let legacyCaptured = 0;
|
|
533
|
+
let stampedCount;
|
|
534
|
+
let newestHeartbeatHours = null;
|
|
535
|
+
try {
|
|
536
|
+
db = openDatabaseImpl();
|
|
537
|
+
const rows = db.prepare(`SELECT e.type AS type,
|
|
538
|
+
SUM(CASE WHEN e.created_at > datetime('now', '-7 days') THEN 1 ELSE 0 END) AS last7,
|
|
539
|
+
SUM(CASE WHEN e.created_at <= datetime('now', '-7 days')
|
|
540
|
+
AND e.created_at > datetime('now', '-14 days') THEN 1 ELSE 0 END) AS prev7
|
|
541
|
+
FROM entities e
|
|
542
|
+
JOIN tags t ON t.entity_id = e.id
|
|
543
|
+
WHERE t.tag = ?
|
|
544
|
+
AND e.created_at > datetime('now', '-14 days')
|
|
545
|
+
GROUP BY e.type`).all(AUTO_CAPTURE_TAG);
|
|
546
|
+
types = summarizeTypeTrends(rows.map((r) => ({
|
|
547
|
+
type: String(r.type),
|
|
548
|
+
last7: Number(r.last7) || 0,
|
|
549
|
+
prev7: Number(r.prev7) || 0,
|
|
550
|
+
})));
|
|
551
|
+
const tablePresent = !!db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'hook_runs'").get();
|
|
552
|
+
const heartbeats = tablePresent
|
|
553
|
+
? db.prepare('SELECT hook, last_run_at FROM hook_runs').all()
|
|
554
|
+
: [];
|
|
555
|
+
const stamped = new Set(heartbeats.map((r) => r.hook));
|
|
556
|
+
stampedCount = stamped.size;
|
|
557
|
+
for (const r of heartbeats) {
|
|
558
|
+
const h = hoursSince(String(r.last_run_at));
|
|
559
|
+
if (h !== null && (newestHeartbeatHours === null || h < newestHeartbeatHours))
|
|
560
|
+
newestHeartbeatHours = h;
|
|
561
|
+
}
|
|
562
|
+
neverRan = FAIL_ELIGIBLE_HOOKS.filter((h) => !stamped.has(h));
|
|
563
|
+
const since = db.prepare("SELECT value FROM memesh_metadata WHERE key = 'hook_runs_since'").get()?.value;
|
|
564
|
+
measuringHours = since !== undefined ? hoursSince(since) : null;
|
|
565
|
+
if (since !== undefined) {
|
|
566
|
+
legacyCaptured = db.prepare(`SELECT COUNT(DISTINCT e.id) as c FROM entities e
|
|
567
|
+
JOIN tags t ON t.entity_id = e.id
|
|
568
|
+
WHERE t.tag = ? AND e.created_at > ?`).get(AUTO_CAPTURE_TAG, since)?.c ?? 0;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
catch (err) {
|
|
572
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
573
|
+
return {
|
|
574
|
+
check: createCheck('capture-liveness', TITLE, 'fail', `Could not read capture liveness from the database: ${detail}. Whether anything is being saved is unknown, which is not the same as healthy.`, 'The error is quoted above. Check that ~/.memesh is readable and that the disk is not full.', { code: 'capture-liveness.query-failed', params: { detail } }),
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
finally {
|
|
578
|
+
try {
|
|
579
|
+
if (db)
|
|
580
|
+
closeDatabaseImpl();
|
|
581
|
+
}
|
|
582
|
+
catch { }
|
|
583
|
+
}
|
|
584
|
+
const verdict = captureLivenessVerdict({ hooks, types, neverRanHooks: neverRan, measuringHours });
|
|
585
|
+
const report = {
|
|
586
|
+
status: verdict.status,
|
|
587
|
+
hooks,
|
|
588
|
+
types,
|
|
589
|
+
neverRan: verdict.deadHooks,
|
|
590
|
+
};
|
|
591
|
+
if (verdict.status === 'FAIL') {
|
|
592
|
+
const hook = verdict.deadHooks[0];
|
|
593
|
+
if (!captureWired) {
|
|
594
|
+
return {
|
|
595
|
+
check: createCheck('capture-liveness', TITLE, 'warn', `The ${hook} hook has never run — but no capture hook (Stop / PostToolUse / PreCompact) is confirmed wired on this machine, so there is nothing that should be running.`, 'If you want automatic capture, run `memesh install-hooks`. If this install is MCP-only (Codex / Gemini / Cursor), this is expected and safe to ignore.', { code: 'capture-liveness.not-wired', params: { hook } }),
|
|
596
|
+
report: { ...report, status: 'PASS_WITH_CONCERNS' },
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
if (legacyCaptured > 0 && hooks.length === 0) {
|
|
600
|
+
return {
|
|
601
|
+
check: createCheck('capture-liveness', TITLE, 'warn', `The ${hook} hook has left no record and no heartbeat, but ${legacyCaptured} auto-capture memor${legacyCaptured === 1 ? 'y' : 'ies'} landed since tracking began — hooks from a version before outcome tracking are probably still running.`, 'Update the memesh hooks to the current version (plugin installs: `/plugin update memesh`; npm installs: `memesh install-hooks`), then restart your agent.', { code: 'capture-liveness.never-ran-legacy', params: { hook, captured: legacyCaptured } }),
|
|
602
|
+
report: { ...report, status: 'PASS_WITH_CONCERNS' },
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
return {
|
|
606
|
+
check: createCheck('capture-liveness', TITLE, 'fail', `The ${hook} hook has left no record and no heartbeat in the ${Math.round(measuringHours ?? 0)} hours since tracking began — it has never run, so nothing it would capture is being saved.`, 'Run `memesh install-hooks` and restart your agent, then end one work session and re-run `memesh doctor`.', { code: 'capture-liveness.never-ran', params: { hook, hours: Math.round(measuringHours ?? 0) } }),
|
|
607
|
+
report,
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
if (verdict.silentHook) {
|
|
611
|
+
const h = verdict.silentHook;
|
|
612
|
+
const reason = h.dominantSkipReason ?? 'no reason recorded';
|
|
613
|
+
return {
|
|
614
|
+
check: createCheck('capture-liveness', TITLE, 'warn', `${h.hook}: ${h.triggeredRuns} runs, 0 writes — '${reason}'. The hook is alive and deciding there is nothing to save every single time, which is also what a broken capture path looks like.`, 'Run `memesh doctor --json` for the per-hook figures. If the reason does not describe your usage, run `memesh install-hooks` and restart your agent.', { code: 'capture-liveness.silent-hook', params: { hook: h.hook, runs: h.triggeredRuns, reason } }),
|
|
615
|
+
report,
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
if (hooks.length === 0 && captureWired && stampedCount > 0
|
|
619
|
+
&& measuringHours !== null && measuringHours > NEVER_RAN_GRACE_HOURS) {
|
|
620
|
+
const lastHeartbeat = newestHeartbeatHours === null ? null : Math.round(newestHeartbeatHours);
|
|
621
|
+
return {
|
|
622
|
+
check: createCheck('capture-liveness', TITLE, 'warn', `Hooks have run on this machine (last heartbeat ${lastHeartbeat ?? '?'} hours ago), but not one has left an outcome record. Either the running hooks predate outcome tracking, or they fail as they load and record nothing.`, 'Update the memesh hooks (plugin installs: `/plugin update memesh`; npm installs: `memesh install-hooks`), restart your agent, start one session, and re-run `memesh doctor`. If you just updated, start a session first — the records begin on the next hook run.', { code: 'capture-liveness.no-records', params: { hours: lastHeartbeat ?? '?' } }),
|
|
623
|
+
report: { ...report, status: 'PASS_WITH_CONCERNS' },
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
if (verdict.stoppedTypes.length > 0) {
|
|
627
|
+
const t = verdict.stoppedTypes[0];
|
|
628
|
+
return {
|
|
629
|
+
check: createCheck('capture-liveness', TITLE, 'warn', `Nothing of type '${t.type}' was captured in the last 7 days, against ${t.prev7} in the 7 days before. Something that was being remembered has stopped being remembered.`, 'Run `memesh doctor --json` for the per-hook figures, and check whether the way you work changed — if it did not, run `memesh install-hooks` and restart your agent.', { code: 'capture-liveness.type-stopped', params: { type: t.type, prev: t.prev7 } }),
|
|
630
|
+
report,
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
const writing = hooks.filter((h) => h.writes > 0);
|
|
634
|
+
const ranEnough = hooks.filter((h) => h.triggeredRuns >= SILENT_HOOK_MIN_RUNS);
|
|
635
|
+
let summary;
|
|
636
|
+
if (writing.length > 0) {
|
|
637
|
+
summary = `${writing.length} of ${hooks.length} recording hooks did their work in their recorded window (${writing.map((h) => h.hook).join(', ')}).`;
|
|
638
|
+
}
|
|
639
|
+
else if (ranEnough.length > 0) {
|
|
640
|
+
summary = `${ranEnough.map((h) => `${h.hook} (${h.triggeredRuns} runs)`).join(', ')} ran without writing anything. These hooks decide there is nothing to save on most runs by design, so that is not itself a fault — \`memesh doctor --json\` has the per-hook figures.`;
|
|
641
|
+
}
|
|
642
|
+
else if (hooks.length > 0) {
|
|
643
|
+
summary = `Every recording hook is below the ${SILENT_HOOK_MIN_RUNS}-run threshold where silence would mean anything — too early to say, which is normal on a fresh install.`;
|
|
644
|
+
}
|
|
645
|
+
else {
|
|
646
|
+
summary = 'No hook has recorded an outcome yet — the records start on the next hook run, which is normal right after an upgrade.';
|
|
647
|
+
}
|
|
648
|
+
return {
|
|
649
|
+
check: createCheck('capture-liveness', TITLE, 'pass', summary),
|
|
650
|
+
report,
|
|
651
|
+
};
|
|
652
|
+
}
|
|
512
653
|
function autoCaptureOffSource() {
|
|
513
654
|
let configAutoCapture;
|
|
514
655
|
try {
|
|
@@ -901,7 +1042,7 @@ function inspectClaudeChannelRegistration(existsSyncImpl, readFileSyncImpl) {
|
|
|
901
1042
|
? servers['memesh-channel']
|
|
902
1043
|
: undefined;
|
|
903
1044
|
if (server === undefined) {
|
|
904
|
-
return createCheck('claude-channel', 'Claude Channel registration', 'warn', 'No user-scoped memesh-channel registration was found. Durable MCP/inbox messaging can still work, but live Claude Channel notification is inactive. The upstream research-preview channel remains opt-in.', 'If you want the opt-in channel, run `memesh agent setup claude` and then register the printed user-scoped MCP command.');
|
|
1045
|
+
return createCheck('claude-channel', 'Claude Channel registration', 'warn', 'No user-scoped memesh-channel registration was found. Durable MCP/inbox messaging can still work, but live Claude Channel notification is inactive. The upstream research-preview channel remains opt-in.', 'If you want the opt-in channel, run `memesh agent setup claude` and then register the printed user-scoped MCP command.', { code: 'claude-channel.unregistered' });
|
|
905
1046
|
}
|
|
906
1047
|
const record = server && typeof server === 'object' && !Array.isArray(server)
|
|
907
1048
|
? server
|
|
@@ -994,7 +1135,7 @@ async function inspectUpdateStatus(packageVersion, getUpdateCheckImpl, installSu
|
|
|
994
1135
|
return createCheck('update-status', 'Update status', 'fail', `Installed version ${packageVersion} is DEPRECATED by maintainers: ${update.deprecationMessage}`, fix, { code: 'update-status.deprecated', params: { version: packageVersion, detail: update.deprecationMessage ?? '' } });
|
|
995
1136
|
}
|
|
996
1137
|
if (update.freshness === 'unavailable') {
|
|
997
|
-
if (isFreshInstall()) {
|
|
1138
|
+
if (isFreshInstall() && !update.lastAttemptAt && !update.lastError) {
|
|
998
1139
|
return createCheck('update-status', 'Update status', 'pass', 'Installed recently — memesh has not had a chance to check for updates yet. This resolves itself on the first successful check.');
|
|
999
1140
|
}
|
|
1000
1141
|
return createCheck('update-status', 'Update status', 'warn', 'memesh has not been able to check for newer versions yet, so it cannot tell you whether an update exists.', 'Run `memesh status` once while connected to the internet — that stores the answer and this notice goes away.', { code: 'update-status.no-cache' });
|
|
@@ -1025,7 +1166,7 @@ async function inspectUpdateStatus(packageVersion, getUpdateCheckImpl, installSu
|
|
|
1025
1166
|
params: { version: packageVersion, detail: update.lastError ?? '' },
|
|
1026
1167
|
});
|
|
1027
1168
|
}
|
|
1028
|
-
if (update.
|
|
1169
|
+
if (update.latestVersion && update.latestVersion !== packageVersion) {
|
|
1029
1170
|
if (classifyBump(packageVersion, update.latestVersion)) {
|
|
1030
1171
|
return createCheck('update-status', 'Update status', 'warn', `Update available: ${update.latestVersion} (current: ${packageVersion})`, `Run 'memesh update' to upgrade`, { code: 'update-status.update-available', params: { latest: update.latestVersion, current: packageVersion } });
|
|
1031
1172
|
}
|
|
@@ -1427,6 +1568,9 @@ export async function runDoctor(options) {
|
|
|
1427
1568
|
const captureWired = wiring.status === 'pass'
|
|
1428
1569
|
&& (wiring.params === undefined || wiring.params.captureWired === 1);
|
|
1429
1570
|
checks.push(inspectHookActivity(openDatabaseImpl, safeCloseDatabaseImpl, existsSyncImpl, statSyncImpl, captureWired));
|
|
1571
|
+
const captureLiveness = inspectCaptureLiveness(openDatabaseImpl, safeCloseDatabaseImpl, readFileSyncImpl, getMemeshDirFromDbPath, captureWired);
|
|
1572
|
+
checks.push(captureLiveness.check);
|
|
1573
|
+
const captureReport = captureLiveness.report;
|
|
1430
1574
|
checks.push(inspectDashboardArtifact(packageRoot, existsSyncImpl));
|
|
1431
1575
|
checks.push(inspectNodeRuntime(packageRoot, existsSyncImpl, readFileSyncImpl));
|
|
1432
1576
|
checks.push(inspectNativeBinding(packageRoot, existsSyncImpl, nativeBindingProbeImpl));
|
|
@@ -1448,6 +1592,7 @@ export async function runDoctor(options) {
|
|
|
1448
1592
|
return {
|
|
1449
1593
|
status: summarizeOverallStatus(checks),
|
|
1450
1594
|
checks,
|
|
1595
|
+
...(captureReport ? { capture: captureReport } : {}),
|
|
1451
1596
|
};
|
|
1452
1597
|
}
|
|
1453
1598
|
function iconForStatus(status) {
|