@kawacode/mcp 5.2.0 → 6.0.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 (81) hide show
  1. package/CLAUDE.md.example +1 -1
  2. package/README.md +54 -198
  3. package/build/index.js +10 -1
  4. package/build/index.js.map +1 -1
  5. package/build/kawacode-on-pre-edit.d.ts +27 -0
  6. package/build/kawacode-on-pre-edit.js +205 -0
  7. package/build/kawacode-on-pre-edit.js.map +1 -0
  8. package/build/kawacode-on-stop.d.ts +29 -0
  9. package/build/kawacode-on-stop.js +84 -0
  10. package/build/kawacode-on-stop.js.map +1 -0
  11. package/build/prompts/intent-first-workflow.js +2 -2
  12. package/build/services/muninn-ipc.d.ts +10 -5
  13. package/build/services/muninn-ipc.js +13 -8
  14. package/build/services/muninn-ipc.js.map +1 -1
  15. package/build/tools/_fork-fields.d.ts +84 -0
  16. package/build/tools/_fork-fields.js +65 -0
  17. package/build/tools/_fork-fields.js.map +1 -0
  18. package/build/tools/activate-intent.d.ts +66 -0
  19. package/build/tools/activate-intent.js +59 -3
  20. package/build/tools/activate-intent.js.map +1 -1
  21. package/build/tools/check-active-intent.d.ts +64 -0
  22. package/build/tools/check-active-intent.js +16 -2
  23. package/build/tools/check-active-intent.js.map +1 -1
  24. package/build/tools/complete-intent.d.ts +115 -4
  25. package/build/tools/complete-intent.js +130 -11
  26. package/build/tools/complete-intent.js.map +1 -1
  27. package/build/tools/create-intent.d.ts +73 -1
  28. package/build/tools/create-intent.js +105 -7
  29. package/build/tools/create-intent.js.map +1 -1
  30. package/build/tools/detect-intent-conflicts.d.ts +52 -0
  31. package/build/tools/detect-intent-conflicts.js +14 -10
  32. package/build/tools/detect-intent-conflicts.js.map +1 -1
  33. package/build/tools/edit-session-decision.d.ts +64 -12
  34. package/build/tools/edit-session-decision.js +4 -1
  35. package/build/tools/edit-session-decision.js.map +1 -1
  36. package/build/tools/evolve-decisions.d.ts +52 -0
  37. package/build/tools/evolve-decisions.js +14 -15
  38. package/build/tools/evolve-decisions.js.map +1 -1
  39. package/build/tools/get-intent-changes.d.ts +52 -0
  40. package/build/tools/get-intent-changes.js +4 -1
  41. package/build/tools/get-intent-changes.js.map +1 -1
  42. package/build/tools/get-intents-for-file.d.ts +52 -0
  43. package/build/tools/get-intents-for-file.js +4 -1
  44. package/build/tools/get-intents-for-file.js.map +1 -1
  45. package/build/tools/get-intents-for-lines.d.ts +52 -0
  46. package/build/tools/get-intents-for-lines.js +4 -1
  47. package/build/tools/get-intents-for-lines.js.map +1 -1
  48. package/build/tools/get-project-decisions.d.ts +52 -0
  49. package/build/tools/get-project-decisions.js +4 -1
  50. package/build/tools/get-project-decisions.js.map +1 -1
  51. package/build/tools/get-relevant-context.d.ts +52 -0
  52. package/build/tools/get-relevant-context.js +18 -24
  53. package/build/tools/get-relevant-context.js.map +1 -1
  54. package/build/tools/get-session-decisions.d.ts +52 -0
  55. package/build/tools/get-session-decisions.js +4 -1
  56. package/build/tools/get-session-decisions.js.map +1 -1
  57. package/build/tools/index.d.ts +620 -18
  58. package/build/tools/index.js +12 -3
  59. package/build/tools/index.js.map +1 -1
  60. package/build/tools/infer-history.d.ts +6 -0
  61. package/build/tools/infer-history.js +33 -16
  62. package/build/tools/infer-history.js.map +1 -1
  63. package/build/tools/list-team-intents.d.ts +58 -6
  64. package/build/tools/list-team-intents.js +5 -2
  65. package/build/tools/list-team-intents.js.map +1 -1
  66. package/build/tools/log-work.d.ts +52 -0
  67. package/build/tools/log-work.js +4 -1
  68. package/build/tools/log-work.js.map +1 -1
  69. package/build/tools/pre-edit-acknowledge.d.ts +92 -0
  70. package/build/tools/pre-edit-acknowledge.js +48 -0
  71. package/build/tools/pre-edit-acknowledge.js.map +1 -0
  72. package/build/tools/pre-edit-decision-check.d.ts +141 -0
  73. package/build/tools/pre-edit-decision-check.js +77 -0
  74. package/build/tools/pre-edit-decision-check.js.map +1 -0
  75. package/build/tools/record-decision.d.ts +88 -12
  76. package/build/tools/record-decision.js +15 -1
  77. package/build/tools/record-decision.js.map +1 -1
  78. package/build/tools/update-intent.d.ts +60 -8
  79. package/build/tools/update-intent.js +6 -1
  80. package/build/tools/update-intent.js.map +1 -1
  81. package/package.json +6 -3
@@ -1,13 +1,39 @@
1
1
  import { z } from 'zod';
2
2
  export declare const checkActiveIntentSchema: z.ZodObject<{
3
+ forkAuthor: z.ZodOptional<z.ZodObject<{
4
+ platform: z.ZodEnum<["github", "gitlab"]>;
5
+ user: z.ZodString;
6
+ forkOrigin: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ platform: "github" | "gitlab";
9
+ user: string;
10
+ forkOrigin: string;
11
+ }, {
12
+ platform: "github" | "gitlab";
13
+ user: string;
14
+ forkOrigin: string;
15
+ }>>;
16
+ workspaceId: z.ZodOptional<z.ZodString>;
3
17
  repoOrigin: z.ZodOptional<z.ZodString>;
4
18
  repoPath: z.ZodString;
5
19
  }, "strip", z.ZodTypeAny, {
6
20
  repoPath: string;
7
21
  repoOrigin?: string | undefined;
22
+ forkAuthor?: {
23
+ platform: "github" | "gitlab";
24
+ user: string;
25
+ forkOrigin: string;
26
+ } | undefined;
27
+ workspaceId?: string | undefined;
8
28
  }, {
9
29
  repoPath: string;
10
30
  repoOrigin?: string | undefined;
31
+ forkAuthor?: {
32
+ platform: "github" | "gitlab";
33
+ user: string;
34
+ forkOrigin: string;
35
+ } | undefined;
36
+ workspaceId?: string | undefined;
11
37
  }>;
12
38
  export type CheckActiveIntentInput = z.infer<typeof checkActiveIntentSchema>;
13
39
  export interface IntentBlock {
@@ -25,7 +51,19 @@ export interface ActiveIntentResponse {
25
51
  description: string;
26
52
  templateType: 'feature' | 'refactor' | 'exploration';
27
53
  constraints: string[];
54
+ /**
55
+ * `active` — currently being worked on (default).
56
+ * `pending` — auto-finalized by the sweeper or blocked at completion by
57
+ * conflicts; reportable as "live context" so the agent can prompt the
58
+ * user to resume via activate_intent or finalize via complete_intent.
59
+ */
28
60
  status: string;
61
+ /**
62
+ * Set when status === 'pending'. One of `sweeper-auto-finalize` (24h
63
+ * inactivity, no conflicts) or `sweeper-blocked-conflicts` (24h
64
+ * inactivity, distilled decisions contradicted standards).
65
+ */
66
+ pendingReason?: string;
29
67
  branch: string;
30
68
  forkedFrom?: string;
31
69
  blocks: IntentBlock[];
@@ -36,14 +74,40 @@ export declare const checkActiveIntentTool: {
36
74
  name: string;
37
75
  description: string;
38
76
  inputSchema: z.ZodObject<{
77
+ forkAuthor: z.ZodOptional<z.ZodObject<{
78
+ platform: z.ZodEnum<["github", "gitlab"]>;
79
+ user: z.ZodString;
80
+ forkOrigin: z.ZodString;
81
+ }, "strip", z.ZodTypeAny, {
82
+ platform: "github" | "gitlab";
83
+ user: string;
84
+ forkOrigin: string;
85
+ }, {
86
+ platform: "github" | "gitlab";
87
+ user: string;
88
+ forkOrigin: string;
89
+ }>>;
90
+ workspaceId: z.ZodOptional<z.ZodString>;
39
91
  repoOrigin: z.ZodOptional<z.ZodString>;
40
92
  repoPath: z.ZodString;
41
93
  }, "strip", z.ZodTypeAny, {
42
94
  repoPath: string;
43
95
  repoOrigin?: string | undefined;
96
+ forkAuthor?: {
97
+ platform: "github" | "gitlab";
98
+ user: string;
99
+ forkOrigin: string;
100
+ } | undefined;
101
+ workspaceId?: string | undefined;
44
102
  }, {
45
103
  repoPath: string;
46
104
  repoOrigin?: string | undefined;
105
+ forkAuthor?: {
106
+ platform: "github" | "gitlab";
107
+ user: string;
108
+ forkOrigin: string;
109
+ } | undefined;
110
+ workspaceId?: string | undefined;
47
111
  }>;
48
112
  handler: typeof checkActiveIntent;
49
113
  };
@@ -1,14 +1,17 @@
1
1
  import { z } from 'zod';
2
2
  import { request } from '../services/muninn-ipc.js';
3
3
  import { resolveOrigin } from './resolve-origin.js';
4
+ import { forkFieldsExtensions, extractForkFields } from './_fork-fields.js';
4
5
  export const checkActiveIntentSchema = z.object({
5
6
  repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
6
- repoPath: z.string().describe('Local path to the repository root')
7
+ repoPath: z.string().describe('Local path to the repository root'),
8
+ ...forkFieldsExtensions,
7
9
  });
8
10
  export async function checkActiveIntent(input) {
9
11
  const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
10
12
  const res = await request('intent', 'get-active', {
11
13
  repoOrigin: actualOrigin,
14
+ ...extractForkFields(input),
12
15
  });
13
16
  // Muninn returns { hasActiveIntent, intentId, intent }
14
17
  const intent = res.intent;
@@ -24,6 +27,7 @@ export async function checkActiveIntent(input) {
24
27
  templateType: (intent.templateType || 'feature'),
25
28
  constraints: intent.constraints || [],
26
29
  status: intent.status || 'active',
30
+ pendingReason: intent.pendingReason,
27
31
  branch: intent.branch || '',
28
32
  forkedFrom: intent.forkedFrom,
29
33
  blocks: [] // Blocks are tracked separately by intent-block service
@@ -40,7 +44,17 @@ you should ask the user to confirm intent details and then call create_and_activ
40
44
  An active intent tracks what the user is working on, enabling:
41
45
  - Better code context for AI-generated changes
42
46
  - Conflict detection with team members
43
- - Automatic assignment of code blocks to the intent`,
47
+ - Automatic assignment of code blocks to the intent
48
+
49
+ 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).`,
44
58
  inputSchema: checkActiveIntentSchema,
45
59
  handler: checkActiveIntent
46
60
  };
@@ -1 +1 @@
1
- {"version":3,"file":"check-active-intent.js","sourceRoot":"","sources":["../../src/tools/check-active-intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,O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,IAAI;QACrB,MAAM,EAAE;YACN,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,CAAC,QAAQ,IAAI,EAAE;YACnC,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE;YACzB,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,EAAE;YACrC,YAAY,EAAE,CAAC,MAAM,CAAC,YAAY,IAAI,SAAS,CAA2C;YAC1F,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,EAAE;YACrC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,QAAQ;YACjC,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;YAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,MAAM,EAAE,EAAE,CAAC,wDAAwD;SACpE;KACF,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE;;;;;;;;;;;;;;;;;;iCAkBkB;IAC/B,WAAW,EAAE,uBAAuB;IACpC,OAAO,EAAE,iBAAiB;CAC3B,CAAA"}
@@ -1,5 +1,19 @@
1
1
  import { z } from 'zod';
2
2
  export declare const completeIntentSchema: z.ZodObject<{
3
+ forkAuthor: z.ZodOptional<z.ZodObject<{
4
+ platform: z.ZodEnum<["github", "gitlab"]>;
5
+ user: z.ZodString;
6
+ forkOrigin: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ platform: "github" | "gitlab";
9
+ user: string;
10
+ forkOrigin: string;
11
+ }, {
12
+ platform: "github" | "gitlab";
13
+ user: string;
14
+ forkOrigin: string;
15
+ }>>;
16
+ workspaceId: z.ZodOptional<z.ZodString>;
3
17
  repoOrigin: z.ZodOptional<z.ZodString>;
4
18
  repoPath: z.ZodString;
5
19
  intentId: z.ZodOptional<z.ZodString>;
@@ -7,34 +21,119 @@ export declare const completeIntentSchema: z.ZodObject<{
7
21
  status: z.ZodDefault<z.ZodEnum<["committed", "pushed", "done", "abandoned", "superseded"]>>;
8
22
  supersededBy: z.ZodOptional<z.ZodString>;
9
23
  }, "strip", z.ZodTypeAny, {
10
- repoPath: string;
11
24
  status: "committed" | "pushed" | "done" | "abandoned" | "superseded";
25
+ repoPath: string;
12
26
  repoOrigin?: string | undefined;
27
+ forkAuthor?: {
28
+ platform: "github" | "gitlab";
29
+ user: string;
30
+ forkOrigin: string;
31
+ } | undefined;
32
+ workspaceId?: string | undefined;
13
33
  intentId?: string | undefined;
14
34
  commitSha?: string | undefined;
15
35
  supersededBy?: string | undefined;
16
36
  }, {
17
37
  repoPath: string;
18
- repoOrigin?: string | undefined;
19
38
  status?: "committed" | "pushed" | "done" | "abandoned" | "superseded" | undefined;
39
+ repoOrigin?: string | undefined;
40
+ forkAuthor?: {
41
+ platform: "github" | "gitlab";
42
+ user: string;
43
+ forkOrigin: string;
44
+ } | undefined;
45
+ workspaceId?: string | undefined;
20
46
  intentId?: string | undefined;
21
47
  commitSha?: string | undefined;
22
48
  supersededBy?: string | undefined;
23
49
  }>;
24
50
  export type CompleteIntentInput = z.infer<typeof completeIntentSchema>;
51
+ /**
52
+ * One contradiction between a distilled proposed decision and an existing
53
+ * standard decision in the repo. Surfaced when distillation produces decisions
54
+ * that conflict with previously-recorded ones (PRD §5.2 step 5b / §7.2).
55
+ */
56
+ export interface ConflictMatch {
57
+ proposedDecisionSummary: string;
58
+ proposedDecisionRationale: string;
59
+ conflictsWith: {
60
+ decisionId: string;
61
+ summary: string;
62
+ intentTitle?: string;
63
+ author?: string;
64
+ };
65
+ sharedConcern?: string;
66
+ description?: string;
67
+ }
25
68
  export interface CompleteIntentResponse {
26
69
  success: boolean;
27
70
  intentId: string;
28
71
  previousStatus: string;
72
+ /**
73
+ * The status after this call. Stays "active" when distillation surfaces
74
+ * conflicts (PRD §5.2 step 5b — no decisions written, no transition).
75
+ */
29
76
  newStatus: string;
30
77
  commitSha?: string;
31
78
  message: string;
79
+ /**
80
+ * Number of distilled standard decisions written to the API on a clean
81
+ * completion. Omitted when there were no ephemerals, when the v2 pipeline
82
+ * is disabled, or when conflicts blocked the write.
83
+ *
84
+ * Decision *content* is intentionally not surfaced here — it's already
85
+ * visible via the orchestration panel and via get_intent_decisions /
86
+ * get_relevant_context. Inlining the full list would just duplicate that
87
+ * channel and add noise to the agent's reply.
88
+ */
89
+ committedDecisionCount?: number;
90
+ /**
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.
96
+ */
97
+ conflicts?: ConflictMatch[];
98
+ /**
99
+ * Set when success=false to discriminate between:
100
+ * - "conflicts" → see `conflicts[]`
101
+ * - "transient-failure" → distiller LLM call or /check-conflicts API errored;
102
+ * `failedStage` and `error` carry diagnostics, the user retries.
103
+ */
104
+ reason?: 'conflicts' | 'transient-failure';
105
+ failedStage?: string;
106
+ error?: string;
107
+ /**
108
+ * Phase 3.5 — true when an API write call (decisions/sync, intents/PATCH)
109
+ * was queued for later replay because the API was unreachable. Work is
110
+ * "done" from the user's perspective; surface a heads-up. `deferredStages`
111
+ * names which write(s) were queued.
112
+ */
113
+ apiSyncDeferred?: boolean;
114
+ deferredStages?: string[];
115
+ deferredDecisionCount?: number;
116
+ deferredError?: string;
32
117
  }
33
118
  export declare function completeIntent(input: CompleteIntentInput): Promise<CompleteIntentResponse>;
34
119
  export declare const completeIntentTool: {
35
120
  name: string;
36
121
  description: string;
37
122
  inputSchema: z.ZodObject<{
123
+ forkAuthor: z.ZodOptional<z.ZodObject<{
124
+ platform: z.ZodEnum<["github", "gitlab"]>;
125
+ user: z.ZodString;
126
+ forkOrigin: z.ZodString;
127
+ }, "strip", z.ZodTypeAny, {
128
+ platform: "github" | "gitlab";
129
+ user: string;
130
+ forkOrigin: string;
131
+ }, {
132
+ platform: "github" | "gitlab";
133
+ user: string;
134
+ forkOrigin: string;
135
+ }>>;
136
+ workspaceId: z.ZodOptional<z.ZodString>;
38
137
  repoOrigin: z.ZodOptional<z.ZodString>;
39
138
  repoPath: z.ZodString;
40
139
  intentId: z.ZodOptional<z.ZodString>;
@@ -42,16 +141,28 @@ export declare const completeIntentTool: {
42
141
  status: z.ZodDefault<z.ZodEnum<["committed", "pushed", "done", "abandoned", "superseded"]>>;
43
142
  supersededBy: z.ZodOptional<z.ZodString>;
44
143
  }, "strip", z.ZodTypeAny, {
45
- repoPath: string;
46
144
  status: "committed" | "pushed" | "done" | "abandoned" | "superseded";
145
+ repoPath: string;
47
146
  repoOrigin?: string | undefined;
147
+ forkAuthor?: {
148
+ platform: "github" | "gitlab";
149
+ user: string;
150
+ forkOrigin: string;
151
+ } | undefined;
152
+ workspaceId?: string | undefined;
48
153
  intentId?: string | undefined;
49
154
  commitSha?: string | undefined;
50
155
  supersededBy?: string | undefined;
51
156
  }, {
52
157
  repoPath: string;
53
- repoOrigin?: string | undefined;
54
158
  status?: "committed" | "pushed" | "done" | "abandoned" | "superseded" | undefined;
159
+ repoOrigin?: string | undefined;
160
+ forkAuthor?: {
161
+ platform: "github" | "gitlab";
162
+ user: string;
163
+ forkOrigin: string;
164
+ } | undefined;
165
+ workspaceId?: string | undefined;
55
166
  intentId?: string | undefined;
56
167
  commitSha?: string | undefined;
57
168
  supersededBy?: string | undefined;
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { request } from '../services/muninn-ipc.js';
3
3
  import { resolveOrigin } from './resolve-origin.js';
4
+ import { forkFieldsExtensions, extractForkFields } from './_fork-fields.js';
4
5
  export const completeIntentSchema = z.object({
5
6
  repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
6
7
  repoPath: z.string().describe('Local path to the repository root'),
@@ -8,7 +9,8 @@ export const completeIntentSchema = z.object({
8
9
  commitSha: z.string().optional().describe('The git commit SHA to associate with this intent (if already committed)'),
9
10
  status: z.enum(['committed', 'pushed', 'done', 'abandoned', 'superseded']).default('committed')
10
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.'),
11
- supersededBy: z.string().optional().describe('Intent ID that supersedes this one. Required when status is "superseded".')
12
+ supersededBy: z.string().optional().describe('Intent ID that supersedes this one. Required when status is "superseded".'),
13
+ ...forkFieldsExtensions,
12
14
  });
13
15
  export async function completeIntent(input) {
14
16
  const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
@@ -43,23 +45,102 @@ export async function completeIntent(input) {
43
45
  status: input.status,
44
46
  commitSha: input.commitSha,
45
47
  supersededBy: input.supersededBy,
48
+ ...extractForkFields(input),
46
49
  });
47
50
  const intentId = res.intentId || '';
48
51
  const intentTitle = res.intentTitle || 'Intent';
49
52
  const previousStatus = res.previousStatus || 'active';
50
- const statusMessages = {
51
- committed: `Intent "${intentTitle}" marked as committed`,
52
- pushed: `Intent "${intentTitle}" marked as pushed`,
53
- done: `Intent "${intentTitle}" marked as done`,
54
- abandoned: `Intent "${intentTitle}" abandoned`
55
- };
53
+ const success = res.success !== false;
54
+ const conflicts = Array.isArray(res.conflicts) ? res.conflicts : [];
55
+ const committedDecisionCount = typeof res.committedDecisionCount === 'number' ? res.committedDecisionCount : undefined;
56
+ const reason = res.reason === 'conflicts' || res.reason === 'transient-failure' ? res.reason : undefined;
57
+ const apiSyncDeferred = res.apiSyncDeferred === true;
58
+ // Branch on the four §7.2 / §7.3 outcome shapes — pick the message that
59
+ // tells the agent exactly what to surface to the user.
60
+ let newStatus;
61
+ let message;
62
+ if (!success && reason === 'conflicts') {
63
+ // PRD §5.2 step 5b — distilled decisions contradicted standards. No write,
64
+ // no transition, bucket preserved. The agent's job is to surface each
65
+ // conflict to the user and ask how to resolve.
66
+ newStatus = res.status || 'active';
67
+ const lines = [
68
+ `Cannot complete: ${conflicts.length} conflict(s) between proposed decisions and existing standards.`,
69
+ '',
70
+ 'For each conflict below, surface BOTH sides side-by-side to the user and ask how to resolve.',
71
+ 'Common resolution paths:',
72
+ ' (A) Record a superseding decision: record_decision(type="fork", supersedes=["<existing-decision-id>"], rationale=...). Then retry complete_intent.',
73
+ ' (B) Abandon the intent: complete_intent(status="abandoned"). Decisions are soft-deleted but recoverable via activate_intent.',
74
+ ' (C) Keep the intent active and continue working.',
75
+ '',
76
+ 'DO NOT silently retry — every retry runs the distiller again and produces the same conflicts.',
77
+ '',
78
+ ];
79
+ conflicts.forEach((c, i) => {
80
+ lines.push(`[${i + 1}] Proposed: ${c.proposedDecisionSummary}`);
81
+ const cw = c.conflictsWith || {};
82
+ const author = cw.author ? ` by ${cw.author}` : '';
83
+ const intentPart = cw.intentTitle ? ` (intent: "${cw.intentTitle}")` : '';
84
+ lines.push(` Conflicts with: ${cw.summary || cw.decisionId || '(unknown)'}${intentPart}${author}`);
85
+ if (c.description)
86
+ lines.push(` ${c.description}`);
87
+ lines.push('');
88
+ });
89
+ message = lines.join('\n');
90
+ }
91
+ else if (!success && reason === 'transient-failure') {
92
+ // Distiller LLM error or /check-conflicts API error. Bucket re-populated,
93
+ // intent stays active. User decides whether to wait + retry or abandon.
94
+ newStatus = res.status || 'active';
95
+ const stage = res.failedStage ? ` (${res.failedStage})` : '';
96
+ const errPart = res.error ? `: ${res.error}` : '';
97
+ message =
98
+ `Could not complete intent "${intentTitle}" — transient failure${stage}${errPart}. ` +
99
+ `The ephemerals were preserved. Wait for the underlying issue to clear, then retry complete_intent. ` +
100
+ `If retrying repeatedly fails, the user can abandon the intent (complete_intent(status="abandoned")).`;
101
+ }
102
+ else if (!success) {
103
+ // Catch-all for legacy / unexpected error shapes.
104
+ newStatus = res.newStatus || res.status || input.status;
105
+ message = `Failed to complete intent "${intentTitle}".`;
106
+ }
107
+ else {
108
+ // Clean completion. Note: Phase 3.5 may have queued writes for later
109
+ // replay — the response is success=true but apiSyncDeferred=true.
110
+ newStatus = res.newStatus || input.status;
111
+ const statusMessages = {
112
+ committed: `Intent "${intentTitle}" marked as committed`,
113
+ pushed: `Intent "${intentTitle}" marked as pushed`,
114
+ done: `Intent "${intentTitle}" marked as done`,
115
+ abandoned: `Intent "${intentTitle}" abandoned`,
116
+ superseded: `Intent "${intentTitle}" marked as superseded`,
117
+ };
118
+ const statusMsg = statusMessages[input.status] || `Intent "${intentTitle}" updated`;
119
+ const shaPart = input.commitSha ? ` (commit: ${input.commitSha.substring(0, 7)})` : '';
120
+ const distilledPart = committedDecisionCount && committedDecisionCount > 0
121
+ ? ` — ${committedDecisionCount} distilled decision(s) recorded`
122
+ : '';
123
+ const deferredPart = apiSyncDeferred
124
+ ? ` — API sync deferred (${(res.deferredStages || []).join(', ')}); will retry on the next sync tick`
125
+ : '';
126
+ message = statusMsg + shaPart + distilledPart + deferredPart;
127
+ }
56
128
  return {
57
- success: res.success !== false,
129
+ success,
58
130
  intentId,
59
131
  previousStatus,
60
- newStatus: input.status,
132
+ newStatus,
61
133
  commitSha: input.commitSha,
62
- message: statusMessages[input.status] + (input.commitSha ? ` (commit: ${input.commitSha.substring(0, 7)})` : '')
134
+ message,
135
+ committedDecisionCount,
136
+ conflicts: conflicts.length > 0 ? conflicts : undefined,
137
+ reason,
138
+ failedStage: res.failedStage,
139
+ error: res.error,
140
+ apiSyncDeferred: apiSyncDeferred ? true : undefined,
141
+ deferredStages: Array.isArray(res.deferredStages) ? res.deferredStages : undefined,
142
+ deferredDecisionCount: typeof res.deferredDecisionCount === 'number' ? res.deferredDecisionCount : undefined,
143
+ deferredError: res.deferredError,
63
144
  };
64
145
  }
65
146
  export const completeIntentTool = {
@@ -75,7 +156,45 @@ Status values:
75
156
  - "committed": Code is committed locally (default)
76
157
  - "pushed": Code has been pushed to remote
77
158
  - "done": Work is fully complete
78
- - "abandoned": Work was discarded without committing`,
159
+ - "abandoned": Work was discarded without committing
160
+
161
+ REQUIRED: Inspect the response after calling this tool. Four outcomes:
162
+
163
+ 1. response.success === true:
164
+ The task is complete. Briefly acknowledge the commit and — if
165
+ response.committedDecisionCount > 0 — mention that N distilled architectural
166
+ decisions were recorded for the intent. Do NOT enumerate the decisions
167
+ inline; they're visible via the orchestration panel and via
168
+ get_intent_decisions / get_relevant_context if the user wants details.
169
+ If response.apiSyncDeferred === true, also mention that the API sync was
170
+ deferred; the queued writes will replay on the next sync tick.
171
+
172
+ 2. response.success === false AND response.conflicts is non-empty:
173
+ The distillation produced decisions that contradict existing standards in
174
+ this repo. Status stays "active" and NO decisions were written.
175
+ Surface EACH conflict to the user with the proposed decision and the
176
+ conflicting standard decision side-by-side. Then ask the user how to
177
+ resolve. Common options to suggest:
178
+ (A) Record a superseding decision via record_decision(type="fork",
179
+ supersedes=["<existing-decision-id>"], rationale=...). Then retry
180
+ complete_intent — the distiller may now find the new superseding
181
+ decision in recall and the conflict resolves.
182
+ (B) Abandon the intent: complete_intent(status="abandoned"). Decisions
183
+ are soft-deleted but recoverable via activate_intent if the user
184
+ changes their mind.
185
+ (C) Keep the intent active and continue working.
186
+ DO NOT silently retry — every retry runs the distiller (and the per-pair
187
+ judge) again. Wait for the user's decision.
188
+
189
+ 3. response.success === false AND response.reason === "transient-failure":
190
+ The distiller LLM call or the conflict-check API call errored. The
191
+ ephemerals are preserved (the bucket is intact), and the intent stays
192
+ "active". Tell the user the failure stage (response.failedStage) and the
193
+ underlying error, then suggest retrying once the issue clears, or
194
+ abandoning if the failure persists.
195
+
196
+ 4. In a non-interactive (autonomous) session: log the conflicts at WARN level
197
+ and leave the intent active. A human review path exists via the panel.`,
79
198
  inputSchema: completeIntentSchema,
80
199
  handler: completeIntent
81
200
  };
@@ -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,M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,qBAAqB,EAAE,OAAO,GAAG,CAAC,qBAAqB,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS;QAC5G,aAAa,EAAE,GAAG,CAAC,aAAa;KACjC,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0EAiD2D;IACxE,WAAW,EAAE,oBAAoB;IACjC,OAAO,EAAE,cAAc;CACxB,CAAA"}
@@ -1,5 +1,19 @@
1
1
  import { z } from 'zod';
2
2
  export declare const createAndActivateIntentSchema: z.ZodObject<{
3
+ forkAuthor: z.ZodOptional<z.ZodObject<{
4
+ platform: z.ZodEnum<["github", "gitlab"]>;
5
+ user: z.ZodString;
6
+ forkOrigin: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ platform: "github" | "gitlab";
9
+ user: string;
10
+ forkOrigin: string;
11
+ }, {
12
+ platform: "github" | "gitlab";
13
+ user: string;
14
+ forkOrigin: string;
15
+ }>>;
16
+ workspaceId: z.ZodOptional<z.ZodString>;
3
17
  repoOrigin: z.ZodOptional<z.ZodString>;
4
18
  repoPath: z.ZodString;
5
19
  title: z.ZodString;
@@ -14,12 +28,24 @@ export declare const createAndActivateIntentSchema: z.ZodObject<{
14
28
  templateType: "feature" | "refactor" | "exploration";
15
29
  force: boolean;
16
30
  repoOrigin?: string | undefined;
31
+ forkAuthor?: {
32
+ platform: "github" | "gitlab";
33
+ user: string;
34
+ forkOrigin: string;
35
+ } | undefined;
36
+ workspaceId?: string | undefined;
17
37
  constraints?: string[] | undefined;
18
38
  }, {
19
39
  repoPath: string;
20
40
  title: string;
21
41
  description: string;
22
42
  repoOrigin?: string | undefined;
43
+ forkAuthor?: {
44
+ platform: "github" | "gitlab";
45
+ user: string;
46
+ forkOrigin: string;
47
+ } | undefined;
48
+ workspaceId?: string | undefined;
23
49
  templateType?: "feature" | "refactor" | "exploration" | undefined;
24
50
  constraints?: string[] | undefined;
25
51
  force?: boolean | undefined;
@@ -39,18 +65,52 @@ interface ConflictInfo {
39
65
  oppositionDetected: boolean;
40
66
  oppositionDetail: string | null;
41
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
+ }
42
86
  export interface CreateIntentResponse {
43
87
  success: boolean;
44
88
  intentId: string;
45
- action: 'created' | 'reactivated' | 'conflict';
89
+ action: 'created' | 'reactivated' | 'conflict' | 'lock_conflict' | 'pending_blocked';
46
90
  message: string;
47
91
  conflicts?: ConflictInfo[];
92
+ lockConflict?: ActiveIntentLockConflict;
93
+ pendingIntent?: PendingIntentBlocking;
48
94
  }
49
95
  export declare function createAndActivateIntent(input: CreateIntentInput): Promise<CreateIntentResponse>;
50
96
  export declare const createAndActivateIntentTool: {
51
97
  name: string;
52
98
  description: string;
53
99
  inputSchema: z.ZodObject<{
100
+ forkAuthor: z.ZodOptional<z.ZodObject<{
101
+ platform: z.ZodEnum<["github", "gitlab"]>;
102
+ user: z.ZodString;
103
+ forkOrigin: z.ZodString;
104
+ }, "strip", z.ZodTypeAny, {
105
+ platform: "github" | "gitlab";
106
+ user: string;
107
+ forkOrigin: string;
108
+ }, {
109
+ platform: "github" | "gitlab";
110
+ user: string;
111
+ forkOrigin: string;
112
+ }>>;
113
+ workspaceId: z.ZodOptional<z.ZodString>;
54
114
  repoOrigin: z.ZodOptional<z.ZodString>;
55
115
  repoPath: z.ZodString;
56
116
  title: z.ZodString;
@@ -65,12 +125,24 @@ export declare const createAndActivateIntentTool: {
65
125
  templateType: "feature" | "refactor" | "exploration";
66
126
  force: boolean;
67
127
  repoOrigin?: string | undefined;
128
+ forkAuthor?: {
129
+ platform: "github" | "gitlab";
130
+ user: string;
131
+ forkOrigin: string;
132
+ } | undefined;
133
+ workspaceId?: string | undefined;
68
134
  constraints?: string[] | undefined;
69
135
  }, {
70
136
  repoPath: string;
71
137
  title: string;
72
138
  description: string;
73
139
  repoOrigin?: string | undefined;
140
+ forkAuthor?: {
141
+ platform: "github" | "gitlab";
142
+ user: string;
143
+ forkOrigin: string;
144
+ } | undefined;
145
+ workspaceId?: string | undefined;
74
146
  templateType?: "feature" | "refactor" | "exploration" | undefined;
75
147
  constraints?: string[] | undefined;
76
148
  force?: boolean | undefined;