@vpxa/kb 0.1.13 → 0.1.15
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 +8 -2
- package/package.json +10 -7
- package/packages/analyzers/dist/blast-radius-analyzer.d.ts +17 -20
- package/packages/analyzers/dist/blast-radius-analyzer.js +6 -12
- package/packages/analyzers/dist/dependency-analyzer.d.ts +31 -27
- package/packages/analyzers/dist/dependency-analyzer.js +7 -9
- package/packages/analyzers/dist/diagram-generator.d.ts +12 -8
- package/packages/analyzers/dist/diagram-generator.js +3 -4
- package/packages/analyzers/dist/entry-point-analyzer.d.ts +39 -35
- package/packages/analyzers/dist/entry-point-analyzer.js +5 -6
- package/packages/analyzers/dist/index.d.ts +12 -14
- package/packages/analyzers/dist/index.js +1 -1
- package/packages/analyzers/dist/knowledge-producer.d.ts +29 -25
- package/packages/analyzers/dist/knowledge-producer.js +16 -15
- package/packages/analyzers/dist/pattern-analyzer.d.ts +14 -10
- package/packages/analyzers/dist/pattern-analyzer.js +3 -5
- package/packages/analyzers/dist/regex-call-graph.d.ts +6 -12
- package/packages/analyzers/dist/regex-call-graph.js +2 -1
- package/packages/analyzers/dist/structure-analyzer.d.ts +13 -9
- package/packages/analyzers/dist/structure-analyzer.js +3 -4
- package/packages/analyzers/dist/symbol-analyzer.d.ts +12 -8
- package/packages/analyzers/dist/symbol-analyzer.js +8 -13
- package/packages/analyzers/dist/ts-call-graph.d.ts +16 -13
- package/packages/analyzers/dist/ts-call-graph.js +2 -1
- package/packages/analyzers/dist/types.d.ts +82 -79
- package/packages/analyzers/dist/types.js +1 -0
- package/packages/chunker/dist/call-graph-extractor.d.ts +13 -10
- package/packages/chunker/dist/call-graph-extractor.js +2 -1
- package/packages/chunker/dist/chunker-factory.d.ts +6 -2
- package/packages/chunker/dist/chunker-factory.js +2 -1
- package/packages/chunker/dist/chunker.interface.d.ts +8 -4
- package/packages/chunker/dist/chunker.interface.js +1 -0
- package/packages/chunker/dist/code-chunker.d.ts +16 -12
- package/packages/chunker/dist/code-chunker.js +12 -14
- package/packages/chunker/dist/generic-chunker.d.ts +14 -10
- package/packages/chunker/dist/generic-chunker.js +6 -5
- package/packages/chunker/dist/index.d.ts +8 -8
- package/packages/chunker/dist/index.js +1 -1
- package/packages/chunker/dist/markdown-chunker.d.ts +16 -12
- package/packages/chunker/dist/markdown-chunker.js +4 -10
- package/packages/chunker/dist/treesitter-chunker.d.ts +28 -31
- package/packages/chunker/dist/treesitter-chunker.js +7 -8
- package/packages/cli/dist/commands/analyze.d.ts +6 -2
- package/packages/cli/dist/commands/analyze.js +3 -3
- package/packages/cli/dist/commands/context-cmds.d.ts +6 -2
- package/packages/cli/dist/commands/context-cmds.js +2 -1
- package/packages/cli/dist/commands/environment.d.ts +6 -2
- package/packages/cli/dist/commands/environment.js +2 -2
- package/packages/cli/dist/commands/execution.d.ts +6 -2
- package/packages/cli/dist/commands/execution.js +2 -1
- package/packages/cli/dist/commands/graph.d.ts +6 -2
- package/packages/cli/dist/commands/graph.js +6 -6
- package/packages/cli/dist/commands/init/adapters.d.ts +27 -0
- package/packages/cli/dist/commands/init/adapters.js +2 -0
- package/packages/cli/dist/commands/init/config.d.ts +11 -0
- package/packages/cli/dist/commands/init/config.js +4 -0
- package/packages/cli/dist/commands/init/curated.d.ts +8 -0
- package/packages/cli/dist/commands/init/curated.js +2 -0
- package/packages/cli/dist/commands/init/index.d.ts +23 -0
- package/packages/cli/dist/commands/init/index.js +3 -0
- package/packages/cli/dist/commands/init/scaffold.d.ts +24 -0
- package/packages/cli/dist/commands/init/scaffold.js +2 -0
- package/packages/cli/dist/commands/init/templates.d.ts +10 -0
- package/packages/cli/dist/commands/init/templates.js +302 -0
- package/packages/cli/dist/commands/init.d.ts +8 -3
- package/packages/cli/dist/commands/init.js +120 -123
- package/packages/cli/dist/commands/knowledge.d.ts +6 -2
- package/packages/cli/dist/commands/knowledge.js +2 -1
- package/packages/cli/dist/commands/search.d.ts +6 -2
- package/packages/cli/dist/commands/search.js +2 -8
- package/packages/cli/dist/commands/system.d.ts +6 -2
- package/packages/cli/dist/commands/system.js +5 -7
- package/packages/cli/dist/commands/workspace.d.ts +6 -2
- package/packages/cli/dist/commands/workspace.js +2 -2
- package/packages/cli/dist/context.d.ts +7 -4
- package/packages/cli/dist/context.js +2 -1
- package/packages/cli/dist/helpers.d.ts +51 -47
- package/packages/cli/dist/helpers.js +6 -5
- package/packages/cli/dist/index.d.ts +4 -1
- package/packages/cli/dist/index.js +3 -2
- package/packages/cli/dist/kb-init.d.ts +48 -50
- package/packages/cli/dist/kb-init.js +2 -1
- package/packages/cli/dist/types.d.ts +8 -5
- package/packages/cli/dist/types.js +1 -0
- package/packages/core/dist/constants.d.ts +36 -33
- package/packages/core/dist/constants.js +2 -1
- package/packages/core/dist/content-detector.d.ts +8 -7
- package/packages/core/dist/content-detector.js +2 -1
- package/packages/core/dist/errors.d.ts +15 -12
- package/packages/core/dist/errors.js +2 -1
- package/packages/core/dist/index.d.ts +6 -6
- package/packages/core/dist/index.js +1 -1
- package/packages/core/dist/logger.d.ts +16 -7
- package/packages/core/dist/logger.js +2 -1
- package/packages/core/dist/types.d.ts +107 -91
- package/packages/core/dist/types.js +2 -0
- package/packages/embeddings/dist/embedder.interface.d.ts +22 -19
- package/packages/embeddings/dist/embedder.interface.js +1 -0
- package/packages/embeddings/dist/index.d.ts +3 -3
- package/packages/embeddings/dist/index.js +1 -1
- package/packages/embeddings/dist/onnx-embedder.d.ts +21 -22
- package/packages/embeddings/dist/onnx-embedder.js +2 -1
- package/packages/enterprise-bridge/dist/cache.d.ts +29 -0
- package/packages/enterprise-bridge/dist/cache.js +2 -0
- package/packages/enterprise-bridge/dist/er-client.d.ts +38 -0
- package/packages/enterprise-bridge/dist/er-client.js +2 -0
- package/packages/enterprise-bridge/dist/evolution-collector.d.ts +63 -0
- package/packages/enterprise-bridge/dist/evolution-collector.js +2 -0
- package/packages/enterprise-bridge/dist/index.d.ts +8 -0
- package/packages/enterprise-bridge/dist/index.js +1 -0
- package/packages/enterprise-bridge/dist/policy-store.d.ts +46 -0
- package/packages/enterprise-bridge/dist/policy-store.js +2 -0
- package/packages/enterprise-bridge/dist/push-adapter.d.ts +24 -0
- package/packages/enterprise-bridge/dist/push-adapter.js +2 -0
- package/packages/enterprise-bridge/dist/result-merger.d.ts +15 -0
- package/packages/enterprise-bridge/dist/result-merger.js +2 -0
- package/packages/enterprise-bridge/dist/types.d.ts +82 -0
- package/packages/enterprise-bridge/dist/types.js +2 -0
- package/packages/indexer/dist/file-hasher.d.ts +5 -2
- package/packages/indexer/dist/file-hasher.js +2 -1
- package/packages/indexer/dist/filesystem-crawler.d.ts +23 -20
- package/packages/indexer/dist/filesystem-crawler.js +2 -1
- package/packages/indexer/dist/graph-extractor.d.ts +9 -12
- package/packages/indexer/dist/graph-extractor.js +2 -1
- package/packages/indexer/dist/incremental-indexer.d.ts +49 -43
- package/packages/indexer/dist/incremental-indexer.js +2 -1
- package/packages/indexer/dist/index.d.ts +5 -5
- package/packages/indexer/dist/index.js +1 -1
- package/packages/server/dist/api.d.ts +3 -8
- package/packages/server/dist/api.js +1 -1
- package/packages/server/dist/config.d.ts +6 -2
- package/packages/server/dist/config.js +2 -1
- package/packages/server/dist/curated-manager.d.ts +79 -76
- package/packages/server/dist/curated-manager.js +6 -10
- package/packages/server/dist/index.d.ts +1 -2
- package/packages/server/dist/index.js +2 -1
- package/packages/server/dist/replay-interceptor.d.ts +6 -6
- package/packages/server/dist/replay-interceptor.js +2 -1
- package/packages/server/dist/resources/resources.d.ts +7 -3
- package/packages/server/dist/resources/resources.js +3 -2
- package/packages/server/dist/server.d.ts +34 -24
- package/packages/server/dist/server.js +2 -1
- package/packages/server/dist/tools/analyze.tools.d.ts +14 -10
- package/packages/server/dist/tools/analyze.tools.js +2 -3
- package/packages/server/dist/tools/audit.tool.d.ts +8 -4
- package/packages/server/dist/tools/audit.tool.js +2 -4
- package/packages/server/dist/tools/bridge.tools.d.ts +35 -0
- package/packages/server/dist/tools/bridge.tools.js +16 -0
- package/packages/server/dist/tools/evolution.tools.d.ts +8 -0
- package/packages/server/dist/tools/evolution.tools.js +6 -0
- package/packages/server/dist/tools/forge.tools.d.ts +13 -11
- package/packages/server/dist/tools/forge.tools.js +11 -13
- package/packages/server/dist/tools/forget.tool.d.ts +7 -3
- package/packages/server/dist/tools/forget.tool.js +2 -7
- package/packages/server/dist/tools/graph.tool.d.ts +7 -3
- package/packages/server/dist/tools/graph.tool.js +5 -5
- package/packages/server/dist/tools/list.tool.d.ts +7 -3
- package/packages/server/dist/tools/list.tool.js +3 -8
- package/packages/server/dist/tools/lookup.tool.d.ts +7 -3
- package/packages/server/dist/tools/lookup.tool.js +3 -9
- package/packages/server/dist/tools/onboard.tool.d.ts +8 -4
- package/packages/server/dist/tools/onboard.tool.js +3 -2
- package/packages/server/dist/tools/policy.tools.d.ts +8 -0
- package/packages/server/dist/tools/policy.tools.js +3 -0
- package/packages/server/dist/tools/produce.tool.d.ts +6 -2
- package/packages/server/dist/tools/produce.tool.js +3 -2
- package/packages/server/dist/tools/read.tool.d.ts +7 -3
- package/packages/server/dist/tools/read.tool.js +3 -6
- package/packages/server/dist/tools/reindex.tool.d.ts +10 -6
- package/packages/server/dist/tools/reindex.tool.js +3 -2
- package/packages/server/dist/tools/remember.tool.d.ts +8 -3
- package/packages/server/dist/tools/remember.tool.js +4 -5
- package/packages/server/dist/tools/replay.tool.d.ts +6 -2
- package/packages/server/dist/tools/replay.tool.js +3 -6
- package/packages/server/dist/tools/search.tool.d.ts +10 -4
- package/packages/server/dist/tools/search.tool.js +7 -22
- package/packages/server/dist/tools/status.tool.d.ts +7 -3
- package/packages/server/dist/tools/status.tool.js +3 -3
- package/packages/server/dist/tools/toolkit.tools.d.ts +36 -34
- package/packages/server/dist/tools/toolkit.tools.js +20 -24
- package/packages/server/dist/tools/update.tool.d.ts +7 -3
- package/packages/server/dist/tools/update.tool.js +2 -6
- package/packages/server/dist/tools/utility.tools.d.ts +15 -14
- package/packages/server/dist/tools/utility.tools.js +11 -23
- package/packages/server/dist/version-check.d.ts +5 -1
- package/packages/server/dist/version-check.js +2 -1
- package/packages/store/dist/graph-store.interface.d.ts +89 -86
- package/packages/store/dist/graph-store.interface.js +1 -0
- package/packages/store/dist/index.d.ts +6 -6
- package/packages/store/dist/index.js +1 -1
- package/packages/store/dist/lance-store.d.ts +37 -30
- package/packages/store/dist/lance-store.js +2 -1
- package/packages/store/dist/sqlite-graph-store.d.ts +43 -46
- package/packages/store/dist/sqlite-graph-store.js +14 -13
- package/packages/store/dist/store-factory.d.ts +11 -7
- package/packages/store/dist/store-factory.js +2 -1
- package/packages/store/dist/store.interface.d.ts +47 -46
- package/packages/store/dist/store.interface.js +1 -0
- package/packages/tools/dist/audit.d.ts +61 -61
- package/packages/tools/dist/audit.js +5 -5
- package/packages/tools/dist/batch.d.ts +20 -17
- package/packages/tools/dist/batch.js +2 -1
- package/packages/tools/dist/changelog.d.ts +29 -26
- package/packages/tools/dist/changelog.js +3 -2
- package/packages/tools/dist/check.d.ts +42 -38
- package/packages/tools/dist/check.js +3 -2
- package/packages/tools/dist/checkpoint.d.ts +17 -14
- package/packages/tools/dist/checkpoint.js +2 -2
- package/packages/tools/dist/codemod.d.ts +35 -32
- package/packages/tools/dist/codemod.js +3 -2
- package/packages/tools/dist/compact.d.ts +34 -37
- package/packages/tools/dist/compact.js +3 -2
- package/packages/tools/dist/data-transform.d.ts +10 -7
- package/packages/tools/dist/data-transform.js +2 -1
- package/packages/tools/dist/dead-symbols.d.ts +29 -25
- package/packages/tools/dist/dead-symbols.js +3 -2
- package/packages/tools/dist/delegate.d.ts +26 -23
- package/packages/tools/dist/delegate.js +2 -5
- package/packages/tools/dist/diff-parse.d.ts +24 -21
- package/packages/tools/dist/diff-parse.js +4 -3
- package/packages/tools/dist/digest.d.ts +43 -45
- package/packages/tools/dist/digest.js +5 -5
- package/packages/tools/dist/encode.d.ts +11 -8
- package/packages/tools/dist/encode.js +2 -1
- package/packages/tools/dist/env-info.d.ts +25 -22
- package/packages/tools/dist/env-info.js +2 -1
- package/packages/tools/dist/eval.d.ts +13 -10
- package/packages/tools/dist/eval.js +3 -3
- package/packages/tools/dist/evidence-map.d.ts +64 -61
- package/packages/tools/dist/evidence-map.js +3 -3
- package/packages/tools/dist/file-cache.d.ts +42 -0
- package/packages/tools/dist/file-cache.js +4 -0
- package/packages/tools/dist/file-summary.d.ts +34 -29
- package/packages/tools/dist/file-summary.js +3 -2
- package/packages/tools/dist/file-walk.d.ts +6 -3
- package/packages/tools/dist/file-walk.js +2 -1
- package/packages/tools/dist/find-examples.d.ts +26 -21
- package/packages/tools/dist/find-examples.js +4 -3
- package/packages/tools/dist/find.d.ts +39 -40
- package/packages/tools/dist/find.js +2 -1
- package/packages/tools/dist/forge-classify.d.ts +35 -38
- package/packages/tools/dist/forge-classify.js +3 -2
- package/packages/tools/dist/forge-ground.d.ts +58 -60
- package/packages/tools/dist/forge-ground.js +2 -1
- package/packages/tools/dist/git-context.d.ts +22 -19
- package/packages/tools/dist/git-context.js +4 -3
- package/packages/tools/dist/graph-query.d.ts +75 -78
- package/packages/tools/dist/graph-query.js +2 -1
- package/packages/tools/dist/guide.d.ts +14 -11
- package/packages/tools/dist/guide.js +2 -1
- package/packages/tools/dist/health.d.ts +13 -10
- package/packages/tools/dist/health.js +3 -2
- package/packages/tools/dist/http-request.d.ts +20 -17
- package/packages/tools/dist/http-request.js +2 -1
- package/packages/tools/dist/index.d.ts +54 -53
- package/packages/tools/dist/index.js +1 -1
- package/packages/tools/dist/lane.d.ts +28 -25
- package/packages/tools/dist/lane.js +7 -7
- package/packages/tools/dist/measure.d.ts +32 -29
- package/packages/tools/dist/measure.js +3 -2
- package/packages/tools/dist/onboard.d.ts +29 -26
- package/packages/tools/dist/onboard.js +18 -41
- package/packages/tools/dist/parse-output.d.ts +48 -45
- package/packages/tools/dist/parse-output.js +3 -2
- package/packages/tools/dist/path-resolver.d.ts +4 -1
- package/packages/tools/dist/path-resolver.js +2 -1
- package/packages/tools/dist/process-manager.d.ts +18 -15
- package/packages/tools/dist/process-manager.js +2 -1
- package/packages/tools/dist/queue.d.ts +28 -25
- package/packages/tools/dist/queue.js +2 -2
- package/packages/tools/dist/regex-test.d.ts +26 -23
- package/packages/tools/dist/regex-test.js +2 -1
- package/packages/tools/dist/rename.d.ts +28 -25
- package/packages/tools/dist/rename.js +3 -2
- package/packages/tools/dist/replay.d.ts +32 -29
- package/packages/tools/dist/replay.js +5 -6
- package/packages/tools/dist/response-envelope.d.ts +32 -29
- package/packages/tools/dist/response-envelope.js +2 -1
- package/packages/tools/dist/schema-validate.d.ts +15 -12
- package/packages/tools/dist/schema-validate.js +2 -1
- package/packages/tools/dist/scope-map.d.ts +45 -47
- package/packages/tools/dist/scope-map.js +2 -1
- package/packages/tools/dist/snippet.d.ts +26 -24
- package/packages/tools/dist/snippet.js +2 -1
- package/packages/tools/dist/stash.d.ts +13 -10
- package/packages/tools/dist/stash.js +2 -2
- package/packages/tools/dist/stratum-card.d.ts +27 -27
- package/packages/tools/dist/stratum-card.js +4 -5
- package/packages/tools/dist/symbol.d.ts +29 -25
- package/packages/tools/dist/symbol.js +4 -3
- package/packages/tools/dist/test-run.d.ts +19 -15
- package/packages/tools/dist/test-run.js +3 -2
- package/packages/tools/dist/text-utils.d.ts +6 -3
- package/packages/tools/dist/text-utils.js +3 -2
- package/packages/tools/dist/time-utils.d.ts +15 -12
- package/packages/tools/dist/time-utils.js +2 -1
- package/packages/tools/dist/trace.d.ts +24 -20
- package/packages/tools/dist/trace.js +3 -2
- package/packages/tools/dist/truncation.d.ts +6 -3
- package/packages/tools/dist/truncation.js +8 -14
- package/packages/tools/dist/watch.d.ts +28 -25
- package/packages/tools/dist/watch.js +2 -1
- package/packages/tools/dist/web-fetch.d.ts +35 -32
- package/packages/tools/dist/web-fetch.js +7 -12
- package/packages/tools/dist/web-search.d.ts +16 -13
- package/packages/tools/dist/web-search.js +2 -1
- package/packages/tools/dist/workset.d.ts +19 -16
- package/packages/tools/dist/workset.js +2 -2
- package/packages/tui/dist/App-BAlmxCCw.js +3 -0
- package/packages/tui/dist/App.d.ts +11 -5
- package/packages/tui/dist/App.js +1 -450
- package/packages/tui/dist/CuratedPanel-sYdZAICX.js +3 -0
- package/packages/tui/dist/LogPanel-DVB8Sv46.js +4 -0
- package/packages/tui/dist/SearchPanel-DREo6zgt.js +3 -0
- package/packages/tui/dist/StatusPanel-2ex8fLOO.js +3 -0
- package/packages/tui/dist/chunk-D6axbAb-.js +2 -0
- package/packages/tui/dist/devtools-DUyj952l.js +8 -0
- package/packages/tui/dist/embedder.interface-D4ew0HPW.d.ts +29 -0
- package/packages/tui/dist/index-B9VpfVPP.d.ts +14 -0
- package/packages/tui/dist/index.d.ts +3 -19
- package/packages/tui/dist/index.js +2 -476
- package/packages/tui/dist/jsx-runtime-Cof-kwFn.js +317 -0
- package/packages/tui/dist/panels/CuratedPanel.d.ts +11 -5
- package/packages/tui/dist/panels/CuratedPanel.js +1 -371
- package/packages/tui/dist/panels/LogPanel.d.ts +7 -2
- package/packages/tui/dist/panels/LogPanel.js +1 -449
- package/packages/tui/dist/panels/SearchPanel.d.ts +14 -7
- package/packages/tui/dist/panels/SearchPanel.js +1 -372
- package/packages/tui/dist/panels/StatusPanel.d.ts +11 -5
- package/packages/tui/dist/panels/StatusPanel.js +1 -371
- package/packages/tui/dist/store.interface-CnY6SPOH.d.ts +151 -0
- package/scaffold/adapters/claude-code.mjs +20 -0
- package/scaffold/adapters/copilot.mjs +320 -0
- package/scaffold/copilot/agents/Architect-Reviewer-Alpha.agent.md +14 -0
- package/scaffold/copilot/agents/Architect-Reviewer-Beta.agent.md +14 -0
- package/scaffold/copilot/agents/Code-Reviewer-Alpha.agent.md +12 -0
- package/scaffold/copilot/agents/Code-Reviewer-Beta.agent.md +12 -0
- package/scaffold/copilot/agents/Debugger.agent.md +31 -0
- package/scaffold/copilot/agents/Documenter.agent.md +35 -0
- package/scaffold/copilot/agents/Explorer.agent.md +50 -0
- package/scaffold/copilot/agents/Frontend.agent.md +29 -0
- package/scaffold/copilot/agents/Implementer.agent.md +31 -0
- package/scaffold/copilot/agents/Orchestrator.agent.md +96 -0
- package/scaffold/copilot/agents/Planner.agent.md +45 -0
- package/scaffold/copilot/agents/README.md +57 -0
- package/scaffold/copilot/agents/Refactor.agent.md +30 -0
- package/scaffold/copilot/agents/Researcher-Alpha.agent.md +12 -0
- package/scaffold/copilot/agents/Researcher-Beta.agent.md +12 -0
- package/scaffold/copilot/agents/Researcher-Delta.agent.md +12 -0
- package/scaffold/copilot/agents/Researcher-Gamma.agent.md +12 -0
- package/scaffold/copilot/agents/Security.agent.md +42 -0
- package/scaffold/copilot/agents/_shared/adr-protocol.md +91 -0
- package/scaffold/copilot/agents/_shared/architect-reviewer-base.md +50 -0
- package/scaffold/copilot/agents/_shared/code-agent-base.md +70 -0
- package/scaffold/copilot/agents/_shared/code-reviewer-base.md +54 -0
- package/scaffold/copilot/agents/_shared/decision-protocol.md +27 -0
- package/scaffold/copilot/agents/_shared/forge-protocol.md +46 -0
- package/scaffold/copilot/agents/_shared/researcher-base.md +61 -0
- package/scaffold/copilot/agents/templates/adr-template.md +27 -0
- package/scaffold/copilot/agents/templates/execution-state.md +25 -0
- package/scaffold/copilot/prompts/ask.prompt.md +20 -0
- package/scaffold/copilot/prompts/debug.prompt.md +25 -0
- package/scaffold/copilot/prompts/design.prompt.md +22 -0
- package/scaffold/copilot/prompts/implement.prompt.md +26 -0
- package/scaffold/copilot/prompts/plan.prompt.md +24 -0
- package/scaffold/copilot/prompts/review.prompt.md +31 -0
- package/scaffold/definitions/agents.mjs +165 -0
- package/scaffold/definitions/bodies.mjs +292 -0
- package/scaffold/definitions/hooks.mjs +43 -0
- package/scaffold/definitions/models.mjs +56 -0
- package/scaffold/definitions/plugins.mjs +24 -0
- package/scaffold/definitions/prompts.mjs +145 -0
- package/scaffold/definitions/protocols.mjs +322 -0
- package/scaffold/definitions/tools.mjs +176 -0
- package/scaffold/generate.mjs +74 -0
- package/skills/brainstorming/SKILL.md +259 -0
- package/skills/brainstorming/scripts/frame-template.html +365 -0
- package/skills/brainstorming/scripts/helper.js +216 -0
- package/skills/brainstorming/scripts/server.cjs +9 -0
- package/skills/brainstorming/scripts/server.src.cjs +249 -0
- package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/skills/brainstorming/visual-companion.md +430 -0
- package/skills/knowledge-base/SKILL.md +22 -9
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
function
|
|
2
|
-
`),
|
|
3
|
-
`)
|
|
1
|
+
function e(e){let{diff:r}=e,i=r.split(/^diff --git /m).filter(Boolean);return i.length>0&&/^a\//.test(i[0])?t(i):n(r)}function t(e){let t=[];for(let n of e){let e=n.split(`
|
|
2
|
+
`),r=e[0]?.match(/a\/(.+?)\s+b\/(.+)/);if(!r)continue;let i=r[1],a=r[2],o=`modified`;n.includes(`new file mode`)?o=`added`:n.includes(`deleted file mode`)?o=`deleted`:i!==a&&(o=`renamed`);let s=[],c=0,l=0,u=null,d=0,f=0;for(let t of e){let e=t.match(/^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@(.*)$/);if(e){u={oldStart:Number(e[1]),oldLines:Number(e[2]??1),newStart:Number(e[3]),newLines:Number(e[4]??1),header:e[5]?.trim()??``,changes:[]},s.push(u),d=u.oldStart,f=u.newStart;continue}if(!(!u||t.startsWith(`\\`))){if(t.startsWith(`+`)&&!t.startsWith(`+++`)){u.changes.push({type:`add`,line:f,content:t.slice(1)}),c+=1,f+=1;continue}if(t.startsWith(`-`)&&!t.startsWith(`---`)){u.changes.push({type:`delete`,line:d,content:t.slice(1)}),l+=1,d+=1;continue}t.startsWith(` `)&&(u.changes.push({type:`context`,line:f,content:t.slice(1)}),d+=1,f+=1)}}t.push({path:a,oldPath:o===`renamed`?i:void 0,status:o,hunks:s,additions:c,deletions:l})}return t}function n(e){let t=[],n=e.split(`
|
|
3
|
+
`),r=0;for(;r<n.length;){let e=n[r]?.match(/^---\s+(?:a\/)?(.+)/),i=n[r+1]?.match(/^\+\+\+\s+(?:b\/)?(.+)/);if(!e||!i){r++;continue}let a=e[1].trim(),o=i[1].trim(),s=`modified`;a===`/dev/null`?s=`added`:o===`/dev/null`?s=`deleted`:a!==o&&(s=`renamed`),r+=2;let c=[],l=0,u=0;for(;r<n.length&&!n[r]?.startsWith(`--- `);){let e=n[r]?.match(/^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@(.*)$/);if(e){let t={oldStart:Number(e[1]),oldLines:Number(e[2]??1),newStart:Number(e[3]),newLines:Number(e[4]??1),header:e[5]?.trim()??``,changes:[]};c.push(t);let i=t.oldStart,a=t.newStart;for(r++;r<n.length;){let e=n[r];if(e?.startsWith(`@@`)||e?.startsWith(`--- `)||e?.startsWith(`diff `))break;if(e?.startsWith(`\\`)){r++;continue}if(e?.startsWith(`+`))t.changes.push({type:`add`,line:a,content:e.slice(1)}),l++,a++;else if(e?.startsWith(`-`))t.changes.push({type:`delete`,line:i,content:e.slice(1)}),u++,i++;else if(e?.startsWith(` `))t.changes.push({type:`context`,line:a,content:e.slice(1)}),i++,a++;else break;r++}}else r++}let d=s===`deleted`?a:o;t.push({path:d,oldPath:s===`renamed`?a:void 0,status:s,hunks:c,additions:l,deletions:u})}return t}export{e as diffParse};
|
|
4
|
+
//# sourceMappingURL=diff-parse.js.map
|
|
@@ -1,53 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/** The text to compress */
|
|
12
|
-
text: string;
|
|
13
|
-
/** Priority weight (default: 1). Higher = more budget share */
|
|
14
|
-
weight?: number;
|
|
1
|
+
import { IEmbedder } from "@kb/embeddings";
|
|
2
|
+
|
|
3
|
+
//#region packages/tools/src/digest.d.ts
|
|
4
|
+
interface DigestSource {
|
|
5
|
+
/** Unique identifier for this source */
|
|
6
|
+
id: string;
|
|
7
|
+
/** The text to compress */
|
|
8
|
+
text: string;
|
|
9
|
+
/** Priority weight (default: 1). Higher = more budget share */
|
|
10
|
+
weight?: number;
|
|
15
11
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
interface DigestOptions {
|
|
13
|
+
/** Source texts to compress */
|
|
14
|
+
sources: DigestSource[];
|
|
15
|
+
/** Focus query — what matters for the next step? */
|
|
16
|
+
query: string;
|
|
17
|
+
/** Target budget in characters (default: 4000) */
|
|
18
|
+
maxChars?: number;
|
|
19
|
+
/** Key fields to always extract via keyword matching */
|
|
20
|
+
pinFields?: string[];
|
|
21
|
+
/** Segmentation strategy (default: 'paragraph') */
|
|
22
|
+
segmentation?: 'paragraph' | 'sentence' | 'line';
|
|
27
23
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
interface DigestFieldEntry {
|
|
25
|
+
sourceId: string;
|
|
26
|
+
value: string;
|
|
31
27
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
28
|
+
interface DigestResult {
|
|
29
|
+
/** Compressed narrative (all sources merged, reading order maintained) */
|
|
30
|
+
text: string;
|
|
31
|
+
/** Extracted structured fields */
|
|
32
|
+
fields: Record<string, DigestFieldEntry[]>;
|
|
33
|
+
/** Per-source compression stats */
|
|
34
|
+
sourceStats: Array<{
|
|
35
|
+
id: string;
|
|
36
|
+
originalChars: number;
|
|
37
|
+
keptChars: number;
|
|
38
|
+
segmentsKept: number;
|
|
39
|
+
segmentsTotal: number;
|
|
40
|
+
}>;
|
|
41
|
+
totalOriginalChars: number;
|
|
42
|
+
totalCompressedChars: number;
|
|
43
|
+
ratio: number;
|
|
48
44
|
}
|
|
49
45
|
/**
|
|
50
46
|
* Compress multiple text sources into a single digest.
|
|
51
47
|
*/
|
|
52
|
-
|
|
48
|
+
declare function digest(embedder: IEmbedder, options: DigestOptions): Promise<DigestResult>;
|
|
49
|
+
//#endregion
|
|
50
|
+
export { DigestFieldEntry, DigestOptions, DigestResult, DigestSource, digest };
|
|
53
51
|
//# sourceMappingURL=digest.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{cosineSimilarity as
|
|
2
|
-
`).map(
|
|
3
|
-
${n.text}`).join(`
|
|
1
|
+
import{cosineSimilarity as e,estimateTokens as t,segment as n}from"./text-utils.js";const r=[`status`,`files`,`decisions`,`blockers`,`artifacts`,`next`],i={status:/\b(?:status|result)\s*[:=]/i,files:/\b(?:files?|modified|created|deleted)\s*[:=]/i,artifacts:/\b(?:artifacts?)\s*[:=]/i,decisions:/\b(?:decisions?|decided|chose|selected)\s*[:=]/i,blockers:/\b(?:blockers?|blocked|blocking)\s*[:=]/i,next:/\b(?:next\s*(?:steps?|actions?)|todo|follow.up)\s*[:=]/i},a={status:/(?:^|\b)(?:status|result)\s*[:=]\s*(.+)$/i,files:/(?:^|\b)(?:files?|modified|created|deleted)\s*[:=]\s*(.+)$/i,artifacts:/(?:^|\b)(?:artifacts?)\s*[:=]\s*(.+)$/i,decisions:/(?:^|\b)(?:decisions?|decided|chose|selected)\s*[:=]\s*(.+)$/i,blockers:/(?:^|\b)(?:blockers?|blocked|blocking)\s*[:=]\s*(.+)$/i,next:/(?:^|\b)(?:next\s*(?:steps?|actions?)|todo|follow.up)\s*[:=]\s*(.+)$/i},o=/\b(?:APPROVED|NEEDS_REVISION|BLOCKED|SUCCESS|PARTIAL|FAILED|ESCALATE)\b/i,s=.01;function c(e){let t=e??[...r];return[...new Set(t.map(e=>e.toLowerCase()))]}function l(e){return typeof e!=`number`||!Number.isFinite(e)||e<=0?1:e}function u(e,t){let n=new Set;for(let r of t)i[r]?.test(e)&&n.add(r);return t.includes(`status`)&&o.test(e)&&n.add(`status`),[...n]}function d(e,t){let n=t.split(`
|
|
2
|
+
`).map(e=>e.trim()).filter(e=>e.length>0);for(let t of n){let n=a[e]?.exec(t);if(n?.[1])return n[1].trim();if(e===`status`){let e=t.match(o);if(e)return e[0]}}return t.trim()}function f(e,t,n,r){e[t]||(e[t]=[]),e[t].push({sourceId:n,value:r})}function p(e,t,r,i){return e.map(e=>{let a=n(e.text,t).map((t,n)=>{let a=u(t,r);for(let n of a)f(i,n,e.id,d(n,t));return{index:n,text:t,pinnedFields:a,score:0}}),o=a.filter(e=>e.pinnedFields.length>0).reduce((e,t)=>e+t.text.length,0),s=a.filter(e=>e.pinnedFields.length===0).reduce((e,t)=>e+t.text.length,0);return{id:e.id,originalText:e.text,weight:l(e.weight),segments:a,pinnedChars:o,nonPinnedChars:s}})}function m(e,t){let n=new Map(e.map(e=>[e.id,0])),r=Math.max(0,t),i=e.filter(e=>e.nonPinnedChars>0);for(;r>s&&i.length>0;){let e=i.reduce((e,t)=>e+t.weight,0),t=0,a=[];for(let o of i){let i=n.get(o.id)??0,c=o.nonPinnedChars-i;if(c<=s)continue;let l=r*(o.weight/e),u=Math.min(l,c);n.set(o.id,i+u),t+=u,c-u>s&&a.push(o)}if(t<=s)break;r-=t,i=a}return n}function h(e){return e.map(e=>`[${e.id}]\n${e.text}`).join(`
|
|
4
3
|
|
|
5
|
-
`)}function
|
|
4
|
+
`)}function g(e,t){return e===0?0:t/e}async function _(n,r){let{sources:i,query:a,maxChars:o=4e3,pinFields:l,segmentation:u=`paragraph`}=r,d={},f=p(i,u,c(l),d),_=i.reduce((e,t)=>e+t.text.length,0);if(_<=o){let e=f.filter(e=>e.originalText.trim().length>0).map(e=>({id:e.id,text:e.originalText})),t=f.map(e=>({id:e.id,originalChars:e.originalText.length,keptChars:e.originalText.length,segmentsKept:e.segments.length,segmentsTotal:e.segments.length}));return{text:h(e),fields:d,sourceStats:t,totalOriginalChars:_,totalCompressedChars:_,ratio:_===0?0:1}}let v=await n.embedQuery(a);for(let t of f)for(let r of t.segments)r.pinnedFields.length>0||(r.score=e(v,await n.embed(r.text)));let y=m(f,o-f.reduce((e,t)=>e+t.pinnedChars,0)),b=[],x=[],S=0;for(let e of f){let n=y.get(e.id)??0,r=new Map,i=0,a=e.segments.filter(e=>e.pinnedFields.length===0).sort((e,n)=>n.score-e.score||t(e.text)-t(n.text)||e.index-n.index),o;for(let e of a){let t=n-i;if(t<=s)break;if(e.text.length<=t+s){r.set(e.index,e.text),i+=e.text.length;continue}o||=e}let c=Math.floor(n-i);if(o&&c>0){let e=o.text.slice(0,c).trimEnd();e.length>0&&(r.set(o.index,e),i+=e.length)}let l=e.segments.filter(e=>e.pinnedFields.length>0||r.has(e.index)).map(e=>({index:e.index,text:r.get(e.index)??e.text})),u=l.reduce((e,t)=>e+t.text.length,0);b.push({id:e.id,originalChars:e.originalText.length,keptChars:u,segmentsKept:l.length,segmentsTotal:e.segments.length}),S+=u,l.length!==0&&x.push({id:e.id,text:l.map(e=>e.text).join(`
|
|
6
5
|
|
|
7
|
-
`)})}return{text:
|
|
6
|
+
`)})}return{text:h(x),fields:d,sourceStats:b,totalOriginalChars:_,totalCompressedChars:S,ratio:g(_,S)}}export{_ as digest};
|
|
7
|
+
//# sourceMappingURL=digest.js.map
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
//#region packages/tools/src/encode.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* kb_encode — Encoding, decoding, and hashing utilities.
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
type EncodeOperation = 'base64_encode' | 'base64_decode' | 'url_encode' | 'url_decode' | 'sha256' | 'md5' | 'jwt_decode' | 'hex_encode' | 'hex_decode';
|
|
6
|
+
interface EncodeOptions {
|
|
7
|
+
operation: EncodeOperation;
|
|
8
|
+
input: string;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
interface EncodeResult {
|
|
11
|
+
output: string;
|
|
12
|
+
operation: string;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
declare function encode(options: EncodeOptions): EncodeResult;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { EncodeOperation, EncodeOptions, EncodeResult, encode };
|
|
14
17
|
//# sourceMappingURL=encode.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{createHash as
|
|
1
|
+
import{createHash as e}from"node:crypto";function t(t){let{operation:n,input:r}=t,i;switch(n){case`base64_encode`:i=Buffer.from(r).toString(`base64`);break;case`base64_decode`:i=Buffer.from(r,`base64`).toString(`utf8`);break;case`url_encode`:i=encodeURIComponent(r);break;case`url_decode`:i=decodeURIComponent(r);break;case`sha256`:i=e(`sha256`).update(r).digest(`hex`);break;case`md5`:i=e(`md5`).update(r).digest(`hex`);break;case`jwt_decode`:{let e=r.split(`.`);if(e.length!==3)throw Error(`Invalid JWT: expected 3 dot-separated parts`);let t,n;try{t=JSON.parse(Buffer.from(e[0],`base64url`).toString()),n=JSON.parse(Buffer.from(e[1],`base64url`).toString())}catch{throw Error(`Invalid JWT: header or payload is not valid JSON`)}i=JSON.stringify({header:t,payload:n},null,2);break}case`hex_encode`:i=Buffer.from(r).toString(`hex`);break;case`hex_decode`:i=Buffer.from(r,`hex`).toString(`utf8`);break;default:throw Error(`Unknown operation: ${n}`)}return{output:i,operation:n}}export{t as encode};
|
|
2
|
+
//# sourceMappingURL=encode.js.map
|
|
@@ -1,28 +1,31 @@
|
|
|
1
|
+
//#region packages/tools/src/env-info.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* kb_env — System environment and runtime information.
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
interface EnvInfoOptions {
|
|
6
|
+
includeEnv?: boolean;
|
|
7
|
+
filterEnv?: string;
|
|
8
|
+
showSensitive?: boolean;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
interface EnvInfoResult {
|
|
11
|
+
system: {
|
|
12
|
+
platform: string;
|
|
13
|
+
arch: string;
|
|
14
|
+
release: string;
|
|
15
|
+
hostname: string;
|
|
16
|
+
type: string;
|
|
17
|
+
cpus: number;
|
|
18
|
+
memoryTotalGb: number;
|
|
19
|
+
memoryFreeGb: number;
|
|
20
|
+
};
|
|
21
|
+
runtime: {
|
|
22
|
+
node: string;
|
|
23
|
+
v8: string;
|
|
24
|
+
};
|
|
25
|
+
cwd: string;
|
|
26
|
+
env?: Record<string, string>;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
declare function envInfo(options?: EnvInfoOptions): EnvInfoResult;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { EnvInfoOptions, EnvInfoResult, envInfo };
|
|
28
31
|
//# sourceMappingURL=env-info.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{arch as
|
|
1
|
+
import{arch as e,cpus as t,freemem as n,hostname as r,platform as i,release as a,totalmem as o,type as s}from"node:os";const c=[/key/i,/secret/i,/token/i,/password/i,/passwd/i,/credential/i,/private/i,/certificate/i];function l(l={}){let{includeEnv:u=!1,filterEnv:d,showSensitive:f=!1}=l,p={system:{platform:i(),arch:e(),release:a(),hostname:r(),type:s(),cpus:t().length,memoryTotalGb:Math.round(o()/1024**3*10)/10,memoryFreeGb:Math.round(n()/1024**3*10)/10},runtime:{node:process.versions.node,v8:process.versions.v8},cwd:process.cwd()};if(u){let e={};for(let[t,n]of Object.entries(process.env))n&&(d&&!t.toLowerCase().includes(d.toLowerCase())||(!f&&c.some(e=>e.test(t))?e[t]=`[REDACTED]`:e[t]=n));p.env=e}return p}export{l as envInfo};
|
|
2
|
+
//# sourceMappingURL=env-info.js.map
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region packages/tools/src/eval.d.ts
|
|
2
|
+
interface EvalOptions {
|
|
3
|
+
code: string;
|
|
4
|
+
lang?: 'js' | 'ts';
|
|
5
|
+
timeout?: number;
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
interface EvalResult {
|
|
8
|
+
success: boolean;
|
|
9
|
+
output: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
durationMs: number;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
declare function evaluate(options: EvalOptions): EvalResult;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { EvalOptions, EvalResult, evaluate };
|
|
13
16
|
//# sourceMappingURL=eval.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
`)+(
|
|
3
|
-
|
|
1
|
+
import e from"node:vm";function t(t){let{code:i,lang:a=`js`,timeout:o=5e3}=t,s=Date.now();try{let t=a===`ts`?r(i):i,c=[],l={console:{log:(...e)=>c.push(e.map(String).join(` `)),error:(...e)=>c.push(`[error] ${e.map(String).join(` `)}`),warn:(...e)=>c.push(`[warn] ${e.map(String).join(` `)}`)},setTimeout:void 0,setInterval:void 0,setImmediate:void 0,fetch:void 0,process:void 0,require:void 0,JSON,Math,Date,Array,Object,String,Number,Boolean,Map,Set,RegExp,Error,Promise,parseInt,parseFloat,isNaN,isFinite},u=e.createContext(l,{codeGeneration:{strings:!1,wasm:!1}}),d=e.runInContext(t,u,{timeout:o});return{success:!0,output:c.length>0?c.join(`
|
|
2
|
+
`)+(d===void 0?``:`\n→ ${n(d)}`):d===void 0?`(no output)`:n(d),durationMs:Date.now()-s}}catch(e){return{success:!1,output:``,error:e.message,durationMs:Date.now()-s}}}function n(e){if(e===void 0)return`undefined`;if(e===null)return`null`;if(typeof e==`object`)try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)}function r(e){return e.replace(/^\s*import\s+type\s+.*?;\s*$/gm,``).replace(/^\s*(?:export\s+)?interface\s+\w+[^{]*\{[\s\S]*?^\s*}\s*$/gm,``).replace(/^\s*(?:export\s+)?type\s+\w+\s*=.*?;\s*$/gm,``).replace(/([,(]\s*[A-Za-z_$][\w$]*)\s*:\s*[^,)=\n]+/g,`$1`).replace(/\)\s*:\s*[^={\n]+(?=\s*(?:=>|\{))/g,`)`).replace(/\s+as\s+[A-Za-z_$][\w$<>,[\]|&\s.]*/g,``).replace(/<(?:[A-Za-z_$][\w$]*\s*,?\s*)+>(?=\s*\()/g,``)}export{t as evaluate};
|
|
3
|
+
//# sourceMappingURL=eval.js.map
|
|
@@ -1,79 +1,82 @@
|
|
|
1
|
+
//#region packages/tools/src/evidence-map.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* kb_evidence_map — FORGE Evidence Map CRUD + Gate evaluator.
|
|
3
4
|
*
|
|
4
5
|
* Structured storage, validation, and gate evaluation for FORGE Evidence Map entries.
|
|
5
6
|
* Persisted in .kb-state/evidence-maps.json.
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
type EvidenceStatus = 'V' | 'A' | 'U';
|
|
9
|
+
type UnknownType = 'contract' | 'convention' | 'freshness' | 'runtime' | 'data-flow' | 'impact';
|
|
10
|
+
type GateDecision = 'YIELD' | 'HOLD' | 'HARD_BLOCK' | 'FORCED_DELIVERY';
|
|
11
|
+
type ForgeTier = 'floor' | 'standard' | 'critical';
|
|
12
|
+
interface EvidenceEntry {
|
|
13
|
+
id: number;
|
|
14
|
+
claim: string;
|
|
15
|
+
status: EvidenceStatus;
|
|
16
|
+
receipt: string;
|
|
17
|
+
criticalPath: boolean;
|
|
18
|
+
unknownType?: UnknownType;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
interface EvidenceMapState {
|
|
21
|
+
taskId: string;
|
|
22
|
+
tier: ForgeTier;
|
|
23
|
+
entries: EvidenceEntry[];
|
|
24
|
+
createdAt: string;
|
|
25
|
+
updatedAt: string;
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
interface GateResult {
|
|
28
|
+
decision: GateDecision;
|
|
29
|
+
reason: string;
|
|
30
|
+
unresolvedCritical: EvidenceEntry[];
|
|
31
|
+
warnings: string[];
|
|
32
|
+
stats: {
|
|
33
|
+
total: number;
|
|
34
|
+
verified: number;
|
|
35
|
+
assumed: number;
|
|
36
|
+
unresolved: number;
|
|
37
|
+
};
|
|
38
|
+
annotation?: string;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
type EvidenceMapAction = {
|
|
41
|
+
action: 'create';
|
|
42
|
+
taskId: string;
|
|
43
|
+
tier: ForgeTier;
|
|
43
44
|
} | {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
action: 'add';
|
|
46
|
+
taskId: string;
|
|
47
|
+
claim: string;
|
|
48
|
+
status: EvidenceStatus;
|
|
49
|
+
receipt: string;
|
|
50
|
+
criticalPath?: boolean;
|
|
51
|
+
unknownType?: UnknownType;
|
|
51
52
|
} | {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
action: 'update';
|
|
54
|
+
taskId: string;
|
|
55
|
+
id: number;
|
|
56
|
+
status: EvidenceStatus;
|
|
57
|
+
receipt: string;
|
|
57
58
|
} | {
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
action: 'get';
|
|
60
|
+
taskId: string;
|
|
60
61
|
} | {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
action: 'gate';
|
|
63
|
+
taskId: string;
|
|
64
|
+
retryCount?: number;
|
|
64
65
|
} | {
|
|
65
|
-
|
|
66
|
+
action: 'list';
|
|
66
67
|
} | {
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
action: 'delete';
|
|
69
|
+
taskId: string;
|
|
69
70
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
interface EvidenceMapResult {
|
|
72
|
+
state?: EvidenceMapState;
|
|
73
|
+
states?: EvidenceMapState[];
|
|
74
|
+
entry?: EvidenceEntry;
|
|
75
|
+
gate?: GateResult;
|
|
76
|
+
deleted?: boolean;
|
|
77
|
+
formattedMap?: string;
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
+
declare function evidenceMap(action: EvidenceMapAction, cwd?: string): EvidenceMapResult;
|
|
80
|
+
//#endregion
|
|
81
|
+
export { EvidenceEntry, EvidenceMapAction, EvidenceMapResult, EvidenceMapState, EvidenceStatus, ForgeTier, GateDecision, GateResult, UnknownType, evidenceMap };
|
|
79
82
|
//# sourceMappingURL=evidence-map.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import{dirname as e,resolve as t}from"node:path";import{existsSync as n,mkdirSync as r,readFileSync as i,writeFileSync as a}from"node:fs";function o(e){return t(e??process.cwd(),`.kb-state`,`evidence-maps.json`)}function s(e){let t=o(e);if(!n(t))return{};try{let e=i(t,`utf-8`);return JSON.parse(e)}catch{return{}}}function c(t,i){let s=o(i),c=e(s);n(c)||r(c,{recursive:!0}),a(s,`${JSON.stringify(t,null,2)}\n`,`utf-8`)}function l(e,t){let n=s(t),r=n[e];if(!r)throw Error(`Evidence map not found: ${e}`);return{maps:n,state:r}}function u(e){return e.reduce((e,t)=>Math.max(e,t.id),0)+1}function d(e){let t=e.trim();if(!t)throw Error(`Claim is required`);if(/\r?\n/.test(t))throw Error(`Claim must be a single line`);return t}function f(e){return(e??``).replace(/\r?\n/g,` `).replace(/\|/g,`\\|`)}function p(e){let t=[`| # | Claim | Status | Receipt | Critical | Type |`,`|---|-------|--------|---------|----------|------|`];for(let n of e.entries)t.push(`| ${n.id} | ${f(n.claim)} | ${n.status} | ${f(n.receipt)} | ${n.criticalPath?`yes`:`no`} | ${f(n.unknownType)} |`);return t.join(`
|
|
2
|
+
`)}function m(e){return{total:e.length,verified:e.filter(e=>e.status===`V`).length,assumed:e.filter(e=>e.status===`A`).length,unresolved:e.filter(e=>e.status===`U`).length}}function h(e){let t=[];for(let n of e.entries)n.status===`V`&&n.receipt.trim()===``&&t.push(`V entry without receipt`),n.status===`A`&&e.tier===`critical`&&n.unknownType===`contract`&&t.push(`Assumed contract at Critical tier — should be Verified`);return t}function g(e){return`FORCED DELIVERY annotation: unresolved entries remain -> ${e.filter(e=>e.status===`U`).map(e=>`#${e.id} ${e.claim}`).join(`; `)}`}function _(e,t=0){let n=e.entries.filter(e=>e.criticalPath&&e.status===`U`),r=h(e),i=m(e.entries);return n.find(e=>e.unknownType===`contract`)?{decision:`HARD_BLOCK`,reason:`Unresolved contract unknown on critical path`,unresolvedCritical:n,warnings:r,stats:i}:n.length>0&&t===0?{decision:`HOLD`,reason:`Unresolved critical-path unknown — retry available`,unresolvedCritical:n,warnings:r,stats:i}:n.length>0&&t>=1?{decision:`FORCED_DELIVERY`,reason:`Unresolved critical-path unknown after retry`,unresolvedCritical:n,warnings:r,stats:i,annotation:g(e.entries)}:{decision:`YIELD`,reason:`All critical-path claims satisfy gate rules`,unresolvedCritical:[],warnings:r,stats:i}}function v(e,t){switch(e.action){case`create`:{let n=s(t),r=new Date().toISOString(),i={taskId:e.taskId,tier:e.tier,entries:[],createdAt:r,updatedAt:r};return n[e.taskId]=i,c(n,t),{state:i,formattedMap:p(i)}}case`add`:{let{maps:n,state:r}=l(e.taskId,t),i={id:u(r.entries),claim:d(e.claim),status:e.status,receipt:e.receipt,criticalPath:e.criticalPath??!1,unknownType:e.unknownType};return r.entries.push(i),r.updatedAt=new Date().toISOString(),n[e.taskId]=r,c(n,t),{state:r,entry:i,formattedMap:p(r)}}case`update`:{let{maps:n,state:r}=l(e.taskId,t),i=r.entries.find(t=>t.id===e.id);if(!i)throw Error(`Evidence entry not found: ${e.id}`);return i.status=e.status,i.receipt=e.receipt,r.updatedAt=new Date().toISOString(),n[e.taskId]=r,c(n,t),{state:r,entry:i,formattedMap:p(r)}}case`get`:{let{state:n}=l(e.taskId,t);return{state:n,formattedMap:p(n)}}case`gate`:{let{state:n}=l(e.taskId,t);return{state:n,gate:_(n,e.retryCount??0),formattedMap:p(n)}}case`list`:return{states:Object.values(s(t)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt))};case`delete`:{let n=s(t);return e.taskId in n?(delete n[e.taskId],c(n,t),{deleted:!0}):{deleted:!1}}}}export{v as evidenceMap};
|
|
3
|
+
//# sourceMappingURL=evidence-map.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region packages/tools/src/file-cache.d.ts
|
|
2
|
+
interface FileCacheEntry {
|
|
3
|
+
/** Full file content */
|
|
4
|
+
content: string;
|
|
5
|
+
/** SHA-256 hash of content */
|
|
6
|
+
hash: string;
|
|
7
|
+
/** Line count */
|
|
8
|
+
lines: number;
|
|
9
|
+
/** Estimated token count (~chars/4) */
|
|
10
|
+
estimatedTokens: number;
|
|
11
|
+
/** How many times this file has been requested */
|
|
12
|
+
hitCount: number;
|
|
13
|
+
/** Whether content changed since last read (false on cache hit) */
|
|
14
|
+
changed: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface FileCacheStats {
|
|
17
|
+
totalReads: number;
|
|
18
|
+
cacheHits: number;
|
|
19
|
+
filesTracked: number;
|
|
20
|
+
}
|
|
21
|
+
declare class FileCache {
|
|
22
|
+
private cache;
|
|
23
|
+
private totalReads;
|
|
24
|
+
private cacheHits;
|
|
25
|
+
private static readonly MAX_ENTRIES;
|
|
26
|
+
/**
|
|
27
|
+
* Get file content with deduplication.
|
|
28
|
+
* First call: reads from disk, hashes, caches.
|
|
29
|
+
* Subsequent calls: checks mtime → if unchanged, cache hit (skip read).
|
|
30
|
+
* If mtime changed: re-reads, re-hashes, checks if content actually changed.
|
|
31
|
+
*/
|
|
32
|
+
get(filePath: string): Promise<FileCacheEntry>;
|
|
33
|
+
/** Remove a single file from cache. Returns true if it was cached. */
|
|
34
|
+
invalidate(filePath: string): boolean;
|
|
35
|
+
/** Clear all cached files. Returns how many were cleared. */
|
|
36
|
+
clear(): number;
|
|
37
|
+
/** Get cache statistics. */
|
|
38
|
+
stats(): FileCacheStats;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { FileCache, FileCacheEntry, FileCacheStats };
|
|
42
|
+
//# sourceMappingURL=file-cache.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{estimateTokens as e}from"./text-utils.js";import{readFile as t,stat as n}from"node:fs/promises";import{resolve as r}from"node:path";import{createHash as i}from"node:crypto";var a=class i{cache=new Map;totalReads=0;cacheHits=0;static MAX_ENTRIES=500;async get(a){let s=r(a);this.totalReads++;let c=(await n(s)).mtimeMs,l=this.cache.get(s);if(l){if(l.mtimeMs===c)return this.cacheHits++,l.hitCount++,{content:l.content,hash:l.hash,lines:l.lines,estimatedTokens:l.estimatedTokens,hitCount:l.hitCount,changed:!1};let n=await t(s,`utf-8`),r=o(n);if(r===l.hash)return this.cacheHits++,l.hitCount++,l.mtimeMs=c,{content:l.content,hash:l.hash,lines:l.lines,estimatedTokens:l.estimatedTokens,hitCount:l.hitCount,changed:!1};let i=n.split(`
|
|
2
|
+
`).length,a=e(n);return l.content=n,l.hash=r,l.lines=i,l.estimatedTokens=a,l.hitCount++,l.mtimeMs=c,{content:n,hash:r,lines:i,estimatedTokens:a,hitCount:l.hitCount,changed:!0}}let u=await t(s,`utf-8`),d=o(u),f=u.split(`
|
|
3
|
+
`).length,p=e(u);if(this.cache.set(s,{content:u,hash:d,lines:f,estimatedTokens:p,hitCount:1,mtimeMs:c}),this.cache.size>i.MAX_ENTRIES){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}return{content:u,hash:d,lines:f,estimatedTokens:p,hitCount:1,changed:!0}}invalidate(e){return this.cache.delete(r(e))}clear(){let e=this.cache.size;return this.cache.clear(),e}stats(){return{totalReads:this.totalReads,cacheHits:this.cacheHits,filesTracked:this.cache.size}}};function o(e){return i(`sha256`).update(e).digest(`hex`)}export{a as FileCache};
|
|
4
|
+
//# sourceMappingURL=file-cache.js.map
|
|
@@ -1,32 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region packages/tools/src/file-summary.d.ts
|
|
2
|
+
interface FileSummaryOptions {
|
|
3
|
+
path: string;
|
|
4
|
+
/** Pre-loaded content — skip readFile when provided (e.g., from FileCache) */
|
|
5
|
+
content?: string;
|
|
6
|
+
previewLines?: number;
|
|
4
7
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
8
|
+
interface FileSummaryResult {
|
|
9
|
+
path: string;
|
|
10
|
+
lines: number;
|
|
11
|
+
language: string;
|
|
12
|
+
imports: string[];
|
|
13
|
+
exports: string[];
|
|
14
|
+
functions: Array<{
|
|
15
|
+
name: string;
|
|
16
|
+
line: number;
|
|
17
|
+
exported: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
classes: Array<{
|
|
20
|
+
name: string;
|
|
21
|
+
line: number;
|
|
22
|
+
exported: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
interfaces: Array<{
|
|
25
|
+
name: string;
|
|
26
|
+
line: number;
|
|
27
|
+
}>;
|
|
28
|
+
types: Array<{
|
|
29
|
+
name: string;
|
|
30
|
+
line: number;
|
|
31
|
+
}>;
|
|
32
|
+
estimatedTokens: number;
|
|
30
33
|
}
|
|
31
|
-
|
|
34
|
+
declare function fileSummary(options: FileSummaryOptions): Promise<FileSummaryResult>;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { FileSummaryOptions, FileSummaryResult, fileSummary };
|
|
32
37
|
//# sourceMappingURL=file-summary.d.ts.map
|