lastlight-core 0.28.2 → 0.30.0

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 (68) hide show
  1. package/config/default.yaml +77 -0
  2. package/dist/config/config.d.ts +8 -0
  3. package/dist/config/config.js +101 -0
  4. package/dist/config/config.js.map +1 -1
  5. package/dist/config/provider-registry.d.ts +57 -0
  6. package/dist/config/provider-registry.js +73 -0
  7. package/dist/config/provider-registry.js.map +1 -0
  8. package/dist/engine/agent-executor.js +19 -6
  9. package/dist/engine/agent-executor.js.map +1 -1
  10. package/dist/engine/chat/chat-runner.d.ts +14 -0
  11. package/dist/engine/chat/chat-runner.js +55 -6
  12. package/dist/engine/chat/chat-runner.js.map +1 -1
  13. package/dist/engine/executors/orchestrator.js +4 -2
  14. package/dist/engine/executors/orchestrator.js.map +1 -1
  15. package/dist/engine/github/github.d.ts +25 -0
  16. package/dist/engine/github/github.js +50 -0
  17. package/dist/engine/github/github.js.map +1 -1
  18. package/dist/engine/llm.d.ts +1 -1
  19. package/dist/engine/llm.js +18 -11
  20. package/dist/engine/llm.js.map +1 -1
  21. package/dist/engine/pr-decisions.js +99 -0
  22. package/dist/engine/pr-decisions.js.map +1 -1
  23. package/dist/engine/pr-state.d.ts +18 -0
  24. package/dist/engine/pr-state.js +36 -7
  25. package/dist/engine/pr-state.js.map +1 -1
  26. package/dist/engine/review-triage.d.ts +98 -0
  27. package/dist/engine/review-triage.js +122 -0
  28. package/dist/engine/review-triage.js.map +1 -0
  29. package/dist/index.js +6 -0
  30. package/dist/index.js.map +1 -1
  31. package/dist/sandbox/egress-allowlist.d.ts +20 -8
  32. package/dist/sandbox/egress-allowlist.js +25 -13
  33. package/dist/sandbox/egress-allowlist.js.map +1 -1
  34. package/dist/sandbox/egress-firewall-config.js +3 -3
  35. package/dist/sandbox/egress-firewall-config.js.map +1 -1
  36. package/dist/sandbox/k8s/kubernetes-sandbox.js +2 -2
  37. package/dist/sandbox/k8s/kubernetes-sandbox.js.map +1 -1
  38. package/dist/sandbox/sandbox.d.ts +8 -0
  39. package/dist/sandbox/sandbox.js +3 -0
  40. package/dist/sandbox/sandbox.js.map +1 -1
  41. package/dist/workflows/resume.js +3 -0
  42. package/dist/workflows/resume.js.map +1 -1
  43. package/dist/workflows/runner.d.ts +0 -6
  44. package/dist/workflows/runner.js +52 -0
  45. package/dist/workflows/runner.js.map +1 -1
  46. package/package.json +4 -4
  47. package/workflows/answer.yaml +4 -30
  48. package/workflows/build.yaml +0 -12
  49. package/workflows/cron-dependabot-ci-fix.yaml +3 -23
  50. package/workflows/cron-dependabot-merge.yaml +3 -18
  51. package/workflows/cron-digest.yaml +0 -7
  52. package/workflows/cron-review.yaml +10 -24
  53. package/workflows/demo.yaml +4 -31
  54. package/workflows/dependabot-ci-fix.yaml +57 -161
  55. package/workflows/dependabot-pr-merge.yaml +24 -72
  56. package/workflows/explore.yaml +4 -13
  57. package/workflows/issue-comment.yaml +2 -9
  58. package/workflows/issue-triage.yaml +1 -18
  59. package/workflows/pr-comment.yaml +2 -9
  60. package/workflows/pr-fix.yaml +0 -80
  61. package/workflows/pr-review.yaml +164 -478
  62. package/workflows/prompts/review-triage.md +86 -0
  63. package/workflows/prompts/review.md +47 -2
  64. package/workflows/qa-test.yaml +8 -41
  65. package/workflows/repo-health.yaml +1 -9
  66. package/workflows/security-feedback.yaml +7 -18
  67. package/workflows/security-review.yaml +4 -22
  68. package/workflows/verify.yaml +8 -38
@@ -0,0 +1,86 @@
1
+ You have reviewed this pull request before. Decide **how much review this push
2
+ is owed** — and nothing else. You are not reviewing the code.
3
+
4
+ We posted a review at `{{priorReviewSha}}`, verdict **{{priorReviewState}}**.
5
+ The head is now `{{headSha}}`. Your whole job is to read what changed between
6
+ those two commits and answer one question: **could a full re-review plausibly
7
+ say something it did not already say at `{{priorReviewSha}}`?**
8
+
9
+ The repository is already checked out at the head commit and your working
10
+ directory is the checkout. Start with:
11
+
12
+ ```
13
+ git diff --stat {{priorReviewSha}}...HEAD
14
+ git diff {{priorReviewSha}}...HEAD
15
+ ```
16
+
17
+ Read the delta. Open a file where the diff alone does not tell you what a hunk
18
+ does. Do not run tests, do not install dependencies, and do not review the pull
19
+ request as a whole — a full pass costs roughly twenty times what this one does,
20
+ and deciding it is needed is the entirety of what you are being asked for.
21
+
22
+ ## Answer `light` only when all of these hold
23
+
24
+ - The delta is **small** — a handful of hunks a person would read in a couple of
25
+ minutes.
26
+ - It is **localised**: it does not move an interface, a schema, a permission
27
+ boundary, a security or auth path, a concurrency or transaction boundary, or
28
+ anything that decides what callers elsewhere may do.
29
+ - It is **self-contained**: understanding it does not require re-reading code it
30
+ did not touch.
31
+ - Nothing in it looks like a **response to the prior review** that needs
32
+ checking in depth. A delta that claims to fix something we flagged is exactly
33
+ the case that earns a `full` pass.
34
+
35
+ ## Answer `full` whenever any of these hold
36
+
37
+ - The delta is large, or spread across many files.
38
+ - It touches an interface, a data schema or migration, authentication,
39
+ authorisation, secrets, input validation, or error and failure handling.
40
+ - It changes behaviour you would need to reason about, rather than text, tests,
41
+ comments, formatting or dependency pins.
42
+ - The prior review requested changes and this delta appears to be the answer.
43
+ - **You are not sure.** Uncertainty is a `full` answer. A `light` review that
44
+ should have been `full` misses a real defect; a `full` review that could have
45
+ been `light` costs money and nothing else.
46
+
47
+ Files changed since that review (may be truncated, and empty when we could not
48
+ read the list — in which case you have less information than usual and should
49
+ lean toward `full`):
50
+
51
+ ```
52
+ {{pathsSinceLastReview}}
53
+ ```
54
+
55
+ The review we posted at `{{priorReviewSha}}`:
56
+
57
+ ```
58
+ {{priorReviewBody}}
59
+ ```
60
+
61
+ ## Output
62
+
63
+ Write two or three sentences saying what the delta is and why it earns the depth
64
+ you chose. Then end your output with exactly one line, on its own, and nothing
65
+ after it:
66
+
67
+ ```
68
+ REVIEW_DEPTH: full
69
+ ```
70
+
71
+ or
72
+
73
+ ```
74
+ REVIEW_DEPTH: light
75
+ ```
76
+
77
+ Any other value, or no line at all, is read as `full`.
78
+
79
+ Context:
80
+ repository: {{owner}}/{{repo}}
81
+ prNumber: {{prNumber}}
82
+ branch: {{branch}}
83
+ baseBranch: {{baseBranch}}
84
+ headSha: {{headSha}}
85
+ priorReviewSha: {{priorReviewSha}}
86
+ priorReviewState: {{priorReviewState}}
@@ -1,8 +1,8 @@
1
- {{#if !analysisEnabled}}
1
+ {{#if scratch.reviewTriage.baseline}}
2
2
  Use the **pr-review** skill to handle this request.
3
3
  Other skills available if you need them: code-review.
4
4
  {{/if}}
5
- {{#if analysisEnabled}}
5
+ {{#if scratch.reviewTriage.deep}}
6
6
  The review evidence pipeline has already run in this workspace. Six survey
7
7
  families wrote defect hypotheses under `.lastlight/pr-review/hypotheses/`, a
8
8
  falsify pass probed what could be executed, and a dedicated **adjudicate**
@@ -62,6 +62,51 @@ phase so you know what NOT to duplicate — none of it is vocabulary the author
62
62
  shares. Write about their change in their words; a review that explains how it
63
63
  was produced has spent the reader's attention on us instead of on their code.
64
64
  {{/if}}
65
+ {{#if scratch.reviewTriage.light}}
66
+ You have already reviewed this pull request, at `{{priorReviewSha}}` — that
67
+ review's verdict was **{{priorReviewState}}**. A triage pass has judged the
68
+ change since then small enough that re-deriving the whole review would cost more
69
+ than it is worth, so this is a **single focused pass**, and the only one this
70
+ run gets.
71
+
72
+ Read what has changed since `{{priorReviewSha}}`, not the pull request from
73
+ scratch. `git diff {{priorReviewSha}}...HEAD` is the delta; the three-dot diff
74
+ against `{{baseBranch}}` is still the change as a whole, and you should reach
75
+ for it only where the delta cannot be understood without it.
76
+
77
+ Three things to report, and nothing else:
78
+
79
+ - a **new defect the delta introduces** — held to the same precision bar a full
80
+ review is;
81
+ - a point from the prior review that the delta **claims to address but does
82
+ not**, which is the failure this pass exists to catch;
83
+ - a point from the prior review the delta has **genuinely fixed**, so the
84
+ verdict can move.
85
+
86
+ Do **not** restate the prior review's standing findings as if they were new; the
87
+ author has already read them. Do **not** re-audit code the delta did not touch —
88
+ a line you approved at `{{priorReviewSha}}` has not changed and neither has your
89
+ answer. An empty `findings` array is the expected outcome of a small, correct
90
+ delta.
91
+
92
+ What you said last time, verbatim (empty if that review carried no body):
93
+
94
+ ```
95
+ {{priorReviewBody}}
96
+ ```
97
+
98
+ Follow the **pr-review** skill for everything procedural — the workspace layout,
99
+ the stop conditions, the prior-discussion read, what CI already answered — and
100
+ write `.lastlight/pr-review/findings.json` in the skill's format
101
+ (`skip?` / `summary` / `event` / `findings[]`). The posting step requires that
102
+ file to exist even when `findings` is empty. The **code-review** skill's
103
+ precision bar applies to anything you do report.
104
+
105
+ **Your `summary`, `title` and `body` may be posted verbatim to the maintainer.**
106
+ Write about their change in their words. That a triage pass sized this review is
107
+ not vocabulary the author shares, and a review explaining how it was produced
108
+ has spent the reader's attention on us instead of on their code.
109
+ {{/if}}
65
110
 
66
111
  Context:
67
112
  repository: {{owner}}/{{repo}}
@@ -1,12 +1,5 @@
1
1
  kind: qa-test
2
2
  name: qa-test
3
- # Runtime policy (issue #368) — reads the repo and posts a step-level QA
4
- # report; never pushes code. Pre-populates its synthesized branch so
5
- # browser-QA screenshots land under `.lastlight/<key>/` where
6
- # `serverArtifacts()` harvests them; against a real PR it pins to the PR's
7
- # head ref, or it would QA the base branch and report the PR's feature
8
- # missing. Full prose for each key is in the workflow schema
9
- # (packages/workflow-engine/src/core/schema.ts).
10
3
  git_access: issues-write
11
4
  prepopulate_synth_branch: true
12
5
  prepopulate_pr_head_ref: true
@@ -25,28 +18,15 @@ chat:
25
18
  - run through <flow> and tell me what breaks
26
19
  - smoke-test the CLI commands
27
20
  description: |
28
- Run an automated QA flow against a repo's CLI or locally-served app and report
29
- step-level pass/fail with evidence. It installs and runs the code in the
30
- sandbox, exercises a flow (CLI invocations or curl against a dev-server),
31
- optionally drives the UI in a real browser, then posts a single per-step QA
32
- report. Does not modify code.
21
+ Run an automated QA flow against a repo's CLI or locally-served app and
22
+ report step-level pass/fail with evidence. Installs and runs the code in the
23
+ sandbox, exercises the flow, and posts one QA report. Never modifies code.
33
24
 
34
- Delivery is a single in-place status comment (`status_checklist`): the run
35
- shows its phases ticking off, then a final `synthesize` phase folds the text
36
- report and (when it ran) the browser evidence into ONE combined report,
37
- delivered as the comment's footer via `final_message`. No comment-per-phase.
38
- Posted on the originating issue/PR for GitHub runs, or into the Slack thread
39
- for Slack runs. The agents therefore do NOT post anything themselves.
40
-
41
- When the host runs the docker backend with the browser-QA image built, the
42
- gated `qa_browser` phase drives a real headless Chromium against the
43
- locally-served app and captures step-level screenshot evidence; everywhere
44
- else it is silently skipped (graceful degradation) and the text report stands
45
- alone. The synthesis runs either way.
46
-
47
- Triggered by:
48
- - a `@last-light qa-test <target> [-- steps]` comment on an issue/PR
49
- - manual CLI: tsx src/cli.ts qa-test owner/repo#N -- "<steps>"
25
+ A final `synthesize` phase folds the text report and, when it ran, the
26
+ browser evidence into ONE report delivered as the status comment's footer —
27
+ no comment per phase, and the agents post nothing themselves. The browser
28
+ phase needs the docker backend and the browser-QA image; anywhere else it is
29
+ skipped and the text report stands alone.
50
30
 
51
31
  status_checklist: true
52
32
  final_message: "{{synthesisResult}}"
@@ -61,8 +41,6 @@ phases:
61
41
  label: QA Test
62
42
  depends_on: [phase_0]
63
43
  prompt: prompts/qa-test.md
64
- # qa-test: the flow procedure + report shape (primary).
65
- # building: install + run the repo to exercise the flow.
66
44
  skills: [qa-test, building]
67
45
  model: "{{models.qa-test}}"
68
46
  variant: "{{variants.qa-test}}"
@@ -72,12 +50,6 @@ phases:
72
50
  on_success: "Text QA flow complete."
73
51
  on_failure: "I couldn't complete the QA run — see the logs for details."
74
52
 
75
- # Browser-QA pass (Tier B). Gated to the docker backend AND the enriched
76
- # `lastlight-sandbox-qa:latest` image (Playwright + Chromium). On gondolin, or
77
- # a docker host without that image, the scheduler silently skips this phase.
78
- # It is terminal (nothing depends on it) — `synthesize` depends only on
79
- # `qa_test`, so it still runs (after this phase, by declaration order) and
80
- # folds in `qaBrowserResult` only when this phase actually produced it.
81
53
  - name: qa_browser
82
54
  label: QA Test (browser)
83
55
  depends_on: [qa_test]
@@ -93,11 +65,6 @@ phases:
93
65
  on_success: "Browser QA complete — screenshots captured."
94
66
  on_skipped_done: "Browser QA unavailable on this host — text report stands."
95
67
 
96
- # Synthesis. Depends only on `qa_test` (always runs after the gated browser
97
- # phase by declaration order, and never skips when that phase is gated out).
98
- # Reads the prior reports from phaseOutputs and writes ONE combined report;
99
- # its output (`synthesisResult`) becomes the comment footer via the
100
- # workflow-level `final_message`. Pure composition — no skills, no repo work.
101
68
  - name: synthesize
102
69
  label: Summary
103
70
  depends_on: [qa_test, qa_browser]
@@ -1,9 +1,5 @@
1
1
  kind: health
2
2
  name: repo-health
3
- # Runtime policy (issue #368) — the report is delivered by the harness, not
4
- # written to GitHub by the agent, so this workflow needs nothing beyond
5
- # contents:read. Full prose for each key is in the workflow schema
6
- # (packages/workflow-engine/src/core/schema.ts).
7
3
  git_access: read
8
4
  chat:
9
5
  summary: A weekly repo health report
@@ -18,11 +14,7 @@ chat:
18
14
  trigger; do not suggest typing it here.)
19
15
  description: |
20
16
  Generate a health report for a repository: open issues, stale issues, PR
21
- velocity, label distribution, etc. Repo-scoped (no specific issue/PR).
22
-
23
- Triggered by:
24
- - weekly cron (default Monday 09:00)
25
- - manual CLI: tsx src/cli.ts health owner/repo
17
+ velocity, label distribution. Repo-scoped, with no specific issue or PR.
26
18
 
27
19
  phases:
28
20
  - name: report
@@ -1,26 +1,15 @@
1
1
  kind: health
2
2
  name: security-feedback
3
- # Runtime policy (issue #368) — opens issues AND pushes a SECURITY.md
4
- # suppression PR, so it needs contents:write. Full prose for each key is in
5
- # the workflow schema (packages/workflow-engine/src/core/schema.ts).
6
3
  git_access: repo-write
7
4
  description: |
8
- Process maintainer feedback on a security-labelled issue (usually a
9
- per-run scan summary). Classifies the comment and acts:
5
+ Process maintainer feedback on a security-labelled issue, usually a scan
6
+ summary. Classifies the comment and acts: break selected findings out into
7
+ their own issues (the primary flow), update SECURITY.md via PR to suppress a
8
+ finding as accepted-risk or a false positive, ask for a re-run, or simply
9
+ reply.
10
10
 
11
- - create-issues — break selected findings out into individual issues
12
- that can later be fed to the `build` skill (the primary flow)
13
- - accept-risk / false-positive — update SECURITY.md via PR to
14
- suppress the finding in future scans
15
- - reopen — ask the maintainer to re-run `@last-light security-review`
16
- - discuss / ignore — reply conversationally or do nothing
17
-
18
- The scan-summary issue grammar is defined in
19
- `skills/security-review/SKILL.md § Issue format`; this skill's parser
20
- mirrors it (version-checked on entry).
21
-
22
- Triggered by:
23
- - @last-light mention on issues labelled "security"
11
+ The scan-summary grammar it parses is defined in
12
+ `skills/security-review/SKILL.md § Issue format` and version-checked on entry.
24
13
 
25
14
  phases:
26
15
  - name: feedback
@@ -1,8 +1,5 @@
1
1
  kind: health
2
2
  name: security-review
3
- # Runtime policy (issue #368) — scans and files findings as issues/comments;
4
- # never pushes code. Full prose for each key is in the workflow schema
5
- # (packages/workflow-engine/src/core/schema.ts).
6
3
  git_access: issues-write
7
4
  classification:
8
5
  intent: security
@@ -20,25 +17,10 @@ chat:
20
17
  - scan for vulnerabilities
21
18
  - check security of <repo>
22
19
  description: |
23
- Scan the target repository for security issues using open-source tools
24
- (npm audit, semgrep, gitleaks) plus AI code review. Files ONE summary
25
- issue per run (Renovate-style) containing a GitHub task list of every
26
- finding grouped by Critical / High / Medium / Low. Honours SECURITY.md
27
- for known false positives and accepted risks.
28
-
29
- Maintainers break findings out into individual issues by commenting on
30
- the summary issue (see the `security-feedback` skill — which handles
31
- `@last-light create issues for the criticals`, per-item accept-risk /
32
- false-positive commands, and conversational follow-ups).
33
-
34
- Each invocation scans exactly ONE repo. The weekly cron fans out into
35
- one independent run per managed repo.
36
-
37
- Triggered by:
38
- - weekly cron (Monday 10:00, fans out over every managed repo)
39
- - manual CLI: tsx src/cli.ts security owner/repo
40
- - @last-light security-review in a GitHub comment
41
- - Slack: "security review cliftonc/repo"
20
+ Scan the repository for security issues with open-source tools (npm audit,
21
+ semgrep, gitleaks) plus AI review, and file ONE summary issue per run: a task
22
+ list of every finding grouped by Critical / High / Medium / Low. Honours
23
+ SECURITY.md for known false positives and accepted risks.
42
24
 
43
25
  phases:
44
26
  - name: scan
@@ -1,12 +1,5 @@
1
1
  kind: verify
2
2
  name: verify
3
- # Runtime policy (issue #368) — reads the repo and posts a CONFIRMED/REFUTED
4
- # verdict; never pushes code. Pre-populates its synthesized branch so
5
- # browser-QA artifacts land under `.lastlight/<key>/` where
6
- # `serverArtifacts()` harvests them; against a real PR it pins to the PR's
7
- # head ref, or it would verify the base branch and refute a claim the PR
8
- # actually satisfies. Full prose for each key is in the workflow schema
9
- # (packages/workflow-engine/src/core/schema.ts).
10
3
  git_access: issues-write
11
4
  prepopulate_synth_branch: true
12
5
  prepopulate_pr_head_ref: true
@@ -27,25 +20,15 @@ chat:
27
20
  - confirm <Z> actually happens
28
21
  description: |
29
22
  Verify a behaviour claim against a repo or PR and report whether the evidence
30
- confirms or refutes it. It installs and runs the code in the sandbox, captures
31
- bash/text evidence, optionally drives the UI in a real browser, then posts a
32
- single CONFIRMED / REFUTED / INCONCLUSIVE verdict. Does not modify code.
23
+ confirms or refutes it. Installs and runs the code in the sandbox, captures
24
+ evidence, and posts one CONFIRMED / REFUTED / INCONCLUSIVE verdict. Never
25
+ modifies code.
33
26
 
34
- Delivery is a single in-place status comment (`status_checklist`): the run
35
- shows its phases ticking off, then a final `synthesize` phase folds the text
36
- verdict and (when it ran) the browser evidence into ONE combined verdict,
37
- delivered as the comment's footer via `final_message`. No comment-per-phase.
38
- Posted on the originating issue/PR for GitHub runs, or into the Slack thread
39
- for Slack runs. The agents therefore do NOT post anything themselves.
40
-
41
- When the host runs the docker backend with the browser-QA image built, the
42
- gated `verify_browser` phase drives the UI in a real headless Chromium and
43
- captures screenshot evidence; everywhere else it is silently skipped (graceful
44
- degradation) and the text verdict stands alone. The synthesis runs either way.
45
-
46
- Triggered by:
47
- - a `@last-light verify <claim>` comment on an issue/PR
48
- - manual CLI: tsx src/cli.ts verify owner/repo#N -- "<claim>"
27
+ A final `synthesize` phase folds the text verdict and, when it ran, the
28
+ browser evidence into ONE verdict delivered as the status comment's footer —
29
+ no comment per phase, and the agents post nothing themselves. The browser
30
+ phase needs the docker backend and the browser-QA image; anywhere else it is
31
+ skipped and the text verdict stands alone.
49
32
 
50
33
  status_checklist: true
51
34
  final_message: "{{synthesisResult}}"
@@ -60,8 +43,6 @@ phases:
60
43
  label: Verify
61
44
  depends_on: [phase_0]
62
45
  prompt: prompts/verify.md
63
- # verify: the investigator procedure + report shape (primary).
64
- # building: install + run the repo to capture evidence.
65
46
  skills: [verify, building]
66
47
  model: "{{models.verify}}"
67
48
  variant: "{{variants.verify}}"
@@ -71,12 +52,6 @@ phases:
71
52
  on_success: "Text verification complete."
72
53
  on_failure: "I couldn't complete the verification — see the logs for details."
73
54
 
74
- # Browser-QA pass (Tier B). Gated to the docker backend AND the enriched
75
- # `lastlight-sandbox-qa:latest` image (Playwright + Chromium). On gondolin, or
76
- # a docker host without that image, the scheduler silently skips this phase.
77
- # It is terminal (nothing depends on it) — `synthesize` depends only on
78
- # `verify`, so it still runs (after this phase, by declaration order) and
79
- # folds in `verifyBrowserResult` only when this phase actually produced it.
80
55
  - name: verify_browser
81
56
  label: Verify (browser)
82
57
  depends_on: [verify]
@@ -92,11 +67,6 @@ phases:
92
67
  on_success: "Browser QA complete — screenshots captured."
93
68
  on_skipped_done: "Browser QA unavailable on this host — text verdict stands."
94
69
 
95
- # Synthesis. Depends only on `verify` (always runs after the gated browser
96
- # phase by declaration order, and never skips when that phase is gated out).
97
- # Reads the prior reports from phaseOutputs and writes ONE concise combined
98
- # verdict; its output (`synthesisResult`) becomes the comment footer via the
99
- # workflow-level `final_message`. Pure composition — no skills, no repo work.
100
70
  - name: synthesize
101
71
  label: Summary
102
72
  depends_on: [verify, verify_browser]