@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,281 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { getAppPaths } from "../config.js";
|
|
5
|
+
import { atomicWrite } from "./session-storage.js";
|
|
6
|
+
// ── Settings Schema ────────────────────────────────────────
|
|
7
|
+
const SettingsSchema = z.object({
|
|
8
|
+
autoCompact: z.boolean().default(true),
|
|
9
|
+
compactThreshold: z.number().min(0.1).max(1.0).default(0.85),
|
|
10
|
+
/** Absolute auto-compaction trigger in tokens. The trigger is
|
|
11
|
+
* min(compactThreshold × window, compactAtTokens). Unset = 400,000
|
|
12
|
+
* (DEFAULT_COMPACT_AT_TOKENS: keeps time-to-first-token down on 1M-window
|
|
13
|
+
* models); set higher to compact later. */
|
|
14
|
+
compactAtTokens: z.number().int().min(20_000).optional(),
|
|
15
|
+
/** Bash binary for the shell tool. `auto` = first bash on PATH (current
|
|
16
|
+
* behaviour); `system` = /bin/bash on macOS (faster spawn), same as auto
|
|
17
|
+
* elsewhere; anything else = an explicit path. */
|
|
18
|
+
bashPath: z.string().min(1).default("auto"),
|
|
19
|
+
defaultProvider: z
|
|
20
|
+
.enum([
|
|
21
|
+
"anthropic",
|
|
22
|
+
"openai",
|
|
23
|
+
"gemini",
|
|
24
|
+
"glm",
|
|
25
|
+
"moonshot",
|
|
26
|
+
"minimax",
|
|
27
|
+
"xiaomi",
|
|
28
|
+
"deepseek",
|
|
29
|
+
"openrouter",
|
|
30
|
+
"huggingface",
|
|
31
|
+
"opencode",
|
|
32
|
+
"opencode-go",
|
|
33
|
+
"sakana",
|
|
34
|
+
"xai",
|
|
35
|
+
// The desktop app's local endpoints. Rejecting it reset the whole file (#133).
|
|
36
|
+
"local",
|
|
37
|
+
])
|
|
38
|
+
.default("anthropic"),
|
|
39
|
+
defaultModel: z.string().optional(),
|
|
40
|
+
maxTokens: z.number().int().min(256).default(16384),
|
|
41
|
+
thinkingEnabled: z.boolean().default(false),
|
|
42
|
+
thinkingLevel: z.enum(["low", "medium", "high", "xhigh", "max", "ultra"]).optional(),
|
|
43
|
+
theme: z
|
|
44
|
+
.enum([
|
|
45
|
+
"auto",
|
|
46
|
+
"dark",
|
|
47
|
+
"light",
|
|
48
|
+
"dark-ansi",
|
|
49
|
+
"light-ansi",
|
|
50
|
+
"dark-daltonized",
|
|
51
|
+
"light-daltonized",
|
|
52
|
+
])
|
|
53
|
+
.default("auto"),
|
|
54
|
+
showTokenUsage: z.boolean().default(true),
|
|
55
|
+
/** Legacy name: switches loop-break and re-grounding nudges (Ideal review
|
|
56
|
+
* itself was removed). Kept so existing settings files keep their meaning. */
|
|
57
|
+
idealReviewEnabled: z.boolean().default(true),
|
|
58
|
+
/** Append LSP diagnostics to edit/write tool results. */
|
|
59
|
+
lspDiagnostics: z.boolean().default(true),
|
|
60
|
+
/** Allow write/edit outside the workspace (cwd, tmpdir, ~/.gg). Off by
|
|
61
|
+
* default — outside writes return a guard error asking for user approval. */
|
|
62
|
+
allowOutsideWorkspaceWrites: z.boolean().default(false),
|
|
63
|
+
/** Network egress policy. "allowlist" enforces `networkAllow` on the agent's
|
|
64
|
+
* own web-fetch/web-search calls and blocks recognised network commands in
|
|
65
|
+
* bash. NOT an OS sandbox — a determined process can still reach the network
|
|
66
|
+
* (see core/network-guard.ts). Default "off" changes nothing. */
|
|
67
|
+
networkMode: z.enum(["off", "allowlist"]).default("off"),
|
|
68
|
+
/** Hosts allowed when networkMode is "allowlist". A leading `*.` wildcard
|
|
69
|
+
* matches subdomains (`*.github.com`). */
|
|
70
|
+
networkAllow: z.array(z.string()).default([]),
|
|
71
|
+
/**
|
|
72
|
+
* OS-enforced command isolation for bash (filesystem + network), via
|
|
73
|
+
* sandbox-runtime. `auto` isolates wherever the platform supports it and
|
|
74
|
+
* degrades with a warning where it does not; `workspace` additionally fails
|
|
75
|
+
* closed on hosts that cannot isolate.
|
|
76
|
+
*
|
|
77
|
+
* Opt-in, and deliberately so. Verified day-one breakage in the upstream
|
|
78
|
+
* sandbox that we cannot fix from here:
|
|
79
|
+
* • Linux: pipes and redirections fail under seccomp — `echo hi | grep hi`
|
|
80
|
+
* returns "Permission denied" on /proc/self/fd/3 (upstream #261).
|
|
81
|
+
* • macOS: git over SSH fails the SOCKS handshake, because the ProxyCommand
|
|
82
|
+
* uses `nc`, which cannot do SOCKS5 auth (upstream sandbox-utils.ts).
|
|
83
|
+
* • `git config --global` is refused: ~/.gitconfig is a mandatory upstream
|
|
84
|
+
* write protection with no opt-out.
|
|
85
|
+
* • Corporate TLS interception and private registries need extra config.
|
|
86
|
+
* Enabling it by default would break `git push` and piped commands for a
|
|
87
|
+
* large share of users immediately after an update, with no obvious cause.
|
|
88
|
+
*/
|
|
89
|
+
sandboxMode: z.enum(["auto", "workspace", "off"]).default("off"),
|
|
90
|
+
/**
|
|
91
|
+
* Unix sockets sandboxed commands may open (macOS; on Linux/WSL2 the seccomp
|
|
92
|
+
* filter blocks AF_UNIX by syscall and cannot match paths). Empty by default:
|
|
93
|
+
* `/var/run/docker.sock` is unauthenticated root-equivalent control of the
|
|
94
|
+
* host, and the SSH agent socket signs whatever it is asked to. Set this only
|
|
95
|
+
* to run `docker` (or similar) from sandboxed bash, and only knowing that the
|
|
96
|
+
* socket is a full bypass of the isolation around it.
|
|
97
|
+
*/
|
|
98
|
+
sandboxAllowUnixSockets: z.array(z.string()).default([]),
|
|
99
|
+
/** Defer MCP tool schemas out of the prompt until discovered via tool_search.
|
|
100
|
+
* Cuts ~8k tokens/cache-miss turn with two MCP servers connected. */
|
|
101
|
+
deferredMcpTools: z.boolean().default(true),
|
|
102
|
+
/** Defer rarely reached BUILT-IN tool schemas the same way, leaving a one-line
|
|
103
|
+
* capability hint in the prompt that `tool_search` expands on demand. Trades
|
|
104
|
+
* per-request tokens against how reliably the model still finds the tool. */
|
|
105
|
+
deferredBuiltinTools: z.boolean().default(true),
|
|
106
|
+
/** Use the `rg` binary for `grep` content search when it is on PATH, falling
|
|
107
|
+
* back to the in-process scanner otherwise. */
|
|
108
|
+
grepUseRipgrep: z.boolean().default(true),
|
|
109
|
+
/** Opt into the 2026-07-28 MCP protocol revision. When on, a connect probes
|
|
110
|
+
* with `server/discover` and falls back to the 2025 `initialize` handshake,
|
|
111
|
+
* so a legacy server still connects. Off by default: the probe costs a round
|
|
112
|
+
* trip, and a legacy stdio server that ignores it pays the probe timeout. */
|
|
113
|
+
mcpModernProtocol: z.boolean().default(false),
|
|
114
|
+
/** Connect MCP servers declared in the OPENED REPO's `.gg/mcp.json`. That
|
|
115
|
+
* file is repo-controlled: a malicious repo can declare a stdio `command`
|
|
116
|
+
* that executes the moment the project opens. Off by default — enable only
|
|
117
|
+
* for repos you trust (global ~/.gg/mcp.json is always connected). */
|
|
118
|
+
trustProjectMcpServers: z.boolean().default(false),
|
|
119
|
+
/** Repo paths the user has individually trusted for project-scope MCP (the
|
|
120
|
+
* per-repo complement to the global `trustProjectMcpServers`). Stored as
|
|
121
|
+
* resolved absolute paths so symlink/relative mismatches can't flip the
|
|
122
|
+
* decision. */
|
|
123
|
+
trustedProjects: z.array(z.string()).default([]),
|
|
124
|
+
/** Max concurrent subagents per resolved child model. Unset = only the
|
|
125
|
+
* global limit applies. Can only REDUCE concurrency, never raise it. */
|
|
126
|
+
subagentMaxPerModel: z.number().int().min(1).max(4).optional(),
|
|
127
|
+
/** Per-input byte budgets for prompt-injected content (skills, MCP tool
|
|
128
|
+
* descriptions/schemas, project instructions, total prompt ceiling).
|
|
129
|
+
* Unset keys fall back to the built-in defaults (core/context-limits.ts). */
|
|
130
|
+
contextLimits: z
|
|
131
|
+
.object({
|
|
132
|
+
skillDescriptionBytes: z.number().int().min(64).optional(),
|
|
133
|
+
skillCatalogBytes: z.number().int().min(1024).optional(),
|
|
134
|
+
mcpToolDescriptionBytes: z.number().int().min(64).optional(),
|
|
135
|
+
mcpToolSchemaBytes: z.number().int().min(1024).optional(),
|
|
136
|
+
projectContextBytes: z.number().int().min(1024).optional(),
|
|
137
|
+
systemPromptCeilingBytes: z
|
|
138
|
+
.number()
|
|
139
|
+
.int()
|
|
140
|
+
.min(16 * 1024)
|
|
141
|
+
.optional(),
|
|
142
|
+
})
|
|
143
|
+
.optional(),
|
|
144
|
+
enabledTools: z.array(z.string()).optional(),
|
|
145
|
+
/** Delete session transcripts older than this many days at startup. 0 disables pruning. */
|
|
146
|
+
sessionRetentionDays: z.number().int().min(0).default(30),
|
|
147
|
+
/** Speed optimization profile.
|
|
148
|
+
* - "baseline": 5-min cache TTL, no pre-warm
|
|
149
|
+
* - "optimized": 1-h cache TTL, cache pre-warming on first prompt (default) */
|
|
150
|
+
speedProfile: z.enum(["baseline", "optimized"]).default("optimized"),
|
|
151
|
+
/** Hold an OS idle-sleep assertion while the desktop app's agent works
|
|
152
|
+
* (runs, autopilot, Ken, background sub-agents). The display may still sleep. */
|
|
153
|
+
keepAwake: z.boolean().default(true),
|
|
154
|
+
/** Pre-warm the Anthropic prompt cache (max_tokens: 1, identical prefix) when the
|
|
155
|
+
* desktop app signals the user is about to type after opening a chat / idling. */
|
|
156
|
+
cachePrewarm: z.boolean().default(true),
|
|
157
|
+
/** OpenAI strict tool schemas. Strict calls spell out every optional
|
|
158
|
+
* argument as null, costing output tokens and latency per call. `auto`
|
|
159
|
+
* turns it off (measured faster on all three gpt-6 models); `on` restores it. */
|
|
160
|
+
codexStrictTools: z.enum(["auto", "on", "off"]).default("auto"),
|
|
161
|
+
/** Release-age cooldown (days) for every package install the agent runs:
|
|
162
|
+
* versions younger than this are skipped. 0 disables. */
|
|
163
|
+
packageCooldownDays: z.number().min(0).max(365).default(2),
|
|
164
|
+
});
|
|
165
|
+
export const DEFAULT_SETTINGS = {
|
|
166
|
+
autoCompact: true,
|
|
167
|
+
compactThreshold: 0.85,
|
|
168
|
+
bashPath: "auto",
|
|
169
|
+
defaultProvider: "anthropic",
|
|
170
|
+
maxTokens: 16384,
|
|
171
|
+
thinkingEnabled: false,
|
|
172
|
+
theme: "auto",
|
|
173
|
+
showTokenUsage: true,
|
|
174
|
+
idealReviewEnabled: true,
|
|
175
|
+
lspDiagnostics: true,
|
|
176
|
+
allowOutsideWorkspaceWrites: false,
|
|
177
|
+
networkMode: "off",
|
|
178
|
+
networkAllow: [],
|
|
179
|
+
sandboxMode: "off",
|
|
180
|
+
sandboxAllowUnixSockets: [],
|
|
181
|
+
deferredMcpTools: true,
|
|
182
|
+
deferredBuiltinTools: true,
|
|
183
|
+
grepUseRipgrep: true,
|
|
184
|
+
mcpModernProtocol: false,
|
|
185
|
+
trustProjectMcpServers: false,
|
|
186
|
+
trustedProjects: [],
|
|
187
|
+
sessionRetentionDays: 30,
|
|
188
|
+
speedProfile: "optimized",
|
|
189
|
+
keepAwake: true,
|
|
190
|
+
cachePrewarm: true,
|
|
191
|
+
codexStrictTools: "auto",
|
|
192
|
+
packageCooldownDays: 2,
|
|
193
|
+
};
|
|
194
|
+
// ── Settings Manager ───────────────────────────────────────
|
|
195
|
+
/**
|
|
196
|
+
* The file's settings, merged over the defaults. A value this build rejects
|
|
197
|
+
* (a newer build's, or a bad hand edit) falls back to its default alone; it
|
|
198
|
+
* used to send every setting back to its default.
|
|
199
|
+
*/
|
|
200
|
+
function parseSettings(raw) {
|
|
201
|
+
const whole = SettingsSchema.safeParse({ ...DEFAULT_SETTINGS, ...raw });
|
|
202
|
+
if (whole.success)
|
|
203
|
+
return { settings: whole.data, rejected: [] };
|
|
204
|
+
const kept = {};
|
|
205
|
+
const rejected = [];
|
|
206
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
207
|
+
const field = SettingsSchema.shape[key];
|
|
208
|
+
if (!field)
|
|
209
|
+
continue;
|
|
210
|
+
if (field.safeParse(value).success)
|
|
211
|
+
kept[key] = value;
|
|
212
|
+
else
|
|
213
|
+
rejected.push(key);
|
|
214
|
+
}
|
|
215
|
+
return { settings: SettingsSchema.parse({ ...DEFAULT_SETTINGS, ...kept }), rejected };
|
|
216
|
+
}
|
|
217
|
+
export class SettingsManager {
|
|
218
|
+
settings = { ...DEFAULT_SETTINGS };
|
|
219
|
+
filePath;
|
|
220
|
+
loaded = false;
|
|
221
|
+
/** The file as read: keys this build doesn't know are written back untouched. */
|
|
222
|
+
raw = {};
|
|
223
|
+
/** Keys whose value this build rejected and nothing has set since: kept as they were. */
|
|
224
|
+
rejected = new Set();
|
|
225
|
+
constructor(filePath) {
|
|
226
|
+
this.filePath = filePath ?? getAppPaths().settingsFile;
|
|
227
|
+
}
|
|
228
|
+
async load() {
|
|
229
|
+
let raw;
|
|
230
|
+
try {
|
|
231
|
+
raw = JSON.parse(await fs.readFile(this.filePath, "utf-8"));
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
raw = undefined;
|
|
235
|
+
}
|
|
236
|
+
this.raw =
|
|
237
|
+
raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
238
|
+
const parsed = parseSettings(this.raw);
|
|
239
|
+
this.settings = parsed.settings;
|
|
240
|
+
this.rejected = new Set(parsed.rejected);
|
|
241
|
+
this.loaded = true;
|
|
242
|
+
return this.settings;
|
|
243
|
+
}
|
|
244
|
+
async save() {
|
|
245
|
+
const out = { ...this.raw, ...this.settings };
|
|
246
|
+
for (const key of this.rejected)
|
|
247
|
+
out[key] = this.raw[key];
|
|
248
|
+
// Atomic: a crash mid-write left a file the next load read as all defaults.
|
|
249
|
+
await atomicWrite(this.filePath, JSON.stringify(out, null, 2));
|
|
250
|
+
}
|
|
251
|
+
get(key) {
|
|
252
|
+
return this.settings[key];
|
|
253
|
+
}
|
|
254
|
+
async set(key, value) {
|
|
255
|
+
this.settings[key] = value;
|
|
256
|
+
this.rejected.delete(key);
|
|
257
|
+
await this.save();
|
|
258
|
+
}
|
|
259
|
+
getAll() {
|
|
260
|
+
return { ...this.settings };
|
|
261
|
+
}
|
|
262
|
+
/** Whether the project at `cwd` is trusted for project-scope MCP. True when
|
|
263
|
+
* EITHER the global `trustProjectMcpServers` toggle is on OR the resolved
|
|
264
|
+
* cwd appears in `trustedProjects`. */
|
|
265
|
+
isProjectTrusted(cwd) {
|
|
266
|
+
if (this.settings.trustProjectMcpServers)
|
|
267
|
+
return true;
|
|
268
|
+
const resolved = path.resolve(cwd);
|
|
269
|
+
return this.settings.trustedProjects.includes(resolved);
|
|
270
|
+
}
|
|
271
|
+
/** Persist `cwd` as a trusted project (resolved absolute path, deduped) and
|
|
272
|
+
* save settings immediately. */
|
|
273
|
+
async trustProject(cwd) {
|
|
274
|
+
const resolved = path.resolve(cwd);
|
|
275
|
+
if (!this.settings.trustedProjects.includes(resolved)) {
|
|
276
|
+
this.settings.trustedProjects = [...this.settings.trustedProjects, resolved];
|
|
277
|
+
await this.save();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
//# sourceMappingURL=settings-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-manager.js","sourceRoot":"","sources":["../../src/core/settings-manager.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,8DAA8D;AAE9D,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACtC,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IAC5D;;;gDAG4C;IAC5C,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;IACxD;;uDAEmD;IACnD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IAC3C,eAAe,EAAE,CAAC;SACf,IAAI,CAAC;QACJ,WAAW;QACX,QAAQ;QACR,QAAQ;QACR,KAAK;QACL,UAAU;QACV,SAAS;QACT,QAAQ;QACR,UAAU;QACV,YAAY;QACZ,aAAa;QACb,UAAU;QACV,aAAa;QACb,QA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AsB;YAAE,OAAO,IAAI,CAAC;QACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC1D,CAAC;IAED;qCACiC;IACjC,KAAK,CAAC,YAAY,CAAC,GAAW;QAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtD,IAAI,CAAC,QAAQ,CAAC,eAAe,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;YAC7E,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QACpB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Branch switches in a checkout another open window also uses.
|
|
3
|
+
*
|
|
4
|
+
* A git checkout has ONE branch. Two app windows on the same folder share it,
|
|
5
|
+
* so an agent in one window that runs `git checkout -b feature` moves the other
|
|
6
|
+
* window onto `feature` too — its files change underneath it, and its agent
|
|
7
|
+
* keeps editing and committing on a branch it never chose (observed: a goal's
|
|
8
|
+
* agent switched the shared gg-coder checkout and later commits swept another
|
|
9
|
+
* window's uncommitted work onto that branch). A separate worktree gives each
|
|
10
|
+
* branch its own folder, so the guard blocks the switch and points there.
|
|
11
|
+
*/
|
|
12
|
+
/** Set on the command (`GG_SHARED_CHECKOUT_OK=1 git checkout …`) after the user confirms. */
|
|
13
|
+
export declare const SHARED_CHECKOUT_OVERRIDE = "GG_SHARED_CHECKOUT_OK";
|
|
14
|
+
export interface BranchSwitch {
|
|
15
|
+
/** The invocation, for the block message. */
|
|
16
|
+
display: string;
|
|
17
|
+
/** Directory it would run in (after `cd`, `-C`). */
|
|
18
|
+
dir: string;
|
|
19
|
+
/** `--git-dir=`/`--work-tree=` globals to forward when resolving the checkout. */
|
|
20
|
+
gitArgs: string[];
|
|
21
|
+
/** `git checkout <name>`: switches only when `name` is a commit-ish, not a path. */
|
|
22
|
+
maybeRef?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Every invocation in `command` that changes the branch of the checkout it runs
|
|
26
|
+
* in: `git switch`, `git checkout <branch>` / `-b`, `gh pr checkout`. Pure apart
|
|
27
|
+
* from `existsSync` for the ambiguous `git checkout <name>`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function findBranchSwitches(command: string, cwd: string): BranchSwitch[];
|
|
30
|
+
/**
|
|
31
|
+
* The root of the checkout (working tree) `dir` belongs to, symlinks resolved,
|
|
32
|
+
* or null outside a repo. Each worktree is its own checkout with its own root.
|
|
33
|
+
*/
|
|
34
|
+
export declare function checkoutRoot(dir: string, gitArgs?: readonly string[]): Promise<string | null>;
|
|
35
|
+
export interface SharedCheckoutCheckOptions {
|
|
36
|
+
/** The tool's working directory. */
|
|
37
|
+
cwd: string;
|
|
38
|
+
/** The shell's real directory when it can differ from `cwd` (persistent shell). */
|
|
39
|
+
resolveCwd?: () => Promise<string | null>;
|
|
40
|
+
/**
|
|
41
|
+
* Who else works in the checkout rooted at `root` ("2 other open GG Coder
|
|
42
|
+
* windows", "the agent that started you"), or null when nobody does.
|
|
43
|
+
*/
|
|
44
|
+
sharedWith: (root: string) => Promise<string | null>;
|
|
45
|
+
}
|
|
46
|
+
/** "1 other open GG Coder window" / "3 other open GG Coder windows", or null for none. */
|
|
47
|
+
export declare function describeOtherWindows(count: number): string | null;
|
|
48
|
+
/**
|
|
49
|
+
* Returns a block message for the model when `command` would switch the branch
|
|
50
|
+
* of a checkout another open window also uses, or null to let it run. Fails
|
|
51
|
+
* open: a guard error never blocks a command.
|
|
52
|
+
*/
|
|
53
|
+
export declare function checkSharedCheckoutSwitch(command: string, options: SharedCheckoutCheckOptions): Promise<string | null>;
|
|
54
|
+
/**
|
|
55
|
+
* How many windows other than `selfId` read git from a folder inside the
|
|
56
|
+
* checkout rooted at `root`. `resolveRoot` is {@link checkoutRoot}, injectable.
|
|
57
|
+
*/
|
|
58
|
+
export declare function countOtherWindowsOnCheckout(windows: readonly {
|
|
59
|
+
id: string;
|
|
60
|
+
gitDir: string | null;
|
|
61
|
+
}[], selfId: string, root: string, resolveRoot?: (dir: string) => Promise<string | null>): Promise<number>;
|
|
62
|
+
/** Whether any window other than `selfId` in the checkout rooted at `root` is working. */
|
|
63
|
+
export declare function anyOtherWindowBusyOnCheckout(windows: readonly {
|
|
64
|
+
id: string;
|
|
65
|
+
gitDir: string | null;
|
|
66
|
+
isBusy: () => boolean;
|
|
67
|
+
}[], selfId: string, root: string, resolveRoot?: (dir: string) => Promise<string | null>): Promise<boolean>;
|
|
68
|
+
/**
|
|
69
|
+
* For a worker agent: its parent (and every sibling worker and window) works in
|
|
70
|
+
* the checkouts of `dirs`, the worker's cwd and shared roots. Resolved once,
|
|
71
|
+
* lazily, on the first branch switch the worker tries.
|
|
72
|
+
*/
|
|
73
|
+
export declare function parentCheckoutSharers(dirs: readonly string[], resolveRoot?: (dir: string) => Promise<string | null>): (root: string) => Promise<string | null>;
|
|
74
|
+
/**
|
|
75
|
+
* The note an agent gets when its checkout's branch changed while it was not
|
|
76
|
+
* looking (another window, the user's terminal, or its own last command).
|
|
77
|
+
*/
|
|
78
|
+
export declare function branchChangeNote(previous: string, next: string): string;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { realpathNative, runBackgroundGit } from "../utils/git.js";
|
|
4
|
+
import { hasLong, hasShort, isPathspecShaped, operands, parseGitInvocation, splitAtDoubleDash, walkShell, } from "./destructive-git-guard.js";
|
|
5
|
+
import { log } from "@kenkaiiii/gg-core";
|
|
6
|
+
/**
|
|
7
|
+
* Branch switches in a checkout another open window also uses.
|
|
8
|
+
*
|
|
9
|
+
* A git checkout has ONE branch. Two app windows on the same folder share it,
|
|
10
|
+
* so an agent in one window that runs `git checkout -b feature` moves the other
|
|
11
|
+
* window onto `feature` too — its files change underneath it, and its agent
|
|
12
|
+
* keeps editing and committing on a branch it never chose (observed: a goal's
|
|
13
|
+
* agent switched the shared gg-coder checkout and later commits swept another
|
|
14
|
+
* window's uncommitted work onto that branch). A separate worktree gives each
|
|
15
|
+
* branch its own folder, so the guard blocks the switch and points there.
|
|
16
|
+
*/
|
|
17
|
+
/** Set on the command (`GG_SHARED_CHECKOUT_OK=1 git checkout …`) after the user confirms. */
|
|
18
|
+
export const SHARED_CHECKOUT_OVERRIDE = "GG_SHARED_CHECKOUT_OK";
|
|
19
|
+
const GIT_TIMEOUT_MS = 3_000;
|
|
20
|
+
const SWITCH_VALUE_OPTS = new Set(["-c", "-C", "--orphan", "--conflict"]);
|
|
21
|
+
const CHECKOUT_VALUE_OPTS = new Set([
|
|
22
|
+
"-b",
|
|
23
|
+
"-B",
|
|
24
|
+
"--orphan",
|
|
25
|
+
"--conflict",
|
|
26
|
+
"-U",
|
|
27
|
+
"--unified",
|
|
28
|
+
]);
|
|
29
|
+
function truncate(text, max = 120) {
|
|
30
|
+
return text.length > max ? `${text.slice(0, max - 1)}…` : text;
|
|
31
|
+
}
|
|
32
|
+
function classifyGit(args, cwd) {
|
|
33
|
+
const { dir, gitArgs, subcommand, rest } = parseGitInvocation(args, cwd);
|
|
34
|
+
if (subcommand === undefined)
|
|
35
|
+
return null;
|
|
36
|
+
const base = { display: truncate(["git", subcommand, ...rest].join(" ")), dir, gitArgs };
|
|
37
|
+
if (rest.some((t) => t === "-h" || t === "--help"))
|
|
38
|
+
return null;
|
|
39
|
+
if (subcommand === "switch") {
|
|
40
|
+
const creates = hasShort(rest, "c") || hasShort(rest, "C") || hasLong(rest, "--orphan");
|
|
41
|
+
const detach = hasShort(rest, "d") || hasLong(rest, "--detach", 5);
|
|
42
|
+
// A bare `-` is the previous branch, not an option.
|
|
43
|
+
const previous = rest.includes("-");
|
|
44
|
+
return creates || detach || previous || operands(rest, SWITCH_VALUE_OPTS).length > 0
|
|
45
|
+
? base
|
|
46
|
+
: null;
|
|
47
|
+
}
|
|
48
|
+
if (subcommand === "checkout") {
|
|
49
|
+
const { before, after } = splitAtDoubleDash(rest);
|
|
50
|
+
if (before.some((t) => t === "-b" || t === "-B" || t === "--orphan"))
|
|
51
|
+
return base;
|
|
52
|
+
// `git checkout [<ref>] -- <paths>` restores files; the branch stays.
|
|
53
|
+
if (after !== null)
|
|
54
|
+
return null;
|
|
55
|
+
// A bare `-` is the previous branch, not an option.
|
|
56
|
+
if (before.includes("-"))
|
|
57
|
+
return base;
|
|
58
|
+
const positional = operands(before, CHECKOUT_VALUE_OPTS);
|
|
59
|
+
// Two operands is `<tree-ish> <paths>`, a file restore.
|
|
60
|
+
if (positional.length !== 1)
|
|
61
|
+
return null;
|
|
62
|
+
const operand = positional[0] ?? "";
|
|
63
|
+
if (hasShort(before, "d") || hasLong(before, "--detach", 5))
|
|
64
|
+
return base;
|
|
65
|
+
if (isPathspecShaped(operand) || existsSync(path.resolve(dir, operand)))
|
|
66
|
+
return null;
|
|
67
|
+
return { ...base, maybeRef: operand };
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Every invocation in `command` that changes the branch of the checkout it runs
|
|
73
|
+
* in: `git switch`, `git checkout <branch>` / `-b`, `gh pr checkout`. Pure apart
|
|
74
|
+
* from `existsSync` for the ambiguous `git checkout <name>`.
|
|
75
|
+
*/
|
|
76
|
+
export function findBranchSwitches(command, cwd) {
|
|
77
|
+
const out = [];
|
|
78
|
+
for (const call of walkShell(command, cwd, (name) => name === "git" || name === "gh")) {
|
|
79
|
+
if (call.name === "gh") {
|
|
80
|
+
const [group, action] = operands(call.args, new Set(["-R", "--repo"]));
|
|
81
|
+
if (group === "pr" && action === "checkout") {
|
|
82
|
+
out.push({ display: truncate(["gh", ...call.args].join(" ")), dir: call.cwd, gitArgs: [] });
|
|
83
|
+
}
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const match = classifyGit(call.args, call.cwd);
|
|
87
|
+
if (match)
|
|
88
|
+
out.push(match);
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The root of the checkout (working tree) `dir` belongs to, symlinks resolved,
|
|
94
|
+
* or null outside a repo. Each worktree is its own checkout with its own root.
|
|
95
|
+
*/
|
|
96
|
+
export async function checkoutRoot(dir, gitArgs = []) {
|
|
97
|
+
try {
|
|
98
|
+
const { stdout } = await runBackgroundGit(["rev-parse", "--show-toplevel"], {
|
|
99
|
+
cwd: dir,
|
|
100
|
+
globalArgs: gitArgs,
|
|
101
|
+
timeoutMs: GIT_TIMEOUT_MS,
|
|
102
|
+
});
|
|
103
|
+
const top = stdout.trim();
|
|
104
|
+
return top ? await realpathNative(top) : null;
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async function isCommit(match, ref) {
|
|
111
|
+
try {
|
|
112
|
+
await runBackgroundGit(["rev-parse", "--verify", "--quiet", `${ref}^{commit}`], {
|
|
113
|
+
cwd: match.dir,
|
|
114
|
+
globalArgs: match.gitArgs,
|
|
115
|
+
timeoutMs: GIT_TIMEOUT_MS,
|
|
116
|
+
});
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/** "1 other open GG Coder window" / "3 other open GG Coder windows", or null for none. */
|
|
124
|
+
export function describeOtherWindows(count) {
|
|
125
|
+
if (count <= 0)
|
|
126
|
+
return null;
|
|
127
|
+
return count === 1 ? "1 other open GG Coder window" : `${count} other open GG Coder windows`;
|
|
128
|
+
}
|
|
129
|
+
function blockMessage(match, root, others) {
|
|
130
|
+
const repo = path.basename(root);
|
|
131
|
+
return (`Blocked \`${match.display}\`: ${others} also work in this checkout (${root}). A checkout has one ` +
|
|
132
|
+
"branch, so switching it here switches it for them too: their files change underneath " +
|
|
133
|
+
"them and their agents keep editing and committing on the new branch. Work in a separate " +
|
|
134
|
+
`worktree instead, e.g. \`git worktree add ../${repo}-<branch> -b <branch>\` (or ` +
|
|
135
|
+
"`git worktree add <folder> <existing-branch>`), then run your commands in that folder; " +
|
|
136
|
+
"the user can open it in its own window. If the user explicitly wants this shared checkout " +
|
|
137
|
+
`switched, confirm with ask_user first, then re-run the command prefixed with ` +
|
|
138
|
+
`\`${SHARED_CHECKOUT_OVERRIDE}=1\`.`);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Returns a block message for the model when `command` would switch the branch
|
|
142
|
+
* of a checkout another open window also uses, or null to let it run. Fails
|
|
143
|
+
* open: a guard error never blocks a command.
|
|
144
|
+
*/
|
|
145
|
+
export async function checkSharedCheckoutSwitch(command, options) {
|
|
146
|
+
try {
|
|
147
|
+
if (!/\b(git|gh)\b/.test(command))
|
|
148
|
+
return null;
|
|
149
|
+
if (new RegExp(`(^|[\\s;&|(])${SHARED_CHECKOUT_OVERRIDE}=1(\\s|$)`).test(command))
|
|
150
|
+
return null;
|
|
151
|
+
let matches = findBranchSwitches(command, options.cwd);
|
|
152
|
+
if (matches.length === 0)
|
|
153
|
+
return null;
|
|
154
|
+
if (options.resolveCwd) {
|
|
155
|
+
const real = await options.resolveCwd();
|
|
156
|
+
if (real && path.isAbsolute(real) && real !== options.cwd) {
|
|
157
|
+
matches = findBranchSwitches(command, real);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const reasons = [];
|
|
161
|
+
for (const match of matches) {
|
|
162
|
+
if (!existsSync(match.dir))
|
|
163
|
+
continue;
|
|
164
|
+
if (match.maybeRef !== undefined && !(await isCommit(match, match.maybeRef)))
|
|
165
|
+
continue;
|
|
166
|
+
const root = await checkoutRoot(match.dir, match.gitArgs);
|
|
167
|
+
if (!root)
|
|
168
|
+
continue;
|
|
169
|
+
const others = await options.sharedWith(root);
|
|
170
|
+
if (others)
|
|
171
|
+
reasons.push(blockMessage(match, root, others));
|
|
172
|
+
}
|
|
173
|
+
return reasons.length > 0 ? reasons.join("\n") : null;
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
log("WARN", "git-guard", `Shared-checkout guard failed open: ${error.message}`);
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* How many windows other than `selfId` read git from a folder inside the
|
|
182
|
+
* checkout rooted at `root`. `resolveRoot` is {@link checkoutRoot}, injectable.
|
|
183
|
+
*/
|
|
184
|
+
export async function countOtherWindowsOnCheckout(windows, selfId, root, resolveRoot = (dir) => checkoutRoot(dir)) {
|
|
185
|
+
const others = windows.filter((w) => w.id !== selfId && w.gitDir !== null);
|
|
186
|
+
const roots = await Promise.all(others.map((w) => resolveRoot(w.gitDir ?? "")));
|
|
187
|
+
return roots.filter((r) => r === root).length;
|
|
188
|
+
}
|
|
189
|
+
/** Whether any window other than `selfId` in the checkout rooted at `root` is working. */
|
|
190
|
+
export async function anyOtherWindowBusyOnCheckout(windows, selfId, root, resolveRoot = (dir) => checkoutRoot(dir)) {
|
|
191
|
+
const busy = windows.filter((w) => w.id !== selfId && w.gitDir !== null && w.isBusy());
|
|
192
|
+
const roots = await Promise.all(busy.map((w) => resolveRoot(w.gitDir ?? "")));
|
|
193
|
+
return roots.includes(root);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* For a worker agent: its parent (and every sibling worker and window) works in
|
|
197
|
+
* the checkouts of `dirs`, the worker's cwd and shared roots. Resolved once,
|
|
198
|
+
* lazily, on the first branch switch the worker tries.
|
|
199
|
+
*/
|
|
200
|
+
export function parentCheckoutSharers(dirs, resolveRoot = (dir) => checkoutRoot(dir)) {
|
|
201
|
+
let roots;
|
|
202
|
+
return async (root) => {
|
|
203
|
+
roots ??= Promise.all(dirs.map(resolveRoot)).then((found) => new Set(found.filter((r) => r !== null)));
|
|
204
|
+
return (await roots).has(root)
|
|
205
|
+
? "the agent that started you (and any window or worker on this folder)"
|
|
206
|
+
: null;
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* The note an agent gets when its checkout's branch changed while it was not
|
|
211
|
+
* looking (another window, the user's terminal, or its own last command).
|
|
212
|
+
*/
|
|
213
|
+
export function branchChangeNote(previous, next) {
|
|
214
|
+
return (`The git branch of this checkout changed from \`${previous}\` to \`${next}\` (switched by ` +
|
|
215
|
+
"another window, the user, or one of your own commands). Your working files now follow " +
|
|
216
|
+
`\`${next}\`: re-check \`git status\` before editing or committing, and don't assume ` +
|
|
217
|
+
`\`${previous}\` is still checked out.`);
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=shared-checkout-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-checkout-guard.js","sourceRoot":"","sources":["../../src/core/shared-checkout-guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EACL,OAAO,EACP,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,GACV,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEzC;;;;;;;;;;GAUG;AAEH,6FAA6F;AAC7F,MAAM,CAAC,MAAM,wBAAwB,GAAG,uBAAuB,CAAC;AAEhE,MAAM,cAAc,GAAG,KAAK,CAAC;AAC7B,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,CAA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ACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute the enriched PATH (login shell ∪ current ∪ existing well-known dirs).
|
|
3
|
+
* Cached after first call. Order is preserved and duplicates removed.
|
|
4
|
+
*/
|
|
5
|
+
export declare function resolveEnrichedPath(currentPath?: string): Promise<string>;
|
|
6
|
+
/** How many directories `after` has that `before` did not. */
|
|
7
|
+
export declare function countAddedPathDirs(before: string, after: string): number;
|
|
8
|
+
/**
|
|
9
|
+
* Enrich `process.env.PATH` in place so every later spawn/execFile (the bash
|
|
10
|
+
* tool, background tasks, LSP servers, git helpers) inherits a working PATH.
|
|
11
|
+
* Idempotent and safe to call once at startup. No-op on Windows.
|
|
12
|
+
*/
|
|
13
|
+
export declare function enrichProcessPath(): Promise<void>;
|