@kb-labs/rest-api-app 1.3.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.
Files changed (255) hide show
  1. package/.kb/agents/sessions/session-1771531145393-ws3uh6q/turns.json +42 -0
  2. package/.kb/agents/sessions/session-1771548930486-ui6rtvm/turns.json +33 -0
  3. package/.kb/agents/sessions/session-1771549691485-nibqroq/turns.json +133 -0
  4. package/.kb/agents/sessions/session-1771550943182-dkwqdjc/turns.json +130 -0
  5. package/.kb/agents/sessions/session-1771551564182-cr4bwzn/turns.json +349 -0
  6. package/.kb/agents/sessions/session-1771552401370-g4ztwd1/turns.json +206 -0
  7. package/.kb/commit/current/plan.json +248 -0
  8. package/.kb/commit/current/status.json +472 -0
  9. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/health.d.ts +10 -0
  10. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/health.js +215 -0
  11. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/health.js.map +1 -0
  12. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/list.d.ts +10 -0
  13. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/list.js +271 -0
  14. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/list.js.map +1 -0
  15. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/logs.d.ts +10 -0
  16. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/logs.js +230 -0
  17. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/logs.js.map +1 -0
  18. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/metrics.d.ts +10 -0
  19. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/metrics.js +228 -0
  20. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/metrics.js.map +1 -0
  21. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/run.d.ts +11 -0
  22. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/run.js +281 -0
  23. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/run.js.map +1 -0
  24. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/status.d.ts +10 -0
  25. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/status.js +266 -0
  26. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/status.js.map +1 -0
  27. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/workflow-run.d.ts +11 -0
  28. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/workflow-run.js +284 -0
  29. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/workflow-run.js.map +1 -0
  30. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/flags-WLdpSZl4.d.ts +77 -0
  31. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/index.d.ts +2 -0
  32. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/index.js +441 -0
  33. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/index.js.map +1 -0
  34. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/manifest.d.ts +196 -0
  35. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/manifest.js +441 -0
  36. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/manifest.js.map +1 -0
  37. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/cron-list-handler.d.ts +19 -0
  38. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/cron-list-handler.js +48 -0
  39. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/cron-list-handler.js.map +1 -0
  40. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/index.d.ts +6 -0
  41. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/index.js +170 -0
  42. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/index.js.map +1 -0
  43. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-cancel-handler.d.ts +12 -0
  44. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-cancel-handler.js +52 -0
  45. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-cancel-handler.js.map +1 -0
  46. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-detail-handler.d.ts +22 -0
  47. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-detail-handler.js +52 -0
  48. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-detail-handler.js.map +1 -0
  49. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-logs-handler.d.ts +13 -0
  50. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-logs-handler.js +52 -0
  51. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-logs-handler.js.map +1 -0
  52. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-steps-handler.d.ts +9 -0
  53. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-steps-handler.js +43 -0
  54. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-steps-handler.js.map +1 -0
  55. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/jobs-list-handler.d.ts +26 -0
  56. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/jobs-list-handler.js +63 -0
  57. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/jobs-list-handler.js.map +1 -0
  58. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/pending-approvals-handler.d.ts +9 -0
  59. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/pending-approvals-handler.js +46 -0
  60. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/pending-approvals-handler.js.map +1 -0
  61. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/resolve-approval-handler.d.ts +16 -0
  62. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/resolve-approval-handler.js +58 -0
  63. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/resolve-approval-handler.js.map +1 -0
  64. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/run-detail-handler.d.ts +9 -0
  65. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/run-detail-handler.js +46 -0
  66. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/run-detail-handler.js.map +1 -0
  67. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/runs-list-handler.d.ts +11 -0
  68. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/runs-list-handler.js +50 -0
  69. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/runs-list-handler.js.map +1 -0
  70. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/stats-handler.d.ts +7 -0
  71. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/stats-handler.js +39 -0
  72. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/stats-handler.js.map +1 -0
  73. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-detail-handler.d.ts +10 -0
  74. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-detail-handler.js +46 -0
  75. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-detail-handler.js.map +1 -0
  76. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-cancel-handler.d.ts +13 -0
  77. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-cancel-handler.js +47 -0
  78. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-cancel-handler.js.map +1 -0
  79. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-handler.d.ts +14 -0
  80. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-handler.js +53 -0
  81. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-handler.js.map +1 -0
  82. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-runs-handler.d.ts +13 -0
  83. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-runs-handler.js +54 -0
  84. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-runs-handler.js.map +1 -0
  85. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflows-list-handler.d.ts +12 -0
  86. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflows-list-handler.js +51 -0
  87. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflows-list-handler.js.map +1 -0
  88. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/logs-channel.d.ts +17 -0
  89. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/logs-channel.js +133 -0
  90. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/logs-channel.js.map +1 -0
  91. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/progress-channel.d.ts +11 -0
  92. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/progress-channel.js +46 -0
  93. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/progress-channel.js.map +1 -0
  94. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/health.d.ts +10 -0
  95. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/health.js +215 -0
  96. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/health.js.map +1 -0
  97. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/list.d.ts +10 -0
  98. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/list.js +271 -0
  99. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/list.js.map +1 -0
  100. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/logs.d.ts +10 -0
  101. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/logs.js +230 -0
  102. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/logs.js.map +1 -0
  103. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/metrics.d.ts +10 -0
  104. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/metrics.js +228 -0
  105. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/metrics.js.map +1 -0
  106. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/run.d.ts +11 -0
  107. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/run.js +281 -0
  108. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/run.js.map +1 -0
  109. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/status.d.ts +10 -0
  110. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/status.js +266 -0
  111. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/status.js.map +1 -0
  112. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/workflow-run.d.ts +11 -0
  113. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/workflow-run.js +284 -0
  114. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/workflow-run.js.map +1 -0
  115. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/flags-WLdpSZl4.d.ts +77 -0
  116. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/index.d.ts +2 -0
  117. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/index.js +441 -0
  118. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/index.js.map +1 -0
  119. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/manifest.d.ts +196 -0
  120. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/manifest.js +441 -0
  121. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/manifest.js.map +1 -0
  122. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/cron-list-handler.d.ts +19 -0
  123. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/cron-list-handler.js +48 -0
  124. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/cron-list-handler.js.map +1 -0
  125. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/index.d.ts +6 -0
  126. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/index.js +170 -0
  127. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/index.js.map +1 -0
  128. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-cancel-handler.d.ts +12 -0
  129. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-cancel-handler.js +52 -0
  130. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-cancel-handler.js.map +1 -0
  131. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-detail-handler.d.ts +22 -0
  132. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-detail-handler.js +52 -0
  133. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-detail-handler.js.map +1 -0
  134. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-logs-handler.d.ts +13 -0
  135. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-logs-handler.js +52 -0
  136. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-logs-handler.js.map +1 -0
  137. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-steps-handler.d.ts +9 -0
  138. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-steps-handler.js +43 -0
  139. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-steps-handler.js.map +1 -0
  140. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/jobs-list-handler.d.ts +26 -0
  141. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/jobs-list-handler.js +63 -0
  142. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/jobs-list-handler.js.map +1 -0
  143. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/pending-approvals-handler.d.ts +9 -0
  144. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/pending-approvals-handler.js +46 -0
  145. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/pending-approvals-handler.js.map +1 -0
  146. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/resolve-approval-handler.d.ts +16 -0
  147. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/resolve-approval-handler.js +58 -0
  148. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/resolve-approval-handler.js.map +1 -0
  149. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/run-detail-handler.d.ts +9 -0
  150. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/run-detail-handler.js +46 -0
  151. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/run-detail-handler.js.map +1 -0
  152. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/runs-list-handler.d.ts +11 -0
  153. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/runs-list-handler.js +50 -0
  154. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/runs-list-handler.js.map +1 -0
  155. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/stats-handler.d.ts +7 -0
  156. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/stats-handler.js +39 -0
  157. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/stats-handler.js.map +1 -0
  158. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-detail-handler.d.ts +10 -0
  159. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-detail-handler.js +46 -0
  160. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-detail-handler.js.map +1 -0
  161. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-cancel-handler.d.ts +13 -0
  162. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-cancel-handler.js +47 -0
  163. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-cancel-handler.js.map +1 -0
  164. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-handler.d.ts +14 -0
  165. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-handler.js +53 -0
  166. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-handler.js.map +1 -0
  167. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-runs-handler.d.ts +13 -0
  168. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-runs-handler.js +54 -0
  169. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-runs-handler.js.map +1 -0
  170. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflows-list-handler.d.ts +12 -0
  171. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflows-list-handler.js +51 -0
  172. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflows-list-handler.js.map +1 -0
  173. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/logs-channel.d.ts +17 -0
  174. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/logs-channel.js +133 -0
  175. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/logs-channel.js.map +1 -0
  176. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/progress-channel.d.ts +11 -0
  177. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/progress-channel.js +46 -0
  178. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/progress-channel.js.map +1 -0
  179. package/README.md +54 -0
  180. package/eslint.config.js +23 -0
  181. package/package.json +72 -0
  182. package/src/.kb/agents/sessions/session-1773470583796-ximqnfk/kpi-baseline.json +17 -0
  183. package/src/.kb/memory/sessions/session-1773470583796-ximqnfk/fact-sheet.json +1 -0
  184. package/src/bootstrap.ts +233 -0
  185. package/src/diagnostics/header-debug.ts +37 -0
  186. package/src/events/hub.ts +60 -0
  187. package/src/events/index.ts +1 -0
  188. package/src/index.ts +13 -0
  189. package/src/manifest.ts +21 -0
  190. package/src/middleware/__tests__/cache.spec.ts +184 -0
  191. package/src/middleware/__tests__/envelope.spec.ts +268 -0
  192. package/src/middleware/__tests__/metrics.redis.spec.ts +64 -0
  193. package/src/middleware/__tests__/rate-limit.spec.ts +283 -0
  194. package/src/middleware/__tests__/request-id.spec.ts +160 -0
  195. package/src/middleware/cache.ts +67 -0
  196. package/src/middleware/envelope.ts +136 -0
  197. package/src/middleware/error-guard.ts +69 -0
  198. package/src/middleware/index.ts +37 -0
  199. package/src/middleware/metrics.ts +810 -0
  200. package/src/middleware/mock-mode.ts +44 -0
  201. package/src/middleware/prom-metrics.ts +284 -0
  202. package/src/middleware/rate-limit-routes.ts +73 -0
  203. package/src/middleware/rate-limit.ts +72 -0
  204. package/src/middleware/request-id.ts +41 -0
  205. package/src/middleware/request-timeout.ts +69 -0
  206. package/src/middleware/security-headers.ts +24 -0
  207. package/src/middleware/startup-guard.ts +107 -0
  208. package/src/observability/service-contract.ts +192 -0
  209. package/src/plugins/index.ts +118 -0
  210. package/src/routes/__tests__/adapters-date-helpers.spec.ts +332 -0
  211. package/src/routes/__tests__/adapters.spec.ts +680 -0
  212. package/src/routes/__tests__/cache.spec.ts +264 -0
  213. package/src/routes/__tests__/events.spec.ts +434 -0
  214. package/src/routes/__tests__/health.spec.ts +414 -0
  215. package/src/routes/__tests__/logs.spec.ts +494 -0
  216. package/src/routes/__tests__/observability.spec.ts +392 -0
  217. package/src/routes/__tests__/plugins.spec.ts +931 -0
  218. package/src/routes/__tests__/workflow-management.spec.ts +698 -0
  219. package/src/routes/__tests__/workflows.spec.ts +204 -0
  220. package/src/routes/adapter-call.ts +220 -0
  221. package/src/routes/adapters.ts +1206 -0
  222. package/src/routes/analytics.ts +328 -0
  223. package/src/routes/cache.ts +104 -0
  224. package/src/routes/debug-routes.ts +95 -0
  225. package/src/routes/events.ts +115 -0
  226. package/src/routes/health.ts +348 -0
  227. package/src/routes/hello.ts +47 -0
  228. package/src/routes/index.ts +395 -0
  229. package/src/routes/jobs.ts +253 -0
  230. package/src/routes/logs.ts +718 -0
  231. package/src/routes/metrics.ts +120 -0
  232. package/src/routes/observability.ts +1388 -0
  233. package/src/routes/openapi.ts +101 -0
  234. package/src/routes/platform.ts +143 -0
  235. package/src/routes/plugins.ts +998 -0
  236. package/src/routes/readiness.ts +83 -0
  237. package/src/routes/workflow-management.ts +469 -0
  238. package/src/routes/workflows.ts +256 -0
  239. package/src/server.ts +203 -0
  240. package/src/services/historical-metrics.ts +496 -0
  241. package/src/services/incident-analyzer.ts +289 -0
  242. package/src/services/incident-detector.ts +691 -0
  243. package/src/services/incident-schema.sql +76 -0
  244. package/src/services/incident-storage.ts +593 -0
  245. package/src/services/system-metrics-collector.ts +244 -0
  246. package/src/types/fastify.d.ts +58 -0
  247. package/src/utils/__tests__/sse-auth.spec.ts +113 -0
  248. package/src/utils/path-helpers.ts +15 -0
  249. package/src/utils/repo.ts +42 -0
  250. package/src/utils/schema.ts +20 -0
  251. package/src/utils/sse-auth.ts +81 -0
  252. package/test-sandbox.sh +105 -0
  253. package/tsconfig.build.json +15 -0
  254. package/tsconfig.json +9 -0
  255. package/tsup.config.ts +18 -0
@@ -0,0 +1,472 @@
1
+ {
2
+ "schemaVersion": "1.0",
3
+ "createdAt": "2026-01-02T14:08:23.750Z",
4
+ "status": {
5
+ "staged": [],
6
+ "unstaged": [
7
+ ".gitignore",
8
+ "apps/rest-api/package.json",
9
+ "apps/rest-api/src/bootstrap.ts",
10
+ "apps/rest-api/src/events/index.ts",
11
+ "apps/rest-api/src/middleware/envelope.ts",
12
+ "apps/rest-api/src/middleware/index.ts",
13
+ "apps/rest-api/src/middleware/metrics.ts",
14
+ "apps/rest-api/src/middleware/request-id.ts",
15
+ "apps/rest-api/src/routes/__tests__/workflows.spec.ts",
16
+ "apps/rest-api/src/routes/events.ts",
17
+ "apps/rest-api/src/routes/health.ts",
18
+ "apps/rest-api/src/routes/index.ts",
19
+ "apps/rest-api/src/routes/metrics.ts",
20
+ "apps/rest-api/src/routes/plugins.ts",
21
+ "apps/rest-api/src/server.ts",
22
+ "packages/rest-api-contracts/package.json",
23
+ "packages/rest-api-contracts/src/index.ts",
24
+ "packages/rest-api-contracts/src/studio.ts",
25
+ "packages/rest-api-core/package.json",
26
+ "packages/rest-api-core/src/config/loader.ts",
27
+ "packages/rest-api-core/src/index.ts",
28
+ "pnpm-lock.yaml",
29
+ "tsconfig.paths.json",
30
+ "apps/rest-api/src/events/sse-event-bridge.ts",
31
+ "apps/rest-api/src/middleware/__tests__/header-policy.spec.ts",
32
+ "apps/rest-api/src/middleware/header-policy.ts",
33
+ "apps/rest-api/src/plugins/cli-discovery.ts",
34
+ "apps/rest-api/src/plugins/compat.ts",
35
+ "apps/rest-api/src/plugins/discovery.ts"
36
+ ],
37
+ "untracked": [
38
+ "apps/rest-api/.kb/commit/current/plan.json",
39
+ "apps/rest-api/.kb/commit/current/status.json",
40
+ "apps/rest-api/src/middleware/__tests__/cache.spec.ts",
41
+ "apps/rest-api/src/middleware/__tests__/envelope.spec.ts",
42
+ "apps/rest-api/src/middleware/__tests__/rate-limit.spec.ts",
43
+ "apps/rest-api/src/middleware/__tests__/request-id.spec.ts",
44
+ "apps/rest-api/src/middleware/prom-metrics.ts",
45
+ "apps/rest-api/src/platform.ts",
46
+ "apps/rest-api/src/routes/__tests__/adapters-date-helpers.spec.ts",
47
+ "apps/rest-api/src/routes/__tests__/adapters.spec.ts",
48
+ "apps/rest-api/src/routes/adapters.ts",
49
+ "apps/rest-api/src/routes/analytics.ts",
50
+ "apps/rest-api/src/routes/cache.ts",
51
+ "apps/rest-api/src/routes/logs.ts",
52
+ "apps/rest-api/src/routes/observability.ts",
53
+ "apps/rest-api/src/routes/platform.ts",
54
+ "apps/rest-api/src/routes/workflow-management.ts",
55
+ "packages/rest-api-contracts/src/observability.ts",
56
+ "packages/rest-api-contracts/src/platform.ts",
57
+ "packages/rest-api-core/src/__tests__/config-schema.spec.ts",
58
+ "packages/rest-api-core/src/__tests__/studio-registry.spec.ts",
59
+ "packages/rest-api-core/src/studio-registry.ts"
60
+ ]
61
+ },
62
+ "summaries": [
63
+ {
64
+ "path": ".gitignore",
65
+ "status": "added",
66
+ "additions": 0,
67
+ "deletions": 0,
68
+ "binary": false,
69
+ "isNewFile": true
70
+ },
71
+ {
72
+ "path": "apps/rest-api/package.json",
73
+ "status": "added",
74
+ "additions": 0,
75
+ "deletions": 0,
76
+ "binary": false,
77
+ "isNewFile": true
78
+ },
79
+ {
80
+ "path": "apps/rest-api/src/bootstrap.ts",
81
+ "status": "added",
82
+ "additions": 0,
83
+ "deletions": 0,
84
+ "binary": false,
85
+ "isNewFile": true
86
+ },
87
+ {
88
+ "path": "apps/rest-api/src/events/index.ts",
89
+ "status": "added",
90
+ "additions": 0,
91
+ "deletions": 0,
92
+ "binary": false,
93
+ "isNewFile": true
94
+ },
95
+ {
96
+ "path": "apps/rest-api/src/middleware/envelope.ts",
97
+ "status": "added",
98
+ "additions": 0,
99
+ "deletions": 0,
100
+ "binary": false,
101
+ "isNewFile": true
102
+ },
103
+ {
104
+ "path": "apps/rest-api/src/middleware/index.ts",
105
+ "status": "added",
106
+ "additions": 0,
107
+ "deletions": 0,
108
+ "binary": false,
109
+ "isNewFile": true
110
+ },
111
+ {
112
+ "path": "apps/rest-api/src/middleware/metrics.ts",
113
+ "status": "added",
114
+ "additions": 0,
115
+ "deletions": 0,
116
+ "binary": false,
117
+ "isNewFile": true
118
+ },
119
+ {
120
+ "path": "apps/rest-api/src/middleware/request-id.ts",
121
+ "status": "added",
122
+ "additions": 0,
123
+ "deletions": 0,
124
+ "binary": false,
125
+ "isNewFile": true
126
+ },
127
+ {
128
+ "path": "apps/rest-api/src/routes/__tests__/workflows.spec.ts",
129
+ "status": "added",
130
+ "additions": 0,
131
+ "deletions": 0,
132
+ "binary": false,
133
+ "isNewFile": true
134
+ },
135
+ {
136
+ "path": "apps/rest-api/src/routes/events.ts",
137
+ "status": "added",
138
+ "additions": 0,
139
+ "deletions": 0,
140
+ "binary": false,
141
+ "isNewFile": true
142
+ },
143
+ {
144
+ "path": "apps/rest-api/src/routes/health.ts",
145
+ "status": "added",
146
+ "additions": 0,
147
+ "deletions": 0,
148
+ "binary": false,
149
+ "isNewFile": true
150
+ },
151
+ {
152
+ "path": "apps/rest-api/src/routes/index.ts",
153
+ "status": "added",
154
+ "additions": 0,
155
+ "deletions": 0,
156
+ "binary": false,
157
+ "isNewFile": true
158
+ },
159
+ {
160
+ "path": "apps/rest-api/src/routes/metrics.ts",
161
+ "status": "added",
162
+ "additions": 0,
163
+ "deletions": 0,
164
+ "binary": false,
165
+ "isNewFile": true
166
+ },
167
+ {
168
+ "path": "apps/rest-api/src/routes/plugins.ts",
169
+ "status": "added",
170
+ "additions": 0,
171
+ "deletions": 0,
172
+ "binary": false,
173
+ "isNewFile": true
174
+ },
175
+ {
176
+ "path": "apps/rest-api/src/server.ts",
177
+ "status": "added",
178
+ "additions": 0,
179
+ "deletions": 0,
180
+ "binary": false,
181
+ "isNewFile": true
182
+ },
183
+ {
184
+ "path": "packages/rest-api-contracts/package.json",
185
+ "status": "added",
186
+ "additions": 0,
187
+ "deletions": 0,
188
+ "binary": false,
189
+ "isNewFile": true
190
+ },
191
+ {
192
+ "path": "packages/rest-api-contracts/src/index.ts",
193
+ "status": "added",
194
+ "additions": 0,
195
+ "deletions": 0,
196
+ "binary": false,
197
+ "isNewFile": true
198
+ },
199
+ {
200
+ "path": "packages/rest-api-contracts/src/studio.ts",
201
+ "status": "added",
202
+ "additions": 0,
203
+ "deletions": 0,
204
+ "binary": false,
205
+ "isNewFile": true
206
+ },
207
+ {
208
+ "path": "packages/rest-api-core/package.json",
209
+ "status": "added",
210
+ "additions": 0,
211
+ "deletions": 0,
212
+ "binary": false,
213
+ "isNewFile": true
214
+ },
215
+ {
216
+ "path": "packages/rest-api-core/src/config/loader.ts",
217
+ "status": "added",
218
+ "additions": 0,
219
+ "deletions": 0,
220
+ "binary": false,
221
+ "isNewFile": true
222
+ },
223
+ {
224
+ "path": "packages/rest-api-core/src/index.ts",
225
+ "status": "added",
226
+ "additions": 0,
227
+ "deletions": 0,
228
+ "binary": false,
229
+ "isNewFile": true
230
+ },
231
+ {
232
+ "path": "pnpm-lock.yaml",
233
+ "status": "added",
234
+ "additions": 0,
235
+ "deletions": 0,
236
+ "binary": false,
237
+ "isNewFile": true
238
+ },
239
+ {
240
+ "path": "tsconfig.paths.json",
241
+ "status": "added",
242
+ "additions": 0,
243
+ "deletions": 0,
244
+ "binary": false,
245
+ "isNewFile": true
246
+ },
247
+ {
248
+ "path": "apps/rest-api/src/events/sse-event-bridge.ts",
249
+ "status": "added",
250
+ "additions": 0,
251
+ "deletions": 0,
252
+ "binary": false,
253
+ "isNewFile": true
254
+ },
255
+ {
256
+ "path": "apps/rest-api/src/middleware/__tests__/header-policy.spec.ts",
257
+ "status": "added",
258
+ "additions": 0,
259
+ "deletions": 0,
260
+ "binary": false,
261
+ "isNewFile": true
262
+ },
263
+ {
264
+ "path": "apps/rest-api/src/middleware/header-policy.ts",
265
+ "status": "added",
266
+ "additions": 0,
267
+ "deletions": 0,
268
+ "binary": false,
269
+ "isNewFile": true
270
+ },
271
+ {
272
+ "path": "apps/rest-api/src/plugins/cli-discovery.ts",
273
+ "status": "added",
274
+ "additions": 0,
275
+ "deletions": 0,
276
+ "binary": false,
277
+ "isNewFile": true
278
+ },
279
+ {
280
+ "path": "apps/rest-api/src/plugins/compat.ts",
281
+ "status": "added",
282
+ "additions": 0,
283
+ "deletions": 0,
284
+ "binary": false,
285
+ "isNewFile": true
286
+ },
287
+ {
288
+ "path": "apps/rest-api/src/plugins/discovery.ts",
289
+ "status": "added",
290
+ "additions": 0,
291
+ "deletions": 0,
292
+ "binary": false,
293
+ "isNewFile": true
294
+ },
295
+ {
296
+ "path": "apps/rest-api/.kb/commit/current/plan.json",
297
+ "status": "added",
298
+ "additions": 0,
299
+ "deletions": 0,
300
+ "binary": false,
301
+ "isNewFile": true
302
+ },
303
+ {
304
+ "path": "apps/rest-api/.kb/commit/current/status.json",
305
+ "status": "added",
306
+ "additions": 0,
307
+ "deletions": 0,
308
+ "binary": false,
309
+ "isNewFile": true
310
+ },
311
+ {
312
+ "path": "apps/rest-api/src/middleware/__tests__/cache.spec.ts",
313
+ "status": "added",
314
+ "additions": 0,
315
+ "deletions": 0,
316
+ "binary": false,
317
+ "isNewFile": true
318
+ },
319
+ {
320
+ "path": "apps/rest-api/src/middleware/__tests__/envelope.spec.ts",
321
+ "status": "added",
322
+ "additions": 0,
323
+ "deletions": 0,
324
+ "binary": false,
325
+ "isNewFile": true
326
+ },
327
+ {
328
+ "path": "apps/rest-api/src/middleware/__tests__/rate-limit.spec.ts",
329
+ "status": "added",
330
+ "additions": 0,
331
+ "deletions": 0,
332
+ "binary": false,
333
+ "isNewFile": true
334
+ },
335
+ {
336
+ "path": "apps/rest-api/src/middleware/__tests__/request-id.spec.ts",
337
+ "status": "added",
338
+ "additions": 0,
339
+ "deletions": 0,
340
+ "binary": false,
341
+ "isNewFile": true
342
+ },
343
+ {
344
+ "path": "apps/rest-api/src/middleware/prom-metrics.ts",
345
+ "status": "added",
346
+ "additions": 0,
347
+ "deletions": 0,
348
+ "binary": false,
349
+ "isNewFile": true
350
+ },
351
+ {
352
+ "path": "apps/rest-api/src/platform.ts",
353
+ "status": "added",
354
+ "additions": 0,
355
+ "deletions": 0,
356
+ "binary": false,
357
+ "isNewFile": true
358
+ },
359
+ {
360
+ "path": "apps/rest-api/src/routes/__tests__/adapters-date-helpers.spec.ts",
361
+ "status": "added",
362
+ "additions": 0,
363
+ "deletions": 0,
364
+ "binary": false,
365
+ "isNewFile": true
366
+ },
367
+ {
368
+ "path": "apps/rest-api/src/routes/__tests__/adapters.spec.ts",
369
+ "status": "added",
370
+ "additions": 0,
371
+ "deletions": 0,
372
+ "binary": false,
373
+ "isNewFile": true
374
+ },
375
+ {
376
+ "path": "apps/rest-api/src/routes/adapters.ts",
377
+ "status": "added",
378
+ "additions": 0,
379
+ "deletions": 0,
380
+ "binary": false,
381
+ "isNewFile": true
382
+ },
383
+ {
384
+ "path": "apps/rest-api/src/routes/analytics.ts",
385
+ "status": "added",
386
+ "additions": 0,
387
+ "deletions": 0,
388
+ "binary": false,
389
+ "isNewFile": true
390
+ },
391
+ {
392
+ "path": "apps/rest-api/src/routes/cache.ts",
393
+ "status": "added",
394
+ "additions": 0,
395
+ "deletions": 0,
396
+ "binary": false,
397
+ "isNewFile": true
398
+ },
399
+ {
400
+ "path": "apps/rest-api/src/routes/logs.ts",
401
+ "status": "added",
402
+ "additions": 0,
403
+ "deletions": 0,
404
+ "binary": false,
405
+ "isNewFile": true
406
+ },
407
+ {
408
+ "path": "apps/rest-api/src/routes/observability.ts",
409
+ "status": "added",
410
+ "additions": 0,
411
+ "deletions": 0,
412
+ "binary": false,
413
+ "isNewFile": true
414
+ },
415
+ {
416
+ "path": "apps/rest-api/src/routes/platform.ts",
417
+ "status": "added",
418
+ "additions": 0,
419
+ "deletions": 0,
420
+ "binary": false,
421
+ "isNewFile": true
422
+ },
423
+ {
424
+ "path": "apps/rest-api/src/routes/workflow-management.ts",
425
+ "status": "added",
426
+ "additions": 0,
427
+ "deletions": 0,
428
+ "binary": false,
429
+ "isNewFile": true
430
+ },
431
+ {
432
+ "path": "packages/rest-api-contracts/src/observability.ts",
433
+ "status": "added",
434
+ "additions": 0,
435
+ "deletions": 0,
436
+ "binary": false,
437
+ "isNewFile": true
438
+ },
439
+ {
440
+ "path": "packages/rest-api-contracts/src/platform.ts",
441
+ "status": "added",
442
+ "additions": 0,
443
+ "deletions": 0,
444
+ "binary": false,
445
+ "isNewFile": true
446
+ },
447
+ {
448
+ "path": "packages/rest-api-core/src/__tests__/config-schema.spec.ts",
449
+ "status": "added",
450
+ "additions": 0,
451
+ "deletions": 0,
452
+ "binary": false,
453
+ "isNewFile": true
454
+ },
455
+ {
456
+ "path": "packages/rest-api-core/src/__tests__/studio-registry.spec.ts",
457
+ "status": "added",
458
+ "additions": 0,
459
+ "deletions": 0,
460
+ "binary": false,
461
+ "isNewFile": true
462
+ },
463
+ {
464
+ "path": "packages/rest-api-core/src/studio-registry.ts",
465
+ "status": "added",
466
+ "additions": 0,
467
+ "deletions": 0,
468
+ "binary": false,
469
+ "isNewFile": true
470
+ }
471
+ ]
472
+ }
@@ -0,0 +1,10 @@
1
+ import * as _kb_labs_shared_command_kit from '@kb-labs/shared-command-kit';
2
+
3
+ /**
4
+ * workflow:health command - Check daemon health
5
+ */
6
+ declare const _default: _kb_labs_shared_command_kit.CommandHandlerV3<unknown, any, {
7
+ exitCode: number;
8
+ }>;
9
+
10
+ export { _default as default };
@@ -0,0 +1,215 @@
1
+ import { defineCommand } from '@kb-labs/sdk';
2
+
3
+ // src/commands/health.ts
4
+
5
+ // src/http-client.ts
6
+ var DEFAULT_DAEMON_URL = "http://localhost:7778";
7
+ var WorkflowDaemonClient = class {
8
+ baseUrl;
9
+ constructor(options = {}) {
10
+ this.baseUrl = options.url ?? process.env.WORKFLOW_DAEMON_URL ?? DEFAULT_DAEMON_URL;
11
+ }
12
+ /**
13
+ * Validate response Content-Type and parse JSON safely
14
+ */
15
+ async parseJsonResponse(response) {
16
+ const contentType = response.headers.get("content-type");
17
+ if (!contentType?.includes("application/json")) {
18
+ throw new Error(`Invalid Content-Type: expected application/json, got ${contentType}`);
19
+ }
20
+ return response.json();
21
+ }
22
+ unwrapData(payload) {
23
+ if (payload && typeof payload === "object" && "ok" in payload && payload.ok === true && "data" in payload) {
24
+ return payload.data;
25
+ }
26
+ return payload;
27
+ }
28
+ /**
29
+ * Validate and encode job ID to prevent path traversal attacks
30
+ */
31
+ validateAndEncodeJobId(jobId) {
32
+ if (!/^[a-zA-Z0-9_-]+$/.test(jobId)) {
33
+ throw new Error(`Invalid job ID format: ${jobId}`);
34
+ }
35
+ return encodeURIComponent(jobId);
36
+ }
37
+ /**
38
+ * Health check
39
+ */
40
+ async health() {
41
+ const response = await fetch(`${this.baseUrl}/health`);
42
+ if (!response.ok) {
43
+ throw new Error(`Health check failed: ${response.statusText}`);
44
+ }
45
+ return this.parseJsonResponse(response);
46
+ }
47
+ /**
48
+ * Get workflow metrics
49
+ */
50
+ async getMetrics() {
51
+ const response = await fetch(`${this.baseUrl}/metrics`);
52
+ if (!response.ok) {
53
+ throw new Error(`Failed to get metrics: ${response.statusText}`);
54
+ }
55
+ const data = await this.parseJsonResponse(response);
56
+ return this.unwrapData(data);
57
+ }
58
+ /**
59
+ * Get job status with full details (jobs, steps, outputs)
60
+ */
61
+ async getJobStatus(jobId) {
62
+ const encodedJobId = this.validateAndEncodeJobId(jobId);
63
+ const response = await fetch(`${this.baseUrl}/api/v1/jobs/${encodedJobId}`);
64
+ if (response.status === 404) {
65
+ throw new Error(`Job ${jobId} not found`);
66
+ }
67
+ if (!response.ok) {
68
+ throw new Error(`Failed to get job status: ${response.statusText}`);
69
+ }
70
+ const data = await this.parseJsonResponse(response);
71
+ return this.unwrapData(data);
72
+ }
73
+ /**
74
+ * Get job steps with outputs
75
+ */
76
+ async getJobSteps(jobId) {
77
+ const encodedJobId = this.validateAndEncodeJobId(jobId);
78
+ const response = await fetch(`${this.baseUrl}/api/v1/jobs/${encodedJobId}/steps`);
79
+ if (response.status === 404) {
80
+ throw new Error(`Job ${jobId} not found`);
81
+ }
82
+ if (!response.ok) {
83
+ throw new Error(`Failed to get job steps: ${response.statusText}`);
84
+ }
85
+ const data = await this.parseJsonResponse(response);
86
+ return this.unwrapData(data);
87
+ }
88
+ /**
89
+ * Get job logs
90
+ */
91
+ async getJobLogs(jobId) {
92
+ const encodedJobId = this.validateAndEncodeJobId(jobId);
93
+ const response = await fetch(`${this.baseUrl}/api/v1/jobs/${encodedJobId}/logs`);
94
+ if (response.status === 404) {
95
+ throw new Error(`Job ${jobId} not found`);
96
+ }
97
+ if (!response.ok) {
98
+ throw new Error(`Failed to get job logs: ${response.statusText}`);
99
+ }
100
+ const data = await this.parseJsonResponse(response);
101
+ const unwrapped = this.unwrapData(data);
102
+ return unwrapped.logs ?? [];
103
+ }
104
+ /**
105
+ * Get active executions
106
+ */
107
+ async getExecutions() {
108
+ const response = await fetch(`${this.baseUrl}/api/v1/jobs`);
109
+ if (!response.ok) {
110
+ throw new Error(`Failed to get executions: ${response.statusText}`);
111
+ }
112
+ const data = await this.parseJsonResponse(response);
113
+ const unwrapped = this.unwrapData(data);
114
+ const jobs = unwrapped.jobs ?? [];
115
+ return jobs.filter((job) => job.status === "running" || job.status === "pending");
116
+ }
117
+ /**
118
+ * Get cron jobs
119
+ */
120
+ async getCronJobs() {
121
+ const response = await fetch(`${this.baseUrl}/api/v1/cron`);
122
+ if (!response.ok) {
123
+ throw new Error(`Failed to get cron jobs: ${response.statusText}`);
124
+ }
125
+ const data = await this.parseJsonResponse(response);
126
+ return this.unwrapData(data);
127
+ }
128
+ /**
129
+ * Submit a job for execution
130
+ */
131
+ async submitJob(params) {
132
+ const response = await fetch(`${this.baseUrl}/api/v1/jobs`, {
133
+ method: "POST",
134
+ headers: {
135
+ "Content-Type": "application/json"
136
+ },
137
+ body: JSON.stringify({
138
+ type: params.handler,
139
+ payload: params.input,
140
+ priority: params.priority
141
+ })
142
+ });
143
+ if (!response.ok) {
144
+ const error = await response.json().catch(() => ({ error: response.statusText }));
145
+ throw new Error(error.error || `Failed to submit job: ${response.statusText}`);
146
+ }
147
+ const payload = await this.parseJsonResponse(response);
148
+ const data = this.unwrapData(payload);
149
+ return { id: data.jobId, status: "pending" };
150
+ }
151
+ /**
152
+ * Run workflow by ID
153
+ */
154
+ async runWorkflow(workflowId, request = {}) {
155
+ const response = await fetch(
156
+ `${this.baseUrl}/api/v1/workflows/${encodeURIComponent(workflowId)}/run`,
157
+ {
158
+ method: "POST",
159
+ headers: {
160
+ "Content-Type": "application/json"
161
+ },
162
+ body: JSON.stringify(request)
163
+ }
164
+ );
165
+ if (!response.ok) {
166
+ const error = await response.json().catch(() => ({ error: response.statusText }));
167
+ throw new Error(error.error || `Failed to run workflow: ${response.statusText}`);
168
+ }
169
+ const payload = await this.parseJsonResponse(response);
170
+ return this.unwrapData(payload);
171
+ }
172
+ };
173
+
174
+ // src/commands/health.ts
175
+ var health_default = defineCommand({
176
+ id: "workflow:health",
177
+ description: "Check workflow daemon health status",
178
+ handler: {
179
+ async execute(ctx, input) {
180
+ const flags = input.flags ?? input;
181
+ const outputJson = flags.json ?? false;
182
+ try {
183
+ const client = new WorkflowDaemonClient();
184
+ const health = await client.health();
185
+ if (outputJson) {
186
+ ctx.ui?.json?.({ ok: true, data: health });
187
+ } else {
188
+ ctx.ui?.success?.("Daemon is healthy", {
189
+ title: "Workflow Daemon",
190
+ sections: [
191
+ {
192
+ header: "Status",
193
+ items: [`Service: ${health.service}`, "Health: OK"]
194
+ }
195
+ ]
196
+ });
197
+ }
198
+ return { exitCode: 0 };
199
+ } catch (error) {
200
+ const message = error instanceof Error ? error.message : String(error);
201
+ if (outputJson) {
202
+ ctx.ui?.json?.({ ok: false, error: message });
203
+ } else {
204
+ ctx.ui?.error?.(`Failed to check daemon health: ${message}`);
205
+ ctx.ui?.warn?.(`Make sure workflow daemon is running: kb-workflow`);
206
+ }
207
+ return { exitCode: 1 };
208
+ }
209
+ }
210
+ }
211
+ });
212
+
213
+ export { health_default as default };
214
+ //# sourceMappingURL=health.js.map
215
+ //# sourceMappingURL=health.js.map