homegraph 1.5.8 → 1.6.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/CHANGELOG.md +34 -0
- package/dist/extraction/grammars.d.ts +19 -0
- package/dist/extraction/grammars.js +44 -1
- package/dist/extraction/index.js +17 -12
- package/dist/extraction/languages/arkts.d.ts +40 -7
- package/dist/extraction/languages/arkts.js +290 -84
- package/dist/extraction/tree-sitter.js +12 -3
- package/dist/index.js +23 -12
- package/dist/mcp/arkts-evidence-packs.js +1 -0
- package/dist/mcp/daemon.d.ts +21 -3
- package/dist/mcp/daemon.js +60 -6
- package/dist/mcp/engine.d.ts +26 -0
- package/dist/mcp/engine.js +143 -7
- package/dist/mcp/index-availability.d.ts +40 -10
- package/dist/mcp/index-availability.js +89 -23
- package/dist/mcp/index.js +9 -0
- package/dist/mcp/indexable-root.d.ts +22 -0
- package/dist/mcp/indexable-root.js +140 -0
- package/dist/mcp/liveness-watchdog.d.ts +6 -1
- package/dist/mcp/liveness-watchdog.js +17 -5
- package/dist/mcp/locate-contract.d.ts +50 -0
- package/dist/mcp/locate-contract.js +146 -0
- package/dist/mcp/server-instructions.d.ts +2 -6
- package/dist/mcp/server-instructions.js +15 -5
- package/dist/mcp/session.js +15 -0
- package/dist/mcp/tools.d.ts +52 -0
- package/dist/mcp/tools.js +750 -103
- package/dist/project-map/index.d.ts +45 -0
- package/dist/project-map/index.js +373 -45
- package/dist/resolution/callback-synthesizer.js +251 -0
- package/dist/resolution/frameworks/arkts-entry.d.ts +35 -6
- package/dist/resolution/frameworks/arkts-entry.js +513 -30
- package/dist/resolution/index.js +25 -21
- package/dist/runtime-log.d.ts +52 -0
- package/dist/runtime-log.js +199 -0
- package/dist/search/query-plan-provider.js +3 -2
- package/dist/search/query-plan.js +21 -19
- package/dist/search/query-utils.d.ts +13 -0
- package/dist/search/query-utils.js +64 -0
- package/package.json +2 -2
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* 仅调整检索选择,不改变索引、查询语义或编码任务的验收要求。
|
|
4
|
-
*/
|
|
5
|
-
export declare const SERVER_INSTRUCTIONS = "# HomeGraph \u2014 optional structural evidence for this repo\n\n## When to call (path-first, bash-first)\n\nUse ordinary bash/search/read tools first for repository paths, symbols, literal strings and local changes. Skip HomeGraph when those tools provide sufficient evidence, including for difficult implementation tasks. A known path can be read directly; an adequate source result does not need a second graph lookup.\n\nHomeGraph 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.\n\nChoose the smallest available tool for that gap:\n- Exact usage/reference locations \u2192 `homegraph_usages`; callers/callees \u2192 the corresponding tool.\n- Named module dependencies/cycles \u2192 `homegraph_modules`; native exports/registration \u2192 `homegraph_native`.\n- One missing symbol body \u2192 `homegraph_node`; prefer direct read if its path is already known.\n- An unresolved cross-symbol mechanism \u2192 `homegraph_explore`. Do not use it for routine pre-edit orientation, a literal search, or to re-confirm source already found with bash.\n- ArkUI migration analysis \u2192 `homegraph_arkui_migrate` when that analysis is needed; SDK contracts \u2192 project declarations or SDK documentation.\n\nDo not call explore after a focused tool already answered the relation. Keep working directly once the edit location and affected behavior are sufficiently supported. Task difficulty and file count alone do not require graph use.\n\n## Query and recovery\n\nWrite 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. Use returned repository-relative paths without reconstructing an experiment directory; a path refusal requires valid in-repo relocation, not broader permissions.\n\nA project map is navigation, not proof of a located feature. Preserve requested product/module scope and verify each candidate before editing. Start with one focused graph request; recover only a named missing body/relation. Budget: \u22642 `homegraph_explore` attempts per project, \u22641 focused depth recovery; existing runtime budgets may be tighter. These are ceilings, never a required sequence. If evidence is still missing, use targeted bash/search/read and continue implementation. Do not expand into unrelated files merely to exhaust a budget.\n\n\n- ArkTS evidence packs keep complete declarations and the source dependencies of displayed static relations together. Gaps identify omitted, stale or unindexed evidence; inspect only a gap relevant to the task. A static link does not prove runtime ordering or value propagation, and a complete declaration does not prove its enclosing call conditions.\n- ArkTS path evidence follows typed, directed relations between named anchors within a bounded search. A provided path includes intermediate declarations and registration sites. Check its goal and stop reason; no path in scope does not prove no relationship. Qualify ambiguous symbols with their owning type or file.\n- Reuse complete, unchanged, line-numbered source ranges already visible. An outline, path list, truncated body or SDK declaration cannot replace missing implementation evidence. A slice hash identifies that excerpt, not the whole file. Refresh affected ranges after edits.\n- 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.\n- 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.\n\nNo index \u2192 use ordinary tools; indexing is managed by the host. Do not run HomeGraph initialization as part of solving the task.\n";
|
|
6
|
-
export declare const SERVER_INSTRUCTIONS_NO_ROOT_INDEX = "# HomeGraph \u2014 optional per-project evidence\n\nPass `projectPath` to an already indexed folder with `.homegraph/`. No index \u2192 use ordinary tools; indexing is managed by the host.\n\n## When to call (path-first, bash-first)\n\nUse ordinary bash/search/read tools first for repository paths, symbols, literal strings and local changes. Skip HomeGraph when those tools provide sufficient evidence, including for difficult implementation tasks. A known path can be read directly; an adequate source result does not need a second graph lookup.\n\nHomeGraph 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.\n\nChoose the smallest available tool for that gap:\n- Exact usage/reference locations \u2192 `homegraph_usages`; callers/callees \u2192 the corresponding tool.\n- Named module dependencies/cycles \u2192 `homegraph_modules`; native exports/registration \u2192 `homegraph_native`.\n- One missing symbol body \u2192 `homegraph_node`; prefer direct read if its path is already known.\n- An unresolved cross-symbol mechanism \u2192 `homegraph_explore`. Do not use it for routine pre-edit orientation, a literal search, or to re-confirm source already found with bash.\n- ArkUI migration analysis \u2192 `homegraph_arkui_migrate` when that analysis is needed; SDK contracts \u2192 project declarations or SDK documentation.\n\nDo not call explore after a focused tool already answered the relation. Keep working directly once the edit location and affected behavior are sufficiently supported. Task difficulty and file count alone do not require graph use.\n\n## Query and recovery\n\nWrite 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. Use returned repository-relative paths without reconstructing an experiment directory; a path refusal requires valid in-repo relocation, not broader permissions.\n\nA project map is navigation, not proof of a located feature. Preserve requested product/module scope and verify each candidate before editing. Start with one focused graph request; recover only a named missing body/relation. Budget: \u22642 `homegraph_explore` attempts per project, \u22641 focused depth recovery; existing runtime budgets may be tighter. These are ceilings, never a required sequence. If evidence is still missing, use targeted bash/search/read and continue implementation. Do not expand into unrelated files merely to exhaust a budget.\n\n\n- ArkTS evidence packs keep complete declarations and the source dependencies of displayed static relations together. Gaps identify omitted, stale or unindexed evidence; inspect only a gap relevant to the task. A static link does not prove runtime ordering or value propagation, and a complete declaration does not prove its enclosing call conditions.\n- ArkTS path evidence follows typed, directed relations between named anchors within a bounded search. A provided path includes intermediate declarations and registration sites. Check its goal and stop reason; no path in scope does not prove no relationship. Qualify ambiguous symbols with their owning type or file.\n- Reuse complete, unchanged, line-numbered source ranges already visible. An outline, path list, truncated body or SDK declaration cannot replace missing implementation evidence. A slice hash identifies that excerpt, not the whole file. Refresh affected ranges after edits.\n- 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.\n- 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.\n\n";
|
|
1
|
+
export declare const SERVER_INSTRUCTIONS = "# HomeGraph \u2014 optional structural evidence for this repo\n\n## When to call (path-first, bash-first)\n\nUse ordinary bash/search/read tools first for repository paths, symbols, literal strings and local changes. Skip HomeGraph when those tools provide sufficient evidence, including for difficult implementation tasks. A known path can be read directly; an adequate source result does not need a second graph lookup.\n\nHomeGraph 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.\n\nChoose the smallest available tool for that gap:\n- Engineering overview / which module owns a feature / where `route_map.json` or resource dirs live \u2192 `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.\n- Exact usage/reference locations \u2192 `homegraph_usages`; callers/callees \u2192 the corresponding tool.\n- Named module dependencies/cycles \u2192 `homegraph_modules`; native exports/registration \u2192 `homegraph_native`.\n- One missing symbol body \u2192 `homegraph_node`; prefer direct read if its path is already known.\n- An unresolved cross-symbol mechanism or route registration edges \u2192 `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). Do not use it for routine pre-edit orientation, a literal search, or to re-confirm source already found with bash.\n- ArkUI migration analysis \u2192 `homegraph_arkui_migrate` when that analysis is needed; SDK contracts \u2192 project declarations or SDK documentation.\n- Harmony `element/string.json` key/value lookup is searchable via explore/search (Resource hits may include bound `.ets` anchors; no graph edges). Project lists resource **paths**; color/other non-allowlisted files still need Grep/Read.\n- Harmony `form_config.json` / `shortcuts_config.json` are indexed as capability profiles (paths + names; no UI edges). Card/shortcut tasks should use explore/project \u2014 do not treat SDK Form `.d.ts` as project wiring when the negative note says no in-repo form.\n\nDo not call explore after a focused tool already answered the relation. Keep working directly once the edit location and affected behavior are sufficiently supported. Task difficulty and file count alone do not require graph use.\n\n## Query and recovery\n\nWrite 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: `\u2026`` \u2014 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 \u2014 do not treat that as a hard error.\n\nA 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. Budget: \u22642 `homegraph_explore` attempts per project, \u22641 focused depth recovery; existing runtime budgets may be tighter. These are ceilings, never a required sequence. If evidence is still missing, use targeted bash/search/read and continue implementation. Do not expand into unrelated files merely to exhaust a budget.\n\n## Index status\n\nTool replies may start with `HomeGraph project root: \u2026` (absolute join base for relative paths) and end with `HomeGraph status=\u2026`. status: empty=not ready \u00B7 fast=map only (homegraph_project) \u00B7 full=fresh \u00B7 dirty=usable but listed paths outdated \u00B7 syncing=write lock, retry.\n\n\n- ArkTS evidence packs keep complete declarations and the source dependencies of displayed static relations together. Gaps identify omitted, stale or unindexed evidence; inspect only a gap relevant to the task. A static link does not prove runtime ordering or value propagation, and a complete declaration does not prove its enclosing call conditions.\n- ArkTS path evidence follows typed, directed relations between named anchors within a bounded search. A provided path includes intermediate declarations and registration sites. Check its goal and stop reason; no path in scope does not prove no relationship. Qualify ambiguous symbols with their owning type or file.\n- Reuse complete, unchanged, line-numbered source ranges already visible. An outline, path list, truncated body or SDK declaration cannot replace missing implementation evidence. A slice hash identifies that excerpt, not the whole file. Refresh affected ranges after edits.\n- 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.\n- 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.\n\nNo index \u2192 use ordinary tools; indexing is managed by the host. Do not run HomeGraph initialization as part of solving the task.\n";
|
|
2
|
+
export declare const SERVER_INSTRUCTIONS_NO_ROOT_INDEX = "# HomeGraph \u2014 optional per-project evidence\n\nPass `projectPath` to an already indexed folder with `.homegraph/`. No index \u2192 use ordinary tools; indexing is managed by the host.\n\n## When to call (path-first, bash-first)\n\nUse ordinary bash/search/read tools first for repository paths, symbols, literal strings and local changes. Skip HomeGraph when those tools provide sufficient evidence, including for difficult implementation tasks. A known path can be read directly; an adequate source result does not need a second graph lookup.\n\nHomeGraph 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.\n\nChoose the smallest available tool for that gap:\n- Engineering overview / which module owns a feature / where `route_map.json` or resource dirs live \u2192 `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.\n- Exact usage/reference locations \u2192 `homegraph_usages`; callers/callees \u2192 the corresponding tool.\n- Named module dependencies/cycles \u2192 `homegraph_modules`; native exports/registration \u2192 `homegraph_native`.\n- One missing symbol body \u2192 `homegraph_node`; prefer direct read if its path is already known.\n- An unresolved cross-symbol mechanism or route registration edges \u2192 `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). Do not use it for routine pre-edit orientation, a literal search, or to re-confirm source already found with bash.\n- ArkUI migration analysis \u2192 `homegraph_arkui_migrate` when that analysis is needed; SDK contracts \u2192 project declarations or SDK documentation.\n- Harmony `element/string.json` key/value lookup is searchable via explore/search (Resource hits may include bound `.ets` anchors; no graph edges). Project lists resource **paths**; color/other non-allowlisted files still need Grep/Read.\n- Harmony `form_config.json` / `shortcuts_config.json` are indexed as capability profiles (paths + names; no UI edges). Card/shortcut tasks should use explore/project \u2014 do not treat SDK Form `.d.ts` as project wiring when the negative note says no in-repo form.\n\nDo not call explore after a focused tool already answered the relation. Keep working directly once the edit location and affected behavior are sufficiently supported. Task difficulty and file count alone do not require graph use.\n\n## Query and recovery\n\nWrite 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: `\u2026`` \u2014 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 \u2014 do not treat that as a hard error.\n\nA 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. Budget: \u22642 `homegraph_explore` attempts per project, \u22641 focused depth recovery; existing runtime budgets may be tighter. These are ceilings, never a required sequence. If evidence is still missing, use targeted bash/search/read and continue implementation. Do not expand into unrelated files merely to exhaust a budget.\n\n## Index status\n\nTool replies may start with `HomeGraph project root: \u2026` (absolute join base for relative paths) and end with `HomeGraph status=\u2026`. status: empty=not ready \u00B7 fast=map only (homegraph_project) \u00B7 full=fresh \u00B7 dirty=usable but listed paths outdated \u00B7 syncing=write lock, retry.\n\n\n- ArkTS evidence packs keep complete declarations and the source dependencies of displayed static relations together. Gaps identify omitted, stale or unindexed evidence; inspect only a gap relevant to the task. A static link does not prove runtime ordering or value propagation, and a complete declaration does not prove its enclosing call conditions.\n- ArkTS path evidence follows typed, directed relations between named anchors within a bounded search. A provided path includes intermediate declarations and registration sites. Check its goal and stop reason; no path in scope does not prove no relationship. Qualify ambiguous symbols with their owning type or file.\n- Reuse complete, unchanged, line-numbered source ranges already visible. An outline, path list, truncated body or SDK declaration cannot replace missing implementation evidence. A slice hash identifies that excerpt, not the whole file. Refresh affected ranges after edits.\n- 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.\n- 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.\n\n";
|
|
7
3
|
//# sourceMappingURL=server-instructions.d.ts.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = exports.SERVER_INSTRUCTIONS = void 0;
|
|
4
|
+
const index_availability_1 = require("./index-availability");
|
|
2
5
|
/**
|
|
3
6
|
* MCP initialize 中的统一工具指引;工具描述必须遵守相同的按需策略。
|
|
4
7
|
* 仅调整检索选择,不改变索引、查询语义或编码任务的验收要求。
|
|
5
8
|
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.SERVER_INSTRUCTIONS_NO_ROOT_INDEX = exports.SERVER_INSTRUCTIONS = void 0;
|
|
8
9
|
const SOURCE_AND_VALIDATION = `
|
|
9
10
|
- ArkTS evidence packs keep complete declarations and the source dependencies of displayed static relations together. Gaps identify omitted, stale or unindexed evidence; inspect only a gap relevant to the task. A static link does not prove runtime ordering or value propagation, and a complete declaration does not prove its enclosing call conditions.
|
|
10
11
|
- ArkTS path evidence follows typed, directed relations between named anchors within a bounded search. A provided path includes intermediate declarations and registration sites. Check its goal and stop reason; no path in scope does not prove no relationship. Qualify ambiguous symbols with their owning type or file.
|
|
@@ -19,24 +20,32 @@ Use ordinary bash/search/read tools first for repository paths, symbols, literal
|
|
|
19
20
|
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.
|
|
20
21
|
|
|
21
22
|
Choose the smallest available tool for that gap:
|
|
23
|
+
- 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.
|
|
22
24
|
- Exact usage/reference locations → \`homegraph_usages\`; callers/callees → the corresponding tool.
|
|
23
25
|
- Named module dependencies/cycles → \`homegraph_modules\`; native exports/registration → \`homegraph_native\`.
|
|
24
26
|
- One missing symbol body → \`homegraph_node\`; prefer direct read if its path is already known.
|
|
25
|
-
- An unresolved cross-symbol mechanism → \`homegraph_explore
|
|
27
|
+
- An unresolved cross-symbol mechanism 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). Do not use it for routine pre-edit orientation, a literal search, or to re-confirm source already found with bash.
|
|
26
28
|
- ArkUI migration analysis → \`homegraph_arkui_migrate\` when that analysis is needed; SDK contracts → project declarations or SDK documentation.
|
|
29
|
+
- Harmony \`element/string.json\` key/value lookup is searchable via explore/search (Resource hits may include bound \`.ets\` anchors; no graph edges). Project lists resource **paths**; color/other non-allowlisted files still need Grep/Read.
|
|
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.
|
|
27
31
|
|
|
28
32
|
Do not call explore after a focused tool already answered the relation. Keep working directly once the edit location and affected behavior are sufficiently supported. Task difficulty and file count alone do not require graph use.
|
|
29
33
|
`;
|
|
30
34
|
const QUERY = `## Query and recovery
|
|
31
35
|
|
|
32
|
-
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.
|
|
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
|
+
|
|
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. Budget: ≤2 \`homegraph_explore\` attempts per project, ≤1 focused depth recovery; existing runtime budgets may be tighter. These are ceilings, never a required sequence. If evidence is still missing, use targeted bash/search/read and continue implementation. Do not expand into unrelated files merely to exhaust a budget.
|
|
39
|
+
`;
|
|
40
|
+
const INDEX_STATUS = `## Index status
|
|
33
41
|
|
|
34
|
-
|
|
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}.
|
|
35
43
|
`;
|
|
36
44
|
exports.SERVER_INSTRUCTIONS = `# HomeGraph — optional structural evidence for this repo
|
|
37
45
|
|
|
38
46
|
${ON_DEMAND}
|
|
39
47
|
${QUERY}
|
|
48
|
+
${INDEX_STATUS}
|
|
40
49
|
${SOURCE_AND_VALIDATION}
|
|
41
50
|
No index → use ordinary tools; indexing is managed by the host. Do not run HomeGraph initialization as part of solving the task.
|
|
42
51
|
`;
|
|
@@ -46,6 +55,7 @@ Pass \`projectPath\` to an already indexed folder with \`.homegraph/\`. No index
|
|
|
46
55
|
|
|
47
56
|
${ON_DEMAND}
|
|
48
57
|
${QUERY}
|
|
58
|
+
${INDEX_STATUS}
|
|
49
59
|
${SOURCE_AND_VALIDATION}
|
|
50
60
|
`;
|
|
51
61
|
//# sourceMappingURL=server-instructions.js.map
|
package/dist/mcp/session.js
CHANGED
|
@@ -54,6 +54,7 @@ const tools_1 = require("./tools");
|
|
|
54
54
|
const server_instructions_1 = require("./server-instructions");
|
|
55
55
|
const version_1 = require("./version");
|
|
56
56
|
const directory_1 = require("../directory");
|
|
57
|
+
const runtime_log_1 = require("../runtime-log");
|
|
57
58
|
const update_check_1 = require("../upgrade/update-check");
|
|
58
59
|
const explore_session_state_1 = require("./explore-session-state");
|
|
59
60
|
/**
|
|
@@ -249,6 +250,10 @@ class MCPSession {
|
|
|
249
250
|
serverInfo: exports.SERVER_INFO,
|
|
250
251
|
instructions: initializeInstructions(indexed ? server_instructions_1.SERVER_INSTRUCTIONS : server_instructions_1.SERVER_INSTRUCTIONS_NO_ROOT_INDEX),
|
|
251
252
|
});
|
|
253
|
+
(0, runtime_log_1.logLifecycle)('mcp.initialize', {
|
|
254
|
+
projectRoot: explicitPath ?? undefined,
|
|
255
|
+
indexed,
|
|
256
|
+
});
|
|
252
257
|
if (explicitPath) {
|
|
253
258
|
// Kick off engine init in the background. If another session in the
|
|
254
259
|
// same daemon already opened the project, `ensureInitialized` is a
|
|
@@ -317,6 +322,16 @@ class MCPSession {
|
|
|
317
322
|
}
|
|
318
323
|
if (this.engine.hasDefaultHomeGraph())
|
|
319
324
|
return;
|
|
325
|
+
// Spec 0049: empty-root defer — re-probe and start auto-init as soon as
|
|
326
|
+
// sources appear (do not wait for the next timer tick).
|
|
327
|
+
if (this.engine.isAutoInitDeferred()) {
|
|
328
|
+
try {
|
|
329
|
+
await this.engine.kickDeferredAutoInit();
|
|
330
|
+
}
|
|
331
|
+
catch { /* fall through */ }
|
|
332
|
+
if (this.engine.hasDefaultHomeGraph())
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
320
335
|
const hint = this.explicitProjectPath ?? this.engine.getProjectPath();
|
|
321
336
|
if (!hint && !this.rootsAttempted) {
|
|
322
337
|
this.rootsAttempted = true;
|
package/dist/mcp/tools.d.ts
CHANGED
|
@@ -119,6 +119,32 @@ export declare function tightenExploreBudgetForQuery(budget: ExploreOutputBudget
|
|
|
119
119
|
* Set `HOMEGRAPH_EXPLORE_FULL_SOURCE=1` to restore the previous fatter Source.
|
|
120
120
|
*/
|
|
121
121
|
export declare function exploreLocatorDigestEnabled(): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Spec 0039 — short Registration sources table from indexed Harmony profile routes.
|
|
124
|
+
* Returns null when nothing to show.
|
|
125
|
+
*/
|
|
126
|
+
export declare function formatHarmonyRegistrationSources(cg: Pick<HomeGraph, 'getNodesByKind'>, maxRows?: number): string | null;
|
|
127
|
+
/**
|
|
128
|
+
* Spec 0041 / 0048 §3 — short Resource hits table for element/string.json constants.
|
|
129
|
+
* Spec 0048: append up to 2 in-repo `.ets` binding anchors when signature/docstring
|
|
130
|
+
* mention `app.string.<key>`.
|
|
131
|
+
*/
|
|
132
|
+
export declare function formatHarmonyResourceHits(cg: Pick<HomeGraph, 'getNodesByKind' | 'getProjectRoot' | 'getFiles'>, query: string, maxRows?: number): string | null;
|
|
133
|
+
/**
|
|
134
|
+
* Spec 0048 §1–2 — Capability profiles table, or form negative evidence.
|
|
135
|
+
*/
|
|
136
|
+
export declare function formatHarmonyCapabilityProfiles(cg: Pick<HomeGraph, 'getNodesByKind'>, query: string, maxRows?: number): string | null;
|
|
137
|
+
/** Spec 0048 §5 — detect empty / log-only method bodies. */
|
|
138
|
+
export declare function isHarmonyStubBody(source: string): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Spec 0048 §5 — seam notes for located explore anchors.
|
|
141
|
+
*/
|
|
142
|
+
export declare function formatHarmonySeamNotes(cg: Pick<HomeGraph, 'getNodesByKind' | 'getNode'>, projectRoot: string, located: Array<{
|
|
143
|
+
id?: string;
|
|
144
|
+
name: string;
|
|
145
|
+
filePath: string;
|
|
146
|
+
startLine: number;
|
|
147
|
+
}>, maxAnchors?: number): string | null;
|
|
122
148
|
/**
|
|
123
149
|
* Per-file staleness banner emitted at the top of a tool response when the
|
|
124
150
|
* file watcher has pending events for files referenced by the response.
|
|
@@ -256,6 +282,7 @@ export declare class ToolHandler {
|
|
|
256
282
|
private cg;
|
|
257
283
|
private projectCache;
|
|
258
284
|
private defaultProjectHint;
|
|
285
|
+
private boundProjectPathPinNotice;
|
|
259
286
|
private worktreeMismatchCache;
|
|
260
287
|
private catchUpGate;
|
|
261
288
|
private queryPool;
|
|
@@ -342,6 +369,11 @@ export declare class ToolHandler {
|
|
|
342
369
|
*
|
|
343
370
|
* Walks up parent directories to find the nearest .homegraph/ folder,
|
|
344
371
|
* similar to how git finds .git/ directories.
|
|
372
|
+
*
|
|
373
|
+
* Spec 0043: when a default project is already bound, a `projectPath` whose
|
|
374
|
+
* resolved index root differs from that bound root is soft-pinned back to
|
|
375
|
+
* the default (no DB switch) and a success-shaped English notice is stashed
|
|
376
|
+
* for the reply preamble.
|
|
345
377
|
*/
|
|
346
378
|
private getHomeGraph;
|
|
347
379
|
/**
|
|
@@ -418,6 +450,12 @@ export declare class ToolHandler {
|
|
|
418
450
|
*/
|
|
419
451
|
private isFileStaleOnDisk;
|
|
420
452
|
private withStalenessNotice;
|
|
453
|
+
/**
|
|
454
|
+
* Decorate successful tool text (Spec 0035 status footer + Spec 0038 project-root hint
|
|
455
|
+
* + Spec 0043 bound projectPath pin notice).
|
|
456
|
+
* Prepends absolute project root + join guidance when known; appends status when missing.
|
|
457
|
+
*/
|
|
458
|
+
private withProductStatusFooter;
|
|
421
459
|
/**
|
|
422
460
|
* Execute a tool by name.
|
|
423
461
|
*
|
|
@@ -425,6 +463,9 @@ export declare class ToolHandler {
|
|
|
425
463
|
* it (the CLI does) and explore behaves exactly as before, untracked.
|
|
426
464
|
*/
|
|
427
465
|
execute(toolName: string, args: Record<string, unknown>, sessionState?: ExploreSessionState): Promise<ToolResult>;
|
|
466
|
+
/** Spec 0046: HOMEGRAPH_DEBUG tool summary → stderr + daemon.log. */
|
|
467
|
+
private traceToolCall;
|
|
468
|
+
private executeCore;
|
|
428
469
|
/**
|
|
429
470
|
* Attach the caller's session view to an explore call's args (CG-17), on a
|
|
430
471
|
* COPY so the caller's object is never mutated. Nothing else sees it: a
|
|
@@ -774,6 +815,17 @@ export declare class ToolHandler {
|
|
|
774
815
|
private handleExplore;
|
|
775
816
|
/** Render literal witnesses before graph-heavy sections, including unindexed UI. */
|
|
776
817
|
private renderLiteralSource;
|
|
818
|
+
/**
|
|
819
|
+
* Spec 0039: when the query names Harmony route profiles, lead with a short
|
|
820
|
+
* Registration sources table so agents see JSON was indexed (avoid re-Read).
|
|
821
|
+
*/
|
|
822
|
+
private prependHarmonyRegistrationSources;
|
|
823
|
+
/** Spec 0041: lead with Resource hits when string.json is named or matched. */
|
|
824
|
+
private prependHarmonyResourceHits;
|
|
825
|
+
/** Spec 0048 §1–2: Capability profiles or form negative evidence. */
|
|
826
|
+
private prependHarmonyCapabilityProfiles;
|
|
827
|
+
/** Spec 0048 §5: seam notes for located anchors. */
|
|
828
|
+
private prependHarmonySeamNotes;
|
|
777
829
|
/**
|
|
778
830
|
* An explore response plus the record of what it emitted (CG-17). The record
|
|
779
831
|
* rides the result only as far as {@link execute}, which files it into the
|