lastlight 0.16.0 → 0.16.1

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 (385) hide show
  1. package/README.md +71 -692
  2. package/dist/cli-config.js.map +1 -0
  3. package/dist/cli-format.js.map +1 -0
  4. package/dist/{cli/cli-server.d.ts → cli-server.d.ts} +26 -1
  5. package/dist/{cli/cli-server.js → cli-server.js} +40 -5
  6. package/dist/cli-server.js.map +1 -0
  7. package/dist/cli-timeline.js.map +1 -0
  8. package/dist/{cli/cli.js → cli.js} +4 -3
  9. package/dist/cli.js.map +1 -0
  10. package/dist/{cli/fork-cli.d.ts → fork-cli.d.ts} +3 -3
  11. package/dist/{cli/fork-cli.js → fork-cli.js} +28 -27
  12. package/dist/fork-cli.js.map +1 -0
  13. package/dist/{cli/oauth-cli.js → oauth-cli.js} +1 -1
  14. package/dist/oauth-cli.js.map +1 -0
  15. package/dist/{cli/setup.js → setup.js} +10 -4
  16. package/dist/setup.js.map +1 -0
  17. package/dist/{cli/skills-install.d.ts → skills-install.d.ts} +6 -0
  18. package/dist/{cli/skills-install.js → skills-install.js} +6 -2
  19. package/dist/skills-install.js.map +1 -0
  20. package/package.json +20 -65
  21. package/plugins/lastlight/.claude-plugin/plugin.json +1 -1
  22. package/agent-context/rules.md +0 -80
  23. package/agent-context/security.md +0 -69
  24. package/agent-context/soul.md +0 -21
  25. package/config/default.yaml +0 -119
  26. package/deploy/.env.production.example +0 -100
  27. package/deploy/entrypoint.sh +0 -82
  28. package/deploy/native/README.md +0 -160
  29. package/deploy/native/install.sh +0 -110
  30. package/deploy/native/lastlight.env.example +0 -95
  31. package/deploy/native/lastlight.service +0 -50
  32. package/deploy/sandbox-entrypoint.sh +0 -93
  33. package/dist/admin/auth.d.ts +0 -51
  34. package/dist/admin/auth.js +0 -121
  35. package/dist/admin/auth.js.map +0 -1
  36. package/dist/admin/chat-session-reader.d.ts +0 -39
  37. package/dist/admin/chat-session-reader.js +0 -84
  38. package/dist/admin/chat-session-reader.js.map +0 -1
  39. package/dist/admin/docker.d.ts +0 -61
  40. package/dist/admin/docker.js +0 -187
  41. package/dist/admin/docker.js.map +0 -1
  42. package/dist/admin/index.d.ts +0 -9
  43. package/dist/admin/index.js +0 -59
  44. package/dist/admin/index.js.map +0 -1
  45. package/dist/admin/routes.d.ts +0 -81
  46. package/dist/admin/routes.js +0 -1381
  47. package/dist/admin/routes.js.map +0 -1
  48. package/dist/admin/sessions.d.ts +0 -89
  49. package/dist/admin/sessions.js +0 -204
  50. package/dist/admin/sessions.js.map +0 -1
  51. package/dist/admin/tail.d.ts +0 -12
  52. package/dist/admin/tail.js +0 -145
  53. package/dist/admin/tail.js.map +0 -1
  54. package/dist/admin/version.d.ts +0 -22
  55. package/dist/admin/version.js +0 -92
  56. package/dist/admin/version.js.map +0 -1
  57. package/dist/cli/cli-config.js.map +0 -1
  58. package/dist/cli/cli-format.js.map +0 -1
  59. package/dist/cli/cli-server.js.map +0 -1
  60. package/dist/cli/cli-timeline.js.map +0 -1
  61. package/dist/cli/cli.js.map +0 -1
  62. package/dist/cli/fork-cli.js.map +0 -1
  63. package/dist/cli/oauth-cli.js.map +0 -1
  64. package/dist/cli/setup.js.map +0 -1
  65. package/dist/cli/skills-install.js.map +0 -1
  66. package/dist/config/config-resolve.d.ts +0 -28
  67. package/dist/config/config-resolve.js +0 -47
  68. package/dist/config/config-resolve.js.map +0 -1
  69. package/dist/config/config.d.ts +0 -157
  70. package/dist/config/config.js +0 -581
  71. package/dist/config/config.js.map +0 -1
  72. package/dist/config/core-pin.d.ts +0 -16
  73. package/dist/config/core-pin.js +0 -85
  74. package/dist/config/core-pin.js.map +0 -1
  75. package/dist/config/overlay-assets.d.ts +0 -20
  76. package/dist/config/overlay-assets.js +0 -114
  77. package/dist/config/overlay-assets.js.map +0 -1
  78. package/dist/config/overlay-bootstrap.d.ts +0 -44
  79. package/dist/config/overlay-bootstrap.js +0 -304
  80. package/dist/config/overlay-bootstrap.js.map +0 -1
  81. package/dist/connectors/github-webhook.d.ts +0 -45
  82. package/dist/connectors/github-webhook.js +0 -321
  83. package/dist/connectors/github-webhook.js.map +0 -1
  84. package/dist/connectors/index.d.ts +0 -18
  85. package/dist/connectors/index.js +0 -41
  86. package/dist/connectors/index.js.map +0 -1
  87. package/dist/connectors/messaging/base.d.ts +0 -42
  88. package/dist/connectors/messaging/base.js +0 -139
  89. package/dist/connectors/messaging/base.js.map +0 -1
  90. package/dist/connectors/messaging/delivery.d.ts +0 -14
  91. package/dist/connectors/messaging/delivery.js +0 -38
  92. package/dist/connectors/messaging/delivery.js.map +0 -1
  93. package/dist/connectors/messaging/index.d.ts +0 -4
  94. package/dist/connectors/messaging/index.js +0 -4
  95. package/dist/connectors/messaging/index.js.map +0 -1
  96. package/dist/connectors/messaging/session-manager.d.ts +0 -53
  97. package/dist/connectors/messaging/session-manager.js +0 -255
  98. package/dist/connectors/messaging/session-manager.js.map +0 -1
  99. package/dist/connectors/messaging/types.d.ts +0 -58
  100. package/dist/connectors/messaging/types.js +0 -7
  101. package/dist/connectors/messaging/types.js.map +0 -1
  102. package/dist/connectors/slack/connector.d.ts +0 -142
  103. package/dist/connectors/slack/connector.js +0 -494
  104. package/dist/connectors/slack/connector.js.map +0 -1
  105. package/dist/connectors/slack/index.d.ts +0 -2
  106. package/dist/connectors/slack/index.js +0 -3
  107. package/dist/connectors/slack/index.js.map +0 -1
  108. package/dist/connectors/slack/mrkdwn.d.ts +0 -19
  109. package/dist/connectors/slack/mrkdwn.js +0 -240
  110. package/dist/connectors/slack/mrkdwn.js.map +0 -1
  111. package/dist/connectors/types.d.ts +0 -61
  112. package/dist/connectors/types.js +0 -2
  113. package/dist/connectors/types.js.map +0 -1
  114. package/dist/cron/fanout.d.ts +0 -33
  115. package/dist/cron/fanout.js +0 -55
  116. package/dist/cron/fanout.js.map +0 -1
  117. package/dist/cron/jobs.d.ts +0 -18
  118. package/dist/cron/jobs.js +0 -37
  119. package/dist/cron/jobs.js.map +0 -1
  120. package/dist/cron/scheduler.d.ts +0 -45
  121. package/dist/cron/scheduler.js +0 -105
  122. package/dist/cron/scheduler.js.map +0 -1
  123. package/dist/engine/agent-executor.d.ts +0 -34
  124. package/dist/engine/agent-executor.js +0 -246
  125. package/dist/engine/agent-executor.js.map +0 -1
  126. package/dist/engine/chat/chat-runner.d.ts +0 -132
  127. package/dist/engine/chat/chat-runner.js +0 -424
  128. package/dist/engine/chat/chat-runner.js.map +0 -1
  129. package/dist/engine/chat/chat-skills.d.ts +0 -45
  130. package/dist/engine/chat/chat-skills.js +0 -184
  131. package/dist/engine/chat/chat-skills.js.map +0 -1
  132. package/dist/engine/chat/chat.d.ts +0 -54
  133. package/dist/engine/chat/chat.js +0 -316
  134. package/dist/engine/chat/chat.js.map +0 -1
  135. package/dist/engine/chat/message-batcher.d.ts +0 -32
  136. package/dist/engine/chat/message-batcher.js +0 -109
  137. package/dist/engine/chat/message-batcher.js.map +0 -1
  138. package/dist/engine/dispatcher.d.ts +0 -73
  139. package/dist/engine/dispatcher.js +0 -663
  140. package/dist/engine/dispatcher.js.map +0 -1
  141. package/dist/engine/event-shim.d.ts +0 -117
  142. package/dist/engine/event-shim.js +0 -435
  143. package/dist/engine/event-shim.js.map +0 -1
  144. package/dist/engine/executors/orchestrator.d.ts +0 -81
  145. package/dist/engine/executors/orchestrator.js +0 -365
  146. package/dist/engine/executors/orchestrator.js.map +0 -1
  147. package/dist/engine/executors/shared.d.ts +0 -189
  148. package/dist/engine/executors/shared.js +0 -616
  149. package/dist/engine/executors/shared.js.map +0 -1
  150. package/dist/engine/github/git-auth.d.ts +0 -62
  151. package/dist/engine/github/git-auth.js +0 -161
  152. package/dist/engine/github/git-auth.js.map +0 -1
  153. package/dist/engine/github/github-app-client.d.ts +0 -23
  154. package/dist/engine/github/github-app-client.js +0 -33
  155. package/dist/engine/github/github-app-client.js.map +0 -1
  156. package/dist/engine/github/github-tools.d.ts +0 -18
  157. package/dist/engine/github/github-tools.js +0 -263
  158. package/dist/engine/github/github-tools.js.map +0 -1
  159. package/dist/engine/github/github.d.ts +0 -1193
  160. package/dist/engine/github/github.js +0 -357
  161. package/dist/engine/github/github.js.map +0 -1
  162. package/dist/engine/github/profiles.d.ts +0 -279
  163. package/dist/engine/github/profiles.js +0 -42
  164. package/dist/engine/github/profiles.js.map +0 -1
  165. package/dist/engine/github/review-poster.d.ts +0 -98
  166. package/dist/engine/github/review-poster.js +0 -177
  167. package/dist/engine/github/review-poster.js.map +0 -1
  168. package/dist/engine/llm.d.ts +0 -79
  169. package/dist/engine/llm.js +0 -269
  170. package/dist/engine/llm.js.map +0 -1
  171. package/dist/engine/oauth.d.ts +0 -43
  172. package/dist/engine/oauth.js +0 -103
  173. package/dist/engine/oauth.js.map +0 -1
  174. package/dist/engine/router.d.ts +0 -29
  175. package/dist/engine/router.js +0 -680
  176. package/dist/engine/router.js.map +0 -1
  177. package/dist/engine/screen/classifier.d.ts +0 -93
  178. package/dist/engine/screen/classifier.js +0 -215
  179. package/dist/engine/screen/classifier.js.map +0 -1
  180. package/dist/engine/screen/screen.d.ts +0 -41
  181. package/dist/engine/screen/screen.js +0 -93
  182. package/dist/engine/screen/screen.js.map +0 -1
  183. package/dist/evals-api.d.ts +0 -24
  184. package/dist/evals-api.js +0 -22
  185. package/dist/evals-api.js.map +0 -1
  186. package/dist/index.d.ts +0 -1
  187. package/dist/index.js +0 -940
  188. package/dist/index.js.map +0 -1
  189. package/dist/managed-repos.d.ts +0 -30
  190. package/dist/managed-repos.js +0 -72
  191. package/dist/managed-repos.js.map +0 -1
  192. package/dist/notify/blocks.d.ts +0 -23
  193. package/dist/notify/blocks.js +0 -118
  194. package/dist/notify/blocks.js.map +0 -1
  195. package/dist/notify/index.d.ts +0 -17
  196. package/dist/notify/index.js +0 -7
  197. package/dist/notify/index.js.map +0 -1
  198. package/dist/notify/model.d.ts +0 -57
  199. package/dist/notify/model.js +0 -89
  200. package/dist/notify/model.js.map +0 -1
  201. package/dist/notify/notifier.d.ts +0 -18
  202. package/dist/notify/notifier.js +0 -100
  203. package/dist/notify/notifier.js.map +0 -1
  204. package/dist/notify/render.d.ts +0 -21
  205. package/dist/notify/render.js +0 -59
  206. package/dist/notify/render.js.map +0 -1
  207. package/dist/notify/transports/github.d.ts +0 -26
  208. package/dist/notify/transports/github.js +0 -27
  209. package/dist/notify/transports/github.js.map +0 -1
  210. package/dist/notify/transports/slack.d.ts +0 -27
  211. package/dist/notify/transports/slack.js +0 -37
  212. package/dist/notify/transports/slack.js.map +0 -1
  213. package/dist/notify/types.d.ts +0 -119
  214. package/dist/notify/types.js +0 -16
  215. package/dist/notify/types.js.map +0 -1
  216. package/dist/providers.d.ts +0 -125
  217. package/dist/providers.js +0 -279
  218. package/dist/providers.js.map +0 -1
  219. package/dist/sandbox/docker.d.ts +0 -180
  220. package/dist/sandbox/docker.js +0 -517
  221. package/dist/sandbox/docker.js.map +0 -1
  222. package/dist/sandbox/egress-allowlist.d.ts +0 -74
  223. package/dist/sandbox/egress-allowlist.js +0 -164
  224. package/dist/sandbox/egress-allowlist.js.map +0 -1
  225. package/dist/sandbox/egress-firewall-config.d.ts +0 -127
  226. package/dist/sandbox/egress-firewall-config.js +0 -434
  227. package/dist/sandbox/egress-firewall-config.js.map +0 -1
  228. package/dist/sandbox/images.d.ts +0 -23
  229. package/dist/sandbox/images.js +0 -55
  230. package/dist/sandbox/images.js.map +0 -1
  231. package/dist/sandbox/index.d.ts +0 -112
  232. package/dist/sandbox/index.js +0 -332
  233. package/dist/sandbox/index.js.map +0 -1
  234. package/dist/sandbox/sandbox.d.ts +0 -214
  235. package/dist/sandbox/sandbox.js +0 -453
  236. package/dist/sandbox/sandbox.js.map +0 -1
  237. package/dist/sandbox/smol.d.ts +0 -162
  238. package/dist/sandbox/smol.js +0 -485
  239. package/dist/sandbox/smol.js.map +0 -1
  240. package/dist/session-log.d.ts +0 -63
  241. package/dist/session-log.js +0 -290
  242. package/dist/session-log.js.map +0 -1
  243. package/dist/state/approval-store.d.ts +0 -88
  244. package/dist/state/approval-store.js +0 -149
  245. package/dist/state/approval-store.js.map +0 -1
  246. package/dist/state/build-assets.d.ts +0 -50
  247. package/dist/state/build-assets.js +0 -154
  248. package/dist/state/build-assets.js.map +0 -1
  249. package/dist/state/db.d.ts +0 -81
  250. package/dist/state/db.js +0 -155
  251. package/dist/state/db.js.map +0 -1
  252. package/dist/state/execution-store.d.ts +0 -257
  253. package/dist/state/execution-store.js +0 -527
  254. package/dist/state/execution-store.js.map +0 -1
  255. package/dist/state/migrate.d.ts +0 -15
  256. package/dist/state/migrate.js +0 -175
  257. package/dist/state/migrate.js.map +0 -1
  258. package/dist/state/workflow-run-store.d.ts +0 -216
  259. package/dist/state/workflow-run-store.js +0 -403
  260. package/dist/state/workflow-run-store.js.map +0 -1
  261. package/dist/telemetry/index.d.ts +0 -38
  262. package/dist/telemetry/index.js +0 -253
  263. package/dist/telemetry/index.js.map +0 -1
  264. package/dist/telemetry/pi-events.d.ts +0 -12
  265. package/dist/telemetry/pi-events.js +0 -134
  266. package/dist/telemetry/pi-events.js.map +0 -1
  267. package/dist/workflows/dag.d.ts +0 -37
  268. package/dist/workflows/dag.js +0 -118
  269. package/dist/workflows/dag.js.map +0 -1
  270. package/dist/workflows/loader.d.ts +0 -53
  271. package/dist/workflows/loader.js +0 -421
  272. package/dist/workflows/loader.js.map +0 -1
  273. package/dist/workflows/loop-eval.d.ts +0 -28
  274. package/dist/workflows/loop-eval.js +0 -74
  275. package/dist/workflows/loop-eval.js.map +0 -1
  276. package/dist/workflows/phase-executor.d.ts +0 -222
  277. package/dist/workflows/phase-executor.js +0 -1153
  278. package/dist/workflows/phase-executor.js.map +0 -1
  279. package/dist/workflows/phase-ref.d.ts +0 -50
  280. package/dist/workflows/phase-ref.js +0 -91
  281. package/dist/workflows/phase-ref.js.map +0 -1
  282. package/dist/workflows/resume.d.ts +0 -58
  283. package/dist/workflows/resume.js +0 -313
  284. package/dist/workflows/resume.js.map +0 -1
  285. package/dist/workflows/runner.d.ts +0 -63
  286. package/dist/workflows/runner.js +0 -381
  287. package/dist/workflows/runner.js.map +0 -1
  288. package/dist/workflows/schema.d.ts +0 -344
  289. package/dist/workflows/schema.js +0 -460
  290. package/dist/workflows/schema.js.map +0 -1
  291. package/dist/workflows/simple.d.ts +0 -90
  292. package/dist/workflows/simple.js +0 -393
  293. package/dist/workflows/simple.js.map +0 -1
  294. package/dist/workflows/target-policy.d.ts +0 -74
  295. package/dist/workflows/target-policy.js +0 -80
  296. package/dist/workflows/target-policy.js.map +0 -1
  297. package/dist/workflows/templates.d.ts +0 -88
  298. package/dist/workflows/templates.js +0 -127
  299. package/dist/workflows/templates.js.map +0 -1
  300. package/dist/workflows/triggers.d.ts +0 -21
  301. package/dist/workflows/triggers.js +0 -45
  302. package/dist/workflows/triggers.js.map +0 -1
  303. package/dist/workflows/verdict.d.ts +0 -19
  304. package/dist/workflows/verdict.js +0 -30
  305. package/dist/workflows/verdict.js.map +0 -1
  306. package/dist/worktree/manager.d.ts +0 -43
  307. package/dist/worktree/manager.js +0 -127
  308. package/dist/worktree/manager.js.map +0 -1
  309. package/docker-compose.yml +0 -274
  310. package/sandbox.Dockerfile +0 -68
  311. package/skills/README.md +0 -42
  312. package/skills/browser-qa/SKILL.md +0 -208
  313. package/skills/browser-qa/scripts/agent-browser.mjs +0 -531
  314. package/skills/building/SKILL.md +0 -95
  315. package/skills/chat/SKILL.md +0 -36
  316. package/skills/code-review/SKILL.md +0 -82
  317. package/skills/debug-production/SKILL.md +0 -108
  318. package/skills/demo/SKILL.md +0 -228
  319. package/skills/demo/scripts/compose-demo.sh +0 -243
  320. package/skills/issue-answer/SKILL.md +0 -91
  321. package/skills/issue-comment/SKILL.md +0 -49
  322. package/skills/issue-triage/SKILL.md +0 -149
  323. package/skills/issue-triage/references/AGENT-BRIEF.md +0 -65
  324. package/skills/pr-comment/SKILL.md +0 -64
  325. package/skills/pr-review/SKILL.md +0 -148
  326. package/skills/pr-review/references/findings-schema.md +0 -89
  327. package/skills/qa-test/SKILL.md +0 -97
  328. package/skills/repo-health/SKILL.md +0 -67
  329. package/skills/security-feedback/SKILL.md +0 -173
  330. package/skills/security-feedback/references/templates.md +0 -77
  331. package/skills/security-review/SKILL.md +0 -215
  332. package/skills/security-review/references/issue-format.md +0 -302
  333. package/skills/verify/SKILL.md +0 -118
  334. package/workflows/answer.yaml +0 -44
  335. package/workflows/build.yaml +0 -129
  336. package/workflows/cron-health.yaml +0 -6
  337. package/workflows/cron-review.yaml +0 -8
  338. package/workflows/cron-security.yaml +0 -6
  339. package/workflows/cron-triage.yaml +0 -8
  340. package/workflows/demo.yaml +0 -62
  341. package/workflows/examples/bash-smoke.yaml +0 -41
  342. package/workflows/examples/parallel-review.yaml +0 -36
  343. package/workflows/examples/tdd-loop.yaml +0 -17
  344. package/workflows/explore.yaml +0 -80
  345. package/workflows/issue-comment.yaml +0 -15
  346. package/workflows/issue-triage.yaml +0 -22
  347. package/workflows/pr-comment.yaml +0 -16
  348. package/workflows/pr-fix.yaml +0 -17
  349. package/workflows/pr-review.yaml +0 -50
  350. package/workflows/prompts/answer.md +0 -68
  351. package/workflows/prompts/architect.md +0 -44
  352. package/workflows/prompts/classifier.md +0 -60
  353. package/workflows/prompts/classify-adds-info.md +0 -17
  354. package/workflows/prompts/demo.md +0 -125
  355. package/workflows/prompts/executor.md +0 -42
  356. package/workflows/prompts/explore-ask.md +0 -99
  357. package/workflows/prompts/explore-publish.md +0 -31
  358. package/workflows/prompts/explore-read.md +0 -120
  359. package/workflows/prompts/explore-synthesize.md +0 -88
  360. package/workflows/prompts/fix.md +0 -18
  361. package/workflows/prompts/guardrails.md +0 -96
  362. package/workflows/prompts/pr-fix.md +0 -26
  363. package/workflows/prompts/pr.md +0 -39
  364. package/workflows/prompts/qa-browser.md +0 -95
  365. package/workflows/prompts/qa-synth.md +0 -44
  366. package/workflows/prompts/qa-test.md +0 -60
  367. package/workflows/prompts/re-reviewer.md +0 -33
  368. package/workflows/prompts/reviewer.md +0 -60
  369. package/workflows/prompts/verify-browser.md +0 -93
  370. package/workflows/prompts/verify-synth.md +0 -44
  371. package/workflows/prompts/verify.md +0 -63
  372. package/workflows/qa-test.yaml +0 -94
  373. package/workflows/repo-health.yaml +0 -15
  374. package/workflows/security-feedback.yaml +0 -25
  375. package/workflows/security-review.yaml +0 -37
  376. package/workflows/verify.yaml +0 -93
  377. /package/dist/{cli/cli-config.d.ts → cli-config.d.ts} +0 -0
  378. /package/dist/{cli/cli-config.js → cli-config.js} +0 -0
  379. /package/dist/{cli/cli-format.d.ts → cli-format.d.ts} +0 -0
  380. /package/dist/{cli/cli-format.js → cli-format.js} +0 -0
  381. /package/dist/{cli/cli-timeline.d.ts → cli-timeline.d.ts} +0 -0
  382. /package/dist/{cli/cli-timeline.js → cli-timeline.js} +0 -0
  383. /package/dist/{cli/cli.d.ts → cli.d.ts} +0 -0
  384. /package/dist/{cli/oauth-cli.d.ts → oauth-cli.d.ts} +0 -0
  385. /package/dist/{cli/setup.d.ts → setup.d.ts} +0 -0
@@ -1,357 +0,0 @@
1
- import { githubAppClient, githubTokenClient, } from "./github-app-client.js";
2
- /**
3
- * GitHub client for the harness — uses GitHub App auth.
4
- * Used by the orchestrator to post comments, not by agent sessions.
5
- */
6
- export class GitHubClient {
7
- octokit;
8
- constructor(config) {
9
- this.octokit = githubAppClient(config);
10
- }
11
- /**
12
- * Build a client authed with a raw bearer token (a pre-minted installation
13
- * token) instead of App JWT auth. Used by the harness-side `post-review`
14
- * action: prod passes the run's scoped review-write token; evals pass the
15
- * mock's token + `baseUrl`. Avoids the App installation-token minting
16
- * round-trip (which hard-codes api.github.com and the evals mock doesn't
17
- * serve).
18
- */
19
- static withToken(token, baseUrl) {
20
- const client = Object.create(GitHubClient.prototype);
21
- client.octokit = githubTokenClient(token, baseUrl);
22
- return client;
23
- }
24
- /**
25
- * Create a new comment on an issue/PR. Returns the new comment id so callers
26
- * that want to edit it later (the in-place status checklist — see
27
- * `src/notify/transports/github.ts`) can hold onto a handle. Callers that
28
- * just post a one-off comment can ignore the return.
29
- */
30
- async postComment(owner, repo, issueNumber, body) {
31
- const { data } = await this.octokit.rest.issues.createComment({
32
- owner,
33
- repo,
34
- issue_number: issueNumber,
35
- body,
36
- });
37
- return data.id;
38
- }
39
- /**
40
- * List every repository the App installation can access, as `owner/repo`
41
- * full names. Used at boot to seed the managed-repo list from the App grant
42
- * (see src/managed-repos.ts). The installation id is bound by the App auth
43
- * strategy, so no argument is needed. Paginated — handles installs with
44
- * hundreds of repos.
45
- */
46
- async listInstallationRepos() {
47
- const repos = await this.octokit.paginate(this.octokit.rest.apps.listReposAccessibleToInstallation, { per_page: 100 });
48
- return repos.map((r) => r.full_name);
49
- }
50
- /**
51
- * Edit an existing issue/PR comment in place. Paired with `postComment` to
52
- * maintain a single status comment that updates as a workflow progresses,
53
- * rather than posting a new comment per phase. GitHub does NOT notify
54
- * watchers on edits, which is exactly why this keeps the thread quiet.
55
- */
56
- async updateComment(owner, repo, commentId, body) {
57
- await this.octokit.rest.issues.updateComment({
58
- owner,
59
- repo,
60
- comment_id: commentId,
61
- body,
62
- });
63
- }
64
- /**
65
- * Add an emoji reaction to a specific issue comment. Used as an immediate
66
- * (silent) acknowledgment that the agent has accepted a request, before
67
- * any actual work — and any chatty bot comments — start.
68
- *
69
- * Reaction `content` values: "+1" | "-1" | "laugh" | "confused" | "heart"
70
- * | "hooray" | "rocket" | "eyes".
71
- */
72
- async reactToComment(owner, repo, commentId, content = "rocket") {
73
- await this.octokit.rest.reactions.createForIssueComment({
74
- owner,
75
- repo,
76
- comment_id: commentId,
77
- content,
78
- });
79
- }
80
- /**
81
- * Add an emoji reaction to an issue or PR itself (not a comment) — used to
82
- * ack events that aren't comments, e.g. a freshly opened issue/PR. PRs are
83
- * issues for the reactions API, so this works for both.
84
- */
85
- async reactToIssue(owner, repo, issueNumber, content = "eyes") {
86
- await this.octokit.rest.reactions.createForIssue({
87
- owner,
88
- repo,
89
- issue_number: issueNumber,
90
- content,
91
- });
92
- }
93
- /**
94
- * Add an emoji reaction to a pull-request review comment (inline diff
95
- * comment). Distinct endpoint from issue comments — review comments live on
96
- * the pulls API.
97
- */
98
- async reactToReviewComment(owner, repo, commentId, content = "eyes") {
99
- await this.octokit.rest.reactions.createForPullRequestReviewComment({
100
- owner,
101
- repo,
102
- comment_id: commentId,
103
- content,
104
- });
105
- }
106
- async getIssue(owner, repo, issueNumber) {
107
- const { data } = await this.octokit.rest.issues.get({
108
- owner,
109
- repo,
110
- issue_number: issueNumber,
111
- });
112
- return data;
113
- }
114
- /**
115
- * Fetch the issue body. Used by the dispatch path so build/explore/pr-fix
116
- * workflows always see the real issue body, even when triggered from a
117
- * comment (where the EventEnvelope.body field is the comment, not the
118
- * issue body).
119
- */
120
- async getIssueBody(owner, repo, issueNumber) {
121
- const { data } = await this.octokit.rest.issues.get({
122
- owner,
123
- repo,
124
- issue_number: issueNumber,
125
- });
126
- return data.body || "";
127
- }
128
- /**
129
- * List all comments on an issue/PR, oldest first. Used by the dispatch path
130
- * to inject the full conversation thread into the architect's context — the
131
- * spec the bot writes during an `explore` run lives here, and the build
132
- * cycle needs to see it to implement the agreed design.
133
- */
134
- async listIssueComments(owner, repo, issueNumber) {
135
- const data = await this.octokit.paginate(this.octokit.rest.issues.listComments, { owner, repo, issue_number: issueNumber, per_page: 100 });
136
- return data.map((c) => ({
137
- user: c.user?.login || "unknown",
138
- body: c.body || "",
139
- createdAt: c.created_at,
140
- }));
141
- }
142
- async getPullRequest(owner, repo, pullNumber) {
143
- const { data } = await this.octokit.rest.pulls.get({
144
- owner,
145
- repo,
146
- pull_number: pullNumber,
147
- });
148
- return data;
149
- }
150
- /**
151
- * The repo's default branch (e.g. `main`, `master`, `develop`). Used to
152
- * scope build runs to the real base branch instead of assuming `main` — a
153
- * `master`-default repo otherwise breaks every `git ... main..HEAD` the
154
- * reviewer runs. See the `baseBranch` plumbing in src/index.ts.
155
- */
156
- async getDefaultBranch(owner, repo) {
157
- const { data } = await this.octokit.rest.repos.get({ owner, repo });
158
- return data.default_branch;
159
- }
160
- /** Convenience: fetch only the PR's head commit SHA. Used by check-run code. */
161
- async getPullRequestHeadSha(owner, repo, pullNumber) {
162
- const { data } = await this.octokit.rest.pulls.get({
163
- owner,
164
- repo,
165
- pull_number: pullNumber,
166
- });
167
- return data.head.sha;
168
- }
169
- /**
170
- * Create a Check Run on a PR's head commit. Returns the new check_run id so
171
- * the caller can later transition it from `in_progress` → `completed` with
172
- * a conclusion. Repos that enable "Require status checks to pass" with
173
- * `name` in their list will gate merges on the eventual conclusion.
174
- *
175
- * Requires the GitHub App to have `Checks: Read and write` permission.
176
- */
177
- async createCheckRun(owner, repo, headSha, name, options = {}) {
178
- const { data } = await this.octokit.rest.checks.create({
179
- owner,
180
- repo,
181
- name,
182
- head_sha: headSha,
183
- status: "in_progress",
184
- started_at: new Date().toISOString(),
185
- ...(options.detailsUrl ? { details_url: options.detailsUrl } : {}),
186
- ...(options.output ? { output: options.output } : {}),
187
- });
188
- return data.id;
189
- }
190
- /**
191
- * Update an existing Check Run — typically to transition `in_progress` →
192
- * `completed` with a conclusion. Conclusion values that branch protection
193
- * treats as passing: `success`, `neutral`, `skipped`. Failing: `failure`,
194
- * `cancelled`, `timed_out`, `action_required`.
195
- */
196
- async updateCheckRun(owner, repo, checkRunId, update) {
197
- await this.octokit.rest.checks.update({
198
- owner,
199
- repo,
200
- check_run_id: checkRunId,
201
- ...(update.status ? { status: update.status } : {}),
202
- ...(update.conclusion ? { conclusion: update.conclusion } : {}),
203
- ...(update.status === "completed" ? { completed_at: new Date().toISOString() } : {}),
204
- ...(update.detailsUrl ? { details_url: update.detailsUrl } : {}),
205
- ...(update.output ? { output: update.output } : {}),
206
- });
207
- }
208
- /**
209
- * Find the bot's most recent review on this PR's current head commit. Used
210
- * after a pr-review workflow finishes to derive the check-run conclusion
211
- * from the review the agent actually posted (APPROVE / REQUEST_CHANGES /
212
- * COMMENT). Returns null when the bot hasn't reviewed this SHA yet.
213
- *
214
- * `botLogin` defaults to `last-light[bot]` so the lookup matches App-auth'd
215
- * reviews regardless of how the agent identified itself.
216
- */
217
- async getLatestBotReview(owner, repo, pullNumber, headSha, botLogin = "last-light[bot]") {
218
- const reviews = await this.octokit.paginate(this.octokit.rest.pulls.listReviews, {
219
- owner,
220
- repo,
221
- pull_number: pullNumber,
222
- per_page: 100,
223
- });
224
- // Reviews are returned oldest-first; iterate newest-first to pick the most
225
- // recent one tied to this SHA. `commit_id` on a review is the head sha at
226
- // the time the review was submitted, which is exactly the discriminator
227
- // we want — re-pushes invalidate stale reviews here naturally.
228
- for (let i = reviews.length - 1; i >= 0; i--) {
229
- const r = reviews[i];
230
- if (r.user?.login === botLogin && r.commit_id === headSha) {
231
- return { state: r.state, body: r.body ?? null, submittedAt: r.submitted_at ?? null };
232
- }
233
- }
234
- return null;
235
- }
236
- /**
237
- * Fetch a PR's unified diff (three-dot, base…head) as a string. Used by the
238
- * `post-review` action to anchor findings to changed lines — the harness runs
239
- * this in-process (not in the sandbox), so the diff comes from the API rather
240
- * than a local `git diff`, with no dependency on checkout/fetch state.
241
- */
242
- async getPullRequestDiff(owner, repo, pullNumber) {
243
- const res = await this.octokit.rest.pulls.get({
244
- owner,
245
- repo,
246
- pull_number: pullNumber,
247
- mediaType: { format: "diff" },
248
- });
249
- // With `format: diff` Octokit returns the raw diff as the response body,
250
- // typed as the JSON shape — cast through unknown.
251
- return res.data;
252
- }
253
- /**
254
- * Submit one formal PR review with an event (APPROVE / REQUEST_CHANGES /
255
- * COMMENT) plus optional line-anchored inline comments. `commitId` pins the
256
- * review to the reviewed head SHA. This is the single harness-side write for
257
- * PR reviews — the reviewer agent never submits; it writes findings and the
258
- * `post-review` action calls this. Throws on a non-2xx so the action can fail
259
- * the phase visibly (or retry body-only).
260
- */
261
- async createPullRequestReview(owner, repo, pullNumber, review) {
262
- await this.octokit.rest.pulls.createReview({
263
- owner,
264
- repo,
265
- pull_number: pullNumber,
266
- body: review.body,
267
- event: review.event,
268
- ...(review.comments && review.comments.length ? { comments: review.comments } : {}),
269
- ...(review.commitId ? { commit_id: review.commitId } : {}),
270
- });
271
- }
272
- /**
273
- * Get failed check runs for a PR's head SHA.
274
- * Fetches the actual job logs (not just annotations) to show real errors.
275
- */
276
- async getFailedChecks(owner, repo, ref) {
277
- try {
278
- const { data } = await this.octokit.rest.checks.listForRef({
279
- owner,
280
- repo,
281
- ref,
282
- filter: "latest",
283
- });
284
- const failed = data.check_runs.filter((r) => r.conclusion === "failure" || r.conclusion === "timed_out");
285
- if (failed.length === 0)
286
- return "No failed checks found.";
287
- const summaries = await Promise.all(failed.map(async (run) => {
288
- let logExcerpt = "";
289
- // Try to fetch the actual job log (contains the real errors)
290
- if (run.details_url) {
291
- try {
292
- // Extract the job ID from the check run — the run is linked to a workflow job
293
- const jobId = run.id;
294
- const { data: logData } = await this.octokit.rest.actions.downloadJobLogsForWorkflowRun({
295
- owner,
296
- repo,
297
- job_id: jobId,
298
- });
299
- // logData is a string with the full log
300
- const fullLog = typeof logData === "string" ? logData : String(logData);
301
- // Extract the last N lines which typically contain the error
302
- const lines = fullLog.split("\n");
303
- // Find error lines and surrounding context
304
- const errorLines = [];
305
- for (let i = 0; i < lines.length; i++) {
306
- const line = lines[i];
307
- if (line.match(/error|ERR!|FAIL|failed|Error:|npm ERR/i) && !line.match(/^$/)) {
308
- // Include some context before and after
309
- const start = Math.max(0, i - 2);
310
- const end = Math.min(lines.length, i + 5);
311
- for (let j = start; j < end; j++) {
312
- if (!errorLines.includes(lines[j])) {
313
- errorLines.push(lines[j]);
314
- }
315
- }
316
- }
317
- }
318
- if (errorLines.length > 0) {
319
- logExcerpt = errorLines.slice(0, 50).join("\n");
320
- }
321
- else {
322
- // No error lines found — show the last 30 lines
323
- logExcerpt = lines.slice(-30).join("\n");
324
- }
325
- }
326
- catch {
327
- // Job logs may not be available — fall back to annotations
328
- }
329
- }
330
- // Fall back to annotations if no job logs
331
- if (!logExcerpt) {
332
- try {
333
- const { data: annotations } = await this.octokit.rest.checks.listAnnotations({
334
- owner,
335
- repo,
336
- check_run_id: run.id,
337
- });
338
- if (annotations.length > 0) {
339
- logExcerpt = annotations
340
- .filter((a) => a.annotation_level === "failure")
341
- .slice(0, 10)
342
- .map((a) => `${a.path}:${a.start_line} — ${a.message}`)
343
- .join("\n");
344
- }
345
- }
346
- catch { /* annotations may not be available */ }
347
- }
348
- return `### ${run.name}: ${run.conclusion}\n${logExcerpt || "No log details available."}`;
349
- }));
350
- return summaries.join("\n\n");
351
- }
352
- catch (err) {
353
- return `Could not fetch check runs: ${err.message}`;
354
- }
355
- }
356
- }
357
- //# sourceMappingURL=github.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"github.js","sourceRoot":"","sources":["../../../src/engine/github/github.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,iBAAiB,GAElB,MAAM,wBAAwB,CAAC;AAchC;;;GAGG;AACH,MAAM,OAAO,YAAY;IACf,OAAO,CAAU;IAEzB,YAAY,MAA6B;QACvC,IAAI,CAAC,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,SAAS,CAAC,KAAa,EAAE,OAAgB;QAC9C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,CAAiB,CAAC;QACrE,MAAM,CAAC,OAAO,GAAG,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACnD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CAAC,KAAa,EAAE,IAAY,EAAE,WAAmB,EAAE,IAAY;QAC9E,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;YAC5D,KAAK;YACL,IAAI;YACJ,YAAY,EAAE,WAAW;YACzB,IAAI;SACL,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,EA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AC,sCAAsC,CAAC,CAAC;gBACpD,CAAC;gBAED,OAAO,OAAO,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,UAAU,KAAK,UAAU,IAAI,2BAA2B,EAAE,CAAC;YAC5F,CAAC,CAAC,CAAC,CAAC;YAEJ,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,+BAA+B,GAAG,CAAC,OAAO,EAAE,CAAC;QACtD,CAAC;IACH,CAAC;CACF"}
@@ -1,279 +0,0 @@
1
- import type { GitHubTokenPermissions } from "./git-auth.js";
2
- import type { BuildAssetsLocation, OtelConfig, SandboxBackend } from "../../config/config.js";
3
- /**
4
- * Configuration for an agent execution.
5
- */
6
- export interface ExecutorConfig {
7
- /** Working directory for the agent (used by the no-sandbox path). */
8
- cwd?: string;
9
- /** Maximum conversation turns. Unused by agentic-pi; kept for API stability. */
10
- maxTurns?: number;
11
- /** Model id (e.g. "anthropic/claude-sonnet-4-6"). */
12
- model?: string;
13
- /**
14
- * Pi thinking level: `off | minimal | low | medium | high | xhigh`.
15
- * Forwarded to agentic-pi as the `thinking` option. When omitted,
16
- * agentic-pi uses the model's default.
17
- */
18
- variant?: string;
19
- /** Path to agent context directory. */
20
- agentContextDir?: string;
21
- /** Directory for persistent state. */
22
- stateDir?: string;
23
- /** Directory for agent sandboxes (cloned repos). */
24
- sandboxDir?: string;
25
- /**
26
- * Run the agent in a `<workspace>/<repoSubdir>/` SUBDIRECTORY instead of the
27
- * workspace root, WITHOUT going through the token-gated `prePopulate`/clone
28
- * path. For callers that pre-seed the repo themselves (e.g. the evals harness
29
- * in static-token mode): it reproduces production's nested layout — the repo
30
- * checkout is a child dir, while `AGENTS.md`/`.lastlight-skills/` stay at the
31
- * workspace root, siblings outside the repo's git tree. Ignored when a real
32
- * `prePopulate` clone runs (that already nests into `<repo>/`). Use backend
33
- * `none` so skills stage at the root rather than under the repo.
34
- */
35
- repoSubdir?: string;
36
- /** Where the shim writes dashboard envelope jsonl. */
37
- sessionsDir?: string;
38
- /** Workflow sandbox backend (overrides config-level default). */
39
- sandbox?: SandboxBackend;
40
- /**
41
- * Which docker sandbox image this phase runs in: `"qa"` selects the
42
- * browser-QA image (Playwright + Chromium), anything else the lean default.
43
- * Overlaid per-phase from `sandbox_image:` by `phaseConfigFor`; only acted on
44
- * by the docker path.
45
- */
46
- sandboxImage?: "default" | "qa";
47
- /**
48
- * Where build handoff docs live for this run:
49
- * - "repo" (default): the agent writes/commits `.lastlight/<issueKey>/`
50
- * into the target repo branch; the stage-in/harvest seam is skipped.
51
- * - "server": docs are staged in from / harvested back to the server store
52
- * under `buildAssetsDir`, never committed. Set from the runtime config.
53
- */
54
- buildAssets?: BuildAssetsLocation;
55
- /** Filesystem root for the server-mode build-assets store (when buildAssets === "server"). */
56
- buildAssetsDir?: string;
57
- /**
58
- * Server-mode artifact identity for this run. Used by the stage-in/harvest
59
- * seam to locate the run's docs in the store at
60
- * `<buildAssetsDir>/<owner>/<repo>/<issueKey>/`. Set per run from simple.ts.
61
- */
62
- buildAssetsKey?: {
63
- owner: string;
64
- repo: string;
65
- issueKey: string;
66
- };
67
- /**
68
- * Bypass the HTTP egress allowlist for this phase. When true:
69
- * - gondolin: `allowedHttpHosts: ["*"]` is passed to agentic-pi.
70
- * - docker: the sandbox container uses the open CoreDNS/nginx
71
- * egress-firewall pair instead of the strict one.
72
- *
73
- * Default false. Set via the `unrestricted_egress` field on a workflow
74
- * phase — used for phases that need broad web access (e.g. an explore
75
- * phase that searches third-party documentation).
76
- */
77
- unrestrictedEgress?: boolean;
78
- /**
79
- * Enable agentic-pi's web-search extension (`web_search` / `web_fetch`
80
- * tools). Default false. agentic-pi auto-enables web search whenever a
81
- * provider env var (`TAVILY_API_KEY`, `BRAVE_SEARCH_API_KEY`,
82
- * `EXA_API_KEY`) is present, so we pass an explicit `false` downstream
83
- * to suppress auto-enable for non-explore workflows.
84
- */
85
- webSearch?: boolean;
86
- /**
87
- * Force a specific web-search provider. When unset, agentic-pi picks
88
- * one based on which API key env var is present (Tavily > Exa > Brave).
89
- */
90
- webSearchProvider?: "tavily" | "brave" | "exa";
91
- /**
92
- * Override the GitHub REST API base URL for agentic-pi's built-in
93
- * `github_*` tools (Octokit `baseUrl`). Test/eval escape hatch only:
94
- * the eval harness (`evals/`) points this at a local fake GitHub server so
95
- * a real workflow runs unchanged with its GitHub calls mocked. Production
96
- * leaves it unset → `https://api.github.com`. Only honoured by the
97
- * in-process (`none`/`gondolin`) path.
98
- */
99
- githubApiBaseUrl?: string;
100
- /** Controls OTEL env forwarding and PI event redaction for workflow phase runs. */
101
- otel?: OtelConfig;
102
- telemetry?: {
103
- workflowName?: string;
104
- phaseName?: string;
105
- triggerId?: string;
106
- workflowRunId?: string;
107
- };
108
- /**
109
- * Absolute host paths to skill directories (each containing SKILL.md
110
- * plus optional scripts/, references/, assets/). Staged into a per-phase
111
- * bundle at `.lastlight-skills/<phaseName>/<basename>/` before the agent
112
- * runs — gondolin/none via symlink, docker via copy — and passed to pi
113
- * explicitly (`--skill` in docker, `skillPaths` in-process). cwd stays the
114
- * repo; the bundle is a workspace-root sibling of the repo (never committed)
115
- * on docker/none, and under the repo + local `.git/info/exclude` on gondolin
116
- * (which mounts only cwd). Keyed per phase so parallel phases stay isolated.
117
- * Resolved by `phaseConfigFor` in the workflow runner from the phase's
118
- * `skill:`/`skills:` field.
119
- */
120
- skillPaths?: string[];
121
- }
122
- /**
123
- * Normalized status of one agentic-pi extension for a single run.
124
- * Keyed by extension name ("file-search" | "github" | "web-search") in
125
- * an {@link ExtensionStatusMap}. agentic-pi emits these as `extension_status`
126
- * events at run start and on `RunResult.{fileSearch,github,webSearch}`;
127
- * lastlight captures them so the dashboard and logs show which extensions
128
- * (e.g. FFF file-search) were actually active.
129
- */
130
- export interface ExtensionStatus {
131
- /** "configured" when the extension loaded, "skipped" otherwise. */
132
- status: string;
133
- /** file-search only: "override" | "tools-only" | "tools-and-ui". */
134
- mode?: string;
135
- /** web-search only: the resolved search provider. */
136
- provider?: string;
137
- /** Number of tools the extension registered. */
138
- toolCount?: number;
139
- /** Why it was skipped (e.g. "no-credentials", "resolve-failed"). */
140
- reason?: string;
141
- }
142
- export type ExtensionStatusMap = Record<string, ExtensionStatus>;
143
- /**
144
- * One skill agentic-pi discovered for a run, flattened from the
145
- * `skills_status` event's `skills[]`. Mirrors agentic-pi's `SkillSummary`.
146
- */
147
- export interface SkillSummary {
148
- /** Skill name (from SKILL.md frontmatter). */
149
- name: string;
150
- /** Absolute path to the skill's SKILL.md. */
151
- source: string;
152
- /**
153
- * Whether the model can auto-invoke it. False when the skill set
154
- * `disable-model-invocation: true` — present but not surfaced in the
155
- * system prompt, so worth flagging in the dashboard.
156
- */
157
- modelInvocable: boolean;
158
- }
159
- /**
160
- * Normalized status of agentic-pi's skill discovery for a single run — the
161
- * skill-loading counterpart to {@link ExtensionStatus} (tool loading).
162
- * agentic-pi (≥0.2.6) emits this as a single, gated `skills_status` event at
163
- * run start: present only when skills were configured (`skillPaths`/`noSkills`)
164
- * or at least one was discovered, absent on a default run with no skills.
165
- * lastlight captures it so the dashboard's phase-detail panel can show which
166
- * skills the agent had available.
167
- */
168
- export interface SkillsStatus {
169
- /**
170
- * "default" (rely on auto-discovery), "configured" (explicit `skillPaths`
171
- * resolved), or "disabled" (`noSkills` with no explicit paths).
172
- */
173
- status: string;
174
- /** Number of skills the resource loader actually discovered. */
175
- discovered: number;
176
- /** The discovered skills, flattened. */
177
- skills: SkillSummary[];
178
- /** Operator-mapped skill paths that resolved (echoed for observability). */
179
- mappedPaths: string[];
180
- /** Whether agentic-pi's default skill discovery was disabled. */
181
- noSkills: boolean;
182
- }
183
- /**
184
- * Result from an agent execution.
185
- */
186
- export interface ExecutionResult {
187
- success: boolean;
188
- output: string;
189
- turns: number;
190
- error?: string;
191
- durationMs: number;
192
- /** Session id captured from the runtime's stream. */
193
- sessionId?: string;
194
- /** Total USD cost reported by the runtime. Zero under OAuth/subscription auth. */
195
- costUsd?: number;
196
- /** Tokens billed as fresh input (no cache hit). */
197
- inputTokens?: number;
198
- /** Tokens that triggered a cache write. */
199
- cacheCreationInputTokens?: number;
200
- /** Tokens served from prompt cache (heavily discounted). */
201
- cacheReadInputTokens?: number;
202
- /** Output tokens generated by the model. */
203
- outputTokens?: number;
204
- /** API-side duration (excludes orchestrator overhead). */
205
- apiDurationMs?: number;
206
- /** Mapped stop reason ("success" / "error_*" / etc.). */
207
- stopReason?: string;
208
- /**
209
- * Which agentic-pi extensions were active for this run, keyed by name.
210
- * Surfaced in the dashboard's phase-detail panel and persisted to the
211
- * `executions.extension_status` column.
212
- */
213
- extensions?: ExtensionStatusMap;
214
- /**
215
- * Skill-loading status captured from agentic-pi's `skills_status` event.
216
- * Surfaced alongside {@link extensions} in the dashboard's phase-detail
217
- * panel and persisted to the `executions.skills_status` column. Undefined
218
- * when the run reported no skills (the event is gated on the agentic-pi side).
219
- */
220
- skills?: SkillsStatus;
221
- }
222
- export type GitAccessProfile = "read" | "issues-write" | "review-write" | "repo-write";
223
- /**
224
- * agentic-pi's GitHub extension uses the same four profile names — they
225
- * pass through unchanged. Kept as an explicit map so renames on either
226
- * side surface as a type error rather than a silent runtime mismatch.
227
- */
228
- export declare const AGENTIC_PROFILE_FOR: Record<GitAccessProfile, string>;
229
- export interface GitSandboxAccess {
230
- owner: string;
231
- repo: string;
232
- profile: GitAccessProfile;
233
- /**
234
- * When true, sandbox MCP can mint/refresh tokens using the app PEM.
235
- * Leave false for lower-trust runs to keep private key material inaccessible.
236
- */
237
- allowMcpAppAuth?: boolean;
238
- /**
239
- * When set, the harness pre-clones the repo at this branch into the
240
- * task's workspace before the sandbox container starts. The agent then
241
- * sees the workspace already checked out — no `clone_repo` call needed
242
- * inside the session. Used by read-only workflows (pr-review, pr-fix)
243
- * that operate on an existing branch, and by branch-synthesizing
244
- * workflows (`build`, `verify`, `qa-test`, `demo` — see
245
- * `PREPOPULATE_SYNTH_WORKFLOWS`) whose `lastlight/N-slug` branch doesn't
246
- * exist on the remote yet: the missing-branch fallback in
247
- * `prePopulateWorkspace` clones the default branch and creates it locally.
248
- */
249
- prePopulateBranch?: string;
250
- /**
251
- * The owning workflow run id. Stamped into a `<workDir>/.lastlight-run`
252
- * marker by the pre-clone so a reused per-PR workspace (see
253
- * `workflowScopedTaskId` for pr-review / pr-fix) can tell "next phase of
254
- * the same run" (preserve the checkout — build's plan.md lives here) from
255
- * "a fresh run reusing an old PR dir" (fetch + hard-reset + clean, keeping
256
- * node_modules warm). Unset for non-workflow callers, which keep the old
257
- * skip-if-`.git`-exists behaviour.
258
- */
259
- runId?: string;
260
- /**
261
- * Clone shallowly (`--depth 1 --single-branch`). Set for read-only
262
- * workflows that never need history; repo-write workflows (build, pr-fix,
263
- * security-feedback) keep the deeper `--depth 50` clone so rebases / amends
264
- * have headroom.
265
- */
266
- shallow?: boolean;
267
- /**
268
- * Recreate the workspace from the **default branch** on a fresh run instead
269
- * of reusing/refreshing an existing feature-branch checkout. Set for the
270
- * `PER_TARGET_RECREATE_WORKFLOWS` (build): a re-triggered build discards any
271
- * leftover from an earlier incomplete run and starts again off current
272
- * `main`, and its feature branch is always cut from the latest default —
273
- * never inheriting a stale pushed branch (issue #153). A same-run resume
274
- * (approval gate) still preserves the checkout via the run marker.
275
- */
276
- recreateFromBase?: boolean;
277
- }
278
- export declare const GITHUB_PERMISSION_PROFILES: Record<GitAccessProfile, GitHubTokenPermissions>;
279
- export declare function loadAgentContext(_dir?: string): string;