@geminixiang/mikan 1.5.1 → 1.6.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/adapters/commands/login.js +1 -1
  3. package/dist/adapters/commands/login.js.map +1 -1
  4. package/dist/adapters/commands/manifest.js +1 -1
  5. package/dist/adapters/commands/manifest.js.map +1 -1
  6. package/dist/adapters/commands/model.d.ts.map +1 -1
  7. package/dist/adapters/commands/model.js.map +1 -1
  8. package/dist/adapters/commands/types.d.ts +3 -2
  9. package/dist/adapters/commands/types.d.ts.map +1 -1
  10. package/dist/adapters/commands/types.js.map +1 -1
  11. package/dist/adapters/discord/bot.d.ts +2 -3
  12. package/dist/adapters/discord/bot.d.ts.map +1 -1
  13. package/dist/adapters/discord/bot.js +8 -20
  14. package/dist/adapters/discord/bot.js.map +1 -1
  15. package/dist/adapters/discord/context.d.ts.map +1 -1
  16. package/dist/adapters/discord/context.js +7 -23
  17. package/dist/adapters/discord/context.js.map +1 -1
  18. package/dist/adapters/github/bot.d.ts +1 -2
  19. package/dist/adapters/github/bot.d.ts.map +1 -1
  20. package/dist/adapters/github/bot.js +5 -13
  21. package/dist/adapters/github/bot.js.map +1 -1
  22. package/dist/adapters/github/context.d.ts.map +1 -1
  23. package/dist/adapters/github/context.js +6 -22
  24. package/dist/adapters/github/context.js.map +1 -1
  25. package/dist/adapters/github/tools/checks.d.ts +2 -2
  26. package/dist/adapters/github/tools/checks.d.ts.map +1 -1
  27. package/dist/adapters/github/tools/checks.js +3 -3
  28. package/dist/adapters/github/tools/checks.js.map +1 -1
  29. package/dist/adapters/github/tools/issue.d.ts +2 -2
  30. package/dist/adapters/github/tools/issue.d.ts.map +1 -1
  31. package/dist/adapters/github/tools/issue.js +1 -1
  32. package/dist/adapters/github/tools/issue.js.map +1 -1
  33. package/dist/adapters/github/tools/pr.d.ts +2 -2
  34. package/dist/adapters/github/tools/pr.d.ts.map +1 -1
  35. package/dist/adapters/github/tools/pr.js +1 -1
  36. package/dist/adapters/github/tools/pr.js.map +1 -1
  37. package/dist/adapters/github/tools/read.d.ts +2 -2
  38. package/dist/adapters/github/tools/read.d.ts.map +1 -1
  39. package/dist/adapters/github/tools/read.js +1 -1
  40. package/dist/adapters/github/tools/read.js.map +1 -1
  41. package/dist/adapters/github/tools/review-reply.d.ts +2 -2
  42. package/dist/adapters/github/tools/review-reply.d.ts.map +1 -1
  43. package/dist/adapters/github/tools/review-reply.js +1 -1
  44. package/dist/adapters/github/tools/review-reply.js.map +1 -1
  45. package/dist/adapters/progressive-renderer.d.ts +1 -2
  46. package/dist/adapters/progressive-renderer.d.ts.map +1 -1
  47. package/dist/adapters/progressive-renderer.js +0 -24
  48. package/dist/adapters/progressive-renderer.js.map +1 -1
  49. package/dist/adapters/shared.d.ts +12 -2
  50. package/dist/adapters/shared.d.ts.map +1 -1
  51. package/dist/adapters/shared.js +48 -1
  52. package/dist/adapters/shared.js.map +1 -1
  53. package/dist/adapters/slack/bot.d.ts +4 -5
  54. package/dist/adapters/slack/bot.d.ts.map +1 -1
  55. package/dist/adapters/slack/bot.js +63 -87
  56. package/dist/adapters/slack/bot.js.map +1 -1
  57. package/dist/adapters/slack/response-lifecycle.d.ts.map +1 -1
  58. package/dist/adapters/slack/response-lifecycle.js +0 -28
  59. package/dist/adapters/slack/response-lifecycle.js.map +1 -1
  60. package/dist/adapters/slack/tools/blockkit.d.ts +2 -2
  61. package/dist/adapters/slack/tools/blockkit.d.ts.map +1 -1
  62. package/dist/adapters/slack/tools/blockkit.js +3 -4
  63. package/dist/adapters/slack/tools/blockkit.js.map +1 -1
  64. package/dist/adapters/slack/types.d.ts +10 -0
  65. package/dist/adapters/slack/types.d.ts.map +1 -1
  66. package/dist/adapters/slack/types.js.map +1 -1
  67. package/dist/adapters/slack/update-diagnostics.d.ts.map +1 -1
  68. package/dist/adapters/slack/update-diagnostics.js +8 -2
  69. package/dist/adapters/slack/update-diagnostics.js.map +1 -1
  70. package/dist/adapters/telegram/bot.d.ts +2 -3
  71. package/dist/adapters/telegram/bot.d.ts.map +1 -1
  72. package/dist/adapters/telegram/bot.js +8 -15
  73. package/dist/adapters/telegram/bot.js.map +1 -1
  74. package/dist/adapters/telegram/context.d.ts.map +1 -1
  75. package/dist/adapters/telegram/context.js +3 -19
  76. package/dist/adapters/telegram/context.js.map +1 -1
  77. package/dist/adapters/types.d.ts +8 -3
  78. package/dist/adapters/types.d.ts.map +1 -1
  79. package/dist/adapters/types.js.map +1 -1
  80. package/dist/adapters/web/admin/portal.d.ts +3 -8
  81. package/dist/adapters/web/admin/portal.d.ts.map +1 -1
  82. package/dist/adapters/web/admin/portal.js +35 -46
  83. package/dist/adapters/web/admin/portal.js.map +1 -1
  84. package/dist/adapters/web/desktop/index.d.ts +1 -1
  85. package/dist/adapters/web/desktop/index.d.ts.map +1 -1
  86. package/dist/adapters/web/desktop/index.js +0 -22
  87. package/dist/adapters/web/desktop/index.js.map +1 -1
  88. package/dist/adapters/web/desktop/page.d.ts.map +1 -1
  89. package/dist/adapters/web/desktop/page.js +0 -34
  90. package/dist/adapters/web/desktop/page.js.map +1 -1
  91. package/dist/adapters/web/login/portal.d.ts.map +1 -1
  92. package/dist/adapters/web/login/portal.js +54 -85
  93. package/dist/adapters/web/login/portal.js.map +1 -1
  94. package/dist/adapters/web/portal-shell.d.ts +3 -0
  95. package/dist/adapters/web/portal-shell.d.ts.map +1 -1
  96. package/dist/adapters/web/portal-shell.js +26 -0
  97. package/dist/adapters/web/portal-shell.js.map +1 -1
  98. package/dist/adapters/web/session-view/portal.d.ts.map +1 -1
  99. package/dist/adapters/web/session-view/portal.js +15 -23
  100. package/dist/adapters/web/session-view/portal.js.map +1 -1
  101. package/dist/adapters/web/types.d.ts +8 -0
  102. package/dist/adapters/web/types.d.ts.map +1 -1
  103. package/dist/adapters/web/types.js.map +1 -1
  104. package/dist/env-manifest.d.ts +1 -1
  105. package/dist/env-manifest.d.ts.map +1 -1
  106. package/dist/env-manifest.js +3 -6
  107. package/dist/env-manifest.js.map +1 -1
  108. package/dist/events/index.d.ts +3 -0
  109. package/dist/events/index.d.ts.map +1 -1
  110. package/dist/events/index.js +12 -0
  111. package/dist/events/index.js.map +1 -1
  112. package/dist/events/scheduler.d.ts +1 -1
  113. package/dist/events/scheduler.d.ts.map +1 -1
  114. package/dist/events/scheduler.js +14 -21
  115. package/dist/events/scheduler.js.map +1 -1
  116. package/dist/harness/execution-resolver.d.ts.map +1 -1
  117. package/dist/harness/execution-resolver.js +2 -8
  118. package/dist/harness/execution-resolver.js.map +1 -1
  119. package/dist/harness/jev.d.ts +2 -0
  120. package/dist/harness/jev.d.ts.map +1 -1
  121. package/dist/harness/jev.js +1 -0
  122. package/dist/harness/jev.js.map +1 -1
  123. package/dist/harness/mcp-result.d.ts +3 -3
  124. package/dist/harness/mcp-result.d.ts.map +1 -1
  125. package/dist/harness/mcp-result.js +13 -30
  126. package/dist/harness/mcp-result.js.map +1 -1
  127. package/dist/harness/mcp.d.ts.map +1 -1
  128. package/dist/harness/mcp.js +10 -23
  129. package/dist/harness/mcp.js.map +1 -1
  130. package/dist/harness/presenter.d.ts +0 -1
  131. package/dist/harness/presenter.d.ts.map +1 -1
  132. package/dist/harness/presenter.js +22 -151
  133. package/dist/harness/presenter.js.map +1 -1
  134. package/dist/harness/prompt.d.ts.map +1 -1
  135. package/dist/harness/prompt.js +9 -7
  136. package/dist/harness/prompt.js.map +1 -1
  137. package/dist/harness/run-events.d.ts +1 -0
  138. package/dist/harness/run-events.d.ts.map +1 -1
  139. package/dist/harness/run-events.js +8 -19
  140. package/dist/harness/run-events.js.map +1 -1
  141. package/dist/harness/runner.d.ts.map +1 -1
  142. package/dist/harness/runner.js +21 -131
  143. package/dist/harness/runner.js.map +1 -1
  144. package/dist/harness/session.d.ts +19 -22
  145. package/dist/harness/session.d.ts.map +1 -1
  146. package/dist/harness/session.js +285 -282
  147. package/dist/harness/session.js.map +1 -1
  148. package/dist/harness/skills.d.ts +0 -1
  149. package/dist/harness/skills.d.ts.map +1 -1
  150. package/dist/harness/skills.js +11 -16
  151. package/dist/harness/skills.js.map +1 -1
  152. package/dist/harness/tools/attach.d.ts +2 -2
  153. package/dist/harness/tools/attach.d.ts.map +1 -1
  154. package/dist/harness/tools/attach.js +2 -3
  155. package/dist/harness/tools/attach.js.map +1 -1
  156. package/dist/harness/tools/event.d.ts +2 -2
  157. package/dist/harness/tools/event.d.ts.map +1 -1
  158. package/dist/harness/tools/event.js +2 -3
  159. package/dist/harness/tools/event.js.map +1 -1
  160. package/dist/harness/tools/generate-image.d.ts +2 -2
  161. package/dist/harness/tools/generate-image.d.ts.map +1 -1
  162. package/dist/harness/tools/generate-image.js +2 -3
  163. package/dist/harness/tools/generate-image.js.map +1 -1
  164. package/dist/harness/tools/history.d.ts +2 -2
  165. package/dist/harness/tools/history.d.ts.map +1 -1
  166. package/dist/harness/tools/history.js +2 -3
  167. package/dist/harness/tools/history.js.map +1 -1
  168. package/dist/harness/tools/host-fn-tool.d.ts +8 -3
  169. package/dist/harness/tools/host-fn-tool.d.ts.map +1 -1
  170. package/dist/harness/tools/host-fn-tool.js +23 -15
  171. package/dist/harness/tools/host-fn-tool.js.map +1 -1
  172. package/dist/harness/tools/index.d.ts +4 -5
  173. package/dist/harness/tools/index.d.ts.map +1 -1
  174. package/dist/harness/tools/index.js +10 -21
  175. package/dist/harness/tools/index.js.map +1 -1
  176. package/dist/harness/tools/jev.d.ts +2 -2
  177. package/dist/harness/tools/jev.d.ts.map +1 -1
  178. package/dist/harness/tools/jev.js +3 -3
  179. package/dist/harness/tools/jev.js.map +1 -1
  180. package/dist/harness/tools/pi-tools.d.ts +3 -7
  181. package/dist/harness/tools/pi-tools.d.ts.map +1 -1
  182. package/dist/harness/tools/pi-tools.js +23 -60
  183. package/dist/harness/tools/pi-tools.js.map +1 -1
  184. package/dist/harness/tools/react.d.ts +2 -2
  185. package/dist/harness/tools/react.d.ts.map +1 -1
  186. package/dist/harness/tools/react.js +1 -1
  187. package/dist/harness/tools/react.js.map +1 -1
  188. package/dist/harness/tools/sandbox.d.ts +2 -2
  189. package/dist/harness/tools/sandbox.d.ts.map +1 -1
  190. package/dist/harness/tools/sandbox.js +2 -3
  191. package/dist/harness/tools/sandbox.js.map +1 -1
  192. package/dist/harness/tools/secret-redaction.d.ts +2 -2
  193. package/dist/harness/tools/secret-redaction.d.ts.map +1 -1
  194. package/dist/harness/tools/secret-redaction.js +24 -9
  195. package/dist/harness/tools/secret-redaction.js.map +1 -1
  196. package/dist/harness/tools/task.d.ts +6 -6
  197. package/dist/harness/tools/task.d.ts.map +1 -1
  198. package/dist/harness/tools/task.js +7 -8
  199. package/dist/harness/tools/task.js.map +1 -1
  200. package/dist/harness/tools/types.d.ts +2 -6
  201. package/dist/harness/tools/types.d.ts.map +1 -1
  202. package/dist/harness/tools/types.js.map +1 -1
  203. package/dist/harness/tools/web-fetch.d.ts +2 -2
  204. package/dist/harness/tools/web-fetch.d.ts.map +1 -1
  205. package/dist/harness/tools/web-fetch.js +2 -2
  206. package/dist/harness/tools/web-fetch.js.map +1 -1
  207. package/dist/harness/types.d.ts +13 -146
  208. package/dist/harness/types.d.ts.map +1 -1
  209. package/dist/harness/types.js.map +1 -1
  210. package/dist/index.d.ts +1 -1
  211. package/dist/index.d.ts.map +1 -1
  212. package/dist/index.js.map +1 -1
  213. package/dist/main.js +3 -9
  214. package/dist/main.js.map +1 -1
  215. package/dist/observability/index.d.ts +2 -4
  216. package/dist/observability/index.d.ts.map +1 -1
  217. package/dist/observability/index.js +3 -80
  218. package/dist/observability/index.js.map +1 -1
  219. package/dist/observability/types.d.ts +8 -16
  220. package/dist/observability/types.d.ts.map +1 -1
  221. package/dist/observability/types.js.map +1 -1
  222. package/dist/office/index.d.ts.map +1 -1
  223. package/dist/office/index.js +0 -1
  224. package/dist/office/index.js.map +1 -1
  225. package/dist/office/types.d.ts +0 -1
  226. package/dist/office/types.d.ts.map +1 -1
  227. package/dist/office/types.js.map +1 -1
  228. package/dist/runtime/conversation-runtime.d.ts.map +1 -1
  229. package/dist/runtime/conversation-runtime.js +7 -29
  230. package/dist/runtime/conversation-runtime.js.map +1 -1
  231. package/dist/runtime/session-lifecycle.d.ts +1 -3
  232. package/dist/runtime/session-lifecycle.d.ts.map +1 -1
  233. package/dist/runtime/session-lifecycle.js +5 -7
  234. package/dist/runtime/session-lifecycle.js.map +1 -1
  235. package/dist/runtime/types.d.ts +0 -2
  236. package/dist/runtime/types.d.ts.map +1 -1
  237. package/dist/runtime/types.js.map +1 -1
  238. package/dist/sandbox/desktop.d.ts +1 -11
  239. package/dist/sandbox/desktop.d.ts.map +1 -1
  240. package/dist/sandbox/desktop.js +1 -47
  241. package/dist/sandbox/desktop.js.map +1 -1
  242. package/dist/sandbox/provisioner.d.ts +1 -6
  243. package/dist/sandbox/provisioner.d.ts.map +1 -1
  244. package/dist/sandbox/provisioner.js +64 -72
  245. package/dist/sandbox/provisioner.js.map +1 -1
  246. package/dist/sandbox/types.d.ts +0 -5
  247. package/dist/sandbox/types.d.ts.map +1 -1
  248. package/dist/sandbox/types.js.map +1 -1
  249. package/dist/sandbox/utils.d.ts +0 -1
  250. package/dist/sandbox/utils.d.ts.map +1 -1
  251. package/dist/sandbox/utils.js +0 -10
  252. package/dist/sandbox/utils.js.map +1 -1
  253. package/dist/sessions/chat-history-sync.d.ts +1 -2
  254. package/dist/sessions/chat-history-sync.d.ts.map +1 -1
  255. package/dist/sessions/chat-history-sync.js +1 -14
  256. package/dist/sessions/chat-history-sync.js.map +1 -1
  257. package/dist/sessions/compaction-summary.d.ts +2 -2
  258. package/dist/sessions/compaction-summary.d.ts.map +1 -1
  259. package/dist/sessions/compaction-summary.js.map +1 -1
  260. package/dist/sessions/session-key.d.ts +6 -0
  261. package/dist/sessions/session-key.d.ts.map +1 -1
  262. package/dist/sessions/session-key.js +7 -0
  263. package/dist/sessions/session-key.js.map +1 -1
  264. package/dist/sessions/session-store.d.ts +5 -9
  265. package/dist/sessions/session-store.d.ts.map +1 -1
  266. package/dist/sessions/session-store.js +45 -86
  267. package/dist/sessions/session-store.js.map +1 -1
  268. package/dist/sessions/types.d.ts +4 -8
  269. package/dist/sessions/types.d.ts.map +1 -1
  270. package/dist/sessions/types.js.map +1 -1
  271. package/dist/settings/index.d.ts +4 -4
  272. package/dist/settings/index.d.ts.map +1 -1
  273. package/dist/settings/index.js +13 -14
  274. package/dist/settings/index.js.map +1 -1
  275. package/dist/types.d.ts +3 -40
  276. package/dist/types.d.ts.map +1 -1
  277. package/dist/types.js.map +1 -1
  278. package/dist/unknown-values.d.ts +2 -0
  279. package/dist/unknown-values.d.ts.map +1 -1
  280. package/dist/unknown-values.js +6 -0
  281. package/dist/unknown-values.js.map +1 -1
  282. package/dist/vault/index.d.ts +0 -1
  283. package/dist/vault/index.d.ts.map +1 -1
  284. package/dist/vault/index.js +0 -15
  285. package/dist/vault/index.js.map +1 -1
  286. package/dist/vault/types.d.ts +0 -1
  287. package/dist/vault/types.d.ts.map +1 -1
  288. package/dist/vault/types.js.map +1 -1
  289. package/package.json +7 -8
  290. package/dist/adapters/slack/persona.d.ts +0 -6
  291. package/dist/adapters/slack/persona.d.ts.map +0 -1
  292. package/dist/adapters/slack/persona.js +0 -13
  293. package/dist/adapters/slack/persona.js.map +0 -1
  294. package/dist/harness/loop-guard.d.ts +0 -10
  295. package/dist/harness/loop-guard.d.ts.map +0 -1
  296. package/dist/harness/loop-guard.js +0 -111
  297. package/dist/harness/loop-guard.js.map +0 -1
  298. package/dist/harness/subagent-profiles.d.ts +0 -3
  299. package/dist/harness/subagent-profiles.d.ts.map +0 -1
  300. package/dist/harness/subagent-profiles.js +0 -260
  301. package/dist/harness/subagent-profiles.js.map +0 -1
  302. package/dist/harness/subagent.d.ts +0 -39
  303. package/dist/harness/subagent.d.ts.map +0 -1
  304. package/dist/harness/subagent.js +0 -613
  305. package/dist/harness/subagent.js.map +0 -1
  306. package/dist/harness/tools/codemode.d.ts +0 -5
  307. package/dist/harness/tools/codemode.d.ts.map +0 -1
  308. package/dist/harness/tools/codemode.js +0 -253
  309. package/dist/harness/tools/codemode.js.map +0 -1
  310. package/dist/harness/tools/jev-browser.d.ts +0 -53
  311. package/dist/harness/tools/jev-browser.d.ts.map +0 -1
  312. package/dist/harness/tools/jev-browser.js +0 -730
  313. package/dist/harness/tools/jev-browser.js.map +0 -1
  314. package/dist/harness/tools/subagent.d.ts +0 -51
  315. package/dist/harness/tools/subagent.d.ts.map +0 -1
  316. package/dist/harness/tools/subagent.js +0 -581
  317. package/dist/harness/tools/subagent.js.map +0 -1
  318. package/dist/harness/tools/tool-search.d.ts +0 -6
  319. package/dist/harness/tools/tool-search.d.ts.map +0 -1
  320. package/dist/harness/tools/tool-search.js +0 -146
  321. package/dist/harness/tools/tool-search.js.map +0 -1
  322. package/dist/memory-capture/index.d.ts +0 -15
  323. package/dist/memory-capture/index.d.ts.map +0 -1
  324. package/dist/memory-capture/index.js +0 -198
  325. package/dist/memory-capture/index.js.map +0 -1
  326. package/dist/memory-capture/types.d.ts +0 -27
  327. package/dist/memory-capture/types.d.ts.map +0 -1
  328. package/dist/memory-capture/types.js +0 -2
  329. package/dist/memory-capture/types.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/adapters/github/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAC7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACjG,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AASxD,SAAS,eAAe,CACtB,YAA2C,EAC3C,GAA0B,EAC1B,QAAyC;IAEzC,MAAM,MAAM,GAAG,QAAQ;QACrB,CAAC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} from \"../../types.js\";\nimport { createConversationMessage, parseGithubConversationId } from \"../../office/index.js\";\nimport { resolveChatSessionKey } from \"../../sessions/session-key.js\";\nimport { createProgressiveRenderer, formatMarkdownToolResult } from \"../progressive-renderer.js\";\nimport { formatGithubContinuation } from \"./bot.js\";\nimport { GITHUB_MAX_COMMENT_LENGTH } from \"./client.js\";\nimport type {\n GithubCapability,\n GithubAgentIdentity,\n GithubConversationBot,\n GithubEvent,\n} from \"./types.js\";\nimport type { GithubConversationRef } from \"../../office/types.js\";\n\nfunction repositoryGuide(\n capabilities: ReadonlySet<GithubCapability>,\n ref: GithubConversationRef,\n identity: GithubAgentIdentity | undefined,\n): string {\n const author = identity\n ? `Commit as the agent account: git config user.name \"${identity.login}\" and ` +\n `git config user.email \"${identity.email}\". `\n : \"\";\n const clone =\n `## Repository & pull requests\\n` +\n `Nothing is cloned for you. When you need the code, clone it into your scratch ` +\n `directory with git clone https://github.com/${ref.owner}/${ref.repo}.git; if this ` +\n `conversation is a pull request, run gh pr checkout ${ref.number} inside the clone. ` +\n `git and gh use the GitHub credentials of this sandbox, if it has any; without them ` +\n `only public repositories are reachable. ${author}\\n`;\n const shipping = capabilities.has(\"push\")\n ? `To ship code changes: push a new branch (for example pi/fix-${ref.number}), never ` +\n `the default branch, which is protected, then call github_pr with that branch to ` +\n `open a pull request (draft: true for a draft). To update this pull request, push ` +\n `to its head branch; no github_pr call is needed. Use github_checks to read CI ` +\n `results for your branch (or this PR) — pass a failing check's job id to read its ` +\n `log — and iterate until they pass. Humans review and merge every PR.\\n`\n : `Do not push branches or open pull requests here: propose code changes in your ` +\n `reply (for example as a diff or suggestion block) for a human to apply. Use ` +\n `github_checks to read this pull request's CI results.\\n`;\n const lookup =\n `github_read looks up PR/issue metadata that a clone does not show (diff stats, ` +\n `changed files, review state, other issues in this repo)` +\n (capabilities.has(\"triage\")\n ? `; github_issue manages labels, assignees, and close/reopen for triage.`\n : `.`);\n return clone + shipping + lookup;\n}\n\nexport function createGithubAdapters(\n event: GithubEvent,\n bot: GithubConversationBot,\n): ConversationContext {\n const conversationId = event.address.conversationId;\n const ref = parseGithubConversationId(conversationId);\n\n const message = createConversationMessage({\n platform: \"github\",\n conversationId,\n address: event.address,\n id: event.ts,\n sessionKey:\n event.sessionKey ??\n resolveChatSessionKey({\n conversationId,\n conversationKind: event.conversationKind,\n messageId: event.ts,\n persistentTopLevel: true,\n threadTs: event.thread_ts,\n }),\n conversationKind: event.conversationKind,\n userId: event.user,\n userName: event.userName,\n text: event.text,\n attachments: event.attachments,\n threadTs: event.thread_ts,\n });\n const baseInfo = bot.getMessagingInfo();\n const platform = {\n ...baseInfo,\n formattingGuide:\n `${baseInfo.formattingGuide}\\n\\n` +\n `## Conversation context\\n` +\n `This conversation IS GitHub issue/PR ${ref.owner}/${ref.repo}#${ref.number}: the ` +\n `first message in the history is its title and body, and the following messages are ` +\n `its comments. When the user says \"this issue\", they mean #${ref.number}. Messages ` +\n `tagged [PR review comment rc-<id> …] are inline review threads on a diff line: ` +\n `answer those with the github_review_reply tool (comment_id = that id) so the reply ` +\n `lands in-thread — your normal response posts as a plain PR comment.\\n\\n` +\n repositoryGuide(bot.capabilities, ref, bot.agentIdentity),\n diagnostics: {\n showUsageSummary: false,\n },\n };\n\n const { responder } = createProgressiveRenderer({\n label: \"GitHub\",\n maxLength: GITHUB_MAX_COMMENT_LENGTH,\n formatContinuation: formatGithubContinuation,\n errorPrefix: \"**Error:** \",\n formatToolResult: formatMarkdownToolResult,\n logIntermediateResponses: true,\n responseErrorContext: (responseId) => ({\n platform: \"github\",\n conversationId,\n messageId: message.id,\n sessionKey: message.sessionKey,\n responseMessageId: responseId === null ? null : Number(responseId),\n conversationKind: message.conversationKind,\n }),\n post: async (text) => {\n return String(await bot.postComment(ref, text));\n },\n update: (id, text) => bot.updateMessage(conversationId, id, text),\n postExtra: async (text) => bot.postComment(ref, text),\n delete: async (id) => {\n await bot.deleteComment(ref, Number(id));\n },\n logBotResponse: (text, id) =>\n bot.logBotResponse(conversationId, text, id, undefined, {\n answer: { replyTo: message.id, sessionKey: message.sessionKey },\n }),\n uploadFallbackNote: (name) =>\n `*(file \\`${name}\\` was produced, but the GitHub adapter cannot attach files to comments)*`,\n react: (emoji) => bot.addReaction(conversationId, event.ts, emoji),\n });\n\n return { address: message.address, message, responder, platform };\n}\n"]}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/adapters/github/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AASxD,SAAS,eAAe,CACtB,YAA2C,EAC3C,GAA0B,EAC1B,QAAyC;IAEzC,MAAM,MAAM,GAAG,QAAQ;QACrB,CAAC,CAAC,sDAAsD,QAAQ,CAAC,KAAK,QAAQ;YAC5E,0BAA0B,QAAQ,CAAC,KAAK,KAAK;QAC/C,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,KAAK,GACT,iCAAiC;QACjC,gFAAgF;QAChF,+CAA+C,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,IAAI,gBAAgB;QACpF,sDAAsD,GAAG,CAAC,MAAM,qBAAqB;QACrF,qFAAqF;QACrF,2CAA2C,MAAM,IAAI,CAAC;IACxD,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC;QACvC,CAAC,CAAC,+DAA+D,GAAG,CAAC,MAAM,WAAW;YACpF,kFAAkF;YAClF,mFAAmF;YACnF,gFAAgF;YAChF,mFAAmF;YACnF,wEAAwE;QAC1E,CAAC,CAAC,gFAAgF;YAChF,8EAA8E;YAC9E,yDAAyD,CAAC;IAC9D,MAAM,MAAM,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CAAC,CAAC;IAEH,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AACpE,CAAC","sourcesContent":["import type { ConversationContext } from \"../../types.js\";\nimport { parseGithubConversationId } from \"../../office/index.js\";\nimport { createProgressiveRenderer } from \"../progressive-renderer.js\";\nimport { createEventMessage, persistentTopLevelSessionKey } from \"../shared.js\";\nimport { formatGithubContinuation } from \"./bot.js\";\nimport { GITHUB_MAX_COMMENT_LENGTH } from \"./client.js\";\nimport type {\n GithubCapability,\n GithubAgentIdentity,\n GithubConversationBot,\n GithubEvent,\n} from \"./types.js\";\nimport type { GithubConversationRef } from \"../../office/types.js\";\n\nfunction repositoryGuide(\n capabilities: ReadonlySet<GithubCapability>,\n ref: GithubConversationRef,\n identity: GithubAgentIdentity | undefined,\n): string {\n const author = identity\n ? `Commit as the agent account: git config user.name \"${identity.login}\" and ` +\n `git config user.email \"${identity.email}\". `\n : \"\";\n const clone =\n `## Repository & pull requests\\n` +\n `Nothing is cloned for you. When you need the code, clone it into your scratch ` +\n `directory with git clone https://github.com/${ref.owner}/${ref.repo}.git; if this ` +\n `conversation is a pull request, run gh pr checkout ${ref.number} inside the clone. ` +\n `git and gh use the GitHub credentials of this sandbox, if it has any; without them ` +\n `only public repositories are reachable. ${author}\\n`;\n const shipping = capabilities.has(\"push\")\n ? `To ship code changes: push a new branch (for example pi/fix-${ref.number}), never ` +\n `the default branch, which is protected, then call github_pr with that branch to ` +\n `open a pull request (draft: true for a draft). To update this pull request, push ` +\n `to its head branch; no github_pr call is needed. Use github_checks to read CI ` +\n `results for your branch (or this PR) — pass a failing check's job id to read its ` +\n `log — and iterate until they pass. Humans review and merge every PR.\\n`\n : `Do not push branches or open pull requests here: propose code changes in your ` +\n `reply (for example as a diff or suggestion block) for a human to apply. Use ` +\n `github_checks to read this pull request's CI results.\\n`;\n const lookup =\n `github_read looks up PR/issue metadata that a clone does not show (diff stats, ` +\n `changed files, review state, other issues in this repo)` +\n (capabilities.has(\"triage\")\n ? `; github_issue manages labels, assignees, and close/reopen for triage.`\n : `.`);\n return clone + shipping + lookup;\n}\n\nexport function createGithubAdapters(\n event: GithubEvent,\n bot: GithubConversationBot,\n): ConversationContext {\n const conversationId = event.address.conversationId;\n const ref = parseGithubConversationId(conversationId);\n\n const message = createEventMessage({\n platform: \"github\",\n event,\n sessionKey: persistentTopLevelSessionKey(event),\n });\n const baseInfo = bot.getMessagingInfo();\n const platform = {\n ...baseInfo,\n formattingGuide:\n `${baseInfo.formattingGuide}\\n\\n` +\n `## Conversation context\\n` +\n `This conversation IS GitHub issue/PR ${ref.owner}/${ref.repo}#${ref.number}: the ` +\n `first message in the history is its title and body, and the following messages are ` +\n `its comments. When the user says \"this issue\", they mean #${ref.number}. Messages ` +\n `tagged [PR review comment rc-<id> …] are inline review threads on a diff line: ` +\n `answer those with the github_review_reply tool (comment_id = that id) so the reply ` +\n `lands in-thread — your normal response posts as a plain PR comment.\\n\\n` +\n repositoryGuide(bot.capabilities, ref, bot.agentIdentity),\n diagnostics: {\n showUsageSummary: false,\n },\n };\n\n const { responder } = createProgressiveRenderer({\n label: \"GitHub\",\n maxLength: GITHUB_MAX_COMMENT_LENGTH,\n formatContinuation: formatGithubContinuation,\n errorPrefix: \"**Error:** \",\n logIntermediateResponses: true,\n responseErrorContext: (responseId) => ({\n platform: \"github\",\n conversationId,\n messageId: message.id,\n sessionKey: message.sessionKey,\n responseMessageId: responseId === null ? null : Number(responseId),\n conversationKind: message.conversationKind,\n }),\n post: async (text) => {\n return String(await bot.postComment(ref, text));\n },\n update: (id, text) => bot.updateMessage(conversationId, id, text),\n postExtra: async (text) => bot.postComment(ref, text),\n delete: async (id) => {\n await bot.deleteComment(ref, Number(id));\n },\n logBotResponse: (text, id) =>\n bot.logBotResponse(conversationId, text, id, undefined, {\n answer: { replyTo: message.id, sessionKey: message.sessionKey },\n }),\n uploadFallbackNote: (name) =>\n `*(file \\`${name}\\` was produced, but the GitHub adapter cannot attach files to comments)*`,\n react: (emoji) => bot.addReaction(conversationId, event.ts, emoji),\n });\n\n return { address: message.address, message, responder, platform };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { AgentTool } from "@earendil-works/pi-agent-core";
1
+ import type { ToolRegistration } from "@earendil-works/pi-durable";
2
2
  import { Type } from "typebox";
3
3
  import type { GithubChecksFns } from "../types.js";
4
4
  export declare const GITHUB_CHECKS_TOOL = "github_checks";
@@ -7,7 +7,7 @@ declare const githubChecksSchema: Type.TObject<{
7
7
  job_id: Type.TOptional<Type.TNumber>;
8
8
  }>;
9
9
  export declare function createGithubChecksTool(): {
10
- tool: AgentTool<typeof githubChecksSchema>;
10
+ tool: ToolRegistration<typeof githubChecksSchema>;
11
11
  setGithubChecksFunction: (fns: GithubChecksFns | null) => void;
12
12
  };
13
13
  export {};
@@ -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;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,KAAK,EAAsB,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvE,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAElD,QAAA,MAAM,kBAAkB;;;EAetB,CAAC;AAuBH,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"}
1
+ {"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/checks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,KAAK,EAAsB,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvE,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAElD,QAAA,MAAM,kBAAkB;;;EAetB,CAAC;AAuBH,wBAAgB,sBAAsB,IAAI;IACxC,IAAI,EAAE,gBAAgB,CAAC,OAAO,kBAAkB,CAAC,CAAC;IAClD,uBAAuB,EAAE,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI,KAAK,IAAI,CAAC;CAChE,CAmDA"}
@@ -43,14 +43,14 @@ export function createGithubChecksTool() {
43
43
  if (args.job_id !== undefined) {
44
44
  const logText = await checksFns.getJobLog(args.job_id);
45
45
  return {
46
- content: [{ type: "text", text: logText || "(empty log)" }],
46
+ output: [{ type: "text", text: logText || "(empty log)" }],
47
47
  details: undefined,
48
48
  };
49
49
  }
50
50
  const runs = await checksFns.getChecks(args.branch);
51
51
  if (runs.length === 0) {
52
52
  return {
53
- content: [
53
+ output: [
54
54
  {
55
55
  type: "text",
56
56
  text: "No CI jobs or commit statuses found — CI may not have started yet; try again shortly.",
@@ -63,7 +63,7 @@ export function createGithubChecksTool() {
63
63
  const failing = completed.filter((run) => run.conclusion !== null && FAILING_CONCLUSIONS.has(run.conclusion));
64
64
  const summary = `${runs.length} check(s): ${completed.length} completed, ${runs.length - completed.length} running, ${failing.length} failing`;
65
65
  return {
66
- content: [
66
+ output: [
67
67
  {
68
68
  type: "text",
69
69
  text: [summary, ...runs.map(formatCheckLine)].join("\n"),
@@ -1 +1 @@
1
- {"version":3,"file":"checks.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/checks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAG1E,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAElD,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC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AE,EAAE,CAAC,GAAG,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC;YACnE,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAC9B,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,KAAK,IAAI,IAAI,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAC5E,CAAC;YACF,MAAM,OAAO,GAAG,GAAG,IAAI,CAAC,MAAM,cAAc,SAAS,CAAC,MAAM,eAAe,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,aAAa,OAAO,CAAC,MAAM,UAAU,CAAC;YAC/I,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;qBACzD;iBACF;gBACD,OAAO,EAAE,SAAS;aACnB,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 \"typebox\";\nimport { defineHostFnTool } from \"../../../harness/tools/host-fn-tool.js\";\nimport type { GithubCheckSummary, GithubChecksFns } from \"../types.js\";\n\nexport const GITHUB_CHECKS_TOOL = \"github_checks\";\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\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.source === \"actions\" ? `[job ${run.id}]` : \"[commit status — 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\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_TOOL,\n description:\n \"Read CI status (GitHub Actions jobs and commit statuses) for a branch you pushed, 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 job's log. Commit statuses from external \" +\n \"CI keep logs on their own service: use \" +\n \"their summary/url, or reproduce the failure locally in your clone. Only available in \" +\n \"GitHub conversations.\",\n parameters: githubChecksSchema,\n unavailable: `${GITHUB_CHECKS_TOOL} 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 CI jobs or commit statuses 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,SAAS,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAG1E,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAElD,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,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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AE,CAAC;AAClD,CAAC","sourcesContent":["import type { ToolRegistration } from \"@earendil-works/pi-durable\";\nimport { Type } from \"typebox\";\nimport { defineHostFnTool } from \"../../../harness/tools/host-fn-tool.js\";\nimport type { GithubCheckSummary, GithubChecksFns } from \"../types.js\";\n\nexport const GITHUB_CHECKS_TOOL = \"github_checks\";\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\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.source === \"actions\" ? `[job ${run.id}]` : \"[commit status — 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\nexport function createGithubChecksTool(): {\n tool: ToolRegistration<typeof githubChecksSchema>;\n setGithubChecksFunction: (fns: GithubChecksFns | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<GithubChecksFns, typeof githubChecksSchema>({\n name: GITHUB_CHECKS_TOOL,\n description:\n \"Read CI status (GitHub Actions jobs and commit statuses) for a branch you pushed, 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 job's log. Commit statuses from external \" +\n \"CI keep logs on their own service: use \" +\n \"their summary/url, or reproduce the failure locally in your clone. Only available in \" +\n \"GitHub conversations.\",\n parameters: githubChecksSchema,\n unavailable: `${GITHUB_CHECKS_TOOL} 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 output: [{ 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 output: [\n {\n type: \"text\" as const,\n text: \"No CI jobs or commit statuses 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 output: [\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,4 +1,4 @@
1
- import type { AgentTool } from "@earendil-works/pi-agent-core";
1
+ import type { ToolRegistration } from "@earendil-works/pi-durable";
2
2
  import { Type } from "typebox";
3
3
  import type { GithubIssueFn } from "../types.js";
4
4
  export declare const GITHUB_ISSUE_TOOL = "github_issue";
@@ -11,7 +11,7 @@ declare const githubIssueSchema: Type.TObject<{
11
11
  state_reason: Type.TOptional<Type.TUnion<[Type.TLiteral<"completed">, Type.TLiteral<"not_planned">]>>;
12
12
  }>;
13
13
  export declare function createGithubIssueTool(): {
14
- tool: AgentTool<typeof githubIssueSchema>;
14
+ tool: ToolRegistration<typeof githubIssueSchema>;
15
15
  setGithubIssueFunction: (fn: GithubIssueFn | null) => void;
16
16
  };
17
17
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"issue.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/issue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,aAAa,CAAC;AAErE,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,QAAA,MAAM,iBAAiB;;;;;;;EA+BrB,CAAC;AAEH,wBAAgB,qBAAqB,IAAI;IACvC,IAAI,EAAE,SAAS,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAC1C,sBAAsB,EAAE,CAAC,EAAE,EAAE,aAAa,GAAG,IAAI,KAAK,IAAI,CAAC;CAC5D,CAoBA"}
1
+ {"version":3,"file":"issue.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/issue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,aAAa,CAAC;AAErE,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,QAAA,MAAM,iBAAiB;;;;;;;EA+BrB,CAAC;AAEH,wBAAgB,qBAAqB,IAAI;IACvC,IAAI,EAAE,gBAAgB,CAAC,OAAO,iBAAiB,CAAC,CAAC;IACjD,sBAAsB,EAAE,CAAC,EAAE,EAAE,aAAa,GAAG,IAAI,KAAK,IAAI,CAAC;CAC5D,CAoBA"}
@@ -34,7 +34,7 @@ export function createGithubIssueTool() {
34
34
  run: async (issueFn, args) => {
35
35
  const report = await issueFn(args);
36
36
  return {
37
- content: [{ type: "text", text: report }],
37
+ output: [{ type: "text", text: report }],
38
38
  details: undefined,
39
39
  };
40
40
  },
@@ -1 +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,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE;QACnE,WAAW,EAAE,uCAAuC;KACrD,CAAC,CACH;CACF,CAAC,CAAC;AAEH,MAAM,UAAU,qBAAqB;IAInC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,gBAAgB,CAA0C;QAChF,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,6EAA6E;YAC7E,mFAAmF;YACnF,kFAAkF;YAClF,gBAAgB;QAClB,UAAU,EAAE,iBAAiB;QAC7B,WAAW,EAAE,GAAG,iBAAiB,6CAA6C;QAC9E,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;YAC3B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAA0B,CAAC,CAAC;YACzD,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gBAClD,OAAO,EAAE,SAAS;aACnB,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAAC;AACjD,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Type } from \"typebox\";\nimport { defineHostFnTool } from \"../../../harness/tools/host-fn-tool.js\";\nimport type { GithubIssueFn, GithubIssueRequest } from \"../types.js\";\n\nexport const GITHUB_ISSUE_TOOL = \"github_issue\";\n\nconst githubIssueSchema = Type.Object({\n action: Type.Union(\n [\n Type.Literal(\"add_labels\"),\n Type.Literal(\"remove_label\"),\n Type.Literal(\"add_assignees\"),\n Type.Literal(\"remove_assignees\"),\n Type.Literal(\"close\"),\n Type.Literal(\"reopen\"),\n ],\n { description: \"Issue management action.\" },\n ),\n number: Type.Optional(\n Type.Number({\n description: \"Issue/PR number in this repo; omit for this conversation's own.\",\n }),\n ),\n labels: Type.Optional(\n Type.Array(Type.String(), { description: \"add_labels: label names to add.\" }),\n ),\n label: Type.Optional(Type.String({ description: \"remove_label: the label name to remove.\" })),\n assignees: Type.Optional(\n Type.Array(Type.String(), {\n description: \"add_assignees / remove_assignees: GitHub logins.\",\n }),\n ),\n state_reason: Type.Optional(\n Type.Union([Type.Literal(\"completed\"), Type.Literal(\"not_planned\")], {\n description: \"close: why the issue is being closed.\",\n }),\n ),\n});\n\nexport function createGithubIssueTool(): {\n tool: AgentTool<typeof githubIssueSchema>;\n setGithubIssueFunction: (fn: GithubIssueFn | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<GithubIssueFn, typeof githubIssueSchema>({\n name: GITHUB_ISSUE_TOOL,\n description:\n \"Manage issues in this repo: add/remove labels, add/remove assignees, close \" +\n \"(optionally with state_reason) or reopen. number defaults to this conversation's \" +\n \"issue; any issue number in this repo works for triage. Only available in GitHub \" +\n \"conversations.\",\n parameters: githubIssueSchema,\n unavailable: `${GITHUB_ISSUE_TOOL} is only available in GitHub conversations.`,\n run: async (issueFn, args) => {\n const report = await issueFn(args as GithubIssueRequest);\n return {\n content: [{ type: \"text\" as const, text: report }],\n details: undefined,\n };\n },\n });\n\n return { tool, setGithubIssueFunction: setFn };\n}\n"]}
1
+ {"version":3,"file":"issue.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/issue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAG1E,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAEhD,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC;IACpC,MAAM,EAAE,IAAI,CAAC,KAAK,CAChB;QACE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;QAC1B,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QAC5B,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;QAC7B,IAAI,CAAC,OA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M,OAAO,CAAC,IAA0B,CAAC,CAAC;YACzD,OAAO;gBACL,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gBACjD,OAAO,EAAE,SAAS;aACnB,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,KAAK,EAAE,CAAC;AACjD,CAAC","sourcesContent":["import type { ToolRegistration } from \"@earendil-works/pi-durable\";\nimport { Type } from \"typebox\";\nimport { defineHostFnTool } from \"../../../harness/tools/host-fn-tool.js\";\nimport type { GithubIssueFn, GithubIssueRequest } from \"../types.js\";\n\nexport const GITHUB_ISSUE_TOOL = \"github_issue\";\n\nconst githubIssueSchema = Type.Object({\n action: Type.Union(\n [\n Type.Literal(\"add_labels\"),\n Type.Literal(\"remove_label\"),\n Type.Literal(\"add_assignees\"),\n Type.Literal(\"remove_assignees\"),\n Type.Literal(\"close\"),\n Type.Literal(\"reopen\"),\n ],\n { description: \"Issue management action.\" },\n ),\n number: Type.Optional(\n Type.Number({\n description: \"Issue/PR number in this repo; omit for this conversation's own.\",\n }),\n ),\n labels: Type.Optional(\n Type.Array(Type.String(), { description: \"add_labels: label names to add.\" }),\n ),\n label: Type.Optional(Type.String({ description: \"remove_label: the label name to remove.\" })),\n assignees: Type.Optional(\n Type.Array(Type.String(), {\n description: \"add_assignees / remove_assignees: GitHub logins.\",\n }),\n ),\n state_reason: Type.Optional(\n Type.Union([Type.Literal(\"completed\"), Type.Literal(\"not_planned\")], {\n description: \"close: why the issue is being closed.\",\n }),\n ),\n});\n\nexport function createGithubIssueTool(): {\n tool: ToolRegistration<typeof githubIssueSchema>;\n setGithubIssueFunction: (fn: GithubIssueFn | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<GithubIssueFn, typeof githubIssueSchema>({\n name: GITHUB_ISSUE_TOOL,\n description:\n \"Manage issues in this repo: add/remove labels, add/remove assignees, close \" +\n \"(optionally with state_reason) or reopen. number defaults to this conversation's \" +\n \"issue; any issue number in this repo works for triage. Only available in GitHub \" +\n \"conversations.\",\n parameters: githubIssueSchema,\n unavailable: `${GITHUB_ISSUE_TOOL} is only available in GitHub conversations.`,\n run: async (issueFn, args) => {\n const report = await issueFn(args as GithubIssueRequest);\n return {\n output: [{ type: \"text\" as const, text: report }],\n details: undefined,\n };\n },\n });\n\n return { tool, setGithubIssueFunction: setFn };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { AgentTool } from "@earendil-works/pi-agent-core";
1
+ import type { ToolRegistration } from "@earendil-works/pi-durable";
2
2
  import { Type } from "typebox";
3
3
  import type { GithubPrRequest, GithubPrResult } from "../types.js";
4
4
  export declare const GITHUB_PR_TOOL = "github_pr";
@@ -10,7 +10,7 @@ declare const githubPrSchema: Type.TObject<{
10
10
  draft: Type.TOptional<Type.TBoolean>;
11
11
  }>;
12
12
  export declare function createGithubPrTool(): {
13
- tool: AgentTool<typeof githubPrSchema>;
13
+ tool: ToolRegistration<typeof githubPrSchema>;
14
14
  setGithubPrFunction: (fn: ((request: GithubPrRequest) => Promise<GithubPrResult>) | null) => void;
15
15
  };
16
16
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"pr.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/pr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEnE,eAAO,MAAM,cAAc,cAAc,CAAC;AAE1C,QAAA,MAAM,cAAc;;;;;;EAYlB,CAAC;AAIH,wBAAgB,kBAAkB,IAAI;IACpC,IAAI,EAAE,SAAS,CAAC,OAAO,cAAc,CAAC,CAAC;IACvC,mBAAmB,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;CACnG,CA8BA"}
1
+ {"version":3,"file":"pr.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/pr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEnE,eAAO,MAAM,cAAc,cAAc,CAAC;AAE1C,QAAA,MAAM,cAAc;;;;;;EAYlB,CAAC;AAIH,wBAAgB,kBAAkB,IAAI;IACpC,IAAI,EAAE,gBAAgB,CAAC,OAAO,cAAc,CAAC,CAAC;IAC9C,mBAAmB,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;CACnG,CA8BA"}
@@ -23,7 +23,7 @@ export function createGithubPrTool() {
23
23
  run: async (prFn, args) => {
24
24
  const result = await prFn(args);
25
25
  return {
26
- content: [
26
+ output: [
27
27
  {
28
28
  type: "text",
29
29
  text: result.updatedExisting
@@ -1 +1 @@
1
- {"version":3,"file":"pr.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/pr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAG1E,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAE1C,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC;IACjC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;QAClB,WAAW,EACT,sFAAsF;YACtF,eAAe;KAClB,CAAC;IACF,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WA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sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Type } from \"typebox\";\nimport { defineHostFnTool } from \"../../../harness/tools/host-fn-tool.js\";\nimport type { GithubPrRequest, GithubPrResult } from \"../types.js\";\n\nexport const GITHUB_PR_TOOL = \"github_pr\";\n\nconst githubPrSchema = Type.Object({\n branch: Type.String({\n description:\n 'Branch you already pushed from your sandbox (e.g. \"pi/fix-42\"); it becomes the pull ' +\n \"request head.\",\n }),\n title: Type.String({ description: \"Pull request title.\" }),\n body: Type.Optional(Type.String({ description: \"Pull request description (Markdown).\" })),\n base: Type.Optional(\n Type.String({ description: \"Target branch; defaults to the repository's default branch.\" }),\n ),\n draft: Type.Optional(Type.Boolean({ description: \"Open as a draft pull request.\" })),\n});\n\ntype GithubPrArgs = GithubPrRequest;\n\nexport function createGithubPrTool(): {\n tool: AgentTool<typeof githubPrSchema>;\n setGithubPrFunction: (fn: ((request: GithubPrRequest) => Promise<GithubPrResult>) | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<\n (request: GithubPrRequest) => Promise<GithubPrResult>,\n typeof githubPrSchema\n >({\n name: GITHUB_PR_TOOL,\n description:\n \"Open a GitHub pull request (or draft) for a branch you already pushed with git from \" +\n \"your sandbox. If the branch already has an open PR, returns that PR instead of \" +\n \"opening another. Only available in GitHub issue/PR conversations. You cannot merge — \" +\n \"humans review and merge the PR.\",\n parameters: githubPrSchema,\n unavailable: `${GITHUB_PR_TOOL} is only available in GitHub conversations.`,\n run: async (prFn, args: GithubPrArgs) => {\n const result = await prFn(args);\n return {\n content: [\n {\n type: \"text\" as const,\n text: result.updatedExisting\n ? `Branch already has PR #${result.number}: ${result.url}`\n : `Opened ${args.draft ? \"draft \" : \"\"}PR #${result.number}: ${result.url}`,\n },\n ],\n details: undefined,\n };\n },\n });\n\n return { tool, setGithubPrFunction: setFn };\n}\n"]}
1
+ {"version":3,"file":"pr.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/pr.ts"],"names":[],"mapp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AAC,MAAM,KAAK,MAAM,CAAC,GAAG,EAAE;4BAC1D,CAAC,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,GAAG,EAAE;qBAC9E;iBACF;gBACD,OAAO,EAAE,SAAS;aACnB,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC;AAC9C,CAAC","sourcesContent":["import type { ToolRegistration } from \"@earendil-works/pi-durable\";\nimport { Type } from \"typebox\";\nimport { defineHostFnTool } from \"../../../harness/tools/host-fn-tool.js\";\nimport type { GithubPrRequest, GithubPrResult } from \"../types.js\";\n\nexport const GITHUB_PR_TOOL = \"github_pr\";\n\nconst githubPrSchema = Type.Object({\n branch: Type.String({\n description:\n 'Branch you already pushed from your sandbox (e.g. \"pi/fix-42\"); it becomes the pull ' +\n \"request head.\",\n }),\n title: Type.String({ description: \"Pull request title.\" }),\n body: Type.Optional(Type.String({ description: \"Pull request description (Markdown).\" })),\n base: Type.Optional(\n Type.String({ description: \"Target branch; defaults to the repository's default branch.\" }),\n ),\n draft: Type.Optional(Type.Boolean({ description: \"Open as a draft pull request.\" })),\n});\n\ntype GithubPrArgs = GithubPrRequest;\n\nexport function createGithubPrTool(): {\n tool: ToolRegistration<typeof githubPrSchema>;\n setGithubPrFunction: (fn: ((request: GithubPrRequest) => Promise<GithubPrResult>) | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<\n (request: GithubPrRequest) => Promise<GithubPrResult>,\n typeof githubPrSchema\n >({\n name: GITHUB_PR_TOOL,\n description:\n \"Open a GitHub pull request (or draft) for a branch you already pushed with git from \" +\n \"your sandbox. If the branch already has an open PR, returns that PR instead of \" +\n \"opening another. Only available in GitHub issue/PR conversations. You cannot merge — \" +\n \"humans review and merge the PR.\",\n parameters: githubPrSchema,\n unavailable: `${GITHUB_PR_TOOL} is only available in GitHub conversations.`,\n run: async (prFn, args: GithubPrArgs) => {\n const result = await prFn(args);\n return {\n output: [\n {\n type: \"text\" as const,\n text: result.updatedExisting\n ? `Branch already has PR #${result.number}: ${result.url}`\n : `Opened ${args.draft ? \"draft \" : \"\"}PR #${result.number}: ${result.url}`,\n },\n ],\n details: undefined,\n };\n },\n });\n\n return { tool, setGithubPrFunction: setFn };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { AgentTool } from "@earendil-works/pi-agent-core";
1
+ import type { ToolRegistration } from "@earendil-works/pi-durable";
2
2
  import { Type } from "typebox";
3
3
  import type { GithubReadFn } from "../types.js";
4
4
  export declare const GITHUB_READ_TOOL = "github_read";
@@ -10,7 +10,7 @@ declare const githubReadSchema: Type.TObject<{
10
10
  creator: Type.TOptional<Type.TString>;
11
11
  }>;
12
12
  export declare function createGithubReadTool(): {
13
- tool: AgentTool<typeof githubReadSchema>;
13
+ tool: ToolRegistration<typeof githubReadSchema>;
14
14
  setGithubReadFunction: (fn: GithubReadFn | null) => void;
15
15
  };
16
16
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,KAAK,EAEV,YAAY,EAGb,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,gBAAgB,gBAAgB,CAAC;AAE9C,QAAA,MAAM,gBAAgB;;;;;;EA8BpB,CAAC;AA4GH,wBAAgB,oBAAoB,IAAI;IACtC,IAAI,EAAE,SAAS,CAAC,OAAO,gBAAgB,CAAC,CAAC;IACzC,qBAAqB,EAAE,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,KAAK,IAAI,CAAC;CAC1D,CAoBA"}
1
+ {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,KAAK,EAEV,YAAY,EAGb,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,gBAAgB,gBAAgB,CAAC;AAE9C,QAAA,MAAM,gBAAgB;;;;;;EA8BpB,CAAC;AA4GH,wBAAgB,oBAAoB,IAAI;IACtC,IAAI,EAAE,gBAAgB,CAAC,OAAO,gBAAgB,CAAC,CAAC;IAChD,qBAAqB,EAAE,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,KAAK,IAAI,CAAC;CAC1D,CAoBA"}
@@ -124,7 +124,7 @@ export function createGithubReadTool() {
124
124
  run: async (readFn, args) => {
125
125
  const result = await readFn(args);
126
126
  return {
127
- content: [{ type: "text", text: formatResult(result) }],
127
+ output: [{ type: "text", text: formatResult(result) }],
128
128
  details: undefined,
129
129
  };
130
130
  },
@@ -1 +1 @@
1
- {"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/read.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAQ1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE9C,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,IAAI,CAAC,KAAK,CAChB;QACE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;QAC1B,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QACrB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;QACxB,IAAI,CAAC,OAAO,CA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OAAO,CAAC;gBACjD,OAAO,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,KAAK,IAAI,GAAG,IAAI,IAAI,KAAK,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;YAC1G,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC,IAAI,qBAAqB,CACvC,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB;IAIlC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,gBAAgB,CAAwC;QAC9E,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACT,8EAA8E;YAC9E,oFAAoF;YACpF,qFAAqF;YACrF,0EAA0E;QAC5E,UAAU,EAAE,gBAAgB;QAC5B,WAAW,EAAE,GAAG,gBAAgB,6CAA6C;QAC7E,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;YAC1B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAyB,CAAC,CAAC;YACvD,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;gBAChE,OAAO,EAAE,SAAS;aACnB,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC;AAChD,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Type } from \"typebox\";\nimport { defineHostFnTool } from \"../../../harness/tools/host-fn-tool.js\";\nimport type {\n GithubPullRequest,\n GithubReadFn,\n GithubReadRequest,\n GithubReadResult,\n} from \"../types.js\";\n\nexport const GITHUB_READ_TOOL = \"github_read\";\n\nconst githubReadSchema = Type.Object({\n action: Type.Union(\n [\n Type.Literal(\"pr\"),\n Type.Literal(\"pr_files\"),\n Type.Literal(\"pr_reviews\"),\n Type.Literal(\"issue\"),\n Type.Literal(\"comments\"),\n Type.Literal(\"list\"),\n ],\n {\n description:\n \"pr: PR metadata (state, base/head, diff stats). pr_files: changed files. \" +\n \"pr_reviews: submitted reviews + open inline threads (with rc- ids for \" +\n \"github_review_reply). issue: issue metadata. comments: recent conversation \" +\n \"comments. list: issues/PRs in this repo.\",\n },\n ),\n number: Type.Optional(\n Type.Number({\n description: \"Issue/PR number to read; omit for this conversation's own.\",\n }),\n ),\n state: Type.Optional(\n Type.String({ description: \"list only: open | closed | all (default open).\" }),\n ),\n labels: Type.Optional(\n Type.String({ description: \"list only: comma-separated label names to filter by.\" }),\n ),\n creator: Type.Optional(Type.String({ description: \"list only: filter by author login.\" })),\n});\n\nconst MAX_BODY_CHARS = 1000;\nconst MAX_COMMENT_CHARS = 500;\nconst MAX_REVIEW_BODY_CHARS = 300;\n\nfunction truncate(text: string, max: number): string {\n return text.length > max ? `${text.slice(0, max)}…` : text;\n}\n\nfunction formatPr(pr: GithubPullRequest): string {\n const flags = [\n pr.state ?? \"unknown\",\n pr.draft ? \"draft\" : null,\n pr.merged ? \"merged\" : null,\n pr.mergeable_state ? `mergeable_state: ${pr.mergeable_state}` : null,\n ].filter(Boolean);\n return [\n `PR #${pr.number}: ${pr.title ?? \"\"} [${flags.join(\", \")}]`,\n `${pr.head?.ref ?? \"?\"} → ${pr.base?.ref ?? \"?\"} | ${pr.changed_files ?? \"?\"} files, +${pr.additions ?? \"?\"} -${pr.deletions ?? \"?\"}`,\n pr.user ? `author: @${pr.user.login}` : null,\n pr.body ? truncate(pr.body, MAX_BODY_CHARS) : \"(no description)\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n}\n\nfunction formatReviews({\n reviews,\n threads,\n}: Extract<GithubReadResult, { kind: \"pr_reviews\" }>): string {\n const reviewLines = reviews\n .filter((review) => review.state !== \"PENDING\")\n .map((review) => {\n const body = review.body?.trim() ? ` — ${truncate(review.body, MAX_REVIEW_BODY_CHARS)}` : \"\";\n return `@${review.user.login}: ${review.state}${body}`;\n });\n const replyCounts = new Map<number | undefined, number>();\n for (const { in_reply_to_id: parent } of threads) {\n replyCounts.set(parent, (replyCounts.get(parent) ?? 0) + 1);\n }\n const threadLines = threads\n .filter((comment) => comment.in_reply_to_id === undefined)\n .map((comment) => {\n const location = comment.line !== null ? `${comment.path}:${comment.line}` : comment.path;\n const count = replyCounts.get(comment.id) ?? 0;\n const replyNote = count ? ` (${count} repl${count === 1 ? \"y\" : \"ies\"})` : \"\";\n return `rc-${comment.id} ${location} @${comment.user.login}${replyNote}: ${truncate(comment.body, MAX_REVIEW_BODY_CHARS)}`;\n });\n return [\n reviewLines.length ? `Reviews:\\n${reviewLines.join(\"\\n\")}` : \"No submitted reviews.\",\n threadLines.length\n ? `Inline threads (reply with github_review_reply):\\n${threadLines.join(\"\\n\")}`\n : \"No inline review threads.\",\n ].join(\"\\n\\n\");\n}\n\nfunction formatResult(result: GithubReadResult): string {\n switch (result.kind) {\n case \"pr\":\n return formatPr(result.pr);\n case \"pr_files\": {\n if (result.files.length === 0) return \"No changed files.\";\n const lines = result.files.map(\n (file) => `${file.status.padEnd(8)} ${file.filename} +${file.additions} -${file.deletions}`,\n );\n return [`${result.files.length} changed file(s):`, ...lines].join(\"\\n\");\n }\n case \"pr_reviews\":\n return formatReviews(result);\n case \"issue\": {\n const issue = result.issue;\n const labels = (issue.labels ?? []).map((label) => label.name).join(\", \");\n const assignees = (issue.assignees ?? []).map((assignee) => `@${assignee.login}`).join(\", \");\n return [\n `#${issue.number}: ${issue.title} [${issue.state ?? \"unknown\"}${issue.pull_request ? \", PR\" : \"\"}]`,\n labels ? `labels: ${labels}` : null,\n assignees ? `assignees: ${assignees}` : null,\n `author: @${issue.user.login}`,\n issue.body ? truncate(issue.body, MAX_BODY_CHARS) : \"(no body)\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n }\n case \"comments\": {\n return (\n result.comments\n .map(\n (comment) =>\n `@${comment.user.login} (${comment.created_at}): ${truncate(comment.body, MAX_COMMENT_CHARS)}`,\n )\n .join(\"\\n\") || \"No comments.\"\n );\n }\n case \"list\": {\n return (\n result.issues\n .map((issue) => {\n const labels = (issue.labels ?? []).map((label) => label.name).join(\", \");\n const kind = issue.pull_request ? \"PR\" : \"issue\";\n return `#${issue.number} [${issue.state ?? \"?\"} ${kind}] ${issue.title}${labels ? ` (${labels})` : \"\"}`;\n })\n .join(\"\\n\") || \"No matching issues.\"\n );\n }\n }\n}\n\nexport function createGithubReadTool(): {\n tool: AgentTool<typeof githubReadSchema>;\n setGithubReadFunction: (fn: GithubReadFn | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<GithubReadFn, typeof githubReadSchema>({\n name: GITHUB_READ_TOOL,\n description:\n \"Read GitHub metadata for this repo: PR state/diff stats (pr), changed files \" +\n \"(pr_files), reviews and open inline threads (pr_reviews), issue metadata (issue), \" +\n \"recent comments (comments), or a filtered issue/PR listing (list). number defaults \" +\n \"to this conversation's issue/PR. Only available in GitHub conversations.\",\n parameters: githubReadSchema,\n unavailable: `${GITHUB_READ_TOOL} is only available in GitHub conversations.`,\n run: async (readFn, args) => {\n const result = await readFn(args as GithubReadRequest);\n return {\n content: [{ type: \"text\" as const, text: formatResult(result) }],\n details: undefined,\n };\n },\n });\n\n return { tool, setGithubReadFunction: setFn };\n}\n"]}
1
+ {"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/read.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAQ1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE9C,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,IAAI,CAAC,KAAK,CAChB;QACE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QAClB,IAAI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G,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC1E,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;gBACjD,OAAO,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,KAAK,IAAI,GAAG,IAAI,IAAI,KAAK,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;YAC1G,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC,IAAI,qBAAqB,CACvC,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB;IAIlC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,gBAAgB,CAAwC;QAC9E,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACT,8EAA8E;YAC9E,oFAAoF;YACpF,qFAAqF;YACrF,0EAA0E;QAC5E,UAAU,EAAE,gBAAgB;QAC5B,WAAW,EAAE,GAAG,gBAAgB,6CAA6C;QAC7E,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;YAC1B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAyB,CAAC,CAAC;YACvD,OAAO;gBACL,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC/D,OAAO,EAAE,SAAS;aACnB,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAE,KAAK,EAAE,CAAC;AAChD,CAAC","sourcesContent":["import type { ToolRegistration } from \"@earendil-works/pi-durable\";\nimport { Type } from \"typebox\";\nimport { defineHostFnTool } from \"../../../harness/tools/host-fn-tool.js\";\nimport type {\n GithubPullRequest,\n GithubReadFn,\n GithubReadRequest,\n GithubReadResult,\n} from \"../types.js\";\n\nexport const GITHUB_READ_TOOL = \"github_read\";\n\nconst githubReadSchema = Type.Object({\n action: Type.Union(\n [\n Type.Literal(\"pr\"),\n Type.Literal(\"pr_files\"),\n Type.Literal(\"pr_reviews\"),\n Type.Literal(\"issue\"),\n Type.Literal(\"comments\"),\n Type.Literal(\"list\"),\n ],\n {\n description:\n \"pr: PR metadata (state, base/head, diff stats). pr_files: changed files. \" +\n \"pr_reviews: submitted reviews + open inline threads (with rc- ids for \" +\n \"github_review_reply). issue: issue metadata. comments: recent conversation \" +\n \"comments. list: issues/PRs in this repo.\",\n },\n ),\n number: Type.Optional(\n Type.Number({\n description: \"Issue/PR number to read; omit for this conversation's own.\",\n }),\n ),\n state: Type.Optional(\n Type.String({ description: \"list only: open | closed | all (default open).\" }),\n ),\n labels: Type.Optional(\n Type.String({ description: \"list only: comma-separated label names to filter by.\" }),\n ),\n creator: Type.Optional(Type.String({ description: \"list only: filter by author login.\" })),\n});\n\nconst MAX_BODY_CHARS = 1000;\nconst MAX_COMMENT_CHARS = 500;\nconst MAX_REVIEW_BODY_CHARS = 300;\n\nfunction truncate(text: string, max: number): string {\n return text.length > max ? `${text.slice(0, max)}…` : text;\n}\n\nfunction formatPr(pr: GithubPullRequest): string {\n const flags = [\n pr.state ?? \"unknown\",\n pr.draft ? \"draft\" : null,\n pr.merged ? \"merged\" : null,\n pr.mergeable_state ? `mergeable_state: ${pr.mergeable_state}` : null,\n ].filter(Boolean);\n return [\n `PR #${pr.number}: ${pr.title ?? \"\"} [${flags.join(\", \")}]`,\n `${pr.head?.ref ?? \"?\"} → ${pr.base?.ref ?? \"?\"} | ${pr.changed_files ?? \"?\"} files, +${pr.additions ?? \"?\"} -${pr.deletions ?? \"?\"}`,\n pr.user ? `author: @${pr.user.login}` : null,\n pr.body ? truncate(pr.body, MAX_BODY_CHARS) : \"(no description)\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n}\n\nfunction formatReviews({\n reviews,\n threads,\n}: Extract<GithubReadResult, { kind: \"pr_reviews\" }>): string {\n const reviewLines = reviews\n .filter((review) => review.state !== \"PENDING\")\n .map((review) => {\n const body = review.body?.trim() ? ` — ${truncate(review.body, MAX_REVIEW_BODY_CHARS)}` : \"\";\n return `@${review.user.login}: ${review.state}${body}`;\n });\n const replyCounts = new Map<number | undefined, number>();\n for (const { in_reply_to_id: parent } of threads) {\n replyCounts.set(parent, (replyCounts.get(parent) ?? 0) + 1);\n }\n const threadLines = threads\n .filter((comment) => comment.in_reply_to_id === undefined)\n .map((comment) => {\n const location = comment.line !== null ? `${comment.path}:${comment.line}` : comment.path;\n const count = replyCounts.get(comment.id) ?? 0;\n const replyNote = count ? ` (${count} repl${count === 1 ? \"y\" : \"ies\"})` : \"\";\n return `rc-${comment.id} ${location} @${comment.user.login}${replyNote}: ${truncate(comment.body, MAX_REVIEW_BODY_CHARS)}`;\n });\n return [\n reviewLines.length ? `Reviews:\\n${reviewLines.join(\"\\n\")}` : \"No submitted reviews.\",\n threadLines.length\n ? `Inline threads (reply with github_review_reply):\\n${threadLines.join(\"\\n\")}`\n : \"No inline review threads.\",\n ].join(\"\\n\\n\");\n}\n\nfunction formatResult(result: GithubReadResult): string {\n switch (result.kind) {\n case \"pr\":\n return formatPr(result.pr);\n case \"pr_files\": {\n if (result.files.length === 0) return \"No changed files.\";\n const lines = result.files.map(\n (file) => `${file.status.padEnd(8)} ${file.filename} +${file.additions} -${file.deletions}`,\n );\n return [`${result.files.length} changed file(s):`, ...lines].join(\"\\n\");\n }\n case \"pr_reviews\":\n return formatReviews(result);\n case \"issue\": {\n const issue = result.issue;\n const labels = (issue.labels ?? []).map((label) => label.name).join(\", \");\n const assignees = (issue.assignees ?? []).map((assignee) => `@${assignee.login}`).join(\", \");\n return [\n `#${issue.number}: ${issue.title} [${issue.state ?? \"unknown\"}${issue.pull_request ? \", PR\" : \"\"}]`,\n labels ? `labels: ${labels}` : null,\n assignees ? `assignees: ${assignees}` : null,\n `author: @${issue.user.login}`,\n issue.body ? truncate(issue.body, MAX_BODY_CHARS) : \"(no body)\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n }\n case \"comments\": {\n return (\n result.comments\n .map(\n (comment) =>\n `@${comment.user.login} (${comment.created_at}): ${truncate(comment.body, MAX_COMMENT_CHARS)}`,\n )\n .join(\"\\n\") || \"No comments.\"\n );\n }\n case \"list\": {\n return (\n result.issues\n .map((issue) => {\n const labels = (issue.labels ?? []).map((label) => label.name).join(\", \");\n const kind = issue.pull_request ? \"PR\" : \"issue\";\n return `#${issue.number} [${issue.state ?? \"?\"} ${kind}] ${issue.title}${labels ? ` (${labels})` : \"\"}`;\n })\n .join(\"\\n\") || \"No matching issues.\"\n );\n }\n }\n}\n\nexport function createGithubReadTool(): {\n tool: ToolRegistration<typeof githubReadSchema>;\n setGithubReadFunction: (fn: GithubReadFn | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<GithubReadFn, typeof githubReadSchema>({\n name: GITHUB_READ_TOOL,\n description:\n \"Read GitHub metadata for this repo: PR state/diff stats (pr), changed files \" +\n \"(pr_files), reviews and open inline threads (pr_reviews), issue metadata (issue), \" +\n \"recent comments (comments), or a filtered issue/PR listing (list). number defaults \" +\n \"to this conversation's issue/PR. Only available in GitHub conversations.\",\n parameters: githubReadSchema,\n unavailable: `${GITHUB_READ_TOOL} is only available in GitHub conversations.`,\n run: async (readFn, args) => {\n const result = await readFn(args as GithubReadRequest);\n return {\n output: [{ type: \"text\" as const, text: formatResult(result) }],\n details: undefined,\n };\n },\n });\n\n return { tool, setGithubReadFunction: setFn };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { AgentTool } from "@earendil-works/pi-agent-core";
1
+ import type { ToolRegistration } from "@earendil-works/pi-durable";
2
2
  import { Type } from "typebox";
3
3
  export declare const GITHUB_REVIEW_REPLY_TOOL = "github_review_reply";
4
4
  declare const githubReviewReplySchema: Type.TObject<{
@@ -7,7 +7,7 @@ declare const githubReviewReplySchema: Type.TObject<{
7
7
  }>;
8
8
  import type { GithubReviewReplyFn } from "../types.js";
9
9
  export declare function createGithubReviewReplyTool(): {
10
- tool: AgentTool<typeof githubReviewReplySchema>;
10
+ tool: ToolRegistration<typeof githubReviewReplySchema>;
11
11
  setGithubReviewReplyFunction: (fn: GithubReviewReplyFn | null) => void;
12
12
  };
13
13
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"review-reply.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/review-reply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAE9D,QAAA,MAAM,uBAAuB;;;EAO3B,CAAC;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,wBAAgB,2BAA2B,IAAI;IAC7C,IAAI,EAAE,SAAS,CAAC,OAAO,uBAAuB,CAAC,CAAC;IAChD,4BAA4B,EAAE,CAAC,EAAE,EAAE,mBAAmB,GAAG,IAAI,KAAK,IAAI,CAAC;CACxE,CAwBA"}
1
+ {"version":3,"file":"review-reply.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/review-reply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAE9D,QAAA,MAAM,uBAAuB;;;EAO3B,CAAC;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,wBAAgB,2BAA2B,IAAI;IAC7C,IAAI,EAAE,gBAAgB,CAAC,OAAO,uBAAuB,CAAC,CAAC;IACvD,4BAA4B,EAAE,CAAC,EAAE,EAAE,mBAAmB,GAAG,IAAI,KAAK,IAAI,CAAC;CACxE,CAwBA"}
@@ -19,7 +19,7 @@ export function createGithubReviewReplyTool() {
19
19
  run: async (replyFn, args) => {
20
20
  const result = await replyFn(args.comment_id, args.body);
21
21
  return {
22
- content: [
22
+ output: [
23
23
  {
24
24
  type: "text",
25
25
  text: `Replied in review thread rc-${args.comment_id}: ${result.url}`,
@@ -1 +1 @@
1
- {"version":3,"file":"review-reply.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/review-reply.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAAqB,CAAC;AAE9D,MAAM,uBAAuB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC1C,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;QACtB,WAAW,EACT,gFAAgF;YAChF,wEAAwE;KAC3E,CAAC;IACF,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;CAC7D,CAAC,CAAC;AAIH,MAAM,UAAU,2BAA2B;IAIzC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,gBAAgB,CAAsD;QAC5F,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EACT,uEAAuE;YACvE,mFAAmF;YACnF,yFAAyF;QAC3F,UAAU,EAAE,uBAAuB;QACnC,WAAW,EAAE,GAAG,wBAAwB,6CAA6C;QACrF,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;YAC3B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACzD,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,+BAA+B,IAAI,CAAC,UAAU,KAAK,MAAM,CAAC,GAAG,EAAE;qBACtE;iBACF;gBACD,OAAO,EAAE,SAAS;aACnB,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,4BAA4B,EAAE,KAAK,EAAE,CAAC;AACvD,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Type } from \"typebox\";\nimport { defineHostFnTool } from \"../../../harness/tools/host-fn-tool.js\";\n\nexport const GITHUB_REVIEW_REPLY_TOOL = \"github_review_reply\";\n\nconst githubReviewReplySchema = Type.Object({\n comment_id: Type.Number({\n description:\n \"Numeric id from an [PR review comment rc-<id> …] message in this conversation \" +\n \"(e.g. 8001 for rc-8001). The reply lands inside that comment's thread.\",\n }),\n body: Type.String({ description: \"Reply text (Markdown).\" }),\n});\n\nimport type { GithubReviewReplyFn } from \"../types.js\";\n\nexport function createGithubReviewReplyTool(): {\n tool: AgentTool<typeof githubReviewReplySchema>;\n setGithubReviewReplyFunction: (fn: GithubReviewReplyFn | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<GithubReviewReplyFn, typeof githubReviewReplySchema>({\n name: GITHUB_REVIEW_REPLY_TOOL,\n description:\n \"Reply inside a specific PR review thread. Use the numeric id from an \" +\n \"[PR review comment rc-<id> …] message as comment_id; a plain response would post \" +\n \"as a normal PR comment instead of in-thread. Only available in GitHub PR conversations.\",\n parameters: githubReviewReplySchema,\n unavailable: `${GITHUB_REVIEW_REPLY_TOOL} is only available in GitHub conversations.`,\n run: async (replyFn, args) => {\n const result = await replyFn(args.comment_id, args.body);\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Replied in review thread rc-${args.comment_id}: ${result.url}`,\n },\n ],\n details: undefined,\n };\n },\n });\n\n return { tool, setGithubReviewReplyFunction: setFn };\n}\n"]}
1
+ {"version":3,"file":"review-reply.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/review-reply.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAE1E,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAAqB,CAAC;AAE9D,MAAM,uBAAuB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC1C,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC;QACtB,WAAW,EACT,gFAAgF;YAChF,wEAAwE;KAC3E,CAAC;IACF,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,wBAAwB,EAAE,CAAC;CAC7D,CAAC,CAAC;AAIH,MAAM,UAAU,2BAA2B;IAIzC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,gBAAgB,CAAsD;QAC5F,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EACT,uEAAuE;YACvE,mFAAmF;YACnF,yFAAyF;QAC3F,UAAU,EAAE,uBAAuB;QACnC,WAAW,EAAE,GAAG,wBAAwB,6CAA6C;QACrF,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;YAC3B,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACzD,OAAO;gBACL,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,+BAA+B,IAAI,CAAC,UAAU,KAAK,MAAM,CAAC,GAAG,EAAE;qBACtE;iBACF;gBACD,OAAO,EAAE,SAAS;aACnB,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,IAAI,EAAE,4BAA4B,EAAE,KAAK,EAAE,CAAC;AACvD,CAAC","sourcesContent":["import type { ToolRegistration } from \"@earendil-works/pi-durable\";\nimport { Type } from \"typebox\";\nimport { defineHostFnTool } from \"../../../harness/tools/host-fn-tool.js\";\n\nexport const GITHUB_REVIEW_REPLY_TOOL = \"github_review_reply\";\n\nconst githubReviewReplySchema = Type.Object({\n comment_id: Type.Number({\n description:\n \"Numeric id from an [PR review comment rc-<id> …] message in this conversation \" +\n \"(e.g. 8001 for rc-8001). The reply lands inside that comment's thread.\",\n }),\n body: Type.String({ description: \"Reply text (Markdown).\" }),\n});\n\nimport type { GithubReviewReplyFn } from \"../types.js\";\n\nexport function createGithubReviewReplyTool(): {\n tool: ToolRegistration<typeof githubReviewReplySchema>;\n setGithubReviewReplyFunction: (fn: GithubReviewReplyFn | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<GithubReviewReplyFn, typeof githubReviewReplySchema>({\n name: GITHUB_REVIEW_REPLY_TOOL,\n description:\n \"Reply inside a specific PR review thread. Use the numeric id from an \" +\n \"[PR review comment rc-<id> …] message as comment_id; a plain response would post \" +\n \"as a normal PR comment instead of in-thread. Only available in GitHub PR conversations.\",\n parameters: githubReviewReplySchema,\n unavailable: `${GITHUB_REVIEW_REPLY_TOOL} is only available in GitHub conversations.`,\n run: async (replyFn, args) => {\n const result = await replyFn(args.comment_id, args.body);\n return {\n output: [\n {\n type: \"text\" as const,\n text: `Replied in review thread rc-${args.comment_id}: ${result.url}`,\n },\n ],\n details: undefined,\n };\n },\n });\n\n return { tool, setGithubReviewReplyFunction: setFn };\n}\n"]}
@@ -1,6 +1,5 @@
1
- import type { ChatToolResult, ConversationResponder } from "../types.js";
1
+ import type { ConversationResponder } from "../types.js";
2
2
  import type { ProgressiveRendererPlatform } from "./types.js";
3
- export declare function formatMarkdownToolResult(result: ChatToolResult): string;
4
3
  export declare function createProgressiveRenderer(platform: ProgressiveRendererPlatform): {
5
4
  responder: ConversationResponder;
6
5
  };
@@ -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,EAGtB,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAA8B,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAI1F,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CASvE;AAgeD,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,2BAA2B,GAAG;IAChF,SAAS,EAAE,qBAAqB,CAAC;CAClC,CAEA"}
1
+ {"version":3,"file":"progressive-renderer.d.ts","sourceRoot":"","sources":["../../src/adapters/progressive-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAA0B,MAAM,aAAa,CAAC;AAGjF,OAAO,KAAK,EAA8B,2BAA2B,EAAE,MAAM,YAAY,CAAC;AA4c1F,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,2BAA2B,GAAG;IAChF,SAAS,EAAE,qBAAqB,CAAC;CAClC,CAEA"}
@@ -1,19 +1,6 @@
1
1
  import * as log from "../log.js";
2
2
  import { createChatResponseErrorReporter, splitText } from "./shared.js";
3
- import { formatToolArgs } from "../harness/tool-args.js";
4
3
  import { errorMessage } from "../unknown-values.js";
5
- export function formatMarkdownToolResult(result) {
6
- const argsFormatted = formatToolArgs(result.args);
7
- const duration = (result.durationMs / 1000).toFixed(1);
8
- let text = `**${result.isError ? "Error" : "Done"} ${result.toolName}**`;
9
- if (result.label)
10
- text += `: ${result.label}`;
11
- text += ` (${duration}s)\n`;
12
- if (argsFormatted)
13
- text += `\`\`\`\n${argsFormatted}\n\`\`\`\n`;
14
- text += `**Result:**\n\`\`\`\n${result.result}\n\`\`\``;
15
- return text;
16
- }
17
4
  const DEFAULT_FLUSH_INTERVAL_MS = 1000;
18
5
  class ProgressiveRenderer {
19
6
  constructor(platform) {
@@ -47,11 +34,7 @@ class ProgressiveRenderer {
47
34
  respond: (text) => this.respond(text),
48
35
  showsPartialAnswer: Boolean(this.platform.showsPartialAnswer || this.platform.stream),
49
36
  replaceResponse: (text, options) => this.replaceResponse(text, options),
50
- replaceSubagentProgress: this.platform.formatSubagentProgress
51
- ? (progress, finalText, options) => this.replaceSubagentProgress(progress, finalText, options)
52
- : undefined,
53
37
  respondDiagnostic: (text, options) => this.respondDiagnostic(text, options),
54
- respondToolResult: (result) => this.respondToolResult(result),
55
38
  setTyping: (isTyping) => this.setTyping(isTyping),
56
39
  setWorking: (working) => this.setWorking(working),
57
40
  uploadFile: (filePath, title) => this.uploadFile(filePath, title),
@@ -298,10 +281,6 @@ class ProgressiveRenderer {
298
281
  await this.renderRaw(display, "render", options, prepared);
299
282
  }
300
283
  }
301
- async replaceSubagentProgress(progress, finalText, options) {
302
- const dashboard = this.platform.formatSubagentProgress(progress);
303
- await this.responder.replaceResponse(finalText ? `${dashboard}\n\n${finalText}` : dashboard, options);
304
- }
305
284
  async respondDiagnostic(text, options = {}) {
306
285
  await this.run("respondDiagnostic", "respond_diagnostic", async () => {
307
286
  const ids = this.platform.postDiagnostic
@@ -310,9 +289,6 @@ class ProgressiveRenderer {
310
289
  this.state.extraIds.push(...ids);
311
290
  }, () => ({ textLength: text.length, style: options.style }));
312
291
  }
313
- async respondToolResult(result) {
314
- await this.responder.respondDiagnostic(this.platform.formatToolResult(result));
315
- }
316
292
  async setTyping(isTyping) {
317
293
  await this.run("setTyping", "set_working", async () => {
318
294
  if (this.platform.setTyping) {