trail-code 0.0.0-stage → 0.28.0-semantic.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +567 -2
- package/dist/ai/crux.d.ts +88 -0
- package/dist/ai/crux.d.ts.map +1 -0
- package/dist/ai/crux.js +219 -0
- package/dist/ai/crux.js.map +1 -0
- package/dist/ai/failure.d.ts +60 -0
- package/dist/ai/failure.d.ts.map +1 -0
- package/dist/ai/failure.js +86 -0
- package/dist/ai/failure.js.map +1 -0
- package/dist/ai/llm/anthropic.d.ts +37 -0
- package/dist/ai/llm/anthropic.d.ts.map +1 -0
- package/dist/ai/llm/anthropic.js +144 -0
- package/dist/ai/llm/anthropic.js.map +1 -0
- package/dist/ai/llm/factory.d.ts +28 -0
- package/dist/ai/llm/factory.d.ts.map +1 -0
- package/dist/ai/llm/factory.js +36 -0
- package/dist/ai/llm/factory.js.map +1 -0
- package/dist/ai/llm/litellm.d.ts +34 -0
- package/dist/ai/llm/litellm.d.ts.map +1 -0
- package/dist/ai/llm/litellm.js +45 -0
- package/dist/ai/llm/litellm.js.map +1 -0
- package/dist/ai/llm/openai.d.ts +145 -0
- package/dist/ai/llm/openai.d.ts.map +1 -0
- package/dist/ai/llm/openai.js +629 -0
- package/dist/ai/llm/openai.js.map +1 -0
- package/dist/ai/llm/orcarouter.d.ts +34 -0
- package/dist/ai/llm/orcarouter.d.ts.map +1 -0
- package/dist/ai/llm/orcarouter.js +45 -0
- package/dist/ai/llm/orcarouter.js.map +1 -0
- package/dist/ai/llm/recover-tool.d.ts +21 -0
- package/dist/ai/llm/recover-tool.d.ts.map +1 -0
- package/dist/ai/llm/recover-tool.js +109 -0
- package/dist/ai/llm/recover-tool.js.map +1 -0
- package/dist/ai/llm/types.d.ts +122 -0
- package/dist/ai/llm/types.d.ts.map +1 -0
- package/dist/ai/llm/types.js +33 -0
- package/dist/ai/llm/types.js.map +1 -0
- package/dist/ai/providers.d.ts +59 -0
- package/dist/ai/providers.d.ts.map +1 -0
- package/dist/ai/providers.js +54 -0
- package/dist/ai/providers.js.map +1 -0
- package/dist/ai/summarize.d.ts +25 -0
- package/dist/ai/summarize.d.ts.map +1 -0
- package/dist/ai/summarize.js +34 -0
- package/dist/ai/summarize.js.map +1 -0
- package/dist/ai/synthesize.d.ts +40 -0
- package/dist/ai/synthesize.d.ts.map +1 -0
- package/dist/ai/synthesize.js +230 -0
- package/dist/ai/synthesize.js.map +1 -0
- package/dist/ask/ask.d.ts +199 -0
- package/dist/ask/ask.d.ts.map +1 -0
- package/dist/ask/ask.js +1291 -0
- package/dist/ask/ask.js.map +1 -0
- package/dist/ask/file-rank.d.ts +72 -0
- package/dist/ask/file-rank.d.ts.map +1 -0
- package/dist/ask/file-rank.js +160 -0
- package/dist/ask/file-rank.js.map +1 -0
- package/dist/ask/file-selection.d.ts +22 -0
- package/dist/ask/file-selection.d.ts.map +1 -0
- package/dist/ask/file-selection.js +66 -0
- package/dist/ask/file-selection.js.map +1 -0
- package/dist/ask/fuse.d.ts +195 -0
- package/dist/ask/fuse.d.ts.map +1 -0
- package/dist/ask/fuse.js +344 -0
- package/dist/ask/fuse.js.map +1 -0
- package/dist/ask/graphrank.d.ts +61 -0
- package/dist/ask/graphrank.d.ts.map +1 -0
- package/dist/ask/graphrank.js +130 -0
- package/dist/ask/graphrank.js.map +1 -0
- package/dist/ask/index-file.d.ts +44 -0
- package/dist/ask/index-file.d.ts.map +1 -0
- package/dist/ask/index-file.js +128 -0
- package/dist/ask/index-file.js.map +1 -0
- package/dist/ask/semantic.d.ts +42 -0
- package/dist/ask/semantic.d.ts.map +1 -0
- package/dist/ask/semantic.js +293 -0
- package/dist/ask/semantic.js.map +1 -0
- package/dist/bin/graft.d.ts +3 -0
- package/dist/bin/graft.d.ts.map +1 -0
- package/dist/bin/graft.js +14 -0
- package/dist/bin/graft.js.map +1 -0
- package/dist/bin/trail.d.ts +3 -0
- package/dist/bin/trail.d.ts.map +1 -0
- package/dist/bin/trail.js +13 -0
- package/dist/bin/trail.js.map +1 -0
- package/dist/blast/blast-cli.d.ts +35 -0
- package/dist/blast/blast-cli.d.ts.map +1 -0
- package/dist/blast/blast-cli.js +155 -0
- package/dist/blast/blast-cli.js.map +1 -0
- package/dist/blast/blast.d.ts +128 -0
- package/dist/blast/blast.d.ts.map +1 -0
- package/dist/blast/blast.js +383 -0
- package/dist/blast/blast.js.map +1 -0
- package/dist/blast/diff.d.ts +53 -0
- package/dist/blast/diff.d.ts.map +1 -0
- package/dist/blast/diff.js +193 -0
- package/dist/blast/diff.js.map +1 -0
- package/dist/blast/evidence.d.ts +51 -0
- package/dist/blast/evidence.d.ts.map +1 -0
- package/dist/blast/evidence.js +162 -0
- package/dist/blast/evidence.js.map +1 -0
- package/dist/blast/modules.d.ts +33 -0
- package/dist/blast/modules.d.ts.map +1 -0
- package/dist/blast/modules.js +83 -0
- package/dist/blast/modules.js.map +1 -0
- package/dist/blast/name.d.ts +74 -0
- package/dist/blast/name.d.ts.map +1 -0
- package/dist/blast/name.js +269 -0
- package/dist/blast/name.js.map +1 -0
- package/dist/blast/owners.d.ts +85 -0
- package/dist/blast/owners.d.ts.map +1 -0
- package/dist/blast/owners.js +272 -0
- package/dist/blast/owners.js.map +1 -0
- package/dist/blast/render.d.ts +46 -0
- package/dist/blast/render.d.ts.map +1 -0
- package/dist/blast/render.js +422 -0
- package/dist/blast/render.js.map +1 -0
- package/dist/blast/viz.d.ts +37 -0
- package/dist/blast/viz.d.ts.map +1 -0
- package/dist/blast/viz.js +180 -0
- package/dist/blast/viz.js.map +1 -0
- package/dist/brand.d.ts +111 -0
- package/dist/brand.d.ts.map +1 -0
- package/dist/brand.js +282 -0
- package/dist/brand.js.map +1 -0
- package/dist/claude/build-progress.d.ts +30 -0
- package/dist/claude/build-progress.d.ts.map +1 -0
- package/dist/claude/build-progress.js +81 -0
- package/dist/claude/build-progress.js.map +1 -0
- package/dist/claude/hermes-skill-template.d.ts +16 -0
- package/dist/claude/hermes-skill-template.d.ts.map +1 -0
- package/dist/claude/hermes-skill-template.js +154 -0
- package/dist/claude/hermes-skill-template.js.map +1 -0
- package/dist/claude/init.d.ts +65 -0
- package/dist/claude/init.d.ts.map +1 -0
- package/dist/claude/init.js +258 -0
- package/dist/claude/init.js.map +1 -0
- package/dist/claude/paths.d.ts +9 -0
- package/dist/claude/paths.d.ts.map +1 -0
- package/dist/claude/paths.js +22 -0
- package/dist/claude/paths.js.map +1 -0
- package/dist/claude/session-metrics.d.ts +73 -0
- package/dist/claude/session-metrics.d.ts.map +1 -0
- package/dist/claude/session-metrics.js +209 -0
- package/dist/claude/session-metrics.js.map +1 -0
- package/dist/claude/settings-merge.d.ts +76 -0
- package/dist/claude/settings-merge.d.ts.map +1 -0
- package/dist/claude/settings-merge.js +283 -0
- package/dist/claude/settings-merge.js.map +1 -0
- package/dist/claude/skill-template.d.ts +13 -0
- package/dist/claude/skill-template.d.ts.map +1 -0
- package/dist/claude/skill-template.js +290 -0
- package/dist/claude/skill-template.js.map +1 -0
- package/dist/claude/state.d.ts +85 -0
- package/dist/claude/state.d.ts.map +1 -0
- package/dist/claude/state.js +88 -0
- package/dist/claude/state.js.map +1 -0
- package/dist/claude/stats.d.ts +5 -0
- package/dist/claude/stats.d.ts.map +1 -0
- package/dist/claude/stats.js +24 -0
- package/dist/claude/stats.js.map +1 -0
- package/dist/cli-epilogue.d.ts +12 -0
- package/dist/cli-epilogue.d.ts.map +1 -0
- package/dist/cli-epilogue.js +72 -0
- package/dist/cli-epilogue.js.map +1 -0
- package/dist/cli-meta.d.ts +82 -0
- package/dist/cli-meta.d.ts.map +1 -0
- package/dist/cli-meta.js +238 -0
- package/dist/cli-meta.js.map +1 -0
- package/dist/cli-picker.d.ts +139 -0
- package/dist/cli-picker.d.ts.map +1 -0
- package/dist/cli-picker.js +439 -0
- package/dist/cli-picker.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1638 -0
- package/dist/cli.js.map +1 -0
- package/dist/context/batches.d.ts +29 -0
- package/dist/context/batches.d.ts.map +1 -0
- package/dist/context/batches.js +130 -0
- package/dist/context/batches.js.map +1 -0
- package/dist/context/build.d.ts +57 -0
- package/dist/context/build.d.ts.map +1 -0
- package/dist/context/build.js +396 -0
- package/dist/context/build.js.map +1 -0
- package/dist/context/check.d.ts +42 -0
- package/dist/context/check.d.ts.map +1 -0
- package/dist/context/check.js +162 -0
- package/dist/context/check.js.map +1 -0
- package/dist/context/map-dir.d.ts +13 -0
- package/dist/context/map-dir.d.ts.map +1 -0
- package/dist/context/map-dir.js +81 -0
- package/dist/context/map-dir.js.map +1 -0
- package/dist/context/node-file.d.ts +109 -0
- package/dist/context/node-file.d.ts.map +1 -0
- package/dist/context/node-file.js +390 -0
- package/dist/context/node-file.js.map +1 -0
- package/dist/context/price.d.ts +49 -0
- package/dist/context/price.d.ts.map +1 -0
- package/dist/context/price.js +83 -0
- package/dist/context/price.js.map +1 -0
- package/dist/context/savings.d.ts +67 -0
- package/dist/context/savings.d.ts.map +1 -0
- package/dist/context/savings.js +125 -0
- package/dist/context/savings.js.map +1 -0
- package/dist/engine.d.ts +85 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +122 -0
- package/dist/engine.js.map +1 -0
- package/dist/graph/bindings.d.ts +64 -0
- package/dist/graph/bindings.d.ts.map +1 -0
- package/dist/graph/bindings.js +713 -0
- package/dist/graph/bindings.js.map +1 -0
- package/dist/graph/build-run.d.ts +25 -0
- package/dist/graph/build-run.d.ts.map +1 -0
- package/dist/graph/build-run.js +121 -0
- package/dist/graph/build-run.js.map +1 -0
- package/dist/graph/build.d.ts +88 -0
- package/dist/graph/build.d.ts.map +1 -0
- package/dist/graph/build.js +386 -0
- package/dist/graph/build.js.map +1 -0
- package/dist/graph/cards.d.ts +46 -0
- package/dist/graph/cards.d.ts.map +1 -0
- package/dist/graph/cards.js +280 -0
- package/dist/graph/cards.js.map +1 -0
- package/dist/graph/check.d.ts +25 -0
- package/dist/graph/check.d.ts.map +1 -0
- package/dist/graph/check.js +192 -0
- package/dist/graph/check.js.map +1 -0
- package/dist/graph/container.d.ts +63 -0
- package/dist/graph/container.d.ts.map +1 -0
- package/dist/graph/container.js +191 -0
- package/dist/graph/container.js.map +1 -0
- package/dist/graph/depth-parser.d.ts +61 -0
- package/dist/graph/depth-parser.d.ts.map +1 -0
- package/dist/graph/depth-parser.js +153 -0
- package/dist/graph/depth-parser.js.map +1 -0
- package/dist/graph/enrich.d.ts +62 -0
- package/dist/graph/enrich.d.ts.map +1 -0
- package/dist/graph/enrich.js +258 -0
- package/dist/graph/enrich.js.map +1 -0
- package/dist/graph/extract-cache.d.ts +101 -0
- package/dist/graph/extract-cache.d.ts.map +1 -0
- package/dist/graph/extract-cache.js +199 -0
- package/dist/graph/extract-cache.js.map +1 -0
- package/dist/graph/extract.d.ts +85 -0
- package/dist/graph/extract.d.ts.map +1 -0
- package/dist/graph/extract.js +2377 -0
- package/dist/graph/extract.js.map +1 -0
- package/dist/graph/fingerprint.d.ts +76 -0
- package/dist/graph/fingerprint.d.ts.map +1 -0
- package/dist/graph/fingerprint.js +160 -0
- package/dist/graph/fingerprint.js.map +1 -0
- package/dist/graph/generic.d.ts +74 -0
- package/dist/graph/generic.d.ts.map +1 -0
- package/dist/graph/generic.js +773 -0
- package/dist/graph/generic.js.map +1 -0
- package/dist/graph/invariants.d.ts +33 -0
- package/dist/graph/invariants.d.ts.map +1 -0
- package/dist/graph/invariants.js +52 -0
- package/dist/graph/invariants.js.map +1 -0
- package/dist/graph/load.d.ts +29 -0
- package/dist/graph/load.d.ts.map +1 -0
- package/dist/graph/load.js +97 -0
- package/dist/graph/load.js.map +1 -0
- package/dist/graph/lsp/client.d.ts +61 -0
- package/dist/graph/lsp/client.d.ts.map +1 -0
- package/dist/graph/lsp/client.js +217 -0
- package/dist/graph/lsp/client.js.map +1 -0
- package/dist/graph/lsp/enrich.d.ts +11 -0
- package/dist/graph/lsp/enrich.d.ts.map +1 -0
- package/dist/graph/lsp/enrich.js +163 -0
- package/dist/graph/lsp/enrich.js.map +1 -0
- package/dist/graph/lsp/registry.d.ts +22 -0
- package/dist/graph/lsp/registry.d.ts.map +1 -0
- package/dist/graph/lsp/registry.js +71 -0
- package/dist/graph/lsp/registry.js.map +1 -0
- package/dist/graph/map.d.ts +107 -0
- package/dist/graph/map.d.ts.map +1 -0
- package/dist/graph/map.js +239 -0
- package/dist/graph/map.js.map +1 -0
- package/dist/graph/markdown.d.ts +22 -0
- package/dist/graph/markdown.d.ts.map +1 -0
- package/dist/graph/markdown.js +143 -0
- package/dist/graph/markdown.js.map +1 -0
- package/dist/graph/native.d.ts +46 -0
- package/dist/graph/native.d.ts.map +1 -0
- package/dist/graph/native.js +169 -0
- package/dist/graph/native.js.map +1 -0
- package/dist/graph/queries/c.scm +13 -0
- package/dist/graph/queries/c_sharp.scm +19 -0
- package/dist/graph/queries/clojure.scm +58 -0
- package/dist/graph/queries/cpp.scm +23 -0
- package/dist/graph/queries/dart.scm +42 -0
- package/dist/graph/queries/elixir.scm +54 -0
- package/dist/graph/queries/gleam.scm +51 -0
- package/dist/graph/queries/java.scm +20 -0
- package/dist/graph/queries/kotlin.scm +43 -0
- package/dist/graph/queries/lua.scm +36 -0
- package/dist/graph/queries/nix.scm +32 -0
- package/dist/graph/queries/php.scm +40 -0
- package/dist/graph/queries/ruby.scm +65 -0
- package/dist/graph/queries/rust.scm +41 -0
- package/dist/graph/queries/scala.scm +66 -0
- package/dist/graph/queries/solidity.scm +43 -0
- package/dist/graph/queries/swift.scm +51 -0
- package/dist/graph/refresh.d.ts +106 -0
- package/dist/graph/refresh.d.ts.map +1 -0
- package/dist/graph/refresh.js +430 -0
- package/dist/graph/refresh.js.map +1 -0
- package/dist/graph/relations.d.ts +14 -0
- package/dist/graph/relations.d.ts.map +1 -0
- package/dist/graph/relations.js +8 -0
- package/dist/graph/relations.js.map +1 -0
- package/dist/graph/resolve.d.ts +17 -0
- package/dist/graph/resolve.d.ts.map +1 -0
- package/dist/graph/resolve.js +716 -0
- package/dist/graph/resolve.js.map +1 -0
- package/dist/graph/root.d.ts +11 -0
- package/dist/graph/root.d.ts.map +1 -0
- package/dist/graph/root.js +40 -0
- package/dist/graph/root.js.map +1 -0
- package/dist/graph/scopes.d.ts +40 -0
- package/dist/graph/scopes.d.ts.map +1 -0
- package/dist/graph/scopes.js +383 -0
- package/dist/graph/scopes.js.map +1 -0
- package/dist/graph/seed.d.ts +38 -0
- package/dist/graph/seed.d.ts.map +1 -0
- package/dist/graph/seed.js +229 -0
- package/dist/graph/seed.js.map +1 -0
- package/dist/graph/source-files.d.ts +46 -0
- package/dist/graph/source-files.d.ts.map +1 -0
- package/dist/graph/source-files.js +118 -0
- package/dist/graph/source-files.js.map +1 -0
- package/dist/graph/traverse-cli.d.ts +55 -0
- package/dist/graph/traverse-cli.d.ts.map +1 -0
- package/dist/graph/traverse-cli.js +189 -0
- package/dist/graph/traverse-cli.js.map +1 -0
- package/dist/graph/traverse.d.ts +112 -0
- package/dist/graph/traverse.d.ts.map +1 -0
- package/dist/graph/traverse.js +192 -0
- package/dist/graph/traverse.js.map +1 -0
- package/dist/graph/types.d.ts +78 -0
- package/dist/graph/types.d.ts.map +1 -0
- package/dist/graph/types.js +14 -0
- package/dist/graph/types.js.map +1 -0
- package/dist/graph/wasm-runtime.d.ts +19 -0
- package/dist/graph/wasm-runtime.d.ts.map +1 -0
- package/dist/graph/wasm-runtime.js +38 -0
- package/dist/graph/wasm-runtime.js.map +1 -0
- package/dist/graph/workspace-cli.d.ts +56 -0
- package/dist/graph/workspace-cli.d.ts.map +1 -0
- package/dist/graph/workspace-cli.js +111 -0
- package/dist/graph/workspace-cli.js.map +1 -0
- package/dist/graph/workspace.d.ts +172 -0
- package/dist/graph/workspace.d.ts.map +1 -0
- package/dist/graph/workspace.js +714 -0
- package/dist/graph/workspace.js.map +1 -0
- package/dist/graph/write.d.ts +13 -0
- package/dist/graph/write.d.ts.map +1 -0
- package/dist/graph/write.js +86 -0
- package/dist/graph/write.js.map +1 -0
- package/dist/hosts/antigravity.d.ts +14 -0
- package/dist/hosts/antigravity.d.ts.map +1 -0
- package/dist/hosts/antigravity.js +59 -0
- package/dist/hosts/antigravity.js.map +1 -0
- package/dist/hosts/auto.d.ts +37 -0
- package/dist/hosts/auto.d.ts.map +1 -0
- package/dist/hosts/auto.js +141 -0
- package/dist/hosts/auto.js.map +1 -0
- package/dist/hosts/claude-global.d.ts +72 -0
- package/dist/hosts/claude-global.d.ts.map +1 -0
- package/dist/hosts/claude-global.js +230 -0
- package/dist/hosts/claude-global.js.map +1 -0
- package/dist/hosts/config-write.d.ts +36 -0
- package/dist/hosts/config-write.d.ts.map +1 -0
- package/dist/hosts/config-write.js +64 -0
- package/dist/hosts/config-write.js.map +1 -0
- package/dist/hosts/init.d.ts +28 -0
- package/dist/hosts/init.d.ts.map +1 -0
- package/dist/hosts/init.js +89 -0
- package/dist/hosts/init.js.map +1 -0
- package/dist/hosts/instructions.d.ts +14 -0
- package/dist/hosts/instructions.d.ts.map +1 -0
- package/dist/hosts/instructions.js +95 -0
- package/dist/hosts/instructions.js.map +1 -0
- package/dist/hosts/mcp-config.d.ts +78 -0
- package/dist/hosts/mcp-config.d.ts.map +1 -0
- package/dist/hosts/mcp-config.js +251 -0
- package/dist/hosts/mcp-config.js.map +1 -0
- package/dist/hosts/plan.d.ts +32 -0
- package/dist/hosts/plan.d.ts.map +1 -0
- package/dist/hosts/plan.js +73 -0
- package/dist/hosts/plan.js.map +1 -0
- package/dist/hosts/registry.d.ts +41 -0
- package/dist/hosts/registry.d.ts.map +1 -0
- package/dist/hosts/registry.js +164 -0
- package/dist/hosts/registry.js.map +1 -0
- package/dist/hosts/retract.d.ts +47 -0
- package/dist/hosts/retract.d.ts.map +1 -0
- package/dist/hosts/retract.js +520 -0
- package/dist/hosts/retract.js.map +1 -0
- package/dist/hosts/sections.d.ts +47 -0
- package/dist/hosts/sections.d.ts.map +1 -0
- package/dist/hosts/sections.js +127 -0
- package/dist/hosts/sections.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/ingest/fs.d.ts +79 -0
- package/dist/ingest/fs.d.ts.map +1 -0
- package/dist/ingest/fs.js +306 -0
- package/dist/ingest/fs.js.map +1 -0
- package/dist/init-guard.d.ts +16 -0
- package/dist/init-guard.d.ts.map +1 -0
- package/dist/init-guard.js +27 -0
- package/dist/init-guard.js.map +1 -0
- package/dist/mcp/instructions.d.ts +5 -0
- package/dist/mcp/instructions.d.ts.map +1 -0
- package/dist/mcp/instructions.js +64 -0
- package/dist/mcp/instructions.js.map +1 -0
- package/dist/mcp/kept-listing.d.ts +27 -0
- package/dist/mcp/kept-listing.d.ts.map +1 -0
- package/dist/mcp/kept-listing.js +63 -0
- package/dist/mcp/kept-listing.js.map +1 -0
- package/dist/mcp/server.d.ts +4 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +147 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tool-names.d.ts +27 -0
- package/dist/mcp/tool-names.d.ts.map +1 -0
- package/dist/mcp/tool-names.js +47 -0
- package/dist/mcp/tool-names.js.map +1 -0
- package/dist/mcp/tools.d.ts +22 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +440 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/node-version.d.ts +15 -0
- package/dist/node-version.d.ts.map +1 -0
- package/dist/node-version.js +23 -0
- package/dist/node-version.js.map +1 -0
- package/dist/search/grep-cli.d.ts +35 -0
- package/dist/search/grep-cli.d.ts.map +1 -0
- package/dist/search/grep-cli.js +115 -0
- package/dist/search/grep-cli.js.map +1 -0
- package/dist/search/grep.d.ts +60 -0
- package/dist/search/grep.d.ts.map +1 -0
- package/dist/search/grep.js +143 -0
- package/dist/search/grep.js.map +1 -0
- package/dist/search/ignored-code.d.ts +9 -0
- package/dist/search/ignored-code.d.ts.map +1 -0
- package/dist/search/ignored-code.js +73 -0
- package/dist/search/ignored-code.js.map +1 -0
- package/dist/search/user-regexp.d.ts +26 -0
- package/dist/search/user-regexp.d.ts.map +1 -0
- package/dist/search/user-regexp.js +150 -0
- package/dist/search/user-regexp.js.map +1 -0
- package/dist/telemetry/contract.d.ts +117 -0
- package/dist/telemetry/contract.d.ts.map +1 -0
- package/dist/telemetry/contract.js +341 -0
- package/dist/telemetry/contract.js.map +1 -0
- package/dist/telemetry/flush.d.ts +21 -0
- package/dist/telemetry/flush.d.ts.map +1 -0
- package/dist/telemetry/flush.js +85 -0
- package/dist/telemetry/flush.js.map +1 -0
- package/dist/telemetry/gate.d.ts +30 -0
- package/dist/telemetry/gate.d.ts.map +1 -0
- package/dist/telemetry/gate.js +81 -0
- package/dist/telemetry/gate.js.map +1 -0
- package/dist/telemetry/identity.d.ts +40 -0
- package/dist/telemetry/identity.d.ts.map +1 -0
- package/dist/telemetry/identity.js +80 -0
- package/dist/telemetry/identity.js.map +1 -0
- package/dist/telemetry/index.d.ts +18 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +16 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/key.d.ts +21 -0
- package/dist/telemetry/key.d.ts.map +1 -0
- package/dist/telemetry/key.js +49 -0
- package/dist/telemetry/key.js.map +1 -0
- package/dist/telemetry/notice.d.ts +19 -0
- package/dist/telemetry/notice.d.ts.map +1 -0
- package/dist/telemetry/notice.js +93 -0
- package/dist/telemetry/notice.js.map +1 -0
- package/dist/telemetry/queue.d.ts +35 -0
- package/dist/telemetry/queue.d.ts.map +1 -0
- package/dist/telemetry/queue.js +162 -0
- package/dist/telemetry/queue.js.map +1 -0
- package/dist/telemetry/send.d.ts +19 -0
- package/dist/telemetry/send.d.ts.map +1 -0
- package/dist/telemetry/send.js +84 -0
- package/dist/telemetry/send.js.map +1 -0
- package/dist/telemetry/sessions.d.ts +25 -0
- package/dist/telemetry/sessions.d.ts.map +1 -0
- package/dist/telemetry/sessions.js +104 -0
- package/dist/telemetry/sessions.js.map +1 -0
- package/dist/telemetry/track.d.ts +62 -0
- package/dist/telemetry/track.d.ts.map +1 -0
- package/dist/telemetry/track.js +143 -0
- package/dist/telemetry/track.js.map +1 -0
- package/dist/upkeep-run.d.ts +22 -0
- package/dist/upkeep-run.d.ts.map +1 -0
- package/dist/upkeep-run.js +85 -0
- package/dist/upkeep-run.js.map +1 -0
- package/dist/upkeep.d.ts +127 -0
- package/dist/upkeep.d.ts.map +1 -0
- package/dist/upkeep.js +252 -0
- package/dist/upkeep.js.map +1 -0
- package/dist/util/actions-folder.d.ts +2 -0
- package/dist/util/actions-folder.d.ts.map +1 -0
- package/dist/util/actions-folder.js +9 -0
- package/dist/util/actions-folder.js.map +1 -0
- package/dist/util/browser.d.ts +3 -0
- package/dist/util/browser.d.ts.map +1 -0
- package/dist/util/browser.js +14 -0
- package/dist/util/browser.js.map +1 -0
- package/dist/util/child-process.d.ts +15 -0
- package/dist/util/child-process.d.ts.map +1 -0
- package/dist/util/child-process.js +15 -0
- package/dist/util/child-process.js.map +1 -0
- package/dist/util/front-matter.d.ts +46 -0
- package/dist/util/front-matter.d.ts.map +1 -0
- package/dist/util/front-matter.js +113 -0
- package/dist/util/front-matter.js.map +1 -0
- package/dist/util/id.d.ts +7 -0
- package/dist/util/id.d.ts.map +1 -0
- package/dist/util/id.js +14 -0
- package/dist/util/id.js.map +1 -0
- package/dist/util/paths.d.ts +29 -0
- package/dist/util/paths.d.ts.map +1 -0
- package/dist/util/paths.js +71 -0
- package/dist/util/paths.js.map +1 -0
- package/dist/util/private-file.d.ts +14 -0
- package/dist/util/private-file.d.ts.map +1 -0
- package/dist/util/private-file.js +82 -0
- package/dist/util/private-file.js.map +1 -0
- package/dist/util/source.d.ts +4 -0
- package/dist/util/source.d.ts.map +1 -0
- package/dist/util/source.js +12 -0
- package/dist/util/source.js.map +1 -0
- package/dist/util/spinner.d.ts +15 -0
- package/dist/util/spinner.d.ts.map +1 -0
- package/dist/util/spinner.js +52 -0
- package/dist/util/spinner.js.map +1 -0
- package/dist/util/state.d.ts +120 -0
- package/dist/util/state.d.ts.map +1 -0
- package/dist/util/state.js +264 -0
- package/dist/util/state.js.map +1 -0
- package/dist/vendor/grammars/tree-sitter-go.LICENSE +21 -0
- package/dist/vendor/grammars/tree-sitter-go.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-java.LICENSE +21 -0
- package/dist/vendor/grammars/tree-sitter-java.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-kotlin.LICENSE +9 -0
- package/dist/vendor/grammars/tree-sitter-kotlin.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-php.LICENSE +22 -0
- package/dist/vendor/grammars/tree-sitter-php.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-python.LICENSE +21 -0
- package/dist/vendor/grammars/tree-sitter-python.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-r.LICENSE +9 -0
- package/dist/vendor/grammars/tree-sitter-r.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-swift.LICENSE +21 -0
- package/dist/vendor/grammars/tree-sitter-swift.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-tsx.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-typescript.LICENSE +21 -0
- package/dist/vendor/grammars/tree-sitter-typescript.wasm +0 -0
- package/dist/viewer/app.js +2 -0
- package/dist/viewer/index.html +49 -0
- package/dist/viewer/style.css +154 -0
- package/dist/viz/assemble.d.ts +83 -0
- package/dist/viz/assemble.d.ts.map +1 -0
- package/dist/viz/assemble.js +101 -0
- package/dist/viz/assemble.js.map +1 -0
- package/dist/viz/export.d.ts +39 -0
- package/dist/viz/export.d.ts.map +1 -0
- package/dist/viz/export.js +98 -0
- package/dist/viz/export.js.map +1 -0
- package/dist/viz/serve.d.ts +13 -0
- package/dist/viz/serve.d.ts.map +1 -0
- package/dist/viz/serve.js +130 -0
- package/dist/viz/serve.js.map +1 -0
- package/package.json +115 -4
- package/scripts/build-grammar-wasm.mjs +112 -0
- package/scripts/build-viewer.mjs +44 -0
- package/scripts/graph-quality.mjs +117 -0
- package/scripts/pack-trail.mjs +53 -0
- package/scripts/postinstall.mjs +65 -0
- package/scripts/run-tests.mjs +72 -0
- package/scripts/stamp-telemetry-key.mjs +56 -0
- package/scripts/tally-audit.mjs +140 -0
- package/scripts/vendor-grammars.mjs +53 -0
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { recoverToolArgsFromContent, warnToolChoiceIgnored } from "./llm/recover-tool.js";
|
|
2
|
+
const SYSTEM_PROMPT = `You build an ARCHITECTURE graph of a codebase from per-file summaries. The reader is an AI agent that will read this graph before working on the code, so it must describe the system at the level a senior engineer would explain it — not file by file.
|
|
3
|
+
|
|
4
|
+
Produce a CURATED set of nodes of mixed granularity:
|
|
5
|
+
- "system" nodes: GROUP files that collaborate as one component (usually a directory or a cohesive set) into a SINGLE node. This should be the most common node type. Prefer one system node over several file nodes.
|
|
6
|
+
- "file" nodes: only for a substantial, standalone module that genuinely deserves its own node apart from its system.
|
|
7
|
+
- "concept" nodes: cross-cutting ideas, design decisions, or invariants that span multiple files (e.g. "local-first provider fallback", "staleness checking", "content-hash provenance"). Include several — they are the most valuable nodes for an agent.
|
|
8
|
+
|
|
9
|
+
Rules:
|
|
10
|
+
- Every summary must earn its tokens with NON-OBVIOUS information: invariants, ordering constraints, conventions, failure modes, "X must never happen after Y" facts, and the WHY behind a design. Never restate what a README says or what a directory listing already makes obvious ("src/api contains the API code" is worthless); an agent reading the node already sees the file paths. If all you can say about a group of files is what their names say, fold them into a larger node instead.
|
|
11
|
+
- Strongly prefer FEWER, larger, meaningful nodes. For a repo of N files, aim for well under N nodes. Do NOT emit one node per file, and never a node per incidental identifier (a local interface, helper, or third-party symbol).
|
|
12
|
+
- Merge duplicates and surface-form variants into one node.
|
|
13
|
+
- For each node give: a canonical human-readable name; a type ("system" | "file" | "concept"); a 1-3 sentence summary of its ROLE in the system; "sources" = the exact file paths (from the input) it is grounded in (a system lists all its files; a concept lists the files that motivate it); and "links" to other nodes you define, each with a relation and a short description of what concretely happens in the code.
|
|
14
|
+
- The relation MUST be one of exactly these verbs (each answers a question a code reviewer asks): "part_of" (where does this live?), "uses" (what breaks if the target changes?), "depends_on" (same, for non-call dependencies), "produces" (where does this output come from?), "configures" (what changes its behavior without a code change?), "validates" (what checks or judges this? tests, drift checks, scoring), "implements" (what contract must this honor?). Never invent vague relations like "influences", "supports", or "relates_to" — if none of the verbs fit, drop the link.
|
|
15
|
+
- Only link to nodes you actually define in this response.
|
|
16
|
+
Respond only via the record_graph tool / JSON schema.`;
|
|
17
|
+
const NODES_SCHEMA = {
|
|
18
|
+
type: "object",
|
|
19
|
+
properties: {
|
|
20
|
+
nodes: {
|
|
21
|
+
type: "array",
|
|
22
|
+
items: {
|
|
23
|
+
type: "object",
|
|
24
|
+
properties: {
|
|
25
|
+
name: { type: "string" },
|
|
26
|
+
type: { type: "string" },
|
|
27
|
+
summary: { type: "string" },
|
|
28
|
+
sources: { type: "array", items: { type: "string" } },
|
|
29
|
+
links: {
|
|
30
|
+
type: "array",
|
|
31
|
+
items: {
|
|
32
|
+
type: "object",
|
|
33
|
+
properties: {
|
|
34
|
+
to: { type: "string" },
|
|
35
|
+
relation: {
|
|
36
|
+
type: "string",
|
|
37
|
+
enum: ["part_of", "uses", "depends_on", "produces", "configures", "validates", "implements"],
|
|
38
|
+
},
|
|
39
|
+
description: { type: "string" },
|
|
40
|
+
},
|
|
41
|
+
required: ["to", "relation"],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
required: ["name", "type", "summary", "sources"],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
required: ["nodes"],
|
|
50
|
+
};
|
|
51
|
+
/** Cap the total summary text sent in one call so it never blows the context. */
|
|
52
|
+
const MAX_INPUT_CHARS = 60_000;
|
|
53
|
+
function userContent(files) {
|
|
54
|
+
const body = files.map((f) => `## ${f.path}\n\n${f.summary}`).join("\n\n");
|
|
55
|
+
return body.length > MAX_INPUT_CHARS
|
|
56
|
+
? `${body.slice(0, MAX_INPUT_CHARS)}\n… (truncated)`
|
|
57
|
+
: body;
|
|
58
|
+
}
|
|
59
|
+
/** Normalize a raw model response into clean {@link SynthNode}s. */
|
|
60
|
+
function clean(nodes) {
|
|
61
|
+
if (!Array.isArray(nodes))
|
|
62
|
+
return [];
|
|
63
|
+
const out = [];
|
|
64
|
+
for (const n of nodes) {
|
|
65
|
+
if (!n || typeof n.name !== "string" || typeof n.type !== "string")
|
|
66
|
+
continue;
|
|
67
|
+
out.push({
|
|
68
|
+
name: n.name,
|
|
69
|
+
type: n.type,
|
|
70
|
+
summary: typeof n.summary === "string" ? n.summary : "",
|
|
71
|
+
sources: Array.isArray(n.sources) ? n.sources.filter((s) => typeof s === "string") : [],
|
|
72
|
+
links: Array.isArray(n.links)
|
|
73
|
+
? n.links
|
|
74
|
+
.filter((l) => l && typeof l.to === "string" && typeof l.relation === "string")
|
|
75
|
+
.map((l) => ({
|
|
76
|
+
to: l.to,
|
|
77
|
+
relation: l.relation,
|
|
78
|
+
description: typeof l.description === "string" ? l.description : undefined,
|
|
79
|
+
}))
|
|
80
|
+
: [],
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A forced `record_graph` call can still deliver `nodes` as a JSON *string*
|
|
87
|
+
* (double-encoded args). `clean` would then return [] and the CLI ticked
|
|
88
|
+
* `✓ concepts: 0 nodes` (#383). Parse, then salvage balanced `{"name":…}`
|
|
89
|
+
* objects if a stray brace breaks the string. Do not reuse recover-tool —
|
|
90
|
+
* that path only runs when there is no tool-call args object.
|
|
91
|
+
*/
|
|
92
|
+
function coerceRecordGraphNodes(nodes, toolCalls) {
|
|
93
|
+
if (Array.isArray(nodes))
|
|
94
|
+
return nodes;
|
|
95
|
+
if (typeof nodes !== "string")
|
|
96
|
+
return [];
|
|
97
|
+
let parsed;
|
|
98
|
+
let salvaged = 0;
|
|
99
|
+
try {
|
|
100
|
+
parsed = JSON.parse(nodes);
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
const objs = salvageNamedObjects(nodes);
|
|
104
|
+
parsed = objs;
|
|
105
|
+
salvaged = objs.length;
|
|
106
|
+
}
|
|
107
|
+
const values = Array.isArray(parsed) ? parsed : [];
|
|
108
|
+
const salvageBit = salvaged > 0 ? ` — salvaged ${salvaged} node(s) from malformed JSON` : "";
|
|
109
|
+
console.error(`⚠ synthesize: tool call returned "nodes" as a ${nodes.length}-char string, not an array; ${toolCalls} tool call(s)${salvageBit}`);
|
|
110
|
+
return values;
|
|
111
|
+
}
|
|
112
|
+
/** Pull complete `{"name":…}` objects out of a near-JSON string. */
|
|
113
|
+
function salvageNamedObjects(raw) {
|
|
114
|
+
const out = [];
|
|
115
|
+
for (let i = 0; i < raw.length;) {
|
|
116
|
+
const start = raw.indexOf("{", i);
|
|
117
|
+
if (start === -1)
|
|
118
|
+
break;
|
|
119
|
+
const end = balancedClose(raw, start);
|
|
120
|
+
if (end === -1) {
|
|
121
|
+
i = start + 1;
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
const obj = JSON.parse(raw.slice(start, end + 1));
|
|
126
|
+
if (obj && typeof obj === "object" && !Array.isArray(obj) && typeof obj.name === "string") {
|
|
127
|
+
out.push(obj);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
/* slice was not a complete object */
|
|
132
|
+
}
|
|
133
|
+
i = end + 1;
|
|
134
|
+
}
|
|
135
|
+
return out;
|
|
136
|
+
}
|
|
137
|
+
function balancedClose(raw, start) {
|
|
138
|
+
let depth = 0;
|
|
139
|
+
let inStr = false;
|
|
140
|
+
let escape = false;
|
|
141
|
+
for (let i = start; i < raw.length; i++) {
|
|
142
|
+
const c = raw[i];
|
|
143
|
+
if (inStr) {
|
|
144
|
+
if (escape) {
|
|
145
|
+
escape = false;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (c === "\\") {
|
|
149
|
+
escape = true;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (c === '"')
|
|
153
|
+
inStr = false;
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (c === '"') {
|
|
157
|
+
inStr = true;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (c === "{")
|
|
161
|
+
depth++;
|
|
162
|
+
else if (c === "}") {
|
|
163
|
+
depth--;
|
|
164
|
+
if (depth === 0)
|
|
165
|
+
return i;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return -1;
|
|
169
|
+
}
|
|
170
|
+
function shapeOfNodes(nodes) {
|
|
171
|
+
if (typeof nodes === "string")
|
|
172
|
+
return `"nodes" is string, ${nodes.length} chars`;
|
|
173
|
+
if (Array.isArray(nodes))
|
|
174
|
+
return `"nodes" is array, ${nodes.length} entries`;
|
|
175
|
+
if (nodes === undefined)
|
|
176
|
+
return `"nodes" is undefined`;
|
|
177
|
+
return `"nodes" is ${typeof nodes}`;
|
|
178
|
+
}
|
|
179
|
+
const RECORD_TOOL = "record_graph";
|
|
180
|
+
/** Synthesizer backed by any {@link ChatModel} via forced tool calling. */
|
|
181
|
+
export class ChatSynthesizer {
|
|
182
|
+
model;
|
|
183
|
+
constructor(model) {
|
|
184
|
+
this.model = model;
|
|
185
|
+
}
|
|
186
|
+
async synthesize(files) {
|
|
187
|
+
if (files.length === 0)
|
|
188
|
+
return [];
|
|
189
|
+
const res = await this.model.create({
|
|
190
|
+
temperature: 0,
|
|
191
|
+
maxTokens: 8192,
|
|
192
|
+
tools: [
|
|
193
|
+
{
|
|
194
|
+
name: RECORD_TOOL,
|
|
195
|
+
description: "Record the curated architecture-graph nodes and their links.",
|
|
196
|
+
parameters: NODES_SCHEMA,
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
responseFormat: { kind: "tool", name: RECORD_TOOL },
|
|
200
|
+
messages: [
|
|
201
|
+
{ role: "system", content: SYSTEM_PROMPT },
|
|
202
|
+
{ role: "user", content: userContent(files) },
|
|
203
|
+
],
|
|
204
|
+
});
|
|
205
|
+
const raw = nodesFromResponse(res)?.nodes;
|
|
206
|
+
const out = clean(coerceRecordGraphNodes(raw, res.toolCalls.length));
|
|
207
|
+
if (out.length === 0) {
|
|
208
|
+
console.error(`⚠ synthesize: empty batch (${shapeOfNodes(raw)}; ${res.toolCalls.length} tool call(s))`);
|
|
209
|
+
}
|
|
210
|
+
return out;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Prefer a real tool call; if the gateway ignored `tool_choice` (#129), recover
|
|
215
|
+
* the same payload from `content`. Recovered args still go through {@link clean}.
|
|
216
|
+
*/
|
|
217
|
+
function nodesFromResponse(res) {
|
|
218
|
+
const call = res.toolCalls.find((c) => c.name === RECORD_TOOL) ?? res.toolCalls[0];
|
|
219
|
+
if (call?.args && typeof call.args === "object" && !Array.isArray(call.args)) {
|
|
220
|
+
return call.args;
|
|
221
|
+
}
|
|
222
|
+
const recovered = recoverToolArgsFromContent(res.text, {
|
|
223
|
+
toolNames: [RECORD_TOOL, "emit_json"],
|
|
224
|
+
payloadKey: "nodes",
|
|
225
|
+
});
|
|
226
|
+
if (!recovered)
|
|
227
|
+
warnToolChoiceIgnored("synthesize", res.text?.trim() ? "unparsed" : "empty");
|
|
228
|
+
return recovered;
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=synthesize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthesize.js","sourceRoot":"","sources":["../../src/ai/synthesize.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AA8B1F,MAAM,aAAa,GAAG;;;;;;;;;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AAE,CAAC;QAC7E,OAAO,IAAI,CAAC,IAA2B,CAAC;IAC1C,CAAC;IACD,MAAM,SAAS,GAAG,0BAA0B,CAAC,GAAG,CAAC,IAAI,EAAE;QACrD,SAAS,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC;QACrC,UAAU,EAAE,OAAO;KACpB,CAAC,CAAC;IACH,IAAI,CAAC,SAAS;QAAE,qBAAqB,CAAC,YAAY,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC7F,OAAO,SAA4C,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { type Savings } from "../context/savings.js";
|
|
2
|
+
import type { NodeV1, Relation } from "../graph/types.js";
|
|
3
|
+
export interface AskHit {
|
|
4
|
+
kind: "concept" | "symbol" | "caller" | "callee";
|
|
5
|
+
title: string;
|
|
6
|
+
/** A `file` or `file:Lx-Ly` pointer the agent can open directly. */
|
|
7
|
+
pointer: string;
|
|
8
|
+
snippet: string;
|
|
9
|
+
relation?: Relation;
|
|
10
|
+
related?: string[];
|
|
11
|
+
score: number;
|
|
12
|
+
/** The actual source at `pointer`, sliced from disk when `source` is on.
|
|
13
|
+
* This is what makes `ask` substitutive — the agent reads the span here
|
|
14
|
+
* instead of opening the file, so no source read happens on top of the query. */
|
|
15
|
+
code?: string;
|
|
16
|
+
/** Multi-scope repos only: the ranking scope (path prefix, "" = root) this
|
|
17
|
+
* hit was ranked within — answers "which sub-project is this from?". Drives
|
|
18
|
+
* the `[scope/] ` label in formatAsk. Absent on single-scope repos. */
|
|
19
|
+
scope?: string;
|
|
20
|
+
}
|
|
21
|
+
/** Internal file-aware ranking group. The first hit is the one document that
|
|
22
|
+
* participates in a higher-level ranker; the remaining hits are projected only
|
|
23
|
+
* after every ranked group has emitted its leader. */
|
|
24
|
+
export interface AskRankingGroup {
|
|
25
|
+
key: string;
|
|
26
|
+
hits: AskHit[];
|
|
27
|
+
/** Exact baseline-scored members of this group, in baseline order. Populated
|
|
28
|
+
* only in opt-in metadata so a workspace top lock never reuses a pooled
|
|
29
|
+
* leader score for a secondary span. */
|
|
30
|
+
baselineHits?: AskHit[];
|
|
31
|
+
coverage: number;
|
|
32
|
+
coverageStrong: number;
|
|
33
|
+
}
|
|
34
|
+
/** Internal metadata used by workspace federation to fuse file documents
|
|
35
|
+
* before projecting symbol spans. It is opt-in and never appears in normal
|
|
36
|
+
* CLI/API results. */
|
|
37
|
+
export interface AskRankingMetadata {
|
|
38
|
+
groups: AskRankingGroup[];
|
|
39
|
+
baseline: Array<{
|
|
40
|
+
group: string;
|
|
41
|
+
hit: AskHit;
|
|
42
|
+
}>;
|
|
43
|
+
baselineCoverage?: number;
|
|
44
|
+
baselineCoverageStrong?: number;
|
|
45
|
+
}
|
|
46
|
+
export interface AskResult {
|
|
47
|
+
query: string;
|
|
48
|
+
mode: "structural" | "lexical" | "empty";
|
|
49
|
+
/** For structural mode: the symbol whose neighbours we walked. */
|
|
50
|
+
subject?: string;
|
|
51
|
+
/** Authoritative result order. Lexical results preserve each hit's raw
|
|
52
|
+
* relevance score, but select distinct-file leaders before sibling spans, so
|
|
53
|
+
* callers must not re-sort this list by `score`. */
|
|
54
|
+
hits: AskHit[];
|
|
55
|
+
note?: string;
|
|
56
|
+
/** The repo keeps notes on this machine, so an empty `notes` means "none
|
|
57
|
+
* about this yet" rather than "this repo keeps no notes". */
|
|
58
|
+
notesChecked?: boolean;
|
|
59
|
+
/** One line about the notes, e.g. that this many would search better ranked. */
|
|
60
|
+
notesHint?: string;
|
|
61
|
+
/** Token-saving estimate, set only in `--source` (retriever) mode: the whole
|
|
62
|
+
* size of the distinct files these hits point into, i.e. the baseline cost of
|
|
63
|
+
* reading them instead of this pack. Computed from file sizes stored at build. */
|
|
64
|
+
saved?: {
|
|
65
|
+
files: number;
|
|
66
|
+
baselineChars: number;
|
|
67
|
+
};
|
|
68
|
+
/** Lexical mode only: share (0..1) of the query's distinct terms the TOP hit
|
|
69
|
+
* matched. A relevance signal for callers that inject packs unprompted (the
|
|
70
|
+
* Claude prompt hook): a low share means the query's words barely overlap the
|
|
71
|
+
* best result, i.e. the pack is probably noise for this prompt. Absent in
|
|
72
|
+
* structural mode — a resolved "who calls X" is itself the relevance signal. */
|
|
73
|
+
coverage?: number;
|
|
74
|
+
/** Like {@link coverage}, but the top hit's idf-weighted matched share over
|
|
75
|
+
* its NAME + PATH fields ONLY (body excluded) — a match-STRENGTH signal:
|
|
76
|
+
* "did the query hit a high-value field, or only incidental body tokens?".
|
|
77
|
+
* A body-only collision (a variable that happens to share a query word) has
|
|
78
|
+
* `coverageStrong === 0` while `coverage` can still look respectable. Used by
|
|
79
|
+
* workspace federation to gate a weak child out of the cross-repo ranking.
|
|
80
|
+
* Absent in structural mode; same lexical-only contract as `coverage`. */
|
|
81
|
+
coverageStrong?: number;
|
|
82
|
+
/** Multi-scope lexical results only: which scopes federated into the fused
|
|
83
|
+
* ranking, plus scopes that matched too weakly to federate (with their best
|
|
84
|
+
* doc id). Drives formatAsk's `matched in:` / `also matched:` footer.
|
|
85
|
+
* Absent on single-scope repos — zero output change there. */
|
|
86
|
+
scopes?: {
|
|
87
|
+
federated: string[];
|
|
88
|
+
alsoMatched: {
|
|
89
|
+
scope: string;
|
|
90
|
+
bestId: string;
|
|
91
|
+
}[];
|
|
92
|
+
};
|
|
93
|
+
/** @internal Opt-in latent file groups plus the exact pre-file-ranking list. */
|
|
94
|
+
ranking?: AskRankingMetadata;
|
|
95
|
+
}
|
|
96
|
+
/** Score a document's token counts against the query counts (name field
|
|
97
|
+
* pre-weighted by caller). Each shared term is weighted by its inverse document
|
|
98
|
+
* frequency (`idf`), so a word that appears in many nodes — "overlay" across a
|
|
99
|
+
* whole widget subsystem, or a repeated word in a pasted issue body — counts for
|
|
100
|
+
* far less than a rare, discriminating identifier ("scrolling"). Without idf,
|
|
101
|
+
* pure term-frequency lets an incidental common word dominate the ranking; this
|
|
102
|
+
* is the lexical half of the keyword-collision fix (graph-rank is the other). */
|
|
103
|
+
/** Test files rarely answer "how does X work" / "where is Y" — they mirror the
|
|
104
|
+
* real symbol's tokens, so a test can out-score the definition on a lexical tie
|
|
105
|
+
* and land as the top hit (observed: an `ask` returning a `Test…` function first,
|
|
106
|
+
* sending the agent to the wrong file). A multiplicative de-rank keeps tests in
|
|
107
|
+
* the results (they still matter for "where are the tests") but below the real
|
|
108
|
+
* definition. Covers Go (`_test.go`), JS/TS (`.test.` / `.spec.`), and test dirs. */
|
|
109
|
+
export declare function isTestPath(path: string): boolean;
|
|
110
|
+
/** Idf-weighted share (0..1) of the query a document matches: each query term
|
|
111
|
+
* counts by its rarity, so this separates task prompts from chatter in a way a
|
|
112
|
+
* raw term count can't. A conversational prompt's words are either off-corpus
|
|
113
|
+
* (rare → heavy, unmatched → sinks the ratio) or generic code words ("list",
|
|
114
|
+
* "write": common → near-weightless even when they collide with a symbol name);
|
|
115
|
+
* a task prompt matches exactly its rare, discriminating identifiers. Terms the
|
|
116
|
+
* corpus has never seen take `dfltIdf` (the df=0 weight). */
|
|
117
|
+
/** The match-STRENGTH share behind `coverageStrong`: idf-weighted share of the
|
|
118
|
+
* query matched in the node's NAME field ONLY. The PATH field is deliberately
|
|
119
|
+
* excluded — a coincidental generic directory (`gateway/`) or file basename
|
|
120
|
+
* (`gateway.ts`) in an unrelated repo would otherwise clear the strength gate
|
|
121
|
+
* and float that repo to the top; an on-topic path-organized repo is still
|
|
122
|
+
* rescued by the broad-coverage HIGH_FLOOR clause instead. For the same reason
|
|
123
|
+
* a `kind:"file"` node contributes zero strength: its `name` is a basename (a
|
|
124
|
+
* path component), not a symbol name, so a file whose basename happens to share
|
|
125
|
+
* a query word is not a strong match. */
|
|
126
|
+
export declare function strongShare(q: Map<string, number>, node: NodeV1, doc: {
|
|
127
|
+
name: Map<string, number>;
|
|
128
|
+
}, idf: Map<string, number>, dfltIdf: number): number;
|
|
129
|
+
export interface AskOptions {
|
|
130
|
+
contextDir?: string;
|
|
131
|
+
limit?: number;
|
|
132
|
+
/** Inline the source at each `path:Lx-Ly` hit, sliced from `dir`. Turns the
|
|
133
|
+
* pack from a locator into a retriever so the agent needn't re-open the file. */
|
|
134
|
+
source?: boolean;
|
|
135
|
+
/** Re-rank lexical hits by graph connectivity (personalized PageRank over the
|
|
136
|
+
* wiring edges), demoting same-word collisions and rescuing strongly-connected
|
|
137
|
+
* neighbours the query didn't name. On by default; set false for pure lexical. */
|
|
138
|
+
graphRank?: boolean;
|
|
139
|
+
/** With `source`: inline each hit's WHOLE definition span (capped at
|
|
140
|
+
* {@link MAX_SPAN_LINES}) instead of the default crux-first slice. The
|
|
141
|
+
* default inlines the ≤8-line LLM-chosen crux when a node has one — the
|
|
142
|
+
* decision point, ~10× cheaper than the full span — and the pack marks each
|
|
143
|
+
* crux so the agent knows `--full` (or the file itself) has the rest. */
|
|
144
|
+
full?: boolean;
|
|
145
|
+
/** Narrow the doc/node set to this path prefix BEFORE scoring (segment-aware,
|
|
146
|
+
* like `scopeOf` — "frontend" never matches "frontend-utils"). Per-scope
|
|
147
|
+
* IDF/BM25/walk come free: the filtered set is usually one scope, so the
|
|
148
|
+
* existing multi-scope machinery degrades to its single-scope passthrough
|
|
149
|
+
* with no scope labels. A prefix matching nothing indexed throws. */
|
|
150
|
+
in?: string;
|
|
151
|
+
/** @internal Defer file-first projection to a downstream authoritative
|
|
152
|
+
* ranking stage (currently workspace federation). Direct callers should
|
|
153
|
+
* leave this unset. */
|
|
154
|
+
fileFirst?: boolean;
|
|
155
|
+
/** @internal Bounded file scoring control. */
|
|
156
|
+
fileComplement?: boolean;
|
|
157
|
+
/** @internal Exact baseline top-hit lock. Requires bounded file
|
|
158
|
+
* scoring and composes it with the file-first frontier. */
|
|
159
|
+
fileTopLock?: boolean;
|
|
160
|
+
/** @internal Return latent file queues and the exact baseline list so a
|
|
161
|
+
* workspace parent can fuse files before projecting spans. */
|
|
162
|
+
includeRankingMetadata?: boolean;
|
|
163
|
+
}
|
|
164
|
+
/** Answer a query from the graft/ graph at `dir`. Deterministic, $0. */
|
|
165
|
+
export declare function ask(dir: string, query: string, opts?: AskOptions): AskResult;
|
|
166
|
+
export interface SkeletonEntry {
|
|
167
|
+
name: string;
|
|
168
|
+
kind: string;
|
|
169
|
+
span: string;
|
|
170
|
+
signature: string | null;
|
|
171
|
+
/** First line of the Tier-2 summary, when the node has one. */
|
|
172
|
+
summary?: string;
|
|
173
|
+
}
|
|
174
|
+
export interface SkeletonResult {
|
|
175
|
+
file: string;
|
|
176
|
+
entries: SkeletonEntry[];
|
|
177
|
+
note?: string;
|
|
178
|
+
/** Tokens-saved baseline: this file read whole vs the signatures-only view. */
|
|
179
|
+
saved?: Savings;
|
|
180
|
+
}
|
|
181
|
+
/** Signatures-only view of one file, straight from the wiring graph — the
|
|
182
|
+
* cheapest way to understand a file's API surface (~10× less than reading it).
|
|
183
|
+
* `file` is matched as an exact repo-relative path, then as a basename. */
|
|
184
|
+
export declare function skeleton(dir: string, file: string, opts?: {
|
|
185
|
+
contextDir?: string;
|
|
186
|
+
}): SkeletonResult;
|
|
187
|
+
/** Render a {@link SkeletonResult} as compact markdown. */
|
|
188
|
+
export declare function formatSkeleton(r: SkeletonResult): string;
|
|
189
|
+
/** Render an {@link AskResult} as a compact markdown context pack. */
|
|
190
|
+
export declare function formatAsk(r: AskResult): string;
|
|
191
|
+
/** {@link formatAsk}, plus the tokens its pack saved (what {@link askSavedTokens} says), from the one render. */
|
|
192
|
+
export declare function formatAskWithSaved(r: AskResult): {
|
|
193
|
+
text: string;
|
|
194
|
+
savedTokens: number;
|
|
195
|
+
};
|
|
196
|
+
/** Tokens this lookup's pack saved against reading the files it covers whole:
|
|
197
|
+
* the number `formatAsk` prints as "tokens saved ≈ N", or 0 when it prints none. */
|
|
198
|
+
export declare function askSavedTokens(r: AskResult): number;
|
|
199
|
+
//# sourceMappingURL=ask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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