@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,209 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Neo daemon registry: the on-disk record clients use to find a running daemon
|
|
3
|
-
* for a given cwd.
|
|
4
|
-
*
|
|
5
|
-
* Layout: `<agentDir>/neo-daemon/<cwd-key>.json`, mode 0600, containing
|
|
6
|
-
* `{ version, socket, pid, token }`. The daemon is the ONLY writer — clients
|
|
7
|
-
* only read. Writes are atomic (temp file + rename) so a client never observes a
|
|
8
|
-
* half-written record.
|
|
9
|
-
*
|
|
10
|
-
* `cwd-key` uses the same safe-path scheme as the session manager
|
|
11
|
-
* (session-manager.ts getDefaultSessionDirPath) so one cwd maps to exactly one
|
|
12
|
-
* daemon record.
|
|
13
|
-
*/
|
|
14
|
-
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
15
|
-
import { connect } from "node:net";
|
|
16
|
-
import { join } from "node:path";
|
|
17
|
-
import { resolvePath } from "../../utils/paths.js";
|
|
18
|
-
/** Bump when the wire protocol or handshake changes incompatibly. */
|
|
19
|
-
export const NEO_DAEMON_PROTOCOL_VERSION = 1;
|
|
20
|
-
/**
|
|
21
|
-
* Compute the safe registry-key for a cwd. Mirrors the session-manager
|
|
22
|
-
* safe-path scheme so both derive the same key from the same cwd.
|
|
23
|
-
*/
|
|
24
|
-
export function neoDaemonCwdKey(cwd) {
|
|
25
|
-
const resolvedCwd = resolvePath(cwd);
|
|
26
|
-
return `--${resolvedCwd.replace(/^[/\\]/, "").replace(/[/\\:]/g, "-")}--`;
|
|
27
|
-
}
|
|
28
|
-
/** Directory holding all neo daemon registry records. */
|
|
29
|
-
export function neoDaemonRegistryDir(agentDir) {
|
|
30
|
-
return join(agentDir, "neo-daemon");
|
|
31
|
-
}
|
|
32
|
-
/** Absolute path to the registry record for a cwd. */
|
|
33
|
-
export function neoDaemonRegistryPath(agentDir, cwd) {
|
|
34
|
-
return join(neoDaemonRegistryDir(agentDir), `${neoDaemonCwdKey(cwd)}.json`);
|
|
35
|
-
}
|
|
36
|
-
function isValidRecord(value) {
|
|
37
|
-
if (typeof value !== "object" || value === null)
|
|
38
|
-
return false;
|
|
39
|
-
const record = value;
|
|
40
|
-
return (typeof record.version === "number" &&
|
|
41
|
-
typeof record.socket === "string" &&
|
|
42
|
-
typeof record.pid === "number" &&
|
|
43
|
-
typeof record.token === "string");
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Read the registry record for a cwd. Returns undefined when the file is
|
|
47
|
-
* missing, unreadable, or malformed (all non-fatal — the caller then spawns).
|
|
48
|
-
*/
|
|
49
|
-
export function readNeoDaemonRecord(agentDir, cwd) {
|
|
50
|
-
const path = neoDaemonRegistryPath(agentDir, cwd);
|
|
51
|
-
let raw;
|
|
52
|
-
try {
|
|
53
|
-
raw = readFileSync(path, "utf8");
|
|
54
|
-
}
|
|
55
|
-
catch {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
let parsed;
|
|
59
|
-
try {
|
|
60
|
-
parsed = JSON.parse(raw);
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
return isValidRecord(parsed) ? parsed : undefined;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Atomically write the registry record (temp file + rename, mode 0600). The
|
|
69
|
-
* daemon calls this as the LAST listen step, after the socket is bound and
|
|
70
|
-
* listening.
|
|
71
|
-
*/
|
|
72
|
-
export function writeNeoDaemonRecord(agentDir, cwd, record) {
|
|
73
|
-
const dir = neoDaemonRegistryDir(agentDir);
|
|
74
|
-
mkdirSync(dir, { recursive: true });
|
|
75
|
-
const finalPath = neoDaemonRegistryPath(agentDir, cwd);
|
|
76
|
-
const tempPath = `${finalPath}.${process.pid}.${Date.now()}.tmp`;
|
|
77
|
-
writeFileSync(tempPath, JSON.stringify(record, null, 2), { mode: 0o600 });
|
|
78
|
-
renameSync(tempPath, finalPath);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Re-assert the daemon's own registry record iff it is missing or does not match
|
|
82
|
-
* this daemon (version/socket/pid/token). Returns true when a (re-)write happened.
|
|
83
|
-
*
|
|
84
|
-
* This is the self-heal that closes the "live daemon owns the deterministic
|
|
85
|
-
* socket, but its registry record was lost/corrupted (or a SIGKILL left it
|
|
86
|
-
* missing)" recovery wedge: a fresh client cannot bind a new daemon (the live one
|
|
87
|
-
* owns the socket) and, with no record, cannot find the live one either. The
|
|
88
|
-
* daemon calls this on every accepted connection and on a short recurring
|
|
89
|
-
* interval, so a lost record repairs itself inside the client's attach-poll
|
|
90
|
-
* window. It NEVER clobbers an already-correct record (idempotent, no write when
|
|
91
|
-
* the record already points at this daemon), and because there is exactly one
|
|
92
|
-
* daemon per cwd (the bind mutex), it can never fight another live daemon. The
|
|
93
|
-
* re-asserted record carries the daemon's real in-memory token, so token auth is
|
|
94
|
-
* preserved — the client authenticates with the healed token exactly as it would
|
|
95
|
-
* with the original.
|
|
96
|
-
*/
|
|
97
|
-
export function reassertNeoDaemonRecord(agentDir, cwd, record) {
|
|
98
|
-
const existing = readNeoDaemonRecord(agentDir, cwd);
|
|
99
|
-
if (existing &&
|
|
100
|
-
existing.version === record.version &&
|
|
101
|
-
existing.socket === record.socket &&
|
|
102
|
-
existing.pid === record.pid &&
|
|
103
|
-
existing.token === record.token) {
|
|
104
|
-
return false; // already correct — do not fight a valid record
|
|
105
|
-
}
|
|
106
|
-
writeNeoDaemonRecord(agentDir, cwd, record);
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
/** Remove the registry record for a cwd (best-effort; missing is fine). */
|
|
110
|
-
export function removeNeoDaemonRecord(agentDir, cwd) {
|
|
111
|
-
const path = neoDaemonRegistryPath(agentDir, cwd);
|
|
112
|
-
try {
|
|
113
|
-
unlinkSync(path);
|
|
114
|
-
}
|
|
115
|
-
catch {
|
|
116
|
-
// already gone
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Whether a pid is alive. `process.kill(pid, 0)` throws ESRCH for a dead pid and
|
|
121
|
-
* EPERM for a live pid we cannot signal (which still means "alive").
|
|
122
|
-
*/
|
|
123
|
-
export function isPidAlive(pid) {
|
|
124
|
-
if (!Number.isInteger(pid) || pid <= 0)
|
|
125
|
-
return false;
|
|
126
|
-
try {
|
|
127
|
-
process.kill(pid, 0);
|
|
128
|
-
return true;
|
|
129
|
-
}
|
|
130
|
-
catch (error) {
|
|
131
|
-
const code = error.code;
|
|
132
|
-
return code === "EPERM";
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Clean up a stale record + its socket file for a cwd BEFORE a fresh daemon
|
|
137
|
-
* binds. A record is stale when its pid is dead. Returns true when something was
|
|
138
|
-
* cleaned. The bound socket path is unlinked so the fresh bind does not hit a
|
|
139
|
-
* leftover socket file.
|
|
140
|
-
*/
|
|
141
|
-
export function cleanupStaleNeoDaemon(agentDir, cwd) {
|
|
142
|
-
const record = readNeoDaemonRecord(agentDir, cwd);
|
|
143
|
-
if (!record) {
|
|
144
|
-
// No record: still unlink a dangling socket path if the caller left one.
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
if (isPidAlive(record.pid)) {
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
// Stale: remove the socket file and the record.
|
|
151
|
-
if (record.socket && existsSync(record.socket)) {
|
|
152
|
-
try {
|
|
153
|
-
rmSync(record.socket, { force: true });
|
|
154
|
-
}
|
|
155
|
-
catch {
|
|
156
|
-
// non-fatal
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
removeNeoDaemonRecord(agentDir, cwd);
|
|
160
|
-
return true;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Reclaim a leftover unix-socket file at `listenPath` when NO live daemon is
|
|
164
|
-
* serving it, so a fresh bind() does not hit EADDRINUSE forever.
|
|
165
|
-
*
|
|
166
|
-
* This is the safety net that makes the DETERMINISTIC socket path safe: a daemon
|
|
167
|
-
* SIGKILLed without a clean shutdown leaves the socket file on disk with its
|
|
168
|
-
* registry record gone (so {@link cleanupStaleNeoDaemon}, which keys off the
|
|
169
|
-
* record, misses it). bind() on a leftover unix-socket file throws EADDRINUSE
|
|
170
|
-
* whether or not anyone is listening, so the fresh daemon must probe the path and
|
|
171
|
-
* unlink it when it is dead.
|
|
172
|
-
*
|
|
173
|
-
* A LIVE daemon serving the socket accepts a connection; we must NOT unlink that
|
|
174
|
-
* one — the caller then loses the bind race (EADDRINUSE) and attaches to the
|
|
175
|
-
* winner, which is the intended "bind is the mutex" outcome. We only unlink when
|
|
176
|
-
* connecting is refused/errors (a dead socket) or the path is a plain file.
|
|
177
|
-
*
|
|
178
|
-
* No-op on Windows named pipes (not filesystem paths; the OS reclaims a pipe when
|
|
179
|
-
* its owner dies) and when nothing exists at the path.
|
|
180
|
-
*/
|
|
181
|
-
export async function reclaimDeadSocketFile(listenPath) {
|
|
182
|
-
if (process.platform === "win32")
|
|
183
|
-
return;
|
|
184
|
-
if (!existsSync(listenPath))
|
|
185
|
-
return;
|
|
186
|
-
const alive = await isSocketServed(listenPath);
|
|
187
|
-
if (alive)
|
|
188
|
-
return; // a live daemon owns it — let the caller lose the bind race
|
|
189
|
-
try {
|
|
190
|
-
rmSync(listenPath, { force: true });
|
|
191
|
-
}
|
|
192
|
-
catch {
|
|
193
|
-
// non-fatal: bind will surface any real problem as EADDRINUSE/EACCES
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
/** Whether a unix socket at `path` currently accepts a connection (a live server). */
|
|
197
|
-
function isSocketServed(path) {
|
|
198
|
-
return new Promise((resolve) => {
|
|
199
|
-
const socket = connect(path);
|
|
200
|
-
const done = (alive) => {
|
|
201
|
-
socket.removeAllListeners();
|
|
202
|
-
socket.destroy();
|
|
203
|
-
resolve(alive);
|
|
204
|
-
};
|
|
205
|
-
socket.once("connect", () => done(true));
|
|
206
|
-
socket.once("error", () => done(false));
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
//# sourceMappingURL=neo-daemon-registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"neo-daemon-registry.js","sourceRoot":"","sources":["../../../src/modes/rpc/neo-daemon-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7G,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,qEAAqE;AACrE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAa7C;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IAC1C,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IACrC,OAAO,KAAK,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC;AAC3E,CAAC;AAED,yDAAyD;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AkBG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,UAAkB;IAC7D,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;QAAE,OAAO;IACzC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO;IACpC,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,UAAU,CAAC,CAAC;IAC/C,IAAI,KAAK;QAAE,OAAO,CAAC,4DAA4D;IAC/E,IAAI,CAAC;QACJ,MAAM,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACR,qEAAqE;IACtE,CAAC;AACF,CAAC;AAED,sFAAsF;AACtF,SAAS,cAAc,CAAC,IAAY;IACnC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC7B,MAAM,IAAI,GAAG,CAAC,KAAc,EAAQ,EAAE;YACrC,MAAM,CAAC,kBAAkB,EAAE,CAAC;YAC5B,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Neo daemon registry: the on-disk record clients use to find a running daemon\n * for a given cwd.\n *\n * Layout: `<agentDir>/neo-daemon/<cwd-key>.json`, mode 0600, containing\n * `{ version, socket, pid, token }`. The daemon is the ONLY writer — clients\n * only read. Writes are atomic (temp file + rename) so a client never observes a\n * half-written record.\n *\n * `cwd-key` uses the same safe-path scheme as the session manager\n * (session-manager.ts getDefaultSessionDirPath) so one cwd maps to exactly one\n * daemon record.\n */\n\nimport { existsSync, mkdirSync, readFileSync, renameSync, rmSync, unlinkSync, writeFileSync } from \"node:fs\";\nimport { connect } from \"node:net\";\nimport { join } from \"node:path\";\nimport { resolvePath } from \"../../utils/paths.ts\";\n\n/** Bump when the wire protocol or handshake changes incompatibly. */\nexport const NEO_DAEMON_PROTOCOL_VERSION = 1;\n\nexport interface NeoDaemonRecord {\n\t/** Protocol version the daemon speaks; clients refuse on mismatch. */\n\treadonly version: number;\n\t/** Absolute unix socket path (or Windows named-pipe path) the daemon listens on. */\n\treadonly socket: string;\n\t/** Daemon process id, used for stale-record detection. */\n\treadonly pid: number;\n\t/** Handshake token; a client must present it in `hello`. */\n\treadonly token: string;\n}\n\n/**\n * Compute the safe registry-key for a cwd. Mirrors the session-manager\n * safe-path scheme so both derive the same key from the same cwd.\n */\nexport function neoDaemonCwdKey(cwd: string): string {\n\tconst resolvedCwd = resolvePath(cwd);\n\treturn `--${resolvedCwd.replace(/^[/\\\\]/, \"\").replace(/[/\\\\:]/g, \"-\")}--`;\n}\n\n/** Directory holding all neo daemon registry records. */\nexport function neoDaemonRegistryDir(agentDir: string): string {\n\treturn join(agentDir, \"neo-daemon\");\n}\n\n/** Absolute path to the registry record for a cwd. */\nexport function neoDaemonRegistryPath(agentDir: string, cwd: string): string {\n\treturn join(neoDaemonRegistryDir(agentDir), `${neoDaemonCwdKey(cwd)}.json`);\n}\n\nfunction isValidRecord(value: unknown): value is NeoDaemonRecord {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst record = value as Record<string, unknown>;\n\treturn (\n\t\ttypeof record.version === \"number\" &&\n\t\ttypeof record.socket === \"string\" &&\n\t\ttypeof record.pid === \"number\" &&\n\t\ttypeof record.token === \"string\"\n\t);\n}\n\n/**\n * Read the registry record for a cwd. Returns undefined when the file is\n * missing, unreadable, or malformed (all non-fatal — the caller then spawns).\n */\nexport function readNeoDaemonRecord(agentDir: string, cwd: string): NeoDaemonRecord | undefined {\n\tconst path = neoDaemonRegistryPath(agentDir, cwd);\n\tlet raw: string;\n\ttry {\n\t\traw = readFileSync(path, \"utf8\");\n\t} catch {\n\t\treturn undefined;\n\t}\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch {\n\t\treturn undefined;\n\t}\n\treturn isValidRecord(parsed) ? parsed : undefined;\n}\n\n/**\n * Atomically write the registry record (temp file + rename, mode 0600). The\n * daemon calls this as the LAST listen step, after the socket is bound and\n * listening.\n */\nexport function writeNeoDaemonRecord(agentDir: string, cwd: string, record: NeoDaemonRecord): void {\n\tconst dir = neoDaemonRegistryDir(agentDir);\n\tmkdirSync(dir, { recursive: true });\n\tconst finalPath = neoDaemonRegistryPath(agentDir, cwd);\n\tconst tempPath = `${finalPath}.${process.pid}.${Date.now()}.tmp`;\n\twriteFileSync(tempPath, JSON.stringify(record, null, 2), { mode: 0o600 });\n\trenameSync(tempPath, finalPath);\n}\n\n/**\n * Re-assert the daemon's own registry record iff it is missing or does not match\n * this daemon (version/socket/pid/token). Returns true when a (re-)write happened.\n *\n * This is the self-heal that closes the \"live daemon owns the deterministic\n * socket, but its registry record was lost/corrupted (or a SIGKILL left it\n * missing)\" recovery wedge: a fresh client cannot bind a new daemon (the live one\n * owns the socket) and, with no record, cannot find the live one either. The\n * daemon calls this on every accepted connection and on a short recurring\n * interval, so a lost record repairs itself inside the client's attach-poll\n * window. It NEVER clobbers an already-correct record (idempotent, no write when\n * the record already points at this daemon), and because there is exactly one\n * daemon per cwd (the bind mutex), it can never fight another live daemon. The\n * re-asserted record carries the daemon's real in-memory token, so token auth is\n * preserved — the client authenticates with the healed token exactly as it would\n * with the original.\n */\nexport function reassertNeoDaemonRecord(agentDir: string, cwd: string, record: NeoDaemonRecord): boolean {\n\tconst existing = readNeoDaemonRecord(agentDir, cwd);\n\tif (\n\t\texisting &&\n\t\texisting.version === record.version &&\n\t\texisting.socket === record.socket &&\n\t\texisting.pid === record.pid &&\n\t\texisting.token === record.token\n\t) {\n\t\treturn false; // already correct — do not fight a valid record\n\t}\n\twriteNeoDaemonRecord(agentDir, cwd, record);\n\treturn true;\n}\n\n/** Remove the registry record for a cwd (best-effort; missing is fine). */\nexport function removeNeoDaemonRecord(agentDir: string, cwd: string): void {\n\tconst path = neoDaemonRegistryPath(agentDir, cwd);\n\ttry {\n\t\tunlinkSync(path);\n\t} catch {\n\t\t// already gone\n\t}\n}\n\n/**\n * Whether a pid is alive. `process.kill(pid, 0)` throws ESRCH for a dead pid and\n * EPERM for a live pid we cannot signal (which still means \"alive\").\n */\nexport function isPidAlive(pid: number): boolean {\n\tif (!Number.isInteger(pid) || pid <= 0) return false;\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\tconst code = (error as NodeJS.ErrnoException).code;\n\t\treturn code === \"EPERM\";\n\t}\n}\n\n/**\n * Clean up a stale record + its socket file for a cwd BEFORE a fresh daemon\n * binds. A record is stale when its pid is dead. Returns true when something was\n * cleaned. The bound socket path is unlinked so the fresh bind does not hit a\n * leftover socket file.\n */\nexport function cleanupStaleNeoDaemon(agentDir: string, cwd: string): boolean {\n\tconst record = readNeoDaemonRecord(agentDir, cwd);\n\tif (!record) {\n\t\t// No record: still unlink a dangling socket path if the caller left one.\n\t\treturn false;\n\t}\n\tif (isPidAlive(record.pid)) {\n\t\treturn false;\n\t}\n\t// Stale: remove the socket file and the record.\n\tif (record.socket && existsSync(record.socket)) {\n\t\ttry {\n\t\t\trmSync(record.socket, { force: true });\n\t\t} catch {\n\t\t\t// non-fatal\n\t\t}\n\t}\n\tremoveNeoDaemonRecord(agentDir, cwd);\n\treturn true;\n}\n\n/**\n * Reclaim a leftover unix-socket file at `listenPath` when NO live daemon is\n * serving it, so a fresh bind() does not hit EADDRINUSE forever.\n *\n * This is the safety net that makes the DETERMINISTIC socket path safe: a daemon\n * SIGKILLed without a clean shutdown leaves the socket file on disk with its\n * registry record gone (so {@link cleanupStaleNeoDaemon}, which keys off the\n * record, misses it). bind() on a leftover unix-socket file throws EADDRINUSE\n * whether or not anyone is listening, so the fresh daemon must probe the path and\n * unlink it when it is dead.\n *\n * A LIVE daemon serving the socket accepts a connection; we must NOT unlink that\n * one — the caller then loses the bind race (EADDRINUSE) and attaches to the\n * winner, which is the intended \"bind is the mutex\" outcome. We only unlink when\n * connecting is refused/errors (a dead socket) or the path is a plain file.\n *\n * No-op on Windows named pipes (not filesystem paths; the OS reclaims a pipe when\n * its owner dies) and when nothing exists at the path.\n */\nexport async function reclaimDeadSocketFile(listenPath: string): Promise<void> {\n\tif (process.platform === \"win32\") return;\n\tif (!existsSync(listenPath)) return;\n\tconst alive = await isSocketServed(listenPath);\n\tif (alive) return; // a live daemon owns it — let the caller lose the bind race\n\ttry {\n\t\trmSync(listenPath, { force: true });\n\t} catch {\n\t\t// non-fatal: bind will surface any real problem as EADDRINUSE/EACCES\n\t}\n}\n\n/** Whether a unix socket at `path` currently accepts a connection (a live server). */\nfunction isSocketServed(path: string): Promise<boolean> {\n\treturn new Promise((resolve) => {\n\t\tconst socket = connect(path);\n\t\tconst done = (alive: boolean): void => {\n\t\t\tsocket.removeAllListeners();\n\t\t\tsocket.destroy();\n\t\t\tresolve(alive);\n\t\t};\n\t\tsocket.once(\"connect\", () => done(true));\n\t\tsocket.once(\"error\", () => done(false));\n\t});\n}\n"]}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert a NeoRuntimeOptions payload into the classic argv a child
|
|
3
|
-
* `senpi --mode rpc` worker consumes for runtime construction.
|
|
4
|
-
*
|
|
5
|
-
* This is the daemon-side inverse of cli/neo/build-argv.ts: the launcher turns
|
|
6
|
-
* classic argv into neo argv; here the daemon turns the connection's
|
|
7
|
-
* NeoRuntimeOptions back into classic runtime-construction argv for its worker
|
|
8
|
-
* process. Initial inputs (messages / fileArgs) are intentionally NOT emitted —
|
|
9
|
-
* an rpc worker does not consume them as an initial prompt. The plain positional
|
|
10
|
-
* `messages` text is delivered separately as a `prompt` command; launch-time
|
|
11
|
-
* @file expansion is not yet implemented, so `fileArgs` are surfaced as a
|
|
12
|
-
* one-line non-fatal notice in the Go TUI rather than expanded.
|
|
13
|
-
*/
|
|
14
|
-
import type { NeoRuntimeOptions } from "./neo-runtime-options.ts";
|
|
15
|
-
/** Build the classic runtime-construction argv for `senpi --mode rpc`. */
|
|
16
|
-
export declare function neoRuntimeOptionsToRpcArgv(options: NeoRuntimeOptions): string[];
|
|
17
|
-
//# sourceMappingURL=neo-runtime-options-argv.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"neo-runtime-options-argv.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/neo-runtime-options-argv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,0EAA0E;AAC1E,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,EAAE,CAmD/E"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert a NeoRuntimeOptions payload into the classic argv a child
|
|
3
|
-
* `senpi --mode rpc` worker consumes for runtime construction.
|
|
4
|
-
*
|
|
5
|
-
* This is the daemon-side inverse of cli/neo/build-argv.ts: the launcher turns
|
|
6
|
-
* classic argv into neo argv; here the daemon turns the connection's
|
|
7
|
-
* NeoRuntimeOptions back into classic runtime-construction argv for its worker
|
|
8
|
-
* process. Initial inputs (messages / fileArgs) are intentionally NOT emitted —
|
|
9
|
-
* an rpc worker does not consume them as an initial prompt. The plain positional
|
|
10
|
-
* `messages` text is delivered separately as a `prompt` command; launch-time
|
|
11
|
-
* @file expansion is not yet implemented, so `fileArgs` are surfaced as a
|
|
12
|
-
* one-line non-fatal notice in the Go TUI rather than expanded.
|
|
13
|
-
*/
|
|
14
|
-
/** Build the classic runtime-construction argv for `senpi --mode rpc`. */
|
|
15
|
-
export function neoRuntimeOptionsToRpcArgv(options) {
|
|
16
|
-
const argv = ["--mode", "rpc"];
|
|
17
|
-
pushValue(argv, "--provider", options.provider);
|
|
18
|
-
pushValue(argv, "--model", options.model);
|
|
19
|
-
pushValue(argv, "--models", options.models?.join(","));
|
|
20
|
-
pushValue(argv, "--thinking", options.thinking);
|
|
21
|
-
pushValue(argv, "--api-key", options.apiKey);
|
|
22
|
-
pushValue(argv, "--session", options.session);
|
|
23
|
-
pushValue(argv, "--session-id", options.sessionId);
|
|
24
|
-
pushValue(argv, "--session-dir", options.sessionDir);
|
|
25
|
-
pushValue(argv, "--fork", options.fork);
|
|
26
|
-
pushValue(argv, "--name", options.name);
|
|
27
|
-
pushFlag(argv, "--resume", options.resume);
|
|
28
|
-
pushFlag(argv, "--continue", options.continue);
|
|
29
|
-
pushFlag(argv, "--no-session", options.noSession);
|
|
30
|
-
if (options.projectTrustOverride === true) {
|
|
31
|
-
argv.push("--approve");
|
|
32
|
-
}
|
|
33
|
-
else if (options.projectTrustOverride === false) {
|
|
34
|
-
argv.push("--no-approve");
|
|
35
|
-
}
|
|
36
|
-
pushValue(argv, "--tools", options.tools?.join(","));
|
|
37
|
-
pushValue(argv, "--exclude-tools", options.excludeTools?.join(","));
|
|
38
|
-
pushFlag(argv, "--no-tools", options.noTools);
|
|
39
|
-
pushFlag(argv, "--no-builtin-tools", options.noBuiltinTools);
|
|
40
|
-
pushRepeated(argv, "--extension", options.extensions);
|
|
41
|
-
pushRepeated(argv, "--skill", options.skills);
|
|
42
|
-
pushRepeated(argv, "--prompt-template", options.promptTemplates);
|
|
43
|
-
pushRepeated(argv, "--theme", options.themes);
|
|
44
|
-
pushFlag(argv, "--no-extensions", options.noExtensions);
|
|
45
|
-
pushFlag(argv, "--no-skills", options.noSkills);
|
|
46
|
-
pushFlag(argv, "--no-prompt-templates", options.noPromptTemplates);
|
|
47
|
-
pushFlag(argv, "--no-themes", options.noThemes);
|
|
48
|
-
pushFlag(argv, "--no-context-files", options.noContextFiles);
|
|
49
|
-
// Extension (unknown) flags: `--<name>` for boolean-true, `--<name> <value>` otherwise.
|
|
50
|
-
if (options.unknownFlags) {
|
|
51
|
-
for (const [name, value] of Object.entries(options.unknownFlags)) {
|
|
52
|
-
if (value === true) {
|
|
53
|
-
argv.push(`--${name}`);
|
|
54
|
-
}
|
|
55
|
-
else if (value !== false) {
|
|
56
|
-
argv.push(`--${name}`, String(value));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return argv;
|
|
61
|
-
}
|
|
62
|
-
function pushValue(argv, flag, value) {
|
|
63
|
-
if (value !== undefined) {
|
|
64
|
-
argv.push(flag, value);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function pushFlag(argv, flag, value) {
|
|
68
|
-
if (value === true) {
|
|
69
|
-
argv.push(flag);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function pushRepeated(argv, flag, values) {
|
|
73
|
-
if (values === undefined)
|
|
74
|
-
return;
|
|
75
|
-
for (const value of values) {
|
|
76
|
-
argv.push(flag, value);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=neo-runtime-options-argv.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"neo-runtime-options-argv.js","sourceRoot":"","sources":["../../../src/modes/rpc/neo-runtime-options-argv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,0EAA0E;AAC1E,MAAM,UAAU,0BAA0B,CAAC,OAA0B;IACpE,MAAM,IAAI,GAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAEzC,SAAS,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChD,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1C,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC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AAC,CAAC;YACvC,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAED,SAAS,SAAS,CAAC,IAAc,EAAE,IAAY,EAAE,KAAyB;IACzE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACxB,CAAC;AACF,CAAC;AAED,SAAS,QAAQ,CAAC,IAAc,EAAE,IAAY,EAAE,KAA0B;IACzE,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACpB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;AACF,CAAC;AAED,SAAS,YAAY,CAAC,IAAc,EAAE,IAAY,EAAE,MAAqC;IACxF,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO;IACjC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACxB,CAAC;AACF,CAAC","sourcesContent":["/**\n * Convert a NeoRuntimeOptions payload into the classic argv a child\n * `senpi --mode rpc` worker consumes for runtime construction.\n *\n * This is the daemon-side inverse of cli/neo/build-argv.ts: the launcher turns\n * classic argv into neo argv; here the daemon turns the connection's\n * NeoRuntimeOptions back into classic runtime-construction argv for its worker\n * process. Initial inputs (messages / fileArgs) are intentionally NOT emitted —\n * an rpc worker does not consume them as an initial prompt. The plain positional\n * `messages` text is delivered separately as a `prompt` command; launch-time\n * @file expansion is not yet implemented, so `fileArgs` are surfaced as a\n * one-line non-fatal notice in the Go TUI rather than expanded.\n */\n\nimport type { NeoRuntimeOptions } from \"./neo-runtime-options.ts\";\n\n/** Build the classic runtime-construction argv for `senpi --mode rpc`. */\nexport function neoRuntimeOptionsToRpcArgv(options: NeoRuntimeOptions): string[] {\n\tconst argv: string[] = [\"--mode\", \"rpc\"];\n\n\tpushValue(argv, \"--provider\", options.provider);\n\tpushValue(argv, \"--model\", options.model);\n\tpushValue(argv, \"--models\", options.models?.join(\",\"));\n\tpushValue(argv, \"--thinking\", options.thinking);\n\tpushValue(argv, \"--api-key\", options.apiKey);\n\n\tpushValue(argv, \"--session\", options.session);\n\tpushValue(argv, \"--session-id\", options.sessionId);\n\tpushValue(argv, \"--session-dir\", options.sessionDir);\n\tpushValue(argv, \"--fork\", options.fork);\n\tpushValue(argv, \"--name\", options.name);\n\tpushFlag(argv, \"--resume\", options.resume);\n\tpushFlag(argv, \"--continue\", options.continue);\n\tpushFlag(argv, \"--no-session\", options.noSession);\n\n\tif (options.projectTrustOverride === true) {\n\t\targv.push(\"--approve\");\n\t} else if (options.projectTrustOverride === false) {\n\t\targv.push(\"--no-approve\");\n\t}\n\n\tpushValue(argv, \"--tools\", options.tools?.join(\",\"));\n\tpushValue(argv, \"--exclude-tools\", options.excludeTools?.join(\",\"));\n\tpushFlag(argv, \"--no-tools\", options.noTools);\n\tpushFlag(argv, \"--no-builtin-tools\", options.noBuiltinTools);\n\n\tpushRepeated(argv, \"--extension\", options.extensions);\n\tpushRepeated(argv, \"--skill\", options.skills);\n\tpushRepeated(argv, \"--prompt-template\", options.promptTemplates);\n\tpushRepeated(argv, \"--theme\", options.themes);\n\tpushFlag(argv, \"--no-extensions\", options.noExtensions);\n\tpushFlag(argv, \"--no-skills\", options.noSkills);\n\tpushFlag(argv, \"--no-prompt-templates\", options.noPromptTemplates);\n\tpushFlag(argv, \"--no-themes\", options.noThemes);\n\tpushFlag(argv, \"--no-context-files\", options.noContextFiles);\n\n\t// Extension (unknown) flags: `--<name>` for boolean-true, `--<name> <value>` otherwise.\n\tif (options.unknownFlags) {\n\t\tfor (const [name, value] of Object.entries(options.unknownFlags)) {\n\t\t\tif (value === true) {\n\t\t\t\targv.push(`--${name}`);\n\t\t\t} else if (value !== false) {\n\t\t\t\targv.push(`--${name}`, String(value));\n\t\t\t}\n\t\t}\n\t}\n\n\treturn argv;\n}\n\nfunction pushValue(argv: string[], flag: string, value: string | undefined): void {\n\tif (value !== undefined) {\n\t\targv.push(flag, value);\n\t}\n}\n\nfunction pushFlag(argv: string[], flag: string, value: boolean | undefined): void {\n\tif (value === true) {\n\t\targv.push(flag);\n\t}\n}\n\nfunction pushRepeated(argv: string[], flag: string, values: readonly string[] | undefined): void {\n\tif (values === undefined) return;\n\tfor (const value of values) {\n\t\targv.push(flag, value);\n\t}\n}\n"]}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NeoRuntimeOptions — the typed handshake payload a neo client sends so the
|
|
3
|
-
* daemon builds THAT connection's runtime exactly as the classic launcher would.
|
|
4
|
-
*
|
|
5
|
-
* Every field here corresponds to a `parsed.<field>` read in the classic
|
|
6
|
-
* runtime-construction path (main.ts). The neo launcher forwards the classic
|
|
7
|
-
* argv (see cli/neo/build-argv.ts); the daemon reconstructs a runtime from this
|
|
8
|
-
* payload per connection, so per-client startup flags survive daemon sharing.
|
|
9
|
-
*
|
|
10
|
-
* The mapping between classic parsed fields and this payload is captured by
|
|
11
|
-
* {@link NEO_RUNTIME_OPTION_SOURCE_FIELDS} and enforced by an extraction test
|
|
12
|
-
* (neo-runtime-options-extraction.test.ts): the test statically scans the
|
|
13
|
-
* runtime-construction path for `parsed.*` reads and fails if any runtime field
|
|
14
|
-
* is not represented here. It is therefore GENERATED FROM the source, never
|
|
15
|
-
* hand-maintained — a future consumer of a new parsed field fails the test until
|
|
16
|
-
* it is threaded through this payload.
|
|
17
|
-
*
|
|
18
|
-
* Documented carve-outs (fields the daemon deliberately does NOT accept because
|
|
19
|
-
* they are launcher fast-paths or resolve before the daemon is ever reached):
|
|
20
|
-
* see {@link NEO_RUNTIME_OPTION_CARVEOUT_FIELDS}.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* The typed per-connection runtime options.
|
|
24
|
-
*
|
|
25
|
-
* Values mirror the classic `Args` shape for the runtime-relevant subset. All
|
|
26
|
-
* fields are optional: an omitted field means "classic default" for that flag.
|
|
27
|
-
* Initial inputs (`messages`, `fileArgs`) are forwarded RAW. Launch-time
|
|
28
|
-
* @file/image expansion is NOT yet implemented daemon-side: only the plain
|
|
29
|
-
* positional `messages` text is delivered (as a `prompt` command); `fileArgs`
|
|
30
|
-
* surface a one-line non-fatal notice in the Go TUI instead of being expanded.
|
|
31
|
-
*/
|
|
32
|
-
export interface NeoRuntimeOptions {
|
|
33
|
-
readonly provider?: string;
|
|
34
|
-
readonly model?: string;
|
|
35
|
-
readonly models?: readonly string[];
|
|
36
|
-
readonly thinking?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Per-connection API key. Applied ONLY to this connection's own AuthStorage
|
|
39
|
-
* so one client's --api-key can never leak into another connection.
|
|
40
|
-
*/
|
|
41
|
-
readonly apiKey?: string;
|
|
42
|
-
readonly noSession?: boolean;
|
|
43
|
-
readonly session?: string;
|
|
44
|
-
readonly sessionId?: string;
|
|
45
|
-
readonly sessionDir?: string;
|
|
46
|
-
readonly fork?: string;
|
|
47
|
-
readonly name?: string;
|
|
48
|
-
readonly resume?: boolean;
|
|
49
|
-
readonly continue?: boolean;
|
|
50
|
-
readonly projectTrustOverride?: boolean;
|
|
51
|
-
readonly tools?: readonly string[];
|
|
52
|
-
readonly excludeTools?: readonly string[];
|
|
53
|
-
readonly noTools?: boolean;
|
|
54
|
-
readonly noBuiltinTools?: boolean;
|
|
55
|
-
readonly extensions?: readonly string[];
|
|
56
|
-
readonly skills?: readonly string[];
|
|
57
|
-
readonly promptTemplates?: readonly string[];
|
|
58
|
-
readonly themes?: readonly string[];
|
|
59
|
-
readonly noExtensions?: boolean;
|
|
60
|
-
readonly noSkills?: boolean;
|
|
61
|
-
readonly noPromptTemplates?: boolean;
|
|
62
|
-
readonly noThemes?: boolean;
|
|
63
|
-
readonly noContextFiles?: boolean;
|
|
64
|
-
/** Unknown flags (extension flags): name -> value. */
|
|
65
|
-
readonly unknownFlags?: Readonly<Record<string, boolean | string>>;
|
|
66
|
-
readonly messages?: readonly string[];
|
|
67
|
-
readonly fileArgs?: readonly string[];
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Every classic `parsed.<field>` the runtime-construction path reads that MUST
|
|
71
|
-
* be represented in {@link NeoRuntimeOptions}. This is the contract the
|
|
72
|
-
* extraction test enforces against the actual source.
|
|
73
|
-
*
|
|
74
|
-
* Keep this in `parsed`-field spelling (the classic Args key), because that is
|
|
75
|
-
* what the extraction test scans for in main.ts.
|
|
76
|
-
*/
|
|
77
|
-
export declare const NEO_RUNTIME_OPTION_SOURCE_FIELDS: readonly ["provider", "model", "models", "thinking", "apiKey", "noSession", "session", "sessionId", "sessionDir", "fork", "name", "resume", "continue", "projectTrustOverride", "tools", "excludeTools", "noTools", "noBuiltinTools", "extensions", "skills", "promptTemplates", "themes", "noExtensions", "noSkills", "noPromptTemplates", "noThemes", "noContextFiles", "unknownFlags", "messages", "fileArgs"];
|
|
78
|
-
/**
|
|
79
|
-
* Classic `parsed.*` fields the runtime path reads that the daemon deliberately
|
|
80
|
-
* does NOT accept in the handshake, each with the reason it resolves before the
|
|
81
|
-
* daemon or is intentionally launcher-local. The extraction test allows these.
|
|
82
|
-
*/
|
|
83
|
-
export declare const NEO_RUNTIME_OPTION_CARVEOUT_FIELDS: Readonly<Record<string, string>>;
|
|
84
|
-
//# sourceMappingURL=neo-runtime-options.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"neo-runtime-options.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/neo-runtime-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAEjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,QAAQ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AQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAElC,sDAAsD;IACtD,QAAQ,CAAC,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC;IAGnE,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC,mZA+B2B,CAAC;AAEzE;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAwBtE,CAAC"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NeoRuntimeOptions — the typed handshake payload a neo client sends so the
|
|
3
|
-
* daemon builds THAT connection's runtime exactly as the classic launcher would.
|
|
4
|
-
*
|
|
5
|
-
* Every field here corresponds to a `parsed.<field>` read in the classic
|
|
6
|
-
* runtime-construction path (main.ts). The neo launcher forwards the classic
|
|
7
|
-
* argv (see cli/neo/build-argv.ts); the daemon reconstructs a runtime from this
|
|
8
|
-
* payload per connection, so per-client startup flags survive daemon sharing.
|
|
9
|
-
*
|
|
10
|
-
* The mapping between classic parsed fields and this payload is captured by
|
|
11
|
-
* {@link NEO_RUNTIME_OPTION_SOURCE_FIELDS} and enforced by an extraction test
|
|
12
|
-
* (neo-runtime-options-extraction.test.ts): the test statically scans the
|
|
13
|
-
* runtime-construction path for `parsed.*` reads and fails if any runtime field
|
|
14
|
-
* is not represented here. It is therefore GENERATED FROM the source, never
|
|
15
|
-
* hand-maintained — a future consumer of a new parsed field fails the test until
|
|
16
|
-
* it is threaded through this payload.
|
|
17
|
-
*
|
|
18
|
-
* Documented carve-outs (fields the daemon deliberately does NOT accept because
|
|
19
|
-
* they are launcher fast-paths or resolve before the daemon is ever reached):
|
|
20
|
-
* see {@link NEO_RUNTIME_OPTION_CARVEOUT_FIELDS}.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Every classic `parsed.<field>` the runtime-construction path reads that MUST
|
|
24
|
-
* be represented in {@link NeoRuntimeOptions}. This is the contract the
|
|
25
|
-
* extraction test enforces against the actual source.
|
|
26
|
-
*
|
|
27
|
-
* Keep this in `parsed`-field spelling (the classic Args key), because that is
|
|
28
|
-
* what the extraction test scans for in main.ts.
|
|
29
|
-
*/
|
|
30
|
-
export const NEO_RUNTIME_OPTION_SOURCE_FIELDS = [
|
|
31
|
-
"provider",
|
|
32
|
-
"model",
|
|
33
|
-
"models",
|
|
34
|
-
"thinking",
|
|
35
|
-
"apiKey",
|
|
36
|
-
"noSession",
|
|
37
|
-
"session",
|
|
38
|
-
"sessionId",
|
|
39
|
-
"sessionDir",
|
|
40
|
-
"fork",
|
|
41
|
-
"name",
|
|
42
|
-
"resume",
|
|
43
|
-
"continue",
|
|
44
|
-
"projectTrustOverride",
|
|
45
|
-
"tools",
|
|
46
|
-
"excludeTools",
|
|
47
|
-
"noTools",
|
|
48
|
-
"noBuiltinTools",
|
|
49
|
-
"extensions",
|
|
50
|
-
"skills",
|
|
51
|
-
"promptTemplates",
|
|
52
|
-
"themes",
|
|
53
|
-
"noExtensions",
|
|
54
|
-
"noSkills",
|
|
55
|
-
"noPromptTemplates",
|
|
56
|
-
"noThemes",
|
|
57
|
-
"noContextFiles",
|
|
58
|
-
"unknownFlags",
|
|
59
|
-
"messages",
|
|
60
|
-
"fileArgs",
|
|
61
|
-
];
|
|
62
|
-
/**
|
|
63
|
-
* Classic `parsed.*` fields the runtime path reads that the daemon deliberately
|
|
64
|
-
* does NOT accept in the handshake, each with the reason it resolves before the
|
|
65
|
-
* daemon or is intentionally launcher-local. The extraction test allows these.
|
|
66
|
-
*/
|
|
67
|
-
export const NEO_RUNTIME_OPTION_CARVEOUT_FIELDS = {
|
|
68
|
-
// Launcher fast-paths: handled and exited before any runtime is constructed.
|
|
69
|
-
help: "classic --help fast-path; never reaches the daemon",
|
|
70
|
-
version: "classic --version fast-path; never reaches the daemon",
|
|
71
|
-
export: "classic --export fast-path; never reaches the daemon",
|
|
72
|
-
listModels: "classic --list-models fast-path; never reaches the daemon",
|
|
73
|
-
// Mode / dispatch: the daemon path is chosen by the launcher, not forwarded.
|
|
74
|
-
mode: "output mode dispatch; the daemon always speaks rpc over the socket",
|
|
75
|
-
print: "print-mode dispatch; TTY-less --neo falls back to classic print in the launcher",
|
|
76
|
-
neo: "the --neo flag itself; consumed by the launcher to choose the neo path",
|
|
77
|
-
multiSession: "RPC-host process flag; neo daemon workers always use classic per-connection RPC",
|
|
78
|
-
// Diagnostics are produced by the parser, not a runtime input.
|
|
79
|
-
diagnostics: "parser-produced diagnostics; not a runtime construction input",
|
|
80
|
-
// Neo launcher-local flags never forwarded to the daemon runtime.
|
|
81
|
-
neoIsolated: "launcher-local: selects isolated transport, not a runtime input",
|
|
82
|
-
neoBin: "launcher-local: dev binary override, not a runtime input",
|
|
83
|
-
// Neo daemon supervisor flags: consumed by the daemon launcher, never a
|
|
84
|
-
// per-connection runtime input (each connection's runtime comes from the
|
|
85
|
-
// handshake NeoRuntimeOptions, not the daemon's own argv).
|
|
86
|
-
neoListen: "daemon-supervisor: socket path to bind; not a per-connection runtime input",
|
|
87
|
-
neoRegister: "daemon-supervisor: self-register flag; not a per-connection runtime input",
|
|
88
|
-
// Verbose controls classic startup logging / InteractiveMode; neo renders its
|
|
89
|
-
// own UI and does not consume classic verbose startup output.
|
|
90
|
-
verbose: "classic InteractiveMode/startup verbosity; neo renders its own UI",
|
|
91
|
-
};
|
|
92
|
-
//# sourceMappingURL=neo-runtime-options.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"neo-runtime-options.js","sourceRoot":"","sources":["../../../src/modes/rpc/neo-runtime-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA8DH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC/C,UAAU;IACV,OAAO;IACP,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,WAAW;IACX,SAAS;IACT,WAAW;IACX,YAAY;IACZ,MAAM;IACN,MAAM;IACN,QAAQ;IACR,UAAU;IACV,sBAAsB;IACtB,OAAO;IACP,cAAc;IACd,SAAS;IACT,gBAAgB;IAChB,YAAY;IACZ,QAAQ;IACR,iBAAiB;IACjB,QAAQ;IACR,cAAc;IACd,UAAU;IACV,mBAAmB;IACnB,UAAU;IACV,gBAAgB;IAChB,cAAc;IACd,UAAU;IACV,UAAU;CAC6D,CAAC;AAEzE;;;;GAIG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAqC;IACnF,6EAA6E;IAC7E,IAAI,EAAE,oDAAoD;IAC1D,OAAO,EAAE,uDAAuD;IAChE,MAAM,EAAE,sDAAsD;IAC9D,UAAU,EAAE,2DAA2D;IACvE,6EAA6E;IAC7E,IAAI,EAAE,oEAAoE;IAC1E,KAAK,EAAE,iFAAiF;IACxF,GAAG,EAAE,wEAAwE;IAC7E,YAAY,EAAE,iFAAiF;IAC/F,+DAA+D;IAC/D,WAAW,EAAE,+DAA+D;IAC5E,kEAAkE;IAClE,WAAW,EAAE,iEAAiE;IAC9E,MAAM,EAAE,0DAA0D;IAClE,wEAAwE;IACxE,yEAAyE;IACzE,2DAA2D;IAC3D,SAAS,EAAE,4EAA4E;IACvF,WAAW,EAAE,2EAA2E;IACxF,8EAA8E;IAC9E,8DAA8D;IAC9D,OAAO,EAAE,mEAAmE;CACnE,CAAC","sourcesContent":["/**\n * NeoRuntimeOptions — the typed handshake payload a neo client sends so the\n * daemon builds THAT connection's runtime exactly as the classic launcher would.\n *\n * Every field here corresponds to a `parsed.<field>` read in the classic\n * runtime-construction path (main.ts). The neo launcher forwards the classic\n * argv (see cli/neo/build-argv.ts); the daemon reconstructs a runtime from this\n * payload per connection, so per-client startup flags survive daemon sharing.\n *\n * The mapping between classic parsed fields and this payload is captured by\n * {@link NEO_RUNTIME_OPTION_SOURCE_FIELDS} and enforced by an extraction test\n * (neo-runtime-options-extraction.test.ts): the test statically scans the\n * runtime-construction path for `parsed.*` reads and fails if any runtime field\n * is not represented here. It is therefore GENERATED FROM the source, never\n * hand-maintained — a future consumer of a new parsed field fails the test until\n * it is threaded through this payload.\n *\n * Documented carve-outs (fields the daemon deliberately does NOT accept because\n * they are launcher fast-paths or resolve before the daemon is ever reached):\n * see {@link NEO_RUNTIME_OPTION_CARVEOUT_FIELDS}.\n */\n\n/**\n * The typed per-connection runtime options.\n *\n * Values mirror the classic `Args` shape for the runtime-relevant subset. All\n * fields are optional: an omitted field means \"classic default\" for that flag.\n * Initial inputs (`messages`, `fileArgs`) are forwarded RAW. Launch-time\n * @file/image expansion is NOT yet implemented daemon-side: only the plain\n * positional `messages` text is delivered (as a `prompt` command); `fileArgs`\n * surface a one-line non-fatal notice in the Go TUI instead of being expanded.\n */\nexport interface NeoRuntimeOptions {\n\t// Provider / model / thinking / auth.\n\treadonly provider?: string;\n\treadonly model?: string;\n\treadonly models?: readonly string[];\n\treadonly thinking?: string;\n\t/**\n\t * Per-connection API key. Applied ONLY to this connection's own AuthStorage\n\t * so one client's --api-key can never leak into another connection.\n\t */\n\treadonly apiKey?: string;\n\n\t// Session selection.\n\treadonly noSession?: boolean;\n\treadonly session?: string;\n\treadonly sessionId?: string;\n\treadonly sessionDir?: string;\n\treadonly fork?: string;\n\treadonly name?: string;\n\treadonly resume?: boolean;\n\treadonly continue?: boolean;\n\n\t// Approval / project trust.\n\treadonly projectTrustOverride?: boolean;\n\n\t// Tool scoping.\n\treadonly tools?: readonly string[];\n\treadonly excludeTools?: readonly string[];\n\treadonly noTools?: boolean;\n\treadonly noBuiltinTools?: boolean;\n\n\t// Resource loading.\n\treadonly extensions?: readonly string[];\n\treadonly skills?: readonly string[];\n\treadonly promptTemplates?: readonly string[];\n\treadonly themes?: readonly string[];\n\treadonly noExtensions?: boolean;\n\treadonly noSkills?: boolean;\n\treadonly noPromptTemplates?: boolean;\n\treadonly noThemes?: boolean;\n\treadonly noContextFiles?: boolean;\n\n\t/** Unknown flags (extension flags): name -> value. */\n\treadonly unknownFlags?: Readonly<Record<string, boolean | string>>;\n\n\t// Initial inputs — forwarded RAW; daemon expands @file/image paths per cwd.\n\treadonly messages?: readonly string[];\n\treadonly fileArgs?: readonly string[];\n}\n\n/**\n * Every classic `parsed.<field>` the runtime-construction path reads that MUST\n * be represented in {@link NeoRuntimeOptions}. This is the contract the\n * extraction test enforces against the actual source.\n *\n * Keep this in `parsed`-field spelling (the classic Args key), because that is\n * what the extraction test scans for in main.ts.\n */\nexport const NEO_RUNTIME_OPTION_SOURCE_FIELDS = [\n\t\"provider\",\n\t\"model\",\n\t\"models\",\n\t\"thinking\",\n\t\"apiKey\",\n\t\"noSession\",\n\t\"session\",\n\t\"sessionId\",\n\t\"sessionDir\",\n\t\"fork\",\n\t\"name\",\n\t\"resume\",\n\t\"continue\",\n\t\"projectTrustOverride\",\n\t\"tools\",\n\t\"excludeTools\",\n\t\"noTools\",\n\t\"noBuiltinTools\",\n\t\"extensions\",\n\t\"skills\",\n\t\"promptTemplates\",\n\t\"themes\",\n\t\"noExtensions\",\n\t\"noSkills\",\n\t\"noPromptTemplates\",\n\t\"noThemes\",\n\t\"noContextFiles\",\n\t\"unknownFlags\",\n\t\"messages\",\n\t\"fileArgs\",\n] as const satisfies readonly (keyof import(\"../../cli/args.ts\").Args)[];\n\n/**\n * Classic `parsed.*` fields the runtime path reads that the daemon deliberately\n * does NOT accept in the handshake, each with the reason it resolves before the\n * daemon or is intentionally launcher-local. The extraction test allows these.\n */\nexport const NEO_RUNTIME_OPTION_CARVEOUT_FIELDS: Readonly<Record<string, string>> = {\n\t// Launcher fast-paths: handled and exited before any runtime is constructed.\n\thelp: \"classic --help fast-path; never reaches the daemon\",\n\tversion: \"classic --version fast-path; never reaches the daemon\",\n\texport: \"classic --export fast-path; never reaches the daemon\",\n\tlistModels: \"classic --list-models fast-path; never reaches the daemon\",\n\t// Mode / dispatch: the daemon path is chosen by the launcher, not forwarded.\n\tmode: \"output mode dispatch; the daemon always speaks rpc over the socket\",\n\tprint: \"print-mode dispatch; TTY-less --neo falls back to classic print in the launcher\",\n\tneo: \"the --neo flag itself; consumed by the launcher to choose the neo path\",\n\tmultiSession: \"RPC-host process flag; neo daemon workers always use classic per-connection RPC\",\n\t// Diagnostics are produced by the parser, not a runtime input.\n\tdiagnostics: \"parser-produced diagnostics; not a runtime construction input\",\n\t// Neo launcher-local flags never forwarded to the daemon runtime.\n\tneoIsolated: \"launcher-local: selects isolated transport, not a runtime input\",\n\tneoBin: \"launcher-local: dev binary override, not a runtime input\",\n\t// Neo daemon supervisor flags: consumed by the daemon launcher, never a\n\t// per-connection runtime input (each connection's runtime comes from the\n\t// handshake NeoRuntimeOptions, not the daemon's own argv).\n\tneoListen: \"daemon-supervisor: socket path to bind; not a per-connection runtime input\",\n\tneoRegister: \"daemon-supervisor: self-register flag; not a per-connection runtime input\",\n\t// Verbose controls classic startup logging / InteractiveMode; neo renders its\n\t// own UI and does not consume classic verbose startup output.\n\tverbose: \"classic InteractiveMode/startup verbosity; neo renders its own UI\",\n} as const;\n"]}
|