@kenkaiiii/gg-engine 0.0.0-stage → 7.1.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/LICENSE +661 -0
- package/NOTICE +43 -0
- package/README.md +53 -2
- package/assets/skills/bulletproof/SKILL.md +132 -0
- package/assets/skills/bulletproof/references/agent-surface.md +113 -0
- package/assets/skills/bulletproof/references/attack-classes.md +226 -0
- package/assets/skills/bulletproof/references/audit-protocol.md +232 -0
- package/assets/skills/bulletproof/references/platform-playbooks.md +196 -0
- package/assets/skills/bulletproof/references/provenance.md +146 -0
- package/assets/skills/bulletproof/references/secure-defaults.md +137 -0
- package/assets/skills/bulletproof/references/supply-chain.md +84 -0
- package/assets/skills/bulletproof/references/threat-landscape.md +66 -0
- package/assets/skills/bulletproof/references/verification.md +74 -0
- package/assets/skills/compliance-guard/SKILL.md +115 -0
- package/assets/skills/compliance-guard/references/artifacts.md +199 -0
- package/assets/skills/compliance-guard/references/eu-uk.md +162 -0
- package/assets/skills/compliance-guard/references/exposure-triage.md +177 -0
- package/assets/skills/compliance-guard/references/full-review.md +155 -0
- package/assets/skills/compliance-guard/references/lawsuit-vectors.md +153 -0
- package/assets/skills/compliance-guard/references/provenance.md +135 -0
- package/assets/skills/compliance-guard/references/sector-gates.md +187 -0
- package/assets/skills/compliance-guard/references/security-baseline.md +117 -0
- package/assets/skills/compliance-guard/references/trigger-map.md +177 -0
- package/assets/skills/compliance-guard/references/us.md +194 -0
- package/assets/skills/durable/SKILL.md +114 -0
- package/assets/skills/durable/references/agent-db-safety.md +76 -0
- package/assets/skills/durable/references/backups-and-runtime.md +93 -0
- package/assets/skills/durable/references/migrations-and-schema.md +87 -0
- package/assets/skills/gg-guide/SKILL.md +43 -0
- package/assets/skills/gg-guide/references/chat-motion-goals.md +217 -0
- package/assets/skills/gg-guide/references/checklist-and-safety.md +177 -0
- package/assets/skills/gg-guide/references/code-mode.md +272 -0
- package/assets/skills/gg-guide/references/getting-started.md +295 -0
- package/assets/skills/gg-guide/references/ken-and-autopilot.md +172 -0
- package/assets/skills/gg-guide/references/mcp-and-skills.md +204 -0
- package/assets/skills/gg-guide/references/models-and-sign-in.md +200 -0
- package/assets/skills/gg-guide/references/sessions-and-history.md +213 -0
- package/assets/skills/gg-guide/references/settings.md +193 -0
- package/assets/skills/gg-guide/references/troubleshooting-and-data.md +186 -0
- package/assets/skills/lean/SKILL.md +117 -0
- package/assets/skills/lean/references/memory-and-processes.md +99 -0
- package/assets/skills/lean/references/playbooks.md +134 -0
- package/dist/app-error.d.ts +22 -0
- package/dist/app-error.js +41 -0
- package/dist/app-error.js.map +1 -0
- package/dist/config.d.ts +90 -0
- package/dist/config.js +240 -0
- package/dist/config.js.map +1 -0
- package/dist/core/acceptance-checks.d.ts +48 -0
- package/dist/core/acceptance-checks.js +151 -0
- package/dist/core/acceptance-checks.js.map +1 -0
- package/dist/core/action-threats.d.ts +68 -0
- package/dist/core/action-threats.js +894 -0
- package/dist/core/action-threats.js.map +1 -0
- package/dist/core/agent-notifications.d.ts +79 -0
- package/dist/core/agent-notifications.js +125 -0
- package/dist/core/agent-notifications.js.map +1 -0
- package/dist/core/agent-session/helpers.d.ts +26 -0
- package/dist/core/agent-session/helpers.js +47 -0
- package/dist/core/agent-session/helpers.js.map +1 -0
- package/dist/core/agent-session/mcp-tools.d.ts +87 -0
- package/dist/core/agent-session/mcp-tools.js +227 -0
- package/dist/core/agent-session/mcp-tools.js.map +1 -0
- package/dist/core/agent-session/run-loop-monitor.d.ts +63 -0
- package/dist/core/agent-session/run-loop-monitor.js +164 -0
- package/dist/core/agent-session/run-loop-monitor.js.map +1 -0
- package/dist/core/agent-session/transcript-markers.d.ts +57 -0
- package/dist/core/agent-session/transcript-markers.js +166 -0
- package/dist/core/agent-session/transcript-markers.js.map +1 -0
- package/dist/core/agent-session/verification-tracker.d.ts +71 -0
- package/dist/core/agent-session/verification-tracker.js +295 -0
- package/dist/core/agent-session/verification-tracker.js.map +1 -0
- package/dist/core/agent-session.d.ts +1401 -0
- package/dist/core/agent-session.js +5160 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/agents.d.ts +63 -0
- package/dist/core/agents.js +160 -0
- package/dist/core/agents.js.map +1 -0
- package/dist/core/ask-user.d.ts +163 -0
- package/dist/core/ask-user.js +178 -0
- package/dist/core/ask-user.js.map +1 -0
- package/dist/core/auto-update.d.ts +32 -0
- package/dist/core/auto-update.js +218 -0
- package/dist/core/auto-update.js.map +1 -0
- package/dist/core/autopilot-cycle.d.ts +127 -0
- package/dist/core/autopilot-cycle.js +182 -0
- package/dist/core/autopilot-cycle.js.map +1 -0
- package/dist/core/autopilot-gate.d.ts +106 -0
- package/dist/core/autopilot-gate.js +192 -0
- package/dist/core/autopilot-gate.js.map +1 -0
- package/dist/core/autopilot-verdict.d.ts +55 -0
- package/dist/core/autopilot-verdict.js +226 -0
- package/dist/core/autopilot-verdict.js.map +1 -0
- package/dist/core/blocked-packages-file.d.ts +33 -0
- package/dist/core/blocked-packages-file.js +274 -0
- package/dist/core/blocked-packages-file.js.map +1 -0
- package/dist/core/bundled-agents.d.ts +2 -0
- package/dist/core/bundled-agents.js +253 -0
- package/dist/core/bundled-agents.js.map +1 -0
- package/dist/core/cache-diagnostics.d.ts +72 -0
- package/dist/core/cache-diagnostics.js +200 -0
- package/dist/core/cache-diagnostics.js.map +1 -0
- package/dist/core/cache-expiry.d.ts +89 -0
- package/dist/core/cache-expiry.js +117 -0
- package/dist/core/cache-expiry.js.map +1 -0
- package/dist/core/checklist-detection.d.ts +8 -0
- package/dist/core/checklist-detection.js +238 -0
- package/dist/core/checklist-detection.js.map +1 -0
- package/dist/core/checklist-git.d.ts +19 -0
- package/dist/core/checklist-git.js +54 -0
- package/dist/core/checklist-git.js.map +1 -0
- package/dist/core/checklist-items.d.ts +182 -0
- package/dist/core/checklist-items.js +228 -0
- package/dist/core/checklist-items.js.map +1 -0
- package/dist/core/checklist-prompt.d.ts +14 -0
- package/dist/core/checklist-prompt.js +64 -0
- package/dist/core/checklist-prompt.js.map +1 -0
- package/dist/core/checklist-snapshot.d.ts +7 -0
- package/dist/core/checklist-snapshot.js +46 -0
- package/dist/core/checklist-snapshot.js.map +1 -0
- package/dist/core/checklist-store.d.ts +45 -0
- package/dist/core/checklist-store.js +281 -0
- package/dist/core/checklist-store.js.map +1 -0
- package/dist/core/checkout-record.d.ts +22 -0
- package/dist/core/checkout-record.js +68 -0
- package/dist/core/checkout-record.js.map +1 -0
- package/dist/core/checkpoint-store.d.ts +109 -0
- package/dist/core/checkpoint-store.js +260 -0
- package/dist/core/checkpoint-store.js.map +1 -0
- package/dist/core/claude-code/complete.d.ts +35 -0
- package/dist/core/claude-code/complete.js +125 -0
- package/dist/core/claude-code/complete.js.map +1 -0
- package/dist/core/claude-code/events.d.ts +67 -0
- package/dist/core/claude-code/events.js +460 -0
- package/dist/core/claude-code/events.js.map +1 -0
- package/dist/core/claude-code/live-session.d.ts +94 -0
- package/dist/core/claude-code/live-session.js +525 -0
- package/dist/core/claude-code/live-session.js.map +1 -0
- package/dist/core/claude-code/loop.d.ts +9 -0
- package/dist/core/claude-code/loop.js +15 -0
- package/dist/core/claude-code/loop.js.map +1 -0
- package/dist/core/claude-code/session-sync.d.ts +28 -0
- package/dist/core/claude-code/session-sync.js +53 -0
- package/dist/core/claude-code/session-sync.js.map +1 -0
- package/dist/core/claude-code/tool-bridge.d.ts +49 -0
- package/dist/core/claude-code/tool-bridge.js +352 -0
- package/dist/core/claude-code/tool-bridge.js.map +1 -0
- package/dist/core/claude-code/transcripts.d.ts +39 -0
- package/dist/core/claude-code/transcripts.js +195 -0
- package/dist/core/claude-code/transcripts.js.map +1 -0
- package/dist/core/code-retrieval-chunkers.d.ts +26 -0
- package/dist/core/code-retrieval-chunkers.js +264 -0
- package/dist/core/code-retrieval-chunkers.js.map +1 -0
- package/dist/core/code-retrieval.d.ts +18 -0
- package/dist/core/code-retrieval.js +124 -0
- package/dist/core/code-retrieval.js.map +1 -0
- package/dist/core/codex-request-shape.d.ts +7 -0
- package/dist/core/codex-request-shape.js +19 -0
- package/dist/core/codex-request-shape.js.map +1 -0
- package/dist/core/compaction/active-context.d.ts +16 -0
- package/dist/core/compaction/active-context.js +20 -0
- package/dist/core/compaction/active-context.js.map +1 -0
- package/dist/core/compaction/compactor.d.ts +281 -0
- package/dist/core/compaction/compactor.js +1451 -0
- package/dist/core/compaction/compactor.js.map +1 -0
- package/dist/core/compaction/plan-step-policy.d.ts +46 -0
- package/dist/core/compaction/plan-step-policy.js +57 -0
- package/dist/core/compaction/plan-step-policy.js.map +1 -0
- package/dist/core/compaction/policy.d.ts +36 -0
- package/dist/core/compaction/policy.js +144 -0
- package/dist/core/compaction/policy.js.map +1 -0
- package/dist/core/compaction/query-aware-selector.d.ts +32 -0
- package/dist/core/compaction/query-aware-selector.js +202 -0
- package/dist/core/compaction/query-aware-selector.js.map +1 -0
- package/dist/core/compaction/token-estimator.d.ts +36 -0
- package/dist/core/compaction/token-estimator.js +180 -0
- package/dist/core/compaction/token-estimator.js.map +1 -0
- package/dist/core/compaction/tool-result-pruner.d.ts +90 -0
- package/dist/core/compaction/tool-result-pruner.js +238 -0
- package/dist/core/compaction/tool-result-pruner.js.map +1 -0
- package/dist/core/completion-review.d.ts +24 -0
- package/dist/core/completion-review.js +2 -0
- package/dist/core/completion-review.js.map +1 -0
- package/dist/core/context-files.d.ts +8 -0
- package/dist/core/context-files.js +46 -0
- package/dist/core/context-files.js.map +1 -0
- package/dist/core/context-limits.d.ts +40 -0
- package/dist/core/context-limits.js +43 -0
- package/dist/core/context-limits.js.map +1 -0
- package/dist/core/custom-commands.d.ts +18 -0
- package/dist/core/custom-commands.js +57 -0
- package/dist/core/custom-commands.js.map +1 -0
- package/dist/core/destructive-git-guard.d.ts +113 -0
- package/dist/core/destructive-git-guard.js +874 -0
- package/dist/core/destructive-git-guard.js.map +1 -0
- package/dist/core/display-items.d.ts +8 -0
- package/dist/core/display-items.js +2 -0
- package/dist/core/display-items.js.map +1 -0
- package/dist/core/encode-cwd.d.ts +41 -0
- package/dist/core/encode-cwd.js +53 -0
- package/dist/core/encode-cwd.js.map +1 -0
- package/dist/core/env-delta.d.ts +34 -0
- package/dist/core/env-delta.js +84 -0
- package/dist/core/env-delta.js.map +1 -0
- package/dist/core/event-bus.d.ts +178 -0
- package/dist/core/event-bus.js +171 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +7 -0
- package/dist/core/extensions/loader.js +68 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/plugin-bundles.d.ts +13 -0
- package/dist/core/extensions/plugin-bundles.js +45 -0
- package/dist/core/extensions/plugin-bundles.js.map +1 -0
- package/dist/core/extensions/types.d.ts +18 -0
- package/dist/core/extensions/types.js +2 -0
- package/dist/core/extensions/types.js.map +1 -0
- package/dist/core/foreign-session-import.d.ts +119 -0
- package/dist/core/foreign-session-import.js +598 -0
- package/dist/core/foreign-session-import.js.map +1 -0
- package/dist/core/foreign-transcript-blocks.d.ts +50 -0
- package/dist/core/foreign-transcript-blocks.js +151 -0
- package/dist/core/foreign-transcript-blocks.js.map +1 -0
- package/dist/core/frontmatter.d.ts +22 -0
- package/dist/core/frontmatter.js +90 -0
- package/dist/core/frontmatter.js.map +1 -0
- package/dist/core/goal-run-marker.d.ts +32 -0
- package/dist/core/goal-run-marker.js +178 -0
- package/dist/core/goal-run-marker.js.map +1 -0
- package/dist/core/goal-summary.d.ts +15 -0
- package/dist/core/goal-summary.js +110 -0
- package/dist/core/goal-summary.js.map +1 -0
- package/dist/core/goals-store.d.ts +208 -0
- package/dist/core/goals-store.js +577 -0
- package/dist/core/goals-store.js.map +1 -0
- package/dist/core/hashline.d.ts +51 -0
- package/dist/core/hashline.js +76 -0
- package/dist/core/hashline.js.map +1 -0
- package/dist/core/idle-wake.d.ts +62 -0
- package/dist/core/idle-wake.js +103 -0
- package/dist/core/idle-wake.js.map +1 -0
- package/dist/core/index.d.ts +15 -0
- package/dist/core/index.js +15 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/injection-detect.d.ts +39 -0
- package/dist/core/injection-detect.js +241 -0
- package/dist/core/injection-detect.js.map +1 -0
- package/dist/core/installed-threats.d.ts +23 -0
- package/dist/core/installed-threats.js +71 -0
- package/dist/core/installed-threats.js.map +1 -0
- package/dist/core/internal-diagnostics.d.ts +159 -0
- package/dist/core/internal-diagnostics.js +495 -0
- package/dist/core/internal-diagnostics.js.map +1 -0
- package/dist/core/keep-awake.d.ts +88 -0
- package/dist/core/keep-awake.js +251 -0
- package/dist/core/keep-awake.js.map +1 -0
- package/dist/core/ken-ask-answer.d.ts +24 -0
- package/dist/core/ken-ask-answer.js +96 -0
- package/dist/core/ken-ask-answer.js.map +1 -0
- package/dist/core/ken-context.d.ts +119 -0
- package/dist/core/ken-context.js +447 -0
- package/dist/core/ken-context.js.map +1 -0
- package/dist/core/ken-model.d.ts +45 -0
- package/dist/core/ken-model.js +26 -0
- package/dist/core/ken-model.js.map +1 -0
- package/dist/core/ken-prompt.d.ts +21 -0
- package/dist/core/ken-prompt.js +370 -0
- package/dist/core/ken-prompt.js.map +1 -0
- package/dist/core/language-detector.d.ts +41 -0
- package/dist/core/language-detector.js +293 -0
- package/dist/core/language-detector.js.map +1 -0
- package/dist/core/live-preview.d.ts +26 -0
- package/dist/core/live-preview.js +80 -0
- package/dist/core/live-preview.js.map +1 -0
- package/dist/core/local-endpoint-store.d.ts +53 -0
- package/dist/core/local-endpoint-store.js +221 -0
- package/dist/core/local-endpoint-store.js.map +1 -0
- package/dist/core/logger.d.ts +21 -0
- package/dist/core/logger.js +94 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/loop-breaker.d.ts +89 -0
- package/dist/core/loop-breaker.js +204 -0
- package/dist/core/loop-breaker.js.map +1 -0
- package/dist/core/lsp/client.d.ts +206 -0
- package/dist/core/lsp/client.js +685 -0
- package/dist/core/lsp/client.js.map +1 -0
- package/dist/core/lsp/edit-telemetry.d.ts +26 -0
- package/dist/core/lsp/edit-telemetry.js +52 -0
- package/dist/core/lsp/edit-telemetry.js.map +1 -0
- package/dist/core/lsp/format.d.ts +11 -0
- package/dist/core/lsp/format.js +30 -0
- package/dist/core/lsp/format.js.map +1 -0
- package/dist/core/lsp/jsonrpc.d.ts +68 -0
- package/dist/core/lsp/jsonrpc.js +153 -0
- package/dist/core/lsp/jsonrpc.js.map +1 -0
- package/dist/core/lsp/manager.d.ts +188 -0
- package/dist/core/lsp/manager.js +576 -0
- package/dist/core/lsp/manager.js.map +1 -0
- package/dist/core/lsp/pool.d.ts +114 -0
- package/dist/core/lsp/pool.js +259 -0
- package/dist/core/lsp/pool.js.map +1 -0
- package/dist/core/lsp/project-root.d.ts +9 -0
- package/dist/core/lsp/project-root.js +75 -0
- package/dist/core/lsp/project-root.js.map +1 -0
- package/dist/core/lsp/reference-project.d.ts +6 -0
- package/dist/core/lsp/reference-project.js +110 -0
- package/dist/core/lsp/reference-project.js.map +1 -0
- package/dist/core/lsp/servers.d.ts +44 -0
- package/dist/core/lsp/servers.js +289 -0
- package/dist/core/lsp/servers.js.map +1 -0
- package/dist/core/lsp/test-support.d.ts +17 -0
- package/dist/core/lsp/test-support.js +27 -0
- package/dist/core/lsp/test-support.js.map +1 -0
- package/dist/core/mcp/catalog-cache.d.ts +64 -0
- package/dist/core/mcp/catalog-cache.js +166 -0
- package/dist/core/mcp/catalog-cache.js.map +1 -0
- package/dist/core/mcp/client.d.ts +317 -0
- package/dist/core/mcp/client.js +1168 -0
- package/dist/core/mcp/client.js.map +1 -0
- package/dist/core/mcp/content.d.ts +23 -0
- package/dist/core/mcp/content.js +194 -0
- package/dist/core/mcp/content.js.map +1 -0
- package/dist/core/mcp/defaults.d.ts +26 -0
- package/dist/core/mcp/defaults.js +81 -0
- package/dist/core/mcp/defaults.js.map +1 -0
- package/dist/core/mcp/deferred-catalog.d.ts +53 -0
- package/dist/core/mcp/deferred-catalog.js +117 -0
- package/dist/core/mcp/deferred-catalog.js.map +1 -0
- package/dist/core/mcp/elicitation-bridge.d.ts +40 -0
- package/dist/core/mcp/elicitation-bridge.js +36 -0
- package/dist/core/mcp/elicitation-bridge.js.map +1 -0
- package/dist/core/mcp/index.d.ts +16 -0
- package/dist/core/mcp/index.js +10 -0
- package/dist/core/mcp/index.js.map +1 -0
- package/dist/core/mcp/loopback.d.ts +26 -0
- package/dist/core/mcp/loopback.js +66 -0
- package/dist/core/mcp/loopback.js.map +1 -0
- package/dist/core/mcp/oauth-provider.d.ts +55 -0
- package/dist/core/mcp/oauth-provider.js +106 -0
- package/dist/core/mcp/oauth-provider.js.map +1 -0
- package/dist/core/mcp/oauth-store.d.ts +44 -0
- package/dist/core/mcp/oauth-store.js +76 -0
- package/dist/core/mcp/oauth-store.js.map +1 -0
- package/dist/core/mcp/parse-add-command.d.ts +50 -0
- package/dist/core/mcp/parse-add-command.js +391 -0
- package/dist/core/mcp/parse-add-command.js.map +1 -0
- package/dist/core/mcp/resolve-stdio.d.ts +77 -0
- package/dist/core/mcp/resolve-stdio.js +359 -0
- package/dist/core/mcp/resolve-stdio.js.map +1 -0
- package/dist/core/mcp/shared-pool.d.ts +157 -0
- package/dist/core/mcp/shared-pool.js +236 -0
- package/dist/core/mcp/shared-pool.js.map +1 -0
- package/dist/core/mcp/store.d.ts +100 -0
- package/dist/core/mcp/store.js +202 -0
- package/dist/core/mcp/store.js.map +1 -0
- package/dist/core/mcp/tool-guard.d.ts +58 -0
- package/dist/core/mcp/tool-guard.js +215 -0
- package/dist/core/mcp/tool-guard.js.map +1 -0
- package/dist/core/mcp/types.d.ts +57 -0
- package/dist/core/mcp/types.js +2 -0
- package/dist/core/mcp/types.js.map +1 -0
- package/dist/core/message-images.d.ts +11 -0
- package/dist/core/message-images.js +52 -0
- package/dist/core/message-images.js.map +1 -0
- package/dist/core/model-unavailable.d.ts +14 -0
- package/dist/core/model-unavailable.js +23 -0
- package/dist/core/model-unavailable.js.map +1 -0
- package/dist/core/network-guard.d.ts +28 -0
- package/dist/core/network-guard.js +251 -0
- package/dist/core/network-guard.js.map +1 -0
- package/dist/core/node-debugger.d.ts +148 -0
- package/dist/core/node-debugger.js +642 -0
- package/dist/core/node-debugger.js.map +1 -0
- package/dist/core/opencode-catalog-store.d.ts +20 -0
- package/dist/core/opencode-catalog-store.js +82 -0
- package/dist/core/opencode-catalog-store.js.map +1 -0
- package/dist/core/openrouter-catalog-store.d.ts +24 -0
- package/dist/core/openrouter-catalog-store.js +140 -0
- package/dist/core/openrouter-catalog-store.js.map +1 -0
- package/dist/core/package-cooldown.d.ts +69 -0
- package/dist/core/package-cooldown.js +297 -0
- package/dist/core/package-cooldown.js.map +1 -0
- package/dist/core/package-threats.d.ts +92 -0
- package/dist/core/package-threats.js +1339 -0
- package/dist/core/package-threats.js.map +1 -0
- package/dist/core/parked-requests.d.ts +43 -0
- package/dist/core/parked-requests.js +34 -0
- package/dist/core/parked-requests.js.map +1 -0
- package/dist/core/persistent-shell.d.ts +81 -0
- package/dist/core/persistent-shell.js +452 -0
- package/dist/core/persistent-shell.js.map +1 -0
- package/dist/core/plan-delta.d.ts +23 -0
- package/dist/core/plan-delta.js +36 -0
- package/dist/core/plan-delta.js.map +1 -0
- package/dist/core/plan-handoff.d.ts +38 -0
- package/dist/core/plan-handoff.js +21 -0
- package/dist/core/plan-handoff.js.map +1 -0
- package/dist/core/plan-submission-gate.d.ts +28 -0
- package/dist/core/plan-submission-gate.js +27 -0
- package/dist/core/plan-submission-gate.js.map +1 -0
- package/dist/core/platform-clis.d.ts +15 -0
- package/dist/core/platform-clis.js +299 -0
- package/dist/core/platform-clis.js.map +1 -0
- package/dist/core/process-gate.d.ts +61 -0
- package/dist/core/process-gate.js +103 -0
- package/dist/core/process-gate.js.map +1 -0
- package/dist/core/process-manager.d.ts +242 -0
- package/dist/core/process-manager.js +902 -0
- package/dist/core/process-manager.js.map +1 -0
- package/dist/core/progress/engine.d.ts +22 -0
- package/dist/core/progress/engine.js +131 -0
- package/dist/core/progress/engine.js.map +1 -0
- package/dist/core/progress/git-xp.d.ts +15 -0
- package/dist/core/progress/git-xp.js +100 -0
- package/dist/core/progress/git-xp.js.map +1 -0
- package/dist/core/progress/ranks.d.ts +31 -0
- package/dist/core/progress/ranks.js +310 -0
- package/dist/core/progress/ranks.js.map +1 -0
- package/dist/core/progress/rebuild.d.ts +8 -0
- package/dist/core/progress/rebuild.js +125 -0
- package/dist/core/progress/rebuild.js.map +1 -0
- package/dist/core/progress/store.d.ts +34 -0
- package/dist/core/progress/store.js +200 -0
- package/dist/core/progress/store.js.map +1 -0
- package/dist/core/progress/types.d.ts +56 -0
- package/dist/core/progress/types.js +2 -0
- package/dist/core/progress/types.js.map +1 -0
- package/dist/core/project-discovery.d.ts +64 -0
- package/dist/core/project-discovery.js +908 -0
- package/dist/core/project-discovery.js.map +1 -0
- package/dist/core/project-files.d.ts +15 -0
- package/dist/core/project-files.js +37 -0
- package/dist/core/project-files.js.map +1 -0
- package/dist/core/project-health-scan.d.ts +109 -0
- package/dist/core/project-health-scan.js +673 -0
- package/dist/core/project-health-scan.js.map +1 -0
- package/dist/core/project-health-score.d.ts +41 -0
- package/dist/core/project-health-score.js +257 -0
- package/dist/core/project-health-score.js.map +1 -0
- package/dist/core/prompt-command-expansion.d.ts +13 -0
- package/dist/core/prompt-command-expansion.js +48 -0
- package/dist/core/prompt-command-expansion.js.map +1 -0
- package/dist/core/prompt-commands.d.ts +13 -0
- package/dist/core/prompt-commands.js +370 -0
- package/dist/core/prompt-commands.js.map +1 -0
- package/dist/core/pull-requests.d.ts +18 -0
- package/dist/core/pull-requests.js +95 -0
- package/dist/core/pull-requests.js.map +1 -0
- package/dist/core/radio-players.d.ts +28 -0
- package/dist/core/radio-players.js +132 -0
- package/dist/core/radio-players.js.map +1 -0
- package/dist/core/radio.d.ts +42 -0
- package/dist/core/radio.js +499 -0
- package/dist/core/radio.js.map +1 -0
- package/dist/core/regrounding.d.ts +37 -0
- package/dist/core/regrounding.js +89 -0
- package/dist/core/regrounding.js.map +1 -0
- package/dist/core/resolve-start.d.ts +28 -0
- package/dist/core/resolve-start.js +35 -0
- package/dist/core/resolve-start.js.map +1 -0
- package/dist/core/run-claim.d.ts +36 -0
- package/dist/core/run-claim.js +46 -0
- package/dist/core/run-claim.js.map +1 -0
- package/dist/core/run-lifecycle.d.ts +58 -0
- package/dist/core/run-lifecycle.js +104 -0
- package/dist/core/run-lifecycle.js.map +1 -0
- package/dist/core/run-status.d.ts +17 -0
- package/dist/core/run-status.js +28 -0
- package/dist/core/run-status.js.map +1 -0
- package/dist/core/runtime-mode.d.ts +21 -0
- package/dist/core/runtime-mode.js +43 -0
- package/dist/core/runtime-mode.js.map +1 -0
- package/dist/core/sandbox-domains.d.ts +13 -0
- package/dist/core/sandbox-domains.js +76 -0
- package/dist/core/sandbox-domains.js.map +1 -0
- package/dist/core/sandbox-feedback.d.ts +21 -0
- package/dist/core/sandbox-feedback.js +69 -0
- package/dist/core/sandbox-feedback.js.map +1 -0
- package/dist/core/sandbox.d.ts +106 -0
- package/dist/core/sandbox.js +383 -0
- package/dist/core/sandbox.js.map +1 -0
- package/dist/core/semantic-loop-check.d.ts +58 -0
- package/dist/core/semantic-loop-check.js +103 -0
- package/dist/core/semantic-loop-check.js.map +1 -0
- package/dist/core/session-compaction.d.ts +23 -0
- package/dist/core/session-compaction.js +54 -0
- package/dist/core/session-compaction.js.map +1 -0
- package/dist/core/session-export.d.ts +97 -0
- package/dist/core/session-export.js +368 -0
- package/dist/core/session-export.js.map +1 -0
- package/dist/core/session-history.d.ts +160 -0
- package/dist/core/session-history.js +467 -0
- package/dist/core/session-history.js.map +1 -0
- package/dist/core/session-manager.d.ts +512 -0
- package/dist/core/session-manager.js +1370 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/session-preview.d.ts +12 -0
- package/dist/core/session-preview.js +58 -0
- package/dist/core/session-preview.js.map +1 -0
- package/dist/core/session-storage.d.ts +78 -0
- package/dist/core/session-storage.js +659 -0
- package/dist/core/session-storage.js.map +1 -0
- package/dist/core/session-summary-index.d.ts +51 -0
- package/dist/core/session-summary-index.js +192 -0
- package/dist/core/session-summary-index.js.map +1 -0
- package/dist/core/settings-manager.d.ts +113 -0
- package/dist/core/settings-manager.js +281 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/shared-checkout-guard.d.ts +78 -0
- package/dist/core/shared-checkout-guard.js +219 -0
- package/dist/core/shared-checkout-guard.js.map +1 -0
- package/dist/core/shell-path.d.ts +13 -0
- package/dist/core/shell-path.js +175 -0
- package/dist/core/shell-path.js.map +1 -0
- package/dist/core/shell-threats-popular-packages.d.ts +11 -0
- package/dist/core/shell-threats-popular-packages.js +675 -0
- package/dist/core/shell-threats-popular-packages.js.map +1 -0
- package/dist/core/shell-threats.d.ts +21 -0
- package/dist/core/shell-threats.js +235 -0
- package/dist/core/shell-threats.js.map +1 -0
- package/dist/core/shell.d.ts +54 -0
- package/dist/core/shell.js +99 -0
- package/dist/core/shell.js.map +1 -0
- package/dist/core/shutdown.d.ts +70 -0
- package/dist/core/shutdown.js +144 -0
- package/dist/core/shutdown.js.map +1 -0
- package/dist/core/skill-scan.d.ts +112 -0
- package/dist/core/skill-scan.js +781 -0
- package/dist/core/skill-scan.js.map +1 -0
- package/dist/core/skills.d.ts +80 -0
- package/dist/core/skills.js +270 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/slash-commands.d.ts +58 -0
- package/dist/core/slash-commands.js +242 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/core/steering.d.ts +47 -0
- package/dist/core/steering.js +65 -0
- package/dist/core/steering.js.map +1 -0
- package/dist/core/steroids.d.ts +66 -0
- package/dist/core/steroids.js +243 -0
- package/dist/core/steroids.js.map +1 -0
- package/dist/core/stream-diag-level.d.ts +3 -0
- package/dist/core/stream-diag-level.js +24 -0
- package/dist/core/stream-diag-level.js.map +1 -0
- package/dist/core/stream-rules.d.ts +30 -0
- package/dist/core/stream-rules.js +151 -0
- package/dist/core/stream-rules.js.map +1 -0
- package/dist/core/subagent-manager.d.ts +242 -0
- package/dist/core/subagent-manager.js +1075 -0
- package/dist/core/subagent-manager.js.map +1 -0
- package/dist/core/subagent-policy.d.ts +9 -0
- package/dist/core/subagent-policy.js +41 -0
- package/dist/core/subagent-policy.js.map +1 -0
- package/dist/core/subagent-receipt.d.ts +54 -0
- package/dist/core/subagent-receipt.js +274 -0
- package/dist/core/subagent-receipt.js.map +1 -0
- package/dist/core/subagent-store.d.ts +41 -0
- package/dist/core/subagent-store.js +284 -0
- package/dist/core/subagent-store.js.map +1 -0
- package/dist/core/subagent-turn-record.d.ts +18 -0
- package/dist/core/subagent-turn-record.js +82 -0
- package/dist/core/subagent-turn-record.js.map +1 -0
- package/dist/core/tasks-store.d.ts +31 -0
- package/dist/core/tasks-store.js +97 -0
- package/dist/core/tasks-store.js.map +1 -0
- package/dist/core/telegram-config.d.ts +20 -0
- package/dist/core/telegram-config.js +52 -0
- package/dist/core/telegram-config.js.map +1 -0
- package/dist/core/telegram.d.ts +114 -0
- package/dist/core/telegram.js +275 -0
- package/dist/core/telegram.js.map +1 -0
- package/dist/core/temp-paths.d.ts +5 -0
- package/dist/core/temp-paths.js +50 -0
- package/dist/core/temp-paths.js.map +1 -0
- package/dist/core/test-impact.d.ts +73 -0
- package/dist/core/test-impact.js +467 -0
- package/dist/core/test-impact.js.map +1 -0
- package/dist/core/threat-feed.d.ts +65 -0
- package/dist/core/threat-feed.js +334 -0
- package/dist/core/threat-feed.js.map +1 -0
- package/dist/core/trophies/catalog-more.d.ts +2 -0
- package/dist/core/trophies/catalog-more.js +837 -0
- package/dist/core/trophies/catalog-more.js.map +1 -0
- package/dist/core/trophies/catalog.d.ts +4 -0
- package/dist/core/trophies/catalog.js +649 -0
- package/dist/core/trophies/catalog.js.map +1 -0
- package/dist/core/trophies/engine.d.ts +70 -0
- package/dist/core/trophies/engine.js +347 -0
- package/dist/core/trophies/engine.js.map +1 -0
- package/dist/core/trophies/store.d.ts +17 -0
- package/dist/core/trophies/store.js +113 -0
- package/dist/core/trophies/store.js.map +1 -0
- package/dist/core/trophies/types.d.ts +87 -0
- package/dist/core/trophies/types.js +74 -0
- package/dist/core/trophies/types.js.map +1 -0
- package/dist/core/ui-adoption.d.ts +32 -0
- package/dist/core/ui-adoption.js +302 -0
- package/dist/core/ui-adoption.js.map +1 -0
- package/dist/core/ui-compatibility.d.ts +10 -0
- package/dist/core/ui-compatibility.js +51 -0
- package/dist/core/ui-compatibility.js.map +1 -0
- package/dist/core/ui-registry.d.ts +101 -0
- package/dist/core/ui-registry.js +292 -0
- package/dist/core/ui-registry.js.map +1 -0
- package/dist/core/user-shell-context.d.ts +8 -0
- package/dist/core/user-shell-context.js +12 -0
- package/dist/core/user-shell-context.js.map +1 -0
- package/dist/core/verification-evidence.d.ts +49 -0
- package/dist/core/verification-evidence.js +816 -0
- package/dist/core/verification-evidence.js.map +1 -0
- package/dist/core/verification-gate.d.ts +77 -0
- package/dist/core/verification-gate.js +504 -0
- package/dist/core/verification-gate.js.map +1 -0
- package/dist/core/verification-snapshot.d.ts +7 -0
- package/dist/core/verification-snapshot.js +109 -0
- package/dist/core/verification-snapshot.js.map +1 -0
- package/dist/core/verify-commands.d.ts +34 -0
- package/dist/core/verify-commands.js +203 -0
- package/dist/core/verify-commands.js.map +1 -0
- package/dist/core/voice-transcriber.d.ts +32 -0
- package/dist/core/voice-transcriber.js +114 -0
- package/dist/core/voice-transcriber.js.map +1 -0
- package/dist/core/workspace-guard.d.ts +56 -0
- package/dist/core/workspace-guard.js +334 -0
- package/dist/core/workspace-guard.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/session.d.ts +44 -0
- package/dist/session.js +105 -0
- package/dist/session.js.map +1 -0
- package/dist/system-prompt.d.ts +104 -0
- package/dist/system-prompt.js +480 -0
- package/dist/system-prompt.js.map +1 -0
- package/dist/test-support/fake-home.d.ts +19 -0
- package/dist/test-support/fake-home.js +37 -0
- package/dist/test-support/fake-home.js.map +1 -0
- package/dist/test-support/keep-alive.d.ts +14 -0
- package/dist/test-support/keep-alive.js +17 -0
- package/dist/test-support/keep-alive.js.map +1 -0
- package/dist/test-support/slow-git.d.ts +1 -0
- package/dist/test-support/slow-git.js +21 -0
- package/dist/test-support/slow-git.js.map +1 -0
- package/dist/test-support/system-tools.d.ts +6 -0
- package/dist/test-support/system-tools.js +36 -0
- package/dist/test-support/system-tools.js.map +1 -0
- package/dist/tools/ask-user.d.ts +34 -0
- package/dist/tools/ask-user.js +99 -0
- package/dist/tools/ask-user.js.map +1 -0
- package/dist/tools/background-watch-lint.d.ts +18 -0
- package/dist/tools/background-watch-lint.js +102 -0
- package/dist/tools/background-watch-lint.js.map +1 -0
- package/dist/tools/bash-read-evidence.d.ts +23 -0
- package/dist/tools/bash-read-evidence.js +180 -0
- package/dist/tools/bash-read-evidence.js.map +1 -0
- package/dist/tools/bash.d.ts +64 -0
- package/dist/tools/bash.js +552 -0
- package/dist/tools/bash.js.map +1 -0
- package/dist/tools/browser-api.d.ts +27 -0
- package/dist/tools/browser-api.js +449 -0
- package/dist/tools/browser-api.js.map +1 -0
- package/dist/tools/browser-sandbox.d.ts +16 -0
- package/dist/tools/browser-sandbox.js +158 -0
- package/dist/tools/browser-sandbox.js.map +1 -0
- package/dist/tools/browser-session.d.ts +84 -0
- package/dist/tools/browser-session.js +304 -0
- package/dist/tools/browser-session.js.map +1 -0
- package/dist/tools/browser-snapshot.d.ts +19 -0
- package/dist/tools/browser-snapshot.js +109 -0
- package/dist/tools/browser-snapshot.js.map +1 -0
- package/dist/tools/browser.d.ts +11 -0
- package/dist/tools/browser.js +106 -0
- package/dist/tools/browser.js.map +1 -0
- package/dist/tools/checklist.d.ts +49 -0
- package/dist/tools/checklist.js +154 -0
- package/dist/tools/checklist.js.map +1 -0
- package/dist/tools/compress.d.ts +56 -0
- package/dist/tools/compress.js +226 -0
- package/dist/tools/compress.js.map +1 -0
- package/dist/tools/debug.d.ts +54 -0
- package/dist/tools/debug.js +230 -0
- package/dist/tools/debug.js.map +1 -0
- package/dist/tools/document-text.d.ts +6 -0
- package/dist/tools/document-text.js +154 -0
- package/dist/tools/document-text.js.map +1 -0
- package/dist/tools/edit-diff.d.ts +123 -0
- package/dist/tools/edit-diff.js +476 -0
- package/dist/tools/edit-diff.js.map +1 -0
- package/dist/tools/edit-targets.d.ts +10 -0
- package/dist/tools/edit-targets.js +31 -0
- package/dist/tools/edit-targets.js.map +1 -0
- package/dist/tools/edit.d.ts +38 -0
- package/dist/tools/edit.js +695 -0
- package/dist/tools/edit.js.map +1 -0
- package/dist/tools/enter-plan.d.ts +7 -0
- package/dist/tools/enter-plan.js +20 -0
- package/dist/tools/enter-plan.js.map +1 -0
- package/dist/tools/exit-plan.d.ts +7 -0
- package/dist/tools/exit-plan.js +51 -0
- package/dist/tools/exit-plan.js.map +1 -0
- package/dist/tools/find.d.ts +17 -0
- package/dist/tools/find.js +100 -0
- package/dist/tools/find.js.map +1 -0
- package/dist/tools/generate-image.d.ts +83 -0
- package/dist/tools/generate-image.js +625 -0
- package/dist/tools/generate-image.js.map +1 -0
- package/dist/tools/grep-scan.d.ts +96 -0
- package/dist/tools/grep-scan.js +283 -0
- package/dist/tools/grep-scan.js.map +1 -0
- package/dist/tools/grep.d.ts +48 -0
- package/dist/tools/grep.js +1013 -0
- package/dist/tools/grep.js.map +1 -0
- package/dist/tools/html-extract.d.ts +57 -0
- package/dist/tools/html-extract.js +130 -0
- package/dist/tools/html-extract.js.map +1 -0
- package/dist/tools/index.d.ts +198 -0
- package/dist/tools/index.js +216 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/live-preview.d.ts +23 -0
- package/dist/tools/live-preview.js +41 -0
- package/dist/tools/live-preview.js.map +1 -0
- package/dist/tools/ls.d.ts +9 -0
- package/dist/tools/ls.js +59 -0
- package/dist/tools/ls.js.map +1 -0
- package/dist/tools/operations.d.ts +86 -0
- package/dist/tools/operations.js +117 -0
- package/dist/tools/operations.js.map +1 -0
- package/dist/tools/overflow.d.ts +17 -0
- package/dist/tools/overflow.js +68 -0
- package/dist/tools/overflow.js.map +1 -0
- package/dist/tools/path-utils.d.ts +30 -0
- package/dist/tools/path-utils.js +74 -0
- package/dist/tools/path-utils.js.map +1 -0
- package/dist/tools/pdf-extract.d.ts +17 -0
- package/dist/tools/pdf-extract.js +43 -0
- package/dist/tools/pdf-extract.js.map +1 -0
- package/dist/tools/prompt-hints.d.ts +46 -0
- package/dist/tools/prompt-hints.js +171 -0
- package/dist/tools/prompt-hints.js.map +1 -0
- package/dist/tools/read-only-bash.d.ts +31 -0
- package/dist/tools/read-only-bash.js +338 -0
- package/dist/tools/read-only-bash.js.map +1 -0
- package/dist/tools/read-tracker.d.ts +43 -0
- package/dist/tools/read-tracker.js +120 -0
- package/dist/tools/read-tracker.js.map +1 -0
- package/dist/tools/read.d.ts +18 -0
- package/dist/tools/read.js +316 -0
- package/dist/tools/read.js.map +1 -0
- package/dist/tools/redaction-guard.d.ts +10 -0
- package/dist/tools/redaction-guard.js +55 -0
- package/dist/tools/redaction-guard.js.map +1 -0
- package/dist/tools/routine-output.d.ts +39 -0
- package/dist/tools/routine-output.js +281 -0
- package/dist/tools/routine-output.js.map +1 -0
- package/dist/tools/safe-env.d.ts +1 -0
- package/dist/tools/safe-env.js +79 -0
- package/dist/tools/safe-env.js.map +1 -0
- package/dist/tools/session-stats.d.ts +26 -0
- package/dist/tools/session-stats.js +51 -0
- package/dist/tools/session-stats.js.map +1 -0
- package/dist/tools/side-web-search.d.ts +34 -0
- package/dist/tools/side-web-search.js +146 -0
- package/dist/tools/side-web-search.js.map +1 -0
- package/dist/tools/skill.d.ts +12 -0
- package/dist/tools/skill.js +94 -0
- package/dist/tools/skill.js.map +1 -0
- package/dist/tools/source-path.d.ts +8 -0
- package/dist/tools/source-path.js +135 -0
- package/dist/tools/source-path.js.map +1 -0
- package/dist/tools/steroids.d.ts +44 -0
- package/dist/tools/steroids.js +356 -0
- package/dist/tools/steroids.js.map +1 -0
- package/dist/tools/subagent-control.d.ts +5 -0
- package/dist/tools/subagent-control.js +211 -0
- package/dist/tools/subagent-control.js.map +1 -0
- package/dist/tools/subagent-shared.d.ts +115 -0
- package/dist/tools/subagent-shared.js +182 -0
- package/dist/tools/subagent-shared.js.map +1 -0
- package/dist/tools/subagent.d.ts +39 -0
- package/dist/tools/subagent.js +412 -0
- package/dist/tools/subagent.js.map +1 -0
- package/dist/tools/task-output.d.ts +10 -0
- package/dist/tools/task-output.js +74 -0
- package/dist/tools/task-output.js.map +1 -0
- package/dist/tools/task-send.d.ts +11 -0
- package/dist/tools/task-send.js +36 -0
- package/dist/tools/task-send.js.map +1 -0
- package/dist/tools/task-stop.d.ts +8 -0
- package/dist/tools/task-stop.js +15 -0
- package/dist/tools/task-stop.js.map +1 -0
- package/dist/tools/tasks.d.ts +15 -0
- package/dist/tools/tasks.js +94 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/tools/tool-search.d.ts +26 -0
- package/dist/tools/tool-search.js +81 -0
- package/dist/tools/tool-search.js.map +1 -0
- package/dist/tools/tool-tiers.d.ts +65 -0
- package/dist/tools/tool-tiers.js +121 -0
- package/dist/tools/tool-tiers.js.map +1 -0
- package/dist/tools/truncate.d.ts +39 -0
- package/dist/tools/truncate.js +242 -0
- package/dist/tools/truncate.js.map +1 -0
- package/dist/tools/ui-adopt.d.ts +16 -0
- package/dist/tools/ui-adopt.js +66 -0
- package/dist/tools/ui-adopt.js.map +1 -0
- package/dist/tools/ui-registry.d.ts +15 -0
- package/dist/tools/ui-registry.js +39 -0
- package/dist/tools/ui-registry.js.map +1 -0
- package/dist/tools/verification-review.d.ts +2 -0
- package/dist/tools/verification-review.js +41 -0
- package/dist/tools/verification-review.js.map +1 -0
- package/dist/tools/web-fetch.d.ts +52 -0
- package/dist/tools/web-fetch.js +986 -0
- package/dist/tools/web-fetch.js.map +1 -0
- package/dist/tools/web-search.d.ts +35 -0
- package/dist/tools/web-search.js +926 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/tools/write.d.ts +16 -0
- package/dist/tools/write.js +196 -0
- package/dist/tools/write.js.map +1 -0
- package/dist/types.d.ts +44 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/commit-message.d.ts +25 -0
- package/dist/utils/commit-message.js +72 -0
- package/dist/utils/commit-message.js.map +1 -0
- package/dist/utils/git.d.ts +102 -0
- package/dist/utils/git.js +325 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/github-ci.d.ts +9 -0
- package/dist/utils/github-ci.js +138 -0
- package/dist/utils/github-ci.js.map +1 -0
- package/dist/utils/github.d.ts +19 -0
- package/dist/utils/github.js +67 -0
- package/dist/utils/github.js.map +1 -0
- package/dist/utils/image.d.ts +166 -0
- package/dist/utils/image.js +673 -0
- package/dist/utils/image.js.map +1 -0
- package/dist/utils/open-browser.d.ts +13 -0
- package/dist/utils/open-browser.js +31 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/dist/utils/plan-steps.d.ts +90 -0
- package/dist/utils/plan-steps.js +209 -0
- package/dist/utils/plan-steps.js.map +1 -0
- package/dist/utils/process.d.ts +48 -0
- package/dist/utils/process.js +175 -0
- package/dist/utils/process.js.map +1 -0
- package/dist/utils/prompt-enhancer.d.ts +34 -0
- package/dist/utils/prompt-enhancer.js +178 -0
- package/dist/utils/prompt-enhancer.js.map +1 -0
- package/dist/utils/text.d.ts +61 -0
- package/dist/utils/text.js +68 -0
- package/dist/utils/text.js.map +1 -0
- package/package.json +87 -3
|
@@ -0,0 +1,816 @@
|
|
|
1
|
+
import { hasUnsafeShellSyntax, isReadOnlyCommand, splitShellCommandSegments, } from "../tools/read-only-bash.js";
|
|
2
|
+
const LONG_RUNNING_FLAGS = new Set([
|
|
3
|
+
"--watch",
|
|
4
|
+
"--watchall",
|
|
5
|
+
"--watchall=false",
|
|
6
|
+
"--ui",
|
|
7
|
+
"--inspect",
|
|
8
|
+
"--inspect-brk",
|
|
9
|
+
"-w",
|
|
10
|
+
]);
|
|
11
|
+
const MUTATING_FLAGS = new Set([
|
|
12
|
+
"--init",
|
|
13
|
+
"--build",
|
|
14
|
+
"-b",
|
|
15
|
+
"--clean",
|
|
16
|
+
"--fix",
|
|
17
|
+
"--write",
|
|
18
|
+
"--update",
|
|
19
|
+
"-u",
|
|
20
|
+
"--updatesnapshot",
|
|
21
|
+
"--incremental",
|
|
22
|
+
"--tsbuildinfofile",
|
|
23
|
+
"--emitdeclarationonly",
|
|
24
|
+
]);
|
|
25
|
+
const AMBIGUOUS_FLAGS = new Set([
|
|
26
|
+
"--nocheck",
|
|
27
|
+
"--listfilesonly",
|
|
28
|
+
"--showconfig",
|
|
29
|
+
"--help",
|
|
30
|
+
"-h",
|
|
31
|
+
"--version",
|
|
32
|
+
"--generatetrace",
|
|
33
|
+
"--traceresolution",
|
|
34
|
+
"--diagnostics",
|
|
35
|
+
"--extendeddiagnostics",
|
|
36
|
+
"--generatecpuprofile",
|
|
37
|
+
"--collect-only",
|
|
38
|
+
"--listtests",
|
|
39
|
+
]);
|
|
40
|
+
const SAFE_PACKAGE_SCRIPTS = /^(?:test(?::(?:unit|integration|e2e))?|check|typecheck|type-check|lint(?::check)?|format(?::check|-check)|prettier:check)$/i;
|
|
41
|
+
const UNSAFE_PACKAGE_SCRIPTS = /^(?:build|clean|dev|serve|start|watch|preview|prepare|install|format(?!:check$)|lint:fix|test:watch)(?::|$)/i;
|
|
42
|
+
const VERIFIER_WORDS = /(?:^|\s|\/)(?:tsc|vitest|jest|pytest|eslint|prettier|pyright|mypy|ruff|cargo|go|shellcheck)(?:\s|$)/i;
|
|
43
|
+
function tokenize(segment) {
|
|
44
|
+
return segment
|
|
45
|
+
.trim()
|
|
46
|
+
.split(/\s+/)
|
|
47
|
+
.map((token) => token.replace(/^["']|["']$/g, ""))
|
|
48
|
+
.filter(Boolean);
|
|
49
|
+
}
|
|
50
|
+
function lowerFlags(tokens) {
|
|
51
|
+
return new Set(tokens.filter((token) => token.startsWith("-")).map((token) => token.toLowerCase()));
|
|
52
|
+
}
|
|
53
|
+
function hasFlag(flags, denied) {
|
|
54
|
+
for (const flag of flags) {
|
|
55
|
+
const name = flag.split("=")[0];
|
|
56
|
+
if (denied.has(flag) || denied.has(name))
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
function rejected(candidate, reason, mayMutate = false) {
|
|
62
|
+
return { accepted: false, candidate, reason, mayMutate };
|
|
63
|
+
}
|
|
64
|
+
function accepted(reason) {
|
|
65
|
+
return { accepted: true, candidate: true, reason, mayMutate: false };
|
|
66
|
+
}
|
|
67
|
+
function classifyTsc(tokens) {
|
|
68
|
+
const flags = lowerFlags(tokens);
|
|
69
|
+
if (hasFlag(flags, LONG_RUNNING_FLAGS))
|
|
70
|
+
return rejected(true, "long-running watch/debug mode");
|
|
71
|
+
if (hasFlag(flags, MUTATING_FLAGS))
|
|
72
|
+
return rejected(true, "mutating or artifact-producing mode", true);
|
|
73
|
+
if (hasFlag(flags, AMBIGUOUS_FLAGS) || flags.has("-v")) {
|
|
74
|
+
return rejected(true, "does not prove type correctness");
|
|
75
|
+
}
|
|
76
|
+
if (!flags.has("--noemit"))
|
|
77
|
+
// Without --noEmit tsc EMITS files, so it is both unproven and rewriting.
|
|
78
|
+
return rejected(true, "tsc must explicitly use --noEmit", true);
|
|
79
|
+
return accepted("bounded TypeScript no-emit check");
|
|
80
|
+
}
|
|
81
|
+
function classifyTestRunner(executable, tokens) {
|
|
82
|
+
const flags = lowerFlags(tokens);
|
|
83
|
+
if (hasFlag(flags, LONG_RUNNING_FLAGS) || flags.has("--watch=false")) {
|
|
84
|
+
return rejected(true, "long-running or interactive test mode");
|
|
85
|
+
}
|
|
86
|
+
if (hasFlag(flags, MUTATING_FLAGS))
|
|
87
|
+
return rejected(true, "mutating test/update mode", true);
|
|
88
|
+
if (hasFlag(flags, AMBIGUOUS_FLAGS))
|
|
89
|
+
return rejected(true, "does not execute the test suite");
|
|
90
|
+
if (executable === "vitest") {
|
|
91
|
+
const positional = tokens.slice(1).filter((token) => !token.startsWith("-"));
|
|
92
|
+
if (!positional.includes("run") && !flags.has("--run")) {
|
|
93
|
+
return rejected(true, "vitest must explicitly use one-shot run mode");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return accepted("bounded one-shot test check");
|
|
97
|
+
}
|
|
98
|
+
function classifyDirect(tokens) {
|
|
99
|
+
const executable = tokens[0]?.replace(/^.*[\\/]/, "").toLowerCase();
|
|
100
|
+
if (!executable)
|
|
101
|
+
return rejected(false, "empty command");
|
|
102
|
+
if (executable === "tsc")
|
|
103
|
+
return classifyTsc(tokens);
|
|
104
|
+
if ((executable === "node" || executable === "node.exe") && tokens.includes("--test")) {
|
|
105
|
+
// simplification: require --test first; supporting preceding Node options
|
|
106
|
+
// needs option-arity parsing so script arguments cannot masquerade as flags.
|
|
107
|
+
if (tokens[1] !== "--test")
|
|
108
|
+
return rejected(true, "--test must lead Node arguments");
|
|
109
|
+
if (tokens.some((token) => ["-e", "--eval", "-p", "--print"].includes(token))) {
|
|
110
|
+
return rejected(true, "inline evaluation is not verification");
|
|
111
|
+
}
|
|
112
|
+
return classifyTestRunner("node", tokens);
|
|
113
|
+
}
|
|
114
|
+
if (/^python(?:3(?:\.\d+)?)?(?:\.exe)?$/.test(executable) && tokens[1] === "-m") {
|
|
115
|
+
if (["pytest", "unittest"].includes(tokens[2])) {
|
|
116
|
+
return classifyTestRunner(tokens[2], tokens.slice(2));
|
|
117
|
+
}
|
|
118
|
+
// `python -m ruff check` is the same bounded check as `ruff check`.
|
|
119
|
+
if (["ruff", "mypy", "pyright"].includes(tokens[2]))
|
|
120
|
+
return classifyDirect(tokens.slice(2));
|
|
121
|
+
}
|
|
122
|
+
if (executable === "vitest" || executable === "jest" || executable === "pytest") {
|
|
123
|
+
return classifyTestRunner(executable, tokens);
|
|
124
|
+
}
|
|
125
|
+
const flags = lowerFlags(tokens);
|
|
126
|
+
if (["eslint", "prettier", "ruff"].includes(executable)) {
|
|
127
|
+
if (hasFlag(flags, LONG_RUNNING_FLAGS))
|
|
128
|
+
return rejected(true, "long-running mode");
|
|
129
|
+
if (hasFlag(flags, MUTATING_FLAGS))
|
|
130
|
+
return rejected(true, "mutating formatter/linter mode", true);
|
|
131
|
+
if (hasFlag(flags, AMBIGUOUS_FLAGS))
|
|
132
|
+
return rejected(true, "does not execute a static check");
|
|
133
|
+
if (executable === "prettier" && !flags.has("--check")) {
|
|
134
|
+
return rejected(true, "prettier must explicitly use --check");
|
|
135
|
+
}
|
|
136
|
+
if (executable === "ruff" && tokens[1] === "format" && !flags.has("--check")) {
|
|
137
|
+
return rejected(true, "ruff format must explicitly use --check");
|
|
138
|
+
}
|
|
139
|
+
return accepted("bounded static check");
|
|
140
|
+
}
|
|
141
|
+
if (["pyright", "mypy", "shellcheck"].includes(executable)) {
|
|
142
|
+
if (hasFlag(flags, LONG_RUNNING_FLAGS))
|
|
143
|
+
return rejected(true, "long-running mode");
|
|
144
|
+
if (hasFlag(flags, AMBIGUOUS_FLAGS))
|
|
145
|
+
return rejected(true, "does not execute a static check");
|
|
146
|
+
return accepted("bounded static check");
|
|
147
|
+
}
|
|
148
|
+
if (executable === "cargo") {
|
|
149
|
+
const subcommand = tokens[1]?.toLowerCase();
|
|
150
|
+
if (subcommand === "build" || subcommand === "clean" || subcommand === "run") {
|
|
151
|
+
return rejected(true, "artifact-producing Cargo command", true);
|
|
152
|
+
}
|
|
153
|
+
if (subcommand === "fmt" && !flags.has("--check")) {
|
|
154
|
+
return rejected(true, "cargo fmt must explicitly use --check", true);
|
|
155
|
+
}
|
|
156
|
+
return ["check", "clippy", "test", "fmt"].includes(subcommand)
|
|
157
|
+
? accepted("bounded Cargo check")
|
|
158
|
+
: rejected(false, "not a recognized verification command");
|
|
159
|
+
}
|
|
160
|
+
if (executable === "go") {
|
|
161
|
+
const subcommand = tokens[1]?.toLowerCase();
|
|
162
|
+
return subcommand === "test" || subcommand === "vet"
|
|
163
|
+
? accepted("bounded Go check")
|
|
164
|
+
: rejected(subcommand === "build" || subcommand === "clean", "not a bounded Go check", subcommand === "build");
|
|
165
|
+
}
|
|
166
|
+
return rejected(VERIFIER_WORDS.test(tokens.join(" ")), "not a recognized verification command");
|
|
167
|
+
}
|
|
168
|
+
function classifyPackageRunner(tokens) {
|
|
169
|
+
const runner = tokens[0].toLowerCase();
|
|
170
|
+
let index = 1;
|
|
171
|
+
while (index < tokens.length) {
|
|
172
|
+
const token = tokens[index].toLowerCase();
|
|
173
|
+
if (["--filter", "-f", "--dir", "-c"].includes(token)) {
|
|
174
|
+
index += 2;
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (token === "--workspace-root" ||
|
|
178
|
+
token === "-w" ||
|
|
179
|
+
token.startsWith("--filter=") ||
|
|
180
|
+
token.startsWith("--dir=")) {
|
|
181
|
+
index += 1;
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
const action = tokens[index]?.toLowerCase();
|
|
187
|
+
if (!action)
|
|
188
|
+
return rejected(false, "package runner has no command");
|
|
189
|
+
if (["exec", "x", "dlx"].includes(action))
|
|
190
|
+
return classifyDirect(tokens.slice(index + 1));
|
|
191
|
+
const scriptIndex = action === "run" ? index + 1 : index;
|
|
192
|
+
const script = tokens[scriptIndex]?.toLowerCase();
|
|
193
|
+
if (!script)
|
|
194
|
+
return rejected(false, "package runner has no script");
|
|
195
|
+
if (UNSAFE_PACKAGE_SCRIPTS.test(script)) {
|
|
196
|
+
const result = rejected(true, "mutating, artifact-producing, or long-running package script", true);
|
|
197
|
+
const flags = lowerFlags(tokens.slice(scriptIndex + 1));
|
|
198
|
+
// Only ordinary builds qualify, and only with a host-owned before/after
|
|
199
|
+
// snapshot. Never infer safety for fixers, watchers or another directory.
|
|
200
|
+
if (script === "build" &&
|
|
201
|
+
!tokens.some((token) => /^(?:--dir|--prefix|--cwd|-C|-c|-w|--workspace-root)(?:=|$)/.test(token)) &&
|
|
202
|
+
!hasFlag(flags, LONG_RUNNING_FLAGS) &&
|
|
203
|
+
!hasFlag(flags, MUTATING_FLAGS) &&
|
|
204
|
+
!hasFlag(flags, AMBIGUOUS_FLAGS))
|
|
205
|
+
result.snapshotEligible = true;
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
208
|
+
if (!SAFE_PACKAGE_SCRIPTS.test(script)) {
|
|
209
|
+
// pnpm permits omitting exec for installed binaries, e.g. pnpm vitest run.
|
|
210
|
+
if (runner === "pnpm" && action !== "run")
|
|
211
|
+
return classifyDirect(tokens.slice(index));
|
|
212
|
+
return rejected(false, "package script is not a recognized verification check");
|
|
213
|
+
}
|
|
214
|
+
const scriptArgs = tokens.slice(scriptIndex + 1).filter((token) => token !== "--");
|
|
215
|
+
const flags = lowerFlags(scriptArgs);
|
|
216
|
+
if (hasFlag(flags, LONG_RUNNING_FLAGS))
|
|
217
|
+
return rejected(true, "long-running package-script mode");
|
|
218
|
+
if (hasFlag(flags, MUTATING_FLAGS))
|
|
219
|
+
return rejected(true, "mutating package-script mode", true);
|
|
220
|
+
if (hasFlag(flags, AMBIGUOUS_FLAGS))
|
|
221
|
+
return rejected(true, "package script does not prove correctness");
|
|
222
|
+
return accepted(`bounded ${runner} verification script`);
|
|
223
|
+
}
|
|
224
|
+
/** Trailing stderr redirects that cannot change a check's exit status or write a
|
|
225
|
+
* file: merging stderr into stdout, or discarding it. Anything else (`> file`,
|
|
226
|
+
* `2> log`) still reaches the unsafe-syntax rejection. */
|
|
227
|
+
const HARMLESS_STDERR_SUFFIX = /\s+2>(?:&1|\/dev\/null)\s*$/;
|
|
228
|
+
function classifySegment(rawSegment) {
|
|
229
|
+
const segment = rawSegment.replace(HARMLESS_STDERR_SUFFIX, "");
|
|
230
|
+
const candidate = VERIFIER_WORDS.test(segment) || /(?:^|\s)(?:pnpm|npm|yarn|bun)(?:\s|$)/i.test(segment);
|
|
231
|
+
if (hasUnsafeShellSyntax(segment))
|
|
232
|
+
return rejected(candidate, "unsafe shell syntax or redirection");
|
|
233
|
+
const tokens = tokenize(segment);
|
|
234
|
+
const first = tokens[0]?.toLowerCase();
|
|
235
|
+
if (["pnpm", "npm", "yarn", "bun"].includes(first))
|
|
236
|
+
return classifyPackageRunner(tokens);
|
|
237
|
+
if (["npx", "bunx"].includes(first))
|
|
238
|
+
return classifyDirect(tokens.slice(1));
|
|
239
|
+
return classifyDirect(tokens);
|
|
240
|
+
}
|
|
241
|
+
/** tail/head with at most a line-count argument: pure output limiters. They
|
|
242
|
+
* cannot rewrite, filter, or otherwise transform what the check proved — the
|
|
243
|
+
* exit status (pipefail-protected) and the kept tail are the full evidence. */
|
|
244
|
+
const PIPE_LIMITER = /^(?:tail|head)(?:\s+(?:-[1-9]\d*|-n\s*\d+|--lines(?:=|\s+)\d+))?\s*$/;
|
|
245
|
+
/** Fail-closed classifier: bounded checks with narrowly allowed non-check preludes.
|
|
246
|
+
*
|
|
247
|
+
* `posixShell`: the command runs under bash with pipefail (GG's bash tool on
|
|
248
|
+
* macOS/Linux, or Windows with Git Bash). Only then can read-only commands
|
|
249
|
+
* around a check count: cmd.exe has no pipefail, and there `;` is not a
|
|
250
|
+
* separator, so `cat a; npm test` would run only `cat`. Default off, so a
|
|
251
|
+
* caller that does not know the shell fails closed. */
|
|
252
|
+
export function classifyVerificationCommand(command, { posixShell = false } = {}) {
|
|
253
|
+
const strict = classifyStrict(command);
|
|
254
|
+
if (strict.accepted || !posixShell || !checkWithReadOnlyContext(command))
|
|
255
|
+
return strict;
|
|
256
|
+
// Never certified from the transcript: the live host must also see the
|
|
257
|
+
// workspace unchanged across the run (snapshotEligible), exactly as for an
|
|
258
|
+
// ordinary build. Non-preserve-only, so a clean pass is fresh evidence.
|
|
259
|
+
return {
|
|
260
|
+
...rejected(true, "check with read-only commands around it"),
|
|
261
|
+
snapshotEligible: true,
|
|
262
|
+
ambiguousFailure: true,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
/** Stand-in for a `( … )` group already proven to contain only read-only commands. */
|
|
266
|
+
const READ_ONLY_GROUP = "\u0000read-only-group";
|
|
267
|
+
/** Index of the `)` closing the `(` at `open`, skipping quoted text. -1 when
|
|
268
|
+
* unbalanced or when the inside holds anything this cannot account for. */
|
|
269
|
+
function closingParen(text, open) {
|
|
270
|
+
let quote = null;
|
|
271
|
+
for (let i = open + 1; i < text.length; i++) {
|
|
272
|
+
const ch = text[i];
|
|
273
|
+
if (quote) {
|
|
274
|
+
if (ch === quote)
|
|
275
|
+
quote = null;
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
if (ch === "'" || ch === '"')
|
|
279
|
+
quote = ch;
|
|
280
|
+
else if (ch === "(")
|
|
281
|
+
return -1; // no nesting
|
|
282
|
+
else if (ch === ")")
|
|
283
|
+
return i;
|
|
284
|
+
}
|
|
285
|
+
return -1;
|
|
286
|
+
}
|
|
287
|
+
/** True when `inner` (a group or `$( … )` body) runs read-only commands only. */
|
|
288
|
+
function readOnlyInner(inner) {
|
|
289
|
+
const pipelines = parsePipelines(inner);
|
|
290
|
+
return pipelines !== null && pipelines.every(({ stages }) => stages.every(isReadOnlyContext));
|
|
291
|
+
}
|
|
292
|
+
/** Quote- and operator-level parse of a command into pipelines and the
|
|
293
|
+
* separator that follows each. Null for anything this cannot fully account
|
|
294
|
+
* for: escapes, backticks, variable expansion (except `$?`), redirections
|
|
295
|
+
* (beyond a check's stderr merge), background `&`, comments, negation, brace
|
|
296
|
+
* groups. `$( … )` and `( … )` are allowed only around read-only commands. */
|
|
297
|
+
function parsePipelines(command) {
|
|
298
|
+
// A NUL could forge the vetted-group stand-in (and never reaches a shell).
|
|
299
|
+
if (command.includes("\u0000"))
|
|
300
|
+
return null;
|
|
301
|
+
const text = command.replace(/\s2>(?:&1|\/dev\/null)(?=\s*(?:\||&&|;|\n|$))/g, "");
|
|
302
|
+
const pipelines = [];
|
|
303
|
+
let stages = [];
|
|
304
|
+
let current = "";
|
|
305
|
+
let quote = null;
|
|
306
|
+
let afterGroup = false;
|
|
307
|
+
const endStage = () => {
|
|
308
|
+
const stage = current.trim();
|
|
309
|
+
current = "";
|
|
310
|
+
afterGroup = false;
|
|
311
|
+
if (!stage || stage.startsWith("!"))
|
|
312
|
+
return false;
|
|
313
|
+
stages.push(stage);
|
|
314
|
+
return true;
|
|
315
|
+
};
|
|
316
|
+
const endPipeline = (next) => {
|
|
317
|
+
if (!endStage())
|
|
318
|
+
return false;
|
|
319
|
+
pipelines.push({ stages, next });
|
|
320
|
+
stages = [];
|
|
321
|
+
return true;
|
|
322
|
+
};
|
|
323
|
+
for (let i = 0; i < text.length; i++) {
|
|
324
|
+
const ch = text[i];
|
|
325
|
+
const nextCh = text[i + 1] ?? "";
|
|
326
|
+
if (quote === "'") {
|
|
327
|
+
if (ch === "'")
|
|
328
|
+
quote = null;
|
|
329
|
+
current += ch;
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
if (afterGroup && !/\s/.test(ch) && !"&|;\n".includes(ch))
|
|
333
|
+
return null;
|
|
334
|
+
if (ch === "`" || ch === "\\")
|
|
335
|
+
return null;
|
|
336
|
+
if (ch === "$") {
|
|
337
|
+
if (nextCh === "?") {
|
|
338
|
+
// The previous exit status: a number, it cannot run anything.
|
|
339
|
+
current += "0";
|
|
340
|
+
i++;
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
343
|
+
if (nextCh === "(") {
|
|
344
|
+
const close = closingParen(text, i + 1);
|
|
345
|
+
if (close === -1 || !readOnlyInner(text.slice(i + 2, close)))
|
|
346
|
+
return null;
|
|
347
|
+
current += "Q";
|
|
348
|
+
i = close;
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
351
|
+
// Any other expansion (`$VAR`, `${…}`, `$'\x2d'` ANSI-C quoting) can
|
|
352
|
+
// produce text this cannot see. Only a bare `$` is literal.
|
|
353
|
+
if (nextCh !== "" && !/\s/.test(nextCh))
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
if (quote === '"') {
|
|
357
|
+
if (ch === '"')
|
|
358
|
+
quote = null;
|
|
359
|
+
current += ch;
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (ch === "'" || ch === '"') {
|
|
363
|
+
quote = ch;
|
|
364
|
+
current += ch;
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
if (ch === "(" && current.trim() === "") {
|
|
368
|
+
const close = closingParen(text, i);
|
|
369
|
+
if (close === -1 || !readOnlyInner(text.slice(i + 1, close)))
|
|
370
|
+
return null;
|
|
371
|
+
current = READ_ONLY_GROUP;
|
|
372
|
+
afterGroup = true;
|
|
373
|
+
i = close;
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
if ("(){}<>".includes(ch))
|
|
377
|
+
return null;
|
|
378
|
+
if (ch === "#" && (current === "" || /\s$/.test(current)))
|
|
379
|
+
return null;
|
|
380
|
+
if (ch === "&") {
|
|
381
|
+
if (nextCh !== "&" || !endPipeline("&&"))
|
|
382
|
+
return null;
|
|
383
|
+
i++;
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
if (ch === "|") {
|
|
387
|
+
if (nextCh === "|") {
|
|
388
|
+
if (!endPipeline("||"))
|
|
389
|
+
return null;
|
|
390
|
+
i++;
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
if (nextCh === "&" || !endStage())
|
|
394
|
+
return null;
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
if (ch === ";" || ch === "\n") {
|
|
398
|
+
if (current.trim() === "" && stages.length === 0)
|
|
399
|
+
continue; // blank line
|
|
400
|
+
if (!endPipeline(";"))
|
|
401
|
+
return null;
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
current += ch;
|
|
405
|
+
}
|
|
406
|
+
if (quote !== null)
|
|
407
|
+
return null;
|
|
408
|
+
if (current.trim() === "" && stages.length === 0) {
|
|
409
|
+
// Trailing separator: the last pipeline has no successor after all.
|
|
410
|
+
const last = pipelines.at(-1);
|
|
411
|
+
if (last)
|
|
412
|
+
last.next = null;
|
|
413
|
+
}
|
|
414
|
+
else if (!endPipeline(null))
|
|
415
|
+
return null;
|
|
416
|
+
return pipelines.length > 0 ? pipelines : null;
|
|
417
|
+
}
|
|
418
|
+
/** Pure stream filters allowed after a check. None exists in cmd.exe, so on a
|
|
419
|
+
* shell without pipefail the pipeline cannot exit 0 through them. */
|
|
420
|
+
const PIPE_FILTERS = new Set(["tail", "head", "grep", "egrep", "fgrep", "rg", "wc", "cat"]);
|
|
421
|
+
/** Read-only git around a check: no `-c`/`-C` globals (they can run helpers). */
|
|
422
|
+
const CONTEXT_GIT = /^git\s+(?:status|diff|log|show)(?:\s|$)/;
|
|
423
|
+
/** Quoted text masked so read-only screening cannot be confused by `|`, `>`
|
|
424
|
+
* or `;` inside patterns; a quoted flag (`"-o"`) stays visible to it. */
|
|
425
|
+
function maskQuotes(stage) {
|
|
426
|
+
let hiddenFlag = false;
|
|
427
|
+
const masked = stage.replace(/'[^']*'|"[^"]*"/g, (quoted) => {
|
|
428
|
+
if (/^.-/.test(quoted))
|
|
429
|
+
hiddenFlag = true;
|
|
430
|
+
return "Q";
|
|
431
|
+
});
|
|
432
|
+
return hiddenFlag ? null : masked;
|
|
433
|
+
}
|
|
434
|
+
function isReadOnlyContext(stage) {
|
|
435
|
+
if (stage === READ_ONLY_GROUP)
|
|
436
|
+
return true;
|
|
437
|
+
const masked = maskQuotes(stage);
|
|
438
|
+
if (masked === null || !isReadOnlyCommand(masked))
|
|
439
|
+
return false;
|
|
440
|
+
const word = masked.split(/\s+/)[0];
|
|
441
|
+
return word !== "git" || CONTEXT_GIT.test(masked);
|
|
442
|
+
}
|
|
443
|
+
function isPipeFilter(stage) {
|
|
444
|
+
const masked = maskQuotes(stage);
|
|
445
|
+
if (masked === null)
|
|
446
|
+
return false;
|
|
447
|
+
const words = masked.split(/\s+/);
|
|
448
|
+
if (!PIPE_FILTERS.has(words[0] ?? ""))
|
|
449
|
+
return false;
|
|
450
|
+
// A follow mode never ends; it could only time the check out.
|
|
451
|
+
if (words.some((w) => /^(?:-f|-F|--follow(?:=.*)?|--retry)$/.test(w)))
|
|
452
|
+
return false;
|
|
453
|
+
return isReadOnlyCommand(masked);
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* A real check with read-only commands around it, as models write them:
|
|
457
|
+
* `cat a.js; npm test 2>&1 | grep -E "pass|fail"`, `npm test && git diff --stat`,
|
|
458
|
+
* `(rg -n old || echo none) && npm test 2>&1 | tail -15`.
|
|
459
|
+
*
|
|
460
|
+
* Exit 0 still proves every check passed, because:
|
|
461
|
+
* - every check pipeline is a recognised bounded check piped only through pure
|
|
462
|
+
* filters, and the agent shell runs with pipefail;
|
|
463
|
+
* - a check is never reached through `||` (`cat a || npm test` exits 0 without
|
|
464
|
+
* testing), and from the first check on everything is joined by `&&`, so no
|
|
465
|
+
* later command's status can replace a failed check's;
|
|
466
|
+
* - everything else is read-only; before the first check, `;` and `||` are
|
|
467
|
+
* fine because those statuses never become the command's;
|
|
468
|
+
* - a leading `cd dir &&` may pick the directory, as for a bare check. If it
|
|
469
|
+
* fails, a later `;` runs the check in the project root, which is still the
|
|
470
|
+
* workspace the host compares.
|
|
471
|
+
* The host additionally compares workspace inputs before and after the run
|
|
472
|
+
* (snapshotEligible), so nothing in the chain can rewrite what was checked.
|
|
473
|
+
*/
|
|
474
|
+
function checkWithReadOnlyContext(command) {
|
|
475
|
+
const pipelines = parsePipelines(command);
|
|
476
|
+
if (pipelines === null)
|
|
477
|
+
return false;
|
|
478
|
+
let seenCheck = false;
|
|
479
|
+
let previous = null;
|
|
480
|
+
for (const [index, { stages, next }] of pipelines.entries()) {
|
|
481
|
+
const [head, ...rest] = stages;
|
|
482
|
+
const isCheck = classifySegment(head).accepted && rest.every(isPipeFilter);
|
|
483
|
+
if (isCheck) {
|
|
484
|
+
if (previous === "||")
|
|
485
|
+
return false;
|
|
486
|
+
seenCheck = true;
|
|
487
|
+
}
|
|
488
|
+
else if (index === 0 && rest.length === 0 && next === "&&" && /^cd\s+\S+$/.test(head)) {
|
|
489
|
+
// working-directory prelude
|
|
490
|
+
}
|
|
491
|
+
else if (!stages.every(isReadOnlyContext))
|
|
492
|
+
return false;
|
|
493
|
+
if (seenCheck && (next === ";" || next === "||"))
|
|
494
|
+
return false;
|
|
495
|
+
previous = next;
|
|
496
|
+
}
|
|
497
|
+
return seenCheck;
|
|
498
|
+
}
|
|
499
|
+
function classifyStrict(command) {
|
|
500
|
+
const candidate = VERIFIER_WORDS.test(command) || /(?:^|\s)(?:pnpm|npm|yarn|bun)(?:\s|$)/i.test(command);
|
|
501
|
+
// Only && preserves fail-closed evidence across a chain. OR, semicolons, and
|
|
502
|
+
// newlines can still hide a failed check behind a later zero exit status.
|
|
503
|
+
if (command.includes("||") || command.includes(";") || command.includes("\n")) {
|
|
504
|
+
return rejected(candidate, "shell control operator can hide a failed check");
|
|
505
|
+
}
|
|
506
|
+
// Pipes are evidence ONLY as `check | tail/head`: the agent shell runs with
|
|
507
|
+
// pipefail, so the pipeline reports the check's own status, and a limiter
|
|
508
|
+
// cannot transform results. Any other pipe stage can (grep, tee, wc…) — rejected.
|
|
509
|
+
if (/(^|[^|])\|([^|]|$)/.test(command)) {
|
|
510
|
+
const stages = command.split("|");
|
|
511
|
+
const check = stages[0].replace(/\s*2>&1\s*$/, "").trim();
|
|
512
|
+
const limitersOk = stages.slice(1).every((stage) => PIPE_LIMITER.test(stage.trim()));
|
|
513
|
+
if (!limitersOk || !check) {
|
|
514
|
+
return rejected(candidate, "pipe stage can transform check results");
|
|
515
|
+
}
|
|
516
|
+
const head = classifyVerificationCommand(check);
|
|
517
|
+
return head.accepted
|
|
518
|
+
? accepted("piped check with output limiter (pipefail)")
|
|
519
|
+
: rejected(head.candidate || candidate, head.reason, head.mayMutate);
|
|
520
|
+
}
|
|
521
|
+
const segments = splitShellCommandSegments(command);
|
|
522
|
+
if (segments.length === 0)
|
|
523
|
+
return rejected(false, "empty command");
|
|
524
|
+
const results = segments.map((segment, index) => {
|
|
525
|
+
const tokens = tokenize(segment);
|
|
526
|
+
// A leading directory change is not itself evidence. && ensures it must
|
|
527
|
+
// succeed, and a real bounded check must still follow it.
|
|
528
|
+
if (index < segments.length - 1 &&
|
|
529
|
+
tokens[0] === "cd" &&
|
|
530
|
+
tokens.length === 2 &&
|
|
531
|
+
!hasUnsafeShellSyntax(segment))
|
|
532
|
+
return accepted("working-directory prelude");
|
|
533
|
+
// Status is not evidence itself; a real check must follow through &&.
|
|
534
|
+
// simplification: only basic status flags; expand with vetted flags, not arbitrary Git commands.
|
|
535
|
+
if (index < segments.length - 1 &&
|
|
536
|
+
/^git\s+status(?:\s+(?:--short|-s|--branch|-b|--porcelain(?:=[12])?))*$/.test(segment.trim()))
|
|
537
|
+
return accepted("git status prelude");
|
|
538
|
+
return classifySegment(segment);
|
|
539
|
+
});
|
|
540
|
+
const firstRejected = results.find((result) => !result.accepted);
|
|
541
|
+
if (firstRejected) {
|
|
542
|
+
// Preludes are `accepted` only so a real check may follow them; they are
|
|
543
|
+
// never checks themselves, so they must not make a chain a check candidate
|
|
544
|
+
// or qualify it for snapshot comparison.
|
|
545
|
+
const isPrelude = (entry) => entry.reason === "git status prelude" || entry.reason === "working-directory prelude";
|
|
546
|
+
const hasRealCheck = results.some((entry) => entry.accepted && !isPrelude(entry));
|
|
547
|
+
const result = rejected(results.some((entry) => entry.candidate && !isPrelude(entry)), firstRejected.reason, results.some((entry) => entry.mayMutate));
|
|
548
|
+
if (results.every((entry) => entry.accepted || entry.snapshotEligible) &&
|
|
549
|
+
!results.some((entry) => entry.reason === "working-directory prelude")) {
|
|
550
|
+
result.snapshotEligible = true;
|
|
551
|
+
}
|
|
552
|
+
else if (!result.mayMutate &&
|
|
553
|
+
hasRealCheck &&
|
|
554
|
+
!results.some((entry) => entry.reason === "working-directory prelude") &&
|
|
555
|
+
segments.every((segment) => !hasUnsafeShellSyntax(segment))) {
|
|
556
|
+
// Mixed check/script chains remain rejected. A host-observed successful
|
|
557
|
+
// exit plus unchanged inputs can only retain evidence from earlier checks.
|
|
558
|
+
result.snapshotEligible = true;
|
|
559
|
+
result.snapshotPreserveOnly = true;
|
|
560
|
+
}
|
|
561
|
+
return result;
|
|
562
|
+
}
|
|
563
|
+
return accepted(segments.length === 1 ? results[0].reason : "bounded verification command chain");
|
|
564
|
+
}
|
|
565
|
+
/** `name` of a heredoc introduced at `start` (just past `<<`/`<<-`), with the
|
|
566
|
+
* index after it. Quotes around the delimiter are removed. */
|
|
567
|
+
function readHeredocDelimiter(command, start) {
|
|
568
|
+
let i = start;
|
|
569
|
+
while (command[i] === " " || command[i] === "\t")
|
|
570
|
+
i++;
|
|
571
|
+
const quote = command[i] === "'" || command[i] === '"' ? command[i] : null;
|
|
572
|
+
if (quote) {
|
|
573
|
+
const close = command.indexOf(quote, i + 1);
|
|
574
|
+
if (close < 0)
|
|
575
|
+
return null;
|
|
576
|
+
return { word: command.slice(i + 1, close), end: close + 1 };
|
|
577
|
+
}
|
|
578
|
+
const match = /^[^\s;&|<>()]+/.exec(command.slice(i));
|
|
579
|
+
return match ? { word: match[0].replace(/\\/g, ""), end: i + match[0].length } : null;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* The top-level segments of a shell command: split on `;`, `&&`, `||`, `|`,
|
|
583
|
+
* `&` and newlines, but not inside quotes, `$( … )`, `( … )`, backticks or
|
|
584
|
+
* heredoc bodies, and never on redirections (`2>&1`, `&>`). Comments are
|
|
585
|
+
* dropped. Null when the text cannot be accounted for (an unterminated quote,
|
|
586
|
+
* group or heredoc).
|
|
587
|
+
*
|
|
588
|
+
* Only {@link extractStandaloneCheck} uses this, and whatever it returns is
|
|
589
|
+
* re-run and judged on its own exit status, so a misread here can at worst
|
|
590
|
+
* re-run a real check; it can never turn into evidence by itself.
|
|
591
|
+
*/
|
|
592
|
+
function topLevelSegments(command) {
|
|
593
|
+
const segments = [];
|
|
594
|
+
const heredocs = [];
|
|
595
|
+
let current = "";
|
|
596
|
+
let before = null;
|
|
597
|
+
let depth = 0;
|
|
598
|
+
const end = (op) => {
|
|
599
|
+
const text = current.trim();
|
|
600
|
+
if (text)
|
|
601
|
+
segments.push({ text, before, after: op });
|
|
602
|
+
current = "";
|
|
603
|
+
if (text || op !== "\n")
|
|
604
|
+
before = op;
|
|
605
|
+
};
|
|
606
|
+
let i = 0;
|
|
607
|
+
while (i < command.length) {
|
|
608
|
+
const ch = command[i];
|
|
609
|
+
const next = command[i + 1];
|
|
610
|
+
if (ch === "\\") {
|
|
611
|
+
current += command.slice(i, i + 2);
|
|
612
|
+
i += 2;
|
|
613
|
+
continue;
|
|
614
|
+
}
|
|
615
|
+
if (ch === "'" || ch === "`") {
|
|
616
|
+
const close = command.indexOf(ch, i + 1);
|
|
617
|
+
if (close < 0)
|
|
618
|
+
return null;
|
|
619
|
+
current += command.slice(i, close + 1);
|
|
620
|
+
i = close + 1;
|
|
621
|
+
continue;
|
|
622
|
+
}
|
|
623
|
+
if (ch === '"') {
|
|
624
|
+
let j = i + 1;
|
|
625
|
+
while (j < command.length && command[j] !== '"')
|
|
626
|
+
j += command[j] === "\\" ? 2 : 1;
|
|
627
|
+
if (j >= command.length)
|
|
628
|
+
return null;
|
|
629
|
+
current += command.slice(i, j + 1);
|
|
630
|
+
i = j + 1;
|
|
631
|
+
continue;
|
|
632
|
+
}
|
|
633
|
+
if (ch === "#" && (current === "" || /\s$/.test(current))) {
|
|
634
|
+
const newline = command.indexOf("\n", i);
|
|
635
|
+
i = newline < 0 ? command.length : newline;
|
|
636
|
+
continue;
|
|
637
|
+
}
|
|
638
|
+
if (ch === "<" && next === "<" && command[i + 2] !== "<") {
|
|
639
|
+
const stripTabs = command[i + 2] === "-";
|
|
640
|
+
const delimiter = readHeredocDelimiter(command, i + (stripTabs ? 3 : 2));
|
|
641
|
+
if (!delimiter)
|
|
642
|
+
return null;
|
|
643
|
+
heredocs.push({ word: delimiter.word, stripTabs });
|
|
644
|
+
current += command.slice(i, delimiter.end);
|
|
645
|
+
i = delimiter.end;
|
|
646
|
+
continue;
|
|
647
|
+
}
|
|
648
|
+
if (ch === "\n" && heredocs.length > 0) {
|
|
649
|
+
// Heredoc bodies start on the next line; skip each up to its delimiter.
|
|
650
|
+
let lineStart = i + 1;
|
|
651
|
+
for (const { word, stripTabs } of heredocs.splice(0)) {
|
|
652
|
+
for (;;) {
|
|
653
|
+
if (lineStart > command.length)
|
|
654
|
+
return null;
|
|
655
|
+
const lineEnd = command.indexOf("\n", lineStart);
|
|
656
|
+
const line = command.slice(lineStart, lineEnd < 0 ? command.length : lineEnd);
|
|
657
|
+
lineStart = lineEnd < 0 ? command.length + 1 : lineEnd + 1;
|
|
658
|
+
if ((stripTabs ? line.replace(/^\t+/, "") : line) === word)
|
|
659
|
+
break;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
if (depth === 0)
|
|
663
|
+
end("\n");
|
|
664
|
+
i = lineStart - 1;
|
|
665
|
+
continue;
|
|
666
|
+
}
|
|
667
|
+
if (ch === "(" || (ch === "$" && next === "(")) {
|
|
668
|
+
depth++;
|
|
669
|
+
current += ch === "$" ? "$(" : "(";
|
|
670
|
+
i += ch === "$" ? 2 : 1;
|
|
671
|
+
continue;
|
|
672
|
+
}
|
|
673
|
+
if (ch === ")") {
|
|
674
|
+
if (depth === 0)
|
|
675
|
+
return null;
|
|
676
|
+
depth--;
|
|
677
|
+
current += ch;
|
|
678
|
+
i++;
|
|
679
|
+
continue;
|
|
680
|
+
}
|
|
681
|
+
if (depth === 0) {
|
|
682
|
+
const pair = command.slice(i, i + 2);
|
|
683
|
+
if (pair === "&&" || pair === "||") {
|
|
684
|
+
end(pair);
|
|
685
|
+
i += 2;
|
|
686
|
+
continue;
|
|
687
|
+
}
|
|
688
|
+
if (ch === "|") {
|
|
689
|
+
end("|");
|
|
690
|
+
i += next === "&" ? 2 : 1;
|
|
691
|
+
continue;
|
|
692
|
+
}
|
|
693
|
+
if (ch === ";" || ch === "\n") {
|
|
694
|
+
end(ch);
|
|
695
|
+
i++;
|
|
696
|
+
continue;
|
|
697
|
+
}
|
|
698
|
+
// A lone & backgrounds; `>&`, `<&` and `&>` are redirections.
|
|
699
|
+
if (ch === "&" && next !== ">" && !/[<>]$/.test(current)) {
|
|
700
|
+
end("&");
|
|
701
|
+
i++;
|
|
702
|
+
continue;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
current += ch;
|
|
706
|
+
i++;
|
|
707
|
+
}
|
|
708
|
+
if (depth !== 0 || heredocs.length > 0)
|
|
709
|
+
return null;
|
|
710
|
+
end(null);
|
|
711
|
+
return segments;
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* The bounded check a refused command ran, as a command that counts on its
|
|
715
|
+
* own: `cd app && npm test` from `cd app && rg -n old . ; npm test 2>&1 |
|
|
716
|
+
* tail -15; node -e '…'`. Null when the command already counts, holds no
|
|
717
|
+
* check, or its working directory is ambiguous (a `cd` after the first
|
|
718
|
+
* segment). With several checks, the last one wins.
|
|
719
|
+
*
|
|
720
|
+
* The host re-runs the result when a turn ends unverified (see
|
|
721
|
+
* VerificationTracker.takeRefusedCheck), so the evidence is the re-run's own
|
|
722
|
+
* exit status, never the original command's.
|
|
723
|
+
*/
|
|
724
|
+
export function extractStandaloneCheck(command) {
|
|
725
|
+
if (classifyStrict(command).accepted)
|
|
726
|
+
return null;
|
|
727
|
+
const segments = topLevelSegments(command);
|
|
728
|
+
if (!segments)
|
|
729
|
+
return null;
|
|
730
|
+
let checkIndex = -1;
|
|
731
|
+
let check = "";
|
|
732
|
+
for (const [index, segment] of segments.entries()) {
|
|
733
|
+
// A pipeline's later stages are filters, never the check itself.
|
|
734
|
+
if (segment.before === "|")
|
|
735
|
+
continue;
|
|
736
|
+
const text = segment.text.replace(/\s+2>&1$/, "");
|
|
737
|
+
const verdict = classifyStrict(text);
|
|
738
|
+
if (verdict.accepted && !verdict.mayMutate) {
|
|
739
|
+
checkIndex = index;
|
|
740
|
+
check = text;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
if (checkIndex < 0)
|
|
744
|
+
return null;
|
|
745
|
+
const first = segments[0];
|
|
746
|
+
const leadingCd = checkIndex > 0 && first.after === "&&" && /^cd\s+[^\s;&|<>()$`'"]+$/.test(first.text)
|
|
747
|
+
? first.text
|
|
748
|
+
: null;
|
|
749
|
+
const moves = segments
|
|
750
|
+
.slice(leadingCd ? 1 : 0, checkIndex)
|
|
751
|
+
.some((segment) => /^(?:cd|pushd|popd)(?:\s|$)/.test(segment.text));
|
|
752
|
+
if (moves)
|
|
753
|
+
return null;
|
|
754
|
+
const standalone = leadingCd ? `${leadingCd} && ${check}` : check;
|
|
755
|
+
const verdict = classifyStrict(standalone);
|
|
756
|
+
return verdict.accepted && !verdict.mayMutate ? standalone : null;
|
|
757
|
+
}
|
|
758
|
+
function resultText(result) {
|
|
759
|
+
if (typeof result.content === "string")
|
|
760
|
+
return result.content;
|
|
761
|
+
return result.content
|
|
762
|
+
.filter((part) => part.type === "text")
|
|
763
|
+
.map((part) => part.text)
|
|
764
|
+
.join("\n");
|
|
765
|
+
}
|
|
766
|
+
/** Extract harness-owned evidence from completed bash calls in a transcript. */
|
|
767
|
+
export function collectVerificationEvidence(messages) {
|
|
768
|
+
const calls = new Map();
|
|
769
|
+
const evidence = [];
|
|
770
|
+
for (const message of messages) {
|
|
771
|
+
if (message.role === "assistant" && Array.isArray(message.content)) {
|
|
772
|
+
for (const part of message.content) {
|
|
773
|
+
if (part.type !== "tool_call" || part.name !== "bash")
|
|
774
|
+
continue;
|
|
775
|
+
const command = typeof part.args.command === "string" ? part.args.command.trim() : "";
|
|
776
|
+
const background = part.args.run_in_background === true || part.args.persist === true;
|
|
777
|
+
calls.set(part.id, {
|
|
778
|
+
command,
|
|
779
|
+
classification: classifyVerificationCommand(command),
|
|
780
|
+
background,
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
if (message.role !== "tool")
|
|
785
|
+
continue;
|
|
786
|
+
for (const result of message.content) {
|
|
787
|
+
const call = calls.get(result.toolCallId);
|
|
788
|
+
if (!call || !call.classification.candidate)
|
|
789
|
+
continue;
|
|
790
|
+
if (call.background) {
|
|
791
|
+
evidence.push({
|
|
792
|
+
command: call.command,
|
|
793
|
+
status: "rejected",
|
|
794
|
+
reason: "background or persistent commands are not bounded evidence",
|
|
795
|
+
});
|
|
796
|
+
continue;
|
|
797
|
+
}
|
|
798
|
+
if (!call.classification.accepted) {
|
|
799
|
+
evidence.push({
|
|
800
|
+
command: call.command,
|
|
801
|
+
status: "rejected",
|
|
802
|
+
reason: call.classification.reason,
|
|
803
|
+
});
|
|
804
|
+
continue;
|
|
805
|
+
}
|
|
806
|
+
const passed = !result.isError && /^Exit code:\s*0(?:\s|$)/i.test(resultText(result).trim());
|
|
807
|
+
evidence.push({
|
|
808
|
+
command: call.command,
|
|
809
|
+
status: passed ? "passed" : "failed",
|
|
810
|
+
reason: passed ? call.classification.reason : "bounded check did not exit successfully",
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
return evidence;
|
|
815
|
+
}
|
|
816
|
+
//# sourceMappingURL=verification-evidence.js.map
|