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,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task tool — spawn a subagent to handle complex tasks autonomously.
|
|
3
|
+
*
|
|
4
|
+
* The LLM calls `task(subagent_type, name, query)` to delegate work
|
|
5
|
+
* to a child process running THIS binary. The child inherits all custom
|
|
6
|
+
* tools (excel_exec), providers, and auth.
|
|
7
|
+
*
|
|
8
|
+
* Multiple task() calls execute in parallel (our forked agent loop does
|
|
9
|
+
* Promise.all on tool calls).
|
|
10
|
+
*/
|
|
11
|
+
import { StringEnum } from '@mariozechner/pi-ai';
|
|
12
|
+
import { Type } from '@sinclair/typebox';
|
|
13
|
+
import { ABORT_AGENT_MESSAGE, ABORT_UI_LABEL_INLINE } from '../../../core/abort.js';
|
|
14
|
+
import { resolveOwnBinary } from '../../../config.js';
|
|
15
|
+
import { TASK } from '../../../tool-names.js';
|
|
16
|
+
import { buildTaskToolDescription, getSubagent, getSubagentNames } from '../../agents/index.js';
|
|
17
|
+
import { buildAgentArgs } from './subprocess.js';
|
|
18
|
+
import { renderTaskCall, renderTaskGroup, renderTaskResult } from './render.js';
|
|
19
|
+
import { truncateOutput } from '../../../core/tools/truncate.js';
|
|
20
|
+
import { cleanupTempFile, spawnSubagent } from './subprocess.js';
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Constants
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
const TOOL_NAME = TASK;
|
|
25
|
+
const TOOL_LABEL = 'Task';
|
|
26
|
+
const TOOL_DESCRIPTION = buildTaskToolDescription();
|
|
27
|
+
const SUBAGENT_MODELS = ['shortcut/claude-opus-4-6', 'shortcut/gpt-5.4-2026-03-05'];
|
|
28
|
+
function buildSchema() {
|
|
29
|
+
const names = getSubagentNames();
|
|
30
|
+
return Type.Object({
|
|
31
|
+
subagent_type: StringEnum(names, {
|
|
32
|
+
description: 'The type of specialized agent to use for this task'
|
|
33
|
+
}),
|
|
34
|
+
name: Type.String({
|
|
35
|
+
description: "Descriptive name for the task (max 3 words). Use the target being analyzed, e.g. 'Revenue Sheet', 'Income Statement', 'Format Summary'. NEVER use generic names like 'Task 1' or 'Analysis'. Shown in the UI."
|
|
36
|
+
}),
|
|
37
|
+
query: Type.String({
|
|
38
|
+
description: 'The task for the subagent. Be specific: include file paths, sheet names, cell ranges, and concrete instructions. The subagent has its own context window and cannot see your conversation history. ' +
|
|
39
|
+
'Can also be a file path ending in .txt (e.g., "/tmp/query.txt") — the file contents will be used as the query. Useful for batch/parallel calls to programmatically write .txt query files with variables.'
|
|
40
|
+
}),
|
|
41
|
+
model: Type.Optional(StringEnum(SUBAGENT_MODELS, {
|
|
42
|
+
description: 'shortcut/claude-opus-4-6 (default): best all-around choice. shortcut/gpt-5.4-2026-03-05: stronger reasoning but weaker formatting — best for auditing, reviewing, and verification tasks, especially when run concurrently with Opus tasks for diverse perspectives.'
|
|
43
|
+
}))
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export function createTaskTool(options = {}) {
|
|
47
|
+
const { cwd: cwdOverride, extraArgs = [] } = options;
|
|
48
|
+
const schema = buildSchema();
|
|
49
|
+
return {
|
|
50
|
+
name: TOOL_NAME,
|
|
51
|
+
label: TOOL_LABEL,
|
|
52
|
+
description: TOOL_DESCRIPTION,
|
|
53
|
+
parameters: schema,
|
|
54
|
+
async execute(_toolCallId, params, signal, onUpdate, ctx) {
|
|
55
|
+
const { subagent_type, query, model: modelOverride } = params;
|
|
56
|
+
// Look up agent config
|
|
57
|
+
const agentConfig = getSubagent(subagent_type);
|
|
58
|
+
if (!agentConfig) {
|
|
59
|
+
const available = getSubagentNames().join(', ');
|
|
60
|
+
return {
|
|
61
|
+
content: [
|
|
62
|
+
{
|
|
63
|
+
type: 'text',
|
|
64
|
+
text: `Unknown subagent_type '${subagent_type}'. Available: ${available}`
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
details: undefined,
|
|
68
|
+
isError: true
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const taskCwd = cwdOverride ?? process.cwd();
|
|
72
|
+
const command = resolveOwnBinary();
|
|
73
|
+
// Apply model override if provided
|
|
74
|
+
const effectiveConfig = modelOverride
|
|
75
|
+
? { ...agentConfig, model: modelOverride }
|
|
76
|
+
: agentConfig;
|
|
77
|
+
const effectiveModel = effectiveConfig.model ?? 'shortcut/claude-opus-4-6';
|
|
78
|
+
// Resolve model info for context window display and API key
|
|
79
|
+
const [modelProvider, ...modelIdParts] = effectiveModel.split('/');
|
|
80
|
+
const modelId = modelIdParts.join('/');
|
|
81
|
+
const modelInfo = ctx.modelRegistry.find(modelProvider, modelId);
|
|
82
|
+
const contextWindow = modelInfo?.contextWindow ?? 0;
|
|
83
|
+
// Build args from agent config (typed config → CLI args + temp file)
|
|
84
|
+
const { args: agentArgs, promptFile } = buildAgentArgs(effectiveConfig);
|
|
85
|
+
// Subagent reads auth.json directly (kept fresh by parent's proactive
|
|
86
|
+
// refresh timer). No --api-key needed — avoids stale tokens on long runs.
|
|
87
|
+
const timeoutMs = (agentConfig.timeoutSeconds ?? 900) * 1000;
|
|
88
|
+
const abortController = new AbortController();
|
|
89
|
+
// Compose signals: external abort + timeout
|
|
90
|
+
const timeoutId = setTimeout(() => abortController.abort(), timeoutMs);
|
|
91
|
+
if (signal) {
|
|
92
|
+
signal.addEventListener('abort', () => abortController.abort(), { once: true });
|
|
93
|
+
}
|
|
94
|
+
let result;
|
|
95
|
+
try {
|
|
96
|
+
result = await spawnSubagent({
|
|
97
|
+
task: query,
|
|
98
|
+
cwd: taskCwd,
|
|
99
|
+
command,
|
|
100
|
+
agentArgs: [...extraArgs, ...agentArgs],
|
|
101
|
+
signal: abortController.signal,
|
|
102
|
+
onProgress: (progress) => {
|
|
103
|
+
const details = {
|
|
104
|
+
text: progress.text,
|
|
105
|
+
toolCalls: progress.toolCalls,
|
|
106
|
+
usage: progress.usage,
|
|
107
|
+
model: progress.model,
|
|
108
|
+
contextWindow,
|
|
109
|
+
isRunning: true,
|
|
110
|
+
isError: false
|
|
111
|
+
};
|
|
112
|
+
onUpdate?.({
|
|
113
|
+
content: [{ type: 'text', text: progress.text || '(running...)' }],
|
|
114
|
+
details
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
finally {
|
|
120
|
+
clearTimeout(timeoutId);
|
|
121
|
+
if (promptFile)
|
|
122
|
+
cleanupTempFile(promptFile);
|
|
123
|
+
}
|
|
124
|
+
// User cancel (or timeout) — surface a clean cancelled message, not a generic error
|
|
125
|
+
if (result.aborted) {
|
|
126
|
+
const details = {
|
|
127
|
+
text: ABORT_UI_LABEL_INLINE,
|
|
128
|
+
toolCalls: result.toolCalls,
|
|
129
|
+
usage: result.usage,
|
|
130
|
+
model: result.model,
|
|
131
|
+
contextWindow,
|
|
132
|
+
isRunning: false,
|
|
133
|
+
isError: false,
|
|
134
|
+
isAborted: true,
|
|
135
|
+
sessionId: result.sessionId,
|
|
136
|
+
sessionFile: result.sessionFile
|
|
137
|
+
};
|
|
138
|
+
return {
|
|
139
|
+
content: [{ type: 'text', text: ABORT_AGENT_MESSAGE }],
|
|
140
|
+
details
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
const isError = result.exitCode !== 0 || result.stopReason === 'error' || result.stopReason === 'aborted';
|
|
144
|
+
const details = {
|
|
145
|
+
text: result.text,
|
|
146
|
+
toolCalls: result.toolCalls,
|
|
147
|
+
usage: result.usage,
|
|
148
|
+
model: result.model,
|
|
149
|
+
contextWindow,
|
|
150
|
+
isRunning: false,
|
|
151
|
+
isError,
|
|
152
|
+
errorMessage: result.errorMessage,
|
|
153
|
+
sessionId: result.sessionId,
|
|
154
|
+
sessionFile: result.sessionFile
|
|
155
|
+
};
|
|
156
|
+
if (isError) {
|
|
157
|
+
const errorText = result.errorMessage || result.stderr || result.text || '(subagent failed with no output)';
|
|
158
|
+
return {
|
|
159
|
+
content: [{ type: 'text', text: `Error: ${truncateOutput(errorText)}` }],
|
|
160
|
+
details,
|
|
161
|
+
isError: true
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
content: [{ type: 'text', text: truncateOutput(result.text || '(no output)') }],
|
|
166
|
+
details
|
|
167
|
+
};
|
|
168
|
+
},
|
|
169
|
+
renderCall(args, options, theme) {
|
|
170
|
+
const a = args;
|
|
171
|
+
const name = a.name ?? 'task';
|
|
172
|
+
const agentType = a.subagent_type;
|
|
173
|
+
const query = a.query;
|
|
174
|
+
const label = agentType ? `${name} [${agentType}]` : name;
|
|
175
|
+
return renderTaskCall({ name: label, query }, options.expanded, theme);
|
|
176
|
+
},
|
|
177
|
+
renderResult(result, options, theme) {
|
|
178
|
+
const details = result.details;
|
|
179
|
+
if (!details) {
|
|
180
|
+
const textBlock = result.content?.[0];
|
|
181
|
+
const fallback = textBlock?.type === 'text' ? textBlock.text : '(no output)';
|
|
182
|
+
return renderTaskResult({
|
|
183
|
+
text: fallback,
|
|
184
|
+
toolCalls: [],
|
|
185
|
+
usage: {
|
|
186
|
+
input: 0,
|
|
187
|
+
output: 0,
|
|
188
|
+
cacheRead: 0,
|
|
189
|
+
cacheWrite: 0,
|
|
190
|
+
cost: 0,
|
|
191
|
+
turns: 0,
|
|
192
|
+
lastTurnInput: 0
|
|
193
|
+
},
|
|
194
|
+
isRunning: false,
|
|
195
|
+
isError: false
|
|
196
|
+
}, options.expanded, theme);
|
|
197
|
+
}
|
|
198
|
+
return renderTaskResult(details, options.expanded, theme);
|
|
199
|
+
},
|
|
200
|
+
renderGroup(members, options, theme) {
|
|
201
|
+
return renderTaskGroup(members, options, theme);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=task.js.map
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Todo list tool — in-memory task tracker for complex multi-step workflows.
|
|
3
|
+
*
|
|
4
|
+
* Renders as a persistent widget above the editor (aboveEditor placement)
|
|
5
|
+
* that survives interrupts and stays visible throughout the session.
|
|
6
|
+
* State is persisted in tool result details (written to session JSONL on each call).
|
|
7
|
+
*/
|
|
8
|
+
import { Type } from '@sinclair/typebox';
|
|
9
|
+
import { theme } from '../../core/theme.js';
|
|
10
|
+
import { TODO_LIST } from '../../tool-names.js';
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Schema
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
const TodoItemSchema = Type.Object({
|
|
15
|
+
id: Type.String({ description: 'A short id to reference the task, like update-1' }),
|
|
16
|
+
content: Type.Optional(Type.String({
|
|
17
|
+
description: 'Clear description of the task (1-2 sentences). Include the cells/ranges you will read from and write to. When merge=true, omit to keep existing value.'
|
|
18
|
+
})),
|
|
19
|
+
status: Type.Optional(Type.Union([Type.Literal('todo'), Type.Literal('in_progress'), Type.Literal('done')], {
|
|
20
|
+
description: "Task status: 'todo', 'in_progress', or 'done'. When merge=true, omit to keep existing value."
|
|
21
|
+
}))
|
|
22
|
+
});
|
|
23
|
+
const schema = Type.Object({
|
|
24
|
+
merge: Type.Boolean({
|
|
25
|
+
description: 'If false, completely replace existing items. If true, merge by id — only id is required per item, content/status keep existing values when omitted.'
|
|
26
|
+
}),
|
|
27
|
+
items: Type.Array(TodoItemSchema, {
|
|
28
|
+
description: 'The list of tasks to create or update.'
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Tool description (what the LLM sees)
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
const TOOL_DESCRIPTION = `\
|
|
35
|
+
Update your task list. Use merge=false to replace all tasks, or merge=true to patch specific tasks by id.
|
|
36
|
+
When handling complex Excel workflows, use this tool to ensure all operations complete successfully and in the correct order.
|
|
37
|
+
|
|
38
|
+
Use ONLY when creating NEW complex models/spreadsheets from scratch. NOT for editing or iterative updates.
|
|
39
|
+
For model creation: understand data, styles, and formats before planning. Include references, ranges, and formatting details in tasks.
|
|
40
|
+
|
|
41
|
+
Each task has:
|
|
42
|
+
- id: a short id to reference the task, like update-1
|
|
43
|
+
- content: what needs to be done
|
|
44
|
+
- status: 'todo', 'in_progress', or 'done'
|
|
45
|
+
|
|
46
|
+
IMPORTANT: Call this frequently to update and ensure only one task is in progress at a time.`;
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// State (singleton — one session per process)
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
let items = [];
|
|
51
|
+
let widgetFn = null;
|
|
52
|
+
const WIDGET_KEY = 'todo';
|
|
53
|
+
const DISMISS_DELAY_MS = 3_000;
|
|
54
|
+
const ANSI_BLINK = '\x1b[5m';
|
|
55
|
+
const ANSI_RESET = '\x1b[0m';
|
|
56
|
+
const VALID_STATUSES = new Set(['todo', 'in_progress', 'done']);
|
|
57
|
+
let dismissTimer = null;
|
|
58
|
+
/** Validate and coerce a raw status string, falling back to `fallback`. */
|
|
59
|
+
function coerceStatus(raw, fallback) {
|
|
60
|
+
if (raw !== undefined && VALID_STATUSES.has(raw))
|
|
61
|
+
return raw;
|
|
62
|
+
return fallback;
|
|
63
|
+
}
|
|
64
|
+
/** Build a TodoItem from raw input, optionally merging with an existing item. */
|
|
65
|
+
function buildItem(raw, existing) {
|
|
66
|
+
return {
|
|
67
|
+
id: raw.id,
|
|
68
|
+
content: raw.content ?? existing?.content ?? 'Task not specified',
|
|
69
|
+
status: coerceStatus(raw.status, existing?.status ?? 'todo')
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Called from main.ts onReady to wire up the persistent widget.
|
|
74
|
+
*/
|
|
75
|
+
export function setTodoWidget(setWidget) {
|
|
76
|
+
widgetFn = setWidget;
|
|
77
|
+
if (items.length > 0) {
|
|
78
|
+
updateWidget();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// Core logic
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
function applyUpdate(merge, incoming) {
|
|
85
|
+
// Deduplicate — last entry per id wins (handles LLM sending duplicate ids)
|
|
86
|
+
const deduped = [...new Map(incoming.map((it) => [it.id, it])).values()];
|
|
87
|
+
if (!merge) {
|
|
88
|
+
const newItems = deduped.map((raw) => buildItem(raw));
|
|
89
|
+
items = newItems;
|
|
90
|
+
return { updatedItems: newItems, allItems: newItems };
|
|
91
|
+
}
|
|
92
|
+
// Merge mode — patch existing items, append new ones
|
|
93
|
+
const currentById = new Map(items.map((it, idx) => [it.id, idx]));
|
|
94
|
+
const result = [...items];
|
|
95
|
+
for (const raw of deduped) {
|
|
96
|
+
const idx = currentById.get(raw.id);
|
|
97
|
+
if (idx !== undefined) {
|
|
98
|
+
result[idx] = buildItem(raw, result[idx]);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
result.push(buildItem(raw));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
items = result;
|
|
105
|
+
const touchedIds = new Set(deduped.map((it) => it.id));
|
|
106
|
+
const updatedItems = result.filter((it) => touchedIds.has(it.id));
|
|
107
|
+
return { updatedItems, allItems: result };
|
|
108
|
+
}
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
// Widget rendering
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
function renderItem(t, isLast) {
|
|
113
|
+
const glyph = isLast ? '└─' : '├─';
|
|
114
|
+
const glyphStr = theme.fg('dim', glyph);
|
|
115
|
+
switch (t.status) {
|
|
116
|
+
case 'done': {
|
|
117
|
+
const icon = theme.fg('success', '✔');
|
|
118
|
+
const text = theme.strikethrough(theme.fg('dim', t.content));
|
|
119
|
+
return ` ${glyphStr} ${icon} ${text}`;
|
|
120
|
+
}
|
|
121
|
+
case 'in_progress': {
|
|
122
|
+
const icon = `${ANSI_BLINK}${theme.fg('warning', '●')}${ANSI_RESET}`;
|
|
123
|
+
const text = theme.fg('muted', t.content);
|
|
124
|
+
return ` ${glyphStr} ${icon} ${text}`;
|
|
125
|
+
}
|
|
126
|
+
case 'todo': {
|
|
127
|
+
const icon = theme.fg('dim', '○');
|
|
128
|
+
const text = theme.fg('muted', t.content);
|
|
129
|
+
return ` ${glyphStr} ${icon} ${text}`;
|
|
130
|
+
}
|
|
131
|
+
default: {
|
|
132
|
+
const _exhaustive = t.status;
|
|
133
|
+
return _exhaustive;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function updateWidget() {
|
|
138
|
+
if (!widgetFn)
|
|
139
|
+
return;
|
|
140
|
+
if (items.length === 0) {
|
|
141
|
+
widgetFn(WIDGET_KEY, undefined);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const done = items.filter((t) => t.status === 'done').length;
|
|
145
|
+
const lines = [];
|
|
146
|
+
// Header with progress summary
|
|
147
|
+
const header = theme.fg('accent', `Tasks ${done}/${items.length}`);
|
|
148
|
+
lines.push(header);
|
|
149
|
+
// Each item as a tree branch
|
|
150
|
+
for (let i = 0; i < items.length; i++) {
|
|
151
|
+
lines.push(renderItem(items[i], i === items.length - 1));
|
|
152
|
+
}
|
|
153
|
+
widgetFn(WIDGET_KEY, lines, { placement: 'aboveEditor' });
|
|
154
|
+
// Auto-dismiss after all tasks are done
|
|
155
|
+
if (dismissTimer) {
|
|
156
|
+
clearTimeout(dismissTimer);
|
|
157
|
+
dismissTimer = null;
|
|
158
|
+
}
|
|
159
|
+
if (done === items.length) {
|
|
160
|
+
dismissTimer = setTimeout(() => {
|
|
161
|
+
widgetFn?.(WIDGET_KEY, undefined);
|
|
162
|
+
dismissTimer = null;
|
|
163
|
+
}, DISMISS_DELAY_MS);
|
|
164
|
+
dismissTimer.unref?.();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
// Tool factory
|
|
169
|
+
// ---------------------------------------------------------------------------
|
|
170
|
+
export function createTodoListTool() {
|
|
171
|
+
return {
|
|
172
|
+
name: TODO_LIST,
|
|
173
|
+
label: 'Todo list',
|
|
174
|
+
description: TOOL_DESCRIPTION,
|
|
175
|
+
parameters: schema,
|
|
176
|
+
async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
|
|
177
|
+
const { updatedItems, allItems } = applyUpdate(params.merge, params.items);
|
|
178
|
+
// Update the persistent widget
|
|
179
|
+
updateWidget();
|
|
180
|
+
const summary = (updatedItems.length > 0 ? updatedItems : allItems).map((t) => `[${t.status === 'done' ? 'x' : t.status === 'in_progress' ? '>' : ' '}] ${t.id}: ${t.content}`);
|
|
181
|
+
return {
|
|
182
|
+
content: [{ type: 'text', text: summary.join('\n') || 'No tasks' }],
|
|
183
|
+
details: { items: allItems }
|
|
184
|
+
};
|
|
185
|
+
},
|
|
186
|
+
renderCall() {
|
|
187
|
+
// Suppressed — the persistent widget above the editor shows the state
|
|
188
|
+
return undefined;
|
|
189
|
+
},
|
|
190
|
+
renderResult() {
|
|
191
|
+
return undefined;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=todo-list.js.map
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session trace uploader.
|
|
3
|
+
*
|
|
4
|
+
* Listens for agent_end events and uploads the session JSONL (and any
|
|
5
|
+
* subagent JONLs) to the Shortcut backend for centralized trace storage.
|
|
6
|
+
*
|
|
7
|
+
* Subagent linking: when the parent session contains task tool results
|
|
8
|
+
* with sessionFile paths, those subagent JONLs are uploaded too. The
|
|
9
|
+
* parent's JSONL references subagent session IDs via details.sessionId,
|
|
10
|
+
* forming a tree queryable in ClickHouse.
|
|
11
|
+
*/
|
|
12
|
+
import { existsSync, readFileSync, rmdirSync, unlinkSync } from 'fs';
|
|
13
|
+
import { dirname } from 'path';
|
|
14
|
+
import { SHORTCUT_API_URL } from '../constants.js';
|
|
15
|
+
/**
|
|
16
|
+
* Upload JSONL content to the trace endpoint.
|
|
17
|
+
* Pure HTTP — no file I/O, no constants. Exported for testing.
|
|
18
|
+
*/
|
|
19
|
+
export async function uploadTrace(content, baseUrl, accessToken) {
|
|
20
|
+
const response = await fetch(`${baseUrl}/api/v1/agent-traces`, {
|
|
21
|
+
method: 'POST',
|
|
22
|
+
headers: {
|
|
23
|
+
'Content-Type': 'application/x-ndjson',
|
|
24
|
+
Authorization: `Bearer ${accessToken}`
|
|
25
|
+
},
|
|
26
|
+
body: content
|
|
27
|
+
});
|
|
28
|
+
const body = await response.text().catch(() => '');
|
|
29
|
+
return { ok: response.ok, status: response.status, body };
|
|
30
|
+
}
|
|
31
|
+
export function attachSessionUpload(session, options) {
|
|
32
|
+
if (options.enabled === false) {
|
|
33
|
+
return () => { };
|
|
34
|
+
}
|
|
35
|
+
const listener = (event) => {
|
|
36
|
+
if (event.type === 'agent_end') {
|
|
37
|
+
void uploadAll(session, options).catch(() => { });
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return session.subscribe(listener);
|
|
41
|
+
}
|
|
42
|
+
async function uploadAll(session, options) {
|
|
43
|
+
const accessToken = options.getAccessToken();
|
|
44
|
+
if (!accessToken)
|
|
45
|
+
return;
|
|
46
|
+
const sessionFile = session.sessionManager.getSessionFile();
|
|
47
|
+
if (!sessionFile)
|
|
48
|
+
return;
|
|
49
|
+
// Upload the parent session
|
|
50
|
+
await uploadFileFromDisk(sessionFile, accessToken);
|
|
51
|
+
// Find and upload subagent session files from tool result details
|
|
52
|
+
const entries = session.sessionManager.getEntries();
|
|
53
|
+
for (const entry of entries) {
|
|
54
|
+
if (entry.type !== 'message')
|
|
55
|
+
continue;
|
|
56
|
+
const msg = entry.message;
|
|
57
|
+
if (msg?.role !== 'toolResult')
|
|
58
|
+
continue;
|
|
59
|
+
const subFile = msg?.details?.sessionFile;
|
|
60
|
+
if (typeof subFile === 'string' && existsSync(subFile)) {
|
|
61
|
+
await uploadFileFromDisk(subFile, accessToken);
|
|
62
|
+
try {
|
|
63
|
+
unlinkSync(subFile);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
/* ignore */
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
rmdirSync(dirname(subFile));
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
/* ignore */
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function uploadFileFromDisk(filePath, accessToken) {
|
|
78
|
+
let content;
|
|
79
|
+
try {
|
|
80
|
+
content = readFileSync(filePath, 'utf-8');
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (!content.trim())
|
|
86
|
+
return;
|
|
87
|
+
const result = await uploadTrace(content, SHORTCUT_API_URL, accessToken);
|
|
88
|
+
if (!result.ok) {
|
|
89
|
+
// Silenced: staging/local API may not have trace endpoint
|
|
90
|
+
// console.warn(`[trace-upload] Failed: ${result.status} ${result.body}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=session-upload.js.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Core session management
|
|
2
|
+
// Config paths
|
|
3
|
+
export { VERSION, getAgentDir } from './config.js';
|
|
4
|
+
export { AgentSession, parseSkillBlock } from './core/agent-session.js';
|
|
5
|
+
// Auth and model registry
|
|
6
|
+
export { AuthStorage, FileAuthStorageBackend, InMemoryAuthStorageBackend } from './core/auth-storage.js';
|
|
7
|
+
// Compaction
|
|
8
|
+
export { DEFAULT_COMPACTION_SETTINGS, calculateContextTokens, collectEntriesForBranchSummary, compact, estimateTokens, findCutPoint, findTurnStartIndex, generateBranchSummary, generateSummary, getLastAssistantUsage, prepareBranchEntries, serializeConversation, shouldCompact } from './core/compaction/index.js';
|
|
9
|
+
export { createEventBus } from './core/event-bus.js';
|
|
10
|
+
// Extension system
|
|
11
|
+
export { ExtensionRunner, createExtensionRuntime, discoverAndLoadExtensions, isBashToolResult, isEditToolResult, isFindToolResult, isGrepToolResult, isLsToolResult, isReadToolResult, isToolCallEventType, isWriteToolResult, wrapRegisteredTool, wrapRegisteredTools, wrapToolWithExtensions, wrapToolsWithExtensions } from './core/extensions/index.js';
|
|
12
|
+
export { convertToLlm } from './core/messages.js';
|
|
13
|
+
export { ModelRegistry } from './core/model-registry.js';
|
|
14
|
+
export { DefaultPackageManager } from './core/package-manager.js';
|
|
15
|
+
export { DefaultResourceLoader } from './core/resource-loader.js';
|
|
16
|
+
// SDK for programmatic usage
|
|
17
|
+
export {
|
|
18
|
+
// Factory
|
|
19
|
+
createAgentSession, createBashTool,
|
|
20
|
+
// Tool factories (for custom cwd)
|
|
21
|
+
createCodingTools, createEditTool, createFindTool, createGrepTool, createLsTool, createReadOnlyTools, createReadTool, createWriteTool,
|
|
22
|
+
// Pre-built tools (use process.cwd())
|
|
23
|
+
readOnlyTools } from './core/sdk.js';
|
|
24
|
+
export { CURRENT_SESSION_VERSION, SessionManager, buildSessionContext, getLatestCompactionEntry, migrateSessionEntries, parseSessionEntries } from './core/session-manager.js';
|
|
25
|
+
export { SettingsManager } from './core/settings-manager.js';
|
|
26
|
+
// Skills
|
|
27
|
+
export { formatSkillsForPrompt, loadSkills, loadSkillsFromDir } from './core/skills.js';
|
|
28
|
+
// Tools
|
|
29
|
+
export { DEFAULT_MAX_CHARS, bashTool, codingTools, editTool, findTool, formatSize, grepTool, lsTool, readTool, truncateHead, truncateLine, truncateOutput, writeTool } from './core/tools/index.js';
|
|
30
|
+
// Main entry point
|
|
31
|
+
export { main } from './main.js';
|
|
32
|
+
// Run modes for programmatic SDK usage
|
|
33
|
+
export { InteractiveMode, runPrintMode, runRpcMode } from './modes/index.js';
|
|
34
|
+
// UI components for extensions
|
|
35
|
+
export { ArminComponent, AssistantMessageComponent, BashExecutionComponent, BorderedLoader, BranchSummaryMessageComponent, CompactionSummaryMessageComponent, CustomEditor, CustomMessageComponent, DynamicBorder, ExtensionEditorComponent, ExtensionInputComponent, ExtensionSelectorComponent, FooterComponent, LoginDialogComponent, ModelSelectorComponent, OAuthSelectorComponent, SessionSelectorComponent, SettingsSelectorComponent, ShowImagesSelectorComponent, SkillInvocationMessageComponent, ThemeSelectorComponent, ThinkingSelectorComponent, ToolExecutionComponent, TreeSelectorComponent, UserMessageComponent, UserMessageSelectorComponent, appKey, appKeyHint, editorKey, keyHint, rawKeyHint, renderDiff, truncateToVisualLines } from './modes/interactive/components/index.js';
|
|
36
|
+
// Theme core
|
|
37
|
+
export { Theme, initTheme } from './core/theme.js';
|
|
38
|
+
// Theme TUI utilities for custom tools and extensions
|
|
39
|
+
export { getLanguageFromPath, getMarkdownTheme, getSelectListTheme, getSettingsListTheme, highlightCode } from './modes/interactive/theme/theme.js';
|
|
40
|
+
// Clipboard utilities
|
|
41
|
+
export { copyToClipboard } from './utils/clipboard.js';
|
|
42
|
+
export { parseFrontmatter, stripFrontmatter } from './utils/frontmatter.js';
|
|
43
|
+
// Shell utilities
|
|
44
|
+
export { getShellConfig, resetShellConfig } from './utils/shell.js';
|
|
45
|
+
//# sourceMappingURL=index.js.map
|