gsd-pi 2.34.0 → 2.35.0-dev.30eec3f
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/dist/cli.js +7 -2
- package/dist/resource-loader.d.ts +1 -1
- package/dist/resource-loader.js +13 -1
- package/dist/resources/extensions/async-jobs/await-tool.js +0 -2
- package/dist/resources/extensions/async-jobs/job-manager.js +0 -6
- package/dist/resources/extensions/bg-shell/output-formatter.js +1 -19
- package/dist/resources/extensions/bg-shell/process-manager.js +0 -4
- package/dist/resources/extensions/bg-shell/types.js +0 -2
- package/dist/resources/extensions/context7/index.js +5 -0
- package/dist/resources/extensions/get-secrets-from-user.js +2 -30
- package/dist/resources/extensions/google-search/index.js +5 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +43 -1
- package/dist/resources/extensions/gsd/auto-loop.js +10 -1
- package/dist/resources/extensions/gsd/auto-recovery.js +35 -0
- package/dist/resources/extensions/gsd/auto-start.js +35 -2
- package/dist/resources/extensions/gsd/auto.js +59 -4
- package/dist/resources/extensions/gsd/changelog.js +162 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +1 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +2 -2
- package/dist/resources/extensions/gsd/commands-inspect.js +10 -3
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +5 -1
- package/dist/resources/extensions/gsd/commands.js +8 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/dist/resources/extensions/gsd/doctor-checks.js +113 -5
- package/dist/resources/extensions/gsd/doctor-environment.js +26 -17
- package/dist/resources/extensions/gsd/doctor-proactive.js +22 -0
- package/dist/resources/extensions/gsd/doctor.js +36 -0
- package/dist/resources/extensions/gsd/files.js +11 -2
- package/dist/resources/extensions/gsd/gitignore.js +54 -7
- package/dist/resources/extensions/gsd/guided-flow.js +5 -3
- package/dist/resources/extensions/gsd/health-widget-core.js +96 -0
- package/dist/resources/extensions/gsd/health-widget.js +97 -46
- package/dist/resources/extensions/gsd/index.js +10 -1
- package/dist/resources/extensions/gsd/migrate-external.js +55 -2
- package/dist/resources/extensions/gsd/paths.js +74 -7
- package/dist/resources/extensions/gsd/post-unit-hooks.js +4 -1
- package/dist/resources/extensions/gsd/preferences-validation.js +54 -1
- package/dist/resources/extensions/gsd/preferences.js +2 -0
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +2 -0
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
- package/dist/resources/extensions/gsd/roadmap-mutations.js +55 -0
- package/dist/resources/extensions/gsd/session-lock.js +26 -2
- package/dist/resources/extensions/gsd/templates/plan.md +8 -0
- package/dist/resources/extensions/gsd/worktree-resolver.js +12 -0
- package/dist/resources/extensions/mcp-client/index.js +2 -1
- package/dist/resources/extensions/remote-questions/remote-command.js +2 -22
- package/dist/resources/extensions/shared/mod.js +1 -1
- package/dist/resources/extensions/shared/sanitize.js +30 -0
- package/dist/resources/extensions/subagent/index.js +6 -14
- package/dist/resources/skills/create-gsd-extension/references/events-reference.md +4 -4
- package/package.json +2 -1
- package/packages/native/dist/native.d.ts +0 -2
- package/packages/native/dist/native.js +0 -2
- package/packages/native/src/native.ts +0 -3
- package/packages/pi-agent-core/dist/agent-loop.d.ts +14 -0
- package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +24 -27
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/dist/agent.d.ts +1 -0
- package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent.js +11 -22
- package/packages/pi-agent-core/dist/agent.js.map +1 -1
- package/packages/pi-agent-core/dist/proxy.d.ts +1 -25
- package/packages/pi-agent-core/dist/proxy.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/proxy.js +3 -9
- package/packages/pi-agent-core/dist/proxy.js.map +1 -1
- package/packages/pi-agent-core/src/agent-loop.ts +30 -27
- package/packages/pi-agent-core/src/agent.ts +12 -23
- package/packages/pi-agent-core/src/proxy.ts +3 -9
- package/packages/pi-ai/dist/api-registry.d.ts +0 -2
- package/packages/pi-ai/dist/api-registry.d.ts.map +1 -1
- package/packages/pi-ai/dist/api-registry.js +0 -10
- package/packages/pi-ai/dist/api-registry.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts +0 -8
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/azure-openai-responses.js +5 -41
- package/packages/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts +0 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.js +1 -1
- package/packages/pi-ai/dist/providers/github-copilot-headers.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts +1 -43
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.js +2 -2
- package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.d.ts +0 -4
- package/packages/pi-ai/dist/providers/google-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +10 -73
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.js +9 -80
- package/packages/pi-ai/dist/providers/openai-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-shared.d.ts +65 -0
- package/packages/pi-ai/dist/providers/openai-shared.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/openai-shared.js +146 -0
- package/packages/pi-ai/dist/providers/openai-shared.js.map +1 -0
- package/packages/pi-ai/dist/providers/register-builtins.d.ts +0 -1
- package/packages/pi-ai/dist/providers/register-builtins.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/register-builtins.js +1 -1
- package/packages/pi-ai/dist/providers/register-builtins.js.map +1 -1
- package/packages/pi-ai/dist/utils/event-stream.d.ts +0 -2
- package/packages/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/event-stream.js +0 -4
- package/packages/pi-ai/dist/utils/event-stream.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js +7 -135
- package/packages/pi-ai/dist/utils/oauth/google-antigravity.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js +7 -135
- package/packages/pi-ai/dist/utils/oauth/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.d.ts +46 -0
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.js +160 -0
- package/packages/pi-ai/dist/utils/oauth/google-oauth-utils.js.map +1 -0
- package/packages/pi-ai/dist/utils/overflow.d.ts +0 -4
- package/packages/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/overflow.js +0 -6
- package/packages/pi-ai/dist/utils/overflow.js.map +1 -1
- package/packages/pi-ai/dist/utils/validation.d.ts +0 -8
- package/packages/pi-ai/dist/utils/validation.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/validation.js +0 -14
- package/packages/pi-ai/dist/utils/validation.js.map +1 -1
- package/packages/pi-ai/src/api-registry.ts +0 -12
- package/packages/pi-ai/src/providers/anthropic.ts +1 -1
- package/packages/pi-ai/src/providers/azure-openai-responses.ts +11 -45
- package/packages/pi-ai/src/providers/github-copilot-headers.ts +1 -1
- package/packages/pi-ai/src/providers/google-gemini-cli.ts +2 -2
- package/packages/pi-ai/src/providers/google-shared.ts +1 -1
- package/packages/pi-ai/src/providers/openai-completions.ts +16 -86
- package/packages/pi-ai/src/providers/openai-responses.ts +16 -96
- package/packages/pi-ai/src/providers/openai-shared.ts +193 -0
- package/packages/pi-ai/src/providers/register-builtins.ts +1 -1
- package/packages/pi-ai/src/utils/event-stream.ts +0 -5
- package/packages/pi-ai/src/utils/oauth/google-antigravity.ts +14 -162
- package/packages/pi-ai/src/utils/oauth/google-gemini-cli.ts +13 -161
- package/packages/pi-ai/src/utils/oauth/google-oauth-utils.ts +201 -0
- package/packages/pi-ai/src/utils/overflow.ts +1 -8
- package/packages/pi-ai/src/utils/validation.ts +0 -15
- package/packages/pi-coding-agent/dist/config.d.ts +0 -9
- package/packages/pi-coding-agent/dist/config.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/config.js +4 -8
- package/packages/pi-coding-agent/dist/config.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +16 -63
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +104 -641
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js +4 -35
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js +5 -43
- package/packages/pi-coding-agent/dist/core/compaction/branch-summarization.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js +11 -69
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts +40 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/utils.js +78 -0
- package/packages/pi-coding-agent/dist/core/compaction/utils.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.d.ts +77 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js +331 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts +0 -4
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js +1 -1
- package/packages/pi-coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +2 -2
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +15 -5
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +129 -256
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +49 -42
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js +2 -21
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts +0 -8
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/keybindings.js +2 -2
- package/packages/pi-coding-agent/dist/core/keybindings.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lock-utils.d.ts +39 -0
- package/packages/pi-coding-agent/dist/core/lock-utils.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/lock-utils.js +89 -0
- package/packages/pi-coding-agent/dist/core/lock-utils.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/lsp/client.d.ts +0 -17
- package/packages/pi-coding-agent/dist/core/lsp/client.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/client.js +3 -62
- package/packages/pi-coding-agent/dist/core/lsp/client.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.d.ts +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/config.js +2 -6
- package/packages/pi-coding-agent/dist/core/lsp/config.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts +0 -5
- package/packages/pi-coding-agent/dist/core/lsp/edits.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.js +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/edits.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/index.js +52 -107
- package/packages/pi-coding-agent/dist/core/lsp/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.js +3 -22
- package/packages/pi-coding-agent/dist/core/lsp/lspmux.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/types.d.ts +0 -1
- package/packages/pi-coding-agent/dist/core/lsp/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/types.js +0 -28
- package/packages/pi-coding-agent/dist/core/lsp/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts +1 -6
- package/packages/pi-coding-agent/dist/core/lsp/utils.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/utils.js +1 -28
- package/packages/pi-coding-agent/dist/core/lsp/utils.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.d.ts +0 -8
- package/packages/pi-coding-agent/dist/core/messages.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.js +5 -5
- package/packages/pi-coding-agent/dist/core/messages.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +0 -3
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +1 -3
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts +1 -26
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.js +3 -59
- package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/package-manager.js +2 -4
- package/packages/pi-coding-agent/dist/core/package-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts +0 -17
- package/packages/pi-coding-agent/dist/core/prompt-templates.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/prompt-templates.js +2 -2
- package/packages/pi-coding-agent/dist/core/prompt-templates.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts +2 -4
- package/packages/pi-coding-agent/dist/core/resource-loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.js +46 -60
- package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts +87 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.js +295 -0
- package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts +0 -5
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +5 -32
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +8 -12
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +78 -168
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.js +1 -3
- package/packages/pi-coding-agent/dist/core/skills.js.map +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +1 -1
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/migrations.d.ts +0 -16
- package/packages/pi-coding-agent/dist/migrations.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/migrations.js +2 -2
- package/packages/pi-coding-agent/dist/migrations.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +0 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js +2 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js +9 -26
- package/packages/pi-coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +1 -13
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.d.ts +44 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.js +61 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-render-utils.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js +6 -9
- package/packages/pi-coding-agent/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +1 -24
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +50 -512
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts +71 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js +514 -0
- package/packages/pi-coding-agent/dist/modes/interactive/slash-command-handlers.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +65 -4
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +6 -23
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts +12 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +175 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.d.ts +6 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.js +15 -0
- package/packages/pi-coding-agent/dist/modes/interactive/utils/shorten-path.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/print-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/print-mode.js +2 -30
- package/packages/pi-coding-agent/dist/modes/print-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js +2 -28
- package/packages/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.d.ts +19 -0
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.js +45 -0
- package/packages/pi-coding-agent/dist/modes/shared/command-context-actions.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts +0 -4
- package/packages/pi-coding-agent/dist/utils/changelog.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/changelog.js +1 -1
- package/packages/pi-coding-agent/dist/utils/changelog.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts +0 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js +1 -1
- package/packages/pi-coding-agent/dist/utils/clipboard-image.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/error.d.ts +5 -0
- package/packages/pi-coding-agent/dist/utils/error.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/error.js +7 -0
- package/packages/pi-coding-agent/dist/utils/error.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/photon.d.ts +0 -19
- package/packages/pi-coding-agent/dist/utils/photon.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/photon.js +1 -120
- package/packages/pi-coding-agent/dist/utils/photon.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts +0 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.js +1 -1
- package/packages/pi-coding-agent/dist/utils/tools-manager.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/config.ts +5 -10
- package/packages/pi-coding-agent/src/core/agent-session.ts +117 -745
- package/packages/pi-coding-agent/src/core/auth-storage.ts +4 -38
- package/packages/pi-coding-agent/src/core/compaction/branch-summarization.ts +7 -53
- package/packages/pi-coding-agent/src/core/compaction/compaction.ts +14 -74
- package/packages/pi-coding-agent/src/core/compaction/utils.ts +100 -0
- package/packages/pi-coding-agent/src/core/compaction-orchestrator.ts +424 -0
- package/packages/pi-coding-agent/src/core/export-html/ansi-to-html.ts +1 -1
- package/packages/pi-coding-agent/src/core/extensions/index.ts +1 -21
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +119 -256
- package/packages/pi-coding-agent/src/core/extensions/types.ts +50 -69
- package/packages/pi-coding-agent/src/core/keybindings.ts +2 -2
- package/packages/pi-coding-agent/src/core/lock-utils.ts +113 -0
- package/packages/pi-coding-agent/src/core/lsp/client.ts +3 -73
- package/packages/pi-coding-agent/src/core/lsp/config.ts +2 -10
- package/packages/pi-coding-agent/src/core/lsp/edits.ts +1 -1
- package/packages/pi-coding-agent/src/core/lsp/index.ts +83 -152
- package/packages/pi-coding-agent/src/core/lsp/lspmux.ts +3 -23
- package/packages/pi-coding-agent/src/core/lsp/types.ts +0 -29
- package/packages/pi-coding-agent/src/core/lsp/utils.ts +1 -33
- package/packages/pi-coding-agent/src/core/messages.ts +5 -5
- package/packages/pi-coding-agent/src/core/model-registry.ts +0 -2
- package/packages/pi-coding-agent/src/core/model-resolver.ts +3 -77
- package/packages/pi-coding-agent/src/core/package-manager.ts +1 -4
- package/packages/pi-coding-agent/src/core/prompt-templates.ts +2 -2
- package/packages/pi-coding-agent/src/core/resource-loader.ts +56 -69
- package/packages/pi-coding-agent/src/core/retry-handler.ts +359 -0
- package/packages/pi-coding-agent/src/core/session-manager.ts +5 -34
- package/packages/pi-coding-agent/src/core/settings-manager.ts +87 -166
- package/packages/pi-coding-agent/src/core/skills.ts +1 -4
- package/packages/pi-coding-agent/src/index.ts +1 -7
- package/packages/pi-coding-agent/src/migrations.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector-search.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/session-selector.ts +17 -29
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +1 -13
- package/packages/pi-coding-agent/src/modes/interactive/components/tree-render-utils.ts +81 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tree-selector.ts +14 -19
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +50 -561
- package/packages/pi-coding-agent/src/modes/interactive/slash-command-handlers.ts +653 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +7 -26
- package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +196 -0
- package/packages/pi-coding-agent/src/modes/interactive/utils/shorten-path.ts +14 -0
- package/packages/pi-coding-agent/src/modes/print-mode.ts +2 -30
- package/packages/pi-coding-agent/src/modes/rpc/rpc-mode.ts +2 -28
- package/packages/pi-coding-agent/src/modes/shared/command-context-actions.ts +53 -0
- package/packages/pi-coding-agent/src/utils/changelog.ts +1 -1
- package/packages/pi-coding-agent/src/utils/clipboard-image.ts +1 -1
- package/packages/pi-coding-agent/src/utils/error.ts +6 -0
- package/packages/pi-coding-agent/src/utils/photon.ts +0 -137
- package/packages/pi-coding-agent/src/utils/tools-manager.ts +1 -1
- package/packages/pi-tui/dist/components/editor.d.ts +0 -10
- package/packages/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/editor.js +1 -1
- package/packages/pi-tui/dist/components/editor.js.map +1 -1
- package/packages/pi-tui/dist/components/markdown.d.ts +5 -0
- package/packages/pi-tui/dist/components/markdown.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/markdown.js +25 -31
- package/packages/pi-tui/dist/components/markdown.js.map +1 -1
- package/packages/pi-tui/dist/keys.d.ts +0 -4
- package/packages/pi-tui/dist/keys.d.ts.map +1 -1
- package/packages/pi-tui/dist/keys.js +94 -162
- package/packages/pi-tui/dist/keys.js.map +1 -1
- package/packages/pi-tui/dist/overlay-layout.d.ts +55 -0
- package/packages/pi-tui/dist/overlay-layout.d.ts.map +1 -0
- package/packages/pi-tui/dist/overlay-layout.js +288 -0
- package/packages/pi-tui/dist/overlay-layout.js.map +1 -0
- package/packages/pi-tui/dist/tui.d.ts +0 -22
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +6 -272
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/dist/utils.d.ts +0 -7
- package/packages/pi-tui/dist/utils.d.ts.map +1 -1
- package/packages/pi-tui/dist/utils.js +0 -44
- package/packages/pi-tui/dist/utils.js.map +1 -1
- package/packages/pi-tui/src/components/editor.ts +1 -1
- package/packages/pi-tui/src/components/markdown.ts +25 -29
- package/packages/pi-tui/src/keys.ts +94 -173
- package/packages/pi-tui/src/overlay-layout.ts +372 -0
- package/packages/pi-tui/src/tui.ts +11 -312
- package/packages/pi-tui/src/utils.ts +0 -43
- package/pkg/dist/core/export-html/ansi-to-html.d.ts +0 -4
- package/pkg/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/pkg/dist/core/export-html/ansi-to-html.js +1 -1
- package/pkg/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.d.ts +65 -4
- package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.js +6 -23
- package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/themes.d.ts +12 -0
- package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -0
- package/pkg/dist/modes/interactive/theme/themes.js +175 -0
- package/pkg/dist/modes/interactive/theme/themes.js.map +1 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/async-jobs/await-tool.ts +0 -2
- package/src/resources/extensions/async-jobs/job-manager.ts +0 -7
- package/src/resources/extensions/bg-shell/output-formatter.ts +0 -17
- package/src/resources/extensions/bg-shell/process-manager.ts +0 -4
- package/src/resources/extensions/bg-shell/types.ts +0 -12
- package/src/resources/extensions/context7/index.ts +7 -0
- package/src/resources/extensions/get-secrets-from-user.ts +2 -35
- package/src/resources/extensions/google-search/index.ts +7 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +49 -1
- package/src/resources/extensions/gsd/auto-loop.ts +11 -1
- package/src/resources/extensions/gsd/auto-recovery.ts +39 -0
- package/src/resources/extensions/gsd/auto-start.ts +42 -2
- package/src/resources/extensions/gsd/auto.ts +61 -3
- package/src/resources/extensions/gsd/changelog.ts +213 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +1 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +2 -2
- package/src/resources/extensions/gsd/commands-inspect.ts +10 -3
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +5 -1
- package/src/resources/extensions/gsd/commands.ts +9 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/src/resources/extensions/gsd/doctor-checks.ts +107 -5
- package/src/resources/extensions/gsd/doctor-environment.ts +26 -16
- package/src/resources/extensions/gsd/doctor-proactive.ts +24 -0
- package/src/resources/extensions/gsd/doctor-types.ts +9 -1
- package/src/resources/extensions/gsd/doctor.ts +35 -0
- package/src/resources/extensions/gsd/files.ts +12 -2
- package/src/resources/extensions/gsd/gitignore.ts +54 -7
- package/src/resources/extensions/gsd/guided-flow.ts +5 -3
- package/src/resources/extensions/gsd/health-widget-core.ts +129 -0
- package/src/resources/extensions/gsd/health-widget.ts +103 -59
- package/src/resources/extensions/gsd/index.ts +10 -1
- package/src/resources/extensions/gsd/migrate-external.ts +47 -2
- package/src/resources/extensions/gsd/paths.ts +73 -7
- package/src/resources/extensions/gsd/post-unit-hooks.ts +5 -1
- package/src/resources/extensions/gsd/preferences-validation.ts +54 -1
- package/src/resources/extensions/gsd/preferences.ts +2 -0
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +2 -0
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +2 -0
- package/src/resources/extensions/gsd/roadmap-mutations.ts +66 -0
- package/src/resources/extensions/gsd/session-lock.ts +29 -2
- package/src/resources/extensions/gsd/templates/plan.md +8 -0
- package/src/resources/extensions/gsd/tests/commands-inspect-open-db.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/doctor-git.test.ts +98 -2
- package/src/resources/extensions/gsd/tests/doctor-runtime.test.ts +59 -3
- package/src/resources/extensions/gsd/tests/files-loadfile-eisdir.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/gitignore-tracked-gsd.test.ts +214 -0
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +158 -0
- package/src/resources/extensions/gsd/tests/paths.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +40 -2
- package/src/resources/extensions/gsd/tests/test-utils.ts +165 -0
- package/src/resources/extensions/gsd/tests/validate-directory.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +32 -0
- package/src/resources/extensions/gsd/worktree-resolver.ts +11 -0
- package/src/resources/extensions/mcp-client/index.ts +2 -1
- package/src/resources/extensions/remote-questions/remote-command.ts +2 -23
- package/src/resources/extensions/shared/mod.ts +1 -1
- package/src/resources/extensions/shared/sanitize.ts +36 -0
- package/src/resources/extensions/subagent/index.ts +6 -12
- package/src/resources/skills/create-gsd-extension/references/events-reference.md +4 -4
- package/dist/resources/extensions/shared/wizard-ui.js +0 -478
- package/packages/pi-coding-agent/dist/modes/interactive/theme/dark.json +0 -85
- package/packages/pi-coding-agent/dist/modes/interactive/theme/light.json +0 -84
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.json +0 -335
- package/packages/pi-coding-agent/src/modes/interactive/theme/dark.json +0 -85
- package/packages/pi-coding-agent/src/modes/interactive/theme/light.json +0 -84
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.json +0 -335
- package/pkg/dist/modes/interactive/theme/dark.json +0 -85
- package/pkg/dist/modes/interactive/theme/light.json +0 -84
- package/pkg/dist/modes/interactive/theme/theme-schema.json +0 -335
- package/src/resources/extensions/shared/wizard-ui.ts +0 -551
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Overlay layout resolution, compositing, and rendering utilities.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from tui.ts — these are pure functions that compute overlay
|
|
5
|
+
* positions and composite overlay content onto base terminal lines.
|
|
6
|
+
*/
|
|
7
|
+
import { extractSegments, sliceByColumn, sliceWithWidth, visibleWidth } from "./utils.js";
|
|
8
|
+
import { isImageLine } from "./terminal-image.js";
|
|
9
|
+
import { CURSOR_MARKER } from "./tui.js";
|
|
10
|
+
// ─── Size parsing ───────────────────────────────────────────────────────────
|
|
11
|
+
/** Parse a SizeValue into absolute value given a reference size */
|
|
12
|
+
export function parseSizeValue(value, referenceSize) {
|
|
13
|
+
if (value === undefined)
|
|
14
|
+
return undefined;
|
|
15
|
+
if (typeof value === "number")
|
|
16
|
+
return value;
|
|
17
|
+
// Parse percentage string like "50%"
|
|
18
|
+
const match = value.match(/^(\d+(?:\.\d+)?)%$/);
|
|
19
|
+
if (match) {
|
|
20
|
+
return Math.floor((referenceSize * parseFloat(match[1])) / 100);
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
// ─── Anchor resolution ──────────────────────────────────────────────────────
|
|
25
|
+
export function resolveAnchorRow(anchor, height, availHeight, marginTop) {
|
|
26
|
+
switch (anchor) {
|
|
27
|
+
case "top-left":
|
|
28
|
+
case "top-center":
|
|
29
|
+
case "top-right":
|
|
30
|
+
return marginTop;
|
|
31
|
+
case "bottom-left":
|
|
32
|
+
case "bottom-center":
|
|
33
|
+
case "bottom-right":
|
|
34
|
+
return marginTop + availHeight - height;
|
|
35
|
+
case "left-center":
|
|
36
|
+
case "center":
|
|
37
|
+
case "right-center":
|
|
38
|
+
return marginTop + Math.floor((availHeight - height) / 2);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export function resolveAnchorCol(anchor, width, availWidth, marginLeft) {
|
|
42
|
+
switch (anchor) {
|
|
43
|
+
case "top-left":
|
|
44
|
+
case "left-center":
|
|
45
|
+
case "bottom-left":
|
|
46
|
+
return marginLeft;
|
|
47
|
+
case "top-right":
|
|
48
|
+
case "right-center":
|
|
49
|
+
case "bottom-right":
|
|
50
|
+
return marginLeft + availWidth - width;
|
|
51
|
+
case "top-center":
|
|
52
|
+
case "center":
|
|
53
|
+
case "bottom-center":
|
|
54
|
+
return marginLeft + Math.floor((availWidth - width) / 2);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Resolve overlay layout from options.
|
|
59
|
+
* Returns { width, row, col, maxHeight } for rendering.
|
|
60
|
+
*/
|
|
61
|
+
export function resolveOverlayLayout(options, overlayHeight, termWidth, termHeight) {
|
|
62
|
+
const opt = options ?? {};
|
|
63
|
+
// Parse margin (clamp to non-negative)
|
|
64
|
+
const margin = typeof opt.margin === "number"
|
|
65
|
+
? { top: opt.margin, right: opt.margin, bottom: opt.margin, left: opt.margin }
|
|
66
|
+
: (opt.margin ?? {});
|
|
67
|
+
const marginTop = Math.max(0, margin.top ?? 0);
|
|
68
|
+
const marginRight = Math.max(0, margin.right ?? 0);
|
|
69
|
+
const marginBottom = Math.max(0, margin.bottom ?? 0);
|
|
70
|
+
const marginLeft = Math.max(0, margin.left ?? 0);
|
|
71
|
+
// Available space after margins
|
|
72
|
+
const availWidth = Math.max(1, termWidth - marginLeft - marginRight);
|
|
73
|
+
const availHeight = Math.max(1, termHeight - marginTop - marginBottom);
|
|
74
|
+
// === Resolve width ===
|
|
75
|
+
let width = parseSizeValue(opt.width, termWidth) ?? Math.min(80, availWidth);
|
|
76
|
+
// Apply minWidth
|
|
77
|
+
if (opt.minWidth !== undefined) {
|
|
78
|
+
width = Math.max(width, opt.minWidth);
|
|
79
|
+
}
|
|
80
|
+
// Clamp to available space
|
|
81
|
+
width = Math.max(1, Math.min(width, availWidth));
|
|
82
|
+
// === Resolve maxHeight ===
|
|
83
|
+
let maxHeight = parseSizeValue(opt.maxHeight, termHeight);
|
|
84
|
+
// Clamp to available space
|
|
85
|
+
if (maxHeight !== undefined) {
|
|
86
|
+
maxHeight = Math.max(1, Math.min(maxHeight, availHeight));
|
|
87
|
+
}
|
|
88
|
+
// Effective overlay height (may be clamped by maxHeight)
|
|
89
|
+
const effectiveHeight = maxHeight !== undefined ? Math.min(overlayHeight, maxHeight) : overlayHeight;
|
|
90
|
+
// === Resolve position ===
|
|
91
|
+
let row;
|
|
92
|
+
let col;
|
|
93
|
+
if (opt.row !== undefined) {
|
|
94
|
+
if (typeof opt.row === "string") {
|
|
95
|
+
// Percentage: 0% = top, 100% = bottom (overlay stays within bounds)
|
|
96
|
+
const match = opt.row.match(/^(\d+(?:\.\d+)?)%$/);
|
|
97
|
+
if (match) {
|
|
98
|
+
const maxRow = Math.max(0, availHeight - effectiveHeight);
|
|
99
|
+
const percent = parseFloat(match[1]) / 100;
|
|
100
|
+
row = marginTop + Math.floor(maxRow * percent);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// Invalid format, fall back to center
|
|
104
|
+
row = resolveAnchorRow("center", effectiveHeight, availHeight, marginTop);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
// Absolute row position
|
|
109
|
+
row = opt.row;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
// Anchor-based (default: center)
|
|
114
|
+
const anchor = opt.anchor ?? "center";
|
|
115
|
+
row = resolveAnchorRow(anchor, effectiveHeight, availHeight, marginTop);
|
|
116
|
+
}
|
|
117
|
+
if (opt.col !== undefined) {
|
|
118
|
+
if (typeof opt.col === "string") {
|
|
119
|
+
// Percentage: 0% = left, 100% = right (overlay stays within bounds)
|
|
120
|
+
const match = opt.col.match(/^(\d+(?:\.\d+)?)%$/);
|
|
121
|
+
if (match) {
|
|
122
|
+
const maxCol = Math.max(0, availWidth - width);
|
|
123
|
+
const percent = parseFloat(match[1]) / 100;
|
|
124
|
+
col = marginLeft + Math.floor(maxCol * percent);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
// Invalid format, fall back to center
|
|
128
|
+
col = resolveAnchorCol("center", width, availWidth, marginLeft);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
// Absolute column position
|
|
133
|
+
col = opt.col;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
// Anchor-based (default: center)
|
|
138
|
+
const anchor = opt.anchor ?? "center";
|
|
139
|
+
col = resolveAnchorCol(anchor, width, availWidth, marginLeft);
|
|
140
|
+
}
|
|
141
|
+
// Apply offsets
|
|
142
|
+
if (opt.offsetY !== undefined)
|
|
143
|
+
row += opt.offsetY;
|
|
144
|
+
if (opt.offsetX !== undefined)
|
|
145
|
+
col += opt.offsetX;
|
|
146
|
+
// Clamp to terminal bounds (respecting margins)
|
|
147
|
+
row = Math.max(marginTop, Math.min(row, termHeight - marginBottom - effectiveHeight));
|
|
148
|
+
col = Math.max(marginLeft, Math.min(col, termWidth - marginRight - width));
|
|
149
|
+
return { width, row, col, maxHeight };
|
|
150
|
+
}
|
|
151
|
+
// ─── Line compositing ───────────────────────────────────────────────────────
|
|
152
|
+
const SEGMENT_RESET = "\x1b[0m\x1b]8;;\x07";
|
|
153
|
+
/** Append reset sequences to each non-image line. */
|
|
154
|
+
export function applyLineResets(lines) {
|
|
155
|
+
for (let i = 0; i < lines.length; i++) {
|
|
156
|
+
const line = lines[i];
|
|
157
|
+
if (!isImageLine(line)) {
|
|
158
|
+
lines[i] = line + SEGMENT_RESET;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return lines;
|
|
162
|
+
}
|
|
163
|
+
/** Splice overlay content into a base line at a specific column. Single-pass optimized. */
|
|
164
|
+
export function compositeLineAt(baseLine, overlayLine, startCol, overlayWidth, totalWidth) {
|
|
165
|
+
if (isImageLine(baseLine))
|
|
166
|
+
return baseLine;
|
|
167
|
+
// Single pass through baseLine extracts both before and after segments
|
|
168
|
+
const afterStart = startCol + overlayWidth;
|
|
169
|
+
const base = extractSegments(baseLine, startCol, afterStart, totalWidth - afterStart, true);
|
|
170
|
+
// Extract overlay with width tracking (strict=true to exclude wide chars at boundary)
|
|
171
|
+
const overlay = sliceWithWidth(overlayLine, 0, overlayWidth, true);
|
|
172
|
+
// Pad segments to target widths
|
|
173
|
+
const beforePad = Math.max(0, startCol - base.beforeWidth);
|
|
174
|
+
const overlayPad = Math.max(0, overlayWidth - overlay.width);
|
|
175
|
+
const actualBeforeWidth = Math.max(startCol, base.beforeWidth);
|
|
176
|
+
const actualOverlayWidth = Math.max(overlayWidth, overlay.width);
|
|
177
|
+
const afterTarget = Math.max(0, totalWidth - actualBeforeWidth - actualOverlayWidth);
|
|
178
|
+
const afterPad = Math.max(0, afterTarget - base.afterWidth);
|
|
179
|
+
// Compose result
|
|
180
|
+
const r = SEGMENT_RESET;
|
|
181
|
+
const result = base.before +
|
|
182
|
+
" ".repeat(beforePad) +
|
|
183
|
+
r +
|
|
184
|
+
overlay.text +
|
|
185
|
+
" ".repeat(overlayPad) +
|
|
186
|
+
r +
|
|
187
|
+
base.after +
|
|
188
|
+
" ".repeat(afterPad);
|
|
189
|
+
// CRITICAL: Always verify and truncate to terminal width.
|
|
190
|
+
// This is the final safeguard against width overflow which would crash the TUI.
|
|
191
|
+
// Width tracking can drift from actual visible width due to:
|
|
192
|
+
// - Complex ANSI/OSC sequences (hyperlinks, colors)
|
|
193
|
+
// - Wide characters at segment boundaries
|
|
194
|
+
// - Edge cases in segment extraction
|
|
195
|
+
const resultWidth = visibleWidth(result);
|
|
196
|
+
if (resultWidth <= totalWidth) {
|
|
197
|
+
return result;
|
|
198
|
+
}
|
|
199
|
+
// Truncate with strict=true to ensure we don't exceed totalWidth
|
|
200
|
+
return sliceByColumn(result, 0, totalWidth, true);
|
|
201
|
+
}
|
|
202
|
+
/** Check if an overlay entry is currently visible */
|
|
203
|
+
export function isOverlayVisible(entry, termWidth, termHeight) {
|
|
204
|
+
if (entry.hidden)
|
|
205
|
+
return false;
|
|
206
|
+
if (entry.options?.visible) {
|
|
207
|
+
return entry.options.visible(termWidth, termHeight);
|
|
208
|
+
}
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Composite all visible overlays into content lines.
|
|
213
|
+
* Sorted by focusOrder (higher = on top).
|
|
214
|
+
*/
|
|
215
|
+
export function compositeOverlays(lines, overlayStack, termWidth, termHeight, maxLinesRendered) {
|
|
216
|
+
if (overlayStack.length === 0)
|
|
217
|
+
return lines;
|
|
218
|
+
const result = [...lines];
|
|
219
|
+
// Pre-render all visible overlays and calculate positions
|
|
220
|
+
const rendered = [];
|
|
221
|
+
let minLinesNeeded = result.length;
|
|
222
|
+
const visibleEntries = overlayStack.filter((e) => isOverlayVisible(e, termWidth, termHeight));
|
|
223
|
+
visibleEntries.sort((a, b) => a.focusOrder - b.focusOrder);
|
|
224
|
+
for (const entry of visibleEntries) {
|
|
225
|
+
const { component, options } = entry;
|
|
226
|
+
// Get layout with height=0 first to determine width and maxHeight
|
|
227
|
+
// (width and maxHeight don't depend on overlay height)
|
|
228
|
+
const { width, maxHeight } = resolveOverlayLayout(options, 0, termWidth, termHeight);
|
|
229
|
+
// Render component at calculated width
|
|
230
|
+
let overlayLines = component.render(width);
|
|
231
|
+
// Apply maxHeight if specified
|
|
232
|
+
if (maxHeight !== undefined && overlayLines.length > maxHeight) {
|
|
233
|
+
overlayLines = overlayLines.slice(0, maxHeight);
|
|
234
|
+
}
|
|
235
|
+
// Get final row/col with actual overlay height
|
|
236
|
+
const { row, col } = resolveOverlayLayout(options, overlayLines.length, termWidth, termHeight);
|
|
237
|
+
rendered.push({ overlayLines, row, col, w: width });
|
|
238
|
+
minLinesNeeded = Math.max(minLinesNeeded, row + overlayLines.length);
|
|
239
|
+
}
|
|
240
|
+
// Ensure result covers the terminal working area to keep overlay positioning stable across resizes.
|
|
241
|
+
// maxLinesRendered can exceed current content length after a shrink; pad to keep viewportStart consistent.
|
|
242
|
+
const workingHeight = Math.max(maxLinesRendered, minLinesNeeded);
|
|
243
|
+
// Extend result with empty lines if content is too short for overlay placement or working area
|
|
244
|
+
while (result.length < workingHeight) {
|
|
245
|
+
result.push("");
|
|
246
|
+
}
|
|
247
|
+
const viewportStart = Math.max(0, workingHeight - termHeight);
|
|
248
|
+
// Composite each overlay
|
|
249
|
+
for (const { overlayLines, row, col, w } of rendered) {
|
|
250
|
+
for (let i = 0; i < overlayLines.length; i++) {
|
|
251
|
+
const idx = viewportStart + row + i;
|
|
252
|
+
if (idx >= 0 && idx < result.length) {
|
|
253
|
+
// Defensive: truncate overlay line to declared width before compositing
|
|
254
|
+
// (components should already respect width, but this ensures it)
|
|
255
|
+
const truncatedOverlayLine = visibleWidth(overlayLines[i]) > w ? sliceByColumn(overlayLines[i], 0, w, true) : overlayLines[i];
|
|
256
|
+
result[idx] = compositeLineAt(result[idx], truncatedOverlayLine, col, w, termWidth);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return result;
|
|
261
|
+
}
|
|
262
|
+
// ─── Cursor extraction ──────────────────────────────────────────────────────
|
|
263
|
+
/**
|
|
264
|
+
* Find and extract cursor position from rendered lines.
|
|
265
|
+
* Searches for CURSOR_MARKER, calculates its position, and strips it from the output.
|
|
266
|
+
* Only scans the bottom terminal height lines (visible viewport).
|
|
267
|
+
* @param lines - Rendered lines to search (mutated to strip marker)
|
|
268
|
+
* @param height - Terminal height (visible viewport size)
|
|
269
|
+
* @returns Cursor position { row, col } or null if no marker found
|
|
270
|
+
*/
|
|
271
|
+
export function extractCursorPosition(lines, height) {
|
|
272
|
+
// Only scan the bottom `height` lines (visible viewport)
|
|
273
|
+
const viewportTop = Math.max(0, lines.length - height);
|
|
274
|
+
for (let row = lines.length - 1; row >= viewportTop; row--) {
|
|
275
|
+
const line = lines[row];
|
|
276
|
+
const markerIndex = line.indexOf(CURSOR_MARKER);
|
|
277
|
+
if (markerIndex !== -1) {
|
|
278
|
+
// Calculate visual column (width of text before marker)
|
|
279
|
+
const beforeMarker = line.slice(0, markerIndex);
|
|
280
|
+
const col = visibleWidth(beforeMarker);
|
|
281
|
+
// Strip marker from the line
|
|
282
|
+
lines[row] = line.slice(0, markerIndex) + line.slice(markerIndex + CURSOR_MARKER.length);
|
|
283
|
+
return { row, col };
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=overlay-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-layout.js","sourceRoot":"","sources":["../src/overlay-layout.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAmB,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3G,OAAO,EAAE,WAAW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AAM,CAAC;AACf,CAAC;AAED,+EAA+E;AAE/E;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAe,EAAE,MAAc;IACpE,yDAAyD;IACzD,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACvD,KAAK,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,IAAI,WAAW,EAAE,GAAG,EAAE,EAAE,CAAC;QAC5D,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACxB,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAChD,IAAI,WAAW,KAAK,CAAC,CAAC,EAAE,CAAC;YACxB,wDAAwD;YACxD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;YAChD,MAAM,GAAG,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;YAEvC,6BAA6B;YAC7B,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;YAEzF,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;QACrB,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/**\n * Overlay layout resolution, compositing, and rendering utilities.\n *\n * Extracted from tui.ts — these are pure functions that compute overlay\n * positions and composite overlay content onto base terminal lines.\n */\n\nimport type { OverlayAnchor, OverlayOptions, SizeValue } from \"./tui.js\";\nimport { extractSegments, sliceByColumn, sliceWithWidth, truncateToWidth, visibleWidth } from \"./utils.js\";\nimport { isImageLine } from \"./terminal-image.js\";\nimport { CURSOR_MARKER } from \"./tui.js\";\n\n// ─── Size parsing ───────────────────────────────────────────────────────────\n\n/** Parse a SizeValue into absolute value given a reference size */\nexport function parseSizeValue(value: SizeValue | undefined, referenceSize: number): number | undefined {\n\tif (value === undefined) return undefined;\n\tif (typeof value === \"number\") return value;\n\t// Parse percentage string like \"50%\"\n\tconst match = value.match(/^(\\d+(?:\\.\\d+)?)%$/);\n\tif (match) {\n\t\treturn Math.floor((referenceSize * parseFloat(match[1])) / 100);\n\t}\n\treturn undefined;\n}\n\n// ─── Anchor resolution ──────────────────────────────────────────────────────\n\nexport function resolveAnchorRow(\n\tanchor: OverlayAnchor,\n\theight: number,\n\tavailHeight: number,\n\tmarginTop: number,\n): number {\n\tswitch (anchor) {\n\t\tcase \"top-left\":\n\t\tcase \"top-center\":\n\t\tcase \"top-right\":\n\t\t\treturn marginTop;\n\t\tcase \"bottom-left\":\n\t\tcase \"bottom-center\":\n\t\tcase \"bottom-right\":\n\t\t\treturn marginTop + availHeight - height;\n\t\tcase \"left-center\":\n\t\tcase \"center\":\n\t\tcase \"right-center\":\n\t\t\treturn marginTop + Math.floor((availHeight - height) / 2);\n\t}\n}\n\nexport function resolveAnchorCol(\n\tanchor: OverlayAnchor,\n\twidth: number,\n\tavailWidth: number,\n\tmarginLeft: number,\n): number {\n\tswitch (anchor) {\n\t\tcase \"top-left\":\n\t\tcase \"left-center\":\n\t\tcase \"bottom-left\":\n\t\t\treturn marginLeft;\n\t\tcase \"top-right\":\n\t\tcase \"right-center\":\n\t\tcase \"bottom-right\":\n\t\t\treturn marginLeft + availWidth - width;\n\t\tcase \"top-center\":\n\t\tcase \"center\":\n\t\tcase \"bottom-center\":\n\t\t\treturn marginLeft + Math.floor((availWidth - width) / 2);\n\t}\n}\n\n// ─── Overlay layout resolution ──────────────────────────────────────────────\n\nexport interface OverlayLayout {\n\twidth: number;\n\trow: number;\n\tcol: number;\n\tmaxHeight: number | undefined;\n}\n\n/**\n * Resolve overlay layout from options.\n * Returns { width, row, col, maxHeight } for rendering.\n */\nexport function resolveOverlayLayout(\n\toptions: OverlayOptions | undefined,\n\toverlayHeight: number,\n\ttermWidth: number,\n\ttermHeight: number,\n): OverlayLayout {\n\tconst opt = options ?? {};\n\n\t// Parse margin (clamp to non-negative)\n\tconst margin =\n\t\ttypeof opt.margin === \"number\"\n\t\t\t? { top: opt.margin, right: opt.margin, bottom: opt.margin, left: opt.margin }\n\t\t\t: (opt.margin ?? {});\n\tconst marginTop = Math.max(0, margin.top ?? 0);\n\tconst marginRight = Math.max(0, margin.right ?? 0);\n\tconst marginBottom = Math.max(0, margin.bottom ?? 0);\n\tconst marginLeft = Math.max(0, margin.left ?? 0);\n\n\t// Available space after margins\n\tconst availWidth = Math.max(1, termWidth - marginLeft - marginRight);\n\tconst availHeight = Math.max(1, termHeight - marginTop - marginBottom);\n\n\t// === Resolve width ===\n\tlet width = parseSizeValue(opt.width, termWidth) ?? Math.min(80, availWidth);\n\t// Apply minWidth\n\tif (opt.minWidth !== undefined) {\n\t\twidth = Math.max(width, opt.minWidth);\n\t}\n\t// Clamp to available space\n\twidth = Math.max(1, Math.min(width, availWidth));\n\n\t// === Resolve maxHeight ===\n\tlet maxHeight = parseSizeValue(opt.maxHeight, termHeight);\n\t// Clamp to available space\n\tif (maxHeight !== undefined) {\n\t\tmaxHeight = Math.max(1, Math.min(maxHeight, availHeight));\n\t}\n\n\t// Effective overlay height (may be clamped by maxHeight)\n\tconst effectiveHeight = maxHeight !== undefined ? Math.min(overlayHeight, maxHeight) : overlayHeight;\n\n\t// === Resolve position ===\n\tlet row: number;\n\tlet col: number;\n\n\tif (opt.row !== undefined) {\n\t\tif (typeof opt.row === \"string\") {\n\t\t\t// Percentage: 0% = top, 100% = bottom (overlay stays within bounds)\n\t\t\tconst match = opt.row.match(/^(\\d+(?:\\.\\d+)?)%$/);\n\t\t\tif (match) {\n\t\t\t\tconst maxRow = Math.max(0, availHeight - effectiveHeight);\n\t\t\t\tconst percent = parseFloat(match[1]) / 100;\n\t\t\t\trow = marginTop + Math.floor(maxRow * percent);\n\t\t\t} else {\n\t\t\t\t// Invalid format, fall back to center\n\t\t\t\trow = resolveAnchorRow(\"center\", effectiveHeight, availHeight, marginTop);\n\t\t\t}\n\t\t} else {\n\t\t\t// Absolute row position\n\t\t\trow = opt.row;\n\t\t}\n\t} else {\n\t\t// Anchor-based (default: center)\n\t\tconst anchor = opt.anchor ?? \"center\";\n\t\trow = resolveAnchorRow(anchor, effectiveHeight, availHeight, marginTop);\n\t}\n\n\tif (opt.col !== undefined) {\n\t\tif (typeof opt.col === \"string\") {\n\t\t\t// Percentage: 0% = left, 100% = right (overlay stays within bounds)\n\t\t\tconst match = opt.col.match(/^(\\d+(?:\\.\\d+)?)%$/);\n\t\t\tif (match) {\n\t\t\t\tconst maxCol = Math.max(0, availWidth - width);\n\t\t\t\tconst percent = parseFloat(match[1]) / 100;\n\t\t\t\tcol = marginLeft + Math.floor(maxCol * percent);\n\t\t\t} else {\n\t\t\t\t// Invalid format, fall back to center\n\t\t\t\tcol = resolveAnchorCol(\"center\", width, availWidth, marginLeft);\n\t\t\t}\n\t\t} else {\n\t\t\t// Absolute column position\n\t\t\tcol = opt.col;\n\t\t}\n\t} else {\n\t\t// Anchor-based (default: center)\n\t\tconst anchor = opt.anchor ?? \"center\";\n\t\tcol = resolveAnchorCol(anchor, width, availWidth, marginLeft);\n\t}\n\n\t// Apply offsets\n\tif (opt.offsetY !== undefined) row += opt.offsetY;\n\tif (opt.offsetX !== undefined) col += opt.offsetX;\n\n\t// Clamp to terminal bounds (respecting margins)\n\trow = Math.max(marginTop, Math.min(row, termHeight - marginBottom - effectiveHeight));\n\tcol = Math.max(marginLeft, Math.min(col, termWidth - marginRight - width));\n\n\treturn { width, row, col, maxHeight };\n}\n\n// ─── Line compositing ───────────────────────────────────────────────────────\n\nconst SEGMENT_RESET = \"\\x1b[0m\\x1b]8;;\\x07\";\n\n/** Append reset sequences to each non-image line. */\nexport function applyLineResets(lines: string[]): string[] {\n\tfor (let i = 0; i < lines.length; i++) {\n\t\tconst line = lines[i];\n\t\tif (!isImageLine(line)) {\n\t\t\tlines[i] = line + SEGMENT_RESET;\n\t\t}\n\t}\n\treturn lines;\n}\n\n/** Splice overlay content into a base line at a specific column. Single-pass optimized. */\nexport function compositeLineAt(\n\tbaseLine: string,\n\toverlayLine: string,\n\tstartCol: number,\n\toverlayWidth: number,\n\ttotalWidth: number,\n): string {\n\tif (isImageLine(baseLine)) return baseLine;\n\n\t// Single pass through baseLine extracts both before and after segments\n\tconst afterStart = startCol + overlayWidth;\n\tconst base = extractSegments(baseLine, startCol, afterStart, totalWidth - afterStart, true);\n\n\t// Extract overlay with width tracking (strict=true to exclude wide chars at boundary)\n\tconst overlay = sliceWithWidth(overlayLine, 0, overlayWidth, true);\n\n\t// Pad segments to target widths\n\tconst beforePad = Math.max(0, startCol - base.beforeWidth);\n\tconst overlayPad = Math.max(0, overlayWidth - overlay.width);\n\tconst actualBeforeWidth = Math.max(startCol, base.beforeWidth);\n\tconst actualOverlayWidth = Math.max(overlayWidth, overlay.width);\n\tconst afterTarget = Math.max(0, totalWidth - actualBeforeWidth - actualOverlayWidth);\n\tconst afterPad = Math.max(0, afterTarget - base.afterWidth);\n\n\t// Compose result\n\tconst r = SEGMENT_RESET;\n\tconst result =\n\t\tbase.before +\n\t\t\" \".repeat(beforePad) +\n\t\tr +\n\t\toverlay.text +\n\t\t\" \".repeat(overlayPad) +\n\t\tr +\n\t\tbase.after +\n\t\t\" \".repeat(afterPad);\n\n\t// CRITICAL: Always verify and truncate to terminal width.\n\t// This is the final safeguard against width overflow which would crash the TUI.\n\t// Width tracking can drift from actual visible width due to:\n\t// - Complex ANSI/OSC sequences (hyperlinks, colors)\n\t// - Wide characters at segment boundaries\n\t// - Edge cases in segment extraction\n\tconst resultWidth = visibleWidth(result);\n\tif (resultWidth <= totalWidth) {\n\t\treturn result;\n\t}\n\t// Truncate with strict=true to ensure we don't exceed totalWidth\n\treturn sliceByColumn(result, 0, totalWidth, true);\n}\n\n// ─── Overlay compositing ────────────────────────────────────────────────────\n\nexport interface OverlayEntry {\n\tcomponent: { render(width: number): string[]; invalidate?(): void };\n\toptions?: OverlayOptions;\n\thidden: boolean;\n\tfocusOrder: number;\n}\n\n/** Check if an overlay entry is currently visible */\nexport function isOverlayVisible(\n\tentry: OverlayEntry,\n\ttermWidth: number,\n\ttermHeight: number,\n): boolean {\n\tif (entry.hidden) return false;\n\tif (entry.options?.visible) {\n\t\treturn entry.options.visible(termWidth, termHeight);\n\t}\n\treturn true;\n}\n\n/**\n * Composite all visible overlays into content lines.\n * Sorted by focusOrder (higher = on top).\n */\nexport function compositeOverlays(\n\tlines: string[],\n\toverlayStack: OverlayEntry[],\n\ttermWidth: number,\n\ttermHeight: number,\n\tmaxLinesRendered: number,\n): string[] {\n\tif (overlayStack.length === 0) return lines;\n\tconst result = [...lines];\n\n\t// Pre-render all visible overlays and calculate positions\n\tconst rendered: { overlayLines: string[]; row: number; col: number; w: number }[] = [];\n\tlet minLinesNeeded = result.length;\n\n\tconst visibleEntries = overlayStack.filter((e) => isOverlayVisible(e, termWidth, termHeight));\n\tvisibleEntries.sort((a, b) => a.focusOrder - b.focusOrder);\n\tfor (const entry of visibleEntries) {\n\t\tconst { component, options } = entry;\n\n\t\t// Get layout with height=0 first to determine width and maxHeight\n\t\t// (width and maxHeight don't depend on overlay height)\n\t\tconst { width, maxHeight } = resolveOverlayLayout(options, 0, termWidth, termHeight);\n\n\t\t// Render component at calculated width\n\t\tlet overlayLines = component.render(width);\n\n\t\t// Apply maxHeight if specified\n\t\tif (maxHeight !== undefined && overlayLines.length > maxHeight) {\n\t\t\toverlayLines = overlayLines.slice(0, maxHeight);\n\t\t}\n\n\t\t// Get final row/col with actual overlay height\n\t\tconst { row, col } = resolveOverlayLayout(options, overlayLines.length, termWidth, termHeight);\n\n\t\trendered.push({ overlayLines, row, col, w: width });\n\t\tminLinesNeeded = Math.max(minLinesNeeded, row + overlayLines.length);\n\t}\n\n\t// Ensure result covers the terminal working area to keep overlay positioning stable across resizes.\n\t// maxLinesRendered can exceed current content length after a shrink; pad to keep viewportStart consistent.\n\tconst workingHeight = Math.max(maxLinesRendered, minLinesNeeded);\n\n\t// Extend result with empty lines if content is too short for overlay placement or working area\n\twhile (result.length < workingHeight) {\n\t\tresult.push(\"\");\n\t}\n\n\tconst viewportStart = Math.max(0, workingHeight - termHeight);\n\n\t// Composite each overlay\n\tfor (const { overlayLines, row, col, w } of rendered) {\n\t\tfor (let i = 0; i < overlayLines.length; i++) {\n\t\t\tconst idx = viewportStart + row + i;\n\t\t\tif (idx >= 0 && idx < result.length) {\n\t\t\t\t// Defensive: truncate overlay line to declared width before compositing\n\t\t\t\t// (components should already respect width, but this ensures it)\n\t\t\t\tconst truncatedOverlayLine =\n\t\t\t\t\tvisibleWidth(overlayLines[i]) > w ? sliceByColumn(overlayLines[i], 0, w, true) : overlayLines[i];\n\t\t\t\tresult[idx] = compositeLineAt(result[idx], truncatedOverlayLine, col, w, termWidth);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n\n// ─── Cursor extraction ──────────────────────────────────────────────────────\n\n/**\n * Find and extract cursor position from rendered lines.\n * Searches for CURSOR_MARKER, calculates its position, and strips it from the output.\n * Only scans the bottom terminal height lines (visible viewport).\n * @param lines - Rendered lines to search (mutated to strip marker)\n * @param height - Terminal height (visible viewport size)\n * @returns Cursor position { row, col } or null if no marker found\n */\nexport function extractCursorPosition(lines: string[], height: number): { row: number; col: number } | null {\n\t// Only scan the bottom `height` lines (visible viewport)\n\tconst viewportTop = Math.max(0, lines.length - height);\n\tfor (let row = lines.length - 1; row >= viewportTop; row--) {\n\t\tconst line = lines[row];\n\t\tconst markerIndex = line.indexOf(CURSOR_MARKER);\n\t\tif (markerIndex !== -1) {\n\t\t\t// Calculate visual column (width of text before marker)\n\t\t\tconst beforeMarker = line.slice(0, markerIndex);\n\t\t\tconst col = visibleWidth(beforeMarker);\n\n\t\t\t// Strip marker from the line\n\t\t\tlines[row] = line.slice(0, markerIndex) + line.slice(markerIndex + CURSOR_MARKER.length);\n\n\t\t\treturn { row, col };\n\t\t}\n\t}\n\treturn null;\n}\n"]}
|
|
@@ -187,28 +187,6 @@ export declare class TUI extends Container {
|
|
|
187
187
|
requestRender(force?: boolean): void;
|
|
188
188
|
private handleInput;
|
|
189
189
|
private parseCellSizeResponse;
|
|
190
|
-
/**
|
|
191
|
-
* Resolve overlay layout from options.
|
|
192
|
-
* Returns { width, row, col, maxHeight } for rendering.
|
|
193
|
-
*/
|
|
194
|
-
private resolveOverlayLayout;
|
|
195
|
-
private resolveAnchorRow;
|
|
196
|
-
private resolveAnchorCol;
|
|
197
|
-
/** Composite all overlays into content lines (sorted by focusOrder, higher = on top). */
|
|
198
|
-
private compositeOverlays;
|
|
199
|
-
private static readonly SEGMENT_RESET;
|
|
200
|
-
private applyLineResets;
|
|
201
|
-
/** Splice overlay content into a base line at a specific column. Single-pass optimized. */
|
|
202
|
-
private compositeLineAt;
|
|
203
|
-
/**
|
|
204
|
-
* Find and extract cursor position from rendered lines.
|
|
205
|
-
* Searches for CURSOR_MARKER, calculates its position, and strips it from the output.
|
|
206
|
-
* Only scans the bottom terminal height lines (visible viewport).
|
|
207
|
-
* @param lines - Rendered lines to search
|
|
208
|
-
* @param height - Terminal height (visible viewport size)
|
|
209
|
-
* @returns Cursor position { row, col } or null if no marker found
|
|
210
|
-
*/
|
|
211
|
-
private extractCursorPosition;
|
|
212
190
|
private doRender;
|
|
213
191
|
/**
|
|
214
192
|
* Position the hardware cursor for IME candidate window.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../src/tui.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../src/tui.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAmB,YAAY,EAAE,MAAM,YAAY,CAAC;AAE3D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