@dimassetoid/septum-mcp 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +142 -2
- package/bin/septum.ts +4 -0
- package/package.json +70 -4
- package/scripts/postinstall.ts +25 -0
- package/src/cli/commands/check.ts +133 -0
- package/src/cli/commands/hook.ts +205 -0
- package/src/cli/commands/init.ts +570 -0
- package/src/cli/commands/serve.ts +5 -0
- package/src/cli/commands/sync.ts +39 -0
- package/src/cli/hook-payload.ts +43 -0
- package/src/cli/index.ts +124 -0
- package/src/cli/scaffold/harness-config.ts +661 -0
- package/src/cli/templates/hooks.ts +110 -0
- package/src/cli/templates/rules.ts +35 -0
- package/src/cli/templates/skill.ts +55 -0
- package/src/cli/ui/prompts.ts +122 -0
- package/src/core/boundary/evaluator.ts +426 -0
- package/src/core/boundary/staged-auditor.ts +120 -0
- package/src/core/config/domain-ownership.ts +45 -0
- package/src/core/config/loader.ts +174 -0
- package/src/core/config/schema.ts +59 -0
- package/src/core/database/client.ts +60 -0
- package/src/core/database/repositories/dependency.repository.ts +733 -0
- package/src/core/database/repositories/domain.repository.ts +373 -0
- package/src/core/database/repositories/file.repository.ts +117 -0
- package/src/core/database/repositories/meta.repository.ts +33 -0
- package/src/core/database/repositories/symbol.repository.ts +647 -0
- package/src/core/database/repository.ts +358 -0
- package/src/core/database/schema.ts +123 -0
- package/src/core/discovery/navigation.ts +105 -0
- package/src/core/discovery/topology-detector.ts +863 -0
- package/src/core/ingestion/hasher.ts +5 -0
- package/src/core/ingestion/pipeline.ts +590 -0
- package/src/core/parser/behavioral-analyzer.ts +123 -0
- package/src/core/parser/boundary-tracker.ts +458 -0
- package/src/core/parser/extractors/base.ts +71 -0
- package/src/core/parser/extractors/blade.ts +159 -0
- package/src/core/parser/extractors/csharp.ts +248 -0
- package/src/core/parser/extractors/django-semantic.ts +655 -0
- package/src/core/parser/extractors/elysia-semantic.ts +517 -0
- package/src/core/parser/extractors/express-semantic.ts +429 -0
- package/src/core/parser/extractors/fastapi-semantic.ts +702 -0
- package/src/core/parser/extractors/fastify-semantic.ts +759 -0
- package/src/core/parser/extractors/flask-semantic.ts +482 -0
- package/src/core/parser/extractors/frontend.ts +149 -0
- package/src/core/parser/extractors/go-semantic.ts +670 -0
- package/src/core/parser/extractors/go.ts +491 -0
- package/src/core/parser/extractors/hono-semantic.ts +546 -0
- package/src/core/parser/extractors/java.ts +227 -0
- package/src/core/parser/extractors/laravel-semantic.ts +1150 -0
- package/src/core/parser/extractors/mcp-cli-semantic.ts +367 -0
- package/src/core/parser/extractors/nestjs-semantic.ts +527 -0
- package/src/core/parser/extractors/php.ts +585 -0
- package/src/core/parser/extractors/python.ts +503 -0
- package/src/core/parser/extractors/registry.ts +99 -0
- package/src/core/parser/extractors/ruby.ts +237 -0
- package/src/core/parser/extractors/rust.ts +304 -0
- package/src/core/parser/extractors/semantic-extractor.interface.ts +24 -0
- package/src/core/parser/extractors/symfony-semantic.ts +321 -0
- package/src/core/parser/extractors/typescript.ts +839 -0
- package/src/core/parser/implementation-fingerprint.ts +97 -0
- package/src/core/parser/language-capabilities.ts +87 -0
- package/src/core/parser/schema/providers/laravel-migration-provider.ts +239 -0
- package/src/core/parser/schema/schema-provider-registry.ts +41 -0
- package/src/core/parser/schema/schema-provider.interface.ts +34 -0
- package/src/core/parser/semantic-revision.ts +3 -0
- package/src/core/parser/static-string.ts +51 -0
- package/src/core/parser/tree-sitter.ts +63 -0
- package/src/core/parser/wasm-assets.ts +25 -0
- package/src/core/parser/wasm-loader.ts +274 -0
- package/src/core/resolver/call-graph-tracer.ts +1033 -0
- package/src/core/resolver/import-resolver.ts +365 -0
- package/src/core/resolver/interpretation-inputs.ts +7 -0
- package/src/core/resolver/languages/go.ts +103 -0
- package/src/core/resolver/languages/managed.ts +200 -0
- package/src/core/resolver/languages/python.ts +115 -0
- package/src/core/resolver/languages/ruby.ts +40 -0
- package/src/core/resolver/languages/rust.ts +127 -0
- package/src/core/resolver/languages/shared.ts +71 -0
- package/src/core/resolver/module-resolver.ts +486 -0
- package/src/core/resolver/path-resolver.ts +200 -0
- package/src/core/resolver/slice-catalog.ts +79 -0
- package/src/core/resolver/slice-format.ts +9 -0
- package/src/core/resolver/symbol-impact.ts +381 -0
- package/src/core/resolver/symbol-locator.ts +276 -0
- package/src/core/resolver/symbol-reference.ts +53 -0
- package/src/core/resolver/vertical-slice-tracer.ts +344 -0
- package/src/core/resources/ignore.ts +144 -0
- package/src/core/resources/limits.ts +14 -0
- package/src/core/resources/source-files.ts +185 -0
- package/src/core/resources/source-inventory.ts +55 -0
- package/src/core/resources/work-queue.ts +74 -0
- package/src/core/retrieval/context-page.ts +109 -0
- package/src/core/retrieval/context.ts +320 -0
- package/src/core/retrieval/resolution-warnings.ts +21 -0
- package/src/core/retrieval/symbol-evidence.ts +97 -0
- package/src/core/retrieval/typescript-references.ts +262 -0
- package/src/core/telemetry/telemetry.ts +142 -0
- package/src/index.ts +18 -0
- package/src/mcp/schemas.ts +746 -0
- package/src/mcp/server.ts +600 -0
- package/src/mcp/tools/boundary.ts +17 -0
- package/src/mcp/tools/check-boundary.ts +382 -0
- package/src/mcp/tools/get-domain-catalog.ts +39 -0
- package/src/mcp/tools/get-symbol-impact.ts +104 -0
- package/src/mcp/tools/get-symbol.ts +399 -0
- package/src/mcp/tools/locate-symbol.ts +236 -0
- package/src/mcp/tools/map.ts +26 -0
- package/src/mcp/tools/register-domain.ts +113 -0
- package/src/mcp/tools/slice.ts +16 -0
- package/src/mcp/tools/symbol.ts +95 -0
- package/src/mcp/tools/trace-vertical-slice.ts +106 -0
- package/src/mcp/workspace-manager.ts +170 -0
- package/src/mcp/workspace-watcher.ts +202 -0
- package/src/types/index.ts +438 -0
- package/src/types/wasm.d.ts +4 -0
- package/src/utils/version-check.ts +209 -0
- package/src/version.ts +1 -0
|
@@ -0,0 +1,746 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
function withAliases(raw: unknown, aliases: Record<string, string>): unknown {
|
|
4
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return raw;
|
|
5
|
+
const obj = { ...(raw as Record<string, unknown>) };
|
|
6
|
+
for (const [alias, target] of Object.entries(aliases)) {
|
|
7
|
+
if (obj[alias] !== undefined && obj[target] === undefined) {
|
|
8
|
+
obj[target] = obj[alias];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return obj;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function extractSingleStringFallback(
|
|
15
|
+
raw: unknown,
|
|
16
|
+
targetField: string,
|
|
17
|
+
ignoredKeys: string[] = ["workspace_path", "workspacePath", "workspace", "project_root", "projectRoot"]
|
|
18
|
+
): unknown {
|
|
19
|
+
if (typeof raw === "string") {
|
|
20
|
+
return { [targetField]: raw };
|
|
21
|
+
}
|
|
22
|
+
if (Array.isArray(raw) && raw.length === 1 && typeof raw[0] === "string") {
|
|
23
|
+
return { [targetField]: raw[0] };
|
|
24
|
+
}
|
|
25
|
+
if (typeof raw === "object" && raw !== null && !Array.isArray(raw)) {
|
|
26
|
+
const obj = { ...(raw as Record<string, unknown>) };
|
|
27
|
+
if (obj[targetField] !== undefined && typeof obj[targetField] === "string" && (obj[targetField] as string).trim() !== "") {
|
|
28
|
+
return obj;
|
|
29
|
+
}
|
|
30
|
+
const nonIgnoredEntries = Object.entries(obj).filter(
|
|
31
|
+
([key, val]) => !ignoredKeys.includes(key) && typeof val === "string" && (val as string).trim() !== ""
|
|
32
|
+
);
|
|
33
|
+
if (nonIgnoredEntries.length === 1) {
|
|
34
|
+
obj[targetField] = nonIgnoredEntries[0][1];
|
|
35
|
+
}
|
|
36
|
+
return obj;
|
|
37
|
+
}
|
|
38
|
+
return raw;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function normalizeBoundaryArgs(raw: unknown): unknown {
|
|
42
|
+
if (Array.isArray(raw) && raw.length > 1 && raw.every((item) => typeof item === "string")) {
|
|
43
|
+
raw = { file_paths: raw };
|
|
44
|
+
}
|
|
45
|
+
const coerced = extractSingleStringFallback(raw, "file_path", [
|
|
46
|
+
"action",
|
|
47
|
+
"plan_ref",
|
|
48
|
+
"workspace_path",
|
|
49
|
+
"workspacePath",
|
|
50
|
+
"workspace",
|
|
51
|
+
"project_root",
|
|
52
|
+
"projectRoot",
|
|
53
|
+
"scope",
|
|
54
|
+
"domain",
|
|
55
|
+
"domain_name",
|
|
56
|
+
"domainName",
|
|
57
|
+
"feature_key",
|
|
58
|
+
"featureKey",
|
|
59
|
+
"feature",
|
|
60
|
+
"feature_name",
|
|
61
|
+
"featureName",
|
|
62
|
+
"name",
|
|
63
|
+
"key",
|
|
64
|
+
]);
|
|
65
|
+
if (typeof coerced !== "object" || coerced === null || Array.isArray(coerced)) return coerced;
|
|
66
|
+
const obj = { ...(coerced as Record<string, unknown>) };
|
|
67
|
+
const aliases: Record<string, string> = {
|
|
68
|
+
filePath: "file_path",
|
|
69
|
+
file: "file_path",
|
|
70
|
+
path: "file_path",
|
|
71
|
+
from_file: "file_path",
|
|
72
|
+
fromFile: "file_path",
|
|
73
|
+
source_file: "file_path",
|
|
74
|
+
sourceFile: "file_path",
|
|
75
|
+
filePaths: "file_paths",
|
|
76
|
+
files: "file_paths",
|
|
77
|
+
paths: "file_paths",
|
|
78
|
+
proposedImports: "proposed_imports",
|
|
79
|
+
imports: "proposed_imports",
|
|
80
|
+
featureKey: "feature_key",
|
|
81
|
+
feature: "feature_key",
|
|
82
|
+
feature_name: "feature_key",
|
|
83
|
+
featureName: "feature_key",
|
|
84
|
+
name: "feature_key",
|
|
85
|
+
key: "feature_key",
|
|
86
|
+
domain_name: "domain",
|
|
87
|
+
domainName: "domain",
|
|
88
|
+
workspace: "workspace_path",
|
|
89
|
+
workspacePath: "workspace_path",
|
|
90
|
+
project_root: "workspace_path",
|
|
91
|
+
projectRoot: "workspace_path",
|
|
92
|
+
};
|
|
93
|
+
obj.proposed_imports_supplied ??= ["proposed_imports", "proposedImports", "imports", "to_file", "toFile"].some(key => Object.prototype.hasOwnProperty.call(obj, key));
|
|
94
|
+
for (const [alias, target] of Object.entries(aliases)) {
|
|
95
|
+
if (obj[alias] !== undefined && obj[target] === undefined) {
|
|
96
|
+
obj[target] = obj[alias];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (obj.feature_key !== undefined && obj.feature === undefined) {
|
|
101
|
+
obj.feature = obj.feature_key;
|
|
102
|
+
} else if (obj.feature !== undefined && obj.feature_key === undefined) {
|
|
103
|
+
obj.feature_key = obj.feature;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (obj.to_file || obj.toFile) {
|
|
107
|
+
const rawTo = obj.to_file ?? obj.toFile;
|
|
108
|
+
const toFiles = Array.isArray(rawTo) ? rawTo.map(String) : [String(rawTo)];
|
|
109
|
+
if (!obj.proposed_imports) {
|
|
110
|
+
obj.proposed_imports = toFiles;
|
|
111
|
+
} else if (Array.isArray(obj.proposed_imports)) {
|
|
112
|
+
obj.proposed_imports = [...obj.proposed_imports, ...toFiles];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (Array.isArray(obj.file_path) && !obj.file_paths) {
|
|
116
|
+
obj.file_paths = obj.file_path;
|
|
117
|
+
delete obj.file_path;
|
|
118
|
+
}
|
|
119
|
+
if (typeof obj.file_paths === "string" && !obj.file_path) {
|
|
120
|
+
obj.file_path = obj.file_paths;
|
|
121
|
+
delete obj.file_paths;
|
|
122
|
+
}
|
|
123
|
+
if (obj.scope === undefined) {
|
|
124
|
+
if (obj.staged === true) {
|
|
125
|
+
obj.scope = "staged";
|
|
126
|
+
} else if (obj.domain !== undefined && obj.file_path === undefined && obj.file_paths === undefined) {
|
|
127
|
+
obj.scope = "domain";
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return obj;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function normalizeDomainCatalogArgs(raw: unknown): unknown {
|
|
134
|
+
const coerced = extractSingleStringFallback(raw, "domain", [
|
|
135
|
+
"workspace_path",
|
|
136
|
+
"workspacePath",
|
|
137
|
+
"workspace",
|
|
138
|
+
"project_root",
|
|
139
|
+
"projectRoot",
|
|
140
|
+
"target_path",
|
|
141
|
+
"path",
|
|
142
|
+
"archetype_filter",
|
|
143
|
+
"archetype",
|
|
144
|
+
"archetypeFilter",
|
|
145
|
+
"type",
|
|
146
|
+
"detail_level",
|
|
147
|
+
"detailLevel",
|
|
148
|
+
"mode",
|
|
149
|
+
"format",
|
|
150
|
+
"file_filter",
|
|
151
|
+
"fileFilter",
|
|
152
|
+
"file",
|
|
153
|
+
"filter",
|
|
154
|
+
]);
|
|
155
|
+
if (typeof coerced !== "object" || coerced === null || Array.isArray(coerced)) return coerced;
|
|
156
|
+
const obj = withAliases(coerced, {
|
|
157
|
+
domain_name: "domain",
|
|
158
|
+
domainName: "domain",
|
|
159
|
+
name: "domain",
|
|
160
|
+
archetype: "archetype_filter",
|
|
161
|
+
archetypeFilter: "archetype_filter",
|
|
162
|
+
type: "archetype_filter",
|
|
163
|
+
detailLevel: "detail_level",
|
|
164
|
+
mode: "detail_level",
|
|
165
|
+
format: "detail_level",
|
|
166
|
+
fileFilter: "file_filter",
|
|
167
|
+
file: "file_filter",
|
|
168
|
+
filter: "file_filter",
|
|
169
|
+
workspace: "workspace_path",
|
|
170
|
+
workspacePath: "workspace_path",
|
|
171
|
+
project_root: "workspace_path",
|
|
172
|
+
projectRoot: "workspace_path",
|
|
173
|
+
target_path: "workspace_path",
|
|
174
|
+
path: "workspace_path",
|
|
175
|
+
}) as Record<string, unknown>;
|
|
176
|
+
if (obj.domain !== undefined && obj.name === undefined) {
|
|
177
|
+
obj.name = obj.domain;
|
|
178
|
+
} else if (obj.name !== undefined && obj.domain === undefined) {
|
|
179
|
+
obj.domain = obj.name;
|
|
180
|
+
}
|
|
181
|
+
if (obj.archetype_filter !== undefined && obj.archetype === undefined) {
|
|
182
|
+
obj.archetype = obj.archetype_filter;
|
|
183
|
+
} else if (obj.archetype !== undefined && obj.archetype_filter === undefined) {
|
|
184
|
+
obj.archetype_filter = obj.archetype;
|
|
185
|
+
}
|
|
186
|
+
if (obj.full === true && obj.detail_level === undefined) {
|
|
187
|
+
obj.detail_level = "full";
|
|
188
|
+
}
|
|
189
|
+
return obj;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export const GetDomainCatalogSchema = z.preprocess(
|
|
193
|
+
normalizeDomainCatalogArgs,
|
|
194
|
+
z.object({
|
|
195
|
+
domain: z.string().optional(),
|
|
196
|
+
name: z.string().optional(),
|
|
197
|
+
archetype_filter: z.string().optional(),
|
|
198
|
+
archetype: z.string().optional(),
|
|
199
|
+
detail_level: z.enum(["compact", "full"]).optional().default("compact"),
|
|
200
|
+
file_filter: z.string().optional(),
|
|
201
|
+
file_offset: z.number().int().nonnegative().optional(),
|
|
202
|
+
file_limit: z.number().int().min(1).max(100).optional(),
|
|
203
|
+
include_evidence: z.boolean().optional(),
|
|
204
|
+
include_capabilities: z.boolean().optional(),
|
|
205
|
+
workspace_path: z.string().optional(),
|
|
206
|
+
})
|
|
207
|
+
);
|
|
208
|
+
export type GetDomainCatalogArgs = z.infer<typeof GetDomainCatalogSchema>;
|
|
209
|
+
|
|
210
|
+
export function normalizeLocateSymbolArgs(raw: unknown): unknown {
|
|
211
|
+
const coerced = extractSingleStringFallback(raw, "query", [
|
|
212
|
+
"workspace_path",
|
|
213
|
+
"workspacePath",
|
|
214
|
+
"workspace",
|
|
215
|
+
"project_root",
|
|
216
|
+
"projectRoot",
|
|
217
|
+
"target_path",
|
|
218
|
+
"path",
|
|
219
|
+
"domain",
|
|
220
|
+
"domain_name",
|
|
221
|
+
"domainName",
|
|
222
|
+
"file_path",
|
|
223
|
+
"filePath",
|
|
224
|
+
]);
|
|
225
|
+
if (typeof coerced !== "object" || coerced === null || Array.isArray(coerced)) return coerced;
|
|
226
|
+
const obj = withAliases(coerced, {
|
|
227
|
+
symbol: "query",
|
|
228
|
+
name: "query",
|
|
229
|
+
symbol_name: "query",
|
|
230
|
+
symbolName: "query",
|
|
231
|
+
target: "query",
|
|
232
|
+
domain_name: "domain",
|
|
233
|
+
domainName: "domain",
|
|
234
|
+
max: "limit",
|
|
235
|
+
workspace: "workspace_path",
|
|
236
|
+
workspacePath: "workspace_path",
|
|
237
|
+
project_root: "workspace_path",
|
|
238
|
+
projectRoot: "workspace_path",
|
|
239
|
+
target_path: "workspace_path",
|
|
240
|
+
path: "workspace_path",
|
|
241
|
+
}) as Record<string, unknown>;
|
|
242
|
+
if (obj.query !== undefined && obj.symbol === undefined) {
|
|
243
|
+
obj.symbol = obj.query;
|
|
244
|
+
} else if (obj.symbol !== undefined && obj.query === undefined) {
|
|
245
|
+
obj.query = obj.symbol;
|
|
246
|
+
}
|
|
247
|
+
if (!obj.query && !obj.symbol && typeof obj.symbol_ref === "object" && obj.symbol_ref !== null) {
|
|
248
|
+
obj.query = (obj.symbol_ref as Record<string, unknown>).name;
|
|
249
|
+
obj.symbol = obj.query;
|
|
250
|
+
}
|
|
251
|
+
return obj;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export const SymbolReferenceSchema = z.object({
|
|
255
|
+
file_path: z.string().min(1), language: z.string().min(1), name: z.string().min(1), kind: z.string().min(1),
|
|
256
|
+
signature: z.string(), start_line: z.number().int().positive(), end_line: z.number().int().positive(),
|
|
257
|
+
indexed_content_hash: z.string().min(1), container: z.string().optional(), receiver: z.string().optional(),
|
|
258
|
+
}).refine(ref => ref.end_line >= ref.start_line, { message: "end_line must be at or after start_line" });
|
|
259
|
+
|
|
260
|
+
export const LocateSymbolSchema = z.preprocess(
|
|
261
|
+
normalizeLocateSymbolArgs,
|
|
262
|
+
z.object({
|
|
263
|
+
query: z.string().min(1, "query is required"),
|
|
264
|
+
symbol: z.string().optional(),
|
|
265
|
+
domain: z.string().optional(),
|
|
266
|
+
symbol_ref: SymbolReferenceSchema.optional(),
|
|
267
|
+
file_path: z.string().min(1).optional(),
|
|
268
|
+
limit: z.number().int().min(1).max(50).optional().default(10),
|
|
269
|
+
workspace_path: z.string().optional(),
|
|
270
|
+
})
|
|
271
|
+
);
|
|
272
|
+
export type LocateSymbolArgs = z.infer<typeof LocateSymbolSchema>;
|
|
273
|
+
|
|
274
|
+
export function normalizeGetSymbolArgs(raw: unknown): unknown {
|
|
275
|
+
const coerced = extractSingleStringFallback(raw, "symbol", [
|
|
276
|
+
"workspace_path",
|
|
277
|
+
"workspacePath",
|
|
278
|
+
"workspace",
|
|
279
|
+
"project_root",
|
|
280
|
+
"projectRoot",
|
|
281
|
+
"domain",
|
|
282
|
+
"domain_name",
|
|
283
|
+
"domainName",
|
|
284
|
+
"file_path",
|
|
285
|
+
"filePath",
|
|
286
|
+
]);
|
|
287
|
+
if (typeof coerced !== "object" || coerced === null || Array.isArray(coerced)) return coerced;
|
|
288
|
+
const obj = withAliases(coerced, {
|
|
289
|
+
query: "symbol",
|
|
290
|
+
name: "symbol",
|
|
291
|
+
symbol_name: "symbol",
|
|
292
|
+
symbolName: "symbol",
|
|
293
|
+
target: "symbol",
|
|
294
|
+
domain_name: "domain",
|
|
295
|
+
domainName: "domain",
|
|
296
|
+
includeDependencies: "include_dependencies",
|
|
297
|
+
include_deps: "include_dependencies",
|
|
298
|
+
includeDeps: "include_dependencies",
|
|
299
|
+
dependencies: "include_dependencies",
|
|
300
|
+
deps: "include_dependencies",
|
|
301
|
+
workspace: "workspace_path",
|
|
302
|
+
workspacePath: "workspace_path",
|
|
303
|
+
project_root: "workspace_path",
|
|
304
|
+
projectRoot: "workspace_path",
|
|
305
|
+
}) as Record<string, unknown>;
|
|
306
|
+
if (obj.symbol !== undefined && obj.query === undefined) {
|
|
307
|
+
obj.query = obj.symbol;
|
|
308
|
+
} else if (obj.query !== undefined && obj.symbol === undefined) {
|
|
309
|
+
obj.symbol = obj.query;
|
|
310
|
+
}
|
|
311
|
+
if (!obj.query && !obj.symbol && typeof obj.symbol_ref === "object" && obj.symbol_ref !== null) {
|
|
312
|
+
obj.query = (obj.symbol_ref as Record<string, unknown>).name;
|
|
313
|
+
obj.symbol = obj.query;
|
|
314
|
+
}
|
|
315
|
+
return obj;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export const GetSymbolSchema = z.preprocess(
|
|
319
|
+
normalizeGetSymbolArgs,
|
|
320
|
+
z.object({
|
|
321
|
+
symbol: z.string().min(1, "symbol is required"),
|
|
322
|
+
query: z.string().optional(),
|
|
323
|
+
domain: z.string().optional(),
|
|
324
|
+
symbol_ref: SymbolReferenceSchema.optional(),
|
|
325
|
+
include_dependencies: z.boolean().optional().default(true),
|
|
326
|
+
workspace_path: z.string().optional(),
|
|
327
|
+
file_path: z.string().min(1).optional(),
|
|
328
|
+
include_source: z.boolean().optional().default(false),
|
|
329
|
+
source_start_line: z.number().int().positive().optional(),
|
|
330
|
+
source_line_limit: z.number().int().positive().max(200).optional().default(120),
|
|
331
|
+
})
|
|
332
|
+
);
|
|
333
|
+
export type GetSymbolArgs = z.infer<typeof GetSymbolSchema>;
|
|
334
|
+
|
|
335
|
+
export function normalizeGetSymbolImpactArgs(raw: unknown): unknown {
|
|
336
|
+
const coerced = extractSingleStringFallback(raw, "symbol");
|
|
337
|
+
if (typeof coerced !== "object" || coerced === null || Array.isArray(coerced)) return coerced;
|
|
338
|
+
const obj = withAliases(coerced, {
|
|
339
|
+
query: "symbol",
|
|
340
|
+
name: "symbol",
|
|
341
|
+
symbol_name: "symbol",
|
|
342
|
+
symbolName: "symbol",
|
|
343
|
+
file_path: "symbol",
|
|
344
|
+
filePath: "symbol",
|
|
345
|
+
file: "symbol",
|
|
346
|
+
path: "symbol",
|
|
347
|
+
target: "symbol",
|
|
348
|
+
workspace: "workspace_path",
|
|
349
|
+
workspacePath: "workspace_path",
|
|
350
|
+
project_root: "workspace_path",
|
|
351
|
+
projectRoot: "workspace_path",
|
|
352
|
+
}) as Record<string, unknown>;
|
|
353
|
+
if (obj.symbol !== undefined && obj.query === undefined) {
|
|
354
|
+
obj.query = obj.symbol;
|
|
355
|
+
} else if (obj.query !== undefined && obj.symbol === undefined) {
|
|
356
|
+
obj.symbol = obj.query;
|
|
357
|
+
}
|
|
358
|
+
return obj;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export const GetSymbolImpactSchema = z.preprocess(
|
|
362
|
+
normalizeGetSymbolImpactArgs,
|
|
363
|
+
z.object({
|
|
364
|
+
symbol: z.string().min(1, "symbol is required"),
|
|
365
|
+
query: z.string().optional(),
|
|
366
|
+
domain: z.string().optional(),
|
|
367
|
+
workspace_path: z.string().optional(),
|
|
368
|
+
})
|
|
369
|
+
);
|
|
370
|
+
export type GetSymbolImpactArgs = z.infer<typeof GetSymbolImpactSchema>;
|
|
371
|
+
|
|
372
|
+
export function normalizeTraceVerticalSliceArgs(raw: unknown): unknown {
|
|
373
|
+
const coerced = extractSingleStringFallback(raw, "query", [
|
|
374
|
+
"workspace_path", "workspacePath", "workspace", "project_root", "projectRoot", "controller_file",
|
|
375
|
+
]);
|
|
376
|
+
if (typeof coerced !== "object" || coerced === null || Array.isArray(coerced)) return coerced;
|
|
377
|
+
const obj = withAliases(coerced, {
|
|
378
|
+
route: "query",
|
|
379
|
+
uri: "query",
|
|
380
|
+
route_uri: "query",
|
|
381
|
+
routeUri: "query",
|
|
382
|
+
entry_file: "query",
|
|
383
|
+
entryFile: "query",
|
|
384
|
+
file_path: "query",
|
|
385
|
+
filePath: "query",
|
|
386
|
+
file: "query",
|
|
387
|
+
path: "query",
|
|
388
|
+
symbol: "query",
|
|
389
|
+
name: "query",
|
|
390
|
+
feature: "query",
|
|
391
|
+
feature_key: "query",
|
|
392
|
+
featureKey: "query",
|
|
393
|
+
maxDepth: "max_depth",
|
|
394
|
+
depth: "max_depth",
|
|
395
|
+
workspace: "workspace_path",
|
|
396
|
+
workspacePath: "workspace_path",
|
|
397
|
+
project_root: "workspace_path",
|
|
398
|
+
projectRoot: "workspace_path",
|
|
399
|
+
}) as Record<string, unknown>;
|
|
400
|
+
if (obj.query !== undefined && obj.symbol === undefined) {
|
|
401
|
+
obj.symbol = obj.query;
|
|
402
|
+
} else if (obj.symbol !== undefined && obj.query === undefined) {
|
|
403
|
+
obj.query = obj.symbol;
|
|
404
|
+
}
|
|
405
|
+
if (obj.max_depth !== undefined && obj.max_depth !== null && !Number.isNaN(Number(obj.max_depth))) {
|
|
406
|
+
obj.max_depth = Math.min(Math.max(Math.trunc(Number(obj.max_depth)), 1), 8);
|
|
407
|
+
}
|
|
408
|
+
return obj;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export const TraceVerticalSliceSchema = z.preprocess(
|
|
412
|
+
normalizeTraceVerticalSliceArgs,
|
|
413
|
+
z.object({
|
|
414
|
+
query: z.string().min(1, "query is required"),
|
|
415
|
+
symbol: z.string().optional(),
|
|
416
|
+
controller_file: z.string().min(1).optional(),
|
|
417
|
+
max_depth: z.number().int().min(1).max(8).optional().default(5),
|
|
418
|
+
workspace_path: z.string().optional(),
|
|
419
|
+
})
|
|
420
|
+
);
|
|
421
|
+
export type TraceVerticalSliceArgs = z.infer<typeof TraceVerticalSliceSchema>;
|
|
422
|
+
|
|
423
|
+
export const CheckBoundarySchema = z.preprocess(
|
|
424
|
+
normalizeBoundaryArgs,
|
|
425
|
+
z.object({
|
|
426
|
+
file_path: z.string().trim().min(1, "file_path cannot be blank").optional(),
|
|
427
|
+
file_paths: z.array(z.string().trim().min(1, "file_paths cannot contain blank paths")).optional(),
|
|
428
|
+
proposed_imports: z.array(z.string()).optional().default([]),
|
|
429
|
+
proposed_imports_supplied: z.boolean().optional().default(false),
|
|
430
|
+
scope: z.enum(["file", "all", "staged", "domain"]).optional(),
|
|
431
|
+
domain: z.string().trim().min(1, "domain cannot be blank").optional(),
|
|
432
|
+
staged: z.boolean().optional(),
|
|
433
|
+
workspace_path: z.string().optional(),
|
|
434
|
+
}).superRefine((args, ctx) => {
|
|
435
|
+
const hasBatch = Boolean(args.file_paths?.length);
|
|
436
|
+
const hasTarget = args.file_path !== undefined || hasBatch;
|
|
437
|
+
const scope = args.scope ?? (args.staged ? "staged" : hasTarget ? "file" : args.domain ? "domain" : "all");
|
|
438
|
+
if (args.file_path !== undefined && hasBatch) {
|
|
439
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["file_paths"], message: "Use either file_path or file_paths, not both." });
|
|
440
|
+
}
|
|
441
|
+
if (args.staged && scope !== "staged") {
|
|
442
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["staged"], message: "staged=true requires scope='staged'." });
|
|
443
|
+
}
|
|
444
|
+
if (scope === "file" && !hasTarget) {
|
|
445
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["file_path"], message: "scope='file' requires file_path or non-empty file_paths." });
|
|
446
|
+
}
|
|
447
|
+
if (scope !== "file" && hasTarget) {
|
|
448
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["scope"], message: `scope='${scope}' does not accept file targets. Use scope='file' for proposed-import checks.` });
|
|
449
|
+
}
|
|
450
|
+
if (scope === "domain" && !args.domain) {
|
|
451
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["domain"], message: "scope='domain' requires a registered domain name." });
|
|
452
|
+
}
|
|
453
|
+
if (scope === "all" && args.domain) {
|
|
454
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["domain"], message: "scope='all' checks the entire repository. Use scope='domain' to filter a domain." });
|
|
455
|
+
}
|
|
456
|
+
if (scope !== "file" && args.proposed_imports.length) {
|
|
457
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["proposed_imports"], message: "proposed_imports requires a file target and scope='file'." });
|
|
458
|
+
}
|
|
459
|
+
})
|
|
460
|
+
);
|
|
461
|
+
export type CheckBoundaryArgs = z.infer<typeof CheckBoundarySchema>;
|
|
462
|
+
|
|
463
|
+
export function normalizeRegisterDomainArgs(raw: unknown): unknown {
|
|
464
|
+
const coerced = extractSingleStringFallback(raw, "domain", [
|
|
465
|
+
"root",
|
|
466
|
+
"root_path",
|
|
467
|
+
"rootPath",
|
|
468
|
+
"path",
|
|
469
|
+
"root_dir",
|
|
470
|
+
"workspace_path",
|
|
471
|
+
"workspacePath",
|
|
472
|
+
"workspace",
|
|
473
|
+
"project_root",
|
|
474
|
+
"projectRoot",
|
|
475
|
+
]);
|
|
476
|
+
if (typeof coerced !== "object" || coerced === null || Array.isArray(coerced)) return coerced;
|
|
477
|
+
const obj = withAliases(coerced, {
|
|
478
|
+
name: "domain",
|
|
479
|
+
domain_name: "domain",
|
|
480
|
+
domainName: "domain",
|
|
481
|
+
root_path: "root",
|
|
482
|
+
rootPath: "root",
|
|
483
|
+
path: "root",
|
|
484
|
+
allowedDependencies: "allowed_dependencies",
|
|
485
|
+
allowed: "allowed_dependencies",
|
|
486
|
+
forbiddenDependencies: "forbidden_dependencies",
|
|
487
|
+
forbidden: "forbidden_dependencies",
|
|
488
|
+
archetype: "archetypes",
|
|
489
|
+
ingestNow: "ingest_now",
|
|
490
|
+
workspace: "workspace_path",
|
|
491
|
+
workspacePath: "workspace_path",
|
|
492
|
+
project_root: "workspace_path",
|
|
493
|
+
projectRoot: "workspace_path",
|
|
494
|
+
}) as Record<string, unknown>;
|
|
495
|
+
if (obj.domain !== undefined && obj.name === undefined) {
|
|
496
|
+
obj.name = obj.domain;
|
|
497
|
+
} else if (obj.name !== undefined && obj.domain === undefined) {
|
|
498
|
+
obj.domain = obj.name;
|
|
499
|
+
}
|
|
500
|
+
return obj;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
export const RegisterDomainSchema = z.preprocess(
|
|
504
|
+
normalizeRegisterDomainArgs,
|
|
505
|
+
z.object({
|
|
506
|
+
domain: z.string().min(1, "Domain name/identifier is required"),
|
|
507
|
+
name: z.string().optional(),
|
|
508
|
+
root: z.string().min(1, "Domain root path is required"),
|
|
509
|
+
description: z.string().optional(),
|
|
510
|
+
allowed_dependencies: z.array(z.string()).optional(),
|
|
511
|
+
forbidden_dependencies: z.array(z.string()).optional(),
|
|
512
|
+
archetypes: z.record(z.string()).optional(),
|
|
513
|
+
ingest_now: z.boolean().optional().default(false),
|
|
514
|
+
workspace_path: z.string().optional(),
|
|
515
|
+
})
|
|
516
|
+
);
|
|
517
|
+
export type RegisterDomainArgs = z.infer<typeof RegisterDomainSchema>;
|
|
518
|
+
|
|
519
|
+
// =========================================================================
|
|
520
|
+
// 4 UNIFIED TOOLS SCHEMAS & NORMALIZERS
|
|
521
|
+
// =========================================================================
|
|
522
|
+
|
|
523
|
+
// 1. septum_map
|
|
524
|
+
export function normalizeMapToolArgs(raw: unknown): unknown {
|
|
525
|
+
const coerced = extractSingleStringFallback(raw, "domain", [
|
|
526
|
+
"workspace_path",
|
|
527
|
+
"workspacePath",
|
|
528
|
+
"workspace",
|
|
529
|
+
"project_root",
|
|
530
|
+
"projectRoot",
|
|
531
|
+
"target_path",
|
|
532
|
+
"path",
|
|
533
|
+
"action",
|
|
534
|
+
"detail_level",
|
|
535
|
+
"detailLevel",
|
|
536
|
+
"mode",
|
|
537
|
+
"format",
|
|
538
|
+
"archetype_filter",
|
|
539
|
+
"archetype",
|
|
540
|
+
"file_filter",
|
|
541
|
+
"fileFilter",
|
|
542
|
+
"root",
|
|
543
|
+
"root_path",
|
|
544
|
+
"rootPath",
|
|
545
|
+
]);
|
|
546
|
+
if (typeof coerced !== "object" || coerced === null || Array.isArray(coerced)) return coerced;
|
|
547
|
+
const obj = withAliases(coerced, {
|
|
548
|
+
domain_name: "domain",
|
|
549
|
+
domainName: "domain",
|
|
550
|
+
name: "domain",
|
|
551
|
+
archetype: "archetype_filter",
|
|
552
|
+
archetypeFilter: "archetype_filter",
|
|
553
|
+
type: "archetype_filter",
|
|
554
|
+
detailLevel: "detail_level",
|
|
555
|
+
mode: "detail_level",
|
|
556
|
+
format: "detail_level",
|
|
557
|
+
fileFilter: "file_filter",
|
|
558
|
+
file: "file_filter",
|
|
559
|
+
filter: "file_filter",
|
|
560
|
+
root_path: "root",
|
|
561
|
+
rootPath: "root",
|
|
562
|
+
path: "root",
|
|
563
|
+
allowedDependencies: "allowed_dependencies",
|
|
564
|
+
allowed: "allowed_dependencies",
|
|
565
|
+
forbiddenDependencies: "forbidden_dependencies",
|
|
566
|
+
forbidden: "forbidden_dependencies",
|
|
567
|
+
archetypes: "archetypes",
|
|
568
|
+
ingestNow: "ingest_now",
|
|
569
|
+
workspace: "workspace_path",
|
|
570
|
+
workspacePath: "workspace_path",
|
|
571
|
+
project_root: "workspace_path",
|
|
572
|
+
projectRoot: "workspace_path",
|
|
573
|
+
}) as Record<string, unknown>;
|
|
574
|
+
|
|
575
|
+
if (obj.domain !== undefined && obj.name === undefined) {
|
|
576
|
+
obj.name = obj.domain;
|
|
577
|
+
} else if (obj.name !== undefined && obj.domain === undefined) {
|
|
578
|
+
obj.domain = obj.name;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
if (obj.archetype_filter !== undefined && obj.archetype === undefined) {
|
|
582
|
+
obj.archetype = obj.archetype_filter;
|
|
583
|
+
} else if (obj.archetype !== undefined && obj.archetype_filter === undefined) {
|
|
584
|
+
obj.archetype_filter = obj.archetype;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
if (obj.full === true && obj.detail_level === undefined) {
|
|
588
|
+
obj.detail_level = "full";
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
if (!obj.action) {
|
|
592
|
+
if (obj.root !== undefined || obj.ingest_now !== undefined) {
|
|
593
|
+
obj.action = "register";
|
|
594
|
+
} else {
|
|
595
|
+
obj.action = "catalog";
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
return obj;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
export const MapToolSchema = z.preprocess(
|
|
603
|
+
normalizeMapToolArgs,
|
|
604
|
+
z.object({
|
|
605
|
+
action: z.enum(["catalog", "register"]).optional().default("catalog"),
|
|
606
|
+
domain: z.string().optional(),
|
|
607
|
+
name: z.string().optional(),
|
|
608
|
+
detail_level: z.enum(["compact", "full"]).optional().default("compact"),
|
|
609
|
+
archetype_filter: z.string().optional(),
|
|
610
|
+
archetype: z.string().optional(),
|
|
611
|
+
file_filter: z.string().optional(),
|
|
612
|
+
file_offset: z.number().int().nonnegative().optional(),
|
|
613
|
+
file_limit: z.number().int().min(1).max(100).optional(),
|
|
614
|
+
include_evidence: z.boolean().optional(),
|
|
615
|
+
include_capabilities: z.boolean().optional(),
|
|
616
|
+
root: z.string().optional(),
|
|
617
|
+
description: z.string().optional(),
|
|
618
|
+
allowed_dependencies: z.array(z.string()).optional(),
|
|
619
|
+
forbidden_dependencies: z.array(z.string()).optional(),
|
|
620
|
+
archetypes: z.record(z.string()).optional(),
|
|
621
|
+
ingest_now: z.boolean().optional().default(false),
|
|
622
|
+
workspace_path: z.string().optional(),
|
|
623
|
+
})
|
|
624
|
+
);
|
|
625
|
+
export type MapToolArgs = z.infer<typeof MapToolSchema>;
|
|
626
|
+
|
|
627
|
+
// 2. septum_symbol
|
|
628
|
+
export function normalizeSymbolToolArgs(raw: unknown): unknown {
|
|
629
|
+
const coerced = extractSingleStringFallback(raw, "query", [
|
|
630
|
+
"workspace_path",
|
|
631
|
+
"workspacePath",
|
|
632
|
+
"workspace",
|
|
633
|
+
"project_root",
|
|
634
|
+
"projectRoot",
|
|
635
|
+
"action",
|
|
636
|
+
"domain",
|
|
637
|
+
"domain_name",
|
|
638
|
+
"domainName",
|
|
639
|
+
"file_path",
|
|
640
|
+
"filePath",
|
|
641
|
+
"limit",
|
|
642
|
+
]);
|
|
643
|
+
if (typeof coerced !== "object" || coerced === null || Array.isArray(coerced)) return coerced;
|
|
644
|
+
const obj = withAliases(coerced, {
|
|
645
|
+
symbol: "query",
|
|
646
|
+
name: "query",
|
|
647
|
+
symbol_name: "query",
|
|
648
|
+
symbolName: "query",
|
|
649
|
+
target: "query",
|
|
650
|
+
domain_name: "domain",
|
|
651
|
+
domainName: "domain",
|
|
652
|
+
includeDependencies: "include_dependencies",
|
|
653
|
+
include_deps: "include_dependencies",
|
|
654
|
+
includeDeps: "include_dependencies",
|
|
655
|
+
dependencies: "include_dependencies",
|
|
656
|
+
deps: "include_dependencies",
|
|
657
|
+
max: "limit",
|
|
658
|
+
workspace: "workspace_path",
|
|
659
|
+
workspacePath: "workspace_path",
|
|
660
|
+
project_root: "workspace_path",
|
|
661
|
+
projectRoot: "workspace_path",
|
|
662
|
+
filePath: "file_path",
|
|
663
|
+
sourceStartLine: "source_start_line",
|
|
664
|
+
sourceLineLimit: "source_line_limit",
|
|
665
|
+
semanticDepth: "semantic_depth",
|
|
666
|
+
}) as Record<string, unknown>;
|
|
667
|
+
|
|
668
|
+
if (obj.query !== undefined && obj.symbol === undefined) {
|
|
669
|
+
obj.symbol = obj.query;
|
|
670
|
+
} else if (obj.symbol !== undefined && obj.query === undefined) {
|
|
671
|
+
obj.query = obj.symbol;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
if (!obj.action) {
|
|
675
|
+
if (obj.budget_bytes !== undefined || obj.continuation !== undefined || obj.context_mode !== undefined) {
|
|
676
|
+
obj.action = "context";
|
|
677
|
+
} else if (obj.include_dependencies !== undefined || obj.include_source !== undefined ||
|
|
678
|
+
obj.source_start_line !== undefined || obj.source_line_limit !== undefined) {
|
|
679
|
+
obj.action = "context";
|
|
680
|
+
} else {
|
|
681
|
+
obj.action = "locate";
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
if (!obj.query && !obj.symbol && typeof obj.symbol_ref === "object" && obj.symbol_ref !== null) {
|
|
686
|
+
obj.query = (obj.symbol_ref as Record<string, unknown>).name;
|
|
687
|
+
obj.symbol = obj.query;
|
|
688
|
+
}
|
|
689
|
+
if (obj.action === "inspect") obj.action = "context";
|
|
690
|
+
return obj;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
export const SymbolToolSchema = z.preprocess(
|
|
694
|
+
normalizeSymbolToolArgs,
|
|
695
|
+
z.object({
|
|
696
|
+
action: z.enum(["locate", "inspect", "impact", "context"]).optional().default("locate"),
|
|
697
|
+
query: z.string().optional(),
|
|
698
|
+
symbol: z.string().optional(),
|
|
699
|
+
domain: z.string().optional(),
|
|
700
|
+
symbol_ref: SymbolReferenceSchema.optional(),
|
|
701
|
+
include_dependencies: z.boolean().optional().default(true),
|
|
702
|
+
limit: z.number().int().positive().optional(),
|
|
703
|
+
workspace_path: z.string().optional(),
|
|
704
|
+
file_path: z.string().min(1).optional(),
|
|
705
|
+
include_source: z.boolean().optional(),
|
|
706
|
+
source_start_line: z.number().int().positive().optional(),
|
|
707
|
+
source_line_limit: z.number().int().positive().max(200).optional(),
|
|
708
|
+
semantic_depth: z.number().int().min(1).max(2).optional(),
|
|
709
|
+
context_mode: z.enum(["deep", "source"]).optional(),
|
|
710
|
+
budget_bytes: z.number().int().min(2048).max(2 * 1024 * 1024).optional(),
|
|
711
|
+
continuation: z.string().min(1).max(4096).optional(),
|
|
712
|
+
}).superRefine((args, ctx) => {
|
|
713
|
+
if (args.symbol_ref && args.action !== "locate" && args.action !== "inspect" && args.action !== "impact" && args.action !== "context") {
|
|
714
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["symbol_ref"], message: "symbol_ref is supported only for locate, inspect, impact, and context." });
|
|
715
|
+
}
|
|
716
|
+
if (args.action !== "context" && (args.budget_bytes !== undefined || args.continuation !== undefined)) {
|
|
717
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["action"], message: "budget_bytes and continuation are supported only for context." });
|
|
718
|
+
}
|
|
719
|
+
if (args.context_mode !== undefined && args.action !== "context") {
|
|
720
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["context_mode"], message: "context_mode requires action='context' or its inspect alias." });
|
|
721
|
+
}
|
|
722
|
+
if (args.context_mode === "deep" && (args.include_source !== undefined || args.source_start_line !== undefined || args.source_line_limit !== undefined)) {
|
|
723
|
+
ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["context_mode"], message: "Deep context does not accept bounded source options." });
|
|
724
|
+
}
|
|
725
|
+
})
|
|
726
|
+
);
|
|
727
|
+
export type SymbolToolArgs = z.infer<typeof SymbolToolSchema>;
|
|
728
|
+
|
|
729
|
+
// 3. septum_slice
|
|
730
|
+
export const SliceToolSchema = TraceVerticalSliceSchema;
|
|
731
|
+
export type SliceToolArgs = TraceVerticalSliceArgs;
|
|
732
|
+
|
|
733
|
+
// 4. septum_boundary
|
|
734
|
+
export const BoundaryToolSchema = CheckBoundarySchema;
|
|
735
|
+
export type BoundaryToolArgs = CheckBoundaryArgs;
|
|
736
|
+
|
|
737
|
+
export function parseToolRequest(name: string, args: unknown) {
|
|
738
|
+
switch (name) {
|
|
739
|
+
case "septum_map": return { name, args: MapToolSchema.parse(args ?? {}) } as const;
|
|
740
|
+
case "septum_symbol": return { name, args: SymbolToolSchema.parse(args ?? {}) } as const;
|
|
741
|
+
case "septum_slice": return { name, args: SliceToolSchema.parse(args ?? {}) } as const;
|
|
742
|
+
case "septum_boundary": return { name, args: BoundaryToolSchema.parse(args ?? {}) } as const;
|
|
743
|
+
default: throw new Error(`Unknown tool: '${name}'`);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
|