@oka-core/reason 0.2.10 → 0.2.11
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/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,uBAAuB,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,C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ate
|
|
188
188
|
*/
|
|
189
189
|
async triggerConsolidation(req) {
|
|
190
|
-
|
|
190
|
+
const body = { ...req, repo: req.repo || this.repo };
|
|
191
|
+
return this.post("/api/reasoning/consolidate", body, 120_000);
|
|
191
192
|
}
|
|
192
193
|
// ─── HTTP helpers ───────────────────────────────────────────────
|
|
193
194
|
authHeaders() {
|
package/dist/tools/read.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EACV,SAAS,EAGV,MAAM,cAAc,CAAC;AAoEtB;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EACV,SAAS,EAGV,MAAM,cAAc,CAAC;AAoEtB;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CAwmB5E"}
|
package/dist/tools/read.js
CHANGED
|
@@ -66,7 +66,6 @@ export function registerReadTools(server, client) {
|
|
|
66
66
|
topic: z
|
|
67
67
|
.string()
|
|
68
68
|
.describe("Topic to query (e.g., 'auth', 'billing', 'deployment')"),
|
|
69
|
-
repo: z.string().optional().describe("Repository identifier"),
|
|
70
69
|
file_patterns: z
|
|
71
70
|
.string()
|
|
72
71
|
.optional()
|
|
@@ -128,7 +127,6 @@ export function registerReadTools(server, client) {
|
|
|
128
127
|
// ─── learnings ─────────────────────────────────────────────────
|
|
129
128
|
server.tool("learnings", "Browse institutional knowledge. Filter by category, status, " +
|
|
130
129
|
"confidence, or repo. Returns consolidated learnings with evidence counts.", {
|
|
131
|
-
repo: z.string().optional().describe("Repository to filter by"),
|
|
132
130
|
category: z
|
|
133
131
|
.enum([
|
|
134
132
|
"architecture",
|
|
@@ -158,7 +156,6 @@ export function registerReadTools(server, client) {
|
|
|
158
156
|
}, async (params) => {
|
|
159
157
|
try {
|
|
160
158
|
const result = await client.getLearnings({
|
|
161
|
-
repo: params.repo,
|
|
162
159
|
category: params.category,
|
|
163
160
|
status: params.status,
|
|
164
161
|
min_confidence: params.min_confidence,
|
|
@@ -207,8 +204,7 @@ export function registerReadTools(server, client) {
|
|
|
207
204
|
}
|
|
208
205
|
});
|
|
209
206
|
// ─── decisions ─────────────────────────────────────────────────
|
|
210
|
-
server.tool("decisions", "Get the decision log
|
|
211
|
-
repo: z.string().describe("Repository identifier"),
|
|
207
|
+
server.tool("decisions", "Get the decision log, optionally filtered by module and timeframe", {
|
|
212
208
|
module: z.string().optional().describe("Filter by module/area"),
|
|
213
209
|
timeframe: z
|
|
214
210
|
.string()
|
|
@@ -231,12 +227,9 @@ export function registerReadTools(server, client) {
|
|
|
231
227
|
};
|
|
232
228
|
});
|
|
233
229
|
// ─── patterns ──────────────────────────────────────────────────
|
|
234
|
-
server.tool("patterns", "Get recurring insights and patterns identified across agent sessions", {
|
|
235
|
-
repo: z.string().describe("Repository identifier"),
|
|
236
|
-
}, async (params) => {
|
|
230
|
+
server.tool("patterns", "Get recurring insights and patterns identified across agent sessions", {}, async () => {
|
|
237
231
|
try {
|
|
238
232
|
const result = await client.getLearnings({
|
|
239
|
-
repo: params.repo,
|
|
240
233
|
min_confidence: 0.5,
|
|
241
234
|
sort_by: "confidence",
|
|
242
235
|
sort_order: "desc",
|
|
@@ -259,7 +252,7 @@ export function registerReadTools(server, client) {
|
|
|
259
252
|
content: [
|
|
260
253
|
{
|
|
261
254
|
type: "text",
|
|
262
|
-
text: `## Patterns
|
|
255
|
+
text: `## Patterns\n\n${text}`,
|
|
263
256
|
},
|
|
264
257
|
],
|
|
265
258
|
};
|
|
@@ -273,7 +266,6 @@ export function registerReadTools(server, client) {
|
|
|
273
266
|
});
|
|
274
267
|
// ─── suggest ───────────────────────────────────────────────────
|
|
275
268
|
server.tool("suggest", "Get ranked task priorities based on accumulated reasoning", {
|
|
276
|
-
repo: z.string().describe("Repository identifier"),
|
|
277
269
|
backlog: z
|
|
278
270
|
.preprocess((v) => (typeof v === "string" ? JSON.parse(v) : v), z.array(z.string()).min(1))
|
|
279
271
|
.describe("List of backlog items to prioritize"),
|
|
@@ -281,7 +273,6 @@ export function registerReadTools(server, client) {
|
|
|
281
273
|
try {
|
|
282
274
|
// Fetch learnings to rank backlog items by relevance to institutional knowledge
|
|
283
275
|
const learningsResult = await client.getLearnings({
|
|
284
|
-
repo: params.repo,
|
|
285
276
|
sort_by: "confidence",
|
|
286
277
|
sort_order: "desc",
|
|
287
278
|
});
|
|
@@ -333,7 +324,6 @@ export function registerReadTools(server, client) {
|
|
|
333
324
|
server.tool("backlog", "Get the auto-generated agentic product backlog. " +
|
|
334
325
|
"PBIs are generated by the consolidation engine from high-confidence learnings. " +
|
|
335
326
|
"Each PBI includes evidence summary, suggested approach, and full context.", {
|
|
336
|
-
repo: z.string().optional().describe("Repository to scope to"),
|
|
337
327
|
status: z
|
|
338
328
|
.string()
|
|
339
329
|
.optional()
|
|
@@ -347,7 +337,6 @@ export function registerReadTools(server, client) {
|
|
|
347
337
|
}, async (params) => {
|
|
348
338
|
try {
|
|
349
339
|
const backlog = await client.getBacklog({
|
|
350
|
-
repo: params.repo,
|
|
351
340
|
status: params.status,
|
|
352
341
|
priority: params.priority,
|
|
353
342
|
tags: params.tags?.join(","),
|
|
@@ -401,7 +390,6 @@ export function registerReadTools(server, client) {
|
|
|
401
390
|
server.tool("priorities", "Get evidence-ranked priorities for what to build next. " +
|
|
402
391
|
"Priorities are derived from consolidated learnings across agent sessions, " +
|
|
403
392
|
"code changes, meetings, tickets, and chat.", {
|
|
404
|
-
repo: z.string().optional().describe("Repository to scope priorities to"),
|
|
405
393
|
current_tasks: z
|
|
406
394
|
.array(z.string())
|
|
407
395
|
.optional()
|
|
@@ -414,7 +402,6 @@ export function registerReadTools(server, client) {
|
|
|
414
402
|
}, async (params) => {
|
|
415
403
|
try {
|
|
416
404
|
const backlog = await client.getBacklog({
|
|
417
|
-
repo: params.repo,
|
|
418
405
|
status: "approved",
|
|
419
406
|
limit: params.max_results,
|
|
420
407
|
});
|
|
@@ -469,16 +456,12 @@ export function registerReadTools(server, client) {
|
|
|
469
456
|
query: z
|
|
470
457
|
.string()
|
|
471
458
|
.describe("Natural language query (e.g., 'authentication token refresh')"),
|
|
472
|
-
repo: z
|
|
473
|
-
.string()
|
|
474
|
-
.optional()
|
|
475
|
-
.describe("Repository identifier. Optional for account_wide (cross-repo) search."),
|
|
476
459
|
limit: z.number().optional().default(10).describe("Max results"),
|
|
477
460
|
min_similarity: z
|
|
478
461
|
.number()
|
|
479
462
|
.optional()
|
|
480
|
-
.default(0.
|
|
481
|
-
.describe("Minimum cosine similarity (0.0–1.0)"),
|
|
463
|
+
.default(0.4)
|
|
464
|
+
.describe("Minimum cosine similarity threshold (0.0–1.0)"),
|
|
482
465
|
visibility: z
|
|
483
466
|
.enum(["user_repo", "account_wide", "user_private"])
|
|
484
467
|
.optional()
|
|
@@ -488,7 +471,6 @@ export function registerReadTools(server, client) {
|
|
|
488
471
|
}, async (params) => {
|
|
489
472
|
try {
|
|
490
473
|
const result = await client.semanticSearch(params.query, {
|
|
491
|
-
repo: params.repo,
|
|
492
474
|
limit: params.limit,
|
|
493
475
|
min_similarity: params.min_similarity,
|
|
494
476
|
visibility: params.visibility,
|
|
@@ -536,12 +518,11 @@ export function registerReadTools(server, client) {
|
|
|
536
518
|
server.tool("consolidate", "Trigger a consolidation run to process recent reasoning events " +
|
|
537
519
|
"and derive new learnings and backlog items. Use this when you want " +
|
|
538
520
|
"to refresh the institutional knowledge base.", {
|
|
539
|
-
repo: z.string().describe("Repository to run consolidation for"),
|
|
540
521
|
max_events: z.number().optional().describe("Maximum events to process"),
|
|
541
522
|
}, async (params) => {
|
|
542
523
|
try {
|
|
543
524
|
const result = await client.triggerConsolidation({
|
|
544
|
-
repo:
|
|
525
|
+
repo: "",
|
|
545
526
|
trigger: "manual",
|
|
546
527
|
max_events: params.max_events,
|
|
547
528
|
});
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"read_enhanced.d.ts","sourceRoot":"","sources":["../../src/tools/read_enhanced.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAoE9C,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,SAAS,GAChB,IAAI,CAqPN"}
|
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* Enhanced read tools that prefer consolidated Learnings over raw events.
|
|
4
|
-
*
|
|
5
|
-
* These are drop-in replacements for the basic read tools in read.ts.
|
|
6
|
-
* They query the enhanced learnings API first, falling back to raw events
|
|
7
|
-
* if the enhanced endpoint isn't available.
|
|
8
|
-
*/
|
|
9
|
-
const GetContextInputEnhanced = z.object({
|
|
10
|
-
repo: z.string().describe("Repository identifier"),
|
|
11
|
-
area: z
|
|
12
|
-
.string()
|
|
13
|
-
.describe("Area to get context for (e.g., 'auth', 'billing')"),
|
|
14
|
-
include_raw_events: z
|
|
15
|
-
.boolean()
|
|
16
|
-
.optional()
|
|
17
|
-
.default(false)
|
|
18
|
-
.describe("Also include raw recent events alongside consolidated learnings"),
|
|
19
|
-
min_confidence: z
|
|
20
|
-
.number()
|
|
21
|
-
.optional()
|
|
22
|
-
.default(0.5)
|
|
23
|
-
.describe("Minimum confidence for included learnings"),
|
|
24
|
-
});
|
|
25
|
-
const GetDecisionsInputEnhanced = z.object({
|
|
26
|
-
repo: z.string(),
|
|
27
|
-
module: z.string().optional().describe("Module to filter by"),
|
|
28
|
-
timeframe: z.string().optional().describe("Timeframe: '7d', '30d', '24h'"),
|
|
29
|
-
include_rationale: z
|
|
30
|
-
.boolean()
|
|
31
|
-
.optional()
|
|
32
|
-
.default(true)
|
|
33
|
-
.describe("Include full rationale and alternatives considered"),
|
|
34
|
-
});
|
|
35
|
-
const GetPatternsInputEnhanced = z.object({
|
|
36
|
-
repo: z.string(),
|
|
37
|
-
category: z
|
|
38
|
-
.string()
|
|
39
|
-
.optional()
|
|
40
|
-
.describe("Filter by: architecture, bug_pattern, convention, decision, performance, security, workflow"),
|
|
41
|
-
min_evidence: z
|
|
42
|
-
.number()
|
|
43
|
-
.optional()
|
|
44
|
-
.default(2)
|
|
45
|
-
.describe("Minimum number of corroborating sources"),
|
|
46
|
-
});
|
|
47
|
-
const SuggestPrioritiesEnhanced = z.object({
|
|
48
|
-
repo: z.string(),
|
|
49
|
-
backlog: z
|
|
50
|
-
.array(z.string())
|
|
51
|
-
.optional()
|
|
52
|
-
.describe("Current backlog items for context-aware ranking"),
|
|
53
|
-
include_auto_generated: z
|
|
54
|
-
.boolean()
|
|
55
|
-
.optional()
|
|
56
|
-
.default(true)
|
|
57
|
-
.describe("Include auto-generated PBIs from consolidation"),
|
|
58
|
-
});
|
|
59
|
-
export function registerEnhancedReadTools(server, client) {
|
|
60
|
-
server.tool("get_context_enhanced", "Get consolidated institutional knowledge about an area. " +
|
|
61
|
-
"Unlike basic get_context, this returns Learnings derived from cross-source " +
|
|
62
|
-
"consolidation (agent reasoning + code + docs + meetings + tickets + chat). " +
|
|
63
|
-
"Each learning has a confidence score and evidence count.", GetContextInputEnhanced.shape, async (params) => {
|
|
64
|
-
try {
|
|
65
|
-
// Try enhanced endpoint first
|
|
66
|
-
const enhancedResult = await fetchEnhancedLearnings(client, {
|
|
67
|
-
repo: params.repo,
|
|
68
|
-
area: params.area,
|
|
69
|
-
minConfidence: params.min_confidence,
|
|
70
|
-
});
|
|
71
|
-
if (enhancedResult && enhancedResult.length > 0) {
|
|
72
|
-
let text = formatEnhancedContext(params.area, enhancedResult);
|
|
73
|
-
// Optionally include raw events for full picture
|
|
74
|
-
if (params.include_raw_events) {
|
|
75
|
-
const rawResult = await client.query({
|
|
76
|
-
area: params.area,
|
|
77
|
-
});
|
|
78
|
-
if (rawResult?.results?.length > 0) {
|
|
79
|
-
text += "\n\n---\n\n## Recent Raw Events\n\n";
|
|
80
|
-
text += rawResult.results
|
|
81
|
-
.slice(0, 10)
|
|
82
|
-
.map((r) => {
|
|
83
|
-
const rec = r;
|
|
84
|
-
const payload = rec["payload"];
|
|
85
|
-
const desc = payload?.["description"] ||
|
|
86
|
-
payload?.["area"] ||
|
|
87
|
-
JSON.stringify(payload).slice(0, 200);
|
|
88
|
-
return `- [${rec["event_type"]}] ${desc}`;
|
|
89
|
-
})
|
|
90
|
-
.join("\n");
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return { content: [{ type: "text", text }] };
|
|
94
|
-
}
|
|
95
|
-
// Fall back to raw events
|
|
96
|
-
const rawResult = await client.query({
|
|
97
|
-
area: params.area,
|
|
98
|
-
});
|
|
99
|
-
return {
|
|
100
|
-
content: [
|
|
101
|
-
{
|
|
102
|
-
type: "text",
|
|
103
|
-
text: rawResult?.results?.length > 0
|
|
104
|
-
? formatRawFallback(params.area, rawResult.results)
|
|
105
|
-
: `No knowledge found for area "${params.area}". This area hasn't been explored yet.`,
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
return {
|
|
112
|
-
content: [{ type: "text", text: `Error: ${error}` }],
|
|
113
|
-
isError: true,
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
server.tool("get_decisions_enhanced", "Get the decision log with full rationale and alternatives. " +
|
|
118
|
-
"Shows what was decided, why, and what was rejected.", GetDecisionsInputEnhanced.shape, async (params) => {
|
|
119
|
-
try {
|
|
120
|
-
const result = await client.query({
|
|
121
|
-
event_type: "decision",
|
|
122
|
-
module: params.module,
|
|
123
|
-
timeframe: params.timeframe,
|
|
124
|
-
});
|
|
125
|
-
if (!result?.results?.length) {
|
|
126
|
-
return {
|
|
127
|
-
content: [
|
|
128
|
-
{
|
|
129
|
-
type: "text",
|
|
130
|
-
text: "No decisions recorded for this scope.",
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
const formatted = result.results
|
|
136
|
-
.map((r) => {
|
|
137
|
-
const record = r;
|
|
138
|
-
const p = record["payload"] || {};
|
|
139
|
-
let entry = `### ${p["description"] || "Decision"}\n`;
|
|
140
|
-
if (params.include_rationale && p["rationale"]) {
|
|
141
|
-
entry += `**Rationale:** ${p["rationale"]}\n`;
|
|
142
|
-
}
|
|
143
|
-
const alts = p["alternatives_considered"];
|
|
144
|
-
if (alts && alts.length > 0) {
|
|
145
|
-
entry += `**Rejected alternatives:** ${alts.join(", ")}\n`;
|
|
146
|
-
}
|
|
147
|
-
if (p["confidence"]) {
|
|
148
|
-
entry += `**Confidence:** ${((p["confidence"] ?? 0) * 100).toFixed(0)}%\n`;
|
|
149
|
-
}
|
|
150
|
-
entry += `*Agent: ${record["agent_id"]} | Session: ${record["session_id"]}*\n`;
|
|
151
|
-
return entry;
|
|
152
|
-
})
|
|
153
|
-
.join("\n---\n\n");
|
|
154
|
-
return {
|
|
155
|
-
content: [
|
|
156
|
-
{
|
|
157
|
-
type: "text",
|
|
158
|
-
text: `## Decision Log\n\n${formatted}`,
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
catch (error) {
|
|
164
|
-
return {
|
|
165
|
-
content: [{ type: "text", text: `Error: ${error}` }],
|
|
166
|
-
isError: true,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
server.tool("get_patterns_enhanced", "Get recurring patterns with evidence counts and confidence. " +
|
|
171
|
-
"Only shows patterns corroborated by multiple sources.", GetPatternsInputEnhanced.shape, async (params) => {
|
|
172
|
-
try {
|
|
173
|
-
const learnings = await fetchEnhancedLearnings(client, {
|
|
174
|
-
repo: params.repo,
|
|
175
|
-
category: params.category,
|
|
176
|
-
minConfidence: 0.5,
|
|
177
|
-
});
|
|
178
|
-
const patterns = (learnings || []).filter((l) => (l.evidence_count ?? 1) >= (params.min_evidence ?? 2));
|
|
179
|
-
if (patterns.length === 0) {
|
|
180
|
-
return {
|
|
181
|
-
content: [
|
|
182
|
-
{
|
|
183
|
-
type: "text",
|
|
184
|
-
text: "No recurring patterns identified yet. Patterns emerge after multiple " +
|
|
185
|
-
"sessions observe the same conventions, bugs, or architectural decisions.",
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
const formatted = patterns
|
|
191
|
-
.map((p) => `### ${p.summary}\n` +
|
|
192
|
-
`**Confidence:** ${((p.confidence ?? 0) * 100).toFixed(0)}% | ` +
|
|
193
|
-
`**Evidence:** ${p.evidence_count} source(s) | ` +
|
|
194
|
-
`**Category:** ${p.category || "general"}\n` +
|
|
195
|
-
(p.suggested_action
|
|
196
|
-
? `**Action:** ${p.suggested_action}\n`
|
|
197
|
-
: "") +
|
|
198
|
-
(p.file_patterns?.length
|
|
199
|
-
? `**Files:** ${p.file_patterns.join(", ")}\n`
|
|
200
|
-
: ""))
|
|
201
|
-
.join("\n---\n\n");
|
|
202
|
-
return {
|
|
203
|
-
content: [
|
|
204
|
-
{
|
|
205
|
-
type: "text",
|
|
206
|
-
text: `## Recurring Patterns\n\n${formatted}`,
|
|
207
|
-
},
|
|
208
|
-
],
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
catch (error) {
|
|
212
|
-
return {
|
|
213
|
-
content: [{ type: "text", text: `Error: ${error}` }],
|
|
214
|
-
isError: true,
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
server.tool("suggest_priorities_enhanced", "Suggest evidence-ranked priorities combining human backlog with " +
|
|
219
|
-
"auto-generated PBIs from consolidation.", SuggestPrioritiesEnhanced.shape, async (params) => {
|
|
220
|
-
try {
|
|
221
|
-
// Get high-confidence learnings that suggest action
|
|
222
|
-
const learnings = await fetchEnhancedLearnings(client, {
|
|
223
|
-
repo: params.repo,
|
|
224
|
-
minConfidence: 0.7,
|
|
225
|
-
});
|
|
226
|
-
const actionable = (learnings || [])
|
|
227
|
-
.filter((l) => l.suggested_action)
|
|
228
|
-
.sort((a, b) => (b.confidence ?? 0) - (a.confidence ?? 0));
|
|
229
|
-
let text = "## Suggested Priorities\n\n";
|
|
230
|
-
text += "> Ranked by evidence weight across all knowledge sources.\n\n";
|
|
231
|
-
if (actionable.length === 0) {
|
|
232
|
-
text +=
|
|
233
|
-
"No high-confidence actionable learnings yet. " +
|
|
234
|
-
"Continue capturing reasoning events to build the evidence base.";
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
actionable.forEach((l, i) => {
|
|
238
|
-
text += `${i + 1}. **${l.summary}**\n`;
|
|
239
|
-
text += ` Confidence: ${((l.confidence ?? 0) * 100).toFixed(0)}% | `;
|
|
240
|
-
text += `Evidence: ${l.evidence_count ?? 1} source(s)\n`;
|
|
241
|
-
text += ` Action: ${l.suggested_action}\n\n`;
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
return { content: [{ type: "text", text }] };
|
|
245
|
-
}
|
|
246
|
-
catch (error) {
|
|
247
|
-
return {
|
|
248
|
-
content: [{ type: "text", text: `Error: ${error}` }],
|
|
249
|
-
isError: true,
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
// --- Helpers ---
|
|
255
|
-
async function fetchEnhancedLearnings(client, options) {
|
|
256
|
-
try {
|
|
257
|
-
// Try the enhanced learnings endpoint via the client's query method
|
|
258
|
-
// with a special type parameter that the API can recognize
|
|
259
|
-
const result = await client.query({
|
|
260
|
-
type: "learnings_enhanced",
|
|
261
|
-
area: options.area,
|
|
262
|
-
category: options.category,
|
|
263
|
-
min_confidence: options.minConfidence
|
|
264
|
-
? String(options.minConfidence)
|
|
265
|
-
: undefined,
|
|
266
|
-
sort_by: "confidence",
|
|
267
|
-
sort_order: "desc",
|
|
268
|
-
limit: "30",
|
|
269
|
-
});
|
|
270
|
-
return result?.results ?? [];
|
|
271
|
-
}
|
|
272
|
-
catch {
|
|
273
|
-
return [];
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
function formatEnhancedContext(area, learnings) {
|
|
277
|
-
let text = `## Institutional Knowledge: ${area}\n\n`;
|
|
278
|
-
text += `> ${learnings.length} consolidated learning(s) from cross-source analysis.\n\n`;
|
|
279
|
-
for (const l of learnings) {
|
|
280
|
-
text += `### ${l.summary}\n`;
|
|
281
|
-
text += `**Confidence:** ${((l.confidence ?? 0) * 100).toFixed(0)}%`;
|
|
282
|
-
if (l.evidence_count > 1)
|
|
283
|
-
text += ` (${l.evidence_count} sources)`;
|
|
284
|
-
text += ` | **Category:** ${l.category || "general"}\n`;
|
|
285
|
-
if (l.detailed_description)
|
|
286
|
-
text += `\n${l.detailed_description}\n`;
|
|
287
|
-
if (l.suggested_action)
|
|
288
|
-
text += `\n**Suggested action:** ${l.suggested_action}\n`;
|
|
289
|
-
if (l.file_patterns?.length)
|
|
290
|
-
text += `**Related files:** ${l.file_patterns.join(", ")}\n`;
|
|
291
|
-
text += "\n";
|
|
292
|
-
}
|
|
293
|
-
return text;
|
|
294
|
-
}
|
|
295
|
-
function formatRawFallback(area, events) {
|
|
296
|
-
let text = `## Raw Events: ${area}\n\n`;
|
|
297
|
-
text += `> No consolidated learnings yet. Showing ${events.length} raw event(s).\n\n`;
|
|
298
|
-
for (const e of events) {
|
|
299
|
-
const payload = e["payload"];
|
|
300
|
-
const desc = payload?.["description"] || JSON.stringify(payload).slice(0, 200);
|
|
301
|
-
text += `- [${e["event_type"]}] ${desc}\n`;
|
|
302
|
-
}
|
|
303
|
-
return text;
|
|
304
|
-
}
|