@vpxa/kb 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +1 -1
- package/packages/analyzers/dist/blast-radius-analyzer.js +13 -114
- package/packages/analyzers/dist/dependency-analyzer.js +11 -425
- package/packages/analyzers/dist/diagram-generator.js +4 -86
- package/packages/analyzers/dist/entry-point-analyzer.js +5 -239
- package/packages/analyzers/dist/index.js +1 -23
- package/packages/analyzers/dist/knowledge-producer.js +24 -113
- package/packages/analyzers/dist/pattern-analyzer.js +5 -359
- package/packages/analyzers/dist/regex-call-graph.js +1 -428
- package/packages/analyzers/dist/structure-analyzer.js +4 -258
- package/packages/analyzers/dist/symbol-analyzer.js +13 -442
- package/packages/analyzers/dist/ts-call-graph.js +1 -160
- package/packages/analyzers/dist/types.js +0 -1
- package/packages/chunker/dist/call-graph-extractor.js +1 -90
- package/packages/chunker/dist/chunker-factory.js +1 -36
- package/packages/chunker/dist/chunker.interface.js +0 -1
- package/packages/chunker/dist/code-chunker.js +14 -134
- package/packages/chunker/dist/generic-chunker.js +5 -72
- package/packages/chunker/dist/index.js +1 -21
- package/packages/chunker/dist/markdown-chunker.js +7 -119
- package/packages/chunker/dist/treesitter-chunker.js +8 -234
- package/packages/cli/dist/commands/analyze.js +3 -112
- package/packages/cli/dist/commands/context-cmds.js +1 -155
- package/packages/cli/dist/commands/environment.js +2 -204
- package/packages/cli/dist/commands/execution.js +1 -137
- package/packages/cli/dist/commands/graph.js +7 -81
- package/packages/cli/dist/commands/init.js +9 -87
- package/packages/cli/dist/commands/knowledge.js +1 -139
- package/packages/cli/dist/commands/search.js +8 -267
- package/packages/cli/dist/commands/system.js +4 -241
- package/packages/cli/dist/commands/workspace.js +2 -388
- package/packages/cli/dist/context.js +1 -14
- package/packages/cli/dist/helpers.js +3 -458
- package/packages/cli/dist/index.d.ts +1 -1
- package/packages/cli/dist/index.js +3 -69
- package/packages/cli/dist/kb-init.js +1 -82
- package/packages/cli/dist/types.js +0 -1
- package/packages/core/dist/constants.js +1 -43
- package/packages/core/dist/content-detector.js +1 -79
- package/packages/core/dist/errors.js +1 -40
- package/packages/core/dist/index.js +1 -9
- package/packages/core/dist/logger.js +1 -34
- package/packages/core/dist/types.js +0 -1
- package/packages/embeddings/dist/embedder.interface.js +0 -1
- package/packages/embeddings/dist/index.js +1 -5
- package/packages/embeddings/dist/onnx-embedder.js +1 -82
- package/packages/indexer/dist/file-hasher.js +1 -13
- package/packages/indexer/dist/filesystem-crawler.js +1 -125
- package/packages/indexer/dist/graph-extractor.js +1 -111
- package/packages/indexer/dist/incremental-indexer.js +1 -278
- package/packages/indexer/dist/index.js +1 -14
- package/packages/server/dist/api.js +1 -9
- package/packages/server/dist/config.js +1 -75
- package/packages/server/dist/curated-manager.js +9 -356
- package/packages/server/dist/index.js +1 -134
- package/packages/server/dist/replay-interceptor.js +1 -38
- package/packages/server/dist/resources/resources.js +2 -40
- package/packages/server/dist/server.js +1 -247
- package/packages/server/dist/tools/analyze.tools.js +1 -288
- package/packages/server/dist/tools/forge.tools.js +11 -499
- package/packages/server/dist/tools/forget.tool.js +3 -39
- package/packages/server/dist/tools/graph.tool.js +5 -110
- package/packages/server/dist/tools/list.tool.js +5 -53
- package/packages/server/dist/tools/lookup.tool.js +8 -51
- package/packages/server/dist/tools/onboard.tool.js +2 -112
- package/packages/server/dist/tools/produce.tool.js +4 -74
- package/packages/server/dist/tools/read.tool.js +4 -47
- package/packages/server/dist/tools/reindex.tool.js +2 -70
- package/packages/server/dist/tools/remember.tool.js +3 -42
- package/packages/server/dist/tools/replay.tool.js +6 -88
- package/packages/server/dist/tools/search.tool.js +17 -327
- package/packages/server/dist/tools/status.tool.js +3 -68
- package/packages/server/dist/tools/toolkit.tools.js +20 -1673
- package/packages/server/dist/tools/update.tool.js +3 -39
- package/packages/server/dist/tools/utility.tools.js +19 -456
- package/packages/store/dist/graph-store.interface.js +0 -1
- package/packages/store/dist/index.js +1 -9
- package/packages/store/dist/lance-store.js +1 -258
- package/packages/store/dist/sqlite-graph-store.js +8 -309
- package/packages/store/dist/store-factory.js +1 -14
- package/packages/store/dist/store.interface.js +0 -1
- package/packages/tools/dist/batch.js +1 -45
- package/packages/tools/dist/changelog.js +2 -112
- package/packages/tools/dist/check.js +2 -59
- package/packages/tools/dist/checkpoint.js +2 -43
- package/packages/tools/dist/codemod.js +2 -69
- package/packages/tools/dist/compact.js +3 -60
- package/packages/tools/dist/data-transform.js +1 -124
- package/packages/tools/dist/dead-symbols.js +2 -71
- package/packages/tools/dist/delegate.js +3 -128
- package/packages/tools/dist/diff-parse.js +3 -153
- package/packages/tools/dist/digest.js +7 -242
- package/packages/tools/dist/encode.js +1 -46
- package/packages/tools/dist/env-info.js +1 -58
- package/packages/tools/dist/eval.js +3 -79
- package/packages/tools/dist/evidence-map.js +3 -203
- package/packages/tools/dist/file-summary.js +2 -106
- package/packages/tools/dist/file-walk.js +1 -75
- package/packages/tools/dist/find-examples.js +3 -48
- package/packages/tools/dist/find.js +1 -120
- package/packages/tools/dist/forge-classify.js +2 -319
- package/packages/tools/dist/forge-ground.js +1 -184
- package/packages/tools/dist/git-context.js +3 -46
- package/packages/tools/dist/graph-query.js +1 -194
- package/packages/tools/dist/health.js +1 -118
- package/packages/tools/dist/http-request.js +1 -58
- package/packages/tools/dist/index.js +1 -273
- package/packages/tools/dist/lane.js +7 -227
- package/packages/tools/dist/measure.js +2 -119
- package/packages/tools/dist/onboard.js +42 -1136
- package/packages/tools/dist/parse-output.js +2 -158
- package/packages/tools/dist/process-manager.js +1 -69
- package/packages/tools/dist/queue.js +2 -126
- package/packages/tools/dist/regex-test.js +1 -39
- package/packages/tools/dist/rename.js +2 -70
- package/packages/tools/dist/replay.js +6 -108
- package/packages/tools/dist/schema-validate.js +1 -141
- package/packages/tools/dist/scope-map.js +1 -72
- package/packages/tools/dist/snippet.js +1 -80
- package/packages/tools/dist/stash.js +2 -60
- package/packages/tools/dist/stratum-card.js +5 -238
- package/packages/tools/dist/symbol.js +3 -87
- package/packages/tools/dist/test-run.js +2 -55
- package/packages/tools/dist/text-utils.js +2 -31
- package/packages/tools/dist/time-utils.js +1 -135
- package/packages/tools/dist/trace.js +2 -114
- package/packages/tools/dist/truncation.js +10 -41
- package/packages/tools/dist/watch.js +1 -61
- package/packages/tools/dist/web-fetch.js +9 -244
- package/packages/tools/dist/web-search.js +1 -46
- package/packages/tools/dist/workset.js +2 -77
- package/packages/tui/dist/App.js +260 -52468
- package/packages/tui/dist/index.js +286 -54551
- package/packages/tui/dist/panels/CuratedPanel.js +211 -34291
- package/packages/tui/dist/panels/LogPanel.js +259 -51703
- package/packages/tui/dist/panels/SearchPanel.js +212 -34824
- package/packages/tui/dist/panels/StatusPanel.js +211 -34304
|
@@ -1,501 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
function registerEvidenceMapTool(server) {
|
|
4
|
-
server.registerTool(
|
|
5
|
-
"evidence_map",
|
|
6
|
-
{
|
|
7
|
-
description: "FORGE Evidence Map \u2014 track critical-path claims as Verified/Assumed/Unresolved with receipts. Supports CRUD operations and deterministic Gate evaluation (YIELD/HOLD/HARD_BLOCK/FORCED_DELIVERY). Persists across tool calls.",
|
|
8
|
-
inputSchema: {
|
|
9
|
-
action: z.enum(["create", "add", "update", "get", "gate", "list", "delete"]).describe("Operation to perform"),
|
|
10
|
-
task_id: z.string().optional().describe("Task identifier (required for all except list)"),
|
|
11
|
-
tier: z.enum(["floor", "standard", "critical"]).optional().describe("FORGE tier (required for create)"),
|
|
12
|
-
claim: z.string().optional().describe("Critical-path claim text (for add)"),
|
|
13
|
-
status: z.enum(["V", "A", "U"]).optional().describe("Evidence status: V=Verified, A=Assumed, U=Unresolved"),
|
|
14
|
-
receipt: z.string().optional().describe("Evidence receipt: tool\u2192ref for V, reasoning for A, attempts for U"),
|
|
15
|
-
id: z.number().optional().describe("Entry ID (for update)"),
|
|
16
|
-
critical_path: z.boolean().default(true).describe("Whether this claim is on the critical path"),
|
|
17
|
-
unknown_type: z.enum(["contract", "convention", "freshness", "runtime", "data-flow", "impact"]).optional().describe("Typed unknown classification"),
|
|
18
|
-
retry_count: z.number().default(0).describe("Retry count for gate evaluation (0 = first attempt)"),
|
|
19
|
-
cwd: z.string().optional().describe(
|
|
20
|
-
"Working directory for evidence map storage (default: server cwd). Use root_path from forge_ground to match."
|
|
21
|
-
)
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
async ({
|
|
25
|
-
action,
|
|
26
|
-
task_id,
|
|
27
|
-
tier,
|
|
28
|
-
claim,
|
|
29
|
-
status,
|
|
30
|
-
receipt,
|
|
31
|
-
id,
|
|
32
|
-
critical_path,
|
|
33
|
-
unknown_type,
|
|
34
|
-
retry_count,
|
|
35
|
-
cwd
|
|
36
|
-
}) => {
|
|
37
|
-
try {
|
|
38
|
-
switch (action) {
|
|
39
|
-
case "create": {
|
|
40
|
-
if (!task_id) throw new Error("task_id required for create");
|
|
41
|
-
if (!tier) throw new Error("tier required for create");
|
|
42
|
-
evidenceMap({ action: "create", taskId: task_id, tier }, cwd);
|
|
43
|
-
return {
|
|
44
|
-
content: [
|
|
45
|
-
{
|
|
46
|
-
type: "text",
|
|
47
|
-
text: `Created evidence map "${task_id}" (tier: ${tier}).
|
|
1
|
+
import{digest as x,evidenceMap as g,forgeClassify as y,forgeGround as b,stratumCard as v}from"../../../tools/dist/index.js";import{z as t}from"zod";function T(m){m.registerTool("evidence_map",{description:"FORGE Evidence Map \u2014 track critical-path claims as Verified/Assumed/Unresolved with receipts. Supports CRUD operations and deterministic Gate evaluation (YIELD/HOLD/HARD_BLOCK/FORCED_DELIVERY). Persists across tool calls.",inputSchema:{action:t.enum(["create","add","update","get","gate","list","delete"]).describe("Operation to perform"),task_id:t.string().optional().describe("Task identifier (required for all except list)"),tier:t.enum(["floor","standard","critical"]).optional().describe("FORGE tier (required for create)"),claim:t.string().optional().describe("Critical-path claim text (for add)"),status:t.enum(["V","A","U"]).optional().describe("Evidence status: V=Verified, A=Assumed, U=Unresolved"),receipt:t.string().optional().describe("Evidence receipt: tool\u2192ref for V, reasoning for A, attempts for U"),id:t.number().optional().describe("Entry ID (for update)"),critical_path:t.boolean().default(!0).describe("Whether this claim is on the critical path"),unknown_type:t.enum(["contract","convention","freshness","runtime","data-flow","impact"]).optional().describe("Typed unknown classification"),retry_count:t.number().default(0).describe("Retry count for gate evaluation (0 = first attempt)"),cwd:t.string().optional().describe("Working directory for evidence map storage (default: server cwd). Use root_path from forge_ground to match.")}},async({action:h,task_id:s,tier:l,claim:c,status:i,receipt:d,id:o,critical_path:p,unknown_type:n,retry_count:r,cwd:u})=>{try{switch(h){case"create":{if(!s)throw new Error("task_id required for create");if(!l)throw new Error("tier required for create");return g({action:"create",taskId:s,tier:l},u),{content:[{type:"text",text:`Created evidence map "${s}" (tier: ${l}).
|
|
48
2
|
|
|
49
3
|
---
|
|
50
|
-
_Next: Use \`evidence_map\` with action "add" to record critical-path claims._`
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
{
|
|
61
|
-
action: "add",
|
|
62
|
-
taskId: task_id,
|
|
63
|
-
claim,
|
|
64
|
-
status,
|
|
65
|
-
receipt: receipt ?? "",
|
|
66
|
-
criticalPath: critical_path,
|
|
67
|
-
unknownType: unknown_type
|
|
68
|
-
},
|
|
69
|
-
cwd
|
|
70
|
-
);
|
|
71
|
-
const lines = [
|
|
72
|
-
`Added entry #${result.entry?.id} to "${task_id}": [${status}] ${claim}`
|
|
73
|
-
];
|
|
74
|
-
if (result.formattedMap) {
|
|
75
|
-
lines.push("", result.formattedMap);
|
|
76
|
-
}
|
|
77
|
-
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
78
|
-
}
|
|
79
|
-
case "update": {
|
|
80
|
-
if (!task_id) throw new Error("task_id required for update");
|
|
81
|
-
if (id === void 0) throw new Error("id required for update");
|
|
82
|
-
if (!status) throw new Error("status required for update");
|
|
83
|
-
const result = evidenceMap(
|
|
84
|
-
{
|
|
85
|
-
action: "update",
|
|
86
|
-
taskId: task_id,
|
|
87
|
-
id,
|
|
88
|
-
status,
|
|
89
|
-
receipt: receipt ?? ""
|
|
90
|
-
},
|
|
91
|
-
cwd
|
|
92
|
-
);
|
|
93
|
-
const lines = [`Updated entry #${id} in "${task_id}" \u2192 ${status}`];
|
|
94
|
-
if (result.formattedMap) {
|
|
95
|
-
lines.push("", result.formattedMap);
|
|
96
|
-
}
|
|
97
|
-
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
98
|
-
}
|
|
99
|
-
case "get": {
|
|
100
|
-
if (!task_id) throw new Error("task_id required for get");
|
|
101
|
-
const result = evidenceMap({ action: "get", taskId: task_id }, cwd);
|
|
102
|
-
if (!result.state) {
|
|
103
|
-
return {
|
|
104
|
-
content: [
|
|
105
|
-
{
|
|
106
|
-
type: "text",
|
|
107
|
-
text: `Evidence map "${task_id}" not found.`
|
|
108
|
-
}
|
|
109
|
-
]
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
const lines = [
|
|
113
|
-
`## Evidence Map: ${task_id} (${result.state.tier})`,
|
|
114
|
-
"",
|
|
115
|
-
result.formattedMap ?? "No entries.",
|
|
116
|
-
"",
|
|
117
|
-
`_${result.state.entries.length} entries \u2014 created ${result.state.createdAt}_`
|
|
118
|
-
];
|
|
119
|
-
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
120
|
-
}
|
|
121
|
-
case "gate": {
|
|
122
|
-
if (!task_id) throw new Error("task_id required for gate");
|
|
123
|
-
const result = evidenceMap(
|
|
124
|
-
{
|
|
125
|
-
action: "gate",
|
|
126
|
-
taskId: task_id,
|
|
127
|
-
retryCount: retry_count
|
|
128
|
-
},
|
|
129
|
-
cwd
|
|
130
|
-
);
|
|
131
|
-
if (!result.gate) {
|
|
132
|
-
return {
|
|
133
|
-
content: [
|
|
134
|
-
{
|
|
135
|
-
type: "text",
|
|
136
|
-
text: `Evidence map "${task_id}" not found.`
|
|
137
|
-
}
|
|
138
|
-
]
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
const g = result.gate;
|
|
142
|
-
const lines = [
|
|
143
|
-
`## FORGE Gate: **${g.decision}**`,
|
|
144
|
-
"",
|
|
145
|
-
`**Reason:** ${g.reason}`,
|
|
146
|
-
"",
|
|
147
|
-
`**Stats:** ${g.stats.verified}V / ${g.stats.assumed}A / ${g.stats.unresolved}U (${g.stats.total} total)`
|
|
148
|
-
];
|
|
149
|
-
if (g.warnings.length > 0) {
|
|
150
|
-
lines.push("", "**Warnings:**", ...g.warnings.map((w) => `- \u26A0\uFE0F ${w}`));
|
|
151
|
-
}
|
|
152
|
-
if (g.unresolvedCritical.length > 0) {
|
|
153
|
-
lines.push(
|
|
154
|
-
"",
|
|
155
|
-
"**Blocking entries:**",
|
|
156
|
-
...g.unresolvedCritical.map(
|
|
157
|
-
(e) => `- #${e.id}: ${e.claim} [${e.unknownType ?? "untyped"}]`
|
|
158
|
-
)
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
if (g.annotation) {
|
|
162
|
-
lines.push("", "**Annotation:**", g.annotation);
|
|
163
|
-
}
|
|
164
|
-
if (result.formattedMap) {
|
|
165
|
-
lines.push("", "---", "", result.formattedMap);
|
|
166
|
-
}
|
|
167
|
-
lines.push(
|
|
168
|
-
"",
|
|
169
|
-
"---",
|
|
170
|
-
`_Next: ${g.decision === "YIELD" ? "Proceed to implementation." : g.decision === "HOLD" ? "Resolve blocking entries, then re-run gate." : g.decision === "HARD_BLOCK" ? "Contract unknowns MUST be resolved. Use search or schema_validate." : "Proceed with annotation \u2014 document unresolved items in delivery."}_`
|
|
171
|
-
);
|
|
172
|
-
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
173
|
-
}
|
|
174
|
-
case "list": {
|
|
175
|
-
const result = evidenceMap({ action: "list" }, cwd);
|
|
176
|
-
if (!result.states || result.states.length === 0) {
|
|
177
|
-
return {
|
|
178
|
-
content: [{ type: "text", text: "No evidence maps found." }]
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
const lines = result.states.map(
|
|
182
|
-
(s) => `- **${s.taskId}** (${s.tier}) \u2014 ${s.entries.length} entries \u2014 ${s.updatedAt}`
|
|
183
|
-
);
|
|
184
|
-
return {
|
|
185
|
-
content: [{ type: "text", text: lines.join("\n") }]
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
case "delete": {
|
|
189
|
-
if (!task_id) throw new Error("task_id required for delete");
|
|
190
|
-
const result = evidenceMap({ action: "delete", taskId: task_id }, cwd);
|
|
191
|
-
return {
|
|
192
|
-
content: [
|
|
193
|
-
{
|
|
194
|
-
type: "text",
|
|
195
|
-
text: result.deleted ? `Deleted evidence map "${task_id}".` : `Evidence map "${task_id}" not found.`
|
|
196
|
-
}
|
|
197
|
-
]
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
} catch (err) {
|
|
202
|
-
return {
|
|
203
|
-
content: [
|
|
204
|
-
{
|
|
205
|
-
type: "text",
|
|
206
|
-
text: `Evidence map error: ${err.message}`
|
|
207
|
-
}
|
|
208
|
-
],
|
|
209
|
-
isError: true
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
function registerDigestTool(server, embedder) {
|
|
216
|
-
server.registerTool(
|
|
217
|
-
"digest",
|
|
218
|
-
{
|
|
219
|
-
description: "Compress multiple text sources (handoffs, debates, phase summaries) into a token-budgeted digest. Jointly ranks across all sources, pins structured fields (status, files, decisions, blockers), and allocates budget by priority weight.",
|
|
220
|
-
inputSchema: {
|
|
221
|
-
sources: z.array(
|
|
222
|
-
z.object({
|
|
223
|
-
id: z.string().describe('Source identifier (e.g., "phase-2-handoff")'),
|
|
224
|
-
text: z.string().describe("Source text to compress"),
|
|
225
|
-
weight: z.number().min(0).default(1).describe("Priority weight (higher = more budget)")
|
|
226
|
-
})
|
|
227
|
-
).min(1).describe("Text sources to compress"),
|
|
228
|
-
query: z.string().describe("Focus query \u2014 what matters for the next step?"),
|
|
229
|
-
max_chars: z.number().min(100).max(5e4).default(4e3).describe("Target budget in characters"),
|
|
230
|
-
pin_fields: z.array(z.string()).optional().describe(
|
|
231
|
-
"Key fields to always extract (default: status, files, decisions, blockers, next)"
|
|
232
|
-
),
|
|
233
|
-
segmentation: z.enum(["paragraph", "sentence", "line"]).default("paragraph").describe("How to split text for scoring")
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
async ({ sources, query, max_chars, pin_fields, segmentation }) => {
|
|
237
|
-
try {
|
|
238
|
-
const result = await digest(embedder, {
|
|
239
|
-
sources,
|
|
240
|
-
query,
|
|
241
|
-
maxChars: max_chars,
|
|
242
|
-
pinFields: pin_fields,
|
|
243
|
-
segmentation
|
|
244
|
-
});
|
|
245
|
-
const lines = [
|
|
246
|
-
`## Digest (${result.totalOriginalChars} \u2192 ${result.totalCompressedChars} chars, ${(result.ratio * 100).toFixed(0)}%)`,
|
|
247
|
-
""
|
|
248
|
-
];
|
|
249
|
-
const fieldKeys = Object.keys(result.fields);
|
|
250
|
-
if (fieldKeys.length > 0) {
|
|
251
|
-
lines.push("### Extracted Fields");
|
|
252
|
-
for (const key of fieldKeys) {
|
|
253
|
-
const entries = result.fields[key];
|
|
254
|
-
lines.push(`**${key}:**`);
|
|
255
|
-
for (const e of entries) {
|
|
256
|
-
lines.push(` - [${e.sourceId}] ${e.value}`);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
lines.push("");
|
|
260
|
-
}
|
|
261
|
-
lines.push("### Compressed Content", "", result.text);
|
|
262
|
-
lines.push("", "### Source Stats");
|
|
263
|
-
for (const s of result.sourceStats) {
|
|
264
|
-
lines.push(
|
|
265
|
-
`- **${s.id}**: ${s.originalChars} \u2192 ${s.keptChars} chars (${s.segmentsKept}/${s.segmentsTotal} segments)`
|
|
266
|
-
);
|
|
267
|
-
}
|
|
268
|
-
lines.push(
|
|
269
|
-
"",
|
|
270
|
-
"---",
|
|
271
|
-
"_Next: Use the digest as compressed context for the next phase. Use `stash` to persist it if needed._"
|
|
272
|
-
);
|
|
273
|
-
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
274
|
-
} catch (err) {
|
|
275
|
-
return {
|
|
276
|
-
content: [{ type: "text", text: `Digest failed: ${err.message}` }],
|
|
277
|
-
isError: true
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
function registerForgeClassifyTool(server) {
|
|
284
|
-
server.registerTool(
|
|
285
|
-
"forge_classify",
|
|
286
|
-
{
|
|
287
|
-
description: "Classify FORGE tier (Floor/Standard/Critical) from target files and task description. Checks blast radius, cross-package boundaries, schema/contract patterns, and security signals. Returns tier, triggers, typed unknown seeds, and ceremony guidance.",
|
|
288
|
-
inputSchema: {
|
|
289
|
-
files: z.array(z.string()).min(1).describe("Files being modified (paths)"),
|
|
290
|
-
task: z.string().describe("Task description"),
|
|
291
|
-
root_path: z.string().describe("Root path of the codebase")
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
async ({ files, task, root_path }) => {
|
|
295
|
-
try {
|
|
296
|
-
const result = await forgeClassify({ files, task, rootPath: root_path });
|
|
297
|
-
const lines = [`## FORGE Classification: **${result.tier.toUpperCase()}**`, ""];
|
|
298
|
-
if (result.triggers.length > 0) {
|
|
299
|
-
lines.push("### Triggers");
|
|
300
|
-
for (const t of result.triggers) {
|
|
301
|
-
lines.push(`- **${t.rule}** (${t.source}): ${t.detail}`);
|
|
302
|
-
}
|
|
303
|
-
lines.push("");
|
|
304
|
-
}
|
|
305
|
-
if (result.packagesCrossed.length > 0) {
|
|
306
|
-
lines.push(`**Packages crossed:** ${result.packagesCrossed.join(", ")}`);
|
|
307
|
-
}
|
|
308
|
-
if (result.typedUnknownSeeds.length > 0) {
|
|
309
|
-
lines.push("", "### Typed Unknown Seeds");
|
|
310
|
-
for (const u of result.typedUnknownSeeds) {
|
|
311
|
-
lines.push(`- [${u.type}] ${u.description} \u2192 use \`${u.suggestedTool}\``);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
lines.push("", "### Ceremony");
|
|
315
|
-
const c = result.ceremony;
|
|
316
|
-
lines.push(
|
|
317
|
-
`- **Ground:** ${c.ground}`,
|
|
318
|
-
`- **Build:** ${c.build}`,
|
|
319
|
-
`- **Break:** ${c.break}`,
|
|
320
|
-
`- **Evidence Map:** ${c.evidenceMap}`,
|
|
321
|
-
`- **Gate:** ${c.gate}`
|
|
322
|
-
);
|
|
323
|
-
lines.push(
|
|
324
|
-
"",
|
|
325
|
-
"---",
|
|
326
|
-
`_Next: ${result.tier === "floor" ? "Proceed directly to implementation." : "Run `forge_ground` to execute the full Ground phase."}_`
|
|
327
|
-
);
|
|
328
|
-
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
329
|
-
} catch (err) {
|
|
330
|
-
return {
|
|
331
|
-
content: [
|
|
332
|
-
{
|
|
333
|
-
type: "text",
|
|
334
|
-
text: `FORGE classify failed: ${err.message}`
|
|
335
|
-
}
|
|
336
|
-
],
|
|
337
|
-
isError: true
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
);
|
|
342
|
-
}
|
|
343
|
-
function registerStratumCardTool(server, embedder) {
|
|
344
|
-
server.registerTool(
|
|
345
|
-
"stratum_card",
|
|
346
|
-
{
|
|
347
|
-
description: "Generate STRATUM context cards from files. T1 = structural metadata (~100 tokens/file). T2 = T1 + compressed content (~300 tokens/file). Replaces reading full files \u2014 10-100x token reduction.",
|
|
348
|
-
inputSchema: {
|
|
349
|
-
files: z.array(z.string()).min(1).describe("Absolute file paths to generate cards for"),
|
|
350
|
-
query: z.string().describe("Current task query \u2014 guides relevance scoring"),
|
|
351
|
-
tier: z.enum(["T1", "T2"]).default("T1").describe("Card tier: T1 = structural only, T2 = T1 + compressed content"),
|
|
352
|
-
max_content_chars: z.number().min(100).max(5e3).default(800).describe("For T2: max chars for compressed content section")
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
async ({ files, query, tier, max_content_chars }) => {
|
|
356
|
-
try {
|
|
357
|
-
const result = await stratumCard(embedder, {
|
|
358
|
-
files,
|
|
359
|
-
query,
|
|
360
|
-
tier,
|
|
361
|
-
maxContentChars: max_content_chars
|
|
362
|
-
});
|
|
363
|
-
const lines = [
|
|
364
|
-
`## STRATUM Cards (${tier}) \u2014 ${result.cards.length} files`,
|
|
365
|
-
`Total: ~${result.totalTokenEstimate} tokens (was ~${result.totalOriginalTokenEstimate}, ${(result.compressionRatio * 100).toFixed(0)}% of original)`,
|
|
366
|
-
""
|
|
367
|
-
];
|
|
368
|
-
for (const card of result.cards) {
|
|
369
|
-
lines.push(card.card, "");
|
|
370
|
-
}
|
|
371
|
-
lines.push(
|
|
372
|
-
"---",
|
|
373
|
-
`_Next: Use these cards as context instead of reading full files. Use \`compact\` for deeper content extraction on specific files._`
|
|
374
|
-
);
|
|
375
|
-
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
376
|
-
} catch (err) {
|
|
377
|
-
return {
|
|
378
|
-
content: [
|
|
379
|
-
{
|
|
380
|
-
type: "text",
|
|
381
|
-
text: `STRATUM cards failed: ${err.message}`
|
|
382
|
-
}
|
|
383
|
-
],
|
|
384
|
-
isError: true
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
);
|
|
389
|
-
}
|
|
390
|
-
function registerForgeGroundTool(server, embedder, store) {
|
|
391
|
-
server.registerTool(
|
|
392
|
-
"forge_ground",
|
|
393
|
-
{
|
|
394
|
-
description: "Execute the complete FORGE Ground phase in a single call. Chains: tier classification \u2192 scope map \u2192 typed unknown seeds \u2192 constraint loading \u2192 file summaries \u2192 evidence map creation. Replaces 5-15 manual tool calls.",
|
|
395
|
-
inputSchema: {
|
|
396
|
-
task: z.string().describe("Task description"),
|
|
397
|
-
files: z.array(z.string()).min(1).describe("Target files being modified (absolute paths)"),
|
|
398
|
-
root_path: z.string().describe("Root path of the codebase"),
|
|
399
|
-
max_constraints: z.number().min(0).max(10).default(3).describe("Max constraint entries to load from KB"),
|
|
400
|
-
force_tier: z.enum(["floor", "standard", "critical"]).optional().describe("Force a specific tier (skips auto-classification)"),
|
|
401
|
-
task_id: z.string().optional().describe("Custom task ID for evidence map (auto-generated if omitted)")
|
|
402
|
-
}
|
|
403
|
-
},
|
|
404
|
-
async ({ task, files, root_path, max_constraints, force_tier, task_id }) => {
|
|
405
|
-
try {
|
|
406
|
-
const result = await forgeGround(embedder, store, {
|
|
407
|
-
task,
|
|
408
|
-
files,
|
|
409
|
-
rootPath: root_path,
|
|
410
|
-
maxConstraints: max_constraints,
|
|
411
|
-
forceTier: force_tier,
|
|
412
|
-
taskId: task_id
|
|
413
|
-
});
|
|
414
|
-
const lines = [
|
|
415
|
-
`## FORGE Ground: **${result.tier.toUpperCase()}**`,
|
|
416
|
-
`Estimated output: ~${result.estimatedTokens} tokens`,
|
|
417
|
-
""
|
|
418
|
-
];
|
|
419
|
-
if (result.classifyTriggers.length > 0) {
|
|
420
|
-
lines.push("### Classification Triggers");
|
|
421
|
-
for (const t of result.classifyTriggers) {
|
|
422
|
-
lines.push(`- **${t.rule}** (${t.source}): ${t.detail}`);
|
|
423
|
-
}
|
|
424
|
-
lines.push("");
|
|
425
|
-
}
|
|
426
|
-
if (result.fileSummaries.length > 0) {
|
|
427
|
-
lines.push("### Target Files");
|
|
428
|
-
for (const f of result.fileSummaries) {
|
|
429
|
-
lines.push(
|
|
430
|
-
`- **${f.path}** (${f.lines} lines) \u2014 exports: ${f.exports.join(", ") || "none"} \u2014 functions: ${f.functions.join(", ") || "none"}`
|
|
431
|
-
);
|
|
432
|
-
}
|
|
433
|
-
lines.push("");
|
|
434
|
-
}
|
|
435
|
-
if (result.typedUnknownSeeds.length > 0) {
|
|
436
|
-
lines.push("### Typed Unknown Seeds");
|
|
437
|
-
for (const u of result.typedUnknownSeeds) {
|
|
438
|
-
lines.push(`- [${u.type}] ${u.description} \u2192 \`${u.suggestedTool}\``);
|
|
439
|
-
}
|
|
440
|
-
lines.push("");
|
|
441
|
-
}
|
|
442
|
-
if (result.constraints.length > 0) {
|
|
443
|
-
lines.push("### Constraint Seed");
|
|
444
|
-
for (const c2 of result.constraints) {
|
|
445
|
-
lines.push(`- **${c2.source}** (${(c2.relevance * 100).toFixed(0)}%): ${c2.snippet}`);
|
|
446
|
-
}
|
|
447
|
-
lines.push("");
|
|
448
|
-
}
|
|
449
|
-
if (result.scopeMap) {
|
|
450
|
-
lines.push(
|
|
451
|
-
`### Scope Map: ${result.scopeMap.files.length} files (~${result.scopeMap.totalEstimatedTokens} tokens)`
|
|
452
|
-
);
|
|
453
|
-
for (const f of result.scopeMap.files.slice(0, 5)) {
|
|
454
|
-
lines.push(`- ${f.path} (${(f.relevance * 100).toFixed(0)}%) \u2014 ${f.reason}`);
|
|
455
|
-
}
|
|
456
|
-
if (result.scopeMap.files.length > 5) {
|
|
457
|
-
lines.push(`- _...and ${result.scopeMap.files.length - 5} more_`);
|
|
458
|
-
}
|
|
459
|
-
lines.push("");
|
|
460
|
-
}
|
|
461
|
-
if (result.evidenceMapTaskId) {
|
|
462
|
-
lines.push(`**Evidence Map:** \`${result.evidenceMapTaskId}\` (initialized)`);
|
|
463
|
-
lines.push("");
|
|
464
|
-
}
|
|
465
|
-
lines.push("### Ceremony Guidance");
|
|
466
|
-
const c = result.ceremony;
|
|
467
|
-
lines.push(
|
|
468
|
-
`- **Ground:** ${c.ground}`,
|
|
469
|
-
`- **Build:** ${c.build}`,
|
|
470
|
-
`- **Break:** ${c.break}`,
|
|
471
|
-
`- **Evidence Map:** ${c.evidenceMap}`,
|
|
472
|
-
`- **Gate:** ${c.gate}`
|
|
473
|
-
);
|
|
474
|
-
lines.push(
|
|
475
|
-
"",
|
|
476
|
-
"---",
|
|
477
|
-
`_Next: ${result.tier === "floor" ? "Proceed to Build phase." : "Use `evidence_map` to track claims during Build, then `evidence_map` gate after Break."}_`
|
|
478
|
-
);
|
|
479
|
-
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
480
|
-
} catch (err) {
|
|
481
|
-
return {
|
|
482
|
-
content: [
|
|
483
|
-
{
|
|
484
|
-
type: "text",
|
|
485
|
-
text: `FORGE Ground failed: ${err.message}`
|
|
486
|
-
}
|
|
487
|
-
],
|
|
488
|
-
isError: true
|
|
489
|
-
};
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
);
|
|
493
|
-
}
|
|
494
|
-
export {
|
|
495
|
-
registerDigestTool,
|
|
496
|
-
registerEvidenceMapTool,
|
|
497
|
-
registerForgeClassifyTool,
|
|
498
|
-
registerForgeGroundTool,
|
|
499
|
-
registerStratumCardTool
|
|
500
|
-
};
|
|
501
|
-
//# sourceMappingURL=forge.tools.js.map
|
|
4
|
+
_Next: Use \`evidence_map\` with action "add" to record critical-path claims._`}]}}case"add":{if(!s)throw new Error("task_id required for add");if(!c)throw new Error("claim required for add");if(!i)throw new Error("status required for add");const e=g({action:"add",taskId:s,claim:c,status:i,receipt:d??"",criticalPath:p,unknownType:n},u),a=[`Added entry #${e.entry?.id} to "${s}": [${i}] ${c}`];return e.formattedMap&&a.push("",e.formattedMap),{content:[{type:"text",text:a.join(`
|
|
5
|
+
`)}]}}case"update":{if(!s)throw new Error("task_id required for update");if(o===void 0)throw new Error("id required for update");if(!i)throw new Error("status required for update");const e=g({action:"update",taskId:s,id:o,status:i,receipt:d??""},u),a=[`Updated entry #${o} in "${s}" \u2192 ${i}`];return e.formattedMap&&a.push("",e.formattedMap),{content:[{type:"text",text:a.join(`
|
|
6
|
+
`)}]}}case"get":{if(!s)throw new Error("task_id required for get");const e=g({action:"get",taskId:s},u);return e.state?{content:[{type:"text",text:[`## Evidence Map: ${s} (${e.state.tier})`,"",e.formattedMap??"No entries.","",`_${e.state.entries.length} entries \u2014 created ${e.state.createdAt}_`].join(`
|
|
7
|
+
`)}]}:{content:[{type:"text",text:`Evidence map "${s}" not found.`}]}}case"gate":{if(!s)throw new Error("task_id required for gate");const e=g({action:"gate",taskId:s,retryCount:r},u);if(!e.gate)return{content:[{type:"text",text:`Evidence map "${s}" not found.`}]};const a=e.gate,f=[`## FORGE Gate: **${a.decision}**`,"",`**Reason:** ${a.reason}`,"",`**Stats:** ${a.stats.verified}V / ${a.stats.assumed}A / ${a.stats.unresolved}U (${a.stats.total} total)`];return a.warnings.length>0&&f.push("","**Warnings:**",...a.warnings.map($=>`- \u26A0\uFE0F ${$}`)),a.unresolvedCritical.length>0&&f.push("","**Blocking entries:**",...a.unresolvedCritical.map($=>`- #${$.id}: ${$.claim} [${$.unknownType??"untyped"}]`)),a.annotation&&f.push("","**Annotation:**",a.annotation),e.formattedMap&&f.push("","---","",e.formattedMap),f.push("","---",`_Next: ${a.decision==="YIELD"?"Proceed to implementation.":a.decision==="HOLD"?"Resolve blocking entries, then re-run gate.":a.decision==="HARD_BLOCK"?"Contract unknowns MUST be resolved. Use search or schema_validate.":"Proceed with annotation \u2014 document unresolved items in delivery."}_`),{content:[{type:"text",text:f.join(`
|
|
8
|
+
`)}]}}case"list":{const e=g({action:"list"},u);return!e.states||e.states.length===0?{content:[{type:"text",text:"No evidence maps found."}]}:{content:[{type:"text",text:e.states.map(f=>`- **${f.taskId}** (${f.tier}) \u2014 ${f.entries.length} entries \u2014 ${f.updatedAt}`).join(`
|
|
9
|
+
`)}]}}case"delete":{if(!s)throw new Error("task_id required for delete");return{content:[{type:"text",text:g({action:"delete",taskId:s},u).deleted?`Deleted evidence map "${s}".`:`Evidence map "${s}" not found.`}]}}}}catch(e){return{content:[{type:"text",text:`Evidence map error: ${e.message}`}],isError:!0}}})}function w(m,h){m.registerTool("digest",{description:"Compress multiple text sources (handoffs, debates, phase summaries) into a token-budgeted digest. Jointly ranks across all sources, pins structured fields (status, files, decisions, blockers), and allocates budget by priority weight.",inputSchema:{sources:t.array(t.object({id:t.string().describe('Source identifier (e.g., "phase-2-handoff")'),text:t.string().describe("Source text to compress"),weight:t.number().min(0).default(1).describe("Priority weight (higher = more budget)")})).min(1).describe("Text sources to compress"),query:t.string().describe("Focus query \u2014 what matters for the next step?"),max_chars:t.number().min(100).max(5e4).default(4e3).describe("Target budget in characters"),pin_fields:t.array(t.string()).optional().describe("Key fields to always extract (default: status, files, decisions, blockers, next)"),segmentation:t.enum(["paragraph","sentence","line"]).default("paragraph").describe("How to split text for scoring")}},async({sources:s,query:l,max_chars:c,pin_fields:i,segmentation:d})=>{try{const o=await x(h,{sources:s,query:l,maxChars:c,pinFields:i,segmentation:d}),p=[`## Digest (${o.totalOriginalChars} \u2192 ${o.totalCompressedChars} chars, ${(o.ratio*100).toFixed(0)}%)`,""],n=Object.keys(o.fields);if(n.length>0){p.push("### Extracted Fields");for(const r of n){const u=o.fields[r];p.push(`**${r}:**`);for(const e of u)p.push(` - [${e.sourceId}] ${e.value}`)}p.push("")}p.push("### Compressed Content","",o.text),p.push("","### Source Stats");for(const r of o.sourceStats)p.push(`- **${r.id}**: ${r.originalChars} \u2192 ${r.keptChars} chars (${r.segmentsKept}/${r.segmentsTotal} segments)`);return p.push("","---","_Next: Use the digest as compressed context for the next phase. Use `stash` to persist it if needed._"),{content:[{type:"text",text:p.join(`
|
|
10
|
+
`)}]}}catch(o){return{content:[{type:"text",text:`Digest failed: ${o.message}`}],isError:!0}}})}function C(m){m.registerTool("forge_classify",{description:"Classify FORGE tier (Floor/Standard/Critical) from target files and task description. Checks blast radius, cross-package boundaries, schema/contract patterns, and security signals. Returns tier, triggers, typed unknown seeds, and ceremony guidance.",inputSchema:{files:t.array(t.string()).min(1).describe("Files being modified (paths)"),task:t.string().describe("Task description"),root_path:t.string().describe("Root path of the codebase")}},async({files:h,task:s,root_path:l})=>{try{const c=await y({files:h,task:s,rootPath:l}),i=[`## FORGE Classification: **${c.tier.toUpperCase()}**`,""];if(c.triggers.length>0){i.push("### Triggers");for(const o of c.triggers)i.push(`- **${o.rule}** (${o.source}): ${o.detail}`);i.push("")}if(c.packagesCrossed.length>0&&i.push(`**Packages crossed:** ${c.packagesCrossed.join(", ")}`),c.typedUnknownSeeds.length>0){i.push("","### Typed Unknown Seeds");for(const o of c.typedUnknownSeeds)i.push(`- [${o.type}] ${o.description} \u2192 use \`${o.suggestedTool}\``)}i.push("","### Ceremony");const d=c.ceremony;return i.push(`- **Ground:** ${d.ground}`,`- **Build:** ${d.build}`,`- **Break:** ${d.break}`,`- **Evidence Map:** ${d.evidenceMap}`,`- **Gate:** ${d.gate}`),i.push("","---",`_Next: ${c.tier==="floor"?"Proceed directly to implementation.":"Run `forge_ground` to execute the full Ground phase."}_`),{content:[{type:"text",text:i.join(`
|
|
11
|
+
`)}]}}catch(c){return{content:[{type:"text",text:`FORGE classify failed: ${c.message}`}],isError:!0}}})}function M(m,h){m.registerTool("stratum_card",{description:"Generate STRATUM context cards from files. T1 = structural metadata (~100 tokens/file). T2 = T1 + compressed content (~300 tokens/file). Replaces reading full files \u2014 10-100x token reduction.",inputSchema:{files:t.array(t.string()).min(1).describe("Absolute file paths to generate cards for"),query:t.string().describe("Current task query \u2014 guides relevance scoring"),tier:t.enum(["T1","T2"]).default("T1").describe("Card tier: T1 = structural only, T2 = T1 + compressed content"),max_content_chars:t.number().min(100).max(5e3).default(800).describe("For T2: max chars for compressed content section")}},async({files:s,query:l,tier:c,max_content_chars:i})=>{try{const d=await v(h,{files:s,query:l,tier:c,maxContentChars:i}),o=[`## STRATUM Cards (${c}) \u2014 ${d.cards.length} files`,`Total: ~${d.totalTokenEstimate} tokens (was ~${d.totalOriginalTokenEstimate}, ${(d.compressionRatio*100).toFixed(0)}% of original)`,""];for(const p of d.cards)o.push(p.card,"");return o.push("---","_Next: Use these cards as context instead of reading full files. Use `compact` for deeper content extraction on specific files._"),{content:[{type:"text",text:o.join(`
|
|
12
|
+
`)}]}}catch(d){return{content:[{type:"text",text:`STRATUM cards failed: ${d.message}`}],isError:!0}}})}function S(m,h,s){m.registerTool("forge_ground",{description:"Execute the complete FORGE Ground phase in a single call. Chains: tier classification \u2192 scope map \u2192 typed unknown seeds \u2192 constraint loading \u2192 file summaries \u2192 evidence map creation. Replaces 5-15 manual tool calls.",inputSchema:{task:t.string().describe("Task description"),files:t.array(t.string()).min(1).describe("Target files being modified (absolute paths)"),root_path:t.string().describe("Root path of the codebase"),max_constraints:t.number().min(0).max(10).default(3).describe("Max constraint entries to load from KB"),force_tier:t.enum(["floor","standard","critical"]).optional().describe("Force a specific tier (skips auto-classification)"),task_id:t.string().optional().describe("Custom task ID for evidence map (auto-generated if omitted)")}},async({task:l,files:c,root_path:i,max_constraints:d,force_tier:o,task_id:p})=>{try{const n=await b(h,s,{task:l,files:c,rootPath:i,maxConstraints:d,forceTier:o,taskId:p}),r=[`## FORGE Ground: **${n.tier.toUpperCase()}**`,`Estimated output: ~${n.estimatedTokens} tokens`,""];if(n.classifyTriggers.length>0){r.push("### Classification Triggers");for(const e of n.classifyTriggers)r.push(`- **${e.rule}** (${e.source}): ${e.detail}`);r.push("")}if(n.fileSummaries.length>0){r.push("### Target Files");for(const e of n.fileSummaries)r.push(`- **${e.path}** (${e.lines} lines) \u2014 exports: ${e.exports.join(", ")||"none"} \u2014 functions: ${e.functions.join(", ")||"none"}`);r.push("")}if(n.typedUnknownSeeds.length>0){r.push("### Typed Unknown Seeds");for(const e of n.typedUnknownSeeds)r.push(`- [${e.type}] ${e.description} \u2192 \`${e.suggestedTool}\``);r.push("")}if(n.constraints.length>0){r.push("### Constraint Seed");for(const e of n.constraints)r.push(`- **${e.source}** (${(e.relevance*100).toFixed(0)}%): ${e.snippet}`);r.push("")}if(n.scopeMap){r.push(`### Scope Map: ${n.scopeMap.files.length} files (~${n.scopeMap.totalEstimatedTokens} tokens)`);for(const e of n.scopeMap.files.slice(0,5))r.push(`- ${e.path} (${(e.relevance*100).toFixed(0)}%) \u2014 ${e.reason}`);n.scopeMap.files.length>5&&r.push(`- _...and ${n.scopeMap.files.length-5} more_`),r.push("")}n.evidenceMapTaskId&&(r.push(`**Evidence Map:** \`${n.evidenceMapTaskId}\` (initialized)`),r.push("")),r.push("### Ceremony Guidance");const u=n.ceremony;return r.push(`- **Ground:** ${u.ground}`,`- **Build:** ${u.build}`,`- **Break:** ${u.break}`,`- **Evidence Map:** ${u.evidenceMap}`,`- **Gate:** ${u.gate}`),r.push("","---",`_Next: ${n.tier==="floor"?"Proceed to Build phase.":"Use `evidence_map` to track claims during Build, then `evidence_map` gate after Break."}_`),{content:[{type:"text",text:r.join(`
|
|
13
|
+
`)}]}}catch(n){return{content:[{type:"text",text:`FORGE Ground failed: ${n.message}`}],isError:!0}}})}export{w as registerDigestTool,T as registerEvidenceMapTool,C as registerForgeClassifyTool,S as registerForgeGroundTool,M as registerStratumCardTool};
|
|
@@ -1,43 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
function registerForgetTool(server, curated) {
|
|
3
|
-
server.registerTool(
|
|
4
|
-
"forget",
|
|
5
|
-
{
|
|
6
|
-
description: "Remove a curated knowledge entry. Deletes the file and removes it from the vector store.",
|
|
7
|
-
inputSchema: {
|
|
8
|
-
path: z.string().describe('Relative path within curated/ (e.g., "decisions/deprecated-approach.md")'),
|
|
9
|
-
reason: z.string().min(3).describe("Why this entry is being removed")
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
async ({ path, reason }) => {
|
|
13
|
-
try {
|
|
14
|
-
const result = await curated.forget(path, reason);
|
|
15
|
-
console.error(`[KB] Forgot: ${result.path} \u2014 reason: ${reason}`);
|
|
16
|
-
return {
|
|
17
|
-
content: [
|
|
18
|
-
{
|
|
19
|
-
type: "text",
|
|
20
|
-
text: `Forgotten: \`curated/${result.path}\`
|
|
1
|
+
import{z as t}from"zod";function i(o,n){o.registerTool("forget",{description:"Remove a curated knowledge entry. Deletes the file and removes it from the vector store.",inputSchema:{path:t.string().describe('Relative path within curated/ (e.g., "decisions/deprecated-approach.md")'),reason:t.string().min(3).describe("Why this entry is being removed")}},async({path:s,reason:r})=>{try{const e=await n.forget(s,r);return console.error(`[KB] Forgot: ${e.path} \u2014 reason: ${r}`),{content:[{type:"text",text:`Forgotten: \`curated/${e.path}\`
|
|
21
2
|
|
|
22
3
|
Removed from disk and vector store.
|
|
23
|
-
Reason: ${
|
|
4
|
+
Reason: ${r}
|
|
24
5
|
|
|
25
6
|
---
|
|
26
|
-
_Next: Use \`list\` to verify removal, or \`search\` to confirm the entry is no longer returned._`
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
};
|
|
30
|
-
} catch (err) {
|
|
31
|
-
console.error("[KB] Forget failed:", err);
|
|
32
|
-
return {
|
|
33
|
-
content: [{ type: "text", text: `Forget failed: ${err.message}` }],
|
|
34
|
-
isError: true
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
export {
|
|
41
|
-
registerForgetTool
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=forget.tool.js.map
|
|
7
|
+
_Next: Use \`list\` to verify removal, or \`search\` to confirm the entry is no longer returned._`}]}}catch(e){return console.error("[KB] Forget failed:",e),{content:[{type:"text",text:`Forget failed: ${e.message}`}],isError:!0}}})}export{i as registerForgetTool};
|