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,193 @@
|
|
|
1
|
+
import { readFile, readdir, realpath, stat } from "node:fs/promises";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { SUBAGENT_PARENT_SESSION_FILE, SUBAGENTS_REGISTRY_FILE, SUBAGENTS_RUN_ROOT } from "./constants.js";
|
|
4
|
+
import { isSubagentRegistry } from "./subagents-model.js";
|
|
5
|
+
export function subagentsRegistryPath(cwd) {
|
|
6
|
+
return join(cwd, SUBAGENTS_RUN_ROOT, SUBAGENTS_REGISTRY_FILE);
|
|
7
|
+
}
|
|
8
|
+
export async function readSubagentRegistry(cwd) {
|
|
9
|
+
try {
|
|
10
|
+
const parsed = JSON.parse(await readFile(subagentsRegistryPath(cwd), "utf8"));
|
|
11
|
+
return isSubagentRegistry(parsed) ? parsed : undefined;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export async function readSubagentRunStateFromFiles(runDir, options = {}) {
|
|
18
|
+
if (!(await isDirectory(runDir)))
|
|
19
|
+
return undefined;
|
|
20
|
+
const includeLineCounts = options.includeLineCounts ?? true;
|
|
21
|
+
const agents = [];
|
|
22
|
+
const launchedIds = new Set();
|
|
23
|
+
let entries;
|
|
24
|
+
try {
|
|
25
|
+
entries = await readdir(runDir, { withFileTypes: true });
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
for (const entry of entries) {
|
|
31
|
+
if (!entry.isDirectory())
|
|
32
|
+
continue;
|
|
33
|
+
const state = await readSubagentAgentState(runDir, entry.name, { includeLineCounts });
|
|
34
|
+
if (!state)
|
|
35
|
+
continue;
|
|
36
|
+
agents.push(state);
|
|
37
|
+
launchedIds.add(entry.name);
|
|
38
|
+
}
|
|
39
|
+
const promptsDir = join(runDir, "prompts");
|
|
40
|
+
try {
|
|
41
|
+
for (const prompt of await readdir(promptsDir)) {
|
|
42
|
+
if (!prompt.endsWith(".md"))
|
|
43
|
+
continue;
|
|
44
|
+
const id = prompt.slice(0, -3);
|
|
45
|
+
if (!id || launchedIds.has(id))
|
|
46
|
+
continue;
|
|
47
|
+
agents.push({ id, status: "planned" });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// Missing prompts directory is fine for older/partial runs.
|
|
52
|
+
}
|
|
53
|
+
return { runDir, agents };
|
|
54
|
+
}
|
|
55
|
+
export async function subagentRunHasParentSession(runDir, parentSessionFile) {
|
|
56
|
+
if (!parentSessionFile || !(await isDirectory(runDir)))
|
|
57
|
+
return false;
|
|
58
|
+
const normalizedParent = await normalizeExistingPath(parentSessionFile);
|
|
59
|
+
let entries;
|
|
60
|
+
try {
|
|
61
|
+
entries = await readdir(runDir, { withFileTypes: true });
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
for (const entry of entries) {
|
|
67
|
+
if (!entry.isDirectory())
|
|
68
|
+
continue;
|
|
69
|
+
const parentSession = await readTrimmedFile(join(runDir, entry.name, SUBAGENT_PARENT_SESSION_FILE));
|
|
70
|
+
if (!parentSession)
|
|
71
|
+
continue;
|
|
72
|
+
if (await pathsEqual(parentSession, normalizedParent))
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
async function readSubagentAgentState(runDir, agentId, options) {
|
|
78
|
+
const agentDir = join(runDir, agentId);
|
|
79
|
+
if (!(await isDirectory(agentDir)))
|
|
80
|
+
return undefined;
|
|
81
|
+
if (!(await fileExists(join(agentDir, "prompt.md"))))
|
|
82
|
+
return undefined;
|
|
83
|
+
const state = { id: agentId, status: "planned" };
|
|
84
|
+
const pid = await readNumberFile(join(agentDir, "pid"));
|
|
85
|
+
if (pid !== undefined)
|
|
86
|
+
state.pid = pid;
|
|
87
|
+
const exitCodeFile = join(agentDir, "exit_code");
|
|
88
|
+
if (await fileExists(exitCodeFile)) {
|
|
89
|
+
const code = await readNumberFile(exitCodeFile);
|
|
90
|
+
if (code === undefined) {
|
|
91
|
+
state.status = "stopped";
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
state.exitCode = code;
|
|
95
|
+
state.status = code === 0 ? "done" : "failed";
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else if (pid !== undefined) {
|
|
99
|
+
try {
|
|
100
|
+
process.kill(pid, 0);
|
|
101
|
+
state.status = "running";
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
state.status = "stopped";
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const startedAt = await readTrimmedFile(join(agentDir, "started_at"));
|
|
108
|
+
if (startedAt)
|
|
109
|
+
state.startedAt = startedAt;
|
|
110
|
+
const finishedAt = await readTrimmedFile(join(agentDir, "finished_at"));
|
|
111
|
+
if (finishedAt)
|
|
112
|
+
state.finishedAt = finishedAt;
|
|
113
|
+
const retryPending = await fileExists(join(agentDir, "retry_pending"));
|
|
114
|
+
const stopRequested = await fileExists(join(agentDir, "stop_requested"));
|
|
115
|
+
if (retryPending && !stopRequested && state.status !== "running" && state.status !== "done") {
|
|
116
|
+
state.status = "retrying";
|
|
117
|
+
const nextRetryAt = await readTrimmedFile(join(agentDir, "next_retry_at"));
|
|
118
|
+
if (nextRetryAt)
|
|
119
|
+
state.nextRetryAt = nextRetryAt;
|
|
120
|
+
}
|
|
121
|
+
if (options.includeLineCounts) {
|
|
122
|
+
const resultLines = await countFileLines(join(agentDir, "result.md"));
|
|
123
|
+
if (resultLines !== undefined)
|
|
124
|
+
state.resultLines = resultLines;
|
|
125
|
+
const stderrLines = await countFileLines(join(agentDir, "stderr.log"));
|
|
126
|
+
if (stderrLines !== undefined && stderrLines > 0)
|
|
127
|
+
state.stderrLines = stderrLines;
|
|
128
|
+
const eventLines = await countFileLines(join(agentDir, "events.jsonl"));
|
|
129
|
+
if (eventLines !== undefined)
|
|
130
|
+
state.eventLines = eventLines;
|
|
131
|
+
}
|
|
132
|
+
const retryCount = await readNumberFile(join(agentDir, "retry_count"));
|
|
133
|
+
if (retryCount !== undefined && retryCount > 0)
|
|
134
|
+
state.retryCount = retryCount;
|
|
135
|
+
return state;
|
|
136
|
+
}
|
|
137
|
+
async function fileExists(filePath) {
|
|
138
|
+
try {
|
|
139
|
+
await stat(filePath);
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async function pathsEqual(filePath, normalizedTarget) {
|
|
147
|
+
return await normalizeExistingPath(filePath) === normalizedTarget;
|
|
148
|
+
}
|
|
149
|
+
async function normalizeExistingPath(filePath) {
|
|
150
|
+
const resolved = resolve(filePath);
|
|
151
|
+
try {
|
|
152
|
+
return await realpath(resolved);
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return resolved;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
async function isDirectory(filePath) {
|
|
159
|
+
try {
|
|
160
|
+
return (await stat(filePath)).isDirectory();
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
async function readTrimmedFile(filePath) {
|
|
167
|
+
try {
|
|
168
|
+
const value = (await readFile(filePath, "utf8")).trim();
|
|
169
|
+
return value || undefined;
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
return undefined;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
async function readNumberFile(filePath) {
|
|
176
|
+
const raw = await readTrimmedFile(filePath);
|
|
177
|
+
if (!raw)
|
|
178
|
+
return undefined;
|
|
179
|
+
const value = Number.parseInt(raw, 10);
|
|
180
|
+
return Number.isFinite(value) ? value : undefined;
|
|
181
|
+
}
|
|
182
|
+
async function countFileLines(filePath) {
|
|
183
|
+
try {
|
|
184
|
+
const content = await readFile(filePath, "utf8");
|
|
185
|
+
if (content.length === 0)
|
|
186
|
+
return 0;
|
|
187
|
+
const newlineCount = content.split("\n").length - 1;
|
|
188
|
+
return content.endsWith("\n") ? newlineCount : newlineCount + 1;
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
return undefined;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SubagentActiveStatus, SubagentAgentState, SubagentsLiveStateEvent, SubagentRegistry, SubagentRegistryAgent, SubagentRegistryRun, SubagentRenderMode, SubagentRunRenderDetails, SubagentStatus, SubagentTaskPreview, SubagentTerminalStatus } from "./types.js";
|
|
2
|
+
export declare function isSubagentsToolName(toolName: string): boolean;
|
|
3
|
+
export declare function isSubagentStatus(value: unknown): value is SubagentStatus;
|
|
4
|
+
export declare function isSubagentActiveStatus(value: SubagentStatus): value is SubagentActiveStatus;
|
|
5
|
+
export declare function isSubagentTerminalStatus(value: SubagentStatus): value is SubagentTerminalStatus;
|
|
6
|
+
export declare function isSubagentRenderMode(value: unknown): value is SubagentRenderMode;
|
|
7
|
+
export declare function isSubagentAgentState(value: unknown): value is SubagentAgentState;
|
|
8
|
+
export declare function isSubagentTaskPreview(value: unknown): value is SubagentTaskPreview;
|
|
9
|
+
export declare function isSubagentRunRenderDetails(value: unknown): value is SubagentRunRenderDetails;
|
|
10
|
+
export declare function isSubagentsLiveStateEvent(value: unknown): value is SubagentsLiveStateEvent;
|
|
11
|
+
export declare function isSubagentRegistryRun(runId: string, value: unknown): value is SubagentRegistryRun;
|
|
12
|
+
export declare function isSubagentRegistryAgent(agentId: string, value: unknown): value is SubagentRegistryAgent;
|
|
13
|
+
export declare function isSubagentRegistry(value: unknown): value is SubagentRegistry;
|
|
14
|
+
export declare function subagentStatusIcon(status: SubagentStatus): string;
|
|
15
|
+
export declare function formatSubagentsPanelStats(agents: readonly SubagentAgentState[]): string;
|
|
16
|
+
export declare function subagentModelThinkingLabel(preview: SubagentTaskPreview | undefined): string;
|
|
17
|
+
export declare function activeSubagentStates(agents: readonly SubagentAgentState[]): SubagentAgentState[];
|
|
18
|
+
export declare function allSubagentStatesTerminal(agents: readonly SubagentAgentState[]): boolean;
|
|
19
|
+
export declare function taskPreviewMap(tasks: readonly SubagentTaskPreview[] | undefined): Map<string, SubagentTaskPreview>;
|
|
20
|
+
export declare function formatSubagentTimestamp(value: string | undefined): string | undefined;
|
|
21
|
+
export declare function formatElapsedSince(value: string | undefined, now?: number): string;
|
|
22
|
+
export declare function subagentRunName(runDir: string): string;
|
|
23
|
+
export declare function resolveSubagentRunDir(cwd: string, runDir: string): string;
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { basename, isAbsolute, join, resolve } from "node:path";
|
|
2
|
+
import { SUBAGENT_ACTIVE_STATUSES, SUBAGENT_RENDER_MODES, SUBAGENT_STATUSES, SUBAGENT_TERMINAL_STATUSES, SUBAGENTS_TOOL_NAME, SUBAGENTS_TOOL_NAME_PREFIX, } from "./constants.js";
|
|
3
|
+
import { isRecord, isStringArray } from "./guards.js";
|
|
4
|
+
import { APP_ICONS } from "./icons.js";
|
|
5
|
+
import { stripProviderFromModelRef } from "./model-ref.js";
|
|
6
|
+
export function isSubagentsToolName(toolName) {
|
|
7
|
+
return toolName === SUBAGENTS_TOOL_NAME || toolName.startsWith(SUBAGENTS_TOOL_NAME_PREFIX);
|
|
8
|
+
}
|
|
9
|
+
export function isSubagentStatus(value) {
|
|
10
|
+
return typeof value === "string" && SUBAGENT_STATUSES.includes(value);
|
|
11
|
+
}
|
|
12
|
+
export function isSubagentActiveStatus(value) {
|
|
13
|
+
return SUBAGENT_ACTIVE_STATUSES.includes(value);
|
|
14
|
+
}
|
|
15
|
+
export function isSubagentTerminalStatus(value) {
|
|
16
|
+
return SUBAGENT_TERMINAL_STATUSES.includes(value);
|
|
17
|
+
}
|
|
18
|
+
export function isSubagentRenderMode(value) {
|
|
19
|
+
return typeof value === "string" && SUBAGENT_RENDER_MODES.includes(value);
|
|
20
|
+
}
|
|
21
|
+
export function isSubagentAgentState(value) {
|
|
22
|
+
if (!isRecord(value))
|
|
23
|
+
return false;
|
|
24
|
+
if (typeof value.id !== "string" || !value.id.trim())
|
|
25
|
+
return false;
|
|
26
|
+
if (!isSubagentStatus(value.status))
|
|
27
|
+
return false;
|
|
28
|
+
if (value.exitCode !== undefined && typeof value.exitCode !== "number")
|
|
29
|
+
return false;
|
|
30
|
+
if (value.startedAt !== undefined && typeof value.startedAt !== "string")
|
|
31
|
+
return false;
|
|
32
|
+
if (value.finishedAt !== undefined && typeof value.finishedAt !== "string")
|
|
33
|
+
return false;
|
|
34
|
+
if (value.nextRetryAt !== undefined && typeof value.nextRetryAt !== "string")
|
|
35
|
+
return false;
|
|
36
|
+
if (value.pid !== undefined && typeof value.pid !== "number")
|
|
37
|
+
return false;
|
|
38
|
+
if (value.resultLines !== undefined && typeof value.resultLines !== "number")
|
|
39
|
+
return false;
|
|
40
|
+
if (value.stderrLines !== undefined && typeof value.stderrLines !== "number")
|
|
41
|
+
return false;
|
|
42
|
+
if (value.eventLines !== undefined && typeof value.eventLines !== "number")
|
|
43
|
+
return false;
|
|
44
|
+
if (value.retryCount !== undefined && typeof value.retryCount !== "number")
|
|
45
|
+
return false;
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
export function isSubagentTaskPreview(value) {
|
|
49
|
+
if (!isRecord(value))
|
|
50
|
+
return false;
|
|
51
|
+
if (typeof value.id !== "string" || !value.id.trim())
|
|
52
|
+
return false;
|
|
53
|
+
if (value.task !== undefined && typeof value.task !== "string")
|
|
54
|
+
return false;
|
|
55
|
+
if (value.scope !== undefined && typeof value.scope !== "string")
|
|
56
|
+
return false;
|
|
57
|
+
if (value.model !== undefined && typeof value.model !== "string")
|
|
58
|
+
return false;
|
|
59
|
+
if (value.thinking !== undefined && typeof value.thinking !== "string")
|
|
60
|
+
return false;
|
|
61
|
+
if (value.thinkingLevel !== undefined && typeof value.thinkingLevel !== "string")
|
|
62
|
+
return false;
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
export function isSubagentRunRenderDetails(value) {
|
|
66
|
+
if (!isRecord(value))
|
|
67
|
+
return false;
|
|
68
|
+
if (typeof value.runDir !== "string" || !value.runDir.trim())
|
|
69
|
+
return false;
|
|
70
|
+
if (!Array.isArray(value.agents) || !value.agents.every(isSubagentAgentState))
|
|
71
|
+
return false;
|
|
72
|
+
if (value.tasks !== undefined && (!Array.isArray(value.tasks) || !value.tasks.every(isSubagentTaskPreview)))
|
|
73
|
+
return false;
|
|
74
|
+
if (value.mode !== undefined && !isSubagentRenderMode(value.mode))
|
|
75
|
+
return false;
|
|
76
|
+
if (value.agentId !== undefined && typeof value.agentId !== "string")
|
|
77
|
+
return false;
|
|
78
|
+
if (value.state !== undefined && !isSubagentAgentState(value.state))
|
|
79
|
+
return false;
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
export function isSubagentsLiveStateEvent(value) {
|
|
83
|
+
if (!isRecord(value))
|
|
84
|
+
return false;
|
|
85
|
+
if (value.version !== 1)
|
|
86
|
+
return false;
|
|
87
|
+
if (typeof value.count !== "number" || !Number.isFinite(value.count))
|
|
88
|
+
return false;
|
|
89
|
+
if (!Array.isArray(value.runs))
|
|
90
|
+
return false;
|
|
91
|
+
if (value.sessionFile !== undefined && typeof value.sessionFile !== "string")
|
|
92
|
+
return false;
|
|
93
|
+
if (typeof value.checkedAt !== "number" || !Number.isFinite(value.checkedAt))
|
|
94
|
+
return false;
|
|
95
|
+
return value.runs.every((run) => {
|
|
96
|
+
if (!isRecord(run))
|
|
97
|
+
return false;
|
|
98
|
+
if (typeof run.runDir !== "string" || !run.runDir.trim())
|
|
99
|
+
return false;
|
|
100
|
+
if (!Array.isArray(run.agents) || !run.agents.every(isSubagentAgentState))
|
|
101
|
+
return false;
|
|
102
|
+
if (run.tasks !== undefined && (!Array.isArray(run.tasks) || !run.tasks.every(isSubagentTaskPreview)))
|
|
103
|
+
return false;
|
|
104
|
+
return true;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
export function isSubagentRegistryRun(runId, value) {
|
|
108
|
+
void runId;
|
|
109
|
+
if (!isRecord(value))
|
|
110
|
+
return false;
|
|
111
|
+
if (typeof value.runId !== "string")
|
|
112
|
+
return false;
|
|
113
|
+
if (typeof value.runDir !== "string")
|
|
114
|
+
return false;
|
|
115
|
+
if (!isStringArray(value.agentIds))
|
|
116
|
+
return false;
|
|
117
|
+
if (typeof value.createdAt !== "string")
|
|
118
|
+
return false;
|
|
119
|
+
if (typeof value.updatedAt !== "string")
|
|
120
|
+
return false;
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
export function isSubagentRegistryAgent(agentId, value) {
|
|
124
|
+
void agentId;
|
|
125
|
+
if (!isRecord(value))
|
|
126
|
+
return false;
|
|
127
|
+
if (typeof value.agentId !== "string")
|
|
128
|
+
return false;
|
|
129
|
+
if (typeof value.runId !== "string")
|
|
130
|
+
return false;
|
|
131
|
+
if (typeof value.runDir !== "string")
|
|
132
|
+
return false;
|
|
133
|
+
if (typeof value.updatedAt !== "string")
|
|
134
|
+
return false;
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
export function isSubagentRegistry(value) {
|
|
138
|
+
if (!isRecord(value))
|
|
139
|
+
return false;
|
|
140
|
+
if (value.version !== 1)
|
|
141
|
+
return false;
|
|
142
|
+
if (value.latestRunId !== undefined && typeof value.latestRunId !== "string")
|
|
143
|
+
return false;
|
|
144
|
+
if (value.latestRunDir !== undefined && typeof value.latestRunDir !== "string")
|
|
145
|
+
return false;
|
|
146
|
+
if (!isRecord(value.runs) || !isRecord(value.agents))
|
|
147
|
+
return false;
|
|
148
|
+
return Object.entries(value.runs).every(([runId, run]) => isSubagentRegistryRun(runId, run))
|
|
149
|
+
&& Object.entries(value.agents).every(([agentId, agent]) => isSubagentRegistryAgent(agentId, agent));
|
|
150
|
+
}
|
|
151
|
+
export function subagentStatusIcon(status) {
|
|
152
|
+
switch (status) {
|
|
153
|
+
case "planned":
|
|
154
|
+
return APP_ICONS.circleOutline;
|
|
155
|
+
case "running":
|
|
156
|
+
return APP_ICONS.timerSand;
|
|
157
|
+
case "retrying":
|
|
158
|
+
return APP_ICONS.refresh;
|
|
159
|
+
case "done":
|
|
160
|
+
return APP_ICONS.checkCircle;
|
|
161
|
+
case "failed":
|
|
162
|
+
return APP_ICONS.closeCircle;
|
|
163
|
+
case "stopped":
|
|
164
|
+
return APP_ICONS.stopCircle;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
export function formatSubagentsPanelStats(agents) {
|
|
168
|
+
const stats = [
|
|
169
|
+
{ count: agents.filter((agent) => agent.status === "planned").length, label: "planned" },
|
|
170
|
+
{ count: agents.filter((agent) => agent.status === "running").length, label: "running" },
|
|
171
|
+
{ count: agents.filter((agent) => agent.status === "retrying").length, label: "retrying" },
|
|
172
|
+
]
|
|
173
|
+
.filter(({ count }) => count > 0)
|
|
174
|
+
.map(({ count, label }) => `${count} ${label}`);
|
|
175
|
+
return stats.join(", ");
|
|
176
|
+
}
|
|
177
|
+
export function subagentModelThinkingLabel(preview) {
|
|
178
|
+
const rawModel = preview?.model?.trim();
|
|
179
|
+
const model = rawModel ? stripProviderFromModelRef(rawModel) : "model:unknown";
|
|
180
|
+
const thinking = preview?.thinking?.trim() || preview?.thinkingLevel?.trim();
|
|
181
|
+
if (!thinking || model.endsWith(`:${thinking}`))
|
|
182
|
+
return model;
|
|
183
|
+
return `${model}:${thinking}`;
|
|
184
|
+
}
|
|
185
|
+
export function activeSubagentStates(agents) {
|
|
186
|
+
return agents.filter((agent) => isSubagentActiveStatus(agent.status));
|
|
187
|
+
}
|
|
188
|
+
export function allSubagentStatesTerminal(agents) {
|
|
189
|
+
return agents.length > 0 && agents.every((agent) => isSubagentTerminalStatus(agent.status));
|
|
190
|
+
}
|
|
191
|
+
export function taskPreviewMap(tasks) {
|
|
192
|
+
return new Map((tasks ?? []).map((task) => [task.id, task]));
|
|
193
|
+
}
|
|
194
|
+
export function formatSubagentTimestamp(value) {
|
|
195
|
+
if (!value)
|
|
196
|
+
return undefined;
|
|
197
|
+
const time = Date.parse(value);
|
|
198
|
+
if (!Number.isFinite(time))
|
|
199
|
+
return value;
|
|
200
|
+
return new Date(time).toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit", second: "2-digit" });
|
|
201
|
+
}
|
|
202
|
+
export function formatElapsedSince(value, now = Date.now()) {
|
|
203
|
+
if (!value)
|
|
204
|
+
return "elapsed:—";
|
|
205
|
+
const started = Date.parse(value);
|
|
206
|
+
if (!Number.isFinite(started))
|
|
207
|
+
return "elapsed:—";
|
|
208
|
+
const seconds = Math.max(0, Math.floor((now - started) / 1000));
|
|
209
|
+
if (seconds < 60)
|
|
210
|
+
return `${seconds}s`;
|
|
211
|
+
const minutes = Math.floor(seconds / 60);
|
|
212
|
+
const remainingSeconds = seconds % 60;
|
|
213
|
+
if (minutes < 60)
|
|
214
|
+
return `${minutes}m${remainingSeconds.toString().padStart(2, "0")}s`;
|
|
215
|
+
const hours = Math.floor(minutes / 60);
|
|
216
|
+
const remainingMinutes = minutes % 60;
|
|
217
|
+
return `${hours}h${remainingMinutes.toString().padStart(2, "0")}m`;
|
|
218
|
+
}
|
|
219
|
+
export function subagentRunName(runDir) {
|
|
220
|
+
return basename(runDir) || runDir;
|
|
221
|
+
}
|
|
222
|
+
export function resolveSubagentRunDir(cwd, runDir) {
|
|
223
|
+
return resolve(isAbsolute(runDir) ? runDir : join(cwd, runDir));
|
|
224
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { SubagentsWidgetState } from "./types.js";
|
|
2
|
+
export type SubagentsToolResultObserveOptions = {
|
|
3
|
+
showSnapshot?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type SubagentsWidgetControllerHost = {
|
|
6
|
+
readonly cwd: string;
|
|
7
|
+
sessionFile(): string | undefined;
|
|
8
|
+
isRunning(): boolean;
|
|
9
|
+
render(): void;
|
|
10
|
+
};
|
|
11
|
+
export declare class AppSubagentsWidgetController {
|
|
12
|
+
private readonly host;
|
|
13
|
+
private pollTimer;
|
|
14
|
+
private pollInFlight;
|
|
15
|
+
private currentRunDir;
|
|
16
|
+
private state;
|
|
17
|
+
private readonly taskPreviewsByRunDir;
|
|
18
|
+
private readonly snapshotByRunDir;
|
|
19
|
+
private refreshGeneration;
|
|
20
|
+
private fileWatcher;
|
|
21
|
+
private fileRefreshTimer;
|
|
22
|
+
constructor(host: SubagentsWidgetControllerHost);
|
|
23
|
+
get widgetState(): SubagentsWidgetState | undefined;
|
|
24
|
+
startPolling(): void;
|
|
25
|
+
stopPolling(): void;
|
|
26
|
+
reset(): void;
|
|
27
|
+
observeToolResult(toolName: string, details: unknown, options?: SubagentsToolResultObserveOptions): void;
|
|
28
|
+
observeLiveState(data: unknown): void;
|
|
29
|
+
private startFileWatcher;
|
|
30
|
+
private stopFileWatcher;
|
|
31
|
+
private handleSubagentsFilesChanged;
|
|
32
|
+
private schedulePoll;
|
|
33
|
+
private poll;
|
|
34
|
+
private refreshFromFiles;
|
|
35
|
+
private findActiveRegistryRunDirForCurrentSession;
|
|
36
|
+
private registryRunDirsNewestFirst;
|
|
37
|
+
private clearMissingRunAndMaybeSelectReplacement;
|
|
38
|
+
private clearCachedRun;
|
|
39
|
+
private updateState;
|
|
40
|
+
private isCurrentGeneration;
|
|
41
|
+
private shouldContinuePolling;
|
|
42
|
+
private eventMatchesCurrentSession;
|
|
43
|
+
}
|