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
@@ -39,6 +39,8 @@ models:
39
39
  # diagnose: anthropic/claude-haiku-4-5-20251001 # the CI-failure classifier
40
40
  # pr-fix-retry: anthropic/claude-opus-4-8 # used above fix.escalateModelAfterAttempt
41
41
  # review-adjudicate: anthropic/claude-sonnet-4-6 # the adjudication pass
42
+ # review-summary: openai/gpt-5.4-mini # post-review's summary, written after the caps
43
+ # review-falsify: anthropic/claude-haiku-4-5-20251001 # the probe oracle
42
44
  # A per-task entry wins over `default`. `classifier`/`screener` are the cheap
43
45
  # one-shot helpers (src/engine/llm.ts); when unset they fall back to the first
44
46
  # configured provider's fast model, NOT `default`.
@@ -53,8 +55,8 @@ models:
53
55
  #
54
56
  # `review-survey` is SET above, and it is the one entry in this block that is
55
57
  # not an example. It is the key the five survey branches of `pr-review.yaml`
56
- # declare (`model: "{{models.review-survey}}"`, one per obligation family)
57
- # and, since it has no key of its own, the `falsify` phase too — six phases.
58
+ # declare (`model: "{{models.review-survey}}"`, one per obligation family),
59
+ # and the `falsify` phase's fall-through.
58
60
  #
59
61
  # Pinning it to Haiku 4.5 is NOT a cost downgrade, and that is the unusual
60
62
  # part: on review RECALL, Haiku 4.5 BEATS Sonnet 4.6 on two independent evals
@@ -79,6 +81,15 @@ models:
79
81
  # `config.yaml` (a cheap, fast model of its own provider), exactly as it
80
82
  # already overrides `models.default`.
81
83
  #
84
+ # `review-falsify` is the ORACLE's own key — the one phase that runs code.
85
+ # Unset, it falls through to `review-survey` (its template is the same
86
+ # `{{#if}}` pair `adjudicate` uses, so an unset key lands on the survey model
87
+ # and not on `default`), which is exactly the behaviour before the key
88
+ # existed. It exists so the oracle's model can be moved on its own: it was
89
+ # hard-wired to `review-survey`, so asking "is a cheap model good enough at
90
+ # WRITING AND RUNNING a probe?" meant moving all five survey branches too —
91
+ # two variables, and therefore not a runnable experiment.
92
+ #
82
93
  # `review-adjudicate` is the adjudicate phase's own key in `pr-review.yaml` —
83
94
  # the RANKING pass over what the surveys found, a different task from survey
84
95
  # discovery, so it can be moved independently of `models.review`. Unset, it
@@ -524,6 +535,51 @@ review:
524
535
  # telemetry (and the clean-discharge demotion it enables at the posting
525
536
  # boundary), at the cost of the verification-report volume above.
526
537
  obligationContract: minimal
538
+ # What `adjudicate` is handed, and what shape it writes back (#399).
539
+ #
540
+ # legacy — the shipped phase. The prompt names the files and the model
541
+ # shells out to assemble them, then writes a `tier` and a
542
+ # `confidence` per finding.
543
+ # dossier — a deterministic `dossier` phase renders every record the
544
+ # phase needs and the harness attaches it, and the model writes
545
+ # typed attributes (`claim` / `category` / `fix`) from which a
546
+ # pure function derives the tier. `confidence` is not asked for.
547
+ #
548
+ # ONE key for both halves deliberately: they move the same phase's measured
549
+ # surface — its input and its output — so shipping them together costs one
550
+ # comparability break with the archive instead of two, and one arm validates
551
+ # both.
552
+ #
553
+ # What it targets, measured on the 8-case probes arm: adjudicate spends 137
554
+ # bash calls across 8 adjudications (35 turns, 30 of them bash on the stress
555
+ # case) re-deriving records the harness already holds — about a third of
556
+ # case cost — and makes its actual judgement at the end of that transcript.
557
+ #
558
+ # jev — implies `dossier` (same rendering, same typed output) and
559
+ # additionally runs `jev-classify`: one TypeSafe `systemOne`
560
+ # call PER HYPOTHESIS (not per finding — hypotheses vastly
561
+ # outnumber findings, and per-hypothesis is the volume a
562
+ # System-1 primitive is for), asking only the category axis
563
+ # measured at AUC 0.897 (never correctness, measured dead at
564
+ # AUC 0.534). Its category is rendered into the dossier as an
565
+ # ADVISORY line — Sonnet still writes every disposition
566
+ # itself. Measured 2026-09-22: 260 hypotheses / 8 cases,
567
+ # 83.6% agreement with Sonnet's own call on identical
568
+ # evidence, $0.0053. Weakest on the rarest, highest-stakes
569
+ # categories (`defect` 33%, `correctness-risk` 40% recall
570
+ # against Sonnet) — that is why it annotates rather than
571
+ # decides. Needs `TYPESAFE_KEY` (or `TYPESAFE_API_KEY`); its
572
+ # absence degrades the phase to "no annotation", never a
573
+ # failed run.
574
+ #
575
+ # `legacy` until an arm has run for each. An unrecognised value lands there
576
+ # too.
577
+ adjudicate: legacy
578
+ # The TypeSafe model `jev-classify` calls, under `adjudicate: "jev"`.
579
+ # `null` = the CLI's own default (`TYPESAFE_MODEL` env, else `jev-latest`).
580
+ # Kept out of the `models:` map above — TypeSafe is a distinct provider
581
+ # from the `provider/model` chat models that map resolves.
582
+ jevModel: null
527
583
 
528
584
  # Which D2 minting rules `lastlight-facts seed` runs beyond the original
529
585
  # four. A comma-list; the valid tokens are `all-in-diff` (contract
@@ -567,27 +623,51 @@ review:
567
623
 
568
624
  # ── WP4: `prepare` (the affordance) + `falsify` (the oracle) ──────────────
569
625
  #
570
- # A SECOND switch under an already-gated block, and deliberately so. What
571
- # `probes: true` buys is a review workspace with a `node_modules` in it, and
572
- # that one fact changes three things at once:
626
+ # A SECOND switch under an already-gated block, and TRI-STATE — the middle
627
+ # value is the point of it.
573
628
  #
574
- # - `contract` can seed at all on a normal monorepo. A tsconfig that
575
- # `extends` a bare package specifier (`@calcom/tsconfig/react-library`)
576
- # does not resolve on a bare checkout, tsgo excludes the project, and the
577
- # case drops to tier 2 with `contracts` emitting nothing. Measured over
578
- # the 50-PR corpus: tier-1 cases 21 -> 5, contract deltas 73 -> 19.
579
- # - `tests` can seed at all. The `coverage` extractor READS a report and
580
- # never runs a suite; it found ZERO artifacts across all 50 corpus cases
581
- # and all 8 gate cases. Until `probeCoverage` produces one, that family
582
- # is NOT MEASURED — a different row from "did not convert".
583
- # - the `facts` phase inherits an installed tree, on every re-review too
584
- # (the cross-run refresh is `git clean -fdx -e node_modules`). Peak RSS
585
- # there is UNMEASURED on the current engine.
629
+ # "off" — neither `prepare` nor `falsify` runs. Reproduces WP3 exactly,
630
+ # and it is the shipped posture: the whole pipeline is off out
631
+ # of the box (LD8).
632
+ # "static" — both phases run and NOTHING IS EVER INSTALLED. `prepare` runs
633
+ # with `--no-install`, so it writes a real `env.json`
634
+ # (`install: "skipped"`, `installed` still read off the
635
+ # filesystem) and `falsify` gets the fact its prompt is written
636
+ # against: it already branches on `installed: false`, records
637
+ # what it cannot run as `unprobed` with a reason, and those
638
+ # hypotheses SURVIVE to adjudication. The oracle was written
639
+ # for the zero-install world; one shared gate was all that kept
640
+ # it out of one. Seconds of CPU, no package manager, no test
641
+ # suite, no `postinstall` from a pull request head.
642
+ # "full" — `prepare` installs. What that buys is the DISCOVERY side, not
643
+ # the probe side: a tsconfig that `extends` a bare package
644
+ # specifier (`@calcom/tsconfig/react-library`) does not resolve
645
+ # on a bare checkout, tsgo excludes the project, and the case
646
+ # drops to tier 2 with `contracts` emitting nothing — measured
647
+ # over the 50-PR corpus, tier-1 cases 21 -> 5 and contract
648
+ # deltas 73 -> 19. It is also the only route to a coverage
649
+ # artifact, so until `probeCoverage` produces one the `tests`
650
+ # family is NOT MEASURED, a different row from "did not
651
+ # convert".
586
652
  #
587
- # Default posture: OFF in production, ON in the eval overlay — whether it
588
- # ships on is an ablation number, not a judgement call.
589
- probes: false
590
- # Let the install run the tree's own postinstall. OFF, as a SECURITY default:
653
+ # Two costs that are NOT metered anywhere, and this is the only
654
+ # place they are written down. There is no disk guard — not in
655
+ # `prepare`, not in `prepareTree`, not in the workflow — and
656
+ # the warm-workspace refresh is deliberately
657
+ # `git clean -fdx -e node_modules`, so `node_modules` PERSISTS
658
+ # across reviews by design. `full` is therefore a permanent
659
+ # per-target disk cost with nothing watching the volume. And
660
+ # the `facts` phase inherits the installed tree on every
661
+ # re-review; peak RSS there is UNMEASURED on the current
662
+ # engine.
663
+ #
664
+ # A bare `true` reads as "static", never "full": no deployment may silently
665
+ # gain an install by upgrading. Anything else — including the truthy strings
666
+ # — reads as "off", the same direction every switch in this block fails.
667
+ probes: "off"
668
+ # Let the install run the tree's own postinstall. Applies to `full` alone —
669
+ # there is no install to attach a script to under `static`, and the phase
670
+ # never claims otherwise in `env.json`. OFF, as a SECURITY default:
591
671
  # `prepare` installs at a PULL REQUEST HEAD, so a lifecycle script there is
592
672
  # code the PR author wrote running on this machine — and `pr-review`'s
593
673
  # workspace has never installed anything, which makes this the first thing in
@@ -615,6 +695,19 @@ review:
615
695
  # five-line existence gate, not a validator — v2's full quote validator was
616
696
  # overkill and cost 2.4x for a worse result.
617
697
  probeRounds: 2
698
+ # The WHOLE-PHASE ceiling on `falsify`, across every round. It had none at
699
+ # all until the oracle could run without an install, and `probeRounds` was
700
+ # never a budget: a round count bounds how many times the loop may go round,
701
+ # not what it may spend, and CPU is this pipeline's binding constraint. Ten
702
+ # minutes covers two rounds of a pass whose probes are sub-second by
703
+ # construction (a differential `git` run, a copied pure function under plain
704
+ # `node`) and whose real cost is model latency.
705
+ falsifyTimeoutSeconds: 600
706
+ # The WHOLE-PHASE ceiling on `jev-classify`, under `adjudicate: "jev"`.
707
+ # Each call is a TypeSafe `systemOne` round trip (~100ms typically) but the
708
+ # phase makes one per hypothesis and a case can carry dozens; 120s covers
709
+ # a slow provider day without threatening the falsify-sized budget above.
710
+ jevTimeoutSeconds: 120
618
711
  # The attention boundary (WP6b). Preserving internal recall and spending a
619
712
  # human's attention are two different budgets; conflating them is how a
620
713
  # recall-first reviewer becomes unreadable.
@@ -624,15 +717,19 @@ review:
624
717
  # for being noisy: this is an attention boundary, not the v2 suppressor that
625
718
  # was built, measured and reverted.
626
719
  #
627
- # Ten, from "Does AI Code Review Lead to Code Changes?" (22k+ real review
628
- # comments): concise, hunk-level, actionable findings are substantially
629
- # likelier to cause a change, and the wall the paper warns about is TWENTY.
630
- # A ceiling rather than a budget that bites — measured inline volume is 1–5
631
- # per PR, so this has never bound, and the overflow goes to the body.
632
- maxInlineComments: 10
720
+ # Five, down from ten (issue #405). Ten came from "Does AI Code Review Lead
721
+ # to Code Changes?" (22k+ real review comments; the wall it warns about is
722
+ # twenty) and never bound while inline volume was 1–5 per PR. The all-open
723
+ # Martian arm then posted 5–13 a case at precision 0.15–0.40 against two
724
+ # gold. It can bite now because what it ranks on varies: a hypothesis-
725
+ # derived finding's severity is DERIVED from its evidence record and probe
726
+ # strength (code-facts finding-severity.ts, stamped by `reconcile`), so the
727
+ # cut keeps boundary-crossing and executed claims over local, read-only
728
+ # ones. The overflow still goes to the body, then to the body budget.
729
+ maxInlineComments: 5
633
730
  # The BODY budget — how many findings the review body's "Additional
634
731
  # findings" list may carry. N (the default is 5) keeps the top N ranked by
635
- # severity × confidence and records the rest in disposition.json at
732
+ # severity and records the rest in disposition.json at
636
733
  # `internal` with reason `body-budget` — capped attention, never a lost
637
734
  # record. 0 = NO overflow at all (nothing tiers to body); null = unlimited
638
735
  # (the pre-2026-08-24 funnel).
@@ -648,27 +745,19 @@ review:
648
745
  # slightly better precision). 5 is the recall-preserving compromise pending
649
746
  # a real boundary tune — so an eval overlay measuring a particular shape
650
747
  # should still pin this key (`null` for the open funnel) explicitly rather
651
- # than inherit it.
748
+ # than inherit it. A deployment overlay should NOT pin `null`: that is the
749
+ # open funnel issue #405 measured posting every claim, and the body budget
750
+ # is only a ranking cut once severity varies (see maxInlineComments).
652
751
  maxBodyComments: 5
653
- # Per-family confidence bar for an INLINE comment; below it, the body.
654
- # Per-family and not global because AutoCommenter (Google Critique) measured
655
- # a global threshold as catastrophic — at t=0.98, ~80% of below-threshold
656
- # predictions were still CORRECT — while per-URL thresholds raised recall
657
- # without hurting precision.
658
- #
659
- # THESE ARE INITIAL GUESSES TO BE TUNED ON THE TRAIN SPLIT, NOT
660
- # MEASUREMENTS. Record each retune in the eval journal.
661
- thresholds:
662
- contract: 0.35 # converts; cheap to check; bias to surface
663
- enforcement: 0.35
664
- security: 0.30
665
- state: 0.50
666
- tests: 0.60 # mechanical provenance, but noisier as prose
667
- spec: 0.45
668
- # Below this, recorded in findings.json but not posted at all. The one tier
669
- # that costs recall, so it is low. A finding carrying NO confidence is never
670
- # affected — an absent field is not a zero.
671
- internalFloor: 0.15
752
+ # REMOVED 2026-09-21: `thresholds` (the per-family confidence bars) and
753
+ # `internalFloor`. Both gated on a finding's self-reported `confidence`,
754
+ # which measured AUROC 0.228 [0.171, 0.299] over 516 findings from 20
755
+ # preserved case-runs — a strong signal pointing the WRONG way, because the
756
+ # model is surest about the observations where nothing is wrong (withheld
757
+ # findings carried a HIGHER median confidence, 0.99, than posted ones).
758
+ # They also cost nothing: across the preserved archive not one gold finding
759
+ # was ever lost to `below-floor` or `below-threshold`. An overlay that
760
+ # still pins either key is accepted and ignored, with a warning in the log.
672
761
 
673
762
  # The software-factory pipeline (label-driven autonomy).
674
763
  #
@@ -1439,6 +1439,9 @@ export function createAdminRoutes(db, sessions, chatSessions, config) {
1439
1439
  outputTokens: r.outputTokens,
1440
1440
  apiDurationMs: r.apiDurationMs,
1441
1441
  stopReason: r.stopReason,
1442
+ cpuSeconds: r.cpuSeconds,
1443
+ peakMemoryBytes: r.peakMemoryBytes,
1444
+ memoryLimitBytes: r.memoryLimitBytes,
1442
1445
  // Already parsed objects on the way out of the store — passed through as
1443
1446
  // they are. Re-parsing them would throw, and the old helper's `catch`
1444
1447
  // swallowed that into `undefined`, silently emptying the panel.