@fleettools/server 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -2
- package/tsconfig.json +7 -1
- package/.flightline/checkpoints.db +0 -0
- package/.flightline/ctk/04a5510b-1e09-40c6-91c8-399c22138708.json +0 -9
- package/.flightline/ctk/0ecde721-7827-4039-995a-974e24493cc5.json +0 -9
- package/.flightline/ctk/268bbdbd-ddd7-46b2-845f-56a138aa518a.json +0 -9
- package/.flightline/ctk/6f476f2e-776c-407a-b441-b9365c0bae95.json +0 -9
- package/.flightline/ctk/7e10d0d5-fbc2-4661-af03-53de89e064db.json +0 -9
- package/.flightline/ctk/90783096-b7d4-49c5-8153-3c35018a2e61.json +0 -9
- package/.flightline/ctk/9a3b6d18-8a46-4728-90aa-279800a8e397.json +0 -9
- package/.flightline/ctk/ae30e192-b386-4ee2-899c-93f86785d3f3.json +0 -9
- package/.flightline/ctk/d0e9c49e-10df-413e-8cf7-37232b1838ca.json +0 -9
- package/.flightline/ctk/eae1a12b-2e9d-4c3f-8619-dafbb1346e96.json +0 -9
- package/.flightline/mailboxes/mbx_00dae6ba-0b5e-4a8d-a86d-93c8640872c3/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_05b0bfa9-c4f5-4f68-ba75-6202820f49c3/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_0a6b8fb2-729e-4385-8241-839c36b929d7/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_0abca4ab-8e34-409c-997f-481e80e450dc/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_173e5fb9-8203-418d-93c2-4f8c91f2d842/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_22b62201-0570-4ce8-b0a7-0f4b445f6d9e/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_2724efb1-76e1-4147-9620-4defcc65510f/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_35b8bfcd-5a54-48f1-8759-cb1f8ffe775d/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_3bc5193a-604d-4f52-be00-e56277643358/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_3bd500f3-c111-427a-8cd7-a004125d6dc1/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_45ce9ae8-5299-44dc-a1b5-4d63914a9609/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_4779c645-1efc-4c76-ab21-ff93f973ee8f/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_482237cf-87c8-486e-a24d-0941be2f480d/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_4b7e23c8-5680-4edd-a276-88803dd5fb6f/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_4dd3b945-d846-4c7a-94eb-6eeb25a0dc6b/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_4ec41a62-62bb-4be4-b3ce-282d5a33acce/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_4ff7ee7e-0c8a-43d6-a829-7c62c10af3b0/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_7661e4fb-a919-4af1-86f7-3eaef22f1d81/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_7ca872bb-69ab-4e7d-a7c6-4888ec8e7749/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_7e6d5707-2aa5-4770-a7be-6b1be93d0d87/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_87bef50d-3c59-429b-a995-5872f6278c37/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_88d1ea56-0b69-48c4-9fcf-ce1e1f7527ba/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_8bfb6bd7-07d1-4836-ae9d-3c93668c6dfe/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_93355083-e95b-4341-b625-56fcc1e4fc0c/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_999fd94c-ca56-4fec-8d30-8b677cf40ad6/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_a039fd15-7ee1-4bd6-906d-55dea8d0e489/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_a0b7363f-7cc6-4940-8e29-2dc85793a77d/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_a31e8b61-9643-4c78-939d-d1696d0420d9/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_acc51591-256c-4bed-9a51-514b1811f4cd/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_b1efebd9-5981-49fa-8775-20fa00d0c902/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_ba9d4c61-39a3-4852-95d7-bd34e3605a43/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_c549b60f-65fd-48d5-8cd6-2f053292b112/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_d0f839a5-3ab9-42e2-b438-df5825d049fe/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_d826d57e-9817-4f3c-ab94-2bfafa352f6d/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_da102f37-632c-4c0b-be4c-4270a74c06b9/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_df4506f5-67f2-4cf6-9113-93994b76f39b/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_e038e93b-87ea-4122-9578-6540018697b7/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_e0c171c5-407f-44dc-9ef9-e26e8b99ceac/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_e64770bf-7220-4d0f-848c-d751ea1c7376/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_e7f0edda-0fab-484d-ab4d-d8a8e363cd14/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_ec7d9118-8594-4d79-bf79-f43afdfaf156/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_ee06ec01-03e4-485a-ae2b-d8bdb6e7a3a8/manifest.json +0 -6
- package/.flightline/mailboxes/mbx_fd467681-f9cf-4a54-b06a-836df6de2ccc/manifest.json +0 -6
- package/.flightline/progress.db +0 -0
- package/.flightline/recovery.log +0 -1
- package/.flightline/tasks.db +0 -0
- package/.flightline/tech-orders/to_0c93d981-6b4e-4055-8678-f39c009d1db1.json +0 -11
- package/.flightline/tech-orders/to_1862f8ed-c487-4914-9f1e-528af6d4f053.json +0 -11
- package/.flightline/tech-orders/to_2335a57d-f400-4efa-b108-e13ece57520d.json +0 -11
- package/.flightline/tech-orders/to_2bd8dbdd-ac57-4b84-b977-33a3637d10d1.json +0 -11
- package/.flightline/tech-orders/to_37057c01-39b5-403a-991f-afb186abde95.json +0 -11
- package/.flightline/tech-orders/to_9e7288bb-c0fd-488a-a83d-1e9337bd0f1f.json +0 -11
- package/.flightline/tech-orders/to_aa0fe80b-9de7-40f6-a106-353b5bca10bd.json +0 -11
- package/.flightline/tech-orders/to_c1a0f480-c863-4203-a070-76ad77137845.json +0 -11
- package/.flightline/tech-orders/to_cf1e882a-cf56-45a4-8d19-494925e5f449.json +0 -11
- package/.flightline/work-orders/wo_5a29168d-5fb4-41d7-8dac-1d1151d9248f/manifest.json +0 -15
- package/.flightline/work-orders/wo_6c8c38bb-17a1-4885-ada4-dbfc5cc12d7a/manifest.json +0 -15
- package/.flightline/work-orders/wo_cadeb9b2-ea42-4491-b429-e2d467942b5c/manifest.json +0 -12
- package/.flightline/work-orders/wo_cc7b669c-16c4-4ef7-8a76-d1813219d0be/manifest.json +0 -15
- package/dist/agent-lifecycle.js +0 -148
- package/dist/agent-spawner.js +0 -460
- package/dist/agent-validation.js +0 -111
- package/dist/index.js +0 -255
- package/dist/server/api/src/coordination/agent-lifecycle.d.ts +0 -12
- package/dist/server/api/src/coordination/agent-lifecycle.d.ts.map +0 -1
- package/dist/server/api/src/coordination/agent-lifecycle.js +0 -12
- package/dist/server/api/src/coordination/agent-lifecycle.js.map +0 -1
- package/dist/server/api/src/coordination/agent-runner.d.ts +0 -9
- package/dist/server/api/src/coordination/agent-runner.d.ts.map +0 -1
- package/dist/server/api/src/coordination/agent-runner.js +0 -416
- package/dist/server/api/src/coordination/agent-runner.js.map +0 -1
- package/dist/server/api/src/coordination/agent-spawner-routes.d.ts +0 -7
- package/dist/server/api/src/coordination/agent-spawner-routes.d.ts.map +0 -1
- package/dist/server/api/src/coordination/agent-spawner-routes.js +0 -321
- package/dist/server/api/src/coordination/agent-spawner-routes.js.map +0 -1
- package/dist/server/api/src/coordination/agent-spawner.d.ts +0 -187
- package/dist/server/api/src/coordination/agent-spawner.d.ts.map +0 -1
- package/dist/server/api/src/coordination/agent-spawner.js +0 -712
- package/dist/server/api/src/coordination/agent-spawner.js.map +0 -1
- package/dist/server/api/src/coordination/agents.d.ts +0 -13
- package/dist/server/api/src/coordination/agents.d.ts.map +0 -1
- package/dist/server/api/src/coordination/agents.js +0 -464
- package/dist/server/api/src/coordination/agents.js.map +0 -1
- package/dist/server/api/src/coordination/checkpoint-routes.d.ts +0 -33
- package/dist/server/api/src/coordination/checkpoint-routes.d.ts.map +0 -1
- package/dist/server/api/src/coordination/checkpoint-routes.js +0 -323
- package/dist/server/api/src/coordination/checkpoint-routes.js.map +0 -1
- package/dist/server/api/src/coordination/conflict-resolver.d.ts +0 -152
- package/dist/server/api/src/coordination/conflict-resolver.d.ts.map +0 -1
- package/dist/server/api/src/coordination/conflict-resolver.js +0 -502
- package/dist/server/api/src/coordination/conflict-resolver.js.map +0 -1
- package/dist/server/api/src/coordination/missions.d.ts +0 -9
- package/dist/server/api/src/coordination/missions.d.ts.map +0 -1
- package/dist/server/api/src/coordination/missions.js +0 -148
- package/dist/server/api/src/coordination/missions.js.map +0 -1
- package/dist/server/api/src/coordination/monitor.d.ts +0 -175
- package/dist/server/api/src/coordination/monitor.d.ts.map +0 -1
- package/dist/server/api/src/coordination/monitor.js +0 -410
- package/dist/server/api/src/coordination/monitor.js.map +0 -1
- package/dist/server/api/src/coordination/notifier.d.ts +0 -160
- package/dist/server/api/src/coordination/notifier.d.ts.map +0 -1
- package/dist/server/api/src/coordination/notifier.js +0 -422
- package/dist/server/api/src/coordination/notifier.js.map +0 -1
- package/dist/server/api/src/coordination/progress-tracker.d.ts +0 -98
- package/dist/server/api/src/coordination/progress-tracker.d.ts.map +0 -1
- package/dist/server/api/src/coordination/progress-tracker.js +0 -323
- package/dist/server/api/src/coordination/progress-tracker.js.map +0 -1
- package/dist/server/api/src/coordination/recovery-manager.d.ts +0 -135
- package/dist/server/api/src/coordination/recovery-manager.d.ts.map +0 -1
- package/dist/server/api/src/coordination/recovery-manager.js +0 -435
- package/dist/server/api/src/coordination/recovery-manager.js.map +0 -1
- package/dist/server/api/src/coordination/task-decomposer.d.ts +0 -90
- package/dist/server/api/src/coordination/task-decomposer.d.ts.map +0 -1
- package/dist/server/api/src/coordination/task-decomposer.js +0 -412
- package/dist/server/api/src/coordination/task-decomposer.js.map +0 -1
- package/dist/server/api/src/coordination/task-queue-routes.d.ts +0 -7
- package/dist/server/api/src/coordination/task-queue-routes.d.ts.map +0 -1
- package/dist/server/api/src/coordination/task-queue-routes.js +0 -266
- package/dist/server/api/src/coordination/task-queue-routes.js.map +0 -1
- package/dist/server/api/src/coordination/task-queue.d.ts +0 -104
- package/dist/server/api/src/coordination/task-queue.d.ts.map +0 -1
- package/dist/server/api/src/coordination/task-queue.js +0 -378
- package/dist/server/api/src/coordination/task-queue.js.map +0 -1
- package/dist/server/api/src/coordination/tasks.d.ts +0 -7
- package/dist/server/api/src/coordination/tasks.d.ts.map +0 -1
- package/dist/server/api/src/coordination/tasks.js +0 -59
- package/dist/server/api/src/coordination/tasks.js.map +0 -1
- package/dist/server/api/src/decomposition/cli.d.ts +0 -18
- package/dist/server/api/src/decomposition/cli.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/cli.js +0 -191
- package/dist/server/api/src/decomposition/cli.js.map +0 -1
- package/dist/server/api/src/decomposition/codebase-analyzer.d.ts +0 -59
- package/dist/server/api/src/decomposition/codebase-analyzer.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/codebase-analyzer.js +0 -274
- package/dist/server/api/src/decomposition/codebase-analyzer.js.map +0 -1
- package/dist/server/api/src/decomposition/dependency-resolver.d.ts +0 -68
- package/dist/server/api/src/decomposition/dependency-resolver.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/dependency-resolver.js +0 -261
- package/dist/server/api/src/decomposition/dependency-resolver.js.map +0 -1
- package/dist/server/api/src/decomposition/index.d.ts +0 -17
- package/dist/server/api/src/decomposition/index.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/index.js +0 -19
- package/dist/server/api/src/decomposition/index.js.map +0 -1
- package/dist/server/api/src/decomposition/parallelization.d.ts +0 -40
- package/dist/server/api/src/decomposition/parallelization.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/parallelization.js +0 -144
- package/dist/server/api/src/decomposition/parallelization.js.map +0 -1
- package/dist/server/api/src/decomposition/planner.d.ts +0 -84
- package/dist/server/api/src/decomposition/planner.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/planner.js +0 -415
- package/dist/server/api/src/decomposition/planner.js.map +0 -1
- package/dist/server/api/src/decomposition/routes.d.ts +0 -13
- package/dist/server/api/src/decomposition/routes.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/routes.js +0 -114
- package/dist/server/api/src/decomposition/routes.js.map +0 -1
- package/dist/server/api/src/decomposition/strategies.d.ts +0 -43
- package/dist/server/api/src/decomposition/strategies.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/strategies.js +0 -147
- package/dist/server/api/src/decomposition/strategies.js.map +0 -1
- package/dist/server/api/src/decomposition/types.d.ts +0 -1090
- package/dist/server/api/src/decomposition/types.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/types.js +0 -65
- package/dist/server/api/src/decomposition/types.js.map +0 -1
- package/dist/server/api/src/decomposition/validator.d.ts +0 -84
- package/dist/server/api/src/decomposition/validator.d.ts.map +0 -1
- package/dist/server/api/src/decomposition/validator.js +0 -314
- package/dist/server/api/src/decomposition/validator.js.map +0 -1
- package/dist/server/api/src/flightline/ctk.d.ts +0 -2
- package/dist/server/api/src/flightline/ctk.d.ts.map +0 -1
- package/dist/server/api/src/flightline/ctk.js +0 -114
- package/dist/server/api/src/flightline/ctk.js.map +0 -1
- package/dist/server/api/src/flightline/tech-orders.d.ts +0 -2
- package/dist/server/api/src/flightline/tech-orders.d.ts.map +0 -1
- package/dist/server/api/src/flightline/tech-orders.js +0 -74
- package/dist/server/api/src/flightline/tech-orders.js.map +0 -1
- package/dist/server/api/src/flightline/work-orders.d.ts +0 -2
- package/dist/server/api/src/flightline/work-orders.d.ts.map +0 -1
- package/dist/server/api/src/flightline/work-orders.js +0 -178
- package/dist/server/api/src/flightline/work-orders.js.map +0 -1
- package/dist/server/api/src/index.d.ts +0 -3
- package/dist/server/api/src/index.d.ts.map +0 -1
- package/dist/server/api/src/index.js +0 -192
- package/dist/server/api/src/index.js.map +0 -1
- package/dist/server/api/src/middleware/agent-validation.d.ts +0 -161
- package/dist/server/api/src/middleware/agent-validation.d.ts.map +0 -1
- package/dist/server/api/src/middleware/agent-validation.js +0 -112
- package/dist/server/api/src/middleware/agent-validation.js.map +0 -1
- package/dist/server/api/src/middleware/error-handler.d.ts +0 -8
- package/dist/server/api/src/middleware/error-handler.d.ts.map +0 -1
- package/dist/server/api/src/middleware/error-handler.js +0 -54
- package/dist/server/api/src/middleware/error-handler.js.map +0 -1
- package/dist/server/api/src/middleware/logger.d.ts +0 -8
- package/dist/server/api/src/middleware/logger.d.ts.map +0 -1
- package/dist/server/api/src/middleware/logger.js +0 -31
- package/dist/server/api/src/middleware/logger.js.map +0 -1
- package/dist/server/api/src/middleware/validation.d.ts +0 -322
- package/dist/server/api/src/middleware/validation.d.ts.map +0 -1
- package/dist/server/api/src/middleware/validation.js +0 -189
- package/dist/server/api/src/middleware/validation.js.map +0 -1
- package/dist/server/api/src/squawk/blocker-handler.d.ts +0 -111
- package/dist/server/api/src/squawk/blocker-handler.d.ts.map +0 -1
- package/dist/server/api/src/squawk/blocker-handler.js +0 -262
- package/dist/server/api/src/squawk/blocker-handler.js.map +0 -1
- package/dist/server/api/src/squawk/coordinator.d.ts +0 -2
- package/dist/server/api/src/squawk/coordinator.d.ts.map +0 -1
- package/dist/server/api/src/squawk/coordinator.js +0 -24
- package/dist/server/api/src/squawk/coordinator.js.map +0 -1
- package/dist/server/api/src/squawk/cursor.d.ts +0 -2
- package/dist/server/api/src/squawk/cursor.d.ts.map +0 -1
- package/dist/server/api/src/squawk/cursor.js +0 -55
- package/dist/server/api/src/squawk/cursor.js.map +0 -1
- package/dist/server/api/src/squawk/dependency-resolver.d.ts +0 -107
- package/dist/server/api/src/squawk/dependency-resolver.d.ts.map +0 -1
- package/dist/server/api/src/squawk/dependency-resolver.js +0 -324
- package/dist/server/api/src/squawk/dependency-resolver.js.map +0 -1
- package/dist/server/api/src/squawk/dispatch-orchestrator.d.ts +0 -117
- package/dist/server/api/src/squawk/dispatch-orchestrator.d.ts.map +0 -1
- package/dist/server/api/src/squawk/dispatch-orchestrator.js +0 -296
- package/dist/server/api/src/squawk/dispatch-orchestrator.js.map +0 -1
- package/dist/server/api/src/squawk/lock-coordinator.d.ts +0 -118
- package/dist/server/api/src/squawk/lock-coordinator.d.ts.map +0 -1
- package/dist/server/api/src/squawk/lock-coordinator.js +0 -279
- package/dist/server/api/src/squawk/lock-coordinator.js.map +0 -1
- package/dist/server/api/src/squawk/lock.d.ts +0 -2
- package/dist/server/api/src/squawk/lock.d.ts.map +0 -1
- package/dist/server/api/src/squawk/lock.js +0 -87
- package/dist/server/api/src/squawk/lock.js.map +0 -1
- package/dist/server/api/src/squawk/mailbox.d.ts +0 -2
- package/dist/server/api/src/squawk/mailbox.d.ts.map +0 -1
- package/dist/server/api/src/squawk/mailbox.js +0 -66
- package/dist/server/api/src/squawk/mailbox.js.map +0 -1
- package/dist/server/api/src/squawk/spawning.d.ts +0 -79
- package/dist/server/api/src/squawk/spawning.d.ts.map +0 -1
- package/dist/server/api/src/squawk/spawning.js +0 -226
- package/dist/server/api/src/squawk/spawning.js.map +0 -1
- package/dist/server/api/src/squawk/specialist-tools.d.ts +0 -206
- package/dist/server/api/src/squawk/specialist-tools.d.ts.map +0 -1
- package/dist/server/api/src/squawk/specialist-tools.js +0 -411
- package/dist/server/api/src/squawk/specialist-tools.js.map +0 -1
- package/dist/server/api/src/types/api.d.ts +0 -63
- package/dist/server/api/src/types/api.d.ts.map +0 -1
- package/dist/server/api/src/types/api.js +0 -5
- package/dist/server/api/src/types/api.js.map +0 -1
- package/dist/squawk/src/db/index.d.ts +0 -30
- package/dist/squawk/src/db/index.d.ts.map +0 -1
- package/dist/squawk/src/db/index.js +0 -329
- package/dist/squawk/src/db/index.js.map +0 -1
- package/dist/squawk/src/db/sqlite.d.ts +0 -31
- package/dist/squawk/src/db/sqlite.d.ts.map +0 -1
- package/dist/squawk/src/db/sqlite.js +0 -558
- package/dist/squawk/src/db/sqlite.js.map +0 -1
- package/dist/squawk/src/db/types.d.ts +0 -611
- package/dist/squawk/src/db/types.d.ts.map +0 -1
- package/dist/squawk/src/db/types.js +0 -4
- package/dist/squawk/src/db/types.js.map +0 -1
- package/dist/task-queue.js +0 -377
- package/dist/validation.js +0 -188
- package/e2e-integration.test.ts +0 -290
- package/integration.test.ts +0 -186
- package/phase1-integration.test.ts +0 -455
- package/phase2-verification.test.ts +0 -135
- package/server.log +0 -58
- package/src/agent-runner.js +0 -877
- package/src/coordination/agent-lifecycle.ts +0 -13
- package/src/coordination/agent-runner.ts +0 -479
- package/src/coordination/agent-spawner-routes.ts +0 -340
- package/src/coordination/agent-spawner.ts +0 -885
- package/src/coordination/agents.ts +0 -525
- package/src/coordination/checkpoint-routes.ts +0 -382
- package/src/coordination/conflict-resolver.ts +0 -640
- package/src/coordination/missions.ts +0 -219
- package/src/coordination/monitor.ts +0 -593
- package/src/coordination/notifier.ts +0 -547
- package/src/coordination/progress-tracker.ts +0 -410
- package/src/coordination/recovery-manager.ts +0 -531
- package/src/coordination/task-decomposer.ts +0 -491
- package/src/coordination/task-queue-routes.ts +0 -284
- package/src/coordination/task-queue.ts +0 -480
- package/src/coordination/tasks.ts +0 -72
- package/src/flightline/ctk.ts +0 -131
- package/src/flightline/tech-orders.ts +0 -85
- package/src/flightline/work-orders.ts +0 -202
- package/src/index.ts +0 -211
- package/src/middleware/agent-validation.ts +0 -130
- package/src/middleware/error-handler.ts +0 -59
- package/src/middleware/logger.ts +0 -37
- package/src/middleware/validation.ts +0 -235
- package/src/squawk/coordinator.ts +0 -26
- package/src/squawk/cursor.ts +0 -62
- package/src/squawk/lock.ts +0 -98
- package/src/squawk/mailbox.ts +0 -75
- package/src/types/api.ts +0 -71
- package/test-api.ts +0 -310
- package/test-enhanced-agents.ts +0 -428
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "wo_5a29168d-5fb4-41d7-8dac-1d1151d9248f",
|
|
3
|
-
"title": "Test Work Order",
|
|
4
|
-
"description": "A test work order created by the test script",
|
|
5
|
-
"status": "pending",
|
|
6
|
-
"priority": "high",
|
|
7
|
-
"created_at": "2026-01-04T12:27:33.909Z",
|
|
8
|
-
"updated_at": "2026-01-04T12:27:33.909Z",
|
|
9
|
-
"assigned_to": [
|
|
10
|
-
"specialist-1",
|
|
11
|
-
"specialist-2"
|
|
12
|
-
],
|
|
13
|
-
"cells": [],
|
|
14
|
-
"tech_orders": []
|
|
15
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "wo_6c8c38bb-17a1-4885-ada4-dbfc5cc12d7a",
|
|
3
|
-
"title": "Test Work Order",
|
|
4
|
-
"description": "A test work order created by the test script",
|
|
5
|
-
"status": "in_progress",
|
|
6
|
-
"priority": "critical",
|
|
7
|
-
"created_at": "2026-01-06T20:25:37.265Z",
|
|
8
|
-
"updated_at": "2026-01-06T20:25:37.271Z",
|
|
9
|
-
"assigned_to": [
|
|
10
|
-
"specialist-1",
|
|
11
|
-
"specialist-2"
|
|
12
|
-
],
|
|
13
|
-
"cells": [],
|
|
14
|
-
"tech_orders": []
|
|
15
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "wo_cadeb9b2-ea42-4491-b429-e2d467942b5c",
|
|
3
|
-
"title": "Test Work Order",
|
|
4
|
-
"description": "Verification test",
|
|
5
|
-
"status": "pending",
|
|
6
|
-
"priority": "high",
|
|
7
|
-
"created_at": "2026-01-04T12:51:38.399Z",
|
|
8
|
-
"updated_at": "2026-01-04T12:51:38.399Z",
|
|
9
|
-
"assigned_to": [],
|
|
10
|
-
"cells": [],
|
|
11
|
-
"tech_orders": []
|
|
12
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "wo_cc7b669c-16c4-4ef7-8a76-d1813219d0be",
|
|
3
|
-
"title": "Test Work Order",
|
|
4
|
-
"description": "A test work order created by the test script",
|
|
5
|
-
"status": "in_progress",
|
|
6
|
-
"priority": "critical",
|
|
7
|
-
"created_at": "2026-01-12T03:38:34.590Z",
|
|
8
|
-
"updated_at": "2026-01-12T03:38:34.596Z",
|
|
9
|
-
"assigned_to": [
|
|
10
|
-
"specialist-1",
|
|
11
|
-
"specialist-2"
|
|
12
|
-
],
|
|
13
|
-
"cells": [],
|
|
14
|
-
"tech_orders": []
|
|
15
|
-
}
|
package/dist/agent-lifecycle.js
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Lifecycle Management Methods
|
|
3
|
-
*
|
|
4
|
-
* Additional lifecycle management methods for AgentSpawner
|
|
5
|
-
*/
|
|
6
|
-
// These are additional methods that can be added to the AgentSpawner class
|
|
7
|
-
export class AgentLifecycleManager {
|
|
8
|
-
agents = new Map();
|
|
9
|
-
/**
|
|
10
|
-
* Update agent heartbeat
|
|
11
|
-
*/
|
|
12
|
-
async updateHeartbeat(agentId) {
|
|
13
|
-
const agent = this.agents.get(agentId);
|
|
14
|
-
if (!agent)
|
|
15
|
-
return;
|
|
16
|
-
agent.metadata = {
|
|
17
|
-
...agent.metadata,
|
|
18
|
-
lastHeartbeat: new Date().toISOString()
|
|
19
|
-
};
|
|
20
|
-
agent.updatedAt = new Date().toISOString();
|
|
21
|
-
this.agents.set(agentId, agent);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Log agent error
|
|
25
|
-
*/
|
|
26
|
-
async logError(agentId, error) {
|
|
27
|
-
const agent = this.agents.get(agentId);
|
|
28
|
-
if (!agent)
|
|
29
|
-
return;
|
|
30
|
-
const errors = agent.metadata?.errors || [];
|
|
31
|
-
const errorEntry = {
|
|
32
|
-
timestamp: new Date().toISOString(),
|
|
33
|
-
error,
|
|
34
|
-
count: 1
|
|
35
|
-
};
|
|
36
|
-
// Check if this error type already exists
|
|
37
|
-
const existingError = errors.find((e) => e.error === error);
|
|
38
|
-
if (existingError) {
|
|
39
|
-
existingError.count++;
|
|
40
|
-
existingError.timestamp = new Date().toISOString();
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
errors.push(errorEntry);
|
|
44
|
-
}
|
|
45
|
-
agent.metadata = {
|
|
46
|
-
...agent.metadata,
|
|
47
|
-
errors: errors.slice(-10) // Keep last 10 errors
|
|
48
|
-
};
|
|
49
|
-
agent.updatedAt = new Date().toISOString();
|
|
50
|
-
this.agents.set(agentId, agent);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Check agent health status
|
|
54
|
-
*/
|
|
55
|
-
async checkAgentHealth(agentId) {
|
|
56
|
-
const agent = this.agents.get(agentId);
|
|
57
|
-
if (!agent) {
|
|
58
|
-
return { healthy: false, issues: ['Agent not found'] };
|
|
59
|
-
}
|
|
60
|
-
const issues = [];
|
|
61
|
-
// Check if heartbeat is recent (within last 30 seconds)
|
|
62
|
-
if (agent.metadata?.lastHeartbeat) {
|
|
63
|
-
const lastHeartbeat = new Date(agent.metadata.lastHeartbeat).getTime();
|
|
64
|
-
const now = Date.now();
|
|
65
|
-
const heartbeatAge = (now - lastHeartbeat) / 1000;
|
|
66
|
-
if (heartbeatAge > 30) {
|
|
67
|
-
issues.push('Heartbeat timeout');
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
issues.push('No heartbeat received');
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
// Check error rate
|
|
75
|
-
errors = agent.metadata?.errors || [];
|
|
76
|
-
recentErrors = errors.filter((e) => {
|
|
77
|
-
const errorTime = new Date(e.timestamp).getTime();
|
|
78
|
-
const now = Date.now();
|
|
79
|
-
const errorAge = (now - errorTime) / 1000;
|
|
80
|
-
return errorAge < 300; // Last 5 minutes
|
|
81
|
-
});
|
|
82
|
-
if(recentErrors, length) { }
|
|
83
|
-
}
|
|
84
|
-
> 5;
|
|
85
|
-
{
|
|
86
|
-
issues.push('High error rate');
|
|
87
|
-
}
|
|
88
|
-
// Check uptime
|
|
89
|
-
if (agent.createdAt) {
|
|
90
|
-
const uptime = this.calculateUptime(agent.createdAt);
|
|
91
|
-
if (uptime > 3600) { // More than 1 hour
|
|
92
|
-
// Check if too long running without reset
|
|
93
|
-
issues.push('Long uptime, consider restart');
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
healthy: issues.length === 0,
|
|
98
|
-
issues
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Restart agent
|
|
102
|
-
*/
|
|
103
|
-
async;
|
|
104
|
-
restartAgent(agentId, string);
|
|
105
|
-
Promise < void > {
|
|
106
|
-
const: agent = this.agents.get(agentId),
|
|
107
|
-
if(, agent) {
|
|
108
|
-
throw new Error(`Agent not found: ${agentId}`);
|
|
109
|
-
},
|
|
110
|
-
try: {
|
|
111
|
-
// Terminate current agent
|
|
112
|
-
if(agent) { }, : .pid
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
{
|
|
116
|
-
process.kill(agent.pid, 'SIGTERM');
|
|
117
|
-
// Wait for graceful shutdown
|
|
118
|
-
await new Promise(resolve => setTimeout(resolve, 5000));
|
|
119
|
-
// Force kill if still running
|
|
120
|
-
try {
|
|
121
|
-
process.kill(agent.pid, 0);
|
|
122
|
-
}
|
|
123
|
-
catch {
|
|
124
|
-
// Process already terminated
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
// Spawn new agent with same configuration
|
|
128
|
-
const spawnRequest = agent.metadata?.spawnRequest;
|
|
129
|
-
if (spawnRequest) {
|
|
130
|
-
// Update metadata for restart
|
|
131
|
-
agent.metadata = {
|
|
132
|
-
...agent.metadata,
|
|
133
|
-
restartCount: (agent.metadata?.restartCount || 0) + 1,
|
|
134
|
-
lastRestart: new Date().toISOString()
|
|
135
|
-
};
|
|
136
|
-
console.log(`✓ Agent restarted: ${agentId} (attempt ${agent.metadata.restartCount})`);
|
|
137
|
-
}
|
|
138
|
-
try { }
|
|
139
|
-
catch (error) {
|
|
140
|
-
throw new Error(`Agent restart failed: ${error.message}`);
|
|
141
|
-
}
|
|
142
|
-
calculateUptime(createdAt, string);
|
|
143
|
-
number;
|
|
144
|
-
{
|
|
145
|
-
const created = new Date(createdAt).getTime();
|
|
146
|
-
const now = Date.now();
|
|
147
|
-
return Math.floor((now - created) / 1000);
|
|
148
|
-
}
|
package/dist/agent-spawner.js
DELETED
|
@@ -1,460 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent Spawner for FleetTools Coordination System
|
|
3
|
-
*
|
|
4
|
-
* Manages agent lifecycle: spawning, monitoring, and termination
|
|
5
|
-
* Integrates with Squawk mailbox system for coordination
|
|
6
|
-
*/
|
|
7
|
-
import { randomUUID } from 'node:crypto';
|
|
8
|
-
import path from 'node:path';
|
|
9
|
-
// Import types from coordination module (using local definition to avoid path issues)
|
|
10
|
-
export var AgentType;
|
|
11
|
-
(function (AgentType) {
|
|
12
|
-
AgentType["FRONTEND"] = "frontend";
|
|
13
|
-
AgentType["BACKEND"] = "backend";
|
|
14
|
-
AgentType["TESTING"] = "testing";
|
|
15
|
-
AgentType["DOCUMENTATION"] = "documentation";
|
|
16
|
-
AgentType["SECURITY"] = "security";
|
|
17
|
-
AgentType["PERFORMANCE"] = "performance";
|
|
18
|
-
})(AgentType || (AgentType = {}));
|
|
19
|
-
export var AgentStatus;
|
|
20
|
-
(function (AgentStatus) {
|
|
21
|
-
AgentStatus["SPAWNING"] = "spawning";
|
|
22
|
-
AgentStatus["RUNNING"] = "running";
|
|
23
|
-
AgentStatus["IDLE"] = "idle";
|
|
24
|
-
AgentStatus["BUSY"] = "busy";
|
|
25
|
-
AgentStatus["ERROR"] = "error";
|
|
26
|
-
AgentStatus["TERMINATED"] = "terminated";
|
|
27
|
-
AgentStatus["FAILED"] = "failed";
|
|
28
|
-
})(AgentStatus || (AgentStatus = {}));
|
|
29
|
-
export class AgentSpawner {
|
|
30
|
-
agents = new Map();
|
|
31
|
-
mailboxPath;
|
|
32
|
-
constructor(mailboxPath) {
|
|
33
|
-
this.mailboxPath = mailboxPath || path.join(process.cwd(), '.flightline', 'mailboxes');
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Spawn a new agent with timeout and retry logic
|
|
37
|
-
*/
|
|
38
|
-
async spawn(request) {
|
|
39
|
-
const agentId = `agt_${randomUUID()}`;
|
|
40
|
-
const mailboxId = `mbx_${randomUUID()}`;
|
|
41
|
-
const timeout = request.config?.timeout || 300000; // 5 minutes default
|
|
42
|
-
const maxRetries = request.config?.retries || 3;
|
|
43
|
-
const agent = {
|
|
44
|
-
id: agentId,
|
|
45
|
-
type: request.type,
|
|
46
|
-
status: AgentStatus.SPAWNING,
|
|
47
|
-
mailboxId,
|
|
48
|
-
createdAt: new Date().toISOString(),
|
|
49
|
-
updatedAt: new Date().toISOString(),
|
|
50
|
-
metadata: {
|
|
51
|
-
...request.metadata,
|
|
52
|
-
spawnRequest: request,
|
|
53
|
-
spawnAttempts: 0,
|
|
54
|
-
maxRetries
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
let lastError = null;
|
|
58
|
-
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
59
|
-
try {
|
|
60
|
-
agent.metadata.spawnAttempts = attempt;
|
|
61
|
-
agent.updatedAt = new Date().toISOString();
|
|
62
|
-
// Create mailbox for agent
|
|
63
|
-
await this.createMailbox(mailboxId, agentId);
|
|
64
|
-
// Spawn agent process with timeout
|
|
65
|
-
const pid = await this.executeAgentSpawnWithTimeout(agent, request, timeout);
|
|
66
|
-
agent.pid = pid;
|
|
67
|
-
agent.status = AgentStatus.RUNNING;
|
|
68
|
-
agent.updatedAt = new Date().toISOString();
|
|
69
|
-
// Store agent
|
|
70
|
-
this.agents.set(agentId, agent);
|
|
71
|
-
console.log(`✓ Agent spawned: ${agentId} (${request.type}) - attempt ${attempt}`);
|
|
72
|
-
return agent;
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
lastError = error;
|
|
76
|
-
agent.status = AgentStatus.FAILED;
|
|
77
|
-
agent.updatedAt = new Date().toISOString();
|
|
78
|
-
console.error(`✗ Agent spawn attempt ${attempt} failed:`, error.message);
|
|
79
|
-
if (attempt < maxRetries) {
|
|
80
|
-
// Wait before retry
|
|
81
|
-
const retryDelay = Math.min(5000 * attempt, 15000); // Exponential backoff
|
|
82
|
-
console.log(`Retrying agent spawn in ${retryDelay}ms...`);
|
|
83
|
-
await new Promise(resolve => setTimeout(resolve, retryDelay));
|
|
84
|
-
// Clean up failed attempt
|
|
85
|
-
try {
|
|
86
|
-
await this.cleanupFailedSpawn(agentId);
|
|
87
|
-
}
|
|
88
|
-
catch (cleanupError) {
|
|
89
|
-
console.error(`Cleanup failed:`, cleanupError.message);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
// All attempts failed
|
|
95
|
-
agent.status = AgentStatus.FAILED;
|
|
96
|
-
agent.updatedAt = new Date().toISOString();
|
|
97
|
-
agent.metadata.lastError = lastError?.message || 'Unknown error';
|
|
98
|
-
this.agents.set(agentId, agent);
|
|
99
|
-
console.error(`✗ Agent spawn failed after ${maxRetries} attempts: ${agentId}`);
|
|
100
|
-
throw new Error(`Agent spawn failed after ${maxRetries} attempts: ${lastError?.message}`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
;
|
|
104
|
-
try {
|
|
105
|
-
// Create mailbox for agent
|
|
106
|
-
await this.createMailbox(mailboxId, agentId);
|
|
107
|
-
// Spawn the agent process
|
|
108
|
-
const pid = await this.executeAgentSpawn(agent, request);
|
|
109
|
-
agent.pid = pid;
|
|
110
|
-
agent.status = AgentStatus.RUNNING;
|
|
111
|
-
agent.updatedAt = new Date().toISOString();
|
|
112
|
-
// Store agent
|
|
113
|
-
this.agents.set(agentId, agent);
|
|
114
|
-
console.log(`✓ Agent spawned: ${agentId} (${request.type})`);
|
|
115
|
-
return agent;
|
|
116
|
-
}
|
|
117
|
-
catch (error) {
|
|
118
|
-
agent.status = AgentStatus.FAILED;
|
|
119
|
-
agent.updatedAt = new Date().toISOString();
|
|
120
|
-
this.agents.set(agentId, agent);
|
|
121
|
-
console.error(`✗ Failed to spawn agent ${agentId}:`, error.message);
|
|
122
|
-
throw new Error(`Agent spawn failed: ${error.message}`);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Monitor agent status and health with comprehensive checks
|
|
126
|
-
*/
|
|
127
|
-
async;
|
|
128
|
-
monitor(agentId, string);
|
|
129
|
-
Promise < AgentMonitor > {
|
|
130
|
-
const: agent = this.agents.get(agentId),
|
|
131
|
-
if(, agent) {
|
|
132
|
-
throw new Error(`Agent not found: ${agentId}`);
|
|
133
|
-
},
|
|
134
|
-
const: monitor, AgentMonitor = {
|
|
135
|
-
status: agent.status,
|
|
136
|
-
uptime: this.calculateUptime(agent.createdAt),
|
|
137
|
-
lastHeartbeat: await this.getLastHeartbeat(agentId),
|
|
138
|
-
resourceUsage: await this.getAgentResourceUsage(agentId),
|
|
139
|
-
errors: await this.getAgentErrors(agentId)
|
|
140
|
-
},
|
|
141
|
-
// Check if process is still running
|
|
142
|
-
if(agent) { }, : .pid
|
|
143
|
-
};
|
|
144
|
-
{
|
|
145
|
-
try {
|
|
146
|
-
process.kill(agent.pid, 0); // Signal 0 doesn't kill, just checks
|
|
147
|
-
monitor.status = AgentStatus.RUNNING;
|
|
148
|
-
// Update agent status if different
|
|
149
|
-
if (agent.status !== AgentStatus.RUNNING) {
|
|
150
|
-
agent.status = AgentStatus.RUNNING;
|
|
151
|
-
agent.updatedAt = new Date().toISOString();
|
|
152
|
-
this.agents.set(agentId, agent);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
catch {
|
|
156
|
-
monitor.status = AgentStatus.TERMINATED;
|
|
157
|
-
agent.status = AgentStatus.TERMINATED;
|
|
158
|
-
agent.updatedAt = new Date().toISOString();
|
|
159
|
-
this.agents.set(agentId, agent);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
// Health assessment
|
|
163
|
-
if (monitor.errors && monitor.errors.length > 5) {
|
|
164
|
-
monitor.status = AgentStatus.ERROR;
|
|
165
|
-
agent.status = AgentStatus.ERROR;
|
|
166
|
-
agent.updatedAt = new Date().toISOString();
|
|
167
|
-
this.agents.set(agentId, agent);
|
|
168
|
-
}
|
|
169
|
-
return monitor;
|
|
170
|
-
/**
|
|
171
|
-
* Terminate an agent
|
|
172
|
-
*/
|
|
173
|
-
async;
|
|
174
|
-
terminate(agentId, string, graceful = true);
|
|
175
|
-
Promise < void > {
|
|
176
|
-
const: agent = this.agents.get(agentId),
|
|
177
|
-
if(, agent) {
|
|
178
|
-
throw new Error(`Agent not found: ${agentId}`);
|
|
179
|
-
},
|
|
180
|
-
console, : .log(`Terminating agent: ${agentId} (${agent.type})`),
|
|
181
|
-
try: {
|
|
182
|
-
if(agent) { }, : .pid
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
{
|
|
186
|
-
if (graceful) {
|
|
187
|
-
// Send SIGTERM for graceful shutdown
|
|
188
|
-
process.kill(agent.pid, 'SIGTERM');
|
|
189
|
-
// Wait for graceful shutdown
|
|
190
|
-
await new Promise(resolve => setTimeout(resolve, 5000));
|
|
191
|
-
// Check if process is still running
|
|
192
|
-
try {
|
|
193
|
-
process.kill(agent.pid, 0);
|
|
194
|
-
// Force kill if still running
|
|
195
|
-
process.kill(agent.pid, 'SIGKILL');
|
|
196
|
-
console.log(`⚠️ Force killed agent: ${agentId}`);
|
|
197
|
-
}
|
|
198
|
-
catch {
|
|
199
|
-
// Process already terminated
|
|
200
|
-
console.log(`✓ Agent terminated gracefully: ${agentId}`);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
// Force kill immediately
|
|
205
|
-
process.kill(agent.pid, 'SIGKILL');
|
|
206
|
-
console.log(`✓ Agent terminated: ${agentId}`);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
// Cleanup mailbox
|
|
210
|
-
await this.cleanupMailbox(agent.mailboxId);
|
|
211
|
-
// Update agent status
|
|
212
|
-
agent.status = AgentStatus.TERMINATED;
|
|
213
|
-
agent.updatedAt = new Date().toISOString();
|
|
214
|
-
console.log(`✓ Agent cleanup complete: ${agentId}`);
|
|
215
|
-
try { }
|
|
216
|
-
catch (error) {
|
|
217
|
-
agent.status = AgentStatus.ERROR;
|
|
218
|
-
agent.updatedAt = new Date().toISOString();
|
|
219
|
-
console.error(`✗ Error terminating agent ${agentId}:`, error.message);
|
|
220
|
-
throw new Error(`Agent termination failed: ${error.message}`);
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Get all active agents
|
|
224
|
-
*/
|
|
225
|
-
getActiveAgents();
|
|
226
|
-
AgentHandle[];
|
|
227
|
-
{
|
|
228
|
-
return Array.from(this.agents.values()).filter(agent => agent.status === AgentStatus.RUNNING ||
|
|
229
|
-
agent.status === AgentStatus.IDLE ||
|
|
230
|
-
agent.status === AgentStatus.BUSY);
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Get agents by type
|
|
234
|
-
*/
|
|
235
|
-
getAgentsByType(type, AgentType);
|
|
236
|
-
AgentHandle[];
|
|
237
|
-
{
|
|
238
|
-
return Array.from(this.agents.values()).filter(agent => agent.type === type);
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Get agent by ID
|
|
242
|
-
*/
|
|
243
|
-
getAgent(agentId, string);
|
|
244
|
-
AgentHandle | undefined;
|
|
245
|
-
{
|
|
246
|
-
return this.agents.get(agentId);
|
|
247
|
-
}
|
|
248
|
-
async;
|
|
249
|
-
createMailbox(mailboxId, string, agentId, string);
|
|
250
|
-
Promise < void > {
|
|
251
|
-
const: mailboxDir = path.join(this.mailboxPath, mailboxId),
|
|
252
|
-
// Create mailbox directory
|
|
253
|
-
await, this: .ensureDirectory(mailboxDir),
|
|
254
|
-
// Create mailbox manifest
|
|
255
|
-
const: manifest = {
|
|
256
|
-
id: mailboxId,
|
|
257
|
-
agentId,
|
|
258
|
-
createdAt: new Date().toISOString(),
|
|
259
|
-
type: 'agent-mailbox'
|
|
260
|
-
},
|
|
261
|
-
const: manifestPath = path.join(mailboxDir, 'manifest.json'),
|
|
262
|
-
await, this: .writeFile(manifestPath, JSON.stringify(manifest, null, 2))
|
|
263
|
-
};
|
|
264
|
-
async;
|
|
265
|
-
cleanupMailbox(mailboxId, string);
|
|
266
|
-
Promise < void > {
|
|
267
|
-
const: mailboxDir = path.join(this.mailboxPath, mailboxId),
|
|
268
|
-
try: {
|
|
269
|
-
await, this: .removeDirectory(mailboxDir),
|
|
270
|
-
console, : .log(`✓ Cleaned up mailbox: ${mailboxId}`)
|
|
271
|
-
}, catch(error) {
|
|
272
|
-
console.error(`⚠️ Failed to cleanup mailbox ${mailboxId}:`, error.message);
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
async;
|
|
276
|
-
executeAgentSpawn(agent, AgentHandle, request, AgentSpawnRequest);
|
|
277
|
-
Promise < number > {
|
|
278
|
-
// This is a placeholder implementation
|
|
279
|
-
// In a real system, this would spawn the actual agent process
|
|
280
|
-
// For now, we'll simulate with a child process
|
|
281
|
-
const: { spawn } = await import('node:child_process'),
|
|
282
|
-
return: new Promise((resolve, reject) => {
|
|
283
|
-
const args = [
|
|
284
|
-
'--agent-id', agent.id,
|
|
285
|
-
'--agent-type', agent.type,
|
|
286
|
-
'--mailbox-id', agent.mailboxId,
|
|
287
|
-
'--task', request.task || ''
|
|
288
|
-
];
|
|
289
|
-
if (request.config?.timeout) {
|
|
290
|
-
args.push('--timeout', request.config.timeout.toString());
|
|
291
|
-
}
|
|
292
|
-
const childProcess = spawn('node', ['src/agent-runner.js', ...args], {
|
|
293
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
294
|
-
detached: false
|
|
295
|
-
});
|
|
296
|
-
childProcess.on('spawn', () => {
|
|
297
|
-
console.log(`Agent process spawned with PID: ${childProcess.pid}`);
|
|
298
|
-
resolve(childProcess.pid);
|
|
299
|
-
});
|
|
300
|
-
childProcess.on('error', (error) => {
|
|
301
|
-
console.error(`Failed to spawn agent process:`, error);
|
|
302
|
-
reject(error);
|
|
303
|
-
});
|
|
304
|
-
// Handle agent output
|
|
305
|
-
if (childProcess.stdout) {
|
|
306
|
-
childProcess.stdout.on('data', (data) => {
|
|
307
|
-
console.log(`[${agent.id}] ${data.toString().trim()}`);
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
if (childProcess.stderr) {
|
|
311
|
-
childProcess.stderr.on('data', (data) => {
|
|
312
|
-
console.error(`[${agent.id}] ERROR: ${data.toString().trim()}`);
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
childProcess.on('close', (code) => {
|
|
316
|
-
if (code !== 0) {
|
|
317
|
-
console.log(`Agent ${agent.id} exited with code: ${code}`);
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
})
|
|
321
|
-
};
|
|
322
|
-
async;
|
|
323
|
-
executeAgentSpawnWithTimeout(agent, AgentHandle, request, AgentSpawnRequest, timeout, number);
|
|
324
|
-
Promise < number > {
|
|
325
|
-
return: Promise.race([
|
|
326
|
-
this.executeAgentSpawn(agent, request),
|
|
327
|
-
new Promise((_, reject) => setTimeout(() => reject(new Error('Agent spawn timeout')), timeout))
|
|
328
|
-
])
|
|
329
|
-
};
|
|
330
|
-
async;
|
|
331
|
-
cleanupFailedSpawn(agentId, string);
|
|
332
|
-
Promise < void > {
|
|
333
|
-
try: {
|
|
334
|
-
// Terminate any existing process
|
|
335
|
-
const: agent = this.agents.get(agentId),
|
|
336
|
-
if(agent, pid) {
|
|
337
|
-
try {
|
|
338
|
-
process.kill(agent.pid, 'SIGKILL');
|
|
339
|
-
console.log(`✓ Cleaned up process ${agent.pid}`);
|
|
340
|
-
}
|
|
341
|
-
catch {
|
|
342
|
-
// Process already terminated
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
// Cleanup mailbox
|
|
346
|
-
,
|
|
347
|
-
// Cleanup mailbox
|
|
348
|
-
const: agentHandle = this.agents.get(agentId),
|
|
349
|
-
if(agentHandle, mailboxId) {
|
|
350
|
-
await this.cleanupMailbox(agentHandle.mailboxId);
|
|
351
|
-
}
|
|
352
|
-
}, catch(error) {
|
|
353
|
-
console.error(`Cleanup error for ${agentId}:`, error.message);
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
async;
|
|
357
|
-
getLastHeartbeat(agentId, string);
|
|
358
|
-
Promise < string | undefined > {
|
|
359
|
-
// Placeholder: In real implementation, read from Squawk mailbox
|
|
360
|
-
return: new Date().toISOString()
|
|
361
|
-
};
|
|
362
|
-
async;
|
|
363
|
-
getAgentErrors(agentId, string);
|
|
364
|
-
Promise < Array < { timestamp: string, error: string, count: number } >> {
|
|
365
|
-
// Placeholder: In real implementation, read from error logs or database
|
|
366
|
-
const: agent = this.agents.get(agentId),
|
|
367
|
-
if(agent, metadata, errors) {
|
|
368
|
-
return agent.metadata.errors;
|
|
369
|
-
},
|
|
370
|
-
return: []
|
|
371
|
-
};
|
|
372
|
-
async;
|
|
373
|
-
getAgentResourceUsage(agentId, string);
|
|
374
|
-
Promise < { memory: number, cpu: number } | undefined > {
|
|
375
|
-
// Placeholder: In real implementation, get from process monitoring
|
|
376
|
-
const: agent = this.agents.get(agentId),
|
|
377
|
-
if(agent, pid) {
|
|
378
|
-
try {
|
|
379
|
-
// This would use system monitoring APIs in a real implementation
|
|
380
|
-
// For now, return simulated values
|
|
381
|
-
return {
|
|
382
|
-
memory: Math.floor(Math.random() * 500) + 100, // MB
|
|
383
|
-
cpu: Math.floor(Math.random() * 80) + 10 // percentage
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
catch {
|
|
387
|
-
return undefined;
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
return: undefined
|
|
391
|
-
};
|
|
392
|
-
/**
|
|
393
|
-
* Update agent heartbeat
|
|
394
|
-
*/
|
|
395
|
-
async;
|
|
396
|
-
updateHeartbeat(agentId, string);
|
|
397
|
-
Promise < void > {
|
|
398
|
-
const: agent = this.agents.get(agentId),
|
|
399
|
-
if(, agent) { }, return: ,
|
|
400
|
-
agent, : .metadata = {
|
|
401
|
-
...agent.metadata,
|
|
402
|
-
lastHeartbeat: new Date().toISOString()
|
|
403
|
-
},
|
|
404
|
-
agent, : .updatedAt = new Date().toISOString(),
|
|
405
|
-
this: .agents.set(agentId, agent)
|
|
406
|
-
};
|
|
407
|
-
/**
|
|
408
|
-
* Log agent error
|
|
409
|
-
*/
|
|
410
|
-
async;
|
|
411
|
-
logError(agentId, string, error, string);
|
|
412
|
-
Promise < void > {
|
|
413
|
-
const: agent = this.agents.get(agentId),
|
|
414
|
-
if(, agent) { }, return: ,
|
|
415
|
-
const: errors = agent.metadata?.errors || [],
|
|
416
|
-
const: errorEntry = {
|
|
417
|
-
timestamp: new Date().toISOString(),
|
|
418
|
-
error,
|
|
419
|
-
count: 1
|
|
420
|
-
},
|
|
421
|
-
// Check if this error type already exists
|
|
422
|
-
const: existingError = errors.find(e => e.error === error),
|
|
423
|
-
if(existingError) {
|
|
424
|
-
existingError.count++;
|
|
425
|
-
existingError.timestamp = new Date().toISOString();
|
|
426
|
-
}, else: {
|
|
427
|
-
errors, : .push(errorEntry)
|
|
428
|
-
},
|
|
429
|
-
agent, : .metadata = {
|
|
430
|
-
...agent.metadata,
|
|
431
|
-
errors: errors.slice(-10) // Keep last 10 errors
|
|
432
|
-
},
|
|
433
|
-
agent, : .updatedAt = new Date().toISOString(),
|
|
434
|
-
this: .agents.set(agentId, agent)
|
|
435
|
-
};
|
|
436
|
-
calculateUptime(createdAt, string);
|
|
437
|
-
number;
|
|
438
|
-
{
|
|
439
|
-
const created = new Date(createdAt).getTime();
|
|
440
|
-
const now = Date.now();
|
|
441
|
-
return Math.floor((now - created) / 1000);
|
|
442
|
-
}
|
|
443
|
-
async;
|
|
444
|
-
ensureDirectory(dirPath, string);
|
|
445
|
-
Promise < void > {
|
|
446
|
-
const: { mkdir } = await import('node:fs/promises'),
|
|
447
|
-
await
|
|
448
|
-
};
|
|
449
|
-
async;
|
|
450
|
-
writeFile(filePath, string, content, string);
|
|
451
|
-
Promise < void > {
|
|
452
|
-
const: { writeFile } = await import('node:fs/promises'),
|
|
453
|
-
await
|
|
454
|
-
};
|
|
455
|
-
async;
|
|
456
|
-
removeDirectory(dirPath, string);
|
|
457
|
-
Promise < void > {
|
|
458
|
-
const: { rm } = await import('node:fs/promises'),
|
|
459
|
-
await
|
|
460
|
-
};
|