@jawcode-dev/coding-agent 1.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/CHANGELOG.md +376 -0
- package/README.md +37 -0
- package/dist/types/async/index.d.ts +2 -0
- package/dist/types/async/job-manager.d.ts +294 -0
- package/dist/types/async/support.d.ts +2 -0
- package/dist/types/autoresearch/dashboard.d.ts +4 -0
- package/dist/types/autoresearch/git.d.ts +36 -0
- package/dist/types/autoresearch/helpers.d.ts +24 -0
- package/dist/types/autoresearch/index.d.ts +2 -0
- package/dist/types/autoresearch/state.d.ts +17 -0
- package/dist/types/autoresearch/storage.d.ts +142 -0
- package/dist/types/autoresearch/tools/init-experiment.d.ts +31 -0
- package/dist/types/autoresearch/tools/log-experiment.d.ts +23 -0
- package/dist/types/autoresearch/tools/run-experiment.d.ts +8 -0
- package/dist/types/autoresearch/tools/update-notes.d.ts +12 -0
- package/dist/types/autoresearch/types.d.ts +154 -0
- package/dist/types/capability/context-file.d.ts +17 -0
- package/dist/types/capability/extension-module.d.ts +15 -0
- package/dist/types/capability/extension.d.ts +28 -0
- package/dist/types/capability/fs.d.ts +20 -0
- package/dist/types/capability/hook.d.ts +19 -0
- package/dist/types/capability/index.d.ts +80 -0
- package/dist/types/capability/instruction.d.ts +17 -0
- package/dist/types/capability/mcp.d.ts +45 -0
- package/dist/types/capability/prompt.d.ts +15 -0
- package/dist/types/capability/rule.d.ts +61 -0
- package/dist/types/capability/settings.d.ts +15 -0
- package/dist/types/capability/skill.d.ts +36 -0
- package/dist/types/capability/slash-command.d.ts +17 -0
- package/dist/types/capability/ssh.d.ts +23 -0
- package/dist/types/capability/system-prompt.d.ts +15 -0
- package/dist/types/capability/tool.d.ts +19 -0
- package/dist/types/capability/types.d.ts +154 -0
- package/dist/types/cli/agents-cli.d.ts +12 -0
- package/dist/types/cli/args.d.ts +56 -0
- package/dist/types/cli/auth-broker-cli.d.ts +25 -0
- package/dist/types/cli/auth-gateway-cli.d.ts +18 -0
- package/dist/types/cli/classify-install-target.d.ts +18 -0
- package/dist/types/cli/commands/init-xdg.d.ts +1 -0
- package/dist/types/cli/config-cli.d.ts +22 -0
- package/dist/types/cli/fast-help.d.ts +1 -0
- package/dist/types/cli/file-processor.d.ts +11 -0
- package/dist/types/cli/grep-cli.d.ts +17 -0
- package/dist/types/cli/initial-message.d.ts +17 -0
- package/dist/types/cli/list-models.d.ts +30 -0
- package/dist/types/cli/notify-cli.d.ts +29 -0
- package/dist/types/cli/plugin-cli.d.ts +32 -0
- package/dist/types/cli/read-cli.d.ts +4 -0
- package/dist/types/cli/session-picker.d.ts +3 -0
- package/dist/types/cli/setup-cli.d.ts +45 -0
- package/dist/types/cli/shell-cli.d.ts +8 -0
- package/dist/types/cli/skills-cli.d.ts +9 -0
- package/dist/types/cli/ssh-cli.d.ts +21 -0
- package/dist/types/cli/stats-cli.d.ts +17 -0
- package/dist/types/cli/update-cli.d.ts +41 -0
- package/dist/types/cli/web-search-cli.d.ts +20 -0
- package/dist/types/cli/worktree-cli.d.ts +26 -0
- package/dist/types/cli.d.ts +4 -0
- package/dist/types/commands/acp.d.ts +12 -0
- package/dist/types/commands/agents.d.ts +34 -0
- package/dist/types/commands/auth-broker.d.ts +54 -0
- package/dist/types/commands/auth-gateway.d.ts +32 -0
- package/dist/types/commands/chat.d.ts +18 -0
- package/dist/types/commands/codex-native-hook.d.ts +6 -0
- package/dist/types/commands/commit.d.ts +27 -0
- package/dist/types/commands/config.d.ts +30 -0
- package/dist/types/commands/contribution-prep.d.ts +18 -0
- package/dist/types/commands/coordinator.d.ts +19 -0
- package/dist/types/commands/goal.d.ts +31 -0
- package/dist/types/commands/grep.d.ts +42 -0
- package/dist/types/commands/harness.d.ts +50 -0
- package/dist/types/commands/interview.d.ts +51 -0
- package/dist/types/commands/launch.d.ts +127 -0
- package/dist/types/commands/mcp-serve.d.ts +24 -0
- package/dist/types/commands/memory.d.ts +19 -0
- package/dist/types/commands/notify.d.ts +30 -0
- package/dist/types/commands/orchestrate.d.ts +48 -0
- package/dist/types/commands/planphase.d.ts +7 -0
- package/dist/types/commands/plugin.d.ts +52 -0
- package/dist/types/commands/ralplan.d.ts +7 -0
- package/dist/types/commands/read.d.ts +15 -0
- package/dist/types/commands/session.d.ts +24 -0
- package/dist/types/commands/setup.d.ts +95 -0
- package/dist/types/commands/shell.d.ts +21 -0
- package/dist/types/commands/skills.d.ts +26 -0
- package/dist/types/commands/ssh.d.ts +48 -0
- package/dist/types/commands/state.d.ts +7 -0
- package/dist/types/commands/stats.d.ts +25 -0
- package/dist/types/commands/team.d.ts +24 -0
- package/dist/types/commands/ultragoal.d.ts +8 -0
- package/dist/types/commands/update.d.ts +20 -0
- package/dist/types/commands/web-search.d.ts +33 -0
- package/dist/types/commands/worktree.d.ts +31 -0
- package/dist/types/commit/agentic/agent.d.ts +31 -0
- package/dist/types/commit/agentic/fallback.d.ts +5 -0
- package/dist/types/commit/agentic/index.d.ts +2 -0
- package/dist/types/commit/agentic/state.d.ts +58 -0
- package/dist/types/commit/agentic/tools/analyze-file.d.ts +19 -0
- package/dist/types/commit/agentic/tools/git-file-diff.d.ts +10 -0
- package/dist/types/commit/agentic/tools/git-hunk.d.ts +9 -0
- package/dist/types/commit/agentic/tools/git-overview.d.ts +9 -0
- package/dist/types/commit/agentic/tools/index.d.ts +16 -0
- package/dist/types/commit/agentic/tools/propose-changelog.d.ts +28 -0
- package/dist/types/commit/agentic/tools/propose-commit.d.ts +36 -0
- package/dist/types/commit/agentic/tools/recent-commits.d.ts +7 -0
- package/dist/types/commit/agentic/tools/schemas.d.ts +27 -0
- package/dist/types/commit/agentic/tools/split-commit.d.ts +53 -0
- package/dist/types/commit/agentic/topo-sort.d.ts +4 -0
- package/dist/types/commit/agentic/trivial.d.ts +7 -0
- package/dist/types/commit/agentic/validation.d.ts +20 -0
- package/dist/types/commit/analysis/conventional.d.ts +22 -0
- package/dist/types/commit/analysis/index.d.ts +4 -0
- package/dist/types/commit/analysis/scope.d.ts +6 -0
- package/dist/types/commit/analysis/summary.d.ts +19 -0
- package/dist/types/commit/analysis/validation.d.ts +8 -0
- package/dist/types/commit/changelog/detect.d.ts +2 -0
- package/dist/types/commit/changelog/generate.d.ts +30 -0
- package/dist/types/commit/changelog/index.d.ts +30 -0
- package/dist/types/commit/changelog/parse.d.ts +2 -0
- package/dist/types/commit/cli.d.ts +3 -0
- package/dist/types/commit/git/diff.d.ts +5 -0
- package/dist/types/commit/index.d.ts +4 -0
- package/dist/types/commit/map-reduce/index.d.ts +28 -0
- package/dist/types/commit/map-reduce/map-phase.d.ts +17 -0
- package/dist/types/commit/map-reduce/reduce-phase.d.ts +13 -0
- package/dist/types/commit/map-reduce/utils.d.ts +2 -0
- package/dist/types/commit/message.d.ts +2 -0
- package/dist/types/commit/model-selection.d.ts +15 -0
- package/dist/types/commit/pipeline.d.ts +5 -0
- package/dist/types/commit/shared-llm.d.ts +54 -0
- package/dist/types/commit/types.d.ts +78 -0
- package/dist/types/commit/utils/exclusions.d.ts +4 -0
- package/dist/types/commit/utils.d.ts +20 -0
- package/dist/types/config/config-file.d.ts +58 -0
- package/dist/types/config/file-lock.d.ts +6 -0
- package/dist/types/config/keybindings.d.ts +359 -0
- package/dist/types/config/model-equivalence.d.ts +24 -0
- package/dist/types/config/model-profile-activation.d.ts +36 -0
- package/dist/types/config/model-profiles.d.ts +19 -0
- package/dist/types/config/model-registry.d.ts +445 -0
- package/dist/types/config/model-resolver.d.ts +217 -0
- package/dist/types/config/models-config-schema.d.ts +652 -0
- package/dist/types/config/oauth-provider-aliases.d.ts +1 -0
- package/dist/types/config/prompt-templates.d.ts +32 -0
- package/dist/types/config/resolve-config-value.d.ts +17 -0
- package/dist/types/config/settings-schema.d.ts +3683 -0
- package/dist/types/config/settings.d.ts +134 -0
- package/dist/types/config/skill-settings-defaults.d.ts +21 -0
- package/dist/types/config.d.ts +66 -0
- package/dist/types/coordinator/contract.d.ts +4 -0
- package/dist/types/coordinator-mcp/policy.d.ts +24 -0
- package/dist/types/coordinator-mcp/safety.d.ts +26 -0
- package/dist/types/coordinator-mcp/server.d.ts +52 -0
- package/dist/types/cursor.d.ts +24 -0
- package/dist/types/dap/client.d.ts +38 -0
- package/dist/types/dap/config.d.ts +6 -0
- package/dist/types/dap/index.d.ts +4 -0
- package/dist/types/dap/session.d.ts +108 -0
- package/dist/types/dap/types.d.ts +524 -0
- package/dist/types/debug/crash-diagnostics.d.ts +45 -0
- package/dist/types/debug/index.d.ts +15 -0
- package/dist/types/debug/log-formatting.d.ts +4 -0
- package/dist/types/debug/log-viewer.d.ts +68 -0
- package/dist/types/debug/profiler.d.ts +24 -0
- package/dist/types/debug/raw-sse-buffer.d.ts +44 -0
- package/dist/types/debug/raw-sse.d.ts +16 -0
- package/dist/types/debug/report-bundle.d.ts +55 -0
- package/dist/types/debug/runtime-gauges.d.ts +6 -0
- package/dist/types/debug/system-info.d.ts +26 -0
- package/dist/types/defaults/jwc-defaults.d.ts +69 -0
- package/dist/types/discovery/agents-md.d.ts +1 -0
- package/dist/types/discovery/agents.d.ts +12 -0
- package/dist/types/discovery/builtin.d.ts +1 -0
- package/dist/types/discovery/claude-plugins.d.ts +1 -0
- package/dist/types/discovery/claude.d.ts +1 -0
- package/dist/types/discovery/cli-jaw.d.ts +1 -0
- package/dist/types/discovery/cline.d.ts +1 -0
- package/dist/types/discovery/codex.d.ts +1 -0
- package/dist/types/discovery/cursor.d.ts +16 -0
- package/dist/types/discovery/gemini.d.ts +1 -0
- package/dist/types/discovery/github.d.ts +1 -0
- package/dist/types/discovery/helpers.d.ts +278 -0
- package/dist/types/discovery/index.d.ts +49 -0
- package/dist/types/discovery/mcp-json.d.ts +1 -0
- package/dist/types/discovery/opencode.d.ts +1 -0
- package/dist/types/discovery/plugin-dir-roots.d.ts +15 -0
- package/dist/types/discovery/ssh.d.ts +1 -0
- package/dist/types/discovery/substitute-plugin-root.d.ts +5 -0
- package/dist/types/discovery/vscode.d.ts +1 -0
- package/dist/types/discovery/windsurf.d.ts +13 -0
- package/dist/types/edit/apply-patch/index.d.ts +35 -0
- package/dist/types/edit/apply-patch/parser.d.ts +34 -0
- package/dist/types/edit/diff.d.ts +75 -0
- package/dist/types/edit/file-read-cache.d.ts +25 -0
- package/dist/types/edit/index.d.ts +58 -0
- package/dist/types/edit/modes/apply-patch.d.ts +24 -0
- package/dist/types/edit/modes/patch.d.ts +99 -0
- package/dist/types/edit/modes/replace.d.ts +149 -0
- package/dist/types/edit/normalize.d.ts +43 -0
- package/dist/types/edit/notebook.d.ts +23 -0
- package/dist/types/edit/read-file.d.ts +2 -0
- package/dist/types/edit/renderer.d.ts +110 -0
- package/dist/types/edit/streaming.d.ts +66 -0
- package/dist/types/eval/backend.d.ts +40 -0
- package/dist/types/eval/index.d.ts +4 -0
- package/dist/types/eval/js/context-manager.d.ts +24 -0
- package/dist/types/eval/js/executor.d.ts +28 -0
- package/dist/types/eval/js/index.d.ts +10 -0
- package/dist/types/eval/js/shared/helpers.d.ts +38 -0
- package/dist/types/eval/js/shared/indirect-eval.d.ts +14 -0
- package/dist/types/eval/js/shared/prelude.d.ts +1 -0
- package/dist/types/eval/js/shared/rewrite-imports.d.ts +6 -0
- package/dist/types/eval/js/shared/runtime.d.ts +47 -0
- package/dist/types/eval/js/shared/types.d.ts +24 -0
- package/dist/types/eval/js/tool-bridge.d.ts +18 -0
- package/dist/types/eval/js/worker-core.d.ts +5 -0
- package/dist/types/eval/js/worker-entry.d.ts +1 -0
- package/dist/types/eval/js/worker-protocol.d.ts +77 -0
- package/dist/types/eval/py/display.d.ts +25 -0
- package/dist/types/eval/py/executor.d.ts +85 -0
- package/dist/types/eval/py/index.d.ts +10 -0
- package/dist/types/eval/py/kernel.d.ts +63 -0
- package/dist/types/eval/py/prelude.d.ts +1 -0
- package/dist/types/eval/py/runtime.d.ts +21 -0
- package/dist/types/eval/py/tool-bridge.d.ts +20 -0
- package/dist/types/eval/types.d.ts +52 -0
- package/dist/types/exa/factory.d.ts +13 -0
- package/dist/types/exa/index.d.ts +20 -0
- package/dist/types/exa/mcp-client.d.ts +45 -0
- package/dist/types/exa/render.d.ts +19 -0
- package/dist/types/exa/researcher.d.ts +9 -0
- package/dist/types/exa/search.d.ts +9 -0
- package/dist/types/exa/types.d.ts +155 -0
- package/dist/types/exa/websets.d.ts +9 -0
- package/dist/types/exec/bash-executor.d.ts +58 -0
- package/dist/types/exec/exec.d.ts +25 -0
- package/dist/types/exec/idle-timeout-watchdog.d.ts +18 -0
- package/dist/types/exec/non-interactive-env.d.ts +4 -0
- package/dist/types/export/custom-share.d.ts +20 -0
- package/dist/types/export/html/index.d.ts +10 -0
- package/dist/types/export/html/template.generated.d.ts +1 -0
- package/dist/types/export/html/template.macro.d.ts +5 -0
- package/dist/types/export/ttsr.d.ts +44 -0
- package/dist/types/extensibility/custom-commands/bundled/ci-green/index.d.ts +9 -0
- package/dist/types/extensibility/custom-commands/bundled/review/index.d.ts +10 -0
- package/dist/types/extensibility/custom-commands/index.d.ts +2 -0
- package/dist/types/extensibility/custom-commands/loader.d.ts +29 -0
- package/dist/types/extensibility/custom-commands/types.d.ts +106 -0
- package/dist/types/extensibility/custom-tools/index.d.ts +6 -0
- package/dist/types/extensibility/custom-tools/loader.d.ts +69 -0
- package/dist/types/extensibility/custom-tools/types.d.ts +227 -0
- package/dist/types/extensibility/custom-tools/wrapper.d.ts +23 -0
- package/dist/types/extensibility/extensions/compact-handler.d.ts +26 -0
- package/dist/types/extensibility/extensions/get-commands-handler.d.ts +29 -0
- package/dist/types/extensibility/extensions/index.d.ts +8 -0
- package/dist/types/extensibility/extensions/loader.d.ts +43 -0
- package/dist/types/extensibility/extensions/runner.d.ts +134 -0
- package/dist/types/extensibility/extensions/types.d.ts +916 -0
- package/dist/types/extensibility/extensions/wrapper.d.ts +54 -0
- package/dist/types/extensibility/hooks/index.d.ts +5 -0
- package/dist/types/extensibility/hooks/loader.d.ts +89 -0
- package/dist/types/extensibility/hooks/runner.d.ts +126 -0
- package/dist/types/extensibility/hooks/tool-wrapper.d.ts +25 -0
- package/dist/types/extensibility/hooks/types.d.ts +431 -0
- package/dist/types/extensibility/jwc-plugins/activation.d.ts +14 -0
- package/dist/types/extensibility/jwc-plugins/index.d.ts +9 -0
- package/dist/types/extensibility/jwc-plugins/injection.d.ts +31 -0
- package/dist/types/extensibility/jwc-plugins/loader.d.ts +3 -0
- package/dist/types/extensibility/jwc-plugins/paths.d.ts +8 -0
- package/dist/types/extensibility/jwc-plugins/schema.d.ts +3 -0
- package/dist/types/extensibility/jwc-plugins/state.d.ts +9 -0
- package/dist/types/extensibility/jwc-plugins/tools.d.ts +8 -0
- package/dist/types/extensibility/jwc-plugins/types.d.ts +64 -0
- package/dist/types/extensibility/jwc-plugins/validation.d.ts +4 -0
- package/dist/types/extensibility/plugins/doctor.d.ts +3 -0
- package/dist/types/extensibility/plugins/git-url.d.ts +34 -0
- package/dist/types/extensibility/plugins/index.d.ts +7 -0
- package/dist/types/extensibility/plugins/installer.d.ts +5 -0
- package/dist/types/extensibility/plugins/legacy-pi-compat.d.ts +2 -0
- package/dist/types/extensibility/plugins/loader.d.ts +31 -0
- package/dist/types/extensibility/plugins/manager.d.ts +65 -0
- package/dist/types/extensibility/plugins/marketplace/cache.d.ts +41 -0
- package/dist/types/extensibility/plugins/marketplace/fetcher.d.ts +48 -0
- package/dist/types/extensibility/plugins/marketplace/index.d.ts +6 -0
- package/dist/types/extensibility/plugins/marketplace/manager.d.ts +57 -0
- package/dist/types/extensibility/plugins/marketplace/registry.d.ts +34 -0
- package/dist/types/extensibility/plugins/marketplace/source-resolver.d.ts +28 -0
- package/dist/types/extensibility/plugins/marketplace/types.d.ts +130 -0
- package/dist/types/extensibility/plugins/parser.d.ts +52 -0
- package/dist/types/extensibility/plugins/types.d.ts +149 -0
- package/dist/types/extensibility/shared-events.d.ts +280 -0
- package/dist/types/extensibility/skills.d.ts +82 -0
- package/dist/types/extensibility/slash-commands.d.ts +49 -0
- package/dist/types/extensibility/tool-proxy.d.ts +4 -0
- package/dist/types/extensibility/typebox.d.ts +155 -0
- package/dist/types/extensibility/utils.d.ts +12 -0
- package/dist/types/goals/goal-planning-start.d.ts +7 -0
- package/dist/types/goals/index.d.ts +3 -0
- package/dist/types/goals/runtime.d.ts +62 -0
- package/dist/types/goals/state.d.ts +40 -0
- package/dist/types/goals/tools/goal-tool.d.ts +62 -0
- package/dist/types/harness-control-plane/classifier.d.ts +13 -0
- package/dist/types/harness-control-plane/control-endpoint.d.ts +31 -0
- package/dist/types/harness-control-plane/finalize.d.ts +55 -0
- package/dist/types/harness-control-plane/operate.d.ts +35 -0
- package/dist/types/harness-control-plane/owner.d.ts +46 -0
- package/dist/types/harness-control-plane/phase-rollup.d.ts +23 -0
- package/dist/types/harness-control-plane/preserve.d.ts +19 -0
- package/dist/types/harness-control-plane/receipt-ingest.d.ts +19 -0
- package/dist/types/harness-control-plane/receipt-spool.d.ts +26 -0
- package/dist/types/harness-control-plane/receipts.d.ts +132 -0
- package/dist/types/harness-control-plane/rpc-adapter.d.ts +66 -0
- package/dist/types/harness-control-plane/seams.d.ts +21 -0
- package/dist/types/harness-control-plane/session-lease.d.ts +65 -0
- package/dist/types/harness-control-plane/state-machine.d.ts +24 -0
- package/dist/types/harness-control-plane/storage.d.ts +60 -0
- package/dist/types/harness-control-plane/types.d.ts +179 -0
- package/dist/types/hashline/anchors.d.ts +20 -0
- package/dist/types/hashline/apply.d.ts +14 -0
- package/dist/types/hashline/constants.d.ts +19 -0
- package/dist/types/hashline/diff-preview.d.ts +2 -0
- package/dist/types/hashline/diff.d.ts +17 -0
- package/dist/types/hashline/execute.d.ts +4 -0
- package/dist/types/hashline/hash.d.ts +123 -0
- package/dist/types/hashline/index.d.ts +13 -0
- package/dist/types/hashline/input.d.ts +11 -0
- package/dist/types/hashline/parser.d.ts +7 -0
- package/dist/types/hashline/prefixes.d.ts +7 -0
- package/dist/types/hashline/recovery.d.ts +27 -0
- package/dist/types/hashline/stream.d.ts +2 -0
- package/dist/types/hashline/types.d.ts +77 -0
- package/dist/types/hindsight/backend.d.ts +13 -0
- package/dist/types/hindsight/bank.d.ts +54 -0
- package/dist/types/hindsight/client.d.ts +224 -0
- package/dist/types/hindsight/config.d.ts +51 -0
- package/dist/types/hindsight/content.d.ts +71 -0
- package/dist/types/hindsight/index.d.ts +8 -0
- package/dist/types/hindsight/mental-models.d.ts +125 -0
- package/dist/types/hindsight/state.d.ts +99 -0
- package/dist/types/hindsight/transcript.d.ts +28 -0
- package/dist/types/hooks/codex-native-hooks-config.d.ts +29 -0
- package/dist/types/hooks/native-skill-hook.d.ts +16 -0
- package/dist/types/hooks/skill-keywords.d.ts +18 -0
- package/dist/types/hooks/skill-state.d.ts +88 -0
- package/dist/types/index.d.ts +33 -0
- package/dist/types/internal-urls/agent-protocol.d.ts +12 -0
- package/dist/types/internal-urls/artifact-protocol.d.ts +6 -0
- package/dist/types/internal-urls/docs-index.generated.d.ts +2 -0
- package/dist/types/internal-urls/index.d.ts +20 -0
- package/dist/types/internal-urls/issue-pr-protocol.d.ts +17 -0
- package/dist/types/internal-urls/json-query.d.ts +30 -0
- package/dist/types/internal-urls/jwc-protocol.d.ts +19 -0
- package/dist/types/internal-urls/local-protocol.d.ts +39 -0
- package/dist/types/internal-urls/mcp-protocol.d.ts +12 -0
- package/dist/types/internal-urls/memory-protocol.d.ts +23 -0
- package/dist/types/internal-urls/parse.d.ts +19 -0
- package/dist/types/internal-urls/registry-helpers.d.ts +11 -0
- package/dist/types/internal-urls/router.d.ts +14 -0
- package/dist/types/internal-urls/rule-protocol.d.ts +6 -0
- package/dist/types/internal-urls/skill-protocol.d.ts +13 -0
- package/dist/types/internal-urls/types.d.ts +109 -0
- package/dist/types/jaw-interview/structured-renderer.d.ts +20 -0
- package/dist/types/jwc-runtime/actor-registry.d.ts +76 -0
- package/dist/types/jwc-runtime/agent-identity.d.ts +6 -0
- package/dist/types/jwc-runtime/cli-jaw-home.d.ts +1 -0
- package/dist/types/jwc-runtime/cli-jaw-vocab.d.ts +15 -0
- package/dist/types/jwc-runtime/cli-write-receipt.d.ts +24 -0
- package/dist/types/jwc-runtime/goal-cli.d.ts +7 -0
- package/dist/types/jwc-runtime/goal-engine.d.ts +193 -0
- package/dist/types/jwc-runtime/goal-guard.d.ts +26 -0
- package/dist/types/jwc-runtime/goal-mode-request.d.ts +78 -0
- package/dist/types/jwc-runtime/jaw-interview-runtime.d.ts +41 -0
- package/dist/types/jwc-runtime/launch-tmux.d.ts +70 -0
- package/dist/types/jwc-runtime/launch-worktree.d.ts +46 -0
- package/dist/types/jwc-runtime/legacy-storage.d.ts +19 -0
- package/dist/types/jwc-runtime/memory-runtime.d.ts +16 -0
- package/dist/types/jwc-runtime/orchestrate-runtime.d.ts +12 -0
- package/dist/types/jwc-runtime/orchestrate-state.d.ts +246 -0
- package/dist/types/jwc-runtime/plan-writer.d.ts +26 -0
- package/dist/types/jwc-runtime/restricted-role-agent-bash.d.ts +2 -0
- package/dist/types/jwc-runtime/session-state-sidecar.d.ts +17 -0
- package/dist/types/jwc-runtime/stage-skill-map.d.ts +7 -0
- package/dist/types/jwc-runtime/state-graph.d.ts +4 -0
- package/dist/types/jwc-runtime/state-migrations.d.ts +34 -0
- package/dist/types/jwc-runtime/state-renderer.d.ts +65 -0
- package/dist/types/jwc-runtime/state-runtime.d.ts +37 -0
- package/dist/types/jwc-runtime/state-schema.d.ts +324 -0
- package/dist/types/jwc-runtime/state-validation.d.ts +6 -0
- package/dist/types/jwc-runtime/state-writer.d.ts +147 -0
- package/dist/types/jwc-runtime/team-runtime.d.ts +349 -0
- package/dist/types/jwc-runtime/tmux-common.d.ts +49 -0
- package/dist/types/jwc-runtime/tmux-sessions.d.ts +17 -0
- package/dist/types/jwc-runtime/workflow-command-ref.d.ts +43 -0
- package/dist/types/jwc-runtime/workflow-manifest.d.ts +54 -0
- package/dist/types/lsp/client.d.ts +66 -0
- package/dist/types/lsp/clients/biome-client.d.ts +16 -0
- package/dist/types/lsp/clients/index.d.ts +19 -0
- package/dist/types/lsp/clients/lsp-linter-client.d.ts +16 -0
- package/dist/types/lsp/clients/swiftlint-client.d.ts +20 -0
- package/dist/types/lsp/config.d.ts +65 -0
- package/dist/types/lsp/edits.d.ts +23 -0
- package/dist/types/lsp/index.d.ts +130 -0
- package/dist/types/lsp/lspmux.d.ts +58 -0
- package/dist/types/lsp/render.d.ts +32 -0
- package/dist/types/lsp/startup-events.d.ts +11 -0
- package/dist/types/lsp/types.d.ts +302 -0
- package/dist/types/lsp/utils.d.ts +108 -0
- package/dist/types/main.d.ts +72 -0
- package/dist/types/mem0/backend.d.ts +2 -0
- package/dist/types/mem0/client.d.ts +49 -0
- package/dist/types/mem0/config.d.ts +24 -0
- package/dist/types/mem0/index.d.ts +5 -0
- package/dist/types/mem0/scope.d.ts +12 -0
- package/dist/types/mem0/state.d.ts +36 -0
- package/dist/types/memories/index.d.ts +28 -0
- package/dist/types/memories/local-query.d.ts +112 -0
- package/dist/types/memories/memory-config.d.ts +46 -0
- package/dist/types/memories/memory-fts.d.ts +51 -0
- package/dist/types/memories/memory-model-resolution.d.ts +20 -0
- package/dist/types/memories/memory-quality.d.ts +27 -0
- package/dist/types/memories/storage.d.ts +110 -0
- package/dist/types/memory-backend/index.d.ts +4 -0
- package/dist/types/memory-backend/local-backend.d.ts +9 -0
- package/dist/types/memory-backend/off-backend.d.ts +7 -0
- package/dist/types/memory-backend/resolve.d.ts +16 -0
- package/dist/types/memory-backend/types.d.ts +64 -0
- package/dist/types/migrate-config-dir-startup.d.ts +1 -0
- package/dist/types/migrate-config-dir.d.ts +22 -0
- package/dist/types/modes/acp/acp-agent.d.ts +61 -0
- package/dist/types/modes/acp/acp-client-bridge.d.ts +9 -0
- package/dist/types/modes/acp/acp-event-mapper.d.ts +34 -0
- package/dist/types/modes/acp/acp-mode.d.ts +5 -0
- package/dist/types/modes/acp/index.d.ts +2 -0
- package/dist/types/modes/acp/terminal-auth.d.ts +6 -0
- package/dist/types/modes/background-row-model.d.ts +3 -0
- package/dist/types/modes/bridge/auth.d.ts +12 -0
- package/dist/types/modes/bridge/bridge-client-bridge.d.ts +9 -0
- package/dist/types/modes/bridge/bridge-mode.d.ts +46 -0
- package/dist/types/modes/bridge/bridge-ui-context.d.ts +88 -0
- package/dist/types/modes/bridge/event-stream.d.ts +8 -0
- package/dist/types/modes/components/_cli-jaw-entry.d.ts +31 -0
- package/dist/types/modes/components/agent-dashboard.d.ts +21 -0
- package/dist/types/modes/components/assistant-message.d.ts +33 -0
- package/dist/types/modes/components/background-footer-detail.d.ts +6 -0
- package/dist/types/modes/components/background-footer-panel-model.d.ts +18 -0
- package/dist/types/modes/components/background-footer-panel.d.ts +19 -0
- package/dist/types/modes/components/bash-execution.d.ts +37 -0
- package/dist/types/modes/components/bordered-loader.d.ts +11 -0
- package/dist/types/modes/components/branch-summary-message.d.ts +15 -0
- package/dist/types/modes/components/btw-panel.d.ts +16 -0
- package/dist/types/modes/components/compaction-summary-message.d.ts +15 -0
- package/dist/types/modes/components/composer-chrome.d.ts +7 -0
- package/dist/types/modes/components/composer-footer.d.ts +43 -0
- package/dist/types/modes/components/countdown-timer.d.ts +14 -0
- package/dist/types/modes/components/custom-editor.d.ts +80 -0
- package/dist/types/modes/components/custom-message.d.ts +17 -0
- package/dist/types/modes/components/custom-provider-wizard.d.ts +10 -0
- package/dist/types/modes/components/diff.d.ts +11 -0
- package/dist/types/modes/components/dynamic-border.d.ts +14 -0
- package/dist/types/modes/components/eval-execution.d.ts +31 -0
- package/dist/types/modes/components/execution-shared.d.ts +46 -0
- package/dist/types/modes/components/extensions/extension-dashboard.d.ts +26 -0
- package/dist/types/modes/components/extensions/extension-list.d.ts +39 -0
- package/dist/types/modes/components/extensions/index.d.ts +8 -0
- package/dist/types/modes/components/extensions/inspector-panel.d.ts +8 -0
- package/dist/types/modes/components/extensions/state-manager.d.ts +50 -0
- package/dist/types/modes/components/extensions/types.d.ts +151 -0
- package/dist/types/modes/components/footer.d.ts +30 -0
- package/dist/types/modes/components/full-transcript-overlay.d.ts +21 -0
- package/dist/types/modes/components/help-selector.d.ts +38 -0
- package/dist/types/modes/components/history-search.d.ts +7 -0
- package/dist/types/modes/components/hook-editor.d.ts +18 -0
- package/dist/types/modes/components/hook-input.d.ts +15 -0
- package/dist/types/modes/components/hook-message.d.ts +15 -0
- package/dist/types/modes/components/hook-selector.d.ts +64 -0
- package/dist/types/modes/components/index.d.ts +35 -0
- package/dist/types/modes/components/jobs-overlay-model.d.ts +31 -0
- package/dist/types/modes/components/jobs-overlay.d.ts +30 -0
- package/dist/types/modes/components/keybinding-hints.d.ts +40 -0
- package/dist/types/modes/components/login-dialog.d.ts +32 -0
- package/dist/types/modes/components/message-frame.d.ts +42 -0
- package/dist/types/modes/components/model-selector.d.ts +53 -0
- package/dist/types/modes/components/oauth-selector.d.ts +14 -0
- package/dist/types/modes/components/pabcd-border.d.ts +8 -0
- package/dist/types/modes/components/plugin-selector.d.ts +26 -0
- package/dist/types/modes/components/plugin-settings.d.ts +66 -0
- package/dist/types/modes/components/provider-onboarding-selector.d.ts +7 -0
- package/dist/types/modes/components/queue-mode-selector.d.ts +9 -0
- package/dist/types/modes/components/quota-panel.d.ts +21 -0
- package/dist/types/modes/components/read-tool-group.d.ts +34 -0
- package/dist/types/modes/components/runtime-mcp-add-wizard.d.ts +25 -0
- package/dist/types/modes/components/session-observer-overlay.d.ts +11 -0
- package/dist/types/modes/components/session-selector.d.ts +30 -0
- package/dist/types/modes/components/settings-defs.d.ts +50 -0
- package/dist/types/modes/components/settings-selector.d.ts +56 -0
- package/dist/types/modes/components/show-images-selector.d.ts +9 -0
- package/dist/types/modes/components/skill-hud/render.d.ts +2 -0
- package/dist/types/modes/components/skill-message.d.ts +11 -0
- package/dist/types/modes/components/status-line/context-thresholds.d.ts +4 -0
- package/dist/types/modes/components/status-line/git-utils.d.ts +22 -0
- package/dist/types/modes/components/status-line/index.d.ts +4 -0
- package/dist/types/modes/components/status-line/presets.d.ts +3 -0
- package/dist/types/modes/components/status-line/segments.d.ts +5 -0
- package/dist/types/modes/components/status-line/separators.d.ts +3 -0
- package/dist/types/modes/components/status-line/token-rate.d.ts +10 -0
- package/dist/types/modes/components/status-line/types.d.ts +92 -0
- package/dist/types/modes/components/status-line/workflow-readers.d.ts +21 -0
- package/dist/types/modes/components/status-line.d.ts +82 -0
- package/dist/types/modes/components/theme-selector.d.ts +10 -0
- package/dist/types/modes/components/thinking-selector.d.ts +10 -0
- package/dist/types/modes/components/todo-reminder.d.ts +13 -0
- package/dist/types/modes/components/tool-execution.d.ts +69 -0
- package/dist/types/modes/components/tool-transcript-overlay.d.ts +18 -0
- package/dist/types/modes/components/tree-selector.d.ts +31 -0
- package/dist/types/modes/components/ttsr-notification.d.ts +15 -0
- package/dist/types/modes/components/user-message-selector.d.ts +28 -0
- package/dist/types/modes/components/user-message.d.ts +8 -0
- package/dist/types/modes/components/visual-truncate.d.ts +19 -0
- package/dist/types/modes/components/welcome.d.ts +42 -0
- package/dist/types/modes/controllers/btw-controller.d.ts +10 -0
- package/dist/types/modes/controllers/command-controller-shared.d.ts +47 -0
- package/dist/types/modes/controllers/command-controller.d.ts +39 -0
- package/dist/types/modes/controllers/event-controller.d.ts +12 -0
- package/dist/types/modes/controllers/extension-ui-controller.d.ts +80 -0
- package/dist/types/modes/controllers/input-controller.d.ts +49 -0
- package/dist/types/modes/controllers/runtime-mcp-command-controller.d.ts +10 -0
- package/dist/types/modes/controllers/selector-controller.d.ts +78 -0
- package/dist/types/modes/controllers/ssh-command-controller.d.ts +10 -0
- package/dist/types/modes/controllers/todo-command-controller.d.ts +7 -0
- package/dist/types/modes/emoji-autocomplete.d.ts +16 -0
- package/dist/types/modes/index.d.ts +10 -0
- package/dist/types/modes/interactive-mode.d.ts +295 -0
- package/dist/types/modes/jobs-observer.d.ts +67 -0
- package/dist/types/modes/oauth-manual-input.d.ts +8 -0
- package/dist/types/modes/print-mode.d.ts +27 -0
- package/dist/types/modes/prompt-action-autocomplete.d.ts +46 -0
- package/dist/types/modes/rpc/host-tools.d.ts +1 -0
- package/dist/types/modes/rpc/host-uris.d.ts +1 -0
- package/dist/types/modes/rpc/rpc-client.d.ts +267 -0
- package/dist/types/modes/rpc/rpc-mode.d.ts +67 -0
- package/dist/types/modes/rpc/rpc-types.d.ts +765 -0
- package/dist/types/modes/runtime-init.d.ts +21 -0
- package/dist/types/modes/session-observer-registry.d.ts +26 -0
- package/dist/types/modes/shared/agent-wire/approval-gate.d.ts +57 -0
- package/dist/types/modes/shared/agent-wire/command-contract.d.ts +18 -0
- package/dist/types/modes/shared/agent-wire/command-dispatch.d.ts +35 -0
- package/dist/types/modes/shared/agent-wire/command-validation.d.ts +2 -0
- package/dist/types/modes/shared/agent-wire/event-contract.d.ts +84 -0
- package/dist/types/modes/shared/agent-wire/event-envelope.d.ts +38 -0
- package/dist/types/modes/shared/agent-wire/event-observation.d.ts +37 -0
- package/dist/types/modes/shared/agent-wire/handshake.d.ts +56 -0
- package/dist/types/modes/shared/agent-wire/host-tool-bridge.d.ts +16 -0
- package/dist/types/modes/shared/agent-wire/host-uri-bridge.d.ts +17 -0
- package/dist/types/modes/shared/agent-wire/jaw-interview-gate.d.ts +58 -0
- package/dist/types/modes/shared/agent-wire/protocol.d.ts +25 -0
- package/dist/types/modes/shared/agent-wire/responses.d.ts +4 -0
- package/dist/types/modes/shared/agent-wire/scopes.d.ts +18 -0
- package/dist/types/modes/shared/agent-wire/session-registry.d.ts +25 -0
- package/dist/types/modes/shared/agent-wire/ui-request-broker.d.ts +42 -0
- package/dist/types/modes/shared/agent-wire/ui-result.d.ts +27 -0
- package/dist/types/modes/shared/agent-wire/unattended-action-policy.d.ts +27 -0
- package/dist/types/modes/shared/agent-wire/unattended-audit.d.ts +68 -0
- package/dist/types/modes/shared/agent-wire/unattended-run-controller.d.ts +161 -0
- package/dist/types/modes/shared/agent-wire/unattended-session.d.ts +61 -0
- package/dist/types/modes/shared/agent-wire/workflow-gate-broker.d.ts +114 -0
- package/dist/types/modes/shared/agent-wire/workflow-gate-schema.d.ts +39 -0
- package/dist/types/modes/shared.d.ts +15 -0
- package/dist/types/modes/theme/defaults/index.d.ts +499 -0
- package/dist/types/modes/theme/mermaid-cache.d.ts +9 -0
- package/dist/types/modes/theme/shimmer.d.ts +38 -0
- package/dist/types/modes/theme/theme.d.ts +274 -0
- package/dist/types/modes/types.d.ts +311 -0
- package/dist/types/modes/utils/abort-message.d.ts +4 -0
- package/dist/types/modes/utils/compaction-progress.d.ts +20 -0
- package/dist/types/modes/utils/context-usage.d.ts +53 -0
- package/dist/types/modes/utils/help-markdown.d.ts +17 -0
- package/dist/types/modes/utils/hotkeys-markdown.d.ts +5 -0
- package/dist/types/modes/utils/keybinding-matchers.d.ts +10 -0
- package/dist/types/modes/utils/session-transcript-replay.d.ts +24 -0
- package/dist/types/modes/utils/tools-markdown.d.ts +5 -0
- package/dist/types/modes/utils/ui-helpers.d.ts +77 -0
- package/dist/types/notifications/ask-bridge.d.ts +36 -0
- package/dist/types/notifications/config-command-parser.d.ts +27 -0
- package/dist/types/notifications/config.d.ts +37 -0
- package/dist/types/notifications/daemon-control.d.ts +29 -0
- package/dist/types/notifications/daemon-engine.d.ts +64 -0
- package/dist/types/notifications/daemon-inbound.d.ts +93 -0
- package/dist/types/notifications/daemon-loop.d.ts +28 -0
- package/dist/types/notifications/daemon-owner.d.ts +25 -0
- package/dist/types/notifications/daemon-runtime.d.ts +32 -0
- package/dist/types/notifications/discovery.d.ts +45 -0
- package/dist/types/notifications/index.d.ts +34 -0
- package/dist/types/notifications/lifecycle-audit.d.ts +60 -0
- package/dist/types/notifications/lifecycle-command-parser.d.ts +19 -0
- package/dist/types/notifications/lifecycle-control-runtime.d.ts +45 -0
- package/dist/types/notifications/notification-redaction.d.ts +36 -0
- package/dist/types/notifications/protocol.d.ts +43 -0
- package/dist/types/notifications/remote-answer.d.ts +78 -0
- package/dist/types/notifications/reply-bridge.d.ts +21 -0
- package/dist/types/notifications/server.d.ts +38 -0
- package/dist/types/notifications/session-lifecycle.d.ts +22 -0
- package/dist/types/notifications/session-registry.d.ts +31 -0
- package/dist/types/notifications/telegram-api.d.ts +93 -0
- package/dist/types/notifications/telegram-ask-keyboard.d.ts +57 -0
- package/dist/types/notifications/telegram-callback-ingest.d.ts +49 -0
- package/dist/types/notifications/telegram-inbound-router.d.ts +57 -0
- package/dist/types/notifications/telegram-media-policy.d.ts +27 -0
- package/dist/types/notifications/telegram-media-render.d.ts +29 -0
- package/dist/types/notifications/telegram-message-ingest.d.ts +54 -0
- package/dist/types/notifications/telegram-pairing.d.ts +21 -0
- package/dist/types/notifications/threaded-lifecycle.d.ts +23 -0
- package/dist/types/notifications/threaded-shutdown.d.ts +19 -0
- package/dist/types/notifications/threaded-surface.d.ts +71 -0
- package/dist/types/notifications/transport-shell.d.ts +47 -0
- package/dist/types/notifications/transport-state.d.ts +44 -0
- package/dist/types/notifications/workspace-path-confinement.d.ts +12 -0
- package/dist/types/plan-mode/approved-plan.d.ts +49 -0
- package/dist/types/plan-mode/state.d.ts +6 -0
- package/dist/types/registry/agent-registry.d.ts +62 -0
- package/dist/types/reminders/star-reminder.d.ts +115 -0
- package/dist/types/runtime-mcp/client.d.ts +74 -0
- package/dist/types/runtime-mcp/config-writer.d.ts +53 -0
- package/dist/types/runtime-mcp/config.d.ts +75 -0
- package/dist/types/runtime-mcp/discoverable-tool-metadata.d.ts +7 -0
- package/dist/types/runtime-mcp/index.d.ts +18 -0
- package/dist/types/runtime-mcp/json-rpc.d.ts +22 -0
- package/dist/types/runtime-mcp/loader.d.ts +43 -0
- package/dist/types/runtime-mcp/manager.d.ts +193 -0
- package/dist/types/runtime-mcp/oauth-discovery.d.ts +40 -0
- package/dist/types/runtime-mcp/oauth-flow.d.ts +59 -0
- package/dist/types/runtime-mcp/render.d.ts +25 -0
- package/dist/types/runtime-mcp/smithery-auth.d.ts +16 -0
- package/dist/types/runtime-mcp/smithery-connect.d.ts +38 -0
- package/dist/types/runtime-mcp/smithery-registry.d.ts +51 -0
- package/dist/types/runtime-mcp/tool-bridge.d.ts +86 -0
- package/dist/types/runtime-mcp/tool-cache.d.ts +8 -0
- package/dist/types/runtime-mcp/transports/http.d.ts +36 -0
- package/dist/types/runtime-mcp/transports/index.d.ts +5 -0
- package/dist/types/runtime-mcp/transports/stdio.d.ts +28 -0
- package/dist/types/runtime-mcp/types.d.ts +333 -0
- package/dist/types/sdk.d.ts +234 -0
- package/dist/types/secrets/index.d.ts +10 -0
- package/dist/types/secrets/obfuscator.d.ts +23 -0
- package/dist/types/secrets/regex.d.ts +2 -0
- package/dist/types/session/agent-session.d.ts +1052 -0
- package/dist/types/session/agent-storage.d.ts +100 -0
- package/dist/types/session/artifacts.d.ts +61 -0
- package/dist/types/session/auth-broker-config.d.ts +13 -0
- package/dist/types/session/auth-storage.d.ts +6 -0
- package/dist/types/session/blob-store.d.ts +112 -0
- package/dist/types/session/client-bridge.d.ts +88 -0
- package/dist/types/session/contribution-prep.d.ts +47 -0
- package/dist/types/session/history-storage.d.ts +16 -0
- package/dist/types/session/messages.d.ts +165 -0
- package/dist/types/session/pabcd-stage-header.d.ts +18 -0
- package/dist/types/session/session-dump-format.d.ts +22 -0
- package/dist/types/session/session-manager.d.ts +571 -0
- package/dist/types/session/session-storage.d.ts +88 -0
- package/dist/types/session/streaming-output.d.ts +196 -0
- package/dist/types/session/tool-choice-queue.d.ts +78 -0
- package/dist/types/session/yield-queue.d.ts +24 -0
- package/dist/types/setup/hermes-setup.d.ts +71 -0
- package/dist/types/setup/model-onboarding-guidance.d.ts +9 -0
- package/dist/types/setup/provider-onboarding.d.ts +52 -0
- package/dist/types/skill-state/active-state.d.ts +115 -0
- package/dist/types/skill-state/initial-phase.d.ts +12 -0
- package/dist/types/skill-state/jaw-interview-mutation-guard.d.ts +33 -0
- package/dist/types/skill-state/workflow-hud.d.ts +76 -0
- package/dist/types/skill-state/workflow-state-contract.d.ts +60 -0
- package/dist/types/skill-state/workflow-state-version.d.ts +3 -0
- package/dist/types/slash-commands/acp-builtins.d.ts +18 -0
- package/dist/types/slash-commands/builtin-registry.d.ts +24 -0
- package/dist/types/slash-commands/helpers/context-report.d.ts +7 -0
- package/dist/types/slash-commands/helpers/format.d.ts +10 -0
- package/dist/types/slash-commands/helpers/mcp.d.ts +3 -0
- package/dist/types/slash-commands/helpers/parse.d.ts +33 -0
- package/dist/types/slash-commands/helpers/ssh.d.ts +3 -0
- package/dist/types/slash-commands/helpers/todo.d.ts +3 -0
- package/dist/types/slash-commands/helpers/usage-report.d.ts +11 -0
- package/dist/types/slash-commands/types.d.ts +120 -0
- package/dist/types/ssh/config-writer.d.ts +49 -0
- package/dist/types/ssh/connection-manager.d.ts +33 -0
- package/dist/types/ssh/ssh-executor.d.ts +37 -0
- package/dist/types/ssh/sshfs-mount.d.ts +6 -0
- package/dist/types/ssh/utils.d.ts +2 -0
- package/dist/types/stt/downloader.d.ts +9 -0
- package/dist/types/stt/index.d.ts +3 -0
- package/dist/types/stt/recorder.d.ts +13 -0
- package/dist/types/stt/setup.d.ts +18 -0
- package/dist/types/stt/stt-controller.d.ts +16 -0
- package/dist/types/stt/transcriber.d.ts +16 -0
- package/dist/types/system-prompt.d.ts +100 -0
- package/dist/types/task/agents.d.ts +28 -0
- package/dist/types/task/commands.d.ts +35 -0
- package/dist/types/task/discovery.d.ts +19 -0
- package/dist/types/task/executor.d.ts +113 -0
- package/dist/types/task/fork-context-advisory.d.ts +13 -0
- package/dist/types/task/id.d.ts +7 -0
- package/dist/types/task/index.d.ts +43 -0
- package/dist/types/task/jwc-command.d.ts +7 -0
- package/dist/types/task/model-presets.d.ts +17 -0
- package/dist/types/task/name-generator.d.ts +16 -0
- package/dist/types/task/output-manager.d.ts +36 -0
- package/dist/types/task/parallel.d.ts +34 -0
- package/dist/types/task/receipt.d.ts +86 -0
- package/dist/types/task/render.d.ts +28 -0
- package/dist/types/task/roi-reconciliation.d.ts +27 -0
- package/dist/types/task/simple-mode.d.ts +8 -0
- package/dist/types/task/spawn-gate.d.ts +38 -0
- package/dist/types/task/subprocess-tool-registry.d.ts +72 -0
- package/dist/types/task/types.d.ts +506 -0
- package/dist/types/task/worktree.d.ts +94 -0
- package/dist/types/thinking.d.ts +31 -0
- package/dist/types/tool-discovery/tool-index.d.ts +113 -0
- package/dist/types/tools/archive-reader.d.ts +40 -0
- package/dist/types/tools/ask.d.ts +152 -0
- package/dist/types/tools/ast-edit.d.ts +77 -0
- package/dist/types/tools/ast-grep.d.ts +69 -0
- package/dist/types/tools/auto-generated-guard.d.ts +17 -0
- package/dist/types/tools/background.d.ts +124 -0
- package/dist/types/tools/bash-allowed-prefixes.d.ts +5 -0
- package/dist/types/tools/bash-command-fixup.d.ts +11 -0
- package/dist/types/tools/bash-interactive.d.ts +16 -0
- package/dist/types/tools/bash-interceptor.d.ts +24 -0
- package/dist/types/tools/bash-pty-selection.d.ts +7 -0
- package/dist/types/tools/bash-skill-urls.d.ts +31 -0
- package/dist/types/tools/bash.d.ts +156 -0
- package/dist/types/tools/browser/actions.d.ts +54 -0
- package/dist/types/tools/browser/attach.d.ts +34 -0
- package/dist/types/tools/browser/launch.d.ts +62 -0
- package/dist/types/tools/browser/readable.d.ts +17 -0
- package/dist/types/tools/browser/registry.d.ts +42 -0
- package/dist/types/tools/browser/render.d.ts +50 -0
- package/dist/types/tools/browser/tab-protocol.d.ts +144 -0
- package/dist/types/tools/browser/tab-supervisor.d.ts +63 -0
- package/dist/types/tools/browser/tab-worker-entry.d.ts +1 -0
- package/dist/types/tools/browser/tab-worker.d.ts +19 -0
- package/dist/types/tools/browser.d.ts +194 -0
- package/dist/types/tools/calculator.d.ts +76 -0
- package/dist/types/tools/checkpoint.d.ts +63 -0
- package/dist/types/tools/computer-use-backend.d.ts +6 -0
- package/dist/types/tools/computer-use.d.ts +100 -0
- package/dist/types/tools/conflict-detect.d.ts +205 -0
- package/dist/types/tools/context.d.ts +19 -0
- package/dist/types/tools/cron.d.ts +116 -0
- package/dist/types/tools/debug.d.ts +209 -0
- package/dist/types/tools/eval.d.ts +108 -0
- package/dist/types/tools/fetch.d.ts +61 -0
- package/dist/types/tools/file-recorder.d.ts +13 -0
- package/dist/types/tools/find.d.ts +95 -0
- package/dist/types/tools/fs-cache-invalidation.d.ts +15 -0
- package/dist/types/tools/gh-format.d.ts +6 -0
- package/dist/types/tools/gh-renderer.d.ts +25 -0
- package/dist/types/tools/gh.d.ts +356 -0
- package/dist/types/tools/github-cache.d.ts +103 -0
- package/dist/types/tools/grouped-file-output.d.ts +36 -0
- package/dist/types/tools/hindsight-recall.d.ts +21 -0
- package/dist/types/tools/hindsight-reflect.d.ts +23 -0
- package/dist/types/tools/hindsight-retain.d.ts +27 -0
- package/dist/types/tools/image-gen.d.ts +79 -0
- package/dist/types/tools/index.d.ts +281 -0
- package/dist/types/tools/inspect-image-renderer.d.ts +26 -0
- package/dist/types/tools/inspect-image.d.ts +31 -0
- package/dist/types/tools/irc.d.ts +79 -0
- package/dist/types/tools/job.d.ts +65 -0
- package/dist/types/tools/json-tree.d.ts +23 -0
- package/dist/types/tools/jtd-to-json-schema.d.ts +29 -0
- package/dist/types/tools/jtd-to-typescript.d.ts +26 -0
- package/dist/types/tools/jtd-utils.d.ts +42 -0
- package/dist/types/tools/list-limit.d.ts +12 -0
- package/dist/types/tools/match-line-format.d.ts +11 -0
- package/dist/types/tools/monitor.d.ts +65 -0
- package/dist/types/tools/output-meta.d.ts +204 -0
- package/dist/types/tools/path-utils.d.ts +147 -0
- package/dist/types/tools/plan-mode-guard.d.ts +18 -0
- package/dist/types/tools/read.d.ts +85 -0
- package/dist/types/tools/recipe/index.d.ts +45 -0
- package/dist/types/tools/recipe/render.d.ts +36 -0
- package/dist/types/tools/recipe/runner.d.ts +60 -0
- package/dist/types/tools/recipe/runners/cargo.d.ts +16 -0
- package/dist/types/tools/recipe/runners/index.d.ts +2 -0
- package/dist/types/tools/recipe/runners/just.d.ts +2 -0
- package/dist/types/tools/recipe/runners/make.d.ts +2 -0
- package/dist/types/tools/recipe/runners/pkg.d.ts +2 -0
- package/dist/types/tools/recipe/runners/task.d.ts +2 -0
- package/dist/types/tools/render-mermaid.d.ts +37 -0
- package/dist/types/tools/render-utils.d.ts +158 -0
- package/dist/types/tools/renderers.d.ts +26 -0
- package/dist/types/tools/resolve.d.ts +90 -0
- package/dist/types/tools/review.d.ts +63 -0
- package/dist/types/tools/search-tool-bm25.d.ts +65 -0
- package/dist/types/tools/search.d.ts +93 -0
- package/dist/types/tools/skill.d.ts +47 -0
- package/dist/types/tools/sqlite-reader.d.ts +93 -0
- package/dist/types/tools/ssh.d.ts +67 -0
- package/dist/types/tools/subagent-render.d.ts +25 -0
- package/dist/types/tools/subagent.d.ts +87 -0
- package/dist/types/tools/telegram-send.d.ts +53 -0
- package/dist/types/tools/todo-write.d.ts +120 -0
- package/dist/types/tools/tool-errors.d.ts +33 -0
- package/dist/types/tools/tool-result.d.ts +30 -0
- package/dist/types/tools/tool-timeouts.d.ts +51 -0
- package/dist/types/tools/vim.d.ts +58 -0
- package/dist/types/tools/write.d.ts +59 -0
- package/dist/types/tools/yield.d.ts +25 -0
- package/dist/types/tui/code-cell.d.ts +32 -0
- package/dist/types/tui/file-list.d.ts +22 -0
- package/dist/types/tui/hyperlink.d.ts +42 -0
- package/dist/types/tui/index.d.ts +11 -0
- package/dist/types/tui/output-block.d.ts +28 -0
- package/dist/types/tui/status-line.d.ts +18 -0
- package/dist/types/tui/tree-list.d.ts +19 -0
- package/dist/types/tui/types.d.ts +13 -0
- package/dist/types/tui/utils.d.ts +36 -0
- package/dist/types/utils/changelog.d.ts +36 -0
- package/dist/types/utils/clipboard.d.ts +22 -0
- package/dist/types/utils/command-args.d.ts +9 -0
- package/dist/types/utils/commit-message-generator.d.ts +7 -0
- package/dist/types/utils/edit-mode.d.ts +13 -0
- package/dist/types/utils/event-bus.d.ts +6 -0
- package/dist/types/utils/external-editor.d.ts +17 -0
- package/dist/types/utils/file-display-mode.d.ts +27 -0
- package/dist/types/utils/file-mentions.d.ts +11 -0
- package/dist/types/utils/git.d.ts +361 -0
- package/dist/types/utils/image-loading.d.ts +26 -0
- package/dist/types/utils/image-resize.d.ts +39 -0
- package/dist/types/utils/lang-from-path.d.ts +8 -0
- package/dist/types/utils/markit.d.ts +7 -0
- package/dist/types/utils/open.d.ts +2 -0
- package/dist/types/utils/session-color.d.ts +10 -0
- package/dist/types/utils/shell-snapshot.d.ts +5 -0
- package/dist/types/utils/sixel.d.ts +21 -0
- package/dist/types/utils/title-generator.d.ts +31 -0
- package/dist/types/utils/tokenizer-download.d.ts +4 -0
- package/dist/types/utils/tokenizer-encoding.d.ts +7 -0
- package/dist/types/utils/tool-choice.d.ts +20 -0
- package/dist/types/utils/tools-manager.d.ts +9 -0
- package/dist/types/vim/buffer.d.ts +41 -0
- package/dist/types/vim/commands.d.ts +6 -0
- package/dist/types/vim/engine.d.ts +47 -0
- package/dist/types/vim/parser.d.ts +3 -0
- package/dist/types/vim/render.d.ts +25 -0
- package/dist/types/vim/types.d.ts +182 -0
- package/dist/types/web/kagi.d.ts +23 -0
- package/dist/types/web/parallel.d.ts +58 -0
- package/dist/types/web/public-fetch-url.d.ts +1 -0
- package/dist/types/web/scrapers/artifacthub.d.ts +6 -0
- package/dist/types/web/scrapers/arxiv.d.ts +5 -0
- package/dist/types/web/scrapers/aur.d.ts +5 -0
- package/dist/types/web/scrapers/biorxiv.d.ts +5 -0
- package/dist/types/web/scrapers/bluesky.d.ts +5 -0
- package/dist/types/web/scrapers/brew.d.ts +5 -0
- package/dist/types/web/scrapers/cheatsh.d.ts +8 -0
- package/dist/types/web/scrapers/chocolatey.d.ts +5 -0
- package/dist/types/web/scrapers/choosealicense.d.ts +2 -0
- package/dist/types/web/scrapers/cisa-kev.d.ts +5 -0
- package/dist/types/web/scrapers/clojars.d.ts +5 -0
- package/dist/types/web/scrapers/coingecko.d.ts +5 -0
- package/dist/types/web/scrapers/crates-io.d.ts +5 -0
- package/dist/types/web/scrapers/crossref.d.ts +2 -0
- package/dist/types/web/scrapers/devto.d.ts +5 -0
- package/dist/types/web/scrapers/discogs.d.ts +8 -0
- package/dist/types/web/scrapers/discourse.d.ts +5 -0
- package/dist/types/web/scrapers/dockerhub.d.ts +5 -0
- package/dist/types/web/scrapers/docs-rs.d.ts +2 -0
- package/dist/types/web/scrapers/fdroid.d.ts +5 -0
- package/dist/types/web/scrapers/firefox-addons.d.ts +2 -0
- package/dist/types/web/scrapers/flathub.d.ts +2 -0
- package/dist/types/web/scrapers/github-gist.d.ts +5 -0
- package/dist/types/web/scrapers/github.d.ts +12 -0
- package/dist/types/web/scrapers/gitlab.d.ts +5 -0
- package/dist/types/web/scrapers/go-pkg.d.ts +5 -0
- package/dist/types/web/scrapers/hackage.d.ts +5 -0
- package/dist/types/web/scrapers/hackernews.d.ts +2 -0
- package/dist/types/web/scrapers/hex.d.ts +5 -0
- package/dist/types/web/scrapers/huggingface.d.ts +2 -0
- package/dist/types/web/scrapers/iacr.d.ts +5 -0
- package/dist/types/web/scrapers/index.d.ts +84 -0
- package/dist/types/web/scrapers/jetbrains-marketplace.d.ts +2 -0
- package/dist/types/web/scrapers/lemmy.d.ts +2 -0
- package/dist/types/web/scrapers/lobsters.d.ts +5 -0
- package/dist/types/web/scrapers/mastodon.d.ts +5 -0
- package/dist/types/web/scrapers/maven.d.ts +6 -0
- package/dist/types/web/scrapers/mdn.d.ts +2 -0
- package/dist/types/web/scrapers/metacpan.d.ts +5 -0
- package/dist/types/web/scrapers/musicbrainz.d.ts +5 -0
- package/dist/types/web/scrapers/npm.d.ts +5 -0
- package/dist/types/web/scrapers/nuget.d.ts +5 -0
- package/dist/types/web/scrapers/nvd.d.ts +5 -0
- package/dist/types/web/scrapers/ollama.d.ts +2 -0
- package/dist/types/web/scrapers/open-vsx.d.ts +5 -0
- package/dist/types/web/scrapers/opencorporates.d.ts +5 -0
- package/dist/types/web/scrapers/openlibrary.d.ts +5 -0
- package/dist/types/web/scrapers/orcid.d.ts +5 -0
- package/dist/types/web/scrapers/osv.d.ts +5 -0
- package/dist/types/web/scrapers/packagist.d.ts +5 -0
- package/dist/types/web/scrapers/pub-dev.d.ts +5 -0
- package/dist/types/web/scrapers/pubmed.d.ts +5 -0
- package/dist/types/web/scrapers/pypi.d.ts +5 -0
- package/dist/types/web/scrapers/rawg.d.ts +2 -0
- package/dist/types/web/scrapers/readthedocs.d.ts +2 -0
- package/dist/types/web/scrapers/reddit.d.ts +5 -0
- package/dist/types/web/scrapers/repology.d.ts +5 -0
- package/dist/types/web/scrapers/rfc.d.ts +5 -0
- package/dist/types/web/scrapers/rubygems.d.ts +5 -0
- package/dist/types/web/scrapers/searchcode.d.ts +2 -0
- package/dist/types/web/scrapers/sec-edgar.d.ts +5 -0
- package/dist/types/web/scrapers/semantic-scholar.d.ts +2 -0
- package/dist/types/web/scrapers/snapcraft.d.ts +2 -0
- package/dist/types/web/scrapers/sourcegraph.d.ts +2 -0
- package/dist/types/web/scrapers/spdx.d.ts +5 -0
- package/dist/types/web/scrapers/spotify.d.ts +8 -0
- package/dist/types/web/scrapers/stackoverflow.d.ts +6 -0
- package/dist/types/web/scrapers/terraform.d.ts +5 -0
- package/dist/types/web/scrapers/tldr.d.ts +7 -0
- package/dist/types/web/scrapers/twitter.d.ts +5 -0
- package/dist/types/web/scrapers/types.d.ts +78 -0
- package/dist/types/web/scrapers/utils.d.ts +26 -0
- package/dist/types/web/scrapers/vimeo.d.ts +5 -0
- package/dist/types/web/scrapers/vscode-marketplace.d.ts +5 -0
- package/dist/types/web/scrapers/w3c.d.ts +2 -0
- package/dist/types/web/scrapers/wikidata.d.ts +5 -0
- package/dist/types/web/scrapers/wikipedia.d.ts +5 -0
- package/dist/types/web/scrapers/youtube.d.ts +5 -0
- package/dist/types/web/search/index.d.ts +95 -0
- package/dist/types/web/search/provider.d.ts +35 -0
- package/dist/types/web/search/providers/anthropic.d.ts +32 -0
- package/dist/types/web/search/providers/base.d.ts +90 -0
- package/dist/types/web/search/providers/brave.d.ts +27 -0
- package/dist/types/web/search/providers/codex.d.ts +35 -0
- package/dist/types/web/search/providers/duckduckgo.d.ts +57 -0
- package/dist/types/web/search/providers/exa.d.ts +52 -0
- package/dist/types/web/search/providers/gemini.d.ts +59 -0
- package/dist/types/web/search/providers/jina.d.ts +26 -0
- package/dist/types/web/search/providers/kagi.d.ts +24 -0
- package/dist/types/web/search/providers/kimi.d.ts +27 -0
- package/dist/types/web/search/providers/parallel.d.ts +15 -0
- package/dist/types/web/search/providers/perplexity.d.ts +38 -0
- package/dist/types/web/search/providers/searxng.d.ts +44 -0
- package/dist/types/web/search/providers/synthetic.d.ts +21 -0
- package/dist/types/web/search/providers/tavily.d.ts +29 -0
- package/dist/types/web/search/providers/utils.d.ts +52 -0
- package/dist/types/web/search/providers/xai.d.ts +62 -0
- package/dist/types/web/search/providers/zai.d.ts +28 -0
- package/dist/types/web/search/render.d.ts +35 -0
- package/dist/types/web/search/types.d.ts +348 -0
- package/dist/types/web/search/utils.d.ts +4 -0
- package/dist/types/workspace-tree.d.ts +42 -0
- package/examples/README.md +21 -0
- package/examples/custom-tools/README.md +104 -0
- package/examples/custom-tools/hello/index.ts +20 -0
- package/examples/extensions/README.md +120 -0
- package/examples/extensions/api-demo.ts +79 -0
- package/examples/extensions/chalk-logger.ts +25 -0
- package/examples/extensions/hello.ts +31 -0
- package/examples/extensions/pirate.ts +43 -0
- package/examples/extensions/plan-mode.ts +549 -0
- package/examples/extensions/reload-runtime.ts +38 -0
- package/examples/extensions/tools.ts +144 -0
- package/examples/extensions/with-deps/index.ts +36 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +16 -0
- package/examples/hooks/README.md +56 -0
- package/examples/hooks/auto-commit-on-exit.ts +48 -0
- package/examples/hooks/confirm-destructive.ts +58 -0
- package/examples/hooks/custom-compaction.ts +115 -0
- package/examples/hooks/dirty-repo-guard.ts +51 -0
- package/examples/hooks/file-trigger.ts +40 -0
- package/examples/hooks/git-checkpoint.ts +52 -0
- package/examples/hooks/handoff.ts +149 -0
- package/examples/hooks/permission-gate.ts +33 -0
- package/examples/hooks/protected-paths.ts +29 -0
- package/examples/hooks/qna.ts +118 -0
- package/examples/hooks/status-line.ts +39 -0
- package/examples/sdk/01-minimal.ts +21 -0
- package/examples/sdk/02-custom-model.ts +49 -0
- package/examples/sdk/03-custom-prompt.ts +46 -0
- package/examples/sdk/04-skills.ts +43 -0
- package/examples/sdk/06-extensions.ts +82 -0
- package/examples/sdk/06-hooks.ts +61 -0
- package/examples/sdk/07-context-files.ts +35 -0
- package/examples/sdk/08-prompt-templates.ts +41 -0
- package/examples/sdk/08-slash-commands.ts +46 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +54 -0
- package/examples/sdk/11-sessions.ts +47 -0
- package/examples/sdk/README.md +172 -0
- package/package.json +539 -0
- package/scripts/build-binary.ts +84 -0
- package/scripts/format-prompts.ts +68 -0
- package/scripts/generate-docs-index.ts +71 -0
- package/scripts/generate-template.ts +33 -0
- package/src/async/index.ts +2 -0
- package/src/async/job-manager.ts +1299 -0
- package/src/async/support.ts +6 -0
- package/src/autoresearch/command-resume.md +14 -0
- package/src/autoresearch/dashboard.ts +446 -0
- package/src/autoresearch/git.ts +319 -0
- package/src/autoresearch/helpers.ts +218 -0
- package/src/autoresearch/index.ts +536 -0
- package/src/autoresearch/prompt-setup.md +43 -0
- package/src/autoresearch/prompt.md +103 -0
- package/src/autoresearch/resume-message.md +10 -0
- package/src/autoresearch/state.ts +273 -0
- package/src/autoresearch/storage.ts +699 -0
- package/src/autoresearch/tools/init-experiment.ts +272 -0
- package/src/autoresearch/tools/log-experiment.ts +524 -0
- package/src/autoresearch/tools/run-experiment.ts +475 -0
- package/src/autoresearch/tools/update-notes.ts +109 -0
- package/src/autoresearch/types.ts +168 -0
- package/src/bun-imports.d.ts +28 -0
- package/src/capability/context-file.ts +44 -0
- package/src/capability/extension-module.ts +34 -0
- package/src/capability/extension.ts +47 -0
- package/src/capability/fs.ts +107 -0
- package/src/capability/hook.ts +40 -0
- package/src/capability/index.ts +436 -0
- package/src/capability/instruction.ts +37 -0
- package/src/capability/mcp.ts +74 -0
- package/src/capability/prompt.ts +35 -0
- package/src/capability/rule.ts +244 -0
- package/src/capability/settings.ts +34 -0
- package/src/capability/skill.ts +56 -0
- package/src/capability/slash-command.ts +40 -0
- package/src/capability/ssh.ts +41 -0
- package/src/capability/system-prompt.ts +34 -0
- package/src/capability/tool.ts +38 -0
- package/src/capability/types.ts +168 -0
- package/src/cli/agents-cli.ts +141 -0
- package/src/cli/args.ts +309 -0
- package/src/cli/auth-broker-cli.ts +747 -0
- package/src/cli/auth-gateway-cli.ts +411 -0
- package/src/cli/classify-install-target.ts +50 -0
- package/src/cli/commands/init-xdg.ts +27 -0
- package/src/cli/config-cli.ts +426 -0
- package/src/cli/fast-help.ts +80 -0
- package/src/cli/file-processor.ts +123 -0
- package/src/cli/grep-cli.ts +160 -0
- package/src/cli/initial-message.ts +58 -0
- package/src/cli/list-models.ts +194 -0
- package/src/cli/notify-cli.ts +135 -0
- package/src/cli/plugin-cli.ts +942 -0
- package/src/cli/read-cli.ts +57 -0
- package/src/cli/session-picker.ts +52 -0
- package/src/cli/setup-cli.ts +537 -0
- package/src/cli/shell-cli.ts +176 -0
- package/src/cli/skills-cli.ts +88 -0
- package/src/cli/ssh-cli.ts +179 -0
- package/src/cli/stats-cli.ts +238 -0
- package/src/cli/update-cli.ts +468 -0
- package/src/cli/web-search-cli.ts +133 -0
- package/src/cli/worktree-cli.ts +291 -0
- package/src/cli.ts +150 -0
- package/src/commands/acp.ts +24 -0
- package/src/commands/agents.ts +57 -0
- package/src/commands/auth-broker.ts +96 -0
- package/src/commands/auth-gateway.ts +63 -0
- package/src/commands/chat.ts +25 -0
- package/src/commands/codex-native-hook.ts +12 -0
- package/src/commands/commit.ts +46 -0
- package/src/commands/config.ts +51 -0
- package/src/commands/contribution-prep.ts +41 -0
- package/src/commands/coordinator.ts +71 -0
- package/src/commands/goal.ts +37 -0
- package/src/commands/grep.ts +48 -0
- package/src/commands/harness.ts +1137 -0
- package/src/commands/interview.ts +42 -0
- package/src/commands/launch.ts +178 -0
- package/src/commands/mcp-serve.ts +63 -0
- package/src/commands/memory.ts +34 -0
- package/src/commands/notify.ts +45 -0
- package/src/commands/orchestrate.ts +55 -0
- package/src/commands/planphase.ts +19 -0
- package/src/commands/plugin.ts +78 -0
- package/src/commands/ralplan.ts +25 -0
- package/src/commands/read.ts +35 -0
- package/src/commands/session.ts +151 -0
- package/src/commands/setup.ts +85 -0
- package/src/commands/shell.ts +29 -0
- package/src/commands/skills.ts +49 -0
- package/src/commands/ssh.ts +60 -0
- package/src/commands/state.ts +25 -0
- package/src/commands/stats.ts +29 -0
- package/src/commands/team.ts +217 -0
- package/src/commands/ultragoal.ts +40 -0
- package/src/commands/update.ts +21 -0
- package/src/commands/web-search.ts +42 -0
- package/src/commands/worktree.ts +57 -0
- package/src/commit/agentic/agent.ts +316 -0
- package/src/commit/agentic/fallback.ts +96 -0
- package/src/commit/agentic/index.ts +356 -0
- package/src/commit/agentic/prompts/analyze-file.md +22 -0
- package/src/commit/agentic/prompts/session-user.md +25 -0
- package/src/commit/agentic/prompts/split-confirm.md +1 -0
- package/src/commit/agentic/prompts/system.md +38 -0
- package/src/commit/agentic/state.ts +60 -0
- package/src/commit/agentic/tools/analyze-file.ts +127 -0
- package/src/commit/agentic/tools/git-file-diff.ts +191 -0
- package/src/commit/agentic/tools/git-hunk.ts +50 -0
- package/src/commit/agentic/tools/git-overview.ts +81 -0
- package/src/commit/agentic/tools/index.ts +54 -0
- package/src/commit/agentic/tools/propose-changelog.ts +144 -0
- package/src/commit/agentic/tools/propose-commit.ts +109 -0
- package/src/commit/agentic/tools/recent-commits.ts +81 -0
- package/src/commit/agentic/tools/schemas.ts +23 -0
- package/src/commit/agentic/tools/split-commit.ts +238 -0
- package/src/commit/agentic/topo-sort.ts +44 -0
- package/src/commit/agentic/trivial.ts +51 -0
- package/src/commit/agentic/validation.ts +183 -0
- package/src/commit/analysis/conventional.ts +64 -0
- package/src/commit/analysis/index.ts +4 -0
- package/src/commit/analysis/scope.ts +242 -0
- package/src/commit/analysis/summary.ts +105 -0
- package/src/commit/analysis/validation.ts +66 -0
- package/src/commit/changelog/detect.ts +40 -0
- package/src/commit/changelog/generate.ts +97 -0
- package/src/commit/changelog/index.ts +234 -0
- package/src/commit/changelog/parse.ts +44 -0
- package/src/commit/cli.ts +85 -0
- package/src/commit/git/diff.ts +148 -0
- package/src/commit/index.ts +5 -0
- package/src/commit/map-reduce/index.ts +69 -0
- package/src/commit/map-reduce/map-phase.ts +193 -0
- package/src/commit/map-reduce/reduce-phase.ts +49 -0
- package/src/commit/map-reduce/utils.ts +9 -0
- package/src/commit/message.ts +11 -0
- package/src/commit/model-selection.ts +51 -0
- package/src/commit/pipeline.ts +244 -0
- package/src/commit/prompts/analysis-system.md +148 -0
- package/src/commit/prompts/analysis-user.md +38 -0
- package/src/commit/prompts/changelog-system.md +50 -0
- package/src/commit/prompts/changelog-user.md +18 -0
- package/src/commit/prompts/file-observer-system.md +24 -0
- package/src/commit/prompts/file-observer-user.md +8 -0
- package/src/commit/prompts/reduce-system.md +50 -0
- package/src/commit/prompts/reduce-user.md +17 -0
- package/src/commit/prompts/summary-retry.md +3 -0
- package/src/commit/prompts/summary-system.md +38 -0
- package/src/commit/prompts/summary-user.md +13 -0
- package/src/commit/prompts/types-description.md +2 -0
- package/src/commit/shared-llm.ts +77 -0
- package/src/commit/types.ts +118 -0
- package/src/commit/utils/exclusions.ts +42 -0
- package/src/commit/utils.ts +58 -0
- package/src/config/config-file.ts +232 -0
- package/src/config/file-lock.ts +121 -0
- package/src/config/keybindings.ts +553 -0
- package/src/config/mcp-schema.json +230 -0
- package/src/config/model-equivalence.ts +816 -0
- package/src/config/model-profile-activation.ts +165 -0
- package/src/config/model-profiles.ts +188 -0
- package/src/config/model-registry.ts +2751 -0
- package/src/config/model-resolver.ts +1355 -0
- package/src/config/models-config-schema.ts +254 -0
- package/src/config/oauth-provider-aliases.ts +49 -0
- package/src/config/prompt-templates.ts +310 -0
- package/src/config/resolve-config-value.ts +94 -0
- package/src/config/settings-schema.ts +3235 -0
- package/src/config/settings.ts +979 -0
- package/src/config/skill-settings-defaults.ts +35 -0
- package/src/config.ts +212 -0
- package/src/coordinator/contract.ts +20 -0
- package/src/coordinator-mcp/policy.ts +174 -0
- package/src/coordinator-mcp/safety.ts +80 -0
- package/src/coordinator-mcp/server.ts +1319 -0
- package/src/cursor.ts +372 -0
- package/src/dap/client.ts +689 -0
- package/src/dap/config.ts +150 -0
- package/src/dap/defaults.json +211 -0
- package/src/dap/index.ts +4 -0
- package/src/dap/session.ts +1306 -0
- package/src/dap/types.ts +600 -0
- package/src/debug/crash-diagnostics.ts +223 -0
- package/src/debug/index.ts +459 -0
- package/src/debug/log-formatting.ts +58 -0
- package/src/debug/log-viewer.ts +908 -0
- package/src/debug/profiler.ts +162 -0
- package/src/debug/raw-sse-buffer.ts +270 -0
- package/src/debug/raw-sse.ts +213 -0
- package/src/debug/report-bundle.ts +365 -0
- package/src/debug/runtime-gauges.ts +20 -0
- package/src/debug/system-info.ts +111 -0
- package/src/defaults/jwc/mcp-defaults.json +8 -0
- package/src/defaults/jwc/skill-fragments/browse/web-ai.md +130 -0
- package/src/defaults/jwc/skills/browse/SKILL.md +113 -0
- package/src/defaults/jwc/skills/goal/SKILL.md +323 -0
- package/src/defaults/jwc/skills/goal/ai-slop-cleaner.md +61 -0
- package/src/defaults/jwc/skills/jaw-interview/SKILL.md +891 -0
- package/src/defaults/jwc/skills/jaw-interview/auto-answer-uncertain.md +37 -0
- package/src/defaults/jwc/skills/jaw-interview/auto-research-greenfield.md +42 -0
- package/src/defaults/jwc/skills/plan/SKILL.md +201 -0
- package/src/defaults/jwc/skills/search/SKILL.md +120 -0
- package/src/defaults/jwc/skills/team/SKILL.md +441 -0
- package/src/defaults/jwc-defaults.ts +316 -0
- package/src/discovery/agents-md.ts +67 -0
- package/src/discovery/agents.ts +230 -0
- package/src/discovery/builtin.ts +932 -0
- package/src/discovery/claude-plugins.ts +407 -0
- package/src/discovery/claude.ts +313 -0
- package/src/discovery/cli-jaw.ts +36 -0
- package/src/discovery/cline.ts +83 -0
- package/src/discovery/codex.ts +330 -0
- package/src/discovery/cursor.ts +220 -0
- package/src/discovery/gemini.ts +383 -0
- package/src/discovery/github.ts +118 -0
- package/src/discovery/helpers.ts +1010 -0
- package/src/discovery/index.ts +77 -0
- package/src/discovery/mcp-json.ts +171 -0
- package/src/discovery/opencode.ts +398 -0
- package/src/discovery/plugin-dir-roots.ts +28 -0
- package/src/discovery/ssh.ts +153 -0
- package/src/discovery/substitute-plugin-root.ts +29 -0
- package/src/discovery/vscode.ts +105 -0
- package/src/discovery/windsurf.ts +147 -0
- package/src/edit/apply-patch/index.ts +87 -0
- package/src/edit/apply-patch/parser.ts +174 -0
- package/src/edit/diff.ts +873 -0
- package/src/edit/file-read-cache.ts +95 -0
- package/src/edit/index.ts +528 -0
- package/src/edit/modes/apply-patch.lark +19 -0
- package/src/edit/modes/apply-patch.ts +53 -0
- package/src/edit/modes/patch.ts +1835 -0
- package/src/edit/modes/replace.ts +1161 -0
- package/src/edit/normalize.ts +375 -0
- package/src/edit/notebook.ts +222 -0
- package/src/edit/read-file.ts +25 -0
- package/src/edit/renderer.ts +683 -0
- package/src/edit/streaming.ts +561 -0
- package/src/eval/backend.ts +43 -0
- package/src/eval/index.ts +4 -0
- package/src/eval/js/context-manager.ts +414 -0
- package/src/eval/js/executor.ts +134 -0
- package/src/eval/js/index.ts +46 -0
- package/src/eval/js/shared/helpers.ts +237 -0
- package/src/eval/js/shared/indirect-eval.ts +30 -0
- package/src/eval/js/shared/prelude.ts +2 -0
- package/src/eval/js/shared/prelude.txt +70 -0
- package/src/eval/js/shared/rewrite-imports.ts +415 -0
- package/src/eval/js/shared/runtime.ts +301 -0
- package/src/eval/js/shared/types.ts +18 -0
- package/src/eval/js/tool-bridge.ts +144 -0
- package/src/eval/js/worker-core.ts +146 -0
- package/src/eval/js/worker-entry.ts +24 -0
- package/src/eval/js/worker-protocol.ts +41 -0
- package/src/eval/py/display.ts +71 -0
- package/src/eval/py/executor.ts +622 -0
- package/src/eval/py/index.ts +58 -0
- package/src/eval/py/kernel.ts +683 -0
- package/src/eval/py/prelude.py +462 -0
- package/src/eval/py/prelude.ts +3 -0
- package/src/eval/py/runner.py +910 -0
- package/src/eval/py/runtime.ts +210 -0
- package/src/eval/py/tool-bridge.ts +137 -0
- package/src/eval/types.ts +48 -0
- package/src/exa/factory.ts +60 -0
- package/src/exa/index.ts +27 -0
- package/src/exa/mcp-client.ts +364 -0
- package/src/exa/render.ts +244 -0
- package/src/exa/researcher.ts +36 -0
- package/src/exa/search.ts +47 -0
- package/src/exa/types.ts +166 -0
- package/src/exa/websets.ts +248 -0
- package/src/exec/bash-executor.ts +362 -0
- package/src/exec/exec.ts +53 -0
- package/src/exec/idle-timeout-watchdog.ts +126 -0
- package/src/exec/non-interactive-env.ts +73 -0
- package/src/export/custom-share.ts +65 -0
- package/src/export/html/index.ts +168 -0
- package/src/export/html/template.css +1060 -0
- package/src/export/html/template.generated.ts +2 -0
- package/src/export/html/template.html +47 -0
- package/src/export/html/template.js +2268 -0
- package/src/export/html/template.macro.ts +25 -0
- package/src/export/html/vendor/highlight.min.js +1213 -0
- package/src/export/html/vendor/marked.min.js +6 -0
- package/src/export/ttsr.ts +444 -0
- package/src/extensibility/custom-commands/bundled/ci-green/index.ts +25 -0
- package/src/extensibility/custom-commands/bundled/review/index.ts +456 -0
- package/src/extensibility/custom-commands/index.ts +2 -0
- package/src/extensibility/custom-commands/loader.ts +238 -0
- package/src/extensibility/custom-commands/types.ts +113 -0
- package/src/extensibility/custom-tools/index.ts +7 -0
- package/src/extensibility/custom-tools/loader.ts +245 -0
- package/src/extensibility/custom-tools/types.ts +255 -0
- package/src/extensibility/custom-tools/wrapper.ts +47 -0
- package/src/extensibility/extensions/compact-handler.ts +40 -0
- package/src/extensibility/extensions/get-commands-handler.ts +80 -0
- package/src/extensibility/extensions/index.ts +15 -0
- package/src/extensibility/extensions/loader.ts +555 -0
- package/src/extensibility/extensions/runner.ts +900 -0
- package/src/extensibility/extensions/types.ts +1314 -0
- package/src/extensibility/extensions/wrapper.ts +189 -0
- package/src/extensibility/hooks/index.ts +5 -0
- package/src/extensibility/hooks/loader.ts +257 -0
- package/src/extensibility/hooks/runner.ts +425 -0
- package/src/extensibility/hooks/tool-wrapper.ts +107 -0
- package/src/extensibility/hooks/types.ts +599 -0
- package/src/extensibility/jwc-plugins/activation.ts +87 -0
- package/src/extensibility/jwc-plugins/index.ts +9 -0
- package/src/extensibility/jwc-plugins/injection.ts +114 -0
- package/src/extensibility/jwc-plugins/loader.ts +131 -0
- package/src/extensibility/jwc-plugins/paths.ts +66 -0
- package/src/extensibility/jwc-plugins/schema.ts +79 -0
- package/src/extensibility/jwc-plugins/state.ts +29 -0
- package/src/extensibility/jwc-plugins/tools.ts +47 -0
- package/src/extensibility/jwc-plugins/types.ts +97 -0
- package/src/extensibility/jwc-plugins/validation.ts +76 -0
- package/src/extensibility/plugins/doctor.ts +66 -0
- package/src/extensibility/plugins/git-url.ts +281 -0
- package/src/extensibility/plugins/index.ts +9 -0
- package/src/extensibility/plugins/installer.ts +192 -0
- package/src/extensibility/plugins/legacy-pi-compat.ts +336 -0
- package/src/extensibility/plugins/loader.ts +288 -0
- package/src/extensibility/plugins/manager.ts +739 -0
- package/src/extensibility/plugins/marketplace/cache.ts +136 -0
- package/src/extensibility/plugins/marketplace/fetcher.ts +317 -0
- package/src/extensibility/plugins/marketplace/index.ts +6 -0
- package/src/extensibility/plugins/marketplace/manager.ts +770 -0
- package/src/extensibility/plugins/marketplace/registry.ts +196 -0
- package/src/extensibility/plugins/marketplace/source-resolver.ts +147 -0
- package/src/extensibility/plugins/marketplace/types.ts +191 -0
- package/src/extensibility/plugins/parser.ts +105 -0
- package/src/extensibility/plugins/types.ts +194 -0
- package/src/extensibility/shared-events.ts +344 -0
- package/src/extensibility/skills.ts +449 -0
- package/src/extensibility/slash-commands.ts +249 -0
- package/src/extensibility/tool-proxy.ts +25 -0
- package/src/extensibility/typebox.ts +418 -0
- package/src/extensibility/utils.ts +44 -0
- package/src/goals/goal-planning-start.ts +21 -0
- package/src/goals/index.ts +3 -0
- package/src/goals/runtime.ts +418 -0
- package/src/goals/state.ts +70 -0
- package/src/goals/tools/goal-tool.ts +230 -0
- package/src/harness-control-plane/classifier.ts +128 -0
- package/src/harness-control-plane/control-endpoint.ts +148 -0
- package/src/harness-control-plane/finalize.ts +306 -0
- package/src/harness-control-plane/operate.ts +225 -0
- package/src/harness-control-plane/owner.ts +664 -0
- package/src/harness-control-plane/phase-rollup.ts +96 -0
- package/src/harness-control-plane/preserve.ts +102 -0
- package/src/harness-control-plane/receipt-ingest.ts +127 -0
- package/src/harness-control-plane/receipt-spool.ts +147 -0
- package/src/harness-control-plane/receipts.ts +320 -0
- package/src/harness-control-plane/rpc-adapter.ts +282 -0
- package/src/harness-control-plane/seams.ts +39 -0
- package/src/harness-control-plane/session-lease.ts +388 -0
- package/src/harness-control-plane/state-machine.ts +119 -0
- package/src/harness-control-plane/storage.ts +423 -0
- package/src/harness-control-plane/types.ts +240 -0
- package/src/hashline/anchors.ts +113 -0
- package/src/hashline/apply.ts +737 -0
- package/src/hashline/bigrams.json +649 -0
- package/src/hashline/constants.ts +25 -0
- package/src/hashline/diff-preview.ts +43 -0
- package/src/hashline/diff.ts +56 -0
- package/src/hashline/execute.ts +267 -0
- package/src/hashline/grammar.lark +21 -0
- package/src/hashline/hash.ts +196 -0
- package/src/hashline/index.ts +13 -0
- package/src/hashline/input.ts +130 -0
- package/src/hashline/parser.ts +246 -0
- package/src/hashline/prefixes.ts +101 -0
- package/src/hashline/recovery.ts +113 -0
- package/src/hashline/stream.ts +123 -0
- package/src/hashline/types.ts +68 -0
- package/src/hindsight/backend.ts +205 -0
- package/src/hindsight/bank.ts +131 -0
- package/src/hindsight/client.ts +598 -0
- package/src/hindsight/config.ts +175 -0
- package/src/hindsight/content.ts +211 -0
- package/src/hindsight/index.ts +8 -0
- package/src/hindsight/mental-models.ts +382 -0
- package/src/hindsight/seeds.json +32 -0
- package/src/hindsight/state.ts +469 -0
- package/src/hindsight/transcript.ts +71 -0
- package/src/hooks/codex-native-hooks-config.ts +143 -0
- package/src/hooks/native-skill-hook.ts +305 -0
- package/src/hooks/skill-keywords.ts +95 -0
- package/src/hooks/skill-state.ts +654 -0
- package/src/index.ts +56 -0
- package/src/internal-urls/agent-protocol.ts +176 -0
- package/src/internal-urls/artifact-protocol.ts +75 -0
- package/src/internal-urls/docs-index.generated.ts +92 -0
- package/src/internal-urls/index.ts +21 -0
- package/src/internal-urls/issue-pr-protocol.ts +577 -0
- package/src/internal-urls/json-query.ts +126 -0
- package/src/internal-urls/jwc-protocol.ts +91 -0
- package/src/internal-urls/local-protocol.ts +249 -0
- package/src/internal-urls/mcp-protocol.ts +151 -0
- package/src/internal-urls/memory-protocol.ts +165 -0
- package/src/internal-urls/parse.ts +72 -0
- package/src/internal-urls/registry-helpers.ts +28 -0
- package/src/internal-urls/router.ts +79 -0
- package/src/internal-urls/rule-protocol.ts +38 -0
- package/src/internal-urls/skill-protocol.ts +103 -0
- package/src/internal-urls/types.ts +114 -0
- package/src/jaw-interview/structured-renderer.ts +83 -0
- package/src/jwc-runtime/actor-registry.ts +365 -0
- package/src/jwc-runtime/agent-identity.ts +16 -0
- package/src/jwc-runtime/cli-jaw-home.ts +14 -0
- package/src/jwc-runtime/cli-jaw-vocab.ts +69 -0
- package/src/jwc-runtime/cli-write-receipt.ts +31 -0
- package/src/jwc-runtime/goal-cli.ts +428 -0
- package/src/jwc-runtime/goal-engine.ts +2214 -0
- package/src/jwc-runtime/goal-guard.ts +300 -0
- package/src/jwc-runtime/goal-mode-request.ts +331 -0
- package/src/jwc-runtime/jaw-interview-runtime.ts +809 -0
- package/src/jwc-runtime/launch-tmux.ts +296 -0
- package/src/jwc-runtime/launch-worktree.ts +291 -0
- package/src/jwc-runtime/legacy-storage.ts +132 -0
- package/src/jwc-runtime/memory-runtime.ts +434 -0
- package/src/jwc-runtime/orchestrate-runtime.ts +612 -0
- package/src/jwc-runtime/orchestrate-state.ts +395 -0
- package/src/jwc-runtime/plan-writer.ts +661 -0
- package/src/jwc-runtime/restricted-role-agent-bash.ts +5 -0
- package/src/jwc-runtime/session-state-sidecar.ts +89 -0
- package/src/jwc-runtime/stage-skill-map.ts +48 -0
- package/src/jwc-runtime/state-graph.ts +86 -0
- package/src/jwc-runtime/state-migrations.ts +183 -0
- package/src/jwc-runtime/state-renderer.ts +340 -0
- package/src/jwc-runtime/state-runtime.ts +1978 -0
- package/src/jwc-runtime/state-schema.ts +218 -0
- package/src/jwc-runtime/state-validation.ts +50 -0
- package/src/jwc-runtime/state-writer.ts +765 -0
- package/src/jwc-runtime/team-runtime.ts +4181 -0
- package/src/jwc-runtime/tmux-common.ts +130 -0
- package/src/jwc-runtime/tmux-sessions.ts +169 -0
- package/src/jwc-runtime/workflow-command-ref.ts +240 -0
- package/src/jwc-runtime/workflow-manifest.generated.json +1606 -0
- package/src/jwc-runtime/workflow-manifest.ts +427 -0
- package/src/lsp/client.ts +974 -0
- package/src/lsp/clients/biome-client.ts +202 -0
- package/src/lsp/clients/index.ts +50 -0
- package/src/lsp/clients/lsp-linter-client.ts +93 -0
- package/src/lsp/clients/swiftlint-client.ts +120 -0
- package/src/lsp/config.ts +492 -0
- package/src/lsp/defaults.json +493 -0
- package/src/lsp/edits.ts +166 -0
- package/src/lsp/index.ts +2282 -0
- package/src/lsp/lspmux.ts +233 -0
- package/src/lsp/render.ts +692 -0
- package/src/lsp/startup-events.ts +13 -0
- package/src/lsp/types.ts +443 -0
- package/src/lsp/utils.ts +678 -0
- package/src/main.ts +1159 -0
- package/src/mem0/backend.ts +75 -0
- package/src/mem0/client.ts +122 -0
- package/src/mem0/config.ts +82 -0
- package/src/mem0/index.ts +5 -0
- package/src/mem0/scope.ts +54 -0
- package/src/mem0/state.ts +142 -0
- package/src/memories/index.ts +1111 -0
- package/src/memories/local-query.ts +699 -0
- package/src/memories/memory-config.ts +175 -0
- package/src/memories/memory-fts.ts +179 -0
- package/src/memories/memory-model-resolution.ts +84 -0
- package/src/memories/memory-quality.ts +163 -0
- package/src/memories/storage.ts +588 -0
- package/src/memory-backend/index.ts +4 -0
- package/src/memory-backend/local-backend.ts +50 -0
- package/src/memory-backend/off-backend.ts +16 -0
- package/src/memory-backend/resolve.ts +27 -0
- package/src/memory-backend/types.ts +82 -0
- package/src/migrate-config-dir-startup.ts +15 -0
- package/src/migrate-config-dir.ts +80 -0
- package/src/modes/acp/acp-agent.ts +2218 -0
- package/src/modes/acp/acp-client-bridge.ts +154 -0
- package/src/modes/acp/acp-event-mapper.ts +912 -0
- package/src/modes/acp/acp-mode.ts +23 -0
- package/src/modes/acp/index.ts +2 -0
- package/src/modes/acp/terminal-auth.ts +37 -0
- package/src/modes/background-row-model.ts +17 -0
- package/src/modes/bridge/auth.ts +41 -0
- package/src/modes/bridge/bridge-client-bridge.ts +47 -0
- package/src/modes/bridge/bridge-mode.ts +644 -0
- package/src/modes/bridge/bridge-ui-context.ts +200 -0
- package/src/modes/bridge/event-stream.ts +70 -0
- package/src/modes/components/_cli-jaw-entry.ts +36 -0
- package/src/modes/components/agent-dashboard.ts +1120 -0
- package/src/modes/components/assistant-message.ts +361 -0
- package/src/modes/components/background-footer-detail.ts +27 -0
- package/src/modes/components/background-footer-panel-model.ts +96 -0
- package/src/modes/components/background-footer-panel.ts +89 -0
- package/src/modes/components/bash-execution.ts +261 -0
- package/src/modes/components/bordered-loader.ts +41 -0
- package/src/modes/components/branch-summary-message.ts +65 -0
- package/src/modes/components/btw-panel.ts +104 -0
- package/src/modes/components/compaction-summary-message.ts +71 -0
- package/src/modes/components/composer-chrome.ts +42 -0
- package/src/modes/components/composer-footer.ts +113 -0
- package/src/modes/components/countdown-timer.ts +75 -0
- package/src/modes/components/custom-editor.ts +515 -0
- package/src/modes/components/custom-message.ts +85 -0
- package/src/modes/components/custom-provider-wizard.ts +318 -0
- package/src/modes/components/diff.ts +363 -0
- package/src/modes/components/dynamic-border.ts +25 -0
- package/src/modes/components/eval-execution.ts +196 -0
- package/src/modes/components/execution-shared.ts +112 -0
- package/src/modes/components/extensions/extension-dashboard.ts +350 -0
- package/src/modes/components/extensions/extension-list.ts +492 -0
- package/src/modes/components/extensions/index.ts +9 -0
- package/src/modes/components/extensions/inspector-panel.ts +317 -0
- package/src/modes/components/extensions/state-manager.ts +628 -0
- package/src/modes/components/extensions/types.ts +191 -0
- package/src/modes/components/footer.ts +270 -0
- package/src/modes/components/full-transcript-overlay.ts +133 -0
- package/src/modes/components/help-selector.ts +274 -0
- package/src/modes/components/history-search.ts +158 -0
- package/src/modes/components/hook-editor.ts +151 -0
- package/src/modes/components/hook-input.ts +79 -0
- package/src/modes/components/hook-message.ts +68 -0
- package/src/modes/components/hook-selector.ts +873 -0
- package/src/modes/components/index.ts +36 -0
- package/src/modes/components/jobs-overlay-model.ts +109 -0
- package/src/modes/components/jobs-overlay.ts +172 -0
- package/src/modes/components/keybinding-hints.ts +65 -0
- package/src/modes/components/login-dialog.ts +164 -0
- package/src/modes/components/message-frame.ts +88 -0
- package/src/modes/components/model-selector.ts +1653 -0
- package/src/modes/components/oauth-selector.ts +248 -0
- package/src/modes/components/pabcd-border.ts +98 -0
- package/src/modes/components/plugin-selector.ts +95 -0
- package/src/modes/components/plugin-settings.ts +489 -0
- package/src/modes/components/provider-onboarding-selector.ts +94 -0
- package/src/modes/components/queue-mode-selector.ts +56 -0
- package/src/modes/components/quota-panel.ts +101 -0
- package/src/modes/components/read-tool-group.ts +295 -0
- package/src/modes/components/runtime-mcp-add-wizard.ts +1341 -0
- package/src/modes/components/session-observer-overlay.ts +839 -0
- package/src/modes/components/session-selector.ts +343 -0
- package/src/modes/components/settings-defs.ts +175 -0
- package/src/modes/components/settings-selector.ts +644 -0
- package/src/modes/components/show-images-selector.ts +45 -0
- package/src/modes/components/skill-hud/render.ts +93 -0
- package/src/modes/components/skill-message.ts +110 -0
- package/src/modes/components/status-line/context-thresholds.ts +68 -0
- package/src/modes/components/status-line/git-utils.ts +42 -0
- package/src/modes/components/status-line/index.ts +4 -0
- package/src/modes/components/status-line/presets.ts +107 -0
- package/src/modes/components/status-line/segments.ts +657 -0
- package/src/modes/components/status-line/separators.ts +55 -0
- package/src/modes/components/status-line/token-rate.ts +66 -0
- package/src/modes/components/status-line/types.ts +102 -0
- package/src/modes/components/status-line/workflow-readers.ts +97 -0
- package/src/modes/components/status-line.ts +917 -0
- package/src/modes/components/theme-selector.ts +63 -0
- package/src/modes/components/thinking-selector.ts +52 -0
- package/src/modes/components/todo-reminder.ts +40 -0
- package/src/modes/components/tool-execution.ts +990 -0
- package/src/modes/components/tool-transcript-overlay.ts +81 -0
- package/src/modes/components/tree-selector.ts +930 -0
- package/src/modes/components/ttsr-notification.ts +100 -0
- package/src/modes/components/user-message-selector.ts +141 -0
- package/src/modes/components/user-message.ts +53 -0
- package/src/modes/components/visual-truncate.ts +63 -0
- package/src/modes/components/welcome.ts +522 -0
- package/src/modes/controllers/btw-controller.ts +105 -0
- package/src/modes/controllers/command-controller-shared.ts +108 -0
- package/src/modes/controllers/command-controller.ts +1703 -0
- package/src/modes/controllers/event-controller.ts +1054 -0
- package/src/modes/controllers/extension-ui-controller.ts +1010 -0
- package/src/modes/controllers/input-controller.ts +1422 -0
- package/src/modes/controllers/runtime-mcp-command-controller.ts +1934 -0
- package/src/modes/controllers/selector-controller.ts +1605 -0
- package/src/modes/controllers/ssh-command-controller.ts +384 -0
- package/src/modes/controllers/todo-command-controller.ts +485 -0
- package/src/modes/data/emojis.json +1 -0
- package/src/modes/emoji-autocomplete.ts +285 -0
- package/src/modes/index.ts +35 -0
- package/src/modes/interactive-mode.ts +2938 -0
- package/src/modes/jobs-observer.ts +352 -0
- package/src/modes/oauth-manual-input.ts +42 -0
- package/src/modes/print-mode.ts +121 -0
- package/src/modes/prompt-action-autocomplete.ts +409 -0
- package/src/modes/rpc/host-tools.ts +1 -0
- package/src/modes/rpc/host-uris.ts +1 -0
- package/src/modes/rpc/rpc-client.ts +914 -0
- package/src/modes/rpc/rpc-mode.ts +784 -0
- package/src/modes/rpc/rpc-types.ts +601 -0
- package/src/modes/runtime-init.ts +116 -0
- package/src/modes/session-observer-registry.ts +146 -0
- package/src/modes/shared/agent-wire/approval-gate.ts +151 -0
- package/src/modes/shared/agent-wire/command-contract.ts +18 -0
- package/src/modes/shared/agent-wire/command-dispatch.ts +438 -0
- package/src/modes/shared/agent-wire/command-validation.ts +164 -0
- package/src/modes/shared/agent-wire/event-contract.ts +148 -0
- package/src/modes/shared/agent-wire/event-envelope.ts +141 -0
- package/src/modes/shared/agent-wire/event-observation.ts +424 -0
- package/src/modes/shared/agent-wire/handshake.ts +157 -0
- package/src/modes/shared/agent-wire/host-tool-bridge.ts +194 -0
- package/src/modes/shared/agent-wire/host-uri-bridge.ts +236 -0
- package/src/modes/shared/agent-wire/jaw-interview-gate.ts +253 -0
- package/src/modes/shared/agent-wire/protocol.ts +46 -0
- package/src/modes/shared/agent-wire/responses.ts +17 -0
- package/src/modes/shared/agent-wire/scopes.ts +91 -0
- package/src/modes/shared/agent-wire/session-registry.ts +109 -0
- package/src/modes/shared/agent-wire/ui-request-broker.ts +150 -0
- package/src/modes/shared/agent-wire/ui-result.ts +48 -0
- package/src/modes/shared/agent-wire/unattended-action-policy.ts +341 -0
- package/src/modes/shared/agent-wire/unattended-audit.ts +175 -0
- package/src/modes/shared/agent-wire/unattended-run-controller.ts +406 -0
- package/src/modes/shared/agent-wire/unattended-session.ts +180 -0
- package/src/modes/shared/agent-wire/workflow-gate-broker.ts +324 -0
- package/src/modes/shared/agent-wire/workflow-gate-schema.ts +331 -0
- package/src/modes/shared.ts +55 -0
- package/src/modes/theme/defaults/abyss-bite-light.json +124 -0
- package/src/modes/theme/defaults/abyss-bite.json +124 -0
- package/src/modes/theme/defaults/blue-crab.json +126 -0
- package/src/modes/theme/defaults/index.ts +11 -0
- package/src/modes/theme/defaults/red-claw.json +123 -0
- package/src/modes/theme/mermaid-cache.ts +29 -0
- package/src/modes/theme/shimmer.ts +219 -0
- package/src/modes/theme/theme-schema.json +429 -0
- package/src/modes/theme/theme.ts +2472 -0
- package/src/modes/types.ts +343 -0
- package/src/modes/utils/abort-message.ts +41 -0
- package/src/modes/utils/compaction-progress.ts +174 -0
- package/src/modes/utils/context-usage.ts +398 -0
- package/src/modes/utils/help-markdown.ts +50 -0
- package/src/modes/utils/hotkeys-markdown.ts +61 -0
- package/src/modes/utils/keybinding-matchers.ts +30 -0
- package/src/modes/utils/session-transcript-replay.ts +520 -0
- package/src/modes/utils/tools-markdown.ts +27 -0
- package/src/modes/utils/ui-helpers.ts +846 -0
- package/src/notifications/ask-bridge.ts +74 -0
- package/src/notifications/config-command-parser.ts +76 -0
- package/src/notifications/config.ts +102 -0
- package/src/notifications/daemon-control.ts +73 -0
- package/src/notifications/daemon-engine.ts +165 -0
- package/src/notifications/daemon-inbound.ts +220 -0
- package/src/notifications/daemon-loop.ts +60 -0
- package/src/notifications/daemon-owner.ts +53 -0
- package/src/notifications/daemon-runtime.ts +84 -0
- package/src/notifications/discovery.ts +119 -0
- package/src/notifications/index.ts +34 -0
- package/src/notifications/lifecycle-audit.ts +94 -0
- package/src/notifications/lifecycle-command-parser.ts +51 -0
- package/src/notifications/lifecycle-control-runtime.ts +127 -0
- package/src/notifications/notification-redaction.ts +57 -0
- package/src/notifications/protocol.ts +61 -0
- package/src/notifications/remote-answer.ts +241 -0
- package/src/notifications/reply-bridge.ts +85 -0
- package/src/notifications/server.ts +280 -0
- package/src/notifications/session-lifecycle.ts +46 -0
- package/src/notifications/session-registry.ts +164 -0
- package/src/notifications/telegram-api.ts +259 -0
- package/src/notifications/telegram-ask-keyboard.ts +137 -0
- package/src/notifications/telegram-callback-ingest.ts +126 -0
- package/src/notifications/telegram-inbound-router.ts +166 -0
- package/src/notifications/telegram-media-policy.ts +50 -0
- package/src/notifications/telegram-media-render.ts +40 -0
- package/src/notifications/telegram-message-ingest.ts +121 -0
- package/src/notifications/telegram-pairing.ts +69 -0
- package/src/notifications/threaded-lifecycle.ts +27 -0
- package/src/notifications/threaded-shutdown.ts +37 -0
- package/src/notifications/threaded-surface.ts +187 -0
- package/src/notifications/transport-shell.ts +152 -0
- package/src/notifications/transport-state.ts +161 -0
- package/src/notifications/workspace-path-confinement.ts +65 -0
- package/src/plan-mode/approved-plan.ts +163 -0
- package/src/plan-mode/state.ts +6 -0
- package/src/prompts/agents/architect.md +95 -0
- package/src/prompts/agents/critic.md +68 -0
- package/src/prompts/agents/executor.md +64 -0
- package/src/prompts/agents/explore.md +58 -0
- package/src/prompts/agents/frontmatter.md +14 -0
- package/src/prompts/agents/init.md +34 -0
- package/src/prompts/agents/plan.md +49 -0
- package/src/prompts/agents/planner.md +63 -0
- package/src/prompts/agents/reviewer.md +141 -0
- package/src/prompts/agents/task.md +16 -0
- package/src/prompts/ci-green-request.md +36 -0
- package/src/prompts/goals/goal-continuation.md +33 -0
- package/src/prompts/goals/goal-mode-active.md +23 -0
- package/src/prompts/jaw/orchestrate-a.md +20 -0
- package/src/prompts/jaw/orchestrate-audit-architect.md +17 -0
- package/src/prompts/jaw/orchestrate-audit-planner.md +17 -0
- package/src/prompts/jaw/orchestrate-b.md +17 -0
- package/src/prompts/jaw/orchestrate-c.md +18 -0
- package/src/prompts/jaw/orchestrate-d.md +32 -0
- package/src/prompts/jaw/orchestrate-i.md +17 -0
- package/src/prompts/jaw/orchestrate-p.md +23 -0
- package/src/prompts/memories/consolidation.md +30 -0
- package/src/prompts/memories/read-path.md +10 -0
- package/src/prompts/memories/stage_one_input.md +6 -0
- package/src/prompts/memories/stage_one_system.md +21 -0
- package/src/prompts/memories/unavailable.md +9 -0
- package/src/prompts/review-request.md +70 -0
- package/src/prompts/system/agent-creation-architect.md +75 -0
- package/src/prompts/system/agent-creation-user.md +6 -0
- package/src/prompts/system/auto-continue.md +1 -0
- package/src/prompts/system/btw-user.md +8 -0
- package/src/prompts/system/commit-message-system.md +2 -0
- package/src/prompts/system/custom-system-prompt.md +64 -0
- package/src/prompts/system/eager-todo.md +13 -0
- package/src/prompts/system/executor-self-fork.md +3 -0
- package/src/prompts/system/irc-incoming.md +8 -0
- package/src/prompts/system/plan-mode-active.md +116 -0
- package/src/prompts/system/plan-mode-approved.md +28 -0
- package/src/prompts/system/plan-mode-compact-instructions.md +16 -0
- package/src/prompts/system/plan-mode-reference.md +14 -0
- package/src/prompts/system/plan-mode-subagent.md +34 -0
- package/src/prompts/system/plan-mode-tool-decision-reminder.md +9 -0
- package/src/prompts/system/project-prompt.md +46 -0
- package/src/prompts/system/subagent-system-prompt.md +89 -0
- package/src/prompts/system/subagent-user-prompt.md +3 -0
- package/src/prompts/system/subagent-yield-reminder.md +12 -0
- package/src/prompts/system/system-prompt.md +409 -0
- package/src/prompts/system/title-system.md +2 -0
- package/src/prompts/system/ttsr-interrupt.md +7 -0
- package/src/prompts/system/ttsr-tool-reminder.md +5 -0
- package/src/prompts/system/web-search.md +25 -0
- package/src/prompts/tools/apply-patch.md +65 -0
- package/src/prompts/tools/ask.md +29 -0
- package/src/prompts/tools/ast-edit.md +39 -0
- package/src/prompts/tools/ast-grep.md +42 -0
- package/src/prompts/tools/async-result.md +8 -0
- package/src/prompts/tools/background.md +19 -0
- package/src/prompts/tools/bash.md +50 -0
- package/src/prompts/tools/browser.md +14 -0
- package/src/prompts/tools/calculator.md +10 -0
- package/src/prompts/tools/checkpoint.md +16 -0
- package/src/prompts/tools/computer-use.md +15 -0
- package/src/prompts/tools/cron.md +25 -0
- package/src/prompts/tools/debug.md +33 -0
- package/src/prompts/tools/eval.md +75 -0
- package/src/prompts/tools/find.md +34 -0
- package/src/prompts/tools/github.md +20 -0
- package/src/prompts/tools/goal.md +20 -0
- package/src/prompts/tools/hashline.md +130 -0
- package/src/prompts/tools/image-gen.md +7 -0
- package/src/prompts/tools/inspect-image-system.md +20 -0
- package/src/prompts/tools/inspect-image.md +32 -0
- package/src/prompts/tools/irc.md +49 -0
- package/src/prompts/tools/job.md +22 -0
- package/src/prompts/tools/lsp.md +42 -0
- package/src/prompts/tools/monitor.md +32 -0
- package/src/prompts/tools/patch.md +70 -0
- package/src/prompts/tools/read.md +82 -0
- package/src/prompts/tools/recall.md +6 -0
- package/src/prompts/tools/recipe.md +16 -0
- package/src/prompts/tools/reflect.md +6 -0
- package/src/prompts/tools/render-mermaid.md +9 -0
- package/src/prompts/tools/replace.md +36 -0
- package/src/prompts/tools/resolve.md +9 -0
- package/src/prompts/tools/retain.md +7 -0
- package/src/prompts/tools/rewind.md +13 -0
- package/src/prompts/tools/search-tool-bm25.md +37 -0
- package/src/prompts/tools/search.md +25 -0
- package/src/prompts/tools/skill.md +28 -0
- package/src/prompts/tools/ssh.md +35 -0
- package/src/prompts/tools/subagent.md +56 -0
- package/src/prompts/tools/task-summary.md +22 -0
- package/src/prompts/tools/task.md +106 -0
- package/src/prompts/tools/todo-write.md +50 -0
- package/src/prompts/tools/vim.md +98 -0
- package/src/prompts/tools/web-search.md +10 -0
- package/src/prompts/tools/write.md +14 -0
- package/src/registry/agent-registry.ts +140 -0
- package/src/reminders/star-reminder.ts +422 -0
- package/src/runtime-mcp/client.ts +485 -0
- package/src/runtime-mcp/config-writer.ts +225 -0
- package/src/runtime-mcp/config.ts +365 -0
- package/src/runtime-mcp/discoverable-tool-metadata.ts +25 -0
- package/src/runtime-mcp/index.ts +29 -0
- package/src/runtime-mcp/json-rpc.ts +84 -0
- package/src/runtime-mcp/loader.ts +124 -0
- package/src/runtime-mcp/manager.ts +1211 -0
- package/src/runtime-mcp/oauth-discovery.ts +349 -0
- package/src/runtime-mcp/oauth-flow.ts +409 -0
- package/src/runtime-mcp/render.ts +123 -0
- package/src/runtime-mcp/smithery-auth.ts +104 -0
- package/src/runtime-mcp/smithery-connect.ts +145 -0
- package/src/runtime-mcp/smithery-registry.ts +477 -0
- package/src/runtime-mcp/tool-bridge.ts +416 -0
- package/src/runtime-mcp/tool-cache.ts +117 -0
- package/src/runtime-mcp/transports/http.ts +503 -0
- package/src/runtime-mcp/transports/index.ts +6 -0
- package/src/runtime-mcp/transports/stdio.ts +326 -0
- package/src/runtime-mcp/types.ts +423 -0
- package/src/sdk.ts +2248 -0
- package/src/secrets/index.ts +120 -0
- package/src/secrets/obfuscator.ts +352 -0
- package/src/secrets/regex.ts +21 -0
- package/src/session/agent-session.ts +10343 -0
- package/src/session/agent-storage.ts +466 -0
- package/src/session/artifacts.ts +135 -0
- package/src/session/auth-broker-config.ts +102 -0
- package/src/session/auth-storage.ts +23 -0
- package/src/session/blob-store.ts +372 -0
- package/src/session/client-bridge.ts +85 -0
- package/src/session/contribution-prep.ts +320 -0
- package/src/session/history-storage.ts +311 -0
- package/src/session/messages.ts +406 -0
- package/src/session/pabcd-stage-header.ts +77 -0
- package/src/session/session-dump-format.ts +209 -0
- package/src/session/session-manager.ts +3914 -0
- package/src/session/session-storage.ts +415 -0
- package/src/session/streaming-output.ts +1114 -0
- package/src/session/tool-choice-queue.ts +213 -0
- package/src/session/yield-queue.ts +155 -0
- package/src/setup/hermes/templates/operator-instructions.v1.md +29 -0
- package/src/setup/hermes-setup.ts +429 -0
- package/src/setup/model-onboarding-guidance.ts +41 -0
- package/src/setup/provider-onboarding.ts +358 -0
- package/src/skill-state/active-state.ts +788 -0
- package/src/skill-state/initial-phase.ts +21 -0
- package/src/skill-state/jaw-interview-mutation-guard.ts +490 -0
- package/src/skill-state/workflow-hud.ts +208 -0
- package/src/skill-state/workflow-state-contract.ts +167 -0
- package/src/skill-state/workflow-state-version.ts +3 -0
- package/src/slash-commands/acp-builtins.ts +55 -0
- package/src/slash-commands/builtin-registry.ts +1879 -0
- package/src/slash-commands/helpers/context-report.ts +149 -0
- package/src/slash-commands/helpers/format.ts +46 -0
- package/src/slash-commands/helpers/mcp.ts +532 -0
- package/src/slash-commands/helpers/parse.ts +85 -0
- package/src/slash-commands/helpers/ssh.ts +195 -0
- package/src/slash-commands/helpers/todo.ts +279 -0
- package/src/slash-commands/helpers/usage-report.ts +105 -0
- package/src/slash-commands/types.ts +127 -0
- package/src/ssh/config-writer.ts +183 -0
- package/src/ssh/connection-manager.ts +482 -0
- package/src/ssh/ssh-executor.ts +133 -0
- package/src/ssh/sshfs-mount.ts +140 -0
- package/src/ssh/utils.ts +8 -0
- package/src/stt/downloader.ts +71 -0
- package/src/stt/index.ts +3 -0
- package/src/stt/recorder.ts +351 -0
- package/src/stt/setup.ts +52 -0
- package/src/stt/stt-controller.ts +160 -0
- package/src/stt/transcribe.py +70 -0
- package/src/stt/transcriber.ts +91 -0
- package/src/system-prompt.ts +661 -0
- package/src/task/agents.ts +189 -0
- package/src/task/commands.ts +131 -0
- package/src/task/discovery.ts +136 -0
- package/src/task/executor.ts +1664 -0
- package/src/task/fork-context-advisory.ts +99 -0
- package/src/task/id.ts +33 -0
- package/src/task/index.ts +2173 -0
- package/src/task/jwc-command.ts +26 -0
- package/src/task/model-presets.ts +53 -0
- package/src/task/name-generator.ts +1577 -0
- package/src/task/output-manager.ts +108 -0
- package/src/task/parallel.ts +116 -0
- package/src/task/receipt.ts +304 -0
- package/src/task/render.ts +1075 -0
- package/src/task/roi-reconciliation.ts +90 -0
- package/src/task/simple-mode.ts +27 -0
- package/src/task/spawn-gate.ts +132 -0
- package/src/task/subprocess-tool-registry.ts +88 -0
- package/src/task/types.ts +433 -0
- package/src/task/worktree.ts +506 -0
- package/src/thinking.ts +93 -0
- package/src/tool-discovery/tool-index.ts +408 -0
- package/src/tools/archive-reader.ts +321 -0
- package/src/tools/ask.ts +1011 -0
- package/src/tools/ast-edit.ts +555 -0
- package/src/tools/ast-grep.ts +424 -0
- package/src/tools/auto-generated-guard.ts +305 -0
- package/src/tools/background.ts +500 -0
- package/src/tools/bash-allowed-prefixes.ts +169 -0
- package/src/tools/bash-command-fixup.ts +37 -0
- package/src/tools/bash-interactive.ts +388 -0
- package/src/tools/bash-interceptor.ts +67 -0
- package/src/tools/bash-pty-selection.ts +15 -0
- package/src/tools/bash-skill-urls.ts +248 -0
- package/src/tools/bash.ts +1242 -0
- package/src/tools/browser/actions.ts +189 -0
- package/src/tools/browser/attach.ts +175 -0
- package/src/tools/browser/launch.ts +651 -0
- package/src/tools/browser/readable.ts +95 -0
- package/src/tools/browser/registry.ts +194 -0
- package/src/tools/browser/render.ts +212 -0
- package/src/tools/browser/tab-protocol.ts +105 -0
- package/src/tools/browser/tab-supervisor.ts +577 -0
- package/src/tools/browser/tab-worker-entry.ts +21 -0
- package/src/tools/browser/tab-worker.ts +1054 -0
- package/src/tools/browser.ts +380 -0
- package/src/tools/calculator.ts +540 -0
- package/src/tools/checkpoint.ts +134 -0
- package/src/tools/computer-use-backend.ts +75 -0
- package/src/tools/computer-use.ts +228 -0
- package/src/tools/conflict-detect.ts +672 -0
- package/src/tools/context.ts +39 -0
- package/src/tools/cron.ts +713 -0
- package/src/tools/debug.ts +1014 -0
- package/src/tools/eval.ts +1101 -0
- package/src/tools/fetch.ts +1485 -0
- package/src/tools/file-recorder.ts +35 -0
- package/src/tools/find.ts +543 -0
- package/src/tools/fs-cache-invalidation.ts +28 -0
- package/src/tools/gh-format.ts +12 -0
- package/src/tools/gh-renderer.ts +428 -0
- package/src/tools/gh.ts +3737 -0
- package/src/tools/github-cache.ts +548 -0
- package/src/tools/grouped-file-output.ts +96 -0
- package/src/tools/hindsight-recall.ts +66 -0
- package/src/tools/hindsight-reflect.ts +55 -0
- package/src/tools/hindsight-retain.ts +54 -0
- package/src/tools/image-gen.ts +1284 -0
- package/src/tools/index.ts +580 -0
- package/src/tools/inspect-image-renderer.ts +103 -0
- package/src/tools/inspect-image.ts +167 -0
- package/src/tools/irc.ts +239 -0
- package/src/tools/job.ts +530 -0
- package/src/tools/json-tree.ts +243 -0
- package/src/tools/jtd-to-json-schema.ts +219 -0
- package/src/tools/jtd-to-typescript.ts +136 -0
- package/src/tools/jtd-utils.ts +102 -0
- package/src/tools/list-limit.ts +40 -0
- package/src/tools/match-line-format.ts +22 -0
- package/src/tools/monitor.ts +255 -0
- package/src/tools/output-meta.ts +754 -0
- package/src/tools/path-utils.ts +741 -0
- package/src/tools/plan-mode-guard.ts +68 -0
- package/src/tools/puppeteer/00_stealth_tampering.txt +63 -0
- package/src/tools/puppeteer/01_stealth_activity.txt +20 -0
- package/src/tools/puppeteer/02_stealth_hairline.txt +11 -0
- package/src/tools/puppeteer/03_stealth_botd.txt +384 -0
- package/src/tools/puppeteer/04_stealth_iframe.txt +81 -0
- package/src/tools/puppeteer/05_stealth_webgl.txt +75 -0
- package/src/tools/puppeteer/06_stealth_screen.txt +72 -0
- package/src/tools/puppeteer/07_stealth_fonts.txt +97 -0
- package/src/tools/puppeteer/08_stealth_audio.txt +51 -0
- package/src/tools/puppeteer/09_stealth_locale.txt +46 -0
- package/src/tools/puppeteer/10_stealth_plugins.txt +206 -0
- package/src/tools/puppeteer/11_stealth_hardware.txt +8 -0
- package/src/tools/puppeteer/12_stealth_codecs.txt +40 -0
- package/src/tools/puppeteer/13_stealth_worker.txt +74 -0
- package/src/tools/read.ts +2333 -0
- package/src/tools/recipe/index.ts +80 -0
- package/src/tools/recipe/render.ts +19 -0
- package/src/tools/recipe/runner.ts +219 -0
- package/src/tools/recipe/runners/cargo.ts +131 -0
- package/src/tools/recipe/runners/index.ts +8 -0
- package/src/tools/recipe/runners/just.ts +73 -0
- package/src/tools/recipe/runners/make.ts +101 -0
- package/src/tools/recipe/runners/pkg.ts +167 -0
- package/src/tools/recipe/runners/task.ts +72 -0
- package/src/tools/render-mermaid.ts +68 -0
- package/src/tools/render-utils.ts +774 -0
- package/src/tools/renderers.ts +79 -0
- package/src/tools/resolve.ts +258 -0
- package/src/tools/review.ts +252 -0
- package/src/tools/search-tool-bm25.ts +364 -0
- package/src/tools/search.ts +787 -0
- package/src/tools/skill.ts +170 -0
- package/src/tools/sqlite-reader.ts +736 -0
- package/src/tools/ssh.ts +310 -0
- package/src/tools/subagent-render.ts +160 -0
- package/src/tools/subagent.ts +698 -0
- package/src/tools/telegram-send.ts +178 -0
- package/src/tools/todo-write.ts +695 -0
- package/src/tools/tool-errors.ts +62 -0
- package/src/tools/tool-result.ts +86 -0
- package/src/tools/tool-timeouts.ts +30 -0
- package/src/tools/vim.ts +949 -0
- package/src/tools/write.ts +953 -0
- package/src/tools/yield.ts +268 -0
- package/src/tui/code-cell.ts +201 -0
- package/src/tui/file-list.ts +55 -0
- package/src/tui/hyperlink.ts +126 -0
- package/src/tui/index.ts +12 -0
- package/src/tui/output-block.ts +150 -0
- package/src/tui/status-line.ts +39 -0
- package/src/tui/tree-list.ts +84 -0
- package/src/tui/types.ts +15 -0
- package/src/tui/utils.ts +103 -0
- package/src/utils/changelog.ts +121 -0
- package/src/utils/clipboard.ts +156 -0
- package/src/utils/command-args.ts +76 -0
- package/src/utils/commit-message-generator.ts +135 -0
- package/src/utils/edit-mode.ts +42 -0
- package/src/utils/event-bus.ts +33 -0
- package/src/utils/external-editor.ts +65 -0
- package/src/utils/file-display-mode.ts +45 -0
- package/src/utils/file-mentions.ts +376 -0
- package/src/utils/git.ts +1536 -0
- package/src/utils/image-loading.ts +102 -0
- package/src/utils/image-resize.ts +309 -0
- package/src/utils/lang-from-path.ts +239 -0
- package/src/utils/markit.ts +89 -0
- package/src/utils/open.ts +20 -0
- package/src/utils/session-color.ts +43 -0
- package/src/utils/shell-snapshot.ts +187 -0
- package/src/utils/sixel.ts +69 -0
- package/src/utils/title-generator.ts +237 -0
- package/src/utils/tokenizer-download.ts +106 -0
- package/src/utils/tokenizer-encoding.ts +29 -0
- package/src/utils/tool-choice.ts +62 -0
- package/src/utils/tools-manager.ts +363 -0
- package/src/vim/buffer.ts +309 -0
- package/src/vim/commands.ts +382 -0
- package/src/vim/engine.ts +2409 -0
- package/src/vim/parser.ts +134 -0
- package/src/vim/render.ts +252 -0
- package/src/vim/types.ts +197 -0
- package/src/web/kagi.ts +183 -0
- package/src/web/parallel.ts +349 -0
- package/src/web/public-fetch-url.ts +74 -0
- package/src/web/scrapers/artifacthub.ts +207 -0
- package/src/web/scrapers/arxiv.ts +83 -0
- package/src/web/scrapers/aur.ts +162 -0
- package/src/web/scrapers/biorxiv.ts +133 -0
- package/src/web/scrapers/bluesky.ts +262 -0
- package/src/web/scrapers/brew.ts +172 -0
- package/src/web/scrapers/cheatsh.ts +68 -0
- package/src/web/scrapers/chocolatey.ts +196 -0
- package/src/web/scrapers/choosealicense.ts +95 -0
- package/src/web/scrapers/cisa-kev.ts +87 -0
- package/src/web/scrapers/clojars.ts +154 -0
- package/src/web/scrapers/coingecko.ts +177 -0
- package/src/web/scrapers/crates-io.ts +97 -0
- package/src/web/scrapers/crossref.ts +136 -0
- package/src/web/scrapers/devto.ts +147 -0
- package/src/web/scrapers/discogs.ts +306 -0
- package/src/web/scrapers/discourse.ts +197 -0
- package/src/web/scrapers/dockerhub.ts +138 -0
- package/src/web/scrapers/docs-rs.ts +653 -0
- package/src/web/scrapers/fdroid.ts +134 -0
- package/src/web/scrapers/firefox-addons.ts +191 -0
- package/src/web/scrapers/flathub.ts +223 -0
- package/src/web/scrapers/github-gist.ts +58 -0
- package/src/web/scrapers/github.ts +452 -0
- package/src/web/scrapers/gitlab.ts +401 -0
- package/src/web/scrapers/go-pkg.ts +266 -0
- package/src/web/scrapers/hackage.ts +140 -0
- package/src/web/scrapers/hackernews.ts +189 -0
- package/src/web/scrapers/hex.ts +105 -0
- package/src/web/scrapers/huggingface.ts +321 -0
- package/src/web/scrapers/iacr.ts +89 -0
- package/src/web/scrapers/index.ts +252 -0
- package/src/web/scrapers/jetbrains-marketplace.ts +159 -0
- package/src/web/scrapers/lemmy.ts +203 -0
- package/src/web/scrapers/lobsters.ts +175 -0
- package/src/web/scrapers/mastodon.ts +292 -0
- package/src/web/scrapers/maven.ts +138 -0
- package/src/web/scrapers/mdn.ts +173 -0
- package/src/web/scrapers/metacpan.ts +222 -0
- package/src/web/scrapers/musicbrainz.ts +250 -0
- package/src/web/scrapers/npm.ts +98 -0
- package/src/web/scrapers/nuget.ts +183 -0
- package/src/web/scrapers/nvd.ts +222 -0
- package/src/web/scrapers/ollama.ts +239 -0
- package/src/web/scrapers/open-vsx.ts +106 -0
- package/src/web/scrapers/opencorporates.ts +292 -0
- package/src/web/scrapers/openlibrary.ts +336 -0
- package/src/web/scrapers/orcid.ts +286 -0
- package/src/web/scrapers/osv.ts +176 -0
- package/src/web/scrapers/packagist.ts +160 -0
- package/src/web/scrapers/pub-dev.ts +143 -0
- package/src/web/scrapers/pubmed.ts +211 -0
- package/src/web/scrapers/pypi.ts +112 -0
- package/src/web/scrapers/rawg.ts +110 -0
- package/src/web/scrapers/readthedocs.ts +120 -0
- package/src/web/scrapers/reddit.ts +95 -0
- package/src/web/scrapers/repology.ts +251 -0
- package/src/web/scrapers/rfc.ts +201 -0
- package/src/web/scrapers/rubygems.ts +103 -0
- package/src/web/scrapers/searchcode.ts +189 -0
- package/src/web/scrapers/sec-edgar.ts +261 -0
- package/src/web/scrapers/semantic-scholar.ts +171 -0
- package/src/web/scrapers/snapcraft.ts +187 -0
- package/src/web/scrapers/sourcegraph.ts +336 -0
- package/src/web/scrapers/spdx.ts +108 -0
- package/src/web/scrapers/spotify.ts +198 -0
- package/src/web/scrapers/stackoverflow.ts +120 -0
- package/src/web/scrapers/terraform.ts +277 -0
- package/src/web/scrapers/tldr.ts +47 -0
- package/src/web/scrapers/twitter.ts +93 -0
- package/src/web/scrapers/types.ts +358 -0
- package/src/web/scrapers/utils.ts +133 -0
- package/src/web/scrapers/vimeo.ts +133 -0
- package/src/web/scrapers/vscode-marketplace.ts +187 -0
- package/src/web/scrapers/w3c.ts +156 -0
- package/src/web/scrapers/wikidata.ts +344 -0
- package/src/web/scrapers/wikipedia.ts +84 -0
- package/src/web/scrapers/youtube.ts +319 -0
- package/src/web/search/index.ts +416 -0
- package/src/web/search/provider.ts +236 -0
- package/src/web/search/providers/anthropic.ts +319 -0
- package/src/web/search/providers/base.ts +102 -0
- package/src/web/search/providers/brave.ts +149 -0
- package/src/web/search/providers/codex.ts +598 -0
- package/src/web/search/providers/duckduckgo.ts +279 -0
- package/src/web/search/providers/exa.ts +193 -0
- package/src/web/search/providers/gemini.ts +462 -0
- package/src/web/search/providers/jina.ts +101 -0
- package/src/web/search/providers/kagi.ts +75 -0
- package/src/web/search/providers/kimi.ts +171 -0
- package/src/web/search/providers/parallel.ts +210 -0
- package/src/web/search/providers/perplexity.ts +575 -0
- package/src/web/search/providers/searxng.ts +309 -0
- package/src/web/search/providers/synthetic.ts +108 -0
- package/src/web/search/providers/tavily.ts +173 -0
- package/src/web/search/providers/utils.ts +128 -0
- package/src/web/search/providers/xai.ts +174 -0
- package/src/web/search/providers/zai.ts +320 -0
- package/src/web/search/render.ts +299 -0
- package/src/web/search/types.ts +445 -0
- package/src/web/search/utils.ts +17 -0
- package/src/workspace-tree.ts +286 -0
|
@@ -0,0 +1,2214 @@
|
|
|
1
|
+
import * as crypto from "node:crypto";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { APP_NAME } from "@jawcode-dev/utils";
|
|
4
|
+
import type { WorkflowHudSummary } from "../skill-state/active-state";
|
|
5
|
+
import { buildGoalHudSummary as buildWorkflowGoalHudSummary } from "../skill-state/workflow-hud";
|
|
6
|
+
import { renderCliWriteReceipt } from "./cli-write-receipt";
|
|
7
|
+
import { DEFAULT_GOAL_OBJECTIVE, resolveCliWorkflowSessionId } from "./goal-mode-request";
|
|
8
|
+
import { resolveGoalStoragePaths } from "./legacy-storage";
|
|
9
|
+
import { renderGoalStatusMarkdown } from "./state-renderer";
|
|
10
|
+
import { reconcileWorkflowSkillState } from "./state-runtime";
|
|
11
|
+
import { appendJsonl, writeArtifact, writeJsonAtomic } from "./state-writer";
|
|
12
|
+
|
|
13
|
+
export type GoalJwcGoalMode = "aggregate" | "per-story";
|
|
14
|
+
export type GoalStatus = "pending" | "active" | "complete" | "failed" | "blocked" | "review_blocked" | "superseded";
|
|
15
|
+
|
|
16
|
+
export interface GoalEntry {
|
|
17
|
+
id: string;
|
|
18
|
+
title: string;
|
|
19
|
+
objective: string;
|
|
20
|
+
status: GoalStatus;
|
|
21
|
+
createdAt: string;
|
|
22
|
+
updatedAt: string;
|
|
23
|
+
startedAt?: string;
|
|
24
|
+
completedAt?: string;
|
|
25
|
+
evidence?: string;
|
|
26
|
+
steering?: Record<string, unknown>;
|
|
27
|
+
completionVerification?: GoalCompletionVerification;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface GoalPlan {
|
|
31
|
+
version: 1;
|
|
32
|
+
brief: string;
|
|
33
|
+
jwcGoalMode: GoalJwcGoalMode;
|
|
34
|
+
jwcObjective: string;
|
|
35
|
+
jwcObjectiveAliases?: string[];
|
|
36
|
+
goals: GoalEntry[];
|
|
37
|
+
createdAt: string;
|
|
38
|
+
updatedAt: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type GoalReceiptKind = "per-goal" | "final-aggregate";
|
|
42
|
+
|
|
43
|
+
export interface GoalCompletionVerification {
|
|
44
|
+
schemaVersion: 1;
|
|
45
|
+
receiptId: string;
|
|
46
|
+
verifiedAt: string;
|
|
47
|
+
goalId: string;
|
|
48
|
+
receiptKind: GoalReceiptKind;
|
|
49
|
+
goalStatusBeforeCheckpoint: GoalStatus;
|
|
50
|
+
jwcGoalMode: GoalJwcGoalMode;
|
|
51
|
+
jwcObjective: string;
|
|
52
|
+
qualityGateHash: string;
|
|
53
|
+
jwcGoalSnapshotHash: string;
|
|
54
|
+
planGeneration: string;
|
|
55
|
+
basis: {
|
|
56
|
+
planHashBeforeCheckpoint: string;
|
|
57
|
+
latestRelevantLedgerEventIdBeforeCheckpoint: string | null;
|
|
58
|
+
goalUpdatedAtBeforeCheckpoint: string;
|
|
59
|
+
relevantGoalIdsBeforeCheckpoint: string[];
|
|
60
|
+
requiredGoalSetHashBeforeCheckpoint: string;
|
|
61
|
+
};
|
|
62
|
+
checkpointLedgerEventId: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface GoalLedgerEvent extends JsonObject {
|
|
66
|
+
eventId?: string;
|
|
67
|
+
event?: string;
|
|
68
|
+
goalId?: string;
|
|
69
|
+
timestamp?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface GoalPaths {
|
|
73
|
+
dir: string;
|
|
74
|
+
briefPath: string;
|
|
75
|
+
goalsPath: string;
|
|
76
|
+
ledgerPath: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface GoalStatusSummary {
|
|
80
|
+
exists: boolean;
|
|
81
|
+
status: "missing" | "pending" | "active" | "complete" | "blocked" | "failed";
|
|
82
|
+
paths: GoalPaths;
|
|
83
|
+
jwcObjective?: string;
|
|
84
|
+
currentGoal?: GoalEntry;
|
|
85
|
+
counts: Record<GoalStatus, number>;
|
|
86
|
+
goals: GoalEntry[];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface GoalEngineCommandResult {
|
|
90
|
+
status: number;
|
|
91
|
+
stdout?: string;
|
|
92
|
+
stderr?: string;
|
|
93
|
+
createdPlan?: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface JsonObject {
|
|
97
|
+
[key: string]: unknown;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const TERMINAL_OR_SKIPPED_STATUSES = new Set<GoalStatus>(["complete", "superseded"]);
|
|
101
|
+
const CLEAN_ARCHITECT_STATUS = "CLEAR";
|
|
102
|
+
const APPROVE_RECOMMENDATION = "APPROVE";
|
|
103
|
+
const PASSED_STATUS = "passed";
|
|
104
|
+
const NOT_APPLICABLE_STATUS = "not_applicable";
|
|
105
|
+
const COVERED_STATUS = "covered";
|
|
106
|
+
const ACCEPTED_PROOF_STATUSES = new Set([COVERED_STATUS, "passed", "verified"]);
|
|
107
|
+
const MIN_SUBSTANTIVE_EVIDENCE_WORDS = 5;
|
|
108
|
+
const MIN_SUBSTANTIVE_EVIDENCE_CHARS = 32;
|
|
109
|
+
|
|
110
|
+
const GJC_GOAL_SNAPSHOT_MAX_AGE_MILLISECONDS = 10 * 60 * 1000;
|
|
111
|
+
const GJC_GOAL_SNAPSHOT_MAX_FUTURE_SKEW_MILLISECONDS = 60 * 1000;
|
|
112
|
+
|
|
113
|
+
const SCHEDULABLE_STATUSES = new Set<GoalStatus>(["pending", "active", "failed"]);
|
|
114
|
+
|
|
115
|
+
function stableStructuredValue(value: unknown): unknown {
|
|
116
|
+
if (Array.isArray(value)) return value.map(item => stableStructuredValue(item));
|
|
117
|
+
if (typeof value !== "object" || value === null) return value;
|
|
118
|
+
const record = value as Record<string, unknown>;
|
|
119
|
+
const sorted: Record<string, unknown> = {};
|
|
120
|
+
for (const key of Object.keys(record).sort()) {
|
|
121
|
+
const item = record[key];
|
|
122
|
+
if (item !== undefined) sorted[key] = stableStructuredValue(item);
|
|
123
|
+
}
|
|
124
|
+
return sorted;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function hashStructuredValue(value: unknown): string {
|
|
128
|
+
return crypto
|
|
129
|
+
.createHash("sha256")
|
|
130
|
+
.update(JSON.stringify(stableStructuredValue(value)))
|
|
131
|
+
.digest("hex");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function getGoalPaths(cwd: string): GoalPaths {
|
|
135
|
+
const dir = path.join(cwd, ".jwc", "goal");
|
|
136
|
+
return {
|
|
137
|
+
dir,
|
|
138
|
+
briefPath: path.join(dir, "brief.md"),
|
|
139
|
+
goalsPath: path.join(dir, "goals.json"),
|
|
140
|
+
ledgerPath: path.join(dir, "ledger.jsonl"),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function isEnoent(error: unknown): boolean {
|
|
145
|
+
return (
|
|
146
|
+
typeof error === "object" && error !== null && "code" in error && (error as { code?: unknown }).code === "ENOENT"
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async function appendLedger(cwd: string, event: JsonObject): Promise<GoalLedgerEvent> {
|
|
151
|
+
const paths = getGoalPaths(cwd);
|
|
152
|
+
const entry: GoalLedgerEvent = {
|
|
153
|
+
eventId: typeof event.eventId === "string" ? event.eventId : crypto.randomUUID(),
|
|
154
|
+
...event,
|
|
155
|
+
timestamp: new Date().toISOString(),
|
|
156
|
+
};
|
|
157
|
+
await appendJsonl(paths.ledgerPath, entry, {
|
|
158
|
+
cwd,
|
|
159
|
+
audit: { category: "ledger", verb: "append", owner: "jwc-runtime" },
|
|
160
|
+
});
|
|
161
|
+
return entry;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export async function readGoalLedger(cwd: string): Promise<GoalLedgerEvent[]> {
|
|
165
|
+
const paths = await resolveGoalStoragePaths(cwd);
|
|
166
|
+
try {
|
|
167
|
+
const raw = await Bun.file(paths.ledgerPath).text();
|
|
168
|
+
return raw
|
|
169
|
+
.split(/\r?\n/)
|
|
170
|
+
.map(line => line.trim())
|
|
171
|
+
.filter(line => line.length > 0)
|
|
172
|
+
.map(line => JSON.parse(line) as GoalLedgerEvent);
|
|
173
|
+
} catch (error) {
|
|
174
|
+
if (isEnoent(error)) return [];
|
|
175
|
+
throw error;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async function writePlan(cwd: string, plan: GoalPlan): Promise<void> {
|
|
180
|
+
const paths = getGoalPaths(cwd);
|
|
181
|
+
await writeArtifact(paths.briefPath, `${plan.brief.trim()}\n`, {
|
|
182
|
+
cwd,
|
|
183
|
+
audit: { category: "artifact", verb: "write", owner: "jwc-runtime" },
|
|
184
|
+
});
|
|
185
|
+
await writeJsonAtomic(paths.goalsPath, plan, {
|
|
186
|
+
cwd,
|
|
187
|
+
audit: { category: "state", verb: "write", owner: "jwc-runtime" },
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function requiredGoalEntries(plan: GoalPlan): GoalEntry[] {
|
|
192
|
+
return plan.goals.filter(goal => goal.status !== "superseded");
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function receiptRelevantGoals(plan: GoalPlan, goal: GoalEntry, receiptKind: GoalReceiptKind): GoalEntry[] {
|
|
196
|
+
return receiptKind === "final-aggregate" ? requiredGoalEntries(plan) : [goal];
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function ledgerEventId(event: GoalLedgerEvent): string | null {
|
|
200
|
+
return typeof event.eventId === "string" && event.eventId.trim().length > 0 ? event.eventId : null;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function latestRelevantLedgerEventId(
|
|
204
|
+
ledger: readonly GoalLedgerEvent[],
|
|
205
|
+
relevantGoalIds: readonly string[],
|
|
206
|
+
excludeEventId?: string,
|
|
207
|
+
): string | null {
|
|
208
|
+
const relevant = new Set(relevantGoalIds);
|
|
209
|
+
for (const event of [...ledger].reverse()) {
|
|
210
|
+
const eventId = ledgerEventId(event);
|
|
211
|
+
if (eventId && eventId === excludeEventId) continue;
|
|
212
|
+
const goalId = typeof event.goalId === "string" ? event.goalId : null;
|
|
213
|
+
if (!goalId || relevant.has(goalId)) return eventId;
|
|
214
|
+
}
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function planSnapshotForReceipt(input: {
|
|
219
|
+
plan: GoalPlan;
|
|
220
|
+
goal: GoalEntry;
|
|
221
|
+
beforeStatus: GoalStatus;
|
|
222
|
+
targetGoalUpdatedAt: string;
|
|
223
|
+
receiptKind: GoalReceiptKind;
|
|
224
|
+
}): unknown {
|
|
225
|
+
const targetGoalSnapshot = {
|
|
226
|
+
...input.goal,
|
|
227
|
+
status: input.beforeStatus,
|
|
228
|
+
updatedAt: input.targetGoalUpdatedAt,
|
|
229
|
+
evidence: undefined,
|
|
230
|
+
completedAt: undefined,
|
|
231
|
+
completionVerification: undefined,
|
|
232
|
+
};
|
|
233
|
+
const goals =
|
|
234
|
+
input.receiptKind === "final-aggregate"
|
|
235
|
+
? input.plan.goals.map(goal => ({
|
|
236
|
+
...goal,
|
|
237
|
+
status: goal.id === input.goal.id ? input.beforeStatus : goal.status,
|
|
238
|
+
updatedAt: goal.id === input.goal.id ? input.targetGoalUpdatedAt : goal.updatedAt,
|
|
239
|
+
evidence: goal.id === input.goal.id ? undefined : goal.evidence,
|
|
240
|
+
completedAt: goal.id === input.goal.id ? undefined : goal.completedAt,
|
|
241
|
+
completionVerification: undefined,
|
|
242
|
+
}))
|
|
243
|
+
: [targetGoalSnapshot];
|
|
244
|
+
return {
|
|
245
|
+
version: input.plan.version,
|
|
246
|
+
brief: input.plan.brief,
|
|
247
|
+
jwcGoalMode: input.plan.jwcGoalMode,
|
|
248
|
+
jwcObjective: input.plan.jwcObjective,
|
|
249
|
+
jwcObjectiveAliases: input.plan.jwcObjectiveAliases,
|
|
250
|
+
createdAt: input.plan.createdAt,
|
|
251
|
+
goals,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export function computeGoalPlanGeneration(input: {
|
|
256
|
+
plan: GoalPlan;
|
|
257
|
+
ledger: readonly GoalLedgerEvent[];
|
|
258
|
+
goal: GoalEntry;
|
|
259
|
+
receiptKind: GoalReceiptKind;
|
|
260
|
+
beforeStatus: GoalStatus;
|
|
261
|
+
excludeEventId?: string;
|
|
262
|
+
targetGoalUpdatedAt?: string;
|
|
263
|
+
}): {
|
|
264
|
+
planGeneration: string;
|
|
265
|
+
basis: GoalCompletionVerification["basis"];
|
|
266
|
+
} {
|
|
267
|
+
const relevantGoals = receiptRelevantGoals(input.plan, input.goal, input.receiptKind);
|
|
268
|
+
const relevantGoalIds = relevantGoals.map(goal => goal.id);
|
|
269
|
+
const targetGoalUpdatedAt = input.targetGoalUpdatedAt ?? input.goal.updatedAt;
|
|
270
|
+
const planHashBeforeCheckpoint = hashStructuredValue(
|
|
271
|
+
planSnapshotForReceipt({
|
|
272
|
+
plan: input.plan,
|
|
273
|
+
goal: input.goal,
|
|
274
|
+
beforeStatus: input.beforeStatus,
|
|
275
|
+
targetGoalUpdatedAt,
|
|
276
|
+
receiptKind: input.receiptKind,
|
|
277
|
+
}),
|
|
278
|
+
);
|
|
279
|
+
const requiredGoalSetHashBeforeCheckpoint = hashStructuredValue(
|
|
280
|
+
relevantGoals.map(goal => ({
|
|
281
|
+
id: goal.id,
|
|
282
|
+
status: goal.id === input.goal.id ? input.beforeStatus : goal.status,
|
|
283
|
+
updatedAt: goal.id === input.goal.id ? targetGoalUpdatedAt : goal.updatedAt,
|
|
284
|
+
})),
|
|
285
|
+
);
|
|
286
|
+
const basis: GoalCompletionVerification["basis"] = {
|
|
287
|
+
planHashBeforeCheckpoint,
|
|
288
|
+
latestRelevantLedgerEventIdBeforeCheckpoint: latestRelevantLedgerEventId(
|
|
289
|
+
input.ledger,
|
|
290
|
+
relevantGoalIds,
|
|
291
|
+
input.excludeEventId,
|
|
292
|
+
),
|
|
293
|
+
goalUpdatedAtBeforeCheckpoint: targetGoalUpdatedAt,
|
|
294
|
+
relevantGoalIdsBeforeCheckpoint: relevantGoalIds,
|
|
295
|
+
requiredGoalSetHashBeforeCheckpoint,
|
|
296
|
+
};
|
|
297
|
+
return { planGeneration: hashStructuredValue(basis), basis };
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
function chooseReceiptKind(plan: GoalPlan, goal: GoalEntry, status: GoalStatus): GoalReceiptKind {
|
|
301
|
+
if (plan.jwcGoalMode === "per-story") return "per-goal";
|
|
302
|
+
if (status !== "complete") return "per-goal";
|
|
303
|
+
const unfinishedRequiredGoals = requiredGoalEntries(plan).filter(
|
|
304
|
+
item => item.id !== goal.id && !TERMINAL_OR_SKIPPED_STATUSES.has(item.status),
|
|
305
|
+
);
|
|
306
|
+
return unfinishedRequiredGoals.length === 0 ? "final-aggregate" : "per-goal";
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function buildCompletionReceipt(input: {
|
|
310
|
+
plan: GoalPlan;
|
|
311
|
+
ledger: readonly GoalLedgerEvent[];
|
|
312
|
+
goal: GoalEntry;
|
|
313
|
+
receiptKind: GoalReceiptKind;
|
|
314
|
+
beforeStatus: GoalStatus;
|
|
315
|
+
qualityGateJson: JsonObject;
|
|
316
|
+
jwcGoalJson: JsonObject;
|
|
317
|
+
now: string;
|
|
318
|
+
checkpointLedgerEventId: string;
|
|
319
|
+
}): GoalCompletionVerification {
|
|
320
|
+
const generation = computeGoalPlanGeneration({
|
|
321
|
+
plan: input.plan,
|
|
322
|
+
ledger: input.ledger,
|
|
323
|
+
goal: input.goal,
|
|
324
|
+
receiptKind: input.receiptKind,
|
|
325
|
+
beforeStatus: input.beforeStatus,
|
|
326
|
+
targetGoalUpdatedAt: input.now,
|
|
327
|
+
excludeEventId: input.checkpointLedgerEventId,
|
|
328
|
+
});
|
|
329
|
+
return {
|
|
330
|
+
schemaVersion: 1,
|
|
331
|
+
receiptId: crypto.randomUUID(),
|
|
332
|
+
verifiedAt: input.now,
|
|
333
|
+
goalId: input.goal.id,
|
|
334
|
+
receiptKind: input.receiptKind,
|
|
335
|
+
goalStatusBeforeCheckpoint: input.beforeStatus,
|
|
336
|
+
jwcGoalMode: input.plan.jwcGoalMode,
|
|
337
|
+
jwcObjective: input.plan.jwcObjective,
|
|
338
|
+
qualityGateHash: hashStructuredValue(input.qualityGateJson),
|
|
339
|
+
jwcGoalSnapshotHash: hashStructuredValue(input.jwcGoalJson),
|
|
340
|
+
planGeneration: generation.planGeneration,
|
|
341
|
+
basis: generation.basis,
|
|
342
|
+
checkpointLedgerEventId: input.checkpointLedgerEventId,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function nonEmptyString(value: unknown): string | null {
|
|
347
|
+
return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function normalizeGoalStatus(value: unknown): GoalStatus {
|
|
351
|
+
switch (value) {
|
|
352
|
+
case "pending":
|
|
353
|
+
case "active":
|
|
354
|
+
case "complete":
|
|
355
|
+
case "failed":
|
|
356
|
+
case "blocked":
|
|
357
|
+
case "review_blocked":
|
|
358
|
+
case "superseded":
|
|
359
|
+
return value;
|
|
360
|
+
default:
|
|
361
|
+
return "pending";
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function parseGoalStatus(value: unknown): GoalStatus {
|
|
366
|
+
const status = normalizeGoalStatus(value);
|
|
367
|
+
if (status === "pending" && value !== "pending") {
|
|
368
|
+
throw new Error(
|
|
369
|
+
"checkpoint --status must be pending, active, complete, failed, blocked, review_blocked, or superseded",
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
return status;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
function normalizePlan(raw: unknown): GoalPlan {
|
|
376
|
+
if (typeof raw !== "object" || raw === null) throw new Error("Invalid goal plan: expected object");
|
|
377
|
+
const record = raw as JsonObject;
|
|
378
|
+
const brief = nonEmptyString(record.brief) ?? "";
|
|
379
|
+
const createdAt = nonEmptyString(record.createdAt) ?? new Date().toISOString();
|
|
380
|
+
const updatedAt = nonEmptyString(record.updatedAt) ?? createdAt;
|
|
381
|
+
// 260613 flip: legacy goals.json carries gjc*-named fields — read both.
|
|
382
|
+
const rawGoalMode = record.jwcGoalMode ?? record.gjcGoalMode;
|
|
383
|
+
const jwcGoalMode = rawGoalMode === "per-story" ? "per-story" : "aggregate";
|
|
384
|
+
const jwcObjective =
|
|
385
|
+
nonEmptyString(record.jwcObjective) ?? nonEmptyString(record.gjcObjective) ?? DEFAULT_GOAL_OBJECTIVE;
|
|
386
|
+
const rawGoals = Array.isArray(record.goals) ? record.goals : [];
|
|
387
|
+
const goals: GoalEntry[] = rawGoals.map((item, index) => {
|
|
388
|
+
const goalRecord = typeof item === "object" && item !== null ? (item as JsonObject) : {};
|
|
389
|
+
const id = nonEmptyString(goalRecord.id) ?? `G${String(index + 1).padStart(3, "0")}`;
|
|
390
|
+
const title = nonEmptyString(goalRecord.title) ?? id;
|
|
391
|
+
const objective = nonEmptyString(goalRecord.objective) ?? title;
|
|
392
|
+
const goalCreatedAt = nonEmptyString(goalRecord.createdAt) ?? createdAt;
|
|
393
|
+
return {
|
|
394
|
+
id,
|
|
395
|
+
title,
|
|
396
|
+
objective,
|
|
397
|
+
status: normalizeGoalStatus(goalRecord.status),
|
|
398
|
+
createdAt: goalCreatedAt,
|
|
399
|
+
updatedAt: nonEmptyString(goalRecord.updatedAt) ?? goalCreatedAt,
|
|
400
|
+
startedAt: nonEmptyString(goalRecord.startedAt) ?? undefined,
|
|
401
|
+
completedAt: nonEmptyString(goalRecord.completedAt) ?? undefined,
|
|
402
|
+
evidence: nonEmptyString(goalRecord.evidence) ?? undefined,
|
|
403
|
+
steering:
|
|
404
|
+
typeof goalRecord.steering === "object" && goalRecord.steering !== null
|
|
405
|
+
? (goalRecord.steering as Record<string, unknown>)
|
|
406
|
+
: undefined,
|
|
407
|
+
completionVerification:
|
|
408
|
+
typeof goalRecord.completionVerification === "object" && goalRecord.completionVerification !== null
|
|
409
|
+
? (goalRecord.completionVerification as GoalCompletionVerification)
|
|
410
|
+
: undefined,
|
|
411
|
+
};
|
|
412
|
+
});
|
|
413
|
+
const rawAliases = record.jwcObjectiveAliases ?? record.gjcObjectiveAliases;
|
|
414
|
+
const aliases = Array.isArray(rawAliases)
|
|
415
|
+
? rawAliases.filter((value): value is string => typeof value === "string" && value.trim().length > 0)
|
|
416
|
+
: undefined;
|
|
417
|
+
return {
|
|
418
|
+
version: 1,
|
|
419
|
+
brief,
|
|
420
|
+
jwcGoalMode,
|
|
421
|
+
jwcObjective,
|
|
422
|
+
jwcObjectiveAliases: aliases,
|
|
423
|
+
goals,
|
|
424
|
+
createdAt,
|
|
425
|
+
updatedAt,
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
export async function readGoalPlan(cwd: string): Promise<GoalPlan | null> {
|
|
430
|
+
const paths = await resolveGoalStoragePaths(cwd);
|
|
431
|
+
try {
|
|
432
|
+
return normalizePlan(await Bun.file(paths.goalsPath).json());
|
|
433
|
+
} catch (error) {
|
|
434
|
+
if (isEnoent(error)) return null;
|
|
435
|
+
throw error;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function emptyCounts(): Record<GoalStatus, number> {
|
|
440
|
+
return {
|
|
441
|
+
pending: 0,
|
|
442
|
+
active: 0,
|
|
443
|
+
complete: 0,
|
|
444
|
+
failed: 0,
|
|
445
|
+
blocked: 0,
|
|
446
|
+
review_blocked: 0,
|
|
447
|
+
superseded: 0,
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
export async function getGoalStatus(cwd: string): Promise<GoalStatusSummary> {
|
|
452
|
+
const paths = await resolveGoalStoragePaths(cwd);
|
|
453
|
+
const plan = await readGoalPlan(cwd);
|
|
454
|
+
const counts = emptyCounts();
|
|
455
|
+
if (!plan) return { exists: false, status: "missing", paths, counts, goals: [] };
|
|
456
|
+
for (const goal of plan.goals) counts[goal.status] += 1;
|
|
457
|
+
const currentGoal = plan.goals.find(goal => SCHEDULABLE_STATUSES.has(goal.status));
|
|
458
|
+
let status: GoalStatusSummary["status"] = "pending";
|
|
459
|
+
if (plan.goals.length > 0 && plan.goals.every(goal => TERMINAL_OR_SKIPPED_STATUSES.has(goal.status)))
|
|
460
|
+
status = "complete";
|
|
461
|
+
else if (counts.active > 0) status = "active";
|
|
462
|
+
else if (counts.failed > 0) status = "failed";
|
|
463
|
+
else if (counts.blocked > 0 || counts.review_blocked > 0) status = "blocked";
|
|
464
|
+
return {
|
|
465
|
+
exists: true,
|
|
466
|
+
status,
|
|
467
|
+
paths,
|
|
468
|
+
jwcObjective: plan.jwcObjective,
|
|
469
|
+
currentGoal,
|
|
470
|
+
counts,
|
|
471
|
+
goals: plan.goals,
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
export function buildGoalHudSummary(summary: GoalStatusSummary, latestLedger?: GoalLedgerEvent): WorkflowHudSummary {
|
|
475
|
+
return buildWorkflowGoalHudSummary({
|
|
476
|
+
status: summary.status,
|
|
477
|
+
currentGoal: summary.currentGoal,
|
|
478
|
+
counts: summary.counts,
|
|
479
|
+
goals: summary.goals,
|
|
480
|
+
latestLedgerEvent: latestLedger,
|
|
481
|
+
updatedAt: new Date().toISOString(),
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
function clampTitle(title: string): string {
|
|
485
|
+
return title.length > 80 ? `${title.slice(0, 77)}...` : title;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
function firstNonEmptyLine(text: string): string | undefined {
|
|
489
|
+
return text
|
|
490
|
+
.split(/\r?\n/)
|
|
491
|
+
.map(line => line.trim())
|
|
492
|
+
.find(line => line.length > 0);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
function titleFromBrief(brief: string): string {
|
|
496
|
+
const firstLine = firstNonEmptyLine(brief);
|
|
497
|
+
if (!firstLine) return "Complete goal brief";
|
|
498
|
+
return clampTitle(firstLine);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// A reserved, column-0 (unindented) `@goal` line opens a story. The character
|
|
502
|
+
// right after `@goal` must be `:`, an ASCII space or tab, or end-of-line, so
|
|
503
|
+
// `@goalish`, `@goals:`, `@goal-foo`, `@goal.foo`, `@goal/foo`, a non-breaking
|
|
504
|
+
// space, and indented or mid-line `@goal:` are all ordinary objective text and
|
|
505
|
+
// never delimiters.
|
|
506
|
+
const GOAL_DELIMITER = /^@goal(?::|[ \t]+|$)[ \t]*(.*)$/;
|
|
507
|
+
|
|
508
|
+
interface ParsedGoal {
|
|
509
|
+
title: string;
|
|
510
|
+
objective: string;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
function parseGoalsFromBrief(brief: string): ParsedGoal[] {
|
|
514
|
+
const sections: { title: string; body: string[] }[] = [];
|
|
515
|
+
let current: { title: string; body: string[] } | undefined;
|
|
516
|
+
for (const line of brief.split(/\r?\n/)) {
|
|
517
|
+
const match = GOAL_DELIMITER.exec(line);
|
|
518
|
+
if (match) {
|
|
519
|
+
current = { title: match[1].trim(), body: [] };
|
|
520
|
+
sections.push(current);
|
|
521
|
+
continue;
|
|
522
|
+
}
|
|
523
|
+
current?.body.push(line);
|
|
524
|
+
}
|
|
525
|
+
if (sections.length === 0) {
|
|
526
|
+
return [{ title: titleFromBrief(brief), objective: brief.trim() }];
|
|
527
|
+
}
|
|
528
|
+
return sections.map((section, index) => {
|
|
529
|
+
const body = section.body.join("\n").trim();
|
|
530
|
+
const title = section.title || firstNonEmptyLine(body) || "";
|
|
531
|
+
if (!title && !body) {
|
|
532
|
+
throw new Error(`goal @goal block ${index + 1} has no title or objective`);
|
|
533
|
+
}
|
|
534
|
+
return { title: clampTitle(title), objective: body || title };
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export async function createGoalPlan(input: {
|
|
539
|
+
cwd: string;
|
|
540
|
+
brief: string;
|
|
541
|
+
jwcGoalMode?: GoalJwcGoalMode;
|
|
542
|
+
}): Promise<GoalPlan> {
|
|
543
|
+
const brief = input.brief.trim();
|
|
544
|
+
if (!brief) throw new Error("goal brief is required");
|
|
545
|
+
const now = new Date().toISOString();
|
|
546
|
+
// Parse the untrimmed brief so the raw-line delimiter contract holds: a
|
|
547
|
+
// leading-indented `@goal` on the first line must stay objective text rather
|
|
548
|
+
// than being promoted to column 0 by trimming.
|
|
549
|
+
const goals: GoalEntry[] = parseGoalsFromBrief(input.brief).map((goal, index) => ({
|
|
550
|
+
id: `G${String(index + 1).padStart(3, "0")}`,
|
|
551
|
+
title: goal.title,
|
|
552
|
+
objective: goal.objective,
|
|
553
|
+
status: "pending",
|
|
554
|
+
createdAt: now,
|
|
555
|
+
updatedAt: now,
|
|
556
|
+
}));
|
|
557
|
+
const plan: GoalPlan = {
|
|
558
|
+
version: 1,
|
|
559
|
+
brief,
|
|
560
|
+
jwcGoalMode: input.jwcGoalMode ?? "aggregate",
|
|
561
|
+
jwcObjective: DEFAULT_GOAL_OBJECTIVE,
|
|
562
|
+
goals,
|
|
563
|
+
createdAt: now,
|
|
564
|
+
updatedAt: now,
|
|
565
|
+
};
|
|
566
|
+
await writePlan(input.cwd, plan);
|
|
567
|
+
await appendLedger(input.cwd, { event: "plan_created", goalIds: plan.goals.map(goal => goal.id) });
|
|
568
|
+
return plan;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Narrow ledger append surface for the jwc goal adapter (061 M6) — keeps the
|
|
573
|
+
* ledger writer itself private while letting the adapter record audited
|
|
574
|
+
* pause events (`goal_pause_audited`).
|
|
575
|
+
*/
|
|
576
|
+
export async function appendGoalLedgerEvent(cwd: string, event: JsonObject): Promise<GoalLedgerEvent> {
|
|
577
|
+
return await appendLedger(cwd, event);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Refine the durable objective in place (jwc `goal refine`, 061 §2). Updates
|
|
582
|
+
* the plan-level jwcObjective and the active (or first) story objective; no
|
|
583
|
+
* ledger event by contract (refine is a wording change, not a state change).
|
|
584
|
+
*/
|
|
585
|
+
export async function refineGoalObjective(input: { cwd: string; objective: string }): Promise<GoalPlan> {
|
|
586
|
+
const objective = input.objective.trim();
|
|
587
|
+
if (!objective) throw new Error("goal refine requires a non-empty objective");
|
|
588
|
+
const plan = await readGoalPlan(input.cwd);
|
|
589
|
+
if (!plan) throw new Error("No goal plan found. Run `jwc goal set <objective>` first.");
|
|
590
|
+
const now = new Date().toISOString();
|
|
591
|
+
plan.jwcObjective = objective;
|
|
592
|
+
const target = plan.goals.find(goal => goal.status === "active") ?? plan.goals[0];
|
|
593
|
+
if (target) {
|
|
594
|
+
target.objective = objective;
|
|
595
|
+
target.updatedAt = now;
|
|
596
|
+
}
|
|
597
|
+
plan.updatedAt = now;
|
|
598
|
+
await writePlan(input.cwd, plan);
|
|
599
|
+
return plan;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function chooseNextGoal(plan: GoalPlan, retryFailed: boolean): GoalEntry | undefined {
|
|
603
|
+
return (
|
|
604
|
+
plan.goals.find(goal => goal.status === "active") ??
|
|
605
|
+
plan.goals.find(goal => goal.status === "pending") ??
|
|
606
|
+
(retryFailed ? plan.goals.find(goal => goal.status === "failed") : undefined)
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
export interface GoalRunCompletionState {
|
|
610
|
+
requiredGoals: GoalEntry[];
|
|
611
|
+
incompleteGoals: GoalEntry[];
|
|
612
|
+
nextGoal?: GoalEntry;
|
|
613
|
+
allComplete: boolean;
|
|
614
|
+
hasBlockers: boolean;
|
|
615
|
+
needsFinalAggregateReceipt: boolean;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
export function getGoalRunCompletionState(
|
|
619
|
+
plan: GoalPlan,
|
|
620
|
+
options: { retryFailed?: boolean } = {},
|
|
621
|
+
): GoalRunCompletionState {
|
|
622
|
+
const requiredGoals = requiredGoalEntries(plan);
|
|
623
|
+
const incompleteGoals = requiredGoals.filter(goal => !TERMINAL_OR_SKIPPED_STATUSES.has(goal.status));
|
|
624
|
+
const nextGoal = chooseNextGoal(plan, options.retryFailed === true);
|
|
625
|
+
return {
|
|
626
|
+
requiredGoals,
|
|
627
|
+
incompleteGoals,
|
|
628
|
+
nextGoal,
|
|
629
|
+
allComplete: requiredGoals.length > 0 && incompleteGoals.length === 0,
|
|
630
|
+
hasBlockers: incompleteGoals.some(goal => goal.status === "blocked" || goal.status === "review_blocked"),
|
|
631
|
+
needsFinalAggregateReceipt: plan.jwcGoalMode === "aggregate" && incompleteGoals.length === 0,
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
export async function startNextGoal(input: { cwd: string; retryFailed?: boolean }): Promise<{
|
|
636
|
+
plan: GoalPlan;
|
|
637
|
+
goal?: GoalEntry;
|
|
638
|
+
allComplete: boolean;
|
|
639
|
+
}> {
|
|
640
|
+
const plan = await readGoalPlan(input.cwd);
|
|
641
|
+
if (!plan) throw new Error("No goal plan found. Run `jwc goal create-goals --brief ...` first.");
|
|
642
|
+
const goal = chooseNextGoal(plan, input.retryFailed === true);
|
|
643
|
+
if (!goal) return { plan, allComplete: getGoalRunCompletionState(plan).allComplete };
|
|
644
|
+
if (goal.status !== "active") {
|
|
645
|
+
const now = new Date().toISOString();
|
|
646
|
+
goal.status = "active";
|
|
647
|
+
goal.startedAt = goal.startedAt ?? now;
|
|
648
|
+
goal.updatedAt = now;
|
|
649
|
+
plan.updatedAt = now;
|
|
650
|
+
await writePlan(input.cwd, plan);
|
|
651
|
+
await appendLedger(input.cwd, { event: "goal_started", goalId: goal.id });
|
|
652
|
+
}
|
|
653
|
+
return { plan, goal, allComplete: false };
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
async function readStructuredValue(cwd: string, value: string): Promise<unknown> {
|
|
657
|
+
const trimmed = value.trim();
|
|
658
|
+
if (!trimmed) return "";
|
|
659
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) return JSON.parse(trimmed) as unknown;
|
|
660
|
+
try {
|
|
661
|
+
return await Bun.file(path.resolve(cwd, trimmed)).json();
|
|
662
|
+
} catch (error) {
|
|
663
|
+
if (isEnoent(error)) return value;
|
|
664
|
+
throw error;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
function qualityGateObject(value: unknown): JsonObject | null {
|
|
668
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? (value as JsonObject) : null;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
function nonEmptyStringArray(value: unknown): string[] | null {
|
|
672
|
+
if (!Array.isArray(value)) return null;
|
|
673
|
+
const strings = value.filter(item => typeof item === "string" && item.trim().length > 0);
|
|
674
|
+
return strings.length === value.length && strings.length > 0 ? strings : null;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
function requireNonEmptyString(value: unknown, fieldName: string): void {
|
|
678
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
679
|
+
throw new Error(`qualityGate ${fieldName} must be a non-empty string`);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
function requireEmptyBlockers(value: unknown, fieldName: string): void {
|
|
684
|
+
if (!Array.isArray(value) || value.length !== 0) {
|
|
685
|
+
throw new Error(`qualityGate ${fieldName} must be an empty blockers array`);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
function requireQualityGateObject(value: unknown, fieldName: string): JsonObject {
|
|
689
|
+
const object = qualityGateObject(value);
|
|
690
|
+
if (!object) throw new Error(`qualityGate ${fieldName} must be an object`);
|
|
691
|
+
return object;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
function requireObjectArray(value: unknown, fieldName: string): JsonObject[] {
|
|
695
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
696
|
+
throw new Error(`qualityGate ${fieldName} must be a non-empty object array`);
|
|
697
|
+
}
|
|
698
|
+
return value.map((item, index) => requireQualityGateObject(item, `${fieldName}[${index}]`));
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
function requiredStringField(row: JsonObject, key: string, fieldName: string): string {
|
|
702
|
+
const value = row[key];
|
|
703
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
704
|
+
const hint =
|
|
705
|
+
key === "obligation" && typeof row.description === "string" && row.description.trim().length > 0
|
|
706
|
+
? "; found description, but complete-checkpoint contractCoverage rows require obligation"
|
|
707
|
+
: "";
|
|
708
|
+
throw new Error(`qualityGate ${fieldName}.${key} must be a non-empty string${hint}`);
|
|
709
|
+
}
|
|
710
|
+
return value.trim();
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
function optionalStatusField(row: JsonObject, fieldName: string): string | null {
|
|
714
|
+
if (row.status === undefined) return null;
|
|
715
|
+
const status = requiredStringField(row, "status", fieldName).toLowerCase();
|
|
716
|
+
if (status === "todo") throw new Error(`qualityGate ${fieldName}.status must not be todo`);
|
|
717
|
+
return status;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
function requireProofStatus(status: string, fieldName: string): void {
|
|
721
|
+
if (!ACCEPTED_PROOF_STATUSES.has(status) && status !== NOT_APPLICABLE_STATUS) {
|
|
722
|
+
throw new Error(`qualityGate ${fieldName}.status must be covered, passed, verified, or not_applicable`);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
function requireSuccessStatus(status: string, fieldName: string): void {
|
|
726
|
+
requireProofStatus(status, fieldName);
|
|
727
|
+
if (status === NOT_APPLICABLE_STATUS) {
|
|
728
|
+
throw new Error(`qualityGate ${fieldName}.status must be covered, passed, or verified`);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
function rowOutcomeStatuses(row: JsonObject, fieldName: string): string[] {
|
|
733
|
+
const statuses: string[] = [];
|
|
734
|
+
const status = optionalStatusField(row, fieldName);
|
|
735
|
+
if (status) statuses.push(status);
|
|
736
|
+
const verdict = row.verdict;
|
|
737
|
+
if (typeof verdict === "string" && verdict.trim().length > 0) statuses.push(verdict.trim().toLowerCase());
|
|
738
|
+
const result = row.result;
|
|
739
|
+
if (typeof result === "string" && result.trim().length > 0) statuses.push(result.trim().toLowerCase());
|
|
740
|
+
if (statuses.length === 0) throw new Error(`qualityGate ${fieldName}.verdict must be a non-empty string`);
|
|
741
|
+
return statuses;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
function requireSuccessfulRowOutcome(row: JsonObject, fieldName: string): void {
|
|
745
|
+
for (const status of rowOutcomeStatuses(row, fieldName)) {
|
|
746
|
+
requireSuccessStatus(status, fieldName);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
function requireStringLinks(value: unknown, fieldName: string): string[] {
|
|
751
|
+
const strings = nonEmptyStringArray(value);
|
|
752
|
+
if (!strings) throw new Error(`qualityGate ${fieldName} must be a non-empty string array`);
|
|
753
|
+
return strings.map(item => item.trim());
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
function optionalStringLinks(row: JsonObject, key: string, fieldName: string): string[] | null {
|
|
757
|
+
if (row[key] === undefined) return null;
|
|
758
|
+
return requireStringLinks(row[key], `${fieldName}.${key}`);
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
function buildRowIdMap(rows: JsonObject[], fieldName: string): Map<string, JsonObject> {
|
|
762
|
+
const ids = new Map<string, JsonObject>();
|
|
763
|
+
for (const [index, row] of rows.entries()) {
|
|
764
|
+
const id = requiredStringField(row, "id", `${fieldName}[${index}]`);
|
|
765
|
+
if (ids.has(id)) throw new Error(`qualityGate ${fieldName} contains duplicate id ${id}`);
|
|
766
|
+
ids.set(id, row);
|
|
767
|
+
}
|
|
768
|
+
return ids;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
function requireResolvedLinks(ids: string[], map: Map<string, JsonObject>, fieldName: string): void {
|
|
772
|
+
for (const id of ids) {
|
|
773
|
+
if (!map.has(id)) throw new Error(`qualityGate ${fieldName} references unknown id ${id}`);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
function successfulLinkedRows(ids: string[], map: Map<string, JsonObject>, fieldName: string): JsonObject[] {
|
|
777
|
+
const rows: JsonObject[] = [];
|
|
778
|
+
for (const id of ids) {
|
|
779
|
+
const row = map.get(id);
|
|
780
|
+
if (!row) throw new Error(`qualityGate ${fieldName} references unknown id ${id}`);
|
|
781
|
+
requireSuccessfulRowOutcome(row, `${fieldName}.${id}`);
|
|
782
|
+
rows.push(row);
|
|
783
|
+
}
|
|
784
|
+
return rows;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
function normalizedEvidenceKind(row: JsonObject): string {
|
|
788
|
+
return requiredStringField(row, "kind", "executorQa.artifactRefs[]").toLowerCase().replaceAll("_", "-");
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
function evidenceKindMatches(kind: string, words: string[]): boolean {
|
|
792
|
+
return words.some(word => kind.includes(word));
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
function validateSurfaceArtifactCompatibility(
|
|
796
|
+
surface: string,
|
|
797
|
+
artifactIds: string[],
|
|
798
|
+
artifactRefs: Map<string, JsonObject>,
|
|
799
|
+
fieldName: string,
|
|
800
|
+
): void {
|
|
801
|
+
const normalizedSurface = surface.toLowerCase().replaceAll("_", "-");
|
|
802
|
+
const kinds = artifactIds.map(id => normalizedEvidenceKind(artifactRefs.get(id)!));
|
|
803
|
+
const isGuiOrWeb = ["gui", "web", "browser", "ui", "visual"].some(word => normalizedSurface.includes(word));
|
|
804
|
+
if (isGuiOrWeb) {
|
|
805
|
+
const hasBrowser = kinds.some(kind =>
|
|
806
|
+
evidenceKindMatches(kind, ["browser", "playwright", "pandawright", "automation"]),
|
|
807
|
+
);
|
|
808
|
+
const hasVisual = kinds.some(kind => evidenceKindMatches(kind, ["screenshot", "image", "visual"]));
|
|
809
|
+
if (!hasBrowser || !hasVisual) {
|
|
810
|
+
throw new Error(
|
|
811
|
+
`qualityGate ${fieldName} for GUI/web surfaces must reference browser automation plus screenshot or image-verdict artifacts`,
|
|
812
|
+
);
|
|
813
|
+
}
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
const surfaceFamilies: Array<{ surface: string[]; evidence: string[]; label: string }> = [
|
|
817
|
+
{
|
|
818
|
+
surface: ["cli", "terminal", "command"],
|
|
819
|
+
evidence: ["cli", "log", "transcript", "terminal", "command", "test-report"],
|
|
820
|
+
label: "CLI",
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
surface: ["api", "package", "library", "sdk"],
|
|
824
|
+
evidence: ["api", "package", "consumer", "black-box", "test-report"],
|
|
825
|
+
label: "API/package",
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
surface: ["algorithm", "math", "mathematical", "equation"],
|
|
829
|
+
evidence: ["property", "boundary", "edge", "adversarial", "failure", "math", "algorithm", "test-report"],
|
|
830
|
+
label: "algorithm/math",
|
|
831
|
+
},
|
|
832
|
+
];
|
|
833
|
+
for (const family of surfaceFamilies) {
|
|
834
|
+
if (family.surface.some(word => normalizedSurface.includes(word))) {
|
|
835
|
+
if (!kinds.some(kind => evidenceKindMatches(kind, family.evidence))) {
|
|
836
|
+
throw new Error(
|
|
837
|
+
`qualityGate ${fieldName} for ${family.label} surfaces must reference compatible artifact kinds`,
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
function isSubstantiveEvidence(value: unknown): boolean {
|
|
846
|
+
if (typeof value !== "string") return false;
|
|
847
|
+
const trimmed = value.trim();
|
|
848
|
+
if (trimmed.length < MIN_SUBSTANTIVE_EVIDENCE_CHARS) return false;
|
|
849
|
+
const words = trimmed.split(/\s+/).filter(word => /[a-z0-9]/i.test(word));
|
|
850
|
+
if (words.length < MIN_SUBSTANTIVE_EVIDENCE_WORDS) return false;
|
|
851
|
+
const normalized = trimmed.toLowerCase();
|
|
852
|
+
return !["todo", "tbd", "n/a", "na", "none", "placeholder", "empty", "stub"].includes(normalized);
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
function hasTypedVerifiedReceipt(value: unknown): boolean {
|
|
856
|
+
const receipt = qualityGateObject(value);
|
|
857
|
+
if (!receipt) return false;
|
|
858
|
+
const type = nonEmptyString(receipt.type) ?? nonEmptyString(receipt.kind) ?? nonEmptyString(receipt.receiptType);
|
|
859
|
+
const id = nonEmptyString(receipt.id) ?? nonEmptyString(receipt.receiptId) ?? nonEmptyString(receipt.ref);
|
|
860
|
+
const status = (nonEmptyString(receipt.status) ?? nonEmptyString(receipt.verdict) ?? "").toLowerCase();
|
|
861
|
+
return Boolean(type && id && (status === "verified" || status === "passed"));
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
async function hasExistingNonEmptyArtifact(cwd: string, value: unknown): Promise<boolean> {
|
|
865
|
+
const artifactPath = nonEmptyString(value);
|
|
866
|
+
if (!artifactPath) return false;
|
|
867
|
+
const resolved = path.resolve(cwd, artifactPath);
|
|
868
|
+
try {
|
|
869
|
+
const file = Bun.file(resolved);
|
|
870
|
+
return (await file.exists()) && file.size > 0;
|
|
871
|
+
} catch (error) {
|
|
872
|
+
if (isEnoent(error)) return false;
|
|
873
|
+
throw error;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
async function requireSubstantiveArtifactEvidence(cwd: string, row: JsonObject, fieldName: string): Promise<void> {
|
|
878
|
+
if (isSubstantiveEvidence(row.inlineEvidence) || isSubstantiveEvidence(row.evidence)) return;
|
|
879
|
+
if (hasTypedVerifiedReceipt(row.verifiedReceipt) || hasTypedVerifiedReceipt(row.receipt)) return;
|
|
880
|
+
if (await hasExistingNonEmptyArtifact(cwd, row.path)) return;
|
|
881
|
+
throw new Error(
|
|
882
|
+
`qualityGate ${fieldName} must reference an existing non-empty artifact path, substantive inlineEvidence, or a typed verifiedReceipt`,
|
|
883
|
+
);
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
// Live surface families (web/cli/native) cannot be proven by inline prose alone — mirrors gjc
|
|
887
|
+
// surfaceFamily()+isLiveSurfaceFamily(). The token set is exactly gjc's native+web+cli tokens,
|
|
888
|
+
// which gjc classifies before api-package/algorithm-math, so this flat check is equivalent to
|
|
889
|
+
// isLiveSurfaceFamily(surfaceFamily(s)) for every surface. api-package/algorithm-math stay
|
|
890
|
+
// inline-permitted.
|
|
891
|
+
const LIVE_SURFACE_TOKENS = [
|
|
892
|
+
"computer",
|
|
893
|
+
"computer-use",
|
|
894
|
+
"desktop-input",
|
|
895
|
+
"native-input",
|
|
896
|
+
"native",
|
|
897
|
+
"desktop",
|
|
898
|
+
"tui",
|
|
899
|
+
"gui",
|
|
900
|
+
"web",
|
|
901
|
+
"browser",
|
|
902
|
+
"ui",
|
|
903
|
+
"visual",
|
|
904
|
+
"cli",
|
|
905
|
+
"terminal",
|
|
906
|
+
"command",
|
|
907
|
+
];
|
|
908
|
+
|
|
909
|
+
function isLiveSurface(surface: string): boolean {
|
|
910
|
+
const normalized = surface.toLowerCase().replaceAll("_", "-");
|
|
911
|
+
return LIVE_SURFACE_TOKENS.some(token => normalized.includes(token));
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
// gjc validateLiveSurfaceProofPresence parity (minimal): a live surface needs at least one linked
|
|
915
|
+
// artifact backed by a resolvable non-empty file; inlineEvidence / typed receipts do not prove a
|
|
916
|
+
// live surface. Deep byte/structural/replay verification is split to a follow-up card (10.021 split).
|
|
917
|
+
async function requireLiveSurfaceProof(
|
|
918
|
+
cwd: string,
|
|
919
|
+
surface: string,
|
|
920
|
+
artifactIds: string[],
|
|
921
|
+
artifactRefs: Map<string, JsonObject>,
|
|
922
|
+
fieldName: string,
|
|
923
|
+
): Promise<void> {
|
|
924
|
+
if (!isLiveSurface(surface)) return;
|
|
925
|
+
for (const artifactId of artifactIds) {
|
|
926
|
+
if (await hasExistingNonEmptyArtifact(cwd, artifactRefs.get(artifactId)!.path)) return;
|
|
927
|
+
}
|
|
928
|
+
throw new Error(
|
|
929
|
+
`qualityGate ${fieldName} for live surfaces must reference a resolvable non-empty artifact file; inlineEvidence and typed verifiedReceipt do not prove live surfaces`,
|
|
930
|
+
);
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
async function validateArtifactRefs(cwd: string, executorQa: JsonObject): Promise<Map<string, JsonObject>> {
|
|
934
|
+
const rows = requireObjectArray(executorQa.artifactRefs, "executorQa.artifactRefs");
|
|
935
|
+
const idMap = buildRowIdMap(rows, "executorQa.artifactRefs");
|
|
936
|
+
for (const [index, row] of rows.entries()) {
|
|
937
|
+
const fieldName = `executorQa.artifactRefs[${index}]`;
|
|
938
|
+
requiredStringField(row, "kind", fieldName);
|
|
939
|
+
requiredStringField(row, "description", fieldName);
|
|
940
|
+
await requireSubstantiveArtifactEvidence(cwd, row, fieldName);
|
|
941
|
+
}
|
|
942
|
+
return idMap;
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
async function validateSurfaceEvidence(
|
|
946
|
+
cwd: string,
|
|
947
|
+
executorQa: JsonObject,
|
|
948
|
+
artifactRefs: Map<string, JsonObject>,
|
|
949
|
+
): Promise<Map<string, JsonObject>> {
|
|
950
|
+
const rows = requireObjectArray(executorQa.surfaceEvidence, "executorQa.surfaceEvidence");
|
|
951
|
+
const idMap = buildRowIdMap(rows, "executorQa.surfaceEvidence");
|
|
952
|
+
for (const [index, row] of rows.entries()) {
|
|
953
|
+
const fieldName = `executorQa.surfaceEvidence[${index}]`;
|
|
954
|
+
const status = optionalStatusField(row, fieldName);
|
|
955
|
+
requiredStringField(row, "contractRef", fieldName);
|
|
956
|
+
if (status === NOT_APPLICABLE_STATUS) {
|
|
957
|
+
requiredStringField(row, "reason", fieldName);
|
|
958
|
+
continue;
|
|
959
|
+
}
|
|
960
|
+
const surface = requiredStringField(row, "surface", fieldName);
|
|
961
|
+
requireSuccessfulRowOutcome(row, fieldName);
|
|
962
|
+
requiredStringField(row, "invocation", fieldName);
|
|
963
|
+
if (typeof row.verdict !== "string" || row.verdict.trim().length === 0) {
|
|
964
|
+
requiredStringField(row, "result", fieldName);
|
|
965
|
+
}
|
|
966
|
+
const artifactIds = requireStringLinks(row.artifactRefs, `${fieldName}.artifactRefs`);
|
|
967
|
+
requireResolvedLinks(artifactIds, artifactRefs, `${fieldName}.artifactRefs`);
|
|
968
|
+
validateSurfaceArtifactCompatibility(surface, artifactIds, artifactRefs, `${fieldName}.artifactRefs`);
|
|
969
|
+
await requireLiveSurfaceProof(cwd, surface, artifactIds, artifactRefs, `${fieldName}.artifactRefs`);
|
|
970
|
+
}
|
|
971
|
+
return idMap;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
function validateAdversarialCases(
|
|
975
|
+
executorQa: JsonObject,
|
|
976
|
+
artifactRefs: Map<string, JsonObject>,
|
|
977
|
+
): Map<string, JsonObject> {
|
|
978
|
+
const rows = requireObjectArray(executorQa.adversarialCases, "executorQa.adversarialCases");
|
|
979
|
+
const idMap = buildRowIdMap(rows, "executorQa.adversarialCases");
|
|
980
|
+
for (const [index, row] of rows.entries()) {
|
|
981
|
+
const fieldName = `executorQa.adversarialCases[${index}]`;
|
|
982
|
+
const status = optionalStatusField(row, fieldName);
|
|
983
|
+
if (status === NOT_APPLICABLE_STATUS) {
|
|
984
|
+
throw new Error(`qualityGate ${fieldName}.status must not be not_applicable`);
|
|
985
|
+
}
|
|
986
|
+
requireSuccessfulRowOutcome(row, fieldName);
|
|
987
|
+
requiredStringField(row, "contractRef", fieldName);
|
|
988
|
+
requiredStringField(row, "scenario", fieldName);
|
|
989
|
+
requiredStringField(row, "expectedBehavior", fieldName);
|
|
990
|
+
if (typeof row.verdict !== "string" || row.verdict.trim().length === 0) {
|
|
991
|
+
requiredStringField(row, "result", fieldName);
|
|
992
|
+
}
|
|
993
|
+
const artifactIds = requireStringLinks(row.artifactRefs, `${fieldName}.artifactRefs`);
|
|
994
|
+
requireResolvedLinks(artifactIds, artifactRefs, `${fieldName}.artifactRefs`);
|
|
995
|
+
}
|
|
996
|
+
return idMap;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
function validateContractCoverage(
|
|
1000
|
+
executorQa: JsonObject,
|
|
1001
|
+
surfaceEvidence: Map<string, JsonObject>,
|
|
1002
|
+
adversarialCases: Map<string, JsonObject>,
|
|
1003
|
+
artifactRefs: Map<string, JsonObject>,
|
|
1004
|
+
): void {
|
|
1005
|
+
const rows = requireObjectArray(executorQa.contractCoverage, "executorQa.contractCoverage");
|
|
1006
|
+
buildRowIdMap(rows, "executorQa.contractCoverage");
|
|
1007
|
+
let hasSuccessfulContractCoverage = false;
|
|
1008
|
+
for (const [index, row] of rows.entries()) {
|
|
1009
|
+
const fieldName = `executorQa.contractCoverage[${index}]`;
|
|
1010
|
+
requiredStringField(row, "contractRef", fieldName);
|
|
1011
|
+
const status = optionalStatusField(row, fieldName);
|
|
1012
|
+
if (status === NOT_APPLICABLE_STATUS) {
|
|
1013
|
+
requiredStringField(row, "reason", fieldName);
|
|
1014
|
+
continue;
|
|
1015
|
+
}
|
|
1016
|
+
requiredStringField(row, "obligation", fieldName);
|
|
1017
|
+
if (!status) throw new Error(`qualityGate ${fieldName}.status must be a non-empty string`);
|
|
1018
|
+
requireSuccessStatus(status, fieldName);
|
|
1019
|
+
hasSuccessfulContractCoverage = true;
|
|
1020
|
+
const surfaceIds = optionalStringLinks(row, "surfaceEvidenceRefs", fieldName);
|
|
1021
|
+
const adversarialIds = optionalStringLinks(row, "adversarialCaseRefs", fieldName);
|
|
1022
|
+
const artifactIds = optionalStringLinks(row, "artifactRefs", fieldName);
|
|
1023
|
+
if (!surfaceIds && !adversarialIds && !artifactIds) {
|
|
1024
|
+
throw new Error(
|
|
1025
|
+
`qualityGate ${fieldName} must link to surfaceEvidenceRefs, adversarialCaseRefs, or artifactRefs`,
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
let successfulProofLinks = 0;
|
|
1029
|
+
if (surfaceIds)
|
|
1030
|
+
successfulProofLinks += successfulLinkedRows(
|
|
1031
|
+
surfaceIds,
|
|
1032
|
+
surfaceEvidence,
|
|
1033
|
+
`${fieldName}.surfaceEvidenceRefs`,
|
|
1034
|
+
).length;
|
|
1035
|
+
if (adversarialIds) {
|
|
1036
|
+
successfulProofLinks += successfulLinkedRows(
|
|
1037
|
+
adversarialIds,
|
|
1038
|
+
adversarialCases,
|
|
1039
|
+
`${fieldName}.adversarialCaseRefs`,
|
|
1040
|
+
).length;
|
|
1041
|
+
}
|
|
1042
|
+
if (artifactIds) {
|
|
1043
|
+
requireResolvedLinks(artifactIds, artifactRefs, `${fieldName}.artifactRefs`);
|
|
1044
|
+
successfulProofLinks += artifactIds.length;
|
|
1045
|
+
}
|
|
1046
|
+
if (successfulProofLinks === 0) {
|
|
1047
|
+
throw new Error(`qualityGate ${fieldName} must link to at least one successful proof row or artifact`);
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
if (!hasSuccessfulContractCoverage) {
|
|
1051
|
+
throw new Error(
|
|
1052
|
+
"qualityGate executorQa.contractCoverage must include at least one row with status covered, passed, or verified",
|
|
1053
|
+
);
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
async function validateExecutorQaRedTeamEvidence(cwd: string, executorQa: JsonObject): Promise<void> {
|
|
1058
|
+
const artifactRefs = await validateArtifactRefs(cwd, executorQa);
|
|
1059
|
+
const surfaceEvidence = await validateSurfaceEvidence(cwd, executorQa, artifactRefs);
|
|
1060
|
+
const adversarialCases = validateAdversarialCases(executorQa, artifactRefs);
|
|
1061
|
+
validateContractCoverage(executorQa, surfaceEvidence, adversarialCases, artifactRefs);
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
async function validateCompletionQualityGate(cwd: string, gate: JsonObject): Promise<void> {
|
|
1065
|
+
const codeReview = qualityGateObject(gate.codeReview);
|
|
1066
|
+
if (codeReview) {
|
|
1067
|
+
throw new Error(
|
|
1068
|
+
"checkpoint --status complete requires architect review approval through architectReview, executorQa, and iteration quality-gate evidence; legacy codeReview-only gates are not sufficient",
|
|
1069
|
+
);
|
|
1070
|
+
}
|
|
1071
|
+
const allowedKeys = new Set(["architectReview", "executorQa", "iteration"]);
|
|
1072
|
+
const unsupportedKeys = Object.keys(gate).filter(key => !allowedKeys.has(key));
|
|
1073
|
+
if (unsupportedKeys.length > 0) {
|
|
1074
|
+
throw new Error(`qualityGate contains unsupported keys: ${unsupportedKeys.join(", ")}`);
|
|
1075
|
+
}
|
|
1076
|
+
const architectReview = qualityGateObject(gate.architectReview);
|
|
1077
|
+
const executorQa = qualityGateObject(gate.executorQa);
|
|
1078
|
+
const iteration = qualityGateObject(gate.iteration);
|
|
1079
|
+
if (!architectReview || !executorQa || !iteration) {
|
|
1080
|
+
throw new Error("qualityGate requires architectReview, executorQa, and iteration objects");
|
|
1081
|
+
}
|
|
1082
|
+
if (
|
|
1083
|
+
architectReview.architectureStatus !== CLEAN_ARCHITECT_STATUS ||
|
|
1084
|
+
architectReview.productStatus !== CLEAN_ARCHITECT_STATUS ||
|
|
1085
|
+
architectReview.codeStatus !== CLEAN_ARCHITECT_STATUS ||
|
|
1086
|
+
architectReview.recommendation !== APPROVE_RECOMMENDATION
|
|
1087
|
+
) {
|
|
1088
|
+
throw new Error(
|
|
1089
|
+
"checkpoint --status complete requires architect review approval: architectReview architecture/product/code must be CLEAR and recommendation must be APPROVE",
|
|
1090
|
+
);
|
|
1091
|
+
}
|
|
1092
|
+
if (!nonEmptyStringArray(architectReview.commands)) {
|
|
1093
|
+
throw new Error("qualityGate architectReview.commands must be a non-empty string array");
|
|
1094
|
+
}
|
|
1095
|
+
requireNonEmptyString(architectReview.evidence, "architectReview.evidence");
|
|
1096
|
+
requireEmptyBlockers(architectReview.blockers, "architectReview.blockers");
|
|
1097
|
+
if (
|
|
1098
|
+
executorQa.status !== PASSED_STATUS ||
|
|
1099
|
+
executorQa.e2eStatus !== PASSED_STATUS ||
|
|
1100
|
+
executorQa.redTeamStatus !== PASSED_STATUS
|
|
1101
|
+
) {
|
|
1102
|
+
throw new Error("qualityGate executorQa status, e2eStatus, and redTeamStatus must be passed");
|
|
1103
|
+
}
|
|
1104
|
+
if (!nonEmptyStringArray(executorQa.e2eCommands) || !nonEmptyStringArray(executorQa.redTeamCommands)) {
|
|
1105
|
+
throw new Error("qualityGate executorQa e2eCommands and redTeamCommands must be non-empty string arrays");
|
|
1106
|
+
}
|
|
1107
|
+
requireNonEmptyString(executorQa.evidence, "executorQa.evidence");
|
|
1108
|
+
requireEmptyBlockers(executorQa.blockers, "executorQa.blockers");
|
|
1109
|
+
await validateExecutorQaRedTeamEvidence(cwd, executorQa);
|
|
1110
|
+
if (iteration.status !== PASSED_STATUS || iteration.fullRerun !== true) {
|
|
1111
|
+
throw new Error("qualityGate iteration must be passed with fullRerun true");
|
|
1112
|
+
}
|
|
1113
|
+
if (!nonEmptyStringArray(iteration.rerunCommands)) {
|
|
1114
|
+
throw new Error("qualityGate iteration.rerunCommands must be a non-empty string array");
|
|
1115
|
+
}
|
|
1116
|
+
requireNonEmptyString(iteration.evidence, "iteration.evidence");
|
|
1117
|
+
requireEmptyBlockers(iteration.blockers, "iteration.blockers");
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
async function readRequiredCompletionQualityGate(cwd: string, value: string | undefined): Promise<unknown> {
|
|
1121
|
+
if (!value?.trim()) {
|
|
1122
|
+
throw new Error(
|
|
1123
|
+
"complete checkpoints require --quality-gate-json with architectReview, executorQa, and iteration evidence",
|
|
1124
|
+
);
|
|
1125
|
+
}
|
|
1126
|
+
const gate = await readStructuredValue(cwd, value);
|
|
1127
|
+
const gateObject = qualityGateObject(gate);
|
|
1128
|
+
if (!gateObject) throw new Error("qualityGate must be a JSON object");
|
|
1129
|
+
await validateCompletionQualityGate(cwd, gateObject);
|
|
1130
|
+
return gate;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
function snapshotUpdatedAtMilliseconds(value: unknown): number | null {
|
|
1134
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
1135
|
+
if (typeof value !== "string" || value.trim().length === 0) return null;
|
|
1136
|
+
const trimmed = value.trim();
|
|
1137
|
+
if (/^\d+$/.test(trimmed)) {
|
|
1138
|
+
const parsed = Number.parseInt(trimmed, 10);
|
|
1139
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
1140
|
+
}
|
|
1141
|
+
const parsed = Date.parse(trimmed);
|
|
1142
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
1143
|
+
}
|
|
1144
|
+
async function readJwcGoalSnapshot(input: {
|
|
1145
|
+
cwd: string;
|
|
1146
|
+
value: string | undefined;
|
|
1147
|
+
plan: GoalPlan;
|
|
1148
|
+
goal?: GoalEntry;
|
|
1149
|
+
required: boolean;
|
|
1150
|
+
errorPrefix: string;
|
|
1151
|
+
allowCompletedLegacyBlocker?: boolean;
|
|
1152
|
+
}): Promise<unknown> {
|
|
1153
|
+
if (!input.value?.trim()) {
|
|
1154
|
+
if (!input.required) return undefined;
|
|
1155
|
+
throw new Error(
|
|
1156
|
+
`${input.errorPrefix} require --gjc-goal-json from a fresh active goal({"op":"get"}) snapshot; this is the GJC goal-mode receipt, not the .jwc/goal/goals.json goal record`,
|
|
1157
|
+
);
|
|
1158
|
+
}
|
|
1159
|
+
const snapshot = await readStructuredValue(input.cwd, input.value);
|
|
1160
|
+
const snapshotObject = qualityGateObject(snapshot);
|
|
1161
|
+
const detailsObject = qualityGateObject(snapshotObject?.details);
|
|
1162
|
+
const goalObject = qualityGateObject(snapshotObject?.goal) ?? qualityGateObject(detailsObject?.goal);
|
|
1163
|
+
if (!goalObject)
|
|
1164
|
+
throw new Error(
|
|
1165
|
+
`${input.errorPrefix} require --gjc-goal-json with a goal object from goal({"op":"get"}); pass the active GJC goal-mode snapshot, not the .jwc/goal/goals.json goal record`,
|
|
1166
|
+
);
|
|
1167
|
+
const updatedAt = snapshotUpdatedAtMilliseconds(goalObject.updatedAt);
|
|
1168
|
+
if (!updatedAt)
|
|
1169
|
+
throw new Error(
|
|
1170
|
+
`${input.errorPrefix} require --gjc-goal-json goal.updatedAt as epoch milliseconds or an ISO timestamp from goal({"op":"get"}); pass the active GJC goal-mode snapshot, not the .jwc/goal/goals.json goal record`,
|
|
1171
|
+
);
|
|
1172
|
+
const nowMilliseconds = Date.now();
|
|
1173
|
+
if (updatedAt < nowMilliseconds - GJC_GOAL_SNAPSHOT_MAX_AGE_MILLISECONDS) {
|
|
1174
|
+
throw new Error(`${input.errorPrefix} require a fresh --gjc-goal-json snapshot`);
|
|
1175
|
+
}
|
|
1176
|
+
if (updatedAt > nowMilliseconds + GJC_GOAL_SNAPSHOT_MAX_FUTURE_SKEW_MILLISECONDS) {
|
|
1177
|
+
throw new Error(`${input.errorPrefix} require --gjc-goal-json goal.updatedAt that is not from the future`);
|
|
1178
|
+
}
|
|
1179
|
+
const objective = typeof goalObject.objective === "string" ? goalObject.objective : "";
|
|
1180
|
+
const expectedObjectives = new Set([input.plan.jwcObjective, ...(input.plan.jwcObjectiveAliases ?? [])]);
|
|
1181
|
+
if (input.plan.jwcGoalMode === "per-story" && input.goal?.objective) {
|
|
1182
|
+
expectedObjectives.add(input.goal.objective);
|
|
1183
|
+
}
|
|
1184
|
+
if (input.allowCompletedLegacyBlocker && goalObject.status === "complete" && !expectedObjectives.has(objective)) {
|
|
1185
|
+
return snapshot;
|
|
1186
|
+
}
|
|
1187
|
+
if (!expectedObjectives.has(objective)) {
|
|
1188
|
+
throw new Error(
|
|
1189
|
+
`${input.errorPrefix} require --gjc-goal-json objective to match the active GJC goal-mode objective from goal({"op":"get"}), not the .jwc/goal/goals.json goal ${input.goal?.id ?? "record"}`,
|
|
1190
|
+
);
|
|
1191
|
+
}
|
|
1192
|
+
if (goalObject.status !== "active") {
|
|
1193
|
+
throw new Error(`${input.errorPrefix} require --gjc-goal-json goal.status to be active`);
|
|
1194
|
+
}
|
|
1195
|
+
return snapshot;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
export async function checkpointGoal(input: {
|
|
1199
|
+
cwd: string;
|
|
1200
|
+
goalId: string;
|
|
1201
|
+
status: GoalStatus;
|
|
1202
|
+
evidence: string;
|
|
1203
|
+
jwcGoalJson?: string;
|
|
1204
|
+
qualityGateJson?: string;
|
|
1205
|
+
}): Promise<GoalPlan> {
|
|
1206
|
+
const plan = await readGoalPlan(input.cwd);
|
|
1207
|
+
if (!plan) throw new Error("No goal plan found. Run `jwc goal create-goals --brief ...` first.");
|
|
1208
|
+
const goal = plan.goals.find(item => item.id === input.goalId);
|
|
1209
|
+
if (!goal) throw new Error(`No goal found for ${input.goalId}.`);
|
|
1210
|
+
const evidence = input.evidence.trim();
|
|
1211
|
+
if (!evidence) throw new Error("checkpoint evidence is required");
|
|
1212
|
+
const qualityGateJson =
|
|
1213
|
+
input.status === "complete"
|
|
1214
|
+
? await readRequiredCompletionQualityGate(input.cwd, input.qualityGateJson)
|
|
1215
|
+
: input.qualityGateJson
|
|
1216
|
+
? await readStructuredValue(input.cwd, input.qualityGateJson)
|
|
1217
|
+
: undefined;
|
|
1218
|
+
const now = new Date().toISOString();
|
|
1219
|
+
const ledgerBefore = await readGoalLedger(input.cwd);
|
|
1220
|
+
const beforeStatus = goal.status;
|
|
1221
|
+
if (input.status === "complete") {
|
|
1222
|
+
const blockedGoalId =
|
|
1223
|
+
typeof goal.steering?.kind === "string" && goal.steering.kind === "review_blocker"
|
|
1224
|
+
? nonEmptyString(goal.steering.blockedGoalId)
|
|
1225
|
+
: null;
|
|
1226
|
+
const blockedGoal = blockedGoalId ? plan.goals.find(item => item.id === blockedGoalId) : undefined;
|
|
1227
|
+
if (blockedGoal?.status === "review_blocked") {
|
|
1228
|
+
blockedGoal.status = "superseded";
|
|
1229
|
+
blockedGoal.evidence = `Resolved by verification blocker story ${goal.id}: ${evidence}`;
|
|
1230
|
+
blockedGoal.updatedAt = now;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
const receiptKind = input.status === "complete" ? chooseReceiptKind(plan, goal, input.status) : null;
|
|
1234
|
+
const jwcGoalJson =
|
|
1235
|
+
input.status === "complete"
|
|
1236
|
+
? await readJwcGoalSnapshot({
|
|
1237
|
+
cwd: input.cwd,
|
|
1238
|
+
value: input.jwcGoalJson,
|
|
1239
|
+
plan,
|
|
1240
|
+
goal,
|
|
1241
|
+
required: true,
|
|
1242
|
+
errorPrefix: "complete checkpoints",
|
|
1243
|
+
})
|
|
1244
|
+
: await readJwcGoalSnapshot({
|
|
1245
|
+
cwd: input.cwd,
|
|
1246
|
+
value: input.jwcGoalJson,
|
|
1247
|
+
plan,
|
|
1248
|
+
goal,
|
|
1249
|
+
required: false,
|
|
1250
|
+
errorPrefix: `${input.status} checkpoints`,
|
|
1251
|
+
allowCompletedLegacyBlocker: input.status === "blocked",
|
|
1252
|
+
});
|
|
1253
|
+
const pendingCheckpointEventId = crypto.randomUUID();
|
|
1254
|
+
if (input.status === "complete" && receiptKind && qualityGateJson && !Array.isArray(qualityGateJson)) {
|
|
1255
|
+
goal.completionVerification = buildCompletionReceipt({
|
|
1256
|
+
plan,
|
|
1257
|
+
ledger: ledgerBefore,
|
|
1258
|
+
goal,
|
|
1259
|
+
receiptKind,
|
|
1260
|
+
beforeStatus,
|
|
1261
|
+
qualityGateJson: qualityGateJson as JsonObject,
|
|
1262
|
+
jwcGoalJson: jwcGoalJson as JsonObject,
|
|
1263
|
+
now,
|
|
1264
|
+
checkpointLedgerEventId: pendingCheckpointEventId,
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
goal.status = input.status;
|
|
1268
|
+
goal.evidence = evidence;
|
|
1269
|
+
goal.updatedAt = now;
|
|
1270
|
+
if (input.status === "complete") goal.completedAt = now;
|
|
1271
|
+
plan.updatedAt = now;
|
|
1272
|
+
await writePlan(input.cwd, plan);
|
|
1273
|
+
await appendLedger(input.cwd, {
|
|
1274
|
+
eventId: pendingCheckpointEventId,
|
|
1275
|
+
event: "goal_checkpointed",
|
|
1276
|
+
goalId: goal.id,
|
|
1277
|
+
status: input.status,
|
|
1278
|
+
evidence,
|
|
1279
|
+
jwcGoalJson,
|
|
1280
|
+
qualityGateJson,
|
|
1281
|
+
completionVerification: goal.completionVerification,
|
|
1282
|
+
});
|
|
1283
|
+
return plan;
|
|
1284
|
+
}
|
|
1285
|
+
export interface GoalCheckpointContinuation {
|
|
1286
|
+
plan: GoalPlan;
|
|
1287
|
+
checkpointedGoal: GoalEntry;
|
|
1288
|
+
nextGoal?: GoalEntry;
|
|
1289
|
+
startedNext: boolean;
|
|
1290
|
+
allComplete: boolean;
|
|
1291
|
+
incompleteGoals: GoalEntry[];
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
export async function checkpointAndContinueGoal(input: {
|
|
1295
|
+
cwd: string;
|
|
1296
|
+
goalId: string;
|
|
1297
|
+
status: GoalStatus;
|
|
1298
|
+
evidence: string;
|
|
1299
|
+
jwcGoalJson?: string;
|
|
1300
|
+
qualityGateJson?: string;
|
|
1301
|
+
advanceNext?: boolean;
|
|
1302
|
+
retryFailed?: boolean;
|
|
1303
|
+
}): Promise<GoalCheckpointContinuation> {
|
|
1304
|
+
let plan = await checkpointGoal(input);
|
|
1305
|
+
const checkpointedGoal = plan.goals.find(goal => goal.id === input.goalId);
|
|
1306
|
+
if (!checkpointedGoal) throw new Error(`No goal found for ${input.goalId}.`);
|
|
1307
|
+
if (input.status === "complete" && input.advanceNext === true) {
|
|
1308
|
+
const beforeAdvance = getGoalRunCompletionState(plan, { retryFailed: input.retryFailed });
|
|
1309
|
+
if (beforeAdvance.nextGoal && beforeAdvance.nextGoal.status !== "active") {
|
|
1310
|
+
const started = await startNextGoal({ cwd: input.cwd, retryFailed: input.retryFailed });
|
|
1311
|
+
plan = started.plan;
|
|
1312
|
+
const afterAdvance = getGoalRunCompletionState(plan, { retryFailed: input.retryFailed });
|
|
1313
|
+
return {
|
|
1314
|
+
plan,
|
|
1315
|
+
checkpointedGoal,
|
|
1316
|
+
nextGoal: started.goal,
|
|
1317
|
+
startedNext: Boolean(started.goal),
|
|
1318
|
+
allComplete: afterAdvance.allComplete,
|
|
1319
|
+
incompleteGoals: afterAdvance.incompleteGoals,
|
|
1320
|
+
};
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
const state = getGoalRunCompletionState(plan, { retryFailed: input.retryFailed });
|
|
1324
|
+
return {
|
|
1325
|
+
plan,
|
|
1326
|
+
checkpointedGoal,
|
|
1327
|
+
nextGoal: state.nextGoal,
|
|
1328
|
+
startedNext: false,
|
|
1329
|
+
allComplete: state.allComplete,
|
|
1330
|
+
incompleteGoals: state.incompleteGoals,
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
export async function addGoalSubgoal(input: {
|
|
1335
|
+
cwd: string;
|
|
1336
|
+
title: string;
|
|
1337
|
+
objective: string;
|
|
1338
|
+
evidence: string;
|
|
1339
|
+
rationale: string;
|
|
1340
|
+
}): Promise<GoalPlan> {
|
|
1341
|
+
const plan = await readGoalPlan(input.cwd);
|
|
1342
|
+
if (!plan) throw new Error("No goal plan found. Run `jwc goal create-goals --brief ...` first.");
|
|
1343
|
+
return (await addGoalSubgoalToPlan({ ...input, plan })).plan;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
// ── Goal steering subsystem (chase 10.012, ported from gjc ultragoal-runtime, Ultragoal→Goal) ──
|
|
1347
|
+
const NATIVE_STEERING_KINDS = [
|
|
1348
|
+
"add_subgoal",
|
|
1349
|
+
"split_subgoal",
|
|
1350
|
+
"reorder_pending",
|
|
1351
|
+
"revise_pending_wording",
|
|
1352
|
+
"annotate_ledger",
|
|
1353
|
+
"mark_blocked_superseded",
|
|
1354
|
+
] as const;
|
|
1355
|
+
type GoalSteeringKind = (typeof NATIVE_STEERING_KINDS)[number];
|
|
1356
|
+
const NATIVE_STEERING_KIND_SET = new Set<string>(NATIVE_STEERING_KINDS);
|
|
1357
|
+
|
|
1358
|
+
interface ReplacementSpec {
|
|
1359
|
+
title: string;
|
|
1360
|
+
objective: string;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
interface SteeringCommandResult {
|
|
1364
|
+
kind: GoalSteeringKind;
|
|
1365
|
+
message: string;
|
|
1366
|
+
receipt: JsonObject;
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
function nextGoalId(plan: GoalPlan, offset = 1): string {
|
|
1370
|
+
return `G${String(plan.goals.length + offset).padStart(3, "0")}`;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
function requireSteeringText(value: string, label: string, kind: GoalSteeringKind): string {
|
|
1374
|
+
const trimmed = value.trim();
|
|
1375
|
+
if (!trimmed) throw new Error(`steer --${label} is required for ${kind}`);
|
|
1376
|
+
return trimmed;
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
function requireSteeringEvidence(input: { kind: GoalSteeringKind; evidence: string; rationale: string }): {
|
|
1380
|
+
evidence: string;
|
|
1381
|
+
rationale: string;
|
|
1382
|
+
} {
|
|
1383
|
+
return {
|
|
1384
|
+
evidence: requireSteeringText(input.evidence, "evidence", input.kind),
|
|
1385
|
+
rationale: requireSteeringText(input.rationale, "rationale", input.kind),
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
function findGoalOrThrow(plan: GoalPlan, goalId: string, kind: GoalSteeringKind): GoalEntry {
|
|
1390
|
+
const id = goalId.trim();
|
|
1391
|
+
if (!id) throw new Error(`steer --goal-id is required for ${kind}`);
|
|
1392
|
+
const goal = plan.goals.find(item => item.id === id);
|
|
1393
|
+
if (!goal) throw new Error(`No goal found for ${id}.`);
|
|
1394
|
+
return goal;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
function requireGoalStatus(goal: GoalEntry, allowed: readonly GoalStatus[], kind: GoalSteeringKind): void {
|
|
1398
|
+
if (!allowed.includes(goal.status)) {
|
|
1399
|
+
throw new Error(`steer ${kind} requires goal ${goal.id} status ${allowed.join(" or ")}; found ${goal.status}`);
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
function parseJsonFlag(value: string, label: string, kind: GoalSteeringKind): unknown {
|
|
1404
|
+
const trimmed = requireSteeringText(value, label, kind);
|
|
1405
|
+
try {
|
|
1406
|
+
return JSON.parse(trimmed) as unknown;
|
|
1407
|
+
} catch (error) {
|
|
1408
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1409
|
+
throw new Error(`steer --${label} must be valid JSON for ${kind}: ${message}`);
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
function parseReplacementSpecs(value: string, kind: GoalSteeringKind): ReplacementSpec[] {
|
|
1414
|
+
const raw = parseJsonFlag(value, "replacements-json", kind);
|
|
1415
|
+
if (!Array.isArray(raw) || raw.length < 2) {
|
|
1416
|
+
throw new Error("steer --replacements-json must be an array with at least two replacements");
|
|
1417
|
+
}
|
|
1418
|
+
const seen = new Set<string>();
|
|
1419
|
+
return raw.map((item, index) => {
|
|
1420
|
+
if (typeof item !== "object" || item === null || Array.isArray(item)) {
|
|
1421
|
+
throw new Error(`steer --replacements-json[${index}] must be an object`);
|
|
1422
|
+
}
|
|
1423
|
+
const record = item as Record<string, unknown>;
|
|
1424
|
+
const title = typeof record.title === "string" ? record.title.trim() : "";
|
|
1425
|
+
const objective = typeof record.objective === "string" ? record.objective.trim() : "";
|
|
1426
|
+
if (!title || !objective) {
|
|
1427
|
+
throw new Error(`steer --replacements-json[${index}] requires non-empty title and objective`);
|
|
1428
|
+
}
|
|
1429
|
+
const key = `${title} ${objective}`;
|
|
1430
|
+
if (seen.has(key)) throw new Error(`steer --replacements-json[${index}] duplicates an earlier replacement`);
|
|
1431
|
+
seen.add(key);
|
|
1432
|
+
return { title, objective };
|
|
1433
|
+
});
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
function parsePendingOrder(value: string, kind: GoalSteeringKind): string[] {
|
|
1437
|
+
const raw = parseJsonFlag(value, "order-json", kind);
|
|
1438
|
+
if (!Array.isArray(raw) || raw.length === 0) {
|
|
1439
|
+
throw new Error("steer --order-json must be a non-empty array of goal ids");
|
|
1440
|
+
}
|
|
1441
|
+
const seen = new Set<string>();
|
|
1442
|
+
return raw.map((item, index) => {
|
|
1443
|
+
if (typeof item !== "string" || item.trim().length === 0) {
|
|
1444
|
+
throw new Error(`steer --order-json[${index}] must be a non-empty goal id string`);
|
|
1445
|
+
}
|
|
1446
|
+
const id = item.trim();
|
|
1447
|
+
if (seen.has(id)) throw new Error(`steer --order-json contains duplicate goal id ${id}`);
|
|
1448
|
+
seen.add(id);
|
|
1449
|
+
return id;
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
async function appendSteeringRejected(input: {
|
|
1454
|
+
cwd: string;
|
|
1455
|
+
kind: GoalSteeringKind;
|
|
1456
|
+
reason: string;
|
|
1457
|
+
goalId?: string;
|
|
1458
|
+
evidence?: string;
|
|
1459
|
+
rationale?: string;
|
|
1460
|
+
payload?: JsonObject;
|
|
1461
|
+
}): Promise<void> {
|
|
1462
|
+
await appendLedger(input.cwd, {
|
|
1463
|
+
event: "steering_rejected",
|
|
1464
|
+
kind: input.kind,
|
|
1465
|
+
goalId: input.goalId?.trim() || undefined,
|
|
1466
|
+
reason: input.reason,
|
|
1467
|
+
evidence: input.evidence?.trim() || undefined,
|
|
1468
|
+
rationale: input.rationale?.trim() || undefined,
|
|
1469
|
+
payload: input.payload,
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
function steeringPayloadSummary(args: readonly string[]): JsonObject {
|
|
1474
|
+
return {
|
|
1475
|
+
goalId: flagValue(args, "--goal-id"),
|
|
1476
|
+
title: flagValue(args, "--title"),
|
|
1477
|
+
objective: flagValue(args, "--objective"),
|
|
1478
|
+
replacementsJson: flagValue(args, "--replacements-json"),
|
|
1479
|
+
orderJson: flagValue(args, "--order-json"),
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
function parseNativeSteeringKind(value: string | undefined): GoalSteeringKind {
|
|
1484
|
+
if (typeof value === "string" && NATIVE_STEERING_KIND_SET.has(value)) return value as GoalSteeringKind;
|
|
1485
|
+
throw new Error(`native steering currently supports --kind ${NATIVE_STEERING_KINDS.join(", ")}`);
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
async function addGoalSubgoalToPlan(input: {
|
|
1489
|
+
cwd: string;
|
|
1490
|
+
plan: GoalPlan;
|
|
1491
|
+
title: string;
|
|
1492
|
+
objective: string;
|
|
1493
|
+
evidence: string;
|
|
1494
|
+
rationale: string;
|
|
1495
|
+
}): Promise<{ plan: GoalPlan; goalId: string }> {
|
|
1496
|
+
const kind = "add_subgoal";
|
|
1497
|
+
const title = requireSteeringText(input.title, "title", kind);
|
|
1498
|
+
const objective = requireSteeringText(input.objective, "objective", kind);
|
|
1499
|
+
const { evidence, rationale } = requireSteeringEvidence({
|
|
1500
|
+
kind,
|
|
1501
|
+
evidence: input.evidence,
|
|
1502
|
+
rationale: input.rationale,
|
|
1503
|
+
});
|
|
1504
|
+
const now = new Date().toISOString();
|
|
1505
|
+
const nextId = nextGoalId(input.plan);
|
|
1506
|
+
input.plan.goals.push({
|
|
1507
|
+
id: nextId,
|
|
1508
|
+
title,
|
|
1509
|
+
objective,
|
|
1510
|
+
status: "pending",
|
|
1511
|
+
createdAt: now,
|
|
1512
|
+
updatedAt: now,
|
|
1513
|
+
steering: { kind, evidence, rationale },
|
|
1514
|
+
});
|
|
1515
|
+
input.plan.updatedAt = now;
|
|
1516
|
+
await writePlan(input.cwd, input.plan);
|
|
1517
|
+
await appendLedger(input.cwd, { event: "steering_accepted", kind, goalId: nextId, evidence, rationale });
|
|
1518
|
+
return { plan: input.plan, goalId: nextId };
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
async function splitGoalSubgoal(input: {
|
|
1522
|
+
cwd: string;
|
|
1523
|
+
plan: GoalPlan;
|
|
1524
|
+
goalId: string;
|
|
1525
|
+
replacementsJson: string;
|
|
1526
|
+
evidence: string;
|
|
1527
|
+
rationale: string;
|
|
1528
|
+
}): Promise<{ plan: GoalPlan; goalId: string; replacementGoalIds: string[] }> {
|
|
1529
|
+
const kind = "split_subgoal";
|
|
1530
|
+
const { evidence, rationale } = requireSteeringEvidence({
|
|
1531
|
+
kind,
|
|
1532
|
+
evidence: input.evidence,
|
|
1533
|
+
rationale: input.rationale,
|
|
1534
|
+
});
|
|
1535
|
+
const target = findGoalOrThrow(input.plan, input.goalId, kind);
|
|
1536
|
+
requireGoalStatus(target, ["pending"], kind);
|
|
1537
|
+
const replacements = parseReplacementSpecs(input.replacementsJson, kind);
|
|
1538
|
+
const now = new Date().toISOString();
|
|
1539
|
+
const replacementGoalIds = replacements.map((_, index) => nextGoalId(input.plan, index + 1));
|
|
1540
|
+
target.status = "superseded";
|
|
1541
|
+
target.evidence = evidence;
|
|
1542
|
+
target.updatedAt = now;
|
|
1543
|
+
target.steering = { kind, evidence, rationale, replacementGoalIds };
|
|
1544
|
+
const replacementGoals = replacements.map(
|
|
1545
|
+
(replacement, index): GoalEntry => ({
|
|
1546
|
+
id: replacementGoalIds[index]!,
|
|
1547
|
+
title: replacement.title,
|
|
1548
|
+
objective: replacement.objective,
|
|
1549
|
+
status: "pending",
|
|
1550
|
+
createdAt: now,
|
|
1551
|
+
updatedAt: now,
|
|
1552
|
+
steering: { kind: "split_replacement", sourceGoalId: target.id, evidence, rationale },
|
|
1553
|
+
}),
|
|
1554
|
+
);
|
|
1555
|
+
const targetIndex = input.plan.goals.findIndex(goal => goal.id === target.id);
|
|
1556
|
+
input.plan.goals.splice(targetIndex + 1, 0, ...replacementGoals);
|
|
1557
|
+
input.plan.updatedAt = now;
|
|
1558
|
+
await writePlan(input.cwd, input.plan);
|
|
1559
|
+
await appendLedger(input.cwd, {
|
|
1560
|
+
event: "steering_accepted",
|
|
1561
|
+
kind,
|
|
1562
|
+
goalId: target.id,
|
|
1563
|
+
replacementGoalIds,
|
|
1564
|
+
evidence,
|
|
1565
|
+
rationale,
|
|
1566
|
+
});
|
|
1567
|
+
return { plan: input.plan, goalId: target.id, replacementGoalIds };
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
async function reorderPendingGoals(input: {
|
|
1571
|
+
cwd: string;
|
|
1572
|
+
plan: GoalPlan;
|
|
1573
|
+
orderJson: string;
|
|
1574
|
+
evidence: string;
|
|
1575
|
+
rationale: string;
|
|
1576
|
+
}): Promise<{ plan: GoalPlan; pendingGoalIds: string[] }> {
|
|
1577
|
+
const kind = "reorder_pending";
|
|
1578
|
+
const { evidence, rationale } = requireSteeringEvidence({
|
|
1579
|
+
kind,
|
|
1580
|
+
evidence: input.evidence,
|
|
1581
|
+
rationale: input.rationale,
|
|
1582
|
+
});
|
|
1583
|
+
const pendingGoalIds = input.plan.goals.filter(goal => goal.status === "pending").map(goal => goal.id);
|
|
1584
|
+
const requestedOrder = parsePendingOrder(input.orderJson, kind);
|
|
1585
|
+
const pendingSet = new Set(pendingGoalIds);
|
|
1586
|
+
for (const id of requestedOrder) {
|
|
1587
|
+
const goal = input.plan.goals.find(item => item.id === id);
|
|
1588
|
+
if (!goal) throw new Error(`steer --order-json references unknown goal id ${id}`);
|
|
1589
|
+
if (goal.status !== "pending") throw new Error(`steer --order-json references non-pending goal id ${id}`);
|
|
1590
|
+
}
|
|
1591
|
+
const missing = pendingGoalIds.filter(id => !requestedOrder.includes(id));
|
|
1592
|
+
if (missing.length > 0) throw new Error(`steer --order-json missing pending goal id(s): ${missing.join(", ")}`);
|
|
1593
|
+
if (requestedOrder.length !== pendingSet.size)
|
|
1594
|
+
throw new Error("steer --order-json must include every pending goal exactly once");
|
|
1595
|
+
const pendingById = new Map(input.plan.goals.map(goal => [goal.id, goal]));
|
|
1596
|
+
const remaining = [...requestedOrder];
|
|
1597
|
+
input.plan.goals = input.plan.goals.map(goal =>
|
|
1598
|
+
goal.status === "pending" ? pendingById.get(remaining.shift()!)! : goal,
|
|
1599
|
+
);
|
|
1600
|
+
input.plan.updatedAt = new Date().toISOString();
|
|
1601
|
+
await writePlan(input.cwd, input.plan);
|
|
1602
|
+
await appendLedger(input.cwd, {
|
|
1603
|
+
event: "steering_accepted",
|
|
1604
|
+
kind,
|
|
1605
|
+
previousPendingGoalIds: pendingGoalIds,
|
|
1606
|
+
pendingGoalIds: requestedOrder,
|
|
1607
|
+
evidence,
|
|
1608
|
+
rationale,
|
|
1609
|
+
});
|
|
1610
|
+
return { plan: input.plan, pendingGoalIds: requestedOrder };
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
async function revisePendingGoalWording(input: {
|
|
1614
|
+
cwd: string;
|
|
1615
|
+
plan: GoalPlan;
|
|
1616
|
+
goalId: string;
|
|
1617
|
+
title?: string;
|
|
1618
|
+
objective?: string;
|
|
1619
|
+
evidence: string;
|
|
1620
|
+
rationale: string;
|
|
1621
|
+
}): Promise<{ plan: GoalPlan; goalId: string; changedFields: string[] }> {
|
|
1622
|
+
const kind = "revise_pending_wording";
|
|
1623
|
+
const { evidence, rationale } = requireSteeringEvidence({
|
|
1624
|
+
kind,
|
|
1625
|
+
evidence: input.evidence,
|
|
1626
|
+
rationale: input.rationale,
|
|
1627
|
+
});
|
|
1628
|
+
const goal = findGoalOrThrow(input.plan, input.goalId, kind);
|
|
1629
|
+
requireGoalStatus(goal, ["pending"], kind);
|
|
1630
|
+
const title = input.title === undefined ? undefined : input.title.trim();
|
|
1631
|
+
const objective = input.objective === undefined ? undefined : input.objective.trim();
|
|
1632
|
+
if (input.title !== undefined && !title)
|
|
1633
|
+
throw new Error("steer --title must be non-empty for revise_pending_wording");
|
|
1634
|
+
if (input.objective !== undefined && !objective)
|
|
1635
|
+
throw new Error("steer --objective must be non-empty for revise_pending_wording");
|
|
1636
|
+
if (!title && !objective) throw new Error("revise_pending_wording requires --title and/or --objective");
|
|
1637
|
+
const changedFields: string[] = [];
|
|
1638
|
+
if (title !== undefined) {
|
|
1639
|
+
goal.title = title;
|
|
1640
|
+
changedFields.push("title");
|
|
1641
|
+
}
|
|
1642
|
+
if (objective !== undefined) {
|
|
1643
|
+
goal.objective = objective;
|
|
1644
|
+
changedFields.push("objective");
|
|
1645
|
+
}
|
|
1646
|
+
const now = new Date().toISOString();
|
|
1647
|
+
goal.updatedAt = now;
|
|
1648
|
+
goal.steering = { kind, evidence, rationale, changedFields };
|
|
1649
|
+
input.plan.updatedAt = now;
|
|
1650
|
+
await writePlan(input.cwd, input.plan);
|
|
1651
|
+
await appendLedger(input.cwd, {
|
|
1652
|
+
event: "steering_accepted",
|
|
1653
|
+
kind,
|
|
1654
|
+
goalId: goal.id,
|
|
1655
|
+
changedFields,
|
|
1656
|
+
evidence,
|
|
1657
|
+
rationale,
|
|
1658
|
+
});
|
|
1659
|
+
return { plan: input.plan, goalId: goal.id, changedFields };
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
async function annotateGoalLedger(input: {
|
|
1663
|
+
cwd: string;
|
|
1664
|
+
plan: GoalPlan;
|
|
1665
|
+
evidence: string;
|
|
1666
|
+
rationale: string;
|
|
1667
|
+
}): Promise<{ plan: GoalPlan }> {
|
|
1668
|
+
const kind = "annotate_ledger";
|
|
1669
|
+
const { evidence, rationale } = requireSteeringEvidence({
|
|
1670
|
+
kind,
|
|
1671
|
+
evidence: input.evidence,
|
|
1672
|
+
rationale: input.rationale,
|
|
1673
|
+
});
|
|
1674
|
+
await appendLedger(input.cwd, { event: "steering_accepted", kind, evidence, rationale });
|
|
1675
|
+
return { plan: input.plan };
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
async function markBlockedGoalSuperseded(input: {
|
|
1679
|
+
cwd: string;
|
|
1680
|
+
plan: GoalPlan;
|
|
1681
|
+
goalId: string;
|
|
1682
|
+
evidence: string;
|
|
1683
|
+
rationale: string;
|
|
1684
|
+
}): Promise<{ plan: GoalPlan; goalId: string }> {
|
|
1685
|
+
const kind = "mark_blocked_superseded";
|
|
1686
|
+
const { evidence, rationale } = requireSteeringEvidence({
|
|
1687
|
+
kind,
|
|
1688
|
+
evidence: input.evidence,
|
|
1689
|
+
rationale: input.rationale,
|
|
1690
|
+
});
|
|
1691
|
+
const goal = findGoalOrThrow(input.plan, input.goalId, kind);
|
|
1692
|
+
requireGoalStatus(goal, ["blocked", "review_blocked"], kind);
|
|
1693
|
+
const remainingRequiredGoals = requiredGoalEntries(input.plan).filter(item => item.id !== goal.id);
|
|
1694
|
+
if (remainingRequiredGoals.length === 0) {
|
|
1695
|
+
throw new Error(`steer ${kind} cannot supersede ${goal.id} because it is the only remaining required goal`);
|
|
1696
|
+
}
|
|
1697
|
+
const now = new Date().toISOString();
|
|
1698
|
+
goal.status = "superseded";
|
|
1699
|
+
goal.evidence = evidence;
|
|
1700
|
+
goal.updatedAt = now;
|
|
1701
|
+
goal.steering = { kind, evidence, rationale, noReplacementRequired: true };
|
|
1702
|
+
input.plan.updatedAt = now;
|
|
1703
|
+
await writePlan(input.cwd, input.plan);
|
|
1704
|
+
await appendLedger(input.cwd, {
|
|
1705
|
+
event: "steering_accepted",
|
|
1706
|
+
kind,
|
|
1707
|
+
goalId: goal.id,
|
|
1708
|
+
noReplacementRequired: true,
|
|
1709
|
+
evidence,
|
|
1710
|
+
rationale,
|
|
1711
|
+
});
|
|
1712
|
+
return { plan: input.plan, goalId: goal.id };
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
async function executeGoalSteeringCommand(args: readonly string[], cwd: string): Promise<SteeringCommandResult> {
|
|
1716
|
+
const kind = parseNativeSteeringKind(flagValue(args, "--kind"));
|
|
1717
|
+
const plan = await readGoalPlan(cwd);
|
|
1718
|
+
if (!plan) throw new Error("No goal plan found. Run `jwc goal create-goals --brief ...` first.");
|
|
1719
|
+
const evidence = flagValue(args, "--evidence") ?? "";
|
|
1720
|
+
const rationale = flagValue(args, "--rationale") ?? "";
|
|
1721
|
+
const goalsPath = getGoalPaths(cwd).goalsPath;
|
|
1722
|
+
try {
|
|
1723
|
+
switch (kind) {
|
|
1724
|
+
case "add_subgoal": {
|
|
1725
|
+
const result = await addGoalSubgoalToPlan({
|
|
1726
|
+
cwd,
|
|
1727
|
+
plan,
|
|
1728
|
+
title: flagValue(args, "--title") ?? "",
|
|
1729
|
+
objective: flagValue(args, "--objective") ?? "",
|
|
1730
|
+
evidence,
|
|
1731
|
+
rationale,
|
|
1732
|
+
});
|
|
1733
|
+
return {
|
|
1734
|
+
kind,
|
|
1735
|
+
message: "Accepted add_subgoal steering.\n",
|
|
1736
|
+
receipt: { ok: true, kind, goal_id: result.goalId, goals_path: goalsPath },
|
|
1737
|
+
};
|
|
1738
|
+
}
|
|
1739
|
+
case "split_subgoal": {
|
|
1740
|
+
const result = await splitGoalSubgoal({
|
|
1741
|
+
cwd,
|
|
1742
|
+
plan,
|
|
1743
|
+
goalId: flagValue(args, "--goal-id") ?? "",
|
|
1744
|
+
replacementsJson: flagValue(args, "--replacements-json") ?? "",
|
|
1745
|
+
evidence,
|
|
1746
|
+
rationale,
|
|
1747
|
+
});
|
|
1748
|
+
return {
|
|
1749
|
+
kind,
|
|
1750
|
+
message: "Accepted split_subgoal steering.\n",
|
|
1751
|
+
receipt: {
|
|
1752
|
+
ok: true,
|
|
1753
|
+
kind,
|
|
1754
|
+
goal_id: result.goalId,
|
|
1755
|
+
replacement_goal_ids: result.replacementGoalIds,
|
|
1756
|
+
goals_path: goalsPath,
|
|
1757
|
+
},
|
|
1758
|
+
};
|
|
1759
|
+
}
|
|
1760
|
+
case "reorder_pending": {
|
|
1761
|
+
const result = await reorderPendingGoals({
|
|
1762
|
+
cwd,
|
|
1763
|
+
plan,
|
|
1764
|
+
orderJson: flagValue(args, "--order-json") ?? "",
|
|
1765
|
+
evidence,
|
|
1766
|
+
rationale,
|
|
1767
|
+
});
|
|
1768
|
+
return {
|
|
1769
|
+
kind,
|
|
1770
|
+
message: "Accepted reorder_pending steering.\n",
|
|
1771
|
+
receipt: { ok: true, kind, pending_goal_ids: result.pendingGoalIds, goals_path: goalsPath },
|
|
1772
|
+
};
|
|
1773
|
+
}
|
|
1774
|
+
case "revise_pending_wording": {
|
|
1775
|
+
const result = await revisePendingGoalWording({
|
|
1776
|
+
cwd,
|
|
1777
|
+
plan,
|
|
1778
|
+
goalId: flagValue(args, "--goal-id") ?? "",
|
|
1779
|
+
title: flagValue(args, "--title"),
|
|
1780
|
+
objective: flagValue(args, "--objective"),
|
|
1781
|
+
evidence,
|
|
1782
|
+
rationale,
|
|
1783
|
+
});
|
|
1784
|
+
return {
|
|
1785
|
+
kind,
|
|
1786
|
+
message: "Accepted revise_pending_wording steering.\n",
|
|
1787
|
+
receipt: {
|
|
1788
|
+
ok: true,
|
|
1789
|
+
kind,
|
|
1790
|
+
goal_id: result.goalId,
|
|
1791
|
+
changed_fields: result.changedFields,
|
|
1792
|
+
goals_path: goalsPath,
|
|
1793
|
+
},
|
|
1794
|
+
};
|
|
1795
|
+
}
|
|
1796
|
+
case "annotate_ledger": {
|
|
1797
|
+
await annotateGoalLedger({ cwd, plan, evidence, rationale });
|
|
1798
|
+
return {
|
|
1799
|
+
kind,
|
|
1800
|
+
message: "Accepted annotate_ledger steering.\n",
|
|
1801
|
+
receipt: { ok: true, kind, ledger_path: getGoalPaths(cwd).ledgerPath },
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1804
|
+
case "mark_blocked_superseded": {
|
|
1805
|
+
const result = await markBlockedGoalSuperseded({
|
|
1806
|
+
cwd,
|
|
1807
|
+
plan,
|
|
1808
|
+
goalId: flagValue(args, "--goal-id") ?? "",
|
|
1809
|
+
evidence,
|
|
1810
|
+
rationale,
|
|
1811
|
+
});
|
|
1812
|
+
return {
|
|
1813
|
+
kind,
|
|
1814
|
+
message: "Accepted mark_blocked_superseded steering.\n",
|
|
1815
|
+
receipt: {
|
|
1816
|
+
ok: true,
|
|
1817
|
+
kind,
|
|
1818
|
+
goal_id: result.goalId,
|
|
1819
|
+
no_replacement_required: true,
|
|
1820
|
+
goals_path: goalsPath,
|
|
1821
|
+
},
|
|
1822
|
+
};
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
} catch (error) {
|
|
1826
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
1827
|
+
await appendSteeringRejected({
|
|
1828
|
+
cwd,
|
|
1829
|
+
kind,
|
|
1830
|
+
reason,
|
|
1831
|
+
goalId: flagValue(args, "--goal-id"),
|
|
1832
|
+
evidence,
|
|
1833
|
+
rationale,
|
|
1834
|
+
payload: steeringPayloadSummary(args),
|
|
1835
|
+
});
|
|
1836
|
+
throw error;
|
|
1837
|
+
}
|
|
1838
|
+
throw new Error(`unhandled steering kind ${kind}`);
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
export async function recordGoalReviewBlockers(input: {
|
|
1842
|
+
cwd: string;
|
|
1843
|
+
goalId: string;
|
|
1844
|
+
title: string;
|
|
1845
|
+
objective: string;
|
|
1846
|
+
evidence: string;
|
|
1847
|
+
jwcGoalJson?: string;
|
|
1848
|
+
}): Promise<GoalPlan> {
|
|
1849
|
+
const objective = input.objective.trim();
|
|
1850
|
+
if (!objective) throw new Error("record-review-blockers --objective is required");
|
|
1851
|
+
if (!input.jwcGoalJson?.trim()) {
|
|
1852
|
+
throw new Error('record-review-blockers require --gjc-goal-json from a fresh active goal({"op":"get"}) snapshot');
|
|
1853
|
+
}
|
|
1854
|
+
const plan = await checkpointGoal({
|
|
1855
|
+
cwd: input.cwd,
|
|
1856
|
+
goalId: input.goalId,
|
|
1857
|
+
status: "review_blocked",
|
|
1858
|
+
evidence: input.evidence,
|
|
1859
|
+
jwcGoalJson: input.jwcGoalJson,
|
|
1860
|
+
});
|
|
1861
|
+
const now = new Date().toISOString();
|
|
1862
|
+
const nextId = `G${String(plan.goals.length + 1).padStart(3, "0")}`;
|
|
1863
|
+
plan.goals.push({
|
|
1864
|
+
id: nextId,
|
|
1865
|
+
title: input.title.trim() || "Resolve final code-review blockers",
|
|
1866
|
+
objective,
|
|
1867
|
+
status: "pending",
|
|
1868
|
+
createdAt: now,
|
|
1869
|
+
updatedAt: now,
|
|
1870
|
+
steering: { kind: "review_blocker", blockedGoalId: input.goalId },
|
|
1871
|
+
});
|
|
1872
|
+
plan.updatedAt = now;
|
|
1873
|
+
await writePlan(input.cwd, plan);
|
|
1874
|
+
await appendLedger(input.cwd, { event: "review_blockers_recorded", goalId: input.goalId, blockerGoalId: nextId });
|
|
1875
|
+
return plan;
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
function flagValue(args: readonly string[], flag: string): string | undefined {
|
|
1879
|
+
const index = args.indexOf(flag);
|
|
1880
|
+
if (index < 0) return undefined;
|
|
1881
|
+
return args[index + 1];
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
function hasFlag(args: readonly string[], flag: string): boolean {
|
|
1885
|
+
return args.includes(flag);
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
const HELP_FLAGS = new Set(["--help", "-h"]);
|
|
1889
|
+
|
|
1890
|
+
const FLAGS_WITH_VALUES = new Set([
|
|
1891
|
+
"--brief",
|
|
1892
|
+
"--brief-file",
|
|
1893
|
+
"--gjc-goal-mode",
|
|
1894
|
+
"--goal-id",
|
|
1895
|
+
"--status",
|
|
1896
|
+
"--evidence",
|
|
1897
|
+
"--gjc-goal-json",
|
|
1898
|
+
"--quality-gate-json",
|
|
1899
|
+
"--kind",
|
|
1900
|
+
"--title",
|
|
1901
|
+
"--objective",
|
|
1902
|
+
"--rationale",
|
|
1903
|
+
"--replacements-json",
|
|
1904
|
+
"--order-json",
|
|
1905
|
+
]);
|
|
1906
|
+
|
|
1907
|
+
function isHelpArg(arg: string): boolean {
|
|
1908
|
+
return HELP_FLAGS.has(arg);
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
function commandName(args: readonly string[]): string {
|
|
1912
|
+
let skipNext = false;
|
|
1913
|
+
for (const arg of args) {
|
|
1914
|
+
if (skipNext) {
|
|
1915
|
+
skipNext = false;
|
|
1916
|
+
continue;
|
|
1917
|
+
}
|
|
1918
|
+
if (FLAGS_WITH_VALUES.has(arg)) {
|
|
1919
|
+
skipNext = true;
|
|
1920
|
+
continue;
|
|
1921
|
+
}
|
|
1922
|
+
if (isHelpArg(arg)) continue;
|
|
1923
|
+
if (!arg.startsWith("-")) return arg;
|
|
1924
|
+
}
|
|
1925
|
+
return "status";
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
function renderGoalHelp(args: readonly string[]): string | null {
|
|
1929
|
+
if (!args.some(isHelpArg) && args[0] !== "help") return null;
|
|
1930
|
+
const subject =
|
|
1931
|
+
args[0] === "help" ? args.find((arg, index) => index > 0 && !arg.startsWith("-")) : commandName(args);
|
|
1932
|
+
if (subject === "checkpoint") {
|
|
1933
|
+
return [
|
|
1934
|
+
`Run native ${APP_NAME.toUpperCase()} Goal workflow commands`,
|
|
1935
|
+
"",
|
|
1936
|
+
"USAGE",
|
|
1937
|
+
` $ ${APP_NAME} goal checkpoint --goal-id <id> --status <status> --evidence <text> [FLAGS]`,
|
|
1938
|
+
"",
|
|
1939
|
+
"FLAGS",
|
|
1940
|
+
" --goal-id=<value> Durable .jwc/goal goal id, e.g. G001",
|
|
1941
|
+
" --status=<value> pending|active|complete|failed|blocked|review_blocked|superseded",
|
|
1942
|
+
" --evidence=<value> Completion or checkpoint evidence text",
|
|
1943
|
+
" --quality-gate-json=<value> JSON string or path for complete checkpoints",
|
|
1944
|
+
' --gjc-goal-json=<value> JSON string or path containing the current goal({"op":"get"}) snapshot',
|
|
1945
|
+
" --json Output a machine-readable receipt",
|
|
1946
|
+
"",
|
|
1947
|
+
"COMPLETE CHECKPOINT RECEIPTS",
|
|
1948
|
+
" --quality-gate-json must be an object with architectReview, executorQa, and iteration.",
|
|
1949
|
+
" executorQa.contractCoverage[] rows require an obligation field; description is not a substitute.",
|
|
1950
|
+
' --gjc-goal-json must contain the active GJC goal-mode snapshot from goal({"op":"get"}), not the .jwc/goal/goals.json goal record.',
|
|
1951
|
+
" goal.updatedAt may be epoch milliseconds or an ISO timestamp and must be fresh.",
|
|
1952
|
+
"",
|
|
1953
|
+
"EXAMPLES",
|
|
1954
|
+
` $ ${APP_NAME} goal checkpoint --goal-id G001 --status blocked --evidence "waiting on review"`,
|
|
1955
|
+
` $ ${APP_NAME} goal checkpoint --goal-id G001 --status complete --evidence "tests passed" --gjc-goal-json ./goal.json --quality-gate-json ./quality-gate.json --json`,
|
|
1956
|
+
"",
|
|
1957
|
+
].join("\n");
|
|
1958
|
+
}
|
|
1959
|
+
return [
|
|
1960
|
+
`Run native ${APP_NAME.toUpperCase()} Goal workflow commands`,
|
|
1961
|
+
"",
|
|
1962
|
+
"USAGE",
|
|
1963
|
+
` $ ${APP_NAME} goal <command> [FLAGS]`,
|
|
1964
|
+
"",
|
|
1965
|
+
"COMMANDS",
|
|
1966
|
+
" status",
|
|
1967
|
+
" create-goals",
|
|
1968
|
+
" complete-goals",
|
|
1969
|
+
" checkpoint",
|
|
1970
|
+
" steer",
|
|
1971
|
+
" record-review-blockers",
|
|
1972
|
+
"",
|
|
1973
|
+
"Run `jwc goal checkpoint --help` for complete checkpoint receipt requirements.",
|
|
1974
|
+
"",
|
|
1975
|
+
].join("\n");
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
async function readBrief(cwd: string, args: readonly string[]): Promise<string> {
|
|
1979
|
+
const inline = flagValue(args, "--brief");
|
|
1980
|
+
if (inline !== undefined) return inline;
|
|
1981
|
+
const briefFile = flagValue(args, "--brief-file");
|
|
1982
|
+
if (briefFile !== undefined) return await Bun.file(path.resolve(cwd, briefFile)).text();
|
|
1983
|
+
if (hasFlag(args, "--from-stdin")) return await Bun.stdin.text();
|
|
1984
|
+
throw new Error("create-goals requires --brief, --brief-file, or --from-stdin");
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
function renderStatus(summary: GoalStatusSummary, json: boolean): string {
|
|
1988
|
+
if (json) return `${JSON.stringify(summary, null, 2)}\n`;
|
|
1989
|
+
return renderGoalStatusMarkdown(summary);
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
function renderCompleteHandoff(
|
|
1993
|
+
result: { plan: GoalPlan; goal?: GoalEntry; allComplete: boolean },
|
|
1994
|
+
json: boolean,
|
|
1995
|
+
cwd: string,
|
|
1996
|
+
): string {
|
|
1997
|
+
if (json) {
|
|
1998
|
+
return renderCliWriteReceipt({
|
|
1999
|
+
ok: true,
|
|
2000
|
+
all_complete: result.allComplete,
|
|
2001
|
+
next_action: result.allComplete ? "none" : "execute-goal",
|
|
2002
|
+
goal_id: result.goal?.id,
|
|
2003
|
+
goal_status: result.goal?.status,
|
|
2004
|
+
gjc_objective: result.plan.jwcObjective,
|
|
2005
|
+
goals_path: getGoalPaths(cwd).goalsPath,
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
2008
|
+
if (result.allComplete) return "goal complete all=true\n";
|
|
2009
|
+
if (!result.goal) return "goal next-action=none\n";
|
|
2010
|
+
return [
|
|
2011
|
+
`goal next-action=execute-goal goal-id=${result.goal.id}`,
|
|
2012
|
+
`objective=${result.goal.objective}`,
|
|
2013
|
+
`gjc-objective=${result.plan.jwcObjective}`,
|
|
2014
|
+
"checkpoint requires=architectReview:CLEAR+APPROVE,executorQa:passed",
|
|
2015
|
+
"",
|
|
2016
|
+
].join("\n");
|
|
2017
|
+
}
|
|
2018
|
+
function renderCheckpointContinuation(
|
|
2019
|
+
result: GoalCheckpointContinuation,
|
|
2020
|
+
status: GoalStatus,
|
|
2021
|
+
json: boolean,
|
|
2022
|
+
cwd: string,
|
|
2023
|
+
): string {
|
|
2024
|
+
if (json)
|
|
2025
|
+
return renderCliWriteReceipt({
|
|
2026
|
+
ok: true,
|
|
2027
|
+
goal_id: result.checkpointedGoal.id,
|
|
2028
|
+
status,
|
|
2029
|
+
goals_path: getGoalPaths(cwd).goalsPath,
|
|
2030
|
+
completion_receipt_kind: result.checkpointedGoal.completionVerification?.receiptKind,
|
|
2031
|
+
quality_gate_hash: result.checkpointedGoal.completionVerification?.qualityGateHash,
|
|
2032
|
+
all_complete: result.allComplete,
|
|
2033
|
+
next_goal_id: result.nextGoal?.id,
|
|
2034
|
+
next_goal_status: result.nextGoal?.status,
|
|
2035
|
+
started_next: result.startedNext,
|
|
2036
|
+
incomplete_goal_ids: result.incompleteGoals.map(goal => goal.id),
|
|
2037
|
+
});
|
|
2038
|
+
const lines = [`Checkpointed ${result.checkpointedGoal.id} as ${status}.`];
|
|
2039
|
+
if (status === "complete") {
|
|
2040
|
+
if (result.allComplete) {
|
|
2041
|
+
lines.push("All goals are complete.");
|
|
2042
|
+
} else if (result.nextGoal) {
|
|
2043
|
+
lines.push(`Next goal: ${result.nextGoal.id} — ${result.nextGoal.title}`);
|
|
2044
|
+
lines.push(`Objective: ${result.nextGoal.objective}`);
|
|
2045
|
+
lines.push(`GJC objective: ${result.plan.jwcObjective}`);
|
|
2046
|
+
lines.push(
|
|
2047
|
+
result.startedNext
|
|
2048
|
+
? "The next goal is active; continue the current aggregate GJC goal and checkpoint this story when verified."
|
|
2049
|
+
: "Run `jwc goal complete-goals` to activate the next goal story.",
|
|
2050
|
+
);
|
|
2051
|
+
}
|
|
2052
|
+
} else if (status === "failed") {
|
|
2053
|
+
lines.push("Resume failed goals with `jwc goal complete-goals --retry-failed` after the blocker is fixed.");
|
|
2054
|
+
} else if (status === "blocked" || status === "review_blocked") {
|
|
2055
|
+
lines.push("Blocked goal work must be resolved with explicit blocker work or steering before final completion.");
|
|
2056
|
+
}
|
|
2057
|
+
lines.push("");
|
|
2058
|
+
return lines.join("\n");
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
async function dispatchGoalCommand(args: string[], cwd: string): Promise<GoalEngineCommandResult> {
|
|
2062
|
+
const help = renderGoalHelp(args);
|
|
2063
|
+
if (help) return { status: 0, stdout: help };
|
|
2064
|
+
try {
|
|
2065
|
+
const command = commandName(args);
|
|
2066
|
+
const json = hasFlag(args, "--json");
|
|
2067
|
+
switch (command) {
|
|
2068
|
+
case "status":
|
|
2069
|
+
return { status: 0, stdout: renderStatus(await getGoalStatus(cwd), json) };
|
|
2070
|
+
case "create":
|
|
2071
|
+
case "create-goals": {
|
|
2072
|
+
const mode = flagValue(args, "--gjc-goal-mode") === "per-story" ? "per-story" : "aggregate";
|
|
2073
|
+
const plan = await createGoalPlan({ cwd, brief: await readBrief(cwd, args), jwcGoalMode: mode });
|
|
2074
|
+
return {
|
|
2075
|
+
status: 0,
|
|
2076
|
+
createdPlan: true,
|
|
2077
|
+
stdout: json
|
|
2078
|
+
? renderCliWriteReceipt({
|
|
2079
|
+
ok: true,
|
|
2080
|
+
goals_count: plan.goals.length,
|
|
2081
|
+
goal_ids: plan.goals.map(goal => goal.id),
|
|
2082
|
+
goals_path: getGoalPaths(cwd).goalsPath,
|
|
2083
|
+
})
|
|
2084
|
+
: `Created goal plan with ${plan.goals.length} goal${plan.goals.length === 1 ? "" : "s"} at ${getGoalPaths(cwd).goalsPath}.\n`,
|
|
2085
|
+
};
|
|
2086
|
+
}
|
|
2087
|
+
case "complete-goals":
|
|
2088
|
+
return {
|
|
2089
|
+
status: 0,
|
|
2090
|
+
stdout: renderCompleteHandoff(
|
|
2091
|
+
await startNextGoal({ cwd, retryFailed: hasFlag(args, "--retry-failed") }),
|
|
2092
|
+
json,
|
|
2093
|
+
cwd,
|
|
2094
|
+
),
|
|
2095
|
+
};
|
|
2096
|
+
case "checkpoint": {
|
|
2097
|
+
const goalId = flagValue(args, "--goal-id") ?? "";
|
|
2098
|
+
const status = parseGoalStatus(flagValue(args, "--status"));
|
|
2099
|
+
const evidence = flagValue(args, "--evidence") ?? "";
|
|
2100
|
+
const result = await checkpointAndContinueGoal({
|
|
2101
|
+
cwd,
|
|
2102
|
+
goalId,
|
|
2103
|
+
status,
|
|
2104
|
+
evidence,
|
|
2105
|
+
jwcGoalJson: flagValue(args, "--gjc-goal-json"),
|
|
2106
|
+
qualityGateJson: flagValue(args, "--quality-gate-json"),
|
|
2107
|
+
advanceNext: status === "complete",
|
|
2108
|
+
});
|
|
2109
|
+
return {
|
|
2110
|
+
status: 0,
|
|
2111
|
+
stdout: renderCheckpointContinuation(result, status, json, cwd),
|
|
2112
|
+
};
|
|
2113
|
+
}
|
|
2114
|
+
case "steer": {
|
|
2115
|
+
const result = await executeGoalSteeringCommand(args, cwd);
|
|
2116
|
+
return {
|
|
2117
|
+
status: 0,
|
|
2118
|
+
stdout: json ? renderCliWriteReceipt(result.receipt) : result.message,
|
|
2119
|
+
};
|
|
2120
|
+
}
|
|
2121
|
+
case "record-review-blockers": {
|
|
2122
|
+
const plan = await recordGoalReviewBlockers({
|
|
2123
|
+
cwd,
|
|
2124
|
+
goalId: flagValue(args, "--goal-id") ?? "",
|
|
2125
|
+
title: flagValue(args, "--title") ?? "Resolve final code-review blockers",
|
|
2126
|
+
objective: flagValue(args, "--objective") ?? "",
|
|
2127
|
+
evidence: flagValue(args, "--evidence") ?? "",
|
|
2128
|
+
jwcGoalJson: flagValue(args, "--gjc-goal-json"),
|
|
2129
|
+
});
|
|
2130
|
+
const goal = plan.goals.at(-1);
|
|
2131
|
+
return {
|
|
2132
|
+
status: 0,
|
|
2133
|
+
stdout: json
|
|
2134
|
+
? renderCliWriteReceipt({ ok: true, goal_id: goal?.id, goals_path: getGoalPaths(cwd).goalsPath })
|
|
2135
|
+
: "Recorded review blockers.\n",
|
|
2136
|
+
};
|
|
2137
|
+
}
|
|
2138
|
+
default:
|
|
2139
|
+
return { status: 1, stderr: `Unknown gjc goal command: ${command}\n` };
|
|
2140
|
+
}
|
|
2141
|
+
} catch (error) {
|
|
2142
|
+
return { status: 1, stderr: `${error instanceof Error ? error.message : String(error)}\n` };
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
const RECONCILE_COMMANDS = new Set([
|
|
2147
|
+
"status",
|
|
2148
|
+
"create",
|
|
2149
|
+
"create-goals",
|
|
2150
|
+
"complete-goals",
|
|
2151
|
+
"checkpoint",
|
|
2152
|
+
"steer",
|
|
2153
|
+
"record-review-blockers",
|
|
2154
|
+
]);
|
|
2155
|
+
|
|
2156
|
+
/**
|
|
2157
|
+
* Derive a workflow-state payload from the goal plan/ledger and reconcile the
|
|
2158
|
+
* goal mode-state + active-state/HUD so `jwc state goal read`, the
|
|
2159
|
+
* skill-tool chain guard, and the HUD chip mirror the plan/ledger. Session scope
|
|
2160
|
+
* follows the CLI workflow session resolver (`--session-id`, then `JWC_SESSION_ID`,
|
|
2161
|
+
* then `GJC_SESSION_ID`). This is a derived repair: it never changes
|
|
2162
|
+
* the triggering command's status/stdout, but a failure is surfaced (stderr + a
|
|
2163
|
+
* `reconcile_failed` ledger audit event) rather than silently swallowed. `status` is
|
|
2164
|
+
* therefore a read PLUS a derived repair; it never mutates goals.json/ledger.jsonl
|
|
2165
|
+
* beyond that reconcile-failure audit event.
|
|
2166
|
+
*/
|
|
2167
|
+
export async function reconcileGoalState(
|
|
2168
|
+
cwd: string,
|
|
2169
|
+
options?: { sessionId?: string; suppressSharedActive?: boolean },
|
|
2170
|
+
): Promise<void> {
|
|
2171
|
+
const sessionId = options?.sessionId ?? resolveCliWorkflowSessionId();
|
|
2172
|
+
try {
|
|
2173
|
+
const summary = await getGoalStatus(cwd);
|
|
2174
|
+
const status = options?.suppressSharedActive ? "complete" : summary.status;
|
|
2175
|
+
const active = options?.suppressSharedActive ? false : summary.exists && status !== "complete";
|
|
2176
|
+
const payload: Record<string, unknown> = {
|
|
2177
|
+
skill: "goal",
|
|
2178
|
+
status,
|
|
2179
|
+
current_phase: status,
|
|
2180
|
+
active,
|
|
2181
|
+
goals: summary.goals.map(goal => ({ id: goal.id, title: goal.title, status: goal.status })),
|
|
2182
|
+
counts: summary.counts,
|
|
2183
|
+
active_goal_id: options?.suppressSharedActive ? null : (summary.currentGoal?.id ?? null),
|
|
2184
|
+
ledger_path: summary.paths.ledgerPath,
|
|
2185
|
+
brief_path: summary.paths.briefPath,
|
|
2186
|
+
goals_path: summary.paths.goalsPath,
|
|
2187
|
+
};
|
|
2188
|
+
if (summary.jwcObjective) payload.gjc_objective = summary.jwcObjective;
|
|
2189
|
+
await reconcileWorkflowSkillState({ cwd, mode: "goal", sessionId, active, phase: status, payload });
|
|
2190
|
+
} catch (error) {
|
|
2191
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2192
|
+
process.stderr.write(`goal state reconciliation failed: ${message}\n`);
|
|
2193
|
+
try {
|
|
2194
|
+
await appendLedger(cwd, { type: "reconcile_failed", error: message });
|
|
2195
|
+
} catch {
|
|
2196
|
+
// Best-effort audit; never let a secondary failure change command semantics.
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
export async function runNativeGoalEngineCommand(
|
|
2202
|
+
args: string[],
|
|
2203
|
+
cwd = process.cwd(),
|
|
2204
|
+
): Promise<GoalEngineCommandResult> {
|
|
2205
|
+
const command = commandName(args);
|
|
2206
|
+
const result = await dispatchGoalCommand(args, cwd);
|
|
2207
|
+
const isHelp = args.some(isHelpArg) || args[0] === "help";
|
|
2208
|
+
if (!isHelp && result.status === 0 && RECONCILE_COMMANDS.has(command)) {
|
|
2209
|
+
await reconcileGoalState(cwd, {
|
|
2210
|
+
sessionId: resolveCliWorkflowSessionId({ flagSessionId: flagValue(args, "--session-id") }),
|
|
2211
|
+
});
|
|
2212
|
+
}
|
|
2213
|
+
return result;
|
|
2214
|
+
}
|