@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/readiness.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// Shared readiness state for health and plugin routes
|
|
2
|
-
export interface ReadinessState {
|
|
3
|
-
cliApiInitialized: boolean;
|
|
4
|
-
registryLoaded: boolean;
|
|
5
|
-
registryPartial: boolean;
|
|
6
|
-
registryStale: boolean;
|
|
7
|
-
pluginRoutesMounted: boolean;
|
|
8
|
-
pluginMountInProgress: boolean;
|
|
9
|
-
pluginRoutesCount: number;
|
|
10
|
-
pluginRouteErrors: number;
|
|
11
|
-
pluginRouteFailures: Array<{ id: string; error: string }>;
|
|
12
|
-
lastPluginMountTs?: string | null;
|
|
13
|
-
pluginRoutesLastDurationMs?: number | null;
|
|
14
|
-
redisEnabled: boolean;
|
|
15
|
-
redisConnected: boolean;
|
|
16
|
-
redisStates: {
|
|
17
|
-
publisher: string | null;
|
|
18
|
-
subscriber: string | null;
|
|
19
|
-
cache: string | null;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function createInitialReadinessState(): ReadinessState {
|
|
24
|
-
return {
|
|
25
|
-
cliApiInitialized: false,
|
|
26
|
-
registryLoaded: false,
|
|
27
|
-
registryPartial: false,
|
|
28
|
-
registryStale: false,
|
|
29
|
-
pluginRoutesMounted: false,
|
|
30
|
-
pluginMountInProgress: true,
|
|
31
|
-
pluginRoutesCount: 0,
|
|
32
|
-
pluginRouteErrors: 0,
|
|
33
|
-
pluginRouteFailures: [],
|
|
34
|
-
lastPluginMountTs: null,
|
|
35
|
-
pluginRoutesLastDurationMs: null,
|
|
36
|
-
redisEnabled: false,
|
|
37
|
-
redisConnected: true,
|
|
38
|
-
redisStates: {
|
|
39
|
-
publisher: null,
|
|
40
|
-
subscriber: null,
|
|
41
|
-
cache: null,
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function isReady(readiness: ReadinessState): boolean {
|
|
47
|
-
return (
|
|
48
|
-
readiness.cliApiInitialized &&
|
|
49
|
-
readiness.registryLoaded &&
|
|
50
|
-
!readiness.registryPartial &&
|
|
51
|
-
!readiness.registryStale &&
|
|
52
|
-
(!readiness.redisEnabled || readiness.redisConnected)
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function resolveReadinessReason(readiness: ReadinessState):
|
|
57
|
-
| 'ready'
|
|
58
|
-
| 'cli_api_not_initialized'
|
|
59
|
-
| 'registry_not_loaded'
|
|
60
|
-
| 'registry_partial'
|
|
61
|
-
| 'registry_snapshot_stale'
|
|
62
|
-
| 'redis_unavailable'
|
|
63
|
-
| 'plugin_mount_in_progress' {
|
|
64
|
-
if (!readiness.cliApiInitialized) {
|
|
65
|
-
return 'cli_api_not_initialized';
|
|
66
|
-
}
|
|
67
|
-
if (!readiness.registryLoaded) {
|
|
68
|
-
if (readiness.registryStale) {
|
|
69
|
-
return 'registry_snapshot_stale';
|
|
70
|
-
}
|
|
71
|
-
if (readiness.registryPartial) {
|
|
72
|
-
return 'registry_partial';
|
|
73
|
-
}
|
|
74
|
-
return 'registry_not_loaded';
|
|
75
|
-
}
|
|
76
|
-
if (readiness.redisEnabled && !readiness.redisConnected) {
|
|
77
|
-
return 'redis_unavailable';
|
|
78
|
-
}
|
|
79
|
-
if (readiness.pluginMountInProgress) {
|
|
80
|
-
return 'plugin_mount_in_progress';
|
|
81
|
-
}
|
|
82
|
-
return 'ready';
|
|
83
|
-
}
|
|
@@ -1,469 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Workflow Management API endpoints
|
|
3
|
-
* Provides CRUD operations and schedule management for workflows
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { FastifyInstance } from 'fastify';
|
|
7
|
-
import type { ZodTypeProvider } from 'fastify-type-provider-zod';
|
|
8
|
-
import { serializerCompiler, validatorCompiler } from 'fastify-type-provider-zod';
|
|
9
|
-
import type { RestApiConfig } from '@kb-labs/rest-api-core';
|
|
10
|
-
import type { IEntityRegistry } from '@kb-labs/core-registry';
|
|
11
|
-
import type { PlatformServices } from '@kb-labs/plugin-contracts';
|
|
12
|
-
import type { IWorkflowEngine, ICronManager } from '@kb-labs/core-platform';
|
|
13
|
-
import {
|
|
14
|
-
WorkflowService,
|
|
15
|
-
WorkflowScheduleManager,
|
|
16
|
-
type WorkflowExecutor,
|
|
17
|
-
} from '@kb-labs/workflow-engine';
|
|
18
|
-
import { z } from 'zod';
|
|
19
|
-
import {
|
|
20
|
-
ListWorkflowsQuerySchema,
|
|
21
|
-
WorkflowsListResponseSchema,
|
|
22
|
-
WorkflowResponseSchema,
|
|
23
|
-
CreateWorkflowBodySchema,
|
|
24
|
-
UpdateWorkflowBodySchema,
|
|
25
|
-
ScheduleConfigBodySchema,
|
|
26
|
-
ValidateWorkflowBodySchema,
|
|
27
|
-
HandlersListResponseSchema,
|
|
28
|
-
ErrorResponseSchema,
|
|
29
|
-
} from '@kb-labs/rest-api-contracts';
|
|
30
|
-
import { normalizeBasePath } from '../utils/path-helpers';
|
|
31
|
-
|
|
32
|
-
// ============================================================================
|
|
33
|
-
// Helper Functions
|
|
34
|
-
// ============================================================================
|
|
35
|
-
|
|
36
|
-
function errPayload(code: string, message: string) {
|
|
37
|
-
return { ok: false as const, message, error: { code, message } };
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// ============================================================================
|
|
41
|
-
// Route Registration
|
|
42
|
-
// ============================================================================
|
|
43
|
-
|
|
44
|
-
export async function registerWorkflowManagementRoutes(
|
|
45
|
-
server: FastifyInstance,
|
|
46
|
-
config: RestApiConfig,
|
|
47
|
-
registry: IEntityRegistry,
|
|
48
|
-
platform: PlatformServices,
|
|
49
|
-
workflowEngine: IWorkflowEngine | null,
|
|
50
|
-
cronManager: ICronManager | null,
|
|
51
|
-
): Promise<void> {
|
|
52
|
-
const basePath = normalizeBasePath(config.basePath);
|
|
53
|
-
|
|
54
|
-
// Encapsulate Zod compilers so they don't leak to plugin routes (plain JSON schemas)
|
|
55
|
-
await server.register(async (scope) => {
|
|
56
|
-
scope.setValidatorCompiler(validatorCompiler);
|
|
57
|
-
scope.setSerializerCompiler(serializerCompiler);
|
|
58
|
-
const s = scope.withTypeProvider<ZodTypeProvider>();
|
|
59
|
-
|
|
60
|
-
// Initialize services
|
|
61
|
-
const workflowService = new WorkflowService({
|
|
62
|
-
cliApi: registry,
|
|
63
|
-
platform,
|
|
64
|
-
workflowStorageDir: '.kb/workflows',
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// Initialize WorkflowScheduleManager to register jobs from manifests
|
|
68
|
-
if (cronManager && workflowEngine) {
|
|
69
|
-
const executor: WorkflowExecutor = {
|
|
70
|
-
async execute(request) {
|
|
71
|
-
const run = await workflowEngine.execute(
|
|
72
|
-
request.workflowId,
|
|
73
|
-
request.input ?? {},
|
|
74
|
-
{
|
|
75
|
-
tags: { trigger: request.trigger },
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
return { runId: run.id };
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const scheduleManager = new WorkflowScheduleManager({
|
|
83
|
-
cronManager,
|
|
84
|
-
workflowService,
|
|
85
|
-
executor,
|
|
86
|
-
platform,
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
// Register all scheduled workflows/jobs from manifests
|
|
90
|
-
await scheduleManager.registerAll();
|
|
91
|
-
|
|
92
|
-
platform.logger?.info('WorkflowScheduleManager initialized and jobs registered');
|
|
93
|
-
} else {
|
|
94
|
-
platform.logger?.warn('WorkflowScheduleManager not initialized: cronManager or workflowEngine unavailable');
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// ========================================================================
|
|
98
|
-
// Workflow CRUD
|
|
99
|
-
// ========================================================================
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* GET /api/v1/workflows
|
|
103
|
-
* List all workflows (manifest + standalone)
|
|
104
|
-
*/
|
|
105
|
-
s.route({
|
|
106
|
-
method: 'GET',
|
|
107
|
-
url: `${basePath}/workflows`,
|
|
108
|
-
schema: {
|
|
109
|
-
tags: ['Workflows'],
|
|
110
|
-
summary: 'List all workflows',
|
|
111
|
-
querystring: ListWorkflowsQuerySchema,
|
|
112
|
-
response: {
|
|
113
|
-
200: WorkflowsListResponseSchema,
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
handler: async (request, reply) => {
|
|
117
|
-
const query = request.query;
|
|
118
|
-
|
|
119
|
-
const workflows = await workflowService.listAll({
|
|
120
|
-
source: query.source,
|
|
121
|
-
status: query.status,
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
let filtered = workflows;
|
|
125
|
-
|
|
126
|
-
if (query.tags) {
|
|
127
|
-
const tags = query.tags.split(',').map((t) => t.trim());
|
|
128
|
-
filtered = filtered.filter((w) => (w as any).tags?.some((tag: string) => tags.includes(tag)));
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (query.search) {
|
|
132
|
-
const search = query.search.toLowerCase();
|
|
133
|
-
filtered = filtered.filter(
|
|
134
|
-
(w) =>
|
|
135
|
-
(w as any).name?.toLowerCase().includes(search) ||
|
|
136
|
-
(w as any).description?.toLowerCase().includes(search)
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
reply.send({ workflows: filtered as any, total: filtered.length });
|
|
141
|
-
},
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* GET /api/v1/workflows/handlers
|
|
146
|
-
* List available workflow handlers (must be before /:id to avoid route conflict)
|
|
147
|
-
*/
|
|
148
|
-
s.route({
|
|
149
|
-
method: 'GET',
|
|
150
|
-
url: `${basePath}/workflows/handlers`,
|
|
151
|
-
schema: {
|
|
152
|
-
tags: ['Workflows'],
|
|
153
|
-
summary: 'List available workflow handlers',
|
|
154
|
-
response: {
|
|
155
|
-
200: HandlersListResponseSchema,
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
handler: async (request, reply) => {
|
|
159
|
-
const handlers = await workflowService.getAvailableHandlers();
|
|
160
|
-
reply.send({ handlers: handlers as any, total: handlers.length });
|
|
161
|
-
},
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* POST /api/v1/workflows/validate
|
|
166
|
-
* Validate workflow spec (must be before /:id to avoid route conflict)
|
|
167
|
-
*/
|
|
168
|
-
s.route({
|
|
169
|
-
method: 'POST',
|
|
170
|
-
url: `${basePath}/workflows/validate`,
|
|
171
|
-
schema: {
|
|
172
|
-
tags: ['Workflows'],
|
|
173
|
-
summary: 'Validate workflow spec',
|
|
174
|
-
body: ValidateWorkflowBodySchema,
|
|
175
|
-
response: {
|
|
176
|
-
200: z.record(z.string(), z.unknown()),
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
handler: async (request, reply) => {
|
|
180
|
-
const result = await workflowService.validate(request.body.spec);
|
|
181
|
-
reply.send(result as any);
|
|
182
|
-
},
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* GET /api/v1/workflows/:id
|
|
187
|
-
* Get workflow by ID
|
|
188
|
-
*/
|
|
189
|
-
s.route({
|
|
190
|
-
method: 'GET',
|
|
191
|
-
url: `${basePath}/workflows/:id`,
|
|
192
|
-
schema: {
|
|
193
|
-
tags: ['Workflows'],
|
|
194
|
-
summary: 'Get workflow by ID',
|
|
195
|
-
params: z.object({ id: z.string() }),
|
|
196
|
-
response: {
|
|
197
|
-
200: WorkflowResponseSchema,
|
|
198
|
-
404: ErrorResponseSchema,
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
handler: async (request, reply) => {
|
|
202
|
-
const workflow = await workflowService.get(request.params.id);
|
|
203
|
-
|
|
204
|
-
if (!workflow) {
|
|
205
|
-
return reply.code(404).send(errPayload('WF_NOT_FOUND', `Workflow ${request.params.id} not found`) as any);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
reply.send({ workflow } as any);
|
|
209
|
-
},
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* POST /api/v1/workflows
|
|
214
|
-
* Create new standalone workflow
|
|
215
|
-
*/
|
|
216
|
-
s.route({
|
|
217
|
-
method: 'POST',
|
|
218
|
-
url: `${basePath}/workflows`,
|
|
219
|
-
schema: {
|
|
220
|
-
tags: ['Workflows'],
|
|
221
|
-
summary: 'Create standalone workflow',
|
|
222
|
-
body: CreateWorkflowBodySchema,
|
|
223
|
-
response: {
|
|
224
|
-
201: WorkflowResponseSchema,
|
|
225
|
-
400: ErrorResponseSchema,
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
handler: async (request, reply) => {
|
|
229
|
-
const workflow = await workflowService.create(request.body.spec as any);
|
|
230
|
-
reply.code(201).send({ workflow } as any);
|
|
231
|
-
},
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* PUT /api/v1/workflows/:id
|
|
236
|
-
* Update standalone workflow
|
|
237
|
-
*/
|
|
238
|
-
s.route({
|
|
239
|
-
method: 'PUT',
|
|
240
|
-
url: `${basePath}/workflows/:id`,
|
|
241
|
-
schema: {
|
|
242
|
-
tags: ['Workflows'],
|
|
243
|
-
summary: 'Update standalone workflow',
|
|
244
|
-
params: z.object({ id: z.string() }),
|
|
245
|
-
body: UpdateWorkflowBodySchema,
|
|
246
|
-
response: {
|
|
247
|
-
200: WorkflowResponseSchema,
|
|
248
|
-
400: ErrorResponseSchema,
|
|
249
|
-
404: ErrorResponseSchema,
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
handler: async (request, reply) => {
|
|
253
|
-
const id = request.params.id;
|
|
254
|
-
|
|
255
|
-
const existing = await workflowService.get(id);
|
|
256
|
-
if (!existing) {
|
|
257
|
-
return reply.code(404).send(errPayload('WF_NOT_FOUND', `Workflow ${id} not found`) as any);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
if ((existing as any).source !== 'standalone') {
|
|
261
|
-
return reply.code(400).send(errPayload('WF_NOT_STANDALONE', `Cannot update manifest-based workflow ${id}`) as any);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
if (request.body.spec) {
|
|
265
|
-
await workflowService.update(id, request.body.spec);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
if (request.body.status) {
|
|
269
|
-
if (request.body.status === 'paused') {
|
|
270
|
-
await workflowService.pause(id);
|
|
271
|
-
} else if (request.body.status === 'active') {
|
|
272
|
-
await workflowService.resume(id);
|
|
273
|
-
} else if (request.body.status === 'disabled') {
|
|
274
|
-
await workflowService.disable(id);
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
const workflow = await workflowService.get(id);
|
|
279
|
-
reply.send({ workflow } as any);
|
|
280
|
-
},
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* DELETE /api/v1/workflows/:id
|
|
285
|
-
* Delete standalone workflow
|
|
286
|
-
*/
|
|
287
|
-
s.route({
|
|
288
|
-
method: 'DELETE',
|
|
289
|
-
url: `${basePath}/workflows/:id`,
|
|
290
|
-
schema: {
|
|
291
|
-
tags: ['Workflows'],
|
|
292
|
-
summary: 'Delete standalone workflow',
|
|
293
|
-
params: z.object({ id: z.string() }),
|
|
294
|
-
response: {
|
|
295
|
-
204: z.null(),
|
|
296
|
-
400: ErrorResponseSchema,
|
|
297
|
-
404: ErrorResponseSchema,
|
|
298
|
-
},
|
|
299
|
-
},
|
|
300
|
-
handler: async (request, reply) => {
|
|
301
|
-
const id = request.params.id;
|
|
302
|
-
|
|
303
|
-
const existing = await workflowService.get(id);
|
|
304
|
-
if (!existing) {
|
|
305
|
-
return reply.code(404).send(errPayload('WF_NOT_FOUND', `Workflow ${id} not found`) as any);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
if ((existing as any).source !== 'standalone') {
|
|
309
|
-
return reply.code(400).send(errPayload('WF_NOT_STANDALONE', `Cannot delete manifest-based workflow ${id}`) as any);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
await workflowService.delete(id);
|
|
313
|
-
reply.code(204).send(null);
|
|
314
|
-
},
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
// ========================================================================
|
|
318
|
-
// Schedule Management
|
|
319
|
-
// ========================================================================
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* POST /api/v1/workflows/:id/schedule
|
|
323
|
-
* Enable or update workflow schedule
|
|
324
|
-
*/
|
|
325
|
-
s.route({
|
|
326
|
-
method: 'POST',
|
|
327
|
-
url: `${basePath}/workflows/:id/schedule`,
|
|
328
|
-
schema: {
|
|
329
|
-
tags: ['Workflows'],
|
|
330
|
-
summary: 'Enable or update workflow schedule',
|
|
331
|
-
params: z.object({ id: z.string() }),
|
|
332
|
-
body: ScheduleConfigBodySchema,
|
|
333
|
-
response: {
|
|
334
|
-
200: WorkflowResponseSchema,
|
|
335
|
-
400: ErrorResponseSchema,
|
|
336
|
-
404: ErrorResponseSchema,
|
|
337
|
-
},
|
|
338
|
-
},
|
|
339
|
-
handler: async (request, reply) => {
|
|
340
|
-
const id = request.params.id;
|
|
341
|
-
const scheduleConfig = request.body;
|
|
342
|
-
|
|
343
|
-
const existing = await workflowService.get(id);
|
|
344
|
-
if (!existing) {
|
|
345
|
-
return reply.code(404).send(errPayload('WF_NOT_FOUND', `Workflow ${id} not found`) as any);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
if ((existing as any).source !== 'standalone') {
|
|
349
|
-
return reply.code(400).send(errPayload('WF_NOT_STANDALONE', `Cannot modify schedule for manifest-based workflow ${id}`) as any);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
const workflow = await workflowService.update(id, {
|
|
353
|
-
on: {
|
|
354
|
-
schedule: scheduleConfig.enabled
|
|
355
|
-
? { cron: scheduleConfig.cron, timezone: scheduleConfig.timezone }
|
|
356
|
-
: undefined,
|
|
357
|
-
},
|
|
358
|
-
});
|
|
359
|
-
|
|
360
|
-
reply.send({ workflow } as any);
|
|
361
|
-
},
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* DELETE /api/v1/workflows/:id/schedule
|
|
366
|
-
* Disable workflow schedule
|
|
367
|
-
*/
|
|
368
|
-
s.route({
|
|
369
|
-
method: 'DELETE',
|
|
370
|
-
url: `${basePath}/workflows/:id/schedule`,
|
|
371
|
-
schema: {
|
|
372
|
-
tags: ['Workflows'],
|
|
373
|
-
summary: 'Disable workflow schedule',
|
|
374
|
-
params: z.object({ id: z.string() }),
|
|
375
|
-
response: {
|
|
376
|
-
200: WorkflowResponseSchema,
|
|
377
|
-
400: ErrorResponseSchema,
|
|
378
|
-
404: ErrorResponseSchema,
|
|
379
|
-
},
|
|
380
|
-
},
|
|
381
|
-
handler: async (request, reply) => {
|
|
382
|
-
const id = request.params.id;
|
|
383
|
-
|
|
384
|
-
const existing = await workflowService.get(id);
|
|
385
|
-
if (!existing) {
|
|
386
|
-
return reply.code(404).send(errPayload('WF_NOT_FOUND', `Workflow ${id} not found`) as any);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
if ((existing as any).source !== 'standalone') {
|
|
390
|
-
return reply.code(400).send(errPayload('WF_NOT_STANDALONE', `Cannot modify schedule for manifest-based workflow ${id}`) as any);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
const workflow = await workflowService.update(id, { on: { schedule: undefined } });
|
|
394
|
-
reply.send({ workflow } as any);
|
|
395
|
-
},
|
|
396
|
-
});
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* POST /api/v1/workflows/:id/pause
|
|
400
|
-
* Pause workflow (disable schedule temporarily)
|
|
401
|
-
*/
|
|
402
|
-
s.route({
|
|
403
|
-
method: 'POST',
|
|
404
|
-
url: `${basePath}/workflows/:id/pause`,
|
|
405
|
-
schema: {
|
|
406
|
-
tags: ['Workflows'],
|
|
407
|
-
summary: 'Pause workflow (disable schedule temporarily)',
|
|
408
|
-
params: z.object({ id: z.string() }),
|
|
409
|
-
response: {
|
|
410
|
-
200: WorkflowResponseSchema,
|
|
411
|
-
400: ErrorResponseSchema,
|
|
412
|
-
404: ErrorResponseSchema,
|
|
413
|
-
},
|
|
414
|
-
},
|
|
415
|
-
handler: async (request, reply) => {
|
|
416
|
-
const id = request.params.id;
|
|
417
|
-
|
|
418
|
-
const existing = await workflowService.get(id);
|
|
419
|
-
if (!existing) {
|
|
420
|
-
return reply.code(404).send(errPayload('WF_NOT_FOUND', `Workflow ${id} not found`) as any);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
if ((existing as any).source !== 'standalone') {
|
|
424
|
-
return reply.code(400).send(errPayload('WF_NOT_STANDALONE', `Cannot pause manifest-based workflow ${id}`) as any);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
await workflowService.pause(id);
|
|
428
|
-
const workflow = await workflowService.get(id);
|
|
429
|
-
reply.send({ workflow } as any);
|
|
430
|
-
},
|
|
431
|
-
});
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* POST /api/v1/workflows/:id/resume
|
|
435
|
-
* Resume workflow (re-enable schedule)
|
|
436
|
-
*/
|
|
437
|
-
s.route({
|
|
438
|
-
method: 'POST',
|
|
439
|
-
url: `${basePath}/workflows/:id/resume`,
|
|
440
|
-
schema: {
|
|
441
|
-
tags: ['Workflows'],
|
|
442
|
-
summary: 'Resume workflow (re-enable schedule)',
|
|
443
|
-
params: z.object({ id: z.string() }),
|
|
444
|
-
response: {
|
|
445
|
-
200: WorkflowResponseSchema,
|
|
446
|
-
400: ErrorResponseSchema,
|
|
447
|
-
404: ErrorResponseSchema,
|
|
448
|
-
},
|
|
449
|
-
},
|
|
450
|
-
handler: async (request, reply) => {
|
|
451
|
-
const id = request.params.id;
|
|
452
|
-
|
|
453
|
-
const existing = await workflowService.get(id);
|
|
454
|
-
if (!existing) {
|
|
455
|
-
return reply.code(404).send(errPayload('WF_NOT_FOUND', `Workflow ${id} not found`) as any);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
if ((existing as any).source !== 'standalone') {
|
|
459
|
-
return reply.code(400).send(errPayload('WF_NOT_STANDALONE', `Cannot resume manifest-based workflow ${id}`) as any);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
await workflowService.resume(id);
|
|
463
|
-
const workflow = await workflowService.get(id);
|
|
464
|
-
reply.send({ workflow } as any);
|
|
465
|
-
},
|
|
466
|
-
});
|
|
467
|
-
|
|
468
|
-
}); // end encapsulated scope
|
|
469
|
-
}
|