indusagi-coding-agent 0.1.38 → 0.1.40
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/CHANGELOG.md +22 -7
- package/{LICENSE.md → LICENSE} +0 -1
- package/README.md +2 -4
- package/dist/cli/args.d.ts +6 -128
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +277 -472
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts +9 -62
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +31 -146
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/file-processor.d.ts +1 -69
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +36 -267
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/list-models.d.ts +0 -60
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +53 -246
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/session-picker.d.ts +1 -72
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +57 -231
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli.js +25 -31
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +0 -42
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +62 -97
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +26 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +78 -66
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +4 -95
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +233 -288
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts +0 -323
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +126 -359
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +3 -3
- package/dist/core/compaction/branch-summarization.js +16 -16
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +3 -3
- package/dist/core/compaction/compaction.js +40 -40
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/index.d.ts +32 -4
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +30 -4
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +1 -19
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +92 -113
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/discover-packages.d.ts +0 -4
- package/dist/core/discover-packages.d.ts.map +1 -1
- package/dist/core/discover-packages.js +41 -44
- package/dist/core/discover-packages.js.map +1 -1
- package/dist/core/event-bus.d.ts +1 -147
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js +17 -106
- package/dist/core/event-bus.js.map +1 -1
- package/dist/core/exec.d.ts +0 -16
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js +18 -27
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.ts +262 -0
- package/dist/core/export-html/index.ts +433 -0
- package/dist/core/export-html/template.html +48 -26
- package/dist/core/export-html/tool-renderer.d.ts +0 -21
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +35 -51
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/export-html/tool-renderer.ts +80 -0
- package/dist/core/export-html/vendor/highlight.min.js +401 -370
- package/dist/core/export-html/vendor/marked.min.js +71 -3
- package/dist/core/extensions/index.d.ts +7 -4
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +17 -3
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +0 -6
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +60 -56
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +3 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +48 -80
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +50 -23
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/footer-data-provider.d.ts +2 -15
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +21 -33
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/hooks/loader.js +2 -2
- package/dist/core/hooks/loader.js.map +1 -1
- package/dist/core/index.d.ts +29 -10
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +29 -10
- package/dist/core/index.js.map +1 -1
- package/dist/core/keybindings.d.ts +2 -179
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +64 -238
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-registry.d.ts +26 -181
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +228 -407
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts +0 -139
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +34 -215
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/package-manager.d.ts +25 -57
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +326 -964
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/prompt-templates.d.ts +2 -34
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +122 -170
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/resource-loader.d.ts +19 -12
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +353 -467
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +2 -61
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +184 -252
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +447 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +1176 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +9 -12
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +170 -398
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +2 -27
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +149 -212
- package/dist/core/skills.js.map +1 -1
- package/dist/core/subagents.d.ts +2 -2
- package/dist/core/subagents.d.ts.map +1 -1
- package/dist/core/subagents.js +21 -14
- package/dist/core/subagents.js.map +1 -1
- package/dist/core/system-prompt.d.ts +0 -11
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +168 -139
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/timings.d.ts +1 -4
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +34 -18
- package/dist/core/timings.js.map +1 -1
- package/dist/core/todo-store.d.ts +20 -0
- package/dist/core/todo-store.d.ts.map +1 -0
- package/dist/core/todo-store.js +60 -0
- package/dist/core/todo-store.js.map +1 -0
- package/dist/core/tools/bash.d.ts +2 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +2 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/bg-process.d.ts +1 -6
- package/dist/core/tools/bg-process.d.ts.map +1 -1
- package/dist/core/tools/bg-process.js +4 -18
- package/dist/core/tools/bg-process.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +9 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +2 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +2 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +2 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/find.d.ts +2 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +2 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +2 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +2 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/index.d.ts +8 -2
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/ls.d.ts +2 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +2 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/memory.d.ts +50 -1
- package/dist/core/tools/memory.d.ts.map +1 -1
- package/dist/core/tools/memory.js +11 -7
- package/dist/core/tools/memory.js.map +1 -1
- package/dist/core/tools/path-utils.d.ts +2 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +2 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/read.d.ts +2 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +2 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/registry.d.ts +0 -15
- package/dist/core/tools/registry.d.ts.map +1 -1
- package/dist/core/tools/registry.js +13 -37
- package/dist/core/tools/registry.js.map +1 -1
- package/dist/core/tools/task.d.ts +17 -23
- package/dist/core/tools/task.d.ts.map +1 -1
- package/dist/core/tools/task.js +43 -82
- package/dist/core/tools/task.js.map +1 -1
- package/dist/core/tools/todo.d.ts +17 -20
- package/dist/core/tools/todo.d.ts.map +1 -1
- package/dist/core/tools/todo.js +79 -58
- package/dist/core/tools/todo.js.map +1 -1
- package/dist/core/tools/truncate.d.ts +2 -0
- package/dist/core/tools/truncate.d.ts.map +1 -0
- package/dist/core/tools/truncate.js +2 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/webfetch.d.ts +2 -0
- package/dist/core/tools/webfetch.d.ts.map +1 -0
- package/dist/core/tools/webfetch.js +2 -0
- package/dist/core/tools/webfetch.js.map +1 -0
- package/dist/core/tools/websearch.d.ts +2 -0
- package/dist/core/tools/websearch.d.ts.map +1 -0
- package/dist/core/tools/websearch.js +2 -0
- package/dist/core/tools/websearch.js.map +1 -0
- package/dist/core/tools/write.d.ts +2 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +2 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/index.d.ts +35 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -41
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +237 -225
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +0 -25
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +129 -180
- package/dist/migrations.js.map +1 -1
- package/dist/modes/index.d.ts +13 -6
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js +11 -5
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/components/armin.d.ts +8 -23
- package/dist/modes/interactive/components/armin.d.ts.map +1 -1
- package/dist/modes/interactive/components/armin.js +217 -266
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +2 -168
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +61 -216
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts +6 -313
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +86 -403
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts +1 -3
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +59 -29
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts +3 -3
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +30 -17
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +3 -3
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +35 -18
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +60 -68
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts +2 -6
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.js +32 -18
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +1 -5
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +45 -37
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +5 -6
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +43 -53
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts +0 -3
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js +101 -108
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts +7 -2
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +24 -4
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +5 -9
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +43 -46
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts +4 -9
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +45 -28
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +7 -12
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +54 -32
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +2 -11
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +135 -183
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +79 -30
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +73 -31
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +0 -18
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +24 -31
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +11 -24
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +89 -86
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +15 -19
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +104 -157
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +5 -5
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +12 -22
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +111 -132
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts +3 -3
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js +92 -103
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +28 -39
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +111 -203
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +17 -19
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +3 -3
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +29 -19
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts +2 -2
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +20 -25
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +19 -20
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +12 -10
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +14 -8
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +53 -60
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts +3 -9
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +57 -68
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts +0 -12
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js +14 -22
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +6 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +118 -113
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +189 -39
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +8 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +88 -59
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +24 -46
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +75 -409
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js +21 -360
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/observability/core/config.d.ts +28 -0
- package/dist/observability/core/config.d.ts.map +1 -0
- package/dist/observability/core/config.js +150 -0
- package/dist/observability/core/config.js.map +1 -0
- package/dist/observability/core/event-bus.d.ts +15 -0
- package/dist/observability/core/event-bus.d.ts.map +1 -0
- package/dist/observability/core/event-bus.js +37 -0
- package/dist/observability/core/event-bus.js.map +1 -0
- package/dist/observability/core/index.d.ts +12 -0
- package/dist/observability/core/index.d.ts.map +1 -0
- package/dist/observability/core/index.js +14 -0
- package/dist/observability/core/index.js.map +1 -0
- package/dist/observability/core/observability.d.ts +63 -0
- package/dist/observability/core/observability.d.ts.map +1 -0
- package/dist/observability/core/observability.js +127 -0
- package/dist/observability/core/observability.js.map +1 -0
- package/dist/observability/core/span.d.ts +37 -0
- package/dist/observability/core/span.d.ts.map +1 -0
- package/dist/observability/core/span.js +90 -0
- package/dist/observability/core/span.js.map +1 -0
- package/dist/observability/core/tracer.d.ts +22 -0
- package/dist/observability/core/tracer.d.ts.map +1 -0
- package/dist/observability/core/tracer.js +79 -0
- package/dist/observability/core/tracer.js.map +1 -0
- package/dist/observability/core/types.d.ts +155 -0
- package/dist/observability/core/types.d.ts.map +1 -0
- package/dist/observability/core/types.js +38 -0
- package/dist/observability/core/types.js.map +1 -0
- package/dist/observability/exporters/base-exporter.d.ts +16 -0
- package/dist/observability/exporters/base-exporter.d.ts.map +1 -0
- package/dist/observability/exporters/base-exporter.js +26 -0
- package/dist/observability/exporters/base-exporter.js.map +1 -0
- package/dist/observability/exporters/console-exporter.d.ts +22 -0
- package/dist/observability/exporters/console-exporter.d.ts.map +1 -0
- package/dist/observability/exporters/console-exporter.js +80 -0
- package/dist/observability/exporters/console-exporter.js.map +1 -0
- package/dist/observability/exporters/file-exporter.d.ts +31 -0
- package/dist/observability/exporters/file-exporter.d.ts.map +1 -0
- package/dist/observability/exporters/file-exporter.js +120 -0
- package/dist/observability/exporters/file-exporter.js.map +1 -0
- package/dist/observability/exporters/index.d.ts +12 -0
- package/dist/observability/exporters/index.d.ts.map +1 -0
- package/dist/observability/exporters/index.js +11 -0
- package/dist/observability/exporters/index.js.map +1 -0
- package/dist/observability/exporters/langfuse-exporter.d.ts +27 -0
- package/dist/observability/exporters/langfuse-exporter.d.ts.map +1 -0
- package/dist/observability/exporters/langfuse-exporter.js +146 -0
- package/dist/observability/exporters/langfuse-exporter.js.map +1 -0
- package/dist/observability/exporters/sentry-exporter.d.ts +22 -0
- package/dist/observability/exporters/sentry-exporter.d.ts.map +1 -0
- package/dist/observability/exporters/sentry-exporter.js +121 -0
- package/dist/observability/exporters/sentry-exporter.js.map +1 -0
- package/dist/observability/index.d.ts +3 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +3 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/utils/changelog.d.ts +1 -2
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +53 -61
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +77 -83
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +62 -49
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/image-convert.d.ts +6 -6
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js +29 -23
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-resize.d.ts +0 -17
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +100 -138
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/mime.d.ts +1 -0
- package/dist/utils/mime.d.ts.map +1 -1
- package/dist/utils/mime.js +35 -15
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/photon.d.ts +4 -15
- package/dist/utils/photon.d.ts.map +1 -1
- package/dist/utils/photon.js +71 -60
- package/dist/utils/photon.js.map +1 -1
- package/dist/utils/shell.d.ts +4 -21
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +101 -124
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/sleep.d.ts +1 -1
- package/dist/utils/sleep.d.ts.map +1 -1
- package/dist/utils/sleep.js +32 -8
- package/dist/utils/sleep.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +4 -2
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +96 -122
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/PI_MONO_MIT_REMOVAL_GUIDE.md +2132 -0
- package/docs/SAME_TO_SAME_PARITY_REPORT.md +312 -0
- package/examples/README.md +12 -0
- package/package.json +62 -88
- package/dist/modes/interactive/theme/dark.json +0 -85
- package/dist/modes/interactive/theme/light.json +0 -84
- package/dist/modes/interactive/theme/theme-schema.json +0 -335
- package/docs/FEATURES.md +0 -306
- package/docs/MCP.md +0 -341
- package/docs/MEMORY.md +0 -443
- package/examples/mcp-servers.example.json +0 -50
|
@@ -13,78 +13,99 @@ import { loadPromptTemplates } from "./prompt-templates.js";
|
|
|
13
13
|
import { SettingsManager } from "./settings-manager.js";
|
|
14
14
|
import { loadSkills } from "./skills.js";
|
|
15
15
|
function resolvePromptInput(input, description) {
|
|
16
|
-
if (!input)
|
|
16
|
+
if (!input)
|
|
17
17
|
return undefined;
|
|
18
|
+
if (!existsSync(input))
|
|
19
|
+
return input;
|
|
20
|
+
try {
|
|
21
|
+
return readFileSync(input, "utf-8");
|
|
18
22
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
console.error(chalk.yellow(`Warning: Could not read ${description} file ${input}: ${error}`));
|
|
25
|
-
return input;
|
|
26
|
-
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
console.error(chalk.yellow(`Warning: Could not read ${description} file ${input}: ${error}`));
|
|
25
|
+
return input;
|
|
27
26
|
}
|
|
28
|
-
return input;
|
|
29
27
|
}
|
|
30
28
|
function loadContextFileFromDir(dir) {
|
|
31
|
-
const
|
|
32
|
-
for (const filename of candidates) {
|
|
29
|
+
for (const filename of ["AGENTS.md", "CLAUDE.md"]) {
|
|
33
30
|
const filePath = join(dir, filename);
|
|
34
|
-
if (existsSync(filePath)) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
console.error(chalk.yellow(`Warning: Could not read ${filePath}: ${error}`));
|
|
43
|
-
}
|
|
31
|
+
if (!existsSync(filePath)) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
return { path: filePath, content: readFileSync(filePath, "utf-8") };
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error(chalk.yellow(`Warning: Could not read ${filePath}: ${error}`));
|
|
44
39
|
}
|
|
45
40
|
}
|
|
46
41
|
return null;
|
|
47
42
|
}
|
|
48
43
|
function loadProjectContextFiles(options = {}) {
|
|
49
|
-
const
|
|
50
|
-
const
|
|
44
|
+
const cwd = options.cwd ?? process.cwd();
|
|
45
|
+
const agentDir = options.agentDir ?? getAgentDir();
|
|
51
46
|
const contextFiles = [];
|
|
52
|
-
const
|
|
53
|
-
const globalContext = loadContextFileFromDir(
|
|
47
|
+
const seen = new Set();
|
|
48
|
+
const globalContext = loadContextFileFromDir(agentDir);
|
|
54
49
|
if (globalContext) {
|
|
55
50
|
contextFiles.push(globalContext);
|
|
56
|
-
|
|
51
|
+
seen.add(globalContext.path);
|
|
57
52
|
}
|
|
58
|
-
const
|
|
59
|
-
let currentDir =
|
|
53
|
+
const ancestorFiles = [];
|
|
54
|
+
let currentDir = cwd;
|
|
60
55
|
const root = resolve("/");
|
|
61
56
|
while (true) {
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
const candidate = loadContextFileFromDir(currentDir);
|
|
58
|
+
if (candidate && !seen.has(candidate.path)) {
|
|
59
|
+
ancestorFiles.unshift(candidate);
|
|
60
|
+
seen.add(candidate.path);
|
|
66
61
|
}
|
|
67
|
-
if (currentDir === root)
|
|
62
|
+
if (currentDir === root) {
|
|
68
63
|
break;
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
}
|
|
65
|
+
const parent = resolve(currentDir, "..");
|
|
66
|
+
if (parent === currentDir) {
|
|
71
67
|
break;
|
|
72
|
-
|
|
68
|
+
}
|
|
69
|
+
currentDir = parent;
|
|
73
70
|
}
|
|
74
|
-
contextFiles.push(...
|
|
71
|
+
contextFiles.push(...ancestorFiles);
|
|
75
72
|
return contextFiles;
|
|
76
73
|
}
|
|
74
|
+
function isUnderPath(target, root) {
|
|
75
|
+
const normalizedRoot = resolve(root);
|
|
76
|
+
if (target === normalizedRoot)
|
|
77
|
+
return true;
|
|
78
|
+
const prefix = normalizedRoot.endsWith(sep) ? normalizedRoot : `${normalizedRoot}${sep}`;
|
|
79
|
+
return target.startsWith(prefix);
|
|
80
|
+
}
|
|
81
|
+
function resolveResourcePath(cwd, targetPath) {
|
|
82
|
+
let expanded = targetPath.trim();
|
|
83
|
+
if (expanded === "~")
|
|
84
|
+
expanded = homedir();
|
|
85
|
+
else if (expanded.startsWith("~/"))
|
|
86
|
+
expanded = join(homedir(), expanded.slice(2));
|
|
87
|
+
else if (expanded.startsWith("~"))
|
|
88
|
+
expanded = join(homedir(), expanded.slice(1));
|
|
89
|
+
return resolve(cwd, expanded);
|
|
90
|
+
}
|
|
77
91
|
export class DefaultResourceLoader {
|
|
78
92
|
constructor(options) {
|
|
93
|
+
this.extensionsResult = { extensions: [], errors: [], runtime: createExtensionRuntime() };
|
|
94
|
+
this.hooksResult = { hooks: [], errors: [] };
|
|
95
|
+
this.skills = [];
|
|
96
|
+
this.skillDiagnostics = [];
|
|
97
|
+
this.prompts = [];
|
|
98
|
+
this.promptDiagnostics = [];
|
|
99
|
+
this.themes = [];
|
|
100
|
+
this.themeDiagnostics = [];
|
|
101
|
+
this.agentsFiles = [];
|
|
102
|
+
this.appendSystemPrompt = [];
|
|
103
|
+
this.pathMetadata = new Map();
|
|
79
104
|
this.cwd = options.cwd ?? process.cwd();
|
|
80
105
|
this.agentDir = options.agentDir ?? getAgentDir();
|
|
81
106
|
this.settingsManager = options.settingsManager ?? SettingsManager.create(this.cwd, this.agentDir);
|
|
82
107
|
this.eventBus = options.eventBus ?? createEventBus();
|
|
83
|
-
this.packageManager = new DefaultPackageManager({
|
|
84
|
-
cwd: this.cwd,
|
|
85
|
-
agentDir: this.agentDir,
|
|
86
|
-
settingsManager: this.settingsManager,
|
|
87
|
-
});
|
|
108
|
+
this.packageManager = new DefaultPackageManager({ cwd: this.cwd, agentDir: this.agentDir, settingsManager: this.settingsManager });
|
|
88
109
|
this.additionalExtensionPaths = options.additionalExtensionPaths ?? [];
|
|
89
110
|
this.additionalHookPaths = options.additionalHookPaths ?? [];
|
|
90
111
|
this.additionalSkillPaths = options.additionalSkillPaths ?? [];
|
|
@@ -106,79 +127,37 @@ export class DefaultResourceLoader {
|
|
|
106
127
|
this.agentsFilesOverride = options.agentsFilesOverride;
|
|
107
128
|
this.systemPromptOverride = options.systemPromptOverride;
|
|
108
129
|
this.appendSystemPromptOverride = options.appendSystemPromptOverride;
|
|
109
|
-
this.extensionsResult = { extensions: [], errors: [], runtime: createExtensionRuntime() };
|
|
110
|
-
this.hooksResult = { hooks: [], errors: [] };
|
|
111
|
-
this.skills = [];
|
|
112
|
-
this.skillDiagnostics = [];
|
|
113
|
-
this.prompts = [];
|
|
114
|
-
this.promptDiagnostics = [];
|
|
115
|
-
this.themes = [];
|
|
116
|
-
this.themeDiagnostics = [];
|
|
117
|
-
this.agentsFiles = [];
|
|
118
|
-
this.appendSystemPrompt = [];
|
|
119
|
-
this.pathMetadata = new Map();
|
|
120
|
-
}
|
|
121
|
-
getExtensions() {
|
|
122
|
-
return this.extensionsResult;
|
|
123
|
-
}
|
|
124
|
-
getHooks() {
|
|
125
|
-
return this.hooksResult;
|
|
126
|
-
}
|
|
127
|
-
getSkills() {
|
|
128
|
-
return { skills: this.skills, diagnostics: this.skillDiagnostics };
|
|
129
|
-
}
|
|
130
|
-
getPrompts() {
|
|
131
|
-
return { prompts: this.prompts, diagnostics: this.promptDiagnostics };
|
|
132
|
-
}
|
|
133
|
-
getThemes() {
|
|
134
|
-
return { themes: this.themes, diagnostics: this.themeDiagnostics };
|
|
135
|
-
}
|
|
136
|
-
getAgentsFiles() {
|
|
137
|
-
return { agentsFiles: this.agentsFiles };
|
|
138
|
-
}
|
|
139
|
-
getSystemPrompt() {
|
|
140
|
-
return this.systemPrompt;
|
|
141
|
-
}
|
|
142
|
-
getAppendSystemPrompt() {
|
|
143
|
-
return this.appendSystemPrompt;
|
|
144
|
-
}
|
|
145
|
-
getPathMetadata() {
|
|
146
|
-
return this.pathMetadata;
|
|
147
130
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
131
|
+
getExtensions() { return this.extensionsResult; }
|
|
132
|
+
getHooks() { return this.hooksResult; }
|
|
133
|
+
getSkills() { return { skills: this.skills, diagnostics: this.skillDiagnostics }; }
|
|
134
|
+
getPrompts() { return { prompts: this.prompts, diagnostics: this.promptDiagnostics }; }
|
|
135
|
+
getThemes() { return { themes: this.themes, diagnostics: this.themeDiagnostics }; }
|
|
136
|
+
getAgentsFiles() { return { agentsFiles: this.agentsFiles }; }
|
|
137
|
+
getSystemPrompt() { return this.systemPrompt; }
|
|
138
|
+
getAppendSystemPrompt() { return this.appendSystemPrompt; }
|
|
139
|
+
getPathMetadata() { return this.pathMetadata; }
|
|
140
|
+
captureEnabledResources(resources, metadata) {
|
|
141
|
+
for (const resource of resources) {
|
|
142
|
+
if (!metadata.has(resource.path)) {
|
|
143
|
+
metadata.set(resource.path, resource.metadata);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return resources.filter((resource) => resource.enabled).map((resource) => resource.path);
|
|
147
|
+
}
|
|
148
|
+
captureEnabledSkillResources(resources, metadata) {
|
|
149
|
+
const enabledResources = resources.filter((resource) => {
|
|
150
|
+
if (!metadata.has(resource.path)) {
|
|
151
|
+
metadata.set(resource.path, resource.metadata);
|
|
152
|
+
}
|
|
153
|
+
return resource.enabled;
|
|
153
154
|
});
|
|
154
|
-
|
|
155
|
-
temporary: true,
|
|
156
|
-
});
|
|
157
|
-
const directHookPaths = this.expandHookPaths(hookSources.directPaths);
|
|
158
|
-
// Helper to extract enabled paths and store metadata
|
|
159
|
-
const getEnabledResources = (resources) => {
|
|
160
|
-
for (const r of resources) {
|
|
161
|
-
if (!this.pathMetadata.has(r.path)) {
|
|
162
|
-
this.pathMetadata.set(r.path, r.metadata);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return resources.filter((r) => r.enabled);
|
|
166
|
-
};
|
|
167
|
-
const getEnabledPaths = (resources) => getEnabledResources(resources).map((r) => r.path);
|
|
168
|
-
// Store metadata and get enabled paths
|
|
169
|
-
this.pathMetadata = new Map();
|
|
170
|
-
const enabledExtensions = getEnabledPaths(resolvedPaths.extensions);
|
|
171
|
-
const enabledHooks = getEnabledPaths(resolvedPaths.hooks);
|
|
172
|
-
const enabledSkillResources = getEnabledResources(resolvedPaths.skills);
|
|
173
|
-
const enabledPrompts = getEnabledPaths(resolvedPaths.prompts);
|
|
174
|
-
const enabledThemes = getEnabledPaths(resolvedPaths.themes);
|
|
175
|
-
const mapSkillPath = (resource) => {
|
|
155
|
+
return enabledResources.map((resource) => {
|
|
176
156
|
if (resource.metadata.source !== "auto" && resource.metadata.origin !== "package") {
|
|
177
157
|
return resource.path;
|
|
178
158
|
}
|
|
179
159
|
try {
|
|
180
|
-
|
|
181
|
-
if (!stats.isDirectory()) {
|
|
160
|
+
if (!statSync(resource.path).isDirectory()) {
|
|
182
161
|
return resource.path;
|
|
183
162
|
}
|
|
184
163
|
}
|
|
@@ -186,149 +165,17 @@ export class DefaultResourceLoader {
|
|
|
186
165
|
return resource.path;
|
|
187
166
|
}
|
|
188
167
|
const skillFile = join(resource.path, "SKILL.md");
|
|
189
|
-
if (existsSync(skillFile)) {
|
|
190
|
-
|
|
191
|
-
this.pathMetadata.set(skillFile, resource.metadata);
|
|
192
|
-
}
|
|
193
|
-
return skillFile;
|
|
194
|
-
}
|
|
195
|
-
return resource.path;
|
|
196
|
-
};
|
|
197
|
-
const enabledSkills = enabledSkillResources.map(mapSkillPath);
|
|
198
|
-
// Add CLI paths metadata
|
|
199
|
-
for (const r of cliExtensionPaths.extensions) {
|
|
200
|
-
if (!this.pathMetadata.has(r.path)) {
|
|
201
|
-
this.pathMetadata.set(r.path, { source: "cli", scope: "temporary", origin: "top-level" });
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
for (const r of cliHookPaths.hooks) {
|
|
205
|
-
if (!this.pathMetadata.has(r.path)) {
|
|
206
|
-
this.pathMetadata.set(r.path, { source: "cli", scope: "temporary", origin: "top-level" });
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
for (const hookPath of directHookPaths) {
|
|
210
|
-
if (!this.pathMetadata.has(hookPath)) {
|
|
211
|
-
this.pathMetadata.set(hookPath, { source: "cli", scope: "temporary", origin: "top-level" });
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
for (const r of cliExtensionPaths.skills) {
|
|
215
|
-
if (!this.pathMetadata.has(r.path)) {
|
|
216
|
-
this.pathMetadata.set(r.path, { source: "cli", scope: "temporary", origin: "top-level" });
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
const cliEnabledExtensions = getEnabledPaths(cliExtensionPaths.extensions);
|
|
220
|
-
const cliEnabledHooks = getEnabledPaths(cliHookPaths.hooks);
|
|
221
|
-
const cliEnabledSkills = getEnabledPaths(cliExtensionPaths.skills);
|
|
222
|
-
const cliEnabledPrompts = getEnabledPaths(cliExtensionPaths.prompts);
|
|
223
|
-
const cliEnabledThemes = getEnabledPaths(cliExtensionPaths.themes);
|
|
224
|
-
const extensionPaths = this.noExtensions
|
|
225
|
-
? cliEnabledExtensions
|
|
226
|
-
: this.mergePaths(enabledExtensions, cliEnabledExtensions);
|
|
227
|
-
const extensionsResult = await loadExtensions(extensionPaths, this.cwd, this.eventBus);
|
|
228
|
-
const inlineExtensions = await this.loadExtensionFactories(extensionsResult.runtime);
|
|
229
|
-
extensionsResult.extensions.push(...inlineExtensions.extensions);
|
|
230
|
-
extensionsResult.errors.push(...inlineExtensions.errors);
|
|
231
|
-
// Detect extension conflicts (tools, commands, flags with same names from different extensions)
|
|
232
|
-
const conflicts = this.detectExtensionConflicts(extensionsResult.extensions);
|
|
233
|
-
if (conflicts.length > 0) {
|
|
234
|
-
const conflictingPaths = new Set(conflicts.map((c) => c.path));
|
|
235
|
-
extensionsResult.extensions = extensionsResult.extensions.filter((ext) => !conflictingPaths.has(ext.path));
|
|
236
|
-
for (const conflict of conflicts) {
|
|
237
|
-
extensionsResult.errors.push({ path: conflict.path, error: conflict.message });
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
this.extensionsResult = this.extensionsOverride ? this.extensionsOverride(extensionsResult) : extensionsResult;
|
|
241
|
-
const hookPaths = this.noHooks
|
|
242
|
-
? this.mergePaths(cliEnabledHooks, directHookPaths)
|
|
243
|
-
: this.mergePaths([...enabledHooks, ...cliEnabledHooks], directHookPaths);
|
|
244
|
-
const hooksResult = hookPaths.length > 0 ? await loadHooks(hookPaths, this.cwd, this.agentDir, this.eventBus) : { hooks: [], errors: [] };
|
|
245
|
-
this.hooksResult = this.hooksOverride ? this.hooksOverride(hooksResult) : hooksResult;
|
|
246
|
-
const skillPaths = this.noSkills
|
|
247
|
-
? this.mergePaths(cliEnabledSkills, this.additionalSkillPaths)
|
|
248
|
-
: this.mergePaths([...enabledSkills, ...cliEnabledSkills], this.additionalSkillPaths);
|
|
249
|
-
let skillsResult;
|
|
250
|
-
if (this.noSkills && skillPaths.length === 0) {
|
|
251
|
-
skillsResult = { skills: [], diagnostics: [] };
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
254
|
-
skillsResult = loadSkills({
|
|
255
|
-
cwd: this.cwd,
|
|
256
|
-
agentDir: this.agentDir,
|
|
257
|
-
skillPaths,
|
|
258
|
-
includeDefaults: false,
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
const resolvedSkills = this.skillsOverride ? this.skillsOverride(skillsResult) : skillsResult;
|
|
262
|
-
this.skills = resolvedSkills.skills;
|
|
263
|
-
this.skillDiagnostics = resolvedSkills.diagnostics;
|
|
264
|
-
for (const skill of this.skills) {
|
|
265
|
-
this.addDefaultMetadataForPath(skill.filePath);
|
|
266
|
-
}
|
|
267
|
-
const promptPaths = this.noPromptTemplates
|
|
268
|
-
? this.mergePaths(cliEnabledPrompts, this.additionalPromptTemplatePaths)
|
|
269
|
-
: this.mergePaths([...enabledPrompts, ...cliEnabledPrompts], this.additionalPromptTemplatePaths);
|
|
270
|
-
let promptsResult;
|
|
271
|
-
if (this.noPromptTemplates && promptPaths.length === 0) {
|
|
272
|
-
promptsResult = { prompts: [], diagnostics: [] };
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
const allPrompts = loadPromptTemplates({
|
|
276
|
-
cwd: this.cwd,
|
|
277
|
-
agentDir: this.agentDir,
|
|
278
|
-
promptPaths,
|
|
279
|
-
includeDefaults: false,
|
|
280
|
-
});
|
|
281
|
-
promptsResult = this.dedupePrompts(allPrompts);
|
|
282
|
-
}
|
|
283
|
-
const resolvedPrompts = this.promptsOverride ? this.promptsOverride(promptsResult) : promptsResult;
|
|
284
|
-
this.prompts = resolvedPrompts.prompts;
|
|
285
|
-
this.promptDiagnostics = resolvedPrompts.diagnostics;
|
|
286
|
-
for (const prompt of this.prompts) {
|
|
287
|
-
this.addDefaultMetadataForPath(prompt.filePath);
|
|
288
|
-
}
|
|
289
|
-
const themePaths = this.noThemes
|
|
290
|
-
? this.mergePaths(cliEnabledThemes, this.additionalThemePaths)
|
|
291
|
-
: this.mergePaths([...enabledThemes, ...cliEnabledThemes], this.additionalThemePaths);
|
|
292
|
-
let themesResult;
|
|
293
|
-
if (this.noThemes && themePaths.length === 0) {
|
|
294
|
-
themesResult = { themes: [], diagnostics: [] };
|
|
295
|
-
}
|
|
296
|
-
else {
|
|
297
|
-
const loaded = this.loadThemes(themePaths, false);
|
|
298
|
-
const deduped = this.dedupeThemes(loaded.themes);
|
|
299
|
-
themesResult = { themes: deduped.themes, diagnostics: [...loaded.diagnostics, ...deduped.diagnostics] };
|
|
300
|
-
}
|
|
301
|
-
const resolvedThemes = this.themesOverride ? this.themesOverride(themesResult) : themesResult;
|
|
302
|
-
this.themes = resolvedThemes.themes;
|
|
303
|
-
this.themeDiagnostics = resolvedThemes.diagnostics;
|
|
304
|
-
for (const theme of this.themes) {
|
|
305
|
-
if (theme.sourcePath) {
|
|
306
|
-
this.addDefaultMetadataForPath(theme.sourcePath);
|
|
168
|
+
if (existsSync(skillFile) && !metadata.has(skillFile)) {
|
|
169
|
+
metadata.set(skillFile, resource.metadata);
|
|
307
170
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
this.addDefaultMetadataForPath(extension.path);
|
|
311
|
-
}
|
|
312
|
-
for (const hook of this.hooksResult.hooks) {
|
|
313
|
-
this.addDefaultMetadataForPath(hook.path);
|
|
314
|
-
}
|
|
315
|
-
const agentsFiles = { agentsFiles: loadProjectContextFiles({ cwd: this.cwd, agentDir: this.agentDir }) };
|
|
316
|
-
const resolvedAgentsFiles = this.agentsFilesOverride ? this.agentsFilesOverride(agentsFiles) : agentsFiles;
|
|
317
|
-
this.agentsFiles = resolvedAgentsFiles.agentsFiles;
|
|
318
|
-
const baseSystemPrompt = resolvePromptInput(this.systemPromptSource ?? this.discoverSystemPromptFile(), "system prompt");
|
|
319
|
-
this.systemPrompt = this.systemPromptOverride ? this.systemPromptOverride(baseSystemPrompt) : baseSystemPrompt;
|
|
320
|
-
const appendSource = this.appendSystemPromptSource ?? this.discoverAppendSystemPromptFile();
|
|
321
|
-
const resolvedAppend = resolvePromptInput(appendSource, "append system prompt");
|
|
322
|
-
const baseAppend = resolvedAppend ? [resolvedAppend] : [];
|
|
323
|
-
this.appendSystemPrompt = this.appendSystemPromptOverride
|
|
324
|
-
? this.appendSystemPromptOverride(baseAppend)
|
|
325
|
-
: baseAppend;
|
|
171
|
+
return existsSync(skillFile) ? skillFile : resource.path;
|
|
172
|
+
});
|
|
326
173
|
}
|
|
327
174
|
splitHookSources(paths) {
|
|
328
175
|
const packageSources = [];
|
|
329
176
|
const directPaths = [];
|
|
330
177
|
for (const entry of paths) {
|
|
331
|
-
if (
|
|
178
|
+
if (entry.startsWith("npm:") || entry.startsWith("git:") || looksLikeGitUrl(entry.trim())) {
|
|
332
179
|
packageSources.push(entry);
|
|
333
180
|
}
|
|
334
181
|
else {
|
|
@@ -337,36 +184,26 @@ export class DefaultResourceLoader {
|
|
|
337
184
|
}
|
|
338
185
|
return { packageSources, directPaths };
|
|
339
186
|
}
|
|
340
|
-
isPackageSource(path) {
|
|
341
|
-
const trimmed = path.trim();
|
|
342
|
-
return trimmed.startsWith("npm:") || trimmed.startsWith("git:") || looksLikeGitUrl(trimmed);
|
|
343
|
-
}
|
|
344
187
|
expandHookPaths(paths) {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
const resolved = this.resolveResourcePath(pathToHook);
|
|
188
|
+
return paths.flatMap((hookPath) => {
|
|
189
|
+
const resolved = resolveResourcePath(this.cwd, hookPath);
|
|
348
190
|
try {
|
|
349
|
-
|
|
350
|
-
if (stats.isDirectory()) {
|
|
191
|
+
if (statSync(resolved).isDirectory()) {
|
|
351
192
|
const discovered = discoverHooksInDir(resolved);
|
|
352
|
-
|
|
353
|
-
expanded.push(...discovered);
|
|
354
|
-
continue;
|
|
355
|
-
}
|
|
193
|
+
return discovered.length > 0 ? discovered : [resolved];
|
|
356
194
|
}
|
|
357
195
|
}
|
|
358
196
|
catch {
|
|
359
|
-
|
|
197
|
+
return [resolved];
|
|
360
198
|
}
|
|
361
|
-
|
|
362
|
-
}
|
|
363
|
-
return expanded;
|
|
199
|
+
return [resolved];
|
|
200
|
+
});
|
|
364
201
|
}
|
|
365
202
|
mergePaths(primary, additional) {
|
|
366
203
|
const merged = [];
|
|
367
204
|
const seen = new Set();
|
|
368
|
-
for (const
|
|
369
|
-
const resolved = this.
|
|
205
|
+
for (const targetPath of [...primary, ...additional]) {
|
|
206
|
+
const resolved = resolveResourcePath(this.cwd, targetPath);
|
|
370
207
|
if (seen.has(resolved))
|
|
371
208
|
continue;
|
|
372
209
|
seen.add(resolved);
|
|
@@ -374,108 +211,55 @@ export class DefaultResourceLoader {
|
|
|
374
211
|
}
|
|
375
212
|
return merged;
|
|
376
213
|
}
|
|
377
|
-
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
383
|
-
else if (trimmed.startsWith("~/")) {
|
|
384
|
-
expanded = join(homedir(), trimmed.slice(2));
|
|
385
|
-
}
|
|
386
|
-
else if (trimmed.startsWith("~")) {
|
|
387
|
-
expanded = join(homedir(), trimmed.slice(1));
|
|
388
|
-
}
|
|
389
|
-
return resolve(this.cwd, expanded);
|
|
390
|
-
}
|
|
391
|
-
loadThemes(paths, includeDefaults = true) {
|
|
392
|
-
const themes = [];
|
|
393
|
-
const diagnostics = [];
|
|
394
|
-
if (includeDefaults) {
|
|
395
|
-
const defaultDirs = [join(this.agentDir, "themes"), join(this.cwd, CONFIG_DIR_NAME, "themes")];
|
|
396
|
-
for (const dir of defaultDirs) {
|
|
397
|
-
this.loadThemesFromDir(dir, themes, diagnostics);
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
for (const p of paths) {
|
|
401
|
-
const resolved = resolve(this.cwd, p);
|
|
402
|
-
if (!existsSync(resolved)) {
|
|
403
|
-
diagnostics.push({ type: "warning", message: "theme path does not exist", path: resolved });
|
|
404
|
-
continue;
|
|
405
|
-
}
|
|
214
|
+
async loadInlineExtensions(runtime) {
|
|
215
|
+
const extensions = [];
|
|
216
|
+
const errors = [];
|
|
217
|
+
for (const [index, factory] of this.extensionFactories.entries()) {
|
|
218
|
+
const path = `<inline:${index + 1}>`;
|
|
406
219
|
try {
|
|
407
|
-
|
|
408
|
-
if (stats.isDirectory()) {
|
|
409
|
-
this.loadThemesFromDir(resolved, themes, diagnostics);
|
|
410
|
-
}
|
|
411
|
-
else if (stats.isFile() && resolved.endsWith(".json")) {
|
|
412
|
-
this.loadThemeFromFile(resolved, themes, diagnostics);
|
|
413
|
-
}
|
|
414
|
-
else {
|
|
415
|
-
diagnostics.push({ type: "warning", message: "theme path is not a json file", path: resolved });
|
|
416
|
-
}
|
|
220
|
+
extensions.push(await loadExtensionFromFactory(factory, this.cwd, this.eventBus, runtime, path));
|
|
417
221
|
}
|
|
418
222
|
catch (error) {
|
|
419
|
-
|
|
420
|
-
diagnostics.push({ type: "warning", message, path: resolved });
|
|
223
|
+
errors.push({ path, error: error instanceof Error ? error.message : "failed to load extension" });
|
|
421
224
|
}
|
|
422
225
|
}
|
|
423
|
-
return {
|
|
226
|
+
return { extensions, errors };
|
|
424
227
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
for (const
|
|
432
|
-
|
|
433
|
-
if (
|
|
434
|
-
|
|
435
|
-
isFile = statSync(join(dir, entry.name)).isFile();
|
|
436
|
-
}
|
|
437
|
-
catch {
|
|
438
|
-
continue;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
if (!isFile) {
|
|
442
|
-
continue;
|
|
228
|
+
detectExtensionConflicts(extensions) {
|
|
229
|
+
const conflicts = [];
|
|
230
|
+
const toolOwners = new Map();
|
|
231
|
+
const commandOwners = new Map();
|
|
232
|
+
const flagOwners = new Map();
|
|
233
|
+
for (const extension of extensions) {
|
|
234
|
+
for (const toolName of extension.tools.keys()) {
|
|
235
|
+
const owner = toolOwners.get(toolName);
|
|
236
|
+
if (owner && owner !== extension.path) {
|
|
237
|
+
conflicts.push({ path: extension.path, message: `Tool "${toolName}" conflicts with ${owner}` });
|
|
443
238
|
}
|
|
444
|
-
|
|
445
|
-
|
|
239
|
+
else {
|
|
240
|
+
toolOwners.set(toolName, extension.path);
|
|
446
241
|
}
|
|
447
|
-
this.loadThemeFromFile(join(dir, entry.name), themes, diagnostics);
|
|
448
242
|
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
themes.push(loadThemeFromPath(filePath));
|
|
458
|
-
}
|
|
459
|
-
catch (error) {
|
|
460
|
-
const message = error instanceof Error ? error.message : "failed to load theme";
|
|
461
|
-
diagnostics.push({ type: "warning", message, path: filePath });
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
async loadExtensionFactories(runtime) {
|
|
465
|
-
const extensions = [];
|
|
466
|
-
const errors = [];
|
|
467
|
-
for (const [index, factory] of this.extensionFactories.entries()) {
|
|
468
|
-
const extensionPath = `<inline:${index + 1}>`;
|
|
469
|
-
try {
|
|
470
|
-
const extension = await loadExtensionFromFactory(factory, this.cwd, this.eventBus, runtime, extensionPath);
|
|
471
|
-
extensions.push(extension);
|
|
243
|
+
for (const commandName of extension.commands.keys()) {
|
|
244
|
+
const owner = commandOwners.get(commandName);
|
|
245
|
+
if (owner && owner !== extension.path) {
|
|
246
|
+
conflicts.push({ path: extension.path, message: `Command "/${commandName}" conflicts with ${owner}` });
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
commandOwners.set(commandName, extension.path);
|
|
250
|
+
}
|
|
472
251
|
}
|
|
473
|
-
|
|
474
|
-
const
|
|
475
|
-
|
|
252
|
+
for (const flagName of extension.flags.keys()) {
|
|
253
|
+
const owner = flagOwners.get(flagName);
|
|
254
|
+
if (owner && owner !== extension.path) {
|
|
255
|
+
conflicts.push({ path: extension.path, message: `Flag "--${flagName}" conflicts with ${owner}` });
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
flagOwners.set(flagName, extension.path);
|
|
259
|
+
}
|
|
476
260
|
}
|
|
477
261
|
}
|
|
478
|
-
return
|
|
262
|
+
return conflicts;
|
|
479
263
|
}
|
|
480
264
|
dedupePrompts(prompts) {
|
|
481
265
|
const seen = new Map();
|
|
@@ -487,158 +271,260 @@ export class DefaultResourceLoader {
|
|
|
487
271
|
type: "collision",
|
|
488
272
|
message: `name "/${prompt.name}" collision`,
|
|
489
273
|
path: prompt.filePath,
|
|
490
|
-
collision: {
|
|
491
|
-
resourceType: "prompt",
|
|
492
|
-
name: prompt.name,
|
|
493
|
-
winnerPath: existing.filePath,
|
|
494
|
-
loserPath: prompt.filePath,
|
|
495
|
-
},
|
|
274
|
+
collision: { resourceType: "prompt", name: prompt.name, winnerPath: existing.filePath, loserPath: prompt.filePath },
|
|
496
275
|
});
|
|
276
|
+
continue;
|
|
497
277
|
}
|
|
498
|
-
|
|
499
|
-
seen.set(prompt.name, prompt);
|
|
500
|
-
}
|
|
278
|
+
seen.set(prompt.name, prompt);
|
|
501
279
|
}
|
|
502
280
|
return { prompts: Array.from(seen.values()), diagnostics };
|
|
503
281
|
}
|
|
504
282
|
dedupeThemes(themes) {
|
|
505
283
|
const seen = new Map();
|
|
506
284
|
const diagnostics = [];
|
|
507
|
-
for (const
|
|
508
|
-
const name =
|
|
285
|
+
for (const theme of themes) {
|
|
286
|
+
const name = theme.name ?? "unnamed";
|
|
509
287
|
const existing = seen.get(name);
|
|
510
288
|
if (existing) {
|
|
511
289
|
diagnostics.push({
|
|
512
290
|
type: "collision",
|
|
513
291
|
message: `name "${name}" collision`,
|
|
514
|
-
path:
|
|
292
|
+
path: theme.sourcePath,
|
|
515
293
|
collision: {
|
|
516
294
|
resourceType: "theme",
|
|
517
295
|
name,
|
|
518
296
|
winnerPath: existing.sourcePath ?? "<builtin>",
|
|
519
|
-
loserPath:
|
|
297
|
+
loserPath: theme.sourcePath ?? "<builtin>",
|
|
520
298
|
},
|
|
521
299
|
});
|
|
300
|
+
continue;
|
|
522
301
|
}
|
|
523
|
-
|
|
524
|
-
seen.set(name, t);
|
|
525
|
-
}
|
|
302
|
+
seen.set(name, theme);
|
|
526
303
|
}
|
|
527
304
|
return { themes: Array.from(seen.values()), diagnostics };
|
|
528
305
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
306
|
+
loadThemesFromDir(dir, themes, diagnostics) {
|
|
307
|
+
if (!existsSync(dir))
|
|
308
|
+
return;
|
|
309
|
+
try {
|
|
310
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
311
|
+
let isFile = entry.isFile();
|
|
312
|
+
if (entry.isSymbolicLink()) {
|
|
313
|
+
try {
|
|
314
|
+
isFile = statSync(join(dir, entry.name)).isFile();
|
|
315
|
+
}
|
|
316
|
+
catch {
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (!isFile || !entry.name.endsWith(".json"))
|
|
321
|
+
continue;
|
|
322
|
+
this.loadThemeFromFile(join(dir, entry.name), themes, diagnostics);
|
|
323
|
+
}
|
|
533
324
|
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
325
|
+
catch (error) {
|
|
326
|
+
diagnostics.push({ type: "warning", message: error instanceof Error ? error.message : "failed to read theme directory", path: dir });
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
loadThemeFromFile(filePath, themes, diagnostics) {
|
|
330
|
+
try {
|
|
331
|
+
themes.push(loadThemeFromPath(filePath));
|
|
332
|
+
}
|
|
333
|
+
catch (error) {
|
|
334
|
+
diagnostics.push({ type: "warning", message: error instanceof Error ? error.message : "failed to load theme", path: filePath });
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
loadThemeResources(paths) {
|
|
338
|
+
const themes = [];
|
|
339
|
+
const diagnostics = [];
|
|
340
|
+
for (const themePath of paths) {
|
|
341
|
+
const resolvedPath = resolve(this.cwd, themePath);
|
|
342
|
+
if (!existsSync(resolvedPath)) {
|
|
343
|
+
diagnostics.push({ type: "warning", message: "theme path does not exist", path: resolvedPath });
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
346
|
+
try {
|
|
347
|
+
const stats = statSync(resolvedPath);
|
|
348
|
+
if (stats.isDirectory())
|
|
349
|
+
this.loadThemesFromDir(resolvedPath, themes, diagnostics);
|
|
350
|
+
else if (stats.isFile() && resolvedPath.endsWith(".json"))
|
|
351
|
+
this.loadThemeFromFile(resolvedPath, themes, diagnostics);
|
|
352
|
+
else
|
|
353
|
+
diagnostics.push({ type: "warning", message: "theme path is not a json file", path: resolvedPath });
|
|
354
|
+
}
|
|
355
|
+
catch (error) {
|
|
356
|
+
diagnostics.push({ type: "warning", message: error instanceof Error ? error.message : "failed to read theme path", path: resolvedPath });
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return { themes, diagnostics };
|
|
360
|
+
}
|
|
361
|
+
discoverSystemPromptFile() {
|
|
362
|
+
for (const filePath of [join(this.cwd, CONFIG_DIR_NAME, "SYSTEM.md"), join(this.agentDir, "SYSTEM.md")]) {
|
|
363
|
+
if (existsSync(filePath))
|
|
364
|
+
return filePath;
|
|
537
365
|
}
|
|
538
366
|
return undefined;
|
|
539
367
|
}
|
|
540
368
|
discoverAppendSystemPromptFile() {
|
|
541
|
-
const
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}
|
|
545
|
-
const globalPath = join(this.agentDir, "APPEND_SYSTEM.md");
|
|
546
|
-
if (existsSync(globalPath)) {
|
|
547
|
-
return globalPath;
|
|
369
|
+
for (const filePath of [join(this.cwd, CONFIG_DIR_NAME, "APPEND_SYSTEM.md"), join(this.agentDir, "APPEND_SYSTEM.md")]) {
|
|
370
|
+
if (existsSync(filePath))
|
|
371
|
+
return filePath;
|
|
548
372
|
}
|
|
549
373
|
return undefined;
|
|
550
374
|
}
|
|
551
|
-
addDefaultMetadataForPath(filePath) {
|
|
552
|
-
if (!filePath || filePath.startsWith("<"))
|
|
375
|
+
addDefaultMetadataForPath(filePath, metadata) {
|
|
376
|
+
if (!filePath || filePath.startsWith("<"))
|
|
553
377
|
return;
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
378
|
+
const normalized = resolve(filePath);
|
|
379
|
+
if (metadata.has(normalized) || metadata.has(filePath))
|
|
380
|
+
return;
|
|
381
|
+
const userRoots = ["skills", "prompts", "themes", "extensions", "hooks"].map((name) => join(this.agentDir, name));
|
|
382
|
+
const projectRoots = ["skills", "prompts", "themes", "extensions", "hooks"].map((name) => join(this.cwd, CONFIG_DIR_NAME, name));
|
|
383
|
+
if (userRoots.some((root) => isUnderPath(normalized, root))) {
|
|
384
|
+
metadata.set(normalized, { source: "local", scope: "user", origin: "top-level" });
|
|
557
385
|
return;
|
|
558
386
|
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
join(this.agentDir, "prompts"),
|
|
562
|
-
join(this.agentDir, "themes"),
|
|
563
|
-
join(this.agentDir, "extensions"),
|
|
564
|
-
join(this.agentDir, "hooks"),
|
|
565
|
-
];
|
|
566
|
-
const projectRoots = [
|
|
567
|
-
join(this.cwd, CONFIG_DIR_NAME, "skills"),
|
|
568
|
-
join(this.cwd, CONFIG_DIR_NAME, "prompts"),
|
|
569
|
-
join(this.cwd, CONFIG_DIR_NAME, "themes"),
|
|
570
|
-
join(this.cwd, CONFIG_DIR_NAME, "extensions"),
|
|
571
|
-
join(this.cwd, CONFIG_DIR_NAME, "hooks"),
|
|
572
|
-
];
|
|
573
|
-
for (const root of agentRoots) {
|
|
574
|
-
if (this.isUnderPath(normalizedPath, root)) {
|
|
575
|
-
this.pathMetadata.set(normalizedPath, { source: "local", scope: "user", origin: "top-level" });
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
387
|
+
if (projectRoots.some((root) => isUnderPath(normalized, root))) {
|
|
388
|
+
metadata.set(normalized, { source: "local", scope: "project", origin: "top-level" });
|
|
578
389
|
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
390
|
+
}
|
|
391
|
+
async loadExtensionResources(extensionPaths) {
|
|
392
|
+
const extensionsResult = await loadExtensions(extensionPaths, this.cwd, this.eventBus);
|
|
393
|
+
const inlineExtensions = await this.loadInlineExtensions(extensionsResult.runtime);
|
|
394
|
+
extensionsResult.extensions.push(...inlineExtensions.extensions);
|
|
395
|
+
extensionsResult.errors.push(...inlineExtensions.errors);
|
|
396
|
+
const conflicts = this.detectExtensionConflicts(extensionsResult.extensions);
|
|
397
|
+
if (conflicts.length > 0) {
|
|
398
|
+
const conflictingPaths = new Set(conflicts.map((conflict) => conflict.path));
|
|
399
|
+
extensionsResult.extensions = extensionsResult.extensions.filter((ext) => !conflictingPaths.has(ext.path));
|
|
400
|
+
for (const conflict of conflicts) {
|
|
401
|
+
extensionsResult.errors.push({ path: conflict.path, error: conflict.message });
|
|
583
402
|
}
|
|
584
403
|
}
|
|
404
|
+
return this.extensionsOverride ? this.extensionsOverride(extensionsResult) : extensionsResult;
|
|
405
|
+
}
|
|
406
|
+
async loadHookResources(hookPaths) {
|
|
407
|
+
const base = hookPaths.length > 0 ? await loadHooks(hookPaths, this.cwd, this.agentDir, this.eventBus) : { hooks: [], errors: [] };
|
|
408
|
+
return this.hooksOverride ? this.hooksOverride(base) : base;
|
|
409
|
+
}
|
|
410
|
+
loadSkillResources(skillPaths) {
|
|
411
|
+
const base = this.noSkills && skillPaths.length === 0
|
|
412
|
+
? { skills: [], diagnostics: [] }
|
|
413
|
+
: loadSkills({ cwd: this.cwd, agentDir: this.agentDir, skillPaths, includeDefaults: false });
|
|
414
|
+
return this.skillsOverride ? this.skillsOverride(base) : base;
|
|
415
|
+
}
|
|
416
|
+
loadPromptResources(promptPaths) {
|
|
417
|
+
const base = this.noPromptTemplates && promptPaths.length === 0
|
|
418
|
+
? { prompts: [], diagnostics: [] }
|
|
419
|
+
: (() => {
|
|
420
|
+
const allPrompts = loadPromptTemplates({ cwd: this.cwd, agentDir: this.agentDir, promptPaths, includeDefaults: false });
|
|
421
|
+
return this.dedupePrompts(allPrompts);
|
|
422
|
+
})();
|
|
423
|
+
return this.promptsOverride ? this.promptsOverride(base) : base;
|
|
424
|
+
}
|
|
425
|
+
loadThemePhase(themePaths) {
|
|
426
|
+
const base = this.noThemes && themePaths.length === 0
|
|
427
|
+
? { themes: [], diagnostics: [] }
|
|
428
|
+
: (() => {
|
|
429
|
+
const loaded = this.loadThemeResources(themePaths);
|
|
430
|
+
const deduped = this.dedupeThemes(loaded.themes);
|
|
431
|
+
return { themes: deduped.themes, diagnostics: [...loaded.diagnostics, ...deduped.diagnostics] };
|
|
432
|
+
})();
|
|
433
|
+
return this.themesOverride ? this.themesOverride(base) : base;
|
|
434
|
+
}
|
|
435
|
+
loadAgentsPhase() {
|
|
436
|
+
const base = { agentsFiles: loadProjectContextFiles({ cwd: this.cwd, agentDir: this.agentDir }) };
|
|
437
|
+
return this.agentsFilesOverride ? this.agentsFilesOverride(base).agentsFiles : base.agentsFiles;
|
|
438
|
+
}
|
|
439
|
+
resolvePromptOverrides() {
|
|
440
|
+
const baseSystemPrompt = resolvePromptInput(this.systemPromptSource ?? this.discoverSystemPromptFile(), "system prompt");
|
|
441
|
+
const systemPrompt = this.systemPromptOverride ? this.systemPromptOverride(baseSystemPrompt) : baseSystemPrompt;
|
|
442
|
+
const appendSource = this.appendSystemPromptSource ?? this.discoverAppendSystemPromptFile();
|
|
443
|
+
const resolvedAppend = resolvePromptInput(appendSource, "append system prompt");
|
|
444
|
+
const baseAppend = resolvedAppend ? [resolvedAppend] : [];
|
|
445
|
+
return {
|
|
446
|
+
systemPrompt,
|
|
447
|
+
appendSystemPrompt: this.appendSystemPromptOverride ? this.appendSystemPromptOverride(baseAppend) : baseAppend,
|
|
448
|
+
};
|
|
585
449
|
}
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
450
|
+
composeResourceSnapshot(snapshot) {
|
|
451
|
+
this.extensionsResult = snapshot.extensionsResult;
|
|
452
|
+
this.hooksResult = snapshot.hooksResult;
|
|
453
|
+
this.skills = snapshot.skills;
|
|
454
|
+
this.skillDiagnostics = snapshot.skillDiagnostics;
|
|
455
|
+
this.prompts = snapshot.prompts;
|
|
456
|
+
this.promptDiagnostics = snapshot.promptDiagnostics;
|
|
457
|
+
this.themes = snapshot.themes;
|
|
458
|
+
this.themeDiagnostics = snapshot.themeDiagnostics;
|
|
459
|
+
this.agentsFiles = snapshot.agentsFiles;
|
|
460
|
+
this.systemPrompt = snapshot.systemPrompt;
|
|
461
|
+
this.appendSystemPrompt = snapshot.appendSystemPrompt;
|
|
462
|
+
this.pathMetadata = snapshot.pathMetadata;
|
|
593
463
|
}
|
|
594
|
-
|
|
595
|
-
const
|
|
596
|
-
|
|
597
|
-
const
|
|
598
|
-
const
|
|
599
|
-
const
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
}
|
|
610
|
-
else {
|
|
611
|
-
toolOwners.set(toolName, ext.path);
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
// Check commands
|
|
615
|
-
for (const commandName of ext.commands.keys()) {
|
|
616
|
-
const existingOwner = commandOwners.get(commandName);
|
|
617
|
-
if (existingOwner && existingOwner !== ext.path) {
|
|
618
|
-
conflicts.push({
|
|
619
|
-
path: ext.path,
|
|
620
|
-
message: `Command "/${commandName}" conflicts with ${existingOwner}`,
|
|
621
|
-
});
|
|
622
|
-
}
|
|
623
|
-
else {
|
|
624
|
-
commandOwners.set(commandName, ext.path);
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
// Check flags
|
|
628
|
-
for (const flagName of ext.flags.keys()) {
|
|
629
|
-
const existingOwner = flagOwners.get(flagName);
|
|
630
|
-
if (existingOwner && existingOwner !== ext.path) {
|
|
631
|
-
conflicts.push({
|
|
632
|
-
path: ext.path,
|
|
633
|
-
message: `Flag "--${flagName}" conflicts with ${existingOwner}`,
|
|
634
|
-
});
|
|
635
|
-
}
|
|
636
|
-
else {
|
|
637
|
-
flagOwners.set(flagName, ext.path);
|
|
638
|
-
}
|
|
464
|
+
async reload() {
|
|
465
|
+
const packageResources = await this.packageManager.resolve();
|
|
466
|
+
const hookSources = this.splitHookSources(this.additionalHookPaths);
|
|
467
|
+
const cliResources = await this.packageManager.resolveExtensionSources(this.additionalExtensionPaths, { temporary: true });
|
|
468
|
+
const cliHookResources = await this.packageManager.resolveExtensionSources(hookSources.packageSources, { temporary: true });
|
|
469
|
+
const directHookPaths = this.expandHookPaths(hookSources.directPaths);
|
|
470
|
+
const metadata = new Map();
|
|
471
|
+
const enabledExtensions = this.captureEnabledResources(packageResources.extensions, metadata);
|
|
472
|
+
const enabledHooks = this.captureEnabledResources(packageResources.hooks, metadata);
|
|
473
|
+
const enabledSkills = this.captureEnabledSkillResources(packageResources.skills, metadata);
|
|
474
|
+
const enabledPrompts = this.captureEnabledResources(packageResources.prompts, metadata);
|
|
475
|
+
const enabledThemes = this.captureEnabledResources(packageResources.themes, metadata);
|
|
476
|
+
for (const resource of [...cliResources.extensions, ...cliHookResources.hooks, ...cliResources.skills, ...cliResources.prompts, ...cliResources.themes]) {
|
|
477
|
+
if (!metadata.has(resource.path)) {
|
|
478
|
+
metadata.set(resource.path, { source: "cli", scope: "temporary", origin: "top-level" });
|
|
639
479
|
}
|
|
640
480
|
}
|
|
641
|
-
|
|
481
|
+
for (const hookPath of directHookPaths) {
|
|
482
|
+
if (!metadata.has(hookPath)) {
|
|
483
|
+
metadata.set(hookPath, { source: "cli", scope: "temporary", origin: "top-level" });
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
const cliEnabledExtensions = cliResources.extensions.filter((item) => item.enabled).map((item) => item.path);
|
|
487
|
+
const cliEnabledHooks = cliHookResources.hooks.filter((item) => item.enabled).map((item) => item.path);
|
|
488
|
+
const cliEnabledSkills = cliResources.skills.filter((item) => item.enabled).map((item) => item.path);
|
|
489
|
+
const cliEnabledPrompts = cliResources.prompts.filter((item) => item.enabled).map((item) => item.path);
|
|
490
|
+
const cliEnabledThemes = cliResources.themes.filter((item) => item.enabled).map((item) => item.path);
|
|
491
|
+
const extensionPaths = this.noExtensions ? cliEnabledExtensions : this.mergePaths(enabledExtensions, cliEnabledExtensions);
|
|
492
|
+
const hookPaths = this.noHooks ? this.mergePaths(cliEnabledHooks, directHookPaths) : this.mergePaths([...enabledHooks, ...cliEnabledHooks], directHookPaths);
|
|
493
|
+
const skillPaths = this.noSkills ? this.mergePaths(cliEnabledSkills, this.additionalSkillPaths) : this.mergePaths([...enabledSkills, ...cliEnabledSkills], this.additionalSkillPaths);
|
|
494
|
+
const promptPaths = this.noPromptTemplates ? this.mergePaths(cliEnabledPrompts, this.additionalPromptTemplatePaths) : this.mergePaths([...enabledPrompts, ...cliEnabledPrompts], this.additionalPromptTemplatePaths);
|
|
495
|
+
const themePaths = this.noThemes ? this.mergePaths(cliEnabledThemes, this.additionalThemePaths) : this.mergePaths([...enabledThemes, ...cliEnabledThemes], this.additionalThemePaths);
|
|
496
|
+
const extensionsResult = await this.loadExtensionResources(extensionPaths);
|
|
497
|
+
const hooksResult = await this.loadHookResources(hookPaths);
|
|
498
|
+
const skillsResult = this.loadSkillResources(skillPaths);
|
|
499
|
+
const promptsResult = this.loadPromptResources(promptPaths);
|
|
500
|
+
const themesResult = this.loadThemePhase(themePaths);
|
|
501
|
+
const agentsFiles = this.loadAgentsPhase();
|
|
502
|
+
const promptOverrides = this.resolvePromptOverrides();
|
|
503
|
+
for (const skill of skillsResult.skills)
|
|
504
|
+
this.addDefaultMetadataForPath(skill.filePath, metadata);
|
|
505
|
+
for (const prompt of promptsResult.prompts)
|
|
506
|
+
this.addDefaultMetadataForPath(prompt.filePath, metadata);
|
|
507
|
+
for (const theme of themesResult.themes)
|
|
508
|
+
if (theme.sourcePath)
|
|
509
|
+
this.addDefaultMetadataForPath(theme.sourcePath, metadata);
|
|
510
|
+
for (const extension of extensionsResult.extensions)
|
|
511
|
+
this.addDefaultMetadataForPath(extension.path, metadata);
|
|
512
|
+
for (const hook of hooksResult.hooks)
|
|
513
|
+
this.addDefaultMetadataForPath(hook.path, metadata);
|
|
514
|
+
this.composeResourceSnapshot({
|
|
515
|
+
extensionsResult,
|
|
516
|
+
hooksResult,
|
|
517
|
+
skills: skillsResult.skills,
|
|
518
|
+
skillDiagnostics: skillsResult.diagnostics,
|
|
519
|
+
prompts: promptsResult.prompts,
|
|
520
|
+
promptDiagnostics: promptsResult.diagnostics,
|
|
521
|
+
themes: themesResult.themes,
|
|
522
|
+
themeDiagnostics: themesResult.diagnostics,
|
|
523
|
+
agentsFiles,
|
|
524
|
+
systemPrompt: promptOverrides.systemPrompt,
|
|
525
|
+
appendSystemPrompt: promptOverrides.appendSystemPrompt,
|
|
526
|
+
pathMetadata: metadata,
|
|
527
|
+
});
|
|
642
528
|
}
|
|
643
529
|
}
|
|
644
530
|
//# sourceMappingURL=resource-loader.js.map
|