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
package/package.json ADDED
@@ -0,0 +1,93 @@
1
+ {
2
+ "name": "lastlight-core",
3
+ "version": "0.16.1",
4
+ "description": "GitHub repository maintenance agent — Agent SDK harness",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "exports": {
8
+ ".": "./dist/index.js",
9
+ "./evals": {
10
+ "types": "./dist/evals-api.d.ts",
11
+ "import": "./dist/evals-api.js"
12
+ },
13
+ "./dist/*": "./dist/*",
14
+ "./package.json": "./package.json"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "config",
19
+ "workflows",
20
+ "skills",
21
+ "agent-context",
22
+ "deploy",
23
+ "sandbox.Dockerfile",
24
+ "docker-compose.yml"
25
+ ],
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/nearform/lastlight.git"
29
+ },
30
+ "keywords": [
31
+ "github",
32
+ "agent",
33
+ "claude",
34
+ "anthropic",
35
+ "maintenance",
36
+ "workflow"
37
+ ],
38
+ "author": "Clifton Cunningham",
39
+ "license": "MIT",
40
+ "engines": {
41
+ "node": ">=22.12"
42
+ },
43
+ "dependencies": {
44
+ "@earendil-works/pi-ai": "^0.79.8",
45
+ "@hono/node-server": "^1.19.13",
46
+ "@octokit/auth-app": "^8.2.0",
47
+ "@opentelemetry/api": "^1.9.1",
48
+ "@opentelemetry/exporter-logs-otlp-http": "^0.219.0",
49
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.219.0",
50
+ "@opentelemetry/exporter-trace-otlp-http": "^0.219.0",
51
+ "@opentelemetry/resources": "^2.8.0",
52
+ "@opentelemetry/sdk-logs": "^0.219.0",
53
+ "@opentelemetry/sdk-metrics": "^2.8.0",
54
+ "@opentelemetry/sdk-node": "^0.219.0",
55
+ "@opentelemetry/semantic-conventions": "^1.41.1",
56
+ "@sinclair/typebox": "^0.34.49",
57
+ "@slack/bolt": "^4.6.0",
58
+ "@slack/web-api": "^7.16.0",
59
+ "agentic-pi": "^0.2.16",
60
+ "arctic": "^3.7.0",
61
+ "better-sqlite3": "^11.0.0",
62
+ "croner": "^9.0.0",
63
+ "hono": "^4.12.14",
64
+ "octokit": "^5.0.5",
65
+ "yaml": "^2.8.3",
66
+ "zod": "^4.3.6",
67
+ "lastlight-workflow-engine": "0.1.0",
68
+ "lastlight-shared": "0.1.0"
69
+ },
70
+ "devDependencies": {
71
+ "@types/better-sqlite3": "^7.6.0",
72
+ "@types/node": "^22.0.0",
73
+ "concurrently": "^9.0.0",
74
+ "dependency-cruiser": "^18.1.0",
75
+ "tsx": "^4.0.0",
76
+ "typescript": "^5.7.0",
77
+ "vitest": "^4.1.4"
78
+ },
79
+ "scripts": {
80
+ "test": "vitest run",
81
+ "typecheck:test": "tsc -p tsconfig.test.json --noEmit",
82
+ "build": "tsc",
83
+ "build:dashboard": "pnpm --filter @lastlight/dashboard build",
84
+ "build:all": "pnpm run build && pnpm --filter @lastlight/dashboard build",
85
+ "start": "node dist/index.js",
86
+ "dev": "concurrently -n server,dash -c blue,magenta \"bash scripts/dev-local.sh\" \"pnpm --filter @lastlight/dashboard dev\"",
87
+ "dev:server": "bash scripts/dev-local.sh",
88
+ "dev:dashboard": "pnpm --filter @lastlight/dashboard dev",
89
+ "test:watch": "vitest",
90
+ "lint:boundaries": "depcruise --config .dependency-cruiser.cjs src",
91
+ "typecheck": "tsc --noEmit && pnpm run lint:boundaries"
92
+ }
93
+ }
@@ -0,0 +1,68 @@
1
+ # Sandbox image for Last Light agent tasks (LASTLIGHT_SANDBOX=docker
2
+ # fallback only — the default production sandbox is gondolin, invoked
3
+ # in-process by agentic-pi without docker).
4
+ #
5
+ # The heavy, stable toolchain (Debian deps, fnm + Node versions, semgrep/
6
+ # gitleaks, uv, the `agent` user) lives in the shared sandbox-base image so it
7
+ # stays cached across releases. This file adds only the THIN, frequently-changing
8
+ # tail: the pinned agentic-pi install + the baked agent-context + the entrypoint.
9
+ # Keep it that way — the same tail is duplicated in sandbox-qa.Dockerfile so
10
+ # Chromium stays a cached child of the base rather than of this churn.
11
+ #
12
+ # Build order matters (sandbox-base must exist first):
13
+ # docker compose --profile build-only build sandbox-base sandbox
14
+ #
15
+ # BASE_IMAGE defaults to the local tag (host `--local` builds + docker compose
16
+ # resolve it from the local image store). CI overrides it to the just-pushed
17
+ # GHCR ref (`--build-arg BASE_IMAGE=ghcr.io/nearform/lastlight-sandbox-base:<tag>`)
18
+ # because the buildx docker-container driver resolves FROM from a registry, not
19
+ # the local store. See .github/workflows/docker-publish.yml.
20
+ ARG BASE_IMAGE=lastlight-sandbox-base:latest
21
+ FROM ${BASE_IMAGE}
22
+
23
+ # Install agentic-pi globally so the harness can `docker exec ...
24
+ # agentic-pi run ...` against this container. The version + integrity come from
25
+ # `sandbox/agentic-pi.pin` (regenerated from lastlight's pnpm-lock.yaml by
26
+ # scripts/agentic-pi-pin.sh, drift-guarded by tests/agentic-pi-pin.test.ts). We
27
+ # COPY that tiny two-line file rather than the whole pnpm-lock.yaml on
28
+ # purpose: the lockfile's hash changes on every release and would rebust this
29
+ # layer (and sandbox-qa's Chromium) on every version bump; the pin changes only
30
+ # when agentic-pi actually does. `npm install -g <tarball>` doesn't consult a
31
+ # lockfile, hence the explicit integrity verification.
32
+ COPY apps/server/sandbox/agentic-pi.pin /tmp/agentic-pi.pin
33
+ RUN version=$(sed -n '1p' /tmp/agentic-pi.pin) \
34
+ && expected=$(sed -n '2p' /tmp/agentic-pi.pin) \
35
+ && echo "Installing agentic-pi@${version} (${expected})" \
36
+ && curl -fsSL "https://registry.npmjs.org/agentic-pi/-/agentic-pi-${version}.tgz" -o /tmp/agentic-pi.tgz \
37
+ && actual="sha512-$(node -e "const c=require('crypto'),f=require('fs');process.stdout.write(c.createHash('sha512').update(f.readFileSync('/tmp/agentic-pi.tgz')).digest('base64'))")" \
38
+ && if [ "$actual" != "$expected" ]; then \
39
+ echo "agentic-pi tarball integrity mismatch:" >&2; \
40
+ echo " expected: $expected" >&2; \
41
+ echo " actual: $actual" >&2; \
42
+ exit 1; \
43
+ fi \
44
+ && npm install -g --no-audit --no-fund /tmp/agentic-pi.tgz \
45
+ && rm /tmp/agentic-pi.tgz /tmp/agentic-pi.pin
46
+
47
+ # Agent context (baked at /app/ — entrypoint cats into workspace/AGENTS.md)
48
+ COPY apps/server/agent-context/ /app/agent-context/
49
+
50
+ # Entrypoint
51
+ COPY apps/server/deploy/sandbox-entrypoint.sh /app/sandbox-entrypoint.sh
52
+ RUN chmod +x /app/sandbox-entrypoint.sh
53
+
54
+ # Own app dir for agent user
55
+ RUN chown -R agent:agent /app /home/agent
56
+
57
+ WORKDIR /home/agent/workspace
58
+
59
+ # Image-level env so every `docker exec` (the entrypoint just runs once at
60
+ # container start) sees these. Exporting them in sandbox-entrypoint.sh only
61
+ # affects PID 1 — subsequent `docker exec agentic-pi run …` calls get a
62
+ # fresh environment and would otherwise miss these paths.
63
+ ENV LASTLIGHT_WORKSPACE=/home/agent/workspace
64
+ ENV LASTLIGHT_GIT_CREDENTIALS=/home/agent/.lastlight-git-credentials
65
+
66
+ # Entrypoint runs as root, fixes permissions, then drops to agent via gosu
67
+ ENTRYPOINT ["/app/sandbox-entrypoint.sh"]
68
+ CMD ["sleep", "infinity"]
@@ -0,0 +1,42 @@
1
+ # Skills
2
+
3
+ Skill directories staged into the sandbox per workflow phase (and a subset into
4
+ chat). A phase declares `skill: <name>` / `skills: [<name>, …]`; the runner
5
+ stages the whole directory into `<agentCwd>/.agents/skills/<name>/` and
6
+ pi-coding-agent surfaces `name` + `description` in the system prompt. The agent
7
+ reads SKILL.md (and any `references/`) on demand via its `read` tool.
8
+
9
+ **Authoring guide:** [`docs/agents/writing-skills.md`](../docs/agents/writing-skills.md)
10
+ — the loading contract, the craft, and house conventions. Read it before adding
11
+ or editing a skill.
12
+
13
+ ## Skills
14
+
15
+ | Skill | Used by | Purpose |
16
+ |-------|---------|---------|
17
+ | [`chat`](chat/) | chat | Conversational assistant for Slack/Discord threads — answer repo/PR/issue questions, guide to natural-language triggers. |
18
+ | [`issue-triage`](issue-triage/) | `issue-triage.yaml`, chat | Move issues through the canonical triage state machine — categorise, label, dedupe, manage stale, write a problem-statement summary (not a solution design), re-triage on reporter replies. |
19
+ | [`issue-comment`](issue-comment/) | `issue-comment.yaml` | Handle non-build maintainer comments on issues/PRs — close, label, answer briefly, redirect build requests. |
20
+ | [`pr-review`](pr-review/) | `pr-review.yaml`, chat | Review a PR with precision-first, tiered feedback and post a formal review. A pure code review — no building (CI validates the change). |
21
+ | [`pr-comment`](pr-comment/) | `pr-comment.yaml` | Answer a maintainer's question about an open PR with concrete, code-cited evidence (not a full review). |
22
+ | [`repo-health`](repo-health/) | `repo-health.yaml`, chat | Generate a repository health report — open issues, PR backlog, CI status, action items. |
23
+ | [`security-review`](security-review/) | `security-review.yaml` | Diff-scoped SDLC security review; file one dated summary issue with a task-list of findings. |
24
+ | [`security-feedback`](security-feedback/) | `security-feedback.yaml` | Process a maintainer's comment on a security scan summary — break findings into issues or record suppressions. |
25
+ | [`building`](building/) | build (executor, reviewer), `pr-fix.yaml` | Shared craft: install-first + package-manager detection, the test/lint/typecheck gate, and TDD discipline in the sandbox. |
26
+ | [`code-review`](code-review/) | build (reviewer), `pr-review.yaml` | Shared rubric: finding tiers (Critical/Important/Suggestions/Nits) and what-to-check. Referenced by both the branch-diff reviewer and the PR reviewer. |
27
+ | [`verify`](verify/) | `verify.yaml` | Test a behaviour claim as an investigator — CONFIRMED / REFUTED / INCONCLUSIVE with bash-captured evidence. |
28
+ | [`qa-test`](qa-test/) | `qa-test.yaml` | Run an automated QA flow against a CLI or locally-served app and report step-level pass/fail with evidence. |
29
+ | [`browser-qa`](browser-qa/) | `verify.yaml`, `qa-test.yaml`, `demo.yaml` | Drive a real headless browser against a locally-served web UI and capture screenshot (and, for `demo`, video) evidence. Gated to the docker QA image. |
30
+ | [`demo`](demo/) | `demo.yaml` | Record a short demo VIDEO of a PR/feature — drive the web UI, screen-record, and composite a titled, size-capped mp4 with ffmpeg. Gated to the docker QA image. |
31
+
32
+ `building` and `code-review` are **shared building blocks** so the install
33
+ gate and the review rubric each live in one place. `building` is staged by the
34
+ build cycle (executor + reviewer) and `pr-fix`; `code-review` by the build
35
+ reviewer and `pr-review` (which stages `code-review` but **not** `building` — a
36
+ pure code review). They're staged alongside the phase's primary skill/prompt and
37
+ read on demand.
38
+
39
+ The live set is enforced at startup: `validateAssets()` (`src/workflows/loader.ts`)
40
+ resolves every workflow `skill:` reference and `CHAT_SKILL_NAMES`
41
+ (`src/engine/chat-skills.ts`). Adding a skill here does nothing until a phase or
42
+ the chat list references it.
@@ -0,0 +1,208 @@
1
+ ---
2
+ name: browser-qa
3
+ description: Drive a real headless browser against a locally-served web UI and capture screenshot evidence, reporting step-level PASS/FAIL/BLOCKED with extracted DOM text and console errors. Use when a phase on the docker QA image must exercise a rendered UI and attach screenshots — it complements the text-evidence verify/qa-test skills.
4
+ version: 1.0.0
5
+ tags: [browser, qa, screenshots, evidence]
6
+ ---
7
+
8
+ # Browser QA
9
+
10
+ Drive a web UI with a real headless Chromium and report **step-level
11
+ pass/fail with evidence**: extracted DOM text, assertion results, console
12
+ errors, and screenshot files. The deliverable is a QA report — partial
13
+ coverage with documented failures is the expected output.
14
+
15
+ This skill is the **browser/screenshot path** that `verify` and `qa-test`
16
+ scope out to "a separate docker-gated capability". It only works on the
17
+ `lastlight-sandbox-qa:latest` docker image, which bakes in Playwright +
18
+ Chromium. You have bash + file tools but **no vision** — you reason over the
19
+ driver's JSON stdout (extracted text, assertion results, console errors).
20
+ The PNG screenshots are **human evidence only**; you never see them.
21
+
22
+ This skill uses the **building** skill for installing dependencies and
23
+ starting the repo's dev-server.
24
+
25
+ ## When this applies
26
+
27
+ A phase running on the docker QA image whose target is a **web app** the
28
+ repo serves on `localhost` and where rendered-UI behaviour or visual
29
+ evidence matters. For a CLI or a curl-able API, use `qa-test`/`verify`
30
+ instead — don't launch a browser you don't need.
31
+
32
+ ## FIRST — probe for a browser
33
+
34
+ The driver lives in this skill's bundle at
35
+ `<skill-dir>/scripts/agent-browser.mjs`. Resolve `<skill-dir>` from the
36
+ available-skills catalogue (it gives the absolute staged path of this
37
+ skill); do not assume a relative path from `$PWD` — the agent's cwd is the
38
+ checked-out repo, the bundle is a sibling.
39
+
40
+ Run the runtime probe before anything else:
41
+
42
+ ```bash
43
+ node <skill-dir>/scripts/agent-browser.mjs doctor
44
+ ```
45
+
46
+ - Exit 0 with `{"ok":true,"chromium":"..."}` → Chromium is available; proceed.
47
+ - Exit non-zero (e.g. `playwright not available …`, or no Chromium — the lean
48
+ default image, or a gondolin run) → **DO NOT attempt browser QA.** Fall back
49
+ to the text path (`verify`/`qa-test` style: curl the dev-server, capture
50
+ stdout) and **say in your report that the browser path was unavailable** and
51
+ you used the text path.
52
+
53
+ ## Start the app
54
+
55
+ Follow the **building** skill to install dependencies, then start the repo's
56
+ dev-server **in the background** and wait until it is listening on
57
+ `localhost:PORT` (poll with `curl` until it answers). Note the port — you
58
+ pass it as `--base-url`.
59
+
60
+ ## Author a flow
61
+
62
+ Write a `flow.json` describing the QA flow. Shape:
63
+
64
+ ```json
65
+ {
66
+ "baseUrl": "http://localhost:3000",
67
+ "viewport": { "width": 1280, "height": 800 },
68
+ "steps": [
69
+ { "name": "home", "goto": "/" },
70
+ { "click": "text=Login" },
71
+ { "fill": ["#email", "a@b.com"] },
72
+ { "type": ["#password", "hunter2"] },
73
+ { "press": "Enter" },
74
+ { "waitFor": "#dashboard" },
75
+ { "assertText": "Welcome" },
76
+ { "text": "h1" },
77
+ { "screenshot": "after-login" }
78
+ ]
79
+ }
80
+ ```
81
+
82
+ Step keys (a step may combine an action **plus** a trailing `screenshot`):
83
+
84
+ | Key | Value | Effect |
85
+ |--------------|----------------------|------------------------------------------------------------------|
86
+ | `goto` | path or URL | Navigate (resolved against `baseUrl`). **Failure is fatal.** |
87
+ | `click` | selector | Click the element. |
88
+ | `fill` | `[selector, value]` | Set an input's value. |
89
+ | `type` | `[selector, value]` | Type key-by-key into an input. |
90
+ | `press` | key (e.g. `Enter`) | Press a keyboard key. |
91
+ | `waitFor` | selector | Wait until the element is visible (~10s timeout). |
92
+ | `assertText` | string | Pass if the text is visible anywhere on the page; else step FAIL.|
93
+ | `text` | selector | Extract `textContent` into the step result (for you to read). |
94
+ | `pause` | milliseconds | Hold for N ms — a readable beat after a state change (demo videos).|
95
+ | `screenshot` | basename | Write `<out-dir>/<basename>.png` (full page). |
96
+
97
+ The whole flow runs in **one Chromium session** — login state, cookies, and
98
+ navigation persist across steps.
99
+
100
+ ### Demo mode (recording only)
101
+
102
+ When the session is **recorded** (`--record-dir`, `"record": true`, or an
103
+ explicit `--demo`), the driver switches on "demo mode" so the capture is
104
+ watchable — headless Chromium otherwise paints no cursor and fires actions
105
+ instantly. Demo mode adds a **synthetic cursor overlay** that animates to each
106
+ target, types `type` steps **character-by-character**, and holds a beat
107
+ **between steps**. For screenshot QA (no recording) these are all no-ops, so
108
+ QA runs stay fast. Prefer `type` over `fill` in a recorded flow so the typing is
109
+ visible, and use `pause` for deliberate holds. Tunables:
110
+ `--step-delay MS` (default 700), `--type-delay MS` (default 70),
111
+ `--move-steps N` (default 25), `--no-cursor` to drop the overlay (env:
112
+ `LASTLIGHT_STEP_DELAY_MS`, `LASTLIGHT_TYPE_DELAY_MS`, `LASTLIGHT_MOVE_STEPS`).
113
+
114
+ ## Run the flow
115
+
116
+ ```bash
117
+ node <skill-dir>/scripts/agent-browser.mjs run flow.json \
118
+ --base-url http://localhost:PORT \
119
+ --out-dir <artifact-dir>
120
+ ```
121
+
122
+ The driver prints a single JSON report:
123
+
124
+ ```json
125
+ { "ok": false,
126
+ "baseUrl": "http://localhost:3000",
127
+ "steps": [
128
+ { "index": 0, "action": "goto", "ok": true, "ms": 412 },
129
+ { "index": 6, "action": "assertText", "ok": false, "ms": 10003,
130
+ "error": "assertText not found: \"Welcome\"" },
131
+ { "index": 7, "action": "text", "ok": true, "ms": 5, "text": "Dashboard" },
132
+ { "index": 8, "action": "screenshot", "ok": true, "ms": 88,
133
+ "screenshot": "/…/after-login.png" }
134
+ ],
135
+ "consoleErrors": ["Uncaught TypeError: …"],
136
+ "screenshots": ["/…/after-login.png"] }
137
+ ```
138
+
139
+ - A step error (selector not found, assertion miss, timeout) is recorded
140
+ `ok:false` and the run **continues** — best-effort coverage. The exception
141
+ is a `goto` that fails: that is fatal and the remaining steps are skipped.
142
+ - `ok` at the top level is true only when **every** step passed. The process
143
+ exits 0 even when steps failed — judge from the JSON, not the exit code.
144
+ A non-zero exit means a fatal harness error (bad flow file, launch failure).
145
+
146
+ ## Screenshots & artifacts
147
+
148
+ Pass `--out-dir <artifact-dir>` pointing at the run's artifact directory the
149
+ **prompt provides** (commonly the run's `.lastlight/<issueKey>/` dir,
150
+ referenced as the template variable the prompt passes in). Saving there lets
151
+ the harness **harvest** the PNGs into the dashboard Artifacts view. Reference
152
+ each screenshot path in your report.
153
+
154
+ Screenshot delivery requires **server-mode build-assets**. If the PNGs can't
155
+ be persisted (no artifact dir was provided, or build-assets is repo-mode),
156
+ still report the text/DOM observations and console errors, and say the
157
+ screenshots were **not retained**.
158
+
159
+ ## Evidence rules
160
+
161
+ Mirror `verify`/`qa-test` — you are an investigator, not an advocate:
162
+
163
+ - **Never fake a pass.** Don't hardcode expected text or edit the code under
164
+ test to force a green step.
165
+ - **Report real failures.** A step that genuinely fails is a finding — record
166
+ it `FAIL` with the assertion/selector and the driver's error, and don't bury
167
+ it.
168
+ - **Treat `consoleErrors` and page errors as findings**, even if the visible
169
+ flow "worked" — surface them in the report.
170
+ - If the browser is unavailable (probe failed), fall back to text and say so —
171
+ don't pretend a UI step ran.
172
+
173
+ ## Report
174
+
175
+ Produce your report as your **final message** — the workflow posts it for you
176
+ (don't `github_add_issue_comment` yourself; that would double-post).
177
+
178
+ **Be concise, and stay in the browser.** The deliverable is short: a one-line
179
+ environment summary, the results table, the screenshots, console errors, and a
180
+ one-line coverage note. Do **not** read or analyse the repo's source code (the
181
+ text pass already did) and do **not** narrate every step or dump extracted DOM
182
+ text — surface a `text`/assertion value only when it's the actual evidence for a
183
+ row (e.g. a FAIL).
184
+
185
+ ```
186
+ ## Browser QA: <target>
187
+
188
+ **Environment:** <branch / commit, package manager, how served, Chromium version>
189
+
190
+ ### Results
191
+ | Step | Status | Evidence |
192
+ |------|--------|----------|
193
+ | <step description> | PASS / FAIL / BLOCKED | <terse evidence + inline screenshot if any> |
194
+
195
+ ### Console errors
196
+ - <each consoleErrors / pageerror entry, or "none observed">
197
+
198
+ ### Coverage
199
+ <one or two lines: what was driven, and anything not tested and why>
200
+ ```
201
+
202
+ Reference screenshots **inline** as raw Markdown images when the prompt gives
203
+ you a public artifact base URL — write `![caption](<base>/<name>.png)` directly
204
+ in the report body (or table cell), **never** wrapped in backticks or a code
205
+ fence (inside a code span it renders as literal text, not an image). Otherwise
206
+ reference them by filename. Every step in the flow must
207
+ have a row and a result. Never report a flow as "passed" with steps you didn't
208
+ actually run — list them as untested instead.