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.
- package/config/default.yaml +302 -5
- package/dist/admin/docker.js.map +1 -1
- package/dist/admin/sessions.js.map +1 -1
- package/dist/admin/tail.js.map +1 -1
- package/dist/config/config.d.ts +18 -4
- package/dist/config/config.js +122 -9
- package/dist/config/config.js.map +1 -1
- package/dist/config/repo-config.js.map +1 -1
- package/dist/connectors/messaging/session-manager.js.map +1 -1
- package/dist/connectors/slack/connector.js.map +1 -1
- package/dist/cron/dependabot-discovery.js.map +1 -1
- package/dist/cron/review-discovery.js.map +1 -1
- package/dist/engine/agent-executor.d.ts +25 -1
- package/dist/engine/agent-executor.js +41 -1
- package/dist/engine/agent-executor.js.map +1 -1
- package/dist/engine/chat/chat-prompt.js.map +1 -1
- package/dist/engine/chat/chat-runner.js.map +1 -1
- package/dist/engine/dispatcher.js +17 -0
- package/dist/engine/dispatcher.js.map +1 -1
- package/dist/engine/event-shim.d.ts +18 -0
- package/dist/engine/event-shim.js +2 -0
- package/dist/engine/event-shim.js.map +1 -1
- package/dist/engine/executors/orchestrator.d.ts +92 -1
- package/dist/engine/executors/orchestrator.js +144 -46
- package/dist/engine/executors/orchestrator.js.map +1 -1
- package/dist/engine/executors/shared.js.map +1 -1
- package/dist/engine/fix-harvest.js.map +1 -1
- package/dist/engine/github/github.d.ts +59 -0
- package/dist/engine/github/github.js +72 -0
- package/dist/engine/github/github.js.map +1 -1
- package/dist/engine/github/installations.js.map +1 -1
- package/dist/engine/github/review-poster.d.ts +403 -9
- package/dist/engine/github/review-poster.js +619 -52
- package/dist/engine/github/review-poster.js.map +1 -1
- package/dist/engine/github/team-visibility.js.map +1 -1
- package/dist/engine/llm.js.map +1 -1
- package/dist/engine/pr-decisions.d.ts +85 -5
- package/dist/engine/pr-decisions.js +331 -5
- package/dist/engine/pr-decisions.js.map +1 -1
- package/dist/engine/pr-state.d.ts +82 -0
- package/dist/engine/pr-state.js +71 -1
- package/dist/engine/pr-state.js.map +1 -1
- package/dist/engine/review-spec.d.ts +264 -0
- package/dist/engine/review-spec.js +723 -0
- package/dist/engine/review-spec.js.map +1 -0
- package/dist/engine/router.js.map +1 -1
- package/dist/engine/screen/classifier.js.map +1 -1
- package/dist/engine/screen/screen.js.map +1 -1
- package/dist/evals-api.d.ts +3 -0
- package/dist/evals-api.js +20 -0
- package/dist/evals-api.js.map +1 -1
- package/dist/index.js +76 -11
- package/dist/index.js.map +1 -1
- package/dist/notify/digest-blocks.js.map +1 -1
- package/dist/notify/model.js.map +1 -1
- package/dist/notify/transports/github.js.map +1 -1
- package/dist/notify/transports/slack.js.map +1 -1
- package/dist/sandbox/artifact-backend.js.map +1 -1
- package/dist/sandbox/artifact-store.js.map +1 -1
- package/dist/sandbox/docker.d.ts +23 -4
- package/dist/sandbox/docker.js +1 -1
- package/dist/sandbox/docker.js.map +1 -1
- package/dist/sandbox/egress-allowlist.js.map +1 -1
- package/dist/sandbox/k8s/agent-context-registry.js.map +1 -1
- package/dist/sandbox/k8s/client.js.map +1 -1
- package/dist/sandbox/k8s/kubernetes-sandbox.js.map +1 -1
- package/dist/sandbox/k8s/resource-name.js.map +1 -1
- package/dist/sandbox/k8s/run-id.js.map +1 -1
- package/dist/sandbox/k8s/run-secrets.js.map +1 -1
- package/dist/sandbox/k8s/skill-bundle.js.map +1 -1
- package/dist/sandbox/k8s/workspace-provisioner.js +10 -2
- package/dist/sandbox/k8s/workspace-provisioner.js.map +1 -1
- package/dist/sandbox/sandbox.d.ts +20 -0
- package/dist/sandbox/sandbox.js +27 -6
- package/dist/sandbox/sandbox.js.map +1 -1
- package/dist/session-log.js.map +1 -1
- package/dist/state/approval-store.js.map +1 -1
- package/dist/state/build-assets.js.map +1 -1
- package/dist/state/cron-run-store.js.map +1 -1
- package/dist/state/data-migrate.d.ts +135 -0
- package/dist/state/data-migrate.js +309 -0
- package/dist/state/data-migrate.js.map +1 -0
- package/dist/state/db.d.ts +24 -3
- package/dist/state/db.js +41 -11
- package/dist/state/db.js.map +1 -1
- package/dist/state/execution-store.js.map +1 -1
- package/dist/state/feedback-store.js.map +1 -1
- package/dist/state/pg-client.d.ts +44 -0
- package/dist/state/pg-client.js +81 -0
- package/dist/state/pg-client.js.map +1 -0
- package/dist/state/schema/pg.d.ts +15 -15
- package/dist/state/schema/sqlite.d.ts +15 -15
- package/dist/state/state-cli.d.ts +8 -0
- package/dist/state/state-cli.js +247 -0
- package/dist/state/state-cli.js.map +1 -0
- package/dist/state/team-store.js.map +1 -1
- package/dist/state/user-store.js.map +1 -1
- package/dist/state/workflow-run-store.js.map +1 -1
- package/dist/telemetry/index.js.map +1 -1
- package/dist/workflows/handlers/fanout.d.ts +157 -0
- package/dist/workflows/handlers/fanout.js +663 -0
- package/dist/workflows/handlers/fanout.js.map +1 -0
- package/dist/workflows/handlers/post-review.d.ts +111 -10
- package/dist/workflows/handlers/post-review.js +531 -39
- package/dist/workflows/handlers/post-review.js.map +1 -1
- package/dist/workflows/runner.js +33 -0
- package/dist/workflows/runner.js.map +1 -1
- package/dist/workflows/simple.js.map +1 -1
- package/docker-compose.yml +50 -0
- package/package.json +22 -12
- package/sandbox.Dockerfile +54 -0
- package/skills/adjudicate-pass/SKILL.md +117 -0
- package/skills/code-review/SKILL.md +114 -15
- package/skills/pr-review/SKILL.md +113 -24
- package/skills/pr-review/references/findings-schema.md +38 -7
- package/skills/survey-pass/SKILL.md +148 -0
- package/workflows/pr-review.yaml +626 -0
- package/workflows/prompts/dependabot-pr-merge.md +22 -2
- package/workflows/prompts/review-adjudicate.md +340 -0
- package/workflows/prompts/review-falsify.md +167 -0
- package/workflows/prompts/review.md +80 -0
- package/workflows/prompts/survey-contract.md +121 -0
- package/workflows/prompts/survey-enforcement.md +137 -0
- package/workflows/prompts/survey-security.md +165 -0
- package/workflows/prompts/survey-spec.md +116 -0
- package/workflows/prompts/survey-state.md +151 -0
- package/workflows/prompts/survey-tests.md +99 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { AssetLoader, DagNode, ExecutionResult, ExecutorConfig, GitSandboxAccess, LedgerDeps, PhaseDefinition, PhaseOutcome, PhaseReporter, PhaseResolver, PhaseTypeHandler, TemplateContext, WorkflowStateStore } from "lastlight-workflow-engine";
|
|
2
|
+
import type { SandboxBackend } from "../../config/config.js";
|
|
3
|
+
import type { SandboxFactory } from "../../sandbox/sandbox.js";
|
|
4
|
+
/**
|
|
5
|
+
* The heading the appended {@link FanoutBranch.context_file} is filed under. A
|
|
6
|
+
* constant rather than a literal at the call site because two tests and one
|
|
7
|
+
* prompt-authoring convention all name it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const BRANCH_CONTEXT_HEADING = "## Attached: the file this pass was seeded with";
|
|
10
|
+
/** Run-scoped data the `fanout` handler needs. */
|
|
11
|
+
export interface FanoutRunScope {
|
|
12
|
+
workflowName: string;
|
|
13
|
+
ctx: TemplateContext;
|
|
14
|
+
config: ExecutorConfig;
|
|
15
|
+
/** Single workspace shared by every phase + branch of the run. */
|
|
16
|
+
taskId: string;
|
|
17
|
+
triggerId: string;
|
|
18
|
+
githubAccess: GitSandboxAccess;
|
|
19
|
+
backend: SandboxBackend;
|
|
20
|
+
assets: AssetLoader;
|
|
21
|
+
resolver: PhaseResolver;
|
|
22
|
+
store?: WorkflowStateStore;
|
|
23
|
+
workflowId?: string;
|
|
24
|
+
ledger: Omit<LedgerDeps, "store">;
|
|
25
|
+
/**
|
|
26
|
+
* The two quota hooks `runner.ts` wraps its `AgentPort` in. A fan-out branch
|
|
27
|
+
* bypasses that port (it drives an already-provisioned sandbox directly), so
|
|
28
|
+
* without these a k8s ResourceQuota rejection inside a branch would fail the
|
|
29
|
+
* run red instead of requeueing it as backpressure.
|
|
30
|
+
*/
|
|
31
|
+
observeResult: (r: ExecutionResult) => ExecutionResult;
|
|
32
|
+
observeError: (err: unknown) => never;
|
|
33
|
+
/** Test seam — substitute a FakeSandbox. Defaults to the real factory. */
|
|
34
|
+
sandboxFactory?: SandboxFactory;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The `type: fanout` phase — N agent sessions run CONCURRENTLY inside ONE
|
|
38
|
+
* provisioned workspace, as a single DAG node.
|
|
39
|
+
*
|
|
40
|
+
* **Why this exists rather than parallel phases.** Real DAG concurrency is
|
|
41
|
+
* parked (`docs/plans/deterministic-pr-levers.md` §WP5) behind
|
|
42
|
+
* four hard blockers and seven design changes, and that document says why in one
|
|
43
|
+
* sentence: *"Every hard blocker below — B1, D1, D2, D7 — exists because each
|
|
44
|
+
* phase provisions its own sandbox against a shared workspace. A fan-out inside
|
|
45
|
+
* one agent has none of them."* One node means one workspace (B1), one
|
|
46
|
+
* `current_phase` (B4), one terminal transition (D5), one provisioning pass so
|
|
47
|
+
* no `ensureBaseAvailable` git-lock contention (D1/D2), one artifact
|
|
48
|
+
* stage/harvest (D3), and one `outputs` writer (D4). B2 — a sibling's success
|
|
49
|
+
* overwriting a `paused` run and orphaning its approval row, the item that doc
|
|
50
|
+
* calls the worst in the list — is refused at the schema instead: a fanout phase
|
|
51
|
+
* may not declare an approval gate.
|
|
52
|
+
*
|
|
53
|
+
* **What it gives up, and buys back.** A DAG node per branch is genuinely lost:
|
|
54
|
+
* six survey families are one node now, retried as one. What is NOT lost is the
|
|
55
|
+
* per-branch `executions` row — each branch goes through the same
|
|
56
|
+
* {@link runLedgeredPhase} every other phase does, keyed
|
|
57
|
+
* `<phase>_branch_<name>`, so resume, dedup, cost attribution and the
|
|
58
|
+
* dashboard's longest-prefix grouping all keep working. WP5
|
|
59
|
+
* (`docs/plans/deterministic-pr-levers.md` §"Parked: parallel phases (WP5)")
|
|
60
|
+
* listed exactly those as the price of an in-agent fan-out; the ledger key is
|
|
61
|
+
* how it goes unpaid.
|
|
62
|
+
*/
|
|
63
|
+
export declare class FanoutHandler implements PhaseTypeHandler {
|
|
64
|
+
private readonly run;
|
|
65
|
+
private readonly reporter;
|
|
66
|
+
constructor(run: FanoutRunScope, reporter: PhaseReporter);
|
|
67
|
+
execute(phase: PhaseDefinition, _node: DagNode, outputs: Readonly<Record<string, unknown>>): Promise<PhaseOutcome>;
|
|
68
|
+
/**
|
|
69
|
+
* Run one branch, with the one-shot soft retry `on_branch_soft_failure`
|
|
70
|
+
* describes. A HARD failure (terminated / fatal / tool error / non-zero exit)
|
|
71
|
+
* is never retried — that is `isSoftOutcome`'s split, shared with the reviewer
|
|
72
|
+
* and generic loops so all three stay in lockstep.
|
|
73
|
+
*/
|
|
74
|
+
private runBranch;
|
|
75
|
+
/** The attempt loop — one branch's agent turn plus its one-shot soft retry. */
|
|
76
|
+
private runBranchAttempts;
|
|
77
|
+
/**
|
|
78
|
+
* Append the branch's `context_file` to its rendered prompt, if it declares
|
|
79
|
+
* one.
|
|
80
|
+
*
|
|
81
|
+
* **LAST in the prompt, and that is §D4's ordering rather than convenience.**
|
|
82
|
+
* Provider-side prompt caching is keyed on the request PREFIX, so the shared
|
|
83
|
+
* head (skills, AGENTS.md, the diff summary) has to stay byte-identical across
|
|
84
|
+
* the six branches and everything family-specific has to come after it. The
|
|
85
|
+
* attached file is the most family-specific thing there is.
|
|
86
|
+
*
|
|
87
|
+
* Whether the read succeeded is LOGGED either way. A lost seed used to be
|
|
88
|
+
* invisible from outside the transcript — it is now one grep on the harness
|
|
89
|
+
* log, which is what turned a 22%-of-branches defect into something anybody
|
|
90
|
+
* could have found in a minute.
|
|
91
|
+
*/
|
|
92
|
+
private withBranchContext;
|
|
93
|
+
/** One ledgered agent turn for a branch, under its own AGENT span. */
|
|
94
|
+
private runBranchOnce;
|
|
95
|
+
/**
|
|
96
|
+
* A branch's `until_bash`, recorded as its own `<phase>_branch_<name>_check`
|
|
97
|
+
* row.
|
|
98
|
+
*
|
|
99
|
+
* Observational, and that is not a weakening — it is what the six chained
|
|
100
|
+
* survey phases already did. Each declared `generic_loop: { max_iterations: 1,
|
|
101
|
+
* until_bash: … }`, and with one iteration the gate can never cause a re-run:
|
|
102
|
+
* it runs once, records `condition_met` / `condition_not_met`, and the loop
|
|
103
|
+
* ends either way. Reproducing that exactly is what makes this a speed change
|
|
104
|
+
* rather than a behaviour change.
|
|
105
|
+
*
|
|
106
|
+
* Like the generic loop's check row it bypasses the dedup ledger: a condition
|
|
107
|
+
* must be re-evaluated every time it is asked, and `success` records whether
|
|
108
|
+
* the check RAN, not what it said.
|
|
109
|
+
*/
|
|
110
|
+
private runBranchGate;
|
|
111
|
+
/**
|
|
112
|
+
* Fold the branches into one node outcome.
|
|
113
|
+
*
|
|
114
|
+
* `then: "complete"` (the default) is what makes a fan-out a fan-out: it
|
|
115
|
+
* gathers independent evidence, so one branch coming back empty must not
|
|
116
|
+
* discard the other five. The six survey phases already had this — a chained
|
|
117
|
+
* phase with `on_soft_failure: { retries: 1, then: complete }` — and it was
|
|
118
|
+
* worth having: without it a single degenerate turn hard-failed the run, which
|
|
119
|
+
* records no `assessedHeadShaByWorkflow` and hands `cron-review.yaml` something
|
|
120
|
+
* to re-dispatch every thirty minutes forever.
|
|
121
|
+
*
|
|
122
|
+
* A HARD branch failure still fails the phase. That is not the soft policy's
|
|
123
|
+
* business, and a fan-out where every branch crashed is not a success.
|
|
124
|
+
*/
|
|
125
|
+
private report;
|
|
126
|
+
/**
|
|
127
|
+
* `min(declared, backend ceiling)`, logged when the host has the last word so
|
|
128
|
+
* an operator who set `max_concurrent: 6` and saw sequential timings can find
|
|
129
|
+
* out why from the log rather than from this file.
|
|
130
|
+
*/
|
|
131
|
+
private resolveConcurrency;
|
|
132
|
+
/** The phase-level config — what opens the shared session. */
|
|
133
|
+
private phaseConfig;
|
|
134
|
+
/**
|
|
135
|
+
* The per-branch config. Two things vary and both matter:
|
|
136
|
+
* `telemetry.phaseName` (which is `skillBundleKey`, so each branch stages into
|
|
137
|
+
* its OWN `.lastlight-skills/<label>/` and concurrent branches cannot clobber
|
|
138
|
+
* each other's catalogue) and `skillPaths` when the branch overrides skills.
|
|
139
|
+
*/
|
|
140
|
+
private branchConfig;
|
|
141
|
+
/**
|
|
142
|
+
* The branch as a phase-shaped object, for the two engine helpers that take
|
|
143
|
+
* one (`buildPhasePrompt`, `phaseConfigFor`).
|
|
144
|
+
*
|
|
145
|
+
* Built by hand rather than by spreading the branch over the phase: a spread
|
|
146
|
+
* would carry `until_bash` and `branches` into something that looks like a
|
|
147
|
+
* PhaseDefinition, and the prompt-cache ordering (§D4 — shared prefix first,
|
|
148
|
+
* the family's obligations last) depends on this going through exactly the
|
|
149
|
+
* same `buildPhasePrompt` path the six chained phases used.
|
|
150
|
+
*/
|
|
151
|
+
private branchPhase;
|
|
152
|
+
/** Mirrors `PhaseExecutor.resolveModelVariant` — YAML template first, then the resolver. */
|
|
153
|
+
private resolveModelVariant;
|
|
154
|
+
private gateTimeoutSeconds;
|
|
155
|
+
}
|
|
156
|
+
/** Build the app-registered `fanout` phase-type handler for a run. */
|
|
157
|
+
export declare function makeFanoutHandler(run: FanoutRunScope, reporter: PhaseReporter): PhaseTypeHandler;
|