@kb-labs/rest-api-app 1.3.0 → 1.4.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/dist/index.d.ts +2 -0
- package/dist/index.js +8151 -0
- package/dist/index.js.map +1 -0
- package/package.json +7 -4
- package/.kb/agents/sessions/session-1771531145393-ws3uh6q/turns.json +0 -42
- package/.kb/agents/sessions/session-1771548930486-ui6rtvm/turns.json +0 -33
- package/.kb/agents/sessions/session-1771549691485-nibqroq/turns.json +0 -133
- package/.kb/agents/sessions/session-1771550943182-dkwqdjc/turns.json +0 -130
- package/.kb/agents/sessions/session-1771551564182-cr4bwzn/turns.json +0 -349
- package/.kb/agents/sessions/session-1771552401370-g4ztwd1/turns.json +0 -206
- package/.kb/commit/current/plan.json +0 -248
- package/.kb/commit/current/status.json +0 -472
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/health.d.ts +0 -10
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/health.js +0 -215
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/health.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/list.d.ts +0 -10
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/list.js +0 -271
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/list.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/logs.d.ts +0 -10
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/logs.js +0 -230
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/logs.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/metrics.d.ts +0 -10
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/metrics.js +0 -228
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/metrics.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/run.d.ts +0 -11
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/run.js +0 -281
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/run.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/status.d.ts +0 -10
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/status.js +0 -266
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/status.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/workflow-run.d.ts +0 -11
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/workflow-run.js +0 -284
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/workflow-run.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/flags-WLdpSZl4.d.ts +0 -77
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/index.d.ts +0 -2
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/index.js +0 -441
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/index.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/manifest.d.ts +0 -196
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/manifest.js +0 -441
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/manifest.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/cron-list-handler.d.ts +0 -19
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/cron-list-handler.js +0 -48
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/cron-list-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/index.d.ts +0 -6
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/index.js +0 -170
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/index.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-cancel-handler.d.ts +0 -12
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-cancel-handler.js +0 -52
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-cancel-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-detail-handler.d.ts +0 -22
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-detail-handler.js +0 -52
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-detail-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-logs-handler.d.ts +0 -13
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-logs-handler.js +0 -52
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-logs-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-steps-handler.d.ts +0 -9
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-steps-handler.js +0 -43
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-steps-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/jobs-list-handler.d.ts +0 -26
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/jobs-list-handler.js +0 -63
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/jobs-list-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/pending-approvals-handler.d.ts +0 -9
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/pending-approvals-handler.js +0 -46
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/pending-approvals-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/resolve-approval-handler.d.ts +0 -16
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/resolve-approval-handler.js +0 -58
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/resolve-approval-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/run-detail-handler.d.ts +0 -9
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/run-detail-handler.js +0 -46
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/run-detail-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/runs-list-handler.d.ts +0 -11
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/runs-list-handler.js +0 -50
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/runs-list-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/stats-handler.d.ts +0 -7
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/stats-handler.js +0 -39
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/stats-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-detail-handler.d.ts +0 -10
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-detail-handler.js +0 -46
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-detail-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-cancel-handler.d.ts +0 -13
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-cancel-handler.js +0 -47
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-cancel-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-handler.d.ts +0 -14
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-handler.js +0 -53
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-runs-handler.d.ts +0 -13
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-runs-handler.js +0 -54
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-runs-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflows-list-handler.d.ts +0 -12
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflows-list-handler.js +0 -51
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflows-list-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/logs-channel.d.ts +0 -17
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/logs-channel.js +0 -133
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/logs-channel.js.map +0 -1
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/progress-channel.d.ts +0 -11
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/progress-channel.js +0 -46
- package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/progress-channel.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/health.d.ts +0 -10
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/health.js +0 -215
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/health.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/list.d.ts +0 -10
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/list.js +0 -271
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/list.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/logs.d.ts +0 -10
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/logs.js +0 -230
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/logs.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/metrics.d.ts +0 -10
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/metrics.js +0 -228
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/metrics.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/run.d.ts +0 -11
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/run.js +0 -281
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/run.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/status.d.ts +0 -10
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/status.js +0 -266
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/status.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/workflow-run.d.ts +0 -11
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/workflow-run.js +0 -284
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/workflow-run.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/flags-WLdpSZl4.d.ts +0 -77
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/index.d.ts +0 -2
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/index.js +0 -441
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/index.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/manifest.d.ts +0 -196
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/manifest.js +0 -441
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/manifest.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/cron-list-handler.d.ts +0 -19
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/cron-list-handler.js +0 -48
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/cron-list-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/index.d.ts +0 -6
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/index.js +0 -170
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/index.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-cancel-handler.d.ts +0 -12
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-cancel-handler.js +0 -52
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-cancel-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-detail-handler.d.ts +0 -22
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-detail-handler.js +0 -52
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-detail-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-logs-handler.d.ts +0 -13
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-logs-handler.js +0 -52
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-logs-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-steps-handler.d.ts +0 -9
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-steps-handler.js +0 -43
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-steps-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/jobs-list-handler.d.ts +0 -26
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/jobs-list-handler.js +0 -63
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/jobs-list-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/pending-approvals-handler.d.ts +0 -9
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/pending-approvals-handler.js +0 -46
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/pending-approvals-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/resolve-approval-handler.d.ts +0 -16
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/resolve-approval-handler.js +0 -58
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/resolve-approval-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/run-detail-handler.d.ts +0 -9
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/run-detail-handler.js +0 -46
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/run-detail-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/runs-list-handler.d.ts +0 -11
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/runs-list-handler.js +0 -50
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/runs-list-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/stats-handler.d.ts +0 -7
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/stats-handler.js +0 -39
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/stats-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-detail-handler.d.ts +0 -10
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-detail-handler.js +0 -46
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-detail-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-cancel-handler.d.ts +0 -13
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-cancel-handler.js +0 -47
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-cancel-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-handler.d.ts +0 -14
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-handler.js +0 -53
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-runs-handler.d.ts +0 -13
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-runs-handler.js +0 -54
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-runs-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflows-list-handler.d.ts +0 -12
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflows-list-handler.js +0 -51
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflows-list-handler.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/logs-channel.d.ts +0 -17
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/logs-channel.js +0 -133
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/logs-channel.js.map +0 -1
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/progress-channel.d.ts +0 -11
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/progress-channel.js +0 -46
- package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/progress-channel.js.map +0 -1
- package/eslint.config.js +0 -23
- package/src/.kb/agents/sessions/session-1773470583796-ximqnfk/kpi-baseline.json +0 -17
- package/src/.kb/memory/sessions/session-1773470583796-ximqnfk/fact-sheet.json +0 -1
- package/src/bootstrap.ts +0 -233
- package/src/diagnostics/header-debug.ts +0 -37
- package/src/events/hub.ts +0 -60
- package/src/events/index.ts +0 -1
- package/src/index.ts +0 -13
- package/src/manifest.ts +0 -21
- package/src/middleware/__tests__/cache.spec.ts +0 -184
- package/src/middleware/__tests__/envelope.spec.ts +0 -268
- package/src/middleware/__tests__/metrics.redis.spec.ts +0 -64
- package/src/middleware/__tests__/rate-limit.spec.ts +0 -283
- package/src/middleware/__tests__/request-id.spec.ts +0 -160
- package/src/middleware/cache.ts +0 -67
- package/src/middleware/envelope.ts +0 -136
- package/src/middleware/error-guard.ts +0 -69
- package/src/middleware/index.ts +0 -37
- package/src/middleware/metrics.ts +0 -810
- package/src/middleware/mock-mode.ts +0 -44
- package/src/middleware/prom-metrics.ts +0 -284
- package/src/middleware/rate-limit-routes.ts +0 -73
- package/src/middleware/rate-limit.ts +0 -72
- package/src/middleware/request-id.ts +0 -41
- package/src/middleware/request-timeout.ts +0 -69
- package/src/middleware/security-headers.ts +0 -24
- package/src/middleware/startup-guard.ts +0 -107
- package/src/observability/service-contract.ts +0 -192
- package/src/plugins/index.ts +0 -118
- package/src/routes/__tests__/adapters-date-helpers.spec.ts +0 -332
- package/src/routes/__tests__/adapters.spec.ts +0 -680
- package/src/routes/__tests__/cache.spec.ts +0 -264
- package/src/routes/__tests__/events.spec.ts +0 -434
- package/src/routes/__tests__/health.spec.ts +0 -414
- package/src/routes/__tests__/logs.spec.ts +0 -494
- package/src/routes/__tests__/observability.spec.ts +0 -392
- package/src/routes/__tests__/plugins.spec.ts +0 -931
- package/src/routes/__tests__/workflow-management.spec.ts +0 -698
- package/src/routes/__tests__/workflows.spec.ts +0 -204
- package/src/routes/adapter-call.ts +0 -220
- package/src/routes/adapters.ts +0 -1206
- package/src/routes/analytics.ts +0 -328
- package/src/routes/cache.ts +0 -104
- package/src/routes/debug-routes.ts +0 -95
- package/src/routes/events.ts +0 -115
- package/src/routes/health.ts +0 -348
- package/src/routes/hello.ts +0 -47
- package/src/routes/index.ts +0 -395
- package/src/routes/jobs.ts +0 -253
- package/src/routes/logs.ts +0 -718
- package/src/routes/metrics.ts +0 -120
- package/src/routes/observability.ts +0 -1388
- package/src/routes/openapi.ts +0 -101
- package/src/routes/platform.ts +0 -143
- package/src/routes/plugins.ts +0 -998
- package/src/routes/readiness.ts +0 -83
- package/src/routes/workflow-management.ts +0 -469
- package/src/routes/workflows.ts +0 -256
- package/src/server.ts +0 -203
- package/src/services/historical-metrics.ts +0 -496
- package/src/services/incident-analyzer.ts +0 -289
- package/src/services/incident-detector.ts +0 -691
- package/src/services/incident-schema.sql +0 -76
- package/src/services/incident-storage.ts +0 -593
- package/src/services/system-metrics-collector.ts +0 -244
- package/src/types/fastify.d.ts +0 -58
- package/src/utils/__tests__/sse-auth.spec.ts +0 -113
- package/src/utils/path-helpers.ts +0 -15
- package/src/utils/repo.ts +0 -42
- package/src/utils/schema.ts +0 -20
- package/src/utils/sse-auth.ts +0 -81
- package/test-sandbox.sh +0 -105
- package/tsconfig.build.json +0 -15
- package/tsconfig.json +0 -9
- package/tsup.config.ts +0 -18
package/src/routes/analytics.ts
DELETED
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module @kb-labs/rest-api-app/routes/analytics
|
|
3
|
-
* Analytics endpoints for querying events, stats, and monitoring
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { FastifyInstance } from 'fastify';
|
|
7
|
-
import type { RestApiConfig } from '@kb-labs/rest-api-core';
|
|
8
|
-
import { normalizeBasePath, resolvePaths } from '../utils/path-helpers';
|
|
9
|
-
import { platform } from '@kb-labs/core-runtime';
|
|
10
|
-
import { restDomainOperationMetrics } from '../middleware/metrics.js';
|
|
11
|
-
import type {
|
|
12
|
-
EventsQuery,
|
|
13
|
-
EventsResponse,
|
|
14
|
-
EventsStats,
|
|
15
|
-
BufferStatus,
|
|
16
|
-
DlqStatus,
|
|
17
|
-
} from '@kb-labs/core-platform/adapters';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Register analytics routes
|
|
21
|
-
*
|
|
22
|
-
* These are system-level analytics endpoints that expose events and statistics
|
|
23
|
-
* from the platform's analytics adapter (if configured).
|
|
24
|
-
*
|
|
25
|
-
* Returns 501 Not Implemented if analytics adapter doesn't support read methods.
|
|
26
|
-
*/
|
|
27
|
-
export async function registerAnalyticsRoutes(
|
|
28
|
-
fastify: FastifyInstance,
|
|
29
|
-
config: RestApiConfig
|
|
30
|
-
): Promise<void> {
|
|
31
|
-
const basePath = normalizeBasePath(config.basePath);
|
|
32
|
-
|
|
33
|
-
// GET /api/v1/analytics/events
|
|
34
|
-
// Query analytics events with optional filters
|
|
35
|
-
const eventsPaths = resolvePaths(basePath, '/analytics/events');
|
|
36
|
-
for (const path of eventsPaths) {
|
|
37
|
-
fastify.get<{
|
|
38
|
-
Querystring: {
|
|
39
|
-
type?: string | string[];
|
|
40
|
-
source?: string;
|
|
41
|
-
actor?: string;
|
|
42
|
-
from?: string;
|
|
43
|
-
to?: string;
|
|
44
|
-
limit?: string;
|
|
45
|
-
offset?: string;
|
|
46
|
-
};
|
|
47
|
-
}>(path, async (request, reply) => {
|
|
48
|
-
try {
|
|
49
|
-
const analytics = platform.analytics;
|
|
50
|
-
|
|
51
|
-
// Check if analytics adapter supports read methods
|
|
52
|
-
const getEvents = analytics.getEvents;
|
|
53
|
-
if (!getEvents) {
|
|
54
|
-
fastify.log.debug('Analytics adapter does not implement getEvents()');
|
|
55
|
-
return reply.code(501).send({
|
|
56
|
-
ok: false,
|
|
57
|
-
error: {
|
|
58
|
-
code: 'ANALYTICS_NOT_IMPLEMENTED',
|
|
59
|
-
message: 'Analytics adapter does not support reading events',
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Build query from request params
|
|
65
|
-
const query: EventsQuery = {};
|
|
66
|
-
|
|
67
|
-
if (request.query.type !== undefined) {
|
|
68
|
-
query.type = request.query.type;
|
|
69
|
-
}
|
|
70
|
-
if (request.query.source) {
|
|
71
|
-
query.source = request.query.source;
|
|
72
|
-
}
|
|
73
|
-
if (request.query.actor) {
|
|
74
|
-
query.actor = request.query.actor;
|
|
75
|
-
}
|
|
76
|
-
if (request.query.from) {
|
|
77
|
-
query.from = request.query.from;
|
|
78
|
-
}
|
|
79
|
-
if (request.query.to) {
|
|
80
|
-
query.to = request.query.to;
|
|
81
|
-
}
|
|
82
|
-
if (request.query.limit) {
|
|
83
|
-
query.limit = Number.parseInt(request.query.limit, 10);
|
|
84
|
-
}
|
|
85
|
-
if (request.query.offset) {
|
|
86
|
-
query.offset = Number.parseInt(request.query.offset, 10);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
fastify.log.debug({ query }, 'Fetching analytics events');
|
|
90
|
-
|
|
91
|
-
const response: EventsResponse = await restDomainOperationMetrics.observeOperation(
|
|
92
|
-
'analytics.events.query',
|
|
93
|
-
() => getEvents.call(analytics, query),
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
fastify.log.debug(
|
|
97
|
-
{
|
|
98
|
-
total: response.total,
|
|
99
|
-
count: response.events.length,
|
|
100
|
-
hasMore: response.hasMore,
|
|
101
|
-
},
|
|
102
|
-
'Analytics events fetched successfully'
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
ok: true,
|
|
107
|
-
data: response,
|
|
108
|
-
meta: {
|
|
109
|
-
source: 'analytics-adapter',
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
} catch (error) {
|
|
113
|
-
platform.logger.error('Failed to fetch analytics events', error instanceof Error ? error : new Error(String(error)));
|
|
114
|
-
|
|
115
|
-
return reply.code(500).send({
|
|
116
|
-
ok: false,
|
|
117
|
-
error: {
|
|
118
|
-
code: 'ANALYTICS_ERROR',
|
|
119
|
-
message: error instanceof Error ? error.message : 'Failed to fetch analytics events',
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// GET /api/v1/analytics/stats
|
|
127
|
-
// Get aggregated statistics
|
|
128
|
-
const statsPaths = resolvePaths(basePath, '/analytics/stats');
|
|
129
|
-
for (const path of statsPaths) {
|
|
130
|
-
fastify.get(path, async (_request, reply) => {
|
|
131
|
-
try {
|
|
132
|
-
const analytics = platform.analytics;
|
|
133
|
-
|
|
134
|
-
const getStats = analytics.getStats;
|
|
135
|
-
if (!getStats) {
|
|
136
|
-
fastify.log.debug('Analytics adapter does not implement getStats()');
|
|
137
|
-
return reply.code(501).send({
|
|
138
|
-
ok: false,
|
|
139
|
-
error: {
|
|
140
|
-
code: 'ANALYTICS_NOT_IMPLEMENTED',
|
|
141
|
-
message: 'Analytics adapter does not support reading stats',
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
fastify.log.debug('Fetching analytics stats');
|
|
147
|
-
|
|
148
|
-
// Cache stats for 60 seconds to avoid reprocessing 50k+ events on every request
|
|
149
|
-
const cacheKey = 'analytics:stats';
|
|
150
|
-
let stats = await platform.cache.get<EventsStats>(cacheKey);
|
|
151
|
-
|
|
152
|
-
if (!stats) {
|
|
153
|
-
fastify.log.debug('Cache miss, fetching stats from adapter');
|
|
154
|
-
stats = await restDomainOperationMetrics.observeOperation('analytics.stats.get', () => getStats.call(analytics));
|
|
155
|
-
await platform.cache.set(cacheKey, stats, 60 * 1000); // 60 second TTL
|
|
156
|
-
} else {
|
|
157
|
-
fastify.log.debug('Cache hit, returning cached stats');
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
fastify.log.debug(
|
|
161
|
-
{
|
|
162
|
-
totalEvents: stats.totalEvents,
|
|
163
|
-
timeRange: stats.timeRange,
|
|
164
|
-
},
|
|
165
|
-
'Analytics stats fetched successfully'
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
return {
|
|
169
|
-
ok: true,
|
|
170
|
-
data: stats,
|
|
171
|
-
meta: {
|
|
172
|
-
source: 'analytics-adapter',
|
|
173
|
-
},
|
|
174
|
-
};
|
|
175
|
-
} catch (error) {
|
|
176
|
-
platform.logger.error('Failed to fetch analytics stats', error instanceof Error ? error : new Error(String(error)));
|
|
177
|
-
|
|
178
|
-
return reply.code(500).send({
|
|
179
|
-
ok: false,
|
|
180
|
-
error: {
|
|
181
|
-
code: 'ANALYTICS_ERROR',
|
|
182
|
-
message: error instanceof Error ? error.message : 'Failed to fetch analytics stats',
|
|
183
|
-
},
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// GET /api/v1/analytics/buffer/status
|
|
190
|
-
// Get WAL buffer status (if applicable)
|
|
191
|
-
const bufferPaths = resolvePaths(basePath, '/analytics/buffer/status');
|
|
192
|
-
for (const path of bufferPaths) {
|
|
193
|
-
fastify.get(path, async (_request, reply) => {
|
|
194
|
-
try {
|
|
195
|
-
const analytics = platform.analytics;
|
|
196
|
-
|
|
197
|
-
const getBufferStatus = analytics.getBufferStatus;
|
|
198
|
-
if (!getBufferStatus) {
|
|
199
|
-
fastify.log.debug('Analytics adapter does not implement getBufferStatus()');
|
|
200
|
-
return reply.code(501).send({
|
|
201
|
-
ok: false,
|
|
202
|
-
error: {
|
|
203
|
-
code: 'ANALYTICS_NOT_IMPLEMENTED',
|
|
204
|
-
message: 'Analytics adapter does not support buffer status',
|
|
205
|
-
},
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
fastify.log.debug('Fetching analytics buffer status');
|
|
210
|
-
|
|
211
|
-
const status: BufferStatus | null = await restDomainOperationMetrics.observeOperation(
|
|
212
|
-
'analytics.buffer.status',
|
|
213
|
-
() => getBufferStatus.call(analytics),
|
|
214
|
-
);
|
|
215
|
-
|
|
216
|
-
if (status === null) {
|
|
217
|
-
fastify.log.debug('Buffer status not applicable for current analytics backend');
|
|
218
|
-
return reply.code(501).send({
|
|
219
|
-
ok: false,
|
|
220
|
-
error: {
|
|
221
|
-
code: 'BUFFER_NOT_APPLICABLE',
|
|
222
|
-
message: 'Buffer status not applicable for current analytics backend',
|
|
223
|
-
},
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
fastify.log.debug(
|
|
228
|
-
{
|
|
229
|
-
segments: status.segments,
|
|
230
|
-
totalSizeBytes: status.totalSizeBytes,
|
|
231
|
-
},
|
|
232
|
-
'Analytics buffer status fetched successfully'
|
|
233
|
-
);
|
|
234
|
-
|
|
235
|
-
return {
|
|
236
|
-
ok: true,
|
|
237
|
-
data: status,
|
|
238
|
-
meta: {
|
|
239
|
-
source: 'analytics-adapter',
|
|
240
|
-
},
|
|
241
|
-
};
|
|
242
|
-
} catch (error) {
|
|
243
|
-
platform.logger.error('Failed to fetch analytics buffer status', error instanceof Error ? error : new Error(String(error)));
|
|
244
|
-
|
|
245
|
-
return reply.code(500).send({
|
|
246
|
-
ok: false,
|
|
247
|
-
error: {
|
|
248
|
-
code: 'ANALYTICS_ERROR',
|
|
249
|
-
message:
|
|
250
|
-
error instanceof Error
|
|
251
|
-
? error.message
|
|
252
|
-
: 'Failed to fetch analytics buffer status',
|
|
253
|
-
},
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
// GET /api/v1/analytics/dlq/status
|
|
260
|
-
// Get Dead-Letter Queue status (if applicable)
|
|
261
|
-
const dlqPaths = resolvePaths(basePath, '/analytics/dlq/status');
|
|
262
|
-
for (const path of dlqPaths) {
|
|
263
|
-
fastify.get(path, async (_request, reply) => {
|
|
264
|
-
try {
|
|
265
|
-
const analytics = platform.analytics;
|
|
266
|
-
|
|
267
|
-
const getDlqStatus = analytics.getDlqStatus;
|
|
268
|
-
if (!getDlqStatus) {
|
|
269
|
-
fastify.log.debug('Analytics adapter does not implement getDlqStatus()');
|
|
270
|
-
return reply.code(501).send({
|
|
271
|
-
ok: false,
|
|
272
|
-
error: {
|
|
273
|
-
code: 'ANALYTICS_NOT_IMPLEMENTED',
|
|
274
|
-
message: 'Analytics adapter does not support DLQ status',
|
|
275
|
-
},
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
fastify.log.debug('Fetching analytics DLQ status');
|
|
280
|
-
|
|
281
|
-
const status: DlqStatus | null = await restDomainOperationMetrics.observeOperation(
|
|
282
|
-
'analytics.dlq.status',
|
|
283
|
-
() => getDlqStatus.call(analytics),
|
|
284
|
-
);
|
|
285
|
-
|
|
286
|
-
if (status === null) {
|
|
287
|
-
fastify.log.debug('DLQ status not applicable for current analytics backend');
|
|
288
|
-
return reply.code(501).send({
|
|
289
|
-
ok: false,
|
|
290
|
-
error: {
|
|
291
|
-
code: 'DLQ_NOT_APPLICABLE',
|
|
292
|
-
message: 'DLQ status not applicable for current analytics backend',
|
|
293
|
-
},
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
fastify.log.debug(
|
|
298
|
-
{
|
|
299
|
-
failedEvents: status.failedEvents,
|
|
300
|
-
oldestFailureTs: status.oldestFailureTs,
|
|
301
|
-
},
|
|
302
|
-
'Analytics DLQ status fetched successfully'
|
|
303
|
-
);
|
|
304
|
-
|
|
305
|
-
return {
|
|
306
|
-
ok: true,
|
|
307
|
-
data: status,
|
|
308
|
-
meta: {
|
|
309
|
-
source: 'analytics-adapter',
|
|
310
|
-
},
|
|
311
|
-
};
|
|
312
|
-
} catch (error) {
|
|
313
|
-
platform.logger.error('Failed to fetch analytics DLQ status', error instanceof Error ? error : new Error(String(error)));
|
|
314
|
-
|
|
315
|
-
return reply.code(500).send({
|
|
316
|
-
ok: false,
|
|
317
|
-
error: {
|
|
318
|
-
code: 'ANALYTICS_ERROR',
|
|
319
|
-
message:
|
|
320
|
-
error instanceof Error ? error.message : 'Failed to fetch analytics DLQ status',
|
|
321
|
-
},
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
fastify.log.info('Analytics routes registered');
|
|
328
|
-
}
|
package/src/routes/cache.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { platform } from '@kb-labs/core-runtime';
|
|
2
|
-
/**
|
|
3
|
-
* @module @kb-labs/rest-api-app/routes/cache
|
|
4
|
-
* Cache management routes
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { FastifyInstance } from 'fastify';
|
|
8
|
-
import type { RestApiConfig } from '@kb-labs/rest-api-core';
|
|
9
|
-
import type { IEntityRegistry } from '@kb-labs/core-registry';
|
|
10
|
-
import { normalizeBasePath } from '../utils/path-helpers';
|
|
11
|
-
import { restDomainOperationMetrics } from '../middleware/metrics.js';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Register cache management routes
|
|
15
|
-
*/
|
|
16
|
-
export async function registerCacheRoutes(
|
|
17
|
-
server: FastifyInstance,
|
|
18
|
-
config: RestApiConfig,
|
|
19
|
-
registry: IEntityRegistry
|
|
20
|
-
): Promise<void> {
|
|
21
|
-
const basePath = normalizeBasePath(config.basePath);
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* POST /api/v1/cache/invalidate
|
|
25
|
-
* Force cache invalidation and registry refresh
|
|
26
|
-
*/
|
|
27
|
-
server.post(`${basePath}/cache/invalidate`, async (request, reply) => {
|
|
28
|
-
const start = Date.now();
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
// Capture current state
|
|
32
|
-
const beforeSnapshot = registry.snapshot();
|
|
33
|
-
const previousRev = beforeSnapshot.rev;
|
|
34
|
-
|
|
35
|
-
platform.logger.info('Manual cache invalidation requested', {
|
|
36
|
-
requestId: request.id,
|
|
37
|
-
previousRev,
|
|
38
|
-
});
|
|
39
|
-
// Force cache invalidation and refresh discovery
|
|
40
|
-
// This will trigger re-discovery and clear stale cache
|
|
41
|
-
await restDomainOperationMetrics.observeOperation('cache.invalidate', async () => {
|
|
42
|
-
await registry.refresh();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// Get new state
|
|
46
|
-
const afterSnapshot = await restDomainOperationMetrics.observeOperation('plugin.registry.snapshot', async () =>
|
|
47
|
-
registry.snapshot(),
|
|
48
|
-
);
|
|
49
|
-
const plugins = await restDomainOperationMetrics.observeOperation('plugin.registry.list', async () =>
|
|
50
|
-
registry.listPlugins(),
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const elapsed = Date.now() - start;
|
|
54
|
-
|
|
55
|
-
platform.logger.info('Cache invalidated successfully', {
|
|
56
|
-
requestId: request.id,
|
|
57
|
-
previousRev,
|
|
58
|
-
newRev: afterSnapshot.rev,
|
|
59
|
-
pluginsDiscovered: plugins.length,
|
|
60
|
-
elapsedMs: elapsed,
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
return reply.code(200).send({
|
|
64
|
-
ok: true,
|
|
65
|
-
data: {
|
|
66
|
-
invalidated: true,
|
|
67
|
-
timestamp: new Date().toISOString(),
|
|
68
|
-
previousRev,
|
|
69
|
-
newRev: afterSnapshot.rev,
|
|
70
|
-
pluginsDiscovered: plugins.length,
|
|
71
|
-
},
|
|
72
|
-
meta: {
|
|
73
|
-
requestId: request.id,
|
|
74
|
-
durationMs: elapsed,
|
|
75
|
-
apiVersion: '1.0.0',
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
} catch (error) {
|
|
79
|
-
const elapsed = Date.now() - start;
|
|
80
|
-
|
|
81
|
-
platform.logger.error(
|
|
82
|
-
'Cache invalidation failed',
|
|
83
|
-
error instanceof Error ? error : new Error(String(error)),
|
|
84
|
-
{
|
|
85
|
-
requestId: request.id as string,
|
|
86
|
-
elapsedMs: elapsed,
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
return reply.code(500).send({
|
|
91
|
-
ok: false,
|
|
92
|
-
error: {
|
|
93
|
-
code: 'CACHE_INVALIDATION_FAILED',
|
|
94
|
-
message: error instanceof Error ? error.message : 'Cache invalidation failed',
|
|
95
|
-
},
|
|
96
|
-
meta: {
|
|
97
|
-
requestId: request.id,
|
|
98
|
-
durationMs: elapsed,
|
|
99
|
-
apiVersion: '1.0.0',
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module @kb-labs/rest-api-app/routes/debug-routes
|
|
3
|
-
* Debug endpoint to list all registered routes
|
|
4
|
-
*
|
|
5
|
-
* GET /api/v1/routes - List all registered routes with methods
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { FastifyInstance, RouteOptions } from 'fastify';
|
|
9
|
-
import type { RestApiConfig } from '@kb-labs/rest-api-core';
|
|
10
|
-
import { normalizeBasePath, resolvePaths } from '../utils/path-helpers';
|
|
11
|
-
|
|
12
|
-
interface RouteInfo {
|
|
13
|
-
method: string;
|
|
14
|
-
url: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Store for collected routes (populated via onRoute hook)
|
|
18
|
-
const collectedRoutes: RouteInfo[] = [];
|
|
19
|
-
const seenRoutes = new Set<string>();
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Hook to collect routes as they are registered
|
|
23
|
-
*/
|
|
24
|
-
function collectRoute(routeOptions: RouteOptions): void {
|
|
25
|
-
const methods = Array.isArray(routeOptions.method)
|
|
26
|
-
? routeOptions.method
|
|
27
|
-
: [routeOptions.method];
|
|
28
|
-
|
|
29
|
-
for (const method of methods) {
|
|
30
|
-
// Skip HEAD (auto-generated for GET routes) and internal routes
|
|
31
|
-
if (method === 'HEAD') {continue;}
|
|
32
|
-
|
|
33
|
-
const url = routeOptions.url;
|
|
34
|
-
const key = `${method}:${url}`;
|
|
35
|
-
|
|
36
|
-
if (!seenRoutes.has(key)) {
|
|
37
|
-
seenRoutes.add(key);
|
|
38
|
-
collectedRoutes.push({ method, url });
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Register the onRoute hook to collect routes
|
|
45
|
-
* Must be called early, before other routes are registered
|
|
46
|
-
*/
|
|
47
|
-
export function registerRouteCollector(fastify: FastifyInstance): void {
|
|
48
|
-
fastify.addHook('onRoute', collectRoute);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Register debug routes endpoint
|
|
53
|
-
*/
|
|
54
|
-
export async function registerDebugRoutes(
|
|
55
|
-
fastify: FastifyInstance,
|
|
56
|
-
config: RestApiConfig
|
|
57
|
-
): Promise<void> {
|
|
58
|
-
const basePath = normalizeBasePath(config.basePath);
|
|
59
|
-
const routesPaths = resolvePaths(basePath, '/routes');
|
|
60
|
-
|
|
61
|
-
for (const path of routesPaths) {
|
|
62
|
-
fastify.get(path, async (_request, reply) => {
|
|
63
|
-
// Filter to only show /api/v1 routes (skip duplicates without prefix)
|
|
64
|
-
let routes = collectedRoutes.filter(r => r.url.startsWith('/api/'));
|
|
65
|
-
|
|
66
|
-
// If no API routes found, show all (fallback)
|
|
67
|
-
if (routes.length === 0) {
|
|
68
|
-
routes = [...collectedRoutes];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Sort routes by URL, then by method
|
|
72
|
-
routes.sort((a, b) => {
|
|
73
|
-
const urlCompare = a.url.localeCompare(b.url);
|
|
74
|
-
if (urlCompare !== 0) {return urlCompare;}
|
|
75
|
-
return a.method.localeCompare(b.method);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
// Get raw printRoutes for debugging (optional)
|
|
79
|
-
let raw: string | null = null;
|
|
80
|
-
try {
|
|
81
|
-
raw = fastify.printRoutes({ commonPrefix: false });
|
|
82
|
-
} catch {
|
|
83
|
-
// Ignore if not available
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return reply.send({
|
|
87
|
-
schema: 'kb.routes/1',
|
|
88
|
-
ts: new Date().toISOString(),
|
|
89
|
-
count: routes.length,
|
|
90
|
-
routes,
|
|
91
|
-
raw,
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
package/src/routes/events.ts
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import type { FastifyInstance } from 'fastify';
|
|
2
|
-
import type { RestApiConfig } from '@kb-labs/rest-api-core';
|
|
3
|
-
import type { IEntityRegistry, SystemHealthSnapshot } from '@kb-labs/core-registry';
|
|
4
|
-
import type { ReadinessState } from './readiness';
|
|
5
|
-
import { isReady, resolveReadinessReason } from './readiness';
|
|
6
|
-
import type { EventHub, BroadcastEvent } from '../events/hub';
|
|
7
|
-
import { metricsCollector } from '../middleware/metrics.js';
|
|
8
|
-
import { buildRegistrySseAuthHook } from '../utils/sse-auth';
|
|
9
|
-
|
|
10
|
-
export async function registerEventRoutes(
|
|
11
|
-
server: FastifyInstance,
|
|
12
|
-
basePath: string,
|
|
13
|
-
registry: IEntityRegistry,
|
|
14
|
-
readiness: ReadinessState,
|
|
15
|
-
eventHub: EventHub,
|
|
16
|
-
config: RestApiConfig
|
|
17
|
-
): Promise<void> {
|
|
18
|
-
const endpoint = `${basePath}/events/registry`;
|
|
19
|
-
const authHook = buildRegistrySseAuthHook(config);
|
|
20
|
-
|
|
21
|
-
server.route({
|
|
22
|
-
method: 'GET',
|
|
23
|
-
url: endpoint,
|
|
24
|
-
onRequest: authHook ? [authHook] : undefined,
|
|
25
|
-
handler: async (request, reply) => {
|
|
26
|
-
// Tell Fastify we're manually managing the response
|
|
27
|
-
reply.hijack();
|
|
28
|
-
|
|
29
|
-
// Explicit CORS headers for EventSource (browser requires these before opening connection)
|
|
30
|
-
const origin = request.headers.origin;
|
|
31
|
-
if (origin === 'http://localhost:3000' || origin === 'http://localhost:5173') {
|
|
32
|
-
reply.raw.setHeader('Access-Control-Allow-Origin', origin);
|
|
33
|
-
reply.raw.setHeader('Access-Control-Allow-Credentials', 'true');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
reply.raw.setHeader('Content-Type', 'text/event-stream');
|
|
37
|
-
reply.raw.setHeader('Cache-Control', 'no-cache, no-transform');
|
|
38
|
-
reply.raw.setHeader('Connection', 'keep-alive');
|
|
39
|
-
reply.raw.flushHeaders?.();
|
|
40
|
-
reply.raw.write(': connected\n\n');
|
|
41
|
-
|
|
42
|
-
const send = (event: BroadcastEvent) => {
|
|
43
|
-
reply.raw.write(`event: ${event.type}\n`);
|
|
44
|
-
reply.raw.write(`data: ${JSON.stringify(event)}\n\n`);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const unsubscribe = eventHub.subscribe(send);
|
|
48
|
-
|
|
49
|
-
const snapshot = registry.snapshot();
|
|
50
|
-
const checksumAlgorithm = snapshot.checksumAlgorithm === 'sha256' ? 'sha256' : undefined;
|
|
51
|
-
send({
|
|
52
|
-
type: 'registry',
|
|
53
|
-
rev: snapshot.rev,
|
|
54
|
-
generatedAt: snapshot.generatedAt,
|
|
55
|
-
partial: snapshot.partial,
|
|
56
|
-
stale: snapshot.stale,
|
|
57
|
-
expiresAt: snapshot.expiresAt ?? null,
|
|
58
|
-
ttlMs: snapshot.ttlMs ?? null,
|
|
59
|
-
checksum: snapshot.checksum ?? undefined,
|
|
60
|
-
checksumAlgorithm,
|
|
61
|
-
previousChecksum: snapshot.previousChecksum ?? null,
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const healthPromise = registry
|
|
65
|
-
.getSystemHealth()
|
|
66
|
-
.then((health: SystemHealthSnapshot) => {
|
|
67
|
-
const ready = isReady(readiness);
|
|
68
|
-
const reason = resolveReadinessReason(readiness);
|
|
69
|
-
const pluginSnapshot = metricsCollector.getLastPluginMountSnapshot();
|
|
70
|
-
const redisStatus = (registry as any).getRedisStatus?.();
|
|
71
|
-
send({
|
|
72
|
-
type: 'health',
|
|
73
|
-
status: health.status,
|
|
74
|
-
ts: health.ts,
|
|
75
|
-
ready,
|
|
76
|
-
reason,
|
|
77
|
-
registryPartial: readiness.registryPartial,
|
|
78
|
-
registryStale: readiness.registryStale,
|
|
79
|
-
registryLoaded: readiness.registryLoaded,
|
|
80
|
-
pluginMountInProgress: readiness.pluginMountInProgress,
|
|
81
|
-
pluginRoutesMounted: readiness.pluginRoutesMounted,
|
|
82
|
-
pluginsMounted: pluginSnapshot?.succeeded ?? 0,
|
|
83
|
-
pluginsFailed: pluginSnapshot?.failed ?? 0,
|
|
84
|
-
lastPluginMountTs: readiness.lastPluginMountTs ?? null,
|
|
85
|
-
pluginRoutesLastDurationMs: readiness.pluginRoutesLastDurationMs ?? null,
|
|
86
|
-
redisEnabled: redisStatus?.enabled ?? false,
|
|
87
|
-
redisHealthy: redisStatus?.healthy ?? true,
|
|
88
|
-
redisStates: redisStatus?.roles,
|
|
89
|
-
});
|
|
90
|
-
})
|
|
91
|
-
.catch((error: unknown) => {
|
|
92
|
-
if ((request as any).kbLogger) {
|
|
93
|
-
(request as any).kbLogger.warn('Failed to fetch system health for SSE client', { err: error });
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
await new Promise<void>((resolve) => {
|
|
98
|
-
request.raw.on('close', () => {
|
|
99
|
-
unsubscribe();
|
|
100
|
-
reply.raw.end();
|
|
101
|
-
resolve();
|
|
102
|
-
});
|
|
103
|
-
// In inject/test mode, the socket is not a real TCP socket and 'close' may not fire.
|
|
104
|
-
// Wait for health fetch to complete before resolving so health event is included in response.
|
|
105
|
-
if (request.raw.socket && !(request.raw.socket as any).writable) {
|
|
106
|
-
void healthPromise.then(() => {
|
|
107
|
-
unsubscribe();
|
|
108
|
-
reply.raw.end();
|
|
109
|
-
resolve();
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
-
}
|