@geminixiang/mikan 1.0.0-beta.45 → 1.0.0-beta.46

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 (422) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +12 -19
  3. package/dist/adapter.d.ts +1 -1
  4. package/dist/adapter.d.ts.map +1 -1
  5. package/dist/adapter.js.map +1 -1
  6. package/dist/adapters/discord/bot.d.ts +3 -1
  7. package/dist/adapters/discord/bot.d.ts.map +1 -1
  8. package/dist/adapters/discord/bot.js +143 -141
  9. package/dist/adapters/discord/bot.js.map +1 -1
  10. package/dist/adapters/discord/context.d.ts +2 -8
  11. package/dist/adapters/discord/context.d.ts.map +1 -1
  12. package/dist/adapters/discord/context.js +1 -1
  13. package/dist/adapters/discord/context.js.map +1 -1
  14. package/dist/adapters/discord/format.d.ts.map +1 -1
  15. package/dist/adapters/discord/format.js +2 -4
  16. package/dist/adapters/discord/format.js.map +1 -1
  17. package/dist/adapters/github/bot.d.ts.map +1 -1
  18. package/dist/adapters/github/bot.js +1 -4
  19. package/dist/adapters/github/bot.js.map +1 -1
  20. package/dist/adapters/github/context.d.ts +2 -9
  21. package/dist/adapters/github/context.d.ts.map +1 -1
  22. package/dist/adapters/github/context.js.map +1 -1
  23. package/dist/adapters/github/github-ops.d.ts +4 -17
  24. package/dist/adapters/github/github-ops.d.ts.map +1 -1
  25. package/dist/adapters/github/github-ops.js +17 -86
  26. package/dist/adapters/github/github-ops.js.map +1 -1
  27. package/dist/adapters/github/tool-pack.d.ts.map +1 -1
  28. package/dist/adapters/github/tool-pack.js +0 -1
  29. package/dist/adapters/github/tool-pack.js.map +1 -1
  30. package/dist/adapters/github/tools/checks.d.ts +0 -1
  31. package/dist/adapters/github/tools/checks.d.ts.map +1 -1
  32. package/dist/adapters/github/tools/checks.js +3 -22
  33. package/dist/adapters/github/tools/checks.js.map +1 -1
  34. package/dist/adapters/github/types.d.ts +0 -33
  35. package/dist/adapters/github/types.d.ts.map +1 -1
  36. package/dist/adapters/github/types.js.map +1 -1
  37. package/dist/adapters/progressive-renderer.d.ts.map +1 -1
  38. package/dist/adapters/progressive-renderer.js +311 -318
  39. package/dist/adapters/progressive-renderer.js.map +1 -1
  40. package/dist/adapters/slack/blocks.d.ts.map +1 -1
  41. package/dist/adapters/slack/blocks.js +1 -4
  42. package/dist/adapters/slack/blocks.js.map +1 -1
  43. package/dist/adapters/slack/bot.d.ts +12 -0
  44. package/dist/adapters/slack/bot.d.ts.map +1 -1
  45. package/dist/adapters/slack/bot.js +158 -178
  46. package/dist/adapters/slack/bot.js.map +1 -1
  47. package/dist/adapters/slack/context.d.ts +2 -8
  48. package/dist/adapters/slack/context.d.ts.map +1 -1
  49. package/dist/adapters/slack/context.js +1 -1
  50. package/dist/adapters/slack/context.js.map +1 -1
  51. package/dist/adapters/slack/response-lifecycle.d.ts.map +1 -1
  52. package/dist/adapters/slack/response-lifecycle.js +135 -123
  53. package/dist/adapters/slack/response-lifecycle.js.map +1 -1
  54. package/dist/adapters/slack/stream-limits.d.ts +1 -1
  55. package/dist/adapters/slack/stream-limits.js +1 -1
  56. package/dist/adapters/slack/stream-limits.js.map +1 -1
  57. package/dist/adapters/slack/types.d.ts +4 -0
  58. package/dist/adapters/slack/types.d.ts.map +1 -1
  59. package/dist/adapters/slack/types.js.map +1 -1
  60. package/dist/adapters/telegram/context.d.ts +2 -8
  61. package/dist/adapters/telegram/context.d.ts.map +1 -1
  62. package/dist/adapters/telegram/context.js +1 -2
  63. package/dist/adapters/telegram/context.js.map +1 -1
  64. package/dist/adapters/types.d.ts +11 -5
  65. package/dist/adapters/types.d.ts.map +1 -1
  66. package/dist/adapters/types.js.map +1 -1
  67. package/dist/agent/catalog.d.ts +6 -18
  68. package/dist/agent/catalog.d.ts.map +1 -1
  69. package/dist/agent/catalog.js +19 -155
  70. package/dist/agent/catalog.js.map +1 -1
  71. package/dist/agent/execution.d.ts +0 -7
  72. package/dist/agent/execution.d.ts.map +1 -1
  73. package/dist/agent/execution.js +23 -21
  74. package/dist/agent/execution.js.map +1 -1
  75. package/dist/agent/presenter.d.ts +7 -9
  76. package/dist/agent/presenter.d.ts.map +1 -1
  77. package/dist/agent/presenter.js +355 -357
  78. package/dist/agent/presenter.js.map +1 -1
  79. package/dist/agent/prompt.d.ts +5 -12
  80. package/dist/agent/prompt.d.ts.map +1 -1
  81. package/dist/agent/prompt.js +56 -81
  82. package/dist/agent/prompt.js.map +1 -1
  83. package/dist/agent/runner.d.ts +0 -7
  84. package/dist/agent/runner.d.ts.map +1 -1
  85. package/dist/agent/runner.js +255 -308
  86. package/dist/agent/runner.js.map +1 -1
  87. package/dist/agent/types.d.ts +21 -17
  88. package/dist/agent/types.d.ts.map +1 -1
  89. package/dist/agent/types.js +0 -1
  90. package/dist/agent/types.js.map +1 -1
  91. package/dist/cli/boot.d.ts.map +1 -1
  92. package/dist/cli/boot.js +7 -10
  93. package/dist/cli/boot.js.map +1 -1
  94. package/dist/cli/onboard.d.ts +10 -0
  95. package/dist/cli/onboard.d.ts.map +1 -0
  96. package/dist/cli/onboard.js +237 -0
  97. package/dist/cli/onboard.js.map +1 -0
  98. package/dist/cli/types.d.ts +8 -3
  99. package/dist/cli/types.d.ts.map +1 -1
  100. package/dist/cli/types.js.map +1 -1
  101. package/dist/commands/auto-reply.d.ts.map +1 -1
  102. package/dist/commands/auto-reply.js +5 -12
  103. package/dist/commands/auto-reply.js.map +1 -1
  104. package/dist/commands/manifest.d.ts.map +1 -1
  105. package/dist/commands/manifest.js +9 -16
  106. package/dist/commands/manifest.js.map +1 -1
  107. package/dist/commands/new.d.ts.map +1 -1
  108. package/dist/commands/new.js +15 -10
  109. package/dist/commands/new.js.map +1 -1
  110. package/dist/commands/registry.d.ts.map +1 -1
  111. package/dist/commands/registry.js +0 -2
  112. package/dist/commands/registry.js.map +1 -1
  113. package/dist/commands/sandbox.d.ts.map +1 -1
  114. package/dist/commands/sandbox.js +89 -70
  115. package/dist/commands/sandbox.js.map +1 -1
  116. package/dist/commands/session-view.js +9 -2
  117. package/dist/commands/session-view.js.map +1 -1
  118. package/dist/commands/types.d.ts +4 -3
  119. package/dist/commands/types.d.ts.map +1 -1
  120. package/dist/commands/types.js.map +1 -1
  121. package/dist/config.d.ts +13 -17
  122. package/dist/config.d.ts.map +1 -1
  123. package/dist/config.js +39 -37
  124. package/dist/config.js.map +1 -1
  125. package/dist/dream/index.d.ts +20 -0
  126. package/dist/dream/index.d.ts.map +1 -0
  127. package/dist/dream/index.js +253 -0
  128. package/dist/dream/index.js.map +1 -0
  129. package/dist/dream/types.d.ts +30 -0
  130. package/dist/dream/types.d.ts.map +1 -0
  131. package/dist/dream/types.js.map +1 -0
  132. package/dist/env-manifest.d.ts.map +1 -1
  133. package/dist/env-manifest.js +2 -34
  134. package/dist/env-manifest.js.map +1 -1
  135. package/dist/execution-resolver.d.ts +9 -2
  136. package/dist/execution-resolver.d.ts.map +1 -1
  137. package/dist/execution-resolver.js +26 -27
  138. package/dist/execution-resolver.js.map +1 -1
  139. package/dist/harness/event-format.d.ts +1 -2
  140. package/dist/harness/event-format.d.ts.map +1 -1
  141. package/dist/harness/event-format.js +9 -15
  142. package/dist/harness/event-format.js.map +1 -1
  143. package/dist/harness/index.d.ts +1 -7
  144. package/dist/harness/index.d.ts.map +1 -1
  145. package/dist/harness/index.js +0 -4
  146. package/dist/harness/index.js.map +1 -1
  147. package/dist/harness/models.d.ts.map +1 -1
  148. package/dist/harness/models.js +15 -35
  149. package/dist/harness/models.js.map +1 -1
  150. package/dist/harness/runner.d.ts +7 -16
  151. package/dist/harness/runner.d.ts.map +1 -1
  152. package/dist/harness/runner.js +13 -131
  153. package/dist/harness/runner.js.map +1 -1
  154. package/dist/harness/session-store.d.ts +1 -1
  155. package/dist/harness/session-store.d.ts.map +1 -1
  156. package/dist/harness/session-store.js +1 -1
  157. package/dist/harness/session-store.js.map +1 -1
  158. package/dist/harness/subagent-runner.d.ts +2 -2
  159. package/dist/harness/subagent-runner.d.ts.map +1 -1
  160. package/dist/harness/subagent-runner.js +157 -162
  161. package/dist/harness/subagent-runner.js.map +1 -1
  162. package/dist/harness/types.d.ts +1 -13
  163. package/dist/harness/types.d.ts.map +1 -1
  164. package/dist/harness/types.js.map +1 -1
  165. package/dist/index.d.ts +3 -9
  166. package/dist/index.d.ts.map +1 -1
  167. package/dist/index.js +1 -5
  168. package/dist/index.js.map +1 -1
  169. package/dist/main.js +31 -212
  170. package/dist/main.js.map +1 -1
  171. package/dist/mcp/catalog.d.ts +5 -0
  172. package/dist/mcp/catalog.d.ts.map +1 -0
  173. package/dist/mcp/catalog.js +135 -0
  174. package/dist/mcp/catalog.js.map +1 -0
  175. package/dist/mcp/loader.d.ts.map +1 -1
  176. package/dist/mcp/loader.js +3 -6
  177. package/dist/mcp/loader.js.map +1 -1
  178. package/dist/mcp/types.d.ts +22 -0
  179. package/dist/mcp/types.d.ts.map +1 -1
  180. package/dist/mcp/types.js.map +1 -1
  181. package/dist/office/index.d.ts +136 -8
  182. package/dist/office/index.d.ts.map +1 -1
  183. package/dist/office/index.js +1050 -9
  184. package/dist/office/index.js.map +1 -1
  185. package/dist/office/types.d.ts +19 -1
  186. package/dist/office/types.d.ts.map +1 -1
  187. package/dist/office/types.js.map +1 -1
  188. package/dist/packages/index.d.ts +168 -5
  189. package/dist/packages/index.d.ts.map +1 -1
  190. package/dist/packages/index.js +749 -5
  191. package/dist/packages/index.js.map +1 -1
  192. package/dist/packages/types.d.ts +1 -5
  193. package/dist/packages/types.d.ts.map +1 -1
  194. package/dist/packages/types.js.map +1 -1
  195. package/dist/provisioner.d.ts +2 -9
  196. package/dist/provisioner.d.ts.map +1 -1
  197. package/dist/provisioner.js +3 -12
  198. package/dist/provisioner.js.map +1 -1
  199. package/dist/runtime/conversation-runtime.d.ts.map +1 -1
  200. package/dist/runtime/conversation-runtime.js +117 -380
  201. package/dist/runtime/conversation-runtime.js.map +1 -1
  202. package/dist/runtime/session-lifecycle.d.ts +32 -18
  203. package/dist/runtime/session-lifecycle.d.ts.map +1 -1
  204. package/dist/runtime/session-lifecycle.js +159 -46
  205. package/dist/runtime/session-lifecycle.js.map +1 -1
  206. package/dist/runtime/types.d.ts +4 -26
  207. package/dist/runtime/types.d.ts.map +1 -1
  208. package/dist/runtime/types.js.map +1 -1
  209. package/dist/sandbox/cloudflare.d.ts.map +1 -1
  210. package/dist/sandbox/cloudflare.js +2 -3
  211. package/dist/sandbox/cloudflare.js.map +1 -1
  212. package/dist/sandbox/container.d.ts +0 -1
  213. package/dist/sandbox/container.d.ts.map +1 -1
  214. package/dist/sandbox/container.js +2 -3
  215. package/dist/sandbox/container.js.map +1 -1
  216. package/dist/sandbox/host.d.ts.map +1 -1
  217. package/dist/sandbox/host.js +4 -2
  218. package/dist/sandbox/host.js.map +1 -1
  219. package/dist/sandbox/identity.d.ts +10 -19
  220. package/dist/sandbox/identity.d.ts.map +1 -1
  221. package/dist/sandbox/identity.js +8 -8
  222. package/dist/sandbox/identity.js.map +1 -1
  223. package/dist/sandbox/index.d.ts +7 -10
  224. package/dist/sandbox/index.d.ts.map +1 -1
  225. package/dist/sandbox/index.js +45 -16
  226. package/dist/sandbox/index.js.map +1 -1
  227. package/dist/sandbox/types.d.ts +13 -45
  228. package/dist/sandbox/types.d.ts.map +1 -1
  229. package/dist/sandbox/types.js.map +1 -1
  230. package/dist/sandbox/utils.d.ts +5 -0
  231. package/dist/sandbox/utils.d.ts.map +1 -1
  232. package/dist/sandbox/utils.js +10 -0
  233. package/dist/sandbox/utils.js.map +1 -1
  234. package/dist/sessions/chat-history-sync.d.ts +1 -3
  235. package/dist/sessions/chat-history-sync.d.ts.map +1 -1
  236. package/dist/sessions/chat-history-sync.js +58 -11
  237. package/dist/sessions/chat-history-sync.js.map +1 -1
  238. package/dist/sessions/migrate-v3.d.ts +2 -5
  239. package/dist/sessions/migrate-v3.d.ts.map +1 -1
  240. package/dist/sessions/migrate-v3.js +17 -1
  241. package/dist/sessions/migrate-v3.js.map +1 -1
  242. package/dist/sessions/store.d.ts +5 -6
  243. package/dist/sessions/store.d.ts.map +1 -1
  244. package/dist/sessions/store.js +62 -2
  245. package/dist/sessions/store.js.map +1 -1
  246. package/dist/sessions/types.d.ts +9 -0
  247. package/dist/sessions/types.d.ts.map +1 -1
  248. package/dist/sessions/types.js.map +1 -1
  249. package/dist/tools/bash.d.ts.map +1 -1
  250. package/dist/tools/bash.js +2 -10
  251. package/dist/tools/bash.js.map +1 -1
  252. package/dist/tools/read.js +2 -2
  253. package/dist/tools/read.js.map +1 -1
  254. package/dist/tools/sandbox.d.ts.map +1 -1
  255. package/dist/tools/sandbox.js +2 -3
  256. package/dist/tools/sandbox.js.map +1 -1
  257. package/dist/tools/subagent.d.ts +1 -1
  258. package/dist/tools/subagent.js.map +1 -1
  259. package/dist/types.d.ts +38 -127
  260. package/dist/types.d.ts.map +1 -1
  261. package/dist/types.js.map +1 -1
  262. package/dist/vault/index.d.ts +9 -2
  263. package/dist/vault/index.d.ts.map +1 -1
  264. package/dist/vault/index.js +29 -5
  265. package/dist/vault/index.js.map +1 -1
  266. package/dist/web/admin/portal.d.ts +12 -1
  267. package/dist/web/admin/portal.d.ts.map +1 -1
  268. package/dist/web/admin/portal.js +437 -422
  269. package/dist/web/admin/portal.js.map +1 -1
  270. package/dist/web/admin/types.d.ts +2 -2
  271. package/dist/web/admin/types.d.ts.map +1 -1
  272. package/dist/web/admin/types.js.map +1 -1
  273. package/dist/web/login/portal.d.ts +7 -1
  274. package/dist/web/login/portal.d.ts.map +1 -1
  275. package/dist/web/login/portal.js +143 -78
  276. package/dist/web/login/portal.js.map +1 -1
  277. package/dist/web/portal-shell.d.ts +1 -0
  278. package/dist/web/portal-shell.d.ts.map +1 -1
  279. package/dist/web/portal-shell.js +12 -1
  280. package/dist/web/portal-shell.js.map +1 -1
  281. package/dist/web/server.d.ts +3 -3
  282. package/dist/web/server.d.ts.map +1 -1
  283. package/dist/web/server.js.map +1 -1
  284. package/dist/web/session-view/portal.d.ts +8 -1
  285. package/dist/web/session-view/portal.d.ts.map +1 -1
  286. package/dist/web/session-view/portal.js +609 -132
  287. package/dist/web/session-view/portal.js.map +1 -1
  288. package/dist/web/session-view/types.d.ts +8 -0
  289. package/dist/web/session-view/types.d.ts.map +1 -1
  290. package/dist/web/session-view/types.js.map +1 -1
  291. package/dist/workspace-projection/index.d.ts +14 -2
  292. package/dist/workspace-projection/index.d.ts.map +1 -1
  293. package/dist/workspace-projection/index.js +102 -14
  294. package/dist/workspace-projection/index.js.map +1 -1
  295. package/dist/workspace-projection/types.d.ts +14 -1
  296. package/dist/workspace-projection/types.d.ts.map +1 -1
  297. package/dist/workspace-projection/types.js.map +1 -1
  298. package/package.json +3 -5
  299. package/dist/adapters/github/cloudbuild.d.ts +0 -19
  300. package/dist/adapters/github/cloudbuild.d.ts.map +0 -1
  301. package/dist/adapters/github/cloudbuild.js +0 -71
  302. package/dist/adapters/github/cloudbuild.js.map +0 -1
  303. package/dist/adapters/github/gcp-auth.d.ts +0 -28
  304. package/dist/adapters/github/gcp-auth.d.ts.map +0 -1
  305. package/dist/adapters/github/gcp-auth.js +0 -196
  306. package/dist/adapters/github/gcp-auth.js.map +0 -1
  307. package/dist/agent/index.d.ts +0 -9
  308. package/dist/agent/index.d.ts.map +0 -1
  309. package/dist/agent/index.js +0 -8
  310. package/dist/agent/index.js.map +0 -1
  311. package/dist/cli/ext-dev.d.ts +0 -2
  312. package/dist/cli/ext-dev.d.ts.map +0 -1
  313. package/dist/cli/ext-dev.js +0 -188
  314. package/dist/cli/ext-dev.js.map +0 -1
  315. package/dist/cli/ext.d.ts +0 -2
  316. package/dist/cli/ext.d.ts.map +0 -1
  317. package/dist/cli/ext.js +0 -324
  318. package/dist/cli/ext.js.map +0 -1
  319. package/dist/commands/extensions.d.ts +0 -26
  320. package/dist/commands/extensions.d.ts.map +0 -1
  321. package/dist/commands/extensions.js +0 -103
  322. package/dist/commands/extensions.js.map +0 -1
  323. package/dist/extension-schedules.d.ts +0 -31
  324. package/dist/extension-schedules.d.ts.map +0 -1
  325. package/dist/extension-schedules.js +0 -229
  326. package/dist/extension-schedules.js.map +0 -1
  327. package/dist/harness/auth.d.ts +0 -17
  328. package/dist/harness/auth.d.ts.map +0 -1
  329. package/dist/harness/auth.js +0 -92
  330. package/dist/harness/auth.js.map +0 -1
  331. package/dist/harness/extensions/loader.d.ts +0 -40
  332. package/dist/harness/extensions/loader.d.ts.map +0 -1
  333. package/dist/harness/extensions/loader.js +0 -723
  334. package/dist/harness/extensions/loader.js.map +0 -1
  335. package/dist/harness/extensions/registry.d.ts +0 -155
  336. package/dist/harness/extensions/registry.d.ts.map +0 -1
  337. package/dist/harness/extensions/registry.js +0 -420
  338. package/dist/harness/extensions/registry.js.map +0 -1
  339. package/dist/harness/extensions/types.d.ts +0 -665
  340. package/dist/harness/extensions/types.d.ts.map +0 -1
  341. package/dist/harness/extensions/types.js.map +0 -1
  342. package/dist/office/address.d.ts +0 -31
  343. package/dist/office/address.d.ts.map +0 -1
  344. package/dist/office/address.js +0 -113
  345. package/dist/office/address.js.map +0 -1
  346. package/dist/office/layout.d.ts +0 -27
  347. package/dist/office/layout.d.ts.map +0 -1
  348. package/dist/office/layout.js +0 -97
  349. package/dist/office/layout.js.map +0 -1
  350. package/dist/office/migration.d.ts +0 -44
  351. package/dist/office/migration.d.ts.map +0 -1
  352. package/dist/office/migration.js +0 -255
  353. package/dist/office/migration.js.map +0 -1
  354. package/dist/office/registry.d.ts +0 -75
  355. package/dist/office/registry.d.ts.map +0 -1
  356. package/dist/office/registry.js +0 -646
  357. package/dist/office/registry.js.map +0 -1
  358. package/dist/packages/admin.d.ts +0 -17
  359. package/dist/packages/admin.d.ts.map +0 -1
  360. package/dist/packages/admin.js +0 -98
  361. package/dist/packages/admin.js.map +0 -1
  362. package/dist/packages/inspect.d.ts +0 -11
  363. package/dist/packages/inspect.d.ts.map +0 -1
  364. package/dist/packages/inspect.js +0 -98
  365. package/dist/packages/inspect.js.map +0 -1
  366. package/dist/packages/materialize.d.ts +0 -40
  367. package/dist/packages/materialize.d.ts.map +0 -1
  368. package/dist/packages/materialize.js +0 -297
  369. package/dist/packages/materialize.js.map +0 -1
  370. package/dist/packages/resolve.d.ts +0 -25
  371. package/dist/packages/resolve.d.ts.map +0 -1
  372. package/dist/packages/resolve.js +0 -208
  373. package/dist/packages/resolve.js.map +0 -1
  374. package/dist/packages/source.d.ts +0 -39
  375. package/dist/packages/source.d.ts.map +0 -1
  376. package/dist/packages/source.js +0 -189
  377. package/dist/packages/source.js.map +0 -1
  378. package/dist/sandbox/errors.d.ts +0 -6
  379. package/dist/sandbox/errors.d.ts.map +0 -1
  380. package/dist/sandbox/errors.js +0 -11
  381. package/dist/sandbox/errors.js.map +0 -1
  382. package/dist/sandbox/firecracker.d.ts +0 -18
  383. package/dist/sandbox/firecracker.d.ts.map +0 -1
  384. package/dist/sandbox/firecracker.js +0 -223
  385. package/dist/sandbox/firecracker.js.map +0 -1
  386. package/dist/sandbox/gondolin.d.ts +0 -57
  387. package/dist/sandbox/gondolin.d.ts.map +0 -1
  388. package/dist/sandbox/gondolin.js +0 -764
  389. package/dist/sandbox/gondolin.js.map +0 -1
  390. package/dist/sandbox/image.d.ts +0 -3
  391. package/dist/sandbox/image.d.ts.map +0 -1
  392. package/dist/sandbox/image.js +0 -29
  393. package/dist/sandbox/image.js.map +0 -1
  394. package/dist/sessions/conversation-log.d.ts +0 -9
  395. package/dist/sessions/conversation-log.d.ts.map +0 -1
  396. package/dist/sessions/conversation-log.js +0 -50
  397. package/dist/sessions/conversation-log.js.map +0 -1
  398. package/dist/sessions/rotation.d.ts +0 -2
  399. package/dist/sessions/rotation.d.ts.map +0 -1
  400. package/dist/sessions/rotation.js +0 -41
  401. package/dist/sessions/rotation.js.map +0 -1
  402. package/dist/vault/disabled.d.ts +0 -9
  403. package/dist/vault/disabled.d.ts.map +0 -1
  404. package/dist/vault/disabled.js +0 -25
  405. package/dist/vault/disabled.js.map +0 -1
  406. package/dist/web/admin/store.d.ts +0 -13
  407. package/dist/web/admin/store.d.ts.map +0 -1
  408. package/dist/web/admin/store.js +0 -14
  409. package/dist/web/admin/store.js.map +0 -1
  410. package/dist/web/login/store.d.ts +0 -8
  411. package/dist/web/login/store.d.ts.map +0 -1
  412. package/dist/web/login/store.js +0 -15
  413. package/dist/web/login/store.js.map +0 -1
  414. package/dist/web/session-view/service.d.ts +0 -6
  415. package/dist/web/session-view/service.d.ts.map +0 -1
  416. package/dist/web/session-view/service.js +0 -517
  417. package/dist/web/session-view/service.js.map +0 -1
  418. package/dist/web/session-view/store.d.ts +0 -8
  419. package/dist/web/session-view/store.d.ts.map +0 -1
  420. package/dist/web/session-view/store.js +0 -15
  421. package/dist/web/session-view/store.js.map +0 -1
  422. /package/dist/{harness/extensions → dream}/types.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"github-ops.js","sourceRoot":"","sources":["../../../src/adapters/github/github-ops.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EACL,oBAAoB,EACpB,6BAA6B,EAC7B,kBAAkB,EAClB,cAAc,EACd,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAc5D,+DAA+D;AAC/D,MAAM,aAAa,GAAG,KAAK,CAAC;AAE5B,SAAS,eAAe,CAAC,OAAe;IACtC,OAAO,OAAO,CAAC,MAAM,GAAG,aAAa;QACnC,CAAC,CAAC,2BAA2B,aAAa,YAAY,OAAO,CAAC,KAAK,CA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QACD,MAAM,GAAG,GAAG,yBAAyB,CAAC,cAAc,CAAC,CAAC;QACtD,IAAI,OAAe,CAAC;QACpB,IAAI,CAAC;YACH,OAAO,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QACvF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,cAAc,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACxD,MAAM,IAAI,KAAK,CACb,iCAAiC,KAAK,gDAAgD;oBACpF,oFAAoF;oBACpF,oFAAoF;oBACpF,iDAAiD,EACnD,EAAE,KAAK,EAAE,GAAG,EAAE,CACf,CAAC;YACJ,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;QACD,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;CACF","sourcesContent":["import { existsSync } from \"node:fs\";\nimport * as log from \"../../log.js\";\nimport type { GithubClient } from \"./client.js\";\nimport { GithubApiError, GITHUB_MAX_COMMENT_LENGTH, githubRetry } from \"./client.js\";\nimport {\n CLOUD_BUILD_APP_SLUG,\n CloudBuildLogUnavailableError,\n fetchCloudBuildLog,\n isCloudBuildId,\n projectFromDetailsUrl,\n} from \"./cloudbuild.js\";\nimport { parseGithubConversationId } from \"./ids.js\";\nimport { conversationRepoDir, GITHUB_PUSH_BRANCH_PATTERN, pushBranch, syncRepo } from \"./repo.js\";\nimport { createOfficeAddress } from \"../../office/index.js\";\nimport type { Workspace } from \"../../office/index.js\";\nimport type {\n GithubBotConfig,\n GithubCheckSummary,\n GithubConversationRef,\n GithubIssueRequest,\n GithubPrRequest,\n GithubPrResult,\n GithubReadRequest,\n GithubReadResult,\n PlatformGithubOps,\n} from \"./types.js\";\n\n/** Both CI log modes tail-truncate to this many characters. */\nconst MAX_LOG_CHARS = 20000;\n\nfunction truncateLogTail(logText: string): string {\n return logText.length > MAX_LOG_CHARS\n ? `…(truncated to the last ${MAX_LOG_CHARS} chars)\\n${logText.slice(-MAX_LOG_CHARS)}`\n : logText;\n}\n\n/** Whether the conversation's issue is a PR, for callers where the triggering\n * item didn't carry that knowledge. Errs toward plain issue. */\nexport async function fetchIsPr(\n client: GithubClient,\n ref: GithubConversationRef,\n): Promise<boolean> {\n try {\n const issue = await githubRetry(() => client.getIssue(ref.owner, ref.repo, ref.number));\n return Boolean(issue.pull_request);\n } catch {\n return false;\n }\n}\n\n/**\n * The PR's head branch name when it lives in this repo — that is the name\n * the local checkout should carry, so committing on it and calling\n * github_pr pushes back to the PR itself instead of opening a new one.\n * Fork heads (unpushable with the repo-scoped token) and failed lookups\n * return undefined; callers then fall back to the synthetic pr-<n>.\n */\nexport async function fetchPrHeadBranch(\n client: GithubClient,\n ref: GithubConversationRef,\n): Promise<string | undefined> {\n try {\n const pr = await githubRetry(() => client.getPullRequest(ref.owner, ref.repo, ref.number));\n const sameRepo =\n pr.head?.repo?.full_name?.toLowerCase() === `${ref.owner}/${ref.repo}`.toLowerCase();\n return sameRepo ? pr.head?.ref : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Host-side backend of the github_* tool pack (`PlatformGithubOps`),\n * standalone from the messaging bot: it needs the API client, the\n * conversation working dir, and optional Cloud Build access — not the poll\n * loop, queues, or trigger gate. Tokens are minted per call, scoped to the\n * conversation's repo, and never enter the sandbox.\n */\nexport class GithubOps implements PlatformGithubOps {\n /** Cloud Build ids seen in getChecks summaries → their GCP project. */\n private buildRef = new Map<string, { project: string }>();\n\n constructor(\n private readonly client: GithubClient,\n private readonly config: {\n workspace: Workspace;\n cloudBuild?: GithubBotConfig[\"cloudBuild\"];\n },\n ) {}\n\n private repoDir(conversationId: string): string {\n return conversationRepoDir(\n this.config.workspace.office(createOfficeAddress(\"github\", conversationId)),\n );\n }\n\n /**\n * Backs the `github_pr` tool: push a `pi/*` branch the agent prepared in\n * the conversation's clone, then open a pull request as the App. The write\n * token is minted per call, scoped to this one repo, and never enters the\n * sandbox.\n */\n async pushAndCreatePr(conversationId: string, request: GithubPrRequest): Promise<GithubPrResult> {\n const ref = parseGithubConversationId(conversationId);\n const dir = this.repoDir(conversationId);\n if (!existsSync(dir)) {\n throw new Error(\"This conversation has no ./repo clone to push from.\");\n }\n if (!GITHUB_PUSH_BRANCH_PATTERN.test(request.branch)) {\n throw new Error(\n `Branch '${request.branch}' is not pushable: name it pi/<something> (e.g. pi/fix-${ref.number}).`,\n );\n }\n const repository = await githubRetry(() => this.client.getRepository(ref.owner, ref.repo));\n const base = request.base ?? repository.default_branch;\n const token = await this.client.createScopedInstallationToken(ref.repo, {\n contents: \"write\",\n pull_requests: \"write\",\n });\n await pushBranch({ dir, branch: request.branch, token });\n try {\n const pr = await githubRetry(() =>\n this.client.createPullRequest(ref.owner, ref.repo, {\n title: request.title,\n head: request.branch,\n base,\n body: request.body,\n draft: request.draft,\n }),\n );\n log.logInfo(`[${conversationId}] Opened PR #${pr.number}: ${pr.html_url}`);\n return { number: pr.number, url: pr.html_url };\n } catch (err) {\n // Idempotency: pushing more commits to a branch that already has an\n // open PR updates that PR; the create call then 422s. Surface the\n // existing PR instead of failing the fix-CI-push-again loop.\n if (\n err instanceof GithubApiError &&\n err.status === 422 &&\n /already exists/i.test(err.message)\n ) {\n const existing = await this.client.findOpenPullRequestByBranch(\n ref.owner,\n ref.repo,\n request.branch,\n );\n if (existing) {\n log.logInfo(\n `[${conversationId}] Pushed to existing PR #${existing.number}: ${existing.html_url}`,\n );\n return { number: existing.number, url: existing.html_url, updatedExisting: true };\n }\n }\n throw err;\n }\n }\n\n /**\n * Backs the `github_checks` tool: CI check runs for a branch the agent\n * pushed, or for the conversation's PR head when no branch is given.\n */\n async getChecks(conversationId: string, branch?: string): Promise<GithubCheckSummary[]> {\n const ref = parseGithubConversationId(conversationId);\n let target = branch;\n if (!target) {\n let pr;\n try {\n pr = await githubRetry(() => this.client.getPullRequest(ref.owner, ref.repo, ref.number));\n } catch {\n pr = null;\n }\n if (!pr?.head) {\n throw new Error(\n \"This conversation is not a pull request — pass the branch whose checks you want.\",\n );\n }\n target = pr.head.sha;\n }\n const runs = await githubRetry(() => this.client.listCheckRuns(ref.owner, ref.repo, target));\n return runs.map((run) => {\n const externalId = run.external_id?.trim() || null;\n let buildLogAvailable = false;\n // Cloud Build runs carry their build UUID in external_id and the GCP\n // project in details_url. Remember project-by-build so getBuildLog only\n // serves builds the agent actually saw on this repo's checks.\n if (\n this.config.cloudBuild &&\n run.app?.slug === CLOUD_BUILD_APP_SLUG &&\n externalId &&\n isCloudBuildId(externalId)\n ) {\n const project =\n projectFromDetailsUrl(run.details_url) ?? this.config.cloudBuild.projectFallback;\n if (project) {\n this.rememberBuild(externalId, project);\n buildLogAvailable = true;\n }\n }\n return {\n id: run.id,\n name: run.name,\n status: run.status,\n conclusion: run.conclusion,\n url: run.html_url,\n appSlug: run.app?.slug ?? null,\n outputSummary: run.output?.summary?.trim() ? run.output.summary.slice(0, 500) : null,\n externalId,\n buildLogAvailable,\n };\n });\n }\n\n private rememberBuild(buildId: string, project: string): void {\n // Insertion-ordered Map as a small LRU: re-insert on touch, prune oldest.\n this.buildRef.delete(buildId);\n this.buildRef.set(buildId, { project });\n if (this.buildRef.size > 200) {\n const oldest = this.buildRef.keys().next().value;\n if (oldest !== undefined) this.buildRef.delete(oldest);\n }\n }\n\n /**\n * Backs the Cloud Build log mode of `github_checks`. GCP credentials stay\n * host-side (ADC via GOOGLE_APPLICATION_CREDENTIALS — e.g. a Workload\n * Identity Federation external_account file); the build must have appeared\n * in a github_checks summary first, which is also where its project is\n * learned. Unreadable logs degrade to the console url, never a dead end.\n */\n async getBuildLog(conversationId: string, buildId: string): Promise<string> {\n if (!this.config.cloudBuild) {\n throw new Error(\n \"Cloud Build log access is not configured on this host (no GCP credentials).\",\n );\n }\n const known = this.buildRef.get(buildId);\n if (!known) {\n throw new Error(\n `Unknown build id ${buildId}: run github_checks first and take a [build …] id from ` +\n `the summary.`,\n );\n }\n let logText: string;\n try {\n logText = await fetchCloudBuildLog({\n tokenProvider: this.config.cloudBuild.tokenProvider,\n project: known.project,\n buildId,\n });\n } catch (err) {\n if (err instanceof CloudBuildLogUnavailableError) {\n throw new Error(\n `${err.message}${err.consoleUrl ? ` Console: ${err.consoleUrl}` : \"\"} Use the check's ` +\n `summary/url from github_checks, or reproduce the failure locally in ./repo.`,\n { cause: err },\n );\n }\n throw err;\n }\n return truncateLogTail(logText);\n }\n\n /**\n * Backs the `github_sync` tool: refresh the conversation's ./repo clone\n * from origin with an ephemeral read token. Fetch-only when moving the\n * checkout could lose agent work; the formatted report tells the agent\n * what happened and what to do next.\n */\n async syncRepo(conversationId: string, branch?: string): Promise<string> {\n const ref = parseGithubConversationId(conversationId);\n const dir = this.repoDir(conversationId);\n if (!existsSync(dir)) {\n throw new Error(\"This conversation has no ./repo clone to sync.\");\n }\n const token = await this.client.createScopedInstallationToken(ref.repo, {\n contents: \"read\",\n });\n let prNumber: number | undefined;\n let prHeadBranch: string | undefined;\n let defaultBranch: string | undefined;\n if (!branch) {\n if (await fetchIsPr(this.client, ref)) {\n prNumber = ref.number;\n prHeadBranch = await fetchPrHeadBranch(this.client, ref);\n } else {\n const repository = await githubRetry(() => this.client.getRepository(ref.owner, ref.repo));\n defaultBranch = repository.default_branch;\n }\n }\n const result = await syncRepo({ dir, token, branch, prNumber, prHeadBranch, defaultBranch });\n\n if (result.updatedCheckout) {\n return `Updated ./repo: branch ${result.target} is now at ${result.fetchedSha.slice(0, 12)}.`;\n }\n const reasons: string[] = [];\n if (result.currentBranch !== result.target) {\n reasons.push(`the checkout is on '${result.currentBranch}', not '${result.target}'`);\n }\n if (result.dirty) {\n reasons.push(\"the working tree has uncommitted changes\");\n }\n if (result.localCommits > 0) {\n reasons.push(`'${result.target}' has ${result.localCommits} local commit(s) not on origin`);\n }\n return (\n `Fetched ${result.target} to FETCH_HEAD (${result.fetchedSha.slice(0, 12)}) but left the ` +\n `checkout alone: ${reasons.join(\"; \")}. Merge or rebase FETCH_HEAD yourself ` +\n `(e.g. git merge FETCH_HEAD), or commit your work to a pi/* branch first.`\n );\n }\n\n /**\n * Backs the `github_read` tool: PR/issue metadata the ./repo clone cannot\n * provide (diff stats, review state, other issues in the repo). Owner/repo\n * always come from the conversation id, so reads never leave this repo.\n */\n async readGithub(conversationId: string, request: GithubReadRequest): Promise<GithubReadResult> {\n const ref = parseGithubConversationId(conversationId);\n const number = request.number ?? ref.number;\n switch (request.action) {\n case \"pr\": {\n const pr = await githubRetry(() => this.client.getPullRequest(ref.owner, ref.repo, number));\n return { kind: \"pr\", pr };\n }\n case \"pr_files\": {\n const files = await githubRetry(() =>\n this.client.listPullRequestFiles(ref.owner, ref.repo, number),\n );\n return { kind: \"pr_files\", files };\n }\n case \"pr_reviews\": {\n const [reviews, threads] = await Promise.all([\n githubRetry(() => this.client.listPullRequestReviews(ref.owner, ref.repo, number)),\n githubRetry(() => this.client.listPullReviewComments(ref.owner, ref.repo, number)),\n ]);\n return { kind: \"pr_reviews\", reviews, threads };\n }\n case \"issue\": {\n const issue = await githubRetry(() => this.client.getIssue(ref.owner, ref.repo, number));\n return { kind: \"issue\", issue };\n }\n case \"comments\": {\n const comments = await githubRetry(() =>\n this.client.listIssueComments(ref.owner, ref.repo, number),\n );\n return { kind: \"comments\", comments };\n }\n case \"list\": {\n const issues = await githubRetry(() =>\n this.client.listIssues(ref.owner, ref.repo, {\n state: request.state,\n labels: request.labels,\n creator: request.creator,\n }),\n );\n return { kind: \"list\", issues };\n }\n default:\n throw new Error(`Unknown github_read action: ${String(request.action)}`);\n }\n }\n\n /**\n * Backs the `github_issue` tool: labels, assignees, and open/closed state\n * on any issue of this conversation's repo (triage). Same-repo by\n * construction — owner/repo come from the conversation id; the action enum\n * is closed, so lock/delete/transfer cannot be expressed at all.\n */\n async manageIssue(conversationId: string, request: GithubIssueRequest): Promise<string> {\n const ref = parseGithubConversationId(conversationId);\n const number = request.number ?? ref.number;\n try {\n switch (request.action) {\n case \"add_labels\": {\n if (!request.labels?.length) {\n throw new Error(\"add_labels requires a non-empty labels array.\");\n }\n await githubRetry(() =>\n this.client.addIssueLabels(ref.owner, ref.repo, number, request.labels!),\n );\n return `Added label(s) ${request.labels.join(\", \")} to #${number}.`;\n }\n case \"remove_label\": {\n if (!request.label) {\n throw new Error(\"remove_label requires a label name.\");\n }\n await githubRetry(() =>\n this.client.removeIssueLabel(ref.owner, ref.repo, number, request.label!),\n );\n return `Removed label ${request.label} from #${number}.`;\n }\n case \"add_assignees\": {\n if (!request.assignees?.length) {\n throw new Error(\"add_assignees requires a non-empty assignees array.\");\n }\n await githubRetry(() =>\n this.client.addIssueAssignees(ref.owner, ref.repo, number, request.assignees!),\n );\n return `Assigned ${request.assignees.map((login) => `@${login}`).join(\", \")} to #${number}.`;\n }\n case \"remove_assignees\": {\n if (!request.assignees?.length) {\n throw new Error(\"remove_assignees requires a non-empty assignees array.\");\n }\n await githubRetry(() =>\n this.client.removeIssueAssignees(ref.owner, ref.repo, number, request.assignees!),\n );\n return `Unassigned ${request.assignees.map((login) => `@${login}`).join(\", \")} from #${number}.`;\n }\n case \"close\": {\n await githubRetry(() =>\n this.client.updateIssueState(\n ref.owner,\n ref.repo,\n number,\n \"closed\",\n request.state_reason,\n ),\n );\n return `Closed #${number}${request.state_reason ? ` as ${request.state_reason}` : \"\"}.`;\n }\n case \"reopen\": {\n await githubRetry(() =>\n this.client.updateIssueState(ref.owner, ref.repo, number, \"open\"),\n );\n return `Reopened #${number}.`;\n }\n default:\n throw new Error(`Unknown github_issue action: ${String(request.action)}`);\n }\n } catch (err) {\n if (err instanceof GithubApiError && err.status === 404) {\n throw new Error(`Issue #${number} not found in ${ref.owner}/${ref.repo}.`, { cause: err });\n }\n throw err;\n }\n }\n\n /**\n * Backs the `github_review_reply` tool: answer inside one inline review\n * thread of this conversation's PR. The comment id comes from an\n * `[PR review comment rc-<id> …]` message; GitHub validates it belongs to\n * this PR (404 otherwise, translated into agent-actionable guidance).\n */\n async replyToReviewThread(\n conversationId: string,\n commentId: number,\n body: string,\n ): Promise<{ url: string }> {\n if (!Number.isInteger(commentId) || commentId <= 0) {\n throw new Error(\n \"comment_id must be the numeric id from an [PR review comment rc-<id> …] message.\",\n );\n }\n const ref = parseGithubConversationId(conversationId);\n const text =\n body.length > GITHUB_MAX_COMMENT_LENGTH\n ? `${body.slice(0, GITHUB_MAX_COMMENT_LENGTH)}\\n…(truncated)`\n : body;\n try {\n const reply = await githubRetry(() =>\n this.client.replyToReviewComment(ref.owner, ref.repo, ref.number, commentId, text),\n );\n return {\n url: `https://github.com/${ref.owner}/${ref.repo}/pull/${ref.number}#discussion_r${reply.id}`,\n };\n } catch (err) {\n if (err instanceof GithubApiError && err.status === 404) {\n throw new Error(\n `Comment ${commentId} is not a review comment on this PR. Take the id from an ` +\n `[PR review comment rc-<id> …] message in this conversation; do not guess ids.`,\n { cause: err },\n );\n }\n throw err;\n }\n }\n\n /**\n * Backs the log mode of `github_checks`: the tail of one CI job's log so\n * the agent can diagnose a failing check without sandbox credentials. Only\n * GitHub Actions checks have logs on GitHub — external CI apps (e.g. Cloud\n * Build) keep theirs on their own service, so a 404 here is translated\n * into guidance instead of a dead end.\n */\n async getJobLog(conversationId: string, jobId: number): Promise<string> {\n if (!Number.isInteger(jobId) || jobId <= 0) {\n throw new Error(\n \"job_id must be a positive Actions job id taken from a [job …] entry in the github_checks summary.\",\n );\n }\n const ref = parseGithubConversationId(conversationId);\n let logText: string;\n try {\n logText = await githubRetry(() => this.client.getJobLog(ref.owner, ref.repo, jobId));\n } catch (err) {\n if (err instanceof GithubApiError && err.status === 404) {\n throw new Error(\n `No GitHub Actions log for job ${jobId}. Logs are only available for checks reported ` +\n `by github-actions; external CI (e.g. Cloud Build) keeps logs on its own service — ` +\n `use that check's summary/url from github_checks, or reproduce the failure locally ` +\n `in ./repo instead. Do not retry with other ids.`,\n { cause: err },\n );\n }\n throw err;\n }\n return truncateLogTail(logText);\n }\n}\n"]}
1
+ {"version":3,"file":"github-ops.js","sourceRoot":"","sources":["../../../src/adapters/github/github-ops.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAa5D,8DAA8D;AAC9D,MAAM,aAAa,GAAG,KAAK,CAAC;AAE5B;iEACiE;AACjE,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,MAAoB,EACpB,GAA0B;IAE1B,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QACxF,OAAO,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAoB,EACpB,GAA0B;IAE1B,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3F,MAAM,QAAQ,GACZ,EAAE,CAAC,IAAI,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CAAC;YACJ,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;QACD,OAAO,OAAO,CAAC,MAAM,GAAG,aAAa;YACnC,CAAC,CAAC,2BAA2B,aAAa,YAAY,OAAO,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,EAAE;YACrF,CAAC,CAAC,OAAO,CAAC;IACd,CAAC;CACF","sourcesContent":["import { existsSync } from \"node:fs\";\nimport * as log from \"../../log.js\";\nimport type { GithubClient } from \"./client.js\";\nimport { GithubApiError, GITHUB_MAX_COMMENT_LENGTH, githubRetry } from \"./client.js\";\nimport { parseGithubConversationId } from \"./ids.js\";\nimport { conversationRepoDir, GITHUB_PUSH_BRANCH_PATTERN, pushBranch, syncRepo } from \"./repo.js\";\nimport { createOfficeAddress } from \"../../office/index.js\";\nimport type { Workspace } from \"../../office/index.js\";\nimport type {\n GithubCheckSummary,\n GithubConversationRef,\n GithubIssueRequest,\n GithubPrRequest,\n GithubPrResult,\n GithubReadRequest,\n GithubReadResult,\n PlatformGithubOps,\n} from \"./types.js\";\n\n/** CI job logs are tail-truncated to this many characters. */\nconst MAX_LOG_CHARS = 20000;\n\n/** Whether the conversation's issue is a PR, for callers where the triggering\n * item didn't carry that knowledge. Errs toward plain issue. */\nexport async function fetchIsPr(\n client: GithubClient,\n ref: GithubConversationRef,\n): Promise<boolean> {\n try {\n const issue = await githubRetry(() => client.getIssue(ref.owner, ref.repo, ref.number));\n return Boolean(issue.pull_request);\n } catch {\n return false;\n }\n}\n\n/**\n * The PR's head branch name when it lives in this repo — that is the name\n * the local checkout should carry, so committing on it and calling\n * github_pr pushes back to the PR itself instead of opening a new one.\n * Fork heads (unpushable with the repo-scoped token) and failed lookups\n * return undefined; callers then fall back to the synthetic pr-<n>.\n */\nexport async function fetchPrHeadBranch(\n client: GithubClient,\n ref: GithubConversationRef,\n): Promise<string | undefined> {\n try {\n const pr = await githubRetry(() => client.getPullRequest(ref.owner, ref.repo, ref.number));\n const sameRepo =\n pr.head?.repo?.full_name?.toLowerCase() === `${ref.owner}/${ref.repo}`.toLowerCase();\n return sameRepo ? pr.head?.ref : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Host-side backend of the github_* tool pack (`PlatformGithubOps`),\n * standalone from the messaging bot: it needs the API client, the\n * conversation working dir — not the poll\n * loop, queues, or trigger gate. Tokens are minted per call, scoped to the\n * conversation's repo, and never enter the sandbox.\n */\nexport class GithubOps implements PlatformGithubOps {\n constructor(\n private readonly client: GithubClient,\n private readonly config: { workspace: Workspace },\n ) {}\n\n private repoDir(conversationId: string): string {\n return conversationRepoDir(\n this.config.workspace.office(createOfficeAddress(\"github\", conversationId)),\n );\n }\n\n /**\n * Backs the `github_pr` tool: push a `pi/*` branch the agent prepared in\n * the conversation's clone, then open a pull request as the App. The write\n * token is minted per call, scoped to this one repo, and never enters the\n * sandbox.\n */\n async pushAndCreatePr(conversationId: string, request: GithubPrRequest): Promise<GithubPrResult> {\n const ref = parseGithubConversationId(conversationId);\n const dir = this.repoDir(conversationId);\n if (!existsSync(dir)) {\n throw new Error(\"This conversation has no ./repo clone to push from.\");\n }\n if (!GITHUB_PUSH_BRANCH_PATTERN.test(request.branch)) {\n throw new Error(\n `Branch '${request.branch}' is not pushable: name it pi/<something> (e.g. pi/fix-${ref.number}).`,\n );\n }\n const repository = await githubRetry(() => this.client.getRepository(ref.owner, ref.repo));\n const base = request.base ?? repository.default_branch;\n const token = await this.client.createScopedInstallationToken(ref.repo, {\n contents: \"write\",\n pull_requests: \"write\",\n });\n await pushBranch({ dir, branch: request.branch, token });\n try {\n const pr = await githubRetry(() =>\n this.client.createPullRequest(ref.owner, ref.repo, {\n title: request.title,\n head: request.branch,\n base,\n body: request.body,\n draft: request.draft,\n }),\n );\n log.logInfo(`[${conversationId}] Opened PR #${pr.number}: ${pr.html_url}`);\n return { number: pr.number, url: pr.html_url };\n } catch (err) {\n // Idempotency: pushing more commits to a branch that already has an\n // open PR updates that PR; the create call then 422s. Surface the\n // existing PR instead of failing the fix-CI-push-again loop.\n if (\n err instanceof GithubApiError &&\n err.status === 422 &&\n /already exists/i.test(err.message)\n ) {\n const existing = await this.client.findOpenPullRequestByBranch(\n ref.owner,\n ref.repo,\n request.branch,\n );\n if (existing) {\n log.logInfo(\n `[${conversationId}] Pushed to existing PR #${existing.number}: ${existing.html_url}`,\n );\n return { number: existing.number, url: existing.html_url, updatedExisting: true };\n }\n }\n throw err;\n }\n }\n\n /**\n * Backs the `github_checks` tool: CI check runs for a branch the agent\n * pushed, or for the conversation's PR head when no branch is given.\n */\n async getChecks(conversationId: string, branch?: string): Promise<GithubCheckSummary[]> {\n const ref = parseGithubConversationId(conversationId);\n let target = branch;\n if (!target) {\n let pr;\n try {\n pr = await githubRetry(() => this.client.getPullRequest(ref.owner, ref.repo, ref.number));\n } catch {\n pr = null;\n }\n if (!pr?.head) {\n throw new Error(\n \"This conversation is not a pull request — pass the branch whose checks you want.\",\n );\n }\n target = pr.head.sha;\n }\n const runs = await githubRetry(() => this.client.listCheckRuns(ref.owner, ref.repo, target));\n return runs.map((run) => ({\n id: run.id,\n name: run.name,\n status: run.status,\n conclusion: run.conclusion,\n url: run.html_url,\n appSlug: run.app?.slug ?? null,\n outputSummary: run.output?.summary?.trim() ? run.output.summary.slice(0, 500) : null,\n }));\n }\n\n /**\n * Backs the `github_sync` tool: refresh the conversation's ./repo clone\n * from origin with an ephemeral read token. Fetch-only when moving the\n * checkout could lose agent work; the formatted report tells the agent\n * what happened and what to do next.\n */\n async syncRepo(conversationId: string, branch?: string): Promise<string> {\n const ref = parseGithubConversationId(conversationId);\n const dir = this.repoDir(conversationId);\n if (!existsSync(dir)) {\n throw new Error(\"This conversation has no ./repo clone to sync.\");\n }\n const token = await this.client.createScopedInstallationToken(ref.repo, {\n contents: \"read\",\n });\n let prNumber: number | undefined;\n let prHeadBranch: string | undefined;\n let defaultBranch: string | undefined;\n if (!branch) {\n if (await fetchIsPr(this.client, ref)) {\n prNumber = ref.number;\n prHeadBranch = await fetchPrHeadBranch(this.client, ref);\n } else {\n const repository = await githubRetry(() => this.client.getRepository(ref.owner, ref.repo));\n defaultBranch = repository.default_branch;\n }\n }\n const result = await syncRepo({ dir, token, branch, prNumber, prHeadBranch, defaultBranch });\n\n if (result.updatedCheckout) {\n return `Updated ./repo: branch ${result.target} is now at ${result.fetchedSha.slice(0, 12)}.`;\n }\n const reasons: string[] = [];\n if (result.currentBranch !== result.target) {\n reasons.push(`the checkout is on '${result.currentBranch}', not '${result.target}'`);\n }\n if (result.dirty) {\n reasons.push(\"the working tree has uncommitted changes\");\n }\n if (result.localCommits > 0) {\n reasons.push(`'${result.target}' has ${result.localCommits} local commit(s) not on origin`);\n }\n return (\n `Fetched ${result.target} to FETCH_HEAD (${result.fetchedSha.slice(0, 12)}) but left the ` +\n `checkout alone: ${reasons.join(\"; \")}. Merge or rebase FETCH_HEAD yourself ` +\n `(e.g. git merge FETCH_HEAD), or commit your work to a pi/* branch first.`\n );\n }\n\n /**\n * Backs the `github_read` tool: PR/issue metadata the ./repo clone cannot\n * provide (diff stats, review state, other issues in the repo). Owner/repo\n * always come from the conversation id, so reads never leave this repo.\n */\n async readGithub(conversationId: string, request: GithubReadRequest): Promise<GithubReadResult> {\n const ref = parseGithubConversationId(conversationId);\n const number = request.number ?? ref.number;\n switch (request.action) {\n case \"pr\": {\n const pr = await githubRetry(() => this.client.getPullRequest(ref.owner, ref.repo, number));\n return { kind: \"pr\", pr };\n }\n case \"pr_files\": {\n const files = await githubRetry(() =>\n this.client.listPullRequestFiles(ref.owner, ref.repo, number),\n );\n return { kind: \"pr_files\", files };\n }\n case \"pr_reviews\": {\n const [reviews, threads] = await Promise.all([\n githubRetry(() => this.client.listPullRequestReviews(ref.owner, ref.repo, number)),\n githubRetry(() => this.client.listPullReviewComments(ref.owner, ref.repo, number)),\n ]);\n return { kind: \"pr_reviews\", reviews, threads };\n }\n case \"issue\": {\n const issue = await githubRetry(() => this.client.getIssue(ref.owner, ref.repo, number));\n return { kind: \"issue\", issue };\n }\n case \"comments\": {\n const comments = await githubRetry(() =>\n this.client.listIssueComments(ref.owner, ref.repo, number),\n );\n return { kind: \"comments\", comments };\n }\n case \"list\": {\n const issues = await githubRetry(() =>\n this.client.listIssues(ref.owner, ref.repo, {\n state: request.state,\n labels: request.labels,\n creator: request.creator,\n }),\n );\n return { kind: \"list\", issues };\n }\n default:\n throw new Error(`Unknown github_read action: ${String(request.action)}`);\n }\n }\n\n /**\n * Backs the `github_issue` tool: labels, assignees, and open/closed state\n * on any issue of this conversation's repo (triage). Same-repo by\n * construction — owner/repo come from the conversation id; the action enum\n * is closed, so lock/delete/transfer cannot be expressed at all.\n */\n async manageIssue(conversationId: string, request: GithubIssueRequest): Promise<string> {\n const ref = parseGithubConversationId(conversationId);\n const number = request.number ?? ref.number;\n try {\n switch (request.action) {\n case \"add_labels\": {\n if (!request.labels?.length) {\n throw new Error(\"add_labels requires a non-empty labels array.\");\n }\n await githubRetry(() =>\n this.client.addIssueLabels(ref.owner, ref.repo, number, request.labels!),\n );\n return `Added label(s) ${request.labels.join(\", \")} to #${number}.`;\n }\n case \"remove_label\": {\n if (!request.label) {\n throw new Error(\"remove_label requires a label name.\");\n }\n await githubRetry(() =>\n this.client.removeIssueLabel(ref.owner, ref.repo, number, request.label!),\n );\n return `Removed label ${request.label} from #${number}.`;\n }\n case \"add_assignees\": {\n if (!request.assignees?.length) {\n throw new Error(\"add_assignees requires a non-empty assignees array.\");\n }\n await githubRetry(() =>\n this.client.addIssueAssignees(ref.owner, ref.repo, number, request.assignees!),\n );\n return `Assigned ${request.assignees.map((login) => `@${login}`).join(\", \")} to #${number}.`;\n }\n case \"remove_assignees\": {\n if (!request.assignees?.length) {\n throw new Error(\"remove_assignees requires a non-empty assignees array.\");\n }\n await githubRetry(() =>\n this.client.removeIssueAssignees(ref.owner, ref.repo, number, request.assignees!),\n );\n return `Unassigned ${request.assignees.map((login) => `@${login}`).join(\", \")} from #${number}.`;\n }\n case \"close\": {\n await githubRetry(() =>\n this.client.updateIssueState(\n ref.owner,\n ref.repo,\n number,\n \"closed\",\n request.state_reason,\n ),\n );\n return `Closed #${number}${request.state_reason ? ` as ${request.state_reason}` : \"\"}.`;\n }\n case \"reopen\": {\n await githubRetry(() =>\n this.client.updateIssueState(ref.owner, ref.repo, number, \"open\"),\n );\n return `Reopened #${number}.`;\n }\n default:\n throw new Error(`Unknown github_issue action: ${String(request.action)}`);\n }\n } catch (err) {\n if (err instanceof GithubApiError && err.status === 404) {\n throw new Error(`Issue #${number} not found in ${ref.owner}/${ref.repo}.`, { cause: err });\n }\n throw err;\n }\n }\n\n /**\n * Backs the `github_review_reply` tool: answer inside one inline review\n * thread of this conversation's PR. The comment id comes from an\n * `[PR review comment rc-<id> …]` message; GitHub validates it belongs to\n * this PR (404 otherwise, translated into agent-actionable guidance).\n */\n async replyToReviewThread(\n conversationId: string,\n commentId: number,\n body: string,\n ): Promise<{ url: string }> {\n if (!Number.isInteger(commentId) || commentId <= 0) {\n throw new Error(\n \"comment_id must be the numeric id from an [PR review comment rc-<id> …] message.\",\n );\n }\n const ref = parseGithubConversationId(conversationId);\n const text =\n body.length > GITHUB_MAX_COMMENT_LENGTH\n ? `${body.slice(0, GITHUB_MAX_COMMENT_LENGTH)}\\n…(truncated)`\n : body;\n try {\n const reply = await githubRetry(() =>\n this.client.replyToReviewComment(ref.owner, ref.repo, ref.number, commentId, text),\n );\n return {\n url: `https://github.com/${ref.owner}/${ref.repo}/pull/${ref.number}#discussion_r${reply.id}`,\n };\n } catch (err) {\n if (err instanceof GithubApiError && err.status === 404) {\n throw new Error(\n `Comment ${commentId} is not a review comment on this PR. Take the id from an ` +\n `[PR review comment rc-<id> …] message in this conversation; do not guess ids.`,\n { cause: err },\n );\n }\n throw err;\n }\n }\n\n /**\n * Backs the log mode of `github_checks`: the tail of one CI job's log so\n * the agent can diagnose a failing check without sandbox credentials. Only\n * GitHub Actions checks have logs on GitHub; external CI apps keep theirs\n * on their own service, so a 404 here becomes guidance instead of a dead end.\n */\n async getJobLog(conversationId: string, jobId: number): Promise<string> {\n if (!Number.isInteger(jobId) || jobId <= 0) {\n throw new Error(\n \"job_id must be a positive Actions job id taken from a [job …] entry in the github_checks summary.\",\n );\n }\n const ref = parseGithubConversationId(conversationId);\n let logText: string;\n try {\n logText = await githubRetry(() => this.client.getJobLog(ref.owner, ref.repo, jobId));\n } catch (err) {\n if (err instanceof GithubApiError && err.status === 404) {\n throw new Error(\n `No GitHub Actions log for job ${jobId}. Logs are only available for checks reported ` +\n `by github-actions; external CI keeps logs on its own service — ` +\n `use that check's summary/url from github_checks, or reproduce the failure locally ` +\n `in ./repo instead. Do not retry with other ids.`,\n { cause: err },\n );\n }\n throw err;\n }\n return logText.length > MAX_LOG_CHARS\n ? `…(truncated to the last ${MAX_LOG_CHARS} chars)\\n${logText.slice(-MAX_LOG_CHARS)}`\n : logText;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tool-pack.d.ts","sourceRoot":"","sources":["../../../src/adapters/github/tool-pack.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,iBAAiB,GAAG,gBAAgB,CA0C7E"}
1
+ {"version":3,"file":"tool-pack.d.ts","sourceRoot":"","sources":["../../../src/adapters/github/tool-pack.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,iBAAiB,GAAG,gBAAgB,CAyC7E"}
@@ -44,7 +44,6 @@ export function createGithubToolPack(ops) {
44
44
  setGithubChecksFunction({
45
45
  getChecks: (branch) => ops.getChecks(conversationId, branch),
46
46
  getJobLog: (jobId) => ops.getJobLog(conversationId, jobId),
47
- getBuildLog: (buildId) => ops.getBuildLog(conversationId, buildId),
48
47
  });
49
48
  setGithubReviewReplyFunction((commentId, body) => ops.replyToReviewThread(conversationId, commentId, body));
50
49
  setGithubSyncFunction((branch) => ops.syncRepo(conversationId, branch));
@@ -1 +1 @@
1
- {"version":3,"file":"tool-pack.js","sourceRoot":"","sources":["../../../src/adapters/github/tool-pack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAIvD;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAsB;IACzD,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,mBAAmB,EAAE,GAAG,kBAAkB,EAAE,CAAC;IACzE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,GAAG,sBAAsB,EAAE,CAAC;IACrF,MAAM,EAAE,IAAI,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,GACjE,2BAA2B,EAAE,CAAC;IAChC,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,qBAAqB,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC/E,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,qBAAqB,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC/E,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,sBAAsB,EAAE,GAAG,qBAAqB,EAAE,CAAC;IAElF,OAAO;QACL,KAAK,EAAE;YACL,YAAY;YACZ,g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BAAsB,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;QAChF,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { createGithubChecksTool } from \"./tools/checks.js\";\nimport { createGithubPrTool } from \"./tools/pr.js\";\nimport { createGithubIssueTool } from \"./tools/issue.js\";\nimport { createGithubReadTool } from \"./tools/read.js\";\nimport { createGithubReviewReplyTool } from \"./tools/review-reply.js\";\nimport { createGithubSyncTool } from \"./tools/sync.js\";\nimport type { PlatformToolPack } from \"../../tools/types.js\";\nimport type { PlatformGithubOps } from \"./types.js\";\n\n/**\n * GitHub host-side capability pack — one tool per module under `tools/`:\n * github_pr, github_checks, github_review_reply, github_sync, github_read,\n * github_issue.\n *\n * These tools never run in the sandbox; they call PlatformGithubOps which\n * mints short-lived installation tokens on the host. The pack is only\n * constructed when the GitHub bot is configured; bindRun enables the tools\n * only for github-named conversations so multi-platform processes stay safe.\n */\nexport function createGithubToolPack(ops: PlatformGithubOps): PlatformToolPack {\n const { tool: githubPrTool, setGithubPrFunction } = createGithubPrTool();\n const { tool: githubChecksTool, setGithubChecksFunction } = createGithubChecksTool();\n const { tool: githubReviewReplyTool, setGithubReviewReplyFunction } =\n createGithubReviewReplyTool();\n const { tool: githubSyncTool, setGithubSyncFunction } = createGithubSyncTool();\n const { tool: githubReadTool, setGithubReadFunction } = createGithubReadTool();\n const { tool: githubIssueTool, setGithubIssueFunction } = createGithubIssueTool();\n\n return {\n tools: [\n githubPrTool,\n githubChecksTool,\n githubReviewReplyTool,\n githubSyncTool,\n githubReadTool,\n githubIssueTool,\n ],\n bindRun({ conversationId, platformName }) {\n if (platformName !== \"github\") {\n setGithubPrFunction(null);\n setGithubChecksFunction(null);\n setGithubReviewReplyFunction(null);\n setGithubSyncFunction(null);\n setGithubReadFunction(null);\n setGithubIssueFunction(null);\n return;\n }\n setGithubPrFunction((request) => ops.pushAndCreatePr(conversationId, request));\n setGithubChecksFunction({\n getChecks: (branch) => ops.getChecks(conversationId, branch),\n getJobLog: (jobId) => ops.getJobLog(conversationId, jobId),\n getBuildLog: (buildId) => ops.getBuildLog(conversationId, buildId),\n });\n setGithubReviewReplyFunction((commentId, body) =>\n ops.replyToReviewThread(conversationId, commentId, body),\n );\n setGithubSyncFunction((branch) => ops.syncRepo(conversationId, branch));\n setGithubReadFunction((request) => ops.readGithub(conversationId, request));\n setGithubIssueFunction((request) => ops.manageIssue(conversationId, request));\n },\n };\n}\n"]}
1
+ {"version":3,"file":"tool-pack.js","sourceRoot":"","sources":["../../../src/adapters/github/tool-pack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAIvD;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAsB;IACzD,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,mBAAmB,EAAE,GAAG,kBAAkB,EAAE,CAAC;IACzE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,GAAG,sBAAsB,EAAE,CAAC;IACrF,MAAM,EAAE,IAAI,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,GACjE,2BAA2B,EAAE,CAAC;IAChC,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,qBAAqB,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC/E,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,qBAAqB,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC/E,MAAM,EAAE,IA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AC;YAC5E,sBAAsB,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC;QAChF,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { createGithubChecksTool } from \"./tools/checks.js\";\nimport { createGithubPrTool } from \"./tools/pr.js\";\nimport { createGithubIssueTool } from \"./tools/issue.js\";\nimport { createGithubReadTool } from \"./tools/read.js\";\nimport { createGithubReviewReplyTool } from \"./tools/review-reply.js\";\nimport { createGithubSyncTool } from \"./tools/sync.js\";\nimport type { PlatformToolPack } from \"../../tools/types.js\";\nimport type { PlatformGithubOps } from \"./types.js\";\n\n/**\n * GitHub host-side capability pack — one tool per module under `tools/`:\n * github_pr, github_checks, github_review_reply, github_sync, github_read,\n * github_issue.\n *\n * These tools never run in the sandbox; they call PlatformGithubOps which\n * mints short-lived installation tokens on the host. The pack is only\n * constructed when the GitHub bot is configured; bindRun enables the tools\n * only for github-named conversations so multi-platform processes stay safe.\n */\nexport function createGithubToolPack(ops: PlatformGithubOps): PlatformToolPack {\n const { tool: githubPrTool, setGithubPrFunction } = createGithubPrTool();\n const { tool: githubChecksTool, setGithubChecksFunction } = createGithubChecksTool();\n const { tool: githubReviewReplyTool, setGithubReviewReplyFunction } =\n createGithubReviewReplyTool();\n const { tool: githubSyncTool, setGithubSyncFunction } = createGithubSyncTool();\n const { tool: githubReadTool, setGithubReadFunction } = createGithubReadTool();\n const { tool: githubIssueTool, setGithubIssueFunction } = createGithubIssueTool();\n\n return {\n tools: [\n githubPrTool,\n githubChecksTool,\n githubReviewReplyTool,\n githubSyncTool,\n githubReadTool,\n githubIssueTool,\n ],\n bindRun({ conversationId, platformName }) {\n if (platformName !== \"github\") {\n setGithubPrFunction(null);\n setGithubChecksFunction(null);\n setGithubReviewReplyFunction(null);\n setGithubSyncFunction(null);\n setGithubReadFunction(null);\n setGithubIssueFunction(null);\n return;\n }\n setGithubPrFunction((request) => ops.pushAndCreatePr(conversationId, request));\n setGithubChecksFunction({\n getChecks: (branch) => ops.getChecks(conversationId, branch),\n getJobLog: (jobId) => ops.getJobLog(conversationId, jobId),\n });\n setGithubReviewReplyFunction((commentId, body) =>\n ops.replyToReviewThread(conversationId, commentId, body),\n );\n setGithubSyncFunction((branch) => ops.syncRepo(conversationId, branch));\n setGithubReadFunction((request) => ops.readGithub(conversationId, request));\n setGithubIssueFunction((request) => ops.manageIssue(conversationId, request));\n },\n };\n}\n"]}
@@ -4,7 +4,6 @@ import type { GithubChecksFns } from "../types.js";
4
4
  declare const githubChecksSchema: import("@sinclair/typebox").TObject<{
5
5
  branch: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
6
6
  job_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
7
- build_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
8
7
  }>;
9
8
  /**
10
9
  * The `github_checks` tool reads CI check runs (GitHub Actions and other
@@ -1 +1 @@
1
- {"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/checks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG/D,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAsB,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvE,QAAA,MAAM,kBAAkB;;;;EAsBtB,CAAC;AA+BH;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI;IACxC,IAAI,EAAE,SAAS,CAAC,OAAO,kBAAkB,CAAC,CAAC;IAC3C,uBAAuB,EAAE,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI,KAAK,IAAI,CAAC;CAChE,CA+DA"}
1
+ {"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/checks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG/D,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAsB,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvE,QAAA,MAAM,kBAAkB;;;EAetB,CAAC;AA0BH;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI;IACxC,IAAI,EAAE,SAAS,CAAC,OAAO,kBAAkB,CAAC,CAAC;IAC3C,uBAAuB,EAAE,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI,KAAK,IAAI,CAAC;CAChE,CAmDA"}
@@ -9,10 +9,6 @@ const githubChecksSchema = Type.Object({
9
9
  description: "A [job …] id from the summary output (GitHub Actions checks) — returns that " +
10
10
  "CI job's log (tail) instead of the summary, for diagnosing a failing check.",
11
11
  })),
12
- build_id: Type.Optional(Type.String({
13
- description: "A [build …] uuid from the summary output (Cloud Build checks) — returns that " +
14
- "build's log (tail) instead of the summary. Mutually exclusive with job_id.",
15
- })),
16
12
  });
17
13
  /** Conclusions that mean "this check did not pass and needs attention". */
18
14
  const FAILING_CONCLUSIONS = new Set(["failure", "timed_out", "action_required", "cancelled"]);
@@ -25,14 +21,9 @@ function formatCheckLine(run) {
25
21
  : run.conclusion === "success"
26
22
  ? "✓"
27
23
  : "−";
28
- // GitHub Actions logs fetch via job_id; Cloud Build logs via build_id when
29
- // the host has GCP credentials. Other external CI keeps logs on its own
30
- // service, so advertising an id there would only invite doomed fetches.
31
24
  const handle = run.appSlug === "github-actions"
32
25
  ? `[job ${run.id}]`
33
- : run.buildLogAvailable && run.externalId
34
- ? `[build ${run.externalId}]`
35
- : `[external CI: ${run.appSlug ?? "unknown"} — logs not on GitHub]`;
26
+ : `[external CI: ${run.appSlug ?? "unknown"} — logs not on GitHub]`;
36
27
  const line = `${marker} ${run.name}: ${state} ${handle}${run.url ? ` (${run.url})` : ""}`;
37
28
  const failed = run.conclusion !== null && FAILING_CONCLUSIONS.has(run.conclusion);
38
29
  return failed && run.outputSummary
@@ -50,16 +41,13 @@ export function createGithubChecksTool() {
50
41
  name: "github_checks",
51
42
  description: "Read CI status (check runs) for a branch you pushed with github_pr, or for this " +
52
43
  "conversation's pull request when branch is omitted. Pass job_id (a [job …] id, " +
53
- "GitHub Actions) or build_id (a [build …] uuid, Cloud Build) from the summary to " +
54
- "fetch that run's log. Other external CI checks keep logs on their own service: use " +
44
+ "GitHub Actions) from the summary to fetch that run's log. External CI checks keep " +
45
+ "logs on their own service: use " +
55
46
  "their summary/url, or reproduce the failure locally in ./repo. Only available in " +
56
47
  "GitHub conversations.",
57
48
  parameters: githubChecksSchema,
58
49
  unavailable: "github_checks is only available in GitHub conversations.",
59
50
  run: async (checksFns, args) => {
60
- if (args.job_id !== undefined && args.build_id !== undefined) {
61
- throw new Error("Pass either job_id or build_id, not both.");
62
- }
63
51
  if (args.job_id !== undefined) {
64
52
  const logText = await checksFns.getJobLog(args.job_id);
65
53
  return {
@@ -67,13 +55,6 @@ export function createGithubChecksTool() {
67
55
  details: undefined,
68
56
  };
69
57
  }
70
- if (args.build_id !== undefined) {
71
- const logText = await checksFns.getBuildLog(args.build_id);
72
- return {
73
- content: [{ type: "text", text: logText || "(empty log)" }],
74
- details: undefined,
75
- };
76
- }
77
58
  const runs = await checksFns.getChecks(args.branch);
78
59
  if (runs.length === 0) {
79
60
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"checks.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/checks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAIlE,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC;IACrC,MAAM,EAAE,IAAI,CAAC,QAAQ,CACnB,IAAI,CAAC,MAAM,CAAC;QACV,WAAW,EACT,uEAAuE;YACvE,mEAAmE;KACtE,CAAC,CACH;IACD,MAAM,EAAE,IAAI,CAAC,QAAQ,CACnB,IAAI,CAAC,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,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAC;AAClD,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Type } from \"@sinclair/typebox\";\nimport { defineHostFnTool } from \"../../../tools/host-fn-tool.js\";\nexport type { GithubChecksFns } from \"../types.js\";\nimport type { GithubCheckSummary, GithubChecksFns } from \"../types.js\";\n\nconst githubChecksSchema = Type.Object({\n branch: Type.Optional(\n Type.String({\n description:\n \"Branch whose CI checks to read (e.g. a pi/<name> branch you pushed). \" +\n \"Omit in a pull-request conversation to read the PR head's checks.\",\n }),\n ),\n job_id: Type.Optional(\n Type.Number({\n description:\n \"A [job …] id from the summary output (GitHub Actions checks) — returns that \" +\n \"CI job's log (tail) instead of the summary, for diagnosing a failing check.\",\n }),\n ),\n build_id: Type.Optional(\n Type.String({\n description:\n \"A [build …] uuid from the summary output (Cloud Build checks) — returns that \" +\n \"build's log (tail) instead of the summary. Mutually exclusive with job_id.\",\n }),\n ),\n});\n\n/** Conclusions that mean \"this check did not pass and needs attention\". */\nconst FAILING_CONCLUSIONS = new Set([\"failure\", \"timed_out\", \"action_required\", \"cancelled\"]);\n\nfunction formatCheckLine(run: GithubCheckSummary): string {\n const state = run.status === \"completed\" ? (run.conclusion ?? \"unknown\") : run.status;\n const marker =\n run.conclusion === null\n ? \"…\"\n : FAILING_CONCLUSIONS.has(run.conclusion)\n ? \"✗\"\n : run.conclusion === \"success\"\n ? \"✓\"\n : \"−\";\n // GitHub Actions logs fetch via job_id; Cloud Build logs via build_id when\n // the host has GCP credentials. Other external CI keeps logs on its own\n // service, so advertising an id there would only invite doomed fetches.\n const handle =\n run.appSlug === \"github-actions\"\n ? `[job ${run.id}]`\n : run.buildLogAvailable && run.externalId\n ? `[build ${run.externalId}]`\n : `[external CI: ${run.appSlug ?? \"unknown\"} — logs not on GitHub]`;\n const line = `${marker} ${run.name}: ${state} ${handle}${run.url ? ` (${run.url})` : \"\"}`;\n const failed = run.conclusion !== null && FAILING_CONCLUSIONS.has(run.conclusion);\n return failed && run.outputSummary\n ? `${line}\\n ↳ ${run.outputSummary.replace(/\\s*\\n\\s*/g, \" \")}`\n : line;\n}\n\n/**\n * The `github_checks` tool reads CI check runs (GitHub Actions and other\n * check-reporting apps) for a branch or the conversation's PR head, and can\n * fetch one job's log tail so the agent can diagnose failures and iterate.\n * Read-only, host-side; wired per run and only for GitHub conversations.\n */\nexport function createGithubChecksTool(): {\n tool: AgentTool<typeof githubChecksSchema>;\n setGithubChecksFunction: (fns: GithubChecksFns | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<GithubChecksFns, typeof githubChecksSchema>({\n name: \"github_checks\",\n description:\n \"Read CI status (check runs) for a branch you pushed with github_pr, or for this \" +\n \"conversation's pull request when branch is omitted. Pass job_id (a [job …] id, \" +\n \"GitHub Actions) or build_id (a [build …] uuid, Cloud Build) from the summary to \" +\n \"fetch that run's log. Other external CI checks keep logs on their own service: use \" +\n \"their summary/url, or reproduce the failure locally in ./repo. Only available in \" +\n \"GitHub conversations.\",\n parameters: githubChecksSchema,\n unavailable: \"github_checks is only available in GitHub conversations.\",\n run: async (checksFns, args) => {\n if (args.job_id !== undefined && args.build_id !== undefined) {\n throw new Error(\"Pass either job_id or build_id, not both.\");\n }\n\n if (args.job_id !== undefined) {\n const logText = await checksFns.getJobLog(args.job_id);\n return {\n content: [{ type: \"text\" as const, text: logText || \"(empty log)\" }],\n details: undefined,\n };\n }\n\n if (args.build_id !== undefined) {\n const logText = await checksFns.getBuildLog(args.build_id);\n return {\n content: [{ type: \"text\" as const, text: logText || \"(empty log)\" }],\n details: undefined,\n };\n }\n\n const runs = await checksFns.getChecks(args.branch);\n if (runs.length === 0) {\n return {\n content: [\n {\n type: \"text\" as const,\n text: \"No check runs found — CI may not have started yet; try again shortly.\",\n },\n ],\n details: undefined,\n };\n }\n const completed = runs.filter((run) => run.status === \"completed\");\n const failing = completed.filter(\n (run) => run.conclusion !== null && FAILING_CONCLUSIONS.has(run.conclusion),\n );\n const summary = `${runs.length} check(s): ${completed.length} completed, ${runs.length - completed.length} running, ${failing.length} failing`;\n return {\n content: [\n {\n type: \"text\" as const,\n text: [summary, ...runs.map(formatCheckLine)].join(\"\\n\"),\n },\n ],\n details: undefined,\n };\n },\n });\n\n return { tool, setGithubChecksFunction: setFn };\n}\n"]}
1
+ {"version":3,"file":"checks.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/checks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAIlE,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC;IACrC,MAAM,EAAE,IAAI,CAAC,QAAQ,CACnB,IAAI,CAAC,MAAM,CAAC;QACV,WAAW,EACT,uEAAuE;YACvE,mEAAmE;KACtE,CAAC,CACH;IACD,MAAM,EAAE,IAAI,CAAC,QAAQ,CACnB,IAAI,CAAC,MAAM,CAAC;QACV,WAAW,EACT,8EAA8E;YAC9E,6EAA6E;KAChF,CAAC,CACH;CACF,CAAC,CAAC;AAEH,2EAA2E;AAC3E,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,iBAAiB,EAAE,WAAW,CAAC,CAAC,CAAC;AAE9F,SAAS,eAAe,CAAC,GAAuB;IAC9C,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IACtF,MAAM,MAAM,GACV,GAAG,CAAC,UAAU,KAAK,IAAI;QACrB,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC;YACvC,CAAC,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AuB,EAAE,KAAK,EAAE,CAAC;AAClD,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Type } from \"@sinclair/typebox\";\nimport { defineHostFnTool } from \"../../../tools/host-fn-tool.js\";\nexport type { GithubChecksFns } from \"../types.js\";\nimport type { GithubCheckSummary, GithubChecksFns } from \"../types.js\";\n\nconst githubChecksSchema = Type.Object({\n branch: Type.Optional(\n Type.String({\n description:\n \"Branch whose CI checks to read (e.g. a pi/<name> branch you pushed). \" +\n \"Omit in a pull-request conversation to read the PR head's checks.\",\n }),\n ),\n job_id: Type.Optional(\n Type.Number({\n description:\n \"A [job …] id from the summary output (GitHub Actions checks) — returns that \" +\n \"CI job's log (tail) instead of the summary, for diagnosing a failing check.\",\n }),\n ),\n});\n\n/** Conclusions that mean \"this check did not pass and needs attention\". */\nconst FAILING_CONCLUSIONS = new Set([\"failure\", \"timed_out\", \"action_required\", \"cancelled\"]);\n\nfunction formatCheckLine(run: GithubCheckSummary): string {\n const state = run.status === \"completed\" ? (run.conclusion ?? \"unknown\") : run.status;\n const marker =\n run.conclusion === null\n ? \"…\"\n : FAILING_CONCLUSIONS.has(run.conclusion)\n ? \"✗\"\n : run.conclusion === \"success\"\n ? \"✓\"\n : \"−\";\n const handle =\n run.appSlug === \"github-actions\"\n ? `[job ${run.id}]`\n : `[external CI: ${run.appSlug ?? \"unknown\"} — logs not on GitHub]`;\n const line = `${marker} ${run.name}: ${state} ${handle}${run.url ? ` (${run.url})` : \"\"}`;\n const failed = run.conclusion !== null && FAILING_CONCLUSIONS.has(run.conclusion);\n return failed && run.outputSummary\n ? `${line}\\n ↳ ${run.outputSummary.replace(/\\s*\\n\\s*/g, \" \")}`\n : line;\n}\n\n/**\n * The `github_checks` tool reads CI check runs (GitHub Actions and other\n * check-reporting apps) for a branch or the conversation's PR head, and can\n * fetch one job's log tail so the agent can diagnose failures and iterate.\n * Read-only, host-side; wired per run and only for GitHub conversations.\n */\nexport function createGithubChecksTool(): {\n tool: AgentTool<typeof githubChecksSchema>;\n setGithubChecksFunction: (fns: GithubChecksFns | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<GithubChecksFns, typeof githubChecksSchema>({\n name: \"github_checks\",\n description:\n \"Read CI status (check runs) for a branch you pushed with github_pr, or for this \" +\n \"conversation's pull request when branch is omitted. Pass job_id (a [job …] id, \" +\n \"GitHub Actions) from the summary to fetch that run's log. External CI checks keep \" +\n \"logs on their own service: use \" +\n \"their summary/url, or reproduce the failure locally in ./repo. Only available in \" +\n \"GitHub conversations.\",\n parameters: githubChecksSchema,\n unavailable: \"github_checks is only available in GitHub conversations.\",\n run: async (checksFns, args) => {\n if (args.job_id !== undefined) {\n const logText = await checksFns.getJobLog(args.job_id);\n return {\n content: [{ type: \"text\" as const, text: logText || \"(empty log)\" }],\n details: undefined,\n };\n }\n\n const runs = await checksFns.getChecks(args.branch);\n if (runs.length === 0) {\n return {\n content: [\n {\n type: \"text\" as const,\n text: \"No check runs found — CI may not have started yet; try again shortly.\",\n },\n ],\n details: undefined,\n };\n }\n const completed = runs.filter((run) => run.status === \"completed\");\n const failing = completed.filter(\n (run) => run.conclusion !== null && FAILING_CONCLUSIONS.has(run.conclusion),\n );\n const summary = `${runs.length} check(s): ${completed.length} completed, ${runs.length - completed.length} running, ${failing.length} failing`;\n return {\n content: [\n {\n type: \"text\" as const,\n text: [summary, ...runs.map(formatCheckLine)].join(\"\\n\"),\n },\n ],\n details: undefined,\n };\n },\n });\n\n return { tool, setGithubChecksFunction: setFn };\n}\n"]}
@@ -1,5 +1,4 @@
1
1
  import type { ConversationEvent } from "../../adapter.js";
2
- import type { GcpTokenProvider } from "./gcp-auth.js";
3
2
  import type { Workspace } from "../../office/types.js";
4
3
  export interface GithubEvent extends ConversationEvent {
5
4
  type: "message" | "issue";
@@ -21,27 +20,6 @@ export interface GithubBotConfig {
21
20
  * re-trigger runs.
22
21
  */
23
22
  syncStatePath: string;
24
- /**
25
- * Present when the host has GCP credentials (GOOGLE_APPLICATION_CREDENTIALS):
26
- * lets github_checks fetch Cloud Build logs. Credentials never enter the
27
- * sandbox; absent, external-CI checks degrade to guidance text.
28
- */
29
- cloudBuild?: {
30
- tokenProvider: GcpTokenProvider;
31
- /** Project used when a check's details_url does not name one. */
32
- projectFallback?: string;
33
- };
34
- }
35
- export interface GcpTokenProviderOptions {
36
- /** Path to the ADC JSON (usually $GOOGLE_APPLICATION_CREDENTIALS). */
37
- credentialsPath: string;
38
- fetchImpl?: typeof fetch;
39
- }
40
- export interface CloudBuildLogOptions {
41
- tokenProvider: GcpTokenProvider;
42
- project: string;
43
- buildId: string;
44
- fetchImpl?: typeof fetch;
45
23
  }
46
24
  /** Persisted per-repo poll watermark (DESIGN.md § Event source). */
47
25
  interface GithubRepoSyncState {
@@ -187,10 +165,6 @@ export interface GithubCheckRun {
187
165
  title?: string | null;
188
166
  summary?: string | null;
189
167
  } | null;
190
- /** The reporting app's own id for the run; Cloud Build puts the build UUID here. */
191
- external_id?: string | null;
192
- /** The reporting app's own results page; Cloud Build encodes the GCP project here. */
193
- details_url?: string | null;
194
168
  }
195
169
  /** Permission subset requestable on a scoped installation token. */
196
170
  export type GithubTokenPermissions = Partial<Record<"contents" | "pull_requests" | "issues", "read" | "write">>;
@@ -281,15 +255,10 @@ export interface GithubCheckSummary {
281
255
  appSlug: string | null;
282
256
  /** The reporting app's own summary of the run, when it posted one. */
283
257
  outputSummary: string | null;
284
- /** The reporting app's run id (Cloud Build: the build UUID). */
285
- externalId: string | null;
286
- /** True when this run's log is fetchable via build_id (Cloud Build + GCP creds). */
287
- buildLogAvailable?: boolean;
288
258
  }
289
259
  export interface GithubChecksFns {
290
260
  getChecks: (branch?: string) => Promise<GithubCheckSummary[]>;
291
261
  getJobLog: (jobId: number) => Promise<string>;
292
- getBuildLog: (buildId: string) => Promise<string>;
293
262
  }
294
263
  /** Arguments for the host-side `github_read` tool. */
295
264
  export interface GithubReadRequest {
@@ -356,8 +325,6 @@ export interface PlatformGithubOps {
356
325
  getChecks(conversationId: string, branch?: string): Promise<GithubCheckSummary[]>;
357
326
  /** Log text of one CI job (an Actions check-run id), tail-truncated. */
358
327
  getJobLog(conversationId: string, jobId: number): Promise<string>;
359
- /** Log text of one Cloud Build run (a [build …] uuid), tail-truncated. */
360
- getBuildLog(conversationId: string, buildId: string): Promise<string>;
361
328
  /** Reply inside one inline review thread of the conversation's PR. */
362
329
  replyToReviewThread(conversationId: string, commentId: number, body: string): Promise<{
363
330
  url: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapters/github/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,WAAW,WAAY,SAAQ,iBAAiB;IACpD,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,UAAU,CAAC,EAAE;QACX,aAAa,EAAE,gBAAgB,CAAC;QAChC,iEAAiE;QACjE,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAED,MAAM,WAAW,uBAAuB;IACtC,sEAAsE;IACtE,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;A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S,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5B,gFAAgF;IAChF,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnE,uEAAuE;IACvE,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC1F,+EAA+E;IAC/E,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACnF;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/adapters/github/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ConversationEvent } from \"../../adapter.js\";\nimport type { GcpTokenProvider } from \"./gcp-auth.js\";\nimport type { Workspace } from \"../../office/types.js\";\n\nexport interface GithubEvent extends ConversationEvent {\n type: \"message\" | \"issue\";\n userName?: string;\n}\n\nexport interface GithubBotConfig {\n appId: string;\n /** PEM-encoded GitHub App private key. */\n privateKey: string;\n installationId: string;\n /** `owner/repo` entries to watch; empty = all installation repositories. */\n repos: string[];\n pollIntervalMs: number;\n workspace: Workspace;\n /**\n * Where the poll watermark state (baseline + seen ids) is persisted. Lives\n * under the host-only state dir: the workspace dir can be mounted into\n * sandboxes, and sandboxed code must not be able to clear dedup state and\n * re-trigger runs.\n */\n syncStatePath: string;\n /**\n * Present when the host has GCP credentials (GOOGLE_APPLICATION_CREDENTIALS):\n * lets github_checks fetch Cloud Build logs. Credentials never enter the\n * sandbox; absent, external-CI checks degrade to guidance text.\n */\n cloudBuild?: {\n tokenProvider: GcpTokenProvider;\n /** Project used when a check's details_url does not name one. */\n projectFallback?: string;\n };\n}\n\nexport interface GcpTokenProviderOptions {\n /** Path to the ADC JSON (usually $GOOGLE_APPLICATION_CREDENTIALS). */\n credentialsPath: string;\n fetchImpl?: typeof fetch;\n}\n\nexport interface CloudBuildLogOptions {\n tokenProvider: GcpTokenProvider;\n project: string;\n buildId: string;\n fetchImpl?: typeof fetch;\n}\n\n/** Persisted per-repo poll watermark (DESIGN.md § Event source). */\ninterface GithubRepoSyncState {\n /** Comments/issues created before this ISO instant never trigger. */\n baseline: string;\n /** Newest updated_at seen; polls fetch from (cursor - overlap). */\n cursor: string;\n seenComments: number[];\n seenIssues: number[];\n /** Optional so state files written before review-comment polling still load. */\n seenReviewComments?: number[];\n}\n\nexport interface GithubSyncState {\n repos: Record<string, GithubRepoSyncState>;\n}\n\nexport interface GithubRepoRef {\n owner: string;\n repo: string;\n}\n\nexport interface GithubConversationRef extends GithubRepoRef {\n number: number;\n}\n\n// ── GitHub REST payload shapes (only the fields mikan reads) ─────────────────\n\ninterface GithubUser {\n login: string;\n type: string;\n}\n\nexport interface GithubIssue {\n id: number;\n number: number;\n title: string;\n body: string | null;\n user: GithubUser;\n created_at: string;\n updated_at: string;\n pull_request?: object;\n /** open | closed */\n state?: string;\n labels?: { name: string }[];\n assignees?: { login: string }[];\n}\n\nexport interface GithubIssueComment {\n id: number;\n body: string;\n user: GithubUser;\n created_at: string;\n updated_at: string;\n /** API URL of the parent issue, e.g. …/repos/o/r/issues/42 */\n issue_url: string;\n}\n\n/** An inline PR review comment (a comment on a diff line). */\nexport interface GithubReviewComment {\n id: number;\n body: string;\n user: GithubUser;\n created_at: string;\n updated_at: string;\n /** API URL of the parent PR, e.g. …/repos/o/r/pulls/42 */\n pull_request_url: string;\n /** File the comment is anchored to. */\n path: string;\n /** Line in the diff's right side; null when the anchor is outdated. */\n line: number | null;\n /** The diff excerpt the comment is anchored to. */\n diff_hunk: string;\n /** Set on replies: the id of the thread's root comment. */\n in_reply_to_id?: number;\n}\n\nexport interface GithubRepository {\n name: string;\n owner: GithubUser;\n}\n\nexport interface GithubRepositoryDetails {\n default_branch: string;\n}\n\nexport interface GithubCollaboratorPermission {\n /** Legacy field: admin | write | read | none (maintain→write, triage→read). */\n permission: string;\n /** Granular assigned role (admin/maintain/write/triage/read or a custom role). */\n role_name?: string;\n}\n\nexport interface GithubPullRequest {\n number: number;\n html_url: string;\n /** head.repo is null when the fork a PR came from was deleted. */\n head?: { ref: string; sha: string; repo?: { full_name?: string } | null };\n base?: { ref: string };\n title?: string;\n body?: string | null;\n /** open | closed */\n state?: string;\n draft?: boolean;\n merged?: boolean;\n mergeable_state?: string;\n changed_files?: number;\n additions?: number;\n deletions?: number;\n user?: GithubUser;\n}\n\n/** One row of GET /pulls/{n}/files. */\nexport interface GithubPullRequestFile {\n filename: string;\n /** added | removed | modified | renamed | … */\n status: string;\n additions: number;\n deletions: number;\n}\n\n/** One submitted review of GET /pulls/{n}/reviews. */\nexport interface GithubPullRequestReview {\n id: number;\n user: GithubUser;\n body: string | null;\n /** APPROVED | CHANGES_REQUESTED | COMMENTED | DISMISSED | PENDING */\n state: string;\n submitted_at?: string;\n}\n\nexport interface GithubCheckRun {\n /** Check-run id; for GitHub Actions this doubles as the job id (log fetch). */\n id: number;\n name: string;\n /** queued | in_progress | completed */\n status: string;\n /** success | failure | neutral | cancelled | skipped | timed_out | action_required | null while running */\n conclusion: string | null;\n html_url: string | null;\n /** The app that reported the check (github-actions vs external CI). */\n app?: { slug?: string } | null;\n /** Whatever the reporting app posted about the run. */\n output?: { title?: string | null; summary?: string | null } | null;\n /** The reporting app's own id for the run; Cloud Build puts the build UUID here. */\n external_id?: string | null;\n /** The reporting app's own results page; Cloud Build encodes the GCP project here. */\n details_url?: string | null;\n}\n\n/** Permission subset requestable on a scoped installation token. */\nexport type GithubTokenPermissions = Partial<\n Record<\"contents\" | \"pull_requests\" | \"issues\", \"read\" | \"write\">\n>;\n\nexport type GithubReactionContent =\n | \"+1\"\n | \"-1\"\n | \"laugh\"\n | \"confused\"\n | \"heart\"\n | \"hooray\"\n | \"rocket\"\n | \"eyes\";\n\nexport interface CloneRepoOptions {\n /** HTTPS remote, e.g. https://github.com/owner/repo.git (no credentials). */\n url: string;\n /** Destination directory (the conversation dir's `repo/`). */\n dir: string;\n /** Ephemeral scoped installation token; used per-invocation, never stored. */\n token: string;\n botLogin: string;\n botEmail: string;\n /** When the conversation is a PR: fetch and check out its head. */\n prNumber?: number;\n /**\n * The PR's head branch name when it lives in this repo (not a fork): the\n * checkout is named after it so committing there + github_pr updates the\n * PR in place. Absent (fork/unknown), the checkout falls back to pr-<n>.\n */\n prHeadBranch?: string;\n}\n\nexport interface PushBranchOptions {\n dir: string;\n branch: string;\n token: string;\n}\n\nexport interface SyncRepoOptions {\n dir: string;\n /** Ephemeral contents:read token; used per-invocation, never stored. */\n token: string;\n /** Explicit branch to fetch; wins over prNumber/defaultBranch. */\n branch?: string;\n /** PR conversations: fetch pull/<n>/head into the local PR checkout. */\n prNumber?: number;\n /** Same-repo PR head name; the local checkout target. Fallback: pr-<n>. */\n prHeadBranch?: string;\n /** Fallback target when neither branch nor prNumber applies. */\n defaultBranch?: string;\n}\n\nexport interface SyncRepoResult {\n /** Local branch the fetch targets (the PR head name, pr-<n>, or the branch). */\n target: string;\n fetchedSha: string;\n /** True when the checkout was moved to the fetched head. */\n updatedCheckout: boolean;\n /** Working tree had uncommitted changes (checkout left alone). */\n dirty: boolean;\n currentBranch: string;\n /** Bot-committed (agent-made) commits on the target that origin lacks. */\n localCommits: number;\n}\n\nexport interface GithubClientOptions {\n appId: string;\n privateKey: string;\n installationId: string;\n /** Override the API root for tests; defaults to https://api.github.com */\n baseUrl?: string;\n fetchImpl?: typeof fetch;\n}\n\n// ── Host-side tool contracts (capability pack, not messaging core) ───────────\n\n/** Arguments for the host-side `github_pr` tool. */\nexport interface GithubPrRequest {\n /** Local branch in the conversation's ./repo clone; must match pi/<name>. */\n branch: string;\n title: string;\n body?: string;\n /** Target branch; defaults to the repository's default branch. */\n base?: string;\n draft?: boolean;\n}\n\nexport interface GithubPrResult {\n number: number;\n url: string;\n /** True when the branch already had an open PR that this push updated. */\n updatedExisting?: boolean;\n}\n\n/** Normalized check-run row for the host-side `github_checks` tool. */\nexport interface GithubCheckSummary {\n /** Check-run id; for GitHub Actions checks it is also the job id for log fetch. */\n id: number;\n name: string;\n /** queued | in_progress | completed */\n status: string;\n /** success | failure | … ; null while the run is still in progress */\n conclusion: string | null;\n url: string | null;\n /** Slug of the reporting app; \"github-actions\" checks have fetchable logs. */\n appSlug: string | null;\n /** The reporting app's own summary of the run, when it posted one. */\n outputSummary: string | null;\n /** The reporting app's run id (Cloud Build: the build UUID). */\n externalId: string | null;\n /** True when this run's log is fetchable via build_id (Cloud Build + GCP creds). */\n buildLogAvailable?: boolean;\n}\n\nexport interface GithubChecksFns {\n getChecks: (branch?: string) => Promise<GithubCheckSummary[]>;\n getJobLog: (jobId: number) => Promise<string>;\n getBuildLog: (buildId: string) => Promise<string>;\n}\n\n/** Arguments for the host-side `github_read` tool. */\nexport interface GithubReadRequest {\n action: \"pr\" | \"pr_files\" | \"pr_reviews\" | \"issue\" | \"comments\" | \"list\";\n /** Issue/PR number; defaults to the conversation's own. */\n number?: number;\n /** list only: open | closed | all (default open). */\n state?: string;\n /** list only: comma-separated label names. */\n labels?: string;\n /** list only: filter by author login. */\n creator?: string;\n}\n\n/** Typed payload of one `github_read` action; the tool renders it. */\nexport type GithubReadResult =\n | { kind: \"pr\"; pr: GithubPullRequest }\n | { kind: \"pr_files\"; files: GithubPullRequestFile[] }\n | { kind: \"pr_reviews\"; reviews: GithubPullRequestReview[]; threads: GithubReviewComment[] }\n | { kind: \"issue\"; issue: GithubIssue }\n | { kind: \"comments\"; comments: GithubIssueComment[] }\n | { kind: \"list\"; issues: GithubIssue[] };\n\n/** Arguments for the host-side `github_issue` tool. Deliberately a closed\n * action set: lock/delete/transfer are not offered at all. */\nexport interface GithubIssueRequest {\n action: \"add_labels\" | \"remove_label\" | \"add_assignees\" | \"remove_assignees\" | \"close\" | \"reopen\";\n /** Issue/PR number; defaults to the conversation's own (triage may target others). */\n number?: number;\n /** add_labels */\n labels?: string[];\n /** remove_label */\n label?: string;\n /** add_assignees / remove_assignees */\n assignees?: string[];\n /** close */\n state_reason?: \"completed\" | \"not_planned\";\n}\n\n/**\n * Host-side GitHub operations for github_* tools. Wired in main.ts over the\n * GitHub bot; tokens stay host-side. Consumed by `createGithubToolPack`.\n */\nexport type GithubSyncFn = (branch?: string) => Promise<string>;\n\nexport type GithubReviewReplyFn = (commentId: number, body: string) => Promise<{ url: string }>;\n\nexport type GithubReadFn = (request: GithubReadRequest) => Promise<GithubReadResult>;\n\nexport type GithubIssueFn = (request: GithubIssueRequest) => Promise<string>;\n\nexport interface PlatformGithubOps {\n /** Push a prepared pi/* branch and open (or update) a pull request. */\n pushAndCreatePr(conversationId: string, request: GithubPrRequest): Promise<GithubPrResult>;\n /** CI check runs for a branch, or for the conversation's PR head when omitted. */\n getChecks(conversationId: string, branch?: string): Promise<GithubCheckSummary[]>;\n /** Log text of one CI job (an Actions check-run id), tail-truncated. */\n getJobLog(conversationId: string, jobId: number): Promise<string>;\n /** Log text of one Cloud Build run (a [build …] uuid), tail-truncated. */\n getBuildLog(conversationId: string, buildId: string): Promise<string>;\n /** Reply inside one inline review thread of the conversation's PR. */\n replyToReviewThread(\n conversationId: string,\n commentId: number,\n body: string,\n ): Promise<{ url: string }>;\n /** Refresh the conversation's ./repo clone; returns a human-readable report. */\n syncRepo(conversationId: string, branch?: string): Promise<string>;\n /** Read PR/issue metadata the clone cannot provide; same repo only. */\n readGithub(conversationId: string, request: GithubReadRequest): Promise<GithubReadResult>;\n /** Label/assignee/state management on this repo's issues; returns a report. */\n manageIssue(conversationId: string, request: GithubIssueRequest): Promise<string>;\n}\n\nexport interface GithubWebhookOptions {\n secret: string;\n /** Called after signature verification for relevant events. */\n onPoke: () => void;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/adapters/github/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ConversationEvent } from \"../../adapter.js\";\nimport type { Workspace } from \"../../office/types.js\";\n\nexport interface GithubEvent extends ConversationEvent {\n type: \"message\" | \"issue\";\n userName?: string;\n}\n\nexport interface GithubBotConfig {\n appId: string;\n /** PEM-encoded GitHub App private key. */\n privateKey: string;\n installationId: string;\n /** `owner/repo` entries to watch; empty = all installation repositories. */\n repos: string[];\n pollIntervalMs: number;\n workspace: Workspace;\n /**\n * Where the poll watermark state (baseline + seen ids) is persisted. Lives\n * under the host-only state dir: the workspace dir can be mounted into\n * sandboxes, and sandboxed code must not be able to clear dedup state and\n * re-trigger runs.\n */\n syncStatePath: string;\n}\n\n/** Persisted per-repo poll watermark (DESIGN.md § Event source). */\ninterface GithubRepoSyncState {\n /** Comments/issues created before this ISO instant never trigger. */\n baseline: string;\n /** Newest updated_at seen; polls fetch from (cursor - overlap). */\n cursor: string;\n seenComments: number[];\n seenIssues: number[];\n /** Optional so state files written before review-comment polling still load. */\n seenReviewComments?: number[];\n}\n\nexport interface GithubSyncState {\n repos: Record<string, GithubRepoSyncState>;\n}\n\nexport interface GithubRepoRef {\n owner: string;\n repo: string;\n}\n\nexport interface GithubConversationRef extends GithubRepoRef {\n number: number;\n}\n\n// ── GitHub REST payload shapes (only the fields mikan reads) ─────────────────\n\ninterface GithubUser {\n login: string;\n type: string;\n}\n\nexport interface GithubIssue {\n id: number;\n number: number;\n title: string;\n body: string | null;\n user: GithubUser;\n created_at: string;\n updated_at: string;\n pull_request?: object;\n /** open | closed */\n state?: string;\n labels?: { name: string }[];\n assignees?: { login: string }[];\n}\n\nexport interface GithubIssueComment {\n id: number;\n body: string;\n user: GithubUser;\n created_at: string;\n updated_at: string;\n /** API URL of the parent issue, e.g. …/repos/o/r/issues/42 */\n issue_url: string;\n}\n\n/** An inline PR review comment (a comment on a diff line). */\nexport interface GithubReviewComment {\n id: number;\n body: string;\n user: GithubUser;\n created_at: string;\n updated_at: string;\n /** API URL of the parent PR, e.g. …/repos/o/r/pulls/42 */\n pull_request_url: string;\n /** File the comment is anchored to. */\n path: string;\n /** Line in the diff's right side; null when the anchor is outdated. */\n line: number | null;\n /** The diff excerpt the comment is anchored to. */\n diff_hunk: string;\n /** Set on replies: the id of the thread's root comment. */\n in_reply_to_id?: number;\n}\n\nexport interface GithubRepository {\n name: string;\n owner: GithubUser;\n}\n\nexport interface GithubRepositoryDetails {\n default_branch: string;\n}\n\nexport interface GithubCollaboratorPermission {\n /** Legacy field: admin | write | read | none (maintain→write, triage→read). */\n permission: string;\n /** Granular assigned role (admin/maintain/write/triage/read or a custom role). */\n role_name?: string;\n}\n\nexport interface GithubPullRequest {\n number: number;\n html_url: string;\n /** head.repo is null when the fork a PR came from was deleted. */\n head?: { ref: string; sha: string; repo?: { full_name?: string } | null };\n base?: { ref: string };\n title?: string;\n body?: string | null;\n /** open | closed */\n state?: string;\n draft?: boolean;\n merged?: boolean;\n mergeable_state?: string;\n changed_files?: number;\n additions?: number;\n deletions?: number;\n user?: GithubUser;\n}\n\n/** One row of GET /pulls/{n}/files. */\nexport interface GithubPullRequestFile {\n filename: string;\n /** added | removed | modified | renamed | … */\n status: string;\n additions: number;\n deletions: number;\n}\n\n/** One submitted review of GET /pulls/{n}/reviews. */\nexport interface GithubPullRequestReview {\n id: number;\n user: GithubUser;\n body: string | null;\n /** APPROVED | CHANGES_REQUESTED | COMMENTED | DISMISSED | PENDING */\n state: string;\n submitted_at?: string;\n}\n\nexport interface GithubCheckRun {\n /** Check-run id; for GitHub Actions this doubles as the job id (log fetch). */\n id: number;\n name: string;\n /** queued | in_progress | completed */\n status: string;\n /** success | failure | neutral | cancelled | skipped | timed_out | action_required | null while running */\n conclusion: string | null;\n html_url: string | null;\n /** The app that reported the check (github-actions vs external CI). */\n app?: { slug?: string } | null;\n /** Whatever the reporting app posted about the run. */\n output?: { title?: string | null; summary?: string | null } | null;\n}\n\n/** Permission subset requestable on a scoped installation token. */\nexport type GithubTokenPermissions = Partial<\n Record<\"contents\" | \"pull_requests\" | \"issues\", \"read\" | \"write\">\n>;\n\nexport type GithubReactionContent =\n | \"+1\"\n | \"-1\"\n | \"laugh\"\n | \"confused\"\n | \"heart\"\n | \"hooray\"\n | \"rocket\"\n | \"eyes\";\n\nexport interface CloneRepoOptions {\n /** HTTPS remote, e.g. https://github.com/owner/repo.git (no credentials). */\n url: string;\n /** Destination directory (the conversation dir's `repo/`). */\n dir: string;\n /** Ephemeral scoped installation token; used per-invocation, never stored. */\n token: string;\n botLogin: string;\n botEmail: string;\n /** When the conversation is a PR: fetch and check out its head. */\n prNumber?: number;\n /**\n * The PR's head branch name when it lives in this repo (not a fork): the\n * checkout is named after it so committing there + github_pr updates the\n * PR in place. Absent (fork/unknown), the checkout falls back to pr-<n>.\n */\n prHeadBranch?: string;\n}\n\nexport interface PushBranchOptions {\n dir: string;\n branch: string;\n token: string;\n}\n\nexport interface SyncRepoOptions {\n dir: string;\n /** Ephemeral contents:read token; used per-invocation, never stored. */\n token: string;\n /** Explicit branch to fetch; wins over prNumber/defaultBranch. */\n branch?: string;\n /** PR conversations: fetch pull/<n>/head into the local PR checkout. */\n prNumber?: number;\n /** Same-repo PR head name; the local checkout target. Fallback: pr-<n>. */\n prHeadBranch?: string;\n /** Fallback target when neither branch nor prNumber applies. */\n defaultBranch?: string;\n}\n\nexport interface SyncRepoResult {\n /** Local branch the fetch targets (the PR head name, pr-<n>, or the branch). */\n target: string;\n fetchedSha: string;\n /** True when the checkout was moved to the fetched head. */\n updatedCheckout: boolean;\n /** Working tree had uncommitted changes (checkout left alone). */\n dirty: boolean;\n currentBranch: string;\n /** Bot-committed (agent-made) commits on the target that origin lacks. */\n localCommits: number;\n}\n\nexport interface GithubClientOptions {\n appId: string;\n privateKey: string;\n installationId: string;\n /** Override the API root for tests; defaults to https://api.github.com */\n baseUrl?: string;\n fetchImpl?: typeof fetch;\n}\n\n// ── Host-side tool contracts (capability pack, not messaging core) ───────────\n\n/** Arguments for the host-side `github_pr` tool. */\nexport interface GithubPrRequest {\n /** Local branch in the conversation's ./repo clone; must match pi/<name>. */\n branch: string;\n title: string;\n body?: string;\n /** Target branch; defaults to the repository's default branch. */\n base?: string;\n draft?: boolean;\n}\n\nexport interface GithubPrResult {\n number: number;\n url: string;\n /** True when the branch already had an open PR that this push updated. */\n updatedExisting?: boolean;\n}\n\n/** Normalized check-run row for the host-side `github_checks` tool. */\nexport interface GithubCheckSummary {\n /** Check-run id; for GitHub Actions checks it is also the job id for log fetch. */\n id: number;\n name: string;\n /** queued | in_progress | completed */\n status: string;\n /** success | failure | … ; null while the run is still in progress */\n conclusion: string | null;\n url: string | null;\n /** Slug of the reporting app; \"github-actions\" checks have fetchable logs. */\n appSlug: string | null;\n /** The reporting app's own summary of the run, when it posted one. */\n outputSummary: string | null;\n}\n\nexport interface GithubChecksFns {\n getChecks: (branch?: string) => Promise<GithubCheckSummary[]>;\n getJobLog: (jobId: number) => Promise<string>;\n}\n\n/** Arguments for the host-side `github_read` tool. */\nexport interface GithubReadRequest {\n action: \"pr\" | \"pr_files\" | \"pr_reviews\" | \"issue\" | \"comments\" | \"list\";\n /** Issue/PR number; defaults to the conversation's own. */\n number?: number;\n /** list only: open | closed | all (default open). */\n state?: string;\n /** list only: comma-separated label names. */\n labels?: string;\n /** list only: filter by author login. */\n creator?: string;\n}\n\n/** Typed payload of one `github_read` action; the tool renders it. */\nexport type GithubReadResult =\n | { kind: \"pr\"; pr: GithubPullRequest }\n | { kind: \"pr_files\"; files: GithubPullRequestFile[] }\n | { kind: \"pr_reviews\"; reviews: GithubPullRequestReview[]; threads: GithubReviewComment[] }\n | { kind: \"issue\"; issue: GithubIssue }\n | { kind: \"comments\"; comments: GithubIssueComment[] }\n | { kind: \"list\"; issues: GithubIssue[] };\n\n/** Arguments for the host-side `github_issue` tool. Deliberately a closed\n * action set: lock/delete/transfer are not offered at all. */\nexport interface GithubIssueRequest {\n action: \"add_labels\" | \"remove_label\" | \"add_assignees\" | \"remove_assignees\" | \"close\" | \"reopen\";\n /** Issue/PR number; defaults to the conversation's own (triage may target others). */\n number?: number;\n /** add_labels */\n labels?: string[];\n /** remove_label */\n label?: string;\n /** add_assignees / remove_assignees */\n assignees?: string[];\n /** close */\n state_reason?: \"completed\" | \"not_planned\";\n}\n\n/**\n * Host-side GitHub operations for github_* tools. Wired in main.ts over the\n * GitHub bot; tokens stay host-side. Consumed by `createGithubToolPack`.\n */\nexport type GithubSyncFn = (branch?: string) => Promise<string>;\n\nexport type GithubReviewReplyFn = (commentId: number, body: string) => Promise<{ url: string }>;\n\nexport type GithubReadFn = (request: GithubReadRequest) => Promise<GithubReadResult>;\n\nexport type GithubIssueFn = (request: GithubIssueRequest) => Promise<string>;\n\nexport interface PlatformGithubOps {\n /** Push a prepared pi/* branch and open (or update) a pull request. */\n pushAndCreatePr(conversationId: string, request: GithubPrRequest): Promise<GithubPrResult>;\n /** CI check runs for a branch, or for the conversation's PR head when omitted. */\n getChecks(conversationId: string, branch?: string): Promise<GithubCheckSummary[]>;\n /** Log text of one CI job (an Actions check-run id), tail-truncated. */\n getJobLog(conversationId: string, jobId: number): Promise<string>;\n /** Reply inside one inline review thread of the conversation's PR. */\n replyToReviewThread(\n conversationId: string,\n commentId: number,\n body: string,\n ): Promise<{ url: string }>;\n /** Refresh the conversation's ./repo clone; returns a human-readable report. */\n syncRepo(conversationId: string, branch?: string): Promise<string>;\n /** Read PR/issue metadata the clone cannot provide; same repo only. */\n readGithub(conversationId: string, request: GithubReadRequest): Promise<GithubReadResult>;\n /** Label/assignee/state management on this repo's issues; returns a report. */\n manageIssue(conversationId: string, request: GithubIssueRequest): Promise<string>;\n}\n\nexport interface GithubWebhookOptions {\n secret: string;\n /** Called after signature verification for relevant events. */\n onPoke: () => void;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"progressive-renderer.d.ts","sourceRoot":"","sources":["../../src/adapters/progressive-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EAEtB,MAAM,eAAe,CAAC;AAQvB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CASvE;AAoCD,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,2BAA2B,GAAG;IAChF,SAAS,EAAE,qBAAqB,CAAC;CAClC,CA+eA"}
1
+ {"version":3,"file":"progressive-renderer.d.ts","sourceRoot":"","sources":["../../src/adapters/progressive-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EAEtB,MAAM,eAAe,CAAC;AAQvB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAE9D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CASvE;AAqhBD,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,2BAA2B,GAAG;IAChF,SAAS,EAAE,qBAAqB,CAAC;CAClC,CAEA"}