@herbertgao/pi-extensions 2026.8.2 → 2026.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -2
- package/examples/pi-footer.json +275 -0
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +6 -8
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +5 -7
- package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/hero.en.svg +101 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +1 -17
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +5 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/{utils/agent-summary.ts → feature/agent-summary/core.ts} +37 -35
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{agent-summary.ts → agent-summary/index.ts} +2 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{session-reference.ts → reference/index.ts} +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{agent-autocomplete.ts → reference/subagent.ts} +19 -9
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{pi-startup-header.ts → shell/startup-header.ts} +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{working-message.ts → shell/working-message.ts} +5 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/index.ts +32 -28
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +379 -85
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +727 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +65 -775
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/{feature → renderer}/markdown-enhance.ts +35 -31
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-hover.ts → mouse/hover.ts} +5 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-interaction.ts → mouse/interaction.ts} +34 -35
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-layout.ts → mouse/layout.ts} +5 -21
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-packets.ts → mouse/packets.ts} +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{mouse-scroll.ts → mouse/scroll.ts} +48 -37
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/ansi-utils.ts +56 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/diff-renderer.ts +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/line-width-safety.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-display-utils.ts +12 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/write-execution.ts +1 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-grouping.ts → tool/grouping.ts} +18 -8
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-result.ts → tool/result.ts} +4 -13
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/fullscreen-detect.ts +0 -27
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +3 -3
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-subagents/package.json +2 -2
- package/node_modules/@herbertgao/pi-subagents/src/agent-manager.ts +1 -0
- package/node_modules/@herbertgao/pi-subagents/src/agent-runner.ts +3 -1
- package/node_modules/@herbertgao/pi-subagents/src/index.ts +33 -35
- package/node_modules/@herbertgao/pi-subagents/src/nested-tools.ts +26 -35
- package/node_modules/@herbertgao/pi-subagents/src/prompts.ts +15 -1
- package/node_modules/pi-footer/CHANGELOG.md +145 -0
- package/node_modules/pi-footer/LICENSE +21 -0
- package/node_modules/pi-footer/README.md +354 -0
- package/node_modules/pi-footer/package.json +68 -0
- package/node_modules/pi-footer/src/cache.ts +106 -0
- package/node_modules/pi-footer/src/colors.ts +237 -0
- package/node_modules/pi-footer/src/config.ts +202 -0
- package/node_modules/pi-footer/src/event-widgets.ts +41 -0
- package/node_modules/pi-footer/src/extension-statuses.ts +102 -0
- package/node_modules/pi-footer/src/git.ts +135 -0
- package/node_modules/pi-footer/src/index.ts +268 -0
- package/node_modules/pi-footer/src/metrics.ts +141 -0
- package/node_modules/pi-footer/src/presets.ts +383 -0
- package/node_modules/pi-footer/src/render.ts +114 -0
- package/node_modules/pi-footer/src/separators.ts +52 -0
- package/node_modules/pi-footer/src/types.ts +122 -0
- package/node_modules/pi-footer/src/ui/color-level-confirm.ts +22 -0
- package/node_modules/pi-footer/src/ui/color-options.ts +195 -0
- package/node_modules/pi-footer/src/ui/config-lifecycle.ts +61 -0
- package/node_modules/pi-footer/src/ui/edit-colors.ts +13 -0
- package/node_modules/pi-footer/src/ui/events.ts +35 -0
- package/node_modules/pi-footer/src/ui/extension-status-picker.ts +60 -0
- package/node_modules/pi-footer/src/ui/extension-statuses.ts +73 -0
- package/node_modules/pi-footer/src/ui/fields.ts +252 -0
- package/node_modules/pi-footer/src/ui/global-menu.ts +126 -0
- package/node_modules/pi-footer/src/ui/helpers.ts +44 -0
- package/node_modules/pi-footer/src/ui/layout.ts +17 -0
- package/node_modules/pi-footer/src/ui/line-list.ts +19 -0
- package/node_modules/pi-footer/src/ui/model.ts +64 -0
- package/node_modules/pi-footer/src/ui/navigation.ts +29 -0
- package/node_modules/pi-footer/src/ui/option-edit.ts +93 -0
- package/node_modules/pi-footer/src/ui/overlay-render.ts +103 -0
- package/node_modules/pi-footer/src/ui/screen-context.ts +18 -0
- package/node_modules/pi-footer/src/ui/screen-controller.ts +27 -0
- package/node_modules/pi-footer/src/ui/screen-render.ts +32 -0
- package/node_modules/pi-footer/src/ui/screen-state.ts +20 -0
- package/node_modules/pi-footer/src/ui/screen.ts +243 -0
- package/node_modules/pi-footer/src/ui/screens/add-widget.ts +92 -0
- package/node_modules/pi-footer/src/ui/screens/confirm-exit.ts +52 -0
- package/node_modules/pi-footer/src/ui/screens/controller.ts +12 -0
- package/node_modules/pi-footer/src/ui/screens/edit-colors.ts +68 -0
- package/node_modules/pi-footer/src/ui/screens/edit-widget.ts +115 -0
- package/node_modules/pi-footer/src/ui/screens/extension-status-row.ts +61 -0
- package/node_modules/pi-footer/src/ui/screens/global.ts +75 -0
- package/node_modules/pi-footer/src/ui/screens/line-list.ts +108 -0
- package/node_modules/pi-footer/src/ui/screens/main.ts +99 -0
- package/node_modules/pi-footer/src/ui/screens/terminal.ts +121 -0
- package/node_modules/pi-footer/src/ui/screens/widget-list.ts +154 -0
- package/node_modules/pi-footer/src/ui/terminal-menu.ts +32 -0
- package/node_modules/pi-footer/src/ui/theme.ts +48 -0
- package/node_modules/pi-footer/src/ui/title-bar.ts +100 -0
- package/node_modules/pi-footer/src/ui/widget-actions.ts +76 -0
- package/node_modules/pi-footer/src/ui.ts +66 -0
- package/node_modules/pi-footer/src/widgets/context.ts +28 -0
- package/node_modules/pi-footer/src/widgets/core/active-tools.ts +17 -0
- package/node_modules/pi-footer/src/widgets/core/context-window.ts +24 -0
- package/node_modules/pi-footer/src/widgets/core/cwd-basename.ts +19 -0
- package/node_modules/pi-footer/src/widgets/core/cwd.ts +108 -0
- package/node_modules/pi-footer/src/widgets/core/event.ts +34 -0
- package/node_modules/pi-footer/src/widgets/core/external-status.ts +102 -0
- package/node_modules/pi-footer/src/widgets/core/model-provider.ts +20 -0
- package/node_modules/pi-footer/src/widgets/core/model.ts +35 -0
- package/node_modules/pi-footer/src/widgets/core/provider.ts +17 -0
- package/node_modules/pi-footer/src/widgets/core/session-name.ts +17 -0
- package/node_modules/pi-footer/src/widgets/core/text-verbosity.ts +17 -0
- package/node_modules/pi-footer/src/widgets/core/thinking-level.ts +17 -0
- package/node_modules/pi-footer/src/widgets/git/ahead-behind.ts +17 -0
- package/node_modules/pi-footer/src/widgets/git/branch.ts +81 -0
- package/node_modules/pi-footer/src/widgets/git/clean.ts +19 -0
- package/node_modules/pi-footer/src/widgets/git/deletions.ts +17 -0
- package/node_modules/pi-footer/src/widgets/git/diff.ts +38 -0
- package/node_modules/pi-footer/src/widgets/git/insertions.ts +17 -0
- package/node_modules/pi-footer/src/widgets/git/remote.ts +17 -0
- package/node_modules/pi-footer/src/widgets/git/root.ts +17 -0
- package/node_modules/pi-footer/src/widgets/git/sha.ts +17 -0
- package/node_modules/pi-footer/src/widgets/git/staged.ts +17 -0
- package/node_modules/pi-footer/src/widgets/git/status.ts +19 -0
- package/node_modules/pi-footer/src/widgets/git/unstaged.ts +17 -0
- package/node_modules/pi-footer/src/widgets/git/untracked.ts +17 -0
- package/node_modules/pi-footer/src/widgets/instance.ts +118 -0
- package/node_modules/pi-footer/src/widgets/layout/custom-text.ts +18 -0
- package/node_modules/pi-footer/src/widgets/layout/flex-separator.ts +32 -0
- package/node_modules/pi-footer/src/widgets/layout/separator.ts +57 -0
- package/node_modules/pi-footer/src/widgets/layout/spacer.ts +31 -0
- package/node_modules/pi-footer/src/widgets/options.ts +122 -0
- package/node_modules/pi-footer/src/widgets/project/runtime.ts +361 -0
- package/node_modules/pi-footer/src/widgets/registry.ts +223 -0
- package/node_modules/pi-footer/src/widgets/session/assistant-messages.ts +17 -0
- package/node_modules/pi-footer/src/widgets/session/compactions.ts +17 -0
- package/node_modules/pi-footer/src/widgets/session/elapsed.ts +18 -0
- package/node_modules/pi-footer/src/widgets/session/last-activity.ts +18 -0
- package/node_modules/pi-footer/src/widgets/session/messages.ts +19 -0
- package/node_modules/pi-footer/src/widgets/session/session-id.ts +17 -0
- package/node_modules/pi-footer/src/widgets/session/session-start.ts +18 -0
- package/node_modules/pi-footer/src/widgets/session/tool-results.ts +17 -0
- package/node_modules/pi-footer/src/widgets/session/total-messages.ts +19 -0
- package/node_modules/pi-footer/src/widgets/session/total-time.ts +18 -0
- package/node_modules/pi-footer/src/widgets/session/user-messages.ts +17 -0
- package/node_modules/pi-footer/src/widgets/store.ts +26 -0
- package/node_modules/pi-footer/src/widgets/tokens/cache-hit-rate.ts +55 -0
- package/node_modules/pi-footer/src/widgets/tokens/cache-read.ts +18 -0
- package/node_modules/pi-footer/src/widgets/tokens/cache-write.ts +18 -0
- package/node_modules/pi-footer/src/widgets/tokens/context-bar.ts +108 -0
- package/node_modules/pi-footer/src/widgets/tokens/context-length.ts +26 -0
- package/node_modules/pi-footer/src/widgets/tokens/context-remaining.ts +29 -0
- package/node_modules/pi-footer/src/widgets/tokens/context.ts +29 -0
- package/node_modules/pi-footer/src/widgets/tokens/cost.ts +51 -0
- package/node_modules/pi-footer/src/widgets/tokens/input-speed.ts +25 -0
- package/node_modules/pi-footer/src/widgets/tokens/input-tokens.ts +18 -0
- package/node_modules/pi-footer/src/widgets/tokens/output-speed.ts +25 -0
- package/node_modules/pi-footer/src/widgets/tokens/output-tokens.ts +18 -0
- package/node_modules/pi-footer/src/widgets/tokens/tokens.ts +20 -0
- package/node_modules/pi-footer/src/widgets/tokens/total-speed.ts +25 -0
- package/node_modules/pi-footer/src/widgets/tokens/total-tokens.ts +18 -0
- package/node_modules/pi-footer/src/widgets/types.ts +181 -0
- package/node_modules/pi-footer/src/widgets/utils/colors.ts +11 -0
- package/node_modules/pi-footer/src/widgets/utils/context.ts +112 -0
- package/node_modules/pi-footer/src/widgets/utils/session.ts +19 -0
- package/node_modules/pi-footer/src/widgets/utils/token-format.ts +78 -0
- package/node_modules/pi-mcp-adapter/CHANGELOG.md +19 -0
- package/node_modules/pi-mcp-adapter/README.md +19 -4
- package/node_modules/pi-mcp-adapter/agent-dir.ts +40 -0
- package/node_modules/pi-mcp-adapter/commands.ts +12 -2
- package/node_modules/pi-mcp-adapter/direct-tools.ts +6 -8
- package/node_modules/pi-mcp-adapter/index.ts +15 -3
- package/node_modules/pi-mcp-adapter/mcp-auth-flow.ts +87 -4
- package/node_modules/pi-mcp-adapter/mcp-callback-server.ts +138 -61
- package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +43 -4
- package/node_modules/pi-mcp-adapter/oauth.ts +48 -0
- package/node_modules/pi-mcp-adapter/package.json +8 -2
- package/node_modules/pi-mcp-adapter/proxy-modes.ts +8 -10
- package/node_modules/pi-mcp-adapter/tool-registrar.ts +187 -3
- package/node_modules/pi-mcp-adapter/types.ts +2 -0
- package/node_modules/pi-web-access/CHANGELOG.md +45 -0
- package/node_modules/pi-web-access/README.md +104 -29
- package/node_modules/pi-web-access/bocha.ts +221 -0
- package/node_modules/pi-web-access/curator-page.ts +113 -12
- package/node_modules/pi-web-access/curator-server.ts +56 -20
- package/node_modules/pi-web-access/datalab-pdf-extract.ts +568 -0
- package/node_modules/pi-web-access/duckduckgo.ts +123 -0
- package/node_modules/pi-web-access/extract.ts +288 -143
- package/node_modules/pi-web-access/feature-config.ts +29 -0
- package/node_modules/pi-web-access/gemini-api.ts +4 -0
- package/node_modules/pi-web-access/gemini-search.ts +45 -12
- package/node_modules/pi-web-access/gemini-web.ts +68 -3
- package/node_modules/pi-web-access/index.ts +160 -71
- package/node_modules/pi-web-access/jina-search.ts +284 -0
- package/node_modules/pi-web-access/kagi.ts +12 -12
- package/node_modules/pi-web-access/openai-search.ts +12 -2
- package/node_modules/pi-web-access/package.json +4 -3
- package/node_modules/pi-web-access/pdf-extract.ts +327 -228
- package/node_modules/pi-web-access/storage.ts +440 -2
- package/node_modules/pi-web-access/summary-model-scope.ts +1 -1
- package/node_modules/pi-web-access/summary-review.ts +4 -2
- package/node_modules/pi-web-access/video-extract.ts +10 -8
- package/node_modules/pi-web-access/xai-search.ts +12 -2
- package/node_modules/pi-web-access/youtube-extract.ts +2 -1
- package/node_modules/remote-pi/LICENSE +21 -0
- package/node_modules/remote-pi/README.md +675 -0
- package/node_modules/remote-pi/dist/actions/handlers.d.ts +122 -0
- package/node_modules/remote-pi/dist/actions/handlers.js +160 -0
- package/node_modules/remote-pi/dist/actions/handlers.js.map +1 -0
- package/node_modules/remote-pi/dist/actions/registry.d.ts +39 -0
- package/node_modules/remote-pi/dist/actions/registry.js +58 -0
- package/node_modules/remote-pi/dist/actions/registry.js.map +1 -0
- package/node_modules/remote-pi/dist/bin/supervisord.d.ts +2 -0
- package/node_modules/remote-pi/dist/bin/supervisord.js +86 -0
- package/node_modules/remote-pi/dist/bin/supervisord.js.map +1 -0
- package/node_modules/remote-pi/dist/commands/builtin_mirror.d.ts +58 -0
- package/node_modules/remote-pi/dist/commands/builtin_mirror.js +71 -0
- package/node_modules/remote-pi/dist/commands/builtin_mirror.js.map +1 -0
- package/node_modules/remote-pi/dist/commands/list_commands.d.ts +60 -0
- package/node_modules/remote-pi/dist/commands/list_commands.js +73 -0
- package/node_modules/remote-pi/dist/commands/list_commands.js.map +1 -0
- package/node_modules/remote-pi/dist/config.d.ts +62 -0
- package/node_modules/remote-pi/dist/config.js +115 -0
- package/node_modules/remote-pi/dist/config.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/client.d.ts +20 -0
- package/node_modules/remote-pi/dist/daemon/client.js +131 -0
- package/node_modules/remote-pi/dist/daemon/client.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/control_protocol.d.ts +176 -0
- package/node_modules/remote-pi/dist/daemon/control_protocol.js +63 -0
- package/node_modules/remote-pi/dist/daemon/control_protocol.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/cron_log.d.ts +45 -0
- package/node_modules/remote-pi/dist/daemon/cron_log.js +72 -0
- package/node_modules/remote-pi/dist/daemon/cron_log.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/cron_registry.d.ts +80 -0
- package/node_modules/remote-pi/dist/daemon/cron_registry.js +194 -0
- package/node_modules/remote-pi/dist/daemon/cron_registry.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/id.d.ts +24 -0
- package/node_modules/remote-pi/dist/daemon/id.js +36 -0
- package/node_modules/remote-pi/dist/daemon/id.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/install.d.ts +170 -0
- package/node_modules/remote-pi/dist/daemon/install.js +547 -0
- package/node_modules/remote-pi/dist/daemon/install.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/registry.d.ts +63 -0
- package/node_modules/remote-pi/dist/daemon/registry.js +153 -0
- package/node_modules/remote-pi/dist/daemon/registry.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/rpc_child.d.ts +194 -0
- package/node_modules/remote-pi/dist/daemon/rpc_child.js +389 -0
- package/node_modules/remote-pi/dist/daemon/rpc_child.js.map +1 -0
- package/node_modules/remote-pi/dist/daemon/supervisor.d.ts +93 -0
- package/node_modules/remote-pi/dist/daemon/supervisor.js +596 -0
- package/node_modules/remote-pi/dist/daemon/supervisor.js.map +1 -0
- package/node_modules/remote-pi/dist/extension_ui_bridge.d.ts +26 -0
- package/node_modules/remote-pi/dist/extension_ui_bridge.js +341 -0
- package/node_modules/remote-pi/dist/extension_ui_bridge.js.map +1 -0
- package/node_modules/remote-pi/dist/index.d.ts +213 -0
- package/node_modules/remote-pi/dist/index.js +4996 -0
- package/node_modules/remote-pi/dist/index.js.map +1 -0
- package/node_modules/remote-pi/dist/mcp/mesh_result.d.ts +10 -0
- package/node_modules/remote-pi/dist/mcp/mesh_result.js +42 -0
- package/node_modules/remote-pi/dist/mcp/mesh_result.js.map +1 -0
- package/node_modules/remote-pi/dist/mcp/mesh_server.d.ts +16 -0
- package/node_modules/remote-pi/dist/mcp/mesh_server.js +327 -0
- package/node_modules/remote-pi/dist/mcp/mesh_server.js.map +1 -0
- package/node_modules/remote-pi/dist/mesh/canonical.d.ts +30 -0
- package/node_modules/remote-pi/dist/mesh/canonical.js +61 -0
- package/node_modules/remote-pi/dist/mesh/canonical.js.map +1 -0
- package/node_modules/remote-pi/dist/mesh/client.d.ts +18 -0
- package/node_modules/remote-pi/dist/mesh/client.js +125 -0
- package/node_modules/remote-pi/dist/mesh/client.js.map +1 -0
- package/node_modules/remote-pi/dist/mesh/encoding.d.ts +38 -0
- package/node_modules/remote-pi/dist/mesh/encoding.js +216 -0
- package/node_modules/remote-pi/dist/mesh/encoding.js.map +1 -0
- package/node_modules/remote-pi/dist/mesh/self_revoke.d.ts +73 -0
- package/node_modules/remote-pi/dist/mesh/self_revoke.js +401 -0
- package/node_modules/remote-pi/dist/mesh/self_revoke.js.map +1 -0
- package/node_modules/remote-pi/dist/mesh/siblings.d.ts +49 -0
- package/node_modules/remote-pi/dist/mesh/siblings.js +159 -0
- package/node_modules/remote-pi/dist/mesh/siblings.js.map +1 -0
- package/node_modules/remote-pi/dist/mesh/types.d.ts +34 -0
- package/node_modules/remote-pi/dist/mesh/types.js +11 -0
- package/node_modules/remote-pi/dist/mesh/types.js.map +1 -0
- package/node_modules/remote-pi/dist/mesh/verify.d.ts +17 -0
- package/node_modules/remote-pi/dist/mesh/verify.js +86 -0
- package/node_modules/remote-pi/dist/mesh/verify.js.map +1 -0
- package/node_modules/remote-pi/dist/pairing/crypto.d.ts +8 -0
- package/node_modules/remote-pi/dist/pairing/crypto.js +22 -0
- package/node_modules/remote-pi/dist/pairing/crypto.js.map +1 -0
- package/node_modules/remote-pi/dist/pairing/handshake.d.ts +28 -0
- package/node_modules/remote-pi/dist/pairing/handshake.js +113 -0
- package/node_modules/remote-pi/dist/pairing/handshake.js.map +1 -0
- package/node_modules/remote-pi/dist/pairing/noise-sha256.d.ts +16 -0
- package/node_modules/remote-pi/dist/pairing/noise-sha256.js +103 -0
- package/node_modules/remote-pi/dist/pairing/noise-sha256.js.map +1 -0
- package/node_modules/remote-pi/dist/pairing/qr.d.ts +59 -0
- package/node_modules/remote-pi/dist/pairing/qr.js +125 -0
- package/node_modules/remote-pi/dist/pairing/qr.js.map +1 -0
- package/node_modules/remote-pi/dist/pairing/storage.d.ts +120 -0
- package/node_modules/remote-pi/dist/pairing/storage.js +604 -0
- package/node_modules/remote-pi/dist/pairing/storage.js.map +1 -0
- package/node_modules/remote-pi/dist/protocol/codec.d.ts +7 -0
- package/node_modules/remote-pi/dist/protocol/codec.js +49 -0
- package/node_modules/remote-pi/dist/protocol/codec.js.map +1 -0
- package/node_modules/remote-pi/dist/protocol/types.d.ts +393 -0
- package/node_modules/remote-pi/dist/protocol/types.js +2 -0
- package/node_modules/remote-pi/dist/protocol/types.js.map +1 -0
- package/node_modules/remote-pi/dist/rooms.d.ts +29 -0
- package/node_modules/remote-pi/dist/rooms.js +57 -0
- package/node_modules/remote-pi/dist/rooms.js.map +1 -0
- package/node_modules/remote-pi/dist/session/address.d.ts +49 -0
- package/node_modules/remote-pi/dist/session/address.js +58 -0
- package/node_modules/remote-pi/dist/session/address.js.map +1 -0
- package/node_modules/remote-pi/dist/session/agent_bridge.d.ts +55 -0
- package/node_modules/remote-pi/dist/session/agent_bridge.js +146 -0
- package/node_modules/remote-pi/dist/session/agent_bridge.js.map +1 -0
- package/node_modules/remote-pi/dist/session/bridge.d.ts +37 -0
- package/node_modules/remote-pi/dist/session/bridge.js +130 -0
- package/node_modules/remote-pi/dist/session/bridge.js.map +1 -0
- package/node_modules/remote-pi/dist/session/broker.d.ts +189 -0
- package/node_modules/remote-pi/dist/session/broker.js +507 -0
- package/node_modules/remote-pi/dist/session/broker.js.map +1 -0
- package/node_modules/remote-pi/dist/session/broker_remote.d.ts +74 -0
- package/node_modules/remote-pi/dist/session/broker_remote.js +583 -0
- package/node_modules/remote-pi/dist/session/broker_remote.js.map +1 -0
- package/node_modules/remote-pi/dist/session/cwd_lock.d.ts +33 -0
- package/node_modules/remote-pi/dist/session/cwd_lock.js +126 -0
- package/node_modules/remote-pi/dist/session/cwd_lock.js.map +1 -0
- package/node_modules/remote-pi/dist/session/envelope.d.ts +33 -0
- package/node_modules/remote-pi/dist/session/envelope.js +117 -0
- package/node_modules/remote-pi/dist/session/envelope.js.map +1 -0
- package/node_modules/remote-pi/dist/session/global_config.d.ts +33 -0
- package/node_modules/remote-pi/dist/session/global_config.js +73 -0
- package/node_modules/remote-pi/dist/session/global_config.js.map +1 -0
- package/node_modules/remote-pi/dist/session/ipc.d.ts +27 -0
- package/node_modules/remote-pi/dist/session/ipc.js +22 -0
- package/node_modules/remote-pi/dist/session/ipc.js.map +1 -0
- package/node_modules/remote-pi/dist/session/leader_election.d.ts +32 -0
- package/node_modules/remote-pi/dist/session/leader_election.js +106 -0
- package/node_modules/remote-pi/dist/session/leader_election.js.map +1 -0
- package/node_modules/remote-pi/dist/session/local_config.d.ts +55 -0
- package/node_modules/remote-pi/dist/session/local_config.js +157 -0
- package/node_modules/remote-pi/dist/session/local_config.js.map +1 -0
- package/node_modules/remote-pi/dist/session/mesh_message.d.ts +20 -0
- package/node_modules/remote-pi/dist/session/mesh_message.js +28 -0
- package/node_modules/remote-pi/dist/session/mesh_message.js.map +1 -0
- package/node_modules/remote-pi/dist/session/mesh_node.d.ts +116 -0
- package/node_modules/remote-pi/dist/session/mesh_node.js +573 -0
- package/node_modules/remote-pi/dist/session/mesh_node.js.map +1 -0
- package/node_modules/remote-pi/dist/session/peer.d.ts +139 -0
- package/node_modules/remote-pi/dist/session/peer.js +451 -0
- package/node_modules/remote-pi/dist/session/peer.js.map +1 -0
- package/node_modules/remote-pi/dist/session/peer_inventory.d.ts +13 -0
- package/node_modules/remote-pi/dist/session/peer_inventory.js +48 -0
- package/node_modules/remote-pi/dist/session/peer_inventory.js.map +1 -0
- package/node_modules/remote-pi/dist/session/peer_limits.d.ts +9 -0
- package/node_modules/remote-pi/dist/session/peer_limits.js +21 -0
- package/node_modules/remote-pi/dist/session/peer_limits.js.map +1 -0
- package/node_modules/remote-pi/dist/session/setup_wizard.d.ts +39 -0
- package/node_modules/remote-pi/dist/session/setup_wizard.js +63 -0
- package/node_modules/remote-pi/dist/session/setup_wizard.js.map +1 -0
- package/node_modules/remote-pi/dist/session/tool_gate.d.ts +5 -0
- package/node_modules/remote-pi/dist/session/tool_gate.js +11 -0
- package/node_modules/remote-pi/dist/session/tool_gate.js.map +1 -0
- package/node_modules/remote-pi/dist/session/tools.d.ts +24 -0
- package/node_modules/remote-pi/dist/session/tools.js +252 -0
- package/node_modules/remote-pi/dist/session/tools.js.map +1 -0
- package/node_modules/remote-pi/dist/session/wizard.d.ts +13 -0
- package/node_modules/remote-pi/dist/session/wizard.js +20 -0
- package/node_modules/remote-pi/dist/session/wizard.js.map +1 -0
- package/node_modules/remote-pi/dist/settings.d.ts +15 -0
- package/node_modules/remote-pi/dist/settings.js +52 -0
- package/node_modules/remote-pi/dist/settings.js.map +1 -0
- package/node_modules/remote-pi/dist/transport/peer_channel.d.ts +37 -0
- package/node_modules/remote-pi/dist/transport/peer_channel.js +98 -0
- package/node_modules/remote-pi/dist/transport/peer_channel.js.map +1 -0
- package/node_modules/remote-pi/dist/transport/pi_forward_client.d.ts +29 -0
- package/node_modules/remote-pi/dist/transport/pi_forward_client.js +62 -0
- package/node_modules/remote-pi/dist/transport/pi_forward_client.js.map +1 -0
- package/node_modules/remote-pi/dist/transport/relay_client.d.ts +91 -0
- package/node_modules/remote-pi/dist/transport/relay_client.js +206 -0
- package/node_modules/remote-pi/dist/transport/relay_client.js.map +1 -0
- package/node_modules/remote-pi/dist/ui/footer.d.ts +32 -0
- package/node_modules/remote-pi/dist/ui/footer.js +34 -0
- package/node_modules/remote-pi/dist/ui/footer.js.map +1 -0
- package/node_modules/remote-pi/docs/daemon.md +289 -0
- package/node_modules/remote-pi/package.json +88 -0
- package/node_modules/remote-pi/service-templates/launchd.plist.template +35 -0
- package/node_modules/remote-pi/service-templates/systemd.service.template +19 -0
- package/node_modules/remote-pi/service-templates/task-launcher.vbs.template +10 -0
- package/node_modules/remote-pi/service-templates/task-scheduler.xml.template +38 -0
- package/node_modules/remote-pi/skills/agent-network/SKILL.md +310 -0
- package/package.json +25 -10
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool-diff/write-display-utils.ts +0 -29
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{session-reference-core.ts → reference/session.ts} +0 -0
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/{pi-aliases.ts → shell/aliases.ts} +0 -0
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/ATTRIBUTION.md +0 -0
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/diff-presentation.ts +0 -0
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/index.ts +0 -0
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/render-utils.ts +0 -0
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/shiki-highlight.ts +0 -0
- /package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{tool-diff → tool/diff}/types.ts +0 -0
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, unlinkSync } from "node:fs";
|
|
2
|
+
import { createConnection, createServer } from "node:net";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { addDaemon, listDaemons, migrateRegistryNames, removeDaemon } from "./registry.js";
|
|
6
|
+
import { daemonIdForCwd } from "./id.js";
|
|
7
|
+
import { defaultAgentName } from "../session/local_config.js";
|
|
8
|
+
import { ipcAddress, usesNamedPipe } from "../session/ipc.js";
|
|
9
|
+
import { EXIT_DAEMON_FRESH_SESSION, RpcChild } from "./rpc_child.js";
|
|
10
|
+
import { encodeReply, parseRequest, } from "./control_protocol.js";
|
|
11
|
+
import { Cron } from "croner";
|
|
12
|
+
import { addJob as addCronJob, getJob as getCronJob, listJobs as listCronJobs, nextRunFor, recordRun, removeJob as removeCronJob, setJobEnabled, validateSchedule, } from "./cron_registry.js";
|
|
13
|
+
import { appendCronLog, readCronLog } from "./cron_log.js";
|
|
14
|
+
/**
|
|
15
|
+
* Central process that owns the daemon fleet (plan/26).
|
|
16
|
+
*
|
|
17
|
+
* Responsibilities:
|
|
18
|
+
* - Spawn one `pi --mode rpc` child per registry entry. Track them in
|
|
19
|
+
* `_children: Map<id, RpcChild>`.
|
|
20
|
+
* - Auto-restart crashed children with exponential backoff
|
|
21
|
+
* (1s, 5s, 30s, 5min). Give up after 4 attempts to avoid log spam
|
|
22
|
+
* when the agent is misconfigured.
|
|
23
|
+
* - Listen on `~/.pi/remote/supervisor.sock` for `ControlRequest`s from
|
|
24
|
+
* the `remote-pi` CLI. Each connection: 1 request → 1 reply → close.
|
|
25
|
+
* - Graceful shutdown on SIGTERM/SIGINT: stop all children + unlink
|
|
26
|
+
* the UDS file so a next supervisor can bind cleanly.
|
|
27
|
+
*
|
|
28
|
+
* The supervisor itself is the only long-running process the user
|
|
29
|
+
* installs as a system service (plan/26 W3 will generate the unit/plist).
|
|
30
|
+
* If it crashes, systemd/launchd restarts it; on restart it re-reads
|
|
31
|
+
* the registry and re-spawns everything.
|
|
32
|
+
*/
|
|
33
|
+
const SUPERVISOR_SOCK_NAME = "supervisor.sock";
|
|
34
|
+
/** Backoff schedule for auto-restart after a crash. After exhausting, the
|
|
35
|
+
* child stays in `crashed` state until manual `restart_all` or fresh
|
|
36
|
+
* registry add. Keeps logs sane when the agent dies on every boot. */
|
|
37
|
+
const RESTART_BACKOFFS_MS = [1_000, 5_000, 30_000, 5 * 60_000];
|
|
38
|
+
function supervisorSockPath() {
|
|
39
|
+
const root = process.env["REMOTE_PI_HOME"] || homedir();
|
|
40
|
+
// POSIX → ~/.pi/remote/supervisor.sock; Windows → per-user named pipe (plan/40).
|
|
41
|
+
return ipcAddress("supervisor", join(root, ".pi", "remote", SUPERVISOR_SOCK_NAME));
|
|
42
|
+
}
|
|
43
|
+
/** Thrown by `start()` when another live supervisor already holds the UDS.
|
|
44
|
+
* Prevents a second supervisor from orphaning the first's children. */
|
|
45
|
+
export class SupervisorAlreadyRunningError extends Error {
|
|
46
|
+
sockPath;
|
|
47
|
+
constructor(sockPath) {
|
|
48
|
+
super(`Another pi-supervisord is already running (UDS held at ${sockPath}). ` +
|
|
49
|
+
"Refusing to start a second instance. Use `remote-pi daemon …` to control it, " +
|
|
50
|
+
"or stop the running one first.");
|
|
51
|
+
this.sockPath = sockPath;
|
|
52
|
+
this.name = "SupervisorAlreadyRunningError";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Probes whether a live supervisor is accepting connections on `path`.
|
|
56
|
+
* Resolves true if the connect succeeds (a listener is there), false on
|
|
57
|
+
* ECONNREFUSED / ENOENT (stale socket file from a crashed supervisor). */
|
|
58
|
+
function _probeSupervisor(path) {
|
|
59
|
+
return new Promise((resolve) => {
|
|
60
|
+
const sock = createConnection({ path });
|
|
61
|
+
const done = (alive) => {
|
|
62
|
+
sock.removeAllListeners();
|
|
63
|
+
sock.destroy();
|
|
64
|
+
resolve(alive);
|
|
65
|
+
};
|
|
66
|
+
const timer = setTimeout(() => done(false), 1_000);
|
|
67
|
+
sock.once("connect", () => { clearTimeout(timer); done(true); });
|
|
68
|
+
sock.once("error", () => { clearTimeout(timer); done(false); });
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
export function decideFireAction(o) {
|
|
72
|
+
if (!o.running)
|
|
73
|
+
return o.wake ? "wake_and_send" : "skip_down";
|
|
74
|
+
if (o.skipIfBusy && o.busy)
|
|
75
|
+
return "skip_busy";
|
|
76
|
+
return "send";
|
|
77
|
+
}
|
|
78
|
+
export class Supervisor {
|
|
79
|
+
opts;
|
|
80
|
+
server = null;
|
|
81
|
+
children = new Map();
|
|
82
|
+
/** Live croner schedules, keyed by cron job id (plan/39). */
|
|
83
|
+
cronJobs = new Map();
|
|
84
|
+
shuttingDown = false;
|
|
85
|
+
constructor(opts) {
|
|
86
|
+
this.opts = opts;
|
|
87
|
+
}
|
|
88
|
+
/** Bind the control UDS + spawn all registered daemons. */
|
|
89
|
+
async start() {
|
|
90
|
+
this._mkdirParent();
|
|
91
|
+
// Backfill folder-derived names into legacy registry entries (pre-name
|
|
92
|
+
// field) so every daemon has a stable name to inject via env.
|
|
93
|
+
migrateRegistryNames();
|
|
94
|
+
await this._bindUds();
|
|
95
|
+
this._spawnAllFromRegistry();
|
|
96
|
+
// Cron (plan/39): schedule all enabled jobs, then run any missed catchup.
|
|
97
|
+
this._reconcileCron();
|
|
98
|
+
this._runCatchup();
|
|
99
|
+
}
|
|
100
|
+
/** Graceful shutdown: stop all children, close UDS. */
|
|
101
|
+
async stop() {
|
|
102
|
+
this.shuttingDown = true;
|
|
103
|
+
// Stop all cron schedules (plan/39) so no fire races with teardown.
|
|
104
|
+
for (const c of this.cronJobs.values())
|
|
105
|
+
c.stop();
|
|
106
|
+
this.cronJobs.clear();
|
|
107
|
+
// Cancel pending restart timers first so they don't race with stop().
|
|
108
|
+
for (const slot of this.children.values()) {
|
|
109
|
+
if (slot.restartTimer !== null) {
|
|
110
|
+
clearTimeout(slot.restartTimer);
|
|
111
|
+
slot.restartTimer = null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
await Promise.all([...this.children.values()].map((s) => s.child.stop()));
|
|
115
|
+
this.children.clear();
|
|
116
|
+
await new Promise((resolve) => {
|
|
117
|
+
if (!this.server)
|
|
118
|
+
return resolve();
|
|
119
|
+
this.server.close(() => resolve());
|
|
120
|
+
});
|
|
121
|
+
this.server = null;
|
|
122
|
+
// Best-effort: clear the socket file so a next supervisor bind succeeds.
|
|
123
|
+
// Windows named pipes have no file (auto-removed on exit) → nothing to do.
|
|
124
|
+
if (!usesNamedPipe()) {
|
|
125
|
+
try {
|
|
126
|
+
unlinkSync(supervisorSockPath());
|
|
127
|
+
}
|
|
128
|
+
catch { /* ignored */ }
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// ── UDS binding ──────────────────────────────────────────────────────────
|
|
132
|
+
_mkdirParent() {
|
|
133
|
+
// A named pipe has no parent directory to create (the addr is `\\.\pipe\…`).
|
|
134
|
+
if (usesNamedPipe())
|
|
135
|
+
return;
|
|
136
|
+
mkdirSync(dirname(supervisorSockPath()), { recursive: true });
|
|
137
|
+
}
|
|
138
|
+
async _bindUds() {
|
|
139
|
+
const path = supervisorSockPath();
|
|
140
|
+
const pipe = usesNamedPipe();
|
|
141
|
+
// Single-instance guard. PROBE first: a live supervisor answering the
|
|
142
|
+
// connect means we must NOT start a second one. Stealing the socket
|
|
143
|
+
// (unlink + bind) would orphan the running supervisor's children — they'd
|
|
144
|
+
// keep running, unreachable by the CLI. Only on POSIX, when the probe
|
|
145
|
+
// fails (stale socket from a crash), do we unlink + bind. On Windows there
|
|
146
|
+
// is no file: always probe, never unlink (the pipe self-cleans on exit).
|
|
147
|
+
if (pipe || existsSync(path)) {
|
|
148
|
+
const alive = await _probeSupervisor(path);
|
|
149
|
+
if (alive) {
|
|
150
|
+
throw new SupervisorAlreadyRunningError(path);
|
|
151
|
+
}
|
|
152
|
+
if (!pipe) {
|
|
153
|
+
try {
|
|
154
|
+
unlinkSync(path);
|
|
155
|
+
}
|
|
156
|
+
catch { /* will throw on bind if still held */ }
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const server = createServer((socket) => this._onConnection(socket));
|
|
160
|
+
await new Promise((resolve, reject) => {
|
|
161
|
+
server.once("error", reject);
|
|
162
|
+
server.listen(path, () => resolve());
|
|
163
|
+
});
|
|
164
|
+
this.server = server;
|
|
165
|
+
}
|
|
166
|
+
_onConnection(socket) {
|
|
167
|
+
let buf = "";
|
|
168
|
+
socket.setEncoding("utf8");
|
|
169
|
+
socket.on("data", (chunk) => {
|
|
170
|
+
buf += chunk;
|
|
171
|
+
const nl = buf.indexOf("\n");
|
|
172
|
+
if (nl < 0)
|
|
173
|
+
return;
|
|
174
|
+
const line = buf.slice(0, nl);
|
|
175
|
+
// Single request per connection; ignore anything past the newline.
|
|
176
|
+
void this._handleRequest(line)
|
|
177
|
+
.then((reply) => socket.end(encodeReply(reply)))
|
|
178
|
+
.catch((err) => socket.end(encodeReply({ ok: false, error: String(err) })));
|
|
179
|
+
});
|
|
180
|
+
socket.on("error", () => { });
|
|
181
|
+
}
|
|
182
|
+
// ── Request dispatch ─────────────────────────────────────────────────────
|
|
183
|
+
async _handleRequest(line) {
|
|
184
|
+
let req;
|
|
185
|
+
try {
|
|
186
|
+
req = parseRequest(line);
|
|
187
|
+
}
|
|
188
|
+
catch (e) {
|
|
189
|
+
return { ok: false, error: e.message };
|
|
190
|
+
}
|
|
191
|
+
switch (req.op) {
|
|
192
|
+
case "list": return { ok: true, data: { daemons: this._listInfo() } };
|
|
193
|
+
case "status": return { ok: true, data: { daemons: this._listInfo() } };
|
|
194
|
+
case "start_all": return this._opStartAll();
|
|
195
|
+
case "start": return this._opStart(req.id);
|
|
196
|
+
case "stop_all": return this._opStopAll();
|
|
197
|
+
case "stop": return this._opStop(req.id);
|
|
198
|
+
case "restart_all": return this._opRestartAll();
|
|
199
|
+
case "restart": return this._opRestart(req.id);
|
|
200
|
+
case "send": return this._opSend(req.id, req.text);
|
|
201
|
+
case "register": return this._opRegister(req.cwd);
|
|
202
|
+
case "unregister": return this._opUnregister(req.id);
|
|
203
|
+
case "cron_add": return this._opCronAdd(req);
|
|
204
|
+
case "cron_list": return this._opCronList();
|
|
205
|
+
case "cron_remove": return this._opCronRemove(req.job_id);
|
|
206
|
+
case "cron_enable": return this._opCronEnable(req.job_id, req.enabled);
|
|
207
|
+
case "cron_run": return this._opCronRun(req.job_id);
|
|
208
|
+
case "cron_log": return this._opCronLog(req.job_id, req.tail);
|
|
209
|
+
default: {
|
|
210
|
+
const unknown = req.op;
|
|
211
|
+
return { ok: false, error: `unknown op: ${unknown}` };
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// ── Op handlers ──────────────────────────────────────────────────────────
|
|
216
|
+
_listInfo() {
|
|
217
|
+
const registry = listDaemons();
|
|
218
|
+
return registry.map((entry) => {
|
|
219
|
+
const slot = this.children.get(entry.id);
|
|
220
|
+
const name = entry.name ?? defaultAgentName(entry.cwd);
|
|
221
|
+
const info = {
|
|
222
|
+
id: entry.id,
|
|
223
|
+
cwd: entry.cwd,
|
|
224
|
+
name,
|
|
225
|
+
state: slot?.child.state ?? "stopped",
|
|
226
|
+
};
|
|
227
|
+
if (slot) {
|
|
228
|
+
if (slot.child.pid !== undefined)
|
|
229
|
+
info.pid = slot.child.pid;
|
|
230
|
+
if (slot.child.uptimeMs !== undefined)
|
|
231
|
+
info.uptime_s = Math.floor(slot.child.uptimeMs / 1000);
|
|
232
|
+
info.restart_count = slot.child.restartCount;
|
|
233
|
+
}
|
|
234
|
+
return info;
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
_opStartAll() {
|
|
238
|
+
const started = [];
|
|
239
|
+
const already = [];
|
|
240
|
+
for (const entry of listDaemons()) {
|
|
241
|
+
const slot = this.children.get(entry.id);
|
|
242
|
+
if (slot && slot.child.state === "running") {
|
|
243
|
+
already.push(entry.id);
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
this._spawnEntry(entry.id, entry.cwd);
|
|
247
|
+
started.push(entry.id);
|
|
248
|
+
}
|
|
249
|
+
return { ok: true, data: { started, already_running: already } };
|
|
250
|
+
}
|
|
251
|
+
/** Spawn a single registered daemon by id. Idempotent: a daemon already
|
|
252
|
+
* running returns `started: false`. Unknown id → ok:false. This is what
|
|
253
|
+
* `/remote-pi create` calls so a freshly-registered folder boots its Pi
|
|
254
|
+
* immediately instead of waiting for the next supervisor restart. */
|
|
255
|
+
_opStart(id) {
|
|
256
|
+
const entry = listDaemons().find((d) => d.id === id);
|
|
257
|
+
if (!entry)
|
|
258
|
+
return { ok: false, error: `no daemon with id ${id}` };
|
|
259
|
+
const slot = this.children.get(id);
|
|
260
|
+
if (slot && slot.child.state === "running") {
|
|
261
|
+
return { ok: true, data: { id, state: slot.child.state, started: false } };
|
|
262
|
+
}
|
|
263
|
+
this._spawnEntry(entry.id, entry.cwd, entry.name);
|
|
264
|
+
const state = this.children.get(id)?.child.state ?? "starting";
|
|
265
|
+
return { ok: true, data: { id, state, started: true } };
|
|
266
|
+
}
|
|
267
|
+
async _opStopAll() {
|
|
268
|
+
const stopped = [];
|
|
269
|
+
const already = [];
|
|
270
|
+
for (const [id, slot] of this.children) {
|
|
271
|
+
if (slot.child.state !== "running") {
|
|
272
|
+
already.push(id);
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
if (slot.restartTimer !== null) {
|
|
276
|
+
clearTimeout(slot.restartTimer);
|
|
277
|
+
slot.restartTimer = null;
|
|
278
|
+
}
|
|
279
|
+
await slot.child.stop();
|
|
280
|
+
stopped.push(id);
|
|
281
|
+
}
|
|
282
|
+
return { ok: true, data: { stopped, already_stopped: already } };
|
|
283
|
+
}
|
|
284
|
+
/** Stop a single registered daemon by id. Idempotent: a daemon that isn't
|
|
285
|
+
* running returns `stopped: false`. Unknown id → ok:false. Mirrors the
|
|
286
|
+
* per-id semantics of `_opStart`. Cancels any pending restart backoff so a
|
|
287
|
+
* deliberate stop stays stopped. */
|
|
288
|
+
async _opStop(id) {
|
|
289
|
+
const entry = listDaemons().find((d) => d.id === id);
|
|
290
|
+
if (!entry)
|
|
291
|
+
return { ok: false, error: `no daemon with id ${id}` };
|
|
292
|
+
const slot = this.children.get(id);
|
|
293
|
+
if (!slot || slot.child.state !== "running") {
|
|
294
|
+
return { ok: true, data: { id, state: slot?.child.state ?? "stopped", stopped: false } };
|
|
295
|
+
}
|
|
296
|
+
if (slot.restartTimer !== null) {
|
|
297
|
+
clearTimeout(slot.restartTimer);
|
|
298
|
+
slot.restartTimer = null;
|
|
299
|
+
}
|
|
300
|
+
await slot.child.stop();
|
|
301
|
+
return { ok: true, data: { id, state: slot.child.state, stopped: true } };
|
|
302
|
+
}
|
|
303
|
+
/** Restart a single registered daemon by id (stop-if-running, then spawn).
|
|
304
|
+
* Unknown id → ok:false. Resets the crash backoff. */
|
|
305
|
+
async _opRestart(id) {
|
|
306
|
+
const entry = listDaemons().find((d) => d.id === id);
|
|
307
|
+
if (!entry)
|
|
308
|
+
return { ok: false, error: `no daemon with id ${id}` };
|
|
309
|
+
const slot = this.children.get(id);
|
|
310
|
+
if (slot && slot.child.state === "running") {
|
|
311
|
+
if (slot.restartTimer !== null) {
|
|
312
|
+
clearTimeout(slot.restartTimer);
|
|
313
|
+
slot.restartTimer = null;
|
|
314
|
+
}
|
|
315
|
+
await slot.child.stop();
|
|
316
|
+
}
|
|
317
|
+
this._spawnEntry(entry.id, entry.cwd, entry.name);
|
|
318
|
+
const state = this.children.get(id)?.child.state ?? "starting";
|
|
319
|
+
return { ok: true, data: { id, state, restarted: true } };
|
|
320
|
+
}
|
|
321
|
+
async _opRestartAll() {
|
|
322
|
+
const stopReply = await this._opStopAll();
|
|
323
|
+
if (!stopReply.ok)
|
|
324
|
+
return stopReply;
|
|
325
|
+
const startReply = this._opStartAll();
|
|
326
|
+
if (!startReply.ok)
|
|
327
|
+
return startReply;
|
|
328
|
+
const restarted = startReply.data.started;
|
|
329
|
+
return { ok: true, data: { restarted } };
|
|
330
|
+
}
|
|
331
|
+
_opSend(id, text) {
|
|
332
|
+
const slot = this.children.get(id);
|
|
333
|
+
if (!slot)
|
|
334
|
+
return { ok: false, error: `daemon ${id} not running` };
|
|
335
|
+
if (slot.child.state !== "running") {
|
|
336
|
+
return { ok: false, error: `daemon ${id} state is ${slot.child.state}` };
|
|
337
|
+
}
|
|
338
|
+
const ok = slot.child.sendPrompt(text);
|
|
339
|
+
return { ok: true, data: { id, delivered: ok } };
|
|
340
|
+
}
|
|
341
|
+
_opRegister(rawCwd) {
|
|
342
|
+
try {
|
|
343
|
+
const { id, cwd } = addDaemon(rawCwd);
|
|
344
|
+
return { ok: true, data: { id, cwd } };
|
|
345
|
+
}
|
|
346
|
+
catch (e) {
|
|
347
|
+
return { ok: false, error: e.message };
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
async _opUnregister(id) {
|
|
351
|
+
// Stop the child first so we don't leave an orphan when the registry
|
|
352
|
+
// entry is gone.
|
|
353
|
+
const slot = this.children.get(id);
|
|
354
|
+
if (slot) {
|
|
355
|
+
if (slot.restartTimer !== null) {
|
|
356
|
+
clearTimeout(slot.restartTimer);
|
|
357
|
+
slot.restartTimer = null;
|
|
358
|
+
}
|
|
359
|
+
await slot.child.stop();
|
|
360
|
+
this.children.delete(id);
|
|
361
|
+
}
|
|
362
|
+
try {
|
|
363
|
+
const result = removeDaemon(id);
|
|
364
|
+
return { ok: true, data: result };
|
|
365
|
+
}
|
|
366
|
+
catch (e) {
|
|
367
|
+
return { ok: false, error: e.message };
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
// ── Cron ops + engine (plan/39) ────────────────────────────────────────────
|
|
371
|
+
_opCronAdd(req) {
|
|
372
|
+
const v = validateSchedule(req.schedule, req.tz);
|
|
373
|
+
if (!v.ok)
|
|
374
|
+
return { ok: false, error: v.error ?? "invalid schedule" };
|
|
375
|
+
const input = { daemon_id: req.daemon_id, schedule: req.schedule, prompt: req.prompt };
|
|
376
|
+
if (req.tz !== undefined)
|
|
377
|
+
input.tz = req.tz;
|
|
378
|
+
if (req.skip_if_busy !== undefined)
|
|
379
|
+
input.skip_if_busy = req.skip_if_busy;
|
|
380
|
+
if (req.wake !== undefined)
|
|
381
|
+
input.wake = req.wake;
|
|
382
|
+
if (req.catchup !== undefined)
|
|
383
|
+
input.catchup = req.catchup;
|
|
384
|
+
const job = addCronJob(input);
|
|
385
|
+
this._scheduleCron(job);
|
|
386
|
+
return { ok: true, data: { job: this._jobView(job) } };
|
|
387
|
+
}
|
|
388
|
+
_opCronList() {
|
|
389
|
+
const jobs = listCronJobs().map((j) => this._jobView(j));
|
|
390
|
+
return { ok: true, data: { jobs } };
|
|
391
|
+
}
|
|
392
|
+
_opCronRemove(jobId) {
|
|
393
|
+
const removed = removeCronJob(jobId);
|
|
394
|
+
this._stopCron(jobId);
|
|
395
|
+
return { ok: true, data: { removed } };
|
|
396
|
+
}
|
|
397
|
+
_opCronEnable(jobId, enabled) {
|
|
398
|
+
const updated = setJobEnabled(jobId, enabled);
|
|
399
|
+
if (updated) {
|
|
400
|
+
this._stopCron(jobId);
|
|
401
|
+
const job = getCronJob(jobId);
|
|
402
|
+
if (enabled && job)
|
|
403
|
+
this._scheduleCron(job);
|
|
404
|
+
}
|
|
405
|
+
return { ok: true, data: { job_id: jobId, enabled, updated } };
|
|
406
|
+
}
|
|
407
|
+
async _opCronRun(jobId) {
|
|
408
|
+
if (!getCronJob(jobId))
|
|
409
|
+
return { ok: false, error: `no cron job with id ${jobId}` };
|
|
410
|
+
const result = await this.fireJob(jobId, { manual: true });
|
|
411
|
+
return { ok: true, data: { job_id: jobId, result } };
|
|
412
|
+
}
|
|
413
|
+
_opCronLog(jobId, tail) {
|
|
414
|
+
const opts = {};
|
|
415
|
+
if (jobId !== undefined)
|
|
416
|
+
opts.jobId = jobId;
|
|
417
|
+
if (tail !== undefined)
|
|
418
|
+
opts.tail = tail;
|
|
419
|
+
return { ok: true, data: { entries: readCronLog(opts) } };
|
|
420
|
+
}
|
|
421
|
+
_jobView(job) {
|
|
422
|
+
const next = nextRunFor(job);
|
|
423
|
+
return { ...job, next_run: next ? next.toISOString() : null };
|
|
424
|
+
}
|
|
425
|
+
/** Rebuild all live `Cron` schedules from the registry (enabled jobs only).
|
|
426
|
+
* Called on start; mutations reconcile incrementally via _scheduleCron/_stopCron. */
|
|
427
|
+
_reconcileCron() {
|
|
428
|
+
for (const c of this.cronJobs.values())
|
|
429
|
+
c.stop();
|
|
430
|
+
this.cronJobs.clear();
|
|
431
|
+
for (const job of listCronJobs()) {
|
|
432
|
+
if (job.enabled)
|
|
433
|
+
this._scheduleCron(job);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
_scheduleCron(job) {
|
|
437
|
+
this._stopCron(job.id);
|
|
438
|
+
try {
|
|
439
|
+
const opts = job.tz ? { timezone: job.tz, name: job.id } : { name: job.id };
|
|
440
|
+
const cron = new Cron(job.schedule, opts, () => { void this.fireJob(job.id); });
|
|
441
|
+
this.cronJobs.set(job.id, cron);
|
|
442
|
+
}
|
|
443
|
+
catch (e) {
|
|
444
|
+
process.stderr.write(`[remote-pi-supervisord] cron schedule failed for ${job.id}: ${String(e)}\n`);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
_stopCron(jobId) {
|
|
448
|
+
const c = this.cronJobs.get(jobId);
|
|
449
|
+
if (c) {
|
|
450
|
+
c.stop();
|
|
451
|
+
this.cronJobs.delete(jobId);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
/** Detail 2: on start, run a catchup job once if its previous scheduled run
|
|
455
|
+
* was missed while the supervisor was down. Opt-in (`catchup`), at most 1×. */
|
|
456
|
+
_runCatchup() {
|
|
457
|
+
for (const job of listCronJobs()) {
|
|
458
|
+
if (!job.enabled || !job.catchup)
|
|
459
|
+
continue;
|
|
460
|
+
try {
|
|
461
|
+
const cron = new Cron(job.schedule, job.tz ? { timezone: job.tz } : {});
|
|
462
|
+
const prev = cron.previousRun();
|
|
463
|
+
cron.stop();
|
|
464
|
+
if (!prev)
|
|
465
|
+
continue;
|
|
466
|
+
const lastRunMs = job.last_run ? Date.parse(job.last_run) : 0;
|
|
467
|
+
if (prev.getTime() > lastRunMs)
|
|
468
|
+
void this.fireJob(job.id, { manual: true });
|
|
469
|
+
}
|
|
470
|
+
catch { /* skip a malformed schedule */ }
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Fires a cron job: resolves the daemon, decides the action (decideFireAction),
|
|
475
|
+
* acts, and records the outcome — ALWAYS one `last_status` update + one JSONL
|
|
476
|
+
* line, for both fires and skips. Returns the result. `manual` bypasses the
|
|
477
|
+
* disabled-skip (used by `cron run` + catchup).
|
|
478
|
+
*/
|
|
479
|
+
async fireJob(jobId, opts = {}) {
|
|
480
|
+
const job = getCronJob(jobId);
|
|
481
|
+
if (!job)
|
|
482
|
+
return "missing";
|
|
483
|
+
let result;
|
|
484
|
+
if (!job.enabled && !opts.manual) {
|
|
485
|
+
result = "skipped_disabled";
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
const slot = this.children.get(job.daemon_id);
|
|
489
|
+
const running = !!slot && slot.child.state === "running";
|
|
490
|
+
let busy = false;
|
|
491
|
+
if (running && job.skip_if_busy)
|
|
492
|
+
busy = await slot.child.refreshBusy();
|
|
493
|
+
const action = decideFireAction({ running, busy, wake: job.wake, skipIfBusy: job.skip_if_busy });
|
|
494
|
+
if (action === "skip_down") {
|
|
495
|
+
result = "skipped_down";
|
|
496
|
+
}
|
|
497
|
+
else if (action === "skip_busy") {
|
|
498
|
+
result = "skipped_busy";
|
|
499
|
+
}
|
|
500
|
+
else if (action === "wake_and_send") {
|
|
501
|
+
const entry = listDaemons().find((d) => d.id === job.daemon_id);
|
|
502
|
+
if (!entry) {
|
|
503
|
+
result = "skipped_down";
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
this._spawnEntry(entry.id, entry.cwd, entry.name);
|
|
507
|
+
const woke = this.children.get(job.daemon_id);
|
|
508
|
+
result = woke && woke.child.sendPrompt(job.prompt) ? "woke_and_delivered" : "deliver_failed";
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
result = slot.child.sendPrompt(job.prompt) ? "delivered" : "deliver_failed";
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
const at = new Date().toISOString();
|
|
516
|
+
recordRun(job.id, at, result);
|
|
517
|
+
appendCronLog({ job_id: job.id, daemon_id: job.daemon_id, schedule: job.schedule, result, prompt: job.prompt });
|
|
518
|
+
return result;
|
|
519
|
+
}
|
|
520
|
+
// ── Child lifecycle ──────────────────────────────────────────────────────
|
|
521
|
+
_spawnAllFromRegistry() {
|
|
522
|
+
for (const entry of listDaemons()) {
|
|
523
|
+
this._spawnEntry(entry.id, entry.cwd, entry.name);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
_spawnEntry(id, cwd, name) {
|
|
527
|
+
// Clean up any prior slot (e.g. crashed + waiting for backoff).
|
|
528
|
+
const existing = this.children.get(id);
|
|
529
|
+
if (existing) {
|
|
530
|
+
if (existing.restartTimer !== null)
|
|
531
|
+
clearTimeout(existing.restartTimer);
|
|
532
|
+
// If somehow the child is still alive, stop it first so we don't
|
|
533
|
+
// leak. Fire-and-forget — caller doesn't await.
|
|
534
|
+
if (existing.child.state === "running")
|
|
535
|
+
void existing.child.stop();
|
|
536
|
+
}
|
|
537
|
+
// Build the daemon's config and inject it via REMOTE_PI_DIRECT_CONFIG —
|
|
538
|
+
// no per-cwd config file needed. The daemon scopes by (cwd, name) like any
|
|
539
|
+
// agent (plan/38); relay on.
|
|
540
|
+
const config = {
|
|
541
|
+
agent_name: name ?? defaultAgentName(cwd),
|
|
542
|
+
auto_start_relay: true,
|
|
543
|
+
};
|
|
544
|
+
const childOpts = {
|
|
545
|
+
extensionPath: this.opts.extensionPath,
|
|
546
|
+
cwd,
|
|
547
|
+
config,
|
|
548
|
+
};
|
|
549
|
+
if (this.opts.piBin !== undefined)
|
|
550
|
+
childOpts.piBin = this.opts.piBin;
|
|
551
|
+
const child = new RpcChild(childOpts);
|
|
552
|
+
const slot = { id, cwd, child, restartTimer: null, restartAttempt: 0 };
|
|
553
|
+
this.children.set(id, slot);
|
|
554
|
+
child.on("exit", (evt) => this._onChildExit(id, evt));
|
|
555
|
+
child.spawn();
|
|
556
|
+
}
|
|
557
|
+
_onChildExit(id, evt) {
|
|
558
|
+
if (this.shuttingDown)
|
|
559
|
+
return;
|
|
560
|
+
const slot = this.children.get(id);
|
|
561
|
+
if (!slot)
|
|
562
|
+
return;
|
|
563
|
+
if (!evt.isCrash) {
|
|
564
|
+
// Clean shutdown (e.g. via `stop_all`). Don't auto-restart.
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
if (evt.code === EXIT_DAEMON_FRESH_SESSION) {
|
|
568
|
+
// App-triggered daemon `/new`: this is an intentional recycle, not a
|
|
569
|
+
// crash. Restart immediately and don't burn the crash backoff budget.
|
|
570
|
+
slot.restartAttempt = 0;
|
|
571
|
+
slot.child.noteRestart();
|
|
572
|
+
slot.child.spawn();
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
// Crash: schedule restart with backoff. After exhausting the schedule
|
|
576
|
+
// we give up and stay in `crashed`.
|
|
577
|
+
if (slot.restartAttempt >= RESTART_BACKOFFS_MS.length) {
|
|
578
|
+
process.stderr.write(`[remote-pi-supervisord] giving up restart for ${id} after ${slot.restartAttempt} attempts\n`);
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
const delay = RESTART_BACKOFFS_MS[slot.restartAttempt];
|
|
582
|
+
process.stderr.write(`[remote-pi-supervisord] scheduling restart of ${id} in ${delay}ms (attempt ${slot.restartAttempt + 1})\n`);
|
|
583
|
+
slot.restartTimer = setTimeout(() => {
|
|
584
|
+
slot.restartTimer = null;
|
|
585
|
+
slot.restartAttempt += 1;
|
|
586
|
+
slot.child.noteRestart();
|
|
587
|
+
slot.child.spawn();
|
|
588
|
+
}, delay);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
/** Test helper: derive id from cwd without going through the registry. */
|
|
592
|
+
export function _idForCwdForTest(cwd) { return daemonIdForCwd(cwd); }
|
|
593
|
+
/** Exported for the bin/supervisord entry + tests to know where the
|
|
594
|
+
* supervisor will bind. */
|
|
595
|
+
export function getSupervisorSockPath() { return supervisorSockPath(); }
|
|
596
|
+
//# sourceMappingURL=supervisor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor.js","sourceRoot":"","sources":["../../src/daemon/supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAA4B,MAAM,UAAU,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,eA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,CAAC,EAAE,KAAK,CAAC,CAAC;IACZ,CAAC;CACF;AAED,0EAA0E;AAC1E,MAAM,UAAU,gBAAgB,CAAC,GAAW,IAAY,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAErF;4BAC4B;AAC5B,MAAM,UAAU,qBAAqB,KAAa,OAAO,kBAAkB,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { AskResponseEnrichmentWire, ExtensionUiResponseWire, ServerMessage } from "./protocol/types.js";
|
|
3
|
+
export interface ExtensionUiBridge {
|
|
4
|
+
/** Route an inbound `extension_ui_response` from a peer back to pi-ask. */
|
|
5
|
+
respond(msg: ExtensionUiResponseWire): void;
|
|
6
|
+
/**
|
|
7
|
+
* Requests for flows still awaiting an answer, for `session_sync` to replay.
|
|
8
|
+
*
|
|
9
|
+
* The `started` broadcast fires exactly once. A peer that connects *after*
|
|
10
|
+
* a flow opened never saw it: history replayed, but the interactive frame
|
|
11
|
+
* did not, so the phone showed the ask_user tool call as plain text while
|
|
12
|
+
* the desktop sat blocked on the TUI dialog. Replaying on sync closes that
|
|
13
|
+
* hole — the common real-world case is the agent asking while the app is
|
|
14
|
+
* closed.
|
|
15
|
+
*/
|
|
16
|
+
pendingRequests(): ServerMessage[];
|
|
17
|
+
/** Drop all subscriptions + state (best-effort teardown). */
|
|
18
|
+
dispose(): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Wire pi-ask's event contract to the relay's extension_ui_request/response
|
|
22
|
+
* frames. Returns `null` only if the SDK exposes no usable `events` bus (defensive
|
|
23
|
+
* — modern Pi always has one); callers stay null-safe.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createExtensionUiBridge(pi: ExtensionAPI, broadcast: (msg: ServerMessage) => void): ExtensionUiBridge | null;
|
|
26
|
+
export type { AskResponseEnrichmentWire, ExtensionUiResponseWire };
|