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,60 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { TERMINAL_COMMAND_MODIFIER_FLAG } from "./constants.js";
|
|
5
|
+
import { isRecord } from "./guards.js";
|
|
6
|
+
const cjsRequire = createRequire(import.meta.url);
|
|
7
|
+
let nativeModifiersHelper;
|
|
8
|
+
export function isNativeShiftPressed() {
|
|
9
|
+
return isNativeModifierPressed("shift");
|
|
10
|
+
}
|
|
11
|
+
export function isNativeCommandPressed() {
|
|
12
|
+
return isNativeModifierPressed("command");
|
|
13
|
+
}
|
|
14
|
+
function isNativeModifierPressed(key) {
|
|
15
|
+
const helper = loadNativeModifiersHelper();
|
|
16
|
+
if (!helper)
|
|
17
|
+
return false;
|
|
18
|
+
try {
|
|
19
|
+
return helper.isModifierPressed(key) === true;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export function hasTerminalCommandModifier(modifierValue) {
|
|
26
|
+
return ((modifierValue - 1) & TERMINAL_COMMAND_MODIFIER_FLAG) !== 0;
|
|
27
|
+
}
|
|
28
|
+
function loadNativeModifiersHelper() {
|
|
29
|
+
if (nativeModifiersHelper !== undefined)
|
|
30
|
+
return nativeModifiersHelper ?? undefined;
|
|
31
|
+
nativeModifiersHelper = null;
|
|
32
|
+
if (process.platform !== "darwin")
|
|
33
|
+
return undefined;
|
|
34
|
+
if (process.arch !== "x64" && process.arch !== "arm64")
|
|
35
|
+
return undefined;
|
|
36
|
+
const moduleDir = dirname(fileURLToPath(import.meta.url));
|
|
37
|
+
const nativePath = join("native", "darwin", "prebuilds", `darwin-${process.arch}`, "darwin-modifiers.node");
|
|
38
|
+
const candidates = [
|
|
39
|
+
join(process.cwd(), "node_modules", "@earendil-works", "pi-coding-agent", "node_modules", "@earendil-works", "pi-tui", nativePath),
|
|
40
|
+
join(process.cwd(), "node_modules", "@earendil-works", "pi-tui", nativePath),
|
|
41
|
+
join(moduleDir, "..", "node_modules", "@earendil-works", "pi-coding-agent", "node_modules", "@earendil-works", "pi-tui", nativePath),
|
|
42
|
+
join(dirname(process.execPath), nativePath),
|
|
43
|
+
];
|
|
44
|
+
for (const candidate of candidates) {
|
|
45
|
+
try {
|
|
46
|
+
const helper = cjsRequire(candidate);
|
|
47
|
+
if (isNativeModifiersHelper(helper)) {
|
|
48
|
+
nativeModifiersHelper = helper;
|
|
49
|
+
return helper;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// Try the next possible install layout.
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
function isNativeModifiersHelper(value) {
|
|
59
|
+
return isRecord(value) && typeof value.isModifierPressed === "function";
|
|
60
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type NerdFontInstallHost = {
|
|
2
|
+
showToast(message: string, kind: "success" | "error" | "warning" | "info"): void;
|
|
3
|
+
render(): void;
|
|
4
|
+
};
|
|
5
|
+
export declare class NerdFontController {
|
|
6
|
+
private readonly host;
|
|
7
|
+
private ensureStarted;
|
|
8
|
+
constructor(host: NerdFontInstallHost);
|
|
9
|
+
ensureInstalledOnStartup(): void;
|
|
10
|
+
private ensureInstalled;
|
|
11
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
2
|
+
import { readdir } from "node:fs/promises";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
const CASK_NAME = "font-jetbrains-mono-nerd-font";
|
|
6
|
+
const FONT_FILE_PATTERN = /(?:JetBrainsMono|JetBrains).*Nerd.*\.(?:ttf|otf)$/iu;
|
|
7
|
+
export class NerdFontController {
|
|
8
|
+
host;
|
|
9
|
+
ensureStarted = false;
|
|
10
|
+
constructor(host) {
|
|
11
|
+
this.host = host;
|
|
12
|
+
}
|
|
13
|
+
ensureInstalledOnStartup() {
|
|
14
|
+
if (this.ensureStarted)
|
|
15
|
+
return;
|
|
16
|
+
this.ensureStarted = true;
|
|
17
|
+
void this.ensureInstalled();
|
|
18
|
+
}
|
|
19
|
+
async ensureInstalled() {
|
|
20
|
+
if (await isJetBrainsNerdFontInstalled())
|
|
21
|
+
return;
|
|
22
|
+
if (process.platform !== "darwin") {
|
|
23
|
+
this.host.showToast("Nerd Font is missing; auto-install is only configured for macOS Homebrew", "warning");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!commandExists("brew")) {
|
|
27
|
+
this.host.showToast("Nerd Font is missing; install Homebrew or JetBrainsMono Nerd Font manually", "warning");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
this.host.showToast("Installing JetBrainsMono Nerd Font…", "info");
|
|
31
|
+
try {
|
|
32
|
+
await runBrewInstall();
|
|
33
|
+
if (await isJetBrainsNerdFontInstalled()) {
|
|
34
|
+
this.host.showToast("JetBrainsMono Nerd Font installed", "success");
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.host.showToast("Nerd Font install finished, but the font was not detected", "warning");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
this.host.showToast(`Nerd Font install failed: ${errorMessage(error)}`, "error");
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
this.host.render();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function isJetBrainsNerdFontInstalled() {
|
|
49
|
+
if (commandExists("brew") && spawnSync("brew", ["list", "--cask", CASK_NAME], { stdio: "ignore" }).status === 0)
|
|
50
|
+
return true;
|
|
51
|
+
const fontDirs = [join(homedir(), "Library", "Fonts"), "/Library/Fonts", "/System/Library/Fonts"];
|
|
52
|
+
for (const dir of fontDirs) {
|
|
53
|
+
try {
|
|
54
|
+
const files = await readdir(dir);
|
|
55
|
+
if (files.some((file) => FONT_FILE_PATTERN.test(file)))
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// Ignore unreadable/missing font directories.
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
async function runBrewInstall() {
|
|
65
|
+
await new Promise((resolve, reject) => {
|
|
66
|
+
const child = spawn("brew", ["install", "--cask", CASK_NAME], {
|
|
67
|
+
env: { ...process.env, HOMEBREW_NO_AUTO_UPDATE: "1" },
|
|
68
|
+
stdio: ["ignore", "ignore", "pipe"],
|
|
69
|
+
});
|
|
70
|
+
let stderr = "";
|
|
71
|
+
child.stderr.on("data", (chunk) => {
|
|
72
|
+
stderr = `${stderr}${chunk.toString("utf8")}`.slice(-800);
|
|
73
|
+
});
|
|
74
|
+
child.once("error", reject);
|
|
75
|
+
child.once("close", (code) => {
|
|
76
|
+
if (code === 0)
|
|
77
|
+
resolve();
|
|
78
|
+
else
|
|
79
|
+
reject(new Error(stderr.trim() || `brew exited with code ${code ?? "unknown"}`));
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function commandExists(command) {
|
|
84
|
+
if (process.platform === "win32")
|
|
85
|
+
return spawnSync("where", [command], { stdio: "ignore" }).status === 0;
|
|
86
|
+
return spawnSync("sh", ["-lc", `command -v ${command}`], { stdio: "ignore" }).status === 0;
|
|
87
|
+
}
|
|
88
|
+
function errorMessage(error) {
|
|
89
|
+
return error instanceof Error ? error.message : String(error);
|
|
90
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { AgentSession, AgentSessionRuntime } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { AppCommandController } from "./command-controller.js";
|
|
3
|
+
import type { AppMenuItemsController } from "./menu-items-controller.js";
|
|
4
|
+
import type { AppPopupMenuController } from "./popup-menu-controller.js";
|
|
5
|
+
import type { AppQueuedMessageController } from "./queued-message-controller.js";
|
|
6
|
+
import type { Entry, SlashCommand } from "./types.js";
|
|
7
|
+
import type { AppWorkspaceActionsController } from "./workspace-actions-controller.js";
|
|
8
|
+
export type AppPopupActionControllerHost = {
|
|
9
|
+
runtime(): AgentSessionRuntime | undefined;
|
|
10
|
+
getBuiltinSlashCommands(): readonly SlashCommand[];
|
|
11
|
+
isRunning(): boolean;
|
|
12
|
+
setInput(value: string): void;
|
|
13
|
+
addEntry(entry: Entry): void;
|
|
14
|
+
setStatus(status: string): void;
|
|
15
|
+
setSessionStatus(session: AgentSession | undefined): void;
|
|
16
|
+
showToast(message: string, kind: "success" | "error" | "warning" | "info"): void;
|
|
17
|
+
render(): void;
|
|
18
|
+
resetSessionView(): void;
|
|
19
|
+
bindCurrentSession(): Promise<void>;
|
|
20
|
+
loadSessionHistory(): void;
|
|
21
|
+
scrollToConversationEntry(entryId: string): boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare class AppPopupActionController {
|
|
24
|
+
private readonly host;
|
|
25
|
+
private readonly popupMenus;
|
|
26
|
+
private readonly commandController;
|
|
27
|
+
private readonly menuItems;
|
|
28
|
+
private readonly queuedMessages;
|
|
29
|
+
private readonly workspaceActions;
|
|
30
|
+
constructor(host: AppPopupActionControllerHost, popupMenus: AppPopupMenuController, commandController: AppCommandController, menuItems: AppMenuItemsController, queuedMessages: AppQueuedMessageController, workspaceActions: AppWorkspaceActionsController);
|
|
31
|
+
submitActivePopupMenu(): Promise<boolean>;
|
|
32
|
+
submitSlashCommand(text: string): Promise<void>;
|
|
33
|
+
private submitSelectedSlashCommand;
|
|
34
|
+
private submitSelectedModel;
|
|
35
|
+
private submitSelectedThinking;
|
|
36
|
+
private submitSelectedUserMessageAction;
|
|
37
|
+
private submitSelectedUserMessageJump;
|
|
38
|
+
private submitSelectedQueueMessageAction;
|
|
39
|
+
private submitSelectedResume;
|
|
40
|
+
private formatSlashCommandLine;
|
|
41
|
+
private executeResourceSlashCommand;
|
|
42
|
+
private getRuntime;
|
|
43
|
+
private getIdleRuntime;
|
|
44
|
+
}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { createId } from "./id.js";
|
|
2
|
+
import { stringifyUnknown } from "./message-content.js";
|
|
3
|
+
export class AppPopupActionController {
|
|
4
|
+
host;
|
|
5
|
+
popupMenus;
|
|
6
|
+
commandController;
|
|
7
|
+
menuItems;
|
|
8
|
+
queuedMessages;
|
|
9
|
+
workspaceActions;
|
|
10
|
+
constructor(host, popupMenus, commandController, menuItems, queuedMessages, workspaceActions) {
|
|
11
|
+
this.host = host;
|
|
12
|
+
this.popupMenus = popupMenus;
|
|
13
|
+
this.commandController = commandController;
|
|
14
|
+
this.menuItems = menuItems;
|
|
15
|
+
this.queuedMessages = queuedMessages;
|
|
16
|
+
this.workspaceActions = workspaceActions;
|
|
17
|
+
}
|
|
18
|
+
async submitActivePopupMenu() {
|
|
19
|
+
const active = this.popupMenus.syncActivePopupMenu();
|
|
20
|
+
if (!active)
|
|
21
|
+
return false;
|
|
22
|
+
if (active === "queue-message")
|
|
23
|
+
return await this.submitSelectedQueueMessageAction();
|
|
24
|
+
if (active === "user-message")
|
|
25
|
+
return await this.submitSelectedUserMessageAction();
|
|
26
|
+
if (active === "user-message-jump")
|
|
27
|
+
return this.submitSelectedUserMessageJump();
|
|
28
|
+
if (active === "resume")
|
|
29
|
+
return await this.submitSelectedResume();
|
|
30
|
+
if (active === "model")
|
|
31
|
+
return await this.submitSelectedModel();
|
|
32
|
+
if (active === "thinking")
|
|
33
|
+
return await this.submitSelectedThinking();
|
|
34
|
+
if (active === "sdk-menu")
|
|
35
|
+
return this.popupMenus.submitSelectedSdkMenu();
|
|
36
|
+
if (active === "slash")
|
|
37
|
+
return await this.submitSelectedSlashCommand();
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
async submitSlashCommand(text) {
|
|
41
|
+
const parsed = this.menuItems.parseSlashInput(text);
|
|
42
|
+
if (!parsed)
|
|
43
|
+
return;
|
|
44
|
+
if (parsed.commandName.length === 0) {
|
|
45
|
+
this.host.setStatus("type a slash command");
|
|
46
|
+
this.host.render();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const builtinCommandName = parsed.commandName.toLowerCase();
|
|
50
|
+
const command = this.host.getBuiltinSlashCommands().find((candidate) => candidate.name === builtinCommandName)
|
|
51
|
+
?? this.menuItems.getResourceSlashCommands().find((candidate) => candidate.name === parsed.commandName);
|
|
52
|
+
if (!command) {
|
|
53
|
+
const suggestions = this.menuItems.getSlashCommandMatches(parsed.commandName, 3).map((match) => `/${match.value.name}`);
|
|
54
|
+
this.host.showToast(suggestions.length > 0 ? `Unknown command /${parsed.commandName}; try ${suggestions.join(", ")}` : "Unknown command", "warning");
|
|
55
|
+
this.host.render();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (parsed.hasArguments && !command.allowArguments) {
|
|
59
|
+
this.host.showToast(`/${command.name} does not take arguments`, "warning");
|
|
60
|
+
this.host.render();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
this.host.setInput("");
|
|
64
|
+
if (!command.suppressCommandEcho) {
|
|
65
|
+
this.host.addEntry({ id: createId("system"), kind: "system", text: `command: ${this.formatSlashCommandLine(command.name, parsed.arguments)}` });
|
|
66
|
+
}
|
|
67
|
+
this.host.render();
|
|
68
|
+
try {
|
|
69
|
+
if (command.kind === "resource") {
|
|
70
|
+
await this.executeResourceSlashCommand(command, parsed.arguments);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
if (!command.run)
|
|
74
|
+
throw new Error(`/${command.name} is not executable`);
|
|
75
|
+
await command.run(parsed.arguments);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
this.host.addEntry({ id: createId("error"), kind: "error", text: stringifyUnknown(error) });
|
|
80
|
+
this.host.showToast(`/${command.name} failed`, "error");
|
|
81
|
+
this.host.setSessionStatus(this.host.runtime()?.session);
|
|
82
|
+
}
|
|
83
|
+
if (this.host.isRunning())
|
|
84
|
+
this.host.render();
|
|
85
|
+
}
|
|
86
|
+
async submitSelectedSlashCommand() {
|
|
87
|
+
const selected = this.popupMenus.selectedSlashCommand();
|
|
88
|
+
if (!selected)
|
|
89
|
+
return false;
|
|
90
|
+
this.popupMenus.closeSlashCommandSelection();
|
|
91
|
+
if (selected.name === "resume") {
|
|
92
|
+
this.host.setInput("");
|
|
93
|
+
await this.commandController.runResumeCommand();
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
await this.submitSlashCommand(`/${selected.name}`);
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
async submitSelectedModel() {
|
|
100
|
+
const selected = this.popupMenus.selectedModel();
|
|
101
|
+
if (!selected)
|
|
102
|
+
return false;
|
|
103
|
+
this.popupMenus.closeModelSelection();
|
|
104
|
+
if (!selected.direct) {
|
|
105
|
+
this.host.setInput("");
|
|
106
|
+
this.host.addEntry({ id: createId("system"), kind: "system", text: `command: /model ${selected.value.ref}` });
|
|
107
|
+
}
|
|
108
|
+
this.host.render();
|
|
109
|
+
try {
|
|
110
|
+
await this.commandController.runModelCommand(selected.value.model);
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
this.host.addEntry({ id: createId("error"), kind: "error", text: stringifyUnknown(error) });
|
|
114
|
+
this.host.showToast("/model failed", "error");
|
|
115
|
+
this.host.setSessionStatus(this.host.runtime()?.session);
|
|
116
|
+
}
|
|
117
|
+
if (this.host.isRunning())
|
|
118
|
+
this.host.render();
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
async submitSelectedThinking() {
|
|
122
|
+
const selected = this.popupMenus.selectedThinking();
|
|
123
|
+
if (!selected)
|
|
124
|
+
return false;
|
|
125
|
+
this.popupMenus.closeThinkingSelection();
|
|
126
|
+
if (!selected.direct) {
|
|
127
|
+
this.host.setInput("");
|
|
128
|
+
this.host.addEntry({ id: createId("system"), kind: "system", text: `command: /thinking ${selected.value.level}` });
|
|
129
|
+
}
|
|
130
|
+
this.host.render();
|
|
131
|
+
try {
|
|
132
|
+
await this.commandController.runThinkingCommand(selected.value.level);
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
this.host.addEntry({ id: createId("error"), kind: "error", text: stringifyUnknown(error) });
|
|
136
|
+
this.host.showToast("/thinking failed", "error");
|
|
137
|
+
this.host.setSessionStatus(this.host.runtime()?.session);
|
|
138
|
+
}
|
|
139
|
+
if (this.host.isRunning())
|
|
140
|
+
this.host.render();
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
async submitSelectedUserMessageAction() {
|
|
144
|
+
const selected = this.popupMenus.selectedUserMessageAction();
|
|
145
|
+
if (!selected)
|
|
146
|
+
return false;
|
|
147
|
+
this.popupMenus.closeUserMessageMenu();
|
|
148
|
+
this.host.render();
|
|
149
|
+
try {
|
|
150
|
+
if (selected.value === "copy") {
|
|
151
|
+
this.workspaceActions.copyUserMessage(selected.entryId);
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
if (selected.value === "fork") {
|
|
155
|
+
await this.workspaceActions.forkFromUserMessage(selected.entryId);
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
await this.workspaceActions.undoChangesFromUserMessage(selected.entryId);
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
this.host.addEntry({ id: createId("error"), kind: "error", text: stringifyUnknown(error) });
|
|
163
|
+
this.host.showToast(`${selected.label} failed`, "error");
|
|
164
|
+
this.host.setSessionStatus(this.host.runtime()?.session);
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
submitSelectedUserMessageJump() {
|
|
169
|
+
const selected = this.popupMenus.selectedUserMessageJump();
|
|
170
|
+
if (!selected)
|
|
171
|
+
return false;
|
|
172
|
+
const entryId = selected.entryId;
|
|
173
|
+
this.popupMenus.closeUserMessageJumpMenu();
|
|
174
|
+
if (!this.host.scrollToConversationEntry(entryId)) {
|
|
175
|
+
this.host.showToast("User message not found", "error");
|
|
176
|
+
this.host.setSessionStatus(this.host.runtime()?.session);
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
this.host.showToast("Jumped to user message", "success");
|
|
180
|
+
this.host.setSessionStatus(this.host.runtime()?.session);
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
async submitSelectedQueueMessageAction() {
|
|
184
|
+
const selected = this.popupMenus.selectedQueueMessageAction();
|
|
185
|
+
if (!selected)
|
|
186
|
+
return false;
|
|
187
|
+
this.popupMenus.closeQueueMessageMenu();
|
|
188
|
+
this.host.render();
|
|
189
|
+
try {
|
|
190
|
+
if (selected.value === "cancel") {
|
|
191
|
+
await this.queuedMessages.cancelQueuedMessage(selected.entryId);
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
if (selected.value === "edit") {
|
|
195
|
+
await this.queuedMessages.editQueuedMessage(selected.entryId);
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
await this.queuedMessages.sendQueuedMessageImmediately(selected.entryId);
|
|
199
|
+
return true;
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
this.host.addEntry({ id: createId("error"), kind: "error", text: stringifyUnknown(error) });
|
|
203
|
+
this.host.showToast(`${selected.label} failed`, "error");
|
|
204
|
+
this.host.setSessionStatus(this.host.runtime()?.session);
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
async submitSelectedResume() {
|
|
209
|
+
const selected = this.popupMenus.selectedResume();
|
|
210
|
+
if (!selected)
|
|
211
|
+
return false;
|
|
212
|
+
this.popupMenus.setDirectMenu(undefined);
|
|
213
|
+
this.popupMenus.setDirectPreserveStatus(false);
|
|
214
|
+
this.popupMenus.setDirectQuery("");
|
|
215
|
+
this.popupMenus.closeResumeMenu();
|
|
216
|
+
if (selected.kind === "new") {
|
|
217
|
+
await this.submitSlashCommand("/new");
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
const runtime = this.getIdleRuntime("resume");
|
|
221
|
+
if (!runtime)
|
|
222
|
+
return true;
|
|
223
|
+
const { session } = selected;
|
|
224
|
+
this.host.addEntry({ id: createId("system"), kind: "system", text: `Resuming session ${session.id.slice(0, 8)}…` });
|
|
225
|
+
this.host.setStatus("switching session");
|
|
226
|
+
this.host.render();
|
|
227
|
+
try {
|
|
228
|
+
const result = await runtime.switchSession(session.path);
|
|
229
|
+
if (result.cancelled) {
|
|
230
|
+
this.host.addEntry({ id: createId("system"), kind: "system", text: "Resume cancelled." });
|
|
231
|
+
this.host.setSessionStatus(runtime.session);
|
|
232
|
+
this.host.render();
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
this.host.resetSessionView();
|
|
236
|
+
await this.host.bindCurrentSession();
|
|
237
|
+
this.host.loadSessionHistory();
|
|
238
|
+
const name = runtime.session.sessionName ?? session.id.slice(0, 8);
|
|
239
|
+
this.host.addEntry({ id: createId("system"), kind: "system", text: `Resumed session "${name}"` });
|
|
240
|
+
this.host.setSessionStatus(runtime.session);
|
|
241
|
+
}
|
|
242
|
+
catch (error) {
|
|
243
|
+
this.host.addEntry({ id: createId("error"), kind: "error", text: `Resume failed: ${error instanceof Error ? error.message : String(error)}` });
|
|
244
|
+
this.host.showToast("Failed to resume session", "error");
|
|
245
|
+
this.host.setSessionStatus(runtime.session);
|
|
246
|
+
}
|
|
247
|
+
if (this.host.isRunning())
|
|
248
|
+
this.host.render();
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
formatSlashCommandLine(name, argumentsText) {
|
|
252
|
+
return `/${name}${argumentsText ? ` ${argumentsText}` : ""}`;
|
|
253
|
+
}
|
|
254
|
+
async executeResourceSlashCommand(command, argumentsText) {
|
|
255
|
+
const promptText = this.formatSlashCommandLine(command.name, argumentsText);
|
|
256
|
+
this.host.setStatus(`running /${command.name}`);
|
|
257
|
+
await this.queuedMessages.submitUserMessage(this.queuedMessages.createSubmittedUserMessage(promptText, promptText, []));
|
|
258
|
+
}
|
|
259
|
+
getRuntime(commandName) {
|
|
260
|
+
const runtime = this.host.runtime();
|
|
261
|
+
if (!runtime) {
|
|
262
|
+
this.host.addEntry({ id: createId("error"), kind: "error", text: "Runtime is not initialized" });
|
|
263
|
+
this.host.showToast(`/${commandName} unavailable`, "error");
|
|
264
|
+
return undefined;
|
|
265
|
+
}
|
|
266
|
+
return runtime;
|
|
267
|
+
}
|
|
268
|
+
getIdleRuntime(commandName) {
|
|
269
|
+
const runtime = this.getRuntime(commandName);
|
|
270
|
+
if (!runtime)
|
|
271
|
+
return undefined;
|
|
272
|
+
if (runtime.session.isStreaming) {
|
|
273
|
+
this.host.showToast(`/${commandName} is unavailable while the agent is running`, "warning");
|
|
274
|
+
return undefined;
|
|
275
|
+
}
|
|
276
|
+
return runtime;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { type Theme } from "../theme.js";
|
|
2
|
+
import { PopupMenu, type PopupMenuItem } from "../ui.js";
|
|
3
|
+
import type { ScreenStyler } from "./screen-styler.js";
|
|
4
|
+
import type { ActivePopupMenu, Entry, ModelMenuValue, ParsedSlashInput, PixMenuController, PixMenuItem, PixMenuOptions, PixMenuSelectOptions, PopupMenuPlacement, QueueMessageMenuValue, RenderedLine, ResumeMenuValue, SlashCommand, ThinkingMenuValue, UserMessageJumpMenuValue, UserMessageMenuValue } from "./types.js";
|
|
5
|
+
import type { AgentSession, SessionInfo } from "@earendil-works/pi-coding-agent";
|
|
6
|
+
type SlashCommandMenuValue = SlashCommand;
|
|
7
|
+
type ModelPopupMenuValue = ModelMenuValue;
|
|
8
|
+
type ThinkingPopupMenuValue = ThinkingMenuValue;
|
|
9
|
+
type ResumePopupMenuValue = ResumeMenuValue;
|
|
10
|
+
type UserMessagePopupMenuValue = UserMessageMenuValue;
|
|
11
|
+
type UserMessageJumpPopupMenuValue = UserMessageJumpMenuValue;
|
|
12
|
+
type QueueMessagePopupMenuValue = QueueMessageMenuValue;
|
|
13
|
+
export type DirectPopupMenu = Exclude<ActivePopupMenu, "slash">;
|
|
14
|
+
export type AppPopupMenuControllerHost = {
|
|
15
|
+
readonly theme: Theme;
|
|
16
|
+
readonly screenStyler: ScreenStyler;
|
|
17
|
+
readonly entries: readonly Entry[];
|
|
18
|
+
readonly session: AgentSession | undefined;
|
|
19
|
+
readonly resumeLoading: boolean;
|
|
20
|
+
readonly resumeSessionCount: number;
|
|
21
|
+
isRunning(): boolean;
|
|
22
|
+
getInput(): string;
|
|
23
|
+
setInput(value: string): void;
|
|
24
|
+
parseSlashInput(text: string): ParsedSlashInput | undefined;
|
|
25
|
+
getSlashCommandMenuItems(query: string): PopupMenuItem<SlashCommand>[];
|
|
26
|
+
getModelMenuItems(query: string): PopupMenuItem<ModelMenuValue>[];
|
|
27
|
+
getThinkingMenuItems(query: string): PopupMenuItem<ThinkingMenuValue>[];
|
|
28
|
+
getResumeMenuItems(query: string, limit?: number): PopupMenuItem<ResumeMenuValue>[];
|
|
29
|
+
getUserMessageMenuItems(): PopupMenuItem<UserMessageMenuValue>[];
|
|
30
|
+
getUserMessageJumpMenuItems(query: string): PopupMenuItem<UserMessageJumpMenuValue>[];
|
|
31
|
+
getQueueMessageMenuItems(): PopupMenuItem<QueueMessageMenuValue>[];
|
|
32
|
+
hasUserEntry(entryId: string): boolean;
|
|
33
|
+
hasQueuedEntry(entryId: string): boolean;
|
|
34
|
+
setStatus(status: string): void;
|
|
35
|
+
restoreSessionStatus(): void;
|
|
36
|
+
render(): void;
|
|
37
|
+
};
|
|
38
|
+
export declare class AppPopupMenuController {
|
|
39
|
+
private readonly host;
|
|
40
|
+
readonly menuController: PixMenuController;
|
|
41
|
+
private readonly slashCommandMenu;
|
|
42
|
+
private readonly modelMenu;
|
|
43
|
+
private readonly thinkingMenu;
|
|
44
|
+
private readonly resumeMenu;
|
|
45
|
+
private readonly userMessageMenu;
|
|
46
|
+
private readonly userMessageJumpMenu;
|
|
47
|
+
private readonly queueMessageMenu;
|
|
48
|
+
private readonly sdkMenu;
|
|
49
|
+
private sdkMenuRequest;
|
|
50
|
+
private slashCommandMenuQuery;
|
|
51
|
+
private dismissedSlashCommandMenuInput;
|
|
52
|
+
private modelMenuQuery;
|
|
53
|
+
private dismissedModelMenuInput;
|
|
54
|
+
private thinkingMenuQuery;
|
|
55
|
+
private dismissedThinkingMenuInput;
|
|
56
|
+
private directPopupMenu;
|
|
57
|
+
private directPopupMenuPreserveStatus;
|
|
58
|
+
private directPopupMenuPlacement;
|
|
59
|
+
private directPopupMenuQuery;
|
|
60
|
+
private resumeMenuQuery;
|
|
61
|
+
private resumeMenuSessionLimit;
|
|
62
|
+
private resumeMenuAllSessionsLoaded;
|
|
63
|
+
private activeUserMessageEntryId;
|
|
64
|
+
private activeQueuedMessageEntryId;
|
|
65
|
+
constructor(host: AppPopupMenuControllerHost);
|
|
66
|
+
get directMenu(): DirectPopupMenu | undefined;
|
|
67
|
+
get directQuery(): string;
|
|
68
|
+
setDirectMenu(menu: DirectPopupMenu | undefined): void;
|
|
69
|
+
setDirectPreserveStatus(preserveStatus: boolean): void;
|
|
70
|
+
setDirectQuery(query: string): void;
|
|
71
|
+
resetInputMenuDismissals(): void;
|
|
72
|
+
showSdkMenu<T>(items: readonly PixMenuItem<T>[], options: PixMenuOptions): Promise<T | undefined>;
|
|
73
|
+
selectSdkMenu(title: string, options: readonly string[], menuOptions?: PixMenuSelectOptions): Promise<string | undefined>;
|
|
74
|
+
closeSdkMenu(value: unknown | undefined, options?: {
|
|
75
|
+
render?: boolean;
|
|
76
|
+
restoreStatus?: boolean;
|
|
77
|
+
}): void;
|
|
78
|
+
getActivePopupMenu(active: ActivePopupMenu): PopupMenu<unknown>;
|
|
79
|
+
moveActivePopupMenuSelection(delta: number): boolean;
|
|
80
|
+
scrollActivePopupMenu(delta: number): boolean;
|
|
81
|
+
handleDirectPopupInput(char: string): boolean;
|
|
82
|
+
openDirectPopupMenu(menu: DirectPopupMenu, options?: {
|
|
83
|
+
preserveStatus?: boolean;
|
|
84
|
+
placement?: PopupMenuPlacement;
|
|
85
|
+
}): void;
|
|
86
|
+
popupMenuPlacement(): PopupMenuPlacement;
|
|
87
|
+
openUserMessageMenu(entryId: string): boolean;
|
|
88
|
+
openQueueMessageMenu(entryId: string): boolean;
|
|
89
|
+
openResumeMenuWithQuery(query: string): void;
|
|
90
|
+
closeResumeMenu(): void;
|
|
91
|
+
closeUserMessageMenu(): void;
|
|
92
|
+
closeUserMessageJumpMenu(): void;
|
|
93
|
+
closeQueueMessageMenu(): void;
|
|
94
|
+
resetConversationMenuState(): void;
|
|
95
|
+
closeModelSelection(): void;
|
|
96
|
+
closeThinkingSelection(): void;
|
|
97
|
+
closeSlashCommandSelection(): void;
|
|
98
|
+
cancelActivePopupMenu(): void;
|
|
99
|
+
autocompleteSlashCommand(): void;
|
|
100
|
+
autocompleteModel(): boolean;
|
|
101
|
+
autocompleteThinking(): boolean;
|
|
102
|
+
selectedSlashCommand(): SlashCommand | undefined;
|
|
103
|
+
selectedModel(): {
|
|
104
|
+
value: ModelMenuValue;
|
|
105
|
+
direct: boolean;
|
|
106
|
+
} | undefined;
|
|
107
|
+
selectedThinking(): {
|
|
108
|
+
value: ThinkingMenuValue;
|
|
109
|
+
direct: boolean;
|
|
110
|
+
} | undefined;
|
|
111
|
+
selectedResume(): ResumeMenuValue | undefined;
|
|
112
|
+
selectedUserMessageAction(): {
|
|
113
|
+
value: UserMessageMenuValue;
|
|
114
|
+
label: string;
|
|
115
|
+
entryId: string;
|
|
116
|
+
} | undefined;
|
|
117
|
+
selectedUserMessageJump(): UserMessageJumpMenuValue | undefined;
|
|
118
|
+
selectedQueueMessageAction(): {
|
|
119
|
+
value: QueueMessageMenuValue;
|
|
120
|
+
label: string;
|
|
121
|
+
entryId: string;
|
|
122
|
+
} | undefined;
|
|
123
|
+
submitSelectedSdkMenu(): boolean;
|
|
124
|
+
syncActivePopupMenu(): ActivePopupMenu | undefined;
|
|
125
|
+
renderActivePopupMenu(width: number): RenderedLine[];
|
|
126
|
+
popupMenuWidth(columns: number): number;
|
|
127
|
+
popupMenuMargin(columns: number): number;
|
|
128
|
+
effectivePopupMenuWidth(columns: number): number;
|
|
129
|
+
styleOverlayLine(row: number, line: RenderedLine, width: number): string;
|
|
130
|
+
overlayPlainText(line: RenderedLine, width: number): string;
|
|
131
|
+
isDynamicConversationBlock(entry: Entry): boolean;
|
|
132
|
+
hasDynamicConversationBlock(): boolean;
|
|
133
|
+
renderInlineUserMessageMenu(entry: Extract<Entry, {
|
|
134
|
+
kind: "user";
|
|
135
|
+
}>, options: {
|
|
136
|
+
userContentWidth: number;
|
|
137
|
+
userContentLeft: number;
|
|
138
|
+
userLine: (text: string, entryId?: string, syntaxHighlight?: RenderedLine["syntaxHighlight"]) => RenderedLine;
|
|
139
|
+
}): RenderedLine[];
|
|
140
|
+
private hasPopupActionItems;
|
|
141
|
+
private withoutCloseMenuItems;
|
|
142
|
+
private resetPopupMenuSelection;
|
|
143
|
+
private resetResumeMenuLazyState;
|
|
144
|
+
private maybeGrowResumeMenuWindow;
|
|
145
|
+
private updateResumeMenuLoadedState;
|
|
146
|
+
private resumeMenuLoadedSessionCount;
|
|
147
|
+
private userMessageActionForeground;
|
|
148
|
+
private selectableItemVariant;
|
|
149
|
+
private queueMessageItemVariant;
|
|
150
|
+
private sdkItemVariant;
|
|
151
|
+
private resumeMenuItemSegments;
|
|
152
|
+
private popupMenuHeader;
|
|
153
|
+
private syncModelMenu;
|
|
154
|
+
private syncThinkingMenu;
|
|
155
|
+
private syncResumeMenu;
|
|
156
|
+
private syncUserMessageMenu;
|
|
157
|
+
private syncUserMessageJumpMenu;
|
|
158
|
+
private syncQueueMessageMenu;
|
|
159
|
+
private syncSdkMenu;
|
|
160
|
+
private syncSlashCommandMenu;
|
|
161
|
+
private closeMenusExcept;
|
|
162
|
+
private getSdkMenuItems;
|
|
163
|
+
private renderSlashCommandMenu;
|
|
164
|
+
private renderModelMenu;
|
|
165
|
+
private renderThinkingMenu;
|
|
166
|
+
private renderResumeMenu;
|
|
167
|
+
private renderUserMessageJumpMenu;
|
|
168
|
+
private renderQueueMessageMenu;
|
|
169
|
+
private renderSdkMenu;
|
|
170
|
+
private popupLineForeground;
|
|
171
|
+
private popupLineBackground;
|
|
172
|
+
}
|
|
173
|
+
export declare function formatPopupMenuHeader(title: string, width: number): string;
|
|
174
|
+
export type SessionInfoMenuItemsLoader = {
|
|
175
|
+
readonly total: number;
|
|
176
|
+
items(limit?: number): PopupMenuItem<SessionInfo>[];
|
|
177
|
+
};
|
|
178
|
+
export declare function createSessionInfoMenuItemsLoader(sessions: readonly SessionInfo[], currentSessionFile: string | undefined, query: string): SessionInfoMenuItemsLoader;
|
|
179
|
+
export declare function formatSessionInfoMenuItems(sessions: readonly SessionInfo[], currentSessionFile: string | undefined, query: string, options?: {
|
|
180
|
+
limit?: number;
|
|
181
|
+
}): PopupMenuItem<SessionInfo>[];
|
|
182
|
+
export declare function buildUserMessageJumpItems(entries: readonly Entry[], query: string): PopupMenuItem<UserMessageJumpMenuValue>[];
|
|
183
|
+
export type { ModelPopupMenuValue, QueueMessagePopupMenuValue, ResumePopupMenuValue, SlashCommandMenuValue, ThinkingPopupMenuValue, UserMessageJumpPopupMenuValue, UserMessagePopupMenuValue, };
|