@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,195 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// AUTO-GENERATED from src/core/update-notice.ts — DO NOT EDIT BY HAND.
|
|
3
|
+
// Regenerate with: npm run build (scripts/generate-hook-core.mjs)
|
|
4
|
+
//
|
|
5
|
+
// Claude Code hooks import this committed copy instead of dist/, so the
|
|
6
|
+
// always-on capture path survives a missing or stale dist/ while staying
|
|
7
|
+
// byte-locked to core — eliminating the hand-mirror drift behind the P0 FTS bug.
|
|
8
|
+
// ============================================================================
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import { redactUserPaths } from './core-paths.js';
|
|
12
|
+
export const UP_TO_DATE_REFRESH_MS = 60 * 60 * 1000;
|
|
13
|
+
export const UPGRADE_AVAILABLE_REFRESH_MS = 12 * 60 * 60 * 1000;
|
|
14
|
+
export const ANSWER_VALID_MS = 24 * 60 * 60 * 1000;
|
|
15
|
+
export const SNOOZE_LEVEL_MS = [24 * 60 * 60 * 1000, 48 * 60 * 60 * 1000, 7 * 24 * 60 * 60 * 1000];
|
|
16
|
+
const SNOOZE_FILE = 'update-snooze.json';
|
|
17
|
+
const JUST_UPGRADED_FILE = 'just-upgraded.json';
|
|
18
|
+
export function isStrictlyOlder(a, b) {
|
|
19
|
+
const parse = (v) => {
|
|
20
|
+
const [main, ...rest] = String(v).split(/[-+]/);
|
|
21
|
+
const nums = main.split('.').map((s) => Number.parseInt(s, 10));
|
|
22
|
+
return { nums, tail: rest.join('-') };
|
|
23
|
+
};
|
|
24
|
+
const pa = parse(a);
|
|
25
|
+
const pb = parse(b);
|
|
26
|
+
const len = Math.max(pa.nums.length, pb.nums.length);
|
|
27
|
+
for (let i = 0; i < len; i++) {
|
|
28
|
+
const ai = Number.isFinite(pa.nums[i]) ? pa.nums[i] : 0;
|
|
29
|
+
const bi = Number.isFinite(pb.nums[i]) ? pb.nums[i] : 0;
|
|
30
|
+
if (ai !== bi)
|
|
31
|
+
return ai < bi;
|
|
32
|
+
}
|
|
33
|
+
if (pa.tail && !pb.tail)
|
|
34
|
+
return true;
|
|
35
|
+
if (!pa.tail && pb.tail)
|
|
36
|
+
return false;
|
|
37
|
+
return pa.tail < pb.tail;
|
|
38
|
+
}
|
|
39
|
+
function parseIso(value) {
|
|
40
|
+
if (typeof value !== 'string')
|
|
41
|
+
return null;
|
|
42
|
+
const t = Date.parse(value);
|
|
43
|
+
return Number.isNaN(t) ? null : t;
|
|
44
|
+
}
|
|
45
|
+
function readJson(file) {
|
|
46
|
+
try {
|
|
47
|
+
if (!fs.existsSync(file))
|
|
48
|
+
return null;
|
|
49
|
+
const parsed = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
50
|
+
return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : null;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function writePrivateJson(file, value) {
|
|
57
|
+
fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
58
|
+
fs.writeFileSync(file, JSON.stringify(value, null, 2), { mode: 0o600 });
|
|
59
|
+
try {
|
|
60
|
+
fs.chmodSync(file, 0o600);
|
|
61
|
+
}
|
|
62
|
+
catch { }
|
|
63
|
+
}
|
|
64
|
+
export function readSnooze(dir) {
|
|
65
|
+
const raw = readJson(path.join(dir, SNOOZE_FILE));
|
|
66
|
+
if (!raw)
|
|
67
|
+
return null;
|
|
68
|
+
const { target, level, since } = raw;
|
|
69
|
+
if (typeof target !== 'string' || !target)
|
|
70
|
+
return null;
|
|
71
|
+
if (typeof level !== 'number' || !Number.isInteger(level) || level < 1)
|
|
72
|
+
return null;
|
|
73
|
+
if (parseIso(since) === null)
|
|
74
|
+
return null;
|
|
75
|
+
return { target, level, since: since };
|
|
76
|
+
}
|
|
77
|
+
export function writeSnooze(dir, target, now = new Date()) {
|
|
78
|
+
const previous = readSnooze(dir);
|
|
79
|
+
const level = previous && previous.target === target
|
|
80
|
+
? Math.min(previous.level + 1, SNOOZE_LEVEL_MS.length)
|
|
81
|
+
: 1;
|
|
82
|
+
const state = { target, level, since: now.toISOString() };
|
|
83
|
+
writePrivateJson(path.join(dir, SNOOZE_FILE), state);
|
|
84
|
+
return state;
|
|
85
|
+
}
|
|
86
|
+
export function clearSnooze(dir) {
|
|
87
|
+
try {
|
|
88
|
+
fs.unlinkSync(path.join(dir, SNOOZE_FILE));
|
|
89
|
+
}
|
|
90
|
+
catch { }
|
|
91
|
+
}
|
|
92
|
+
export function snoozeExpiresAt(state) {
|
|
93
|
+
const since = parseIso(state.since) ?? 0;
|
|
94
|
+
const duration = SNOOZE_LEVEL_MS[Math.min(state.level, SNOOZE_LEVEL_MS.length) - 1];
|
|
95
|
+
return since + duration;
|
|
96
|
+
}
|
|
97
|
+
export function readJustUpgradedMarker(dir) {
|
|
98
|
+
const raw = readJson(path.join(dir, JUST_UPGRADED_FILE));
|
|
99
|
+
if (!raw)
|
|
100
|
+
return null;
|
|
101
|
+
const { from, to, at } = raw;
|
|
102
|
+
if (typeof from !== 'string' || !from || typeof to !== 'string' || !to)
|
|
103
|
+
return null;
|
|
104
|
+
return { from, to, at: typeof at === 'string' ? at : '' };
|
|
105
|
+
}
|
|
106
|
+
export function writeJustUpgradedMarker(dir, from, to, now = new Date()) {
|
|
107
|
+
writePrivateJson(path.join(dir, JUST_UPGRADED_FILE), { from, to, at: now.toISOString() });
|
|
108
|
+
}
|
|
109
|
+
export function clearJustUpgradedMarker(dir) {
|
|
110
|
+
try {
|
|
111
|
+
fs.unlinkSync(path.join(dir, JUST_UPGRADED_FILE));
|
|
112
|
+
}
|
|
113
|
+
catch { }
|
|
114
|
+
}
|
|
115
|
+
export function claimJustUpgradedMarker(dir) {
|
|
116
|
+
const file = path.join(dir, JUST_UPGRADED_FILE);
|
|
117
|
+
const taken = `${file}.claimed-${process.pid}-${Math.random().toString(36).slice(2, 8)}`;
|
|
118
|
+
try {
|
|
119
|
+
fs.renameSync(file, taken);
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
const raw = readJson(taken);
|
|
125
|
+
try {
|
|
126
|
+
fs.unlinkSync(taken);
|
|
127
|
+
}
|
|
128
|
+
catch { }
|
|
129
|
+
if (!raw)
|
|
130
|
+
return null;
|
|
131
|
+
const { from, to, at } = raw;
|
|
132
|
+
if (typeof from !== 'string' || !from || typeof to !== 'string' || !to)
|
|
133
|
+
return null;
|
|
134
|
+
return { from, to, at: typeof at === 'string' ? at : '' };
|
|
135
|
+
}
|
|
136
|
+
function boundedReason(raw) {
|
|
137
|
+
const oneLine = redactUserPaths(raw).replace(/[\u0000-\u001f\u007f]+/g, ' ').replace(/\s+/g, ' ').trim();
|
|
138
|
+
return oneLine.length > 160 ? `${oneLine.slice(0, 157)}...` : oneLine;
|
|
139
|
+
}
|
|
140
|
+
function answerIsCurrent(currentVersion, cache, now) {
|
|
141
|
+
if (!cache || cache.currentVersion !== currentVersion)
|
|
142
|
+
return false;
|
|
143
|
+
if (typeof cache.latestVersion !== 'string' || !cache.latestVersion)
|
|
144
|
+
return false;
|
|
145
|
+
const successAt = parseIso(cache.lastSuccessfulCheckAt);
|
|
146
|
+
if (successAt === null)
|
|
147
|
+
return false;
|
|
148
|
+
return now.getTime() - successAt <= ANSWER_VALID_MS;
|
|
149
|
+
}
|
|
150
|
+
export function shouldRefreshUpdateCache(currentVersion, cache, now = new Date()) {
|
|
151
|
+
if (!answerIsCurrent(currentVersion, cache, now))
|
|
152
|
+
return true;
|
|
153
|
+
const successAt = parseIso(cache.lastSuccessfulCheckAt);
|
|
154
|
+
const age = now.getTime() - successAt;
|
|
155
|
+
const upgrade = isStrictlyOlder(currentVersion, cache.latestVersion);
|
|
156
|
+
return age > (upgrade ? UPGRADE_AVAILABLE_REFRESH_MS : UP_TO_DATE_REFRESH_MS);
|
|
157
|
+
}
|
|
158
|
+
export function resolveUpdateNotice(input) {
|
|
159
|
+
const { dir, currentVersion, cache } = input;
|
|
160
|
+
const now = input.now ?? new Date();
|
|
161
|
+
if (input.updateCheckEnabled === false)
|
|
162
|
+
return { kind: 'DISABLED', currentVersion };
|
|
163
|
+
const marker = readJustUpgradedMarker(dir);
|
|
164
|
+
if (marker) {
|
|
165
|
+
if (marker.to === currentVersion) {
|
|
166
|
+
return { kind: 'JUST_UPGRADED', currentVersion, from: marker.from, to: marker.to };
|
|
167
|
+
}
|
|
168
|
+
clearJustUpgradedMarker(dir);
|
|
169
|
+
}
|
|
170
|
+
if (!answerIsCurrent(currentVersion, cache, now)) {
|
|
171
|
+
let reason = 'no update check has completed yet';
|
|
172
|
+
let attempted = false;
|
|
173
|
+
if (cache && cache.currentVersion === currentVersion) {
|
|
174
|
+
attempted = parseIso(cache.lastSuccessfulCheckAt) !== null
|
|
175
|
+
|| (typeof cache.lastError === 'string' && cache.lastError.length > 0);
|
|
176
|
+
if (typeof cache.lastError === 'string' && cache.lastError)
|
|
177
|
+
reason = boundedReason(cache.lastError);
|
|
178
|
+
else if (parseIso(cache.lastSuccessfulCheckAt) !== null)
|
|
179
|
+
reason = 'the last successful check is more than a day old';
|
|
180
|
+
}
|
|
181
|
+
return { kind: 'CHECK_FAILED', currentVersion, reason, attempted };
|
|
182
|
+
}
|
|
183
|
+
const latestVersion = cache.latestVersion;
|
|
184
|
+
if (!isStrictlyOlder(currentVersion, latestVersion)) {
|
|
185
|
+
return { kind: 'UP_TO_DATE', currentVersion, latestVersion };
|
|
186
|
+
}
|
|
187
|
+
const snooze = readSnooze(dir);
|
|
188
|
+
if (snooze && snooze.target === latestVersion) {
|
|
189
|
+
const until = snoozeExpiresAt(snooze);
|
|
190
|
+
if (now.getTime() < until) {
|
|
191
|
+
return { kind: 'SNOOZED', currentVersion, latestVersion, until: new Date(until).toISOString(), level: snooze.level };
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return { kind: 'UPGRADE_AVAILABLE', currentVersion, latestVersion };
|
|
195
|
+
}
|
|
@@ -200,6 +200,9 @@ export function assembleTopologyBlock(stateLines, pools, projectName, budget = D
|
|
|
200
200
|
lines.push(...globalLines);
|
|
201
201
|
return lines;
|
|
202
202
|
}
|
|
203
|
+
export function hasBriefingContent(lines) {
|
|
204
|
+
return lines.length > 0;
|
|
205
|
+
}
|
|
203
206
|
export function buildReferenceContext(memoryLines) {
|
|
204
207
|
const safeLines = memoryLines.map((line) => String(line ?? '')
|
|
205
208
|
.replace(/[\s\u0085\u001c-\u001e]+/g, ' ')
|