@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,547 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Notification System for FleetTools Coordination
|
|
3
|
-
*
|
|
4
|
-
* Handles mission completion notifications and event delivery
|
|
5
|
-
* Integrates with Squawk for message passing
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export interface NotificationConfig {
|
|
9
|
-
squawkUrl?: string;
|
|
10
|
-
notificationRetention: number; // days
|
|
11
|
-
batchNotifications: boolean;
|
|
12
|
-
batchInterval: number; // milliseconds
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface Notification {
|
|
16
|
-
id: string;
|
|
17
|
-
type: 'mission_completed' | 'mission_failed' | 'agent_terminated' | 'conflict_resolved' | 'system_alert';
|
|
18
|
-
priority: 'low' | 'medium' | 'high' | 'critical';
|
|
19
|
-
title: string;
|
|
20
|
-
message: string;
|
|
21
|
-
metadata: Record<string, any>;
|
|
22
|
-
timestamp: string;
|
|
23
|
-
delivered: boolean;
|
|
24
|
-
deliveredAt?: string;
|
|
25
|
-
recipients?: string[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface MissionCompletionData {
|
|
29
|
-
missionId: string;
|
|
30
|
-
title: string;
|
|
31
|
-
status: 'success' | 'partial' | 'failed';
|
|
32
|
-
duration: number; // milliseconds
|
|
33
|
-
completedTasks: number;
|
|
34
|
-
totalTasks: number;
|
|
35
|
-
participatingAgents: string[];
|
|
36
|
-
summary?: string;
|
|
37
|
-
metrics?: Record<string, number>;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface NotificationRecipient {
|
|
41
|
-
id: string;
|
|
42
|
-
type: 'user' | 'agent' | 'system';
|
|
43
|
-
contactInfo: {
|
|
44
|
-
email?: string;
|
|
45
|
-
webhook?: string;
|
|
46
|
-
squawkMailbox?: string;
|
|
47
|
-
};
|
|
48
|
-
preferences: {
|
|
49
|
-
missionUpdates: boolean;
|
|
50
|
-
conflicts: boolean;
|
|
51
|
-
systemAlerts: boolean;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export class Notifier {
|
|
56
|
-
private config: NotificationConfig;
|
|
57
|
-
private notifications: Map<string, Notification> = new Map();
|
|
58
|
-
private recipients: Map<string, NotificationRecipient> = new Map();
|
|
59
|
-
private batchTimer?: ReturnType<typeof setInterval>;
|
|
60
|
-
private pendingNotifications: Notification[] = [];
|
|
61
|
-
|
|
62
|
-
constructor(config: Partial<NotificationConfig> = {}) {
|
|
63
|
-
this.config = {
|
|
64
|
-
squawkUrl: process.env.SQUAWK_URL || 'http://localhost:3002',
|
|
65
|
-
notificationRetention: 7,
|
|
66
|
-
batchNotifications: true,
|
|
67
|
-
batchInterval: 30000, // 30 seconds
|
|
68
|
-
...config
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
console.log('โ Notifier initialized');
|
|
72
|
-
|
|
73
|
-
if (this.config.batchNotifications) {
|
|
74
|
-
this.startBatchProcessing();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Send mission completion notification
|
|
80
|
-
*/
|
|
81
|
-
async notifyMissionCompleted(completionData: MissionCompletionData): Promise<void> {
|
|
82
|
-
const notification = this.createNotification('mission_completed', {
|
|
83
|
-
priority: completionData.status === 'failed' ? 'high' : 'medium',
|
|
84
|
-
title: `Mission ${completionData.status}: ${completionData.title}`,
|
|
85
|
-
message: this.formatMissionCompletionMessage(completionData),
|
|
86
|
-
metadata: {
|
|
87
|
-
missionId: completionData.missionId,
|
|
88
|
-
missionTitle: completionData.title,
|
|
89
|
-
completionStatus: completionData.status,
|
|
90
|
-
duration: completionData.duration,
|
|
91
|
-
taskMetrics: {
|
|
92
|
-
completed: completionData.completedTasks,
|
|
93
|
-
total: completionData.totalTasks,
|
|
94
|
-
percentage: Math.round((completionData.completedTasks / completionData.totalTasks) * 100)
|
|
95
|
-
},
|
|
96
|
-
agentCount: completionData.participatingAgents.length,
|
|
97
|
-
metrics: completionData.metrics
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
await this.deliverNotification(notification);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Send agent termination notification
|
|
106
|
-
*/
|
|
107
|
-
async notifyAgentTerminated(agentId: string, reason: string, exitCode?: number): Promise<void> {
|
|
108
|
-
const notification = this.createNotification('agent_terminated', {
|
|
109
|
-
priority: reason === 'error' ? 'high' : 'medium',
|
|
110
|
-
title: `Agent terminated: ${agentId}`,
|
|
111
|
-
message: `Agent ${agentId} has terminated due to: ${reason}${exitCode ? ` (exit code: ${exitCode})` : ''}`,
|
|
112
|
-
metadata: {
|
|
113
|
-
agentId,
|
|
114
|
-
terminationReason: reason,
|
|
115
|
-
exitCode,
|
|
116
|
-
timestamp: new Date().toISOString()
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
await this.deliverNotification(notification);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Send conflict resolution notification
|
|
125
|
-
*/
|
|
126
|
-
async notifyConflictResolved(conflictId: string, resolution: string, agents: string[]): Promise<void> {
|
|
127
|
-
const notification = this.createNotification('conflict_resolved', {
|
|
128
|
-
priority: 'medium',
|
|
129
|
-
title: `Conflict resolved: ${conflictId}`,
|
|
130
|
-
message: `Conflict ${conflictId} has been resolved using strategy: ${resolution}`,
|
|
131
|
-
metadata: {
|
|
132
|
-
conflictId,
|
|
133
|
-
resolution,
|
|
134
|
-
affectedAgents: agents,
|
|
135
|
-
resolvedAt: new Date().toISOString()
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
await this.deliverNotification(notification);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Send system alert notification
|
|
144
|
-
*/
|
|
145
|
-
async notifySystemAlert(alertType: string, message: string, severity: 'low' | 'medium' | 'high' | 'critical'): Promise<void> {
|
|
146
|
-
const notification = this.createNotification('system_alert', {
|
|
147
|
-
priority: severity,
|
|
148
|
-
title: `System Alert: ${alertType}`,
|
|
149
|
-
message,
|
|
150
|
-
metadata: {
|
|
151
|
-
alertType,
|
|
152
|
-
severity,
|
|
153
|
-
timestamp: new Date().toISOString(),
|
|
154
|
-
component: 'coordination_system'
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
await this.deliverNotification(notification);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Register notification recipient
|
|
163
|
-
*/
|
|
164
|
-
registerRecipient(recipient: NotificationRecipient): void {
|
|
165
|
-
this.recipients.set(recipient.id, recipient);
|
|
166
|
-
console.log(`โ Registered notification recipient: ${recipient.id} (${recipient.type})`);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Unregister notification recipient
|
|
171
|
-
*/
|
|
172
|
-
unregisterRecipient(recipientId: string): void {
|
|
173
|
-
this.recipients.delete(recipientId);
|
|
174
|
-
console.log(`โ Unregistered notification recipient: ${recipientId}`);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Get pending notifications for recipient
|
|
179
|
-
*/
|
|
180
|
-
getPendingNotifications(recipientId: string): Notification[] {
|
|
181
|
-
return Array.from(this.notifications.values()).filter(notification =>
|
|
182
|
-
!notification.delivered &&
|
|
183
|
-
(!notification.recipients || notification.recipients.includes(recipientId))
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Mark notification as delivered
|
|
189
|
-
*/
|
|
190
|
-
markAsDelivered(notificationId: string): void {
|
|
191
|
-
const notification = this.notifications.get(notificationId);
|
|
192
|
-
if (notification) {
|
|
193
|
-
notification.delivered = true;
|
|
194
|
-
notification.deliveredAt = new Date().toISOString();
|
|
195
|
-
this.notifications.set(notificationId, notification);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Create a notification object
|
|
201
|
-
*/
|
|
202
|
-
private createNotification(
|
|
203
|
-
type: Notification['type'],
|
|
204
|
-
options: {
|
|
205
|
-
priority: Notification['priority'];
|
|
206
|
-
title: string;
|
|
207
|
-
message: string;
|
|
208
|
-
metadata: Record<string, any>;
|
|
209
|
-
recipients?: string[];
|
|
210
|
-
}
|
|
211
|
-
): Notification {
|
|
212
|
-
const notification: Notification = {
|
|
213
|
-
id: `notif_${Date.now()}_${Math.random().toString(36).substr(2, 6)}`,
|
|
214
|
-
type,
|
|
215
|
-
priority: options.priority,
|
|
216
|
-
title: options.title,
|
|
217
|
-
message: options.message,
|
|
218
|
-
metadata: options.metadata,
|
|
219
|
-
timestamp: new Date().toISOString(),
|
|
220
|
-
delivered: false,
|
|
221
|
-
recipients: options.recipients
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
this.notifications.set(notification.id, notification);
|
|
225
|
-
return notification;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Deliver notification through appropriate channels
|
|
230
|
-
*/
|
|
231
|
-
private async deliverNotification(notification: Notification): Promise<void> {
|
|
232
|
-
if (this.config.batchNotifications) {
|
|
233
|
-
this.pendingNotifications.push(notification);
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
await this.sendNotification(notification);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Send notification immediately
|
|
242
|
-
*/
|
|
243
|
-
private async sendNotification(notification: Notification): Promise<void> {
|
|
244
|
-
const deliveryPromises: Promise<void>[] = [];
|
|
245
|
-
|
|
246
|
-
// Send to all relevant recipients
|
|
247
|
-
for (const [recipientId, recipient] of this.recipients.entries()) {
|
|
248
|
-
if (this.shouldSendToRecipient(notification, recipient)) {
|
|
249
|
-
deliveryPromises.push(this.sendToRecipient(notification, recipient));
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// Try to send via Squawk
|
|
254
|
-
deliveryPromises.push(this.sendViaSquawk(notification));
|
|
255
|
-
|
|
256
|
-
await Promise.allSettled(deliveryPromises);
|
|
257
|
-
|
|
258
|
-
// Mark as delivered
|
|
259
|
-
notification.delivered = true;
|
|
260
|
-
notification.deliveredAt = new Date().toISOString();
|
|
261
|
-
this.notifications.set(notification.id, notification);
|
|
262
|
-
|
|
263
|
-
console.log(`๐ค Notification sent: ${notification.title}`);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Start batch processing of notifications
|
|
268
|
-
*/
|
|
269
|
-
private startBatchProcessing(): void {
|
|
270
|
-
this.batchTimer = setInterval(async () => {
|
|
271
|
-
if (this.pendingNotifications.length > 0) {
|
|
272
|
-
const batch = [...this.pendingNotifications];
|
|
273
|
-
this.pendingNotifications = [];
|
|
274
|
-
|
|
275
|
-
console.log(`๐ฆ Processing notification batch: ${batch.length} notifications`);
|
|
276
|
-
|
|
277
|
-
for (const notification of batch) {
|
|
278
|
-
await this.sendNotification(notification);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}, this.config.batchInterval);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Check if notification should be sent to recipient
|
|
286
|
-
*/
|
|
287
|
-
private shouldSendToRecipient(notification: Notification, recipient: NotificationRecipient): boolean {
|
|
288
|
-
if (notification.recipients && !notification.recipients.includes(recipient.id)) {
|
|
289
|
-
return false;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
switch (notification.type) {
|
|
293
|
-
case 'mission_completed':
|
|
294
|
-
return recipient.preferences.missionUpdates;
|
|
295
|
-
case 'conflict_resolved':
|
|
296
|
-
return recipient.preferences.conflicts;
|
|
297
|
-
case 'system_alert':
|
|
298
|
-
return recipient.preferences.systemAlerts;
|
|
299
|
-
case 'agent_terminated':
|
|
300
|
-
return recipient.preferences.missionUpdates || recipient.preferences.systemAlerts;
|
|
301
|
-
default:
|
|
302
|
-
return true;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Send notification to specific recipient
|
|
308
|
-
*/
|
|
309
|
-
private async sendToRecipient(notification: Notification, recipient: NotificationRecipient): Promise<void> {
|
|
310
|
-
try {
|
|
311
|
-
if (recipient.contactInfo.email) {
|
|
312
|
-
await this.sendEmail(notification, recipient.contactInfo.email);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (recipient.contactInfo.webhook) {
|
|
316
|
-
await this.sendWebhook(notification, recipient.contactInfo.webhook);
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
if (recipient.contactInfo.squawkMailbox) {
|
|
320
|
-
await this.sendToSquawkMailbox(notification, recipient.contactInfo.squawkMailbox);
|
|
321
|
-
}
|
|
322
|
-
} catch (error) {
|
|
323
|
-
console.error(`Failed to send notification to recipient ${recipient.id}:`, error);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Send notification via Squawk coordination system
|
|
329
|
-
*/
|
|
330
|
-
private async sendViaSquawk(notification: Notification): Promise<void> {
|
|
331
|
-
if (!this.config.squawkUrl) {
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
try {
|
|
336
|
-
const squawkUrl = `${this.config.squawkUrl}/api/v1/events`;
|
|
337
|
-
|
|
338
|
-
const event = {
|
|
339
|
-
type: 'notification',
|
|
340
|
-
data: {
|
|
341
|
-
notificationId: notification.id,
|
|
342
|
-
notificationType: notification.type,
|
|
343
|
-
priority: notification.priority,
|
|
344
|
-
title: notification.title,
|
|
345
|
-
message: notification.message,
|
|
346
|
-
metadata: notification.metadata,
|
|
347
|
-
timestamp: notification.timestamp
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
const response = await fetch(squawkUrl, {
|
|
352
|
-
method: 'POST',
|
|
353
|
-
headers: {
|
|
354
|
-
'Content-Type': 'application/json',
|
|
355
|
-
},
|
|
356
|
-
body: JSON.stringify(event)
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
if (!response.ok) {
|
|
360
|
-
throw new Error(`Squawk delivery failed: ${response.status}`);
|
|
361
|
-
}
|
|
362
|
-
} catch (error) {
|
|
363
|
-
console.error(`Failed to send notification via Squawk:`, error);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* Send notification via email (placeholder)
|
|
369
|
-
*/
|
|
370
|
-
private async sendEmail(notification: Notification, email: string): Promise<void> {
|
|
371
|
-
// In real implementation, this would integrate with email service
|
|
372
|
-
console.log(`๐ง Email notification to ${email}: ${notification.title}`);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* Send notification via webhook
|
|
377
|
-
*/
|
|
378
|
-
private async sendWebhook(notification: Notification, webhook: string): Promise<void> {
|
|
379
|
-
try {
|
|
380
|
-
const payload = {
|
|
381
|
-
id: notification.id,
|
|
382
|
-
type: notification.type,
|
|
383
|
-
priority: notification.priority,
|
|
384
|
-
title: notification.title,
|
|
385
|
-
message: notification.message,
|
|
386
|
-
metadata: notification.metadata,
|
|
387
|
-
timestamp: notification.timestamp
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
const response = await fetch(webhook, {
|
|
391
|
-
method: 'POST',
|
|
392
|
-
headers: {
|
|
393
|
-
'Content-Type': 'application/json',
|
|
394
|
-
'User-Agent': 'FleetTools-Notifier/1.0'
|
|
395
|
-
},
|
|
396
|
-
body: JSON.stringify(payload)
|
|
397
|
-
});
|
|
398
|
-
|
|
399
|
-
if (!response.ok) {
|
|
400
|
-
throw new Error(`Webhook delivery failed: ${response.status}`);
|
|
401
|
-
}
|
|
402
|
-
} catch (error) {
|
|
403
|
-
console.error(`Failed to send webhook notification:`, error);
|
|
404
|
-
throw error;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* Send notification to Squawk mailbox
|
|
410
|
-
*/
|
|
411
|
-
private async sendToSquawkMailbox(notification: Notification, mailboxId: string): Promise<void> {
|
|
412
|
-
try {
|
|
413
|
-
const squawkUrl = `${this.config.squawkUrl}/api/v1/mailbox/${mailboxId}/messages`;
|
|
414
|
-
|
|
415
|
-
const message = {
|
|
416
|
-
type: 'notification',
|
|
417
|
-
content: {
|
|
418
|
-
id: notification.id,
|
|
419
|
-
title: notification.title,
|
|
420
|
-
message: notification.message,
|
|
421
|
-
priority: notification.priority,
|
|
422
|
-
metadata: notification.metadata
|
|
423
|
-
},
|
|
424
|
-
timestamp: notification.timestamp
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
const response = await fetch(squawkUrl, {
|
|
428
|
-
method: 'POST',
|
|
429
|
-
headers: {
|
|
430
|
-
'Content-Type': 'application/json',
|
|
431
|
-
},
|
|
432
|
-
body: JSON.stringify(message)
|
|
433
|
-
});
|
|
434
|
-
|
|
435
|
-
if (!response.ok) {
|
|
436
|
-
throw new Error(`Mailbox delivery failed: ${response.status}`);
|
|
437
|
-
}
|
|
438
|
-
} catch (error) {
|
|
439
|
-
console.error(`Failed to send to Squawk mailbox:`, error);
|
|
440
|
-
throw error;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* Format mission completion message
|
|
446
|
-
*/
|
|
447
|
-
private formatMissionCompletionMessage(data: MissionCompletionData): string {
|
|
448
|
-
const duration = Math.round(data.duration / 1000); // Convert to seconds
|
|
449
|
-
const successRate = Math.round((data.completedTasks / data.totalTasks) * 100);
|
|
450
|
-
|
|
451
|
-
let message = `Mission "${data.title}" completed with status: ${data.status.toUpperCase()}. `;
|
|
452
|
-
message += `Duration: ${duration}s, Tasks: ${data.completedTasks}/${data.totalTasks} (${successRate}%)`;
|
|
453
|
-
|
|
454
|
-
if (data.participatingAgents.length > 0) {
|
|
455
|
-
message += `, Agents: ${data.participatingAgents.length}`;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
if (data.summary) {
|
|
459
|
-
message += `. Summary: ${data.summary}`;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
return message;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Get notification statistics
|
|
467
|
-
*/
|
|
468
|
-
getNotificationStats(): {
|
|
469
|
-
total: number;
|
|
470
|
-
delivered: number;
|
|
471
|
-
pending: number;
|
|
472
|
-
byType: Record<string, number>;
|
|
473
|
-
byPriority: Record<string, number>;
|
|
474
|
-
} {
|
|
475
|
-
const notifications = Array.from(this.notifications.values());
|
|
476
|
-
const byType: Record<string, number> = {};
|
|
477
|
-
const byPriority: Record<string, number> = {};
|
|
478
|
-
|
|
479
|
-
notifications.forEach(notification => {
|
|
480
|
-
byType[notification.type] = (byType[notification.type] || 0) + 1;
|
|
481
|
-
byPriority[notification.priority] = (byPriority[notification.priority] || 0) + 1;
|
|
482
|
-
});
|
|
483
|
-
|
|
484
|
-
return {
|
|
485
|
-
total: notifications.length,
|
|
486
|
-
delivered: notifications.filter(n => n.delivered).length,
|
|
487
|
-
pending: notifications.filter(n => !n.delivered).length,
|
|
488
|
-
byType,
|
|
489
|
-
byPriority
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
* Clean up old notifications
|
|
495
|
-
*/
|
|
496
|
-
cleanupOldNotifications(): void {
|
|
497
|
-
const cutoff = new Date();
|
|
498
|
-
cutoff.setDate(cutoff.getDate() - this.config.notificationRetention);
|
|
499
|
-
|
|
500
|
-
let cleanedCount = 0;
|
|
501
|
-
for (const [notificationId, notification] of this.notifications.entries()) {
|
|
502
|
-
if (new Date(notification.timestamp) < cutoff) {
|
|
503
|
-
this.notifications.delete(notificationId);
|
|
504
|
-
cleanedCount++;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
if (cleanedCount > 0) {
|
|
509
|
-
console.log(`๐งน Cleaned up ${cleanedCount} old notifications`);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
* Stop notification system
|
|
515
|
-
*/
|
|
516
|
-
stop(): void {
|
|
517
|
-
if (this.batchTimer) {
|
|
518
|
-
clearInterval(this.batchTimer);
|
|
519
|
-
this.batchTimer = undefined;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
// Send any pending notifications
|
|
523
|
-
if (this.pendingNotifications.length > 0) {
|
|
524
|
-
console.log(`๐ฆ Sending ${this.pendingNotifications.length} pending notifications before shutdown`);
|
|
525
|
-
this.pendingNotifications.forEach(async notification => {
|
|
526
|
-
await this.sendNotification(notification);
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
console.log('๐ค Notifier stopped');
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
/**
|
|
534
|
-
* Export notification data
|
|
535
|
-
*/
|
|
536
|
-
exportNotifications(): {
|
|
537
|
-
notifications: Notification[];
|
|
538
|
-
recipients: NotificationRecipient[];
|
|
539
|
-
stats: ReturnType<typeof Notifier.prototype.getNotificationStats>;
|
|
540
|
-
} {
|
|
541
|
-
return {
|
|
542
|
-
notifications: Array.from(this.notifications.values()),
|
|
543
|
-
recipients: Array.from(this.recipients.values()),
|
|
544
|
-
stats: this.getNotificationStats()
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
}
|