@fleettools/server 0.1.0 → 0.2.0
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 +6 -2
- package/tsconfig.json +7 -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/agent-lifecycle.js +0 -148
- package/dist/agent-spawner.js +0 -460
- package/dist/agent-validation.js +0 -111
- package/dist/index.js +0 -255
- 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/dist/task-queue.js +0 -377
- package/dist/validation.js +0 -188
- 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,480 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Queue for FleetTools Coordination System
|
|
3
|
-
*
|
|
4
|
-
* Manages task queuing, assignment, and completion tracking
|
|
5
|
-
* Uses SQLite for persistence with tsk_ prefixed IDs
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import Database from 'bun:sqlite';
|
|
9
|
-
import { randomUUID } from 'node:crypto';
|
|
10
|
-
import path from 'node:path';
|
|
11
|
-
// Using local types to avoid import issues
|
|
12
|
-
export enum TaskStatus {
|
|
13
|
-
PENDING = 'pending',
|
|
14
|
-
ASSIGNED = 'assigned',
|
|
15
|
-
IN_PROGRESS = 'in_progress',
|
|
16
|
-
COMPLETED = 'completed',
|
|
17
|
-
FAILED = 'failed',
|
|
18
|
-
CANCELLED = 'cancelled'
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface Task {
|
|
22
|
-
id: string;
|
|
23
|
-
type: string;
|
|
24
|
-
title: string;
|
|
25
|
-
description: string;
|
|
26
|
-
status: TaskStatus;
|
|
27
|
-
priority: 'low' | 'medium' | 'high' | 'critical';
|
|
28
|
-
assignedTo?: string;
|
|
29
|
-
missionId?: string;
|
|
30
|
-
dependencies?: string[];
|
|
31
|
-
metadata: Record<string, any>;
|
|
32
|
-
createdAt: string;
|
|
33
|
-
updatedAt: string;
|
|
34
|
-
completedAt?: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface TaskQueueConfig {
|
|
38
|
-
dbPath?: string;
|
|
39
|
-
maxRetries?: number;
|
|
40
|
-
retryDelay?: number;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export class TaskQueue {
|
|
44
|
-
private db: Database;
|
|
45
|
-
private config: TaskQueueConfig;
|
|
46
|
-
|
|
47
|
-
constructor(config: TaskQueueConfig = {}) {
|
|
48
|
-
this.config = {
|
|
49
|
-
maxRetries: 3,
|
|
50
|
-
retryDelay: 5000,
|
|
51
|
-
dbPath: path.join(process.cwd(), '.flightline', 'tasks.db'),
|
|
52
|
-
...config
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
this.db = new Database(this.config.dbPath!);
|
|
56
|
-
this.initializeDatabase();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Initialize database schema
|
|
61
|
-
*/
|
|
62
|
-
private initializeDatabase(): void {
|
|
63
|
-
// Create tasks table
|
|
64
|
-
this.db.exec(`
|
|
65
|
-
CREATE TABLE IF NOT EXISTS tasks (
|
|
66
|
-
id TEXT PRIMARY KEY,
|
|
67
|
-
type TEXT NOT NULL,
|
|
68
|
-
title TEXT NOT NULL,
|
|
69
|
-
description TEXT,
|
|
70
|
-
status TEXT NOT NULL DEFAULT 'pending',
|
|
71
|
-
priority TEXT NOT NULL DEFAULT 'medium',
|
|
72
|
-
assigned_to TEXT,
|
|
73
|
-
mission_id TEXT,
|
|
74
|
-
dependencies TEXT, -- JSON array
|
|
75
|
-
metadata TEXT, -- JSON object
|
|
76
|
-
created_at TEXT NOT NULL,
|
|
77
|
-
updated_at TEXT NOT NULL,
|
|
78
|
-
completed_at TEXT,
|
|
79
|
-
retry_count INTEGER DEFAULT 0,
|
|
80
|
-
last_retry_at TEXT
|
|
81
|
-
)
|
|
82
|
-
`);
|
|
83
|
-
|
|
84
|
-
// Create indexes for performance
|
|
85
|
-
this.db.exec(`
|
|
86
|
-
CREATE INDEX IF NOT EXISTS idx_tasks_status ON tasks(status);
|
|
87
|
-
CREATE INDEX IF NOT EXISTS idx_tasks_priority ON tasks(priority);
|
|
88
|
-
CREATE INDEX IF NOT EXISTS idx_tasks_assigned_to ON tasks(assigned_to);
|
|
89
|
-
CREATE INDEX IF NOT EXISTS idx_tasks_mission_id ON tasks(mission_id);
|
|
90
|
-
CREATE INDEX IF NOT EXISTS idx_tasks_created_at ON tasks(created_at);
|
|
91
|
-
`);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Enqueue a new task
|
|
96
|
-
*/
|
|
97
|
-
async enqueue(task: Omit<Task, 'id' | 'createdAt' | 'updatedAt'>): Promise<string> {
|
|
98
|
-
const taskId = `tsk_${randomUUID()}`;
|
|
99
|
-
const now = new Date().toISOString();
|
|
100
|
-
|
|
101
|
-
try {
|
|
102
|
-
const stmt = this.db.prepare(`
|
|
103
|
-
INSERT INTO tasks (
|
|
104
|
-
id, type, title, description, status, priority,
|
|
105
|
-
assigned_to, mission_id, dependencies, metadata,
|
|
106
|
-
created_at, updated_at
|
|
107
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
108
|
-
`);
|
|
109
|
-
|
|
110
|
-
stmt.run(
|
|
111
|
-
taskId,
|
|
112
|
-
task.type,
|
|
113
|
-
task.title,
|
|
114
|
-
task.description,
|
|
115
|
-
task.status || TaskStatus.PENDING,
|
|
116
|
-
task.priority,
|
|
117
|
-
task.assignedTo || null,
|
|
118
|
-
task.missionId || null,
|
|
119
|
-
JSON.stringify(task.dependencies || []),
|
|
120
|
-
JSON.stringify(task.metadata || {}),
|
|
121
|
-
now,
|
|
122
|
-
now
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
console.log(`✓ Task enqueued: ${taskId} (${task.title})`);
|
|
126
|
-
return taskId;
|
|
127
|
-
} catch (error: any) {
|
|
128
|
-
console.error(`✗ Failed to enqueue task:`, error.message);
|
|
129
|
-
throw new Error(`Task enqueue failed: ${error.message}`);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Dequeue next available task for agent type
|
|
135
|
-
*/
|
|
136
|
-
async dequeue(agentType?: string, limit = 1): Promise<Task[]> {
|
|
137
|
-
try {
|
|
138
|
-
let whereClause = 'status = ?';
|
|
139
|
-
const params: any[] = [TaskStatus.PENDING];
|
|
140
|
-
|
|
141
|
-
if (agentType) {
|
|
142
|
-
whereClause += ' AND (type = ? OR type = ?)';
|
|
143
|
-
params.push(agentType, 'general'); // Allow general tasks
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
whereClause += ' ORDER BY priority DESC, created_at ASC LIMIT ?';
|
|
147
|
-
params.push(limit);
|
|
148
|
-
|
|
149
|
-
const stmt = this.db.prepare(`
|
|
150
|
-
SELECT * FROM tasks
|
|
151
|
-
WHERE ${whereClause}
|
|
152
|
-
`);
|
|
153
|
-
|
|
154
|
-
const rows = stmt.all(...params) as any[];
|
|
155
|
-
|
|
156
|
-
if (rows.length === 0) {
|
|
157
|
-
return [];
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Mark tasks as assigned
|
|
161
|
-
const taskIds = rows.map(row => row.id);
|
|
162
|
-
await this.markAsAssigned(taskIds);
|
|
163
|
-
|
|
164
|
-
// Convert rows to Task objects
|
|
165
|
-
const tasks: Task[] = rows.map(row => this.rowToTask(row));
|
|
166
|
-
|
|
167
|
-
console.log(`✓ Dequeued ${tasks.length} task(s)`);
|
|
168
|
-
return tasks;
|
|
169
|
-
} catch (error: any) {
|
|
170
|
-
console.error(`✗ Failed to dequeue tasks:`, error.message);
|
|
171
|
-
throw new Error(`Task dequeue failed: ${error.message}`);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Mark task as in progress
|
|
177
|
-
*/
|
|
178
|
-
async markAsInProgress(taskId: string): Promise<void> {
|
|
179
|
-
await this.updateTaskStatus(taskId, TaskStatus.IN_PROGRESS);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Complete a task
|
|
184
|
-
*/
|
|
185
|
-
async complete(taskId: string, result?: any): Promise<void> {
|
|
186
|
-
try {
|
|
187
|
-
const now = new Date().toISOString();
|
|
188
|
-
|
|
189
|
-
const stmt = this.db.prepare(`
|
|
190
|
-
UPDATE tasks
|
|
191
|
-
SET status = ?, updated_at = ?, completed_at = ?, metadata = ?
|
|
192
|
-
WHERE id = ?
|
|
193
|
-
`);
|
|
194
|
-
|
|
195
|
-
// Add result to metadata
|
|
196
|
-
const currentTask = await this.getTask(taskId);
|
|
197
|
-
const updatedMetadata = {
|
|
198
|
-
...currentTask?.metadata,
|
|
199
|
-
result: result || null
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
stmt.run(
|
|
203
|
-
TaskStatus.COMPLETED,
|
|
204
|
-
now,
|
|
205
|
-
now,
|
|
206
|
-
JSON.stringify(updatedMetadata),
|
|
207
|
-
taskId
|
|
208
|
-
);
|
|
209
|
-
|
|
210
|
-
console.log(`✓ Task completed: ${taskId}`);
|
|
211
|
-
} catch (error: any) {
|
|
212
|
-
await this.fail(taskId, `Completion failed: ${error.message}`);
|
|
213
|
-
throw new Error(`Task completion failed: ${error.message}`);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Mark task as failed
|
|
219
|
-
*/
|
|
220
|
-
async fail(taskId: string, error: string): Promise<void> {
|
|
221
|
-
try {
|
|
222
|
-
const now = new Date().toISOString();
|
|
223
|
-
|
|
224
|
-
const stmt = this.db.prepare(`
|
|
225
|
-
UPDATE tasks
|
|
226
|
-
SET status = ?, updated_at = ?, retry_count = retry_count + 1, last_retry_at = ?
|
|
227
|
-
WHERE id = ?
|
|
228
|
-
`);
|
|
229
|
-
|
|
230
|
-
stmt.run(
|
|
231
|
-
TaskStatus.FAILED,
|
|
232
|
-
now,
|
|
233
|
-
now,
|
|
234
|
-
taskId
|
|
235
|
-
);
|
|
236
|
-
|
|
237
|
-
console.log(`✗ Task failed: ${taskId} - ${error}`);
|
|
238
|
-
} catch (error: any) {
|
|
239
|
-
console.error(`✗ Failed to mark task as failed:`, error.message);
|
|
240
|
-
throw new Error(`Task failure marking failed: ${error.message}`);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Get task by ID
|
|
246
|
-
*/
|
|
247
|
-
async getTask(taskId: string): Promise<Task | null> {
|
|
248
|
-
try {
|
|
249
|
-
const stmt = this.db.prepare('SELECT * FROM tasks WHERE id = ?');
|
|
250
|
-
const row = stmt.get(taskId) as any;
|
|
251
|
-
|
|
252
|
-
return row ? this.rowToTask(row) : null;
|
|
253
|
-
} catch (error: any) {
|
|
254
|
-
console.error(`✗ Failed to get task:`, error.message);
|
|
255
|
-
return null;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Get tasks by status
|
|
261
|
-
*/
|
|
262
|
-
async getTasksByStatus(status: TaskStatus): Promise<Task[]> {
|
|
263
|
-
try {
|
|
264
|
-
const stmt = this.db.prepare('SELECT * FROM tasks WHERE status = ? ORDER BY created_at DESC');
|
|
265
|
-
const rows = stmt.all(status) as any[];
|
|
266
|
-
|
|
267
|
-
return rows.map(row => this.rowToTask(row));
|
|
268
|
-
} catch (error: any) {
|
|
269
|
-
console.error(`✗ Failed to get tasks by status:`, error.message);
|
|
270
|
-
return [];
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* Get tasks for mission
|
|
276
|
-
*/
|
|
277
|
-
async getTasksByMission(missionId: string): Promise<Task[]> {
|
|
278
|
-
try {
|
|
279
|
-
const stmt = this.db.prepare('SELECT * FROM tasks WHERE mission_id = ? ORDER BY priority DESC, created_at ASC');
|
|
280
|
-
const rows = stmt.all(missionId) as any[];
|
|
281
|
-
|
|
282
|
-
return rows.map(row => this.rowToTask(row));
|
|
283
|
-
} catch (error: any) {
|
|
284
|
-
console.error(`✗ Failed to get mission tasks:`, error.message);
|
|
285
|
-
return [];
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Get tasks assigned to agent
|
|
291
|
-
*/
|
|
292
|
-
async getTasksByAgent(agentId: string): Promise<Task[]> {
|
|
293
|
-
try {
|
|
294
|
-
const stmt = this.db.prepare('SELECT * FROM tasks WHERE assigned_to = ? ORDER BY created_at DESC');
|
|
295
|
-
const rows = stmt.all(agentId) as any[];
|
|
296
|
-
|
|
297
|
-
return rows.map(row => this.rowToTask(row));
|
|
298
|
-
} catch (error: any) {
|
|
299
|
-
console.error(`✗ Failed to get agent tasks:`, error.message);
|
|
300
|
-
return [];
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Retry failed tasks
|
|
306
|
-
*/
|
|
307
|
-
async retryFailedTasks(): Promise<number> {
|
|
308
|
-
try {
|
|
309
|
-
const stmt = this.db.prepare(`
|
|
310
|
-
SELECT * FROM tasks
|
|
311
|
-
WHERE status = ? AND retry_count < ?
|
|
312
|
-
ORDER BY priority DESC, created_at ASC
|
|
313
|
-
`);
|
|
314
|
-
|
|
315
|
-
const rows = stmt.all(TaskStatus.FAILED, this.config.maxRetries!) as any[];
|
|
316
|
-
|
|
317
|
-
let retriedCount = 0;
|
|
318
|
-
|
|
319
|
-
for (const row of rows) {
|
|
320
|
-
// Check dependencies
|
|
321
|
-
if (row.dependencies) {
|
|
322
|
-
const dependencies = JSON.parse(row.dependencies);
|
|
323
|
-
const pendingDeps = await this.checkDependencies(dependencies);
|
|
324
|
-
|
|
325
|
-
if (pendingDeps.length > 0) {
|
|
326
|
-
continue; // Skip if dependencies not met
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
await this.resetTask(row.id);
|
|
331
|
-
retriedCount++;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
if (retriedCount > 0) {
|
|
335
|
-
console.log(`✓ Retried ${retriedCount} failed tasks`);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
return retriedCount;
|
|
339
|
-
} catch (error: any) {
|
|
340
|
-
console.error(`✗ Failed to retry tasks:`, error.message);
|
|
341
|
-
return 0;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Get queue statistics
|
|
347
|
-
*/
|
|
348
|
-
async getStats(): Promise<{
|
|
349
|
-
total: number;
|
|
350
|
-
pending: number;
|
|
351
|
-
assigned: number;
|
|
352
|
-
inProgress: number;
|
|
353
|
-
completed: number;
|
|
354
|
-
failed: number;
|
|
355
|
-
}> {
|
|
356
|
-
try {
|
|
357
|
-
const stats = {
|
|
358
|
-
total: 0,
|
|
359
|
-
pending: 0,
|
|
360
|
-
assigned: 0,
|
|
361
|
-
inProgress: 0,
|
|
362
|
-
completed: 0,
|
|
363
|
-
failed: 0
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
const stmt = this.db.prepare('SELECT status, COUNT(*) as count FROM tasks GROUP BY status');
|
|
367
|
-
const rows = stmt.all() as any[];
|
|
368
|
-
|
|
369
|
-
rows.forEach(row => {
|
|
370
|
-
stats.total += row.count;
|
|
371
|
-
|
|
372
|
-
switch (row.status) {
|
|
373
|
-
case TaskStatus.PENDING:
|
|
374
|
-
stats.pending = row.count;
|
|
375
|
-
break;
|
|
376
|
-
case TaskStatus.ASSIGNED:
|
|
377
|
-
stats.assigned = row.count;
|
|
378
|
-
break;
|
|
379
|
-
case TaskStatus.IN_PROGRESS:
|
|
380
|
-
stats.inProgress = row.count;
|
|
381
|
-
break;
|
|
382
|
-
case TaskStatus.COMPLETED:
|
|
383
|
-
stats.completed = row.count;
|
|
384
|
-
break;
|
|
385
|
-
case TaskStatus.FAILED:
|
|
386
|
-
stats.failed = row.count;
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
return stats;
|
|
392
|
-
} catch (error: any) {
|
|
393
|
-
console.error(`✗ Failed to get stats:`, error.message);
|
|
394
|
-
return {
|
|
395
|
-
total: 0,
|
|
396
|
-
pending: 0,
|
|
397
|
-
assigned: 0,
|
|
398
|
-
inProgress: 0,
|
|
399
|
-
completed: 0,
|
|
400
|
-
failed: 0
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
// ========================================================================
|
|
406
|
-
// Private Helper Methods
|
|
407
|
-
// ========================================================================
|
|
408
|
-
|
|
409
|
-
private async markAsAssigned(taskIds: string[]): Promise<void> {
|
|
410
|
-
if (taskIds.length === 0) return;
|
|
411
|
-
|
|
412
|
-
const placeholders = taskIds.map(() => '?').join(',');
|
|
413
|
-
const stmt = this.db.prepare(`
|
|
414
|
-
UPDATE tasks
|
|
415
|
-
SET status = ?, updated_at = ?
|
|
416
|
-
WHERE id IN (${placeholders})
|
|
417
|
-
`);
|
|
418
|
-
|
|
419
|
-
const now = new Date().toISOString();
|
|
420
|
-
stmt.run(TaskStatus.ASSIGNED, now, ...taskIds);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
private async updateTaskStatus(taskId: string, status: TaskStatus): Promise<void> {
|
|
424
|
-
const stmt = this.db.prepare(`
|
|
425
|
-
UPDATE tasks
|
|
426
|
-
SET status = ?, updated_at = ?
|
|
427
|
-
WHERE id = ?
|
|
428
|
-
`);
|
|
429
|
-
|
|
430
|
-
stmt.run(status, new Date().toISOString(), taskId);
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
private async resetTask(taskId: string): Promise<void> {
|
|
434
|
-
const stmt = this.db.prepare(`
|
|
435
|
-
UPDATE tasks
|
|
436
|
-
SET status = ?, updated_at = ?, completed_at = NULL
|
|
437
|
-
WHERE id = ?
|
|
438
|
-
`);
|
|
439
|
-
|
|
440
|
-
stmt.run(TaskStatus.PENDING, new Date().toISOString(), taskId);
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
private async checkDependencies(dependencies: string[]): Promise<string[]> {
|
|
444
|
-
if (dependencies.length === 0) return [];
|
|
445
|
-
|
|
446
|
-
const placeholders = dependencies.map(() => '?').join(',');
|
|
447
|
-
const stmt = this.db.prepare(`
|
|
448
|
-
SELECT id FROM tasks
|
|
449
|
-
WHERE id IN (${placeholders}) AND status != ?
|
|
450
|
-
`);
|
|
451
|
-
|
|
452
|
-
const incompleteRows = stmt.all(...dependencies, TaskStatus.COMPLETED) as any[];
|
|
453
|
-
return incompleteRows.map((row: any) => row.id);
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
private rowToTask(row: any): Task {
|
|
457
|
-
return {
|
|
458
|
-
id: row.id,
|
|
459
|
-
type: row.type,
|
|
460
|
-
title: row.title,
|
|
461
|
-
description: row.description || '',
|
|
462
|
-
status: row.status,
|
|
463
|
-
priority: row.priority,
|
|
464
|
-
assignedTo: row.assigned_to,
|
|
465
|
-
missionId: row.mission_id,
|
|
466
|
-
dependencies: row.dependencies ? JSON.parse(row.dependencies) : [],
|
|
467
|
-
metadata: row.metadata ? JSON.parse(row.metadata) : {},
|
|
468
|
-
createdAt: row.created_at,
|
|
469
|
-
updatedAt: row.updated_at,
|
|
470
|
-
completedAt: row.completed_at
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
/**
|
|
475
|
-
* Close database connection
|
|
476
|
-
*/
|
|
477
|
-
close(): void {
|
|
478
|
-
this.db.close();
|
|
479
|
-
}
|
|
480
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Decomposition API Routes
|
|
3
|
-
*
|
|
4
|
-
* POST /api/v1/tasks/decompose - Decompose mission into assignable tasks
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { TaskDecomposer } from './task-decomposer.js';
|
|
8
|
-
|
|
9
|
-
const decomposer = new TaskDecomposer();
|
|
10
|
-
|
|
11
|
-
export function registerTaskDecompositionRoutes(
|
|
12
|
-
router: any,
|
|
13
|
-
headers: Record<string, string>
|
|
14
|
-
): void {
|
|
15
|
-
router.post('/api/v1/tasks/decompose', async (req: Request) => {
|
|
16
|
-
try {
|
|
17
|
-
const body = await req.json() as {
|
|
18
|
-
title?: string;
|
|
19
|
-
description?: string;
|
|
20
|
-
type?: string;
|
|
21
|
-
metadata?: Record<string, any>;
|
|
22
|
-
};
|
|
23
|
-
const { title, description, type, metadata } = body;
|
|
24
|
-
|
|
25
|
-
if (!title) {
|
|
26
|
-
return new Response(JSON.stringify({
|
|
27
|
-
error: 'Mission title is required'
|
|
28
|
-
}), {
|
|
29
|
-
status: 400,
|
|
30
|
-
headers: { ...headers, 'Content-Type': 'application/json' }
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const tasks = decomposer.decomposeMission({
|
|
35
|
-
title,
|
|
36
|
-
description: description || '',
|
|
37
|
-
type,
|
|
38
|
-
metadata
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const tasksWithDuration = tasks.map(task => {
|
|
42
|
-
const complexity = decomposer.calculateComplexity(task);
|
|
43
|
-
const estimatedDuration = decomposer.estimateTaskDuration(complexity);
|
|
44
|
-
return {
|
|
45
|
-
...task,
|
|
46
|
-
estimatedDurationMinutes: estimatedDuration
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
return new Response(JSON.stringify({
|
|
51
|
-
success: true,
|
|
52
|
-
data: {
|
|
53
|
-
mission: { title, description, type },
|
|
54
|
-
tasks: tasksWithDuration,
|
|
55
|
-
totalTasks: tasksWithDuration.length,
|
|
56
|
-
totalEstimatedMinutes: tasksWithDuration.reduce((sum, task) => sum + (task.estimatedDurationMinutes || 0), 0)
|
|
57
|
-
}
|
|
58
|
-
}), {
|
|
59
|
-
headers: { ...headers, 'Content-Type': 'application/json' }
|
|
60
|
-
});
|
|
61
|
-
} catch (error: any) {
|
|
62
|
-
console.error('Task decomposition error:', error);
|
|
63
|
-
return new Response(JSON.stringify({
|
|
64
|
-
error: 'Failed to decompose task',
|
|
65
|
-
message: error?.message || 'Unknown error'
|
|
66
|
-
}), {
|
|
67
|
-
status: 500,
|
|
68
|
-
headers: { ...headers, 'Content-Type': 'application/json' }
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
package/src/flightline/ctk.ts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
import crypto from 'crypto';
|
|
5
|
-
|
|
6
|
-
const FLIGHTLINE_DIR = path.join(process.cwd(), '.flightline');
|
|
7
|
-
const CTK_DIR = path.join(FLIGHTLINE_DIR, 'ctk');
|
|
8
|
-
|
|
9
|
-
function ensureDirectory() {
|
|
10
|
-
if (!fs.existsSync(CTK_DIR)) {
|
|
11
|
-
fs.mkdirSync(CTK_DIR, { recursive: true });
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function checksumFile(filePath: string) {
|
|
16
|
-
try {
|
|
17
|
-
const content = fs.readFileSync(filePath);
|
|
18
|
-
return crypto.createHash('sha256').update(content).digest('hex');
|
|
19
|
-
} catch (error) {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function registerCtkRoutes(router: any, headers: Record<string, string>) {
|
|
25
|
-
ensureDirectory();
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
router.get('/api/v1/ctk/reservations', async (req: Request) => {
|
|
29
|
-
try {
|
|
30
|
-
const files = fs.readdirSync(CTK_DIR);
|
|
31
|
-
const reservations: any[] = [];
|
|
32
|
-
|
|
33
|
-
for (const file of files) {
|
|
34
|
-
if (file.endsWith('.json')) {
|
|
35
|
-
const content = fs.readFileSync(path.join(CTK_DIR, file), 'utf-8');
|
|
36
|
-
const reservation = JSON.parse(content) as any;
|
|
37
|
-
reservations.push(reservation);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return new Response(JSON.stringify({ reservations }), {
|
|
42
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
43
|
-
});
|
|
44
|
-
} catch (error) {
|
|
45
|
-
console.error('Error listing CTK reservations:', error);
|
|
46
|
-
return new Response(JSON.stringify({ error: 'Failed to list reservations' }), {
|
|
47
|
-
status: 500,
|
|
48
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
router.post('/api/v1/ctk/reserve', async (req: Request) => {
|
|
55
|
-
try {
|
|
56
|
-
const body = await req.json() as { file?: string; specialist_id?: string; purpose?: string };
|
|
57
|
-
const { file, specialist_id, purpose = 'edit' } = body;
|
|
58
|
-
|
|
59
|
-
if (!file || !specialist_id) {
|
|
60
|
-
return new Response(JSON.stringify({ error: 'file and specialist_id are required' }), {
|
|
61
|
-
status: 400,
|
|
62
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const reservation = {
|
|
67
|
-
id: crypto.randomUUID(),
|
|
68
|
-
file,
|
|
69
|
-
reserved_by: specialist_id,
|
|
70
|
-
reserved_at: new Date().toISOString(),
|
|
71
|
-
released_at: null,
|
|
72
|
-
purpose,
|
|
73
|
-
checksum: checksumFile(file),
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const reservationPath = path.join(CTK_DIR, `${reservation.id}.json`);
|
|
77
|
-
fs.writeFileSync(reservationPath, JSON.stringify(reservation, null, 2));
|
|
78
|
-
|
|
79
|
-
console.log(`Reserved file ${file} for specialist ${specialist_id}`);
|
|
80
|
-
return new Response(JSON.stringify({ reservation }), {
|
|
81
|
-
status: 201,
|
|
82
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
83
|
-
});
|
|
84
|
-
} catch (error) {
|
|
85
|
-
console.error('Error creating reservation:', error);
|
|
86
|
-
return new Response(JSON.stringify({ error: 'Failed to create reservation' }), {
|
|
87
|
-
status: 500,
|
|
88
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
router.post('/api/v1/ctk/release', async (req: Request) => {
|
|
95
|
-
try {
|
|
96
|
-
const body = await req.json() as { reservation_id?: string };
|
|
97
|
-
const { reservation_id } = body;
|
|
98
|
-
|
|
99
|
-
if (!reservation_id) {
|
|
100
|
-
return new Response(JSON.stringify({ error: 'reservation_id is required' }), {
|
|
101
|
-
status: 400,
|
|
102
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const reservationPath = path.join(CTK_DIR, `${reservation_id}.json`);
|
|
107
|
-
if (!fs.existsSync(reservationPath)) {
|
|
108
|
-
return new Response(JSON.stringify({ error: 'Reservation not found' }), {
|
|
109
|
-
status: 404,
|
|
110
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const reservation = JSON.parse(fs.readFileSync(reservationPath, 'utf-8'));
|
|
115
|
-
reservation.released_at = new Date().toISOString();
|
|
116
|
-
|
|
117
|
-
fs.writeFileSync(reservationPath, JSON.stringify(reservation, null, 2));
|
|
118
|
-
|
|
119
|
-
console.log(`Released reservation ${reservation_id}`);
|
|
120
|
-
return new Response(JSON.stringify({ reservation }), {
|
|
121
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
122
|
-
});
|
|
123
|
-
} catch (error) {
|
|
124
|
-
console.error('Error releasing reservation:', error);
|
|
125
|
-
return new Response(JSON.stringify({ error: 'Failed to release reservation' }), {
|
|
126
|
-
status: 500,
|
|
127
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|