@fleettools/server 0.1.0 → 0.1.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/package.json +1 -1
- package/.flightline/checkpoints.db +0 -0
- package/.flightline/ctk/04a5510b-1e09-40c6-91c8-399c22138708.json +0 -9
- package/.flightline/ctk/0ecde721-7827-4039-995a-974e24493cc5.json +0 -9
- package/.flightline/ctk/268bbdbd-ddd7-46b2-845f-56a138aa518a.json +0 -9
- package/.flightline/ctk/6f476f2e-776c-407a-b441-b9365c0bae95.json +0 -9
- package/.flightline/ctk/7e10d0d5-fbc2-4661-af03-53de89e064db.json +0 -9
- package/.flightline/ctk/90783096-b7d4-49c5-8153-3c35018a2e61.json +0 -9
- package/.flightline/ctk/9a3b6d18-8a46-4728-90aa-279800a8e397.json +0 -9
- package/.flightline/ctk/ae30e192-b386-4ee2-899c-93f86785d3f3.json +0 -9
- package/.flightline/ctk/d0e9c49e-10df-413e-8cf7-37232b1838ca.json +0 -9
- package/.flightline/ctk/eae1a12b-2e9d-4c3f-8619-dafbb1346e96.json +0 -9
- package/.flightline/mailboxes/mbx_00dae6ba-0b5e-4a8d-a86d-93c8640872c3/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_05b0bfa9-c4f5-4f68-ba75-6202820f49c3/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_0a6b8fb2-729e-4385-8241-839c36b929d7/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_0abca4ab-8e34-409c-997f-481e80e450dc/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_173e5fb9-8203-418d-93c2-4f8c91f2d842/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_22b62201-0570-4ce8-b0a7-0f4b445f6d9e/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_2724efb1-76e1-4147-9620-4defcc65510f/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_35b8bfcd-5a54-48f1-8759-cb1f8ffe775d/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_3bc5193a-604d-4f52-be00-e56277643358/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_3bd500f3-c111-427a-8cd7-a004125d6dc1/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_45ce9ae8-5299-44dc-a1b5-4d63914a9609/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_4779c645-1efc-4c76-ab21-ff93f973ee8f/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_482237cf-87c8-486e-a24d-0941be2f480d/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_4b7e23c8-5680-4edd-a276-88803dd5fb6f/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_4dd3b945-d846-4c7a-94eb-6eeb25a0dc6b/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_4ec41a62-62bb-4be4-b3ce-282d5a33acce/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_4ff7ee7e-0c8a-43d6-a829-7c62c10af3b0/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_7661e4fb-a919-4af1-86f7-3eaef22f1d81/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_7ca872bb-69ab-4e7d-a7c6-4888ec8e7749/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_7e6d5707-2aa5-4770-a7be-6b1be93d0d87/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_87bef50d-3c59-429b-a995-5872f6278c37/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_88d1ea56-0b69-48c4-9fcf-ce1e1f7527ba/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_8bfb6bd7-07d1-4836-ae9d-3c93668c6dfe/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_93355083-e95b-4341-b625-56fcc1e4fc0c/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_999fd94c-ca56-4fec-8d30-8b677cf40ad6/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_a039fd15-7ee1-4bd6-906d-55dea8d0e489/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_a0b7363f-7cc6-4940-8e29-2dc85793a77d/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_a31e8b61-9643-4c78-939d-d1696d0420d9/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_acc51591-256c-4bed-9a51-514b1811f4cd/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_b1efebd9-5981-49fa-8775-20fa00d0c902/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_ba9d4c61-39a3-4852-95d7-bd34e3605a43/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_c549b60f-65fd-48d5-8cd6-2f053292b112/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_d0f839a5-3ab9-42e2-b438-df5825d049fe/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_d826d57e-9817-4f3c-ab94-2bfafa352f6d/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_da102f37-632c-4c0b-be4c-4270a74c06b9/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_df4506f5-67f2-4cf6-9113-93994b76f39b/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_e038e93b-87ea-4122-9578-6540018697b7/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_e0c171c5-407f-44dc-9ef9-e26e8b99ceac/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_e64770bf-7220-4d0f-848c-d751ea1c7376/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_e7f0edda-0fab-484d-ab4d-d8a8e363cd14/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_ec7d9118-8594-4d79-bf79-f43afdfaf156/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_ee06ec01-03e4-485a-ae2b-d8bdb6e7a3a8/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_fd467681-f9cf-4a54-b06a-836df6de2ccc/manifest.json +0 -6
- package/.flightline/progress.db +0 -0
- package/.flightline/recovery.log +0 -1
- package/.flightline/tasks.db +0 -0
- package/.flightline/tech-orders/to_0c93d981-6b4e-4055-8678-f39c009d1db1.json +0 -11
- package/.flightline/tech-orders/to_1862f8ed-c487-4914-9f1e-528af6d4f053.json +0 -11
- package/.flightline/tech-orders/to_2335a57d-f400-4efa-b108-e13ece57520d.json +0 -11
- package/.flightline/tech-orders/to_2bd8dbdd-ac57-4b84-b977-33a3637d10d1.json +0 -11
- package/.flightline/tech-orders/to_37057c01-39b5-403a-991f-afb186abde95.json +0 -11
- package/.flightline/tech-orders/to_9e7288bb-c0fd-488a-a83d-1e9337bd0f1f.json +0 -11
- package/.flightline/tech-orders/to_aa0fe80b-9de7-40f6-a106-353b5bca10bd.json +0 -11
- package/.flightline/tech-orders/to_c1a0f480-c863-4203-a070-76ad77137845.json +0 -11
- package/.flightline/tech-orders/to_cf1e882a-cf56-45a4-8d19-494925e5f449.json +0 -11
- package/.flightline/work-orders/wo_5a29168d-5fb4-41d7-8dac-1d1151d9248f/manifest.json +0 -15
- package/.flightline/work-orders/wo_6c8c38bb-17a1-4885-ada4-dbfc5cc12d7a/manifest.json +0 -15
- package/.flightline/work-orders/wo_cadeb9b2-ea42-4491-b429-e2d467942b5c/manifest.json +0 -12
- package/.flightline/work-orders/wo_cc7b669c-16c4-4ef7-8a76-d1813219d0be/manifest.json +0 -15
- package/dist/server/api/src/coordination/agent-lifecycle.d.ts +0 -12
- package/dist/server/api/src/coordination/agent-lifecycle.d.ts.map +0 -1
- package/dist/server/api/src/coordination/agent-lifecycle.js +0 -12
- package/dist/server/api/src/coordination/agent-lifecycle.js.map +0 -1
- package/dist/server/api/src/coordination/agent-runner.d.ts +0 -9
- package/dist/server/api/src/coordination/agent-runner.d.ts.map +0 -1
- package/dist/server/api/src/coordination/agent-runner.js +0 -416
- package/dist/server/api/src/coordination/agent-runner.js.map +0 -1
- package/dist/server/api/src/coordination/agent-spawner-routes.d.ts +0 -7
- package/dist/server/api/src/coordination/agent-spawner-routes.d.ts.map +0 -1
- package/dist/server/api/src/coordination/agent-spawner-routes.js +0 -321
- package/dist/server/api/src/coordination/agent-spawner-routes.js.map +0 -1
- package/dist/server/api/src/coordination/agent-spawner.d.ts +0 -187
- package/dist/server/api/src/coordination/agent-spawner.d.ts.map +0 -1
- package/dist/server/api/src/coordination/agent-spawner.js +0 -712
- package/dist/server/api/src/coordination/agent-spawner.js.map +0 -1
- package/dist/server/api/src/coordination/agents.d.ts +0 -13
- package/dist/server/api/src/coordination/agents.d.ts.map +0 -1
- package/dist/server/api/src/coordination/agents.js +0 -464
- package/dist/server/api/src/coordination/agents.js.map +0 -1
- package/dist/server/api/src/coordination/checkpoint-routes.d.ts +0 -33
- package/dist/server/api/src/coordination/checkpoint-routes.d.ts.map +0 -1
- package/dist/server/api/src/coordination/checkpoint-routes.js +0 -323
- package/dist/server/api/src/coordination/checkpoint-routes.js.map +0 -1
- package/dist/server/api/src/coordination/conflict-resolver.d.ts +0 -152
- package/dist/server/api/src/coordination/conflict-resolver.d.ts.map +0 -1
- package/dist/server/api/src/coordination/conflict-resolver.js +0 -502
- package/dist/server/api/src/coordination/conflict-resolver.js.map +0 -1
- package/dist/server/api/src/coordination/missions.d.ts +0 -9
- package/dist/server/api/src/coordination/missions.d.ts.map +0 -1
- package/dist/server/api/src/coordination/missions.js +0 -148
- package/dist/server/api/src/coordination/missions.js.map +0 -1
- package/dist/server/api/src/coordination/monitor.d.ts +0 -175
- package/dist/server/api/src/coordination/monitor.d.ts.map +0 -1
- package/dist/server/api/src/coordination/monitor.js +0 -410
- package/dist/server/api/src/coordination/monitor.js.map +0 -1
- package/dist/server/api/src/coordination/notifier.d.ts +0 -160
- package/dist/server/api/src/coordination/notifier.d.ts.map +0 -1
- package/dist/server/api/src/coordination/notifier.js +0 -422
- package/dist/server/api/src/coordination/notifier.js.map +0 -1
- package/dist/server/api/src/coordination/progress-tracker.d.ts +0 -98
- package/dist/server/api/src/coordination/progress-tracker.d.ts.map +0 -1
- package/dist/server/api/src/coordination/progress-tracker.js +0 -323
- package/dist/server/api/src/coordination/progress-tracker.js.map +0 -1
- package/dist/server/api/src/coordination/recovery-manager.d.ts +0 -135
- package/dist/server/api/src/coordination/recovery-manager.d.ts.map +0 -1
- package/dist/server/api/src/coordination/recovery-manager.js +0 -435
- package/dist/server/api/src/coordination/recovery-manager.js.map +0 -1
- package/dist/server/api/src/coordination/task-decomposer.d.ts +0 -90
- package/dist/server/api/src/coordination/task-decomposer.d.ts.map +0 -1
- package/dist/server/api/src/coordination/task-decomposer.js +0 -412
- package/dist/server/api/src/coordination/task-decomposer.js.map +0 -1
- package/dist/server/api/src/coordination/task-queue-routes.d.ts +0 -7
- package/dist/server/api/src/coordination/task-queue-routes.d.ts.map +0 -1
- package/dist/server/api/src/coordination/task-queue-routes.js +0 -266
- package/dist/server/api/src/coordination/task-queue-routes.js.map +0 -1
- package/dist/server/api/src/coordination/task-queue.d.ts +0 -104
- package/dist/server/api/src/coordination/task-queue.d.ts.map +0 -1
- package/dist/server/api/src/coordination/task-queue.js +0 -378
- package/dist/server/api/src/coordination/task-queue.js.map +0 -1
- package/dist/server/api/src/coordination/tasks.d.ts +0 -7
- package/dist/server/api/src/coordination/tasks.d.ts.map +0 -1
- package/dist/server/api/src/coordination/tasks.js +0 -59
- package/dist/server/api/src/coordination/tasks.js.map +0 -1
- package/dist/server/api/src/decomposition/cli.d.ts +0 -18
- package/dist/server/api/src/decomposition/cli.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/cli.js +0 -191
- package/dist/server/api/src/decomposition/cli.js.map +0 -1
- package/dist/server/api/src/decomposition/codebase-analyzer.d.ts +0 -59
- package/dist/server/api/src/decomposition/codebase-analyzer.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/codebase-analyzer.js +0 -274
- package/dist/server/api/src/decomposition/codebase-analyzer.js.map +0 -1
- package/dist/server/api/src/decomposition/dependency-resolver.d.ts +0 -68
- package/dist/server/api/src/decomposition/dependency-resolver.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/dependency-resolver.js +0 -261
- package/dist/server/api/src/decomposition/dependency-resolver.js.map +0 -1
- package/dist/server/api/src/decomposition/index.d.ts +0 -17
- package/dist/server/api/src/decomposition/index.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/index.js +0 -19
- package/dist/server/api/src/decomposition/index.js.map +0 -1
- package/dist/server/api/src/decomposition/parallelization.d.ts +0 -40
- package/dist/server/api/src/decomposition/parallelization.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/parallelization.js +0 -144
- package/dist/server/api/src/decomposition/parallelization.js.map +0 -1
- package/dist/server/api/src/decomposition/planner.d.ts +0 -84
- package/dist/server/api/src/decomposition/planner.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/planner.js +0 -415
- package/dist/server/api/src/decomposition/planner.js.map +0 -1
- package/dist/server/api/src/decomposition/routes.d.ts +0 -13
- package/dist/server/api/src/decomposition/routes.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/routes.js +0 -114
- package/dist/server/api/src/decomposition/routes.js.map +0 -1
- package/dist/server/api/src/decomposition/strategies.d.ts +0 -43
- package/dist/server/api/src/decomposition/strategies.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/strategies.js +0 -147
- package/dist/server/api/src/decomposition/strategies.js.map +0 -1
- package/dist/server/api/src/decomposition/types.d.ts +0 -1090
- package/dist/server/api/src/decomposition/types.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/types.js +0 -65
- package/dist/server/api/src/decomposition/types.js.map +0 -1
- package/dist/server/api/src/decomposition/validator.d.ts +0 -84
- package/dist/server/api/src/decomposition/validator.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/validator.js +0 -314
- package/dist/server/api/src/decomposition/validator.js.map +0 -1
- package/dist/server/api/src/flightline/ctk.d.ts +0 -2
- package/dist/server/api/src/flightline/ctk.d.ts.map +0 -1
- package/dist/server/api/src/flightline/ctk.js +0 -114
- package/dist/server/api/src/flightline/ctk.js.map +0 -1
- package/dist/server/api/src/flightline/tech-orders.d.ts +0 -2
- package/dist/server/api/src/flightline/tech-orders.d.ts.map +0 -1
- package/dist/server/api/src/flightline/tech-orders.js +0 -74
- package/dist/server/api/src/flightline/tech-orders.js.map +0 -1
- package/dist/server/api/src/flightline/work-orders.d.ts +0 -2
- package/dist/server/api/src/flightline/work-orders.d.ts.map +0 -1
- package/dist/server/api/src/flightline/work-orders.js +0 -178
- package/dist/server/api/src/flightline/work-orders.js.map +0 -1
- package/dist/server/api/src/index.d.ts +0 -3
- package/dist/server/api/src/index.d.ts.map +0 -1
- package/dist/server/api/src/index.js +0 -192
- package/dist/server/api/src/index.js.map +0 -1
- package/dist/server/api/src/middleware/agent-validation.d.ts +0 -161
- package/dist/server/api/src/middleware/agent-validation.d.ts.map +0 -1
- package/dist/server/api/src/middleware/agent-validation.js +0 -112
- package/dist/server/api/src/middleware/agent-validation.js.map +0 -1
- package/dist/server/api/src/middleware/error-handler.d.ts +0 -8
- package/dist/server/api/src/middleware/error-handler.d.ts.map +0 -1
- package/dist/server/api/src/middleware/error-handler.js +0 -54
- package/dist/server/api/src/middleware/error-handler.js.map +0 -1
- package/dist/server/api/src/middleware/logger.d.ts +0 -8
- package/dist/server/api/src/middleware/logger.d.ts.map +0 -1
- package/dist/server/api/src/middleware/logger.js +0 -31
- package/dist/server/api/src/middleware/logger.js.map +0 -1
- package/dist/server/api/src/middleware/validation.d.ts +0 -322
- package/dist/server/api/src/middleware/validation.d.ts.map +0 -1
- package/dist/server/api/src/middleware/validation.js +0 -189
- package/dist/server/api/src/middleware/validation.js.map +0 -1
- package/dist/server/api/src/squawk/blocker-handler.d.ts +0 -111
- package/dist/server/api/src/squawk/blocker-handler.d.ts.map +0 -1
- package/dist/server/api/src/squawk/blocker-handler.js +0 -262
- package/dist/server/api/src/squawk/blocker-handler.js.map +0 -1
- package/dist/server/api/src/squawk/coordinator.d.ts +0 -2
- package/dist/server/api/src/squawk/coordinator.d.ts.map +0 -1
- package/dist/server/api/src/squawk/coordinator.js +0 -24
- package/dist/server/api/src/squawk/coordinator.js.map +0 -1
- package/dist/server/api/src/squawk/cursor.d.ts +0 -2
- package/dist/server/api/src/squawk/cursor.d.ts.map +0 -1
- package/dist/server/api/src/squawk/cursor.js +0 -55
- package/dist/server/api/src/squawk/cursor.js.map +0 -1
- package/dist/server/api/src/squawk/dependency-resolver.d.ts +0 -107
- package/dist/server/api/src/squawk/dependency-resolver.d.ts.map +0 -1
- package/dist/server/api/src/squawk/dependency-resolver.js +0 -324
- package/dist/server/api/src/squawk/dependency-resolver.js.map +0 -1
- package/dist/server/api/src/squawk/dispatch-orchestrator.d.ts +0 -117
- package/dist/server/api/src/squawk/dispatch-orchestrator.d.ts.map +0 -1
- package/dist/server/api/src/squawk/dispatch-orchestrator.js +0 -296
- package/dist/server/api/src/squawk/dispatch-orchestrator.js.map +0 -1
- package/dist/server/api/src/squawk/lock-coordinator.d.ts +0 -118
- package/dist/server/api/src/squawk/lock-coordinator.d.ts.map +0 -1
- package/dist/server/api/src/squawk/lock-coordinator.js +0 -279
- package/dist/server/api/src/squawk/lock-coordinator.js.map +0 -1
- package/dist/server/api/src/squawk/lock.d.ts +0 -2
- package/dist/server/api/src/squawk/lock.d.ts.map +0 -1
- package/dist/server/api/src/squawk/lock.js +0 -87
- package/dist/server/api/src/squawk/lock.js.map +0 -1
- package/dist/server/api/src/squawk/mailbox.d.ts +0 -2
- package/dist/server/api/src/squawk/mailbox.d.ts.map +0 -1
- package/dist/server/api/src/squawk/mailbox.js +0 -66
- package/dist/server/api/src/squawk/mailbox.js.map +0 -1
- package/dist/server/api/src/squawk/spawning.d.ts +0 -79
- package/dist/server/api/src/squawk/spawning.d.ts.map +0 -1
- package/dist/server/api/src/squawk/spawning.js +0 -226
- package/dist/server/api/src/squawk/spawning.js.map +0 -1
- package/dist/server/api/src/squawk/specialist-tools.d.ts +0 -206
- package/dist/server/api/src/squawk/specialist-tools.d.ts.map +0 -1
- package/dist/server/api/src/squawk/specialist-tools.js +0 -411
- package/dist/server/api/src/squawk/specialist-tools.js.map +0 -1
- package/dist/server/api/src/types/api.d.ts +0 -63
- package/dist/server/api/src/types/api.d.ts.map +0 -1
- package/dist/server/api/src/types/api.js +0 -5
- package/dist/server/api/src/types/api.js.map +0 -1
- package/dist/squawk/src/db/index.d.ts +0 -30
- package/dist/squawk/src/db/index.d.ts.map +0 -1
- package/dist/squawk/src/db/index.js +0 -329
- package/dist/squawk/src/db/index.js.map +0 -1
- package/dist/squawk/src/db/sqlite.d.ts +0 -31
- package/dist/squawk/src/db/sqlite.d.ts.map +0 -1
- package/dist/squawk/src/db/sqlite.js +0 -558
- package/dist/squawk/src/db/sqlite.js.map +0 -1
- package/dist/squawk/src/db/types.d.ts +0 -611
- package/dist/squawk/src/db/types.d.ts.map +0 -1
- package/dist/squawk/src/db/types.js +0 -4
- package/dist/squawk/src/db/types.js.map +0 -1
- package/e2e-integration.test.ts +0 -290
- package/integration.test.ts +0 -186
- package/phase1-integration.test.ts +0 -455
- package/phase2-verification.test.ts +0 -135
- package/server.log +0 -58
- package/src/agent-runner.js +0 -877
- package/src/coordination/agent-lifecycle.ts +0 -13
- package/src/coordination/agent-runner.ts +0 -479
- package/src/coordination/agent-spawner-routes.ts +0 -340
- package/src/coordination/agent-spawner.ts +0 -885
- package/src/coordination/agents.ts +0 -525
- package/src/coordination/checkpoint-routes.ts +0 -382
- package/src/coordination/conflict-resolver.ts +0 -640
- package/src/coordination/missions.ts +0 -219
- package/src/coordination/monitor.ts +0 -593
- package/src/coordination/notifier.ts +0 -547
- package/src/coordination/progress-tracker.ts +0 -410
- package/src/coordination/recovery-manager.ts +0 -531
- package/src/coordination/task-decomposer.ts +0 -491
- package/src/coordination/task-queue-routes.ts +0 -284
- package/src/coordination/task-queue.ts +0 -480
- package/src/coordination/tasks.ts +0 -72
- package/src/flightline/ctk.ts +0 -131
- package/src/flightline/tech-orders.ts +0 -85
- package/src/flightline/work-orders.ts +0 -202
- package/src/index.ts +0 -211
- package/src/middleware/agent-validation.ts +0 -130
- package/src/middleware/error-handler.ts +0 -59
- package/src/middleware/logger.ts +0 -37
- package/src/middleware/validation.ts +0 -235
- package/src/squawk/coordinator.ts +0 -26
- package/src/squawk/cursor.ts +0 -62
- package/src/squawk/lock.ts +0 -98
- package/src/squawk/mailbox.ts +0 -75
- package/src/types/api.ts +0 -71
- package/test-api.ts +0 -310
- package/test-enhanced-agents.ts +0 -428
|
@@ -1,531 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Recovery Manager for FleetTools Checkpoint/Resume System
|
|
3
|
-
*
|
|
4
|
-
* Handles restoring system state from checkpoints including:
|
|
5
|
-
* - Agent state restoration
|
|
6
|
-
* - Task recovery
|
|
7
|
-
* - Lock restoration
|
|
8
|
-
* - Message queue recovery
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { AgentSpawner, AgentType, AgentStatus } from './agent-spawner.js';
|
|
12
|
-
import { CheckpointManager } from './checkpoint-routes.js';
|
|
13
|
-
import { randomUUID } from 'node:crypto';
|
|
14
|
-
import path from 'node:path';
|
|
15
|
-
|
|
16
|
-
interface RecoveryPlan {
|
|
17
|
-
checkpointId: string;
|
|
18
|
-
missionId: string;
|
|
19
|
-
agentsToRestore: AgentRestorePlan[];
|
|
20
|
-
tasksToResume: TaskRestorePlan[];
|
|
21
|
-
locksToRestore: LockRestorePlan[];
|
|
22
|
-
estimatedDuration: number;
|
|
23
|
-
risks: string[];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface AgentRestorePlan {
|
|
27
|
-
agentId: string;
|
|
28
|
-
agentType: AgentType;
|
|
29
|
-
previousState: any;
|
|
30
|
-
task?: string;
|
|
31
|
-
priority: 'high' | 'medium' | 'low';
|
|
32
|
-
estimatedRestoreTime: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface TaskRestorePlan {
|
|
36
|
-
taskId: string;
|
|
37
|
-
missionId: string;
|
|
38
|
-
previousState: any;
|
|
39
|
-
assignedAgent?: string;
|
|
40
|
-
progress: number;
|
|
41
|
-
nextSteps: string[];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
interface LockRestorePlan {
|
|
45
|
-
lockId: string;
|
|
46
|
-
filePath: string;
|
|
47
|
-
originalAgent: string;
|
|
48
|
-
purpose: string;
|
|
49
|
-
needsConflictResolution: boolean;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export class RecoveryManager {
|
|
53
|
-
private agentSpawner: AgentSpawner;
|
|
54
|
-
private checkpointManager: CheckpointManager;
|
|
55
|
-
private recoveryLogPath: string;
|
|
56
|
-
|
|
57
|
-
constructor() {
|
|
58
|
-
this.agentSpawner = new AgentSpawner();
|
|
59
|
-
this.checkpointManager = new CheckpointManager();
|
|
60
|
-
this.recoveryLogPath = path.join(process.cwd(), '.flightline', 'recovery.log');
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Create a recovery plan from a checkpoint
|
|
65
|
-
*/
|
|
66
|
-
async createRecoveryPlan(checkpointId: string, force = false): Promise<RecoveryPlan> {
|
|
67
|
-
console.log(`📋 Creating recovery plan for checkpoint: ${checkpointId}`);
|
|
68
|
-
|
|
69
|
-
const checkpoint = await this.checkpointManager.getCheckpoint(checkpointId);
|
|
70
|
-
if (!checkpoint) {
|
|
71
|
-
throw new Error(`Checkpoint not found: ${checkpointId}`);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Analyze checkpoint and create restore plans
|
|
75
|
-
const agentsToRestore = await this.analyzeAgentRestore(checkpoint);
|
|
76
|
-
const tasksToResume = await this.analyzeTaskResume(checkpoint);
|
|
77
|
-
const locksToRestore = await this.analyzeLockRestore(checkpoint);
|
|
78
|
-
const risks = await this.assessRecoveryRisks(checkpoint, force);
|
|
79
|
-
|
|
80
|
-
const plan: RecoveryPlan = {
|
|
81
|
-
checkpointId,
|
|
82
|
-
missionId: checkpoint.mission_id,
|
|
83
|
-
agentsToRestore,
|
|
84
|
-
tasksToResume,
|
|
85
|
-
locksToRestore,
|
|
86
|
-
estimatedDuration: this.calculateEstimatedDuration(agentsToRestore, tasksToResume),
|
|
87
|
-
risks
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
await this.logRecoveryEvent('plan_created', {
|
|
91
|
-
checkpointId,
|
|
92
|
-
plan: this.sanitizePlanForLogging(plan)
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
return plan;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Execute recovery from a checkpoint
|
|
100
|
-
*/
|
|
101
|
-
async executeRecovery(checkpointId: string, options: {
|
|
102
|
-
force?: boolean;
|
|
103
|
-
dryRun?: boolean;
|
|
104
|
-
} = {}): Promise<{
|
|
105
|
-
success: boolean;
|
|
106
|
-
restoredAgents: string[];
|
|
107
|
-
restoredTasks: string[];
|
|
108
|
-
restoredLocks: string[];
|
|
109
|
-
errors: string[];
|
|
110
|
-
}> {
|
|
111
|
-
console.log(`🔄 Starting recovery from checkpoint: ${checkpointId}`);
|
|
112
|
-
|
|
113
|
-
const plan = await this.createRecoveryPlan(checkpointId, options.force);
|
|
114
|
-
|
|
115
|
-
if (options.dryRun) {
|
|
116
|
-
console.log('🔍 DRY RUN - Recovery Plan:');
|
|
117
|
-
console.log(JSON.stringify(plan, null, 2));
|
|
118
|
-
return {
|
|
119
|
-
success: true,
|
|
120
|
-
restoredAgents: [],
|
|
121
|
-
restoredTasks: [],
|
|
122
|
-
restoredLocks: [],
|
|
123
|
-
errors: []
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const result = {
|
|
128
|
-
success: true,
|
|
129
|
-
restoredAgents: [] as string[],
|
|
130
|
-
restoredTasks: [] as string[],
|
|
131
|
-
restoredLocks: [] as string[],
|
|
132
|
-
errors: [] as string[]
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
try {
|
|
136
|
-
// Phase 1: Restore agents in priority order
|
|
137
|
-
console.log('🚀 Phase 1: Restoring agents...');
|
|
138
|
-
for (const agentPlan of plan.agentsToRestore.sort((a, b) => {
|
|
139
|
-
const priorityOrder = { high: 3, medium: 2, low: 1 };
|
|
140
|
-
return priorityOrder[b.priority] - priorityOrder[a.priority];
|
|
141
|
-
})) {
|
|
142
|
-
try {
|
|
143
|
-
const agentId = await this.restoreAgent(agentPlan);
|
|
144
|
-
result.restoredAgents.push(agentId);
|
|
145
|
-
console.log(`✅ Restored agent: ${agentId} (${agentPlan.agentType})`);
|
|
146
|
-
} catch (error: any) {
|
|
147
|
-
const errorMsg = `Failed to restore agent ${agentPlan.agentId}: ${error.message}`;
|
|
148
|
-
result.errors.push(errorMsg);
|
|
149
|
-
console.error(`❌ ${errorMsg}`);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// Phase 2: Resume tasks
|
|
154
|
-
console.log('📋 Phase 2: Resuming tasks...');
|
|
155
|
-
for (const taskPlan of plan.tasksToResume) {
|
|
156
|
-
try {
|
|
157
|
-
const taskId = await this.resumeTask(taskPlan);
|
|
158
|
-
result.restoredTasks.push(taskId);
|
|
159
|
-
console.log(`✅ Resumed task: ${taskId}`);
|
|
160
|
-
} catch (error: any) {
|
|
161
|
-
const errorMsg = `Failed to resume task ${taskPlan.taskId}: ${error.message}`;
|
|
162
|
-
result.errors.push(errorMsg);
|
|
163
|
-
console.error(`❌ ${errorMsg}`);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// Phase 3: Restore locks (if needed)
|
|
168
|
-
console.log('🔒 Phase 3: Restoring locks...');
|
|
169
|
-
for (const lockPlan of plan.locksToRestore) {
|
|
170
|
-
try {
|
|
171
|
-
const lockId = await this.restoreLock(lockPlan, options.force);
|
|
172
|
-
result.restoredLocks.push(lockId);
|
|
173
|
-
console.log(`✅ Restored lock: ${lockId}`);
|
|
174
|
-
} catch (error: any) {
|
|
175
|
-
const errorMsg = `Failed to restore lock ${lockPlan.lockId}: ${error.message}`;
|
|
176
|
-
result.errors.push(errorMsg);
|
|
177
|
-
console.error(`❌ ${errorMsg}`);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
result.success = result.errors.length === 0 || result.errors.length < this.calculateAcceptableErrorCount(plan);
|
|
182
|
-
|
|
183
|
-
await this.logRecoveryEvent('recovery_completed', {
|
|
184
|
-
checkpointId,
|
|
185
|
-
result,
|
|
186
|
-
plan: this.sanitizePlanForLogging(plan)
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
console.log(`🎉 Recovery ${result.success ? 'completed successfully' : 'completed with errors'}`);
|
|
190
|
-
console.log(` Agents restored: ${result.restoredAgents.length}`);
|
|
191
|
-
console.log(` Tasks resumed: ${result.restoredTasks.length}`);
|
|
192
|
-
console.log(` Locks restored: ${result.restoredLocks.length}`);
|
|
193
|
-
console.log(` Errors: ${result.errors.length}`);
|
|
194
|
-
|
|
195
|
-
if (result.errors.length > 0) {
|
|
196
|
-
console.log('\n⚠️ Recovery errors:');
|
|
197
|
-
result.errors.forEach(error => console.log(` - ${error}`));
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return result;
|
|
201
|
-
} catch (error: any) {
|
|
202
|
-
result.success = false;
|
|
203
|
-
result.errors.push(`Recovery failed: ${error.message}`);
|
|
204
|
-
|
|
205
|
-
await this.logRecoveryEvent('recovery_failed', {
|
|
206
|
-
checkpointId,
|
|
207
|
-
error: error.message,
|
|
208
|
-
result
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
throw error;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Analyze what agents need to be restored
|
|
217
|
-
*/
|
|
218
|
-
private async analyzeAgentRestore(checkpoint: any): Promise<AgentRestorePlan[]> {
|
|
219
|
-
const plans: AgentRestorePlan[] = [];
|
|
220
|
-
|
|
221
|
-
if (checkpoint.sorties && Array.isArray(checkpoint.sorties)) {
|
|
222
|
-
for (const sortie of checkpoint.sorties) {
|
|
223
|
-
if (sortie.status === 'in_progress' && sortie.assigned_to) {
|
|
224
|
-
plans.push({
|
|
225
|
-
agentId: `agt_${randomUUID()}`,
|
|
226
|
-
agentType: this.mapSortieToAgentType(sortie.assigned_to),
|
|
227
|
-
previousState: sortie,
|
|
228
|
-
task: sortie.description || sortie.title,
|
|
229
|
-
priority: this.determineAgentPriority(sortie),
|
|
230
|
-
estimatedRestoreTime: this.estimateAgentRestoreTime(sortie)
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return plans;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Analyze what tasks need to be resumed
|
|
241
|
-
*/
|
|
242
|
-
private async analyzeTaskResume(checkpoint: any): Promise<TaskRestorePlan[]> {
|
|
243
|
-
const plans: TaskRestorePlan[] = [];
|
|
244
|
-
|
|
245
|
-
if (checkpoint.sorties && Array.isArray(checkpoint.sorties)) {
|
|
246
|
-
for (const sortie of checkpoint.sorties) {
|
|
247
|
-
if (sortie.status !== 'completed') {
|
|
248
|
-
plans.push({
|
|
249
|
-
taskId: sortie.id,
|
|
250
|
-
missionId: checkpoint.mission_id,
|
|
251
|
-
previousState: sortie,
|
|
252
|
-
assignedAgent: sortie.assigned_to,
|
|
253
|
-
progress: sortie.progress || 0,
|
|
254
|
-
nextSteps: this.generateNextSteps(sortie, checkpoint.recovery_context)
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
return plans;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Analyze what locks need to be restored
|
|
265
|
-
*/
|
|
266
|
-
private async analyzeLockRestore(checkpoint: any): Promise<LockRestorePlan[]> {
|
|
267
|
-
const plans: LockRestorePlan[] = [];
|
|
268
|
-
|
|
269
|
-
if (checkpoint.active_locks && Array.isArray(checkpoint.active_locks)) {
|
|
270
|
-
for (const lock of checkpoint.active_locks) {
|
|
271
|
-
plans.push({
|
|
272
|
-
lockId: `lock_${randomUUID()}`,
|
|
273
|
-
filePath: lock.file,
|
|
274
|
-
originalAgent: lock.held_by,
|
|
275
|
-
purpose: lock.purpose,
|
|
276
|
-
needsConflictResolution: true // Always check for conflicts on resume
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
return plans;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Assess potential recovery risks
|
|
286
|
-
*/
|
|
287
|
-
private async assessRecoveryRisks(checkpoint: any, force: boolean): Promise<string[]> {
|
|
288
|
-
const risks: string[] = [];
|
|
289
|
-
const checkpointAge = Date.now() - new Date(checkpoint.timestamp).getTime();
|
|
290
|
-
const ageHours = checkpointAge / (1000 * 60 * 60);
|
|
291
|
-
|
|
292
|
-
if (ageHours > 24) {
|
|
293
|
-
risks.push(`Checkpoint is ${Math.round(ageHours)} hours old - environment may have changed`);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
if (checkpoint.active_locks && checkpoint.active_locks.length > 0) {
|
|
297
|
-
risks.push('Active locks may conflict with current state');
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
if (!force && await this.hasActiveAgents()) {
|
|
301
|
-
risks.push('Active agents detected - use --force to override');
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
const agentCount = checkpoint.sorties?.filter((s: any) => s.status === 'in_progress').length || 0;
|
|
305
|
-
if (agentCount > 5) {
|
|
306
|
-
risks.push(`High agent count (${agentCount}) may impact recovery performance`);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
return risks;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Restore an individual agent
|
|
314
|
-
*/
|
|
315
|
-
private async restoreAgent(plan: AgentRestorePlan): Promise<string> {
|
|
316
|
-
const spawnRequest = {
|
|
317
|
-
type: plan.agentType,
|
|
318
|
-
task: plan.task,
|
|
319
|
-
metadata: {
|
|
320
|
-
restoredFromCheckpoint: plan.agentId,
|
|
321
|
-
previousState: plan.previousState,
|
|
322
|
-
restoreTimestamp: new Date().toISOString()
|
|
323
|
-
},
|
|
324
|
-
config: {
|
|
325
|
-
timeout: 300000, // 5 minutes
|
|
326
|
-
retries: 2
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
const agent = await this.agentSpawner.spawn(spawnRequest);
|
|
331
|
-
return agent.id;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Resume an individual task
|
|
336
|
-
*/
|
|
337
|
-
private async resumeTask(plan: TaskRestorePlan): Promise<string> {
|
|
338
|
-
// In a real implementation, this would integrate with the task queue
|
|
339
|
-
// For now, simulate task resumption
|
|
340
|
-
console.log(` Resuming task ${plan.taskId} with ${plan.progress}% progress`);
|
|
341
|
-
|
|
342
|
-
// Send task resumption to task queue system
|
|
343
|
-
const taskResume = {
|
|
344
|
-
taskId: plan.taskId,
|
|
345
|
-
missionId: plan.missionId,
|
|
346
|
-
previousState: plan.previousState,
|
|
347
|
-
progress: plan.progress,
|
|
348
|
-
nextSteps: plan.nextSteps,
|
|
349
|
-
resumedAt: new Date().toISOString()
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
// This would integrate with the actual task system
|
|
353
|
-
return plan.taskId;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Restore an individual lock
|
|
358
|
-
*/
|
|
359
|
-
private async restoreLock(plan: LockRestorePlan, force = false): Promise<string> {
|
|
360
|
-
if (plan.needsConflictResolution && !force) {
|
|
361
|
-
// Check for existing conflicts
|
|
362
|
-
const hasConflict = await this.checkLockConflict(plan.filePath);
|
|
363
|
-
if (hasConflict) {
|
|
364
|
-
throw new Error(`Lock conflict detected on ${plan.filePath}. Use --force to override.`);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
// Restore lock via lock API
|
|
369
|
-
const lockRestore = {
|
|
370
|
-
file: plan.filePath,
|
|
371
|
-
specialist_id: plan.originalAgent,
|
|
372
|
-
purpose: plan.purpose,
|
|
373
|
-
timeout_ms: 3600000 // 1 hour
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
const response = await fetch('http://localhost:3001/api/v1/lock/acquire', {
|
|
377
|
-
method: 'POST',
|
|
378
|
-
headers: { 'Content-Type': 'application/json' },
|
|
379
|
-
body: JSON.stringify(lockRestore)
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
if (!response.ok) {
|
|
383
|
-
const errorData = await response.json() as any;
|
|
384
|
-
throw new Error(`Lock restore failed: ${errorData?.error || 'Unknown error'}`);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
const result = await response.json() as any;
|
|
388
|
-
return result.lock.id;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Check if there are active agents
|
|
393
|
-
*/
|
|
394
|
-
private async hasActiveAgents(): Promise<boolean> {
|
|
395
|
-
try {
|
|
396
|
-
const response = await fetch('http://localhost:3001/api/v1/agents');
|
|
397
|
-
if (!response.ok) return false;
|
|
398
|
-
|
|
399
|
-
const data = await response.json() as any;
|
|
400
|
-
return data.success && data.data?.agents?.length > 0;
|
|
401
|
-
} catch {
|
|
402
|
-
return false;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* Check for lock conflicts
|
|
408
|
-
*/
|
|
409
|
-
private async checkLockConflict(filePath: string): Promise<boolean> {
|
|
410
|
-
try {
|
|
411
|
-
const response = await fetch(`http://localhost:3001/api/v1/locks`);
|
|
412
|
-
if (!response.ok) return false;
|
|
413
|
-
|
|
414
|
-
const data = await response.json() as any;
|
|
415
|
-
if (!data.success) return false;
|
|
416
|
-
|
|
417
|
-
const locks = data.data?.locks || [];
|
|
418
|
-
return locks.some((lock: any) => lock.file === filePath && lock.status === 'active');
|
|
419
|
-
} catch {
|
|
420
|
-
return false;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* Map sortie assignment to agent type
|
|
426
|
-
*/
|
|
427
|
-
private mapSortieToAgentType(assignment: string): AgentType {
|
|
428
|
-
const type = assignment.toLowerCase();
|
|
429
|
-
|
|
430
|
-
if (type.includes('frontend') || type.includes('ui')) return AgentType.FRONTEND;
|
|
431
|
-
if (type.includes('backend') || type.includes('api')) return AgentType.BACKEND;
|
|
432
|
-
if (type.includes('test') || type.includes('qa')) return AgentType.TESTING;
|
|
433
|
-
if (type.includes('doc') || type.includes('write')) return AgentType.DOCUMENTATION;
|
|
434
|
-
if (type.includes('security') || type.includes('audit')) return AgentType.SECURITY;
|
|
435
|
-
if (type.includes('perf') || type.includes('optim')) return AgentType.PERFORMANCE;
|
|
436
|
-
|
|
437
|
-
return AgentType.BACKEND; // Default
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* Determine agent priority based on state
|
|
442
|
-
*/
|
|
443
|
-
private determineAgentPriority(sortie: any): 'high' | 'medium' | 'low' {
|
|
444
|
-
if (sortie.priority === 'critical') return 'high';
|
|
445
|
-
if (sortie.progress > 50) return 'medium';
|
|
446
|
-
return 'low';
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* Estimate agent restore time in seconds
|
|
451
|
-
*/
|
|
452
|
-
private estimateAgentRestoreTime(sortie: any): number {
|
|
453
|
-
const baseTime = 30; // 30 seconds base
|
|
454
|
-
const progressBonus = (sortie.progress || 0) * 0.5; // Faster if already progress
|
|
455
|
-
return Math.max(baseTime - progressBonus, 10);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
/**
|
|
459
|
-
* Generate next steps for task resumption
|
|
460
|
-
*/
|
|
461
|
-
private generateNextSteps(sortie: any, recoveryContext: any): string[] {
|
|
462
|
-
const steps: string[] = [];
|
|
463
|
-
|
|
464
|
-
if (recoveryContext?.next_steps && Array.isArray(recoveryContext.next_steps)) {
|
|
465
|
-
steps.push(...recoveryContext.next_steps);
|
|
466
|
-
} else {
|
|
467
|
-
steps.push(`Continue ${sortie.title || 'task'}`);
|
|
468
|
-
|
|
469
|
-
if (sortie.progress < 100) {
|
|
470
|
-
steps.push(`Complete remaining ${100 - (sortie.progress || 0)}%`);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
return steps;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
* Calculate estimated total duration
|
|
479
|
-
*/
|
|
480
|
-
private calculateEstimatedDuration(agents: AgentRestorePlan[], tasks: TaskRestorePlan[]): number {
|
|
481
|
-
const agentTime = agents.reduce((sum, agent) => sum + agent.estimatedRestoreTime, 0);
|
|
482
|
-
const taskTime = tasks.length * 10; // 10 seconds per task
|
|
483
|
-
return agentTime + taskTime + 30; // 30 seconds overhead
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* Calculate acceptable error count
|
|
488
|
-
*/
|
|
489
|
-
private calculateAcceptableErrorCount(plan: RecoveryPlan): number {
|
|
490
|
-
const totalItems = plan.agentsToRestore.length + plan.tasksToResume.length + plan.locksToRestore.length;
|
|
491
|
-
return Math.max(1, Math.floor(totalItems * 0.1)); // 10% failure rate acceptable
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
/**
|
|
495
|
-
* Sanitize plan for logging
|
|
496
|
-
*/
|
|
497
|
-
private sanitizePlanForLogging(plan: RecoveryPlan): any {
|
|
498
|
-
return {
|
|
499
|
-
...plan,
|
|
500
|
-
agentsToRestore: plan.agentsToRestore.map(a => ({
|
|
501
|
-
...a,
|
|
502
|
-
previousState: '[REDACTED]'
|
|
503
|
-
})),
|
|
504
|
-
tasksToResume: plan.tasksToResume.map(t => ({
|
|
505
|
-
...t,
|
|
506
|
-
previousState: '[REDACTED]'
|
|
507
|
-
}))
|
|
508
|
-
};
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* Log recovery events
|
|
513
|
-
*/
|
|
514
|
-
private async logRecoveryEvent(eventType: string, data: any): Promise<void> {
|
|
515
|
-
const logEntry = {
|
|
516
|
-
timestamp: new Date().toISOString(),
|
|
517
|
-
eventType,
|
|
518
|
-
data
|
|
519
|
-
};
|
|
520
|
-
|
|
521
|
-
try {
|
|
522
|
-
await Bun.write(
|
|
523
|
-
this.recoveryLogPath,
|
|
524
|
-
JSON.stringify(logEntry) + '\n',
|
|
525
|
-
{ createPath: true }
|
|
526
|
-
);
|
|
527
|
-
} catch (error: any) {
|
|
528
|
-
console.warn('Failed to write recovery log:', error?.message || error);
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
}
|