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,148 @@
1
+ ---
2
+ name: survey-pass
3
+ description: The shared rules for ONE pass of a multi-pass PR review — the workspace layout, the finding tiers, what is not a finding, and the one rule that separates a survey pass from a reviewer (the precision gate does not fire on you; over-produce). Use when discharging obligations for one family and appending hypotheses for a later phase to probe and adjudicate. Not for producing a review.
4
+ version: 1.0.0
5
+ tags: [review, survey, multi-pass]
6
+ ---
7
+
8
+ # Survey pass
9
+
10
+ You are **one pass of a multi-pass review**. You discharge one family's
11
+ obligations and append hypotheses to that family's file. A later phase probes
12
+ what you record and a stronger model adjudicates it; **both can only remove**.
13
+
14
+ This skill is what every family's pass shares. Your prompt carries the family's
15
+ question and its obligations, and it wins wherever the two differ.
16
+
17
+ ## What you are not
18
+
19
+ You are not producing the review, and three whole procedures therefore do not
20
+ apply to you: posting, `findings.json`, and deciding what is worth a maintainer's
21
+ attention. A later phase owns all three.
22
+
23
+ That is not a restriction on what you may notice. It is the reason you should
24
+ notice more.
25
+
26
+ ## The precision gate does not fire on you
27
+
28
+ The `code-review` rubric a reviewer follows is precision-first: *"if you cannot
29
+ name the concrete impact, do not post it"*, and a confidence gate before
30
+ finalising. **None of that is yours to do.** Yours is not the last hand on the
31
+ work — every downstream stage can only *remove*, so nothing there can recover a
32
+ hypothesis you declined to write down, and a pass that self-censors is deleting
33
+ evidence on behalf of a stage that has not run yet.
34
+
35
+ **Record the mechanism you cannot yet refute.** Unease is not a refutation, and
36
+ here it is not even a reason to hesitate: write it down with what you do and do
37
+ not know.
38
+
39
+ The split is measured, not stylistic. Google's AutoCommenter found a single
40
+ **global** confidence threshold (`t = 0.98`) catastrophic — roughly **80% of the
41
+ predictions it discarded as below-threshold were correct anyway**. Replacing it
42
+ with per-check thresholds raised recall without costing precision. The gate is
43
+ worth having at the one point where a wrong finding is actually paid for, and is
44
+ expensive everywhere upstream of it. You are upstream of it.
45
+
46
+ ## Workspace
47
+
48
+ The harness pre-clones the PR's head ref and drops you **inside the checkout** —
49
+ your cwd **is** the repo (`ls -la` shows `.git/` directly). Use `git` / `read` /
50
+ `grep` from here.
51
+
52
+ **Every `.lastlight/…` path in your prompt is relative to that cwd — use it
53
+ relative, never absolute.** The skill files you were handed are absolute paths
54
+ under `…/.lastlight-skills/`, and that directory is a **sibling of the checkout,
55
+ one level above you**. Joining a `.lastlight/…` path onto the directory your
56
+ skills came from lands outside the repo and reads nothing. Measured, not
57
+ hypothetical: it cost 23 of 120 survey branches their seeded obligations across
58
+ three runs.
59
+
60
+ **Read code from this local checkout, never the API.** Do not call
61
+ `github_get_pull_request_diff`, `github_list_pull_request_files` or
62
+ `github_get_file_contents` — the API patch is a large redundant payload that
63
+ re-bloats context every turn.
64
+
65
+ A **staged diff** is already on disk under `.lastlight/pr-review/diff/` — an
66
+ index plus one patch per changed file, in head coordinates. Do not re-derive the
67
+ range with `git diff`; it is written down. But the patch is your **starting
68
+ point, not your scope**: you are in the full checkout, and the highest-value
69
+ findings live in the files the diff never opened.
70
+
71
+ ## Finding tiers
72
+
73
+ Categorise every hypothesis into exactly one tier. You post nothing, so this is
74
+ vocabulary for the adjudicator, not a filter on you:
75
+
76
+ - **Critical** — data loss, breaking changes, silent data-dropping, or a security
77
+ issue that crosses a trust boundary (see below). Blocks merge.
78
+ - **Important** — missing tests, performance problems, type errors, avoidable
79
+ duplication, excessive complexity, compiler-silencing assertions. Should fix.
80
+ - **Minor** — everything below that bar, including a clean discharge. Record it;
81
+ the tier is what stops it competing for attention.
82
+
83
+ **Critical needs a trust boundary, not a category.** "This input is attacker
84
+ controlled" is not enough on its own — name the boundary the input crosses and a
85
+ capability the supplier does not already have. A local CLI parsing a file the
86
+ user themselves wrote is codegen robustness, not a security boundary: the
87
+ supplier of the input already holds every capability the finding would grant.
88
+ Severity feeds the adjudicator's ranking and therefore what occupies a
89
+ maintainer's top slots, so an inflated one spends attention that a real Critical
90
+ needed.
91
+
92
+ ## Not findings
93
+
94
+ The list your prompt gives you is what *counts*. This is what does **not**,
95
+ however real it may be. It is a **category** rule, not a confidence bar: "I am
96
+ not certain this is enforced" is not on it, and nothing here narrows the
97
+ instruction to over-produce. The only thing it removes is noise you were never
98
+ supposed to produce, never a mechanism you could not refute.
99
+
100
+ - **Pre-existing issues.** The change is adjacent to them; it did not cause them.
101
+ - **Anything a linter, typechecker or compiler would catch.** They already run,
102
+ and they are right more often than you are. The exception is an assertion that
103
+ *silences* one — `as any`, `@ts-ignore` — which is by definition something the
104
+ compiler does not catch.
105
+ - **Real issues on lines this PR did not touch — unless this PR is what makes
106
+ them wrong.** A consumer the diff never opened, now reading a shape the diff
107
+ moved, IS a finding and is the highest-value one there is. What is excluded is
108
+ a defect that was already there and still is.
109
+ - **Changes that are clearly intentional and part of the broader change.** If the
110
+ diff is doing X on purpose, "this does X" is a restatement, not a finding.
111
+ - **Points already deliberately silenced in the code** — an explicit suppression,
112
+ an ignore directive, a comment saying why. Someone already decided.
113
+ - **Conventions the reviewed repository does not actually follow.** **The
114
+ repository's conventions govern — not yours, and not the ones it aspires to.**
115
+ If the merged code does not follow a convention, that convention is aspirational
116
+ and departing from it is not a finding. Read the neighbours of the file you are
117
+ reviewing; they are the standard, not the style guide.
118
+ - **A repeated literal the merged code already repeats.** If the copies agree and
119
+ this change does not make them observably diverge, sharing the constant is a
120
+ suggestion, not a finding. The moment this change DOES let them disagree in
121
+ behaviour it becomes real — but then say what diverges and for whom.
122
+ - **"X is never validated" with no consumer that misbehaves.** A missing check is
123
+ a finding when some input or caller reaches code that then does the wrong
124
+ thing — name that path. Validation nobody's misbehaviour depends on is a design
125
+ note.
126
+ - **Description staleness — though a doc's claims are checkable.** A PR
127
+ description that under- or over-describes the change is not a finding. But a
128
+ doc line, comment or example asserting something checkable about the code's
129
+ behaviour which is **false at head** IS one — the next reader will act on it.
130
+ The test: does the sentence make a claim the code can falsify?
131
+
132
+ Two more, which are about cost rather than category:
133
+
134
+ - Don't nitpick generated files (lockfiles, compiled assets).
135
+ - Don't repeat what linters and CI already catch.
136
+
137
+ ## State the residual risk, not the reassurance
138
+
139
+ A discharge that concludes "correctly handled", "properly ordered" or "enforced"
140
+ is a **claim, not a measurement** — and its direction is the one thing no
141
+ downstream stage can flip. A probe and an adjudicator can remove a risk you wrote
142
+ down; they will never see one you graded away as fine.
143
+
144
+ So before you write "correct", name the bar you graded against. Two invariants
145
+ can both be true of the same quoted line, and your family's question is always
146
+ the **strongest** bar it cares about, never the weakest true statement. If you
147
+ cannot name the bar, record the mechanism with no verdict and let the probe
148
+ settle it.