homegraph 1.6.1 → 1.6.2
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/CHANGELOG.md +22 -0
- package/dist/bin/homegraph.js +2 -2
- package/dist/db/index.js +1 -0
- package/dist/db/migrations.d.ts +6 -1
- package/dist/db/migrations.js +26 -1
- package/dist/db/queries.d.ts +5 -0
- package/dist/db/queries.js +17 -7
- package/dist/db/schema.sql +4 -0
- package/dist/extraction/grammars.js +2 -1
- package/dist/extraction/languages/c-cpp.d.ts +8 -0
- package/dist/extraction/languages/c-cpp.js +44 -0
- package/dist/extraction/wasm-runtime-flags.d.ts +4 -0
- package/dist/extraction/wasm-runtime-flags.js +9 -0
- package/dist/index.js +7 -1
- package/dist/installer/targets/icode.d.ts +43 -0
- package/dist/installer/targets/icode.js +631 -0
- package/dist/installer/targets/registry.js +2 -0
- package/dist/installer/targets/types.d.ts +1 -1
- package/dist/mcp/evidence-rendering.js +1 -1
- package/dist/mcp/explore-repeat-guard.d.ts +19 -5
- package/dist/mcp/explore-repeat-guard.js +35 -14
- package/dist/mcp/explore-session-state.d.ts +5 -0
- package/dist/mcp/explore-session-state.js +1 -0
- package/dist/mcp/locate-contract.js +1 -1
- package/dist/mcp/server-instructions.d.ts +2 -2
- package/dist/mcp/server-instructions.js +10 -10
- package/dist/mcp/session.js +3 -2
- package/dist/mcp/tools.d.ts +21 -2
- package/dist/mcp/tools.js +109 -50
- package/dist/resolution/c-feature-variants.d.ts +40 -0
- package/dist/resolution/c-feature-variants.js +272 -0
- package/dist/resolution/cpp-macro-visibility.d.ts +21 -0
- package/dist/resolution/cpp-macro-visibility.js +393 -0
- package/dist/resolution/index.js +11 -0
- package/dist/resolution/name-matcher.js +49 -2
- package/dist/resolution/types.d.ts +8 -0
- package/dist/resolution/types.js +8 -0
- package/dist/sync/watcher.d.ts +30 -0
- package/dist/sync/watcher.js +45 -0
- package/package.json +1 -1
|
@@ -40,14 +40,28 @@ export declare function inferExplorePartialMeta(text: string): {
|
|
|
40
40
|
};
|
|
41
41
|
export interface ExploreRepeatDecision {
|
|
42
42
|
refuse: boolean;
|
|
43
|
-
/** Matched prior call when refusing for overlap. */
|
|
43
|
+
/** Matched prior call when refusing for overlap or cooldown. */
|
|
44
44
|
matched?: ExploreCallRecord;
|
|
45
|
-
reason: 'overlap' | 'call-budget' | '
|
|
45
|
+
reason: 'overlap' | 'call-budget' | 'cooldown' | 'next-anchor' | 'ok';
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* After `homegraph_explore` records a result (the response is about to be
|
|
49
|
+
* returned), refuse another explore on the same project until this elapses.
|
|
50
|
+
* There is no per-connection call ceiling — a later question on a long-lived
|
|
51
|
+
* MCP session must still be able to explore.
|
|
52
|
+
*
|
|
53
|
+
* Tool descriptions, initialize instructions, and explore footers must quote
|
|
54
|
+
* this same wait. `getExploreBudget` scales output size only.
|
|
55
|
+
*/
|
|
56
|
+
export declare const EXPLORE_COOLDOWN_MS = 10000;
|
|
57
|
+
/** Whole seconds shown to agents. Matches {@link EXPLORE_COOLDOWN_MS}. */
|
|
58
|
+
export declare function exploreCooldownSeconds(): number;
|
|
47
59
|
/**
|
|
48
60
|
* Whether this explore should short-refuse instead of re-running.
|
|
61
|
+
*
|
|
62
|
+
* `now` is injectable so tests can move past the cooldown without sleeping.
|
|
49
63
|
*/
|
|
50
|
-
export declare function decideExploreRepeat(prior: ExploreProjectState | null | undefined, query: string): ExploreRepeatDecision;
|
|
64
|
+
export declare function decideExploreRepeat(prior: ExploreProjectState | null | undefined, query: string, now?: number): ExploreRepeatDecision;
|
|
51
65
|
/** Short success-shaped refuse when a repeat explore would waste tokens. */
|
|
52
66
|
export declare function formatExploreRepeatRefuse(decision: ExploreRepeatDecision, query: string): string;
|
|
53
67
|
export interface DepthToolFuseDecision {
|
|
@@ -98,8 +112,8 @@ export declare function formatMechanismSoftCloseFooter(next?: DomainRoleAnchorCa
|
|
|
98
112
|
/** Honest Partial footer with a single Next anchor + ONE Grep. */
|
|
99
113
|
export declare function formatMechanismPartialFooter(nextCaption: string): string;
|
|
100
114
|
/**
|
|
101
|
-
* Appended when
|
|
102
|
-
*
|
|
115
|
+
* Appended when another Partial is emitted after one earlier Partial in this
|
|
116
|
+
* session. The wait is the return cooldown, not a connection-long stop.
|
|
103
117
|
*/
|
|
104
118
|
export declare function formatSecondPartialStopFooter(nextAnchor?: string): string;
|
|
105
119
|
/**
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* Shape-driven only — no product nouns.
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EXPLORE_COOLDOWN_MS = void 0;
|
|
12
13
|
exports.exploreQueryTokens = exploreQueryTokens;
|
|
13
14
|
exports.queryTokenJaccard = queryTokenJaccard;
|
|
14
15
|
exports.queryTokenOverlapScore = queryTokenOverlapScore;
|
|
@@ -17,6 +18,7 @@ exports.novelAnchorsVsPriors = novelAnchorsVsPriors;
|
|
|
17
18
|
exports.isTightExploreFollowUp = isTightExploreFollowUp;
|
|
18
19
|
exports.extractNextAnchorFromText = extractNextAnchorFromText;
|
|
19
20
|
exports.inferExplorePartialMeta = inferExplorePartialMeta;
|
|
21
|
+
exports.exploreCooldownSeconds = exploreCooldownSeconds;
|
|
20
22
|
exports.decideExploreRepeat = decideExploreRepeat;
|
|
21
23
|
exports.formatExploreRepeatRefuse = formatExploreRepeatRefuse;
|
|
22
24
|
exports.latestCountedExplore = latestCountedExplore;
|
|
@@ -159,10 +161,19 @@ function inferExplorePartialMeta(text) {
|
|
|
159
161
|
};
|
|
160
162
|
}
|
|
161
163
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
+
* After `homegraph_explore` records a result (the response is about to be
|
|
165
|
+
* returned), refuse another explore on the same project until this elapses.
|
|
166
|
+
* There is no per-connection call ceiling — a later question on a long-lived
|
|
167
|
+
* MCP session must still be able to explore.
|
|
168
|
+
*
|
|
169
|
+
* Tool descriptions, initialize instructions, and explore footers must quote
|
|
170
|
+
* this same wait. `getExploreBudget` scales output size only.
|
|
164
171
|
*/
|
|
165
|
-
|
|
172
|
+
exports.EXPLORE_COOLDOWN_MS = 10_000;
|
|
173
|
+
/** Whole seconds shown to agents. Matches {@link EXPLORE_COOLDOWN_MS}. */
|
|
174
|
+
function exploreCooldownSeconds() {
|
|
175
|
+
return Math.round(exports.EXPLORE_COOLDOWN_MS / 1000);
|
|
176
|
+
}
|
|
166
177
|
/**
|
|
167
178
|
* After a counted Partial explore, allow this many depth tools
|
|
168
179
|
* (`homegraph_node` / callers / callees) before refusing — stops Partial→node×N
|
|
@@ -172,20 +183,30 @@ const MAX_DEPTH_AFTER_PARTIAL = 1;
|
|
|
172
183
|
function isCountedCall(call) {
|
|
173
184
|
return call.evidenceStatus !== undefined || (call.responseBytes || 0) >= 400;
|
|
174
185
|
}
|
|
186
|
+
function latestReturnedCall(prior) {
|
|
187
|
+
for (let i = prior.calls.length - 1; i >= 0; i--) {
|
|
188
|
+
const call = prior.calls[i];
|
|
189
|
+
if (call && typeof call.returnedAt === 'number' && Number.isFinite(call.returnedAt))
|
|
190
|
+
return call;
|
|
191
|
+
}
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
175
194
|
/**
|
|
176
195
|
* Whether this explore should short-refuse instead of re-running.
|
|
196
|
+
*
|
|
197
|
+
* `now` is injectable so tests can move past the cooldown without sleeping.
|
|
177
198
|
*/
|
|
178
|
-
function decideExploreRepeat(prior, query) {
|
|
199
|
+
function decideExploreRepeat(prior, query, now = Date.now()) {
|
|
179
200
|
if (!prior || prior.calls.length === 0)
|
|
180
201
|
return { refuse: false, reason: 'ok' };
|
|
181
202
|
const counted = prior.calls.filter(isCountedCall);
|
|
182
203
|
const last = counted[counted.length - 1];
|
|
183
|
-
|
|
184
|
-
if (
|
|
204
|
+
const returned = latestReturnedCall(prior);
|
|
205
|
+
if (returned && now - returned.returnedAt < exports.EXPLORE_COOLDOWN_MS) {
|
|
185
206
|
return {
|
|
186
207
|
refuse: true,
|
|
187
|
-
matched:
|
|
188
|
-
reason: '
|
|
208
|
+
matched: returned,
|
|
209
|
+
reason: 'cooldown',
|
|
189
210
|
};
|
|
190
211
|
}
|
|
191
212
|
// Missing or SDK-only evidence is not a successfully answered query. Permit
|
|
@@ -217,8 +238,8 @@ function formatExploreRepeatRefuse(decision, query) {
|
|
|
217
238
|
: '';
|
|
218
239
|
let why;
|
|
219
240
|
switch (decision.reason) {
|
|
220
|
-
case '
|
|
221
|
-
why = `
|
|
241
|
+
case 'cooldown':
|
|
242
|
+
why = `The previous \`homegraph_explore\` result was returned less than **${exploreCooldownSeconds()}** seconds ago. Wait, reuse that result, or inspect with Read/Grep, then call explore again.`;
|
|
222
243
|
break;
|
|
223
244
|
case 'next-anchor':
|
|
224
245
|
why = `Prior explore was Partial and named a **Next anchor** — do not re-explore a paraphrase of "${priorQ}${priorQ.length >= 100 ? '…' : ''}".`;
|
|
@@ -415,8 +436,8 @@ function formatMechanismPartialFooter(nextCaption) {
|
|
|
415
436
|
+ 'Use targeted Read/Grep if the evidence remains missing; an inventory alone does not establish behavior.');
|
|
416
437
|
}
|
|
417
438
|
/**
|
|
418
|
-
* Appended when
|
|
419
|
-
*
|
|
439
|
+
* Appended when another Partial is emitted after one earlier Partial in this
|
|
440
|
+
* session. The wait is the return cooldown, not a connection-long stop.
|
|
420
441
|
*/
|
|
421
442
|
function formatSecondPartialStopFooter(nextAnchor) {
|
|
422
443
|
const next = nextAnchor
|
|
@@ -425,7 +446,7 @@ function formatSecondPartialStopFooter(nextAnchor) {
|
|
|
425
446
|
return [
|
|
426
447
|
'',
|
|
427
448
|
'---',
|
|
428
|
-
|
|
449
|
+
`> **Second Partial.** Wait ${exploreCooldownSeconds()} seconds after this result before calling \`homegraph_explore\` again.`
|
|
429
450
|
+ next
|
|
430
451
|
+ ' Evidence remains incomplete. Inspect only missing source with targeted Read or narrow Grep, '
|
|
431
452
|
+ 'then continue the requested edits and validation. Reuse unchanged source already returned.',
|
|
@@ -473,7 +494,7 @@ function formatPartialExploreGuidance(opts) {
|
|
|
473
494
|
`⚠️ **Partial result** — ${why}. This is NOT an error.`,
|
|
474
495
|
'A targeted Read or **ONE narrow Grep** may recover missing evidence using names already in the question.',
|
|
475
496
|
anchorLine,
|
|
476
|
-
'At most **one** focused
|
|
497
|
+
'At most **one** focused callers/callees recovery after Partial; reuse source already returned.',
|
|
477
498
|
'If a second explore is still Partial, its retrieval budget is exhausted. Inspect missing source directly and continue the requested work; do not infer task completion.',
|
|
478
499
|
].join('\n');
|
|
479
500
|
}
|
|
@@ -118,6 +118,11 @@ export interface ExploreEmission {
|
|
|
118
118
|
export interface ExploreCallRecord extends ExploreEmission {
|
|
119
119
|
/** 1-based call index within this session FOR THIS PROJECT. Survives eviction. */
|
|
120
120
|
index: number;
|
|
121
|
+
/**
|
|
122
|
+
* Epoch ms when this result was recorded and about to be returned.
|
|
123
|
+
* The explore cooldown measures from here, not from when the request arrived.
|
|
124
|
+
*/
|
|
125
|
+
returnedAt?: number;
|
|
121
126
|
}
|
|
122
127
|
/** Everything the session knows about one project. */
|
|
123
128
|
export interface ExploreProjectState {
|
|
@@ -215,6 +215,7 @@ class ExploreSessionState {
|
|
|
215
215
|
state.responseBytes += Math.max(0, emission.responseBytes || 0);
|
|
216
216
|
const record = {
|
|
217
217
|
index: state.callCount,
|
|
218
|
+
returnedAt: Date.now(),
|
|
218
219
|
projectRoot: emission.projectRoot,
|
|
219
220
|
query: typeof emission.query === 'string' ? emission.query : '',
|
|
220
221
|
files: this.boundFiles(emission.files),
|
|
@@ -58,7 +58,7 @@ function formatLocatedBanner() {
|
|
|
58
58
|
}
|
|
59
59
|
function formatPartialBanner() {
|
|
60
60
|
return ('> **Partial** — evidence is incomplete (missing relation or budget). '
|
|
61
|
-
+ 'Next: `
|
|
61
|
+
+ 'Next: `homegraph_usages` / `homegraph_search` for the named gap — '
|
|
62
62
|
+ 'do **not** Grep the same symbol names already shown.');
|
|
63
63
|
}
|
|
64
64
|
/** Miss: paths only, no source bodies. */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const SERVER_INSTRUCTIONS
|
|
2
|
-
export declare const SERVER_INSTRUCTIONS_NO_ROOT_INDEX
|
|
1
|
+
export declare const SERVER_INSTRUCTIONS: string;
|
|
2
|
+
export declare const SERVER_INSTRUCTIONS_NO_ROOT_INDEX: string;
|
|
3
3
|
//# sourceMappingURL=server-instructions.d.ts.map
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = exports.SERVER_INSTRUCTIONS = void 0;
|
|
4
4
|
const index_availability_1 = require("./index-availability");
|
|
5
|
+
const explore_repeat_guard_1 = require("./explore-repeat-guard");
|
|
5
6
|
/**
|
|
6
|
-
* MCP initialize
|
|
7
|
+
* MCP initialize 中的统一工具指引;工具描述必须遵守相同的选用策略。
|
|
8
|
+
* 与 DevEco 产品侧 graph-first 口径对齐(去掉 bash-first / optional 劝退)。
|
|
7
9
|
* 仅调整检索选择,不改变索引、查询语义或编码任务的验收要求。
|
|
8
10
|
*/
|
|
9
11
|
const SOURCE_AND_VALIDATION = `
|
|
@@ -17,31 +19,29 @@ const SOURCE_AND_VALIDATION = `
|
|
|
17
19
|
- An empty edge set means the relation may be unindexed, not absent. For partial, stale or irrelevant results, inspect the exact missing source with scoped search/read. After a query adds no evidence, change the method or scope rather than paraphrasing the same explore.
|
|
18
20
|
- Retrieval completion is not task completion. Continue the requested edits and validation; check the original task's behavior and preservation constraints. Build success alone does not establish functional correctness.
|
|
19
21
|
`;
|
|
20
|
-
const ON_DEMAND = `## When to call (
|
|
22
|
+
const ON_DEMAND = `## When to call (graph-first for existing code)
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
HomeGraph is optional. Use it only for a concrete unresolved relationship that benefits from graph evidence: cross-file state/event propagation, callers/callees, module dependencies or ArkTS-to-native registration. Name the missing relation and use anchors from the current task or source. There is no mandatory number of bash searches before a useful graph query.
|
|
24
|
+
When the task touches existing project code, open with \`homegraph_explore\` alone (no parallel grep/glob/read in the same step) using feature/component/symbol keywords (Chinese + English Type/\`Type.member\`; \`taskContext\` = the requirement). Do NOT skip HomeGraph because you think the index might still be building — call it anyway.
|
|
25
25
|
|
|
26
26
|
Choose the smallest available tool for that gap:
|
|
27
27
|
- Engineering overview / which module owns a feature / where \`route_map.json\` or resource dirs live → \`homegraph_project\` (module map + Harmony skeleton pointers + Module roster with local \`file:\` deps + bounded resources path inventory: string.json / form_config|shortcuts_config / rawfile / media / on-disk modules not in the graph). It does **not** return symbol bodies, call graphs, or JSON/media contents.
|
|
28
|
-
- An unresolved cross-symbol mechanism, usage/dependency/native-registration relation, or route registration edges → \`homegraph_explore\` (may include Spec 0039 Registration sources for route_map; Spec 0041 Resource hits for \`element/string.json\` literals; Spec 0048 Capability profiles for form/shortcuts, or an explicit no-in-repo form note; Seam notes for stubs).
|
|
28
|
+
- An unresolved cross-symbol mechanism, usage/dependency/native-registration relation, or route registration edges → \`homegraph_explore\` (may include Spec 0039 Registration sources for route_map; Spec 0041 Resource hits for \`element/string.json\` literals; Spec 0048 Capability profiles for form/shortcuts, or an explicit no-in-repo form note; Seam notes for stubs). Literal string/pattern greps and SDK/@kit feature catalogs → ordinary search/read. SDK contracts → project declarations or SDK documentation.
|
|
29
29
|
- Harmony \`element/string.json\` key/value lookup is searchable via explore (Resource hits may include bound \`.ets\` anchors; no graph edges). Project lists resource **paths**; color/other non-allowlisted files still need Grep/Read.
|
|
30
30
|
- Harmony \`form_config.json\` / \`shortcuts_config.json\` are indexed as capability profiles (paths + names; no UI edges). Card/shortcut tasks should use explore/project — do not treat SDK Form \`.d.ts\` as project wiring when the negative note says no in-repo form.
|
|
31
31
|
|
|
32
|
-
Keep working directly once the edit location and affected behavior are sufficiently supported.
|
|
32
|
+
Keep working directly once the edit location and affected behavior are sufficiently supported.
|
|
33
33
|
`;
|
|
34
34
|
const QUERY = `## Query and recovery
|
|
35
35
|
|
|
36
36
|
Write one focused sentence: requested action + target + known anchors + unresolved relation + preservation constraints. Use the full public task as \`taskContext\` when needed. Keep UI labels verbatim; use exact symbols from the task or source instead of inventing names or piling up generic keywords. Tool replies may begin with \`HomeGraph project root: \`…\`\` — that absolute root is the join base for repo-relative paths below; pass those paths to Read/Grep as-is, or join as \`<root>/<relative>\` (use \`/\`). Do not invent experiment/result directory prefixes; a path refusal requires valid in-repo relocation, not broader permissions. When this MCP session already has a bound project root, a mismatched \`projectPath\` is ignored (results stay on the bound root) with a short English notice — do not treat that as a hard error.
|
|
37
37
|
|
|
38
|
-
A project map (\`homegraph_project\`) is navigation and Harmony skeleton pointers, not proof of a located feature and not a call graph. Preserve requested product/module scope and verify each candidate before editing. Start with one focused graph request; recover only a named missing body/relation.
|
|
38
|
+
A project map (\`homegraph_project\`) is navigation and Harmony skeleton pointers, not proof of a located feature and not a call graph. Preserve requested product/module scope and verify each candidate before editing. Start with one focused graph request; recover only a named missing body/relation. After \`homegraph_explore\` returns, wait ${(0, explore_repeat_guard_1.exploreCooldownSeconds)()} seconds before calling it again on the same project. If evidence is still missing, use targeted bash/search/read and continue implementation. Do not expand into unrelated files merely to fill the wait.
|
|
39
39
|
`;
|
|
40
40
|
const INDEX_STATUS = `## Index status
|
|
41
41
|
|
|
42
42
|
Tool replies may start with \`HomeGraph project root: …\` (absolute join base for relative paths) and end with \`HomeGraph status=…\`. ${index_availability_1.PRODUCT_STATUS_GLOSSARY}.
|
|
43
43
|
`;
|
|
44
|
-
exports.SERVER_INSTRUCTIONS = `# HomeGraph —
|
|
44
|
+
exports.SERVER_INSTRUCTIONS = `# HomeGraph — structural index for this repo
|
|
45
45
|
|
|
46
46
|
${ON_DEMAND}
|
|
47
47
|
${QUERY}
|
|
@@ -49,7 +49,7 @@ ${INDEX_STATUS}
|
|
|
49
49
|
${SOURCE_AND_VALIDATION}
|
|
50
50
|
No index → use ordinary tools; indexing is managed by the host. Do not run HomeGraph initialization as part of solving the task.
|
|
51
51
|
`;
|
|
52
|
-
exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = `# HomeGraph —
|
|
52
|
+
exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = `# HomeGraph — per-project structural index
|
|
53
53
|
|
|
54
54
|
Pass \`projectPath\` to an already indexed folder with \`.homegraph/\`. No index → use ordinary tools; indexing is managed by the host.
|
|
55
55
|
|
package/dist/mcp/session.js
CHANGED
|
@@ -287,11 +287,12 @@ class MCPSession {
|
|
|
287
287
|
this.transport.sendError(request.id, transport_1.ErrorCodes.InvalidParams, 'Missing tool name');
|
|
288
288
|
return;
|
|
289
289
|
}
|
|
290
|
-
|
|
290
|
+
// Accept short list names (`explore`) and canonical (`homegraph_explore`).
|
|
291
|
+
const toolName = (0, tools_1.canonicalizeMcpToolName)(params.name);
|
|
291
292
|
const toolArgs = params.arguments || {};
|
|
292
293
|
const tool = tools_1.tools.find((t) => t.name === toolName);
|
|
293
294
|
if (!tool) {
|
|
294
|
-
this.transport.sendError(request.id, transport_1.ErrorCodes.InvalidParams, `Unknown tool: ${
|
|
295
|
+
this.transport.sendError(request.id, transport_1.ErrorCodes.InvalidParams, `Unknown tool: ${params.name}`);
|
|
295
296
|
return;
|
|
296
297
|
}
|
|
297
298
|
if (process.env.HOMEGRAPH_MCP_DEBUG)
|
package/dist/mcp/tools.d.ts
CHANGED
|
@@ -51,6 +51,11 @@ export declare function normalizeQuerySpelling(query: string): string;
|
|
|
51
51
|
* but smaller ones should use fewer to avoid unnecessary overhead.
|
|
52
52
|
*/
|
|
53
53
|
export declare function getExploreBudget(fileCount: number): number;
|
|
54
|
+
/**
|
|
55
|
+
* Cooldown shown on `homegraph_explore` when the project is indexed.
|
|
56
|
+
* Matches {@link exploreCooldownSeconds}. Output tiers stay on {@link getExploreBudget}.
|
|
57
|
+
*/
|
|
58
|
+
export declare function formatExploreCallBudgetNote(fileCount: number): string;
|
|
54
59
|
/**
|
|
55
60
|
* Adaptive output budget for `homegraph_explore`, scaled to project size.
|
|
56
61
|
*
|
|
@@ -258,6 +263,20 @@ export declare const DEFAULT_MCP_TOOL_SHORT_NAMES: readonly ["explore", "project
|
|
|
258
263
|
export type McpToolAllowlist = Set<string> | 'all';
|
|
259
264
|
/** Resolve the exposed-tool allowlist from env (default = product slim pair). */
|
|
260
265
|
export declare function resolveMcpToolAllowlist(raw?: string | undefined): McpToolAllowlist;
|
|
266
|
+
/**
|
|
267
|
+
* Product hosts that prefix MCP tools with the server name (e.g. DevEco Code
|
|
268
|
+
* → `homegraph_` + tool name) set `HOMEGRAPH_MCP_SHORT_TOOL_NAMES=1` so
|
|
269
|
+
* tools/list exposes `explore` / `project` instead of `homegraph_explore`.
|
|
270
|
+
* After the host prefix, the model-visible name is still `homegraph_explore`.
|
|
271
|
+
* Cursor / Claude leave this unset and keep the canonical `homegraph_*` names.
|
|
272
|
+
*/
|
|
273
|
+
export declare function shortMcpToolNamesEnabled(raw?: string | undefined): boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Map a tools/call name to the canonical `homegraph_*` form.
|
|
276
|
+
* Accepts both short (`explore`) and long (`homegraph_explore`) so hosts that
|
|
277
|
+
* list short names (or still pass the long name) both work.
|
|
278
|
+
*/
|
|
279
|
+
export declare function canonicalizeMcpToolName(name: string): string;
|
|
261
280
|
/**
|
|
262
281
|
* Allowlist-filtered tool definitions WITHOUT an engine — the static surface the
|
|
263
282
|
* proxy answers `tools/list` with before any project is open. Mirrors
|
|
@@ -365,8 +384,8 @@ export declare class ToolHandler {
|
|
|
365
384
|
* guidance so the frozen description and the live call-time response tell
|
|
366
385
|
* the same story: failed build → say so (indexing is the user's call, so
|
|
367
386
|
* the agent relays it); still building → point at homegraph_project and
|
|
368
|
-
* retry; genuinely empty → honest empty note. Only fileCount > 0 carries
|
|
369
|
-
*
|
|
387
|
+
* retry; genuinely empty → honest empty note. Only fileCount > 0 carries the
|
|
388
|
+
* return cooldown — there is nothing to cool down over an unbuilt index.
|
|
370
389
|
*/
|
|
371
390
|
private exploreSuffix;
|
|
372
391
|
/**
|