@code-yeongyu/senpi 2026.7.25 → 2026.7.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +81 -0
- package/README.md +1 -1
- package/dist/beta/omo-local-update.d.ts +207 -0
- package/dist/beta/omo-local-update.d.ts.map +1 -0
- package/dist/beta/omo-local-update.js +708 -0
- package/dist/beta/omo-local-update.js.map +1 -0
- package/dist/cli/args.d.ts +4 -16
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +9 -25
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/grok-neo-gate.d.ts +12 -0
- package/dist/cli/grok-neo-gate.d.ts.map +1 -0
- package/dist/cli/grok-neo-gate.js +18 -0
- package/dist/cli/grok-neo-gate.js.map +1 -0
- package/dist/cli-main.js +4 -0
- package/dist/cli-main.js.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +2 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +33 -8
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +22 -3
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +202 -58
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-providers.d.ts +2 -2
- package/dist/core/auth-providers.js +2 -2
- package/dist/core/auth-providers.js.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/timeout.js +3 -2
- package/dist/core/extensions/builtin/bash-timeout/timeout.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.js +30 -2
- package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.js +28 -0
- package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
- package/dist/core/extensions/builtin/config-reload/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/config-reload/index.js +20 -17
- package/dist/core/extensions/builtin/config-reload/index.js.map +1 -1
- package/dist/core/extensions/builtin/config-reload/log.d.ts +4 -1
- package/dist/core/extensions/builtin/config-reload/log.d.ts.map +1 -1
- package/dist/core/extensions/builtin/config-reload/log.js +3 -0
- package/dist/core/extensions/builtin/config-reload/log.js.map +1 -1
- package/dist/core/extensions/builtin/config-reload/routine-settings.d.ts +15 -0
- package/dist/core/extensions/builtin/config-reload/routine-settings.d.ts.map +1 -0
- package/dist/core/extensions/builtin/config-reload/routine-settings.js +102 -0
- package/dist/core/extensions/builtin/config-reload/routine-settings.js.map +1 -0
- package/dist/core/extensions/builtin/goal/command-registration.js +2 -2
- package/dist/core/extensions/builtin/goal/command-registration.js.map +1 -1
- package/dist/core/extensions/builtin/goal/format.d.ts +1 -1
- package/dist/core/extensions/builtin/goal/format.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/format.js +9 -2
- package/dist/core/extensions/builtin/goal/format.js.map +1 -1
- package/dist/core/extensions/builtin/goal/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/index.js +38 -23
- package/dist/core/extensions/builtin/goal/index.js.map +1 -1
- package/dist/core/extensions/builtin/goal/lifecycle-helpers.d.ts +6 -0
- package/dist/core/extensions/builtin/goal/lifecycle-helpers.d.ts.map +1 -0
- package/dist/core/extensions/builtin/goal/lifecycle-helpers.js +19 -0
- package/dist/core/extensions/builtin/goal/lifecycle-helpers.js.map +1 -0
- package/dist/core/extensions/builtin/goal/persistence.d.ts +6 -0
- package/dist/core/extensions/builtin/goal/persistence.d.ts.map +1 -0
- package/dist/core/extensions/builtin/goal/persistence.js +141 -0
- package/dist/core/extensions/builtin/goal/persistence.js.map +1 -0
- package/dist/core/extensions/builtin/goal/store.d.ts +7 -3
- package/dist/core/extensions/builtin/goal/store.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/store.js +66 -181
- package/dist/core/extensions/builtin/goal/store.js.map +1 -1
- package/dist/core/extensions/builtin/goal/tool-registration.d.ts +1 -0
- package/dist/core/extensions/builtin/goal/tool-registration.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/tool-registration.js +26 -15
- package/dist/core/extensions/builtin/goal/tool-registration.js.map +1 -1
- package/dist/core/extensions/builtin/goal/transitions.d.ts +3 -0
- package/dist/core/extensions/builtin/goal/transitions.d.ts.map +1 -0
- package/dist/core/extensions/builtin/goal/transitions.js +45 -0
- package/dist/core/extensions/builtin/goal/transitions.js.map +1 -0
- package/dist/core/extensions/builtin/goal/types.d.ts +10 -4
- package/dist/core/extensions/builtin/goal/types.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/types.js +2 -2
- package/dist/core/extensions/builtin/goal/types.js.map +1 -1
- package/dist/core/extensions/builtin/goal/ui.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/ui.js +2 -0
- package/dist/core/extensions/builtin/goal/ui.js.map +1 -1
- package/dist/core/extensions/builtin/goal/validation.d.ts +8 -1
- package/dist/core/extensions/builtin/goal/validation.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/validation.js +24 -12
- package/dist/core/extensions/builtin/goal/validation.js.map +1 -1
- package/dist/core/extensions/builtin/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/index.js +0 -2
- package/dist/core/extensions/builtin/index.js.map +1 -1
- package/dist/core/extensions/builtin/mcp/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/mcp/index.js +8 -5
- package/dist/core/extensions/builtin/mcp/index.js.map +1 -1
- package/dist/core/extensions/builtin/permission-system/parsers.d.ts.map +1 -1
- package/dist/core/extensions/builtin/permission-system/parsers.js +1 -0
- package/dist/core/extensions/builtin/permission-system/parsers.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts +48 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +88 -64
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.js +32 -0
- package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/index.d.ts +1 -1
- package/dist/core/extensions/builtin/terminal/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/index.js +1 -1
- package/dist/core/extensions/builtin/terminal/index.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-notify.d.ts +29 -0
- package/dist/core/extensions/builtin/terminal/monitor-notify.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/monitor-notify.js +185 -0
- package/dist/core/extensions/builtin/terminal/monitor-notify.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts +35 -0
- package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/monitor-registry.js +98 -0
- package/dist/core/extensions/builtin/terminal/monitor-registry.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/notify.d.ts +9 -0
- package/dist/core/extensions/builtin/terminal/notify.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/notify.js +30 -14
- package/dist/core/extensions/builtin/terminal/notify.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/prompt.d.ts +1 -1
- package/dist/core/extensions/builtin/terminal/prompt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/prompt.js +13 -5
- package/dist/core/extensions/builtin/terminal/prompt.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/runtime-session.d.ts +3 -12
- package/dist/core/extensions/builtin/terminal/runtime-session.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/runtime-session.js +4 -59
- package/dist/core/extensions/builtin/terminal/runtime-session.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/settings.d.ts +8 -0
- package/dist/core/extensions/builtin/terminal/settings.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/settings.js +16 -2
- package/dist/core/extensions/builtin/terminal/settings.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/shared.d.ts +2 -2
- package/dist/core/extensions/builtin/terminal/shared.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/shared.js +2 -1
- package/dist/core/extensions/builtin/terminal/shared.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/bash-output.d.ts +10 -4
- package/dist/core/extensions/builtin/terminal/tools/bash-output.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/bash-output.js +17 -96
- package/dist/core/extensions/builtin/terminal/tools/bash-output.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/context.d.ts +7 -0
- package/dist/core/extensions/builtin/terminal/tools/context.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/context.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts +41 -0
- package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/tools/monitor.js +97 -0
- package/dist/core/extensions/builtin/terminal/tools/monitor.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/tools/render.d.ts +3 -0
- package/dist/core/extensions/builtin/terminal/tools/render.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/render.js +5 -2
- package/dist/core/extensions/builtin/terminal/tools/render.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/fuzzy-match.d.ts +19 -0
- package/dist/core/extensions/builtin/todotools/fuzzy-match.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todotools/fuzzy-match.js +70 -0
- package/dist/core/extensions/builtin/todotools/fuzzy-match.js.map +1 -0
- package/dist/core/extensions/builtin/todotools/normalize.d.ts +8 -0
- package/dist/core/extensions/builtin/todotools/normalize.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todotools/normalize.js +174 -0
- package/dist/core/extensions/builtin/todotools/normalize.js.map +1 -0
- package/dist/core/extensions/builtin/todotools/prompt.d.ts +2 -2
- package/dist/core/extensions/builtin/todotools/prompt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/prompt.js +4 -2
- package/dist/core/extensions/builtin/todotools/prompt.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/state.d.ts +9 -8
- package/dist/core/extensions/builtin/todotools/state.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/state.js +99 -48
- package/dist/core/extensions/builtin/todotools/state.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/tools/todo.d.ts +1 -1
- package/dist/core/extensions/builtin/todotools/tools/todo.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/tools/todo.js +65 -38
- package/dist/core/extensions/builtin/todotools/tools/todo.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/index.js +2 -4
- package/dist/core/extensions/builtin/websearch/index.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/config.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/config.js +4 -1
- package/dist/core/extensions/builtin/websearch/websearch/config.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/native.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/native.js +2 -4
- package/dist/core/extensions/builtin/websearch/websearch/native.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/renderers.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/renderers.js +20 -8
- package/dist/core/extensions/builtin/websearch/websearch/renderers.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/search.d.ts +6 -1
- package/dist/core/extensions/builtin/websearch/websearch/search.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/search.js +15 -11
- package/dist/core/extensions/builtin/websearch/websearch/search.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/tool.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/tool.js +5 -10
- package/dist/core/extensions/builtin/websearch/websearch/tool.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/types.d.ts +1 -0
- package/dist/core/extensions/builtin/websearch/websearch/types.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/types.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +12 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +5 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +12 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +25 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/keybindings.d.ts +0 -5
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +0 -2
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/messages.d.ts +32 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +91 -0
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-resolver.d.ts +10 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +13 -3
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +2 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +4 -3
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +19 -1
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader.d.ts +9 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +13 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/retry-fallback/controller.d.ts +7 -0
- package/dist/core/retry-fallback/controller.d.ts.map +1 -1
- package/dist/core/retry-fallback/controller.js +13 -0
- package/dist/core/retry-fallback/controller.js.map +1 -1
- package/dist/core/retry-fallback/cooldown.d.ts.map +1 -1
- package/dist/core/retry-fallback/cooldown.js +5 -0
- package/dist/core/retry-fallback/cooldown.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +11 -35
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +12 -16
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +10 -13
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/thinking-levels.d.ts.map +1 -1
- package/dist/core/thinking-levels.js +9 -2
- package/dist/core/thinking-levels.js.map +1 -1
- package/dist/core/timings.d.ts +7 -2
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +11 -0
- package/dist/core/timings.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +6 -0
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/inspector-policy.d.ts +22 -0
- package/dist/inspector-policy.d.ts.map +1 -0
- package/dist/inspector-policy.js +84 -0
- package/dist/inspector-policy.js.map +1 -0
- package/dist/main.d.ts +6 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +20 -23
- package/dist/main.js.map +1 -1
- package/dist/modes/app-server/runtime.d.ts.map +1 -1
- package/dist/modes/app-server/runtime.js +1 -0
- package/dist/modes/app-server/runtime.js.map +1 -1
- package/dist/modes/app-server/threads/goal-handlers.js +4 -2
- package/dist/modes/app-server/threads/goal-handlers.js.map +1 -1
- package/dist/modes/app-server/threads/goal-wire.d.ts.map +1 -1
- package/dist/modes/app-server/threads/goal-wire.js +1 -0
- package/dist/modes/app-server/threads/goal-wire.js.map +1 -1
- package/dist/modes/app-server/threads/handlers.d.ts +1 -0
- package/dist/modes/app-server/threads/handlers.d.ts.map +1 -1
- package/dist/modes/app-server/threads/handlers.js +2 -0
- package/dist/modes/app-server/threads/handlers.js.map +1 -1
- package/dist/modes/app-server/threads/turn-runtime.d.ts +1 -0
- package/dist/modes/app-server/threads/turn-runtime.d.ts.map +1 -1
- package/dist/modes/app-server/threads/turn-runtime.js.map +1 -1
- package/dist/modes/app-server/threads/turns.d.ts.map +1 -1
- package/dist/modes/app-server/threads/turns.js +47 -3
- package/dist/modes/app-server/threads/turns.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts +3 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +9 -2
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +1 -0
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +29 -4
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +5 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +43 -17
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/grok/chrome-tokens.d.ts +22 -0
- package/dist/modes/interactive/grok/chrome-tokens.d.ts.map +1 -0
- package/dist/modes/interactive/grok/chrome-tokens.js +27 -0
- package/dist/modes/interactive/grok/chrome-tokens.js.map +1 -0
- package/dist/modes/interactive/grok/chrome.d.ts +51 -0
- package/dist/modes/interactive/grok/chrome.d.ts.map +1 -0
- package/dist/modes/interactive/grok/chrome.js +105 -0
- package/dist/modes/interactive/grok/chrome.js.map +1 -0
- package/dist/modes/interactive/grok/footer.d.ts +14 -0
- package/dist/modes/interactive/grok/footer.d.ts.map +1 -0
- package/dist/modes/interactive/grok/footer.js +27 -0
- package/dist/modes/interactive/grok/footer.js.map +1 -0
- package/dist/modes/interactive/grok/input-card.d.ts +9 -0
- package/dist/modes/interactive/grok/input-card.d.ts.map +1 -0
- package/dist/modes/interactive/grok/input-card.js +30 -0
- package/dist/modes/interactive/grok/input-card.js.map +1 -0
- package/dist/modes/interactive/grok/palette.d.ts +145 -0
- package/dist/modes/interactive/grok/palette.d.ts.map +1 -0
- package/dist/modes/interactive/grok/palette.js +92 -0
- package/dist/modes/interactive/grok/palette.js.map +1 -0
- package/dist/modes/interactive/grok/tool-row.d.ts +17 -0
- package/dist/modes/interactive/grok/tool-row.d.ts.map +1 -0
- package/dist/modes/interactive/grok/tool-row.js +26 -0
- package/dist/modes/interactive/grok/tool-row.js.map +1 -0
- package/dist/modes/interactive/grok/welcome-card.d.ts +10 -0
- package/dist/modes/interactive/grok/welcome-card.d.ts.map +1 -0
- package/dist/modes/interactive/grok/welcome-card.js +30 -0
- package/dist/modes/interactive/grok/welcome-card.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +5 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +117 -54
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/grok-day.json +77 -0
- package/dist/modes/interactive/theme/grok-night.json +93 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +4 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/rpc/connection-handler.d.ts +3 -3
- package/dist/modes/rpc/connection-handler.js +6 -6
- package/dist/modes/rpc/connection-handler.js.map +1 -1
- package/dist/modes/rpc/custom-capability.d.ts +6 -7
- package/dist/modes/rpc/custom-capability.d.ts.map +1 -1
- package/dist/modes/rpc/custom-capability.js +6 -7
- package/dist/modes/rpc/custom-capability.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +2 -2
- package/dist/modes/rpc/rpc-mode.js +5 -5
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +11 -0
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/senpi +2 -0
- package/docs/docs.json +4 -0
- package/docs/environment-variables.md +1 -0
- package/docs/extensions.md +2 -2
- package/docs/grok-neo.md +77 -0
- package/docs/keybindings.md +0 -1
- package/docs/settings.md +14 -3
- package/docs/terminal-tools.md +6 -3
- package/docs/usage.md +1 -1
- package/examples/extensions/message-renderer.ts +2 -2
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +47 -0
- package/node_modules/@code-yeongyu/senpi-codemode/README.md +39 -19
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +3 -3
- package/node_modules/@code-yeongyu/senpi-codemode/src/bridge/http-server.ts +6 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/bridges/output-bridge.ts +0 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/extension/eval-notifier.ts +40 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +46 -66
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/context-manager.ts +5 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/kernel-contract.ts +2 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/kernel.ts +19 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/prelude.py +7 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/shared/subprocess-kernel.ts +8 -5
- package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +23 -5
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-manager.ts +322 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +253 -18
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/interrupt-note.ts +58 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/render.ts +28 -6
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/status-events.ts +20 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/types.ts +65 -22
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +4 -41
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +6 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +4 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.d.ts +10 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.js +38 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +5 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +210 -26
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +16 -8
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +39 -20
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +9 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +4 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +12 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +19 -11
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +121 -23
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +67 -31
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +13 -8
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.d.ts +3 -2
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.js +37 -35
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/radius.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +11 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models-store.d.ts +5 -0
- package/node_modules/@earendil-works/pi-ai/dist/models-store.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models-store.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.js +5 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +9 -0
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js +8 -3
- package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +10 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/server-fallback-receipt.d.ts +30 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/server-fallback-receipt.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/server-fallback-receipt.js +70 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/server-fallback-receipt.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/stop-details.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/stop-details.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/stop-details.js +7 -3
- package/node_modules/@earendil-works/pi-ai/dist/utils/stop-details.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-call-id.d.ts +9 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-call-id.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-call-id.js +16 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/tool-call-id.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/package.json +1 -1
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +35 -3
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +6 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +32 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +15 -7
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +8 -8
- package/dist/cli/neo/build-argv.d.ts +0 -19
- package/dist/cli/neo/build-argv.d.ts.map +0 -1
- package/dist/cli/neo/build-argv.js +0 -84
- package/dist/cli/neo/build-argv.js.map +0 -1
- package/dist/cli/neo/daemon-launch.d.ts +0 -25
- package/dist/cli/neo/daemon-launch.d.ts.map +0 -1
- package/dist/cli/neo/daemon-launch.js +0 -97
- package/dist/cli/neo/daemon-launch.js.map +0 -1
- package/dist/cli/neo/gate.d.ts +0 -15
- package/dist/cli/neo/gate.d.ts.map +0 -1
- package/dist/cli/neo/gate.js +0 -21
- package/dist/cli/neo/gate.js.map +0 -1
- package/dist/cli/neo/launch.d.ts +0 -24
- package/dist/cli/neo/launch.d.ts.map +0 -1
- package/dist/cli/neo/launch.js +0 -66
- package/dist/cli/neo/launch.js.map +0 -1
- package/dist/cli/neo/platform.d.ts +0 -38
- package/dist/cli/neo/platform.d.ts.map +0 -1
- package/dist/cli/neo/platform.js +0 -54
- package/dist/cli/neo/platform.js.map +0 -1
- package/dist/cli/neo/resolve-binary.d.ts +0 -39
- package/dist/cli/neo/resolve-binary.d.ts.map +0 -1
- package/dist/cli/neo/resolve-binary.js +0 -66
- package/dist/cli/neo/resolve-binary.js.map +0 -1
- package/dist/core/extensions/builtin/session-observer/index.d.ts +0 -5
- package/dist/core/extensions/builtin/session-observer/index.d.ts.map +0 -1
- package/dist/core/extensions/builtin/session-observer/index.js +0 -36
- package/dist/core/extensions/builtin/session-observer/index.js.map +0 -1
- package/dist/core/extensions/builtin/session-observer/loader.d.ts +0 -3
- package/dist/core/extensions/builtin/session-observer/loader.d.ts.map +0 -1
- package/dist/core/extensions/builtin/session-observer/loader.js +0 -20
- package/dist/core/extensions/builtin/session-observer/loader.js.map +0 -1
- package/dist/core/extensions/builtin/session-observer/overlay-format.d.ts +0 -7
- package/dist/core/extensions/builtin/session-observer/overlay-format.d.ts.map +0 -1
- package/dist/core/extensions/builtin/session-observer/overlay-format.js +0 -30
- package/dist/core/extensions/builtin/session-observer/overlay-format.js.map +0 -1
- package/dist/core/extensions/builtin/session-observer/overlay.d.ts +0 -51
- package/dist/core/extensions/builtin/session-observer/overlay.d.ts.map +0 -1
- package/dist/core/extensions/builtin/session-observer/overlay.js +0 -229
- package/dist/core/extensions/builtin/session-observer/overlay.js.map +0 -1
- package/dist/core/extensions/builtin/session-observer/scanner.d.ts +0 -10
- package/dist/core/extensions/builtin/session-observer/scanner.d.ts.map +0 -1
- package/dist/core/extensions/builtin/session-observer/scanner.js +0 -142
- package/dist/core/extensions/builtin/session-observer/scanner.js.map +0 -1
- package/dist/core/extensions/builtin/session-observer/text.d.ts +0 -7
- package/dist/core/extensions/builtin/session-observer/text.d.ts.map +0 -1
- package/dist/core/extensions/builtin/session-observer/text.js +0 -37
- package/dist/core/extensions/builtin/session-observer/text.js.map +0 -1
- package/dist/core/extensions/builtin/session-observer/transcript-entries.d.ts +0 -7
- package/dist/core/extensions/builtin/session-observer/transcript-entries.d.ts.map +0 -1
- package/dist/core/extensions/builtin/session-observer/transcript-entries.js +0 -71
- package/dist/core/extensions/builtin/session-observer/transcript-entries.js.map +0 -1
- package/dist/core/extensions/builtin/session-observer/transcript-format.d.ts +0 -11
- package/dist/core/extensions/builtin/session-observer/transcript-format.d.ts.map +0 -1
- package/dist/core/extensions/builtin/session-observer/transcript-format.js +0 -65
- package/dist/core/extensions/builtin/session-observer/transcript-format.js.map +0 -1
- package/dist/core/extensions/builtin/session-observer/transcript.d.ts +0 -4
- package/dist/core/extensions/builtin/session-observer/transcript.d.ts.map +0 -1
- package/dist/core/extensions/builtin/session-observer/transcript.js +0 -81
- package/dist/core/extensions/builtin/session-observer/transcript.js.map +0 -1
- package/dist/core/extensions/builtin/session-observer/types.d.ts +0 -33
- package/dist/core/extensions/builtin/session-observer/types.d.ts.map +0 -1
- package/dist/core/extensions/builtin/session-observer/types.js +0 -2
- package/dist/core/extensions/builtin/session-observer/types.js.map +0 -1
- package/dist/modes/rpc/neo-daemon-child-worker.d.ts +0 -29
- package/dist/modes/rpc/neo-daemon-child-worker.d.ts.map +0 -1
- package/dist/modes/rpc/neo-daemon-child-worker.js +0 -95
- package/dist/modes/rpc/neo-daemon-child-worker.js.map +0 -1
- package/dist/modes/rpc/neo-daemon-mode.d.ts +0 -110
- package/dist/modes/rpc/neo-daemon-mode.d.ts.map +0 -1
- package/dist/modes/rpc/neo-daemon-mode.js +0 -267
- package/dist/modes/rpc/neo-daemon-mode.js.map +0 -1
- package/dist/modes/rpc/neo-daemon-protocol.d.ts +0 -50
- package/dist/modes/rpc/neo-daemon-protocol.d.ts.map +0 -1
- package/dist/modes/rpc/neo-daemon-protocol.js +0 -66
- package/dist/modes/rpc/neo-daemon-protocol.js.map +0 -1
- package/dist/modes/rpc/neo-daemon-registry.d.ts +0 -98
- package/dist/modes/rpc/neo-daemon-registry.d.ts.map +0 -1
- package/dist/modes/rpc/neo-daemon-registry.js +0 -209
- package/dist/modes/rpc/neo-daemon-registry.js.map +0 -1
- package/dist/modes/rpc/neo-runtime-options-argv.d.ts +0 -17
- package/dist/modes/rpc/neo-runtime-options-argv.d.ts.map +0 -1
- package/dist/modes/rpc/neo-runtime-options-argv.js +0 -79
- package/dist/modes/rpc/neo-runtime-options-argv.js.map +0 -1
- package/dist/modes/rpc/neo-runtime-options.d.ts +0 -84
- package/dist/modes/rpc/neo-runtime-options.d.ts.map +0 -1
- package/dist/modes/rpc/neo-runtime-options.js +0 -92
- package/dist/modes/rpc/neo-runtime-options.js.map +0 -1
- package/docs/neo.md +0 -111
- package/node_modules/@code-yeongyu/senpi-codemode/src/codemode/runtime.ts +0 -258
- package/node_modules/@code-yeongyu/senpi-codemode/src/codemode/tools.ts +0 -106
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Static, Type } from "typebox";
|
|
2
|
+
import { type TerminalToolContext, type TerminalToolResult } from "./context.ts";
|
|
3
|
+
import { renderMonitorCall } from "./render.ts";
|
|
4
|
+
export declare const DEFAULT_MONITOR_TIMEOUT_MS = 300000;
|
|
5
|
+
export declare const MAX_MONITOR_TIMEOUT_MS = 3600000;
|
|
6
|
+
export declare const monitorSchema: Type.TUnion<[Type.TObject<{
|
|
7
|
+
action: Type.TOptional<Type.TLiteral<"create">>;
|
|
8
|
+
description: Type.TString;
|
|
9
|
+
command: Type.TString;
|
|
10
|
+
filter: Type.TOptional<Type.TString>;
|
|
11
|
+
timeout_ms: Type.TOptional<Type.TNumber>;
|
|
12
|
+
persistent: Type.TOptional<Type.TBoolean>;
|
|
13
|
+
}>, Type.TObject<{
|
|
14
|
+
action: Type.TLiteral<"rearm">;
|
|
15
|
+
bash_id: Type.TString;
|
|
16
|
+
}>]>;
|
|
17
|
+
export type MonitorInput = Static<typeof monitorSchema>;
|
|
18
|
+
/** Build the PTY-backed monitor tool. Monitor handles share TerminalManager's bash_N namespace. */
|
|
19
|
+
export declare function createMonitorTool(ctx: TerminalToolContext): {
|
|
20
|
+
name: string;
|
|
21
|
+
label: string;
|
|
22
|
+
description: string;
|
|
23
|
+
promptSnippet: string;
|
|
24
|
+
promptGuidelines: string[];
|
|
25
|
+
parameters: Type.TUnion<[Type.TObject<{
|
|
26
|
+
action: Type.TOptional<Type.TLiteral<"create">>;
|
|
27
|
+
description: Type.TString;
|
|
28
|
+
command: Type.TString;
|
|
29
|
+
filter: Type.TOptional<Type.TString>;
|
|
30
|
+
timeout_ms: Type.TOptional<Type.TNumber>;
|
|
31
|
+
persistent: Type.TOptional<Type.TBoolean>;
|
|
32
|
+
}>, Type.TObject<{
|
|
33
|
+
action: Type.TLiteral<"rearm">;
|
|
34
|
+
bash_id: Type.TString;
|
|
35
|
+
}>]>;
|
|
36
|
+
renderCall: typeof renderMonitorCall;
|
|
37
|
+
execute(_toolCallId: string, input: MonitorInput, _signal?: AbortSignal, _onUpdate?: undefined, execCtx?: {
|
|
38
|
+
cwd?: string;
|
|
39
|
+
}): Promise<TerminalToolResult>;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=monitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitor.d.ts","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/terminal/tools/monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAe,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAc,MAAM,cAAc,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,eAAO,MAAM,0BAA0B,SAAU,CAAC;AAClD,eAAO,MAAM,sBAAsB,UAAY,CAAC;AA4BhD,eAAO,MAAM,aAAa;;;;;;;;;;IAAwD,CAAC;AACnF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AA2CxD,mGAAmG;AACnG,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,mBAAmB;;;;;;;;;;;;;;;;;;yBAoB1C,MAAM,SACZ,YAAY,YACT,WAAW,cACT,SAAS,YACX;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GACxB,OAAO,CAAC,kBAAkB,CAAC;EAY/B"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
import { MonitorRegistry } from "../monitor-registry.js";
|
|
3
|
+
import { DEFAULT_COLS, DEFAULT_ROWS, TERMINAL_MONITOR_TOOL } from "../shared.js";
|
|
4
|
+
import { errorResult, textResult } from "./context.js";
|
|
5
|
+
import { renderMonitorCall } from "./render.js";
|
|
6
|
+
import { spawnCommandSession } from "./spawn.js";
|
|
7
|
+
export const DEFAULT_MONITOR_TIMEOUT_MS = 300_000;
|
|
8
|
+
export const MAX_MONITOR_TIMEOUT_MS = 3_600_000;
|
|
9
|
+
const createMonitorSchema = Type.Object({
|
|
10
|
+
action: Type.Optional(Type.Literal("create")),
|
|
11
|
+
description: Type.String({
|
|
12
|
+
minLength: 1,
|
|
13
|
+
maxLength: 200,
|
|
14
|
+
description: "Short label for the watcher and its decision-relevant events.",
|
|
15
|
+
}),
|
|
16
|
+
command: Type.String({ description: "Shell command to run and watch in a PTY-backed monitor session." }),
|
|
17
|
+
filter: Type.Optional(Type.String({ description: "Only stdout lines matching this regex become monitor events." })),
|
|
18
|
+
timeout_ms: Type.Optional(Type.Number({
|
|
19
|
+
minimum: 1,
|
|
20
|
+
maximum: MAX_MONITOR_TIMEOUT_MS,
|
|
21
|
+
description: "Watcher deadline in milliseconds (default 300000; ignored by persistent monitors).",
|
|
22
|
+
})),
|
|
23
|
+
persistent: Type.Optional(Type.Boolean({ description: "Keep watching until the command exits or kill_bash stops its bash_id." })),
|
|
24
|
+
});
|
|
25
|
+
const rearmMonitorSchema = Type.Object({
|
|
26
|
+
action: Type.Literal("rearm"),
|
|
27
|
+
bash_id: Type.String({ description: "Paused monitor bash_id to resume after a wake-budget pause." }),
|
|
28
|
+
});
|
|
29
|
+
export const monitorSchema = Type.Union([createMonitorSchema, rearmMonitorSchema]);
|
|
30
|
+
function resolveDimension(value, fallback) {
|
|
31
|
+
if (value === undefined || !Number.isFinite(value) || value < 1)
|
|
32
|
+
return fallback;
|
|
33
|
+
return Math.trunc(value);
|
|
34
|
+
}
|
|
35
|
+
function resolveTimeoutMs(value) {
|
|
36
|
+
const timeout = value ?? DEFAULT_MONITOR_TIMEOUT_MS;
|
|
37
|
+
return Math.min(Math.max(Math.trunc(timeout), 1), MAX_MONITOR_TIMEOUT_MS);
|
|
38
|
+
}
|
|
39
|
+
function compileFilter(filter) {
|
|
40
|
+
if (filter === undefined)
|
|
41
|
+
return undefined;
|
|
42
|
+
return new RegExp(filter);
|
|
43
|
+
}
|
|
44
|
+
async function createMonitor(ctx, registry, input, execCtx) {
|
|
45
|
+
let filter;
|
|
46
|
+
try {
|
|
47
|
+
filter = compileFilter(input.filter);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return errorResult(`Invalid monitor filter regex: ${input.filter}`);
|
|
51
|
+
}
|
|
52
|
+
const { id, runtime } = await spawnCommandSession(ctx, {
|
|
53
|
+
command: input.command,
|
|
54
|
+
cols: resolveDimension(undefined, ctx.defaultCols || DEFAULT_COLS),
|
|
55
|
+
rows: resolveDimension(undefined, ctx.defaultRows || DEFAULT_ROWS),
|
|
56
|
+
cwd: execCtx?.cwd,
|
|
57
|
+
...(input.persistent ? {} : { timeoutMs: resolveTimeoutMs(input.timeout_ms) }),
|
|
58
|
+
});
|
|
59
|
+
registry.register({ id, description: input.description, runtime, filter });
|
|
60
|
+
return textResult(`Monitor started with ID: ${id}`, { details: { bash_id: id, monitor: true } });
|
|
61
|
+
}
|
|
62
|
+
/** Build the PTY-backed monitor tool. Monitor handles share TerminalManager's bash_N namespace. */
|
|
63
|
+
export function createMonitorTool(ctx) {
|
|
64
|
+
let fallbackRegistry;
|
|
65
|
+
const getRegistry = () => {
|
|
66
|
+
const sessionRegistry = ctx.monitorRegistry;
|
|
67
|
+
if (sessionRegistry)
|
|
68
|
+
return sessionRegistry;
|
|
69
|
+
fallbackRegistry ??= new MonitorRegistry((event) => ctx.onMonitorEvent?.(event));
|
|
70
|
+
return fallbackRegistry;
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
name: TERMINAL_MONITOR_TOOL,
|
|
74
|
+
label: "monitor",
|
|
75
|
+
description: "Watch a background shell command and emit decision-relevant stdout-line events. Returns a bash_id immediately; peek with bash_output or stop with kill_bash.",
|
|
76
|
+
promptSnippet: "Watch a long-running command; monitor emits matching stdout lines as events",
|
|
77
|
+
promptGuidelines: [
|
|
78
|
+
"Use monitor only for decision-relevant lines; filter noisy output at the source when possible.",
|
|
79
|
+
],
|
|
80
|
+
parameters: monitorSchema,
|
|
81
|
+
renderCall: renderMonitorCall,
|
|
82
|
+
async execute(_toolCallId, input, _signal, _onUpdate, execCtx) {
|
|
83
|
+
const registry = getRegistry();
|
|
84
|
+
if (input.action === "rearm") {
|
|
85
|
+
const outcome = registry.rearm(input.bash_id);
|
|
86
|
+
if (outcome === "not_found")
|
|
87
|
+
return errorResult(`No active monitor found with id: ${input.bash_id}`);
|
|
88
|
+
if (outcome === "not_paused")
|
|
89
|
+
return textResult(`Monitor ${input.bash_id} is not paused; no action taken.`);
|
|
90
|
+
ctx.onMonitorRearmed?.(input.bash_id);
|
|
91
|
+
return textResult(`Monitor ${input.bash_id} re-armed.`);
|
|
92
|
+
}
|
|
93
|
+
return createMonitor(ctx, registry, input, execCtx);
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=monitor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"monitor.js","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/terminal/tools/monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,O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mB,EACnB,OAAqB,EACrB,SAAqB,EACrB,OAA0B;YAE1B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;YAC/B,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;gBAC9B,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC9C,IAAI,OAAO,KAAK,WAAW;oBAAE,OAAO,WAAW,CAAC,oCAAoC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;gBACrG,IAAI,OAAO,KAAK,YAAY;oBAAE,OAAO,UAAU,CAAC,WAAW,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;gBAC5G,GAAG,CAAC,gBAAgB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACtC,OAAO,UAAU,CAAC,WAAW,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;YACzD,CAAC;YACD,OAAO,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACrD,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import { type Static, Type } from \"typebox\";\nimport { MonitorRegistry } from \"../monitor-registry.ts\";\nimport { DEFAULT_COLS, DEFAULT_ROWS, TERMINAL_MONITOR_TOOL } from \"../shared.ts\";\nimport { errorResult, type TerminalToolContext, type TerminalToolResult, textResult } from \"./context.ts\";\nimport { renderMonitorCall } from \"./render.ts\";\nimport { spawnCommandSession } from \"./spawn.ts\";\n\nexport const DEFAULT_MONITOR_TIMEOUT_MS = 300_000;\nexport const MAX_MONITOR_TIMEOUT_MS = 3_600_000;\n\nconst createMonitorSchema = Type.Object({\n\taction: Type.Optional(Type.Literal(\"create\")),\n\tdescription: Type.String({\n\t\tminLength: 1,\n\t\tmaxLength: 200,\n\t\tdescription: \"Short label for the watcher and its decision-relevant events.\",\n\t}),\n\tcommand: Type.String({ description: \"Shell command to run and watch in a PTY-backed monitor session.\" }),\n\tfilter: Type.Optional(Type.String({ description: \"Only stdout lines matching this regex become monitor events.\" })),\n\ttimeout_ms: Type.Optional(\n\t\tType.Number({\n\t\t\tminimum: 1,\n\t\t\tmaximum: MAX_MONITOR_TIMEOUT_MS,\n\t\t\tdescription: \"Watcher deadline in milliseconds (default 300000; ignored by persistent monitors).\",\n\t\t}),\n\t),\n\tpersistent: Type.Optional(\n\t\tType.Boolean({ description: \"Keep watching until the command exits or kill_bash stops its bash_id.\" }),\n\t),\n});\n\nconst rearmMonitorSchema = Type.Object({\n\taction: Type.Literal(\"rearm\"),\n\tbash_id: Type.String({ description: \"Paused monitor bash_id to resume after a wake-budget pause.\" }),\n});\n\nexport const monitorSchema = Type.Union([createMonitorSchema, rearmMonitorSchema]);\nexport type MonitorInput = Static<typeof monitorSchema>;\n\ntype MonitorCreateInput = Static<typeof createMonitorSchema>;\n\nfunction resolveDimension(value: number | undefined, fallback: number): number {\n\tif (value === undefined || !Number.isFinite(value) || value < 1) return fallback;\n\treturn Math.trunc(value);\n}\n\nfunction resolveTimeoutMs(value: number | undefined): number {\n\tconst timeout = value ?? DEFAULT_MONITOR_TIMEOUT_MS;\n\treturn Math.min(Math.max(Math.trunc(timeout), 1), MAX_MONITOR_TIMEOUT_MS);\n}\n\nfunction compileFilter(filter: string | undefined): RegExp | undefined {\n\tif (filter === undefined) return undefined;\n\treturn new RegExp(filter);\n}\n\nasync function createMonitor(\n\tctx: TerminalToolContext,\n\tregistry: MonitorRegistry,\n\tinput: MonitorCreateInput,\n\texecCtx: { cwd?: string } | undefined,\n): Promise<TerminalToolResult> {\n\tlet filter: RegExp | undefined;\n\ttry {\n\t\tfilter = compileFilter(input.filter);\n\t} catch {\n\t\treturn errorResult(`Invalid monitor filter regex: ${input.filter}`);\n\t}\n\n\tconst { id, runtime } = await spawnCommandSession(ctx, {\n\t\tcommand: input.command,\n\t\tcols: resolveDimension(undefined, ctx.defaultCols || DEFAULT_COLS),\n\t\trows: resolveDimension(undefined, ctx.defaultRows || DEFAULT_ROWS),\n\t\tcwd: execCtx?.cwd,\n\t\t...(input.persistent ? {} : { timeoutMs: resolveTimeoutMs(input.timeout_ms) }),\n\t});\n\tregistry.register({ id, description: input.description, runtime, filter });\n\treturn textResult(`Monitor started with ID: ${id}`, { details: { bash_id: id, monitor: true } });\n}\n\n/** Build the PTY-backed monitor tool. Monitor handles share TerminalManager's bash_N namespace. */\nexport function createMonitorTool(ctx: TerminalToolContext) {\n\tlet fallbackRegistry: MonitorRegistry | undefined;\n\tconst getRegistry = (): MonitorRegistry => {\n\t\tconst sessionRegistry = ctx.monitorRegistry;\n\t\tif (sessionRegistry) return sessionRegistry;\n\t\tfallbackRegistry ??= new MonitorRegistry((event) => ctx.onMonitorEvent?.(event));\n\t\treturn fallbackRegistry;\n\t};\n\treturn {\n\t\tname: TERMINAL_MONITOR_TOOL,\n\t\tlabel: \"monitor\",\n\t\tdescription:\n\t\t\t\"Watch a background shell command and emit decision-relevant stdout-line events. Returns a bash_id immediately; peek with bash_output or stop with kill_bash.\",\n\t\tpromptSnippet: \"Watch a long-running command; monitor emits matching stdout lines as events\",\n\t\tpromptGuidelines: [\n\t\t\t\"Use monitor only for decision-relevant lines; filter noisy output at the source when possible.\",\n\t\t],\n\t\tparameters: monitorSchema,\n\t\trenderCall: renderMonitorCall,\n\t\tasync execute(\n\t\t\t_toolCallId: string,\n\t\t\tinput: MonitorInput,\n\t\t\t_signal?: AbortSignal,\n\t\t\t_onUpdate?: undefined,\n\t\t\texecCtx?: { cwd?: string },\n\t\t): Promise<TerminalToolResult> {\n\t\t\tconst registry = getRegistry();\n\t\t\tif (input.action === \"rearm\") {\n\t\t\t\tconst outcome = registry.rearm(input.bash_id);\n\t\t\t\tif (outcome === \"not_found\") return errorResult(`No active monitor found with id: ${input.bash_id}`);\n\t\t\t\tif (outcome === \"not_paused\") return textResult(`Monitor ${input.bash_id} is not paused; no action taken.`);\n\t\t\t\tctx.onMonitorRearmed?.(input.bash_id);\n\t\t\t\treturn textResult(`Monitor ${input.bash_id} re-armed.`);\n\t\t\t}\n\t\t\treturn createMonitor(ctx, registry, input, execCtx);\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Text } from "@earendil-works/pi-tui";
|
|
2
2
|
import type { AgentToolResult, ToolDefinition } from "../../../types.ts";
|
|
3
3
|
import type { BashOutputInput, bashOutputSchema } from "./bash-output.ts";
|
|
4
|
+
import type { MonitorInput, monitorSchema } from "./monitor.ts";
|
|
4
5
|
type BashOutputDetails = Record<string, unknown> | undefined;
|
|
5
6
|
type BashOutputToolDefinition = ToolDefinition<typeof bashOutputSchema, BashOutputDetails>;
|
|
7
|
+
type MonitorToolDefinition = ToolDefinition<typeof monitorSchema, BashOutputDetails>;
|
|
6
8
|
type RenderResultOptions = Parameters<NonNullable<BashOutputToolDefinition["renderResult"]>>[1];
|
|
7
9
|
declare class BashOutputResultComponent {
|
|
8
10
|
#private;
|
|
@@ -11,6 +13,7 @@ declare class BashOutputResultComponent {
|
|
|
11
13
|
invalidate(): void;
|
|
12
14
|
}
|
|
13
15
|
export declare function renderBashOutputCall(args: BashOutputInput, theme: Parameters<NonNullable<BashOutputToolDefinition["renderCall"]>>[1]): Text;
|
|
16
|
+
export declare function renderMonitorCall(args: MonitorInput, theme: Parameters<NonNullable<MonitorToolDefinition["renderCall"]>>[1]): Text;
|
|
14
17
|
export declare function renderBashOutputResult(result: AgentToolResult<BashOutputDetails>, options: RenderResultOptions, _theme: Parameters<NonNullable<BashOutputToolDefinition["renderResult"]>>[2], context: Parameters<NonNullable<BashOutputToolDefinition["renderResult"]>>[3]): BashOutputResultComponent;
|
|
15
18
|
export {};
|
|
16
19
|
//# sourceMappingURL=render.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/terminal/tools/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,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AAI,CAEN;AAED,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACpE,IAAI,CAGN;AAED,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,eAAe,CAAC,iBAAiB,CAAC,EAC1C,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,UAAU,CAAC,WAAW,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC5E,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC3E,yBAAyB,CAK3B"}
|
|
@@ -19,8 +19,11 @@ class BashOutputResultComponent {
|
|
|
19
19
|
invalidate() { }
|
|
20
20
|
}
|
|
21
21
|
export function renderBashOutputCall(args, theme) {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
return new Text(theme.fg("toolTitle", theme.bold(`bash_output ${args.bash_id}`)), 0, 0);
|
|
23
|
+
}
|
|
24
|
+
export function renderMonitorCall(args, theme) {
|
|
25
|
+
const label = args.action === "rearm" ? `monitor rearm ${args.bash_id}` : `monitor ${args.description}`;
|
|
26
|
+
return new Text(theme.fg("toolTitle", theme.bold(label)), 0, 0);
|
|
24
27
|
}
|
|
25
28
|
export function renderBashOutputResult(result, options, _theme, context) {
|
|
26
29
|
const component = context.lastComponent ?? new BashOutputResultComponent();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../../../../src/core/extensions/builtin/terminal/tools/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gEAAgE,CAAC;
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../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C,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,eAAe,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACzF,CAAC;AAED,MAAM,UAAU,iBAAiB,CAChC,IAAkB,EAClB,KAAsE;IAEtE,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,iBAAiB,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,WAAW,IAAI,CAAC,WAAW,EAAE,CAAC;IACxG,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,sBAAsB,CACrC,MAA0C,EAC1C,OAA4B,EAC5B,MAA4E,EAC5E,OAA6E;IAE7E,MAAM,SAAS,GACb,OAAO,CAAC,aAAuD,IAAI,IAAI,yBAAyB,EAAE,CAAC;IACrG,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["import { Text } from \"@earendil-works/pi-tui\";\nimport { truncateToVisualLines } from \"../../../../../modes/interactive/components/visual-truncate.ts\";\nimport type { AgentToolResult, ToolDefinition } from \"../../../types.ts\";\nimport type { BashOutputInput, bashOutputSchema } from \"./bash-output.ts\";\nimport type { MonitorInput, monitorSchema } from \"./monitor.ts\";\n\ntype BashOutputDetails = Record<string, unknown> | undefined;\ntype BashOutputToolDefinition = ToolDefinition<typeof bashOutputSchema, BashOutputDetails>;\ntype MonitorToolDefinition = ToolDefinition<typeof monitorSchema, BashOutputDetails>;\ntype RenderResultOptions = Parameters<NonNullable<BashOutputToolDefinition[\"renderResult\"]>>[1];\n\nconst OUTPUT_PREVIEW_LINES = 8;\n\nclass BashOutputResultComponent {\n\t#text = \"\";\n\t#isPartial = false;\n\t#expanded = false;\n\n\tsetResult(result: AgentToolResult<BashOutputDetails>, options: RenderResultOptions): void {\n\t\tconst block = result.content.find((content) => content.type === \"text\");\n\t\tthis.#text = block?.type === \"text\" ? block.text : \"\";\n\t\tthis.#isPartial = options.isPartial;\n\t\tthis.#expanded = options.expanded;\n\t}\n\n\trender(width: number): string[] {\n\t\tif (!this.#isPartial || this.#expanded) return this.#text.split(\"\\n\");\n\t\treturn truncateToVisualLines(this.#text, OUTPUT_PREVIEW_LINES, Math.max(1, width)).visualLines.map((line) =>\n\t\t\tline.trimEnd(),\n\t\t);\n\t}\n\n\tinvalidate(): void {}\n}\n\nexport function renderBashOutputCall(\n\targs: BashOutputInput,\n\ttheme: Parameters<NonNullable<BashOutputToolDefinition[\"renderCall\"]>>[1],\n): Text {\n\treturn new Text(theme.fg(\"toolTitle\", theme.bold(`bash_output ${args.bash_id}`)), 0, 0);\n}\n\nexport function renderMonitorCall(\n\targs: MonitorInput,\n\ttheme: Parameters<NonNullable<MonitorToolDefinition[\"renderCall\"]>>[1],\n): Text {\n\tconst label = args.action === \"rearm\" ? `monitor rearm ${args.bash_id}` : `monitor ${args.description}`;\n\treturn new Text(theme.fg(\"toolTitle\", theme.bold(label)), 0, 0);\n}\n\nexport function renderBashOutputResult(\n\tresult: AgentToolResult<BashOutputDetails>,\n\toptions: RenderResultOptions,\n\t_theme: Parameters<NonNullable<BashOutputToolDefinition[\"renderResult\"]>>[2],\n\tcontext: Parameters<NonNullable<BashOutputToolDefinition[\"renderResult\"]>>[3],\n): BashOutputResultComponent {\n\tconst component =\n\t\t(context.lastComponent as BashOutputResultComponent | undefined) ?? new BashOutputResultComponent();\n\tcomponent.setResult(result, options);\n\treturn component;\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type TodoItem, type TodoPhase } from "./state.ts";
|
|
2
|
+
type TaskHit = {
|
|
3
|
+
task: TodoItem;
|
|
4
|
+
phase: TodoPhase;
|
|
5
|
+
};
|
|
6
|
+
export type FuzzyTaskResolution = {
|
|
7
|
+
hit?: TaskHit;
|
|
8
|
+
corrected: boolean;
|
|
9
|
+
suggestion?: string;
|
|
10
|
+
};
|
|
11
|
+
export type FuzzyPhaseResolution = {
|
|
12
|
+
hit?: TodoPhase;
|
|
13
|
+
corrected: boolean;
|
|
14
|
+
suggestion?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function fuzzyResolveTask(phases: readonly TodoPhase[], query: string): FuzzyTaskResolution;
|
|
17
|
+
export declare function fuzzyResolvePhase(phases: readonly TodoPhase[], name: string): FuzzyPhaseResolution;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=fuzzy-match.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fuzzy-match.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/todotools/fuzzy-match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE7E,KAAK,OAAO,GAAG;IACd,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IACjC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAClC,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAmDF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,mBAAmB,CAWjG;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,oBAAoB,CAUlG"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { sanitizeTodoText } from "./state.js";
|
|
2
|
+
function normalized(text) {
|
|
3
|
+
return sanitizeTodoText(text).toLowerCase();
|
|
4
|
+
}
|
|
5
|
+
function diceCoefficient(left, right) {
|
|
6
|
+
if (left === right)
|
|
7
|
+
return 1;
|
|
8
|
+
if (left.length < 2 || right.length < 2)
|
|
9
|
+
return 0;
|
|
10
|
+
const pairs = new Map();
|
|
11
|
+
for (let index = 0; index < left.length - 1; index += 1) {
|
|
12
|
+
const pair = left.slice(index, index + 2);
|
|
13
|
+
pairs.set(pair, (pairs.get(pair) ?? 0) + 1);
|
|
14
|
+
}
|
|
15
|
+
let overlap = 0;
|
|
16
|
+
for (let index = 0; index < right.length - 1; index += 1) {
|
|
17
|
+
const pair = right.slice(index, index + 2);
|
|
18
|
+
const count = pairs.get(pair) ?? 0;
|
|
19
|
+
if (count > 0) {
|
|
20
|
+
overlap += 1;
|
|
21
|
+
pairs.set(pair, count - 1);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return (2 * overlap) / (left.length + right.length - 2);
|
|
25
|
+
}
|
|
26
|
+
function suggestionFor(candidates, query, contentOf) {
|
|
27
|
+
const normalizedQuery = normalized(query);
|
|
28
|
+
if (!normalizedQuery)
|
|
29
|
+
return undefined;
|
|
30
|
+
let suggestion;
|
|
31
|
+
let bestScore = 0;
|
|
32
|
+
for (const candidate of candidates) {
|
|
33
|
+
const content = contentOf(candidate);
|
|
34
|
+
const normalizedContent = normalized(content);
|
|
35
|
+
if (!normalizedContent)
|
|
36
|
+
continue;
|
|
37
|
+
const score = normalizedContent.includes(normalizedQuery) || normalizedQuery.includes(normalizedContent)
|
|
38
|
+
? 1
|
|
39
|
+
: diceCoefficient(normalizedContent, normalizedQuery);
|
|
40
|
+
if (score >= 0.5 && score > bestScore) {
|
|
41
|
+
bestScore = score;
|
|
42
|
+
suggestion = content;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return suggestion;
|
|
46
|
+
}
|
|
47
|
+
export function fuzzyResolveTask(phases, query) {
|
|
48
|
+
const candidates = phases.flatMap((phase) => phase.tasks.map((task) => ({ task, phase })));
|
|
49
|
+
const exactMatches = candidates.filter(({ task }) => task.content === query);
|
|
50
|
+
if (exactMatches.length === 1)
|
|
51
|
+
return { hit: exactMatches[0], corrected: false };
|
|
52
|
+
const normalizedQuery = normalized(query);
|
|
53
|
+
const normalizedMatches = candidates.filter(({ task }) => normalized(task.content) === normalizedQuery);
|
|
54
|
+
if (normalizedMatches.length === 1)
|
|
55
|
+
return { hit: normalizedMatches[0], corrected: true };
|
|
56
|
+
const suggestion = suggestionFor(candidates, query, ({ task }) => task.content);
|
|
57
|
+
return suggestion ? { corrected: false, suggestion } : { corrected: false };
|
|
58
|
+
}
|
|
59
|
+
export function fuzzyResolvePhase(phases, name) {
|
|
60
|
+
const exactMatches = phases.filter((phase) => phase.name === name);
|
|
61
|
+
if (exactMatches.length === 1)
|
|
62
|
+
return { hit: exactMatches[0], corrected: false };
|
|
63
|
+
const normalizedName = normalized(name);
|
|
64
|
+
const normalizedMatches = phases.filter((phase) => normalized(phase.name) === normalizedName);
|
|
65
|
+
if (normalizedMatches.length === 1)
|
|
66
|
+
return { hit: normalizedMatches[0], corrected: true };
|
|
67
|
+
const suggestion = suggestionFor(phases, name, (phase) => phase.name);
|
|
68
|
+
return suggestion ? { corrected: false, suggestion } : { corrected: false };
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=fuzzy-match.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fuzzy-match.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/todotools/fuzzy-match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAiC,MAAM,YAAY,CAAC;AAmB7E,SAAS,UAAU,CAAC,IAAY;IAC/B,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC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iBAAiB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAE1F,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACtE,OAAO,UAAU,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AAC7E,CAAC","sourcesContent":["import { sanitizeTodoText, type TodoItem, type TodoPhase } from \"./state.ts\";\n\ntype TaskHit = {\n\ttask: TodoItem;\n\tphase: TodoPhase;\n};\n\nexport type FuzzyTaskResolution = {\n\thit?: TaskHit;\n\tcorrected: boolean;\n\tsuggestion?: string;\n};\n\nexport type FuzzyPhaseResolution = {\n\thit?: TodoPhase;\n\tcorrected: boolean;\n\tsuggestion?: string;\n};\n\nfunction normalized(text: string): string {\n\treturn sanitizeTodoText(text).toLowerCase();\n}\n\nfunction diceCoefficient(left: string, right: string): number {\n\tif (left === right) return 1;\n\tif (left.length < 2 || right.length < 2) return 0;\n\tconst pairs = new Map<string, number>();\n\tfor (let index = 0; index < left.length - 1; index += 1) {\n\t\tconst pair = left.slice(index, index + 2);\n\t\tpairs.set(pair, (pairs.get(pair) ?? 0) + 1);\n\t}\n\tlet overlap = 0;\n\tfor (let index = 0; index < right.length - 1; index += 1) {\n\t\tconst pair = right.slice(index, index + 2);\n\t\tconst count = pairs.get(pair) ?? 0;\n\t\tif (count > 0) {\n\t\t\toverlap += 1;\n\t\t\tpairs.set(pair, count - 1);\n\t\t}\n\t}\n\treturn (2 * overlap) / (left.length + right.length - 2);\n}\n\nfunction suggestionFor<T>(\n\tcandidates: readonly T[],\n\tquery: string,\n\tcontentOf: (candidate: T) => string,\n): string | undefined {\n\tconst normalizedQuery = normalized(query);\n\tif (!normalizedQuery) return undefined;\n\tlet suggestion: string | undefined;\n\tlet bestScore = 0;\n\tfor (const candidate of candidates) {\n\t\tconst content = contentOf(candidate);\n\t\tconst normalizedContent = normalized(content);\n\t\tif (!normalizedContent) continue;\n\t\tconst score =\n\t\t\tnormalizedContent.includes(normalizedQuery) || normalizedQuery.includes(normalizedContent)\n\t\t\t\t? 1\n\t\t\t\t: diceCoefficient(normalizedContent, normalizedQuery);\n\t\tif (score >= 0.5 && score > bestScore) {\n\t\t\tbestScore = score;\n\t\t\tsuggestion = content;\n\t\t}\n\t}\n\treturn suggestion;\n}\n\nexport function fuzzyResolveTask(phases: readonly TodoPhase[], query: string): FuzzyTaskResolution {\n\tconst candidates = phases.flatMap((phase) => phase.tasks.map((task) => ({ task, phase })));\n\tconst exactMatches = candidates.filter(({ task }) => task.content === query);\n\tif (exactMatches.length === 1) return { hit: exactMatches[0], corrected: false };\n\n\tconst normalizedQuery = normalized(query);\n\tconst normalizedMatches = candidates.filter(({ task }) => normalized(task.content) === normalizedQuery);\n\tif (normalizedMatches.length === 1) return { hit: normalizedMatches[0], corrected: true };\n\n\tconst suggestion = suggestionFor(candidates, query, ({ task }) => task.content);\n\treturn suggestion ? { corrected: false, suggestion } : { corrected: false };\n}\n\nexport function fuzzyResolvePhase(phases: readonly TodoPhase[], name: string): FuzzyPhaseResolution {\n\tconst exactMatches = phases.filter((phase) => phase.name === name);\n\tif (exactMatches.length === 1) return { hit: exactMatches[0], corrected: false };\n\n\tconst normalizedName = normalized(name);\n\tconst normalizedMatches = phases.filter((phase) => normalized(phase.name) === normalizedName);\n\tif (normalizedMatches.length === 1) return { hit: normalizedMatches[0], corrected: true };\n\n\tconst suggestion = suggestionFor(phases, name, (phase) => phase.name);\n\treturn suggestion ? { corrected: false, suggestion } : { corrected: false };\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TodoOpEntry, TodoPhase } from "./state.ts";
|
|
2
|
+
export type TodoNormalization = {
|
|
3
|
+
entry?: TodoOpEntry;
|
|
4
|
+
corrections: string[];
|
|
5
|
+
error?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function normalizeTodoParams(raw: Record<string, unknown>, currentPhases: readonly TodoPhase[]): TodoNormalization;
|
|
8
|
+
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/todotools/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAiB,SAAS,EAAE,MAAM,YAAY,CAAC;AAExE,MAAM,MAAM,iBAAiB,GAAG;IAC/B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AA6EF,wBAAgB,mBAAmB,CAClC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,aAAa,EAAE,SAAS,SAAS,EAAE,GACjC,iBAAiB,CAsGnB"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
const CONFLICTING_SHAPES = 'conflicting shapes. Use {"op":"init","list":[...]} to replace the list or {"op":"append","phase":"<active phase>","items":[...]} to add tasks.';
|
|
2
|
+
function isRecord(value) {
|
|
3
|
+
return typeof value === "object" && value !== null;
|
|
4
|
+
}
|
|
5
|
+
function isOperation(value) {
|
|
6
|
+
switch (value) {
|
|
7
|
+
case "init":
|
|
8
|
+
case "start":
|
|
9
|
+
case "done":
|
|
10
|
+
case "rm":
|
|
11
|
+
case "drop":
|
|
12
|
+
case "append":
|
|
13
|
+
case "view":
|
|
14
|
+
return true;
|
|
15
|
+
default:
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function strings(value) {
|
|
20
|
+
if (!Array.isArray(value))
|
|
21
|
+
return undefined;
|
|
22
|
+
const parsed = [];
|
|
23
|
+
for (const item of value) {
|
|
24
|
+
if (typeof item !== "string")
|
|
25
|
+
return undefined;
|
|
26
|
+
parsed.push(item);
|
|
27
|
+
}
|
|
28
|
+
return parsed;
|
|
29
|
+
}
|
|
30
|
+
function list(value) {
|
|
31
|
+
if (!Array.isArray(value))
|
|
32
|
+
return undefined;
|
|
33
|
+
const parsed = [];
|
|
34
|
+
for (const item of value) {
|
|
35
|
+
if (!isRecord(item) || typeof item.phase !== "string")
|
|
36
|
+
return undefined;
|
|
37
|
+
const items = strings(item.items);
|
|
38
|
+
if (!items)
|
|
39
|
+
return undefined;
|
|
40
|
+
parsed.push({ phase: item.phase, items });
|
|
41
|
+
}
|
|
42
|
+
return parsed;
|
|
43
|
+
}
|
|
44
|
+
function nonBlank(value) {
|
|
45
|
+
return typeof value === "string" && value.trim() !== "" ? value : undefined;
|
|
46
|
+
}
|
|
47
|
+
function isBlank(value) {
|
|
48
|
+
return typeof value === "string" && value.trim() === "";
|
|
49
|
+
}
|
|
50
|
+
function error(message) {
|
|
51
|
+
return { corrections: [], error: message };
|
|
52
|
+
}
|
|
53
|
+
function aliasCorrection(alias, inferred) {
|
|
54
|
+
const form = alias === "init" ? '{"op":"init","items":[...]}' : '{"op":"append","phase":"<active phase>","items":[...]}';
|
|
55
|
+
if (inferred) {
|
|
56
|
+
return `[auto-corrected] "op" was missing; interpreted as "${alias}" because "${alias}" was provided as an items alias. Always pass op explicitly: ${form}`;
|
|
57
|
+
}
|
|
58
|
+
return `[auto-corrected] "${alias}" was used as an items alias and folded into "items". Use: ${form}`;
|
|
59
|
+
}
|
|
60
|
+
function inferredCorrection(op, reason, form) {
|
|
61
|
+
return `[auto-corrected] "op" was missing; interpreted as "${op}" because ${reason}. Always pass op explicitly: ${form}`;
|
|
62
|
+
}
|
|
63
|
+
function hasTasks(phases) {
|
|
64
|
+
return phases.some((phase) => phase.tasks.length > 0);
|
|
65
|
+
}
|
|
66
|
+
export function normalizeTodoParams(raw, currentPhases) {
|
|
67
|
+
const rawOp = raw.op;
|
|
68
|
+
if (rawOp === "view")
|
|
69
|
+
return { entry: { op: "view" }, corrections: [] };
|
|
70
|
+
if (rawOp !== undefined && !isOperation(rawOp))
|
|
71
|
+
return error('Invalid "op".');
|
|
72
|
+
const op = isOperation(rawOp) ? rawOp : undefined;
|
|
73
|
+
const task = nonBlank(raw.task);
|
|
74
|
+
const phase = nonBlank(raw.phase);
|
|
75
|
+
if (op === "start" || op === "done" || op === "drop" || op === "rm") {
|
|
76
|
+
if (isBlank(raw.task) && !phase) {
|
|
77
|
+
return error('Blank "task" — pass the exact task text, or omit the field entirely for a bulk operation.');
|
|
78
|
+
}
|
|
79
|
+
if (isBlank(raw.phase) && !task) {
|
|
80
|
+
return error('Blank "phase" — pass the exact phase text, or omit the field entirely for a bulk operation.');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const rawItems = strings(raw.items);
|
|
84
|
+
const aliases = [];
|
|
85
|
+
for (const name of ["init", "append"]) {
|
|
86
|
+
const items = strings(raw[name]);
|
|
87
|
+
if (items && items.length > 0)
|
|
88
|
+
aliases.push({ name, items });
|
|
89
|
+
}
|
|
90
|
+
if (aliases.length > 1)
|
|
91
|
+
return error(CONFLICTING_SHAPES);
|
|
92
|
+
if (aliases.length === 1 && rawItems && rawItems.length > 0)
|
|
93
|
+
return error(CONFLICTING_SHAPES);
|
|
94
|
+
const alias = aliases[0];
|
|
95
|
+
let effectiveItems = rawItems && rawItems.length > 0 ? rawItems : undefined;
|
|
96
|
+
let candidate;
|
|
97
|
+
const corrections = [];
|
|
98
|
+
if (alias) {
|
|
99
|
+
if (op && op !== alias.name)
|
|
100
|
+
return error(CONFLICTING_SHAPES);
|
|
101
|
+
effectiveItems = alias.items;
|
|
102
|
+
candidate = op ? undefined : alias.name;
|
|
103
|
+
corrections.push(aliasCorrection(alias.name, !op));
|
|
104
|
+
}
|
|
105
|
+
const effectiveList = list(raw.list);
|
|
106
|
+
const hasList = Boolean(effectiveList && effectiveList.length > 0);
|
|
107
|
+
const hasItems = Boolean(effectiveItems && effectiveItems.length > 0);
|
|
108
|
+
if (hasList && hasItems)
|
|
109
|
+
return error(CONFLICTING_SHAPES);
|
|
110
|
+
let effectiveOp = op;
|
|
111
|
+
if (!effectiveOp) {
|
|
112
|
+
if (candidate) {
|
|
113
|
+
effectiveOp = candidate;
|
|
114
|
+
}
|
|
115
|
+
else if (hasList) {
|
|
116
|
+
effectiveOp = "init";
|
|
117
|
+
corrections.push(inferredCorrection("init", '"list" was provided', '{"op":"init","list":[...]}'));
|
|
118
|
+
}
|
|
119
|
+
else if (hasItems && phase) {
|
|
120
|
+
effectiveOp = "append";
|
|
121
|
+
corrections.push(inferredCorrection("append", '"items" and "phase" were provided', '{"op":"append","phase":"<active phase>","items":[...]}'));
|
|
122
|
+
}
|
|
123
|
+
else if (hasItems && !hasTasks(currentPhases)) {
|
|
124
|
+
effectiveOp = "init";
|
|
125
|
+
corrections.push(inferredCorrection("init", '"items" was provided to an empty todo list', '{"op":"init","items":[...]}'));
|
|
126
|
+
}
|
|
127
|
+
else if (hasItems) {
|
|
128
|
+
return error('Missing "op": use {"op":"init","list":[...]} to replace the list, or {"op":"append","phase":"<active phase>","items":[...]} to add tasks.');
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
return error('Missing "op". Example: {"op":"init","list":[{"phase":"Setup","items":["..."]}]}');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
switch (effectiveOp) {
|
|
135
|
+
case "init": {
|
|
136
|
+
if (task || (effectiveList && effectiveList.length === 0 && hasItems))
|
|
137
|
+
return error(CONFLICTING_SHAPES);
|
|
138
|
+
const entry = { op: "init" };
|
|
139
|
+
if (effectiveList)
|
|
140
|
+
entry.list = effectiveList;
|
|
141
|
+
if (effectiveItems)
|
|
142
|
+
entry.items = effectiveItems;
|
|
143
|
+
if (phase)
|
|
144
|
+
entry.phase = phase;
|
|
145
|
+
return { entry, corrections };
|
|
146
|
+
}
|
|
147
|
+
case "start":
|
|
148
|
+
if (phase || hasList || hasItems)
|
|
149
|
+
return error(CONFLICTING_SHAPES);
|
|
150
|
+
return { entry: task ? { op: "start", task } : { op: "start" }, corrections };
|
|
151
|
+
case "done":
|
|
152
|
+
case "drop":
|
|
153
|
+
case "rm": {
|
|
154
|
+
if (hasList || hasItems)
|
|
155
|
+
return error(CONFLICTING_SHAPES);
|
|
156
|
+
const entry = { op: effectiveOp };
|
|
157
|
+
if (task)
|
|
158
|
+
entry.task = task;
|
|
159
|
+
if (phase)
|
|
160
|
+
entry.phase = phase;
|
|
161
|
+
return { entry, corrections };
|
|
162
|
+
}
|
|
163
|
+
case "append":
|
|
164
|
+
if (task || hasList)
|
|
165
|
+
return error(CONFLICTING_SHAPES);
|
|
166
|
+
return {
|
|
167
|
+
entry: { op: "append", ...(phase ? { phase } : {}), ...(effectiveItems ? { items: effectiveItems } : {}) },
|
|
168
|
+
corrections,
|
|
169
|
+
};
|
|
170
|
+
case "view":
|
|
171
|
+
return { entry: { op: "view" }, corrections: [] };
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/todotools/normalize.ts"],"names":[],"mappings":"AAUA,MAAM,kBAAkB,GACvB,gJAAgJ,CAAC;AAElJ,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACpD,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IAClC,QAAQ,KAAK,EAAE,CAAC;QACf,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO,CAAC;QACb,KAAK,MAAM,CAAC;QACZ,KAAK,IAAI,CAAC;QACV,KAAK,MAAM,CAAC;QACZ,KAAK,QAAQ,CAAC;QACd,KAAK,MAAM;YACV,OAAO,IAAI,CAAC;QACb;YACC,OAAO,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KAAK,MAAM,CAAC;QACZ,KAAK,MAAM,CAAC;QACZ,KAAK,IAAI,EAAE,CAAC;YACX,IAAI,OAAO,IAAI,QAAQ;gBAAE,OAAO,KAAK,CAAC,kBAAkB,CAAC,CAAC;YAC1D,MAAM,KAAK,GAAgB,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC;YAC/C,IAAI,IAAI;gBAAE,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;YAC5B,IAAI,KAAK;gBAAE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;YAC/B,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;QAC/B,CAAC;QACD,KAAK,QAAQ;YACZ,IAAI,IAAI,IAAI,OAAO;gBAAE,OAAO,KAAK,CAAC,kBAAkB,CAAC,CAAC;YACtD,OAAO;gBACN,KAAK,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;gBAC1G,WAAW;aACX,CAAC;QACH,KAAK,MAAM;YACV,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;IACpD,CAAC;AACF,CAAC","sourcesContent":["import type { TodoOpEntry, TodoOperation, TodoPhase } from \"./state.ts\";\n\nexport type TodoNormalization = {\n\tentry?: TodoOpEntry;\n\tcorrections: string[];\n\terror?: string;\n};\n\ntype Alias = \"init\" | \"append\";\n\nconst CONFLICTING_SHAPES =\n\t'conflicting shapes. Use {\"op\":\"init\",\"list\":[...]} to replace the list or {\"op\":\"append\",\"phase\":\"<active phase>\",\"items\":[...]} to add tasks.';\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction isOperation(value: unknown): value is TodoOperation {\n\tswitch (value) {\n\t\tcase \"init\":\n\t\tcase \"start\":\n\t\tcase \"done\":\n\t\tcase \"rm\":\n\t\tcase \"drop\":\n\t\tcase \"append\":\n\t\tcase \"view\":\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nfunction strings(value: unknown): string[] | undefined {\n\tif (!Array.isArray(value)) return undefined;\n\tconst parsed: string[] = [];\n\tfor (const item of value) {\n\t\tif (typeof item !== \"string\") return undefined;\n\t\tparsed.push(item);\n\t}\n\treturn parsed;\n}\n\nfunction list(value: unknown): TodoOpEntry[\"list\"] | undefined {\n\tif (!Array.isArray(value)) return undefined;\n\tconst parsed: NonNullable<TodoOpEntry[\"list\"]> = [];\n\tfor (const item of value) {\n\t\tif (!isRecord(item) || typeof item.phase !== \"string\") return undefined;\n\t\tconst items = strings(item.items);\n\t\tif (!items) return undefined;\n\t\tparsed.push({ phase: item.phase, items });\n\t}\n\treturn parsed;\n}\n\nfunction nonBlank(value: unknown): string | undefined {\n\treturn typeof value === \"string\" && value.trim() !== \"\" ? value : undefined;\n}\n\nfunction isBlank(value: unknown): boolean {\n\treturn typeof value === \"string\" && value.trim() === \"\";\n}\n\nfunction error(message: string): TodoNormalization {\n\treturn { corrections: [], error: message };\n}\n\nfunction aliasCorrection(alias: Alias, inferred: boolean): string {\n\tconst form =\n\t\talias === \"init\" ? '{\"op\":\"init\",\"items\":[...]}' : '{\"op\":\"append\",\"phase\":\"<active phase>\",\"items\":[...]}';\n\tif (inferred) {\n\t\treturn `[auto-corrected] \"op\" was missing; interpreted as \"${alias}\" because \"${alias}\" was provided as an items alias. Always pass op explicitly: ${form}`;\n\t}\n\treturn `[auto-corrected] \"${alias}\" was used as an items alias and folded into \"items\". Use: ${form}`;\n}\n\nfunction inferredCorrection(op: \"init\" | \"append\", reason: string, form: string): string {\n\treturn `[auto-corrected] \"op\" was missing; interpreted as \"${op}\" because ${reason}. Always pass op explicitly: ${form}`;\n}\n\nfunction hasTasks(phases: readonly TodoPhase[]): boolean {\n\treturn phases.some((phase) => phase.tasks.length > 0);\n}\n\nexport function normalizeTodoParams(\n\traw: Record<string, unknown>,\n\tcurrentPhases: readonly TodoPhase[],\n): TodoNormalization {\n\tconst rawOp = raw.op;\n\tif (rawOp === \"view\") return { entry: { op: \"view\" }, corrections: [] };\n\tif (rawOp !== undefined && !isOperation(rawOp)) return error('Invalid \"op\".');\n\n\tconst op = isOperation(rawOp) ? rawOp : undefined;\n\tconst task = nonBlank(raw.task);\n\tconst phase = nonBlank(raw.phase);\n\tif (op === \"start\" || op === \"done\" || op === \"drop\" || op === \"rm\") {\n\t\tif (isBlank(raw.task) && !phase) {\n\t\t\treturn error('Blank \"task\" — pass the exact task text, or omit the field entirely for a bulk operation.');\n\t\t}\n\t\tif (isBlank(raw.phase) && !task) {\n\t\t\treturn error('Blank \"phase\" — pass the exact phase text, or omit the field entirely for a bulk operation.');\n\t\t}\n\t}\n\n\tconst rawItems = strings(raw.items);\n\tconst aliases: Array<{ name: Alias; items: string[] }> = [];\n\tfor (const name of [\"init\", \"append\"] as const) {\n\t\tconst items = strings(raw[name]);\n\t\tif (items && items.length > 0) aliases.push({ name, items });\n\t}\n\tif (aliases.length > 1) return error(CONFLICTING_SHAPES);\n\tif (aliases.length === 1 && rawItems && rawItems.length > 0) return error(CONFLICTING_SHAPES);\n\n\tconst alias = aliases[0];\n\tlet effectiveItems = rawItems && rawItems.length > 0 ? rawItems : undefined;\n\tlet candidate: Alias | undefined;\n\tconst corrections: string[] = [];\n\tif (alias) {\n\t\tif (op && op !== alias.name) return error(CONFLICTING_SHAPES);\n\t\teffectiveItems = alias.items;\n\t\tcandidate = op ? undefined : alias.name;\n\t\tcorrections.push(aliasCorrection(alias.name, !op));\n\t}\n\n\tconst effectiveList = list(raw.list);\n\tconst hasList = Boolean(effectiveList && effectiveList.length > 0);\n\tconst hasItems = Boolean(effectiveItems && effectiveItems.length > 0);\n\tif (hasList && hasItems) return error(CONFLICTING_SHAPES);\n\n\tlet effectiveOp = op;\n\tif (!effectiveOp) {\n\t\tif (candidate) {\n\t\t\teffectiveOp = candidate;\n\t\t} else if (hasList) {\n\t\t\teffectiveOp = \"init\";\n\t\t\tcorrections.push(inferredCorrection(\"init\", '\"list\" was provided', '{\"op\":\"init\",\"list\":[...]}'));\n\t\t} else if (hasItems && phase) {\n\t\t\teffectiveOp = \"append\";\n\t\t\tcorrections.push(\n\t\t\t\tinferredCorrection(\n\t\t\t\t\t\"append\",\n\t\t\t\t\t'\"items\" and \"phase\" were provided',\n\t\t\t\t\t'{\"op\":\"append\",\"phase\":\"<active phase>\",\"items\":[...]}',\n\t\t\t\t),\n\t\t\t);\n\t\t} else if (hasItems && !hasTasks(currentPhases)) {\n\t\t\teffectiveOp = \"init\";\n\t\t\tcorrections.push(\n\t\t\t\tinferredCorrection(\"init\", '\"items\" was provided to an empty todo list', '{\"op\":\"init\",\"items\":[...]}'),\n\t\t\t);\n\t\t} else if (hasItems) {\n\t\t\treturn error(\n\t\t\t\t'Missing \"op\": use {\"op\":\"init\",\"list\":[...]} to replace the list, or {\"op\":\"append\",\"phase\":\"<active phase>\",\"items\":[...]} to add tasks.',\n\t\t\t);\n\t\t} else {\n\t\t\treturn error('Missing \"op\". Example: {\"op\":\"init\",\"list\":[{\"phase\":\"Setup\",\"items\":[\"...\"]}]}');\n\t\t}\n\t}\n\n\tswitch (effectiveOp) {\n\t\tcase \"init\": {\n\t\t\tif (task || (effectiveList && effectiveList.length === 0 && hasItems)) return error(CONFLICTING_SHAPES);\n\t\t\tconst entry: TodoOpEntry = { op: \"init\" };\n\t\t\tif (effectiveList) entry.list = effectiveList;\n\t\t\tif (effectiveItems) entry.items = effectiveItems;\n\t\t\tif (phase) entry.phase = phase;\n\t\t\treturn { entry, corrections };\n\t\t}\n\t\tcase \"start\":\n\t\t\tif (phase || hasList || hasItems) return error(CONFLICTING_SHAPES);\n\t\t\treturn { entry: task ? { op: \"start\", task } : { op: \"start\" }, corrections };\n\t\tcase \"done\":\n\t\tcase \"drop\":\n\t\tcase \"rm\": {\n\t\t\tif (hasList || hasItems) return error(CONFLICTING_SHAPES);\n\t\t\tconst entry: TodoOpEntry = { op: effectiveOp };\n\t\t\tif (task) entry.task = task;\n\t\t\tif (phase) entry.phase = phase;\n\t\t\treturn { entry, corrections };\n\t\t}\n\t\tcase \"append\":\n\t\t\tif (task || hasList) return error(CONFLICTING_SHAPES);\n\t\t\treturn {\n\t\t\t\tentry: { op: \"append\", ...(phase ? { phase } : {}), ...(effectiveItems ? { items: effectiveItems } : {}) },\n\t\t\t\tcorrections,\n\t\t\t};\n\t\tcase \"view\":\n\t\t\treturn { entry: { op: \"view\" }, corrections: [] };\n\t}\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const TODO_TOOL_DESCRIPTION = "**Tasks referenced by verbatim content string, NEVER an auto-generated ID \u2014 no \"task-1\"/\"task-N\" exists. Pass the content text in the task field.**\n\nOn each completion the earliest still-open task (in phase order) auto-promotes to in_progress.\nCompleting tasks out of phase order can move this pointer **back** to an earlier phase \u2014 expected; completed tasks are never reverted.\n\n## Operations\n\n| op | Required fields | Effect |\n|---|---|---|\n| init | list: [{phase, items: string[]}] | Initialize full list (replaces existing) |\n| init | items: string[] | Flattened single-phase init |\n| start | task | Mark in progress |\n| done | task or phase | Mark completed |\n| drop | task or phase | Mark abandoned |\n| rm | task or phase (optional) | Remove task or phase; omit both to clear |\n| append | phase
|
|
2
|
-
export declare const TASK_MANAGEMENT_SECTION = "\n<Task_Management>\n## Todo Management (CRITICAL)\n\nUse the todo tool for multi-step work. It is one operation at a time: initialize a phased list, then start, complete, abandon, append, remove, or view tasks by their exact content. The earliest open task auto-promotes after each completion.\n\n**Tasks referenced by verbatim content string, NEVER an auto-generated ID \u2014 no \"task-1\"/\"task-N\" exists. Pass the content text in the task field.**\n\nOn each completion the earliest still-open task (in phase order) auto-promotes to in_progress.\nCompleting tasks out of phase order can move this pointer **back** to an earlier phase \u2014 expected; completed tasks are never reverted.\n\n## Operations\n\n| op | Required fields | Effect |\n|---|---|---|\n| init | list: [{phase, items: string[]}] | Initialize full list (replaces existing) |\n| init | items: string[] | Flattened single-phase init |\n| start | task | Mark in progress |\n| done | task or phase | Mark completed |\n| drop | task or phase | Mark abandoned |\n| rm | task or phase (optional) | Remove task or phase; omit both to clear |\n| append | phase
|
|
1
|
+
export declare const TODO_TOOL_DESCRIPTION = "**Tasks referenced by verbatim content string, NEVER an auto-generated ID \u2014 no \"task-1\"/\"task-N\" exists. Pass the content text in the task field.**\n\nOn each completion the earliest still-open task (in phase order) auto-promotes to in_progress.\nCompleting tasks out of phase order can move this pointer **back** to an earlier phase \u2014 expected; completed tasks are never reverted.\n\n## Operations\n\n| op | Required fields | Effect |\n|---|---|---|\n| init | list: [{phase, items: string[]}] | Initialize full list (replaces existing) |\n| init | items: string[] | Flattened single-phase init |\n| start | task | Mark in progress |\n| done | task or phase | Mark completed |\n| drop | task or phase | Mark abandoned |\n| rm | task or phase (optional) | Remove task or phase; omit both to clear |\n| append | phase?, items: string[] | Append tasks to phase; lazily creates phase |\n| view | \u2014 | Read-only: echo list |\n\nExample: {\"op\":\"init\",\"list\":[{\"phase\":\"Setup\",\"items\":[\"Survey code\",\"Write tests\"]}]}\n\n## Anatomy\n- **Task content**: 5\u201310 words; what, not how. Unique identifier.\n- **Phase name**: short noun phrase (e.g. Foundation, Auth, Verification). Unique identifier. NEVER prefix 1., A), Phase 1:.\n\n## Rules\n- Mark tasks done immediately after finishing. Complete phases in order.\n- NEVER make a todo call your turn's only tool call \u2014 batch it with the real work: init with the first reads/edits, each done/start with the next action. Solo todo turns waste a round trip.\n- Blocked? append a task to the active phase, or drop.\n- Keep task/phase strings stable once introduced.\n- Lost the exact task text? view echoes the list \u2014 NEVER guess from memory. done/start/drop take the task's EXACT text \u2014 copy it verbatim from the latest todo result, never re-type from memory.\n\n## When to create a list\n- Task requires 3+ distinct steps\n- User explicitly requests one\n- User provides a set of tasks\n- New instructions arrive mid-task \u2014 capture before proceeding\n\n<critical>\nUser hands you a multi-step plan \u2014 phased todo, numbered/bulleted checklist, or \"N bugs/items/tasks\":\n- You MUST init the list with EVERY item as its own task before working.\n- Enumerate all; NEVER summarize into fewer tasks, sample \"the important ones\", drop items, or track the rest from memory.\n</critical>";
|
|
2
|
+
export declare const TASK_MANAGEMENT_SECTION = "\n<Task_Management>\n## Todo Management (CRITICAL)\n\nUse the todo tool for multi-step work. It is one operation at a time: initialize a phased list, then start, complete, abandon, append, remove, or view tasks by their exact content. The earliest open task auto-promotes after each completion.\n\n**Tasks referenced by verbatim content string, NEVER an auto-generated ID \u2014 no \"task-1\"/\"task-N\" exists. Pass the content text in the task field.**\n\nOn each completion the earliest still-open task (in phase order) auto-promotes to in_progress.\nCompleting tasks out of phase order can move this pointer **back** to an earlier phase \u2014 expected; completed tasks are never reverted.\n\n## Operations\n\n| op | Required fields | Effect |\n|---|---|---|\n| init | list: [{phase, items: string[]}] | Initialize full list (replaces existing) |\n| init | items: string[] | Flattened single-phase init |\n| start | task | Mark in progress |\n| done | task or phase | Mark completed |\n| drop | task or phase | Mark abandoned |\n| rm | task or phase (optional) | Remove task or phase; omit both to clear |\n| append | phase?, items: string[] | Append tasks to phase; lazily creates phase |\n| view | \u2014 | Read-only: echo list |\n\nExample: {\"op\":\"init\",\"list\":[{\"phase\":\"Setup\",\"items\":[\"Survey code\",\"Write tests\"]}]}\n\n## Anatomy\n- **Task content**: 5\u201310 words; what, not how. Unique identifier.\n- **Phase name**: short noun phrase (e.g. Foundation, Auth, Verification). Unique identifier. NEVER prefix 1., A), Phase 1:.\n\n## Rules\n- Mark tasks done immediately after finishing. Complete phases in order.\n- NEVER make a todo call your turn's only tool call \u2014 batch it with the real work: init with the first reads/edits, each done/start with the next action. Solo todo turns waste a round trip.\n- Blocked? append a task to the active phase, or drop.\n- Keep task/phase strings stable once introduced.\n- Lost the exact task text? view echoes the list \u2014 NEVER guess from memory. done/start/drop take the task's EXACT text \u2014 copy it verbatim from the latest todo result, never re-type from memory.\n\n## When to create a list\n- Task requires 3+ distinct steps\n- User explicitly requests one\n- User provides a set of tasks\n- New instructions arrive mid-task \u2014 capture before proceeding\n\n<critical>\nUser hands you a multi-step plan \u2014 phased todo, numbered/bulleted checklist, or \"N bugs/items/tasks\":\n- You MUST init the list with EVERY item as its own task before working.\n- Enumerate all; NEVER summarize into fewer tasks, sample \"the important ones\", drop items, or track the rest from memory.\n</critical>\n\n## Evidence\n- File edit: inspect the changed files and diagnostics.\n- Build command: require exit code 0.\n- Test run: require passing output, or state the pre-existing failure.\n</Task_Management>\n";
|
|
3
3
|
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/todotools/prompt.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/todotools/prompt.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,o1EAyCtB,CAAC;AAEb,eAAO,MAAM,uBAAuB,20FAanC,CAAC"}
|
|
@@ -17,9 +17,11 @@ Completing tasks out of phase order can move this pointer **back** to an earlier
|
|
|
17
17
|
| done | task or phase | Mark completed |
|
|
18
18
|
| drop | task or phase | Mark abandoned |
|
|
19
19
|
| rm | task or phase (optional) | Remove task or phase; omit both to clear |
|
|
20
|
-
| append | phase
|
|
20
|
+
| append | phase?, items: string[] | Append tasks to phase; lazily creates phase |
|
|
21
21
|
| view | — | Read-only: echo list |
|
|
22
22
|
|
|
23
|
+
Example: {"op":"init","list":[{"phase":"Setup","items":["Survey code","Write tests"]}]}
|
|
24
|
+
|
|
23
25
|
## Anatomy
|
|
24
26
|
- **Task content**: 5–10 words; what, not how. Unique identifier.
|
|
25
27
|
- **Phase name**: short noun phrase (e.g. Foundation, Auth, Verification). Unique identifier. NEVER prefix 1., A), Phase 1:.
|
|
@@ -29,7 +31,7 @@ Completing tasks out of phase order can move this pointer **back** to an earlier
|
|
|
29
31
|
- NEVER make a todo call your turn's only tool call — batch it with the real work: init with the first reads/edits, each done/start with the next action. Solo todo turns waste a round trip.
|
|
30
32
|
- Blocked? append a task to the active phase, or drop.
|
|
31
33
|
- Keep task/phase strings stable once introduced.
|
|
32
|
-
- Lost the exact task text? view echoes the list — NEVER guess from memory.
|
|
34
|
+
- Lost the exact task text? view echoes the list — NEVER guess from memory. done/start/drop take the task's EXACT text — copy it verbatim from the latest todo result, never re-type from memory.
|
|
33
35
|
|
|
34
36
|
## When to create a list
|
|
35
37
|
- Task requires 3+ distinct steps
|