@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
package/src/middleware/logger.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export function requestLogger() {
|
|
4
|
-
return async (request: Request, next: (request: Request) => Promise<Response>): Promise<Response> => {
|
|
5
|
-
const start = Date.now();
|
|
6
|
-
const url = new URL(request.url);
|
|
7
|
-
const method = request.method;
|
|
8
|
-
|
|
9
|
-
console.log(`[${new Date().toISOString()}] ${method} ${url.pathname}`);
|
|
10
|
-
|
|
11
|
-
try {
|
|
12
|
-
const response = await next(request);
|
|
13
|
-
const duration = Date.now() - start;
|
|
14
|
-
const status = response.status;
|
|
15
|
-
|
|
16
|
-
console.log(`[${new Date().toISOString()}] ${method} ${url.pathname} ${status} ${duration}ms`);
|
|
17
|
-
|
|
18
|
-
return response;
|
|
19
|
-
} catch (error) {
|
|
20
|
-
const duration = Date.now() - start;
|
|
21
|
-
console.error(`[${new Date().toISOString()}] ${method} ${url.pathname} ERROR ${duration}ms:`, error);
|
|
22
|
-
throw error;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function logRequest(req: Request) {
|
|
28
|
-
const timestamp = new Date().toISOString();
|
|
29
|
-
const method = req.method;
|
|
30
|
-
const url = new URL(req.url);
|
|
31
|
-
console.log(`[${timestamp}] ${method} ${url.pathname}`);
|
|
32
|
-
return { timestamp, method, path: url.pathname };
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function logResponse(timestamp: string, method: string, path: string, status: number, duration: number) {
|
|
36
|
-
console.log(`[${new Date().toISOString()}] ${method} ${path} ${status} ${duration}ms`);
|
|
37
|
-
}
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Types and Validation Schemas
|
|
3
|
-
*
|
|
4
|
-
* Zod validation schemas for agent coordination
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
|
|
9
|
-
// Define AgentType locally to avoid import conflicts
|
|
10
|
-
export enum AgentType {
|
|
11
|
-
FRONTEND = 'frontend',
|
|
12
|
-
BACKEND = 'backend',
|
|
13
|
-
TESTING = 'testing',
|
|
14
|
-
DOCUMENTATION = 'documentation',
|
|
15
|
-
SECURITY = 'security',
|
|
16
|
-
PERFORMANCE = 'performance'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface AgentConfig {
|
|
20
|
-
timeout?: number;
|
|
21
|
-
retries?: number;
|
|
22
|
-
resources?: {
|
|
23
|
-
memory?: string;
|
|
24
|
-
cpu?: string;
|
|
25
|
-
};
|
|
26
|
-
environment?: Record<string, string>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface AgentSpawnRequest {
|
|
30
|
-
type: AgentType;
|
|
31
|
-
task?: string;
|
|
32
|
-
metadata?: Record<string, any>;
|
|
33
|
-
config?: AgentConfig;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Enhanced AgentType with validation
|
|
37
|
-
export const AgentTypeSchema = z.enum([
|
|
38
|
-
AgentType.FRONTEND,
|
|
39
|
-
AgentType.BACKEND,
|
|
40
|
-
AgentType.TESTING,
|
|
41
|
-
AgentType.DOCUMENTATION,
|
|
42
|
-
AgentType.SECURITY,
|
|
43
|
-
AgentType.PERFORMANCE
|
|
44
|
-
]);
|
|
45
|
-
|
|
46
|
-
// Agent Configuration Schema
|
|
47
|
-
export const AgentConfigSchema = z.object({
|
|
48
|
-
timeout: z.number().int().positive().optional(),
|
|
49
|
-
retries: z.number().int().min(0).max(10).optional(),
|
|
50
|
-
resources: z.object({
|
|
51
|
-
memory: z.string().optional(),
|
|
52
|
-
cpu: z.string().optional(),
|
|
53
|
-
}).optional(),
|
|
54
|
-
environment: z.record(z.string()).optional(),
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
// Agent Spawn Request Schema
|
|
58
|
-
export const AgentSpawnRequestSchema = z.object({
|
|
59
|
-
type: AgentTypeSchema,
|
|
60
|
-
task: z.string().optional(),
|
|
61
|
-
metadata: z.record(z.unknown()).optional(),
|
|
62
|
-
config: AgentConfigSchema.optional(),
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
// Agent Update Request Schema
|
|
66
|
-
export const AgentUpdateRequestSchema = z.object({
|
|
67
|
-
status: z.enum(['idle', 'busy', 'error']).optional(),
|
|
68
|
-
metadata: z.record(z.unknown()).optional(),
|
|
69
|
-
heartbeat: z.boolean().optional(),
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
// Agent Capability Schema
|
|
73
|
-
export const AgentCapabilitySchema = z.object({
|
|
74
|
-
id: z.string().uuid(),
|
|
75
|
-
agentId: z.string(),
|
|
76
|
-
capability: z.string(),
|
|
77
|
-
version: z.string(),
|
|
78
|
-
enabled: z.boolean(),
|
|
79
|
-
config: z.record(z.unknown()).optional(),
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// Agent Specialization Schema
|
|
83
|
-
export const AgentSpecializationSchema = z.object({
|
|
84
|
-
id: z.string().uuid(),
|
|
85
|
-
agentId: z.string(),
|
|
86
|
-
specialization: z.string(),
|
|
87
|
-
proficiency: z.number().min(0).max(1), // 0-1 scale
|
|
88
|
-
experience: z.number().int().min(0), // years
|
|
89
|
-
certifications: z.array(z.string()).optional(),
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// Task Assignment Schema
|
|
93
|
-
export const TaskAssignmentSchema = z.object({
|
|
94
|
-
taskId: z.string(),
|
|
95
|
-
agentId: z.string(),
|
|
96
|
-
assignedAt: z.string().datetime(),
|
|
97
|
-
deadline: z.string().datetime().optional(),
|
|
98
|
-
priority: z.enum(['low', 'medium', 'high', 'critical']),
|
|
99
|
-
requirements: z.object({
|
|
100
|
-
skills: z.array(z.string()).optional(),
|
|
101
|
-
tools: z.array(z.string()).optional(),
|
|
102
|
-
resources: z.record(z.string()).optional(),
|
|
103
|
-
}).optional(),
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// Agent Performance Schema
|
|
107
|
-
export const AgentPerformanceSchema = z.object({
|
|
108
|
-
agentId: z.string(),
|
|
109
|
-
taskId: z.string().optional(),
|
|
110
|
-
metrics: z.object({
|
|
111
|
-
executionTime: z.number().min(0),
|
|
112
|
-
accuracy: z.number().min(0).max(1),
|
|
113
|
-
efficiency: z.number().min(0).max(1),
|
|
114
|
-
resourceUsage: z.object({
|
|
115
|
-
memory: z.number().min(0),
|
|
116
|
-
cpu: z.number().min(0),
|
|
117
|
-
disk: z.number().min(0).optional(),
|
|
118
|
-
}),
|
|
119
|
-
}),
|
|
120
|
-
timestamp: z.string().datetime(),
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
// Validation functions
|
|
124
|
-
export class AgentValidator {
|
|
125
|
-
/**
|
|
126
|
-
* Validate agent spawn request
|
|
127
|
-
*/
|
|
128
|
-
static validateSpawnRequest(data: unknown): AgentSpawnRequest {
|
|
129
|
-
const result = AgentSpawnRequestSchema.safeParse(data);
|
|
130
|
-
|
|
131
|
-
if (!result.success) {
|
|
132
|
-
throw new Error(`Invalid spawn request: ${result.error.message}`);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return result.data;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Validate agent configuration
|
|
140
|
-
*/
|
|
141
|
-
static validateConfig(data: unknown): AgentConfig {
|
|
142
|
-
const result = AgentConfigSchema.safeParse(data);
|
|
143
|
-
|
|
144
|
-
if (!result.success) {
|
|
145
|
-
throw new Error(`Invalid agent config: ${result.error.message}`);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return result.data;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Validate agent type
|
|
153
|
-
*/
|
|
154
|
-
static validateAgentType(type: string): AgentType {
|
|
155
|
-
const result = AgentTypeSchema.safeParse(type);
|
|
156
|
-
|
|
157
|
-
if (!result.success) {
|
|
158
|
-
throw new Error(`Invalid agent type: ${result.error.message}`);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return result.data;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Validate agent ID format
|
|
166
|
-
*/
|
|
167
|
-
static validateAgentId(id: string): boolean {
|
|
168
|
-
// Agent IDs should follow pattern: agt_<uuid>
|
|
169
|
-
const agentIdPattern = /^agt_[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
|
170
|
-
return agentIdPattern.test(id);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Validate task assignment
|
|
175
|
-
*/
|
|
176
|
-
static validateTaskAssignment(data: unknown): z.infer<typeof TaskAssignmentSchema> {
|
|
177
|
-
const result = TaskAssignmentSchema.safeParse(data);
|
|
178
|
-
|
|
179
|
-
if (!result.success) {
|
|
180
|
-
throw new Error(`Invalid task assignment: ${result.error.message}`);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return result.data;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Check if agent type is suitable for task type
|
|
188
|
-
*/
|
|
189
|
-
static isAgentSuitableForTask(agentType: AgentType, taskType: string): boolean {
|
|
190
|
-
const suitabilityMap: Record<AgentType, string[]> = {
|
|
191
|
-
[AgentType.FRONTEND]: ['ui', 'frontend', 'component', 'interface'],
|
|
192
|
-
[AgentType.BACKEND]: ['api', 'backend', 'server', 'database'],
|
|
193
|
-
[AgentType.TESTING]: ['test', 'testing', 'qa', 'validation'],
|
|
194
|
-
[AgentType.DOCUMENTATION]: ['docs', 'documentation', 'readme', 'guide'],
|
|
195
|
-
[AgentType.SECURITY]: ['security', 'audit', 'vulnerability', 'scan'],
|
|
196
|
-
[AgentType.PERFORMANCE]: ['performance', 'optimization', 'benchmark', 'metrics']
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
const agentCapabilities = suitabilityMap[agentType] || [];
|
|
200
|
-
return agentCapabilities.some(capability =>
|
|
201
|
-
taskType.toLowerCase().includes(capability)
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Get recommended agents for task type
|
|
207
|
-
*/
|
|
208
|
-
static getRecommendedAgents(taskType: string): AgentType[] {
|
|
209
|
-
const taskToAgents: Record<string, AgentType[]> = {
|
|
210
|
-
'ui': [AgentType.FRONTEND],
|
|
211
|
-
'frontend': [AgentType.FRONTEND],
|
|
212
|
-
'api': [AgentType.BACKEND],
|
|
213
|
-
'backend': [AgentType.BACKEND],
|
|
214
|
-
'test': [AgentType.TESTING],
|
|
215
|
-
'security': [AgentType.SECURITY],
|
|
216
|
-
'docs': [AgentType.DOCUMENTATION],
|
|
217
|
-
'performance': [AgentType.PERFORMANCE],
|
|
218
|
-
'general': [AgentType.BACKEND, AgentType.FRONTEND] // General tasks can go to multiple types
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
return taskToAgents[taskType.toLowerCase()] || [AgentType.BACKEND]; // Default to backend
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// Common task categories for validation
|
|
226
|
-
const AgentCapabilities = [
|
|
227
|
-
'ui', 'frontend', 'component', 'interface',
|
|
228
|
-
'api', 'backend', 'server', 'database',
|
|
229
|
-
'test', 'testing', 'qa', 'validation',
|
|
230
|
-
'docs', 'documentation', 'readme', 'guide',
|
|
231
|
-
'security', 'audit', 'vulnerability', 'scan',
|
|
232
|
-
'performance', 'optimization', 'benchmark', 'metrics',
|
|
233
|
-
'general', 'utility', 'helper', 'tool'
|
|
234
|
-
];
|
|
235
|
-
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { mailboxOps, lockOps } from '../../../../squawk/src/db/index.js';
|
|
3
|
-
|
|
4
|
-
export function registerCoordinatorRoutes(router: any, headers: Record<string, string>) {
|
|
5
|
-
|
|
6
|
-
router.get('/api/v1/coordinator/status', async (req: Request) => {
|
|
7
|
-
try {
|
|
8
|
-
const mailboxes = await mailboxOps.getAll();
|
|
9
|
-
const locks = await lockOps.getAll();
|
|
10
|
-
|
|
11
|
-
return new Response(JSON.stringify({
|
|
12
|
-
active_mailboxes: mailboxes.length,
|
|
13
|
-
active_locks: locks.length,
|
|
14
|
-
timestamp: new Date().toISOString(),
|
|
15
|
-
}), {
|
|
16
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
17
|
-
});
|
|
18
|
-
} catch (error) {
|
|
19
|
-
console.error('Error getting coordinator status:', error);
|
|
20
|
-
return new Response(JSON.stringify({ error: 'Failed to get status' }), {
|
|
21
|
-
status: 500,
|
|
22
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
package/src/squawk/cursor.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { cursorOps, mailboxOps } from '../../../../squawk/src/db/index.js';
|
|
3
|
-
|
|
4
|
-
export function registerCursorRoutes(router: any, headers: Record<string, string>) {
|
|
5
|
-
|
|
6
|
-
router.post('/api/v1/cursor/advance', async (req: Request) => {
|
|
7
|
-
try {
|
|
8
|
-
const body = await req.json() as { stream_id?: string; position?: number };
|
|
9
|
-
const { stream_id, position } = body;
|
|
10
|
-
|
|
11
|
-
if (!stream_id || typeof position !== 'number') {
|
|
12
|
-
return new Response(JSON.stringify({ error: 'stream_id and position are required' }), {
|
|
13
|
-
status: 400,
|
|
14
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (!(await mailboxOps.exists(stream_id))) {
|
|
19
|
-
return new Response(JSON.stringify({ error: 'Mailbox not found' }), {
|
|
20
|
-
status: 404,
|
|
21
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const cursor = await cursorOps.upsert({ stream_id, position, updated_at: new Date().toISOString() });
|
|
26
|
-
return new Response(JSON.stringify({ cursor }), {
|
|
27
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
28
|
-
});
|
|
29
|
-
} catch (error) {
|
|
30
|
-
console.error('Error advancing cursor:', error);
|
|
31
|
-
return new Response(JSON.stringify({ error: 'Failed to advance cursor' }), {
|
|
32
|
-
status: 500,
|
|
33
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
router.get('/api/v1/cursor/:cursorId', async (req: Request, params: { cursorId: string }) => {
|
|
40
|
-
try {
|
|
41
|
-
const cursorId = params.cursorId;
|
|
42
|
-
const cursor = cursorOps.getById(cursorId);
|
|
43
|
-
|
|
44
|
-
if (!cursor) {
|
|
45
|
-
return new Response(JSON.stringify({ error: 'Cursor not found' }), {
|
|
46
|
-
status: 404,
|
|
47
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return new Response(JSON.stringify({ cursor }), {
|
|
52
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
53
|
-
});
|
|
54
|
-
} catch (error) {
|
|
55
|
-
console.error('Error getting cursor:', error);
|
|
56
|
-
return new Response(JSON.stringify({ error: 'Failed to get cursor' }), {
|
|
57
|
-
status: 500,
|
|
58
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
package/src/squawk/lock.ts
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { lockOps } from '../../../../squawk/src/db/index.js';
|
|
3
|
-
|
|
4
|
-
export function registerLockRoutes(router: any, headers: Record<string, string>) {
|
|
5
|
-
|
|
6
|
-
router.post('/api/v1/lock/acquire', async (req: Request) => {
|
|
7
|
-
try {
|
|
8
|
-
const body = await req.json() as { file?: string; specialist_id?: string; timeout_ms?: number };
|
|
9
|
-
const { file, specialist_id, timeout_ms = 30000 } = body;
|
|
10
|
-
|
|
11
|
-
if (!file || !specialist_id) {
|
|
12
|
-
return new Response(JSON.stringify({ error: 'file and specialist_id are required' }), {
|
|
13
|
-
status: 400,
|
|
14
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const lock = await lockOps.acquire({
|
|
19
|
-
file,
|
|
20
|
-
reserved_by: specialist_id,
|
|
21
|
-
reserved_at: new Date().toISOString(),
|
|
22
|
-
released_at: null,
|
|
23
|
-
purpose: 'edit',
|
|
24
|
-
checksum: null,
|
|
25
|
-
timeout_ms,
|
|
26
|
-
metadata: null,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
return new Response(JSON.stringify({ lock }), {
|
|
30
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
31
|
-
});
|
|
32
|
-
} catch (error) {
|
|
33
|
-
console.error('Error acquiring lock:', error);
|
|
34
|
-
return new Response(JSON.stringify({ error: 'Failed to acquire lock' }), {
|
|
35
|
-
status: 500,
|
|
36
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
router.post('/api/v1/lock/release', async (req: Request) => {
|
|
43
|
-
try {
|
|
44
|
-
const body = await req.json() as { lock_id?: string; specialist_id?: string };
|
|
45
|
-
const { lock_id, specialist_id } = body;
|
|
46
|
-
|
|
47
|
-
if (!lock_id) {
|
|
48
|
-
return new Response(JSON.stringify({ error: 'lock_id is required' }), {
|
|
49
|
-
status: 400,
|
|
50
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const lock = await lockOps.getById(lock_id);
|
|
55
|
-
|
|
56
|
-
if (!lock) {
|
|
57
|
-
return new Response(JSON.stringify({ error: 'Lock not found' }), {
|
|
58
|
-
status: 404,
|
|
59
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (lock.reserved_by !== specialist_id) {
|
|
64
|
-
return new Response(JSON.stringify({ error: 'Cannot release lock: wrong specialist' }), {
|
|
65
|
-
status: 403,
|
|
66
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const updatedLock = await lockOps.release(lock_id);
|
|
71
|
-
return new Response(JSON.stringify({ lock: updatedLock }), {
|
|
72
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
73
|
-
});
|
|
74
|
-
} catch (error) {
|
|
75
|
-
console.error('Error releasing lock:', error);
|
|
76
|
-
return new Response(JSON.stringify({ error: 'Failed to release lock' }), {
|
|
77
|
-
status: 500,
|
|
78
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
router.get('/api/v1/locks', async (req: Request) => {
|
|
85
|
-
try {
|
|
86
|
-
const locks = lockOps.getAll();
|
|
87
|
-
return new Response(JSON.stringify({ locks }), {
|
|
88
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
89
|
-
});
|
|
90
|
-
} catch (error) {
|
|
91
|
-
console.error('Error listing locks:', error);
|
|
92
|
-
return new Response(JSON.stringify({ error: 'Failed to list locks' }), {
|
|
93
|
-
status: 500,
|
|
94
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
package/src/squawk/mailbox.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { mailboxOps, eventOps } from '../../../../squawk/src/db/index.js';
|
|
3
|
-
|
|
4
|
-
export function registerMailboxRoutes(router: any, headers: Record<string, string>) {
|
|
5
|
-
|
|
6
|
-
router.post('/api/v1/mailbox/append', async (req: Request) => {
|
|
7
|
-
try {
|
|
8
|
-
const body = await req.json() as { stream_id?: string; events?: any[] };
|
|
9
|
-
const { stream_id, events } = body;
|
|
10
|
-
|
|
11
|
-
if (!stream_id || !Array.isArray(events)) {
|
|
12
|
-
return new Response(JSON.stringify({ error: 'stream_id and events array are required' }), {
|
|
13
|
-
status: 400,
|
|
14
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (!(await mailboxOps.exists(stream_id))) {
|
|
19
|
-
await mailboxOps.create(stream_id);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const formattedEvents = events.map((e: any) => ({
|
|
23
|
-
type: e.type,
|
|
24
|
-
stream_id,
|
|
25
|
-
data: JSON.stringify(e.data),
|
|
26
|
-
occurred_at: new Date().toISOString(),
|
|
27
|
-
causation_id: e.causation_id || null,
|
|
28
|
-
metadata: e.metadata ? JSON.stringify(e.metadata) : null,
|
|
29
|
-
}));
|
|
30
|
-
|
|
31
|
-
const inserted = await eventOps.append(stream_id, formattedEvents);
|
|
32
|
-
const mailbox = await mailboxOps.getById(stream_id);
|
|
33
|
-
const mailboxEvents = await eventOps.getByMailbox(stream_id);
|
|
34
|
-
|
|
35
|
-
return new Response(JSON.stringify({
|
|
36
|
-
mailbox: { ...mailbox, events: mailboxEvents },
|
|
37
|
-
inserted: inserted.length
|
|
38
|
-
}), {
|
|
39
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
40
|
-
});
|
|
41
|
-
} catch (error) {
|
|
42
|
-
console.error('Error appending to mailbox:', error);
|
|
43
|
-
return new Response(JSON.stringify({ error: 'Failed to append to mailbox' }), {
|
|
44
|
-
status: 500,
|
|
45
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
router.get('/api/v1/mailbox/:streamId', async (req: Request, params: { streamId: string }) => {
|
|
52
|
-
try {
|
|
53
|
-
const streamId = params.streamId;
|
|
54
|
-
const mailbox = await mailboxOps.getById(streamId);
|
|
55
|
-
|
|
56
|
-
if (!mailbox) {
|
|
57
|
-
return new Response(JSON.stringify({ error: 'Mailbox not found' }), {
|
|
58
|
-
status: 404,
|
|
59
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const events = await eventOps.getByMailbox(streamId);
|
|
64
|
-
return new Response(JSON.stringify({ mailbox: { ...mailbox, events } }), {
|
|
65
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
66
|
-
});
|
|
67
|
-
} catch (error) {
|
|
68
|
-
console.error('Error getting mailbox:', error);
|
|
69
|
-
return new Response(JSON.stringify({ error: 'Failed to get mailbox' }), {
|
|
70
|
-
status: 500,
|
|
71
|
-
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}
|
package/src/types/api.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for API requests
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export interface SpawnAgentRequest {
|
|
6
|
-
type: string;
|
|
7
|
-
task?: string;
|
|
8
|
-
metadata?: Record<string, any>;
|
|
9
|
-
config?: {
|
|
10
|
-
timeout?: number;
|
|
11
|
-
retries?: number;
|
|
12
|
-
resources?: {
|
|
13
|
-
memory?: string;
|
|
14
|
-
cpu?: string;
|
|
15
|
-
};
|
|
16
|
-
environment?: Record<string, string>;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface CreateTaskRequest {
|
|
21
|
-
type: string;
|
|
22
|
-
title: string;
|
|
23
|
-
description: string;
|
|
24
|
-
priority?: 'low' | 'medium' | 'high' | 'critical';
|
|
25
|
-
missionId?: string;
|
|
26
|
-
dependencies?: string[];
|
|
27
|
-
metadata?: Record<string, any>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface UpdateTaskRequest {
|
|
31
|
-
status: string;
|
|
32
|
-
result?: any;
|
|
33
|
-
error?: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface WorkOrderRequest {
|
|
37
|
-
title: string;
|
|
38
|
-
description: string;
|
|
39
|
-
priority?: 'low' | 'medium' | 'high' | 'critical';
|
|
40
|
-
assigned_to?: string;
|
|
41
|
-
metadata?: Record<string, any>;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface TechOrderRequest {
|
|
45
|
-
name: string;
|
|
46
|
-
pattern: string;
|
|
47
|
-
context: string;
|
|
48
|
-
usage_count?: number;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface CtkReservationRequest {
|
|
52
|
-
file: string;
|
|
53
|
-
specialist_id: string;
|
|
54
|
-
purpose: string;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export interface LockRequest {
|
|
58
|
-
file: string;
|
|
59
|
-
specialist_id: string;
|
|
60
|
-
timeout_ms?: number;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface CursorRequest {
|
|
64
|
-
stream_id: string;
|
|
65
|
-
position: number;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface MailboxRequest {
|
|
69
|
-
stream_id: string;
|
|
70
|
-
events: any[];
|
|
71
|
-
}
|