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,453 +0,0 @@
1
- import { join, relative } from "path";
2
- import { mkdtempSync, mkdirSync, rmSync } from "fs";
3
- import { tmpdir } from "os";
4
- import { spawnSync } from "child_process";
5
- import { createTaskSandbox, setupTaskWorktree, prePopulateWorkspace } from "./index.js";
6
- import { SmolSandbox as SmolDriver, smolAvailable, SMOL_WORKSPACE_DIR } from "./smol.js";
7
- import { ALLOW_ALL_SENTINEL } from "./egress-allowlist.js";
8
- import { getDockerSandboxOtelEnv, getOtelEnvForSandbox } from "../telemetry/index.js";
9
- import { DOCKER_WORKSPACE_DIR, SKILL_BUNDLE_ROOT, stageSkillBundle, excludeFromGit, applyEnv, } from "../engine/executors/shared.js";
10
- /**
11
- * Inner-run git identity, shared by every adapter's agent path. Takes the
12
- * resolved bot login (e.g. `last-light[bot]` / `nearform-lastlight[bot]`) so
13
- * agent commits are attributed to the actual App — including a `BOT_LOGIN`
14
- * override, which the caller resolves before passing it here.
15
- */
16
- export function agentGitIdentityEnv(botLogin) {
17
- const login = botLogin;
18
- return {
19
- GIT_AUTHOR_NAME: login,
20
- GIT_AUTHOR_EMAIL: `${login}@users.noreply.github.com`,
21
- GIT_COMMITTER_NAME: login,
22
- GIT_COMMITTER_EMAIL: `${login}@users.noreply.github.com`,
23
- // /workspace is a host-UID bind mount into a different-UID guest; git refuses
24
- // to operate without an explicit safe-directory. GIT_CONFIG_* avoids needing
25
- // a writeable ~/.gitconfig.
26
- GIT_CONFIG_COUNT: "1",
27
- GIT_CONFIG_KEY_0: "safe.directory",
28
- GIT_CONFIG_VALUE_0: "*",
29
- };
30
- }
31
- /**
32
- * The single factory replacing the `if (backend === …)` ladder. Given a
33
- * backend and construction opts, returns the matching adapter. Docker's
34
- * old null-fallback is now a thrown error from `provision` (the orchestrator's
35
- * bracket surfaces it), so this never returns null.
36
- */
37
- export function sandboxFor(backend, opts) {
38
- switch (backend) {
39
- case "docker":
40
- return new DockerSandbox(opts);
41
- case "smol":
42
- return new SmolSandbox(opts);
43
- case "gondolin":
44
- return new InProcessSandbox("gondolin", opts);
45
- case "none":
46
- return new InProcessSandbox("none", opts);
47
- }
48
- }
49
- // ── Docker adapter ──────────────────────────────────────────────────
50
- /**
51
- * Wraps the docker container driver ({@link DockerDriver}) + the
52
- * `createTaskSandbox` provisioning helper. Egress is the strict/open coredns
53
- * pair selected by `--dns`; the host constants live here.
54
- */
55
- class DockerSandbox {
56
- opts;
57
- backend = "docker";
58
- sbx;
59
- agentCwd = DOCKER_WORKSPACE_DIR;
60
- constructor(opts) {
61
- this.opts = opts;
62
- }
63
- async provision(pre) {
64
- // Strict allowlist by default; an `unrestricted_egress` phase points at the
65
- // open coredns sidecar instead. IPs match docker-compose.yml's static
66
- // assignments (see src/sandbox/egress-firewall-config.ts).
67
- const dnsIp = this.opts.egress.unrestricted
68
- ? process.env.LASTLIGHT_DNS_OPEN || "172.30.0.11"
69
- : process.env.LASTLIGHT_DNS_STRICT || "172.30.0.10";
70
- const sbx = await createTaskSandbox({
71
- taskId: this.opts.taskId,
72
- stateDir: this.opts.stateDir,
73
- sandboxDir: this.opts.sandboxDir,
74
- env: this.opts.env,
75
- prePopulate: pre,
76
- dnsIp,
77
- imageName: this.opts.imageName,
78
- });
79
- if (!sbx) {
80
- throw new Error("LASTLIGHT_SANDBOX=docker but no docker sandbox was available. " +
81
- "Install Docker and build the sandbox image, or set LASTLIGHT_SANDBOX=gondolin / none.");
82
- }
83
- this.sbx = sbx;
84
- this.agentCwd = pre ? `${DOCKER_WORKSPACE_DIR}/${pre.repo}` : DOCKER_WORKSPACE_DIR;
85
- return { hostWorkspaceDir: sbx.workDir, agentCwd: this.agentCwd };
86
- }
87
- stageSkills(phaseKey, skillPaths) {
88
- if (!this.sbx)
89
- throw new Error("DockerSandbox.stageSkills before provision");
90
- // Copy (not symlink): the agent's tools run inside the container and host
91
- // symlink targets wouldn't resolve there. Map host dests → in-container paths.
92
- const staged = stageSkillBundle(this.sbx.workDir, phaseKey, skillPaths, "copy");
93
- if (!staged)
94
- return undefined;
95
- return staged.map((d) => `${DOCKER_WORKSPACE_DIR}/${relative(this.sbx.workDir, d)}`);
96
- }
97
- sandboxPathFor(relPath) {
98
- return `${DOCKER_WORKSPACE_DIR}/${relPath}`;
99
- }
100
- async runAgent(taskId, prompt, opts, onEvent) {
101
- if (!this.sbx)
102
- throw new Error("DockerSandbox.runAgent before provision");
103
- await this.sbx.sandbox.runAgent(taskId, prompt, {
104
- model: opts.model,
105
- thinking: opts.thinking,
106
- profile: opts.profile,
107
- sandboxEnv: this.innerAgentEnv(opts.sandboxEnv),
108
- agentCwd: opts.agentCwd,
109
- skillDirs: opts.skillDirs,
110
- webSearch: opts.webSearch,
111
- webSearchProvider: opts.webSearchProvider,
112
- onLine: parseLine(onEvent),
113
- });
114
- return undefined;
115
- }
116
- async runCommand(taskId, command, opts) {
117
- if (!this.sbx)
118
- throw new Error("DockerSandbox.runCommand before provision");
119
- return this.sbx.sandbox.runCommand(taskId, command, {
120
- cwd: opts.cwd,
121
- sandboxEnv: opts.sandboxEnv,
122
- timeoutSeconds: opts.timeoutSeconds,
123
- onLine: () => { },
124
- });
125
- }
126
- async dispose() {
127
- if (this.sbx)
128
- await this.sbx.cleanup();
129
- }
130
- /** Git identity + (inside-container) OTEL collector env. */
131
- innerAgentEnv(base) {
132
- const otel = this.opts.otel?.enabled && this.opts.otel.forwardToSandbox ? getDockerSandboxOtelEnv() : {};
133
- return { ...otel, ...base };
134
- }
135
- }
136
- // ── smol adapter ────────────────────────────────────────────────────
137
- /**
138
- * Wraps the smolvm micro-VM driver ({@link SmolDriver}). Egress is native
139
- * per-machine `--allow-host`; unrestricted → null (open). Provisioning boots
140
- * the VM first, then probes the share-backed host dir before cloning into it.
141
- */
142
- class SmolSandbox {
143
- opts;
144
- backend = "smol";
145
- driver;
146
- agentCwd = SMOL_WORKSPACE_DIR;
147
- hostWorkspaceDir = "";
148
- constructor(opts) {
149
- this.opts = opts;
150
- }
151
- async provision(pre) {
152
- if (!smolAvailable()) {
153
- throw new Error("LASTLIGHT_SANDBOX=smol but the smolvm CLI is not available. " +
154
- "Install smolvm (https://smolmachines.com) and start `smolvm serve`, " +
155
- "or set LASTLIGHT_SANDBOX=docker / gondolin / none.");
156
- }
157
- // Boot FIRST (workspace dir mounted), then provision the probed share. No
158
- // pre-clone here — see SmolSandbox.resolveHostWorkspace for why the mount
159
- // source isn't always the share root.
160
- const workDir = setupTaskWorktree({
161
- taskId: this.opts.taskId,
162
- stateDir: this.opts.stateDir,
163
- sandboxDir: this.opts.sandboxDir,
164
- });
165
- this.driver = new SmolDriver({
166
- env: this.opts.env,
167
- allowHosts: this.opts.egress.unrestricted ? null : this.opts.egress.hosts,
168
- });
169
- const machine = await this.driver.create({ taskId: this.opts.taskId, worktreePath: workDir });
170
- const hostWs = machine.hostWorkspace;
171
- if (pre)
172
- prePopulateWorkspace(hostWs, pre);
173
- this.hostWorkspaceDir = hostWs;
174
- this.agentCwd = pre ? `${SMOL_WORKSPACE_DIR}/${pre.repo}` : SMOL_WORKSPACE_DIR;
175
- return { hostWorkspaceDir: hostWs, agentCwd: this.agentCwd };
176
- }
177
- stageSkills(phaseKey, skillPaths) {
178
- const staged = stageSkillBundle(this.hostWorkspaceDir, phaseKey, skillPaths, "copy");
179
- if (!staged)
180
- return undefined;
181
- return staged.map((d) => `${SMOL_WORKSPACE_DIR}/${relative(this.hostWorkspaceDir, d)}`);
182
- }
183
- sandboxPathFor(relPath) {
184
- return `${SMOL_WORKSPACE_DIR}/${relPath}`;
185
- }
186
- async runAgent(taskId, prompt, opts, onEvent) {
187
- if (!this.driver)
188
- throw new Error("SmolSandbox.runAgent before provision");
189
- await this.driver.runAgent(taskId, prompt, {
190
- model: opts.model,
191
- thinking: opts.thinking,
192
- profile: opts.profile,
193
- sandboxEnv: opts.sandboxEnv,
194
- agentCwd: opts.agentCwd,
195
- skillDirs: opts.skillDirs,
196
- webSearch: opts.webSearch,
197
- webSearchProvider: opts.webSearchProvider,
198
- onLine: parseLine(onEvent),
199
- });
200
- return undefined;
201
- }
202
- async runCommand(taskId, command, opts) {
203
- if (!this.driver)
204
- throw new Error("SmolSandbox.runCommand before provision");
205
- return this.driver.runCommand(taskId, command, {
206
- cwd: opts.cwd,
207
- sandboxEnv: opts.sandboxEnv,
208
- timeoutSeconds: opts.timeoutSeconds,
209
- onLine: () => { },
210
- });
211
- }
212
- async dispose() {
213
- if (this.driver)
214
- await this.driver.destroy(this.opts.taskId);
215
- }
216
- }
217
- // ── In-process adapter (gondolin / none) ────────────────────────────
218
- /**
219
- * **One** adapter for the two in-process backends, parameterized by
220
- * `mode: 'gondolin' | 'none'`. The two differ only in agentic-pi's `sandbox`
221
- * arg and a `HOME` override. Owns the `applyEnv`/restore `process.env` splice
222
- * and the lazy `import("agentic-pi")`.
223
- *
224
- * The `mode` flag is a **tombstone** for gondolin's planned removal — when
225
- * gondolin is retired it collapses to single-mode `none`.
226
- */
227
- class InProcessSandbox {
228
- mode;
229
- opts;
230
- backend;
231
- hostWorkspaceDir = "";
232
- agentCwd = "";
233
- constructor(mode, opts) {
234
- this.mode = mode;
235
- this.opts = opts;
236
- this.backend = mode;
237
- }
238
- async provision(pre) {
239
- const workDir = setupTaskWorktree({
240
- taskId: this.opts.taskId,
241
- stateDir: this.opts.stateDir,
242
- sandboxDir: this.opts.sandboxDir,
243
- prePopulate: pre,
244
- });
245
- this.hostWorkspaceDir = workDir;
246
- // When pre-cloned, cwd is the checkout so the agent runs inside the repo
247
- // with no `cd` preamble; otherwise the workspace root. `repoSubdir` lets a
248
- // caller that pre-seeded a `<workspace>/<repo>/` checkout nest the cwd the
249
- // same way without a clone (the evals harness) — workDir (the root) stays
250
- // hostWorkspaceDir so AGENTS.md/skills remain siblings outside the repo.
251
- if (pre) {
252
- this.agentCwd = join(workDir, pre.repo);
253
- }
254
- else if (this.opts.repoSubdir) {
255
- this.agentCwd = join(workDir, this.opts.repoSubdir);
256
- mkdirSync(this.agentCwd, { recursive: true });
257
- }
258
- else {
259
- this.agentCwd = workDir;
260
- }
261
- return { hostWorkspaceDir: workDir, agentCwd: this.agentCwd };
262
- }
263
- stageSkills(phaseKey, skillPaths) {
264
- // none: stage at the workspace ROOT (host FS fully visible), by symlink —
265
- // the host resolves it and it's the cheap/CI path. gondolin mounts ONLY cwd
266
- // into the guest, so its bundle is staged under the repo (inside the mount)
267
- // AND must be COPIED, not symlinked: a symlink's target is the skill source
268
- // in the install tree (outside cwd), which isn't mounted, so it would dangle
269
- // in the guest and the agent couldn't read SKILL.md. Copying (dereferenced)
270
- // lands the real files inside the mount, exactly as docker does. The bundle
271
- // is added to the checkout's local `.git/info/exclude` so it's never committed.
272
- const gondolin = this.mode === "gondolin";
273
- const skillRoot = gondolin ? this.agentCwd : this.hostWorkspaceDir;
274
- const staged = stageSkillBundle(skillRoot, phaseKey, skillPaths, gondolin ? "copy" : "symlink");
275
- if (staged && gondolin)
276
- excludeFromGit(this.agentCwd, SKILL_BUNDLE_ROOT);
277
- return staged; // paths inside cwd → agentic-pi maps them into the guest's /workspace
278
- }
279
- sandboxPathFor(relPath) {
280
- return join(this.hostWorkspaceDir, relPath);
281
- }
282
- async runAgent(_taskId, prompt, opts, onEvent) {
283
- // agentic-pi reads its own env (provider keys, App PEM, …) from
284
- // process.env. Splice in our scoped values for the call, then restore.
285
- const restore = applyEnv(this.opts.env);
286
- const allowedHttpHosts = this.opts.egress.unrestricted ? [ALLOW_ALL_SENTINEL] : this.opts.egress.hosts;
287
- try {
288
- // Loaded lazily: agentic-pi transitively poisons the global undici
289
- // dispatcher on import, which would break the harness's own fetch. The
290
- // dynamic import keeps the harness clean unless an in-process run happens.
291
- const { run: agenticRun } = await import("agentic-pi");
292
- return await agenticRun({
293
- model: opts.model,
294
- prompt,
295
- thinking: opts.thinking,
296
- profile: opts.profile,
297
- authFile: opts.authFile,
298
- githubApiBaseUrl: opts.githubApiBaseUrl,
299
- sandbox: this.mode === "gondolin" ? "gondolin" : "none",
300
- sandboxEnv: this.innerAgentEnv(opts.sandboxEnv),
301
- cwd: opts.agentCwd,
302
- noSession: true,
303
- skillPaths: opts.skillDirs,
304
- allowedHttpHosts,
305
- webSearch: opts.webSearch === true,
306
- webSearchProvider: opts.webSearchProvider,
307
- onEvent,
308
- onWarn: (msg) => console.warn(`[agentic] ${msg}`),
309
- });
310
- }
311
- finally {
312
- restore();
313
- }
314
- }
315
- async runCommand(_taskId, command, opts) {
316
- // gondolin / none run the command on the host worktree via spawnSync — the
317
- // same degraded model those backends already used.
318
- const proc = spawnSync("sh", ["-c", command], {
319
- cwd: opts.cwd,
320
- env: { ...process.env, ...this.opts.env, ...(opts.sandboxEnv ?? {}) },
321
- encoding: "utf-8",
322
- timeout: opts.timeoutSeconds * 1000,
323
- maxBuffer: 256 * 1024 * 1024,
324
- });
325
- const exitCode = proc.status ?? (proc.signal ? 124 : 1);
326
- return {
327
- exitCode,
328
- stdout: proc.stdout ?? "",
329
- stderr: proc.stderr ?? "",
330
- timedOut: proc.signal === "SIGTERM",
331
- };
332
- }
333
- dispose() {
334
- // No isolation primitive to tear down — the env splice is restored inside
335
- // runAgent, and the worktree is reaped elsewhere.
336
- }
337
- /** Git identity + OTEL env + (gondolin only) a HOME override into the VM. */
338
- innerAgentEnv(base) {
339
- const otel = this.opts.otel?.enabled && this.opts.otel.forwardToSandbox ? getOtelEnvForSandbox() : {};
340
- // gondolin: the VM user inherits HOME from the agentic-pi process (the
341
- // host's HOME leaks in). Force HOME=/root so `git config --global` /
342
- // `gh auth status` write to a real path inside the VM. none runs on the
343
- // host — never override HOME.
344
- const homeOverride = this.mode === "gondolin" ? { HOME: "/root", USER: "root", LOGNAME: "root" } : {};
345
- return { ...otel, ...base, ...homeOverride };
346
- }
347
- }
348
- /**
349
- * In-memory `Sandbox` adapter for unit-testing the orchestrator without
350
- * Docker/VMs. `provision()` returns a **real** `mkdtemp` workspace (so skill
351
- * staging + artifact harvest run for real), `runAgent` replays a canned array
352
- * of pi event records through `onEvent`, and it **records** the opts it
353
- * received for assertions. Covers Last Light's orchestration, not agentic-pi's
354
- * semantics.
355
- *
356
- * Inject it via the optional `sandboxFactory` on `executeAgent`/`executeCommand`
357
- * — see {@link FakeSandbox.asFactory}.
358
- */
359
- export class FakeSandbox {
360
- behavior;
361
- backend = "none";
362
- // Recorded for assertions.
363
- egress;
364
- env;
365
- hostWorkspaceDir = "";
366
- agentCwd = "";
367
- stagedSkillDirs;
368
- receivedAgentOpts;
369
- receivedCommandOpts;
370
- receivedCommand;
371
- provisionCalls = 0;
372
- disposed = false;
373
- constructor(behavior = {}) {
374
- this.behavior = behavior;
375
- }
376
- /**
377
- * Build a {@link SandboxFactory} that always returns THIS instance, capturing
378
- * the construction opts (egress, env, backend) for later inspection.
379
- */
380
- asFactory() {
381
- return (backend, opts) => {
382
- this.backend = backend;
383
- this.egress = opts.egress;
384
- this.env = opts.env;
385
- return this;
386
- };
387
- }
388
- async provision(pre) {
389
- this.provisionCalls += 1;
390
- const dir = mkdtempSync(join(tmpdir(), "fake-sbx-"));
391
- this.hostWorkspaceDir = dir;
392
- this.agentCwd = pre ? join(dir, pre.repo) : dir;
393
- if (pre)
394
- mkdirSync(this.agentCwd, { recursive: true });
395
- return { hostWorkspaceDir: dir, agentCwd: this.agentCwd };
396
- }
397
- stageSkills(phaseKey, skillPaths) {
398
- this.stagedSkillDirs = stageSkillBundle(this.hostWorkspaceDir, phaseKey, skillPaths, "symlink");
399
- return this.stagedSkillDirs;
400
- }
401
- sandboxPathFor(relPath) {
402
- return join(this.hostWorkspaceDir, relPath);
403
- }
404
- async runAgent(_taskId, _prompt, opts, onEvent) {
405
- this.receivedAgentOpts = opts;
406
- if (this.behavior.throwOnRunAgent)
407
- throw asError(this.behavior.throwOnRunAgent);
408
- for (const record of this.behavior.events ?? [])
409
- onEvent(record);
410
- return this.behavior.returnRunResult;
411
- }
412
- async runCommand(_taskId, command, opts) {
413
- this.receivedCommand = command;
414
- this.receivedCommandOpts = opts;
415
- if (this.behavior.throwOnRunCommand)
416
- throw asError(this.behavior.throwOnRunCommand);
417
- return this.behavior.commandResult ?? { exitCode: 0, stdout: "", stderr: "", timedOut: false };
418
- }
419
- dispose() {
420
- this.disposed = true;
421
- try {
422
- if (this.hostWorkspaceDir)
423
- rmSync(this.hostWorkspaceDir, { recursive: true, force: true });
424
- }
425
- catch {
426
- /* best effort */
427
- }
428
- }
429
- }
430
- // ── helpers ─────────────────────────────────────────────────────────
431
- function asError(e) {
432
- return e instanceof Error ? e : new Error(e);
433
- }
434
- /**
435
- * Wrap an `onEvent(record)` consumer as an `onLine(line)` handler for the
436
- * subprocess (docker/smol) drivers: apply the cheap `{`-prefix guard, parse
437
- * JSON, and forward the parsed record. Non-JSON / malformed lines are dropped.
438
- */
439
- function parseLine(onEvent) {
440
- return (line) => {
441
- if (!line.startsWith("{"))
442
- return;
443
- let record;
444
- try {
445
- record = JSON.parse(line);
446
- }
447
- catch {
448
- return;
449
- }
450
- onEvent(record);
451
- };
452
- }
453
- //# sourceMappingURL=sandbox.js.map
@@ -1 +0,0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QAAQ,CAAC,iBAAiB;YAAE,MAAM,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACjG,CAAC;IAED,OAAO;QACL,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC;YACH,IAAI,IAAI,CAAC,gBAAgB;gBAAE,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7F,CAAC;QAAC,MAAM,CAAC;YACP,iBAAiB;QACnB,CAAC;IACH,CAAC;CACF;AAED,uEAAuE;AAEvE,SAAS,OAAO,CAAC,CAAiB;IAChC,OAAO,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED;;;;GAIG;AACH,SAAS,SAAS,CAAC,OAAuC;IACxD,OAAO,CAAC,IAAY,EAAE,EAAE;QACtB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO;QAClC,IAAI,MAAoB,CAAC;QACzB,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAiB,CAAC;QAC5C,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC"}
@@ -1,162 +0,0 @@
1
- /**
2
- * smolvm sandbox manager — runs agent tasks inside local micro-VMs.
3
- *
4
- * Structural peer of {@link DockerSandbox}: Last Light owns the isolation
5
- * boundary, bind-mounts the per-task workspace, runs `agentic-pi run --sandbox
6
- * none` *inside* the machine, and parses the JSONL event stream exactly as the
7
- * docker path does. Differences from docker:
8
- *
9
- * - **Isolation** is a real micro-VM (own kernel) via smolvm's host
10
- * hypervisor (Apple Silicon Hypervisor.framework / Linux KVM), not a
11
- * sibling container. No daemon, no Docker (smolvm drives the hypervisor
12
- * directly).
13
- * - **Egress** is enforced natively per-machine via `--allow-host` (sourced
14
- * from `egress-allowlist.ts`), so this backend needs none of the coredns +
15
- * nginx-egress sidecar stack. `--allow-host` implies `--net`; we always
16
- * enable networking (the agent must reach the LLM provider).
17
- * - **Secrets** (provider keys, GITHUB_TOKEN) are injected via smolvm's
18
- * `--secret-env GUEST=HOST` so values never appear on the argv — the host
19
- * env of the spawned `smolvm` process carries them; smolvm resolves them
20
- * into the guest at start.
21
- * - **Image** is whatever `SMOLVM_IMAGE` names. smolvm's `-I` accepts a
22
- * registry ref OR a local `docker save` archive (`./img.tar`) / unpacked
23
- * rootfs dir — the latter needs NO registry, so it works under the strict
24
- * egress allowlist. The lastlight sandbox image (built locally by docker)
25
- * is consumed offline via `docker save lastlight-sandbox:latest -o img.tar`
26
- * then `SMOLVM_IMAGE=img.tar`. Archives are cached by hash; `start` resolves
27
- * from cache, not the network.
28
- *
29
- * Driven via the **smolvm CLI** (`execFile`), verified against smolvm 1.2.5.
30
- *
31
- * Feasibility-spike scope (documented gaps vs docker):
32
- * - We exec `agentic-pi` directly rather than running the sandbox image's
33
- * entrypoint, so the entrypoint's git-credential-helper setup is skipped.
34
- * Read-only profiles (agentic-pi's built-in github tools + minted
35
- * GITHUB_TOKEN) work; repo-write `git push` from the workspace is out of
36
- * scope here.
37
- * - The workload runs VM-grade (root) by default; workspace writes land as
38
- * root on the host bind mount. No shared package-manager cache, no SSRF
39
- * metadata floor in unrestricted mode, no in-network OTEL collector.
40
- * - The image (`SMOLVM_IMAGE`) must be resolvable by smolvm (a registry ref,
41
- * or a local image it can load) — see the spike plan's verification steps.
42
- */
43
- /**
44
- * Where the per-task workspace is bind-mounted inside the guest. smolvm treats
45
- * `/workspace` specially — a `-v <host>:/workspace` mount "takes priority" and
46
- * the host share is used directly (instead of the VM's storage-disk workspace),
47
- * which avoids the `virtiofs` carve-out other mount targets get. The probe in
48
- * {@link SmolSandbox.resolveHostWorkspace} still confirms the actual host path.
49
- */
50
- export declare const SMOL_WORKSPACE_DIR = "/workspace";
51
- /** True when the smolvm CLI is invocable on this host. */
52
- export declare function smolAvailable(): boolean;
53
- export interface SmolSandboxConfig {
54
- /** OCI image to boot (default: SMOLVM_IMAGE / lastlight-sandbox:latest). */
55
- imageName?: string;
56
- /**
57
- * Env vars injected into in-guest commands (provider keys, GITHUB_TOKEN,
58
- * OTEL…). Forwarded via `--secret-env` so values stay off the argv.
59
- */
60
- env: Record<string, string>;
61
- /** Timeout in seconds for an agent run (default 1800 = 30 min). */
62
- timeoutSeconds?: number;
63
- /**
64
- * Egress allowlist (apex hostnames). Each becomes a repeated `--allow-host`.
65
- * `null` → no allowlist (open egress, still `--net`); used for
66
- * `unrestricted_egress` phases.
67
- */
68
- allowHosts: string[] | null;
69
- }
70
- export interface SmolMachineInfo {
71
- machineName: string;
72
- /** Host dir passed to `-v` (the mount source). */
73
- worktreePath: string;
74
- /**
75
- * Host dir that actually backs the guest workspace. smolvm's `-v` does not
76
- * always share the source root directly — depending on version it carves a
77
- * `<source>/virtiofs/<tag>` subdir and shares THAT. We probe for it after
78
- * boot (see {@link SmolSandbox.resolveHostWorkspace}) so host-side staging
79
- * (clone / AGENTS.md / skills) lands where the guest can see it, regardless
80
- * of which mount semantics the installed smolvm uses.
81
- */
82
- hostWorkspace: string;
83
- }
84
- export declare class SmolSandbox {
85
- private config;
86
- private machines;
87
- constructor(config: SmolSandboxConfig);
88
- /** Create + start a micro-VM with the workspace bind-mounted and egress locked. */
89
- create(opts: {
90
- taskId: string;
91
- worktreePath: string;
92
- }): Promise<SmolMachineInfo>;
93
- /**
94
- * Discover the host directory that backs the guest workspace mount. Writes a
95
- * sentinel file from inside the guest at {@link SMOL_WORKSPACE_DIR}, then
96
- * locates it under the mount source on the host — its parent dir is the
97
- * host-side workspace root. Falls back to the source root if not found
98
- * (e.g. a future smolvm that shares the source directly and the scan misses).
99
- */
100
- private resolveHostWorkspace;
101
- /** Wait until the machine can run a trivial command (boot completion). */
102
- private waitForReady;
103
- /**
104
- * Run `agentic-pi run --sandbox none …` inside the machine. Mirrors
105
- * {@link DockerSandbox.runAgent}: streams stdout line-by-line for the live
106
- * shim and writes the prompt to the child's stdin (`-i`). The agentic-pi
107
- * argv is passed directly after `--` (no `sh -c`), so no shell quoting.
108
- */
109
- runAgent(taskId: string, prompt: string, opts?: {
110
- model?: string;
111
- thinking?: string;
112
- profile?: string;
113
- /** Forwarded to the inner agentic-pi run via its own `--sandbox-env`. */
114
- sandboxEnv?: Record<string, string>;
115
- agentCwd?: string;
116
- webSearch?: boolean;
117
- webSearchProvider?: "tavily" | "brave" | "exa";
118
- skillDirs?: string[];
119
- onLine?: (line: string) => void;
120
- }): Promise<void>;
121
- /**
122
- * Run a deterministic shell command in the machine and resolve with its exit
123
- * code + bounded output. Non-agent sibling of {@link runAgent}; powers
124
- * `type: bash` / `type: script` phases. The command is a shell string, so it
125
- * runs under `sh -c`.
126
- */
127
- runCommand(taskId: string, command: string, opts?: {
128
- cwd?: string;
129
- /** Non-secret env forwarded via `-e KEY=VALUE` (e.g. LL_OUT_*, git identity). */
130
- sandboxEnv?: Record<string, string>;
131
- timeoutSeconds?: number;
132
- onLine?: (line: string) => void;
133
- }): Promise<{
134
- exitCode: number;
135
- stdout: string;
136
- stderr: string;
137
- timedOut: boolean;
138
- }>;
139
- /** Stop + delete the machine. */
140
- destroy(taskId: string): Promise<void>;
141
- /**
142
- * The allowlist hosts that smolvm can actually use, in original order.
143
- *
144
- * smolvm resolves every `--allow-host` to its IP(s) AT VM START and aborts
145
- * `create` if ANY entry fails to resolve. Our `egress-allowlist.ts` follows an
146
- * apex+subdomain convention (e.g. `githubusercontent.com`), and some of those
147
- * bare apexes have no A record — they'd abort the whole VM. So we pre-resolve
148
- * here and drop the unresolvable ones.
149
- *
150
- * CAVEAT: unlike docker (SNI) / gondolin (hostname), smolvm's filter is
151
- * IP-pinned at start — `--allow-host github.com` allows github.com's IPs only,
152
- * NOT api.github.com or rotating CDN IPs. A faithful apex+subdomain policy
153
- * would need each concrete subdomain enumerated; that's a spike gap.
154
- */
155
- private resolvableAllowHosts;
156
- /**
157
- * Build `--secret-env GUEST=GUEST` flags for every machine-env var plus the
158
- * child-process env that carries their values, so secrets (tokens, provider
159
- * keys) reach the guest via smolvm's secret channel rather than the argv.
160
- */
161
- private secretEnv;
162
- }