@vpxa/aikit 0.1.58 → 0.1.60
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 +38 -3
- package/package.json +2 -1
- package/packages/aikit-client/dist/index.d.ts +146 -4
- package/packages/aikit-client/dist/index.js +5 -1
- package/packages/analyzers/dist/index.d.ts +309 -11
- package/packages/analyzers/dist/index.js +54 -1
- package/packages/chunker/dist/index.d.ts +451 -18
- package/packages/chunker/dist/index.js +24 -1
- package/packages/cli/dist/{commands/init/constants.js → constants-D3v4VDf0.js} +1 -1
- package/packages/cli/dist/index.js +15 -2
- package/packages/cli/dist/init-D0CiV9PX.js +7 -0
- package/packages/cli/dist/scaffold-CJwkHf-q.js +2 -0
- package/packages/cli/dist/{commands/init/templates.js → templates-DJ7EC5vw.js} +1 -1
- package/packages/cli/dist/user-HmJYNt5b.js +5 -0
- package/packages/core/dist/index.d.ts +357 -6
- package/packages/core/dist/index.js +1 -1
- package/packages/dashboard/dist/assets/{index-Cdke3KDK.js → index-C6D-PCp0.js} +7 -7
- package/packages/dashboard/dist/assets/index-C6D-PCp0.js.map +1 -0
- package/packages/dashboard/dist/index.html +1 -1
- package/packages/elicitation/dist/index.d.ts +139 -4
- package/packages/elicitation/dist/index.js +1 -1
- package/packages/embeddings/dist/index.d.ts +45 -2
- package/packages/embeddings/dist/index.js +1 -1
- package/packages/enterprise-bridge/dist/index.d.ts +275 -7
- package/packages/enterprise-bridge/dist/index.js +1 -1
- package/packages/flows/dist/index.d.ts +345 -12
- package/packages/flows/dist/index.js +15 -1
- package/packages/indexer/dist/index.d.ts +196 -6
- package/packages/indexer/dist/index.js +1 -1
- package/packages/present/dist/index.html +315 -314
- package/packages/server/dist/curated-manager-DX-_oJg0.js +5 -0
- package/packages/server/dist/index.d.ts +139 -1
- package/packages/server/dist/index.js +1 -1
- package/packages/server/dist/server-eMZ64H9b.js +1274 -0
- package/packages/store/dist/index.d.ts +316 -5
- package/packages/store/dist/index.js +90 -1
- package/packages/store/dist/lance-store-jdHZp-V4.js +1 -0
- package/packages/tools/dist/index.d.ts +2161 -61
- package/packages/tools/dist/index.js +117 -1
- package/packages/tui/dist/{App-CoMyn2kt.js → App-DobfqTPH.js} +1 -1
- package/packages/tui/dist/App.d.ts +1 -1
- package/packages/tui/dist/App.js +1 -1
- package/packages/tui/dist/{LogPanel-CDItCD0E.js → LogPanel-DGeptKim.js} +3 -3
- package/packages/tui/dist/hooks/useKBClient.d.ts +1 -1
- package/packages/tui/dist/{index-MXJeXmCf.d.ts → index-floZQwfo.d.ts} +2 -1
- package/packages/tui/dist/index.d.ts +1 -1
- package/packages/tui/dist/index.js +1 -1
- package/packages/tui/dist/panels/LogPanel.js +1 -1
- package/scaffold/definitions/bodies.mjs +47 -0
- package/scaffold/definitions/protocols.mjs +9 -0
- package/scaffold/definitions/tools.mjs +15 -0
- package/scaffold/general/agents/Debugger.agent.md +9 -0
- package/scaffold/general/agents/Documenter.agent.md +9 -0
- package/scaffold/general/agents/Frontend.agent.md +9 -0
- package/scaffold/general/agents/Implementer.agent.md +9 -0
- package/scaffold/general/agents/Orchestrator.agent.md +47 -0
- package/scaffold/general/agents/Planner.agent.md +9 -0
- package/scaffold/general/agents/Refactor.agent.md +9 -0
- package/scaffold/general/agents/Security.agent.md +9 -0
- package/scaffold/general/agents/_shared/code-agent-base.md +9 -0
- package/scaffold/general/skills/aikit/SKILL.md +71 -7
- package/scaffold/general/skills/c4-architecture/SKILL.md +87 -1
- package/scaffold/general/skills/c4-architecture/references/html-design-system.md +337 -0
- package/scaffold/general/skills/c4-architecture/references/html-template.html +627 -0
- package/scaffold/general/skills/present/SKILL.md +180 -0
- package/packages/aikit-client/dist/direct-client.d.ts +0 -37
- package/packages/aikit-client/dist/direct-client.js +0 -1
- package/packages/aikit-client/dist/mcp-client.d.ts +0 -19
- package/packages/aikit-client/dist/mcp-client.js +0 -4
- package/packages/aikit-client/dist/parsers.d.ts +0 -35
- package/packages/aikit-client/dist/parsers.js +0 -2
- package/packages/aikit-client/dist/types.d.ts +0 -62
- package/packages/aikit-client/dist/types.js +0 -1
- package/packages/analyzers/dist/blast-radius-analyzer.d.ts +0 -19
- package/packages/analyzers/dist/blast-radius-analyzer.js +0 -6
- package/packages/analyzers/dist/dependency-analyzer.d.ts +0 -32
- package/packages/analyzers/dist/dependency-analyzer.js +0 -8
- package/packages/analyzers/dist/diagram-generator.d.ts +0 -16
- package/packages/analyzers/dist/diagram-generator.js +0 -2
- package/packages/analyzers/dist/entry-point-analyzer.d.ts +0 -40
- package/packages/analyzers/dist/entry-point-analyzer.js +0 -4
- package/packages/analyzers/dist/knowledge-producer.d.ts +0 -40
- package/packages/analyzers/dist/knowledge-producer.js +0 -26
- package/packages/analyzers/dist/pattern-analyzer.d.ts +0 -15
- package/packages/analyzers/dist/pattern-analyzer.js +0 -2
- package/packages/analyzers/dist/regex-call-graph.d.ts +0 -10
- package/packages/analyzers/dist/regex-call-graph.js +0 -1
- package/packages/analyzers/dist/structure-analyzer.d.ts +0 -19
- package/packages/analyzers/dist/structure-analyzer.js +0 -4
- package/packages/analyzers/dist/symbol-analyzer.d.ts +0 -14
- package/packages/analyzers/dist/symbol-analyzer.js +0 -9
- package/packages/analyzers/dist/ts-call-graph.d.ts +0 -29
- package/packages/analyzers/dist/ts-call-graph.js +0 -1
- package/packages/analyzers/dist/types.d.ts +0 -110
- package/packages/analyzers/dist/types.js +0 -1
- package/packages/chunker/dist/call-graph-extractor.d.ts +0 -25
- package/packages/chunker/dist/call-graph-extractor.js +0 -1
- package/packages/chunker/dist/chunker-factory.d.ts +0 -19
- package/packages/chunker/dist/chunker-factory.js +0 -1
- package/packages/chunker/dist/chunker.interface.d.ts +0 -13
- package/packages/chunker/dist/chunker.interface.js +0 -1
- package/packages/chunker/dist/code-chunker.d.ts +0 -17
- package/packages/chunker/dist/code-chunker.js +0 -11
- package/packages/chunker/dist/extractors/call-extractor.d.ts +0 -24
- package/packages/chunker/dist/extractors/call-extractor.js +0 -1
- package/packages/chunker/dist/extractors/entry-point-detector.d.ts +0 -14
- package/packages/chunker/dist/extractors/entry-point-detector.js +0 -1
- package/packages/chunker/dist/extractors/import-extractor.d.ts +0 -14
- package/packages/chunker/dist/extractors/import-extractor.js +0 -1
- package/packages/chunker/dist/extractors/pattern-detector.d.ts +0 -14
- package/packages/chunker/dist/extractors/pattern-detector.js +0 -1
- package/packages/chunker/dist/extractors/scope-resolver.d.ts +0 -26
- package/packages/chunker/dist/extractors/scope-resolver.js +0 -1
- package/packages/chunker/dist/extractors/symbol-extractor.d.ts +0 -14
- package/packages/chunker/dist/extractors/symbol-extractor.js +0 -3
- package/packages/chunker/dist/extractors/types.d.ts +0 -44
- package/packages/chunker/dist/extractors/types.js +0 -1
- package/packages/chunker/dist/generic-chunker.d.ts +0 -15
- package/packages/chunker/dist/generic-chunker.js +0 -5
- package/packages/chunker/dist/markdown-chunker.d.ts +0 -17
- package/packages/chunker/dist/markdown-chunker.js +0 -3
- package/packages/chunker/dist/wasm/languages.d.ts +0 -18
- package/packages/chunker/dist/wasm/languages.js +0 -1
- package/packages/chunker/dist/wasm/query-executor.d.ts +0 -70
- package/packages/chunker/dist/wasm/query-executor.js +0 -1
- package/packages/chunker/dist/wasm/runtime.d.ts +0 -44
- package/packages/chunker/dist/wasm/runtime.js +0 -1
- package/packages/chunker/dist/wasm/types.d.ts +0 -84
- package/packages/chunker/dist/wasm/types.js +0 -1
- package/packages/chunker/dist/wasm-chunker.d.ts +0 -23
- package/packages/chunker/dist/wasm-chunker.js +0 -6
- package/packages/cli/dist/aikit-init.d.ts +0 -59
- package/packages/cli/dist/aikit-init.js +0 -1
- package/packages/cli/dist/commands/analyze.d.ts +0 -6
- package/packages/cli/dist/commands/analyze.js +0 -2
- package/packages/cli/dist/commands/context-cmds.d.ts +0 -6
- package/packages/cli/dist/commands/context-cmds.js +0 -1
- package/packages/cli/dist/commands/environment.d.ts +0 -6
- package/packages/cli/dist/commands/environment.js +0 -1
- package/packages/cli/dist/commands/execution.d.ts +0 -6
- package/packages/cli/dist/commands/execution.js +0 -1
- package/packages/cli/dist/commands/flow.d.ts +0 -6
- package/packages/cli/dist/commands/flow.js +0 -1
- package/packages/cli/dist/commands/graph.d.ts +0 -6
- package/packages/cli/dist/commands/graph.js +0 -6
- package/packages/cli/dist/commands/init/adapters.d.ts +0 -28
- package/packages/cli/dist/commands/init/adapters.js +0 -1
- package/packages/cli/dist/commands/init/config.d.ts +0 -10
- package/packages/cli/dist/commands/init/config.js +0 -3
- package/packages/cli/dist/commands/init/constants.d.ts +0 -46
- package/packages/cli/dist/commands/init/curated.d.ts +0 -7
- package/packages/cli/dist/commands/init/curated.js +0 -1
- package/packages/cli/dist/commands/init/frontmatter.d.ts +0 -79
- package/packages/cli/dist/commands/init/frontmatter.js +0 -2
- package/packages/cli/dist/commands/init/index.d.ts +0 -36
- package/packages/cli/dist/commands/init/index.js +0 -5
- package/packages/cli/dist/commands/init/manifest.d.ts +0 -72
- package/packages/cli/dist/commands/init/manifest.js +0 -1
- package/packages/cli/dist/commands/init/scaffold.d.ts +0 -58
- package/packages/cli/dist/commands/init/scaffold.js +0 -1
- package/packages/cli/dist/commands/init/templates.d.ts +0 -9
- package/packages/cli/dist/commands/init/user.d.ts +0 -61
- package/packages/cli/dist/commands/init/user.js +0 -5
- package/packages/cli/dist/commands/knowledge.d.ts +0 -6
- package/packages/cli/dist/commands/knowledge.js +0 -1
- package/packages/cli/dist/commands/search.d.ts +0 -6
- package/packages/cli/dist/commands/search.js +0 -1
- package/packages/cli/dist/commands/system.d.ts +0 -6
- package/packages/cli/dist/commands/system.js +0 -4
- package/packages/cli/dist/commands/upgrade.d.ts +0 -6
- package/packages/cli/dist/commands/upgrade.js +0 -1
- package/packages/cli/dist/commands/workspace.d.ts +0 -6
- package/packages/cli/dist/commands/workspace.js +0 -1
- package/packages/cli/dist/context.d.ts +0 -7
- package/packages/cli/dist/context.js +0 -1
- package/packages/cli/dist/helpers.d.ts +0 -55
- package/packages/cli/dist/helpers.js +0 -5
- package/packages/cli/dist/types.d.ts +0 -9
- package/packages/cli/dist/types.js +0 -1
- package/packages/core/dist/constants.d.ts +0 -74
- package/packages/core/dist/constants.js +0 -1
- package/packages/core/dist/content-detector.d.ts +0 -13
- package/packages/core/dist/content-detector.js +0 -1
- package/packages/core/dist/errors.d.ts +0 -20
- package/packages/core/dist/errors.js +0 -1
- package/packages/core/dist/global-registry.d.ts +0 -69
- package/packages/core/dist/global-registry.js +0 -1
- package/packages/core/dist/logger.d.ts +0 -32
- package/packages/core/dist/logger.js +0 -1
- package/packages/core/dist/types.d.ts +0 -149
- package/packages/core/dist/types.js +0 -1
- package/packages/dashboard/dist/assets/index-Cdke3KDK.js.map +0 -1
- package/packages/elicitation/dist/build.d.ts +0 -14
- package/packages/elicitation/dist/build.js +0 -1
- package/packages/elicitation/dist/fields.d.ts +0 -32
- package/packages/elicitation/dist/fields.js +0 -1
- package/packages/elicitation/dist/normalize.d.ts +0 -15
- package/packages/elicitation/dist/normalize.js +0 -1
- package/packages/elicitation/dist/types.d.ts +0 -88
- package/packages/elicitation/dist/types.js +0 -1
- package/packages/embeddings/dist/embedder.interface.d.ts +0 -26
- package/packages/embeddings/dist/embedder.interface.js +0 -1
- package/packages/embeddings/dist/onnx-embedder.d.ts +0 -23
- package/packages/embeddings/dist/onnx-embedder.js +0 -1
- package/packages/enterprise-bridge/dist/cache.d.ts +0 -28
- package/packages/enterprise-bridge/dist/cache.js +0 -1
- package/packages/enterprise-bridge/dist/er-client.d.ts +0 -37
- package/packages/enterprise-bridge/dist/er-client.js +0 -1
- package/packages/enterprise-bridge/dist/evolution-collector.d.ts +0 -62
- package/packages/enterprise-bridge/dist/evolution-collector.js +0 -1
- package/packages/enterprise-bridge/dist/policy-store.d.ts +0 -45
- package/packages/enterprise-bridge/dist/policy-store.js +0 -1
- package/packages/enterprise-bridge/dist/push-adapter.d.ts +0 -23
- package/packages/enterprise-bridge/dist/push-adapter.js +0 -1
- package/packages/enterprise-bridge/dist/result-merger.d.ts +0 -14
- package/packages/enterprise-bridge/dist/result-merger.js +0 -1
- package/packages/enterprise-bridge/dist/types.d.ts +0 -81
- package/packages/enterprise-bridge/dist/types.js +0 -1
- package/packages/flows/dist/adapters/claude-plugin.d.ts +0 -25
- package/packages/flows/dist/adapters/claude-plugin.js +0 -3
- package/packages/flows/dist/adapters/copilot.d.ts +0 -12
- package/packages/flows/dist/adapters/copilot.js +0 -1
- package/packages/flows/dist/adapters/index.d.ts +0 -12
- package/packages/flows/dist/adapters/index.js +0 -1
- package/packages/flows/dist/adapters/native.d.ts +0 -10
- package/packages/flows/dist/adapters/native.js +0 -1
- package/packages/flows/dist/adapters/openspec.d.ts +0 -40
- package/packages/flows/dist/adapters/openspec.js +0 -1
- package/packages/flows/dist/builtins.d.ts +0 -16
- package/packages/flows/dist/builtins.js +0 -1
- package/packages/flows/dist/foundation.d.ts +0 -20
- package/packages/flows/dist/foundation.js +0 -11
- package/packages/flows/dist/git.d.ts +0 -53
- package/packages/flows/dist/git.js +0 -2
- package/packages/flows/dist/loader.d.ts +0 -13
- package/packages/flows/dist/loader.js +0 -2
- package/packages/flows/dist/registry.d.ts +0 -23
- package/packages/flows/dist/registry.js +0 -1
- package/packages/flows/dist/state-machine.d.ts +0 -23
- package/packages/flows/dist/state-machine.js +0 -1
- package/packages/flows/dist/symlinks.d.ts +0 -17
- package/packages/flows/dist/symlinks.js +0 -1
- package/packages/flows/dist/types.d.ts +0 -127
- package/packages/flows/dist/types.js +0 -1
- package/packages/indexer/dist/file-hasher.d.ts +0 -13
- package/packages/indexer/dist/file-hasher.js +0 -1
- package/packages/indexer/dist/filesystem-crawler.d.ts +0 -29
- package/packages/indexer/dist/filesystem-crawler.js +0 -1
- package/packages/indexer/dist/graph-extractor.d.ts +0 -22
- package/packages/indexer/dist/graph-extractor.js +0 -1
- package/packages/indexer/dist/hash-cache.d.ts +0 -24
- package/packages/indexer/dist/hash-cache.js +0 -1
- package/packages/indexer/dist/incremental-indexer.d.ts +0 -73
- package/packages/indexer/dist/incremental-indexer.js +0 -1
- package/packages/indexer/dist/smart-index-scheduler.d.ts +0 -47
- package/packages/indexer/dist/smart-index-scheduler.js +0 -1
- package/packages/server/dist/api.d.ts +0 -3
- package/packages/server/dist/api.js +0 -1
- package/packages/server/dist/auto-gc.d.ts +0 -30
- package/packages/server/dist/auto-gc.js +0 -1
- package/packages/server/dist/background-task.d.ts +0 -47
- package/packages/server/dist/background-task.js +0 -1
- package/packages/server/dist/completions.d.ts +0 -14
- package/packages/server/dist/completions.js +0 -1
- package/packages/server/dist/compression-interceptor.d.ts +0 -12
- package/packages/server/dist/compression-interceptor.js +0 -1
- package/packages/server/dist/config.d.ts +0 -16
- package/packages/server/dist/cross-workspace.d.ts +0 -43
- package/packages/server/dist/cross-workspace.js +0 -1
- package/packages/server/dist/curated-manager.d.ts +0 -92
- package/packages/server/dist/curated-manager.js +0 -5
- package/packages/server/dist/dashboard-static.d.ts +0 -27
- package/packages/server/dist/elicitor.d.ts +0 -18
- package/packages/server/dist/elicitor.js +0 -1
- package/packages/server/dist/idle-timer.d.ts +0 -33
- package/packages/server/dist/idle-timer.js +0 -1
- package/packages/server/dist/mcp-logging.d.ts +0 -11
- package/packages/server/dist/mcp-logging.js +0 -1
- package/packages/server/dist/memory-monitor.d.ts +0 -37
- package/packages/server/dist/memory-monitor.js +0 -1
- package/packages/server/dist/output-schemas.d.ts +0 -244
- package/packages/server/dist/output-schemas.js +0 -1
- package/packages/server/dist/prompts.d.ts +0 -13
- package/packages/server/dist/prompts.js +0 -13
- package/packages/server/dist/replay-interceptor.d.ts +0 -23
- package/packages/server/dist/replay-interceptor.js +0 -1
- package/packages/server/dist/resource-links.d.ts +0 -34
- package/packages/server/dist/resource-links.js +0 -1
- package/packages/server/dist/resources/curated-resources.d.ts +0 -13
- package/packages/server/dist/resources/curated-resources.js +0 -2
- package/packages/server/dist/resources/resource-notifier.d.ts +0 -45
- package/packages/server/dist/resources/resource-notifier.js +0 -1
- package/packages/server/dist/resources/resources.d.ts +0 -8
- package/packages/server/dist/resources/resources.js +0 -2
- package/packages/server/dist/sampling.d.ts +0 -41
- package/packages/server/dist/sampling.js +0 -2
- package/packages/server/dist/server.d.ts +0 -63
- package/packages/server/dist/server.js +0 -3
- package/packages/server/dist/structured-content-guard.d.ts +0 -28
- package/packages/server/dist/structured-content-guard.js +0 -1
- package/packages/server/dist/task-manager.d.ts +0 -40
- package/packages/server/dist/task-manager.js +0 -1
- package/packages/server/dist/tool-metadata.d.ts +0 -38
- package/packages/server/dist/tool-metadata.js +0 -1
- package/packages/server/dist/tool-prefix.d.ts +0 -12
- package/packages/server/dist/tool-prefix.js +0 -1
- package/packages/server/dist/tool-timeout.d.ts +0 -27
- package/packages/server/dist/tool-timeout.js +0 -1
- package/packages/server/dist/tools/analyze.tools.d.ts +0 -14
- package/packages/server/dist/tools/analyze.tools.js +0 -8
- package/packages/server/dist/tools/audit.tool.d.ts +0 -8
- package/packages/server/dist/tools/audit.tool.js +0 -1
- package/packages/server/dist/tools/brainstorm.tool.d.ts +0 -7
- package/packages/server/dist/tools/brainstorm.tool.js +0 -9
- package/packages/server/dist/tools/bridge.tools.d.ts +0 -34
- package/packages/server/dist/tools/bridge.tools.js +0 -15
- package/packages/server/dist/tools/config.tool.d.ts +0 -8
- package/packages/server/dist/tools/config.tool.js +0 -12
- package/packages/server/dist/tools/context.tools.d.ts +0 -15
- package/packages/server/dist/tools/context.tools.js +0 -10
- package/packages/server/dist/tools/evolution.tools.d.ts +0 -7
- package/packages/server/dist/tools/evolution.tools.js +0 -5
- package/packages/server/dist/tools/execution.tools.d.ts +0 -14
- package/packages/server/dist/tools/execution.tools.js +0 -4
- package/packages/server/dist/tools/flow.tools.d.ts +0 -7
- package/packages/server/dist/tools/flow.tools.js +0 -16
- package/packages/server/dist/tools/forge.tools.d.ts +0 -13
- package/packages/server/dist/tools/forge.tools.js +0 -10
- package/packages/server/dist/tools/forget.tool.d.ts +0 -8
- package/packages/server/dist/tools/forget.tool.js +0 -1
- package/packages/server/dist/tools/graph.tool.d.ts +0 -7
- package/packages/server/dist/tools/graph.tool.js +0 -29
- package/packages/server/dist/tools/infra.tools.d.ts +0 -10
- package/packages/server/dist/tools/infra.tools.js +0 -5
- package/packages/server/dist/tools/list.tool.d.ts +0 -7
- package/packages/server/dist/tools/list.tool.js +0 -2
- package/packages/server/dist/tools/lookup.tool.d.ts +0 -7
- package/packages/server/dist/tools/lookup.tool.js +0 -3
- package/packages/server/dist/tools/manipulation.tools.d.ts +0 -10
- package/packages/server/dist/tools/manipulation.tools.js +0 -4
- package/packages/server/dist/tools/onboard.tool.d.ts +0 -12
- package/packages/server/dist/tools/onboard.tool.js +0 -2
- package/packages/server/dist/tools/persistence.tools.d.ts +0 -10
- package/packages/server/dist/tools/persistence.tools.js +0 -5
- package/packages/server/dist/tools/policy.tools.d.ts +0 -7
- package/packages/server/dist/tools/policy.tools.js +0 -3
- package/packages/server/dist/tools/present/browser.d.ts +0 -4
- package/packages/server/dist/tools/present/browser.js +0 -93
- package/packages/server/dist/tools/present/helpers.d.ts +0 -19
- package/packages/server/dist/tools/present/helpers.js +0 -16
- package/packages/server/dist/tools/present/html.d.ts +0 -18
- package/packages/server/dist/tools/present/html.js +0 -5
- package/packages/server/dist/tools/present/index.d.ts +0 -2
- package/packages/server/dist/tools/present/index.js +0 -1
- package/packages/server/dist/tools/present/markdown.d.ts +0 -32
- package/packages/server/dist/tools/present/markdown.js +0 -11
- package/packages/server/dist/tools/present/templates.d.ts +0 -14
- package/packages/server/dist/tools/present/templates.js +0 -472
- package/packages/server/dist/tools/present/tool.d.ts +0 -27
- package/packages/server/dist/tools/present/tool.js +0 -39
- package/packages/server/dist/tools/present-blocks.d.ts +0 -46
- package/packages/server/dist/tools/present-blocks.js +0 -27
- package/packages/server/dist/tools/present-charts.d.ts +0 -31
- package/packages/server/dist/tools/present-charts.js +0 -34
- package/packages/server/dist/tools/present-theme.d.ts +0 -14
- package/packages/server/dist/tools/present-theme.js +0 -396
- package/packages/server/dist/tools/present-utils.d.ts +0 -11
- package/packages/server/dist/tools/present-utils.js +0 -1
- package/packages/server/dist/tools/present.tool.d.ts +0 -2
- package/packages/server/dist/tools/present.tool.js +0 -1
- package/packages/server/dist/tools/produce.tool.d.ts +0 -7
- package/packages/server/dist/tools/produce.tool.js +0 -4
- package/packages/server/dist/tools/read.tool.d.ts +0 -7
- package/packages/server/dist/tools/read.tool.js +0 -2
- package/packages/server/dist/tools/reindex.tool.d.ts +0 -11
- package/packages/server/dist/tools/reindex.tool.js +0 -9
- package/packages/server/dist/tools/remember.tool.d.ts +0 -9
- package/packages/server/dist/tools/remember.tool.js +0 -4
- package/packages/server/dist/tools/replay.tool.d.ts +0 -6
- package/packages/server/dist/tools/replay.tool.js +0 -3
- package/packages/server/dist/tools/restore.tool.d.ts +0 -6
- package/packages/server/dist/tools/restore.tool.js +0 -3
- package/packages/server/dist/tools/search.tool.d.ts +0 -11
- package/packages/server/dist/tools/search.tool.js +0 -10
- package/packages/server/dist/tools/status.tool.d.ts +0 -28
- package/packages/server/dist/tools/status.tool.js +0 -3
- package/packages/server/dist/tools/update.tool.d.ts +0 -8
- package/packages/server/dist/tools/update.tool.js +0 -1
- package/packages/server/dist/tools/utility.tools.d.ts +0 -15
- package/packages/server/dist/tools/utility.tools.js +0 -13
- package/packages/server/dist/version-check.d.ts +0 -32
- package/packages/store/dist/graph-store.interface.d.ts +0 -159
- package/packages/store/dist/graph-store.interface.js +0 -1
- package/packages/store/dist/lance-store.d.ts +0 -46
- package/packages/store/dist/lance-store.js +0 -1
- package/packages/store/dist/sqlite-graph-store.d.ts +0 -57
- package/packages/store/dist/sqlite-graph-store.js +0 -90
- package/packages/store/dist/store-factory.d.ts +0 -12
- package/packages/store/dist/store-factory.js +0 -1
- package/packages/store/dist/store.interface.d.ts +0 -54
- package/packages/store/dist/store.interface.js +0 -1
- package/packages/tools/dist/audit.d.ts +0 -65
- package/packages/tools/dist/audit.js +0 -6
- package/packages/tools/dist/batch.d.ts +0 -23
- package/packages/tools/dist/batch.js +0 -1
- package/packages/tools/dist/changelog.d.ts +0 -36
- package/packages/tools/dist/changelog.js +0 -2
- package/packages/tools/dist/check.d.ts +0 -48
- package/packages/tools/dist/check.js +0 -2
- package/packages/tools/dist/checkpoint.d.ts +0 -19
- package/packages/tools/dist/checkpoint.js +0 -1
- package/packages/tools/dist/codemod.d.ts +0 -39
- package/packages/tools/dist/codemod.js +0 -2
- package/packages/tools/dist/compact.d.ts +0 -47
- package/packages/tools/dist/compact.js +0 -3
- package/packages/tools/dist/compress-output.d.ts +0 -38
- package/packages/tools/dist/compress-output.js +0 -1
- package/packages/tools/dist/compression/delta-cache.d.ts +0 -29
- package/packages/tools/dist/compression/delta-cache.js +0 -1
- package/packages/tools/dist/compression/engine.d.ts +0 -34
- package/packages/tools/dist/compression/engine.js +0 -4
- package/packages/tools/dist/compression/litm.d.ts +0 -20
- package/packages/tools/dist/compression/litm.js +0 -1
- package/packages/tools/dist/compression/mmr.d.ts +0 -24
- package/packages/tools/dist/compression/mmr.js +0 -1
- package/packages/tools/dist/compression/rules/docker.d.ts +0 -11
- package/packages/tools/dist/compression/rules/docker.js +0 -3
- package/packages/tools/dist/compression/rules/generic.d.ts +0 -11
- package/packages/tools/dist/compression/rules/generic.js +0 -3
- package/packages/tools/dist/compression/rules/git.d.ts +0 -11
- package/packages/tools/dist/compression/rules/git.js +0 -3
- package/packages/tools/dist/compression/rules/index.d.ts +0 -14
- package/packages/tools/dist/compression/rules/index.js +0 -1
- package/packages/tools/dist/compression/rules/kubectl.d.ts +0 -11
- package/packages/tools/dist/compression/rules/kubectl.js +0 -3
- package/packages/tools/dist/compression/rules/lint.d.ts +0 -11
- package/packages/tools/dist/compression/rules/lint.js +0 -3
- package/packages/tools/dist/compression/rules/npm.d.ts +0 -11
- package/packages/tools/dist/compression/rules/npm.js +0 -3
- package/packages/tools/dist/compression/rules/test-runner.d.ts +0 -11
- package/packages/tools/dist/compression/rules/test-runner.js +0 -3
- package/packages/tools/dist/compression/scoring.d.ts +0 -26
- package/packages/tools/dist/compression/scoring.js +0 -1
- package/packages/tools/dist/compression/types.d.ts +0 -61
- package/packages/tools/dist/compression/types.js +0 -1
- package/packages/tools/dist/config-extractor.d.ts +0 -9
- package/packages/tools/dist/config-extractor.js +0 -7
- package/packages/tools/dist/data-transform.d.ts +0 -12
- package/packages/tools/dist/data-transform.js +0 -1
- package/packages/tools/dist/dead-symbols.d.ts +0 -28
- package/packages/tools/dist/dead-symbols.js +0 -2
- package/packages/tools/dist/delegate.d.ts +0 -36
- package/packages/tools/dist/delegate.js +0 -1
- package/packages/tools/dist/diagram-builder.d.ts +0 -9
- package/packages/tools/dist/diagram-builder.js +0 -9
- package/packages/tools/dist/diff-parse.d.ts +0 -28
- package/packages/tools/dist/diff-parse.js +0 -3
- package/packages/tools/dist/digest.d.ts +0 -55
- package/packages/tools/dist/digest.js +0 -6
- package/packages/tools/dist/dogfood-log.d.ts +0 -49
- package/packages/tools/dist/dogfood-log.js +0 -2
- package/packages/tools/dist/encode.d.ts +0 -16
- package/packages/tools/dist/encode.js +0 -1
- package/packages/tools/dist/env-info.d.ts +0 -30
- package/packages/tools/dist/env-info.js +0 -1
- package/packages/tools/dist/eval.d.ts +0 -15
- package/packages/tools/dist/eval.js +0 -2
- package/packages/tools/dist/evidence-map.d.ts +0 -92
- package/packages/tools/dist/evidence-map.js +0 -2
- package/packages/tools/dist/file-cache.d.ts +0 -41
- package/packages/tools/dist/file-cache.js +0 -3
- package/packages/tools/dist/file-summary.d.ts +0 -52
- package/packages/tools/dist/file-summary.js +0 -2
- package/packages/tools/dist/file-walk.d.ts +0 -6
- package/packages/tools/dist/file-walk.js +0 -1
- package/packages/tools/dist/find-examples.d.ts +0 -29
- package/packages/tools/dist/find-examples.js +0 -3
- package/packages/tools/dist/find.d.ts +0 -49
- package/packages/tools/dist/find.js +0 -1
- package/packages/tools/dist/forge-classify.d.ts +0 -44
- package/packages/tools/dist/forge-classify.js +0 -2
- package/packages/tools/dist/forge-ground.d.ts +0 -61
- package/packages/tools/dist/forge-ground.js +0 -1
- package/packages/tools/dist/git-context.d.ts +0 -25
- package/packages/tools/dist/git-context.js +0 -3
- package/packages/tools/dist/graph-query.d.ts +0 -98
- package/packages/tools/dist/graph-query.js +0 -1
- package/packages/tools/dist/guide.d.ts +0 -25
- package/packages/tools/dist/guide.js +0 -1
- package/packages/tools/dist/health.d.ts +0 -16
- package/packages/tools/dist/health.js +0 -2
- package/packages/tools/dist/http-request.d.ts +0 -25
- package/packages/tools/dist/http-request.js +0 -1
- package/packages/tools/dist/lane.d.ts +0 -41
- package/packages/tools/dist/lane.js +0 -6
- package/packages/tools/dist/measure.d.ts +0 -42
- package/packages/tools/dist/measure.js +0 -2
- package/packages/tools/dist/onboard-utils.d.ts +0 -12
- package/packages/tools/dist/onboard-utils.js +0 -1
- package/packages/tools/dist/onboard.d.ts +0 -50
- package/packages/tools/dist/onboard.js +0 -18
- package/packages/tools/dist/parse-output.d.ts +0 -84
- package/packages/tools/dist/parse-output.js +0 -2
- package/packages/tools/dist/path-resolver.d.ts +0 -14
- package/packages/tools/dist/path-resolver.js +0 -1
- package/packages/tools/dist/process-manager.d.ts +0 -20
- package/packages/tools/dist/process-manager.js +0 -1
- package/packages/tools/dist/queue.d.ts +0 -40
- package/packages/tools/dist/queue.js +0 -1
- package/packages/tools/dist/regex-test.d.ts +0 -33
- package/packages/tools/dist/regex-test.js +0 -1
- package/packages/tools/dist/regex-utils.d.ts +0 -8
- package/packages/tools/dist/regex-utils.js +0 -1
- package/packages/tools/dist/rename.d.ts +0 -31
- package/packages/tools/dist/rename.js +0 -2
- package/packages/tools/dist/replay.d.ts +0 -59
- package/packages/tools/dist/replay.js +0 -4
- package/packages/tools/dist/response-envelope.d.ts +0 -43
- package/packages/tools/dist/response-envelope.js +0 -1
- package/packages/tools/dist/restore-points.d.ts +0 -22
- package/packages/tools/dist/restore-points.js +0 -1
- package/packages/tools/dist/schema-validate.d.ts +0 -25
- package/packages/tools/dist/schema-validate.js +0 -1
- package/packages/tools/dist/scope-map.d.ts +0 -51
- package/packages/tools/dist/scope-map.js +0 -1
- package/packages/tools/dist/snippet.d.ts +0 -35
- package/packages/tools/dist/snippet.js +0 -1
- package/packages/tools/dist/stash.d.ts +0 -14
- package/packages/tools/dist/stash.js +0 -1
- package/packages/tools/dist/stratum-card.d.ts +0 -30
- package/packages/tools/dist/stratum-card.js +0 -4
- package/packages/tools/dist/symbol.d.ts +0 -45
- package/packages/tools/dist/symbol.js +0 -3
- package/packages/tools/dist/synthesis-engine.d.ts +0 -13
- package/packages/tools/dist/synthesis-engine.js +0 -6
- package/packages/tools/dist/test-run.d.ts +0 -28
- package/packages/tools/dist/test-run.js +0 -2
- package/packages/tools/dist/text-utils.d.ts +0 -24
- package/packages/tools/dist/text-utils.js +0 -2
- package/packages/tools/dist/time-utils.d.ts +0 -20
- package/packages/tools/dist/time-utils.js +0 -1
- package/packages/tools/dist/trace.d.ts +0 -43
- package/packages/tools/dist/trace.js +0 -2
- package/packages/tools/dist/truncation.d.ts +0 -66
- package/packages/tools/dist/truncation.js +0 -11
- package/packages/tools/dist/watch.d.ts +0 -32
- package/packages/tools/dist/watch.js +0 -1
- package/packages/tools/dist/web-fetch.d.ts +0 -47
- package/packages/tools/dist/web-fetch.js +0 -8
- package/packages/tools/dist/web-search.d.ts +0 -25
- package/packages/tools/dist/web-search.js +0 -1
- package/packages/tools/dist/workset.d.ts +0 -47
- package/packages/tools/dist/workset.js +0 -1
- package/scaffold/__tests__/copilot-inline-shared-protocols.test.mjs +0 -39
- /package/packages/server/dist/{config.js → config-C5IU9Lau.js} +0 -0
- /package/packages/server/dist/{dashboard-static.js → dashboard-static-BfIe0Si1.js} +0 -0
- /package/packages/server/dist/{version-check.js → version-check-D4j0Pykd.js} +0 -0
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
|
|
3
|
-
//#region packages/server/src/structured-content-guard.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Build a minimal `structuredContent` placeholder when the handler didn't
|
|
6
|
-
* provide one. The SDK only checks that the value is a non-null object and
|
|
7
|
-
* validates it against the tool's Zod-driven JSON-Schema.
|
|
8
|
-
*
|
|
9
|
-
* We extract the error message from the text content blocks and store it
|
|
10
|
-
* under an `_error` key. Because `outputSchema` Zod schemas are compiled
|
|
11
|
-
* with `strict: false` by default via `zodToJsonSchema`, additional
|
|
12
|
-
* properties are tolerated and the SDK validator will not reject the
|
|
13
|
-
* placeholder.
|
|
14
|
-
*
|
|
15
|
-
* UPDATE: The SDK uses passthrough-style validation which DOES reject
|
|
16
|
-
* unknown keys on strict schemas. Instead, we build a "zero-value"
|
|
17
|
-
* object from the registered outputSchema (Zod or JSON-Schema) so it
|
|
18
|
-
* always passes validation. Zod schemas expose `.shape` and `.type`
|
|
19
|
-
* differently from JSON-Schema's `.properties` and `.type` — the
|
|
20
|
-
* `buildZeroValue` function handles both formats.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Wrap `server.registerTool` so that every handler result is guaranteed
|
|
24
|
-
* to include `structuredContent` when the tool declares `outputSchema`.
|
|
25
|
-
*/
|
|
26
|
-
declare function installStructuredContentGuard(server: McpServer): void;
|
|
27
|
-
//#endregion
|
|
28
|
-
export { installStructuredContentGuard };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e){let n=e.registerTool.bind(e);e.registerTool=(e,r,i)=>r?.outputSchema==null?n(e,r,i):n(e,r,async(e,n)=>{let a=await i(e,n);return a.structuredContent??=t(r.outputSchema),a})}function t(e){if(!e)return{};if(e.anyOf){let n=e.anyOf.find(e=>e.type!==`null`);return n?t(n):null}switch(e.type){case`object`:{let n={},r=e.properties??e.shape;if(r)for(let[e,i]of Object.entries(r))n[e]=t(i);return n}case`array`:return[];case`string`:return``;case`number`:case`integer`:return 0;case`boolean`:return!1;case`nullable`:return null;case`optional`:return;case`record`:return{};default:return{}}}export{e as installStructuredContentGuard};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
//#region packages/server/src/task-manager.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Lightweight progress reporting for long-running tool operations.
|
|
4
|
-
*
|
|
5
|
-
* Wraps MCP progress notifications (`notifications/progress`) with a simple
|
|
6
|
-
* TaskHandle API. Degrades gracefully when the client doesn't support progress.
|
|
7
|
-
*
|
|
8
|
-
* @see E-027 — Tasks + Progress enhancement
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Minimal type for the tool handler `extra` parameter we need.
|
|
12
|
-
* Avoids importing full SDK types for testing flexibility.
|
|
13
|
-
*/
|
|
14
|
-
interface ToolHandlerExtra {
|
|
15
|
-
sendNotification?: (notification: {
|
|
16
|
-
method: string;
|
|
17
|
-
params?: Record<string, unknown>;
|
|
18
|
-
}) => Promise<void>;
|
|
19
|
-
}
|
|
20
|
-
interface TaskHandle {
|
|
21
|
-
/** Report progress. `current` is 0-based step number. */
|
|
22
|
-
progress(current: number, message?: string): void;
|
|
23
|
-
/** Mark the task as complete. */
|
|
24
|
-
complete(message?: string): void;
|
|
25
|
-
/** Mark the task as failed. */
|
|
26
|
-
fail(error?: string): void;
|
|
27
|
-
}
|
|
28
|
-
interface ITaskRunner {
|
|
29
|
-
/** Create a task with a descriptive title and expected total steps. */
|
|
30
|
-
createTask(title: string, totalSteps: number): TaskHandle;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Create a task runner that sends MCP progress notifications.
|
|
34
|
-
* If `extra` is undefined or lacks sendNotification, returns a no-op runner.
|
|
35
|
-
*/
|
|
36
|
-
declare function createTaskRunner(extra?: ToolHandlerExtra): ITaskRunner;
|
|
37
|
-
/** No-op task runner — all methods silently succeed. */
|
|
38
|
-
declare const noopTaskRunner: ITaskRunner;
|
|
39
|
-
//#endregion
|
|
40
|
-
export { ITaskRunner, TaskHandle, ToolHandlerExtra, createTaskRunner, noopTaskRunner };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createLogger as e}from"../../core/dist/index.js";const t=e(`task-manager`);let n=0;function r(e){let r=typeof e?.sendNotification==`function`;return{createTask(i,a){let o=`aikit-task-${++n}`,s=(n,i,a)=>{r&&e.sendNotification?.({method:`notifications/progress`,params:{progressToken:o,progress:n,total:i,...a?{message:a}:{}}}).catch(e=>{t.debug(`Progress notification failed`,{token:o,error:String(e)})})};return r&&t.debug(`Task created`,{token:o,title:i,totalSteps:a}),{progress(e,t){s(e,a,t??`${i}: step ${e+1}/${a}`)},complete(e){s(a,a,e??`${i}: complete`)},fail(e){s(a,a,e??`${i}: failed`)}}}}}const i={createTask(){return{progress(){},complete(){},fail(){}}}};export{r as createTaskRunner,i as noopTaskRunner};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
//#region packages/server/src/tool-metadata.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Centralized tool metadata registry for all AI Kit MCP tools.
|
|
4
|
-
*
|
|
5
|
-
* Provides `title` and `annotations` (readOnlyHint, destructiveHint) for each tool.
|
|
6
|
-
* Used by both placeholder registration (lazy startup) and real tool registration
|
|
7
|
-
* to keep metadata in sync.
|
|
8
|
-
*
|
|
9
|
-
* @see E-020 — Tool Annotations enhancement
|
|
10
|
-
*/
|
|
11
|
-
interface ToolMeta {
|
|
12
|
-
/** Human-readable display name shown in the VS Code tools picker. */
|
|
13
|
-
title: string;
|
|
14
|
-
/** MCP tool annotations. */
|
|
15
|
-
annotations: {
|
|
16
|
-
readOnlyHint?: boolean;
|
|
17
|
-
destructiveHint?: boolean;
|
|
18
|
-
idempotentHint?: boolean;
|
|
19
|
-
openWorldHint?: boolean;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Master metadata map keyed by tool name.
|
|
24
|
-
*
|
|
25
|
-
* Classification rules:
|
|
26
|
-
* - `readOnlyHint: true` — tool NEVER modifies state (files, store, index, processes)
|
|
27
|
-
* - `readOnlyHint: false` — tool CAN modify state (even if only via certain actions)
|
|
28
|
-
* - `destructiveHint: true` — tool deletes or overwrites data
|
|
29
|
-
* - Mixed-mode tools (read+write via `action` param) → `readOnlyHint: false`
|
|
30
|
-
*/
|
|
31
|
-
declare const TOOL_METADATA: Record<string, ToolMeta>;
|
|
32
|
-
/**
|
|
33
|
-
* Get tool metadata for a given tool name.
|
|
34
|
-
* Returns a default (no title, readOnlyHint: false) for unknown tools.
|
|
35
|
-
*/
|
|
36
|
-
declare function getToolMeta(name: string): ToolMeta;
|
|
37
|
-
//#endregion
|
|
38
|
-
export { TOOL_METADATA, ToolMeta, getToolMeta };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={search:{title:`Hybrid Search`,annotations:{readOnlyHint:!0,idempotentHint:!0}},find:{title:`Federated Find`,annotations:{readOnlyHint:!0,idempotentHint:!0}},symbol:{title:`Symbol Resolver — Cross-Module Definitions & References`,annotations:{readOnlyHint:!0,idempotentHint:!0}},trace:{title:`Data Flow Tracer — Cross-Module Call & Import Chains`,annotations:{readOnlyHint:!0,idempotentHint:!0}},scope_map:{title:`Task Scope Map`,annotations:{readOnlyHint:!0,idempotentHint:!0}},lookup:{title:`Chunk Lookup`,annotations:{readOnlyHint:!0,idempotentHint:!0}},dead_symbols:{title:`Dead Symbol Finder`,annotations:{readOnlyHint:!0,idempotentHint:!0}},file_summary:{title:`File Summary`,annotations:{readOnlyHint:!0,idempotentHint:!0}},analyze_structure:{title:`Analyze Structure`,annotations:{readOnlyHint:!0,idempotentHint:!0}},analyze_dependencies:{title:`Analyze Dependencies`,annotations:{readOnlyHint:!0,idempotentHint:!0}},analyze_symbols:{title:`Analyze Symbols`,annotations:{readOnlyHint:!0,idempotentHint:!0}},analyze_patterns:{title:`Analyze Patterns`,annotations:{readOnlyHint:!0,idempotentHint:!0}},analyze_entry_points:{title:`Analyze Entry Points`,annotations:{readOnlyHint:!0,idempotentHint:!0}},analyze_diagram:{title:`Analyze Diagram`,annotations:{readOnlyHint:!0,idempotentHint:!0}},blast_radius:{title:`Blast Radius`,annotations:{readOnlyHint:!0,idempotentHint:!0}},brainstorm:{title:`Brainstorm Session`,annotations:{readOnlyHint:!0,idempotentHint:!0}},remember:{title:`Remember Knowledge`,annotations:{readOnlyHint:!1}},read:{title:`Read Knowledge`,annotations:{readOnlyHint:!0,idempotentHint:!0}},update:{title:`Update Knowledge`,annotations:{readOnlyHint:!1}},forget:{title:`Forget Knowledge`,annotations:{readOnlyHint:!1,destructiveHint:!0}},list:{title:`List Knowledge`,annotations:{readOnlyHint:!0,idempotentHint:!0}},produce_knowledge:{title:`Produce Knowledge`,annotations:{readOnlyHint:!0,idempotentHint:!0}},compact:{title:`Semantic Compactor`,annotations:{readOnlyHint:!0,idempotentHint:!0}},digest:{title:`Multi-Source Digest`,annotations:{readOnlyHint:!0,idempotentHint:!0}},stratum_card:{title:`Stratum Card`,annotations:{readOnlyHint:!0,idempotentHint:!0}},forge_ground:{title:`FORGE Ground`,annotations:{readOnlyHint:!0,idempotentHint:!0}},forge_classify:{title:`FORGE Classify`,annotations:{readOnlyHint:!0,idempotentHint:!0}},evidence_map:{title:`Evidence Map`,annotations:{readOnlyHint:!1}},present:{title:`Rich Content Presenter`,annotations:{readOnlyHint:!0,idempotentHint:!0}},check:{title:`Typecheck & Lint`,annotations:{readOnlyHint:!0,openWorldHint:!0}},test_run:{title:`Run Tests`,annotations:{readOnlyHint:!0,openWorldHint:!0}},eval:{title:`Evaluate Code`,annotations:{readOnlyHint:!1,openWorldHint:!0}},batch:{title:`Batch Operations`,annotations:{readOnlyHint:!0,idempotentHint:!0}},audit:{title:`Project Audit`,annotations:{readOnlyHint:!0,idempotentHint:!0}},rename:{title:`Rename Symbol`,annotations:{readOnlyHint:!1,destructiveHint:!0}},restore:{title:`Restore`,annotations:{readOnlyHint:!1}},codemod:{title:`Codemod`,annotations:{readOnlyHint:!1,destructiveHint:!0}},data_transform:{title:`Data Transform`,annotations:{readOnlyHint:!0,idempotentHint:!0}},stash:{title:`Stash Values`,annotations:{readOnlyHint:!1}},checkpoint:{title:`Session Checkpoint`,annotations:{readOnlyHint:!1}},workset:{title:`Workset Manager`,annotations:{readOnlyHint:!1}},lane:{title:`Exploration Lane`,annotations:{readOnlyHint:!1}},git_context:{title:`Git Context`,annotations:{readOnlyHint:!0,idempotentHint:!0}},diff_parse:{title:`Diff Parser`,annotations:{readOnlyHint:!0,idempotentHint:!0}},parse_output:{title:`Parse Build Output`,annotations:{readOnlyHint:!0,idempotentHint:!0}},process:{title:`Process Manager`,annotations:{readOnlyHint:!1,openWorldHint:!0}},watch:{title:`File Watcher`,annotations:{readOnlyHint:!1,openWorldHint:!0}},delegate:{title:`Delegate Task`,annotations:{readOnlyHint:!1,openWorldHint:!0}},config:{title:`Configuration Manager`,annotations:{readOnlyHint:!1}},status:{title:`AI Kit Status`,annotations:{readOnlyHint:!0,idempotentHint:!0}},health:{title:`Health Check`,annotations:{readOnlyHint:!0,idempotentHint:!0}},reindex:{title:`Reindex`,annotations:{readOnlyHint:!1}},onboard:{title:`Onboard Codebase`,annotations:{readOnlyHint:!1}},graph:{title:`Code Knowledge Graph — Module & Symbol Relationships`,annotations:{readOnlyHint:!1}},guide:{title:`Tool Guide`,annotations:{readOnlyHint:!0,idempotentHint:!0}},replay:{title:`Replay History`,annotations:{readOnlyHint:!0,idempotentHint:!0}},changelog:{title:`Generate Changelog`,annotations:{readOnlyHint:!0,idempotentHint:!0}},regex_test:{title:`Regex Tester`,annotations:{readOnlyHint:!0,idempotentHint:!0}},encode:{title:`Encode / Decode`,annotations:{readOnlyHint:!0,idempotentHint:!0}},measure:{title:`Code Metrics`,annotations:{readOnlyHint:!0,idempotentHint:!0}},schema_validate:{title:`Schema Validator`,annotations:{readOnlyHint:!0,idempotentHint:!0}},snippet:{title:`Code Snippets`,annotations:{readOnlyHint:!1}},env:{title:`Environment Info`,annotations:{readOnlyHint:!0,idempotentHint:!0}},time:{title:`Date & Time`,annotations:{readOnlyHint:!0,idempotentHint:!0}},web_fetch:{title:`Web Fetch`,annotations:{readOnlyHint:!0,openWorldHint:!0}},web_search:{title:`Web Search`,annotations:{readOnlyHint:!0,openWorldHint:!0}},http:{title:`HTTP Request`,annotations:{readOnlyHint:!1,openWorldHint:!0}},queue:{title:`Operation Queue`,annotations:{readOnlyHint:!1}},bridge_push:{title:`Bridge Push`,annotations:{readOnlyHint:!1}},bridge_pull:{title:`Bridge Pull`,annotations:{readOnlyHint:!0,idempotentHint:!0}},bridge_sync:{title:`Bridge Sync Status`,annotations:{readOnlyHint:!0,idempotentHint:!0}},evolution_state:{title:`Evolution State`,annotations:{readOnlyHint:!1}},policy_check:{title:`Policy Check`,annotations:{readOnlyHint:!0,idempotentHint:!0}},flow_list:{title:`Flow List`,annotations:{readOnlyHint:!0,idempotentHint:!0}},flow_info:{title:`Flow Info`,annotations:{readOnlyHint:!0,idempotentHint:!0}},flow_start:{title:`Flow Start`,annotations:{readOnlyHint:!1}},flow_step:{title:`Flow Step`,annotations:{readOnlyHint:!1}},flow_status:{title:`Flow Status`,annotations:{readOnlyHint:!0,idempotentHint:!0}},flow_reset:{title:`Flow Reset`,annotations:{readOnlyHint:!1}},flow_read_instruction:{title:`Flow Read Instruction`,annotations:{readOnlyHint:!0,idempotentHint:!0}},flow_add:{title:`Flow Add`,annotations:{readOnlyHint:!1}},flow_remove:{title:`Flow Remove`,annotations:{readOnlyHint:!1}},flow_update:{title:`Flow Update`,annotations:{readOnlyHint:!1}}};function t(t){return e[t]??{title:t,annotations:{readOnlyHint:!1}}}export{e as TOOL_METADATA,t as getToolMeta};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
|
|
3
|
-
//#region packages/server/src/tool-prefix.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Install a tool-name prefix interceptor on the given McpServer.
|
|
6
|
-
*
|
|
7
|
-
* @param server The MCP server whose `registerTool` method will be wrapped.
|
|
8
|
-
* @param prefix A string prepended to every tool name. Empty string = no-op.
|
|
9
|
-
*/
|
|
10
|
-
declare function installToolPrefix(server: McpServer, prefix: string): void;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { installToolPrefix };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,t){if(!t)return;let n=e.registerTool.bind(e);e.registerTool=(e,r,i)=>{let a=`${t}${e}`;return i===void 0?n(a,r):n(a,r,i)}}export{e as installToolPrefix};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//#region packages/server/src/tool-timeout.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Tool timeout wrapper — ensures no tool handler can run indefinitely.
|
|
4
|
-
*
|
|
5
|
-
* Every MCP tool handler is wrapped with a configurable timeout.
|
|
6
|
-
* Heavy tools (onboard, reindex, produce_knowledge, analyzers) get a longer deadline.
|
|
7
|
-
*/
|
|
8
|
-
/** Default timeout for normal tool handlers (120 seconds). */
|
|
9
|
-
declare const DEFAULT_TOOL_TIMEOUT_MS = 120000;
|
|
10
|
-
/** Extended timeout for heavy tool handlers (10 minutes). */
|
|
11
|
-
declare const HEAVY_TOOL_TIMEOUT_MS = 600000;
|
|
12
|
-
declare class ToolTimeoutError extends Error {
|
|
13
|
-
readonly toolName: string;
|
|
14
|
-
readonly timeoutMs: number;
|
|
15
|
-
constructor(toolName: string, timeoutMs: number);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Return the timeout for a given tool name.
|
|
19
|
-
*/
|
|
20
|
-
declare function getToolTimeout(toolName: string): number;
|
|
21
|
-
/**
|
|
22
|
-
* Wrap an async function with a timeout. If the function doesn't resolve
|
|
23
|
-
* within `timeoutMs`, the returned promise rejects with a `ToolTimeoutError`.
|
|
24
|
-
*/
|
|
25
|
-
declare function withTimeout<T>(fn: () => Promise<T>, timeoutMs: number, toolName: string): Promise<T>;
|
|
26
|
-
//#endregion
|
|
27
|
-
export { DEFAULT_TOOL_TIMEOUT_MS, HEAVY_TOOL_TIMEOUT_MS, ToolTimeoutError, getToolTimeout, withTimeout };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createLogger as e}from"../../core/dist/index.js";const t=e(`tool-timeout`),n=12e4,r=6e5,i=new Set([`onboard`,`reindex`,`produce_knowledge`,`analyze_structure`,`analyze_dependencies`,`analyze_symbols`,`analyze_patterns`,`analyze_entry_points`,`analyze_diagram`,`codemod`,`batch`,`audit`]);var a=class extends Error{constructor(e,t){super(`Tool "${e}" timed out after ${t}ms`),this.toolName=e,this.timeoutMs=t,this.name=`ToolTimeoutError`}};function o(e){return i.has(e)?r:n}function s(e,n,r){return new Promise((i,o)=>{let s=!1,c=setTimeout(()=>{if(!s){s=!0;let e=new a(r,n);t.warn(e.message),o(e)}},n);c.unref&&c.unref(),e().then(e=>{s||(s=!0,clearTimeout(c),i(e))},e=>{s||(s=!0,clearTimeout(c),o(e))})})}export{n as DEFAULT_TOOL_TIMEOUT_MS,r as HEAVY_TOOL_TIMEOUT_MS,a as ToolTimeoutError,o as getToolTimeout,s as withTimeout};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { IGraphStore, IKnowledgeStore } from "../../../store/dist/index.js";
|
|
3
|
-
import { IEmbedder } from "../../../embeddings/dist/index.js";
|
|
4
|
-
|
|
5
|
-
//#region packages/server/src/tools/analyze.tools.d.ts
|
|
6
|
-
declare function registerAnalyzeStructureTool(server: McpServer, store: IKnowledgeStore, embedder: IEmbedder): void;
|
|
7
|
-
declare function registerAnalyzeDependenciesTool(server: McpServer, store: IKnowledgeStore, embedder: IEmbedder): void;
|
|
8
|
-
declare function registerAnalyzeSymbolsTool(server: McpServer, store: IKnowledgeStore, embedder: IEmbedder): void;
|
|
9
|
-
declare function registerAnalyzePatternsTool(server: McpServer, store: IKnowledgeStore, embedder: IEmbedder): void;
|
|
10
|
-
declare function registerAnalyzeEntryPointsTool(server: McpServer, store: IKnowledgeStore, embedder: IEmbedder): void;
|
|
11
|
-
declare function registerAnalyzeDiagramTool(server: McpServer, store: IKnowledgeStore, embedder: IEmbedder): void;
|
|
12
|
-
declare function registerBlastRadiusTool(server: McpServer, store: IKnowledgeStore, embedder: IEmbedder, graphStore?: IGraphStore): void;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { registerAnalyzeDependenciesTool, registerAnalyzeDiagramTool, registerAnalyzeEntryPointsTool, registerAnalyzePatternsTool, registerAnalyzeStructureTool, registerAnalyzeSymbolsTool, registerBlastRadiusTool };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{getToolMeta as e}from"../tool-metadata.js";import{AnalyzeStructureOutputSchema as t,BlastRadiusOutputSchema as n}from"../output-schemas.js";import{z as r}from"zod";import{createHash as i}from"node:crypto";import{createLogger as a,serializeError as o}from"../../../core/dist/index.js";import{BlastRadiusAnalyzer as s,DependencyAnalyzer as c,DiagramGenerator as l,EntryPointAnalyzer as u,PatternAnalyzer as d,StructureAnalyzer as f,SymbolAnalyzer as p}from"../../../analyzers/dist/index.js";import{WasmRuntime as m}from"../../../chunker/dist/index.js";import{gitContext as h,truncateToTokenBudget as g}from"../../../tools/dist/index.js";const _=a(`tools`),v=r.number().min(100).max(5e4).optional().describe(`Maximum token budget for the response. When set, output is truncated to fit.`);function y(e,t){return t?g(e,t):e}function b(){let e=[];return m.get()||e.push(`Tree-sitter unavailable — using regex fallback, symbol/pattern confidence reduced`),e.length===0?``:`\n\n> **⚠ Caveats:** ${e.join(`; `)}`}function x(e){return(e??[]).map(e=>{if(typeof e==`string`)return e;if(e&&typeof e==`object`&&`path`in e)return typeof e.path==`string`?e.path:void 0}).filter(e=>!!e)}function S(e){let t=[],n=e.filter(e=>/\.(ts|tsx|js|jsx)$/.test(e)&&/(service|store|model|schema|migration)/i.test(e)),r=e.filter(e=>/\.(ts|tsx|js|jsx)$/.test(e)&&!n.includes(e)),i=e.filter(e=>!/\.(ts|tsx|js|jsx)$/.test(e));return(n.length>0||r.length>0||i.length>0)&&(t.push(`
|
|
2
|
-
|
|
3
|
-
### Risk Assessment`),n.length>0&&t.push(`- 🔴 **High risk** (${n.length}): ${n.slice(0,5).map(e=>`\`${e}\``).join(`, `)}`),r.length>0&&t.push(`- 🟡 **Medium risk** (${r.length}): source files`),i.length>0&&t.push(`- 🟢 **Low risk** (${i.length}): non-source files`)),t.join(`
|
|
4
|
-
`)}function C(e){let t=e.replace(/\\/g,`/`);return/(^|\/)__tests__\/|\.(test|spec)\.[jt]sx?$/i.test(t)?`Tests`:/(controller|route|handler|api)/i.test(t)?`API`:/(service|store|model|schema|migration|repo|repository|db|database)/i.test(t)?`Core/Data`:/\.(ts|tsx|js|jsx)$/.test(t)?`Source`:`Config/Docs`}function w(e){if(e.length===0)return``;let t=[`Core/Data`,`API`,`Source`,`Tests`,`Config/Docs`],n=new Map;for(let t of e){let e=C(t),r=n.get(e)??[];r.push(t),n.set(e,r)}let r=[`
|
|
5
|
-
|
|
6
|
-
### Layer Classification`];for(let e of t){let t=n.get(e);if(!t?.length)continue;let i=t.slice(0,5).map(e=>`\`${e}\``).join(`, `),a=t.length>5?`, ... and ${t.length-5} more`:``;r.push(`- **${e}** (${t.length}): ${i}${a}`)}return r.join(`
|
|
7
|
-
`)}async function T(e,t,n,r,a){try{let o=`produced/analysis/${n}/${i(`sha256`).update(r).digest(`hex`).slice(0,12)}.md`,s=i(`sha256`).update(a).digest(`hex`).slice(0,16),c=new Date().toISOString(),l=a.length>2e3?a.split(/(?=^## )/m).filter(e=>e.trim().length>0):[a],u=l.map((e,t)=>({id:i(`sha256`).update(`${o}::${t}`).digest(`hex`).slice(0,16),content:e.trim(),sourcePath:o,contentType:`produced-knowledge`,chunkIndex:t,totalChunks:l.length,startLine:0,endLine:0,fileHash:s,indexedAt:c,origin:`produced`,tags:[`analysis`,n],category:`analysis`,version:1})),d=await t.embedBatch(u.map(e=>e.content));await e.upsert(u,d),_.info(`Auto-persisted analysis`,{analyzerName:n,chunkCount:u.length})}catch(e){_.warn(`Auto-persist analysis failed`,{analyzerName:n,...o(e)})}}function E(n,i,a){let s=new f,c=e(`analyze_structure`);n.registerTool(`analyze_structure`,{title:c.title,description:`Analyze the file/directory structure of a codebase. Returns an annotated tree with language stats.`,outputSchema:t,inputSchema:{path:r.string().describe(`Root path to analyze`),max_depth:r.number().min(1).max(10).default(6).describe(`Maximum directory depth`),format:r.enum([`json`,`markdown`]).default(`markdown`).describe(`Output format`),max_tokens:v},annotations:c.annotations},async({path:e,max_depth:t,format:n,max_tokens:r})=>{try{let o=await s.analyze(e,{format:n,maxDepth:t,maxTokens:r});T(i,a,`structure`,e,o.output);let c=o.data;return{content:[{type:`text`,text:y(o.output+"\n\n---\n_Analysis auto-saved to KB. Next: Use `analyze_dependencies` for import graphs, or `analyze_patterns` to detect architecture patterns._",r)}],structuredContent:{files:c.fileCount??o.meta.fileCount,packages:c.packageCount??0,languages:c.languages??{},tree:o.output.slice(0,2e3)}}}catch(e){return _.error(`Analysis failed`,o(e)),{content:[{type:`text`,text:`Analysis failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function D(t,n,i){let a=new c,s=e(`analyze_dependencies`);t.registerTool(`analyze_dependencies`,{title:s.title,description:`Analyze import/require dependencies across a codebase. Shows external packages and internal module graph.`,inputSchema:{path:r.string().describe(`Root path to analyze`),format:r.enum([`json`,`markdown`,`mermaid`]).default(`markdown`).describe(`Output format`),max_tokens:v},annotations:s.annotations},async({path:e,format:t,max_tokens:r})=>{try{let o=await a.analyze(e,{format:t});return T(n,i,`dependencies`,e,o.output),{content:[{type:`text`,text:y(o.output+"\n\n---\n_Analysis auto-saved to KB. Next: Use `analyze_symbols` to explore exported symbols, or `analyze_diagram` for visual representation._",r)}]}}catch(e){return _.error(`Analysis failed`,o(e)),{content:[{type:`text`,text:`Analysis failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function O(t,n,i){let a=new p,s=e(`analyze_symbols`);t.registerTool(`analyze_symbols`,{title:s.title,description:`Extract exported and local symbols (functions, classes, interfaces, types, constants) from a codebase.`,inputSchema:{path:r.string().describe(`Root path to analyze`),filter:r.string().optional().describe(`Filter symbols by name substring`),format:r.enum([`json`,`markdown`]).default(`markdown`).describe(`Output format`)},annotations:s.annotations},async({path:e,filter:t,format:r})=>{try{let o=await a.analyze(e,{format:r,filter:t});return T(n,i,`symbols`,e,o.output),{content:[{type:`text`,text:o.output+b()+"\n\n---\n_Analysis auto-saved to KB. Next: Use `analyze_dependencies` to see import relationships, or `search` to find usage patterns._"}]}}catch(e){return _.error(`Analysis failed`,o(e)),{content:[{type:`text`,text:`Analysis failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function k(t,n,i){let a=new d,s=e(`analyze_patterns`);t.registerTool(`analyze_patterns`,{title:s.title,description:`Detect architectural patterns, frameworks, and conventions in a codebase using directory structure and code heuristics.`,inputSchema:{path:r.string().describe(`Root path to analyze`)},annotations:s.annotations},async({path:e})=>{try{let t=await a.analyze(e);return T(n,i,`patterns`,e,t.output),{content:[{type:`text`,text:t.output+b()+"\n\n---\n_Analysis auto-saved to KB. Next: Use `analyze_entry_points` to find Lambda handlers and main exports, or `produce_knowledge` for full analysis._"}]}}catch(e){return _.error(`Analysis failed`,o(e)),{content:[{type:`text`,text:`Analysis failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function A(t,n,i){let a=new u,s=e(`analyze_entry_points`);t.registerTool(`analyze_entry_points`,{title:s.title,description:`Find entry points: Lambda handlers, main exports, CLI bins, and server start scripts.`,inputSchema:{path:r.string().describe(`Root path to analyze`)},annotations:s.annotations},async({path:e})=>{try{let t=await a.analyze(e);return T(n,i,`entry-points`,e,t.output),{content:[{type:`text`,text:t.output+b()+"\n\n---\n_Analysis auto-saved to KB. Next: Use `analyze_dependencies` to see what each entry point imports, or `produce_knowledge` for comprehensive analysis._"}]}}catch(e){return _.error(`Analysis failed`,o(e)),{content:[{type:`text`,text:`Analysis failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function j(t,n,i){let a=new l,s=e(`analyze_diagram`);t.registerTool(`analyze_diagram`,{title:s.title,description:`Generate a Mermaid diagram of the codebase architecture or dependency graph. Returns Mermaid flowchart syntax — paste into any Markdown renderer or Mermaid editor to visualize.`,inputSchema:{path:r.string().describe(`Root path to analyze`),diagram_type:r.enum([`architecture`,`dependencies`]).default(`architecture`).describe(`Type of diagram`)},annotations:s.annotations},async({path:e,diagram_type:t})=>{try{let r=await a.analyze(e,{diagramType:t});return T(n,i,`diagram`,e,r.output),{content:[{type:`text`,text:r.output+"\n\n---\n_Analysis auto-saved to KB. Next: Use `analyze_structure` for detailed file tree, or `produce_knowledge` for comprehensive analysis._"}]}}catch(e){return _.error(`Diagram generation failed`,o(e)),{content:[{type:`text`,text:`Diagram generation failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function M(t,i,a,c){let l=new s,u=e(`blast_radius`);t.registerTool(`blast_radius`,{title:u.title,description:`Given a list of changed files, trace the dependency graph to find all affected files (direct + transitive importers) and their tests. Useful for scoping code reviews and impact analysis.`,outputSchema:n,inputSchema:{path:r.string().describe(`Root path of the codebase`),files:r.array(r.string()).optional().describe(`Changed file paths (relative to root). If omitted, auto-detects from git status.`),max_depth:r.number().min(1).max(20).default(5).describe(`Maximum transitive dependency depth`),format:r.enum([`json`,`markdown`]).default(`markdown`).describe(`Output format`),max_tokens:v},annotations:u.annotations},async({path:e,files:t,max_depth:n,format:r,max_tokens:s})=>{try{let o=t??[];if(o.length===0)try{let t=await h({cwd:e,includeDiff:!1});if(o=Array.from(new Set([...x(t.status?.staged),...x(t.status?.modified),...x(t.status?.untracked)])),o.length===0)return{content:[{type:`text`,text:"No changed files detected from git status. Provide `files` explicitly or make changes first."}]}}catch{return{content:[{type:`text`,text:"Could not detect changed files from git. Provide `files` explicitly."}],isError:!0}}let u=await l.analyze(e,{files:o,maxDepth:n,format:r}),d=``;if(c)try{let e=new Set;for(let t of o){let n=await c.findNodes({sourcePath:t,limit:10});for(let t of n){let n=await c.getNeighbors(t.id,{direction:`incoming`,edgeType:`imports`});for(let t of n.nodes){let n=t.sourcePath??t.name;o.includes(n)||e.add(n)}}}e.size>0&&(d=`\n\n### Graph-discovered importers (${e.size})\n`+[...e].slice(0,20).map(e=>`- \`${e}\``).join(`
|
|
8
|
-
`),e.size>20&&(d+=`\n- ... and ${e.size-20} more`))}catch{}let f=w(o),p=S(o),m=u.output+d+f+p+b()+"\n\n---\n_Analysis auto-saved to KB. Next: Use `analyze_dependencies` to see the full import graph, or `analyze_symbols` to inspect affected exports._";T(i,a,`blast-radius`,e,m);let g=new Set;if(c)for(let e of o)try{let t=await c.findNodes({sourcePath:e,limit:10});for(let e of t){let t=await c.getNeighbors(e.id,{direction:`incoming`,edgeType:`imports`});for(let e of t.nodes){let t=e.sourcePath??e.name;o.includes(t)||g.add(t)}}}catch{}let _=[...g].map(e=>({path:e,impact:`transitive`,reason:`imports changed file`})),v=o.length>10?`high`:o.length>3?`medium`:`low`;return{content:[{type:`text`,text:y(m,s)}],structuredContent:{changedFiles:o,affectedFiles:_,totalAffected:_.length,riskLevel:v}}}catch(e){return _.error(`Blast radius analysis failed`,o(e)),{content:[{type:`text`,text:`Blast radius analysis failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}export{D as registerAnalyzeDependenciesTool,j as registerAnalyzeDiagramTool,A as registerAnalyzeEntryPointsTool,k as registerAnalyzePatternsTool,E as registerAnalyzeStructureTool,O as registerAnalyzeSymbolsTool,M as registerBlastRadiusTool};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { IKnowledgeStore } from "../../../store/dist/index.js";
|
|
3
|
-
import { IEmbedder } from "../../../embeddings/dist/index.js";
|
|
4
|
-
|
|
5
|
-
//#region packages/server/src/tools/audit.tool.d.ts
|
|
6
|
-
declare function registerAuditTool(server: McpServer, store: IKnowledgeStore, embedder: IEmbedder): void;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { registerAuditTool };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getToolMeta as e}from"../tool-metadata.js";import{AuditOutputSchema as t}from"../output-schemas.js";import{createTaskRunner as n}from"../task-manager.js";import{z as r}from"zod";import{createLogger as i,serializeError as a}from"../../../core/dist/index.js";import{audit as o}from"../../../tools/dist/index.js";const s=i(`tools`);function c(i,c,l){let u=e(`audit`);i.registerTool(`audit`,{title:u.title,description:`Run a unified audit: structure, dependencies, patterns, health, dead_symbols, check, entry_points. Returns synthesized report with score, recommendations, and next steps. 6 round-trips → 1.`,outputSchema:t,inputSchema:{path:r.string().default(`.`).describe(`Root path to audit`),checks:r.array(r.enum([`structure`,`dependencies`,`patterns`,`health`,`dead_symbols`,`check`,`entry_points`])).optional().describe(`Which checks to run (default: all)`),detail:r.enum([`summary`,`full`]).default(`summary`).describe(`'summary' for overview (~500 tokens), 'full' includes pattern table`)},annotations:u.annotations},async({path:e,checks:t,detail:r},i)=>{try{let a=await o(c,l,{path:e,checks:t,detail:r});return n(i).createTask(`Audit`,1).complete(`Audit complete: ${a.data?.recommendations?.length??0} recommendations`),{content:[{type:`text`,text:a.ok?`${a.summary}\n\n---\n_Audit score: ${a.data?.score}/100 | ${a.meta.durationMs}ms${a.next&&a.next.length>0?` | Next: ${a.next.map(e=>`\`${e.tool}\` (${e.reason})`).join(`, `)}`:``}_`:a.error?.message??`Audit failed`}],isError:!a.ok,...a.ok&&a.data?{structuredContent:{passed:a.ok,score:a.data.score??0,checks:(a.data.recommendations??[]).map(e=>({name:e.area,passed:e.priority!==`high`,message:e.message,severity:e.priority})),summary:a.summary??``}}:{}}}catch(e){return s.error(`Audit failed`,a(e)),{content:[{type:`text`,text:`Audit failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}export{c as registerAuditTool};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { Elicitor } from "../../../elicitation/dist/index.js";
|
|
3
|
-
|
|
4
|
-
//#region packages/server/src/tools/brainstorm.tool.d.ts
|
|
5
|
-
declare function registerBrainstormTool(server: McpServer, elicitor: Elicitor): void;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { registerBrainstormTool };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{getToolMeta as e}from"../tool-metadata.js";import{z as t}from"zod";import{createLogger as n}from"../../../core/dist/index.js";const r=n(`tools`);function i(n,i){let s=e(`brainstorm`);n.registerTool(`brainstorm`,{title:s.title,description:`Interactive brainstorming tool for exploring ideas, making design decisions, and gathering requirements. Supports multiple actions: ask_choice (single selection), ask_multi (multiple selections), ask_freeform (text input), ask_confirm (yes/no), present_design (show summary and confirm). Falls back to text-only mode when elicitation is unavailable.`,inputSchema:{action:t.enum([`ask_choice`,`ask_multi`,`ask_freeform`,`ask_confirm`,`present_design`]).describe(`The type of brainstorm interaction`),message:t.string().describe(`The question or prompt to present`),options:t.array(t.string()).optional().describe(`Options for ask_choice/ask_multi actions`),context:t.string().optional().describe(`Additional context to include in the prompt`)},annotations:s.annotations},async({action:e,message:t,options:n,context:s})=>{let c=s?`${s}\n\n${t}`:t;if(!i.available)return o(e,c,n);try{switch(e){case`ask_choice`:{if(!n?.length)return a(`Error: ask_choice requires options array`);let e=await i.selectOne(c,n);return a(e===null?`No selection made (declined or cancelled).`:`Selected: **${e}**`)}case`ask_multi`:{if(!n?.length)return a(`Error: ask_multi requires options array`);let e=await i.selectMany(c,n);return e.length===0?a(`No selections made (declined or cancelled).`):a(`Selected:\n${e.map(e=>`- ${e}`).join(`
|
|
2
|
-
`)}`)}case`ask_freeform`:{let e=await i.promptText(c);return a(e===null?`No input provided (declined or cancelled).`:`Response:\n\n${e}`)}case`ask_confirm`:return a(await i.confirm(c)?`Confirmed: **Yes**`:`Confirmed: **No**`);case`present_design`:return a(await i.confirm(`## Design Summary\n\n${c}\n\nDo you approve this design?`)?`## Design Approved ✓
|
|
3
|
-
|
|
4
|
-
Proceeding with the design as described.`:`## Design Not Approved
|
|
5
|
-
|
|
6
|
-
Please provide feedback for revisions.`);default:return a(`Unknown action: ${e}`)}}catch(t){return r.warn(`Brainstorm elicitation failed, falling back to text`,{action:e,error:String(t)}),o(e,c,n)}})}function a(e){return{content:[{type:`text`,text:e}]}}function o(e,t,n){let r=`## Brainstorm: ${e}\n\n${t}`;return n?.length&&(r+=`\n\n**Options:**\n${n.map((e,t)=>`${t+1}. ${e}`).join(`
|
|
7
|
-
`)}`),r+=`
|
|
8
|
-
|
|
9
|
-
> *Elicitation unavailable — please respond with your choice in the next message.*`,{content:[{type:`text`,text:r}]}}export{i as registerBrainstormTool};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { ERBridgeConfig, ERCache, ERClient, EvolutionCollector, PushAdapter } from "../../../enterprise-bridge/dist/index.js";
|
|
3
|
-
|
|
4
|
-
//#region packages/server/src/tools/bridge.tools.d.ts
|
|
5
|
-
/** Resolve ER bridge config from server config + env */
|
|
6
|
-
declare function resolveErBridgeConfig(erConfig?: {
|
|
7
|
-
enabled: boolean;
|
|
8
|
-
baseUrl: string;
|
|
9
|
-
timeoutMs?: number;
|
|
10
|
-
cacheTtlMs?: number;
|
|
11
|
-
cacheMaxEntries?: number;
|
|
12
|
-
fallbackThreshold?: number;
|
|
13
|
-
}): ERBridgeConfig | undefined;
|
|
14
|
-
/** Shared bridge components (initialized once, reused across tools) */
|
|
15
|
-
interface BridgeComponents {
|
|
16
|
-
client: ERClient;
|
|
17
|
-
cache: ERCache;
|
|
18
|
-
pushAdapter: PushAdapter;
|
|
19
|
-
config: ERBridgeConfig;
|
|
20
|
-
}
|
|
21
|
-
/** Initialize bridge components from config. Returns undefined if ER disabled or init fails. */
|
|
22
|
-
declare function initBridgeComponents(erConfig?: {
|
|
23
|
-
enabled: boolean;
|
|
24
|
-
baseUrl: string;
|
|
25
|
-
timeoutMs?: number;
|
|
26
|
-
cacheTtlMs?: number;
|
|
27
|
-
cacheMaxEntries?: number;
|
|
28
|
-
fallbackThreshold?: number;
|
|
29
|
-
}): BridgeComponents | undefined;
|
|
30
|
-
declare function registerErPushTool(server: McpServer, bridge: BridgeComponents, evolutionCollector?: EvolutionCollector): void;
|
|
31
|
-
declare function registerErPullTool(server: McpServer, bridge: BridgeComponents): void;
|
|
32
|
-
declare function registerErSyncStatusTool(server: McpServer, bridge: BridgeComponents): void;
|
|
33
|
-
//#endregion
|
|
34
|
-
export { BridgeComponents, initBridgeComponents, registerErPullTool, registerErPushTool, registerErSyncStatusTool, resolveErBridgeConfig };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import{getToolMeta as e}from"../tool-metadata.js";import{z as t}from"zod";import{createLogger as n,serializeError as r}from"../../../core/dist/index.js";import{ERCache as i,ERClient as a,PushAdapter as o}from"../../../enterprise-bridge/dist/index.js";const s=n(`tools`);function c(e){if(!e?.enabled)return;let t=process.env.AIKIT_ER_API_KEY;if(!t){s.warn(`ER bridge enabled but AIKIT_ER_API_KEY not set; disabling`);return}return{enabled:!0,baseUrl:e.baseUrl,apiKey:t,timeoutMs:e.timeoutMs??5e3,cacheTtlMs:e.cacheTtlMs??360*60*1e3,cacheMaxEntries:e.cacheMaxEntries??100,fallbackThreshold:e.fallbackThreshold??.45}}function l(e){let t=c(e);if(t)try{let e=new a(t),n=new i({maxEntries:t.cacheMaxEntries,defaultTtl:t.cacheTtlMs}),r=new o(e);try{let e=new URL(t.baseUrl).hostname;s.info(`ER bridge initialized`,{host:e})}catch{s.info(`ER bridge initialized`)}return{client:e,cache:n,pushAdapter:r,config:t}}catch(e){s.warn(`ER bridge initialization failed`,r(e));return}}function u(n,i,a){let o=e(`er_push`);n.registerTool(`er_push`,{title:o.title,description:`Push a curated knowledge entry to Enterprise RAG. The entry is stored via ER's curated_remember tool and becomes immediately searchable in the enterprise AI Kit.`,inputSchema:{title:t.string().min(3).max(120).describe(`Title for the knowledge entry`),content:t.string().min(10).max(1e5).describe(`Markdown content to push (max 100KB)`),category:t.string().regex(/^[a-z][a-z0-9-]*$/).default(`conventions`).describe(`Category slug (e.g., "decisions", "patterns", "conventions")`),tags:t.array(t.string()).default([]).describe(`Optional tags`),rule_id:t.string().optional().describe(`ID of the classification rule that motivated this push (from remember classification signals). Improves rule effectiveness tracking.`)},annotations:o.annotations},async({title:e,content:t,category:n,tags:o,rule_id:c})=>{try{let r=`${n}/${e.toLowerCase().replace(/[^a-z0-9]+/g,`-`)}`,s=await i.pushAdapter.push(r,{title:e,content:t,category:n,tags:o});return s.pushed?(a&&a.recordPush(r,s.pushed,c),{content:[{type:`text`,text:`Pushed to ER: **${e}**\n\nRemote path: \`${s.remotePath??`unknown`}\`\nTimestamp: ${s.timestamp}\n\n---\n_Next: Use \`er_pull\` to verify the entry is searchable in ER, or \`er_sync_status\` to see push history._`}]}):(a&&a.recordPush(r,!1,c),{content:[{type:`text`,text:`ER push failed: ${s.error??`Unknown error`}\n\n_The local AI Kit is unaffected. You can retry or check ER health with \`er_sync_status\`._`}],isError:!0})}catch(t){if(s.error(`ER push failed`,r(t)),a){let t=`${n}/${e.toLowerCase().replace(/[^a-z0-9]+/g,`-`)}`;a.recordPush(t,!1,c)}return{content:[{type:`text`,text:`ER push failed: operation unsuccessful
|
|
2
|
-
|
|
3
|
-
_The local AI Kit is unaffected. You can retry or check ER health with \`er_sync_status\`._`}],isError:!0}}})}function d(n,i){let a=e(`er_pull`);n.registerTool(`er_pull`,{title:a.title,description:`Explicitly search the Enterprise RAG AI Kit. Returns results from the enterprise system only (not local AI Kit). Uses a cache with 6-hour TTL to reduce API calls.`,inputSchema:{query:t.string().min(1).max(2e3).describe(`Search query for Enterprise RAG AI Kit (max 2000 chars)`),max_results:t.number().min(1).max(20).default(5).describe(`Maximum results to return`),bypass_cache:t.boolean().default(!0).describe(`Skip cache and fetch fresh results from ER (default: true per DR-001)`)},annotations:a.annotations},async({query:e,max_results:t,bypass_cache:n})=>{try{if(!n){let n=i.cache.get(e);if(n)return{content:[{type:`text`,text:`${n.slice(0,t).map((e,t)=>`### Result ${t+1} (score: ${e.score.toFixed(3)}, source: ER cached)\n- **Source**: ${e.sourcePath}\n\n${e.content}`).join(`
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
`)}\n\n---\n_Source: ER cache (${n.length} cached results) | Use \`bypass_cache: true\` for fresh results_`}]}}let r=await i.client.pull(e,t);return r.length>0&&i.cache.set(e,r),r.length===0?{content:[{type:`text`,text:`No results found in Enterprise RAG for the given query.`}]}:{content:[{type:`text`,text:`${r.map((e,t)=>`### Result ${t+1} (score: ${e.score.toFixed(3)}, source: ER)\n- **Source**: ${e.sourcePath}\n\n${e.content}`).join(`
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
`)}\n\n---\n_Source: Enterprise RAG (${r.length} results) | Results cached for ${Math.floor(i.config.cacheTtlMs/36e5)}h_`}]}}catch(e){return s.error(`ER pull failed`,r(e)),{content:[{type:`text`,text:`ER pull failed: search request unsuccessful
|
|
12
|
-
|
|
13
|
-
_Enterprise RAG may be unavailable. Local AI Kit search is unaffected._`}],isError:!0}}})}function f(n,i){let a=e(`er_sync_status`);n.registerTool(`er_sync_status`,{title:a.title,description:`Show the status of the Enterprise RAG bridge: health, cache stats, and push history.`,inputSchema:{check_health:t.boolean().default(!0).describe(`Whether to ping ER health endpoint (adds latency)`)},annotations:a.annotations},async({check_health:e})=>{try{let t=i.cache.stats(),n=i.pushAdapter.getStatus(),r=new URL(i.config.baseUrl),a=`${r.protocol}//${r.hostname}${r.port?`:${r.port}`:``}`,o=`_Health check skipped_`;if(e){let e=await i.client.health();o=e.healthy?`✅ Healthy (HTTP ${e.status})`:`❌ Unhealthy${e.status?` (HTTP ${e.status})`:``}`}let s=[`## ER Bridge Status
|
|
14
|
-
`,`**Endpoint**: \`${a}\``,`**Health**: ${o}`,`**Threshold**: ${i.config.fallbackThreshold} (vector similarity for auto-fallback)`,``,`### Cache`,`- Entries: ${t.size} / ${t.maxEntries}`,`- TTL: ${Math.floor(t.defaultTtlMs/36e5)}h`,``,`### Push History`,`- Total pushed: ${n.totalPushed}`,`- Successful: ${n.successCount}`,`- Failed: ${n.failCount}`];return n.lastPush&&s.push(`- Last push: "${n.lastPush.title}" at ${n.lastPush.pushedAt} (${n.lastPush.status})`),s.push("\n---\n_Next: Use `er_push` to send knowledge to ER, or `er_pull` to search ER._"),{content:[{type:`text`,text:s.join(`
|
|
15
|
-
`)}]}}catch(e){return s.error(`ER sync status failed`,r(e)),{content:[{type:`text`,text:`ER sync status failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}export{l as initBridgeComponents,d as registerErPullTool,u as registerErPushTool,f as registerErSyncStatusTool,c as resolveErBridgeConfig};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { KBConfig } from "../../../core/dist/index.js";
|
|
3
|
-
|
|
4
|
-
//#region packages/server/src/tools/config.tool.d.ts
|
|
5
|
-
type KBServer = McpServer;
|
|
6
|
-
declare function registerConfigTool(server: KBServer, config: KBConfig): void;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { registerConfigTool };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{getToolMeta as e}from"../tool-metadata.js";import{buildDashboardHtml as t,buildFormHtml as n}from"./present/templates.js";import{existsSync as r,readFileSync as i,writeFileSync as a}from"node:fs";import{resolve as o}from"node:path";import{z as s}from"zod";import{createLogger as c}from"../../../core/dist/index.js";import{RESOURCE_MIME_TYPE as l,registerAppResource as u,registerAppTool as d}from"@modelcontextprotocol/ext-apps/server";const f=s.object({action:s.enum([`view`,`update`]).default(`view`).describe(`Action to perform: view current configuration or update it`),updates:s.record(s.string(),s.unknown()).optional().describe(`Partial configuration to merge when action is "update". Supports nested paths like { "indexing": { "chunkSize": 2000 } }`)}),p=c(`config-tool`),m=`ui://aikit/config.html`,h=[`serverName`,`toolPrefix`,`autoIndex`,`sources`,`indexing`];function g(){let e=process.env.AIKIT_CONFIG_PATH;if(e&&r(e))return e;let t=o(process.cwd(),`aikit.config.json`);return r(t)?t:``}function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function v(e,t){let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];if(_(t)&&_(r)){n[e]=v(t,r);continue}n[e]=r}return n}function y(e){return e===void 0?`undefined`:JSON.stringify(e)}function b(e,t,n,r=``){let i=[];for(let[a,o]of Object.entries(n)){let n=r?`${r}.${a}`:a,s=e[a],c=t[a];if(_(o)&&_(s)&&_(c)){i.push(...b(s,c,o,n));continue}y(s)!==y(c)&&i.push(`- ${n}: ${y(s)} -> ${y(c)}`)}return i}function x(e){let t=[];for(let[n,r]of Object.entries(e)){if(n===`store`||n===`embedding`||n===`er`){t.push(`Field "${n}" cannot be updated through this tool because it requires a restart.`);continue}if(n===`onboardDir`||n===`stateDir`||n===`curated`){t.push(`Field "${n}" cannot be updated through this tool because it requires a restart.`);continue}if(n===`autoIndex`){typeof r!=`boolean`&&t.push(`autoIndex must be a boolean.`);continue}if(n===`serverName`||n===`toolPrefix`){typeof r!=`string`&&t.push(`${n} must be a string.`);continue}if(n===`sources`){(!Array.isArray(r)||r.length===0)&&t.push(`sources must be a non-empty array.`);continue}if(n===`indexing`){if(!_(r)){t.push(`indexing must be an object.`);continue}for(let[e,n]of Object.entries(r)){if(e!==`chunkSize`&&e!==`chunkOverlap`&&e!==`minChunkSize`&&e!==`concurrency`){t.push(`indexing.${e} is not updatable through this tool.`);continue}(typeof n!=`number`||!Number.isFinite(n)||n<=0)&&t.push(`indexing.${e} must be a positive number.`)}continue}t.push(`Field "${n}" is not updatable through this tool.`)}return t}function S(e){let t=[];if(`autoIndex`in e&&typeof e.autoIndex!=`boolean`&&t.push(`autoIndex must be a boolean.`),`serverName`in e&&e.serverName!==void 0&&typeof e.serverName!=`string`&&t.push(`serverName must be a string.`),`toolPrefix`in e&&e.toolPrefix!==void 0&&typeof e.toolPrefix!=`string`&&t.push(`toolPrefix must be a string.`),(!Array.isArray(e.sources)||e.sources.length===0)&&t.push(`sources must be a non-empty array.`),!_(e.indexing))return t.push(`indexing must be an object.`),t;for(let n of[`chunkSize`,`chunkOverlap`,`minChunkSize`,`concurrency`]){let r=e.indexing[n];r!==void 0&&(typeof r!=`number`||!Number.isFinite(r)||r<=0)&&t.push(`indexing.${n} must be a positive number.`)}return t}function C(e){let t=JSON.parse(i(e,`utf-8`));if(!_(t))throw Error(`Config file must contain a JSON object.`);return t}function w(e,t){return[`AI Kit Configuration`,`Config file: ${t}`,``,JSON.stringify(e,null,2)].join(`
|
|
2
|
-
`)}function T(e){return e===void 0?``:_(e)||Array.isArray(e)?JSON.stringify(e,null,2):String(e)}function E(e){return t({metrics:Object.entries(e).map(([e,t])=>({label:e,value:_(t)||Array.isArray(t)?JSON.stringify(t,null,2):String(t),status:`info`}))})}function D(e){return n({fields:h.map(t=>{let n=e[t];return typeof n==`boolean`?{name:t,label:t,type:`select`,options:[`true`,`false`],value:String(n)}:{name:t,label:t,type:_(n)||Array.isArray(n)?`textarea`:`text`,value:T(n)}})})}function O(e,t){return`<!DOCTYPE html><html><head><meta charset="utf-8"><title>${e}</title><style>:root{--aikit-bg:#1e1e1e;--aikit-surface:#252526;--aikit-surface2:#2d2d30;--aikit-border:#3c3c3c;--aikit-text:#e5e7eb;--aikit-muted:#9ca3af;--aikit-accent:#60a5fa;--aikit-success:#22c55e;font-family:system-ui,sans-serif}body{margin:0;padding:20px;background:var(--aikit-bg);color:var(--aikit-text);font-family:system-ui,sans-serif}h2{margin:0 0 16px}</style></head><body><h2>${e}</h2>${t}</body></html>`}function k(e,t,n){u(e,`AI Kit Config App`,m,{description:`View and update AI Kit configuration`},async()=>({contents:[{uri:m,mimeType:l,text:O(t,n)}]}))}function A(t,n){let r=e(`config`);d(t,`config`,{title:r.title,description:`View and update AI Kit server configuration. Use action "view" to see current settings, or "update" to modify configuration values. Changes are written to aikit.config.json and take effect on next server restart. Some settings (store, embedding) require a full restart.`,inputSchema:f,annotations:r.annotations,_meta:{ui:{resourceUri:m}}},async e=>{let{action:r,updates:i}=e;if(r===`view`){let e=g(),r=e||`(runtime config only; no aikit.config.json found)`;try{let i=e?C(e):n,a=w(i,r);return k(t,`Configuration`,E(i)),{content:[{type:`text`,text:a}],ui:{type:`resource`,uri:m}}}catch(t){return p.error(`Failed to read config for view`,{configPath:e,error:t instanceof Error?t.message:String(t)}),{content:[{type:`text`,text:`Failed to read configuration from ${r}: ${t instanceof Error?t.message:String(t)}`}]}}}if(!i)return k(t,`Configuration Form`,D(n)),{content:[{type:`text`,text:`No updates provided. Pass an updates object when action is "update".`}],ui:{type:`resource`,uri:m}};let o=g();if(!o)return k(t,`Configuration Form`,D(n)),{content:[{type:`text`,text:`No config file found to update.`}],ui:{type:`resource`,uri:m}};let s=x(i);if(s.length>0)return k(t,`Configuration Form`,D(C(o))),{content:[{type:`text`,text:`Configuration update rejected:\n${s.map(e=>`- ${e}`).join(`
|
|
3
|
-
`)}`}],ui:{type:`resource`,uri:m}};try{let e=C(o),n=v(e,i),r=S(n);if(r.length>0)return k(t,`Configuration Form`,D(e)),{content:[{type:`text`,text:`Configuration update rejected:\n${r.map(e=>`- ${e}`).join(`
|
|
4
|
-
`)}`}],ui:{type:`resource`,uri:m}};a(o,JSON.stringify(n,null,2),`utf-8`);let s=b(e,n,i),c=`Configuration updated successfully.
|
|
5
|
-
|
|
6
|
-
Config file: ${o}
|
|
7
|
-
|
|
8
|
-
Changed values:
|
|
9
|
-
${s.length>0?s.join(`
|
|
10
|
-
`):`- No effective changes; requested values already matched the file.`}
|
|
11
|
-
|
|
12
|
-
These changes take effect on the next server restart.`;return k(t,`Configuration`,E(n)),{content:[{type:`text`,text:c}],ui:{type:`resource`,uri:m}}}catch(e){return p.error(`Failed to update config`,{configPath:o,error:e instanceof Error?e.message:String(e)}),{content:[{type:`text`,text:`Failed to update configuration in ${o}: ${e instanceof Error?e.message:String(e)}`}]}}})}export{A as registerConfigTool};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { FileCache } from "../../../tools/dist/index.js";
|
|
3
|
-
import { IGraphStore, IKnowledgeStore } from "../../../store/dist/index.js";
|
|
4
|
-
import { IEmbedder } from "../../../embeddings/dist/index.js";
|
|
5
|
-
|
|
6
|
-
//#region packages/server/src/tools/context.tools.d.ts
|
|
7
|
-
declare function registerCompactTool(server: McpServer, embedder: IEmbedder, cache: FileCache, rootPath: string): void;
|
|
8
|
-
declare function registerScopeMapTool(server: McpServer, embedder: IEmbedder, store: IKnowledgeStore): void;
|
|
9
|
-
declare function registerFindTool(server: McpServer, embedder: IEmbedder, store: IKnowledgeStore): void;
|
|
10
|
-
declare function registerSymbolTool(server: McpServer, embedder: IEmbedder, store: IKnowledgeStore, graphStore?: IGraphStore): void;
|
|
11
|
-
declare function registerFileSummaryTool(server: McpServer, cache: FileCache, rootPath: string): void;
|
|
12
|
-
declare function registerTraceTool(server: McpServer, embedder: IEmbedder, store: IKnowledgeStore, graphStore?: IGraphStore): void;
|
|
13
|
-
declare function registerDeadSymbolsTool(server: McpServer, embedder: IEmbedder, store: IKnowledgeStore): void;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { registerCompactTool, registerDeadSymbolsTool, registerFileSummaryTool, registerFindTool, registerScopeMapTool, registerSymbolTool, registerTraceTool };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{getToolMeta as e}from"../tool-metadata.js";import{CompactOutputSchema as t,DeadSymbolsOutputSchema as n,FileSummaryOutputSchema as r,FindOutputSchema as i,ScopeMapOutputSchema as a,SymbolOutputSchema as o}from"../output-schemas.js";import{fanOutSearch as s,openWorkspaceStores as c,resolveWorkspaces as l}from"../cross-workspace.js";import{isAbsolute as u,resolve as d}from"node:path";import{z as f}from"zod";import{stat as p}from"node:fs/promises";import{CONTENT_TYPES as m,computePartitionKey as h,createLogger as g,serializeError as _}from"../../../core/dist/index.js";import{StructureAnalyzer as v}from"../../../analyzers/dist/index.js";import{compact as y,fileSummary as b,find as x,findDeadSymbols as S,findExamples as C,scopeMap as w,symbol as T,trace as E,truncateToTokenBudget as D}from"../../../tools/dist/index.js";const O=g(`tools:context`);function k(n,r,i,a){let o=e(`compact`);n.registerTool(`compact`,{title:o.title,description:"Compress text to relevant sections using embedding similarity (no LLM). Provide either `text` or `path` (server reads the file — saves a round-trip). Segments by paragraph/sentence/line.",outputSchema:t,inputSchema:{text:f.string().optional().describe(`The text to compress (provide this OR path, not both)`),path:f.string().optional().describe(`File path to read server-side — avoids read_file round-trip + token doubling (provide this OR text)`),query:f.string().describe(`Focus query — what are you trying to understand?`),max_chars:f.number().min(100).max(5e4).default(3e3).describe(`Target output size in characters`),segmentation:f.enum([`paragraph`,`sentence`,`line`]).default(`paragraph`).describe(`How to split the text for scoring`),token_budget:f.number().min(50).max(12500).optional().describe(`Token budget — overrides max_chars (approx 4 chars per token). Use to fit output into a specific context window.`)},annotations:o.annotations},async({text:e,path:t,query:n,max_chars:o,segmentation:s,token_budget:c})=>{try{let l=t&&!u(t)?d(a,t):t;if(!e&&!l)return{content:[{type:`text`,text:`Error: Either "text" or "path" must be provided.`}],isError:!0};let f=await y(r,{text:e,path:l,query:n,maxChars:o,tokenBudget:c,segmentation:s,cache:i});return{content:[{type:`text`,text:[`Compressed ${f.originalChars} → ${f.compressedChars} chars (${(f.ratio*100).toFixed(0)}%)`,`Kept ${f.segmentsKept}/${f.segmentsTotal} segments`,``,f.text].join(`
|
|
2
|
-
`)}],structuredContent:{originalChars:f.originalChars,compressedChars:f.compressedChars,ratio:f.ratio,segmentsKept:f.segmentsKept,segmentsTotal:f.segmentsTotal}}}catch(e){return O.error(`Compact failed`,_(e)),{content:[{type:`text`,text:`Compact failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function A(t,n,r){let i=e(`scope_map`);t.registerTool(`scope_map`,{title:i.title,description:`Generate a task-scoped reading plan. Given a task description, identifies which files and sections are relevant, with estimated token counts and suggested reading order.`,outputSchema:a,inputSchema:{task:f.string().describe(`Description of the task to scope`),max_files:f.number().min(1).max(50).default(15).describe(`Maximum files to include`),content_type:f.enum(m).optional().describe(`Filter by content type`),max_tokens:f.number().min(100).max(5e4).optional().describe(`Maximum token budget for the response. When set, output is truncated to fit.`)},annotations:i.annotations},async({task:e,max_files:t,content_type:i,max_tokens:a})=>{try{let o=await w(n,r,{task:e,maxFiles:t,contentType:i}),s=[`## Scope Map: ${e}`,`Total estimated tokens: ~${o.totalEstimatedTokens}`,``,`### Files (by relevance)`,...o.files.map((e,t)=>`${t+1}. **${e.path}** (~${e.estimatedTokens} tokens, ${(e.relevance*100).toFixed(0)}% relevant)\n ${e.reason}\n Focus: ${e.focusRanges.map(e=>`L${e.start}-${e.end}`).join(`, `)}`),``,`### Suggested Reading Order`,...o.readingOrder.map((e,t)=>`${t+1}. ${e}`),``,`### Suggested Compact Calls`,`_Estimated compressed total: ~${Math.ceil(o.totalEstimatedTokens/5)} tokens_`,...o.compactCommands.map((e,t)=>`${t+1}. ${e}`)].join(`
|
|
3
|
-
`)+"\n\n---\n_Next: Use `search` to dive into specific files, or `compact` to compress file contents for context._";return{content:[{type:`text`,text:a?D(s,a):s}],structuredContent:{files:o.files.map(e=>({path:e.path,relevance:e.relevance,estimatedTokens:e.estimatedTokens,...e.focusRanges.length>0?{focusLines:e.focusRanges.map(e=>`L${e.start}-${e.end}`)}:{}})),totalFiles:o.files.length,totalEstimatedTokens:o.totalEstimatedTokens,task:e}}}catch(e){return O.error(`Scope map failed`,_(e)),{content:[{type:`text`,text:`Scope map failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function j(t,n,r){let a=e(`find`);t.registerTool(`find`,{title:a.title,description:`Multi-strategy search combining vector, FTS, glob, and regex. Use for precise queries needing multiple strategies. mode=examples finds real usage of a symbol. For general discovery use search instead.`,outputSchema:i,inputSchema:{query:f.string().optional().describe(`Semantic/keyword search query (required for mode "examples")`),glob:f.string().optional().describe(`File glob pattern (search mode only)`),pattern:f.string().optional().describe(`Regex pattern to match in content (search mode only)`),limit:f.number().min(1).max(50).default(10).describe(`Max results`),content_type:f.enum(m).optional().describe(`Filter by content type`),mode:f.enum([`search`,`examples`]).default(`search`).describe(`Mode: "search" (default) for federated search, "examples" to find usage examples of a symbol/pattern`),max_tokens:f.number().min(100).max(5e4).optional().describe(`Maximum token budget for the response. When set, output is truncated to fit.`),workspaces:f.array(f.string()).optional().describe(`Cross-workspace search: partition names or folder basenames to include. Use ["*"] for all. User-level mode only.`)},annotations:a.annotations},async({query:e,glob:t,pattern:i,limit:a,content_type:o,mode:u,max_tokens:d,workspaces:f})=>{try{if(u===`examples`){if(!e)return{content:[{type:`text`,text:`Error: "query" is required for mode "examples".`}],isError:!0};let t=await C(n,r,{query:e,limit:a,contentType:o}),i=JSON.stringify(t);return{content:[{type:`text`,text:d?D(i,d):i}]}}let p=await x(n,r,{query:e,glob:t,pattern:i,limit:a,contentType:o}),m=``;if(f&&f.length>0&&e){let t=l(f,h(process.cwd()));if(t.length>0){let{stores:r,closeAll:i}=await c(t);try{let i=await s(r,await n.embedQuery(e),{limit:a,contentType:o});for(let e of i)p.results.push({path:`[${e.workspace}] ${e.record.sourcePath}`,score:e.score,source:`cross-workspace`,lineRange:e.record.startLine?{start:e.record.startLine,end:e.record.endLine}:void 0,preview:e.record.content.slice(0,200)});p.results.sort((e,t)=>t.score-e.score),p.results=p.results.slice(0,a),p.totalFound=p.results.length,m=` + ${t.length} workspace(s)`}finally{await i()}}}if(p.results.length===0)return{content:[{type:`text`,text:`No results found.${p.failedStrategies?.length?`\nStrategies attempted: ${p.strategies.join(`, `)}\nFailed: ${p.failedStrategies.map(e=>`${e.strategy} (${e.reason})`).join(`, `)}`:p.strategies.length===0?`
|
|
4
|
-
No search strategies were activated. Provide at least one of: query, glob, or pattern.`:``}`}],structuredContent:{matches:[],totalMatches:0,pattern:e??t??i??``,truncated:!1}};let g=[`Found ${p.totalFound} results via ${p.strategies.join(` + `)}${m}`,``,...p.results.map(e=>{let t=e.lineRange?`:${e.lineRange.start}-${e.lineRange.end}`:``,n=e.preview?`\n ${e.preview.slice(0,100)}...`:``;return`- [${e.source}] ${e.path}${t} (${(e.score*100).toFixed(0)}%)${n}`})];return{content:[{type:`text`,text:d?D(g.join(`
|
|
5
|
-
`),d):g.join(`
|
|
6
|
-
`)}],structuredContent:{matches:p.results.map(e=>({path:e.path,...e.lineRange?{line:e.lineRange.start}:{},matchType:e.source,preview:e.preview?.slice(0,200)??``})),totalMatches:p.totalFound,pattern:e??t??i??``,truncated:p.results.length<p.totalFound}}}catch(e){return O.error(`Find failed`,_(e)),{content:[{type:`text`,text:`Find failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function M(t,n,r,i){let a=e(`symbol`);t.registerTool(`symbol`,{title:a.title,description:`Find definition, imports, and references of a named symbol (function, class, type). For tracing data flow across call sites use trace instead.`,inputSchema:{name:f.string().describe(`Symbol name to look up (function, class, type, etc.)`),limit:f.number().min(1).max(50).default(20).describe(`Max results per category`),workspaces:f.array(f.string()).optional().describe(`Cross-workspace search: partition names or folder basenames to include. Use ["*"] for all. User-level mode only.`)},outputSchema:o,annotations:a.annotations},async({name:e,limit:t,workspaces:a})=>{try{let o=await T(n,r,{name:e,limit:t,graphStore:i});if(a&&a.length>0){let r=l(a,h(process.cwd()));if(r.length>0){let{stores:i,closeAll:a}=await c(r);try{for(let[r,a]of i){let i=await T(n,a,{name:e,limit:t});i.definedIn&&!o.definedIn&&(o.definedIn={...i.definedIn,path:`[${r}] ${i.definedIn.path}`});for(let e of i.referencedIn)o.referencedIn.push({...e,path:`[${r}] ${e.path}`});if(i.importedBy){o.importedBy=o.importedBy??[];for(let e of i.importedBy)o.importedBy.push({...e,path:`[${r}] ${e.path}`})}}}finally{await a()}}}let s={name:o.name,definedIn:o.definedIn??null,importedBy:o.importedBy??[],referencedIn:o.referencedIn??[],graphContext:o.graphContext??null};return{content:[{type:`text`,text:I(o)}],structuredContent:s}}catch(e){return O.error(`Symbol lookup failed`,_(e)),{content:[{type:`text`,text:`Symbol lookup failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function N(t,n,i){let a=new v,o=e(`file_summary`);t.registerTool(`file_summary`,{title:o.title,description:`Create a concise structural summary of a source file: imports, exports, functions, classes, interfaces, and types.`,outputSchema:r,inputSchema:{path:f.string().describe(`Absolute path to the file to summarize`),max_tokens:f.number().min(100).max(5e4).optional().describe(`Maximum token budget for the response.`)},annotations:o.annotations},async({path:e,max_tokens:t})=>{try{let r=u(e)?e:d(i,e);if((await p(r)).isDirectory()){let n=await a.analyze(r,{format:`markdown`,maxDepth:3,maxTokens:t}),i=n.data.stats?.languages??{},o=Object.entries(i).sort((e,t)=>t[1]-e[1])[0]?.[0],s=`📁 **Directory**: \`${e}\`\n\n${n.output}\n\n---\n_Path is a directory. Showing structure analysis. Use \`analyze_structure\` for deeper analysis with custom depth._`;return{content:[{type:`text`,text:t?D(s,t):s}],structuredContent:{path:r,language:o??`directory`,lines:0,imports:0,exports:0,functions:0,classes:0}}}let o=await b({path:r,content:(await n.get(r)).content});return{content:[{type:`text`,text:L(o)}],structuredContent:{path:o.path,language:o.language,lines:o.lines,imports:o.imports?.length??0,exports:o.exports?.length??0,functions:o.functions?.length??0,classes:o.classes?.length??0}}}catch(e){return O.error(`File summary failed`,_(e)),{content:[{type:`text`,text:`File summary failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function P(t,n,r,i){let a=e(`trace`);t.registerTool(`trace`,{title:a.title,description:`Follow data flow forward/backward across imports and call sites from a starting symbol or file:line. For finding a single symbol definition use symbol instead.`,inputSchema:{start:f.string().describe(`Starting point — symbol name or file:line reference`),direction:f.enum([`forward`,`backward`,`both`]).describe(`Which direction to trace relationships`),max_depth:f.number().min(1).max(10).default(3).optional().describe(`Maximum trace depth`)},annotations:a.annotations},async({start:e,direction:t,max_depth:a})=>{try{let o=await E(n,r,{start:e,direction:t,maxDepth:a,graphStore:i}),s=[`## Trace: ${o.start}`,`Direction: ${o.direction} | Depth: ${o.depth}`,``];if(o.graphContext&&(s.push(`### Graph Context`),o.graphContext.definingModule&&s.push(`- Module: ${o.graphContext.definingModule}`),o.graphContext.community&&s.push(`- Community: ${o.graphContext.community}`),o.graphContext.importedByModules.length>0&&s.push(`- Imported by modules: ${o.graphContext.importedByModules.join(`, `)}`),o.graphContext.siblingSymbols.length>0&&s.push(`- Sibling symbols: ${o.graphContext.siblingSymbols.join(`, `)}`),s.push(``)),o.nodes.length===0)s.push(`No connections found.`);else{let e=o.nodes.filter(e=>e.relationship===`calls`),t=o.nodes.filter(e=>e.relationship===`called-by`),n=o.nodes.filter(e=>e.relationship===`imports`),r=o.nodes.filter(e=>e.relationship===`imported-by`),i=o.nodes.filter(e=>e.relationship===`references`);if(e.length>0){s.push(`### Calls (${e.length})`);for(let t of e){let e=t.scope?` (from ${t.scope}())`:``;s.push(`- ${t.symbol}() — ${t.path}:${t.line}${e}`)}s.push(``)}if(t.length>0){s.push(`### Called by (${t.length})`);for(let e of t){let t=e.scope?` in ${e.scope}()`:``;s.push(`- ${e.symbol}()${t} — ${e.path}:${e.line}`)}s.push(``)}if(n.length>0){s.push(`### Imports (${n.length})`);for(let e of n)s.push(`- ${e.symbol} — ${e.path}:${e.line}`);s.push(``)}if(r.length>0){s.push(`### Imported by (${r.length})`);for(let e of r)s.push(`- ${e.path}:${e.line}`);s.push(``)}if(i.length>0){s.push(`### References (${i.length})`);for(let e of i)s.push(`- ${e.path}:${e.line}`);s.push(``)}}return s.push(`---`,"_Next: `symbol` for definition details | `compact` to read a referenced file | `blast_radius` for impact analysis_"),{content:[{type:`text`,text:s.join(`
|
|
7
|
-
`)}],structuredContent:{start:o.start,direction:o.direction,depth:o.depth,nodes:o.nodes,graphContext:o.graphContext??null}}}catch(e){return O.error(`Trace failed`,_(e)),{content:[{type:`text`,text:`Trace failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function F(t,r,i){let a=e(`dead_symbols`);t.registerTool(`dead_symbols`,{title:a.title,description:`Find exported symbols that appear to be unused because they are never imported or re-exported.`,outputSchema:n,inputSchema:{path:f.string().optional().describe(`Root path to scope the search (default: cwd)`),limit:f.number().min(1).max(500).default(100).optional().describe(`Maximum exported symbols to scan`)},annotations:a.annotations},async({path:e,limit:t})=>{try{let n=await S(r,i,{rootPath:e,limit:t}),a=[`## Dead Symbol Analysis`,``,`**Exports scanned:** ${n.totalExports}`,`**Dead in source:** ${n.totalDeadSource} (actionable)`,`**Dead in docs:** ${n.totalDeadDocs} (informational — code samples in .md files)`,``];if(n.deadInSource.length>0){a.push(`### Dead in Source (actionable)`);for(let e of n.deadInSource)a.push(`- \`${e.name}\` (${e.kind}) — ${e.path}:${e.line}`);a.push(``)}if(n.deadInDocs.length>0){a.push(`### Dead in Docs (informational)`),a.push(`_${n.totalDeadDocs} symbol(s) found only in documentation code samples — not actionable dead code._`);for(let e of n.deadInDocs.slice(0,5))a.push(`- \`${e.name}\` — ${e.path}:${e.line}`);n.deadInDocs.length>5&&a.push(`- _... ${n.deadInDocs.length-5} more omitted_`)}return n.totalDeadSource>0?a.push(``,`---`,`_Next: \`codemod\` to remove ${n.totalDeadSource} unused exports | \`symbol\` to verify usage before removing_`):a.push(``,`---`,"_Next: `check` — no dead symbols found, validate types and lint_"),{content:[{type:`text`,text:a.join(`
|
|
8
|
-
`)}],structuredContent:{symbols:[...n.deadInSource,...n.deadInDocs].map(e=>({name:e.name,path:e.path,...e.line===void 0?{}:{line:e.line},kind:e.kind})),totalDead:n.totalDeadSource+n.totalDeadDocs}}}catch(e){return O.error(`Dead symbol scan failed`,_(e)),{content:[{type:`text`,text:`Dead symbol scan failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function I(e){let t=[`Symbol: ${e.name}`];if(e.definedIn){let n=`Defined in: ${e.definedIn.path}:${e.definedIn.line} (${e.definedIn.kind})`;e.definedIn.signature&&(n+=`\nSignature: ${e.definedIn.signature}`),t.push(n)}else t.push(`Defined in: not found`);if(t.push(``,`Imported by:`),e.importedBy.length===0)t.push(` none`);else for(let n of e.importedBy)t.push(` - ${n.path}:${n.line} ${n.importStatement}`);if(t.push(``,`Referenced in:`),e.referencedIn.length===0)t.push(` none`);else for(let n of e.referencedIn){let e=`scope`in n&&n.scope?` in ${n.scope}()`:``;t.push(` - ${n.path}:${n.line}${e} ${n.context}`)}if(e.graphContext){let n=e.graphContext;t.push(``,`Graph context:`),n.definingModule&&t.push(` Module: ${n.definingModule}`),n.importedByModules.length>0&&t.push(` Imported by modules: ${n.importedByModules.join(`, `)}`),n.siblingSymbols.length>0&&t.push(` Sibling symbols: ${n.siblingSymbols.join(`, `)}`)}return t.join(`
|
|
9
|
-
`)}function L(e){let t=[e.path,`Language: ${e.language}`,`Lines: ${e.lines}`,`Estimated tokens: ~${e.estimatedTokens}`,``,`Imports (${e.imports.length}):`,...R(e.imports),``,`Exports (${e.exports.length}):`,...R(e.exports),``,`Functions (${e.functions.length}):`,...R(e.functions.map(e=>`${e.name} @ line ${e.line}${e.exported?` [exported]`:``}${`signature`in e&&e.signature?` — ${e.signature}`:``}`)),``,`Classes (${e.classes.length}):`,...R(e.classes.map(e=>`${e.name} @ line ${e.line}${e.exported?` [exported]`:``}${e.signature?` — ${e.signature}`:``}`)),``,`Interfaces (${e.interfaces.length}):`,...R(e.interfaces.map(e=>`${e.name} @ line ${e.line}${`exported`in e&&e.exported?` [exported]`:``}`)),``,`Types (${e.types.length}):`,...R(e.types.map(e=>`${e.name} @ line ${e.line}${`exported`in e&&e.exported?` [exported]`:``}`))];if(`importDetails`in e&&e.importDetails&&e.importDetails.length>0){let n=e.importDetails.filter(e=>e.isExternal).length,r=e.importDetails.length-n;t.push(``,`Import breakdown: ${n} external, ${r} internal`)}if(`callEdges`in e&&e.callEdges&&e.callEdges.length>0){t.push(``,`Call edges (${e.callEdges.length} intra-file):`);for(let n of e.callEdges.slice(0,30))t.push(` - ${n.caller}() → ${n.callee}() @ line ${n.line}`);e.callEdges.length>30&&t.push(` - ... ${e.callEdges.length-30} more`)}return t.join(`
|
|
10
|
-
`)}function R(e){return e.length===0?[` none`]:e.map(e=>` - ${e}`)}export{k as registerCompactTool,F as registerDeadSymbolsTool,N as registerFileSummaryTool,j as registerFindTool,A as registerScopeMapTool,M as registerSymbolTool,P as registerTraceTool};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { EvolutionCollector } from "../../../enterprise-bridge/dist/index.js";
|
|
3
|
-
|
|
4
|
-
//#region packages/server/src/tools/evolution.tools.d.ts
|
|
5
|
-
declare function registerErEvolveReviewTool(server: McpServer, collector: EvolutionCollector): void;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { registerErEvolveReviewTool };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{getToolMeta as e}from"../tool-metadata.js";import{z as t}from"zod";import{createLogger as n,serializeError as r}from"../../../core/dist/index.js";const i=n(`tools`);function a(n,a){let o=e(`er_evolve_review`);n.registerTool(`er_evolve_review`,{title:o.title,description:`Review evolution metrics for the AI Kit ↔ ER bridge. Shows local miss rates, push acceptance, rule effectiveness, and top missed queries. Use this to reason about improving classification rules and knowledge flow.`,inputSchema:{include_details:t.boolean().default(!0).describe(`Include detailed breakdowns (top missed queries, rule stats)`),reset_after:t.boolean().default(!1).describe(`Reset collected metrics after review`)},annotations:o.annotations},async({include_details:e,reset_after:t})=>{try{let n=a.getMetrics(),r=[`## ER Evolution Review
|
|
2
|
-
`,`**Period**: ${n.period.startedAt} → ${n.period.queriedAt}`,`**Total events**: ${n.period.totalEvents}\n`,`### Search`,`- Total searches: ${n.search.totalSearches}`,`- ER fallback triggered: ${n.search.erFallbackCount} (${(n.search.erFallbackRate*100).toFixed(1)}%)`,`- ER cache hits: ${n.search.erCacheHitCount} (${(n.search.erCacheHitRate*100).toFixed(1)}% of fallbacks)`];if(e&&n.search.topMissedQueries.length>0){r.push(`
|
|
3
|
-
**Top missed queries** (triggered ER fallback):`);for(let e of n.search.topMissedQueries.slice(0,10)){let t=e.query.length>60?`${e.query.slice(0,57)}...`:e.query;r.push(` - "${t}" (${e.count}x)`)}}if(r.push(``,`### Push`,`- Total pushes: ${n.push.totalPushes} (${n.push.successCount} ok, ${n.push.failCount} failed)`,`- Classification match rate: ${(n.push.classificationMatchRate*100).toFixed(1)}%`,`- Push acceptance rate: ${(n.push.pushAcceptanceRate*100).toFixed(1)}%`),r.push(``,`### Rule Effectiveness`),Object.keys(n.rules.matchCounts).length>0)for(let[e,t]of Object.entries(n.rules.matchCounts)){let i=n.rules.pushCounts[e]??0,a=t>0?(i/t*100).toFixed(0):`0`;r.push(`- **${e}**: ${t} matches → ${i} pushes (${a}% conversion)`)}else r.push(`- _No rule activity recorded yet_`);if(e&&n.rules.lowConversionRules.length>0){r.push(``,`### ⚠️ Low Conversion Rules (potential false positives)`);for(let e of n.rules.lowConversionRules)r.push(`- **${e.ruleId}**: ${e.matchCount} matches, ${e.pushCount} pushes (${(e.conversionRate*100).toFixed(0)}% conversion) — consider tightening patterns`)}return r.push(``,`---`,"_Next: Use `er_update_policy` to refine rules based on these metrics, or `er_push` to share high-value knowledge._"),t&&(i.info(`Evolution metrics reset requested`,{requestedAt:new Date().toISOString(),clearedEvents:n.period.totalEvents}),a.reset(),r.push(`
|
|
4
|
-
_Metrics have been reset._`)),{content:[{type:`text`,text:r.join(`
|
|
5
|
-
`)}]}}catch(e){return i.error(`Evolution review failed`,r(e)),{content:[{type:`text`,text:`Evolution review failed: unable to compute metrics`}],isError:!0}}})}export{a as registerErEvolveReviewTool};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ISamplingClient } from "../sampling.js";
|
|
2
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
-
import { IKnowledgeStore } from "../../../store/dist/index.js";
|
|
4
|
-
import { IEmbedder } from "../../../embeddings/dist/index.js";
|
|
5
|
-
|
|
6
|
-
//#region packages/server/src/tools/execution.tools.d.ts
|
|
7
|
-
declare function registerCheckTool(server: McpServer): void;
|
|
8
|
-
declare function registerBatchTool(server: McpServer, embedder: IEmbedder, store: IKnowledgeStore): void;
|
|
9
|
-
declare function registerEvalTool(server: McpServer): void;
|
|
10
|
-
declare function registerTestRunTool(server: McpServer): void;
|
|
11
|
-
declare function registerParseOutputTool(server: McpServer): void;
|
|
12
|
-
declare function registerDelegateTool(server: McpServer, samplingClient?: ISamplingClient): void;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { registerBatchTool, registerCheckTool, registerDelegateTool, registerEvalTool, registerParseOutputTool, registerTestRunTool };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{getToolMeta as e}from"../tool-metadata.js";import{CheckOutputSchema as t}from"../output-schemas.js";import{createTaskRunner as n}from"../task-manager.js";import{z as r}from"zod";import{CONTENT_TYPES as i,createLogger as a,serializeError as o}from"../../../core/dist/index.js";import{batch as s,check as c,delegate as l,delegateListModels as u,evaluate as d,find as f,parseOutput as p,summarizeCheckResult as m,testRun as h}from"../../../tools/dist/index.js";const g=a(`tools:execution`);function _(i){let a=e(`check`);i.registerTool(`check`,{title:a.title,description:`Run incremental typecheck (tsc) and lint (biome) on the project or specific files. Returns structured error and warning lists. Default detail level is "summary" (~300 tokens).`,inputSchema:{files:r.array(r.string()).optional().describe(`Specific files to check (if omitted, checks all)`),cwd:r.string().optional().describe(`Working directory`),skip_types:r.boolean().default(!1).describe(`Skip TypeScript typecheck`),skip_lint:r.boolean().default(!1).describe(`Skip Biome lint`),detail:r.enum([`summary`,`errors`,`full`]).default(`summary`).describe(`Output detail level: summary (default, ~300 tokens — pass/fail + counts + top errors), errors (parsed error objects), full (includes raw terminal output)`)},outputSchema:t,annotations:a.annotations},async({files:e,cwd:t,skip_types:r,skip_lint:i,detail:a},s)=>{try{let o=await c({files:e,cwd:t,skipTypes:r,skipLint:i,detail:a===`summary`?`errors`:a}),l=n(s).createTask(`Check`,2);if(l.progress(0,`tsc: ${o.tsc.errors.length} errors`),l.progress(1,`biome: ${o.biome.errors.length} errors`),l.complete(`Check ${o.passed?`passed`:`failed`}`),a===`summary`){let e=m(o),t=[];if(o.passed)t.push({tool:`test_run`,reason:`Types and lint clean — run tests next`});else{let e=o.tsc.errors[0]?.file??o.biome.errors[0]?.file;e&&t.push({tool:`symbol`,reason:`Resolve failing symbol in ${e}`,suggested_args:{name:e}}),t.push({tool:`check`,reason:`Re-check after fixing errors`,suggested_args:{detail:`errors`}})}let n=[`## Check ${e.passed?`✅ PASS`:`❌ FAIL`}`,``,`**tsc**: ${e.tsc.passed?`✅`:`❌`} ${e.tsc.errorCount} errors, ${e.tsc.warningCount} warnings`];if(e.tsc.topErrors.length>0)for(let t of e.tsc.topErrors)n.push(` - ${t}`);if(n.push(`**biome**: ${e.biome.passed?`✅`:`❌`} ${e.biome.errorCount} errors, ${e.biome.warningCount} warnings`),e.biome.topErrors.length>0)for(let t of e.biome.topErrors)n.push(` - ${t}`);if(t.length>0){n.push(``,`**Next steps:**`);for(let e of t)n.push(`- \`${e.tool}\`: ${e.reason}`)}return{content:[{type:`text`,text:n.join(`
|
|
2
|
-
`)}],structuredContent:{...e}}}return{content:[{type:`text`,text:JSON.stringify(o)}]}}catch(e){return g.error(`Check failed`,o(e)),{content:[{type:`text`,text:`Check failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function v(t,i,a){let c=e(`batch`);t.registerTool(`batch`,{title:c.title,description:`Execute multiple built-in operations in parallel with concurrency control. Supported operation types: search, find, and check.`,inputSchema:{operations:r.array(r.object({id:r.string().describe(`Unique ID for this operation`),type:r.enum([`search`,`find`,`check`]).describe(`Built-in operation type`),args:r.record(r.string(),r.unknown()).describe(`Arguments for the operation`)})).min(1).max(100).describe(`Operations to execute`),concurrency:r.number().min(1).max(20).default(4).describe(`Max concurrent operations`)},annotations:c.annotations},async({operations:e,concurrency:t},r)=>{try{let o=await s(e,async e=>E(e,i,a),{concurrency:t}),c=n(r).createTask(`Batch`,e.length);for(let e=0;e<o.length;e++)c.progress(e,`${o[e].id}: ${o[e].status}`);return c.complete(`Batch complete: ${o.length} operations`),{content:[{type:`text`,text:JSON.stringify(o)}]}}catch(e){return g.error(`Batch failed`,o(e)),{content:[{type:`text`,text:`Batch failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function y(t){let n=e(`eval`);t.registerTool(`eval`,{title:n.title,description:`Execute a JavaScript or TypeScript snippet in a constrained VM sandbox with a timeout. Captures console output and returned values.`,inputSchema:{code:r.string().max(1e5).describe(`Code snippet to execute`),lang:r.enum([`js`,`ts`]).default(`js`).optional().describe(`Language mode: js executes directly, ts strips common type syntax first`),timeout:r.number().min(1).max(6e4).default(5e3).optional().describe(`Execution timeout in milliseconds`)},annotations:n.annotations},async({code:e,lang:t,timeout:n})=>{try{let r=d({code:e,lang:t,timeout:n});return r.success?{content:[{type:`text`,text:`Eval succeeded in ${r.durationMs}ms\n\n${r.output}`}]}:{content:[{type:`text`,text:`Eval failed in ${r.durationMs}ms: ${r.error??`Unknown error`}`}],isError:!0}}catch(e){return g.error(`Eval failed`,o(e)),{content:[{type:`text`,text:`Eval failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function b(t){let i=e(`test_run`);t.registerTool(`test_run`,{title:i.title,description:`Run Vitest for the current project or a subset of files, then return a structured summary of passing and failing tests.`,inputSchema:{files:r.array(r.string()).optional().describe(`Specific test files or patterns to run`),grep:r.string().optional().describe(`Only run tests whose names match this pattern`),cwd:r.string().optional().describe(`Working directory for the test run`)},annotations:i.annotations},async({files:e,grep:t,cwd:r},i)=>{try{let a=await h({files:e,grep:t,cwd:r}),o=n(i).createTask(`Test Run`,1),s=a.summary.passed+a.summary.failed+a.summary.skipped;return o.complete(`Tests: ${a.passed?`passed`:`failed`} (${s} tests)`),{content:[{type:`text`,text:k(a)}],isError:!a.passed}}catch(e){return g.error(`Test run failed`,o(e)),{content:[{type:`text`,text:`Test run failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function x(t){let n=e(`parse_output`);t.registerTool(`parse_output`,{title:n.title,description:`Parse structured data from build tool output. Supports tsc, vitest, biome, and git status. Auto-detects the tool or specify explicitly.`,inputSchema:{output:r.string().max(5e5).describe(`Raw output text from a build tool`),tool:r.enum([`tsc`,`vitest`,`biome`,`git-status`]).optional().describe(`Tool to parse as (auto-detects if omitted)`)},annotations:n.annotations},async({output:e,tool:t})=>{try{let n=p(e.replace(/\\n/g,`
|
|
3
|
-
`).replace(/\\t/g,` `),t);return{content:[{type:`text`,text:JSON.stringify(n)}]}}catch(e){return g.error(`Parse failed`,o(e)),{content:[{type:`text`,text:`Parse failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}function S(t,n){let i=e(`delegate`);t.registerTool(`delegate`,{title:i.title,description:`Delegate a subtask to a local Ollama model. Use for summarization, classification, naming, or any task that can offload work from the host agent. Fails fast if Ollama is not running.`,inputSchema:{prompt:r.string().max(2e5).describe(`The task or question to send to the local model`),model:r.string().optional().describe(`Ollama model name (default: first available model)`),system:r.string().optional().describe(`System prompt for the model`),context:r.string().max(5e5).optional().describe(`Context text to include before the prompt (e.g. file contents)`),temperature:r.number().min(0).max(2).default(.3).optional().describe(`Sampling temperature (0=deterministic, default 0.3)`),timeout:r.number().min(1e3).max(6e5).default(12e4).optional().describe(`Timeout in milliseconds (default 120000)`),action:r.enum([`generate`,`list_models`]).default(`generate`).optional().describe(`Action: generate a response or list available models`)},annotations:i.annotations},async({prompt:e,model:t,system:r,context:i,temperature:a,timeout:s,action:c})=>{try{if(c===`list_models`){let e=await u();return{content:[{type:`text`,text:JSON.stringify({models:e,count:e.length,_Next:`Use delegate with a model name`},null,2)}]}}if(n?.available)try{let t=await n.createMessage({prompt:e,systemPrompt:r,context:i,maxTokens:4e3,modelPreferences:{intelligencePriority:.8,speedPriority:.5,costPriority:.3}});return{content:[{type:`text`,text:JSON.stringify({model:t.model??`sampling`,response:t.text,provider:`mcp-sampling`,_Next:`Use the response in your workflow. stash to save it.`},null,2)}]}}catch{g.debug(`Sampling failed, falling back to Ollama`)}let o=await l({prompt:e,model:t,system:r,context:i,temperature:a,timeout:s});return o.error?{content:[{type:`text`,text:JSON.stringify({error:o.error,model:o.model,durationMs:o.durationMs},null,2)}],isError:!0}:{content:[{type:`text`,text:JSON.stringify({model:o.model,response:o.response,durationMs:o.durationMs,tokenCount:o.tokenCount,_Next:`Use the response in your workflow. stash to save it.`},null,2)}]}}catch(e){return g.error(`Delegate failed`,o(e)),{content:[{type:`text`,text:`Delegate failed: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})}const C=r.object({query:r.string(),limit:r.number().min(1).max(20).default(5).optional(),search_mode:r.enum([`hybrid`,`semantic`,`keyword`]).default(`hybrid`).optional(),content_type:r.enum(i).optional(),origin:r.enum([`indexed`,`curated`,`produced`]).optional(),category:r.string().optional(),tags:r.array(r.string()).optional(),min_score:r.number().min(0).max(1).default(.25).optional()}),w=r.object({query:r.string().optional(),glob:r.string().optional(),pattern:r.string().optional(),limit:r.number().min(1).max(50).default(10).optional(),content_type:r.enum(i).optional(),cwd:r.string().optional()}),T=r.object({files:r.array(r.string()).optional(),cwd:r.string().optional(),skip_types:r.boolean().optional(),skip_lint:r.boolean().optional()});async function E(e,t,n){switch(e.type){case`search`:return D(t,n,C.parse(e.args));case`find`:{let r=w.parse(e.args);if(!r.query&&!r.glob&&!r.pattern)throw Error(`find operation requires query, glob, or pattern`);return f(t,n,{query:r.query,glob:r.glob,pattern:r.pattern,limit:r.limit,contentType:r.content_type,cwd:r.cwd})}case`check`:{let t=T.parse(e.args);return c({files:t.files,cwd:t.cwd,skipTypes:t.skip_types,skipLint:t.skip_lint})}default:throw Error(`Unsupported batch operation type: ${e.type}`)}}async function D(e,t,n){let r=n.limit??5,i={limit:r,minScore:n.min_score??.25,contentType:n.content_type,origin:n.origin,category:n.category,tags:n.tags},a=e.embedQuery?.bind(e)??e.embed.bind(e);if(n.search_mode===`keyword`)return(await t.ftsSearch(n.query,i)).slice(0,r);let o=await a(n.query);if(n.search_mode===`semantic`)return t.search(o,i);let[s,c]=await Promise.all([t.search(o,{...i,limit:r*2}),t.ftsSearch(n.query,{...i,limit:r*2})]);return O(s,c).slice(0,r)}function O(e,t,n=60){let r=new Map;for(let t=0;t<e.length;t++){let i=e[t];r.set(i.record.id,{record:i.record,score:1/(n+t+1)})}for(let e=0;e<t.length;e++){let i=t[e],a=r.get(i.record.id);if(a){a.score+=1/(n+e+1);continue}r.set(i.record.id,{record:i.record,score:1/(n+e+1)})}return[...r.values()].sort((e,t)=>t.score-e.score)}function k(e){let t=[`Vitest run: ${e.passed?`passed`:`failed`}`,`Duration: ${e.durationMs}ms`,`Passed: ${e.summary.passed}`,`Failed: ${e.summary.failed}`,`Skipped: ${e.summary.skipped}`];e.summary.suites!==void 0&&t.push(`Suites: ${e.summary.suites}`);let n=e.summary.tests.filter(e=>e.status===`fail`);if(n.length>0){t.push(``,`Failed tests:`);for(let e of n)t.push(`- ${e.name}${e.file?` (${e.file})`:``}`),e.error&&t.push(` ${e.error}`)}return t.join(`
|
|
4
|
-
`)}export{v as registerBatchTool,_ as registerCheckTool,S as registerDelegateTool,y as registerEvalTool,x as registerParseOutputTool,b as registerTestRunTool};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { KBConfig } from "../../../core/dist/index.js";
|
|
3
|
-
|
|
4
|
-
//#region packages/server/src/tools/flow.tools.d.ts
|
|
5
|
-
declare function registerFlowTools(server: McpServer, config: KBConfig): void;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { registerFlowTools };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{createSamplingClient as e}from"../sampling.js";import{getToolMeta as t}from"../tool-metadata.js";import{existsSync as n,readFileSync as r,readdirSync as i,renameSync as a,rmSync as o}from"node:fs";import{basename as s,join as c,resolve as l}from"node:path";import{homedir as u}from"node:os";import{z as d}from"zod";import{readFile as f}from"node:fs/promises";import{createLogger as p,getGlobalDataDir as m,serializeError as h}from"../../../core/dist/index.js";import{execSync as g}from"node:child_process";const _=p(`flow-tools`);function v(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0):[]}function y(t){let n=e(t);return async({content:e,sourceFormat:t,stepName:r,metadata:i})=>{let a=r.charAt(0).toUpperCase()+r.slice(1),o=i?JSON.stringify(i,null,2):void 0,s=`You are converting a flow step definition from "${t}" format to aikit native flow step README.md format.
|
|
2
|
-
|
|
3
|
-
Convert the provided content into a well-structured README.md for a flow step named "${r}".
|
|
4
|
-
|
|
5
|
-
The output must:
|
|
6
|
-
1. Start with a heading: # ${a}
|
|
7
|
-
2. Have a "## Purpose" section explaining what this step does
|
|
8
|
-
3. Have a "## Instructions" section with ALL technical instructions preserved from the source
|
|
9
|
-
4. Have a "## Artifacts" section listing what this step produces
|
|
10
|
-
5. Have a "## Prerequisites" section if there are dependencies on previous steps
|
|
11
|
-
6. Preserve ALL tool restrictions, constraints, and requirements from the source
|
|
12
|
-
7. Be formatted as clean Markdown
|
|
13
|
-
|
|
14
|
-
Output ONLY the README.md content, nothing else.`;if(n.available)try{let i=(await n.createMessage({prompt:e,systemPrompt:s,context:o?`Step name: ${r}\nSource format: ${t}\nMetadata:\n${o}`:`Step name: ${r}\nSource format: ${t}`,maxTokens:4096,modelPreferences:{intelligencePriority:.8,speedPriority:.4,costPriority:.2}})).text.trim();if(i.length>0)return i}catch(e){_.debug(`Flow transform sampling failed; using fallback formatting`,{error:x(e),sourceFormat:t,stepName:r})}let c=typeof i?.description==`string`&&i.description.trim().length>0?i.description.trim():null,l=v(i?.produces),u=v(i?.requires);return[`# ${a}`,``,`## Purpose`,``,c??`${a} step.`,``,`## Instructions`,``,e.trim(),``,`## Artifacts`,``,...l.length>0?l.map(e=>`- ${e}`):[`- ${r}.md`],...u.length>0?[``,`## Prerequisites`,``,...u.map(e=>`- ${e}`)]:[],``].join(`
|
|
15
|
-
`).trimEnd().concat(`
|
|
16
|
-
`)}}function b(e){return{content:[{type:`text`,text:e}]}}function x(e){return e instanceof Error?e.message:String(e)}function S(e,p){function v(){return p.sources?.[0]?.path??process.cwd()}function S(){return c(m(),`flows`,`registry.json`)}function C(){return c(p.stateDir??c(v(),`.aikit-state`),`flows`,`state.json`)}function w(e,t){let r=t?.installPath?s(t.installPath):e.replaceAll(`:`,`-`),i=l(u(),`.copilot`,`flows`,r).replaceAll(`\\`,`/`);if(n(i))return i;let a=l(u(),`.claude`,`flows`,r).replaceAll(`\\`,`/`);if(n(a))return a;let o=l(v(),`.github`,`flows`,r).replaceAll(`\\`,`/`);return n(o)?o:t?.installPath&&n(t.installPath)?t.installPath.replaceAll(`\\`,`/`):null}function T(e,t){let n=w(e.name,e);return n?l(n,t).replaceAll(`\\`,`/`):t}function E(){try{let e=c(g(`npm root -g`,{encoding:`utf-8`}).trim(),`@fission-ai`,`openspec`);if(n(e))return{path:e,sourceType:`npm-global`,isGit:!1}}catch{}return{path:`https://github.com/Fission-AI/OpenSpec.git`,sourceType:`git`,isGit:!0}}function D(e){let t=l(e);if(n(c(t,`.claude-plugin`,`plugin.json`)))return{path:t,sourceType:`claude-plugin`};let a=u(),o=c(a,`.claude`,`plugins`,e);if(n(c(o,`.claude-plugin`,`plugin.json`)))return{path:o,sourceType:`claude-plugin`};let s=c(a,`.claude`,`plugins`);if(!n(s))return null;for(let t of i(s,{withFileTypes:!0})){if(!t.isDirectory())continue;let i=c(s,t.name,`.claude-plugin`,`plugin.json`);if(n(i))try{if(JSON.parse(r(i,`utf-8`)).name===e)return{path:c(s,t.name),sourceType:`claude-plugin`}}catch{}}return null}async function O(){let{FlowRegistryManager:e,FlowStateMachine:t,FlowLoader:n,GitInstaller:r}=await import(`../../../flows/dist/index.js`),i=c(p.stateDir??c(v(),`.aikit-state`),`flows`,`installed`);return{registry:new e(S()),stateMachine:new t(C()),loader:new n,installer:new r(i)}}let k=t(`flow_list`);e.registerTool(`flow_list`,{title:k.title,description:`List all installed flows and their steps`,annotations:k.annotations,inputSchema:{}},async()=>{try{let{registry:e,stateMachine:t,installer:n}=await O(),r=e.list(),i=t.getStatus(),a={flows:r.map(e=>{let t={name:e.name,version:e.version,source:e.source,sourceType:e.sourceType,format:e.format,steps:e.manifest.steps.map(e=>e.id)};if(e.sourceType===`git`&&e.commitSha){let r=n.hasUpdates(e.installPath);return{...t,commitSha:e.commitSha,updateAvailable:r.success&&r.data?r.data.hasUpdates:void 0}}return t}),activeFlow:i.success&&i.data?{flow:i.data.flow,status:i.data.status,currentStep:i.data.currentStep}:null};return b(JSON.stringify(a,null,2))}catch(e){return _.error(`flow_list failed`,h(e)),b(`Error: ${x(e)}`)}});let A=t(`flow_info`);e.registerTool(`flow_info`,{title:A.title,description:`Show detailed information about a specific flow`,annotations:A.annotations,inputSchema:{name:d.string().describe(`Flow name to get info for`)}},async({name:e})=>{try{let{registry:t,installer:n}=await O(),r=t.get(e);if(!r)return b(`Flow "${e}" not found. Use flow_list to see available flows.`);let i=r.commitSha??null,a;if(r.sourceType===`git`&&r.installPath){let e=n.hasUpdates(r.installPath);a=e.success&&e.data?e.data.hasUpdates:void 0}let o={name:r.name,version:r.version,description:r.manifest.description,source:r.source,sourceType:r.sourceType,format:r.format,commitSha:i,updateAvailable:a,installPath:w(r.name,r),registeredAt:r.registeredAt,updatedAt:r.updatedAt,steps:r.manifest.steps.map(e=>({id:e.id,name:e.name,instruction:T(r,e.instruction),produces:e.produces,requires:e.requires,description:e.description})),agents:r.manifest.agents,artifactsDir:r.manifest.artifacts_dir,install:r.manifest.install};return b(JSON.stringify(o,null,2))}catch(e){return _.error(`flow_info failed`,h(e)),b(`Error: ${x(e)}`)}});let j=t(`flow_start`);e.registerTool(`flow_start`,{title:j.title,description:`Start a flow. Sets the active flow and positions at the first step.`,annotations:j.annotations,inputSchema:{flow:d.string().describe(`Flow name to start (use flow_list to see options)`)}},async({flow:e})=>{try{let{registry:t,stateMachine:n}=await O(),r=t.get(e);if(!r)return b(`Flow "${e}" not found. Use flow_list to see available flows.`);let i=n.start(r.name,r.manifest);if(!i.success||!i.data)return b(`Cannot start: ${i.error}`);let a=i.data,o=r.manifest.steps.find(e=>e.id===a.currentStep),s={started:!0,flow:a.flow,currentStep:a.currentStep,currentStepInstruction:r&&o?T(r,o.instruction):null,currentStepDescription:o?.description??null,totalSteps:r.manifest.steps.length,stepSequence:r.manifest.steps.map(e=>e.id),artifactsDir:r.manifest.artifacts_dir};return b(JSON.stringify(s,null,2))}catch(e){return _.error(`flow_start failed`,h(e)),b(`Error: ${x(e)}`)}});let M=t(`flow_step`);e.registerTool(`flow_step`,{title:M.title,description:`Advance the active flow: complete current step and move to next, skip current step, or redo current step.`,annotations:M.annotations,inputSchema:{action:d.enum([`next`,`skip`,`redo`]).describe(`next: mark current step done and advance. skip: skip current step. redo: repeat current step.`)}},async({action:e})=>{try{let{registry:t,stateMachine:n}=await O(),r=n.load();if(!r)return b(`No active flow. Use flow_start first.`);let i=t.get(r.flow);if(!i)return b(`Flow "${r.flow}" not found in registry.`);let a=n.step(e,i.manifest);if(!a.success||!a.data)return b(`Cannot ${e}: ${a.error}`);let o=a.data,s=o.currentStep?i.manifest.steps.find(e=>e.id===o.currentStep):null,c={flow:o.flow,status:o.status,action:e,currentStep:o.currentStep,currentStepInstruction:i&&s?T(i,s.instruction):null,currentStepDescription:s?.description??null,completedSteps:o.completedSteps,skippedSteps:o.skippedSteps,totalSteps:i.manifest.steps.length,remaining:i.manifest.steps.filter(e=>!o.completedSteps.includes(e.id)&&!o.skippedSteps.includes(e.id)&&e.id!==o.currentStep).map(e=>e.id)};return b(JSON.stringify(c,null,2))}catch(e){return _.error(`flow_step failed`,h(e)),b(`Error: ${x(e)}`)}});let N=t(`flow_status`);e.registerTool(`flow_status`,{title:N.title,description:`Show the current flow execution state — which flow is active, current step, completed steps, and artifacts.`,annotations:N.annotations,inputSchema:{}},async()=>{try{let{registry:e,stateMachine:t}=await O(),n=t.getStatus();if(!n.success||!n.data)return b(`No active flow. Use flow_start to begin one, or flow_list to see available flows.`);let r=n.data,i=e.get(r.flow),a=i?.manifest.steps.find(e=>e.id===r.currentStep),o=i&&a?T(i,a.instruction):null,s={flow:r.flow,status:r.status,currentStep:r.currentStep,currentStepInstruction:o,instructionPath:o,currentStepDescription:a?.description??null,completedSteps:r.completedSteps,skippedSteps:r.skippedSteps,artifacts:r.artifacts,startedAt:r.startedAt,updatedAt:r.updatedAt,totalSteps:i?.manifest.steps.length??0,progress:i?`${r.completedSteps.length+r.skippedSteps.length}/${i.manifest.steps.length}`:`unknown`};return b(JSON.stringify(s,null,2))}catch(e){return _.error(`flow_status failed`,h(e)),b(`Error: ${x(e)}`)}});let P=t(`flow_read_instruction`);e.registerTool(`flow_read_instruction`,{title:P.title===`flow_read_instruction`?`Flow Read Instruction`:P.title,description:`Read the instruction content for a flow step. If step is omitted, reads the current step.`,annotations:P.title===`flow_read_instruction`?{readOnlyHint:!0,idempotentHint:!0}:P.annotations,inputSchema:{step:d.string().optional().describe(`Step id or name to read. Defaults to the current step.`)}},async({step:e})=>{try{let{registry:t,stateMachine:n}=await O(),r=n.getStatus();if(!r.success||!r.data)return b(`No active flow. Use flow_start to begin one, or flow_list to see available flows.`);let i=r.data,a=t.get(i.flow);if(!a)return b(`Flow "${i.flow}" not found in registry.`);let o=e??i.currentStep;if(!o)return b(`No current step is available for the active flow.`);let s=a.manifest.steps.find(e=>e.id===o||e.name===o);return b(s?await f(T(a,s.instruction),`utf-8`):`Step "${o}" not found in flow "${i.flow}".`)}catch(e){return _.error(`flow_read_instruction failed`,h(e)),e instanceof Error&&`code`in e&&e.code===`ENOENT`?b(`Could not read instruction file: ${e.message}`):b(`Error: ${x(e)}`)}});let F=t(`flow_reset`);e.registerTool(`flow_reset`,{title:F.title,description:`Reset the active flow, clearing all state. Use to start over or switch to a different flow.`,annotations:F.annotations,inputSchema:{}},async()=>{try{let{stateMachine:e}=await O(),t=e.reset();return t.success?b(`Flow state reset. Use flow_start to begin a new flow.`):b(`Reset failed: ${t.error}`)}catch(e){return _.error(`flow_reset failed`,h(e)),b(`Error: ${x(e)}`)}});let I=t(`flow_add`);e.registerTool(`flow_add`,{title:I.title,description:`Install a new development flow from a git repository URL or local directory path. Use when the user wants to add, install, import, or onboard a new workflow — for example: "use this as a flow", "add this flow", "add this flow URL", "install a flow", or "onboard a flow". Accepts git URLs (https://..., git@...) and local filesystem paths. Also accepts the shorthand "openspec" to install the OpenSpec flow (auto-detects local npm global install or clones from GitHub).`,annotations:I.annotations,inputSchema:{source:d.string().describe(`Git repository URL (https://... or git@...) or absolute/local directory path containing a flow definition. Use "openspec" as a shorthand to auto-resolve the OpenSpec flow.`),name:d.string().optional().describe(`Optional override for the installed flow name. If omitted, the name comes from the flow manifest.`),token:d.string().optional().describe(`Authentication token for private/GHE repositories`)}},async({source:t,name:n,token:r})=>{try{let{registry:i,loader:a,installer:o}=await O(),c=y(e),u=t===`openspec`||t.startsWith(`openspec:`),d,f=t,p;if(u){let e=E();f=e.path,d=e.sourceType}let m=u?null:D(f);m&&(f=m.path,d=m.sourceType);let h=/^https?:\/\/|^git@/.test(f),g;if(h){let e=o.clone(f,r);if(!e.success||!e.data)return b(`Failed to clone flow: ${e.error}`);g=e.data}else{let e=l(f);p=e;let t=n||s(e)||`custom-flow`,r=o.copyLocal(e,t);if(!r.success||!r.data)return b(`Failed to copy flow: ${r.error}`);g=r.data}let _=await a.load(g,{forceAssetSync:!0,transform:c});if(!_.success||!_.data)return o.remove(g),b(`Failed to load flow manifest: ${_.error}`);let{manifest:v,format:x}=_.data,S=n||v.name,C=d??(h?`git`:`local`);if(i.has(S))return o.remove(g),b(`Flow "${S}" is already installed. Use flow_update to update it, or flow_remove then flow_add to replace.`);if(v.install.length>0){let e=o.runInstallDeps(v.install);if(!e.success)return o.remove(g),b(`Dependency install failed: ${e.error}`)}let w=new Date().toISOString(),T=h?o.getLocalCommit(g):void 0,k=i.register({name:S,version:v.version,source:C===`local`||C===`claude-plugin`?p??t:t,sourceType:C,installPath:g,format:x,registeredAt:w,updatedAt:w,manifest:v,...T?{commitSha:T}:{}});if(!k.success)return o.remove(g),b(`Failed to register flow: ${k.error}`);let A=v.steps.length;return b(`Flow "${S}" installed successfully (${A} steps). Use flow_start({ flow: "${S}" }) to begin.`)}catch(e){return _.error(`flow_add failed`,h(e)),b(`Error: ${x(e)}`)}});let L=t(`flow_remove`);e.registerTool(`flow_remove`,{title:L.title,description:`Remove an installed flow by name. Unregisters it and deletes its files when applicable. Builtin flows cannot be removed.`,annotations:L.annotations,inputSchema:{name:d.string().describe(`Name of the flow to remove.`)}},async({name:e})=>{try{let{registry:t,installer:n}=await O();if(!t.has(e))return b(`Flow "${e}" is not installed.`);let r=t.get(e);if(!r)return b(`Flow "${e}" is not installed.`);if(r.sourceType===`builtin`)return b(`Cannot remove builtin flow "${e}".`);let i=n.remove(r.installPath);if(!i.success)return b(`Failed to remove flow files: ${i.error}`);let a=t.unregister(e);return a.success?b(`Flow "${e}" removed successfully.`):b(`Failed to unregister flow: ${a.error}`)}catch(e){return _.error(`flow_remove failed`,h(e)),b(`Error: ${x(e)}`)}});let R=t(`flow_update`);e.registerTool(`flow_update`,{title:R.title,description:`Update an installed flow to its latest version. For git-based flows, pulls the latest changes. For npm-global flows (e.g. OpenSpec), runs npm update.`,annotations:R.annotations,inputSchema:{name:d.string().describe(`Name of the flow to update.`)}},async({name:t})=>{try{let{registry:r,loader:i,installer:c}=await O(),u=y(e);if(!r.has(t))return b(`Flow "${t}" is not installed.`);let d=r.get(t);if(!d||d.sourceType!==`git`&&d.sourceType!==`npm-global`&&d.sourceType!==`local`&&d.sourceType!==`claude-plugin`)return b(`Flow "${t}" was not installed from git, npm, or a local source — cannot update. Remove and re-add instead.`);if(d.sourceType===`local`||d.sourceType===`claude-plugin`){let e=l(d.source);if(!n(e))return b(`Source path no longer exists: ${e}`);let t=`${d.installPath}.updating`,f=`${d.installPath}.backup`;n(t)&&o(t,{recursive:!0,force:!0}),n(f)&&o(f,{recursive:!0,force:!0});let p=c.copyLocal(e,s(t));if(!p.success||!p.data)return b(`Failed to copy flow: ${p.error}`);let m=await i.load(t,{forceAssetSync:!0,transform:u});if(!m.success||!m.data)return c.remove(t),b(`Failed to load flow manifest: ${m.error}`);let h=!1;try{a(d.installPath,f),a(t,d.installPath);let e=await i.load(d.installPath,{forceAssetSync:!0,transform:u});if(!e.success||!e.data)throw Error(`Failed to load flow manifest: ${e.error}`);let n=e.data.manifest,s=e.data.format,l=r.register({...d,version:n.version,format:s,installPath:d.installPath,manifest:n,updatedAt:new Date().toISOString()});if(!l.success)throw Error(`Failed to refresh flow registry entry: ${l.error}`);if(h=!0,n.install.length>0){let e=c.runInstallDeps(n.install);if(!e.success)throw Error(`Dependency install failed: ${e.error}`)}o(f,{recursive:!0,force:!0})}catch(e){return n(t)&&o(t,{recursive:!0,force:!0}),n(f)&&(n(d.installPath)&&o(d.installPath,{recursive:!0,force:!0}),a(f,d.installPath)),h&&r.register(d),b(x(e))}return b(`Flow "${d.name}" updated from ${d.sourceType} source successfully.`)}if(d.sourceType===`npm-global`){try{g(`npm update -g @fission-ai/openspec`,{encoding:`utf-8`,stdio:`pipe`})}catch(e){return b(`npm update failed: ${x(e)}`)}let e=E(),n=await i.load(e.path,{forceAssetSync:!0,transform:u}),a=n.success&&n.data?n.data.manifest:null,o=n.success&&n.data?n.data.format:d.format;if(a){let t=r.register({...d,version:a.version,format:o,installPath:e.path,manifest:a,updatedAt:new Date().toISOString()});if(!t.success)return b(`Failed to refresh flow registry entry: ${t.error}`)}return b(`Flow "${t}" updated via npm successfully.`)}let f=c.update(d.installPath);if(!f.success)return b(`Update failed: ${f.error}`);let p=await i.load(d.installPath,{forceAssetSync:!0,transform:u}),m=p.success&&p.data?p.data.manifest:null,h=p.success&&p.data?p.data.format:d.format;if(m){let e=c.getLocalCommit(d.installPath),t=r.register({...d,version:m.version,format:h,manifest:m,updatedAt:new Date().toISOString(),...e?{commitSha:e}:{}});if(!t.success)return b(`Failed to refresh flow registry entry: ${t.error}`)}let _=m?.install??d.manifest.install;if(_.length>0){let e=c.runInstallDeps(_);if(!e.success)return b(`Dependency install failed: ${e.error}`)}return b(`Flow "${t}" updated successfully.`)}catch(e){return _.error(`flow_update failed`,h(e)),b(`Error: ${x(e)}`)}})}export{S as registerFlowTools};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { FileCache } from "../../../tools/dist/index.js";
|
|
3
|
-
import { IKnowledgeStore } from "../../../store/dist/index.js";
|
|
4
|
-
import { IEmbedder } from "../../../embeddings/dist/index.js";
|
|
5
|
-
|
|
6
|
-
//#region packages/server/src/tools/forge.tools.d.ts
|
|
7
|
-
declare function registerEvidenceMapTool(server: McpServer): void;
|
|
8
|
-
declare function registerDigestTool(server: McpServer, embedder: IEmbedder): void;
|
|
9
|
-
declare function registerForgeClassifyTool(server: McpServer): void;
|
|
10
|
-
declare function registerStratumCardTool(server: McpServer, embedder: IEmbedder, cache: FileCache): void;
|
|
11
|
-
declare function registerForgeGroundTool(server: McpServer, embedder: IEmbedder, store: IKnowledgeStore): void;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { registerDigestTool, registerEvidenceMapTool, registerForgeClassifyTool, registerForgeGroundTool, registerStratumCardTool };
|