@kb-labs/rest-api-app 1.3.0 → 1.5.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 +23 -20
- 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
|
@@ -1,494 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration tests for log query endpoints
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { beforeEach, describe, expect, it, vi, afterEach } from 'vitest';
|
|
6
|
-
import Fastify from 'fastify';
|
|
7
|
-
|
|
8
|
-
import type { RestApiConfig } from '@kb-labs/rest-api-core';
|
|
9
|
-
import { registerLogRoutes } from '../logs.js';
|
|
10
|
-
import { platform } from '@kb-labs/core-runtime';
|
|
11
|
-
import type { LogRecord, ILogReader } from '@kb-labs/core-platform';
|
|
12
|
-
|
|
13
|
-
const BASE_CONFIG: RestApiConfig = {
|
|
14
|
-
port: 3000,
|
|
15
|
-
basePath: '/api/v1',
|
|
16
|
-
apiVersion: 'test',
|
|
17
|
-
cors: {
|
|
18
|
-
origins: [],
|
|
19
|
-
allowCredentials: true,
|
|
20
|
-
profile: 'dev',
|
|
21
|
-
},
|
|
22
|
-
plugins: [],
|
|
23
|
-
mockMode: false,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// Helper to create mock log
|
|
27
|
-
const createMockLog = (id: string, level: string, message: string, timestamp = Date.now()): LogRecord => ({
|
|
28
|
-
id,
|
|
29
|
-
timestamp,
|
|
30
|
-
level: level as LogRecord['level'],
|
|
31
|
-
message,
|
|
32
|
-
fields: { plugin: 'test', executionId: 'exec-123' },
|
|
33
|
-
source: 'test',
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
describe('Log Routes Integration Tests', () => {
|
|
37
|
-
let app: ReturnType<typeof Fastify>;
|
|
38
|
-
let mockLogService: Partial<ILogReader>;
|
|
39
|
-
|
|
40
|
-
beforeEach(async () => {
|
|
41
|
-
vi.clearAllMocks();
|
|
42
|
-
|
|
43
|
-
// Create mock log service
|
|
44
|
-
mockLogService = {
|
|
45
|
-
query: vi.fn(),
|
|
46
|
-
getById: vi.fn(),
|
|
47
|
-
search: vi.fn(),
|
|
48
|
-
subscribe: vi.fn(),
|
|
49
|
-
getStats: vi.fn(),
|
|
50
|
-
getCapabilities: vi.fn(),
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// Mock platform.logs
|
|
54
|
-
vi.spyOn(platform, 'logs', 'get').mockReturnValue(mockLogService as ILogReader);
|
|
55
|
-
|
|
56
|
-
app = Fastify({ logger: false });
|
|
57
|
-
await registerLogRoutes(app, BASE_CONFIG, {} as any);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
afterEach(async () => {
|
|
61
|
-
await app.close();
|
|
62
|
-
vi.restoreAllMocks();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
describe('GET /api/v1/logs', () => {
|
|
66
|
-
it('should query logs with filters', async () => {
|
|
67
|
-
const mockLogs = [
|
|
68
|
-
createMockLog('log-1', 'error', 'Error 1', 1000),
|
|
69
|
-
createMockLog('log-2', 'error', 'Error 2', 2000),
|
|
70
|
-
];
|
|
71
|
-
|
|
72
|
-
(mockLogService.query as any).mockResolvedValue({
|
|
73
|
-
logs: mockLogs,
|
|
74
|
-
total: 2,
|
|
75
|
-
hasMore: false,
|
|
76
|
-
source: 'persistence',
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
(mockLogService.getStats as any).mockResolvedValue({
|
|
80
|
-
persistence: {
|
|
81
|
-
totalLogs: 100,
|
|
82
|
-
oldestTimestamp: 1000,
|
|
83
|
-
newestTimestamp: 2000,
|
|
84
|
-
sizeBytes: 1024,
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const response = await app.inject({
|
|
89
|
-
method: 'GET',
|
|
90
|
-
url: '/api/v1/logs?level=error&limit=10',
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
expect(response.statusCode).toBe(200);
|
|
94
|
-
const payload = response.json();
|
|
95
|
-
|
|
96
|
-
expect(payload.ok).toBe(true);
|
|
97
|
-
expect(payload.data.logs).toHaveLength(2);
|
|
98
|
-
expect(payload.data.total).toBe(2);
|
|
99
|
-
expect(payload.data.hasMore).toBe(false);
|
|
100
|
-
expect(payload.data.source).toBe('persistence');
|
|
101
|
-
|
|
102
|
-
expect(mockLogService.query).toHaveBeenCalledWith(
|
|
103
|
-
expect.objectContaining({ level: 'error' }),
|
|
104
|
-
expect.objectContaining({ limit: 10 })
|
|
105
|
-
);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('should use search when search query provided', async () => {
|
|
109
|
-
const mockLogs = [
|
|
110
|
-
createMockLog('log-1', 'error', 'Authentication failed'),
|
|
111
|
-
];
|
|
112
|
-
|
|
113
|
-
(mockLogService.search as any).mockResolvedValue({
|
|
114
|
-
logs: mockLogs,
|
|
115
|
-
total: 1,
|
|
116
|
-
hasMore: false,
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
(mockLogService.getStats as any).mockResolvedValue({});
|
|
120
|
-
|
|
121
|
-
const response = await app.inject({
|
|
122
|
-
method: 'GET',
|
|
123
|
-
url: '/api/v1/logs?search=authentication',
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
expect(response.statusCode).toBe(200);
|
|
127
|
-
const payload = response.json();
|
|
128
|
-
|
|
129
|
-
expect(payload.ok).toBe(true);
|
|
130
|
-
expect(payload.data.logs).toHaveLength(1);
|
|
131
|
-
|
|
132
|
-
expect(mockLogService.search).toHaveBeenCalledWith(
|
|
133
|
-
'authentication',
|
|
134
|
-
expect.objectContaining({ limit: 100, offset: 0 })
|
|
135
|
-
);
|
|
136
|
-
expect(mockLogService.query).not.toHaveBeenCalled();
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it('should handle pagination', async () => {
|
|
140
|
-
const mockLogs = Array.from({ length: 5 }, (_, i) =>
|
|
141
|
-
createMockLog(`log-${i}`, 'info', `Info ${i}`)
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
(mockLogService.query as any).mockResolvedValue({
|
|
145
|
-
logs: mockLogs,
|
|
146
|
-
total: 50,
|
|
147
|
-
hasMore: true,
|
|
148
|
-
source: 'buffer',
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
(mockLogService.getStats as any).mockResolvedValue({});
|
|
152
|
-
|
|
153
|
-
const response = await app.inject({
|
|
154
|
-
method: 'GET',
|
|
155
|
-
url: '/api/v1/logs?limit=5&offset=10',
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
expect(response.statusCode).toBe(200);
|
|
159
|
-
const payload = response.json();
|
|
160
|
-
|
|
161
|
-
expect(payload.data.hasMore).toBe(true);
|
|
162
|
-
expect(payload.data.total).toBe(50);
|
|
163
|
-
|
|
164
|
-
expect(mockLogService.query).toHaveBeenCalledWith(
|
|
165
|
-
expect.anything(),
|
|
166
|
-
expect.objectContaining({ limit: 5, offset: 10 })
|
|
167
|
-
);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
it('should return stats in response', async () => {
|
|
171
|
-
(mockLogService.query as any).mockResolvedValue({
|
|
172
|
-
logs: [],
|
|
173
|
-
total: 0,
|
|
174
|
-
hasMore: false,
|
|
175
|
-
source: 'persistence',
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
(mockLogService.getStats as any).mockResolvedValue({
|
|
179
|
-
buffer: {
|
|
180
|
-
size: 100,
|
|
181
|
-
maxSize: 1000,
|
|
182
|
-
oldestTimestamp: 1000,
|
|
183
|
-
newestTimestamp: 2000,
|
|
184
|
-
},
|
|
185
|
-
persistence: {
|
|
186
|
-
totalLogs: 5000,
|
|
187
|
-
oldestTimestamp: 100,
|
|
188
|
-
newestTimestamp: 3000,
|
|
189
|
-
sizeBytes: 1024000,
|
|
190
|
-
},
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
const response = await app.inject({
|
|
194
|
-
method: 'GET',
|
|
195
|
-
url: '/api/v1/logs',
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
expect(response.statusCode).toBe(200);
|
|
199
|
-
const payload = response.json();
|
|
200
|
-
|
|
201
|
-
expect(payload.data.stats.buffer).toBeDefined();
|
|
202
|
-
expect(payload.data.stats.buffer.size).toBe(100);
|
|
203
|
-
expect(payload.data.stats.persistence).toBeDefined();
|
|
204
|
-
expect(payload.data.stats.persistence.totalLogs).toBe(5000);
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
it('should handle errors gracefully', async () => {
|
|
208
|
-
(mockLogService.query as any).mockRejectedValue(
|
|
209
|
-
new Error('No log storage backend available')
|
|
210
|
-
);
|
|
211
|
-
|
|
212
|
-
const response = await app.inject({
|
|
213
|
-
method: 'GET',
|
|
214
|
-
url: '/api/v1/logs',
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
expect(response.statusCode).toBe(503);
|
|
218
|
-
const payload = response.json();
|
|
219
|
-
|
|
220
|
-
expect(payload.ok).toBe(false);
|
|
221
|
-
expect(payload.error).toBe('Log query failed');
|
|
222
|
-
expect(payload.message).toContain('No log storage backend');
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
describe('GET /api/v1/logs/:id', () => {
|
|
227
|
-
it('should return log by ID', async () => {
|
|
228
|
-
const mockLog = createMockLog('log-123', 'error', 'Test error');
|
|
229
|
-
|
|
230
|
-
(mockLogService.getById as any).mockResolvedValue(mockLog);
|
|
231
|
-
|
|
232
|
-
const response = await app.inject({
|
|
233
|
-
method: 'GET',
|
|
234
|
-
url: '/api/v1/logs/log-123',
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
expect(response.statusCode).toBe(200);
|
|
238
|
-
const payload = response.json();
|
|
239
|
-
|
|
240
|
-
expect(payload.ok).toBe(true);
|
|
241
|
-
expect(payload.data.log.msg).toBe('Test error');
|
|
242
|
-
expect(payload.data.log.level).toBe('error');
|
|
243
|
-
|
|
244
|
-
expect(mockLogService.getById).toHaveBeenCalledWith('log-123');
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
it('should return 404 when log not found', async () => {
|
|
248
|
-
(mockLogService.getById as any).mockResolvedValue(null);
|
|
249
|
-
|
|
250
|
-
const response = await app.inject({
|
|
251
|
-
method: 'GET',
|
|
252
|
-
url: '/api/v1/logs/non-existent',
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
expect(response.statusCode).toBe(404);
|
|
256
|
-
const payload = response.json();
|
|
257
|
-
|
|
258
|
-
expect(payload.ok).toBe(false);
|
|
259
|
-
expect(payload.error).toBe('Log not found');
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
it('should handle errors', async () => {
|
|
263
|
-
(mockLogService.getById as any).mockRejectedValue(
|
|
264
|
-
new Error('Database connection failed')
|
|
265
|
-
);
|
|
266
|
-
|
|
267
|
-
const response = await app.inject({
|
|
268
|
-
method: 'GET',
|
|
269
|
-
url: '/api/v1/logs/log-123',
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
expect(response.statusCode).toBe(500);
|
|
273
|
-
const payload = response.json();
|
|
274
|
-
|
|
275
|
-
expect(payload.ok).toBe(false);
|
|
276
|
-
expect(payload.error).toBe('Failed to fetch log');
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
describe('GET /api/v1/logs/stream', () => {
|
|
281
|
-
it('should return 503 when streaming not supported', async () => {
|
|
282
|
-
(mockLogService.getCapabilities as any).mockReturnValue({
|
|
283
|
-
hasBuffer: false,
|
|
284
|
-
hasPersistence: true,
|
|
285
|
-
hasSearch: true,
|
|
286
|
-
hasStreaming: false,
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
const response = await app.inject({
|
|
290
|
-
method: 'GET',
|
|
291
|
-
url: '/api/v1/logs/stream',
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
expect(response.statusCode).toBe(503);
|
|
295
|
-
const payload = response.json();
|
|
296
|
-
|
|
297
|
-
expect(payload.error).toBe('Log streaming not enabled');
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
// Note: SSE streaming is hard to test in unit tests
|
|
301
|
-
// Would need separate E2E tests with real SSE client
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
describe('GET /api/v1/logs/stats', () => {
|
|
305
|
-
it('should return combined statistics', async () => {
|
|
306
|
-
(mockLogService.getStats as any).mockResolvedValue({
|
|
307
|
-
buffer: {
|
|
308
|
-
size: 150,
|
|
309
|
-
maxSize: 1000,
|
|
310
|
-
oldestTimestamp: 5000,
|
|
311
|
-
newestTimestamp: 10000,
|
|
312
|
-
},
|
|
313
|
-
persistence: {
|
|
314
|
-
totalLogs: 10000,
|
|
315
|
-
oldestTimestamp: 1000,
|
|
316
|
-
newestTimestamp: 10000,
|
|
317
|
-
sizeBytes: 5120000,
|
|
318
|
-
},
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
(mockLogService.getCapabilities as any).mockReturnValue({
|
|
322
|
-
hasBuffer: true,
|
|
323
|
-
hasPersistence: true,
|
|
324
|
-
hasSearch: true,
|
|
325
|
-
hasStreaming: true,
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
const response = await app.inject({
|
|
329
|
-
method: 'GET',
|
|
330
|
-
url: '/api/v1/logs/stats',
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
expect(response.statusCode).toBe(200);
|
|
334
|
-
const payload = response.json();
|
|
335
|
-
|
|
336
|
-
expect(payload.ok).toBe(true);
|
|
337
|
-
expect(payload.data.capabilities).toEqual({
|
|
338
|
-
hasBuffer: true,
|
|
339
|
-
hasPersistence: true,
|
|
340
|
-
hasSearch: true,
|
|
341
|
-
hasStreaming: true,
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
expect(payload.data.buffer).toBeDefined();
|
|
345
|
-
expect(payload.data.buffer.size).toBe(150);
|
|
346
|
-
|
|
347
|
-
expect(payload.data.persistence).toBeDefined();
|
|
348
|
-
expect(payload.data.persistence.totalLogs).toBe(10000);
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
it('should handle only buffer stats', async () => {
|
|
352
|
-
(mockLogService.getStats as any).mockResolvedValue({
|
|
353
|
-
buffer: {
|
|
354
|
-
size: 50,
|
|
355
|
-
maxSize: 1000,
|
|
356
|
-
oldestTimestamp: null,
|
|
357
|
-
newestTimestamp: null,
|
|
358
|
-
},
|
|
359
|
-
});
|
|
360
|
-
|
|
361
|
-
(mockLogService.getCapabilities as any).mockReturnValue({
|
|
362
|
-
hasBuffer: true,
|
|
363
|
-
hasPersistence: false,
|
|
364
|
-
hasSearch: false,
|
|
365
|
-
hasStreaming: true,
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
const response = await app.inject({
|
|
369
|
-
method: 'GET',
|
|
370
|
-
url: '/api/v1/logs/stats',
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
expect(response.statusCode).toBe(200);
|
|
374
|
-
const payload = response.json();
|
|
375
|
-
|
|
376
|
-
expect(payload.data.buffer).toBeDefined();
|
|
377
|
-
expect(payload.data.persistence).toBeUndefined();
|
|
378
|
-
expect(payload.data.capabilities.hasPersistence).toBe(false);
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
it('should handle errors', async () => {
|
|
382
|
-
(mockLogService.getStats as any).mockRejectedValue(
|
|
383
|
-
new Error('Stats unavailable')
|
|
384
|
-
);
|
|
385
|
-
|
|
386
|
-
const response = await app.inject({
|
|
387
|
-
method: 'GET',
|
|
388
|
-
url: '/api/v1/logs/stats',
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
expect(response.statusCode).toBe(500);
|
|
392
|
-
const payload = response.json();
|
|
393
|
-
|
|
394
|
-
expect(payload.ok).toBe(false);
|
|
395
|
-
expect(payload.error).toBe('Failed to fetch stats');
|
|
396
|
-
});
|
|
397
|
-
});
|
|
398
|
-
|
|
399
|
-
describe('POST /api/v1/logs/summarize', () => {
|
|
400
|
-
it('should summarize logs with LLM', async () => {
|
|
401
|
-
const mockLogs = [
|
|
402
|
-
createMockLog('log-1', 'error', 'Database connection failed'),
|
|
403
|
-
createMockLog('log-2', 'error', 'Timeout connecting to DB'),
|
|
404
|
-
];
|
|
405
|
-
|
|
406
|
-
(mockLogService.query as any).mockResolvedValue({
|
|
407
|
-
logs: mockLogs,
|
|
408
|
-
total: 2,
|
|
409
|
-
hasMore: false,
|
|
410
|
-
source: 'persistence',
|
|
411
|
-
});
|
|
412
|
-
|
|
413
|
-
// Mock platform.llm
|
|
414
|
-
const mockLLM = {
|
|
415
|
-
complete: vi.fn().mockResolvedValue({
|
|
416
|
-
content: 'Database connection issues detected. Multiple timeouts occurred.',
|
|
417
|
-
}),
|
|
418
|
-
};
|
|
419
|
-
vi.spyOn(platform, 'llm', 'get').mockReturnValue(mockLLM as any);
|
|
420
|
-
|
|
421
|
-
const response = await app.inject({
|
|
422
|
-
method: 'POST',
|
|
423
|
-
url: '/api/v1/logs/summarize',
|
|
424
|
-
payload: {
|
|
425
|
-
timeRange: {
|
|
426
|
-
from: new Date(Date.now() - 3600000).toISOString(),
|
|
427
|
-
to: new Date().toISOString(),
|
|
428
|
-
},
|
|
429
|
-
filters: { level: 'error' },
|
|
430
|
-
question: 'What errors occurred?',
|
|
431
|
-
},
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
expect(response.statusCode).toBe(200);
|
|
435
|
-
const payload = response.json();
|
|
436
|
-
|
|
437
|
-
expect(payload.ok).toBe(true);
|
|
438
|
-
expect(payload.data.aiSummary).toContain('Database connection issues');
|
|
439
|
-
expect(payload.data.summary.total).toBe(2);
|
|
440
|
-
|
|
441
|
-
expect(mockLogService.query).toHaveBeenCalled();
|
|
442
|
-
expect(mockLLM.complete).toHaveBeenCalled();
|
|
443
|
-
});
|
|
444
|
-
|
|
445
|
-
it('should handle missing LLM gracefully', async () => {
|
|
446
|
-
const mockLogs = [
|
|
447
|
-
createMockLog('log-1', 'error', 'Error 1'),
|
|
448
|
-
];
|
|
449
|
-
|
|
450
|
-
(mockLogService.query as any).mockResolvedValue({
|
|
451
|
-
logs: mockLogs,
|
|
452
|
-
total: 1,
|
|
453
|
-
hasMore: false,
|
|
454
|
-
source: 'buffer',
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
// No LLM available
|
|
458
|
-
vi.spyOn(platform, 'llm', 'get').mockReturnValue(undefined as any);
|
|
459
|
-
|
|
460
|
-
const response = await app.inject({
|
|
461
|
-
method: 'POST',
|
|
462
|
-
url: '/api/v1/logs/summarize',
|
|
463
|
-
payload: {
|
|
464
|
-
question: 'What happened?',
|
|
465
|
-
},
|
|
466
|
-
});
|
|
467
|
-
|
|
468
|
-
expect(response.statusCode).toBe(200);
|
|
469
|
-
const payload = response.json();
|
|
470
|
-
|
|
471
|
-
expect(payload.ok).toBe(true);
|
|
472
|
-
expect(payload.data.aiSummary).toContain('Log Summary'); // Fallback summary
|
|
473
|
-
expect(payload.data.message).toContain('LLM not configured');
|
|
474
|
-
});
|
|
475
|
-
|
|
476
|
-
it('should handle errors', async () => {
|
|
477
|
-
(mockLogService.query as any).mockRejectedValue(
|
|
478
|
-
new Error('Query failed')
|
|
479
|
-
);
|
|
480
|
-
|
|
481
|
-
const response = await app.inject({
|
|
482
|
-
method: 'POST',
|
|
483
|
-
url: '/api/v1/logs/summarize',
|
|
484
|
-
payload: {},
|
|
485
|
-
});
|
|
486
|
-
|
|
487
|
-
expect(response.statusCode).toBe(500);
|
|
488
|
-
const payload = response.json();
|
|
489
|
-
|
|
490
|
-
expect(payload.ok).toBe(false);
|
|
491
|
-
expect(payload.error).toBe('Log summarization failed');
|
|
492
|
-
});
|
|
493
|
-
});
|
|
494
|
-
});
|