aicodeman 0.2.9 → 0.3.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/README.md +118 -4
- package/dist/ai-idle-checker.d.ts.map +1 -1
- package/dist/ai-idle-checker.js +3 -2
- package/dist/ai-idle-checker.js.map +1 -1
- package/dist/ai-plan-checker.d.ts.map +1 -1
- package/dist/ai-plan-checker.js +3 -2
- package/dist/ai-plan-checker.js.map +1 -1
- package/dist/bash-tool-parser.d.ts +2 -3
- package/dist/bash-tool-parser.d.ts.map +1 -1
- package/dist/bash-tool-parser.js +14 -31
- package/dist/bash-tool-parser.js.map +1 -1
- package/dist/config/ai-defaults.d.ts +16 -0
- package/dist/config/ai-defaults.d.ts.map +1 -0
- package/dist/config/ai-defaults.js +16 -0
- package/dist/config/ai-defaults.js.map +1 -0
- package/dist/config/auth-config.d.ts +19 -0
- package/dist/config/auth-config.d.ts.map +1 -0
- package/dist/config/auth-config.js +28 -0
- package/dist/config/auth-config.js.map +1 -0
- package/dist/config/exec-timeout.d.ts +10 -0
- package/dist/config/exec-timeout.d.ts.map +1 -0
- package/dist/config/exec-timeout.js +10 -0
- package/dist/config/exec-timeout.js.map +1 -0
- package/dist/config/map-limits.d.ts +4 -0
- package/dist/config/map-limits.d.ts.map +1 -1
- package/dist/config/map-limits.js +7 -0
- package/dist/config/map-limits.js.map +1 -1
- package/dist/config/server-timing.d.ts +42 -0
- package/dist/config/server-timing.d.ts.map +1 -0
- package/dist/config/server-timing.js +57 -0
- package/dist/config/server-timing.js.map +1 -0
- package/dist/config/team-config.d.ts +16 -0
- package/dist/config/team-config.d.ts.map +1 -0
- package/dist/config/team-config.js +16 -0
- package/dist/config/team-config.js.map +1 -0
- package/dist/config/terminal-limits.d.ts +18 -0
- package/dist/config/terminal-limits.d.ts.map +1 -0
- package/dist/config/terminal-limits.js +18 -0
- package/dist/config/terminal-limits.js.map +1 -0
- package/dist/config/tunnel-config.d.ts +27 -0
- package/dist/config/tunnel-config.d.ts.map +1 -0
- package/dist/config/tunnel-config.js +36 -0
- package/dist/config/tunnel-config.js.map +1 -0
- package/dist/hooks-config.d.ts +21 -6
- package/dist/hooks-config.d.ts.map +1 -1
- package/dist/hooks-config.js +28 -12
- package/dist/hooks-config.js.map +1 -1
- package/dist/image-watcher.d.ts +4 -4
- package/dist/image-watcher.d.ts.map +1 -1
- package/dist/image-watcher.js +17 -30
- package/dist/image-watcher.js.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/plan-orchestrator.d.ts +2 -24
- package/dist/plan-orchestrator.d.ts.map +1 -1
- package/dist/plan-orchestrator.js.map +1 -1
- package/dist/prompts/planner.d.ts +7 -8
- package/dist/prompts/planner.d.ts.map +1 -1
- package/dist/prompts/planner.js +7 -8
- package/dist/prompts/planner.js.map +1 -1
- package/dist/prompts/research-agent.d.ts +6 -4
- package/dist/prompts/research-agent.d.ts.map +1 -1
- package/dist/prompts/research-agent.js +6 -4
- package/dist/prompts/research-agent.js.map +1 -1
- package/dist/push-store.d.ts +1 -1
- package/dist/push-store.d.ts.map +1 -1
- package/dist/push-store.js +4 -12
- package/dist/push-store.js.map +1 -1
- package/dist/ralph-fix-plan-watcher.d.ts +91 -0
- package/dist/ralph-fix-plan-watcher.d.ts.map +1 -0
- package/dist/ralph-fix-plan-watcher.js +326 -0
- package/dist/ralph-fix-plan-watcher.js.map +1 -0
- package/dist/ralph-loop.d.ts +14 -4
- package/dist/ralph-loop.d.ts.map +1 -1
- package/dist/ralph-loop.js +14 -4
- package/dist/ralph-loop.js.map +1 -1
- package/dist/ralph-plan-tracker.d.ts +201 -0
- package/dist/ralph-plan-tracker.d.ts.map +1 -0
- package/dist/ralph-plan-tracker.js +325 -0
- package/dist/ralph-plan-tracker.js.map +1 -0
- package/dist/ralph-stall-detector.d.ts +84 -0
- package/dist/ralph-stall-detector.d.ts.map +1 -0
- package/dist/ralph-stall-detector.js +139 -0
- package/dist/ralph-stall-detector.js.map +1 -0
- package/dist/ralph-status-parser.d.ts +141 -0
- package/dist/ralph-status-parser.d.ts.map +1 -0
- package/dist/ralph-status-parser.js +478 -0
- package/dist/ralph-status-parser.js.map +1 -0
- package/dist/ralph-tracker.d.ts +218 -692
- package/dist/ralph-tracker.d.ts.map +1 -1
- package/dist/ralph-tracker.js +389 -1723
- package/dist/ralph-tracker.js.map +1 -1
- package/dist/respawn-adaptive-timing.d.ts +61 -0
- package/dist/respawn-adaptive-timing.d.ts.map +1 -0
- package/dist/respawn-adaptive-timing.js +105 -0
- package/dist/respawn-adaptive-timing.js.map +1 -0
- package/dist/respawn-controller.d.ts +35 -115
- package/dist/respawn-controller.d.ts.map +1 -1
- package/dist/respawn-controller.js +167 -607
- package/dist/respawn-controller.js.map +1 -1
- package/dist/respawn-health.d.ts +54 -0
- package/dist/respawn-health.d.ts.map +1 -0
- package/dist/respawn-health.js +183 -0
- package/dist/respawn-health.js.map +1 -0
- package/dist/respawn-metrics.d.ts +81 -0
- package/dist/respawn-metrics.d.ts.map +1 -0
- package/dist/respawn-metrics.js +198 -0
- package/dist/respawn-metrics.js.map +1 -0
- package/dist/respawn-patterns.d.ts +45 -0
- package/dist/respawn-patterns.d.ts.map +1 -0
- package/dist/respawn-patterns.js +125 -0
- package/dist/respawn-patterns.js.map +1 -0
- package/dist/session-auto-ops.d.ts +89 -0
- package/dist/session-auto-ops.d.ts.map +1 -0
- package/dist/session-auto-ops.js +224 -0
- package/dist/session-auto-ops.js.map +1 -0
- package/dist/session-cli-builder.d.ts +62 -0
- package/dist/session-cli-builder.d.ts.map +1 -0
- package/dist/session-cli-builder.js +121 -0
- package/dist/session-cli-builder.js.map +1 -0
- package/dist/session-manager.d.ts +17 -5
- package/dist/session-manager.d.ts.map +1 -1
- package/dist/session-manager.js +17 -5
- package/dist/session-manager.js.map +1 -1
- package/dist/session-task-cache.d.ts +52 -0
- package/dist/session-task-cache.d.ts.map +1 -0
- package/dist/session-task-cache.js +90 -0
- package/dist/session-task-cache.js.map +1 -0
- package/dist/session.d.ts +23 -41
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +79 -317
- package/dist/session.js.map +1 -1
- package/dist/state-store.d.ts +19 -9
- package/dist/state-store.d.ts.map +1 -1
- package/dist/state-store.js +29 -30
- package/dist/state-store.js.map +1 -1
- package/dist/subagent-watcher.d.ts +26 -7
- package/dist/subagent-watcher.d.ts.map +1 -1
- package/dist/subagent-watcher.js +47 -64
- package/dist/subagent-watcher.js.map +1 -1
- package/dist/team-watcher.d.ts.map +1 -1
- package/dist/team-watcher.js +2 -5
- package/dist/team-watcher.js.map +1 -1
- package/dist/tmux-manager.d.ts.map +1 -1
- package/dist/tmux-manager.js +1 -2
- package/dist/tmux-manager.js.map +1 -1
- package/dist/tunnel-manager.d.ts +26 -0
- package/dist/tunnel-manager.d.ts.map +1 -1
- package/dist/tunnel-manager.js +126 -7
- package/dist/tunnel-manager.js.map +1 -1
- package/dist/types/api.d.ts +108 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +98 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/app-state.d.ts +117 -0
- package/dist/types/app-state.d.ts.map +1 -0
- package/dist/types/app-state.js +76 -0
- package/dist/types/app-state.js.map +1 -0
- package/dist/types/common.d.ts +79 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +17 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/index.d.ts +66 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +66 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/lifecycle.d.ts +28 -0
- package/dist/types/lifecycle.d.ts.map +1 -0
- package/dist/types/lifecycle.js +16 -0
- package/dist/types/lifecycle.js.map +1 -0
- package/dist/types/plan.d.ts +45 -0
- package/dist/types/plan.d.ts.map +1 -0
- package/dist/types/plan.js +18 -0
- package/dist/types/plan.js.map +1 -0
- package/dist/types/push.d.ts +36 -0
- package/dist/types/push.d.ts.map +1 -0
- package/dist/types/push.js +18 -0
- package/dist/types/push.js.map +1 -0
- package/dist/types/ralph.d.ts +262 -0
- package/dist/types/ralph.d.ts.map +1 -0
- package/dist/types/ralph.js +70 -0
- package/dist/types/ralph.js.map +1 -0
- package/dist/types/respawn.d.ts +271 -0
- package/dist/types/respawn.d.ts.map +1 -0
- package/dist/types/respawn.js +26 -0
- package/dist/types/respawn.js.map +1 -0
- package/dist/types/run-summary.d.ts +96 -0
- package/dist/types/run-summary.d.ts.map +1 -0
- package/dist/types/run-summary.js +37 -0
- package/dist/types/run-summary.js.map +1 -0
- package/dist/types/session.d.ts +152 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/session.js +27 -0
- package/dist/types/session.js.map +1 -0
- package/dist/types/task.d.ts +72 -0
- package/dist/types/task.d.ts.map +1 -0
- package/dist/types/task.js +19 -0
- package/dist/types/task.js.map +1 -0
- package/dist/types/teams.d.ts +73 -0
- package/dist/types/teams.d.ts.map +1 -0
- package/dist/types/teams.js +23 -0
- package/dist/types/teams.js.map +1 -0
- package/dist/types/tools.d.ts +61 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +20 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/types.d.ts +8 -1134
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -210
- package/dist/types.js.map +1 -1
- package/dist/utils/claude-cli-resolver.d.ts.map +1 -1
- package/dist/utils/claude-cli-resolver.js +1 -2
- package/dist/utils/claude-cli-resolver.js.map +1 -1
- package/dist/utils/debouncer.d.ts +111 -0
- package/dist/utils/debouncer.d.ts.map +1 -0
- package/dist/utils/debouncer.js +162 -0
- package/dist/utils/debouncer.js.map +1 -0
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/opencode-cli-resolver.d.ts.map +1 -1
- package/dist/utils/opencode-cli-resolver.js +1 -2
- package/dist/utils/opencode-cli-resolver.js.map +1 -1
- package/dist/utils/string-similarity.d.ts +0 -57
- package/dist/utils/string-similarity.d.ts.map +1 -1
- package/dist/utils/string-similarity.js +3 -18
- package/dist/utils/string-similarity.js.map +1 -1
- package/dist/web/middleware/auth.d.ts +31 -0
- package/dist/web/middleware/auth.d.ts.map +1 -0
- package/dist/web/middleware/auth.js +154 -0
- package/dist/web/middleware/auth.js.map +1 -0
- package/dist/web/ports/auth-port.d.ts +18 -0
- package/dist/web/ports/auth-port.d.ts.map +1 -0
- package/dist/web/ports/auth-port.js +6 -0
- package/dist/web/ports/auth-port.js.map +1 -0
- package/dist/web/ports/config-port.d.ts +28 -0
- package/dist/web/ports/config-port.d.ts.map +1 -0
- package/dist/web/ports/config-port.js +6 -0
- package/dist/web/ports/config-port.js.map +1 -0
- package/dist/web/ports/event-port.d.ts +13 -0
- package/dist/web/ports/event-port.d.ts.map +1 -0
- package/dist/web/ports/event-port.js +6 -0
- package/dist/web/ports/event-port.js.map +1 -0
- package/dist/web/ports/index.d.ts +14 -0
- package/dist/web/ports/index.d.ts.map +1 -0
- package/dist/web/ports/index.js +9 -0
- package/dist/web/ports/index.js.map +1 -0
- package/dist/web/ports/infra-port.d.ts +36 -0
- package/dist/web/ports/infra-port.d.ts.map +1 -0
- package/dist/web/ports/infra-port.js +6 -0
- package/dist/web/ports/infra-port.js.map +1 -0
- package/dist/web/ports/respawn-port.d.ts +20 -0
- package/dist/web/ports/respawn-port.d.ts.map +1 -0
- package/dist/web/ports/respawn-port.js +6 -0
- package/dist/web/ports/respawn-port.js.map +1 -0
- package/dist/web/ports/session-port.d.ts +15 -0
- package/dist/web/ports/session-port.d.ts.map +1 -0
- package/dist/web/ports/session-port.js +6 -0
- package/dist/web/ports/session-port.js.map +1 -0
- package/dist/web/public/api-client.js +82 -0
- package/dist/web/public/api-client.js.br +0 -0
- package/dist/web/public/api-client.js.gz +0 -0
- package/dist/web/public/app.js +117 -201
- package/dist/web/public/app.js.br +0 -0
- package/dist/web/public/app.js.gz +0 -0
- package/dist/web/public/constants.js +365 -0
- package/dist/web/public/constants.js.br +0 -0
- package/dist/web/public/constants.js.gz +0 -0
- package/dist/web/public/index.html +15 -3
- package/dist/web/public/index.html.br +0 -0
- package/dist/web/public/index.html.gz +0 -0
- package/dist/web/public/keyboard-accessory.js +302 -0
- package/dist/web/public/keyboard-accessory.js.br +0 -0
- package/dist/web/public/keyboard-accessory.js.gz +0 -0
- package/dist/web/public/mobile-handlers.js +491 -0
- package/dist/web/public/mobile-handlers.js.br +0 -0
- package/dist/web/public/mobile-handlers.js.gz +0 -0
- package/dist/web/public/mobile.css.gz +0 -0
- package/dist/web/public/notification-manager.js +472 -0
- package/dist/web/public/notification-manager.js.br +0 -0
- package/dist/web/public/notification-manager.js.gz +0 -0
- package/dist/web/public/ralph-wizard.js +33 -9
- package/dist/web/public/ralph-wizard.js.br +0 -0
- package/dist/web/public/ralph-wizard.js.gz +0 -0
- package/dist/web/public/styles.css.gz +0 -0
- package/dist/web/public/subagent-windows.js +1149 -0
- package/dist/web/public/subagent-windows.js.br +0 -0
- package/dist/web/public/subagent-windows.js.gz +0 -0
- package/dist/web/public/sw.js +15 -0
- package/dist/web/public/sw.js.br +0 -0
- package/dist/web/public/sw.js.gz +0 -0
- package/dist/web/public/upload.html.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-zerolag-input.js +4 -0
- package/dist/web/public/vendor/xterm-zerolag-input.js.br +0 -0
- package/dist/web/public/vendor/xterm-zerolag-input.js.gz +0 -0
- package/dist/web/public/vendor/xterm.css.gz +0 -0
- package/dist/web/public/vendor/xterm.min.js.gz +0 -0
- package/dist/web/public/voice-input.js +882 -0
- package/dist/web/public/voice-input.js.br +0 -0
- package/dist/web/public/voice-input.js.gz +0 -0
- package/dist/web/route-helpers.d.ts +38 -0
- package/dist/web/route-helpers.d.ts.map +1 -0
- package/dist/web/route-helpers.js +144 -0
- package/dist/web/route-helpers.js.map +1 -0
- package/dist/web/routes/case-routes.d.ts +9 -0
- package/dist/web/routes/case-routes.d.ts.map +1 -0
- package/dist/web/routes/case-routes.js +426 -0
- package/dist/web/routes/case-routes.js.map +1 -0
- package/dist/web/routes/file-routes.d.ts +8 -0
- package/dist/web/routes/file-routes.d.ts.map +1 -0
- package/dist/web/routes/file-routes.js +337 -0
- package/dist/web/routes/file-routes.js.map +1 -0
- package/dist/web/routes/hook-event-routes.d.ts +9 -0
- package/dist/web/routes/hook-event-routes.d.ts.map +1 -0
- package/dist/web/routes/hook-event-routes.js +57 -0
- package/dist/web/routes/hook-event-routes.js.map +1 -0
- package/dist/web/routes/index.d.ts +16 -0
- package/dist/web/routes/index.d.ts.map +1 -0
- package/dist/web/routes/index.js +16 -0
- package/dist/web/routes/index.js.map +1 -0
- package/dist/web/routes/mux-routes.d.ts +8 -0
- package/dist/web/routes/mux-routes.d.ts.map +1 -0
- package/dist/web/routes/mux-routes.js +32 -0
- package/dist/web/routes/mux-routes.js.map +1 -0
- package/dist/web/routes/plan-routes.d.ts +9 -0
- package/dist/web/routes/plan-routes.d.ts.map +1 -0
- package/dist/web/routes/plan-routes.js +385 -0
- package/dist/web/routes/plan-routes.js.map +1 -0
- package/dist/web/routes/push-routes.d.ts +8 -0
- package/dist/web/routes/push-routes.d.ts.map +1 -0
- package/dist/web/routes/push-routes.js +49 -0
- package/dist/web/routes/push-routes.js.map +1 -0
- package/dist/web/routes/ralph-routes.d.ts +9 -0
- package/dist/web/routes/ralph-routes.d.ts.map +1 -0
- package/dist/web/routes/ralph-routes.js +485 -0
- package/dist/web/routes/ralph-routes.js.map +1 -0
- package/dist/web/routes/respawn-routes.d.ts +8 -0
- package/dist/web/routes/respawn-routes.d.ts.map +1 -0
- package/dist/web/routes/respawn-routes.js +270 -0
- package/dist/web/routes/respawn-routes.js.map +1 -0
- package/dist/web/routes/scheduled-routes.d.ts +8 -0
- package/dist/web/routes/scheduled-routes.d.ts.map +1 -0
- package/dist/web/routes/scheduled-routes.js +51 -0
- package/dist/web/routes/scheduled-routes.js.map +1 -0
- package/dist/web/routes/session-routes.d.ts +9 -0
- package/dist/web/routes/session-routes.d.ts.map +1 -0
- package/dist/web/routes/session-routes.js +751 -0
- package/dist/web/routes/session-routes.js.map +1 -0
- package/dist/web/routes/system-routes.d.ts +9 -0
- package/dist/web/routes/system-routes.d.ts.map +1 -0
- package/dist/web/routes/system-routes.js +699 -0
- package/dist/web/routes/system-routes.js.map +1 -0
- package/dist/web/routes/team-routes.d.ts +8 -0
- package/dist/web/routes/team-routes.d.ts.map +1 -0
- package/dist/web/routes/team-routes.js +14 -0
- package/dist/web/routes/team-routes.js.map +1 -0
- package/dist/web/schemas.d.ts +43 -3
- package/dist/web/schemas.d.ts.map +1 -1
- package/dist/web/schemas.js +6 -2
- package/dist/web/schemas.js.map +1 -1
- package/dist/web/server.d.ts +35 -15
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +563 -3971
- package/dist/web/server.js.map +1 -1
- package/dist/web/sse-events.d.ts +361 -0
- package/dist/web/sse-events.d.ts.map +1 -0
- package/dist/web/sse-events.js +396 -0
- package/dist/web/sse-events.js.map +1 -0
- package/package.json +2 -1
- package/scripts/postinstall.js +58 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview API types and error handling.
|
|
3
|
+
*
|
|
4
|
+
* Defines the standardized API response envelope (ApiResponse), error codes,
|
|
5
|
+
* hook event types from Claude Code's hooks system, and utility functions
|
|
6
|
+
* for error message extraction. Used by all route modules in `src/web/routes/`.
|
|
7
|
+
*
|
|
8
|
+
* Key exports:
|
|
9
|
+
* - ApiResponse<T> — discriminated union envelope (success with data or error with code)
|
|
10
|
+
* - ApiErrorCode — enum of standard error codes with user-friendly messages
|
|
11
|
+
* - HookEventType — union of Claude Code hook event names (idle_prompt, stop, etc.)
|
|
12
|
+
* - createErrorResponse() — factory for consistent error responses
|
|
13
|
+
* - getErrorMessage() — safe extraction from unknown catch values
|
|
14
|
+
* - CaseInfo, QuickStartResponse — case folder metadata types
|
|
15
|
+
*
|
|
16
|
+
* No dependencies on other domain modules. Consumed by all route modules
|
|
17
|
+
* and validated via Zod schemas in `src/web/schemas.ts`.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Standard error codes for API responses
|
|
21
|
+
*/
|
|
22
|
+
export var ApiErrorCode;
|
|
23
|
+
(function (ApiErrorCode) {
|
|
24
|
+
/** Resource not found */
|
|
25
|
+
ApiErrorCode["NOT_FOUND"] = "NOT_FOUND";
|
|
26
|
+
/** Invalid input provided */
|
|
27
|
+
ApiErrorCode["INVALID_INPUT"] = "INVALID_INPUT";
|
|
28
|
+
/** Session is currently busy */
|
|
29
|
+
ApiErrorCode["SESSION_BUSY"] = "SESSION_BUSY";
|
|
30
|
+
/** Operation failed */
|
|
31
|
+
ApiErrorCode["OPERATION_FAILED"] = "OPERATION_FAILED";
|
|
32
|
+
/** Resource already exists */
|
|
33
|
+
ApiErrorCode["ALREADY_EXISTS"] = "ALREADY_EXISTS";
|
|
34
|
+
/** Internal server error */
|
|
35
|
+
ApiErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
|
|
36
|
+
})(ApiErrorCode || (ApiErrorCode = {}));
|
|
37
|
+
/**
|
|
38
|
+
* User-friendly error messages for each error code
|
|
39
|
+
*/
|
|
40
|
+
const ErrorMessages = {
|
|
41
|
+
[ApiErrorCode.NOT_FOUND]: 'The requested resource was not found',
|
|
42
|
+
[ApiErrorCode.INVALID_INPUT]: 'Invalid input provided',
|
|
43
|
+
[ApiErrorCode.SESSION_BUSY]: 'Session is currently busy',
|
|
44
|
+
[ApiErrorCode.OPERATION_FAILED]: 'The operation failed',
|
|
45
|
+
[ApiErrorCode.ALREADY_EXISTS]: 'Resource already exists',
|
|
46
|
+
[ApiErrorCode.INTERNAL_ERROR]: 'An internal error occurred',
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Creates a standardized error response
|
|
50
|
+
* @param code Error code
|
|
51
|
+
* @param details Optional detailed error message
|
|
52
|
+
* @returns Formatted error response
|
|
53
|
+
*/
|
|
54
|
+
export function createErrorResponse(code, details) {
|
|
55
|
+
return {
|
|
56
|
+
success: false,
|
|
57
|
+
error: details || ErrorMessages[code],
|
|
58
|
+
errorCode: code,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
// ========== Error Handling Utilities ==========
|
|
62
|
+
/**
|
|
63
|
+
* Type guard to check if a value is an Error instance
|
|
64
|
+
* @param value The value to check
|
|
65
|
+
* @returns True if the value is an Error instance
|
|
66
|
+
*/
|
|
67
|
+
export function isError(value) {
|
|
68
|
+
return value instanceof Error;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Safely extracts an error message from an unknown caught value.
|
|
72
|
+
* Handles the TypeScript 4.4+ unknown error type in catch blocks.
|
|
73
|
+
*
|
|
74
|
+
* @param error The caught error (type unknown in strict mode)
|
|
75
|
+
* @returns A string error message
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* try {
|
|
80
|
+
* await riskyOperation();
|
|
81
|
+
* } catch (err) {
|
|
82
|
+
* console.error('Failed:', getErrorMessage(err));
|
|
83
|
+
* }
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export function getErrorMessage(error) {
|
|
87
|
+
if (isError(error)) {
|
|
88
|
+
return error.message;
|
|
89
|
+
}
|
|
90
|
+
if (typeof error === 'string') {
|
|
91
|
+
return error;
|
|
92
|
+
}
|
|
93
|
+
if (error && typeof error === 'object' && 'message' in error) {
|
|
94
|
+
return String(error.message);
|
|
95
|
+
}
|
|
96
|
+
return 'An unknown error occurred';
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;GAEG;AACH,MAAM,CAAN,IAAY,YAaX;AAbD,WAAY,YAAY;IACtB,yBAAyB;IACzB,uCAAuB,CAAA;IACvB,6BAA6B;IAC7B,+CAA+B,CAAA;IAC/B,gCAAgC;IAChC,6CAA6B,CAAA;IAC7B,uBAAuB;IACvB,qDAAqC,CAAA;IACrC,8BAA8B;IAC9B,iDAAiC,CAAA;IACjC,4BAA4B;IAC5B,iDAAiC,CAAA;AACnC,CAAC,EAbW,YAAY,KAAZ,YAAY,QAavB;AAED;;GAEG;AACH,MAAM,aAAa,GAAiC;IAClD,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,sCAAsC;IAChE,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE,wBAAwB;IACtD,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,2BAA2B;IACxD,CAAC,YAAY,CAAC,gBAAgB,CAAC,EAAE,sBAAsB;IACvD,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,yBAAyB;IACxD,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,4BAA4B;CAC5D,CAAC;AAuBF;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAkB,EAAE,OAAgB;IACtE,OAAO;QACL,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC;QACrC,SAAS,EAAE,IAAI;KAChB,CAAC;AACJ,CAAC;AA8BD,iDAAiD;AAEjD;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,KAAc;IACpC,OAAO,KAAK,YAAY,KAAK,CAAC;AAChC,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACnB,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;QAC7D,OAAO,MAAM,CAAE,KAA8B,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,2BAA2B,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Application state type definitions.
|
|
3
|
+
*
|
|
4
|
+
* Defines the top-level persisted state structure (AppState) which composes
|
|
5
|
+
* types from multiple domains: SessionState (session), TaskState (task),
|
|
6
|
+
* RalphLoopState (ralph), and RespawnConfig (respawn).
|
|
7
|
+
*
|
|
8
|
+
* Key exports:
|
|
9
|
+
* - AppState — root state object (sessions, tasks, ralphLoop, config, globalStats, tokenStats)
|
|
10
|
+
* - AppConfig — app configuration including default RespawnConfig
|
|
11
|
+
* - GlobalStats — cumulative usage stats across all sessions (lifetime)
|
|
12
|
+
* - TokenStats / TokenUsageEntry — daily token usage history
|
|
13
|
+
* - DEFAULT_CONFIG — default AppConfig values
|
|
14
|
+
* - createInitialState() — factory for fresh AppState
|
|
15
|
+
*
|
|
16
|
+
* Persisted to `~/.codeman/state.json` via StateStore (debounced 500ms writes).
|
|
17
|
+
* Served at `GET /api/status` (full state) and `GET /api/config` (config subset).
|
|
18
|
+
*
|
|
19
|
+
* Cross-domain imports: SessionState, TaskState, RalphLoopState, RespawnConfig.
|
|
20
|
+
*/
|
|
21
|
+
import type { SessionState } from './session.js';
|
|
22
|
+
import type { TaskState } from './task.js';
|
|
23
|
+
import type { RalphLoopState } from './ralph.js';
|
|
24
|
+
import type { RespawnConfig } from './respawn.js';
|
|
25
|
+
/**
|
|
26
|
+
* Global statistics across all sessions (including deleted ones).
|
|
27
|
+
* Persisted to track cumulative usage over time.
|
|
28
|
+
*/
|
|
29
|
+
export interface GlobalStats {
|
|
30
|
+
/** Total input tokens used across all sessions */
|
|
31
|
+
totalInputTokens: number;
|
|
32
|
+
/** Total output tokens used across all sessions */
|
|
33
|
+
totalOutputTokens: number;
|
|
34
|
+
/** Total cost in USD across all sessions */
|
|
35
|
+
totalCost: number;
|
|
36
|
+
/** Total number of sessions created (lifetime) */
|
|
37
|
+
totalSessionsCreated: number;
|
|
38
|
+
/** Timestamp when stats were first recorded */
|
|
39
|
+
firstRecordedAt: number;
|
|
40
|
+
/** Timestamp of last update */
|
|
41
|
+
lastUpdatedAt: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Daily token usage entry for historical tracking.
|
|
45
|
+
*/
|
|
46
|
+
export interface TokenUsageEntry {
|
|
47
|
+
/** Date in YYYY-MM-DD format */
|
|
48
|
+
date: string;
|
|
49
|
+
/** Input tokens used on this day */
|
|
50
|
+
inputTokens: number;
|
|
51
|
+
/** Output tokens used on this day */
|
|
52
|
+
outputTokens: number;
|
|
53
|
+
/** Estimated cost in USD */
|
|
54
|
+
estimatedCost: number;
|
|
55
|
+
/** Number of sessions that contributed to this day's usage */
|
|
56
|
+
sessions: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Token usage statistics with daily tracking.
|
|
60
|
+
*/
|
|
61
|
+
export interface TokenStats {
|
|
62
|
+
/** Daily usage entries (most recent first) */
|
|
63
|
+
daily: TokenUsageEntry[];
|
|
64
|
+
/** Timestamp of last update */
|
|
65
|
+
lastUpdated: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Application configuration
|
|
69
|
+
*/
|
|
70
|
+
export interface AppConfig {
|
|
71
|
+
/** Interval for polling session status (ms) */
|
|
72
|
+
pollIntervalMs: number;
|
|
73
|
+
/** Default timeout for tasks (ms) */
|
|
74
|
+
defaultTimeoutMs: number;
|
|
75
|
+
/** Maximum concurrent sessions allowed */
|
|
76
|
+
maxConcurrentSessions: number;
|
|
77
|
+
/** Path to state file */
|
|
78
|
+
stateFilePath: string;
|
|
79
|
+
/** Respawn controller configuration */
|
|
80
|
+
respawn: RespawnConfig;
|
|
81
|
+
/** Last used case name (for default selection) */
|
|
82
|
+
lastUsedCase: string | null;
|
|
83
|
+
/** Whether Ralph/Todo tracker is globally enabled for all new sessions */
|
|
84
|
+
ralphEnabled: boolean;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Complete application state
|
|
88
|
+
*/
|
|
89
|
+
export interface AppState {
|
|
90
|
+
/** Map of session ID to session state */
|
|
91
|
+
sessions: Record<string, SessionState>;
|
|
92
|
+
/** Map of task ID to task state */
|
|
93
|
+
tasks: Record<string, TaskState>;
|
|
94
|
+
/** Ralph Loop controller state */
|
|
95
|
+
ralphLoop: RalphLoopState;
|
|
96
|
+
/** Application configuration */
|
|
97
|
+
config: AppConfig;
|
|
98
|
+
/** Global statistics (cumulative across all sessions) */
|
|
99
|
+
globalStats?: GlobalStats;
|
|
100
|
+
/** Daily token usage statistics */
|
|
101
|
+
tokenStats?: TokenStats;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Default application configuration values
|
|
105
|
+
*/
|
|
106
|
+
export declare const DEFAULT_CONFIG: AppConfig;
|
|
107
|
+
/**
|
|
108
|
+
* Creates initial application state
|
|
109
|
+
* @returns Fresh application state with defaults
|
|
110
|
+
*/
|
|
111
|
+
export declare function createInitialState(): AppState;
|
|
112
|
+
/**
|
|
113
|
+
* Creates initial global stats object
|
|
114
|
+
* @returns Fresh global stats with zero values
|
|
115
|
+
*/
|
|
116
|
+
export declare function createInitialGlobalStats(): GlobalStats;
|
|
117
|
+
//# sourceMappingURL=app-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-state.d.ts","sourceRoot":"","sources":["../../src/types/app-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIlD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,kDAAkD;IAClD,gBAAgB,EAAE,MAAM,CAAC;IACzB,mDAAmD;IACnD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,+CAA+C;IAC/C,eAAe,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,aAAa,EAAE,MAAM,CAAC;CACvB;AAID;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,4BAA4B;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,8CAA8C;IAC9C,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,+CAA+C;IAC/C,cAAc,EAAE,MAAM,CAAC;IACvB,qCAAqC;IACrC,gBAAgB,EAAE,MAAM,CAAC;IACzB,0CAA0C;IAC1C,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yBAAyB;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,OAAO,EAAE,aAAa,CAAC;IACvB,kDAAkD;IAClD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,0EAA0E;IAC1E,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACvC,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACjC,kCAAkC;IAClC,SAAS,EAAE,cAAc,CAAC;IAC1B,gCAAgC;IAChC,MAAM,EAAE,SAAS,CAAC;IAClB,yDAAyD;IACzD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,mCAAmC;IACnC,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAID;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,SAe5B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,QAAQ,CAe7C;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,WAAW,CAUtD"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Application state type definitions.
|
|
3
|
+
*
|
|
4
|
+
* Defines the top-level persisted state structure (AppState) which composes
|
|
5
|
+
* types from multiple domains: SessionState (session), TaskState (task),
|
|
6
|
+
* RalphLoopState (ralph), and RespawnConfig (respawn).
|
|
7
|
+
*
|
|
8
|
+
* Key exports:
|
|
9
|
+
* - AppState — root state object (sessions, tasks, ralphLoop, config, globalStats, tokenStats)
|
|
10
|
+
* - AppConfig — app configuration including default RespawnConfig
|
|
11
|
+
* - GlobalStats — cumulative usage stats across all sessions (lifetime)
|
|
12
|
+
* - TokenStats / TokenUsageEntry — daily token usage history
|
|
13
|
+
* - DEFAULT_CONFIG — default AppConfig values
|
|
14
|
+
* - createInitialState() — factory for fresh AppState
|
|
15
|
+
*
|
|
16
|
+
* Persisted to `~/.codeman/state.json` via StateStore (debounced 500ms writes).
|
|
17
|
+
* Served at `GET /api/status` (full state) and `GET /api/config` (config subset).
|
|
18
|
+
*
|
|
19
|
+
* Cross-domain imports: SessionState, TaskState, RalphLoopState, RespawnConfig.
|
|
20
|
+
*/
|
|
21
|
+
// ========== Default Configuration ==========
|
|
22
|
+
/**
|
|
23
|
+
* Default application configuration values
|
|
24
|
+
*/
|
|
25
|
+
export const DEFAULT_CONFIG = {
|
|
26
|
+
pollIntervalMs: 1000,
|
|
27
|
+
defaultTimeoutMs: 300000, // 5 minutes
|
|
28
|
+
maxConcurrentSessions: 5,
|
|
29
|
+
stateFilePath: '',
|
|
30
|
+
respawn: {
|
|
31
|
+
idleTimeoutMs: 5000, // 5 seconds of no activity after prompt
|
|
32
|
+
updatePrompt: 'update all the docs and CLAUDE.md',
|
|
33
|
+
interStepDelayMs: 1000, // 1 second between steps
|
|
34
|
+
enabled: false, // disabled by default
|
|
35
|
+
sendClear: true, // send /clear after update prompt
|
|
36
|
+
sendInit: true, // send /init after /clear
|
|
37
|
+
},
|
|
38
|
+
lastUsedCase: null,
|
|
39
|
+
ralphEnabled: false,
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Creates initial application state
|
|
43
|
+
* @returns Fresh application state with defaults
|
|
44
|
+
*/
|
|
45
|
+
export function createInitialState() {
|
|
46
|
+
return {
|
|
47
|
+
sessions: {},
|
|
48
|
+
tasks: {},
|
|
49
|
+
ralphLoop: {
|
|
50
|
+
status: 'stopped',
|
|
51
|
+
startedAt: null,
|
|
52
|
+
minDurationMs: null,
|
|
53
|
+
tasksCompleted: 0,
|
|
54
|
+
tasksGenerated: 0,
|
|
55
|
+
lastCheckAt: null,
|
|
56
|
+
},
|
|
57
|
+
config: { ...DEFAULT_CONFIG },
|
|
58
|
+
globalStats: createInitialGlobalStats(),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Creates initial global stats object
|
|
63
|
+
* @returns Fresh global stats with zero values
|
|
64
|
+
*/
|
|
65
|
+
export function createInitialGlobalStats() {
|
|
66
|
+
const now = Date.now();
|
|
67
|
+
return {
|
|
68
|
+
totalInputTokens: 0,
|
|
69
|
+
totalOutputTokens: 0,
|
|
70
|
+
totalCost: 0,
|
|
71
|
+
totalSessionsCreated: 0,
|
|
72
|
+
firstRecordedAt: now,
|
|
73
|
+
lastUpdatedAt: now,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=app-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-state.js","sourceRoot":"","sources":["../../src/types/app-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA8FH,8CAA8C;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAc;IACvC,cAAc,EAAE,IAAI;IACpB,gBAAgB,EAAE,MAAM,EAAE,YAAY;IACtC,qBAAqB,EAAE,CAAC;IACxB,aAAa,EAAE,EAAE;IACjB,OAAO,EAAE;QACP,aAAa,EAAE,IAAI,EAAE,wCAAwC;QAC7D,YAAY,EAAE,mCAAmC;QACjD,gBAAgB,EAAE,IAAI,EAAE,yBAAyB;QACjD,OAAO,EAAE,KAAK,EAAE,sBAAsB;QACtC,SAAS,EAAE,IAAI,EAAE,kCAAkC;QACnD,QAAQ,EAAE,IAAI,EAAE,0BAA0B;KAC3C;IACD,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,KAAK;CACpB,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,EAAE;QACT,SAAS,EAAE;YACT,MAAM,EAAE,SAAS;YACjB,SAAS,EAAE,IAAI;YACf,aAAa,EAAE,IAAI;YACnB,cAAc,EAAE,CAAC;YACjB,cAAc,EAAE,CAAC;YACjB,WAAW,EAAE,IAAI;SAClB;QACD,MAAM,EAAE,EAAE,GAAG,cAAc,EAAE;QAC7B,WAAW,EAAE,wBAAwB,EAAE;KACxC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB;IACtC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,OAAO;QACL,gBAAgB,EAAE,CAAC;QACnB,iBAAiB,EAAE,CAAC;QACpB,SAAS,EAAE,CAAC;QACZ,oBAAoB,EAAE,CAAC;QACvB,eAAe,EAAE,GAAG;QACpB,aAAa,EAAE,GAAG;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Common/shared type definitions.
|
|
3
|
+
*
|
|
4
|
+
* Base types used across multiple domains. No dependencies on other domain modules.
|
|
5
|
+
*
|
|
6
|
+
* Key exports:
|
|
7
|
+
* - Disposable — interface for objects requiring explicit cleanup (timers, watchers)
|
|
8
|
+
* - BufferConfig — size-limited storage config (terminal: 2MB, text: 1MB)
|
|
9
|
+
* - CleanupRegistration / CleanupResourceType — entries for the centralized CleanupManager
|
|
10
|
+
* - NiceConfig / DEFAULT_NICE_CONFIG — process priority settings for `nice`/`ionice`
|
|
11
|
+
* - ProcessStats — memory/CPU/child-count snapshot for resource monitoring
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Interface for objects that hold resources requiring explicit cleanup.
|
|
15
|
+
* Implementing classes should release timers, watchers, and other resources in dispose().
|
|
16
|
+
*/
|
|
17
|
+
export interface Disposable {
|
|
18
|
+
/** Release all held resources. Safe to call multiple times. */
|
|
19
|
+
dispose(): void;
|
|
20
|
+
/** Whether this object has been disposed */
|
|
21
|
+
readonly isDisposed: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Configuration for buffer accumulator instances.
|
|
25
|
+
* Used for terminal buffers, text output, and other size-limited string storage.
|
|
26
|
+
*/
|
|
27
|
+
export interface BufferConfig {
|
|
28
|
+
/** Maximum buffer size in bytes before trimming */
|
|
29
|
+
maxSize: number;
|
|
30
|
+
/** Size to trim to when maxSize is exceeded */
|
|
31
|
+
trimSize: number;
|
|
32
|
+
/** Optional callback invoked when buffer is trimmed */
|
|
33
|
+
onTrim?: (trimmedBytes: number) => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Resource types that can be registered for cleanup.
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* Configuration for process priority using `nice`.
|
|
40
|
+
* Lower priority reduces CPU contention with other processes.
|
|
41
|
+
*/
|
|
42
|
+
export interface NiceConfig {
|
|
43
|
+
/** Whether nice priority is enabled */
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
/** Nice value (-20 to 19, default: 10 = lower priority) */
|
|
46
|
+
niceValue: number;
|
|
47
|
+
}
|
|
48
|
+
export declare const DEFAULT_NICE_CONFIG: NiceConfig;
|
|
49
|
+
/**
|
|
50
|
+
* Process resource statistics
|
|
51
|
+
*/
|
|
52
|
+
export interface ProcessStats {
|
|
53
|
+
/** Memory usage in megabytes */
|
|
54
|
+
memoryMB: number;
|
|
55
|
+
/** CPU usage percentage */
|
|
56
|
+
cpuPercent: number;
|
|
57
|
+
/** Number of child processes */
|
|
58
|
+
childCount: number;
|
|
59
|
+
/** Timestamp of stats collection */
|
|
60
|
+
updatedAt: number;
|
|
61
|
+
}
|
|
62
|
+
export type CleanupResourceType = 'timer' | 'interval' | 'watcher' | 'listener' | 'stream';
|
|
63
|
+
/**
|
|
64
|
+
* Registration entry for a cleanup resource.
|
|
65
|
+
* Used by CleanupManager to track and dispose resources.
|
|
66
|
+
*/
|
|
67
|
+
export interface CleanupRegistration {
|
|
68
|
+
/** Unique identifier for this registration */
|
|
69
|
+
id: string;
|
|
70
|
+
/** Type of resource */
|
|
71
|
+
type: CleanupResourceType;
|
|
72
|
+
/** Human-readable description for debugging */
|
|
73
|
+
description: string;
|
|
74
|
+
/** Cleanup function to call on dispose */
|
|
75
|
+
cleanup: () => void;
|
|
76
|
+
/** Timestamp when registered */
|
|
77
|
+
registeredAt: number;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,+DAA+D;IAC/D,OAAO,IAAI,IAAI,CAAC;IAChB,4CAA4C;IAC5C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED;;GAEG;AACH;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,uCAAuC;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,mBAAmB,EAAE,UAGjC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE3F;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,8CAA8C;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,uBAAuB;IACvB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Common/shared type definitions.
|
|
3
|
+
*
|
|
4
|
+
* Base types used across multiple domains. No dependencies on other domain modules.
|
|
5
|
+
*
|
|
6
|
+
* Key exports:
|
|
7
|
+
* - Disposable — interface for objects requiring explicit cleanup (timers, watchers)
|
|
8
|
+
* - BufferConfig — size-limited storage config (terminal: 2MB, text: 1MB)
|
|
9
|
+
* - CleanupRegistration / CleanupResourceType — entries for the centralized CleanupManager
|
|
10
|
+
* - NiceConfig / DEFAULT_NICE_CONFIG — process priority settings for `nice`/`ionice`
|
|
11
|
+
* - ProcessStats — memory/CPU/child-count snapshot for resource monitoring
|
|
12
|
+
*/
|
|
13
|
+
export const DEFAULT_NICE_CONFIG = {
|
|
14
|
+
enabled: false,
|
|
15
|
+
niceValue: 10,
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAwCH,MAAM,CAAC,MAAM,mBAAmB,GAAe;IAC7C,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,EAAE;CACd,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Barrel re-export for all Codeman type definitions.
|
|
3
|
+
*
|
|
4
|
+
* The type system is split into 13 domain modules for maintainability.
|
|
5
|
+
* Import from `'./types'` (or `'./types/index.js'`) to access any type:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import type { SessionState, AppState, RespawnConfig } from './types';
|
|
9
|
+
* import { createErrorResponse, ApiErrorCode } from './types';
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* ## Domain modules
|
|
13
|
+
*
|
|
14
|
+
* | Module | Key exports | Persistence / API |
|
|
15
|
+
* |--------------|-----------------------------------------------------------------------|-------------------------------------------------|
|
|
16
|
+
* | common | Disposable, BufferConfig, CleanupRegistration, NiceConfig, ProcessStats | In-memory only |
|
|
17
|
+
* | session | SessionState, SessionConfig, SessionStatus, SessionMode, ClaudeMode, OpenCodeConfig | `~/.codeman/state.json` → `GET /api/sessions` |
|
|
18
|
+
* | task | TaskDefinition, TaskState, TaskStatus | `~/.codeman/state.json` → `GET /api/tasks` |
|
|
19
|
+
* | app-state | AppState, AppConfig, GlobalStats, TokenStats, DEFAULT_CONFIG | `~/.codeman/state.json` → `GET /api/status` |
|
|
20
|
+
* | respawn | RespawnConfig, RespawnPreset, RespawnCycleMetrics, RalphLoopHealthScore, TimingHistory | Per-session in state.json → `GET /api/sessions/:id/respawn` |
|
|
21
|
+
* | ralph | RalphTrackerState, RalphTodoItem, CircuitBreakerStatus, RalphStatusBlock, RalphSessionState | Per-session → `GET /api/sessions/:id/ralph-state` |
|
|
22
|
+
* | api | ApiResponse, ApiErrorCode, HookEventType, CaseInfo, createErrorResponse, getErrorMessage | Used by all route handlers |
|
|
23
|
+
* | lifecycle | LifecycleEntry, LifecycleEventType | `~/.codeman/session-lifecycle.jsonl` (append-only) |
|
|
24
|
+
* | run-summary | RunSummary, RunSummaryEvent, RunSummaryStats | In-memory → `GET /api/sessions/:id/run-summary` |
|
|
25
|
+
* | tools | ActiveBashTool, ImageDetectedEvent | In-memory, broadcast via SSE |
|
|
26
|
+
* | teams | TeamConfig, TeamMember, TeamTask, InboxMessage, PaneInfo | `~/.claude/teams/`, `~/.claude/tasks/` → `GET /api/teams` |
|
|
27
|
+
* | push | PushSubscriptionRecord, VapidKeys | `~/.codeman/push-keys.json`, `~/.codeman/push-subscriptions.json` |
|
|
28
|
+
* | plan | PlanItem, PlanTaskStatus, TddPhase | In-memory → `GET /api/sessions/:id/plan/tasks` |
|
|
29
|
+
*
|
|
30
|
+
* ## Cross-domain relationship map
|
|
31
|
+
*
|
|
32
|
+
* ```
|
|
33
|
+
* AppState (app-state)
|
|
34
|
+
* ├── sessions: Record<id, SessionState> ← session domain
|
|
35
|
+
* │ ├── respawnConfig?: RespawnConfig ← respawn domain (per-session settings)
|
|
36
|
+
* │ ├── ralphEnabled?: boolean ← toggles ralph tracking
|
|
37
|
+
* │ └── id ← referenced by:
|
|
38
|
+
* │ ├── RalphSessionState.sessionId ← ralph domain
|
|
39
|
+
* │ ├── RunSummary.sessionId ← run-summary domain
|
|
40
|
+
* │ ├── ActiveBashTool.sessionId ← tools domain
|
|
41
|
+
* │ ├── RespawnCycleMetrics.sessionId ← respawn domain
|
|
42
|
+
* │ └── TeamConfig.leadSessionId ← teams domain
|
|
43
|
+
* ├── tasks: Record<id, TaskState> ← task domain
|
|
44
|
+
* │ └── assignedSessionId → SessionState.id
|
|
45
|
+
* ├── ralphLoop: RalphLoopState ← ralph domain (global loop state)
|
|
46
|
+
* └── config: AppConfig
|
|
47
|
+
* └── respawn: RespawnConfig ← respawn domain (global defaults)
|
|
48
|
+
*
|
|
49
|
+
* RalphLoopHealthScore (respawn)
|
|
50
|
+
* └── components.circuitBreaker ← derived from CircuitBreakerStatus (ralph)
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export * from './common.js';
|
|
54
|
+
export * from './session.js';
|
|
55
|
+
export * from './task.js';
|
|
56
|
+
export * from './app-state.js';
|
|
57
|
+
export * from './respawn.js';
|
|
58
|
+
export * from './ralph.js';
|
|
59
|
+
export * from './api.js';
|
|
60
|
+
export * from './lifecycle.js';
|
|
61
|
+
export * from './run-summary.js';
|
|
62
|
+
export * from './tools.js';
|
|
63
|
+
export * from './teams.js';
|
|
64
|
+
export * from './push.js';
|
|
65
|
+
export * from './plan.js';
|
|
66
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Barrel re-export for all Codeman type definitions.
|
|
3
|
+
*
|
|
4
|
+
* The type system is split into 13 domain modules for maintainability.
|
|
5
|
+
* Import from `'./types'` (or `'./types/index.js'`) to access any type:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import type { SessionState, AppState, RespawnConfig } from './types';
|
|
9
|
+
* import { createErrorResponse, ApiErrorCode } from './types';
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* ## Domain modules
|
|
13
|
+
*
|
|
14
|
+
* | Module | Key exports | Persistence / API |
|
|
15
|
+
* |--------------|-----------------------------------------------------------------------|-------------------------------------------------|
|
|
16
|
+
* | common | Disposable, BufferConfig, CleanupRegistration, NiceConfig, ProcessStats | In-memory only |
|
|
17
|
+
* | session | SessionState, SessionConfig, SessionStatus, SessionMode, ClaudeMode, OpenCodeConfig | `~/.codeman/state.json` → `GET /api/sessions` |
|
|
18
|
+
* | task | TaskDefinition, TaskState, TaskStatus | `~/.codeman/state.json` → `GET /api/tasks` |
|
|
19
|
+
* | app-state | AppState, AppConfig, GlobalStats, TokenStats, DEFAULT_CONFIG | `~/.codeman/state.json` → `GET /api/status` |
|
|
20
|
+
* | respawn | RespawnConfig, RespawnPreset, RespawnCycleMetrics, RalphLoopHealthScore, TimingHistory | Per-session in state.json → `GET /api/sessions/:id/respawn` |
|
|
21
|
+
* | ralph | RalphTrackerState, RalphTodoItem, CircuitBreakerStatus, RalphStatusBlock, RalphSessionState | Per-session → `GET /api/sessions/:id/ralph-state` |
|
|
22
|
+
* | api | ApiResponse, ApiErrorCode, HookEventType, CaseInfo, createErrorResponse, getErrorMessage | Used by all route handlers |
|
|
23
|
+
* | lifecycle | LifecycleEntry, LifecycleEventType | `~/.codeman/session-lifecycle.jsonl` (append-only) |
|
|
24
|
+
* | run-summary | RunSummary, RunSummaryEvent, RunSummaryStats | In-memory → `GET /api/sessions/:id/run-summary` |
|
|
25
|
+
* | tools | ActiveBashTool, ImageDetectedEvent | In-memory, broadcast via SSE |
|
|
26
|
+
* | teams | TeamConfig, TeamMember, TeamTask, InboxMessage, PaneInfo | `~/.claude/teams/`, `~/.claude/tasks/` → `GET /api/teams` |
|
|
27
|
+
* | push | PushSubscriptionRecord, VapidKeys | `~/.codeman/push-keys.json`, `~/.codeman/push-subscriptions.json` |
|
|
28
|
+
* | plan | PlanItem, PlanTaskStatus, TddPhase | In-memory → `GET /api/sessions/:id/plan/tasks` |
|
|
29
|
+
*
|
|
30
|
+
* ## Cross-domain relationship map
|
|
31
|
+
*
|
|
32
|
+
* ```
|
|
33
|
+
* AppState (app-state)
|
|
34
|
+
* ├── sessions: Record<id, SessionState> ← session domain
|
|
35
|
+
* │ ├── respawnConfig?: RespawnConfig ← respawn domain (per-session settings)
|
|
36
|
+
* │ ├── ralphEnabled?: boolean ← toggles ralph tracking
|
|
37
|
+
* │ └── id ← referenced by:
|
|
38
|
+
* │ ├── RalphSessionState.sessionId ← ralph domain
|
|
39
|
+
* │ ├── RunSummary.sessionId ← run-summary domain
|
|
40
|
+
* │ ├── ActiveBashTool.sessionId ← tools domain
|
|
41
|
+
* │ ├── RespawnCycleMetrics.sessionId ← respawn domain
|
|
42
|
+
* │ └── TeamConfig.leadSessionId ← teams domain
|
|
43
|
+
* ├── tasks: Record<id, TaskState> ← task domain
|
|
44
|
+
* │ └── assignedSessionId → SessionState.id
|
|
45
|
+
* ├── ralphLoop: RalphLoopState ← ralph domain (global loop state)
|
|
46
|
+
* └── config: AppConfig
|
|
47
|
+
* └── respawn: RespawnConfig ← respawn domain (global defaults)
|
|
48
|
+
*
|
|
49
|
+
* RalphLoopHealthScore (respawn)
|
|
50
|
+
* └── components.circuitBreaker ← derived from CircuitBreakerStatus (ralph)
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export * from './common.js';
|
|
54
|
+
export * from './session.js';
|
|
55
|
+
export * from './task.js';
|
|
56
|
+
export * from './app-state.js';
|
|
57
|
+
export * from './respawn.js';
|
|
58
|
+
export * from './ralph.js';
|
|
59
|
+
export * from './api.js';
|
|
60
|
+
export * from './lifecycle.js';
|
|
61
|
+
export * from './run-summary.js';
|
|
62
|
+
export * from './tools.js';
|
|
63
|
+
export * from './teams.js';
|
|
64
|
+
export * from './push.js';
|
|
65
|
+
export * from './plan.js';
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Session lifecycle audit types.
|
|
3
|
+
*
|
|
4
|
+
* Types for the append-only JSONL audit log at `~/.codeman/session-lifecycle.jsonl`.
|
|
5
|
+
* Records session creation, PTY launch/exit, server start/stop, tmux recovery,
|
|
6
|
+
* and QR auth events. Written by `SessionLifecycleLog`, read for debugging.
|
|
7
|
+
*
|
|
8
|
+
* Key exports:
|
|
9
|
+
* - LifecycleEventType — union of 11 event types (created, started, exit, qr_auth, etc.)
|
|
10
|
+
* - LifecycleEntry — a single timestamped log entry with event, sessionId, and optional metadata
|
|
11
|
+
*
|
|
12
|
+
* No dependencies on other domain modules. LifecycleEntry.sessionId links
|
|
13
|
+
* back to SessionState.id for correlation.
|
|
14
|
+
*/
|
|
15
|
+
/** Types of session lifecycle events recorded to the audit log */
|
|
16
|
+
export type LifecycleEventType = 'created' | 'started' | 'exit' | 'deleted' | 'detached' | 'recovered' | 'stale_cleaned' | 'mux_died' | 'server_started' | 'server_stopped' | 'qr_auth';
|
|
17
|
+
/** A single entry in the session lifecycle audit log */
|
|
18
|
+
export interface LifecycleEntry {
|
|
19
|
+
ts: number;
|
|
20
|
+
event: LifecycleEventType;
|
|
21
|
+
sessionId: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
mode?: string;
|
|
24
|
+
reason?: string;
|
|
25
|
+
exitCode?: number | null;
|
|
26
|
+
extra?: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/types/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,kEAAkE;AAClE,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,SAAS,GACT,MAAM,GACN,SAAS,GACT,UAAU,GACV,WAAW,GACX,eAAe,GACf,UAAU,GACV,gBAAgB,GAChB,gBAAgB,GAChB,SAAS,CAAC;AAEd,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,kBAAkB,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Session lifecycle audit types.
|
|
3
|
+
*
|
|
4
|
+
* Types for the append-only JSONL audit log at `~/.codeman/session-lifecycle.jsonl`.
|
|
5
|
+
* Records session creation, PTY launch/exit, server start/stop, tmux recovery,
|
|
6
|
+
* and QR auth events. Written by `SessionLifecycleLog`, read for debugging.
|
|
7
|
+
*
|
|
8
|
+
* Key exports:
|
|
9
|
+
* - LifecycleEventType — union of 11 event types (created, started, exit, qr_auth, etc.)
|
|
10
|
+
* - LifecycleEntry — a single timestamped log entry with event, sessionId, and optional metadata
|
|
11
|
+
*
|
|
12
|
+
* No dependencies on other domain modules. LifecycleEntry.sessionId links
|
|
13
|
+
* back to SessionState.id for correlation.
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/types/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Plan orchestrator type definitions.
|
|
3
|
+
*
|
|
4
|
+
* Types for the 2-agent plan generation system (optional research agent → planner agent).
|
|
5
|
+
*
|
|
6
|
+
* Key exports:
|
|
7
|
+
* - PlanItem — a single task with priority (P0/P1/P2), TDD phase, dependencies, verification criteria
|
|
8
|
+
* - PlanTaskStatus — 'pending' | 'in_progress' | 'completed' | 'failed' | 'blocked'
|
|
9
|
+
* - TddPhase / PlanPhase — 'setup' | 'test' | 'impl' | 'verify' | 'review'
|
|
10
|
+
*
|
|
11
|
+
* Used by PlanOrchestrator (`src/plan-orchestrator.ts`) and the plan API routes
|
|
12
|
+
* (`src/web/routes/plan-routes.ts`). Served at `GET /api/sessions/:id/plan/tasks`.
|
|
13
|
+
*
|
|
14
|
+
* PlanItem was moved here from plan-orchestrator.ts to break a circular dependency.
|
|
15
|
+
* No dependencies on other domain modules.
|
|
16
|
+
*/
|
|
17
|
+
/** Task execution status for plan tracking */
|
|
18
|
+
export type PlanTaskStatus = 'pending' | 'in_progress' | 'completed' | 'failed' | 'blocked';
|
|
19
|
+
/** TDD phase categories */
|
|
20
|
+
export type TddPhase = 'setup' | 'test' | 'impl' | 'verify' | 'review';
|
|
21
|
+
/** Development phase in TDD cycle (alias for TddPhase) */
|
|
22
|
+
export type PlanPhase = TddPhase;
|
|
23
|
+
/**
|
|
24
|
+
* A single plan item for plan orchestration.
|
|
25
|
+
* Moved here from plan-orchestrator.ts to break circular dependency.
|
|
26
|
+
*/
|
|
27
|
+
export interface PlanItem {
|
|
28
|
+
id?: string;
|
|
29
|
+
content: string;
|
|
30
|
+
priority: 'P0' | 'P1' | 'P2' | null;
|
|
31
|
+
source?: string;
|
|
32
|
+
rationale?: string;
|
|
33
|
+
verificationCriteria?: string;
|
|
34
|
+
testCommand?: string;
|
|
35
|
+
dependencies?: string[];
|
|
36
|
+
status?: PlanTaskStatus;
|
|
37
|
+
attempts?: number;
|
|
38
|
+
lastError?: string;
|
|
39
|
+
completedAt?: number;
|
|
40
|
+
complexity?: 'low' | 'medium' | 'high';
|
|
41
|
+
tddPhase?: PlanPhase;
|
|
42
|
+
pairedWith?: string;
|
|
43
|
+
reviewChecklist?: string[];
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=plan.d.ts.map
|