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,362 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitLab Duo Provider Extension
|
|
3
|
+
*
|
|
4
|
+
* Provides access to GitLab Duo AI models (Claude and GPT) through GitLab's AI Gateway.
|
|
5
|
+
* Delegates to shortcutxl's built-in Anthropic and OpenAI streaming implementations.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* shortcut -e ./packages/coding-agent/examples/extensions/custom-provider-gitlab-duo
|
|
9
|
+
* # Then /login gitlab-duo, or set GITLAB_TOKEN=glpat-...
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { ExtensionAPI } from 'shortcutxl';
|
|
13
|
+
import {
|
|
14
|
+
type Api,
|
|
15
|
+
type AssistantMessageEventStream,
|
|
16
|
+
type Context,
|
|
17
|
+
createAssistantMessageEventStream,
|
|
18
|
+
type Model,
|
|
19
|
+
type OAuthCredentials,
|
|
20
|
+
type OAuthLoginCallbacks,
|
|
21
|
+
type SimpleStreamOptions,
|
|
22
|
+
streamSimpleAnthropic,
|
|
23
|
+
streamSimpleOpenAIResponses
|
|
24
|
+
} from 'shortcutxl';
|
|
25
|
+
|
|
26
|
+
// =============================================================================
|
|
27
|
+
// Constants
|
|
28
|
+
// =============================================================================
|
|
29
|
+
|
|
30
|
+
const GITLAB_COM_URL = 'https://gitlab.com';
|
|
31
|
+
const AI_GATEWAY_URL = 'https://cloud.gitlab.com';
|
|
32
|
+
const ANTHROPIC_PROXY_URL = `${AI_GATEWAY_URL}/ai/v1/proxy/anthropic/`;
|
|
33
|
+
const OPENAI_PROXY_URL = `${AI_GATEWAY_URL}/ai/v1/proxy/openai/v1`;
|
|
34
|
+
|
|
35
|
+
const BUNDLED_CLIENT_ID = 'da4edff2e6ebd2bc3208611e2768bc1c1dd7be791dc5ff26ca34ca9ee44f7d4b';
|
|
36
|
+
const OAUTH_SCOPES = ['.shortcut'];
|
|
37
|
+
const REDIRECT_URI = 'http://127.0.0.1:8080/callback';
|
|
38
|
+
const DIRECT_ACCESS_TTL = 25 * 60 * 1000;
|
|
39
|
+
|
|
40
|
+
// =============================================================================
|
|
41
|
+
// Models - exported for use by tests
|
|
42
|
+
// =============================================================================
|
|
43
|
+
|
|
44
|
+
type Backend = 'anthropic' | 'openai';
|
|
45
|
+
|
|
46
|
+
interface GitLabModel {
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
backend: Backend;
|
|
50
|
+
baseUrl: string;
|
|
51
|
+
reasoning: boolean;
|
|
52
|
+
input: ('text' | 'image')[];
|
|
53
|
+
cost: { input: number; output: number; cacheRead: number; cacheWrite: number };
|
|
54
|
+
contextWindow: number;
|
|
55
|
+
maxTokens: number;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const MODELS: GitLabModel[] = [
|
|
59
|
+
// Anthropic
|
|
60
|
+
{
|
|
61
|
+
id: 'claude-opus-4-5-20251101',
|
|
62
|
+
name: 'Claude Opus 4.5',
|
|
63
|
+
backend: 'anthropic',
|
|
64
|
+
baseUrl: ANTHROPIC_PROXY_URL,
|
|
65
|
+
reasoning: true,
|
|
66
|
+
input: ['text', 'image'],
|
|
67
|
+
cost: { input: 15, output: 75, cacheRead: 1.5, cacheWrite: 18.75 },
|
|
68
|
+
contextWindow: 200000,
|
|
69
|
+
maxTokens: 32000
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'claude-sonnet-4-5-20250929',
|
|
73
|
+
name: 'Claude Sonnet 4.5',
|
|
74
|
+
backend: 'anthropic',
|
|
75
|
+
baseUrl: ANTHROPIC_PROXY_URL,
|
|
76
|
+
reasoning: true,
|
|
77
|
+
input: ['text', 'image'],
|
|
78
|
+
cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 },
|
|
79
|
+
contextWindow: 200000,
|
|
80
|
+
maxTokens: 16384
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: 'claude-haiku-4-5-20251001',
|
|
84
|
+
name: 'Claude Haiku 4.5',
|
|
85
|
+
backend: 'anthropic',
|
|
86
|
+
baseUrl: ANTHROPIC_PROXY_URL,
|
|
87
|
+
reasoning: true,
|
|
88
|
+
input: ['text', 'image'],
|
|
89
|
+
cost: { input: 1, output: 5, cacheRead: 0.1, cacheWrite: 1.25 },
|
|
90
|
+
contextWindow: 200000,
|
|
91
|
+
maxTokens: 8192
|
|
92
|
+
},
|
|
93
|
+
// OpenAI (all use Responses API)
|
|
94
|
+
{
|
|
95
|
+
id: 'gpt-5.1-2025-11-13',
|
|
96
|
+
name: 'GPT-5.1',
|
|
97
|
+
backend: 'openai',
|
|
98
|
+
baseUrl: OPENAI_PROXY_URL,
|
|
99
|
+
reasoning: true,
|
|
100
|
+
input: ['text', 'image'],
|
|
101
|
+
cost: { input: 2.5, output: 10, cacheRead: 0, cacheWrite: 0 },
|
|
102
|
+
contextWindow: 128000,
|
|
103
|
+
maxTokens: 16384
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: 'gpt-5-mini-2025-08-07',
|
|
107
|
+
name: 'GPT-5 Mini',
|
|
108
|
+
backend: 'openai',
|
|
109
|
+
baseUrl: OPENAI_PROXY_URL,
|
|
110
|
+
reasoning: true,
|
|
111
|
+
input: ['text', 'image'],
|
|
112
|
+
cost: { input: 0.15, output: 0.6, cacheRead: 0, cacheWrite: 0 },
|
|
113
|
+
contextWindow: 128000,
|
|
114
|
+
maxTokens: 16384
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: 'gpt-5-codex',
|
|
118
|
+
name: 'GPT-5 Codex',
|
|
119
|
+
backend: 'openai',
|
|
120
|
+
baseUrl: OPENAI_PROXY_URL,
|
|
121
|
+
reasoning: true,
|
|
122
|
+
input: ['text', 'image'],
|
|
123
|
+
cost: { input: 2.5, output: 10, cacheRead: 0, cacheWrite: 0 },
|
|
124
|
+
contextWindow: 128000,
|
|
125
|
+
maxTokens: 16384
|
|
126
|
+
}
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
const MODEL_MAP = new Map(MODELS.map((m) => [m.id, m]));
|
|
130
|
+
|
|
131
|
+
// =============================================================================
|
|
132
|
+
// Direct Access Token Cache
|
|
133
|
+
// =============================================================================
|
|
134
|
+
|
|
135
|
+
interface DirectAccessToken {
|
|
136
|
+
token: string;
|
|
137
|
+
headers: Record<string, string>;
|
|
138
|
+
expiresAt: number;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
let cachedDirectAccess: DirectAccessToken | null = null;
|
|
142
|
+
|
|
143
|
+
async function getDirectAccessToken(gitlabAccessToken: string): Promise<DirectAccessToken> {
|
|
144
|
+
const now = Date.now();
|
|
145
|
+
if (cachedDirectAccess && cachedDirectAccess.expiresAt > now) {
|
|
146
|
+
return cachedDirectAccess;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const response = await fetch(`${GITLAB_COM_URL}/api/v4/ai/third_party_agents/direct_access`, {
|
|
150
|
+
method: 'POST',
|
|
151
|
+
headers: { Authorization: `Bearer ${gitlabAccessToken}`, 'Content-Type': 'application/json' },
|
|
152
|
+
body: JSON.stringify({ feature_flags: { DuoAgentPlatformNext: true } })
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
if (!response.ok) {
|
|
156
|
+
const errorText = await response.text();
|
|
157
|
+
if (response.status === 403) {
|
|
158
|
+
throw new Error(
|
|
159
|
+
`GitLab Duo access denied. Ensure GitLab Duo is enabled for your account. Error: ${errorText}`
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
throw new Error(`Failed to get direct access token: ${response.status} ${errorText}`);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const data = (await response.json()) as { token: string; headers: Record<string, string> };
|
|
166
|
+
cachedDirectAccess = {
|
|
167
|
+
token: data.token,
|
|
168
|
+
headers: data.headers,
|
|
169
|
+
expiresAt: now + DIRECT_ACCESS_TTL
|
|
170
|
+
};
|
|
171
|
+
return cachedDirectAccess;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function invalidateDirectAccessToken() {
|
|
175
|
+
cachedDirectAccess = null;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// =============================================================================
|
|
179
|
+
// OAuth
|
|
180
|
+
// =============================================================================
|
|
181
|
+
|
|
182
|
+
async function generatePKCE(): Promise<{ verifier: string; challenge: string }> {
|
|
183
|
+
const array = new Uint8Array(32);
|
|
184
|
+
crypto.getRandomValues(array);
|
|
185
|
+
const verifier = btoa(String.fromCharCode(...array))
|
|
186
|
+
.replace(/\+/g, '-')
|
|
187
|
+
.replace(/\//g, '_')
|
|
188
|
+
.replace(/=+$/, '');
|
|
189
|
+
const hash = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(verifier));
|
|
190
|
+
const challenge = btoa(String.fromCharCode(...new Uint8Array(hash)))
|
|
191
|
+
.replace(/\+/g, '-')
|
|
192
|
+
.replace(/\//g, '_')
|
|
193
|
+
.replace(/=+$/, '');
|
|
194
|
+
return { verifier, challenge };
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async function loginGitLab(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials> {
|
|
198
|
+
const { verifier, challenge } = await generatePKCE();
|
|
199
|
+
const authParams = new URLSearchParams({
|
|
200
|
+
client_id: BUNDLED_CLIENT_ID,
|
|
201
|
+
redirect_uri: REDIRECT_URI,
|
|
202
|
+
response_type: 'code',
|
|
203
|
+
scope: OAUTH_SCOPES.join(' '),
|
|
204
|
+
code_challenge: challenge,
|
|
205
|
+
code_challenge_method: 'S256',
|
|
206
|
+
state: crypto.randomUUID()
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
callbacks.onAuth({ url: `${GITLAB_COM_URL}/oauth/authorize?${authParams.toString()}` });
|
|
210
|
+
const callbackUrl = await callbacks.onPrompt({ message: 'Paste the callback URL:' });
|
|
211
|
+
const code = new URL(callbackUrl).searchParams.get('code');
|
|
212
|
+
if (!code) throw new Error('No authorization code found in callback URL');
|
|
213
|
+
|
|
214
|
+
const tokenResponse = await fetch(`${GITLAB_COM_URL}/oauth/token`, {
|
|
215
|
+
method: 'POST',
|
|
216
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
217
|
+
body: new URLSearchParams({
|
|
218
|
+
client_id: BUNDLED_CLIENT_ID,
|
|
219
|
+
grant_type: 'authorization_code',
|
|
220
|
+
code,
|
|
221
|
+
code_verifier: verifier,
|
|
222
|
+
redirect_uri: REDIRECT_URI
|
|
223
|
+
}).toString()
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
if (!tokenResponse.ok) throw new Error(`Token exchange failed: ${await tokenResponse.text()}`);
|
|
227
|
+
const data = (await tokenResponse.json()) as {
|
|
228
|
+
access_token: string;
|
|
229
|
+
refresh_token: string;
|
|
230
|
+
expires_in: number;
|
|
231
|
+
created_at: number;
|
|
232
|
+
};
|
|
233
|
+
invalidateDirectAccessToken();
|
|
234
|
+
return {
|
|
235
|
+
refresh: data.refresh_token,
|
|
236
|
+
access: data.access_token,
|
|
237
|
+
expires: (data.created_at + data.expires_in) * 1000 - 5 * 60 * 1000
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
async function refreshGitLabToken(credentials: OAuthCredentials): Promise<OAuthCredentials> {
|
|
242
|
+
const response = await fetch(`${GITLAB_COM_URL}/oauth/token`, {
|
|
243
|
+
method: 'POST',
|
|
244
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
245
|
+
body: new URLSearchParams({
|
|
246
|
+
client_id: BUNDLED_CLIENT_ID,
|
|
247
|
+
grant_type: 'refresh_token',
|
|
248
|
+
refresh_token: credentials.refresh
|
|
249
|
+
}).toString()
|
|
250
|
+
});
|
|
251
|
+
if (!response.ok) throw new Error(`Token refresh failed: ${await response.text()}`);
|
|
252
|
+
const data = (await response.json()) as {
|
|
253
|
+
access_token: string;
|
|
254
|
+
refresh_token: string;
|
|
255
|
+
expires_in: number;
|
|
256
|
+
created_at: number;
|
|
257
|
+
};
|
|
258
|
+
invalidateDirectAccessToken();
|
|
259
|
+
return {
|
|
260
|
+
refresh: data.refresh_token,
|
|
261
|
+
access: data.access_token,
|
|
262
|
+
expires: (data.created_at + data.expires_in) * 1000 - 5 * 60 * 1000
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// =============================================================================
|
|
267
|
+
// Stream Function
|
|
268
|
+
// =============================================================================
|
|
269
|
+
|
|
270
|
+
export function streamGitLabDuo(
|
|
271
|
+
model: Model<Api>,
|
|
272
|
+
context: Context,
|
|
273
|
+
options?: SimpleStreamOptions
|
|
274
|
+
): AssistantMessageEventStream {
|
|
275
|
+
const stream = createAssistantMessageEventStream();
|
|
276
|
+
|
|
277
|
+
(async () => {
|
|
278
|
+
try {
|
|
279
|
+
const gitlabAccessToken = options?.apiKey;
|
|
280
|
+
if (!gitlabAccessToken)
|
|
281
|
+
throw new Error('No GitLab access token. Run /login gitlab-duo or set GITLAB_TOKEN');
|
|
282
|
+
|
|
283
|
+
const cfg = MODEL_MAP.get(model.id);
|
|
284
|
+
if (!cfg) throw new Error(`Unknown model: ${model.id}`);
|
|
285
|
+
|
|
286
|
+
const directAccess = await getDirectAccessToken(gitlabAccessToken);
|
|
287
|
+
const modelWithBaseUrl = { ...model, baseUrl: cfg.baseUrl };
|
|
288
|
+
const headers = { ...directAccess.headers, Authorization: `Bearer ${directAccess.token}` };
|
|
289
|
+
const streamOptions = { ...options, apiKey: 'gitlab-duo', headers };
|
|
290
|
+
|
|
291
|
+
const innerStream =
|
|
292
|
+
cfg.backend === 'anthropic'
|
|
293
|
+
? streamSimpleAnthropic(
|
|
294
|
+
modelWithBaseUrl as Model<'anthropic-messages'>,
|
|
295
|
+
context,
|
|
296
|
+
streamOptions
|
|
297
|
+
)
|
|
298
|
+
: streamSimpleOpenAIResponses(
|
|
299
|
+
modelWithBaseUrl as Model<'openai-responses'>,
|
|
300
|
+
context,
|
|
301
|
+
streamOptions
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
for await (const event of innerStream) stream.push(event);
|
|
305
|
+
stream.end();
|
|
306
|
+
} catch (error) {
|
|
307
|
+
stream.push({
|
|
308
|
+
type: 'error',
|
|
309
|
+
reason: 'error',
|
|
310
|
+
error: {
|
|
311
|
+
role: 'assistant',
|
|
312
|
+
content: [],
|
|
313
|
+
api: model.api,
|
|
314
|
+
provider: model.provider,
|
|
315
|
+
model: model.id,
|
|
316
|
+
usage: {
|
|
317
|
+
input: 0,
|
|
318
|
+
output: 0,
|
|
319
|
+
cacheRead: 0,
|
|
320
|
+
cacheWrite: 0,
|
|
321
|
+
totalTokens: 0,
|
|
322
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
|
|
323
|
+
},
|
|
324
|
+
stopReason: 'error',
|
|
325
|
+
errorMessage: error instanceof Error ? error.message : String(error),
|
|
326
|
+
timestamp: Date.now()
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
stream.end();
|
|
330
|
+
}
|
|
331
|
+
})();
|
|
332
|
+
|
|
333
|
+
return stream;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// =============================================================================
|
|
337
|
+
// Extension Entry Point
|
|
338
|
+
// =============================================================================
|
|
339
|
+
|
|
340
|
+
export default function (shortcut: ExtensionAPI) {
|
|
341
|
+
shortcut.registerProvider('gitlab-duo', {
|
|
342
|
+
baseUrl: AI_GATEWAY_URL,
|
|
343
|
+
apiKey: 'GITLAB_TOKEN',
|
|
344
|
+
api: 'gitlab-duo-api',
|
|
345
|
+
models: MODELS.map(({ id, name, reasoning, input, cost, contextWindow, maxTokens }) => ({
|
|
346
|
+
id,
|
|
347
|
+
name,
|
|
348
|
+
reasoning,
|
|
349
|
+
input,
|
|
350
|
+
cost,
|
|
351
|
+
contextWindow,
|
|
352
|
+
maxTokens
|
|
353
|
+
})),
|
|
354
|
+
oauth: {
|
|
355
|
+
name: 'GitLab Duo',
|
|
356
|
+
login: loginGitLab,
|
|
357
|
+
refreshToken: refreshGitLabToken,
|
|
358
|
+
getApiKey: (cred) => cred.access
|
|
359
|
+
},
|
|
360
|
+
streamSimple: streamGitLabDuo
|
|
361
|
+
});
|
|
362
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pi-extension-custom-provider-gitlab-duo",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "1.6.4",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"clean": "echo 'nothing to clean'",
|
|
8
|
+
"build": "echo 'nothing to build'",
|
|
9
|
+
"check": "echo 'nothing to check'"
|
|
10
|
+
},
|
|
11
|
+
"pi": {
|
|
12
|
+
"extensions": [
|
|
13
|
+
"./index.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test script for GitLab Duo extension
|
|
3
|
+
* Run: npx tsx test.ts [model-id] [--thinking]
|
|
4
|
+
*
|
|
5
|
+
* Examples:
|
|
6
|
+
* npx tsx test.ts # Test default (claude-sonnet-4-5-20250929)
|
|
7
|
+
* npx tsx test.ts gpt-5-codex # Test GPT-5 Codex
|
|
8
|
+
* npx tsx test.ts claude-sonnet-4-5-20250929 --thinking
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { readFileSync } from 'fs';
|
|
12
|
+
import { homedir } from 'os';
|
|
13
|
+
import { join } from 'path';
|
|
14
|
+
import {
|
|
15
|
+
type Api,
|
|
16
|
+
type Context,
|
|
17
|
+
type Model,
|
|
18
|
+
registerApiProvider,
|
|
19
|
+
streamSimple
|
|
20
|
+
} from 'shortcutxl';
|
|
21
|
+
import { MODELS, streamGitLabDuo } from './index.js';
|
|
22
|
+
|
|
23
|
+
const MODEL_MAP = new Map(MODELS.map((m) => [m.id, m]));
|
|
24
|
+
|
|
25
|
+
async function main() {
|
|
26
|
+
const modelId = process.argv[2] || 'claude-sonnet-4-5-20250929';
|
|
27
|
+
const useThinking = process.argv.includes('--thinking');
|
|
28
|
+
|
|
29
|
+
const cfg = MODEL_MAP.get(modelId);
|
|
30
|
+
if (!cfg) {
|
|
31
|
+
console.error(`Unknown model: ${modelId}`);
|
|
32
|
+
console.error('Available:', MODELS.map((m) => m.id).join(', '));
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Read auth
|
|
37
|
+
const authPath = join(homedir(), '.shortcut', 'agent', 'auth.json');
|
|
38
|
+
const authData = JSON.parse(readFileSync(authPath, 'utf-8'));
|
|
39
|
+
const gitlabCred = authData['gitlab-duo'];
|
|
40
|
+
if (!gitlabCred?.access) {
|
|
41
|
+
console.error('No gitlab-duo credentials. Run /login gitlab-duo first.');
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Register provider
|
|
46
|
+
registerApiProvider({
|
|
47
|
+
api: 'gitlab-duo-api' as Api,
|
|
48
|
+
stream: streamGitLabDuo,
|
|
49
|
+
streamSimple: streamGitLabDuo
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Create model
|
|
53
|
+
const model: Model<Api> = {
|
|
54
|
+
id: cfg.id,
|
|
55
|
+
name: cfg.name,
|
|
56
|
+
api: 'gitlab-duo-api' as Api,
|
|
57
|
+
provider: 'gitlab-duo',
|
|
58
|
+
baseUrl: cfg.baseUrl,
|
|
59
|
+
reasoning: cfg.reasoning,
|
|
60
|
+
input: cfg.input,
|
|
61
|
+
cost: cfg.cost,
|
|
62
|
+
contextWindow: cfg.contextWindow,
|
|
63
|
+
maxTokens: cfg.maxTokens
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const context: Context = {
|
|
67
|
+
messages: [{ role: 'user', content: 'Say hello in exactly 3 words.', timestamp: Date.now() }]
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
console.log(`Model: ${model.id}, Backend: ${cfg.backend}, Thinking: ${useThinking}`);
|
|
71
|
+
|
|
72
|
+
const stream = streamSimple(model, context, {
|
|
73
|
+
apiKey: gitlabCred.access,
|
|
74
|
+
maxTokens: 100,
|
|
75
|
+
reasoning: useThinking ? 'low' : undefined
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
for await (const event of stream) {
|
|
79
|
+
if (event.type === 'thinking_start') console.log('[Thinking]');
|
|
80
|
+
else if (event.type === 'thinking_delta') process.stdout.write(event.delta);
|
|
81
|
+
else if (event.type === 'thinking_end') console.log('\n[/Thinking]\n');
|
|
82
|
+
else if (event.type === 'text_delta') process.stdout.write(event.delta);
|
|
83
|
+
else if (event.type === 'error') console.error('\nError:', event.error.errorMessage);
|
|
84
|
+
else if (event.type === 'done') console.log('\n\nDone!', event.reason, event.message.usage);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
main().catch(console.error);
|