distill-mcp 0.6.0-beta
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/bin/cli.js +133 -0
- package/dist/analytics/session-tracker.d.ts +74 -0
- package/dist/analytics/session-tracker.d.ts.map +1 -0
- package/dist/analytics/session-tracker.js +123 -0
- package/dist/ast/benchmark.test.d.ts +7 -0
- package/dist/ast/benchmark.test.d.ts.map +1 -0
- package/dist/ast/benchmark.test.js +175 -0
- package/dist/ast/go/index.d.ts +9 -0
- package/dist/ast/go/index.d.ts.map +1 -0
- package/dist/ast/go/index.js +8 -0
- package/dist/ast/go/parser.d.ts +31 -0
- package/dist/ast/go/parser.d.ts.map +1 -0
- package/dist/ast/go/parser.js +428 -0
- package/dist/ast/go/parser.test.d.ts +5 -0
- package/dist/ast/go/parser.test.d.ts.map +1 -0
- package/dist/ast/go/parser.test.js +241 -0
- package/dist/ast/go/queries.d.ts +51 -0
- package/dist/ast/go/queries.d.ts.map +1 -0
- package/dist/ast/go/queries.js +114 -0
- package/dist/ast/go/utils.d.ts +66 -0
- package/dist/ast/go/utils.d.ts.map +1 -0
- package/dist/ast/go/utils.js +140 -0
- package/dist/ast/index.d.ts +39 -0
- package/dist/ast/index.d.ts.map +1 -0
- package/dist/ast/index.js +245 -0
- package/dist/ast/php/index.d.ts +9 -0
- package/dist/ast/php/index.d.ts.map +1 -0
- package/dist/ast/php/index.js +8 -0
- package/dist/ast/php/parser.d.ts +31 -0
- package/dist/ast/php/parser.d.ts.map +1 -0
- package/dist/ast/php/parser.js +388 -0
- package/dist/ast/php/parser.test.d.ts +5 -0
- package/dist/ast/php/parser.test.d.ts.map +1 -0
- package/dist/ast/php/parser.test.js +328 -0
- package/dist/ast/php/queries.d.ts +61 -0
- package/dist/ast/php/queries.d.ts.map +1 -0
- package/dist/ast/php/queries.js +117 -0
- package/dist/ast/php/utils.d.ts +83 -0
- package/dist/ast/php/utils.d.ts.map +1 -0
- package/dist/ast/php/utils.js +246 -0
- package/dist/ast/python/index.d.ts +9 -0
- package/dist/ast/python/index.d.ts.map +1 -0
- package/dist/ast/python/index.js +8 -0
- package/dist/ast/python/parser.d.ts +32 -0
- package/dist/ast/python/parser.d.ts.map +1 -0
- package/dist/ast/python/parser.js +422 -0
- package/dist/ast/python/parser.test.d.ts +5 -0
- package/dist/ast/python/parser.test.d.ts.map +1 -0
- package/dist/ast/python/parser.test.js +186 -0
- package/dist/ast/python/queries.d.ts +73 -0
- package/dist/ast/python/queries.d.ts.map +1 -0
- package/dist/ast/python/queries.js +137 -0
- package/dist/ast/python/utils.d.ts +63 -0
- package/dist/ast/python/utils.d.ts.map +1 -0
- package/dist/ast/python/utils.js +159 -0
- package/dist/ast/quick-scan.d.ts +40 -0
- package/dist/ast/quick-scan.d.ts.map +1 -0
- package/dist/ast/quick-scan.js +287 -0
- package/dist/ast/rust/index.d.ts +9 -0
- package/dist/ast/rust/index.d.ts.map +1 -0
- package/dist/ast/rust/index.js +8 -0
- package/dist/ast/rust/parser.d.ts +31 -0
- package/dist/ast/rust/parser.d.ts.map +1 -0
- package/dist/ast/rust/parser.js +416 -0
- package/dist/ast/rust/parser.test.d.ts +5 -0
- package/dist/ast/rust/parser.test.d.ts.map +1 -0
- package/dist/ast/rust/parser.test.js +329 -0
- package/dist/ast/rust/queries.d.ts +66 -0
- package/dist/ast/rust/queries.d.ts.map +1 -0
- package/dist/ast/rust/queries.js +132 -0
- package/dist/ast/rust/utils.d.ts +91 -0
- package/dist/ast/rust/utils.d.ts.map +1 -0
- package/dist/ast/rust/utils.js +254 -0
- package/dist/ast/swift/index.d.ts +10 -0
- package/dist/ast/swift/index.d.ts.map +1 -0
- package/dist/ast/swift/index.js +8 -0
- package/dist/ast/swift/parser.d.ts +31 -0
- package/dist/ast/swift/parser.d.ts.map +1 -0
- package/dist/ast/swift/parser.js +554 -0
- package/dist/ast/swift/parser.test.d.ts +5 -0
- package/dist/ast/swift/parser.test.d.ts.map +1 -0
- package/dist/ast/swift/parser.test.js +398 -0
- package/dist/ast/swift/queries.d.ts +71 -0
- package/dist/ast/swift/queries.d.ts.map +1 -0
- package/dist/ast/swift/queries.js +137 -0
- package/dist/ast/swift/utils.d.ts +94 -0
- package/dist/ast/swift/utils.d.ts.map +1 -0
- package/dist/ast/swift/utils.js +411 -0
- package/dist/ast/types.d.ts +96 -0
- package/dist/ast/types.d.ts.map +1 -0
- package/dist/ast/types.js +21 -0
- package/dist/ast/typescript.d.ts +24 -0
- package/dist/ast/typescript.d.ts.map +1 -0
- package/dist/ast/typescript.js +357 -0
- package/dist/cache/file-hash.d.ts +33 -0
- package/dist/cache/file-hash.d.ts.map +1 -0
- package/dist/cache/file-hash.js +59 -0
- package/dist/cache/index.d.ts +9 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +8 -0
- package/dist/cache/smart-cache.d.ts +68 -0
- package/dist/cache/smart-cache.d.ts.map +1 -0
- package/dist/cache/smart-cache.js +266 -0
- package/dist/cache/types.d.ts +102 -0
- package/dist/cache/types.d.ts.map +1 -0
- package/dist/cache/types.js +6 -0
- package/dist/cli/analyze.d.ts +43 -0
- package/dist/cli/analyze.d.ts.map +1 -0
- package/dist/cli/analyze.js +250 -0
- package/dist/cli/doctor.d.ts +2 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +127 -0
- package/dist/cli/hooks.d.ts +14 -0
- package/dist/cli/hooks.d.ts.map +1 -0
- package/dist/cli/hooks.js +229 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +4 -0
- package/dist/cli/setup.d.ts +10 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +117 -0
- package/dist/cli/utils.d.ts +30 -0
- package/dist/cli/utils.d.ts.map +1 -0
- package/dist/cli/utils.js +116 -0
- package/dist/compressors/config.d.ts +9 -0
- package/dist/compressors/config.d.ts.map +1 -0
- package/dist/compressors/config.js +183 -0
- package/dist/compressors/conversation.d.ts +109 -0
- package/dist/compressors/conversation.d.ts.map +1 -0
- package/dist/compressors/conversation.js +404 -0
- package/dist/compressors/diff.d.ts +35 -0
- package/dist/compressors/diff.d.ts.map +1 -0
- package/dist/compressors/diff.js +389 -0
- package/dist/compressors/generic.d.ts +9 -0
- package/dist/compressors/generic.d.ts.map +1 -0
- package/dist/compressors/generic.js +188 -0
- package/dist/compressors/index.d.ts +31 -0
- package/dist/compressors/index.d.ts.map +1 -0
- package/dist/compressors/index.js +82 -0
- package/dist/compressors/logs.d.ts +9 -0
- package/dist/compressors/logs.d.ts.map +1 -0
- package/dist/compressors/logs.js +245 -0
- package/dist/compressors/multifile.d.ts +106 -0
- package/dist/compressors/multifile.d.ts.map +1 -0
- package/dist/compressors/multifile.js +498 -0
- package/dist/compressors/semantic.d.ts +33 -0
- package/dist/compressors/semantic.d.ts.map +1 -0
- package/dist/compressors/semantic.js +233 -0
- package/dist/compressors/stacktrace.d.ts +9 -0
- package/dist/compressors/stacktrace.d.ts.map +1 -0
- package/dist/compressors/stacktrace.js +259 -0
- package/dist/compressors/types.d.ts +146 -0
- package/dist/compressors/types.d.ts.map +1 -0
- package/dist/compressors/types.js +6 -0
- package/dist/config/output-config.d.ts +56 -0
- package/dist/config/output-config.d.ts.map +1 -0
- package/dist/config/output-config.js +78 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/middleware/chain.d.ts +49 -0
- package/dist/middleware/chain.d.ts.map +1 -0
- package/dist/middleware/chain.js +126 -0
- package/dist/middleware/index.d.ts +4 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +3 -0
- package/dist/middleware/logging.d.ts +8 -0
- package/dist/middleware/logging.d.ts.map +1 -0
- package/dist/middleware/logging.js +71 -0
- package/dist/middleware/types.d.ts +58 -0
- package/dist/middleware/types.d.ts.map +1 -0
- package/dist/middleware/types.js +7 -0
- package/dist/parsers/eslint.d.ts +8 -0
- package/dist/parsers/eslint.d.ts.map +1 -0
- package/dist/parsers/eslint.js +132 -0
- package/dist/parsers/generic.d.ts +8 -0
- package/dist/parsers/generic.d.ts.map +1 -0
- package/dist/parsers/generic.js +234 -0
- package/dist/parsers/index.d.ts +34 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/index.js +216 -0
- package/dist/parsers/types.d.ts +84 -0
- package/dist/parsers/types.d.ts.map +1 -0
- package/dist/parsers/types.js +6 -0
- package/dist/parsers/typescript.d.ts +8 -0
- package/dist/parsers/typescript.d.ts.map +1 -0
- package/dist/parsers/typescript.js +107 -0
- package/dist/pipelines/definitions.d.ts +50 -0
- package/dist/pipelines/definitions.d.ts.map +1 -0
- package/dist/pipelines/definitions.js +206 -0
- package/dist/sandbox/executor.d.ts +12 -0
- package/dist/sandbox/executor.d.ts.map +1 -0
- package/dist/sandbox/executor.js +191 -0
- package/dist/sandbox/index.d.ts +11 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/index.js +9 -0
- package/dist/sandbox/sandbox.test.d.ts +7 -0
- package/dist/sandbox/sandbox.test.d.ts.map +1 -0
- package/dist/sandbox/sandbox.test.js +202 -0
- package/dist/sandbox/sdk/analyze.d.ts +36 -0
- package/dist/sandbox/sdk/analyze.d.ts.map +1 -0
- package/dist/sandbox/sdk/analyze.js +413 -0
- package/dist/sandbox/sdk/analyze.test.d.ts +7 -0
- package/dist/sandbox/sdk/analyze.test.d.ts.map +1 -0
- package/dist/sandbox/sdk/analyze.test.js +191 -0
- package/dist/sandbox/sdk/code.d.ts +20 -0
- package/dist/sandbox/sdk/code.d.ts.map +1 -0
- package/dist/sandbox/sdk/code.js +104 -0
- package/dist/sandbox/sdk/compress.d.ts +23 -0
- package/dist/sandbox/sdk/compress.d.ts.map +1 -0
- package/dist/sandbox/sdk/compress.js +107 -0
- package/dist/sandbox/sdk/conversation.d.ts +148 -0
- package/dist/sandbox/sdk/conversation.d.ts.map +1 -0
- package/dist/sandbox/sdk/conversation.js +177 -0
- package/dist/sandbox/sdk/files.d.ts +29 -0
- package/dist/sandbox/sdk/files.d.ts.map +1 -0
- package/dist/sandbox/sdk/files.js +41 -0
- package/dist/sandbox/sdk/git.d.ts +37 -0
- package/dist/sandbox/sdk/git.d.ts.map +1 -0
- package/dist/sandbox/sdk/git.js +313 -0
- package/dist/sandbox/sdk/git.test.d.ts +8 -0
- package/dist/sandbox/sdk/git.test.d.ts.map +1 -0
- package/dist/sandbox/sdk/git.test.js +160 -0
- package/dist/sandbox/sdk/index.d.ts +16 -0
- package/dist/sandbox/sdk/index.d.ts.map +1 -0
- package/dist/sandbox/sdk/index.js +15 -0
- package/dist/sandbox/sdk/multifile.d.ts +63 -0
- package/dist/sandbox/sdk/multifile.d.ts.map +1 -0
- package/dist/sandbox/sdk/multifile.js +130 -0
- package/dist/sandbox/sdk/pipeline.d.ts +16 -0
- package/dist/sandbox/sdk/pipeline.d.ts.map +1 -0
- package/dist/sandbox/sdk/pipeline.js +454 -0
- package/dist/sandbox/sdk/pipeline.test.d.ts +7 -0
- package/dist/sandbox/sdk/pipeline.test.d.ts.map +1 -0
- package/dist/sandbox/sdk/pipeline.test.js +197 -0
- package/dist/sandbox/sdk/search.d.ts +36 -0
- package/dist/sandbox/sdk/search.d.ts.map +1 -0
- package/dist/sandbox/sdk/search.js +338 -0
- package/dist/sandbox/sdk/search.test.d.ts +7 -0
- package/dist/sandbox/sdk/search.test.d.ts.map +1 -0
- package/dist/sandbox/sdk/search.test.js +183 -0
- package/dist/sandbox/sdk/utils.d.ts +18 -0
- package/dist/sandbox/sdk/utils.d.ts.map +1 -0
- package/dist/sandbox/sdk/utils.js +24 -0
- package/dist/sandbox/security/code-analyzer.d.ts +15 -0
- package/dist/sandbox/security/code-analyzer.d.ts.map +1 -0
- package/dist/sandbox/security/code-analyzer.js +87 -0
- package/dist/sandbox/security/index.d.ts +6 -0
- package/dist/sandbox/security/index.d.ts.map +1 -0
- package/dist/sandbox/security/index.js +5 -0
- package/dist/sandbox/security/path-validator.d.ts +23 -0
- package/dist/sandbox/security/path-validator.d.ts.map +1 -0
- package/dist/sandbox/security/path-validator.js +113 -0
- package/dist/sandbox/types.d.ts +577 -0
- package/dist/sandbox/types.d.ts.map +1 -0
- package/dist/sandbox/types.js +14 -0
- package/dist/server.d.ts +36 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +133 -0
- package/dist/summarizers/build-logs.d.ts +11 -0
- package/dist/summarizers/build-logs.d.ts.map +1 -0
- package/dist/summarizers/build-logs.js +234 -0
- package/dist/summarizers/generic.d.ts +11 -0
- package/dist/summarizers/generic.d.ts.map +1 -0
- package/dist/summarizers/generic.js +93 -0
- package/dist/summarizers/index.d.ts +20 -0
- package/dist/summarizers/index.d.ts.map +1 -0
- package/dist/summarizers/index.js +43 -0
- package/dist/summarizers/server-logs.d.ts +11 -0
- package/dist/summarizers/server-logs.d.ts.map +1 -0
- package/dist/summarizers/server-logs.js +215 -0
- package/dist/summarizers/test-logs.d.ts +11 -0
- package/dist/summarizers/test-logs.d.ts.map +1 -0
- package/dist/summarizers/test-logs.js +258 -0
- package/dist/summarizers/types.d.ts +146 -0
- package/dist/summarizers/types.d.ts.map +1 -0
- package/dist/summarizers/types.js +21 -0
- package/dist/tools/analyze-build-output.d.ts +30 -0
- package/dist/tools/analyze-build-output.d.ts.map +1 -0
- package/dist/tools/analyze-build-output.js +45 -0
- package/dist/tools/analyze-context.d.ts +23 -0
- package/dist/tools/analyze-context.d.ts.map +1 -0
- package/dist/tools/analyze-context.js +78 -0
- package/dist/tools/auto-optimize.d.ts +9 -0
- package/dist/tools/auto-optimize.d.ts.map +1 -0
- package/dist/tools/auto-optimize.js +191 -0
- package/dist/tools/code-execute.d.ts +9 -0
- package/dist/tools/code-execute.d.ts.map +1 -0
- package/dist/tools/code-execute.js +84 -0
- package/dist/tools/code-skeleton.d.ts +33 -0
- package/dist/tools/code-skeleton.d.ts.map +1 -0
- package/dist/tools/code-skeleton.js +206 -0
- package/dist/tools/compress-context.d.ts +33 -0
- package/dist/tools/compress-context.d.ts.map +1 -0
- package/dist/tools/compress-context.js +64 -0
- package/dist/tools/context-budget.d.ts +43 -0
- package/dist/tools/context-budget.d.ts.map +1 -0
- package/dist/tools/context-budget.js +260 -0
- package/dist/tools/context-budget.test.d.ts +5 -0
- package/dist/tools/context-budget.test.d.ts.map +1 -0
- package/dist/tools/context-budget.test.js +219 -0
- package/dist/tools/conversation-compress.d.ts +46 -0
- package/dist/tools/conversation-compress.d.ts.map +1 -0
- package/dist/tools/conversation-compress.js +78 -0
- package/dist/tools/conversation-memory.d.ts +75 -0
- package/dist/tools/conversation-memory.d.ts.map +1 -0
- package/dist/tools/conversation-memory.js +289 -0
- package/dist/tools/deduplicate-errors.d.ts +30 -0
- package/dist/tools/deduplicate-errors.d.ts.map +1 -0
- package/dist/tools/deduplicate-errors.js +72 -0
- package/dist/tools/detect-retry-loop.d.ts +40 -0
- package/dist/tools/detect-retry-loop.d.ts.map +1 -0
- package/dist/tools/detect-retry-loop.js +212 -0
- package/dist/tools/diff-compress.d.ts +40 -0
- package/dist/tools/diff-compress.d.ts.map +1 -0
- package/dist/tools/diff-compress.js +94 -0
- package/dist/tools/discover-tools.d.ts +11 -0
- package/dist/tools/discover-tools.d.ts.map +1 -0
- package/dist/tools/discover-tools.js +163 -0
- package/dist/tools/dynamic-loader.d.ts +131 -0
- package/dist/tools/dynamic-loader.d.ts.map +1 -0
- package/dist/tools/dynamic-loader.js +378 -0
- package/dist/tools/dynamic-loader.test.d.ts +10 -0
- package/dist/tools/dynamic-loader.test.d.ts.map +1 -0
- package/dist/tools/dynamic-loader.test.js +164 -0
- package/dist/tools/lazy-mcp.d.ts +31 -0
- package/dist/tools/lazy-mcp.d.ts.map +1 -0
- package/dist/tools/lazy-mcp.js +151 -0
- package/dist/tools/lazy-mcp.test.d.ts +10 -0
- package/dist/tools/lazy-mcp.test.d.ts.map +1 -0
- package/dist/tools/lazy-mcp.test.js +172 -0
- package/dist/tools/multifile-compress.d.ts +36 -0
- package/dist/tools/multifile-compress.d.ts.map +1 -0
- package/dist/tools/multifile-compress.js +223 -0
- package/dist/tools/optimization-tips.d.ts +18 -0
- package/dist/tools/optimization-tips.d.ts.map +1 -0
- package/dist/tools/optimization-tips.js +133 -0
- package/dist/tools/registry.d.ts +70 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +169 -0
- package/dist/tools/semantic-compress.d.ts +39 -0
- package/dist/tools/semantic-compress.d.ts.map +1 -0
- package/dist/tools/semantic-compress.js +113 -0
- package/dist/tools/semantic-compress.test.d.ts +5 -0
- package/dist/tools/semantic-compress.test.d.ts.map +1 -0
- package/dist/tools/semantic-compress.test.js +182 -0
- package/dist/tools/session-stats.d.ts +34 -0
- package/dist/tools/session-stats.d.ts.map +1 -0
- package/dist/tools/session-stats.js +194 -0
- package/dist/tools/set-output-config.d.ts +38 -0
- package/dist/tools/set-output-config.d.ts.map +1 -0
- package/dist/tools/set-output-config.js +122 -0
- package/dist/tools/smart-cache-tool.d.ts +38 -0
- package/dist/tools/smart-cache-tool.d.ts.map +1 -0
- package/dist/tools/smart-cache-tool.js +224 -0
- package/dist/tools/smart-file-read.d.ts +52 -0
- package/dist/tools/smart-file-read.d.ts.map +1 -0
- package/dist/tools/smart-file-read.js +481 -0
- package/dist/tools/smart-pipeline.d.ts +40 -0
- package/dist/tools/smart-pipeline.d.ts.map +1 -0
- package/dist/tools/smart-pipeline.js +295 -0
- package/dist/tools/summarize-logs.d.ts +36 -0
- package/dist/tools/summarize-logs.d.ts.map +1 -0
- package/dist/tools/summarize-logs.js +184 -0
- package/dist/tools/token-budget.test.d.ts +11 -0
- package/dist/tools/token-budget.test.d.ts.map +1 -0
- package/dist/tools/token-budget.test.js +275 -0
- package/dist/utils/bm25.d.ts +86 -0
- package/dist/utils/bm25.d.ts.map +1 -0
- package/dist/utils/bm25.js +153 -0
- package/dist/utils/bm25.test.d.ts +5 -0
- package/dist/utils/bm25.test.d.ts.map +1 -0
- package/dist/utils/bm25.test.js +156 -0
- package/dist/utils/command-normalizer.d.ts +39 -0
- package/dist/utils/command-normalizer.d.ts.map +1 -0
- package/dist/utils/command-normalizer.js +90 -0
- package/dist/utils/content-detector.d.ts +27 -0
- package/dist/utils/content-detector.d.ts.map +1 -0
- package/dist/utils/content-detector.js +127 -0
- package/dist/utils/embeddings.d.ts +54 -0
- package/dist/utils/embeddings.d.ts.map +1 -0
- package/dist/utils/embeddings.js +97 -0
- package/dist/utils/embeddings.test.d.ts +8 -0
- package/dist/utils/embeddings.test.d.ts.map +1 -0
- package/dist/utils/embeddings.test.js +96 -0
- package/dist/utils/error-normalizer.d.ts +39 -0
- package/dist/utils/error-normalizer.d.ts.map +1 -0
- package/dist/utils/error-normalizer.js +233 -0
- package/dist/utils/hybrid-search.d.ts +79 -0
- package/dist/utils/hybrid-search.d.ts.map +1 -0
- package/dist/utils/hybrid-search.js +146 -0
- package/dist/utils/hybrid-search.test.d.ts +5 -0
- package/dist/utils/hybrid-search.test.d.ts.map +1 -0
- package/dist/utils/hybrid-search.test.js +172 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/language-detector.d.ts +27 -0
- package/dist/utils/language-detector.d.ts.map +1 -0
- package/dist/utils/language-detector.js +94 -0
- package/dist/utils/log-parser.d.ts +46 -0
- package/dist/utils/log-parser.d.ts.map +1 -0
- package/dist/utils/log-parser.js +287 -0
- package/dist/utils/output-estimator.d.ts +54 -0
- package/dist/utils/output-estimator.d.ts.map +1 -0
- package/dist/utils/output-estimator.js +119 -0
- package/dist/utils/output-estimator.test.d.ts +5 -0
- package/dist/utils/output-estimator.test.d.ts.map +1 -0
- package/dist/utils/output-estimator.test.js +115 -0
- package/dist/utils/output-similarity.d.ts +48 -0
- package/dist/utils/output-similarity.d.ts.map +1 -0
- package/dist/utils/output-similarity.js +140 -0
- package/dist/utils/project-detector.d.ts +16 -0
- package/dist/utils/project-detector.d.ts.map +1 -0
- package/dist/utils/project-detector.js +119 -0
- package/dist/utils/segment-scorer.d.ts +99 -0
- package/dist/utils/segment-scorer.d.ts.map +1 -0
- package/dist/utils/segment-scorer.js +148 -0
- package/dist/utils/signature-grouper.d.ts +58 -0
- package/dist/utils/signature-grouper.d.ts.map +1 -0
- package/dist/utils/signature-grouper.js +185 -0
- package/dist/utils/tfidf.d.ts +45 -0
- package/dist/utils/tfidf.d.ts.map +1 -0
- package/dist/utils/tfidf.js +204 -0
- package/dist/utils/tfidf.test.d.ts +5 -0
- package/dist/utils/tfidf.test.d.ts.map +1 -0
- package/dist/utils/tfidf.test.js +115 -0
- package/dist/utils/token-counter.d.ts +35 -0
- package/dist/utils/token-counter.d.ts.map +1 -0
- package/dist/utils/token-counter.js +83 -0
- package/dist/utils/toon-serializer.d.ts +120 -0
- package/dist/utils/toon-serializer.d.ts.map +1 -0
- package/dist/utils/toon-serializer.js +472 -0
- package/dist/utils/toon-serializer.test.d.ts +7 -0
- package/dist/utils/toon-serializer.test.d.ts.map +1 -0
- package/dist/utils/toon-serializer.test.js +290 -0
- package/package.json +63 -0
- package/scripts/install.ps1 +133 -0
- package/scripts/install.sh +183 -0
- package/scripts/pre-commit-hook.sh +86 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sandbox Module
|
|
3
|
+
*
|
|
4
|
+
* Provides safe code execution with ctxopt SDK.
|
|
5
|
+
*/
|
|
6
|
+
export { executeSandbox } from "./executor.js";
|
|
7
|
+
export { analyzeCode, sanitizeError } from "./security/index.js";
|
|
8
|
+
export { validatePath, validateGlobPattern } from "./security/path-validator.js";
|
|
9
|
+
export type { ExecutionContext, ExecutionResult, CtxOptSDK, CodeAnalysis, CompressResult, LogSummary, FileStructure, CodeElement, } from "./types.js";
|
|
10
|
+
export { DEFAULT_LIMITS } from "./types.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sandbox/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACjF,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,YAAY,EACZ,cAAc,EACd,UAAU,EACV,aAAa,EACb,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sandbox Module
|
|
3
|
+
*
|
|
4
|
+
* Provides safe code execution with ctxopt SDK.
|
|
5
|
+
*/
|
|
6
|
+
export { executeSandbox } from "./executor.js";
|
|
7
|
+
export { analyzeCode, sanitizeError } from "./security/index.js";
|
|
8
|
+
export { validatePath, validateGlobPattern } from "./security/path-validator.js";
|
|
9
|
+
export { DEFAULT_LIMITS } from "./types.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox.test.d.ts","sourceRoot":"","sources":["../../src/sandbox/sandbox.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sandbox Tests
|
|
3
|
+
*
|
|
4
|
+
* Tests for code execution SDK security and functionality.
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect } from "vitest";
|
|
7
|
+
import { analyzeCode, sanitizeError } from "./security/index.js";
|
|
8
|
+
import { validatePath, validateGlobPattern } from "./security/path-validator.js";
|
|
9
|
+
import { executeSandbox } from "./executor.js";
|
|
10
|
+
import { DEFAULT_LIMITS } from "./types.js";
|
|
11
|
+
describe("Code Analyzer Security", () => {
|
|
12
|
+
describe("analyzeCode", () => {
|
|
13
|
+
it("should block eval", () => {
|
|
14
|
+
const result = analyzeCode('const x = eval("1+1")');
|
|
15
|
+
expect(result.safe).toBe(false);
|
|
16
|
+
expect(result.blockedPatterns).toContain("eval() is not allowed");
|
|
17
|
+
});
|
|
18
|
+
it("should block require", () => {
|
|
19
|
+
const result = analyzeCode('const fs = require("fs")');
|
|
20
|
+
expect(result.safe).toBe(false);
|
|
21
|
+
expect(result.blockedPatterns).toContain("require() is not allowed");
|
|
22
|
+
});
|
|
23
|
+
it("should block dynamic import", () => {
|
|
24
|
+
const result = analyzeCode('const m = await import("./mod")');
|
|
25
|
+
expect(result.safe).toBe(false);
|
|
26
|
+
expect(result.blockedPatterns).toContain("dynamic import() is not allowed");
|
|
27
|
+
});
|
|
28
|
+
it("should block process access", () => {
|
|
29
|
+
const result = analyzeCode("process.env.SECRET");
|
|
30
|
+
expect(result.safe).toBe(false);
|
|
31
|
+
expect(result.blockedPatterns).toContain("process is not allowed");
|
|
32
|
+
});
|
|
33
|
+
it("should block global access", () => {
|
|
34
|
+
const result = analyzeCode("global.something = 1");
|
|
35
|
+
expect(result.safe).toBe(false);
|
|
36
|
+
});
|
|
37
|
+
it("should block __proto__ access", () => {
|
|
38
|
+
const result = analyzeCode("obj.__proto__.polluted = true");
|
|
39
|
+
expect(result.safe).toBe(false);
|
|
40
|
+
});
|
|
41
|
+
it("should block Reflect", () => {
|
|
42
|
+
const result = analyzeCode("Reflect.get(obj, key)");
|
|
43
|
+
expect(result.safe).toBe(false);
|
|
44
|
+
});
|
|
45
|
+
it("should allow safe code", () => {
|
|
46
|
+
const result = analyzeCode(`
|
|
47
|
+
const x = 1 + 2;
|
|
48
|
+
const arr = [1, 2, 3].map(n => n * 2);
|
|
49
|
+
return arr;
|
|
50
|
+
`);
|
|
51
|
+
expect(result.safe).toBe(true);
|
|
52
|
+
expect(result.blockedPatterns).toHaveLength(0);
|
|
53
|
+
});
|
|
54
|
+
it("should warn about infinite loops", () => {
|
|
55
|
+
const result = analyzeCode("while(true) {}");
|
|
56
|
+
expect(result.safe).toBe(true); // Not blocked, just warned
|
|
57
|
+
expect(result.warnings).toContain("infinite loop detected");
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe("sanitizeError", () => {
|
|
61
|
+
it("should remove working directory from error", () => {
|
|
62
|
+
const error = new Error("File not found: /home/user/project/file.ts");
|
|
63
|
+
const sanitized = sanitizeError(error, "/home/user/project");
|
|
64
|
+
expect(sanitized).not.toContain("/home/user/project");
|
|
65
|
+
expect(sanitized).toContain("<workdir>");
|
|
66
|
+
});
|
|
67
|
+
it("should remove home paths", () => {
|
|
68
|
+
const error = new Error("Error at /home/sauron/code/file.ts");
|
|
69
|
+
const sanitized = sanitizeError(error, "/tmp");
|
|
70
|
+
expect(sanitized).not.toContain("/home/sauron");
|
|
71
|
+
expect(sanitized).toContain("<home>");
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
describe("Path Validator Security", () => {
|
|
76
|
+
const workingDir = "/home/user/project";
|
|
77
|
+
describe("validatePath", () => {
|
|
78
|
+
it("should allow paths within working directory", () => {
|
|
79
|
+
const result = validatePath("src/file.ts", workingDir);
|
|
80
|
+
expect(result.safe).toBe(true);
|
|
81
|
+
expect(result.resolvedPath).toBe("/home/user/project/src/file.ts");
|
|
82
|
+
});
|
|
83
|
+
it("should block path traversal", () => {
|
|
84
|
+
const result = validatePath("../../../etc/passwd", workingDir);
|
|
85
|
+
expect(result.safe).toBe(false);
|
|
86
|
+
expect(result.error).toContain("working directory");
|
|
87
|
+
});
|
|
88
|
+
it("should block .env files", () => {
|
|
89
|
+
const result = validatePath(".env", workingDir);
|
|
90
|
+
expect(result.safe).toBe(false);
|
|
91
|
+
expect(result.error).toContain("blocked");
|
|
92
|
+
});
|
|
93
|
+
it("should block .env.local files", () => {
|
|
94
|
+
const result = validatePath(".env.local", workingDir);
|
|
95
|
+
expect(result.safe).toBe(false);
|
|
96
|
+
});
|
|
97
|
+
it("should block private keys", () => {
|
|
98
|
+
const result = validatePath("id_rsa", workingDir);
|
|
99
|
+
expect(result.safe).toBe(false);
|
|
100
|
+
});
|
|
101
|
+
it("should block credentials files", () => {
|
|
102
|
+
const result = validatePath("credentials.json", workingDir);
|
|
103
|
+
expect(result.safe).toBe(false);
|
|
104
|
+
});
|
|
105
|
+
it("should allow normal source files", () => {
|
|
106
|
+
const result = validatePath("src/index.ts", workingDir);
|
|
107
|
+
expect(result.safe).toBe(true);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
describe("validateGlobPattern", () => {
|
|
111
|
+
it("should allow relative patterns", () => {
|
|
112
|
+
const result = validateGlobPattern("src/**/*.ts", workingDir);
|
|
113
|
+
expect(result.safe).toBe(true);
|
|
114
|
+
});
|
|
115
|
+
it("should block path traversal in patterns", () => {
|
|
116
|
+
const result = validateGlobPattern("../../**/*", workingDir);
|
|
117
|
+
expect(result.safe).toBe(false);
|
|
118
|
+
});
|
|
119
|
+
it("should block absolute paths", () => {
|
|
120
|
+
const result = validateGlobPattern("/etc/**/*", workingDir);
|
|
121
|
+
expect(result.safe).toBe(false);
|
|
122
|
+
});
|
|
123
|
+
it("should block patterns matching sensitive files", () => {
|
|
124
|
+
const result = validateGlobPattern("**/credentials.json", workingDir);
|
|
125
|
+
expect(result.safe).toBe(false);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
describe("Sandbox Executor", () => {
|
|
130
|
+
const defaultContext = {
|
|
131
|
+
workingDir: process.cwd(),
|
|
132
|
+
timeout: 5000,
|
|
133
|
+
memoryLimit: DEFAULT_LIMITS.memoryLimit,
|
|
134
|
+
maxOutputTokens: DEFAULT_LIMITS.maxOutputTokens,
|
|
135
|
+
};
|
|
136
|
+
describe("executeSandbox", () => {
|
|
137
|
+
it("should execute simple code", async () => {
|
|
138
|
+
const result = await executeSandbox("return 1 + 1", defaultContext);
|
|
139
|
+
expect(result.success).toBe(true);
|
|
140
|
+
expect(result.output).toBe(2);
|
|
141
|
+
});
|
|
142
|
+
it("should execute code with ctx.utils", async () => {
|
|
143
|
+
const result = await executeSandbox('return ctx.utils.countTokens("hello world")', defaultContext);
|
|
144
|
+
expect(result.success).toBe(true);
|
|
145
|
+
expect(typeof result.output).toBe("number");
|
|
146
|
+
expect(result.output).toBeGreaterThan(0);
|
|
147
|
+
});
|
|
148
|
+
it("should block dangerous code", async () => {
|
|
149
|
+
const result = await executeSandbox('eval("1+1")', defaultContext);
|
|
150
|
+
expect(result.success).toBe(false);
|
|
151
|
+
expect(result.error).toContain("Blocked patterns");
|
|
152
|
+
});
|
|
153
|
+
it("should block setTimeout usage", async () => {
|
|
154
|
+
const result = await executeSandbox("setTimeout(() => {}, 100); return 'done'", { ...defaultContext, timeout: 1000 });
|
|
155
|
+
expect(result.success).toBe(false);
|
|
156
|
+
expect(result.error).toContain("Blocked patterns");
|
|
157
|
+
});
|
|
158
|
+
it("should track execution time", async () => {
|
|
159
|
+
const result = await executeSandbox("return 42", defaultContext);
|
|
160
|
+
expect(result.stats.executionTimeMs).toBeGreaterThanOrEqual(0);
|
|
161
|
+
});
|
|
162
|
+
it("should handle code returning an object", async () => {
|
|
163
|
+
const result = await executeSandbox("return { x: 1, y: 2 }", defaultContext);
|
|
164
|
+
expect(result.success).toBe(true);
|
|
165
|
+
expect(result.output).toEqual({ x: 1, y: 2 });
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
describe("SDK Functions", () => {
|
|
170
|
+
const defaultContext = {
|
|
171
|
+
workingDir: process.cwd(),
|
|
172
|
+
timeout: 5000,
|
|
173
|
+
memoryLimit: DEFAULT_LIMITS.memoryLimit,
|
|
174
|
+
maxOutputTokens: DEFAULT_LIMITS.maxOutputTokens,
|
|
175
|
+
};
|
|
176
|
+
it("should detect content type", async () => {
|
|
177
|
+
const code = `
|
|
178
|
+
const type = ctx.utils.detectType("error: something failed\\nwarning: deprecated");
|
|
179
|
+
return type;
|
|
180
|
+
`;
|
|
181
|
+
const result = await executeSandbox(code, defaultContext);
|
|
182
|
+
expect(result.success).toBe(true);
|
|
183
|
+
});
|
|
184
|
+
it("should detect language from path", async () => {
|
|
185
|
+
const code = `
|
|
186
|
+
const lang = ctx.utils.detectLanguage("src/server.ts");
|
|
187
|
+
return lang;
|
|
188
|
+
`;
|
|
189
|
+
const result = await executeSandbox(code, defaultContext);
|
|
190
|
+
expect(result.success).toBe(true);
|
|
191
|
+
expect(result.output).toBe("typescript");
|
|
192
|
+
});
|
|
193
|
+
it("should compress content", async () => {
|
|
194
|
+
const code = `
|
|
195
|
+
const text = "error error error error warning warning info info";
|
|
196
|
+
const compressed = ctx.compress.auto(text);
|
|
197
|
+
return compressed.stats.reductionPercent;
|
|
198
|
+
`;
|
|
199
|
+
const result = await executeSandbox(code, defaultContext);
|
|
200
|
+
expect(result.success).toBe(true);
|
|
201
|
+
});
|
|
202
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK Analyze Functions
|
|
3
|
+
*
|
|
4
|
+
* Static analysis operations for sandbox use.
|
|
5
|
+
* Provides dependency analysis, call graphs, and structure overview.
|
|
6
|
+
*/
|
|
7
|
+
import type { ExportInfo, DependencyResult, CallGraphResult, StructureEntry, HostCallbacks } from "../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Create Analyze API for sandbox
|
|
10
|
+
*/
|
|
11
|
+
export declare function createAnalyzeAPI(workingDir: string, callbacks: HostCallbacks): {
|
|
12
|
+
/**
|
|
13
|
+
* Analyze file dependencies (imports and exports)
|
|
14
|
+
* @param file - File path to analyze
|
|
15
|
+
*/
|
|
16
|
+
dependencies(file: string): DependencyResult;
|
|
17
|
+
/**
|
|
18
|
+
* Build a call graph for a function
|
|
19
|
+
* @param functionName - Function name to analyze
|
|
20
|
+
* @param file - File containing the function
|
|
21
|
+
* @param depth - Maximum depth to traverse (default: 3)
|
|
22
|
+
*/
|
|
23
|
+
callGraph(functionName: string, file: string, depth?: number): CallGraphResult;
|
|
24
|
+
/**
|
|
25
|
+
* Get exports from a file
|
|
26
|
+
* @param file - File path to analyze
|
|
27
|
+
*/
|
|
28
|
+
exports(file: string): ExportInfo[];
|
|
29
|
+
/**
|
|
30
|
+
* Get directory structure with code analysis
|
|
31
|
+
* @param dir - Directory to analyze (default: working directory root)
|
|
32
|
+
* @param depth - Maximum depth (default: 3)
|
|
33
|
+
*/
|
|
34
|
+
structure(dir?: string, depth?: number): StructureEntry;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=analyze.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../../src/sandbox/sdk/analyze.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAEV,UAAU,EACV,gBAAgB,EAEhB,eAAe,EACf,cAAc,EACd,aAAa,EACd,MAAM,aAAa,CAAC;AAwKrB;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa;IAEzE;;;OAGG;uBACgB,MAAM,GAAG,gBAAgB;IA8F5C;;;;;OAKG;4BACqB,MAAM,QAAQ,MAAM,UAAU,MAAM,GAAG,eAAe;IAiG9E;;;OAGG;kBACW,MAAM,GAAG,UAAU,EAAE;IAKnC;;;;OAIG;oBACa,MAAM,UAAU,MAAM,GAAG,cAAc;EAmF1D"}
|