@jacques-ai/server 0.0.7-alpha.1
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/dist/config/config.d.ts +34 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +32 -0
- package/dist/config/config.js.map +1 -0
- package/dist/connection/applescript.d.ts +46 -0
- package/dist/connection/applescript.d.ts.map +1 -0
- package/dist/connection/applescript.js +62 -0
- package/dist/connection/applescript.js.map +1 -0
- package/dist/connection/applescript.test.d.ts +5 -0
- package/dist/connection/applescript.test.d.ts.map +1 -0
- package/dist/connection/applescript.test.js +64 -0
- package/dist/connection/applescript.test.js.map +1 -0
- package/dist/connection/constants.d.ts +88 -0
- package/dist/connection/constants.d.ts.map +1 -0
- package/dist/connection/constants.js +110 -0
- package/dist/connection/constants.js.map +1 -0
- package/dist/connection/git-info.d.ts +30 -0
- package/dist/connection/git-info.d.ts.map +1 -0
- package/dist/connection/git-info.js +52 -0
- package/dist/connection/git-info.js.map +1 -0
- package/dist/connection/git-info.test.d.ts +5 -0
- package/dist/connection/git-info.test.d.ts.map +1 -0
- package/dist/connection/git-info.test.js +35 -0
- package/dist/connection/git-info.test.js.map +1 -0
- package/dist/connection/index.d.ts +19 -0
- package/dist/connection/index.d.ts.map +1 -0
- package/dist/connection/index.js +36 -0
- package/dist/connection/index.js.map +1 -0
- package/dist/connection/process-detection.d.ts +58 -0
- package/dist/connection/process-detection.d.ts.map +1 -0
- package/dist/connection/process-detection.js +239 -0
- package/dist/connection/process-detection.js.map +1 -0
- package/dist/connection/process-detection.test.d.ts +5 -0
- package/dist/connection/process-detection.test.d.ts.map +1 -0
- package/dist/connection/process-detection.test.js +43 -0
- package/dist/connection/process-detection.test.js.map +1 -0
- package/dist/connection/session-discovery.d.ts +55 -0
- package/dist/connection/session-discovery.d.ts.map +1 -0
- package/dist/connection/session-discovery.js +311 -0
- package/dist/connection/session-discovery.js.map +1 -0
- package/dist/connection/terminal-key.d.ts +126 -0
- package/dist/connection/terminal-key.d.ts.map +1 -0
- package/dist/connection/terminal-key.js +271 -0
- package/dist/connection/terminal-key.js.map +1 -0
- package/dist/connection/terminal-key.test.d.ts +5 -0
- package/dist/connection/terminal-key.test.d.ts.map +1 -0
- package/dist/connection/terminal-key.test.js +221 -0
- package/dist/connection/terminal-key.test.js.map +1 -0
- package/dist/connection/worktree.d.ts +114 -0
- package/dist/connection/worktree.d.ts.map +1 -0
- package/dist/connection/worktree.js +320 -0
- package/dist/connection/worktree.js.map +1 -0
- package/dist/connection/worktree.test.d.ts +5 -0
- package/dist/connection/worktree.test.d.ts.map +1 -0
- package/dist/connection/worktree.test.js +113 -0
- package/dist/connection/worktree.test.js.map +1 -0
- package/dist/focus-watcher.d.ts +51 -0
- package/dist/focus-watcher.d.ts.map +1 -0
- package/dist/focus-watcher.js +169 -0
- package/dist/focus-watcher.js.map +1 -0
- package/dist/handlers/event-handler.d.ts +93 -0
- package/dist/handlers/event-handler.d.ts.map +1 -0
- package/dist/handlers/event-handler.js +196 -0
- package/dist/handlers/event-handler.js.map +1 -0
- package/dist/handlers/event-handler.test.d.ts +5 -0
- package/dist/handlers/event-handler.test.d.ts.map +1 -0
- package/dist/handlers/event-handler.test.js +305 -0
- package/dist/handlers/event-handler.test.js.map +1 -0
- package/dist/handlers/session-handler.d.ts +23 -0
- package/dist/handlers/session-handler.d.ts.map +1 -0
- package/dist/handlers/session-handler.js +104 -0
- package/dist/handlers/session-handler.js.map +1 -0
- package/dist/handlers/session-handler.test.d.ts +5 -0
- package/dist/handlers/session-handler.test.d.ts.map +1 -0
- package/dist/handlers/session-handler.test.js +89 -0
- package/dist/handlers/session-handler.test.js.map +1 -0
- package/dist/handlers/settings-handler.d.ts +32 -0
- package/dist/handlers/settings-handler.d.ts.map +1 -0
- package/dist/handlers/settings-handler.js +127 -0
- package/dist/handlers/settings-handler.js.map +1 -0
- package/dist/handlers/settings-handler.test.d.ts +5 -0
- package/dist/handlers/settings-handler.test.d.ts.map +1 -0
- package/dist/handlers/settings-handler.test.js +105 -0
- package/dist/handlers/settings-handler.test.js.map +1 -0
- package/dist/handlers/window-handler.d.ts +30 -0
- package/dist/handlers/window-handler.d.ts.map +1 -0
- package/dist/handlers/window-handler.js +486 -0
- package/dist/handlers/window-handler.js.map +1 -0
- package/dist/handlers/window-handler.test.d.ts +8 -0
- package/dist/handlers/window-handler.test.d.ts.map +1 -0
- package/dist/handlers/window-handler.test.js +167 -0
- package/dist/handlers/window-handler.test.js.map +1 -0
- package/dist/handlers/worktree-handler.d.ts +28 -0
- package/dist/handlers/worktree-handler.d.ts.map +1 -0
- package/dist/handlers/worktree-handler.js +268 -0
- package/dist/handlers/worktree-handler.js.map +1 -0
- package/dist/handlers/worktree-handler.test.d.ts +8 -0
- package/dist/handlers/worktree-handler.test.d.ts.map +1 -0
- package/dist/handlers/worktree-handler.test.js +118 -0
- package/dist/handlers/worktree-handler.test.js.map +1 -0
- package/dist/handlers/ws-utils.d.ts +12 -0
- package/dist/handlers/ws-utils.d.ts.map +1 -0
- package/dist/handlers/ws-utils.js +16 -0
- package/dist/handlers/ws-utils.js.map +1 -0
- package/dist/http-api.d.ts +26 -0
- package/dist/http-api.d.ts.map +1 -0
- package/dist/http-api.js +148 -0
- package/dist/http-api.js.map +1 -0
- package/dist/logger.d.ts +42 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +147 -0
- package/dist/logger.js.map +1 -0
- package/dist/logging/logger-factory.d.ts +51 -0
- package/dist/logging/logger-factory.d.ts.map +1 -0
- package/dist/logging/logger-factory.js +59 -0
- package/dist/logging/logger-factory.js.map +1 -0
- package/dist/mcp/search-tool.d.ts +65 -0
- package/dist/mcp/search-tool.d.ts.map +1 -0
- package/dist/mcp/search-tool.js +176 -0
- package/dist/mcp/search-tool.js.map +1 -0
- package/dist/mcp/server.d.ts +9 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +152 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/process-scanner.d.ts +96 -0
- package/dist/process-scanner.d.ts.map +1 -0
- package/dist/process-scanner.js +194 -0
- package/dist/process-scanner.js.map +1 -0
- package/dist/routes/__tests__/archive-routes.test.d.ts +5 -0
- package/dist/routes/__tests__/archive-routes.test.d.ts.map +1 -0
- package/dist/routes/__tests__/archive-routes.test.js +158 -0
- package/dist/routes/__tests__/archive-routes.test.js.map +1 -0
- package/dist/routes/__tests__/config-routes.test.d.ts +5 -0
- package/dist/routes/__tests__/config-routes.test.d.ts.map +1 -0
- package/dist/routes/__tests__/config-routes.test.js +112 -0
- package/dist/routes/__tests__/config-routes.test.js.map +1 -0
- package/dist/routes/__tests__/http-utils.test.d.ts +5 -0
- package/dist/routes/__tests__/http-utils.test.d.ts.map +1 -0
- package/dist/routes/__tests__/http-utils.test.js +102 -0
- package/dist/routes/__tests__/http-utils.test.js.map +1 -0
- package/dist/routes/__tests__/notification-routes.test.d.ts +5 -0
- package/dist/routes/__tests__/notification-routes.test.d.ts.map +1 -0
- package/dist/routes/__tests__/notification-routes.test.js +91 -0
- package/dist/routes/__tests__/notification-routes.test.js.map +1 -0
- package/dist/routes/__tests__/project-routes.test.d.ts +5 -0
- package/dist/routes/__tests__/project-routes.test.d.ts.map +1 -0
- package/dist/routes/__tests__/project-routes.test.js +168 -0
- package/dist/routes/__tests__/project-routes.test.js.map +1 -0
- package/dist/routes/__tests__/session-routes.test.d.ts +5 -0
- package/dist/routes/__tests__/session-routes.test.d.ts.map +1 -0
- package/dist/routes/__tests__/session-routes.test.js +198 -0
- package/dist/routes/__tests__/session-routes.test.js.map +1 -0
- package/dist/routes/__tests__/source-routes.test.d.ts +5 -0
- package/dist/routes/__tests__/source-routes.test.d.ts.map +1 -0
- package/dist/routes/__tests__/source-routes.test.js +142 -0
- package/dist/routes/__tests__/source-routes.test.js.map +1 -0
- package/dist/routes/__tests__/sync-routes.test.d.ts +5 -0
- package/dist/routes/__tests__/sync-routes.test.d.ts.map +1 -0
- package/dist/routes/__tests__/sync-routes.test.js +77 -0
- package/dist/routes/__tests__/sync-routes.test.js.map +1 -0
- package/dist/routes/__tests__/test-helpers.d.ts +47 -0
- package/dist/routes/__tests__/test-helpers.d.ts.map +1 -0
- package/dist/routes/__tests__/test-helpers.js +97 -0
- package/dist/routes/__tests__/test-helpers.js.map +1 -0
- package/dist/routes/archive-routes.d.ts +15 -0
- package/dist/routes/archive-routes.d.ts.map +1 -0
- package/dist/routes/archive-routes.js +181 -0
- package/dist/routes/archive-routes.js.map +1 -0
- package/dist/routes/claude-routes.d.ts +9 -0
- package/dist/routes/claude-routes.d.ts.map +1 -0
- package/dist/routes/claude-routes.js +47 -0
- package/dist/routes/claude-routes.js.map +1 -0
- package/dist/routes/config-routes.d.ts +9 -0
- package/dist/routes/config-routes.d.ts.map +1 -0
- package/dist/routes/config-routes.js +56 -0
- package/dist/routes/config-routes.js.map +1 -0
- package/dist/routes/config-store.d.ts +41 -0
- package/dist/routes/config-store.d.ts.map +1 -0
- package/dist/routes/config-store.js +52 -0
- package/dist/routes/config-store.js.map +1 -0
- package/dist/routes/http-utils.d.ts +32 -0
- package/dist/routes/http-utils.d.ts.map +1 -0
- package/dist/routes/http-utils.js +123 -0
- package/dist/routes/http-utils.js.map +1 -0
- package/dist/routes/index.d.ts +19 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/index.js +17 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/notification-routes.d.ts +10 -0
- package/dist/routes/notification-routes.d.ts.map +1 -0
- package/dist/routes/notification-routes.js +64 -0
- package/dist/routes/notification-routes.js.map +1 -0
- package/dist/routes/project-routes.d.ts +22 -0
- package/dist/routes/project-routes.d.ts.map +1 -0
- package/dist/routes/project-routes.js +415 -0
- package/dist/routes/project-routes.js.map +1 -0
- package/dist/routes/session-routes.d.ts +18 -0
- package/dist/routes/session-routes.d.ts.map +1 -0
- package/dist/routes/session-routes.js +609 -0
- package/dist/routes/session-routes.js.map +1 -0
- package/dist/routes/source-routes.d.ts +12 -0
- package/dist/routes/source-routes.d.ts.map +1 -0
- package/dist/routes/source-routes.js +119 -0
- package/dist/routes/source-routes.js.map +1 -0
- package/dist/routes/static-routes.d.ts +12 -0
- package/dist/routes/static-routes.d.ts.map +1 -0
- package/dist/routes/static-routes.js +52 -0
- package/dist/routes/static-routes.js.map +1 -0
- package/dist/routes/sync-routes.d.ts +9 -0
- package/dist/routes/sync-routes.d.ts.map +1 -0
- package/dist/routes/sync-routes.js +78 -0
- package/dist/routes/sync-routes.js.map +1 -0
- package/dist/routes/tile-routes.d.ts +10 -0
- package/dist/routes/tile-routes.d.ts.map +1 -0
- package/dist/routes/tile-routes.js +108 -0
- package/dist/routes/tile-routes.js.map +1 -0
- package/dist/routes/types.d.ts +17 -0
- package/dist/routes/types.d.ts.map +1 -0
- package/dist/routes/types.js +5 -0
- package/dist/routes/types.js.map +1 -0
- package/dist/routes/usage-routes.d.ts +8 -0
- package/dist/routes/usage-routes.d.ts.map +1 -0
- package/dist/routes/usage-routes.js +18 -0
- package/dist/routes/usage-routes.js.map +1 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +173 -0
- package/dist/server.js.map +1 -0
- package/dist/services/branch-divergence-service.d.ts +48 -0
- package/dist/services/branch-divergence-service.d.ts.map +1 -0
- package/dist/services/branch-divergence-service.js +156 -0
- package/dist/services/branch-divergence-service.js.map +1 -0
- package/dist/services/broadcast-service.d.ts +68 -0
- package/dist/services/broadcast-service.d.ts.map +1 -0
- package/dist/services/broadcast-service.js +78 -0
- package/dist/services/broadcast-service.js.map +1 -0
- package/dist/services/broadcast-service.test.d.ts +5 -0
- package/dist/services/broadcast-service.test.d.ts.map +1 -0
- package/dist/services/broadcast-service.test.js +130 -0
- package/dist/services/broadcast-service.test.js.map +1 -0
- package/dist/services/chat-service.d.ts +72 -0
- package/dist/services/chat-service.d.ts.map +1 -0
- package/dist/services/chat-service.js +342 -0
- package/dist/services/chat-service.js.map +1 -0
- package/dist/services/chat-system-prompt.d.ts +14 -0
- package/dist/services/chat-system-prompt.d.ts.map +1 -0
- package/dist/services/chat-system-prompt.js +68 -0
- package/dist/services/chat-system-prompt.js.map +1 -0
- package/dist/services/notification-service.d.ts +115 -0
- package/dist/services/notification-service.d.ts.map +1 -0
- package/dist/services/notification-service.js +424 -0
- package/dist/services/notification-service.js.map +1 -0
- package/dist/services/notification-service.test.d.ts +5 -0
- package/dist/services/notification-service.test.d.ts.map +1 -0
- package/dist/services/notification-service.test.js +918 -0
- package/dist/services/notification-service.test.js.map +1 -0
- package/dist/session/cleanup-service.d.ts +51 -0
- package/dist/session/cleanup-service.d.ts.map +1 -0
- package/dist/session/cleanup-service.js +98 -0
- package/dist/session/cleanup-service.js.map +1 -0
- package/dist/session/cleanup-service.test.d.ts +5 -0
- package/dist/session/cleanup-service.test.d.ts.map +1 -0
- package/dist/session/cleanup-service.test.js +121 -0
- package/dist/session/cleanup-service.test.js.map +1 -0
- package/dist/session/process-monitor.d.ts +79 -0
- package/dist/session/process-monitor.d.ts.map +1 -0
- package/dist/session/process-monitor.js +270 -0
- package/dist/session/process-monitor.js.map +1 -0
- package/dist/session/process-monitor.test.d.ts +5 -0
- package/dist/session/process-monitor.test.d.ts.map +1 -0
- package/dist/session/process-monitor.test.js +367 -0
- package/dist/session/process-monitor.test.js.map +1 -0
- package/dist/session/session-factory.d.ts +29 -0
- package/dist/session/session-factory.d.ts.map +1 -0
- package/dist/session/session-factory.js +123 -0
- package/dist/session/session-factory.js.map +1 -0
- package/dist/session/session-factory.test.d.ts +5 -0
- package/dist/session/session-factory.test.d.ts.map +1 -0
- package/dist/session/session-factory.test.js +299 -0
- package/dist/session/session-factory.test.js.map +1 -0
- package/dist/session-registry.d.ts +168 -0
- package/dist/session-registry.d.ts.map +1 -0
- package/dist/session-registry.js +626 -0
- package/dist/session-registry.js.map +1 -0
- package/dist/session-registry.test.d.ts +5 -0
- package/dist/session-registry.test.d.ts.map +1 -0
- package/dist/session-registry.test.js +582 -0
- package/dist/session-registry.test.js.map +1 -0
- package/dist/start-server.d.ts +31 -0
- package/dist/start-server.d.ts.map +1 -0
- package/dist/start-server.js +408 -0
- package/dist/start-server.js.map +1 -0
- package/dist/terminal-activator.d.ts +29 -0
- package/dist/terminal-activator.d.ts.map +1 -0
- package/dist/terminal-activator.js +264 -0
- package/dist/terminal-activator.js.map +1 -0
- package/dist/terminal-activator.test.d.ts +9 -0
- package/dist/terminal-activator.test.d.ts.map +1 -0
- package/dist/terminal-activator.test.js +95 -0
- package/dist/terminal-activator.test.js.map +1 -0
- package/dist/terminal-launcher.d.ts +51 -0
- package/dist/terminal-launcher.d.ts.map +1 -0
- package/dist/terminal-launcher.js +298 -0
- package/dist/terminal-launcher.js.map +1 -0
- package/dist/terminal-launcher.test.d.ts +8 -0
- package/dist/terminal-launcher.test.d.ts.map +1 -0
- package/dist/terminal-launcher.test.js +222 -0
- package/dist/terminal-launcher.test.js.map +1 -0
- package/dist/types.d.ts +796 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +15 -0
- package/dist/types.js.map +1 -0
- package/dist/unix-socket.d.ts +68 -0
- package/dist/unix-socket.d.ts.map +1 -0
- package/dist/unix-socket.js +180 -0
- package/dist/unix-socket.js.map +1 -0
- package/dist/usage-limits.d.ts +13 -0
- package/dist/usage-limits.d.ts.map +1 -0
- package/dist/usage-limits.js +112 -0
- package/dist/usage-limits.js.map +1 -0
- package/dist/watchers/handoff-watcher.d.ts +74 -0
- package/dist/watchers/handoff-watcher.d.ts.map +1 -0
- package/dist/watchers/handoff-watcher.js +124 -0
- package/dist/watchers/handoff-watcher.js.map +1 -0
- package/dist/watchers/handoff-watcher.test.d.ts +8 -0
- package/dist/watchers/handoff-watcher.test.d.ts.map +1 -0
- package/dist/watchers/handoff-watcher.test.js +142 -0
- package/dist/watchers/handoff-watcher.test.js.map +1 -0
- package/dist/websocket.d.ts +107 -0
- package/dist/websocket.d.ts.map +1 -0
- package/dist/websocket.js +268 -0
- package/dist/websocket.js.map +1 -0
- package/dist/window-manager/index.d.ts +28 -0
- package/dist/window-manager/index.d.ts.map +1 -0
- package/dist/window-manager/index.js +56 -0
- package/dist/window-manager/index.js.map +1 -0
- package/dist/window-manager/layouts.d.ts +42 -0
- package/dist/window-manager/layouts.d.ts.map +1 -0
- package/dist/window-manager/layouts.js +133 -0
- package/dist/window-manager/layouts.js.map +1 -0
- package/dist/window-manager/linux-manager.d.ts +45 -0
- package/dist/window-manager/linux-manager.d.ts.map +1 -0
- package/dist/window-manager/linux-manager.js +299 -0
- package/dist/window-manager/linux-manager.js.map +1 -0
- package/dist/window-manager/macos-manager.d.ts +103 -0
- package/dist/window-manager/macos-manager.d.ts.map +1 -0
- package/dist/window-manager/macos-manager.js +637 -0
- package/dist/window-manager/macos-manager.js.map +1 -0
- package/dist/window-manager/smart-layouts.d.ts +116 -0
- package/dist/window-manager/smart-layouts.d.ts.map +1 -0
- package/dist/window-manager/smart-layouts.js +188 -0
- package/dist/window-manager/smart-layouts.js.map +1 -0
- package/dist/window-manager/smart-layouts.test.d.ts +8 -0
- package/dist/window-manager/smart-layouts.test.d.ts.map +1 -0
- package/dist/window-manager/smart-layouts.test.js +311 -0
- package/dist/window-manager/smart-layouts.test.js.map +1 -0
- package/dist/window-manager/tile-state.d.ts +87 -0
- package/dist/window-manager/tile-state.d.ts.map +1 -0
- package/dist/window-manager/tile-state.js +136 -0
- package/dist/window-manager/tile-state.js.map +1 -0
- package/dist/window-manager/tile-state.test.d.ts +8 -0
- package/dist/window-manager/tile-state.test.d.ts.map +1 -0
- package/dist/window-manager/tile-state.test.js +179 -0
- package/dist/window-manager/tile-state.test.js.map +1 -0
- package/dist/window-manager/types.d.ts +104 -0
- package/dist/window-manager/types.d.ts.map +1 -0
- package/dist/window-manager/types.js +8 -0
- package/dist/window-manager/types.js.map +1 -0
- package/dist/window-manager/windows-manager.d.ts +44 -0
- package/dist/window-manager/windows-manager.d.ts.map +1 -0
- package/dist/window-manager/windows-manager.js +281 -0
- package/dist/window-manager/windows-manager.js.map +1 -0
- package/dist/window-manager/windows-manager.test.d.ts +8 -0
- package/dist/window-manager/windows-manager.test.d.ts.map +1 -0
- package/dist/window-manager/windows-manager.test.js +183 -0
- package/dist/window-manager/windows-manager.test.js.map +1 -0
- package/gui-dist/assets/index-BmYIHRYe.js +142 -0
- package/gui-dist/assets/index-D_N5RH8O.css +1 -0
- package/gui-dist/assets/vendor-icons-ByXNrcwf.js +336 -0
- package/gui-dist/assets/vendor-markdown-DWPYwU1x.js +22 -0
- package/gui-dist/assets/vendor-react-CpILBTDM.js +59 -0
- package/gui-dist/index.html +17 -0
- package/gui-dist/jacsub.png +0 -0
- package/package.json +67 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized Server Configuration
|
|
3
|
+
*
|
|
4
|
+
* All configuration values used by the Jacques server.
|
|
5
|
+
* Values are sourced from environment variables with sensible defaults.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Server configuration object
|
|
9
|
+
*/
|
|
10
|
+
export declare const ServerConfig: {
|
|
11
|
+
/** IPC socket path for hook communication (Unix socket or Windows Named Pipe) */
|
|
12
|
+
readonly unixSocketPath: string;
|
|
13
|
+
/** WebSocket port for dashboard connections */
|
|
14
|
+
readonly wsPort: number;
|
|
15
|
+
/** HTTP API port for REST endpoints */
|
|
16
|
+
readonly httpPort: number;
|
|
17
|
+
/** Path to Claude Code settings.json */
|
|
18
|
+
readonly claudeSettingsPath: string;
|
|
19
|
+
/** Name of the handoff file watched in project directories */
|
|
20
|
+
readonly handoffFilename: ".jacques-handoff.md";
|
|
21
|
+
/** Auto-compact threshold percentage */
|
|
22
|
+
readonly autoCompactThreshold: number;
|
|
23
|
+
/** Stale session cleanup interval in minutes */
|
|
24
|
+
readonly staleSessionCleanupMinutes: 60;
|
|
25
|
+
/** Focus watcher polling interval in milliseconds */
|
|
26
|
+
readonly focusWatcherPollMs: 2000;
|
|
27
|
+
/** Cleanup interval in minutes */
|
|
28
|
+
readonly cleanupIntervalMinutes: 5;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Type for the server configuration
|
|
32
|
+
*/
|
|
33
|
+
export type ServerConfigType = typeof ServerConfig;
|
|
34
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,eAAO,MAAM,YAAY;IACvB,iFAAiF;;IAIjF,+CAA+C;;IAG/C,uCAAuC;;IAGvC,wCAAwC;;IAGxC,8DAA8D;;IAG9D,wCAAwC;;IAGxC,gDAAgD;;IAGhD,qDAAqD;;IAGrD,kCAAkC;;CAE1B,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,YAAY,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized Server Configuration
|
|
3
|
+
*
|
|
4
|
+
* All configuration values used by the Jacques server.
|
|
5
|
+
* Values are sourced from environment variables with sensible defaults.
|
|
6
|
+
*/
|
|
7
|
+
import { getClaudeSettingsPath } from '@jacques-ai/core/session';
|
|
8
|
+
/**
|
|
9
|
+
* Server configuration object
|
|
10
|
+
*/
|
|
11
|
+
export const ServerConfig = {
|
|
12
|
+
/** IPC socket path for hook communication (Unix socket or Windows Named Pipe) */
|
|
13
|
+
unixSocketPath: process.env.JACQUES_SOCKET_PATH ||
|
|
14
|
+
(process.platform === 'win32' ? '\\\\.\\pipe\\jacques' : '/tmp/jacques.sock'),
|
|
15
|
+
/** WebSocket port for dashboard connections */
|
|
16
|
+
wsPort: parseInt(process.env.JACQUES_WS_PORT || '4242', 10),
|
|
17
|
+
/** HTTP API port for REST endpoints */
|
|
18
|
+
httpPort: parseInt(process.env.JACQUES_HTTP_PORT || '4243', 10),
|
|
19
|
+
/** Path to Claude Code settings.json */
|
|
20
|
+
claudeSettingsPath: getClaudeSettingsPath(),
|
|
21
|
+
/** Name of the handoff file watched in project directories */
|
|
22
|
+
handoffFilename: '.jacques-handoff.md',
|
|
23
|
+
/** Auto-compact threshold percentage */
|
|
24
|
+
autoCompactThreshold: parseInt(process.env.CLAUDE_AUTOCOMPACT_PCT_OVERRIDE || '95', 10),
|
|
25
|
+
/** Stale session cleanup interval in minutes */
|
|
26
|
+
staleSessionCleanupMinutes: 60,
|
|
27
|
+
/** Focus watcher polling interval in milliseconds */
|
|
28
|
+
focusWatcherPollMs: 2000,
|
|
29
|
+
/** Cleanup interval in minutes */
|
|
30
|
+
cleanupIntervalMinutes: 5,
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,iFAAiF;IACjF,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB;QAC7C,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,mBAAmB,CAAC;IAE/E,+CAA+C;IAC/C,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,MAAM,EAAE,EAAE,CAAC;IAE3D,uCAAuC;IACvC,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,MAAM,EAAE,EAAE,CAAC;IAE/D,wCAAwC;IACxC,kBAAkB,EAAE,qBAAqB,EAAE;IAE3C,8DAA8D;IAC9D,eAAe,EAAE,qBAAqB;IAEtC,wCAAwC;IACxC,oBAAoB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,+BAA+B,IAAI,IAAI,EAAE,EAAE,CAAC;IAEvF,gDAAgD;IAChD,0BAA0B,EAAE,EAAE;IAE9B,qDAAqD;IACrD,kBAAkB,EAAE,IAAI;IAExB,kCAAkC;IAClC,sBAAsB,EAAE,CAAC;CACjB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AppleScript Utilities
|
|
3
|
+
*
|
|
4
|
+
* Centralized utilities for executing AppleScript on macOS.
|
|
5
|
+
* Used for terminal activation, focus detection, and window management.
|
|
6
|
+
*
|
|
7
|
+
* @module connection/applescript
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Escape single quotes in AppleScript for shell execution.
|
|
11
|
+
*
|
|
12
|
+
* When passing AppleScript to `osascript -e`, single quotes in the script
|
|
13
|
+
* must be escaped. This function replaces ' with '\'' which:
|
|
14
|
+
* 1. Ends the single-quoted string
|
|
15
|
+
* 2. Adds an escaped single quote
|
|
16
|
+
* 3. Starts a new single-quoted string
|
|
17
|
+
*
|
|
18
|
+
* @param script The AppleScript code to escape
|
|
19
|
+
* @returns Escaped script safe for shell execution
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* escapeAppleScript("tell app 'Finder'") // "tell app '\\''Finder'\\''"
|
|
23
|
+
*/
|
|
24
|
+
export declare function escapeAppleScript(script: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Execute an AppleScript or JXA script and return the result.
|
|
27
|
+
*
|
|
28
|
+
* For AppleScript: wraps the script in proper shell escaping and executes via `osascript`.
|
|
29
|
+
* For JavaScript (JXA): uses `execFile` to avoid shell injection with complex scripts.
|
|
30
|
+
* Returns the trimmed stdout from the script execution.
|
|
31
|
+
*
|
|
32
|
+
* @param script The script code to execute
|
|
33
|
+
* @param language The scripting language: 'AppleScript' (default) or 'JavaScript' (JXA)
|
|
34
|
+
* @returns Promise resolving to the trimmed output string
|
|
35
|
+
* @throws Error if script execution fails
|
|
36
|
+
*/
|
|
37
|
+
export declare function runAppleScript(script: string, language?: 'AppleScript' | 'JavaScript'): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Check if AppleScript is available on this platform.
|
|
40
|
+
*
|
|
41
|
+
* AppleScript is only available on macOS (darwin).
|
|
42
|
+
*
|
|
43
|
+
* @returns True if running on macOS
|
|
44
|
+
*/
|
|
45
|
+
export declare function isAppleScriptAvailable(): boolean;
|
|
46
|
+
//# sourceMappingURL=applescript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applescript.d.ts","sourceRoot":"","sources":["../../src/connection/applescript.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,aAAa,GAAG,YAA4B,GACrD,OAAO,CAAC,MAAM,CAAC,CAQjB;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AppleScript Utilities
|
|
3
|
+
*
|
|
4
|
+
* Centralized utilities for executing AppleScript on macOS.
|
|
5
|
+
* Used for terminal activation, focus detection, and window management.
|
|
6
|
+
*
|
|
7
|
+
* @module connection/applescript
|
|
8
|
+
*/
|
|
9
|
+
import { exec as execCb, execFile as execFileCb } from 'child_process';
|
|
10
|
+
import { promisify } from 'util';
|
|
11
|
+
const execAsync = promisify(execCb);
|
|
12
|
+
const execFileAsync = promisify(execFileCb);
|
|
13
|
+
/**
|
|
14
|
+
* Escape single quotes in AppleScript for shell execution.
|
|
15
|
+
*
|
|
16
|
+
* When passing AppleScript to `osascript -e`, single quotes in the script
|
|
17
|
+
* must be escaped. This function replaces ' with '\'' which:
|
|
18
|
+
* 1. Ends the single-quoted string
|
|
19
|
+
* 2. Adds an escaped single quote
|
|
20
|
+
* 3. Starts a new single-quoted string
|
|
21
|
+
*
|
|
22
|
+
* @param script The AppleScript code to escape
|
|
23
|
+
* @returns Escaped script safe for shell execution
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* escapeAppleScript("tell app 'Finder'") // "tell app '\\''Finder'\\''"
|
|
27
|
+
*/
|
|
28
|
+
export function escapeAppleScript(script) {
|
|
29
|
+
return script.replace(/'/g, "'\\''");
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Execute an AppleScript or JXA script and return the result.
|
|
33
|
+
*
|
|
34
|
+
* For AppleScript: wraps the script in proper shell escaping and executes via `osascript`.
|
|
35
|
+
* For JavaScript (JXA): uses `execFile` to avoid shell injection with complex scripts.
|
|
36
|
+
* Returns the trimmed stdout from the script execution.
|
|
37
|
+
*
|
|
38
|
+
* @param script The script code to execute
|
|
39
|
+
* @param language The scripting language: 'AppleScript' (default) or 'JavaScript' (JXA)
|
|
40
|
+
* @returns Promise resolving to the trimmed output string
|
|
41
|
+
* @throws Error if script execution fails
|
|
42
|
+
*/
|
|
43
|
+
export async function runAppleScript(script, language = 'AppleScript') {
|
|
44
|
+
if (language === 'JavaScript') {
|
|
45
|
+
// Use execFile to avoid shell injection with complex JXA scripts
|
|
46
|
+
const { stdout } = await execFileAsync('osascript', ['-l', 'JavaScript', '-e', script]);
|
|
47
|
+
return stdout.trim();
|
|
48
|
+
}
|
|
49
|
+
const { stdout } = await execAsync(`osascript -e '${escapeAppleScript(script)}'`);
|
|
50
|
+
return stdout.trim();
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Check if AppleScript is available on this platform.
|
|
54
|
+
*
|
|
55
|
+
* AppleScript is only available on macOS (darwin).
|
|
56
|
+
*
|
|
57
|
+
* @returns True if running on macOS
|
|
58
|
+
*/
|
|
59
|
+
export function isAppleScriptAvailable() {
|
|
60
|
+
return process.platform === 'darwin';
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=applescript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applescript.js","sourceRoot":"","sources":["../../src/connection/applescript.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AACpC,MAAM,aAAa,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;AAE5C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAc,EACd,WAAyC,aAAa;IAEtD,IAAI,QAAQ,KAAK,YAAY,EAAE,CAAC;QAC9B,iEAAiE;QACjE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QACxF,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;IACD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,iBAAiB,iBAAiB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAClF,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applescript.test.d.ts","sourceRoot":"","sources":["../../src/connection/applescript.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for AppleScript utilities
|
|
3
|
+
*/
|
|
4
|
+
import { escapeAppleScript, isAppleScriptAvailable } from './applescript.js';
|
|
5
|
+
describe('escapeAppleScript', () => {
|
|
6
|
+
it('escapes single quotes', () => {
|
|
7
|
+
const input = "tell app 'Finder' to activate";
|
|
8
|
+
const escaped = escapeAppleScript(input);
|
|
9
|
+
expect(escaped).toBe("tell app '\\''Finder'\\'' to activate");
|
|
10
|
+
});
|
|
11
|
+
it('handles multiple single quotes', () => {
|
|
12
|
+
const input = "'one' 'two' 'three'";
|
|
13
|
+
const escaped = escapeAppleScript(input);
|
|
14
|
+
expect(escaped).toBe("'\\''one'\\'' '\\''two'\\'' '\\''three'\\''");
|
|
15
|
+
});
|
|
16
|
+
it('returns unchanged string without quotes', () => {
|
|
17
|
+
const input = 'tell application "System Events" to return name';
|
|
18
|
+
const escaped = escapeAppleScript(input);
|
|
19
|
+
expect(escaped).toBe(input);
|
|
20
|
+
});
|
|
21
|
+
it('handles empty string', () => {
|
|
22
|
+
expect(escapeAppleScript('')).toBe('');
|
|
23
|
+
});
|
|
24
|
+
it('handles string with only single quote', () => {
|
|
25
|
+
expect(escapeAppleScript("'")).toBe("'\\''");
|
|
26
|
+
});
|
|
27
|
+
it('handles multiline scripts', () => {
|
|
28
|
+
const script = `tell application "iTerm2"
|
|
29
|
+
repeat with w in windows
|
|
30
|
+
if name of w is 'Main' then
|
|
31
|
+
return "found"
|
|
32
|
+
end if
|
|
33
|
+
end repeat
|
|
34
|
+
end tell`;
|
|
35
|
+
const escaped = escapeAppleScript(script);
|
|
36
|
+
// The single quotes around 'Main' should be escaped
|
|
37
|
+
expect(escaped).toContain("'\\''Main'\\''");
|
|
38
|
+
// Original unescaped pattern should not appear
|
|
39
|
+
expect(escaped).not.toContain(" 'Main' ");
|
|
40
|
+
});
|
|
41
|
+
it('handles consecutive single quotes', () => {
|
|
42
|
+
expect(escapeAppleScript("''")).toBe("'\\'''\\''");
|
|
43
|
+
});
|
|
44
|
+
it('handles quotes at start and end', () => {
|
|
45
|
+
expect(escapeAppleScript("'test'")).toBe("'\\''test'\\''");
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
describe('isAppleScriptAvailable', () => {
|
|
49
|
+
it('returns boolean based on platform', () => {
|
|
50
|
+
const result = isAppleScriptAvailable();
|
|
51
|
+
expect(typeof result).toBe('boolean');
|
|
52
|
+
// On macOS it should be true, on other platforms false
|
|
53
|
+
if (process.platform === 'darwin') {
|
|
54
|
+
expect(result).toBe(true);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
expect(result).toBe(false);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
// Note: runAppleScript is tested implicitly through integration tests
|
|
62
|
+
// since it requires actual osascript execution. Unit tests would need
|
|
63
|
+
// mocking which adds complexity without much value for this simple wrapper.
|
|
64
|
+
//# sourceMappingURL=applescript.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applescript.test.js","sourceRoot":"","sources":["../../src/connection/applescript.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE7E,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/B,MAAM,KAAK,GAAG,+BAA+B,CAAC;QAC9C,MAAM,OAAO,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACzC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,KAAK,GAAG,qBAAqB,CAAC;QACpC,MAAM,OAAO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AAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,MAAM,GAAG,sBAAsB,EAAE,CAAC;QACxC,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,uDAAuD;QACvD,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAClC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,sEAAsE;AACtE,sEAAsE;AACtE,4EAA4E"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connection Layer Constants
|
|
3
|
+
*
|
|
4
|
+
* Centralized configuration values for the Claude Code connection layer.
|
|
5
|
+
* These control timing thresholds, context window sizes, and terminal key formats.
|
|
6
|
+
*/
|
|
7
|
+
/** Default Claude context window size in tokens */
|
|
8
|
+
export declare const DEFAULT_CONTEXT_WINDOW_SIZE = 200000;
|
|
9
|
+
/**
|
|
10
|
+
* Bug threshold for autocompact.
|
|
11
|
+
* When autocompact is disabled, it still triggers at ~78% instead of the configured threshold.
|
|
12
|
+
* See: https://github.com/anthropics/claude-code/issues/XXX
|
|
13
|
+
*/
|
|
14
|
+
export declare const AUTOCOMPACT_BUG_THRESHOLD = 78;
|
|
15
|
+
/** Default autocompact threshold percentage when enabled */
|
|
16
|
+
export declare const DEFAULT_AUTOCOMPACT_THRESHOLD = 95;
|
|
17
|
+
/**
|
|
18
|
+
* Active session threshold for process discovery.
|
|
19
|
+
* Sessions with JSONL files modified within this window are considered "active".
|
|
20
|
+
*/
|
|
21
|
+
export declare const ACTIVE_SESSION_THRESHOLD_MS: number;
|
|
22
|
+
/**
|
|
23
|
+
* Recently ended session TTL.
|
|
24
|
+
* Prevents re-registration of sessions via stale context_update events
|
|
25
|
+
* (fixes duplicate sessions on /clear command).
|
|
26
|
+
*/
|
|
27
|
+
export declare const RECENTLY_ENDED_TTL_MS = 30000;
|
|
28
|
+
/**
|
|
29
|
+
* Idle session timeout.
|
|
30
|
+
* Sessions with no activity for this duration are considered stale and removed.
|
|
31
|
+
* Catches sessions where user walked away without /exit or closing terminal.
|
|
32
|
+
*/
|
|
33
|
+
export declare const IDLE_TIMEOUT_MS: number;
|
|
34
|
+
/** Interval between process liveness verification checks */
|
|
35
|
+
export declare const PROCESS_VERIFY_INTERVAL_MS = 30000;
|
|
36
|
+
/** Interval between branch divergence checks */
|
|
37
|
+
export declare const BRANCH_DIVERGENCE_INTERVAL_MS = 60000;
|
|
38
|
+
/** Interval between stale session cleanup runs */
|
|
39
|
+
export declare const CLEANUP_INTERVAL_MS: number;
|
|
40
|
+
/** Max age for session catalog cache at startup */
|
|
41
|
+
export declare const CATALOG_CACHE_MAX_AGE_MS: number;
|
|
42
|
+
/** Polling interval for focus watcher when terminal is focused */
|
|
43
|
+
export declare const FOCUS_WATCHER_POLL_MS = 500;
|
|
44
|
+
/** Polling interval for focus watcher when terminal is not focused (slower) */
|
|
45
|
+
export declare const FOCUS_WATCHER_IDLE_POLL_MS = 1500;
|
|
46
|
+
/**
|
|
47
|
+
* Terminal key prefix identifiers.
|
|
48
|
+
* Terminal keys follow the format: PREFIX:value
|
|
49
|
+
*
|
|
50
|
+
* Examples:
|
|
51
|
+
* - ITERM:w0t0p0:ABC123-DEF456 (iTerm2 with window/tab/pane + UUID)
|
|
52
|
+
* - ITERM:ABC123-DEF456 (iTerm2 UUID only)
|
|
53
|
+
* - TTY:/dev/ttys001 (Terminal.app or generic Unix)
|
|
54
|
+
* - PID:12345 (Fallback when no better identifier)
|
|
55
|
+
* - KITTY:42 (Kitty window ID)
|
|
56
|
+
* - WEZTERM:pane:0 (WezTerm pane ID)
|
|
57
|
+
* - DISCOVERED:TTY:ttys001:12345 (Session discovered at startup)
|
|
58
|
+
* - AUTO:session-uuid (Auto-registered from context_update)
|
|
59
|
+
*/
|
|
60
|
+
export declare enum TerminalKeyPrefix {
|
|
61
|
+
/** iTerm2 terminal (macOS) */
|
|
62
|
+
ITERM = "ITERM",
|
|
63
|
+
/** Kitty terminal (cross-platform) */
|
|
64
|
+
KITTY = "KITTY",
|
|
65
|
+
/** WezTerm terminal (cross-platform) */
|
|
66
|
+
WEZTERM = "WEZTERM",
|
|
67
|
+
/** TTY path-based identifier (Unix) */
|
|
68
|
+
TTY = "TTY",
|
|
69
|
+
/** Process ID-based identifier (fallback) */
|
|
70
|
+
PID = "PID",
|
|
71
|
+
/** Terminal.app (macOS) */
|
|
72
|
+
TERM = "TERM",
|
|
73
|
+
/** Windows Terminal */
|
|
74
|
+
WT = "WT",
|
|
75
|
+
/** Session discovered at server startup (wraps inner key) */
|
|
76
|
+
DISCOVERED = "DISCOVERED",
|
|
77
|
+
/** Auto-registered from context_update (temporary key) */
|
|
78
|
+
AUTO = "AUTO",
|
|
79
|
+
/** Unknown terminal type */
|
|
80
|
+
UNKNOWN = "UNKNOWN"
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Terminal application names for focus detection.
|
|
84
|
+
* These are the process names as reported by the system.
|
|
85
|
+
*/
|
|
86
|
+
export declare const TERMINAL_APP_NAMES: readonly ["iTerm2", "iTerm", "Terminal", "Alacritty", "kitty", "WezTerm", "Hyper", "Windows Terminal", "wt"];
|
|
87
|
+
export type TerminalAppName = (typeof TERMINAL_APP_NAMES)[number];
|
|
88
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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AC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connection Layer Constants
|
|
3
|
+
*
|
|
4
|
+
* Centralized configuration values for the Claude Code connection layer.
|
|
5
|
+
* These control timing thresholds, context window sizes, and terminal key formats.
|
|
6
|
+
*/
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// Context Window Limits
|
|
9
|
+
// ============================================================================
|
|
10
|
+
/** Default Claude context window size in tokens */
|
|
11
|
+
export const DEFAULT_CONTEXT_WINDOW_SIZE = 200_000;
|
|
12
|
+
/**
|
|
13
|
+
* Bug threshold for autocompact.
|
|
14
|
+
* When autocompact is disabled, it still triggers at ~78% instead of the configured threshold.
|
|
15
|
+
* See: https://github.com/anthropics/claude-code/issues/XXX
|
|
16
|
+
*/
|
|
17
|
+
export const AUTOCOMPACT_BUG_THRESHOLD = 78;
|
|
18
|
+
/** Default autocompact threshold percentage when enabled */
|
|
19
|
+
export const DEFAULT_AUTOCOMPACT_THRESHOLD = 95;
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// Session Timing Thresholds
|
|
22
|
+
// ============================================================================
|
|
23
|
+
/**
|
|
24
|
+
* Active session threshold for process discovery.
|
|
25
|
+
* Sessions with JSONL files modified within this window are considered "active".
|
|
26
|
+
*/
|
|
27
|
+
export const ACTIVE_SESSION_THRESHOLD_MS = 60 * 1000; // 1 minute
|
|
28
|
+
/**
|
|
29
|
+
* Recently ended session TTL.
|
|
30
|
+
* Prevents re-registration of sessions via stale context_update events
|
|
31
|
+
* (fixes duplicate sessions on /clear command).
|
|
32
|
+
*/
|
|
33
|
+
export const RECENTLY_ENDED_TTL_MS = 30_000; // 30 seconds
|
|
34
|
+
/**
|
|
35
|
+
* Idle session timeout.
|
|
36
|
+
* Sessions with no activity for this duration are considered stale and removed.
|
|
37
|
+
* Catches sessions where user walked away without /exit or closing terminal.
|
|
38
|
+
*/
|
|
39
|
+
export const IDLE_TIMEOUT_MS = 4 * 60 * 60 * 1000; // 4 hours
|
|
40
|
+
/** Interval between process liveness verification checks */
|
|
41
|
+
export const PROCESS_VERIFY_INTERVAL_MS = 30_000; // 30 seconds
|
|
42
|
+
/** Interval between branch divergence checks */
|
|
43
|
+
export const BRANCH_DIVERGENCE_INTERVAL_MS = 60_000; // 60 seconds
|
|
44
|
+
/** Interval between stale session cleanup runs */
|
|
45
|
+
export const CLEANUP_INTERVAL_MS = 5 * 60 * 1000; // 5 minutes
|
|
46
|
+
/** Max age for session catalog cache at startup */
|
|
47
|
+
export const CATALOG_CACHE_MAX_AGE_MS = 5 * 60 * 1000; // 5 minutes
|
|
48
|
+
// ============================================================================
|
|
49
|
+
// Focus Detection
|
|
50
|
+
// ============================================================================
|
|
51
|
+
/** Polling interval for focus watcher when terminal is focused */
|
|
52
|
+
export const FOCUS_WATCHER_POLL_MS = 500;
|
|
53
|
+
/** Polling interval for focus watcher when terminal is not focused (slower) */
|
|
54
|
+
export const FOCUS_WATCHER_IDLE_POLL_MS = 1500;
|
|
55
|
+
// ============================================================================
|
|
56
|
+
// Terminal Key Prefixes
|
|
57
|
+
// ============================================================================
|
|
58
|
+
/**
|
|
59
|
+
* Terminal key prefix identifiers.
|
|
60
|
+
* Terminal keys follow the format: PREFIX:value
|
|
61
|
+
*
|
|
62
|
+
* Examples:
|
|
63
|
+
* - ITERM:w0t0p0:ABC123-DEF456 (iTerm2 with window/tab/pane + UUID)
|
|
64
|
+
* - ITERM:ABC123-DEF456 (iTerm2 UUID only)
|
|
65
|
+
* - TTY:/dev/ttys001 (Terminal.app or generic Unix)
|
|
66
|
+
* - PID:12345 (Fallback when no better identifier)
|
|
67
|
+
* - KITTY:42 (Kitty window ID)
|
|
68
|
+
* - WEZTERM:pane:0 (WezTerm pane ID)
|
|
69
|
+
* - DISCOVERED:TTY:ttys001:12345 (Session discovered at startup)
|
|
70
|
+
* - AUTO:session-uuid (Auto-registered from context_update)
|
|
71
|
+
*/
|
|
72
|
+
export var TerminalKeyPrefix;
|
|
73
|
+
(function (TerminalKeyPrefix) {
|
|
74
|
+
/** iTerm2 terminal (macOS) */
|
|
75
|
+
TerminalKeyPrefix["ITERM"] = "ITERM";
|
|
76
|
+
/** Kitty terminal (cross-platform) */
|
|
77
|
+
TerminalKeyPrefix["KITTY"] = "KITTY";
|
|
78
|
+
/** WezTerm terminal (cross-platform) */
|
|
79
|
+
TerminalKeyPrefix["WEZTERM"] = "WEZTERM";
|
|
80
|
+
/** TTY path-based identifier (Unix) */
|
|
81
|
+
TerminalKeyPrefix["TTY"] = "TTY";
|
|
82
|
+
/** Process ID-based identifier (fallback) */
|
|
83
|
+
TerminalKeyPrefix["PID"] = "PID";
|
|
84
|
+
/** Terminal.app (macOS) */
|
|
85
|
+
TerminalKeyPrefix["TERM"] = "TERM";
|
|
86
|
+
/** Windows Terminal */
|
|
87
|
+
TerminalKeyPrefix["WT"] = "WT";
|
|
88
|
+
/** Session discovered at server startup (wraps inner key) */
|
|
89
|
+
TerminalKeyPrefix["DISCOVERED"] = "DISCOVERED";
|
|
90
|
+
/** Auto-registered from context_update (temporary key) */
|
|
91
|
+
TerminalKeyPrefix["AUTO"] = "AUTO";
|
|
92
|
+
/** Unknown terminal type */
|
|
93
|
+
TerminalKeyPrefix["UNKNOWN"] = "UNKNOWN";
|
|
94
|
+
})(TerminalKeyPrefix || (TerminalKeyPrefix = {}));
|
|
95
|
+
/**
|
|
96
|
+
* Terminal application names for focus detection.
|
|
97
|
+
* These are the process names as reported by the system.
|
|
98
|
+
*/
|
|
99
|
+
export const TERMINAL_APP_NAMES = [
|
|
100
|
+
'iTerm2',
|
|
101
|
+
'iTerm',
|
|
102
|
+
'Terminal',
|
|
103
|
+
'Alacritty',
|
|
104
|
+
'kitty',
|
|
105
|
+
'WezTerm',
|
|
106
|
+
'Hyper',
|
|
107
|
+
'Windows Terminal',
|
|
108
|
+
'wt',
|
|
109
|
+
];
|
|
110
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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+EAA+E;AAE/E;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAN,IAAY,iBA8BX;AA9BD,WAAY,iBAAiB;IAC3B,8BAA8B;IAC9B,oCAAe,CAAA;IAEf,sCAAsC;IACtC,oCAAe,CAAA;IAEf,wCAAwC;IACxC,wCAAmB,CAAA;IAEnB,uCAAuC;IACvC,gCAAW,CAAA;IAEX,6CAA6C;IAC7C,gCAAW,CAAA;IAEX,2BAA2B;IAC3B,kCAAa,CAAA;IAEb,uBAAuB;IACvB,8BAAS,CAAA;IAET,6DAA6D;IAC7D,8CAAyB,CAAA;IAEzB,0DAA0D;IAC1D,kCAAa,CAAA;IAEb,4BAA4B;IAC5B,wCAAmB,CAAA;AACrB,CAAC,EA9BW,iBAAiB,KAAjB,iBAAiB,QA8B5B;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,QAAQ;IACR,OAAO;IACP,UAAU;IACV,WAAW;IACX,OAAO;IACP,SAAS;IACT,OAAO;IACP,kBAAkB;IAClB,IAAI;CACI,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Info Detection
|
|
3
|
+
*
|
|
4
|
+
* Detects git branch, worktree, and repo root for a given directory.
|
|
5
|
+
* Uses native git commands (same logic as hooks/git-detect.sh).
|
|
6
|
+
*
|
|
7
|
+
* @module connection/git-info
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Git info for a working directory
|
|
11
|
+
*/
|
|
12
|
+
export interface GitInfo {
|
|
13
|
+
/** Current branch name (e.g., "main", "feature/xyz") */
|
|
14
|
+
branch: string | null;
|
|
15
|
+
/** Worktree name (basename of worktree dir), only set for worktrees */
|
|
16
|
+
worktree: string | null;
|
|
17
|
+
/** Canonical git repo root path (main worktree root, shared across all worktrees) */
|
|
18
|
+
repoRoot: string | null;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Detect git info for a directory: branch, worktree name, and repo root.
|
|
22
|
+
*
|
|
23
|
+
* Uses `git rev-parse` to get the branch and common dir, then determines
|
|
24
|
+
* whether the directory is a worktree based on the common dir location.
|
|
25
|
+
*
|
|
26
|
+
* @param cwd Directory to check for git info
|
|
27
|
+
* @returns Git info with branch, worktree (if applicable), and repo root
|
|
28
|
+
*/
|
|
29
|
+
export declare function detectGitInfo(cwd: string): Promise<GitInfo>;
|
|
30
|
+
//# sourceMappingURL=git-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-info.d.ts","sourceRoot":"","sources":["../../src/connection/git-info.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,wDAAwD;IACxD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,uEAAuE;IACvE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,qFAAqF;IACrF,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAoCjE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Info Detection
|
|
3
|
+
*
|
|
4
|
+
* Detects git branch, worktree, and repo root for a given directory.
|
|
5
|
+
* Uses native git commands (same logic as hooks/git-detect.sh).
|
|
6
|
+
*
|
|
7
|
+
* @module connection/git-info
|
|
8
|
+
*/
|
|
9
|
+
import { exec as execCb } from 'child_process';
|
|
10
|
+
import { promisify } from 'util';
|
|
11
|
+
import * as path from 'path';
|
|
12
|
+
const execAsync = promisify(execCb);
|
|
13
|
+
/**
|
|
14
|
+
* Detect git info for a directory: branch, worktree name, and repo root.
|
|
15
|
+
*
|
|
16
|
+
* Uses `git rev-parse` to get the branch and common dir, then determines
|
|
17
|
+
* whether the directory is a worktree based on the common dir location.
|
|
18
|
+
*
|
|
19
|
+
* @param cwd Directory to check for git info
|
|
20
|
+
* @returns Git info with branch, worktree (if applicable), and repo root
|
|
21
|
+
*/
|
|
22
|
+
export async function detectGitInfo(cwd) {
|
|
23
|
+
try {
|
|
24
|
+
const { stdout } = await execAsync(`git -C "${cwd}" rev-parse --abbrev-ref HEAD --git-common-dir`, { timeout: 2000 });
|
|
25
|
+
if (!stdout.trim()) {
|
|
26
|
+
return { branch: null, worktree: null, repoRoot: null };
|
|
27
|
+
}
|
|
28
|
+
const lines = stdout.trim().split('\n');
|
|
29
|
+
const branch = lines[0] || null;
|
|
30
|
+
const commonDir = lines[1];
|
|
31
|
+
if (!commonDir) {
|
|
32
|
+
return { branch, worktree: null, repoRoot: null };
|
|
33
|
+
}
|
|
34
|
+
let worktree = null;
|
|
35
|
+
let repoRoot = null;
|
|
36
|
+
if (commonDir === '.git') {
|
|
37
|
+
// Normal repo (not a worktree) - cwd is the repo root
|
|
38
|
+
repoRoot = cwd;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// Worktree - commonDir is absolute path to shared .git
|
|
42
|
+
repoRoot = path.dirname(commonDir);
|
|
43
|
+
worktree = path.basename(cwd);
|
|
44
|
+
}
|
|
45
|
+
return { branch, worktree, repoRoot };
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
// Not a git repo or git not available
|
|
49
|
+
return { branch: null, worktree: null, repoRoot: null };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=git-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-info.js","sourceRoot":"","sources":["../../src/connection/git-info.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,SAAS,GAAG,SAAS,CAAC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IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-info.test.d.ts","sourceRoot":"","sources":["../../src/connection/git-info.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for git-info module
|
|
3
|
+
*/
|
|
4
|
+
import { detectGitInfo } from './git-info.js';
|
|
5
|
+
// We test against the actual repo since we're in a git repo
|
|
6
|
+
describe('detectGitInfo', () => {
|
|
7
|
+
it('detects git info for a git repository', async () => {
|
|
8
|
+
// Use the current project directory which IS a git repo
|
|
9
|
+
const cwd = process.cwd().replace(/\/server$/, ''); // Navigate to project root
|
|
10
|
+
const info = await detectGitInfo(cwd);
|
|
11
|
+
expect(info.branch).toBeTruthy();
|
|
12
|
+
expect(typeof info.branch).toBe('string');
|
|
13
|
+
expect(info.repoRoot).toBeTruthy();
|
|
14
|
+
// worktree is null for normal repos
|
|
15
|
+
});
|
|
16
|
+
it('returns nulls for non-git directory', async () => {
|
|
17
|
+
const info = await detectGitInfo('/tmp');
|
|
18
|
+
expect(info.branch).toBeNull();
|
|
19
|
+
expect(info.worktree).toBeNull();
|
|
20
|
+
expect(info.repoRoot).toBeNull();
|
|
21
|
+
});
|
|
22
|
+
it('returns nulls for non-existent directory', async () => {
|
|
23
|
+
const info = await detectGitInfo('/nonexistent/path/that/does/not/exist');
|
|
24
|
+
expect(info.branch).toBeNull();
|
|
25
|
+
expect(info.worktree).toBeNull();
|
|
26
|
+
expect(info.repoRoot).toBeNull();
|
|
27
|
+
});
|
|
28
|
+
it('returns expected GitInfo shape', async () => {
|
|
29
|
+
const info = await detectGitInfo('/tmp');
|
|
30
|
+
expect(info).toHaveProperty('branch');
|
|
31
|
+
expect(info).toHaveProperty('worktree');
|
|
32
|
+
expect(info).toHaveProperty('repoRoot');
|
|
33
|
+
});
|
|
34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