@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,85 +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 TECH_ORDERS_DIR = path.join(FLIGHTLINE_DIR, 'tech-orders');
|
|
8
|
-
|
|
9
|
-
function ensureDirectory() {
|
|
10
|
-
if (!fs.existsSync(TECH_ORDERS_DIR)) {
|
|
11
|
-
fs.mkdirSync(TECH_ORDERS_DIR, { recursive: true });
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function registerTechOrdersRoutes(router: any, headers: Record<string, string>) {
|
|
16
|
-
ensureDirectory();
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
router.get('/api/v1/tech-orders', async (req: Request) => {
|
|
20
|
-
try {
|
|
21
|
-
const files = fs.readdirSync(TECH_ORDERS_DIR);
|
|
22
|
-
const techOrders: any[] = [];
|
|
23
|
-
|
|
24
|
-
for (const file of files) {
|
|
25
|
-
if (file.endsWith('.json')) {
|
|
26
|
-
const content = fs.readFileSync(path.join(TECH_ORDERS_DIR, file), 'utf-8');
|
|
27
|
-
const techOrder = JSON.parse(content);
|
|
28
|
-
techOrders.push(techOrder);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return new Response(JSON.stringify({ tech_orders: techOrders }), {
|
|
33
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
34
|
-
});
|
|
35
|
-
} catch (error) {
|
|
36
|
-
console.error('Error listing tech orders:', error);
|
|
37
|
-
return new Response(JSON.stringify({ error: 'Failed to list tech orders' }), {
|
|
38
|
-
status: 500,
|
|
39
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
router.post('/api/v1/tech-orders', async (req: Request) => {
|
|
46
|
-
try {
|
|
47
|
-
const body = await req.json() as { name?: string; pattern?: string; context?: any; usage_count?: number };
|
|
48
|
-
const { name, pattern, context, usage_count = 0 } = body;
|
|
49
|
-
|
|
50
|
-
if (!name || !pattern) {
|
|
51
|
-
return new Response(JSON.stringify({ error: 'name and pattern are required' }), {
|
|
52
|
-
status: 400,
|
|
53
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const techOrder = {
|
|
58
|
-
id: 'to_' + crypto.randomUUID(),
|
|
59
|
-
name,
|
|
60
|
-
pattern,
|
|
61
|
-
context,
|
|
62
|
-
usage_count,
|
|
63
|
-
success_rate: 0,
|
|
64
|
-
anti_pattern: false,
|
|
65
|
-
created_at: new Date().toISOString(),
|
|
66
|
-
last_used: null,
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const techOrderPath = path.join(TECH_ORDERS_DIR, `${techOrder.id}.json`);
|
|
70
|
-
fs.writeFileSync(techOrderPath, JSON.stringify(techOrder, null, 2));
|
|
71
|
-
|
|
72
|
-
console.log(`Created tech order: ${name}`);
|
|
73
|
-
return new Response(JSON.stringify({ tech_order: techOrder }), {
|
|
74
|
-
status: 201,
|
|
75
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
76
|
-
});
|
|
77
|
-
} catch (error) {
|
|
78
|
-
console.error('Error creating tech order:', error);
|
|
79
|
-
return new Response(JSON.stringify({ error: 'Failed to create tech order' }), {
|
|
80
|
-
status: 500,
|
|
81
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
@@ -1,202 +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 WORK_ORDERS_DIR = path.join(FLIGHTLINE_DIR, 'work-orders');
|
|
8
|
-
|
|
9
|
-
function ensureDirectories() {
|
|
10
|
-
if (!fs.existsSync(FLIGHTLINE_DIR)) {
|
|
11
|
-
fs.mkdirSync(FLIGHTLINE_DIR, { recursive: true });
|
|
12
|
-
}
|
|
13
|
-
if (!fs.existsSync(WORK_ORDERS_DIR)) {
|
|
14
|
-
fs.mkdirSync(WORK_ORDERS_DIR, { recursive: true });
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function generateId() {
|
|
19
|
-
return 'wo_' + crypto.randomUUID();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function getWorkOrderPath(orderId: string) {
|
|
23
|
-
return path.join(WORK_ORDERS_DIR, orderId, 'manifest.json');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function registerWorkOrdersRoutes(router: any, headers: Record<string, string>) {
|
|
27
|
-
ensureDirectories();
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
router.get('/api/v1/work-orders', async (req: Request) => {
|
|
31
|
-
try {
|
|
32
|
-
if (!fs.existsSync(WORK_ORDERS_DIR)) {
|
|
33
|
-
return new Response(JSON.stringify({ work_orders: [] }), {
|
|
34
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const directories = fs.readdirSync(WORK_ORDERS_DIR);
|
|
39
|
-
const workOrders: any[] = [];
|
|
40
|
-
|
|
41
|
-
for (const dirName of directories) {
|
|
42
|
-
const manifestPath = path.join(WORK_ORDERS_DIR, dirName, 'manifest.json');
|
|
43
|
-
if (!fs.existsSync(manifestPath)) continue;
|
|
44
|
-
|
|
45
|
-
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
46
|
-
workOrders.push(manifest);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return new Response(JSON.stringify({ work_orders: workOrders }), {
|
|
50
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
51
|
-
});
|
|
52
|
-
} catch (error) {
|
|
53
|
-
console.error('Error listing work orders:', error);
|
|
54
|
-
return new Response(JSON.stringify({ error: 'Failed to list work orders' }), {
|
|
55
|
-
status: 500,
|
|
56
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
router.post('/api/v1/work-orders', async (req: Request) => {
|
|
63
|
-
try {
|
|
64
|
-
const body = await req.json() as { title?: string; description?: string; priority?: string; assigned_to?: string[] };
|
|
65
|
-
const { title, description, priority = 'medium', assigned_to = [] } = body;
|
|
66
|
-
|
|
67
|
-
if (!title) {
|
|
68
|
-
return new Response(JSON.stringify({ error: 'title is required' }), {
|
|
69
|
-
status: 400,
|
|
70
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const orderId = generateId();
|
|
75
|
-
const now = new Date().toISOString();
|
|
76
|
-
|
|
77
|
-
const manifest = {
|
|
78
|
-
id: orderId,
|
|
79
|
-
title,
|
|
80
|
-
description: description || '',
|
|
81
|
-
status: 'pending',
|
|
82
|
-
priority,
|
|
83
|
-
created_at: now,
|
|
84
|
-
updated_at: now,
|
|
85
|
-
assigned_to: assigned_to,
|
|
86
|
-
cells: [],
|
|
87
|
-
tech_orders: [],
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const orderDir = path.join(WORK_ORDERS_DIR, orderId);
|
|
91
|
-
const manifestPath = path.join(orderDir, 'manifest.json');
|
|
92
|
-
|
|
93
|
-
fs.mkdirSync(orderDir, { recursive: true });
|
|
94
|
-
fs.mkdirSync(path.join(orderDir, 'cells'), { recursive: true });
|
|
95
|
-
fs.mkdirSync(path.join(orderDir, 'events'), { recursive: true });
|
|
96
|
-
fs.mkdirSync(path.join(orderDir, 'artifacts'), { recursive: true });
|
|
97
|
-
|
|
98
|
-
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
99
|
-
|
|
100
|
-
console.log(`Created work order: ${orderId} - ${title}`);
|
|
101
|
-
|
|
102
|
-
return new Response(JSON.stringify({ work_order: manifest }), {
|
|
103
|
-
status: 201,
|
|
104
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
105
|
-
});
|
|
106
|
-
} catch (error) {
|
|
107
|
-
console.error('Error creating work order:', error);
|
|
108
|
-
return new Response(JSON.stringify({ error: 'Failed to create work order' }), {
|
|
109
|
-
status: 500,
|
|
110
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
router.get('/api/v1/work-orders/:id', async (req: Request, params: { id: string }) => {
|
|
117
|
-
try {
|
|
118
|
-
const manifestPath = getWorkOrderPath(params.id);
|
|
119
|
-
if (!fs.existsSync(manifestPath)) {
|
|
120
|
-
return new Response(JSON.stringify({ error: 'Work order not found' }), {
|
|
121
|
-
status: 404,
|
|
122
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
127
|
-
return new Response(JSON.stringify({ work_order: manifest }), {
|
|
128
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
129
|
-
});
|
|
130
|
-
} catch (error) {
|
|
131
|
-
console.error('Error getting work order:', error);
|
|
132
|
-
return new Response(JSON.stringify({ error: 'Failed to get work order' }), {
|
|
133
|
-
status: 500,
|
|
134
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
router.patch('/api/v1/work-orders/:id', async (req: Request, params: { id: string }) => {
|
|
141
|
-
try {
|
|
142
|
-
const body = await req.json() as { title?: string; description?: string; status?: string; priority?: string; assigned_to?: string[] };
|
|
143
|
-
const manifestPath = getWorkOrderPath(params.id);
|
|
144
|
-
if (!fs.existsSync(manifestPath)) {
|
|
145
|
-
return new Response(JSON.stringify({ error: 'Work order not found' }), {
|
|
146
|
-
status: 404,
|
|
147
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
152
|
-
|
|
153
|
-
if (body.title) manifest.title = body.title;
|
|
154
|
-
if (body.description !== undefined) manifest.description = body.description;
|
|
155
|
-
if (body.status) manifest.status = body.status;
|
|
156
|
-
if (body.priority) manifest.priority = body.priority;
|
|
157
|
-
if (body.assigned_to) manifest.assigned_to = body.assigned_to;
|
|
158
|
-
|
|
159
|
-
manifest.updated_at = new Date().toISOString();
|
|
160
|
-
|
|
161
|
-
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
162
|
-
|
|
163
|
-
console.log(`Updated work order: ${params.id}`);
|
|
164
|
-
return new Response(JSON.stringify({ work_order: manifest }), {
|
|
165
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
166
|
-
});
|
|
167
|
-
} catch (error) {
|
|
168
|
-
console.error('Error updating work order:', error);
|
|
169
|
-
return new Response(JSON.stringify({ error: 'Failed to update work order' }), {
|
|
170
|
-
status: 500,
|
|
171
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
router.delete('/api/v1/work-orders/:id', async (req: Request, params: { id: string }) => {
|
|
178
|
-
try {
|
|
179
|
-
const orderDir = path.join(WORK_ORDERS_DIR, params.id);
|
|
180
|
-
if (!fs.existsSync(orderDir)) {
|
|
181
|
-
return new Response(JSON.stringify({ error: 'Work order not found' }), {
|
|
182
|
-
status: 404,
|
|
183
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
fs.rmSync(orderDir, { recursive: true, force: true });
|
|
188
|
-
|
|
189
|
-
console.log(`Deleted work order: ${params.id}`);
|
|
190
|
-
return new Response(null, {
|
|
191
|
-
status: 204,
|
|
192
|
-
headers: { ...headers },
|
|
193
|
-
});
|
|
194
|
-
} catch (error) {
|
|
195
|
-
console.error('Error deleting work order:', error);
|
|
196
|
-
return new Response(JSON.stringify({ error: 'Failed to delete work order' }), {
|
|
197
|
-
status: 500,
|
|
198
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { closeDatabase, initializeDatabase } from '../../../squawk/src/db/index.js';
|
|
4
|
-
import { registerWorkOrdersRoutes } from './flightline/work-orders.js';
|
|
5
|
-
import { registerCtkRoutes } from './flightline/ctk.js';
|
|
6
|
-
import { registerTechOrdersRoutes } from './flightline/tech-orders.js';
|
|
7
|
-
import { registerMailboxRoutes } from './squawk/mailbox.js';
|
|
8
|
-
import { registerCursorRoutes } from './squawk/cursor.js';
|
|
9
|
-
import { registerLockRoutes } from './squawk/lock.js';
|
|
10
|
-
import { registerCoordinatorRoutes } from './squawk/coordinator.js';
|
|
11
|
-
|
|
12
|
-
const headers: Record<string, string> = {
|
|
13
|
-
'Access-Control-Allow-Origin': '*',
|
|
14
|
-
'Access-Control-Allow-Methods': 'GET, POST, PUT, PATCH, DELETE, OPTIONS',
|
|
15
|
-
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const routes: Array<{
|
|
19
|
-
method: string;
|
|
20
|
-
pathPattern: string;
|
|
21
|
-
regex: RegExp;
|
|
22
|
-
paramNames: string[];
|
|
23
|
-
handler: (req: Request, params?: any) => Promise<Response>;
|
|
24
|
-
}> = [];
|
|
25
|
-
|
|
26
|
-
function parsePathPattern(pathPattern: string): { regex: RegExp; paramNames: string[] } {
|
|
27
|
-
const paramNames: string[] = [];
|
|
28
|
-
const regexPattern = pathPattern.replace(/:([^/]+)/g, (_, paramName) => {
|
|
29
|
-
paramNames.push(paramName);
|
|
30
|
-
return '([^/]+)';
|
|
31
|
-
});
|
|
32
|
-
return {
|
|
33
|
-
regex: new RegExp(`^${regexPattern}$`),
|
|
34
|
-
paramNames,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function createRouter() {
|
|
39
|
-
const addRoute = (method: string, path: string, handler: any, paramNames: string[], regex: RegExp) => {
|
|
40
|
-
routes.push({ method, pathPattern: path, regex, paramNames, handler });
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
get: (path: string, handler: any) => {
|
|
45
|
-
const { regex, paramNames } = parsePathPattern(path);
|
|
46
|
-
if (path.includes(':')) {
|
|
47
|
-
addRoute('GET', path, handler, paramNames, regex);
|
|
48
|
-
} else {
|
|
49
|
-
addRoute('GET', path, handler, [], regex);
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
post: (path: string, handler: any) => {
|
|
53
|
-
const { regex, paramNames } = parsePathPattern(path);
|
|
54
|
-
if (path.includes(':')) {
|
|
55
|
-
addRoute('POST', path, handler, paramNames, regex);
|
|
56
|
-
} else {
|
|
57
|
-
addRoute('POST', path, handler, [], regex);
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
patch: (path: string, handler: any) => {
|
|
61
|
-
const { regex, paramNames } = parsePathPattern(path);
|
|
62
|
-
if (path.includes(':')) {
|
|
63
|
-
addRoute('PATCH', path, handler, paramNames, regex);
|
|
64
|
-
} else {
|
|
65
|
-
addRoute('PATCH', path, handler, [], regex);
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
delete: (path: string, handler: any) => {
|
|
69
|
-
const { regex, paramNames } = parsePathPattern(path);
|
|
70
|
-
if (path.includes(':')) {
|
|
71
|
-
addRoute('DELETE', path, handler, paramNames, regex);
|
|
72
|
-
} else {
|
|
73
|
-
addRoute('DELETE', path, handler, [], regex);
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function registerRoutes() {
|
|
80
|
-
registerWorkOrdersRoutes(createRouter(), headers);
|
|
81
|
-
registerCtkRoutes(createRouter(), headers);
|
|
82
|
-
registerTechOrdersRoutes(createRouter(), headers);
|
|
83
|
-
registerMailboxRoutes(createRouter(), headers);
|
|
84
|
-
registerCursorRoutes(createRouter(), headers);
|
|
85
|
-
registerLockRoutes(createRouter(), headers);
|
|
86
|
-
registerCoordinatorRoutes(createRouter(), headers);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
async function startServer() {
|
|
90
|
-
try {
|
|
91
|
-
await initializeDatabase();
|
|
92
|
-
console.log('Squawk database initialized');
|
|
93
|
-
} catch (error) {
|
|
94
|
-
console.error('Failed to initialize database:', error);
|
|
95
|
-
process.exit(1);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
registerRoutes();
|
|
99
|
-
|
|
100
|
-
const server = Bun.serve({
|
|
101
|
-
port: parseInt(process.env.PORT || '3001', 10),
|
|
102
|
-
async fetch(request) {
|
|
103
|
-
const url = new URL(request.url);
|
|
104
|
-
const path = url.pathname;
|
|
105
|
-
const method = request.method;
|
|
106
|
-
|
|
107
|
-
if (method === 'OPTIONS') {
|
|
108
|
-
return new Response(null, { headers });
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (path === '/health') {
|
|
112
|
-
return new Response(JSON.stringify({
|
|
113
|
-
status: 'healthy',
|
|
114
|
-
service: 'fleettools-consolidated',
|
|
115
|
-
timestamp: new Date().toISOString(),
|
|
116
|
-
version: '1.0.0',
|
|
117
|
-
}), {
|
|
118
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
for (const route of routes) {
|
|
123
|
-
if (route.method !== method) continue;
|
|
124
|
-
const match = path.match(route.regex);
|
|
125
|
-
if (match) {
|
|
126
|
-
try {
|
|
127
|
-
const params: any = {};
|
|
128
|
-
route.paramNames.forEach((name, i) => {
|
|
129
|
-
params[name] = match[i + 1];
|
|
130
|
-
});
|
|
131
|
-
return await route.handler(request, params);
|
|
132
|
-
} catch (error) {
|
|
133
|
-
console.error('Route handler error:', error);
|
|
134
|
-
return new Response(JSON.stringify({
|
|
135
|
-
error: 'Internal server error',
|
|
136
|
-
message: error instanceof Error ? error.message : 'Unknown error',
|
|
137
|
-
}), {
|
|
138
|
-
status: 500,
|
|
139
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// 404
|
|
146
|
-
return new Response(JSON.stringify({
|
|
147
|
-
error: 'Not found',
|
|
148
|
-
path,
|
|
149
|
-
method,
|
|
150
|
-
}), {
|
|
151
|
-
status: 404,
|
|
152
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
153
|
-
});
|
|
154
|
-
},
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
setInterval(async () => {
|
|
158
|
-
try {
|
|
159
|
-
const { lockOps } = await import('../../../squawk/src/db/index.js');
|
|
160
|
-
const released = await lockOps.releaseExpired();
|
|
161
|
-
if (released > 0) {
|
|
162
|
-
console.log(`Released ${released} expired locks`);
|
|
163
|
-
}
|
|
164
|
-
} catch (error) {
|
|
165
|
-
console.error('Error releasing expired locks:', error);
|
|
166
|
-
}
|
|
167
|
-
}, 30000); // Check every 30 seconds
|
|
168
|
-
|
|
169
|
-
console.log(`FleetTools Consolidated API server listening on port ${server.port}`);
|
|
170
|
-
console.log(`Health check: http://localhost:${server.port}/health`);
|
|
171
|
-
console.log('\nFlightline Endpoints:');
|
|
172
|
-
console.log(' GET /api/v1/work-orders - List work orders');
|
|
173
|
-
console.log(' POST /api/v1/work-orders - Create work order');
|
|
174
|
-
console.log(' GET /api/v1/work-orders/:id - Get work order');
|
|
175
|
-
console.log(' PATCH /api/v1/work-orders/:id - Update work order');
|
|
176
|
-
console.log(' DELETE /api/v1/work-orders/:id - Delete work order');
|
|
177
|
-
console.log(' GET /api/v1/ctk/reservations - List CTK reservations');
|
|
178
|
-
console.log(' POST /api/v1/ctk/reserve - Reserve file');
|
|
179
|
-
console.log(' POST /api/v1/ctk/release - Release reservation');
|
|
180
|
-
console.log(' GET /api/v1/tech-orders - List tech orders');
|
|
181
|
-
console.log(' POST /api/v1/tech-orders - Create tech order');
|
|
182
|
-
console.log('\nSquawk Endpoints:');
|
|
183
|
-
console.log(' POST /api/v1/mailbox/append - Append events to mailbox');
|
|
184
|
-
console.log(' GET /api/v1/mailbox/:streamId - Get mailbox contents');
|
|
185
|
-
console.log(' POST /api/v1/cursor/advance - Advance cursor position');
|
|
186
|
-
console.log(' GET /api/v1/cursor/:cursorId - Get cursor position');
|
|
187
|
-
console.log(' POST /api/v1/lock/acquire - Acquire file lock');
|
|
188
|
-
console.log(' POST /api/v1/lock/release - Release file lock');
|
|
189
|
-
console.log(' GET /api/v1/locks - List all active locks');
|
|
190
|
-
console.log(' GET /api/v1/coordinator/status - Get coordinator status');
|
|
191
|
-
|
|
192
|
-
process.on('SIGINT', () => {
|
|
193
|
-
console.log('\nShutting down...');
|
|
194
|
-
closeDatabase();
|
|
195
|
-
server.stop();
|
|
196
|
-
process.exit(0);
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
process.on('SIGTERM', () => {
|
|
200
|
-
console.log('\nShutting down...');
|
|
201
|
-
closeDatabase();
|
|
202
|
-
server.stop();
|
|
203
|
-
process.exit(0);
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
return server;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const server = await startServer();
|
|
210
|
-
|
|
211
|
-
export { server };
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Validation Schemas
|
|
3
|
-
*
|
|
4
|
-
* Zod validation schemas for agent coordination
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
|
|
9
|
-
// Agent Type Schema
|
|
10
|
-
export const AgentTypeSchema = z.enum([
|
|
11
|
-
'frontend',
|
|
12
|
-
'backend',
|
|
13
|
-
'testing',
|
|
14
|
-
'documentation',
|
|
15
|
-
'security',
|
|
16
|
-
'performance'
|
|
17
|
-
]);
|
|
18
|
-
|
|
19
|
-
// Agent Configuration Schema
|
|
20
|
-
export const AgentConfigSchema = z.object({
|
|
21
|
-
timeout: z.number().int().positive().optional(),
|
|
22
|
-
retries: z.number().int().min(0).max(10).optional(),
|
|
23
|
-
resources: z.object({
|
|
24
|
-
memory: z.string().optional(),
|
|
25
|
-
cpu: z.string().optional(),
|
|
26
|
-
}).optional(),
|
|
27
|
-
environment: z.record(z.string()).optional(),
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// Agent Spawn Request Schema
|
|
31
|
-
export const AgentSpawnRequestSchema = z.object({
|
|
32
|
-
type: AgentTypeSchema,
|
|
33
|
-
task: z.string().optional(),
|
|
34
|
-
metadata: z.record(z.unknown()).optional(),
|
|
35
|
-
config: AgentConfigSchema.optional(),
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// Agent Update Request Schema
|
|
39
|
-
export const AgentUpdateRequestSchema = z.object({
|
|
40
|
-
status: z.enum(['idle', 'busy', 'error']).optional(),
|
|
41
|
-
metadata: z.record(z.unknown()).optional(),
|
|
42
|
-
heartbeat: z.boolean().optional(),
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// Validation functions
|
|
46
|
-
export class AgentValidator {
|
|
47
|
-
/**
|
|
48
|
-
* Validate agent spawn request
|
|
49
|
-
*/
|
|
50
|
-
static validateSpawnRequest(data: unknown) {
|
|
51
|
-
const result = AgentSpawnRequestSchema.safeParse(data);
|
|
52
|
-
|
|
53
|
-
if (!result.success) {
|
|
54
|
-
throw new Error(`Invalid spawn request: ${result.error.message}`);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return result.data;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Validate agent configuration
|
|
62
|
-
*/
|
|
63
|
-
static validateConfig(data: unknown) {
|
|
64
|
-
const result = AgentConfigSchema.safeParse(data);
|
|
65
|
-
|
|
66
|
-
if (!result.success) {
|
|
67
|
-
throw new Error(`Invalid agent config: ${result.error.message}`);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return result.data;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Validate agent type
|
|
75
|
-
*/
|
|
76
|
-
static validateAgentType(type: string) {
|
|
77
|
-
const result = AgentTypeSchema.safeParse(type);
|
|
78
|
-
|
|
79
|
-
if (!result.success) {
|
|
80
|
-
throw new Error(`Invalid agent type: ${result.error.message}`);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return result.data;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Validate agent ID format
|
|
88
|
-
*/
|
|
89
|
-
static validateAgentId(id: string): boolean {
|
|
90
|
-
// Agent IDs should follow pattern: agt_<uuid>
|
|
91
|
-
const agentIdPattern = /^agt_[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
|
92
|
-
return agentIdPattern.test(id);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Check if agent type is suitable for task type
|
|
97
|
-
*/
|
|
98
|
-
static isAgentSuitableForTask(agentType: string, taskType: string): boolean {
|
|
99
|
-
const suitabilityMap: Record<string, string[]> = {
|
|
100
|
-
'frontend': ['ui', 'frontend', 'component', 'interface'],
|
|
101
|
-
'backend': ['api', 'backend', 'server', 'database'],
|
|
102
|
-
'testing': ['test', 'testing', 'qa', 'validation'],
|
|
103
|
-
'documentation': ['docs', 'documentation', 'readme', 'guide'],
|
|
104
|
-
'security': ['security', 'audit', 'vulnerability', 'scan'],
|
|
105
|
-
'performance': ['performance', 'optimization', 'benchmark', 'metrics']
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
const agentCapabilities = suitabilityMap[agentType] || [];
|
|
109
|
-
return agentCapabilities.includes(taskType.toLowerCase());
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Get recommended agents for task type
|
|
114
|
-
*/
|
|
115
|
-
static getRecommendedAgents(taskType: string): string[] {
|
|
116
|
-
const taskToAgents: Record<string, string[]> = {
|
|
117
|
-
'ui': ['frontend'],
|
|
118
|
-
'frontend': ['frontend'],
|
|
119
|
-
'api': ['backend'],
|
|
120
|
-
'backend': ['backend'],
|
|
121
|
-
'test': ['testing'],
|
|
122
|
-
'security': ['security'],
|
|
123
|
-
'docs': ['documentation'],
|
|
124
|
-
'performance': ['performance'],
|
|
125
|
-
'general': ['backend', 'frontend'] // General tasks can go to multiple types
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
return taskToAgents[taskType.toLowerCase()] || ['backend']; // Default to backend
|
|
129
|
-
}
|
|
130
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export class HttpError extends Error {
|
|
4
|
-
constructor(
|
|
5
|
-
public status: number,
|
|
6
|
-
message: string,
|
|
7
|
-
public details?: any
|
|
8
|
-
) {
|
|
9
|
-
super(message);
|
|
10
|
-
this.name = 'HttpError';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function errorHandler(error: unknown): Response {
|
|
15
|
-
const timestamp = new Date().toISOString();
|
|
16
|
-
|
|
17
|
-
if (error instanceof HttpError) {
|
|
18
|
-
console.error(`[${timestamp}] HTTP ${error.status}: ${error.message}`, error.details);
|
|
19
|
-
return new Response(JSON.stringify({
|
|
20
|
-
error: error.message,
|
|
21
|
-
details: error.details,
|
|
22
|
-
timestamp,
|
|
23
|
-
}), {
|
|
24
|
-
status: error.status,
|
|
25
|
-
headers: { 'Content-Type': 'application/json' },
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (error instanceof SyntaxError && 'status' in error) {
|
|
30
|
-
console.error(`[${timestamp}] JSON Parse Error:`, error.message);
|
|
31
|
-
return new Response(JSON.stringify({
|
|
32
|
-
error: 'Invalid JSON in request body',
|
|
33
|
-
timestamp,
|
|
34
|
-
}), {
|
|
35
|
-
status: 400,
|
|
36
|
-
headers: { 'Content-Type': 'application/json' },
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
console.error(`[${timestamp}] Internal Server Error:`, error);
|
|
41
|
-
return new Response(JSON.stringify({
|
|
42
|
-
error: 'Internal server error',
|
|
43
|
-
message: error instanceof Error ? error.message : 'Unknown error',
|
|
44
|
-
timestamp,
|
|
45
|
-
}), {
|
|
46
|
-
status: 500,
|
|
47
|
-
headers: { 'Content-Type': 'application/json' },
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function withErrorHandler(handler: (request: Request) => Promise<Response>): (request: Request) => Promise<Response> {
|
|
52
|
-
return async (request: Request) => {
|
|
53
|
-
try {
|
|
54
|
-
return await handler(request);
|
|
55
|
-
} catch (error) {
|
|
56
|
-
return errorHandler(error);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}
|