kirograph 0.19.0 → 0.20.1
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/README.md +10 -8
- package/dist/architecture/layers/dart.d.ts +10 -0
- package/dist/architecture/layers/dart.d.ts.map +1 -0
- package/dist/architecture/layers/elixir.d.ts +6 -0
- package/dist/architecture/layers/elixir.d.ts.map +1 -0
- package/dist/architecture/layers/index.d.ts.map +1 -1
- package/dist/architecture/layers/ocaml.d.ts +6 -0
- package/dist/architecture/layers/ocaml.d.ts.map +1 -0
- package/dist/architecture/layers/scala.d.ts +6 -0
- package/dist/architecture/layers/scala.d.ts.map +1 -0
- package/dist/architecture/layers/solidity.d.ts +6 -0
- package/dist/architecture/layers/solidity.d.ts.map +1 -0
- package/dist/architecture/layers/vue.d.ts +6 -0
- package/dist/architecture/layers/vue.d.ts.map +1 -0
- package/dist/architecture/manifest/elm.d.ts +3 -0
- package/dist/architecture/manifest/elm.d.ts.map +1 -0
- package/dist/architecture/manifest/index.d.ts.map +1 -1
- package/dist/architecture/manifest/ocaml.d.ts +3 -0
- package/dist/architecture/manifest/ocaml.d.ts.map +1 -0
- package/dist/architecture/manifest/scala.d.ts +3 -0
- package/dist/architecture/manifest/scala.d.ts.map +1 -0
- package/dist/bin/banner.d.ts.map +1 -1
- package/dist/bin/commands/affected.d.ts.map +1 -1
- package/dist/bin/commands/attack-surface.d.ts +3 -0
- package/dist/bin/commands/attack-surface.d.ts.map +1 -0
- package/dist/bin/commands/attack-surface.js +7 -0
- package/dist/bin/commands/attack-surface.js.map +2 -2
- package/dist/bin/commands/benchmark.d.ts +9 -0
- package/dist/bin/commands/benchmark.d.ts.map +1 -0
- package/dist/bin/commands/budget.d.ts +6 -0
- package/dist/bin/commands/budget.d.ts.map +1 -0
- package/dist/bin/commands/caveman.d.ts +7 -0
- package/dist/bin/commands/caveman.d.ts.map +1 -0
- package/dist/bin/commands/communities.d.ts +3 -0
- package/dist/bin/commands/communities.d.ts.map +1 -0
- package/dist/bin/commands/compression.d.ts +7 -0
- package/dist/bin/commands/compression.d.ts.map +1 -0
- package/dist/bin/commands/context.d.ts.map +1 -1
- package/dist/bin/commands/data.d.ts +3 -0
- package/dist/bin/commands/data.d.ts.map +1 -0
- package/dist/bin/commands/dead-code.d.ts +3 -0
- package/dist/bin/commands/dead-code.d.ts.map +1 -0
- package/dist/bin/commands/dep-confusion.d.ts +3 -0
- package/dist/bin/commands/dep-confusion.d.ts.map +1 -0
- package/dist/bin/commands/docs.d.ts +3 -0
- package/dist/bin/commands/docs.d.ts.map +1 -0
- package/dist/bin/commands/exec.d.ts +11 -0
- package/dist/bin/commands/exec.d.ts.map +1 -0
- package/dist/bin/commands/export.d.ts +3 -0
- package/dist/bin/commands/export.d.ts.map +1 -0
- package/dist/bin/commands/flows.d.ts +3 -0
- package/dist/bin/commands/flows.d.ts.map +1 -0
- package/dist/bin/commands/gain.d.ts +6 -0
- package/dist/bin/commands/gain.d.ts.map +1 -0
- package/dist/bin/commands/help.d.ts +7 -0
- package/dist/bin/commands/help.d.ts.map +1 -1
- package/dist/bin/commands/help.js +20 -3
- package/dist/bin/commands/help.js.map +2 -2
- package/dist/bin/commands/hotspots.d.ts +3 -0
- package/dist/bin/commands/hotspots.d.ts.map +1 -0
- package/dist/bin/commands/hotspots.js +94 -1
- package/dist/bin/commands/hotspots.js.map +3 -3
- package/dist/bin/commands/install.d.ts.map +1 -1
- package/dist/bin/commands/install.js +3 -3
- package/dist/bin/commands/install.js.map +2 -2
- package/dist/bin/commands/licenses.d.ts +3 -0
- package/dist/bin/commands/licenses.d.ts.map +1 -0
- package/dist/bin/commands/memory.d.ts +16 -0
- package/dist/bin/commands/memory.d.ts.map +1 -0
- package/dist/bin/commands/memory.js +151 -4
- package/dist/bin/commands/memory.js.map +2 -2
- package/dist/bin/commands/path.d.ts +3 -0
- package/dist/bin/commands/path.d.ts.map +1 -0
- package/dist/bin/commands/pattern.d.ts +3 -0
- package/dist/bin/commands/pattern.d.ts.map +1 -0
- package/dist/bin/commands/pattern.js +592 -0
- package/dist/bin/commands/pattern.js.map +7 -0
- package/dist/bin/commands/query.d.ts.map +1 -1
- package/dist/bin/commands/reachability.d.ts +3 -0
- package/dist/bin/commands/reachability.d.ts.map +1 -0
- package/dist/bin/commands/read.d.ts +6 -0
- package/dist/bin/commands/read.d.ts.map +1 -0
- package/dist/bin/commands/refactor.d.ts +3 -0
- package/dist/bin/commands/refactor.d.ts.map +1 -0
- package/dist/bin/commands/remediation.d.ts +3 -0
- package/dist/bin/commands/remediation.d.ts.map +1 -0
- package/dist/bin/commands/sbom.d.ts +3 -0
- package/dist/bin/commands/sbom.d.ts.map +1 -0
- package/dist/bin/commands/security-ci-report.d.ts +9 -0
- package/dist/bin/commands/security-ci-report.d.ts.map +1 -0
- package/dist/bin/commands/security-export.d.ts +2 -0
- package/dist/bin/commands/security-export.d.ts.map +1 -0
- package/dist/bin/commands/security-flows.d.ts +3 -0
- package/dist/bin/commands/security-flows.d.ts.map +1 -0
- package/dist/bin/commands/security-secrets.d.ts +3 -0
- package/dist/bin/commands/security-secrets.d.ts.map +1 -0
- package/dist/bin/commands/security.d.ts +3 -0
- package/dist/bin/commands/security.d.ts.map +1 -0
- package/dist/bin/commands/security.js +15 -0
- package/dist/bin/commands/security.js.map +2 -2
- package/dist/bin/commands/snapshot.d.ts +3 -0
- package/dist/bin/commands/snapshot.d.ts.map +1 -0
- package/dist/bin/commands/staleness.d.ts +3 -0
- package/dist/bin/commands/staleness.d.ts.map +1 -0
- package/dist/bin/commands/status.d.ts.map +1 -1
- package/dist/bin/commands/status.js +27 -0
- package/dist/bin/commands/status.js.map +2 -2
- package/dist/bin/commands/supply-chain.d.ts +3 -0
- package/dist/bin/commands/supply-chain.d.ts.map +1 -0
- package/dist/bin/commands/surprising.d.ts +3 -0
- package/dist/bin/commands/surprising.d.ts.map +1 -0
- package/dist/bin/commands/sync.d.ts.map +1 -1
- package/dist/bin/commands/uninit.d.ts.map +1 -1
- package/dist/bin/commands/utils.d.ts +5 -0
- package/dist/bin/commands/utils.d.ts.map +1 -1
- package/dist/bin/commands/vex.d.ts +3 -0
- package/dist/bin/commands/vex.d.ts.map +1 -0
- package/dist/bin/commands/vuln-suppress.d.ts +3 -0
- package/dist/bin/commands/vuln-suppress.d.ts.map +1 -0
- package/dist/bin/commands/vulns.d.ts +3 -0
- package/dist/bin/commands/vulns.d.ts.map +1 -0
- package/dist/bin/installer/archive.d.ts +47 -0
- package/dist/bin/installer/archive.d.ts.map +1 -0
- package/dist/bin/installer/auto-detect.d.ts +16 -0
- package/dist/bin/installer/auto-detect.d.ts.map +1 -0
- package/dist/bin/installer/caveman.d.ts +12 -0
- package/dist/bin/installer/caveman.d.ts.map +1 -0
- package/dist/bin/installer/cli-agent.d.ts +7 -2
- package/dist/bin/installer/cli-agent.d.ts.map +1 -1
- package/dist/bin/installer/cli-agent.js +6 -2
- package/dist/bin/installer/cli-agent.js.map +2 -2
- package/dist/bin/installer/common.d.ts +36 -0
- package/dist/bin/installer/common.d.ts.map +1 -0
- package/dist/bin/installer/common.js +2 -1
- package/dist/bin/installer/common.js.map +2 -2
- package/dist/bin/installer/config-prompt.d.ts +1 -1
- package/dist/bin/installer/config-prompt.d.ts.map +1 -1
- package/dist/bin/installer/config-prompt.js +74 -2
- package/dist/bin/installer/config-prompt.js.map +2 -2
- package/dist/bin/installer/dashboard.d.ts.map +1 -1
- package/dist/bin/installer/detect.d.ts +30 -0
- package/dist/bin/installer/detect.d.ts.map +1 -0
- package/dist/bin/installer/hooks.d.ts +4 -1
- package/dist/bin/installer/hooks.d.ts.map +1 -1
- package/dist/bin/installer/hooks.js +34 -0
- package/dist/bin/installer/hooks.js.map +2 -2
- package/dist/bin/installer/index.d.ts +5 -4
- package/dist/bin/installer/index.d.ts.map +1 -1
- package/dist/bin/installer/index.js +67 -8
- package/dist/bin/installer/index.js.map +2 -2
- package/dist/bin/installer/instructions.d.ts +14 -0
- package/dist/bin/installer/instructions.d.ts.map +1 -0
- package/dist/bin/installer/instructions.js +15 -1
- package/dist/bin/installer/instructions.js.map +2 -2
- package/dist/bin/installer/mcp.d.ts.map +1 -1
- package/dist/bin/installer/prompts.d.ts +17 -0
- package/dist/bin/installer/prompts.d.ts.map +1 -1
- package/dist/bin/installer/qdrant-dashboard.d.ts.map +1 -1
- package/dist/bin/installer/steering.d.ts +14 -2
- package/dist/bin/installer/steering.d.ts.map +1 -1
- package/dist/bin/installer/steering.js +81 -0
- package/dist/bin/installer/steering.js.map +2 -2
- package/dist/bin/installer/targets/aider.d.ts +6 -0
- package/dist/bin/installer/targets/aider.d.ts.map +1 -0
- package/dist/bin/installer/targets/aider.js +3 -3
- package/dist/bin/installer/targets/aider.js.map +2 -2
- package/dist/bin/installer/targets/amp.d.ts +6 -0
- package/dist/bin/installer/targets/amp.d.ts.map +1 -0
- package/dist/bin/installer/targets/amp.js +3 -3
- package/dist/bin/installer/targets/amp.js.map +2 -2
- package/dist/bin/installer/targets/antigravity.d.ts +13 -0
- package/dist/bin/installer/targets/antigravity.d.ts.map +1 -0
- package/dist/bin/installer/targets/antigravity.js +2 -2
- package/dist/bin/installer/targets/antigravity.js.map +2 -2
- package/dist/bin/installer/targets/augment.d.ts +6 -0
- package/dist/bin/installer/targets/augment.d.ts.map +1 -0
- package/dist/bin/installer/targets/augment.js +3 -3
- package/dist/bin/installer/targets/augment.js.map +2 -2
- package/dist/bin/installer/targets/claude.d.ts +6 -0
- package/dist/bin/installer/targets/claude.d.ts.map +1 -0
- package/dist/bin/installer/targets/claude.js +2 -2
- package/dist/bin/installer/targets/claude.js.map +2 -2
- package/dist/bin/installer/targets/cline.d.ts +13 -0
- package/dist/bin/installer/targets/cline.d.ts.map +1 -0
- package/dist/bin/installer/targets/cline.js +2 -2
- package/dist/bin/installer/targets/cline.js.map +2 -2
- package/dist/bin/installer/targets/codex.d.ts +6 -0
- package/dist/bin/installer/targets/codex.d.ts.map +1 -0
- package/dist/bin/installer/targets/codex.js +2 -2
- package/dist/bin/installer/targets/codex.js.map +2 -2
- package/dist/bin/installer/targets/continue.d.ts +12 -0
- package/dist/bin/installer/targets/continue.d.ts.map +1 -0
- package/dist/bin/installer/targets/continue.js +2 -2
- package/dist/bin/installer/targets/continue.js.map +2 -2
- package/dist/bin/installer/targets/copilot-cli.d.ts +12 -0
- package/dist/bin/installer/targets/copilot-cli.d.ts.map +1 -0
- package/dist/bin/installer/targets/copilot-cli.js +2 -2
- package/dist/bin/installer/targets/copilot-cli.js.map +2 -2
- package/dist/bin/installer/targets/copilot.d.ts +6 -0
- package/dist/bin/installer/targets/copilot.d.ts.map +1 -0
- package/dist/bin/installer/targets/copilot.js +2 -2
- package/dist/bin/installer/targets/copilot.js.map +2 -2
- package/dist/bin/installer/targets/cursor.d.ts +6 -0
- package/dist/bin/installer/targets/cursor.d.ts.map +1 -0
- package/dist/bin/installer/targets/cursor.js +2 -2
- package/dist/bin/installer/targets/cursor.js.map +2 -2
- package/dist/bin/installer/targets/devin.d.ts +13 -0
- package/dist/bin/installer/targets/devin.d.ts.map +1 -0
- package/dist/bin/installer/targets/devin.js +2 -2
- package/dist/bin/installer/targets/devin.js.map +2 -2
- package/dist/bin/installer/targets/gemini-cli.d.ts +16 -0
- package/dist/bin/installer/targets/gemini-cli.d.ts.map +1 -0
- package/dist/bin/installer/targets/gemini-cli.js +2 -2
- package/dist/bin/installer/targets/gemini-cli.js.map +2 -2
- package/dist/bin/installer/targets/generic.d.ts +59 -0
- package/dist/bin/installer/targets/generic.d.ts.map +1 -0
- package/dist/bin/installer/targets/generic.js +2 -2
- package/dist/bin/installer/targets/generic.js.map +2 -2
- package/dist/bin/installer/targets/goose.d.ts +6 -0
- package/dist/bin/installer/targets/goose.d.ts.map +1 -0
- package/dist/bin/installer/targets/goose.js +3 -3
- package/dist/bin/installer/targets/goose.js.map +2 -2
- package/dist/bin/installer/targets/index.d.ts +11 -0
- package/dist/bin/installer/targets/index.d.ts.map +1 -0
- package/dist/bin/installer/targets/index.js.map +1 -1
- package/dist/bin/installer/targets/junie.d.ts +13 -0
- package/dist/bin/installer/targets/junie.d.ts.map +1 -0
- package/dist/bin/installer/targets/junie.js +2 -2
- package/dist/bin/installer/targets/junie.js.map +2 -2
- package/dist/bin/installer/targets/kilo.d.ts +12 -0
- package/dist/bin/installer/targets/kilo.d.ts.map +1 -0
- package/dist/bin/installer/targets/kilo.js +2 -2
- package/dist/bin/installer/targets/kilo.js.map +2 -2
- package/dist/bin/installer/targets/kiro.d.ts +5 -0
- package/dist/bin/installer/targets/kiro.d.ts.map +1 -0
- package/dist/bin/installer/targets/kiro.js +4 -4
- package/dist/bin/installer/targets/kiro.js.map +2 -2
- package/dist/bin/installer/targets/opencode.d.ts +13 -0
- package/dist/bin/installer/targets/opencode.d.ts.map +1 -0
- package/dist/bin/installer/targets/opencode.js +2 -2
- package/dist/bin/installer/targets/opencode.js.map +2 -2
- package/dist/bin/installer/targets/openhands.d.ts +6 -0
- package/dist/bin/installer/targets/openhands.d.ts.map +1 -0
- package/dist/bin/installer/targets/openhands.js +3 -3
- package/dist/bin/installer/targets/openhands.js.map +2 -2
- package/dist/bin/installer/targets/qoder.d.ts +12 -0
- package/dist/bin/installer/targets/qoder.d.ts.map +1 -0
- package/dist/bin/installer/targets/qoder.js +2 -2
- package/dist/bin/installer/targets/qoder.js.map +2 -2
- package/dist/bin/installer/targets/qwen.d.ts +12 -0
- package/dist/bin/installer/targets/qwen.d.ts.map +1 -0
- package/dist/bin/installer/targets/qwen.js +2 -2
- package/dist/bin/installer/targets/qwen.js.map +2 -2
- package/dist/bin/installer/targets/replit.d.ts +6 -0
- package/dist/bin/installer/targets/replit.d.ts.map +1 -0
- package/dist/bin/installer/targets/replit.js +3 -3
- package/dist/bin/installer/targets/replit.js.map +2 -2
- package/dist/bin/installer/targets/roo.d.ts +13 -0
- package/dist/bin/installer/targets/roo.d.ts.map +1 -0
- package/dist/bin/installer/targets/roo.js +2 -2
- package/dist/bin/installer/targets/roo.js.map +2 -2
- package/dist/bin/installer/targets/tabnine.d.ts +6 -0
- package/dist/bin/installer/targets/tabnine.d.ts.map +1 -0
- package/dist/bin/installer/targets/tabnine.js +3 -3
- package/dist/bin/installer/targets/tabnine.js.map +2 -2
- package/dist/bin/installer/targets/trae.d.ts +6 -0
- package/dist/bin/installer/targets/trae.d.ts.map +1 -0
- package/dist/bin/installer/targets/trae.js +3 -3
- package/dist/bin/installer/targets/trae.js.map +2 -2
- package/dist/bin/installer/targets/warp.d.ts +12 -0
- package/dist/bin/installer/targets/warp.d.ts.map +1 -0
- package/dist/bin/installer/targets/warp.js +2 -2
- package/dist/bin/installer/targets/warp.js.map +2 -2
- package/dist/bin/installer/targets/windsurf.d.ts +13 -0
- package/dist/bin/installer/targets/windsurf.d.ts.map +1 -0
- package/dist/bin/installer/targets/windsurf.js +2 -2
- package/dist/bin/installer/targets/windsurf.js.map +2 -2
- package/dist/bin/kirograph.js +3 -1
- package/dist/bin/kirograph.js.map +3 -3
- package/dist/bin/progress.d.ts +16 -1
- package/dist/bin/progress.d.ts.map +1 -1
- package/dist/compression/filters/aws.d.ts +9 -0
- package/dist/compression/filters/aws.d.ts.map +1 -0
- package/dist/compression/filters/docker.d.ts +6 -0
- package/dist/compression/filters/docker.d.ts.map +1 -0
- package/dist/compression/filters/files.d.ts +6 -0
- package/dist/compression/filters/files.d.ts.map +1 -0
- package/dist/compression/filters/generic.d.ts +7 -0
- package/dist/compression/filters/generic.d.ts.map +1 -0
- package/dist/compression/filters/git.d.ts +6 -0
- package/dist/compression/filters/git.d.ts.map +1 -0
- package/dist/compression/filters/github.d.ts +6 -0
- package/dist/compression/filters/github.d.ts.map +1 -0
- package/dist/compression/filters/lint.d.ts +6 -0
- package/dist/compression/filters/lint.d.ts.map +1 -0
- package/dist/compression/filters/misc.d.ts +6 -0
- package/dist/compression/filters/misc.d.ts.map +1 -0
- package/dist/compression/filters/package.d.ts +6 -0
- package/dist/compression/filters/package.d.ts.map +1 -0
- package/dist/compression/filters/test.d.ts +6 -0
- package/dist/compression/filters/test.d.ts.map +1 -0
- package/dist/compression/index.d.ts +29 -0
- package/dist/compression/index.d.ts.map +1 -0
- package/dist/compression/naive-cost.d.ts +26 -0
- package/dist/compression/naive-cost.d.ts.map +1 -0
- package/dist/compression/tracker.d.ts +155 -0
- package/dist/compression/tracker.d.ts.map +1 -0
- package/dist/compression/types.d.ts +49 -0
- package/dist/compression/types.d.ts.map +1 -0
- package/dist/config.d.ts +90 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +55 -1
- package/dist/config.js.map +2 -2
- package/dist/core/lock-manager.d.ts +2 -0
- package/dist/core/lock-manager.d.ts.map +1 -1
- package/dist/core/pipeline.d.ts +4 -1
- package/dist/core/pipeline.d.ts.map +1 -1
- package/dist/core/pipeline.js +42 -0
- package/dist/core/pipeline.js.map +2 -2
- package/dist/core/snapshot.d.ts +58 -0
- package/dist/core/snapshot.d.ts.map +1 -0
- package/dist/data/filters.d.ts +23 -0
- package/dist/data/filters.d.ts.map +1 -0
- package/dist/data/indexer.d.ts +25 -0
- package/dist/data/indexer.d.ts.map +1 -0
- package/dist/data/linker.d.ts +37 -0
- package/dist/data/linker.d.ts.map +1 -0
- package/dist/data/lint.d.ts +27 -0
- package/dist/data/lint.d.ts.map +1 -0
- package/dist/data/parsers/csv.d.ts +11 -0
- package/dist/data/parsers/csv.d.ts.map +1 -0
- package/dist/data/parsers/excel.d.ts +10 -0
- package/dist/data/parsers/excel.d.ts.map +1 -0
- package/dist/data/parsers/index.d.ts +28 -0
- package/dist/data/parsers/index.d.ts.map +1 -0
- package/dist/data/parsers/json-array.d.ts +9 -0
- package/dist/data/parsers/json-array.d.ts.map +1 -0
- package/dist/data/parsers/jsonl.d.ts +9 -0
- package/dist/data/parsers/jsonl.d.ts.map +1 -0
- package/dist/data/parsers/parquet.d.ts +10 -0
- package/dist/data/parsers/parquet.d.ts.map +1 -0
- package/dist/data/profiler.d.ts +29 -0
- package/dist/data/profiler.d.ts.map +1 -0
- package/dist/data/queries.d.ts +95 -0
- package/dist/data/queries.d.ts.map +1 -0
- package/dist/data/types.d.ts +103 -0
- package/dist/data/types.d.ts.map +1 -0
- package/dist/db/database.d.ts +57 -0
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/database.js +19 -0
- package/dist/db/database.js.map +2 -2
- package/dist/db/patterns-schema.sql +23 -0
- package/dist/docs/formats/asciidoc.d.ts +9 -0
- package/dist/docs/formats/asciidoc.d.ts.map +1 -0
- package/dist/docs/formats/html.d.ts +10 -0
- package/dist/docs/formats/html.d.ts.map +1 -0
- package/dist/docs/formats/index.d.ts +31 -0
- package/dist/docs/formats/index.d.ts.map +1 -0
- package/dist/docs/formats/markdown.d.ts +11 -0
- package/dist/docs/formats/markdown.d.ts.map +1 -0
- package/dist/docs/formats/openapi.d.ts +17 -0
- package/dist/docs/formats/openapi.d.ts.map +1 -0
- package/dist/docs/formats/org.d.ts +9 -0
- package/dist/docs/formats/org.d.ts.map +1 -0
- package/dist/docs/formats/plaintext.d.ts +11 -0
- package/dist/docs/formats/plaintext.d.ts.map +1 -0
- package/dist/docs/formats/rdoc.d.ts +10 -0
- package/dist/docs/formats/rdoc.d.ts.map +1 -0
- package/dist/docs/formats/rst.d.ts +11 -0
- package/dist/docs/formats/rst.d.ts.map +1 -0
- package/dist/docs/indexer.d.ts +49 -0
- package/dist/docs/indexer.d.ts.map +1 -0
- package/dist/docs/linker.d.ts +30 -0
- package/dist/docs/linker.d.ts.map +1 -0
- package/dist/docs/lint.d.ts +27 -0
- package/dist/docs/lint.d.ts.map +1 -0
- package/dist/docs/queries.d.ts +78 -0
- package/dist/docs/queries.d.ts.map +1 -0
- package/dist/docs/section-id.d.ts +48 -0
- package/dist/docs/section-id.d.ts.map +1 -0
- package/dist/docs/summarizer.d.ts +13 -0
- package/dist/docs/summarizer.d.ts.map +1 -0
- package/dist/docs/types.d.ts +71 -0
- package/dist/docs/types.d.ts.map +1 -0
- package/dist/docs/vectors.d.ts +54 -0
- package/dist/docs/vectors.d.ts.map +1 -0
- package/dist/extraction/extractor.d.ts +1 -1
- package/dist/extraction/extractor.d.ts.map +1 -1
- package/dist/extraction/extractor.js +26 -3
- package/dist/extraction/extractor.js.map +2 -2
- package/dist/extraction/grammars.d.ts +6 -0
- package/dist/extraction/grammars.d.ts.map +1 -1
- package/dist/extraction/grammars.js +1 -0
- package/dist/extraction/grammars.js.map +2 -2
- package/dist/extraction/languages.d.ts.map +1 -1
- package/dist/extraction/languages.js +5 -1
- package/dist/extraction/languages.js.map +2 -2
- package/dist/extraction/notebook.d.ts +14 -0
- package/dist/extraction/notebook.d.ts.map +1 -0
- package/dist/frameworks/amplify.d.ts +9 -0
- package/dist/frameworks/amplify.d.ts.map +1 -0
- package/dist/frameworks/angular.d.ts +9 -0
- package/dist/frameworks/angular.d.ts.map +1 -0
- package/dist/frameworks/ansible.d.ts +8 -0
- package/dist/frameworks/ansible.d.ts.map +1 -0
- package/dist/frameworks/cloudformation.d.ts +9 -0
- package/dist/frameworks/cloudformation.d.ts.map +1 -0
- package/dist/frameworks/docker.d.ts +9 -0
- package/dist/frameworks/docker.d.ts.map +1 -0
- package/dist/frameworks/elixir.d.ts +6 -0
- package/dist/frameworks/elixir.d.ts.map +1 -0
- package/dist/frameworks/flutter.d.ts +12 -0
- package/dist/frameworks/flutter.d.ts.map +1 -0
- package/dist/frameworks/iac.d.ts +10 -0
- package/dist/frameworks/iac.d.ts.map +1 -0
- package/dist/frameworks/index.d.ts +14 -0
- package/dist/frameworks/index.d.ts.map +1 -1
- package/dist/frameworks/kubernetes.d.ts +9 -0
- package/dist/frameworks/kubernetes.d.ts.map +1 -0
- package/dist/frameworks/pulumi.d.ts +9 -0
- package/dist/frameworks/pulumi.d.ts.map +1 -0
- package/dist/frameworks/scala.d.ts +6 -0
- package/dist/frameworks/scala.d.ts.map +1 -0
- package/dist/frameworks/solidity.d.ts +6 -0
- package/dist/frameworks/solidity.d.ts.map +1 -0
- package/dist/frameworks/terraform.d.ts +14 -0
- package/dist/frameworks/terraform.d.ts.map +1 -0
- package/dist/frameworks/vue.d.ts +7 -0
- package/dist/frameworks/vue.d.ts.map +1 -0
- package/dist/graph/communities.d.ts +43 -0
- package/dist/graph/communities.d.ts.map +1 -0
- package/dist/graph/flows.d.ts +55 -0
- package/dist/graph/flows.d.ts.map +1 -0
- package/dist/graph/refactor.d.ts +43 -0
- package/dist/graph/refactor.d.ts.map +1 -0
- package/dist/index.d.ts +36 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/mcp/cache.d.ts +69 -0
- package/dist/mcp/cache.d.ts.map +1 -0
- package/dist/mcp/read-modes.d.ts +31 -0
- package/dist/mcp/read-modes.d.ts.map +1 -0
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +15 -2
- package/dist/mcp/server.js.map +2 -2
- package/dist/mcp/tool-names.d.ts +2 -0
- package/dist/mcp/tool-names.d.ts.map +1 -0
- package/dist/mcp/tool-names.js +4 -1
- package/dist/mcp/tool-names.js.map +2 -2
- package/dist/mcp/tools.d.ts +12 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +397 -0
- package/dist/mcp/tools.js.map +2 -2
- package/dist/memory/compress.d.ts +19 -0
- package/dist/memory/compress.d.ts.map +1 -0
- package/dist/memory/database.d.ts +92 -0
- package/dist/memory/database.d.ts.map +1 -0
- package/dist/memory/database.js +38 -0
- package/dist/memory/database.js.map +2 -2
- package/dist/memory/index.d.ts +71 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +12 -2
- package/dist/memory/index.js.map +2 -2
- package/dist/memory/symbols.d.ts +21 -0
- package/dist/memory/symbols.d.ts.map +1 -0
- package/dist/memory/types.d.ts +78 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js.map +1 -1
- package/dist/memory/vectors.d.ts +43 -0
- package/dist/memory/vectors.d.ts.map +1 -0
- package/dist/patterns/graph.d.ts +16 -0
- package/dist/patterns/graph.d.ts.map +1 -0
- package/dist/patterns/graph.js +45 -0
- package/dist/patterns/graph.js.map +7 -0
- package/dist/patterns/index.d.ts +4 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/patterns/index.js +39 -0
- package/dist/patterns/index.js.map +7 -0
- package/dist/patterns/indexer.d.ts +15 -0
- package/dist/patterns/indexer.d.ts.map +1 -0
- package/dist/patterns/indexer.js +97 -0
- package/dist/patterns/indexer.js.map +7 -0
- package/dist/patterns/library/code-eval-elixir.yaml +11 -0
- package/dist/patterns/library/command-injection-c.yaml +11 -0
- package/dist/patterns/library/command-injection-go.yaml +29 -0
- package/dist/patterns/library/command-injection-kotlin.yaml +10 -0
- package/dist/patterns/library/command-injection-php.yaml +11 -0
- package/dist/patterns/library/command-injection-ruby.yaml +11 -0
- package/dist/patterns/library/command-injection-rust.yaml +11 -0
- package/dist/patterns/library/dangerous-eval-bash.yaml +11 -0
- package/dist/patterns/library/dangerous-eval-js.yaml +14 -0
- package/dist/patterns/library/dangerous-eval-php.yaml +11 -0
- package/dist/patterns/library/dangerous-eval-ruby.yaml +11 -0
- package/dist/patterns/library/dangerous-exec-py.yaml +13 -0
- package/dist/patterns/library/dangerous-reflection-java.yaml +8 -0
- package/dist/patterns/library/dynamic-load-lua.yaml +10 -0
- package/dist/patterns/library/os-cmd-elixir.yaml +16 -0
- package/dist/patterns/library/os-execute-lua.yaml +10 -0
- package/dist/patterns/library/path-traversal-go.yaml +11 -0
- package/dist/patterns/library/path-traversal-py.yaml +12 -0
- package/dist/patterns/library/path-traversal-readfile-js.yaml +14 -0
- package/dist/patterns/library/process-launch-swift.yaml +11 -0
- package/dist/patterns/library/process-run-dart.yaml +15 -0
- package/dist/patterns/library/prototype-pollution-js.yaml +12 -0
- package/dist/patterns/library/source-injection-bash.yaml +11 -0
- package/dist/patterns/library/sql-injection-concat-js.yaml +12 -0
- package/dist/patterns/library/sql-injection-dart.yaml +9 -0
- package/dist/patterns/library/sql-injection-java.yaml +13 -0
- package/dist/patterns/library/sql-injection-kotlin.yaml +11 -0
- package/dist/patterns/library/sql-injection-php.yaml +9 -0
- package/dist/patterns/library/sql-injection-py.yaml +12 -0
- package/dist/patterns/library/sql-injection-swift.yaml +11 -0
- package/dist/patterns/library/sql-injection-template-js.yaml +13 -0
- package/dist/patterns/library/subshell-injection-ruby.yaml +8 -0
- package/dist/patterns/library/unsafe-block-rust.yaml +8 -0
- package/dist/patterns/library/unsafe-string-c.yaml +11 -0
- package/dist/patterns/library/weak-crypto-md5-js.yaml +13 -0
- package/dist/patterns/library/weak-crypto-py.yaml +13 -0
- package/dist/patterns/loader.d.ts +18 -0
- package/dist/patterns/loader.d.ts.map +1 -0
- package/dist/patterns/loader.js +277 -0
- package/dist/patterns/loader.js.map +7 -0
- package/dist/patterns/runner.d.ts +42 -0
- package/dist/patterns/runner.d.ts.map +1 -0
- package/dist/patterns/runner.js +295 -0
- package/dist/patterns/runner.js.map +7 -0
- package/dist/patterns/types.d.ts +27 -0
- package/dist/patterns/types.d.ts.map +1 -0
- package/dist/patterns/types.js +34 -0
- package/dist/patterns/types.js.map +7 -0
- package/dist/resolution/bridges/android-rn.d.ts +13 -0
- package/dist/resolution/bridges/android-rn.d.ts.map +1 -0
- package/dist/resolution/bridges/expo-modules.d.ts +10 -0
- package/dist/resolution/bridges/expo-modules.d.ts.map +1 -0
- package/dist/resolution/bridges/flutter-channel.d.ts +14 -0
- package/dist/resolution/bridges/flutter-channel.d.ts.map +1 -0
- package/dist/resolution/bridges/index.d.ts +40 -0
- package/dist/resolution/bridges/index.d.ts.map +1 -0
- package/dist/resolution/bridges/native-events.d.ts +10 -0
- package/dist/resolution/bridges/native-events.d.ts.map +1 -0
- package/dist/resolution/bridges/native-views.d.ts +13 -0
- package/dist/resolution/bridges/native-views.d.ts.map +1 -0
- package/dist/resolution/bridges/react-native.d.ts +9 -0
- package/dist/resolution/bridges/react-native.d.ts.map +1 -0
- package/dist/resolution/bridges/swift-objc.d.ts +14 -0
- package/dist/resolution/bridges/swift-objc.d.ts.map +1 -0
- package/dist/resolution/bridges/turbomodules.d.ts +10 -0
- package/dist/resolution/bridges/turbomodules.d.ts.map +1 -0
- package/dist/resolution/index.d.ts +28 -3
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/security/attack-surface.d.ts +46 -0
- package/dist/security/attack-surface.d.ts.map +1 -0
- package/dist/security/attack-surface.js +43 -1
- package/dist/security/attack-surface.js.map +2 -2
- package/dist/security/context-warnings.d.ts +40 -0
- package/dist/security/context-warnings.d.ts.map +1 -0
- package/dist/security/data-flows.d.ts +33 -0
- package/dist/security/data-flows.d.ts.map +1 -0
- package/dist/security/data-flows.js +65 -7
- package/dist/security/data-flows.js.map +2 -2
- package/dist/security/dep-confusion.d.ts +23 -0
- package/dist/security/dep-confusion.d.ts.map +1 -0
- package/dist/security/errors.d.ts +16 -0
- package/dist/security/errors.d.ts.map +1 -0
- package/dist/security/export/fix-suggestions.d.ts +21 -0
- package/dist/security/export/fix-suggestions.d.ts.map +1 -0
- package/dist/security/export/sbom.d.ts +33 -0
- package/dist/security/export/sbom.d.ts.map +1 -0
- package/dist/security/export/serialization.d.ts +62 -0
- package/dist/security/export/serialization.d.ts.map +1 -0
- package/dist/security/export/vex.d.ts +58 -0
- package/dist/security/export/vex.d.ts.map +1 -0
- package/dist/security/index.d.ts +21 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/integrator.d.ts +63 -0
- package/dist/security/integrator.d.ts.map +1 -0
- package/dist/security/integrator.js +8 -8
- package/dist/security/integrator.js.map +2 -2
- package/dist/security/license.d.ts +33 -0
- package/dist/security/license.d.ts.map +1 -0
- package/dist/security/manifest/adapter.d.ts +92 -0
- package/dist/security/manifest/adapter.d.ts.map +1 -0
- package/dist/security/manifest/parser.d.ts +73 -0
- package/dist/security/manifest/parser.d.ts.map +1 -0
- package/dist/security/manifest/plugins/cargo.d.ts +11 -0
- package/dist/security/manifest/plugins/cargo.d.ts.map +1 -0
- package/dist/security/manifest/plugins/composer.d.ts +11 -0
- package/dist/security/manifest/plugins/composer.d.ts.map +1 -0
- package/dist/security/manifest/plugins/go.d.ts +12 -0
- package/dist/security/manifest/plugins/go.d.ts.map +1 -0
- package/dist/security/manifest/plugins/gradle.d.ts +12 -0
- package/dist/security/manifest/plugins/gradle.d.ts.map +1 -0
- package/dist/security/manifest/plugins/hex.d.ts +11 -0
- package/dist/security/manifest/plugins/hex.d.ts.map +1 -0
- package/dist/security/manifest/plugins/maven.d.ts +11 -0
- package/dist/security/manifest/plugins/maven.d.ts.map +1 -0
- package/dist/security/manifest/plugins/npm.d.ts +11 -0
- package/dist/security/manifest/plugins/npm.d.ts.map +1 -0
- package/dist/security/manifest/plugins/nuget.d.ts +12 -0
- package/dist/security/manifest/plugins/nuget.d.ts.map +1 -0
- package/dist/security/manifest/plugins/pip.d.ts +11 -0
- package/dist/security/manifest/plugins/pip.d.ts.map +1 -0
- package/dist/security/manifest/plugins/pubspec.d.ts +11 -0
- package/dist/security/manifest/plugins/pubspec.d.ts.map +1 -0
- package/dist/security/manifest/plugins/pyproject.d.ts +3 -0
- package/dist/security/manifest/plugins/pyproject.d.ts.map +1 -0
- package/dist/security/manifest/plugins/rubygems.d.ts +11 -0
- package/dist/security/manifest/plugins/rubygems.d.ts.map +1 -0
- package/dist/security/manifest/plugins/swift.d.ts +11 -0
- package/dist/security/manifest/plugins/swift.d.ts.map +1 -0
- package/dist/security/owasp.d.ts +16 -0
- package/dist/security/owasp.d.ts.map +1 -0
- package/dist/security/pipeline.d.ts +37 -0
- package/dist/security/pipeline.d.ts.map +1 -0
- package/dist/security/reachability.d.ts +67 -0
- package/dist/security/reachability.d.ts.map +1 -0
- package/dist/security/remediation.d.ts +51 -0
- package/dist/security/remediation.d.ts.map +1 -0
- package/dist/security/secrets.d.ts +38 -0
- package/dist/security/secrets.d.ts.map +1 -0
- package/dist/security/staleness.d.ts +43 -0
- package/dist/security/staleness.d.ts.map +1 -0
- package/dist/security/supply-chain.d.ts +34 -0
- package/dist/security/supply-chain.d.ts.map +1 -0
- package/dist/security/suppressions.d.ts +18 -0
- package/dist/security/suppressions.d.ts.map +1 -0
- package/dist/security/types.d.ts +144 -0
- package/dist/security/types.d.ts.map +1 -0
- package/dist/security/vuln/client.d.ts +90 -0
- package/dist/security/vuln/client.d.ts.map +1 -0
- package/dist/security/vuln/client.js.map +2 -2
- package/dist/security/vuln/epss-client.d.ts +26 -0
- package/dist/security/vuln/epss-client.d.ts.map +1 -0
- package/dist/security/vuln/index.d.ts +6 -0
- package/dist/security/vuln/index.d.ts.map +1 -0
- package/dist/security/vuln/osv-adapter.d.ts +58 -0
- package/dist/security/vuln/osv-adapter.d.ts.map +1 -0
- package/dist/security/vuln/types.d.ts +29 -0
- package/dist/security/vuln/types.d.ts.map +1 -0
- package/dist/sync/index.d.ts +4 -2
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/types.d.ts +10 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +2 -2
- package/dist/vectors/index.d.ts +11 -3
- package/dist/vectors/index.d.ts.map +1 -1
- package/dist/vectors/qdrant-index.d.ts +10 -3
- package/dist/vectors/qdrant-index.d.ts.map +1 -1
- package/dist/vectors/turboquant-index.js +261 -0
- package/dist/vectors/turboquant-index.js.map +7 -0
- package/dist/vectors/typesense-index.d.ts.map +1 -1
- package/dist/watchmen/index.js +83 -0
- package/dist/watchmen/index.js.map +7 -0
- package/dist/watchmen/synthesize.js +475 -0
- package/dist/watchmen/synthesize.js.map +7 -0
- package/package.json +24 -2
- package/dist/security/context-warnings.test.js +0 -300
- package/dist/security/context-warnings.test.js.map +0 -7
- package/dist/security/export/fix-suggestions.test.js +0 -74
- package/dist/security/export/fix-suggestions.test.js.map +0 -7
- package/dist/security/export/sbom.test.js +0 -288
- package/dist/security/export/sbom.test.js.map +0 -7
- package/dist/security/export/serialization.test.js +0 -310
- package/dist/security/export/serialization.test.js.map +0 -7
- package/dist/security/export/vex.test.js +0 -278
- package/dist/security/export/vex.test.js.map +0 -7
- package/dist/security/integrator-transitives.test.js +0 -359
- package/dist/security/integrator-transitives.test.js.map +0 -7
- package/dist/security/integrator.test.js +0 -237
- package/dist/security/integrator.test.js.map +0 -7
- package/dist/security/manifest/adapter.test.js +0 -272
- package/dist/security/manifest/adapter.test.js.map +0 -7
- package/dist/security/manifest/parser.test.js +0 -110
- package/dist/security/manifest/parser.test.js.map +0 -7
- package/dist/security/manifest/plugins/cargo.test.js +0 -304
- package/dist/security/manifest/plugins/cargo.test.js.map +0 -7
- package/dist/security/manifest/plugins/go.test.js +0 -341
- package/dist/security/manifest/plugins/go.test.js.map +0 -7
- package/dist/security/manifest/plugins/maven.test.js +0 -389
- package/dist/security/manifest/plugins/maven.test.js.map +0 -7
- package/dist/security/manifest/plugins/npm.test.js +0 -298
- package/dist/security/manifest/plugins/npm.test.js.map +0 -7
- package/dist/security/manifest/plugins/pip.test.js +0 -208
- package/dist/security/manifest/plugins/pip.test.js.map +0 -7
- package/dist/security/reachability.test.js +0 -394
- package/dist/security/reachability.test.js.map +0 -7
- package/dist/security/vuln/client.test.js +0 -288
- package/dist/security/vuln/client.test.js.map +0 -7
- package/dist/security/vuln/osv-adapter.test.js +0 -391
- package/dist/security/vuln/osv-adapter.test.js.map +0 -7
package/dist/vectors/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* KiroGraph Vector Manager
|
|
3
3
|
*
|
|
4
|
-
* Semantic search
|
|
4
|
+
* Semantic search via configurable local embedding models using @huggingface/transformers v3.
|
|
5
5
|
* Mirrors CodeGraph src/vectors/ (embedder.ts + manager.ts) adapted for KiroGraph:
|
|
6
6
|
* - Cache dir: ~/.kirograph/models/ (not ~/.codegraph/models/)
|
|
7
7
|
* - Embeddings stored in the `vectors` SQLite table
|
|
@@ -35,7 +35,7 @@ export declare class VectorManager {
|
|
|
35
35
|
* Fails silently so callers can continue without semantic search.
|
|
36
36
|
* When config.useVecIndex is true, also initializes the sqlite-vec ANN index.
|
|
37
37
|
*/
|
|
38
|
-
initialize(): Promise<void>;
|
|
38
|
+
initialize(onProgress?: (file: string, loaded: number, total: number, done: boolean) => void): Promise<void>;
|
|
39
39
|
/**
|
|
40
40
|
* Embed a single node and persist to the vectors table.
|
|
41
41
|
* Skips silently when disabled; logs on failure without throwing.
|
|
@@ -52,7 +52,15 @@ export declare class VectorManager {
|
|
|
52
52
|
deleteEmbeddings(nodeIds: string[]): Promise<void>;
|
|
53
53
|
/**
|
|
54
54
|
* Embed all eligible nodes in the database that don't yet have embeddings.
|
|
55
|
-
*
|
|
55
|
+
* Streams nodes in pages to avoid loading the entire node set into memory —
|
|
56
|
+
* critical for large codebases (100K+ symbols) where a single getAllNodes()
|
|
57
|
+
* call can exhaust the Node.js heap or the WASM linear memory.
|
|
58
|
+
*
|
|
59
|
+
* Uses dynamic batch sizing: starts at BATCH_SIZE, halves on OOM errors,
|
|
60
|
+
* and recovers back to full size after successful batches.
|
|
61
|
+
*
|
|
62
|
+
* Emits a pre-flight warning via onProgress when the embeddable node count
|
|
63
|
+
* exceeds LARGE_CODEBASE_THRESHOLD so the CLI can surface it to the user.
|
|
56
64
|
*/
|
|
57
65
|
embedAll(onProgress?: (current: number, total: number) => void): Promise<number>;
|
|
58
66
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vectors/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vectors/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,E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GAAG,OAAO,CAAC,MAAM,CAAC;IA6JtF;;;;;;;;OAQG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAmDvD,iEAAiE;IACjE,KAAK,IAAI,IAAI;CAId"}
|
|
@@ -46,12 +46,19 @@ export declare class QdrantIndex {
|
|
|
46
46
|
initialize(): Promise<void>;
|
|
47
47
|
private ensureCollection;
|
|
48
48
|
/**
|
|
49
|
-
* Upsert a node's embedding
|
|
50
|
-
* ID is overwritten if it already exists.
|
|
49
|
+
* Upsert a node's embedding with retry logic.
|
|
50
|
+
* Qdrant's upsert is idempotent — the same point ID is overwritten if it already exists.
|
|
51
|
+
* Retries up to 3 times with exponential backoff to handle transient connection failures.
|
|
51
52
|
*/
|
|
52
53
|
upsert(node: Node, embedding: Float32Array): Promise<void>;
|
|
53
54
|
/**
|
|
54
|
-
*
|
|
55
|
+
* Batch upsert multiple nodes' embeddings in a single HTTP request.
|
|
56
|
+
* Much more efficient than individual upserts for bulk indexing.
|
|
57
|
+
* Retries up to 3 times with exponential backoff.
|
|
58
|
+
*/
|
|
59
|
+
bulkUpsert(nodes: Node[], embeddings: Float32Array[]): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Remove a point from the collection with retry logic.
|
|
55
62
|
*/
|
|
56
63
|
delete(nodeId: string): Promise<void>;
|
|
57
64
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qdrant-index.d.ts","sourceRoot":"","sources":["../../src/vectors/qdrant-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAOH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAUrC,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAgDnD,qBAAa,WAAW;IASpB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG;IATtB,OAA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AAI,OAAO,CAAC,IAAI,CAAC;YAiGnB,gBAAgB;IAU9B;;;;OAIG;IACG,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BhE;;;;OAIG;IACG,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA8B1E;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB3C;;OAEG;IACG,MAAM,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,SAAK,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAgBlE;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IA2B7C,0EAA0E;IAC1E,KAAK,IAAI,IAAI;IAMb,oDAAoD;IAC9C,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;CAS/B"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var turboquant_index_exports = {};
|
|
30
|
+
__export(turboquant_index_exports, {
|
|
31
|
+
TurboQuantIndex: () => TurboQuantIndex,
|
|
32
|
+
readTurboQuantStats: () => readTurboQuantStats,
|
|
33
|
+
writeTurboQuantStats: () => writeTurboQuantStats
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(turboquant_index_exports);
|
|
36
|
+
var path = __toESM(require("path"));
|
|
37
|
+
var fs = __toESM(require("fs"));
|
|
38
|
+
var import_errors = require("../errors");
|
|
39
|
+
const STATS_FILE = "turboquant-stats.json";
|
|
40
|
+
function readTurboQuantStats(kirographDir) {
|
|
41
|
+
try {
|
|
42
|
+
const p = path.join(kirographDir, STATS_FILE);
|
|
43
|
+
if (!fs.existsSync(p)) return null;
|
|
44
|
+
return JSON.parse(fs.readFileSync(p, "utf8"));
|
|
45
|
+
} catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function writeTurboQuantStats(kirographDir, patch) {
|
|
50
|
+
const p = path.join(kirographDir, STATS_FILE);
|
|
51
|
+
const tmp = p + ".tmp";
|
|
52
|
+
try {
|
|
53
|
+
const existing = readTurboQuantStats(kirographDir) ?? {
|
|
54
|
+
count: 0,
|
|
55
|
+
dim: 768,
|
|
56
|
+
bits: 3,
|
|
57
|
+
compressionRatio: 1,
|
|
58
|
+
actualBytes: 0,
|
|
59
|
+
rawBytes: 0,
|
|
60
|
+
savedBytes: 0,
|
|
61
|
+
memEnabled: false,
|
|
62
|
+
memCount: 0,
|
|
63
|
+
memActualBytes: 0,
|
|
64
|
+
memRawBytes: 0,
|
|
65
|
+
docsEnabled: false,
|
|
66
|
+
docsCount: 0,
|
|
67
|
+
docsActualBytes: 0,
|
|
68
|
+
docsRawBytes: 0,
|
|
69
|
+
updatedAt: 0
|
|
70
|
+
};
|
|
71
|
+
const updated = { ...existing, ...patch, updatedAt: Math.floor(Date.now() / 1e3) };
|
|
72
|
+
fs.writeFileSync(tmp, JSON.stringify(updated, null, 2));
|
|
73
|
+
fs.renameSync(tmp, p);
|
|
74
|
+
} catch (err) {
|
|
75
|
+
(0, import_errors.logWarn)("TurboQuantIndex: failed to write stats file", { error: String(err) });
|
|
76
|
+
try {
|
|
77
|
+
fs.unlinkSync(tmp);
|
|
78
|
+
} catch {
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
class TurboQuantIndex {
|
|
83
|
+
constructor(kirographDir, binName, dim, bits = 3) {
|
|
84
|
+
this.kirographDir = kirographDir;
|
|
85
|
+
this.binName = binName;
|
|
86
|
+
this.dim = dim;
|
|
87
|
+
this.bits = bits;
|
|
88
|
+
this.index = null;
|
|
89
|
+
this._available = false;
|
|
90
|
+
}
|
|
91
|
+
isAvailable() {
|
|
92
|
+
return this._available;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Load turboquant-js and restore index from disk if the .bin file exists.
|
|
96
|
+
* Silent no-op when the optional dependency is missing.
|
|
97
|
+
*/
|
|
98
|
+
async initialize() {
|
|
99
|
+
if (this._available) return;
|
|
100
|
+
let TQModule;
|
|
101
|
+
try {
|
|
102
|
+
TQModule = require("turboquant-js");
|
|
103
|
+
} catch {
|
|
104
|
+
(0, import_errors.logDebug)("TurboQuantIndex: turboquant-js not installed \u2014 turboquant engine unavailable");
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const VectorIndex = TQModule?.VectorIndex ?? TQModule?.default?.VectorIndex ?? (typeof TQModule === "function" ? TQModule : null);
|
|
108
|
+
if (!VectorIndex || typeof VectorIndex !== "function") {
|
|
109
|
+
(0, import_errors.logWarn)("TurboQuantIndex: unrecognised turboquant-js module shape \u2014 turboquant engine unavailable");
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const binPath = path.join(this.kirographDir, this.binName);
|
|
113
|
+
try {
|
|
114
|
+
if (fs.existsSync(binPath) && typeof VectorIndex.fromBuffer === "function") {
|
|
115
|
+
const nodeBuf = fs.readFileSync(binPath);
|
|
116
|
+
const ab = nodeBuf.buffer.slice(nodeBuf.byteOffset, nodeBuf.byteOffset + nodeBuf.byteLength);
|
|
117
|
+
this.index = VectorIndex.fromBuffer(ab, { dimension: this.dim, bits: this.bits });
|
|
118
|
+
(0, import_errors.logDebug)("TurboQuantIndex: restored from disk", { binPath });
|
|
119
|
+
} else {
|
|
120
|
+
this.index = new VectorIndex({ dimension: this.dim, bits: this.bits });
|
|
121
|
+
(0, import_errors.logDebug)("TurboQuantIndex: new index", { dim: this.dim, bits: this.bits });
|
|
122
|
+
}
|
|
123
|
+
this._available = true;
|
|
124
|
+
} catch (err) {
|
|
125
|
+
(0, import_errors.logError)("TurboQuantIndex: initialization failed", { error: String(err) });
|
|
126
|
+
this._available = false;
|
|
127
|
+
this.index = null;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/** Add or update an embedding (turboquant-js compresses at index time). */
|
|
131
|
+
upsert(id, vec) {
|
|
132
|
+
if (!this._available || !this.index) return;
|
|
133
|
+
try {
|
|
134
|
+
this.index.add(id, vec);
|
|
135
|
+
} catch (err) {
|
|
136
|
+
(0, import_errors.logWarn)("TurboQuantIndex: upsert failed", { id, error: String(err) });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/** Remove an entry from the index (permanent via turboquant-js remove()). */
|
|
140
|
+
delete(id) {
|
|
141
|
+
if (!this._available || !this.index) return;
|
|
142
|
+
try {
|
|
143
|
+
this.index.remove(id);
|
|
144
|
+
} catch (err) {
|
|
145
|
+
(0, import_errors.logWarn)("TurboQuantIndex: delete failed", { id, error: String(err) });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/** ANN search: returns IDs sorted by descending similarity. */
|
|
149
|
+
search(queryVec, topN = 10) {
|
|
150
|
+
return this.searchWithScores(queryVec, topN).map((r) => r.id);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* ANN search: returns [{id, score}] sorted by descending similarity.
|
|
154
|
+
* Used by MemoryVectorManager and DocsVectorManager to preserve scores for
|
|
155
|
+
* hybrid merge.
|
|
156
|
+
*/
|
|
157
|
+
searchWithScores(queryVec, topN = 10) {
|
|
158
|
+
if (!this._available || !this.index) return [];
|
|
159
|
+
try {
|
|
160
|
+
const raw = this.index.search(queryVec, topN);
|
|
161
|
+
return this._normaliseSearchResults(raw).slice(0, topN);
|
|
162
|
+
} catch (err) {
|
|
163
|
+
(0, import_errors.logWarn)("TurboQuantIndex: search failed", { error: String(err) });
|
|
164
|
+
return [];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Persist the compressed index to disk atomically.
|
|
169
|
+
* Called once at the end of `kirograph index` — not on every upsert.
|
|
170
|
+
*/
|
|
171
|
+
async save() {
|
|
172
|
+
if (!this._available || !this.index) return;
|
|
173
|
+
if (typeof this.index.toBuffer !== "function") {
|
|
174
|
+
(0, import_errors.logDebug)("TurboQuantIndex: toBuffer() not available \u2014 index not persisted");
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const binPath = path.join(this.kirographDir, this.binName);
|
|
178
|
+
const tmp = binPath + ".tmp";
|
|
179
|
+
try {
|
|
180
|
+
const raw = this.index.toBuffer();
|
|
181
|
+
const buf = raw instanceof ArrayBuffer ? Buffer.from(raw) : raw;
|
|
182
|
+
fs.writeFileSync(tmp, buf);
|
|
183
|
+
fs.renameSync(tmp, binPath);
|
|
184
|
+
(0, import_errors.logDebug)("TurboQuantIndex: saved", { binPath, bytes: buf.length });
|
|
185
|
+
} catch (err) {
|
|
186
|
+
(0, import_errors.logWarn)("TurboQuantIndex: save failed", { error: String(err) });
|
|
187
|
+
try {
|
|
188
|
+
fs.unlinkSync(tmp);
|
|
189
|
+
} catch {
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Memory usage stats from the compressed index.
|
|
195
|
+
* Falls back to a formula-based estimate when memoryUsage is unavailable.
|
|
196
|
+
*/
|
|
197
|
+
memoryStats() {
|
|
198
|
+
if (this._available && this.index?.memoryUsage) {
|
|
199
|
+
return this.index.memoryUsage;
|
|
200
|
+
}
|
|
201
|
+
const n = this.count();
|
|
202
|
+
const rawBytes = n * this.dim * 4;
|
|
203
|
+
const actualBytes = Math.ceil(n * this.dim * this.bits / 8);
|
|
204
|
+
return {
|
|
205
|
+
totalBits: actualBytes * 8,
|
|
206
|
+
bitsPerVector: this.bits * this.dim,
|
|
207
|
+
compressionRatio: actualBytes > 0 ? rawBytes / actualBytes : 1,
|
|
208
|
+
actualBytes
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
count() {
|
|
212
|
+
if (!this._available || !this.index) return 0;
|
|
213
|
+
try {
|
|
214
|
+
if (this.index.idToIndex instanceof Map) return this.index.idToIndex.size;
|
|
215
|
+
if (typeof this.index.size === "number") return this.index.size;
|
|
216
|
+
} catch {
|
|
217
|
+
}
|
|
218
|
+
return 0;
|
|
219
|
+
}
|
|
220
|
+
/** All IDs currently in the index. */
|
|
221
|
+
getEmbeddedIds() {
|
|
222
|
+
if (!this._available || !this.index) return [];
|
|
223
|
+
try {
|
|
224
|
+
if (this.index.idToIndex instanceof Map) {
|
|
225
|
+
return [...this.index.idToIndex.keys()];
|
|
226
|
+
}
|
|
227
|
+
} catch {
|
|
228
|
+
}
|
|
229
|
+
return [];
|
|
230
|
+
}
|
|
231
|
+
close() {
|
|
232
|
+
this.index = null;
|
|
233
|
+
this._available = false;
|
|
234
|
+
}
|
|
235
|
+
// ── Private ────────────────────────────────────────────────────────────────
|
|
236
|
+
_normaliseSearchResults(raw) {
|
|
237
|
+
if (!Array.isArray(raw)) return [];
|
|
238
|
+
return raw.map((item, rank) => {
|
|
239
|
+
if (item && typeof item === "object" && !Array.isArray(item)) {
|
|
240
|
+
const obj = item;
|
|
241
|
+
const id = obj["id"] ?? obj["key"] ?? "";
|
|
242
|
+
const score = obj["score"] ?? obj["similarity"] ?? obj["distance"] ?? 1 - rank / raw.length;
|
|
243
|
+
return { id, score: typeof score === "number" ? score : 1 - rank / raw.length };
|
|
244
|
+
}
|
|
245
|
+
if (Array.isArray(item) && item.length >= 2) {
|
|
246
|
+
return { id: String(item[0]), score: typeof item[1] === "number" ? item[1] : 1 - rank / raw.length };
|
|
247
|
+
}
|
|
248
|
+
if (typeof item === "string") {
|
|
249
|
+
return { id: item, score: 1 - rank / raw.length };
|
|
250
|
+
}
|
|
251
|
+
return null;
|
|
252
|
+
}).filter((r) => r !== null && r.id.length > 0);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
256
|
+
0 && (module.exports = {
|
|
257
|
+
TurboQuantIndex,
|
|
258
|
+
readTurboQuantStats,
|
|
259
|
+
writeTurboQuantStats
|
|
260
|
+
});
|
|
261
|
+
//# sourceMappingURL=turboquant-index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/vectors/turboquant-index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph TurboQuant ANN Index\n *\n * Wraps turboquant-js (Google TurboQuant algorithm) as a drop-in ANN index.\n * Compresses embeddings at index time via Walsh-Hadamard rotation + Lloyd-Max\n * scalar quantization \u2014 zero native dependencies.\n *\n * Optional dep: npm install turboquant-js\n *\n * Algorithm: https://research.google/blog/turboquant-redefining-ai-efficiency-with-extreme-compression/\n * Implementation: https://github.com/danilodevhub/turboquant-js (by Danilo Dev)\n *\n * Falls back silently to cosine if turboquant-js is not installed.\n *\n * Compression at 3 bits (default):\n * 768-dim Float32 (3,072 bytes) \u2192 ~120 bytes (\u224825\u00D7 smaller)\n * 10K vectors: ~30 MB raw \u2192 ~1.2 MB compressed\n */\n\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport { logDebug, logWarn, logError } from '../errors';\n\n// \u2500\u2500 TurboQuantStats \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface TurboQuantStats {\n count: number;\n dim: number;\n bits: number;\n compressionRatio: number;\n actualBytes: number;\n rawBytes: number;\n savedBytes: number;\n memEnabled: boolean;\n memCount: number;\n memActualBytes: number;\n memRawBytes: number;\n docsEnabled: boolean;\n docsCount: number;\n docsActualBytes: number;\n docsRawBytes: number;\n updatedAt: number;\n}\n\nconst STATS_FILE = 'turboquant-stats.json';\n\nexport function readTurboQuantStats(kirographDir: string): TurboQuantStats | null {\n try {\n const p = path.join(kirographDir, STATS_FILE);\n if (!fs.existsSync(p)) return null;\n return JSON.parse(fs.readFileSync(p, 'utf8')) as TurboQuantStats;\n } catch {\n return null;\n }\n}\n\nexport function writeTurboQuantStats(kirographDir: string, patch: Partial<TurboQuantStats>): void {\n const p = path.join(kirographDir, STATS_FILE);\n const tmp = p + '.tmp';\n try {\n const existing = readTurboQuantStats(kirographDir) ?? {\n count: 0, dim: 768, bits: 3,\n compressionRatio: 1, actualBytes: 0, rawBytes: 0, savedBytes: 0,\n memEnabled: false, memCount: 0, memActualBytes: 0, memRawBytes: 0,\n docsEnabled: false, docsCount: 0, docsActualBytes: 0, docsRawBytes: 0,\n updatedAt: 0,\n };\n const updated: TurboQuantStats = { ...existing, ...patch, updatedAt: Math.floor(Date.now() / 1000) };\n fs.writeFileSync(tmp, JSON.stringify(updated, null, 2));\n fs.renameSync(tmp, p);\n } catch (err) {\n logWarn('TurboQuantIndex: failed to write stats file', { error: String(err) });\n try { fs.unlinkSync(tmp); } catch { /* ignore */ }\n }\n}\n\n// \u2500\u2500 TurboQuantIndex \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport class TurboQuantIndex {\n private index: any = null;\n private _available = false;\n\n constructor(\n private readonly kirographDir: string,\n private readonly binName: string, // 'turboquant.bin' | 'turboquant-mem.bin' | 'turboquant-doc.bin'\n private readonly dim: number,\n private readonly bits: number = 3,\n ) {}\n\n isAvailable(): boolean {\n return this._available;\n }\n\n /**\n * Load turboquant-js and restore index from disk if the .bin file exists.\n * Silent no-op when the optional dependency is missing.\n */\n async initialize(): Promise<void> {\n if (this._available) return;\n\n let TQModule: any;\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n TQModule = require('turboquant-js');\n } catch {\n logDebug('TurboQuantIndex: turboquant-js not installed \u2014 turboquant engine unavailable');\n return;\n }\n\n // Handle various export shapes (default export, named export, CJS wrapper)\n const VectorIndex =\n TQModule?.VectorIndex ??\n TQModule?.default?.VectorIndex ??\n (typeof TQModule === 'function' ? TQModule : null);\n\n if (!VectorIndex || typeof VectorIndex !== 'function') {\n logWarn('TurboQuantIndex: unrecognised turboquant-js module shape \u2014 turboquant engine unavailable');\n return;\n }\n\n const binPath = path.join(this.kirographDir, this.binName);\n\n try {\n if (fs.existsSync(binPath) && typeof VectorIndex.fromBuffer === 'function') {\n const nodeBuf = fs.readFileSync(binPath);\n // fromBuffer() requires a pure ArrayBuffer, not a Node Buffer/Uint8Array\n const ab = nodeBuf.buffer.slice(nodeBuf.byteOffset, nodeBuf.byteOffset + nodeBuf.byteLength);\n this.index = VectorIndex.fromBuffer(ab, { dimension: this.dim, bits: this.bits });\n logDebug('TurboQuantIndex: restored from disk', { binPath });\n } else {\n this.index = new VectorIndex({ dimension: this.dim, bits: this.bits });\n logDebug('TurboQuantIndex: new index', { dim: this.dim, bits: this.bits });\n }\n this._available = true;\n } catch (err) {\n logError('TurboQuantIndex: initialization failed', { error: String(err) });\n this._available = false;\n this.index = null;\n }\n }\n\n /** Add or update an embedding (turboquant-js compresses at index time). */\n upsert(id: string, vec: Float32Array): void {\n if (!this._available || !this.index) return;\n try {\n this.index.add(id, vec);\n } catch (err) {\n logWarn('TurboQuantIndex: upsert failed', { id, error: String(err) });\n }\n }\n\n /** Remove an entry from the index (permanent via turboquant-js remove()). */\n delete(id: string): void {\n if (!this._available || !this.index) return;\n try {\n this.index.remove(id);\n } catch (err) {\n logWarn('TurboQuantIndex: delete failed', { id, error: String(err) });\n }\n }\n\n /** ANN search: returns IDs sorted by descending similarity. */\n search(queryVec: Float32Array, topN = 10): string[] {\n return this.searchWithScores(queryVec, topN).map(r => r.id);\n }\n\n /**\n * ANN search: returns [{id, score}] sorted by descending similarity.\n * Used by MemoryVectorManager and DocsVectorManager to preserve scores for\n * hybrid merge.\n */\n searchWithScores(queryVec: Float32Array, topN = 10): Array<{ id: string; score: number }> {\n if (!this._available || !this.index) return [];\n try {\n const raw: unknown = this.index.search(queryVec, topN);\n return this._normaliseSearchResults(raw).slice(0, topN);\n } catch (err) {\n logWarn('TurboQuantIndex: search failed', { error: String(err) });\n return [];\n }\n }\n\n /**\n * Persist the compressed index to disk atomically.\n * Called once at the end of `kirograph index` \u2014 not on every upsert.\n */\n async save(): Promise<void> {\n if (!this._available || !this.index) return;\n if (typeof this.index.toBuffer !== 'function') {\n logDebug('TurboQuantIndex: toBuffer() not available \u2014 index not persisted');\n return;\n }\n\n const binPath = path.join(this.kirographDir, this.binName);\n const tmp = binPath + '.tmp';\n try {\n const raw = this.index.toBuffer();\n // toBuffer() may return ArrayBuffer \u2014 Node fs requires Buffer/TypedArray\n const buf = raw instanceof ArrayBuffer ? Buffer.from(raw) : (raw as Buffer);\n fs.writeFileSync(tmp, buf);\n fs.renameSync(tmp, binPath);\n logDebug('TurboQuantIndex: saved', { binPath, bytes: buf.length });\n } catch (err) {\n logWarn('TurboQuantIndex: save failed', { error: String(err) });\n try { fs.unlinkSync(tmp); } catch { /* ignore */ }\n }\n }\n\n /**\n * Memory usage stats from the compressed index.\n * Falls back to a formula-based estimate when memoryUsage is unavailable.\n */\n memoryStats(): { totalBits: number; bitsPerVector: number; compressionRatio: number; actualBytes: number } {\n if (this._available && this.index?.memoryUsage) {\n return this.index.memoryUsage as { totalBits: number; bitsPerVector: number; compressionRatio: number; actualBytes: number };\n }\n const n = this.count();\n const rawBytes = n * this.dim * 4;\n const actualBytes = Math.ceil(n * this.dim * this.bits / 8);\n return {\n totalBits: actualBytes * 8,\n bitsPerVector: this.bits * this.dim,\n compressionRatio: actualBytes > 0 ? rawBytes / actualBytes : 1,\n actualBytes,\n };\n }\n\n count(): number {\n if (!this._available || !this.index) return 0;\n try {\n // idToIndex is an internal Map \u2014 reliable count that survives remove()\n if (this.index.idToIndex instanceof Map) return this.index.idToIndex.size;\n if (typeof this.index.size === 'number') return this.index.size;\n } catch { /* ignore */ }\n return 0;\n }\n\n /** All IDs currently in the index. */\n getEmbeddedIds(): string[] {\n if (!this._available || !this.index) return [];\n try {\n if (this.index.idToIndex instanceof Map) {\n return [...this.index.idToIndex.keys()];\n }\n } catch { /* ignore */ }\n return [];\n }\n\n close(): void {\n this.index = null;\n this._available = false;\n }\n\n // \u2500\u2500 Private \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n private _normaliseSearchResults(raw: unknown): Array<{ id: string; score: number }> {\n if (!Array.isArray(raw)) return [];\n\n return raw\n .map((item: unknown, rank: number) => {\n if (item && typeof item === 'object' && !Array.isArray(item)) {\n const obj = item as Record<string, unknown>;\n const id = (obj['id'] ?? obj['key'] ?? '') as string;\n const score = (obj['score'] ?? obj['similarity'] ?? obj['distance'] ?? (1 - rank / raw.length)) as number;\n return { id, score: typeof score === 'number' ? score : 1 - rank / raw.length };\n }\n if (Array.isArray(item) && item.length >= 2) {\n return { id: String(item[0]), score: typeof item[1] === 'number' ? item[1] : 1 - rank / raw.length };\n }\n if (typeof item === 'string') {\n return { id: item, score: 1 - rank / raw.length };\n }\n return null;\n })\n .filter((r): r is { id: string; score: number } => r !== null && r.id.length > 0);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBA,WAAsB;AACtB,SAAoB;AACpB,oBAA4C;AAuB5C,MAAM,aAAa;AAEZ,SAAS,oBAAoB,cAA8C;AAChF,MAAI;AACF,UAAM,IAAI,KAAK,KAAK,cAAc,UAAU;AAC5C,QAAI,CAAC,GAAG,WAAW,CAAC,EAAG,QAAO;AAC9B,WAAO,KAA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,YAAY,CAAC,MAAM,QAAQ,IAAI,GAAG;AAC5D,cAAM,MAAM;AACZ,cAAM,KAAM,IAAI,IAAI,KAAK,IAAI,KAAK,KAAK;AACvC,cAAM,QAAS,IAAI,OAAO,KAAK,IAAI,YAAY,KAAK,IAAI,UAAU,KAAM,IAAI,OAAO,IAAI;AACvF,eAAO,EAAE,IAAI,OAAO,OAAO,UAAU,WAAW,QAAQ,IAAI,OAAO,IAAI,OAAO;AAAA,MAChF;AACA,UAAI,MAAM,QAAQ,IAAI,KAAK,KAAK,UAAU,GAAG;AAC3C,eAAO,EAAE,IAAI,OAAO,KAAK,CAAC,CAAC,GAAG,OAAO,OAAO,KAAK,CAAC,MAAM,WAAW,KAAK,CAAC,IAAI,IAAI,OAAO,IAAI,OAAO;AAAA,MACrG;AACA,UAAI,OAAO,SAAS,UAAU;AAC5B,eAAO,EAAE,IAAI,MAAM,OAAO,IAAI,OAAO,IAAI,OAAO;AAAA,MAClD;AACA,aAAO;AAAA,IACT,CAAC,EACA,OAAO,CAAC,MAA0C,MAAM,QAAQ,EAAE,GAAG,SAAS,CAAC;AAAA,EACpF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typesense-index.d.ts","sourceRoot":"","sources":["../../src/vectors/typesense-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"typesense-index.d.ts","sourceRoot":"","sources":["../../src/vectors/typesense-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AASH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AA4HrC,qBAAa,cAAc;IAUvB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG;IAVtB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAW;gBAGT,YAAY,EAAE,MAAM,EACpB,GAAG,SAAc;IAMpC,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,cAAc;IAItB,WAAW,IAAI,OAAO;IAItB,aAAa,IAAI,MAAM,GAAG,IAAI;IAI9B;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YAkInB,gBAAgB;IAiB9B;;;OAGG;IACG,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBhE;;;OAGG;IACG,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB1E;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa3C;;OAEG;IACG,MAAM,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,SAAK,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IA0BlE;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAwB7C,uDAAuD;IACjD,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IAY9B;;;OAGG;IACH,KAAK,IAAI,IAAI;CAKd"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var watchmen_exports = {};
|
|
30
|
+
__export(watchmen_exports, {
|
|
31
|
+
WatchmenChecker: () => WatchmenChecker
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(watchmen_exports);
|
|
34
|
+
var fs = __toESM(require("fs"));
|
|
35
|
+
var path = __toESM(require("path"));
|
|
36
|
+
const TARGET_ENTRIES = [
|
|
37
|
+
{ detect: (root) => fs.existsSync(path.join(root, ".kiro")), target: ".kiro/steering/kirograph-watchmen.md" },
|
|
38
|
+
{ detect: (root) => fs.existsSync(path.join(root, "CLAUDE.md")), target: "CLAUDE.md" },
|
|
39
|
+
{ detect: (root) => fs.existsSync(path.join(root, "GEMINI.md")), target: "GEMINI.md" },
|
|
40
|
+
{ detect: (root) => fs.existsSync(path.join(root, "CONVENTIONS.md")), target: "CONVENTIONS.md" },
|
|
41
|
+
{ detect: (root) => fs.existsSync(path.join(root, "augment-guidelines.md")), target: "augment-guidelines.md" },
|
|
42
|
+
{ detect: (root) => fs.existsSync(path.join(root, "AGENTS.md")), target: "AGENTS.md" }
|
|
43
|
+
];
|
|
44
|
+
class WatchmenChecker {
|
|
45
|
+
constructor(threshold) {
|
|
46
|
+
this.threshold = threshold;
|
|
47
|
+
}
|
|
48
|
+
shouldSynthesize(memDb) {
|
|
49
|
+
const pendingCount = memDb.countSinceLastSummary();
|
|
50
|
+
return { ready: pendingCount >= this.threshold, pendingCount };
|
|
51
|
+
}
|
|
52
|
+
buildReadyResponse(id, pendingCount, projectRoot) {
|
|
53
|
+
const targetFiles = this.resolveTargetFiles(projectRoot);
|
|
54
|
+
const hasKiro = fs.existsSync(path.join(projectRoot, ".kiro"));
|
|
55
|
+
const skillTargetDir = hasKiro ? ".kiro/steering" : void 0;
|
|
56
|
+
const skillInstructions = skillTargetDir ? `For each recurring procedure (appearing in 3+ observations): write a separate \`.kiro/steering/watchmen-<slug>.md\` file with \`inclusion: manual\` frontmatter, a short title, trigger phrases (when to load this skill), and numbered steps. Use \`watchmen-\` prefix so auto-generated skills are distinguishable. Delete any \`.kiro/steering/watchmen-*.md\` files from previous runs that no longer reflect current patterns.` : `Embed a ## Recurring Procedures section in each file in targetFiles listing each identified recurring procedure with trigger context and numbered steps.`;
|
|
57
|
+
return {
|
|
58
|
+
id,
|
|
59
|
+
watchmenReady: true,
|
|
60
|
+
pendingCount,
|
|
61
|
+
message: `${pendingCount} new observations since last synthesis. Synthesize now: (1) call kirograph_mem_search for each kind (decision, error, pattern, architecture, note) with limit 20, (2) write or update the workspace brief (## KiroGraph Watchmen section) in each file in targetFiles covering decisions, errors, patterns, and architecture notes, (3) identify recurring procedures: ${skillInstructions} (4) store a kind='summary' observation to mark completion.`,
|
|
62
|
+
targetFiles,
|
|
63
|
+
...skillTargetDir !== void 0 ? { skillTargetDir } : {}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
resolveTargetFiles(projectRoot) {
|
|
67
|
+
const files = [];
|
|
68
|
+
for (const entry of TARGET_ENTRIES) {
|
|
69
|
+
if (entry.detect(projectRoot)) {
|
|
70
|
+
files.push(entry.target);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (files.length === 0) {
|
|
74
|
+
files.push("AGENTS.md");
|
|
75
|
+
}
|
|
76
|
+
return files;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
+
0 && (module.exports = {
|
|
81
|
+
WatchmenChecker
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/watchmen/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph Watchmen \u2014 threshold checker and target file resolver\n *\n * No state file. The watermark is the last kind='summary' observation.\n * Counting observations since that timestamp tells us when to synthesize.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { MemoryDatabase } from '../memory/database';\nimport type { WatchmenReadyResult } from '../memory/types';\n\n// \u2500\u2500 Target file detection \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst TARGET_ENTRIES: Array<{ detect: (root: string) => boolean; target: string }> = [\n { detect: root => fs.existsSync(path.join(root, '.kiro')), target: '.kiro/steering/kirograph-watchmen.md' },\n { detect: root => fs.existsSync(path.join(root, 'CLAUDE.md')), target: 'CLAUDE.md' },\n { detect: root => fs.existsSync(path.join(root, 'GEMINI.md')), target: 'GEMINI.md' },\n { detect: root => fs.existsSync(path.join(root, 'CONVENTIONS.md')), target: 'CONVENTIONS.md' },\n { detect: root => fs.existsSync(path.join(root, 'augment-guidelines.md')), target: 'augment-guidelines.md' },\n { detect: root => fs.existsSync(path.join(root, 'AGENTS.md')), target: 'AGENTS.md' },\n];\n\n// \u2500\u2500 WatchmenChecker \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport class WatchmenChecker {\n constructor(private readonly threshold: number) {}\n\n shouldSynthesize(memDb: MemoryDatabase): { ready: boolean; pendingCount: number } {\n const pendingCount = memDb.countSinceLastSummary();\n return { ready: pendingCount >= this.threshold, pendingCount };\n }\n\n buildReadyResponse(id: string, pendingCount: number, projectRoot: string): WatchmenReadyResult {\n const targetFiles = this.resolveTargetFiles(projectRoot);\n const hasKiro = fs.existsSync(path.join(projectRoot, '.kiro'));\n const skillTargetDir = hasKiro ? '.kiro/steering' : undefined;\n\n const skillInstructions = skillTargetDir\n ? `For each recurring procedure (appearing in 3+ observations): write a separate ` +\n `\\`.kiro/steering/watchmen-<slug>.md\\` file with \\`inclusion: manual\\` frontmatter, ` +\n `a short title, trigger phrases (when to load this skill), and numbered steps. ` +\n `Use \\`watchmen-\\` prefix so auto-generated skills are distinguishable. ` +\n `Delete any \\`.kiro/steering/watchmen-*.md\\` files from previous runs that no ` +\n `longer reflect current patterns.`\n : `Embed a ## Recurring Procedures section in each file in targetFiles listing ` +\n `each identified recurring procedure with trigger context and numbered steps.`;\n\n return {\n id,\n watchmenReady: true,\n pendingCount,\n message:\n `${pendingCount} new observations since last synthesis. ` +\n `Synthesize now: (1) call kirograph_mem_search for each kind ` +\n `(decision, error, pattern, architecture, note) with limit 20, ` +\n `(2) write or update the workspace brief (## KiroGraph Watchmen section) ` +\n `in each file in targetFiles covering decisions, errors, patterns, and ` +\n `architecture notes, (3) identify recurring procedures: ${skillInstructions} ` +\n `(4) store a kind='summary' observation to mark completion.`,\n targetFiles,\n ...(skillTargetDir !== undefined ? { skillTargetDir } : {}),\n };\n }\n\n private resolveTargetFiles(projectRoot: string): string[] {\n const files: string[] = [];\n for (const entry of TARGET_ENTRIES) {\n if (entry.detect(projectRoot)) {\n files.push(entry.target);\n }\n }\n // Last-resort fallback for tools with no recognized project memory file\n if (files.length === 0) {\n files.push('AGENTS.md');\n }\n return files;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,SAAoB;AACpB,WAAsB;AAMtB,MAAM,iBAA+E;AAAA,EACnF,EAAE,QAAQ,UAAQ,GAAG,WAAW,KAAK,KAAK,MAAM,OAAO,CAAC,GAAoB,QAAQ,uCAAuC;AAAA,EAC3H,EAAE,QAAQ,UAAQ,GAAG,WAAW,KAAK,KAAK,MAAM,WAAW,CAAC,GAAgB,QAAQ,YAAY;AAAA,EAChG,EAAE,QAAQ,UAAQ,GAAG,WAAW,KAAK,KAAK,MAAM,WAAW,CAAC,GAAgB,QAAQ,YAAY;AAAA,EAChG,EAAE,QAAQ,UAAQ,GAAG,WAAW,KAAK,KAAK,MAAM,gBAAgB,CAAC,GAAW,QAAQ,iBAAiB;AAAA,EACrG,EAAE,QAAQ,UAAQ,GAAG,WAAW,KAAK,KAAK,MAAM,uBAAuB,CAAC,GAAG,QAAQ,wBAAwB;AAAA,EAC3G,EAAE,QAAQ,UAAQ,G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