homegraph 1.5.10 → 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.
Files changed (35) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/extraction/grammars.d.ts +19 -0
  3. package/dist/extraction/grammars.js +44 -1
  4. package/dist/mcp/arkts-evidence-packs.js +1 -0
  5. package/dist/mcp/daemon.d.ts +21 -3
  6. package/dist/mcp/daemon.js +60 -6
  7. package/dist/mcp/engine.d.ts +26 -0
  8. package/dist/mcp/engine.js +143 -7
  9. package/dist/mcp/index-availability.d.ts +22 -0
  10. package/dist/mcp/index-availability.js +40 -1
  11. package/dist/mcp/index.js +9 -0
  12. package/dist/mcp/indexable-root.d.ts +22 -0
  13. package/dist/mcp/indexable-root.js +140 -0
  14. package/dist/mcp/liveness-watchdog.d.ts +6 -1
  15. package/dist/mcp/liveness-watchdog.js +17 -5
  16. package/dist/mcp/locate-contract.d.ts +50 -0
  17. package/dist/mcp/locate-contract.js +146 -0
  18. package/dist/mcp/server-instructions.d.ts +2 -2
  19. package/dist/mcp/server-instructions.js +7 -4
  20. package/dist/mcp/session.js +15 -0
  21. package/dist/mcp/tools.d.ts +49 -2
  22. package/dist/mcp/tools.js +714 -64
  23. package/dist/project-map/index.d.ts +45 -0
  24. package/dist/project-map/index.js +371 -3
  25. package/dist/resolution/callback-synthesizer.js +251 -0
  26. package/dist/resolution/frameworks/arkts-entry.d.ts +35 -6
  27. package/dist/resolution/frameworks/arkts-entry.js +513 -30
  28. package/dist/resolution/index.js +25 -21
  29. package/dist/runtime-log.d.ts +52 -0
  30. package/dist/runtime-log.js +199 -0
  31. package/dist/search/query-plan-provider.js +3 -2
  32. package/dist/search/query-plan.js +21 -19
  33. package/dist/search/query-utils.d.ts +13 -0
  34. package/dist/search/query-utils.js +64 -0
  35. package/package.json +1 -1
@@ -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;
@@ -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
  /**
@@ -419,8 +451,9 @@ export declare class ToolHandler {
419
451
  private isFileStaleOnDisk;
420
452
  private withStalenessNotice;
421
453
  /**
422
- * Append a one-line product index status footer (Spec 0035).
423
- * Guidance-only replies that already start with `HomeGraph status=` are left alone.
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.
424
457
  */
425
458
  private withProductStatusFooter;
426
459
  /**
@@ -430,6 +463,9 @@ export declare class ToolHandler {
430
463
  * it (the CLI does) and explore behaves exactly as before, untracked.
431
464
  */
432
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;
433
469
  /**
434
470
  * Attach the caller's session view to an explore call's args (CG-17), on a
435
471
  * COPY so the caller's object is never mutated. Nothing else sees it: a
@@ -779,6 +815,17 @@ export declare class ToolHandler {
779
815
  private handleExplore;
780
816
  /** Render literal witnesses before graph-heavy sections, including unindexed UI. */
781
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;
782
829
  /**
783
830
  * An explore response plus the record of what it emitted (CG-17). The record
784
831
  * rides the result only as far as {@link execute}, which files it into the