@bastani/atomic 0.8.31-alpha.5 → 0.9.0-alpha.1
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 +5 -1
- package/dist/builtin/cursor/CHANGELOG.md +4 -1
- package/dist/builtin/cursor/package.json +2 -2
- package/dist/builtin/cursor/src/proto/protobuf-codec-json.ts +44 -0
- package/dist/builtin/cursor/src/proto/protobuf-codec-request.ts +271 -0
- package/dist/builtin/cursor/src/proto/protobuf-codec-wire.ts +231 -0
- package/dist/builtin/cursor/src/proto/protobuf-codec.ts +5 -523
- package/dist/builtin/cursor/src/stream.ts +6 -70
- package/dist/builtin/cursor/src/transport-errors.ts +74 -0
- package/dist/builtin/cursor/src/transport-frame.ts +56 -0
- package/dist/builtin/cursor/src/transport-http2.ts +122 -0
- package/dist/builtin/cursor/src/transport-native-client.ts +161 -0
- package/dist/builtin/cursor/src/transport-run-stream.ts +188 -0
- package/dist/builtin/cursor/src/transport-timeouts.ts +87 -0
- package/dist/builtin/cursor/src/transport-types.ts +140 -0
- package/dist/builtin/cursor/src/transport.ts +24 -790
- package/dist/builtin/intercom/CHANGELOG.md +3 -0
- package/dist/builtin/intercom/broker/client.ts +0 -35
- package/dist/builtin/intercom/contact-supervisor-tool.ts +289 -0
- package/dist/builtin/intercom/index-heavy.ts +77 -1336
- package/dist/builtin/intercom/intercom-tool.ts +409 -0
- package/dist/builtin/intercom/intercom-utils.ts +401 -0
- package/dist/builtin/intercom/lifecycle.ts +133 -0
- package/dist/builtin/intercom/overlay.ts +96 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/subagent-relay.ts +137 -0
- package/dist/builtin/mcp/CHANGELOG.md +3 -0
- package/dist/builtin/mcp/config-write-utils.ts +104 -0
- package/dist/builtin/mcp/config.ts +4 -180
- package/dist/builtin/mcp/mcp-panel-renderer.ts +243 -0
- package/dist/builtin/mcp/mcp-panel-state.ts +227 -0
- package/dist/builtin/mcp/mcp-panel-types.ts +86 -0
- package/dist/builtin/mcp/mcp-panel.ts +145 -579
- package/dist/builtin/mcp/mcp-setup-panel.ts +4 -81
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/mcp/proxy-auth.ts +61 -0
- package/dist/builtin/mcp/proxy-call.ts +373 -0
- package/dist/builtin/mcp/proxy-connect.ts +58 -0
- package/dist/builtin/mcp/proxy-info-modes.ts +326 -0
- package/dist/builtin/mcp/proxy-modes.ts +3 -805
- package/dist/builtin/mcp/proxy-types.ts +3 -0
- package/dist/builtin/mcp/ui-server-http.ts +81 -0
- package/dist/builtin/mcp/ui-server.ts +2 -127
- package/dist/builtin/subagents/CHANGELOG.md +3 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/agents/agent-discovery.ts +127 -0
- package/dist/builtin/subagents/src/agents/agent-loaders.ts +175 -0
- package/dist/builtin/subagents/src/agents/agent-management-helpers.ts +310 -0
- package/dist/builtin/subagents/src/agents/agent-management.ts +3 -309
- package/dist/builtin/subagents/src/agents/agent-overrides.ts +397 -0
- package/dist/builtin/subagents/src/agents/agent-paths.ts +88 -0
- package/dist/builtin/subagents/src/agents/agent-types.ts +136 -0
- package/dist/builtin/subagents/src/agents/agents.ts +22 -895
- package/dist/builtin/subagents/src/agents/skills-paths.ts +333 -0
- package/dist/builtin/subagents/src/agents/skills.ts +3 -326
- package/dist/builtin/subagents/src/extension/index.ts +4 -118
- package/dist/builtin/subagents/src/extension/prompt-guidance.ts +13 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-chain.ts +401 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-common.ts +131 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-single.ts +213 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-types.ts +84 -0
- package/dist/builtin/subagents/src/runs/background/async-execution.ts +13 -795
- package/dist/builtin/subagents/src/runs/background/subagent-runner-dynamic.ts +215 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-finalize.ts +136 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-output.ts +105 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-parallel-helpers.ts +112 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-parallel.ts +159 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-sequential.ts +127 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-state.ts +427 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-step.ts +273 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-streaming.ts +269 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-types.ts +196 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-utils.ts +70 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +44 -2233
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-behavior.ts +75 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-component.ts +202 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-edit.ts +97 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-editor.ts +160 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-frame.ts +72 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-render-modes.ts +161 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-render-selectors.ts +203 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-selectors.ts +234 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-state.ts +103 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify-types.ts +29 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify.ts +4 -1328
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-clarify.ts +117 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-details.ts +35 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-dynamic-step.ts +194 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-runner.ts +183 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-step.ts +185 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-sequential-step.ts +229 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-types.ts +194 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution.ts +94 -1043
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt-control.ts +135 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt-finalize.ts +107 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt-types.ts +17 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt.ts +454 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-run-sync.ts +219 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-structured-retries.ts +77 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-updates.ts +34 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-utils.ts +56 -0
- package/dist/builtin/subagents/src/runs/foreground/execution.ts +6 -1082
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-async.ts +207 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-chain.ts +140 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts +266 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-input.ts +270 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +157 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +375 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-resume.ts +463 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-runtime.ts +17 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +320 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-status.ts +207 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts +121 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-worktree.ts +113 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +150 -2522
- package/dist/builtin/subagents/src/runs/shared/model-fallback.ts +0 -16
- package/dist/builtin/subagents/src/runs/shared/nested-events-control.ts +167 -0
- package/dist/builtin/subagents/src/runs/shared/nested-events-core.ts +219 -0
- package/dist/builtin/subagents/src/runs/shared/nested-events-projection.ts +121 -0
- package/dist/builtin/subagents/src/runs/shared/nested-events-registry.ts +289 -0
- package/dist/builtin/subagents/src/runs/shared/nested-events-sanitize.ts +201 -0
- package/dist/builtin/subagents/src/runs/shared/nested-events.ts +50 -935
- package/dist/builtin/subagents/src/runs/shared/worktree.ts +0 -78
- package/dist/builtin/subagents/src/shared/types-async.ts +265 -0
- package/dist/builtin/subagents/src/shared/types-config.ts +125 -0
- package/dist/builtin/subagents/src/shared/types-depth.ts +121 -0
- package/dist/builtin/subagents/src/shared/types-output.ts +63 -0
- package/dist/builtin/subagents/src/shared/types-results.ts +318 -0
- package/dist/builtin/subagents/src/shared/types-runtime.ts +136 -0
- package/dist/builtin/subagents/src/shared/types.ts +10 -975
- package/dist/builtin/subagents/src/slash/slash-commands.ts +0 -12
- package/dist/builtin/subagents/src/tui/render-chain-graph.ts +247 -0
- package/dist/builtin/subagents/src/tui/render-event-formatting.ts +259 -0
- package/dist/builtin/subagents/src/tui/render-layout.ts +120 -0
- package/dist/builtin/subagents/src/tui/render-result-animation.ts +56 -0
- package/dist/builtin/subagents/src/tui/render-result-compact.ts +154 -0
- package/dist/builtin/subagents/src/tui/render-result.ts +390 -0
- package/dist/builtin/subagents/src/tui/render-stable-output.ts +83 -0
- package/dist/builtin/subagents/src/tui/render-status-progress.ts +133 -0
- package/dist/builtin/subagents/src/tui/render-widget-graph.ts +166 -0
- package/dist/builtin/subagents/src/tui/render-widget.ts +273 -0
- package/dist/builtin/subagents/src/tui/render.ts +14 -1801
- package/dist/builtin/web-access/CHANGELOG.md +3 -0
- package/dist/builtin/web-access/content-tools.ts +348 -0
- package/dist/builtin/web-access/curator-page-assets/script-1.ts +400 -0
- package/dist/builtin/web-access/curator-page-assets/script-2.ts +400 -0
- package/dist/builtin/web-access/curator-page-assets/script-3.ts +400 -0
- package/dist/builtin/web-access/curator-page-assets/script-4.ts +400 -0
- package/dist/builtin/web-access/curator-page-assets/script-5.ts +398 -0
- package/dist/builtin/web-access/curator-page-assets/styles-1.ts +394 -0
- package/dist/builtin/web-access/curator-page-assets/styles-2.ts +394 -0
- package/dist/builtin/web-access/curator-page-assets/styles-3.ts +393 -0
- package/dist/builtin/web-access/curator-page.ts +17 -3180
- package/dist/builtin/web-access/curator-server-helpers.ts +115 -0
- package/dist/builtin/web-access/curator-server.ts +2 -113
- package/dist/builtin/web-access/exa-mcp.ts +218 -0
- package/dist/builtin/web-access/exa.ts +2 -207
- package/dist/builtin/web-access/extract-frames.ts +228 -0
- package/dist/builtin/web-access/extract.ts +13 -214
- package/dist/builtin/web-access/github-config.ts +156 -0
- package/dist/builtin/web-access/github-extract.ts +3 -154
- package/dist/builtin/web-access/index-heavy.ts +8 -1904
- package/dist/builtin/web-access/package.json +2 -1
- package/dist/builtin/web-access/web-search-activity.ts +102 -0
- package/dist/builtin/web-access/web-search-browser.ts +116 -0
- package/dist/builtin/web-access/web-search-command.ts +242 -0
- package/dist/builtin/web-access/web-search-config.ts +163 -0
- package/dist/builtin/web-access/web-search-curator.ts +214 -0
- package/dist/builtin/web-access/web-search-features.ts +165 -0
- package/dist/builtin/web-access/web-search-formatting.ts +117 -0
- package/dist/builtin/web-access/web-search-return.ts +136 -0
- package/dist/builtin/web-access/web-search-summary.ts +170 -0
- package/dist/builtin/web-access/web-search-tool.ts +290 -0
- package/dist/builtin/web-access/web-search-types.ts +50 -0
- package/dist/builtin/workflows/CHANGELOG.md +4 -1
- package/dist/builtin/workflows/builtin/deep-research-codebase-runner.ts +492 -0
- package/dist/builtin/workflows/builtin/deep-research-codebase-utils.ts +346 -0
- package/dist/builtin/workflows/builtin/deep-research-codebase.ts +6 -822
- package/dist/builtin/workflows/builtin/goal-artifacts.ts +43 -0
- package/dist/builtin/workflows/builtin/goal-ledger.ts +54 -0
- package/dist/builtin/workflows/builtin/goal-prompts.ts +360 -0
- package/dist/builtin/workflows/builtin/goal-reducer.ts +141 -0
- package/dist/builtin/workflows/builtin/goal-reports.ts +56 -0
- package/dist/builtin/workflows/builtin/goal-review.ts +84 -0
- package/dist/builtin/workflows/builtin/goal-runner.ts +343 -0
- package/dist/builtin/workflows/builtin/goal-schemas.ts +60 -0
- package/dist/builtin/workflows/builtin/goal-types.ts +132 -0
- package/dist/builtin/workflows/builtin/goal.ts +4 -1160
- package/dist/builtin/workflows/builtin/open-claude-design-phases.ts +432 -0
- package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +477 -0
- package/dist/builtin/workflows/builtin/open-claude-design-utils.ts +312 -0
- package/dist/builtin/workflows/builtin/open-claude-design.ts +7 -1083
- package/dist/builtin/workflows/builtin/ralph-core.ts +408 -0
- package/dist/builtin/workflows/builtin/ralph-models.ts +123 -0
- package/dist/builtin/workflows/builtin/ralph-runner.ts +499 -0
- package/dist/builtin/workflows/builtin/ralph.ts +7 -979
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/page.mjs +8 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +13 -15
- package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +9 -0
- package/dist/builtin/workflows/src/extension/atomic-stage-session.ts +186 -0
- package/dist/builtin/workflows/src/extension/config-file-loader.ts +152 -0
- package/dist/builtin/workflows/src/extension/config-loader.ts +2 -167
- package/dist/builtin/workflows/src/extension/discovery-loaders.ts +115 -0
- package/dist/builtin/workflows/src/extension/discovery.ts +3 -117
- package/dist/builtin/workflows/src/extension/extension-factory.ts +120 -0
- package/dist/builtin/workflows/src/extension/extension-lifecycle.ts +109 -0
- package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +270 -0
- package/dist/builtin/workflows/src/extension/index.ts +42 -4166
- package/dist/builtin/workflows/src/extension/public-types.ts +295 -0
- package/dist/builtin/workflows/src/extension/render-component.ts +14 -0
- package/dist/builtin/workflows/src/extension/runtime-direct.ts +96 -0
- package/dist/builtin/workflows/src/extension/runtime.ts +1 -92
- package/dist/builtin/workflows/src/extension/ui-surface.ts +286 -0
- package/dist/builtin/workflows/src/extension/wiring.ts +6 -475
- package/dist/builtin/workflows/src/extension/workflow-command-completions.ts +111 -0
- package/dist/builtin/workflows/src/extension/workflow-command-registration.ts +213 -0
- package/dist/builtin/workflows/src/extension/workflow-command-surfaces.ts +81 -0
- package/dist/builtin/workflows/src/extension/workflow-command-utils.ts +181 -0
- package/dist/builtin/workflows/src/extension/workflow-policy.ts +15 -0
- package/dist/builtin/workflows/src/extension/workflow-ports.ts +41 -0
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +23 -0
- package/dist/builtin/workflows/src/extension/workflow-run-control-command.ts +286 -0
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +1 -1
- package/dist/builtin/workflows/src/extension/workflow-stage-results.ts +264 -0
- package/dist/builtin/workflows/src/extension/workflow-targets.ts +181 -0
- package/dist/builtin/workflows/src/extension/workflow-tool-content.ts +175 -0
- package/dist/builtin/workflows/src/extension/workflow-tool-control.ts +205 -0
- package/dist/builtin/workflows/src/extension/workflow-tool-helpers.ts +66 -0
- package/dist/builtin/workflows/src/extension/workflow-tool-inspection.ts +164 -0
- package/dist/builtin/workflows/src/extension/workflow-tool-registration.ts +54 -0
- package/dist/builtin/workflows/src/extension/workflow-tool-send.ts +164 -0
- package/dist/builtin/workflows/src/extension/workflow-tool.ts +102 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-abort.ts +431 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-child-boundary.ts +232 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-child-helpers.ts +74 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-child-workflow.ts +158 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-continuation.ts +167 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-direct-helpers.ts +450 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-direct.ts +233 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-exit-manager.ts +195 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-hil.ts +368 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-inputs.ts +83 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-lifecycle.ts +441 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-outputs.ts +160 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-prompt-nodes.ts +274 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-run-finalizers.ts +122 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-run.ts +359 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-scheduler.ts +204 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-call.ts +197 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-context.ts +120 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +126 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +351 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-replay.ts +134 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-types.ts +54 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-task-context.ts +132 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-task-prompts.ts +293 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-types.ts +109 -0
- package/dist/builtin/workflows/src/runs/foreground/executor.ts +19 -5354
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +219 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +500 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-messages.ts +129 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-options.ts +53 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-output.ts +146 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-session.ts +55 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-structured-output.ts +82 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-types.ts +141 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +13 -1355
- package/dist/builtin/workflows/src/runs/shared/model-fallback-candidates.ts +453 -0
- package/dist/builtin/workflows/src/runs/shared/model-fallback-failures.ts +442 -0
- package/dist/builtin/workflows/src/runs/shared/model-fallback.ts +2 -836
- package/dist/builtin/workflows/src/runs/shared/worktree-diff.ts +165 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-git.ts +220 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-setup.ts +335 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-types.ts +92 -0
- package/dist/builtin/workflows/src/runs/shared/worktree.ts +18 -791
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +365 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.ts +425 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +236 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +354 -0
- package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +5 -598
- package/dist/builtin/workflows/src/shared/persistence-restore-helpers.ts +428 -0
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +9 -431
- package/dist/builtin/workflows/src/shared/store-factory.ts +16 -0
- package/dist/builtin/workflows/src/shared/store-internal.ts +219 -0
- package/dist/builtin/workflows/src/shared/store-prompt-methods.ts +219 -0
- package/dist/builtin/workflows/src/shared/store-public-types.ts +215 -0
- package/dist/builtin/workflows/src/shared/store-run-methods.ts +223 -0
- package/dist/builtin/workflows/src/shared/store-stage-methods.ts +305 -0
- package/dist/builtin/workflows/src/shared/store.ts +11 -1138
- package/dist/builtin/workflows/src/shared/workflow-failures-classifier.ts +266 -0
- package/dist/builtin/workflows/src/shared/workflow-failures-contract.ts +75 -0
- package/dist/builtin/workflows/src/shared/workflow-failures-decisions.ts +477 -0
- package/dist/builtin/workflows/src/shared/workflow-failures-signals.ts +248 -0
- package/dist/builtin/workflows/src/shared/workflow-failures.ts +13 -1001
- package/dist/builtin/workflows/src/tui/chat-surface.ts +0 -66
- package/dist/builtin/workflows/src/tui/graph-view-constants.ts +45 -0
- package/dist/builtin/workflows/src/tui/graph-view-graph-render.ts +161 -0
- package/dist/builtin/workflows/src/tui/graph-view-input.ts +333 -0
- package/dist/builtin/workflows/src/tui/graph-view-render-helpers.ts +336 -0
- package/dist/builtin/workflows/src/tui/graph-view-render.ts +194 -0
- package/dist/builtin/workflows/src/tui/graph-view-state.ts +306 -0
- package/dist/builtin/workflows/src/tui/graph-view-types.ts +70 -0
- package/dist/builtin/workflows/src/tui/graph-view.ts +4 -1386
- package/dist/builtin/workflows/src/tui/inline-form-editor-text.ts +121 -0
- package/dist/builtin/workflows/src/tui/inline-form-editor.ts +11 -223
- package/dist/builtin/workflows/src/tui/inputs-picker-editing.ts +151 -0
- package/dist/builtin/workflows/src/tui/inputs-picker-input.ts +305 -0
- package/dist/builtin/workflows/src/tui/inputs-picker-render.ts +300 -0
- package/dist/builtin/workflows/src/tui/inputs-picker-types.ts +190 -0
- package/dist/builtin/workflows/src/tui/inputs-picker.ts +19 -997
- package/dist/builtin/workflows/src/tui/prompt-card-input.ts +226 -0
- package/dist/builtin/workflows/src/tui/prompt-card-render.ts +373 -0
- package/dist/builtin/workflows/src/tui/prompt-card-select.ts +116 -0
- package/dist/builtin/workflows/src/tui/prompt-card-state.ts +61 -0
- package/dist/builtin/workflows/src/tui/prompt-card-text.ts +129 -0
- package/dist/builtin/workflows/src/tui/prompt-card.ts +8 -910
- package/dist/builtin/workflows/src/tui/stage-chat-view-archive-history.ts +315 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-custom-ui.ts +127 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-footer-status.ts +187 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-input.ts +222 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-render-helpers.ts +152 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +464 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-transcript.ts +242 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +151 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +141 -1777
- package/dist/builtin/workflows/src/tui/workflow-attach-pane-types.ts +85 -0
- package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +1 -129
- package/dist/config-self-update.d.ts +21 -0
- package/dist/config-self-update.d.ts.map +1 -0
- package/dist/config-self-update.js +265 -0
- package/dist/config-self-update.js.map +1 -0
- package/dist/config.d.ts +3 -12
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +15 -252
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-accessors.d.ts +3 -0
- package/dist/core/agent-session-accessors.d.ts.map +1 -0
- package/dist/core/agent-session-accessors.js +36 -0
- package/dist/core/agent-session-accessors.js.map +1 -0
- package/dist/core/agent-session-auto-compaction.d.ts +32 -0
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -0
- package/dist/core/agent-session-auto-compaction.js +214 -0
- package/dist/core/agent-session-auto-compaction.js.map +1 -0
- package/dist/core/agent-session-bash.d.ts +30 -0
- package/dist/core/agent-session-bash.d.ts.map +1 -0
- package/dist/core/agent-session-bash.js +84 -0
- package/dist/core/agent-session-bash.js.map +1 -0
- package/dist/core/agent-session-compaction.d.ts +44 -0
- package/dist/core/agent-session-compaction.d.ts.map +1 -0
- package/dist/core/agent-session-compaction.js +282 -0
- package/dist/core/agent-session-compaction.js.map +1 -0
- package/dist/core/agent-session-events.d.ts +65 -0
- package/dist/core/agent-session-events.d.ts.map +1 -0
- package/dist/core/agent-session-events.js +373 -0
- package/dist/core/agent-session-events.js.map +1 -0
- package/dist/core/agent-session-export.d.ts +42 -0
- package/dist/core/agent-session-export.d.ts.map +1 -0
- package/dist/core/agent-session-export.js +199 -0
- package/dist/core/agent-session-export.js.map +1 -0
- package/dist/core/agent-session-extension-bindings.d.ts +37 -0
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -0
- package/dist/core/agent-session-extension-bindings.js +231 -0
- package/dist/core/agent-session-extension-bindings.js.map +1 -0
- package/dist/core/agent-session-message-queue.d.ts +85 -0
- package/dist/core/agent-session-message-queue.d.ts.map +1 -0
- package/dist/core/agent-session-message-queue.js +264 -0
- package/dist/core/agent-session-message-queue.js.map +1 -0
- package/dist/core/agent-session-methods.d.ts +302 -0
- package/dist/core/agent-session-methods.d.ts.map +1 -0
- package/dist/core/agent-session-methods.js +2 -0
- package/dist/core/agent-session-methods.js.map +1 -0
- package/dist/core/agent-session-models.d.ts +111 -0
- package/dist/core/agent-session-models.d.ts.map +1 -0
- package/dist/core/agent-session-models.js +368 -0
- package/dist/core/agent-session-models.js.map +1 -0
- package/dist/core/agent-session-prompt.d.ts +61 -0
- package/dist/core/agent-session-prompt.d.ts.map +1 -0
- package/dist/core/agent-session-prompt.js +330 -0
- package/dist/core/agent-session-prompt.js.map +1 -0
- package/dist/core/agent-session-retry.d.ts +62 -0
- package/dist/core/agent-session-retry.d.ts.map +1 -0
- package/dist/core/agent-session-retry.js +202 -0
- package/dist/core/agent-session-retry.js.map +1 -0
- package/dist/core/agent-session-skill-block.d.ts +13 -0
- package/dist/core/agent-session-skill-block.d.ts.map +1 -0
- package/dist/core/agent-session-skill-block.js +37 -0
- package/dist/core/agent-session-skill-block.js.map +1 -0
- package/dist/core/agent-session-state.d.ts +48 -0
- package/dist/core/agent-session-state.d.ts.map +1 -0
- package/dist/core/agent-session-state.js +129 -0
- package/dist/core/agent-session-state.js.map +1 -0
- package/dist/core/agent-session-tool-hooks.d.ts +7 -0
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -0
- package/dist/core/agent-session-tool-hooks.js +72 -0
- package/dist/core/agent-session-tool-hooks.js.map +1 -0
- package/dist/core/agent-session-tool-registry.d.ts +15 -0
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -0
- package/dist/core/agent-session-tool-registry.js +151 -0
- package/dist/core/agent-session-tool-registry.js.map +1 -0
- package/dist/core/agent-session-tree.d.ts +46 -0
- package/dist/core/agent-session-tree.d.ts.map +1 -0
- package/dist/core/agent-session-tree.js +217 -0
- package/dist/core/agent-session-tree.js.map +1 -0
- package/dist/core/agent-session-types.d.ts +159 -0
- package/dist/core/agent-session-types.d.ts.map +1 -0
- package/dist/core/agent-session-types.js +41 -0
- package/dist/core/agent-session-types.js.map +1 -0
- package/dist/core/agent-session.d.ts +68 -688
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +26 -3152
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage-backends.d.ts +49 -0
- package/dist/core/auth-storage-backends.d.ts.map +1 -0
- package/dist/core/auth-storage-backends.js +185 -0
- package/dist/core/auth-storage-backends.js.map +1 -0
- package/dist/core/auth-storage.d.ts +2 -49
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +3 -183
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/compaction/context-compaction-metrics.d.ts +16 -0
- package/dist/core/compaction/context-compaction-metrics.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction-metrics.js +58 -0
- package/dist/core/compaction/context-compaction-metrics.js.map +1 -0
- package/dist/core/compaction/context-compaction-prompt.d.ts +9 -0
- package/dist/core/compaction/context-compaction-prompt.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction-prompt.js +161 -0
- package/dist/core/compaction/context-compaction-prompt.js.map +1 -0
- package/dist/core/compaction/context-compaction-runner.d.ts +5 -0
- package/dist/core/compaction/context-compaction-runner.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction-runner.js +181 -0
- package/dist/core/compaction/context-compaction-runner.js.map +1 -0
- package/dist/core/compaction/context-compaction-strategy.d.ts +5 -0
- package/dist/core/compaction/context-compaction-strategy.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction-strategy.js +27 -0
- package/dist/core/compaction/context-compaction-strategy.js.map +1 -0
- package/dist/core/compaction/context-compaction-types.d.ts +73 -0
- package/dist/core/compaction/context-compaction-types.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction-types.js +6 -0
- package/dist/core/compaction/context-compaction-types.js.map +1 -0
- package/dist/core/compaction/context-compaction.d.ts +9 -200
- package/dist/core/compaction/context-compaction.d.ts.map +1 -1
- package/dist/core/compaction/context-compaction.js +7 -1943
- package/dist/core/compaction/context-compaction.js.map +1 -1
- package/dist/core/compaction/context-deletion-application.d.ts +13 -0
- package/dist/core/compaction/context-deletion-application.d.ts.map +1 -0
- package/dist/core/compaction/context-deletion-application.js +259 -0
- package/dist/core/compaction/context-deletion-application.js.map +1 -0
- package/dist/core/compaction/context-deletion-store.d.ts +78 -0
- package/dist/core/compaction/context-deletion-store.d.ts.map +1 -0
- package/dist/core/compaction/context-deletion-store.js +162 -0
- package/dist/core/compaction/context-deletion-store.js.map +1 -0
- package/dist/core/compaction/context-deletion-targets.d.ts +40 -0
- package/dist/core/compaction/context-deletion-targets.d.ts.map +1 -0
- package/dist/core/compaction/context-deletion-targets.js +267 -0
- package/dist/core/compaction/context-deletion-targets.js.map +1 -0
- package/dist/core/compaction/context-deletion-tool-definitions.d.ts +187 -0
- package/dist/core/compaction/context-deletion-tool-definitions.d.ts.map +1 -0
- package/dist/core/compaction/context-deletion-tool-definitions.js +98 -0
- package/dist/core/compaction/context-deletion-tool-definitions.js.map +1 -0
- package/dist/core/compaction/context-deletion-tool-helpers.d.ts +19 -0
- package/dist/core/compaction/context-deletion-tool-helpers.d.ts.map +1 -0
- package/dist/core/compaction/context-deletion-tool-helpers.js +137 -0
- package/dist/core/compaction/context-deletion-tool-helpers.js.map +1 -0
- package/dist/core/compaction/context-deletion-tools.d.ts +4 -0
- package/dist/core/compaction/context-deletion-tools.d.ts.map +1 -0
- package/dist/core/compaction/context-deletion-tools.js +395 -0
- package/dist/core/compaction/context-deletion-tools.js.map +1 -0
- package/dist/core/compaction/context-transcript-analysis.d.ts +9 -0
- package/dist/core/compaction/context-transcript-analysis.d.ts.map +1 -0
- package/dist/core/compaction/context-transcript-analysis.js +234 -0
- package/dist/core/compaction/context-transcript-analysis.js.map +1 -0
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +2 -1
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/template-js/data-tree.js +287 -0
- package/dist/core/export-html/template-js/entries-navigation.js +424 -0
- package/dist/core/export-html/template-js/initialization.js +312 -0
- package/dist/core/export-html/template-js/message-tools.js +415 -0
- package/dist/core/export-html/template-js/tree-filter-render.js +421 -0
- package/dist/core/export-html/template-script.d.ts +3 -0
- package/dist/core/export-html/template-script.d.ts.map +1 -0
- package/dist/core/export-html/template-script.js +13 -0
- package/dist/core/export-html/template-script.js.map +1 -0
- package/dist/core/export-html/template.js +3 -1
- package/dist/core/extensions/agent-events.d.ts +159 -0
- package/dist/core/extensions/agent-events.d.ts.map +1 -0
- package/dist/core/extensions/agent-events.js +2 -0
- package/dist/core/extensions/agent-events.js.map +1 -0
- package/dist/core/extensions/api-types.d.ts +189 -0
- package/dist/core/extensions/api-types.d.ts.map +1 -0
- package/dist/core/extensions/api-types.js +2 -0
- package/dist/core/extensions/api-types.js.map +1 -0
- package/dist/core/extensions/command-types.d.ts +14 -0
- package/dist/core/extensions/command-types.d.ts.map +1 -0
- package/dist/core/extensions/command-types.js +2 -0
- package/dist/core/extensions/command-types.js.map +1 -0
- package/dist/core/extensions/context-types.d.ts +130 -0
- package/dist/core/extensions/context-types.d.ts.map +1 -0
- package/dist/core/extensions/context-types.js +2 -0
- package/dist/core/extensions/context-types.js.map +1 -0
- package/dist/core/extensions/event-results.d.ts +61 -0
- package/dist/core/extensions/event-results.d.ts.map +1 -0
- package/dist/core/extensions/event-results.js +2 -0
- package/dist/core/extensions/event-results.js.map +1 -0
- package/dist/core/extensions/event-types.d.ts +6 -0
- package/dist/core/extensions/event-types.d.ts.map +1 -0
- package/dist/core/extensions/event-types.js +2 -0
- package/dist/core/extensions/event-types.js.map +1 -0
- package/dist/core/extensions/loader-api.d.ts +10 -0
- package/dist/core/extensions/loader-api.d.ts.map +1 -0
- package/dist/core/extensions/loader-api.js +143 -0
- package/dist/core/extensions/loader-api.js.map +1 -0
- package/dist/core/extensions/loader-core.d.ts +12 -0
- package/dist/core/extensions/loader-core.d.ts.map +1 -0
- package/dist/core/extensions/loader-core.js +91 -0
- package/dist/core/extensions/loader-core.js.map +1 -0
- package/dist/core/extensions/loader-discovery.d.ts +7 -0
- package/dist/core/extensions/loader-discovery.d.ts.map +1 -0
- package/dist/core/extensions/loader-discovery.js +139 -0
- package/dist/core/extensions/loader-discovery.js.map +1 -0
- package/dist/core/extensions/loader-resources.d.ts +11 -0
- package/dist/core/extensions/loader-resources.d.ts.map +1 -0
- package/dist/core/extensions/loader-resources.js +10 -0
- package/dist/core/extensions/loader-resources.js.map +1 -0
- package/dist/core/extensions/loader-runtime.d.ts +7 -0
- package/dist/core/extensions/loader-runtime.d.ts.map +1 -0
- package/dist/core/extensions/loader-runtime.js +51 -0
- package/dist/core/extensions/loader-runtime.js.map +1 -0
- package/dist/core/extensions/loader-virtual-modules.d.ts +3 -0
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -0
- package/dist/core/extensions/loader-virtual-modules.js +92 -0
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +4 -28
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +3 -542
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/message-types.d.ts +34 -0
- package/dist/core/extensions/message-types.d.ts.map +1 -0
- package/dist/core/extensions/message-types.js +2 -0
- package/dist/core/extensions/message-types.js.map +1 -0
- package/dist/core/extensions/provider-types.d.ts +71 -0
- package/dist/core/extensions/provider-types.d.ts.map +1 -0
- package/dist/core/extensions/provider-types.js +2 -0
- package/dist/core/extensions/provider-types.js.map +1 -0
- package/dist/core/extensions/runner-context.d.ts +42 -0
- package/dist/core/extensions/runner-context.d.ts.map +1 -0
- package/dist/core/extensions/runner-context.js +112 -0
- package/dist/core/extensions/runner-context.js.map +1 -0
- package/dist/core/extensions/runner-events.d.ts +47 -0
- package/dist/core/extensions/runner-events.d.ts.map +1 -0
- package/dist/core/extensions/runner-events.js +280 -0
- package/dist/core/extensions/runner-events.js.map +1 -0
- package/dist/core/extensions/runner-handlers.d.ts +32 -0
- package/dist/core/extensions/runner-handlers.d.ts.map +1 -0
- package/dist/core/extensions/runner-handlers.js +2 -0
- package/dist/core/extensions/runner-handlers.js.map +1 -0
- package/dist/core/extensions/runner-project-trust.d.ts +6 -0
- package/dist/core/extensions/runner-project-trust.d.ts.map +1 -0
- package/dist/core/extensions/runner-project-trust.js +27 -0
- package/dist/core/extensions/runner-project-trust.js.map +1 -0
- package/dist/core/extensions/runner-registries.d.ts +8 -0
- package/dist/core/extensions/runner-registries.d.ts.map +1 -0
- package/dist/core/extensions/runner-registries.js +76 -0
- package/dist/core/extensions/runner-registries.js.map +1 -0
- package/dist/core/extensions/runner-shortcuts.d.ts +10 -0
- package/dist/core/extensions/runner-shortcuts.d.ts.map +1 -0
- package/dist/core/extensions/runner-shortcuts.js +71 -0
- package/dist/core/extensions/runner-shortcuts.js.map +1 -0
- package/dist/core/extensions/runner-ui.d.ts +3 -0
- package/dist/core/extensions/runner-ui.d.ts.map +1 -0
- package/dist/core/extensions/runner-ui.js +50 -0
- package/dist/core/extensions/runner-ui.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +7 -74
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +67 -673
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/runtime-types.d.ts +179 -0
- package/dist/core/extensions/runtime-types.d.ts.map +1 -0
- package/dist/core/extensions/runtime-types.js +2 -0
- package/dist/core/extensions/runtime-types.js.map +1 -0
- package/dist/core/extensions/session-events.d.ts +89 -0
- package/dist/core/extensions/session-events.d.ts.map +1 -0
- package/dist/core/extensions/session-events.js +2 -0
- package/dist/core/extensions/session-events.js.map +1 -0
- package/dist/core/extensions/tool-events.d.ts +127 -0
- package/dist/core/extensions/tool-events.d.ts.map +1 -0
- package/dist/core/extensions/tool-events.js +26 -0
- package/dist/core/extensions/tool-events.js.map +1 -0
- package/dist/core/extensions/tool-types.d.ts +100 -0
- package/dist/core/extensions/tool-types.d.ts.map +1 -0
- package/dist/core/extensions/tool-types.js +11 -0
- package/dist/core/extensions/tool-types.js.map +1 -0
- package/dist/core/extensions/types.d.ts +20 -1288
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js +4 -34
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/ui-types.d.ts +200 -0
- package/dist/core/extensions/ui-types.d.ts.map +1 -0
- package/dist/core/extensions/ui-types.js +2 -0
- package/dist/core/extensions/ui-types.js.map +1 -0
- package/dist/core/model-registry-auth.d.ts +7 -0
- package/dist/core/model-registry-auth.d.ts.map +1 -0
- package/dist/core/model-registry-auth.js +64 -0
- package/dist/core/model-registry-auth.js.map +1 -0
- package/dist/core/model-registry-builtins.d.ts +9 -0
- package/dist/core/model-registry-builtins.d.ts.map +1 -0
- package/dist/core/model-registry-builtins.js +120 -0
- package/dist/core/model-registry-builtins.js.map +1 -0
- package/dist/core/model-registry-custom-loader.d.ts +3 -0
- package/dist/core/model-registry-custom-loader.d.ts.map +1 -0
- package/dist/core/model-registry-custom-loader.js +213 -0
- package/dist/core/model-registry-custom-loader.js.map +1 -0
- package/dist/core/model-registry-dynamic.d.ts +6 -0
- package/dist/core/model-registry-dynamic.d.ts.map +1 -0
- package/dist/core/model-registry-dynamic.js +155 -0
- package/dist/core/model-registry-dynamic.js.map +1 -0
- package/dist/core/model-registry-loader.d.ts +4 -0
- package/dist/core/model-registry-loader.d.ts.map +1 -0
- package/dist/core/model-registry-loader.js +20 -0
- package/dist/core/model-registry-loader.js.map +1 -0
- package/dist/core/model-registry-schemas.d.ts +1084 -0
- package/dist/core/model-registry-schemas.d.ts.map +1 -0
- package/dist/core/model-registry-schemas.js +161 -0
- package/dist/core/model-registry-schemas.js.map +1 -0
- package/dist/core/model-registry-types.d.ts +74 -0
- package/dist/core/model-registry-types.d.ts.map +1 -0
- package/dist/core/model-registry-types.js +2 -0
- package/dist/core/model-registry-types.js.map +1 -0
- package/dist/core/model-registry.d.ts +3 -76
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +24 -733
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver-cli.d.ts +19 -0
- package/dist/core/model-resolver-cli.d.ts.map +1 -0
- package/dist/core/model-resolver-cli.js +118 -0
- package/dist/core/model-resolver-cli.js.map +1 -0
- package/dist/core/model-resolver-defaults.d.ts +5 -0
- package/dist/core/model-resolver-defaults.d.ts.map +1 -0
- package/dist/core/model-resolver-defaults.js +47 -0
- package/dist/core/model-resolver-defaults.js.map +1 -0
- package/dist/core/model-resolver-initial.d.ts +31 -0
- package/dist/core/model-resolver-initial.d.ts.map +1 -0
- package/dist/core/model-resolver-initial.js +116 -0
- package/dist/core/model-resolver-initial.js.map +1 -0
- package/dist/core/model-resolver-patterns.d.ts +26 -0
- package/dist/core/model-resolver-patterns.d.ts.map +1 -0
- package/dist/core/model-resolver-patterns.js +139 -0
- package/dist/core/model-resolver-patterns.js.map +1 -0
- package/dist/core/model-resolver-scope.d.ts +15 -0
- package/dist/core/model-resolver-scope.d.ts.map +1 -0
- package/dist/core/model-resolver-scope.js +66 -0
- package/dist/core/model-resolver-scope.js.map +1 -0
- package/dist/core/model-resolver-types.d.ts +29 -0
- package/dist/core/model-resolver-types.d.ts.map +1 -0
- package/dist/core/model-resolver-types.js +2 -0
- package/dist/core/model-resolver-types.js.map +1 -0
- package/dist/core/model-resolver.d.ts +6 -107
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +5 -549
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/package-manager-auto-resources.d.ts +5 -0
- package/dist/core/package-manager-auto-resources.d.ts.map +1 -0
- package/dist/core/package-manager-auto-resources.js +109 -0
- package/dist/core/package-manager-auto-resources.js.map +1 -0
- package/dist/core/package-manager-command.d.ts +11 -0
- package/dist/core/package-manager-command.d.ts.map +1 -0
- package/dist/core/package-manager-command.js +102 -0
- package/dist/core/package-manager-command.js.map +1 -0
- package/dist/core/package-manager-constants.d.ts +4 -0
- package/dist/core/package-manager-constants.d.ts.map +1 -0
- package/dist/core/package-manager-constants.js +4 -0
- package/dist/core/package-manager-constants.js.map +1 -0
- package/dist/core/package-manager-env.d.ts +4 -0
- package/dist/core/package-manager-env.d.ts.map +1 -0
- package/dist/core/package-manager-env.js +40 -0
- package/dist/core/package-manager-env.js.map +1 -0
- package/dist/core/package-manager-git.d.ts +10 -0
- package/dist/core/package-manager-git.d.ts.map +1 -0
- package/dist/core/package-manager-git.js +271 -0
- package/dist/core/package-manager-git.js.map +1 -0
- package/dist/core/package-manager-manifest.d.ts +7 -0
- package/dist/core/package-manager-manifest.d.ts.map +1 -0
- package/dist/core/package-manager-manifest.js +45 -0
- package/dist/core/package-manager-manifest.js.map +1 -0
- package/dist/core/package-manager-npm.d.ts +25 -0
- package/dist/core/package-manager-npm.d.ts.map +1 -0
- package/dist/core/package-manager-npm.js +252 -0
- package/dist/core/package-manager-npm.js.map +1 -0
- package/dist/core/package-manager-operations.d.ts +11 -0
- package/dist/core/package-manager-operations.d.ts.map +1 -0
- package/dist/core/package-manager-operations.js +196 -0
- package/dist/core/package-manager-operations.js.map +1 -0
- package/dist/core/package-manager-paths.d.ts +14 -0
- package/dist/core/package-manager-paths.d.ts.map +1 -0
- package/dist/core/package-manager-paths.js +61 -0
- package/dist/core/package-manager-paths.js.map +1 -0
- package/dist/core/package-manager-progress.d.ts +4 -0
- package/dist/core/package-manager-progress.d.ts.map +1 -0
- package/dist/core/package-manager-progress.js +16 -0
- package/dist/core/package-manager-progress.js.map +1 -0
- package/dist/core/package-manager-resolver.d.ts +5 -0
- package/dist/core/package-manager-resolver.d.ts.map +1 -0
- package/dist/core/package-manager-resolver.js +149 -0
- package/dist/core/package-manager-resolver.js.map +1 -0
- package/dist/core/package-manager-resource-accumulator.d.ts +6 -0
- package/dist/core/package-manager-resource-accumulator.d.ts.map +1 -0
- package/dist/core/package-manager-resource-accumulator.js +67 -0
- package/dist/core/package-manager-resource-accumulator.js.map +1 -0
- package/dist/core/package-manager-resource-collector.d.ts +5 -0
- package/dist/core/package-manager-resource-collector.d.ts.map +1 -0
- package/dist/core/package-manager-resource-collector.js +148 -0
- package/dist/core/package-manager-resource-collector.js.map +1 -0
- package/dist/core/package-manager-resource-files.d.ts +14 -0
- package/dist/core/package-manager-resource-files.d.ts.map +1 -0
- package/dist/core/package-manager-resource-files.js +265 -0
- package/dist/core/package-manager-resource-files.js.map +1 -0
- package/dist/core/package-manager-resource-patterns.d.ts +12 -0
- package/dist/core/package-manager-resource-patterns.d.ts.map +1 -0
- package/dist/core/package-manager-resource-patterns.js +136 -0
- package/dist/core/package-manager-resource-patterns.js.map +1 -0
- package/dist/core/package-manager-settings.d.ts +10 -0
- package/dist/core/package-manager-settings.d.ts.map +1 -0
- package/dist/core/package-manager-settings.js +91 -0
- package/dist/core/package-manager-settings.js.map +1 -0
- package/dist/core/package-manager-source.d.ts +21 -0
- package/dist/core/package-manager-source.d.ts.map +1 -0
- package/dist/core/package-manager-source.js +146 -0
- package/dist/core/package-manager-source.js.map +1 -0
- package/dist/core/package-manager-types.d.ts +169 -0
- package/dist/core/package-manager-types.d.ts.map +1 -0
- package/dist/core/package-manager-types.js +9 -0
- package/dist/core/package-manager-types.js.map +1 -0
- package/dist/core/package-manager.d.ts +9 -174
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +56 -2100
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/resource-loader-assets.d.ts +6 -0
- package/dist/core/resource-loader-assets.d.ts.map +1 -0
- package/dist/core/resource-loader-assets.js +209 -0
- package/dist/core/resource-loader-assets.js.map +1 -0
- package/dist/core/resource-loader-context-files.d.ts +10 -0
- package/dist/core/resource-loader-context-files.d.ts.map +1 -0
- package/dist/core/resource-loader-context-files.js +74 -0
- package/dist/core/resource-loader-context-files.js.map +1 -0
- package/dist/core/resource-loader-core.d.ts +82 -0
- package/dist/core/resource-loader-core.d.ts.map +1 -0
- package/dist/core/resource-loader-core.js +168 -0
- package/dist/core/resource-loader-core.js.map +1 -0
- package/dist/core/resource-loader-discovery.d.ts +4 -0
- package/dist/core/resource-loader-discovery.d.ts.map +1 -0
- package/dist/core/resource-loader-discovery.js +28 -0
- package/dist/core/resource-loader-discovery.js.map +1 -0
- package/dist/core/resource-loader-extensions.d.ts +13 -0
- package/dist/core/resource-loader-extensions.d.ts.map +1 -0
- package/dist/core/resource-loader-extensions.js +110 -0
- package/dist/core/resource-loader-extensions.js.map +1 -0
- package/dist/core/resource-loader-helpers.d.ts +4 -0
- package/dist/core/resource-loader-helpers.d.ts.map +1 -0
- package/dist/core/resource-loader-helpers.js +23 -0
- package/dist/core/resource-loader-helpers.js.map +1 -0
- package/dist/core/resource-loader-internals.d.ts +96 -0
- package/dist/core/resource-loader-internals.d.ts.map +1 -0
- package/dist/core/resource-loader-internals.js +4 -0
- package/dist/core/resource-loader-internals.js.map +1 -0
- package/dist/core/resource-loader-package-resources.d.ts +31 -0
- package/dist/core/resource-loader-package-resources.d.ts.map +1 -0
- package/dist/core/resource-loader-package-resources.js +112 -0
- package/dist/core/resource-loader-package-resources.js.map +1 -0
- package/dist/core/resource-loader-paths.d.ts +4 -0
- package/dist/core/resource-loader-paths.d.ts.map +1 -0
- package/dist/core/resource-loader-paths.js +22 -0
- package/dist/core/resource-loader-paths.js.map +1 -0
- package/dist/core/resource-loader-reload.d.ts +6 -0
- package/dist/core/resource-loader-reload.d.ts.map +1 -0
- package/dist/core/resource-loader-reload.js +226 -0
- package/dist/core/resource-loader-reload.js.map +1 -0
- package/dist/core/resource-loader-source-info.d.ts +9 -0
- package/dist/core/resource-loader-source-info.d.ts.map +1 -0
- package/dist/core/resource-loader-source-info.js +101 -0
- package/dist/core/resource-loader-source-info.js.map +1 -0
- package/dist/core/resource-loader-types.d.ts +130 -0
- package/dist/core/resource-loader-types.d.ts.map +1 -0
- package/dist/core/resource-loader-types.js +2 -0
- package/dist/core/resource-loader-types.js.map +1 -0
- package/dist/core/resource-loader.d.ts +3 -242
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +2 -976
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk-exports.d.ts +7 -0
- package/dist/core/sdk-exports.d.ts.map +1 -0
- package/dist/core/sdk-exports.js +5 -0
- package/dist/core/sdk-exports.js.map +1 -0
- package/dist/core/sdk-types.d.ts +86 -0
- package/dist/core/sdk-types.d.ts.map +1 -0
- package/dist/core/sdk-types.js +2 -0
- package/dist/core/sdk-types.js.map +1 -0
- package/dist/core/sdk.d.ts +3 -91
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +2 -6
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager-archive.d.ts +27 -0
- package/dist/core/session-manager-archive.d.ts.map +1 -0
- package/dist/core/session-manager-archive.js +114 -0
- package/dist/core/session-manager-archive.js.map +1 -0
- package/dist/core/session-manager-core.d.ts +104 -0
- package/dist/core/session-manager-core.d.ts.map +1 -0
- package/dist/core/session-manager-core.js +346 -0
- package/dist/core/session-manager-core.js.map +1 -0
- package/dist/core/session-manager-entries.d.ts +38 -0
- package/dist/core/session-manager-entries.d.ts.map +1 -0
- package/dist/core/session-manager-entries.js +124 -0
- package/dist/core/session-manager-entries.js.map +1 -0
- package/dist/core/session-manager-history.d.ts +38 -0
- package/dist/core/session-manager-history.d.ts.map +1 -0
- package/dist/core/session-manager-history.js +378 -0
- package/dist/core/session-manager-history.js.map +1 -0
- package/dist/core/session-manager-list.d.ts +5 -0
- package/dist/core/session-manager-list.d.ts.map +1 -0
- package/dist/core/session-manager-list.js +196 -0
- package/dist/core/session-manager-list.js.map +1 -0
- package/dist/core/session-manager-migrations.d.ts +11 -0
- package/dist/core/session-manager-migrations.d.ts.map +1 -0
- package/dist/core/session-manager-migrations.js +80 -0
- package/dist/core/session-manager-migrations.js.map +1 -0
- package/dist/core/session-manager-paths.d.ts +7 -0
- package/dist/core/session-manager-paths.d.ts.map +1 -0
- package/dist/core/session-manager-paths.js +22 -0
- package/dist/core/session-manager-paths.js.map +1 -0
- package/dist/core/session-manager-storage.d.ts +15 -0
- package/dist/core/session-manager-storage.d.ts.map +1 -0
- package/dist/core/session-manager-storage.js +127 -0
- package/dist/core/session-manager-storage.js.map +1 -0
- package/dist/core/session-manager-types.d.ts +172 -0
- package/dist/core/session-manager-types.d.ts.map +1 -0
- package/dist/core/session-manager-types.js +2 -0
- package/dist/core/session-manager-types.js.map +1 -0
- package/dist/core/session-manager-validation.d.ts +7 -0
- package/dist/core/session-manager-validation.d.ts.map +1 -0
- package/dist/core/session-manager-validation.js +34 -0
- package/dist/core/session-manager-validation.js.map +1 -0
- package/dist/core/session-manager.d.ts +8 -390
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +7 -1418
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +65 -0
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -0
- package/dist/core/settings-manager-basic-accessors.js +253 -0
- package/dist/core/settings-manager-basic-accessors.js.map +1 -0
- package/dist/core/settings-manager-core.d.ts +57 -0
- package/dist/core/settings-manager-core.d.ts.map +1 -0
- package/dist/core/settings-manager-core.js +387 -0
- package/dist/core/settings-manager-core.js.map +1 -0
- package/dist/core/settings-manager-internals.d.ts +13 -0
- package/dist/core/settings-manager-internals.d.ts.map +1 -0
- package/dist/core/settings-manager-internals.js +4 -0
- package/dist/core/settings-manager-internals.js.map +1 -0
- package/dist/core/settings-manager-resource-accessors.d.ts +43 -0
- package/dist/core/settings-manager-resource-accessors.d.ts.map +1 -0
- package/dist/core/settings-manager-resource-accessors.js +172 -0
- package/dist/core/settings-manager-resource-accessors.js.map +1 -0
- package/dist/core/settings-manager-ui-accessors.d.ts +44 -0
- package/dist/core/settings-manager-ui-accessors.d.ts.map +1 -0
- package/dist/core/settings-manager-ui-accessors.js +208 -0
- package/dist/core/settings-manager-ui-accessors.js.map +1 -0
- package/dist/core/settings-manager.d.ts +6 -321
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +5 -1060
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-merge.d.ts +4 -0
- package/dist/core/settings-merge.d.ts.map +1 -0
- package/dist/core/settings-merge.js +26 -0
- package/dist/core/settings-merge.js.map +1 -0
- package/dist/core/settings-storage.d.ts +20 -0
- package/dist/core/settings-storage.d.ts.map +1 -0
- package/dist/core/settings-storage.js +100 -0
- package/dist/core/settings-storage.js.map +1 -0
- package/dist/core/settings-types.d.ts +123 -0
- package/dist/core/settings-types.d.ts.map +1 -0
- package/dist/core/settings-types.js +2 -0
- package/dist/core/settings-types.js.map +1 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +7 -0
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash-policy-compile.d.ts +5 -0
- package/dist/core/tools/bash-policy-compile.d.ts.map +1 -0
- package/dist/core/tools/bash-policy-compile.js +241 -0
- package/dist/core/tools/bash-policy-compile.js.map +1 -0
- package/dist/core/tools/bash-policy-evaluate.d.ts +3 -0
- package/dist/core/tools/bash-policy-evaluate.d.ts.map +1 -0
- package/dist/core/tools/bash-policy-evaluate.js +92 -0
- package/dist/core/tools/bash-policy-evaluate.js.map +1 -0
- package/dist/core/tools/bash-policy-format.d.ts +5 -0
- package/dist/core/tools/bash-policy-format.d.ts.map +1 -0
- package/dist/core/tools/bash-policy-format.js +49 -0
- package/dist/core/tools/bash-policy-format.js.map +1 -0
- package/dist/core/tools/bash-policy-parser.d.ts +4 -0
- package/dist/core/tools/bash-policy-parser.d.ts.map +1 -0
- package/dist/core/tools/bash-policy-parser.js +155 -0
- package/dist/core/tools/bash-policy-parser.js.map +1 -0
- package/dist/core/tools/bash-policy-segment.d.ts +3 -0
- package/dist/core/tools/bash-policy-segment.d.ts.map +1 -0
- package/dist/core/tools/bash-policy-segment.js +275 -0
- package/dist/core/tools/bash-policy-segment.js.map +1 -0
- package/dist/core/tools/bash-policy-shell.d.ts +11 -0
- package/dist/core/tools/bash-policy-shell.d.ts.map +1 -0
- package/dist/core/tools/bash-policy-shell.js +267 -0
- package/dist/core/tools/bash-policy-shell.js.map +1 -0
- package/dist/core/tools/bash-policy-types.d.ts +146 -0
- package/dist/core/tools/bash-policy-types.d.ts.map +1 -0
- package/dist/core/tools/bash-policy-types.js +2 -0
- package/dist/core/tools/bash-policy-types.js.map +1 -0
- package/dist/core/tools/bash-policy.d.ts +5 -61
- package/dist/core/tools/bash-policy.d.ts.map +1 -1
- package/dist/core/tools/bash-policy.js +4 -1068
- package/dist/core/tools/bash-policy.js.map +1 -1
- package/dist/core/tools/todos-execute.d.ts +5 -0
- package/dist/core/tools/todos-execute.d.ts.map +1 -0
- package/dist/core/tools/todos-execute.js +200 -0
- package/dist/core/tools/todos-execute.js.map +1 -0
- package/dist/core/tools/todos-locks.d.ts +4 -0
- package/dist/core/tools/todos-locks.d.ts.map +1 -0
- package/dist/core/tools/todos-locks.js +80 -0
- package/dist/core/tools/todos-locks.js.map +1 -0
- package/dist/core/tools/todos-model.d.ts +21 -0
- package/dist/core/tools/todos-model.d.ts.map +1 -0
- package/dist/core/tools/todos-model.js +71 -0
- package/dist/core/tools/todos-model.js.map +1 -0
- package/dist/core/tools/todos-mutations.d.ts +6 -0
- package/dist/core/tools/todos-mutations.d.ts.map +1 -0
- package/dist/core/tools/todos-mutations.js +85 -0
- package/dist/core/tools/todos-mutations.js.map +1 -0
- package/dist/core/tools/todos-paths.d.ts +5 -0
- package/dist/core/tools/todos-paths.d.ts.map +1 -0
- package/dist/core/tools/todos-paths.js +25 -0
- package/dist/core/tools/todos-paths.js.map +1 -0
- package/dist/core/tools/todos-render.d.ts +10 -0
- package/dist/core/tools/todos-render.d.ts.map +1 -0
- package/dist/core/tools/todos-render.js +159 -0
- package/dist/core/tools/todos-render.js.map +1 -0
- package/dist/core/tools/todos-storage.d.ts +9 -0
- package/dist/core/tools/todos-storage.d.ts.map +1 -0
- package/dist/core/tools/todos-storage.js +183 -0
- package/dist/core/tools/todos-storage.js.map +1 -0
- package/dist/core/tools/todos-types.d.ts +46 -0
- package/dist/core/tools/todos-types.d.ts.map +1 -0
- package/dist/core/tools/todos-types.js +27 -0
- package/dist/core/tools/todos-types.js.map +1 -0
- package/dist/core/tools/todos.d.ts +12 -32
- package/dist/core/tools/todos.d.ts.map +1 -1
- package/dist/core/tools/todos.js +7 -893
- package/dist/core/tools/todos.js.map +1 -1
- package/dist/index-extensions.d.ts +3 -0
- package/dist/index-extensions.d.ts.map +1 -0
- package/dist/index-extensions.js +2 -0
- package/dist/index-extensions.js.map +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main-app-mode.d.ts +15 -0
- package/dist/main-app-mode.d.ts.map +1 -0
- package/dist/main-app-mode.js +51 -0
- package/dist/main-app-mode.js.map +1 -0
- package/dist/main-session-options.d.ts +12 -0
- package/dist/main-session-options.d.ts.map +1 -0
- package/dist/main-session-options.js +87 -0
- package/dist/main-session-options.js.map +1 -0
- package/dist/main-session.d.ts +9 -0
- package/dist/main-session.d.ts.map +1 -0
- package/dist/main-session.js +188 -0
- package/dist/main-session.js.map +1 -0
- package/dist/main-stdio.d.ts +12 -0
- package/dist/main-stdio.d.ts.map +1 -0
- package/dist/main-stdio.js +68 -0
- package/dist/main-stdio.js.map +1 -0
- package/dist/main.d.ts +2 -3
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +11 -388
- package/dist/main.js.map +1 -1
- package/dist/migrations-config-values.d.ts +9 -0
- package/dist/migrations-config-values.d.ts.map +1 -0
- package/dist/migrations-config-values.js +298 -0
- package/dist/migrations-config-values.js.map +1 -0
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +2 -296
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.js +0 -7
- package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts +9 -0
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-actions.js +244 -0
- package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-editor.d.ts +18 -0
- package/dist/modes/interactive/components/chat-session-host-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-editor.js +165 -0
- package/dist/modes/interactive/components/chat-session-host-editor.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-events.d.ts +5 -0
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-events.js +200 -0
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts +13 -0
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-rendering.js +185 -0
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-runtime.d.ts +13 -0
- package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-runtime.js +101 -0
- package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +53 -0
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-state.js +42 -0
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-types.d.ts +63 -0
- package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-types.js +2 -0
- package/dist/modes/interactive/components/chat-session-host-types.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-utils.d.ts +28 -0
- package/dist/modes/interactive/components/chat-session-host-utils.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-session-host-utils.js +103 -0
- package/dist/modes/interactive/components/chat-session-host-utils.js.map +1 -0
- package/dist/modes/interactive/components/chat-session-host.d.ts +6 -129
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +50 -1022
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/config-selector-list.d.ts +65 -0
- package/dist/modes/interactive/components/config-selector-list.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector-list.js +458 -0
- package/dist/modes/interactive/components/config-selector-list.js.map +1 -0
- package/dist/modes/interactive/components/config-selector.d.ts +3 -58
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +2 -457
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-delete.d.ts +10 -0
- package/dist/modes/interactive/components/session-selector-delete.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-delete.js +40 -0
- package/dist/modes/interactive/components/session-selector-delete.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-header.d.ts +33 -0
- package/dist/modes/interactive/components/session-selector-header.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-header.js +117 -0
- package/dist/modes/interactive/components/session-selector-header.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-list.d.ts +49 -0
- package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-list.js +307 -0
- package/dist/modes/interactive/components/session-selector-list.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-tree.d.ts +25 -0
- package/dist/modes/interactive/components/session-selector-tree.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-tree.js +53 -0
- package/dist/modes/interactive/components/session-selector-tree.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-types.d.ts +4 -0
- package/dist/modes/interactive/components/session-selector-types.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-types.js +2 -0
- package/dist/modes/interactive/components/session-selector-types.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-utils.d.ts +4 -0
- package/dist/modes/interactive/components/session-selector-utils.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-utils.js +37 -0
- package/dist/modes/interactive/components/session-selector-utils.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +3 -49
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +5 -542
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-handlers.d.ts +3 -0
- package/dist/modes/interactive/components/settings-selector-handlers.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector-handlers.js +84 -0
- package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector-items.d.ts +4 -0
- package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector-items.js +211 -0
- package/dist/modes/interactive/components/settings-selector-items.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector-options.d.ts +6 -0
- package/dist/modes/interactive/components/settings-selector-options.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector-options.js +14 -0
- package/dist/modes/interactive/components/settings-selector-options.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector-submenus.d.ts +44 -0
- package/dist/modes/interactive/components/settings-selector-submenus.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector-submenus.js +228 -0
- package/dist/modes/interactive/components/settings-selector-submenus.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector-types.d.ts +67 -0
- package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector-types.js +2 -0
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -63
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +5 -538
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-component.d.ts +21 -0
- package/dist/modes/interactive/components/tree-selector-component.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-component.js +80 -0
- package/dist/modes/interactive/components/tree-selector-component.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-content.d.ts +8 -0
- package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-content.js +263 -0
- package/dist/modes/interactive/components/tree-selector-content.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-help.d.ts +16 -0
- package/dist/modes/interactive/components/tree-selector-help.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-help.js +103 -0
- package/dist/modes/interactive/components/tree-selector-help.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-label-input.d.ts +16 -0
- package/dist/modes/interactive/components/tree-selector-label-input.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-label-input.js +46 -0
- package/dist/modes/interactive/components/tree-selector-label-input.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-list.d.ts +33 -0
- package/dist/modes/interactive/components/tree-selector-list.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-list.js +336 -0
- package/dist/modes/interactive/components/tree-selector-list.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-model.d.ts +7 -0
- package/dist/modes/interactive/components/tree-selector-model.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-model.js +358 -0
- package/dist/modes/interactive/components/tree-selector-model.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-types.d.ts +57 -0
- package/dist/modes/interactive/components/tree-selector-types.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-types.js +6 -0
- package/dist/modes/interactive/components/tree-selector-types.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-viewport.d.ts +10 -0
- package/dist/modes/interactive/components/tree-selector-viewport.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector-viewport.js +32 -0
- package/dist/modes/interactive/components/tree-selector-viewport.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +2 -88
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +1 -1200
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.d.ts +2 -0
- package/dist/modes/interactive/interactive-agent-events.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-agent-events.js +370 -0
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -0
- package/dist/modes/interactive/interactive-auth-login.d.ts +2 -0
- package/dist/modes/interactive/interactive-auth-login.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-auth-login.js +214 -0
- package/dist/modes/interactive/interactive-auth-login.js.map +1 -0
- package/dist/modes/interactive/interactive-auth-routing.d.ts +2 -0
- package/dist/modes/interactive/interactive-auth-routing.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-auth-routing.js +128 -0
- package/dist/modes/interactive/interactive-auth-routing.js.map +1 -0
- package/dist/modes/interactive/interactive-autocomplete.d.ts +2 -0
- package/dist/modes/interactive/interactive-autocomplete.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-autocomplete.js +140 -0
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -0
- package/dist/modes/interactive/interactive-bash-compact.d.ts +2 -0
- package/dist/modes/interactive/interactive-bash-compact.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-bash-compact.js +112 -0
- package/dist/modes/interactive/interactive-bash-compact.js.map +1 -0
- package/dist/modes/interactive/interactive-editor-actions.d.ts +2 -0
- package/dist/modes/interactive/interactive-editor-actions.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-editor-actions.js +131 -0
- package/dist/modes/interactive/interactive-editor-actions.js.map +1 -0
- package/dist/modes/interactive/interactive-extension-context.d.ts +2 -0
- package/dist/modes/interactive/interactive-extension-context.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-extension-context.js +159 -0
- package/dist/modes/interactive/interactive-extension-context.js.map +1 -0
- package/dist/modes/interactive/interactive-extension-custom-ui.d.ts +2 -0
- package/dist/modes/interactive/interactive-extension-custom-ui.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-extension-custom-ui.js +208 -0
- package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -0
- package/dist/modes/interactive/interactive-extension-dialogs.d.ts +2 -0
- package/dist/modes/interactive/interactive-extension-dialogs.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-extension-dialogs.js +162 -0
- package/dist/modes/interactive/interactive-extension-dialogs.js.map +1 -0
- package/dist/modes/interactive/interactive-extension-runtime.d.ts +2 -0
- package/dist/modes/interactive/interactive-extension-runtime.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-extension-runtime.js +179 -0
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -0
- package/dist/modes/interactive/interactive-extension-widgets.d.ts +2 -0
- package/dist/modes/interactive/interactive-extension-widgets.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-extension-widgets.js +113 -0
- package/dist/modes/interactive/interactive-extension-widgets.js.map +1 -0
- package/dist/modes/interactive/interactive-hotkeys-debug.d.ts +2 -0
- package/dist/modes/interactive/interactive-hotkeys-debug.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-hotkeys-debug.js +186 -0
- package/dist/modes/interactive/interactive-hotkeys-debug.js.map +1 -0
- package/dist/modes/interactive/interactive-input-handling.d.ts +2 -0
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-input-handling.js +275 -0
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -0
- package/dist/modes/interactive/interactive-mode-base.d.ts +103 -0
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode-base.js +130 -0
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -0
- package/dist/modes/interactive/interactive-mode-deps.d.ts +81 -0
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode-deps.js +74 -0
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -0
- package/dist/modes/interactive/interactive-mode-helpers.d.ts +21 -0
- package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode-helpers.js +77 -0
- package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -0
- package/dist/modes/interactive/interactive-mode-surface.d.ts +313 -0
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode-surface.js +2 -0
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -0
- package/dist/modes/interactive/interactive-mode-types.d.ts +29 -0
- package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode-types.js +2 -0
- package/dist/modes/interactive/interactive-mode-types.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +30 -404
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +29 -5260
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.d.ts +2 -0
- package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-model-routing.js +269 -0
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -0
- package/dist/modes/interactive/interactive-process-lifecycle.d.ts +2 -0
- package/dist/modes/interactive/interactive-process-lifecycle.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-process-lifecycle.js +189 -0
- package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -0
- package/dist/modes/interactive/interactive-queueing.d.ts +2 -0
- package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-queueing.js +163 -0
- package/dist/modes/interactive/interactive-queueing.js.map +1 -0
- package/dist/modes/interactive/interactive-render-chat.d.ts +2 -0
- package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-render-chat.js +170 -0
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -0
- package/dist/modes/interactive/interactive-resource-disclosure.d.ts +2 -0
- package/dist/modes/interactive/interactive-resource-disclosure.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-resource-disclosure.js +101 -0
- package/dist/modes/interactive/interactive-resource-disclosure.js.map +1 -0
- package/dist/modes/interactive/interactive-resource-paths.d.ts +2 -0
- package/dist/modes/interactive/interactive-resource-paths.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-resource-paths.js +228 -0
- package/dist/modes/interactive/interactive-resource-paths.js.map +1 -0
- package/dist/modes/interactive/interactive-resource-rendering.d.ts +2 -0
- package/dist/modes/interactive/interactive-resource-rendering.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-resource-rendering.js +181 -0
- package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -0
- package/dist/modes/interactive/interactive-selectors.d.ts +2 -0
- package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-selectors.js +198 -0
- package/dist/modes/interactive/interactive-selectors.js.map +1 -0
- package/dist/modes/interactive/interactive-session-routing.d.ts +2 -0
- package/dist/modes/interactive/interactive-session-routing.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-session-routing.js +232 -0
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -0
- package/dist/modes/interactive/interactive-session-runtime.d.ts +2 -0
- package/dist/modes/interactive/interactive-session-runtime.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-session-runtime.js +131 -0
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -0
- package/dist/modes/interactive/interactive-slash-commands.d.ts +2 -0
- package/dist/modes/interactive/interactive-slash-commands.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-slash-commands.js +338 -0
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -0
- package/dist/modes/interactive/interactive-startup.d.ts +2 -0
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-startup.js +348 -0
- package/dist/modes/interactive/interactive-startup.js.map +1 -0
- package/dist/modes/interactive/theme/color-utils.d.ts +20 -0
- package/dist/modes/interactive/theme/color-utils.d.ts.map +1 -0
- package/dist/modes/interactive/theme/color-utils.js +204 -0
- package/dist/modes/interactive/theme/color-utils.js.map +1 -0
- package/dist/modes/interactive/theme/export-colors.d.ts +19 -0
- package/dist/modes/interactive/theme/export-colors.d.ts.map +1 -0
- package/dist/modes/interactive/theme/export-colors.js +69 -0
- package/dist/modes/interactive/theme/export-colors.js.map +1 -0
- package/dist/modes/interactive/theme/global-theme.d.ts +12 -0
- package/dist/modes/interactive/theme/global-theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/global-theme.js +150 -0
- package/dist/modes/interactive/theme/global-theme.js.map +1 -0
- package/dist/modes/interactive/theme/terminal-detection.d.ts +30 -0
- package/dist/modes/interactive/theme/terminal-detection.d.ts.map +1 -0
- package/dist/modes/interactive/theme/terminal-detection.js +89 -0
- package/dist/modes/interactive/theme/terminal-detection.js.map +1 -0
- package/dist/modes/interactive/theme/theme-class.d.ts +30 -0
- package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-class.js +83 -0
- package/dist/modes/interactive/theme/theme-class.js.map +1 -0
- package/dist/modes/interactive/theme/theme-loading.d.ts +17 -0
- package/dist/modes/interactive/theme/theme-loading.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-loading.js +155 -0
- package/dist/modes/interactive/theme/theme-loading.js.map +1 -0
- package/dist/modes/interactive/theme/theme-parse.d.ts +5 -0
- package/dist/modes/interactive/theme/theme-parse.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-parse.js +52 -0
- package/dist/modes/interactive/theme/theme-parse.js.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts +255 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme-schema.js +78 -0
- package/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts +6 -108
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +6 -1065
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/theme/tui-theme.d.ts +15 -0
- package/dist/modes/interactive/theme/tui-theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/tui-theme.js +199 -0
- package/dist/modes/interactive/theme/tui-theme.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +1 -61
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +1 -72
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts +14 -0
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-command-handler.js +226 -0
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -0
- package/dist/modes/rpc/rpc-extension-ui.d.ts +15 -0
- package/dist/modes/rpc/rpc-extension-ui.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-extension-ui.js +196 -0
- package/dist/modes/rpc/rpc-extension-ui.js.map +1 -0
- package/dist/modes/rpc/rpc-input.d.ts +12 -0
- package/dist/modes/rpc/rpc-input.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-input.js +54 -0
- package/dist/modes/rpc/rpc-input.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +43 -607
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-responses.d.ts +8 -0
- package/dist/modes/rpc/rpc-responses.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-responses.js +27 -0
- package/dist/modes/rpc/rpc-responses.js.map +1 -0
- package/dist/modes/rpc/rpc-session-binding.d.ts +25 -0
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-session-binding.js +70 -0
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -0
- package/dist/package-manager-cli-parser.d.ts +28 -0
- package/dist/package-manager-cli-parser.d.ts.map +1 -0
- package/dist/package-manager-cli-parser.js +269 -0
- package/dist/package-manager-cli-parser.js.map +1 -0
- package/dist/package-manager-cli.d.ts +0 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +2 -267
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +10 -0
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/version-check.d.ts +1 -0
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +17 -0
- package/dist/utils/version-check.js.map +1 -1
- package/docs/development.md +4 -0
- package/docs/workflows.md +8 -6
- package/examples/extensions/custom-provider-anthropic/index.ts +1 -106
- package/examples/extensions/gondolin/index.ts +0 -23
- package/examples/extensions/overlay-qa-animation-components.ts +255 -0
- package/examples/extensions/overlay-qa-focus-components.ts +222 -0
- package/examples/extensions/overlay-qa-position-components.ts +433 -0
- package/examples/extensions/overlay-qa-shared.ts +37 -0
- package/examples/extensions/overlay-qa-streaming-input-components.ts +205 -0
- package/examples/extensions/overlay-qa-tests.ts +17 -1156
- package/examples/extensions/overlay-qa-toggle-passive-components.ts +169 -0
- package/examples/extensions/space-invaders.ts +0 -60
- package/examples/extensions/subagent/display.ts +148 -0
- package/examples/extensions/subagent/index.ts +11 -858
- package/examples/extensions/subagent/render.ts +383 -0
- package/examples/extensions/subagent/runner.ts +252 -0
- package/examples/extensions/subagent/schemas.ts +59 -0
- package/examples/extensions/subagent/types.ts +36 -0
- package/examples/extensions/tic-tac-toe-instructions.ts +65 -0
- package/examples/extensions/tic-tac-toe-rendering.ts +414 -0
- package/examples/extensions/tic-tac-toe-state.ts +158 -0
- package/examples/extensions/tic-tac-toe.ts +92 -754
- package/examples/rpc-extension-ui-components.ts +189 -0
- package/examples/rpc-extension-ui.ts +2 -179
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
2
|
* Tic-Tac-Toe extension - demonstrates executionMode: "sequential" on tools.
|
|
3
3
|
*
|
|
4
4
|
* The user plays via /tic-tac-toe (arrow keys + Enter).
|
|
@@ -18,608 +18,39 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import { StringEnum } from "@earendil-works/pi-ai";
|
|
21
|
-
import
|
|
22
|
-
import
|
|
21
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
22
|
+
import type { ExtensionAPI, ExtensionContext, ToolExecutionMode } from "@bastani/atomic";
|
|
23
23
|
import { Type } from "typebox";
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
type GameStatus = "playing" | "win_X" | "win_O" | "draw";
|
|
40
|
-
|
|
41
|
-
interface GameState {
|
|
42
|
-
board: Cell[][];
|
|
43
|
-
// User cursor (TUI-only, never exposed to the agent).
|
|
44
|
-
userCursorRow: number;
|
|
45
|
-
userCursorCol: number;
|
|
46
|
-
// Agent cursor (manipulated by the tool, shown in the TUI during O's turn).
|
|
47
|
-
agentCursorRow: number;
|
|
48
|
-
agentCursorCol: number;
|
|
49
|
-
status: GameStatus;
|
|
50
|
-
userMark: Cell;
|
|
51
|
-
agentMark: Cell;
|
|
52
|
-
currentTurn: Cell;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Persisted with each toolResult for state reconstruction AND sent to the
|
|
56
|
-
// agent as `details`. Only the agent cursor is included: the user cursor is
|
|
57
|
-
// private to the TUI.
|
|
58
|
-
interface BoardDetails {
|
|
59
|
-
board: Cell[][];
|
|
60
|
-
agentCursorRow: number;
|
|
61
|
-
agentCursorCol: number;
|
|
62
|
-
status: GameStatus;
|
|
63
|
-
currentTurn: Cell;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// ---------------------------------------------------------------------------
|
|
67
|
-
// Game logic
|
|
68
|
-
// ---------------------------------------------------------------------------
|
|
69
|
-
|
|
70
|
-
// Agent cursor home: where the cursor is reset to after a SUCCESSFUL play.
|
|
71
|
-
// Pinned at (0,0) so every non-origin play requires at least one move, which
|
|
72
|
-
// guarantees multiple tool calls per turn and makes the parallel-vs-sequential
|
|
73
|
-
// behavior observable in the demo. The cursor is NOT reset when the user plays
|
|
74
|
-
// nor on a failed `play` (cell taken), so the agent can retry without
|
|
75
|
-
// starting over.
|
|
76
|
-
const AGENT_CURSOR_HOME_ROW = 0;
|
|
77
|
-
const AGENT_CURSOR_HOME_COL = 0;
|
|
78
|
-
|
|
79
|
-
function createInitialState(): GameState {
|
|
80
|
-
return {
|
|
81
|
-
board: [
|
|
82
|
-
[" ", " ", " "],
|
|
83
|
-
[" ", " ", " "],
|
|
84
|
-
[" ", " ", " "],
|
|
85
|
-
],
|
|
86
|
-
userCursorRow: 1,
|
|
87
|
-
userCursorCol: 1,
|
|
88
|
-
agentCursorRow: AGENT_CURSOR_HOME_ROW,
|
|
89
|
-
agentCursorCol: AGENT_CURSOR_HOME_COL,
|
|
90
|
-
status: "playing",
|
|
91
|
-
userMark: "X",
|
|
92
|
-
agentMark: "O",
|
|
93
|
-
currentTurn: "X",
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function getWinLine(board: Cell[][]): [number, number][] | null {
|
|
98
|
-
const lines: [number, number][][] = [
|
|
99
|
-
[
|
|
100
|
-
[0, 0],
|
|
101
|
-
[0, 1],
|
|
102
|
-
[0, 2],
|
|
103
|
-
],
|
|
104
|
-
[
|
|
105
|
-
[1, 0],
|
|
106
|
-
[1, 1],
|
|
107
|
-
[1, 2],
|
|
108
|
-
],
|
|
109
|
-
[
|
|
110
|
-
[2, 0],
|
|
111
|
-
[2, 1],
|
|
112
|
-
[2, 2],
|
|
113
|
-
],
|
|
114
|
-
[
|
|
115
|
-
[0, 0],
|
|
116
|
-
[1, 0],
|
|
117
|
-
[2, 0],
|
|
118
|
-
],
|
|
119
|
-
[
|
|
120
|
-
[0, 1],
|
|
121
|
-
[1, 1],
|
|
122
|
-
[2, 1],
|
|
123
|
-
],
|
|
124
|
-
[
|
|
125
|
-
[0, 2],
|
|
126
|
-
[1, 2],
|
|
127
|
-
[2, 2],
|
|
128
|
-
],
|
|
129
|
-
[
|
|
130
|
-
[0, 0],
|
|
131
|
-
[1, 1],
|
|
132
|
-
[2, 2],
|
|
133
|
-
],
|
|
134
|
-
[
|
|
135
|
-
[0, 2],
|
|
136
|
-
[1, 1],
|
|
137
|
-
[2, 0],
|
|
138
|
-
],
|
|
139
|
-
];
|
|
140
|
-
for (const line of lines) {
|
|
141
|
-
const vals = line.map(([r, c]) => board[r][c]);
|
|
142
|
-
if (vals[0] !== " " && vals[0] === vals[1] && vals[1] === vals[2]) {
|
|
143
|
-
return line;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function checkWin(board: Cell[][]): GameStatus {
|
|
150
|
-
const winLine = getWinLine(board);
|
|
151
|
-
if (winLine) {
|
|
152
|
-
const [r, c] = winLine[0];
|
|
153
|
-
return board[r][c] === "X" ? "win_X" : "win_O";
|
|
154
|
-
}
|
|
155
|
-
if (board.every((row) => row.every((c) => c !== " "))) {
|
|
156
|
-
return "draw";
|
|
157
|
-
}
|
|
158
|
-
return "playing";
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function boardToAscii(board: Cell[][], agentCursorRow: number, agentCursorCol: number): string {
|
|
162
|
-
// Plain grid with coordinates for empty cells, marking the agent cursor
|
|
163
|
-
// position with angle brackets. The user cursor is NEVER included: it is a
|
|
164
|
-
// TUI-only concept and must not leak to the agent.
|
|
165
|
-
const rows = board.map((row, r) =>
|
|
166
|
-
row
|
|
167
|
-
.map((c, cIdx) => {
|
|
168
|
-
const onCursor = r === agentCursorRow && cIdx === agentCursorCol;
|
|
169
|
-
if (c === " ") return onCursor ? `<[${r},${cIdx}]>` : ` [${r},${cIdx}] `;
|
|
170
|
-
return onCursor ? ` <${c}> ` : ` ${c} `;
|
|
171
|
-
})
|
|
172
|
-
.join("|"),
|
|
173
|
-
);
|
|
174
|
-
const separator = "---------+---------+---------";
|
|
175
|
-
return rows.join(`\n${separator}\n`);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// ---------------------------------------------------------------------------
|
|
179
|
-
// Visual board rendering (ANSI).
|
|
180
|
-
// - Cells have NO background fill. Only the centered glyph is drawn.
|
|
181
|
-
// - Played cells color their glyph AND their surrounding borders in the
|
|
182
|
-
// player's color, so each mark reads as a colored boxed region.
|
|
183
|
-
// - Cursor is indicated with colored borders around the cursor cell.
|
|
184
|
-
// ---------------------------------------------------------------------------
|
|
185
|
-
|
|
186
|
-
const CELL_WIDTH = 7;
|
|
187
|
-
const CELL_HEIGHT = 3;
|
|
188
|
-
|
|
189
|
-
// Player colors (SGR fg codes). Also used for the borders of played cells.
|
|
190
|
-
const FG_CODE_X = "34"; // blue
|
|
191
|
-
const FG_CODE_O = "33"; // yellow
|
|
192
|
-
const FG_CODE_WIN = "32"; // green (overrides on the winning line)
|
|
193
|
-
|
|
194
|
-
// Single-character glyphs, picked for maximum visual size without emoji.
|
|
195
|
-
// - \u2573 (BOX DRAWINGS LIGHT DIAGONAL CROSS) for X
|
|
196
|
-
// - \u25ef (LARGE CIRCLE) for O
|
|
197
|
-
const GLYPH_X = "\u2573";
|
|
198
|
-
const GLYPH_O = "\u25ef";
|
|
199
|
-
|
|
200
|
-
const DIM = (s: string) => `\x1b[2m${s}\x1b[22m`;
|
|
201
|
-
const RESET = "\x1b[0m";
|
|
202
|
-
|
|
203
|
-
function centerPad(content: string, width: number): string {
|
|
204
|
-
const contentLen = visibleWidth(content);
|
|
205
|
-
if (contentLen >= width) return truncateToWidth(content, width);
|
|
206
|
-
const pad = width - contentLen;
|
|
207
|
-
const left = Math.floor(pad / 2);
|
|
208
|
-
return " ".repeat(left) + content + " ".repeat(pad - left);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Fg color for a played cell's glyph and its surrounding borders. Undefined
|
|
212
|
-
// for empty cells.
|
|
213
|
-
function cellFgCode(cell: Cell, isWin: boolean): string | undefined {
|
|
214
|
-
if (cell === " ") return undefined;
|
|
215
|
-
if (isWin) return FG_CODE_WIN;
|
|
216
|
-
return cell === "X" ? FG_CODE_X : FG_CODE_O;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function buildCellContent(mark: Cell, lineIdx: number, isWin: boolean): string {
|
|
220
|
-
const empty = " ".repeat(CELL_WIDTH);
|
|
221
|
-
if (mark === " ") return empty;
|
|
222
|
-
|
|
223
|
-
const isMidLine = lineIdx === Math.floor(CELL_HEIGHT / 2);
|
|
224
|
-
if (!isMidLine) return empty;
|
|
225
|
-
|
|
226
|
-
const glyph = mark === "X" ? GLYPH_X : GLYPH_O;
|
|
227
|
-
const fg = cellFgCode(mark, isWin) as string;
|
|
228
|
-
const padLen = CELL_WIDTH - visibleWidth(glyph);
|
|
229
|
-
const leftPad = Math.floor(padLen / 2);
|
|
230
|
-
const rightPad = padLen - leftPad;
|
|
231
|
-
return `${" ".repeat(leftPad)}\x1b[${fg};1m${glyph}${RESET}${" ".repeat(rightPad)}`;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// Fg color for a border char based on its adjacent cells. Undefined when no
|
|
235
|
-
// adjacent cell is played or when adjacent plays disagree (border stays dim
|
|
236
|
-
// to show the separation).
|
|
237
|
-
function borderFgCode(adjacent: ReadonlyArray<{ cell: Cell; isWin: boolean }>): string | undefined {
|
|
238
|
-
const fgs = adjacent.map((a) => cellFgCode(a.cell, a.isWin)).filter((f): f is string => !!f);
|
|
239
|
-
if (fgs.length === 0) return undefined;
|
|
240
|
-
const first = fgs[0];
|
|
241
|
-
return fgs.every((f) => f === first) ? first : undefined;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
interface BoardRenderOpts {
|
|
245
|
-
board: Cell[][];
|
|
246
|
-
maxWidth: number;
|
|
247
|
-
// Optional cursor overlay. Omit to render a static snapshot (used in tool
|
|
248
|
-
// results, move messages, and the game-over banner).
|
|
249
|
-
cursor?: { row: number; col: number; owner: "user" | "agent" };
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
function renderBoard(opts: BoardRenderOpts): string[] {
|
|
253
|
-
const { board, maxWidth, cursor } = opts;
|
|
254
|
-
const showCursor = !!cursor;
|
|
255
|
-
const cr = cursor?.row ?? -1;
|
|
256
|
-
const cc = cursor?.col ?? -1;
|
|
257
|
-
|
|
258
|
-
// Green for user cursor, yellow for agent cursor.
|
|
259
|
-
const cursorSgr = cursor?.owner === "agent" ? "\x1b[33;1m" : "\x1b[32;1m";
|
|
260
|
-
|
|
261
|
-
const winLine = getWinLine(board);
|
|
262
|
-
const winCells = new Set((winLine ?? []).map(([r, c]) => `${r},${c}`));
|
|
263
|
-
const cellAt = (r: number, c: number) => ({ cell: board[r][c], isWin: winCells.has(`${r},${c}`) });
|
|
264
|
-
|
|
265
|
-
const isCursorCorner = (gridR: number, gridC: number): boolean =>
|
|
266
|
-
showCursor && (gridR === cr || gridR === cr + 1) && (gridC === cc || gridC === cc + 1);
|
|
267
|
-
const isCursorHSegment = (gridR: number, c: number): boolean =>
|
|
268
|
-
showCursor && c === cc && (gridR === cr || gridR === cr + 1);
|
|
269
|
-
const isCursorVBorder = (r: number, gridC: number): boolean =>
|
|
270
|
-
showCursor && r === cr && (gridC === cc || gridC === cc + 1);
|
|
271
|
-
|
|
272
|
-
const paintBorder = (ch: string, highlighted: boolean, fgCode: string | undefined): string => {
|
|
273
|
-
if (highlighted) return `${cursorSgr}${ch}${RESET}`;
|
|
274
|
-
if (fgCode) return `\x1b[${fgCode};1m${ch}${RESET}`;
|
|
275
|
-
return DIM(ch);
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
const cornerChar = (gridR: number, gridC: number): string => {
|
|
279
|
-
if (gridR === 0 && gridC === 0) return "\u250c";
|
|
280
|
-
if (gridR === 0 && gridC === 3) return "\u2510";
|
|
281
|
-
if (gridR === 3 && gridC === 0) return "\u2514";
|
|
282
|
-
if (gridR === 3 && gridC === 3) return "\u2518";
|
|
283
|
-
if (gridR === 0) return "\u252c";
|
|
284
|
-
if (gridR === 3) return "\u2534";
|
|
285
|
-
if (gridC === 0) return "\u251c";
|
|
286
|
-
if (gridC === 3) return "\u2524";
|
|
287
|
-
return "\u253c";
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
const cornerAdjacent = (gridR: number, gridC: number) => {
|
|
291
|
-
const out: { cell: Cell; isWin: boolean }[] = [];
|
|
292
|
-
for (const [dr, dc] of [
|
|
293
|
-
[-1, -1],
|
|
294
|
-
[-1, 0],
|
|
295
|
-
[0, -1],
|
|
296
|
-
[0, 0],
|
|
297
|
-
]) {
|
|
298
|
-
const r = gridR + dr;
|
|
299
|
-
const c = gridC + dc;
|
|
300
|
-
if (r >= 0 && r < 3 && c >= 0 && c < 3) out.push(cellAt(r, c));
|
|
301
|
-
}
|
|
302
|
-
return out;
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
const lines: string[] = [];
|
|
306
|
-
|
|
307
|
-
for (let gridR = 0; gridR <= 3; gridR++) {
|
|
308
|
-
// Horizontal border row.
|
|
309
|
-
let row = "";
|
|
310
|
-
for (let gridC = 0; gridC <= 3; gridC++) {
|
|
311
|
-
const cornerColor = borderFgCode(cornerAdjacent(gridR, gridC));
|
|
312
|
-
row += paintBorder(cornerChar(gridR, gridC), isCursorCorner(gridR, gridC), cornerColor);
|
|
313
|
-
if (gridC < 3) {
|
|
314
|
-
const adj: { cell: Cell; isWin: boolean }[] = [];
|
|
315
|
-
if (gridR > 0) adj.push(cellAt(gridR - 1, gridC));
|
|
316
|
-
if (gridR < 3) adj.push(cellAt(gridR, gridC));
|
|
317
|
-
const segColor = borderFgCode(adj);
|
|
318
|
-
row += paintBorder("\u2500".repeat(CELL_WIDTH), isCursorHSegment(gridR, gridC), segColor);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
lines.push(centerPad(row, maxWidth));
|
|
322
|
-
|
|
323
|
-
if (gridR === 3) break;
|
|
324
|
-
|
|
325
|
-
for (let lineIdx = 0; lineIdx < CELL_HEIGHT; lineIdx++) {
|
|
326
|
-
let contentRow = "";
|
|
327
|
-
for (let gridC = 0; gridC <= 3; gridC++) {
|
|
328
|
-
const adj: { cell: Cell; isWin: boolean }[] = [];
|
|
329
|
-
if (gridC > 0) adj.push(cellAt(gridR, gridC - 1));
|
|
330
|
-
if (gridC < 3) adj.push(cellAt(gridR, gridC));
|
|
331
|
-
const vColor = borderFgCode(adj);
|
|
332
|
-
contentRow += paintBorder("\u2502", isCursorVBorder(gridR, gridC), vColor);
|
|
333
|
-
if (gridC < 3) {
|
|
334
|
-
contentRow += buildCellContent(board[gridR][gridC], lineIdx, winCells.has(`${gridR},${gridC}`));
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
lines.push(centerPad(contentRow, maxWidth));
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
return lines;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// Full TUI board with the right cursor overlayed for the current turn.
|
|
345
|
-
function renderVisualBoard(state: GameState, maxWidth: number): string[] {
|
|
346
|
-
const isUserTurn = state.currentTurn === state.userMark;
|
|
347
|
-
const cursor =
|
|
348
|
-
state.status !== "playing"
|
|
349
|
-
? undefined
|
|
350
|
-
: {
|
|
351
|
-
row: isUserTurn ? state.userCursorRow : state.agentCursorRow,
|
|
352
|
-
col: isUserTurn ? state.userCursorCol : state.agentCursorCol,
|
|
353
|
-
owner: (isUserTurn ? "user" : "agent") as "user" | "agent",
|
|
354
|
-
};
|
|
355
|
-
return renderBoard({ board: state.board, maxWidth, cursor });
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/** Static snapshot used inside tool results and custom messages. */
|
|
359
|
-
function renderBoardSnapshot(board: Cell[][], maxWidth: number): string[] {
|
|
360
|
-
return renderBoard({ board, maxWidth });
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
// ---------------------------------------------------------------------------
|
|
364
|
-
// TUI component
|
|
365
|
-
// ---------------------------------------------------------------------------
|
|
366
|
-
|
|
367
|
-
class TicTacToeComponent implements Component {
|
|
368
|
-
private state: GameState;
|
|
369
|
-
private onClose: () => void;
|
|
370
|
-
private onUserPlay: (row: number, col: number) => void;
|
|
371
|
-
private tui: { requestRender: () => void };
|
|
372
|
-
private cachedLines: string[] = [];
|
|
373
|
-
private cachedWidth = 0;
|
|
374
|
-
private version = 0;
|
|
375
|
-
private cachedVersion = -1;
|
|
376
|
-
|
|
377
|
-
constructor(
|
|
378
|
-
tui: { requestRender: () => void },
|
|
379
|
-
onClose: () => void,
|
|
380
|
-
onUserPlay: (row: number, col: number) => void,
|
|
381
|
-
state: GameState,
|
|
382
|
-
) {
|
|
383
|
-
this.tui = tui;
|
|
384
|
-
this.onClose = onClose;
|
|
385
|
-
this.onUserPlay = onUserPlay;
|
|
386
|
-
this.state = state;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
updateState(state: GameState): void {
|
|
390
|
-
this.state = state;
|
|
391
|
-
this.version++;
|
|
392
|
-
this.tui.requestRender();
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
handleInput(data: string): boolean {
|
|
396
|
-
if (matchesKey(data, "escape") || data === "q" || data === "Q") {
|
|
397
|
-
this.onClose();
|
|
398
|
-
return true;
|
|
399
|
-
}
|
|
400
|
-
if (this.state.status !== "playing") {
|
|
401
|
-
if (data === "r" || data === "R") {
|
|
402
|
-
this.onClose();
|
|
403
|
-
return true;
|
|
404
|
-
}
|
|
405
|
-
return true;
|
|
406
|
-
}
|
|
407
|
-
if (this.state.currentTurn !== this.state.userMark) return true;
|
|
408
|
-
|
|
409
|
-
if (matchesKey(data, "up") && this.state.userCursorRow > 0) {
|
|
410
|
-
this.state.userCursorRow--;
|
|
411
|
-
this.version++;
|
|
412
|
-
this.tui.requestRender();
|
|
413
|
-
} else if (matchesKey(data, "down") && this.state.userCursorRow < 2) {
|
|
414
|
-
this.state.userCursorRow++;
|
|
415
|
-
this.version++;
|
|
416
|
-
this.tui.requestRender();
|
|
417
|
-
} else if (matchesKey(data, "left") && this.state.userCursorCol > 0) {
|
|
418
|
-
this.state.userCursorCol--;
|
|
419
|
-
this.version++;
|
|
420
|
-
this.tui.requestRender();
|
|
421
|
-
} else if (matchesKey(data, "right") && this.state.userCursorCol < 2) {
|
|
422
|
-
this.state.userCursorCol++;
|
|
423
|
-
this.version++;
|
|
424
|
-
this.tui.requestRender();
|
|
425
|
-
} else if (matchesKey(data, "return") || data === " ") {
|
|
426
|
-
const { userCursorRow, userCursorCol } = this.state;
|
|
427
|
-
if (this.state.board[userCursorRow][userCursorCol] === " ") {
|
|
428
|
-
this.onUserPlay(userCursorRow, userCursorCol);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
return true;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
invalidate(): void {
|
|
435
|
-
this.cachedWidth = 0;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
render(width: number): string[] {
|
|
439
|
-
if (width === this.cachedWidth && this.cachedVersion === this.version) {
|
|
440
|
-
return this.cachedLines;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
const ESC = "\x1b[";
|
|
444
|
-
const reset = `${ESC}0m`;
|
|
445
|
-
const bold = (s: string) => `${ESC}1m${s}${reset}`;
|
|
446
|
-
const dim = (s: string) => `${ESC}2m${s}${reset}`;
|
|
447
|
-
const blue = (s: string) => `${ESC}34m${s}${reset}`;
|
|
448
|
-
const yellow = (s: string) => `${ESC}33m${s}${reset}`;
|
|
449
|
-
const green = (s: string) => `${ESC}32m${s}${reset}`;
|
|
450
|
-
|
|
451
|
-
const lines: string[] = [];
|
|
452
|
-
|
|
453
|
-
// Top title banner, full width.
|
|
454
|
-
const titleText = " Tic-Tac-Toe ";
|
|
455
|
-
const titleLen = visibleWidth(titleText);
|
|
456
|
-
const borderLen = Math.max(0, width - titleLen);
|
|
457
|
-
const leftBorder = Math.floor(borderLen / 2);
|
|
458
|
-
const rightBorder = borderLen - leftBorder;
|
|
459
|
-
lines.push(dim("\u2500".repeat(leftBorder)) + bold(blue(titleText)) + dim("\u2500".repeat(rightBorder)));
|
|
460
|
-
|
|
461
|
-
lines.push("");
|
|
462
|
-
|
|
463
|
-
// Status line.
|
|
464
|
-
if (this.state.status !== "playing") {
|
|
465
|
-
const statusText =
|
|
466
|
-
this.state.status === "draw"
|
|
467
|
-
? bold(yellow("Draw!"))
|
|
468
|
-
: this.state.status === "win_X"
|
|
469
|
-
? bold(green("X wins!"))
|
|
470
|
-
: bold(yellow("O wins!"));
|
|
471
|
-
lines.push(centerPad(statusText, width));
|
|
472
|
-
} else if (this.state.currentTurn === "X") {
|
|
473
|
-
lines.push(centerPad(`Turn: ${bold(blue("X"))} (You) ${dim("|")} ${bold(yellow("O"))} (Agent)`, width));
|
|
474
|
-
} else {
|
|
475
|
-
lines.push(centerPad(`${blue("X")} (You) ${dim("|")} Turn: ${bold(yellow("O"))} (Agent)`, width));
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
lines.push("");
|
|
479
|
-
lines.push("");
|
|
480
|
-
|
|
481
|
-
lines.push(...renderVisualBoard(this.state, width));
|
|
482
|
-
|
|
483
|
-
lines.push("");
|
|
484
|
-
lines.push("");
|
|
485
|
-
|
|
486
|
-
// Footer.
|
|
487
|
-
let footer: string;
|
|
488
|
-
if (this.state.status !== "playing") {
|
|
489
|
-
footer = `${bold("R")} restart ${dim("|")} ${bold("Q")}/${bold("ESC")} quit`;
|
|
490
|
-
} else if (this.state.currentTurn !== this.state.userMark) {
|
|
491
|
-
footer = dim("Agent is thinking...");
|
|
492
|
-
} else {
|
|
493
|
-
footer = `${bold("\u2190\u2191\u2193\u2192")} move ${dim("|")} ${bold("ENTER")} play ${dim("|")} ${bold("ESC")} quit`;
|
|
494
|
-
}
|
|
495
|
-
lines.push(centerPad(footer, width));
|
|
496
|
-
|
|
497
|
-
// Bottom separator between the component and the editor below.
|
|
498
|
-
lines.push("");
|
|
499
|
-
lines.push(dim("\u2500".repeat(width)));
|
|
500
|
-
|
|
501
|
-
this.cachedLines = lines;
|
|
502
|
-
this.cachedWidth = width;
|
|
503
|
-
this.cachedVersion = this.version;
|
|
504
|
-
return lines;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
// ---------------------------------------------------------------------------
|
|
509
|
-
// Move-message renderer (full width banner)
|
|
510
|
-
// ---------------------------------------------------------------------------
|
|
511
|
-
|
|
512
|
-
// Full-width banner message with an optional board snapshot underneath.
|
|
513
|
-
class BannerMessageComponent implements Component {
|
|
514
|
-
private readonly title: string;
|
|
515
|
-
private readonly details: BoardDetails | undefined;
|
|
516
|
-
private readonly expanded: boolean;
|
|
517
|
-
private readonly theme: Theme;
|
|
518
|
-
|
|
519
|
-
constructor(title: string, details: BoardDetails | undefined, expanded: boolean, theme: Theme) {
|
|
520
|
-
this.title = title;
|
|
521
|
-
this.details = details;
|
|
522
|
-
this.expanded = expanded;
|
|
523
|
-
this.theme = theme;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
invalidate(): void {}
|
|
527
|
-
|
|
528
|
-
render(width: number): string[] {
|
|
529
|
-
const dim = (s: string) => this.theme.fg("dim", s);
|
|
530
|
-
const lines: string[] = [];
|
|
531
|
-
const titleLen = visibleWidth(this.title);
|
|
532
|
-
const fillLen = Math.max(0, width - titleLen - 2);
|
|
533
|
-
const leftFill = Math.floor(fillLen / 2);
|
|
534
|
-
const rightFill = fillLen - leftFill;
|
|
535
|
-
lines.push(`${dim("\u2500".repeat(leftFill))} ${this.title} ${dim("\u2500".repeat(rightFill))}`);
|
|
536
|
-
|
|
537
|
-
if (this.expanded && this.details) {
|
|
538
|
-
lines.push("");
|
|
539
|
-
lines.push(...renderBoardSnapshot(this.details.board, width));
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
return lines;
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
// End-of-game banner: two dim hrs, a big colored title line, and the final
|
|
547
|
-
// board with the winning line highlighted.
|
|
548
|
-
class GameOverMessageComponent implements Component {
|
|
549
|
-
private readonly status: GameStatus;
|
|
550
|
-
private readonly details: BoardDetails | undefined;
|
|
551
|
-
private readonly theme: Theme;
|
|
552
|
-
|
|
553
|
-
constructor(status: GameStatus, details: BoardDetails | undefined, theme: Theme) {
|
|
554
|
-
this.status = status;
|
|
555
|
-
this.details = details;
|
|
556
|
-
this.theme = theme;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
invalidate(): void {}
|
|
560
|
-
|
|
561
|
-
render(width: number): string[] {
|
|
562
|
-
const dim = (s: string) => this.theme.fg("dim", s);
|
|
563
|
-
const bold = (s: string) => this.theme.bold(s);
|
|
564
|
-
|
|
565
|
-
const hr = dim("\u2500".repeat(width));
|
|
566
|
-
const lines: string[] = [];
|
|
567
|
-
lines.push(hr);
|
|
568
|
-
lines.push("");
|
|
569
|
-
|
|
570
|
-
let title: string;
|
|
571
|
-
let sub: string;
|
|
572
|
-
switch (this.status) {
|
|
573
|
-
case "win_X":
|
|
574
|
-
title = bold(this.theme.fg("accent", "\u2605 Player X wins \u2605"));
|
|
575
|
-
sub = "You beat the agent.";
|
|
576
|
-
break;
|
|
577
|
-
case "win_O":
|
|
578
|
-
title = bold(this.theme.fg("warning", "\u2605 Player O wins \u2605"));
|
|
579
|
-
sub = "The agent beat you.";
|
|
580
|
-
break;
|
|
581
|
-
case "draw":
|
|
582
|
-
title = bold(this.theme.fg("muted", "\u2014 Draw \u2014"));
|
|
583
|
-
sub = "No winner.";
|
|
584
|
-
break;
|
|
585
|
-
default:
|
|
586
|
-
title = bold("Game over");
|
|
587
|
-
sub = "";
|
|
588
|
-
break;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
for (const line of [title, dim(sub)]) {
|
|
592
|
-
const pad = Math.max(0, width - visibleWidth(line));
|
|
593
|
-
lines.push(`${" ".repeat(Math.floor(pad / 2))}${line}`);
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
lines.push("");
|
|
597
|
-
if (this.details) {
|
|
598
|
-
lines.push(...renderBoardSnapshot(this.details.board, width));
|
|
599
|
-
lines.push("");
|
|
600
|
-
}
|
|
601
|
-
lines.push(hr);
|
|
602
|
-
|
|
603
|
-
return lines;
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
// ---------------------------------------------------------------------------
|
|
608
|
-
// Delay helper
|
|
609
|
-
// ---------------------------------------------------------------------------
|
|
610
|
-
|
|
611
|
-
function delay(ms: number): Promise<void> {
|
|
612
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
// ---------------------------------------------------------------------------
|
|
616
|
-
// Extension
|
|
617
|
-
// ---------------------------------------------------------------------------
|
|
24
|
+
import { buildTicTacToeInstructions } from "./tic-tac-toe-instructions.js";
|
|
25
|
+
import { BannerMessageComponent, GameOverMessageComponent, TicTacToeComponent } from "./tic-tac-toe-rendering.js";
|
|
26
|
+
import {
|
|
27
|
+
AGENT_CURSOR_HOME_COL,
|
|
28
|
+
AGENT_CURSOR_HOME_ROW,
|
|
29
|
+
TicTacToeError,
|
|
30
|
+
boardToAscii,
|
|
31
|
+
checkWin,
|
|
32
|
+
createInitialState,
|
|
33
|
+
delay,
|
|
34
|
+
toBoardDetails,
|
|
35
|
+
type BoardDetails,
|
|
36
|
+
type GameState,
|
|
37
|
+
type GameStatus,
|
|
38
|
+
} from "./tic-tac-toe-state.js";
|
|
618
39
|
|
|
619
40
|
const SAVE_TYPE = "tic-tac-toe-save";
|
|
620
41
|
const MOVE_MESSAGE_TYPE = "tic-tac-toe-move";
|
|
621
42
|
const GAME_OVER_MESSAGE_TYPE = "tic-tac-toe-game-over";
|
|
622
43
|
|
|
44
|
+
type Action = "move_up" | "move_down" | "move_left" | "move_right" | "play";
|
|
45
|
+
|
|
46
|
+
const ACTION_DELAYS: Record<Action, number> = {
|
|
47
|
+
move_up: 300,
|
|
48
|
+
move_down: 300,
|
|
49
|
+
move_left: 300,
|
|
50
|
+
move_right: 300,
|
|
51
|
+
play: 0,
|
|
52
|
+
};
|
|
53
|
+
|
|
623
54
|
let gameState: GameState = createInitialState();
|
|
624
55
|
let component: TicTacToeComponent | null = null;
|
|
625
56
|
let gameActive = false;
|
|
@@ -646,13 +77,24 @@ function reconstructState(ctx: ExtensionContext): void {
|
|
|
646
77
|
}
|
|
647
78
|
|
|
648
79
|
function getBoardDetails(): BoardDetails {
|
|
649
|
-
return
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
80
|
+
return toBoardDetails(gameState);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function applyCursorMove(action: Exclude<Action, "play">): string {
|
|
84
|
+
switch (action) {
|
|
85
|
+
case "move_up":
|
|
86
|
+
if (gameState.agentCursorRow > 0) gameState.agentCursorRow--;
|
|
87
|
+
return `Moved up. Cursor: (${gameState.agentCursorRow}, ${gameState.agentCursorCol})`;
|
|
88
|
+
case "move_down":
|
|
89
|
+
if (gameState.agentCursorRow < 2) gameState.agentCursorRow++;
|
|
90
|
+
return `Moved down. Cursor: (${gameState.agentCursorRow}, ${gameState.agentCursorCol})`;
|
|
91
|
+
case "move_left":
|
|
92
|
+
if (gameState.agentCursorCol > 0) gameState.agentCursorCol--;
|
|
93
|
+
return `Moved left. Cursor: (${gameState.agentCursorRow}, ${gameState.agentCursorCol})`;
|
|
94
|
+
case "move_right":
|
|
95
|
+
if (gameState.agentCursorCol < 2) gameState.agentCursorCol++;
|
|
96
|
+
return `Moved right. Cursor: (${gameState.agentCursorRow}, ${gameState.agentCursorCol})`;
|
|
97
|
+
}
|
|
656
98
|
}
|
|
657
99
|
|
|
658
100
|
export default function (pi: ExtensionAPI) {
|
|
@@ -679,9 +121,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
679
121
|
});
|
|
680
122
|
};
|
|
681
123
|
|
|
682
|
-
// -----------------------------------------------------------------------
|
|
683
|
-
// Custom message renderer for user move messages
|
|
684
|
-
// -----------------------------------------------------------------------
|
|
685
124
|
pi.registerMessageRenderer(MOVE_MESSAGE_TYPE, (message, { expanded }, theme) => {
|
|
686
125
|
const details = message.details as BoardDetails | undefined;
|
|
687
126
|
const turnLabel =
|
|
@@ -692,89 +131,17 @@ export default function (pi: ExtensionAPI) {
|
|
|
692
131
|
return new BannerMessageComponent(title, details, expanded, theme);
|
|
693
132
|
});
|
|
694
133
|
|
|
695
|
-
// -----------------------------------------------------------------------
|
|
696
|
-
// Custom message renderer for game-over messages
|
|
697
|
-
// -----------------------------------------------------------------------
|
|
698
134
|
pi.registerMessageRenderer(GAME_OVER_MESSAGE_TYPE, (message, _options, theme) => {
|
|
699
135
|
const details = message.details as BoardDetails | undefined;
|
|
700
136
|
const status = (details?.status ?? "draw") as GameStatus;
|
|
701
137
|
return new GameOverMessageComponent(status, details, theme);
|
|
702
138
|
});
|
|
703
139
|
|
|
704
|
-
// -----------------------------------------------------------------------
|
|
705
|
-
// before_agent_start - inject game instructions each turn
|
|
706
|
-
// -----------------------------------------------------------------------
|
|
707
140
|
pi.on("before_agent_start", async (event) => {
|
|
708
141
|
if (!gameActive) return undefined;
|
|
709
|
-
|
|
710
|
-
const instructions = `
|
|
711
|
-
|
|
712
|
-
## Tic-Tac-Toe (you are Player O)
|
|
713
|
-
|
|
714
|
-
A tic-tac-toe game is in progress. The human is Player X. You are Player O.
|
|
715
|
-
The human plays through a TUI; you play through the \`tic_tac_toe\` tool.
|
|
716
|
-
|
|
717
|
-
### Turn protocol
|
|
718
|
-
|
|
719
|
-
When the human plays, you receive a message that contains the cell X marked,
|
|
720
|
-
the full board, and YOUR cursor position (Player O's cursor). The message is
|
|
721
|
-
the source of truth for the board.
|
|
722
|
-
|
|
723
|
-
Player O's cursor persists between O turns. It is reset to (row=${AGENT_CURSOR_HOME_ROW}, col=${AGENT_CURSOR_HOME_COL})
|
|
724
|
-
only after a successful \`play\`. If a \`play\` fails (cell already taken), the
|
|
725
|
-
cursor stays where it was, so you can move and retry.
|
|
726
|
-
|
|
727
|
-
You may also call \`tic_tac_toe_see_board\` if you want the current board and
|
|
728
|
-
your cursor position restated at any point. The user's cursor is private and
|
|
729
|
-
is never shown to you.
|
|
730
|
-
|
|
731
|
-
### The tool
|
|
732
|
-
|
|
733
|
-
\`tic_tac_toe\` takes ONE action per call:
|
|
734
|
-
- \`move_up\` / \`move_down\` / \`move_left\` / \`move_right\`: move YOUR cursor one cell (clamped at edges)
|
|
735
|
-
- \`play\`: place O on the cell under YOUR cursor. Errors if the cell is not empty.
|
|
736
|
-
|
|
737
|
-
There is no batched form. One call = one action.
|
|
738
|
-
|
|
739
|
-
### CRITICAL: emit the whole turn in a single response
|
|
740
|
-
|
|
741
|
-
To play at (r, c) from your cursor (r0, c0) emit, in order:
|
|
742
|
-
- \`move_down\` (r - r0) times (or \`move_up\` (r0 - r) times if r < r0)
|
|
743
|
-
- \`move_right\` (c - c0) times (or \`move_left\` (c0 - c) times if c < c0)
|
|
744
|
-
- one call of \`play\`
|
|
745
|
-
|
|
746
|
-
All of these tool calls MUST be emitted in the SAME assistant response, as
|
|
747
|
-
separate tool_use blocks, before you stop. Do not:
|
|
748
|
-
- split the sequence across multiple assistant responses,
|
|
749
|
-
- wait for a move result before emitting the next move or \`play\`,
|
|
750
|
-
- write any explanation or text between the tool calls,
|
|
751
|
-
- call any other tool during your turn (except \`tic_tac_toe_see_board\` when you
|
|
752
|
-
explicitly need the state restated).
|
|
753
|
-
|
|
754
|
-
Decide the target cell first, then dump every action for the turn in one go.
|
|
755
|
-
|
|
756
|
-
### Examples (cursor starts at (${AGENT_CURSOR_HOME_ROW}, ${AGENT_CURSOR_HOME_COL}))
|
|
757
|
-
|
|
758
|
-
- Target (0,0): one call, \`play\`.
|
|
759
|
-
- Target (0,2): \`move_right\`, \`move_right\`, \`play\`. Three calls, one response.
|
|
760
|
-
- Target (1,1): \`move_down\`, \`move_right\`, \`play\`. Three calls, one response.
|
|
761
|
-
- Target (2,2): \`move_down\`, \`move_down\`, \`move_right\`, \`move_right\`, \`play\`. Five calls, one response.
|
|
762
|
-
|
|
763
|
-
### Strategy
|
|
764
|
-
|
|
765
|
-
1. If you have two O's in a line with the third cell empty, win by playing there.
|
|
766
|
-
2. Otherwise, if X has two in a line with the third cell empty, block there.
|
|
767
|
-
3. Otherwise, prefer center, then corners, then edges.
|
|
768
|
-
`;
|
|
769
|
-
|
|
770
|
-
return {
|
|
771
|
-
systemPrompt: event.systemPrompt + instructions,
|
|
772
|
-
};
|
|
142
|
+
return { systemPrompt: buildTicTacToeInstructions(event.systemPrompt) };
|
|
773
143
|
});
|
|
774
144
|
|
|
775
|
-
// -----------------------------------------------------------------------
|
|
776
|
-
// /tic-tac-toe command
|
|
777
|
-
// -----------------------------------------------------------------------
|
|
778
145
|
pi.registerCommand("tic-tac-toe", {
|
|
779
146
|
description: "Play tic-tac-toe against the agent",
|
|
780
147
|
|
|
@@ -842,20 +209,6 @@ Decide the target cell first, then dump every action for the turn in one go.
|
|
|
842
209
|
},
|
|
843
210
|
});
|
|
844
211
|
|
|
845
|
-
// -----------------------------------------------------------------------
|
|
846
|
-
// tic_tac_toe tool - one action per call.
|
|
847
|
-
// -----------------------------------------------------------------------
|
|
848
|
-
|
|
849
|
-
type Action = "move_up" | "move_down" | "move_left" | "move_right" | "play";
|
|
850
|
-
|
|
851
|
-
const ACTION_DELAYS: Record<Action, number> = {
|
|
852
|
-
move_up: 300,
|
|
853
|
-
move_down: 300,
|
|
854
|
-
move_left: 300,
|
|
855
|
-
move_right: 300,
|
|
856
|
-
play: 0,
|
|
857
|
-
};
|
|
858
|
-
|
|
859
212
|
pi.registerTool({
|
|
860
213
|
name: "tic_tac_toe",
|
|
861
214
|
label: "Tic-Tac-Toe",
|
|
@@ -879,63 +232,10 @@ Decide the target cell first, then dump every action for the turn in one go.
|
|
|
879
232
|
if (actionDelay > 0) await delay(actionDelay);
|
|
880
233
|
|
|
881
234
|
let result: string;
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
result = `Moved up. Cursor: (${gameState.agentCursorRow}, ${gameState.agentCursorCol})`;
|
|
887
|
-
break;
|
|
888
|
-
case "move_down":
|
|
889
|
-
if (gameState.agentCursorRow < 2) gameState.agentCursorRow++;
|
|
890
|
-
result = `Moved down. Cursor: (${gameState.agentCursorRow}, ${gameState.agentCursorCol})`;
|
|
891
|
-
break;
|
|
892
|
-
case "move_left":
|
|
893
|
-
if (gameState.agentCursorCol > 0) gameState.agentCursorCol--;
|
|
894
|
-
result = `Moved left. Cursor: (${gameState.agentCursorRow}, ${gameState.agentCursorCol})`;
|
|
895
|
-
break;
|
|
896
|
-
case "move_right":
|
|
897
|
-
if (gameState.agentCursorCol < 2) gameState.agentCursorCol++;
|
|
898
|
-
result = `Moved right. Cursor: (${gameState.agentCursorRow}, ${gameState.agentCursorCol})`;
|
|
899
|
-
break;
|
|
900
|
-
case "play": {
|
|
901
|
-
if (gameState.status !== "playing") {
|
|
902
|
-
throw new TicTacToeError(`Game is over (${gameState.status}).`);
|
|
903
|
-
}
|
|
904
|
-
if (gameState.currentTurn !== gameState.agentMark) {
|
|
905
|
-
throw new TicTacToeError("It is not your turn.");
|
|
906
|
-
}
|
|
907
|
-
const r = gameState.agentCursorRow;
|
|
908
|
-
const c = gameState.agentCursorCol;
|
|
909
|
-
if (gameState.board[r][c] !== " ") {
|
|
910
|
-
// Do NOT reset the cursor on failure. The agent can retry
|
|
911
|
-
// from the cursor's current position.
|
|
912
|
-
component?.updateState(gameState);
|
|
913
|
-
pi.appendEntry(SAVE_TYPE, getBoardDetails());
|
|
914
|
-
throw new TicTacToeError(
|
|
915
|
-
`Cell (${r},${c}) is already ${gameState.board[r][c]}. Your cursor is still at (${r},${c}). Move to an empty cell and retry play.`,
|
|
916
|
-
);
|
|
917
|
-
}
|
|
918
|
-
gameState.board[r][c] = gameState.agentMark;
|
|
919
|
-
gameState.status = checkWin(gameState.board);
|
|
920
|
-
// Reset agent cursor to home ONLY on successful play.
|
|
921
|
-
gameState.agentCursorRow = AGENT_CURSOR_HOME_ROW;
|
|
922
|
-
gameState.agentCursorCol = AGENT_CURSOR_HOME_COL;
|
|
923
|
-
if (gameState.status === "playing") {
|
|
924
|
-
gameState.currentTurn = gameState.userMark;
|
|
925
|
-
result = `Placed O at (${r},${c}). Cursor reset to (${AGENT_CURSOR_HOME_ROW},${AGENT_CURSOR_HOME_COL}). Your turn, X!`;
|
|
926
|
-
} else if (gameState.status === "win_O") {
|
|
927
|
-
result = `Placed O at (${r},${c}). Player O wins!`;
|
|
928
|
-
gameActive = false;
|
|
929
|
-
emitGameOverMessage();
|
|
930
|
-
} else if (gameState.status === "draw") {
|
|
931
|
-
result = `Placed O at (${r},${c}). It's a draw!`;
|
|
932
|
-
gameActive = false;
|
|
933
|
-
emitGameOverMessage();
|
|
934
|
-
} else {
|
|
935
|
-
result = `Placed O at (${r},${c}).`;
|
|
936
|
-
}
|
|
937
|
-
break;
|
|
938
|
-
}
|
|
235
|
+
if (params.action === "play") {
|
|
236
|
+
result = handleAgentPlay(emitGameOverMessage, () => pi.appendEntry(SAVE_TYPE, getBoardDetails()));
|
|
237
|
+
} else {
|
|
238
|
+
result = applyCursorMove(params.action);
|
|
939
239
|
}
|
|
940
240
|
|
|
941
241
|
component?.updateState(gameState);
|
|
@@ -966,9 +266,6 @@ Decide the target cell first, then dump every action for the turn in one go.
|
|
|
966
266
|
},
|
|
967
267
|
});
|
|
968
268
|
|
|
969
|
-
// -----------------------------------------------------------------------
|
|
970
|
-
// tic_tac_toe_see_board tool - inspect board + agent cursor.
|
|
971
|
-
// -----------------------------------------------------------------------
|
|
972
269
|
pi.registerTool({
|
|
973
270
|
name: "tic_tac_toe_see_board",
|
|
974
271
|
label: "See Board",
|
|
@@ -1006,3 +303,44 @@ Decide the target cell first, then dump every action for the turn in one go.
|
|
|
1006
303
|
},
|
|
1007
304
|
});
|
|
1008
305
|
}
|
|
306
|
+
|
|
307
|
+
function handleAgentPlay(emitGameOverMessage: () => void, appendSave: () => void): string {
|
|
308
|
+
if (gameState.status !== "playing") {
|
|
309
|
+
throw new TicTacToeError(`Game is over (${gameState.status}).`);
|
|
310
|
+
}
|
|
311
|
+
if (gameState.currentTurn !== gameState.agentMark) {
|
|
312
|
+
throw new TicTacToeError("It is not your turn.");
|
|
313
|
+
}
|
|
314
|
+
const r = gameState.agentCursorRow;
|
|
315
|
+
const c = gameState.agentCursorCol;
|
|
316
|
+
if (gameState.board[r][c] !== " ") {
|
|
317
|
+
// Do NOT reset the cursor on failure. The agent can retry
|
|
318
|
+
// from the cursor's current position.
|
|
319
|
+
component?.updateState(gameState);
|
|
320
|
+
appendSave();
|
|
321
|
+
throw new TicTacToeError(
|
|
322
|
+
`Cell (${r},${c}) is already ${gameState.board[r][c]}. Your cursor is still at (${r},${c}). Move to an empty cell and retry play.`,
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
gameState.board[r][c] = gameState.agentMark;
|
|
327
|
+
gameState.status = checkWin(gameState.board);
|
|
328
|
+
// Reset agent cursor to home ONLY on successful play.
|
|
329
|
+
gameState.agentCursorRow = AGENT_CURSOR_HOME_ROW;
|
|
330
|
+
gameState.agentCursorCol = AGENT_CURSOR_HOME_COL;
|
|
331
|
+
if (gameState.status === "playing") {
|
|
332
|
+
gameState.currentTurn = gameState.userMark;
|
|
333
|
+
return `Placed O at (${r},${c}). Cursor reset to (${AGENT_CURSOR_HOME_ROW},${AGENT_CURSOR_HOME_COL}). Your turn, X!`;
|
|
334
|
+
}
|
|
335
|
+
if (gameState.status === "win_O") {
|
|
336
|
+
gameActive = false;
|
|
337
|
+
emitGameOverMessage();
|
|
338
|
+
return `Placed O at (${r},${c}). Player O wins!`;
|
|
339
|
+
}
|
|
340
|
+
if (gameState.status === "draw") {
|
|
341
|
+
gameActive = false;
|
|
342
|
+
emitGameOverMessage();
|
|
343
|
+
return `Placed O at (${r},${c}). It's a draw!`;
|
|
344
|
+
}
|
|
345
|
+
return `Placed O at (${r},${c}).`;
|
|
346
|
+
}
|