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.
Files changed (423) hide show
  1. package/README.md +59 -0
  2. package/agent-docs/README.md +397 -0
  3. package/agent-docs/docs/compaction.md +390 -0
  4. package/agent-docs/docs/custom-provider.md +580 -0
  5. package/agent-docs/docs/development.md +69 -0
  6. package/agent-docs/docs/extensions.md +1971 -0
  7. package/agent-docs/docs/json.md +79 -0
  8. package/agent-docs/docs/keybindings.md +174 -0
  9. package/agent-docs/docs/models.md +293 -0
  10. package/agent-docs/docs/packages.md +209 -0
  11. package/agent-docs/docs/prompt-templates.md +67 -0
  12. package/agent-docs/docs/providers.md +186 -0
  13. package/agent-docs/docs/rpc.md +1317 -0
  14. package/agent-docs/docs/sdk.md +962 -0
  15. package/agent-docs/docs/session.md +412 -0
  16. package/agent-docs/docs/settings.md +223 -0
  17. package/agent-docs/docs/shell-aliases.md +13 -0
  18. package/agent-docs/docs/skills.md +231 -0
  19. package/agent-docs/docs/terminal-setup.md +70 -0
  20. package/agent-docs/docs/termux.md +127 -0
  21. package/agent-docs/docs/themes.md +295 -0
  22. package/agent-docs/docs/tree.md +219 -0
  23. package/agent-docs/docs/tui.md +887 -0
  24. package/agent-docs/docs/windows.md +17 -0
  25. package/agent-docs/examples/README.md +25 -0
  26. package/agent-docs/examples/extensions/README.md +205 -0
  27. package/agent-docs/examples/extensions/antigravity-image-gen.ts +447 -0
  28. package/agent-docs/examples/extensions/auto-commit-on-exit.ts +49 -0
  29. package/agent-docs/examples/extensions/bash-spawn-hook.ts +30 -0
  30. package/agent-docs/examples/extensions/bookmark.ts +50 -0
  31. package/agent-docs/examples/extensions/built-in-tool-renderer.ts +256 -0
  32. package/agent-docs/examples/extensions/claude-rules.ts +86 -0
  33. package/agent-docs/examples/extensions/commands.ts +75 -0
  34. package/agent-docs/examples/extensions/confirm-destructive.ts +59 -0
  35. package/agent-docs/examples/extensions/custom-compaction.ts +126 -0
  36. package/agent-docs/examples/extensions/custom-footer.ts +63 -0
  37. package/agent-docs/examples/extensions/custom-header.ts +73 -0
  38. package/agent-docs/examples/extensions/custom-provider-anthropic/index.ts +660 -0
  39. package/agent-docs/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  40. package/agent-docs/examples/extensions/custom-provider-anthropic/package.json +19 -0
  41. package/agent-docs/examples/extensions/custom-provider-gitlab-duo/index.ts +362 -0
  42. package/agent-docs/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  43. package/agent-docs/examples/extensions/custom-provider-gitlab-duo/test.ts +88 -0
  44. package/agent-docs/examples/extensions/custom-provider-qwen-cli/index.ts +349 -0
  45. package/agent-docs/examples/extensions/custom-provider-qwen-cli/package.json +16 -0
  46. package/agent-docs/examples/extensions/dirty-repo-guard.ts +56 -0
  47. package/agent-docs/examples/extensions/doom-overlay/README.md +46 -0
  48. package/agent-docs/examples/extensions/doom-overlay/doom/build.sh +152 -0
  49. package/agent-docs/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  50. package/agent-docs/examples/extensions/doom-overlay/doom-component.ts +133 -0
  51. package/agent-docs/examples/extensions/doom-overlay/doom-engine.ts +186 -0
  52. package/agent-docs/examples/extensions/doom-overlay/doom-keys.ts +108 -0
  53. package/agent-docs/examples/extensions/doom-overlay/index.ts +74 -0
  54. package/agent-docs/examples/extensions/doom-overlay/wad-finder.ts +51 -0
  55. package/agent-docs/examples/extensions/dynamic-resources/SKILL.md +8 -0
  56. package/agent-docs/examples/extensions/dynamic-resources/dynamic.json +79 -0
  57. package/agent-docs/examples/extensions/dynamic-resources/dynamic.md +5 -0
  58. package/agent-docs/examples/extensions/dynamic-resources/index.ts +15 -0
  59. package/agent-docs/examples/extensions/dynamic-tools.ts +77 -0
  60. package/agent-docs/examples/extensions/event-bus.ts +43 -0
  61. package/agent-docs/examples/extensions/file-trigger.ts +41 -0
  62. package/agent-docs/examples/extensions/git-checkpoint.ts +53 -0
  63. package/agent-docs/examples/extensions/handoff.ts +155 -0
  64. package/agent-docs/examples/extensions/hello.ts +25 -0
  65. package/agent-docs/examples/extensions/inline-bash.ts +94 -0
  66. package/agent-docs/examples/extensions/input-transform.ts +43 -0
  67. package/agent-docs/examples/extensions/interactive-shell.ts +209 -0
  68. package/agent-docs/examples/extensions/mac-system-theme.ts +47 -0
  69. package/agent-docs/examples/extensions/message-renderer.ts +59 -0
  70. package/agent-docs/examples/extensions/minimal-mode.ts +430 -0
  71. package/agent-docs/examples/extensions/modal-editor.ts +90 -0
  72. package/agent-docs/examples/extensions/model-status.ts +31 -0
  73. package/agent-docs/examples/extensions/notify.ts +55 -0
  74. package/agent-docs/examples/extensions/overlay-qa-tests.ts +936 -0
  75. package/agent-docs/examples/extensions/overlay-test.ts +159 -0
  76. package/agent-docs/examples/extensions/permission-gate.ts +37 -0
  77. package/agent-docs/examples/extensions/pirate.ts +47 -0
  78. package/agent-docs/examples/extensions/plan-mode/README.md +65 -0
  79. package/agent-docs/examples/extensions/plan-mode/index.ts +363 -0
  80. package/agent-docs/examples/extensions/plan-mode/utils.ts +173 -0
  81. package/agent-docs/examples/extensions/preset.ts +418 -0
  82. package/agent-docs/examples/extensions/protected-paths.ts +30 -0
  83. package/agent-docs/examples/extensions/qna.ts +122 -0
  84. package/agent-docs/examples/extensions/question.ts +278 -0
  85. package/agent-docs/examples/extensions/questionnaire.ts +440 -0
  86. package/agent-docs/examples/extensions/rainbow-editor.ts +90 -0
  87. package/agent-docs/examples/extensions/reload-runtime.ts +37 -0
  88. package/agent-docs/examples/extensions/rpc-demo.ts +124 -0
  89. package/agent-docs/examples/extensions/sandbox/index.ts +324 -0
  90. package/agent-docs/examples/extensions/sandbox/package-lock.json +92 -0
  91. package/agent-docs/examples/extensions/sandbox/package.json +19 -0
  92. package/agent-docs/examples/extensions/send-user-message.ts +97 -0
  93. package/agent-docs/examples/extensions/session-name.ts +27 -0
  94. package/agent-docs/examples/extensions/shutdown-command.ts +69 -0
  95. package/agent-docs/examples/extensions/snake.ts +343 -0
  96. package/agent-docs/examples/extensions/space-invaders.ts +566 -0
  97. package/agent-docs/examples/extensions/ssh.ts +233 -0
  98. package/agent-docs/examples/extensions/status-line.ts +40 -0
  99. package/agent-docs/examples/extensions/subagent/README.md +172 -0
  100. package/agent-docs/examples/extensions/subagent/agents/planner.md +37 -0
  101. package/agent-docs/examples/extensions/subagent/agents/reviewer.md +35 -0
  102. package/agent-docs/examples/extensions/subagent/agents/scout.md +50 -0
  103. package/agent-docs/examples/extensions/subagent/agents/worker.md +24 -0
  104. package/agent-docs/examples/extensions/subagent/agents.ts +130 -0
  105. package/agent-docs/examples/extensions/subagent/index.ts +1068 -0
  106. package/agent-docs/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  107. package/agent-docs/examples/extensions/subagent/prompts/implement.md +10 -0
  108. package/agent-docs/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  109. package/agent-docs/examples/extensions/summarize.ts +206 -0
  110. package/agent-docs/examples/extensions/system-prompt-header.ts +17 -0
  111. package/agent-docs/examples/extensions/timed-confirm.ts +72 -0
  112. package/agent-docs/examples/extensions/titlebar-spinner.ts +58 -0
  113. package/agent-docs/examples/extensions/todo.ts +314 -0
  114. package/agent-docs/examples/extensions/tool-override.ts +146 -0
  115. package/agent-docs/examples/extensions/tools.ts +145 -0
  116. package/agent-docs/examples/extensions/trigger-compact.ts +40 -0
  117. package/agent-docs/examples/extensions/truncated-tool.ts +194 -0
  118. package/agent-docs/examples/extensions/widget-placement.ts +17 -0
  119. package/agent-docs/examples/extensions/with-deps/index.ts +37 -0
  120. package/agent-docs/examples/extensions/with-deps/package-lock.json +31 -0
  121. package/agent-docs/examples/extensions/with-deps/package.json +22 -0
  122. package/agent-docs/examples/rpc-extension-ui.ts +654 -0
  123. package/agent-docs/examples/sdk/01-minimal.ts +22 -0
  124. package/agent-docs/examples/sdk/02-custom-model.ts +48 -0
  125. package/agent-docs/examples/sdk/03-custom-prompt.ts +55 -0
  126. package/agent-docs/examples/sdk/04-skills.ts +53 -0
  127. package/agent-docs/examples/sdk/05-tools.ts +56 -0
  128. package/agent-docs/examples/sdk/06-extensions.ts +88 -0
  129. package/agent-docs/examples/sdk/07-context-files.ts +40 -0
  130. package/agent-docs/examples/sdk/08-prompt-templates.ts +47 -0
  131. package/agent-docs/examples/sdk/09-api-keys-and-oauth.ts +48 -0
  132. package/agent-docs/examples/sdk/10-settings.ts +54 -0
  133. package/agent-docs/examples/sdk/11-sessions.ts +48 -0
  134. package/agent-docs/examples/sdk/12-full-control.ts +82 -0
  135. package/agent-docs/examples/sdk/README.md +144 -0
  136. package/agent-docs/xll-skill.md +61 -0
  137. package/agent-docs/xll-spec.md +110 -0
  138. package/dist/cli/args.js +290 -0
  139. package/dist/cli/config-selector.js +31 -0
  140. package/dist/cli/file-processor.js +79 -0
  141. package/dist/cli/list-models.js +92 -0
  142. package/dist/cli/package-commands.js +210 -0
  143. package/dist/cli/report-settings-errors.js +11 -0
  144. package/dist/cli/session-picker.js +34 -0
  145. package/dist/cli.js +19 -0
  146. package/dist/config.js +288 -0
  147. package/dist/core/abort.js +15 -0
  148. package/dist/core/agent-loop.js +352 -0
  149. package/dist/core/agent-session.js +2019 -0
  150. package/dist/core/agent.js +410 -0
  151. package/dist/core/auth-storage.js +456 -0
  152. package/dist/core/bash-executor.js +222 -0
  153. package/dist/core/compaction/branch-summarization.js +242 -0
  154. package/dist/core/compaction/compaction.js +610 -0
  155. package/dist/core/compaction/index.js +7 -0
  156. package/dist/core/compaction/utils.js +139 -0
  157. package/dist/core/defaults.js +6 -0
  158. package/dist/core/diagnostics.js +2 -0
  159. package/dist/core/event-bus.js +25 -0
  160. package/dist/core/exec.js +71 -0
  161. package/dist/core/export-html/ansi-to-html.js +256 -0
  162. package/dist/core/export-html/index.js +238 -0
  163. package/dist/core/export-html/session-view-model.js +342 -0
  164. package/dist/core/export-html/template.css +1110 -0
  165. package/dist/core/export-html/template.html +76 -0
  166. package/dist/core/export-html/template.js +1990 -0
  167. package/dist/core/export-html/tool-renderer.js +63 -0
  168. package/dist/core/export-html/vendor/highlight.min.js +7725 -0
  169. package/dist/core/export-html/vendor/marked.min.js +1803 -0
  170. package/dist/core/extensions/index.js +9 -0
  171. package/dist/core/extensions/loader.js +422 -0
  172. package/dist/core/extensions/runner.js +651 -0
  173. package/dist/core/extensions/types.js +35 -0
  174. package/dist/core/extensions/wrapper.js +102 -0
  175. package/dist/core/footer-data-provider.js +162 -0
  176. package/dist/core/index.js +9 -0
  177. package/dist/core/keybindings.js +153 -0
  178. package/dist/core/messages.js +133 -0
  179. package/dist/core/model-registry.js +539 -0
  180. package/dist/core/model-resolver.js +370 -0
  181. package/dist/core/package-manager.js +1485 -0
  182. package/dist/core/prompt-templates.js +253 -0
  183. package/dist/core/resolve-config-value.js +59 -0
  184. package/dist/core/resource-loader.js +700 -0
  185. package/dist/core/sdk.js +197 -0
  186. package/dist/core/session-bash.js +99 -0
  187. package/dist/core/session-compaction.js +165 -0
  188. package/dist/core/session-manager.js +1153 -0
  189. package/dist/core/session-models.js +99 -0
  190. package/dist/core/session-retry.js +155 -0
  191. package/dist/core/settings-manager.js +572 -0
  192. package/dist/core/skills.js +382 -0
  193. package/dist/core/slash-commands.js +31 -0
  194. package/dist/core/system-prompt.js +161 -0
  195. package/dist/core/theme.js +770 -0
  196. package/dist/core/timings.js +26 -0
  197. package/dist/core/tools/bash.js +258 -0
  198. package/dist/core/tools/edit-diff.js +245 -0
  199. package/dist/core/tools/edit.js +148 -0
  200. package/dist/core/tools/find.js +208 -0
  201. package/dist/core/tools/grep.js +246 -0
  202. package/dist/core/tools/index.js +67 -0
  203. package/dist/core/tools/ls.js +123 -0
  204. package/dist/core/tools/path-utils.js +81 -0
  205. package/dist/core/tools/read.js +160 -0
  206. package/dist/core/tools/truncate.js +70 -0
  207. package/dist/core/tools/write.js +82 -0
  208. package/dist/custom/agents/action.js +13 -0
  209. package/dist/custom/agents/document-reader.js +70 -0
  210. package/dist/custom/agents/general.js +26 -0
  211. package/dist/custom/agents/index.js +49 -0
  212. package/dist/custom/agents/installation.js +13 -0
  213. package/dist/custom/agents/types.js +7 -0
  214. package/dist/custom/auth/refresh-timer.js +33 -0
  215. package/dist/custom/auth/shortcut-oauth.js +145 -0
  216. package/dist/custom/constants.js +21 -0
  217. package/dist/custom/context/workbook-summary.js +73 -0
  218. package/dist/custom/credits/shortcut-credits.js +29 -0
  219. package/dist/custom/cron/cron-daemon-entry.js +18 -0
  220. package/dist/custom/cron/daemon-ipc.js +131 -0
  221. package/dist/custom/cron/daemon.js +224 -0
  222. package/dist/custom/cron/jobs.js +226 -0
  223. package/dist/custom/cron/run-log.js +51 -0
  224. package/dist/custom/cron/schedule.js +72 -0
  225. package/dist/custom/cron/status-line.js +98 -0
  226. package/dist/custom/cron/store.js +87 -0
  227. package/dist/custom/cron/types.js +8 -0
  228. package/dist/custom/dev/index.js +59 -0
  229. package/dist/custom/dev/trace-export.js +58 -0
  230. package/dist/custom/ensure-excel.js +63 -0
  231. package/dist/custom/excel-config.js +36 -0
  232. package/dist/custom/preflight.js +422 -0
  233. package/dist/custom/prompts/action.js +100 -0
  234. package/dist/custom/prompts/api.js +66 -0
  235. package/dist/custom/prompts/installation.js +124 -0
  236. package/dist/custom/prompts/shared.js +138 -0
  237. package/dist/custom/providers/llm-usage.js +42 -0
  238. package/dist/custom/providers/message-converter.js +74 -0
  239. package/dist/custom/providers/provider-ids.js +9 -0
  240. package/dist/custom/providers/register-openai-codex-provider.js +27 -0
  241. package/dist/custom/providers/register-shortcut-provider.js +52 -0
  242. package/dist/custom/providers/shortcut-invoke.js +117 -0
  243. package/dist/custom/providers/shortcut-stream.js +252 -0
  244. package/dist/custom/providers/sse-protocol.js +38 -0
  245. package/dist/custom/sync-xll.js +130 -0
  246. package/dist/custom/tools/cron.js +413 -0
  247. package/dist/custom/tools/excel-exec.js +167 -0
  248. package/dist/custom/tools/excel-range.js +50 -0
  249. package/dist/custom/tools/llm-analysis.js +265 -0
  250. package/dist/custom/tools/render-helpers.js +38 -0
  251. package/dist/custom/tools/switch-mode.js +94 -0
  252. package/dist/custom/tools/task/agents.js +6 -0
  253. package/dist/custom/tools/task/index.js +8 -0
  254. package/dist/custom/tools/task/render.js +348 -0
  255. package/dist/custom/tools/task/subprocess.js +320 -0
  256. package/dist/custom/tools/task/task.js +205 -0
  257. package/dist/custom/tools/todo-list.js +195 -0
  258. package/dist/custom/tracing/session-upload.js +93 -0
  259. package/dist/index.js +45 -0
  260. package/dist/main.js +613 -0
  261. package/dist/migrations.js +265 -0
  262. package/dist/modes/index.js +8 -0
  263. package/dist/modes/interactive/components/armin.js +337 -0
  264. package/dist/modes/interactive/components/assistant-message.js +94 -0
  265. package/dist/modes/interactive/components/bash-execution.js +171 -0
  266. package/dist/modes/interactive/components/bordered-loader.js +51 -0
  267. package/dist/modes/interactive/components/branch-summary-message.js +45 -0
  268. package/dist/modes/interactive/components/compaction-summary-message.js +46 -0
  269. package/dist/modes/interactive/components/config-selector.js +488 -0
  270. package/dist/modes/interactive/components/countdown-timer.js +33 -0
  271. package/dist/modes/interactive/components/custom-editor.js +93 -0
  272. package/dist/modes/interactive/components/custom-message.js +81 -0
  273. package/dist/modes/interactive/components/daxnuts.js +140 -0
  274. package/dist/modes/interactive/components/diff.js +133 -0
  275. package/dist/modes/interactive/components/dynamic-border.js +21 -0
  276. package/dist/modes/interactive/components/extension-editor.js +105 -0
  277. package/dist/modes/interactive/components/extension-input.js +61 -0
  278. package/dist/modes/interactive/components/extension-selector.js +78 -0
  279. package/dist/modes/interactive/components/footer.js +309 -0
  280. package/dist/modes/interactive/components/index.js +33 -0
  281. package/dist/modes/interactive/components/keybinding-hints.js +61 -0
  282. package/dist/modes/interactive/components/layout.js +64 -0
  283. package/dist/modes/interactive/components/login-dialog.js +148 -0
  284. package/dist/modes/interactive/components/model-selector.js +237 -0
  285. package/dist/modes/interactive/components/oauth-selector.js +111 -0
  286. package/dist/modes/interactive/components/session-selector-search.js +157 -0
  287. package/dist/modes/interactive/components/session-selector.js +860 -0
  288. package/dist/modes/interactive/components/settings-selector.js +123 -0
  289. package/dist/modes/interactive/components/show-images-selector.js +35 -0
  290. package/dist/modes/interactive/components/skill-invocation-message.js +48 -0
  291. package/dist/modes/interactive/components/theme-selector.js +47 -0
  292. package/dist/modes/interactive/components/thinking-selector.js +47 -0
  293. package/dist/modes/interactive/components/tool-execution.js +789 -0
  294. package/dist/modes/interactive/components/tool-group.js +106 -0
  295. package/dist/modes/interactive/components/tree-selector.js +962 -0
  296. package/dist/modes/interactive/components/user-message-selector.js +115 -0
  297. package/dist/modes/interactive/components/user-message.js +48 -0
  298. package/dist/modes/interactive/components/visual-truncate.js +33 -0
  299. package/dist/modes/interactive/file-attachments.js +135 -0
  300. package/dist/modes/interactive/interactive-mode.js +3775 -0
  301. package/dist/modes/interactive/theme/dark.json +85 -0
  302. package/dist/modes/interactive/theme/light.json +85 -0
  303. package/dist/modes/interactive/theme/theme-schema.json +335 -0
  304. package/dist/modes/interactive/theme/theme.js +177 -0
  305. package/dist/modes/print-mode.js +101 -0
  306. package/dist/modes/rpc/rpc-client.js +387 -0
  307. package/dist/modes/rpc/rpc-mode.js +509 -0
  308. package/dist/modes/rpc/rpc-types.js +8 -0
  309. package/dist/subagent-entry.js +145 -0
  310. package/dist/tool-names.js +34 -0
  311. package/dist/tui/autocomplete.js +596 -0
  312. package/dist/tui/components/box.js +104 -0
  313. package/dist/tui/components/cancellable-loader.js +35 -0
  314. package/dist/tui/components/editor.js +1679 -0
  315. package/dist/tui/components/image.js +69 -0
  316. package/dist/tui/components/input.js +433 -0
  317. package/dist/tui/components/loader.js +49 -0
  318. package/dist/tui/components/markdown.js +629 -0
  319. package/dist/tui/components/select-list.js +152 -0
  320. package/dist/tui/components/settings-list.js +185 -0
  321. package/dist/tui/components/spacer.js +23 -0
  322. package/dist/tui/components/text.js +89 -0
  323. package/dist/tui/components/truncated-text.js +51 -0
  324. package/dist/tui/editor-component.js +2 -0
  325. package/dist/tui/fuzzy.js +107 -0
  326. package/dist/tui/get-east-asian-width/index.js +32 -0
  327. package/dist/tui/get-east-asian-width/lookup.js +404 -0
  328. package/dist/tui/index.js +32 -0
  329. package/dist/tui/keybindings.js +114 -0
  330. package/dist/tui/keys.js +959 -0
  331. package/dist/tui/kill-ring.js +44 -0
  332. package/dist/tui/stdin-buffer.js +317 -0
  333. package/dist/tui/terminal-image.js +288 -0
  334. package/dist/tui/terminal.js +249 -0
  335. package/dist/tui/tui/autocomplete.js +596 -0
  336. package/dist/tui/tui/components/box.js +106 -0
  337. package/dist/tui/tui/components/cancellable-loader.js +35 -0
  338. package/dist/tui/tui/components/editor.js +1679 -0
  339. package/dist/tui/tui/components/image.js +69 -0
  340. package/dist/tui/tui/components/input.js +433 -0
  341. package/dist/tui/tui/components/loader.js +49 -0
  342. package/dist/tui/tui/components/markdown.js +629 -0
  343. package/dist/tui/tui/components/select-list.js +152 -0
  344. package/dist/tui/tui/components/settings-list.js +185 -0
  345. package/dist/tui/tui/components/spacer.js +23 -0
  346. package/dist/tui/tui/components/text.js +91 -0
  347. package/dist/tui/tui/components/truncated-text.js +51 -0
  348. package/dist/tui/tui/editor-component.js +2 -0
  349. package/dist/tui/tui/fuzzy.js +107 -0
  350. package/dist/tui/tui/get-east-asian-width/index.js +32 -0
  351. package/dist/tui/tui/get-east-asian-width/lookup.js +404 -0
  352. package/dist/tui/tui/index.js +32 -0
  353. package/dist/tui/tui/keybindings.js +114 -0
  354. package/dist/tui/tui/keys.js +959 -0
  355. package/dist/tui/tui/kill-ring.js +44 -0
  356. package/dist/tui/tui/stdin-buffer.js +317 -0
  357. package/dist/tui/tui/terminal-image.js +288 -0
  358. package/dist/tui/tui/terminal.js +249 -0
  359. package/dist/tui/tui/tui.js +955 -0
  360. package/dist/tui/tui/undo-stack.js +25 -0
  361. package/dist/tui/tui/utils.js +800 -0
  362. package/dist/tui/tui.js +955 -0
  363. package/dist/tui/undo-stack.js +25 -0
  364. package/dist/tui/utils.js +800 -0
  365. package/dist/utils/changelog.js +87 -0
  366. package/dist/utils/clipboard-image.js +164 -0
  367. package/dist/utils/clipboard-native.js +14 -0
  368. package/dist/utils/clipboard.js +67 -0
  369. package/dist/utils/frontmatter.js +26 -0
  370. package/dist/utils/git.js +166 -0
  371. package/dist/utils/image-convert.js +35 -0
  372. package/dist/utils/image-resize.js +183 -0
  373. package/dist/utils/mime.js +26 -0
  374. package/dist/utils/photon.js +121 -0
  375. package/dist/utils/shell.js +217 -0
  376. package/dist/utils/sleep.js +17 -0
  377. package/dist/utils/tools-manager.js +259 -0
  378. package/package.json +78 -0
  379. package/skills/excel-com-api/SKILL.md +74 -0
  380. package/skills/excel-com-api/excel-type-library.py +27767 -0
  381. package/skills/excel-com-api/office-type-library.py +10867 -0
  382. package/skills/integrations/SKILL.md +138 -0
  383. package/skills/integrations/alphasense.md +457 -0
  384. package/skills/integrations/bloomberg.md +803 -0
  385. package/skills/integrations/calcbench.md +315 -0
  386. package/skills/integrations/capiq.md +848 -0
  387. package/skills/integrations/dynamics-365-finance.md +354 -0
  388. package/skills/integrations/earnings_transcripts.md +387 -0
  389. package/skills/integrations/factset.md +758 -0
  390. package/skills/integrations/ice-fixed-income.md +344 -0
  391. package/skills/integrations/moodys-analytics.md +313 -0
  392. package/skills/integrations/morningstar.md +433 -0
  393. package/skills/integrations/nasdaq-data-link.md +249 -0
  394. package/skills/integrations/pitchbook.md +413 -0
  395. package/skills/integrations/preqin.md +422 -0
  396. package/skills/integrations/quickbooks.md +289 -0
  397. package/skills/integrations/quickfs.md +314 -0
  398. package/skills/integrations/refinitiv.md +473 -0
  399. package/skills/integrations/sage-intacct.md +401 -0
  400. package/skills/integrations/visible-alpha.md +320 -0
  401. package/skills/integrations/xero.md +393 -0
  402. package/skills/integrations/ycharts.md +306 -0
  403. package/skills/pdf-creation/SKILL.md +93 -0
  404. package/skills/pdf-extraction/SKILL.md +32 -0
  405. package/skills/powerpoint-creation/SKILL.md +110 -0
  406. package/skills/sec-edgar/SKILL.md +127 -0
  407. package/skills/sec-edgar/sec_to_pdf.py +109 -0
  408. package/xll/ShortcutXL.xll +0 -0
  409. package/xll/modules/debug_render.py +272 -0
  410. package/xll/modules/gameboy.py +241 -0
  411. package/xll/modules/pong.py +188 -0
  412. package/xll/modules/shortcut_xl/__init__.py +18 -0
  413. package/xll/modules/shortcut_xl/_categorize.py +200 -0
  414. package/xll/modules/shortcut_xl/_com.py +108 -0
  415. package/xll/modules/shortcut_xl/_format.py +252 -0
  416. package/xll/modules/shortcut_xl/_log.py +12 -0
  417. package/xll/modules/shortcut_xl/_managed.py +116 -0
  418. package/xll/modules/shortcut_xl/_registry.py +44 -0
  419. package/xll/modules/shortcut_xl/_threading.py +161 -0
  420. package/xll/modules/shortcut_xl/_tracking.py +283 -0
  421. package/xll/modules/stocks.py +100 -0
  422. package/xll/python3.dll +0 -0
  423. package/xll/python312.dll +0 -0
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Tool Override Example - Demonstrates overriding built-in tools
3
+ *
4
+ * Extensions can register tools with the same name as built-in tools to replace them.
5
+ * This is useful for:
6
+ * - Adding logging or auditing to tool calls
7
+ * - Implementing access control or sandboxing
8
+ * - Routing tool calls to remote systems (e.g., shortcut-ssh-remote)
9
+ * - Modifying tool behavior for specific workflows
10
+ *
11
+ * This example overrides the `read` tool to:
12
+ * 1. Log all file access to a log file
13
+ * 2. Block access to sensitive paths (e.g., .env files)
14
+ * 3. Delegate to the original read implementation for allowed files
15
+ *
16
+ * Since no custom renderCall/renderResult are provided, the built-in renderer
17
+ * is used automatically (syntax highlighting, line numbers, truncation warnings).
18
+ *
19
+ * Usage:
20
+ * shortcut -e ./tool-override.ts
21
+ */
22
+
23
+ import { Type } from '@sinclair/typebox';
24
+ import { appendFileSync, constants, readFileSync } from 'fs';
25
+ import { access, readFile } from 'fs/promises';
26
+ import { homedir } from 'os';
27
+ import { join, resolve } from 'path';
28
+ import type { ExtensionAPI, TextContent } from 'shortcutxl';
29
+
30
+ const LOG_FILE = join(homedir(), '.shortcut', 'agent', 'read-access.log');
31
+
32
+ // Paths that are blocked from reading
33
+ const BLOCKED_PATTERNS = [
34
+ /\.env$/,
35
+ /\.env\..+$/,
36
+ /secrets?\.(json|yaml|yml|toml)$/i,
37
+ /credentials?\.(json|yaml|yml|toml)$/i,
38
+ /\/\.ssh\//,
39
+ /\/\.aws\//,
40
+ /\/\.gnupg\//
41
+ ];
42
+
43
+ function isBlockedPath(path: string): boolean {
44
+ return BLOCKED_PATTERNS.some((pattern) => pattern.test(path));
45
+ }
46
+
47
+ function logAccess(path: string, allowed: boolean, reason?: string) {
48
+ const timestamp = new Date().toISOString();
49
+ const status = allowed ? 'ALLOWED' : 'BLOCKED';
50
+ const msg = reason ? ` (${reason})` : '';
51
+ const line = `[${timestamp}] ${status}: ${path}${msg}\n`;
52
+
53
+ try {
54
+ appendFileSync(LOG_FILE, line);
55
+ } catch {
56
+ // Ignore logging errors
57
+ }
58
+ }
59
+
60
+ const readSchema = Type.Object({
61
+ path: Type.String({ description: 'Path to the file to read (relative or absolute)' }),
62
+ offset: Type.Optional(
63
+ Type.Number({ description: 'Line number to start reading from (1-indexed)' })
64
+ ),
65
+ limit: Type.Optional(Type.Number({ description: 'Maximum number of lines to read' }))
66
+ });
67
+
68
+ export default function (shortcut: ExtensionAPI) {
69
+ shortcut.registerTool({
70
+ name: 'read', // Same name as built-in - this will override it
71
+ label: 'read (audited)',
72
+ description:
73
+ 'Read the contents of a file with access logging. Some sensitive paths (.env, secrets, credentials) are blocked.',
74
+ parameters: readSchema,
75
+
76
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
77
+ const { path, offset, limit } = params;
78
+ const absolutePath = resolve(ctx.cwd, path);
79
+
80
+ // Check if path is blocked
81
+ if (isBlockedPath(absolutePath)) {
82
+ logAccess(absolutePath, false, 'matches blocked pattern');
83
+ return {
84
+ content: [
85
+ {
86
+ type: 'text',
87
+ text: `Access denied: "${path}" matches a blocked pattern (sensitive file). This tool blocks access to .env files, secrets, credentials, and SSH/AWS/GPG directories.`
88
+ }
89
+ ],
90
+ details: { blocked: true }
91
+ };
92
+ }
93
+
94
+ // Log allowed access
95
+ logAccess(absolutePath, true);
96
+
97
+ // Perform the actual read (simplified implementation)
98
+ try {
99
+ await access(absolutePath, constants.R_OK);
100
+ const content = await readFile(absolutePath, 'utf-8');
101
+ const lines = content.split('\n');
102
+
103
+ // Apply offset and limit
104
+ const startLine = offset ? Math.max(0, offset - 1) : 0;
105
+ const endLine = limit ? startLine + limit : lines.length;
106
+ const selectedLines = lines.slice(startLine, endLine);
107
+
108
+ // Basic truncation (50KB limit)
109
+ let text = selectedLines.join('\n');
110
+ const maxBytes = 50 * 1024;
111
+ if (Buffer.byteLength(text, 'utf-8') > maxBytes) {
112
+ text = `${text.slice(0, maxBytes)}\n\n[Output truncated at 50KB]`;
113
+ }
114
+
115
+ return {
116
+ content: [{ type: 'text', text }] as TextContent[],
117
+ details: { lines: lines.length }
118
+ };
119
+ } catch (error: any) {
120
+ return {
121
+ content: [
122
+ { type: 'text', text: `Error reading file: ${error.message}` }
123
+ ] as TextContent[],
124
+ details: { error: true }
125
+ };
126
+ }
127
+ }
128
+
129
+ // No renderCall/renderResult - uses built-in renderer automatically
130
+ // (syntax highlighting, line numbers, truncation warnings, etc.)
131
+ });
132
+
133
+ // Also register a command to view the access log
134
+ shortcut.registerCommand('read-log', {
135
+ description: 'View the file access log',
136
+ handler: async (_args, ctx) => {
137
+ try {
138
+ const log = readFileSync(LOG_FILE, 'utf-8');
139
+ const lines = log.trim().split('\n').slice(-20); // Last 20 entries
140
+ ctx.ui.notify(`Recent file access:\n${lines.join('\n')}`, 'info');
141
+ } catch {
142
+ ctx.ui.notify('No access log found', 'info');
143
+ }
144
+ }
145
+ });
146
+ }
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Tools Extension
3
+ *
4
+ * Provides a /tools command to enable/disable tools interactively.
5
+ * Tool selection persists across session reloads and respects branch navigation.
6
+ *
7
+ * Usage:
8
+ * 1. Copy this file to ~/.shortcut/agent/extensions/ or your project's .shortcut/extensions/
9
+ * 2. Use /tools to open the tool selector
10
+ */
11
+
12
+ import type { ExtensionAPI, ExtensionContext, ToolInfo } from 'shortcutxl';
13
+ import { Container, getSettingsListTheme, type SettingItem, SettingsList } from 'shortcutxl';
14
+
15
+ // State persisted to session
16
+ interface ToolsState {
17
+ enabledTools: string[];
18
+ }
19
+
20
+ export default function toolsExtension(shortcut: ExtensionAPI) {
21
+ // Track enabled tools
22
+ let enabledTools: Set<string> = new Set();
23
+ let allTools: ToolInfo[] = [];
24
+
25
+ // Persist current state
26
+ function persistState() {
27
+ shortcut.appendEntry<ToolsState>('tools-config', {
28
+ enabledTools: Array.from(enabledTools)
29
+ });
30
+ }
31
+
32
+ // Apply current tool selection
33
+ function applyTools() {
34
+ shortcut.setActiveTools(Array.from(enabledTools));
35
+ }
36
+
37
+ // Find the last tools-config entry in the current branch
38
+ function restoreFromBranch(ctx: ExtensionContext) {
39
+ allTools = shortcut.getAllTools();
40
+
41
+ // Get entries in current branch only
42
+ const branchEntries = ctx.sessionManager.getBranch();
43
+ let savedTools: string[] | undefined;
44
+
45
+ for (const entry of branchEntries) {
46
+ if (entry.type === 'custom' && entry.customType === 'tools-config') {
47
+ const data = entry.data as ToolsState | undefined;
48
+ if (data?.enabledTools) {
49
+ savedTools = data.enabledTools;
50
+ }
51
+ }
52
+ }
53
+
54
+ if (savedTools) {
55
+ // Restore saved tool selection (filter to only tools that still exist)
56
+ const allToolNames = allTools.map((t) => t.name);
57
+ enabledTools = new Set(savedTools.filter((t: string) => allToolNames.includes(t)));
58
+ applyTools();
59
+ } else {
60
+ // No saved state - sync with currently active tools
61
+ enabledTools = new Set(shortcut.getActiveTools());
62
+ }
63
+ }
64
+
65
+ // Register /tools command
66
+ shortcut.registerCommand('tools', {
67
+ description: 'Enable/disable tools',
68
+ handler: async (_args, ctx) => {
69
+ // Refresh tool list
70
+ allTools = shortcut.getAllTools();
71
+
72
+ await ctx.ui.custom((tui, theme, _kb, done) => {
73
+ // Build settings items for each tool
74
+ const items: SettingItem[] = allTools.map((tool) => ({
75
+ id: tool.name,
76
+ label: tool.name,
77
+ currentValue: enabledTools.has(tool.name) ? 'enabled' : 'disabled',
78
+ values: ['enabled', 'disabled']
79
+ }));
80
+
81
+ const container = new Container();
82
+ container.addChild(
83
+ new (class {
84
+ render(_width: number) {
85
+ return [theme.fg('accent', theme.bold('Tool Configuration')), ''];
86
+ }
87
+ invalidate() {}
88
+ })()
89
+ );
90
+
91
+ const settingsList = new SettingsList(
92
+ items,
93
+ Math.min(items.length + 2, 15),
94
+ getSettingsListTheme(),
95
+ (id, newValue) => {
96
+ // Update enabled state and apply immediately
97
+ if (newValue === 'enabled') {
98
+ enabledTools.add(id);
99
+ } else {
100
+ enabledTools.delete(id);
101
+ }
102
+ applyTools();
103
+ persistState();
104
+ },
105
+ () => {
106
+ // Close dialog
107
+ done(undefined);
108
+ }
109
+ );
110
+
111
+ container.addChild(settingsList);
112
+
113
+ const component = {
114
+ render(width: number) {
115
+ return container.render(width);
116
+ },
117
+ invalidate() {
118
+ container.invalidate();
119
+ },
120
+ handleInput(data: string) {
121
+ settingsList.handleInput?.(data);
122
+ tui.requestRender();
123
+ }
124
+ };
125
+
126
+ return component;
127
+ });
128
+ }
129
+ });
130
+
131
+ // Restore state on session start
132
+ shortcut.on('session_start', async (_event, ctx) => {
133
+ restoreFromBranch(ctx);
134
+ });
135
+
136
+ // Restore state when navigating the session tree
137
+ shortcut.on('session_tree', async (_event, ctx) => {
138
+ restoreFromBranch(ctx);
139
+ });
140
+
141
+ // Restore state after forking
142
+ shortcut.on('session_fork', async (_event, ctx) => {
143
+ restoreFromBranch(ctx);
144
+ });
145
+ }
@@ -0,0 +1,40 @@
1
+ import type { ExtensionAPI, ExtensionContext } from 'shortcutxl';
2
+
3
+ const COMPACT_THRESHOLD_TOKENS = 100_000;
4
+
5
+ export default function (shortcut: ExtensionAPI) {
6
+ const triggerCompaction = (ctx: ExtensionContext, customInstructions?: string) => {
7
+ if (ctx.hasUI) {
8
+ ctx.ui.notify('Compaction started', 'info');
9
+ }
10
+ ctx.compact({
11
+ customInstructions,
12
+ onComplete: () => {
13
+ if (ctx.hasUI) {
14
+ ctx.ui.notify('Compaction completed', 'info');
15
+ }
16
+ },
17
+ onError: (error) => {
18
+ if (ctx.hasUI) {
19
+ ctx.ui.notify(`Compaction failed: ${error.message}`, 'error');
20
+ }
21
+ }
22
+ });
23
+ };
24
+
25
+ shortcut.on('turn_end', (_event, ctx) => {
26
+ const usage = ctx.getContextUsage();
27
+ if (!usage || usage.tokens === null || usage.tokens <= COMPACT_THRESHOLD_TOKENS) {
28
+ return;
29
+ }
30
+ triggerCompaction(ctx);
31
+ });
32
+
33
+ shortcut.registerCommand('trigger-compact', {
34
+ description: 'Trigger compaction immediately',
35
+ handler: async (args, ctx) => {
36
+ const instructions = args.trim() || undefined;
37
+ triggerCompaction(ctx, instructions);
38
+ }
39
+ });
40
+ }
@@ -0,0 +1,194 @@
1
+ /**
2
+ * Truncated Tool Example - Demonstrates proper output truncation for custom tools
3
+ *
4
+ * Custom tools MUST truncate their output to avoid overwhelming the LLM context.
5
+ * The built-in limit is 50KB (~10k tokens) and 2000 lines, whichever is hit first.
6
+ *
7
+ * This example shows how to:
8
+ * 1. Use the built-in truncation utilities
9
+ * 2. Write full output to a temp file when truncated
10
+ * 3. Inform the LLM where to find the complete output
11
+ * 4. Custom rendering of tool calls and results
12
+ *
13
+ * The `rg` tool here wraps ripgrep with proper truncation. Compare this to the
14
+ * built-in `grep` tool in src/core/tools/grep.ts for a more complete implementation.
15
+ */
16
+
17
+ import { Type } from '@sinclair/typebox';
18
+ import { execSync } from 'child_process';
19
+ import { mkdtempSync, writeFileSync } from 'fs';
20
+ import { tmpdir } from 'os';
21
+ import { join } from 'path';
22
+ import type { ExtensionAPI } from 'shortcutxl';
23
+ import {
24
+ DEFAULT_MAX_BYTES,
25
+ DEFAULT_MAX_LINES,
26
+ formatSize,
27
+ Text,
28
+ truncateHead,
29
+ type TruncationResult
30
+ } from 'shortcutxl';
31
+
32
+ const RgParams = Type.Object({
33
+ pattern: Type.String({ description: 'Search pattern (regex)' }),
34
+ path: Type.Optional(
35
+ Type.String({ description: 'Directory to search (default: current directory)' })
36
+ ),
37
+ glob: Type.Optional(Type.String({ description: "File glob pattern, e.g. '*.ts'" }))
38
+ });
39
+
40
+ interface RgDetails {
41
+ pattern: string;
42
+ path?: string;
43
+ glob?: string;
44
+ matchCount: number;
45
+ truncation?: TruncationResult;
46
+ fullOutputPath?: string;
47
+ }
48
+
49
+ export default function (shortcut: ExtensionAPI) {
50
+ shortcut.registerTool({
51
+ name: 'rg',
52
+ label: 'ripgrep',
53
+ // Document the truncation limits in the tool description so the LLM knows
54
+ description: `Search file contents using ripgrep. Output is truncated to ${DEFAULT_MAX_LINES} lines or ${formatSize(DEFAULT_MAX_BYTES)} (whichever is hit first). If truncated, full output is saved to a temp file.`,
55
+ parameters: RgParams,
56
+
57
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
58
+ const { pattern, path: searchPath, glob } = params;
59
+
60
+ // Build the ripgrep command
61
+ const args = ['rg', '--line-number', '--color=never'];
62
+ if (glob) args.push('--glob', glob);
63
+ args.push(pattern);
64
+ args.push(searchPath || '.');
65
+
66
+ let output: string;
67
+ try {
68
+ output = execSync(args.join(' '), {
69
+ cwd: ctx.cwd,
70
+ encoding: 'utf-8',
71
+ maxBuffer: 100 * 1024 * 1024 // 100MB buffer to capture full output
72
+ });
73
+ } catch (err: any) {
74
+ // ripgrep exits with 1 when no matches found
75
+ if (err.status === 1) {
76
+ return {
77
+ content: [{ type: 'text', text: 'No matches found' }],
78
+ details: { pattern, path: searchPath, glob, matchCount: 0 } as RgDetails
79
+ };
80
+ }
81
+ throw new Error(`ripgrep failed: ${err.message}`);
82
+ }
83
+
84
+ if (!output.trim()) {
85
+ return {
86
+ content: [{ type: 'text', text: 'No matches found' }],
87
+ details: { pattern, path: searchPath, glob, matchCount: 0 } as RgDetails
88
+ };
89
+ }
90
+
91
+ // Apply truncation using built-in utilities
92
+ // truncateHead keeps the first N lines/bytes (good for search results)
93
+ // truncateTail keeps the last N lines/bytes (good for logs/command output)
94
+ const truncation = truncateHead(output, {
95
+ maxLines: DEFAULT_MAX_LINES,
96
+ maxBytes: DEFAULT_MAX_BYTES
97
+ });
98
+
99
+ // Count matches (each non-empty line with a match)
100
+ const matchCount = output.split('\n').filter((line) => line.trim()).length;
101
+
102
+ const details: RgDetails = {
103
+ pattern,
104
+ path: searchPath,
105
+ glob,
106
+ matchCount
107
+ };
108
+
109
+ let resultText = truncation.content;
110
+
111
+ if (truncation.truncated) {
112
+ // Save full output to a temp file so LLM can access it if needed
113
+ const tempDir = mkdtempSync(join(tmpdir(), 'shortcut-rg-'));
114
+ const tempFile = join(tempDir, 'output.txt');
115
+ writeFileSync(tempFile, output);
116
+
117
+ details.truncation = truncation;
118
+ details.fullOutputPath = tempFile;
119
+
120
+ // Add truncation notice - this helps the LLM understand the output is incomplete
121
+ const truncatedLines = truncation.totalLines - truncation.outputLines;
122
+ const truncatedBytes = truncation.totalBytes - truncation.outputBytes;
123
+
124
+ resultText += `\n\n[Output truncated: showing ${truncation.outputLines} of ${truncation.totalLines} lines`;
125
+ resultText += ` (${formatSize(truncation.outputBytes)} of ${formatSize(truncation.totalBytes)}).`;
126
+ resultText += ` ${truncatedLines} lines (${formatSize(truncatedBytes)}) omitted.`;
127
+ resultText += ` Full output saved to: ${tempFile}]`;
128
+ }
129
+
130
+ return {
131
+ content: [{ type: 'text', text: resultText }],
132
+ details
133
+ };
134
+ },
135
+
136
+ // Custom rendering of the tool call (shown before/during execution)
137
+ renderCall(args, theme) {
138
+ let text = theme.fg('toolTitle', theme.bold('rg '));
139
+ text += theme.fg('accent', `"${args.pattern}"`);
140
+ if (args.path) {
141
+ text += theme.fg('muted', ` in ${args.path}`);
142
+ }
143
+ if (args.glob) {
144
+ text += theme.fg('dim', ` --glob ${args.glob}`);
145
+ }
146
+ return new Text(text, 0, 0);
147
+ },
148
+
149
+ // Custom rendering of the tool result
150
+ renderResult(result, { expanded, isPartial }, theme) {
151
+ const details = result.details as RgDetails | undefined;
152
+
153
+ // Handle streaming/partial results
154
+ if (isPartial) {
155
+ return new Text(theme.fg('warning', 'Searching...'), 0, 0);
156
+ }
157
+
158
+ // No matches
159
+ if (!details || details.matchCount === 0) {
160
+ return new Text(theme.fg('dim', 'No matches found'), 0, 0);
161
+ }
162
+
163
+ // Build result display
164
+ let text = theme.fg('success', `${details.matchCount} matches`);
165
+
166
+ // Show truncation warning if applicable
167
+ if (details.truncation?.truncated) {
168
+ text += theme.fg('warning', ' (truncated)');
169
+ }
170
+
171
+ // In expanded view, show the actual matches
172
+ if (expanded) {
173
+ const content = result.content[0];
174
+ if (content?.type === 'text') {
175
+ // Show first 20 lines in expanded view, or all if fewer
176
+ const lines = content.text.split('\n').slice(0, 20);
177
+ for (const line of lines) {
178
+ text += `\n${theme.fg('dim', line)}`;
179
+ }
180
+ if (content.text.split('\n').length > 20) {
181
+ text += `\n${theme.fg('muted', '... (use read tool to see full output)')}`;
182
+ }
183
+ }
184
+
185
+ // Show temp file path if truncated
186
+ if (details.fullOutputPath) {
187
+ text += `\n${theme.fg('dim', `Full output: ${details.fullOutputPath}`)}`;
188
+ }
189
+ }
190
+
191
+ return new Text(text, 0, 0);
192
+ }
193
+ });
194
+ }
@@ -0,0 +1,17 @@
1
+ import type { ExtensionAPI, ExtensionContext } from 'shortcutxl';
2
+
3
+ const applyWidgets = (ctx: ExtensionContext) => {
4
+ if (!ctx.hasUI) return;
5
+ ctx.ui.setWidget('widget-above', ['Above editor widget']);
6
+ ctx.ui.setWidget('widget-below', ['Below editor widget'], { placement: 'belowEditor' });
7
+ };
8
+
9
+ export default function widgetPlacementExtension(shortcut: ExtensionAPI) {
10
+ shortcut.on('session_start', (_event, ctx) => {
11
+ applyWidgets(ctx);
12
+ });
13
+
14
+ shortcut.on('session_switch', (_event, ctx) => {
15
+ applyWidgets(ctx);
16
+ });
17
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Example extension with its own npm dependencies.
3
+ * Tests that jiti resolves modules from the extension's own node_modules.
4
+ *
5
+ * Requires: npm install in this directory
6
+ */
7
+
8
+ import { Type } from '@sinclair/typebox';
9
+ import ms from 'ms';
10
+ import type { ExtensionAPI } from 'shortcutxl';
11
+
12
+ export default function (shortcut: ExtensionAPI) {
13
+ // Register a tool that uses ms
14
+ shortcut.registerTool({
15
+ name: 'parse_duration',
16
+ label: 'Parse Duration',
17
+ description:
18
+ "Parse a human-readable duration string (e.g., '2 days', '1h', '5m') to milliseconds",
19
+ parameters: Type.Object({
20
+ duration: Type.String({ description: "Duration string like '2 days', '1h', '5m'" })
21
+ }),
22
+ execute: async (_toolCallId, params) => {
23
+ const result = ms(params.duration as ms.StringValue);
24
+ if (result === undefined) {
25
+ return {
26
+ content: [{ type: 'text', text: `Invalid duration: "${params.duration}"` }],
27
+ isError: true,
28
+ details: {}
29
+ };
30
+ }
31
+ return {
32
+ content: [{ type: 'text', text: `${params.duration} = ${result} milliseconds` }],
33
+ details: {}
34
+ };
35
+ }
36
+ });
37
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "pi-extension-with-deps",
3
+ "version": "1.19.4",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "pi-extension-with-deps",
9
+ "version": "1.19.4",
10
+ "dependencies": {
11
+ "ms": "^2.1.3"
12
+ },
13
+ "devDependencies": {
14
+ "@types/ms": "^2.1.0"
15
+ }
16
+ },
17
+ "node_modules/@types/ms": {
18
+ "version": "2.1.0",
19
+ "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz",
20
+ "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==",
21
+ "dev": true,
22
+ "license": "MIT"
23
+ },
24
+ "node_modules/ms": {
25
+ "version": "2.1.3",
26
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
27
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
28
+ "license": "MIT"
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "pi-extension-with-deps",
3
+ "private": true,
4
+ "version": "1.19.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
+ "dependencies": {
17
+ "ms": "^2.1.3"
18
+ },
19
+ "devDependencies": {
20
+ "@types/ms": "^2.1.0"
21
+ }
22
+ }