@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transcript-format.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/session-observer/transcript-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAItE,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAI1C,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,GAAG,SAAS,MAAM,EAAE,CAG3G;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,MAAM,CAMzE;AAWD,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAmBrD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,cAAc,GAAG,IAAI,CAS/G"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Markdown } from "@earendil-works/pi-tui";
|
|
2
|
-
import { theme } from "../../../../modes/interactive/theme/theme.js";
|
|
3
|
-
import { INDENT, sanitizeLine } from "./text.js";
|
|
4
|
-
export const MAX_COLLAPSED_LINES = 3;
|
|
5
|
-
export const MAX_EXPANDED_LINES = 100;
|
|
6
|
-
export const MAX_THINKING_COLLAPSED = 200;
|
|
7
|
-
const MAX_TOOL_ARGS_CHARS = 500;
|
|
8
|
-
export function contentWidth(width) {
|
|
9
|
-
return Math.max(20, width - INDENT.length - 4);
|
|
10
|
-
}
|
|
11
|
-
export function renderMarkdown(text, width, markdownTheme) {
|
|
12
|
-
const markdown = new Markdown(text, 0, 0, markdownTheme);
|
|
13
|
-
return markdown.render(Math.max(40, width - INDENT.length - 4)).map((line) => `${INDENT}${line.trimEnd()}`);
|
|
14
|
-
}
|
|
15
|
-
export function toolResultText(result) {
|
|
16
|
-
return result.content
|
|
17
|
-
.filter((part) => part.type === "text")
|
|
18
|
-
.map((part) => part.text)
|
|
19
|
-
.join("\n")
|
|
20
|
-
.trim();
|
|
21
|
-
}
|
|
22
|
-
function safeJson(value) {
|
|
23
|
-
try {
|
|
24
|
-
return JSON.stringify(value) ?? "";
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
if (error instanceof TypeError)
|
|
28
|
-
return "[unserializable]";
|
|
29
|
-
throw error;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export function formatToolArgs(call) {
|
|
33
|
-
const args = call.arguments;
|
|
34
|
-
const path = args.path;
|
|
35
|
-
if ((call.name === "read" || call.name === "write" || call.name === "edit") && typeof path === "string") {
|
|
36
|
-
return `path: ${path}`;
|
|
37
|
-
}
|
|
38
|
-
const command = args.command;
|
|
39
|
-
if (call.name === "bash" && typeof command === "string")
|
|
40
|
-
return command.replace(/\t/g, " ");
|
|
41
|
-
const parts = [];
|
|
42
|
-
let total = 0;
|
|
43
|
-
for (const [key, value] of Object.entries(args)) {
|
|
44
|
-
if (key.startsWith("_"))
|
|
45
|
-
continue;
|
|
46
|
-
const encoded = typeof value === "string" ? value : safeJson(value);
|
|
47
|
-
const part = `${key}: ${encoded}`;
|
|
48
|
-
if (total + part.length > MAX_TOOL_ARGS_CHARS)
|
|
49
|
-
break;
|
|
50
|
-
parts.push(part);
|
|
51
|
-
total += part.length;
|
|
52
|
-
}
|
|
53
|
-
return parts.join(", ");
|
|
54
|
-
}
|
|
55
|
-
export function renderPreview(lines, text, width, color) {
|
|
56
|
-
const textLines = text.split("\n");
|
|
57
|
-
const maxWidth = contentWidth(width);
|
|
58
|
-
for (const line of textLines.slice(0, MAX_COLLAPSED_LINES)) {
|
|
59
|
-
lines.push(`${INDENT}${theme.fg(color, sanitizeLine(line, maxWidth))}`);
|
|
60
|
-
}
|
|
61
|
-
if (textLines.length > MAX_COLLAPSED_LINES) {
|
|
62
|
-
lines.push(`${INDENT}${theme.fg("dim", `... ${textLines.length - MAX_COLLAPSED_LINES} more lines`)}`);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=transcript-format.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transcript-format.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/session-observer/transcript-format.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAsB,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,8CAA8C,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AACtC,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAE1C,MAAM,m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IACnC,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACrC,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,mBAAmB,CAAC,EAAE,CAAC;QAC5D,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,IAAI,SAAS,CAAC,MAAM,GAAG,mBAAmB,EAAE,CAAC;QAC5C,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,SAAS,CAAC,MAAM,GAAG,mBAAmB,aAAa,CAAC,EAAE,CAAC,CAAC;IACvG,CAAC;AACF,CAAC","sourcesContent":["import type { ToolCall, ToolResultMessage } from \"@earendil-works/pi-ai\";\nimport { Markdown, type MarkdownTheme } from \"@earendil-works/pi-tui\";\nimport { theme } from \"../../../../modes/interactive/theme/theme.ts\";\nimport { INDENT, sanitizeLine } from \"./text.ts\";\n\nexport const MAX_COLLAPSED_LINES = 3;\nexport const MAX_EXPANDED_LINES = 100;\nexport const MAX_THINKING_COLLAPSED = 200;\n\nconst MAX_TOOL_ARGS_CHARS = 500;\n\nexport function contentWidth(width: number): number {\n\treturn Math.max(20, width - INDENT.length - 4);\n}\n\nexport function renderMarkdown(text: string, width: number, markdownTheme: MarkdownTheme): readonly string[] {\n\tconst markdown = new Markdown(text, 0, 0, markdownTheme);\n\treturn markdown.render(Math.max(40, width - INDENT.length - 4)).map((line) => `${INDENT}${line.trimEnd()}`);\n}\n\nexport function toolResultText(result: ToolResultMessage<unknown>): string {\n\treturn result.content\n\t\t.filter((part) => part.type === \"text\")\n\t\t.map((part) => part.text)\n\t\t.join(\"\\n\")\n\t\t.trim();\n}\n\nfunction safeJson(value: unknown): string {\n\ttry {\n\t\treturn JSON.stringify(value) ?? \"\";\n\t} catch (error) {\n\t\tif (error instanceof TypeError) return \"[unserializable]\";\n\t\tthrow error;\n\t}\n}\n\nexport function formatToolArgs(call: ToolCall): string {\n\tconst args = call.arguments;\n\tconst path = args.path;\n\tif ((call.name === \"read\" || call.name === \"write\" || call.name === \"edit\") && typeof path === \"string\") {\n\t\treturn `path: ${path}`;\n\t}\n\tconst command = args.command;\n\tif (call.name === \"bash\" && typeof command === \"string\") return command.replace(/\\t/g, \" \");\n\tconst parts: string[] = [];\n\tlet total = 0;\n\tfor (const [key, value] of Object.entries(args)) {\n\t\tif (key.startsWith(\"_\")) continue;\n\t\tconst encoded = typeof value === \"string\" ? value : safeJson(value);\n\t\tconst part = `${key}: ${encoded}`;\n\t\tif (total + part.length > MAX_TOOL_ARGS_CHARS) break;\n\t\tparts.push(part);\n\t\ttotal += part.length;\n\t}\n\treturn parts.join(\", \");\n}\n\nexport function renderPreview(lines: string[], text: string, width: number, color: \"dim\" | \"thinkingText\"): void {\n\tconst textLines = text.split(\"\\n\");\n\tconst maxWidth = contentWidth(width);\n\tfor (const line of textLines.slice(0, MAX_COLLAPSED_LINES)) {\n\t\tlines.push(`${INDENT}${theme.fg(color, sanitizeLine(line, maxWidth))}`);\n\t}\n\tif (textLines.length > MAX_COLLAPSED_LINES) {\n\t\tlines.push(`${INDENT}${theme.fg(\"dim\", `... ${textLines.length - MAX_COLLAPSED_LINES} more lines`)}`);\n\t}\n}\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { SessionMessageEntry } from "../../../session-manager.ts";
|
|
2
|
-
import type { RenderedTranscript, TranscriptRenderOptions } from "./types.ts";
|
|
3
|
-
export declare function renderTranscript(entries: readonly SessionMessageEntry[], options: TranscriptRenderOptions): RenderedTranscript;
|
|
4
|
-
//# sourceMappingURL=transcript.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/session-observer/transcript.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAoB,MAAM,YAAY,CAAC;AA8BhG,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,SAAS,mBAAmB,EAAE,EACvC,OAAO,EAAE,uBAAuB,GAC9B,kBAAkB,CAwEpB"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { getTextContent } from "./text.js";
|
|
2
|
-
import { renderTextEntry, renderThinkingEntry, renderToolEntry, renderUserEntry } from "./transcript-entries.js";
|
|
3
|
-
function pushRange(ranges, lines, start, kind) {
|
|
4
|
-
ranges.push({ lineStart: start, lineCount: lines.length - start, kind });
|
|
5
|
-
}
|
|
6
|
-
function collectToolResults(entries) {
|
|
7
|
-
const results = new Map();
|
|
8
|
-
for (const entry of entries) {
|
|
9
|
-
if (entry.message.role === "toolResult")
|
|
10
|
-
results.set(entry.message.toolCallId, entry.message);
|
|
11
|
-
}
|
|
12
|
-
return results;
|
|
13
|
-
}
|
|
14
|
-
function pushAssistantRange(ranges, lines, start, blockType) {
|
|
15
|
-
if (blockType === "thinking")
|
|
16
|
-
pushRange(ranges, lines, start, "thinking");
|
|
17
|
-
else if (blockType === "toolCall")
|
|
18
|
-
pushRange(ranges, lines, start, "tool");
|
|
19
|
-
else
|
|
20
|
-
pushRange(ranges, lines, start, "response");
|
|
21
|
-
}
|
|
22
|
-
export function renderTranscript(entries, options) {
|
|
23
|
-
const lines = [];
|
|
24
|
-
const ranges = [];
|
|
25
|
-
const toolResults = collectToolResults(entries);
|
|
26
|
-
let entryIndex = 0;
|
|
27
|
-
for (const entry of entries) {
|
|
28
|
-
const message = entry.message;
|
|
29
|
-
if (message.role === "toolResult")
|
|
30
|
-
continue;
|
|
31
|
-
if (message.role === "assistant") {
|
|
32
|
-
if (message.content.length === 0 && message.errorMessage) {
|
|
33
|
-
const start = lines.length;
|
|
34
|
-
renderTextEntry(lines, "Error", message.errorMessage, true, entryIndex === options.selectedIndex, options);
|
|
35
|
-
pushRange(ranges, lines, start, "response");
|
|
36
|
-
entryIndex += 1;
|
|
37
|
-
}
|
|
38
|
-
for (const block of message.content) {
|
|
39
|
-
const start = lines.length;
|
|
40
|
-
const expanded = options.expandedEntries.has(entryIndex);
|
|
41
|
-
const selected = entryIndex === options.selectedIndex;
|
|
42
|
-
if (block.type === "thinking" && block.thinking.trim())
|
|
43
|
-
renderThinkingEntry(lines, block.thinking.trim(), expanded, selected, options);
|
|
44
|
-
else if (block.type === "text" && block.text.trim())
|
|
45
|
-
renderTextEntry(lines, "Response", block.text.trim(), expanded, selected, options);
|
|
46
|
-
else if (block.type === "toolCall")
|
|
47
|
-
renderToolEntry(lines, block, toolResults.get(block.id), expanded, selected, options);
|
|
48
|
-
else
|
|
49
|
-
continue;
|
|
50
|
-
pushAssistantRange(ranges, lines, start, block.type);
|
|
51
|
-
entryIndex += 1;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
else if (message.role === "user") {
|
|
55
|
-
const text = getTextContent(message.content).trim();
|
|
56
|
-
if (!text)
|
|
57
|
-
continue;
|
|
58
|
-
const start = lines.length;
|
|
59
|
-
renderUserEntry(lines, "User", text, options.expandedEntries.has(entryIndex), entryIndex === options.selectedIndex, options);
|
|
60
|
-
pushRange(ranges, lines, start, "user");
|
|
61
|
-
entryIndex += 1;
|
|
62
|
-
}
|
|
63
|
-
else if (message.role === "custom") {
|
|
64
|
-
const text = getTextContent(message.content).trim();
|
|
65
|
-
if (!text)
|
|
66
|
-
continue;
|
|
67
|
-
const start = lines.length;
|
|
68
|
-
renderUserEntry(lines, message.customType, text, options.expandedEntries.has(entryIndex), entryIndex === options.selectedIndex, options);
|
|
69
|
-
pushRange(ranges, lines, start, "system");
|
|
70
|
-
entryIndex += 1;
|
|
71
|
-
}
|
|
72
|
-
else if (message.role === "bashExecution") {
|
|
73
|
-
const start = lines.length;
|
|
74
|
-
renderUserEntry(lines, "Bash", `$ ${message.command}\n${message.output}`, options.expandedEntries.has(entryIndex), entryIndex === options.selectedIndex, options);
|
|
75
|
-
pushRange(ranges, lines, start, "tool");
|
|
76
|
-
entryIndex += 1;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return { lines, ranges };
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=transcript.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transcript.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/session-observer/transcript.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAGjH,SAAS,SAAS,CACjB,MAA0B,EAC1B,KAAwB,EACxB,KAAa,EACb,IAA8B;IAE9B,MAAM,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1E,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAuC;IAClE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAsC,CAAC;IAC9D,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,YAAY;YAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,SAAS,kBAAkB,CAC1B,MAA0B,EAC1B,KAAe,EACf,KAAa,EACb,SAA2C;IAE3C,IAAI,SAAS,KAAK,UAAU;QAAE,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC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AE,MAAM,CAAC,CAAC;YACxC,UAAU,IAAI,CAAC,CAAC;QACjB,CAAC;aAAM,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtC,MAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;YACpD,IAAI,CAAC,IAAI;gBAAE,SAAS;YACpB,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;YAC3B,eAAe,CACd,KAAK,EACL,OAAO,CAAC,UAAU,EAClB,IAAI,EACJ,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,EACvC,UAAU,KAAK,OAAO,CAAC,aAAa,EACpC,OAAO,CACP,CAAC;YACF,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;YAC1C,UAAU,IAAI,CAAC,CAAC;QACjB,CAAC;aAAM,IAAI,OAAO,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;YAC7C,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;YAC3B,eAAe,CACd,KAAK,EACL,MAAM,EACN,KAAK,OAAO,CAAC,OAAO,KAAK,OAAO,CAAC,MAAM,EAAE,EACzC,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,EACvC,UAAU,KAAK,OAAO,CAAC,aAAa,EACpC,OAAO,CACP,CAAC;YACF,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YACxC,UAAU,IAAI,CAAC,CAAC;QACjB,CAAC;IACF,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["import type { ToolResultMessage } from \"@earendil-works/pi-ai\";\nimport type { SessionMessageEntry } from \"../../../session-manager.ts\";\nimport { getTextContent } from \"./text.ts\";\nimport { renderTextEntry, renderThinkingEntry, renderToolEntry, renderUserEntry } from \"./transcript-entries.ts\";\nimport type { RenderedTranscript, TranscriptRenderOptions, ViewerEntryRange } from \"./types.ts\";\n\nfunction pushRange(\n\tranges: ViewerEntryRange[],\n\tlines: readonly string[],\n\tstart: number,\n\tkind: ViewerEntryRange[\"kind\"],\n): void {\n\tranges.push({ lineStart: start, lineCount: lines.length - start, kind });\n}\n\nfunction collectToolResults(entries: readonly SessionMessageEntry[]): Map<string, ToolResultMessage<unknown>> {\n\tconst results = new Map<string, ToolResultMessage<unknown>>();\n\tfor (const entry of entries) {\n\t\tif (entry.message.role === \"toolResult\") results.set(entry.message.toolCallId, entry.message);\n\t}\n\treturn results;\n}\n\nfunction pushAssistantRange(\n\tranges: ViewerEntryRange[],\n\tlines: string[],\n\tstart: number,\n\tblockType: \"thinking\" | \"text\" | \"toolCall\",\n): void {\n\tif (blockType === \"thinking\") pushRange(ranges, lines, start, \"thinking\");\n\telse if (blockType === \"toolCall\") pushRange(ranges, lines, start, \"tool\");\n\telse pushRange(ranges, lines, start, \"response\");\n}\n\nexport function renderTranscript(\n\tentries: readonly SessionMessageEntry[],\n\toptions: TranscriptRenderOptions,\n): RenderedTranscript {\n\tconst lines: string[] = [];\n\tconst ranges: ViewerEntryRange[] = [];\n\tconst toolResults = collectToolResults(entries);\n\tlet entryIndex = 0;\n\tfor (const entry of entries) {\n\t\tconst message = entry.message;\n\t\tif (message.role === \"toolResult\") continue;\n\t\tif (message.role === \"assistant\") {\n\t\t\tif (message.content.length === 0 && message.errorMessage) {\n\t\t\t\tconst start = lines.length;\n\t\t\t\trenderTextEntry(lines, \"Error\", message.errorMessage, true, entryIndex === options.selectedIndex, options);\n\t\t\t\tpushRange(ranges, lines, start, \"response\");\n\t\t\t\tentryIndex += 1;\n\t\t\t}\n\t\t\tfor (const block of message.content) {\n\t\t\t\tconst start = lines.length;\n\t\t\t\tconst expanded = options.expandedEntries.has(entryIndex);\n\t\t\t\tconst selected = entryIndex === options.selectedIndex;\n\t\t\t\tif (block.type === \"thinking\" && block.thinking.trim())\n\t\t\t\t\trenderThinkingEntry(lines, block.thinking.trim(), expanded, selected, options);\n\t\t\t\telse if (block.type === \"text\" && block.text.trim())\n\t\t\t\t\trenderTextEntry(lines, \"Response\", block.text.trim(), expanded, selected, options);\n\t\t\t\telse if (block.type === \"toolCall\")\n\t\t\t\t\trenderToolEntry(lines, block, toolResults.get(block.id), expanded, selected, options);\n\t\t\t\telse continue;\n\t\t\t\tpushAssistantRange(ranges, lines, start, block.type);\n\t\t\t\tentryIndex += 1;\n\t\t\t}\n\t\t} else if (message.role === \"user\") {\n\t\t\tconst text = getTextContent(message.content).trim();\n\t\t\tif (!text) continue;\n\t\t\tconst start = lines.length;\n\t\t\trenderUserEntry(\n\t\t\t\tlines,\n\t\t\t\t\"User\",\n\t\t\t\ttext,\n\t\t\t\toptions.expandedEntries.has(entryIndex),\n\t\t\t\tentryIndex === options.selectedIndex,\n\t\t\t\toptions,\n\t\t\t);\n\t\t\tpushRange(ranges, lines, start, \"user\");\n\t\t\tentryIndex += 1;\n\t\t} else if (message.role === \"custom\") {\n\t\t\tconst text = getTextContent(message.content).trim();\n\t\t\tif (!text) continue;\n\t\t\tconst start = lines.length;\n\t\t\trenderUserEntry(\n\t\t\t\tlines,\n\t\t\t\tmessage.customType,\n\t\t\t\ttext,\n\t\t\t\toptions.expandedEntries.has(entryIndex),\n\t\t\t\tentryIndex === options.selectedIndex,\n\t\t\t\toptions,\n\t\t\t);\n\t\t\tpushRange(ranges, lines, start, \"system\");\n\t\t\tentryIndex += 1;\n\t\t} else if (message.role === \"bashExecution\") {\n\t\t\tconst start = lines.length;\n\t\t\trenderUserEntry(\n\t\t\t\tlines,\n\t\t\t\t\"Bash\",\n\t\t\t\t`$ ${message.command}\\n${message.output}`,\n\t\t\t\toptions.expandedEntries.has(entryIndex),\n\t\t\t\tentryIndex === options.selectedIndex,\n\t\t\t\toptions,\n\t\t\t);\n\t\t\tpushRange(ranges, lines, start, \"tool\");\n\t\t\tentryIndex += 1;\n\t\t}\n\t}\n\treturn { lines, ranges };\n}\n"]}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { MarkdownTheme } from "@earendil-works/pi-tui";
|
|
2
|
-
import type { SessionMessageEntry } from "../../../session-manager.ts";
|
|
3
|
-
export interface SessionHudEntry {
|
|
4
|
-
readonly id: string;
|
|
5
|
-
readonly shortId: string;
|
|
6
|
-
readonly path: string;
|
|
7
|
-
readonly cwd: string;
|
|
8
|
-
readonly createdAt: number;
|
|
9
|
-
readonly modifiedAt: number;
|
|
10
|
-
readonly messageCount: number;
|
|
11
|
-
readonly lastUserText: string;
|
|
12
|
-
readonly isCurrent: boolean;
|
|
13
|
-
}
|
|
14
|
-
export interface TranscriptSnapshot {
|
|
15
|
-
readonly entries: readonly SessionMessageEntry[];
|
|
16
|
-
readonly model?: string;
|
|
17
|
-
}
|
|
18
|
-
export interface ViewerEntryRange {
|
|
19
|
-
readonly lineStart: number;
|
|
20
|
-
readonly lineCount: number;
|
|
21
|
-
readonly kind: "thinking" | "response" | "tool" | "user" | "system";
|
|
22
|
-
}
|
|
23
|
-
export interface RenderedTranscript {
|
|
24
|
-
readonly lines: readonly string[];
|
|
25
|
-
readonly ranges: readonly ViewerEntryRange[];
|
|
26
|
-
}
|
|
27
|
-
export interface TranscriptRenderOptions {
|
|
28
|
-
readonly width: number;
|
|
29
|
-
readonly selectedIndex: number;
|
|
30
|
-
readonly expandedEntries: ReadonlySet<number>;
|
|
31
|
-
readonly markdownTheme?: MarkdownTheme;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/session-observer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,MAAM,WAAW,eAA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.ts"],"names":[],"mappings":"","sourcesContent":["import type { MarkdownTheme } from \"@earendil-works/pi-tui\";\nimport type { SessionMessageEntry } from \"../../../session-manager.ts\";\n\nexport interface SessionHudEntry {\n\treadonly id: string;\n\treadonly shortId: string;\n\treadonly path: string;\n\treadonly cwd: string;\n\treadonly createdAt: number;\n\treadonly modifiedAt: number;\n\treadonly messageCount: number;\n\treadonly lastUserText: string;\n\treadonly isCurrent: boolean;\n}\n\nexport interface TranscriptSnapshot {\n\treadonly entries: readonly SessionMessageEntry[];\n\treadonly model?: string;\n}\n\nexport interface ViewerEntryRange {\n\treadonly lineStart: number;\n\treadonly lineCount: number;\n\treadonly kind: \"thinking\" | \"response\" | \"tool\" | \"user\" | \"system\";\n}\n\nexport interface RenderedTranscript {\n\treadonly lines: readonly string[];\n\treadonly ranges: readonly ViewerEntryRange[];\n}\n\nexport interface TranscriptRenderOptions {\n\treadonly width: number;\n\treadonly selectedIndex: number;\n\treadonly expandedEntries: ReadonlySet<number>;\n\treadonly markdownTheme?: MarkdownTheme;\n}\n"]}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Production worker factory for the neo daemon: one child `senpi --mode rpc`
|
|
3
|
-
* process per connection.
|
|
4
|
-
*
|
|
5
|
-
* Each child is a standard single-connection rpc runtime with its own module
|
|
6
|
-
* state and its own AuthStorage, so a connection's `--api-key` (passed as argv)
|
|
7
|
-
* lives only in that child — the auth-isolation guarantee is structural. The
|
|
8
|
-
* connection socket is bridged to the child's stdio: client lines → child stdin,
|
|
9
|
-
* child stdout → client socket. On dispose the child is aborted (SIGTERM, then
|
|
10
|
-
* SIGKILL after a grace period).
|
|
11
|
-
*/
|
|
12
|
-
import type { NeoDaemonWorkerFactory } from "./neo-daemon-mode.ts";
|
|
13
|
-
export interface NeoChildWorkerConfig {
|
|
14
|
-
/** Executable to run (default: the current node binary). */
|
|
15
|
-
readonly execPath?: string;
|
|
16
|
-
/** Fixed leading args before the runtime argv (e.g. [cliEntryPath]). */
|
|
17
|
-
readonly baseArgs: readonly string[];
|
|
18
|
-
/** Grace period before SIGKILL after SIGTERM, in ms. */
|
|
19
|
-
readonly killGraceMs?: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Build a worker factory that spawns child rpc processes.
|
|
23
|
-
*
|
|
24
|
-
* `baseArgs` should locate the CLI entry, e.g. `[join(distDir, "rpc-entry.js")]`
|
|
25
|
-
* or `[tsxLoader, cliEntry]` in dev. The connection's runtimeOptions are
|
|
26
|
-
* appended as classic argv (see neoRuntimeOptionsToRpcArgv).
|
|
27
|
-
*/
|
|
28
|
-
export declare function createNeoChildWorkerFactory(config: NeoChildWorkerConfig): NeoDaemonWorkerFactory;
|
|
29
|
-
//# sourceMappingURL=neo-daemon-child-worker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"neo-daemon-child-worker.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/neo-daemon-child-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAmB,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAGpF,MAAM,WAAW,oBAAoB;IACpC,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,wDAAwD;IACxD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,oBAAoB,GAAG,sBAAsB,CA6EhG"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Production worker factory for the neo daemon: one child `senpi --mode rpc`
|
|
3
|
-
* process per connection.
|
|
4
|
-
*
|
|
5
|
-
* Each child is a standard single-connection rpc runtime with its own module
|
|
6
|
-
* state and its own AuthStorage, so a connection's `--api-key` (passed as argv)
|
|
7
|
-
* lives only in that child — the auth-isolation guarantee is structural. The
|
|
8
|
-
* connection socket is bridged to the child's stdio: client lines → child stdin,
|
|
9
|
-
* child stdout → client socket. On dispose the child is aborted (SIGTERM, then
|
|
10
|
-
* SIGKILL after a grace period).
|
|
11
|
-
*/
|
|
12
|
-
import { spawn } from "node:child_process";
|
|
13
|
-
import { RPC_CLIENT_CAPABILITIES_ENV } from "./custom-capability.js";
|
|
14
|
-
import { attachJsonlLineReader } from "./jsonl.js";
|
|
15
|
-
import { neoRuntimeOptionsToRpcArgv } from "./neo-runtime-options-argv.js";
|
|
16
|
-
/**
|
|
17
|
-
* Build a worker factory that spawns child rpc processes.
|
|
18
|
-
*
|
|
19
|
-
* `baseArgs` should locate the CLI entry, e.g. `[join(distDir, "rpc-entry.js")]`
|
|
20
|
-
* or `[tsxLoader, cliEntry]` in dev. The connection's runtimeOptions are
|
|
21
|
-
* appended as classic argv (see neoRuntimeOptionsToRpcArgv).
|
|
22
|
-
*/
|
|
23
|
-
export function createNeoChildWorkerFactory(config) {
|
|
24
|
-
const execPath = config.execPath ?? process.execPath;
|
|
25
|
-
const killGraceMs = config.killGraceMs ?? 3000;
|
|
26
|
-
return async ({ runtimeOptions, capabilities, cwd, agentDir, writeToClient, signal }) => {
|
|
27
|
-
const runtimeArgv = neoRuntimeOptionsToRpcArgv(runtimeOptions);
|
|
28
|
-
// The handshake's client capabilities are additive per-connection flags
|
|
29
|
-
// (e.g. custom_unsupported opt-in). Forward them to the child rpc process
|
|
30
|
-
// via an env var — argv carries runtime construction only, and the child's
|
|
31
|
-
// rpc-mode reads this to gate additive UI behavior. Empty = default child.
|
|
32
|
-
const capabilitiesEnv = capabilities.length > 0 ? { [RPC_CLIENT_CAPABILITIES_ENV]: capabilities.join(",") } : {};
|
|
33
|
-
// neoRuntimeOptionsToRpcArgv already prepends ["--mode","rpc"]; strip it if
|
|
34
|
-
// baseArgs points at rpc-entry (which injects --mode rpc itself). We keep it
|
|
35
|
-
// simple and always pass through cli-main-style args; rpc-entry tolerates a
|
|
36
|
-
// duplicate --mode rpc because parseArgs takes the last one.
|
|
37
|
-
const child = spawn(execPath, [...config.baseArgs, ...runtimeArgv], {
|
|
38
|
-
cwd,
|
|
39
|
-
env: {
|
|
40
|
-
...process.env,
|
|
41
|
-
SENPI_CODING_AGENT_DIR: agentDir,
|
|
42
|
-
...capabilitiesEnv,
|
|
43
|
-
},
|
|
44
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
45
|
-
});
|
|
46
|
-
const stdout = child.stdout;
|
|
47
|
-
const stdin = child.stdin;
|
|
48
|
-
if (!stdout || !stdin) {
|
|
49
|
-
child.kill("SIGKILL");
|
|
50
|
-
throw new Error("Failed to open child worker stdio");
|
|
51
|
-
}
|
|
52
|
-
// Child stdout (JSONL) → client socket, line-framed so partial chunks never
|
|
53
|
-
// split a record across the socket boundary.
|
|
54
|
-
const detachStdout = attachJsonlLineReader(stdout, (line) => {
|
|
55
|
-
writeToClient(`${line}\n`);
|
|
56
|
-
});
|
|
57
|
-
// Surface child stderr as a diagnostic event line without leaking secrets:
|
|
58
|
-
// stderr is forwarded verbatim only in dev builds; here it is dropped to
|
|
59
|
-
// avoid mixing non-JSONL bytes into the client stream. Errors that matter
|
|
60
|
-
// arrive as rpc error responses on stdout.
|
|
61
|
-
child.stderr?.resume();
|
|
62
|
-
let disposed = false;
|
|
63
|
-
const dispose = async () => {
|
|
64
|
-
if (disposed)
|
|
65
|
-
return;
|
|
66
|
-
disposed = true;
|
|
67
|
-
detachStdout();
|
|
68
|
-
if (child.exitCode === null && child.signalCode === null) {
|
|
69
|
-
child.kill("SIGTERM");
|
|
70
|
-
await new Promise((resolve) => {
|
|
71
|
-
const timer = setTimeout(() => {
|
|
72
|
-
if (child.exitCode === null && child.signalCode === null) {
|
|
73
|
-
child.kill("SIGKILL");
|
|
74
|
-
}
|
|
75
|
-
resolve();
|
|
76
|
-
}, killGraceMs);
|
|
77
|
-
child.once("exit", () => {
|
|
78
|
-
clearTimeout(timer);
|
|
79
|
-
resolve();
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
signal.addEventListener("abort", () => void dispose(), { once: true });
|
|
85
|
-
return {
|
|
86
|
-
handleLine(line) {
|
|
87
|
-
if (!disposed && stdin.writable) {
|
|
88
|
-
stdin.write(`${line}\n`);
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
dispose,
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
//# sourceMappingURL=neo-daemon-child-worker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"neo-daemon-child-worker.js","sourceRoot":"","sources":["../../../src/modes/rpc/neo-daemon-child-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAW3E;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAA4B;IACvE,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IACrD,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC;IAE/C,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,EAA4B,EAAE;QACjH,MAAM,WAAW,GAAG,0BAA0B,CAAC,cAAc,CAAC,CAAC;QAC/D,wEAAwE;QACxE,0EAA0E;QAC1E,2EAA2E;QAC3E,2EAA2E;QAC3E,MAAM,eAAe,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,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,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;gBAC1D,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBACtB,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;oBACnC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;wBAC7B,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;4BAC1D,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;wBACvB,CAAC;wBACD,OAAO,EAAE,CAAC;oBACX,CAAC,EAAE,WAAW,CAAC,CAAC;oBAChB,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE;wBACvB,YAAY,CAAC,KAAK,CAAC,CAAC;wBACpB,OAAO,EAAE,CAAC;oBACX,CAAC,CAAC,CAAC;gBACJ,CAAC,CAAC,CAAC;YACJ,CAAC;QACF,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAEvE,OAAO;YACN,UAAU,CAAC,IAAY;gBACtB,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;oBACjC,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;gBAC1B,CAAC;YACF,CAAC;YACD,OAAO;SACP,CAAC;IACH,CAAC,CAAC;AACH,CAAC","sourcesContent":["/**\n * Production worker factory for the neo daemon: one child `senpi --mode rpc`\n * process per connection.\n *\n * Each child is a standard single-connection rpc runtime with its own module\n * state and its own AuthStorage, so a connection's `--api-key` (passed as argv)\n * lives only in that child — the auth-isolation guarantee is structural. The\n * connection socket is bridged to the child's stdio: client lines → child stdin,\n * child stdout → client socket. On dispose the child is aborted (SIGTERM, then\n * SIGKILL after a grace period).\n */\n\nimport { type ChildProcess, spawn } from \"node:child_process\";\nimport { RPC_CLIENT_CAPABILITIES_ENV } from \"./custom-capability.ts\";\nimport { attachJsonlLineReader } from \"./jsonl.ts\";\nimport type { NeoDaemonWorker, NeoDaemonWorkerFactory } from \"./neo-daemon-mode.ts\";\nimport { neoRuntimeOptionsToRpcArgv } from \"./neo-runtime-options-argv.ts\";\n\nexport interface NeoChildWorkerConfig {\n\t/** Executable to run (default: the current node binary). */\n\treadonly execPath?: string;\n\t/** Fixed leading args before the runtime argv (e.g. [cliEntryPath]). */\n\treadonly baseArgs: readonly string[];\n\t/** Grace period before SIGKILL after SIGTERM, in ms. */\n\treadonly killGraceMs?: number;\n}\n\n/**\n * Build a worker factory that spawns child rpc processes.\n *\n * `baseArgs` should locate the CLI entry, e.g. `[join(distDir, \"rpc-entry.js\")]`\n * or `[tsxLoader, cliEntry]` in dev. The connection's runtimeOptions are\n * appended as classic argv (see neoRuntimeOptionsToRpcArgv).\n */\nexport function createNeoChildWorkerFactory(config: NeoChildWorkerConfig): NeoDaemonWorkerFactory {\n\tconst execPath = config.execPath ?? process.execPath;\n\tconst killGraceMs = config.killGraceMs ?? 3000;\n\n\treturn async ({ runtimeOptions, capabilities, cwd, agentDir, writeToClient, signal }): Promise<NeoDaemonWorker> => {\n\t\tconst runtimeArgv = neoRuntimeOptionsToRpcArgv(runtimeOptions);\n\t\t// The handshake's client capabilities are additive per-connection flags\n\t\t// (e.g. custom_unsupported opt-in). Forward them to the child rpc process\n\t\t// via an env var — argv carries runtime construction only, and the child's\n\t\t// rpc-mode reads this to gate additive UI behavior. Empty = default child.\n\t\tconst capabilitiesEnv = capabilities.length > 0 ? { [RPC_CLIENT_CAPABILITIES_ENV]: capabilities.join(\",\") } : {};\n\t\t// neoRuntimeOptionsToRpcArgv already prepends [\"--mode\",\"rpc\"]; strip it if\n\t\t// baseArgs points at rpc-entry (which injects --mode rpc itself). We keep it\n\t\t// simple and always pass through cli-main-style args; rpc-entry tolerates a\n\t\t// duplicate --mode rpc because parseArgs takes the last one.\n\t\tconst child: ChildProcess = spawn(execPath, [...config.baseArgs, ...runtimeArgv], {\n\t\t\tcwd,\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\tSENPI_CODING_AGENT_DIR: agentDir,\n\t\t\t\t...capabilitiesEnv,\n\t\t\t},\n\t\t\tstdio: [\"pipe\", \"pipe\", \"pipe\"],\n\t\t});\n\n\t\tconst stdout = child.stdout;\n\t\tconst stdin = child.stdin;\n\t\tif (!stdout || !stdin) {\n\t\t\tchild.kill(\"SIGKILL\");\n\t\t\tthrow new Error(\"Failed to open child worker stdio\");\n\t\t}\n\n\t\t// Child stdout (JSONL) → client socket, line-framed so partial chunks never\n\t\t// split a record across the socket boundary.\n\t\tconst detachStdout = attachJsonlLineReader(stdout, (line) => {\n\t\t\twriteToClient(`${line}\\n`);\n\t\t});\n\n\t\t// Surface child stderr as a diagnostic event line without leaking secrets:\n\t\t// stderr is forwarded verbatim only in dev builds; here it is dropped to\n\t\t// avoid mixing non-JSONL bytes into the client stream. Errors that matter\n\t\t// arrive as rpc error responses on stdout.\n\t\tchild.stderr?.resume();\n\n\t\tlet disposed = false;\n\t\tconst dispose = async (): Promise<void> => {\n\t\t\tif (disposed) return;\n\t\t\tdisposed = true;\n\t\t\tdetachStdout();\n\t\t\tif (child.exitCode === null && child.signalCode === null) {\n\t\t\t\tchild.kill(\"SIGTERM\");\n\t\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\t\tconst timer = setTimeout(() => {\n\t\t\t\t\t\tif (child.exitCode === null && child.signalCode === null) {\n\t\t\t\t\t\t\tchild.kill(\"SIGKILL\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t}, killGraceMs);\n\t\t\t\t\tchild.once(\"exit\", () => {\n\t\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\tsignal.addEventListener(\"abort\", () => void dispose(), { once: true });\n\n\t\treturn {\n\t\t\thandleLine(line: string): void {\n\t\t\t\tif (!disposed && stdin.writable) {\n\t\t\t\t\tstdin.write(`${line}\\n`);\n\t\t\t\t}\n\t\t\t},\n\t\t\tdispose,\n\t\t};\n\t};\n}\n"]}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Neo daemon mode: a JSONL-over-socket server that serves N neo clients sharing
|
|
3
|
-
* one cwd, each with its own runtime.
|
|
4
|
-
*
|
|
5
|
-
* ISOLATION MODEL (see task-15 spike, evidence/task-15-neo-go-tui.md §1):
|
|
6
|
-
* running N `createAgentSessionRuntime` instances concurrently in a SINGLE node
|
|
7
|
-
* process is NOT safe — pi-ai's process-global provider registry
|
|
8
|
-
* (`resetApiProviders`) and pi-agent-core's module-level UUIDv7 counter cause
|
|
9
|
-
* cross-talk, and both are out of scope to change. The daemon therefore uses the
|
|
10
|
-
* plan's documented contingency: the daemon process is a SUPERVISOR that runs
|
|
11
|
-
* ONE worker (its own child process) per connection. Each worker is a standard,
|
|
12
|
-
* already-proven single-connection `runRpcMode` runtime with its own module
|
|
13
|
-
* state and its own AuthStorage, so a connection's `--api-key` can never leak
|
|
14
|
-
* into another connection. Concurrency is real (separate processes).
|
|
15
|
-
*
|
|
16
|
-
* The worker factory is injectable so tests can drive the supervisor
|
|
17
|
-
* deterministically (handshake, registry, idle) without spawning real children,
|
|
18
|
-
* while production spawns `node <cli> --mode rpc` per connection.
|
|
19
|
-
*
|
|
20
|
-
* REGISTRY/RACE: the daemon binds the socket FIRST (bind is the mutex — the race
|
|
21
|
-
* loser gets EADDRINUSE and the client attaches to the winner), THEN atomically
|
|
22
|
-
* self-registers as the LAST listen step. Clients never write the registry.
|
|
23
|
-
*
|
|
24
|
-
* CONNECTION LIFECYCLE: a socket disconnect aborts that connection's in-flight
|
|
25
|
-
* turn and disposes its worker; sessions persist incrementally to disk so
|
|
26
|
-
* recovery is resume-from-file. Idle shutdown fires after a configurable
|
|
27
|
-
* no-connection period.
|
|
28
|
-
*/
|
|
29
|
-
import { type NeoHelloMessage } from "./neo-daemon-protocol.ts";
|
|
30
|
-
import type { NeoRuntimeOptions } from "./neo-runtime-options.ts";
|
|
31
|
-
/** A live worker serving exactly one connection. */
|
|
32
|
-
export interface NeoDaemonWorker {
|
|
33
|
-
/** Feed one inbound JSONL line from the client to the worker. */
|
|
34
|
-
handleLine(line: string): void;
|
|
35
|
-
/** Called when the connection drops; abort the in-flight turn and dispose. */
|
|
36
|
-
dispose(): Promise<void>;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Build a worker for one accepted connection. `writeToClient` sends a
|
|
40
|
-
* (LF-terminated) JSONL line back to the client. `runtimeOptions` are the
|
|
41
|
-
* per-connection options from the handshake. `signal` aborts when the
|
|
42
|
-
* connection drops or the daemon shuts down.
|
|
43
|
-
*/
|
|
44
|
-
export type NeoDaemonWorkerFactory = (args: {
|
|
45
|
-
readonly runtimeOptions: NeoRuntimeOptions;
|
|
46
|
-
readonly capabilities: readonly string[];
|
|
47
|
-
readonly cwd: string;
|
|
48
|
-
readonly agentDir: string;
|
|
49
|
-
readonly writeToClient: (line: string) => void;
|
|
50
|
-
readonly signal: AbortSignal;
|
|
51
|
-
}) => Promise<NeoDaemonWorker>;
|
|
52
|
-
/** Minimal injectable clock so idle-shutdown timing is testable. */
|
|
53
|
-
export interface NeoDaemonClock {
|
|
54
|
-
setTimeout(handler: () => void, ms: number): unknown;
|
|
55
|
-
clearTimeout(handle: unknown): void;
|
|
56
|
-
}
|
|
57
|
-
export interface NeoDaemonOptions {
|
|
58
|
-
/** Unix socket path (POSIX) or named-pipe path (Windows) to bind. */
|
|
59
|
-
readonly listenPath: string;
|
|
60
|
-
/** Absolute cwd this daemon serves. */
|
|
61
|
-
readonly cwd: string;
|
|
62
|
-
/** Agent dir (holds the registry). */
|
|
63
|
-
readonly agentDir: string;
|
|
64
|
-
/** Self-register into the registry as the last listen step. Default true. */
|
|
65
|
-
readonly register?: boolean;
|
|
66
|
-
/** Idle shutdown period in ms; 0 disables. Default 30 min (caller supplies). */
|
|
67
|
-
readonly idleShutdownMs: number;
|
|
68
|
-
/**
|
|
69
|
-
* Registry self-heal interval in ms; 0 disables the recurring re-assert (the
|
|
70
|
-
* on-accept re-assert still runs). The daemon periodically re-writes its own
|
|
71
|
-
* registry record if it went missing/corrupt, so a lost record repairs itself
|
|
72
|
-
* even before the next connection. Default 2000ms (caller may override).
|
|
73
|
-
*/
|
|
74
|
-
readonly selfHealIntervalMs?: number;
|
|
75
|
-
/** Handshake token clients must present. */
|
|
76
|
-
readonly token: string;
|
|
77
|
-
/** Protocol version this daemon speaks. Default NEO_DAEMON_PROTOCOL_VERSION. */
|
|
78
|
-
readonly version?: number;
|
|
79
|
-
/** Worker factory (injected in tests; production spawns a child process). */
|
|
80
|
-
readonly workerFactory: NeoDaemonWorkerFactory;
|
|
81
|
-
/** Injectable clock for idle-shutdown timing. */
|
|
82
|
-
readonly clock?: NeoDaemonClock;
|
|
83
|
-
/**
|
|
84
|
-
* Validate connection runtimeOptions; return a human reason to refuse, or
|
|
85
|
-
* undefined to accept. Lets the host reject options it cannot honor.
|
|
86
|
-
*/
|
|
87
|
-
readonly validateRuntimeOptions?: (options: NeoRuntimeOptions) => string | undefined;
|
|
88
|
-
}
|
|
89
|
-
export interface NeoDaemonHandle {
|
|
90
|
-
/** The bound socket path. */
|
|
91
|
-
readonly listenPath: string;
|
|
92
|
-
/** Resolves when the daemon has fully shut down. */
|
|
93
|
-
readonly closed: Promise<void>;
|
|
94
|
-
/** Current live connection count (for tests/observability). */
|
|
95
|
-
connectionCount(): number;
|
|
96
|
-
/** Trigger a graceful shutdown. */
|
|
97
|
-
shutdown(): Promise<void>;
|
|
98
|
-
}
|
|
99
|
-
/** Raised when the socket path is already bound (a daemon already won the race). */
|
|
100
|
-
export declare class NeoDaemonAddressInUseError extends Error {
|
|
101
|
-
constructor(listenPath: string);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Start the neo daemon. Binds the socket (throws {@link NeoDaemonAddressInUseError}
|
|
105
|
-
* if the race is lost), registers, and serves connections until idle-shutdown or
|
|
106
|
-
* an explicit `shutdown()`.
|
|
107
|
-
*/
|
|
108
|
-
export declare function runNeoDaemon(options: NeoDaemonOptions): Promise<NeoDaemonHandle>;
|
|
109
|
-
export type { NeoHelloMessage };
|
|
110
|
-
//# sourceMappingURL=neo-daemon-mode.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"neo-daemon-mode.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/neo-daemon-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,EAEN,KAAK,eAAe,EAGpB,MAAM,0BAA0B,CAAC;AAUlC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,oDAAoD;AACpD,MAAM,WAAW,eAAe;IAC/B,iEAAiE;IACjE,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,8EAA8E;IAC9E,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAED;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE;IAC3C,QAAQ,CAAC,cAAc,EAAE,iBAAiB,CAAC;IAC3C,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC7B,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;AAE/B,oEAAoE;AACpE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