@tomsun28/pizza 0.0.9 → 0.1.1
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 +20 -143
- package/README.zh-CN.md +36 -0
- package/dist/bun/cli.d.ts +2 -0
- package/dist/bun/cli.js +6 -0
- package/dist/bun/register-bedrock.d.ts +1 -0
- package/dist/bun/register-bedrock.js +3 -0
- package/dist/cli/args.d.ts +48 -0
- package/dist/cli/args.js +330 -0
- package/dist/cli/config-selector.d.ts +13 -0
- package/dist/cli/config-selector.js +30 -0
- package/dist/cli/file-processor.d.ts +14 -0
- package/dist/cli/file-processor.js +82 -0
- package/dist/cli/initial-message.d.ts +17 -0
- package/dist/cli/initial-message.js +21 -0
- package/dist/cli/list-models.d.ts +8 -0
- package/dist/cli/list-models.js +96 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +68 -0
- package/dist/config.d.ts +79 -0
- package/dist/config.js +223 -0
- package/dist/core/agent/index.d.ts +6 -0
- package/dist/core/agent/index.js +6 -0
- package/dist/core/agent/types.d.ts +202 -0
- package/dist/core/agent/types.js +51 -0
- package/dist/core/auth-storage.d.ts +135 -0
- package/dist/core/auth-storage.js +417 -0
- package/dist/core/bash-executor.d.ts +31 -0
- package/dist/core/bash-executor.js +107 -0
- package/dist/core/compaction/branch-summarization.d.ts +87 -0
- package/dist/core/compaction/branch-summarization.js +242 -0
- package/dist/core/compaction/compaction-engine.d.ts +40 -0
- package/dist/core/compaction/compaction-engine.js +292 -0
- package/dist/core/compaction/compaction.d.ts +106 -0
- package/dist/core/compaction/compaction.js +295 -0
- package/dist/core/compaction/index.d.ts +7 -0
- package/dist/core/compaction/index.js +7 -0
- package/dist/core/compaction/utils.d.ts +37 -0
- package/dist/core/compaction/utils.js +152 -0
- package/dist/core/defaults.d.ts +2 -0
- package/dist/core/defaults.js +1 -0
- package/dist/core/diagnostics.d.ts +14 -0
- package/dist/core/diagnostics.js +1 -0
- package/dist/core/event-bus.d.ts +8 -0
- package/dist/core/event-bus.js +24 -0
- package/dist/core/event-store/events.d.ts +465 -0
- package/dist/core/event-store/events.js +6 -0
- package/dist/core/event-store/index.d.ts +10 -0
- package/dist/core/event-store/index.js +10 -0
- package/dist/core/event-store/sqlite-store.d.ts +27 -0
- package/dist/core/event-store/sqlite-store.js +275 -0
- package/dist/core/event-store/store.d.ts +91 -0
- package/dist/core/event-store/store.js +7 -0
- package/dist/core/event-store/thread-scoped-store.d.ts +29 -0
- package/dist/core/event-store/thread-scoped-store.js +50 -0
- package/dist/core/event-store/types.d.ts +70 -0
- package/dist/core/event-store/types.js +7 -0
- package/dist/core/event-store/workspace.d.ts +37 -0
- package/dist/core/event-store/workspace.js +71 -0
- package/dist/core/exec.d.ts +28 -0
- package/dist/core/exec.js +74 -0
- package/dist/core/export-html/ansi-to-html.d.ts +21 -0
- package/dist/core/export-html/ansi-to-html.js +248 -0
- package/dist/core/export-html/index.d.ts +29 -0
- package/dist/core/export-html/index.js +186 -0
- package/dist/core/export-html/template.css +1017 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +1742 -0
- package/dist/core/export-html/tool-renderer.d.ts +39 -0
- package/dist/core/export-html/tool-renderer.js +94 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +6 -0
- package/dist/core/extensions/index.d.ts +12 -0
- package/dist/core/extensions/index.js +9 -0
- package/dist/core/extensions/loader.d.ts +24 -0
- package/dist/core/extensions/loader.js +492 -0
- package/dist/core/extensions/runner.d.ts +167 -0
- package/dist/core/extensions/runner.js +898 -0
- package/dist/core/extensions/session-context.d.ts +67 -0
- package/dist/core/extensions/session-context.js +272 -0
- package/dist/core/extensions/types.d.ts +1147 -0
- package/dist/core/extensions/types.js +44 -0
- package/dist/core/extensions/wrapper.d.ts +19 -0
- package/dist/core/extensions/wrapper.js +21 -0
- package/dist/core/footer-data-provider.d.ts +47 -0
- package/dist/core/footer-data-provider.js +321 -0
- package/dist/core/goal/index.d.ts +3 -0
- package/dist/core/goal/index.js +1 -0
- package/dist/core/goal/scheduler.d.ts +83 -0
- package/dist/core/goal/scheduler.js +154 -0
- package/dist/core/goal/types.d.ts +182 -0
- package/dist/core/goal/types.js +11 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.js +8 -0
- package/dist/core/intent/classifier.d.ts +53 -0
- package/dist/core/intent/classifier.js +353 -0
- package/dist/core/intent/index.d.ts +8 -0
- package/dist/core/intent/index.js +8 -0
- package/dist/core/intent/tool-adapter.d.ts +31 -0
- package/dist/core/intent/tool-adapter.js +168 -0
- package/dist/core/intent/types.d.ts +71 -0
- package/dist/core/intent/types.js +6 -0
- package/dist/core/keybindings.d.ts +297 -0
- package/dist/core/keybindings.js +250 -0
- package/dist/core/messages.d.ts +30 -0
- package/dist/core/messages.js +134 -0
- package/dist/core/model-registry.d.ts +131 -0
- package/dist/core/model-registry.js +634 -0
- package/dist/core/model-resolver.d.ts +109 -0
- package/dist/core/model-resolver.js +486 -0
- package/dist/core/output-guard.d.ts +5 -0
- package/dist/core/output-guard.js +58 -0
- package/dist/core/package-manager.d.ts +196 -0
- package/dist/core/package-manager.js +1873 -0
- package/dist/core/projection/boundary-inferrer.d.ts +58 -0
- package/dist/core/projection/boundary-inferrer.js +122 -0
- package/dist/core/projection/event-to-message.d.ts +35 -0
- package/dist/core/projection/event-to-message.js +253 -0
- package/dist/core/projection/goal-projection.d.ts +67 -0
- package/dist/core/projection/goal-projection.js +339 -0
- package/dist/core/projection/index.d.ts +13 -0
- package/dist/core/projection/index.js +13 -0
- package/dist/core/projection/session-manager.d.ts +100 -0
- package/dist/core/projection/session-manager.js +331 -0
- package/dist/core/projection/session-projection.d.ts +58 -0
- package/dist/core/projection/session-projection.js +257 -0
- package/dist/core/projection/task-history.d.ts +13 -0
- package/dist/core/projection/task-history.js +61 -0
- package/dist/core/projection/timeline-projection.d.ts +82 -0
- package/dist/core/projection/timeline-projection.js +276 -0
- package/dist/core/projection/types.d.ts +69 -0
- package/dist/core/projection/types.js +6 -0
- package/dist/core/prompt-templates.d.ts +51 -0
- package/dist/core/prompt-templates.js +249 -0
- package/dist/core/resolve-config-value.d.ts +22 -0
- package/dist/core/resolve-config-value.js +125 -0
- package/dist/core/resource-loader.d.ts +193 -0
- package/dist/core/resource-loader.js +685 -0
- package/dist/core/runtime/ai-client.d.ts +12 -0
- package/dist/core/runtime/ai-client.js +153 -0
- package/dist/core/runtime/checkpoint.d.ts +12 -0
- package/dist/core/runtime/checkpoint.js +78 -0
- package/dist/core/runtime/index.d.ts +12 -0
- package/dist/core/runtime/index.js +12 -0
- package/dist/core/runtime/llm-types.d.ts +99 -0
- package/dist/core/runtime/llm-types.js +6 -0
- package/dist/core/runtime/local-runtime.d.ts +23 -0
- package/dist/core/runtime/local-runtime.js +59 -0
- package/dist/core/runtime/policies.d.ts +72 -0
- package/dist/core/runtime/policies.js +37 -0
- package/dist/core/runtime/reactor.d.ts +213 -0
- package/dist/core/runtime/reactor.js +992 -0
- package/dist/core/runtime/runtime.d.ts +191 -0
- package/dist/core/runtime/runtime.js +449 -0
- package/dist/core/runtime/types.d.ts +42 -0
- package/dist/core/runtime/types.js +1 -0
- package/dist/core/sdk.d.ts +12 -0
- package/dist/core/sdk.js +10 -0
- package/dist/core/session-context-builder.d.ts +9 -0
- package/dist/core/session-context-builder.js +87 -0
- package/dist/core/session-cwd.d.ts +18 -0
- package/dist/core/session-cwd.js +36 -0
- package/dist/core/session-facade-factory.d.ts +79 -0
- package/dist/core/session-facade-factory.js +460 -0
- package/dist/core/session-facade.d.ts +57 -0
- package/dist/core/session-facade.js +91 -0
- package/dist/core/session-listing.d.ts +30 -0
- package/dist/core/session-listing.js +168 -0
- package/dist/core/session-reader.d.ts +19 -0
- package/dist/core/session-reader.js +101 -0
- package/dist/core/session-ref.d.ts +7 -0
- package/dist/core/session-ref.js +25 -0
- package/dist/core/session-services.d.ts +51 -0
- package/dist/core/session-services.js +90 -0
- package/dist/core/session-stats.d.ts +43 -0
- package/dist/core/session-stats.js +41 -0
- package/dist/core/settings-manager.d.ts +236 -0
- package/dist/core/settings-manager.js +706 -0
- package/dist/core/skill-block-parser.d.ts +12 -0
- package/dist/core/skill-block-parser.js +15 -0
- package/dist/core/skills.d.ts +59 -0
- package/dist/core/skills.js +408 -0
- package/dist/core/slash-commands.d.ts +13 -0
- package/dist/core/slash-commands.js +17 -0
- package/dist/core/source-info.d.ts +17 -0
- package/dist/core/source-info.js +18 -0
- package/dist/core/system-prompt.d.ts +27 -0
- package/dist/core/system-prompt.js +179 -0
- package/dist/core/timings.d.ts +7 -0
- package/dist/core/timings.js +30 -0
- package/dist/core/tools/bash.d.ts +95 -0
- package/dist/core/tools/bash.js +513 -0
- package/dist/core/tools/builtin-commands.d.ts +75 -0
- package/dist/core/tools/builtin-commands.js +503 -0
- package/dist/core/tools/compat-commands.d.ts +12 -0
- package/dist/core/tools/compat-commands.js +1280 -0
- package/dist/core/tools/edit-diff.d.ts +59 -0
- package/dist/core/tools/edit-diff.js +263 -0
- package/dist/core/tools/edit.d.ts +49 -0
- package/dist/core/tools/edit.js +340 -0
- package/dist/core/tools/file-mutation-queue.d.ts +5 -0
- package/dist/core/tools/file-mutation-queue.js +36 -0
- package/dist/core/tools/find.d.ts +34 -0
- package/dist/core/tools/find.js +459 -0
- package/dist/core/tools/grep.d.ts +36 -0
- package/dist/core/tools/grep.js +422 -0
- package/dist/core/tools/index.d.ts +70 -0
- package/dist/core/tools/index.js +129 -0
- package/dist/core/tools/line-anchors.d.ts +33 -0
- package/dist/core/tools/line-anchors.js +151 -0
- package/dist/core/tools/ls.d.ts +36 -0
- package/dist/core/tools/ls.js +268 -0
- package/dist/core/tools/path-utils.d.ts +7 -0
- package/dist/core/tools/path-utils.js +80 -0
- package/dist/core/tools/read.d.ts +35 -0
- package/dist/core/tools/read.js +244 -0
- package/dist/core/tools/render-utils.d.ts +20 -0
- package/dist/core/tools/render-utils.js +48 -0
- package/dist/core/tools/session-split.d.ts +9 -0
- package/dist/core/tools/session-split.js +77 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +13 -0
- package/dist/core/tools/tool-definition-wrapper.js +32 -0
- package/dist/core/tools/truncate.d.ts +69 -0
- package/dist/core/tools/truncate.js +204 -0
- package/dist/core/tools/write.d.ts +25 -0
- package/dist/core/tools/write.js +211 -0
- package/dist/core/types/session-types.d.ts +123 -0
- package/dist/core/types/session-types.js +8 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +38 -0
- package/dist/main.d.ts +11 -2
- package/dist/main.js +577 -149
- package/dist/modes/event-mapper.d.ts +115 -0
- package/dist/modes/event-mapper.js +200 -0
- package/dist/modes/gui/server.d.ts +14 -0
- package/dist/modes/gui/server.js +1032 -0
- package/dist/modes/index.d.ts +10 -0
- package/dist/modes/index.js +9 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/components/armin.d.ts +33 -0
- package/dist/modes/interactive/components/armin.js +328 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +19 -0
- package/dist/modes/interactive/components/assistant-message.js +115 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +33 -0
- package/dist/modes/interactive/components/bash-execution.js +169 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +15 -0
- package/dist/modes/interactive/components/bordered-loader.js +50 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +15 -0
- package/dist/modes/interactive/components/branch-summary-message.js +41 -0
- package/dist/modes/interactive/components/brand-header.d.ts +33 -0
- package/dist/modes/interactive/components/brand-header.js +235 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +15 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +42 -0
- package/dist/modes/interactive/components/config-selector.d.ts +70 -0
- package/dist/modes/interactive/components/config-selector.js +469 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +13 -0
- package/dist/modes/interactive/components/countdown-timer.js +27 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +27 -0
- package/dist/modes/interactive/components/custom-editor.js +94 -0
- package/dist/modes/interactive/components/custom-message.d.ts +19 -0
- package/dist/modes/interactive/components/custom-message.js +73 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +22 -0
- package/dist/modes/interactive/components/daxnuts.js +137 -0
- package/dist/modes/interactive/components/diff.d.ts +11 -0
- package/dist/modes/interactive/components/diff.js +132 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +14 -0
- package/dist/modes/interactive/components/dynamic-border.js +19 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts +4 -0
- package/dist/modes/interactive/components/earendil-announcement.js +39 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +19 -0
- package/dist/modes/interactive/components/extension-editor.js +105 -0
- package/dist/modes/interactive/components/extension-input.d.ts +22 -0
- package/dist/modes/interactive/components/extension-input.js +54 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +23 -0
- package/dist/modes/interactive/components/extension-selector.js +70 -0
- package/dist/modes/interactive/components/footer.d.ts +55 -0
- package/dist/modes/interactive/components/footer.js +207 -0
- package/dist/modes/interactive/components/index.d.ts +31 -0
- package/dist/modes/interactive/components/index.js +32 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +7 -0
- package/dist/modes/interactive/components/keybinding-hints.js +21 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +41 -0
- package/dist/modes/interactive/components/login-dialog.js +138 -0
- package/dist/modes/interactive/components/model-selector.d.ts +32 -0
- package/dist/modes/interactive/components/model-selector.js +209 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +18 -0
- package/dist/modes/interactive/components/oauth-selector.js +91 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +57 -0
- package/dist/modes/interactive/components/settings-selector.js +299 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +9 -0
- package/dist/modes/interactive/components/show-images-selector.js +37 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +16 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +44 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +10 -0
- package/dist/modes/interactive/components/theme-selector.js +47 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +10 -0
- package/dist/modes/interactive/components/thinking-selector.js +50 -0
- package/dist/modes/interactive/components/timeline-view.d.ts +31 -0
- package/dist/modes/interactive/components/timeline-view.js +81 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +64 -0
- package/dist/modes/interactive/components/tool-execution.js +305 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +88 -0
- package/dist/modes/interactive/components/tree-selector.js +1072 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +29 -0
- package/dist/modes/interactive/components/user-message-selector.js +110 -0
- package/dist/modes/interactive/components/user-message.d.ts +9 -0
- package/dist/modes/interactive/components/user-message.js +27 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +23 -0
- package/dist/modes/interactive/components/visual-truncate.js +32 -0
- package/dist/modes/interactive/interactive-mode.d.ts +394 -0
- package/dist/modes/interactive/interactive-mode.js +4116 -0
- package/dist/modes/interactive/theme/dark.json +85 -0
- package/dist/modes/interactive/theme/light.json +84 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.d.ts +80 -0
- package/dist/modes/interactive/theme/theme.js +973 -0
- package/dist/modes/print-mode.d.ts +27 -0
- package/dist/modes/print-mode.js +102 -0
- package/dist/modes/rpc/jsonl.d.ts +16 -0
- package/dist/modes/rpc/jsonl.js +48 -0
- package/dist/modes/rpc/rpc-client.d.ts +219 -0
- package/dist/modes/rpc/rpc-client.js +405 -0
- package/dist/modes/rpc/rpc-mode.d.ts +19 -0
- package/dist/modes/rpc/rpc-mode.js +381 -0
- package/dist/modes/rpc/rpc-types.d.ts +406 -0
- package/dist/modes/rpc/rpc-types.js +7 -0
- package/dist/package-manager-cli.d.ts +3 -0
- package/dist/package-manager-cli.js +233 -0
- package/dist/utils/changelog.d.ts +20 -0
- package/dist/utils/changelog.js +86 -0
- package/dist/utils/child-process.d.ts +10 -0
- package/dist/utils/child-process.js +77 -0
- package/dist/utils/clipboard-image.d.ts +10 -0
- package/dist/utils/clipboard-image.js +244 -0
- package/dist/utils/clipboard-native.d.ts +7 -0
- package/dist/utils/clipboard-native.js +13 -0
- package/dist/utils/clipboard.d.ts +1 -0
- package/dist/utils/clipboard.js +77 -0
- package/dist/utils/exif-orientation.d.ts +4 -0
- package/dist/utils/exif-orientation.js +157 -0
- package/dist/utils/frontmatter.d.ts +7 -0
- package/dist/utils/frontmatter.js +25 -0
- package/dist/utils/git.d.ts +25 -0
- package/dist/utils/git.js +162 -0
- package/dist/utils/image-convert.d.ts +8 -0
- package/dist/utils/image-convert.js +38 -0
- package/dist/utils/image-resize.d.ts +35 -0
- package/dist/utils/image-resize.js +136 -0
- package/dist/utils/mime.d.ts +1 -0
- package/dist/utils/mime.js +25 -0
- package/dist/utils/path-shims.d.ts +1 -0
- package/dist/utils/path-shims.js +90 -0
- package/dist/utils/paths.d.ts +6 -0
- package/dist/utils/paths.js +18 -0
- package/dist/utils/photon.d.ts +20 -0
- package/dist/utils/photon.js +120 -0
- package/dist/utils/shell.d.ts +29 -0
- package/dist/utils/shell.js +189 -0
- package/dist/utils/sleep.d.ts +4 -0
- package/dist/utils/sleep.js +16 -0
- package/dist/utils/tools-manager.d.ts +3 -0
- package/dist/utils/tools-manager.js +101 -0
- package/dist/vendor/bin/darwin-arm64/fd +0 -0
- package/dist/vendor/bin/darwin-arm64/rg +0 -0
- package/dist/vendor/bin/darwin-x64/fd +0 -0
- package/dist/vendor/bin/darwin-x64/rg +0 -0
- package/dist/vendor/bin/linux-arm64/fd +0 -0
- package/dist/vendor/bin/linux-arm64/rg +0 -0
- package/dist/vendor/bin/linux-x64/fd +0 -0
- package/dist/vendor/bin/linux-x64/rg +0 -0
- package/dist/vendor/bin/win32-arm64/fd.exe +0 -0
- package/dist/vendor/bin/win32-arm64/rg.exe +0 -0
- package/dist/vendor/bin/win32-x64/fd.exe +0 -0
- package/dist/vendor/bin/win32-x64/rg.exe +0 -0
- package/package.json +90 -26
- package/dist/extension/core.d.ts +0 -69
- package/dist/extension/core.js +0 -270
- package/dist/extension/core.js.map +0 -1
- package/dist/extension/index.d.ts +0 -25
- package/dist/extension/index.js +0 -303
- package/dist/extension/index.js.map +0 -1
- package/dist/main.js.map +0 -1
- package/themes/pizza.json +0 -87
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RPC protocol types for headless operation.
|
|
3
|
+
*
|
|
4
|
+
* Commands are sent as JSON lines on stdin.
|
|
5
|
+
* Responses and events are emitted as JSON lines on stdout.
|
|
6
|
+
*/
|
|
7
|
+
import type { AgentMessage, ThinkingLevel } from "../../core/agent/types.js";
|
|
8
|
+
import type { ImageContent, Model } from "@earendil-works/pi-ai/compat";
|
|
9
|
+
import type { SessionStats } from "../../core/session-stats.js";
|
|
10
|
+
import type { BashResult } from "../../core/bash-executor.js";
|
|
11
|
+
import type { CompactionResult } from "../../core/compaction/index.js";
|
|
12
|
+
import type { SourceInfo } from "../../core/source-info.js";
|
|
13
|
+
export type RpcCommand = {
|
|
14
|
+
id?: string;
|
|
15
|
+
type: "prompt";
|
|
16
|
+
message: string;
|
|
17
|
+
images?: ImageContent[];
|
|
18
|
+
streamingBehavior?: "steer" | "followUp";
|
|
19
|
+
} | {
|
|
20
|
+
id?: string;
|
|
21
|
+
type: "steer";
|
|
22
|
+
message: string;
|
|
23
|
+
images?: ImageContent[];
|
|
24
|
+
} | {
|
|
25
|
+
id?: string;
|
|
26
|
+
type: "follow_up";
|
|
27
|
+
message: string;
|
|
28
|
+
images?: ImageContent[];
|
|
29
|
+
} | {
|
|
30
|
+
id?: string;
|
|
31
|
+
type: "abort";
|
|
32
|
+
} | {
|
|
33
|
+
id?: string;
|
|
34
|
+
type: "rewind";
|
|
35
|
+
targetEventId?: string;
|
|
36
|
+
} | {
|
|
37
|
+
id?: string;
|
|
38
|
+
type: "get_state";
|
|
39
|
+
} | {
|
|
40
|
+
id?: string;
|
|
41
|
+
type: "set_model";
|
|
42
|
+
provider: string;
|
|
43
|
+
modelId: string;
|
|
44
|
+
} | {
|
|
45
|
+
id?: string;
|
|
46
|
+
type: "cycle_model";
|
|
47
|
+
} | {
|
|
48
|
+
id?: string;
|
|
49
|
+
type: "get_available_models";
|
|
50
|
+
} | {
|
|
51
|
+
id?: string;
|
|
52
|
+
type: "set_thinking_level";
|
|
53
|
+
level: ThinkingLevel;
|
|
54
|
+
} | {
|
|
55
|
+
id?: string;
|
|
56
|
+
type: "cycle_thinking_level";
|
|
57
|
+
} | {
|
|
58
|
+
id?: string;
|
|
59
|
+
type: "set_steering_mode";
|
|
60
|
+
mode: "all" | "one-at-a-time";
|
|
61
|
+
} | {
|
|
62
|
+
id?: string;
|
|
63
|
+
type: "set_follow_up_mode";
|
|
64
|
+
mode: "all" | "one-at-a-time";
|
|
65
|
+
} | {
|
|
66
|
+
id?: string;
|
|
67
|
+
type: "compact";
|
|
68
|
+
customInstructions?: string;
|
|
69
|
+
} | {
|
|
70
|
+
id?: string;
|
|
71
|
+
type: "set_auto_compaction";
|
|
72
|
+
enabled: boolean;
|
|
73
|
+
} | {
|
|
74
|
+
id?: string;
|
|
75
|
+
type: "set_auto_retry";
|
|
76
|
+
enabled: boolean;
|
|
77
|
+
} | {
|
|
78
|
+
id?: string;
|
|
79
|
+
type: "abort_retry";
|
|
80
|
+
} | {
|
|
81
|
+
id?: string;
|
|
82
|
+
type: "bash";
|
|
83
|
+
command: string;
|
|
84
|
+
} | {
|
|
85
|
+
id?: string;
|
|
86
|
+
type: "abort_bash";
|
|
87
|
+
} | {
|
|
88
|
+
id?: string;
|
|
89
|
+
type: "get_session_stats";
|
|
90
|
+
} | {
|
|
91
|
+
id?: string;
|
|
92
|
+
type: "export_html";
|
|
93
|
+
outputPath?: string;
|
|
94
|
+
} | {
|
|
95
|
+
id?: string;
|
|
96
|
+
type: "switch_session";
|
|
97
|
+
sessionPath: string;
|
|
98
|
+
} | {
|
|
99
|
+
id?: string;
|
|
100
|
+
type: "fork";
|
|
101
|
+
entryId: string;
|
|
102
|
+
} | {
|
|
103
|
+
id?: string;
|
|
104
|
+
type: "clone";
|
|
105
|
+
} | {
|
|
106
|
+
id?: string;
|
|
107
|
+
type: "get_fork_messages";
|
|
108
|
+
} | {
|
|
109
|
+
id?: string;
|
|
110
|
+
type: "get_last_assistant_text";
|
|
111
|
+
} | {
|
|
112
|
+
id?: string;
|
|
113
|
+
type: "get_messages";
|
|
114
|
+
} | {
|
|
115
|
+
id?: string;
|
|
116
|
+
type: "get_commands";
|
|
117
|
+
};
|
|
118
|
+
/** A command available for invocation via prompt */
|
|
119
|
+
export interface RpcSlashCommand {
|
|
120
|
+
/** Command name (without leading slash) */
|
|
121
|
+
name: string;
|
|
122
|
+
/** Human-readable description */
|
|
123
|
+
description?: string;
|
|
124
|
+
/** What kind of command this is */
|
|
125
|
+
source: "extension" | "prompt" | "skill";
|
|
126
|
+
/** Source metadata for the owning resource */
|
|
127
|
+
sourceInfo: SourceInfo;
|
|
128
|
+
}
|
|
129
|
+
export interface RpcSessionState {
|
|
130
|
+
model?: Model<any>;
|
|
131
|
+
thinkingLevel: ThinkingLevel;
|
|
132
|
+
isStreaming: boolean;
|
|
133
|
+
isCompacting: boolean;
|
|
134
|
+
sessionFile?: string;
|
|
135
|
+
sessionId: string;
|
|
136
|
+
autoCompactionEnabled: boolean;
|
|
137
|
+
messageCount: number;
|
|
138
|
+
pendingMessageCount: number;
|
|
139
|
+
}
|
|
140
|
+
export type RpcResponse = {
|
|
141
|
+
id?: string;
|
|
142
|
+
type: "response";
|
|
143
|
+
command: "prompt";
|
|
144
|
+
success: true;
|
|
145
|
+
} | {
|
|
146
|
+
id?: string;
|
|
147
|
+
type: "response";
|
|
148
|
+
command: "steer";
|
|
149
|
+
success: true;
|
|
150
|
+
} | {
|
|
151
|
+
id?: string;
|
|
152
|
+
type: "response";
|
|
153
|
+
command: "follow_up";
|
|
154
|
+
success: true;
|
|
155
|
+
} | {
|
|
156
|
+
id?: string;
|
|
157
|
+
type: "response";
|
|
158
|
+
command: "abort";
|
|
159
|
+
success: true;
|
|
160
|
+
} | {
|
|
161
|
+
id?: string;
|
|
162
|
+
type: "response";
|
|
163
|
+
command: "rewind";
|
|
164
|
+
success: true;
|
|
165
|
+
data: {
|
|
166
|
+
cancelled: boolean;
|
|
167
|
+
};
|
|
168
|
+
} | {
|
|
169
|
+
id?: string;
|
|
170
|
+
type: "response";
|
|
171
|
+
command: "get_state";
|
|
172
|
+
success: true;
|
|
173
|
+
data: RpcSessionState;
|
|
174
|
+
} | {
|
|
175
|
+
id?: string;
|
|
176
|
+
type: "response";
|
|
177
|
+
command: "set_model";
|
|
178
|
+
success: true;
|
|
179
|
+
data: Model<any>;
|
|
180
|
+
} | {
|
|
181
|
+
id?: string;
|
|
182
|
+
type: "response";
|
|
183
|
+
command: "cycle_model";
|
|
184
|
+
success: true;
|
|
185
|
+
data: {
|
|
186
|
+
model: Model<any>;
|
|
187
|
+
thinkingLevel: ThinkingLevel;
|
|
188
|
+
isScoped: boolean;
|
|
189
|
+
} | null;
|
|
190
|
+
} | {
|
|
191
|
+
id?: string;
|
|
192
|
+
type: "response";
|
|
193
|
+
command: "get_available_models";
|
|
194
|
+
success: true;
|
|
195
|
+
data: {
|
|
196
|
+
models: Model<any>[];
|
|
197
|
+
};
|
|
198
|
+
} | {
|
|
199
|
+
id?: string;
|
|
200
|
+
type: "response";
|
|
201
|
+
command: "set_thinking_level";
|
|
202
|
+
success: true;
|
|
203
|
+
} | {
|
|
204
|
+
id?: string;
|
|
205
|
+
type: "response";
|
|
206
|
+
command: "cycle_thinking_level";
|
|
207
|
+
success: true;
|
|
208
|
+
data: {
|
|
209
|
+
level: ThinkingLevel;
|
|
210
|
+
} | null;
|
|
211
|
+
} | {
|
|
212
|
+
id?: string;
|
|
213
|
+
type: "response";
|
|
214
|
+
command: "set_steering_mode";
|
|
215
|
+
success: true;
|
|
216
|
+
} | {
|
|
217
|
+
id?: string;
|
|
218
|
+
type: "response";
|
|
219
|
+
command: "set_follow_up_mode";
|
|
220
|
+
success: true;
|
|
221
|
+
} | {
|
|
222
|
+
id?: string;
|
|
223
|
+
type: "response";
|
|
224
|
+
command: "compact";
|
|
225
|
+
success: true;
|
|
226
|
+
data: CompactionResult;
|
|
227
|
+
} | {
|
|
228
|
+
id?: string;
|
|
229
|
+
type: "response";
|
|
230
|
+
command: "set_auto_compaction";
|
|
231
|
+
success: true;
|
|
232
|
+
} | {
|
|
233
|
+
id?: string;
|
|
234
|
+
type: "response";
|
|
235
|
+
command: "set_auto_retry";
|
|
236
|
+
success: true;
|
|
237
|
+
} | {
|
|
238
|
+
id?: string;
|
|
239
|
+
type: "response";
|
|
240
|
+
command: "abort_retry";
|
|
241
|
+
success: true;
|
|
242
|
+
} | {
|
|
243
|
+
id?: string;
|
|
244
|
+
type: "response";
|
|
245
|
+
command: "bash";
|
|
246
|
+
success: true;
|
|
247
|
+
data: BashResult;
|
|
248
|
+
} | {
|
|
249
|
+
id?: string;
|
|
250
|
+
type: "response";
|
|
251
|
+
command: "abort_bash";
|
|
252
|
+
success: true;
|
|
253
|
+
} | {
|
|
254
|
+
id?: string;
|
|
255
|
+
type: "response";
|
|
256
|
+
command: "get_session_stats";
|
|
257
|
+
success: true;
|
|
258
|
+
data: SessionStats;
|
|
259
|
+
} | {
|
|
260
|
+
id?: string;
|
|
261
|
+
type: "response";
|
|
262
|
+
command: "export_html";
|
|
263
|
+
success: true;
|
|
264
|
+
data: {
|
|
265
|
+
path: string;
|
|
266
|
+
};
|
|
267
|
+
} | {
|
|
268
|
+
id?: string;
|
|
269
|
+
type: "response";
|
|
270
|
+
command: "switch_session";
|
|
271
|
+
success: true;
|
|
272
|
+
data: {
|
|
273
|
+
cancelled: boolean;
|
|
274
|
+
};
|
|
275
|
+
} | {
|
|
276
|
+
id?: string;
|
|
277
|
+
type: "response";
|
|
278
|
+
command: "fork";
|
|
279
|
+
success: true;
|
|
280
|
+
data: {
|
|
281
|
+
text: string;
|
|
282
|
+
cancelled: boolean;
|
|
283
|
+
};
|
|
284
|
+
} | {
|
|
285
|
+
id?: string;
|
|
286
|
+
type: "response";
|
|
287
|
+
command: "clone";
|
|
288
|
+
success: true;
|
|
289
|
+
data: {
|
|
290
|
+
cancelled: boolean;
|
|
291
|
+
};
|
|
292
|
+
} | {
|
|
293
|
+
id?: string;
|
|
294
|
+
type: "response";
|
|
295
|
+
command: "get_fork_messages";
|
|
296
|
+
success: true;
|
|
297
|
+
data: {
|
|
298
|
+
messages: Array<{
|
|
299
|
+
entryId: string;
|
|
300
|
+
text: string;
|
|
301
|
+
}>;
|
|
302
|
+
};
|
|
303
|
+
} | {
|
|
304
|
+
id?: string;
|
|
305
|
+
type: "response";
|
|
306
|
+
command: "get_last_assistant_text";
|
|
307
|
+
success: true;
|
|
308
|
+
data: {
|
|
309
|
+
text: string | null;
|
|
310
|
+
};
|
|
311
|
+
} | {
|
|
312
|
+
id?: string;
|
|
313
|
+
type: "response";
|
|
314
|
+
command: "get_messages";
|
|
315
|
+
success: true;
|
|
316
|
+
data: {
|
|
317
|
+
messages: AgentMessage[];
|
|
318
|
+
};
|
|
319
|
+
} | {
|
|
320
|
+
id?: string;
|
|
321
|
+
type: "response";
|
|
322
|
+
command: "get_commands";
|
|
323
|
+
success: true;
|
|
324
|
+
data: {
|
|
325
|
+
commands: RpcSlashCommand[];
|
|
326
|
+
};
|
|
327
|
+
} | {
|
|
328
|
+
id?: string;
|
|
329
|
+
type: "response";
|
|
330
|
+
command: string;
|
|
331
|
+
success: false;
|
|
332
|
+
error: string;
|
|
333
|
+
};
|
|
334
|
+
/** Emitted when an extension needs user input */
|
|
335
|
+
export type RpcExtensionUIRequest = {
|
|
336
|
+
type: "extension_ui_request";
|
|
337
|
+
id: string;
|
|
338
|
+
method: "select";
|
|
339
|
+
title: string;
|
|
340
|
+
options: string[];
|
|
341
|
+
timeout?: number;
|
|
342
|
+
} | {
|
|
343
|
+
type: "extension_ui_request";
|
|
344
|
+
id: string;
|
|
345
|
+
method: "confirm";
|
|
346
|
+
title: string;
|
|
347
|
+
message: string;
|
|
348
|
+
timeout?: number;
|
|
349
|
+
} | {
|
|
350
|
+
type: "extension_ui_request";
|
|
351
|
+
id: string;
|
|
352
|
+
method: "input";
|
|
353
|
+
title: string;
|
|
354
|
+
placeholder?: string;
|
|
355
|
+
timeout?: number;
|
|
356
|
+
} | {
|
|
357
|
+
type: "extension_ui_request";
|
|
358
|
+
id: string;
|
|
359
|
+
method: "editor";
|
|
360
|
+
title: string;
|
|
361
|
+
prefill?: string;
|
|
362
|
+
} | {
|
|
363
|
+
type: "extension_ui_request";
|
|
364
|
+
id: string;
|
|
365
|
+
method: "notify";
|
|
366
|
+
message: string;
|
|
367
|
+
notifyType?: "info" | "warning" | "error";
|
|
368
|
+
} | {
|
|
369
|
+
type: "extension_ui_request";
|
|
370
|
+
id: string;
|
|
371
|
+
method: "setStatus";
|
|
372
|
+
statusKey: string;
|
|
373
|
+
statusText: string | undefined;
|
|
374
|
+
} | {
|
|
375
|
+
type: "extension_ui_request";
|
|
376
|
+
id: string;
|
|
377
|
+
method: "setWidget";
|
|
378
|
+
widgetKey: string;
|
|
379
|
+
widgetLines: string[] | undefined;
|
|
380
|
+
widgetPlacement?: "aboveEditor" | "belowEditor";
|
|
381
|
+
} | {
|
|
382
|
+
type: "extension_ui_request";
|
|
383
|
+
id: string;
|
|
384
|
+
method: "setTitle";
|
|
385
|
+
title: string;
|
|
386
|
+
} | {
|
|
387
|
+
type: "extension_ui_request";
|
|
388
|
+
id: string;
|
|
389
|
+
method: "set_editor_text";
|
|
390
|
+
text: string;
|
|
391
|
+
};
|
|
392
|
+
/** Response to an extension UI request */
|
|
393
|
+
export type RpcExtensionUIResponse = {
|
|
394
|
+
type: "extension_ui_response";
|
|
395
|
+
id: string;
|
|
396
|
+
value: string;
|
|
397
|
+
} | {
|
|
398
|
+
type: "extension_ui_response";
|
|
399
|
+
id: string;
|
|
400
|
+
confirmed: boolean;
|
|
401
|
+
} | {
|
|
402
|
+
type: "extension_ui_response";
|
|
403
|
+
id: string;
|
|
404
|
+
cancelled: true;
|
|
405
|
+
};
|
|
406
|
+
export type RpcCommandType = RpcCommand["type"];
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { selectConfig } from "./cli/config-selector.js";
|
|
3
|
+
import { APP_NAME, CONFIG_DIR_NAME, getAgentDir } from "./config.js";
|
|
4
|
+
import { DefaultPackageManager } from "./core/package-manager.js";
|
|
5
|
+
import { SettingsManager } from "./core/settings-manager.js";
|
|
6
|
+
function reportSettingsErrors(settingsManager, context) {
|
|
7
|
+
const errors = settingsManager.drainErrors();
|
|
8
|
+
for (const { scope, error } of errors) {
|
|
9
|
+
console.error(chalk.yellow(`Warning (${context}, ${scope} settings): ${error.message}`));
|
|
10
|
+
if (error.stack) {
|
|
11
|
+
console.error(chalk.dim(error.stack));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function getPackageCommandUsage(command) {
|
|
16
|
+
switch (command) {
|
|
17
|
+
case "install":
|
|
18
|
+
return `${APP_NAME} install <source> [-l]`;
|
|
19
|
+
case "remove":
|
|
20
|
+
return `${APP_NAME} remove <source> [-l]`;
|
|
21
|
+
case "update":
|
|
22
|
+
return `${APP_NAME} update [source]`;
|
|
23
|
+
case "list":
|
|
24
|
+
return `${APP_NAME} list`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function printPackageCommandHelp(command) {
|
|
28
|
+
switch (command) {
|
|
29
|
+
case "install":
|
|
30
|
+
console.log(`${chalk.bold("Usage:")}
|
|
31
|
+
${getPackageCommandUsage("install")}
|
|
32
|
+
|
|
33
|
+
Install a package and add it to settings.
|
|
34
|
+
|
|
35
|
+
Options:
|
|
36
|
+
-l, --local Install project-locally (${CONFIG_DIR_NAME}/settings.json)
|
|
37
|
+
|
|
38
|
+
Examples:
|
|
39
|
+
${APP_NAME} install npm:@foo/bar
|
|
40
|
+
${APP_NAME} install git:github.com/user/repo
|
|
41
|
+
${APP_NAME} install git:git@github.com:user/repo
|
|
42
|
+
${APP_NAME} install https://github.com/user/repo
|
|
43
|
+
${APP_NAME} install ssh://git@github.com/user/repo
|
|
44
|
+
${APP_NAME} install ./local/path
|
|
45
|
+
`);
|
|
46
|
+
return;
|
|
47
|
+
case "remove":
|
|
48
|
+
console.log(`${chalk.bold("Usage:")}
|
|
49
|
+
${getPackageCommandUsage("remove")}
|
|
50
|
+
|
|
51
|
+
Remove a package and its source from settings.
|
|
52
|
+
Alias: ${APP_NAME} uninstall <source> [-l]
|
|
53
|
+
|
|
54
|
+
Options:
|
|
55
|
+
-l, --local Remove from project settings (${CONFIG_DIR_NAME}/settings.json)
|
|
56
|
+
|
|
57
|
+
Examples:
|
|
58
|
+
${APP_NAME} remove npm:@foo/bar
|
|
59
|
+
${APP_NAME} uninstall npm:@foo/bar
|
|
60
|
+
`);
|
|
61
|
+
return;
|
|
62
|
+
case "update":
|
|
63
|
+
console.log(`${chalk.bold("Usage:")}
|
|
64
|
+
${getPackageCommandUsage("update")}
|
|
65
|
+
|
|
66
|
+
Update installed packages.
|
|
67
|
+
If <source> is provided, only that package is updated.
|
|
68
|
+
`);
|
|
69
|
+
return;
|
|
70
|
+
case "list":
|
|
71
|
+
console.log(`${chalk.bold("Usage:")}
|
|
72
|
+
${getPackageCommandUsage("list")}
|
|
73
|
+
|
|
74
|
+
List installed packages from user and project settings.
|
|
75
|
+
`);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function parsePackageCommand(args) {
|
|
80
|
+
const [rawCommand, ...rest] = args;
|
|
81
|
+
let command;
|
|
82
|
+
if (rawCommand === "uninstall") {
|
|
83
|
+
command = "remove";
|
|
84
|
+
}
|
|
85
|
+
else if (rawCommand === "install" || rawCommand === "remove" || rawCommand === "update" || rawCommand === "list") {
|
|
86
|
+
command = rawCommand;
|
|
87
|
+
}
|
|
88
|
+
if (!command) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
let local = false;
|
|
92
|
+
let help = false;
|
|
93
|
+
let invalidOption;
|
|
94
|
+
let source;
|
|
95
|
+
for (const arg of rest) {
|
|
96
|
+
if (arg === "-h" || arg === "--help") {
|
|
97
|
+
help = true;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (arg === "-l" || arg === "--local") {
|
|
101
|
+
if (command === "install" || command === "remove") {
|
|
102
|
+
local = true;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
invalidOption = invalidOption ?? arg;
|
|
106
|
+
}
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (arg.startsWith("-")) {
|
|
110
|
+
invalidOption = invalidOption ?? arg;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (!source) {
|
|
114
|
+
source = arg;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return { command, source, local, help, invalidOption };
|
|
118
|
+
}
|
|
119
|
+
export async function handleConfigCommand(args) {
|
|
120
|
+
if (args[0] !== "config") {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
const cwd = process.cwd();
|
|
124
|
+
const agentDir = getAgentDir();
|
|
125
|
+
const settingsManager = SettingsManager.create(cwd, agentDir);
|
|
126
|
+
reportSettingsErrors(settingsManager, "config command");
|
|
127
|
+
const packageManager = new DefaultPackageManager({ cwd, agentDir, settingsManager });
|
|
128
|
+
const resolvedPaths = await packageManager.resolve();
|
|
129
|
+
await selectConfig({
|
|
130
|
+
resolvedPaths,
|
|
131
|
+
settingsManager,
|
|
132
|
+
cwd,
|
|
133
|
+
agentDir,
|
|
134
|
+
});
|
|
135
|
+
process.exit(0);
|
|
136
|
+
}
|
|
137
|
+
export async function handlePackageCommand(args) {
|
|
138
|
+
const options = parsePackageCommand(args);
|
|
139
|
+
if (!options) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
if (options.help) {
|
|
143
|
+
printPackageCommandHelp(options.command);
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
if (options.invalidOption) {
|
|
147
|
+
console.error(chalk.red(`Unknown option ${options.invalidOption} for "${options.command}".`));
|
|
148
|
+
console.error(chalk.dim(`Use "${APP_NAME} --help" or "${getPackageCommandUsage(options.command)}".`));
|
|
149
|
+
process.exitCode = 1;
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
const source = options.source;
|
|
153
|
+
if ((options.command === "install" || options.command === "remove") && !source) {
|
|
154
|
+
console.error(chalk.red(`Missing ${options.command} source.`));
|
|
155
|
+
console.error(chalk.dim(`Usage: ${getPackageCommandUsage(options.command)}`));
|
|
156
|
+
process.exitCode = 1;
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
const cwd = process.cwd();
|
|
160
|
+
const agentDir = getAgentDir();
|
|
161
|
+
const settingsManager = SettingsManager.create(cwd, agentDir);
|
|
162
|
+
reportSettingsErrors(settingsManager, "package command");
|
|
163
|
+
const packageManager = new DefaultPackageManager({ cwd, agentDir, settingsManager });
|
|
164
|
+
packageManager.setProgressCallback((event) => {
|
|
165
|
+
if (event.type === "start") {
|
|
166
|
+
process.stdout.write(chalk.dim(`${event.message}\n`));
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
try {
|
|
170
|
+
switch (options.command) {
|
|
171
|
+
case "install":
|
|
172
|
+
await packageManager.installAndPersist(source, { local: options.local });
|
|
173
|
+
console.log(chalk.green(`Installed ${source}`));
|
|
174
|
+
return true;
|
|
175
|
+
case "remove": {
|
|
176
|
+
const removed = await packageManager.removeAndPersist(source, { local: options.local });
|
|
177
|
+
if (!removed) {
|
|
178
|
+
console.error(chalk.red(`No matching package found for ${source}`));
|
|
179
|
+
process.exitCode = 1;
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
console.log(chalk.green(`Removed ${source}`));
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
case "list": {
|
|
186
|
+
const configuredPackages = packageManager.listConfiguredPackages();
|
|
187
|
+
const userPackages = configuredPackages.filter((pkg) => pkg.scope === "user");
|
|
188
|
+
const projectPackages = configuredPackages.filter((pkg) => pkg.scope === "project");
|
|
189
|
+
if (configuredPackages.length === 0) {
|
|
190
|
+
console.log(chalk.dim("No packages installed."));
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
193
|
+
const formatPackage = (pkg) => {
|
|
194
|
+
const display = pkg.filtered ? `${pkg.source} (filtered)` : pkg.source;
|
|
195
|
+
console.log(` ${display}`);
|
|
196
|
+
if (pkg.installedPath) {
|
|
197
|
+
console.log(chalk.dim(` ${pkg.installedPath}`));
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
if (userPackages.length > 0) {
|
|
201
|
+
console.log(chalk.bold("User packages:"));
|
|
202
|
+
for (const pkg of userPackages) {
|
|
203
|
+
formatPackage(pkg);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (projectPackages.length > 0) {
|
|
207
|
+
if (userPackages.length > 0)
|
|
208
|
+
console.log();
|
|
209
|
+
console.log(chalk.bold("Project packages:"));
|
|
210
|
+
for (const pkg of projectPackages) {
|
|
211
|
+
formatPackage(pkg);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
case "update":
|
|
217
|
+
await packageManager.update(source);
|
|
218
|
+
if (source) {
|
|
219
|
+
console.log(chalk.green(`Updated ${source}`));
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
console.log(chalk.green("Updated packages"));
|
|
223
|
+
}
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
const message = error instanceof Error ? error.message : "Unknown package command error";
|
|
229
|
+
console.error(chalk.red(`Error: ${message}`));
|
|
230
|
+
process.exitCode = 1;
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ChangelogEntry {
|
|
2
|
+
major: number;
|
|
3
|
+
minor: number;
|
|
4
|
+
patch: number;
|
|
5
|
+
content: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Parse changelog entries from CHANGELOG.md
|
|
9
|
+
* Scans for ## lines and collects content until next ## or EOF
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseChangelog(changelogPath: string): ChangelogEntry[];
|
|
12
|
+
/**
|
|
13
|
+
* Compare versions. Returns: -1 if v1 < v2, 0 if v1 === v2, 1 if v1 > v2
|
|
14
|
+
*/
|
|
15
|
+
export declare function compareVersions(v1: ChangelogEntry, v2: ChangelogEntry): number;
|
|
16
|
+
/**
|
|
17
|
+
* Get entries newer than lastVersion
|
|
18
|
+
*/
|
|
19
|
+
export declare function getNewEntries(entries: ChangelogEntry[], lastVersion: string): ChangelogEntry[];
|
|
20
|
+
export { getChangelogPath } from "../config.js";
|