@kawacode/mcp 6.1.5 → 6.8.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.
Files changed (69) hide show
  1. package/CLAUDE.md.example +13 -0
  2. package/build/index.js +13 -1
  3. package/build/index.js.map +1 -1
  4. package/build/kawacode-on-pre-edit.d.ts +5 -0
  5. package/build/kawacode-on-pre-edit.js +73 -9
  6. package/build/kawacode-on-pre-edit.js.map +1 -1
  7. package/build/kawacode-on-stop.d.ts +49 -23
  8. package/build/kawacode-on-stop.js +288 -38
  9. package/build/kawacode-on-stop.js.map +1 -1
  10. package/build/services/muninn-ipc.d.ts +19 -1
  11. package/build/services/muninn-ipc.js +20 -2
  12. package/build/services/muninn-ipc.js.map +1 -1
  13. package/build/stop/uncompleted-commit.d.ts +63 -0
  14. package/build/stop/uncompleted-commit.js +188 -0
  15. package/build/stop/uncompleted-commit.js.map +1 -0
  16. package/build/stop/uncompleted-commit.test.d.ts +1 -0
  17. package/build/stop/uncompleted-commit.test.js +135 -0
  18. package/build/stop/uncompleted-commit.test.js.map +1 -0
  19. package/build/telemetry.d.ts +54 -0
  20. package/build/telemetry.js +84 -0
  21. package/build/telemetry.js.map +1 -0
  22. package/build/tools/activate-intent.d.ts +1 -14
  23. package/build/tools/activate-intent.js +17 -56
  24. package/build/tools/activate-intent.js.map +1 -1
  25. package/build/tools/arbiter-apply.d.ts +132 -0
  26. package/build/tools/arbiter-apply.js +59 -0
  27. package/build/tools/arbiter-apply.js.map +1 -0
  28. package/build/tools/arbiter-resolve.d.ts +132 -0
  29. package/build/tools/arbiter-resolve.js +58 -0
  30. package/build/tools/arbiter-resolve.js.map +1 -0
  31. package/build/tools/check-active-intent.d.ts +21 -12
  32. package/build/tools/check-active-intent.js +54 -27
  33. package/build/tools/check-active-intent.js.map +1 -1
  34. package/build/tools/complete-intent.d.ts +43 -10
  35. package/build/tools/complete-intent.js +51 -84
  36. package/build/tools/complete-intent.js.map +1 -1
  37. package/build/tools/create-intent.d.ts +1 -21
  38. package/build/tools/create-intent.js +18 -106
  39. package/build/tools/create-intent.js.map +1 -1
  40. package/build/tools/get-decision-detail.d.ts +109 -0
  41. package/build/tools/get-decision-detail.js +57 -0
  42. package/build/tools/get-decision-detail.js.map +1 -0
  43. package/build/tools/get-project-decisions.d.ts +0 -4
  44. package/build/tools/get-project-decisions.js +4 -6
  45. package/build/tools/get-project-decisions.js.map +1 -1
  46. package/build/tools/get-relevant-context.d.ts +0 -1
  47. package/build/tools/get-relevant-context.js +18 -3
  48. package/build/tools/get-relevant-context.js.map +1 -1
  49. package/build/tools/get-resolution-context.d.ts +154 -0
  50. package/build/tools/get-resolution-context.js +78 -0
  51. package/build/tools/get-resolution-context.js.map +1 -0
  52. package/build/tools/get-session-decisions.d.ts +0 -5
  53. package/build/tools/get-session-decisions.js +5 -5
  54. package/build/tools/get-session-decisions.js.map +1 -1
  55. package/build/tools/index.d.ts +216 -7
  56. package/build/tools/index.js +13 -3
  57. package/build/tools/index.js.map +1 -1
  58. package/build/tools/list-team-intents.d.ts +6 -6
  59. package/build/tools/list-team-intents.js +2 -2
  60. package/build/tools/list-team-intents.js.map +1 -1
  61. package/build/tools/pre-edit-acknowledge.d.ts +12 -0
  62. package/build/tools/pre-edit-acknowledge.js +21 -0
  63. package/build/tools/pre-edit-acknowledge.js.map +1 -1
  64. package/build/tools/pre-edit-decision-check.js +2 -0
  65. package/build/tools/pre-edit-decision-check.js.map +1 -1
  66. package/build/tools/record-decision.d.ts +76 -0
  67. package/build/tools/record-decision.js +10 -0
  68. package/build/tools/record-decision.js.map +1 -1
  69. package/package.json +2 -2
@@ -2,36 +2,66 @@
2
2
  /**
3
3
  * kawacode-on-stop — Claude Code Stop hook dispatcher.
4
4
  *
5
- * Reads the Stop hook payload from stdin (session_id, transcript_path, cwd)
6
- * and sends two short IPCs to Muninn:
5
+ * Fires three independent, fail-soft jobs at the end of every turn:
7
6
  *
8
- * 1. capture-thoughts:capture { sessionId, transcriptPath, cwd }
9
- * → Muninn reads the transcript, extracts the assistant's text
10
- * content blocks (the model's visible responses), and appends them
11
- * as JSONL to ~/.kawa-code/thoughts/active/session-{id}.jsonl.
12
- * Thinking blocks are deliberately ignored — Claude Code redacts
13
- * their plaintext on disk, so they carry no recoverable signal.
14
- * 2. extractor:trigger { session_id, cwd }
15
- * → Muninn wakes the (debounced) extractor service which reads the
16
- * fresh JSONL and emits ephemeral decisions verbalized in the
17
- * assistant's responses.
7
+ * 1. Thought capture (opt out: KAWA_THOUGHT_CAPTURE=off) — two IPCs to Muninn:
8
+ * a. capture-thoughts:capture { sessionId, transcriptPath, cwd }
9
+ * → Muninn reads the transcript, extracts the assistant's text
10
+ * content blocks (the model's visible responses), and appends them
11
+ * as JSONL to ~/.kawa-code/thoughts/active/session-{id}.jsonl.
12
+ * Thinking blocks are deliberately ignored — Claude Code redacts
13
+ * their plaintext on disk, so they carry no recoverable signal.
14
+ * b. extractor:trigger { session_id, cwd }
15
+ * → Muninn wakes the (debounced) extractor service which reads the
16
+ * fresh JSONL and emits ephemeral decisions verbalized in the
17
+ * assistant's responses.
18
18
  *
19
- * Replaces the legacy kawacode-capture-thoughts (Node CLI that did the file
20
- * I/O itself, never merged to main) AND kawacode-extract-trigger (separate
21
- * Node CLI that did the second IPC). The whole capture pipeline now lives
22
- * in Muninn — this dispatcher's only job is to fire the two pings.
19
+ * 2. Live-HAI collision report (opt out: KAWA_STOP_COLLISION_CHECK=off) — ONE
20
+ * IPC, stop-collision:check { repoOrigin, repoPath } (_agentId auto-stamped).
21
+ * Muninn recomputes the turn's working-tree diff and runs the transient
22
+ * /repos/collisions read once per changed file (no publish), returning the
23
+ * peers grouped by HAI plus the per-repo advisory|block mode. This is the
24
+ * once-per-turn relocation of the old per-edit Tier-2 collision check
25
+ * (COLLISION_SURFACE_RELOCATION.md). When peers overlap this turn's work:
26
+ * - advisory (default): inject the report via additionalContext (model-
27
+ * only context; the agent self-judges whether to coordinate/rework/
28
+ * surface to the user).
29
+ * - block (per-repo setting): emit { decision:"block", reason } so the
30
+ * turn stays open until the agent addresses it — but only when
31
+ * stop_hook_active is not already set, so we never loop the block.
23
32
  *
24
- * Failure discipline: every error path exits 0. Claude Code's Stop hook
25
- * must never block the turn loop on capture failure. This is the ONLY
26
- * place fail-soft is allowed under the no-Muninn-independence rule —
27
- * because the hook script is the boundary between the harness (which
28
- * can't recover) and Muninn (which can re-derive missing captures from
29
- * the transcript on the next Stop).
33
+ * 3. complete_intent hard gate (opt out: KAWA_COMPLETE_GATE=off) — blocks the
34
+ * turn when the agent ran `git commit` under an active intent but never
35
+ * finalized it with complete_intent, so distillation + code-block
36
+ * auto-capture aren't silently skipped. Detection is pure Claude Code
37
+ * transcript introspection (the hook's job, not Muninn's): scan for the
38
+ * last CONFIRMED `git commit` vs the last complete_intent tool_use. A
39
+ * commit is confirmed only when its command invokes git commit AND its
40
+ * tool_result carries git's `[<ref> <shorthash>]` success line — so a
41
+ * command that merely mentions "git commit" as data (printf/heredoc) is
42
+ * not misread as a commit. Gate only when a commit lands AFTER the most
43
+ * recent complete_intent call (or with none after it) — a failed/attempted
44
+ * complete_intent still counts as "tried", so conflict-resolution turns
45
+ * are not nagged. Then confirm via intent:get-active that THIS session
46
+ * still has an open current intent (supplies its id/title). Output mirrors
47
+ * job 2: { decision:"block", reason } guarded by !stop_hook_active; once a
48
+ * block has fired it degrades to additionalContext (block once, then
49
+ * advise — never loop). Takes precedence over the collision report on the
50
+ * turn it fires (finalizing the intent matters more; collisions re-surface
51
+ * next turn).
30
52
  *
31
- * Opt out with KAWA_THOUGHT_CAPTURE=off.
53
+ * Failure discipline: every error path exits 0. Claude Code's Stop hook must
54
+ * never block the turn loop on capture/collision failure or Muninn being down.
55
+ * This is the ONLY place fail-soft is allowed under the no-Muninn-independence
56
+ * rule — the hook is the boundary between the harness (which can't recover) and
57
+ * Muninn (which re-derives missing state on the next Stop / at complete_intent).
32
58
  */
33
59
  import { readFileSync } from 'node:fs';
60
+ import { execSync } from 'node:child_process';
34
61
  import { connectToMuninn, request, disconnect } from './services/muninn-ipc.js';
62
+ import { resolveOrigin } from './tools/resolve-origin.js';
63
+ import { detectUncompletedCommit, detectGateSave } from './stop/uncompleted-commit.js';
64
+ import { emitInjection, emitActedOn, estimateTokens } from './telemetry.js';
35
65
  function readStdin() {
36
66
  try {
37
67
  return readFileSync(0, 'utf8');
@@ -40,10 +70,206 @@ function readStdin() {
40
70
  return '';
41
71
  }
42
72
  }
73
+ /** Render one HAI's overlapping files as `path:1-3,7` (single-line ranges
74
+ * collapse to a single number). */
75
+ function formatFiles(files) {
76
+ return files
77
+ .map(f => {
78
+ const ranges = f.ranges
79
+ .map(r => (r[0] === r[1] ? `${r[0]}` : `${r[0]}-${r[1]}`))
80
+ .join(',');
81
+ return `${f.fpath}:${ranges}`;
82
+ })
83
+ .join('; ');
84
+ }
85
+ /** Lean report (payload economy — injected into the append-only transcript):
86
+ * a header plus one bullet per overlapping HAI. The guidance tail is added by
87
+ * the caller per advisory/block mode. */
88
+ function formatCollisionReport(collisions) {
89
+ const lines = [
90
+ `Live-edit collision check: ${collisions.length} collaborator(s) have in-progress edits overlapping your changes this turn.`,
91
+ ];
92
+ for (const c of collisions) {
93
+ const tag = c.isAgent ? ' (agent)' : '';
94
+ lines.push(` • ${c.label || c.uid}${tag} — ${formatFiles(c.files)}`);
95
+ }
96
+ return lines.join('\n');
97
+ }
98
+ /** Run the once-per-turn collision check. Returns the hook-protocol JSON string
99
+ * to print (advisory additionalContext or a block-to-continue), or null when
100
+ * there's nothing to surface / on any failure (fail-soft). */
101
+ async function runCollisionCheck(payload) {
102
+ if (process.env.KAWA_STOP_COLLISION_CHECK === 'off')
103
+ return null;
104
+ const cwd = payload.cwd;
105
+ if (!cwd)
106
+ return null;
107
+ let repoOrigin;
108
+ try {
109
+ repoOrigin = resolveOrigin(undefined, cwd);
110
+ }
111
+ catch {
112
+ return null; // not a git repo / git unavailable — skip
113
+ }
114
+ let res;
115
+ try {
116
+ res = await request('stop-collision', 'check', { repoOrigin, repoPath: cwd });
117
+ }
118
+ catch {
119
+ return null; // Muninn error/timeout — fail open, no report, no block
120
+ }
121
+ const collisions = res?.collisions ?? [];
122
+ if (collisions.length === 0)
123
+ return null;
124
+ const report = formatCollisionReport(collisions);
125
+ // Track-B injection (VALUE_METRICS Phase 2): size the collision report the
126
+ // hook is about to inject (block or advisory both inject `report`).
127
+ // Fire-and-forget; awaited so the socket write flushes before disconnect.
128
+ try {
129
+ await emitInjection({ type: 'stop_collision', tokensEst: estimateTokens(report), itemCount: collisions.length, repoOrigin });
130
+ }
131
+ catch { /* fire-and-forget */ }
132
+ // Block-to-continue only when the per-repo setting is on AND we're not already
133
+ // inside a prior block (else the turn can never end).
134
+ if (res?.mode === 'block' && payload.stop_hook_active !== true) {
135
+ return JSON.stringify({
136
+ decision: 'block',
137
+ reason: `${report}\n\nResolve this before ending the turn: coordinate, rework, or surface it to the user.`,
138
+ });
139
+ }
140
+ // Advisory (the default; also where block degrades when stop_hook_active).
141
+ return JSON.stringify({
142
+ hookSpecificOutput: {
143
+ hookEventName: 'Stop',
144
+ additionalContext: `${report}\n\nThis is advisory — decide whether to coordinate, rework, or surface it to the user before committing.`,
145
+ },
146
+ });
147
+ }
148
+ // ===== Job 3: complete_intent hard gate =====
149
+ /** Read the transcript file and detect an uncompleted commit (fail-soft → false). */
150
+ function scanTranscriptForUncompletedCommit(transcriptPath) {
151
+ let raw;
152
+ try {
153
+ raw = readFileSync(transcriptPath, 'utf8');
154
+ }
155
+ catch {
156
+ return false;
157
+ }
158
+ return detectUncompletedCommit(raw);
159
+ }
160
+ /** Current HEAD sha for `cwd`, or null if unavailable. */
161
+ function gitHeadSha(cwd) {
162
+ try {
163
+ return execSync('git rev-parse HEAD', { cwd, encoding: 'utf8', timeout: 5000, windowsHide: true }).trim();
164
+ }
165
+ catch {
166
+ return null;
167
+ }
168
+ }
169
+ /**
170
+ * The complete_intent hard gate. Returns the hook-protocol JSON to print
171
+ * (a block, or a degraded advisory), or null when there's nothing to gate /
172
+ * on any failure (fail-soft). Mirrors runCollisionCheck's output protocol.
173
+ */
174
+ async function runCompleteGate(payload) {
175
+ if (process.env.KAWA_COMPLETE_GATE === 'off')
176
+ return null;
177
+ const cwd = payload.cwd;
178
+ const transcriptPath = payload.transcript_path;
179
+ if (!cwd || !transcriptPath)
180
+ return null;
181
+ // Cheap, IPC-free evidence first: did the agent commit without completing?
182
+ if (!scanTranscriptForUncompletedCommit(transcriptPath))
183
+ return null;
184
+ let repoOrigin;
185
+ try {
186
+ repoOrigin = resolveOrigin(undefined, cwd);
187
+ }
188
+ catch {
189
+ return null; // not a git repo / git unavailable — skip
190
+ }
191
+ // Confirm THIS session still has an open current intent (supplies id/title).
192
+ let res;
193
+ try {
194
+ res = await request('intent', 'get-active', { repoOrigin });
195
+ }
196
+ catch {
197
+ return null; // Muninn error/timeout — fail open, no gate
198
+ }
199
+ const intent = res?.intent;
200
+ if (!intent?.id)
201
+ return null; // already finalized (completion clears current) or no intent in play
202
+ if ((intent.status || 'active') !== 'active')
203
+ return null;
204
+ const headSha = gitHeadSha(cwd);
205
+ const shaShort = headSha ? ` (${headSha.slice(0, 8)})` : '';
206
+ const title = intent.title ? `"${intent.title}"` : 'the active intent';
207
+ const call = `complete_intent(intentId="${intent.id}", status="committed"${headSha ? `, commitSha="${headSha}"` : ''})`;
208
+ const reason = `You committed${shaShort} under ${title} but didn't finalize it. Run ${call} so its ` +
209
+ `decisions distill and code blocks are captured. If this commit isn't meant to finalize the ` +
210
+ `intent, complete it with the correct status or surface it to the user.`;
211
+ // Track-B injection (VALUE_METRICS Phase 2): size the gate reason the hook is
212
+ // about to inject (block or degraded advisory both inject `reason`).
213
+ try {
214
+ await emitInjection({ type: 'stop_gate', tokensEst: estimateTokens(reason), itemCount: 1, repoOrigin });
215
+ }
216
+ catch { /* fire-and-forget */ }
217
+ // Block-to-continue, unless we already blocked once this turn (avoid a loop).
218
+ if (payload.stop_hook_active !== true) {
219
+ return JSON.stringify({ decision: 'block', reason });
220
+ }
221
+ // Degrade to advisory so the turn can end after a single block.
222
+ return JSON.stringify({
223
+ hookSpecificOutput: {
224
+ hookEventName: 'Stop',
225
+ additionalContext: `Reminder — ${reason}`,
226
+ },
227
+ });
228
+ }
229
+ /**
230
+ * Gate-SAVE acted-on signal (VALUE_METRICS V8 / R2). Emits acted_on{stop_gate}
231
+ * when a prior Stop block held the turn open (`stop_hook_active`) AND the
232
+ * transcript now shows a confirmed commit finalized by a complete_intent — i.e.
233
+ * the gate preceded a completion that would otherwise have skipped distillation
234
+ * + block auto-capture. Fire-and-forget; returns its emit promise so main() can
235
+ * flush it before disconnect. Correlation, not causation.
236
+ */
237
+ async function emitGateSaveSignal(payload) {
238
+ if (process.env.KAWA_COMPLETE_GATE === 'off')
239
+ return;
240
+ if (payload.stop_hook_active !== true)
241
+ return; // only after a block held the turn open
242
+ const cwd = payload.cwd;
243
+ const transcriptPath = payload.transcript_path;
244
+ if (!cwd || !transcriptPath)
245
+ return;
246
+ let raw;
247
+ try {
248
+ raw = readFileSync(transcriptPath, 'utf8');
249
+ }
250
+ catch {
251
+ return;
252
+ }
253
+ if (!detectGateSave(raw))
254
+ return;
255
+ let repoOrigin;
256
+ try {
257
+ repoOrigin = resolveOrigin(undefined, cwd);
258
+ }
259
+ catch {
260
+ return;
261
+ }
262
+ try {
263
+ await emitActedOn({ type: 'stop_gate', repoOrigin });
264
+ }
265
+ catch { /* fire-and-forget */ }
266
+ }
43
267
  async function main() {
44
- if (process.env.KAWA_THOUGHT_CAPTURE === 'off') {
268
+ const captureOff = process.env.KAWA_THOUGHT_CAPTURE === 'off';
269
+ const collisionOff = process.env.KAWA_STOP_COLLISION_CHECK === 'off';
270
+ const gateOff = process.env.KAWA_COMPLETE_GATE === 'off';
271
+ if (captureOff && collisionOff && gateOff)
45
272
  process.exit(0);
46
- }
47
273
  const raw = readStdin();
48
274
  if (!raw)
49
275
  process.exit(0);
@@ -57,31 +283,55 @@ async function main() {
57
283
  const sessionId = payload.session_id;
58
284
  const transcriptPath = payload.transcript_path;
59
285
  const cwd = payload.cwd;
60
- if (!sessionId || !transcriptPath)
61
- process.exit(0);
62
286
  try {
63
287
  await connectToMuninn();
64
288
  }
65
289
  catch {
66
- // Muninn down. Capture happens whenever Muninn is next up — the
67
- // extractor's checkpoint advances on the next successful capture.
290
+ // Muninn down. Capture happens whenever Muninn is next up (the extractor's
291
+ // checkpoint advances on the next successful capture); collision detection
292
+ // simply yields no report this turn.
68
293
  process.exit(0);
69
294
  }
70
- // Fire both IPCs in parallel; each is independent and tolerant of the
71
- // other's failure. allSettled because we never want one to short-circuit
72
- // the other on transient failure.
73
- await Promise.allSettled([
74
- request('capture-thoughts', 'capture', {
295
+ // Fire-and-forget side tasks awaited before disconnect so their socket writes
296
+ // flush. Includes thought capture (below) and the Track-B gate-save acted-on
297
+ // signal (VALUE_METRICS Phase 2).
298
+ const captureTasks = [];
299
+ captureTasks.push(emitGateSaveSignal(payload));
300
+ if (!captureOff && sessionId && transcriptPath) {
301
+ captureTasks.push(request('capture-thoughts', 'capture', {
75
302
  sessionId,
76
303
  transcriptPath,
77
304
  cwd: cwd ?? null,
78
- }),
79
- request('extractor', 'trigger', {
305
+ }), request('extractor', 'trigger', {
80
306
  session_id: sessionId,
81
307
  cwd: cwd ?? '',
82
- }),
83
- ]);
308
+ }));
309
+ }
310
+ // Hook-protocol stdout producers, in precedence order. The complete_intent
311
+ // gate wins the turn it fires (finalizing the intent matters more than a
312
+ // collision advisory; collisions re-surface next turn). Only one JSON object
313
+ // may be written, so fall through to the collision report only when the gate
314
+ // produced nothing (the common case).
315
+ let output = null;
316
+ try {
317
+ output = await runCompleteGate(payload);
318
+ }
319
+ catch {
320
+ output = null; // belt-and-suspenders fail-soft
321
+ }
322
+ if (!output) {
323
+ try {
324
+ output = await runCollisionCheck(payload);
325
+ }
326
+ catch {
327
+ output = null;
328
+ }
329
+ }
330
+ if (captureTasks.length > 0)
331
+ await Promise.allSettled(captureTasks);
84
332
  disconnect();
333
+ if (output)
334
+ process.stdout.write(output + '\n');
85
335
  process.exit(0);
86
336
  }
87
337
  main().catch(() => process.exit(0));
@@ -1 +1 @@
1
- {"version":3,"file":"kawacode-on-stop.js","sourceRoot":"","sources":["../src/kawacode-on-stop.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAS/E,SAAS,SAAS;IAChB,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,KAAK,KAAK,EAAE,CAAC;QAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,MAAM,GAAG,GAAG,SAAS,EAAE,CAAA;IACvB,IAAI,CAAC,GAAG;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAEzB,IAAI,OAAoB,CAAA;IACxB,IAAI,CAAC;QACH,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAA;IACpC,MAAM,cAAc,GAAG,OAAO,CAAC,eAAe,CAAA;IAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;IACvB,IAAI,CAAC,SAAS,IAAI,CAAC,cAAc;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAElD,IAAI,CAAC;QACH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"}
@@ -9,7 +9,25 @@
9
9
  * - Request/response correlation via _msgId
10
10
  * - 30s default timeout per request, overridable per call
11
11
  */
12
- /** Stable session ID for this MCP process. Identifies this agent in intent attribution. */
12
+ /**
13
+ * Stable session ID for this MCP process — identifies this agent/session for
14
+ * intent attribution AND for the per-session "current" intent pointer in Muninn
15
+ * (IMPLEMENTATION_PLAN_MULTI_ACTIVE_INTENTS.md §2 D1).
16
+ *
17
+ * Prefer Claude Code's `CLAUDE_CODE_SESSION_ID`: it's the SAME id the thought-
18
+ * capture path keys on (the `thoughts/active/session-{id}.jsonl` filename and the
19
+ * extractor trigger), so the IPC and capture worlds converge on one value, and it
20
+ * is stable across MCP reconnects (a fresh socket `caw` recovers the same focus).
21
+ * Subagents share their parent session's id — there is no per-subagent id at the
22
+ * MCP layer (see plan §11).
23
+ *
24
+ * Fallback: hosts that don't set the env var (Cursor/Windsurf, older Claude Code)
25
+ * get a generated `mcp-<random>`. Those have no Claude thought-capture, so capture
26
+ * routing is moot and the random id serves only as an IPC discriminator.
27
+ *
28
+ * Stamped as `_agentId` on every outgoing message (see `request()` below); Muninn
29
+ * lifts it into `IpcMessage.aid` and keys the per-session current pointer on it.
30
+ */
13
31
  export declare const SESSION_ID: string;
14
32
  /**
15
33
  * Connect to Muninn's Huginn IPC socket.
@@ -16,8 +16,26 @@ import * as os from 'os';
16
16
  import * as crypto from 'crypto';
17
17
  const EXTENSION_ID = 'mcp';
18
18
  const EXTENSION_DOMAINS = ['intent', 'intent-block', 'decision', 'claude-code', 'code', 'inference'];
19
- /** Stable session ID for this MCP process. Identifies this agent in intent attribution. */
20
- export const SESSION_ID = `mcp-${crypto.randomBytes(4).toString('hex')}`;
19
+ /**
20
+ * Stable session ID for this MCP process — identifies this agent/session for
21
+ * intent attribution AND for the per-session "current" intent pointer in Muninn
22
+ * (IMPLEMENTATION_PLAN_MULTI_ACTIVE_INTENTS.md §2 D1).
23
+ *
24
+ * Prefer Claude Code's `CLAUDE_CODE_SESSION_ID`: it's the SAME id the thought-
25
+ * capture path keys on (the `thoughts/active/session-{id}.jsonl` filename and the
26
+ * extractor trigger), so the IPC and capture worlds converge on one value, and it
27
+ * is stable across MCP reconnects (a fresh socket `caw` recovers the same focus).
28
+ * Subagents share their parent session's id — there is no per-subagent id at the
29
+ * MCP layer (see plan §11).
30
+ *
31
+ * Fallback: hosts that don't set the env var (Cursor/Windsurf, older Claude Code)
32
+ * get a generated `mcp-<random>`. Those have no Claude thought-capture, so capture
33
+ * routing is moot and the random id serves only as an IPC discriminator.
34
+ *
35
+ * Stamped as `_agentId` on every outgoing message (see `request()` below); Muninn
36
+ * lifts it into `IpcMessage.aid` and keys the per-session current pointer on it.
37
+ */
38
+ export const SESSION_ID = process.env.CLAUDE_CODE_SESSION_ID || `mcp-${crypto.randomBytes(4).toString('hex')}`;
21
39
  const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
22
40
  const HANDSHAKE_TIMEOUT_MS = 10_000;
23
41
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"muninn-ipc.js","sourceRoot":"","sources":["../../src/services/muninn-ipc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,GAAG,MAAM,KAAK,CAAA;AAC1B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,MAAM,YAAY,GAAG,KAAK,CAAA;AAC1B,MAAM,iBAAiB,GAAG,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;AAEpG,2FAA2F;AAC3F,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAA;AACxE,MAAM,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AE,CAAC;QACX,MAAM,CAAC,OAAO,EAAE,CAAA;IAClB,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC;AAED,SAAS,OAAO;IACd,SAAS,GAAG,KAAK,CAAA;IACjB,MAAM,GAAG,IAAI,CAAA;IACb,iBAAiB,GAAG,IAAI,CAAA;IAExB,8BAA8B;IAC9B,KAAK,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,eAAe,EAAE,CAAC;QAC5C,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAC3B,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC,CAAA;IACvD,CAAC;IACD,eAAe,CAAC,KAAK,EAAE,CAAA;AACzB,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Pure transcript detection for the complete_intent hard gate (kawacode-on-stop
3
+ * job 3). Kept separate from the bin entry so it's unit-testable without
4
+ * triggering the hook's main().
5
+ *
6
+ * The signal we want: the agent ran `git commit` but never finalized the work
7
+ * with complete_intent. We read Claude Code's own transcript (harness
8
+ * introspection — not Muninn's concern) and compare the position of the last
9
+ * SUCCESSFUL commit against the last complete_intent call.
10
+ */
11
+ /** Flatten a tool_result `content` (string | array of {type,text}) to plain text. */
12
+ export declare function toolResultText(content: unknown): string;
13
+ /** A Bash command that *invokes* `git commit` (incl. `git -C <path> commit`),
14
+ * excluding dry runs. NOTE: a true match here is necessary but NOT sufficient —
15
+ * a command can merely MENTION "git commit" as data (printf/echo/heredoc/docs,
16
+ * `git log --grep`). Confirm an actual commit with {@link looksLikeCommitOutput}
17
+ * on the tool_result before treating it as a commit. */
18
+ export declare function isGitCommitCommand(name: string, cmd: string): boolean;
19
+ /**
20
+ * True when text contains git's commit-success line: `[<ref> <shorthash>] …`
21
+ * (covers commit / amend / merge / cherry-pick / root-commit). This is the
22
+ * authoritative "a commit actually happened" signal — `git log`/`git show` and
23
+ * non-git output don't produce a bracketed short-hash line, and a command that
24
+ * only mentions "git commit" as data produces no such output at all.
25
+ *
26
+ * Tradeoff: `git commit --quiet` suppresses this line, so a quiet commit is a
27
+ * false NEGATIVE (no gate). That's the safe bias for a hard gate — a missed nag
28
+ * is far less disruptive than a false block (the printf-in-transcript bug).
29
+ */
30
+ export declare function looksLikeCommitOutput(text: string): boolean;
31
+ /**
32
+ * True when the transcript shows a SUCCESSFUL `git commit` tool_use that lands
33
+ * after the most recent complete_intent tool_use (or with no complete_intent
34
+ * after it) — i.e. the agent committed without finalizing.
35
+ *
36
+ * A commit counts only when BOTH hold: the command invokes git commit AND its
37
+ * tool_result carries the commit-success signature (not is_error). Requiring
38
+ * the result signature is what stops a command that merely *mentions* "git
39
+ * commit" (e.g. a printf crafting a fixture) from being read as a real commit.
40
+ * A complete_intent call counts even if it later failed (conflicts): the agent
41
+ * tried, so we don't nag.
42
+ *
43
+ * @param transcriptText raw JSONL contents of the Claude Code transcript
44
+ */
45
+ export declare function detectUncompletedCommit(transcriptText: string): boolean;
46
+ /**
47
+ * Gate-SAVE detection (VALUE_METRICS.md V8): the inverse of an uncompleted
48
+ * commit — a CONFIRMED `git commit` exists AND a complete_intent call lands at
49
+ * or after it (the commit was finalized). Used at the Stop hook to emit the
50
+ * acted-on signal only when a prior gate block held the turn open
51
+ * (`stop_hook_active`) and the agent then completed the intent — i.e. the gate
52
+ * preceded a completion that would otherwise have skipped distillation +
53
+ * block auto-capture.
54
+ *
55
+ * Mirrors detectUncompletedCommit's parsing exactly (a commit counts only when
56
+ * its tool_result carries the commit-success signature, per decision 64b340d8 —
57
+ * a command merely MENTIONING "git commit" does not count) and flips the final
58
+ * position comparison.
59
+ *
60
+ * Correlation, not causation: this says "a completion followed a confirmed
61
+ * commit while the turn was held open", not "the gate caused the completion".
62
+ */
63
+ export declare function detectGateSave(transcriptText: string): boolean;