lastlight-core 0.17.0 → 0.18.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lastlight-core",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "GitHub repository maintenance agent — Agent SDK harness",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -64,8 +64,8 @@
64
64
  "yaml": "^2.8.3",
65
65
  "zod": "^4.3.6",
66
66
  "lastlight-shared": "0.1.0",
67
- "agentic-pi": "0.2.17",
68
- "lastlight-workflow-engine": "0.1.0"
67
+ "lastlight-workflow-engine": "0.1.0",
68
+ "agentic-pi": "0.2.18"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@types/better-sqlite3": "^7.6.0",
@@ -5,7 +5,7 @@
5
5
  # The heavy, stable toolchain (Debian deps, fnm + Node versions, semgrep/
6
6
  # gitleaks, uv, the `agent` user) lives in the shared sandbox-base image so it
7
7
  # stays cached across releases. This file adds only the THIN, frequently-changing
8
- # tail: the pinned agentic-pi install + the baked agent-context + the entrypoint.
8
+ # tail: the vendored agentic-pi bundle + the baked agent-context + the entrypoint.
9
9
  # Keep it that way — the same tail is duplicated in sandbox-qa.Dockerfile so
10
10
  # Chromium stays a cached child of the base rather than of this churn.
11
11
  #
@@ -18,32 +18,51 @@
18
18
  # because the buildx docker-container driver resolves FROM from a registry, not
19
19
  # the local store. See .github/workflows/docker-publish.yml.
20
20
  ARG BASE_IMAGE=lastlight-sandbox-base:latest
21
+
22
+ # ── agentic-pi build stage ───────────────────────────────────────────────────
23
+ # The sandbox runs `agentic-pi run` (the harness `docker exec`s it per phase).
24
+ # We VENDOR agentic-pi from the in-repo workspace — build it here from source and
25
+ # COPY the deploy bundle below — instead of `npm install -g`ing the published
26
+ # tarball. Now that agentic-pi lives in this monorepo, installing from npm bought
27
+ # nothing but a drift hazard: `npm install -g` ignores pnpm-lock.yaml, so a caret
28
+ # transitive (e.g. `pi-coding-agent@^0.80.x`) resolved to whatever was latest at
29
+ # image-build time — which is how an upstream breaking change reached prod on a
30
+ # routine rebuild. Building from the workspace pins the WHOLE tree to exactly what
31
+ # CI resolved + tested. The npm package still publishes independently
32
+ # (.github/workflows/agentic-pi-npm.yml) for external consumers — that stream is
33
+ # now fully decoupled from what the sandbox runs.
34
+ #
35
+ # Mirrors the agent image's vendored build (apps/server/Dockerfile): manifests
36
+ # first so the install layer caches until deps change, then source, then
37
+ # `pnpm deploy` shapes a self-contained, lockfile-resolved tree.
38
+ FROM node:24-slim AS agentic-pi-build
39
+ # node:24 matches the sandbox base's runtime Node (node:24-slim), so any native
40
+ # deps compile for the ABI agentic-pi actually runs under.
41
+ # python3/make/g++ so optional native deps (e.g. ssh2's cpu-features, pulled in
42
+ # transitively via gondolin) compile instead of erroring out of the install.
43
+ RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ \
44
+ && rm -rf /var/lib/apt/lists/*
45
+ RUN corepack enable
46
+ WORKDIR /repo
47
+ COPY pnpm-workspace.yaml pnpm-lock.yaml package.json tsconfig.base.json ./
48
+ COPY packages/agentic-pi/package.json packages/agentic-pi/package.json
49
+ RUN pnpm install --frozen-lockfile --filter agentic-pi...
50
+ COPY packages/agentic-pi/ packages/agentic-pi/
51
+ RUN pnpm --filter agentic-pi build \
52
+ && pnpm --filter agentic-pi deploy --prod /bundle
53
+
54
+ # ── Sandbox image ────────────────────────────────────────────────────────────
21
55
  FROM ${BASE_IMAGE}
22
56
 
23
- # Install agentic-pi globally so the harness can `docker exec ...
24
- # agentic-pi run ...` against this container. The version + integrity come from
25
- # `sandbox/agentic-pi.pin` (derived from packages/agentic-pi/package.json's
26
- # version + npm's published integrity by scripts/agentic-pi-pin.sh, drift-guarded
27
- # by tests/agentic-pi-pin.test.ts). We
28
- # COPY that tiny two-line file rather than the whole pnpm-lock.yaml on
29
- # purpose: the lockfile's hash changes on every release and would rebust this
30
- # layer (and sandbox-qa's Chromium) on every version bump; the pin changes only
31
- # when agentic-pi actually does. `npm install -g <tarball>` doesn't consult a
32
- # lockfile, hence the explicit integrity verification.
33
- COPY apps/server/sandbox/agentic-pi.pin /tmp/agentic-pi.pin
34
- RUN version=$(sed -n '1p' /tmp/agentic-pi.pin) \
35
- && expected=$(sed -n '2p' /tmp/agentic-pi.pin) \
36
- && echo "Installing agentic-pi@${version} (${expected})" \
37
- && curl -fsSL "https://registry.npmjs.org/agentic-pi/-/agentic-pi-${version}.tgz" -o /tmp/agentic-pi.tgz \
38
- && actual="sha512-$(node -e "const c=require('crypto'),f=require('fs');process.stdout.write(c.createHash('sha512').update(f.readFileSync('/tmp/agentic-pi.tgz')).digest('base64'))")" \
39
- && if [ "$actual" != "$expected" ]; then \
40
- echo "agentic-pi tarball integrity mismatch:" >&2; \
41
- echo " expected: $expected" >&2; \
42
- echo " actual: $actual" >&2; \
43
- exit 1; \
44
- fi \
45
- && npm install -g --no-audit --no-fund /tmp/agentic-pi.tgz \
46
- && rm /tmp/agentic-pi.tgz /tmp/agentic-pi.pin
57
+ # agentic-pi, vendored from the build stage above. The bundle is a self-contained
58
+ # package tree (dist + prod node_modules, deps resolved from the lockfile);
59
+ # symlink its bin onto PATH so the harness can `docker exec … agentic-pi run …`.
60
+ # This COPY layer is content-addressed on the bundle, so it only busts when
61
+ # agentic-pi actually changes — sandbox-qa's Chromium (baked in the base) stays
62
+ # cached across ordinary releases, exactly as with the old pin file.
63
+ COPY --from=agentic-pi-build /bundle /opt/agentic-pi
64
+ RUN chmod +x /opt/agentic-pi/dist/cli.js \
65
+ && ln -sf /opt/agentic-pi/dist/cli.js /usr/local/bin/agentic-pi
47
66
 
48
67
  # Agent context (baked at /app/ — entrypoint cats into workspace/AGENTS.md)
49
68
  COPY apps/server/agent-context/ /app/agent-context/
@@ -0,0 +1,12 @@
1
+ kind: cron
2
+ name: merge-green-dependency-prs
3
+ schedule: "*/30 * * * *"
4
+ workflow: dependabot-pr-merge
5
+ context:
6
+ mode: scan
7
+ # NOTE: unlike cron-review, this scan intentionally has NO
8
+ # `condition.unless: webhooksEnabled`. The pr.checks_passed webhook merges
9
+ # newly-green PRs in real time; this cron is an additive *sweep* that also runs
10
+ # with webhooks on, catching dependency PRs that went green before boot or
11
+ # during a missed delivery. Enabling auto-merge is idempotent, so overlap with
12
+ # the webhook path is harmless.
@@ -0,0 +1,44 @@
1
+ kind: pr-merge
2
+ name: dependabot-pr-merge
3
+ description: |
4
+ Assess an already-GREEN dependency-update PR (Dependabot / Renovate) and, when
5
+ the change is trivial, enable GitHub auto-merge (squash) so it lands once its
6
+ checks pass. The companion to dependabot-ci-fix: that one repairs a RED bump
7
+ and pushes a fix; this one merges a GREEN one that needs no fix at all.
8
+
9
+ Triggered by:
10
+ - pr.checks_passed webhook (a check_suite completed with a success
11
+ conclusion on a Dependabot/Renovate PR) → routed here by the router's
12
+ deterministic intent lookup (src/engine/router.ts + this file's
13
+ `classification`). Runs against the single PR (`{{prNumber}}`).
14
+ - the cron-dependabot-merge scan (context `mode: scan`, no `prNumber`) which
15
+ sweeps every managed repo for open dependency PRs and assesses each.
16
+ classification:
17
+ intent: dependabot-pr-merge
18
+ description: |
19
+ DEPENDABOTPRMERGE — a GREEN dependency-update pull request (opened by
20
+ Dependabot or Renovate, e.g. "Bump <pkg> from X to Y", "chore(deps): update
21
+ <pkg>") whose CI checks have PASSED and which may be safe to auto-merge with
22
+ no code change. Choose this ONLY for a passing dependency-bump PR that needs
23
+ no fix; prefer DEPENDABOTCIFIX when a dependency PR's checks have FAILED, and
24
+ REVIEW for a normal (non-dependency) PR.
25
+ examples:
26
+ - 'PR "Bump lodash from 4.17.20 to 4.17.21" by dependabot[bot] — its CI checks have passed. → INTENT: DEPENDABOTPRMERGE, REPO: NONE, ISSUE: NONE, REASON: NONE'
27
+ - 'PR "chore(deps): bump actions/checkout from 3 to 4" by renovate[bot] — its CI checks have passed. → INTENT: DEPENDABOTPRMERGE, REPO: NONE, ISSUE: NONE, REASON: NONE'
28
+
29
+ phases:
30
+ # Single phase. Runs under this workflow's repo-write profile, so agentic-pi's
31
+ # `github_enable_auto_merge` tool is available. Conservative by design: enable
32
+ # auto-merge ONLY for trivial, non-functional dependency bumps; anything with
33
+ # runtime-logic impact is left for a human. No repo checkout — the agent reads
34
+ # each diff via the `github_get_pull_request_diff` tool.
35
+ - name: assess
36
+ label: Assess & maybe auto-merge
37
+ prompt: prompts/dependabot-pr-merge.md
38
+ # `code-review`: the finding-tier / what-to-check rubric for reading a diff.
39
+ skill: code-review
40
+ model: "{{models.review}}"
41
+ messages:
42
+ on_start: "Assessing dependency PR(s) for auto-merge..."
43
+ on_success: "Assessed dependency PR(s) — auto-merge enabled for trivial, green updates; anything functional left for review."
44
+ on_failure: "Couldn't assess the dependency PR(s) — leaving for a human."
@@ -0,0 +1,61 @@
1
+ You assess **green** dependency-update PRs (Dependabot / Renovate) and enable
2
+ GitHub auto-merge for the ones whose change is trivial and safe. You never push
3
+ code and you never merge directly — you only *enable auto-merge*, which GitHub
4
+ honours once the required checks pass (and refuses on a red or still-running PR).
5
+
6
+ You are working against `{{owner}}/{{repo}}`. Interact with GitHub through the
7
+ `github_*` tools only — there is no local checkout.
8
+
9
+ {{#if prNumber}}
10
+ TARGET — a single PR the webhook flagged as green.
11
+ - PR #{{prNumber}}: {{issueTitle}}
12
+ - Repository: {{owner}}/{{repo}}
13
+
14
+ Assess **only this PR** using the procedure below, then stop.
15
+ {{/if}}
16
+ {{#if !prNumber}}
17
+ TARGET — scan mode. There is no single PR; sweep the repo.
18
+
19
+ STEP 0 — Find candidate PRs.
20
+ List open PRs with `github_list_pull_requests` ({ owner: "{{owner}}",
21
+ repo: "{{repo}}", state: "open" }). Keep only those authored by a dependency
22
+ bot — `user.login` is `dependabot[bot]` or `renovate[bot]` (or a title like
23
+ "Bump …", "chore(deps): …", "Update … requirement"). Skip drafts. Then run the
24
+ procedure below for EACH candidate PR. If there are none, say so and stop.
25
+ {{/if}}
26
+
27
+ For each PR you assess (call it `pull_number`):
28
+
29
+ STEP 1 — Inspect the change.
30
+ Read the full diff with `github_get_pull_request_diff` ({ owner: "{{owner}}",
31
+ repo: "{{repo}}", pull_number }). Apply the **code-review** skill's rubric.
32
+
33
+ STEP 2 — Classify the change, conservatively.
34
+ Call it **TRIVIAL** only if ALL of these hold:
35
+ - it is limited to dependency metadata (lockfile / manifest version bumps),
36
+ a GitHub Actions tag/SHA bump, type-only edits, comments, or mechanical
37
+ rename/signature updates, AND
38
+ - there is NO change to runtime logic, control flow, or behaviour, AND
39
+ - nothing security-sensitive (auth, crypto, deserialization, network, file I/O)
40
+ changed in a meaningful way, AND
41
+ - it is not a **major** version bump of a runtime dependency.
42
+ If you are unsure, or the change touches application logic, treat it as
43
+ **FUNCTIONAL**. When in doubt, do NOT auto-merge.
44
+
45
+ STEP 3 — Act on the classification.
46
+ - If **TRIVIAL**: enable auto-merge by calling `github_enable_auto_merge` with
47
+ `{ owner: "{{owner}}", repo: "{{repo}}", pull_number, merge_method: "squash" }`.
48
+ This does NOT merge immediately — GitHub merges the PR only once its required
49
+ checks pass, and never while they are failing or still running. If the tool
50
+ returns `{ ok: false }` (the repository does not allow auto-merge), post a
51
+ brief comment via `github_add_issue_comment` saying the update looks trivial
52
+ but auto-merge is disabled, so a maintainer should merge it.
53
+ - If **FUNCTIONAL**: do NOT merge. Post a short comment (via
54
+ `github_add_issue_comment`) summarising what changed and why it warrants a
55
+ human review before merging. In scan mode, do not spam — one concise comment
56
+ per functional PR is enough, and skip PRs you have clearly already commented
57
+ on.
58
+
59
+ OUTPUT: For each PR, state its number, your verdict (TRIVIAL or FUNCTIONAL), a
60
+ one-line justification, and whether you enabled auto-merge or left it for a
61
+ human.