shortcutxl 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/agent-docs/README.md +397 -0
- package/agent-docs/docs/compaction.md +390 -0
- package/agent-docs/docs/custom-provider.md +580 -0
- package/agent-docs/docs/development.md +69 -0
- package/agent-docs/docs/extensions.md +1971 -0
- package/agent-docs/docs/json.md +79 -0
- package/agent-docs/docs/keybindings.md +174 -0
- package/agent-docs/docs/models.md +293 -0
- package/agent-docs/docs/packages.md +209 -0
- package/agent-docs/docs/prompt-templates.md +67 -0
- package/agent-docs/docs/providers.md +186 -0
- package/agent-docs/docs/rpc.md +1317 -0
- package/agent-docs/docs/sdk.md +962 -0
- package/agent-docs/docs/session.md +412 -0
- package/agent-docs/docs/settings.md +223 -0
- package/agent-docs/docs/shell-aliases.md +13 -0
- package/agent-docs/docs/skills.md +231 -0
- package/agent-docs/docs/terminal-setup.md +70 -0
- package/agent-docs/docs/termux.md +127 -0
- package/agent-docs/docs/themes.md +295 -0
- package/agent-docs/docs/tree.md +219 -0
- package/agent-docs/docs/tui.md +887 -0
- package/agent-docs/docs/windows.md +17 -0
- package/agent-docs/examples/README.md +25 -0
- package/agent-docs/examples/extensions/README.md +205 -0
- package/agent-docs/examples/extensions/antigravity-image-gen.ts +447 -0
- package/agent-docs/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/agent-docs/examples/extensions/bash-spawn-hook.ts +30 -0
- package/agent-docs/examples/extensions/bookmark.ts +50 -0
- package/agent-docs/examples/extensions/built-in-tool-renderer.ts +256 -0
- package/agent-docs/examples/extensions/claude-rules.ts +86 -0
- package/agent-docs/examples/extensions/commands.ts +75 -0
- package/agent-docs/examples/extensions/confirm-destructive.ts +59 -0
- package/agent-docs/examples/extensions/custom-compaction.ts +126 -0
- package/agent-docs/examples/extensions/custom-footer.ts +63 -0
- package/agent-docs/examples/extensions/custom-header.ts +73 -0
- package/agent-docs/examples/extensions/custom-provider-anthropic/index.ts +660 -0
- package/agent-docs/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/agent-docs/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/agent-docs/examples/extensions/custom-provider-gitlab-duo/index.ts +362 -0
- package/agent-docs/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/agent-docs/examples/extensions/custom-provider-gitlab-duo/test.ts +88 -0
- package/agent-docs/examples/extensions/custom-provider-qwen-cli/index.ts +349 -0
- package/agent-docs/examples/extensions/custom-provider-qwen-cli/package.json +16 -0
- package/agent-docs/examples/extensions/dirty-repo-guard.ts +56 -0
- package/agent-docs/examples/extensions/doom-overlay/README.md +46 -0
- package/agent-docs/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/agent-docs/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/agent-docs/examples/extensions/doom-overlay/doom-component.ts +133 -0
- package/agent-docs/examples/extensions/doom-overlay/doom-engine.ts +186 -0
- package/agent-docs/examples/extensions/doom-overlay/doom-keys.ts +108 -0
- package/agent-docs/examples/extensions/doom-overlay/index.ts +74 -0
- package/agent-docs/examples/extensions/doom-overlay/wad-finder.ts +51 -0
- package/agent-docs/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/agent-docs/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/agent-docs/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/agent-docs/examples/extensions/dynamic-resources/index.ts +15 -0
- package/agent-docs/examples/extensions/dynamic-tools.ts +77 -0
- package/agent-docs/examples/extensions/event-bus.ts +43 -0
- package/agent-docs/examples/extensions/file-trigger.ts +41 -0
- package/agent-docs/examples/extensions/git-checkpoint.ts +53 -0
- package/agent-docs/examples/extensions/handoff.ts +155 -0
- package/agent-docs/examples/extensions/hello.ts +25 -0
- package/agent-docs/examples/extensions/inline-bash.ts +94 -0
- package/agent-docs/examples/extensions/input-transform.ts +43 -0
- package/agent-docs/examples/extensions/interactive-shell.ts +209 -0
- package/agent-docs/examples/extensions/mac-system-theme.ts +47 -0
- package/agent-docs/examples/extensions/message-renderer.ts +59 -0
- package/agent-docs/examples/extensions/minimal-mode.ts +430 -0
- package/agent-docs/examples/extensions/modal-editor.ts +90 -0
- package/agent-docs/examples/extensions/model-status.ts +31 -0
- package/agent-docs/examples/extensions/notify.ts +55 -0
- package/agent-docs/examples/extensions/overlay-qa-tests.ts +936 -0
- package/agent-docs/examples/extensions/overlay-test.ts +159 -0
- package/agent-docs/examples/extensions/permission-gate.ts +37 -0
- package/agent-docs/examples/extensions/pirate.ts +47 -0
- package/agent-docs/examples/extensions/plan-mode/README.md +65 -0
- package/agent-docs/examples/extensions/plan-mode/index.ts +363 -0
- package/agent-docs/examples/extensions/plan-mode/utils.ts +173 -0
- package/agent-docs/examples/extensions/preset.ts +418 -0
- package/agent-docs/examples/extensions/protected-paths.ts +30 -0
- package/agent-docs/examples/extensions/qna.ts +122 -0
- package/agent-docs/examples/extensions/question.ts +278 -0
- package/agent-docs/examples/extensions/questionnaire.ts +440 -0
- package/agent-docs/examples/extensions/rainbow-editor.ts +90 -0
- package/agent-docs/examples/extensions/reload-runtime.ts +37 -0
- package/agent-docs/examples/extensions/rpc-demo.ts +124 -0
- package/agent-docs/examples/extensions/sandbox/index.ts +324 -0
- package/agent-docs/examples/extensions/sandbox/package-lock.json +92 -0
- package/agent-docs/examples/extensions/sandbox/package.json +19 -0
- package/agent-docs/examples/extensions/send-user-message.ts +97 -0
- package/agent-docs/examples/extensions/session-name.ts +27 -0
- package/agent-docs/examples/extensions/shutdown-command.ts +69 -0
- package/agent-docs/examples/extensions/snake.ts +343 -0
- package/agent-docs/examples/extensions/space-invaders.ts +566 -0
- package/agent-docs/examples/extensions/ssh.ts +233 -0
- package/agent-docs/examples/extensions/status-line.ts +40 -0
- package/agent-docs/examples/extensions/subagent/README.md +172 -0
- package/agent-docs/examples/extensions/subagent/agents/planner.md +37 -0
- package/agent-docs/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/agent-docs/examples/extensions/subagent/agents/scout.md +50 -0
- package/agent-docs/examples/extensions/subagent/agents/worker.md +24 -0
- package/agent-docs/examples/extensions/subagent/agents.ts +130 -0
- package/agent-docs/examples/extensions/subagent/index.ts +1068 -0
- package/agent-docs/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/agent-docs/examples/extensions/subagent/prompts/implement.md +10 -0
- package/agent-docs/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/agent-docs/examples/extensions/summarize.ts +206 -0
- package/agent-docs/examples/extensions/system-prompt-header.ts +17 -0
- package/agent-docs/examples/extensions/timed-confirm.ts +72 -0
- package/agent-docs/examples/extensions/titlebar-spinner.ts +58 -0
- package/agent-docs/examples/extensions/todo.ts +314 -0
- package/agent-docs/examples/extensions/tool-override.ts +146 -0
- package/agent-docs/examples/extensions/tools.ts +145 -0
- package/agent-docs/examples/extensions/trigger-compact.ts +40 -0
- package/agent-docs/examples/extensions/truncated-tool.ts +194 -0
- package/agent-docs/examples/extensions/widget-placement.ts +17 -0
- package/agent-docs/examples/extensions/with-deps/index.ts +37 -0
- package/agent-docs/examples/extensions/with-deps/package-lock.json +31 -0
- package/agent-docs/examples/extensions/with-deps/package.json +22 -0
- package/agent-docs/examples/rpc-extension-ui.ts +654 -0
- package/agent-docs/examples/sdk/01-minimal.ts +22 -0
- package/agent-docs/examples/sdk/02-custom-model.ts +48 -0
- package/agent-docs/examples/sdk/03-custom-prompt.ts +55 -0
- package/agent-docs/examples/sdk/04-skills.ts +53 -0
- package/agent-docs/examples/sdk/05-tools.ts +56 -0
- package/agent-docs/examples/sdk/06-extensions.ts +88 -0
- package/agent-docs/examples/sdk/07-context-files.ts +40 -0
- package/agent-docs/examples/sdk/08-prompt-templates.ts +47 -0
- package/agent-docs/examples/sdk/09-api-keys-and-oauth.ts +48 -0
- package/agent-docs/examples/sdk/10-settings.ts +54 -0
- package/agent-docs/examples/sdk/11-sessions.ts +48 -0
- package/agent-docs/examples/sdk/12-full-control.ts +82 -0
- package/agent-docs/examples/sdk/README.md +144 -0
- package/agent-docs/xll-skill.md +61 -0
- package/agent-docs/xll-spec.md +110 -0
- package/dist/cli/args.js +290 -0
- package/dist/cli/config-selector.js +31 -0
- package/dist/cli/file-processor.js +79 -0
- package/dist/cli/list-models.js +92 -0
- package/dist/cli/package-commands.js +210 -0
- package/dist/cli/report-settings-errors.js +11 -0
- package/dist/cli/session-picker.js +34 -0
- package/dist/cli.js +19 -0
- package/dist/config.js +288 -0
- package/dist/core/abort.js +15 -0
- package/dist/core/agent-loop.js +352 -0
- package/dist/core/agent-session.js +2019 -0
- package/dist/core/agent.js +410 -0
- package/dist/core/auth-storage.js +456 -0
- package/dist/core/bash-executor.js +222 -0
- package/dist/core/compaction/branch-summarization.js +242 -0
- package/dist/core/compaction/compaction.js +610 -0
- package/dist/core/compaction/index.js +7 -0
- package/dist/core/compaction/utils.js +139 -0
- package/dist/core/defaults.js +6 -0
- package/dist/core/diagnostics.js +2 -0
- package/dist/core/event-bus.js +25 -0
- package/dist/core/exec.js +71 -0
- package/dist/core/export-html/ansi-to-html.js +256 -0
- package/dist/core/export-html/index.js +238 -0
- package/dist/core/export-html/session-view-model.js +342 -0
- package/dist/core/export-html/template.css +1110 -0
- package/dist/core/export-html/template.html +76 -0
- package/dist/core/export-html/template.js +1990 -0
- package/dist/core/export-html/tool-renderer.js +63 -0
- package/dist/core/export-html/vendor/highlight.min.js +7725 -0
- package/dist/core/export-html/vendor/marked.min.js +1803 -0
- package/dist/core/extensions/index.js +9 -0
- package/dist/core/extensions/loader.js +422 -0
- package/dist/core/extensions/runner.js +651 -0
- package/dist/core/extensions/types.js +35 -0
- package/dist/core/extensions/wrapper.js +102 -0
- package/dist/core/footer-data-provider.js +162 -0
- package/dist/core/index.js +9 -0
- package/dist/core/keybindings.js +153 -0
- package/dist/core/messages.js +133 -0
- package/dist/core/model-registry.js +539 -0
- package/dist/core/model-resolver.js +370 -0
- package/dist/core/package-manager.js +1485 -0
- package/dist/core/prompt-templates.js +253 -0
- package/dist/core/resolve-config-value.js +59 -0
- package/dist/core/resource-loader.js +700 -0
- package/dist/core/sdk.js +197 -0
- package/dist/core/session-bash.js +99 -0
- package/dist/core/session-compaction.js +165 -0
- package/dist/core/session-manager.js +1153 -0
- package/dist/core/session-models.js +99 -0
- package/dist/core/session-retry.js +155 -0
- package/dist/core/settings-manager.js +572 -0
- package/dist/core/skills.js +382 -0
- package/dist/core/slash-commands.js +31 -0
- package/dist/core/system-prompt.js +161 -0
- package/dist/core/theme.js +770 -0
- package/dist/core/timings.js +26 -0
- package/dist/core/tools/bash.js +258 -0
- package/dist/core/tools/edit-diff.js +245 -0
- package/dist/core/tools/edit.js +148 -0
- package/dist/core/tools/find.js +208 -0
- package/dist/core/tools/grep.js +246 -0
- package/dist/core/tools/index.js +67 -0
- package/dist/core/tools/ls.js +123 -0
- package/dist/core/tools/path-utils.js +81 -0
- package/dist/core/tools/read.js +160 -0
- package/dist/core/tools/truncate.js +70 -0
- package/dist/core/tools/write.js +82 -0
- package/dist/custom/agents/action.js +13 -0
- package/dist/custom/agents/document-reader.js +70 -0
- package/dist/custom/agents/general.js +26 -0
- package/dist/custom/agents/index.js +49 -0
- package/dist/custom/agents/installation.js +13 -0
- package/dist/custom/agents/types.js +7 -0
- package/dist/custom/auth/refresh-timer.js +33 -0
- package/dist/custom/auth/shortcut-oauth.js +145 -0
- package/dist/custom/constants.js +21 -0
- package/dist/custom/context/workbook-summary.js +73 -0
- package/dist/custom/credits/shortcut-credits.js +29 -0
- package/dist/custom/cron/cron-daemon-entry.js +18 -0
- package/dist/custom/cron/daemon-ipc.js +131 -0
- package/dist/custom/cron/daemon.js +224 -0
- package/dist/custom/cron/jobs.js +226 -0
- package/dist/custom/cron/run-log.js +51 -0
- package/dist/custom/cron/schedule.js +72 -0
- package/dist/custom/cron/status-line.js +98 -0
- package/dist/custom/cron/store.js +87 -0
- package/dist/custom/cron/types.js +8 -0
- package/dist/custom/dev/index.js +59 -0
- package/dist/custom/dev/trace-export.js +58 -0
- package/dist/custom/ensure-excel.js +63 -0
- package/dist/custom/excel-config.js +36 -0
- package/dist/custom/preflight.js +422 -0
- package/dist/custom/prompts/action.js +100 -0
- package/dist/custom/prompts/api.js +66 -0
- package/dist/custom/prompts/installation.js +124 -0
- package/dist/custom/prompts/shared.js +138 -0
- package/dist/custom/providers/llm-usage.js +42 -0
- package/dist/custom/providers/message-converter.js +74 -0
- package/dist/custom/providers/provider-ids.js +9 -0
- package/dist/custom/providers/register-openai-codex-provider.js +27 -0
- package/dist/custom/providers/register-shortcut-provider.js +52 -0
- package/dist/custom/providers/shortcut-invoke.js +117 -0
- package/dist/custom/providers/shortcut-stream.js +252 -0
- package/dist/custom/providers/sse-protocol.js +38 -0
- package/dist/custom/sync-xll.js +130 -0
- package/dist/custom/tools/cron.js +413 -0
- package/dist/custom/tools/excel-exec.js +167 -0
- package/dist/custom/tools/excel-range.js +50 -0
- package/dist/custom/tools/llm-analysis.js +265 -0
- package/dist/custom/tools/render-helpers.js +38 -0
- package/dist/custom/tools/switch-mode.js +94 -0
- package/dist/custom/tools/task/agents.js +6 -0
- package/dist/custom/tools/task/index.js +8 -0
- package/dist/custom/tools/task/render.js +348 -0
- package/dist/custom/tools/task/subprocess.js +320 -0
- package/dist/custom/tools/task/task.js +205 -0
- package/dist/custom/tools/todo-list.js +195 -0
- package/dist/custom/tracing/session-upload.js +93 -0
- package/dist/index.js +45 -0
- package/dist/main.js +613 -0
- package/dist/migrations.js +265 -0
- package/dist/modes/index.js +8 -0
- package/dist/modes/interactive/components/armin.js +337 -0
- package/dist/modes/interactive/components/assistant-message.js +94 -0
- package/dist/modes/interactive/components/bash-execution.js +171 -0
- package/dist/modes/interactive/components/bordered-loader.js +51 -0
- package/dist/modes/interactive/components/branch-summary-message.js +45 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +46 -0
- package/dist/modes/interactive/components/config-selector.js +488 -0
- package/dist/modes/interactive/components/countdown-timer.js +33 -0
- package/dist/modes/interactive/components/custom-editor.js +93 -0
- package/dist/modes/interactive/components/custom-message.js +81 -0
- package/dist/modes/interactive/components/daxnuts.js +140 -0
- package/dist/modes/interactive/components/diff.js +133 -0
- package/dist/modes/interactive/components/dynamic-border.js +21 -0
- package/dist/modes/interactive/components/extension-editor.js +105 -0
- package/dist/modes/interactive/components/extension-input.js +61 -0
- package/dist/modes/interactive/components/extension-selector.js +78 -0
- package/dist/modes/interactive/components/footer.js +309 -0
- package/dist/modes/interactive/components/index.js +33 -0
- package/dist/modes/interactive/components/keybinding-hints.js +61 -0
- package/dist/modes/interactive/components/layout.js +64 -0
- package/dist/modes/interactive/components/login-dialog.js +148 -0
- package/dist/modes/interactive/components/model-selector.js +237 -0
- package/dist/modes/interactive/components/oauth-selector.js +111 -0
- package/dist/modes/interactive/components/session-selector-search.js +157 -0
- package/dist/modes/interactive/components/session-selector.js +860 -0
- package/dist/modes/interactive/components/settings-selector.js +123 -0
- package/dist/modes/interactive/components/show-images-selector.js +35 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +48 -0
- package/dist/modes/interactive/components/theme-selector.js +47 -0
- package/dist/modes/interactive/components/thinking-selector.js +47 -0
- package/dist/modes/interactive/components/tool-execution.js +789 -0
- package/dist/modes/interactive/components/tool-group.js +106 -0
- package/dist/modes/interactive/components/tree-selector.js +962 -0
- package/dist/modes/interactive/components/user-message-selector.js +115 -0
- package/dist/modes/interactive/components/user-message.js +48 -0
- package/dist/modes/interactive/components/visual-truncate.js +33 -0
- package/dist/modes/interactive/file-attachments.js +135 -0
- package/dist/modes/interactive/interactive-mode.js +3775 -0
- package/dist/modes/interactive/theme/dark.json +85 -0
- package/dist/modes/interactive/theme/light.json +85 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.js +177 -0
- package/dist/modes/print-mode.js +101 -0
- package/dist/modes/rpc/rpc-client.js +387 -0
- package/dist/modes/rpc/rpc-mode.js +509 -0
- package/dist/modes/rpc/rpc-types.js +8 -0
- package/dist/subagent-entry.js +145 -0
- package/dist/tool-names.js +34 -0
- package/dist/tui/autocomplete.js +596 -0
- package/dist/tui/components/box.js +104 -0
- package/dist/tui/components/cancellable-loader.js +35 -0
- package/dist/tui/components/editor.js +1679 -0
- package/dist/tui/components/image.js +69 -0
- package/dist/tui/components/input.js +433 -0
- package/dist/tui/components/loader.js +49 -0
- package/dist/tui/components/markdown.js +629 -0
- package/dist/tui/components/select-list.js +152 -0
- package/dist/tui/components/settings-list.js +185 -0
- package/dist/tui/components/spacer.js +23 -0
- package/dist/tui/components/text.js +89 -0
- package/dist/tui/components/truncated-text.js +51 -0
- package/dist/tui/editor-component.js +2 -0
- package/dist/tui/fuzzy.js +107 -0
- package/dist/tui/get-east-asian-width/index.js +32 -0
- package/dist/tui/get-east-asian-width/lookup.js +404 -0
- package/dist/tui/index.js +32 -0
- package/dist/tui/keybindings.js +114 -0
- package/dist/tui/keys.js +959 -0
- package/dist/tui/kill-ring.js +44 -0
- package/dist/tui/stdin-buffer.js +317 -0
- package/dist/tui/terminal-image.js +288 -0
- package/dist/tui/terminal.js +249 -0
- package/dist/tui/tui/autocomplete.js +596 -0
- package/dist/tui/tui/components/box.js +106 -0
- package/dist/tui/tui/components/cancellable-loader.js +35 -0
- package/dist/tui/tui/components/editor.js +1679 -0
- package/dist/tui/tui/components/image.js +69 -0
- package/dist/tui/tui/components/input.js +433 -0
- package/dist/tui/tui/components/loader.js +49 -0
- package/dist/tui/tui/components/markdown.js +629 -0
- package/dist/tui/tui/components/select-list.js +152 -0
- package/dist/tui/tui/components/settings-list.js +185 -0
- package/dist/tui/tui/components/spacer.js +23 -0
- package/dist/tui/tui/components/text.js +91 -0
- package/dist/tui/tui/components/truncated-text.js +51 -0
- package/dist/tui/tui/editor-component.js +2 -0
- package/dist/tui/tui/fuzzy.js +107 -0
- package/dist/tui/tui/get-east-asian-width/index.js +32 -0
- package/dist/tui/tui/get-east-asian-width/lookup.js +404 -0
- package/dist/tui/tui/index.js +32 -0
- package/dist/tui/tui/keybindings.js +114 -0
- package/dist/tui/tui/keys.js +959 -0
- package/dist/tui/tui/kill-ring.js +44 -0
- package/dist/tui/tui/stdin-buffer.js +317 -0
- package/dist/tui/tui/terminal-image.js +288 -0
- package/dist/tui/tui/terminal.js +249 -0
- package/dist/tui/tui/tui.js +955 -0
- package/dist/tui/tui/undo-stack.js +25 -0
- package/dist/tui/tui/utils.js +800 -0
- package/dist/tui/tui.js +955 -0
- package/dist/tui/undo-stack.js +25 -0
- package/dist/tui/utils.js +800 -0
- package/dist/utils/changelog.js +87 -0
- package/dist/utils/clipboard-image.js +164 -0
- package/dist/utils/clipboard-native.js +14 -0
- package/dist/utils/clipboard.js +67 -0
- package/dist/utils/frontmatter.js +26 -0
- package/dist/utils/git.js +166 -0
- package/dist/utils/image-convert.js +35 -0
- package/dist/utils/image-resize.js +183 -0
- package/dist/utils/mime.js +26 -0
- package/dist/utils/photon.js +121 -0
- package/dist/utils/shell.js +217 -0
- package/dist/utils/sleep.js +17 -0
- package/dist/utils/tools-manager.js +259 -0
- package/package.json +78 -0
- package/skills/excel-com-api/SKILL.md +74 -0
- package/skills/excel-com-api/excel-type-library.py +27767 -0
- package/skills/excel-com-api/office-type-library.py +10867 -0
- package/skills/integrations/SKILL.md +138 -0
- package/skills/integrations/alphasense.md +457 -0
- package/skills/integrations/bloomberg.md +803 -0
- package/skills/integrations/calcbench.md +315 -0
- package/skills/integrations/capiq.md +848 -0
- package/skills/integrations/dynamics-365-finance.md +354 -0
- package/skills/integrations/earnings_transcripts.md +387 -0
- package/skills/integrations/factset.md +758 -0
- package/skills/integrations/ice-fixed-income.md +344 -0
- package/skills/integrations/moodys-analytics.md +313 -0
- package/skills/integrations/morningstar.md +433 -0
- package/skills/integrations/nasdaq-data-link.md +249 -0
- package/skills/integrations/pitchbook.md +413 -0
- package/skills/integrations/preqin.md +422 -0
- package/skills/integrations/quickbooks.md +289 -0
- package/skills/integrations/quickfs.md +314 -0
- package/skills/integrations/refinitiv.md +473 -0
- package/skills/integrations/sage-intacct.md +401 -0
- package/skills/integrations/visible-alpha.md +320 -0
- package/skills/integrations/xero.md +393 -0
- package/skills/integrations/ycharts.md +306 -0
- package/skills/pdf-creation/SKILL.md +93 -0
- package/skills/pdf-extraction/SKILL.md +32 -0
- package/skills/powerpoint-creation/SKILL.md +110 -0
- package/skills/sec-edgar/SKILL.md +127 -0
- package/skills/sec-edgar/sec_to_pdf.py +109 -0
- package/xll/ShortcutXL.xll +0 -0
- package/xll/modules/debug_render.py +272 -0
- package/xll/modules/gameboy.py +241 -0
- package/xll/modules/pong.py +188 -0
- package/xll/modules/shortcut_xl/__init__.py +18 -0
- package/xll/modules/shortcut_xl/_categorize.py +200 -0
- package/xll/modules/shortcut_xl/_com.py +108 -0
- package/xll/modules/shortcut_xl/_format.py +252 -0
- package/xll/modules/shortcut_xl/_log.py +12 -0
- package/xll/modules/shortcut_xl/_managed.py +116 -0
- package/xll/modules/shortcut_xl/_registry.py +44 -0
- package/xll/modules/shortcut_xl/_threading.py +161 -0
- package/xll/modules/shortcut_xl/_tracking.py +283 -0
- package/xll/modules/stocks.py +100 -0
- package/xll/python3.dll +0 -0
- package/xll/python312.dll +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { getCapabilities, getImageDimensions, imageFallback, renderImage, } from "../terminal-image.js";
|
|
2
|
+
export class Image {
|
|
3
|
+
base64Data;
|
|
4
|
+
mimeType;
|
|
5
|
+
dimensions;
|
|
6
|
+
theme;
|
|
7
|
+
options;
|
|
8
|
+
imageId;
|
|
9
|
+
cachedLines;
|
|
10
|
+
cachedWidth;
|
|
11
|
+
constructor(base64Data, mimeType, theme, options = {}, dimensions) {
|
|
12
|
+
this.base64Data = base64Data;
|
|
13
|
+
this.mimeType = mimeType;
|
|
14
|
+
this.theme = theme;
|
|
15
|
+
this.options = options;
|
|
16
|
+
this.dimensions = dimensions || getImageDimensions(base64Data, mimeType) || { widthPx: 800, heightPx: 600 };
|
|
17
|
+
this.imageId = options.imageId;
|
|
18
|
+
}
|
|
19
|
+
/** Get the Kitty image ID used by this image (if any). */
|
|
20
|
+
getImageId() {
|
|
21
|
+
return this.imageId;
|
|
22
|
+
}
|
|
23
|
+
invalidate() {
|
|
24
|
+
this.cachedLines = undefined;
|
|
25
|
+
this.cachedWidth = undefined;
|
|
26
|
+
}
|
|
27
|
+
render(width) {
|
|
28
|
+
if (this.cachedLines && this.cachedWidth === width) {
|
|
29
|
+
return this.cachedLines;
|
|
30
|
+
}
|
|
31
|
+
const maxWidth = Math.min(width - 2, this.options.maxWidthCells ?? 60);
|
|
32
|
+
const caps = getCapabilities();
|
|
33
|
+
let lines;
|
|
34
|
+
if (caps.images) {
|
|
35
|
+
const result = renderImage(this.base64Data, this.dimensions, {
|
|
36
|
+
maxWidthCells: maxWidth,
|
|
37
|
+
imageId: this.imageId,
|
|
38
|
+
});
|
|
39
|
+
if (result) {
|
|
40
|
+
// Store the image ID for later cleanup
|
|
41
|
+
if (result.imageId) {
|
|
42
|
+
this.imageId = result.imageId;
|
|
43
|
+
}
|
|
44
|
+
// Return `rows` lines so TUI accounts for image height
|
|
45
|
+
// First (rows-1) lines are empty (TUI clears them)
|
|
46
|
+
// Last line: move cursor back up, then output image sequence
|
|
47
|
+
lines = [];
|
|
48
|
+
for (let i = 0; i < result.rows - 1; i++) {
|
|
49
|
+
lines.push("");
|
|
50
|
+
}
|
|
51
|
+
// Move cursor up to first row, then output image
|
|
52
|
+
const moveUp = result.rows > 1 ? `\x1b[${result.rows - 1}A` : "";
|
|
53
|
+
lines.push(moveUp + result.sequence);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const fallback = imageFallback(this.mimeType, this.dimensions, this.options.filename);
|
|
57
|
+
lines = [this.theme.fallbackColor(fallback)];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const fallback = imageFallback(this.mimeType, this.dimensions, this.options.filename);
|
|
62
|
+
lines = [this.theme.fallbackColor(fallback)];
|
|
63
|
+
}
|
|
64
|
+
this.cachedLines = lines;
|
|
65
|
+
this.cachedWidth = width;
|
|
66
|
+
return lines;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import { getEditorKeybindings } from "../keybindings.js";
|
|
2
|
+
import { KillRing } from "../kill-ring.js";
|
|
3
|
+
import { CURSOR_MARKER } from "../tui.js";
|
|
4
|
+
import { UndoStack } from "../undo-stack.js";
|
|
5
|
+
import { getSegmenter, isPunctuationChar, isWhitespaceChar, visibleWidth } from "../utils.js";
|
|
6
|
+
const segmenter = getSegmenter();
|
|
7
|
+
/**
|
|
8
|
+
* Input component - single-line text input with horizontal scrolling
|
|
9
|
+
*/
|
|
10
|
+
export class Input {
|
|
11
|
+
value = "";
|
|
12
|
+
cursor = 0; // Cursor position in the value
|
|
13
|
+
onSubmit;
|
|
14
|
+
onEscape;
|
|
15
|
+
/** Focusable interface - set by TUI when focus changes */
|
|
16
|
+
focused = false;
|
|
17
|
+
// Bracketed paste mode buffering
|
|
18
|
+
pasteBuffer = "";
|
|
19
|
+
isInPaste = false;
|
|
20
|
+
// Kill ring for Emacs-style kill/yank operations
|
|
21
|
+
killRing = new KillRing();
|
|
22
|
+
lastAction = null;
|
|
23
|
+
// Undo support
|
|
24
|
+
undoStack = new UndoStack();
|
|
25
|
+
getValue() {
|
|
26
|
+
return this.value;
|
|
27
|
+
}
|
|
28
|
+
setValue(value) {
|
|
29
|
+
this.value = value;
|
|
30
|
+
this.cursor = Math.min(this.cursor, value.length);
|
|
31
|
+
}
|
|
32
|
+
handleInput(data) {
|
|
33
|
+
// Handle bracketed paste mode
|
|
34
|
+
// Start of paste: \x1b[200~
|
|
35
|
+
// End of paste: \x1b[201~
|
|
36
|
+
// Check if we're starting a bracketed paste
|
|
37
|
+
if (data.includes("\x1b[200~")) {
|
|
38
|
+
this.isInPaste = true;
|
|
39
|
+
this.pasteBuffer = "";
|
|
40
|
+
data = data.replace("\x1b[200~", "");
|
|
41
|
+
}
|
|
42
|
+
// If we're in a paste, buffer the data
|
|
43
|
+
if (this.isInPaste) {
|
|
44
|
+
// Check if this chunk contains the end marker
|
|
45
|
+
this.pasteBuffer += data;
|
|
46
|
+
const endIndex = this.pasteBuffer.indexOf("\x1b[201~");
|
|
47
|
+
if (endIndex !== -1) {
|
|
48
|
+
// Extract the pasted content
|
|
49
|
+
const pasteContent = this.pasteBuffer.substring(0, endIndex);
|
|
50
|
+
// Process the complete paste
|
|
51
|
+
this.handlePaste(pasteContent);
|
|
52
|
+
// Reset paste state
|
|
53
|
+
this.isInPaste = false;
|
|
54
|
+
// Handle any remaining input after the paste marker
|
|
55
|
+
const remaining = this.pasteBuffer.substring(endIndex + 6); // 6 = length of \x1b[201~
|
|
56
|
+
this.pasteBuffer = "";
|
|
57
|
+
if (remaining) {
|
|
58
|
+
this.handleInput(remaining);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const kb = getEditorKeybindings();
|
|
64
|
+
// Escape/Cancel
|
|
65
|
+
if (kb.matches(data, "selectCancel")) {
|
|
66
|
+
if (this.onEscape)
|
|
67
|
+
this.onEscape();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
// Undo
|
|
71
|
+
if (kb.matches(data, "undo")) {
|
|
72
|
+
this.undo();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
// Submit
|
|
76
|
+
if (kb.matches(data, "submit") || data === "\n") {
|
|
77
|
+
if (this.onSubmit)
|
|
78
|
+
this.onSubmit(this.value);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
// Deletion
|
|
82
|
+
if (kb.matches(data, "deleteCharBackward")) {
|
|
83
|
+
this.handleBackspace();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (kb.matches(data, "deleteCharForward")) {
|
|
87
|
+
this.handleForwardDelete();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (kb.matches(data, "deleteWordBackward")) {
|
|
91
|
+
this.deleteWordBackwards();
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (kb.matches(data, "deleteWordForward")) {
|
|
95
|
+
this.deleteWordForward();
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (kb.matches(data, "deleteToLineStart")) {
|
|
99
|
+
this.deleteToLineStart();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (kb.matches(data, "deleteToLineEnd")) {
|
|
103
|
+
this.deleteToLineEnd();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
// Kill ring actions
|
|
107
|
+
if (kb.matches(data, "yank")) {
|
|
108
|
+
this.yank();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (kb.matches(data, "yankPop")) {
|
|
112
|
+
this.yankPop();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
// Cursor movement
|
|
116
|
+
if (kb.matches(data, "cursorLeft")) {
|
|
117
|
+
this.lastAction = null;
|
|
118
|
+
if (this.cursor > 0) {
|
|
119
|
+
const beforeCursor = this.value.slice(0, this.cursor);
|
|
120
|
+
const graphemes = [...segmenter.segment(beforeCursor)];
|
|
121
|
+
const lastGrapheme = graphemes[graphemes.length - 1];
|
|
122
|
+
this.cursor -= lastGrapheme ? lastGrapheme.segment.length : 1;
|
|
123
|
+
}
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (kb.matches(data, "cursorRight")) {
|
|
127
|
+
this.lastAction = null;
|
|
128
|
+
if (this.cursor < this.value.length) {
|
|
129
|
+
const afterCursor = this.value.slice(this.cursor);
|
|
130
|
+
const graphemes = [...segmenter.segment(afterCursor)];
|
|
131
|
+
const firstGrapheme = graphemes[0];
|
|
132
|
+
this.cursor += firstGrapheme ? firstGrapheme.segment.length : 1;
|
|
133
|
+
}
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if (kb.matches(data, "cursorLineStart")) {
|
|
137
|
+
this.lastAction = null;
|
|
138
|
+
this.cursor = 0;
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (kb.matches(data, "cursorLineEnd")) {
|
|
142
|
+
this.lastAction = null;
|
|
143
|
+
this.cursor = this.value.length;
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (kb.matches(data, "cursorWordLeft")) {
|
|
147
|
+
this.moveWordBackwards();
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (kb.matches(data, "cursorWordRight")) {
|
|
151
|
+
this.moveWordForwards();
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
// Regular character input - accept printable characters including Unicode,
|
|
155
|
+
// but reject control characters (C0: 0x00-0x1F, DEL: 0x7F, C1: 0x80-0x9F)
|
|
156
|
+
const hasControlChars = [...data].some((ch) => {
|
|
157
|
+
const code = ch.charCodeAt(0);
|
|
158
|
+
return code < 32 || code === 0x7f || (code >= 0x80 && code <= 0x9f);
|
|
159
|
+
});
|
|
160
|
+
if (!hasControlChars) {
|
|
161
|
+
this.insertCharacter(data);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
insertCharacter(char) {
|
|
165
|
+
// Undo coalescing: consecutive word chars coalesce into one undo unit
|
|
166
|
+
if (isWhitespaceChar(char) || this.lastAction !== "type-word") {
|
|
167
|
+
this.pushUndo();
|
|
168
|
+
}
|
|
169
|
+
this.lastAction = "type-word";
|
|
170
|
+
this.value = this.value.slice(0, this.cursor) + char + this.value.slice(this.cursor);
|
|
171
|
+
this.cursor += char.length;
|
|
172
|
+
}
|
|
173
|
+
handleBackspace() {
|
|
174
|
+
this.lastAction = null;
|
|
175
|
+
if (this.cursor > 0) {
|
|
176
|
+
this.pushUndo();
|
|
177
|
+
const beforeCursor = this.value.slice(0, this.cursor);
|
|
178
|
+
const graphemes = [...segmenter.segment(beforeCursor)];
|
|
179
|
+
const lastGrapheme = graphemes[graphemes.length - 1];
|
|
180
|
+
const graphemeLength = lastGrapheme ? lastGrapheme.segment.length : 1;
|
|
181
|
+
this.value = this.value.slice(0, this.cursor - graphemeLength) + this.value.slice(this.cursor);
|
|
182
|
+
this.cursor -= graphemeLength;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
handleForwardDelete() {
|
|
186
|
+
this.lastAction = null;
|
|
187
|
+
if (this.cursor < this.value.length) {
|
|
188
|
+
this.pushUndo();
|
|
189
|
+
const afterCursor = this.value.slice(this.cursor);
|
|
190
|
+
const graphemes = [...segmenter.segment(afterCursor)];
|
|
191
|
+
const firstGrapheme = graphemes[0];
|
|
192
|
+
const graphemeLength = firstGrapheme ? firstGrapheme.segment.length : 1;
|
|
193
|
+
this.value = this.value.slice(0, this.cursor) + this.value.slice(this.cursor + graphemeLength);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
deleteToLineStart() {
|
|
197
|
+
if (this.cursor === 0)
|
|
198
|
+
return;
|
|
199
|
+
this.pushUndo();
|
|
200
|
+
const deletedText = this.value.slice(0, this.cursor);
|
|
201
|
+
this.killRing.push(deletedText, { prepend: true, accumulate: this.lastAction === "kill" });
|
|
202
|
+
this.lastAction = "kill";
|
|
203
|
+
this.value = this.value.slice(this.cursor);
|
|
204
|
+
this.cursor = 0;
|
|
205
|
+
}
|
|
206
|
+
deleteToLineEnd() {
|
|
207
|
+
if (this.cursor >= this.value.length)
|
|
208
|
+
return;
|
|
209
|
+
this.pushUndo();
|
|
210
|
+
const deletedText = this.value.slice(this.cursor);
|
|
211
|
+
this.killRing.push(deletedText, { prepend: false, accumulate: this.lastAction === "kill" });
|
|
212
|
+
this.lastAction = "kill";
|
|
213
|
+
this.value = this.value.slice(0, this.cursor);
|
|
214
|
+
}
|
|
215
|
+
deleteWordBackwards() {
|
|
216
|
+
if (this.cursor === 0)
|
|
217
|
+
return;
|
|
218
|
+
// Save lastAction before cursor movement (moveWordBackwards resets it)
|
|
219
|
+
const wasKill = this.lastAction === "kill";
|
|
220
|
+
this.pushUndo();
|
|
221
|
+
const oldCursor = this.cursor;
|
|
222
|
+
this.moveWordBackwards();
|
|
223
|
+
const deleteFrom = this.cursor;
|
|
224
|
+
this.cursor = oldCursor;
|
|
225
|
+
const deletedText = this.value.slice(deleteFrom, this.cursor);
|
|
226
|
+
this.killRing.push(deletedText, { prepend: true, accumulate: wasKill });
|
|
227
|
+
this.lastAction = "kill";
|
|
228
|
+
this.value = this.value.slice(0, deleteFrom) + this.value.slice(this.cursor);
|
|
229
|
+
this.cursor = deleteFrom;
|
|
230
|
+
}
|
|
231
|
+
deleteWordForward() {
|
|
232
|
+
if (this.cursor >= this.value.length)
|
|
233
|
+
return;
|
|
234
|
+
// Save lastAction before cursor movement (moveWordForwards resets it)
|
|
235
|
+
const wasKill = this.lastAction === "kill";
|
|
236
|
+
this.pushUndo();
|
|
237
|
+
const oldCursor = this.cursor;
|
|
238
|
+
this.moveWordForwards();
|
|
239
|
+
const deleteTo = this.cursor;
|
|
240
|
+
this.cursor = oldCursor;
|
|
241
|
+
const deletedText = this.value.slice(this.cursor, deleteTo);
|
|
242
|
+
this.killRing.push(deletedText, { prepend: false, accumulate: wasKill });
|
|
243
|
+
this.lastAction = "kill";
|
|
244
|
+
this.value = this.value.slice(0, this.cursor) + this.value.slice(deleteTo);
|
|
245
|
+
}
|
|
246
|
+
yank() {
|
|
247
|
+
const text = this.killRing.peek();
|
|
248
|
+
if (!text)
|
|
249
|
+
return;
|
|
250
|
+
this.pushUndo();
|
|
251
|
+
this.value = this.value.slice(0, this.cursor) + text + this.value.slice(this.cursor);
|
|
252
|
+
this.cursor += text.length;
|
|
253
|
+
this.lastAction = "yank";
|
|
254
|
+
}
|
|
255
|
+
yankPop() {
|
|
256
|
+
if (this.lastAction !== "yank" || this.killRing.length <= 1)
|
|
257
|
+
return;
|
|
258
|
+
this.pushUndo();
|
|
259
|
+
// Delete the previously yanked text (still at end of ring before rotation)
|
|
260
|
+
const prevText = this.killRing.peek() || "";
|
|
261
|
+
this.value = this.value.slice(0, this.cursor - prevText.length) + this.value.slice(this.cursor);
|
|
262
|
+
this.cursor -= prevText.length;
|
|
263
|
+
// Rotate and insert new entry
|
|
264
|
+
this.killRing.rotate();
|
|
265
|
+
const text = this.killRing.peek() || "";
|
|
266
|
+
this.value = this.value.slice(0, this.cursor) + text + this.value.slice(this.cursor);
|
|
267
|
+
this.cursor += text.length;
|
|
268
|
+
this.lastAction = "yank";
|
|
269
|
+
}
|
|
270
|
+
pushUndo() {
|
|
271
|
+
this.undoStack.push({ value: this.value, cursor: this.cursor });
|
|
272
|
+
}
|
|
273
|
+
undo() {
|
|
274
|
+
const snapshot = this.undoStack.pop();
|
|
275
|
+
if (!snapshot)
|
|
276
|
+
return;
|
|
277
|
+
this.value = snapshot.value;
|
|
278
|
+
this.cursor = snapshot.cursor;
|
|
279
|
+
this.lastAction = null;
|
|
280
|
+
}
|
|
281
|
+
moveWordBackwards() {
|
|
282
|
+
if (this.cursor === 0) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
this.lastAction = null;
|
|
286
|
+
const textBeforeCursor = this.value.slice(0, this.cursor);
|
|
287
|
+
const graphemes = [...segmenter.segment(textBeforeCursor)];
|
|
288
|
+
// Skip trailing whitespace
|
|
289
|
+
while (graphemes.length > 0 && isWhitespaceChar(graphemes[graphemes.length - 1]?.segment || "")) {
|
|
290
|
+
this.cursor -= graphemes.pop()?.segment.length || 0;
|
|
291
|
+
}
|
|
292
|
+
if (graphemes.length > 0) {
|
|
293
|
+
const lastGrapheme = graphemes[graphemes.length - 1]?.segment || "";
|
|
294
|
+
if (isPunctuationChar(lastGrapheme)) {
|
|
295
|
+
// Skip punctuation run
|
|
296
|
+
while (graphemes.length > 0 && isPunctuationChar(graphemes[graphemes.length - 1]?.segment || "")) {
|
|
297
|
+
this.cursor -= graphemes.pop()?.segment.length || 0;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
// Skip word run
|
|
302
|
+
while (graphemes.length > 0 &&
|
|
303
|
+
!isWhitespaceChar(graphemes[graphemes.length - 1]?.segment || "") &&
|
|
304
|
+
!isPunctuationChar(graphemes[graphemes.length - 1]?.segment || "")) {
|
|
305
|
+
this.cursor -= graphemes.pop()?.segment.length || 0;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
moveWordForwards() {
|
|
311
|
+
if (this.cursor >= this.value.length) {
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
this.lastAction = null;
|
|
315
|
+
const textAfterCursor = this.value.slice(this.cursor);
|
|
316
|
+
const segments = segmenter.segment(textAfterCursor);
|
|
317
|
+
const iterator = segments[Symbol.iterator]();
|
|
318
|
+
let next = iterator.next();
|
|
319
|
+
// Skip leading whitespace
|
|
320
|
+
while (!next.done && isWhitespaceChar(next.value.segment)) {
|
|
321
|
+
this.cursor += next.value.segment.length;
|
|
322
|
+
next = iterator.next();
|
|
323
|
+
}
|
|
324
|
+
if (!next.done) {
|
|
325
|
+
const firstGrapheme = next.value.segment;
|
|
326
|
+
if (isPunctuationChar(firstGrapheme)) {
|
|
327
|
+
// Skip punctuation run
|
|
328
|
+
while (!next.done && isPunctuationChar(next.value.segment)) {
|
|
329
|
+
this.cursor += next.value.segment.length;
|
|
330
|
+
next = iterator.next();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
// Skip word run
|
|
335
|
+
while (!next.done && !isWhitespaceChar(next.value.segment) && !isPunctuationChar(next.value.segment)) {
|
|
336
|
+
this.cursor += next.value.segment.length;
|
|
337
|
+
next = iterator.next();
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
handlePaste(pastedText) {
|
|
343
|
+
this.lastAction = null;
|
|
344
|
+
this.pushUndo();
|
|
345
|
+
// Clean the pasted text - remove newlines and carriage returns
|
|
346
|
+
const cleanText = pastedText.replace(/\r\n/g, "").replace(/\r/g, "").replace(/\n/g, "");
|
|
347
|
+
// Insert at cursor position
|
|
348
|
+
this.value = this.value.slice(0, this.cursor) + cleanText + this.value.slice(this.cursor);
|
|
349
|
+
this.cursor += cleanText.length;
|
|
350
|
+
}
|
|
351
|
+
invalidate() {
|
|
352
|
+
// No cached state to invalidate currently
|
|
353
|
+
}
|
|
354
|
+
render(width) {
|
|
355
|
+
// Calculate visible window
|
|
356
|
+
const prompt = "> ";
|
|
357
|
+
const availableWidth = width - prompt.length;
|
|
358
|
+
if (availableWidth <= 0) {
|
|
359
|
+
return [prompt];
|
|
360
|
+
}
|
|
361
|
+
let visibleText = "";
|
|
362
|
+
let cursorDisplay = this.cursor;
|
|
363
|
+
if (this.value.length < availableWidth) {
|
|
364
|
+
// Everything fits (leave room for cursor at end)
|
|
365
|
+
visibleText = this.value;
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
// Need horizontal scrolling
|
|
369
|
+
// Reserve one character for cursor if it's at the end
|
|
370
|
+
const scrollWidth = this.cursor === this.value.length ? availableWidth - 1 : availableWidth;
|
|
371
|
+
const halfWidth = Math.floor(scrollWidth / 2);
|
|
372
|
+
const findValidStart = (start) => {
|
|
373
|
+
while (start < this.value.length) {
|
|
374
|
+
const charCode = this.value.charCodeAt(start);
|
|
375
|
+
// this is low surrogate, not a valid start
|
|
376
|
+
if (charCode >= 0xdc00 && charCode < 0xe000) {
|
|
377
|
+
start++;
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
return start;
|
|
383
|
+
};
|
|
384
|
+
const findValidEnd = (end) => {
|
|
385
|
+
while (end > 0) {
|
|
386
|
+
const charCode = this.value.charCodeAt(end - 1);
|
|
387
|
+
// this is high surrogate, might be split.
|
|
388
|
+
if (charCode >= 0xd800 && charCode < 0xdc00) {
|
|
389
|
+
end--;
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
394
|
+
return end;
|
|
395
|
+
};
|
|
396
|
+
if (this.cursor < halfWidth) {
|
|
397
|
+
// Cursor near start
|
|
398
|
+
visibleText = this.value.slice(0, findValidEnd(scrollWidth));
|
|
399
|
+
cursorDisplay = this.cursor;
|
|
400
|
+
}
|
|
401
|
+
else if (this.cursor > this.value.length - halfWidth) {
|
|
402
|
+
// Cursor near end
|
|
403
|
+
const start = findValidStart(this.value.length - scrollWidth);
|
|
404
|
+
visibleText = this.value.slice(start);
|
|
405
|
+
cursorDisplay = this.cursor - start;
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
// Cursor in middle
|
|
409
|
+
const start = findValidStart(this.cursor - halfWidth);
|
|
410
|
+
visibleText = this.value.slice(start, findValidEnd(start + scrollWidth));
|
|
411
|
+
cursorDisplay = halfWidth;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
// Build line with fake cursor
|
|
415
|
+
// Insert cursor character at cursor position
|
|
416
|
+
const graphemes = [...segmenter.segment(visibleText.slice(cursorDisplay))];
|
|
417
|
+
const cursorGrapheme = graphemes[0];
|
|
418
|
+
const beforeCursor = visibleText.slice(0, cursorDisplay);
|
|
419
|
+
const atCursor = cursorGrapheme?.segment ?? " "; // Character at cursor, or space if at end
|
|
420
|
+
const afterCursor = visibleText.slice(cursorDisplay + atCursor.length);
|
|
421
|
+
// Hardware cursor marker (zero-width, emitted before fake cursor for IME positioning)
|
|
422
|
+
const marker = this.focused ? CURSOR_MARKER : "";
|
|
423
|
+
// Use inverse video to show cursor
|
|
424
|
+
const cursorChar = `\x1b[7m${atCursor}\x1b[27m`; // ESC[7m = reverse video, ESC[27m = normal
|
|
425
|
+
const textWithCursor = beforeCursor + marker + cursorChar + afterCursor;
|
|
426
|
+
// Calculate visual width
|
|
427
|
+
const visualLength = visibleWidth(textWithCursor);
|
|
428
|
+
const padding = " ".repeat(Math.max(0, availableWidth - visualLength));
|
|
429
|
+
const line = prompt + textWithCursor + padding;
|
|
430
|
+
return [line];
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
//# sourceMappingURL=input.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Text } from "./text.js";
|
|
2
|
+
/**
|
|
3
|
+
* Loader component that updates every 80ms with spinning animation
|
|
4
|
+
*/
|
|
5
|
+
export class Loader extends Text {
|
|
6
|
+
spinnerColorFn;
|
|
7
|
+
messageColorFn;
|
|
8
|
+
message;
|
|
9
|
+
frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
10
|
+
currentFrame = 0;
|
|
11
|
+
intervalId = null;
|
|
12
|
+
ui = null;
|
|
13
|
+
constructor(ui, spinnerColorFn, messageColorFn, message = "Loading...") {
|
|
14
|
+
super("", 1, 0);
|
|
15
|
+
this.spinnerColorFn = spinnerColorFn;
|
|
16
|
+
this.messageColorFn = messageColorFn;
|
|
17
|
+
this.message = message;
|
|
18
|
+
this.ui = ui;
|
|
19
|
+
this.start();
|
|
20
|
+
}
|
|
21
|
+
render(width) {
|
|
22
|
+
return ["", ...super.render(width)];
|
|
23
|
+
}
|
|
24
|
+
start() {
|
|
25
|
+
this.updateDisplay();
|
|
26
|
+
this.intervalId = setInterval(() => {
|
|
27
|
+
this.currentFrame = (this.currentFrame + 1) % this.frames.length;
|
|
28
|
+
this.updateDisplay();
|
|
29
|
+
}, 80);
|
|
30
|
+
}
|
|
31
|
+
stop() {
|
|
32
|
+
if (this.intervalId) {
|
|
33
|
+
clearInterval(this.intervalId);
|
|
34
|
+
this.intervalId = null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
setMessage(message) {
|
|
38
|
+
this.message = message;
|
|
39
|
+
this.updateDisplay();
|
|
40
|
+
}
|
|
41
|
+
updateDisplay() {
|
|
42
|
+
const frame = this.frames[this.currentFrame];
|
|
43
|
+
this.setText(`${this.spinnerColorFn(frame)} ${this.messageColorFn(this.message)}`);
|
|
44
|
+
if (this.ui) {
|
|
45
|
+
this.ui.requestRender();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=loader.js.map
|