@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/agent-runner.js
DELETED
|
@@ -1,877 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FleetTools Agent Runner
|
|
3
|
-
*
|
|
4
|
-
* Entry point for spawned agent processes
|
|
5
|
-
* Connects to Squawk mailbox for progress reporting
|
|
6
|
-
* Executes tasks with timeout and graceful shutdown
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { randomUUID } from 'node:crypto';
|
|
10
|
-
|
|
11
|
-
// CLI Argument Parsing
|
|
12
|
-
function parseArgs() {
|
|
13
|
-
const args = process.argv.slice(2);
|
|
14
|
-
|
|
15
|
-
const getArgValue = (flag) => {
|
|
16
|
-
const index = args.indexOf(flag);
|
|
17
|
-
if (index === -1 || index + 1 >= args.length) {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
return args[index + 1];
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
agentId: getArgValue('--agent-id') || '',
|
|
25
|
-
agentType: getArgValue('--agent-type') || 'backend',
|
|
26
|
-
mailboxId: getArgValue('--mailbox-id') || '',
|
|
27
|
-
task: getArgValue('--task') || '',
|
|
28
|
-
timeout: parseInt(getArgValue('--timeout') || '300000', 10),
|
|
29
|
-
apiUrl: getArgValue('--api-url') || 'http://localhost:3001'
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Squawk Mailbox Client
|
|
34
|
-
class SquawkMailbox {
|
|
35
|
-
constructor(mailboxId, agentId, apiUrl) {
|
|
36
|
-
this.mailboxId = mailboxId;
|
|
37
|
-
this.agentId = agentId;
|
|
38
|
-
this.apiUrl = apiUrl;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Send progress update via mailbox events
|
|
43
|
-
*/
|
|
44
|
-
async sendProgress(type, data) {
|
|
45
|
-
try {
|
|
46
|
-
const response = await fetch(`${this.apiUrl}/api/v1/mailbox/append`, {
|
|
47
|
-
method: 'POST',
|
|
48
|
-
headers: { 'Content-Type': 'application/json' },
|
|
49
|
-
body: JSON.stringify({
|
|
50
|
-
mailboxId: this.mailboxId,
|
|
51
|
-
eventType: type,
|
|
52
|
-
streamType: 'squawk',
|
|
53
|
-
streamId: this.mailboxId,
|
|
54
|
-
data,
|
|
55
|
-
occurredAt: new Date().toISOString()
|
|
56
|
-
})
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
if (!response.ok) {
|
|
60
|
-
const error = await response.text();
|
|
61
|
-
console.error(`[${this.agentId}] Failed to send progress:`, error);
|
|
62
|
-
}
|
|
63
|
-
} catch (error) {
|
|
64
|
-
console.error(`[${this.agentId}] Error sending progress:`, error);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Advance cursor position
|
|
70
|
-
*/
|
|
71
|
-
async advanceCursor(position) {
|
|
72
|
-
try {
|
|
73
|
-
const response = await fetch(`${this.apiUrl}/api/v1/cursor/advance`, {
|
|
74
|
-
method: 'POST',
|
|
75
|
-
headers: { 'Content-Type': 'application/json' },
|
|
76
|
-
body: JSON.stringify({
|
|
77
|
-
cursorId: `${this.agentId}_cursor`,
|
|
78
|
-
streamType: 'squawk',
|
|
79
|
-
streamId: this.mailboxId,
|
|
80
|
-
position
|
|
81
|
-
})
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
if (!response.ok) {
|
|
85
|
-
const error = await response.text();
|
|
86
|
-
console.error(`[${this.agentId}] Failed to advance cursor:`, error);
|
|
87
|
-
}
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.error(`[${this.agentId}] Error advancing cursor:`, error);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Send heartbeat
|
|
95
|
-
*/
|
|
96
|
-
async sendHeartbeat(status) {
|
|
97
|
-
await this.sendProgress('heartbeat', {
|
|
98
|
-
agentId: this.agentId,
|
|
99
|
-
status,
|
|
100
|
-
timestamp: new Date().toISOString()
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Agent Task Execution
|
|
106
|
-
class AgentExecutor {
|
|
107
|
-
constructor(config, mailbox) {
|
|
108
|
-
this.config = config;
|
|
109
|
-
this.mailbox = mailbox;
|
|
110
|
-
this.startTime = 0;
|
|
111
|
-
this.heartbeatInterval = undefined;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Execute agent task with timeout
|
|
116
|
-
*/
|
|
117
|
-
async execute() {
|
|
118
|
-
this.startTime = Date.now();
|
|
119
|
-
console.log(`[${this.config.agentId}] Starting task execution`);
|
|
120
|
-
console.log(`[${this.config.agentId}] Type: ${this.config.agentType}`);
|
|
121
|
-
console.log(`[${this.config.agentId}] Task: ${this.config.task || '(no task specified)'}`);
|
|
122
|
-
|
|
123
|
-
// Send started event
|
|
124
|
-
await this.mailbox.sendProgress('agent_started', {
|
|
125
|
-
agentType: this.config.agentType,
|
|
126
|
-
task: this.config.task,
|
|
127
|
-
startTime: new Date().toISOString()
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
// Start heartbeat
|
|
131
|
-
this.heartbeatInterval = setInterval(async () => {
|
|
132
|
-
await this.mailbox.sendHeartbeat('running');
|
|
133
|
-
}, 30000); // Every 30 seconds
|
|
134
|
-
|
|
135
|
-
try {
|
|
136
|
-
// Execute task based on agent type
|
|
137
|
-
const result = await this.executeByType();
|
|
138
|
-
|
|
139
|
-
const elapsedTime = Date.now() - this.startTime;
|
|
140
|
-
|
|
141
|
-
// Send completed event
|
|
142
|
-
await this.mailbox.sendProgress('agent_completed', {
|
|
143
|
-
agentType: this.config.agentType,
|
|
144
|
-
task: this.config.task,
|
|
145
|
-
startTime: new Date(this.startTime).toISOString(),
|
|
146
|
-
endTime: new Date().toISOString(),
|
|
147
|
-
duration: elapsedTime,
|
|
148
|
-
result
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
console.log(`[${this.config.agentId}] Task completed in ${elapsedTime}ms`);
|
|
152
|
-
return 0; // Success
|
|
153
|
-
} catch (error) {
|
|
154
|
-
const elapsedTime = Date.now() - this.startTime;
|
|
155
|
-
|
|
156
|
-
await this.mailbox.sendProgress('agent_failed', {
|
|
157
|
-
agentType: this.config.agentType,
|
|
158
|
-
task: this.config.task,
|
|
159
|
-
startTime: new Date(this.startTime).toISOString(),
|
|
160
|
-
endTime: new Date().toISOString(),
|
|
161
|
-
duration: elapsedTime,
|
|
162
|
-
error: error.message || String(error),
|
|
163
|
-
stack: error.stack
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
console.error(`[${this.config.agentId}] Task failed:`, error);
|
|
167
|
-
return 1; // Failure
|
|
168
|
-
} finally {
|
|
169
|
-
if (this.heartbeatInterval) {
|
|
170
|
-
clearInterval(this.heartbeatInterval);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Execute task based on agent type
|
|
177
|
-
*/
|
|
178
|
-
async executeByType() {
|
|
179
|
-
const agentType = this.config.agentType;
|
|
180
|
-
const task = this.config.task;
|
|
181
|
-
const timeout = this.config.timeout;
|
|
182
|
-
|
|
183
|
-
switch (agentType) {
|
|
184
|
-
case 'frontend':
|
|
185
|
-
return this.executeFrontendTask(task, timeout);
|
|
186
|
-
case 'backend':
|
|
187
|
-
return this.executeBackendTask(task, timeout);
|
|
188
|
-
case 'testing':
|
|
189
|
-
return this.executeTestingTask(task, timeout);
|
|
190
|
-
case 'documentation':
|
|
191
|
-
return this.executeDocumentationTask(task, timeout);
|
|
192
|
-
case 'security':
|
|
193
|
-
return this.executeSecurityTask(task, timeout);
|
|
194
|
-
case 'performance':
|
|
195
|
-
return this.executePerformanceTask(task, timeout);
|
|
196
|
-
default:
|
|
197
|
-
throw new Error(`Unknown agent type: ${agentType}`);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
async executeFrontendTask(task, timeout) {
|
|
202
|
-
console.log(`[${this.config.agentId}] Executing frontend task: ${task}`);
|
|
203
|
-
|
|
204
|
-
try {
|
|
205
|
-
// Parse task requirements
|
|
206
|
-
const taskDetails = this.parseTask(task);
|
|
207
|
-
|
|
208
|
-
// Report initial progress
|
|
209
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
210
|
-
stage: 'analysis',
|
|
211
|
-
progress: 10,
|
|
212
|
-
message: 'Analyzing frontend task requirements...'
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
// Check existing codebase structure
|
|
216
|
-
const codebaseAnalysis = await this.analyzeCodebase('frontend');
|
|
217
|
-
|
|
218
|
-
// Report analysis completion
|
|
219
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
220
|
-
stage: 'planning',
|
|
221
|
-
progress: 25,
|
|
222
|
-
message: `Codebase analyzed. Found ${codebaseAnalysis.componentCount} components.`,
|
|
223
|
-
analysis: codebaseAnalysis
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
// Generate/modify code based on task type
|
|
227
|
-
const changes = await this.implementFrontendChanges(taskDetails, codebaseAnalysis);
|
|
228
|
-
|
|
229
|
-
// Report implementation progress
|
|
230
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
231
|
-
stage: 'implementation',
|
|
232
|
-
progress: 70,
|
|
233
|
-
message: `Implemented ${changes.length} frontend changes.`,
|
|
234
|
-
changes
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
// Run frontend tests
|
|
238
|
-
const testResults = await this.runFrontendTests();
|
|
239
|
-
|
|
240
|
-
// Report test completion
|
|
241
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
242
|
-
stage: 'testing',
|
|
243
|
-
progress: 90,
|
|
244
|
-
message: `Ran ${testResults.testsRun} tests. ${testResults.testsPassed} passed.`,
|
|
245
|
-
testResults
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
// Build verification
|
|
249
|
-
const buildResult = await this.verifyBuild();
|
|
250
|
-
|
|
251
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
252
|
-
stage: 'verification',
|
|
253
|
-
progress: 100,
|
|
254
|
-
message: buildResult.success ? 'Build verification passed' : 'Build verification failed',
|
|
255
|
-
buildResult
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
return {
|
|
259
|
-
success: true,
|
|
260
|
-
changes: changes.map(c => c.file),
|
|
261
|
-
testsRun: testResults.testsRun,
|
|
262
|
-
testsPassed: testResults.testsPassed,
|
|
263
|
-
buildStatus: buildResult.success,
|
|
264
|
-
taskCompleted: task
|
|
265
|
-
};
|
|
266
|
-
} catch (error) {
|
|
267
|
-
await this.mailbox.sendProgress('task_error', {
|
|
268
|
-
stage: 'error',
|
|
269
|
-
error: error.message,
|
|
270
|
-
stack: error.stack
|
|
271
|
-
});
|
|
272
|
-
throw error;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
async executeBackendTask(task, timeout) {
|
|
277
|
-
console.log(`[${this.config.agentId}] Executing backend task: ${task}`);
|
|
278
|
-
|
|
279
|
-
try {
|
|
280
|
-
// Parse task requirements
|
|
281
|
-
const taskDetails = this.parseTask(task);
|
|
282
|
-
|
|
283
|
-
// Report initial progress
|
|
284
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
285
|
-
stage: 'analysis',
|
|
286
|
-
progress: 10,
|
|
287
|
-
message: 'Analyzing backend task requirements...'
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
// Check existing backend structure
|
|
291
|
-
const backendAnalysis = await this.analyzeCodebase('backend');
|
|
292
|
-
|
|
293
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
294
|
-
stage: 'planning',
|
|
295
|
-
progress: 25,
|
|
296
|
-
message: `Backend analyzed. Found ${backendAnalysis.endpointCount} endpoints, ${backendAnalysis.modelCount} models.`,
|
|
297
|
-
analysis: backendAnalysis
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
// Implement backend changes
|
|
301
|
-
const changes = await this.implementBackendChanges(taskDetails, backendAnalysis);
|
|
302
|
-
|
|
303
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
304
|
-
stage: 'implementation',
|
|
305
|
-
progress: 60,
|
|
306
|
-
message: `Implemented ${changes.length} backend changes.`,
|
|
307
|
-
changes
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
// Database migrations if needed
|
|
311
|
-
const migrationResult = await this.runMigrations();
|
|
312
|
-
|
|
313
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
314
|
-
stage: 'migration',
|
|
315
|
-
progress: 75,
|
|
316
|
-
message: migrationResult.success ? 'Migrations completed' : 'Migration issues detected',
|
|
317
|
-
migrationResult
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
// Run backend tests
|
|
321
|
-
const testResults = await this.runBackendTests();
|
|
322
|
-
|
|
323
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
324
|
-
stage: 'testing',
|
|
325
|
-
progress: 90,
|
|
326
|
-
message: `Ran ${testResults.testsRun} backend tests. ${testResults.testsPassed} passed.`,
|
|
327
|
-
testResults
|
|
328
|
-
});
|
|
329
|
-
|
|
330
|
-
// API verification
|
|
331
|
-
const apiVerification = await this.verifyAPI();
|
|
332
|
-
|
|
333
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
334
|
-
stage: 'verification',
|
|
335
|
-
progress: 100,
|
|
336
|
-
message: apiVerification.success ? 'API verification passed' : 'API verification failed',
|
|
337
|
-
apiVerification
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
return {
|
|
341
|
-
success: true,
|
|
342
|
-
changes: changes.map(c => c.file),
|
|
343
|
-
endpointsAdded: changes.filter(c => c.type === 'endpoint').length,
|
|
344
|
-
testsRun: testResults.testsRun,
|
|
345
|
-
testsPassed: testResults.testsPassed,
|
|
346
|
-
migrationsRun: migrationResult.migrationsRun || 0,
|
|
347
|
-
taskCompleted: task
|
|
348
|
-
};
|
|
349
|
-
} catch (error) {
|
|
350
|
-
await this.mailbox.sendProgress('task_error', {
|
|
351
|
-
stage: 'error',
|
|
352
|
-
error: error.message,
|
|
353
|
-
stack: error.stack
|
|
354
|
-
});
|
|
355
|
-
throw error;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
async executeTestingTask(task, timeout) {
|
|
360
|
-
console.log(`[${this.config.agentId}] Executing testing task: ${task}`);
|
|
361
|
-
|
|
362
|
-
try {
|
|
363
|
-
// Parse testing requirements
|
|
364
|
-
const taskDetails = this.parseTask(task);
|
|
365
|
-
|
|
366
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
367
|
-
stage: 'analysis',
|
|
368
|
-
progress: 10,
|
|
369
|
-
message: 'Analyzing testing requirements...'
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
// Analyze existing test coverage
|
|
373
|
-
const coverageAnalysis = await this.analyzeTestCoverage();
|
|
374
|
-
|
|
375
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
376
|
-
stage: 'planning',
|
|
377
|
-
progress: 20,
|
|
378
|
-
message: `Current coverage: ${coverageAnalysis.overallCoverage}%`,
|
|
379
|
-
coverageAnalysis
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
// Generate additional tests
|
|
383
|
-
const testGeneration = await this.generateTests(taskDetails, coverageAnalysis);
|
|
384
|
-
|
|
385
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
386
|
-
stage: 'generation',
|
|
387
|
-
progress: 50,
|
|
388
|
-
message: `Generated ${testGeneration.testsGenerated} test files.`,
|
|
389
|
-
testGeneration
|
|
390
|
-
});
|
|
391
|
-
|
|
392
|
-
// Run comprehensive test suite
|
|
393
|
-
const testResults = await this.runComprehensiveTests();
|
|
394
|
-
|
|
395
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
396
|
-
stage: 'testing',
|
|
397
|
-
progress: 80,
|
|
398
|
-
message: `Test results: ${testResults.passed}/${testResults.total} passed`,
|
|
399
|
-
testResults
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
// Performance tests if applicable
|
|
403
|
-
const perfResults = await this.runPerformanceTests();
|
|
404
|
-
|
|
405
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
406
|
-
stage: 'performance',
|
|
407
|
-
progress: 95,
|
|
408
|
-
message: `Performance tests completed`,
|
|
409
|
-
perfResults
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
// Generate test report
|
|
413
|
-
const testReport = await this.generateTestReport(testResults, coverageAnalysis);
|
|
414
|
-
|
|
415
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
416
|
-
stage: 'completion',
|
|
417
|
-
progress: 100,
|
|
418
|
-
message: 'Testing task completed successfully',
|
|
419
|
-
testReport
|
|
420
|
-
});
|
|
421
|
-
|
|
422
|
-
return {
|
|
423
|
-
success: true,
|
|
424
|
-
changes: testGeneration.testFiles,
|
|
425
|
-
testsRun: testResults.total,
|
|
426
|
-
testsPassed: testResults.passed,
|
|
427
|
-
coverage: testResults.coverage,
|
|
428
|
-
performanceMetrics: perfResults,
|
|
429
|
-
reportGenerated: testReport.path,
|
|
430
|
-
taskCompleted: task
|
|
431
|
-
};
|
|
432
|
-
} catch (error) {
|
|
433
|
-
await this.mailbox.sendProgress('task_error', {
|
|
434
|
-
stage: 'error',
|
|
435
|
-
error: error.message,
|
|
436
|
-
stack: error.stack
|
|
437
|
-
});
|
|
438
|
-
throw error;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
async executeDocumentationTask(task, timeout) {
|
|
443
|
-
console.log(`[${this.config.agentId}] Executing documentation task`);
|
|
444
|
-
// Placeholder: Simulate documentation task execution
|
|
445
|
-
await new Promise(resolve => setTimeout(resolve, timeout * 0.3));
|
|
446
|
-
return { success: true, changes: ['docs updated'], pagesModified: 5 };
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
async executeSecurityTask(task, timeout) {
|
|
450
|
-
console.log(`[${this.config.agentId}] Executing security task`);
|
|
451
|
-
// Placeholder: Simulate security task execution
|
|
452
|
-
await new Promise(resolve => setTimeout(resolve, timeout * 0.7));
|
|
453
|
-
return { success: true, vulnerabilitiesFound: 0, vulnerabilitiesFixed: 1, issuesScanned: 25 };
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
async executePerformanceTask(task, timeout) {
|
|
457
|
-
console.log(`[${this.config.agentId}] Executing performance task: ${task}`);
|
|
458
|
-
|
|
459
|
-
try {
|
|
460
|
-
const taskDetails = this.parseTask(task);
|
|
461
|
-
|
|
462
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
463
|
-
stage: 'analysis',
|
|
464
|
-
progress: 10,
|
|
465
|
-
message: 'Analyzing performance requirements...'
|
|
466
|
-
});
|
|
467
|
-
|
|
468
|
-
// Baseline performance measurement
|
|
469
|
-
const baseline = await this.measureBaselinePerformance();
|
|
470
|
-
|
|
471
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
472
|
-
stage: 'baseline',
|
|
473
|
-
progress: 25,
|
|
474
|
-
message: 'Baseline performance measured',
|
|
475
|
-
baseline
|
|
476
|
-
});
|
|
477
|
-
|
|
478
|
-
// Identify performance bottlenecks
|
|
479
|
-
const bottlenecks = await this.identifyBottlenecks();
|
|
480
|
-
|
|
481
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
482
|
-
stage: 'identification',
|
|
483
|
-
progress: 40,
|
|
484
|
-
message: `Identified ${bottlenecks.length} performance bottlenecks`,
|
|
485
|
-
bottlenecks
|
|
486
|
-
});
|
|
487
|
-
|
|
488
|
-
// Apply performance optimizations
|
|
489
|
-
const optimizations = await this.applyOptimizations(bottlenecks);
|
|
490
|
-
|
|
491
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
492
|
-
stage: 'optimization',
|
|
493
|
-
progress: 70,
|
|
494
|
-
message: `Applied ${optimizations.length} performance optimizations`,
|
|
495
|
-
optimizations
|
|
496
|
-
});
|
|
497
|
-
|
|
498
|
-
// Measure improved performance
|
|
499
|
-
const improved = await this.measureImprovedPerformance();
|
|
500
|
-
|
|
501
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
502
|
-
stage: 'measurement',
|
|
503
|
-
progress: 85,
|
|
504
|
-
message: 'Performance improvement measured',
|
|
505
|
-
improved
|
|
506
|
-
});
|
|
507
|
-
|
|
508
|
-
// Run benchmarks
|
|
509
|
-
const benchmarks = await this.runBenchmarks();
|
|
510
|
-
|
|
511
|
-
await this.mailbox.sendProgress('task_progress', {
|
|
512
|
-
stage: 'benchmarking',
|
|
513
|
-
progress: 100,
|
|
514
|
-
message: `Completed ${benchmarks.length} benchmarks`,
|
|
515
|
-
benchmarks
|
|
516
|
-
});
|
|
517
|
-
|
|
518
|
-
const improvements = this.calculateImprovements(baseline, improved);
|
|
519
|
-
|
|
520
|
-
return {
|
|
521
|
-
success: true,
|
|
522
|
-
changes: optimizations.map(o => o.file),
|
|
523
|
-
bottlenecksFound: bottlenecks.length,
|
|
524
|
-
optimizationsApplied: optimizations.length,
|
|
525
|
-
benchmarksRun: benchmarks.length,
|
|
526
|
-
performanceImprovement: improvements,
|
|
527
|
-
taskCompleted: task
|
|
528
|
-
};
|
|
529
|
-
} catch (error) {
|
|
530
|
-
await this.mailbox.sendProgress('task_error', {
|
|
531
|
-
stage: 'error',
|
|
532
|
-
error: error.message,
|
|
533
|
-
stack: error.stack
|
|
534
|
-
});
|
|
535
|
-
throw error;
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
// Helper methods for real task execution
|
|
540
|
-
|
|
541
|
-
parseTask(task) {
|
|
542
|
-
// Simple task parsing - in real implementation would be more sophisticated
|
|
543
|
-
return {
|
|
544
|
-
type: this.inferTaskType(task),
|
|
545
|
-
description: task,
|
|
546
|
-
components: this.extractComponents(task),
|
|
547
|
-
priority: 'normal'
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
inferTaskType(task) {
|
|
552
|
-
if (task.toLowerCase().includes('component') || task.toLowerCase().includes('ui')) return 'component';
|
|
553
|
-
if (task.toLowerCase().includes('api') || task.toLowerCase().includes('endpoint')) return 'api';
|
|
554
|
-
if (task.toLowerCase().includes('test')) return 'test';
|
|
555
|
-
if (task.toLowerCase().includes('performance') || task.toLowerCase().includes('optimize')) return 'performance';
|
|
556
|
-
return 'general';
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
extractComponents(task) {
|
|
560
|
-
// Extract component names, endpoints, etc. from task description
|
|
561
|
-
const components = [];
|
|
562
|
-
const words = task.split(/\s+/);
|
|
563
|
-
for (const word of words) {
|
|
564
|
-
if (word.length > 3 && /^[A-Z]/.test(word)) {
|
|
565
|
-
components.push(word);
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
return components;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
async analyzeCodebase(type) {
|
|
572
|
-
// Simulate codebase analysis - in real implementation would scan actual files
|
|
573
|
-
await this.simulateWork(1000);
|
|
574
|
-
|
|
575
|
-
if (type === 'frontend') {
|
|
576
|
-
return {
|
|
577
|
-
componentCount: Math.floor(Math.random() * 20) + 5,
|
|
578
|
-
routeCount: Math.floor(Math.random() * 10) + 3,
|
|
579
|
-
testCount: Math.floor(Math.random() * 30) + 10,
|
|
580
|
-
framework: 'react', // Would be detected
|
|
581
|
-
hasTypeScript: true
|
|
582
|
-
};
|
|
583
|
-
} else {
|
|
584
|
-
return {
|
|
585
|
-
endpointCount: Math.floor(Math.random() * 15) + 5,
|
|
586
|
-
modelCount: Math.floor(Math.random() * 10) + 3,
|
|
587
|
-
testCount: Math.floor(Math.random() * 25) + 8,
|
|
588
|
-
database: 'sqlite', // Would be detected
|
|
589
|
-
hasAPIDocs: true
|
|
590
|
-
};
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
async implementFrontendChanges(taskDetails, analysis) {
|
|
595
|
-
await this.simulateWork(2000);
|
|
596
|
-
|
|
597
|
-
const changes = [];
|
|
598
|
-
const numChanges = Math.floor(Math.random() * 3) + 1;
|
|
599
|
-
|
|
600
|
-
for (let i = 0; i < numChanges; i++) {
|
|
601
|
-
changes.push({
|
|
602
|
-
file: `src/components/${taskDetails.components[0] || 'New'}Component.tsx`,
|
|
603
|
-
type: 'component',
|
|
604
|
-
linesAdded: Math.floor(Math.random() * 50) + 20
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
return changes;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
async implementBackendChanges(taskDetails, analysis) {
|
|
612
|
-
await this.simulateWork(2500);
|
|
613
|
-
|
|
614
|
-
const changes = [];
|
|
615
|
-
const numChanges = Math.floor(Math.random() * 4) + 1;
|
|
616
|
-
|
|
617
|
-
for (let i = 0; i < numChanges; i++) {
|
|
618
|
-
if (Math.random() > 0.5) {
|
|
619
|
-
changes.push({
|
|
620
|
-
file: `src/api/${taskDetails.components[0] || 'new'}-endpoint.ts`,
|
|
621
|
-
type: 'endpoint',
|
|
622
|
-
linesAdded: Math.floor(Math.random() * 40) + 15
|
|
623
|
-
});
|
|
624
|
-
} else {
|
|
625
|
-
changes.push({
|
|
626
|
-
file: `src/models/${taskDetails.components[0] || 'New'}Model.ts`,
|
|
627
|
-
type: 'model',
|
|
628
|
-
linesAdded: Math.floor(Math.random() * 30) + 10
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
return changes;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
async runFrontendTests() {
|
|
637
|
-
await this.simulateWork(1500);
|
|
638
|
-
const testsRun = Math.floor(Math.random() * 20) + 10;
|
|
639
|
-
const testsPassed = Math.floor(testsRun * (0.8 + Math.random() * 0.2));
|
|
640
|
-
|
|
641
|
-
return { testsRun, testsPassed, failed: testsRun - testsPassed };
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
async runBackendTests() {
|
|
645
|
-
await this.simulateWork(2000);
|
|
646
|
-
const testsRun = Math.floor(Math.random() * 15) + 8;
|
|
647
|
-
const testsPassed = Math.floor(testsRun * (0.85 + Math.random() * 0.15));
|
|
648
|
-
|
|
649
|
-
return { testsRun, testsPassed, failed: testsRun - testsPassed };
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
async runMigrations() {
|
|
653
|
-
await this.simulateWork(800);
|
|
654
|
-
const migrationsRun = Math.floor(Math.random() * 3);
|
|
655
|
-
return { success: true, migrationsRun };
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
async verifyBuild() {
|
|
659
|
-
await this.simulateWork(1200);
|
|
660
|
-
return { success: Math.random() > 0.1, buildTime: Math.floor(Math.random() * 30000) + 10000 };
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
async verifyAPI() {
|
|
664
|
-
await this.simulateWork(1000);
|
|
665
|
-
return { success: Math.random() > 0.05, endpointsVerified: Math.floor(Math.random() * 10) + 5 };
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
async analyzeTestCoverage() {
|
|
669
|
-
await this.simulateWork(1500);
|
|
670
|
-
const overallCoverage = Math.floor(Math.random() * 30) + 60;
|
|
671
|
-
|
|
672
|
-
return {
|
|
673
|
-
overallCoverage,
|
|
674
|
-
frontendCoverage: Math.floor(Math.random() * 25) + 65,
|
|
675
|
-
backendCoverage: Math.floor(Math.random() * 20) + 70,
|
|
676
|
-
uncoveredFiles: Math.floor(Math.random() * 5) + 1
|
|
677
|
-
};
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
async generateTests(taskDetails, coverageAnalysis) {
|
|
681
|
-
await this.simulateWork(3000);
|
|
682
|
-
const testsGenerated = Math.floor(Math.random() * 8) + 3;
|
|
683
|
-
const testFiles = [];
|
|
684
|
-
|
|
685
|
-
for (let i = 0; i < testsGenerated; i++) {
|
|
686
|
-
testFiles.push(`test/${taskDetails.components[0] || 'new'}.test.ts`);
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
return { testsGenerated, testFiles };
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
async runComprehensiveTests() {
|
|
693
|
-
await this.simulateWork(4000);
|
|
694
|
-
const total = Math.floor(Math.random() * 50) + 25;
|
|
695
|
-
const passed = Math.floor(total * (0.9 + Math.random() * 0.1));
|
|
696
|
-
|
|
697
|
-
return {
|
|
698
|
-
total,
|
|
699
|
-
passed,
|
|
700
|
-
failed: total - passed,
|
|
701
|
-
coverage: Math.floor(Math.random() * 15) + 75
|
|
702
|
-
};
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
async runPerformanceTests() {
|
|
706
|
-
await this.simulateWork(2000);
|
|
707
|
-
|
|
708
|
-
return {
|
|
709
|
-
responseTime: Math.floor(Math.random() * 200) + 50,
|
|
710
|
-
throughput: Math.floor(Math.random() * 1000) + 500,
|
|
711
|
-
memoryUsage: Math.floor(Math.random() * 100) + 50
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
async generateTestReport(testResults, coverageAnalysis) {
|
|
716
|
-
await this.simulateWork(800);
|
|
717
|
-
|
|
718
|
-
return {
|
|
719
|
-
path: 'reports/test-report.html',
|
|
720
|
-
summary: `${testResults.passed}/${testResults.total} tests passed, ${coverageAnalysis.overallCoverage}% coverage`
|
|
721
|
-
};
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
async measureBaselinePerformance() {
|
|
725
|
-
await this.simulateWork(1000);
|
|
726
|
-
|
|
727
|
-
return {
|
|
728
|
-
responseTime: Math.floor(Math.random() * 500) + 200,
|
|
729
|
-
throughput: Math.floor(Math.random() * 500) + 200,
|
|
730
|
-
cpuUsage: Math.floor(Math.random() * 40) + 30,
|
|
731
|
-
memoryUsage: Math.floor(Math.random() * 200) + 100
|
|
732
|
-
};
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
async identifyBottlenecks() {
|
|
736
|
-
await this.simulateWork(1500);
|
|
737
|
-
|
|
738
|
-
const bottlenecks = [];
|
|
739
|
-
const numBottlenecks = Math.floor(Math.random() * 4) + 1;
|
|
740
|
-
|
|
741
|
-
for (let i = 0; i < numBottlenecks; i++) {
|
|
742
|
-
bottlenecks.push({
|
|
743
|
-
type: ['database', 'api', 'memory', 'cpu'][Math.floor(Math.random() * 4)],
|
|
744
|
-
severity: ['low', 'medium', 'high'][Math.floor(Math.random() * 3)],
|
|
745
|
-
description: `Performance bottleneck ${i + 1}`
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
return bottlenecks;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
async applyOptimizations(bottlenecks) {
|
|
753
|
-
await this.simulateWork(3000);
|
|
754
|
-
|
|
755
|
-
const optimizations = [];
|
|
756
|
-
for (const bottleneck of bottlenecks) {
|
|
757
|
-
optimizations.push({
|
|
758
|
-
type: bottleneck.type,
|
|
759
|
-
file: `src/optimizations/${bottleneck.type}-opt.ts`,
|
|
760
|
-
improvement: Math.floor(Math.random() * 30) + 10
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
return optimizations;
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
async measureImprovedPerformance() {
|
|
768
|
-
await this.simulateWork(800);
|
|
769
|
-
|
|
770
|
-
return {
|
|
771
|
-
responseTime: Math.floor(Math.random() * 200) + 50,
|
|
772
|
-
throughput: Math.floor(Math.random() * 800) + 400,
|
|
773
|
-
cpuUsage: Math.floor(Math.random() * 30) + 20,
|
|
774
|
-
memoryUsage: Math.floor(Math.random() * 150) + 80
|
|
775
|
-
};
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
async runBenchmarks() {
|
|
779
|
-
await this.simulateWork(2000);
|
|
780
|
-
|
|
781
|
-
const benchmarks = [];
|
|
782
|
-
const numBenchmarks = Math.floor(Math.random() * 5) + 2;
|
|
783
|
-
|
|
784
|
-
for (let i = 0; i < numBenchmarks; i++) {
|
|
785
|
-
benchmarks.push({
|
|
786
|
-
name: `benchmark-${i + 1}`,
|
|
787
|
-
score: Math.floor(Math.random() * 100) + 50,
|
|
788
|
-
improvement: Math.floor(Math.random() * 30) + 5
|
|
789
|
-
});
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
return benchmarks;
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
calculateImprovements(baseline, improved) {
|
|
796
|
-
return {
|
|
797
|
-
responseTimeImprovement: ((baseline.responseTime - improved.responseTime) / baseline.responseTime * 100).toFixed(1) + '%',
|
|
798
|
-
throughputImprovement: ((improved.throughput - baseline.throughput) / baseline.throughput * 100).toFixed(1) + '%',
|
|
799
|
-
cpuImprovement: ((baseline.cpuUsage - improved.cpuUsage) / baseline.cpuUsage * 100).toFixed(1) + '%',
|
|
800
|
-
memoryImprovement: ((baseline.memoryUsage - improved.memoryUsage) / baseline.memoryUsage * 100).toFixed(1) + '%'
|
|
801
|
-
};
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
async simulateWork(duration) {
|
|
805
|
-
return new Promise(resolve => setTimeout(resolve, duration));
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
// Graceful Shutdown
|
|
810
|
-
function setupGracefulShutdown(agentExecutor) {
|
|
811
|
-
const shutdown = async (signal) => {
|
|
812
|
-
console.log(`[${agentExecutor.config.agentId}] Received ${signal}, shutting down gracefully...`);
|
|
813
|
-
|
|
814
|
-
try {
|
|
815
|
-
// Send shutdown event
|
|
816
|
-
await agentExecutor.mailbox.sendProgress('agent_shutdown', {
|
|
817
|
-
agentId: agentExecutor.config.agentId,
|
|
818
|
-
signal,
|
|
819
|
-
timestamp: new Date().toISOString()
|
|
820
|
-
});
|
|
821
|
-
|
|
822
|
-
// Small delay to ensure event is sent
|
|
823
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
824
|
-
|
|
825
|
-
process.exit(0);
|
|
826
|
-
} catch (error) {
|
|
827
|
-
console.error(`[${agentExecutor.config.agentId}] Error during shutdown:`, error);
|
|
828
|
-
process.exit(1);
|
|
829
|
-
}
|
|
830
|
-
};
|
|
831
|
-
|
|
832
|
-
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
|
833
|
-
process.on('SIGINT', () => shutdown('SIGINT'));
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
// Main Entry Point
|
|
837
|
-
async function main() {
|
|
838
|
-
try {
|
|
839
|
-
const config = parseArgs();
|
|
840
|
-
|
|
841
|
-
// Validate required arguments
|
|
842
|
-
if (!config.agentId || !config.mailboxId) {
|
|
843
|
-
console.error('Missing required arguments: --agent-id and --mailbox-id');
|
|
844
|
-
console.error('Usage: node agent-runner.js --agent-id <id> --agent-type <type> --mailbox-id <id> [--task <task>] [--timeout <ms>] [--api-url <url>]');
|
|
845
|
-
process.exit(1);
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
console.log('\n=== FleetTools Agent Runner ===');
|
|
849
|
-
console.log(`Agent ID: ${config.agentId}`);
|
|
850
|
-
console.log(`Agent Type: ${config.agentType}`);
|
|
851
|
-
console.log(`Mailbox: ${config.mailboxId}`);
|
|
852
|
-
console.log(`Task: ${config.task || '(none)'}`);
|
|
853
|
-
console.log(`Timeout: ${config.timeout}ms`);
|
|
854
|
-
console.log(`API: ${config.apiUrl}`);
|
|
855
|
-
console.log('================================\n');
|
|
856
|
-
|
|
857
|
-
// Initialize mailbox connection
|
|
858
|
-
const mailbox = new SquawkMailbox(config.mailboxId, config.agentId, config.apiUrl);
|
|
859
|
-
|
|
860
|
-
// Create executor
|
|
861
|
-
const executor = new AgentExecutor(config, mailbox);
|
|
862
|
-
|
|
863
|
-
// Setup graceful shutdown
|
|
864
|
-
setupGracefulShutdown(executor);
|
|
865
|
-
|
|
866
|
-
// Execute task
|
|
867
|
-
const exitCode = await executor.execute();
|
|
868
|
-
|
|
869
|
-
console.log(`[${config.agentId}] Exiting with code: ${exitCode}`);
|
|
870
|
-
process.exit(exitCode);
|
|
871
|
-
} catch (error) {
|
|
872
|
-
console.error('[Agent Runner] Fatal error:', error);
|
|
873
|
-
process.exit(1);
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
main();
|