@kenkaiiii/gg-engine 0.0.0-stage → 7.0.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 +269 -0
- package/assets/skills/gg-guide/references/getting-started.md +290 -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 +278 -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/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 +510 -0
- package/dist/core/session-manager.js +1368 -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 +239 -0
- package/dist/core/subagent-manager.js +1059 -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 +37 -0
- package/dist/tools/subagent.js +406 -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,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Point `os.homedir()` at a throwaway directory, on every platform.
|
|
3
|
+
*
|
|
4
|
+
* Tests that isolate `~/.gg` (auth.json, settings, session store) used to set
|
|
5
|
+
* `process.env.HOME` alone. That silently does NOTHING on Windows: libuv
|
|
6
|
+
* resolves the home directory from `USERPROFILE`, falling back to
|
|
7
|
+
* `HOMEDRIVE`+`HOMEPATH`, and ignores `HOME` entirely. So on Windows those
|
|
8
|
+
* tests kept reading the REAL user profile — which on a fresh CI runner has no
|
|
9
|
+
* credentials, hence a wave of `NotLoggedInError` failures, and on a developer
|
|
10
|
+
* machine means a test could read (or overwrite) real auth tokens.
|
|
11
|
+
*
|
|
12
|
+
* This is the same trap that made the desktop app come up logged out with an
|
|
13
|
+
* empty project picker: the Rust shell preferred `HOME` while the Node sidecar
|
|
14
|
+
* used `USERPROFILE`, so the two disagreed about where `~` was.
|
|
15
|
+
*
|
|
16
|
+
* Sets every variable libuv consults and returns a restore function that puts
|
|
17
|
+
* the previous values back exactly, including "was not set".
|
|
18
|
+
*/
|
|
19
|
+
export function useFakeHome(dir) {
|
|
20
|
+
const vars = ["HOME", "USERPROFILE", "HOMEDRIVE", "HOMEPATH"];
|
|
21
|
+
const previous = new Map(vars.map((v) => [v, process.env[v]]));
|
|
22
|
+
process.env.HOME = dir;
|
|
23
|
+
process.env.USERPROFILE = dir;
|
|
24
|
+
// HOMEDRIVE/HOMEPATH are only consulted when USERPROFILE is unset, but a
|
|
25
|
+
// stale pair pointing at the real profile is a trap worth removing outright.
|
|
26
|
+
delete process.env.HOMEDRIVE;
|
|
27
|
+
delete process.env.HOMEPATH;
|
|
28
|
+
return () => {
|
|
29
|
+
for (const [name, value] of previous) {
|
|
30
|
+
if (value === undefined)
|
|
31
|
+
delete process.env[name];
|
|
32
|
+
else
|
|
33
|
+
process.env[name] = value;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=fake-home.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake-home.js","sourceRoot":"","sources":["../../src/test-support/fake-home.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,CAAU,CAAC;IACvE,MAAM,QAAQ,GAAG,IAAI,GAAG,CAA6B,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3F,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC;IACvB,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC;IAC9B,yEAAyE;IACzE,6EAA6E;IAC7E,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;IAC7B,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;IAE5B,OAAO,GAAG,EAAE;QACV,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,QAAQ,EAAE,CAAC;YACrC,IAAI,KAAK,KAAK,SAAS;gBAAE,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;;gBAC7C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QACjC,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Body for a test fixture process that must stay running until a test kills
|
|
3
|
+
* it, yet must not outlive the test run itself.
|
|
4
|
+
*
|
|
5
|
+
* A bare `setInterval(() => {}, 1000)` runs forever: if the test runner is
|
|
6
|
+
* killed mid-test (Ctrl+C, an agent's timeout, a crashed worker), cleanup in
|
|
7
|
+
* `finally`/`afterEach` never runs and the fixture is orphaned for good. This
|
|
8
|
+
* one exits as soon as the owning test process is gone, which never changes
|
|
9
|
+
* a test's outcome because the owner is alive for the whole test.
|
|
10
|
+
*
|
|
11
|
+
* Contains no quotes, `$` or backslashes, so it can be embedded in a
|
|
12
|
+
* double-quoted shell argument or a JS string literal unchanged.
|
|
13
|
+
*/
|
|
14
|
+
export declare function keepAliveWhileOwnerLives(ownerPid?: number): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Body for a test fixture process that must stay running until a test kills
|
|
3
|
+
* it, yet must not outlive the test run itself.
|
|
4
|
+
*
|
|
5
|
+
* A bare `setInterval(() => {}, 1000)` runs forever: if the test runner is
|
|
6
|
+
* killed mid-test (Ctrl+C, an agent's timeout, a crashed worker), cleanup in
|
|
7
|
+
* `finally`/`afterEach` never runs and the fixture is orphaned for good. This
|
|
8
|
+
* one exits as soon as the owning test process is gone, which never changes
|
|
9
|
+
* a test's outcome because the owner is alive for the whole test.
|
|
10
|
+
*
|
|
11
|
+
* Contains no quotes, `$` or backslashes, so it can be embedded in a
|
|
12
|
+
* double-quoted shell argument or a JS string literal unchanged.
|
|
13
|
+
*/
|
|
14
|
+
export function keepAliveWhileOwnerLives(ownerPid = process.pid) {
|
|
15
|
+
return `setInterval(()=>{try{process.kill(${ownerPid},0)}catch{process.exit(0)}},1000);`;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=keep-alive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keep-alive.js","sourceRoot":"","sources":["../../src/test-support/keep-alive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,wBAAwB,CAAC,WAAmB,OAAO,CAAC,GAAG;IACrE,OAAO,qCAAqC,QAAQ,oCAAoC,CAAC;AAC3F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function slowRevParseGit(delaySeconds: number): Promise<string>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Make GG's background git slow on demand: put a `git` first on PATH that
|
|
3
|
+
* answers `rev-parse` (the repo check) only after `delaySeconds` and runs the
|
|
4
|
+
* real git for everything else. Returns the shim's folder so the caller can
|
|
5
|
+
* remove it. POSIX only: on Windows GG resolves git.exe itself.
|
|
6
|
+
*/
|
|
7
|
+
import { execFileSync } from "node:child_process";
|
|
8
|
+
import { chmod, mkdtemp, writeFile } from "node:fs/promises";
|
|
9
|
+
import { tmpdir } from "node:os";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import { vi } from "vitest";
|
|
12
|
+
export async function slowRevParseGit(delaySeconds) {
|
|
13
|
+
const dir = await mkdtemp(path.join(tmpdir(), "gg-slow-git-"));
|
|
14
|
+
const realGit = execFileSync("sh", ["-c", "command -v git"], { encoding: "utf8" }).trim();
|
|
15
|
+
const shim = path.join(dir, "git");
|
|
16
|
+
await writeFile(shim, `#!/bin/sh\ncase " $* " in *" rev-parse "*) sleep ${delaySeconds} ;; esac\nexec "${realGit}" "$@"\n`);
|
|
17
|
+
await chmod(shim, 0o755);
|
|
18
|
+
vi.stubEnv("PATH", `${dir}${path.delimiter}${process.env.PATH ?? ""}`);
|
|
19
|
+
return dir;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=slow-git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slow-git.js","sourceRoot":"","sources":["../../src/test-support/slow-git.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,YAAoB;IACxD,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1F,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACnC,MAAM,SAAS,CACb,IAAI,EACJ,oDAAoD,YAAY,mBAAmB,OAAO,UAAU,CACrG,CAAC;IACF,MAAM,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzB,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;IACvE,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True when a test that shells out to these system tools should skip because
|
|
3
|
+
* one is not installed, with a note saying which. CI installs them, so there a
|
|
4
|
+
* missing tool always fails the test instead of skipping it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function missingSystemTools(file: string, ...names: string[]): boolean;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { accessSync, constants, statSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
function onPath(name) {
|
|
4
|
+
const win = process.platform === "win32";
|
|
5
|
+
const exts = win ? (process.env.PATHEXT ?? ".EXE").split(";").filter(Boolean) : [""];
|
|
6
|
+
for (const dir of (process.env.PATH ?? "").split(path.delimiter).filter(Boolean)) {
|
|
7
|
+
for (const ext of exts) {
|
|
8
|
+
const file = path.join(dir, name + ext);
|
|
9
|
+
try {
|
|
10
|
+
accessSync(file, win ? constants.F_OK : constants.X_OK);
|
|
11
|
+
if (statSync(file).isFile())
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
// Not here; try the next folder.
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* True when a test that shells out to these system tools should skip because
|
|
23
|
+
* one is not installed, with a note saying which. CI installs them, so there a
|
|
24
|
+
* missing tool always fails the test instead of skipping it.
|
|
25
|
+
*/
|
|
26
|
+
export function missingSystemTools(file, ...names) {
|
|
27
|
+
// vitest.config.ts forces CI=false in workers, so detect GitHub Actions directly.
|
|
28
|
+
if (process.env.GITHUB_ACTIONS === "true")
|
|
29
|
+
return false;
|
|
30
|
+
const missing = names.filter((name) => !onPath(name));
|
|
31
|
+
if (missing.length === 0)
|
|
32
|
+
return false;
|
|
33
|
+
console.warn(`Skipping parts of ${file}: ${missing.join(", ")} not found on PATH.`);
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=system-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-tools.js","sourceRoot":"","sources":["../../src/test-support/system-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,SAAS,MAAM,CAAC,IAAY;IAC1B,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;IACzC,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACrF,KAAK,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QACjF,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,GAAG,GAAG,CAAC,CAAC;YACxC,IAAI,CAAC;gBACH,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;gBACxD,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE;oBAAE,OAAO,IAAI,CAAC;YAC3C,CAAC;YAAC,MAAM,CAAC;gBACP,iCAAiC;YACnC,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,GAAG,KAAe;IACjE,kFAAkF;IAClF,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,MAAM;QAAE,OAAO,KAAK,CAAC;IACxD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IACtD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACvC,OAAO,CAAC,IAAI,CAAC,qBAAqB,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACpF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AgentTool } from "@kenkaiiii/gg-agent";
|
|
3
|
+
import { type AskUserRequest, type AskUserResult } from "../core/ask-user.js";
|
|
4
|
+
/** Ask the host to put the questions in front of the user and wait. */
|
|
5
|
+
export type AskUserHandler = (request: AskUserRequest) => Promise<AskUserResult>;
|
|
6
|
+
declare const AskUserParams: z.ZodObject<{
|
|
7
|
+
questions: z.ZodArray<z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
question: z.ZodString;
|
|
10
|
+
kind: z.ZodEnum<{
|
|
11
|
+
text: "text";
|
|
12
|
+
confirm: "confirm";
|
|
13
|
+
choice: "choice";
|
|
14
|
+
multi: "multi";
|
|
15
|
+
}>;
|
|
16
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
17
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
18
|
+
label: z.ZodString;
|
|
19
|
+
value: z.ZodOptional<z.ZodString>;
|
|
20
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
21
|
+
recommended: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
}, z.core.$strip>>>;
|
|
23
|
+
allowOther: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
/**
|
|
27
|
+
* Ask the user a question and block the turn until they answer.
|
|
28
|
+
*
|
|
29
|
+
* Registered only by hosts that can actually render it (the gg-app sidecar).
|
|
30
|
+
* A subagent, a headless run or the TUI has nobody to answer, so the tool is
|
|
31
|
+
* simply absent there and the agent falls back to asking in prose.
|
|
32
|
+
*/
|
|
33
|
+
export declare function createAskUserTool(ask: AskUserHandler): AgentTool<typeof AskUserParams>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ASK_USER_TIMEOUT_MS, askResultContent, } from "../core/ask-user.js";
|
|
3
|
+
/** Beyond this the band stops being a question and becomes a form. */
|
|
4
|
+
const MAX_QUESTIONS = 5;
|
|
5
|
+
const MAX_OPTIONS = 6;
|
|
6
|
+
const Option = z.object({
|
|
7
|
+
label: z.string().min(1),
|
|
8
|
+
value: z.string().optional(),
|
|
9
|
+
hint: z.string().optional(),
|
|
10
|
+
recommended: z.boolean().optional().describe("Your pick; max one"),
|
|
11
|
+
});
|
|
12
|
+
const Question = z.object({
|
|
13
|
+
id: z.string().min(1),
|
|
14
|
+
question: z.string().min(1),
|
|
15
|
+
kind: z.enum(["confirm", "choice", "multi", "text"]),
|
|
16
|
+
detail: z.string().optional(),
|
|
17
|
+
options: z.array(Option).max(MAX_OPTIONS).optional(),
|
|
18
|
+
allowOther: z.boolean().optional(),
|
|
19
|
+
});
|
|
20
|
+
const AskUserParams = z.object({
|
|
21
|
+
questions: z.array(Question).min(1).max(MAX_QUESTIONS),
|
|
22
|
+
});
|
|
23
|
+
/** Yes/No is implied by `confirm`, so the model never has to spell it out. */
|
|
24
|
+
const CONFIRM_OPTIONS = [
|
|
25
|
+
{ label: "Yes", value: "yes" },
|
|
26
|
+
{ label: "No", value: "no" },
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* Options that hand the decision straight back to the user.
|
|
30
|
+
*
|
|
31
|
+
* A click carries no payload beyond the option itself, so "Fix something
|
|
32
|
+
* specific" reaches the agent as literally that — an instruction it cannot
|
|
33
|
+
* act on. Catching it here turns a dead-end question into a tool error the
|
|
34
|
+
* model can immediately correct, instead of a button that wastes a turn.
|
|
35
|
+
*/
|
|
36
|
+
const DEFERRING = [
|
|
37
|
+
/\bsomething specific\b/i,
|
|
38
|
+
/\bsomething else\b/i,
|
|
39
|
+
/^(other|tell me more|you (choose|decide)|let me (specify|decide|explain))\b/i,
|
|
40
|
+
/\b(specify|describe|clarify|choose|pick|select|name)\b.*\b(it|one|which|what|something|a file|the file)\b/i,
|
|
41
|
+
];
|
|
42
|
+
function defersBack(option) {
|
|
43
|
+
return DEFERRING.some((re) => re.test(option.label.trim()));
|
|
44
|
+
}
|
|
45
|
+
function normalize(question) {
|
|
46
|
+
const options = question.kind === "confirm" && !question.options?.length ? CONFIRM_OPTIONS : question.options;
|
|
47
|
+
return {
|
|
48
|
+
id: question.id,
|
|
49
|
+
question: question.question,
|
|
50
|
+
kind: question.kind,
|
|
51
|
+
...(question.detail ? { detail: question.detail } : {}),
|
|
52
|
+
...(options ? { options } : {}),
|
|
53
|
+
...(question.allowOther !== undefined ? { allowOther: question.allowOther } : {}),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Ask the user a question and block the turn until they answer.
|
|
58
|
+
*
|
|
59
|
+
* Registered only by hosts that can actually render it (the gg-app sidecar).
|
|
60
|
+
* A subagent, a headless run or the TUI has nobody to answer, so the tool is
|
|
61
|
+
* simply absent there and the agent falls back to asking in prose.
|
|
62
|
+
*/
|
|
63
|
+
export function createAskUserTool(ask) {
|
|
64
|
+
return {
|
|
65
|
+
name: "ask_user",
|
|
66
|
+
description: "Ask the user with clickable options instead of a prose question, only when work they asked for is " +
|
|
67
|
+
"blocked on a decision only they can make; never while they are asking or discussing. Never instead of an answer: " +
|
|
68
|
+
"if they asked something, answer it in full first, so they know enough to choose. Not for facts " +
|
|
69
|
+
"you can look up. Plain words; each option a complete outcome (never 'Something else').",
|
|
70
|
+
parameters: AskUserParams,
|
|
71
|
+
// The turn is blocked on a human; nothing else in the batch may run first.
|
|
72
|
+
executionMode: "sequential",
|
|
73
|
+
// The host's soft deadline is the real bound (it returns "no answer yet"
|
|
74
|
+
// and keeps the question open). Without this the loop's 5-min default
|
|
75
|
+
// would abort the call while the user is still reading the question.
|
|
76
|
+
timeoutMs: ASK_USER_TIMEOUT_MS + 30_000,
|
|
77
|
+
async execute({ questions }) {
|
|
78
|
+
const ids = new Set(questions.map((q) => q.id));
|
|
79
|
+
if (ids.size !== questions.length) {
|
|
80
|
+
return "Error: every question needs a unique `id`.";
|
|
81
|
+
}
|
|
82
|
+
const missing = questions.find((q) => (q.kind === "choice" || q.kind === "multi") && (q.options?.length ?? 0) < 2);
|
|
83
|
+
if (missing) {
|
|
84
|
+
return `Error: question "${missing.id}" is kind "${missing.kind}" and needs at least 2 options.`;
|
|
85
|
+
}
|
|
86
|
+
const deferring = questions.flatMap((q) => q.options ?? []).find(defersBack);
|
|
87
|
+
if (deferring) {
|
|
88
|
+
return (`Error: the option "${deferring.label}" asks the user to specify something, but a ` +
|
|
89
|
+
"click sends only that option — they cannot type or elaborate. Replace it with the " +
|
|
90
|
+
"actual choices, or find the specifics yourself first. (The free-text escape is " +
|
|
91
|
+
"already built into the UI.)");
|
|
92
|
+
}
|
|
93
|
+
const normalized = questions.map(normalize);
|
|
94
|
+
const content = askResultContent(normalized, await ask({ questions: normalized }));
|
|
95
|
+
return typeof content === "string" ? content : { content };
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=ask-user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ask-user.js","sourceRoot":"","sources":["../../src/tools/ask-user.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Warnings for a background command whose output or exit code cannot tell the
|
|
3
|
+
* agent what it is waiting to learn.
|
|
4
|
+
*
|
|
5
|
+
* A background task wakes a waiting agent in three ways: it exits, its output
|
|
6
|
+
* matches the agent's wake pattern, or its output looks like a failure. Two
|
|
7
|
+
* habits defeat all of them, and session logs showed both on most CI waits:
|
|
8
|
+
*
|
|
9
|
+
* - Redirecting stdout to /dev/null or a file. The task log never sees the
|
|
10
|
+
* lines, so no pattern or failure check can match them, and a failure that
|
|
11
|
+
* happens mid-run is only noticed at exit or when the wait runs out.
|
|
12
|
+
* - `gh run watch` without `--exit-status`. It exits 0 when the run FAILS, so
|
|
13
|
+
* the exit looks like success.
|
|
14
|
+
*
|
|
15
|
+
* These are warnings, not refusals: a redirect is sometimes exactly what the
|
|
16
|
+
* agent wants (a setup step whose output is noise).
|
|
17
|
+
*/
|
|
18
|
+
export declare function backgroundWatchWarnings(command: string): string[];
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Warnings for a background command whose output or exit code cannot tell the
|
|
3
|
+
* agent what it is waiting to learn.
|
|
4
|
+
*
|
|
5
|
+
* A background task wakes a waiting agent in three ways: it exits, its output
|
|
6
|
+
* matches the agent's wake pattern, or its output looks like a failure. Two
|
|
7
|
+
* habits defeat all of them, and session logs showed both on most CI waits:
|
|
8
|
+
*
|
|
9
|
+
* - Redirecting stdout to /dev/null or a file. The task log never sees the
|
|
10
|
+
* lines, so no pattern or failure check can match them, and a failure that
|
|
11
|
+
* happens mid-run is only noticed at exit or when the wait runs out.
|
|
12
|
+
* - `gh run watch` without `--exit-status`. It exits 0 when the run FAILS, so
|
|
13
|
+
* the exit looks like success.
|
|
14
|
+
*
|
|
15
|
+
* These are warnings, not refusals: a redirect is sometimes exactly what the
|
|
16
|
+
* agent wants (a setup step whose output is noise).
|
|
17
|
+
*/
|
|
18
|
+
/** First words of commands whose redirect writes a file on purpose. */
|
|
19
|
+
const FILE_WRITERS = new Set([
|
|
20
|
+
"cat",
|
|
21
|
+
"echo",
|
|
22
|
+
"printf",
|
|
23
|
+
"tee",
|
|
24
|
+
"true",
|
|
25
|
+
":",
|
|
26
|
+
"mkdir",
|
|
27
|
+
"touch",
|
|
28
|
+
"git",
|
|
29
|
+
]);
|
|
30
|
+
/** Heredoc bodies hold arbitrary text (often code with `>` in it), never redirects. */
|
|
31
|
+
function stripHeredocs(command) {
|
|
32
|
+
const lines = command.split("\n");
|
|
33
|
+
const kept = [];
|
|
34
|
+
let terminator = null;
|
|
35
|
+
for (const line of lines) {
|
|
36
|
+
if (terminator !== null) {
|
|
37
|
+
if (line.trim() === terminator)
|
|
38
|
+
terminator = null;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
kept.push(line);
|
|
42
|
+
const heredoc = /<<-?\s*(['"]?)([A-Za-z_][A-Za-z0-9_]*)\1/.exec(line);
|
|
43
|
+
if (heredoc?.[2])
|
|
44
|
+
terminator = heredoc[2];
|
|
45
|
+
}
|
|
46
|
+
return kept.join("\n");
|
|
47
|
+
}
|
|
48
|
+
/** Drop quoted strings and `$(...)` bodies, whose `>` is not this command's redirect. */
|
|
49
|
+
function stripNested(command) {
|
|
50
|
+
let text = command.replace(/'[^']*'/g, "''").replace(/"(?:[^"\\]|\\.)*"/g, '""');
|
|
51
|
+
// Innermost-first, bounded: nested substitutions are rare in a watch command.
|
|
52
|
+
for (let i = 0; i < 5 && /\$\([^()]*\)/.test(text); i++) {
|
|
53
|
+
text = text.replace(/\$\([^()]*\)/g, "$()");
|
|
54
|
+
}
|
|
55
|
+
return text;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A stdout redirect: `>`, `>>`, `1>`, `&>`, `&>>` to a target. Not `2>` (stderr
|
|
59
|
+
* only — stdout still reaches the log) and not `>&2` (still captured).
|
|
60
|
+
*/
|
|
61
|
+
const STDOUT_REDIRECT = /(?<![0-9<>&])(?:&>>?|1?>>?)\s*(?!&)([^\s;|&)]+)/;
|
|
62
|
+
export function backgroundWatchWarnings(command) {
|
|
63
|
+
const warnings = [];
|
|
64
|
+
const shellText = stripNested(stripHeredocs(command));
|
|
65
|
+
if (/\bgh\s+run\s+watch\b/.test(shellText) && !/--exit-status\b/.test(shellText)) {
|
|
66
|
+
warnings.push("`gh run watch` without --exit-status exits 0 even when the run fails, so its exit " +
|
|
67
|
+
"code will look like success. Add --exit-status.");
|
|
68
|
+
}
|
|
69
|
+
for (const segment of shellText.split(/\n|;|&&|\|\|/)) {
|
|
70
|
+
const trimmed = segment.trim();
|
|
71
|
+
if (!trimmed)
|
|
72
|
+
continue;
|
|
73
|
+
const firstWord = trimmed.split(/\s+/)[0] ?? "";
|
|
74
|
+
if (FILE_WRITERS.has(firstWord))
|
|
75
|
+
continue;
|
|
76
|
+
const redirect = STDOUT_REDIRECT.exec(trimmed);
|
|
77
|
+
if (!redirect?.[1])
|
|
78
|
+
continue;
|
|
79
|
+
const target = redirect[1];
|
|
80
|
+
const where = target === "/dev/null"
|
|
81
|
+
? "discards its output"
|
|
82
|
+
: /^[\w./~-]+$/.test(target)
|
|
83
|
+
? `writes its output to ${target}`
|
|
84
|
+
: "writes its output to a file";
|
|
85
|
+
// Quoted text and $(...) were blanked for detection; naming a mangled
|
|
86
|
+
// segment back to the agent would only confuse it.
|
|
87
|
+
const named = /''|""|\$\(\)/.test(trimmed)
|
|
88
|
+
? "A command here"
|
|
89
|
+
: `\`${boundedSegment(trimmed)}\``;
|
|
90
|
+
warnings.push(`${named} ${where}, so the task log cannot see it: no wake pattern ` +
|
|
91
|
+
"or failure check can fire on those lines, and a mid-run failure is only noticed at " +
|
|
92
|
+
"exit. If that is the output you are waiting on, drop the redirect — the task log " +
|
|
93
|
+
"already keeps everything.");
|
|
94
|
+
break; // One redirect warning says it; more would only repeat it.
|
|
95
|
+
}
|
|
96
|
+
return warnings;
|
|
97
|
+
}
|
|
98
|
+
function boundedSegment(segment) {
|
|
99
|
+
const collapsed = segment.replace(/\s+/g, " ");
|
|
100
|
+
return collapsed.length <= 80 ? collapsed : `${collapsed.slice(0, 79)}\u2026`;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=background-watch-lint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"background-watch-lint.js","sourceRoot":"","sources":["../../src/tools/background-watch-lint.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ToolCall, ToolResult } from "@kenkaiiii/gg-ai";
|
|
2
|
+
import { type ReadTracker } from "./read-tracker.js";
|
|
3
|
+
import type { ToolOperations } from "./operations.js";
|
|
4
|
+
/** Paths a command prints in full, or [] when it is not a pure file dump. */
|
|
5
|
+
export declare function catTargets(command: string): string[];
|
|
6
|
+
/** A line-range view of one literal file path; `end` undefined means "to EOF". */
|
|
7
|
+
interface RangeTarget {
|
|
8
|
+
target: string;
|
|
9
|
+
start: number;
|
|
10
|
+
end: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Line-range views a command prints: `sed -n 'A,Bp' FILE`, `sed -n 'Ap' FILE`,
|
|
14
|
+
* `head -N FILE` and `head -n N FILE`. Exactly one literal file per command,
|
|
15
|
+
* nothing piped or redirected — the output must be the raw lines.
|
|
16
|
+
*/
|
|
17
|
+
export declare function rangeTargets(command: string): RangeTarget[];
|
|
18
|
+
/**
|
|
19
|
+
* Record reads proven by one step's bash calls. Call with the tool results
|
|
20
|
+
* exactly as appended to the transcript (post-trim).
|
|
21
|
+
*/
|
|
22
|
+
export declare function recordBashReads(tracker: ReadTracker, cwd: string, ops: ToolOperations, toolCalls: readonly ToolCall[], toolResults: readonly ToolResult[]): Promise<string[]>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { recordRead } from "./read-tracker.js";
|
|
3
|
+
import { resolvePath } from "./path-utils.js";
|
|
4
|
+
/**
|
|
5
|
+
* Credit `bash` file dumps as reads, so `edit`/`write` after `cat src/a.ts`
|
|
6
|
+
* does not force a second read of the same bytes.
|
|
7
|
+
*
|
|
8
|
+
* Fail-closed by construction: a file counts only when the command is a plain
|
|
9
|
+
* listing of file paths or one-directory globs (`cat`, `cat -n`, or the
|
|
10
|
+
* `for f in …; do cat …; done` idiom), the tool succeeded, and the CURRENT
|
|
11
|
+
* file content appears verbatim in the output the model actually received
|
|
12
|
+
* (after per-turn trimming). Anything the model did not literally see is
|
|
13
|
+
* never recorded.
|
|
14
|
+
*/
|
|
15
|
+
/** Literal paths, optionally with a `*` in the last segment (`src/*.js`).
|
|
16
|
+
* No variables, substitutions, redirections, or recursive globs. */
|
|
17
|
+
const SAFE_PATH = /^[\w./@+-]*(?:\*[\w.@+-]*)?$/;
|
|
18
|
+
const MAX_FILE_BYTES = 256 * 1024;
|
|
19
|
+
const MAX_GLOB_MATCHES = 64;
|
|
20
|
+
/** Paths a command prints in full, or [] when it is not a pure file dump. */
|
|
21
|
+
export function catTargets(command) {
|
|
22
|
+
const segments = command
|
|
23
|
+
.split(/;|&&|\n/)
|
|
24
|
+
.map((s) => s.trim())
|
|
25
|
+
.filter(Boolean);
|
|
26
|
+
const targets = [];
|
|
27
|
+
const literal = (a) => SAFE_PATH.test(a) && a.length > 0 && !a.startsWith("-");
|
|
28
|
+
for (const seg of segments) {
|
|
29
|
+
const cat = /^cat(?:\s+-n)?\s+(.+)$/.exec(seg);
|
|
30
|
+
if (cat?.[1]) {
|
|
31
|
+
const args = cat[1].split(/\s+/);
|
|
32
|
+
if (args.every(literal))
|
|
33
|
+
targets.push(...args);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// `for f in a b; do echo "== $f"; cat -n $f; done` — explicit word list only.
|
|
37
|
+
const forLoop = /\bfor (\w+) in ([^;\n]+?)\s*;\s*do\b([\s\S]*?)\bdone\b/.exec(command);
|
|
38
|
+
if (forLoop?.[1] && forLoop[2] && forLoop[3]) {
|
|
39
|
+
const v = forLoop[1];
|
|
40
|
+
const body = forLoop[3];
|
|
41
|
+
const catsVar = new RegExp(`\\bcat(?:\\s+-n)?\\s+"?\\$\\{?${v}\\}?"?(?=\\s*(?:;|$|\\n))`).test(body);
|
|
42
|
+
const words = forLoop[2].trim().split(/\s+/);
|
|
43
|
+
if (catsVar && words.every(literal))
|
|
44
|
+
targets.push(...words);
|
|
45
|
+
}
|
|
46
|
+
return [...new Set(targets)];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Line-range views a command prints: `sed -n 'A,Bp' FILE`, `sed -n 'Ap' FILE`,
|
|
50
|
+
* `head -N FILE` and `head -n N FILE`. Exactly one literal file per command,
|
|
51
|
+
* nothing piped or redirected — the output must be the raw lines.
|
|
52
|
+
*/
|
|
53
|
+
export function rangeTargets(command) {
|
|
54
|
+
const out = [];
|
|
55
|
+
for (const seg of command.split(/;|&&|\n/).map((s) => s.trim())) {
|
|
56
|
+
const sed = /^sed -n (['"]?)(\d+)(?:,(\d+))?p\1 (\S+)$/.exec(seg);
|
|
57
|
+
const head = /^head (?:-n ?)?-?(\d+) (\S+)$/.exec(seg);
|
|
58
|
+
const [target, start, end] = sed
|
|
59
|
+
? [sed[4], Number(sed[2]), Number(sed[3] ?? sed[2])]
|
|
60
|
+
: head
|
|
61
|
+
? [head[2], 1, Number(head[1])]
|
|
62
|
+
: [undefined, 0, 0];
|
|
63
|
+
if (!target || !SAFE_PATH.test(target) || target.includes("*") || target.startsWith("-")) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (start >= 1 && end >= start)
|
|
67
|
+
out.push({ target, start, end });
|
|
68
|
+
}
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Expand one target to concrete files. A `*` is matched within its own
|
|
73
|
+
* directory only (shell semantics, dotfiles excluded); a glob that matches
|
|
74
|
+
* nothing yields nothing.
|
|
75
|
+
*/
|
|
76
|
+
async function expandTarget(cwd, target, ops) {
|
|
77
|
+
if (!target.includes("*"))
|
|
78
|
+
return [resolvePath(cwd, target)];
|
|
79
|
+
const slash = target.lastIndexOf("/");
|
|
80
|
+
const dir = resolvePath(cwd, slash >= 0 ? target.slice(0, slash) || "/" : ".");
|
|
81
|
+
const pattern = target.slice(slash + 1);
|
|
82
|
+
const [head = "", tail = ""] = pattern.split("*");
|
|
83
|
+
const entries = await ops.readdir(dir, { withFileTypes: true });
|
|
84
|
+
return entries
|
|
85
|
+
.filter((e) => e.isFile() &&
|
|
86
|
+
!e.name.startsWith(".") &&
|
|
87
|
+
e.name.length >= head.length + tail.length &&
|
|
88
|
+
e.name.startsWith(head) &&
|
|
89
|
+
e.name.endsWith(tail))
|
|
90
|
+
.map((e) => path.join(dir, e.name))
|
|
91
|
+
.sort()
|
|
92
|
+
.slice(0, MAX_GLOB_MATCHES);
|
|
93
|
+
}
|
|
94
|
+
/** `cat -n` prefixes each line with a right-aligned number and a tab. */
|
|
95
|
+
function numbered(content) {
|
|
96
|
+
const lines = content.split("\n");
|
|
97
|
+
if (content.endsWith("\n"))
|
|
98
|
+
lines.pop();
|
|
99
|
+
return lines.map((line, i) => `${String(i + 1).padStart(6)}\t${line}`).join("\n");
|
|
100
|
+
}
|
|
101
|
+
function resultText(result) {
|
|
102
|
+
if (typeof result.content === "string")
|
|
103
|
+
return result.content;
|
|
104
|
+
return result.content.map((part) => (part.type === "text" ? part.text : "")).join("");
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Record reads proven by one step's bash calls. Call with the tool results
|
|
108
|
+
* exactly as appended to the transcript (post-trim).
|
|
109
|
+
*/
|
|
110
|
+
export async function recordBashReads(tracker, cwd, ops, toolCalls, toolResults) {
|
|
111
|
+
const recorded = [];
|
|
112
|
+
const byId = new Map(toolResults.map((r) => [r.toolCallId, r]));
|
|
113
|
+
for (const call of toolCalls) {
|
|
114
|
+
if (call.name !== "bash")
|
|
115
|
+
continue;
|
|
116
|
+
const result = byId.get(call.id);
|
|
117
|
+
const command = call.args["command"];
|
|
118
|
+
if (!result || result.isError || typeof command !== "string")
|
|
119
|
+
continue;
|
|
120
|
+
const targets = catTargets(command);
|
|
121
|
+
const ranges = rangeTargets(command);
|
|
122
|
+
if (targets.length === 0 && ranges.length === 0)
|
|
123
|
+
continue;
|
|
124
|
+
const output = resultText(result);
|
|
125
|
+
for (const { target, start, end } of ranges) {
|
|
126
|
+
try {
|
|
127
|
+
const resolved = resolvePath(cwd, target);
|
|
128
|
+
const stat = await ops.stat(resolved);
|
|
129
|
+
if (!stat.isFile() || stat.size > MAX_FILE_BYTES)
|
|
130
|
+
continue;
|
|
131
|
+
const content = await ops.readFile(resolved);
|
|
132
|
+
const lines = content.split("\n");
|
|
133
|
+
if (content.endsWith("\n"))
|
|
134
|
+
lines.pop();
|
|
135
|
+
const last = Math.min(end, lines.length);
|
|
136
|
+
if (start > last)
|
|
137
|
+
continue;
|
|
138
|
+
// Credit only lines the model literally received, in order.
|
|
139
|
+
if (!output.includes(lines.slice(start - 1, last).join("\n")))
|
|
140
|
+
continue;
|
|
141
|
+
recordRead(tracker, resolved, content, stat.mtimeMs, [start, last]);
|
|
142
|
+
recorded.push(resolved);
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
// Missing or unreadable: nothing was proven.
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const files = [];
|
|
149
|
+
for (const target of targets) {
|
|
150
|
+
try {
|
|
151
|
+
files.push(...(await expandTarget(cwd, target, ops)));
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
// Unresolvable path or unreadable directory: nothing was proven.
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Always re-record: an older full read may be stale (the file changed since),
|
|
158
|
+
// and this output is what the model saw most recently.
|
|
159
|
+
for (const resolved of new Set(files)) {
|
|
160
|
+
try {
|
|
161
|
+
const stat = await ops.stat(resolved);
|
|
162
|
+
if (!stat.isFile() || stat.size > MAX_FILE_BYTES)
|
|
163
|
+
continue;
|
|
164
|
+
const content = await ops.readFile(resolved);
|
|
165
|
+
const body = content.endsWith("\n") ? content.slice(0, -1) : content;
|
|
166
|
+
if (body.length === 0)
|
|
167
|
+
continue;
|
|
168
|
+
if (!output.includes(body) && !output.includes(numbered(content)))
|
|
169
|
+
continue;
|
|
170
|
+
recordRead(tracker, resolved, content, stat.mtimeMs);
|
|
171
|
+
recorded.push(resolved);
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
// Missing or unreadable: nothing was proven.
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return recorded;
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=bash-read-evidence.js.map
|