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,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool wrappers for extensions.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Wrap a RegisteredTool into an AgentTool.
|
|
6
|
+
* Uses the runner's createContext() for consistent context across tools and event handlers.
|
|
7
|
+
*/
|
|
8
|
+
export function wrapRegisteredTool(registeredTool, runner) {
|
|
9
|
+
const { definition } = registeredTool;
|
|
10
|
+
return {
|
|
11
|
+
name: definition.name,
|
|
12
|
+
label: definition.label,
|
|
13
|
+
description: definition.description,
|
|
14
|
+
parameters: definition.parameters,
|
|
15
|
+
execute: (toolCallId, params, signal, onUpdate) => definition.execute(toolCallId, params, signal, onUpdate, runner.createContext())
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Wrap all registered tools into AgentTools.
|
|
20
|
+
* Uses the runner's createContext() for consistent context across tools and event handlers.
|
|
21
|
+
*/
|
|
22
|
+
export function wrapRegisteredTools(registeredTools, runner) {
|
|
23
|
+
return registeredTools.map((rt) => wrapRegisteredTool(rt, runner));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Wrap a tool with extension callbacks for interception.
|
|
27
|
+
* - Emits tool_call event before execution (can block)
|
|
28
|
+
* - Emits tool_result event after execution (can modify result)
|
|
29
|
+
*/
|
|
30
|
+
export function wrapToolWithExtensions(tool, runner) {
|
|
31
|
+
return {
|
|
32
|
+
...tool,
|
|
33
|
+
execute: async (toolCallId, params, signal, onUpdate) => {
|
|
34
|
+
// Emit tool_call event - extensions can block execution
|
|
35
|
+
if (runner.hasHandlers('tool_call')) {
|
|
36
|
+
try {
|
|
37
|
+
const callResult = (await runner.emitToolCall({
|
|
38
|
+
type: 'tool_call',
|
|
39
|
+
toolName: tool.name,
|
|
40
|
+
toolCallId,
|
|
41
|
+
input: params
|
|
42
|
+
}));
|
|
43
|
+
if (callResult?.block) {
|
|
44
|
+
const reason = callResult.reason || 'Tool execution was blocked by an extension';
|
|
45
|
+
throw new Error(reason);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
if (err instanceof Error) {
|
|
50
|
+
throw err;
|
|
51
|
+
}
|
|
52
|
+
throw new Error(`Extension failed, blocking execution: ${String(err)}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// Execute the actual tool
|
|
56
|
+
try {
|
|
57
|
+
const result = await tool.execute(toolCallId, params, signal, onUpdate);
|
|
58
|
+
// Emit tool_result event - extensions can modify the result
|
|
59
|
+
if (runner.hasHandlers('tool_result')) {
|
|
60
|
+
const resultResult = await runner.emitToolResult({
|
|
61
|
+
type: 'tool_result',
|
|
62
|
+
toolName: tool.name,
|
|
63
|
+
toolCallId,
|
|
64
|
+
input: params,
|
|
65
|
+
content: result.content,
|
|
66
|
+
details: result.details,
|
|
67
|
+
isError: false
|
|
68
|
+
});
|
|
69
|
+
if (resultResult) {
|
|
70
|
+
return {
|
|
71
|
+
content: resultResult.content ?? result.content,
|
|
72
|
+
details: (resultResult.details ?? result.details)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
// Emit tool_result event for errors
|
|
80
|
+
if (runner.hasHandlers('tool_result')) {
|
|
81
|
+
await runner.emitToolResult({
|
|
82
|
+
type: 'tool_result',
|
|
83
|
+
toolName: tool.name,
|
|
84
|
+
toolCallId,
|
|
85
|
+
input: params,
|
|
86
|
+
content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }],
|
|
87
|
+
details: undefined,
|
|
88
|
+
isError: true
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
throw err;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Wrap all tools with extension callbacks.
|
|
98
|
+
*/
|
|
99
|
+
export function wrapToolsWithExtensions(tools, runner) {
|
|
100
|
+
return tools.map((tool) => wrapToolWithExtensions(tool, runner));
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=wrapper.js.map
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { existsSync, readFileSync, statSync, watch } from 'fs';
|
|
2
|
+
import { dirname, join, resolve } from 'path';
|
|
3
|
+
/**
|
|
4
|
+
* Find the git HEAD path by walking up from cwd.
|
|
5
|
+
* Handles both regular git repos (.git is a directory) and worktrees (.git is a file).
|
|
6
|
+
*/
|
|
7
|
+
function findGitHeadPath() {
|
|
8
|
+
let dir = process.cwd();
|
|
9
|
+
while (true) {
|
|
10
|
+
const gitPath = join(dir, '.git');
|
|
11
|
+
if (existsSync(gitPath)) {
|
|
12
|
+
try {
|
|
13
|
+
const stat = statSync(gitPath);
|
|
14
|
+
if (stat.isFile()) {
|
|
15
|
+
const content = readFileSync(gitPath, 'utf8').trim();
|
|
16
|
+
if (content.startsWith('gitdir: ')) {
|
|
17
|
+
const gitDir = content.slice(8);
|
|
18
|
+
const headPath = resolve(dir, gitDir, 'HEAD');
|
|
19
|
+
if (existsSync(headPath))
|
|
20
|
+
return headPath;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else if (stat.isDirectory()) {
|
|
24
|
+
const headPath = join(gitPath, 'HEAD');
|
|
25
|
+
if (existsSync(headPath))
|
|
26
|
+
return headPath;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const parent = dirname(dir);
|
|
34
|
+
if (parent === dir)
|
|
35
|
+
return null;
|
|
36
|
+
dir = parent;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Provides git branch and extension statuses - data not otherwise accessible to extensions.
|
|
41
|
+
* Token stats, model info available via ctx.sessionManager and ctx.model.
|
|
42
|
+
*/
|
|
43
|
+
export class FooterDataProvider {
|
|
44
|
+
extensionStatuses = new Map();
|
|
45
|
+
cachedBranch = undefined;
|
|
46
|
+
gitWatcher = null;
|
|
47
|
+
branchChangeCallbacks = new Set();
|
|
48
|
+
availableProviderCount = 0;
|
|
49
|
+
constructor() {
|
|
50
|
+
this.setupGitWatcher();
|
|
51
|
+
}
|
|
52
|
+
/** Current git branch, null if not in repo, "detached" if detached HEAD */
|
|
53
|
+
getGitBranch() {
|
|
54
|
+
if (this.cachedBranch !== undefined)
|
|
55
|
+
return this.cachedBranch;
|
|
56
|
+
try {
|
|
57
|
+
const gitHeadPath = findGitHeadPath();
|
|
58
|
+
if (!gitHeadPath) {
|
|
59
|
+
this.cachedBranch = null;
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const content = readFileSync(gitHeadPath, 'utf8').trim();
|
|
63
|
+
this.cachedBranch = content.startsWith('ref: refs/heads/') ? content.slice(16) : 'detached';
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
this.cachedBranch = null;
|
|
67
|
+
}
|
|
68
|
+
return this.cachedBranch;
|
|
69
|
+
}
|
|
70
|
+
/** Extension status texts set via ctx.ui.setStatus() */
|
|
71
|
+
getExtensionStatuses() {
|
|
72
|
+
return this.extensionStatuses;
|
|
73
|
+
}
|
|
74
|
+
/** Subscribe to git branch changes. Returns unsubscribe function. */
|
|
75
|
+
onBranchChange(callback) {
|
|
76
|
+
this.branchChangeCallbacks.add(callback);
|
|
77
|
+
return () => this.branchChangeCallbacks.delete(callback);
|
|
78
|
+
}
|
|
79
|
+
/** Internal: set extension status */
|
|
80
|
+
setExtensionStatus(key, text) {
|
|
81
|
+
if (text === undefined) {
|
|
82
|
+
this.extensionStatuses.delete(key);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
this.extensionStatuses.set(key, text);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Internal: clear extension statuses */
|
|
89
|
+
clearExtensionStatuses() {
|
|
90
|
+
this.extensionStatuses.clear();
|
|
91
|
+
}
|
|
92
|
+
/** Number of unique providers with available models (for footer display) */
|
|
93
|
+
getAvailableProviderCount() {
|
|
94
|
+
return this.availableProviderCount;
|
|
95
|
+
}
|
|
96
|
+
/** Internal: update available provider count */
|
|
97
|
+
setAvailableProviderCount(count) {
|
|
98
|
+
this.availableProviderCount = count;
|
|
99
|
+
}
|
|
100
|
+
/** Shortcut credit balance (null = not fetched or not using shortcut) */
|
|
101
|
+
creditBalance = null;
|
|
102
|
+
/** Initial credit balance captured at session start, used to compute credits used */
|
|
103
|
+
initialCreditBalance = null;
|
|
104
|
+
/** True when the active model uses credits (suppresses $cost even when balance fetch fails) */
|
|
105
|
+
_usesCredits = false;
|
|
106
|
+
getCreditBalance() {
|
|
107
|
+
return this.creditBalance;
|
|
108
|
+
}
|
|
109
|
+
/** Credits consumed this session (initial - current). Returns 0 if not yet known. */
|
|
110
|
+
getCreditsUsed() {
|
|
111
|
+
if (this.initialCreditBalance === null || !this.creditBalance)
|
|
112
|
+
return 0;
|
|
113
|
+
return Math.max(0, this.initialCreditBalance - this.creditBalance.creditsRemaining);
|
|
114
|
+
}
|
|
115
|
+
setCreditBalance(balance) {
|
|
116
|
+
// Capture the first non-null balance as the session baseline
|
|
117
|
+
if (balance && this.initialCreditBalance === null) {
|
|
118
|
+
this.initialCreditBalance = balance.creditsRemaining;
|
|
119
|
+
}
|
|
120
|
+
this.creditBalance = balance;
|
|
121
|
+
}
|
|
122
|
+
get usesCredits() {
|
|
123
|
+
return this._usesCredits;
|
|
124
|
+
}
|
|
125
|
+
setUsesCredits(value) {
|
|
126
|
+
this._usesCredits = value;
|
|
127
|
+
}
|
|
128
|
+
/** Internal: cleanup */
|
|
129
|
+
dispose() {
|
|
130
|
+
if (this.gitWatcher) {
|
|
131
|
+
this.gitWatcher.close();
|
|
132
|
+
this.gitWatcher = null;
|
|
133
|
+
}
|
|
134
|
+
this.branchChangeCallbacks.clear();
|
|
135
|
+
}
|
|
136
|
+
setupGitWatcher() {
|
|
137
|
+
if (this.gitWatcher) {
|
|
138
|
+
this.gitWatcher.close();
|
|
139
|
+
this.gitWatcher = null;
|
|
140
|
+
}
|
|
141
|
+
const gitHeadPath = findGitHeadPath();
|
|
142
|
+
if (!gitHeadPath)
|
|
143
|
+
return;
|
|
144
|
+
// Watch the directory containing HEAD, not HEAD itself.
|
|
145
|
+
// Git uses atomic writes (write temp, rename over HEAD), which changes the inode.
|
|
146
|
+
// fs.watch on a file stops working after the inode changes.
|
|
147
|
+
const gitDir = dirname(gitHeadPath);
|
|
148
|
+
try {
|
|
149
|
+
this.gitWatcher = watch(gitDir, (_eventType, filename) => {
|
|
150
|
+
if (filename === 'HEAD') {
|
|
151
|
+
this.cachedBranch = undefined;
|
|
152
|
+
for (const cb of this.branchChangeCallbacks)
|
|
153
|
+
cb();
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
// Silently fail if we can't watch
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=footer-data-provider.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core modules shared between all run modes.
|
|
3
|
+
*/
|
|
4
|
+
export { AgentSession } from './agent-session.js';
|
|
5
|
+
export { executeBash, executeBashWithOperations } from './bash-executor.js';
|
|
6
|
+
export { createEventBus } from './event-bus.js';
|
|
7
|
+
// Extensions system
|
|
8
|
+
export { ExtensionRunner, discoverAndLoadExtensions, wrapToolsWithExtensions } from './extensions/index.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { DEFAULT_EDITOR_KEYBINDINGS, EditorKeybindingsManager, matchesKey, setEditorKeybindings } from '../tui/index.js';
|
|
2
|
+
import { existsSync, readFileSync } from 'fs';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import { getAgentDir } from '../config.js';
|
|
5
|
+
/**
|
|
6
|
+
* Default application keybindings.
|
|
7
|
+
*/
|
|
8
|
+
export const DEFAULT_APP_KEYBINDINGS = {
|
|
9
|
+
interrupt: 'escape',
|
|
10
|
+
clear: 'ctrl+c',
|
|
11
|
+
exit: 'ctrl+d',
|
|
12
|
+
suspend: 'ctrl+z',
|
|
13
|
+
cycleThinkingLevel: 'shift+tab',
|
|
14
|
+
cycleModelForward: 'ctrl+p',
|
|
15
|
+
cycleModelBackward: 'shift+ctrl+p',
|
|
16
|
+
selectModel: 'ctrl+l',
|
|
17
|
+
expandTools: 'ctrl+o',
|
|
18
|
+
toggleThinking: 'ctrl+t',
|
|
19
|
+
toggleSessionNamedFilter: 'ctrl+n',
|
|
20
|
+
externalEditor: 'ctrl+g',
|
|
21
|
+
followUp: 'alt+enter',
|
|
22
|
+
dequeue: 'alt+up',
|
|
23
|
+
pasteImage: process.platform === 'win32' ? 'alt+v' : 'ctrl+v',
|
|
24
|
+
newSession: [],
|
|
25
|
+
tree: [],
|
|
26
|
+
fork: [],
|
|
27
|
+
resume: []
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* All default keybindings (app + editor).
|
|
31
|
+
*/
|
|
32
|
+
export const DEFAULT_KEYBINDINGS = {
|
|
33
|
+
...DEFAULT_EDITOR_KEYBINDINGS,
|
|
34
|
+
...DEFAULT_APP_KEYBINDINGS
|
|
35
|
+
};
|
|
36
|
+
// App actions list for type checking
|
|
37
|
+
const APP_ACTIONS = [
|
|
38
|
+
'interrupt',
|
|
39
|
+
'clear',
|
|
40
|
+
'exit',
|
|
41
|
+
'suspend',
|
|
42
|
+
'cycleThinkingLevel',
|
|
43
|
+
'cycleModelForward',
|
|
44
|
+
'cycleModelBackward',
|
|
45
|
+
'selectModel',
|
|
46
|
+
'expandTools',
|
|
47
|
+
'toggleThinking',
|
|
48
|
+
'toggleSessionNamedFilter',
|
|
49
|
+
'externalEditor',
|
|
50
|
+
'followUp',
|
|
51
|
+
'dequeue',
|
|
52
|
+
'pasteImage',
|
|
53
|
+
'newSession',
|
|
54
|
+
'tree',
|
|
55
|
+
'fork',
|
|
56
|
+
'resume'
|
|
57
|
+
];
|
|
58
|
+
function isAppAction(action) {
|
|
59
|
+
return APP_ACTIONS.includes(action);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Manages all keybindings (app + editor).
|
|
63
|
+
*/
|
|
64
|
+
export class KeybindingsManager {
|
|
65
|
+
config;
|
|
66
|
+
appActionToKeys;
|
|
67
|
+
constructor(config) {
|
|
68
|
+
this.config = config;
|
|
69
|
+
this.appActionToKeys = new Map();
|
|
70
|
+
this.buildMaps();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Create from config file and set up editor keybindings.
|
|
74
|
+
*/
|
|
75
|
+
static create(agentDir = getAgentDir()) {
|
|
76
|
+
const configPath = join(agentDir, 'keybindings.json');
|
|
77
|
+
const config = KeybindingsManager.loadFromFile(configPath);
|
|
78
|
+
const manager = new KeybindingsManager(config);
|
|
79
|
+
// Set up editor keybindings globally
|
|
80
|
+
// Include both editor actions and expandTools (shared between app and editor)
|
|
81
|
+
const editorConfig = {};
|
|
82
|
+
for (const [action, keys] of Object.entries(config)) {
|
|
83
|
+
if (!isAppAction(action) || action === 'expandTools') {
|
|
84
|
+
editorConfig[action] = keys;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
setEditorKeybindings(new EditorKeybindingsManager(editorConfig));
|
|
88
|
+
return manager;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Create in-memory.
|
|
92
|
+
*/
|
|
93
|
+
static inMemory(config = {}) {
|
|
94
|
+
return new KeybindingsManager(config);
|
|
95
|
+
}
|
|
96
|
+
static loadFromFile(path) {
|
|
97
|
+
if (!existsSync(path))
|
|
98
|
+
return {};
|
|
99
|
+
try {
|
|
100
|
+
return JSON.parse(readFileSync(path, 'utf-8'));
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return {};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
buildMaps() {
|
|
107
|
+
this.appActionToKeys.clear();
|
|
108
|
+
// Set defaults for app actions
|
|
109
|
+
for (const [action, keys] of Object.entries(DEFAULT_APP_KEYBINDINGS)) {
|
|
110
|
+
const keyArray = Array.isArray(keys) ? keys : [keys];
|
|
111
|
+
this.appActionToKeys.set(action, [...keyArray]);
|
|
112
|
+
}
|
|
113
|
+
// Override with user config (app actions only)
|
|
114
|
+
for (const [action, keys] of Object.entries(this.config)) {
|
|
115
|
+
if (keys === undefined || !isAppAction(action))
|
|
116
|
+
continue;
|
|
117
|
+
const keyArray = Array.isArray(keys) ? keys : [keys];
|
|
118
|
+
this.appActionToKeys.set(action, keyArray);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Check if input matches an app action.
|
|
123
|
+
*/
|
|
124
|
+
matches(data, action) {
|
|
125
|
+
const keys = this.appActionToKeys.get(action);
|
|
126
|
+
if (!keys)
|
|
127
|
+
return false;
|
|
128
|
+
for (const key of keys) {
|
|
129
|
+
if (matchesKey(data, key))
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Get keys bound to an app action.
|
|
136
|
+
*/
|
|
137
|
+
getKeys(action) {
|
|
138
|
+
return this.appActionToKeys.get(action) ?? [];
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Get the full effective config.
|
|
142
|
+
*/
|
|
143
|
+
getEffectiveConfig() {
|
|
144
|
+
const result = { ...DEFAULT_KEYBINDINGS };
|
|
145
|
+
for (const [action, keys] of Object.entries(this.config)) {
|
|
146
|
+
if (keys !== undefined) {
|
|
147
|
+
result[action] = keys;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return result;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=keybindings.js.map
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom message types and transformers for the coding agent.
|
|
3
|
+
*
|
|
4
|
+
* Extends the base AgentMessage type with coding-agent specific message types,
|
|
5
|
+
* and provides a transformer to convert them to LLM-compatible messages.
|
|
6
|
+
*/
|
|
7
|
+
export const COMPACTION_SUMMARY_PREFIX = `The conversation history before this point was compacted into the following summary:
|
|
8
|
+
|
|
9
|
+
<summary>
|
|
10
|
+
`;
|
|
11
|
+
export const COMPACTION_SUMMARY_SUFFIX = `
|
|
12
|
+
</summary>`;
|
|
13
|
+
export const BRANCH_SUMMARY_PREFIX = `The following is a summary of a branch that this conversation came back from:
|
|
14
|
+
|
|
15
|
+
<summary>
|
|
16
|
+
`;
|
|
17
|
+
export const BRANCH_SUMMARY_SUFFIX = `</summary>`;
|
|
18
|
+
/**
|
|
19
|
+
* Convert a BashExecutionMessage to user message text for LLM context.
|
|
20
|
+
*/
|
|
21
|
+
export function bashExecutionToText(msg) {
|
|
22
|
+
let text = `Ran \`${msg.command}\`\n`;
|
|
23
|
+
if (msg.output) {
|
|
24
|
+
text += `\`\`\`\n${msg.output}\n\`\`\``;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
text += '(no output)';
|
|
28
|
+
}
|
|
29
|
+
if (msg.cancelled) {
|
|
30
|
+
text += '\n\n(command cancelled)';
|
|
31
|
+
}
|
|
32
|
+
else if (msg.exitCode !== null && msg.exitCode !== undefined && msg.exitCode !== 0) {
|
|
33
|
+
text += `\n\nCommand exited with code ${msg.exitCode}`;
|
|
34
|
+
}
|
|
35
|
+
if (msg.truncated && msg.fullOutputPath) {
|
|
36
|
+
text += `\n\n[Output truncated. Full output: ${msg.fullOutputPath}]`;
|
|
37
|
+
}
|
|
38
|
+
return text;
|
|
39
|
+
}
|
|
40
|
+
export function createBranchSummaryMessage(summary, fromId, timestamp) {
|
|
41
|
+
return {
|
|
42
|
+
role: 'branchSummary',
|
|
43
|
+
summary,
|
|
44
|
+
fromId,
|
|
45
|
+
timestamp: new Date(timestamp).getTime()
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function createCompactionSummaryMessage(summary, tokensBefore, timestamp) {
|
|
49
|
+
return {
|
|
50
|
+
role: 'compactionSummary',
|
|
51
|
+
summary: summary,
|
|
52
|
+
tokensBefore,
|
|
53
|
+
timestamp: new Date(timestamp).getTime()
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** Convert CustomMessageEntry to AgentMessage format */
|
|
57
|
+
export function createCustomMessage(customType, content, display, details, timestamp) {
|
|
58
|
+
return {
|
|
59
|
+
role: 'custom',
|
|
60
|
+
customType,
|
|
61
|
+
content,
|
|
62
|
+
display,
|
|
63
|
+
details,
|
|
64
|
+
timestamp: new Date(timestamp).getTime()
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Transform AgentMessages (including custom types) to LLM-compatible Messages.
|
|
69
|
+
*
|
|
70
|
+
* This is used by:
|
|
71
|
+
* - Agent's transormToLlm option (for prompt calls and queued messages)
|
|
72
|
+
* - Compaction's generateSummary (for summarization)
|
|
73
|
+
* - Custom extensions and tools
|
|
74
|
+
*/
|
|
75
|
+
export function convertToLlm(messages) {
|
|
76
|
+
return messages
|
|
77
|
+
.map((m) => {
|
|
78
|
+
switch (m.role) {
|
|
79
|
+
case 'bashExecution':
|
|
80
|
+
// Skip messages excluded from context (!! prefix)
|
|
81
|
+
if (m.excludeFromContext) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
role: 'user',
|
|
86
|
+
content: [{ type: 'text', text: bashExecutionToText(m) }],
|
|
87
|
+
timestamp: m.timestamp
|
|
88
|
+
};
|
|
89
|
+
case 'custom': {
|
|
90
|
+
const content = typeof m.content === 'string'
|
|
91
|
+
? [{ type: 'text', text: m.content }]
|
|
92
|
+
: m.content;
|
|
93
|
+
return {
|
|
94
|
+
role: 'user',
|
|
95
|
+
content,
|
|
96
|
+
timestamp: m.timestamp
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
case 'branchSummary':
|
|
100
|
+
return {
|
|
101
|
+
role: 'user',
|
|
102
|
+
content: [
|
|
103
|
+
{
|
|
104
|
+
type: 'text',
|
|
105
|
+
text: BRANCH_SUMMARY_PREFIX + m.summary + BRANCH_SUMMARY_SUFFIX
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
timestamp: m.timestamp
|
|
109
|
+
};
|
|
110
|
+
case 'compactionSummary':
|
|
111
|
+
return {
|
|
112
|
+
role: 'user',
|
|
113
|
+
content: [
|
|
114
|
+
{
|
|
115
|
+
type: 'text',
|
|
116
|
+
text: COMPACTION_SUMMARY_PREFIX + m.summary + COMPACTION_SUMMARY_SUFFIX
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
timestamp: m.timestamp
|
|
120
|
+
};
|
|
121
|
+
case 'user':
|
|
122
|
+
case 'assistant':
|
|
123
|
+
case 'toolResult':
|
|
124
|
+
return m;
|
|
125
|
+
default:
|
|
126
|
+
// biome-ignore lint/correctness/noSwitchDeclarations: fine
|
|
127
|
+
const _exhaustiveCheck = m;
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
.filter((m) => m !== undefined);
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=messages.js.map
|