@geminixiang/mikan 1.0.0-beta.2 → 1.0.0-beta.21

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 (497) hide show
  1. package/CHANGELOG.md +388 -0
  2. package/README.md +49 -16
  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/buffered-responder.d.ts +60 -0
  7. package/dist/adapters/buffered-responder.d.ts.map +1 -0
  8. package/dist/adapters/buffered-responder.js +201 -0
  9. package/dist/adapters/buffered-responder.js.map +1 -0
  10. package/dist/adapters/discord/bot.d.ts +1 -0
  11. package/dist/adapters/discord/bot.d.ts.map +1 -1
  12. package/dist/adapters/discord/bot.js +36 -67
  13. package/dist/adapters/discord/bot.js.map +1 -1
  14. package/dist/adapters/discord/context.d.ts.map +1 -1
  15. package/dist/adapters/discord/context.js +44 -204
  16. package/dist/adapters/discord/context.js.map +1 -1
  17. package/dist/adapters/github/bot.d.ts +86 -0
  18. package/dist/adapters/github/bot.d.ts.map +1 -0
  19. package/dist/adapters/github/bot.js +640 -0
  20. package/dist/adapters/github/bot.js.map +1 -0
  21. package/dist/adapters/github/client.d.ts +122 -0
  22. package/dist/adapters/github/client.d.ts.map +1 -0
  23. package/dist/adapters/github/client.js +314 -0
  24. package/dist/adapters/github/client.js.map +1 -0
  25. package/dist/adapters/github/cloudbuild.d.ts +24 -0
  26. package/dist/adapters/github/cloudbuild.d.ts.map +1 -0
  27. package/dist/adapters/github/cloudbuild.js +71 -0
  28. package/dist/adapters/github/cloudbuild.js.map +1 -0
  29. package/dist/adapters/github/context.d.ts +9 -0
  30. package/dist/adapters/github/context.d.ts.map +1 -0
  31. package/dist/adapters/github/context.js +103 -0
  32. package/dist/adapters/github/context.js.map +1 -0
  33. package/dist/adapters/github/gcp-auth.d.ts +31 -0
  34. package/dist/adapters/github/gcp-auth.d.ts.map +1 -0
  35. package/dist/adapters/github/gcp-auth.js +196 -0
  36. package/dist/adapters/github/gcp-auth.js.map +1 -0
  37. package/dist/adapters/github/github-ops.d.ts +90 -0
  38. package/dist/adapters/github/github-ops.d.ts.map +1 -0
  39. package/dist/adapters/github/github-ops.js +405 -0
  40. package/dist/adapters/github/github-ops.js.map +1 -0
  41. package/dist/adapters/github/ids.d.ts +34 -0
  42. package/dist/adapters/github/ids.d.ts.map +1 -0
  43. package/dist/adapters/github/ids.js +53 -0
  44. package/dist/adapters/github/ids.js.map +1 -0
  45. package/dist/adapters/github/repo.d.ts +32 -0
  46. package/dist/adapters/github/repo.d.ts.map +1 -0
  47. package/dist/adapters/github/repo.js +141 -0
  48. package/dist/adapters/github/repo.js.map +1 -0
  49. package/dist/adapters/github/tool-pack.d.ts +14 -0
  50. package/dist/adapters/github/tool-pack.d.ts.map +1 -0
  51. package/dist/adapters/github/tool-pack.js +56 -0
  52. package/dist/adapters/github/tool-pack.js.map +1 -0
  53. package/dist/adapters/github/tools/checks.d.ts +24 -0
  54. package/dist/adapters/github/tools/checks.d.ts.map +1 -0
  55. package/dist/adapters/github/tools/checks.js +105 -0
  56. package/dist/adapters/github/tools/checks.js.map +1 -0
  57. package/dist/adapters/github/tools/issue.d.ts +22 -0
  58. package/dist/adapters/github/tools/issue.d.ts.map +1 -0
  59. package/dist/adapters/github/tools/issue.js +48 -0
  60. package/dist/adapters/github/tools/issue.js.map +1 -0
  61. package/dist/adapters/github/tools/pr.d.ts +22 -0
  62. package/dist/adapters/github/tools/pr.d.ts.map +1 -0
  63. package/dist/adapters/github/tools/pr.js +48 -0
  64. package/dist/adapters/github/tools/pr.js.map +1 -0
  65. package/dist/adapters/github/tools/read.d.ts +22 -0
  66. package/dist/adapters/github/tools/read.d.ts.map +1 -0
  67. package/dist/adapters/github/tools/read.js +141 -0
  68. package/dist/adapters/github/tools/read.js.map +1 -0
  69. package/dist/adapters/github/tools/review-reply.d.ts +19 -0
  70. package/dist/adapters/github/tools/review-reply.d.ts.map +1 -0
  71. package/dist/adapters/github/tools/review-reply.js +38 -0
  72. package/dist/adapters/github/tools/review-reply.js.map +1 -0
  73. package/dist/adapters/github/tools/sync.d.ts +17 -0
  74. package/dist/adapters/github/tools/sync.d.ts.map +1 -0
  75. package/dist/adapters/github/tools/sync.js +34 -0
  76. package/dist/adapters/github/tools/sync.js.map +1 -0
  77. package/dist/adapters/github/types.d.ts +350 -0
  78. package/dist/adapters/github/types.d.ts.map +1 -0
  79. package/dist/adapters/github/types.js +2 -0
  80. package/dist/adapters/github/types.js.map +1 -0
  81. package/dist/adapters/intake.d.ts +16 -5
  82. package/dist/adapters/intake.d.ts.map +1 -1
  83. package/dist/adapters/intake.js +79 -22
  84. package/dist/adapters/intake.js.map +1 -1
  85. package/dist/adapters/slack/bot.d.ts +8 -6
  86. package/dist/adapters/slack/bot.d.ts.map +1 -1
  87. package/dist/adapters/slack/bot.js +82 -134
  88. package/dist/adapters/slack/bot.js.map +1 -1
  89. package/dist/adapters/slack/context.d.ts.map +1 -1
  90. package/dist/adapters/slack/context.js +3 -14
  91. package/dist/adapters/slack/context.js.map +1 -1
  92. package/dist/adapters/slack/response-lifecycle.d.ts.map +1 -1
  93. package/dist/adapters/slack/response-lifecycle.js +14 -17
  94. package/dist/adapters/slack/response-lifecycle.js.map +1 -1
  95. package/dist/adapters/slack/session.d.ts.map +1 -1
  96. package/dist/adapters/slack/session.js +5 -8
  97. package/dist/adapters/slack/session.js.map +1 -1
  98. package/dist/adapters/streaming.d.ts +4 -0
  99. package/dist/adapters/streaming.d.ts.map +1 -1
  100. package/dist/adapters/streaming.js +11 -0
  101. package/dist/adapters/streaming.js.map +1 -1
  102. package/dist/adapters/telegram/bot.d.ts +1 -2
  103. package/dist/adapters/telegram/bot.d.ts.map +1 -1
  104. package/dist/adapters/telegram/bot.js +27 -62
  105. package/dist/adapters/telegram/bot.js.map +1 -1
  106. package/dist/adapters/telegram/context.d.ts.map +1 -1
  107. package/dist/adapters/telegram/context.js +37 -174
  108. package/dist/adapters/telegram/context.js.map +1 -1
  109. package/dist/adapters/types.d.ts +28 -2
  110. package/dist/adapters/types.d.ts.map +1 -1
  111. package/dist/adapters/types.js.map +1 -1
  112. package/dist/agent.d.ts +37 -14
  113. package/dist/agent.d.ts.map +1 -1
  114. package/dist/agent.js +359 -229
  115. package/dist/agent.js.map +1 -1
  116. package/dist/cli/arg-grammar.d.ts +25 -0
  117. package/dist/cli/arg-grammar.d.ts.map +1 -0
  118. package/dist/cli/arg-grammar.js +59 -0
  119. package/dist/cli/arg-grammar.js.map +1 -0
  120. package/dist/cli/boot.d.ts +16 -0
  121. package/dist/cli/boot.d.ts.map +1 -0
  122. package/dist/cli/boot.js +119 -0
  123. package/dist/cli/boot.js.map +1 -0
  124. package/dist/cli/download.d.ts.map +1 -0
  125. package/dist/cli/download.js.map +1 -0
  126. package/dist/cli/ext-git.d.ts +22 -0
  127. package/dist/cli/ext-git.d.ts.map +1 -0
  128. package/dist/cli/ext-git.js +76 -0
  129. package/dist/cli/ext-git.js.map +1 -0
  130. package/dist/cli/ext.d.ts +2 -0
  131. package/dist/cli/ext.d.ts.map +1 -0
  132. package/dist/cli/ext.js +215 -0
  133. package/dist/cli/ext.js.map +1 -0
  134. package/dist/commands/admin.d.ts.map +1 -1
  135. package/dist/commands/admin.js +2 -1
  136. package/dist/commands/admin.js.map +1 -1
  137. package/dist/commands/auto-reply.d.ts.map +1 -1
  138. package/dist/commands/auto-reply.js +2 -6
  139. package/dist/commands/auto-reply.js.map +1 -1
  140. package/dist/commands/extensions.d.ts.map +1 -1
  141. package/dist/commands/extensions.js +18 -8
  142. package/dist/commands/extensions.js.map +1 -1
  143. package/dist/commands/login.d.ts +2 -1
  144. package/dist/commands/login.d.ts.map +1 -1
  145. package/dist/commands/login.js +35 -3
  146. package/dist/commands/login.js.map +1 -1
  147. package/dist/commands/manifest.d.ts +72 -0
  148. package/dist/commands/manifest.d.ts.map +1 -0
  149. package/dist/commands/manifest.js +121 -0
  150. package/dist/commands/manifest.js.map +1 -0
  151. package/dist/commands/model.d.ts.map +1 -1
  152. package/dist/commands/model.js +11 -9
  153. package/dist/commands/model.js.map +1 -1
  154. package/dist/commands/new.d.ts.map +1 -1
  155. package/dist/commands/new.js +2 -1
  156. package/dist/commands/new.js.map +1 -1
  157. package/dist/commands/sandbox.d.ts.map +1 -1
  158. package/dist/commands/sandbox.js +23 -17
  159. package/dist/commands/sandbox.js.map +1 -1
  160. package/dist/commands/text.d.ts +2 -0
  161. package/dist/commands/text.d.ts.map +1 -0
  162. package/dist/commands/text.js +16 -0
  163. package/dist/commands/text.js.map +1 -0
  164. package/dist/commands/types.d.ts +14 -1
  165. package/dist/commands/types.d.ts.map +1 -1
  166. package/dist/commands/types.js.map +1 -1
  167. package/dist/config.d.ts +1 -3
  168. package/dist/config.d.ts.map +1 -1
  169. package/dist/config.js +98 -95
  170. package/dist/config.js.map +1 -1
  171. package/dist/env-manifest.d.ts +35 -0
  172. package/dist/env-manifest.d.ts.map +1 -0
  173. package/dist/env-manifest.js +225 -0
  174. package/dist/env-manifest.js.map +1 -0
  175. package/dist/events.d.ts.map +1 -1
  176. package/dist/events.js +9 -73
  177. package/dist/events.js.map +1 -1
  178. package/dist/execution-resolver.d.ts +4 -2
  179. package/dist/execution-resolver.d.ts.map +1 -1
  180. package/dist/execution-resolver.js +54 -41
  181. package/dist/execution-resolver.js.map +1 -1
  182. package/dist/harness/event-format.d.ts +66 -0
  183. package/dist/harness/event-format.d.ts.map +1 -0
  184. package/dist/harness/event-format.js +112 -0
  185. package/dist/harness/event-format.js.map +1 -0
  186. package/dist/harness/extensions/loader.d.ts +44 -11
  187. package/dist/harness/extensions/loader.d.ts.map +1 -1
  188. package/dist/harness/extensions/loader.js +273 -84
  189. package/dist/harness/extensions/loader.js.map +1 -1
  190. package/dist/harness/extensions/registry.d.ts +48 -1
  191. package/dist/harness/extensions/registry.d.ts.map +1 -1
  192. package/dist/harness/extensions/registry.js +146 -0
  193. package/dist/harness/extensions/registry.js.map +1 -1
  194. package/dist/harness/extensions/types.d.ts +165 -22
  195. package/dist/harness/extensions/types.d.ts.map +1 -1
  196. package/dist/harness/extensions/types.js.map +1 -1
  197. package/dist/harness/index.d.ts +6 -5
  198. package/dist/harness/index.d.ts.map +1 -1
  199. package/dist/harness/index.js +3 -2
  200. package/dist/harness/index.js.map +1 -1
  201. package/dist/harness/models.d.ts +5 -0
  202. package/dist/harness/models.d.ts.map +1 -1
  203. package/dist/harness/models.js +10 -0
  204. package/dist/harness/models.js.map +1 -1
  205. package/dist/harness/runner.d.ts +37 -2
  206. package/dist/harness/runner.d.ts.map +1 -1
  207. package/dist/harness/runner.js +107 -23
  208. package/dist/harness/runner.js.map +1 -1
  209. package/dist/harness/session-store.d.ts +4 -1
  210. package/dist/harness/session-store.d.ts.map +1 -1
  211. package/dist/harness/session-store.js +11 -2
  212. package/dist/harness/session-store.js.map +1 -1
  213. package/dist/harness/subagent-runner.d.ts +34 -0
  214. package/dist/harness/subagent-runner.d.ts.map +1 -0
  215. package/dist/harness/subagent-runner.js +339 -0
  216. package/dist/harness/subagent-runner.js.map +1 -0
  217. package/dist/harness/types.d.ts +53 -0
  218. package/dist/harness/types.d.ts.map +1 -1
  219. package/dist/harness/types.js.map +1 -1
  220. package/dist/index.d.ts +3 -3
  221. package/dist/index.d.ts.map +1 -1
  222. package/dist/index.js +2 -2
  223. package/dist/index.js.map +1 -1
  224. package/dist/main.js +260 -109
  225. package/dist/main.js.map +1 -1
  226. package/dist/observability/instrument.js +6 -4
  227. package/dist/observability/instrument.js.map +1 -1
  228. package/dist/observability/sentry.d.ts.map +1 -1
  229. package/dist/observability/sentry.js +3 -2
  230. package/dist/observability/sentry.js.map +1 -1
  231. package/dist/provisioner.d.ts.map +1 -1
  232. package/dist/provisioner.js +2 -5
  233. package/dist/provisioner.js.map +1 -1
  234. package/dist/runtime/conversation-runtime.d.ts +1 -1
  235. package/dist/runtime/conversation-runtime.d.ts.map +1 -1
  236. package/dist/runtime/conversation-runtime.js +276 -43
  237. package/dist/runtime/conversation-runtime.js.map +1 -1
  238. package/dist/runtime/types.d.ts +36 -5
  239. package/dist/runtime/types.d.ts.map +1 -1
  240. package/dist/runtime/types.js.map +1 -1
  241. package/dist/sandbox/cloudflare.d.ts +3 -0
  242. package/dist/sandbox/cloudflare.d.ts.map +1 -1
  243. package/dist/sandbox/cloudflare.js +10 -0
  244. package/dist/sandbox/cloudflare.js.map +1 -1
  245. package/dist/sandbox/container.d.ts +4 -0
  246. package/dist/sandbox/container.d.ts.map +1 -1
  247. package/dist/sandbox/container.js +11 -2
  248. package/dist/sandbox/container.js.map +1 -1
  249. package/dist/sandbox/firecracker.d.ts +3 -0
  250. package/dist/sandbox/firecracker.d.ts.map +1 -1
  251. package/dist/sandbox/firecracker.js +10 -1
  252. package/dist/sandbox/firecracker.js.map +1 -1
  253. package/dist/sandbox/gondolin-bootstrap.d.ts +26 -0
  254. package/dist/sandbox/gondolin-bootstrap.d.ts.map +1 -0
  255. package/dist/sandbox/gondolin-bootstrap.js +27 -0
  256. package/dist/sandbox/gondolin-bootstrap.js.map +1 -0
  257. package/dist/sandbox/gondolin-contract.d.ts +125 -0
  258. package/dist/sandbox/gondolin-contract.d.ts.map +1 -0
  259. package/dist/sandbox/gondolin-contract.js +155 -0
  260. package/dist/sandbox/gondolin-contract.js.map +1 -0
  261. package/dist/sandbox/gondolin-fleet.d.ts +104 -0
  262. package/dist/sandbox/gondolin-fleet.d.ts.map +1 -0
  263. package/dist/sandbox/gondolin-fleet.js +330 -0
  264. package/dist/sandbox/gondolin-fleet.js.map +1 -0
  265. package/dist/sandbox/gondolin-gateway.d.ts +86 -0
  266. package/dist/sandbox/gondolin-gateway.d.ts.map +1 -0
  267. package/dist/sandbox/gondolin-gateway.js +407 -0
  268. package/dist/sandbox/gondolin-gateway.js.map +1 -0
  269. package/dist/sandbox/gondolin-inventory.d.ts +75 -0
  270. package/dist/sandbox/gondolin-inventory.d.ts.map +1 -0
  271. package/dist/sandbox/gondolin-inventory.js +257 -0
  272. package/dist/sandbox/gondolin-inventory.js.map +1 -0
  273. package/dist/sandbox/gondolin-join.d.ts +62 -0
  274. package/dist/sandbox/gondolin-join.d.ts.map +1 -0
  275. package/dist/sandbox/gondolin-join.js +261 -0
  276. package/dist/sandbox/gondolin-join.js.map +1 -0
  277. package/dist/sandbox/gondolin-nfs-advisory.d.ts +15 -0
  278. package/dist/sandbox/gondolin-nfs-advisory.d.ts.map +1 -0
  279. package/dist/sandbox/gondolin-nfs-advisory.js +60 -0
  280. package/dist/sandbox/gondolin-nfs-advisory.js.map +1 -0
  281. package/dist/sandbox/gondolin-placement.d.ts +30 -0
  282. package/dist/sandbox/gondolin-placement.d.ts.map +1 -0
  283. package/dist/sandbox/gondolin-placement.js +77 -0
  284. package/dist/sandbox/gondolin-placement.js.map +1 -0
  285. package/dist/sandbox/gondolin-recovery.d.ts +33 -0
  286. package/dist/sandbox/gondolin-recovery.d.ts.map +1 -0
  287. package/dist/sandbox/gondolin-recovery.js +39 -0
  288. package/dist/sandbox/gondolin-recovery.js.map +1 -0
  289. package/dist/sandbox/gondolin-remote.d.ts +70 -0
  290. package/dist/sandbox/gondolin-remote.d.ts.map +1 -0
  291. package/dist/sandbox/gondolin-remote.js +325 -0
  292. package/dist/sandbox/gondolin-remote.js.map +1 -0
  293. package/dist/sandbox/gondolin-worker-client.d.ts +135 -0
  294. package/dist/sandbox/gondolin-worker-client.d.ts.map +1 -0
  295. package/dist/sandbox/gondolin-worker-client.js +323 -0
  296. package/dist/sandbox/gondolin-worker-client.js.map +1 -0
  297. package/dist/sandbox/gondolin-worker-main.d.ts +2 -0
  298. package/dist/sandbox/gondolin-worker-main.d.ts.map +1 -0
  299. package/dist/sandbox/gondolin-worker-main.js +22 -0
  300. package/dist/sandbox/gondolin-worker-main.js.map +1 -0
  301. package/dist/sandbox/gondolin-worker.d.ts +17 -0
  302. package/dist/sandbox/gondolin-worker.d.ts.map +1 -0
  303. package/dist/sandbox/gondolin-worker.js +201 -0
  304. package/dist/sandbox/gondolin-worker.js.map +1 -0
  305. package/dist/sandbox/gondolin.d.ts +53 -0
  306. package/dist/sandbox/gondolin.d.ts.map +1 -0
  307. package/dist/sandbox/gondolin.js +429 -0
  308. package/dist/sandbox/gondolin.js.map +1 -0
  309. package/dist/sandbox/host.d.ts +3 -0
  310. package/dist/sandbox/host.d.ts.map +1 -1
  311. package/dist/sandbox/host.js +14 -0
  312. package/dist/sandbox/host.js.map +1 -1
  313. package/dist/sandbox/identity.d.ts +21 -0
  314. package/dist/sandbox/identity.d.ts.map +1 -0
  315. package/dist/sandbox/identity.js +36 -0
  316. package/dist/sandbox/identity.js.map +1 -0
  317. package/dist/sandbox/index.d.ts +13 -4
  318. package/dist/sandbox/index.d.ts.map +1 -1
  319. package/dist/sandbox/index.js +19 -3
  320. package/dist/sandbox/index.js.map +1 -1
  321. package/dist/sandbox/types.d.ts +31 -1
  322. package/dist/sandbox/types.d.ts.map +1 -1
  323. package/dist/sandbox/types.js.map +1 -1
  324. package/dist/sandbox/utils.d.ts +12 -0
  325. package/dist/sandbox/utils.d.ts.map +1 -1
  326. package/dist/sandbox/utils.js +38 -0
  327. package/dist/sandbox/utils.js.map +1 -1
  328. package/dist/sessions/chat-history-sync.d.ts +32 -0
  329. package/dist/sessions/chat-history-sync.d.ts.map +1 -0
  330. package/dist/sessions/{agent-memory-file-manager.js → chat-history-sync.js} +40 -113
  331. package/dist/sessions/chat-history-sync.js.map +1 -0
  332. package/dist/sessions/conversation-log.d.ts +13 -0
  333. package/dist/sessions/conversation-log.d.ts.map +1 -0
  334. package/dist/sessions/conversation-log.js +47 -0
  335. package/dist/sessions/conversation-log.js.map +1 -0
  336. package/dist/sessions/history-line.d.ts +20 -0
  337. package/dist/sessions/history-line.d.ts.map +1 -0
  338. package/dist/sessions/history-line.js +24 -0
  339. package/dist/sessions/history-line.js.map +1 -0
  340. package/dist/sessions/policy.d.ts.map +1 -1
  341. package/dist/sessions/policy.js +5 -3
  342. package/dist/sessions/policy.js.map +1 -1
  343. package/dist/sessions/rotation.d.ts +2 -0
  344. package/dist/sessions/rotation.d.ts.map +1 -0
  345. package/dist/sessions/rotation.js +39 -0
  346. package/dist/sessions/rotation.js.map +1 -0
  347. package/dist/sessions/session-key.d.ts +31 -0
  348. package/dist/sessions/session-key.d.ts.map +1 -0
  349. package/dist/sessions/session-key.js +44 -0
  350. package/dist/sessions/session-key.js.map +1 -0
  351. package/dist/sessions/store.d.ts.map +1 -1
  352. package/dist/sessions/store.js +6 -12
  353. package/dist/sessions/store.js.map +1 -1
  354. package/dist/sessions/types.d.ts +2 -2
  355. package/dist/sessions/types.d.ts.map +1 -1
  356. package/dist/sessions/types.js.map +1 -1
  357. package/dist/settings-mutation.d.ts +23 -0
  358. package/dist/settings-mutation.d.ts.map +1 -0
  359. package/dist/settings-mutation.js +42 -0
  360. package/dist/settings-mutation.js.map +1 -0
  361. package/dist/tools/bash.d.ts +3 -1
  362. package/dist/tools/bash.d.ts.map +1 -1
  363. package/dist/tools/bash.js +24 -17
  364. package/dist/tools/bash.js.map +1 -1
  365. package/dist/tools/edit.d.ts.map +1 -1
  366. package/dist/tools/edit.js +9 -12
  367. package/dist/tools/edit.js.map +1 -1
  368. package/dist/tools/event.d.ts +1 -1
  369. package/dist/tools/event.d.ts.map +1 -1
  370. package/dist/tools/event.js +53 -43
  371. package/dist/tools/event.js.map +1 -1
  372. package/dist/tools/generate-image.d.ts +17 -0
  373. package/dist/tools/generate-image.d.ts.map +1 -0
  374. package/dist/tools/generate-image.js +63 -0
  375. package/dist/tools/generate-image.js.map +1 -0
  376. package/dist/tools/host-fn-tool.d.ts +21 -0
  377. package/dist/tools/host-fn-tool.d.ts.map +1 -0
  378. package/dist/tools/host-fn-tool.js +32 -0
  379. package/dist/tools/host-fn-tool.js.map +1 -0
  380. package/dist/tools/index.d.ts +17 -2
  381. package/dist/tools/index.d.ts.map +1 -1
  382. package/dist/tools/index.js +28 -3
  383. package/dist/tools/index.js.map +1 -1
  384. package/dist/tools/react.d.ts +15 -0
  385. package/dist/tools/react.d.ts.map +1 -0
  386. package/dist/tools/react.js +29 -0
  387. package/dist/tools/react.js.map +1 -0
  388. package/dist/tools/read.d.ts.map +1 -1
  389. package/dist/tools/read.js +7 -26
  390. package/dist/tools/read.js.map +1 -1
  391. package/dist/tools/sandbox.d.ts +2 -2
  392. package/dist/tools/sandbox.d.ts.map +1 -1
  393. package/dist/tools/sandbox.js +13 -9
  394. package/dist/tools/sandbox.js.map +1 -1
  395. package/dist/tools/subagent-slots.d.ts +28 -0
  396. package/dist/tools/subagent-slots.d.ts.map +1 -0
  397. package/dist/tools/subagent-slots.js +57 -0
  398. package/dist/tools/subagent-slots.js.map +1 -0
  399. package/dist/tools/subagent.d.ts +74 -0
  400. package/dist/tools/subagent.d.ts.map +1 -0
  401. package/dist/tools/subagent.js +335 -0
  402. package/dist/tools/subagent.js.map +1 -0
  403. package/dist/tools/types.d.ts +40 -6
  404. package/dist/tools/types.d.ts.map +1 -1
  405. package/dist/tools/types.js.map +1 -1
  406. package/dist/tools/write.d.ts.map +1 -1
  407. package/dist/tools/write.js +1 -8
  408. package/dist/tools/write.js.map +1 -1
  409. package/dist/trigger.d.ts.map +1 -1
  410. package/dist/trigger.js +1 -2
  411. package/dist/trigger.js.map +1 -1
  412. package/dist/types.d.ts +144 -31
  413. package/dist/types.d.ts.map +1 -1
  414. package/dist/types.js.map +1 -1
  415. package/dist/utils/date.d.ts +1 -1
  416. package/dist/utils/date.js +1 -1
  417. package/dist/utils/date.js.map +1 -1
  418. package/dist/vault/disabled.d.ts +9 -0
  419. package/dist/vault/disabled.d.ts.map +1 -0
  420. package/dist/vault/disabled.js +22 -0
  421. package/dist/vault/disabled.js.map +1 -0
  422. package/dist/vault/index.d.ts +0 -2
  423. package/dist/vault/index.d.ts.map +1 -1
  424. package/dist/vault/index.js +1 -32
  425. package/dist/vault/index.js.map +1 -1
  426. package/dist/vault/injection.d.ts +20 -0
  427. package/dist/vault/injection.d.ts.map +1 -0
  428. package/dist/vault/injection.js +27 -0
  429. package/dist/vault/injection.js.map +1 -0
  430. package/dist/vault/policy.d.ts +20 -0
  431. package/dist/vault/policy.d.ts.map +1 -0
  432. package/dist/vault/policy.js +20 -0
  433. package/dist/vault/policy.js.map +1 -0
  434. package/dist/vault/types.d.ts +0 -2
  435. package/dist/vault/types.d.ts.map +1 -1
  436. package/dist/vault/types.js.map +1 -1
  437. package/dist/web/admin/portal.d.ts +27 -0
  438. package/dist/web/admin/portal.d.ts.map +1 -1
  439. package/dist/web/admin/portal.js +117 -154
  440. package/dist/web/admin/portal.js.map +1 -1
  441. package/dist/web/admin/types.d.ts +6 -0
  442. package/dist/web/admin/types.d.ts.map +1 -1
  443. package/dist/web/admin/types.js.map +1 -1
  444. package/dist/web/agent-events/portal.d.ts.map +1 -1
  445. package/dist/web/agent-events/portal.js +2 -1
  446. package/dist/web/agent-events/portal.js.map +1 -1
  447. package/dist/web/login/oauth.d.ts +2 -3
  448. package/dist/web/login/oauth.d.ts.map +1 -1
  449. package/dist/web/login/oauth.js +0 -31
  450. package/dist/web/login/oauth.js.map +1 -1
  451. package/dist/web/login/portal.js +1 -1
  452. package/dist/web/login/portal.js.map +1 -1
  453. package/dist/web/login/types.d.ts +0 -11
  454. package/dist/web/login/types.d.ts.map +1 -1
  455. package/dist/web/login/types.js.map +1 -1
  456. package/dist/web/portal-shell.d.ts +4 -0
  457. package/dist/web/portal-shell.d.ts.map +1 -0
  458. package/dist/{portal-shell.js → web/portal-shell.js} +2 -2
  459. package/dist/web/portal-shell.js.map +1 -0
  460. package/dist/web/server.d.ts.map +1 -1
  461. package/dist/web/server.js +7 -0
  462. package/dist/web/server.js.map +1 -1
  463. package/dist/web/session-view/command.d.ts.map +1 -1
  464. package/dist/web/session-view/command.js +4 -1
  465. package/dist/web/session-view/command.js.map +1 -1
  466. package/dist/web/session-view/portal.d.ts.map +1 -1
  467. package/dist/web/session-view/portal.js +4 -3
  468. package/dist/web/session-view/portal.js.map +1 -1
  469. package/dist/web/session-view/service.d.ts.map +1 -1
  470. package/dist/web/session-view/service.js +2 -1
  471. package/dist/web/session-view/service.js.map +1 -1
  472. package/dist/web/session-view/types.d.ts +2 -1
  473. package/dist/web/session-view/types.d.ts.map +1 -1
  474. package/dist/web/session-view/types.js.map +1 -1
  475. package/package.json +7 -4
  476. package/dist/download.d.ts.map +0 -1
  477. package/dist/download.js.map +0 -1
  478. package/dist/model-registry.d.ts +0 -4
  479. package/dist/model-registry.d.ts.map +0 -1
  480. package/dist/model-registry.js +0 -7
  481. package/dist/model-registry.js.map +0 -1
  482. package/dist/portal-shell.d.ts +0 -4
  483. package/dist/portal-shell.d.ts.map +0 -1
  484. package/dist/portal-shell.js.map +0 -1
  485. package/dist/runtime/agent-run-controller.d.ts +0 -31
  486. package/dist/runtime/agent-run-controller.d.ts.map +0 -1
  487. package/dist/runtime/agent-run-controller.js +0 -195
  488. package/dist/runtime/agent-run-controller.js.map +0 -1
  489. package/dist/sessions/agent-memory-file-manager.d.ts +0 -19
  490. package/dist/sessions/agent-memory-file-manager.d.ts.map +0 -1
  491. package/dist/sessions/agent-memory-file-manager.js.map +0 -1
  492. package/dist/vault/routing.d.ts +0 -3
  493. package/dist/vault/routing.d.ts.map +0 -1
  494. package/dist/vault/routing.js +0 -13
  495. package/dist/vault/routing.js.map +0 -1
  496. /package/dist/{download.d.ts → cli/download.d.ts} +0 -0
  497. /package/dist/{download.js → cli/download.js} +0 -0
@@ -0,0 +1,22 @@
1
+ import type { AgentTool } from "@earendil-works/pi-agent-core";
2
+ import type { GithubPrRequest, GithubPrResult } from "../types.js";
3
+ declare const githubPrSchema: import("@sinclair/typebox").TObject<{
4
+ branch: import("@sinclair/typebox").TString;
5
+ title: import("@sinclair/typebox").TString;
6
+ body: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
7
+ base: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
8
+ draft: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
9
+ }>;
10
+ /**
11
+ * The `github_pr` tool pushes a branch the agent prepared in the
12
+ * conversation's ./repo clone and opens a pull request as the GitHub App.
13
+ * The push and API calls run host-side with an ephemeral repo-scoped token;
14
+ * the sandbox never holds credentials. Wired per run via the setter, and only
15
+ * for GitHub conversations.
16
+ */
17
+ export declare function createGithubPrTool(): {
18
+ tool: AgentTool<typeof githubPrSchema>;
19
+ setGithubPrFunction: (fn: ((request: GithubPrRequest) => Promise<GithubPrResult>) | null) => void;
20
+ };
21
+ export {};
22
+ //# sourceMappingURL=pr.d.ts.map
@@ -0,0 +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;AAG/D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEnE,QAAA,MAAM,cAAc;;;;;;EAalB,CAAC;AAIH;;;;;;GAMG;AACH,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,CA+BA"}
@@ -0,0 +1,48 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { defineHostFnTool } from "../../../tools/host-fn-tool.js";
3
+ const githubPrSchema = Type.Object({
4
+ branch: Type.String({
5
+ description: 'Local branch inside ./repo to push. Must be named pi/<something> (e.g. "pi/fix-42"); ' +
6
+ "the default branch is never pushable. To update this conversation's own PR, pass its " +
7
+ "checked-out pi/* head branch.",
8
+ }),
9
+ title: Type.String({ description: "Pull request title." }),
10
+ body: Type.Optional(Type.String({ description: "Pull request description (Markdown)." })),
11
+ base: Type.Optional(Type.String({ description: "Target branch; defaults to the repository's default branch." })),
12
+ draft: Type.Optional(Type.Boolean({ description: "Open as a draft pull request." })),
13
+ });
14
+ /**
15
+ * The `github_pr` tool pushes a branch the agent prepared in the
16
+ * conversation's ./repo clone and opens a pull request as the GitHub App.
17
+ * The push and API calls run host-side with an ephemeral repo-scoped token;
18
+ * the sandbox never holds credentials. Wired per run via the setter, and only
19
+ * for GitHub conversations.
20
+ */
21
+ export function createGithubPrTool() {
22
+ const { tool, setFn } = defineHostFnTool({
23
+ name: "github_pr",
24
+ description: "Push a pi/<name> branch you committed inside ./repo and open a GitHub pull request " +
25
+ "(or draft) for it. Pushing a branch that already has an open PR — including this " +
26
+ "conversation's own PR head — updates that PR instead of opening a new one. Only " +
27
+ "available in GitHub issue/PR conversations. You cannot push to the default branch " +
28
+ "and you cannot merge — humans review and merge the PR.",
29
+ parameters: githubPrSchema,
30
+ unavailable: "github_pr is only available in GitHub conversations.",
31
+ run: async (prFn, args) => {
32
+ const result = await prFn(args);
33
+ return {
34
+ content: [
35
+ {
36
+ type: "text",
37
+ text: result.updatedExisting
38
+ ? `Pushed to existing PR #${result.number}: ${result.url}`
39
+ : `Opened ${args.draft ? "draft " : ""}PR #${result.number}: ${result.url}`,
40
+ },
41
+ ],
42
+ details: undefined,
43
+ };
44
+ },
45
+ });
46
+ return { tool, setGithubPrFunction: setFn };
47
+ }
48
+ //# sourceMappingURL=pr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/pr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAGlE,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC;IACjC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;QAClB,WAAW,EACT,uFAAuF;YACvF,uFAAuF;YACvF,+BAA+B;KAClC,CAAC;IACF,KAAK,EAAE,IAAI,CAAC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mB,EAAE,KAAK,EAAE,CAAC;AAC9C,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Type } from \"@sinclair/typebox\";\nimport { defineHostFnTool } from \"../../../tools/host-fn-tool.js\";\nimport type { GithubPrRequest, GithubPrResult } from \"../types.js\";\n\nconst githubPrSchema = Type.Object({\n branch: Type.String({\n description:\n 'Local branch inside ./repo to push. Must be named pi/<something> (e.g. \"pi/fix-42\"); ' +\n \"the default branch is never pushable. To update this conversation's own PR, pass its \" +\n \"checked-out pi/* head branch.\",\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\n/**\n * The `github_pr` tool pushes a branch the agent prepared in the\n * conversation's ./repo clone and opens a pull request as the GitHub App.\n * The push and API calls run host-side with an ephemeral repo-scoped token;\n * the sandbox never holds credentials. Wired per run via the setter, and only\n * for GitHub conversations.\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\",\n description:\n \"Push a pi/<name> branch you committed inside ./repo and open a GitHub pull request \" +\n \"(or draft) for it. Pushing a branch that already has an open PR — including this \" +\n \"conversation's own PR head — updates that PR instead of opening a new one. Only \" +\n \"available in GitHub issue/PR conversations. You cannot push to the default branch \" +\n \"and you cannot merge — humans review and merge the PR.\",\n parameters: githubPrSchema,\n unavailable: \"github_pr 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 ? `Pushed to existing 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"]}
@@ -0,0 +1,22 @@
1
+ import type { AgentTool } from "@earendil-works/pi-agent-core";
2
+ import type { GithubReadRequest, GithubReadResult } from "../types.js";
3
+ declare const githubReadSchema: import("@sinclair/typebox").TObject<{
4
+ action: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"pr">, import("@sinclair/typebox").TLiteral<"pr_files">, import("@sinclair/typebox").TLiteral<"pr_reviews">, import("@sinclair/typebox").TLiteral<"issue">, import("@sinclair/typebox").TLiteral<"comments">, import("@sinclair/typebox").TLiteral<"list">]>;
5
+ number: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
6
+ state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
7
+ labels: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
8
+ creator: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
9
+ }>;
10
+ export type GithubReadFn = (request: GithubReadRequest) => Promise<GithubReadResult>;
11
+ /**
12
+ * The `github_read` tool reads what the ./repo clone cannot show: PR diff
13
+ * stats and changed files, review state with open inline threads, and other
14
+ * issues/PRs in this repo for triage. Read-only, host-side, same-repo by
15
+ * construction; wired per run and only for GitHub conversations.
16
+ */
17
+ export declare function createGithubReadTool(): {
18
+ tool: AgentTool<typeof githubReadSchema>;
19
+ setGithubReadFunction: (fn: GithubReadFn | null) => void;
20
+ };
21
+ export {};
22
+ //# sourceMappingURL=read.d.ts.map
@@ -0,0 +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;AAG/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEvE,QAAA,MAAM,gBAAgB;;;;;;EA8BpB,CAAC;AAoGH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAErF;;;;;GAKG;AACH,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"}
@@ -0,0 +1,141 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { defineHostFnTool } from "../../../tools/host-fn-tool.js";
3
+ const githubReadSchema = Type.Object({
4
+ action: Type.Union([
5
+ Type.Literal("pr"),
6
+ Type.Literal("pr_files"),
7
+ Type.Literal("pr_reviews"),
8
+ Type.Literal("issue"),
9
+ Type.Literal("comments"),
10
+ Type.Literal("list"),
11
+ ], {
12
+ description: "pr: PR metadata (state, base/head, diff stats). pr_files: changed files. " +
13
+ "pr_reviews: submitted reviews + open inline threads (with rc- ids for " +
14
+ "github_review_reply). issue: issue metadata. comments: recent conversation " +
15
+ "comments. list: issues/PRs in this repo.",
16
+ }),
17
+ number: Type.Optional(Type.Number({
18
+ description: "Issue/PR number to read; omit for this conversation's own.",
19
+ })),
20
+ state: Type.Optional(Type.String({ description: "list only: open | closed | all (default open)." })),
21
+ labels: Type.Optional(Type.String({ description: "list only: comma-separated label names to filter by." })),
22
+ creator: Type.Optional(Type.String({ description: "list only: filter by author login." })),
23
+ });
24
+ const MAX_BODY_CHARS = 1000;
25
+ const MAX_COMMENT_CHARS = 500;
26
+ const MAX_REVIEW_BODY_CHARS = 300;
27
+ function truncate(text, max) {
28
+ return text.length > max ? `${text.slice(0, max)}…` : text;
29
+ }
30
+ function formatResult(result) {
31
+ switch (result.kind) {
32
+ case "pr": {
33
+ const pr = result.pr;
34
+ const flags = [
35
+ pr.state ?? "unknown",
36
+ pr.draft ? "draft" : null,
37
+ pr.merged ? "merged" : null,
38
+ pr.mergeable_state ? `mergeable_state: ${pr.mergeable_state}` : null,
39
+ ].filter(Boolean);
40
+ return [
41
+ `PR #${pr.number}: ${pr.title ?? ""} [${flags.join(", ")}]`,
42
+ `${pr.head?.ref ?? "?"} → ${pr.base?.ref ?? "?"} | ${pr.changed_files ?? "?"} files, +${pr.additions ?? "?"} -${pr.deletions ?? "?"}`,
43
+ pr.user ? `author: @${pr.user.login}` : null,
44
+ pr.body ? truncate(pr.body, MAX_BODY_CHARS) : "(no description)",
45
+ ]
46
+ .filter(Boolean)
47
+ .join("\n");
48
+ }
49
+ case "pr_files": {
50
+ if (result.files.length === 0)
51
+ return "No changed files.";
52
+ const lines = result.files.map((file) => `${file.status.padEnd(8)} ${file.filename} +${file.additions} -${file.deletions}`);
53
+ return [`${result.files.length} changed file(s):`, ...lines].join("\n");
54
+ }
55
+ case "pr_reviews": {
56
+ const reviewLines = result.reviews
57
+ .filter((review) => review.state !== "PENDING")
58
+ .map((review) => {
59
+ const body = review.body?.trim()
60
+ ? ` — ${truncate(review.body, MAX_REVIEW_BODY_CHARS)}`
61
+ : "";
62
+ return `@${review.user.login}: ${review.state}${body}`;
63
+ });
64
+ // Thread roots only: replies belong to their root's thread. The rc- id
65
+ // is what github_review_reply takes.
66
+ const rootThreads = result.threads.filter((comment) => comment.in_reply_to_id === undefined);
67
+ const threadLines = rootThreads.map((comment) => {
68
+ const location = comment.line !== null ? `${comment.path}:${comment.line}` : comment.path;
69
+ const replies = result.threads.filter((reply) => reply.in_reply_to_id === comment.id);
70
+ const replyNote = replies.length > 0
71
+ ? ` (${replies.length} repl${replies.length === 1 ? "y" : "ies"})`
72
+ : "";
73
+ return `rc-${comment.id} ${location} @${comment.user.login}${replyNote}: ${truncate(comment.body, MAX_REVIEW_BODY_CHARS)}`;
74
+ });
75
+ return [
76
+ reviewLines.length > 0 ? `Reviews:\n${reviewLines.join("\n")}` : "No submitted reviews.",
77
+ threadLines.length > 0
78
+ ? `Inline threads (reply with github_review_reply):\n${threadLines.join("\n")}`
79
+ : "No inline review threads.",
80
+ ].join("\n\n");
81
+ }
82
+ case "issue": {
83
+ const issue = result.issue;
84
+ const labels = (issue.labels ?? []).map((label) => label.name).join(", ");
85
+ const assignees = (issue.assignees ?? []).map((assignee) => `@${assignee.login}`).join(", ");
86
+ return [
87
+ `#${issue.number}: ${issue.title} [${issue.state ?? "unknown"}${issue.pull_request ? ", PR" : ""}]`,
88
+ labels ? `labels: ${labels}` : null,
89
+ assignees ? `assignees: ${assignees}` : null,
90
+ `author: @${issue.user.login}`,
91
+ issue.body ? truncate(issue.body, MAX_BODY_CHARS) : "(no body)",
92
+ ]
93
+ .filter(Boolean)
94
+ .join("\n");
95
+ }
96
+ case "comments": {
97
+ if (result.comments.length === 0)
98
+ return "No comments.";
99
+ return result.comments
100
+ .map((comment) => `@${comment.user.login} (${comment.created_at}): ${truncate(comment.body, MAX_COMMENT_CHARS)}`)
101
+ .join("\n");
102
+ }
103
+ case "list": {
104
+ if (result.issues.length === 0)
105
+ return "No matching issues.";
106
+ return result.issues
107
+ .map((issue) => {
108
+ const labels = (issue.labels ?? []).map((label) => label.name).join(", ");
109
+ const kind = issue.pull_request ? "PR" : "issue";
110
+ return `#${issue.number} [${issue.state ?? "?"} ${kind}] ${issue.title}${labels ? ` (${labels})` : ""}`;
111
+ })
112
+ .join("\n");
113
+ }
114
+ }
115
+ }
116
+ /**
117
+ * The `github_read` tool reads what the ./repo clone cannot show: PR diff
118
+ * stats and changed files, review state with open inline threads, and other
119
+ * issues/PRs in this repo for triage. Read-only, host-side, same-repo by
120
+ * construction; wired per run and only for GitHub conversations.
121
+ */
122
+ export function createGithubReadTool() {
123
+ const { tool, setFn } = defineHostFnTool({
124
+ name: "github_read",
125
+ description: "Read GitHub metadata for this repo: PR state/diff stats (pr), changed files " +
126
+ "(pr_files), reviews and open inline threads (pr_reviews), issue metadata (issue), " +
127
+ "recent comments (comments), or a filtered issue/PR listing (list). number defaults " +
128
+ "to this conversation's issue/PR. Only available in GitHub conversations.",
129
+ parameters: githubReadSchema,
130
+ unavailable: "github_read is only available in GitHub conversations.",
131
+ run: async (readFn, args) => {
132
+ const result = await readFn(args);
133
+ return {
134
+ content: [{ type: "text", text: formatResult(result) }],
135
+ details: undefined,
136
+ };
137
+ },
138
+ });
139
+ return { tool, setGithubReadFunction: setFn };
140
+ }
141
+ //# sourceMappingURL=read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/read.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAGlE,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,CAAC,MAAM,CAAC;KACrB,EACD;QACE,WAAW,EACT,2EAA2E;YAC3E,wEAAwE;YACxE,6EAA6E;YAC7E,0CAA0C;KAC7C,CACF;IACD,MAAM,EAAE,IAAI,CAAC,QAAQ,CACnB,IAAI,CAAC,MAAM,CAAC;QACV,WAAW,EAAE,4DAA4D;KAC1E,CAAC,CACH;IACD,KAAK,EAAE,IAAI,CAAC,QAAQ,CAClB,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,gDAAgD,EAAE,CAAC,CAC/E;IACD,MAAM,EAAE,IAAI,CAAC,QAAQ,CACnB,IAAI,CA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,EAAE,GAAG,gBAAgB,CAAwC;QAC9E,IAAI,EAAE,aAAa;QACnB,WAAW,EACT,8EAA8E;YAC9E,oFAAoF;YACpF,qFAAqF;YACrF,0EAA0E;QAC5E,UAAU,EAAE,gBAAgB;QAC5B,WAAW,EAAE,wDAAwD;QACrE,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 \"@sinclair/typebox\";\nimport { defineHostFnTool } from \"../../../tools/host-fn-tool.js\";\nimport type { GithubReadRequest, GithubReadResult } from \"../types.js\";\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 formatResult(result: GithubReadResult): string {\n switch (result.kind) {\n case \"pr\": {\n const pr = result.pr;\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 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 const reviewLines = result.reviews\n .filter((review) => review.state !== \"PENDING\")\n .map((review) => {\n const body = review.body?.trim()\n ? ` — ${truncate(review.body, MAX_REVIEW_BODY_CHARS)}`\n : \"\";\n return `@${review.user.login}: ${review.state}${body}`;\n });\n // Thread roots only: replies belong to their root's thread. The rc- id\n // is what github_review_reply takes.\n const rootThreads = result.threads.filter((comment) => comment.in_reply_to_id === undefined);\n const threadLines = rootThreads.map((comment) => {\n const location = comment.line !== null ? `${comment.path}:${comment.line}` : comment.path;\n const replies = result.threads.filter((reply) => reply.in_reply_to_id === comment.id);\n const replyNote =\n replies.length > 0\n ? ` (${replies.length} repl${replies.length === 1 ? \"y\" : \"ies\"})`\n : \"\";\n return `rc-${comment.id} ${location} @${comment.user.login}${replyNote}: ${truncate(comment.body, MAX_REVIEW_BODY_CHARS)}`;\n });\n return [\n reviewLines.length > 0 ? `Reviews:\\n${reviewLines.join(\"\\n\")}` : \"No submitted reviews.\",\n threadLines.length > 0\n ? `Inline threads (reply with github_review_reply):\\n${threadLines.join(\"\\n\")}`\n : \"No inline review threads.\",\n ].join(\"\\n\\n\");\n }\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 if (result.comments.length === 0) return \"No comments.\";\n return result.comments\n .map(\n (comment) =>\n `@${comment.user.login} (${comment.created_at}): ${truncate(comment.body, MAX_COMMENT_CHARS)}`,\n )\n .join(\"\\n\");\n }\n case \"list\": {\n if (result.issues.length === 0) return \"No matching issues.\";\n return 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\");\n }\n }\n}\n\nexport type GithubReadFn = (request: GithubReadRequest) => Promise<GithubReadResult>;\n\n/**\n * The `github_read` tool reads what the ./repo clone cannot show: PR diff\n * stats and changed files, review state with open inline threads, and other\n * issues/PRs in this repo for triage. Read-only, host-side, same-repo by\n * construction; wired per run and only for GitHub conversations.\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\",\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 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"]}
@@ -0,0 +1,19 @@
1
+ import type { AgentTool } from "@earendil-works/pi-agent-core";
2
+ declare const githubReviewReplySchema: import("@sinclair/typebox").TObject<{
3
+ comment_id: import("@sinclair/typebox").TNumber;
4
+ body: import("@sinclair/typebox").TString;
5
+ }>;
6
+ export type GithubReviewReplyFn = (commentId: number, body: string) => Promise<{
7
+ url: string;
8
+ }>;
9
+ /**
10
+ * The `github_review_reply` tool answers inside one inline PR review thread
11
+ * (the responder's normal replies post as plain PR comments instead). Runs
12
+ * host-side as the App; wired per run and only for GitHub conversations.
13
+ */
14
+ export declare function createGithubReviewReplyTool(): {
15
+ tool: AgentTool<typeof githubReviewReplySchema>;
16
+ setGithubReviewReplyFunction: (fn: GithubReviewReplyFn | null) => void;
17
+ };
18
+ export {};
19
+ //# sourceMappingURL=review-reply.d.ts.map
@@ -0,0 +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;AAI/D,QAAA,MAAM,uBAAuB;;;EAO3B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEhG;;;;GAIG;AACH,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"}
@@ -0,0 +1,38 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { defineHostFnTool } from "../../../tools/host-fn-tool.js";
3
+ const githubReviewReplySchema = Type.Object({
4
+ comment_id: Type.Number({
5
+ description: "Numeric id from an [PR review comment rc-<id> …] message in this conversation " +
6
+ "(e.g. 8001 for rc-8001). The reply lands inside that comment's thread.",
7
+ }),
8
+ body: Type.String({ description: "Reply text (Markdown)." }),
9
+ });
10
+ /**
11
+ * The `github_review_reply` tool answers inside one inline PR review thread
12
+ * (the responder's normal replies post as plain PR comments instead). Runs
13
+ * host-side as the App; wired per run and only for GitHub conversations.
14
+ */
15
+ export function createGithubReviewReplyTool() {
16
+ const { tool, setFn } = defineHostFnTool({
17
+ name: "github_review_reply",
18
+ description: "Reply inside a specific PR review thread. Use the numeric id from an " +
19
+ "[PR review comment rc-<id> …] message as comment_id; a plain response would post " +
20
+ "as a normal PR comment instead of in-thread. Only available in GitHub PR conversations.",
21
+ parameters: githubReviewReplySchema,
22
+ unavailable: "github_review_reply is only available in GitHub conversations.",
23
+ run: async (replyFn, args) => {
24
+ const result = await replyFn(args.comment_id, args.body);
25
+ return {
26
+ content: [
27
+ {
28
+ type: "text",
29
+ text: `Replied in review thread rc-${args.comment_id}: ${result.url}`,
30
+ },
31
+ ],
32
+ details: undefined,
33
+ };
34
+ },
35
+ });
36
+ return { tool, setGithubReviewReplyFunction: setFn };
37
+ }
38
+ //# sourceMappingURL=review-reply.js.map
@@ -0,0 +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,mBAAmB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,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;;;;GAIG;AACH,MAAM,UAAU,2BAA2B;IAIzC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,gBAAgB,CAAsD;QAC5F,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EACT,uEAAuE;YACvE,mFAAmF;YACnF,yFAAyF;QAC3F,UAAU,EAAE,uBAAuB;QACnC,WAAW,EAAE,gEAAgE;QAC7E,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 \"@sinclair/typebox\";\nimport { defineHostFnTool } from \"../../../tools/host-fn-tool.js\";\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\nexport type GithubReviewReplyFn = (commentId: number, body: string) => Promise<{ url: string }>;\n\n/**\n * The `github_review_reply` tool answers inside one inline PR review thread\n * (the responder's normal replies post as plain PR comments instead). Runs\n * host-side as the App; wired per run and only for GitHub conversations.\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\",\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 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"]}
@@ -0,0 +1,17 @@
1
+ import type { AgentTool } from "@earendil-works/pi-agent-core";
2
+ declare const githubSyncSchema: import("@sinclair/typebox").TObject<{
3
+ branch: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
4
+ }>;
5
+ export type GithubSyncFn = (branch?: string) => Promise<string>;
6
+ /**
7
+ * The `github_sync` tool refreshes the conversation's ./repo clone — a
8
+ * first-contact snapshot the sandbox cannot update itself (no credentials).
9
+ * Host-side fetch with an ephemeral read token; it reports instead of moving
10
+ * the checkout whenever that could lose the agent's local work.
11
+ */
12
+ export declare function createGithubSyncTool(): {
13
+ tool: AgentTool<typeof githubSyncSchema>;
14
+ setGithubSyncFunction: (fn: GithubSyncFn | null) => void;
15
+ };
16
+ export {};
17
+ //# sourceMappingURL=sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/adapters/github/tools/sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI/D,QAAA,MAAM,gBAAgB;;EAQpB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEhE;;;;;GAKG;AACH,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"}
@@ -0,0 +1,34 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { defineHostFnTool } from "../../../tools/host-fn-tool.js";
3
+ const githubSyncSchema = Type.Object({
4
+ branch: Type.Optional(Type.String({
5
+ description: "Remote branch to fetch. Omit to fetch this PR's latest head (or the default " +
6
+ "branch in a plain-issue conversation).",
7
+ })),
8
+ });
9
+ /**
10
+ * The `github_sync` tool refreshes the conversation's ./repo clone — a
11
+ * first-contact snapshot the sandbox cannot update itself (no credentials).
12
+ * Host-side fetch with an ephemeral read token; it reports instead of moving
13
+ * the checkout whenever that could lose the agent's local work.
14
+ */
15
+ export function createGithubSyncTool() {
16
+ const { tool, setFn } = defineHostFnTool({
17
+ name: "github_sync",
18
+ description: "Update ./repo from GitHub: fetches this PR's latest head (or the default branch, " +
19
+ "or a named branch) and fast-forwards the checkout when that cannot lose your work; " +
20
+ "otherwise it fetches to FETCH_HEAD and reports so you can merge or rebase yourself. " +
21
+ "Only available in GitHub conversations.",
22
+ parameters: githubSyncSchema,
23
+ unavailable: "github_sync is only available in GitHub conversations.",
24
+ run: async (syncFn, args) => {
25
+ const report = await syncFn(args.branch);
26
+ return {
27
+ content: [{ type: "text", text: report }],
28
+ details: undefined,
29
+ };
30
+ },
31
+ });
32
+ return { tool, setGithubSyncFunction: setFn };
33
+ }
34
+ //# sourceMappingURL=sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../../src/adapters/github/tools/sync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,IAAI,CAAC,QAAQ,CACnB,IAAI,CAAC,MAAM,CAAC;QACV,WAAW,EACT,8EAA8E;YAC9E,wCAAwC;KAC3C,CAAC,CACH;CACF,CAAC,CAAC;AAIH;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB;IAIlC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,gBAAgB,CAAwC;QAC9E,IAAI,EAAE,aAAa;QACnB,WAAW,EACT,mFAAmF;YACnF,qFAAqF;YACrF,sFAAsF;YACtF,yCAAyC;QAC3C,UAAU,EAAE,gBAAgB;QAC5B,WAAW,EAAE,wDAAwD;QACrE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;YAC1B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACzC,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,qBAAqB,EAAE,KAAK,EAAE,CAAC;AAChD,CAAC","sourcesContent":["import type { AgentTool } from \"@earendil-works/pi-agent-core\";\nimport { Type } from \"@sinclair/typebox\";\nimport { defineHostFnTool } from \"../../../tools/host-fn-tool.js\";\n\nconst githubSyncSchema = Type.Object({\n branch: Type.Optional(\n Type.String({\n description:\n \"Remote branch to fetch. Omit to fetch this PR's latest head (or the default \" +\n \"branch in a plain-issue conversation).\",\n }),\n ),\n});\n\nexport type GithubSyncFn = (branch?: string) => Promise<string>;\n\n/**\n * The `github_sync` tool refreshes the conversation's ./repo clone — a\n * first-contact snapshot the sandbox cannot update itself (no credentials).\n * Host-side fetch with an ephemeral read token; it reports instead of moving\n * the checkout whenever that could lose the agent's local work.\n */\nexport function createGithubSyncTool(): {\n tool: AgentTool<typeof githubSyncSchema>;\n setGithubSyncFunction: (fn: GithubSyncFn | null) => void;\n} {\n const { tool, setFn } = defineHostFnTool<GithubSyncFn, typeof githubSyncSchema>({\n name: \"github_sync\",\n description:\n \"Update ./repo from GitHub: fetches this PR's latest head (or the default branch, \" +\n \"or a named branch) and fast-forwards the checkout when that cannot lose your work; \" +\n \"otherwise it fetches to FETCH_HEAD and reports so you can merge or rebase yourself. \" +\n \"Only available in GitHub conversations.\",\n parameters: githubSyncSchema,\n unavailable: \"github_sync is only available in GitHub conversations.\",\n run: async (syncFn, args) => {\n const report = await syncFn(args.branch);\n return {\n content: [{ type: \"text\" as const, text: report }],\n details: undefined,\n };\n },\n });\n\n return { tool, setGithubSyncFunction: setFn };\n}\n"]}