lastlight-core 0.26.0 → 0.28.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 (127) hide show
  1. package/config/default.yaml +302 -5
  2. package/dist/admin/docker.js.map +1 -1
  3. package/dist/admin/sessions.js.map +1 -1
  4. package/dist/admin/tail.js.map +1 -1
  5. package/dist/config/config.d.ts +18 -4
  6. package/dist/config/config.js +122 -9
  7. package/dist/config/config.js.map +1 -1
  8. package/dist/config/repo-config.js.map +1 -1
  9. package/dist/connectors/messaging/session-manager.js.map +1 -1
  10. package/dist/connectors/slack/connector.js.map +1 -1
  11. package/dist/cron/dependabot-discovery.js.map +1 -1
  12. package/dist/cron/review-discovery.js.map +1 -1
  13. package/dist/engine/agent-executor.d.ts +25 -1
  14. package/dist/engine/agent-executor.js +41 -1
  15. package/dist/engine/agent-executor.js.map +1 -1
  16. package/dist/engine/chat/chat-prompt.js.map +1 -1
  17. package/dist/engine/chat/chat-runner.js.map +1 -1
  18. package/dist/engine/dispatcher.js +17 -0
  19. package/dist/engine/dispatcher.js.map +1 -1
  20. package/dist/engine/event-shim.d.ts +18 -0
  21. package/dist/engine/event-shim.js +2 -0
  22. package/dist/engine/event-shim.js.map +1 -1
  23. package/dist/engine/executors/orchestrator.d.ts +92 -1
  24. package/dist/engine/executors/orchestrator.js +144 -46
  25. package/dist/engine/executors/orchestrator.js.map +1 -1
  26. package/dist/engine/executors/shared.js.map +1 -1
  27. package/dist/engine/fix-harvest.js.map +1 -1
  28. package/dist/engine/github/github.d.ts +59 -0
  29. package/dist/engine/github/github.js +72 -0
  30. package/dist/engine/github/github.js.map +1 -1
  31. package/dist/engine/github/installations.js.map +1 -1
  32. package/dist/engine/github/review-poster.d.ts +403 -9
  33. package/dist/engine/github/review-poster.js +619 -52
  34. package/dist/engine/github/review-poster.js.map +1 -1
  35. package/dist/engine/github/team-visibility.js.map +1 -1
  36. package/dist/engine/llm.js.map +1 -1
  37. package/dist/engine/pr-decisions.d.ts +85 -5
  38. package/dist/engine/pr-decisions.js +331 -5
  39. package/dist/engine/pr-decisions.js.map +1 -1
  40. package/dist/engine/pr-state.d.ts +82 -0
  41. package/dist/engine/pr-state.js +71 -1
  42. package/dist/engine/pr-state.js.map +1 -1
  43. package/dist/engine/review-spec.d.ts +264 -0
  44. package/dist/engine/review-spec.js +723 -0
  45. package/dist/engine/review-spec.js.map +1 -0
  46. package/dist/engine/router.js.map +1 -1
  47. package/dist/engine/screen/classifier.js.map +1 -1
  48. package/dist/engine/screen/screen.js.map +1 -1
  49. package/dist/evals-api.d.ts +3 -0
  50. package/dist/evals-api.js +20 -0
  51. package/dist/evals-api.js.map +1 -1
  52. package/dist/index.js +76 -11
  53. package/dist/index.js.map +1 -1
  54. package/dist/notify/digest-blocks.js.map +1 -1
  55. package/dist/notify/model.js.map +1 -1
  56. package/dist/notify/transports/github.js.map +1 -1
  57. package/dist/notify/transports/slack.js.map +1 -1
  58. package/dist/sandbox/artifact-backend.js.map +1 -1
  59. package/dist/sandbox/artifact-store.js.map +1 -1
  60. package/dist/sandbox/docker.d.ts +23 -4
  61. package/dist/sandbox/docker.js +1 -1
  62. package/dist/sandbox/docker.js.map +1 -1
  63. package/dist/sandbox/egress-allowlist.js.map +1 -1
  64. package/dist/sandbox/k8s/agent-context-registry.js.map +1 -1
  65. package/dist/sandbox/k8s/client.js.map +1 -1
  66. package/dist/sandbox/k8s/kubernetes-sandbox.js.map +1 -1
  67. package/dist/sandbox/k8s/resource-name.js.map +1 -1
  68. package/dist/sandbox/k8s/run-id.js.map +1 -1
  69. package/dist/sandbox/k8s/run-secrets.js.map +1 -1
  70. package/dist/sandbox/k8s/skill-bundle.js.map +1 -1
  71. package/dist/sandbox/k8s/workspace-provisioner.js +10 -2
  72. package/dist/sandbox/k8s/workspace-provisioner.js.map +1 -1
  73. package/dist/sandbox/sandbox.d.ts +20 -0
  74. package/dist/sandbox/sandbox.js +27 -6
  75. package/dist/sandbox/sandbox.js.map +1 -1
  76. package/dist/session-log.js.map +1 -1
  77. package/dist/state/approval-store.js.map +1 -1
  78. package/dist/state/build-assets.js.map +1 -1
  79. package/dist/state/cron-run-store.js.map +1 -1
  80. package/dist/state/data-migrate.d.ts +135 -0
  81. package/dist/state/data-migrate.js +309 -0
  82. package/dist/state/data-migrate.js.map +1 -0
  83. package/dist/state/db.d.ts +24 -3
  84. package/dist/state/db.js +41 -11
  85. package/dist/state/db.js.map +1 -1
  86. package/dist/state/execution-store.js.map +1 -1
  87. package/dist/state/feedback-store.js.map +1 -1
  88. package/dist/state/pg-client.d.ts +44 -0
  89. package/dist/state/pg-client.js +81 -0
  90. package/dist/state/pg-client.js.map +1 -0
  91. package/dist/state/schema/pg.d.ts +15 -15
  92. package/dist/state/schema/sqlite.d.ts +15 -15
  93. package/dist/state/state-cli.d.ts +8 -0
  94. package/dist/state/state-cli.js +247 -0
  95. package/dist/state/state-cli.js.map +1 -0
  96. package/dist/state/team-store.js.map +1 -1
  97. package/dist/state/user-store.js.map +1 -1
  98. package/dist/state/workflow-run-store.js.map +1 -1
  99. package/dist/telemetry/index.js.map +1 -1
  100. package/dist/workflows/handlers/fanout.d.ts +157 -0
  101. package/dist/workflows/handlers/fanout.js +663 -0
  102. package/dist/workflows/handlers/fanout.js.map +1 -0
  103. package/dist/workflows/handlers/post-review.d.ts +111 -10
  104. package/dist/workflows/handlers/post-review.js +531 -39
  105. package/dist/workflows/handlers/post-review.js.map +1 -1
  106. package/dist/workflows/runner.js +33 -0
  107. package/dist/workflows/runner.js.map +1 -1
  108. package/dist/workflows/simple.js.map +1 -1
  109. package/docker-compose.yml +50 -0
  110. package/package.json +22 -12
  111. package/sandbox.Dockerfile +54 -0
  112. package/skills/adjudicate-pass/SKILL.md +117 -0
  113. package/skills/code-review/SKILL.md +114 -15
  114. package/skills/pr-review/SKILL.md +113 -24
  115. package/skills/pr-review/references/findings-schema.md +38 -7
  116. package/skills/survey-pass/SKILL.md +148 -0
  117. package/workflows/pr-review.yaml +626 -0
  118. package/workflows/prompts/dependabot-pr-merge.md +22 -2
  119. package/workflows/prompts/review-adjudicate.md +340 -0
  120. package/workflows/prompts/review-falsify.md +167 -0
  121. package/workflows/prompts/review.md +80 -0
  122. package/workflows/prompts/survey-contract.md +121 -0
  123. package/workflows/prompts/survey-enforcement.md +137 -0
  124. package/workflows/prompts/survey-security.md +165 -0
  125. package/workflows/prompts/survey-spec.md +116 -0
  126. package/workflows/prompts/survey-state.md +151 -0
  127. package/workflows/prompts/survey-tests.md +99 -0
@@ -0,0 +1,151 @@
1
+ You are running **one pass** of a multi-pass code review. Read the `survey-pass`
2
+ skill for the workspace layout, the finding tiers and what is not a finding, then
3
+ follow this prompt — it carries YOUR family's question and wins wherever the two
4
+ differ.
5
+
6
+ Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{baseBranch}}`.
7
+
8
+ ## What this pass is, and what it is not
9
+
10
+ A deterministic layer has already analysed this diff and written **obligations** —
11
+ questions that each name BOTH ENDS of a possible defect mechanism: where
12
+ something is introduced, and where it would have to be enforced. Your job is to
13
+ DISCHARGE them, and to record what you found as hypotheses.
14
+
15
+ You are **not** the last word. A later phase runs probes against what you record,
16
+ and a stronger model adjudicates. Both of them can only REMOVE. Nothing
17
+ downstream can recover a mechanism you declined to write down.
18
+
19
+ So the instruction here is the opposite of the usual one: **over-produce**. A
20
+ plausible mechanism you cannot yet refute is a hypothesis, not noise. Do not
21
+ apply a confidence gate — you are not being scored on precision, and the
22
+ guardrail is elsewhere.
23
+
24
+ ## Hard limits on this pass
25
+
26
+ - **Do NOT post a review.** Do not call `github_create_pull_request_review` or any
27
+ other posting tool.
28
+ - **Do NOT write `.lastlight/pr-review/findings.json`.** A later phase owns it.
29
+ - **Do NOT read or write any other family's file.** Another pass owns each of the
30
+ others, and passes never reconcile — appending to disjoint files is what makes
31
+ a consensus collapse impossible by construction rather than by instruction.
32
+ - **Do NOT re-derive this PR's range with `git diff` or `git show`.** The
33
+ deterministic layer resolved the merge-base range once and staged it:
34
+ `.lastlight/pr-review/diff/index.md` lists every changed file with its status,
35
+ its changed line ranges and the per-file patch that holds its diff, all under
36
+ `.lastlight/pr-review/diff/`. Read those. The paths are relative to your
37
+ working directory — open them exactly as written and never join them onto an
38
+ absolute path. Re-deriving the range is how a two-dot diff creeps back in and
39
+ claims commits the author never wrote; if the index says NOT AVAILABLE, derive
40
+ it yourself as `git diff origin/{{baseBranch}}...HEAD`, three dots.
41
+
42
+ ## What you have: the whole checkout
43
+
44
+ You are sitting in the complete repository at head, not in a patch file. The
45
+ staged diff is your STARTING POINT, not your scope. Open the changed files
46
+ whole, read the code on either side of every hunk, grep for the callers and
47
+ references the patch never shows you, follow a changed symbol out into the files
48
+ this PR did not touch. That is the work, not a licence: **the defects worth
49
+ finding live in the code the diff touches but does not display.**
50
+
51
+ ## Your family: `state`
52
+
53
+ A changed symbol is used at sites the diff did not touch. The question is ordering, lifecycle, cache invalidation and concurrency at those sites.
54
+
55
+ **The axes you own: Edge cases, concurrency, and Regression risk over time.**
56
+ Empty and null inputs, boundaries, error paths, re-entrancy, retries, partial
57
+ failure — and, above all, what the code does on the SECOND call rather than the
58
+ first. An existing caller of a changed function whose behaviour ripples is
59
+ yours; so is a cache nobody invalidates and a guard that fires once.
60
+
61
+ The other axes belong to other passes. Do not spend this one on them.
62
+
63
+ Your obligations are **appended to the end of this prompt**, under the heading
64
+ `## Attached: the file this pass was seeded with`. The harness read them out of
65
+ the deterministic layer's output and attached them; they carry the discharge
66
+ contract and you must follow it exactly.
67
+
68
+ **Do not go looking for them on disk.** The attachment IS the delivery. Any
69
+ path you construct for it is a guess about a harness layout that varies by
70
+ backend, and earlier passes have lost their seed to exactly that guess.
71
+
72
+ Read the attachment before anything else. It can say three things and they are
73
+ three different facts:
74
+
75
+ - **Obligations.** Discharge every one, exactly as its contract says.
76
+ - **NOT MEASURED.** Record that and stop — do not substitute a judgement for a measurement.
77
+ - **NOT AVAILABLE**, or a path for you to open yourself. The harness could not attach the file; do exactly what the attachment then tells you to. Where it says the block was never delivered, that is **not** a clean result and it is not a finding about the code either — record it FIRST, then work the diff for this family's question directly and say plainly in your output that you did so unseeded.
78
+
79
+ Rank your attention by how much of the impact cone lies OUTSIDE the diff. A symbol with forty callers of which two were touched is a different risk from one with two callers of which two were touched, and the diff alone cannot tell them apart.
80
+
81
+ ## The questions an innocent quote cannot answer
82
+
83
+ Phrase every discharge so that a QUOTED LINE is the only honest answer and an
84
+ innocent quote is not available. "The line exists" is not a discharge: measured
85
+ on this pipeline's own runs, every never-matched real defect within reach of an
86
+ obligation was read, quoted, and signed off as fine. Ask what the quoted line
87
+ cannot tell apart, what runs before it, and what happens after it trips. The
88
+ recurring shapes for THIS family:
89
+
90
+ 1. **Hook / phase ordering.** "This route registers `<hook>` at `<line>`. Name
91
+ the framework's phase order, then quote the earliest line that rejects an
92
+ unauthenticated caller. List every check that runs before it."
93
+ 2. **Early return coverage.** "The changed function returns early at `<line>`.
94
+ List every statement between that return and the end of the function, and
95
+ quote the line that still runs them on the early path — or name the ones it
96
+ skips."
97
+ 3. **Guard vs natural terminal.** "This loop stops when `<counter> >= <CONST>`.
98
+ Quote the line that distinguishes *the source was exhausted* from *the cap
99
+ was hit*, or state that one line is true in both cases."
100
+ 4. **What happens after the guard trips.** "When `<guard>` trips, quote the
101
+ line that propagates it to the caller. If a partial result is returned and
102
+ the caller's success path is unchanged, quote the response line that reports
103
+ success on truncated data."
104
+ 5. **Concurrency × retry conjunction.** "This diff changes a parallelism
105
+ constant from `A` to `B`. Quote the line that bounds or retries the resource
106
+ the extra concurrency contends for. If that line was removed or weakened in
107
+ this same diff, quote both."
108
+ 6. **Partial-failure legibility.** "For a run where some items fail: quote the
109
+ line that makes it a non-2xx, or the line that carries the failed items into
110
+ the summary. If neither exists, quote the line that returns success with an
111
+ error count."
112
+ 7. **Cross-request lifetime.** "The changed symbol keeps state across requests.
113
+ Quote the line that invalidates it AND the line where its clock starts."
114
+ 8. **Staleness ceiling.** "This path skips a refresh or revalidation. Quote
115
+ the line that bounds how long the stale value stays accepted, or state that
116
+ nothing bounds it."
117
+ 9. **Two-path divergence.** "This branch selects between two data sources.
118
+ Quote the line proving both return the same set, or name the field on which
119
+ they differ."
120
+ 10. **Failure-path cleanup.** "On the error or early-return path, quote the
121
+ line that releases or invalidates what the success path would have consumed
122
+ — the lock, the reservation, the single-use credential — or state that the
123
+ failure path leaves it live."
124
+
125
+ ## State the residual risk, not the reassurance
126
+
127
+ A discharge that concludes "correctly handled", "properly ordered" or
128
+ "enforced" is a CLAIM, not a measurement — and its direction is the one thing
129
+ no downstream stage can flip. Before you write "correct", name the bar you
130
+ graded against: who or what can reach this code WITHOUT the check, and what
131
+ happens then. Two invariants can both be true of the same quoted line — "the
132
+ check runs before the handler" and "the check runs before any request-derived
133
+ value is read" are different bars — and this family's question is always the
134
+ strongest bar it cares about, never the weakest true statement. If you cannot
135
+ name the bar, record the mechanism with `needsProbe: true` and no verdict: the
136
+ probe and the adjudicator can remove a risk you wrote down, but they will never
137
+ see the one you graded away as fine.
138
+
139
+ ## Output
140
+
141
+ Append one JSON object per line to `.lastlight/pr-review/hypotheses/state.jsonl`,
142
+ in the shape the obligations file specifies. Create the file even if you have
143
+ nothing to record — write a single line with `"claim": "no state hypothesis"`
144
+ and the obligation ids you discharged, so that "surveyed and found nothing" and
145
+ "never ran" stay distinguishable.
146
+
147
+ The placeholder carries **no analysis**. The moment its details start quoting
148
+ lines and grading them — "X runs before Y, so the order is correct" — you are
149
+ writing a hypothesis with a verdict, and it must be recorded as one, bar named,
150
+ never folded into the no-hypothesis line where no probe and no adjudicator will
151
+ ever look at it.
@@ -0,0 +1,99 @@
1
+ You are running **one pass** of a multi-pass code review. Read the `survey-pass`
2
+ skill for the workspace layout, the finding tiers and what is not a finding, then
3
+ follow this prompt — it carries YOUR family's question and wins wherever the two
4
+ differ.
5
+
6
+ Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{baseBranch}}`.
7
+
8
+ ## What this pass is, and what it is not
9
+
10
+ A deterministic layer has already analysed this diff and written **obligations** —
11
+ questions that each name BOTH ENDS of a possible defect mechanism: where
12
+ something is introduced, and where it would have to be enforced. Your job is to
13
+ DISCHARGE them, and to record what you found as hypotheses.
14
+
15
+ You are **not** the last word. A later phase runs probes against what you record,
16
+ and a stronger model adjudicates. Both of them can only REMOVE. Nothing
17
+ downstream can recover a mechanism you declined to write down.
18
+
19
+ So the instruction here is the opposite of the usual one: **over-produce**. A
20
+ plausible mechanism you cannot yet refute is a hypothesis, not noise. Do not
21
+ apply a confidence gate — you are not being scored on precision, and the
22
+ guardrail is elsewhere.
23
+
24
+ ## Hard limits on this pass
25
+
26
+ - **Do NOT post a review.** Do not call `github_create_pull_request_review` or any
27
+ other posting tool.
28
+ - **Do NOT write `.lastlight/pr-review/findings.json`.** A later phase owns it.
29
+ - **Do NOT read or write any other family's file.** Another pass owns each of the
30
+ others, and passes never reconcile — appending to disjoint files is what makes
31
+ a consensus collapse impossible by construction rather than by instruction.
32
+ - **Do NOT re-derive this PR's range with `git diff` or `git show`.** The
33
+ deterministic layer resolved the merge-base range once and staged it:
34
+ `.lastlight/pr-review/diff/index.md` lists every changed file with its status,
35
+ its changed line ranges and the per-file patch that holds its diff, all under
36
+ `.lastlight/pr-review/diff/`. Read those. The paths are relative to your
37
+ working directory — open them exactly as written and never join them onto an
38
+ absolute path. Re-deriving the range is how a two-dot diff creeps back in and
39
+ claims commits the author never wrote; if the index says NOT AVAILABLE, derive
40
+ it yourself as `git diff origin/{{baseBranch}}...HEAD`, three dots.
41
+
42
+ ## What you have: the whole checkout
43
+
44
+ You are sitting in the complete repository at head, not in a patch file. The
45
+ staged diff is your STARTING POINT, not your scope. Open the changed files
46
+ whole, read the code on either side of every hunk, grep for the callers and
47
+ references the patch never shows you, follow a changed symbol out into the files
48
+ this PR did not touch. That is the work, not a licence: **the defects worth
49
+ finding live in the code the diff touches but does not display.**
50
+
51
+ ## Your family: `tests`
52
+
53
+ A changed line is executed by zero tests.
54
+
55
+ Your obligations are **appended to the end of this prompt**, under the heading
56
+ `## Attached: the file this pass was seeded with`. The harness read them out of
57
+ the deterministic layer's output and attached them; they carry the discharge
58
+ contract and you must follow it exactly.
59
+
60
+ **Do not go looking for them on disk.** The attachment IS the delivery. Any
61
+ path you construct for it is a guess about a harness layout that varies by
62
+ backend, and earlier passes have lost their seed to exactly that guess.
63
+
64
+ Read the attachment before anything else. It can say three things and they are
65
+ three different facts:
66
+
67
+ - **Obligations.** Discharge every one, exactly as its contract says.
68
+ - **NOT MEASURED.** Record that and stop — do not substitute a judgement for a measurement.
69
+ - **NOT AVAILABLE**, or a path for you to open yourself. The harness could not attach the file; do exactly what the attachment then tells you to. Where it says the block was never delivered, that is **not** a clean result and it is not a finding about the code either — record it FIRST, then work the diff for this family's question directly and say plainly in your output that you did so unseeded.
70
+
71
+ This family reads a coverage report. If your block says NOT MEASURED, that is the answer: record it as `notMeasured` and stop. Do not substitute a judgement about whether the code LOOKS tested — an absence you were never in a position to observe is the one thing this pipeline exists to stop reporting.
72
+
73
+ ## State the residual risk, not the reassurance
74
+
75
+ A discharge that concludes "correctly handled", "properly ordered" or
76
+ "enforced" is a CLAIM, not a measurement — and its direction is the one thing
77
+ no downstream stage can flip. Before you write "correct", name the bar you
78
+ graded against: who or what can reach this code WITHOUT the check, and what
79
+ happens then. Two invariants can both be true of the same quoted line — "the
80
+ check runs before the handler" and "the check runs before any request-derived
81
+ value is read" are different bars — and this family's question is always the
82
+ strongest bar it cares about, never the weakest true statement. If you cannot
83
+ name the bar, record the mechanism with `needsProbe: true` and no verdict: the
84
+ probe and the adjudicator can remove a risk you wrote down, but they will never
85
+ see the one you graded away as fine.
86
+
87
+ ## Output
88
+
89
+ Append one JSON object per line to `.lastlight/pr-review/hypotheses/tests.jsonl`,
90
+ in the shape the obligations file specifies. Create the file even if you have
91
+ nothing to record — write a single line with `"claim": "no tests hypothesis"`
92
+ and the obligation ids you discharged, so that "surveyed and found nothing" and
93
+ "never ran" stay distinguishable.
94
+
95
+ The placeholder carries **no analysis**. The moment its details start quoting
96
+ lines and grading them — "X runs before Y, so the order is correct" — you are
97
+ writing a hypothesis with a verdict, and it must be recorded as one, bar named,
98
+ never folded into the no-hypothesis line where no probe and no adjudicator will
99
+ ever look at it.