@kawacode/mcp 8.1.3 → 10.1.1

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.
@@ -11,6 +11,17 @@ export const completeIntentSchema = z.object({
11
11
  supersededBy: z.string().optional().describe('Intent ID that supersedes this one. Required when status is "superseded".'),
12
12
  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
13
  });
14
+ /**
15
+ * How a completion message names the intent. Kawa Code sends the title only when it
16
+ * could read the intent (not when the API was down, the id was paired with the wrong
17
+ * repo, or the failure carries none). Never invent one: a made-up title reads like a
18
+ * real one and hides that the lookup failed. Name the intent by its id instead; a
19
+ * response with neither is just "the intent".
20
+ */
21
+ export function intentLabel(title, intentId) {
22
+ const name = typeof title === 'string' && title ? `"${title}"` : intentId;
23
+ return { name, ref: name ? `intent ${name}` : 'the intent' };
24
+ }
14
25
  export async function completeIntent(input) {
15
26
  const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
16
27
  // Multi-active model (IMPLEMENTATION_PLAN_MULTI_ACTIVE_INTENTS.md §7): `intentId`
@@ -45,7 +56,7 @@ export async function completeIntent(input) {
45
56
  humanApproved: input.humanApproved,
46
57
  }, COMPLETE_TIMEOUT_MS);
47
58
  const intentId = res.intentId || '';
48
- const intentTitle = res.intentTitle || 'Intent';
59
+ const { name: intentName, ref: intentRef } = intentLabel(res.intentTitle, intentId);
49
60
  const previousStatus = res.previousStatus || 'active';
50
61
  // A completed intent ALWAYS comes back with its id — the base success payload
51
62
  // carries both `success: true` and `intentId`, with deferredConflicts /
@@ -63,19 +74,8 @@ export async function completeIntent(input) {
63
74
  // what to surface to the user.
64
75
  let newStatus;
65
76
  let message;
66
- if (!success && reason === 'transient-failure') {
67
- // Distiller LLM error or /check-conflicts API error. Bucket re-populated,
68
- // intent stays active. User decides whether to wait + retry or abandon.
69
- newStatus = res.status || 'active';
70
- const stage = res.failedStage ? ` (${res.failedStage})` : '';
71
- const errPart = res.error ? `: ${res.error}` : '';
72
- message =
73
- `Could not complete intent "${intentTitle}" — transient failure${stage}${errPart}. ` +
74
- `The ephemerals were preserved. Wait for the underlying issue to clear, then retry complete_intent. ` +
75
- `If retrying repeatedly fails, the user can abandon the intent (complete_intent(status="abandoned")).`;
76
- }
77
- else if (!success) {
78
- // Catch-all for every other failure shape (resolution_required,
77
+ if (!success) {
78
+ // Every failure shape (transient-failure, resolution_required,
79
79
  // completion_locked, legacy errors), plus the anomalous "no failure
80
80
  // declared AND no intentId" case. In the latter nothing ran, so do NOT echo
81
81
  // the requested status as though it had landed. Kawa Code owns the wording
@@ -85,21 +85,21 @@ export async function completeIntent(input) {
85
85
  ? res.message
86
86
  : typeof res.error === 'string' ? res.error : '';
87
87
  message = intentId
88
- ? `Failed to complete intent "${intentTitle}".${guidance ? ` ${guidance}` : ''}`
89
- : `Could not complete intent "${intentTitle}" — Kawa Code returned no intent id, so NOTHING was completed: the status was not changed, no code blocks were captured, and no decisions were distilled. Do NOT report this as committed. Retry complete_intent; if it fails again, surface the failure to the user rather than assuming the intent closed.`;
88
+ ? `Failed to complete ${intentRef}.${guidance ? ` ${guidance}` : ''}`
89
+ : `Could not complete ${intentRef} — Kawa Code returned no intent id, so NOTHING was completed: the status was not changed, no code blocks were captured, and no decisions were distilled. Do NOT report this as committed. Retry complete_intent; if it fails again, surface the failure to the user rather than assuming the intent closed.`;
90
90
  }
91
91
  else {
92
92
  // Clean completion. Note: Phase 3.5 may have queued writes for later
93
93
  // replay — the response is success=true but apiSyncDeferred=true.
94
94
  newStatus = res.newStatus || input.status;
95
95
  const statusMessages = {
96
- committed: `Intent "${intentTitle}" marked as committed`,
97
- pushed: `Intent "${intentTitle}" marked as pushed`,
98
- done: `Intent "${intentTitle}" marked as done`,
99
- abandoned: `Intent "${intentTitle}" abandoned`,
100
- superseded: `Intent "${intentTitle}" marked as superseded`,
96
+ committed: `Intent ${intentName} marked as committed`,
97
+ pushed: `Intent ${intentName} marked as pushed`,
98
+ done: `Intent ${intentName} marked as done`,
99
+ abandoned: `Intent ${intentName} abandoned`,
100
+ superseded: `Intent ${intentName} marked as superseded`,
101
101
  };
102
- const statusMsg = statusMessages[input.status] || `Intent "${intentTitle}" updated`;
102
+ const statusMsg = statusMessages[input.status] || `Intent ${intentName} updated`;
103
103
  const shaPart = input.commitSha ? ` (commit: ${input.commitSha.substring(0, 7)})` : '';
104
104
  const distilledPart = committedDecisionCount && committedDecisionCount > 0
105
105
  ? ` — ${committedDecisionCount} distilled decision(s) recorded`
@@ -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;AAEnD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;IACzH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAClE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2VAA2V,CAAC;IACrY,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yEAAyE,CAAC;IACpH,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;SAC5F,QAAQ,CA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AS;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;;;;;;;;;;;;mFAYoE;IACjF,WAAW,EAAE,oBAAoB;IACjC,OAAO,EAAE,cAAc;CACxB,CAAA"}
@@ -6,15 +6,15 @@ export declare const createAndActivateIntentSchema: z.ZodObject<{
6
6
  description: z.ZodString;
7
7
  templateType: z.ZodDefault<z.ZodEnum<["feature", "refactor", "exploration"]>>;
8
8
  constraints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
9
- force: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
9
+ pendingId: z.ZodOptional<z.ZodString>;
10
10
  }, "strip", z.ZodTypeAny, {
11
11
  repoPath: string;
12
12
  title: string;
13
13
  description: string;
14
14
  templateType: "feature" | "refactor" | "exploration";
15
- force: boolean;
16
15
  repoOrigin?: string | undefined;
17
16
  constraints?: string[] | undefined;
17
+ pendingId?: string | undefined;
18
18
  }, {
19
19
  repoPath: string;
20
20
  title: string;
@@ -22,31 +22,51 @@ export declare const createAndActivateIntentSchema: z.ZodObject<{
22
22
  repoOrigin?: string | undefined;
23
23
  templateType?: "feature" | "refactor" | "exploration" | undefined;
24
24
  constraints?: string[] | undefined;
25
- force?: boolean | undefined;
25
+ pendingId?: string | undefined;
26
26
  }>;
27
27
  export type CreateIntentInput = z.infer<typeof createAndActivateIntentSchema>;
28
- interface ConflictInfo {
29
- intentId: string;
30
- title: string;
31
- author: string;
32
- status: string;
33
- createdBy: string;
34
- staleness: 'fresh' | 'aging' | 'likely_stale';
35
- severity: 'high' | 'medium' | 'low';
36
- overlapType: string;
37
- overlappingFiles: string[];
38
- similarityScore: number;
39
- oppositionDetected: boolean;
40
- oppositionDetail: string | null;
41
- }
28
+ export type CreateIntentAction = 'created' | 'reactivated' | 'pending_approval' | 'awaiting_user' | 'declined' | 'expired' | 'unknown_pending';
42
29
  export interface CreateIntentResponse {
43
30
  success: boolean;
44
31
  intentId: string;
45
- action: 'created' | 'reactivated' | 'conflict';
32
+ action: CreateIntentAction;
33
+ /** Present while the request is parked in Kawa Code. */
34
+ pendingId?: string;
35
+ /** How many more times the user's decision may be checked before waiting for them. */
36
+ pollsLeft?: number;
46
37
  message: string;
47
- conflicts?: ConflictInfo[];
38
+ }
39
+ /**
40
+ * How long one tool call waits for the user's decision. A WALL-CLOCK budget, not a
41
+ * count of status calls: each status call is bounded by what is left of it, so the
42
+ * deadline holds even when Kawa Code is busy. 20 s sits well inside every Claude
43
+ * Code tool-call limit (hours; auto-background at 2 min) and inside the 30 s IPC
44
+ * default.
45
+ */
46
+ export declare const WAIT_BUDGET_MS = 20000;
47
+ /** Pause between status calls. */
48
+ export declare const POLL_INTERVAL_MS = 1000;
49
+ /** The IPC default; a status call never gets more than this. */
50
+ export declare const MAX_STATUS_CALL_MS = 30000;
51
+ /** Below this, another status call cannot usefully finish: stop and report. */
52
+ export declare const MIN_STATUS_CALL_MS = 250;
53
+ /** The side effects, injected so the loop is testable without Muninn or a clock. */
54
+ export interface CreateIntentDeps {
55
+ request: (domain: string, action: string, data?: any, timeoutMs?: number) => Promise<any>;
56
+ now: () => number;
57
+ sleep: (ms: number) => Promise<void>;
58
+ resolveOrigin: (repoOrigin: string | undefined, repoPath: string) => string;
48
59
  }
49
60
  export declare function createAndActivateIntent(input: CreateIntentInput): Promise<CreateIntentResponse>;
61
+ /**
62
+ * Forward the request to Kawa Code and relay the outcome. No state, no cache: the
63
+ * parked request, the owner's answer and the poll cap all live in Kawa Code.
64
+ *
65
+ * Deliberately a plain forward-and-wait. The wait is here, not in Kawa Code,
66
+ * because Kawa Code runs one request at a time: a handler that waited would stall
67
+ * every other session's calls.
68
+ */
69
+ export declare function createIntentFlow(input: CreateIntentInput, deps: CreateIntentDeps): Promise<CreateIntentResponse>;
50
70
  export declare const createAndActivateIntentTool: {
51
71
  name: string;
52
72
  description: string;
@@ -57,15 +77,15 @@ export declare const createAndActivateIntentTool: {
57
77
  description: z.ZodString;
58
78
  templateType: z.ZodDefault<z.ZodEnum<["feature", "refactor", "exploration"]>>;
59
79
  constraints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
60
- force: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
80
+ pendingId: z.ZodOptional<z.ZodString>;
61
81
  }, "strip", z.ZodTypeAny, {
62
82
  repoPath: string;
63
83
  title: string;
64
84
  description: string;
65
85
  templateType: "feature" | "refactor" | "exploration";
66
- force: boolean;
67
86
  repoOrigin?: string | undefined;
68
87
  constraints?: string[] | undefined;
88
+ pendingId?: string | undefined;
69
89
  }, {
70
90
  repoPath: string;
71
91
  title: string;
@@ -73,8 +93,7 @@ export declare const createAndActivateIntentTool: {
73
93
  repoOrigin?: string | undefined;
74
94
  templateType?: "feature" | "refactor" | "exploration" | undefined;
75
95
  constraints?: string[] | undefined;
76
- force?: boolean | undefined;
96
+ pendingId?: string | undefined;
77
97
  }>;
78
98
  handler: typeof createAndActivateIntent;
79
99
  };
80
- export {};
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { request } from '../services/muninn-ipc.js';
2
+ import { request, MuninnTimeoutError } from '../services/muninn-ipc.js';
3
3
  import { resolveOrigin } from './resolve-origin.js';
4
4
  export const createAndActivateIntentSchema = z.object({
5
5
  repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
@@ -8,52 +8,69 @@ export const createAndActivateIntentSchema = z.object({
8
8
  description: z.string().max(2000).describe('What this intent accomplishes'),
9
9
  templateType: z.enum(['feature', 'refactor', 'exploration']).default('feature').describe('Type of work'),
10
10
  constraints: z.array(z.string()).optional().describe('Requirements or constraints for this work'),
11
- force: z.boolean().optional().default(false).describe('Bypass conflict detection. Set to true after the user has reviewed detected conflicts and chosen to proceed anyway.'),
11
+ pendingId: z.string().optional().describe('Only after a pending_approval response: the pendingId it returned. Asks whether the user has decided. Pass the same title, description and repoPath as before.'),
12
12
  });
13
+ /**
14
+ * How long one tool call waits for the user's decision. A WALL-CLOCK budget, not a
15
+ * count of status calls: each status call is bounded by what is left of it, so the
16
+ * deadline holds even when Kawa Code is busy. 20 s sits well inside every Claude
17
+ * Code tool-call limit (hours; auto-background at 2 min) and inside the 30 s IPC
18
+ * default.
19
+ */
20
+ export const WAIT_BUDGET_MS = 20_000;
21
+ /** Pause between status calls. */
22
+ export const POLL_INTERVAL_MS = 1_000;
23
+ /** The IPC default; a status call never gets more than this. */
24
+ export const MAX_STATUS_CALL_MS = 30_000;
25
+ /** Below this, another status call cannot usefully finish: stop and report. */
26
+ export const MIN_STATUS_CALL_MS = 250;
27
+ const liveDeps = {
28
+ request,
29
+ now: () => Date.now(),
30
+ sleep: ms => new Promise(resolve => setTimeout(resolve, ms)),
31
+ resolveOrigin,
32
+ };
13
33
  export async function createAndActivateIntent(input) {
14
- const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
15
- // Step 1: Create the intent. If a sufficiently similar one created by THIS
16
- // session already exists, the server may reactivate it instead of creating a
17
- // duplicate (dedup is scoped per-session — IMPLEMENTATION_PLAN_MULTI_ACTIVE_INTENTS.md
18
- // §10.4 — so two sessions' near-duplicates are surfaced as conflicts, not merged).
19
- const createRes = await request('intent', 'create', {
20
- repoOrigin: actualOrigin,
34
+ return createIntentFlow(input, liveDeps);
35
+ }
36
+ /**
37
+ * Forward the request to Kawa Code and relay the outcome. No state, no cache: the
38
+ * parked request, the owner's answer and the poll cap all live in Kawa Code.
39
+ *
40
+ * Deliberately a plain forward-and-wait. The wait is here, not in Kawa Code,
41
+ * because Kawa Code runs one request at a time: a handler that waited would stall
42
+ * every other session's calls.
43
+ */
44
+ export async function createIntentFlow(input, deps) {
45
+ // `force` is gone (hard cut). Only the owner, in Kawa Code, can decide to
46
+ // proceed past an overlap. A client holding a stale schema must be told, not
47
+ // silently ignored: it believes it asked to bypass the check.
48
+ if (input.force === true) {
49
+ throw new Error('`force` is no longer accepted. If the new intent overlaps existing work, Kawa Code asks the user to decide; ' +
50
+ 'call create_and_activate_intent again without `force`.');
51
+ }
52
+ const origin = deps.resolveOrigin(input.repoOrigin, input.repoPath);
53
+ if (input.pendingId) {
54
+ return waitForDecision(origin, input.pendingId, deps);
55
+ }
56
+ // Create. If a sufficiently similar intent created by THIS session already
57
+ // exists, the server may reactivate it instead of creating a duplicate; two
58
+ // sessions' near-duplicates are surfaced as an overlap, not merged.
59
+ const createRes = await deps.request('intent', 'create', {
60
+ repoOrigin: origin,
21
61
  title: input.title,
22
62
  description: input.description,
23
63
  templateType: input.templateType,
24
64
  constraints: input.constraints || [],
25
65
  scope: { type: 'repo', paths: [] },
26
- force: input.force || false,
27
66
  });
28
- // Handle conflict detection — API returned 409 with conflict data.
29
- // Return the conflicts to the caller (Claude Code) so it can present
30
- // them to the user and optionally retry with force=true.
31
- if (createRes.conflict === true && createRes.conflicts) {
32
- const conflicts = createRes.conflicts;
33
- const lines = [
34
- `Found ${conflicts.length} potential conflict(s) with existing intents:`,
35
- '',
36
- ];
37
- for (const c of conflicts) {
38
- const badge = c.severity === 'high' ? '[HIGH]' : c.severity === 'medium' ? '[MEDIUM]' : '[LOW]';
39
- lines.push(`${badge} "${c.title}" by ${c.author} (${c.status}, ${c.staleness})`);
40
- if (c.overlappingFiles.length > 0) {
41
- lines.push(` Files: ${c.overlappingFiles.join(', ')}`);
42
- }
43
- if (c.oppositionDetected) {
44
- lines.push(` Semantic opposition: ${c.oppositionDetail}`);
45
- }
46
- lines.push(` Similarity: ${(c.similarityScore * 100).toFixed(0)}%`);
47
- lines.push('');
48
- }
49
- lines.push('To proceed anyway, call create_and_activate_intent again with force=true.');
50
- return {
51
- success: false,
52
- intentId: '',
53
- action: 'conflict',
54
- message: lines.join('\n'),
55
- conflicts,
56
- };
67
+ // Overlap: Kawa Code parked the request for the user. NOTHING about the
68
+ // overlapping intents is relayed here beyond a count — the API fills each one's
69
+ // `author` with a display name, and the card in Kawa Code is where the user
70
+ // reads the detail.
71
+ if (createRes.action === 'pending_approval') {
72
+ const count = typeof createRes.conflictCount === 'number' ? createRes.conflictCount : 0;
73
+ return pendingApproval(createRes.pendingId, undefined, count);
57
74
  }
58
75
  // Propagate Muninn-side errors (e.g. not signed in, API unreachable) to the AI
59
76
  // so it can tell the user how to recover instead of silently proceeding.
@@ -64,24 +81,125 @@ export async function createAndActivateIntent(input) {
64
81
  if (!intentId) {
65
82
  throw new Error('Intent creation succeeded but no intent ID was returned');
66
83
  }
67
- const action = createRes.action === 'reactivated' ? 'reactivated' : 'created';
68
- // Step 2: Set it as THIS session's current intent. Under the multi-active
69
- // model (no lock) set-active never conflicts — many intents can be active per
70
- // repo at once, and this only moves this session's `current` focus pointer.
71
- await request('intent', 'set-active', {
72
- repoOrigin: actualOrigin,
73
- intentId,
74
- });
75
- const message = action === 'reactivated'
76
- ? `Reactivated existing similar intent: "${input.title}" — resuming previous work instead of creating a duplicate.`
77
- : `Created and activated intent: "${input.title}"`;
84
+ return activate(origin, intentId, createRes.action === 'reactivated' ? 'reactivated' : 'created', input.title, deps);
85
+ }
86
+ /**
87
+ * Ask Kawa Code whether the user has decided, for up to [`WAIT_BUDGET_MS`].
88
+ *
89
+ * Only the FIRST status call of a tool call carries `countPoll`: the loop makes
90
+ * ~20 of them per call, and the cap on polling counts tool calls.
91
+ */
92
+ async function waitForDecision(origin, pendingId, deps) {
93
+ const deadline = deps.now() + WAIT_BUDGET_MS;
94
+ let countPoll = true;
95
+ let pollsLeft;
96
+ for (;;) {
97
+ const remaining = deadline - deps.now();
98
+ if (remaining < MIN_STATUS_CALL_MS)
99
+ break;
100
+ let res;
101
+ try {
102
+ res = await deps.request('intent', 'pending-intent-status', { repoOrigin: origin, pendingId, countPoll }, Math.min(remaining, MAX_STATUS_CALL_MS));
103
+ }
104
+ catch (err) {
105
+ // Kawa Code runs one request at a time, so a status call can sit behind
106
+ // another session's slow handler (a distillation can run for minutes).
107
+ // That is not a failure: the user has not decided, and the agent's next
108
+ // step is the same as for any other pending reply — call again.
109
+ if (err instanceof MuninnTimeoutError)
110
+ break;
111
+ throw err;
112
+ }
113
+ countPoll = false;
114
+ switch (res?.action) {
115
+ case 'created':
116
+ case 'reactivated': {
117
+ const intentId = res.intentId || res.intent?.id || '';
118
+ if (!intentId)
119
+ throw new Error('The decision was recorded but Kawa Code returned no intent ID');
120
+ return activate(origin, intentId, res.action, undefined, deps);
121
+ }
122
+ case 'declined':
123
+ return {
124
+ success: false,
125
+ intentId: '',
126
+ action: 'declined',
127
+ message: 'The user declined this intent — it was NOT created. Do not retry it under a different ' +
128
+ 'title. Edits already written to disk are not reverted and nothing undoes them: tell the ' +
129
+ 'user the request was declined and ask what they want done with the work already made.',
130
+ };
131
+ case 'expired':
132
+ return {
133
+ success: false,
134
+ intentId: '',
135
+ action: 'expired',
136
+ message: 'The request went unanswered for 24 hours and expired. Nothing was created and nothing was decided. ' +
137
+ 'If the user still wants this work, call create_and_activate_intent again WITHOUT pendingId.',
138
+ };
139
+ case 'unknown_pending':
140
+ return {
141
+ success: false,
142
+ intentId: '',
143
+ action: 'unknown_pending',
144
+ message: 'Kawa Code has no pending request with that pendingId (it may have been cleaned up). ' +
145
+ 'Call create_and_activate_intent again WITHOUT pendingId to start over.',
146
+ };
147
+ case 'awaiting_user':
148
+ return {
149
+ success: false,
150
+ intentId: '',
151
+ action: 'awaiting_user',
152
+ pendingId,
153
+ pollsLeft: 0,
154
+ message: 'This tool will stop asking — but do not sit idle waiting for the answer: a parked request ' +
155
+ 'expires after 24 hours and is dropped when the session ends, so the event you would be ' +
156
+ 'waiting for may never arrive. Tell the user the decision is waiting for them in Kawa Code ' +
157
+ '(Orchestration panel), carry on with any work that does not depend on this intent, and ' +
158
+ 'call this tool once more with the same pendingId when they say they have answered. ' +
159
+ 'Decisions recorded before the intent exists are not attributed to it.',
160
+ };
161
+ case 'pending_approval':
162
+ pollsLeft = typeof res.pollsLeft === 'number' ? res.pollsLeft : pollsLeft;
163
+ break;
164
+ default:
165
+ throw new Error(`Unexpected reply from Kawa Code while waiting for the user's decision: ${JSON.stringify(res)}`);
166
+ }
167
+ const left = deadline - deps.now();
168
+ if (left < MIN_STATUS_CALL_MS)
169
+ break;
170
+ await deps.sleep(Math.min(POLL_INTERVAL_MS, left));
171
+ }
172
+ return pendingApproval(pendingId, pollsLeft);
173
+ }
174
+ function pendingApproval(pendingId, pollsLeft, conflictCount) {
175
+ const overlap = conflictCount && conflictCount > 0
176
+ ? `This intent overlaps with ${conflictCount} existing intent${conflictCount === 1 ? '' : 's'}. `
177
+ : '';
178
+ const left = pollsLeft === undefined ? '' : ` Checks left on this request: ${pollsLeft}.`;
78
179
  return {
79
- success: true,
80
- intentId,
81
- action,
82
- message,
180
+ success: false,
181
+ intentId: '',
182
+ action: 'pending_approval',
183
+ pendingId,
184
+ pollsLeft,
185
+ message: `${overlap}The user decides in Kawa Code (Orchestration panel); the intent does NOT exist yet. ` +
186
+ `This is not an instruction to stop. Tell the user it is waiting for them, carry on with any work ` +
187
+ `that does not depend on this intent, and call create_and_activate_intent again with ` +
188
+ `pendingId="${pendingId}" and the same title, description and repoPath at your next checkpoint — ` +
189
+ `or as soon as they say they have answered. Decisions recorded before the intent exists are not ` +
190
+ `attributed to it, so reach the decision before you commit.${left}`,
83
191
  };
84
192
  }
193
+ /** Set the new intent as THIS session's current focus. Under the multi-active
194
+ * model (no lock) this never conflicts: it only moves this session's pointer. */
195
+ async function activate(origin, intentId, action, title, deps) {
196
+ await deps.request('intent', 'set-active', { repoOrigin: origin, intentId });
197
+ const named = title ? ` "${title}"` : '';
198
+ const message = action === 'reactivated'
199
+ ? `Reactivated existing similar intent${named} — resuming previous work instead of creating a duplicate.`
200
+ : `Created and activated intent${named}`;
201
+ return { success: true, intentId, action, message };
202
+ }
85
203
  export const createAndActivateIntentTool = {
86
204
  name: 'create_and_activate_intent',
87
205
  description: `Create a new intent from the user's request and mark it as active for THIS session.
@@ -95,13 +213,35 @@ This ensures all AI-generated code gets properly tracked and attributed.
95
213
 
96
214
  Multi-active model: many intents can be active on a repo at once (one per
97
215
  session/teammate). Creating + activating one only sets YOUR session's current
98
- focus — it never blocks or displaces another session's active intent, so there
99
- is no lock conflict to resolve.
216
+ focus — it never blocks or displaces another session's active intent.
217
+
218
+ If the new intent overlaps existing work, YOU do not decide what happens: Kawa
219
+ Code parks the request, asks the user, and this tool reports the outcome in
220
+ "action". An overlap parks a decision for the user — it is not an instruction to
221
+ stop working. Act on "action":
222
+ - "created" / "reactivated": done; the intent is active. Proceed.
223
+ - "pending_approval": the user has been asked in Kawa Code; the intent does not
224
+ exist yet. Tell them it is waiting, keep working on anything that does not
225
+ depend on this intent, and call this tool again with the returned pendingId
226
+ (same title, description and repoPath) at your next checkpoint or once they
227
+ say they have answered. Each call waits up to ~20 seconds for the answer.
228
+ - "awaiting_user": this tool will stop asking. Do not sit idle — a parked request
229
+ expires after 24 hours and is dropped when the session ends, so the answer you
230
+ would be waiting for may never come. Tell the user, continue independent work,
231
+ and call once more with the pendingId after they say they have answered.
232
+ - "declined": the user said no to this intent. Do not retry it under another
233
+ title. Edits already on disk are not reverted — tell the user and ask what
234
+ they want done with them.
235
+ - "expired" / "unknown_pending": nothing was decided; call again without pendingId
236
+ if the work is still wanted.
237
+ Work done while a request is parked is still real work, but it is not attributed
238
+ to the intent: decisions recorded before the intent exists carry no intent id,
239
+ and complete_intent has nothing to complete until it does. So continue, but reach
240
+ the decision before you commit. There is no force option — only the user can
241
+ decide an overlap.
100
242
 
101
- If the tool returns conflicts (action="conflict"), it found an existing
102
- team-member intent that overlaps semantically or in files. Present the conflict
103
- details to the user and ask whether to proceed. If yes, retry with force=true to
104
- bypass conflict detection.`,
243
+ If this tool call itself times out (before any pendingId was returned), call it
244
+ once more with the same arguments — it will not create a duplicate request.`,
105
245
  inputSchema: createAndActivateIntentSchema,
106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AC,EAAE,CAAA;IACxC,MAAM,OAAO,GAAG,MAAM,KAAK,aAAa;QACtC,CAAC,CAAC,sCAAsC,KAAK,4DAA4D;QACzG,CAAC,CAAC,+BAA+B,KAAK,EAAE,CAAA;IAC1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;AACrD,CAAC;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EAuC6D;IAC1E,WAAW,EAAE,6BAA6B;IAC1C,OAAO,EAAE,uBAAuB;CACjC,CAAA"}
@@ -2,12 +2,18 @@ import { z } from 'zod';
2
2
  export declare const getProjectDecisionsSchema: z.ZodObject<{
3
3
  repoOrigin: z.ZodOptional<z.ZodString>;
4
4
  repoPath: z.ZodString;
5
+ limit: z.ZodOptional<z.ZodNumber>;
6
+ offset: z.ZodOptional<z.ZodNumber>;
5
7
  }, "strip", z.ZodTypeAny, {
6
8
  repoPath: string;
7
9
  repoOrigin?: string | undefined;
10
+ limit?: number | undefined;
11
+ offset?: number | undefined;
8
12
  }, {
9
13
  repoPath: string;
10
14
  repoOrigin?: string | undefined;
15
+ limit?: number | undefined;
16
+ offset?: number | undefined;
11
17
  }>;
12
18
  export type GetProjectDecisionsInput = z.infer<typeof getProjectDecisionsSchema>;
13
19
  export interface ConstraintViolation {
@@ -28,7 +34,10 @@ export interface ProjectDecision {
28
34
  }
29
35
  export interface GetProjectDecisionsResponse {
30
36
  decisions: ProjectDecision[];
37
+ /** Rows in THIS page — not the project total. See totalCount. */
31
38
  count: number;
39
+ totalCount: number;
40
+ hasMore: boolean;
32
41
  }
33
42
  export declare function getProjectDecisions(input: GetProjectDecisionsInput): Promise<GetProjectDecisionsResponse>;
34
43
  export declare const getProjectDecisionsTool: {
@@ -37,12 +46,18 @@ export declare const getProjectDecisionsTool: {
37
46
  inputSchema: z.ZodObject<{
38
47
  repoOrigin: z.ZodOptional<z.ZodString>;
39
48
  repoPath: z.ZodString;
49
+ limit: z.ZodOptional<z.ZodNumber>;
50
+ offset: z.ZodOptional<z.ZodNumber>;
40
51
  }, "strip", z.ZodTypeAny, {
41
52
  repoPath: string;
42
53
  repoOrigin?: string | undefined;
54
+ limit?: number | undefined;
55
+ offset?: number | undefined;
43
56
  }, {
44
57
  repoPath: string;
45
58
  repoOrigin?: string | undefined;
59
+ limit?: number | undefined;
60
+ offset?: number | undefined;
46
61
  }>;
47
62
  handler: typeof getProjectDecisions;
48
63
  };