lastlight-core 0.33.2 → 0.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/config/default.yaml +137 -48
  2. package/dist/admin/routes.js +3 -0
  3. package/dist/admin/routes.js.map +1 -1
  4. package/dist/config/config.d.ts +1 -1
  5. package/dist/config/config.js +45 -29
  6. package/dist/config/config.js.map +1 -1
  7. package/dist/engine/event-shim.d.ts +22 -0
  8. package/dist/engine/event-shim.js +98 -0
  9. package/dist/engine/event-shim.js.map +1 -1
  10. package/dist/engine/executors/orchestrator.d.ts +13 -0
  11. package/dist/engine/executors/orchestrator.js +42 -3
  12. package/dist/engine/executors/orchestrator.js.map +1 -1
  13. package/dist/engine/github/review-poster.d.ts +249 -40
  14. package/dist/engine/github/review-poster.js +332 -54
  15. package/dist/engine/github/review-poster.js.map +1 -1
  16. package/dist/engine/github/review-summary.d.ts +61 -0
  17. package/dist/engine/github/review-summary.js +101 -0
  18. package/dist/engine/github/review-summary.js.map +1 -0
  19. package/dist/engine/pr-decisions.d.ts +16 -0
  20. package/dist/engine/pr-decisions.js +127 -11
  21. package/dist/engine/pr-decisions.js.map +1 -1
  22. package/dist/engine/review-spec.d.ts +1 -1
  23. package/dist/engine/review-spec.js +69 -38
  24. package/dist/engine/review-spec.js.map +1 -1
  25. package/dist/sandbox/docker.d.ts +8 -0
  26. package/dist/sandbox/docker.js +31 -0
  27. package/dist/sandbox/docker.js.map +1 -1
  28. package/dist/sandbox/k8s/kubernetes-sandbox.d.ts +5 -0
  29. package/dist/sandbox/k8s/kubernetes-sandbox.js +46 -2
  30. package/dist/sandbox/k8s/kubernetes-sandbox.js.map +1 -1
  31. package/dist/sandbox/k8s/run-agent-script.d.ts +3 -1
  32. package/dist/sandbox/k8s/run-agent-script.js +10 -2
  33. package/dist/sandbox/k8s/run-agent-script.js.map +1 -1
  34. package/dist/sandbox/resource-usage.d.ts +64 -0
  35. package/dist/sandbox/resource-usage.js +115 -0
  36. package/dist/sandbox/resource-usage.js.map +1 -0
  37. package/dist/sandbox/sandbox.d.ts +20 -0
  38. package/dist/sandbox/sandbox.js +22 -0
  39. package/dist/sandbox/sandbox.js.map +1 -1
  40. package/dist/sandbox/smol.js +6 -0
  41. package/dist/sandbox/smol.js.map +1 -1
  42. package/dist/session-log.js +4 -0
  43. package/dist/session-log.js.map +1 -1
  44. package/dist/state/execution-store.d.ts +33 -1
  45. package/dist/state/execution-store.js +54 -12
  46. package/dist/state/execution-store.js.map +1 -1
  47. package/dist/state/schema/pg.d.ts +51 -0
  48. package/dist/state/schema/pg.js +7 -1
  49. package/dist/state/schema/pg.js.map +1 -1
  50. package/dist/state/schema/sqlite.d.ts +51 -0
  51. package/dist/state/schema/sqlite.js +6 -0
  52. package/dist/state/schema/sqlite.js.map +1 -1
  53. package/dist/state/workflow-run-store.d.ts +5 -2
  54. package/dist/state/workflow-run-store.js +10 -4
  55. package/dist/state/workflow-run-store.js.map +1 -1
  56. package/dist/telemetry/openinference.d.ts +13 -0
  57. package/dist/telemetry/openinference.js +13 -0
  58. package/dist/telemetry/openinference.js.map +1 -1
  59. package/dist/telemetry/pi-events.js +16 -1
  60. package/dist/telemetry/pi-events.js.map +1 -1
  61. package/dist/workflows/handlers/fanout.d.ts +54 -7
  62. package/dist/workflows/handlers/fanout.js +197 -21
  63. package/dist/workflows/handlers/fanout.js.map +1 -1
  64. package/dist/workflows/handlers/post-review.d.ts +17 -0
  65. package/dist/workflows/handlers/post-review.js +137 -50
  66. package/dist/workflows/handlers/post-review.js.map +1 -1
  67. package/dist/workflows/runner.js +1 -1
  68. package/dist/workflows/runner.js.map +1 -1
  69. package/drizzle/pg/0002_luxuriant_screwball.sql +3 -0
  70. package/drizzle/pg/meta/0002_snapshot.json +1894 -0
  71. package/drizzle/pg/meta/_journal.json +7 -0
  72. package/drizzle/sqlite/0003_first_namorita.sql +3 -0
  73. package/drizzle/sqlite/meta/0003_snapshot.json +1725 -0
  74. package/drizzle/sqlite/meta/_journal.json +7 -0
  75. package/package.json +5 -5
  76. package/skills/adjudicate-pass/SKILL.md +24 -20
  77. package/skills/pr-review/SKILL.md +3 -2
  78. package/skills/pr-review/references/findings-schema.md +1 -1
  79. package/skills/survey-pass/SKILL.md +121 -130
  80. package/workflows/pr-review.yaml +210 -7
  81. package/workflows/prompts/review-adjudicate.md +413 -264
  82. package/workflows/prompts/review-falsify.md +185 -44
  83. package/workflows/prompts/review.md +10 -10
  84. package/workflows/prompts/survey-contract.md +48 -48
  85. package/workflows/prompts/survey-enforcement.md +102 -134
  86. package/workflows/prompts/survey-security.md +53 -56
  87. package/workflows/prompts/survey-spec.md +52 -37
  88. package/workflows/prompts/survey-state.md +54 -53
  89. package/workflows/prompts/survey-tests.md +48 -48
@@ -7,46 +7,31 @@ Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{bas
7
7
 
8
8
  ## What this pass is, and what it is not
9
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.
10
+ A deterministic layer analysed this diff and wrote **obligations** — questions that each name BOTH ENDS of a possible defect mechanism: where something is introduced, and where it would have to be enforced. Discharge them, and record what you found as hypotheses.
14
11
 
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.
12
+ > **Nothing downstream can recover a mechanism you declined to write down.**
18
13
 
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.
14
+ So: **over-produce** — see the `survey-pass` skill for why the precision gate does not fire on you.
23
15
 
24
16
  ## Hard limits on this pass
25
17
 
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.
18
+ | do NOT | why |
19
+ |---|---|
20
+ | **Do NOT read or write any other family's file** | another pass owns each; appending to disjoint files makes a consensus collapse impossible **by construction**, not by instruction |
21
+ | **Do NOT re-derive this PR's range with `git diff` or `git show`.** | it is already staged — see below |
22
+
23
+ **The range is already resolved.** `.lastlight/pr-review/diff/index.md` lists every changed file with its status, its changed line ranges, and the per-file patch under `.lastlight/pr-review/diff/`. Read those. Paths are relative to your working directory — open them exactly as written, never joined onto an absolute path.
24
+
25
+ If the index says NOT AVAILABLE, derive it yourself as `git diff origin/{{baseBranch}}...HEAD` — **three dots**.
26
+
27
+ <!-- Re-deriving is how a two-dot diff creeps back in and claims commits the
28
+ author never wrote. -->
41
29
 
42
30
  ## What you have: the whole checkout
43
31
 
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.**
32
+ The staged diff is your STARTING POINT, not your scope: open the changed files whole, grep for the callers the patch never shows you, and follow a changed symbol out into files this PR did not touch.
33
+
34
+ **The defects worth finding live in the code the diff touches but does not display.**
50
35
 
51
36
  ## Your family: `state`
52
37
 
@@ -69,23 +54,27 @@ contract and you must follow it exactly.
69
54
  path you construct for it is a guess about a harness layout that varies by
70
55
  backend, and earlier passes have lost their seed to exactly that guess.
71
56
 
72
- Read the attachment before anything else. It can say three things and they are
73
- three different facts:
57
+ Read the attachment before anything else. It says one of these, and they are different facts:
74
58
 
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.
59
+ | it says | you do |
60
+ |---|---|
61
+ | **obligations** | discharge every one, exactly as its contract says |
62
+ | **NOT MEASURED**, or **no obligations could be built** | make that your FIRST row, then work the diff for this family's question yourself. It is not a result and not a licence to stop: a pass that writes only that row surveyed nothing, and the gate fails it |
63
+ | **NOT AVAILABLE** (or a path to open yourself) | do exactly what it tells you to |
64
+
65
+ A block that was never delivered is **not** a clean result, and 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
66
 
79
67
  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
68
 
81
69
  ## The questions an innocent quote cannot answer
82
70
 
83
71
  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:
72
+ innocent quote is not available. **"The line exists" is not a discharge.** Ask what the quoted line cannot tell apart, what runs before it, and what happens after it trips.
73
+
74
+ <!-- Every never-matched real defect within reach of an obligation was read,
75
+ quoted, and signed off as fine. -->
76
+
77
+ The recurring shapes for THIS family:
89
78
 
90
79
  1. **Hook / phase ordering.** "This route registers `<hook>` at `<line>`. Name
91
80
  the framework's phase order, then quote the earliest line that rejects an
@@ -122,19 +111,31 @@ recurring shapes for THIS family:
122
111
  — the lock, the reservation, the single-use credential — or state that the
123
112
  failure path leaves it live."
124
113
 
114
+
115
+ ## What closes the mechanism, for `state`
116
+
117
+ The `survey-pass` skill's evidence record is shared by every pass; `control_site` is the
118
+ only field whose meaning is yours to fix. For this family the control is an **invalidation, guard or ordering constraint** — the line that resets the entry, releases the lock, or makes the second call behave like the first. Ask what runs on the SECOND call, not the first.
119
+
120
+ **Every row carries an `evidence` object**, in the shape the `survey-pass` skill defines. It is
121
+ how the verdict is computed, and a row without one cannot be ranked by anything — it falls back
122
+ to a guess. Add it to every row you write.
123
+
124
+ **You do not write `severity` or `needsProbe`.** If the attached block's example row shows them,
125
+ ignore those two fields: they are derived from your evidence, not chosen by you. Everything else
126
+ the attachment prescribes still applies.
127
+
128
+ Worked example — invented, for SHAPE only, showing the fields this family fills:
129
+
130
+ ```json
131
+ {"id": "state-001", "obligation": "O-001", "family": "state", "evidence": {"subject": "rosterCache", "control_site": "none", "control_text": "", "authority": "unknown", "order_ok": "unknown", "cannot_distinguish": "nothing", "bypass": "none found", "in_changed_hunk": true, "consequence": "the second request after a member is removed still reads the cached roster; nothing clears it and no TTL bounds it", "trigger": "state", "crosses_boundary": false, "capability_gained": null}, "claim": "nothing invalidates the roster cache when membership changes, so the second call serves a removed member"}
132
+ ```
133
+
125
134
  ## State the residual risk, not the reassurance
126
135
 
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.
136
+ The `survey-pass` skill carries this rule and its examples. The family-specific half: your bar is what the quoted line **cannot tell apart**, not that the line exists.
137
+
138
+ Name that bar before you write "correct". In a changed hunk, the falsifiable risk goes in `claim` with `needsProbe: true`.
138
139
 
139
140
  ## Output
140
141
 
@@ -7,46 +7,31 @@ Reviewing **{{owner}}/{{repo}}#{{prNumber}}**, head `{{headSha}}` against `{{bas
7
7
 
8
8
  ## What this pass is, and what it is not
9
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.
10
+ A deterministic layer analysed this diff and wrote **obligations** — questions that each name BOTH ENDS of a possible defect mechanism: where something is introduced, and where it would have to be enforced. Discharge them, and record what you found as hypotheses.
14
11
 
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.
12
+ > **Nothing downstream can recover a mechanism you declined to write down.**
18
13
 
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.
14
+ So: **over-produce** — see the `survey-pass` skill for why the precision gate does not fire on you.
23
15
 
24
16
  ## Hard limits on this pass
25
17
 
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.
18
+ | do NOT | why |
19
+ |---|---|
20
+ | **Do NOT read or write any other family's file** | another pass owns each; appending to disjoint files makes a consensus collapse impossible **by construction**, not by instruction |
21
+ | **Do NOT re-derive this PR's range with `git diff` or `git show`.** | it is already staged — see below |
22
+
23
+ **The range is already resolved.** `.lastlight/pr-review/diff/index.md` lists every changed file with its status, its changed line ranges, and the per-file patch under `.lastlight/pr-review/diff/`. Read those. Paths are relative to your working directory — open them exactly as written, never joined onto an absolute path.
24
+
25
+ If the index says NOT AVAILABLE, derive it yourself as `git diff origin/{{baseBranch}}...HEAD` — **three dots**.
26
+
27
+ <!-- Re-deriving is how a two-dot diff creeps back in and claims commits the
28
+ author never wrote. -->
41
29
 
42
30
  ## What you have: the whole checkout
43
31
 
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.**
32
+ The staged diff is your STARTING POINT, not your scope: open the changed files whole, grep for the callers the patch never shows you, and follow a changed symbol out into files this PR did not touch.
33
+
34
+ **The defects worth finding live in the code the diff touches but does not display.**
50
35
 
51
36
  ## Your family: `tests`
52
37
 
@@ -61,28 +46,43 @@ contract and you must follow it exactly.
61
46
  path you construct for it is a guess about a harness layout that varies by
62
47
  backend, and earlier passes have lost their seed to exactly that guess.
63
48
 
64
- Read the attachment before anything else. It can say three things and they are
65
- three different facts:
49
+ Read the attachment before anything else. It says one of three things, and they are three different facts:
66
50
 
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.
51
+ | it says | you do |
52
+ |---|---|
53
+ | **obligations** | discharge every one, exactly as its contract says |
54
+ | **NOT MEASURED** | record that and stop — do not substitute a judgement for a measurement |
55
+ | **NOT AVAILABLE** (or a path to open yourself) | do exactly what it tells you to |
56
+
57
+ A block that was never delivered is **not** a clean result, and 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
58
 
71
59
  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
60
 
61
+
62
+ ## What closes the mechanism, for `tests`
63
+
64
+ The `survey-pass` skill's evidence record is shared by every pass; `control_site` is the
65
+ only field whose meaning is yours to fix. For this family the control is an **assertion that would fail if the behaviour changed** — the line that checks the result. A test that exercises a path without asserting on it closes nothing.
66
+
67
+ **Every row carries an `evidence` object**, in the shape the `survey-pass` skill defines. It is
68
+ how the verdict is computed, and a row without one cannot be ranked by anything — it falls back
69
+ to a guess. Add it to every row you write.
70
+
71
+ **You do not write `severity` or `needsProbe`.** If the attached block's example row shows them,
72
+ ignore those two fields: they are derived from your evidence, not chosen by you. Everything else
73
+ the attachment prescribes still applies.
74
+
75
+ Worked example — invented, for SHAPE only, showing the fields this family fills:
76
+
77
+ ```json
78
+ {"id": "tests-001", "obligation": "O-001", "family": "tests", "evidence": {"subject": "retryWithBackoff()", "control_site": "none", "control_text": "", "authority": "unknown", "order_ok": "unknown", "cannot_distinguish": "nothing", "bypass": "none found", "in_changed_hunk": true, "consequence": "the changed backoff arithmetic is executed by no test, so an off-by-one in the delay ships unnoticed", "trigger": "code_change", "crosses_boundary": false, "capability_gained": null}, "claim": "the changed lines run in no test; the suite exercises the caller but asserts nothing about the delay"}
79
+ ```
80
+
73
81
  ## State the residual risk, not the reassurance
74
82
 
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.
83
+ The `survey-pass` skill carries this rule and its examples. The family-specific half: your bar is what the test **would still pass with broken**, not that a test is present.
84
+
85
+ Name that bar before you write "correct". In a changed hunk, the falsifiable risk goes in `claim` with `needsProbe: true`.
86
86
 
87
87
  ## Output
88
88