kuzushi 0.12.0 → 0.17.0
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 +126 -27
- package/dist/agent-runtime/batch-files.js +1 -1
- package/dist/agent-runtime/batch-files.js.map +1 -1
- package/dist/agent-runtime/claude.d.ts +8 -2
- package/dist/agent-runtime/claude.js +126 -78
- package/dist/agent-runtime/claude.js.map +1 -1
- package/dist/agent-runtime/context-guards.js.map +1 -1
- package/dist/agent-runtime/error-classification.js +2 -7
- package/dist/agent-runtime/error-classification.js.map +1 -1
- package/dist/agent-runtime/execution.d.ts +1 -1
- package/dist/agent-runtime/execution.js +21 -19
- package/dist/agent-runtime/execution.js.map +1 -1
- package/dist/agent-runtime/index.d.ts +2 -2
- package/dist/agent-runtime/index.js +3 -3
- package/dist/agent-runtime/index.js.map +1 -1
- package/dist/agent-runtime/logging-runtime.js +1 -1
- package/dist/agent-runtime/logging-runtime.js.map +1 -1
- package/dist/agent-runtime/loop-detector.js +9 -7
- package/dist/agent-runtime/loop-detector.js.map +1 -1
- package/dist/agent-runtime/model-fallback.js.map +1 -1
- package/dist/agent-runtime/model-spec.js.map +1 -1
- package/dist/agent-runtime/pi-ai.js +29 -24
- package/dist/agent-runtime/pi-ai.js.map +1 -1
- package/dist/agent-runtime/tools.js +253 -77
- package/dist/agent-runtime/tools.js.map +1 -1
- package/dist/agent-runtime/turn-watchdog.js.map +1 -1
- package/dist/agents/handoff.js.map +1 -1
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/index.js +45 -38
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/registry.d.ts +1 -1
- package/dist/agents/registry.js +3 -3
- package/dist/agents/registry.js.map +1 -1
- package/dist/agents/scanner-adapter.d.ts +1 -1
- package/dist/agents/scanner-adapter.js +1 -3
- package/dist/agents/scanner-adapter.js.map +1 -1
- package/dist/agents/task-loader.d.ts +1 -1
- package/dist/agents/task-loader.js +2 -2
- package/dist/agents/task-loader.js.map +1 -1
- package/dist/agents/task-manifest.d.ts +2 -2
- package/dist/agents/task-manifest.js +7 -7
- package/dist/agents/task-manifest.js.map +1 -1
- package/dist/agents/task-wrappers.js +1 -1
- package/dist/agents/task-wrappers.js.map +1 -1
- package/dist/agents/tasks/app-model-build.js +55 -34
- package/dist/agents/tasks/app-model-build.js.map +1 -1
- package/dist/agents/tasks/approval-gate.d.ts +1 -1
- package/dist/agents/tasks/approval-gate.js.map +1 -1
- package/dist/agents/tasks/auth-logic-detect.js +31 -9
- package/dist/agents/tasks/auth-logic-detect.js.map +1 -1
- package/dist/agents/tasks/call-graph-assist.js +1 -1
- package/dist/agents/tasks/call-graph-assist.js.map +1 -1
- package/dist/agents/tasks/category-filter.js +28 -14
- package/dist/agents/tasks/category-filter.js.map +1 -1
- package/dist/agents/tasks/chain-analysis.js +3 -6
- package/dist/agents/tasks/chain-analysis.js.map +1 -1
- package/dist/agents/tasks/code-config-detect.d.ts +1 -1
- package/dist/agents/tasks/code-config-detect.js +280 -144
- package/dist/agents/tasks/code-config-detect.js.map +1 -1
- package/dist/agents/tasks/code-graph/build.d.ts +1 -1
- package/dist/agents/tasks/code-graph/build.js +170 -66
- package/dist/agents/tasks/code-graph/build.js.map +1 -1
- package/dist/agents/tasks/code-graph/enrich.js +9 -4
- package/dist/agents/tasks/code-graph/enrich.js.map +1 -1
- package/dist/agents/tasks/code-graph/prompts.js +27 -9
- package/dist/agents/tasks/code-graph/prompts.js.map +1 -1
- package/dist/agents/tasks/code-graph/store.d.ts +4 -4
- package/dist/agents/tasks/code-graph/store.js +38 -22
- package/dist/agents/tasks/code-graph/store.js.map +1 -1
- package/dist/agents/tasks/command-injection.js +70 -20
- package/dist/agents/tasks/command-injection.js.map +1 -1
- package/dist/agents/tasks/context-enricher.js +12 -3
- package/dist/agents/tasks/context-enricher.js.map +1 -1
- package/dist/agents/tasks/context-gatherer.d.ts +1 -1
- package/dist/agents/tasks/context-gatherer.js +110 -31
- package/dist/agents/tasks/context-gatherer.js.map +1 -1
- package/dist/agents/tasks/crypto-behavioral-test.d.ts +1 -1
- package/dist/agents/tasks/crypto-behavioral-test.js +19 -23
- package/dist/agents/tasks/crypto-behavioral-test.js.map +1 -1
- package/dist/agents/tasks/deep-semantic/cwe-select.d.ts +1 -1
- package/dist/agents/tasks/deep-semantic/cwe-select.js +1 -1
- package/dist/agents/tasks/deep-semantic/cwe-select.js.map +1 -1
- package/dist/agents/tasks/deep-semantic/hunt.js +25 -15
- package/dist/agents/tasks/deep-semantic/hunt.js.map +1 -1
- package/dist/agents/tasks/deep-semantic/types.js +16 -6
- package/dist/agents/tasks/deep-semantic/types.js.map +1 -1
- package/dist/agents/tasks/deserialization-detection.js +45 -18
- package/dist/agents/tasks/deserialization-detection.js.map +1 -1
- package/dist/agents/tasks/detection-task-utils.d.ts +49 -0
- package/dist/agents/tasks/detection-task-utils.js +110 -0
- package/dist/agents/tasks/detection-task-utils.js.map +1 -0
- package/dist/agents/tasks/diff-review.js +52 -45
- package/dist/agents/tasks/diff-review.js.map +1 -1
- package/dist/agents/tasks/graphql-security.js +55 -40
- package/dist/agents/tasks/graphql-security.js.map +1 -1
- package/dist/agents/tasks/invariant-analysis/check.js +22 -8
- package/dist/agents/tasks/invariant-analysis/check.js.map +1 -1
- package/dist/agents/tasks/invariant-analysis/extract.d.ts +1 -1
- package/dist/agents/tasks/invariant-analysis/extract.js +21 -9
- package/dist/agents/tasks/invariant-analysis/extract.js.map +1 -1
- package/dist/agents/tasks/invariant-analysis/types.js +36 -4
- package/dist/agents/tasks/invariant-analysis/types.js.map +1 -1
- package/dist/agents/tasks/nosql-injection.js +80 -90
- package/dist/agents/tasks/nosql-injection.js.map +1 -1
- package/dist/agents/tasks/plugin-finding-scanner.d.ts +41 -0
- package/dist/agents/tasks/plugin-finding-scanner.js +56 -0
- package/dist/agents/tasks/plugin-finding-scanner.js.map +1 -0
- package/dist/agents/tasks/pre-read-prompt.js +1 -1
- package/dist/agents/tasks/pre-read-prompt.js.map +1 -1
- package/dist/agents/tasks/pre-read.js +12 -4
- package/dist/agents/tasks/pre-read.js.map +1 -1
- package/dist/agents/tasks/prompt-armor/resolve-promptarmor-plugin.d.ts +8 -0
- package/dist/agents/tasks/prompt-armor/resolve-promptarmor-plugin.js +29 -0
- package/dist/agents/tasks/prompt-armor/resolve-promptarmor-plugin.js.map +1 -0
- package/dist/agents/tasks/prototype-pollution.js +50 -40
- package/dist/agents/tasks/prototype-pollution.js.map +1 -1
- package/dist/agents/tasks/race-condition.js +52 -37
- package/dist/agents/tasks/race-condition.js.map +1 -1
- package/dist/agents/tasks/reachability-check.js +8 -2
- package/dist/agents/tasks/reachability-check.js.map +1 -1
- package/dist/agents/tasks/runtime-overrides.js +10 -4
- package/dist/agents/tasks/runtime-overrides.js.map +1 -1
- package/dist/agents/tasks/scenario-guidance.js +7 -4
- package/dist/agents/tasks/scenario-guidance.js.map +1 -1
- package/dist/agents/tasks/secrets-crypto-detect.d.ts +1 -1
- package/dist/agents/tasks/secrets-crypto-detect.js +50 -43
- package/dist/agents/tasks/secrets-crypto-detect.js.map +1 -1
- package/dist/agents/tasks/sharp-edges-detect.d.ts +16 -6
- package/dist/agents/tasks/sharp-edges-detect.js +95 -96
- package/dist/agents/tasks/sharp-edges-detect.js.map +1 -1
- package/dist/agents/tasks/shinsa/resolve-shinsa-plugin.d.ts +9 -0
- package/dist/agents/tasks/shinsa/resolve-shinsa-plugin.js +36 -0
- package/dist/agents/tasks/shinsa/resolve-shinsa-plugin.js.map +1 -0
- package/dist/agents/tasks/ssrf-detection.d.ts +3 -6
- package/dist/agents/tasks/ssrf-detection.js +79 -94
- package/dist/agents/tasks/ssrf-detection.js.map +1 -1
- package/dist/agents/tasks/supply-chain.js +63 -37
- package/dist/agents/tasks/supply-chain.js.map +1 -1
- package/dist/agents/tasks/systems-hunt/artifacts.js.map +1 -1
- package/dist/agents/tasks/systems-hunt/context.js +49 -14
- package/dist/agents/tasks/systems-hunt/context.js.map +1 -1
- package/dist/agents/tasks/systems-hunt/helpers.d.ts +1 -1
- package/dist/agents/tasks/systems-hunt/helpers.js +28 -30
- package/dist/agents/tasks/systems-hunt/helpers.js.map +1 -1
- package/dist/agents/tasks/systems-hunt/hunt.js +80 -26
- package/dist/agents/tasks/systems-hunt/hunt.js.map +1 -1
- package/dist/agents/tasks/systems-hunt/invariant-extract.js +15 -4
- package/dist/agents/tasks/systems-hunt/invariant-extract.js.map +1 -1
- package/dist/agents/tasks/systems-hunt/trigger-synth.js +2 -2
- package/dist/agents/tasks/systems-hunt/trigger-synth.js.map +1 -1
- package/dist/agents/tasks/systems-hunt/types.js +5 -2
- package/dist/agents/tasks/systems-hunt/types.js.map +1 -1
- package/dist/agents/tasks/taint-analysis/analyze.d.ts +1 -1
- package/dist/agents/tasks/taint-analysis/analyze.js +50 -62
- package/dist/agents/tasks/taint-analysis/analyze.js.map +1 -1
- package/dist/agents/tasks/taint-analysis/codeql-compat.js +6 -12
- package/dist/agents/tasks/taint-analysis/codeql-compat.js.map +1 -1
- package/dist/agents/tasks/taint-analysis/cross-service/analyze.js +6 -4
- package/dist/agents/tasks/taint-analysis/cross-service/analyze.js.map +1 -1
- package/dist/agents/tasks/taint-analysis/cross-service/boundary-agent.d.ts +2 -3
- package/dist/agents/tasks/taint-analysis/cross-service/boundary-agent.js +10 -5
- package/dist/agents/tasks/taint-analysis/cross-service/boundary-agent.js.map +1 -1
- package/dist/agents/tasks/taint-analysis/cross-service/discover.d.ts +1 -1
- package/dist/agents/tasks/taint-analysis/cross-service/discover.js +10 -13
- package/dist/agents/tasks/taint-analysis/cross-service/discover.js.map +1 -1
- package/dist/agents/tasks/taint-analysis/cross-service/stitch.js +88 -59
- package/dist/agents/tasks/taint-analysis/cross-service/stitch.js.map +1 -1
- package/dist/agents/tasks/taint-analysis/cross-service/types.js +32 -14
- package/dist/agents/tasks/taint-analysis/cross-service/types.js.map +1 -1
- package/dist/agents/tasks/taint-analysis/csv.js +6 -8
- package/dist/agents/tasks/taint-analysis/csv.js.map +1 -1
- package/dist/agents/tasks/taint-analysis/diff-scope.js.map +1 -1
- package/dist/agents/tasks/taint-analysis/extraction-agent.js +24 -12
- package/dist/agents/tasks/taint-analysis/extraction-agent.js.map +1 -1
- package/dist/agents/tasks/taint-analysis/grounding.js +3 -1
- package/dist/agents/tasks/taint-analysis/grounding.js.map +1 -1
- package/dist/agents/tasks/taint-analysis/label.d.ts +1 -1
- package/dist/agents/tasks/taint-analysis/label.js +219 -118
- package/dist/agents/tasks/taint-analysis/label.js.map +1 -1
- package/dist/agents/tasks/taint-analysis/preflight.js +70 -92
- package/dist/agents/tasks/taint-analysis/preflight.js.map +1 -1
- package/dist/agents/tasks/taint-analysis/ti-prior.js +378 -74
- package/dist/agents/tasks/taint-analysis/ti-prior.js.map +1 -1
- package/dist/agents/tasks/taint-analysis/types.js +35 -10
- package/dist/agents/tasks/taint-analysis/types.js.map +1 -1
- package/dist/agents/tasks/taint-iris/cwe-select.d.ts +6 -1
- package/dist/agents/tasks/taint-iris/cwe-select.js +1 -1
- package/dist/agents/tasks/taint-iris/cwe-select.js.map +1 -1
- package/dist/agents/tasks/taint-iris/iris.js +11 -3
- package/dist/agents/tasks/taint-iris/iris.js.map +1 -1
- package/dist/agents/tasks/task-selector.js +68 -21
- package/dist/agents/tasks/task-selector.js.map +1 -1
- package/dist/agents/tasks/template-injection.js +83 -91
- package/dist/agents/tasks/template-injection.js.map +1 -1
- package/dist/agents/tasks/threat-hunt.d.ts +9 -0
- package/dist/agents/tasks/threat-hunt.js +33 -15
- package/dist/agents/tasks/threat-hunt.js.map +1 -1
- package/dist/agents/tasks/threat-model-guidance.d.ts +1 -1
- package/dist/agents/tasks/threat-model-guidance.js +14 -8
- package/dist/agents/tasks/threat-model-guidance.js.map +1 -1
- package/dist/agents/tasks/threat-modeling/randori-adapter.js +99 -12
- package/dist/agents/tasks/threat-modeling/randori-adapter.js.map +1 -1
- package/dist/agents/tasks/threat-modeling/randori-artifacts.d.ts +2 -0
- package/dist/agents/tasks/threat-modeling/randori-artifacts.js +10 -2
- package/dist/agents/tasks/threat-modeling/randori-artifacts.js.map +1 -1
- package/dist/agents/tasks/threat-modeling/randori-runner.d.ts +61 -0
- package/dist/agents/tasks/threat-modeling/randori-runner.js +408 -0
- package/dist/agents/tasks/threat-modeling/randori-runner.js.map +1 -0
- package/dist/agents/tasks/threat-modeling/randori.d.ts +1 -0
- package/dist/agents/tasks/threat-modeling/randori.js +27 -200
- package/dist/agents/tasks/threat-modeling/randori.js.map +1 -1
- package/dist/agents/tasks/threat-modeling/resolve-randori.js +3 -3
- package/dist/agents/tasks/threat-modeling/resolve-randori.js.map +1 -1
- package/dist/agents/tasks/threat-modeling/types.d.ts +67 -0
- package/dist/agents/tasks/threat-modeling/types.js.map +1 -1
- package/dist/agents/tasks/threat-scenario-build.d.ts +1 -1
- package/dist/agents/tasks/threat-scenario-build.js +23 -8
- package/dist/agents/tasks/threat-scenario-build.js.map +1 -1
- package/dist/agents/tasks/tob-audit/resolve-tob-plugin.js +5 -5
- package/dist/agents/tasks/tob-audit/resolve-tob-plugin.js.map +1 -1
- package/dist/agents/tasks/tob-audit/tob-audit.d.ts +11 -2
- package/dist/agents/tasks/tob-audit/tob-audit.js +26 -52
- package/dist/agents/tasks/tob-audit/tob-audit.js.map +1 -1
- package/dist/agents/tasks/variant-analysis.js +10 -8
- package/dist/agents/tasks/variant-analysis.js.map +1 -1
- package/dist/agents/tasks/vuln-scout/resolve-vuln-scout.js +3 -3
- package/dist/agents/tasks/vuln-scout/resolve-vuln-scout.js.map +1 -1
- package/dist/agents/tasks/vuln-scout/vuln-scout.d.ts +10 -2
- package/dist/agents/tasks/vuln-scout/vuln-scout.js +26 -52
- package/dist/agents/tasks/vuln-scout/vuln-scout.js.map +1 -1
- package/dist/agents/tasks/xxe-detection.js +45 -18
- package/dist/agents/tasks/xxe-detection.js.map +1 -1
- package/dist/agents/types.d.ts +2 -2
- package/dist/analysis-support/code-intelligence.js +16 -12
- package/dist/analysis-support/code-intelligence.js.map +1 -1
- package/dist/analysis-support/index.d.ts +2 -2
- package/dist/analysis-support/index.js +2 -2
- package/dist/analysis-support/index.js.map +1 -1
- package/dist/analysis-support/simple-index.js +6 -6
- package/dist/analysis-support/simple-index.js.map +1 -1
- package/dist/banner.js +8 -6
- package/dist/banner.js.map +1 -1
- package/dist/bus/adapters/in-process.js +45 -14
- package/dist/bus/adapters/in-process.js.map +1 -1
- package/dist/bus/adapters/index.js +1 -2
- package/dist/bus/adapters/index.js.map +1 -1
- package/dist/bus/event-log.js +3 -3
- package/dist/bus/event-log.js.map +1 -1
- package/dist/bus/events.d.ts +17 -13
- package/dist/bus/index.d.ts +10 -9
- package/dist/bus/index.js +24 -21
- package/dist/bus/index.js.map +1 -1
- package/dist/bus/orchestrator/cheap-verify.js +15 -6
- package/dist/bus/orchestrator/cheap-verify.js.map +1 -1
- package/dist/bus/orchestrator/patch-dispatcher.d.ts +1 -1
- package/dist/bus/orchestrator/patch-dispatcher.js +3 -4
- package/dist/bus/orchestrator/patch-dispatcher.js.map +1 -1
- package/dist/bus/orchestrator/poc-dispatcher.d.ts +2 -2
- package/dist/bus/orchestrator/poc-dispatcher.js +7 -7
- package/dist/bus/orchestrator/poc-dispatcher.js.map +1 -1
- package/dist/bus/orchestrator/task-policy.js +8 -11
- package/dist/bus/orchestrator/task-policy.js.map +1 -1
- package/dist/bus/orchestrator/triage-dispatcher.d.ts +13 -3
- package/dist/bus/orchestrator/triage-dispatcher.js +150 -41
- package/dist/bus/orchestrator/triage-dispatcher.js.map +1 -1
- package/dist/bus/orchestrator/types.d.ts +6 -4
- package/dist/bus/orchestrator/verification-dispatcher.d.ts +2 -2
- package/dist/bus/orchestrator/verification-dispatcher.js +7 -5
- package/dist/bus/orchestrator/verification-dispatcher.js.map +1 -1
- package/dist/bus/orchestrator/verify-gate.js +14 -7
- package/dist/bus/orchestrator/verify-gate.js.map +1 -1
- package/dist/bus/orchestrator.d.ts +3 -1
- package/dist/bus/orchestrator.js +286 -136
- package/dist/bus/orchestrator.js.map +1 -1
- package/dist/bus/run-context.d.ts +15 -0
- package/dist/bus/run-context.js +8 -0
- package/dist/bus/run-context.js.map +1 -0
- package/dist/bus/task-execution.d.ts +2 -2
- package/dist/bus/task-execution.js +11 -2
- package/dist/bus/task-execution.js.map +1 -1
- package/dist/bus/workers/audit-worker.js.map +1 -1
- package/dist/bus/workers/blame-worker.d.ts +6 -0
- package/dist/bus/workers/blame-worker.js +26 -0
- package/dist/bus/workers/blame-worker.js.map +1 -0
- package/dist/bus/workers/dynamic-analysis-worker.js +41 -14
- package/dist/bus/workers/dynamic-analysis-worker.js.map +1 -1
- package/dist/bus/workers/github-worker.d.ts +1 -1
- package/dist/bus/workers/github-worker.js +18 -7
- package/dist/bus/workers/github-worker.js.map +1 -1
- package/dist/bus/workers/patch-verify-worker.d.ts +1 -1
- package/dist/bus/workers/patch-verify-worker.js +3 -3
- package/dist/bus/workers/patch-verify-worker.js.map +1 -1
- package/dist/bus/workers/patch-worker.d.ts +1 -1
- package/dist/bus/workers/patch-worker.js +2 -2
- package/dist/bus/workers/patch-worker.js.map +1 -1
- package/dist/bus/workers/poc-executor-worker.d.ts +1 -1
- package/dist/bus/workers/poc-executor-worker.js +1 -1
- package/dist/bus/workers/poc-executor-worker.js.map +1 -1
- package/dist/bus/workers/poc-harness-worker.js +6 -5
- package/dist/bus/workers/poc-harness-worker.js.map +1 -1
- package/dist/bus/workers/report-worker.d.ts +1 -1
- package/dist/bus/workers/report-worker.js +86 -47
- package/dist/bus/workers/report-worker.js.map +1 -1
- package/dist/bus/workers/scan-worker.d.ts +2 -2
- package/dist/bus/workers/scan-worker.js +8 -6
- package/dist/bus/workers/scan-worker.js.map +1 -1
- package/dist/bus/workers/store-worker.d.ts +1 -1
- package/dist/bus/workers/store-worker.js +17 -7
- package/dist/bus/workers/store-worker.js.map +1 -1
- package/dist/bus/workers/taint-analysis-artifact-worker.js +12 -2
- package/dist/bus/workers/taint-analysis-artifact-worker.js.map +1 -1
- package/dist/bus/workers/taint-analysis-refinement-worker.js +11 -10
- package/dist/bus/workers/taint-analysis-refinement-worker.js.map +1 -1
- package/dist/bus/workers/triage-worker.d.ts +3 -3
- package/dist/bus/workers/triage-worker.js +92 -39
- package/dist/bus/workers/triage-worker.js.map +1 -1
- package/dist/bus/workers/variant-analysis-worker.d.ts +1 -1
- package/dist/bus/workers/variant-analysis-worker.js +5 -5
- package/dist/bus/workers/variant-analysis-worker.js.map +1 -1
- package/dist/bus/workers/verification-worker.d.ts +2 -2
- package/dist/bus/workers/verification-worker.js +29 -18
- package/dist/bus/workers/verification-worker.js.map +1 -1
- package/dist/bypass-knowledge.js +7 -7
- package/dist/bypass-knowledge.js.map +1 -1
- package/dist/cache.js +1 -1
- package/dist/cache.js.map +1 -1
- package/dist/capabilities.d.ts +0 -2
- package/dist/capabilities.js +11 -11
- package/dist/capabilities.js.map +1 -1
- package/dist/cli/commands/monorepo-scan.js +26 -22
- package/dist/cli/commands/monorepo-scan.js.map +1 -1
- package/dist/cli/commands/scan.d.ts +8 -2
- package/dist/cli/commands/scan.js +108 -29
- package/dist/cli/commands/scan.js.map +1 -1
- package/dist/cli/create-module.d.ts +33 -0
- package/dist/cli/create-module.js +246 -0
- package/dist/cli/create-module.js.map +1 -0
- package/dist/cli/errors.d.ts +25 -0
- package/dist/cli/errors.js +44 -2
- package/dist/cli/errors.js.map +1 -1
- package/dist/cli/pi-ai.d.ts +0 -4
- package/dist/cli/pi-ai.js +10 -17
- package/dist/cli/pi-ai.js.map +1 -1
- package/dist/cli/preflight.d.ts +34 -0
- package/dist/cli/preflight.js +163 -0
- package/dist/cli/preflight.js.map +1 -0
- package/dist/cli/scan-config.d.ts +1 -0
- package/dist/cli/scan-config.js +8 -9
- package/dist/cli/scan-config.js.map +1 -1
- package/dist/cli/shared.js +4 -4
- package/dist/cli/shared.js.map +1 -1
- package/dist/cli.js +487 -29
- package/dist/cli.js.map +1 -1
- package/dist/confidence-calibration.d.ts +0 -11
- package/dist/confidence-calibration.js +25 -50
- package/dist/confidence-calibration.js.map +1 -1
- package/dist/config/defaults.d.ts +0 -1
- package/dist/config/defaults.js +11 -8
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/docs.d.ts +24 -0
- package/dist/config/docs.js +134 -0
- package/dist/config/docs.js.map +1 -0
- package/dist/config/paths.d.ts +0 -3
- package/dist/config/paths.js +2 -11
- package/dist/config/paths.js.map +1 -1
- package/dist/config/presets.js +6 -7
- package/dist/config/presets.js.map +1 -1
- package/dist/config/validation.js +9 -5
- package/dist/config/validation.js.map +1 -1
- package/dist/config-io.js +1 -1
- package/dist/config-io.js.map +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.js +48 -48
- package/dist/config.js.map +1 -1
- package/dist/copilot/core.d.ts +21 -3
- package/dist/copilot/core.js +220 -14
- package/dist/copilot/core.js.map +1 -1
- package/dist/copilot/index.d.ts +3 -3
- package/dist/copilot/index.js.map +1 -1
- package/dist/copilot/run.d.ts +1 -1
- package/dist/copilot/run.js +1 -4
- package/dist/copilot/run.js.map +1 -1
- package/dist/copilot/shell.d.ts +70 -2
- package/dist/copilot/shell.js +1447 -408
- package/dist/copilot/shell.js.map +1 -1
- package/dist/crypto-behavioral/harness-generator.js +2 -1
- package/dist/crypto-behavioral/harness-generator.js.map +1 -1
- package/dist/crypto-behavioral/harness-prompts.js +22 -23
- package/dist/crypto-behavioral/harness-prompts.js.map +1 -1
- package/dist/crypto-behavioral/index.d.ts +2 -2
- package/dist/crypto-behavioral/index.js +2 -2
- package/dist/crypto-behavioral/index.js.map +1 -1
- package/dist/crypto-behavioral/result-parser.js +14 -4
- package/dist/crypto-behavioral/result-parser.js.map +1 -1
- package/dist/discovery/adapters/bazel-adapter.js +1 -6
- package/dist/discovery/adapters/bazel-adapter.js.map +1 -1
- package/dist/discovery/adapters/go-adapter.js +1 -3
- package/dist/discovery/adapters/go-adapter.js.map +1 -1
- package/dist/discovery/adapters/msvs-adapter.js.map +1 -1
- package/dist/discovery/adapters/native-adapter.js.map +1 -1
- package/dist/discovery/adapters/node-adapter.js +5 -7
- package/dist/discovery/adapters/node-adapter.js.map +1 -1
- package/dist/discovery/adapters/rust-adapter.js +4 -3
- package/dist/discovery/adapters/rust-adapter.js.map +1 -1
- package/dist/discovery/graph.js +21 -12
- package/dist/discovery/graph.js.map +1 -1
- package/dist/discovery/helpers.js +9 -4
- package/dist/discovery/helpers.js.map +1 -1
- package/dist/discovery/llm-refinement.d.ts +1 -1
- package/dist/discovery/llm-refinement.js +9 -9
- package/dist/discovery/llm-refinement.js.map +1 -1
- package/dist/discovery/repo-discovery.js +4 -4
- package/dist/discovery/repo-discovery.js.map +1 -1
- package/dist/discovery/workspace-clustering.js +5 -7
- package/dist/discovery/workspace-clustering.js.map +1 -1
- package/dist/errors.d.ts +0 -12
- package/dist/errors.js +2 -2
- package/dist/errors.js.map +1 -1
- package/dist/findings/taint-path.js +1 -4
- package/dist/findings/taint-path.js.map +1 -1
- package/dist/fuzz/crashes.d.ts +51 -0
- package/dist/fuzz/crashes.js +153 -0
- package/dist/fuzz/crashes.js.map +1 -0
- package/dist/fuzz/runners.d.ts +76 -0
- package/dist/fuzz/runners.js +344 -0
- package/dist/fuzz/runners.js.map +1 -0
- package/dist/fuzz/sandbox.d.ts +79 -0
- package/dist/fuzz/sandbox.js +232 -0
- package/dist/fuzz/sandbox.js.map +1 -0
- package/dist/git/blame.d.ts +11 -0
- package/dist/git/blame.js +49 -0
- package/dist/git/blame.js.map +1 -0
- package/dist/governance/audit.d.ts +17 -0
- package/dist/governance/audit.js +31 -0
- package/dist/governance/audit.js.map +1 -0
- package/dist/governance/enforcer.d.ts +38 -0
- package/dist/governance/enforcer.js +158 -0
- package/dist/governance/enforcer.js.map +1 -0
- package/dist/governance/types.d.ts +76 -0
- package/dist/governance/types.js +26 -0
- package/dist/governance/types.js.map +1 -0
- package/dist/hooks/chain.d.ts +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/loader.js +1 -1
- package/dist/hooks/loader.js.map +1 -1
- package/dist/http-agent.d.ts +0 -5
- package/dist/http-agent.js +5 -2
- package/dist/http-agent.js.map +1 -1
- package/dist/incremental.d.ts +0 -9
- package/dist/incremental.js +10 -4
- package/dist/incremental.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/intel/cve-feed.d.ts +85 -0
- package/dist/intel/cve-feed.js +280 -0
- package/dist/intel/cve-feed.js.map +1 -0
- package/dist/intel/store.d.ts +22 -0
- package/dist/intel/store.js +169 -0
- package/dist/intel/store.js.map +1 -0
- package/dist/intel/types.d.ts +57 -0
- package/dist/intel/types.js +8 -0
- package/dist/intel/types.js.map +1 -0
- package/dist/knowledge/index.d.ts +1 -1
- package/dist/knowledge/index.js +13 -9
- package/dist/knowledge/index.js.map +1 -1
- package/dist/knowledge/modules/auth-bypass.js +56 -12
- package/dist/knowledge/modules/auth-bypass.js.map +1 -1
- package/dist/knowledge/modules/command-injection.js +41 -10
- package/dist/knowledge/modules/command-injection.js.map +1 -1
- package/dist/knowledge/modules/crypto.js +64 -13
- package/dist/knowledge/modules/crypto.js.map +1 -1
- package/dist/knowledge/modules/deserialization.js +40 -10
- package/dist/knowledge/modules/deserialization.js.map +1 -1
- package/dist/knowledge/modules/file-upload.js +38 -9
- package/dist/knowledge/modules/file-upload.js.map +1 -1
- package/dist/knowledge/modules/idor.js +47 -12
- package/dist/knowledge/modules/idor.js.map +1 -1
- package/dist/knowledge/modules/n-day-patterns.d.ts +8 -0
- package/dist/knowledge/modules/n-day-patterns.js +179 -0
- package/dist/knowledge/modules/n-day-patterns.js.map +1 -0
- package/dist/knowledge/modules/nosql-injection.js +46 -10
- package/dist/knowledge/modules/nosql-injection.js.map +1 -1
- package/dist/knowledge/modules/parser-attack-surface.d.ts +10 -0
- package/dist/knowledge/modules/parser-attack-surface.js +200 -0
- package/dist/knowledge/modules/parser-attack-surface.js.map +1 -0
- package/dist/knowledge/modules/path-traversal.js +36 -8
- package/dist/knowledge/modules/path-traversal.js.map +1 -1
- package/dist/knowledge/modules/race-condition.js +48 -10
- package/dist/knowledge/modules/race-condition.js.map +1 -1
- package/dist/knowledge/modules/sqli.js +50 -10
- package/dist/knowledge/modules/sqli.js.map +1 -1
- package/dist/knowledge/modules/ssrf.js +44 -9
- package/dist/knowledge/modules/ssrf.js.map +1 -1
- package/dist/knowledge/modules/xss.js +46 -10
- package/dist/knowledge/modules/xss.js.map +1 -1
- package/dist/knowledge/modules/xxe.js +47 -12
- package/dist/knowledge/modules/xxe.js.map +1 -1
- package/dist/knowledge/registry.js.map +1 -1
- package/dist/logger.d.ts +5 -0
- package/dist/logger.js +46 -4
- package/dist/logger.js.map +1 -1
- package/dist/migrations/100_schema_reset.d.ts +25 -0
- package/dist/migrations/100_schema_reset.js +381 -0
- package/dist/migrations/100_schema_reset.js.map +1 -0
- package/dist/migrations/index.d.ts +10 -2
- package/dist/migrations/index.js +11 -51
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/runner.d.ts +4 -1
- package/dist/migrations/runner.js +5 -116
- package/dist/migrations/runner.js.map +1 -1
- package/dist/modules/core-prompt-armor.d.ts +33 -0
- package/dist/modules/core-prompt-armor.js +316 -0
- package/dist/modules/core-prompt-armor.js.map +1 -0
- package/dist/modules/core-randori.d.ts +29 -0
- package/dist/modules/core-randori.js +282 -0
- package/dist/modules/core-randori.js.map +1 -0
- package/dist/modules/core-sast.d.ts +1 -0
- package/dist/modules/core-sast.js +737 -95
- package/dist/modules/core-sast.js.map +1 -1
- package/dist/modules/core-shinsa.d.ts +37 -0
- package/dist/modules/core-shinsa.js +259 -0
- package/dist/modules/core-shinsa.js.map +1 -0
- package/dist/modules/core-tob.d.ts +23 -0
- package/dist/modules/core-tob.js +220 -0
- package/dist/modules/core-tob.js.map +1 -0
- package/dist/modules/core-vuln-scout.d.ts +23 -0
- package/dist/modules/core-vuln-scout.js +149 -0
- package/dist/modules/core-vuln-scout.js.map +1 -0
- package/dist/modules/index.d.ts +4 -2
- package/dist/modules/index.js +3 -1
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/loader.d.ts +31 -0
- package/dist/modules/loader.js +138 -0
- package/dist/modules/loader.js.map +1 -0
- package/dist/modules/mcp-bridge.d.ts +21 -0
- package/dist/modules/mcp-bridge.js +317 -0
- package/dist/modules/mcp-bridge.js.map +1 -0
- package/dist/modules/n-day-diff-hunter.d.ts +128 -0
- package/dist/modules/n-day-diff-hunter.js +550 -0
- package/dist/modules/n-day-diff-hunter.js.map +1 -0
- package/dist/modules/registry.d.ts +2 -2
- package/dist/modules/types.d.ts +6 -1
- package/dist/modules/variant-hunter.d.ts +66 -0
- package/dist/modules/variant-hunter.js +385 -0
- package/dist/modules/variant-hunter.js.map +1 -0
- package/dist/monorepo/architectural-analysis.js +48 -25
- package/dist/monorepo/architectural-analysis.js.map +1 -1
- package/dist/monorepo/attack-surface.js +47 -22
- package/dist/monorepo/attack-surface.js.map +1 -1
- package/dist/monorepo/boundary-manifest.d.ts +1 -1
- package/dist/monorepo/boundary-manifest.js +14 -8
- package/dist/monorepo/boundary-manifest.js.map +1 -1
- package/dist/monorepo/budget-controller.js +4 -5
- package/dist/monorepo/budget-controller.js.map +1 -1
- package/dist/monorepo/context-index.js +18 -3
- package/dist/monorepo/context-index.js.map +1 -1
- package/dist/monorepo/cross-module-tracing.js +1 -1
- package/dist/monorepo/cross-module-tracing.js.map +1 -1
- package/dist/monorepo/dependency-graph.js +9 -6
- package/dist/monorepo/dependency-graph.js.map +1 -1
- package/dist/monorepo/types.d.ts +1 -1
- package/dist/multi-agent-triage.d.ts +1 -1
- package/dist/multi-agent-triage.js +14 -9
- package/dist/multi-agent-triage.js.map +1 -1
- package/dist/operator-context.d.ts +24 -0
- package/dist/operator-context.js +341 -0
- package/dist/operator-context.js.map +1 -0
- package/dist/parameter-risk.js +74 -13
- package/dist/parameter-risk.js.map +1 -1
- package/dist/patch.js +17 -11
- package/dist/patch.js.map +1 -1
- package/dist/poc-executor/docker.js +12 -6
- package/dist/poc-executor/docker.js.map +1 -1
- package/dist/poc-executor/index.d.ts +1 -1
- package/dist/poc-executor/index.js +1 -1
- package/dist/poc-executor/index.js.map +1 -1
- package/dist/poc-executor/process.js.map +1 -1
- package/dist/poc-harness.js +40 -39
- package/dist/poc-harness.js.map +1 -1
- package/dist/precedents.js +1 -2
- package/dist/precedents.js.map +1 -1
- package/dist/prompts/bootstrap.js +5 -8
- package/dist/prompts/bootstrap.js.map +1 -1
- package/dist/prompts/context.js +1 -1
- package/dist/prompts/context.js.map +1 -1
- package/dist/prompts/index.d.ts +7 -7
- package/dist/prompts/index.js +5 -5
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/language-tuning.js +1 -5
- package/dist/prompts/language-tuning.js.map +1 -1
- package/dist/prompts/languages/c-cpp.js +169 -44
- package/dist/prompts/languages/c-cpp.js.map +1 -1
- package/dist/prompts/languages/go.js +112 -28
- package/dist/prompts/languages/go.js.map +1 -1
- package/dist/prompts/languages/index.js +3 -3
- package/dist/prompts/languages/index.js.map +1 -1
- package/dist/prompts/languages/java-kotlin.js +220 -52
- package/dist/prompts/languages/java-kotlin.js.map +1 -1
- package/dist/prompts/languages/javascript-typescript.js +326 -72
- package/dist/prompts/languages/javascript-typescript.js.map +1 -1
- package/dist/prompts/languages/php.js +138 -44
- package/dist/prompts/languages/php.js.map +1 -1
- package/dist/prompts/languages/python.js +162 -41
- package/dist/prompts/languages/python.js.map +1 -1
- package/dist/prompts/languages/ruby.js +105 -35
- package/dist/prompts/languages/ruby.js.map +1 -1
- package/dist/prompts/languages/rust.js +69 -19
- package/dist/prompts/languages/rust.js.map +1 -1
- package/dist/prompts/modules.js +2 -5
- package/dist/prompts/modules.js.map +1 -1
- package/dist/prompts/prompt-report.js.map +1 -1
- package/dist/prompts/sanitize.js +34 -17
- package/dist/prompts/sanitize.js.map +1 -1
- package/dist/prompts/templates/triage.d.ts +3 -3
- package/dist/prompts/templates/triage.js +37 -7
- package/dist/prompts/templates/triage.js.map +1 -1
- package/dist/prompts/templates/verify.d.ts +5 -5
- package/dist/prompts/templates/verify.js +49 -10
- package/dist/prompts/templates/verify.js.map +1 -1
- package/dist/prompts/tool-policy.js.map +1 -1
- package/dist/quality-gate-types.d.ts +26 -0
- package/dist/quality-gate-types.js +8 -0
- package/dist/quality-gate-types.js.map +1 -0
- package/dist/quality-gate.d.ts +2 -20
- package/dist/quality-gate.js +2 -4
- package/dist/quality-gate.js.map +1 -1
- package/dist/repo-context.js +8 -12
- package/dist/repo-context.js.map +1 -1
- package/dist/report-csv.js +1 -1
- package/dist/report-csv.js.map +1 -1
- package/dist/report-json.d.ts +1 -1
- package/dist/report-json.js +17 -2
- package/dist/report-json.js.map +1 -1
- package/dist/report-jsonl.js +1 -1
- package/dist/report-jsonl.js.map +1 -1
- package/dist/report-junit.d.ts +28 -0
- package/dist/report-junit.js +103 -0
- package/dist/report-junit.js.map +1 -0
- package/dist/report-markdown.d.ts +1 -1
- package/dist/report-markdown.js +121 -19
- package/dist/report-markdown.js.map +1 -1
- package/dist/report-monorepo.js +5 -4
- package/dist/report-monorepo.js.map +1 -1
- package/dist/report-sarif.d.ts +1 -1
- package/dist/report-sarif.js +60 -23
- package/dist/report-sarif.js.map +1 -1
- package/dist/report.d.ts +3 -3
- package/dist/report.js +36 -19
- package/dist/report.js.map +1 -1
- package/dist/retry.js +3 -5
- package/dist/retry.js.map +1 -1
- package/dist/scan-opts.d.ts +21 -0
- package/dist/scan-opts.js +9 -0
- package/dist/scan-opts.js.map +1 -0
- package/dist/scanner-cache.js +10 -6
- package/dist/scanner-cache.js.map +1 -1
- package/dist/scanners/agentic.d.ts +1 -1
- package/dist/scanners/agentic.js.map +1 -1
- package/dist/scanners/codeql.d.ts +1 -1
- package/dist/scanners/codeql.js +4 -2
- package/dist/scanners/codeql.js.map +1 -1
- package/dist/scanners/dedup.d.ts +5 -0
- package/dist/scanners/dedup.js +102 -72
- package/dist/scanners/dedup.js.map +1 -1
- package/dist/scanners/design-decision-classifier.d.ts +1 -1
- package/dist/scanners/design-decision-classifier.js +1 -1
- package/dist/scanners/design-decision-classifier.js.map +1 -1
- package/dist/scanners/finding-selection.js.map +1 -1
- package/dist/scanners/fp-filter.js +9 -9
- package/dist/scanners/fp-filter.js.map +1 -1
- package/dist/scanners/index.d.ts +1 -1
- package/dist/scanners/index.js +3 -3
- package/dist/scanners/index.js.map +1 -1
- package/dist/scanners/llm-rescore.js +5 -3
- package/dist/scanners/llm-rescore.js.map +1 -1
- package/dist/scanners/normalization.d.ts +1 -1
- package/dist/scanners/normalization.js +1 -4
- package/dist/scanners/normalization.js.map +1 -1
- package/dist/scanners/normalize-findings.js +3 -7
- package/dist/scanners/normalize-findings.js.map +1 -1
- package/dist/scanners/registry.d.ts +1 -1
- package/dist/scanners/registry.js +3 -9
- package/dist/scanners/registry.js.map +1 -1
- package/dist/scanners/resolve-codeql.js.map +1 -1
- package/dist/scanners/resolve-semgrep.js +7 -7
- package/dist/scanners/resolve-semgrep.js.map +1 -1
- package/dist/scanners/run-agentic.d.ts +20 -2
- package/dist/scanners/run-agentic.js +20 -7
- package/dist/scanners/run-agentic.js.map +1 -1
- package/dist/scanners/run-codeql.js +42 -42
- package/dist/scanners/run-codeql.js.map +1 -1
- package/dist/scanners/run-semgrep.js +4 -9
- package/dist/scanners/run-semgrep.js.map +1 -1
- package/dist/scanners/scoring.js.map +1 -1
- package/dist/scanners/semgrep.d.ts +1 -1
- package/dist/scanners/semgrep.js +1 -1
- package/dist/scanners/semgrep.js.map +1 -1
- package/dist/scanners/types.d.ts +8 -3
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/rate-limit-registry.js +3 -4
- package/dist/scheduler/rate-limit-registry.js.map +1 -1
- package/dist/schemas.d.ts +160 -16
- package/dist/schemas.js +145 -48
- package/dist/schemas.js.map +1 -1
- package/dist/scoring/composite-confidence.d.ts +0 -10
- package/dist/scoring/composite-confidence.js +4 -5
- package/dist/scoring/composite-confidence.js.map +1 -1
- package/dist/scoring/prompt-versioning.js +1 -1
- package/dist/scoring/prompt-versioning.js.map +1 -1
- package/dist/scoring/run-metrics-types.d.ts +83 -0
- package/dist/scoring/run-metrics-types.js +9 -0
- package/dist/scoring/run-metrics-types.js.map +1 -0
- package/dist/scoring/run-metrics.d.ts +3 -77
- package/dist/scoring/run-metrics.js.map +1 -1
- package/dist/scoring/triage-assertions.d.ts +0 -60
- package/dist/scoring/triage-assertions.js +28 -30
- package/dist/scoring/triage-assertions.js.map +1 -1
- package/dist/security-profiles.js.map +1 -1
- package/dist/store/crypto-behavioral.js +4 -2
- package/dist/store/crypto-behavioral.js.map +1 -1
- package/dist/store/dynamic-analysis.js +8 -4
- package/dist/store/dynamic-analysis.js.map +1 -1
- package/dist/store/patch-results.js +8 -4
- package/dist/store/patch-results.js.map +1 -1
- package/dist/store.d.ts +46 -28
- package/dist/store.js +592 -154
- package/dist/store.js.map +1 -1
- package/dist/strategies/auto-rule.d.ts +1 -1
- package/dist/strategies/auto-rule.js +25 -14
- package/dist/strategies/auto-rule.js.map +1 -1
- package/dist/strategies/cwe-strategy-map.js +13 -17
- package/dist/strategies/cwe-strategy-map.js.map +1 -1
- package/dist/strategies/dataflow/index.js +18 -9
- package/dist/strategies/dataflow/index.js.map +1 -1
- package/dist/strategies/execution/index.js +16 -10
- package/dist/strategies/execution/index.js.map +1 -1
- package/dist/strategies/executor.d.ts +1 -1
- package/dist/strategies/executor.js +5 -3
- package/dist/strategies/executor.js.map +1 -1
- package/dist/strategies/index.d.ts +4 -4
- package/dist/strategies/index.js +3 -3
- package/dist/strategies/index.js.map +1 -1
- package/dist/strategies/init.js +3 -3
- package/dist/strategies/init.js.map +1 -1
- package/dist/strategies/merge.d.ts +1 -1
- package/dist/strategies/merge.js +11 -9
- package/dist/strategies/merge.js.map +1 -1
- package/dist/strategies/multi-strategy-task.d.ts +1 -1
- package/dist/strategies/multi-strategy-task.js.map +1 -1
- package/dist/strategies/reasoning/index.js +41 -15
- package/dist/strategies/reasoning/index.js.map +1 -1
- package/dist/strategies/rule-persistence.js +1 -1
- package/dist/strategies/rule-persistence.js.map +1 -1
- package/dist/strategies/syntactic/index.js +86 -22
- package/dist/strategies/syntactic/index.js.map +1 -1
- package/dist/strategies/task-profile-map.js.map +1 -1
- package/dist/strategies/types.d.ts +1 -1
- package/dist/streaming.js +1 -1
- package/dist/streaming.js.map +1 -1
- package/dist/task-output-meta.js.map +1 -1
- package/dist/testing/index.d.ts +40 -0
- package/dist/testing/index.js +74 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/threat-model-renderer.d.ts +29 -0
- package/dist/threat-model-renderer.js +302 -0
- package/dist/threat-model-renderer.js.map +1 -0
- package/dist/trajectory-memory.d.ts +0 -10
- package/dist/trajectory-memory.js +27 -44
- package/dist/trajectory-memory.js.map +1 -1
- package/dist/triage.d.ts +290 -0
- package/dist/triage.js +360 -38
- package/dist/triage.js.map +1 -1
- package/dist/types.d.ts +173 -26
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/ui/App.js +29 -18
- package/dist/ui/App.js.map +1 -1
- package/dist/ui/components/AgentActivity.d.ts +6 -7
- package/dist/ui/components/AgentActivity.js +23 -15
- package/dist/ui/components/AgentActivity.js.map +1 -1
- package/dist/ui/components/AnimatedCounter.d.ts +1 -1
- package/dist/ui/components/AnimatedCounter.js +3 -3
- package/dist/ui/components/AnimatedCounter.js.map +1 -1
- package/dist/ui/components/AttackChainDiagram.js +26 -23
- package/dist/ui/components/AttackChainDiagram.js.map +1 -1
- package/dist/ui/components/Banner.d.ts +1 -1
- package/dist/ui/components/Banner.js +8 -6
- package/dist/ui/components/Banner.js.map +1 -1
- package/dist/ui/components/CodePreview.d.ts +5 -12
- package/dist/ui/components/CodePreview.js +20 -17
- package/dist/ui/components/CodePreview.js.map +1 -1
- package/dist/ui/components/CommandInput.d.ts +5 -4
- package/dist/ui/components/CommandInput.js +53 -45
- package/dist/ui/components/CommandInput.js.map +1 -1
- package/dist/ui/components/CompactHeader.d.ts +1 -1
- package/dist/ui/components/CompactHeader.js +3 -3
- package/dist/ui/components/CompactHeader.js.map +1 -1
- package/dist/ui/components/ConfigBanner.d.ts +4 -9
- package/dist/ui/components/ConfigBanner.js +20 -10
- package/dist/ui/components/ConfigBanner.js.map +1 -1
- package/dist/ui/components/ConfigConfirm.d.ts +4 -11
- package/dist/ui/components/ConfigConfirm.js +43 -12
- package/dist/ui/components/ConfigConfirm.js.map +1 -1
- package/dist/ui/components/ContextIntake.d.ts +18 -0
- package/dist/ui/components/ContextIntake.js +311 -0
- package/dist/ui/components/ContextIntake.js.map +1 -0
- package/dist/ui/components/CopilotShell.d.ts +8 -5
- package/dist/ui/components/CopilotShell.js +86 -37
- package/dist/ui/components/CopilotShell.js.map +1 -1
- package/dist/ui/components/CredentialPrompt.d.ts +6 -20
- package/dist/ui/components/CredentialPrompt.js +54 -80
- package/dist/ui/components/CredentialPrompt.js.map +1 -1
- package/dist/ui/components/DiffView.d.ts +3 -8
- package/dist/ui/components/DiffView.js +20 -13
- package/dist/ui/components/DiffView.js.map +1 -1
- package/dist/ui/components/ErrorCard.d.ts +15 -10
- package/dist/ui/components/ErrorCard.js +22 -11
- package/dist/ui/components/ErrorCard.js.map +1 -1
- package/dist/ui/components/ExportActions.d.ts +2 -2
- package/dist/ui/components/ExportActions.js +23 -15
- package/dist/ui/components/ExportActions.js.map +1 -1
- package/dist/ui/components/FindingCard.d.ts +1 -1
- package/dist/ui/components/FindingCard.js +104 -32
- package/dist/ui/components/FindingCard.js.map +1 -1
- package/dist/ui/components/InteractiveReview.d.ts +2 -2
- package/dist/ui/components/InteractiveReview.js +13 -5
- package/dist/ui/components/InteractiveReview.js.map +1 -1
- package/dist/ui/components/MonorepoProgress.d.ts +6 -11
- package/dist/ui/components/MonorepoProgress.js +35 -22
- package/dist/ui/components/MonorepoProgress.js.map +1 -1
- package/dist/ui/components/NoticeRail.d.ts +1 -1
- package/dist/ui/components/NoticeRail.js +12 -13
- package/dist/ui/components/NoticeRail.js.map +1 -1
- package/dist/ui/components/PipelineIndicator.d.ts +1 -1
- package/dist/ui/components/PipelineIndicator.js +109 -88
- package/dist/ui/components/PipelineIndicator.js.map +1 -1
- package/dist/ui/components/ProgressBar.d.ts +4 -1
- package/dist/ui/components/ProgressBar.js +15 -5
- package/dist/ui/components/ProgressBar.js.map +1 -1
- package/dist/ui/components/QualityGate.d.ts +1 -1
- package/dist/ui/components/QualityGate.js +7 -4
- package/dist/ui/components/QualityGate.js.map +1 -1
- package/dist/ui/components/ResultLine.d.ts +3 -7
- package/dist/ui/components/ResultLine.js +19 -12
- package/dist/ui/components/ResultLine.js.map +1 -1
- package/dist/ui/components/ResumeDiff.d.ts +1 -10
- package/dist/ui/components/ResumeDiff.js +11 -7
- package/dist/ui/components/ResumeDiff.js.map +1 -1
- package/dist/ui/components/ScanSummary.d.ts +1 -1
- package/dist/ui/components/ScanSummary.js +64 -23
- package/dist/ui/components/ScanSummary.js.map +1 -1
- package/dist/ui/components/SectionBox.d.ts +1 -1
- package/dist/ui/components/SectionBox.js +6 -2
- package/dist/ui/components/SectionBox.js.map +1 -1
- package/dist/ui/components/SetupWizard.d.ts +5 -14
- package/dist/ui/components/SetupWizard.js +117 -78
- package/dist/ui/components/SetupWizard.js.map +1 -1
- package/dist/ui/components/Spinner.d.ts +4 -2
- package/dist/ui/components/Spinner.js +11 -4
- package/dist/ui/components/Spinner.js.map +1 -1
- package/dist/ui/components/StageHeader.d.ts +1 -1
- package/dist/ui/components/StageHeader.js +14 -9
- package/dist/ui/components/StageHeader.js.map +1 -1
- package/dist/ui/components/StatusFooter.d.ts +3 -2
- package/dist/ui/components/StatusFooter.js +14 -21
- package/dist/ui/components/StatusFooter.js.map +1 -1
- package/dist/ui/components/ThreatModelEditor.d.ts +17 -0
- package/dist/ui/components/ThreatModelEditor.js +155 -0
- package/dist/ui/components/ThreatModelEditor.js.map +1 -0
- package/dist/ui/components/TrophyScreen.d.ts +5 -5
- package/dist/ui/components/TrophyScreen.js +47 -21
- package/dist/ui/components/TrophyScreen.js.map +1 -1
- package/dist/ui/demo.js +89 -21
- package/dist/ui/demo.js.map +1 -1
- package/dist/ui/error-format.d.ts +26 -0
- package/dist/ui/error-format.js +103 -0
- package/dist/ui/error-format.js.map +1 -0
- package/dist/ui/format.d.ts +50 -3
- package/dist/ui/format.js +114 -20
- package/dist/ui/format.js.map +1 -1
- package/dist/ui/hooks/useBoundedIndex.d.ts +13 -0
- package/dist/ui/hooks/useBoundedIndex.js +66 -0
- package/dist/ui/hooks/useBoundedIndex.js.map +1 -0
- package/dist/ui/hooks/useCursorVisibility.d.ts +5 -0
- package/dist/ui/hooks/useCursorVisibility.js +50 -0
- package/dist/ui/hooks/useCursorVisibility.js.map +1 -0
- package/dist/ui/hooks/useExpanded.d.ts +12 -0
- package/dist/ui/hooks/useExpanded.js +38 -0
- package/dist/ui/hooks/useExpanded.js.map +1 -0
- package/dist/ui/hooks/useFocusTrap.d.ts +5 -0
- package/dist/ui/hooks/useFocusTrap.js +36 -0
- package/dist/ui/hooks/useFocusTrap.js.map +1 -0
- package/dist/ui/hooks/useKeybindings.d.ts +27 -0
- package/dist/ui/hooks/useKeybindings.js +67 -0
- package/dist/ui/hooks/useKeybindings.js.map +1 -0
- package/dist/ui/hooks/useTerminalSize.d.ts +5 -0
- package/dist/ui/hooks/useTerminalSize.js +43 -0
- package/dist/ui/hooks/useTerminalSize.js.map +1 -0
- package/dist/ui/hooks.d.ts +23 -1
- package/dist/ui/hooks.js +27 -1
- package/dist/ui/hooks.js.map +1 -1
- package/dist/ui/hyperlink.d.ts +9 -0
- package/dist/ui/hyperlink.js +1 -1
- package/dist/ui/hyperlink.js.map +1 -1
- package/dist/ui/icons.d.ts +4 -4
- package/dist/ui/icons.js +5 -5
- package/dist/ui/icons.js.map +1 -1
- package/dist/ui/markdown.js.map +1 -1
- package/dist/ui/monorepo-render.js +5 -6
- package/dist/ui/monorepo-render.js.map +1 -1
- package/dist/ui/notify.js +4 -1
- package/dist/ui/notify.js.map +1 -1
- package/dist/ui/output.js +4 -4
- package/dist/ui/output.js.map +1 -1
- package/dist/ui/plain-renderer.js +79 -50
- package/dist/ui/plain-renderer.js.map +1 -1
- package/dist/ui/primitives/Breadcrumb.d.ts +9 -0
- package/dist/ui/primitives/Breadcrumb.js +38 -0
- package/dist/ui/primitives/Breadcrumb.js.map +1 -0
- package/dist/ui/primitives/ConfirmDialog.d.ts +11 -0
- package/dist/ui/primitives/ConfirmDialog.js +36 -0
- package/dist/ui/primitives/ConfirmDialog.js.map +1 -0
- package/dist/ui/primitives/Divider.d.ts +12 -0
- package/dist/ui/primitives/Divider.js +27 -0
- package/dist/ui/primitives/Divider.js.map +1 -0
- package/dist/ui/primitives/ExpandableSection.d.ts +14 -0
- package/dist/ui/primitives/ExpandableSection.js +22 -0
- package/dist/ui/primitives/ExpandableSection.js.map +1 -0
- package/dist/ui/primitives/KeybindFooter.d.ts +7 -0
- package/dist/ui/primitives/KeybindFooter.js +31 -0
- package/dist/ui/primitives/KeybindFooter.js.map +1 -0
- package/dist/ui/primitives/MultilineText.d.ts +19 -0
- package/dist/ui/primitives/MultilineText.js +22 -0
- package/dist/ui/primitives/MultilineText.js.map +1 -0
- package/dist/ui/primitives/SelectList.d.ts +30 -0
- package/dist/ui/primitives/SelectList.js +80 -0
- package/dist/ui/primitives/SelectList.js.map +1 -0
- package/dist/ui/primitives/Table.d.ts +22 -0
- package/dist/ui/primitives/Table.js +114 -0
- package/dist/ui/primitives/Table.js.map +1 -0
- package/dist/ui/primitives/TextInput.d.ts +15 -0
- package/dist/ui/primitives/TextInput.js +46 -0
- package/dist/ui/primitives/TextInput.js.map +1 -0
- package/dist/ui/primitives/index.d.ts +22 -0
- package/dist/ui/primitives/index.js +14 -0
- package/dist/ui/primitives/index.js.map +1 -0
- package/dist/ui/render.d.ts +6 -0
- package/dist/ui/render.js +44 -1
- package/dist/ui/render.js.map +1 -1
- package/dist/ui/repl.d.ts +1 -1
- package/dist/ui/repl.js +6 -0
- package/dist/ui/repl.js.map +1 -1
- package/dist/ui/review.d.ts +2 -2
- package/dist/ui/review.js +11 -2
- package/dist/ui/review.js.map +1 -1
- package/dist/ui/setup.d.ts +30 -4
- package/dist/ui/setup.js +81 -10
- package/dist/ui/setup.js.map +1 -1
- package/dist/ui/state.d.ts +116 -5
- package/dist/ui/state.js +139 -17
- package/dist/ui/state.js.map +1 -1
- package/dist/ui/summary-data.d.ts +1 -1
- package/dist/ui/summary-data.js +34 -3
- package/dist/ui/summary-data.js.map +1 -1
- package/dist/ui/theme.js +7 -13
- package/dist/ui/theme.js.map +1 -1
- package/dist/ui/tokens.d.ts +61 -0
- package/dist/ui/tokens.js +105 -0
- package/dist/ui/tokens.js.map +1 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/verify.d.ts +156 -0
- package/dist/verify.js +150 -38
- package/dist/verify.js.map +1 -1
- package/dist/workspace/manager.d.ts +19 -0
- package/dist/workspace/manager.js +112 -0
- package/dist/workspace/manager.js.map +1 -0
- package/dist/workspace/types.d.ts +15 -0
- package/dist/workspace/types.js +2 -0
- package/dist/workspace/types.js.map +1 -0
- package/package.json +51 -26
- package/dist/migrations/001_initial_schema.d.ts +0 -7
- package/dist/migrations/001_initial_schema.js +0 -50
- package/dist/migrations/001_initial_schema.js.map +0 -1
- package/dist/migrations/002_add_scanner_column.d.ts +0 -3
- package/dist/migrations/002_add_scanner_column.js +0 -14
- package/dist/migrations/002_add_scanner_column.js.map +0 -1
- package/dist/migrations/003_add_triage_cost_column.d.ts +0 -3
- package/dist/migrations/003_add_triage_cost_column.js +0 -12
- package/dist/migrations/003_add_triage_cost_column.js.map +0 -1
- package/dist/migrations/004_add_triage_details_column.d.ts +0 -3
- package/dist/migrations/004_add_triage_details_column.js +0 -12
- package/dist/migrations/004_add_triage_details_column.js.map +0 -1
- package/dist/migrations/005_add_verification_columns.d.ts +0 -3
- package/dist/migrations/005_add_verification_columns.js +0 -24
- package/dist/migrations/005_add_verification_columns.js.map +0 -1
- package/dist/migrations/006_add_poc_harness_columns.d.ts +0 -3
- package/dist/migrations/006_add_poc_harness_columns.js +0 -24
- package/dist/migrations/006_add_poc_harness_columns.js.map +0 -1
- package/dist/migrations/007_add_poc_execution_columns.d.ts +0 -3
- package/dist/migrations/007_add_poc_execution_columns.js +0 -22
- package/dist/migrations/007_add_poc_execution_columns.js.map +0 -1
- package/dist/migrations/008_pipeline_runs_status_values.d.ts +0 -8
- package/dist/migrations/008_pipeline_runs_status_values.js +0 -72
- package/dist/migrations/008_pipeline_runs_status_values.js.map +0 -1
- package/dist/migrations/009_add_pipeline_runs_context.d.ts +0 -3
- package/dist/migrations/009_add_pipeline_runs_context.js +0 -12
- package/dist/migrations/009_add_pipeline_runs_context.js.map +0 -1
- package/dist/migrations/010_add_calibration_schema.d.ts +0 -3
- package/dist/migrations/010_add_calibration_schema.js +0 -26
- package/dist/migrations/010_add_calibration_schema.js.map +0 -1
- package/dist/migrations/011_add_trajectories_table.d.ts +0 -3
- package/dist/migrations/011_add_trajectories_table.js +0 -27
- package/dist/migrations/011_add_trajectories_table.js.map +0 -1
- package/dist/migrations/012_add_finding_provenance_columns.d.ts +0 -3
- package/dist/migrations/012_add_finding_provenance_columns.js +0 -19
- package/dist/migrations/012_add_finding_provenance_columns.js.map +0 -1
- package/dist/migrations/013_add_composite_confidence_columns.d.ts +0 -3
- package/dist/migrations/013_add_composite_confidence_columns.js +0 -16
- package/dist/migrations/013_add_composite_confidence_columns.js.map +0 -1
- package/dist/migrations/014_add_metrics_column.d.ts +0 -3
- package/dist/migrations/014_add_metrics_column.js +0 -13
- package/dist/migrations/014_add_metrics_column.js.map +0 -1
- package/dist/migrations/015_add_assertion_tracking.d.ts +0 -2
- package/dist/migrations/015_add_assertion_tracking.js +0 -31
- package/dist/migrations/015_add_assertion_tracking.js.map +0 -1
- package/dist/migrations/016_add_structured_finding_evidence.d.ts +0 -5
- package/dist/migrations/016_add_structured_finding_evidence.js +0 -21
- package/dist/migrations/016_add_structured_finding_evidence.js.map +0 -1
- package/dist/migrations/017_add_dynamic_and_patch_persistence.d.ts +0 -5
- package/dist/migrations/017_add_dynamic_and_patch_persistence.js +0 -69
- package/dist/migrations/017_add_dynamic_and_patch_persistence.js.map +0 -1
- package/dist/migrations/018_add_crypto_behavioral_runs.d.ts +0 -2
- package/dist/migrations/018_add_crypto_behavioral_runs.js +0 -40
- package/dist/migrations/018_add_crypto_behavioral_runs.js.map +0 -1
- package/dist/migrations/019_add_code_graph_tables.d.ts +0 -2
- package/dist/migrations/019_add_code_graph_tables.js +0 -72
- package/dist/migrations/019_add_code_graph_tables.js.map +0 -1
- package/dist/migrations/020_add_verified_patch_status.d.ts +0 -6
- package/dist/migrations/020_add_verified_patch_status.js +0 -38
- package/dist/migrations/020_add_verified_patch_status.js.map +0 -1
- package/dist/migrations/021_add_incremental_scanning_support.d.ts +0 -2
- package/dist/migrations/021_add_incremental_scanning_support.js +0 -13
- package/dist/migrations/021_add_incremental_scanning_support.js.map +0 -1
- package/dist/migrations/022_add_verdict_index.d.ts +0 -2
- package/dist/migrations/022_add_verdict_index.js +0 -8
- package/dist/migrations/022_add_verdict_index.js.map +0 -1
- package/dist/migrations/023_expand_pipeline_status_constraint.d.ts +0 -6
- package/dist/migrations/023_expand_pipeline_status_constraint.js +0 -58
- package/dist/migrations/023_expand_pipeline_status_constraint.js.map +0 -1
- package/dist/migrations/024_rename_scanner_to_task_id.d.ts +0 -13
- package/dist/migrations/024_rename_scanner_to_task_id.js +0 -25
- package/dist/migrations/024_rename_scanner_to_task_id.js.map +0 -1
package/README.md
CHANGED
|
@@ -24,18 +24,18 @@ kuzushi
|
|
|
24
24
|
Just type `kuzushi`. The interactive copilot shell starts with your loaded modules, available tools, and any active workspace. Talk naturally or use structured commands.
|
|
25
25
|
|
|
26
26
|
```
|
|
27
|
-
kuzushi shell
|
|
28
|
-
kuzushi shell --workspace acme-pentest
|
|
29
|
-
kuzushi shell --target ./repo
|
|
30
|
-
kuzushi shell --load
|
|
27
|
+
kuzushi shell # default — just `kuzushi` works
|
|
28
|
+
kuzushi shell --workspace acme-pentest # resume an engagement
|
|
29
|
+
kuzushi shell --target ./repo # set initial target
|
|
30
|
+
kuzushi shell --load randori,vuln-scout,tob # pre-load specific built-in modules
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
```
|
|
34
|
-
|
|
34
|
+
╭─────────────────────────────────────────────────────────────╮
|
|
35
35
|
│ kuzushi shell workspace: acme-api │
|
|
36
|
-
│ modules: sast, randori,
|
|
36
|
+
│ modules: sast, randori, vuln-scout, tob, variant-hunter │
|
|
37
37
|
│ target: ./acme-api (Node.js + Express + PostgreSQL) │
|
|
38
|
-
|
|
38
|
+
╰─────────────────────────────────────────────────────────────╯
|
|
39
39
|
|
|
40
40
|
kuzushi> modules
|
|
41
41
|
kuzushi> use sast
|
|
@@ -93,26 +93,94 @@ kuzushi scan /path/to/repo --model google:gemini-2.0-flash
|
|
|
93
93
|
|
|
94
94
|
Kuzushi auto-downloads Opengrep if you don't have a scanner installed. Zero dependencies to manage.
|
|
95
95
|
|
|
96
|
+
## Quick Start (Contributors)
|
|
97
|
+
|
|
98
|
+
Two commands, deterministic, loud on failure:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
git clone https://github.com/allsmog/Kuzushi.git
|
|
102
|
+
cd Kuzushi
|
|
103
|
+
pnpm setup # verifies Node 22+, pins pnpm via corepack, checks externals, pnpm install
|
|
104
|
+
pnpm doctor # optional: re-verify the environment at any time
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Then:
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
pnpm dev --help # run the CLI from source via tsx
|
|
111
|
+
pnpm test # unit tests (vitest)
|
|
112
|
+
pnpm check:types # typecheck src + benchmarks + perf (in parallel)
|
|
113
|
+
pnpm build # incremental compile to dist/ — incremental, fast
|
|
114
|
+
pnpm build:clean # wipe dist/ and rebuild from scratch (used by `pnpm prepack`)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Optional benchmark corpuses (clones 3rd-party vulnerable apps on demand):
|
|
118
|
+
|
|
119
|
+
```sh
|
|
120
|
+
pnpm setup:benchmarks list # list available corpuses
|
|
121
|
+
pnpm setup:benchmarks govwa # clone one
|
|
122
|
+
pnpm setup:benchmarks all # clone everything
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Prefer a containerised environment? Open the repo in VS Code / Codespaces and
|
|
126
|
+
"Reopen in Container" — the `.devcontainer/devcontainer.json` runs
|
|
127
|
+
`pnpm setup --strict` automatically and installs semgrep + python for you.
|
|
128
|
+
|
|
96
129
|
## Module System
|
|
97
130
|
|
|
98
|
-
Kuzushi's capabilities come from
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
|
103
|
-
|
|
104
|
-
| **
|
|
105
|
-
| **
|
|
106
|
-
| **
|
|
107
|
-
| **
|
|
108
|
-
| **
|
|
109
|
-
| **
|
|
110
|
-
| **
|
|
111
|
-
| **
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
131
|
+
Kuzushi's capabilities come from `CopilotModule`s that expose tools (for shell and run modes) and optionally pipeline tasks (for scan mode DAG execution), plus a set of Claude Code plugins that are wrapped by built-in modules. Three buckets:
|
|
132
|
+
|
|
133
|
+
### Built-in `CopilotModule`s (always available)
|
|
134
|
+
|
|
135
|
+
| Module | Category | What It Does | Key Tools |
|
|
136
|
+
|--------|----------|--------------|-----------|
|
|
137
|
+
| **sast** | offense | 40+ task SAST pipeline: Semgrep, CodeQL, agentic detectors, AI triage, verification, PoC, patch | `sast:scan`, `sast:semgrep`, `sast:codeql`, `sast:triage`, `sast:verify`, `sast:patch`, `sast:findings`, `sast:context`, `sast:threat-hunt`, `sast:taint-iris` |
|
|
138
|
+
| **randori** | intel | PASTA threat modeling via the `@kuzushi/randori-plugin` — S1–S4 stages plus narrative synthesis, returning a `ThreatModelDocument` | `randori:pasta`, `randori:threat-model` |
|
|
139
|
+
| **vuln-scout** | offense | Whitebox pentest via the `@kuzushi/vuln-scout` plugin — agentic SAST + taint analysis returning normalized Findings | `vuln-scout:audit` |
|
|
140
|
+
| **tob** | offense | Trail of Bits skills audit via `@kuzushi/tob-skills` — fp-check, sharp-edges, insecure-defaults, static-analysis, variant-analysis, and more | `tob:audit`, `tob:skills` |
|
|
141
|
+
| **shinsa** | governance | ISO 27001 Annex A + NIST SP 800-53 Rev 5 compliance assessment via `shinsa-plugin` — evidence-backed controls mapped to file:line citations | `shinsa:scan`, `shinsa:quick-check`, `shinsa:nist-scan`, `shinsa:nist-quick-check`, `shinsa:frameworks` |
|
|
142
|
+
| **prompt-armor** | offense | LLM red teaming via `promptarmor-plugin` — 80+ attack plugins, 25+ mutation strategies, code-aware remediation (network commands require `authorized: true`) | `prompt-armor:scan`, `prompt-armor:analyze`, `prompt-armor:attack`, `prompt-armor:diff`, `prompt-armor:report`, `prompt-armor:config` |
|
|
143
|
+
| **variant-hunter** | offense | Lifts confirmed findings into portable signatures and hunts for variants across the repo (including vendored deps) | `variant:lift-pattern`, `variant:hunt` |
|
|
144
|
+
| **n-day-diff-hunter** | offense | CVE-diff-based n-day hunting and variant search against a target | `ndiff:fetch-cve`, `ndiff:search-patch-shape`, `ndiff:hunt-variants` |
|
|
145
|
+
|
|
146
|
+
Load with the shell or at startup: `kuzushi shell --load randori,vuln-scout,tob,shinsa,prompt-armor,variant-hunter,n-day-diff-hunter` (the bare id works — `builtin:` prefix is optional).
|
|
147
|
+
|
|
148
|
+
### External `CopilotModule` packages
|
|
149
|
+
|
|
150
|
+
| Package | Module ID | Usage |
|
|
151
|
+
|---------|-----------|-------|
|
|
152
|
+
| `@kuzushi/augur` | `augur` | Neuro-symbolic SAST (IRIS/ICLR 2025 LLM-driven CodeQL taint analysis). Load with `--load package:@kuzushi/augur`. |
|
|
153
|
+
|
|
154
|
+
### Referenced Claude Code plugins
|
|
155
|
+
|
|
156
|
+
These are dependencies consumed by the built-in wrappers above, not directly loadable as `CopilotModule`s. Attempting `--load package:@kuzushi/randori-plugin` (etc.) prints a pointer to the corresponding built-in module.
|
|
157
|
+
|
|
158
|
+
| Package | Wrapped by | Notes |
|
|
159
|
+
|---------|------------|-------|
|
|
160
|
+
| `@kuzushi/randori-plugin` | built-in `randori` | PASTA threat-modeling plugin (commands, agents, skills, hooks). |
|
|
161
|
+
| `@kuzushi/vuln-scout` | built-in `vuln-scout` | Whitebox pentest skill pack under `whitebox-pentest/`. |
|
|
162
|
+
| `@kuzushi/tob-skills` | built-in `tob` | Fork of trailofbits/skills — security-relevant plugins under `plugins/`. |
|
|
163
|
+
| `shinsa-plugin` | built-in `shinsa` | ISO 27001 + NIST 800-53 compliance assessment (4 commands, 10 assessor agents). |
|
|
164
|
+
| `promptarmor-plugin` | built-in `prompt-armor` | LLM red teaming (6 commands + MCP server under `server/`). |
|
|
165
|
+
|
|
166
|
+
### Roadmap (not yet shipped)
|
|
167
|
+
|
|
168
|
+
`blackbox`, `pwn`, `pentest`, `honeypot`, `yokai`, `revgraph` — referenced in the long-term vision but not currently implemented as loadable modules. See [VISION.md](VISION.md) for direction.
|
|
169
|
+
|
|
170
|
+
### Authoring your own module
|
|
171
|
+
|
|
172
|
+
```sh
|
|
173
|
+
kuzushi create-module my-module --template offense # scaffolds manifest + starter tool + vitest
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
The scaffolder emits `module.manifest.json`, a TypeScript starter tool, and a vitest skeleton. Import types and test helpers from the SDK subpaths:
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
import type { CopilotModule, ModuleTool, ToolResult } from "kuzushi/modules"
|
|
180
|
+
import { createMockToolContext, createMockBus, noopRuntime } from "kuzushi/testing"
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Load a local build with `--load file:///abs/path/to/my-module`, or a published package with `--load package:@scope/name`. MCP servers can be bridged with `--load mcp:<spec>` (stdio or HTTP Streamable). See [CLAUDE.md](CLAUDE.md) for the full module authoring guide.
|
|
116
184
|
|
|
117
185
|
## The SAST Pipeline
|
|
118
186
|
|
|
@@ -159,7 +227,7 @@ jobs:
|
|
|
159
227
|
- uses: actions/setup-node@v4
|
|
160
228
|
with:
|
|
161
229
|
node-version: 22
|
|
162
|
-
- run: npx kuzushi scan . --sarif results.sarif --quality-gate --fail-on-tp
|
|
230
|
+
- run: npx kuzushi scan . --sarif results.sarif --junit results.xml --quality-gate --fail-on-tp
|
|
163
231
|
env:
|
|
164
232
|
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
165
233
|
- uses: github/codeql-action/upload-sarif@v3
|
|
@@ -168,6 +236,8 @@ jobs:
|
|
|
168
236
|
sarif_file: results.sarif
|
|
169
237
|
```
|
|
170
238
|
|
|
239
|
+
Exit codes: `0` clean, `1` findings (or task failures), `2` usage/config/auth, `3` unexpected crash. See `.github/workflows/kuzushi-reference.yml` for a reference workflow with SARIF upload, JUnit publish, and PR sticky comment.
|
|
240
|
+
|
|
171
241
|
### Quality Gates
|
|
172
242
|
|
|
173
243
|
```sh
|
|
@@ -207,7 +277,7 @@ kuzushi scan <repo> --preset glasswing # + PoC + threat-informed hunting + fro
|
|
|
207
277
|
|
|
208
278
|
**Resumable runs** — checkpoints to SQLite. `--resume` picks up where you left off.
|
|
209
279
|
|
|
210
|
-
**Interactive terminal UI** — React+Ink-powered live display with pipeline progress tree, spinners, trophy screen for confirmed exploits. REPL during scans (pause, skip, inspect). First-run setup wizard. Falls back to plain text in non-TTY.
|
|
280
|
+
**Interactive terminal UI** — React+Ink-powered live display with pipeline progress tree, spinners, trophy screen for confirmed exploits. REPL during scans (pause, skip, inspect). First-run setup wizard. Falls back to plain text in non-TTY. Built on a unified primitive library (`src/ui/primitives/`: `SelectList`, `TextInput`, `ConfirmDialog`, `Table`, `Breadcrumb`, `KeybindFooter`, `ExpandableSection`, `Divider`, `MultilineText`) with shared hooks (`src/ui/hooks/`: `useBoundedIndex`, `useFocusTrap`, `useTerminalSize`, `useCursorVisibility`, `useExpanded`, `useKeybindings`) for consistent focus, keyboard navigation, and resize handling.
|
|
211
281
|
|
|
212
282
|
**Incremental scanning** — skips re-triage for unchanged findings. Dependency-aware invalidation via import graph.
|
|
213
283
|
|
|
@@ -267,10 +337,20 @@ kuzushi scan <repo> --output report.md
|
|
|
267
337
|
kuzushi scan <repo> --sarif results.sarif
|
|
268
338
|
kuzushi scan <repo> --json results.json
|
|
269
339
|
kuzushi scan <repo> --csv results.csv
|
|
340
|
+
kuzushi scan <repo> --junit results.xml
|
|
270
341
|
kuzushi scan <repo> --stream
|
|
271
342
|
kuzushi scan <repo> --audit-log
|
|
272
343
|
```
|
|
273
344
|
|
|
345
|
+
### Run History
|
|
346
|
+
|
|
347
|
+
```
|
|
348
|
+
kuzushi runs list # 50 most recent runs
|
|
349
|
+
kuzushi runs list --status interrupted # only resumable runs
|
|
350
|
+
kuzushi runs show <runId> --costs # details + cost breakdown
|
|
351
|
+
kuzushi runs show <runId> --json # JSON output for tooling
|
|
352
|
+
```
|
|
353
|
+
|
|
274
354
|
### Run Mode
|
|
275
355
|
|
|
276
356
|
```
|
|
@@ -367,6 +447,25 @@ kuzushi config set tasks semgrep,codeql
|
|
|
367
447
|
|
|
368
448
|
See [VISION.md](VISION.md) for the full architecture vision, module system design, workspace/knowledge graph, intel layer, governance model, and implementation roadmap.
|
|
369
449
|
|
|
450
|
+
### Terminal UI layer
|
|
451
|
+
|
|
452
|
+
The Ink React frontend lives in `src/ui/`:
|
|
453
|
+
|
|
454
|
+
| Path | Role |
|
|
455
|
+
| --- | --- |
|
|
456
|
+
| `src/ui/App.tsx` | Root Ink component; dispatches on `UIState.mode` (`preflight`, `running`, `summary`, `review`, `done`, `shell`). |
|
|
457
|
+
| `src/ui/state.ts` | `UIStore` — observer-pattern state + `useSyncExternalStore` binding. |
|
|
458
|
+
| `src/ui/render.ts` | Entry point; TTY detection and Ink mount / plain fallback. |
|
|
459
|
+
| `src/ui/plain-renderer.ts` | Non-TTY subscriber that prints delta-based updates. |
|
|
460
|
+
| `src/ui/tokens.ts` | Semantic color/typography tokens + `SPACING` / `COLUMN_WIDTHS` constants. |
|
|
461
|
+
| `src/ui/format.ts` | Terminal formatting utilities — progress bars, cost/duration, column padding, ANSI-aware truncation (`truncateEnd`, `truncateMiddle`, `padCell`, `visibleWidth`). |
|
|
462
|
+
| `src/ui/error-format.ts` | Ink-free error classification (`classifyError`, `formatError`, `suggestNextStep`) consumed by `ErrorCard`. |
|
|
463
|
+
| `src/ui/primitives/` | Reusable building blocks: `SelectList`, `TextInput`, `ConfirmDialog`, `Table`, `Breadcrumb`, `KeybindFooter`, `ExpandableSection`, `Divider`, `MultilineText`. |
|
|
464
|
+
| `src/ui/hooks/` | Behavioral hooks: `useBoundedIndex`, `useFocusTrap`, `useTerminalSize` (SIGWINCH-aware), `useCursorVisibility`, `useExpanded`, `useKeybindings`. |
|
|
465
|
+
| `src/ui/components/` | Feature components (pipeline, findings, setup wizard, copilot shell) composed from the primitives above. |
|
|
466
|
+
|
|
467
|
+
Styling discipline: components import from `tokens` (never `chalk` directly) and lay out with Ink `<Box>` flexbox properties (`flexDirection`, `justifyContent`, `gap`, `padding`, `margin`) rather than string-padding tricks.
|
|
468
|
+
|
|
370
469
|
## License
|
|
371
470
|
|
|
372
471
|
MIT
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdirSync,
|
|
1
|
+
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
/** Sanitize a path component to prevent traversal (strip slashes, .., etc.) */
|
|
4
4
|
function sanitizeComponent(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-files.js","sourceRoot":"","sources":["../../src/agent-runtime/batch-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"batch-files.js","sourceRoot":"","sources":["../../src/agent-runtime/batch-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,+EAA+E;AAC/E,SAAS,iBAAiB,CAAC,KAAa;IACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC5B,QAAgB,EAChB,KAAa,EACb,MAAc,EACd,QAAgB,EAChB,IAAa;IAEb,MAAM,SAAS,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC3C,MAAM,UAAU,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAClE,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC3F,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACvD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAgB,EAAE,KAAa;IAC/D,MAAM,SAAS,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAClE,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import type { AgentRuntimeConfig } from "../types.js";
|
|
2
1
|
import type { MessageBus } from "../bus/types.js";
|
|
3
|
-
import type {
|
|
2
|
+
import type { AgentRuntimeConfig } from "../types.js";
|
|
4
3
|
import type { AgentQueryExecutionResult } from "./execution.js";
|
|
4
|
+
import type { AgentBatchRequest, AgentMessage, AgentQueryOptions, AgentQueryRequest, AgentRuntime, AgentSession } from "./types.js";
|
|
5
|
+
/** Exported for tests only — observes internal semaphore state. */
|
|
6
|
+
export declare function __getSemaphoreState(): {
|
|
7
|
+
active: number;
|
|
8
|
+
leaked: number;
|
|
9
|
+
waiting: number;
|
|
10
|
+
};
|
|
5
11
|
export declare class ClaudeAgentRuntime implements AgentRuntime {
|
|
6
12
|
readonly id = "claude";
|
|
7
13
|
private readonly config;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Anthropic from "@anthropic-ai/sdk";
|
|
2
1
|
import { query as claudeQuery, } from "@anthropic-ai/claude-agent-sdk";
|
|
3
|
-
import
|
|
2
|
+
import Anthropic from "@anthropic-ai/sdk";
|
|
4
3
|
import { getLogger } from "../logger.js";
|
|
4
|
+
import { normalizeCostUsd, toErrorMessage } from "../utils.js";
|
|
5
5
|
const log = getLogger("claude-runtime");
|
|
6
6
|
// Prevent EPIPE from crashing the process when Claude SDK subprocesses die.
|
|
7
7
|
// Multiple concurrent query() calls each spawn a Claude Code subprocess;
|
|
@@ -27,22 +27,32 @@ for (const stream of [process.stdout, process.stderr]) {
|
|
|
27
27
|
// rapid "process exited with code 1" failures.
|
|
28
28
|
const MAX_CONCURRENT_QUERIES = 5;
|
|
29
29
|
let activeQueries = 0;
|
|
30
|
+
// Slots marked as leaked — a prior caller timed out waiting, so we assume
|
|
31
|
+
// its holder died. A subsequent release pays the leak marker down instead
|
|
32
|
+
// of decrementing the live count, which keeps the effective capacity honest
|
|
33
|
+
// even if the "dead" subprocess later recovers and releases.
|
|
34
|
+
let leakedSlots = 0;
|
|
30
35
|
const waitQueue = [];
|
|
31
36
|
const SLOT_TIMEOUT_MS = 600_000; // 10 minutes max wait for a slot
|
|
37
|
+
function effectiveActive() {
|
|
38
|
+
return Math.max(0, activeQueries - leakedSlots);
|
|
39
|
+
}
|
|
32
40
|
async function acquireSlot() {
|
|
33
|
-
if (
|
|
41
|
+
if (effectiveActive() < MAX_CONCURRENT_QUERIES) {
|
|
34
42
|
activeQueries++;
|
|
35
43
|
return;
|
|
36
44
|
}
|
|
37
45
|
let forcedAcquire = false;
|
|
38
|
-
await new Promise((resolve
|
|
46
|
+
await new Promise((resolve) => {
|
|
39
47
|
const timer = setTimeout(() => {
|
|
40
|
-
// Remove from queue
|
|
41
|
-
//
|
|
48
|
+
// Remove from queue; treat one existing holder as leaked. The next
|
|
49
|
+
// healthy release() will pay the leak marker down, so ultimately
|
|
50
|
+
// capacity can never drift negative or permanently below MAX.
|
|
42
51
|
const idx = waitQueue.indexOf(resolve);
|
|
43
52
|
if (idx >= 0)
|
|
44
53
|
waitQueue.splice(idx, 1);
|
|
45
|
-
log.warn("Semaphore slot timeout —
|
|
54
|
+
log.warn("Semaphore slot timeout — assuming leaked slot from dead subprocess, force-acquiring");
|
|
55
|
+
leakedSlots++;
|
|
46
56
|
forcedAcquire = true;
|
|
47
57
|
resolve();
|
|
48
58
|
}, SLOT_TIMEOUT_MS);
|
|
@@ -51,16 +61,29 @@ async function acquireSlot() {
|
|
|
51
61
|
resolve();
|
|
52
62
|
});
|
|
53
63
|
});
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
activeQueries++;
|
|
65
|
+
if (forcedAcquire) {
|
|
66
|
+
// leakedSlots was incremented in the timeout handler. We own a live slot
|
|
67
|
+
// now; the leak marker remains until paid down by a subsequent release.
|
|
56
68
|
}
|
|
57
69
|
}
|
|
58
70
|
function releaseSlot() {
|
|
59
|
-
|
|
71
|
+
if (leakedSlots > 0) {
|
|
72
|
+
// Pay down the leak marker instead of touching the live count; this
|
|
73
|
+
// release "belongs" to the orphaned slot, not our caller.
|
|
74
|
+
leakedSlots--;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
activeQueries = Math.max(0, activeQueries - 1);
|
|
78
|
+
}
|
|
60
79
|
const next = waitQueue.shift();
|
|
61
80
|
if (next)
|
|
62
81
|
next();
|
|
63
82
|
}
|
|
83
|
+
/** Exported for tests only — observes internal semaphore state. */
|
|
84
|
+
export function __getSemaphoreState() {
|
|
85
|
+
return { active: activeQueries, leaked: leakedSlots, waiting: waitQueue.length };
|
|
86
|
+
}
|
|
64
87
|
export class ClaudeAgentRuntime {
|
|
65
88
|
id = "claude";
|
|
66
89
|
config;
|
|
@@ -135,9 +158,7 @@ export class ClaudeAgentRuntime {
|
|
|
135
158
|
stream: false,
|
|
136
159
|
service_tier: "standard_only",
|
|
137
160
|
...(Object.keys(outputConfig).length > 0 ? { output_config: outputConfig } : {}),
|
|
138
|
-
...(thinkingDisabled
|
|
139
|
-
? { thinking: { type: "disabled" } }
|
|
140
|
-
: {}),
|
|
161
|
+
...(thinkingDisabled ? { thinking: { type: "disabled" } } : {}),
|
|
141
162
|
};
|
|
142
163
|
return { custom_id: req.id, params };
|
|
143
164
|
});
|
|
@@ -145,10 +166,17 @@ export class ClaudeAgentRuntime {
|
|
|
145
166
|
let batch = await this.client.messages.batches.create({ requests: batchRequests });
|
|
146
167
|
log.info(`Batch ${batch.id} submitted, polling for completion`);
|
|
147
168
|
const startMs = Date.now();
|
|
148
|
-
|
|
149
|
-
|
|
169
|
+
// Exponential backoff: batches typically run for minutes. A fixed 2 s
|
|
170
|
+
// poll wastes ~30 retrieves per minute after the first minute; this
|
|
171
|
+
// starts at 2 s and grows to a 30 s cap.
|
|
172
|
+
const INITIAL_POLL_MS = 2_000;
|
|
173
|
+
const MAX_POLL_MS_PER_CYCLE = 30_000;
|
|
174
|
+
const BACKOFF_FACTOR = 1.5;
|
|
175
|
+
const MAX_POLL_MS = 600_000; // 10 minutes overall cap
|
|
176
|
+
let pollDelay = INITIAL_POLL_MS;
|
|
150
177
|
while (batch.processing_status !== "ended") {
|
|
151
|
-
await new Promise((r) => setTimeout(r,
|
|
178
|
+
await new Promise((r) => setTimeout(r, pollDelay));
|
|
179
|
+
pollDelay = Math.min(MAX_POLL_MS_PER_CYCLE, Math.floor(pollDelay * BACKOFF_FACTOR));
|
|
152
180
|
batch = await this.client.messages.batches.retrieve(batch.id);
|
|
153
181
|
if (Date.now() - startMs > MAX_POLL_MS) {
|
|
154
182
|
await this.client.messages.batches.cancel(batch.id);
|
|
@@ -172,19 +200,17 @@ export class ClaudeAgentRuntime {
|
|
|
172
200
|
const usage = msg.usage;
|
|
173
201
|
const inputCost = (usage.input_tokens / 1_000_000) * inputRate;
|
|
174
202
|
const outputCost = (usage.output_tokens / 1_000_000) * outputRate;
|
|
175
|
-
const cacheReadTokens = usage
|
|
203
|
+
const cacheReadTokens = usage.cache_read_input_tokens ?? 0;
|
|
176
204
|
const cacheSavings = (cacheReadTokens / 1_000_000) * (inputRate * 0.9);
|
|
177
205
|
results.set(item.custom_id, {
|
|
178
206
|
resultText: textBlock?.text ?? "",
|
|
179
|
-
structuredOutput: msg
|
|
207
|
+
structuredOutput: msg.parsed_output ?? undefined,
|
|
180
208
|
executionError: null,
|
|
181
209
|
costUsd: normalizeCostUsd(inputCost + outputCost - cacheSavings),
|
|
182
210
|
});
|
|
183
211
|
}
|
|
184
212
|
else {
|
|
185
|
-
const errorMsg = item.result.type === "errored"
|
|
186
|
-
? JSON.stringify(item.result.error)
|
|
187
|
-
: item.result.type;
|
|
213
|
+
const errorMsg = item.result.type === "errored" ? JSON.stringify(item.result.error) : item.result.type;
|
|
188
214
|
results.set(item.custom_id, {
|
|
189
215
|
resultText: "",
|
|
190
216
|
structuredOutput: undefined,
|
|
@@ -237,7 +263,9 @@ export class ClaudeAgentRuntime {
|
|
|
237
263
|
payload: { model, promptLength: request.prompt.length, runId: turnRunId },
|
|
238
264
|
});
|
|
239
265
|
}
|
|
240
|
-
catch {
|
|
266
|
+
catch {
|
|
267
|
+
/* non-fatal */
|
|
268
|
+
}
|
|
241
269
|
}
|
|
242
270
|
try {
|
|
243
271
|
// Build output_config — effort errors on Haiku, so skip it
|
|
@@ -255,9 +283,7 @@ export class ClaudeAgentRuntime {
|
|
|
255
283
|
const maxTokens = request.options.maxOutputTokens ?? 16000;
|
|
256
284
|
// Thinking: disable for classification, use adaptive+omitted for analysis
|
|
257
285
|
// display: "omitted" skips streaming thinking tokens (faster time-to-first-text)
|
|
258
|
-
const shouldDisableThinking = request.options.thinkingDisabled
|
|
259
|
-
|| isHaiku
|
|
260
|
-
|| request.options.effort === "low";
|
|
286
|
+
const shouldDisableThinking = request.options.thinkingDisabled || isHaiku || request.options.effort === "low";
|
|
261
287
|
// Use streaming + finalMessage() to avoid HTTP timeouts on large outputs
|
|
262
288
|
const stream = this.client.messages.stream({
|
|
263
289
|
model,
|
|
@@ -301,7 +327,7 @@ export class ClaudeAgentRuntime {
|
|
|
301
327
|
const outputRate = isHaiku ? 5 : isMythos ? 125 : isOpus ? 25 : 15;
|
|
302
328
|
const inputCost = (response.usage.input_tokens / 1_000_000) * inputRate;
|
|
303
329
|
const outputCost = (response.usage.output_tokens / 1_000_000) * outputRate;
|
|
304
|
-
const cacheReadTokens = response.usage
|
|
330
|
+
const cacheReadTokens = response.usage.cache_read_input_tokens ?? 0;
|
|
305
331
|
const cacheSavings = (cacheReadTokens / 1_000_000) * (inputRate * 0.9); // 90% savings on cached tokens
|
|
306
332
|
const totalCostUsd = normalizeCostUsd(inputCost + outputCost - cacheSavings);
|
|
307
333
|
// Extract text result
|
|
@@ -312,17 +338,29 @@ export class ClaudeAgentRuntime {
|
|
|
312
338
|
try {
|
|
313
339
|
await this.bus.publish({
|
|
314
340
|
type: "llm:call-complete",
|
|
315
|
-
meta: {
|
|
316
|
-
|
|
341
|
+
meta: {
|
|
342
|
+
id: crypto.randomUUID(),
|
|
343
|
+
timestamp: new Date().toISOString(),
|
|
344
|
+
runId: turnRunId,
|
|
345
|
+
},
|
|
346
|
+
payload: {
|
|
347
|
+
model,
|
|
348
|
+
durationMs,
|
|
349
|
+
tokensUsed: response.usage.input_tokens + response.usage.output_tokens,
|
|
350
|
+
costUsd: totalCostUsd,
|
|
351
|
+
runId: turnRunId,
|
|
352
|
+
},
|
|
317
353
|
});
|
|
318
354
|
}
|
|
319
|
-
catch {
|
|
355
|
+
catch {
|
|
356
|
+
/* non-fatal */
|
|
357
|
+
}
|
|
320
358
|
}
|
|
321
359
|
yield {
|
|
322
360
|
type: "result",
|
|
323
361
|
subtype: "success",
|
|
324
362
|
result: resultText,
|
|
325
|
-
structuredOutput: response
|
|
363
|
+
structuredOutput: response.parsed_output ?? undefined,
|
|
326
364
|
durationMs,
|
|
327
365
|
numTurns: 1,
|
|
328
366
|
totalCostUsd,
|
|
@@ -330,18 +368,23 @@ export class ClaudeAgentRuntime {
|
|
|
330
368
|
}
|
|
331
369
|
catch (error) {
|
|
332
370
|
const durationMs = Date.now() - startedAtMs;
|
|
333
|
-
const retryable = error instanceof Anthropic.RateLimitError
|
|
334
|
-
|| error instanceof Anthropic.InternalServerError;
|
|
371
|
+
const retryable = error instanceof Anthropic.RateLimitError || error instanceof Anthropic.InternalServerError;
|
|
335
372
|
log.error(`Direct API query failed (${durationMs}ms, retryable=${retryable}): ${toErrorMessage(error)}`);
|
|
336
373
|
if (this.bus) {
|
|
337
374
|
try {
|
|
338
375
|
await this.bus.publish({
|
|
339
376
|
type: "llm:call-error",
|
|
340
|
-
meta: {
|
|
377
|
+
meta: {
|
|
378
|
+
id: crypto.randomUUID(),
|
|
379
|
+
timestamp: new Date().toISOString(),
|
|
380
|
+
runId: turnRunId,
|
|
381
|
+
},
|
|
341
382
|
payload: { model, error: toErrorMessage(error), retryable, runId: turnRunId },
|
|
342
383
|
});
|
|
343
384
|
}
|
|
344
|
-
catch {
|
|
385
|
+
catch {
|
|
386
|
+
/* non-fatal */
|
|
387
|
+
}
|
|
345
388
|
}
|
|
346
389
|
yield {
|
|
347
390
|
type: "result",
|
|
@@ -356,9 +399,9 @@ export class ClaudeAgentRuntime {
|
|
|
356
399
|
async *query(request) {
|
|
357
400
|
// Fast path: tool-less calls go directly to Anthropic API — no subprocess.
|
|
358
401
|
// Only when an API key is available — OAuth mode must use subprocess path.
|
|
359
|
-
if (!request.options.allowedTools?.length
|
|
360
|
-
|
|
361
|
-
|
|
402
|
+
if (!request.options.allowedTools?.length &&
|
|
403
|
+
!request.options.disallowedTools?.length &&
|
|
404
|
+
this.config?.apiKey) {
|
|
362
405
|
yield* this.queryDirect(request);
|
|
363
406
|
return;
|
|
364
407
|
}
|
|
@@ -482,16 +525,16 @@ export class ClaudeAgentRuntime {
|
|
|
482
525
|
continue;
|
|
483
526
|
if (mapped.type === "result") {
|
|
484
527
|
// Extract cost and metadata from SDK result
|
|
485
|
-
const
|
|
486
|
-
totalCostUsd = normalizeCostUsd(
|
|
487
|
-
numTurns =
|
|
528
|
+
const sdkResult = message;
|
|
529
|
+
totalCostUsd = normalizeCostUsd(sdkResult.total_cost_usd);
|
|
530
|
+
numTurns = sdkResult.num_turns ?? 0;
|
|
488
531
|
const durationMs = Date.now() - startedAtMs;
|
|
489
|
-
if (
|
|
532
|
+
if (sdkResult.subtype === "success" && "result" in mapped) {
|
|
490
533
|
yield {
|
|
491
534
|
type: "result",
|
|
492
535
|
subtype: "success",
|
|
493
536
|
result: mapped.result,
|
|
494
|
-
structuredOutput:
|
|
537
|
+
structuredOutput: sdkResult.structured_output,
|
|
495
538
|
durationMs,
|
|
496
539
|
numTurns,
|
|
497
540
|
totalCostUsd,
|
|
@@ -610,9 +653,13 @@ class MessageQueue {
|
|
|
610
653
|
if (this.isDone) {
|
|
611
654
|
return Promise.resolve({ done: true, value: undefined });
|
|
612
655
|
}
|
|
613
|
-
return new Promise((resolve) => {
|
|
656
|
+
return new Promise((resolve) => {
|
|
657
|
+
this.resolve = resolve;
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
[Symbol.asyncIterator]() {
|
|
661
|
+
return this;
|
|
614
662
|
}
|
|
615
|
-
[Symbol.asyncIterator]() { return this; }
|
|
616
663
|
}
|
|
617
664
|
/**
|
|
618
665
|
* A session backed by a single Claude Code subprocess. Uses the SDK's
|
|
@@ -623,18 +670,18 @@ class MessageQueue {
|
|
|
623
670
|
class ClaudeSession {
|
|
624
671
|
baseOptions;
|
|
625
672
|
config;
|
|
626
|
-
|
|
627
|
-
|
|
673
|
+
_bus;
|
|
674
|
+
_runId;
|
|
628
675
|
messageQueue = new MessageQueue();
|
|
629
676
|
queryIterator = null;
|
|
630
677
|
closed = false;
|
|
631
678
|
slotAcquired = false;
|
|
632
679
|
queryInFlight = false; // Mutex: prevent concurrent query() calls
|
|
633
|
-
constructor(baseOptions, config,
|
|
680
|
+
constructor(baseOptions, config, _bus, _runId) {
|
|
634
681
|
this.baseOptions = baseOptions;
|
|
635
682
|
this.config = config;
|
|
636
|
-
this.
|
|
637
|
-
this.
|
|
683
|
+
this._bus = _bus;
|
|
684
|
+
this._runId = _runId;
|
|
638
685
|
}
|
|
639
686
|
ensureStarted() {
|
|
640
687
|
if (this.queryIterator)
|
|
@@ -770,15 +817,15 @@ class ClaudeSession {
|
|
|
770
817
|
if (!mapped)
|
|
771
818
|
continue;
|
|
772
819
|
if (mapped.type === "result") {
|
|
773
|
-
const
|
|
774
|
-
const totalCostUsd = normalizeCostUsd(
|
|
775
|
-
const numTurns =
|
|
776
|
-
if (
|
|
820
|
+
const sdkResult = value;
|
|
821
|
+
const totalCostUsd = normalizeCostUsd(sdkResult.total_cost_usd);
|
|
822
|
+
const numTurns = sdkResult.num_turns ?? 0;
|
|
823
|
+
if (sdkResult.subtype === "success" && "result" in mapped) {
|
|
777
824
|
yield {
|
|
778
825
|
type: "result",
|
|
779
826
|
subtype: "success",
|
|
780
827
|
result: mapped.result,
|
|
781
|
-
structuredOutput:
|
|
828
|
+
structuredOutput: sdkResult.structured_output,
|
|
782
829
|
numTurns,
|
|
783
830
|
totalCostUsd,
|
|
784
831
|
};
|
|
@@ -828,52 +875,53 @@ function mapPermissionMode(mode) {
|
|
|
828
875
|
}
|
|
829
876
|
}
|
|
830
877
|
function mapMessage(msg) {
|
|
831
|
-
|
|
832
|
-
switch (type) {
|
|
878
|
+
switch (msg.type) {
|
|
833
879
|
case "result": {
|
|
834
|
-
const
|
|
835
|
-
|
|
836
|
-
if (subtype === "success") {
|
|
880
|
+
const sdkResult = msg;
|
|
881
|
+
if (sdkResult.subtype === "success") {
|
|
837
882
|
return {
|
|
838
883
|
type: "result",
|
|
839
884
|
subtype: "success",
|
|
840
|
-
result:
|
|
841
|
-
structuredOutput:
|
|
842
|
-
totalCostUsd: normalizeCostUsd(
|
|
885
|
+
result: sdkResult.result ?? "",
|
|
886
|
+
structuredOutput: sdkResult.structured_output,
|
|
887
|
+
totalCostUsd: normalizeCostUsd(sdkResult.total_cost_usd),
|
|
843
888
|
};
|
|
844
889
|
}
|
|
845
890
|
return {
|
|
846
891
|
type: "result",
|
|
847
|
-
subtype: subtype ?? "error_runtime",
|
|
848
|
-
errors: Array.isArray(
|
|
849
|
-
?
|
|
850
|
-
: [String(
|
|
851
|
-
totalCostUsd: normalizeCostUsd(
|
|
892
|
+
subtype: sdkResult.subtype ?? "error_runtime",
|
|
893
|
+
errors: Array.isArray(sdkResult.errors)
|
|
894
|
+
? sdkResult.errors
|
|
895
|
+
: [String(sdkResult.errors ?? "Unknown error")],
|
|
896
|
+
totalCostUsd: normalizeCostUsd(sdkResult.total_cost_usd),
|
|
852
897
|
};
|
|
853
898
|
}
|
|
854
899
|
case "assistant": {
|
|
855
|
-
const
|
|
900
|
+
const sdkAssistant = msg;
|
|
901
|
+
const content = sdkAssistant.message?.content;
|
|
856
902
|
return {
|
|
857
903
|
type: "assistant",
|
|
858
|
-
|
|
904
|
+
// BetaContentBlock[] -> Record<string, unknown>[] via spread to satisfy
|
|
905
|
+
// the AgentAssistantMessage interface (strips the rigid index signature constraint)
|
|
906
|
+
content: Array.isArray(content) ? content.map((block) => ({ ...block })) : [],
|
|
859
907
|
};
|
|
860
908
|
}
|
|
861
|
-
case "
|
|
862
|
-
const
|
|
909
|
+
case "tool_progress": {
|
|
910
|
+
const sdkProgress = msg;
|
|
863
911
|
return {
|
|
864
912
|
type: "tool-progress",
|
|
865
|
-
toolUseId:
|
|
866
|
-
toolName:
|
|
867
|
-
elapsedSeconds:
|
|
913
|
+
toolUseId: sdkProgress.tool_use_id ?? "",
|
|
914
|
+
toolName: sdkProgress.tool_name ?? "",
|
|
915
|
+
elapsedSeconds: sdkProgress.elapsed_time_seconds ?? 0,
|
|
868
916
|
};
|
|
869
917
|
}
|
|
870
918
|
case "tool_use_summary": {
|
|
871
|
-
const
|
|
919
|
+
const sdkSummary = msg;
|
|
872
920
|
return {
|
|
873
921
|
type: "tool-summary",
|
|
874
|
-
summary:
|
|
875
|
-
precedingToolUseIds: Array.isArray(
|
|
876
|
-
?
|
|
922
|
+
summary: sdkSummary.summary ?? "",
|
|
923
|
+
precedingToolUseIds: Array.isArray(sdkSummary.preceding_tool_use_ids)
|
|
924
|
+
? sdkSummary.preceding_tool_use_ids
|
|
877
925
|
: [],
|
|
878
926
|
};
|
|
879
927
|
}
|