@graychennpm/codebridge 0.0.0-stage → 0.1.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 (434) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +21 -0
  3. package/README.md +217 -2
  4. package/README.zh-CN.md +222 -0
  5. package/apps/web/public/brand/agent-logo-carbon.svg +1 -0
  6. package/apps/web/public/brand/agent-logo.svg +1 -0
  7. package/docs/zh-CN/npm-release.md +77 -0
  8. package/node_modules/@codebridge/agent-registry/dist/index.d.ts +32 -0
  9. package/node_modules/@codebridge/agent-registry/dist/index.js +177 -0
  10. package/node_modules/@codebridge/agent-registry/dist/setup.d.ts +9 -0
  11. package/node_modules/@codebridge/agent-registry/dist/setup.js +115 -0
  12. package/node_modules/@codebridge/agent-registry/package.json +17 -0
  13. package/node_modules/@codebridge/backends/dist/acp/acp-active-session.d.ts +12 -0
  14. package/node_modules/@codebridge/backends/dist/acp/acp-active-session.js +57 -0
  15. package/node_modules/@codebridge/backends/dist/acp/acp-claude-activity.d.ts +9 -0
  16. package/node_modules/@codebridge/backends/dist/acp/acp-claude-activity.js +49 -0
  17. package/node_modules/@codebridge/backends/dist/acp/acp-config-options.d.ts +46 -0
  18. package/node_modules/@codebridge/backends/dist/acp/acp-config-options.js +220 -0
  19. package/node_modules/@codebridge/backends/dist/acp/acp-doctor.d.ts +3 -0
  20. package/node_modules/@codebridge/backends/dist/acp/acp-doctor.js +18 -0
  21. package/node_modules/@codebridge/backends/dist/acp/acp-event-mapper.d.ts +5 -0
  22. package/node_modules/@codebridge/backends/dist/acp/acp-event-mapper.js +136 -0
  23. package/node_modules/@codebridge/backends/dist/acp/acp-kill.d.ts +10 -0
  24. package/node_modules/@codebridge/backends/dist/acp/acp-kill.js +24 -0
  25. package/node_modules/@codebridge/backends/dist/acp/acp-race.d.ts +6 -0
  26. package/node_modules/@codebridge/backends/dist/acp/acp-race.js +29 -0
  27. package/node_modules/@codebridge/backends/dist/acp/acp-session-list.d.ts +32 -0
  28. package/node_modules/@codebridge/backends/dist/acp/acp-session-list.js +218 -0
  29. package/node_modules/@codebridge/backends/dist/acp/acp-session-pool.d.ts +85 -0
  30. package/node_modules/@codebridge/backends/dist/acp/acp-session-pool.js +165 -0
  31. package/node_modules/@codebridge/backends/dist/acp/acp-session-runner.d.ts +78 -0
  32. package/node_modules/@codebridge/backends/dist/acp/acp-session-runner.js +550 -0
  33. package/node_modules/@codebridge/backends/dist/acp/acp-spawn-profiles.d.ts +9 -0
  34. package/node_modules/@codebridge/backends/dist/acp/acp-spawn-profiles.js +28 -0
  35. package/node_modules/@codebridge/backends/dist/acp/headless-client.d.ts +19 -0
  36. package/node_modules/@codebridge/backends/dist/acp/headless-client.js +47 -0
  37. package/node_modules/@codebridge/backends/dist/acp/index.d.ts +9 -0
  38. package/node_modules/@codebridge/backends/dist/acp/index.js +9 -0
  39. package/node_modules/@codebridge/backends/dist/agent-setup.d.ts +60 -0
  40. package/node_modules/@codebridge/backends/dist/agent-setup.js +504 -0
  41. package/node_modules/@codebridge/backends/dist/attachment-prompt.d.ts +8 -0
  42. package/node_modules/@codebridge/backends/dist/attachment-prompt.js +28 -0
  43. package/node_modules/@codebridge/backends/dist/auth-error-hints.d.ts +8 -0
  44. package/node_modules/@codebridge/backends/dist/auth-error-hints.js +33 -0
  45. package/node_modules/@codebridge/backends/dist/codex-skill-commands.d.ts +3 -0
  46. package/node_modules/@codebridge/backends/dist/codex-skill-commands.js +88 -0
  47. package/node_modules/@codebridge/backends/dist/index.d.ts +18 -0
  48. package/node_modules/@codebridge/backends/dist/index.js +34 -0
  49. package/node_modules/@codebridge/backends/dist/pi-providers.d.ts +45 -0
  50. package/node_modules/@codebridge/backends/dist/pi-providers.js +148 -0
  51. package/node_modules/@codebridge/backends/dist/pi-session-runner.d.ts +85 -0
  52. package/node_modules/@codebridge/backends/dist/pi-session-runner.js +460 -0
  53. package/node_modules/@codebridge/backends/dist/provider-connection.d.ts +17 -0
  54. package/node_modules/@codebridge/backends/dist/provider-connection.js +99 -0
  55. package/node_modules/@codebridge/backends/dist/session-discovery.d.ts +23 -0
  56. package/node_modules/@codebridge/backends/dist/session-discovery.js +340 -0
  57. package/node_modules/@codebridge/backends/dist/skill-control-plane.d.ts +147 -0
  58. package/node_modules/@codebridge/backends/dist/skill-control-plane.js +832 -0
  59. package/node_modules/@codebridge/backends/package.json +22 -0
  60. package/node_modules/@codebridge/bridge/dist/alert-notification-rules.d.ts +14 -0
  61. package/node_modules/@codebridge/bridge/dist/alert-notification-rules.js +37 -0
  62. package/node_modules/@codebridge/bridge/dist/channel-config.d.ts +4 -0
  63. package/node_modules/@codebridge/bridge/dist/channel-config.js +9 -0
  64. package/node_modules/@codebridge/bridge/dist/channel-ingress.d.ts +5 -0
  65. package/node_modules/@codebridge/bridge/dist/channel-ingress.js +403 -0
  66. package/node_modules/@codebridge/bridge/dist/cli.d.ts +3 -0
  67. package/node_modules/@codebridge/bridge/dist/cli.js +581 -0
  68. package/node_modules/@codebridge/bridge/dist/deployment.d.ts +46 -0
  69. package/node_modules/@codebridge/bridge/dist/deployment.js +174 -0
  70. package/node_modules/@codebridge/bridge/dist/event-loop-lag.d.ts +19 -0
  71. package/node_modules/@codebridge/bridge/dist/event-loop-lag.js +33 -0
  72. package/node_modules/@codebridge/bridge/dist/feishu-alert-monitor.d.ts +70 -0
  73. package/node_modules/@codebridge/bridge/dist/feishu-alert-monitor.js +591 -0
  74. package/node_modules/@codebridge/bridge/dist/init-wizard.d.ts +52 -0
  75. package/node_modules/@codebridge/bridge/dist/init-wizard.js +571 -0
  76. package/node_modules/@codebridge/bridge/dist/mcp-api.d.ts +4 -0
  77. package/node_modules/@codebridge/bridge/dist/mcp-api.js +100 -0
  78. package/node_modules/@codebridge/bridge/dist/outbound-api.d.ts +31 -0
  79. package/node_modules/@codebridge/bridge/dist/outbound-api.js +184 -0
  80. package/node_modules/@codebridge/bridge/dist/outbound-publishers.d.ts +54 -0
  81. package/node_modules/@codebridge/bridge/dist/outbound-publishers.js +213 -0
  82. package/node_modules/@codebridge/bridge/dist/project-api.d.ts +4 -0
  83. package/node_modules/@codebridge/bridge/dist/project-api.js +161 -0
  84. package/node_modules/@codebridge/bridge/dist/secrets-command.d.ts +13 -0
  85. package/node_modules/@codebridge/bridge/dist/secrets-command.js +34 -0
  86. package/node_modules/@codebridge/bridge/dist/session-api.d.ts +26 -0
  87. package/node_modules/@codebridge/bridge/dist/session-api.js +1378 -0
  88. package/node_modules/@codebridge/bridge/dist/session-history-import.d.ts +24 -0
  89. package/node_modules/@codebridge/bridge/dist/session-history-import.js +82 -0
  90. package/node_modules/@codebridge/bridge/dist/session-runtime-api.d.ts +19 -0
  91. package/node_modules/@codebridge/bridge/dist/session-runtime-api.js +453 -0
  92. package/node_modules/@codebridge/bridge/dist/session-runtime-migration.d.ts +21 -0
  93. package/node_modules/@codebridge/bridge/dist/session-runtime-migration.js +43 -0
  94. package/node_modules/@codebridge/bridge/dist/session-runtime-types.d.ts +85 -0
  95. package/node_modules/@codebridge/bridge/dist/session-runtime-types.js +98 -0
  96. package/node_modules/@codebridge/bridge/dist/skill-api.d.ts +28 -0
  97. package/node_modules/@codebridge/bridge/dist/skill-api.js +129 -0
  98. package/node_modules/@codebridge/bridge/dist/startup-surfaces.d.ts +15 -0
  99. package/node_modules/@codebridge/bridge/dist/startup-surfaces.js +13 -0
  100. package/node_modules/@codebridge/bridge/dist/web-frontend.d.ts +8 -0
  101. package/node_modules/@codebridge/bridge/dist/web-frontend.js +76 -0
  102. package/node_modules/@codebridge/bridge/dist/work-item-api.d.ts +6 -0
  103. package/node_modules/@codebridge/bridge/dist/work-item-api.js +414 -0
  104. package/node_modules/@codebridge/bridge/package.json +28 -0
  105. package/node_modules/@codebridge/channel-feishu/dist/alert-reactions.d.ts +6 -0
  106. package/node_modules/@codebridge/channel-feishu/dist/alert-reactions.js +58 -0
  107. package/node_modules/@codebridge/channel-feishu/dist/alert-types.d.ts +35 -0
  108. package/node_modules/@codebridge/channel-feishu/dist/alert-types.js +2 -0
  109. package/node_modules/@codebridge/channel-feishu/dist/bridge.d.ts +130 -0
  110. package/node_modules/@codebridge/channel-feishu/dist/bridge.js +1231 -0
  111. package/node_modules/@codebridge/channel-feishu/dist/cardkit-writer.d.ts +48 -0
  112. package/node_modules/@codebridge/channel-feishu/dist/cardkit-writer.js +153 -0
  113. package/node_modules/@codebridge/channel-feishu/dist/chain-topics.d.ts +20 -0
  114. package/node_modules/@codebridge/channel-feishu/dist/chain-topics.js +35 -0
  115. package/node_modules/@codebridge/channel-feishu/dist/coalescing-card-writer.d.ts +12 -0
  116. package/node_modules/@codebridge/channel-feishu/dist/coalescing-card-writer.js +53 -0
  117. package/node_modules/@codebridge/channel-feishu/dist/delivery-reconciler.d.ts +19 -0
  118. package/node_modules/@codebridge/channel-feishu/dist/delivery-reconciler.js +53 -0
  119. package/node_modules/@codebridge/channel-feishu/dist/durable-markdown-card.d.ts +19 -0
  120. package/node_modules/@codebridge/channel-feishu/dist/durable-markdown-card.js +77 -0
  121. package/node_modules/@codebridge/channel-feishu/dist/feishu-extra-events.d.ts +27 -0
  122. package/node_modules/@codebridge/channel-feishu/dist/feishu-extra-events.js +24 -0
  123. package/node_modules/@codebridge/channel-feishu/dist/feishu-http.d.ts +4 -0
  124. package/node_modules/@codebridge/channel-feishu/dist/feishu-http.js +25 -0
  125. package/node_modules/@codebridge/channel-feishu/dist/feishu-inbound-context.d.ts +13 -0
  126. package/node_modules/@codebridge/channel-feishu/dist/feishu-inbound-context.js +45 -0
  127. package/node_modules/@codebridge/channel-feishu/dist/feishu-inbound-media.d.ts +22 -0
  128. package/node_modules/@codebridge/channel-feishu/dist/feishu-inbound-media.js +273 -0
  129. package/node_modules/@codebridge/channel-feishu/dist/feishu-mention-gate.d.ts +13 -0
  130. package/node_modules/@codebridge/channel-feishu/dist/feishu-mention-gate.js +22 -0
  131. package/node_modules/@codebridge/channel-feishu/dist/feishu-outbound-file.d.ts +12 -0
  132. package/node_modules/@codebridge/channel-feishu/dist/feishu-outbound-file.js +38 -0
  133. package/node_modules/@codebridge/channel-feishu/dist/feishu-quoted-message.d.ts +30 -0
  134. package/node_modules/@codebridge/channel-feishu/dist/feishu-quoted-message.js +183 -0
  135. package/node_modules/@codebridge/channel-feishu/dist/index.d.ts +7 -0
  136. package/node_modules/@codebridge/channel-feishu/dist/index.js +3 -0
  137. package/node_modules/@codebridge/channel-feishu/dist/redacting-logger.d.ts +17 -0
  138. package/node_modules/@codebridge/channel-feishu/dist/redacting-logger.js +41 -0
  139. package/node_modules/@codebridge/channel-feishu/dist/run-status.d.ts +39 -0
  140. package/node_modules/@codebridge/channel-feishu/dist/run-status.js +166 -0
  141. package/node_modules/@codebridge/channel-feishu/dist/session-watcher.d.ts +98 -0
  142. package/node_modules/@codebridge/channel-feishu/dist/session-watcher.js +655 -0
  143. package/node_modules/@codebridge/channel-feishu/package.json +19 -0
  144. package/node_modules/@codebridge/channel-telegram/dist/coalescing-message-writer.d.ts +14 -0
  145. package/node_modules/@codebridge/channel-telegram/dist/coalescing-message-writer.js +56 -0
  146. package/node_modules/@codebridge/channel-telegram/dist/index.d.ts +3 -0
  147. package/node_modules/@codebridge/channel-telegram/dist/index.js +3 -0
  148. package/node_modules/@codebridge/channel-telegram/dist/telegram-api.d.ts +62 -0
  149. package/node_modules/@codebridge/channel-telegram/dist/telegram-api.js +72 -0
  150. package/node_modules/@codebridge/channel-telegram/dist/telegram-bridge.d.ts +64 -0
  151. package/node_modules/@codebridge/channel-telegram/dist/telegram-bridge.js +469 -0
  152. package/node_modules/@codebridge/channel-telegram/dist/telegram-session-watcher.d.ts +41 -0
  153. package/node_modules/@codebridge/channel-telegram/dist/telegram-session-watcher.js +184 -0
  154. package/node_modules/@codebridge/channel-telegram/package.json +18 -0
  155. package/node_modules/@codebridge/core/dist/config-schema.d.ts +1195 -0
  156. package/node_modules/@codebridge/core/dist/config-schema.js +293 -0
  157. package/node_modules/@codebridge/core/dist/config-store.d.ts +48 -0
  158. package/node_modules/@codebridge/core/dist/config-store.js +207 -0
  159. package/node_modules/@codebridge/core/dist/index.d.ts +11 -0
  160. package/node_modules/@codebridge/core/dist/index.js +10 -0
  161. package/node_modules/@codebridge/core/dist/json-file-store.d.ts +16 -0
  162. package/node_modules/@codebridge/core/dist/json-file-store.js +46 -0
  163. package/node_modules/@codebridge/core/dist/mcp-types.d.ts +7 -0
  164. package/node_modules/@codebridge/core/dist/mcp-types.js +2 -0
  165. package/node_modules/@codebridge/core/dist/mentions.d.ts +36 -0
  166. package/node_modules/@codebridge/core/dist/mentions.js +138 -0
  167. package/node_modules/@codebridge/core/dist/secret-migration.d.ts +14 -0
  168. package/node_modules/@codebridge/core/dist/secret-migration.js +55 -0
  169. package/node_modules/@codebridge/core/dist/secret-refs.d.ts +34 -0
  170. package/node_modules/@codebridge/core/dist/secret-refs.js +142 -0
  171. package/node_modules/@codebridge/core/dist/session-event-wire.d.ts +17 -0
  172. package/node_modules/@codebridge/core/dist/session-event-wire.js +28 -0
  173. package/node_modules/@codebridge/core/dist/types.d.ts +363 -0
  174. package/node_modules/@codebridge/core/dist/types.js +22 -0
  175. package/node_modules/@codebridge/core/dist/workspace-key.d.ts +11 -0
  176. package/node_modules/@codebridge/core/dist/workspace-key.js +25 -0
  177. package/node_modules/@codebridge/core/package.json +22 -0
  178. package/node_modules/@codebridge/mcp-runtime/dist/.tsbuildinfo +1 -0
  179. package/node_modules/@codebridge/mcp-runtime/dist/index.d.ts +92 -0
  180. package/node_modules/@codebridge/mcp-runtime/dist/index.js +377 -0
  181. package/node_modules/@codebridge/mcp-runtime/package.json +19 -0
  182. package/node_modules/@codebridge/policy/dist/capability-runtime.d.ts +123 -0
  183. package/node_modules/@codebridge/policy/dist/capability-runtime.js +195 -0
  184. package/node_modules/@codebridge/policy/dist/demo-capabilities.d.ts +4 -0
  185. package/node_modules/@codebridge/policy/dist/demo-capabilities.js +134 -0
  186. package/node_modules/@codebridge/policy/dist/equity-capabilities.d.ts +8 -0
  187. package/node_modules/@codebridge/policy/dist/equity-capabilities.js +35 -0
  188. package/node_modules/@codebridge/policy/dist/index.d.ts +107 -0
  189. package/node_modules/@codebridge/policy/dist/index.js +317 -0
  190. package/node_modules/@codebridge/policy/package.json +17 -0
  191. package/node_modules/@codebridge/project-catalog/dist/index.d.ts +145 -0
  192. package/node_modules/@codebridge/project-catalog/dist/index.js +699 -0
  193. package/node_modules/@codebridge/project-catalog/package.json +18 -0
  194. package/node_modules/@codebridge/router/dist/channel-stream-projector.d.ts +19 -0
  195. package/node_modules/@codebridge/router/dist/channel-stream-projector.js +68 -0
  196. package/node_modules/@codebridge/router/dist/command-help.d.ts +14 -0
  197. package/node_modules/@codebridge/router/dist/command-help.js +151 -0
  198. package/node_modules/@codebridge/router/dist/feishu-stream-presenter.d.ts +18 -0
  199. package/node_modules/@codebridge/router/dist/feishu-stream-presenter.js +193 -0
  200. package/node_modules/@codebridge/router/dist/index.d.ts +9 -0
  201. package/node_modules/@codebridge/router/dist/index.js +9 -0
  202. package/node_modules/@codebridge/router/dist/model-effort.d.ts +5 -0
  203. package/node_modules/@codebridge/router/dist/model-effort.js +33 -0
  204. package/node_modules/@codebridge/router/dist/orchestrator.d.ts +56 -0
  205. package/node_modules/@codebridge/router/dist/orchestrator.js +290 -0
  206. package/node_modules/@codebridge/router/dist/session-list-format.d.ts +19 -0
  207. package/node_modules/@codebridge/router/dist/session-list-format.js +97 -0
  208. package/node_modules/@codebridge/router/dist/session-rotation.d.ts +9 -0
  209. package/node_modules/@codebridge/router/dist/session-rotation.js +31 -0
  210. package/node_modules/@codebridge/router/dist/session-router.d.ts +59 -0
  211. package/node_modules/@codebridge/router/dist/session-router.js +182 -0
  212. package/node_modules/@codebridge/router/dist/slash-commands.d.ts +78 -0
  213. package/node_modules/@codebridge/router/dist/slash-commands.js +874 -0
  214. package/node_modules/@codebridge/router/package.json +18 -0
  215. package/node_modules/@codebridge/run-executor/dist/agent-event-aggregator.d.ts +18 -0
  216. package/node_modules/@codebridge/run-executor/dist/agent-event-aggregator.js +88 -0
  217. package/node_modules/@codebridge/run-executor/dist/index.d.ts +55 -0
  218. package/node_modules/@codebridge/run-executor/dist/index.js +754 -0
  219. package/node_modules/@codebridge/run-executor/dist/run-heartbeat.d.ts +14 -0
  220. package/node_modules/@codebridge/run-executor/dist/run-heartbeat.js +24 -0
  221. package/node_modules/@codebridge/run-executor/package.json +20 -0
  222. package/node_modules/@codebridge/runner-client/dist/index.d.ts +142 -0
  223. package/node_modules/@codebridge/runner-client/dist/index.js +439 -0
  224. package/node_modules/@codebridge/runner-client/package.json +18 -0
  225. package/node_modules/@codebridge/runner-host/dist/cli.d.ts +3 -0
  226. package/node_modules/@codebridge/runner-host/dist/cli.js +58 -0
  227. package/node_modules/@codebridge/runner-host/dist/codex-session-ownership.d.ts +13 -0
  228. package/node_modules/@codebridge/runner-host/dist/codex-session-ownership.js +79 -0
  229. package/node_modules/@codebridge/runner-host/dist/deployment-mcp-server.d.ts +10 -0
  230. package/node_modules/@codebridge/runner-host/dist/deployment-mcp-server.js +54 -0
  231. package/node_modules/@codebridge/runner-host/dist/fcb-script.d.ts +3 -0
  232. package/node_modules/@codebridge/runner-host/dist/fcb-script.js +99 -0
  233. package/node_modules/@codebridge/runner-host/dist/index.d.ts +3 -0
  234. package/node_modules/@codebridge/runner-host/dist/index.js +2 -0
  235. package/node_modules/@codebridge/runner-host/dist/materialize-attachments.d.ts +4 -0
  236. package/node_modules/@codebridge/runner-host/dist/materialize-attachments.js +62 -0
  237. package/node_modules/@codebridge/runner-host/dist/server.d.ts +150 -0
  238. package/node_modules/@codebridge/runner-host/dist/server.js +1295 -0
  239. package/node_modules/@codebridge/runner-host/dist/session-lease.d.ts +12 -0
  240. package/node_modules/@codebridge/runner-host/dist/session-lease.js +146 -0
  241. package/node_modules/@codebridge/runner-host/package.json +26 -0
  242. package/node_modules/@codebridge/session-catalog/dist/index.d.ts +124 -0
  243. package/node_modules/@codebridge/session-catalog/dist/index.js +411 -0
  244. package/node_modules/@codebridge/session-catalog/package.json +17 -0
  245. package/node_modules/@codebridge/session-coordinator/dist/coordinator.d.ts +111 -0
  246. package/node_modules/@codebridge/session-coordinator/dist/coordinator.js +364 -0
  247. package/node_modules/@codebridge/session-coordinator/dist/index.d.ts +5 -0
  248. package/node_modules/@codebridge/session-coordinator/dist/index.js +5 -0
  249. package/node_modules/@codebridge/session-coordinator/dist/lease.d.ts +14 -0
  250. package/node_modules/@codebridge/session-coordinator/dist/lease.js +26 -0
  251. package/node_modules/@codebridge/session-coordinator/dist/queued-claim.d.ts +20 -0
  252. package/node_modules/@codebridge/session-coordinator/dist/queued-claim.js +45 -0
  253. package/node_modules/@codebridge/session-coordinator/dist/recovery.d.ts +31 -0
  254. package/node_modules/@codebridge/session-coordinator/dist/recovery.js +114 -0
  255. package/node_modules/@codebridge/session-coordinator/package.json +17 -0
  256. package/node_modules/@codebridge/web/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  257. package/node_modules/@codebridge/web/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  258. package/node_modules/@codebridge/web/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  259. package/node_modules/@codebridge/web/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  260. package/node_modules/@codebridge/web/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  261. package/node_modules/@codebridge/web/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  262. package/node_modules/@codebridge/web/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  263. package/node_modules/@codebridge/web/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  264. package/node_modules/@codebridge/web/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  265. package/node_modules/@codebridge/web/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  266. package/node_modules/@codebridge/web/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  267. package/node_modules/@codebridge/web/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  268. package/node_modules/@codebridge/web/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  269. package/node_modules/@codebridge/web/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  270. package/node_modules/@codebridge/web/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  271. package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  272. package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  273. package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  274. package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  275. package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  276. package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  277. package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  278. package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  279. package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  280. package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  281. package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  282. package/node_modules/@codebridge/web/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  283. package/node_modules/@codebridge/web/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  284. package/node_modules/@codebridge/web/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  285. package/node_modules/@codebridge/web/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  286. package/node_modules/@codebridge/web/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  287. package/node_modules/@codebridge/web/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  288. package/node_modules/@codebridge/web/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  289. package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  290. package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  291. package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  292. package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  293. package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  294. package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  295. package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  296. package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  297. package/node_modules/@codebridge/web/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  298. package/node_modules/@codebridge/web/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  299. package/node_modules/@codebridge/web/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  300. package/node_modules/@codebridge/web/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  301. package/node_modules/@codebridge/web/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  302. package/node_modules/@codebridge/web/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  303. package/node_modules/@codebridge/web/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  304. package/node_modules/@codebridge/web/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  305. package/node_modules/@codebridge/web/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  306. package/node_modules/@codebridge/web/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  307. package/node_modules/@codebridge/web/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  308. package/node_modules/@codebridge/web/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  309. package/node_modules/@codebridge/web/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  310. package/node_modules/@codebridge/web/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  311. package/node_modules/@codebridge/web/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  312. package/node_modules/@codebridge/web/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  313. package/node_modules/@codebridge/web/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  314. package/node_modules/@codebridge/web/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  315. package/node_modules/@codebridge/web/dist/assets/abnfDiagram-N423BO3Z-C-JdFv0U.js +1 -0
  316. package/node_modules/@codebridge/web/dist/assets/arc-DsNROjzU.js +1 -0
  317. package/node_modules/@codebridge/web/dist/assets/architecture-TIHT7OUA-ZEBHG2JZ.js +1 -0
  318. package/node_modules/@codebridge/web/dist/assets/architectureDiagram-T3A2C74G-OsrxcwPM.js +36 -0
  319. package/node_modules/@codebridge/web/dist/assets/array-BifhSqXX.js +1 -0
  320. package/node_modules/@codebridge/web/dist/assets/blockDiagram-VBNYF7ZC-DRgfNeNW.js +132 -0
  321. package/node_modules/@codebridge/web/dist/assets/c4Diagram-5PPSVZJV-BtOGKTh8.js +10 -0
  322. package/node_modules/@codebridge/web/dist/assets/channel-MhXyjxUS.js +1 -0
  323. package/node_modules/@codebridge/web/dist/assets/chunk-2GRJ4B5K-Dy1gJ7sY.js +1 -0
  324. package/node_modules/@codebridge/web/dist/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  325. package/node_modules/@codebridge/web/dist/assets/chunk-4I5QYGJK-1pOLR_SG.js +1 -0
  326. package/node_modules/@codebridge/web/dist/assets/chunk-5RXB4S5H-CP43rgsO.js +231 -0
  327. package/node_modules/@codebridge/web/dist/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
  328. package/node_modules/@codebridge/web/dist/assets/chunk-6Q2QTUOP-Bi3Xrp6W.js +88 -0
  329. package/node_modules/@codebridge/web/dist/assets/chunk-7BUUIJ7U-Bb538aSH.js +1 -0
  330. package/node_modules/@codebridge/web/dist/assets/chunk-7Z6QIM7H-CILAW2Nk.js +10 -0
  331. package/node_modules/@codebridge/web/dist/assets/chunk-GF5L2VYU-CAp09yhq.js +206 -0
  332. package/node_modules/@codebridge/web/dist/assets/chunk-I66GZJ75-B_rJXmNu.js +128 -0
  333. package/node_modules/@codebridge/web/dist/assets/chunk-JQJVKLGR-OVeOJFCx.js +156 -0
  334. package/node_modules/@codebridge/web/dist/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  335. package/node_modules/@codebridge/web/dist/assets/chunk-KBJHAD2P-uaupp0k5.js +1 -0
  336. package/node_modules/@codebridge/web/dist/assets/chunk-KEIR6QF5-BICK3FdT.js +161 -0
  337. package/node_modules/@codebridge/web/dist/assets/chunk-NSK5VX7P-fIHF5wwn.js +2 -0
  338. package/node_modules/@codebridge/web/dist/assets/chunk-QR6OTTB3-DxkJuF2b.js +62 -0
  339. package/node_modules/@codebridge/web/dist/assets/chunk-RYQCIY6F-CC5j3u-X.js +1 -0
  340. package/node_modules/@codebridge/web/dist/assets/chunk-UBXNYLIW-DB35O-6R.js +1 -0
  341. package/node_modules/@codebridge/web/dist/assets/chunk-W5SLKNZC-bkRBsbq-.js +1 -0
  342. package/node_modules/@codebridge/web/dist/assets/chunk-WRU74C26-DwvEoD-1.js +70 -0
  343. package/node_modules/@codebridge/web/dist/assets/chunk-XXDRQBXY-DRyYA-HY.js +1 -0
  344. package/node_modules/@codebridge/web/dist/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  345. package/node_modules/@codebridge/web/dist/assets/classDiagram-JCYQIIEL-B8r7z8ii.js +1 -0
  346. package/node_modules/@codebridge/web/dist/assets/classDiagram-v2-OCEON4UE-B8r7z8ii.js +1 -0
  347. package/node_modules/@codebridge/web/dist/assets/cose-bilkent-JH36ORCC-CLkwlrX7.js +1 -0
  348. package/node_modules/@codebridge/web/dist/assets/cynefin-VYW2F7L2-C3_Llw02.js +1 -0
  349. package/node_modules/@codebridge/web/dist/assets/cynefinDiagram-MW4NZA55-D5v7UnJy.js +62 -0
  350. package/node_modules/@codebridge/web/dist/assets/cytoscape.esm-B-NFISlW.js +321 -0
  351. package/node_modules/@codebridge/web/dist/assets/dagre-Buvkdvvj.js +1 -0
  352. package/node_modules/@codebridge/web/dist/assets/dagre-VZM6K2ZE-Cr0IibwW.js +4 -0
  353. package/node_modules/@codebridge/web/dist/assets/defaultLocale-BFoDCU3G.js +1 -0
  354. package/node_modules/@codebridge/web/dist/assets/diagram-7IWD3JNH-CpQXDIzA.js +30 -0
  355. package/node_modules/@codebridge/web/dist/assets/diagram-B4RE2ZJO-VaOkH0Ya.js +3 -0
  356. package/node_modules/@codebridge/web/dist/assets/diagram-LBJQPF4R-D0iXyNks.js +24 -0
  357. package/node_modules/@codebridge/web/dist/assets/diagram-Q27KOJAE-CtqYk01P.js +24 -0
  358. package/node_modules/@codebridge/web/dist/assets/diagram-UB23O5K3-CFnd3H1_.js +41 -0
  359. package/node_modules/@codebridge/web/dist/assets/dist-D2L7nRdk.js +1 -0
  360. package/node_modules/@codebridge/web/dist/assets/ebnfDiagram-BXEA7PRR-B0GIbJYt.js +1 -0
  361. package/node_modules/@codebridge/web/dist/assets/erDiagram-JOGREHBK-BApaLGVA.js +85 -0
  362. package/node_modules/@codebridge/web/dist/assets/eventmodeling-45OFAUF4-DqGGjcld.js +1 -0
  363. package/node_modules/@codebridge/web/dist/assets/flowDiagram-UKHOOZJN-I_qlizLH.js +1 -0
  364. package/node_modules/@codebridge/web/dist/assets/ganttDiagram-PKOTCBZU-B-QZ-J82.js +292 -0
  365. package/node_modules/@codebridge/web/dist/assets/gitGraph-TEB2WS4Q-DK2SJ2Ne.js +1 -0
  366. package/node_modules/@codebridge/web/dist/assets/gitGraphDiagram-DS77QQ5N-B6Z-pu0D.js +106 -0
  367. package/node_modules/@codebridge/web/dist/assets/graphlib-DS17s2tU.js +1 -0
  368. package/node_modules/@codebridge/web/dist/assets/index-8BzpyygS.js +559 -0
  369. package/node_modules/@codebridge/web/dist/assets/index-Bzaz89LE.css +1 -0
  370. package/node_modules/@codebridge/web/dist/assets/info-DKCQHKI2-CGWxt_Py.js +1 -0
  371. package/node_modules/@codebridge/web/dist/assets/infoDiagram-6WML65LV-77XjrPZs.js +2 -0
  372. package/node_modules/@codebridge/web/dist/assets/init-C-OQMol4.js +1 -0
  373. package/node_modules/@codebridge/web/dist/assets/ishikawaDiagram-WSZJBQD7-P1bZAz2x.js +70 -0
  374. package/node_modules/@codebridge/web/dist/assets/journeyDiagram-NVQOT4AX-C4rwMcBY.js +139 -0
  375. package/node_modules/@codebridge/web/dist/assets/kanban-definition-27J2QSJJ-mtw4a9bc.js +89 -0
  376. package/node_modules/@codebridge/web/dist/assets/line-DP4RkYqm.js +1 -0
  377. package/node_modules/@codebridge/web/dist/assets/linear-DMg3PPio.js +1 -0
  378. package/node_modules/@codebridge/web/dist/assets/map-BaFkSB1l.js +1 -0
  379. package/node_modules/@codebridge/web/dist/assets/mermaid-parser.core-HY84kHw1.js +7 -0
  380. package/node_modules/@codebridge/web/dist/assets/mermaid.core-DdgCdsnM.js +42 -0
  381. package/node_modules/@codebridge/web/dist/assets/mindmap-definition-FAOFIHXS-Cw1EnbhZ.js +96 -0
  382. package/node_modules/@codebridge/web/dist/assets/ordinal-BDEzSJ7C.js +1 -0
  383. package/node_modules/@codebridge/web/dist/assets/packet-7NZHBO7P-CEbrbJH3.js +1 -0
  384. package/node_modules/@codebridge/web/dist/assets/path-fybaL0A-.js +1 -0
  385. package/node_modules/@codebridge/web/dist/assets/pegDiagram-VL7TDLO6-CEc1Gedb.js +1 -0
  386. package/node_modules/@codebridge/web/dist/assets/pie-RZYD4A2V-DPXVs-IW.js +1 -0
  387. package/node_modules/@codebridge/web/dist/assets/pieDiagram-7S7Q4E2Y-hoQeGMFH.js +39 -0
  388. package/node_modules/@codebridge/web/dist/assets/quadrantDiagram-CIZ2JOQS-C-Nmxx0f.js +7 -0
  389. package/node_modules/@codebridge/web/dist/assets/radar-I7S5WNFK-BVd3X3Pd.js +1 -0
  390. package/node_modules/@codebridge/web/dist/assets/railroad-3IZDKUUU-CxLxzr_v.js +1 -0
  391. package/node_modules/@codebridge/web/dist/assets/railroad-abnf-AHOZXSZD-MA1zPI84.js +1 -0
  392. package/node_modules/@codebridge/web/dist/assets/railroad-ebnf-EBAXGLYW-Bqug_umD.js +1 -0
  393. package/node_modules/@codebridge/web/dist/assets/railroad-peg-LSFZ7HO6-DRcRFwpq.js +1 -0
  394. package/node_modules/@codebridge/web/dist/assets/railroadDiagram-AXF67PYL-B007ZkL9.js +1 -0
  395. package/node_modules/@codebridge/web/dist/assets/requirementDiagram-LRYGKXZP-LrTCcEi5.js +84 -0
  396. package/node_modules/@codebridge/web/dist/assets/rough.esm-Dy-Kn_BL.js +1 -0
  397. package/node_modules/@codebridge/web/dist/assets/sankeyDiagram-W5VNT64P-Ch4mzHck.js +40 -0
  398. package/node_modules/@codebridge/web/dist/assets/sequenceDiagram-SI44F4Z6-CHg4OzLX.js +162 -0
  399. package/node_modules/@codebridge/web/dist/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +1 -0
  400. package/node_modules/@codebridge/web/dist/assets/src-BrO6_odD.js +1 -0
  401. package/node_modules/@codebridge/web/dist/assets/stateDiagram-OKZ733FA-7cVkr5nR.js +1 -0
  402. package/node_modules/@codebridge/web/dist/assets/stateDiagram-v2-UEYNNEHI-CTy_mAXb.js +1 -0
  403. package/node_modules/@codebridge/web/dist/assets/swimlanes-SLNWSIFB-BwSVF5qy.js +2 -0
  404. package/node_modules/@codebridge/web/dist/assets/swimlanesDiagram-ULZ7WXOC-BBQnfZ1j.js +8 -0
  405. package/node_modules/@codebridge/web/dist/assets/timeline-definition-Z64GVDOM-BaHEkVDV.js +120 -0
  406. package/node_modules/@codebridge/web/dist/assets/treeView-QDETBFTQ-CF0kLN62.js +1 -0
  407. package/node_modules/@codebridge/web/dist/assets/treemap-6X3UGDF4-BB8A8uux.js +1 -0
  408. package/node_modules/@codebridge/web/dist/assets/vennDiagram-T6HMQDX7-BFK12Iro.js +34 -0
  409. package/node_modules/@codebridge/web/dist/assets/wardley-OPB4EBWU-C_3y61zk.js +1 -0
  410. package/node_modules/@codebridge/web/dist/assets/wardleyDiagram-T6FBY63Y-W2oGu4WK.js +78 -0
  411. package/node_modules/@codebridge/web/dist/assets/xychartDiagram-ELKLHX3M-BiVRnbvz.js +7 -0
  412. package/node_modules/@codebridge/web/dist/brand/agent-logo-carbon.svg +1 -0
  413. package/node_modules/@codebridge/web/dist/brand/agent-logo.svg +1 -0
  414. package/node_modules/@codebridge/web/dist/brand/agnet-logo-carbon.svg +1 -0
  415. package/node_modules/@codebridge/web/dist/brand/agnet-logo.svg +1 -0
  416. package/node_modules/@codebridge/web/dist/brand/agnet-mark-carbon.svg +1 -0
  417. package/node_modules/@codebridge/web/dist/brand/agnet-mark.svg +1 -0
  418. package/node_modules/@codebridge/web/dist/fonts/CommitMono-400-Regular.otf +0 -0
  419. package/node_modules/@codebridge/web/dist/fonts/CommitMono-700-Regular.otf +0 -0
  420. package/node_modules/@codebridge/web/dist/fonts/CommitMono-OFL.txt +21 -0
  421. package/node_modules/@codebridge/web/dist/fonts/DepartureMono-OFL.txt +21 -0
  422. package/node_modules/@codebridge/web/dist/fonts/DepartureMono-Regular.woff2 +0 -0
  423. package/node_modules/@codebridge/web/dist/index.html +25 -0
  424. package/node_modules/@codebridge/web/package.json +7 -0
  425. package/node_modules/@codebridge/work-items/dist/index.d.ts +371 -0
  426. package/node_modules/@codebridge/work-items/dist/index.js +1784 -0
  427. package/node_modules/@codebridge/work-items/dist/session-projector.d.ts +4 -0
  428. package/node_modules/@codebridge/work-items/dist/session-projector.js +506 -0
  429. package/node_modules/@codebridge/work-items/dist/session-runtime.d.ts +274 -0
  430. package/node_modules/@codebridge/work-items/dist/session-runtime.js +1103 -0
  431. package/node_modules/@codebridge/work-items/dist/session-schema.d.ts +9 -0
  432. package/node_modules/@codebridge/work-items/dist/session-schema.js +292 -0
  433. package/node_modules/@codebridge/work-items/package.json +20 -0
  434. package/package.json +75 -4
@@ -0,0 +1,414 @@
1
+ import { Hono } from "hono";
2
+ import { randomUUID } from "node:crypto";
3
+ const WORK_ITEM_MODES = [
4
+ "auto",
5
+ "investigation",
6
+ "change",
7
+ "review",
8
+ "release",
9
+ "observe",
10
+ ];
11
+ export function createWorkItemApp(store, token, approvals, executor) {
12
+ const app = new Hono();
13
+ app.use("/v1/*", async (c, next) => {
14
+ if (c.req.header("authorization") !== `Bearer ${token}`) {
15
+ return errorResponse(c, 401, "unauthorized", "未授权");
16
+ }
17
+ await next();
18
+ });
19
+ app.post("/v1/work-items", async (c) => {
20
+ const idempotencyKey = c.req.header("idempotency-key");
21
+ if (idempotencyKey) {
22
+ const cached = store.getIdempotencyResponse("create-work-item", idempotencyKey);
23
+ if (cached !== undefined)
24
+ return c.json(cached, 201);
25
+ }
26
+ const body = await readJson(c);
27
+ const input = parseCreateInput(body);
28
+ if (!input) {
29
+ return errorResponse(c, 400, "invalid_work_item", "conversation_id 和 message 必填;title、agent_id、mode 可由 Agent 自动判断");
30
+ }
31
+ try {
32
+ const workItem = store.createWorkItem(input);
33
+ store.appendEvent({
34
+ workItemId: workItem.id,
35
+ type: "MESSAGE_RECEIVED",
36
+ actor: "user",
37
+ payload: { message: input.message },
38
+ });
39
+ const response = toApiWorkItem(workItem);
40
+ if (idempotencyKey)
41
+ store.putIdempotencyResponse("create-work-item", idempotencyKey, response);
42
+ return c.json(response, 201);
43
+ }
44
+ catch (error) {
45
+ return errorResponse(c, 400, "work_item_create_failed", messageOf(error));
46
+ }
47
+ });
48
+ app.get("/v1/work-items", (c) => {
49
+ return c.json({ work_items: store.listWorkItems().map(toApiWorkItem) });
50
+ });
51
+ app.get("/v1/work-items/:work_item_id", (c) => {
52
+ const workItem = store.getWorkItem(c.req.param("work_item_id"));
53
+ if (!workItem) {
54
+ return errorResponse(c, 404, "work_item_not_found", "WorkItem 不存在");
55
+ }
56
+ return c.json(toApiWorkItem(workItem));
57
+ });
58
+ app.post("/v1/work-items/:work_item_id/messages", async (c) => {
59
+ const workItemId = c.req.param("work_item_id");
60
+ if (!store.getWorkItem(workItemId)) {
61
+ return errorResponse(c, 404, "work_item_not_found", "WorkItem 不存在");
62
+ }
63
+ const body = await readJson(c);
64
+ if (!body ||
65
+ typeof body.message !== "string" ||
66
+ body.message.trim() === "") {
67
+ return errorResponse(c, 400, "invalid_message", "message 必填");
68
+ }
69
+ const idempotencyKey = c.req.header("idempotency-key");
70
+ if (idempotencyKey) {
71
+ const cached = store.getIdempotencyResponse(`message:${workItemId}`, idempotencyKey);
72
+ if (cached !== undefined)
73
+ return c.json(cached, 202);
74
+ }
75
+ const event = store.appendEvent({
76
+ workItemId,
77
+ type: "MESSAGE_RECEIVED",
78
+ actor: body.actor === "channel" ? "channel" : "user",
79
+ payload: { message: body.message },
80
+ });
81
+ const response = {
82
+ request_id: `req_${randomUUID().replaceAll("-", "")}`,
83
+ accepted: true,
84
+ event_id: event.eventId,
85
+ sequence: event.sequence,
86
+ };
87
+ if (idempotencyKey)
88
+ store.putIdempotencyResponse(`message:${workItemId}`, idempotencyKey, response);
89
+ return c.json(response, 202);
90
+ });
91
+ app.post("/v1/work-items/:work_item_id/runs", async (c) => {
92
+ const workItemId = c.req.param("work_item_id");
93
+ const workItem = store.getWorkItem(workItemId);
94
+ if (!workItem) {
95
+ return errorResponse(c, 404, "work_item_not_found", "WorkItem 不存在");
96
+ }
97
+ const body = await readJson(c);
98
+ if (!body ||
99
+ typeof body.mode !== "string" ||
100
+ !WORK_ITEM_MODES.includes(body.mode) ||
101
+ body.execution_kind !== "agent") {
102
+ return errorResponse(c, 400, "invalid_run", "mode 与 execution_kind 必须有效");
103
+ }
104
+ if (body.plan_id !== undefined &&
105
+ body.plan_id !== null &&
106
+ typeof body.plan_id !== "string") {
107
+ return errorResponse(c, 400, "invalid_run", "plan_id 无效");
108
+ }
109
+ const idempotencyKey = c.req.header("idempotency-key");
110
+ if (idempotencyKey) {
111
+ const cached = store.getIdempotencyResponse(`run:${workItemId}`, idempotencyKey);
112
+ if (cached !== undefined)
113
+ return c.json(cached, 202);
114
+ }
115
+ try {
116
+ const run = store.createRun({
117
+ workItemId,
118
+ mode: body.mode,
119
+ executionKind: body.execution_kind,
120
+ planId: body.plan_id ?? null,
121
+ });
122
+ if (executor) {
123
+ void executor.execute(run.id).catch(() => {
124
+ // RunExecutor persists the failure event and status. The event stream
125
+ // is the durable error channel for clients that created the Run.
126
+ });
127
+ }
128
+ const response = {
129
+ run_id: run.id,
130
+ status: run.status,
131
+ execution_kind: run.executionKind,
132
+ };
133
+ if (idempotencyKey)
134
+ store.putIdempotencyResponse(`run:${workItemId}`, idempotencyKey, response);
135
+ return c.json(response, 202);
136
+ }
137
+ catch (error) {
138
+ return errorResponse(c, 400, "run_create_failed", messageOf(error));
139
+ }
140
+ });
141
+ app.post("/v1/runs/:run_id/approve", async (c) => {
142
+ if (!approvals) {
143
+ return errorResponse(c, 503, "approval_unavailable", "审批服务未配置");
144
+ }
145
+ const run = store.getRun(c.req.param("run_id"));
146
+ if (!run)
147
+ return errorResponse(c, 404, "run_not_found", "Run 不存在");
148
+ const body = await readJson(c);
149
+ if (!body || typeof body.approval_id !== "string") {
150
+ return errorResponse(c, 400, "invalid_approval", "approval_id 必填");
151
+ }
152
+ const approval = approvals.get(body.approval_id);
153
+ if (!approval || approval.runId !== run.id) {
154
+ return errorResponse(c, 404, "approval_not_found", "审批记录不存在");
155
+ }
156
+ const granted = approvals.grant(approval.id, body.granted_by === "system" ? "system" : "user");
157
+ if (!granted || granted.status !== "granted") {
158
+ return errorResponse(c, 409, "approval_not_grantable", "审批已过期或已处理");
159
+ }
160
+ store.requeueRun(run.id);
161
+ if (executor)
162
+ void executor.execute(run.id).catch(() => { });
163
+ return c.json({ approval_id: granted.id, status: granted.status, granted_at: granted.grantedAt });
164
+ });
165
+ app.get("/v1/runs/:run_id/approvals", (c) => {
166
+ if (!approvals)
167
+ return errorResponse(c, 503, "approval_unavailable", "审批服务未配置");
168
+ const run = store.getRun(c.req.param("run_id"));
169
+ if (!run)
170
+ return errorResponse(c, 404, "run_not_found", "Run 不存在");
171
+ return c.json({ approvals: approvals.listForRun(run.id).map(toApiApproval) });
172
+ });
173
+ app.get("/v1/runs/:run_id/artifacts", (c) => {
174
+ const run = store.getRun(c.req.param("run_id"));
175
+ if (!run)
176
+ return errorResponse(c, 404, "run_not_found", "Run 不存在");
177
+ return c.json({ artifacts: store.listArtifacts(run.id).map((artifact) => toApiArtifact(artifact, false)) });
178
+ });
179
+ app.get("/v1/runs/:run_id/verifications", (c) => {
180
+ const run = store.getRun(c.req.param("run_id"));
181
+ if (!run)
182
+ return errorResponse(c, 404, "run_not_found", "Run 不存在");
183
+ return c.json({ verifications: store.listVerifications(run.id).map(toApiVerification) });
184
+ });
185
+ app.get("/v1/artifacts/:artifact_id", (c) => {
186
+ const artifact = store.getArtifact(c.req.param("artifact_id"));
187
+ if (!artifact)
188
+ return errorResponse(c, 404, "artifact_not_found", "Artifact 不存在");
189
+ return c.json(toApiArtifact(artifact, true));
190
+ });
191
+ app.post("/v1/runs/:run_id/reject", async (c) => {
192
+ if (!approvals) {
193
+ return errorResponse(c, 503, "approval_unavailable", "审批服务未配置");
194
+ }
195
+ const run = store.getRun(c.req.param("run_id"));
196
+ if (!run)
197
+ return errorResponse(c, 404, "run_not_found", "Run 不存在");
198
+ const body = await readJson(c);
199
+ if (!body || typeof body.approval_id !== "string") {
200
+ return errorResponse(c, 400, "invalid_approval", "approval_id 必填");
201
+ }
202
+ const approval = approvals.get(body.approval_id);
203
+ if (!approval || approval.runId !== run.id) {
204
+ return errorResponse(c, 404, "approval_not_found", "审批记录不存在");
205
+ }
206
+ const rejected = approvals.revoke(approval.id, body.rejected_by === "system" ? "system" : "user");
207
+ if (!rejected || rejected.status !== "revoked") {
208
+ return errorResponse(c, 409, "approval_not_rejectable", "审批已过期或已处理");
209
+ }
210
+ store.updateRunStatus(run.id, "cancelled");
211
+ store.appendEvent({
212
+ workItemId: run.workItemId,
213
+ runId: run.id,
214
+ type: "RUN_CANCELLED",
215
+ actor: "user",
216
+ target: run.id,
217
+ payload: { approval_id: rejected.id, reason: "approval_rejected" },
218
+ });
219
+ return c.json({ approval_id: rejected.id, status: rejected.status });
220
+ });
221
+ app.get("/v1/work-items/:work_item_id/events", (c) => {
222
+ const workItemId = c.req.param("work_item_id");
223
+ if (!store.getWorkItem(workItemId)) {
224
+ return errorResponse(c, 404, "work_item_not_found", "WorkItem 不存在");
225
+ }
226
+ const lastEventId = c.req.header("last-event-id");
227
+ const afterSequenceValue = c.req.query("after_sequence") ??
228
+ (lastEventId ? String(store.sequenceForEventId(workItemId, lastEventId)) : "0");
229
+ const afterSequence = Number(afterSequenceValue);
230
+ if (!Number.isInteger(afterSequence) || afterSequence < 0) {
231
+ return errorResponse(c, 400, "invalid_after_sequence", "after_sequence 无效");
232
+ }
233
+ const stream = store
234
+ .listEvents(workItemId, afterSequence)
235
+ .map(toSseEvent)
236
+ .join("");
237
+ return new Response(stream, {
238
+ status: 200,
239
+ headers: {
240
+ "cache-control": "no-cache",
241
+ connection: "keep-alive",
242
+ "content-type": "text/event-stream; charset=utf-8",
243
+ },
244
+ });
245
+ });
246
+ return app;
247
+ }
248
+ function parseCreateInput(body) {
249
+ if (!body)
250
+ return null;
251
+ const requiredStrings = ["conversation_id", "message"];
252
+ if (requiredStrings.some((key) => !isNonEmptyString(body[key]))) {
253
+ return null;
254
+ }
255
+ if (body.title !== undefined && body.title !== null && !isNonEmptyString(body.title)) {
256
+ return null;
257
+ }
258
+ if (body.agent_id !== undefined && body.agent_id !== null && !isNonEmptyString(body.agent_id)) {
259
+ return null;
260
+ }
261
+ if (body.mode !== undefined && body.mode !== null && (typeof body.mode !== "string" ||
262
+ !WORK_ITEM_MODES.includes(body.mode))) {
263
+ return null;
264
+ }
265
+ if (body.workflow_id !== undefined &&
266
+ body.workflow_id !== null &&
267
+ typeof body.workflow_id !== "string") {
268
+ return null;
269
+ }
270
+ if (body.workspace_scope !== undefined && !isStringArray(body.workspace_scope)) {
271
+ return null;
272
+ }
273
+ if (body.identifiers !== undefined && !isRecord(body.identifiers)) {
274
+ return null;
275
+ }
276
+ if (body.risk_level !== undefined &&
277
+ !["read_only", "workspace_write", "git_write", "production_write"].includes(String(body.risk_level))) {
278
+ return null;
279
+ }
280
+ return {
281
+ title: isNonEmptyString(body.title)
282
+ ? body.title
283
+ : deriveTitle(body.message),
284
+ mode: body.mode ?? "auto",
285
+ conversationId: body.conversation_id,
286
+ agentId: body.agent_id ?? null,
287
+ workflowId: body.workflow_id ?? null,
288
+ workflowRevision: null,
289
+ workspaceScope: body.workspace_scope ?? [],
290
+ identifiers: body.identifiers ?? {},
291
+ riskLevel: body.risk_level ?? "read_only",
292
+ message: body.message,
293
+ };
294
+ }
295
+ function deriveTitle(message) {
296
+ const compact = message.replace(/\s+/g, " ").trim();
297
+ return compact.length > 48 ? `${compact.slice(0, 47)}…` : compact;
298
+ }
299
+ async function readJson(c) {
300
+ const body = await c.req.json().catch(() => null);
301
+ return isRecord(body) ? body : null;
302
+ }
303
+ function isRecord(value) {
304
+ return typeof value === "object" && value !== null && !Array.isArray(value);
305
+ }
306
+ function isNonEmptyString(value) {
307
+ return typeof value === "string" && value.trim().length > 0;
308
+ }
309
+ function isStringArray(value) {
310
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
311
+ }
312
+ function toApiWorkItem(workItem) {
313
+ return {
314
+ schema_version: workItem.schemaVersion,
315
+ id: workItem.id,
316
+ title: workItem.title,
317
+ status: workItem.status,
318
+ mode: workItem.mode,
319
+ conversation_id: workItem.conversationId,
320
+ agent_id: workItem.agentId,
321
+ workflow_id: workItem.workflowId,
322
+ workflow_revision: workItem.workflowRevision,
323
+ workspace_scope: workItem.workspaceScope,
324
+ identifiers: workItem.identifiers,
325
+ context_revision: workItem.contextRevision,
326
+ risk_level: workItem.riskLevel,
327
+ created_at: workItem.createdAt,
328
+ updated_at: workItem.updatedAt,
329
+ };
330
+ }
331
+ function toApiApproval(approval) {
332
+ return {
333
+ id: approval.id,
334
+ work_item_id: approval.workItemId,
335
+ run_id: approval.runId,
336
+ step_id: approval.stepId,
337
+ capability_id: approval.capabilityId,
338
+ session_id: approval.sessionId,
339
+ environment: approval.environment,
340
+ target_resource: approval.targetResource,
341
+ input_hash: approval.inputHash,
342
+ status: approval.status,
343
+ requested_by: approval.requestedBy,
344
+ granted_by: approval.grantedBy,
345
+ created_at: approval.createdAt,
346
+ expires_at: approval.expiresAt,
347
+ granted_at: approval.grantedAt,
348
+ consumed_at: approval.consumedAt,
349
+ };
350
+ }
351
+ function toApiArtifact(artifact, includeContent) {
352
+ return {
353
+ id: artifact.id,
354
+ work_item_id: artifact.workItemId,
355
+ run_id: artifact.runId,
356
+ step_id: artifact.stepId,
357
+ kind: artifact.kind,
358
+ name: artifact.name,
359
+ mime_type: artifact.mimeType,
360
+ content: includeContent ? artifact.content : undefined,
361
+ content_hash: artifact.contentHash,
362
+ metadata: artifact.metadata,
363
+ created_at: artifact.createdAt,
364
+ };
365
+ }
366
+ function toApiVerification(verification) {
367
+ return {
368
+ id: verification.id,
369
+ work_item_id: verification.workItemId,
370
+ run_id: verification.runId,
371
+ step_id: verification.stepId,
372
+ validator: verification.validator,
373
+ status: verification.status,
374
+ summary: verification.summary,
375
+ artifact_ids: verification.artifactIds,
376
+ created_at: verification.createdAt,
377
+ };
378
+ }
379
+ function toSseEvent(event) {
380
+ return [
381
+ `id: ${event.eventId}`,
382
+ `event: ${event.type}`,
383
+ `data: ${JSON.stringify({
384
+ schema_version: event.schemaVersion,
385
+ event_id: event.eventId,
386
+ sequence: event.sequence,
387
+ work_item_id: event.workItemId,
388
+ run_id: event.runId,
389
+ type: event.type,
390
+ occurred_at: event.occurredAt,
391
+ actor: event.actor,
392
+ target: event.target,
393
+ input_hash: event.inputHash,
394
+ result_ref: event.resultRef,
395
+ payload: event.payload,
396
+ })}`,
397
+ "",
398
+ "",
399
+ ].join("\n");
400
+ }
401
+ function errorResponse(c, status, code, message, retryable = false) {
402
+ return c.json({
403
+ error: {
404
+ code,
405
+ message,
406
+ retryable,
407
+ request_id: `req_${randomUUID().replaceAll("-", "")}`,
408
+ },
409
+ }, status);
410
+ }
411
+ function messageOf(error) {
412
+ return error instanceof Error ? error.message : String(error);
413
+ }
414
+ //# sourceMappingURL=work-item-api.js.map
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@codebridge/bridge",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "bin": {
6
+ "codebridge": "./dist/cli.js"
7
+ },
8
+ "license": "MIT",
9
+ "dependencies": {
10
+ "@codebridge/channel-feishu": "0.1.0",
11
+ "@codebridge/channel-telegram": "0.1.0",
12
+ "@codebridge/core": "0.1.0",
13
+ "@codebridge/router": "0.1.0",
14
+ "@codebridge/policy": "0.1.0",
15
+ "@codebridge/mcp-runtime": "0.1.0",
16
+ "@codebridge/project-catalog": "0.1.0",
17
+ "@codebridge/agent-registry": "0.1.0",
18
+ "@codebridge/session-catalog": "0.1.0",
19
+ "@codebridge/run-executor": "0.1.0",
20
+ "@codebridge/runner-client": "0.1.0",
21
+ "@codebridge/session-coordinator": "0.1.0",
22
+ "@codebridge/work-items": "0.1.0",
23
+ "@hono/node-server": "1.19.14",
24
+ "commander": "12.1.0",
25
+ "hono": "4.12.27",
26
+ "yaml": "2.9.0"
27
+ }
28
+ }
@@ -0,0 +1,6 @@
1
+ import type { Client } from "@larksuiteoapi/node-sdk";
2
+ /** Replace only this application's managed state reactions on the original alert. */
3
+ export declare function setAlertReaction(client: Client, appId: string, messageId: string, emojiType: string, managedEmojiTypes: string[]): Promise<string>;
4
+ /** Read any human's DONE, excluding the bot's own projected state. */
5
+ export declare function findHumanDoneReaction(client: Client, messageId: string, after?: number): Promise<import("./alert-types.js").FeishuAlertReaction | undefined>;
6
+ //# sourceMappingURL=alert-reactions.d.ts.map
@@ -0,0 +1,58 @@
1
+ /** Replace only this application's managed state reactions on the original alert. */
2
+ export async function setAlertReaction(client, appId, messageId, emojiType, managedEmojiTypes) {
3
+ if (!managedEmojiTypes.includes(emojiType))
4
+ throw new Error("Unmanaged alert reaction");
5
+ const api = client.im.v1.messageReaction;
6
+ const owned = [];
7
+ let pageToken;
8
+ do {
9
+ const response = await api.list({ path: { message_id: messageId }, params: { page_size: 50, page_token: pageToken } });
10
+ if (response.code !== 0 || !response.data)
11
+ throw new Error(`Reaction list failed (${response.code}): ${response.msg}`);
12
+ owned.push(...response.data.items.filter((item) => item.operator?.operator_type === "app"
13
+ && item.operator.operator_id === appId && managedEmojiTypes.includes(item.reaction_type?.emoji_type ?? "")));
14
+ pageToken = response.data.has_more ? response.data.page_token : undefined;
15
+ if (response.data.has_more && !pageToken)
16
+ throw new Error("Incomplete reaction pagination");
17
+ } while (pageToken);
18
+ let reactionId = owned.find((item) => item.reaction_type?.emoji_type === emojiType)?.reaction_id;
19
+ if (!reactionId) {
20
+ const created = await api.create({ path: { message_id: messageId }, data: { reaction_type: { emoji_type: emojiType } } });
21
+ if (created.code !== 0 || !created.data?.reaction_id)
22
+ throw new Error(`Reaction create failed (${created.code}): ${created.msg}`);
23
+ reactionId = created.data.reaction_id;
24
+ }
25
+ // Add the new state before removing the old one; retries can read back the newly created state.
26
+ for (const item of owned) {
27
+ if (!item.reaction_id || item.reaction_id === reactionId)
28
+ continue;
29
+ const removed = await api.delete({ path: { message_id: messageId, reaction_id: item.reaction_id } });
30
+ if (removed.code !== 0)
31
+ throw new Error(`Reaction delete failed (${removed.code}): ${removed.msg}`);
32
+ }
33
+ return reactionId;
34
+ }
35
+ /** Read any human's DONE, excluding the bot's own projected state. */
36
+ export async function findHumanDoneReaction(client, messageId, after) {
37
+ let pageToken;
38
+ do {
39
+ const result = await client.im.v1.messageReaction.list({ path: { message_id: messageId },
40
+ params: { reaction_type: "DONE", user_id_type: "open_id", page_size: 50, page_token: pageToken } });
41
+ if (result.code !== 0 || !result.data)
42
+ throw new Error(`Reaction read failed (${result.code}): ${result.msg}`);
43
+ for (const item of result.data.items) {
44
+ if (item.operator?.operator_type !== "user" || !item.operator.operator_id || item.reaction_type?.emoji_type !== "DONE")
45
+ continue;
46
+ const rawTime = Number(item.action_time);
47
+ const actionTime = Number.isFinite(rawTime) && rawTime > 0 ? rawTime : undefined;
48
+ if (after !== undefined && (actionTime === undefined || actionTime <= after))
49
+ continue;
50
+ return { messageId, operatorOpenId: item.operator.operator_id, operatorType: "user", emojiType: "DONE", action: "added", actionTime };
51
+ }
52
+ pageToken = result.data.has_more ? result.data.page_token : undefined;
53
+ if (result.data.has_more && !pageToken)
54
+ throw new Error("Incomplete reaction pagination");
55
+ } while (pageToken);
56
+ return undefined;
57
+ }
58
+ //# sourceMappingURL=alert-reactions.js.map
@@ -0,0 +1,35 @@
1
+ /** Channel transport values; alert policy and persistence live in the Bridge app. */
2
+ export interface FeishuAlertMessage {
3
+ messageId: string;
4
+ chatId: string;
5
+ createdAt: number;
6
+ senderId: string;
7
+ senderType: string;
8
+ content: string;
9
+ rootId?: string;
10
+ }
11
+ export interface FeishuAlertPage {
12
+ messages: FeishuAlertMessage[];
13
+ hasMore: boolean;
14
+ pageToken?: string;
15
+ }
16
+ export interface FeishuAlertReply {
17
+ allowed: boolean;
18
+ handled?: boolean;
19
+ topicId: string;
20
+ instructions: string;
21
+ /** Sent back into the thread when the message is refused, so nobody is ignored silently. */
22
+ notice?: string;
23
+ }
24
+ export declare const FEISHU_ALERT_STATUSES: readonly ["investigating", "waiting", "resolved", "no_action", "blocked", "dismissed"];
25
+ export type FeishuAlertStatus = typeof FEISHU_ALERT_STATUSES[number];
26
+ export interface FeishuAlertReaction {
27
+ messageId: string;
28
+ operatorOpenId: string;
29
+ /** Set when the source can tell humans from apps; anything but a user is ignored. */
30
+ operatorType?: string;
31
+ emojiType: string;
32
+ action: "added" | "removed";
33
+ actionTime?: number;
34
+ }
35
+ //# sourceMappingURL=alert-types.d.ts.map
@@ -0,0 +1,2 @@
1
+ export const FEISHU_ALERT_STATUSES = ["investigating", "waiting", "resolved", "no_action", "blocked", "dismissed"];
2
+ //# sourceMappingURL=alert-types.js.map
@@ -0,0 +1,130 @@
1
+ import type { FeishuAlertMessage, FeishuAlertPage, FeishuAlertReply, FeishuAlertReaction } from "./alert-types.js";
2
+ import { type AppConfig, type ChannelSessionIngress, type RunAttachment } from "@codebridge/core";
3
+ import { RunOrchestrator } from "@codebridge/router";
4
+ export interface FeishuMessage {
5
+ messageId: string;
6
+ chatId: string;
7
+ chatType: "p2p" | "group";
8
+ senderId: string;
9
+ senderName?: string;
10
+ content: string;
11
+ threadId?: string;
12
+ /** 回复串的串首消息 id(普通群回复时有值) */
13
+ rootId?: string;
14
+ /** 被直接回复(引用)的消息 id */
15
+ replyToMessageId?: string;
16
+ mentionedBot?: boolean;
17
+ mentions?: FeishuMention[];
18
+ attachments?: RunAttachment[];
19
+ rawContentType?: string;
20
+ raw?: unknown;
21
+ }
22
+ export interface FeishuMention {
23
+ openId?: string;
24
+ userId?: string;
25
+ name?: string;
26
+ isBot?: boolean;
27
+ }
28
+ export interface FeishuBridgeOptions {
29
+ config: AppConfig;
30
+ dataDir: string;
31
+ onLog?: (msg: string) => void;
32
+ sessionIngress?: ChannelSessionIngress;
33
+ onDeploymentMessage?: (message: FeishuMessage) => Promise<string | undefined>;
34
+ isMaintenance?: () => boolean;
35
+ prepareAlertReply?: (message: FeishuMessage, topicId: string | undefined) => FeishuAlertReply | undefined | Promise<FeishuAlertReply | undefined>;
36
+ isAlertMessage?: (chatId: string, messageId: string) => boolean;
37
+ isAlertChat?: (chatId: string) => boolean;
38
+ /** True when one of the candidate ids is a configured alert sender for the chat. */
39
+ isAlertSender?: (chatId: string, candidateIds: string[]) => boolean;
40
+ onAlertReaction?: (reaction: FeishuAlertReaction) => Promise<void>;
41
+ }
42
+ /** 把长文本按行切成 ≤ maxLen 的块,用于超长结果分条普通消息发送(避免又撞长度上限) */
43
+ export declare function chunkMarkdown(text: string, maxLen: number): string[];
44
+ export declare class FeishuBridge {
45
+ private readonly options;
46
+ private channel?;
47
+ private orchestrator;
48
+ private config;
49
+ /** chat|topic → 最近一条入站消息 id(出站消息回贴话题用) */
50
+ private readonly lastInboundMessageId;
51
+ /** 普通群回复串 → 会话 topic 映射 */
52
+ private readonly chainTopics;
53
+ /** bot 已参与过的话题(内存;重启后由 Catalog 槽位绑定续上) */
54
+ private readonly botParticipatedTopics;
55
+ private readonly mentionRegistry;
56
+ private readonly pendingStreams;
57
+ /** 所有活动流的 AbortController(非 chat-scoped),disconnect 时统一 abort */
58
+ private readonly activeAborts;
59
+ /** 每 Session 一个持久事件订阅,单订阅路由 Turn/Run/Delivery */
60
+ private readonly sessionWatchers;
61
+ private readonly instanceId;
62
+ private readonly deliveryReconciler;
63
+ private inboundWebSocketState;
64
+ private disconnecting;
65
+ private sessionIngress?;
66
+ private cardKitWriter?;
67
+ private readonly cardUpdateSequences;
68
+ private readonly deliveryRetries;
69
+ /** turnIds abandoned after FEISHU_DELIVERY_RECONCILE_MAX_ATTEMPTS; reconcileDeliveries skips these until the delivery itself disappears. */
70
+ private readonly abandonedDeliveries;
71
+ constructor(options: FeishuBridgeOptions);
72
+ get isConnected(): boolean;
73
+ get orchestratorRef(): RunOrchestrator;
74
+ setSessionIngress(ingress: ChannelSessionIngress): void;
75
+ updateConfig(config: AppConfig): void;
76
+ private applyPolicyToChannel;
77
+ connect(): Promise<void>;
78
+ disconnect(): Promise<void>;
79
+ private recoverInterruptedStreams;
80
+ private chatKey;
81
+ private dispatchInboundMessage;
82
+ /**
83
+ * 消息所属会话 topic:话题群直接用 thread_id;普通群把「回复串」映射为
84
+ * topic——群根发起的对话延续群级会话,回复陌生消息(如告警推送)的串
85
+ * 自动成为独立话题、开启全新 session。
86
+ */
87
+ private resolveTopicId;
88
+ private handleMessage;
89
+ /** 组装话题/引用上下文并启动 agent 流式回复 */
90
+ private dispatchToAgent;
91
+ private cardHost;
92
+ /**
93
+ * Start a fresh provider session (same effect as /new) when the bound one is idle or
94
+ * its context is too full. Alert incidents are exempt: their alert data lives only in
95
+ * the first prompt of the topic session.
96
+ */
97
+ private rotateStaleSession;
98
+ private buildFullSlot;
99
+ private ensureSessionWatcher;
100
+ private reconcileDeliveries;
101
+ private submitAndStream;
102
+ private streamAgentReply;
103
+ private sendMarkdown;
104
+ /**
105
+ * 话题群出站消息定位:带 topicId 时回贴到该话题最近一条入站消息,
106
+ * 否则(或 Bridge 重启后话题内还没有新消息)落到群根/单聊。
107
+ */
108
+ private outboundSendOptions;
109
+ /** Transport adapter for the Bridge-owned alert monitor; always uses bot credentials. */
110
+ readAlertMessages(chatId: string, startTime: number, endTime: number, pageToken?: string): Promise<FeishuAlertPage>;
111
+ setAlertMessageReaction(messageId: string, emojiType: string, managed: string[]): Promise<string>;
112
+ notifyAlertOwner(chatId: string, rootId: string, approverOpenIds: string[], text: string): Promise<void>;
113
+ postAlertThreadNotice(chatId: string, rootId: string, text: string): Promise<void>;
114
+ alertMemberName(chatId: string, openId: string): Promise<string | undefined>;
115
+ resolveAlertThreadRoot(messageId: string): Promise<{
116
+ chatId: string;
117
+ rootId: string;
118
+ } | undefined>;
119
+ readAlertDone(messageId: string, after?: number): Promise<FeishuAlertReaction | undefined>;
120
+ cancelAlertInvestigation(chatId: string, rootId: string): Promise<void>;
121
+ isAlertActive(chatId: string, rootId: string): Promise<boolean>;
122
+ investigateAlert(alert: FeishuAlertMessage, approverOpenIds: string[], instructions: string): Promise<void>;
123
+ /** 出站 API:把本机文件作为文件消息发进聊天(供 Agent 内 fcb 调用) */
124
+ sendOutboundFile(chatId: string, rawPath: string, topicId?: string): Promise<string>;
125
+ /** 出站 API:把 markdown 消息发进聊天(供 Agent 内 fcb 调用) */
126
+ sendOutboundMarkdown(chatId: string, markdown: string, topicId?: string): Promise<void>;
127
+ sendOutboundMention(chatId: string, ref: string, text: string, topicId?: string): Promise<void>;
128
+ }
129
+ export declare function runDoctor(config: AppConfig, dataDir: string): Promise<Record<string, unknown>>;
130
+ //# sourceMappingURL=bridge.d.ts.map