lastlight-core 0.28.1 → 0.29.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 +25 -0
- package/dist/activity.d.ts +19 -0
- package/dist/activity.js +28 -0
- package/dist/activity.js.map +1 -0
- package/dist/admin/activity.d.ts +16 -0
- package/dist/admin/activity.js +21 -0
- package/dist/admin/activity.js.map +1 -0
- package/dist/admin/auth.d.ts +10 -0
- package/dist/admin/auth.js +22 -1
- package/dist/admin/auth.js.map +1 -1
- package/dist/admin/routes.js +211 -7
- package/dist/admin/routes.js.map +1 -1
- package/dist/config/config.d.ts +8 -0
- package/dist/config/config.js +89 -0
- package/dist/config/config.js.map +1 -1
- package/dist/config/provider-registry.d.ts +57 -0
- package/dist/config/provider-registry.js +73 -0
- package/dist/config/provider-registry.js.map +1 -0
- package/dist/cron/dependabot-discovery.d.ts +1 -1
- package/dist/cron/handlers.js +20 -0
- package/dist/cron/handlers.js.map +1 -1
- package/dist/cron/runner.js +24 -2
- package/dist/cron/runner.js.map +1 -1
- package/dist/engine/agent-executor.js +19 -6
- package/dist/engine/agent-executor.js.map +1 -1
- package/dist/engine/chat/chat-runner.d.ts +14 -0
- package/dist/engine/chat/chat-runner.js +55 -6
- package/dist/engine/chat/chat-runner.js.map +1 -1
- package/dist/engine/dispatcher.js +77 -2
- package/dist/engine/dispatcher.js.map +1 -1
- package/dist/engine/executors/orchestrator.js +4 -2
- package/dist/engine/executors/orchestrator.js.map +1 -1
- package/dist/engine/fix-harvest.js +2 -2
- package/dist/engine/fix-harvest.js.map +1 -1
- package/dist/engine/llm.d.ts +1 -1
- package/dist/engine/llm.js +18 -11
- package/dist/engine/llm.js.map +1 -1
- package/dist/engine/pr-decisions.js +3 -3
- package/dist/engine/pr-decisions.js.map +1 -1
- package/dist/engine/pr-state.d.ts +1 -1
- package/dist/engine/pr-state.js +3 -3
- package/dist/engine/pr-state.js.map +1 -1
- package/dist/index.js +47 -6
- package/dist/index.js.map +1 -1
- package/dist/sandbox/egress-allowlist.d.ts +20 -8
- package/dist/sandbox/egress-allowlist.js +25 -13
- package/dist/sandbox/egress-allowlist.js.map +1 -1
- package/dist/sandbox/egress-firewall-config.js +3 -3
- package/dist/sandbox/egress-firewall-config.js.map +1 -1
- package/dist/sandbox/k8s/kubernetes-sandbox.js +2 -2
- package/dist/sandbox/k8s/kubernetes-sandbox.js.map +1 -1
- package/dist/sandbox/reap.d.ts +1 -1
- package/dist/sandbox/reap.js +1 -1
- package/dist/sandbox/sandbox.d.ts +8 -0
- package/dist/sandbox/sandbox.js +3 -0
- package/dist/sandbox/sandbox.js.map +1 -1
- package/dist/state/activity-store.d.ts +118 -0
- package/dist/state/activity-store.js +173 -0
- package/dist/state/activity-store.js.map +1 -0
- package/dist/state/data-migrate.js +3 -0
- package/dist/state/data-migrate.js.map +1 -1
- package/dist/state/db.d.ts +9 -0
- package/dist/state/db.js +9 -0
- package/dist/state/db.js.map +1 -1
- package/dist/state/schema/pg.d.ts +171 -0
- package/dist/state/schema/pg.js +16 -0
- package/dist/state/schema/pg.js.map +1 -1
- package/dist/state/schema/sqlite.d.ts +197 -0
- package/dist/state/schema/sqlite.js +30 -0
- package/dist/state/schema/sqlite.js.map +1 -1
- package/dist/workflows/runner.d.ts +11 -0
- package/dist/workflows/runner.js +17 -33
- package/dist/workflows/runner.js.map +1 -1
- package/dist/workflows/simple.d.ts +3 -4
- package/dist/workflows/simple.js +32 -25
- package/dist/workflows/simple.js.map +1 -1
- package/dist/workflows/target-policy.d.ts +95 -73
- package/dist/workflows/target-policy.js +147 -96
- package/dist/workflows/target-policy.js.map +1 -1
- package/drizzle/pg/0001_brief_gargoyle.sql +15 -0
- package/drizzle/pg/meta/0001_snapshot.json +1876 -0
- package/drizzle/pg/meta/_journal.json +7 -0
- package/drizzle/sqlite/0002_aromatic_vector.sql +15 -0
- package/drizzle/sqlite/meta/0002_snapshot.json +1704 -0
- package/drizzle/sqlite/meta/_journal.json +8 -1
- package/package.json +6 -6
- package/workflows/answer.yaml +4 -0
- package/workflows/build.yaml +8 -0
- package/workflows/demo.yaml +10 -0
- package/workflows/dependabot-ci-fix.yaml +7 -0
- package/workflows/dependabot-pr-merge.yaml +7 -0
- package/workflows/explore.yaml +4 -0
- package/workflows/issue-comment.yaml +4 -0
- package/workflows/issue-triage.yaml +4 -0
- package/workflows/pr-comment.yaml +4 -0
- package/workflows/pr-fix.yaml +7 -0
- package/workflows/pr-review.yaml +9 -0
- package/workflows/qa-test.yaml +10 -0
- package/workflows/repo-health.yaml +5 -0
- package/workflows/security-feedback.yaml +4 -0
- package/workflows/security-review.yaml +4 -0
- package/workflows/verify.yaml +10 -0
|
@@ -1,108 +1,159 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Per-
|
|
3
|
-
* workspace
|
|
2
|
+
* Per-workflow RUNTIME POLICY — the git-token profile a run is minted, how its
|
|
3
|
+
* sandbox workspace is keyed and refreshed, whether it pre-populates a
|
|
4
|
+
* synthesized branch or pins to a PR's real head ref, and whether it is shaped
|
|
5
|
+
* like `pr-fix`.
|
|
4
6
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* the
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `
|
|
21
|
-
*
|
|
22
|
-
*
|
|
7
|
+
* ## Why this is a workflow's own metadata
|
|
8
|
+
*
|
|
9
|
+
* All five of these used to be literal name tables in compiled core code — a
|
|
10
|
+
* `switch` in `runner.ts` and four `new Set([...])`s here. A workflow that
|
|
11
|
+
* exists only in a deployment OVERLAY could therefore never register itself
|
|
12
|
+
* into any of them: it silently got `git_access: read` (cannot submit a
|
|
13
|
+
* review, cannot push), a cold per-run clone, and no head-ref pinning (it
|
|
14
|
+
* reviews the BASE branch and says nothing about it). The only way to ship a
|
|
15
|
+
* first-class overlay workflow was a core patch naming an arm core does not
|
|
16
|
+
* ship (issue #368).
|
|
17
|
+
*
|
|
18
|
+
* The failure mode is the one `./pr-scope.ts` documents for `pr_scoped`, and
|
|
19
|
+
* this is the same refactor: everything these tables control is invisible in a
|
|
20
|
+
* run's output until it isn't. So each is declared on the workflow — see
|
|
21
|
+
* `git_access` / `workspace` / `prepopulate_synth_branch` /
|
|
22
|
+
* `prepopulate_pr_head_ref` / `pr_fix_shaped` in
|
|
23
|
+
* `packages/workflow-engine/src/core/schema.ts`, which carry the full prose —
|
|
24
|
+
* and read back off the loaded definitions here.
|
|
25
|
+
*
|
|
26
|
+
* ## Resolution
|
|
27
|
+
*
|
|
28
|
+
* Derived from the loader's merged layer stack (built-ins + the deployment
|
|
29
|
+
* overlay) and memoised on `getAssetVersion()`, so an admin asset reload
|
|
30
|
+
* re-derives it without a callback registry — exactly as `prScopedWorkflows()`
|
|
31
|
+
* does. Unlike `pr_scoped` there is NO legacy-name floor: this was a hard
|
|
32
|
+
* cutover, with every built-in YAML declaring its behaviour explicitly and a
|
|
33
|
+
* test pinning the derived policy entry-for-entry. What guards an overlay that
|
|
34
|
+
* forked a workflow before these keys existed is `validateAssets`, which warns
|
|
35
|
+
* when a workflow reachable from a configured `routes.github.*` declares none
|
|
36
|
+
* of them.
|
|
37
|
+
*
|
|
38
|
+
* A name the loader has never heard of — every in-process handler
|
|
39
|
+
* (`chat`, `approval-response`, …), and any caller passing a bare skill name —
|
|
40
|
+
* resolves to {@link DEFAULT_POLICY}, which is what the old tables' `default:`
|
|
41
|
+
* arm and `Set.has() === false` gave it.
|
|
42
|
+
*
|
|
43
|
+
* This stays a LEAF module (it imports the loader, but no importer of it —
|
|
44
|
+
* `runner.ts`, `simple.ts`, the engine — is imported by the loader) so both
|
|
45
|
+
* `simple.ts` (taskId keying) and `runner.ts` (`gitSandboxAccessForWorkflow`)
|
|
46
|
+
* can read one source of truth without an import cycle.
|
|
23
47
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"dependabot-ci-fix",
|
|
28
|
-
// dependabot-pr-merge is always single-PR (webhook or the cron's per-PR
|
|
29
|
-
// fan-out), so it keys its (checkout-free) run by (repo, PR): a repeated
|
|
30
|
-
// `pr.checks_passed` and the daily cron backstop for the same PR dedup onto
|
|
31
|
-
// one dir/run rather than stacking.
|
|
32
|
-
"dependabot-pr-merge",
|
|
33
|
-
]);
|
|
48
|
+
import { getAssetVersion, listAgentWorkflows } from "./loader.js";
|
|
49
|
+
import { logger } from "../logging/logger.js";
|
|
50
|
+
const log = logger("target-policy");
|
|
34
51
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* (fix a failing dependency-update PR, then auto-merge trivial ones) is the
|
|
41
|
-
* second member. Kept here so the dispatcher and `src/index.ts` share one list.
|
|
52
|
+
* What an undeclared — or unknown — workflow gets.
|
|
53
|
+
*
|
|
54
|
+
* Every field is the value the deleted hardcoded tables produced for a name
|
|
55
|
+
* they did not list, so a workflow that declares nothing behaves exactly as one
|
|
56
|
+
* missing from all five did.
|
|
42
57
|
*/
|
|
43
|
-
export const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
export const DEFAULT_POLICY = {
|
|
59
|
+
gitAccess: "read",
|
|
60
|
+
workspace: "per-run",
|
|
61
|
+
prepopulateSynthBranch: false,
|
|
62
|
+
prepopulatePrHeadRef: false,
|
|
63
|
+
prFixShaped: false,
|
|
64
|
+
};
|
|
65
|
+
let cached = null;
|
|
66
|
+
let cachedAtVersion = -1;
|
|
67
|
+
function derive() {
|
|
68
|
+
const byName = new Map();
|
|
69
|
+
for (const def of listAgentWorkflows()) {
|
|
70
|
+
byName.set(def.name, {
|
|
71
|
+
gitAccess: def.git_access ?? DEFAULT_POLICY.gitAccess,
|
|
72
|
+
workspace: def.workspace ?? DEFAULT_POLICY.workspace,
|
|
73
|
+
prepopulateSynthBranch: def.prepopulate_synth_branch === true,
|
|
74
|
+
prepopulatePrHeadRef: def.prepopulate_pr_head_ref === true,
|
|
75
|
+
prFixShaped: def.pr_fix_shaped === true,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return byName;
|
|
79
|
+
}
|
|
80
|
+
function policies() {
|
|
81
|
+
const version = getAssetVersion();
|
|
82
|
+
if (cached && cachedAtVersion === version)
|
|
83
|
+
return cached;
|
|
84
|
+
let byName;
|
|
85
|
+
try {
|
|
86
|
+
byName = derive();
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
// A loader that cannot read its workflows must not take the process with
|
|
90
|
+
// it: every lookup then falls through to DEFAULT_POLICY, the least
|
|
91
|
+
// privileged answer (read token, cold per-run workspace, no pinning).
|
|
92
|
+
log.warn("Could not read the workflow definitions — every workflow falls back to the default policy", { err });
|
|
93
|
+
byName = new Map();
|
|
94
|
+
}
|
|
95
|
+
cached = byName;
|
|
96
|
+
cachedAtVersion = version;
|
|
97
|
+
return cached;
|
|
98
|
+
}
|
|
53
99
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* marker triggers a delete + fresh clone off the default branch, not a
|
|
59
|
-
* `git fetch`/reset of the (stale) feature branch. This makes an incomplete
|
|
60
|
-
* `build` disposable: re-triggering it starts again from current `main`
|
|
61
|
-
* (issue #153). A genuine *resume* of the same run (approval gate) still
|
|
62
|
-
* preserves the workspace via the same-run marker — the architect's `plan.md`
|
|
63
|
-
* survives. Concurrency is held off by the dispatcher's
|
|
64
|
-
* `isRunning(skill, triggerId)` guard, so the delete only ever hits a leftover
|
|
65
|
-
* from a finished/abandoned run.
|
|
100
|
+
* The resolved policy for one workflow, by name.
|
|
101
|
+
*
|
|
102
|
+
* Cheap to call — memoised per asset version, and every caller is on a dispatch
|
|
103
|
+
* path that already resolves config.
|
|
66
104
|
*/
|
|
67
|
-
export
|
|
105
|
+
export function workflowTargetPolicy(workflowName) {
|
|
106
|
+
return policies().get(workflowName) ?? DEFAULT_POLICY;
|
|
107
|
+
}
|
|
108
|
+
/** What the GitHub token minted for this workflow's sandbox may do. */
|
|
109
|
+
export function gitAccessFor(workflowName) {
|
|
110
|
+
return workflowTargetPolicy(workflowName).gitAccess;
|
|
111
|
+
}
|
|
112
|
+
/** Is this workflow's workspace keyed by (repo, target) rather than per-run? */
|
|
113
|
+
export function isPerTargetWorkspace(workflowName) {
|
|
114
|
+
return workflowTargetPolicy(workflowName).workspace !== "per-run";
|
|
115
|
+
}
|
|
116
|
+
/** Keyed by (repo, target) and REFRESHED across runs (`per-target-reuse`). */
|
|
117
|
+
export function isPerTargetReuse(workflowName) {
|
|
118
|
+
return workflowTargetPolicy(workflowName).workspace === "per-target-reuse";
|
|
119
|
+
}
|
|
68
120
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* sandbox: the agent's cwd becomes the repo root (no `git clone`/`cd`), and —
|
|
72
|
-
* for the read-only `verify`/`qa-test` runs — server-mode artifacts the agent
|
|
73
|
-
* writes to `.lastlight/<key>/` (e.g. browser-QA screenshots) land where
|
|
74
|
-
* `serverArtifacts()` harvests them instead of being orphaned a level up.
|
|
75
|
-
* `build` was the original member; verify/qa-test were added for the harvest
|
|
76
|
-
* fix, and `demo` for the same reason (its `demo.mp4` is written under
|
|
77
|
-
* `.lastlight/<key>/` and harvested into the Artifacts store). For a fresh
|
|
78
|
-
* (issue-scoped) dispatch the dispatcher leaves `prePopulateBranch` unset and
|
|
79
|
-
* the missing-branch fallback in `prePopulateWorkspace` clones the default
|
|
80
|
-
* branch — correct for `build`/`demo`, which *create* the synth branch off the
|
|
81
|
-
* default. But when the *same* workflow runs against an existing PR, the synth
|
|
82
|
-
* `lastlight/<prNumber>-<title-slug>` name won't match the PR's real head ref
|
|
83
|
-
* (named after the originating issue), so the fallback would clone the default
|
|
84
|
-
* branch and test/demo code that lacks the PR — see
|
|
85
|
-
* `PR_HEADREF_PREPOPULATE_WORKFLOWS`.
|
|
121
|
+
* Keyed by (repo, target) and RECREATED from the default branch on a fresh run
|
|
122
|
+
* (`per-target-recreate`) — read as `recreateFromBase` by the sandbox.
|
|
86
123
|
*/
|
|
87
|
-
export
|
|
124
|
+
export function isPerTargetRecreate(workflowName) {
|
|
125
|
+
return workflowTargetPolicy(workflowName).workspace === "per-target-recreate";
|
|
126
|
+
}
|
|
127
|
+
/** Pre-populate the sandbox even though this workflow's branch is synthesized. */
|
|
128
|
+
export function prepopulatesSynthBranch(workflowName) {
|
|
129
|
+
return workflowTargetPolicy(workflowName).prepopulateSynthBranch;
|
|
130
|
+
}
|
|
131
|
+
/** Against a real PR, pin the pre-clone to the PR's actual head ref. */
|
|
132
|
+
export function prepopulatesPrHeadRef(workflowName) {
|
|
133
|
+
return workflowTargetPolicy(workflowName).prepopulatePrHeadRef;
|
|
134
|
+
}
|
|
135
|
+
/** Is this workflow dispatched through `handlePrFix`? */
|
|
136
|
+
export function isPrFixShaped(workflowName) {
|
|
137
|
+
return workflowTargetPolicy(workflowName).prFixShaped;
|
|
138
|
+
}
|
|
88
139
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* - `qa-test` / `verify` QA the *base* branch and report the PR's feature
|
|
96
|
-
* missing — a false-negative result.
|
|
97
|
-
* - `demo`'s "after" collapses onto the default branch, matching "before".
|
|
98
|
-
* `pr-fix` is handled separately (it plumbs `branch` through context for the
|
|
99
|
-
* architect/executor to push to). See the resolution block in
|
|
100
|
-
* `dispatchWorkflow` (src/index.ts).
|
|
140
|
+
* Every `pr_fix_shaped` workflow, by name — the fix FAMILY.
|
|
141
|
+
*
|
|
142
|
+
* Kept as a set (not just the predicate) because several callers need to
|
|
143
|
+
* ENUMERATE it rather than test one name: the shared per-PR workspace key, the
|
|
144
|
+
* fix ledger's per-family scan (`engine/pr-state.ts`) and the admin PR-retry
|
|
145
|
+
* route's `latestForTrigger` all ask "which of these last worked this PR".
|
|
101
146
|
*/
|
|
102
|
-
export
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
147
|
+
export function prFixShapedWorkflows() {
|
|
148
|
+
const names = new Set();
|
|
149
|
+
for (const [name, policy] of policies())
|
|
150
|
+
if (policy.prFixShaped)
|
|
151
|
+
names.add(name);
|
|
152
|
+
return names;
|
|
153
|
+
}
|
|
154
|
+
/** Drop the memo. Tests only — production invalidates on `getAssetVersion()`. */
|
|
155
|
+
export function __resetTargetPolicyCacheForTest() {
|
|
156
|
+
cached = null;
|
|
157
|
+
cachedAtVersion = -1;
|
|
158
|
+
}
|
|
108
159
|
//# sourceMappingURL=target-policy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"target-policy.js","sourceRoot":"","sources":["../../src/workflows/target-policy.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"target-policy.js","sourceRoot":"","sources":["../../src/workflows/target-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAGH,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,GAAG,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAmBpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAyB;IAClD,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,SAAS;IACpB,sBAAsB,EAAE,KAAK;IAC7B,oBAAoB,EAAE,KAAK;IAC3B,WAAW,EAAE,KAAK;CACnB,CAAC;AAEF,IAAI,MAAM,GAAqD,IAAI,C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AAe,GAAG,CAAC,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
CREATE TABLE "activity_log" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"created_at" text NOT NULL,
|
|
4
|
+
"actor_login" text,
|
|
5
|
+
"actor_type" text,
|
|
6
|
+
"action" text NOT NULL,
|
|
7
|
+
"target_type" text,
|
|
8
|
+
"target_id" text,
|
|
9
|
+
"outcome" text NOT NULL,
|
|
10
|
+
"detail" jsonb
|
|
11
|
+
);
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
CREATE INDEX "idx_activity_created" ON "activity_log" USING btree ("created_at" DESC NULLS LAST);--> statement-breakpoint
|
|
14
|
+
CREATE INDEX "idx_activity_actor_created" ON "activity_log" USING btree ("actor_login","created_at" DESC NULLS LAST);--> statement-breakpoint
|
|
15
|
+
CREATE INDEX "idx_activity_target" ON "activity_log" USING btree ("target_type","target_id");
|