@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,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Autopilot Ken's verdict contract.
|
|
3
|
+
*
|
|
4
|
+
* In autopilot mode Ken never talks to the user — he auto-reviews GG Coder's
|
|
5
|
+
* work and replies with exactly one of four machine-parseable verdicts. The
|
|
6
|
+
* first non-empty line carries the keyword; anything after is the payload.
|
|
7
|
+
*
|
|
8
|
+
* PROMPT
|
|
9
|
+
* <runnable GG Coder prompt body: a few lines, or a short bullet list>
|
|
10
|
+
*
|
|
11
|
+
* ALL_CLEAR
|
|
12
|
+
*
|
|
13
|
+
* ALL_CLEAR CORPUS_UNVERIFIED
|
|
14
|
+
* (approval whose real-world cross-check was impossible; the flag rides on
|
|
15
|
+
* the verdict line so it can't be lost the way a separate JSON reply was)
|
|
16
|
+
*
|
|
17
|
+
* IGNORE
|
|
18
|
+
*
|
|
19
|
+
* HUMAN
|
|
20
|
+
* <one short reason the human is needed>
|
|
21
|
+
*
|
|
22
|
+
* ALL_CLEAR and IGNORE both stop the cycle with nothing left to do, but they
|
|
23
|
+
* mean different things to the UI: ALL_CLEAR is a verdict on real work ("GG
|
|
24
|
+
* Coder built/changed something and it checks out") and renders a one-line Ken
|
|
25
|
+
* marker. IGNORE means the turn was never worth reviewing in the first place
|
|
26
|
+
* (small talk, a question, an ack, a mechanical operation with no code
|
|
27
|
+
* changes) — it renders NOTHING, not even a marker, so trivial turns don't
|
|
28
|
+
* spam the transcript with a Ken bubble that adds no information.
|
|
29
|
+
*
|
|
30
|
+
* Parsing is forgiving and safe-by-default: any reply we can't confidently map
|
|
31
|
+
* to PROMPT, ALL_CLEAR, or IGNORE becomes a HUMAN stop, never a blind loop.
|
|
32
|
+
*
|
|
33
|
+
* Recovery order for prose-then-keyword drift (Ken writing commentary before
|
|
34
|
+
* the verdict despite the contract): bare trailing ALL_CLEAR/IGNORE → buried
|
|
35
|
+
* HUMAN → buried line-start PROMPT (uppercase, line-start only, so prose like
|
|
36
|
+
* "prompt the user" can never match). HUMAN wins over PROMPT when both appear
|
|
37
|
+
* — recovering a stop is always safe, recovering an action must lose ties.
|
|
38
|
+
*/
|
|
39
|
+
export type AutopilotVerdict = {
|
|
40
|
+
kind: "prompt";
|
|
41
|
+
body: string;
|
|
42
|
+
} | {
|
|
43
|
+
kind: "all_clear";
|
|
44
|
+
evidenceLimitation?: "corpus_unverified";
|
|
45
|
+
} | {
|
|
46
|
+
kind: "ignore";
|
|
47
|
+
} | {
|
|
48
|
+
kind: "human";
|
|
49
|
+
reason: string;
|
|
50
|
+
};
|
|
51
|
+
export declare const CORPUS_UNVERIFIED_REASON = "Not cross-checked against real-world implementations.";
|
|
52
|
+
/**
|
|
53
|
+
* Parse Autopilot Ken's raw reply into a verdict. Never throws.
|
|
54
|
+
*/
|
|
55
|
+
export declare function parseAutopilotVerdict(reply: string): AutopilotVerdict;
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Autopilot Ken's verdict contract.
|
|
3
|
+
*
|
|
4
|
+
* In autopilot mode Ken never talks to the user — he auto-reviews GG Coder's
|
|
5
|
+
* work and replies with exactly one of four machine-parseable verdicts. The
|
|
6
|
+
* first non-empty line carries the keyword; anything after is the payload.
|
|
7
|
+
*
|
|
8
|
+
* PROMPT
|
|
9
|
+
* <runnable GG Coder prompt body: a few lines, or a short bullet list>
|
|
10
|
+
*
|
|
11
|
+
* ALL_CLEAR
|
|
12
|
+
*
|
|
13
|
+
* ALL_CLEAR CORPUS_UNVERIFIED
|
|
14
|
+
* (approval whose real-world cross-check was impossible; the flag rides on
|
|
15
|
+
* the verdict line so it can't be lost the way a separate JSON reply was)
|
|
16
|
+
*
|
|
17
|
+
* IGNORE
|
|
18
|
+
*
|
|
19
|
+
* HUMAN
|
|
20
|
+
* <one short reason the human is needed>
|
|
21
|
+
*
|
|
22
|
+
* ALL_CLEAR and IGNORE both stop the cycle with nothing left to do, but they
|
|
23
|
+
* mean different things to the UI: ALL_CLEAR is a verdict on real work ("GG
|
|
24
|
+
* Coder built/changed something and it checks out") and renders a one-line Ken
|
|
25
|
+
* marker. IGNORE means the turn was never worth reviewing in the first place
|
|
26
|
+
* (small talk, a question, an ack, a mechanical operation with no code
|
|
27
|
+
* changes) — it renders NOTHING, not even a marker, so trivial turns don't
|
|
28
|
+
* spam the transcript with a Ken bubble that adds no information.
|
|
29
|
+
*
|
|
30
|
+
* Parsing is forgiving and safe-by-default: any reply we can't confidently map
|
|
31
|
+
* to PROMPT, ALL_CLEAR, or IGNORE becomes a HUMAN stop, never a blind loop.
|
|
32
|
+
*
|
|
33
|
+
* Recovery order for prose-then-keyword drift (Ken writing commentary before
|
|
34
|
+
* the verdict despite the contract): bare trailing ALL_CLEAR/IGNORE → buried
|
|
35
|
+
* HUMAN → buried line-start PROMPT (uppercase, line-start only, so prose like
|
|
36
|
+
* "prompt the user" can never match). HUMAN wins over PROMPT when both appear
|
|
37
|
+
* — recovering a stop is always safe, recovering an action must lose ties.
|
|
38
|
+
*/
|
|
39
|
+
/** Cap on the raw-reply text we echo back as a HUMAN reason when Ken's output
|
|
40
|
+
* is unrecognized — keeps a garbage/huge reply from bloating the transcript. */
|
|
41
|
+
const RAW_REASON_CAP = 500;
|
|
42
|
+
export const CORPUS_UNVERIFIED_REASON = "Not cross-checked against real-world implementations.";
|
|
43
|
+
const DEFAULT_HUMAN_REASON = "Ken flagged this for a human but gave no reason.";
|
|
44
|
+
/** Strip a leading/trailing ``` fence (optionally ```prompt) Ken may have wrapped
|
|
45
|
+
* the prompt body in out of chat habit. */
|
|
46
|
+
function stripPromptFence(body) {
|
|
47
|
+
const trimmed = body.trim();
|
|
48
|
+
const fenceOpen = /^```[^\n]*\n?/;
|
|
49
|
+
const fenceClose = /\n?```$/;
|
|
50
|
+
if (fenceOpen.test(trimmed) && fenceClose.test(trimmed)) {
|
|
51
|
+
return trimmed.replace(fenceOpen, "").replace(fenceClose, "").trim();
|
|
52
|
+
}
|
|
53
|
+
return trimmed;
|
|
54
|
+
}
|
|
55
|
+
/** Truncate long text and note how much was dropped. */
|
|
56
|
+
function cap(text, max = RAW_REASON_CAP) {
|
|
57
|
+
if (text.length <= max)
|
|
58
|
+
return text;
|
|
59
|
+
return `${text.slice(0, max)} […${text.length - max} more chars]`;
|
|
60
|
+
}
|
|
61
|
+
/** Same keyword normalization as the primary line check: uppercase, drop a
|
|
62
|
+
* trailing colon/period, collapse "ALL CLEAR" → "ALL_CLEAR". */
|
|
63
|
+
function normalizeKeywordLine(line) {
|
|
64
|
+
return line
|
|
65
|
+
.trim()
|
|
66
|
+
.toUpperCase()
|
|
67
|
+
.replace(/[:.]+\s*$/, "")
|
|
68
|
+
.trim()
|
|
69
|
+
.replace(/\s+/g, "_");
|
|
70
|
+
}
|
|
71
|
+
/** The flagged approval, e.g. `ALL_CLEAR CORPUS_UNVERIFIED` or
|
|
72
|
+
* `all clear: corpus_unverified`, after {@link normalizeKeywordLine}. */
|
|
73
|
+
const FLAGGED_ALL_CLEAR_RE = /^ALL_CLEAR[_:,-]*CORPUS_UNVERIFIED$/;
|
|
74
|
+
/** The flag anywhere in an approval reply: on the verdict line, or drifted
|
|
75
|
+
* below it (the benchmarked failure). Keeping a warning is always safe. */
|
|
76
|
+
const CORPUS_FLAG_RE = /corpus_unverified/i;
|
|
77
|
+
function allClear(flagged) {
|
|
78
|
+
return flagged
|
|
79
|
+
? { kind: "all_clear", evidenceLimitation: "corpus_unverified" }
|
|
80
|
+
: { kind: "all_clear" };
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Fallback for when Ken ignores the "keyword-first, nothing before it"
|
|
84
|
+
* instruction and buries a bare ALL_CLEAR/IGNORE/SKIP line after a recap or
|
|
85
|
+
* explanation (a real drift pattern models fall into despite the system
|
|
86
|
+
* prompt). Only matches a line that is EXACTLY one of these bare keywords (or
|
|
87
|
+
* the flagged approval). PROMPT/HUMAN carry payloads and get their own
|
|
88
|
+
* dedicated recovery passes in parseAutopilotVerdict. Returns the LAST such
|
|
89
|
+
* line (the verdict conventionally lands at the end of the drift), or null if
|
|
90
|
+
* none is present.
|
|
91
|
+
*/
|
|
92
|
+
function findTrailingBareVerdict(lines) {
|
|
93
|
+
let found = null;
|
|
94
|
+
for (const line of lines) {
|
|
95
|
+
const normalized = normalizeKeywordLine(line);
|
|
96
|
+
if (normalized === "ALL_CLEAR")
|
|
97
|
+
found = allClear(false);
|
|
98
|
+
else if (FLAGGED_ALL_CLEAR_RE.test(normalized))
|
|
99
|
+
found = allClear(true);
|
|
100
|
+
else if (normalized === "IGNORE" || normalized === "SKIP")
|
|
101
|
+
found = { kind: "ignore" };
|
|
102
|
+
}
|
|
103
|
+
return found;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Parse Autopilot Ken's raw reply into a verdict. Never throws.
|
|
107
|
+
*/
|
|
108
|
+
export function parseAutopilotVerdict(reply) {
|
|
109
|
+
const raw = (reply ?? "").trim();
|
|
110
|
+
if (!raw) {
|
|
111
|
+
return { kind: "human", reason: DEFAULT_HUMAN_REASON };
|
|
112
|
+
}
|
|
113
|
+
// Only this explicit evidence limitation can accompany a structured approval.
|
|
114
|
+
// No free-text warning or failed-check exception can become an all-clear.
|
|
115
|
+
const structured = stripPromptFence(raw);
|
|
116
|
+
if (structured.startsWith("{") || structured.startsWith("[") || /^```json(?:\s|$)/i.test(raw)) {
|
|
117
|
+
try {
|
|
118
|
+
if (structured.length > 1024)
|
|
119
|
+
throw new Error("oversized verdict");
|
|
120
|
+
const value = JSON.parse(structured);
|
|
121
|
+
if (value !== null &&
|
|
122
|
+
typeof value === "object" &&
|
|
123
|
+
!Array.isArray(value) &&
|
|
124
|
+
Object.keys(value).length === 2 &&
|
|
125
|
+
"verdict" in value &&
|
|
126
|
+
value.verdict === "ALL_CLEAR" &&
|
|
127
|
+
"evidenceLimitation" in value &&
|
|
128
|
+
value.evidenceLimitation === "corpus_unverified") {
|
|
129
|
+
return { kind: "all_clear", evidenceLimitation: "corpus_unverified" };
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
// Malformed structured output must not fall through to keyword recovery.
|
|
134
|
+
}
|
|
135
|
+
return { kind: "human", reason: "Ken's structured verdict was invalid; review it manually." };
|
|
136
|
+
}
|
|
137
|
+
const lines = raw.split("\n");
|
|
138
|
+
// First non-empty line holds the keyword.
|
|
139
|
+
let keywordLineIdx = 0;
|
|
140
|
+
while (keywordLineIdx < lines.length && lines[keywordLineIdx].trim() === "") {
|
|
141
|
+
keywordLineIdx++;
|
|
142
|
+
}
|
|
143
|
+
const keywordLine = (lines[keywordLineIdx] ?? "").trim();
|
|
144
|
+
// Normalize the leading keyword: uppercase, drop a trailing colon, collapse a
|
|
145
|
+
// space between words so "ALL CLEAR" and "ALL_CLEAR" both match.
|
|
146
|
+
const normalized = keywordLine
|
|
147
|
+
.toUpperCase()
|
|
148
|
+
.replace(/[:.]+\s*$/, "")
|
|
149
|
+
.trim();
|
|
150
|
+
const collapsed = normalized.replace(/\s+/g, "_");
|
|
151
|
+
const rest = lines
|
|
152
|
+
.slice(keywordLineIdx + 1)
|
|
153
|
+
.join("\n")
|
|
154
|
+
.trim();
|
|
155
|
+
if (collapsed === "ALL_CLEAR" || collapsed.startsWith("ALL_CLEAR")) {
|
|
156
|
+
// Lines before the keyword line are blank, so `raw` is the keyword line plus
|
|
157
|
+
// the rest: catches the flag on the verdict line and any later drift.
|
|
158
|
+
return allClear(CORPUS_FLAG_RE.test(raw));
|
|
159
|
+
}
|
|
160
|
+
// IGNORE / SKIP: the turn wasn't real work — nothing to say, nothing to show.
|
|
161
|
+
if (collapsed === "IGNORE" ||
|
|
162
|
+
collapsed.startsWith("IGNORE") ||
|
|
163
|
+
collapsed === "SKIP" ||
|
|
164
|
+
collapsed.startsWith("SKIP")) {
|
|
165
|
+
return { kind: "ignore" };
|
|
166
|
+
}
|
|
167
|
+
if (collapsed === "PROMPT" || collapsed.startsWith("PROMPT")) {
|
|
168
|
+
// Prefer the body on the following lines; if the keyword line itself carried
|
|
169
|
+
// inline text after "PROMPT:", fall back to that.
|
|
170
|
+
let body = stripPromptFence(rest);
|
|
171
|
+
if (!body) {
|
|
172
|
+
const inline = keywordLine.replace(/^prompt[:\s]*/i, "").trim();
|
|
173
|
+
body = stripPromptFence(inline);
|
|
174
|
+
}
|
|
175
|
+
if (!body) {
|
|
176
|
+
return { kind: "human", reason: "Ken said to continue but gave no prompt." };
|
|
177
|
+
}
|
|
178
|
+
return { kind: "prompt", body };
|
|
179
|
+
}
|
|
180
|
+
if (collapsed === "HUMAN" || collapsed.startsWith("HUMAN")) {
|
|
181
|
+
let reason = rest;
|
|
182
|
+
if (!reason) {
|
|
183
|
+
const inline = keywordLine.replace(/^human[:\s]*/i, "").trim();
|
|
184
|
+
reason = inline;
|
|
185
|
+
}
|
|
186
|
+
return { kind: "human", reason: cap(reason) || DEFAULT_HUMAN_REASON };
|
|
187
|
+
}
|
|
188
|
+
// Unrecognized first line → before giving up, check for a bare verdict Ken
|
|
189
|
+
// buried later in the reply (prose-then-keyword drift). This is the exact
|
|
190
|
+
// shape that used to leak raw commentary + "ALL_CLEAR" into a HUMAN bubble
|
|
191
|
+
// instead of rendering the normal all-clear/ignore marker.
|
|
192
|
+
const trailing = findTrailingBareVerdict(lines);
|
|
193
|
+
if (trailing)
|
|
194
|
+
return trailing;
|
|
195
|
+
// A buried bare HUMAN line (Ken wrote his reasoning first, THEN the verdict).
|
|
196
|
+
// Take the lines after the LAST exact-"HUMAN" line as the reason and drop the
|
|
197
|
+
// leading prose. Safe to recover unlike a buried PROMPT: HUMAN stops the cycle
|
|
198
|
+
// either way, so this can't trigger autonomous action — it only keeps Ken's
|
|
199
|
+
// internal reasoning out of the human-facing reason bubble (the drift that
|
|
200
|
+
// dumped his whole recap into the transcript alongside the real reason).
|
|
201
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
202
|
+
if (normalizeKeywordLine(lines[i]) === "HUMAN") {
|
|
203
|
+
const reason = lines
|
|
204
|
+
.slice(i + 1)
|
|
205
|
+
.join("\n")
|
|
206
|
+
.trim();
|
|
207
|
+
return { kind: "human", reason: cap(reason) || DEFAULT_HUMAN_REASON };
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// Buried PROMPT (the drift that used to dump a valid runnable prompt into a
|
|
211
|
+
// HUMAN bubble): recover a line that STARTS with the uppercase keyword and
|
|
212
|
+
// re-parse from there, so both `PROMPT <inline body>` and `PROMPT\n<body>`
|
|
213
|
+
// shapes work. Uppercase + line-start (never mid-line, never lowercase)
|
|
214
|
+
// keeps prose like "prompt the user" or "a prompt for GG Coder" from ever
|
|
215
|
+
// matching. Takes the LAST such line, and runs AFTER the HUMAN recovery so
|
|
216
|
+
// a reply carrying both stops instead of acting.
|
|
217
|
+
const BURIED_PROMPT_RE = /^PROMPT(?=$|[\s:.,])/;
|
|
218
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
219
|
+
if (BURIED_PROMPT_RE.test(lines[i].trim())) {
|
|
220
|
+
return parseAutopilotVerdict(lines.slice(i).join("\n"));
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
// Truly unrecognized → stop and ask the human, echoing the raw reply for context.
|
|
224
|
+
return { kind: "human", reason: cap(raw) };
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=autopilot-verdict.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autopilot-verdict.js","sourceRoot":"","sources":["../../src/core/autopilot-verdict.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAQH;iFACiF;AACjF,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B,MAAM,CAAC,MAAM,wBAAwB,GAAG,uDAAuD,CAAC;AAEhG,MAAM,oBAAoB,GAAG,kDAAkD,CAAC;AAEhF;4CAC4C;AAC5C,SAAS,gBAAgB,CAAC,IAAY;IACpC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,SAAS,GAAG,eAAe,CAAC;IAClC,MAAM,UAAU,GAAG,SAAS,CAAC;IAC7B,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACxD,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACv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2E;IAC3E,yEAAyE;IACzE,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,IAAI,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;YAC/C,MAAM,MAAM,GAAG,KAAK;iBACjB,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;iBACZ,IAAI,CAAC,IAAI,CAAC;iBACV,IAAI,EAAE,CAAC;YACV,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,oBAAoB,EAAE,CAAC;QACxE,CAAC;IACH,CAAC;IAED,4EAA4E;IAC5E,2EAA2E;IAC3E,2EAA2E;IAC3E,wEAAwE;IACxE,0EAA0E;IAC1E,2EAA2E;IAC3E,iDAAiD;IACjD,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;IAChD,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,IAAI,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;YAC3C,OAAO,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IAED,kFAAkF;IAClF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { BlockedPackage } from "./shell-threats.js";
|
|
2
|
+
export declare const BLOCKLIST_START = "<!-- gg-safe:blocked-packages:start -->";
|
|
3
|
+
export declare const BLOCKLIST_END = "<!-- gg-safe:blocked-packages:end -->";
|
|
4
|
+
/**
|
|
5
|
+
* Same names and order as the system prompt's CONTEXT_FILES (a test keeps
|
|
6
|
+
* them equal): GG Coder loads only the first that exists per folder, so the
|
|
7
|
+
* list must go into that one. Creating a CLAUDE.md beside a .cursorrules
|
|
8
|
+
* would outrank it and silently drop the user's own rules.
|
|
9
|
+
*/
|
|
10
|
+
export declare const INSTRUCTION_FILES: readonly ["AGENTS.override.md", "AGENTS.md", "CLAUDE.md", ".cursorrules", "CONVENTIONS.md"];
|
|
11
|
+
/** The instruction file GG Coder reads in `dir` (CLAUDE.md when there is none yet, as /init). */
|
|
12
|
+
export declare function instructionFileFor(dir: string): Promise<string>;
|
|
13
|
+
/** One list line, or null when anything fails validation. */
|
|
14
|
+
export declare function blocklistLine(pkg: BlockedPackage): string | null;
|
|
15
|
+
/** The text with the managed block set to `entries` (added at the end if missing). */
|
|
16
|
+
export declare function withBlocklist(text: string, entries: string[]): string;
|
|
17
|
+
/** Entries currently in the managed block of `text`. */
|
|
18
|
+
export declare function readBlocklist(text: string): string[];
|
|
19
|
+
/**
|
|
20
|
+
* Only write inside a real project: never the home folder or a filesystem
|
|
21
|
+
* root (a ~/CLAUDE.md would apply to every project), and never a loose folder
|
|
22
|
+
* such as Downloads or a temp dir with no project marker in it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isProjectDir(dir: string, home?: string): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* Add `packages` to the project's list in `dir`. Returns the file written, or
|
|
27
|
+
* null when nothing new needed recording (or `dir` isn't a project, or the
|
|
28
|
+
* file is read-only/someone else's: their choice wins). Rejects on I/O
|
|
29
|
+
* failure; callers fire and forget and log it.
|
|
30
|
+
*/
|
|
31
|
+
export declare function recordBlockedPackages(dir: string, packages: readonly BlockedPackage[], options?: {
|
|
32
|
+
home?: string;
|
|
33
|
+
}): Promise<string | null>;
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The project's "don't install" list: when a guard refuses a package, the app
|
|
3
|
+
* (not the agent) records it in the instruction file GG Coder loads for the
|
|
4
|
+
* project, so every later session knows about it from its first token.
|
|
5
|
+
*
|
|
6
|
+
* One small managed block between markers, appended to the file GG Coder
|
|
7
|
+
* reads (the first of INSTRUCTION_FILES that exists; CLAUDE.md is created when
|
|
8
|
+
* none does, as /init does). Deduplicated, capped, and nothing but validated package names,
|
|
9
|
+
* versions and our own reason text ever goes in, so the block can't carry
|
|
10
|
+
* injected instructions. Never touched mid-prompt: the running session already
|
|
11
|
+
* knows from the block message, and nothing re-renders the cached prompt.
|
|
12
|
+
*/
|
|
13
|
+
import { constants as fsConstants } from "node:fs";
|
|
14
|
+
import fsp from "node:fs/promises";
|
|
15
|
+
import os from "node:os";
|
|
16
|
+
import path from "node:path";
|
|
17
|
+
import { retryWindowsReplace } from "./session-storage.js";
|
|
18
|
+
export const BLOCKLIST_START = "<!-- gg-safe:blocked-packages:start -->";
|
|
19
|
+
export const BLOCKLIST_END = "<!-- gg-safe:blocked-packages:end -->";
|
|
20
|
+
const HEADER = [
|
|
21
|
+
"## Blocked packages",
|
|
22
|
+
"GG Coder's safety checks blocked these. Never install or run them; use another version or package.",
|
|
23
|
+
];
|
|
24
|
+
/** Newest entries kept; older ones fall off the top. */
|
|
25
|
+
const MAX_ENTRIES = 30;
|
|
26
|
+
/** Bigger instruction files are left alone (not ours to rewrite). */
|
|
27
|
+
const MAX_FILE_BYTES = 4 * 1024 * 1024;
|
|
28
|
+
/**
|
|
29
|
+
* Same names and order as the system prompt's CONTEXT_FILES (a test keeps
|
|
30
|
+
* them equal): GG Coder loads only the first that exists per folder, so the
|
|
31
|
+
* list must go into that one. Creating a CLAUDE.md beside a .cursorrules
|
|
32
|
+
* would outrank it and silently drop the user's own rules.
|
|
33
|
+
*/
|
|
34
|
+
export const INSTRUCTION_FILES = [
|
|
35
|
+
"AGENTS.override.md",
|
|
36
|
+
"AGENTS.md",
|
|
37
|
+
"CLAUDE.md",
|
|
38
|
+
".cursorrules",
|
|
39
|
+
"CONVENTIONS.md",
|
|
40
|
+
];
|
|
41
|
+
const NAME = /^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/i;
|
|
42
|
+
const VERSION = /^[a-z0-9][a-z0-9.+_-]{0,63}$/i;
|
|
43
|
+
const REASON = /^[\w "(),.:@/-]{1,120}$/;
|
|
44
|
+
/** The instruction file GG Coder reads in `dir` (CLAUDE.md when there is none yet, as /init). */
|
|
45
|
+
export async function instructionFileFor(dir) {
|
|
46
|
+
for (const name of INSTRUCTION_FILES) {
|
|
47
|
+
const file = path.join(dir, name);
|
|
48
|
+
try {
|
|
49
|
+
if ((await fsp.stat(file)).isFile())
|
|
50
|
+
return file;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// Not there: try the next name.
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return path.join(dir, "CLAUDE.md");
|
|
57
|
+
}
|
|
58
|
+
/** One list line, or null when anything fails validation. */
|
|
59
|
+
export function blocklistLine(pkg) {
|
|
60
|
+
if (pkg.ecosystem !== "npm" && pkg.ecosystem !== "PyPI")
|
|
61
|
+
return null;
|
|
62
|
+
if (!NAME.test(pkg.name) || (pkg.version !== undefined && !VERSION.test(pkg.version))) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
if (!REASON.test(pkg.reason))
|
|
66
|
+
return null;
|
|
67
|
+
const id = pkg.version ? `${pkg.name}@${pkg.version}` : pkg.name;
|
|
68
|
+
return `- ${pkg.ecosystem} \`${id}\`: ${pkg.reason}`;
|
|
69
|
+
}
|
|
70
|
+
/** `- npm \`chalk@5.6.1\`: …` → `npm chalk@5.6.1`, the dedupe key. */
|
|
71
|
+
function lineKey(line) {
|
|
72
|
+
return /^- (\S+) `([^`]+)`/.exec(line)?.slice(1, 3).join(" ").toLowerCase() ?? line;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The managed block's span in `text`: the first end marker that has a start
|
|
76
|
+
* marker before it, paired with the nearest such start. A stray start or end
|
|
77
|
+
* marker (hand-edited, half-deleted) never makes us swallow the user's text
|
|
78
|
+
* between it and a real block.
|
|
79
|
+
*/
|
|
80
|
+
function blockSpan(text) {
|
|
81
|
+
let end = text.indexOf(BLOCKLIST_END);
|
|
82
|
+
while (end !== -1) {
|
|
83
|
+
const start = text.lastIndexOf(BLOCKLIST_START, end);
|
|
84
|
+
if (start !== -1)
|
|
85
|
+
return { start, end };
|
|
86
|
+
end = text.indexOf(BLOCKLIST_END, end + BLOCKLIST_END.length);
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
/** Lines inside the block that aren't ours (a user's own note): kept as-is. */
|
|
91
|
+
function blockExtras(text) {
|
|
92
|
+
const span = blockSpan(text);
|
|
93
|
+
if (!span)
|
|
94
|
+
return [];
|
|
95
|
+
return text
|
|
96
|
+
.slice(span.start + BLOCKLIST_START.length, span.end)
|
|
97
|
+
.split(/\r?\n/)
|
|
98
|
+
.filter((line) => line.trim() !== "" && !line.startsWith("- ") && !HEADER.includes(line));
|
|
99
|
+
}
|
|
100
|
+
/** The text with the managed block set to `entries` (added at the end if missing). */
|
|
101
|
+
export function withBlocklist(text, entries) {
|
|
102
|
+
const eol = text.includes("\r\n") ? "\r\n" : "\n";
|
|
103
|
+
const block = [BLOCKLIST_START, ...HEADER, ...blockExtras(text), ...entries, BLOCKLIST_END].join(eol);
|
|
104
|
+
const span = blockSpan(text);
|
|
105
|
+
if (span) {
|
|
106
|
+
return text.slice(0, span.start) + block + text.slice(span.end + BLOCKLIST_END.length);
|
|
107
|
+
}
|
|
108
|
+
const body = text.replace(/[ \t\r\n]+$/, "");
|
|
109
|
+
return body ? `${body}${eol}${eol}${block}${eol}` : `${block}${eol}`;
|
|
110
|
+
}
|
|
111
|
+
/** Entries currently in the managed block of `text`. */
|
|
112
|
+
export function readBlocklist(text) {
|
|
113
|
+
const span = blockSpan(text);
|
|
114
|
+
if (!span)
|
|
115
|
+
return [];
|
|
116
|
+
return text
|
|
117
|
+
.slice(span.start + BLOCKLIST_START.length, span.end)
|
|
118
|
+
.split(/\r?\n/)
|
|
119
|
+
.filter((line) => line.startsWith("- "));
|
|
120
|
+
}
|
|
121
|
+
/** Files and folders that make `dir` a real project (a worktree's `.git` is a file). */
|
|
122
|
+
const PROJECT_MARKERS = [
|
|
123
|
+
".git",
|
|
124
|
+
"package.json",
|
|
125
|
+
"pyproject.toml",
|
|
126
|
+
"requirements.txt",
|
|
127
|
+
"setup.py",
|
|
128
|
+
"Cargo.toml",
|
|
129
|
+
"go.mod",
|
|
130
|
+
"package-lock.json",
|
|
131
|
+
"pnpm-lock.yaml",
|
|
132
|
+
"yarn.lock",
|
|
133
|
+
"bun.lock",
|
|
134
|
+
"uv.lock",
|
|
135
|
+
...INSTRUCTION_FILES,
|
|
136
|
+
];
|
|
137
|
+
/**
|
|
138
|
+
* Only write inside a real project: never the home folder or a filesystem
|
|
139
|
+
* root (a ~/CLAUDE.md would apply to every project), and never a loose folder
|
|
140
|
+
* such as Downloads or a temp dir with no project marker in it.
|
|
141
|
+
*/
|
|
142
|
+
export async function isProjectDir(dir, home = os.homedir()) {
|
|
143
|
+
const resolved = path.resolve(dir);
|
|
144
|
+
if (path.parse(resolved).root === resolved)
|
|
145
|
+
return false;
|
|
146
|
+
const norm = (p) => (process.platform === "win32" ? p.toLowerCase() : p);
|
|
147
|
+
if (home && norm(path.resolve(home)) === norm(resolved))
|
|
148
|
+
return false;
|
|
149
|
+
const hits = await Promise.all(PROJECT_MARKERS.map((name) => fsp.lstat(path.join(resolved, name)).then(() => true, () => false)));
|
|
150
|
+
return hits.includes(true);
|
|
151
|
+
}
|
|
152
|
+
/** Lockfiles older than this are from a crashed writer and may be taken over. */
|
|
153
|
+
const LOCK_STALE_MS = 10_000;
|
|
154
|
+
const LOCK_WAIT_MS = 3_000;
|
|
155
|
+
/**
|
|
156
|
+
* A cross-process lock beside the file (two GG windows on one project are two
|
|
157
|
+
* sidecars only when they're separate apps; still, never lose an entry or the
|
|
158
|
+
* user's text). Returns the release function, or throws after LOCK_WAIT_MS.
|
|
159
|
+
*/
|
|
160
|
+
async function lockFile(file) {
|
|
161
|
+
const lock = `${file}.gg-lock`;
|
|
162
|
+
const deadline = Date.now() + LOCK_WAIT_MS;
|
|
163
|
+
for (;;) {
|
|
164
|
+
try {
|
|
165
|
+
const handle = await fsp.open(lock, "wx");
|
|
166
|
+
await handle.close();
|
|
167
|
+
return () => fsp.rm(lock, { force: true });
|
|
168
|
+
}
|
|
169
|
+
catch (err) {
|
|
170
|
+
if (err.code !== "EEXIST")
|
|
171
|
+
throw err;
|
|
172
|
+
const st = await fsp.stat(lock).catch(() => null);
|
|
173
|
+
if (st && Date.now() - st.mtimeMs > LOCK_STALE_MS) {
|
|
174
|
+
await fsp.rm(lock, { force: true }).catch(() => { });
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (Date.now() > deadline)
|
|
178
|
+
throw new Error(`${lock} is held by another writer`, { cause: err });
|
|
179
|
+
await new Promise((resolve) => setTimeout(resolve, 25));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/** Read, merge, write atomically; "changed" when the file moved under us. */
|
|
184
|
+
async function writeOnce(file, lines) {
|
|
185
|
+
const before = await fsp.stat(file).catch(() => null);
|
|
186
|
+
const text = before ? await fsp.readFile(file, "utf8") : "";
|
|
187
|
+
const entries = readBlocklist(text);
|
|
188
|
+
const known = new Set(entries.map(lineKey));
|
|
189
|
+
const added = lines.filter((line) => {
|
|
190
|
+
const key = lineKey(line);
|
|
191
|
+
if (known.has(key))
|
|
192
|
+
return false;
|
|
193
|
+
known.add(key);
|
|
194
|
+
return true;
|
|
195
|
+
});
|
|
196
|
+
if (added.length === 0)
|
|
197
|
+
return null;
|
|
198
|
+
const next = withBlocklist(text, [...entries, ...added].slice(-MAX_ENTRIES));
|
|
199
|
+
const tmp = `${file}.${process.pid}.${Date.now()}.tmp`;
|
|
200
|
+
try {
|
|
201
|
+
await fsp.writeFile(tmp, next, {
|
|
202
|
+
encoding: "utf8",
|
|
203
|
+
mode: before ? before.mode & 0o777 : 0o644,
|
|
204
|
+
});
|
|
205
|
+
const now = await fsp.stat(file).catch(() => null);
|
|
206
|
+
if (now?.mtimeMs !== before?.mtimeMs || now?.size !== before?.size) {
|
|
207
|
+
await fsp.rm(tmp, { force: true });
|
|
208
|
+
return "changed";
|
|
209
|
+
}
|
|
210
|
+
await retryWindowsReplace(() => fsp.rename(tmp, file));
|
|
211
|
+
}
|
|
212
|
+
catch (err) {
|
|
213
|
+
await fsp.rm(tmp, { force: true }).catch(() => { });
|
|
214
|
+
throw err;
|
|
215
|
+
}
|
|
216
|
+
return file;
|
|
217
|
+
}
|
|
218
|
+
/** One write at a time per file, so concurrent blocks never lose an entry. */
|
|
219
|
+
const queues = new Map();
|
|
220
|
+
/**
|
|
221
|
+
* Add `packages` to the project's list in `dir`. Returns the file written, or
|
|
222
|
+
* null when nothing new needed recording (or `dir` isn't a project, or the
|
|
223
|
+
* file is read-only/someone else's: their choice wins). Rejects on I/O
|
|
224
|
+
* failure; callers fire and forget and log it.
|
|
225
|
+
*/
|
|
226
|
+
export async function recordBlockedPackages(dir, packages, options = {}) {
|
|
227
|
+
const lines = packages.map(blocklistLine).filter((l) => l !== null);
|
|
228
|
+
if (lines.length === 0)
|
|
229
|
+
return null;
|
|
230
|
+
if (!(await isProjectDir(dir, options.home)))
|
|
231
|
+
return null;
|
|
232
|
+
let file = await instructionFileFor(dir);
|
|
233
|
+
// A symlinked CLAUDE.md -> AGENTS.md: write through to the real file, never
|
|
234
|
+
// replace the link with a regular file.
|
|
235
|
+
const link = await fsp.lstat(file).catch(() => null);
|
|
236
|
+
if (link?.isSymbolicLink())
|
|
237
|
+
file = await fsp.realpath(file).catch(() => file);
|
|
238
|
+
const run = async () => {
|
|
239
|
+
const first = await fsp.stat(file).catch(() => null);
|
|
240
|
+
if (first) {
|
|
241
|
+
if (!first.isFile() || first.size > MAX_FILE_BYTES)
|
|
242
|
+
return null;
|
|
243
|
+
// Read-only or owned by someone else: leave it alone (a rename would
|
|
244
|
+
// silently replace it).
|
|
245
|
+
const writable = await fsp.access(file, fsConstants.W_OK).then(() => true, () => false);
|
|
246
|
+
if (!writable)
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
const release = await lockFile(file);
|
|
250
|
+
try {
|
|
251
|
+
// An editor saving mid-write: re-read and try again, never clobber it.
|
|
252
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
253
|
+
const result = await writeOnce(file, lines);
|
|
254
|
+
if (result !== "changed")
|
|
255
|
+
return result;
|
|
256
|
+
}
|
|
257
|
+
return null;
|
|
258
|
+
}
|
|
259
|
+
finally {
|
|
260
|
+
await release().catch(() => { });
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
const prev = queues.get(file) ?? Promise.resolve();
|
|
264
|
+
const next = prev.then(run, run);
|
|
265
|
+
const settled = next.catch(() => null);
|
|
266
|
+
queues.set(file, settled);
|
|
267
|
+
// Drop the entry once idle, so the map doesn't grow with every project.
|
|
268
|
+
void settled.then(() => {
|
|
269
|
+
if (queues.get(file) === settled)
|
|
270
|
+
queues.delete(file);
|
|
271
|
+
});
|
|
272
|
+
return next;
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=blocked-packages-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocked-packages-file.js","sourceRoot":"","sources":["../../src/core/blocked-packages-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,GAAG,MAAM,kBAAkB,CAAC;AACnC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,MAA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