lastlight 0.16.0 → 0.16.2

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} +39 -1
  5. package/dist/{cli/cli-server.js → cli-server.js} +105 -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} +9 -7
  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,616 +0,0 @@
1
- import { resolve, basename, join } from "path";
2
- import { appendFileSync, cpSync, existsSync, mkdirSync, readFileSync, rmSync, symlinkSync } from "fs";
3
- import { truncateForLog, safeStringify } from "../event-shim.js";
4
- import { BuildAssetStore } from "../../state/build-assets.js";
5
- /**
6
- * Shared building blocks for the per-backend executors
7
- * ({@link ../executors/backends.ts}). These have NO dependency on the
8
- * executors or the dispatcher, so the import DAG stays acyclic:
9
- * shared → backends → agent-executor.
10
- */
11
- export const DEFAULT_MODEL = "anthropic/claude-sonnet-4-6";
12
- export const DOCKER_WORKSPACE_DIR = "/home/agent/workspace";
13
- // Directory holding one skill bundle per phase. Deliberately NOT named
14
- // `.agents/skills` (pi's auto-discovery path): we map each phase's bundle
15
- // explicitly via --skill / skillPaths so two phases sharing a workspace —
16
- // sequential today, parallel via worktrees tomorrow — can never clobber each
17
- // other's catalogue. The agent keeps cwd = the repo (no `cd` preamble on
18
- // every command); the bundle is staged at the workspace ROOT — a sibling of
19
- // the repo, never in its git tree — and reached by an absolute path. On
20
- // docker/none that root is genuinely outside the repo. gondolin mounts only
21
- // cwd, so there the bundle is staged under the repo and added to the
22
- // checkout's local `.git/info/exclude` (never committed; see `excludeFromGit`).
23
- export const SKILL_BUNDLE_ROOT = ".lastlight-skills";
24
- export const THINKING_LEVELS = new Set([
25
- "off", "minimal", "low", "medium", "high", "xhigh",
26
- ]);
27
- /**
28
- * Stage this phase's declared skills into a per-phase bundle directory at
29
- * `<workspaceRoot>/.lastlight-skills/<phaseKey>/<basename>/` and return the
30
- * staged skill dirs, so the caller can point pi at them explicitly (via
31
- * `--skill` for docker or `skillPaths` for the in-process backends). Each
32
- * skill is a directory containing SKILL.md plus any `scripts/` / `references/`
33
- * / `assets/` — the whole tree comes along.
34
- *
35
- * Keyed by phase so concurrent phases in one workspace never touch each
36
- * other's bundle: only the phase's own `<phaseKey>` subtree is cleared, so a
37
- * clean slate per phase doesn't disturb a sibling phase mid-run.
38
- *
39
- * `mode` controls how each skill lands:
40
- * - "symlink": one symlink per skill → host source. gondolin/none, where pi
41
- * reads skill files host-side / through the cwd mount. Zero-copy.
42
- * - "copy": recursive copy. docker, where the agent's tools run inside the
43
- * container and host symlink targets wouldn't resolve; the copy lands
44
- * under the bind-mounted workspace.
45
- *
46
- * Returns `undefined` when the phase declares no skills (after clearing its
47
- * bundle), so a phase with no `skills:` gets no catalogue at all.
48
- */
49
- export function stageSkillBundle(workspaceRoot, phaseKey, skillPaths, mode) {
50
- const bundleDir = join(workspaceRoot, SKILL_BUNDLE_ROOT, phaseKey);
51
- if (existsSync(bundleDir)) {
52
- rmSync(bundleDir, { recursive: true, force: true });
53
- }
54
- if (!skillPaths?.length)
55
- return undefined;
56
- mkdirSync(bundleDir, { recursive: true });
57
- const staged = [];
58
- for (const hostPath of skillPaths) {
59
- const dest = join(bundleDir, basename(hostPath));
60
- if (mode === "symlink") {
61
- symlinkSync(hostPath, dest, "dir");
62
- }
63
- else {
64
- cpSync(hostPath, dest, { recursive: true, dereference: true });
65
- }
66
- staged.push(dest);
67
- }
68
- return staged;
69
- }
70
- /**
71
- * Sanitized per-phase key for the skill bundle directory. Phase name first
72
- * (unique even for loop iterations like `reviewer_fix_1`), then workflow name,
73
- * then a constant fallback — so the bundle is always isolated per phase.
74
- */
75
- export function skillBundleKey(config) {
76
- const raw = config.telemetry?.phaseName || config.telemetry?.workflowName || "phase";
77
- return raw.replace(/[^A-Za-z0-9_-]/g, "_") || "phase";
78
- }
79
- /**
80
- * Add `entry` to a checkout's local `.git/info/exclude` (idempotent) so the
81
- * agent's own `git add`/`commit` can never pick it up. This file lives inside
82
- * `.git/` — it is never tracked, committed, or pushed, and it leaves the repo's
83
- * real `.gitignore` untouched; the exclusion applies only to this ephemeral
84
- * sandbox checkout. Used for the gondolin backend, where the skill bundle must
85
- * be staged under cwd (the only mounted dir) rather than as an out-of-repo
86
- * sibling. No-op when `repoDir` isn't a git checkout (e.g. the workspace root).
87
- */
88
- export function excludeFromGit(repoDir, entry) {
89
- const gitDir = join(repoDir, ".git");
90
- if (!existsSync(gitDir))
91
- return; // not a checkout — nothing to exclude
92
- const infoDir = join(gitDir, "info");
93
- const excludeFile = join(infoDir, "exclude");
94
- const line = `/${entry}/`;
95
- let current = "";
96
- try {
97
- current = readFileSync(excludeFile, "utf8");
98
- }
99
- catch { /* may not exist yet */ }
100
- if (current.split(/\r?\n/).includes(line))
101
- return;
102
- mkdirSync(infoDir, { recursive: true });
103
- appendFileSync(excludeFile, `${current.length && !current.endsWith("\n") ? "\n" : ""}${line}\n`);
104
- }
105
- // ── Server-mode build assets ────────────────────────────────────────
106
- //
107
- // In "server" mode the per-phase handoff docs live in the Last Light store
108
- // rather than being committed into the target repo. The seam is symmetric to
109
- // the skill bundle but bidirectional: stage the run's stored docs into the
110
- // repo's `.lastlight/<issueKey>/` before the agent runs (so a later phase /
111
- // resumed run sees prior context), and harvest whatever the phase wrote back
112
- // to the store afterwards. The directory is the SAME relative path as repo
113
- // mode (`{{issueDir}}`), so prompts are unchanged except for gating their
114
- // `git add .lastlight/ && commit` off — the dir is git-excluded here too as a
115
- // backstop against the agent's `git add -A` feature commit sweeping it in.
116
- const ARTIFACT_DIR_ROOT = ".lastlight";
117
- /**
118
- * Resolve the server-mode artifact context for a run, or undefined when not in
119
- * server mode (the default — the whole seam is then skipped and behaviour is
120
- * byte-for-byte repo mode). `hostRepoDir` is the host-visible repo checkout
121
- * (for docker that's the bind-mounted workspace path, not the in-container one).
122
- */
123
- export function serverArtifacts(config, hostRepoDir) {
124
- if (config.buildAssets !== "server" || !config.buildAssetsDir || !config.buildAssetsKey) {
125
- return undefined;
126
- }
127
- const store = new BuildAssetStore(config.buildAssetsDir);
128
- const ref = config.buildAssetsKey;
129
- return { store, ref, dir: join(hostRepoDir, ARTIFACT_DIR_ROOT, ref.issueKey), repoDir: hostRepoDir };
130
- }
131
- /** Stage stored docs into the workspace + exclude the dir from git (server mode). */
132
- export function stageArtifactsIn(art) {
133
- if (!art)
134
- return;
135
- try {
136
- // Stage the run's stored docs into `<repoDir>/.lastlight/<issueKey>/`. This
137
- // is safe for every workflow shape here: pre-cloned workflows (build, pr-*)
138
- // already have the checkout at `repoDir`, and non-pre-cloned ones (explore)
139
- // clone the repo into a *subdir* — so `repoDir` is the workspace root and a
140
- // `.lastlight/` there never collides with the agent's clone. (A future
141
- // workflow that `git clone … .` into cwd would be the one exception.)
142
- art.store.stageInto(art.ref, art.dir);
143
- // Backstop the prompt-level commit gate: when this is a real checkout, keep
144
- // the docs out of the agent's `git add -A` feature commit. No-op at the
145
- // workspace root (no `.git`), where the docs sit outside the repo subtree
146
- // and are never in the repo's git tree anyway.
147
- excludeFromGit(art.repoDir, ARTIFACT_DIR_ROOT);
148
- }
149
- catch (err) {
150
- const msg = err instanceof Error ? err.message : String(err);
151
- console.warn(`[executor] Could not stage build assets: ${msg}`);
152
- }
153
- }
154
- /** Persist docs the phase wrote back to the store (server mode). */
155
- export function harvestArtifactsOut(art) {
156
- if (!art)
157
- return;
158
- try {
159
- art.store.harvestFrom(art.ref, art.dir);
160
- }
161
- catch (err) {
162
- const msg = err instanceof Error ? err.message : String(err);
163
- console.warn(`[executor] Could not harvest build assets: ${msg}`);
164
- }
165
- }
166
- export class RunResultAccumulator {
167
- sessionId;
168
- finalText = "";
169
- agentEnded = false;
170
- toolErrors = false;
171
- maxStepsReached = false;
172
- lastToolError;
173
- // True iff the last assistant turn ended with a tool call — i.e. the agent
174
- // asked for a tool and the loop terminated before it could respond to the
175
- // result. That's a truncated run (pi hit its internal step cap mid-task),
176
- // not a finished one. See `finalizeFromRunResult`'s truncation guard.
177
- lastAssistantHadToolCall = false;
178
- fatalError;
179
- snapshotStats;
180
- messages = [];
181
- // Per-message usage accumulation (the compaction-proof source).
182
- assistantMessages = 0;
183
- userMessages = 0;
184
- toolCalls = 0;
185
- toolResults = 0;
186
- msgInput = 0;
187
- msgOutput = 0;
188
- msgCacheRead = 0;
189
- msgCacheWrite = 0;
190
- msgCost = 0;
191
- // Extension status events (file-search / github / web-search), keyed by
192
- // extension name. Emitted once each at run start; we keep the raw payload
193
- // (minus type/extension) so build() can map them onto the RunResult.
194
- ext = {};
195
- // Skill-loading status. agentic-pi emits a single (gated) `skills_status`
196
- // event at run start; we keep the raw payload (minus type) so skills()
197
- // can normalize it onto the RunResult, mirroring `ext` above for tools.
198
- skillsRaw;
199
- feed(r) {
200
- switch (r.type) {
201
- case "session":
202
- if (typeof r.id === "string")
203
- this.sessionId = r.id;
204
- break;
205
- case "extension_status": {
206
- if (typeof r.extension === "string") {
207
- const { type: _t, extension: _e, ...rest } = r;
208
- this.ext[r.extension] = rest;
209
- }
210
- break;
211
- }
212
- case "skills_status": {
213
- const { type: _t, ...rest } = r;
214
- this.skillsRaw = rest;
215
- break;
216
- }
217
- case "message_end": {
218
- const m = r.message;
219
- if (m?.role === "assistant" && Array.isArray(m.content)) {
220
- const text = m.content
221
- .filter((c) => c.type === "text" && typeof c.text === "string")
222
- .map((c) => c.text)
223
- .join("");
224
- if (text)
225
- this.finalText = text;
226
- this.assistantMessages += 1;
227
- const toolCallsInTurn = m.content.filter((c) => c.type === "toolCall").length;
228
- this.toolCalls += toolCallsInTurn;
229
- // Track whether the *latest* assistant turn requested a tool. If the
230
- // run ends here (no synthesis turn follows the tool result), the
231
- // agent was cut off mid-task.
232
- this.lastAssistantHadToolCall = toolCallsInTurn > 0;
233
- this.accumulateUsage(m.usage);
234
- }
235
- else if (m?.role === "user") {
236
- this.userMessages += 1;
237
- }
238
- break;
239
- }
240
- case "tool_execution_end":
241
- this.toolResults += 1;
242
- if (r.isError === true) {
243
- this.toolErrors = true;
244
- // Keep the actual failure text (not just a boolean) so a run that
245
- // ends in `error_tool` can report which tool failed and why —
246
- // e.g. a provider `insufficient_quota` surfaced through an MCP
247
- // call, or a bash command's stderr. Last error wins (it's the
248
- // one that ended the run). truncate: tool output can be huge.
249
- const raw = r.error ?? r.result ?? r.output;
250
- const message = truncateForLog(typeof raw === "string" ? raw : safeStringify(raw), 4096);
251
- const tool = typeof r.tool === "string"
252
- ? r.tool
253
- : typeof r.toolName === "string"
254
- ? r.toolName
255
- : undefined;
256
- if (message)
257
- this.lastToolError = { tool, message };
258
- }
259
- break;
260
- case "agent_end":
261
- this.agentEnded = true;
262
- if (Array.isArray(r.messages))
263
- this.messages = r.messages;
264
- break;
265
- case "max_steps_reached":
266
- this.maxStepsReached = true;
267
- break;
268
- case "usage_snapshot":
269
- this.snapshotStats = r.stats;
270
- break;
271
- case "fatal_error":
272
- this.fatalError = r.error;
273
- break;
274
- }
275
- }
276
- accumulateUsage(usage) {
277
- if (!usage || typeof usage !== "object")
278
- return;
279
- const num = (v) => typeof v === "number" && Number.isFinite(v) ? v : 0;
280
- this.msgInput += num(usage.input);
281
- this.msgOutput += num(usage.output);
282
- this.msgCacheRead += num(usage.cacheRead);
283
- this.msgCacheWrite += num(usage.cacheWrite);
284
- const cost = usage.cost;
285
- if (cost && typeof cost === "object")
286
- this.msgCost += num(cost.total);
287
- }
288
- /** Stats summed from per-message usage, or undefined if none was seen. */
289
- accumulatedStats() {
290
- const total = this.msgInput + this.msgOutput + this.msgCacheRead + this.msgCacheWrite;
291
- if (this.assistantMessages === 0 && total === 0)
292
- return undefined;
293
- return {
294
- userMessages: this.userMessages,
295
- assistantMessages: this.assistantMessages,
296
- toolCalls: this.toolCalls,
297
- toolResults: this.toolResults,
298
- tokens: {
299
- input: this.msgInput,
300
- output: this.msgOutput,
301
- cacheRead: this.msgCacheRead,
302
- cacheWrite: this.msgCacheWrite,
303
- total,
304
- },
305
- cost: this.msgCost,
306
- };
307
- }
308
- /**
309
- * Prefer the per-message accumulation (compaction-proof) over pi's
310
- * terminal `usage_snapshot`. Fall back to the snapshot only when the
311
- * accumulation carries no token data — e.g. a provider that doesn't
312
- * report per-message usage — so a non-compacted snapshot still wins.
313
- */
314
- bestStats() {
315
- const acc = this.accumulatedStats();
316
- if (acc && acc.tokens.total > 0)
317
- return acc;
318
- return this.snapshotStats ?? acc;
319
- }
320
- build(exitCode) {
321
- return {
322
- exitCode: exitCode,
323
- ok: exitCode === 0 && !this.fatalError,
324
- agentEnded: this.agentEnded,
325
- toolErrors: this.toolErrors,
326
- maxStepsReached: this.maxStepsReached,
327
- fatalError: this.fatalError,
328
- sessionId: this.sessionId,
329
- finalText: this.finalText,
330
- messages: this.messages,
331
- stats: this.bestStats(),
332
- records: [],
333
- warnings: [],
334
- };
335
- }
336
- /**
337
- * Normalized extension status captured from `extension_status` events
338
- * (file-search / github / web-search), or undefined if none reported.
339
- * Decoupled from agentic-pi's `RunResult` type, which lags the runtime —
340
- * the docker sandbox's agentic-pi emits file-search even when the harness's
341
- * pinned `RunResult` type doesn't yet declare it.
342
- */
343
- extensions() {
344
- const out = {};
345
- for (const [name, v] of Object.entries(this.ext)) {
346
- if (v && typeof v.status === "string") {
347
- out[name] = {
348
- status: v.status,
349
- ...(typeof v.mode === "string" ? { mode: v.mode } : {}),
350
- ...(typeof v.provider === "string" ? { provider: v.provider } : {}),
351
- ...(typeof v.toolCount === "number" ? { toolCount: v.toolCount } : {}),
352
- ...(typeof v.reason === "string" ? { reason: v.reason } : {}),
353
- };
354
- }
355
- }
356
- return Object.keys(out).length > 0 ? out : undefined;
357
- }
358
- /**
359
- * Normalized skill-loading status from the gated `skills_status` event, or
360
- * undefined if none was reported (agentic-pi suppresses it on a run that
361
- * configured no skills and discovered none). The skill-loading counterpart
362
- * to {@link extensions}.
363
- */
364
- skills() {
365
- const s = this.skillsRaw;
366
- if (!s || typeof s.status !== "string")
367
- return undefined;
368
- const skills = Array.isArray(s.skills)
369
- ? s.skills
370
- .filter((x) => !!x && typeof x === "object")
371
- .map((x) => ({
372
- name: typeof x.name === "string" ? x.name : "",
373
- source: typeof x.source === "string" ? x.source : "",
374
- modelInvocable: x.modelInvocable === true,
375
- }))
376
- : [];
377
- return {
378
- status: s.status,
379
- discovered: typeof s.discovered === "number" ? s.discovered : skills.length,
380
- skills,
381
- mappedPaths: Array.isArray(s.mappedPaths)
382
- ? s.mappedPaths.filter((p) => typeof p === "string")
383
- : [],
384
- noSkills: s.noSkills === true,
385
- };
386
- }
387
- /**
388
- * The last tool result that came back with `isError: true`, including the
389
- * failure text — or undefined if no tool errored. This is what turns a
390
- * bare `error_tool` stop reason into a human-readable cause.
391
- */
392
- toolError() {
393
- return this.lastToolError;
394
- }
395
- /**
396
- * True iff the run's final assistant turn ended on a tool call — meaning
397
- * the agent intended to keep going but the loop stopped before it could
398
- * respond to the tool result and write its answer. The signal a run was
399
- * truncated (step-limit) rather than genuinely finished.
400
- */
401
- endedOnToolCall() {
402
- return this.lastAssistantHadToolCall;
403
- }
404
- }
405
- // ── Helpers ─────────────────────────────────────────────────────────
406
- /** Provider account/billing/auth failures pi may surface as error text. */
407
- const ACCOUNT_ERROR_MARKERS = [
408
- "credit balance",
409
- "insufficient_quota",
410
- "insufficient quota",
411
- "rate limit",
412
- "unauthorized",
413
- "invalid_api_key",
414
- ];
415
- /**
416
- * Detect a provider account error (out of credit, quota, rate-limited, bad key)
417
- * that pi may have surfaced as plain text rather than a hard failure.
418
- *
419
- * Critically, on a **successful** run we scan ONLY the genuine provider-error
420
- * channel (`agentErrorMessage`, which `extractAgentError` already turns into a
421
- * non-success stopReason when set — so it's empty here). The agent's own output
422
- * (`finalText`) and tool results (`fatalError`, `toolError`) are NOT scanned on
423
- * success: a legitimate `verify`/`qa-test` report or a `curl` probing a 401
424
- * endpoint routinely contains "unauthorized" / "rate limit" as part of the task
425
- * itself, and folding that in would wrongly fail a genuinely successful run
426
- * (and drop its report). Only on a failed run do we fold those in to label why.
427
- */
428
- export function detectAccountError(opts) {
429
- const combined = [
430
- opts.success ? undefined : opts.fatalErrorMessage,
431
- opts.agentErrorMessage,
432
- opts.success ? undefined : opts.finalText,
433
- opts.success ? undefined : opts.toolErrorText,
434
- ]
435
- .filter((s) => typeof s === "string" && s.length > 0)
436
- .join("\n")
437
- .toLowerCase();
438
- return ACCOUNT_ERROR_MARKERS.some((m) => combined.includes(m));
439
- }
440
- export function finalizeFromRunResult(result, _prompt, shim, startTime, extensions, skills, toolError, endedOnToolCall = false) {
441
- const durationMs = Date.now() - startTime;
442
- const stats = result.stats;
443
- // pi-agent-core swallows provider API errors (insufficient_quota, rate
444
- // limit, auth) inside `handleRunFailure`: it synthesizes an assistant
445
- // message with stopReason "error" + errorMessage and emits a clean
446
- // agent_end. Without this check the run would map to "success" and the
447
- // workflow would silently advance with no output. See message scan below.
448
- const agentError = extractAgentError(result);
449
- let stopReason = agentError?.stopReason ?? mapStopReason(result);
450
- // Truncation guard. A run that *would* map to "success" but whose final
451
- // assistant turn ended on a tool call was cut off mid-task: the agent
452
- // asked for a tool and the loop stopped before it could read the result
453
- // and synthesize an answer (pi hit its internal step cap — agentic-pi
454
- // v0.2.7 exposes no maxSteps knob to lift it). In that state `finalText`
455
- // is the agent's "let me just check X" preamble, NOT an answer. Reclassify
456
- // as a failure so the workflow fires `on_failure` instead of delivering
457
- // the fragment as if it were the result.
458
- const truncated = stopReason === "success" && !agentError && endedOnToolCall;
459
- if (truncated)
460
- stopReason = "error_truncated";
461
- const success = stopReason === "success";
462
- const truncationMessage = "Agent stopped mid-task before producing a final answer (hit the agent " +
463
- "step limit). No answer was delivered.";
464
- // A bare `error_tool` stop reason is useless on its own. Surface the
465
- // failing tool's actual error text so the executions row and dashboard
466
- // show *why* the run died (e.g. "Tool `bash` failed: insufficient_quota").
467
- const toolErrorText = toolError
468
- ? toolError.tool
469
- ? `Tool \`${toolError.tool}\` failed: ${toolError.message}`
470
- : toolError.message
471
- : undefined;
472
- const inputTokens = stats?.tokens.input ?? 0;
473
- const outputTokens = stats?.tokens.output ?? 0;
474
- const cacheRead = stats?.tokens.cacheRead ?? 0;
475
- const cacheWrite = stats?.tokens.cacheWrite ?? 0;
476
- const costUsd = stats?.cost ?? 0;
477
- const turns = stats?.assistantMessages ?? 0;
478
- const costStr = costUsd > 0 ? `, $${costUsd.toFixed(4)}` : "";
479
- console.log(` [executor] Result: ${stopReason} (${turns} turns, ${Math.round(durationMs / 1000)}s${costStr})` +
480
- `${result.sessionId ? ` [session ${result.sessionId}]` : ""}`);
481
- shim.finalize({
482
- finalText: result.finalText,
483
- turns,
484
- costUsd,
485
- inputTokens,
486
- outputTokens,
487
- cacheReadInputTokens: cacheRead,
488
- cacheCreationInputTokens: cacheWrite,
489
- stopReason,
490
- durationMs,
491
- apiErrorMessage: agentError?.errorMessage ??
492
- (success ? undefined : (toolErrorText ?? (truncated ? truncationMessage : undefined))),
493
- });
494
- void shim.flush();
495
- const accountError = detectAccountError({
496
- success,
497
- fatalErrorMessage: result.fatalError?.message,
498
- agentErrorMessage: agentError?.errorMessage,
499
- finalText: result.finalText,
500
- toolErrorText,
501
- });
502
- const errorText = result.fatalError?.message ||
503
- agentError?.errorMessage ||
504
- toolErrorText ||
505
- (truncated ? truncationMessage : result.finalText) ||
506
- // `unknown` means the agent exited cleanly but emitted no final text and no
507
- // agent_end event — the bare word is opaque in the dashboard, so spell it out.
508
- (stopReason === "unknown"
509
- ? "agent produced no output (no final text, no agent_end)"
510
- : stopReason);
511
- if (!success || accountError) {
512
- if (accountError)
513
- console.error(` [executor] Account error: ${errorText}`);
514
- else
515
- console.error(` [executor] Run failed (${stopReason}): ${errorText}`);
516
- }
517
- return {
518
- success: success && !accountError,
519
- output: result.finalText,
520
- turns,
521
- error: success && !accountError ? undefined : errorText,
522
- durationMs,
523
- sessionId: result.sessionId,
524
- costUsd: costUsd > 0 ? costUsd : undefined,
525
- inputTokens: inputTokens || undefined,
526
- outputTokens: outputTokens || undefined,
527
- cacheReadInputTokens: cacheRead || undefined,
528
- cacheCreationInputTokens: cacheWrite || undefined,
529
- stopReason,
530
- extensions,
531
- skills,
532
- };
533
- }
534
- export function mapStopReason(result) {
535
- if (result.fatalError)
536
- return "error_fatal";
537
- if (result.toolErrors && result.finalText.length === 0)
538
- return "error_tool";
539
- if (!result.ok)
540
- return `error_exit_${result.exitCode}`;
541
- if (result.agentEnded || result.finalText.length > 0)
542
- return "success";
543
- return "unknown";
544
- }
545
- /**
546
- * Scan agent_end's messages for a failed assistant turn. pi-agent-core's
547
- * `handleRunFailure` catches provider errors, synthesizes an assistant
548
- * message with stopReason "error"/"aborted" + errorMessage, and emits a
549
- * normal agent_end — so the only signal that the run actually failed
550
- * lives on the last assistant message.
551
- */
552
- export function extractAgentError(result) {
553
- if (!Array.isArray(result.messages))
554
- return undefined;
555
- for (let i = result.messages.length - 1; i >= 0; i--) {
556
- const m = result.messages[i];
557
- if (m?.role !== "assistant")
558
- continue;
559
- if (m.stopReason === "error" || m.stopReason === "aborted") {
560
- return {
561
- stopReason: m.stopReason === "aborted" ? "error_aborted" : "error_agent",
562
- errorMessage: m.errorMessage || m.stopReason,
563
- };
564
- }
565
- return undefined;
566
- }
567
- return undefined;
568
- }
569
- export function coerceThinking(raw) {
570
- if (!raw)
571
- return undefined;
572
- const v = raw.trim().toLowerCase();
573
- if (!THINKING_LEVELS.has(v)) {
574
- console.warn(`[executor] Ignoring unknown thinking level "${raw}" — must be one of: ${[...THINKING_LEVELS].join(", ")}`);
575
- return undefined;
576
- }
577
- return v;
578
- }
579
- export function resolveSessionsDir(config) {
580
- if (config.sessionsDir)
581
- return resolve(config.sessionsDir);
582
- const stateDir = config.stateDir || resolve("data");
583
- return process.env.LASTLIGHT_SESSIONS_DIR
584
- ? resolve(process.env.LASTLIGHT_SESSIONS_DIR)
585
- : resolve(stateDir, "agent-sessions");
586
- }
587
- export function emptyResult(stopReason, durationMs) {
588
- return {
589
- finalText: "",
590
- turns: 0,
591
- costUsd: 0,
592
- inputTokens: 0,
593
- outputTokens: 0,
594
- cacheReadInputTokens: 0,
595
- cacheCreationInputTokens: 0,
596
- stopReason,
597
- durationMs,
598
- };
599
- }
600
- /** Splice values into process.env for the duration of a sync block. */
601
- export function applyEnv(env) {
602
- const saved = {};
603
- for (const [k, v] of Object.entries(env)) {
604
- saved[k] = process.env[k];
605
- process.env[k] = v;
606
- }
607
- return () => {
608
- for (const [k, v] of Object.entries(saved)) {
609
- if (v === undefined)
610
- delete process.env[k];
611
- else
612
- process.env[k] = v;
613
- }
614
- };
615
- }
616
- //# sourceMappingURL=shared.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/engine/executors/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAQtG,OAAO,EAAe,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAsB,MAAM,6BAA6B,CAAC;AAElF;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,6BAA6B,CAAC;AAC3D,MAAM,CAAC,MAAM,oBAAoB,GAA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