@kawacode/mcp 5.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 (88) hide show
  1. package/CLAUDE.md.example +80 -0
  2. package/LICENSE +35 -0
  3. package/README.md +322 -0
  4. package/build/index.d.ts +2 -0
  5. package/build/index.js +231 -0
  6. package/build/index.js.map +1 -0
  7. package/build/prompts/intent-first-workflow.d.ts +24 -0
  8. package/build/prompts/intent-first-workflow.js +204 -0
  9. package/build/prompts/intent-first-workflow.js.map +1 -0
  10. package/build/resources/active-intent.d.ts +9 -0
  11. package/build/resources/active-intent.js +52 -0
  12. package/build/resources/active-intent.js.map +1 -0
  13. package/build/services/active-intent-store.d.ts +36 -0
  14. package/build/services/active-intent-store.js +45 -0
  15. package/build/services/active-intent-store.js.map +1 -0
  16. package/build/services/kawa-api.d.ts +131 -0
  17. package/build/services/kawa-api.js +239 -0
  18. package/build/services/kawa-api.js.map +1 -0
  19. package/build/services/muninn-ipc.d.ts +45 -0
  20. package/build/services/muninn-ipc.js +275 -0
  21. package/build/services/muninn-ipc.js.map +1 -0
  22. package/build/services/repo-encryption.d.ts +46 -0
  23. package/build/services/repo-encryption.js +92 -0
  24. package/build/services/repo-encryption.js.map +1 -0
  25. package/build/services/storage-decryption.d.ts +52 -0
  26. package/build/services/storage-decryption.js +162 -0
  27. package/build/services/storage-decryption.js.map +1 -0
  28. package/build/tools/assign-blocks.d.ts +87 -0
  29. package/build/tools/assign-blocks.js +49 -0
  30. package/build/tools/assign-blocks.js.map +1 -0
  31. package/build/tools/check-active-intent.d.ts +50 -0
  32. package/build/tools/check-active-intent.js +48 -0
  33. package/build/tools/check-active-intent.js.map +1 -0
  34. package/build/tools/complete-intent.d.ts +48 -0
  35. package/build/tools/complete-intent.js +53 -0
  36. package/build/tools/complete-intent.js.map +1 -0
  37. package/build/tools/create-intent.d.ts +58 -0
  38. package/build/tools/create-intent.js +49 -0
  39. package/build/tools/create-intent.js.map +1 -0
  40. package/build/tools/detect-intent-conflicts.d.ts +361 -0
  41. package/build/tools/detect-intent-conflicts.js +91 -0
  42. package/build/tools/detect-intent-conflicts.js.map +1 -0
  43. package/build/tools/edit-session-decision.d.ts +201 -0
  44. package/build/tools/edit-session-decision.js +50 -0
  45. package/build/tools/edit-session-decision.js.map +1 -0
  46. package/build/tools/evolve-decisions.d.ts +50 -0
  47. package/build/tools/evolve-decisions.js +45 -0
  48. package/build/tools/evolve-decisions.js.map +1 -0
  49. package/build/tools/get-intent-changes.d.ts +49 -0
  50. package/build/tools/get-intent-changes.js +58 -0
  51. package/build/tools/get-intent-changes.js.map +1 -0
  52. package/build/tools/get-intents-for-file.d.ts +57 -0
  53. package/build/tools/get-intents-for-file.js +57 -0
  54. package/build/tools/get-intents-for-file.js.map +1 -0
  55. package/build/tools/get-intents-for-lines.d.ts +71 -0
  56. package/build/tools/get-intents-for-lines.js +64 -0
  57. package/build/tools/get-intents-for-lines.js.map +1 -0
  58. package/build/tools/get-project-context.d.ts +82 -0
  59. package/build/tools/get-project-context.js +73 -0
  60. package/build/tools/get-project-context.js.map +1 -0
  61. package/build/tools/get-project-decisions.d.ts +51 -0
  62. package/build/tools/get-project-decisions.js +56 -0
  63. package/build/tools/get-project-decisions.js.map +1 -0
  64. package/build/tools/get-relevant-context.d.ts +89 -0
  65. package/build/tools/get-relevant-context.js +104 -0
  66. package/build/tools/get-relevant-context.js.map +1 -0
  67. package/build/tools/get-session-decisions.d.ts +57 -0
  68. package/build/tools/get-session-decisions.js +48 -0
  69. package/build/tools/get-session-decisions.js.map +1 -0
  70. package/build/tools/index.d.ts +656 -0
  71. package/build/tools/index.js +57 -0
  72. package/build/tools/index.js.map +1 -0
  73. package/build/tools/infer-history.d.ts +85 -0
  74. package/build/tools/infer-history.js +69 -0
  75. package/build/tools/infer-history.js.map +1 -0
  76. package/build/tools/list-team-intents.d.ts +51 -0
  77. package/build/tools/list-team-intents.js +57 -0
  78. package/build/tools/list-team-intents.js.map +1 -0
  79. package/build/tools/log-work.d.ts +45 -0
  80. package/build/tools/log-work.js +30 -0
  81. package/build/tools/log-work.js.map +1 -0
  82. package/build/tools/record-decision.d.ts +132 -0
  83. package/build/tools/record-decision.js +66 -0
  84. package/build/tools/record-decision.js.map +1 -0
  85. package/build/tools/resolve-origin.d.ts +13 -0
  86. package/build/tools/resolve-origin.js +33 -0
  87. package/build/tools/resolve-origin.js.map +1 -0
  88. package/package.json +36 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,SAAS,EACT,QAAQ,EACT,MAAM,oCAAoC,CAAA;AAE3C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAEtE,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,OAAO,EACP,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,eAAe,EAChB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,OAAO,EAA6B,MAAM,oCAAoC,CAAA;AACvF,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAA;AAElF,oBAAoB;AACpB,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;IACE,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,OAAO;CACjB,EACD;IACE,YAAY,EAAE;QACZ,KAAK,EAAE,EAAE;QACT,OAAO,EA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E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;IAC7B,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,OAAY;IAC9B,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvC,OAAO,QAAQ,KAAK,aAAa,IAAI,QAAQ,KAAK,YAAY,CAAA;AAChE,CAAC;AAED,mBAAmB;AACnB,KAAK,UAAU,IAAI;IACjB,sDAAsD;IACtD,OAAO,CAAC,KAAK,CAAC,uDAAuD,CAAC,CAAA;IAEtE,kDAAkD;IAClD,IAAI,CAAC;QACH,MAAM,eAAe,EAAE,CAAA;QACvB,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACtC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,YAAa,GAAa,CAAC,OAAO,EAAE,CAAC,CAAA;QACnD,OAAO,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAA;IACrF,CAAC;IAED,4BAA4B;IAC5B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAE/B,OAAO,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAA;AAClD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAA;IACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
@@ -0,0 +1,24 @@
1
+ export declare const intentFirstWorkflowPrompt: {
2
+ name: string;
3
+ description: string;
4
+ arguments: {
5
+ name: string;
6
+ description: string;
7
+ required: boolean;
8
+ }[];
9
+ getPrompt: (args?: {
10
+ task_description?: string;
11
+ }) => string;
12
+ };
13
+ export declare const prompts: {
14
+ name: string;
15
+ description: string;
16
+ arguments: {
17
+ name: string;
18
+ description: string;
19
+ required: boolean;
20
+ }[];
21
+ getPrompt: (args?: {
22
+ task_description?: string;
23
+ }) => string;
24
+ }[];
@@ -0,0 +1,204 @@
1
+ export const intentFirstWorkflowPrompt = {
2
+ name: 'implementation_workflow',
3
+ description: 'Standard workflow for implementing code changes with intent tracking. Use this when starting any code implementation task.',
4
+ arguments: [
5
+ {
6
+ name: 'task_description',
7
+ description: 'Brief description of what the user wants to implement',
8
+ required: false
9
+ }
10
+ ],
11
+ getPrompt: (args) => {
12
+ const taskContext = args?.task_description
13
+ ? `\n\n**Current Task**: ${args.task_description}`
14
+ : '';
15
+ return `## AI Code Implementation Workflow${taskContext}
16
+
17
+ When implementing code changes, follow the intent-aware workflow below. This workflow tracks your work, enables team visibility, and streamlines the commit process.
18
+
19
+ ### Task Complexity Triage
20
+
21
+ Before using MCP tools, assess the task complexity. Match your workflow to the task — don't pay 2K tokens of overhead for a one-line fix.
22
+
23
+ **Skip MCP entirely** — Single-file fixes, typos, adding a log line, renaming a variable, anything where the change is obvious from the prompt alone. Just write the code.
24
+
25
+ **Lightweight** — Bug fixes, small features in 1-2 files, work in familiar code areas. Use only:
26
+
27
+ | When | Action | Tool |
28
+ |------|--------|------|
29
+ | **Before coding** | Check for active intent (resume if exists) | \`check_active_intent\` |
30
+ | **After edits** | Log what was done | \`log_work\` or \`assign_blocks_to_intent\` |
31
+
32
+ **Full workflow** — Multi-file features, unfamiliar code areas, architectural decisions, cross-cutting changes, or work that may overlap with teammates. Use the complete lifecycle:
33
+
34
+ | When | Action | Tool |
35
+ |------|--------|------|
36
+ | **After exploring request** | Get relevant context (with discovered files) | \`get_relevant_context\` |
37
+ | **Before coding** | Check/create intent | \`check_active_intent\`, \`create_and_activate_intent\` |
38
+ | **After each file edit** | Assign modified line ranges | \`assign_blocks_to_intent\` |
39
+ | **On "done"/"commit"/"worked"/etc.** | Verify blocks → Git commit → Complete | \`get_intent_changes\`, \`complete_intent\` |
40
+
41
+ **Trigger phrases for commit flow**: "this worked", "let's commit", "done", "close this", "ship it", "looks good"
42
+
43
+ **Token-efficient context**: Call \`get_relevant_context\` **after initial exploration** of the user's request — once you know which files are involved. Pass both the prompt AND the \`activeFiles\` parameter with files you've discovered. This gives much better relevance matching than calling with just a vague prompt.
44
+
45
+ ### During Implementation
46
+
47
+ - Write code as normal
48
+ - Track which files and line ranges you modify (you'll need this for block assignment)
49
+ - If you discover the scope is larger than expected, continue under the same intent
50
+ - **Record decisions silently** as they occur (see "Recording Decisions" below)
51
+
52
+ ### Recording Decisions
53
+
54
+ Record decisions silently using \`record_decision\` when you:
55
+
56
+ | Trigger | Decision Type | Example |
57
+ |---------|---------------|---------|
58
+ | Choose between alternatives | \`fork\` | "Selected Rust over TypeScript for performance" |
59
+ | Try an approach that fails | \`abandoned\` | "mongodb-memory-server rejected due to binary issues" |
60
+ | Find unexpected limitation | \`discovery\` | "Unix socket paths limited to 104 chars on macOS" |
61
+ | Identify hard requirement | \`constraint\` | "Must work offline per project requirements" |
62
+ | Make explicit trade-off | \`tradeoff\` | "Chose simplicity over flexibility" |
63
+ | Select library/dependency | \`dependency\` | "Using serde for JSON serialization" |
64
+ | **Option violates constraint** | Include in \`constraintViolations\` | Document in \`record_decision\` |
65
+
66
+ **Important**:
67
+ - Record decisions silently - do not announce to the user that you're recording
68
+ - Decisions made during **conversation** (planning, discussion) are just as important as implementation decisions
69
+ - If you forget to record during work, catch them in the pre-commit review (see Commit Flow)
70
+ - Decisions are reviewed before commit
71
+
72
+ ### Commit Prompt
73
+
74
+ When you detect a context switch, prompt the user:
75
+
76
+ > "You have uncommitted work on **'[intent title]'** ([N] files changed). This new request appears to be a different task. Would you like to:
77
+ > 1. **Commit** the current work first, then start on the new task
78
+ > 2. **Continue** - this is actually related to the current intent
79
+ > 3. **Abandon** the current work without committing"
80
+
81
+ Use \`get_intent_changes\` to get the file count and change summary for the prompt.
82
+
83
+ ### Commit Flow
84
+
85
+ When the user chooses to commit (or explicitly requests it):
86
+
87
+ 1. **Get changes**: Call \`get_intent_changes\` to see modified files
88
+
89
+ 2. **Review conversation for missed decisions**: Analyze the conversation since the intent was created. Look for architectural decisions that were made but not yet recorded:
90
+ - **Alternatives discussed**: "Should we use X or Y?" → "Let's use X because..."
91
+ - **Rejected approaches**: "We can't do X because..." or "This won't work due to..."
92
+ - **Trade-offs made**: "The trade-off is..." or "We chose simplicity over performance"
93
+ - **Constraints discovered**: "We have to..." or "This is limited by..."
94
+ - **Dependencies selected**: "Let's use [library] for [purpose]"
95
+ - **Approach changes**: "Initially tried X, but switched to Y because..."
96
+
97
+ If you identify any architectural decisions that weren't recorded, call \`record_decision\` now.
98
+
99
+ 3. **Get decisions**: Call \`get_session_decisions\` to retrieve all decisions (including any just recorded)
100
+
101
+ 4. **Present review** (if decisions were recorded):
102
+ \`\`\`
103
+ Ready to commit "[intent title]" (N files changed)
104
+
105
+ Decision points recorded this session:
106
+ 1. [fork] Chose approach A over B
107
+ └─ Rejected: "approach B" (violates zero-knowledge)
108
+ 2. [discovery] Found socket path length limit
109
+
110
+ Include these in the intent record? [Yes] [Edit] [Skip]
111
+ \`\`\`
112
+ 5. **Assign blocks**: Call \`assign_blocks_to_intent\` with all modified file ranges
113
+ 6. **Git operations**:
114
+ \`\`\`bash
115
+ git add <files>
116
+ git commit -m "<intent title>
117
+
118
+ <intent description if meaningful>
119
+
120
+ Key decisions:
121
+ - <decision 1 summary>
122
+ - <decision 2 summary>
123
+
124
+ Intent-ID: <intent-id>
125
+ Co-Authored-By: Claude <noreply@anthropic.com>"
126
+ \`\`\`
127
+ 7. **Complete intent**: Call \`complete_intent\` with the commit SHA and status='committed'
128
+ 8. **Report**: Tell the user the commit SHA and that the intent is complete
129
+
130
+ - If user had a new request that triggered the commit, proceed to create a new intent for it
131
+ - If user explicitly said "we're done", the workflow ends
132
+
133
+ | Scenario | Handling |
134
+ |----------|----------|
135
+ | User returns after long break with stale intent | Proactively mention: "You have an active intent '[title]' from [time ago]. Want to continue, commit, or abandon it?" |
136
+ | Pre-existing uncommitted changes when creating intent | Note in \`get_intent_changes\` warnings; let user decide what to include |
137
+ | Git commit fails | Report error, keep intent active, let user resolve |
138
+ | User makes changes outside Claude | \`get_intent_changes\` shows all uncommitted changes; user decides what to commit |
139
+ | Multiple small tasks in quick succession | Use judgment - if truly separate, prompt; if related, batch under one intent |
140
+
141
+ ### Retroactive Intent Assignment (Committing Pre-Existing Changes)
142
+
143
+ When uncommitted changes exist that weren't made under an active intent (e.g., changes from a previous session, manual edits, or mixed work), use this workflow to infer intents and commit them in logical groups:
144
+
145
+ #### Step 1: Analyze Changes
146
+ - Run \`git diff --stat\` and read individual diffs to understand what each change does
147
+
148
+ #### Step 2: Group by Intent
149
+ - Identify logical groupings — changes that serve the same purpose belong together
150
+ - Common grouping signals: same feature area, same service/module, related refactoring, shared motivation
151
+
152
+ #### Step 3: Match to Existing Intents
153
+ For each group:
154
+ 1. Call \`list_team_intents\` to get active intents for the repo
155
+ 2. Look for an existing intent whose title and description accurately describe the group's changes
156
+ 3. If a match exists, use it. If not, create a new intent or use \`log_work\` for trivial changes
157
+
158
+ #### Step 4: Commit Each Group
159
+ For each group:
160
+ 1. \`git add\` only the files belonging to this group
161
+ 2. \`git commit\` with a message reflecting the intent
162
+ 3. Call \`complete_intent\` with the commit SHA (if using an existing intent) or \`log_work\` (for trivial changes)
163
+
164
+ #### Guidelines
165
+ - **Prefer existing intents** when they accurately describe the changes — avoid creating duplicates
166
+ - **Use \`log_work\`** for small standalone changes (doc updates, loading spinners, one-line fixes)
167
+ - **Present the grouping plan** to the user before committing, so they can adjust
168
+ - **Don't force-fit** — if changes don't match any existing intent, create a new one
169
+ - **One intent per commit** — each commit should correspond to exactly one intent
170
+
171
+ ### MCP Tools Reference
172
+
173
+ #### Context Tools
174
+
175
+ | Tool | When to Use |
176
+ |------|-------------|
177
+ | \`get_relevant_context\` | **EACH USER REQUEST** - Returns context relevant to the specific prompt via semantic search (token-efficient for large projects) |
178
+
179
+ #### Intent Tools
180
+
181
+ | Tool | When to Use |
182
+ |------|-------------|
183
+ | \`check_active_intent\` | Before starting any code task |
184
+ | \`create_and_activate_intent\` | When no active intent and user requests code changes |
185
+ | \`get_intents_for_file\` | Before modifying files (check for team conflicts) |
186
+ | \`get_intents_for_lines\` | Before modifying specific line ranges |
187
+ | \`assign_blocks_to_intent\` | After writing code, before committing |
188
+ | \`get_intent_changes\` | Before prompting about commit (to show change summary) |
189
+ | \`complete_intent\` | After successful git commit, or to abandon |
190
+ | \`list_team_intents\` | To see what teammates are working on |
191
+
192
+ #### Decision Recording Tools
193
+
194
+ | Tool | When to Use |
195
+ |------|-------------|
196
+ | \`record_decision\` | When making architectural decisions (silently, during work). Omit intentId for repo-scoped decisions (discoveries, constraints) |
197
+ | \`get_session_decisions\` | Before commit, to review recorded decisions |
198
+ | \`get_project_decisions\` | To see all decisions across all intents for the project |
199
+ | \`edit_session_decision\` | To modify or delete a decision before commit |
200
+ | \`detect_intent_conflicts\` | Before commit, to check for conflicts with team decisions |`;
201
+ }
202
+ };
203
+ export const prompts = [intentFirstWorkflowPrompt];
204
+ //# sourceMappingURL=intent-first-workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent-first-workflow.js","sourceRoot":"","sources":["../../src/prompts/intent-first-workflow.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,4HAA4H;IACzI,SAAS,EAAE;QACT;YACE,IAAI,EAAE,kBAAkB;YACxB,WAAW,EAAE,uDAAuD;YACpE,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,SAAS,EAAE,CAAC,IAAoC,EAAE,EAAE;QAClD,MAAM,WAAW,GAAG,IAAI,EAAE,gBAAgB;YACxC,CAAC,CAAC,yBAAyB,IAAI,CAAC,gBAAgB,EAAE;YAClD,CAAC,CAAC,EAAE,CAAA;QAEN,OAAO,qCAAqC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4FAyLiC,CAAA;IAC1F,CAAC;CACF,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,yBAAyB,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ export interface ActiveIntentResource {
2
+ uri: string;
3
+ name: string;
4
+ description: string;
5
+ mimeType: string;
6
+ }
7
+ export declare const activeIntentResource: ActiveIntentResource;
8
+ export declare function readActiveIntentResource(repoOrigin?: string): Promise<string>;
9
+ export declare const resources: ActiveIntentResource[];
@@ -0,0 +1,52 @@
1
+ import { request, isConnected } from '../services/muninn-ipc.js';
2
+ export const activeIntentResource = {
3
+ uri: 'kawa://intent/active',
4
+ name: 'Active Intent',
5
+ description: 'The currently active intent for the connected repository',
6
+ mimeType: 'application/json'
7
+ };
8
+ export async function readActiveIntentResource(repoOrigin) {
9
+ if (!isConnected()) {
10
+ return JSON.stringify({
11
+ hasActiveIntent: false,
12
+ note: 'Muninn is not running. Start Muninn to use intent tracking.'
13
+ }, null, 2);
14
+ }
15
+ try {
16
+ const res = await request('intent', 'get-active', {
17
+ repoOrigin: repoOrigin || '',
18
+ });
19
+ // Muninn returns { success, activeIntentId, activeIntent }
20
+ const intent = res.activeIntent;
21
+ if (!intent) {
22
+ return JSON.stringify({
23
+ hasActiveIntent: false,
24
+ repoOrigin: repoOrigin || undefined,
25
+ note: repoOrigin
26
+ ? undefined
27
+ : 'No active intent. Call check_active_intent with a repoOrigin.'
28
+ }, null, 2);
29
+ }
30
+ return JSON.stringify({
31
+ hasActiveIntent: true,
32
+ repoOrigin: intent.repoOrigin || repoOrigin,
33
+ intent: {
34
+ id: intent.id || '',
35
+ title: intent.title || '',
36
+ description: intent.description || '',
37
+ templateType: intent.templateType || 'feature',
38
+ status: intent.status || 'active',
39
+ constraints: intent.constraints || [],
40
+ blockCount: 0
41
+ }
42
+ }, null, 2);
43
+ }
44
+ catch {
45
+ return JSON.stringify({
46
+ hasActiveIntent: false,
47
+ note: 'Failed to query Muninn for active intent.'
48
+ }, null, 2);
49
+ }
50
+ }
51
+ export const resources = [activeIntentResource];
52
+ //# sourceMappingURL=active-intent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"active-intent.js","sourceRoot":"","sources":["../../src/resources/active-intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAShE,MAAM,CAAC,MAAM,oBAAoB,GAAyB;IACxD,GAAG,EAAE,sBAAsB;IAC3B,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,0DAA0D;IACvE,QAAQ,EAAE,kBAAkB;CAC7B,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,UAAmB;IAChE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,eAAe,EAAE,KAAK;YACtB,IAAI,EAAE,6DAA6D;SACpE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACb,CAAC;IAED,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,QAAQ,EAAE,YAAY,EAAE;YAChD,UAAU,EAAE,UAAU,IAAI,EAAE;SAC7B,CAAC,CAAA;QAEF,2DAA2D;QAC3D,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,CAAA;QAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC,SAAS,CAAC;gBACpB,eAAe,EAAE,KAAK;gBACtB,UAAU,EAAE,UAAU,IAAI,SAAS;gBACnC,IAAI,EAAE,UAAU;oBACd,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,+DAA+D;aACpE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;QACb,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,eAAe,EAAE,IAAI;YACrB,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,UAAU;YAC3C,MAAM,EAAE;gBACN,EAAE,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE;gBACnB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE;gBACzB,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,EAAE;gBACrC,YAAY,EAAE,MAAM,CAAC,YAAY,IAAI,SAAS;gBAC9C,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,QAAQ;gBACjC,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,EAAE;gBACrC,UAAU,EAAE,CAAC;aACd;SACF,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACb,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,eAAe,EAAE,KAAK;YACtB,IAAI,EAAE,2CAA2C;SAClD,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACb,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,oBAAoB,CAAC,CAAA"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * In-memory active intent tracking.
3
+ *
4
+ * Simple Map keyed by normalized origin. Replaces Muninn's per-repo
5
+ * active intent tracking. State lives only for the MCP server lifetime.
6
+ */
7
+ import type { Intent } from './kawa-api.js';
8
+ export interface ActiveIntent {
9
+ id: string;
10
+ title: string;
11
+ description: string;
12
+ templateType: string;
13
+ status: string;
14
+ constraints: string[];
15
+ blocks: Array<{
16
+ filePath: string;
17
+ startLine: number;
18
+ endLine: number;
19
+ contentSnippet?: string;
20
+ }>;
21
+ branch?: string;
22
+ forkedFrom?: string;
23
+ createdAt?: string;
24
+ }
25
+ declare class ActiveIntentStore {
26
+ private store;
27
+ get(origin: string): ActiveIntent | null;
28
+ set(origin: string, intent: ActiveIntent): void;
29
+ clear(origin: string): void;
30
+ /** Return all active intents as [origin, intent] pairs */
31
+ getAll(): Array<[string, ActiveIntent]>;
32
+ /** Convert an API Intent to the ActiveIntent shape and store it */
33
+ setFromApiIntent(origin: string, apiIntent: Intent, cloudId: string): void;
34
+ }
35
+ export declare const activeIntentStore: ActiveIntentStore;
36
+ export {};
@@ -0,0 +1,45 @@
1
+ /**
2
+ * In-memory active intent tracking.
3
+ *
4
+ * Simple Map keyed by normalized origin. Replaces Muninn's per-repo
5
+ * active intent tracking. State lives only for the MCP server lifetime.
6
+ */
7
+ class ActiveIntentStore {
8
+ store = new Map();
9
+ get(origin) {
10
+ return this.store.get(origin) || null;
11
+ }
12
+ set(origin, intent) {
13
+ this.store.set(origin, intent);
14
+ }
15
+ clear(origin) {
16
+ this.store.delete(origin);
17
+ }
18
+ /** Return all active intents as [origin, intent] pairs */
19
+ getAll() {
20
+ return [...this.store.entries()];
21
+ }
22
+ /** Convert an API Intent to the ActiveIntent shape and store it */
23
+ setFromApiIntent(origin, apiIntent, cloudId) {
24
+ this.store.set(origin, {
25
+ id: cloudId || apiIntent._id || apiIntent.id || '',
26
+ title: apiIntent.title || '',
27
+ description: apiIntent.description || '',
28
+ templateType: apiIntent.templateType || 'feature',
29
+ status: apiIntent.status || 'active',
30
+ constraints: apiIntent.constraints || [],
31
+ blocks: (apiIntent.blocks || []).map(b => ({
32
+ filePath: b.filePath,
33
+ startLine: b.startLine,
34
+ endLine: b.endLine,
35
+ contentSnippet: b.contentSnippet,
36
+ })),
37
+ branch: apiIntent.branch,
38
+ forkedFrom: apiIntent.forkedFrom,
39
+ createdAt: apiIntent.createdAt,
40
+ });
41
+ }
42
+ }
43
+ // Singleton
44
+ export const activeIntentStore = new ActiveIntentStore();
45
+ //# sourceMappingURL=active-intent-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"active-intent-store.js","sourceRoot":"","sources":["../../src/services/active-intent-store.ts"],"names":[],"mappings":"AA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,CAAC,CAAC;YACH,MAAM,EAAE,SAAS,CAAC,MAAM;YACxB,UAAU,EAAE,SAAS,CAAC,UAAU;YAChC,SAAS,EAAE,SAAS,CAAC,SAAS;SAC/B,CAAC,CAAA;IACJ,CAAC;CACF;AAED,YAAY;AACZ,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAA"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * HTTP client for the Kawa API.
3
+ *
4
+ * Replaces Muninn IPC — all data operations go directly to the REST API.
5
+ * Uses Node 18+ built-in fetch (no new dependencies).
6
+ *
7
+ * Config:
8
+ * KAWA_API_URL — defaults to https://api.codeawareness.com (set to http://localhost:3008 for local dev)
9
+ * KAWA_AUTH_TOKEN — JWT bearer token (optional - auto-loaded from storage if not set)
10
+ *
11
+ * Auth token resolution order:
12
+ * 1. KAWA_AUTH_TOKEN environment variable
13
+ * 2. ~/.kawa-code/.storage.caw (decrypted using username+hostname)
14
+ */
15
+ export interface Intent {
16
+ _id?: string;
17
+ id?: string;
18
+ title: string;
19
+ description: string;
20
+ templateType: string;
21
+ status?: string;
22
+ scope?: {
23
+ type: string;
24
+ paths: string[];
25
+ };
26
+ blocks?: IntentBlock[];
27
+ constraints?: string[];
28
+ branch?: string;
29
+ forkedFrom?: string;
30
+ encrypted?: boolean;
31
+ authorId?: string;
32
+ authorName?: string;
33
+ createdAt?: string;
34
+ updatedAt?: string;
35
+ }
36
+ export interface IntentBlock {
37
+ filePath: string;
38
+ startLine: number;
39
+ endLine: number;
40
+ contentHash?: string;
41
+ contentSnippet?: string;
42
+ codeContent?: string;
43
+ }
44
+ export interface IntentTranslation {
45
+ intentId: string;
46
+ lang: string;
47
+ title: string;
48
+ description: string;
49
+ }
50
+ export interface Decision {
51
+ decisionId: string;
52
+ intentId?: string;
53
+ authorId?: string;
54
+ timestamp?: string;
55
+ decisionType: string;
56
+ summary: string;
57
+ context?: string;
58
+ alternatives?: string[];
59
+ rationale: string;
60
+ consequences?: string;
61
+ relatedFiles?: string[];
62
+ supersedes?: string[];
63
+ constraintsChecked?: string[];
64
+ constraintViolations?: Array<{
65
+ alternative: string;
66
+ constraint: string;
67
+ reason: string;
68
+ }>;
69
+ createdAt?: string;
70
+ updatedAt?: string;
71
+ }
72
+ export interface CreateIntentParams {
73
+ origin: string;
74
+ lang?: string;
75
+ title: string;
76
+ description: string;
77
+ templateType?: string;
78
+ constraints?: string[];
79
+ scope?: {
80
+ type: string;
81
+ paths: string[];
82
+ };
83
+ blocks?: IntentBlock[];
84
+ branch?: string;
85
+ forkedFrom?: string;
86
+ }
87
+ export declare class KawaApi {
88
+ private baseUrl;
89
+ private authToken;
90
+ constructor(baseUrl?: string, authToken?: string);
91
+ /**
92
+ * Refresh the auth token from storage
93
+ *
94
+ * Call this periodically to pick up token refreshes from Muninn.
95
+ * Returns true if a new token was loaded.
96
+ */
97
+ refreshTokenFromStorage(): boolean;
98
+ /**
99
+ * Check if the client has an auth token
100
+ */
101
+ hasAuthToken(): boolean;
102
+ listIntents(origin: string, lang?: string, since?: string): Promise<Intent[]>;
103
+ createIntent(params: CreateIntentParams): Promise<{
104
+ intent: Intent;
105
+ cloudId: string;
106
+ }>;
107
+ getIntent(intentId: string, origin: string, lang?: string): Promise<Intent>;
108
+ updateIntent(intentId: string, origin: string, updates: Partial<Intent>): Promise<Intent>;
109
+ deleteIntent(intentId: string, origin: string): Promise<void>;
110
+ getIntentsByFile(origin: string, filePath: string): Promise<Intent[]>;
111
+ getIntentsByLines(origin: string, filePath: string, startLine: number, endLine: number): Promise<Intent[]>;
112
+ batchSaveIntents(origin: string, lang: string, intents: CreateIntentParams[]): Promise<any>;
113
+ saveIntentTranslation(intentId: string, origin: string, lang: string, title: string, description: string): Promise<any>;
114
+ getIntentTranslation(intentId: string, origin: string, lang: string): Promise<IntentTranslation | null>;
115
+ getTeamDecisions(origin: string, since?: string): Promise<Decision[]>;
116
+ getIntentDecisions(intentId: string, origin: string): Promise<Decision[]>;
117
+ syncDecisions(origin: string, intentId: string, decisions: Decision[]): Promise<any>;
118
+ deleteDecision(decisionId: string, origin: string): Promise<void>;
119
+ searchRelevantContext(origin: string, query: string, activeFiles?: string[], options?: {
120
+ maxIntents?: number;
121
+ maxDecisions?: number;
122
+ minScore?: number;
123
+ }): Promise<any>;
124
+ private get;
125
+ private post;
126
+ private patch;
127
+ private del;
128
+ getBaseUrl(): string;
129
+ private request;
130
+ }
131
+ export declare function getApi(): KawaApi;