@pocketcoder/host 0.0.2
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/LICENSE +53 -0
- package/README.md +1106 -0
- package/dist/__tests__/daemon-startup.test.d.ts +2 -0
- package/dist/__tests__/daemon-startup.test.d.ts.map +1 -0
- package/dist/__tests__/daemon-startup.test.js +339 -0
- package/dist/__tests__/daemon-startup.test.js.map +1 -0
- package/dist/__tests__/env.test.d.ts +2 -0
- package/dist/__tests__/env.test.d.ts.map +1 -0
- package/dist/__tests__/env.test.js +44 -0
- package/dist/__tests__/env.test.js.map +1 -0
- package/dist/auth/__tests__/gateway-auth.test.d.ts +2 -0
- package/dist/auth/__tests__/gateway-auth.test.d.ts.map +1 -0
- package/dist/auth/__tests__/gateway-auth.test.js +208 -0
- package/dist/auth/__tests__/gateway-auth.test.js.map +1 -0
- package/dist/auth/__tests__/login-manager.test.d.ts +2 -0
- package/dist/auth/__tests__/login-manager.test.d.ts.map +1 -0
- package/dist/auth/__tests__/login-manager.test.js +160 -0
- package/dist/auth/__tests__/login-manager.test.js.map +1 -0
- package/dist/auth/__tests__/login.test.d.ts +2 -0
- package/dist/auth/__tests__/login.test.d.ts.map +1 -0
- package/dist/auth/__tests__/login.test.js +165 -0
- package/dist/auth/__tests__/login.test.js.map +1 -0
- package/dist/auth/__tests__/manual-flow.test.d.ts +2 -0
- package/dist/auth/__tests__/manual-flow.test.d.ts.map +1 -0
- package/dist/auth/__tests__/manual-flow.test.js +72 -0
- package/dist/auth/__tests__/manual-flow.test.js.map +1 -0
- package/dist/auth/__tests__/oauth-server.test.d.ts +2 -0
- package/dist/auth/__tests__/oauth-server.test.d.ts.map +1 -0
- package/dist/auth/__tests__/oauth-server.test.js +104 -0
- package/dist/auth/__tests__/oauth-server.test.js.map +1 -0
- package/dist/auth/__tests__/token-refresh.test.d.ts +2 -0
- package/dist/auth/__tests__/token-refresh.test.d.ts.map +1 -0
- package/dist/auth/__tests__/token-refresh.test.js +205 -0
- package/dist/auth/__tests__/token-refresh.test.js.map +1 -0
- package/dist/auth/__tests__/token-storage.test.d.ts +2 -0
- package/dist/auth/__tests__/token-storage.test.d.ts.map +1 -0
- package/dist/auth/__tests__/token-storage.test.js +145 -0
- package/dist/auth/__tests__/token-storage.test.js.map +1 -0
- package/dist/auth/gateway-auth.d.ts +38 -0
- package/dist/auth/gateway-auth.d.ts.map +1 -0
- package/dist/auth/gateway-auth.js +117 -0
- package/dist/auth/gateway-auth.js.map +1 -0
- package/dist/auth/login.d.ts +43 -0
- package/dist/auth/login.d.ts.map +1 -0
- package/dist/auth/login.js +180 -0
- package/dist/auth/login.js.map +1 -0
- package/dist/auth/manual-flow.d.ts +16 -0
- package/dist/auth/manual-flow.d.ts.map +1 -0
- package/dist/auth/manual-flow.js +44 -0
- package/dist/auth/manual-flow.js.map +1 -0
- package/dist/auth/oauth-server.d.ts +22 -0
- package/dist/auth/oauth-server.d.ts.map +1 -0
- package/dist/auth/oauth-server.js +165 -0
- package/dist/auth/oauth-server.js.map +1 -0
- package/dist/auth/token-refresh.d.ts +36 -0
- package/dist/auth/token-refresh.d.ts.map +1 -0
- package/dist/auth/token-refresh.js +116 -0
- package/dist/auth/token-refresh.js.map +1 -0
- package/dist/auth/token-storage.d.ts +20 -0
- package/dist/auth/token-storage.d.ts.map +1 -0
- package/dist/auth/token-storage.js +71 -0
- package/dist/auth/token-storage.js.map +1 -0
- package/dist/auth/types.d.ts +12 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +2 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/cli/commands/__tests__/cli-auth.test.d.ts +2 -0
- package/dist/cli/commands/__tests__/cli-auth.test.d.ts.map +1 -0
- package/dist/cli/commands/__tests__/cli-auth.test.js +135 -0
- package/dist/cli/commands/__tests__/cli-auth.test.js.map +1 -0
- package/dist/cli/commands/__tests__/cli-autostart.test.d.ts +2 -0
- package/dist/cli/commands/__tests__/cli-autostart.test.d.ts.map +1 -0
- package/dist/cli/commands/__tests__/cli-autostart.test.js +95 -0
- package/dist/cli/commands/__tests__/cli-autostart.test.js.map +1 -0
- package/dist/cli/commands/__tests__/cli-daemon.test.d.ts +2 -0
- package/dist/cli/commands/__tests__/cli-daemon.test.d.ts.map +1 -0
- package/dist/cli/commands/__tests__/cli-daemon.test.js +144 -0
- package/dist/cli/commands/__tests__/cli-daemon.test.js.map +1 -0
- package/dist/cli/commands/__tests__/cli-logs.test.d.ts +2 -0
- package/dist/cli/commands/__tests__/cli-logs.test.d.ts.map +1 -0
- package/dist/cli/commands/__tests__/cli-logs.test.js +85 -0
- package/dist/cli/commands/__tests__/cli-logs.test.js.map +1 -0
- package/dist/cli/commands/__tests__/cli-machine.test.d.ts +2 -0
- package/dist/cli/commands/__tests__/cli-machine.test.d.ts.map +1 -0
- package/dist/cli/commands/__tests__/cli-machine.test.js +119 -0
- package/dist/cli/commands/__tests__/cli-machine.test.js.map +1 -0
- package/dist/cli/commands/__tests__/cli-projects.test.d.ts +2 -0
- package/dist/cli/commands/__tests__/cli-projects.test.d.ts.map +1 -0
- package/dist/cli/commands/__tests__/cli-projects.test.js +246 -0
- package/dist/cli/commands/__tests__/cli-projects.test.js.map +1 -0
- package/dist/cli/commands/__tests__/cli-status.test.d.ts +2 -0
- package/dist/cli/commands/__tests__/cli-status.test.d.ts.map +1 -0
- package/dist/cli/commands/__tests__/cli-status.test.js +153 -0
- package/dist/cli/commands/__tests__/cli-status.test.js.map +1 -0
- package/dist/cli/commands/add.d.ts +7 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/add.js +37 -0
- package/dist/cli/commands/add.js.map +1 -0
- package/dist/cli/commands/autostart.d.ts +16 -0
- package/dist/cli/commands/autostart.d.ts.map +1 -0
- package/dist/cli/commands/autostart.js +47 -0
- package/dist/cli/commands/autostart.js.map +1 -0
- package/dist/cli/commands/login.d.ts +6 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/login.js +19 -0
- package/dist/cli/commands/login.js.map +1 -0
- package/dist/cli/commands/logout.d.ts +7 -0
- package/dist/cli/commands/logout.d.ts.map +1 -0
- package/dist/cli/commands/logout.js +50 -0
- package/dist/cli/commands/logout.js.map +1 -0
- package/dist/cli/commands/logs.d.ts +9 -0
- package/dist/cli/commands/logs.d.ts.map +1 -0
- package/dist/cli/commands/logs.js +113 -0
- package/dist/cli/commands/logs.js.map +1 -0
- package/dist/cli/commands/machine.d.ts +8 -0
- package/dist/cli/commands/machine.d.ts.map +1 -0
- package/dist/cli/commands/machine.js +78 -0
- package/dist/cli/commands/machine.js.map +1 -0
- package/dist/cli/commands/projects.d.ts +6 -0
- package/dist/cli/commands/projects.d.ts.map +1 -0
- package/dist/cli/commands/projects.js +28 -0
- package/dist/cli/commands/projects.js.map +1 -0
- package/dist/cli/commands/remove.d.ts +7 -0
- package/dist/cli/commands/remove.d.ts.map +1 -0
- package/dist/cli/commands/remove.js +31 -0
- package/dist/cli/commands/remove.js.map +1 -0
- package/dist/cli/commands/start.d.ts +14 -0
- package/dist/cli/commands/start.d.ts.map +1 -0
- package/dist/cli/commands/start.js +67 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/status.d.ts +6 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +68 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/stop.d.ts +6 -0
- package/dist/cli/commands/stop.d.ts.map +1 -0
- package/dist/cli/commands/stop.js +39 -0
- package/dist/cli/commands/stop.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +5 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/notify-project-sync.d.ts +11 -0
- package/dist/cli/notify-project-sync.d.ts.map +1 -0
- package/dist/cli/notify-project-sync.js +45 -0
- package/dist/cli/notify-project-sync.js.map +1 -0
- package/dist/cli/notify-re-register.d.ts +7 -0
- package/dist/cli/notify-re-register.d.ts.map +1 -0
- package/dist/cli/notify-re-register.js +34 -0
- package/dist/cli/notify-re-register.js.map +1 -0
- package/dist/cli/program.d.ts +6 -0
- package/dist/cli/program.d.ts.map +1 -0
- package/dist/cli/program.js +66 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/config/__tests__/index.test.d.ts +2 -0
- package/dist/config/__tests__/index.test.d.ts.map +1 -0
- package/dist/config/__tests__/index.test.js +146 -0
- package/dist/config/__tests__/index.test.js.map +1 -0
- package/dist/config/index.d.ts +13 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +77 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/schema.d.ts +26 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +54 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/control-plane/__tests__/server.test.d.ts +2 -0
- package/dist/control-plane/__tests__/server.test.d.ts.map +1 -0
- package/dist/control-plane/__tests__/server.test.js +64 -0
- package/dist/control-plane/__tests__/server.test.js.map +1 -0
- package/dist/control-plane/routes/__tests__/status.test.d.ts +2 -0
- package/dist/control-plane/routes/__tests__/status.test.d.ts.map +1 -0
- package/dist/control-plane/routes/__tests__/status.test.js +152 -0
- package/dist/control-plane/routes/__tests__/status.test.js.map +1 -0
- package/dist/control-plane/routes/__tests__/stop.test.d.ts +2 -0
- package/dist/control-plane/routes/__tests__/stop.test.d.ts.map +1 -0
- package/dist/control-plane/routes/__tests__/stop.test.js +92 -0
- package/dist/control-plane/routes/__tests__/stop.test.js.map +1 -0
- package/dist/control-plane/routes/health.d.ts +3 -0
- package/dist/control-plane/routes/health.d.ts.map +1 -0
- package/dist/control-plane/routes/health.js +14 -0
- package/dist/control-plane/routes/health.js.map +1 -0
- package/dist/control-plane/routes/machine-label.d.ts +8 -0
- package/dist/control-plane/routes/machine-label.d.ts.map +1 -0
- package/dist/control-plane/routes/machine-label.js +32 -0
- package/dist/control-plane/routes/machine-label.js.map +1 -0
- package/dist/control-plane/routes/project-sync.d.ts +12 -0
- package/dist/control-plane/routes/project-sync.d.ts.map +1 -0
- package/dist/control-plane/routes/project-sync.js +63 -0
- package/dist/control-plane/routes/project-sync.js.map +1 -0
- package/dist/control-plane/routes/re-register.d.ts +9 -0
- package/dist/control-plane/routes/re-register.d.ts.map +1 -0
- package/dist/control-plane/routes/re-register.js +56 -0
- package/dist/control-plane/routes/re-register.js.map +1 -0
- package/dist/control-plane/routes/status.d.ts +49 -0
- package/dist/control-plane/routes/status.d.ts.map +1 -0
- package/dist/control-plane/routes/status.js +55 -0
- package/dist/control-plane/routes/status.js.map +1 -0
- package/dist/control-plane/routes/stop.d.ts +7 -0
- package/dist/control-plane/routes/stop.d.ts.map +1 -0
- package/dist/control-plane/routes/stop.js +25 -0
- package/dist/control-plane/routes/stop.js.map +1 -0
- package/dist/control-plane/server.d.ts +10 -0
- package/dist/control-plane/server.d.ts.map +1 -0
- package/dist/control-plane/server.js +39 -0
- package/dist/control-plane/server.js.map +1 -0
- package/dist/daemon.d.ts +23 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +533 -0
- package/dist/daemon.js.map +1 -0
- package/dist/db/__tests__/cleanup.test.d.ts +2 -0
- package/dist/db/__tests__/cleanup.test.d.ts.map +1 -0
- package/dist/db/__tests__/cleanup.test.js +153 -0
- package/dist/db/__tests__/cleanup.test.js.map +1 -0
- package/dist/db/__tests__/database.test.d.ts +2 -0
- package/dist/db/__tests__/database.test.d.ts.map +1 -0
- package/dist/db/__tests__/database.test.js +93 -0
- package/dist/db/__tests__/database.test.js.map +1 -0
- package/dist/db/__tests__/migrator.test.d.ts +2 -0
- package/dist/db/__tests__/migrator.test.d.ts.map +1 -0
- package/dist/db/__tests__/migrator.test.js +146 -0
- package/dist/db/__tests__/migrator.test.js.map +1 -0
- package/dist/db/cleanup.d.ts +20 -0
- package/dist/db/cleanup.d.ts.map +1 -0
- package/dist/db/cleanup.js +67 -0
- package/dist/db/cleanup.js.map +1 -0
- package/dist/db/database.d.ts +18 -0
- package/dist/db/database.d.ts.map +1 -0
- package/dist/db/database.js +41 -0
- package/dist/db/database.js.map +1 -0
- package/dist/db/migrations.d.ts +7 -0
- package/dist/db/migrations.d.ts.map +1 -0
- package/dist/db/migrations.js +32 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/migrator.d.ts +26 -0
- package/dist/db/migrator.d.ts.map +1 -0
- package/dist/db/migrator.js +105 -0
- package/dist/db/migrator.js.map +1 -0
- package/dist/db/repositories/__tests__/command-runs.test.d.ts +2 -0
- package/dist/db/repositories/__tests__/command-runs.test.d.ts.map +1 -0
- package/dist/db/repositories/__tests__/command-runs.test.js +90 -0
- package/dist/db/repositories/__tests__/command-runs.test.js.map +1 -0
- package/dist/db/repositories/__tests__/fs-state.test.d.ts +2 -0
- package/dist/db/repositories/__tests__/fs-state.test.d.ts.map +1 -0
- package/dist/db/repositories/__tests__/fs-state.test.js +77 -0
- package/dist/db/repositories/__tests__/fs-state.test.js.map +1 -0
- package/dist/db/repositories/__tests__/projects.test.d.ts +2 -0
- package/dist/db/repositories/__tests__/projects.test.d.ts.map +1 -0
- package/dist/db/repositories/__tests__/projects.test.js +84 -0
- package/dist/db/repositories/__tests__/projects.test.js.map +1 -0
- package/dist/db/repositories/__tests__/terminal-sessions.test.d.ts +2 -0
- package/dist/db/repositories/__tests__/terminal-sessions.test.d.ts.map +1 -0
- package/dist/db/repositories/__tests__/terminal-sessions.test.js +93 -0
- package/dist/db/repositories/__tests__/terminal-sessions.test.js.map +1 -0
- package/dist/db/repositories/command-runs.d.ts +28 -0
- package/dist/db/repositories/command-runs.d.ts.map +1 -0
- package/dist/db/repositories/command-runs.js +42 -0
- package/dist/db/repositories/command-runs.js.map +1 -0
- package/dist/db/repositories/fs-state.d.ts +28 -0
- package/dist/db/repositories/fs-state.d.ts.map +1 -0
- package/dist/db/repositories/fs-state.js +48 -0
- package/dist/db/repositories/fs-state.js.map +1 -0
- package/dist/db/repositories/projects.d.ts +33 -0
- package/dist/db/repositories/projects.d.ts.map +1 -0
- package/dist/db/repositories/projects.js +50 -0
- package/dist/db/repositories/projects.js.map +1 -0
- package/dist/db/repositories/terminal-sessions.d.ts +28 -0
- package/dist/db/repositories/terminal-sessions.d.ts.map +1 -0
- package/dist/db/repositories/terminal-sessions.js +47 -0
- package/dist/db/repositories/terminal-sessions.js.map +1 -0
- package/dist/db/schema.d.ts +6 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +49 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/env.d.ts +15 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +23 -0
- package/dist/env.js.map +1 -0
- package/dist/errors/__tests__/index.test.d.ts +2 -0
- package/dist/errors/__tests__/index.test.d.ts.map +1 -0
- package/dist/errors/__tests__/index.test.js +105 -0
- package/dist/errors/__tests__/index.test.js.map +1 -0
- package/dist/errors/index.d.ts +36 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +54 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/gateway/__tests__/message-router.test.d.ts +2 -0
- package/dist/gateway/__tests__/message-router.test.d.ts.map +1 -0
- package/dist/gateway/__tests__/message-router.test.js +225 -0
- package/dist/gateway/__tests__/message-router.test.js.map +1 -0
- package/dist/gateway/__tests__/reconnection.test.d.ts +2 -0
- package/dist/gateway/__tests__/reconnection.test.d.ts.map +1 -0
- package/dist/gateway/__tests__/reconnection.test.js +244 -0
- package/dist/gateway/__tests__/reconnection.test.js.map +1 -0
- package/dist/gateway/__tests__/websocket-client.test.d.ts +2 -0
- package/dist/gateway/__tests__/websocket-client.test.d.ts.map +1 -0
- package/dist/gateway/__tests__/websocket-client.test.js +249 -0
- package/dist/gateway/__tests__/websocket-client.test.js.map +1 -0
- package/dist/gateway/gateway-request.d.ts +17 -0
- package/dist/gateway/gateway-request.d.ts.map +1 -0
- package/dist/gateway/gateway-request.js +39 -0
- package/dist/gateway/gateway-request.js.map +1 -0
- package/dist/gateway/message-router.d.ts +31 -0
- package/dist/gateway/message-router.d.ts.map +1 -0
- package/dist/gateway/message-router.js +91 -0
- package/dist/gateway/message-router.js.map +1 -0
- package/dist/gateway/messages/__tests__/daemon-register.test.d.ts +2 -0
- package/dist/gateway/messages/__tests__/daemon-register.test.d.ts.map +1 -0
- package/dist/gateway/messages/__tests__/daemon-register.test.js +113 -0
- package/dist/gateway/messages/__tests__/daemon-register.test.js.map +1 -0
- package/dist/gateway/messages/__tests__/project-sync.test.d.ts +2 -0
- package/dist/gateway/messages/__tests__/project-sync.test.d.ts.map +1 -0
- package/dist/gateway/messages/__tests__/project-sync.test.js +92 -0
- package/dist/gateway/messages/__tests__/project-sync.test.js.map +1 -0
- package/dist/gateway/messages/daemon-register.d.ts +13 -0
- package/dist/gateway/messages/daemon-register.d.ts.map +1 -0
- package/dist/gateway/messages/daemon-register.js +39 -0
- package/dist/gateway/messages/daemon-register.js.map +1 -0
- package/dist/gateway/messages/project-sync.d.ts +16 -0
- package/dist/gateway/messages/project-sync.d.ts.map +1 -0
- package/dist/gateway/messages/project-sync.js +42 -0
- package/dist/gateway/messages/project-sync.js.map +1 -0
- package/dist/gateway/types.d.ts +41 -0
- package/dist/gateway/types.d.ts.map +1 -0
- package/dist/gateway/types.js +5 -0
- package/dist/gateway/types.js.map +1 -0
- package/dist/gateway/websocket-client.d.ts +55 -0
- package/dist/gateway/websocket-client.d.ts.map +1 -0
- package/dist/gateway/websocket-client.js +185 -0
- package/dist/gateway/websocket-client.js.map +1 -0
- package/dist/handlers/__tests__/agent-cancel.test.d.ts +2 -0
- package/dist/handlers/__tests__/agent-cancel.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/agent-cancel.test.js +152 -0
- package/dist/handlers/__tests__/agent-cancel.test.js.map +1 -0
- package/dist/handlers/__tests__/agent-message.test.d.ts +2 -0
- package/dist/handlers/__tests__/agent-message.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/agent-message.test.js +270 -0
- package/dist/handlers/__tests__/agent-message.test.js.map +1 -0
- package/dist/handlers/__tests__/agent-session-new.test.d.ts +2 -0
- package/dist/handlers/__tests__/agent-session-new.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/agent-session-new.test.js +185 -0
- package/dist/handlers/__tests__/agent-session-new.test.js.map +1 -0
- package/dist/handlers/__tests__/agent-sessions-list.test.d.ts +2 -0
- package/dist/handlers/__tests__/agent-sessions-list.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/agent-sessions-list.test.js +171 -0
- package/dist/handlers/__tests__/agent-sessions-list.test.js.map +1 -0
- package/dist/handlers/__tests__/command-cancel.test.d.ts +2 -0
- package/dist/handlers/__tests__/command-cancel.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/command-cancel.test.js +121 -0
- package/dist/handlers/__tests__/command-cancel.test.js.map +1 -0
- package/dist/handlers/__tests__/command-exec.test.d.ts +2 -0
- package/dist/handlers/__tests__/command-exec.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/command-exec.test.js +155 -0
- package/dist/handlers/__tests__/command-exec.test.js.map +1 -0
- package/dist/handlers/__tests__/fs-create.test.d.ts +2 -0
- package/dist/handlers/__tests__/fs-create.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/fs-create.test.js +147 -0
- package/dist/handlers/__tests__/fs-create.test.js.map +1 -0
- package/dist/handlers/__tests__/fs-delete.test.d.ts +2 -0
- package/dist/handlers/__tests__/fs-delete.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/fs-delete.test.js +153 -0
- package/dist/handlers/__tests__/fs-delete.test.js.map +1 -0
- package/dist/handlers/__tests__/fs-list.test.d.ts +2 -0
- package/dist/handlers/__tests__/fs-list.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/fs-list.test.js +203 -0
- package/dist/handlers/__tests__/fs-list.test.js.map +1 -0
- package/dist/handlers/__tests__/fs-read.test.d.ts +2 -0
- package/dist/handlers/__tests__/fs-read.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/fs-read.test.js +178 -0
- package/dist/handlers/__tests__/fs-read.test.js.map +1 -0
- package/dist/handlers/__tests__/fs-replace.test.d.ts +2 -0
- package/dist/handlers/__tests__/fs-replace.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/fs-replace.test.js +201 -0
- package/dist/handlers/__tests__/fs-replace.test.js.map +1 -0
- package/dist/handlers/__tests__/fs-search.test.d.ts +2 -0
- package/dist/handlers/__tests__/fs-search.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/fs-search.test.js +195 -0
- package/dist/handlers/__tests__/fs-search.test.js.map +1 -0
- package/dist/handlers/__tests__/fs-write.test.d.ts +2 -0
- package/dist/handlers/__tests__/fs-write.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/fs-write.test.js +173 -0
- package/dist/handlers/__tests__/fs-write.test.js.map +1 -0
- package/dist/handlers/__tests__/git-branch-create.test.d.ts +2 -0
- package/dist/handlers/__tests__/git-branch-create.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/git-branch-create.test.js +158 -0
- package/dist/handlers/__tests__/git-branch-create.test.js.map +1 -0
- package/dist/handlers/__tests__/git-branches.test.d.ts +2 -0
- package/dist/handlers/__tests__/git-branches.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/git-branches.test.js +184 -0
- package/dist/handlers/__tests__/git-branches.test.js.map +1 -0
- package/dist/handlers/__tests__/git-checkout.test.d.ts +2 -0
- package/dist/handlers/__tests__/git-checkout.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/git-checkout.test.js +126 -0
- package/dist/handlers/__tests__/git-checkout.test.js.map +1 -0
- package/dist/handlers/__tests__/git-commit.test.d.ts +2 -0
- package/dist/handlers/__tests__/git-commit.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/git-commit.test.js +131 -0
- package/dist/handlers/__tests__/git-commit.test.js.map +1 -0
- package/dist/handlers/__tests__/git-diff.test.d.ts +2 -0
- package/dist/handlers/__tests__/git-diff.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/git-diff.test.js +185 -0
- package/dist/handlers/__tests__/git-diff.test.js.map +1 -0
- package/dist/handlers/__tests__/git-discard.test.d.ts +2 -0
- package/dist/handlers/__tests__/git-discard.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/git-discard.test.js +154 -0
- package/dist/handlers/__tests__/git-discard.test.js.map +1 -0
- package/dist/handlers/__tests__/git-file-base.test.d.ts +2 -0
- package/dist/handlers/__tests__/git-file-base.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/git-file-base.test.js +148 -0
- package/dist/handlers/__tests__/git-file-base.test.js.map +1 -0
- package/dist/handlers/__tests__/git-pull.test.d.ts +2 -0
- package/dist/handlers/__tests__/git-pull.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/git-pull.test.js +180 -0
- package/dist/handlers/__tests__/git-pull.test.js.map +1 -0
- package/dist/handlers/__tests__/git-push.test.d.ts +2 -0
- package/dist/handlers/__tests__/git-push.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/git-push.test.js +177 -0
- package/dist/handlers/__tests__/git-push.test.js.map +1 -0
- package/dist/handlers/__tests__/git-stage.test.d.ts +2 -0
- package/dist/handlers/__tests__/git-stage.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/git-stage.test.js +165 -0
- package/dist/handlers/__tests__/git-stage.test.js.map +1 -0
- package/dist/handlers/__tests__/git-status.test.d.ts +2 -0
- package/dist/handlers/__tests__/git-status.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/git-status.test.js +182 -0
- package/dist/handlers/__tests__/git-status.test.js.map +1 -0
- package/dist/handlers/__tests__/machines-list.test.d.ts +2 -0
- package/dist/handlers/__tests__/machines-list.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/machines-list.test.js +164 -0
- package/dist/handlers/__tests__/machines-list.test.js.map +1 -0
- package/dist/handlers/__tests__/project-create.test.d.ts +2 -0
- package/dist/handlers/__tests__/project-create.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/project-create.test.js +166 -0
- package/dist/handlers/__tests__/project-create.test.js.map +1 -0
- package/dist/handlers/__tests__/project-delete.test.d.ts +2 -0
- package/dist/handlers/__tests__/project-delete.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/project-delete.test.js +150 -0
- package/dist/handlers/__tests__/project-delete.test.js.map +1 -0
- package/dist/handlers/__tests__/projects-list.test.d.ts +2 -0
- package/dist/handlers/__tests__/projects-list.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/projects-list.test.js +145 -0
- package/dist/handlers/__tests__/projects-list.test.js.map +1 -0
- package/dist/handlers/__tests__/terminal-create.test.d.ts +2 -0
- package/dist/handlers/__tests__/terminal-create.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/terminal-create.test.js +156 -0
- package/dist/handlers/__tests__/terminal-create.test.js.map +1 -0
- package/dist/handlers/__tests__/terminal-kill.test.d.ts +2 -0
- package/dist/handlers/__tests__/terminal-kill.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/terminal-kill.test.js +125 -0
- package/dist/handlers/__tests__/terminal-kill.test.js.map +1 -0
- package/dist/handlers/__tests__/terminal-resize.test.d.ts +2 -0
- package/dist/handlers/__tests__/terminal-resize.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/terminal-resize.test.js +128 -0
- package/dist/handlers/__tests__/terminal-resize.test.js.map +1 -0
- package/dist/handlers/__tests__/terminal-stdin.test.d.ts +2 -0
- package/dist/handlers/__tests__/terminal-stdin.test.d.ts.map +1 -0
- package/dist/handlers/__tests__/terminal-stdin.test.js +128 -0
- package/dist/handlers/__tests__/terminal-stdin.test.js.map +1 -0
- package/dist/handlers/agent-cancel.d.ts +11 -0
- package/dist/handlers/agent-cancel.d.ts.map +1 -0
- package/dist/handlers/agent-cancel.js +67 -0
- package/dist/handlers/agent-cancel.js.map +1 -0
- package/dist/handlers/agent-message.d.ts +13 -0
- package/dist/handlers/agent-message.d.ts.map +1 -0
- package/dist/handlers/agent-message.js +119 -0
- package/dist/handlers/agent-message.js.map +1 -0
- package/dist/handlers/agent-prompt-response.d.ts +13 -0
- package/dist/handlers/agent-prompt-response.d.ts.map +1 -0
- package/dist/handlers/agent-prompt-response.js +26 -0
- package/dist/handlers/agent-prompt-response.js.map +1 -0
- package/dist/handlers/agent-session-new.d.ts +13 -0
- package/dist/handlers/agent-session-new.d.ts.map +1 -0
- package/dist/handlers/agent-session-new.js +106 -0
- package/dist/handlers/agent-session-new.js.map +1 -0
- package/dist/handlers/agent-sessions-list.d.ts +10 -0
- package/dist/handlers/agent-sessions-list.d.ts.map +1 -0
- package/dist/handlers/agent-sessions-list.js +78 -0
- package/dist/handlers/agent-sessions-list.js.map +1 -0
- package/dist/handlers/command-cancel.d.ts +9 -0
- package/dist/handlers/command-cancel.d.ts.map +1 -0
- package/dist/handlers/command-cancel.js +32 -0
- package/dist/handlers/command-cancel.js.map +1 -0
- package/dist/handlers/command-exec.d.ts +9 -0
- package/dist/handlers/command-exec.d.ts.map +1 -0
- package/dist/handlers/command-exec.js +74 -0
- package/dist/handlers/command-exec.js.map +1 -0
- package/dist/handlers/fs/__tests__/limits.test.d.ts +2 -0
- package/dist/handlers/fs/__tests__/limits.test.d.ts.map +1 -0
- package/dist/handlers/fs/__tests__/limits.test.js +154 -0
- package/dist/handlers/fs/__tests__/limits.test.js.map +1 -0
- package/dist/handlers/fs/limits.d.ts +41 -0
- package/dist/handlers/fs/limits.d.ts.map +1 -0
- package/dist/handlers/fs/limits.js +68 -0
- package/dist/handlers/fs/limits.js.map +1 -0
- package/dist/handlers/fs-create.d.ts +8 -0
- package/dist/handlers/fs-create.d.ts.map +1 -0
- package/dist/handlers/fs-create.js +98 -0
- package/dist/handlers/fs-create.js.map +1 -0
- package/dist/handlers/fs-delete.d.ts +8 -0
- package/dist/handlers/fs-delete.d.ts.map +1 -0
- package/dist/handlers/fs-delete.js +95 -0
- package/dist/handlers/fs-delete.js.map +1 -0
- package/dist/handlers/fs-list.d.ts +7 -0
- package/dist/handlers/fs-list.d.ts.map +1 -0
- package/dist/handlers/fs-list.js +70 -0
- package/dist/handlers/fs-list.js.map +1 -0
- package/dist/handlers/fs-read.d.ts +7 -0
- package/dist/handlers/fs-read.d.ts.map +1 -0
- package/dist/handlers/fs-read.js +98 -0
- package/dist/handlers/fs-read.js.map +1 -0
- package/dist/handlers/fs-replace.d.ts +8 -0
- package/dist/handlers/fs-replace.d.ts.map +1 -0
- package/dist/handlers/fs-replace.js +178 -0
- package/dist/handlers/fs-replace.js.map +1 -0
- package/dist/handlers/fs-search.d.ts +10 -0
- package/dist/handlers/fs-search.d.ts.map +1 -0
- package/dist/handlers/fs-search.js +302 -0
- package/dist/handlers/fs-search.js.map +1 -0
- package/dist/handlers/fs-write.d.ts +7 -0
- package/dist/handlers/fs-write.d.ts.map +1 -0
- package/dist/handlers/fs-write.js +74 -0
- package/dist/handlers/fs-write.js.map +1 -0
- package/dist/handlers/git/__tests__/credentials.test.d.ts +2 -0
- package/dist/handlers/git/__tests__/credentials.test.d.ts.map +1 -0
- package/dist/handlers/git/__tests__/credentials.test.js +145 -0
- package/dist/handlers/git/__tests__/credentials.test.js.map +1 -0
- package/dist/handlers/git/__tests__/error-parser.test.d.ts +2 -0
- package/dist/handlers/git/__tests__/error-parser.test.d.ts.map +1 -0
- package/dist/handlers/git/__tests__/error-parser.test.js +85 -0
- package/dist/handlers/git/__tests__/error-parser.test.js.map +1 -0
- package/dist/handlers/git/credentials.d.ts +55 -0
- package/dist/handlers/git/credentials.d.ts.map +1 -0
- package/dist/handlers/git/credentials.js +93 -0
- package/dist/handlers/git/credentials.js.map +1 -0
- package/dist/handlers/git/error-parser.d.ts +27 -0
- package/dist/handlers/git/error-parser.d.ts.map +1 -0
- package/dist/handlers/git/error-parser.js +98 -0
- package/dist/handlers/git/error-parser.js.map +1 -0
- package/dist/handlers/git-branch-create.d.ts +7 -0
- package/dist/handlers/git-branch-create.d.ts.map +1 -0
- package/dist/handlers/git-branch-create.js +60 -0
- package/dist/handlers/git-branch-create.js.map +1 -0
- package/dist/handlers/git-branches.d.ts +7 -0
- package/dist/handlers/git-branches.d.ts.map +1 -0
- package/dist/handlers/git-branches.js +60 -0
- package/dist/handlers/git-branches.js.map +1 -0
- package/dist/handlers/git-checkout.d.ts +7 -0
- package/dist/handlers/git-checkout.d.ts.map +1 -0
- package/dist/handlers/git-checkout.js +59 -0
- package/dist/handlers/git-checkout.js.map +1 -0
- package/dist/handlers/git-commit.d.ts +7 -0
- package/dist/handlers/git-commit.d.ts.map +1 -0
- package/dist/handlers/git-commit.js +59 -0
- package/dist/handlers/git-commit.js.map +1 -0
- package/dist/handlers/git-diff.d.ts +7 -0
- package/dist/handlers/git-diff.d.ts.map +1 -0
- package/dist/handlers/git-diff.js +56 -0
- package/dist/handlers/git-diff.js.map +1 -0
- package/dist/handlers/git-discard.d.ts +7 -0
- package/dist/handlers/git-discard.d.ts.map +1 -0
- package/dist/handlers/git-discard.js +56 -0
- package/dist/handlers/git-discard.js.map +1 -0
- package/dist/handlers/git-file-base.d.ts +7 -0
- package/dist/handlers/git-file-base.d.ts.map +1 -0
- package/dist/handlers/git-file-base.js +61 -0
- package/dist/handlers/git-file-base.js.map +1 -0
- package/dist/handlers/git-pull.d.ts +8 -0
- package/dist/handlers/git-pull.d.ts.map +1 -0
- package/dist/handlers/git-pull.js +69 -0
- package/dist/handlers/git-pull.js.map +1 -0
- package/dist/handlers/git-push.d.ts +7 -0
- package/dist/handlers/git-push.d.ts.map +1 -0
- package/dist/handlers/git-push.js +67 -0
- package/dist/handlers/git-push.js.map +1 -0
- package/dist/handlers/git-stage.d.ts +7 -0
- package/dist/handlers/git-stage.d.ts.map +1 -0
- package/dist/handlers/git-stage.js +56 -0
- package/dist/handlers/git-stage.js.map +1 -0
- package/dist/handlers/git-status.d.ts +7 -0
- package/dist/handlers/git-status.d.ts.map +1 -0
- package/dist/handlers/git-status.js +63 -0
- package/dist/handlers/git-status.js.map +1 -0
- package/dist/handlers/git-unstage.d.ts +7 -0
- package/dist/handlers/git-unstage.d.ts.map +1 -0
- package/dist/handlers/git-unstage.js +56 -0
- package/dist/handlers/git-unstage.js.map +1 -0
- package/dist/handlers/machines-list.d.ts +14 -0
- package/dist/handlers/machines-list.d.ts.map +1 -0
- package/dist/handlers/machines-list.js +53 -0
- package/dist/handlers/machines-list.js.map +1 -0
- package/dist/handlers/project-create.d.ts +18 -0
- package/dist/handlers/project-create.d.ts.map +1 -0
- package/dist/handlers/project-create.js +100 -0
- package/dist/handlers/project-create.js.map +1 -0
- package/dist/handlers/project-delete.d.ts +19 -0
- package/dist/handlers/project-delete.d.ts.map +1 -0
- package/dist/handlers/project-delete.js +89 -0
- package/dist/handlers/project-delete.js.map +1 -0
- package/dist/handlers/projects-list.d.ts +7 -0
- package/dist/handlers/projects-list.d.ts.map +1 -0
- package/dist/handlers/projects-list.js +42 -0
- package/dist/handlers/projects-list.js.map +1 -0
- package/dist/handlers/terminal-create.d.ts +8 -0
- package/dist/handlers/terminal-create.d.ts.map +1 -0
- package/dist/handlers/terminal-create.js +50 -0
- package/dist/handlers/terminal-create.js.map +1 -0
- package/dist/handlers/terminal-kill.d.ts +10 -0
- package/dist/handlers/terminal-kill.d.ts.map +1 -0
- package/dist/handlers/terminal-kill.js +32 -0
- package/dist/handlers/terminal-kill.js.map +1 -0
- package/dist/handlers/terminal-resize.d.ts +8 -0
- package/dist/handlers/terminal-resize.d.ts.map +1 -0
- package/dist/handlers/terminal-resize.js +29 -0
- package/dist/handlers/terminal-resize.js.map +1 -0
- package/dist/handlers/terminal-stdin.d.ts +8 -0
- package/dist/handlers/terminal-stdin.d.ts.map +1 -0
- package/dist/handlers/terminal-stdin.js +29 -0
- package/dist/handlers/terminal-stdin.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/opencode/__tests__/check-installed.test.d.ts +2 -0
- package/dist/opencode/__tests__/check-installed.test.d.ts.map +1 -0
- package/dist/opencode/__tests__/check-installed.test.js +68 -0
- package/dist/opencode/__tests__/check-installed.test.js.map +1 -0
- package/dist/opencode/__tests__/detect.test.d.ts +2 -0
- package/dist/opencode/__tests__/detect.test.d.ts.map +1 -0
- package/dist/opencode/__tests__/detect.test.js +147 -0
- package/dist/opencode/__tests__/detect.test.js.map +1 -0
- package/dist/opencode/__tests__/health-check.test.d.ts +2 -0
- package/dist/opencode/__tests__/health-check.test.d.ts.map +1 -0
- package/dist/opencode/__tests__/health-check.test.js +143 -0
- package/dist/opencode/__tests__/health-check.test.js.map +1 -0
- package/dist/opencode/__tests__/permission-reply.test.d.ts +2 -0
- package/dist/opencode/__tests__/permission-reply.test.d.ts.map +1 -0
- package/dist/opencode/__tests__/permission-reply.test.js +140 -0
- package/dist/opencode/__tests__/permission-reply.test.js.map +1 -0
- package/dist/opencode/__tests__/proxy.test.d.ts +2 -0
- package/dist/opencode/__tests__/proxy.test.d.ts.map +1 -0
- package/dist/opencode/__tests__/proxy.test.js +179 -0
- package/dist/opencode/__tests__/proxy.test.js.map +1 -0
- package/dist/opencode/__tests__/session-filter.test.d.ts +2 -0
- package/dist/opencode/__tests__/session-filter.test.d.ts.map +1 -0
- package/dist/opencode/__tests__/session-filter.test.js +117 -0
- package/dist/opencode/__tests__/session-filter.test.js.map +1 -0
- package/dist/opencode/__tests__/spawn.test.d.ts +2 -0
- package/dist/opencode/__tests__/spawn.test.d.ts.map +1 -0
- package/dist/opencode/__tests__/spawn.test.js +167 -0
- package/dist/opencode/__tests__/spawn.test.js.map +1 -0
- package/dist/opencode/__tests__/sse.test.d.ts +2 -0
- package/dist/opencode/__tests__/sse.test.d.ts.map +1 -0
- package/dist/opencode/__tests__/sse.test.js +245 -0
- package/dist/opencode/__tests__/sse.test.js.map +1 -0
- package/dist/opencode/__tests__/supervisor.test.d.ts +2 -0
- package/dist/opencode/__tests__/supervisor.test.d.ts.map +1 -0
- package/dist/opencode/__tests__/supervisor.test.js +206 -0
- package/dist/opencode/__tests__/supervisor.test.js.map +1 -0
- package/dist/opencode/check-installed.d.ts +12 -0
- package/dist/opencode/check-installed.d.ts.map +1 -0
- package/dist/opencode/check-installed.js +25 -0
- package/dist/opencode/check-installed.js.map +1 -0
- package/dist/opencode/detect.d.ts +16 -0
- package/dist/opencode/detect.d.ts.map +1 -0
- package/dist/opencode/detect.js +102 -0
- package/dist/opencode/detect.js.map +1 -0
- package/dist/opencode/health-check.d.ts +31 -0
- package/dist/opencode/health-check.d.ts.map +1 -0
- package/dist/opencode/health-check.js +97 -0
- package/dist/opencode/health-check.js.map +1 -0
- package/dist/opencode/permission-reply.d.ts +14 -0
- package/dist/opencode/permission-reply.d.ts.map +1 -0
- package/dist/opencode/permission-reply.js +70 -0
- package/dist/opencode/permission-reply.js.map +1 -0
- package/dist/opencode/proxy.d.ts +45 -0
- package/dist/opencode/proxy.d.ts.map +1 -0
- package/dist/opencode/proxy.js +99 -0
- package/dist/opencode/proxy.js.map +1 -0
- package/dist/opencode/session-filter.d.ts +26 -0
- package/dist/opencode/session-filter.d.ts.map +1 -0
- package/dist/opencode/session-filter.js +20 -0
- package/dist/opencode/session-filter.js.map +1 -0
- package/dist/opencode/spawn.d.ts +24 -0
- package/dist/opencode/spawn.d.ts.map +1 -0
- package/dist/opencode/spawn.js +143 -0
- package/dist/opencode/spawn.js.map +1 -0
- package/dist/opencode/sse.d.ts +42 -0
- package/dist/opencode/sse.d.ts.map +1 -0
- package/dist/opencode/sse.js +250 -0
- package/dist/opencode/sse.js.map +1 -0
- package/dist/opencode/supervisor.d.ts +43 -0
- package/dist/opencode/supervisor.d.ts.map +1 -0
- package/dist/opencode/supervisor.js +153 -0
- package/dist/opencode/supervisor.js.map +1 -0
- package/dist/services/__tests__/autostart.test.d.ts +2 -0
- package/dist/services/__tests__/autostart.test.d.ts.map +1 -0
- package/dist/services/__tests__/autostart.test.js +176 -0
- package/dist/services/__tests__/autostart.test.js.map +1 -0
- package/dist/services/__tests__/file-watcher.test.d.ts +2 -0
- package/dist/services/__tests__/file-watcher.test.d.ts.map +1 -0
- package/dist/services/__tests__/file-watcher.test.js +265 -0
- package/dist/services/__tests__/file-watcher.test.js.map +1 -0
- package/dist/services/__tests__/git-pty.test.d.ts +2 -0
- package/dist/services/__tests__/git-pty.test.d.ts.map +1 -0
- package/dist/services/__tests__/git-pty.test.js +137 -0
- package/dist/services/__tests__/git-pty.test.js.map +1 -0
- package/dist/services/__tests__/message-queue.test.d.ts +2 -0
- package/dist/services/__tests__/message-queue.test.d.ts.map +1 -0
- package/dist/services/__tests__/message-queue.test.js +203 -0
- package/dist/services/__tests__/message-queue.test.js.map +1 -0
- package/dist/services/__tests__/queue-overflow.test.d.ts +2 -0
- package/dist/services/__tests__/queue-overflow.test.d.ts.map +1 -0
- package/dist/services/__tests__/queue-overflow.test.js +115 -0
- package/dist/services/__tests__/queue-overflow.test.js.map +1 -0
- package/dist/services/__tests__/shutdown.test.d.ts +2 -0
- package/dist/services/__tests__/shutdown.test.d.ts.map +1 -0
- package/dist/services/__tests__/shutdown.test.js +181 -0
- package/dist/services/__tests__/shutdown.test.js.map +1 -0
- package/dist/services/__tests__/terminal-exit.test.d.ts +2 -0
- package/dist/services/__tests__/terminal-exit.test.d.ts.map +1 -0
- package/dist/services/__tests__/terminal-exit.test.js +150 -0
- package/dist/services/__tests__/terminal-exit.test.js.map +1 -0
- package/dist/services/__tests__/terminal-stdout.test.d.ts +2 -0
- package/dist/services/__tests__/terminal-stdout.test.d.ts.map +1 -0
- package/dist/services/__tests__/terminal-stdout.test.js +160 -0
- package/dist/services/__tests__/terminal-stdout.test.js.map +1 -0
- package/dist/services/autostart.d.ts +42 -0
- package/dist/services/autostart.d.ts.map +1 -0
- package/dist/services/autostart.js +198 -0
- package/dist/services/autostart.js.map +1 -0
- package/dist/services/capabilities.d.ts +18 -0
- package/dist/services/capabilities.d.ts.map +1 -0
- package/dist/services/capabilities.js +38 -0
- package/dist/services/capabilities.js.map +1 -0
- package/dist/services/command-runner.d.ts +46 -0
- package/dist/services/command-runner.d.ts.map +1 -0
- package/dist/services/command-runner.js +151 -0
- package/dist/services/command-runner.js.map +1 -0
- package/dist/services/file-watcher.d.ts +35 -0
- package/dist/services/file-watcher.d.ts.map +1 -0
- package/dist/services/file-watcher.js +133 -0
- package/dist/services/file-watcher.js.map +1 -0
- package/dist/services/filesystem.d.ts +68 -0
- package/dist/services/filesystem.d.ts.map +1 -0
- package/dist/services/filesystem.js +249 -0
- package/dist/services/filesystem.js.map +1 -0
- package/dist/services/git.d.ts +149 -0
- package/dist/services/git.d.ts.map +1 -0
- package/dist/services/git.js +589 -0
- package/dist/services/git.js.map +1 -0
- package/dist/services/message-queue.d.ts +58 -0
- package/dist/services/message-queue.d.ts.map +1 -0
- package/dist/services/message-queue.js +118 -0
- package/dist/services/message-queue.js.map +1 -0
- package/dist/services/shutdown.d.ts +40 -0
- package/dist/services/shutdown.d.ts.map +1 -0
- package/dist/services/shutdown.js +144 -0
- package/dist/services/shutdown.js.map +1 -0
- package/dist/services/terminal-manager.d.ts +43 -0
- package/dist/services/terminal-manager.d.ts.map +1 -0
- package/dist/services/terminal-manager.js +118 -0
- package/dist/services/terminal-manager.js.map +1 -0
- package/dist/utils/__tests__/config.test.d.ts +2 -0
- package/dist/utils/__tests__/config.test.d.ts.map +1 -0
- package/dist/utils/__tests__/config.test.js +67 -0
- package/dist/utils/__tests__/config.test.js.map +1 -0
- package/dist/utils/__tests__/diff.test.d.ts +2 -0
- package/dist/utils/__tests__/diff.test.d.ts.map +1 -0
- package/dist/utils/__tests__/diff.test.js +40 -0
- package/dist/utils/__tests__/diff.test.js.map +1 -0
- package/dist/utils/__tests__/filename-validation.test.d.ts +2 -0
- package/dist/utils/__tests__/filename-validation.test.d.ts.map +1 -0
- package/dist/utils/__tests__/filename-validation.test.js +114 -0
- package/dist/utils/__tests__/filename-validation.test.js.map +1 -0
- package/dist/utils/__tests__/logger.test.d.ts +2 -0
- package/dist/utils/__tests__/logger.test.d.ts.map +1 -0
- package/dist/utils/__tests__/logger.test.js +254 -0
- package/dist/utils/__tests__/logger.test.js.map +1 -0
- package/dist/utils/__tests__/machine-key.test.d.ts +2 -0
- package/dist/utils/__tests__/machine-key.test.d.ts.map +1 -0
- package/dist/utils/__tests__/machine-key.test.js +123 -0
- package/dist/utils/__tests__/machine-key.test.js.map +1 -0
- package/dist/utils/__tests__/path-sandbox.test.d.ts +2 -0
- package/dist/utils/__tests__/path-sandbox.test.d.ts.map +1 -0
- package/dist/utils/__tests__/path-sandbox.test.js +97 -0
- package/dist/utils/__tests__/path-sandbox.test.js.map +1 -0
- package/dist/utils/__tests__/paths.test.d.ts +2 -0
- package/dist/utils/__tests__/paths.test.d.ts.map +1 -0
- package/dist/utils/__tests__/paths.test.js +87 -0
- package/dist/utils/__tests__/paths.test.js.map +1 -0
- package/dist/utils/__tests__/pid.test.d.ts +2 -0
- package/dist/utils/__tests__/pid.test.d.ts.map +1 -0
- package/dist/utils/__tests__/pid.test.js +79 -0
- package/dist/utils/__tests__/pid.test.js.map +1 -0
- package/dist/utils/__tests__/validate-project-path.test.d.ts +2 -0
- package/dist/utils/__tests__/validate-project-path.test.d.ts.map +1 -0
- package/dist/utils/__tests__/validate-project-path.test.js +178 -0
- package/dist/utils/__tests__/validate-project-path.test.js.map +1 -0
- package/dist/utils/config.d.ts +8 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +16 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/diff.d.ts +11 -0
- package/dist/utils/diff.d.ts.map +1 -0
- package/dist/utils/diff.js +24 -0
- package/dist/utils/diff.js.map +1 -0
- package/dist/utils/filename-validation.d.ts +10 -0
- package/dist/utils/filename-validation.d.ts.map +1 -0
- package/dist/utils/filename-validation.js +55 -0
- package/dist/utils/filename-validation.js.map +1 -0
- package/dist/utils/logger.d.ts +18 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +104 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/machine-info.d.ts +6 -0
- package/dist/utils/machine-info.d.ts.map +1 -0
- package/dist/utils/machine-info.js +38 -0
- package/dist/utils/machine-info.js.map +1 -0
- package/dist/utils/machine-key.d.ts +20 -0
- package/dist/utils/machine-key.d.ts.map +1 -0
- package/dist/utils/machine-key.js +66 -0
- package/dist/utils/machine-key.js.map +1 -0
- package/dist/utils/path-sandbox.d.ts +24 -0
- package/dist/utils/path-sandbox.d.ts.map +1 -0
- package/dist/utils/path-sandbox.js +69 -0
- package/dist/utils/path-sandbox.js.map +1 -0
- package/dist/utils/paths.d.ts +19 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +52 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/pid.d.ts +23 -0
- package/dist/utils/pid.d.ts.map +1 -0
- package/dist/utils/pid.js +57 -0
- package/dist/utils/pid.js.map +1 -0
- package/dist/utils/validate-project-path.d.ts +17 -0
- package/dist/utils/validate-project-path.d.ts.map +1 -0
- package/dist/utils/validate-project-path.js +109 -0
- package/dist/utils/validate-project-path.js.map +1 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,1106 @@
|
|
|
1
|
+
# PocketCoder Daemon
|
|
2
|
+
|
|
3
|
+
The PocketCoder Daemon is a local Node.js process that acts as a bridge between Claude Code and the mobile PWA client. It manages Claude Code execution, file synchronization, and real-time communication with the cloud relay server.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Overview](#overview)
|
|
8
|
+
- [Tech Stack](#tech-stack)
|
|
9
|
+
- [Installation & Usage](#installation--usage)
|
|
10
|
+
- [Architecture](#architecture)
|
|
11
|
+
- [Startup Sequence](#startup-sequence)
|
|
12
|
+
- [Authentication](#authentication)
|
|
13
|
+
- [Relay Connection](#relay-connection)
|
|
14
|
+
- [Message Handling](#message-handling)
|
|
15
|
+
- [Features](#features)
|
|
16
|
+
- [Filesystem Operations](#filesystem-operations)
|
|
17
|
+
- [File Watcher](#file-watcher)
|
|
18
|
+
- [Command Runner](#command-runner)
|
|
19
|
+
- [Git Integration](#git-integration)
|
|
20
|
+
- [Claude Code Integration](#claude-code-integration)
|
|
21
|
+
- [Control Plane HTTP API](#control-plane-http-api)
|
|
22
|
+
- [Database Schema](#database-schema)
|
|
23
|
+
- [CLI Commands](#cli-commands)
|
|
24
|
+
- [Error Handling](#error-handling)
|
|
25
|
+
- [Configuration](#configuration)
|
|
26
|
+
- [Testing](#testing)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Overview
|
|
31
|
+
|
|
32
|
+
```mermaid
|
|
33
|
+
flowchart LR
|
|
34
|
+
subgraph Internet
|
|
35
|
+
Client["Client<br/>(PWA)"]
|
|
36
|
+
Relay["Relay<br/>(Fly.io)"]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
subgraph Local
|
|
40
|
+
Daemon["Daemon<br/>(Local)"]
|
|
41
|
+
Claude["Claude<br/>Code"]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
subgraph Cloud
|
|
45
|
+
Supabase["Supabase<br/>(Auth/DB)"]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
Client <-->|WebSocket| Relay
|
|
49
|
+
Relay <-->|WebSocket| Daemon
|
|
50
|
+
Relay -->|Auth| Supabase
|
|
51
|
+
Daemon -->|Spawn| Claude
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Key Responsibilities:**
|
|
55
|
+
|
|
56
|
+
- **Claude Code Management**: Spawning and managing Claude Code CLI processes
|
|
57
|
+
- **Filesystem Operations**: Reading, writing, and watching project files
|
|
58
|
+
- **Shell Commands**: Executing shell commands with streaming output
|
|
59
|
+
- **Git Operations**: Status, branching, staging, committing, and pushing
|
|
60
|
+
- **Relay Communication**: Maintaining WebSocket connection with the cloud relay
|
|
61
|
+
- **Local Storage**: Persisting projects, command history, and auth tokens in SQLite
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Tech Stack
|
|
66
|
+
|
|
67
|
+
| Component | Library | Purpose |
|
|
68
|
+
| -------------------- | ------------------- | ---------------------------- |
|
|
69
|
+
| **Runtime** | Node.js 24 LTS | JavaScript runtime |
|
|
70
|
+
| **Language** | TypeScript (strict) | Type-safe development |
|
|
71
|
+
| **WebSocket** | `ws` | Relay connection |
|
|
72
|
+
| **Database** | `better-sqlite3` | Local persistence |
|
|
73
|
+
| **File Watcher** | `chokidar` | Filesystem change detection |
|
|
74
|
+
| **CLI Framework** | `commander` | Command-line interface |
|
|
75
|
+
| **Process Spawning** | `execa` | Claude Code & shell commands |
|
|
76
|
+
| **HTTP Server** | `fastify` | Control plane API |
|
|
77
|
+
| **Testing** | `vitest` | Unit and integration tests |
|
|
78
|
+
| **Build** | `tsc` | TypeScript compilation |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Installation & Usage
|
|
83
|
+
|
|
84
|
+
### Prerequisites
|
|
85
|
+
|
|
86
|
+
- Node.js 24 LTS or later
|
|
87
|
+
- Claude Code CLI installed and configured
|
|
88
|
+
- Git (for git operations)
|
|
89
|
+
|
|
90
|
+
### Installation
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Install globally
|
|
94
|
+
npm install -g pocketcoder
|
|
95
|
+
|
|
96
|
+
# Or run without install
|
|
97
|
+
npx pocketcoder start
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Basic Usage
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Login with GitHub (opens browser)
|
|
104
|
+
pocketcoder login
|
|
105
|
+
|
|
106
|
+
# Start the daemon (runs in background)
|
|
107
|
+
pocketcoder start
|
|
108
|
+
|
|
109
|
+
# Start in foreground (for debugging)
|
|
110
|
+
pocketcoder start --foreground
|
|
111
|
+
|
|
112
|
+
# Register a project
|
|
113
|
+
pocketcoder add /path/to/project
|
|
114
|
+
pocketcoder add . # Current directory
|
|
115
|
+
|
|
116
|
+
# List registered projects
|
|
117
|
+
pocketcoder projects
|
|
118
|
+
|
|
119
|
+
# Check daemon status
|
|
120
|
+
pocketcoder status
|
|
121
|
+
|
|
122
|
+
# View logs
|
|
123
|
+
pocketcoder logs --tail 100 -f
|
|
124
|
+
|
|
125
|
+
# Stop the daemon
|
|
126
|
+
pocketcoder stop
|
|
127
|
+
|
|
128
|
+
# Remove a project
|
|
129
|
+
pocketcoder remove <projectId>
|
|
130
|
+
|
|
131
|
+
# Set machine label
|
|
132
|
+
pocketcoder machine label "Work Laptop"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Architecture
|
|
138
|
+
|
|
139
|
+
```mermaid
|
|
140
|
+
graph TB
|
|
141
|
+
subgraph "Local Machine"
|
|
142
|
+
CLI["CLI Commands<br/>(pocketcoder)"]
|
|
143
|
+
CP["Control Plane HTTP<br/>:17333"]
|
|
144
|
+
Daemon["Daemon Core"]
|
|
145
|
+
|
|
146
|
+
subgraph "Services"
|
|
147
|
+
CR["Claude Runner"]
|
|
148
|
+
CMD["Command Runner"]
|
|
149
|
+
FW["File Watcher"]
|
|
150
|
+
GIT["Git Service"]
|
|
151
|
+
MQ["Message Queue"]
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
subgraph "Data Layer"
|
|
155
|
+
DB["SQLite Database<br/>(daemon.db)"]
|
|
156
|
+
AUTH["Auth Storage<br/>(auth.json)"]
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
CLI -->|HTTP| CP
|
|
160
|
+
CP -->|Control| Daemon
|
|
161
|
+
Daemon -->|Spawn| CR
|
|
162
|
+
Daemon -->|Execute| CMD
|
|
163
|
+
Daemon -->|Watch| FW
|
|
164
|
+
Daemon -->|Exec| GIT
|
|
165
|
+
Daemon -->|Queue| MQ
|
|
166
|
+
CR -->|Stream Events| MQ
|
|
167
|
+
Daemon -->|Read/Write| DB
|
|
168
|
+
Daemon -->|Load/Save| AUTH
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
subgraph "Cloud"
|
|
172
|
+
Relay["Relay Server<br/>WebSocket"]
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
Daemon <-->|WebSocket| Relay
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Directory Structure
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
apps/host/
|
|
182
|
+
├── src/
|
|
183
|
+
│ ├── index.ts # Entry point
|
|
184
|
+
│ ├── daemon.ts # Main startup orchestration
|
|
185
|
+
│ ├── cli/ # CLI command handlers
|
|
186
|
+
│ │ ├── index.ts
|
|
187
|
+
│ │ ├── start.ts
|
|
188
|
+
│ │ ├── stop.ts
|
|
189
|
+
│ │ ├── add.ts
|
|
190
|
+
│ │ └── ...
|
|
191
|
+
│ ├── relay/ # Relay communication
|
|
192
|
+
│ │ ├── websocket-client.ts
|
|
193
|
+
│ │ ├── message-router.ts
|
|
194
|
+
│ │ ├── relay-request.ts
|
|
195
|
+
│ │ └── messages/
|
|
196
|
+
│ │ ├── daemon-register.ts
|
|
197
|
+
│ │ └── ...
|
|
198
|
+
│ ├── handlers/ # Message handlers
|
|
199
|
+
│ │ ├── fs-list.ts
|
|
200
|
+
│ │ ├── fs-read.ts
|
|
201
|
+
│ │ ├── fs-write.ts
|
|
202
|
+
│ │ ├── git-status.ts
|
|
203
|
+
│ │ ├── command-exec.ts
|
|
204
|
+
│ │ ├── agent-session-new.ts
|
|
205
|
+
│ │ └── ...
|
|
206
|
+
│ ├── services/ # Core services
|
|
207
|
+
│ │ ├── claude-runner.ts
|
|
208
|
+
│ │ ├── command-runner.ts
|
|
209
|
+
│ │ ├── file-watcher.ts
|
|
210
|
+
│ │ ├── git.ts
|
|
211
|
+
│ │ ├── message-queue.ts
|
|
212
|
+
│ │ ├── stream-json-parser.ts
|
|
213
|
+
│ │ └── shutdown.ts
|
|
214
|
+
│ ├── auth/ # Authentication
|
|
215
|
+
│ │ ├── login.ts
|
|
216
|
+
│ │ ├── relay-auth.ts
|
|
217
|
+
│ │ ├── token-storage.ts
|
|
218
|
+
│ │ └── token-refresh.ts
|
|
219
|
+
│ ├── db/ # Database layer
|
|
220
|
+
│ │ ├── database.ts
|
|
221
|
+
│ │ └── repositories/
|
|
222
|
+
│ │ ├── projects.ts
|
|
223
|
+
│ │ ├── command-runs.ts
|
|
224
|
+
│ │ └── fs-state.ts
|
|
225
|
+
│ ├── control-plane/ # HTTP control plane
|
|
226
|
+
│ │ ├── server.ts
|
|
227
|
+
│ │ └── routes/
|
|
228
|
+
│ └── utils/ # Utilities
|
|
229
|
+
│ ├── logger.ts
|
|
230
|
+
│ ├── paths.ts
|
|
231
|
+
│ ├── machine-info.ts
|
|
232
|
+
│ └── config.ts
|
|
233
|
+
└── tests/ # Test files
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Startup Sequence
|
|
239
|
+
|
|
240
|
+
The daemon startup follows a 3-phase process:
|
|
241
|
+
|
|
242
|
+
```mermaid
|
|
243
|
+
sequenceDiagram
|
|
244
|
+
participant CLI as CLI
|
|
245
|
+
participant Daemon as Daemon
|
|
246
|
+
participant DB as SQLite
|
|
247
|
+
participant Auth as Auth
|
|
248
|
+
participant Relay as Relay
|
|
249
|
+
|
|
250
|
+
Note over Daemon: Phase 1 - Local Init
|
|
251
|
+
Daemon->>Daemon: Create config dirs
|
|
252
|
+
Daemon->>DB: Open/Migrate database
|
|
253
|
+
Daemon->>Daemon: Clean old command runs
|
|
254
|
+
Daemon->>Daemon: Start Control Plane HTTP :17333
|
|
255
|
+
Daemon->>Daemon: Write PID file
|
|
256
|
+
|
|
257
|
+
Note over Daemon: Phase 2 - Authentication
|
|
258
|
+
Daemon->>Auth: Load existing tokens
|
|
259
|
+
alt Has valid tokens
|
|
260
|
+
Daemon->>Relay: token_refresh (if expired)
|
|
261
|
+
Relay-->>Daemon: New tokens
|
|
262
|
+
else No tokens / invalid
|
|
263
|
+
Daemon->>Daemon: Start OAuth server
|
|
264
|
+
Daemon->>Daemon: Open browser
|
|
265
|
+
Note over Daemon: User completes OAuth
|
|
266
|
+
Daemon->>Relay: auth_exchange {code}
|
|
267
|
+
Relay-->>Daemon: tokens + user info
|
|
268
|
+
end
|
|
269
|
+
Daemon->>Auth: Save tokens
|
|
270
|
+
|
|
271
|
+
Note over Daemon: Phase 3 - Relay Connection
|
|
272
|
+
Daemon->>Daemon: Setup message router
|
|
273
|
+
Daemon->>Relay: Connect WebSocket
|
|
274
|
+
Relay-->>Daemon: connected
|
|
275
|
+
Daemon->>Relay: daemon_register
|
|
276
|
+
Daemon->>Daemon: Start file watchers
|
|
277
|
+
Daemon->>Daemon: Register signal handlers
|
|
278
|
+
|
|
279
|
+
Note over Daemon: Ready ✓
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Shutdown Sequence
|
|
283
|
+
|
|
284
|
+
```mermaid
|
|
285
|
+
sequenceDiagram
|
|
286
|
+
participant Signal as SIGTERM/SIGINT
|
|
287
|
+
participant Daemon as Daemon
|
|
288
|
+
participant Services as Services
|
|
289
|
+
participant DB as Database
|
|
290
|
+
|
|
291
|
+
Signal->>Daemon: Shutdown signal
|
|
292
|
+
Daemon->>Daemon: Stop accepting requests
|
|
293
|
+
|
|
294
|
+
Note over Daemon,Services: LIFO cleanup order
|
|
295
|
+
Daemon->>Services: Stop file watchers
|
|
296
|
+
Daemon->>Services: Clear message queues
|
|
297
|
+
Daemon->>Services: Kill Claude processes
|
|
298
|
+
Daemon->>Services: Kill running commands
|
|
299
|
+
Daemon->>Services: Close relay connection
|
|
300
|
+
|
|
301
|
+
Daemon->>DB: Close database
|
|
302
|
+
Daemon->>Daemon: Remove PID file
|
|
303
|
+
Daemon->>Signal: Exit 0
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Authentication
|
|
309
|
+
|
|
310
|
+
The daemon uses GitHub OAuth via Supabase Auth. **Important:** The daemon does NOT interact with Supabase directly - all token exchange goes through the Relay.
|
|
311
|
+
|
|
312
|
+
```mermaid
|
|
313
|
+
sequenceDiagram
|
|
314
|
+
participant User as User
|
|
315
|
+
participant Daemon as Daemon
|
|
316
|
+
participant OAuth as OAuth Server
|
|
317
|
+
participant Supabase as Supabase
|
|
318
|
+
participant Relay as Relay
|
|
319
|
+
|
|
320
|
+
User->>Daemon: pocketcoder login
|
|
321
|
+
Daemon->>Daemon: Start local callback server :random
|
|
322
|
+
Daemon->>OAuth: Open browser to auth URL
|
|
323
|
+
User->>OAuth: Sign in with GitHub
|
|
324
|
+
OAuth->>Daemon: Callback with code
|
|
325
|
+
Daemon->>Relay: auth_exchange { code }
|
|
326
|
+
Relay->>Supabase: Exchange code for tokens
|
|
327
|
+
Supabase-->>Relay: access_token, refresh_token
|
|
328
|
+
Relay-->>Daemon: auth_exchange_response
|
|
329
|
+
Daemon->>Daemon: Generate machineKey (UUID v4)
|
|
330
|
+
Daemon->>Daemon: Save tokens to auth.json
|
|
331
|
+
Daemon-->>User: Login complete
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Token Storage
|
|
335
|
+
|
|
336
|
+
Tokens are stored with restrictive permissions (0600):
|
|
337
|
+
|
|
338
|
+
| OS | Path |
|
|
339
|
+
| ------- | ----------------------------------------------------- |
|
|
340
|
+
| macOS | `~/Library/Application Support/pocketcoder/auth.json` |
|
|
341
|
+
| Linux | `~/.config/pocketcoder/auth.json` |
|
|
342
|
+
| Windows | `%APPDATA%\pocketcoder\auth.json` |
|
|
343
|
+
|
|
344
|
+
```json
|
|
345
|
+
{
|
|
346
|
+
"machine_key": "550e8400-e29b-41d4-a716-446655440000",
|
|
347
|
+
"access_token": "eyJ...",
|
|
348
|
+
"refresh_token": "...",
|
|
349
|
+
"expires_at": 1707666000,
|
|
350
|
+
"user_id": "github|12345"
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### Automatic Token Refresh
|
|
355
|
+
|
|
356
|
+
```mermaid
|
|
357
|
+
sequenceDiagram
|
|
358
|
+
participant Daemon as Daemon
|
|
359
|
+
participant Relay as Relay
|
|
360
|
+
participant Supabase as Supabase
|
|
361
|
+
|
|
362
|
+
Note over Daemon: Token expired
|
|
363
|
+
Daemon->>Relay: token_refresh {refresh_token}
|
|
364
|
+
Relay->>Supabase: POST /auth/v1/token
|
|
365
|
+
Supabase-->>Relay: New tokens
|
|
366
|
+
Relay-->>Daemon: token_refresh_response
|
|
367
|
+
Daemon->>Daemon: Update auth.json
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Relay Connection
|
|
373
|
+
|
|
374
|
+
### Connection State Machine
|
|
375
|
+
|
|
376
|
+
```mermaid
|
|
377
|
+
stateDiagram-v2
|
|
378
|
+
[*] --> disconnected
|
|
379
|
+
|
|
380
|
+
disconnected --> connecting: connect()
|
|
381
|
+
connecting --> connected: WebSocket opens
|
|
382
|
+
connecting --> disconnected: Error/Close
|
|
383
|
+
|
|
384
|
+
connected --> connected: Heartbeat ping/pong
|
|
385
|
+
connected --> reconnecting: Unexpected disconnect
|
|
386
|
+
|
|
387
|
+
reconnecting --> connected: Reconnect success
|
|
388
|
+
reconnecting --> reconnecting: Retry with backoff
|
|
389
|
+
|
|
390
|
+
reconnecting --> disconnected: Manual disconnect()
|
|
391
|
+
connected --> disconnected: Manual disconnect()
|
|
392
|
+
disconnected --> [*]
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### Reconnection Strategy
|
|
396
|
+
|
|
397
|
+
- **Exponential backoff**: 1s, 2s, 4s, 8s... maximum 60s
|
|
398
|
+
- **On reconnect**: Re-sends `daemon_register` with full state
|
|
399
|
+
- **File watchers**: Continue running (local state preserved)
|
|
400
|
+
- **Message queue**: Maintained, processed on reconnect
|
|
401
|
+
|
|
402
|
+
### Daemon Registration
|
|
403
|
+
|
|
404
|
+
```mermaid
|
|
405
|
+
sequenceDiagram
|
|
406
|
+
participant Daemon as Daemon
|
|
407
|
+
participant Relay as Relay
|
|
408
|
+
participant Client as Client
|
|
409
|
+
|
|
410
|
+
Daemon->>Relay: Connect WebSocket
|
|
411
|
+
Daemon->>Relay: daemon_register
|
|
412
|
+
Note right of Daemon: machineKey, token,<br/>machine info, projects
|
|
413
|
+
|
|
414
|
+
Note over Relay: Validate JWT<br/>Store in map
|
|
415
|
+
|
|
416
|
+
Relay--)Client: daemon_status {connected: true}
|
|
417
|
+
Relay-->>Daemon: Ready
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
## Message Handling
|
|
423
|
+
|
|
424
|
+
### Message Flow
|
|
425
|
+
|
|
426
|
+
```mermaid
|
|
427
|
+
graph TB
|
|
428
|
+
subgraph "Relay Server"
|
|
429
|
+
RRelay["Relay WebSocket"]
|
|
430
|
+
end
|
|
431
|
+
|
|
432
|
+
subgraph "Daemon"
|
|
433
|
+
WS["WebSocket Client"]
|
|
434
|
+
Router["Message Router"]
|
|
435
|
+
|
|
436
|
+
subgraph "Handlers"
|
|
437
|
+
H1["fs_* Handlers"]
|
|
438
|
+
H2["git_* Handlers"]
|
|
439
|
+
H3["command_exec"]
|
|
440
|
+
H4["agent_* Handlers"]
|
|
441
|
+
end
|
|
442
|
+
|
|
443
|
+
subgraph "Services"
|
|
444
|
+
CR["Claude Runner"]
|
|
445
|
+
CMD["Command Runner"]
|
|
446
|
+
FW["File Watcher"]
|
|
447
|
+
end
|
|
448
|
+
end
|
|
449
|
+
|
|
450
|
+
RRelay -->|Message| WS
|
|
451
|
+
WS -->|message event| Router
|
|
452
|
+
Router -->|Dispatch| H1
|
|
453
|
+
Router -->|Dispatch| H2
|
|
454
|
+
Router -->|Dispatch| H3
|
|
455
|
+
Router -->|Dispatch| H4
|
|
456
|
+
|
|
457
|
+
H3 -->|Execute| CMD
|
|
458
|
+
H4 -->|Spawn| CR
|
|
459
|
+
|
|
460
|
+
CR -->|Events| Router
|
|
461
|
+
CMD -->|Output| Router
|
|
462
|
+
FW -->|fs_changed| WS
|
|
463
|
+
|
|
464
|
+
Router -->|send| WS
|
|
465
|
+
WS -->|JSON| RRelay
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
### Handler Pattern
|
|
469
|
+
|
|
470
|
+
All message handlers follow this signature:
|
|
471
|
+
|
|
472
|
+
```typescript
|
|
473
|
+
export async function handleMessageType(
|
|
474
|
+
message: RequestMessage,
|
|
475
|
+
send: (response: Message) => void
|
|
476
|
+
): Promise<void> {
|
|
477
|
+
// 1. Extract and validate payload
|
|
478
|
+
// 2. Query database / filesystem
|
|
479
|
+
// 3. Perform operation
|
|
480
|
+
// 4. Send response via send()
|
|
481
|
+
// 5. Stream events (if applicable)
|
|
482
|
+
}
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
### Supported Message Types
|
|
486
|
+
|
|
487
|
+
| Category | Message Type | Description |
|
|
488
|
+
| -------------- | ----------------------- | ------------------------ |
|
|
489
|
+
| **Filesystem** | `fs_list` | List directory contents |
|
|
490
|
+
| | `fs_read` | Read file content |
|
|
491
|
+
| | `fs_write` | Write file content |
|
|
492
|
+
| **Git** | `git_status` | Get git status |
|
|
493
|
+
| | `git_branches` | List branches |
|
|
494
|
+
| | `git_branch_create` | Create new branch |
|
|
495
|
+
| | `git_checkout` | Checkout branch/ref |
|
|
496
|
+
| | `git_stage` | Stage files |
|
|
497
|
+
| | `git_unstage` | Unstage files |
|
|
498
|
+
| | `git_commit` | Create commit |
|
|
499
|
+
| | `git_push` | Push to remote |
|
|
500
|
+
| | `git_file_base` | Get file at HEAD |
|
|
501
|
+
| **Commands** | `command_exec` | Execute shell command |
|
|
502
|
+
| | `command_cancel` | Cancel running command |
|
|
503
|
+
| **Agent** | `agent_session_new` | Start new Claude session |
|
|
504
|
+
| | `agent_message` | Send message to session |
|
|
505
|
+
| | `agent_sessions_list` | List existing sessions |
|
|
506
|
+
| | `agent_cancel` | Cancel running session |
|
|
507
|
+
| | `agent_prompt_response` | Respond to Claude prompt |
|
|
508
|
+
| **System** | `machines_list` | List user's machines |
|
|
509
|
+
| | `projects_list` | List projects |
|
|
510
|
+
|
|
511
|
+
---
|
|
512
|
+
|
|
513
|
+
## Features
|
|
514
|
+
|
|
515
|
+
### Filesystem Operations
|
|
516
|
+
|
|
517
|
+
```mermaid
|
|
518
|
+
sequenceDiagram
|
|
519
|
+
participant Client as Client
|
|
520
|
+
participant Relay as Relay
|
|
521
|
+
participant Daemon as Daemon
|
|
522
|
+
|
|
523
|
+
Note over Client,Daemon: READ OPERATIONS
|
|
524
|
+
Client->>Relay: fs_list {path: "src"}
|
|
525
|
+
Relay->>Daemon: forward
|
|
526
|
+
Note over Daemon: Read directory
|
|
527
|
+
Daemon-->>Relay: fs_list_response
|
|
528
|
+
Relay-->>Client: {children: [...]}
|
|
529
|
+
|
|
530
|
+
Client->>Relay: fs_read {path: "src/app.ts"}
|
|
531
|
+
Relay->>Daemon: forward
|
|
532
|
+
Daemon-->>Relay: fs_read_response
|
|
533
|
+
Relay-->>Client: {content: "..."}
|
|
534
|
+
|
|
535
|
+
Note over Client,Daemon: WRITE OPERATIONS
|
|
536
|
+
Client->>Relay: fs_write {path, content}
|
|
537
|
+
Relay->>Daemon: forward
|
|
538
|
+
Note over Daemon: Write to disk
|
|
539
|
+
Daemon-->>Relay: fs_write_response
|
|
540
|
+
Relay-->>Client: {success: true}
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
#### Lazy Tree Loading
|
|
544
|
+
|
|
545
|
+
The filesystem is loaded lazily for performance:
|
|
546
|
+
|
|
547
|
+
- Root: `fs_list(path="")` returns only root level
|
|
548
|
+
- Expand folder: `fs_list(path="src")` loads that directory
|
|
549
|
+
- Prevents sending large `node_modules` directories
|
|
550
|
+
|
|
551
|
+
#### Limits
|
|
552
|
+
|
|
553
|
+
| Limit | Value |
|
|
554
|
+
| --------------------------- | --------- |
|
|
555
|
+
| Maximum file read size | 10 MB |
|
|
556
|
+
| Maximum file write size | 1 MB |
|
|
557
|
+
| Maximum tree depth | 20 levels |
|
|
558
|
+
| Maximum entries per listing | 10,000 |
|
|
559
|
+
|
|
560
|
+
---
|
|
561
|
+
|
|
562
|
+
### File Watcher
|
|
563
|
+
|
|
564
|
+
The daemon uses chokidar to monitor filesystem changes in real-time.
|
|
565
|
+
|
|
566
|
+
```mermaid
|
|
567
|
+
graph TB
|
|
568
|
+
subgraph "Chokidar Watch"
|
|
569
|
+
WATCH["watch(projectPath)"]
|
|
570
|
+
IGNORE["Ignored Patterns:<br/>node_modules, .git,<br/>dist, build, .next"]
|
|
571
|
+
end
|
|
572
|
+
|
|
573
|
+
subgraph "Change Detection"
|
|
574
|
+
ADD["add/addDir → create"]
|
|
575
|
+
MOD["change → modify"]
|
|
576
|
+
DEL["unlink/unlinkDir → delete"]
|
|
577
|
+
end
|
|
578
|
+
|
|
579
|
+
subgraph "Accumulation"
|
|
580
|
+
PEND["Pending Changes"]
|
|
581
|
+
DEBOUNCE["Debounce Timer<br/>(250ms)"]
|
|
582
|
+
end
|
|
583
|
+
|
|
584
|
+
subgraph "Event Generation"
|
|
585
|
+
SEQ["Increment sequence"]
|
|
586
|
+
TRUNC["Truncate if > 500"]
|
|
587
|
+
EVENT["fs_changed event"]
|
|
588
|
+
end
|
|
589
|
+
|
|
590
|
+
WATCH -->|Event| ADD
|
|
591
|
+
WATCH -->|Event| MOD
|
|
592
|
+
WATCH -->|Event| DEL
|
|
593
|
+
|
|
594
|
+
ADD --> PEND
|
|
595
|
+
MOD --> PEND
|
|
596
|
+
DEL --> PEND
|
|
597
|
+
|
|
598
|
+
PEND -->|Schedule| DEBOUNCE
|
|
599
|
+
DEBOUNCE -->|Fire| SEQ
|
|
600
|
+
SEQ --> TRUNC
|
|
601
|
+
TRUNC --> EVENT
|
|
602
|
+
|
|
603
|
+
IGNORE -.->|Filters| WATCH
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
#### Event Message
|
|
607
|
+
|
|
608
|
+
```typescript
|
|
609
|
+
{
|
|
610
|
+
type: 'fs_changed',
|
|
611
|
+
sessionId: 'proj_abc',
|
|
612
|
+
payload: {
|
|
613
|
+
seq: 43, // Incremental sequence
|
|
614
|
+
changes: [
|
|
615
|
+
{ kind: 'create', path: 'src/new.ts' },
|
|
616
|
+
{ kind: 'modify', path: 'src/app.ts' },
|
|
617
|
+
{ kind: 'delete', path: 'src/old.ts' }
|
|
618
|
+
],
|
|
619
|
+
changesTruncated?: boolean // true if >500 changes
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
#### Synchronization
|
|
625
|
+
|
|
626
|
+
- Each change increments `seq` globally per project
|
|
627
|
+
- Client tracks last `seq` received
|
|
628
|
+
- On seq gap: client triggers full `fs_list` refresh
|
|
629
|
+
|
|
630
|
+
---
|
|
631
|
+
|
|
632
|
+
### Command Runner
|
|
633
|
+
|
|
634
|
+
Non-interactive shell command execution with streaming output.
|
|
635
|
+
|
|
636
|
+
```mermaid
|
|
637
|
+
sequenceDiagram
|
|
638
|
+
participant Client as Client
|
|
639
|
+
participant Relay as Relay
|
|
640
|
+
participant Daemon as Daemon
|
|
641
|
+
|
|
642
|
+
Client->>Relay: command_exec {command: "npm test"}
|
|
643
|
+
Relay->>Daemon: forward
|
|
644
|
+
Note over Daemon: Spawn process
|
|
645
|
+
|
|
646
|
+
loop Streaming output
|
|
647
|
+
Daemon--)Relay: command_output {stdoutChunk}
|
|
648
|
+
Relay--)Client: forward
|
|
649
|
+
Daemon--)Relay: command_output {stderrChunk}
|
|
650
|
+
Relay--)Client: forward
|
|
651
|
+
end
|
|
652
|
+
|
|
653
|
+
Daemon-->>Relay: command_exit {exitCode: 0}
|
|
654
|
+
Relay-->>Client: forward
|
|
655
|
+
|
|
656
|
+
Note over Client,Daemon: CANCELLATION
|
|
657
|
+
Client->>Relay: command_cancel {requestId}
|
|
658
|
+
Relay->>Daemon: forward
|
|
659
|
+
Note over Daemon: kill (SIGTERM)
|
|
660
|
+
Daemon-->>Relay: command_exit {exitCode: null, signal: "SIGTERM"}
|
|
661
|
+
Relay-->>Client: forward
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
#### Design Principles
|
|
665
|
+
|
|
666
|
+
- **One-shot execution**: Command must terminate on its own
|
|
667
|
+
- **No interactive TTY**: stdout/stderr captured and streamed
|
|
668
|
+
- **Cancellation support**: Kill process on request
|
|
669
|
+
- **Timeout protection**: 120 second default timeout
|
|
670
|
+
|
|
671
|
+
#### Limits
|
|
672
|
+
|
|
673
|
+
| Limit | Value |
|
|
674
|
+
| ----------------- | --------------------- |
|
|
675
|
+
| Default timeout | 120 seconds |
|
|
676
|
+
| Maximum output | 300 KB (truncated) |
|
|
677
|
+
| Working directory | Fixed to project path |
|
|
678
|
+
|
|
679
|
+
---
|
|
680
|
+
|
|
681
|
+
### Git Integration
|
|
682
|
+
|
|
683
|
+
```mermaid
|
|
684
|
+
sequenceDiagram
|
|
685
|
+
participant Client as Client
|
|
686
|
+
participant Relay as Relay
|
|
687
|
+
participant Daemon as Daemon
|
|
688
|
+
|
|
689
|
+
Note over Client,Daemon: STATUS & BRANCHES
|
|
690
|
+
Client->>Relay: git_status
|
|
691
|
+
Relay->>Daemon: forward
|
|
692
|
+
Note over Daemon: git status --porcelain
|
|
693
|
+
Daemon-->>Relay: git_status_response
|
|
694
|
+
Relay-->>Client: {branch, staged, unstaged}
|
|
695
|
+
|
|
696
|
+
Note over Client,Daemon: STAGE & COMMIT
|
|
697
|
+
Client->>Relay: git_stage {paths}
|
|
698
|
+
Relay->>Daemon: forward
|
|
699
|
+
Note over Daemon: git add
|
|
700
|
+
Daemon-->>Relay: git_stage_response
|
|
701
|
+
Relay-->>Client: success
|
|
702
|
+
|
|
703
|
+
Client->>Relay: git_commit {message}
|
|
704
|
+
Relay->>Daemon: forward
|
|
705
|
+
Note over Daemon: git commit -m
|
|
706
|
+
Daemon-->>Relay: git_commit_response
|
|
707
|
+
Relay-->>Client: {sha: "abc123"}
|
|
708
|
+
|
|
709
|
+
Note over Client,Daemon: PUSH
|
|
710
|
+
Client->>Relay: git_push
|
|
711
|
+
Relay->>Daemon: forward
|
|
712
|
+
Note over Daemon: git push
|
|
713
|
+
Daemon-->>Relay: git_push_response
|
|
714
|
+
Relay-->>Client: success
|
|
715
|
+
|
|
716
|
+
Note over Client,Daemon: DIFF (via file base)
|
|
717
|
+
Client->>Relay: git_file_base {path}
|
|
718
|
+
Relay->>Daemon: forward
|
|
719
|
+
Note over Daemon: git show HEAD:path
|
|
720
|
+
Daemon-->>Relay: git_file_base_response
|
|
721
|
+
Relay-->>Client: {content}
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
#### Git Operations
|
|
725
|
+
|
|
726
|
+
| Operation | Git Command | Description |
|
|
727
|
+
| ------------------- | --------------------------- | ------------------------------ |
|
|
728
|
+
| `git_status` | `git status --porcelain=v1` | Branch, staged, unstaged files |
|
|
729
|
+
| `git_branches` | `git for-each-ref` | List all branches |
|
|
730
|
+
| `git_branch_create` | `git branch <name>` | Create new branch |
|
|
731
|
+
| `git_checkout` | `git checkout <ref>` | Switch branch/commit |
|
|
732
|
+
| `git_stage` | `git add <paths>` | Stage files |
|
|
733
|
+
| `git_unstage` | `git reset HEAD <paths>` | Unstage files |
|
|
734
|
+
| `git_commit` | `git commit -m` | Create commit |
|
|
735
|
+
| `git_push` | `git push` | Push to remote |
|
|
736
|
+
| `git_file_base` | `git show HEAD:<path>` | Get file at HEAD |
|
|
737
|
+
|
|
738
|
+
---
|
|
739
|
+
|
|
740
|
+
### Claude Code Integration
|
|
741
|
+
|
|
742
|
+
```mermaid
|
|
743
|
+
sequenceDiagram
|
|
744
|
+
participant Client as Client
|
|
745
|
+
participant Relay as Relay
|
|
746
|
+
participant Daemon as Daemon
|
|
747
|
+
participant Claude as Claude CLI
|
|
748
|
+
|
|
749
|
+
Note over Client,Claude: NEW SESSION
|
|
750
|
+
Client->>Relay: agent_session_new {content}
|
|
751
|
+
Relay->>Daemon: forward
|
|
752
|
+
Note over Daemon: Generate agentSessionId
|
|
753
|
+
Daemon->>Claude: claude -p --output-format stream-json --session-id uuid "prompt"
|
|
754
|
+
Daemon-->>Relay: agent_session_new_response {agentSessionId}
|
|
755
|
+
Relay-->>Client: forward
|
|
756
|
+
|
|
757
|
+
loop Streaming events
|
|
758
|
+
Claude-->>Daemon: JSON line
|
|
759
|
+
Daemon--)Relay: agent_event {type: "text"}
|
|
760
|
+
Relay--)Client: forward
|
|
761
|
+
Daemon--)Relay: agent_event {type: "tool_use"}
|
|
762
|
+
Relay--)Client: forward
|
|
763
|
+
end
|
|
764
|
+
|
|
765
|
+
Claude-->>Daemon: result line
|
|
766
|
+
Daemon--)Relay: agent_event {type: "done"}
|
|
767
|
+
Relay--)Client: forward
|
|
768
|
+
|
|
769
|
+
Note over Client,Claude: CONTINUE SESSION
|
|
770
|
+
Client->>Relay: agent_message {agentSessionId, content}
|
|
771
|
+
Relay->>Daemon: forward
|
|
772
|
+
Daemon->>Claude: claude -p --resume sessionId "prompt"
|
|
773
|
+
loop Streaming
|
|
774
|
+
Daemon--)Relay: agent_event
|
|
775
|
+
Relay--)Client: forward
|
|
776
|
+
end
|
|
777
|
+
|
|
778
|
+
Note over Client,Claude: CANCEL
|
|
779
|
+
Client->>Relay: agent_cancel
|
|
780
|
+
Relay->>Daemon: forward
|
|
781
|
+
Note over Daemon: kill (SIGTERM)
|
|
782
|
+
Daemon--)Relay: agent_event {type: "done", cancelled: true}
|
|
783
|
+
Relay--)Client: forward
|
|
784
|
+
```
|
|
785
|
+
|
|
786
|
+
#### Execution Model
|
|
787
|
+
|
|
788
|
+
The daemon does NOT keep Claude Code processes alive permanently:
|
|
789
|
+
|
|
790
|
+
1. Message arrives from client
|
|
791
|
+
2. Daemon spawns `claude -p --output-format stream-json --verbose ...`
|
|
792
|
+
3. Streaming response to client
|
|
793
|
+
4. Process terminates
|
|
794
|
+
5. Next message resumes with `--resume <agentSessionId>`
|
|
795
|
+
|
|
796
|
+
#### Claude CLI Flags
|
|
797
|
+
|
|
798
|
+
| Flag | Description |
|
|
799
|
+
| ----------------------------- | ------------------------- |
|
|
800
|
+
| `-p, --print` | Non-interactive mode |
|
|
801
|
+
| `--output-format stream-json` | Structured JSON output |
|
|
802
|
+
| `--verbose` | Required with stream-json |
|
|
803
|
+
| `--session-id <uuid>` | Create specific session |
|
|
804
|
+
| `-r, --resume <uuid>` | Resume existing session |
|
|
805
|
+
|
|
806
|
+
#### Stream JSON Parser
|
|
807
|
+
|
|
808
|
+
Claude Code emits line-delimited JSON. The daemon parses and transforms:
|
|
809
|
+
|
|
810
|
+
```mermaid
|
|
811
|
+
graph LR
|
|
812
|
+
subgraph "Claude stdout"
|
|
813
|
+
SYS["system init"]
|
|
814
|
+
ASS["assistant"]
|
|
815
|
+
USER["user"]
|
|
816
|
+
RES["result"]
|
|
817
|
+
end
|
|
818
|
+
|
|
819
|
+
subgraph "StreamJsonBuffer"
|
|
820
|
+
BUF["Parse lines"]
|
|
821
|
+
end
|
|
822
|
+
|
|
823
|
+
subgraph "AgentEvents"
|
|
824
|
+
INIT["init"]
|
|
825
|
+
TEXT["text"]
|
|
826
|
+
FC["file_create"]
|
|
827
|
+
FE["file_edit"]
|
|
828
|
+
TU["tool_use"]
|
|
829
|
+
PROMPT["prompt"]
|
|
830
|
+
DONE["done"]
|
|
831
|
+
end
|
|
832
|
+
|
|
833
|
+
SYS --> BUF
|
|
834
|
+
ASS --> BUF
|
|
835
|
+
USER --> BUF
|
|
836
|
+
RES --> BUF
|
|
837
|
+
|
|
838
|
+
BUF --> INIT
|
|
839
|
+
BUF --> TEXT
|
|
840
|
+
BUF --> FC
|
|
841
|
+
BUF --> FE
|
|
842
|
+
BUF --> TU
|
|
843
|
+
BUF --> PROMPT
|
|
844
|
+
BUF --> DONE
|
|
845
|
+
```
|
|
846
|
+
|
|
847
|
+
#### Message Queue
|
|
848
|
+
|
|
849
|
+
- **FIFO queue per session**: Max 50 messages
|
|
850
|
+
- **One Claude process per agentSessionId**
|
|
851
|
+
- **Queue drains after process completes**
|
|
852
|
+
- **If queue full**: Reject with `DAEMON_BUSY`
|
|
853
|
+
|
|
854
|
+
---
|
|
855
|
+
|
|
856
|
+
## Control Plane HTTP API
|
|
857
|
+
|
|
858
|
+
Local HTTP server on `127.0.0.1:17333` for daemon management.
|
|
859
|
+
|
|
860
|
+
| Route | Method | Description |
|
|
861
|
+
| ---------------- | ------ | ------------------------ |
|
|
862
|
+
| `/health` | GET | Health check (empty 200) |
|
|
863
|
+
| `/status` | GET | Detailed daemon status |
|
|
864
|
+
| `/stop` | POST | Graceful shutdown |
|
|
865
|
+
| `/machine-label` | GET | Get machine label |
|
|
866
|
+
| `/machine-label` | POST | Set machine label |
|
|
867
|
+
| `/re-register` | POST | Re-register with relay |
|
|
868
|
+
|
|
869
|
+
### Status Response
|
|
870
|
+
|
|
871
|
+
```json
|
|
872
|
+
{
|
|
873
|
+
"version": "1.0.0",
|
|
874
|
+
"machineKey": "550e8400-e29b-41d4-a716-446655440000",
|
|
875
|
+
"loggedIn": true,
|
|
876
|
+
"relay": {
|
|
877
|
+
"connected": true,
|
|
878
|
+
"lastConnectedAt": "2026-02-12T10:00:00Z",
|
|
879
|
+
"lastHeartbeatAt": "2026-02-12T10:15:00Z"
|
|
880
|
+
},
|
|
881
|
+
"capabilities": {
|
|
882
|
+
"hasGit": true,
|
|
883
|
+
"hasClaude": true,
|
|
884
|
+
"claudeStoreFound": true,
|
|
885
|
+
"warnings": []
|
|
886
|
+
},
|
|
887
|
+
"projects": [
|
|
888
|
+
{
|
|
889
|
+
"projectId": "550e8400-...",
|
|
890
|
+
"name": "my-app",
|
|
891
|
+
"path": "/Users/dev/my-app",
|
|
892
|
+
"watcherRunning": true,
|
|
893
|
+
"lastFsSeq": 123
|
|
894
|
+
}
|
|
895
|
+
]
|
|
896
|
+
}
|
|
897
|
+
```
|
|
898
|
+
|
|
899
|
+
---
|
|
900
|
+
|
|
901
|
+
## Database Schema
|
|
902
|
+
|
|
903
|
+
SQLite database at `~/.pocketcoder/daemon.db`:
|
|
904
|
+
|
|
905
|
+
```mermaid
|
|
906
|
+
erDiagram
|
|
907
|
+
PROJECTS ||--o{ FS_STATE : "1:1"
|
|
908
|
+
PROJECTS ||--o{ COMMAND_RUNS : "1:N"
|
|
909
|
+
PROJECTS ||--o{ CLAUDE_PROJECT_DIRS : "1:N"
|
|
910
|
+
|
|
911
|
+
PROJECTS {
|
|
912
|
+
text project_id PK
|
|
913
|
+
text name
|
|
914
|
+
text path UK
|
|
915
|
+
datetime created_at
|
|
916
|
+
datetime last_opened_at
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
FS_STATE {
|
|
920
|
+
text project_id PK,FK
|
|
921
|
+
integer last_seq
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
COMMAND_RUNS {
|
|
925
|
+
text request_id PK
|
|
926
|
+
text project_id FK
|
|
927
|
+
text command
|
|
928
|
+
datetime started_at
|
|
929
|
+
datetime ended_at
|
|
930
|
+
integer exit_code
|
|
931
|
+
boolean truncated
|
|
932
|
+
text output_preview
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
CLAUDE_PROJECT_DIRS {
|
|
936
|
+
text project_id PK,FK
|
|
937
|
+
text claude_dir_path PK
|
|
938
|
+
datetime last_verified_at
|
|
939
|
+
}
|
|
940
|
+
```
|
|
941
|
+
|
|
942
|
+
### Retention Policy
|
|
943
|
+
|
|
944
|
+
| Table | Policy |
|
|
945
|
+
| --------------------- | ---------------------------- |
|
|
946
|
+
| `projects` | No limit |
|
|
947
|
+
| `fs_state` | No limit (1 row per project) |
|
|
948
|
+
| `claude_project_dirs` | No limit |
|
|
949
|
+
| `command_runs` | 7 days or max 10,000 rows |
|
|
950
|
+
|
|
951
|
+
Cleanup runs on startup and every 6 hours.
|
|
952
|
+
|
|
953
|
+
---
|
|
954
|
+
|
|
955
|
+
## CLI Commands
|
|
956
|
+
|
|
957
|
+
| Command | Description |
|
|
958
|
+
| ---------------------------------- | ------------------------- |
|
|
959
|
+
| `pocketcoder login` | Authenticate with GitHub |
|
|
960
|
+
| `pocketcoder logout` | Delete stored credentials |
|
|
961
|
+
| `pocketcoder start` | Start daemon (background) |
|
|
962
|
+
| `pocketcoder start --foreground` | Start in foreground |
|
|
963
|
+
| `pocketcoder stop` | Stop daemon gracefully |
|
|
964
|
+
| `pocketcoder status` | Show daemon status |
|
|
965
|
+
| `pocketcoder add <path>` | Register project |
|
|
966
|
+
| `pocketcoder remove <projectId>` | Unregister project |
|
|
967
|
+
| `pocketcoder projects` | List registered projects |
|
|
968
|
+
| `pocketcoder logs [--tail N] [-f]` | View daemon logs |
|
|
969
|
+
| `pocketcoder machine label <text>` | Set machine label |
|
|
970
|
+
| `pocketcoder enable-autostart` | Enable autostart |
|
|
971
|
+
| `pocketcoder disable-autostart` | Disable autostart |
|
|
972
|
+
|
|
973
|
+
---
|
|
974
|
+
|
|
975
|
+
## Error Handling
|
|
976
|
+
|
|
977
|
+
All errors are caught at router level and converted to error responses:
|
|
978
|
+
|
|
979
|
+
```typescript
|
|
980
|
+
{
|
|
981
|
+
type: "error",
|
|
982
|
+
requestId: "req_123",
|
|
983
|
+
error: {
|
|
984
|
+
code: "FILE_NOT_FOUND",
|
|
985
|
+
message: "File does not exist",
|
|
986
|
+
details?: { path: "src/missing.ts" }
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
### Error Codes
|
|
992
|
+
|
|
993
|
+
| Code | Description |
|
|
994
|
+
| ---------------------- | ------------------------ |
|
|
995
|
+
| `UNKNOWN_ERROR` | Generic error |
|
|
996
|
+
| `INVALID_REQUEST` | Missing/invalid payload |
|
|
997
|
+
| `UNAUTHORIZED` | Authentication failed |
|
|
998
|
+
| `PROJECT_NOT_FOUND` | Project doesn't exist |
|
|
999
|
+
| `FILE_NOT_FOUND` | File doesn't exist |
|
|
1000
|
+
| `FILE_TOO_LARGE` | File exceeds 10MB |
|
|
1001
|
+
| `OUTSIDE_PROJECT_ROOT` | Path escape attempt |
|
|
1002
|
+
| `GIT_NOT_INITIALIZED` | Not a git repo |
|
|
1003
|
+
| `COMMAND_TIMEOUT` | Command exceeded timeout |
|
|
1004
|
+
| `DAEMON_BUSY` | Queue full (50 max) |
|
|
1005
|
+
|
|
1006
|
+
---
|
|
1007
|
+
|
|
1008
|
+
## Configuration
|
|
1009
|
+
|
|
1010
|
+
### Environment Variables
|
|
1011
|
+
|
|
1012
|
+
| Variable | Description | Default |
|
|
1013
|
+
| ------------- | --------------------- | ------------------------------- |
|
|
1014
|
+
| `GATEWAY_URL` | Gateway WebSocket URL | `wss://gateway.pocketcoder.dev` |
|
|
1015
|
+
| `LOG_LEVEL` | Logging level | `info` |
|
|
1016
|
+
|
|
1017
|
+
### Config Directory
|
|
1018
|
+
|
|
1019
|
+
| OS | Path |
|
|
1020
|
+
| ------- | -------------------------------------------- |
|
|
1021
|
+
| macOS | `~/Library/Application Support/pocketcoder/` |
|
|
1022
|
+
| Linux | `~/.config/pocketcoder/` |
|
|
1023
|
+
| Windows | `%APPDATA%\pocketcoder\` |
|
|
1024
|
+
|
|
1025
|
+
### Files
|
|
1026
|
+
|
|
1027
|
+
| File | Purpose |
|
|
1028
|
+
| ------------------- | ---------------------------- |
|
|
1029
|
+
| `daemon.db` | SQLite database |
|
|
1030
|
+
| `auth.json` | Authentication tokens |
|
|
1031
|
+
| `machine-label.txt` | User-set machine name |
|
|
1032
|
+
| `daemon.pid` | PID file (running indicator) |
|
|
1033
|
+
| `logs/daemon.log` | Log file |
|
|
1034
|
+
|
|
1035
|
+
---
|
|
1036
|
+
|
|
1037
|
+
## Testing
|
|
1038
|
+
|
|
1039
|
+
```bash
|
|
1040
|
+
# Run all tests
|
|
1041
|
+
pnpm test
|
|
1042
|
+
|
|
1043
|
+
# Run tests in watch mode
|
|
1044
|
+
pnpm test -- --watch
|
|
1045
|
+
|
|
1046
|
+
# Run specific test file
|
|
1047
|
+
pnpm test -- --run src/handlers/fs-list.test.ts
|
|
1048
|
+
|
|
1049
|
+
# Run with coverage
|
|
1050
|
+
pnpm test -- --coverage
|
|
1051
|
+
```
|
|
1052
|
+
|
|
1053
|
+
### Test Structure
|
|
1054
|
+
|
|
1055
|
+
```
|
|
1056
|
+
tests/
|
|
1057
|
+
├── handlers/ # Message handler tests
|
|
1058
|
+
├── services/ # Service tests
|
|
1059
|
+
├── auth/ # Auth flow tests
|
|
1060
|
+
├── relay/ # Relay connection tests
|
|
1061
|
+
├── db/ # Database tests
|
|
1062
|
+
├── cli/ # CLI command tests
|
|
1063
|
+
└── utils/ # Utility tests
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
---
|
|
1067
|
+
|
|
1068
|
+
## Security
|
|
1069
|
+
|
|
1070
|
+
### Network Security
|
|
1071
|
+
|
|
1072
|
+
- **Outbound-only**: Daemon only makes outbound WebSocket connection
|
|
1073
|
+
- **No public listeners**: Control plane bound to `127.0.0.1` only
|
|
1074
|
+
- **JWT authentication**: All relay communication authenticated
|
|
1075
|
+
|
|
1076
|
+
### File Security
|
|
1077
|
+
|
|
1078
|
+
- **Path validation**: All paths validated to be within project root
|
|
1079
|
+
- **Symlink protection**: No escape via symlinks
|
|
1080
|
+
- **Token storage**: Restrictive permissions (0600)
|
|
1081
|
+
|
|
1082
|
+
### Threat Model
|
|
1083
|
+
|
|
1084
|
+
- Without stolen JWT: Access probability = 0
|
|
1085
|
+
- With stolen JWT: Full access (focus on secure storage)
|
|
1086
|
+
- Anti-enumeration: Always respond `not_found` on auth errors
|
|
1087
|
+
|
|
1088
|
+
---
|
|
1089
|
+
|
|
1090
|
+
## Performance Limits
|
|
1091
|
+
|
|
1092
|
+
| Aspect | Limit | Rationale |
|
|
1093
|
+
| --------------------- | -------------- | ------------------------ |
|
|
1094
|
+
| Message Queue | 50 per session | Prevent unbounded memory |
|
|
1095
|
+
| File Changes | 500 per event | Batch large fs events |
|
|
1096
|
+
| Command Output | 300 KB | Prevent huge payloads |
|
|
1097
|
+
| Command Timeout | 120s | Prevent stuck processes |
|
|
1098
|
+
| File Size | 10 MB | Binary detection |
|
|
1099
|
+
| Debounce Delay | 250ms | Batch file events |
|
|
1100
|
+
| Relay Request Timeout | 15s | Prevent blocking |
|
|
1101
|
+
|
|
1102
|
+
---
|
|
1103
|
+
|
|
1104
|
+
## License
|
|
1105
|
+
|
|
1106
|
+
See the root [LICENSE](../../LICENSE) file.
|