@kawacode/mcp 6.9.1 → 6.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/build/index.js +22 -2
- package/build/index.js.map +1 -1
- package/build/kawacode-on-pre-edit.d.ts +6 -1
- package/build/kawacode-on-pre-edit.js +27 -17
- package/build/kawacode-on-pre-edit.js.map +1 -1
- package/build/pre-edit/acked-decisions.d.ts +30 -0
- package/build/pre-edit/acked-decisions.js +65 -0
- package/build/pre-edit/acked-decisions.js.map +1 -0
- package/build/pre-edit/acked-decisions.test.d.ts +1 -0
- package/build/pre-edit/acked-decisions.test.js +59 -0
- package/build/pre-edit/acked-decisions.test.js.map +1 -0
- package/build/tools/_salvage-mangled-args.d.ts +38 -0
- package/build/tools/_salvage-mangled-args.js +87 -0
- package/build/tools/_salvage-mangled-args.js.map +1 -0
- package/build/tools/_salvage-mangled-args.test.d.ts +1 -0
- package/build/tools/_salvage-mangled-args.test.js +73 -0
- package/build/tools/_salvage-mangled-args.test.js.map +1 -0
- package/build/tools/complete-intent.d.ts +4 -4
- package/build/tools/complete-intent.js +14 -4
- package/build/tools/complete-intent.js.map +1 -1
- package/build/tools/edit-session-decision.d.ts +13 -12
- package/build/tools/edit-session-decision.js +14 -1
- package/build/tools/edit-session-decision.js.map +1 -1
- package/build/tools/index.d.ts +130 -89
- package/build/tools/index.js +3 -1
- package/build/tools/index.js.map +1 -1
- package/build/tools/list-team-intents.d.ts +4 -4
- package/build/tools/log-work.js +13 -2
- package/build/tools/log-work.js.map +1 -1
- package/build/tools/pre-edit-acknowledge.d.ts +11 -12
- package/build/tools/pre-edit-acknowledge.js +18 -25
- package/build/tools/pre-edit-acknowledge.js.map +1 -1
- package/build/tools/record-decision.d.ts +12 -12
- package/build/tools/resume-intent.d.ts +112 -0
- package/build/tools/resume-intent.js +87 -0
- package/build/tools/resume-intent.js.map +1 -0
- package/package.json +2 -2
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { request, SESSION_ID } from '../services/muninn-ipc.js';
|
|
3
2
|
import { forkFieldsExtensions } from './_fork-fields.js';
|
|
4
3
|
import { resolveOrigin } from './resolve-origin.js';
|
|
5
4
|
import { emitActedOn } from '../telemetry.js';
|
|
6
5
|
/**
|
|
7
|
-
*
|
|
6
|
+
* Marker tool: acknowledging a pre-edit decision.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* This tool no longer writes any override state. The pre-edit hook reads THIS
|
|
9
|
+
* call's presence in the session transcript (a `pre_edit_acknowledge` tool_use
|
|
10
|
+
* naming `decisionIds`) and suppresses those decisions from future blocks — see
|
|
11
|
+
* `src/pre-edit/acked-decisions.ts` and kawa.mcp decision 59ad77ed. That
|
|
12
|
+
* transcript read lives entirely in the hook's own session namespace, so it
|
|
13
|
+
* replaces the old token-keyed `pre-edit-cache`, which silently mis-routed the
|
|
14
|
+
* override across the hook/MCP process boundary after a session restart.
|
|
15
|
+
*
|
|
16
|
+
* The only side effect here is the acted-on value-metric; the acknowledgment
|
|
17
|
+
* itself is carried by the tool_use record, not by anything this handler does.
|
|
13
18
|
*/
|
|
14
19
|
export const preEditAcknowledgeSchema = z.object({
|
|
15
20
|
decisionIds: z
|
|
16
21
|
.array(z.string().min(1))
|
|
17
22
|
.min(1)
|
|
18
|
-
.describe('Decision IDs to acknowledge (
|
|
19
|
-
sessionToken: z
|
|
20
|
-
.string()
|
|
21
|
-
.optional()
|
|
22
|
-
.describe('Session scope for the force-override cache. Should match the sessionToken passed to pre_edit_decision_check. Defaults to the MCP server\'s SESSION_ID.'),
|
|
23
|
+
.describe('Decision IDs to acknowledge (suppress from pre-edit blocks for the rest of this session)'),
|
|
23
24
|
repoOrigin: z
|
|
24
25
|
.string()
|
|
25
26
|
.optional()
|
|
@@ -31,11 +32,6 @@ export const preEditAcknowledgeSchema = z.object({
|
|
|
31
32
|
...forkFieldsExtensions,
|
|
32
33
|
});
|
|
33
34
|
export async function preEditAcknowledge(input) {
|
|
34
|
-
const sessionToken = input.sessionToken ?? SESSION_ID;
|
|
35
|
-
const res = await request('pre-edit-cache', 'add', {
|
|
36
|
-
sessionToken,
|
|
37
|
-
decisionIds: input.decisionIds,
|
|
38
|
-
});
|
|
39
35
|
// Track-B acted-on (VALUE_METRICS Phase 2): an explicit acknowledge IS the
|
|
40
36
|
// agent acting on the surfaced pre_edit reasoning — one signal per decision
|
|
41
37
|
// id. Only attributable to a repo when an origin can be resolved (this tool
|
|
@@ -47,22 +43,19 @@ export async function preEditAcknowledge(input) {
|
|
|
47
43
|
}
|
|
48
44
|
catch { /* origin unresolvable — skip attribution */ }
|
|
49
45
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
cacheSize: typeof res?.total === 'number' ? res.total : 0,
|
|
53
|
-
};
|
|
46
|
+
// No IPC: the transcript record of this call is the acknowledgment.
|
|
47
|
+
return { acknowledged: input.decisionIds.length };
|
|
54
48
|
}
|
|
55
49
|
export const preEditAcknowledgeTool = {
|
|
56
50
|
name: 'pre_edit_acknowledge',
|
|
57
|
-
description: `
|
|
51
|
+
description: `Acknowledge pre-edit decisions so they stop blocking your edits for the rest of this session.
|
|
58
52
|
|
|
59
|
-
|
|
53
|
+
When a pre_edit_decision_check block fires and you judge the surfaced reasoning does NOT apply to your edit, call this with the surfaced decision IDs, then retry the edit — those decisions won't re-block this session. The acknowledgment is recorded by this call itself appearing in the session transcript, which the pre-edit hook reads; it needs no session token and is not affected by restarts.
|
|
60
54
|
|
|
61
|
-
|
|
55
|
+
For a PERSISTENT override across sessions (the reasoning is actually wrong or replaced), record a fork instead: \`record_decision(type: "fork", supersedes: [<id>])\`.
|
|
62
56
|
|
|
63
57
|
Returns:
|
|
64
|
-
- acknowledged: number of
|
|
65
|
-
- cacheSize: total IDs currently in the session override cache`,
|
|
58
|
+
- acknowledged: number of decision IDs acknowledged`,
|
|
66
59
|
inputSchema: preEditAcknowledgeSchema,
|
|
67
60
|
handler: preEditAcknowledge,
|
|
68
61
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pre-edit-acknowledge.js","sourceRoot":"","sources":["../../src/tools/pre-edit-acknowledge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"pre-edit-acknowledge.js","sourceRoot":"","sources":["../../src/tools/pre-edit-acknowledge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C;;;;;;;;;;;;;GAaG;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,WAAW,EAAE,CAAC;SACX,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACxB,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,0FAA0F,CAAC;IACvG,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,yIAAyI,CAAC;IACtJ,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,2FAA2F,CAAC;IACxG,GAAG,oBAAoB;CACxB,CAAC,CAAA;AAQF,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,KAA8B;IAE9B,2EAA2E;IAC3E,4EAA4E;IAC5E,4EAA4E;IAC5E,0EAA0E;IAC1E,IAAI,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACvC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAS,CAAC,CAAA;YAC/D,KAAK,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAA;QACxH,CAAC;QAAC,MAAM,CAAC,CAAC,4CAA4C,CAAC,CAAC;IAC1D,CAAC;IAED,oEAAoE;IACpE,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,CAAA;AACnD,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE;;;;;;;oDAOqC;IAClD,WAAW,EAAE,wBAAwB;IACrC,OAAO,EAAE,kBAAkB;CAC5B,CAAA"}
|
|
@@ -32,13 +32,13 @@ export declare const recordDecisionSchema: z.ZodObject<{
|
|
|
32
32
|
constraint: z.ZodString;
|
|
33
33
|
reason: z.ZodString;
|
|
34
34
|
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
constraint: string;
|
|
35
36
|
reason: string;
|
|
36
37
|
alternative: string;
|
|
37
|
-
constraint: string;
|
|
38
38
|
}, {
|
|
39
|
+
constraint: string;
|
|
39
40
|
reason: string;
|
|
40
41
|
alternative: string;
|
|
41
|
-
constraint: string;
|
|
42
42
|
}>, "many">>;
|
|
43
43
|
source: z.ZodDefault<z.ZodOptional<z.ZodEnum<["user", "agent", "extractor", "infer_history"]>>>;
|
|
44
44
|
confidence: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
|
|
@@ -68,7 +68,7 @@ export declare const recordDecisionSchema: z.ZodObject<{
|
|
|
68
68
|
baselineSha?: string | undefined;
|
|
69
69
|
}>>;
|
|
70
70
|
}, "strip", z.ZodTypeAny, {
|
|
71
|
-
type: "
|
|
71
|
+
type: "fork" | "abandoned" | "discovery" | "constraint" | "tradeoff" | "dependency";
|
|
72
72
|
repoPath: string;
|
|
73
73
|
summary: string;
|
|
74
74
|
intentId: string;
|
|
@@ -89,9 +89,9 @@ export declare const recordDecisionSchema: z.ZodObject<{
|
|
|
89
89
|
supersedes?: string[] | undefined;
|
|
90
90
|
constraintsChecked?: string[] | undefined;
|
|
91
91
|
constraintViolations?: {
|
|
92
|
+
constraint: string;
|
|
92
93
|
reason: string;
|
|
93
94
|
alternative: string;
|
|
94
|
-
constraint: string;
|
|
95
95
|
}[] | undefined;
|
|
96
96
|
confidence?: "high" | "medium" | "low" | undefined;
|
|
97
97
|
sourceThoughtIds?: string[] | undefined;
|
|
@@ -106,7 +106,7 @@ export declare const recordDecisionSchema: z.ZodObject<{
|
|
|
106
106
|
baselineSha?: string | undefined;
|
|
107
107
|
} | undefined;
|
|
108
108
|
}, {
|
|
109
|
-
type: "
|
|
109
|
+
type: "fork" | "abandoned" | "discovery" | "constraint" | "tradeoff" | "dependency";
|
|
110
110
|
repoPath: string;
|
|
111
111
|
summary: string;
|
|
112
112
|
rationale: string;
|
|
@@ -126,9 +126,9 @@ export declare const recordDecisionSchema: z.ZodObject<{
|
|
|
126
126
|
supersedes?: string[] | undefined;
|
|
127
127
|
constraintsChecked?: string[] | undefined;
|
|
128
128
|
constraintViolations?: {
|
|
129
|
+
constraint: string;
|
|
129
130
|
reason: string;
|
|
130
131
|
alternative: string;
|
|
131
|
-
constraint: string;
|
|
132
132
|
}[] | undefined;
|
|
133
133
|
source?: "user" | "agent" | "extractor" | "infer_history" | undefined;
|
|
134
134
|
confidence?: "high" | "medium" | "low" | undefined;
|
|
@@ -187,13 +187,13 @@ export declare const recordDecisionTool: {
|
|
|
187
187
|
constraint: z.ZodString;
|
|
188
188
|
reason: z.ZodString;
|
|
189
189
|
}, "strip", z.ZodTypeAny, {
|
|
190
|
+
constraint: string;
|
|
190
191
|
reason: string;
|
|
191
192
|
alternative: string;
|
|
192
|
-
constraint: string;
|
|
193
193
|
}, {
|
|
194
|
+
constraint: string;
|
|
194
195
|
reason: string;
|
|
195
196
|
alternative: string;
|
|
196
|
-
constraint: string;
|
|
197
197
|
}>, "many">>;
|
|
198
198
|
source: z.ZodDefault<z.ZodOptional<z.ZodEnum<["user", "agent", "extractor", "infer_history"]>>>;
|
|
199
199
|
confidence: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
|
|
@@ -223,7 +223,7 @@ export declare const recordDecisionTool: {
|
|
|
223
223
|
baselineSha?: string | undefined;
|
|
224
224
|
}>>;
|
|
225
225
|
}, "strip", z.ZodTypeAny, {
|
|
226
|
-
type: "
|
|
226
|
+
type: "fork" | "abandoned" | "discovery" | "constraint" | "tradeoff" | "dependency";
|
|
227
227
|
repoPath: string;
|
|
228
228
|
summary: string;
|
|
229
229
|
intentId: string;
|
|
@@ -244,9 +244,9 @@ export declare const recordDecisionTool: {
|
|
|
244
244
|
supersedes?: string[] | undefined;
|
|
245
245
|
constraintsChecked?: string[] | undefined;
|
|
246
246
|
constraintViolations?: {
|
|
247
|
+
constraint: string;
|
|
247
248
|
reason: string;
|
|
248
249
|
alternative: string;
|
|
249
|
-
constraint: string;
|
|
250
250
|
}[] | undefined;
|
|
251
251
|
confidence?: "high" | "medium" | "low" | undefined;
|
|
252
252
|
sourceThoughtIds?: string[] | undefined;
|
|
@@ -261,7 +261,7 @@ export declare const recordDecisionTool: {
|
|
|
261
261
|
baselineSha?: string | undefined;
|
|
262
262
|
} | undefined;
|
|
263
263
|
}, {
|
|
264
|
-
type: "
|
|
264
|
+
type: "fork" | "abandoned" | "discovery" | "constraint" | "tradeoff" | "dependency";
|
|
265
265
|
repoPath: string;
|
|
266
266
|
summary: string;
|
|
267
267
|
rationale: string;
|
|
@@ -281,9 +281,9 @@ export declare const recordDecisionTool: {
|
|
|
281
281
|
supersedes?: string[] | undefined;
|
|
282
282
|
constraintsChecked?: string[] | undefined;
|
|
283
283
|
constraintViolations?: {
|
|
284
|
+
constraint: string;
|
|
284
285
|
reason: string;
|
|
285
286
|
alternative: string;
|
|
286
|
-
constraint: string;
|
|
287
287
|
}[] | undefined;
|
|
288
288
|
source?: "user" | "agent" | "extractor" | "infer_history" | undefined;
|
|
289
289
|
confidence?: "high" | "medium" | "low" | undefined;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type ProjectDecision } from './get-project-decisions.js';
|
|
3
|
+
/**
|
|
4
|
+
* One-call intent hydration for cross-developer handoff.
|
|
5
|
+
*
|
|
6
|
+
* Composes three EXISTING tools/IPC actions — nothing new is added to Muninn,
|
|
7
|
+
* so this works against any daemon version (backwards compatible):
|
|
8
|
+
* 1. activate_intent → adopt the intent as this session's current focus
|
|
9
|
+
* 2. get_intent_changes → the (now-active) intent's title/description/status
|
|
10
|
+
* 3. get_project_decisions → its recorded decisions (summary-only, lean)
|
|
11
|
+
*
|
|
12
|
+
* The existing tools are reused, never modified. A future Muninn
|
|
13
|
+
* `decision:by-intent` filter would let step 3 avoid pulling the full project
|
|
14
|
+
* list, but that's an optimization, not a requirement.
|
|
15
|
+
*/
|
|
16
|
+
export declare const resumeIntentSchema: z.ZodObject<{
|
|
17
|
+
forkAuthor: z.ZodOptional<z.ZodObject<{
|
|
18
|
+
platform: z.ZodEnum<["github", "gitlab"]>;
|
|
19
|
+
user: z.ZodString;
|
|
20
|
+
forkOrigin: z.ZodString;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
platform: "github" | "gitlab";
|
|
23
|
+
user: string;
|
|
24
|
+
forkOrigin: string;
|
|
25
|
+
}, {
|
|
26
|
+
platform: "github" | "gitlab";
|
|
27
|
+
user: string;
|
|
28
|
+
forkOrigin: string;
|
|
29
|
+
}>>;
|
|
30
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
31
|
+
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
32
|
+
repoPath: z.ZodString;
|
|
33
|
+
intentId: z.ZodString;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
repoPath: string;
|
|
36
|
+
intentId: string;
|
|
37
|
+
repoOrigin?: string | undefined;
|
|
38
|
+
forkAuthor?: {
|
|
39
|
+
platform: "github" | "gitlab";
|
|
40
|
+
user: string;
|
|
41
|
+
forkOrigin: string;
|
|
42
|
+
} | undefined;
|
|
43
|
+
workspaceId?: string | undefined;
|
|
44
|
+
}, {
|
|
45
|
+
repoPath: string;
|
|
46
|
+
intentId: string;
|
|
47
|
+
repoOrigin?: string | undefined;
|
|
48
|
+
forkAuthor?: {
|
|
49
|
+
platform: "github" | "gitlab";
|
|
50
|
+
user: string;
|
|
51
|
+
forkOrigin: string;
|
|
52
|
+
} | undefined;
|
|
53
|
+
workspaceId?: string | undefined;
|
|
54
|
+
}>;
|
|
55
|
+
export type ResumeIntentInput = z.infer<typeof resumeIntentSchema>;
|
|
56
|
+
export interface ResumeIntentResponse {
|
|
57
|
+
resumed: boolean;
|
|
58
|
+
intentId: string;
|
|
59
|
+
intent?: {
|
|
60
|
+
title: string;
|
|
61
|
+
description: string;
|
|
62
|
+
status: string;
|
|
63
|
+
};
|
|
64
|
+
decisions: ProjectDecision[];
|
|
65
|
+
count: number;
|
|
66
|
+
message: string;
|
|
67
|
+
}
|
|
68
|
+
export declare function resumeIntent(input: ResumeIntentInput): Promise<ResumeIntentResponse>;
|
|
69
|
+
export declare const resumeIntentTool: {
|
|
70
|
+
name: string;
|
|
71
|
+
description: string;
|
|
72
|
+
inputSchema: z.ZodObject<{
|
|
73
|
+
forkAuthor: z.ZodOptional<z.ZodObject<{
|
|
74
|
+
platform: z.ZodEnum<["github", "gitlab"]>;
|
|
75
|
+
user: z.ZodString;
|
|
76
|
+
forkOrigin: z.ZodString;
|
|
77
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
|
+
platform: "github" | "gitlab";
|
|
79
|
+
user: string;
|
|
80
|
+
forkOrigin: string;
|
|
81
|
+
}, {
|
|
82
|
+
platform: "github" | "gitlab";
|
|
83
|
+
user: string;
|
|
84
|
+
forkOrigin: string;
|
|
85
|
+
}>>;
|
|
86
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
87
|
+
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
88
|
+
repoPath: z.ZodString;
|
|
89
|
+
intentId: z.ZodString;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
repoPath: string;
|
|
92
|
+
intentId: string;
|
|
93
|
+
repoOrigin?: string | undefined;
|
|
94
|
+
forkAuthor?: {
|
|
95
|
+
platform: "github" | "gitlab";
|
|
96
|
+
user: string;
|
|
97
|
+
forkOrigin: string;
|
|
98
|
+
} | undefined;
|
|
99
|
+
workspaceId?: string | undefined;
|
|
100
|
+
}, {
|
|
101
|
+
repoPath: string;
|
|
102
|
+
intentId: string;
|
|
103
|
+
repoOrigin?: string | undefined;
|
|
104
|
+
forkAuthor?: {
|
|
105
|
+
platform: "github" | "gitlab";
|
|
106
|
+
user: string;
|
|
107
|
+
forkOrigin: string;
|
|
108
|
+
} | undefined;
|
|
109
|
+
workspaceId?: string | undefined;
|
|
110
|
+
}>;
|
|
111
|
+
handler: typeof resumeIntent;
|
|
112
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { resolveOrigin } from './resolve-origin.js';
|
|
3
|
+
import { forkFieldsExtensions, extractForkFields } from './_fork-fields.js';
|
|
4
|
+
import { activateIntent } from './activate-intent.js';
|
|
5
|
+
import { getIntentChanges } from './get-intent-changes.js';
|
|
6
|
+
import { getProjectDecisions } from './get-project-decisions.js';
|
|
7
|
+
/**
|
|
8
|
+
* One-call intent hydration for cross-developer handoff.
|
|
9
|
+
*
|
|
10
|
+
* Composes three EXISTING tools/IPC actions — nothing new is added to Muninn,
|
|
11
|
+
* so this works against any daemon version (backwards compatible):
|
|
12
|
+
* 1. activate_intent → adopt the intent as this session's current focus
|
|
13
|
+
* 2. get_intent_changes → the (now-active) intent's title/description/status
|
|
14
|
+
* 3. get_project_decisions → its recorded decisions (summary-only, lean)
|
|
15
|
+
*
|
|
16
|
+
* The existing tools are reused, never modified. A future Muninn
|
|
17
|
+
* `decision:by-intent` filter would let step 3 avoid pulling the full project
|
|
18
|
+
* list, but that's an optimization, not a requirement.
|
|
19
|
+
*/
|
|
20
|
+
export const resumeIntentSchema = z.object({
|
|
21
|
+
repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
|
|
22
|
+
repoPath: z.string().describe('Local path to the repository root'),
|
|
23
|
+
intentId: z.string().describe('The cloud ID (preferred) or local UUID of the intent to resume — e.g. the id from a "follow up on intent <id>" handoff.'),
|
|
24
|
+
...forkFieldsExtensions,
|
|
25
|
+
});
|
|
26
|
+
export async function resumeIntent(input) {
|
|
27
|
+
// Resolve the origin once and pass it down, so the three sub-calls don't each
|
|
28
|
+
// re-shell out to git.
|
|
29
|
+
const origin = resolveOrigin(input.repoOrigin, input.repoPath);
|
|
30
|
+
const base = { repoOrigin: origin, repoPath: input.repoPath, ...extractForkFields(input) };
|
|
31
|
+
// 1. Adopt the intent as THIS session's current focus (multi-active — never
|
|
32
|
+
// displaces another session's current). Fail loud if it can't be activated.
|
|
33
|
+
const activated = await activateIntent({ ...base, intentId: input.intentId });
|
|
34
|
+
if (!activated.success || !activated.intentId) {
|
|
35
|
+
return {
|
|
36
|
+
resumed: false,
|
|
37
|
+
intentId: input.intentId,
|
|
38
|
+
decisions: [],
|
|
39
|
+
count: 0,
|
|
40
|
+
message: `Could not resume intent ${input.intentId}: activation failed. Verify the id (cloud id or local UUID) and that the intent exists in this repo.`,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// 2 + 3. Hydrate the now-active intent's metadata and its decisions in parallel.
|
|
44
|
+
const [changes, project] = await Promise.all([
|
|
45
|
+
getIntentChanges(base),
|
|
46
|
+
getProjectDecisions(base),
|
|
47
|
+
]);
|
|
48
|
+
// Match decisions on every id form we know for this intent — the handoff
|
|
49
|
+
// prompt may carry the cloud id while stored decisions carry a local id (or
|
|
50
|
+
// vice versa), so union the passed id, the activated id, and the resolved one.
|
|
51
|
+
const targetIds = new Set([input.intentId, activated.intentId]);
|
|
52
|
+
if (changes.intent?.id)
|
|
53
|
+
targetIds.add(changes.intent.id);
|
|
54
|
+
const decisions = project.decisions.filter(d => targetIds.has(d.intentId) || d.intentIds.some(id => targetIds.has(id)));
|
|
55
|
+
const intent = changes.hasActiveIntent && changes.intent
|
|
56
|
+
? {
|
|
57
|
+
title: changes.intent.title,
|
|
58
|
+
description: changes.intent.description,
|
|
59
|
+
status: changes.intent.status,
|
|
60
|
+
}
|
|
61
|
+
: undefined;
|
|
62
|
+
return {
|
|
63
|
+
resumed: true,
|
|
64
|
+
intentId: input.intentId,
|
|
65
|
+
intent,
|
|
66
|
+
decisions,
|
|
67
|
+
count: decisions.length,
|
|
68
|
+
message: intent
|
|
69
|
+
? `Resumed "${intent.title}" (${intent.status}) — ${decisions.length} recorded decision(s) loaded. Call get_decision_detail(id) for the full rationale on any of them.`
|
|
70
|
+
: `Resumed intent ${input.intentId.substring(0, 8)} — ${decisions.length} recorded decision(s) loaded.`,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export const resumeIntentTool = {
|
|
74
|
+
name: 'resume_intent',
|
|
75
|
+
description: `Resume an existing intent by ID in one call — activate it AND load its recorded decisions.
|
|
76
|
+
|
|
77
|
+
Use this to pick up a handoff. When a prompt says "follow up on intent <id>" (or you otherwise want to continue a specific existing intent), call resume_intent(<id>) instead of creating a new one. It:
|
|
78
|
+
- activates the intent as THIS session's current focus (multi-active — never displaces a teammate's active intent), and
|
|
79
|
+
- returns the intent's title/description/status plus its recorded decisions (summary-only; call get_decision_detail(id) for full rationale on any one).
|
|
80
|
+
|
|
81
|
+
This is the fast path for cross-developer handoff without a session or transcript export: the reasoning lives in Kawa Code, so a teammate resumes the thread from just the intent id. For the code itself, the intent's owner should have committed or pushed first (a prompt carries reasoning, not an uncommitted working tree).
|
|
82
|
+
|
|
83
|
+
Returns { resumed, intentId, intent?, decisions[], count, message }. resumed=false with a message when the id can't be activated.`,
|
|
84
|
+
inputSchema: resumeIntentSchema,
|
|
85
|
+
handler: resumeIntent,
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=resume-intent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume-intent.js","sourceRoot":"","sources":["../../src/tools/resume-intent.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kawacode/mcp",
|
|
3
|
-
"version": "6.9.
|
|
3
|
+
"version": "6.9.4",
|
|
4
4
|
"description": "Team-aware memory for Claude Code, Cursor, and other AI coding assistants — intent tracking, decision history, real-time team conflict detection.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dev": "tsc --watch",
|
|
24
24
|
"start": "node build/index.js",
|
|
25
25
|
"clean": "rm -rf build",
|
|
26
|
-
"test": "yarn build && node --test 'build/pre-edit/*.test.js' 'build/stop/*.test.js'",
|
|
26
|
+
"test": "yarn build && node --test 'build/pre-edit/*.test.js' 'build/stop/*.test.js' 'build/tools/*.test.js'",
|
|
27
27
|
"prepublishOnly": "npm run build"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|