@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.
Files changed (257) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +8151 -0
  3. package/dist/index.js.map +1 -0
  4. package/package.json +7 -4
  5. package/.kb/agents/sessions/session-1771531145393-ws3uh6q/turns.json +0 -42
  6. package/.kb/agents/sessions/session-1771548930486-ui6rtvm/turns.json +0 -33
  7. package/.kb/agents/sessions/session-1771549691485-nibqroq/turns.json +0 -133
  8. package/.kb/agents/sessions/session-1771550943182-dkwqdjc/turns.json +0 -130
  9. package/.kb/agents/sessions/session-1771551564182-cr4bwzn/turns.json +0 -349
  10. package/.kb/agents/sessions/session-1771552401370-g4ztwd1/turns.json +0 -206
  11. package/.kb/commit/current/plan.json +0 -248
  12. package/.kb/commit/current/status.json +0 -472
  13. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/health.d.ts +0 -10
  14. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/health.js +0 -215
  15. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/health.js.map +0 -1
  16. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/list.d.ts +0 -10
  17. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/list.js +0 -271
  18. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/list.js.map +0 -1
  19. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/logs.d.ts +0 -10
  20. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/logs.js +0 -230
  21. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/logs.js.map +0 -1
  22. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/metrics.d.ts +0 -10
  23. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/metrics.js +0 -228
  24. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/metrics.js.map +0 -1
  25. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/run.d.ts +0 -11
  26. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/run.js +0 -281
  27. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/run.js.map +0 -1
  28. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/status.d.ts +0 -10
  29. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/status.js +0 -266
  30. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/status.js.map +0 -1
  31. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/workflow-run.d.ts +0 -11
  32. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/workflow-run.js +0 -284
  33. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/commands/workflow-run.js.map +0 -1
  34. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/flags-WLdpSZl4.d.ts +0 -77
  35. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/index.d.ts +0 -2
  36. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/index.js +0 -441
  37. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/index.js.map +0 -1
  38. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/manifest.d.ts +0 -196
  39. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/manifest.js +0 -441
  40. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/manifest.js.map +0 -1
  41. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/cron-list-handler.d.ts +0 -19
  42. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/cron-list-handler.js +0 -48
  43. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/cron-list-handler.js.map +0 -1
  44. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/index.d.ts +0 -6
  45. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/index.js +0 -170
  46. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/index.js.map +0 -1
  47. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-cancel-handler.d.ts +0 -12
  48. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-cancel-handler.js +0 -52
  49. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-cancel-handler.js.map +0 -1
  50. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-detail-handler.d.ts +0 -22
  51. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-detail-handler.js +0 -52
  52. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-detail-handler.js.map +0 -1
  53. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-logs-handler.d.ts +0 -13
  54. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-logs-handler.js +0 -52
  55. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-logs-handler.js.map +0 -1
  56. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-steps-handler.d.ts +0 -9
  57. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-steps-handler.js +0 -43
  58. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/job-steps-handler.js.map +0 -1
  59. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/jobs-list-handler.d.ts +0 -26
  60. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/jobs-list-handler.js +0 -63
  61. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/jobs-list-handler.js.map +0 -1
  62. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/pending-approvals-handler.d.ts +0 -9
  63. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/pending-approvals-handler.js +0 -46
  64. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/pending-approvals-handler.js.map +0 -1
  65. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/resolve-approval-handler.d.ts +0 -16
  66. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/resolve-approval-handler.js +0 -58
  67. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/resolve-approval-handler.js.map +0 -1
  68. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/run-detail-handler.d.ts +0 -9
  69. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/run-detail-handler.js +0 -46
  70. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/run-detail-handler.js.map +0 -1
  71. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/runs-list-handler.d.ts +0 -11
  72. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/runs-list-handler.js +0 -50
  73. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/runs-list-handler.js.map +0 -1
  74. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/stats-handler.d.ts +0 -7
  75. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/stats-handler.js +0 -39
  76. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/stats-handler.js.map +0 -1
  77. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-detail-handler.d.ts +0 -10
  78. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-detail-handler.js +0 -46
  79. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-detail-handler.js.map +0 -1
  80. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-cancel-handler.d.ts +0 -13
  81. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-cancel-handler.js +0 -47
  82. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-cancel-handler.js.map +0 -1
  83. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-handler.d.ts +0 -14
  84. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-handler.js +0 -53
  85. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-run-handler.js.map +0 -1
  86. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-runs-handler.d.ts +0 -13
  87. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-runs-handler.js +0 -54
  88. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflow-runs-handler.js.map +0 -1
  89. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflows-list-handler.d.ts +0 -12
  90. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflows-list-handler.js +0 -51
  91. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/rest/workflows-list-handler.js.map +0 -1
  92. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/logs-channel.d.ts +0 -17
  93. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/logs-channel.js +0 -133
  94. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/logs-channel.js.map +0 -1
  95. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/progress-channel.d.ts +0 -11
  96. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/progress-channel.js +0 -46
  97. package/.kb/runtime/workspaces/ws_94c2deab-4cf9-49cb-94ac-3958062754a1/ws/progress-channel.js.map +0 -1
  98. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/health.d.ts +0 -10
  99. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/health.js +0 -215
  100. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/health.js.map +0 -1
  101. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/list.d.ts +0 -10
  102. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/list.js +0 -271
  103. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/list.js.map +0 -1
  104. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/logs.d.ts +0 -10
  105. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/logs.js +0 -230
  106. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/logs.js.map +0 -1
  107. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/metrics.d.ts +0 -10
  108. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/metrics.js +0 -228
  109. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/metrics.js.map +0 -1
  110. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/run.d.ts +0 -11
  111. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/run.js +0 -281
  112. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/run.js.map +0 -1
  113. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/status.d.ts +0 -10
  114. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/status.js +0 -266
  115. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/status.js.map +0 -1
  116. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/workflow-run.d.ts +0 -11
  117. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/workflow-run.js +0 -284
  118. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/commands/workflow-run.js.map +0 -1
  119. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/flags-WLdpSZl4.d.ts +0 -77
  120. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/index.d.ts +0 -2
  121. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/index.js +0 -441
  122. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/index.js.map +0 -1
  123. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/manifest.d.ts +0 -196
  124. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/manifest.js +0 -441
  125. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/manifest.js.map +0 -1
  126. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/cron-list-handler.d.ts +0 -19
  127. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/cron-list-handler.js +0 -48
  128. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/cron-list-handler.js.map +0 -1
  129. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/index.d.ts +0 -6
  130. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/index.js +0 -170
  131. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/index.js.map +0 -1
  132. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-cancel-handler.d.ts +0 -12
  133. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-cancel-handler.js +0 -52
  134. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-cancel-handler.js.map +0 -1
  135. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-detail-handler.d.ts +0 -22
  136. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-detail-handler.js +0 -52
  137. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-detail-handler.js.map +0 -1
  138. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-logs-handler.d.ts +0 -13
  139. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-logs-handler.js +0 -52
  140. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-logs-handler.js.map +0 -1
  141. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-steps-handler.d.ts +0 -9
  142. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-steps-handler.js +0 -43
  143. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/job-steps-handler.js.map +0 -1
  144. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/jobs-list-handler.d.ts +0 -26
  145. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/jobs-list-handler.js +0 -63
  146. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/jobs-list-handler.js.map +0 -1
  147. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/pending-approvals-handler.d.ts +0 -9
  148. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/pending-approvals-handler.js +0 -46
  149. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/pending-approvals-handler.js.map +0 -1
  150. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/resolve-approval-handler.d.ts +0 -16
  151. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/resolve-approval-handler.js +0 -58
  152. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/resolve-approval-handler.js.map +0 -1
  153. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/run-detail-handler.d.ts +0 -9
  154. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/run-detail-handler.js +0 -46
  155. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/run-detail-handler.js.map +0 -1
  156. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/runs-list-handler.d.ts +0 -11
  157. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/runs-list-handler.js +0 -50
  158. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/runs-list-handler.js.map +0 -1
  159. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/stats-handler.d.ts +0 -7
  160. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/stats-handler.js +0 -39
  161. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/stats-handler.js.map +0 -1
  162. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-detail-handler.d.ts +0 -10
  163. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-detail-handler.js +0 -46
  164. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-detail-handler.js.map +0 -1
  165. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-cancel-handler.d.ts +0 -13
  166. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-cancel-handler.js +0 -47
  167. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-cancel-handler.js.map +0 -1
  168. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-handler.d.ts +0 -14
  169. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-handler.js +0 -53
  170. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-run-handler.js.map +0 -1
  171. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-runs-handler.d.ts +0 -13
  172. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-runs-handler.js +0 -54
  173. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflow-runs-handler.js.map +0 -1
  174. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflows-list-handler.d.ts +0 -12
  175. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflows-list-handler.js +0 -51
  176. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/rest/workflows-list-handler.js.map +0 -1
  177. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/logs-channel.d.ts +0 -17
  178. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/logs-channel.js +0 -133
  179. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/logs-channel.js.map +0 -1
  180. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/progress-channel.d.ts +0 -11
  181. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/progress-channel.js +0 -46
  182. package/.kb/runtime/workspaces/ws_f0f301b8-388d-4dc4-b301-475f2bc95f02/ws/progress-channel.js.map +0 -1
  183. package/eslint.config.js +0 -23
  184. package/src/.kb/agents/sessions/session-1773470583796-ximqnfk/kpi-baseline.json +0 -17
  185. package/src/.kb/memory/sessions/session-1773470583796-ximqnfk/fact-sheet.json +0 -1
  186. package/src/bootstrap.ts +0 -233
  187. package/src/diagnostics/header-debug.ts +0 -37
  188. package/src/events/hub.ts +0 -60
  189. package/src/events/index.ts +0 -1
  190. package/src/index.ts +0 -13
  191. package/src/manifest.ts +0 -21
  192. package/src/middleware/__tests__/cache.spec.ts +0 -184
  193. package/src/middleware/__tests__/envelope.spec.ts +0 -268
  194. package/src/middleware/__tests__/metrics.redis.spec.ts +0 -64
  195. package/src/middleware/__tests__/rate-limit.spec.ts +0 -283
  196. package/src/middleware/__tests__/request-id.spec.ts +0 -160
  197. package/src/middleware/cache.ts +0 -67
  198. package/src/middleware/envelope.ts +0 -136
  199. package/src/middleware/error-guard.ts +0 -69
  200. package/src/middleware/index.ts +0 -37
  201. package/src/middleware/metrics.ts +0 -810
  202. package/src/middleware/mock-mode.ts +0 -44
  203. package/src/middleware/prom-metrics.ts +0 -284
  204. package/src/middleware/rate-limit-routes.ts +0 -73
  205. package/src/middleware/rate-limit.ts +0 -72
  206. package/src/middleware/request-id.ts +0 -41
  207. package/src/middleware/request-timeout.ts +0 -69
  208. package/src/middleware/security-headers.ts +0 -24
  209. package/src/middleware/startup-guard.ts +0 -107
  210. package/src/observability/service-contract.ts +0 -192
  211. package/src/plugins/index.ts +0 -118
  212. package/src/routes/__tests__/adapters-date-helpers.spec.ts +0 -332
  213. package/src/routes/__tests__/adapters.spec.ts +0 -680
  214. package/src/routes/__tests__/cache.spec.ts +0 -264
  215. package/src/routes/__tests__/events.spec.ts +0 -434
  216. package/src/routes/__tests__/health.spec.ts +0 -414
  217. package/src/routes/__tests__/logs.spec.ts +0 -494
  218. package/src/routes/__tests__/observability.spec.ts +0 -392
  219. package/src/routes/__tests__/plugins.spec.ts +0 -931
  220. package/src/routes/__tests__/workflow-management.spec.ts +0 -698
  221. package/src/routes/__tests__/workflows.spec.ts +0 -204
  222. package/src/routes/adapter-call.ts +0 -220
  223. package/src/routes/adapters.ts +0 -1206
  224. package/src/routes/analytics.ts +0 -328
  225. package/src/routes/cache.ts +0 -104
  226. package/src/routes/debug-routes.ts +0 -95
  227. package/src/routes/events.ts +0 -115
  228. package/src/routes/health.ts +0 -348
  229. package/src/routes/hello.ts +0 -47
  230. package/src/routes/index.ts +0 -395
  231. package/src/routes/jobs.ts +0 -253
  232. package/src/routes/logs.ts +0 -718
  233. package/src/routes/metrics.ts +0 -120
  234. package/src/routes/observability.ts +0 -1388
  235. package/src/routes/openapi.ts +0 -101
  236. package/src/routes/platform.ts +0 -143
  237. package/src/routes/plugins.ts +0 -998
  238. package/src/routes/readiness.ts +0 -83
  239. package/src/routes/workflow-management.ts +0 -469
  240. package/src/routes/workflows.ts +0 -256
  241. package/src/server.ts +0 -203
  242. package/src/services/historical-metrics.ts +0 -496
  243. package/src/services/incident-analyzer.ts +0 -289
  244. package/src/services/incident-detector.ts +0 -691
  245. package/src/services/incident-schema.sql +0 -76
  246. package/src/services/incident-storage.ts +0 -593
  247. package/src/services/system-metrics-collector.ts +0 -244
  248. package/src/types/fastify.d.ts +0 -58
  249. package/src/utils/__tests__/sse-auth.spec.ts +0 -113
  250. package/src/utils/path-helpers.ts +0 -15
  251. package/src/utils/repo.ts +0 -42
  252. package/src/utils/schema.ts +0 -20
  253. package/src/utils/sse-auth.ts +0 -81
  254. package/test-sandbox.sh +0 -105
  255. package/tsconfig.build.json +0 -15
  256. package/tsconfig.json +0 -9
  257. package/tsup.config.ts +0 -18
@@ -1,107 +0,0 @@
1
- /**
2
- * @module @kb-labs/rest-api-app/middleware/startup-guard
3
- * Guard to prevent request storms during startup
4
- */
5
-
6
- import type { FastifyInstance } from 'fastify';
7
- import type { RestApiConfig } from '@kb-labs/rest-api-core';
8
- import { isReady } from '../routes/readiness';
9
-
10
- type StartupCounters = {
11
- inFlight: number;
12
- };
13
-
14
- type StartupConfig = {
15
- maxConcurrent?: number;
16
- queueLimit?: number;
17
- timeoutMs?: number;
18
- retryAfterSeconds?: number;
19
- };
20
-
21
- export function registerStartupGuard(
22
- server: FastifyInstance,
23
- config: RestApiConfig
24
- ): void {
25
- const startupConfig = (config as RestApiConfig & { startup?: StartupConfig }).startup;
26
- if (!startupConfig) {
27
- return;
28
- }
29
-
30
- const counters: StartupCounters = {
31
- inFlight: 0,
32
- };
33
-
34
- server.kbStartupGuard = counters;
35
-
36
- const maxConcurrent = startupConfig.maxConcurrent ?? 32;
37
- const queueLimit = startupConfig.queueLimit ?? 128;
38
- const timeoutMs = startupConfig.timeoutMs ?? 5000;
39
- const retryAfterSeconds = startupConfig.retryAfterSeconds ?? 2;
40
-
41
- server.addHook('onRequest', (request, reply, done) => {
42
- const readiness = server.kbReadiness;
43
- const infraReady = readiness ? isReady(readiness) : false;
44
-
45
- if (infraReady) {
46
- done();
47
- return;
48
- }
49
-
50
- if (counters.inFlight >= queueLimit) {
51
- reply
52
- .code(503)
53
- .header('Retry-After', retryAfterSeconds.toString())
54
- .send({
55
- schema: 'kb.startup/1',
56
- status: 'initializing',
57
- reason: 'startup_queue_limit',
58
- maxConcurrent,
59
- queueLimit,
60
- });
61
- return;
62
- }
63
-
64
- counters.inFlight += 1;
65
- request.kbStartupGuardActive = true;
66
-
67
- const timer = setTimeout(() => {
68
- if (!reply.sent) {
69
- reply
70
- .code(504)
71
- .header('Retry-After', retryAfterSeconds.toString())
72
- .send({
73
- schema: 'kb.startup/1',
74
- status: 'timeout',
75
- reason: 'startup_timeout',
76
- timeoutMs,
77
- });
78
- }
79
- }, timeoutMs);
80
- timer.unref();
81
- request.kbStartupGuardTimer = timer;
82
-
83
- if (counters.inFlight > maxConcurrent) {
84
- if ((request as any).kbLogger) {
85
- (request as any).kbLogger.warn('Startup guard concurrency threshold exceeded', {
86
- inFlight: counters.inFlight,
87
- maxConcurrent,
88
- });
89
- }
90
- }
91
-
92
- done();
93
- });
94
-
95
- server.addHook('onResponse', (request, _reply, done) => {
96
- if (request.kbStartupGuardActive) {
97
- counters.inFlight = Math.max(0, counters.inFlight - 1);
98
- if (request.kbStartupGuardTimer) {
99
- clearTimeout(request.kbStartupGuardTimer);
100
- request.kbStartupGuardTimer = undefined;
101
- }
102
- request.kbStartupGuardActive = false;
103
- }
104
- done();
105
- });
106
- }
107
-
@@ -1,192 +0,0 @@
1
- import { hostname } from 'node:os';
2
- import {
3
- OBSERVABILITY_CONTRACT_VERSION,
4
- OBSERVABILITY_SCHEMA,
5
- CANONICAL_OBSERVABILITY_METRICS,
6
- type ObservabilityCheck,
7
- } from '@kb-labs/core-contracts';
8
- import type {
9
- ServiceObservabilityDescribe,
10
- ServiceObservabilityHealth,
11
- ServiceOperationSample,
12
- } from '@kb-labs/core-contracts';
13
- import {
14
- createServiceObservabilityDescribe,
15
- createServiceObservabilityHealth,
16
- } from '@kb-labs/shared-http';
17
- import type { SystemHealthSnapshot } from '@kb-labs/core-registry';
18
- import type { ReadinessState } from '../routes/readiness.js';
19
- import { restDomainOperationMetrics, type MetricsSnapshot } from '../middleware/metrics.js';
20
- import { getLatestSystemMetrics } from '../services/system-metrics-collector.js';
21
-
22
- declare const __REST_API_VERSION__: string;
23
- const REST_VERSION = typeof __REST_API_VERSION__ !== 'undefined' ? __REST_API_VERSION__ : '0.0.0';
24
-
25
- function resolveInstanceId(): string {
26
- return `${hostname()}:${process.pid}`;
27
- }
28
-
29
- function mergeTopOperations(
30
- httpOperations: ServiceOperationSample[],
31
- domainOperations: ServiceOperationSample[],
32
- limit = 5,
33
- ): ServiceOperationSample[] {
34
- const merged = new Map<string, ServiceOperationSample>();
35
-
36
- for (const item of [...httpOperations, ...domainOperations]) {
37
- const existing = merged.get(item.operation);
38
- if (!existing) {
39
- merged.set(item.operation, { ...item });
40
- continue;
41
- }
42
-
43
- const count = (existing.count ?? 0) + (item.count ?? 0);
44
- const totalDurationMs =
45
- (existing.avgDurationMs ?? 0) * (existing.count ?? 0) +
46
- (item.avgDurationMs ?? 0) * (item.count ?? 0);
47
-
48
- merged.set(item.operation, {
49
- operation: item.operation,
50
- count,
51
- avgDurationMs: count > 0 ? totalDurationMs / count : 0,
52
- maxDurationMs: Math.max(existing.maxDurationMs ?? 0, item.maxDurationMs ?? 0),
53
- errorCount: (existing.errorCount ?? 0) + (item.errorCount ?? 0),
54
- });
55
- }
56
-
57
- const ranked = Array.from(merged.values())
58
- .sort((a, b) => (b.count ?? 0) - (a.count ?? 0) || (b.maxDurationMs ?? 0) - (a.maxDurationMs ?? 0))
59
- const sliced = ranked.slice(0, limit);
60
-
61
- if (domainOperations.length === 0 || sliced.some((item) => !item.operation.startsWith('http.'))) {
62
- return sliced;
63
- }
64
-
65
- const firstDomainOperation = ranked.find((item) => !item.operation.startsWith('http.'));
66
- if (!firstDomainOperation) {
67
- return sliced;
68
- }
69
-
70
- return [...sliced.slice(0, Math.max(0, limit - 1)), firstDomainOperation];
71
- }
72
-
73
- function finiteNumberOrUndefined(value: number | null | undefined): number | undefined {
74
- return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
75
- }
76
-
77
- export function buildRestObservabilityDescribe(basePath: string): ServiceObservabilityDescribe {
78
- return createServiceObservabilityDescribe({
79
- schema: OBSERVABILITY_SCHEMA,
80
- contractVersion: OBSERVABILITY_CONTRACT_VERSION,
81
- serviceId: 'rest',
82
- instanceId: resolveInstanceId(),
83
- serviceType: 'http-api',
84
- version: REST_VERSION,
85
- environment: process.env.NODE_ENV ?? 'development',
86
- startedAt: new Date(Date.now() - process.uptime() * 1000).toISOString(),
87
- dependencies: [
88
- {
89
- serviceId: 'workflow',
90
- required: true,
91
- description: 'Workflow daemon for workflow and jobs APIs',
92
- },
93
- {
94
- serviceId: 'state-daemon',
95
- required: false,
96
- description: 'State broker and cache-backed storage',
97
- },
98
- ],
99
- metricsEndpoint: `${basePath}/metrics`,
100
- healthEndpoint: `${basePath}/observability/health`,
101
- logsSource: 'rest',
102
- capabilities: ['httpMetrics', 'eventLoopMetrics', 'operationMetrics', 'logCorrelation'],
103
- metricFamilies: [...CANONICAL_OBSERVABILITY_METRICS],
104
- });
105
- }
106
-
107
- export function buildRestObservabilityHealth(
108
- basePath: string,
109
- healthSnapshot: SystemHealthSnapshot,
110
- readiness: ReadinessState,
111
- metrics: MetricsSnapshot,
112
- ): ServiceObservabilityHealth {
113
- const runtimeMetrics = getLatestSystemMetrics();
114
- const checks: ObservabilityCheck[] = [
115
- {
116
- id: 'registry',
117
- status: readiness.registryLoaded && !readiness.registryPartial && !readiness.registryStale
118
- ? 'ok'
119
- : readiness.registryLoaded ? 'warn' : 'error',
120
- message: readiness.registryLoaded ? 'Registry snapshot loaded' : 'Registry snapshot incomplete',
121
- },
122
- {
123
- id: 'plugin-routes',
124
- status: readiness.pluginRouteErrors > 0 ? 'warn' : readiness.pluginRoutesMounted ? 'ok' : 'warn',
125
- message: readiness.pluginRoutesMounted
126
- ? `${readiness.pluginRoutesCount} plugin routes mounted`
127
- : 'Plugin routes are still mounting',
128
- },
129
- {
130
- id: 'redis',
131
- status: !readiness.redisEnabled ? 'ok' : readiness.redisConnected ? 'ok' : 'warn',
132
- message: !readiness.redisEnabled
133
- ? 'Redis integration disabled'
134
- : readiness.redisConnected
135
- ? 'Redis healthy'
136
- : 'Redis unavailable',
137
- },
138
- ];
139
-
140
- const httpTopOperations = metrics.latency.histogram
141
- .slice()
142
- .sort((a, b) => b.count - a.count || b.max - a.max)
143
- .slice(0, 5)
144
- .map((entry) => ({
145
- operation: `http.${entry.route}`,
146
- count: entry.count,
147
- avgDurationMs: entry.count > 0 ? entry.total / entry.count : 0,
148
- maxDurationMs: entry.max,
149
- errorCount: Object.entries(entry.byStatus)
150
- .filter(([status]) => Number(status) >= 400)
151
- .reduce((sum, [, count]) => sum + count, 0),
152
- }));
153
- const topOperations = mergeTopOperations(httpTopOperations, restDomainOperationMetrics.getTopOperations(5));
154
-
155
- const latestOperation = topOperations[0];
156
- const state = healthSnapshot.status === 'healthy'
157
- ? 'active'
158
- : runtimeMetrics || latestOperation
159
- ? 'partial_observability'
160
- : 'insufficient_data';
161
-
162
- return createServiceObservabilityHealth({
163
- schema: OBSERVABILITY_SCHEMA,
164
- contractVersion: OBSERVABILITY_CONTRACT_VERSION,
165
- serviceId: 'rest',
166
- instanceId: resolveInstanceId(),
167
- observedAt: healthSnapshot.ts,
168
- status: healthSnapshot.status === 'healthy' ? 'healthy' : healthSnapshot.status === 'degraded' ? 'degraded' : 'unhealthy',
169
- uptimeSec: healthSnapshot.uptimeSec,
170
- metricsEndpoint: `${basePath}/metrics`,
171
- logsSource: 'rest',
172
- capabilities: ['httpMetrics', 'eventLoopMetrics', 'operationMetrics', 'logCorrelation'],
173
- checks,
174
- snapshot: {
175
- cpuPercent: finiteNumberOrUndefined(runtimeMetrics?.cpu.percentage),
176
- rssBytes: finiteNumberOrUndefined(runtimeMetrics?.memory.rss),
177
- heapUsedBytes: finiteNumberOrUndefined(runtimeMetrics?.memory.heapUsed),
178
- eventLoopLagMs: finiteNumberOrUndefined(runtimeMetrics?.eventLoopLagMs),
179
- activeOperations: runtimeMetrics?.activeOperations ?? metrics.requests.active,
180
- },
181
- topOperations,
182
- state,
183
- meta: {
184
- serviceHealthEndpoint: `${basePath}/health`,
185
- readyEndpoint: `${basePath}/ready`,
186
- runtimeMetricsCollectedAt: runtimeMetrics ? new Date(runtimeMetrics.timestamp).toISOString() : null,
187
- lastRequestAt: metrics.timestamps.lastRequest
188
- ? new Date(metrics.timestamps.lastRequest).toISOString()
189
- : null,
190
- },
191
- });
192
- }
@@ -1,118 +0,0 @@
1
- /**
2
- * @module @kb-labs/rest-api-app/plugins
3
- * Fastify plugins registration
4
- */
5
-
6
- import type {
7
- FastifyInstance,
8
- FastifyPluginCallback,
9
- FastifyBaseLogger,
10
- RawServerDefault,
11
- FastifyTypeProviderDefault,
12
- } from 'fastify';
13
- import type { RestApiConfig } from '@kb-labs/rest-api-core';
14
- import fastifyCors, { type FastifyCorsOptions } from '@fastify/cors';
15
- import fastifyRateLimit, { type RateLimitPluginOptions } from '@fastify/rate-limit';
16
- import { registerOpenAPI } from '@kb-labs/shared-http';
17
-
18
- /**
19
- * Register all Fastify plugins
20
- */
21
- export async function registerPlugins(
22
- server: FastifyInstance,
23
- config: RestApiConfig
24
- ): Promise<void> {
25
- // CORS plugin with profile support
26
- const corsProfile = config.cors.profile || 'dev';
27
- let corsOrigins: string[] | boolean = config.cors.origins;
28
-
29
- if (corsProfile === 'dev') {
30
- // Dev: allow localhost origins
31
- corsOrigins = config.cors.origins.length > 0
32
- ? config.cors.origins
33
- : ['http://localhost:3000', 'http://localhost:5173']; // Vite default + Studio
34
- } else if (corsProfile === 'preview') {
35
- // Preview: specific staging domains
36
- corsOrigins = config.cors.origins.length > 0
37
- ? config.cors.origins
38
- : false; // Disable if not configured
39
- } else if (corsProfile === 'prod') {
40
- // Prod: strict whitelist
41
- corsOrigins = config.cors.origins.length > 0
42
- ? config.cors.origins
43
- : false; // Disable if not configured
44
- }
45
-
46
- const corsOptions: FastifyCorsOptions = {
47
- origin: corsOrigins,
48
- credentials: config.cors.allowCredentials,
49
- methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'HEAD'],
50
- allowedHeaders: [
51
- 'Content-Type',
52
- 'Authorization',
53
- 'X-Request-Id',
54
- 'X-Trace-Id', // Added for Studio widget tracing
55
- 'Idempotency-Key',
56
- 'X-Client-Version'
57
- ],
58
- exposedHeaders: ['X-Request-Id', 'X-Schema-Version', 'X-RateLimit-Limit', 'X-RateLimit-Remaining', 'Retry-After'],
59
- preflightContinue: false,
60
- };
61
-
62
- const corsPlugin: FastifyPluginCallback<
63
- FastifyCorsOptions,
64
- RawServerDefault,
65
- FastifyTypeProviderDefault,
66
- FastifyBaseLogger
67
- > = fastifyCors;
68
-
69
- await server.register(corsPlugin, corsOptions);
70
-
71
- // Add Vary: Origin header for CORS caching
72
- server.addHook('onSend', async (request, reply) => {
73
- if (corsProfile !== 'prod') {
74
- try {
75
- if (!reply.raw.headersSent) {
76
- reply.header('Vary', 'Origin');
77
- }
78
- } catch (err) {
79
- // Headers already sent, ignore
80
- }
81
- }
82
- });
83
-
84
- // Rate limit plugin
85
- if (config.rateLimit) {
86
- const rateLimitOpts: RateLimitPluginOptions = {
87
- max: config.rateLimit.max,
88
- timeWindow: config.rateLimit.timeWindow,
89
- addHeaders: {
90
- 'x-ratelimit-limit': true,
91
- 'x-ratelimit-remaining': true,
92
- 'x-ratelimit-reset': true,
93
- },
94
- };
95
-
96
- const rateLimitPlugin: FastifyPluginCallback<
97
- RateLimitPluginOptions,
98
- RawServerDefault,
99
- FastifyTypeProviderDefault,
100
- FastifyBaseLogger
101
- > = fastifyRateLimit;
102
-
103
- await server.register(rateLimitPlugin, rateLimitOpts);
104
- }
105
-
106
- // OpenAPI / Swagger UI
107
- // Must be registered after other plugins and before routes.
108
- // Spec is at /openapi.json — canonical across all services.
109
- // UI is disabled in production (hideUntagged: true keeps internal routes invisible).
110
- await registerOpenAPI(server, {
111
- title: 'KB Labs REST API',
112
- description: 'Main platform REST API — jobs, workflows, plugins, adapters',
113
- version: '1.0.0',
114
- servers: [{ url: 'http://localhost:5050', description: 'Local dev' }],
115
- ui: corsProfile !== 'prod',
116
- });
117
- }
118
-