lastlight-core 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 (345) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -0
  3. package/agent-context/rules.md +80 -0
  4. package/agent-context/security.md +69 -0
  5. package/agent-context/soul.md +21 -0
  6. package/config/default.yaml +119 -0
  7. package/deploy/.env.production.example +100 -0
  8. package/deploy/entrypoint.sh +82 -0
  9. package/deploy/native/README.md +160 -0
  10. package/deploy/native/install.sh +110 -0
  11. package/deploy/native/lastlight.env.example +95 -0
  12. package/deploy/native/lastlight.service +50 -0
  13. package/deploy/sandbox-entrypoint.sh +93 -0
  14. package/deploy/slack/README.md +92 -0
  15. package/deploy/slack/slack-manifest.json +55 -0
  16. package/dist/admin/auth.d.ts +51 -0
  17. package/dist/admin/auth.js +121 -0
  18. package/dist/admin/auth.js.map +1 -0
  19. package/dist/admin/chat-session-reader.d.ts +39 -0
  20. package/dist/admin/chat-session-reader.js +84 -0
  21. package/dist/admin/chat-session-reader.js.map +1 -0
  22. package/dist/admin/docker.d.ts +61 -0
  23. package/dist/admin/docker.js +187 -0
  24. package/dist/admin/docker.js.map +1 -0
  25. package/dist/admin/index.d.ts +9 -0
  26. package/dist/admin/index.js +59 -0
  27. package/dist/admin/index.js.map +1 -0
  28. package/dist/admin/routes.d.ts +81 -0
  29. package/dist/admin/routes.js +1381 -0
  30. package/dist/admin/routes.js.map +1 -0
  31. package/dist/admin/sessions.d.ts +89 -0
  32. package/dist/admin/sessions.js +204 -0
  33. package/dist/admin/sessions.js.map +1 -0
  34. package/dist/admin/tail.d.ts +12 -0
  35. package/dist/admin/tail.js +145 -0
  36. package/dist/admin/tail.js.map +1 -0
  37. package/dist/admin/version.d.ts +22 -0
  38. package/dist/admin/version.js +92 -0
  39. package/dist/admin/version.js.map +1 -0
  40. package/dist/config/config-resolve.d.ts +28 -0
  41. package/dist/config/config-resolve.js +47 -0
  42. package/dist/config/config-resolve.js.map +1 -0
  43. package/dist/config/config.d.ts +140 -0
  44. package/dist/config/config.js +581 -0
  45. package/dist/config/config.js.map +1 -0
  46. package/dist/connectors/github-webhook.d.ts +45 -0
  47. package/dist/connectors/github-webhook.js +321 -0
  48. package/dist/connectors/github-webhook.js.map +1 -0
  49. package/dist/connectors/index.d.ts +18 -0
  50. package/dist/connectors/index.js +41 -0
  51. package/dist/connectors/index.js.map +1 -0
  52. package/dist/connectors/messaging/base.d.ts +42 -0
  53. package/dist/connectors/messaging/base.js +139 -0
  54. package/dist/connectors/messaging/base.js.map +1 -0
  55. package/dist/connectors/messaging/delivery.d.ts +14 -0
  56. package/dist/connectors/messaging/delivery.js +38 -0
  57. package/dist/connectors/messaging/delivery.js.map +1 -0
  58. package/dist/connectors/messaging/index.d.ts +4 -0
  59. package/dist/connectors/messaging/index.js +4 -0
  60. package/dist/connectors/messaging/index.js.map +1 -0
  61. package/dist/connectors/messaging/session-manager.d.ts +53 -0
  62. package/dist/connectors/messaging/session-manager.js +255 -0
  63. package/dist/connectors/messaging/session-manager.js.map +1 -0
  64. package/dist/connectors/messaging/types.d.ts +58 -0
  65. package/dist/connectors/messaging/types.js +7 -0
  66. package/dist/connectors/messaging/types.js.map +1 -0
  67. package/dist/connectors/slack/connector.d.ts +142 -0
  68. package/dist/connectors/slack/connector.js +494 -0
  69. package/dist/connectors/slack/connector.js.map +1 -0
  70. package/dist/connectors/slack/index.d.ts +2 -0
  71. package/dist/connectors/slack/index.js +3 -0
  72. package/dist/connectors/slack/index.js.map +1 -0
  73. package/dist/connectors/slack/mrkdwn.d.ts +19 -0
  74. package/dist/connectors/slack/mrkdwn.js +240 -0
  75. package/dist/connectors/slack/mrkdwn.js.map +1 -0
  76. package/dist/connectors/types.d.ts +61 -0
  77. package/dist/connectors/types.js +2 -0
  78. package/dist/connectors/types.js.map +1 -0
  79. package/dist/cron/fanout.d.ts +33 -0
  80. package/dist/cron/fanout.js +55 -0
  81. package/dist/cron/fanout.js.map +1 -0
  82. package/dist/cron/jobs.d.ts +18 -0
  83. package/dist/cron/jobs.js +37 -0
  84. package/dist/cron/jobs.js.map +1 -0
  85. package/dist/cron/scheduler.d.ts +45 -0
  86. package/dist/cron/scheduler.js +105 -0
  87. package/dist/cron/scheduler.js.map +1 -0
  88. package/dist/engine/agent-executor.d.ts +34 -0
  89. package/dist/engine/agent-executor.js +246 -0
  90. package/dist/engine/agent-executor.js.map +1 -0
  91. package/dist/engine/chat/chat-runner.d.ts +132 -0
  92. package/dist/engine/chat/chat-runner.js +424 -0
  93. package/dist/engine/chat/chat-runner.js.map +1 -0
  94. package/dist/engine/chat/chat-skills.d.ts +45 -0
  95. package/dist/engine/chat/chat-skills.js +184 -0
  96. package/dist/engine/chat/chat-skills.js.map +1 -0
  97. package/dist/engine/chat/chat.d.ts +54 -0
  98. package/dist/engine/chat/chat.js +316 -0
  99. package/dist/engine/chat/chat.js.map +1 -0
  100. package/dist/engine/chat/message-batcher.d.ts +32 -0
  101. package/dist/engine/chat/message-batcher.js +109 -0
  102. package/dist/engine/chat/message-batcher.js.map +1 -0
  103. package/dist/engine/dispatcher.d.ts +73 -0
  104. package/dist/engine/dispatcher.js +663 -0
  105. package/dist/engine/dispatcher.js.map +1 -0
  106. package/dist/engine/event-shim.d.ts +117 -0
  107. package/dist/engine/event-shim.js +435 -0
  108. package/dist/engine/event-shim.js.map +1 -0
  109. package/dist/engine/executors/orchestrator.d.ts +74 -0
  110. package/dist/engine/executors/orchestrator.js +365 -0
  111. package/dist/engine/executors/orchestrator.js.map +1 -0
  112. package/dist/engine/executors/shared.d.ts +189 -0
  113. package/dist/engine/executors/shared.js +616 -0
  114. package/dist/engine/executors/shared.js.map +1 -0
  115. package/dist/engine/github/git-auth.d.ts +62 -0
  116. package/dist/engine/github/git-auth.js +161 -0
  117. package/dist/engine/github/git-auth.js.map +1 -0
  118. package/dist/engine/github/github-app-client.d.ts +23 -0
  119. package/dist/engine/github/github-app-client.js +33 -0
  120. package/dist/engine/github/github-app-client.js.map +1 -0
  121. package/dist/engine/github/github-tools.d.ts +18 -0
  122. package/dist/engine/github/github-tools.js +263 -0
  123. package/dist/engine/github/github-tools.js.map +1 -0
  124. package/dist/engine/github/github.d.ts +1193 -0
  125. package/dist/engine/github/github.js +357 -0
  126. package/dist/engine/github/github.js.map +1 -0
  127. package/dist/engine/github/profiles.d.ts +11 -0
  128. package/dist/engine/github/profiles.js +42 -0
  129. package/dist/engine/github/profiles.js.map +1 -0
  130. package/dist/engine/github/review-poster.d.ts +98 -0
  131. package/dist/engine/github/review-poster.js +177 -0
  132. package/dist/engine/github/review-poster.js.map +1 -0
  133. package/dist/engine/llm.d.ts +79 -0
  134. package/dist/engine/llm.js +269 -0
  135. package/dist/engine/llm.js.map +1 -0
  136. package/dist/engine/oauth.d.ts +8 -0
  137. package/dist/engine/oauth.js +9 -0
  138. package/dist/engine/oauth.js.map +1 -0
  139. package/dist/engine/router.d.ts +29 -0
  140. package/dist/engine/router.js +680 -0
  141. package/dist/engine/router.js.map +1 -0
  142. package/dist/engine/screen/classifier.d.ts +93 -0
  143. package/dist/engine/screen/classifier.js +215 -0
  144. package/dist/engine/screen/classifier.js.map +1 -0
  145. package/dist/engine/screen/screen.d.ts +41 -0
  146. package/dist/engine/screen/screen.js +93 -0
  147. package/dist/engine/screen/screen.js.map +1 -0
  148. package/dist/evals-api.d.ts +24 -0
  149. package/dist/evals-api.js +22 -0
  150. package/dist/evals-api.js.map +1 -0
  151. package/dist/index.d.ts +1 -0
  152. package/dist/index.js +940 -0
  153. package/dist/index.js.map +1 -0
  154. package/dist/managed-repos.d.ts +30 -0
  155. package/dist/managed-repos.js +72 -0
  156. package/dist/managed-repos.js.map +1 -0
  157. package/dist/notify/blocks.d.ts +23 -0
  158. package/dist/notify/blocks.js +118 -0
  159. package/dist/notify/blocks.js.map +1 -0
  160. package/dist/notify/index.d.ts +17 -0
  161. package/dist/notify/index.js +7 -0
  162. package/dist/notify/index.js.map +1 -0
  163. package/dist/notify/model.d.ts +57 -0
  164. package/dist/notify/model.js +89 -0
  165. package/dist/notify/model.js.map +1 -0
  166. package/dist/notify/notifier.d.ts +18 -0
  167. package/dist/notify/notifier.js +100 -0
  168. package/dist/notify/notifier.js.map +1 -0
  169. package/dist/notify/render.d.ts +21 -0
  170. package/dist/notify/render.js +59 -0
  171. package/dist/notify/render.js.map +1 -0
  172. package/dist/notify/transports/github.d.ts +26 -0
  173. package/dist/notify/transports/github.js +27 -0
  174. package/dist/notify/transports/github.js.map +1 -0
  175. package/dist/notify/transports/slack.d.ts +27 -0
  176. package/dist/notify/transports/slack.js +37 -0
  177. package/dist/notify/transports/slack.js.map +1 -0
  178. package/dist/notify/types.d.ts +111 -0
  179. package/dist/notify/types.js +16 -0
  180. package/dist/notify/types.js.map +1 -0
  181. package/dist/sandbox/docker.d.ts +180 -0
  182. package/dist/sandbox/docker.js +517 -0
  183. package/dist/sandbox/docker.js.map +1 -0
  184. package/dist/sandbox/egress-allowlist.d.ts +74 -0
  185. package/dist/sandbox/egress-allowlist.js +164 -0
  186. package/dist/sandbox/egress-allowlist.js.map +1 -0
  187. package/dist/sandbox/egress-firewall-config.d.ts +127 -0
  188. package/dist/sandbox/egress-firewall-config.js +434 -0
  189. package/dist/sandbox/egress-firewall-config.js.map +1 -0
  190. package/dist/sandbox/images.d.ts +23 -0
  191. package/dist/sandbox/images.js +55 -0
  192. package/dist/sandbox/images.js.map +1 -0
  193. package/dist/sandbox/index.d.ts +112 -0
  194. package/dist/sandbox/index.js +332 -0
  195. package/dist/sandbox/index.js.map +1 -0
  196. package/dist/sandbox/sandbox.d.ts +214 -0
  197. package/dist/sandbox/sandbox.js +453 -0
  198. package/dist/sandbox/sandbox.js.map +1 -0
  199. package/dist/sandbox/smol.d.ts +162 -0
  200. package/dist/sandbox/smol.js +485 -0
  201. package/dist/sandbox/smol.js.map +1 -0
  202. package/dist/session-log.d.ts +63 -0
  203. package/dist/session-log.js +290 -0
  204. package/dist/session-log.js.map +1 -0
  205. package/dist/state/approval-store.d.ts +88 -0
  206. package/dist/state/approval-store.js +149 -0
  207. package/dist/state/approval-store.js.map +1 -0
  208. package/dist/state/build-assets.d.ts +50 -0
  209. package/dist/state/build-assets.js +154 -0
  210. package/dist/state/build-assets.js.map +1 -0
  211. package/dist/state/db.d.ts +81 -0
  212. package/dist/state/db.js +155 -0
  213. package/dist/state/db.js.map +1 -0
  214. package/dist/state/execution-store.d.ts +257 -0
  215. package/dist/state/execution-store.js +527 -0
  216. package/dist/state/execution-store.js.map +1 -0
  217. package/dist/state/migrate.d.ts +15 -0
  218. package/dist/state/migrate.js +175 -0
  219. package/dist/state/migrate.js.map +1 -0
  220. package/dist/state/workflow-run-store.d.ts +216 -0
  221. package/dist/state/workflow-run-store.js +403 -0
  222. package/dist/state/workflow-run-store.js.map +1 -0
  223. package/dist/telemetry/index.d.ts +38 -0
  224. package/dist/telemetry/index.js +253 -0
  225. package/dist/telemetry/index.js.map +1 -0
  226. package/dist/telemetry/pi-events.d.ts +12 -0
  227. package/dist/telemetry/pi-events.js +134 -0
  228. package/dist/telemetry/pi-events.js.map +1 -0
  229. package/dist/workflows/dag.d.ts +1 -0
  230. package/dist/workflows/dag.js +2 -0
  231. package/dist/workflows/dag.js.map +1 -0
  232. package/dist/workflows/handlers/post-review.d.ts +45 -0
  233. package/dist/workflows/handlers/post-review.js +220 -0
  234. package/dist/workflows/handlers/post-review.js.map +1 -0
  235. package/dist/workflows/handlers/verdict-reader.d.ts +14 -0
  236. package/dist/workflows/handlers/verdict-reader.js +55 -0
  237. package/dist/workflows/handlers/verdict-reader.js.map +1 -0
  238. package/dist/workflows/loader.d.ts +9 -0
  239. package/dist/workflows/loader.js +10 -0
  240. package/dist/workflows/loader.js.map +1 -0
  241. package/dist/workflows/loop-eval.d.ts +1 -0
  242. package/dist/workflows/loop-eval.js +2 -0
  243. package/dist/workflows/loop-eval.js.map +1 -0
  244. package/dist/workflows/phase-executor.d.ts +1 -0
  245. package/dist/workflows/phase-executor.js +6 -0
  246. package/dist/workflows/phase-executor.js.map +1 -0
  247. package/dist/workflows/phase-ref.d.ts +1 -0
  248. package/dist/workflows/phase-ref.js +2 -0
  249. package/dist/workflows/phase-ref.js.map +1 -0
  250. package/dist/workflows/resume.d.ts +58 -0
  251. package/dist/workflows/resume.js +313 -0
  252. package/dist/workflows/resume.js.map +1 -0
  253. package/dist/workflows/runner.d.ts +47 -0
  254. package/dist/workflows/runner.js +278 -0
  255. package/dist/workflows/runner.js.map +1 -0
  256. package/dist/workflows/schema.d.ts +1 -0
  257. package/dist/workflows/schema.js +2 -0
  258. package/dist/workflows/schema.js.map +1 -0
  259. package/dist/workflows/simple.d.ts +90 -0
  260. package/dist/workflows/simple.js +393 -0
  261. package/dist/workflows/simple.js.map +1 -0
  262. package/dist/workflows/target-policy.d.ts +74 -0
  263. package/dist/workflows/target-policy.js +80 -0
  264. package/dist/workflows/target-policy.js.map +1 -0
  265. package/dist/workflows/templates.d.ts +1 -0
  266. package/dist/workflows/templates.js +2 -0
  267. package/dist/workflows/templates.js.map +1 -0
  268. package/dist/workflows/triggers.d.ts +21 -0
  269. package/dist/workflows/triggers.js +45 -0
  270. package/dist/workflows/triggers.js.map +1 -0
  271. package/dist/workflows/verdict.d.ts +1 -0
  272. package/dist/workflows/verdict.js +2 -0
  273. package/dist/workflows/verdict.js.map +1 -0
  274. package/dist/worktree/manager.d.ts +43 -0
  275. package/dist/worktree/manager.js +127 -0
  276. package/dist/worktree/manager.js.map +1 -0
  277. package/docker-compose.yml +280 -0
  278. package/package.json +93 -0
  279. package/sandbox.Dockerfile +68 -0
  280. package/skills/README.md +42 -0
  281. package/skills/browser-qa/SKILL.md +208 -0
  282. package/skills/browser-qa/scripts/agent-browser.mjs +531 -0
  283. package/skills/building/SKILL.md +95 -0
  284. package/skills/chat/SKILL.md +36 -0
  285. package/skills/code-review/SKILL.md +82 -0
  286. package/skills/debug-production/SKILL.md +108 -0
  287. package/skills/demo/SKILL.md +228 -0
  288. package/skills/demo/scripts/compose-demo.sh +243 -0
  289. package/skills/issue-answer/SKILL.md +91 -0
  290. package/skills/issue-comment/SKILL.md +49 -0
  291. package/skills/issue-triage/SKILL.md +149 -0
  292. package/skills/issue-triage/references/AGENT-BRIEF.md +65 -0
  293. package/skills/pr-comment/SKILL.md +64 -0
  294. package/skills/pr-review/SKILL.md +148 -0
  295. package/skills/pr-review/references/findings-schema.md +89 -0
  296. package/skills/qa-test/SKILL.md +97 -0
  297. package/skills/repo-health/SKILL.md +67 -0
  298. package/skills/security-feedback/SKILL.md +173 -0
  299. package/skills/security-feedback/references/templates.md +77 -0
  300. package/skills/security-review/SKILL.md +215 -0
  301. package/skills/security-review/references/issue-format.md +302 -0
  302. package/skills/verify/SKILL.md +118 -0
  303. package/workflows/answer.yaml +44 -0
  304. package/workflows/build.yaml +129 -0
  305. package/workflows/cron-health.yaml +6 -0
  306. package/workflows/cron-review.yaml +8 -0
  307. package/workflows/cron-security.yaml +6 -0
  308. package/workflows/cron-triage.yaml +8 -0
  309. package/workflows/demo.yaml +62 -0
  310. package/workflows/examples/bash-smoke.yaml +41 -0
  311. package/workflows/examples/parallel-review.yaml +36 -0
  312. package/workflows/examples/tdd-loop.yaml +17 -0
  313. package/workflows/explore.yaml +80 -0
  314. package/workflows/issue-comment.yaml +15 -0
  315. package/workflows/issue-triage.yaml +22 -0
  316. package/workflows/pr-comment.yaml +16 -0
  317. package/workflows/pr-fix.yaml +17 -0
  318. package/workflows/pr-review.yaml +50 -0
  319. package/workflows/prompts/answer.md +68 -0
  320. package/workflows/prompts/architect.md +44 -0
  321. package/workflows/prompts/classifier.md +60 -0
  322. package/workflows/prompts/classify-adds-info.md +17 -0
  323. package/workflows/prompts/demo.md +125 -0
  324. package/workflows/prompts/executor.md +42 -0
  325. package/workflows/prompts/explore-ask.md +99 -0
  326. package/workflows/prompts/explore-publish.md +31 -0
  327. package/workflows/prompts/explore-read.md +120 -0
  328. package/workflows/prompts/explore-synthesize.md +88 -0
  329. package/workflows/prompts/fix.md +18 -0
  330. package/workflows/prompts/guardrails.md +96 -0
  331. package/workflows/prompts/pr-fix.md +26 -0
  332. package/workflows/prompts/pr.md +39 -0
  333. package/workflows/prompts/qa-browser.md +95 -0
  334. package/workflows/prompts/qa-synth.md +44 -0
  335. package/workflows/prompts/qa-test.md +60 -0
  336. package/workflows/prompts/re-reviewer.md +33 -0
  337. package/workflows/prompts/reviewer.md +60 -0
  338. package/workflows/prompts/verify-browser.md +93 -0
  339. package/workflows/prompts/verify-synth.md +44 -0
  340. package/workflows/prompts/verify.md +63 -0
  341. package/workflows/qa-test.yaml +94 -0
  342. package/workflows/repo-health.yaml +15 -0
  343. package/workflows/security-feedback.yaml +25 -0
  344. package/workflows/security-review.yaml +37 -0
  345. package/workflows/verify.yaml +93 -0
@@ -0,0 +1,100 @@
1
+ /**
2
+ * `ProgressNotifier` — the concrete {@link ProgressReporter} the runner drives.
3
+ *
4
+ * It owns the current {@link ProgressModel}, re-renders once per mutation, and
5
+ * fans the rendered markdown out to every wired transport's `publish()`. It
6
+ * knows nothing about GitHub or Slack — that lives behind
7
+ * {@link NotifierTransport}. Multiple transports can be attached (e.g. a
8
+ * GitHub-triggered build that also mirrors to a Slack thread); each owns its
9
+ * own in-place-update handle.
10
+ *
11
+ * Mutations are serialized through an in-flight chain so two quick transitions
12
+ * can't race on `publish()` and post out of order (or double-create the
13
+ * surface before the first create's handle is stored).
14
+ */
15
+ import { renderProgress } from "./render.js";
16
+ import { setStep, upsertBefore } from "./model.js";
17
+ export class ProgressNotifier {
18
+ model = null;
19
+ transports;
20
+ chain = Promise.resolve();
21
+ constructor(transports) {
22
+ this.transports = transports.filter(Boolean);
23
+ }
24
+ /** Serialize a mutation + publish so transitions can't interleave. */
25
+ enqueue(fn) {
26
+ this.chain = this.chain.then(fn, fn);
27
+ return this.chain;
28
+ }
29
+ async publish() {
30
+ if (!this.model)
31
+ return;
32
+ const model = this.model;
33
+ const body = renderProgress(model);
34
+ // Best-effort per transport — one platform failing must not block the other.
35
+ await Promise.all(this.transports.map((t) => t.publish(body, model).catch((err) => {
36
+ const m = err instanceof Error ? err.message : String(err);
37
+ console.warn(`[notifier] publish failed: ${m}`);
38
+ })));
39
+ }
40
+ start(model) {
41
+ return this.enqueue(async () => {
42
+ this.model = model;
43
+ await this.publish();
44
+ });
45
+ }
46
+ step(key, status, detail) {
47
+ return this.enqueue(async () => {
48
+ if (!this.model)
49
+ return;
50
+ this.model = { ...this.model, steps: setStep(this.model.steps, key, status, detail) };
51
+ await this.publish();
52
+ });
53
+ }
54
+ insertStep(step, beforeKey) {
55
+ return this.enqueue(async () => {
56
+ if (!this.model)
57
+ return;
58
+ this.model = { ...this.model, steps: upsertBefore(this.model.steps, step, beforeKey) };
59
+ await this.publish();
60
+ });
61
+ }
62
+ footer(markdown) {
63
+ return this.enqueue(async () => {
64
+ if (!this.model)
65
+ return;
66
+ const footer = markdown.trim() || undefined;
67
+ this.model = { ...this.model, footer };
68
+ await this.publish();
69
+ });
70
+ }
71
+ note(markdown) {
72
+ return this.noteTo(this.transports, markdown);
73
+ }
74
+ noteApproval(markdown, meta) {
75
+ return this.enqueue(async () => {
76
+ if (!markdown.trim() || this.transports.length === 0)
77
+ return;
78
+ await Promise.all(this.transports.map((t) =>
79
+ // Rich surfaces render interactive controls; the rest post plain text.
80
+ (t.noteApproval ? t.noteApproval(markdown, meta) : t.note(markdown)).catch((err) => {
81
+ const m = err instanceof Error ? err.message : String(err);
82
+ console.warn(`[notifier] noteApproval failed: ${m}`);
83
+ })));
84
+ });
85
+ }
86
+ noteTerminal(markdown) {
87
+ return this.noteTo(this.transports.filter((t) => t.terminalPing), markdown);
88
+ }
89
+ noteTo(transports, markdown) {
90
+ return this.enqueue(async () => {
91
+ if (!markdown.trim() || transports.length === 0)
92
+ return;
93
+ await Promise.all(transports.map((t) => t.note(markdown).catch((err) => {
94
+ const m = err instanceof Error ? err.message : String(err);
95
+ console.warn(`[notifier] note failed: ${m}`);
96
+ })));
97
+ });
98
+ }
99
+ }
100
+ //# sour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AEO,MAAM,CAAC,UAA+B,EAAE,QAAgB;QAC9D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE;YAC7B,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO;YACxD,MAAM,OAAO,CAAC,GAAG,CACf,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACnB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;gBACtC,MAAM,CAAC,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC3D,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,EAAE,CAAC,CAAC;YAC/C,CAAC,CAAC,CACH,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The single shared renderer. Turns a {@link ProgressModel} into markdown.
3
+ * GitHub posts the output as-is; the Slack transport converts it via
4
+ * `markdownToSlackMrkdwn` first. There is exactly one renderer so the two
5
+ * platforms can never drift in content.
6
+ */
7
+ import type { ProgressModel, StepStatus } from "./types.js";
8
+ /** Status → leading emoji. Ported from the Mastra rebuild's EMOJI map. */
9
+ export declare const STATUS_EMOJI: Record<StepStatus, string>;
10
+ /** Render the model to a single markdown body. */
11
+ export declare function renderProgress(model: ProgressModel): string;
12
+ /**
13
+ * Collapse a rendered multi-line message into a compact one-line checklist
14
+ * detail: the first non-empty line, capped on *visible* length. The cap
15
+ * measures the rendered length (a markdown link counts as just its link
16
+ * text, not its URL) so a short label backed by a long URL is kept whole —
17
+ * truncating the raw string would slice through the URL and break the link.
18
+ * When a detail is genuinely too long, the link-stripped form is truncated,
19
+ * which can never produce a broken link.
20
+ */
21
+ export declare function collapseDetail(s: string): string | undefined;
@@ -0,0 +1,59 @@
1
+ /** Status → leading emoji. Ported from the Mastra rebuild's EMOJI map. */
2
+ export const STATUS_EMOJI = {
3
+ pending: "⬜",
4
+ running: "🔄",
5
+ done: "✅",
6
+ blocked: "⛔",
7
+ awaiting: "⏸️",
8
+ failed: "❌",
9
+ skipped: "➖",
10
+ };
11
+ /** Render the model to a single markdown body. */
12
+ export function renderProgress(model) {
13
+ const lines = [];
14
+ lines.push(`### 🤖 ${model.title}`);
15
+ if (model.subtitle) {
16
+ lines.push("");
17
+ lines.push(`**${model.subtitle}**`);
18
+ }
19
+ if (model.meta && model.meta.length > 0) {
20
+ lines.push("");
21
+ for (const m of model.meta)
22
+ if (m.trim())
23
+ lines.push(m);
24
+ }
25
+ lines.push("");
26
+ for (const step of model.steps) {
27
+ const emoji = STATUS_EMOJI[step.status] ?? STATUS_EMOJI.pending;
28
+ const detail = step.detail ? ` — ${step.detail}` : "";
29
+ lines.push(`- ${emoji} **${step.label}**${detail}`);
30
+ }
31
+ if (model.footer && model.footer.trim()) {
32
+ lines.push("");
33
+ lines.push(model.footer);
34
+ }
35
+ return lines.join("\n");
36
+ }
37
+ /** Markdown link `[text](url)` → its visible text, for length measurement. */
38
+ const visibleText = (s) => s.replace(/\[([^\]]+)\]\([^)]+\)/g, "$1");
39
+ /**
40
+ * Collapse a rendered multi-line message into a compact one-line checklist
41
+ * detail: the first non-empty line, capped on *visible* length. The cap
42
+ * measures the rendered length (a markdown link counts as just its link
43
+ * text, not its URL) so a short label backed by a long URL is kept whole —
44
+ * truncating the raw string would slice through the URL and break the link.
45
+ * When a detail is genuinely too long, the link-stripped form is truncated,
46
+ * which can never produce a broken link.
47
+ */
48
+ export function collapseDetail(s) {
49
+ const first = s
50
+ .split("\n")
51
+ .map((l) => l.trim())
52
+ .find((l) => l.length > 0);
53
+ if (!first)
54
+ return undefined;
55
+ if (visibleText(first).length <= 160)
56
+ return first;
57
+ return `${visibleText(first).slice(0, 159)}…`;
58
+ }
59
+ //# sour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E,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,MAAM,IAAI,CAAC,KAAK,KAAK,MAAM,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QACxC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,8EAA8E;AAC9E,MAAM,WAAW,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;AAErF;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,CAAS;IACtC,MAAM,KAAK,GAAG,CAAC;SACZ,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC7B,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,KAAK,CAAC;IACnD,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC;AAChD,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * GitHub binding for the progress notifier. Owns a single comment id and edits
3
+ * it in place on every `publish()`; `note()` posts a fresh comment for moments
4
+ * that deserve a real notification (approval prompts, terminal summary).
5
+ */
6
+ import type { GitHubClient } from "../../engine/github/github.js";
7
+ import type { NotifierTransport, ProgressModel } from "../types.js";
8
+ export interface GitHubTransportDeps {
9
+ github: GitHubClient;
10
+ owner: string;
11
+ repo: string;
12
+ issueNumber: number;
13
+ /** Existing status-comment id from a resumed run, if any. */
14
+ commentId?: number;
15
+ /** Persist the comment id the first time it's created (so resume re-attaches). */
16
+ save?: (commentId: number) => void;
17
+ }
18
+ export declare class GitHubTransport implements NotifierTransport {
19
+ private readonly deps;
20
+ /** No terminal ping — the finished checklist + the PR-opened event suffice. */
21
+ readonly terminalPing = false;
22
+ private commentId?;
23
+ constructor(deps: GitHubTransportDeps);
24
+ publish(markdown: string, _model?: ProgressModel): Promise<void>;
25
+ note(markdown: string): Promise<void>;
26
+ }
@@ -0,0 +1,27 @@
1
+ export class GitHubTransport {
2
+ deps;
3
+ /** No terminal ping — the finished checklist + the PR-opened event suffice. */
4
+ terminalPing = false;
5
+ commentId;
6
+ constructor(deps) {
7
+ this.deps = deps;
8
+ this.commentId = deps.commentId;
9
+ }
10
+ async publish(markdown, _model) {
11
+ // GitHub renders markdown natively — the structured model is Slack-only.
12
+ const { github, owner, repo, issueNumber } = this.deps;
13
+ if (this.commentId !== undefined) {
14
+ await github.updateComment(owner, repo, this.commentId, markdown);
15
+ }
16
+ else {
17
+ const id = await github.postComment(owner, repo, issueNumber, markdown);
18
+ this.commentId = id;
19
+ this.deps.save?.(id);
20
+ }
21
+ }
22
+ async note(markdown) {
23
+ const { github, owner, repo, issueNumber } = this.deps;
24
+ await github.postComment(owner, repo, issueNumber, markdown);
25
+ }
26
+ }
27
+ //# sourceMappingURL=github.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github.js","sourceRoot":"","sources":["../../../src/notify/transports/github.ts"],"names":[],"mappings":"AAmBA,MAAM,OAAO,eAAe;IAKG;IAJ7B,+EAA+E;IACtE,YAAY,GAAG,KAAK,CAAC;IACtB,SAAS,CAAU;IAE3B,YAA6B,IAAyB;QAAzB,SAAI,GAAJ,IAAI,CAAqB;QACpD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,QAAgB,EAAE,MAAsB;QACpD,yEAAyE;QACzE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;QACvD,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACpE,CAAC;aAAM,CAAC;YACN,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;YACxE,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAAgB;QACzB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;QACvD,MAAM,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;IAC/D,CAAC;CACF"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Slack binding for the progress notifier. Owns a single message `ts` and
3
+ * edits it in place via `chat.update` on every `publish()`; `note()` posts a
4
+ * fresh threaded message for moments that deserve a real ping (approval
5
+ * prompts, terminal summary) — `chat.update` itself is silent.
6
+ */
7
+ import type { SlackConnector } from "../../connectors/slack/connector.js";
8
+ import type { ApprovalNoteMeta, NotifierTransport, ProgressModel } from "../types.js";
9
+ export interface SlackTransportDeps {
10
+ slack: SlackConnector;
11
+ channel: string;
12
+ thread: string;
13
+ /** Existing status-message ts from a resumed run, if any. */
14
+ ts?: string;
15
+ /** Persist the ts the first time it's created (so resume re-attaches). */
16
+ save?: (ts: string) => void;
17
+ }
18
+ export declare class SlackTransport implements NotifierTransport {
19
+ private readonly deps;
20
+ /** Slack edits are silent and there's no other signal — so it wants the ping. */
21
+ readonly terminalPing = true;
22
+ private ts?;
23
+ constructor(deps: SlackTransportDeps);
24
+ publish(markdown: string, model?: ProgressModel): Promise<void>;
25
+ note(markdown: string): Promise<void>;
26
+ noteApproval(markdown: string, meta: ApprovalNoteMeta): Promise<void>;
27
+ }
@@ -0,0 +1,37 @@
1
+ import { renderApprovalBlocks, renderProgressBlocks } from "../blocks.js";
2
+ export class SlackTransport {
3
+ deps;
4
+ /** Slack edits are silent and there's no other signal — so it wants the ping. */
5
+ terminalPing = true;
6
+ ts;
7
+ constructor(deps) {
8
+ this.deps = deps;
9
+ this.ts = deps.ts;
10
+ }
11
+ async publish(markdown, model) {
12
+ const { slack, channel, thread } = this.deps;
13
+ // Render Block Kit from the model when available; `markdown` stays the
14
+ // notification/accessibility fallback carried alongside the blocks.
15
+ const blocks = model ? renderProgressBlocks(model) : undefined;
16
+ if (this.ts !== undefined) {
17
+ await slack.updateMessage(channel, this.ts, markdown, blocks);
18
+ }
19
+ else {
20
+ const ts = await slack.sendMessage(channel, thread, markdown, blocks);
21
+ if (typeof ts === "string") {
22
+ this.ts = ts;
23
+ this.deps.save?.(ts);
24
+ }
25
+ }
26
+ }
27
+ async note(markdown) {
28
+ const { slack, channel, thread } = this.deps;
29
+ await slack.sendMessage(channel, thread, markdown);
30
+ }
31
+ async noteApproval(markdown, meta) {
32
+ const { slack, channel, thread } = this.deps;
33
+ const blocks = renderApprovalBlocks(markdown, meta.workflowRunId);
34
+ await slack.sendMessage(channel, thread, markdown, blocks);
35
+ }
36
+ }
37
+ //# sourceMappingURL=slack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slack.js","sourceRoot":"","sources":["../../../src/notify/transports/slack.ts"],"names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AQ,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE,IAAsB;QACzD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;QAC7C,MAAM,MAAM,GAAG,oBAAoB,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAClE,MAAM,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC;CACF"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Shared, platform-agnostic notification model.
3
+ *
4
+ * The notifier renders workflow progress as a single "task list" surface that
5
+ * is **edited in place** as phases run — one GitHub comment (via
6
+ * `issues.updateComment`) and/or one Slack message (via `chat.update`) instead
7
+ * of a fresh comment per phase. The model here is the canonical content; the
8
+ * renderer (`render.ts`) turns it into markdown that both platforms consume
9
+ * (Slack runs the markdown through `markdownToSlackMrkdwn` in its transport).
10
+ *
11
+ * Nothing in this module imports GitHub or Slack — platform code lives behind
12
+ * the `NotifierTransport` interface so the content model stays decoupled and
13
+ * shared.
14
+ */
15
+ import type { StepStatus, ProgressStep } from "lastlight-workflow-engine";
16
+ export type { StepStatus, ProgressStep };
17
+ /** Metadata carried alongside an interactive approval prompt. */
18
+ export interface ApprovalNoteMeta {
19
+ /** The paused workflow run id — a Slack Approve/Reject button carries it as
20
+ * its action value so the click resolves the right gate. */
21
+ workflowRunId: string;
22
+ }
23
+ /** The full content model rendered into the single status surface. */
24
+ export interface ProgressModel {
25
+ /** Heading line, e.g. "build for #18". */
26
+ title: string;
27
+ /** Optional bold sub-heading, e.g. the issue title. */
28
+ subtitle?: string;
29
+ /** Optional metadata lines under the heading (branch link, PR link, …). */
30
+ meta?: string[];
31
+ /** Ordered checklist. */
32
+ steps: ProgressStep[];
33
+ /** Optional trailing line (e.g. artifacts link). */
34
+ footer?: string;
35
+ }
36
+ /**
37
+ * A platform binding. Each transport owns its own in-place-update handle
38
+ * (a GitHub comment id or a Slack message ts) internally.
39
+ */
40
+ export interface NotifierTransport {
41
+ /**
42
+ * Create-or-update the single status surface with the rendered markdown.
43
+ * The `model` is the same content source the markdown was rendered from —
44
+ * a transport that can render richer UI (Slack Block Kit) uses it directly
45
+ * while keeping `markdown` as the notification/accessibility fallback.
46
+ * Transports that only speak markdown (GitHub) ignore it.
47
+ */
48
+ publish(markdown: string, model?: ProgressModel): Promise<void>;
49
+ /**
50
+ * Post a *new, separate* message (not an edit). Used for approval prompts —
51
+ * moments worth an actual notification, since an in-place edit is silent.
52
+ */
53
+ note(markdown: string): Promise<void>;
54
+ /**
55
+ * Post a standalone *approval prompt*. Rich surfaces (Slack) render
56
+ * interactive Approve/Reject controls from `meta`; markdown-only surfaces
57
+ * (GitHub) omit this and the notifier falls back to `note(markdown)`.
58
+ * Optional so a plain transport needs only `note`.
59
+ */
60
+ noteApproval?(markdown: string, meta: ApprovalNoteMeta): Promise<void>;
61
+ /**
62
+ * Whether this surface wants a separate *completion* ping at the end of a
63
+ * run. Slack sets this (its in-place edits are silent and it has no other
64
+ * signal); GitHub leaves it false — the edited checklist plus the
65
+ * PR-opened event already notify watchers, so a terminal comment would just
66
+ * be noise. Default false.
67
+ */
68
+ readonly terminalPing?: boolean;
69
+ }
70
+ /**
71
+ * The runner-facing API. `runner.ts` only ever sees this interface — it never
72
+ * touches a transport or the markdown directly.
73
+ */
74
+ export interface ProgressReporter {
75
+ /** Seed the task list. Idempotent: a resumed run re-seeds the same surface. */
76
+ start(model: ProgressModel): Promise<void>;
77
+ /** Transition a step's status (and optionally set its one-line detail). */
78
+ step(key: string, status: StepStatus, detail?: string): Promise<void>;
79
+ /**
80
+ * Insert (or update) a dynamic step before `beforeKey` — used for loop
81
+ * iterations (re-review / fix cycles). Appends when `beforeKey` is omitted
82
+ * or not found.
83
+ */
84
+ insertStep(step: ProgressStep, beforeKey?: string): Promise<void>;
85
+ /** Post a standalone message to every surface (e.g. an approval prompt). */
86
+ note(markdown: string): Promise<void>;
87
+ /**
88
+ * Post an interactive approval prompt to every surface. Rich surfaces render
89
+ * Approve/Reject controls (Slack Block Kit); others fall back to plain text.
90
+ */
91
+ noteApproval(markdown: string, meta: ApprovalNoteMeta): Promise<void>;
92
+ /**
93
+ * Set (or clear) the trailing footer of the single status surface and
94
+ * re-publish in place. Used to fold a workflow's final synthesized result
95
+ * into the same comment as the checklist rather than posting a new one.
96
+ * Pass an empty string to clear.
97
+ */
98
+ footer(markdown: string): Promise<void>;
99
+ /**
100
+ * Post the run's completion message, but only to surfaces that want a
101
+ * terminal ping (Slack) — GitHub is left with just the finished checklist.
102
+ */
103
+ noteTerminal(markdown: string): Promise<void>;
104
+ }
105
+ /** Persisted in-place-update handles, stored under `workflow_runs.scratch.notifier`. */
106
+ export interface NotifierState {
107
+ githubCommentId?: number;
108
+ slackTs?: string;
109
+ slackChannel?: string;
110
+ slackThread?: string;
111
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Shared, platform-agnostic notification model.
3
+ *
4
+ * The notifier renders workflow progress as a single "task list" surface that
5
+ * is **edited in place** as phases run — one GitHub comment (via
6
+ * `issues.updateComment`) and/or one Slack message (via `chat.update`) instead
7
+ * of a fresh comment per phase. The model here is the canonical content; the
8
+ * renderer (`render.ts`) turns it into markdown that both platforms consume
9
+ * (Slack runs the markdown through `markdownToSlackMrkdwn` in its transport).
10
+ *
11
+ * Nothing in this module imports GitHub or Slack — platform code lives behind
12
+ * the `NotifierTransport` interface so the content model stays decoupled and
13
+ * shared.
14
+ */
15
+ export {};
16
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/notify/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Docker sandbox manager — runs agent tasks in isolated sibling containers.
3
+ *
4
+ * The sandbox image bakes immutable assets at /app/ (skills, agent-context,
5
+ * MCP server, MCP config template). Its entrypoint wires them into the
6
+ * workspace after volumes are mounted — no post-run docker exec needed.
7
+ *
8
+ * Volumes mounted at runtime:
9
+ * - Shared data volume (/data): secrets (app.pem), session logs
10
+ * - Task worktree (/home/agent/workspace): per-task git repo
11
+ */
12
+ export interface SandboxConfig {
13
+ /** Docker image for sandbox containers (default: lastlight-sandbox:latest) */
14
+ imageName: string;
15
+ /** Env vars to inject into the sandbox */
16
+ env: Record<string, string>;
17
+ /** Timeout in seconds (default: 1800 = 30 min) */
18
+ timeoutSeconds?: number;
19
+ /**
20
+ * Per-sandbox memory cap, in Docker's `--memory` format (e.g. "2g", "512m").
21
+ * Default: 2g — enough headroom for `npm install`, vite build, and an
22
+ * agent loop, but small enough that several concurrent sandboxes can't
23
+ * exhaust a 16 GB host. Override via the `SANDBOX_MEMORY_LIMIT` env var.
24
+ */
25
+ memoryLimit?: string;
26
+ /**
27
+ * Docker network to attach the sandbox container to. Defaults to
28
+ * `LASTLIGHT_SANDBOX_NETWORK` env var or `lastlight_sandbox-egress`
29
+ * (the `internal: true` network declared in docker-compose.yml). The
30
+ * sandbox can only reach the public internet through the nginx-egress
31
+ * firewall sidecars on this network.
32
+ */
33
+ network?: string;
34
+ /**
35
+ * IP of the coredns sidecar this sandbox uses as its DNS resolver.
36
+ * `coredns-strict` (172.30.0.10) returns the strict-nginx IP for
37
+ * allowlisted hosts and NXDOMAIN for everything else; `coredns-open`
38
+ * (172.30.0.11) returns the open-nginx IP for any hostname (minus a
39
+ * small SSRF deny set). Passed to `docker run` as `--dns <ip>`.
40
+ *
41
+ * No env vars are injected — the sandbox has no idea a firewall is
42
+ * in front of it. Works for every SDK regardless of whether it
43
+ * honours HTTP_PROXY / HTTPS_PROXY.
44
+ */
45
+ dnsIp?: string;
46
+ }
47
+ export interface SandboxInfo {
48
+ containerId: string;
49
+ containerName: string;
50
+ worktreePath: string;
51
+ }
52
+ /**
53
+ * How `/home/agent/workspace` is materialized inside the sandbox container.
54
+ *
55
+ * - `bind`: classic host-path bind mount. Only safe when the host filesystem
56
+ * path is identical from the harness's view and the docker daemon's view —
57
+ * i.e. local dev where the harness runs directly on the host, or any
58
+ * deployment where `SANDBOX_DATA_VOLUME` is a real host path.
59
+ * - `volume-subpath`: mount a subpath of a named docker volume. Required
60
+ * when the harness runs inside a container that holds the data dir via a
61
+ * named volume (the standard docker-compose setup). A bare bind would
62
+ * resolve `/app/data/sandboxes/<id>` against the host's empty bare-FS
63
+ * `/app/data/...` rather than the named volume's `_data/sandboxes/<id>`,
64
+ * producing two divergent trees and breaking skill staging.
65
+ */
66
+ export type WorkspaceMount = {
67
+ type: "bind";
68
+ hostPath: string;
69
+ } | {
70
+ type: "volume-subpath";
71
+ volume: string;
72
+ subpath: string;
73
+ };
74
+ export declare class DockerSandbox {
75
+ private config;
76
+ private activeContainers;
77
+ constructor(config: SandboxConfig);
78
+ /**
79
+ * Create and start a sandbox container for a task.
80
+ */
81
+ create(opts: {
82
+ taskId: string;
83
+ worktreePath: string;
84
+ workspaceMount: WorkspaceMount;
85
+ }): Promise<SandboxInfo>;
86
+ /**
87
+ * Wait for the sandbox entrypoint to finish setup. The entrypoint touches
88
+ * `$WORKSPACE/.ready` as its last step before exec'ing the agent shell.
89
+ */
90
+ private waitForReady;
91
+ /**
92
+ * Run the agentic-pi CLI inside the sandbox with a prompt.
93
+ *
94
+ * Streams stdout line-by-line so the caller can react to JSON events
95
+ * (e.g. capture the top-level `session` record's id) before the agent
96
+ * has finished. The full stdout is also buffered and returned for
97
+ * post-run parsing of the usage_snapshot rollup.
98
+ */
99
+ runAgent(taskId: string, prompt: string, opts?: {
100
+ model?: string;
101
+ /**
102
+ * Pi thinking level: `off | minimal | low | medium | high | xhigh`.
103
+ * Validated against the closed set before being shell-interpolated.
104
+ */
105
+ thinking?: string;
106
+ /** agentic-pi GitHub profile: `read | issues-write | review-write | repo-write`. */
107
+ profile?: string;
108
+ /**
109
+ * Env forwarded INTO the sandboxed run via repeated `--sandbox-env`
110
+ * flags. Used to inject git identity. Keys / values are charset-asserted
111
+ * before shell interpolation.
112
+ */
113
+ sandboxEnv?: Record<string, string>;
114
+ /**
115
+ * Working directory for the agent process inside the container.
116
+ * Defaults to WORKSPACE_DIR (the workspace root). When the harness
117
+ * pre-cloned the target repo, the executor passes
118
+ * `<WORKSPACE_DIR>/<repo>` so the agent starts inside the checked-out
119
+ * tree. The path is asserted against an allowlist before being passed
120
+ * to `docker exec -w` to keep it shell-safe.
121
+ */
122
+ agentCwd?: string;
123
+ /**
124
+ * Enable agentic-pi's web-search extension. When false (or omitted),
125
+ * `--no-web-search` is appended to suppress auto-enable. When true,
126
+ * the flag is omitted and agentic-pi auto-detects the provider from
127
+ * whichever `*_API_KEY` env var the container received.
128
+ */
129
+ webSearch?: boolean;
130
+ /** Force a specific web-search provider. Validated against a closed set. */
131
+ webSearchProvider?: "tavily" | "brave" | "exa";
132
+ /**
133
+ * Per-phase skill directories to load, as absolute in-container paths
134
+ * under WORKSPACE_DIR (e.g. `/home/agent/workspace/.lastlight-skills/
135
+ * <phase>/<skill>`). Each becomes a repeated `--skill <dir>` flag.
136
+ * Charset/prefix-asserted before shell interpolation.
137
+ */
138
+ skillDirs?: string[];
139
+ /** Called for each newline-terminated stdout line as it arrives. */
140
+ onLine?: (line: string) => void;
141
+ }): Promise<void>;
142
+ /**
143
+ * Run a deterministic shell command inside an already-provisioned sandbox
144
+ * container and return its exit code + captured output. This is the
145
+ * non-agent sibling of {@link runAgent}: same `docker exec --user agent -w
146
+ * <workdir> … sh -c <cmd>` machinery, but it captures a bounded stdout tail
147
+ * (runAgent discards stdout) and RESOLVES with the exit code instead of
148
+ * rejecting on non-zero — the caller decides success/failure.
149
+ *
150
+ * Powers `type: bash` / `type: script` workflow phases (and the in-sandbox
151
+ * `generic_loop.until_bash` check). `command` is passed as a single argv slot
152
+ * to `sh -c`, so it is NOT re-parsed by the host shell — it is the script we
153
+ * intend to run. Env is forwarded via `docker exec -e KEY=VALUE` (argv, not
154
+ * shell-interpolated); keys are charset-asserted defensively.
155
+ */
156
+ runCommand(taskId: string, command: string, opts?: {
157
+ /**
158
+ * Working directory inside the container. Defaults to WORKSPACE_DIR.
159
+ * Asserted against the workspace-root allowlist (same guard as runAgent).
160
+ */
161
+ cwd?: string;
162
+ /** Env forwarded into the command via `docker exec -e`. */
163
+ sandboxEnv?: Record<string, string>;
164
+ /** Per-command timeout in seconds (default: the sandbox config timeout). */
165
+ timeoutSeconds?: number;
166
+ /** Called for each newline-terminated stdout line as it arrives. */
167
+ onLine?: (line: string) => void;
168
+ }): Promise<{
169
+ exitCode: number;
170
+ stdout: string;
171
+ stderr: string;
172
+ timedOut: boolean;
173
+ }>;
174
+ /**
175
+ * Remove a sandbox container.
176
+ */
177
+ destroy(taskId: string): Promise<void>;
178
+ destroyAll(): Promise<void>;
179
+ private resolveGitMounts;
180
+ }