@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,6 +2,7 @@ import { z } from 'zod';
2
2
  import { request } from '../services/muninn-ipc.js';
3
3
  import { resolveOrigin } from './resolve-origin.js';
4
4
  import { forkFieldsExtensions, extractForkFields } from './_fork-fields.js';
5
+ import { emitInjection, estimateTokens } from '../telemetry.js';
5
6
  export const checkActiveIntentSchema = z.object({
6
7
  repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
7
8
  repoPath: z.string().describe('Local path to the repository root'),
@@ -13,33 +14,64 @@ export async function checkActiveIntent(input) {
13
14
  repoOrigin: actualOrigin,
14
15
  ...extractForkFields(input),
15
16
  });
16
- // Muninn returns { hasActiveIntent, intentId, intent }
17
+ // Muninn returns { hasActiveIntent, intentId, intent, activeIntents }.
18
+ // The active set is present regardless of whether THIS session has a current.
19
+ const activeIntents = Array.isArray(res.activeIntents)
20
+ ? res.activeIntents.map((it) => ({
21
+ id: it.id || it._id || '',
22
+ title: it.title || '',
23
+ status: it.status || 'active',
24
+ createdBy: it.createdBy || undefined,
25
+ author: it.authorInfo?.name || it.author || undefined,
26
+ }))
27
+ : [];
17
28
  const intent = res.intent;
29
+ let response;
18
30
  if (!intent) {
19
- return { hasActiveIntent: false };
31
+ response = { hasActiveIntent: false, activeIntents };
20
32
  }
21
- return {
22
- hasActiveIntent: true,
23
- intent: {
24
- id: intent.id || res.intentId || '',
25
- title: intent.title || '',
26
- description: intent.description || '',
27
- templateType: (intent.templateType || 'feature'),
28
- constraints: intent.constraints || [],
29
- status: intent.status || 'active',
30
- pendingReason: intent.pendingReason,
31
- branch: intent.branch || '',
32
- forkedFrom: intent.forkedFrom,
33
- blocks: [] // Blocks are tracked separately by intent-block service
34
- }
35
- };
33
+ else {
34
+ response = {
35
+ hasActiveIntent: true,
36
+ activeIntents,
37
+ intent: {
38
+ id: intent.id || res.intentId || '',
39
+ title: intent.title || '',
40
+ description: intent.description || '',
41
+ templateType: (intent.templateType || 'feature'),
42
+ constraints: intent.constraints || [],
43
+ status: intent.status || 'active',
44
+ branch: intent.branch || '',
45
+ forkedFrom: intent.forkedFrom,
46
+ blocks: [] // Blocks are tracked separately by intent-block service
47
+ }
48
+ };
49
+ }
50
+ // Track-B injection telemetry (VALUE_METRICS Phase 2): size the serialized
51
+ // result (≈ chars/4); itemCount = active-set size + 1 if this session has a
52
+ // current intent. Fire-and-forget — never blocks the tool result.
53
+ void emitInjection({
54
+ type: 'check_active',
55
+ tokensEst: estimateTokens(JSON.stringify(response)),
56
+ itemCount: activeIntents.length + (intent ? 1 : 0),
57
+ repoOrigin: actualOrigin,
58
+ });
59
+ return response;
36
60
  }
37
61
  export const checkActiveIntentTool = {
38
62
  name: 'check_active_intent',
39
63
  description: `REQUIRED: Call this tool BEFORE writing any code.
40
64
 
41
- Returns the currently active intent if one exists. If no active intent is set,
42
- you should ask the user to confirm intent details and then call create_and_activate_intent.
65
+ Returns THIS session's current intent (\`intent\` / \`hasActiveIntent\`) if one is
66
+ set. If not, ask the user to confirm intent details and then call
67
+ create_and_activate_intent.
68
+
69
+ Multi-active model: the active intent is PER SESSION. Many intents can be active
70
+ on a repo at once — your current is independent of other sessions'/teammates'.
71
+ The response also includes \`activeIntents\`: the repo's full active set (every
72
+ session's current intent, with id/title/status/createdBy/author) for awareness
73
+ and orchestration. \`hasActiveIntent\` reflects only YOUR session; \`activeIntents\`
74
+ may be non-empty even when you have no current.
43
75
 
44
76
  An active intent tracks what the user is working on, enabling:
45
77
  - Better code context for AI-generated changes
@@ -47,14 +79,9 @@ An active intent tracks what the user is working on, enabling:
47
79
  - Automatic assignment of code blocks to the intent
48
80
 
49
81
  Status semantics:
50
- - "active" — normal, in-progress.
51
- - "pending" — auto-finalized by the orphan-recovery sweeper or blocked at
52
- completion by conflicts. Pending is treated as live context for the repo:
53
- prompt the user to resume the work (activate_intent) or finalize it
54
- (complete_intent) before starting new unrelated work. Inspect "pendingReason"
55
- to tell the user WHY the intent went pending — "sweeper-auto-finalize"
56
- (24h idle) or "sweeper-blocked-conflicts" (decisions contradicted standards
57
- on the auto-finalize attempt).`,
82
+ - "active" — normal, in-progress. A stale intent simply stays "active"; the
83
+ sweeper preserves its work without any status transition.
84
+ - terminal states — committed / pushed / done / abandoned / superseded.`,
58
85
  inputSchema: checkActiveIntentSchema,
59
86
  handler: checkActiveIntent
60
87
  };
@@ -1 +1 @@
1
- {"version":3,"file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,CAAC,MAAM,CAAC,YAAY,IAAI,SAAS,CAA2C;gBAC1F,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,EAAE;gBACrC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,QAAQ;gBACjC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;gBAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,MAAM,EAAE,EAAE,CAAC,wDAAwD;aACpE;SACF,CAAA;IACH,CAAC;IAED,2EAA2E;IAC3E,4EAA4E;IAC5E,kEAAkE;IAClE,KAAK,aAAa,CAAC;QACjB,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACnD,SAAS,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,UAAU,EAAE,YAAY;KACzB,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;wEAqByD;IACtE,WAAW,EAAE,uBAAuB;IACpC,OAAO,EAAE,iBAAiB;CAC3B,CAAA"}
@@ -20,6 +20,7 @@ export declare const completeIntentSchema: z.ZodObject<{
20
20
  commitSha: z.ZodOptional<z.ZodString>;
21
21
  status: z.ZodDefault<z.ZodEnum<["committed", "pushed", "done", "abandoned", "superseded"]>>;
22
22
  supersededBy: z.ZodOptional<z.ZodString>;
23
+ humanApproved: z.ZodOptional<z.ZodBoolean>;
23
24
  }, "strip", z.ZodTypeAny, {
24
25
  status: "committed" | "pushed" | "done" | "abandoned" | "superseded";
25
26
  repoPath: string;
@@ -33,6 +34,7 @@ export declare const completeIntentSchema: z.ZodObject<{
33
34
  intentId?: string | undefined;
34
35
  commitSha?: string | undefined;
35
36
  supersededBy?: string | undefined;
37
+ humanApproved?: boolean | undefined;
36
38
  }, {
37
39
  repoPath: string;
38
40
  status?: "committed" | "pushed" | "done" | "abandoned" | "superseded" | undefined;
@@ -46,14 +48,20 @@ export declare const completeIntentSchema: z.ZodObject<{
46
48
  intentId?: string | undefined;
47
49
  commitSha?: string | undefined;
48
50
  supersededBy?: string | undefined;
51
+ humanApproved?: boolean | undefined;
49
52
  }>;
50
53
  export type CompleteIntentInput = z.infer<typeof completeIntentSchema>;
51
54
  /**
52
55
  * One contradiction between a distilled proposed decision and an existing
53
56
  * standard decision in the repo. Surfaced when distillation produces decisions
54
- * that conflict with previously-recorded ones (PRD §5.2 step 5b / §7.2).
57
+ * that conflict with previously-recorded ones. Since COMPLETION_CONFLICT_DECOUPLE.md
58
+ * these no longer block completion — the commit (status + blocks) already landed;
59
+ * each conflicting decision is *parked* for an async disposition in the
60
+ * Orchestration panel (supersede / keep-both / reject).
55
61
  */
56
62
  export interface ConflictMatch {
63
+ /** Stable distillation id of the proposed decision; the panel keys the disposition on it. */
64
+ proposedDecisionId?: string;
57
65
  proposedDecisionSummary: string;
58
66
  proposedDecisionRationale: string;
59
67
  conflictsWith: {
@@ -65,6 +73,22 @@ export interface ConflictMatch {
65
73
  sharedConcern?: string;
66
74
  description?: string;
67
75
  }
76
+ /**
77
+ * A live collaborator (HAI: teammate or AI agent) whose published in-progress
78
+ * diff overlaps the work just completed, grouped by HAI across all files
79
+ * (Layer C completion-time collision query). Advisory awareness only — it does
80
+ * not block completion; the overlap is exact (both sides are in the shared
81
+ * baseline / cSHA line-space).
82
+ */
83
+ export interface CompletionCollision {
84
+ uid: string;
85
+ isAgent: boolean;
86
+ label: string;
87
+ files: {
88
+ fpath: string;
89
+ ranges: number[][];
90
+ }[];
91
+ }
68
92
  export interface CompleteIntentResponse {
69
93
  success: boolean;
70
94
  intentId: string;
@@ -88,20 +112,19 @@ export interface CompleteIntentResponse {
88
112
  */
89
113
  committedDecisionCount?: number;
90
114
  /**
91
- * Non-empty when the proposed-decision distillation contradicted existing
92
- * standard decisions. Each entry pairs the proposed decision with the
93
- * specific standard decision it contradicts, so the agent can surface the
94
- * pair to the user. When conflicts is non-empty, success=false and
95
- * newStatus stays "active" — the user resolves and retries.
115
+ * Non-empty when distillation produced decisions that contradict existing
116
+ * standards. Since COMPLETION_CONFLICT_DECOUPLE.md the completion still
117
+ * SUCCEEDED (success=true, status flipped, blocks captured) — these decisions
118
+ * are *deferred*: parked for an async disposition in the Orchestration panel
119
+ * (supersede / keep-both / reject). There is nothing to retry.
96
120
  */
97
- conflicts?: ConflictMatch[];
121
+ deferredConflicts?: ConflictMatch[];
98
122
  /**
99
- * Set when success=false to discriminate between:
100
- * - "conflicts" → see `conflicts[]`
123
+ * Set when success=false to discriminate the failure mode:
101
124
  * - "transient-failure" → distiller LLM call or /check-conflicts API errored;
102
125
  * `failedStage` and `error` carry diagnostics, the user retries.
103
126
  */
104
- reason?: 'conflicts' | 'transient-failure';
127
+ reason?: 'transient-failure';
105
128
  failedStage?: string;
106
129
  error?: string;
107
130
  /**
@@ -114,6 +137,13 @@ export interface CompleteIntentResponse {
114
137
  deferredStages?: string[];
115
138
  deferredDecisionCount?: number;
116
139
  deferredError?: string;
140
+ /**
141
+ * Layer C completion-time collision query: live HAIs whose published diffs
142
+ * overlap the work just completed (grouped by HAI). Present only on a
143
+ * successful completion when at least one overlap exists. Advisory — surface
144
+ * it to the user as a coordination heads-up; it does not affect success.
145
+ */
146
+ collisions?: CompletionCollision[];
117
147
  }
118
148
  export declare function completeIntent(input: CompleteIntentInput): Promise<CompleteIntentResponse>;
119
149
  export declare const completeIntentTool: {
@@ -140,6 +170,7 @@ export declare const completeIntentTool: {
140
170
  commitSha: z.ZodOptional<z.ZodString>;
141
171
  status: z.ZodDefault<z.ZodEnum<["committed", "pushed", "done", "abandoned", "superseded"]>>;
142
172
  supersededBy: z.ZodOptional<z.ZodString>;
173
+ humanApproved: z.ZodOptional<z.ZodBoolean>;
143
174
  }, "strip", z.ZodTypeAny, {
144
175
  status: "committed" | "pushed" | "done" | "abandoned" | "superseded";
145
176
  repoPath: string;
@@ -153,6 +184,7 @@ export declare const completeIntentTool: {
153
184
  intentId?: string | undefined;
154
185
  commitSha?: string | undefined;
155
186
  supersededBy?: string | undefined;
187
+ humanApproved?: boolean | undefined;
156
188
  }, {
157
189
  repoPath: string;
158
190
  status?: "committed" | "pushed" | "done" | "abandoned" | "superseded" | undefined;
@@ -166,6 +198,7 @@ export declare const completeIntentTool: {
166
198
  intentId?: string | undefined;
167
199
  commitSha?: string | undefined;
168
200
  supersededBy?: string | undefined;
201
+ humanApproved?: boolean | undefined;
169
202
  }>;
170
203
  handler: typeof completeIntent;
171
204
  };
@@ -5,41 +5,23 @@ import { forkFieldsExtensions, extractForkFields } from './_fork-fields.js';
5
5
  export const completeIntentSchema = z.object({
6
6
  repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
7
7
  repoPath: z.string().describe('Local path to the repository root'),
8
- intentId: z.string().optional().describe('Expected intent ID to complete. If provided, the tool verifies this matches the active intent and rejects if mismatched (prevents race conditions with concurrent sessions).'),
8
+ intentId: z.string().optional().describe('Target intent to complete/abandon. When omitted, completes THIS session\'s current intent. When provided, targets that specific intent directly — this is how you force-close an intent that is not your current one (e.g. another session\'s). Completing an intent created by ANOTHER team member additionally requires humanApproved=true (see below).'),
9
9
  commitSha: z.string().optional().describe('The git commit SHA to associate with this intent (if already committed)'),
10
10
  status: z.enum(['committed', 'pushed', 'done', 'abandoned', 'superseded']).default('committed')
11
11
  .describe('The new status for the intent. Use "committed" after git commit, "done" when work is complete, "abandoned" to discard, "superseded" when another intent replaces this one.'),
12
12
  supersededBy: z.string().optional().describe('Intent ID that supersedes this one. Required when status is "superseded".'),
13
+ humanApproved: z.boolean().optional().describe('Set to true ONLY when the human has explicitly confirmed closing an intent created by ANOTHER team member. Required for that cross-author case; ignored for your own intents. NEVER set this on your own initiative — always ask the user first and only set it after they approve.'),
13
14
  ...forkFieldsExtensions,
14
15
  });
15
16
  export async function completeIntent(input) {
16
17
  const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
17
- // If intentId provided, verify it matches the active intent before completing
18
- if (input.intentId) {
19
- const activeRes = await request('intent', 'get-active', { repoOrigin: actualOrigin });
20
- const activeId = activeRes.intentId || activeRes.intent?.id || '';
21
- if (!activeId) {
22
- return {
23
- success: false,
24
- intentId: input.intentId,
25
- previousStatus: 'unknown',
26
- newStatus: input.status,
27
- commitSha: input.commitSha,
28
- message: `No active intent found. Expected intent ${input.intentId.substring(0, 8)} but nothing is active.`
29
- };
30
- }
31
- if (activeId !== input.intentId) {
32
- const activeTitle = activeRes.intent?.title || 'unknown';
33
- return {
34
- success: false,
35
- intentId: input.intentId,
36
- previousStatus: 'unknown',
37
- newStatus: input.status,
38
- commitSha: input.commitSha,
39
- message: `Intent mismatch: expected ${input.intentId.substring(0, 8)} but active intent is "${activeTitle}" (${activeId.substring(0, 8)}). Another session may have changed the active intent.`
40
- };
41
- }
42
- }
18
+ // Multi-active model (IMPLEMENTATION_PLAN_MULTI_ACTIVE_INTENTS.md §7): `intentId`
19
+ // is a TARGET, forwarded to Muninn directly. When omitted, Muninn completes this
20
+ // session's current pointer; when provided, it targets that specific intent
21
+ // (force-close). There is no per-repo single "active" intent to verify against
22
+ // anymore, so the old get-active match-or-reject guard is gone. The same-user vs
23
+ // cross-user authorization (and the humanApproved requirement for closing a
24
+ // teammate's intent) is hard-enforced API-side.
43
25
  // Muninn's v2 distillation pipeline (Sonnet distill + per-pair Haiku conflict
44
26
  // judge + recall embeddings) can run well past the 30s default — measured
45
27
  // 51s for superseded on an M3 (see kawa.muninn intent.rs). Override the
@@ -49,53 +31,27 @@ export async function completeIntent(input) {
49
31
  const COMPLETE_TIMEOUT_MS = 180_000;
50
32
  const res = await request('intent', 'complete', {
51
33
  repoOrigin: actualOrigin,
34
+ intentId: input.intentId,
52
35
  status: input.status,
53
36
  commitSha: input.commitSha,
54
37
  supersededBy: input.supersededBy,
38
+ humanApproved: input.humanApproved,
55
39
  ...extractForkFields(input),
56
40
  }, COMPLETE_TIMEOUT_MS);
57
41
  const intentId = res.intentId || '';
58
42
  const intentTitle = res.intentTitle || 'Intent';
59
43
  const previousStatus = res.previousStatus || 'active';
60
44
  const success = res.success !== false;
61
- const conflicts = Array.isArray(res.conflicts) ? res.conflicts : [];
45
+ const deferredConflicts = Array.isArray(res.deferredConflicts) ? res.deferredConflicts : [];
62
46
  const committedDecisionCount = typeof res.committedDecisionCount === 'number' ? res.committedDecisionCount : undefined;
63
- const reason = res.reason === 'conflicts' || res.reason === 'transient-failure' ? res.reason : undefined;
47
+ const reason = res.reason === 'transient-failure' ? res.reason : undefined;
64
48
  const apiSyncDeferred = res.apiSyncDeferred === true;
65
- // Branch on the four §7.2 / §7.3 outcome shapes — pick the message that
66
- // tells the agent exactly what to surface to the user.
49
+ const completionCollisions = Array.isArray(res.collisions) ? res.collisions : [];
50
+ // Branch on the outcome shape — pick the message that tells the agent exactly
51
+ // what to surface to the user.
67
52
  let newStatus;
68
53
  let message;
69
- if (!success && reason === 'conflicts') {
70
- // PRD §5.2 step 5b — distilled decisions contradicted standards. No write,
71
- // no transition, bucket preserved. The agent's job is to surface each
72
- // conflict to the user and ask how to resolve.
73
- newStatus = res.status || 'active';
74
- const lines = [
75
- `Cannot complete: ${conflicts.length} conflict(s) between proposed decisions and existing standards.`,
76
- '',
77
- 'For each conflict below, surface BOTH sides side-by-side to the user and ask how to resolve.',
78
- 'Common resolution paths:',
79
- ' (A) Record a superseding decision: record_decision(type="fork", supersedes=["<existing-decision-id>"], rationale=...). Then retry complete_intent.',
80
- ' (B) Abandon the intent: complete_intent(status="abandoned"). Decisions are soft-deleted but recoverable via activate_intent.',
81
- ' (C) Keep the intent active and continue working.',
82
- '',
83
- 'DO NOT silently retry — every retry runs the distiller again and produces the same conflicts.',
84
- '',
85
- ];
86
- conflicts.forEach((c, i) => {
87
- lines.push(`[${i + 1}] Proposed: ${c.proposedDecisionSummary}`);
88
- const cw = c.conflictsWith || {};
89
- const author = cw.author ? ` by ${cw.author}` : '';
90
- const intentPart = cw.intentTitle ? ` (intent: "${cw.intentTitle}")` : '';
91
- lines.push(` Conflicts with: ${cw.summary || cw.decisionId || '(unknown)'}${intentPart}${author}`);
92
- if (c.description)
93
- lines.push(` ${c.description}`);
94
- lines.push('');
95
- });
96
- message = lines.join('\n');
97
- }
98
- else if (!success && reason === 'transient-failure') {
54
+ if (!success && reason === 'transient-failure') {
99
55
  // Distiller LLM error or /check-conflicts API error. Bucket re-populated,
100
56
  // intent stays active. User decides whether to wait + retry or abandon.
101
57
  newStatus = res.status || 'active';
@@ -130,7 +86,21 @@ export async function completeIntent(input) {
130
86
  const deferredPart = apiSyncDeferred
131
87
  ? ` — API sync deferred (${(res.deferredStages || []).join(', ')}); will retry on the next sync tick`
132
88
  : '';
133
- message = statusMsg + shaPart + distilledPart + deferredPart;
89
+ // Layer C: a live HAI's in-progress diff overlaps the work just completed.
90
+ // Advisory coordination heads-up appended to the success message.
91
+ const collisionPart = completionCollisions.length > 0
92
+ ? ` — heads-up: ${completionCollisions.length} live collaborator(s) overlap this work: ` +
93
+ completionCollisions
94
+ .map(c => `${c.label}${c.isAgent ? ' (agent)' : ''} on ${c.files.map(f => f.fpath).join(', ')}`)
95
+ .join('; ')
96
+ : '';
97
+ // COMPLETION_CONFLICT_DECOUPLE.md: distilled decisions that conflicted with
98
+ // standards did NOT block the completion — they're parked for a disposition
99
+ // in the Orchestration panel. Surface the count; there is nothing to retry.
100
+ const deferredConflictPart = deferredConflicts.length > 0
101
+ ? ` — ${deferredConflicts.length} distilled decision(s) need a disposition in the Orchestration panel (supersede / keep-both / reject)`
102
+ : '';
103
+ message = statusMsg + shaPart + distilledPart + deferredPart + collisionPart + deferredConflictPart;
134
104
  }
135
105
  return {
136
106
  success,
@@ -140,7 +110,7 @@ export async function completeIntent(input) {
140
110
  commitSha: input.commitSha,
141
111
  message,
142
112
  committedDecisionCount,
143
- conflicts: conflicts.length > 0 ? conflicts : undefined,
113
+ deferredConflicts: deferredConflicts.length > 0 ? deferredConflicts : undefined,
144
114
  reason,
145
115
  failedStage: res.failedStage,
146
116
  error: res.error,
@@ -148,6 +118,7 @@ export async function completeIntent(input) {
148
118
  deferredStages: Array.isArray(res.deferredStages) ? res.deferredStages : undefined,
149
119
  deferredDecisionCount: typeof res.deferredDecisionCount === 'number' ? res.deferredDecisionCount : undefined,
150
120
  deferredError: res.deferredError,
121
+ collisions: completionCollisions.length > 0 ? completionCollisions : undefined,
151
122
  };
152
123
  }
153
124
  export const completeIntentTool = {
@@ -165,7 +136,7 @@ Status values:
165
136
  - "done": Work is fully complete
166
137
  - "abandoned": Work was discarded without committing
167
138
 
168
- REQUIRED: Inspect the response after calling this tool. Four outcomes:
139
+ REQUIRED: Inspect the response after calling this tool. Three outcomes:
169
140
 
170
141
  1. response.success === true:
171
142
  The task is complete. Briefly acknowledge the commit and — if
@@ -175,33 +146,29 @@ REQUIRED: Inspect the response after calling this tool. Four outcomes:
175
146
  get_intent_decisions / get_relevant_context if the user wants details.
176
147
  If response.apiSyncDeferred === true, also mention that the API sync was
177
148
  deferred; the queued writes will replay on the next sync tick.
149
+ If response.collisions is non-empty, a live collaborator's (HAI's)
150
+ in-progress edits overlap the work you just completed — surface it as a
151
+ coordination heads-up (who, and which files), naming response.collisions[].label
152
+ and the files. It's advisory, not a failure; the completion still succeeded.
153
+ If response.deferredConflicts is non-empty, the distillation produced N
154
+ decisions that conflict with existing standards — the completion STILL
155
+ SUCCEEDED (the commit landed: status flipped, code blocks captured). Those
156
+ decisions are deferred: parked for a disposition in the Orchestration panel,
157
+ where the user picks per decision: supersede the standard, keep both (records
158
+ a "contradicts" edge for a deliberate divergence / false positive), or reject
159
+ the distilled decision. Tell the user "N decision(s) need a disposition in
160
+ the panel." There is NOTHING to retry — do NOT re-run complete_intent.
178
161
 
179
- 2. response.success === false AND response.conflicts is non-empty:
180
- The distillation produced decisions that contradict existing standards in
181
- this repo. Status stays "active" and NO decisions were written.
182
- Surface EACH conflict to the user with the proposed decision and the
183
- conflicting standard decision side-by-side. Then ask the user how to
184
- resolve. Common options to suggest:
185
- (A) Record a superseding decision via record_decision(type="fork",
186
- supersedes=["<existing-decision-id>"], rationale=...). Then retry
187
- complete_intent — the distiller may now find the new superseding
188
- decision in recall and the conflict resolves.
189
- (B) Abandon the intent: complete_intent(status="abandoned"). Decisions
190
- are soft-deleted but recoverable via activate_intent if the user
191
- changes their mind.
192
- (C) Keep the intent active and continue working.
193
- DO NOT silently retry — every retry runs the distiller (and the per-pair
194
- judge) again. Wait for the user's decision.
195
-
196
- 3. response.success === false AND response.reason === "transient-failure":
162
+ 2. response.success === false AND response.reason === "transient-failure":
197
163
  The distiller LLM call or the conflict-check API call errored. The
198
164
  ephemerals are preserved (the bucket is intact), and the intent stays
199
165
  "active". Tell the user the failure stage (response.failedStage) and the
200
166
  underlying error, then suggest retrying once the issue clears, or
201
167
  abandoning if the failure persists.
202
168
 
203
- 4. In a non-interactive (autonomous) session: log the conflicts at WARN level
204
- and leave the intent active. A human review path exists via the panel.`,
169
+ 3. In a non-interactive (autonomous) session: if response.deferredConflicts is
170
+ non-empty, log it at INFO and continue — the commit already landed and the
171
+ decisions await disposition in the panel. There is no blocking state.`,
205
172
  inputSchema: completeIntentSchema,
206
173
  handler: completeIntent
207
174
  };
@@ -1 +1 @@
1
- {"version":3,"file":"complete-intent.js","sourceRoot":"","sources":["../../src/tools/complete-intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC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AAM;QACN,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;QACnD,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS;QAClF,qBAAqB,EAAE,OAAO,GAAG,CAAC,qBAAqB,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS;QAC5G,aAAa,EAAE,GAAG,CAAC,aAAa;QAChC,UAAU,EAAE,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,SAAS;KAC/E,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yEA6C0D;IACvE,WAAW,EAAE,oBAAoB;IACjC,OAAO,EAAE,cAAc;CACxB,CAAA"}
@@ -65,32 +65,12 @@ interface ConflictInfo {
65
65
  oppositionDetected: boolean;
66
66
  oppositionDetail: string | null;
67
67
  }
68
- export interface ActiveIntentLockConflict {
69
- existingIntentId: string;
70
- title?: string;
71
- createdBy?: string;
72
- author?: string;
73
- }
74
- /**
75
- * Soft-lock surfaced when a `pending` intent blocks creating a new one on
76
- * the same repo. PRD_AGENT_COORDINATION_LAYER_02 §6.3 — the agent must prompt
77
- * the user to abandon-or-finalize the pending one before proceeding.
78
- */
79
- export interface PendingIntentBlocking {
80
- intentId: string;
81
- title?: string;
82
- pendingReason?: string;
83
- lastActivityAt?: string;
84
- distilledDecisionCount?: number;
85
- }
86
68
  export interface CreateIntentResponse {
87
69
  success: boolean;
88
70
  intentId: string;
89
- action: 'created' | 'reactivated' | 'conflict' | 'lock_conflict' | 'pending_blocked';
71
+ action: 'created' | 'reactivated' | 'conflict';
90
72
  message: string;
91
73
  conflicts?: ConflictInfo[];
92
- lockConflict?: ActiveIntentLockConflict;
93
- pendingIntent?: PendingIntentBlocking;
94
74
  }
95
75
  export declare function createAndActivateIntent(input: CreateIntentInput): Promise<CreateIntentResponse>;
96
76
  export declare const createAndActivateIntentTool: {