@kawacode/mcp 6.9.4 → 7.0.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.
- package/CLAUDE.md.example +23 -0
- package/README.md +88 -1
- package/build/index.js +20 -18
- package/build/index.js.map +1 -1
- package/build/prompts/intent-first-workflow.js +6 -8
- package/build/prompts/intent-first-workflow.js.map +1 -1
- package/build/services/muninn-ipc.js +6 -2
- package/build/services/muninn-ipc.js.map +1 -1
- package/build/tools/_mangled-args.d.ts +63 -0
- package/build/tools/_mangled-args.js +116 -0
- package/build/tools/_mangled-args.js.map +1 -0
- package/build/tools/_mangled-args.test.js +110 -0
- package/build/tools/_mangled-args.test.js.map +1 -0
- package/build/tools/activate-intent.d.ts +8 -52
- package/build/tools/activate-intent.js +26 -7
- package/build/tools/activate-intent.js.map +1 -1
- package/build/tools/arbiter-apply.d.ts +0 -52
- package/build/tools/arbiter-apply.js +0 -3
- package/build/tools/arbiter-apply.js.map +1 -1
- package/build/tools/arbiter-resolve.d.ts +0 -52
- package/build/tools/arbiter-resolve.js +0 -3
- package/build/tools/arbiter-resolve.js.map +1 -1
- package/build/tools/check-active-intent.d.ts +0 -52
- package/build/tools/check-active-intent.js +2 -24
- package/build/tools/check-active-intent.js.map +1 -1
- package/build/tools/complete-intent.d.ts +4 -56
- package/build/tools/complete-intent.js +15 -44
- package/build/tools/complete-intent.js.map +1 -1
- package/build/tools/create-intent.d.ts +0 -52
- package/build/tools/create-intent.js +0 -4
- package/build/tools/create-intent.js.map +1 -1
- package/build/tools/detect-intent-conflicts.d.ts +0 -52
- package/build/tools/detect-intent-conflicts.js +0 -3
- package/build/tools/detect-intent-conflicts.js.map +1 -1
- package/build/tools/edit-session-decision.d.ts +0 -52
- package/build/tools/edit-session-decision.js +0 -3
- package/build/tools/edit-session-decision.js.map +1 -1
- package/build/tools/get-decision-detail.d.ts +19 -55
- package/build/tools/get-decision-detail.js +12 -7
- package/build/tools/get-decision-detail.js.map +1 -1
- package/build/tools/get-intents-for-file.d.ts +35 -53
- package/build/tools/get-intents-for-file.js +61 -26
- package/build/tools/get-intents-for-file.js.map +1 -1
- package/build/tools/get-project-decisions.d.ts +0 -52
- package/build/tools/get-project-decisions.js +0 -3
- package/build/tools/get-project-decisions.js.map +1 -1
- package/build/tools/get-relevant-context.d.ts +0 -52
- package/build/tools/get-relevant-context.js +0 -3
- package/build/tools/get-relevant-context.js.map +1 -1
- package/build/tools/get-resolution-context.d.ts +0 -52
- package/build/tools/get-resolution-context.js +0 -4
- package/build/tools/get-resolution-context.js.map +1 -1
- package/build/tools/get-session-decisions.d.ts +10 -53
- package/build/tools/get-session-decisions.js +2 -4
- package/build/tools/get-session-decisions.js.map +1 -1
- package/build/tools/index.d.ts +11 -675
- package/build/tools/index.js +2 -11
- package/build/tools/index.js.map +1 -1
- package/build/tools/infer-history.js +5 -19
- package/build/tools/infer-history.js.map +1 -1
- package/build/tools/list-team-intents.d.ts +4 -56
- package/build/tools/list-team-intents.js +0 -3
- package/build/tools/list-team-intents.js.map +1 -1
- package/build/tools/log-work.d.ts +0 -52
- package/build/tools/log-work.js +0 -3
- package/build/tools/log-work.js.map +1 -1
- package/build/tools/pre-edit-acknowledge.d.ts +0 -52
- package/build/tools/pre-edit-acknowledge.js +0 -2
- package/build/tools/pre-edit-acknowledge.js.map +1 -1
- package/build/tools/pre-edit-decision-check.d.ts +0 -52
- package/build/tools/pre-edit-decision-check.js +0 -4
- package/build/tools/pre-edit-decision-check.js.map +1 -1
- package/build/tools/record-decision.d.ts +2 -52
- package/build/tools/record-decision.js +6 -5
- package/build/tools/record-decision.js.map +1 -1
- package/build/tools/resume-intent.d.ts +9 -60
- package/build/tools/resume-intent.js +40 -23
- package/build/tools/resume-intent.js.map +1 -1
- package/build/tools/update-intent.d.ts +0 -52
- package/build/tools/update-intent.js +1 -5
- package/build/tools/update-intent.js.map +1 -1
- package/build/types/refs.d.ts +73 -0
- package/build/types/refs.js +73 -0
- package/build/types/refs.js.map +1 -0
- package/package.json +1 -1
- package/build/tools/_fork-fields.d.ts +0 -84
- package/build/tools/_fork-fields.js +0 -65
- package/build/tools/_fork-fields.js.map +0 -1
- package/build/tools/_salvage-mangled-args.d.ts +0 -38
- package/build/tools/_salvage-mangled-args.js +0 -87
- package/build/tools/_salvage-mangled-args.js.map +0 -1
- package/build/tools/_salvage-mangled-args.test.js +0 -73
- package/build/tools/_salvage-mangled-args.test.js.map +0 -1
- package/build/tools/evolve-decisions.d.ts +0 -96
- package/build/tools/evolve-decisions.js +0 -42
- package/build/tools/evolve-decisions.js.map +0 -1
- package/build/tools/get-intent-changes.d.ts +0 -101
- package/build/tools/get-intent-changes.js +0 -61
- package/build/tools/get-intent-changes.js.map +0 -1
- package/build/tools/get-intents-for-lines.d.ts +0 -123
- package/build/tools/get-intents-for-lines.js +0 -67
- package/build/tools/get-intents-for-lines.js.map +0 -1
- package/build/tools/update-features.d.ts +0 -31
- package/build/tools/update-features.js +0 -51
- package/build/tools/update-features.js.map +0 -1
- /package/build/tools/{_salvage-mangled-args.test.d.ts → _mangled-args.test.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pre-edit-decision-check.js","sourceRoot":"","sources":["../../src/tools/pre-edit-decision-check.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;
|
|
1
|
+
{"version":3,"file":"pre-edit-decision-check.js","sourceRoot":"","sources":["../../src/tools/pre-edit-decision-check.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;;;;;;;;GAQG;AAEH,MAAM,CAAC,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,GAAG;IACtC,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE;;;;;;;;;;;;;;;uJAewI;IACrJ,WAAW,EAAE,0BAA0B;IACvC,OAAO,EAAE,oBAAoB;CAC9B,CAAA"}
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const recordDecisionSchema: 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>;
|
|
17
3
|
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
18
4
|
repoPath: z.ZodString;
|
|
19
5
|
intentId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -75,12 +61,6 @@ export declare const recordDecisionSchema: z.ZodObject<{
|
|
|
75
61
|
rationale: string;
|
|
76
62
|
source: "user" | "agent" | "extractor" | "infer_history";
|
|
77
63
|
repoOrigin?: string | undefined;
|
|
78
|
-
forkAuthor?: {
|
|
79
|
-
platform: "github" | "gitlab";
|
|
80
|
-
user: string;
|
|
81
|
-
forkOrigin: string;
|
|
82
|
-
} | undefined;
|
|
83
|
-
workspaceId?: string | undefined;
|
|
84
64
|
context?: string | undefined;
|
|
85
65
|
alternatives?: string[] | undefined;
|
|
86
66
|
consequences?: string | undefined;
|
|
@@ -111,12 +91,6 @@ export declare const recordDecisionSchema: z.ZodObject<{
|
|
|
111
91
|
summary: string;
|
|
112
92
|
rationale: string;
|
|
113
93
|
repoOrigin?: string | undefined;
|
|
114
|
-
forkAuthor?: {
|
|
115
|
-
platform: "github" | "gitlab";
|
|
116
|
-
user: string;
|
|
117
|
-
forkOrigin: string;
|
|
118
|
-
} | undefined;
|
|
119
|
-
workspaceId?: string | undefined;
|
|
120
94
|
context?: string | undefined;
|
|
121
95
|
intentId?: string | undefined;
|
|
122
96
|
alternatives?: string[] | undefined;
|
|
@@ -148,6 +122,8 @@ export type RecordDecisionInput = z.infer<typeof recordDecisionSchema>;
|
|
|
148
122
|
export interface RecordDecisionResponse {
|
|
149
123
|
recorded: boolean;
|
|
150
124
|
decisionId: string;
|
|
125
|
+
/** The summary as stored, so the caller can name the decision it recorded. */
|
|
126
|
+
summary?: string;
|
|
151
127
|
error?: string;
|
|
152
128
|
}
|
|
153
129
|
export declare function recordDecision(input: RecordDecisionInput): Promise<RecordDecisionResponse>;
|
|
@@ -155,20 +131,6 @@ export declare const recordDecisionTool: {
|
|
|
155
131
|
name: string;
|
|
156
132
|
description: string;
|
|
157
133
|
inputSchema: z.ZodObject<{
|
|
158
|
-
forkAuthor: z.ZodOptional<z.ZodObject<{
|
|
159
|
-
platform: z.ZodEnum<["github", "gitlab"]>;
|
|
160
|
-
user: z.ZodString;
|
|
161
|
-
forkOrigin: z.ZodString;
|
|
162
|
-
}, "strip", z.ZodTypeAny, {
|
|
163
|
-
platform: "github" | "gitlab";
|
|
164
|
-
user: string;
|
|
165
|
-
forkOrigin: string;
|
|
166
|
-
}, {
|
|
167
|
-
platform: "github" | "gitlab";
|
|
168
|
-
user: string;
|
|
169
|
-
forkOrigin: string;
|
|
170
|
-
}>>;
|
|
171
|
-
workspaceId: z.ZodOptional<z.ZodString>;
|
|
172
134
|
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
173
135
|
repoPath: z.ZodString;
|
|
174
136
|
intentId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -230,12 +192,6 @@ export declare const recordDecisionTool: {
|
|
|
230
192
|
rationale: string;
|
|
231
193
|
source: "user" | "agent" | "extractor" | "infer_history";
|
|
232
194
|
repoOrigin?: string | undefined;
|
|
233
|
-
forkAuthor?: {
|
|
234
|
-
platform: "github" | "gitlab";
|
|
235
|
-
user: string;
|
|
236
|
-
forkOrigin: string;
|
|
237
|
-
} | undefined;
|
|
238
|
-
workspaceId?: string | undefined;
|
|
239
195
|
context?: string | undefined;
|
|
240
196
|
alternatives?: string[] | undefined;
|
|
241
197
|
consequences?: string | undefined;
|
|
@@ -266,12 +222,6 @@ export declare const recordDecisionTool: {
|
|
|
266
222
|
summary: string;
|
|
267
223
|
rationale: string;
|
|
268
224
|
repoOrigin?: string | undefined;
|
|
269
|
-
forkAuthor?: {
|
|
270
|
-
platform: "github" | "gitlab";
|
|
271
|
-
user: string;
|
|
272
|
-
forkOrigin: string;
|
|
273
|
-
} | undefined;
|
|
274
|
-
workspaceId?: string | undefined;
|
|
275
225
|
context?: string | undefined;
|
|
276
226
|
intentId?: string | undefined;
|
|
277
227
|
alternatives?: string[] | undefined;
|
|
@@ -1,7 +1,6 @@
|
|
|
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';
|
|
5
4
|
const constraintViolationSchema = z.object({
|
|
6
5
|
alternative: z.string().describe('The alternative that was rejected'),
|
|
7
6
|
constraint: z.string().describe('The constraint ID that was violated (e.g., "zero-knowledge")'),
|
|
@@ -20,7 +19,7 @@ export const recordDecisionSchema = z.object({
|
|
|
20
19
|
consequences: z.string().optional().describe('Downstream implications of this decision'),
|
|
21
20
|
symptom: z.string().optional().describe('Observable symptom that indicates this decision is relevant (e.g., error messages, runtime panics, unexpected behavior). Useful for discovery and constraint decisions.'),
|
|
22
21
|
relatedFiles: z.array(z.string()).optional().describe('File paths affected by this decision'),
|
|
23
|
-
supersedes: z.array(z.string()).optional().describe('Decision IDs that this one replaces. When a later decision supersedes an earlier one, pass the earlier decisionId(s) here so the evolve pipeline can track the lineage.'),
|
|
22
|
+
supersedes: z.array(z.string()).optional().describe('Decision IDs that this one replaces. When a later decision supersedes an earlier one, pass the earlier decisionId(s) here so the evolve pipeline can track the lineage. Pass FULL decision IDs (36-char UUIDs) — a truncated 8-char prefix is rejected, because resolving it back would mean guessing which decision you meant. If you only have a prefix (e.g. read from a doc), look it up with get_decision_detail first and use the id it returns.'),
|
|
24
23
|
constraintsChecked: z.array(z.string()).optional().describe('Which architectural constraints were verified before this decision'),
|
|
25
24
|
constraintViolations: z.array(constraintViolationSchema).optional()
|
|
26
25
|
.describe('Alternatives that were rejected due to constraint violations'),
|
|
@@ -43,7 +42,6 @@ export const recordDecisionSchema = z.object({
|
|
|
43
42
|
baselineSha: z.string().optional().describe('The cSHA baseline the ranges are expressed in.'),
|
|
44
43
|
}).optional()
|
|
45
44
|
.describe('Layer C audit — set ONLY when this decision records how you resolved a completion-time code collision (i.e. after complete_intent returned resolution_required). Links the decision to the live peer you yielded to or overrode.'),
|
|
46
|
-
...forkFieldsExtensions,
|
|
47
45
|
});
|
|
48
46
|
export async function recordDecision(input) {
|
|
49
47
|
const origin = resolveOrigin(input.repoOrigin, input.repoPath);
|
|
@@ -67,7 +65,6 @@ export async function recordDecision(input) {
|
|
|
67
65
|
appliesWhen: input.appliesWhen,
|
|
68
66
|
surface: input.surface,
|
|
69
67
|
resolvedCollision: input.resolvedCollision,
|
|
70
|
-
...extractForkFields(input),
|
|
71
68
|
});
|
|
72
69
|
// A persisted decision ALWAYS has an id. Anything else — an explicit
|
|
73
70
|
// failure, or a response that merely omits `decisionId` — means nothing was
|
|
@@ -77,6 +74,7 @@ export async function recordDecision(input) {
|
|
|
77
74
|
// `{recorded: true, decisionId: ''}` and the caller silently lost the
|
|
78
75
|
// decision. Capture failures must be loud, never inferred from absence.
|
|
79
76
|
const decisionId = typeof res.decisionId === 'string' ? res.decisionId : '';
|
|
77
|
+
const summary = typeof res.summary === 'string' ? res.summary : input.summary;
|
|
80
78
|
if (res.success === false || !decisionId) {
|
|
81
79
|
return {
|
|
82
80
|
recorded: false,
|
|
@@ -85,7 +83,10 @@ export async function recordDecision(input) {
|
|
|
85
83
|
'The decision was NOT saved (Kawa Code returned no decision id). Nothing has been persisted — re-send this decision, and if it fails again report the failure rather than assuming it was captured.',
|
|
86
84
|
};
|
|
87
85
|
}
|
|
88
|
-
|
|
86
|
+
// Echo the summary back beside the id so the caller can name what it just
|
|
87
|
+
// recorded — "«summary» (id)" — instead of printing a bare id. Costs nothing:
|
|
88
|
+
// the value was supplied by this same call.
|
|
89
|
+
return { recorded: true, decisionId, summary };
|
|
89
90
|
}
|
|
90
91
|
export const recordDecisionTool = {
|
|
91
92
|
name: 'record_decision',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-decision.js","sourceRoot":"","sources":["../../src/tools/record-decision.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;
|
|
1
|
+
{"version":3,"file":"record-decision.js","sourceRoot":"","sources":["../../src/tools/record-decision.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,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IACrE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8DAA8D,CAAC;IAC/F,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6CAA6C,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,cAAc;CACxB,CAAA"}
|
|
@@ -3,31 +3,16 @@ import { type ProjectDecision } from './get-project-decisions.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* One-call intent hydration for cross-developer handoff.
|
|
5
5
|
*
|
|
6
|
-
* Composes three EXISTING
|
|
7
|
-
* so this works against any daemon version (backwards compatible):
|
|
8
|
-
* 1. activate_intent
|
|
9
|
-
* 2.
|
|
10
|
-
* 3. get_project_decisions → its
|
|
6
|
+
* Composes three EXISTING Muninn IPC actions — nothing new is added to the
|
|
7
|
+
* daemon, so this works against any daemon version (backwards compatible):
|
|
8
|
+
* 1. intent:set-active (via activate_intent) → adopt the intent as current
|
|
9
|
+
* 2. intent:get → the intent's title/description/status by id
|
|
10
|
+
* 3. decision:project-list (via get_project_decisions) → its decisions, lean
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* list, but that's an optimization, not a requirement.
|
|
12
|
+
* A future Muninn `decision:by-intent` filter would let step 3 avoid pulling
|
|
13
|
+
* the full project list, but that's an optimization, not a requirement.
|
|
15
14
|
*/
|
|
16
15
|
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
16
|
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
32
17
|
repoPath: z.ZodString;
|
|
33
18
|
intentId: z.ZodString;
|
|
@@ -35,27 +20,17 @@ export declare const resumeIntentSchema: z.ZodObject<{
|
|
|
35
20
|
repoPath: string;
|
|
36
21
|
intentId: string;
|
|
37
22
|
repoOrigin?: string | undefined;
|
|
38
|
-
forkAuthor?: {
|
|
39
|
-
platform: "github" | "gitlab";
|
|
40
|
-
user: string;
|
|
41
|
-
forkOrigin: string;
|
|
42
|
-
} | undefined;
|
|
43
|
-
workspaceId?: string | undefined;
|
|
44
23
|
}, {
|
|
45
24
|
repoPath: string;
|
|
46
25
|
intentId: string;
|
|
47
26
|
repoOrigin?: string | undefined;
|
|
48
|
-
forkAuthor?: {
|
|
49
|
-
platform: "github" | "gitlab";
|
|
50
|
-
user: string;
|
|
51
|
-
forkOrigin: string;
|
|
52
|
-
} | undefined;
|
|
53
|
-
workspaceId?: string | undefined;
|
|
54
27
|
}>;
|
|
55
28
|
export type ResumeIntentInput = z.infer<typeof resumeIntentSchema>;
|
|
56
29
|
export interface ResumeIntentResponse {
|
|
57
30
|
resumed: boolean;
|
|
58
31
|
intentId: string;
|
|
32
|
+
/** True when the resume was refused because the intent is frozen (stale beyond the freeze window). */
|
|
33
|
+
frozen?: boolean;
|
|
59
34
|
intent?: {
|
|
60
35
|
title: string;
|
|
61
36
|
description: string;
|
|
@@ -70,20 +45,6 @@ export declare const resumeIntentTool: {
|
|
|
70
45
|
name: string;
|
|
71
46
|
description: string;
|
|
72
47
|
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
48
|
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
88
49
|
repoPath: z.ZodString;
|
|
89
50
|
intentId: z.ZodString;
|
|
@@ -91,22 +52,10 @@ export declare const resumeIntentTool: {
|
|
|
91
52
|
repoPath: string;
|
|
92
53
|
intentId: string;
|
|
93
54
|
repoOrigin?: string | undefined;
|
|
94
|
-
forkAuthor?: {
|
|
95
|
-
platform: "github" | "gitlab";
|
|
96
|
-
user: string;
|
|
97
|
-
forkOrigin: string;
|
|
98
|
-
} | undefined;
|
|
99
|
-
workspaceId?: string | undefined;
|
|
100
55
|
}, {
|
|
101
56
|
repoPath: string;
|
|
102
57
|
intentId: string;
|
|
103
58
|
repoOrigin?: string | undefined;
|
|
104
|
-
forkAuthor?: {
|
|
105
|
-
platform: "github" | "gitlab";
|
|
106
|
-
user: string;
|
|
107
|
-
forkOrigin: string;
|
|
108
|
-
} | undefined;
|
|
109
|
-
workspaceId?: string | undefined;
|
|
110
59
|
}>;
|
|
111
60
|
handler: typeof resumeIntent;
|
|
112
61
|
};
|
|
@@ -1,62 +1,75 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { request } from '../services/muninn-ipc.js';
|
|
2
3
|
import { resolveOrigin } from './resolve-origin.js';
|
|
3
|
-
import { forkFieldsExtensions, extractForkFields } from './_fork-fields.js';
|
|
4
4
|
import { activateIntent } from './activate-intent.js';
|
|
5
|
-
import { getIntentChanges } from './get-intent-changes.js';
|
|
6
5
|
import { getProjectDecisions } from './get-project-decisions.js';
|
|
7
6
|
/**
|
|
8
7
|
* One-call intent hydration for cross-developer handoff.
|
|
9
8
|
*
|
|
10
|
-
* Composes three EXISTING
|
|
11
|
-
* so this works against any daemon version (backwards compatible):
|
|
12
|
-
* 1. activate_intent
|
|
13
|
-
* 2.
|
|
14
|
-
* 3. get_project_decisions → its
|
|
9
|
+
* Composes three EXISTING Muninn IPC actions — nothing new is added to the
|
|
10
|
+
* daemon, so this works against any daemon version (backwards compatible):
|
|
11
|
+
* 1. intent:set-active (via activate_intent) → adopt the intent as current
|
|
12
|
+
* 2. intent:get → the intent's title/description/status by id
|
|
13
|
+
* 3. decision:project-list (via get_project_decisions) → its decisions, lean
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* list, but that's an optimization, not a requirement.
|
|
15
|
+
* A future Muninn `decision:by-intent` filter would let step 3 avoid pulling
|
|
16
|
+
* the full project list, but that's an optimization, not a requirement.
|
|
19
17
|
*/
|
|
20
18
|
export const resumeIntentSchema = z.object({
|
|
21
19
|
repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
|
|
22
20
|
repoPath: z.string().describe('Local path to the repository root'),
|
|
23
21
|
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
22
|
});
|
|
26
23
|
export async function resumeIntent(input) {
|
|
27
24
|
// Resolve the origin once and pass it down, so the three sub-calls don't each
|
|
28
25
|
// re-shell out to git.
|
|
29
26
|
const origin = resolveOrigin(input.repoOrigin, input.repoPath);
|
|
30
|
-
const base = { repoOrigin: origin, repoPath: input.repoPath
|
|
27
|
+
const base = { repoOrigin: origin, repoPath: input.repoPath };
|
|
31
28
|
// 1. Adopt the intent as THIS session's current focus (multi-active — never
|
|
32
29
|
// displaces another session's current). Fail loud if it can't be activated.
|
|
33
30
|
const activated = await activateIntent({ ...base, intentId: input.intentId });
|
|
34
31
|
if (!activated.success || !activated.intentId) {
|
|
32
|
+
// Frozen intents (stale beyond the freeze window) can no longer be resumed —
|
|
33
|
+
// surface that distinctly so the agent starts a new intent instead of retrying.
|
|
34
|
+
if (activated.frozen) {
|
|
35
|
+
return {
|
|
36
|
+
resumed: false,
|
|
37
|
+
intentId: input.intentId,
|
|
38
|
+
frozen: true,
|
|
39
|
+
decisions: [],
|
|
40
|
+
count: 0,
|
|
41
|
+
message: `Intent ${input.intentId} is frozen (inactive too long) and can no longer be resumed. Start a new intent for the follow-up work — or take it over if you need ownership.`,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
35
44
|
return {
|
|
36
45
|
resumed: false,
|
|
37
46
|
intentId: input.intentId,
|
|
38
47
|
decisions: [],
|
|
39
48
|
count: 0,
|
|
40
|
-
message:
|
|
49
|
+
message: activated.error
|
|
50
|
+
? `Could not resume intent ${input.intentId}: ${activated.error}`
|
|
51
|
+
: `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
52
|
};
|
|
42
53
|
}
|
|
43
|
-
// 2 + 3. Hydrate the
|
|
44
|
-
const [
|
|
45
|
-
|
|
54
|
+
// 2 + 3. Hydrate the intent's metadata (by id) and its decisions in parallel.
|
|
55
|
+
const [intentRes, project] = await Promise.all([
|
|
56
|
+
request('intent', 'get', { repoOrigin: origin, id: input.intentId }),
|
|
46
57
|
getProjectDecisions(base),
|
|
47
58
|
]);
|
|
59
|
+
const raw = intentRes?.intent;
|
|
60
|
+
const resolvedId = raw?.id || raw?._id || '';
|
|
48
61
|
// Match decisions on every id form we know for this intent — the handoff
|
|
49
62
|
// prompt may carry the cloud id while stored decisions carry a local id (or
|
|
50
63
|
// vice versa), so union the passed id, the activated id, and the resolved one.
|
|
51
64
|
const targetIds = new Set([input.intentId, activated.intentId]);
|
|
52
|
-
if (
|
|
53
|
-
targetIds.add(
|
|
65
|
+
if (resolvedId)
|
|
66
|
+
targetIds.add(resolvedId);
|
|
54
67
|
const decisions = project.decisions.filter(d => targetIds.has(d.intentId) || d.intentIds.some(id => targetIds.has(id)));
|
|
55
|
-
const intent =
|
|
68
|
+
const intent = raw
|
|
56
69
|
? {
|
|
57
|
-
title:
|
|
58
|
-
description:
|
|
59
|
-
status:
|
|
70
|
+
title: raw.title || '',
|
|
71
|
+
description: raw.description || '',
|
|
72
|
+
status: raw.status || 'active',
|
|
60
73
|
}
|
|
61
74
|
: undefined;
|
|
62
75
|
return {
|
|
@@ -67,7 +80,11 @@ export async function resumeIntent(input) {
|
|
|
67
80
|
count: decisions.length,
|
|
68
81
|
message: intent
|
|
69
82
|
? `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
|
-
|
|
83
|
+
// No title to lead with — `intent:get` returned nothing. Print the id in
|
|
84
|
+
// FULL: an intent id is a Mongo ObjectId whose leading bytes are a
|
|
85
|
+
// creation timestamp, so a truncated one does not resolve to a single
|
|
86
|
+
// intent and would leave the reader with nothing they can look up.
|
|
87
|
+
: `Resumed intent ${input.intentId} — ${decisions.length} recorded decision(s) loaded.`,
|
|
71
88
|
};
|
|
72
89
|
}
|
|
73
90
|
export const resumeIntentTool = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resume-intent.js","sourceRoot":"","sources":["../../src/tools/resume-intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"resume-intent.js","sourceRoot":"","sources":["../../src/tools/resume-intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAwB,MAAM,4BAA4B,CAAA;AAEtF;;;;;;;;;;;GAWG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;IACzH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CA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AM;QACvB,OAAO,EAAE,MAAM;YACb,CAAC,CAAC,YAAY,MAAM,CAAC,KAAK,MAAM,MAAM,CAAC,MAAM,OAAO,SAAS,CAAC,MAAM,mGAAmG;YACvK,yEAAyE;YACzE,mEAAmE;YACnE,sEAAsE;YACtE,mEAAmE;YACnE,CAAC,CAAC,kBAAkB,KAAK,CAAC,QAAQ,MAAM,SAAS,CAAC,MAAM,+BAA+B;KAC1F,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE;;;;;;;;kIAQmH;IAChI,WAAW,EAAE,kBAAkB;IAC/B,OAAO,EAAE,YAAY;CACtB,CAAA"}
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const updateIntentSchema: 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>;
|
|
17
3
|
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
18
4
|
repoPath: z.ZodString;
|
|
19
5
|
intentId: z.ZodOptional<z.ZodString>;
|
|
@@ -33,12 +19,6 @@ export declare const updateIntentSchema: z.ZodObject<{
|
|
|
33
19
|
}, "strip", z.ZodTypeAny, {
|
|
34
20
|
repoPath: string;
|
|
35
21
|
repoOrigin?: string | undefined;
|
|
36
|
-
forkAuthor?: {
|
|
37
|
-
platform: "github" | "gitlab";
|
|
38
|
-
user: string;
|
|
39
|
-
forkOrigin: string;
|
|
40
|
-
} | undefined;
|
|
41
|
-
workspaceId?: string | undefined;
|
|
42
22
|
title?: string | undefined;
|
|
43
23
|
description?: string | undefined;
|
|
44
24
|
constraints?: string[] | undefined;
|
|
@@ -50,12 +30,6 @@ export declare const updateIntentSchema: z.ZodObject<{
|
|
|
50
30
|
}, {
|
|
51
31
|
repoPath: string;
|
|
52
32
|
repoOrigin?: string | undefined;
|
|
53
|
-
forkAuthor?: {
|
|
54
|
-
platform: "github" | "gitlab";
|
|
55
|
-
user: string;
|
|
56
|
-
forkOrigin: string;
|
|
57
|
-
} | undefined;
|
|
58
|
-
workspaceId?: string | undefined;
|
|
59
33
|
title?: string | undefined;
|
|
60
34
|
description?: string | undefined;
|
|
61
35
|
constraints?: string[] | undefined;
|
|
@@ -78,20 +52,6 @@ export declare const updateIntentTool: {
|
|
|
78
52
|
name: string;
|
|
79
53
|
description: string;
|
|
80
54
|
inputSchema: z.ZodObject<{
|
|
81
|
-
forkAuthor: z.ZodOptional<z.ZodObject<{
|
|
82
|
-
platform: z.ZodEnum<["github", "gitlab"]>;
|
|
83
|
-
user: z.ZodString;
|
|
84
|
-
forkOrigin: z.ZodString;
|
|
85
|
-
}, "strip", z.ZodTypeAny, {
|
|
86
|
-
platform: "github" | "gitlab";
|
|
87
|
-
user: string;
|
|
88
|
-
forkOrigin: string;
|
|
89
|
-
}, {
|
|
90
|
-
platform: "github" | "gitlab";
|
|
91
|
-
user: string;
|
|
92
|
-
forkOrigin: string;
|
|
93
|
-
}>>;
|
|
94
|
-
workspaceId: z.ZodOptional<z.ZodString>;
|
|
95
55
|
repoOrigin: z.ZodOptional<z.ZodString>;
|
|
96
56
|
repoPath: z.ZodString;
|
|
97
57
|
intentId: z.ZodOptional<z.ZodString>;
|
|
@@ -111,12 +71,6 @@ export declare const updateIntentTool: {
|
|
|
111
71
|
}, "strip", z.ZodTypeAny, {
|
|
112
72
|
repoPath: string;
|
|
113
73
|
repoOrigin?: string | undefined;
|
|
114
|
-
forkAuthor?: {
|
|
115
|
-
platform: "github" | "gitlab";
|
|
116
|
-
user: string;
|
|
117
|
-
forkOrigin: string;
|
|
118
|
-
} | undefined;
|
|
119
|
-
workspaceId?: string | undefined;
|
|
120
74
|
title?: string | undefined;
|
|
121
75
|
description?: string | undefined;
|
|
122
76
|
constraints?: string[] | undefined;
|
|
@@ -128,12 +82,6 @@ export declare const updateIntentTool: {
|
|
|
128
82
|
}, {
|
|
129
83
|
repoPath: string;
|
|
130
84
|
repoOrigin?: string | undefined;
|
|
131
|
-
forkAuthor?: {
|
|
132
|
-
platform: "github" | "gitlab";
|
|
133
|
-
user: string;
|
|
134
|
-
forkOrigin: string;
|
|
135
|
-
} | undefined;
|
|
136
|
-
workspaceId?: string | undefined;
|
|
137
85
|
title?: string | undefined;
|
|
138
86
|
description?: string | undefined;
|
|
139
87
|
constraints?: string[] | undefined;
|
|
@@ -1,7 +1,6 @@
|
|
|
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';
|
|
5
4
|
export const updateIntentSchema = z.object({
|
|
6
5
|
repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
|
|
7
6
|
repoPath: z.string().describe('Local path to the repository root'),
|
|
@@ -13,15 +12,13 @@ export const updateIntentSchema = z.object({
|
|
|
13
12
|
type: z.enum(['repo', 'folder', 'files']),
|
|
14
13
|
paths: z.array(z.string())
|
|
15
14
|
}).optional().describe('Updated scope for the intent'),
|
|
16
|
-
...forkFieldsExtensions,
|
|
17
15
|
});
|
|
18
16
|
export async function updateIntent(input) {
|
|
19
17
|
const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
|
|
20
|
-
const forkFields = extractForkFields(input);
|
|
21
18
|
// Resolve the intent ID: use provided intentId, or look up the active intent
|
|
22
19
|
let intentId = input.intentId;
|
|
23
20
|
if (!intentId) {
|
|
24
|
-
const activeRes = await request('intent', 'get-active', { repoOrigin: actualOrigin
|
|
21
|
+
const activeRes = await request('intent', 'get-active', { repoOrigin: actualOrigin });
|
|
25
22
|
intentId = activeRes.intentId || activeRes.intent?.id || '';
|
|
26
23
|
if (!intentId) {
|
|
27
24
|
return {
|
|
@@ -63,7 +60,6 @@ export async function updateIntent(input) {
|
|
|
63
60
|
id: intentId,
|
|
64
61
|
repoOrigin: actualOrigin,
|
|
65
62
|
updates,
|
|
66
|
-
...forkFields,
|
|
67
63
|
});
|
|
68
64
|
if (res.success === false) {
|
|
69
65
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-intent.js","sourceRoot":"","sources":["../../src/tools/update-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;
|
|
1
|
+
{"version":3,"file":"update-intent.js","sourceRoot":"","sources":["../../src/tools/update-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,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,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,8EAA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L,OAAO,EAAE,KAAK;YACd,QAAQ;YACR,OAAO,EAAE,GAAG,CAAC,KAAK,IAAI,sBAAsB;YAC5C,aAAa,EAAE,EAAE;SAClB,CAAA;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,QAAQ;QACR,OAAO,EAAE,mBAAmB,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACtD,aAAa;QACb,OAAO,EAAE,GAAG,CAAC,OAAO;KACrB,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE;;;;;;;;;oEASqD;IAClE,WAAW,EAAE,kBAAkB;IAC/B,OAAO,EAAE,YAAY;CACtB,CAAA"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entity references — the shapes that carry a human-readable label alongside
|
|
3
|
+
* an id, so no tool response hands the model an id it cannot name.
|
|
4
|
+
*
|
|
5
|
+
* Workstream 1 of `kawa.dev-doc/DECISION_LINKING.md`. Before this, every
|
|
6
|
+
* reference reaching a human was a bare 8-char hex prefix:
|
|
7
|
+
*
|
|
8
|
+
* 7a7d1a36 supersedes 2cc444ec, which superseded 97c701e7
|
|
9
|
+
*
|
|
10
|
+
* Three ids, zero information. Naming a single ancestor cost an extra
|
|
11
|
+
* `get_decision_detail` round trip *per ancestor*, so it never happened.
|
|
12
|
+
* Kawa Code resolves the labels now and hands them over pre-joined.
|
|
13
|
+
*
|
|
14
|
+
* These refs carry **identity only** — never rationale, context or
|
|
15
|
+
* consequences. That is deliberate: recall payloads are kept lean, and a
|
|
16
|
+
* summary is bounded (~100 chars) and *is* the identity of the thing. If one of
|
|
17
|
+
* these ever grows a `rationale` field, that is the regression.
|
|
18
|
+
*/
|
|
19
|
+
/** A decision, named. */
|
|
20
|
+
export interface DecisionRef {
|
|
21
|
+
id: string;
|
|
22
|
+
summary: string;
|
|
23
|
+
type: string;
|
|
24
|
+
/**
|
|
25
|
+
* Distance along a supersession chain: 1 is a direct ancestor, 2 is what
|
|
26
|
+
* *that* one superseded, and so on.
|
|
27
|
+
*
|
|
28
|
+
* Present because order alone is ambiguous once a `supersedes` array is wider
|
|
29
|
+
* than one — without it there is no way to tell "A supersedes B and C" from
|
|
30
|
+
* "A supersedes B, which superseded C".
|
|
31
|
+
*/
|
|
32
|
+
depth?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* An intent, named.
|
|
36
|
+
*
|
|
37
|
+
* `id` is always the **full 24-character** ObjectId, never a prefix. Intent ids
|
|
38
|
+
* are Mongo ObjectIds whose leading 4 bytes are a Unix timestamp, so two
|
|
39
|
+
* intents created by the same process in the same second share their first 18
|
|
40
|
+
* hex characters. A truncated intent id is not merely collision-prone — it is
|
|
41
|
+
* not resolvable to a single intent at all. Decision ids are UUIDs and do not
|
|
42
|
+
* have this problem; an 8-char decision prefix is unambiguous.
|
|
43
|
+
*/
|
|
44
|
+
export interface IntentRef {
|
|
45
|
+
id: string;
|
|
46
|
+
title: string;
|
|
47
|
+
status: string;
|
|
48
|
+
}
|
|
49
|
+
/** Shape Kawa Code returns for a resolved reference. Tolerant of an absent label. */
|
|
50
|
+
type RawRef = Record<string, unknown> | null | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Normalize one decision ref off an IPC payload.
|
|
53
|
+
*
|
|
54
|
+
* Returns `null` rather than a half-built ref when there is no id or summary —
|
|
55
|
+
* an unlabelled reference is not a ref, and callers fall back to the bare id,
|
|
56
|
+
* which is exactly the pre-W1 behaviour. Label resolution is fail-soft end to
|
|
57
|
+
* end: an unresolvable ancestor must never turn a working response into an error.
|
|
58
|
+
*/
|
|
59
|
+
export declare function toDecisionRef(raw: RawRef): DecisionRef | null;
|
|
60
|
+
/** Normalize one intent ref off an IPC payload. Same fail-soft contract. */
|
|
61
|
+
export declare function toIntentRef(raw: RawRef): IntentRef | null;
|
|
62
|
+
export declare function toDecisionRefs(raw: unknown): DecisionRef[];
|
|
63
|
+
export declare function toIntentRefs(raw: unknown): IntentRef[];
|
|
64
|
+
/**
|
|
65
|
+
* How to name an entity in a message.
|
|
66
|
+
*
|
|
67
|
+
* Leads with the label and keeps the id in parentheses, per the prose
|
|
68
|
+
* convention in LLM_RULES.md. Falls back to the bare id when nothing resolved,
|
|
69
|
+
* which is the whole point of the fail-soft contract above.
|
|
70
|
+
*/
|
|
71
|
+
export declare function nameDecision(ref: DecisionRef | null, fallbackId: string): string;
|
|
72
|
+
export declare function nameIntent(ref: IntentRef | null, fallbackId: string): string;
|
|
73
|
+
export {};
|