pi-ui-extend 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 +307 -0
- package/bin/pix.mjs +219 -0
- package/dist/app/app.d.ts +96 -0
- package/dist/app/app.js +871 -0
- package/dist/app/blink-controller.d.ts +23 -0
- package/dist/app/blink-controller.js +82 -0
- package/dist/app/cli.d.ts +8 -0
- package/dist/app/cli.js +83 -0
- package/dist/app/clipboard.d.ts +1 -0
- package/dist/app/clipboard.js +24 -0
- package/dist/app/command-controller.d.ts +18 -0
- package/dist/app/command-controller.js +58 -0
- package/dist/app/command-host.d.ts +44 -0
- package/dist/app/command-host.js +1 -0
- package/dist/app/command-model-actions.d.ts +12 -0
- package/dist/app/command-model-actions.js +176 -0
- package/dist/app/command-navigation-actions.d.ts +19 -0
- package/dist/app/command-navigation-actions.js +267 -0
- package/dist/app/command-registry.d.ts +32 -0
- package/dist/app/command-registry.js +225 -0
- package/dist/app/command-runtime.d.ts +5 -0
- package/dist/app/command-runtime.js +32 -0
- package/dist/app/command-session-actions.d.ts +20 -0
- package/dist/app/command-session-actions.js +295 -0
- package/dist/app/constants.d.ts +52 -0
- package/dist/app/constants.js +103 -0
- package/dist/app/conversation-entry-renderer.d.ts +21 -0
- package/dist/app/conversation-entry-renderer.js +81 -0
- package/dist/app/conversation-shell-renderer.d.ts +5 -0
- package/dist/app/conversation-shell-renderer.js +43 -0
- package/dist/app/conversation-tool-renderer.d.ts +16 -0
- package/dist/app/conversation-tool-renderer.js +216 -0
- package/dist/app/conversation-viewport.d.ts +55 -0
- package/dist/app/conversation-viewport.js +252 -0
- package/dist/app/dcp-stats.d.ts +2 -0
- package/dist/app/dcp-stats.js +116 -0
- package/dist/app/editor-layout-renderer.d.ts +31 -0
- package/dist/app/editor-layout-renderer.js +211 -0
- package/dist/app/editor-panels.d.ts +4 -0
- package/dist/app/editor-panels.js +130 -0
- package/dist/app/extension-actions-controller.d.ts +22 -0
- package/dist/app/extension-actions-controller.js +60 -0
- package/dist/app/extension-event-bus.d.ts +3 -0
- package/dist/app/extension-event-bus.js +23 -0
- package/dist/app/extension-ui-controller.d.ts +57 -0
- package/dist/app/extension-ui-controller.js +532 -0
- package/dist/app/file-link-opener.d.ts +2 -0
- package/dist/app/file-link-opener.js +66 -0
- package/dist/app/file-links.d.ts +10 -0
- package/dist/app/file-links.js +117 -0
- package/dist/app/guards.d.ts +3 -0
- package/dist/app/guards.js +9 -0
- package/dist/app/icons.d.ts +37 -0
- package/dist/app/icons.js +97 -0
- package/dist/app/id.d.ts +1 -0
- package/dist/app/id.js +4 -0
- package/dist/app/image-click-targets.d.ts +5 -0
- package/dist/app/image-click-targets.js +32 -0
- package/dist/app/image-opener.d.ts +2 -0
- package/dist/app/image-opener.js +64 -0
- package/dist/app/input-action-controller.d.ts +47 -0
- package/dist/app/input-action-controller.js +209 -0
- package/dist/app/input-controller.d.ts +60 -0
- package/dist/app/input-controller.js +425 -0
- package/dist/app/input-paste-handler.d.ts +27 -0
- package/dist/app/input-paste-handler.js +146 -0
- package/dist/app/menu-items-controller.d.ts +32 -0
- package/dist/app/menu-items-controller.js +182 -0
- package/dist/app/message-content.d.ts +8 -0
- package/dist/app/message-content.js +115 -0
- package/dist/app/model-ref.d.ts +13 -0
- package/dist/app/model-ref.js +50 -0
- package/dist/app/model-usage-controller.d.ts +35 -0
- package/dist/app/model-usage-controller.js +99 -0
- package/dist/app/model-usage-status.d.ts +125 -0
- package/dist/app/model-usage-status.js +749 -0
- package/dist/app/mouse-controller.d.ts +182 -0
- package/dist/app/mouse-controller.js +968 -0
- package/dist/app/native-modifiers.d.ts +3 -0
- package/dist/app/native-modifiers.js +60 -0
- package/dist/app/nerd-font-controller.d.ts +11 -0
- package/dist/app/nerd-font-controller.js +90 -0
- package/dist/app/popup-action-controller.d.ts +44 -0
- package/dist/app/popup-action-controller.js +278 -0
- package/dist/app/popup-menu-controller.d.ts +183 -0
- package/dist/app/popup-menu-controller.js +1070 -0
- package/dist/app/prompt-enhancer-controller.d.ts +40 -0
- package/dist/app/prompt-enhancer-controller.js +215 -0
- package/dist/app/queued-message-controller.d.ts +62 -0
- package/dist/app/queued-message-controller.js +377 -0
- package/dist/app/render-controller.d.ts +41 -0
- package/dist/app/render-controller.js +378 -0
- package/dist/app/render-text.d.ts +19 -0
- package/dist/app/render-text.js +67 -0
- package/dist/app/request-history.d.ts +23 -0
- package/dist/app/request-history.js +131 -0
- package/dist/app/runtime.d.ts +39 -0
- package/dist/app/runtime.js +195 -0
- package/dist/app/screen-selection.d.ts +6 -0
- package/dist/app/screen-selection.js +9 -0
- package/dist/app/screen-styler.d.ts +34 -0
- package/dist/app/screen-styler.js +168 -0
- package/dist/app/scroll-controller.d.ts +51 -0
- package/dist/app/scroll-controller.js +207 -0
- package/dist/app/session-event-controller.d.ts +69 -0
- package/dist/app/session-event-controller.js +338 -0
- package/dist/app/session-history.d.ts +23 -0
- package/dist/app/session-history.js +164 -0
- package/dist/app/session-lifecycle-controller.d.ts +55 -0
- package/dist/app/session-lifecycle-controller.js +116 -0
- package/dist/app/session-search.d.ts +24 -0
- package/dist/app/session-search.js +215 -0
- package/dist/app/shell-command.d.ts +27 -0
- package/dist/app/shell-command.js +176 -0
- package/dist/app/shell-controller.d.ts +28 -0
- package/dist/app/shell-controller.js +124 -0
- package/dist/app/slash-commands.d.ts +6 -0
- package/dist/app/slash-commands.js +75 -0
- package/dist/app/startup-checks.d.ts +8 -0
- package/dist/app/startup-checks.js +59 -0
- package/dist/app/startup-info.d.ts +3 -0
- package/dist/app/startup-info.js +176 -0
- package/dist/app/status-controller.d.ts +35 -0
- package/dist/app/status-controller.js +105 -0
- package/dist/app/status-line-renderer.d.ts +68 -0
- package/dist/app/status-line-renderer.js +453 -0
- package/dist/app/subagents-files.d.ts +10 -0
- package/dist/app/subagents-files.js +193 -0
- package/dist/app/subagents-model.d.ts +23 -0
- package/dist/app/subagents-model.js +224 -0
- package/dist/app/subagents-widget-controller.d.ts +43 -0
- package/dist/app/subagents-widget-controller.js +311 -0
- package/dist/app/tab-line-renderer.d.ts +26 -0
- package/dist/app/tab-line-renderer.js +222 -0
- package/dist/app/tabs-controller.d.ts +100 -0
- package/dist/app/tabs-controller.js +885 -0
- package/dist/app/terminal-controller.d.ts +40 -0
- package/dist/app/terminal-controller.js +135 -0
- package/dist/app/terminal-edit-shortcuts.d.ts +23 -0
- package/dist/app/terminal-edit-shortcuts.js +138 -0
- package/dist/app/terminal-output-buffer.d.ts +20 -0
- package/dist/app/terminal-output-buffer.js +52 -0
- package/dist/app/toast-controller.d.ts +13 -0
- package/dist/app/toast-controller.js +40 -0
- package/dist/app/toast-renderer.d.ts +9 -0
- package/dist/app/toast-renderer.js +79 -0
- package/dist/app/todo-model.d.ts +22 -0
- package/dist/app/todo-model.js +179 -0
- package/dist/app/todo-widget-controller.d.ts +21 -0
- package/dist/app/todo-widget-controller.js +59 -0
- package/dist/app/tool-block-renderer.d.ts +26 -0
- package/dist/app/tool-block-renderer.js +439 -0
- package/dist/app/types.d.ts +550 -0
- package/dist/app/types.js +1 -0
- package/dist/app/update.d.ts +36 -0
- package/dist/app/update.js +315 -0
- package/dist/app/voice-controller.d.ts +52 -0
- package/dist/app/voice-controller.js +600 -0
- package/dist/app/workspace-actions-controller.d.ts +40 -0
- package/dist/app/workspace-actions-controller.js +215 -0
- package/dist/app/workspace-undo.d.ts +44 -0
- package/dist/app/workspace-undo.js +215 -0
- package/dist/config.d.ts +62 -0
- package/dist/config.js +527 -0
- package/dist/context-progress-bar.d.ts +17 -0
- package/dist/context-progress-bar.js +48 -0
- package/dist/default-pix-config.d.ts +1 -0
- package/dist/default-pix-config.js +375 -0
- package/dist/fuzzy.d.ts +23 -0
- package/dist/fuzzy.js +165 -0
- package/dist/input-editor-files.d.ts +15 -0
- package/dist/input-editor-files.js +62 -0
- package/dist/input-editor.d.ts +186 -0
- package/dist/input-editor.js +835 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +12 -0
- package/dist/markdown-format.d.ts +22 -0
- package/dist/markdown-format.js +542 -0
- package/dist/sdk.d.ts +3 -0
- package/dist/sdk.js +1 -0
- package/dist/syntax-highlight.d.ts +22 -0
- package/dist/syntax-highlight.js +528 -0
- package/dist/terminal-width.d.ts +6 -0
- package/dist/terminal-width.js +245 -0
- package/dist/theme.d.ts +56 -0
- package/dist/theme.js +118 -0
- package/dist/tool-renderers/apply-patch.d.ts +2 -0
- package/dist/tool-renderers/apply-patch.js +36 -0
- package/dist/tool-renderers/ast.d.ts +2 -0
- package/dist/tool-renderers/ast.js +5 -0
- package/dist/tool-renderers/compress.d.ts +2 -0
- package/dist/tool-renderers/compress.js +126 -0
- package/dist/tool-renderers/index.d.ts +3 -0
- package/dist/tool-renderers/index.js +44 -0
- package/dist/tool-renderers/question.d.ts +2 -0
- package/dist/tool-renderers/question.js +88 -0
- package/dist/tool-renderers/read.d.ts +2 -0
- package/dist/tool-renderers/read.js +36 -0
- package/dist/tool-renderers/repo.d.ts +2 -0
- package/dist/tool-renderers/repo.js +13 -0
- package/dist/tool-renderers/shell.d.ts +3 -0
- package/dist/tool-renderers/shell.js +27 -0
- package/dist/tool-renderers/skill.d.ts +2 -0
- package/dist/tool-renderers/skill.js +132 -0
- package/dist/tool-renderers/subagents.d.ts +2 -0
- package/dist/tool-renderers/subagents.js +51 -0
- package/dist/tool-renderers/todo.d.ts +2 -0
- package/dist/tool-renderers/todo.js +9 -0
- package/dist/tool-renderers/types.d.ts +42 -0
- package/dist/tool-renderers/types.js +1 -0
- package/dist/tool-renderers/utils.d.ts +31 -0
- package/dist/tool-renderers/utils.js +230 -0
- package/dist/tool-renderers/web.d.ts +3 -0
- package/dist/tool-renderers/web.js +9 -0
- package/dist/tool-renderers/write.d.ts +2 -0
- package/dist/tool-renderers/write.js +42 -0
- package/dist/ui.d.ts +56 -0
- package/dist/ui.js +94 -0
- package/docs/release.md +81 -0
- package/extensions/question/contract.ts +100 -0
- package/extensions/question/index.ts +34 -0
- package/extensions/question/render.ts +28 -0
- package/extensions/question/result.ts +86 -0
- package/extensions/question/tool-description.ts +11 -0
- package/extensions/question/tui.ts +629 -0
- package/extensions/question/types.ts +123 -0
- package/extensions/session-title/config.ts +169 -0
- package/extensions/session-title/index.ts +459 -0
- package/extensions/terminal-bell/index.ts +315 -0
- package/external/pi-tools-suite/README.md +242 -0
- package/external/pi-tools-suite/index.ts +1 -0
- package/external/pi-tools-suite/licenses/ollama-pi-web-search.MIT +21 -0
- package/external/pi-tools-suite/licenses/opencode-mystatus-MIT.txt +21 -0
- package/external/pi-tools-suite/package.json +53 -0
- package/external/pi-tools-suite/src/antigravity-auth/auth-store.ts +194 -0
- package/external/pi-tools-suite/src/antigravity-auth/commands.ts +80 -0
- package/external/pi-tools-suite/src/antigravity-auth/constants.ts +26 -0
- package/external/pi-tools-suite/src/antigravity-auth/headers.ts +20 -0
- package/external/pi-tools-suite/src/antigravity-auth/index.ts +104 -0
- package/external/pi-tools-suite/src/antigravity-auth/models.ts +86 -0
- package/external/pi-tools-suite/src/antigravity-auth/oauth.ts +305 -0
- package/external/pi-tools-suite/src/antigravity-auth/payload.ts +423 -0
- package/external/pi-tools-suite/src/antigravity-auth/status.ts +78 -0
- package/external/pi-tools-suite/src/antigravity-auth/stream.ts +302 -0
- package/external/pi-tools-suite/src/antigravity-auth/types.ts +113 -0
- package/external/pi-tools-suite/src/ast-grep/index.ts +6 -0
- package/external/pi-tools-suite/src/ast-grep/render.ts +70 -0
- package/external/pi-tools-suite/src/ast-grep/schema.ts +109 -0
- package/external/pi-tools-suite/src/ast-grep/tool.ts +345 -0
- package/external/pi-tools-suite/src/ast-grep/types.ts +55 -0
- package/external/pi-tools-suite/src/ast-grep/utils.ts +65 -0
- package/external/pi-tools-suite/src/async-subagents/async-subagents.sample.jsonc +222 -0
- package/external/pi-tools-suite/src/async-subagents/commands.ts +518 -0
- package/external/pi-tools-suite/src/async-subagents/constants.ts +11 -0
- package/external/pi-tools-suite/src/async-subagents/core/agent-strategy.ts +74 -0
- package/external/pi-tools-suite/src/async-subagents/core/attachment-bridge.ts +133 -0
- package/external/pi-tools-suite/src/async-subagents/core/cleanup.ts +66 -0
- package/external/pi-tools-suite/src/async-subagents/core/concurrency.ts +90 -0
- package/external/pi-tools-suite/src/async-subagents/core/config.ts +819 -0
- package/external/pi-tools-suite/src/async-subagents/core/log-limits.ts +166 -0
- package/external/pi-tools-suite/src/async-subagents/core/model-fallback.ts +133 -0
- package/external/pi-tools-suite/src/async-subagents/core/paths.ts +47 -0
- package/external/pi-tools-suite/src/async-subagents/core/pi-invocation.ts +35 -0
- package/external/pi-tools-suite/src/async-subagents/core/presets.ts +67 -0
- package/external/pi-tools-suite/src/async-subagents/core/process.ts +15 -0
- package/external/pi-tools-suite/src/async-subagents/core/prompt.ts +66 -0
- package/external/pi-tools-suite/src/async-subagents/core/registry.ts +224 -0
- package/external/pi-tools-suite/src/async-subagents/core/retry.ts +191 -0
- package/external/pi-tools-suite/src/async-subagents/core/routing.ts +259 -0
- package/external/pi-tools-suite/src/async-subagents/core/sessions.ts +138 -0
- package/external/pi-tools-suite/src/async-subagents/core/spawn.ts +688 -0
- package/external/pi-tools-suite/src/async-subagents/core/state.ts +281 -0
- package/external/pi-tools-suite/src/async-subagents/core/stop.ts +131 -0
- package/external/pi-tools-suite/src/async-subagents/core/structured-result.ts +237 -0
- package/external/pi-tools-suite/src/async-subagents/core/tool-guard.ts +34 -0
- package/external/pi-tools-suite/src/async-subagents/core/types.ts +150 -0
- package/external/pi-tools-suite/src/async-subagents/core/ultrawork-auto.ts +184 -0
- package/external/pi-tools-suite/src/async-subagents/core/utils.ts +11 -0
- package/external/pi-tools-suite/src/async-subagents/format.ts +41 -0
- package/external/pi-tools-suite/src/async-subagents/index.ts +422 -0
- package/external/pi-tools-suite/src/async-subagents/lib.ts +88 -0
- package/external/pi-tools-suite/src/async-subagents/live.ts +10 -0
- package/external/pi-tools-suite/src/async-subagents/polling.ts +83 -0
- package/external/pi-tools-suite/src/async-subagents/render.ts +230 -0
- package/external/pi-tools-suite/src/async-subagents/subagent-overlay.ts +77 -0
- package/external/pi-tools-suite/src/async-subagents/tasks.ts +120 -0
- package/external/pi-tools-suite/src/async-subagents/tools/cleanup.ts +99 -0
- package/external/pi-tools-suite/src/async-subagents/tools/result.ts +179 -0
- package/external/pi-tools-suite/src/async-subagents/tools/spawn.ts +372 -0
- package/external/pi-tools-suite/src/async-subagents/tools/status.ts +60 -0
- package/external/pi-tools-suite/src/async-subagents/tools/stop.ts +79 -0
- package/external/pi-tools-suite/src/async-subagents/tools/subagents.ts +152 -0
- package/external/pi-tools-suite/src/async-subagents/tools/wait.ts +67 -0
- package/external/pi-tools-suite/src/async-subagents/types.ts +45 -0
- package/external/pi-tools-suite/src/async-subagents/ui.ts +5 -0
- package/external/pi-tools-suite/src/compress/commands.ts +440 -0
- package/external/pi-tools-suite/src/compress/compress-tool.ts +368 -0
- package/external/pi-tools-suite/src/compress/compression-blocks.ts +524 -0
- package/external/pi-tools-suite/src/compress/config.ts +310 -0
- package/external/pi-tools-suite/src/compress/dcp-tui-filter.ts +498 -0
- package/external/pi-tools-suite/src/compress/index.ts +397 -0
- package/external/pi-tools-suite/src/compress/prompts.ts +269 -0
- package/external/pi-tools-suite/src/compress/pruner-candidates.ts +176 -0
- package/external/pi-tools-suite/src/compress/pruner-compression-blocks.ts +260 -0
- package/external/pi-tools-suite/src/compress/pruner-message-ids.ts +147 -0
- package/external/pi-tools-suite/src/compress/pruner-metadata.ts +268 -0
- package/external/pi-tools-suite/src/compress/pruner-nudge.ts +315 -0
- package/external/pi-tools-suite/src/compress/pruner-tools.ts +263 -0
- package/external/pi-tools-suite/src/compress/pruner-types.ts +25 -0
- package/external/pi-tools-suite/src/compress/pruner.ts +92 -0
- package/external/pi-tools-suite/src/compress/state.ts +486 -0
- package/external/pi-tools-suite/src/compress/ui.ts +308 -0
- package/external/pi-tools-suite/src/config.ts +176 -0
- package/external/pi-tools-suite/src/context-usage.ts +31 -0
- package/external/pi-tools-suite/src/default-pi-tools-suite-config.ts +355 -0
- package/external/pi-tools-suite/src/index.ts +46 -0
- package/external/pi-tools-suite/src/lib/lsp.ts +62 -0
- package/external/pi-tools-suite/src/lib/project.ts +42 -0
- package/external/pi-tools-suite/src/lib/tool-args.ts +137 -0
- package/external/pi-tools-suite/src/lsp/_shared/config.ts +156 -0
- package/external/pi-tools-suite/src/lsp/_shared/glob.ts +60 -0
- package/external/pi-tools-suite/src/lsp/_shared/output.ts +102 -0
- package/external/pi-tools-suite/src/lsp/_shared/paths.ts +138 -0
- package/external/pi-tools-suite/src/lsp/_shared/runner.ts +64 -0
- package/external/pi-tools-suite/src/lsp/_shared/template.ts +23 -0
- package/external/pi-tools-suite/src/lsp/_shared/trust.ts +116 -0
- package/external/pi-tools-suite/src/lsp/_shared/types.ts +98 -0
- package/external/pi-tools-suite/src/lsp/async.ts +29 -0
- package/external/pi-tools-suite/src/lsp/child-process.ts +81 -0
- package/external/pi-tools-suite/src/lsp/client.ts +340 -0
- package/external/pi-tools-suite/src/lsp/constants.ts +9 -0
- package/external/pi-tools-suite/src/lsp/diagnostics-store.ts +64 -0
- package/external/pi-tools-suite/src/lsp/documents.ts +24 -0
- package/external/pi-tools-suite/src/lsp/index.ts +31 -0
- package/external/pi-tools-suite/src/lsp/lsp-utils.ts +37 -0
- package/external/pi-tools-suite/src/lsp/manager.ts +190 -0
- package/external/pi-tools-suite/src/lsp/mutation-events.ts +78 -0
- package/external/pi-tools-suite/src/lsp/renderer.ts +1 -0
- package/external/pi-tools-suite/src/lsp/tool-result.ts +6 -0
- package/external/pi-tools-suite/src/lsp/tsserver.ts +107 -0
- package/external/pi-tools-suite/src/lsp/types.ts +15 -0
- package/external/pi-tools-suite/src/model-tools/apply-patch.ts +590 -0
- package/external/pi-tools-suite/src/model-tools/index.ts +430 -0
- package/external/pi-tools-suite/src/model-tools/path-utils.ts +6 -0
- package/external/pi-tools-suite/src/model-tools/tool-args.ts +11 -0
- package/external/pi-tools-suite/src/prompt-commands/index.ts +349 -0
- package/external/pi-tools-suite/src/repo-discovery/index.ts +384 -0
- package/external/pi-tools-suite/src/repo-discovery/project.ts +7 -0
- package/external/pi-tools-suite/src/startup-section.ts +13 -0
- package/external/pi-tools-suite/src/terminal-bell/index.ts +309 -0
- package/external/pi-tools-suite/src/todo/index.ts +201 -0
- package/external/pi-tools-suite/src/todo/state/auto-clear.ts +13 -0
- package/external/pi-tools-suite/src/todo/state/invariants.ts +21 -0
- package/external/pi-tools-suite/src/todo/state/persistence.ts +94 -0
- package/external/pi-tools-suite/src/todo/state/replay.ts +38 -0
- package/external/pi-tools-suite/src/todo/state/selectors.ts +49 -0
- package/external/pi-tools-suite/src/todo/state/state-reducer.ts +362 -0
- package/external/pi-tools-suite/src/todo/state/state.ts +18 -0
- package/external/pi-tools-suite/src/todo/state/store.ts +52 -0
- package/external/pi-tools-suite/src/todo/state/task-graph.ts +57 -0
- package/external/pi-tools-suite/src/todo/todo.ts +487 -0
- package/external/pi-tools-suite/src/todo/tool/response-envelope.ts +143 -0
- package/external/pi-tools-suite/src/todo/tool/types.ts +188 -0
- package/external/pi-tools-suite/src/todo/view/format.ts +18 -0
- package/external/pi-tools-suite/src/todo/view/labels.ts +13 -0
- package/external/pi-tools-suite/src/tool-descriptions.ts +369 -0
- package/external/pi-tools-suite/src/usage/index.ts +152 -0
- package/external/pi-tools-suite/src/usage/lib/copilot.ts +535 -0
- package/external/pi-tools-suite/src/usage/lib/google.ts +478 -0
- package/external/pi-tools-suite/src/usage/lib/openai.ts +268 -0
- package/external/pi-tools-suite/src/usage/lib/types.ts +114 -0
- package/external/pi-tools-suite/src/usage/lib/utils.ts +134 -0
- package/external/pi-tools-suite/src/usage/lib/zhipu.ts +228 -0
- package/external/pi-tools-suite/src/web-search/index.ts +397 -0
- package/package.json +89 -0
- package/skills/context7/SKILL.md +69 -0
- package/skills/context7/scripts/context7.sh +73 -0
- package/skills/handoff/SKILL.md +15 -0
- package/skills/pdf/LICENSE.txt +30 -0
- package/skills/pdf/SKILL.md +314 -0
- package/skills/pdf/forms.md +294 -0
- package/skills/pdf/reference.md +612 -0
- package/skills/pdf/scripts/check_bounding_boxes.py +65 -0
- package/skills/pdf/scripts/check_fillable_fields.py +11 -0
- package/skills/pdf/scripts/convert_pdf_to_images.py +33 -0
- package/skills/pdf/scripts/create_validation_image.py +37 -0
- package/skills/pdf/scripts/extract_form_field_info.py +122 -0
- package/skills/pdf/scripts/extract_form_structure.py +115 -0
- package/skills/pdf/scripts/fill_fillable_fields.py +98 -0
- package/skills/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
- package/skills/playwright-cli/SKILL.md +388 -0
- package/skills/playwright-cli/references/element-attributes.md +23 -0
- package/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/skills/playwright-cli/references/request-mocking.md +87 -0
- package/skills/playwright-cli/references/running-code.md +241 -0
- package/skills/playwright-cli/references/session-management.md +225 -0
- package/skills/playwright-cli/references/spec-driven-testing.md +305 -0
- package/skills/playwright-cli/references/storage-state.md +275 -0
- package/skills/playwright-cli/references/test-generation.md +134 -0
- package/skills/playwright-cli/references/tracing.md +139 -0
- package/skills/playwright-cli/references/video-recording.md +143 -0
- package/skills/simplify/SKILL.md +51 -0
- package/skills/skill-creator/LICENSE.txt +202 -0
- package/skills/skill-creator/SKILL.md +485 -0
- package/skills/skill-creator/agents/analyzer.md +274 -0
- package/skills/skill-creator/agents/comparator.md +202 -0
- package/skills/skill-creator/agents/grader.md +223 -0
- package/skills/skill-creator/assets/eval_review.html +146 -0
- package/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/skills/skill-creator/references/schemas.md +430 -0
- package/skills/skill-creator/scripts/__init__.py +0 -0
- package/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/skills/skill-creator/scripts/generate_report.py +326 -0
- package/skills/skill-creator/scripts/improve_description.py +247 -0
- package/skills/skill-creator/scripts/package_skill.py +136 -0
- package/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/skills/skill-creator/scripts/run_eval.py +310 -0
- package/skills/skill-creator/scripts/run_loop.py +328 -0
- package/skills/skill-creator/scripts/utils.py +47 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { ABOVE_EDITOR_WIDGET_KEY_GROUPS, BUILT_IN_SUBAGENTS_WIDGET_KEYS, INPUT_MAX_ROWS, LEGACY_TODO_WIDGET_KEYS, } from "./constants.js";
|
|
2
|
+
import { renderSubagentsPanel, renderTodoPanel } from "./editor-panels.js";
|
|
3
|
+
import { ellipsizeDisplay, horizontalPaddingLayout, padHorizontalText, sanitizeText } from "./render-text.js";
|
|
4
|
+
import { APP_ICONS } from "./icons.js";
|
|
5
|
+
const INPUT_FRAME_VERTICAL = "│";
|
|
6
|
+
export class EditorLayoutRenderer {
|
|
7
|
+
host;
|
|
8
|
+
constructor(host) {
|
|
9
|
+
this.host = host;
|
|
10
|
+
}
|
|
11
|
+
computeLayout(width, rows) {
|
|
12
|
+
const maxAvailableInputRows = Math.max(1, rows - 5);
|
|
13
|
+
const renderedInput = this.renderInput(width, Math.min(INPUT_MAX_ROWS, maxAvailableInputRows), maxAvailableInputRows);
|
|
14
|
+
const maxEntityRows = Math.max(0, rows - renderedInput.lines.length - 4);
|
|
15
|
+
const framedEntityWidth = inputFrameContentWidth(width);
|
|
16
|
+
const aboveEditorEntities = this.renderAboveEditorEntities(framedEntityWidth);
|
|
17
|
+
let aboveEditorLines = this.limitEntityLines(aboveEditorEntities.lines, maxEntityRows);
|
|
18
|
+
if (aboveEditorEntities.hasWidgets && aboveEditorLines.length < maxEntityRows) {
|
|
19
|
+
aboveEditorLines = [...aboveEditorLines, { text: "", variant: "normal" }];
|
|
20
|
+
}
|
|
21
|
+
const belowEditorLines = this.limitEntityLines(this.renderExtensionWidgets("belowEditor", framedEntityWidth), maxEntityRows - aboveEditorLines.length);
|
|
22
|
+
const inputBottomSeparatorRow = rows - 1;
|
|
23
|
+
const belowEditorStartRow = inputBottomSeparatorRow - belowEditorLines.length;
|
|
24
|
+
const inputStartRow = belowEditorStartRow - renderedInput.lines.length;
|
|
25
|
+
const inputSeparatorRow = inputStartRow - aboveEditorLines.length - 1;
|
|
26
|
+
return {
|
|
27
|
+
renderedInput,
|
|
28
|
+
aboveEditorLines,
|
|
29
|
+
belowEditorLines,
|
|
30
|
+
inputStartRow,
|
|
31
|
+
inputSeparatorRow,
|
|
32
|
+
inputBottomSeparatorRow,
|
|
33
|
+
bodyHeight: Math.max(0, inputSeparatorRow - 1),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
renderWidgetRegistration(widget, width) {
|
|
37
|
+
try {
|
|
38
|
+
const lines = Array.isArray(widget.content)
|
|
39
|
+
? widget.content
|
|
40
|
+
: this.renderWidgetComponent(widget, width);
|
|
41
|
+
return lines.map((line) => ({ text: line, variant: "normal" }));
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return [{ text: `${widget.key}: widget render failed: ${String(error)}`, variant: "error" }];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
renderWidgetComponent(widget, width) {
|
|
48
|
+
const content = widget.content;
|
|
49
|
+
if (typeof content !== "function")
|
|
50
|
+
return [...content];
|
|
51
|
+
const component = widget.component ?? content(this.host.widgetTuiHandle(), this.host.createExtensionTheme());
|
|
52
|
+
widget.component = component;
|
|
53
|
+
return component.render(width);
|
|
54
|
+
}
|
|
55
|
+
renderAboveEditorEntities(width) {
|
|
56
|
+
const todoPanelLines = renderTodoPanel(this.host.todoDetails, this.host.todoPanelExpanded, width, this.host.theme.colors);
|
|
57
|
+
const hasBuiltInTodoPanel = todoPanelLines.length > 0;
|
|
58
|
+
const subagentsPanelLines = renderSubagentsPanel(this.host.subagentsWidgetState, this.host.subagentsPanelExpanded, width, this.host.theme.colors);
|
|
59
|
+
const hasBuiltInSubagentsPanel = subagentsPanelLines.length > 0;
|
|
60
|
+
const lines = [...todoPanelLines, ...subagentsPanelLines];
|
|
61
|
+
let hasWidgets = lines.length > 0;
|
|
62
|
+
const consumedWidgetKeys = new Set();
|
|
63
|
+
for (const widgetKeys of ABOVE_EDITOR_WIDGET_KEY_GROUPS) {
|
|
64
|
+
const slotLines = [];
|
|
65
|
+
for (const key of widgetKeys) {
|
|
66
|
+
if (hasBuiltInTodoPanel && LEGACY_TODO_WIDGET_KEYS.has(key)) {
|
|
67
|
+
consumedWidgetKeys.add(key);
|
|
68
|
+
this.host.suppressExtensionWidget(key);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (hasBuiltInSubagentsPanel && BUILT_IN_SUBAGENTS_WIDGET_KEYS.has(key)) {
|
|
72
|
+
consumedWidgetKeys.add(key);
|
|
73
|
+
this.host.suppressExtensionWidget(key);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const widget = this.host.extensionWidgets.get(key);
|
|
77
|
+
if (!widget || widget.placement !== "aboveEditor")
|
|
78
|
+
continue;
|
|
79
|
+
consumedWidgetKeys.add(key);
|
|
80
|
+
const widgetLines = this.renderWidgetRegistration(widget, width);
|
|
81
|
+
if (widgetLines.length > 0)
|
|
82
|
+
hasWidgets = true;
|
|
83
|
+
slotLines.push(...widgetLines);
|
|
84
|
+
}
|
|
85
|
+
lines.push(...slotLines);
|
|
86
|
+
}
|
|
87
|
+
for (const widget of this.host.extensionWidgets.values()) {
|
|
88
|
+
if (widget.placement !== "aboveEditor" || consumedWidgetKeys.has(widget.key))
|
|
89
|
+
continue;
|
|
90
|
+
if (hasBuiltInTodoPanel && LEGACY_TODO_WIDGET_KEYS.has(widget.key)) {
|
|
91
|
+
this.host.suppressExtensionWidget(widget.key);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (hasBuiltInSubagentsPanel && BUILT_IN_SUBAGENTS_WIDGET_KEYS.has(widget.key)) {
|
|
95
|
+
this.host.suppressExtensionWidget(widget.key);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const widgetLines = this.renderWidgetRegistration(widget, width);
|
|
99
|
+
if (widgetLines.length > 0)
|
|
100
|
+
hasWidgets = true;
|
|
101
|
+
lines.push(...widgetLines);
|
|
102
|
+
}
|
|
103
|
+
lines.push(...this.renderVoicePartial(width));
|
|
104
|
+
return { lines, hasWidgets };
|
|
105
|
+
}
|
|
106
|
+
renderVoicePartial(width) {
|
|
107
|
+
const partial = this.host.voicePartialText?.trim();
|
|
108
|
+
if (!partial)
|
|
109
|
+
return [];
|
|
110
|
+
const { left, contentWidth } = horizontalPaddingLayout(width);
|
|
111
|
+
const text = ellipsizeDisplay(`${APP_ICONS.microphone} ${sanitizeText(partial)}`, contentWidth);
|
|
112
|
+
return [{
|
|
113
|
+
text: padHorizontalText(text, width),
|
|
114
|
+
variant: "muted",
|
|
115
|
+
segments: [{ start: left, end: left + APP_ICONS.microphone.length, foreground: this.host.theme.colors.error }],
|
|
116
|
+
}];
|
|
117
|
+
}
|
|
118
|
+
renderExtensionWidgets(placement, width) {
|
|
119
|
+
const lines = [];
|
|
120
|
+
for (const widget of this.host.extensionWidgets.values()) {
|
|
121
|
+
if (widget.placement !== placement)
|
|
122
|
+
continue;
|
|
123
|
+
lines.push(...this.renderWidgetRegistration(widget, width));
|
|
124
|
+
}
|
|
125
|
+
return lines;
|
|
126
|
+
}
|
|
127
|
+
limitEntityLines(lines, maxRows) {
|
|
128
|
+
if (maxRows <= 0)
|
|
129
|
+
return [];
|
|
130
|
+
if (lines.length <= maxRows)
|
|
131
|
+
return [...lines];
|
|
132
|
+
const hidden = lines.length - maxRows + 1;
|
|
133
|
+
return [
|
|
134
|
+
...lines.slice(0, Math.max(0, maxRows - 1)),
|
|
135
|
+
{ text: `… +${hidden} more UI rows`, variant: "muted" },
|
|
136
|
+
];
|
|
137
|
+
}
|
|
138
|
+
renderInput(width, normalMaxRows, extensionMaxRows) {
|
|
139
|
+
const { left, contentWidth } = horizontalPaddingLayout(width);
|
|
140
|
+
const extensionLines = this.host.renderExtensionInputComponent(contentWidth);
|
|
141
|
+
const hasExtensionInput = extensionLines !== undefined;
|
|
142
|
+
const usesEditor = !hasExtensionInput || this.host.extensionInputUsesEditor();
|
|
143
|
+
const maxRows = hasExtensionInput ? extensionMaxRows : normalMaxRows;
|
|
144
|
+
const customLines = hasExtensionInput
|
|
145
|
+
? this.limitExtensionInputLines(extensionLines, Math.max(0, maxRows - (usesEditor ? 1 : 0)))
|
|
146
|
+
: [];
|
|
147
|
+
const editorMaxRows = usesEditor ? Math.max(1, maxRows - customLines.length) : 1;
|
|
148
|
+
const rendered = this.host.inputEditor.render(contentWidth, editorMaxRows, "", "");
|
|
149
|
+
const visibleLines = rendered.visualLines.slice(rendered.scrollOffset, rendered.scrollOffset + editorMaxRows);
|
|
150
|
+
const scrollBar = usesEditor
|
|
151
|
+
? inputScrollBarMetrics(rendered.visualLines.length, visibleLines.length, rendered.scrollOffset)
|
|
152
|
+
: undefined;
|
|
153
|
+
const editorLines = usesEditor ? visibleLines.map((vl) => frameInputLine(padHorizontalText(vl.text, width))) : [];
|
|
154
|
+
const editorTagSpans = usesEditor
|
|
155
|
+
? visibleLines.map((vl) => vl.tagSpans.map((span) => ({
|
|
156
|
+
start: span.start + left,
|
|
157
|
+
end: span.end + left,
|
|
158
|
+
})))
|
|
159
|
+
: [];
|
|
160
|
+
const paddedCustomLines = customLines.map((line) => frameInputLine(padHorizontalText(line, width)));
|
|
161
|
+
return {
|
|
162
|
+
lines: [...paddedCustomLines, ...editorLines],
|
|
163
|
+
cursorRowOffset: customLines.length + rendered.cursorVisualRow - rendered.scrollOffset,
|
|
164
|
+
cursorColumn: Math.min(width, left + rendered.cursorScreenCol),
|
|
165
|
+
cursorVisible: usesEditor && rendered.cursorVisible,
|
|
166
|
+
scrollOffset: rendered.scrollOffset,
|
|
167
|
+
totalLineCount: rendered.visualLines.length,
|
|
168
|
+
visibleRowCount: visibleLines.length,
|
|
169
|
+
scrollBar,
|
|
170
|
+
editorStartRowOffset: customLines.length,
|
|
171
|
+
tagSpans: [
|
|
172
|
+
...paddedCustomLines.map(() => []),
|
|
173
|
+
...editorTagSpans,
|
|
174
|
+
],
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
limitExtensionInputLines(lines, maxRows) {
|
|
178
|
+
if (maxRows <= 0)
|
|
179
|
+
return [];
|
|
180
|
+
if (lines.length <= maxRows)
|
|
181
|
+
return [...lines];
|
|
182
|
+
const hidden = lines.length - maxRows + 1;
|
|
183
|
+
return [
|
|
184
|
+
...lines.slice(0, Math.max(0, maxRows - 1)),
|
|
185
|
+
`… +${hidden} more UI rows`,
|
|
186
|
+
];
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function frameInputLine(line) {
|
|
190
|
+
if (line.length <= 0)
|
|
191
|
+
return line;
|
|
192
|
+
if (line.length === 1)
|
|
193
|
+
return INPUT_FRAME_VERTICAL;
|
|
194
|
+
return `${INPUT_FRAME_VERTICAL}${line.slice(1, -1)}${INPUT_FRAME_VERTICAL}`;
|
|
195
|
+
}
|
|
196
|
+
function inputFrameContentWidth(width) {
|
|
197
|
+
return Math.max(1, width - 2);
|
|
198
|
+
}
|
|
199
|
+
function inputScrollBarMetrics(totalLineCount, visibleRowCount, scrollOffset) {
|
|
200
|
+
if (visibleRowCount <= 0 || totalLineCount <= visibleRowCount)
|
|
201
|
+
return undefined;
|
|
202
|
+
const thumbSize = Math.max(1, Math.min(visibleRowCount, Math.round((visibleRowCount * visibleRowCount) / totalLineCount)));
|
|
203
|
+
const travel = Math.max(0, visibleRowCount - thumbSize);
|
|
204
|
+
const maxScroll = Math.max(0, totalLineCount - visibleRowCount);
|
|
205
|
+
const thumbOffset = travel === 0 ? 0 : Math.round((scrollOffset / maxScroll) * travel);
|
|
206
|
+
return {
|
|
207
|
+
top: thumbOffset,
|
|
208
|
+
height: thumbSize,
|
|
209
|
+
trackHeight: visibleRowCount,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Theme } from "../theme.js";
|
|
2
|
+
import type { RenderedLine, SubagentsWidgetState, TodoDetails } from "./types.js";
|
|
3
|
+
export declare function renderTodoPanel(details: TodoDetails | undefined, expanded: boolean, width: number, colors: Theme["colors"]): RenderedLine[];
|
|
4
|
+
export declare function renderSubagentsPanel(state: SubagentsWidgetState | undefined, expanded: boolean, width: number, colors: Theme["colors"]): RenderedLine[];
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { stringDisplayWidth } from "../terminal-width.js";
|
|
2
|
+
import { SUBAGENTS_WIDGET_MAX_ROWS } from "./constants.js";
|
|
3
|
+
import { ellipsizeDisplay, padOrTrimPlain, wrapLine } from "./render-text.js";
|
|
4
|
+
import { activeSubagentStates, formatElapsedSince, formatSubagentsPanelStats, subagentModelThinkingLabel, subagentRunName, subagentStatusIcon, taskPreviewMap, } from "./subagents-model.js";
|
|
5
|
+
import { formatTodoPanelStats, formatTodoTaskLine, hasOpenTodoTasks, shiftSegmentsToSlice, todoTaskLineSegments, visibleTodoTaskRows, visibleTodoTasks, } from "./todo-model.js";
|
|
6
|
+
export function renderTodoPanel(details, expanded, width, colors) {
|
|
7
|
+
if (!details)
|
|
8
|
+
return [];
|
|
9
|
+
const tasks = visibleTodoTasks(details);
|
|
10
|
+
if (tasks.length === 0)
|
|
11
|
+
return [];
|
|
12
|
+
if (!hasOpenTodoTasks(details))
|
|
13
|
+
return [];
|
|
14
|
+
const contentWidth = Math.max(1, width);
|
|
15
|
+
const target = { kind: "todo-panel" };
|
|
16
|
+
const activeTask = tasks.find((task) => task.status === "in_progress");
|
|
17
|
+
const stats = formatTodoPanelStats(tasks);
|
|
18
|
+
const headerText = `todos ${expanded ? "▾" : "▸"}${stats ? ` ${stats}` : ""}`;
|
|
19
|
+
const todoPanelColor = colors.warning;
|
|
20
|
+
const todoMetaColor = colors.muted;
|
|
21
|
+
if (!expanded) {
|
|
22
|
+
const prefix = `${headerText} — current: `;
|
|
23
|
+
const current = activeTask ? formatTodoTaskLine(activeTask) : "no active todo";
|
|
24
|
+
const collapsedText = `${prefix}${current}`;
|
|
25
|
+
const segments = activeTask
|
|
26
|
+
? todoTaskLineSegments(activeTask, todoMetaColor).map((segment) => ({
|
|
27
|
+
...segment,
|
|
28
|
+
start: segment.start + prefix.length,
|
|
29
|
+
end: segment.end + prefix.length,
|
|
30
|
+
}))
|
|
31
|
+
: undefined;
|
|
32
|
+
const line = {
|
|
33
|
+
text: padOrTrimPlain(ellipsizeDisplay(collapsedText, contentWidth), width),
|
|
34
|
+
colorOverride: todoPanelColor,
|
|
35
|
+
target,
|
|
36
|
+
};
|
|
37
|
+
if (segments)
|
|
38
|
+
line.segments = segments;
|
|
39
|
+
return [line];
|
|
40
|
+
}
|
|
41
|
+
const lines = [];
|
|
42
|
+
for (const { task, depth } of visibleTodoTaskRows(details)) {
|
|
43
|
+
const text = formatTodoTaskLine(task, { depth });
|
|
44
|
+
const segments = todoTaskLineSegments(task, todoMetaColor, { depth });
|
|
45
|
+
let start = 0;
|
|
46
|
+
for (const wrapped of wrapLine(text, contentWidth)) {
|
|
47
|
+
lines.push({
|
|
48
|
+
text: padOrTrimPlain(wrapped, width),
|
|
49
|
+
colorOverride: todoPanelColor,
|
|
50
|
+
segments: shiftSegmentsToSlice(segments, start, wrapped.length),
|
|
51
|
+
target,
|
|
52
|
+
});
|
|
53
|
+
start += wrapped.length;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return lines;
|
|
57
|
+
}
|
|
58
|
+
export function renderSubagentsPanel(state, expanded, width, colors) {
|
|
59
|
+
if (!state)
|
|
60
|
+
return [];
|
|
61
|
+
const activeAgents = activeSubagentStates(state.agents);
|
|
62
|
+
if (activeAgents.length === 0)
|
|
63
|
+
return [];
|
|
64
|
+
const target = { kind: "subagents-panel" };
|
|
65
|
+
const previewById = taskPreviewMap(state.tasks);
|
|
66
|
+
const runName = subagentRunName(state.runDir);
|
|
67
|
+
const titleSuffix = state.live ? "" : " (snapshot)";
|
|
68
|
+
const stats = formatSubagentsPanelStats(activeAgents);
|
|
69
|
+
const headerText = `subagents ${expanded ? "▾" : "▸"}${stats ? ` ${stats}` : ""}${titleSuffix}`;
|
|
70
|
+
const contentWidth = Math.max(1, width);
|
|
71
|
+
if (!expanded) {
|
|
72
|
+
const collapsedText = `${headerText} — ${runName}`;
|
|
73
|
+
return [{ text: padOrTrimPlain(ellipsizeDisplay(collapsedText, contentWidth), width), colorOverride: colors.accent, target }];
|
|
74
|
+
}
|
|
75
|
+
const lines = [];
|
|
76
|
+
const visibleAgents = activeAgents.slice(0, SUBAGENTS_WIDGET_MAX_ROWS);
|
|
77
|
+
const rowWidth = contentWidth;
|
|
78
|
+
const now = Date.now();
|
|
79
|
+
for (const agent of visibleAgents) {
|
|
80
|
+
const preview = previewById.get(agent.id);
|
|
81
|
+
const model = subagentModelThinkingLabel(preview);
|
|
82
|
+
const task = preview?.task?.trim() || preview?.scope?.trim() || "task unavailable";
|
|
83
|
+
const icon = subagentStatusIcon(agent.status);
|
|
84
|
+
const prefix = `${icon} ${agent.id} ${model} `;
|
|
85
|
+
const suffix = ` ${formatElapsedSince(agent.startedAt, now)}`;
|
|
86
|
+
const taskWidth = Math.max(8, rowWidth - stringDisplayWidth(prefix) - stringDisplayWidth(suffix));
|
|
87
|
+
const taskText = ellipsizeDisplay(task, taskWidth);
|
|
88
|
+
const text = `${prefix}${taskText}${suffix}`;
|
|
89
|
+
lines.push({
|
|
90
|
+
text: padOrTrimPlain(text, width),
|
|
91
|
+
colorOverride: colors.muted,
|
|
92
|
+
segments: subagentPanelLineSegments({ text, icon, agentId: agent.id, model, taskText, prefix, status: agent.status }, colors),
|
|
93
|
+
target,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const hidden = activeAgents.length - visibleAgents.length;
|
|
97
|
+
if (hidden > 0)
|
|
98
|
+
lines.push({ text: padOrTrimPlain(`+${hidden} more`, width), variant: "muted", target });
|
|
99
|
+
return lines;
|
|
100
|
+
}
|
|
101
|
+
function subagentPanelLineSegments(input, colors) {
|
|
102
|
+
const iconStart = input.text.indexOf(input.icon);
|
|
103
|
+
const nameStart = input.text.indexOf(input.agentId, iconStart + input.icon.length);
|
|
104
|
+
const modelStart = input.text.indexOf(input.model, nameStart + input.agentId.length);
|
|
105
|
+
const taskStart = input.prefix.length;
|
|
106
|
+
const suffixStart = taskStart + input.taskText.length;
|
|
107
|
+
return [
|
|
108
|
+
{ start: iconStart, end: iconStart + input.icon.length, foreground: subagentStatusColor(input.status, colors), bold: true },
|
|
109
|
+
{ start: nameStart, end: nameStart + input.agentId.length, foreground: colors.accent, bold: true },
|
|
110
|
+
{ start: modelStart, end: modelStart + input.model.length, foreground: colors.info },
|
|
111
|
+
{ start: taskStart, end: suffixStart, foreground: colors.muted },
|
|
112
|
+
{ start: suffixStart, end: input.text.length, foreground: colors.muted },
|
|
113
|
+
].filter((segment) => segment.start >= 0 && segment.end > segment.start);
|
|
114
|
+
}
|
|
115
|
+
function subagentStatusColor(status, colors) {
|
|
116
|
+
switch (status) {
|
|
117
|
+
case "planned":
|
|
118
|
+
return colors.muted;
|
|
119
|
+
case "running":
|
|
120
|
+
return colors.info;
|
|
121
|
+
case "retrying":
|
|
122
|
+
return colors.warning;
|
|
123
|
+
case "done":
|
|
124
|
+
return colors.success;
|
|
125
|
+
case "failed":
|
|
126
|
+
return colors.error;
|
|
127
|
+
case "stopped":
|
|
128
|
+
return colors.muted;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AgentSessionRuntime, ExtensionCommandContextActions, ExtensionError } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { Entry } from "./types.js";
|
|
3
|
+
export type AppExtensionActionsHost = {
|
|
4
|
+
isRunning(): boolean;
|
|
5
|
+
getInput(): string;
|
|
6
|
+
setInput(value: string): void;
|
|
7
|
+
resetSessionView(): void;
|
|
8
|
+
loadSessionHistory(): void;
|
|
9
|
+
afterSessionReplacement(message?: string): void;
|
|
10
|
+
addEntry(entry: Entry): void;
|
|
11
|
+
setStatus(status: string): void;
|
|
12
|
+
setSessionStatus(runtime: AgentSessionRuntime["session"]): void;
|
|
13
|
+
showToast(message: string, kind: "success" | "error" | "warning" | "info"): void;
|
|
14
|
+
render(): void;
|
|
15
|
+
};
|
|
16
|
+
export declare class AppExtensionActionsController {
|
|
17
|
+
private readonly host;
|
|
18
|
+
constructor(host: AppExtensionActionsHost);
|
|
19
|
+
createCommandContextActions(runtime: AgentSessionRuntime): ExtensionCommandContextActions;
|
|
20
|
+
waitForSessionIdle(runtime: AgentSessionRuntime): Promise<void>;
|
|
21
|
+
handleExtensionError(error: ExtensionError): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createId } from "./id.js";
|
|
2
|
+
export class AppExtensionActionsController {
|
|
3
|
+
host;
|
|
4
|
+
constructor(host) {
|
|
5
|
+
this.host = host;
|
|
6
|
+
}
|
|
7
|
+
createCommandContextActions(runtime) {
|
|
8
|
+
return {
|
|
9
|
+
waitForIdle: () => this.waitForSessionIdle(runtime),
|
|
10
|
+
newSession: async (options) => {
|
|
11
|
+
const result = await runtime.newSession(options);
|
|
12
|
+
if (!result.cancelled)
|
|
13
|
+
this.host.afterSessionReplacement("Started a new session.");
|
|
14
|
+
return result;
|
|
15
|
+
},
|
|
16
|
+
fork: async (entryId, options) => {
|
|
17
|
+
const result = await runtime.fork(entryId, options);
|
|
18
|
+
if (!result.cancelled)
|
|
19
|
+
this.host.afterSessionReplacement("Forked to a new session.");
|
|
20
|
+
return result;
|
|
21
|
+
},
|
|
22
|
+
navigateTree: async (targetId, options) => {
|
|
23
|
+
const result = await runtime.session.navigateTree(targetId, options);
|
|
24
|
+
if (!result.cancelled && !result.aborted) {
|
|
25
|
+
this.host.resetSessionView();
|
|
26
|
+
this.host.loadSessionHistory();
|
|
27
|
+
if (result.editorText && !this.host.getInput().trim())
|
|
28
|
+
this.host.setInput(result.editorText);
|
|
29
|
+
this.host.setSessionStatus(runtime.session);
|
|
30
|
+
this.host.render();
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
},
|
|
34
|
+
switchSession: async (sessionPath, options) => {
|
|
35
|
+
const result = await runtime.switchSession(sessionPath, options);
|
|
36
|
+
if (!result.cancelled)
|
|
37
|
+
this.host.afterSessionReplacement(`Switched session: ${sessionPath}`);
|
|
38
|
+
return result;
|
|
39
|
+
},
|
|
40
|
+
reload: async () => {
|
|
41
|
+
await runtime.session.reload();
|
|
42
|
+
this.host.setSessionStatus(runtime.session);
|
|
43
|
+
this.host.showToast("Reloaded resources", "success");
|
|
44
|
+
this.host.render();
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
async waitForSessionIdle(runtime) {
|
|
49
|
+
while (runtime.session.isStreaming || runtime.session.isCompacting) {
|
|
50
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
handleExtensionError(error) {
|
|
54
|
+
const pathText = error.extensionPath ? ` (${error.extensionPath})` : "";
|
|
55
|
+
this.host.addEntry({ id: createId("error"), kind: "error", text: `Extension ${error.event} failed${pathText}: ${error.error}` });
|
|
56
|
+
this.host.showToast(`Extension ${error.event} failed`, "error");
|
|
57
|
+
if (this.host.isRunning())
|
|
58
|
+
this.host.render();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
export function createIsolatedExtensionEventBus(forwardEmit) {
|
|
3
|
+
const emitter = new EventEmitter();
|
|
4
|
+
emitter.setMaxListeners(0);
|
|
5
|
+
return {
|
|
6
|
+
emit: (channel, data) => {
|
|
7
|
+
emitter.emit(channel, data);
|
|
8
|
+
forwardEmit?.(channel, data);
|
|
9
|
+
},
|
|
10
|
+
on: (channel, handler) => {
|
|
11
|
+
const safeHandler = async (data) => {
|
|
12
|
+
try {
|
|
13
|
+
await handler(data);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
console.error(`Event handler error (${channel}):`, error);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
emitter.on(channel, safeHandler);
|
|
20
|
+
return () => emitter.off(channel, safeHandler);
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type Theme } from "../theme.js";
|
|
2
|
+
import { type ToastKind, type ToastNotifier } from "../ui.js";
|
|
3
|
+
import type { Entry, ExtensionInputMouseEvent, ExtensionWidgetRegistration, ExtensionWidgetTheme, PixExtensionUIContext, PixMenuController, WidgetPlacement, WidgetTuiHandle } from "./types.js";
|
|
4
|
+
export type ExtensionTerminalInputResult = {
|
|
5
|
+
consume: boolean;
|
|
6
|
+
data?: string;
|
|
7
|
+
};
|
|
8
|
+
export type ExtensionUiControllerHost = {
|
|
9
|
+
readonly theme: Theme;
|
|
10
|
+
isRunning(): boolean;
|
|
11
|
+
render(): void;
|
|
12
|
+
showToast(message: string, kind?: ToastKind): void;
|
|
13
|
+
readonly toastNotifier: ToastNotifier;
|
|
14
|
+
readonly menuController: PixMenuController;
|
|
15
|
+
setStatus(status: string): void;
|
|
16
|
+
restoreSessionStatus(): void;
|
|
17
|
+
setInput(value: string): void;
|
|
18
|
+
getInput(): string;
|
|
19
|
+
readonly entries: readonly Entry[];
|
|
20
|
+
deleteConversationEntry(entryId: string): void;
|
|
21
|
+
};
|
|
22
|
+
export declare class ExtensionUiController {
|
|
23
|
+
private readonly host;
|
|
24
|
+
private readonly extensionWidgets;
|
|
25
|
+
private readonly terminalInputHandlers;
|
|
26
|
+
private activeCustomUi;
|
|
27
|
+
private readonly aboveInputRenderer;
|
|
28
|
+
constructor(host: ExtensionUiControllerHost);
|
|
29
|
+
get widgets(): ReadonlyMap<string, ExtensionWidgetRegistration>;
|
|
30
|
+
createExtensionTheme(): ExtensionWidgetTheme;
|
|
31
|
+
setWidget(key: string, content: unknown, options?: {
|
|
32
|
+
placement?: WidgetPlacement;
|
|
33
|
+
}): void;
|
|
34
|
+
clearWidgets(): void;
|
|
35
|
+
suppressWidget(key: string): void;
|
|
36
|
+
handleTerminalInput(data: string): ExtensionTerminalInputResult;
|
|
37
|
+
renderActiveCustomUi(width: number): string[] | undefined;
|
|
38
|
+
activeCustomUiUsesEditor(): boolean;
|
|
39
|
+
handleCustomUiMouse(event: ExtensionInputMouseEvent): boolean;
|
|
40
|
+
widgetTuiHandle(): WidgetTuiHandle;
|
|
41
|
+
createExtensionUIContext(): PixExtensionUIContext;
|
|
42
|
+
private setAboveInputWidget;
|
|
43
|
+
private clearAboveInputWidget;
|
|
44
|
+
private selectDialog;
|
|
45
|
+
private confirmDialog;
|
|
46
|
+
private inputDialog;
|
|
47
|
+
private editorDialog;
|
|
48
|
+
private editorBackedDialog;
|
|
49
|
+
private renderEditorBackedDialog;
|
|
50
|
+
private dialogLine;
|
|
51
|
+
private withDialogAutoDismiss;
|
|
52
|
+
private showCustomUi;
|
|
53
|
+
private cancelActiveCustomUi;
|
|
54
|
+
private rejectActiveCustomUi;
|
|
55
|
+
private finishActiveCustomUi;
|
|
56
|
+
private invalidateWidget;
|
|
57
|
+
}
|