From 0129e32b3c838044c0710898c6d1bd9f07e6d1c1 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 11:08:15 -0500 Subject: [PATCH 01/31] Add Cursor ACP rich interactions and pinned distributions Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 71 ++++ .../cursor-distributions.json | 27 ++ .../materialize-cursor-distribution.mjs | 119 +++++++ .../materialize-cursor-distribution.test.mjs | 54 ++++ .../drivers/acpx/cursor-extensions.test.ts | 93 ++++++ .../src/drivers/acpx/cursor-extensions.ts | 304 ++++++++++++++++++ .../drivers/acpx/cursor-launch-policy.test.ts | 25 ++ .../src/drivers/acpx/cursor-launch-policy.ts | 62 ++++ .../cursor-acp/credential-free-probe.json | 152 +++++++++ 9 files changed, 907 insertions(+) create mode 100644 doc/architecture/runner-cursor-capabilities.md create mode 100644 packages/paperclip-runner/cursor-distributions.json create mode 100644 packages/paperclip-runner/scripts/materialize-cursor-distribution.mjs create mode 100644 packages/paperclip-runner/scripts/materialize-cursor-distribution.test.mjs create mode 100644 packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts create mode 100644 packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts create mode 100644 packages/paperclip-runner/src/drivers/acpx/cursor-launch-policy.test.ts create mode 100644 packages/paperclip-runner/src/drivers/acpx/cursor-launch-policy.ts create mode 100644 packages/paperclip-runner/test/fixtures/cursor-acp/credential-free-probe.json diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md new file mode 100644 index 00000000000..d63ec6e8073 --- /dev/null +++ b/doc/architecture/runner-cursor-capabilities.md @@ -0,0 +1,71 @@ +# Cursor ACP capability inventory + +Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. No billable prompt was sent ($0 of the assigned $25 budget); no explicit Cursor credential was available. Local authenticated execution, restrictive permission enforcement, dollar usage, and Daytona execution remain required qualification gates. + +The reference is the runner's Codex app-server integration and its closed thread-item inventory in `src/provider-events.ts`. Cursor ACP and its private extension methods are the transport; the legacy Cursor adapter is unchanged. + +## Evidence and packaging + +- [Cursor's ACP contract](https://cursor.com/docs/cli/acp) describes stdio JSON-RPC, sessions, permissions and five extensions. The pinned binary reveals additional capabilities and one material documentation discrepancy below. +- `packages/paperclip-runner/cursor-distributions.json` pins vendor archive and complete extracted execution-closure SHA256 digests for macOS ARM64/x64 and Linux x64. All three archives were downloaded and independently inventoried (446 files on macOS, 454 on Linux). A real macOS ARM64 installation passed the materializer's full closure check. +- The archive is a complete runtime: bundled `node`, `index.js`, dynamically loaded numbered JavaScript chunks, native addons, workers, and assets. Pinning only the launcher or one executable does not pin its execution dependencies. The materializer rejects links/special files and overwrites, and verifies every file against the pinned closure digest. +- `test/fixtures/cursor-acp/credential-free-probe.json` records an actual macOS ARM64 initialization and nonbillable method probes. `initialize` reports ACP v1, session load/list, HTTP/SSE MCP, image prompts, and opt-in subagent events. Audio and embedded context are false. `session/fork` and `session/resume` return method-not-found. Creating/listing a session requires authentication. +- Static evidence comes from `5672.index.js` (ACP implementation), `8096.index.js` (ACP SDK protocol schemas), `190.index.js` (hook paths) and `index.js` (CLI/configuration), all bound by the archive and closure pins. SDK schema support alone is not counted as implemented harness capability. + +## Capability matrix against Codex app-server + +“Implemented” below means a tested Cursor boundary implementation; the shared runtime must route its canonical events and durable requests. It is not a claim of authenticated end-to-end qualification. + +| Capability | Cursor harness/ACP evidence | Paperclip treatment | Remaining gap or qualification | +|---|---|---|---| +| Streaming assistant/reasoning | `agent_message_chunk`, `agent_thought_chunk` in live and replay presenters | Existing ACP streaming path | Authenticated event capture required | +| Tool lifecycle/input/output | `tool_call` and `tool_call_update`, including raw input/output, locations and content | Existing canonical tool lifecycle; Cursor extensions add semantic activity | Standard content blocks/diffs must survive shared ACPX mapping; evaluate captured field coverage | +| Human questions | `cursor/ask_question`, native single/multiple selections | `normalizeCursorQuestionRequest`: all questions required; opaque UI IDs round-trip native IDs; forged/duplicate/missing selections rejected | Cancellation and skip outcomes must be routed by shared durable request lifecycle | +| Proposed plans and decisions | `cursor/create_plan` with full Markdown, overview, todos, named phases and project flag | `normalizeCursorPlanRequest`: complete presentation; accept/reject/cancel; revision-derived question ID; rejection feedback | Shared question description must allow 100,000 chars. Oversize rejects; it is never truncated. No generated `planUri`, since no uploaded plan artifact is fabricated | +| Execution checklist | Standard ACP `plan` and `cursor/update_todos` (`merge`) | Per-turn reducer merges by native ID and emits complete snapshots with increasing revisions | Native cancelled status is visible as “Cancelled” with canonical blocked status, since canonical plan schema has no cancelled enum | +| Child activity | Optional `subagent_spawned`, `subagent_state_update`; metadata has tool-call/agent/model identity | Stateful child normalizer emits canonical delegation and retains role/task across state deltas; shared host must validate parent ownership | Requires client `_meta.subagents: true`. Nested transcript routing and child authority need end-to-end evidence | +| Completed subagent tasks | `cursor/task`: description, prompt, subtype, model, ID, duration | Canonical delegation with role, model, task and duration in activity summary | Dedicated numeric duration field absent from canonical delegation schema | +| Subagent questions | Pinned ACP subagent handler explicitly rejects interactive questions | No unsupported affordance advertised | Confirmed harness omission; requires upstream support | +| Generated images | `cursor/generate_image`: description, path and reference-image paths | Canonical generated/viewed artifact events; description notice; realpath/regular-file containment checks; `registered:false` | Paths are references, not automatic uploads. Revalidate before artifact ingestion. No image bytes invented | +| Files and diffs | Tool content/location extraction, native edit output | Existing workspace-diff machinery plus canonical tool events | Need live fixture proving complete before/after content and path attribution; currently unverified | +| True active-turn steering | No `session/steer`; `handlePrompt` cancels its existing pending prompt before starting another | Advertise steering unsupported | Concurrent prompt is interruption/replacement, not Codex-style in-place steering. Do not mislabel it | +| Queued follow-ups | No harness queue method discovered | Control-plane scheduling can send another prompt after settlement | No native queue-management events; do not send concurrently to emulate queueing | +| Cancellation | `session/cancel` calls the active prompt cancellation callback | Existing interruption path | Process/child cleanup and exact terminal settlement require live qualification | +| Turn settlement | Prompt implementation drains background subagent completion and awaits child publishers | Existing prompt result terminal boundary | Background shell commands and child errors need live denial/settlement fixtures | +| Session continuity | `session/new`, `session/load`; load replays historical messages, reasoning, tools, images and children | Existing session load/recovery boundary with identity fencing | Duplicate replay suppression and provider-death recovery need authenticated proof | +| Session discovery | `session/list` implemented, cwd filter absolute; pagination cursor rejected | Discovered and reported | Currently unused: runner recovers only its exact recorded session; arbitrary history browsing needs company-scoped discovery API | +| Fork/resume methods | `session/fork` and `session/resume` absent in agent implementation and return method-not-found | Unsupported | Session load is available; do not infer fork from SDK schema | +| Modes | `agent`, `plan`, `ask`; `session/set_mode` and `current_mode_update` | Existing review/mode activity plumbing can display changes | Generic operator mode-selection surface not implemented in this provider slice | +| Model selection | `session/set_model`, config option `model`, model-parameter options, `config_option_update`; `cursor/list_available_models` extension | Exact requested model must be selected/verified by shared admission | Available-model listing is authenticated; no model ID guessed or silently substituted. Parameterized model UI not added | +| Available commands | `available_commands_update`, including skills/slash commands | Existing ACP runtime event path | Command-specific UI/discovery not implemented; preserve bounded metadata where shared mapping permits | +| Session metadata | `session_info_update` title after automatic naming | Capability documented | Runner owns normalized session identity; provider title is currently not surfaced | +| Prompt media | Image=true, audio=false, embeddedContext=false in observed initialize | Image inputs may be admitted by advertised capability | Product attachment-to-ACP conversion needs qualified test; audio/embedded context unsupported | +| MCP and semantic tools | Session MCP injection supports stdio/HTTP/SSE; user/project config also loaded | Runner-owned authenticated MCP bridge only; fail closed on ambient project MCP | Exact tool discovery and company/token boundary remain live tests | +| Usage/cost | No `usage_update`/token-usage emission found in pinned ACP implementation; prompt result contains stopReason | Must report usage unavailable, never zero or estimates presented as actual | Dollar accounting unavailable without another explicit measured source. Live spend needs a measurable bound before starting | +| Reviews, compaction, hooks, memory | Native mode changes, hooks present internally; no dedicated ACP counterparts to Codex context/hook/memory lifecycle found | No fabricated event families | Distinguish confirmed absence of ACP event mapping from unverified native internals | +| Goal controls / lineage | No ACP goal or fork lineage protocol found | Unsupported | No equivalent of Codex native goals/thread lineage | + +## Wire and isolation findings + +The documentation calls todo/task/image methods notifications. The pinned presenter actually calls `connection.extMethod(...).catch(...)`: these messages can carry JSON-RPC IDs. They need immediate acknowledgement plus activity normalization. They must never become human input requests or block awaiting an unnecessary decision. + +Question and plan requests lack a session ID. The shared hook must bind them to the retained connection, active execution/session/turn and originating request ID; reject stale/duplicate answers; cancel on turn termination; persist requests before exposing them; and acknowledge provider delivery before settlement. The provider module does not substitute a best-guess session. + +Fixed launch arguments are `--disable-project-configs --disable-auto-update acp`, using the verified bundled Node and absolute verified `index.js`. Private HOME/XDG roots are required together with CURSOR_CONFIG_DIR, CURSOR_DATA_DIR, a private compile cache, `AGENT_CLI_CREDENTIAL_STORE=memory`, and `NO_OPEN_BROWSER=1`. Only explicitly bound CURSOR_API_KEY or CURSOR_AUTH_TOKEN may enter; never inherit shell credentials. Do not use `--force`, `--trust`, or `--approve-mcps` to paper over governance. + +`--disable-project-configs` only suppresses `.cursor/cli.json`. It does not suppress project MCP, Cursor/Claude hooks, or installed plugins. `assertCursorWorkspacePolicy` refuses ambient project execution config from the workspace through its nearest Git root, including symlinks and unreadable configuration. Ordinary Claude settings with neither hooks nor plugins remain admissible. Enterprise system hooks are checked too. The host must protect these config paths during execution and repeat admission checks on recovery. Admission alone cannot prevent a concurrent file mutation. Team-provided remote hooks are another upstream boundary and remain unqualified under restrictive execution. + +Artifact paths are never automatically read or uploaded. References require a present regular file under the physical workspace, reject traversal and symbolic links, and retain `registered:false`. Private/outside paths are omitted and produce a visible warning. This is metadata validation, not durable file ownership or a replacement for artifact registration checks. + +## Verification and open work + +Passed in the provider worktree: + +- 10 Cursor Vitest cases: questions, multi-selection, native ID round-trip, invalid answers, exact plan revisions, outcomes, todo delta merging, delegation metadata, path containment/symlink refusal, child identity retention, private launch defaults and project config gates. +- 5 materializer Node tests: platform pins, entire-tree tampering, linked paths, archive tampering before extraction, and overwrite refusal. +- Targeted strict TypeScript compilation for both provider modules and their imported contracts. +- Credential-free wire initialization and auth/method probes, plus real macOS ARM64 materialization and archive/closure inventories for the other two platforms. + +Priority follow-ups before advertising support: (1) shared hook integration with durable response/recovery tests; (2) descriptor/private-snapshot native distribution launch and guardian cleanup; (3) explicit credentials plus exact available model and measured dollar budget; (4) local and Daytona semantic tools, permissions, steering distinction, files/artifacts, questions/plans and settlement proof; (5) field-by-field captured trace audit to identify any additional unconsumed native fields. + +Remaining rich capabilities intentionally unused: session discovery, generic mode/config-option UI, provider session titles, command/skill picker metadata, nested child transcripts beyond delegation summaries, native numeric task duration, and optional planUri. They are listed above with reasons; neither “unsupported” nor “complete” should be inferred for unverified live behaviors. The final combined report must update this inventory with integration evidence and include any further events observed during authenticated qualification. diff --git a/packages/paperclip-runner/cursor-distributions.json b/packages/paperclip-runner/cursor-distributions.json new file mode 100644 index 00000000000..5aee5d15fcd --- /dev/null +++ b/packages/paperclip-runner/cursor-distributions.json @@ -0,0 +1,27 @@ +{ + "schema": "paperclip.cursor_distribution.v1", + "version": "2026.09.26-dd393fe", + "platforms": { + "darwin-arm64": { + "url": "https://downloads.cursor.com/lab/2026.09.26-dd393fe/darwin/arm64/agent-cli-package.tar.gz", + "archiveSha256": "538827d96a779bab854a865c8e42859e8e87db34b5f69770261b90fc8cfff191", + "closureSha256": "77394184a89b0e7384971181da19c3c82d83a399b04e7944b3f94fe3d7e62b25", + "executable": "node", + "entrypoint": "index.js" + }, + "darwin-x64": { + "url": "https://downloads.cursor.com/lab/2026.09.26-dd393fe/darwin/x64/agent-cli-package.tar.gz", + "archiveSha256": "ed1771c44cbf0f8059c67cac0d939e6a60eb730bd066d7dc4cbb14de314cfb6e", + "closureSha256": "7c8775160af74e5fb8d25a30e8412c1a6476b0661529078a686e5118fd1c5e5f", + "executable": "node", + "entrypoint": "index.js" + }, + "linux-x64": { + "url": "https://downloads.cursor.com/lab/2026.09.26-dd393fe/linux/x64/agent-cli-package.tar.gz", + "archiveSha256": "8085fd120f5c71f4eae7fea26a043718e5644e3071e4fab3220a0e58c51f9593", + "closureSha256": "bf04ef8ea6a63191067a6b3e15139aa2c793d8419daab246aa3f0a012e1bbcd9", + "executable": "node", + "entrypoint": "index.js" + } + } +} diff --git a/packages/paperclip-runner/scripts/materialize-cursor-distribution.mjs b/packages/paperclip-runner/scripts/materialize-cursor-distribution.mjs new file mode 100644 index 00000000000..ef961305545 --- /dev/null +++ b/packages/paperclip-runner/scripts/materialize-cursor-distribution.mjs @@ -0,0 +1,119 @@ +import { createHash } from "node:crypto"; +import { spawnSync } from "node:child_process"; +import { chmod, lstat, mkdir, mkdtemp, readFile, readdir, rename, rm, writeFile } from "node:fs/promises"; +import { dirname, join, resolve, sep } from "node:path"; +import { fileURLToPath, pathToFileURL } from "node:url"; + +const MANIFEST_PATH = fileURLToPath(new URL("../cursor-distributions.json", import.meta.url)); +const MAX_ARCHIVE_BYTES = 256 * 1024 * 1024; +const MAX_TREE_BYTES = 1024 * 1024 * 1024; +const TREE_MANIFEST = ".paperclip-cursor-closure.json"; +const digest = bytes => createHash("sha256").update(bytes).digest("hex"); + +export async function cursorDistribution(platform = process.platform, architecture = process.arch) { + const manifest = JSON.parse(await readFile(MANIFEST_PATH, "utf8")); + const distribution = manifest.platforms[`${platform}-${architecture}`]; + if (!distribution) throw new Error(`Cursor has no pinned distribution for ${platform}/${architecture}`); + return { ...distribution, version: manifest.version, platform, architecture }; +} + +/** Hash every runtime file, including bundled Node, native addons and workers. */ +export async function cursorDistributionClosure(directory) { + const entries = []; + let bytes = 0; + async function walk(root, prefix = "") { + const stat = await lstat(root); + if (!stat.isDirectory() || stat.isSymbolicLink()) throw new Error("Cursor closure contains a linked or non-directory root"); + for (const name of (await readdir(root)).sort()) { + if (prefix === "" && name === TREE_MANIFEST) continue; + const path = prefix ? `${prefix}/${name}` : name; + if (/[\u0000-\u001f\u007f\\]/.test(path)) throw new Error("Cursor closure contains an unsafe path"); + const absolute = join(root, name); + const before = await lstat(absolute); + if (before.isDirectory()) await walk(absolute, path); + else { + if (!before.isFile() || before.nlink !== 1) throw new Error("Cursor closure contains links or special files"); + bytes += before.size; + if (bytes > MAX_TREE_BYTES || entries.length >= 10_000) throw new Error("Cursor closure exceeds size limits"); + const source = await readFile(absolute); + const after = await lstat(absolute); + if (before.ino !== after.ino || before.dev !== after.dev || before.size !== after.size || before.mtimeMs !== after.mtimeMs || before.ctimeMs !== after.ctimeMs || source.length !== after.size || !after.isFile()) throw new Error("Cursor closure changed while being hashed"); + entries.push({ path, sha256: digest(source), size: source.length, executable: Boolean(after.mode & 0o111) }); + } + } + } + await walk(directory); + entries.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0); + return { entries, sha256: digest(JSON.stringify(entries)) }; +} + +export async function verifyCursorDistribution(directory, distribution) { + const closure = await cursorDistributionClosure(directory); + if (closure.sha256 !== distribution.closureSha256) throw new Error("Cursor full execution closure digest mismatch"); + for (const required of [distribution.executable, distribution.entrypoint]) { + if (!closure.entries.some(entry => entry.path === required)) throw new Error("Cursor execution closure is missing its entrypoint"); + } + return closure; +} + +/** A pinned archive only; never runs the vendor installer or discovers PATH. */ +export async function materializePinnedCursorDistribution(options = {}) { + const distribution = await cursorDistribution(options.platform, options.architecture); + if (!options.destination) throw new Error("Cursor materialization requires an explicit destination"); + const destination = resolve(options.destination); + await mkdir(dirname(destination), { recursive: true, mode: 0o700 }); + try { + await lstat(destination); + throw new Error("Cursor destination already exists; refusing to overwrite it"); + } catch (error) { if (error.code !== "ENOENT") throw error; } + const temporary = await mkdtemp(join(dirname(destination), ".cursor-install-")); + try { + let archive; + if (options.archivePath) { + const stat = await lstat(options.archivePath); + if (!stat.isFile() || stat.size > MAX_ARCHIVE_BYTES) throw new Error("Cursor archive must be a bounded regular file"); + archive = await readFile(options.archivePath); + } else { + const response = await fetch(distribution.url, { redirect: "error", signal: AbortSignal.timeout(180_000) }); + if (!response.ok || !response.body) throw new Error(`Cursor archive download failed: ${response.status}`); + const chunks = []; + let length = 0; + for await (const chunk of response.body) { + length += chunk.length; + if (length > MAX_ARCHIVE_BYTES) throw new Error("Cursor archive download exceeds size limit"); + chunks.push(chunk); + } + archive = Buffer.concat(chunks); + } + if (digest(archive) !== distribution.archiveSha256) throw new Error("Cursor archive digest mismatch"); + const archivePath = join(temporary, "archive.tar.gz"); + const unpacked = join(temporary, "unpacked"); + await writeFile(archivePath, archive, { mode: 0o600 }); + await mkdir(unpacked, { mode: 0o700 }); + // Only authenticated vendor archive bytes reach tar. Inspect entries first; + // links/special files are forbidden, and every path shares one fixed root. + for (const flag of ["-tzf", "-tvzf"]) { + const listing = spawnSync("/usr/bin/tar", [flag, archivePath], { encoding: "utf8", timeout: 30_000, maxBuffer: 4 * 1024 * 1024 }); + if (listing.status !== 0) throw new Error("Cursor archive listing failed"); + const lines = listing.stdout.trim().split("\n"); + if (flag === "-tzf" && lines.some(path => !path.startsWith("dist-package/") || path.split("/").includes("..") || /[\u0000-\u001f\u007f\\]/.test(path))) throw new Error("Cursor archive contains unsafe paths"); + if (flag === "-tvzf" && lines.some(line => !["-", "d"].includes(line[0]))) throw new Error("Cursor archive contains links or special entries"); + } + const extraction = spawnSync("/usr/bin/tar", ["-xzf", archivePath, "-C", unpacked, "--no-same-owner"], { encoding: "utf8", timeout: 120_000 }); + if (extraction.status !== 0) throw new Error("Cursor archive extraction failed"); + const packageRoot = join(unpacked, "dist-package"); + const closure = await verifyCursorDistribution(packageRoot, distribution); + // Record the pinned inventory for a later runtime lease. Its digest must be + // checked against the checked-in distribution pin before trusting entries. + await writeFile(join(packageRoot, TREE_MANIFEST), `${JSON.stringify({ schema: "paperclip.cursor_closure.v1", ...distribution, entries: closure.entries })}\n`, { mode: 0o600 }); + for (const entry of closure.entries) await chmod(join(packageRoot, ...entry.path.split("/")), entry.executable ? 0o500 : 0o400); + await chmod(packageRoot, 0o700); + await rename(packageRoot, destination); + return { version: distribution.version, platform: distribution.platform, architecture: distribution.architecture, destination, executable: join(destination, distribution.executable), entrypoint: join(destination, distribution.entrypoint), archiveSha256: distribution.archiveSha256, closureSha256: closure.sha256 }; + } finally { await rm(temporary, { recursive: true, force: true }); } +} + +if (process.argv[1] && pathToFileURL(resolve(process.argv[1])).href === import.meta.url) { + const [destination, platform, architecture, archivePath] = process.argv.slice(2); + process.stdout.write(`${JSON.stringify(await materializePinnedCursorDistribution({ destination, platform, architecture, archivePath }))}\n`); +} diff --git a/packages/paperclip-runner/scripts/materialize-cursor-distribution.test.mjs b/packages/paperclip-runner/scripts/materialize-cursor-distribution.test.mjs new file mode 100644 index 00000000000..14b45bf10a9 --- /dev/null +++ b/packages/paperclip-runner/scripts/materialize-cursor-distribution.test.mjs @@ -0,0 +1,54 @@ +import assert from "node:assert/strict"; +import { mkdtemp, mkdir, rm, symlink, writeFile } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { afterEach, test } from "node:test"; +import { cursorDistribution, cursorDistributionClosure, materializePinnedCursorDistribution, verifyCursorDistribution } from "./materialize-cursor-distribution.mjs"; + +const roots = []; +afterEach(async () => { await Promise.all(roots.splice(0).map(path => rm(path, { recursive: true, force: true }))); }); +async function fixture() { const path = await mkdtemp(join(tmpdir(), "cursor-distribution-test-")); roots.push(path); return path; } + +test("pins complete archives and closures for every supported platform", async () => { + for (const [platform, architecture] of [["darwin", "arm64"], ["darwin", "x64"], ["linux", "x64"]]) { + const distribution = await cursorDistribution(platform, architecture); + assert.equal(distribution.version, "2026.09.26-dd393fe"); + assert.match(distribution.archiveSha256, /^[a-f0-9]{64}$/); + assert.match(distribution.closureSha256, /^[a-f0-9]{64}$/); + assert.equal(distribution.url, `https://downloads.cursor.com/lab/${distribution.version}/${platform}/${architecture}/agent-cli-package.tar.gz`); + } + await assert.rejects(cursorDistribution("linux", "arm64"), /no pinned distribution/); +}); + +test("full closure verification catches changes outside the main entrypoint", async () => { + const root = await fixture(); + await writeFile(join(root, "node"), "node", { mode: 0o700 }); + await writeFile(join(root, "index.js"), "entry"); + await mkdir(join(root, "chunks")); await writeFile(join(root, "chunks", "worker.js"), "worker"); + const closure = await cursorDistributionClosure(root); + assert.deepEqual(closure.entries.map(entry => entry.path), ["chunks/worker.js", "index.js", "node"]); + const expected = { executable: "node", entrypoint: "index.js", closureSha256: closure.sha256 }; + await verifyCursorDistribution(root, expected); + await writeFile(join(root, "chunks", "worker.js"), "tampered"); + await assert.rejects(verifyCursorDistribution(root, expected), /closure digest mismatch/); +}); + +test("closure never accepts linked files or linked directories", async () => { + const root = await fixture(); const outside = await fixture(); + await writeFile(join(outside, "secret"), "secret"); + await symlink(join(outside, "secret"), join(root, "link")); + await assert.rejects(cursorDistributionClosure(root), /links or special files/); + await rm(join(root, "link")); await symlink(outside, join(root, "directory")); + await assert.rejects(cursorDistributionClosure(root), /links or special files/); +}); + +test("rejects altered archives before invoking tar and leaves no destination", async () => { + const root = await fixture(); const archivePath = join(root, "bad.tar.gz"); + await writeFile(archivePath, "not a pinned archive"); + await assert.rejects(materializePinnedCursorDistribution({ archivePath, destination: join(root, "out"), platform: "darwin", architecture: "arm64" }), /archive digest mismatch/); +}); + +test("refuses to overwrite any existing destination", async () => { + const root = await fixture(); await writeFile(join(root, "existing"), "keep"); + await assert.rejects(materializePinnedCursorDistribution({ destination: join(root, "existing") }), /already exists/); +}); diff --git a/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts new file mode 100644 index 00000000000..90de217b4d6 --- /dev/null +++ b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts @@ -0,0 +1,93 @@ +import { mkdtemp, mkdir, rm, symlink, writeFile } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { afterEach, describe, expect, it } from "vitest"; +import { PAPERCLIP_QUESTION_RESPONSE_SCHEMA } from "../../contracts/question-set.js"; +import { + createCursorNotificationNormalizer, createCursorSubagentNormalizer, cursorWorkspaceArtifactReference, + normalizeCursorPlanRequest, normalizeCursorQuestionRequest, normalizeCursorSubagentUpdate, +} from "./cursor-extensions.js"; + +const response = (answers: Record) => ({ schema: PAPERCLIP_QUESTION_RESPONSE_SCHEMA, answers }); +const roots: string[] = []; +afterEach(async () => { await Promise.all(roots.splice(0).map(root => rm(root, { recursive: true, force: true }))); }); +async function workspace() { const root = await mkdtemp(join(tmpdir(), "cursor-extension-")); roots.push(root); return root; } + +describe("Cursor blocking extension normalization", () => { + const question = { toolCallId: "call-1", title: "Choose scope", questions: [ + { id: "__proto__", prompt: "Which?", options: [{ id: "constructor", label: "A" }, { id: "second", label: "B" }] }, + { id: "many", prompt: "Select all", allowMultiple: true, options: [{ id: "x", label: "X" }, { id: "y", label: "Y" }] }, + ] }; + it("preserves native question/option identity and multi-select without exposing unsafe keys", () => { + const normalized = normalizeCursorQuestionRequest(question); + expect(normalized.accept(response({ "question-1": { selectedOptionIds: ["option-1"] }, "question-2": { selectedOptionIds: ["option-2", "option-1"] } }))).toEqual({ outcome: { outcome: "answered", answers: [ + { questionId: "__proto__", selectedOptionIds: ["constructor"] }, { questionId: "many", selectedOptionIds: ["y", "x"] }, + ] } }); + expect(normalized.cancel()).toEqual({ outcome: { outcome: "cancelled" } }); + expect(normalized.skip("not applicable")).toEqual({ outcome: { outcome: "skipped", reason: "not applicable" } }); + }); + it("rejects incomplete, forged, duplicate and multi-selected single answers", () => { + const normalized = normalizeCursorQuestionRequest(question); + expect(() => normalized.accept(response({}))).toThrow(); + for (const selectedOptionIds of [["forged"], ["option-1", "option-2"], ["option-1", "option-1"]]) { + expect(() => normalized.accept(response({ "question-1": { selectedOptionIds }, "question-2": { selectedOptionIds: ["option-1"] } }))).toThrow(); + } + expect(() => normalizeCursorQuestionRequest({ ...question, questions: [question.questions[0], question.questions[0]] })).toThrow("Duplicate"); + expect(() => normalizeCursorQuestionRequest({ ...question, questions: [{ ...question.questions[0], allowMultiple: "false" }] })).toThrow("boolean"); + }); + it("binds decisions to the full plan revision including phases and todos", () => { + const native = { toolCallId: "plan-1", name: "Migrate", overview: "Two steps", plan: "# Plan\n\nRead, then migrate.", todos: [{ id: "1", content: "Read", status: "pending" }], phases: [{ name: "Delivery", todos: [{ id: "2", content: "Migrate", status: "pending" }] }], isProject: true }; + const first = normalizeCursorPlanRequest(native); + const next = normalizeCursorPlanRequest({ ...native, plan: "# Plan\n\nDelete production data." }); + expect(first.questionSet.description).toContain(native.plan); + expect(first.questionSet.description).toContain("Phase: Delivery"); + expect(first.questionSet.description).toContain("[pending] Migrate"); + expect(first.revision).not.toBe(next.revision); + const accept = response({ [first.questionSet.questions[0]!.id]: { selectedOptionIds: ["accept"] } }); + expect(first.resolve(accept)).toEqual({ outcome: { outcome: "accepted" } }); + expect(() => next.resolve(accept)).toThrow(); + expect(first.resolve(response({ [first.questionSet.questions[0]!.id]: { selectedOptionIds: ["reject"] }, reason: { text: "Too broad" } }))).toEqual({ outcome: { outcome: "rejected", reason: "Too broad" } }); + expect(first.resolve(response({ [first.questionSet.questions[0]!.id]: { selectedOptionIds: ["cancel"] } }))).toEqual(first.cancel()); + }); + it("never truncates or fabricates approval of an oversized plan", () => { + expect(() => normalizeCursorPlanRequest({ toolCallId: "plan", plan: "x".repeat(100_001), todos: [] })).toThrow(); + expect(() => normalizeCursorPlanRequest({ toolCallId: "plan", plan: "x", todos: [{ id: "1", content: "x", status: "mystery" }] })).toThrow(); + }); +}); + +describe("Cursor rich notifications", () => { + it("merges todos into complete snapshots with increasing revisions and visible cancellation", async () => { + const normalize = createCursorNotificationNormalizer({ workspacePath: await workspace(), turnId: "turn-1" }); + const first = await normalize("cursor/update_todos", { toolCallId: "a", merge: false, todos: [{ id: "a", content: "Build", status: "pending" }] }); + const second = await normalize("cursor/update_todos", { toolCallId: "b", merge: true, todos: [{ id: "b", content: "Ship", status: "cancelled" }] }); + expect(second[0]?.payload).toMatchObject({ planId: first[0]?.payload.planId, revision: 2, complete: false, steps: [{ body: "Build", status: "pending" }, { body: "Ship\n(Cancelled)", status: "blocked" }] }); + const final = await normalize("cursor/update_todos", { toolCallId: "c", merge: false, todos: [{ id: "a", content: "Build", status: "completed" }] }); + expect(final[0]?.payload).toMatchObject({ revision: 3, complete: true, steps: [{ body: "Build", status: "completed" }] }); + }); + it("preserves delegation role/model/task and native duration", async () => { + const normalize = createCursorNotificationNormalizer({ workspacePath: await workspace(), turnId: "turn" }); + const [event] = await normalize("cursor/task", { toolCallId: "call", description: "Find references", prompt: "Search src", subagentType: { custom: "research" }, model: "model-1", agentId: "child-1", durationMs: 312 }); + expect(event).toMatchObject({ eventType: "delegation.completed", payload: { children: [{ role: "research", model: "model-1", summary: "Find references", activitySummary: "Search src\nDuration: 312 ms" }] } }); + }); + it("verifies generated image references and refuses symlinks, escapes, directories and missing files", async () => { + const root = await workspace(); + const inside = join(root, "workspace"); await mkdir(inside); await mkdir(join(inside, "outputs")); + await writeFile(join(inside, "outputs", "image.png"), "image"); await writeFile(join(root, "secret"), "private"); + await symlink(join(root, "secret"), join(inside, "link")); + await symlink(join(inside, "outputs"), join(inside, "linked-dir")); + expect(await cursorWorkspaceArtifactReference(inside, join(inside, "outputs", "image.png"))).toBe("outputs/image.png"); + for (const path of ["../secret", join(root, "secret"), "link", "linked-dir/image.png", "missing", "outputs", "outputs/evil\u0000.png", "C:\\secret"]) expect(await cursorWorkspaceArtifactReference(inside, path)).toBeNull(); + const normalize = createCursorNotificationNormalizer({ workspacePath: inside, turnId: "turn" }); + expect(await normalize("cursor/generate_image", { toolCallId: "image", description: "A diagram", filePath: "outputs/image.png" })).toMatchObject([{ eventType: "artifact.generated", payload: { reference: "outputs/image.png", registered: false } }, { eventType: "provider.notice.recorded", payload: { summary: "A diagram" } }]); + expect(await normalize("cursor/generate_image", { toolCallId: "image", description: "A diagram", filePath: "../secret" })).toMatchObject([{ payload: { reference: null } }, {}, { payload: { category: "cursor_artifact_path_rejected" } }]); + }); + it("maps opt-in subagent lifecycle without treating cancellation as completion", () => { + const base = { subagentSessionId: "child.2", _meta: { cursor: { toolCallId: "task-1", agentId: "child", model: "small" } } }; + expect(normalizeCursorSubagentUpdate({ ...base, sessionUpdate: "subagent_spawned", name: "Explore", task: "Find tests" })).toMatchObject({ eventType: "delegation.started", payload: { status: "running", children: [{ role: "Explore", model: "small", summary: "Find tests" }] } }); + expect(normalizeCursorSubagentUpdate({ ...base, sessionUpdate: "subagent_state_update", state: "cancelled" })).toMatchObject({ eventType: "delegation.completed", payload: { status: "interrupted" } }); + expect(normalizeCursorSubagentUpdate({ sessionUpdate: "agent_message_chunk" })).toBeNull(); + const normalize = createCursorSubagentNormalizer(); + normalize({ ...base, sessionUpdate: "subagent_spawned", name: "Explore", task: "Find tests" }); + expect(normalize({ ...base, sessionUpdate: "subagent_state_update", state: "completed" })).toMatchObject({ payload: { children: [{ role: "Explore", model: "small", summary: "Find tests", status: "completed" }] } }); + }); +}); diff --git a/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts new file mode 100644 index 00000000000..3ba52a0ad2a --- /dev/null +++ b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts @@ -0,0 +1,304 @@ +import { createHash } from "node:crypto"; +import { lstat, realpath } from "node:fs/promises"; +import { isAbsolute, relative, resolve, sep } from "node:path"; + +import { + PAPERCLIP_QUESTION_SET_SCHEMA, + parsePaperclipQuestionResponse, + parsePaperclipQuestionSet, + type PaperclipQuestionSet, +} from "../../contracts/question-set.js"; +import type { CanonicalProviderEvent } from "../../provider-events.js"; + +export const CURSOR_EXTENSION_REQUEST_METHODS = [ + "cursor/ask_question", "cursor/create_plan", +] as const; +// The pinned binary sends these with extMethod (a JSON-RPC ID), even though +// Cursor documents them as notifications. Acknowledge immediately with {}. +export const CURSOR_EXTENSION_NOTIFICATION_METHODS = [ + "cursor/update_todos", "cursor/task", "cursor/generate_image", +] as const; + +type CursorQuestionResult = { outcome: + | { outcome: "answered"; answers: Array<{ questionId: string; selectedOptionIds: string[] }> } + | { outcome: "skipped"; reason?: string } + | { outcome: "cancelled" } +}; +type CursorPlanResult = { outcome: + | { outcome: "accepted" } + | { outcome: "rejected"; reason?: string } + | { outcome: "cancelled" } +}; +type Todo = { id: string; content: string; status: "pending" | "in_progress" | "completed" | "cancelled" }; + +/** Native IDs are mapped through opaque UI IDs, including prototype-like keys. */ +export function normalizeCursorQuestionRequest(value: unknown): { + toolCallId: string; + questionSet: PaperclipQuestionSet; + accept(response: unknown): CursorQuestionResult; + resolve(response: unknown): CursorQuestionResult; + cancel(): CursorQuestionResult; + skip(reason?: string): CursorQuestionResult; +} { + const request = object(value); + const toolCallId = requiredText(request.toolCallId, "toolCallId", 1_000); + const nativeQuestions = array(request.questions, "questions", 64, true); + const seenQuestions = new Set(); + const bindings = nativeQuestions.map((raw, index) => { + const question = object(raw); + const nativeId = unique(requiredText(question.id, "question.id", 1_000), seenQuestions, "question ID"); + const seenOptions = new Set(); + if (question.allowMultiple !== undefined && typeof question.allowMultiple !== "boolean") { + throw new Error("Cursor allowMultiple must be boolean"); + } + const options = array(question.options, "options", 128, true).map((rawOption, optionIndex) => { + const option = object(rawOption); + return { + nativeId: unique(requiredText(option.id, "option.id", 1_000), seenOptions, "option ID"), + id: `option-${optionIndex + 1}`, + label: requiredText(option.label, "option.label", 1_000), + }; + }); + return { + nativeId, options, + question: { + id: `question-${index + 1}`, + prompt: requiredText(question.prompt, "question.prompt", 4_000), + required: true, + answerMode: question.allowMultiple === true ? "multi_select" as const : "single_select" as const, + options: options.map(({ id, label }) => ({ id, label })), + }, + }; + }); + const questionSet = parsePaperclipQuestionSet({ + schema: PAPERCLIP_QUESTION_SET_SCHEMA, + title: optionalText(request.title, "title", 1_000) ?? "Cursor needs input", + questions: bindings.map(({ question }) => question), + }); + const accept = (response: unknown): CursorQuestionResult => { + const parsed = parsePaperclipQuestionResponse(questionSet, response); + return { outcome: { outcome: "answered", answers: bindings.map(binding => ({ + questionId: binding.nativeId, + selectedOptionIds: (parsed.answers[binding.question.id]?.selectedOptionIds ?? []).map(id => { + const option = binding.options.find(candidate => candidate.id === id); + if (!option) throw new Error("Cursor question option is no longer available"); + return option.nativeId; + }), + })) } }; + }; + return { + toolCallId, questionSet, accept, resolve: accept, + cancel: () => ({ outcome: { outcome: "cancelled" } }), + skip: (reason?: string) => ({ outcome: { outcome: "skipped", ...(reason === undefined ? {} : { reason: requiredText(reason, "reason", 4_000) }) } }), + }; +} + +/** The approval question ID binds the entire displayed revision, not its title. */ +export function normalizeCursorPlanRequest(value: unknown): { + toolCallId: string; + revision: string; + questionSet: PaperclipQuestionSet; + resolve(response: unknown): CursorPlanResult; + cancel(): CursorPlanResult; +} { + const request = object(value); + const toolCallId = requiredText(request.toolCallId, "toolCallId", 1_000); + const plan = requiredText(request.plan, "plan", 100_000); + const name = optionalText(request.name, "name", 1_000); + const overview = optionalText(request.overview, "overview", 4_000); + const todos = parseTodos(request.todos); + const phases = request.phases === undefined ? [] : array(request.phases, "phases", 64).map(value => { + const phase = object(value); + return { name: requiredText(phase.name, "phase.name", 1_000), todos: parseTodos(phase.todos) }; + }); + if (request.isProject !== undefined && typeof request.isProject !== "boolean") throw new Error("Cursor isProject must be boolean"); + const description = [overview, plan, todos.length ? `Todos\n${renderTodos(todos)}` : undefined, + ...phases.map(phase => `Phase: ${phase.name}\n${renderTodos(phase.todos)}`), + request.isProject === true ? "This is a project plan." : undefined, + ].filter((part): part is string => part !== undefined).join("\n\n"); + // Reject rather than truncating a document that a person must approve. + requiredText(description, "complete plan presentation", 100_000); + const revision = createHash("sha256").update(JSON.stringify({ toolCallId, name, overview, plan, todos, phases, isProject: request.isProject ?? false })).digest("hex"); + const questionId = `plan-${revision}`; + const questionSet = parsePaperclipQuestionSet({ + schema: PAPERCLIP_QUESTION_SET_SCHEMA, + title: name ?? "Review Cursor's plan", description, submitLabel: "Send decision", + questions: [{ id: questionId, prompt: "How should Cursor proceed with this plan?", required: true, + answerMode: "single_select", options: [ + { id: "accept", label: "Accept plan" }, + { id: "reject", label: "Reject plan" }, + { id: "cancel", label: "Cancel plan request" }, + ] }, { id: "reason", prompt: "Reason for rejecting the plan (optional)", required: false, + answerMode: "text", textValidation: { maxLength: 4_000 } }], + }); + return { + toolCallId, revision, questionSet, + resolve(response: unknown): CursorPlanResult { + const parsed = parsePaperclipQuestionResponse(questionSet, response); + const decision = parsed.answers[questionId]?.selectedOptionIds?.[0]; + const reason = parsed.answers.reason?.text; + if (decision === "accept") { + if (reason?.trim()) throw new Error("Cursor's accepted outcome cannot carry feedback; remove feedback or reject the plan"); + return { outcome: { outcome: "accepted" } }; + } + if (decision === "reject") return { outcome: { outcome: "rejected", ...(reason ? { reason } : {}) } }; + return { outcome: { outcome: "cancelled" } }; + }, + cancel: () => ({ outcome: { outcome: "cancelled" } }), + }; +} + +/** Create one reducer per active turn; Cursor todo updates are deltas. */ +export function createCursorNotificationNormalizer(input: { workspacePath: string; turnId: string }) { + let todos = new Map(); + let revision = 0; + const planId = stableId(`cursor-plan:${input.turnId}`); + return async (method: string, value: unknown): Promise => { + const request = object(value); + const toolCallId = requiredText(request.toolCallId, "toolCallId", 1_000); + const itemId = stableId(toolCallId); + if (method === "cursor/update_todos") { + if (typeof request.merge !== "boolean") throw new Error("Cursor todo merge must be boolean"); + const next = request.merge ? new Map(todos) : new Map(); + for (const todo of parseTodos(request.todos)) next.set(todo.id, todo); + if (next.size > 256) throw new Error("Cursor todo snapshot exceeds 256 items"); + todos = next; + return [{ eventType: "plan.updated", itemId, payload: { + schema: "paperclip.plan.updated.v1", planId, revision: ++revision, + explanation: null, + steps: Array.from(todos.values(), todo => ({ stepId: stableId(todo.id), + body: todo.status === "cancelled" ? `${todo.content}\n(Cancelled)` : todo.content, + status: todo.status === "cancelled" ? "blocked" : todo.status })), + complete: todos.size > 0 && Array.from(todos.values()).every(todo => todo.status === "completed"), + syncStatus: "not_applicable", documentRevision: null, + } }]; + } + if (method === "cursor/task") { + const subtype = typeof request.subagentType === "string" ? request.subagentType : object(request.subagentType).custom; + const durationMs = request.durationMs; + if (durationMs !== undefined && (!Number.isSafeInteger(durationMs) || Number(durationMs) < 0)) throw new Error("Cursor task duration must be a nonnegative integer"); + return [{ eventType: "delegation.completed", itemId, payload: { + schema: "paperclip.delegation.v1", delegationId: itemId, action: "spawn", status: "completed", + children: [{ childId: stableId(optionalText(request.agentId, "agentId", 1_000) ?? toolCallId), + role: optionalText(subtype, "subagentType", 160) ?? null, + model: optionalText(request.model, "model", 240) ?? null, status: "completed", + summary: requiredText(request.description, "description", 4_000), + activitySummary: [requiredText(request.prompt, "prompt", 3_800), durationMs === undefined ? undefined : `Duration: ${durationMs} ms`].filter(Boolean).join("\n"), + }], + } }]; + } + if (method === "cursor/generate_image") { + const description = requiredText(request.description, "description", 4_000); + const filePath = optionalText(request.filePath, "filePath", 4_096); + const reference = filePath === undefined ? null : await cursorWorkspaceArtifactReference(input.workspacePath, filePath); + const references = request.referenceImagePaths === undefined ? [] : array(request.referenceImagePaths, "referenceImagePaths", 16); + const viewed: CanonicalProviderEvent[] = []; + for (let index = 0; index < references.length; index++) { + const source = requiredText(references[index], "referenceImagePath", 4_096); + const reference = await cursorWorkspaceArtifactReference(input.workspacePath, source); + const referenceId = stableId(`${toolCallId}:reference:${index}`); + viewed.push({ eventType: "artifact.viewed", itemId: referenceId, payload: { + schema: "paperclip.artifact.viewed.v1", artifactId: referenceId, reference, mediaType: "image/*", title: "Cursor image reference", + } }); + } + return [{ eventType: "artifact.generated", itemId, payload: { + schema: "paperclip.artifact.generated.v1", artifactId: itemId, + status: "completed", reference, mediaType: "image/*", registered: false, failure: null, + } }, notice(`${toolCallId}:description`, "cursor_image", description), + ...viewed, + ...(filePath && reference === null ? [notice(`${toolCallId}:path`, "cursor_artifact_path_rejected", "Cursor reported an image location that could not be verified inside this workspace.", "warning")] : [])]; + } + throw new Error(`Unsupported Cursor notification method ${method}`); + }; +} + +/** References are hints, never instructions to read/upload paths. Revalidate on use. */ +export async function cursorWorkspaceArtifactReference(workspacePath: string, filePath: string): Promise { + if (!filePath || /[\u0000-\u001f\u007f]/.test(filePath) || filePath.includes("\\")) return null; + try { + const workspace = await realpath(workspacePath); + // macOS commonly presents /var while realpath returns /private/var. + let lexical = relative(resolve(workspacePath), resolve(workspacePath, filePath)); + if (!contained(lexical) && isAbsolute(filePath)) lexical = relative(workspace, filePath); + if (!contained(lexical)) return null; + const target = resolve(workspace, lexical); + const physical = await realpath(target); + const physicalRelative = relative(workspace, physical); + if (!contained(physicalRelative) || physical !== target || !(await lstat(target)).isFile()) return null; + return physicalRelative.split(sep).join("/"); + } catch { return null; } +} + +/** Call only after the host has verified parent-session/child-session ownership. */ +export function normalizeCursorSubagentUpdate(value: unknown): CanonicalProviderEvent | null { + const update = object(value); + if (update.sessionUpdate !== "subagent_spawned" && update.sessionUpdate !== "subagent_state_update") return null; + const metadata = object(object(update._meta).cursor); + const itemId = stableId(requiredText(metadata.toolCallId, "subagent toolCallId", 1_000)); + const state = update.sessionUpdate === "subagent_spawned" ? "running" : update.state; + const status = state === "cancelled" ? "interrupted" : state; + if (!["running", "completed", "failed", "interrupted"].includes(String(status))) throw new Error("Unknown Cursor subagent state"); + return { eventType: status === "running" ? "delegation.started" : "delegation.completed", itemId, payload: { + schema: "paperclip.delegation.v1", delegationId: itemId, action: "spawn", status, + children: [{ childId: stableId(requiredText(update.subagentSessionId, "subagentSessionId", 1_000)), + role: optionalText(update.name, "name", 160) ?? null, model: optionalText(metadata.model, "model", 240) ?? null, + status, summary: optionalText(update.task, "task", 4_000) ?? null, activitySummary: null }], + } }; +} + +/** Preserve identity across delta state updates; use a fresh reducer per turn. */ +export function createCursorSubagentNormalizer() { + const children = new Map>(); + return (value: unknown): CanonicalProviderEvent | null => { + const update = object(value); + if (update.sessionUpdate !== "subagent_spawned" && update.sessionUpdate !== "subagent_state_update") return null; + const id = requiredText(update.subagentSessionId, "subagentSessionId", 1_000); + const previous = children.get(id); + if (!previous && children.size >= 256) throw new Error("Cursor subagent inventory exceeds 256 children"); + const merged = { ...previous, ...update, _meta: { + cursor: { ...(previous ? object(object(previous._meta).cursor) : {}), ...object(object(update._meta).cursor) }, + } }; + const normalized = normalizeCursorSubagentUpdate(merged); + children.set(id, merged); + return normalized; + }; +} + +function notice(id: string, category: string, summary: string, severity: "info" | "warning" = "info"): CanonicalProviderEvent { + const itemId = stableId(id); + return { eventType: "provider.notice.recorded", itemId, payload: { + schema: "paperclip.provider.notice.v1", noticeId: itemId, severity, category, + scope: "turn", recoverable: true, userActionable: false, summary, + } }; +} +function parseTodos(value: unknown): Todo[] { + const seen = new Set(); + return array(value, "todos", 256).map(raw => { + const todo = object(raw); + if (!["pending", "in_progress", "completed", "cancelled"].includes(String(todo.status))) throw new Error("Unknown Cursor todo status"); + return { id: unique(requiredText(todo.id, "todo.id", 1_000), seen, "todo ID"), + content: requiredText(todo.content, "todo.content", 3_980), status: todo.status as Todo["status"] }; + }); +} +function renderTodos(todos: Todo[]): string { return todos.map(todo => `- [${todo.status}] ${todo.content}`).join("\n"); } +function stableId(value: string): string { return `cursor-${createHash("sha256").update(value).digest("hex")}`; } +function contained(path: string): boolean { return path !== "" && path !== ".." && !path.startsWith(`..${sep}`) && !isAbsolute(path); } +function object(value: unknown): Record { + if (value === null || typeof value !== "object" || Array.isArray(value)) throw new Error("Cursor payload must be an object"); + return value as Record; +} +function array(value: unknown, field: string, max: number, nonempty = false): unknown[] { + if (!Array.isArray(value) || value.length > max || (nonempty && value.length === 0)) throw new Error(`Cursor ${field} must contain ${nonempty ? "1" : "0"} through ${max} items`); + return value; +} +function optionalText(value: unknown, field: string, max: number): string | undefined { + return value === undefined ? undefined : requiredText(value, field, max); +} +function requiredText(value: unknown, field: string, max: number): string { + if (typeof value !== "string" || value.length === 0 || value.length > max || value.includes("\0")) throw new Error(`Cursor ${field} must be nonempty text of at most ${max} characters`); + return value; +} +function unique(value: string, seen: Set, field: string): string { + if (seen.has(value)) throw new Error(`Duplicate Cursor ${field}`); + seen.add(value); return value; +} diff --git a/packages/paperclip-runner/src/drivers/acpx/cursor-launch-policy.test.ts b/packages/paperclip-runner/src/drivers/acpx/cursor-launch-policy.test.ts new file mode 100644 index 00000000000..7c110085d8d --- /dev/null +++ b/packages/paperclip-runner/src/drivers/acpx/cursor-launch-policy.test.ts @@ -0,0 +1,25 @@ +import { mkdtemp, mkdir, rm, symlink, writeFile } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { afterEach, expect, it } from "vitest"; +import { assertCursorWorkspacePolicy, CURSOR_FIXED_ARGUMENTS, cursorPrivateEnvironment } from "./cursor-launch-policy.js"; +const roots: string[] = []; +afterEach(async () => { await Promise.all(roots.splice(0).map(root => rm(root, { recursive: true, force: true }))); }); +async function fixture() { const root = await mkdtemp(join(tmpdir(), "cursor-policy-")); roots.push(root); await mkdir(join(root, "project")); await mkdir(join(root, ".git")); return root; } +it("uses fixed update/project config flags and memory-only credential storage", () => { + expect(CURSOR_FIXED_ARGUMENTS).toEqual(["--disable-project-configs", "--disable-auto-update", "acp"]); + expect(cursorPrivateEnvironment({ agentHomeDirectory: "/private/home", dataDirectory: "/private/data", cacheDirectory: "/private/cache" })).toEqual({ CURSOR_CONFIG_DIR: "/private/home", CURSOR_DATA_DIR: "/private/data", NODE_COMPILE_CACHE: "/private/cache/cursor-compile-cache", AGENT_CLI_CREDENTIAL_STORE: "memory", NO_OPEN_BROWSER: "1" }); +}); +it("rejects parent-root MCP/hooks and symlinked config, while leaving ordinary Claude settings alone", async () => { + const root = await fixture(); const project = join(root, "project"); + await assertCursorWorkspacePolicy(project); + await mkdir(join(root, ".claude")); await writeFile(join(root, ".claude", "settings.json"), JSON.stringify({ model: "x" })); + await assertCursorWorkspacePolicy(project); + await writeFile(join(root, ".claude", "settings.json"), JSON.stringify({ hooks: {} })); + await expect(assertCursorWorkspacePolicy(project)).rejects.toThrow("ambient execution configuration"); + await rm(join(root, ".claude"), { recursive: true }); await mkdir(join(root, ".cursor")); + await writeFile(join(root, ".cursor", "mcp.json"), "{}"); + await expect(assertCursorWorkspacePolicy(project)).rejects.toThrow("mcp.json"); + await rm(join(root, ".cursor", "mcp.json")); await symlink("missing", join(root, ".cursor", "hooks.json")); + await expect(assertCursorWorkspacePolicy(project)).rejects.toThrow("hooks.json"); +}); diff --git a/packages/paperclip-runner/src/drivers/acpx/cursor-launch-policy.ts b/packages/paperclip-runner/src/drivers/acpx/cursor-launch-policy.ts new file mode 100644 index 00000000000..19dfa2f6d98 --- /dev/null +++ b/packages/paperclip-runner/src/drivers/acpx/cursor-launch-policy.ts @@ -0,0 +1,62 @@ +import { lstat, readFile, realpath } from "node:fs/promises"; +import { dirname, join } from "node:path"; + +export const CURSOR_PINNED_VERSION = "2026.09.26-dd393fe"; +export const CURSOR_FIXED_ARGUMENTS = ["--disable-project-configs", "--disable-auto-update", "acp"] as const; +export const CURSOR_CREDENTIAL_ENVIRONMENT_NAMES = ["CURSOR_API_KEY", "CURSOR_AUTH_TOKEN"] as const; + +/** Add only after the shared launcher has created and pinned private roots. */ +export function cursorPrivateEnvironment(paths: { agentHomeDirectory: string; dataDirectory: string; cacheDirectory: string }): NodeJS.ProcessEnv { + return { + CURSOR_CONFIG_DIR: paths.agentHomeDirectory, + CURSOR_DATA_DIR: paths.dataDirectory, + NODE_COMPILE_CACHE: join(paths.cacheDirectory, "cursor-compile-cache"), + AGENT_CLI_CREDENTIAL_STORE: "memory", + NO_OPEN_BROWSER: "1", + }; +} + +/** + * Cursor's disable-project-configs flag covers cli.json only. Its MCP/hook + * loaders still read these paths. Refuse ambient execution configuration rather + * than mutating the user's project. The host must protect these paths throughout + * the run and keep the same check on recovery; admission alone is not a sandbox. + */ +export async function assertCursorWorkspacePolicy(workspacePath: string, platform: NodeJS.Platform = process.platform): Promise { + const paths: Array<{ path: string; inspectClaude?: boolean }> = []; + const workspace = await realpath(workspacePath); + let directory = workspace; + const ancestors: string[] = []; + let foundRepository = false; + while (true) { + ancestors.push(directory); + try { await lstat(join(directory, ".git")); foundRepository = true; break; } + catch (error) { if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw new Error("Cursor project root could not be inspected"); } + const parent = dirname(directory); + if (parent === directory) break; + directory = parent; + } + for (const directory of foundRepository ? ancestors : [workspace]) { + paths.push( + { path: join(directory, ".cursor", "mcp.json") }, + { path: join(directory, ".cursor", "hooks.json") }, + { path: join(directory, ".cursor", "plugins") }, + { path: join(directory, ".claude", "plugins") }, + { path: join(directory, ".claude", "settings.json"), inspectClaude: true }, + { path: join(directory, ".claude", "settings.local.json"), inspectClaude: true }, + ); + } + paths.push({ path: platform === "darwin" ? "/Library/Application Support/Cursor/hooks.json" : "/etc/cursor/hooks.json" }); + for (const { path, inspectClaude } of paths) { + let metadata; + try { metadata = await lstat(path); } + catch (error) { if ((error as NodeJS.ErrnoException).code === "ENOENT") continue; throw new Error("Cursor ambient execution configuration could not be inspected"); } + if (inspectClaude && metadata.isFile() && !metadata.isSymbolicLink() && metadata.size <= 64 * 1024) { + try { + const config: unknown = JSON.parse(await readFile(path, "utf8")); + if (config !== null && typeof config === "object" && !Array.isArray(config) && !("hooks" in config) && !("enabledPlugins" in config)) continue; + } catch { /* Unreadable or invalid execution config cannot be admitted. */ } + } + throw new Error(`Cursor ambient execution configuration is not allowed in an isolated runner: ${path}`); + } +} diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/credential-free-probe.json b/packages/paperclip-runner/test/fixtures/cursor-acp/credential-free-probe.json new file mode 100644 index 00000000000..37d7f4675c9 --- /dev/null +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/credential-free-probe.json @@ -0,0 +1,152 @@ +{ + "version": "2026.09.26-dd393fe", + "requests": [ + { + "method": "initialize", + "params": { + "protocolVersion": 1, + "clientCapabilities": { + "fs": { + "readTextFile": false, + "writeTextFile": false + }, + "terminal": false, + "_meta": { + "subagents": true + } + }, + "clientInfo": { + "name": "paperclip-qualification-probe", + "version": "1" + } + } + }, + { + "method": "session/list", + "params": {} + }, + { + "method": "session/fork", + "params": { + "sessionId": "probe" + } + }, + { + "method": "session/resume", + "params": { + "sessionId": "probe", + "cwd": "/qualification/workspace", + "mcpServers": [] + } + }, + { + "method": "_cursor/list_available_models", + "params": {} + }, + { + "method": "session/new", + "params": { + "cwd": "/qualification/workspace", + "mcpServers": [] + } + } + ], + "responses": [ + { + "jsonrpc": "2.0", + "id": 1, + "result": { + "protocolVersion": 1, + "agentCapabilities": { + "loadSession": true, + "mcpCapabilities": { + "http": true, + "sse": true + }, + "promptCapabilities": { + "audio": false, + "embeddedContext": false, + "image": true + }, + "sessionCapabilities": { + "list": {}, + "subagents": {} + } + }, + "authMethods": [ + { + "id": "cursor_login", + "name": "Cursor Login", + "description": "Authenticate using existing Cursor login credentials. Run 'agent login' first if not logged in." + } + ] + } + }, + { + "jsonrpc": "2.0", + "id": 2, + "error": { + "code": -32000, + "message": "Authentication required", + "data": { + "message": "Authentication required. Please run 'agent login' first, then call authenticate() with methodId 'cursor_login'." + } + } + }, + { + "jsonrpc": "2.0", + "id": 3, + "error": { + "code": -32601, + "message": "\"Method not found\": session/fork", + "data": { + "method": "session/fork" + } + } + }, + { + "jsonrpc": "2.0", + "id": 4, + "error": { + "code": -32601, + "message": "\"Method not found\": session/resume", + "data": { + "method": "session/resume" + } + } + }, + { + "jsonrpc": "2.0", + "id": 5, + "error": { + "code": -32601, + "message": "\"Method not found\": _cursor/list_available_models", + "data": { + "method": "_cursor/list_available_models" + } + } + }, + { + "jsonrpc": "2.0", + "id": 6, + "error": { + "code": -32000, + "message": "Authentication required", + "data": { + "message": "Authentication required. Please run 'agent login' first, then call authenticate() with methodId 'cursor_login'." + } + } + } + ], + "provenance": { + "capturedAt": "2026-09-28", + "platform": "darwin-arm64", + "archiveSha256": "538827d96a779bab854a865c8e42859e8e87db34b5f69770261b90fc8cfff191", + "billablePrompts": 0, + "auth": "no credentials; private home; in-memory credential store", + "capture": "spawn bundled node with index.js --disable-auto-update acp; newline JSON-RPC; sequential response collection", + "redactions": [ + "private temporary workspace path replaced with /qualification/workspace" + ] + } +} From 72d7bbc9b854e95eb5228c89328ac7d80ff16f76 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 11:14:41 -0500 Subject: [PATCH 02/31] Bound full Cursor plan presentation by durable payload size Co-Authored-By: Paperclip --- doc/architecture/runner-cursor-capabilities.md | 6 ++++-- .../src/drivers/acpx/cursor-extensions.test.ts | 3 +++ .../src/drivers/acpx/cursor-extensions.ts | 10 ++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index d63ec6e8073..9f7312ac6d7 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -21,7 +21,7 @@ The reference is the runner's Codex app-server integration and its closed thread | Streaming assistant/reasoning | `agent_message_chunk`, `agent_thought_chunk` in live and replay presenters | Existing ACP streaming path | Authenticated event capture required | | Tool lifecycle/input/output | `tool_call` and `tool_call_update`, including raw input/output, locations and content | Existing canonical tool lifecycle; Cursor extensions add semantic activity | Standard content blocks/diffs must survive shared ACPX mapping; evaluate captured field coverage | | Human questions | `cursor/ask_question`, native single/multiple selections | `normalizeCursorQuestionRequest`: all questions required; opaque UI IDs round-trip native IDs; forged/duplicate/missing selections rejected | Cancellation and skip outcomes must be routed by shared durable request lifecycle | -| Proposed plans and decisions | `cursor/create_plan` with full Markdown, overview, todos, named phases and project flag | `normalizeCursorPlanRequest`: complete presentation; accept/reject/cancel; revision-derived question ID; rejection feedback | Shared question description must allow 100,000 chars. Oversize rejects; it is never truncated. No generated `planUri`, since no uploaded plan artifact is fabricated | +| Proposed plans and decisions | `cursor/create_plan` with full Markdown, overview, todos, named phases and project flag | `normalizeCursorPlanRequest`: complete presentation; accept/reject/cancel; revision-derived question ID; rejection feedback | Foundation question descriptions allow 100,000 chars; this boundary also enforces the 196 KiB UTF-8 durable payload cap. Oversize rejects; it is never truncated. No generated `planUri`, since no uploaded plan artifact is fabricated | | Execution checklist | Standard ACP `plan` and `cursor/update_todos` (`merge`) | Per-turn reducer merges by native ID and emits complete snapshots with increasing revisions | Native cancelled status is visible as “Cancelled” with canonical blocked status, since canonical plan schema has no cancelled enum | | Child activity | Optional `subagent_spawned`, `subagent_state_update`; metadata has tool-call/agent/model identity | Stateful child normalizer emits canonical delegation and retains role/task across state deltas; shared host must validate parent ownership | Requires client `_meta.subagents: true`. Nested transcript routing and child authority need end-to-end evidence | | Completed subagent tasks | `cursor/task`: description, prompt, subtype, model, ID, duration | Canonical delegation with role, model, task and duration in activity summary | Dedicated numeric duration field absent from canonical delegation schema | @@ -66,6 +66,8 @@ Passed in the provider worktree: - Targeted strict TypeScript compilation for both provider modules and their imported contracts. - Credential-free wire initialization and auth/method probes, plus real macOS ARM64 materialization and archive/closure inventories for the other two platforms. -Priority follow-ups before advertising support: (1) shared hook integration with durable response/recovery tests; (2) descriptor/private-snapshot native distribution launch and guardian cleanup; (3) explicit credentials plus exact available model and measured dollar budget; (4) local and Daytona semantic tools, permissions, steering distinction, files/artifacts, questions/plans and settlement proof; (5) field-by-field captured trace audit to identify any additional unconsumed native fields. +The generic native-distribution lease now snapshots the pinned closure, launches Cursor through its verified bundled Node with a closed-module guard, and uses the existing lifetime guardian. A real nonbillable Cursor initialization passed through that lease. Its six focused tests passed, including argument fencing, external module rejection, and native child ownership/exit proof. The existing snapshot suite passed; four legacy installation tests were blocked by the shared installed Claude SDK (0.3.280 versus the pinned 0.3.263), with the remaining legacy tests passing or platform-skipped. + +Priority follow-ups before advertising support: (1) shared hook integration with durable response/recovery tests; (2) authenticated native lifetime and cleanup proof; (3) explicit credentials plus exact available model and measured dollar budget; (4) local and Daytona semantic tools, permissions, steering distinction, files/artifacts, questions/plans and settlement proof; (5) field-by-field captured trace audit to identify any additional unconsumed native fields. Remaining rich capabilities intentionally unused: session discovery, generic mode/config-option UI, provider session titles, command/skill picker metadata, nested child transcripts beyond delegation summaries, native numeric task duration, and optional planUri. They are listed above with reasons; neither “unsupported” nor “complete” should be inferred for unverified live behaviors. The final combined report must update this inventory with integration evidence and include any further events observed during authenticated qualification. diff --git a/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts index 90de217b4d6..439a5f0c830 100644 --- a/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts +++ b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts @@ -52,6 +52,9 @@ describe("Cursor blocking extension normalization", () => { it("never truncates or fabricates approval of an oversized plan", () => { expect(() => normalizeCursorPlanRequest({ toolCallId: "plan", plan: "x".repeat(100_001), todos: [] })).toThrow(); expect(() => normalizeCursorPlanRequest({ toolCallId: "plan", plan: "x", todos: [{ id: "1", content: "x", status: "mystery" }] })).toThrow(); + const full = "Details\n".repeat(1_000); + expect(normalizeCursorPlanRequest({ toolCallId: "plan", plan: full, todos: [] }).questionSet.description).toBe(full); + expect(() => normalizeCursorPlanRequest({ toolCallId: "plan", plan: "漢".repeat(90_000), todos: [] })).toThrow("byte bound"); }); }); diff --git a/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts index 3ba52a0ad2a..0b6727a1257 100644 --- a/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts +++ b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts @@ -70,7 +70,7 @@ export function normalizeCursorQuestionRequest(value: unknown): { }, }; }); - const questionSet = parsePaperclipQuestionSet({ + const questionSet = boundedQuestionSet({ schema: PAPERCLIP_QUESTION_SET_SCHEMA, title: optionalText(request.title, "title", 1_000) ?? "Cursor needs input", questions: bindings.map(({ question }) => question), @@ -120,7 +120,7 @@ export function normalizeCursorPlanRequest(value: unknown): { requiredText(description, "complete plan presentation", 100_000); const revision = createHash("sha256").update(JSON.stringify({ toolCallId, name, overview, plan, todos, phases, isProject: request.isProject ?? false })).digest("hex"); const questionId = `plan-${revision}`; - const questionSet = parsePaperclipQuestionSet({ + const questionSet = boundedQuestionSet({ schema: PAPERCLIP_QUESTION_SET_SCHEMA, title: name ?? "Review Cursor's plan", description, submitLabel: "Send decision", questions: [{ id: questionId, prompt: "How should Cursor proceed with this plan?", required: true, @@ -271,6 +271,12 @@ function notice(id: string, category: string, summary: string, severity: "info" scope: "turn", recoverable: true, userActionable: false, summary, } }; } +function boundedQuestionSet(value: unknown): PaperclipQuestionSet { + const parsed = parsePaperclipQuestionSet(value); + // Match the durable Rust question payload bound, including UTF-8 expansion. + if (Buffer.byteLength(JSON.stringify(parsed)) > 196 * 1024) throw new Error("Cursor question presentation exceeds the durable input byte bound"); + return parsed; +} function parseTodos(value: unknown): Todo[] { const seen = new Set(); return array(value, "todos", 256).map(raw => { From e2000ca283d4fa5ddad9db7371c92bfe4bea085d Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 11:27:28 -0500 Subject: [PATCH 03/31] Bind Cursor rich input and activity adapters to an active parent turn Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 8 +- .../drivers/acpx/cursor-extensions.test.ts | 52 +++++++++++- .../src/drivers/acpx/cursor-extensions.ts | 80 +++++++++++++++++++ 3 files changed, 136 insertions(+), 4 deletions(-) diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index 9f7312ac6d7..ec582ddbcef 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -20,10 +20,10 @@ The reference is the runner's Codex app-server integration and its closed thread |---|---|---|---| | Streaming assistant/reasoning | `agent_message_chunk`, `agent_thought_chunk` in live and replay presenters | Existing ACP streaming path | Authenticated event capture required | | Tool lifecycle/input/output | `tool_call` and `tool_call_update`, including raw input/output, locations and content | Existing canonical tool lifecycle; Cursor extensions add semantic activity | Standard content blocks/diffs must survive shared ACPX mapping; evaluate captured field coverage | -| Human questions | `cursor/ask_question`, native single/multiple selections | `normalizeCursorQuestionRequest`: all questions required; opaque UI IDs round-trip native IDs; forged/duplicate/missing selections rejected | Cancellation and skip outcomes must be routed by shared durable request lifecycle | +| Human questions | `cursor/ask_question`, native single/multiple selections | `normalizeCursorQuestionRequest`: all questions required; opaque UI IDs round-trip native IDs; forged/duplicate/missing selections rejected | Active-turn adapter maps canonical answers, decline to skipped, and cancellation; durable delivery still requires end-to-end evidence | | Proposed plans and decisions | `cursor/create_plan` with full Markdown, overview, todos, named phases and project flag | `normalizeCursorPlanRequest`: complete presentation; accept/reject/cancel; revision-derived question ID; rejection feedback | Foundation question descriptions allow 100,000 chars; this boundary also enforces the 196 KiB UTF-8 durable payload cap. Oversize rejects; it is never truncated. No generated `planUri`, since no uploaded plan artifact is fabricated | | Execution checklist | Standard ACP `plan` and `cursor/update_todos` (`merge`) | Per-turn reducer merges by native ID and emits complete snapshots with increasing revisions | Native cancelled status is visible as “Cancelled” with canonical blocked status, since canonical plan schema has no cancelled enum | -| Child activity | Optional `subagent_spawned`, `subagent_state_update`; metadata has tool-call/agent/model identity | Stateful child normalizer emits canonical delegation and retains role/task across state deltas; shared host must validate parent ownership | Requires client `_meta.subagents: true`. Nested transcript routing and child authority need end-to-end evidence | +| Child activity | Optional `subagent_spawned`, `subagent_state_update`; metadata has tool-call/agent/model identity | Stateful child normalizer emits canonical delegation and retains role/task across state deltas; active-turn adapter validates parent, known child spawn, and immutable tool/agent origin | Requires client `_meta.subagents: true`. ACPX SDK 1.4.0 lacks these two update variants; a closed pre-parser intercept is required. Nested transcript routing and child authority need end-to-end evidence | | Completed subagent tasks | `cursor/task`: description, prompt, subtype, model, ID, duration | Canonical delegation with role, model, task and duration in activity summary | Dedicated numeric duration field absent from canonical delegation schema | | Subagent questions | Pinned ACP subagent handler explicitly rejects interactive questions | No unsupported affordance advertised | Confirmed harness omission; requires upstream support | | Generated images | `cursor/generate_image`: description, path and reference-image paths | Canonical generated/viewed artifact events; description notice; realpath/regular-file containment checks; `registered:false` | Paths are references, not automatic uploads. Revalidate before artifact ingestion. No image bytes invented | @@ -61,7 +61,7 @@ Artifact paths are never automatically read or uploaded. References require a pr Passed in the provider worktree: -- 10 Cursor Vitest cases: questions, multi-selection, native ID round-trip, invalid answers, exact plan revisions, outcomes, todo delta merging, delegation metadata, path containment/symlink refusal, child identity retention, private launch defaults and project config gates. +- 13 Cursor Vitest cases: questions, multi-selection, native ID round-trip, invalid answers, exact plan revisions, outcomes, todo delta merging, delegation metadata, path containment/symlink refusal, child identity retention, private launch defaults and project config gates; active-turn canonical response mapping and immediate acknowledgements; stale/foreign/unknown child identity rejection. - 5 materializer Node tests: platform pins, entire-tree tampering, linked paths, archive tampering before extraction, and overwrite refusal. - Targeted strict TypeScript compilation for both provider modules and their imported contracts. - Credential-free wire initialization and auth/method probes, plus real macOS ARM64 materialization and archive/closure inventories for the other two platforms. @@ -71,3 +71,5 @@ The generic native-distribution lease now snapshots the pinned closure, launches Priority follow-ups before advertising support: (1) shared hook integration with durable response/recovery tests; (2) authenticated native lifetime and cleanup proof; (3) explicit credentials plus exact available model and measured dollar budget; (4) local and Daytona semantic tools, permissions, steering distinction, files/artifacts, questions/plans and settlement proof; (5) field-by-field captured trace audit to identify any additional unconsumed native fields. Remaining rich capabilities intentionally unused: session discovery, generic mode/config-option UI, provider session titles, command/skill picker metadata, nested child transcripts beyond delegation summaries, native numeric task duration, and optional planUri. They are listed above with reasons; neither “unsupported” nor “complete” should be inferred for unverified live behaviors. The final combined report must update this inventory with integration evidence and include any further events observed during authenticated qualification. + +Shared display-channel verification additionally covers exact rich-event schema validation, terminal/semantic/source injection rejection, active-turn fences, complete Unicode plan preservation through durable outbox persistence, secret redaction disclosure, and oversized UTF-8 rejection. The 4 KiB diagnostic preview cap remains active for diagnostics, never full approval documents. diff --git a/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts index 439a5f0c830..2af0f6441d5 100644 --- a/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts +++ b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts @@ -4,7 +4,7 @@ import { join } from "node:path"; import { afterEach, describe, expect, it } from "vitest"; import { PAPERCLIP_QUESTION_RESPONSE_SCHEMA } from "../../contracts/question-set.js"; import { - createCursorNotificationNormalizer, createCursorSubagentNormalizer, cursorWorkspaceArtifactReference, + createCursorNotificationNormalizer, createCursorProfileExtensionAdapter, createCursorSubagentNormalizer, cursorWorkspaceArtifactReference, normalizeCursorPlanRequest, normalizeCursorQuestionRequest, normalizeCursorSubagentUpdate, } from "./cursor-extensions.js"; @@ -94,3 +94,53 @@ describe("Cursor rich notifications", () => { expect(normalize({ ...base, sessionUpdate: "subagent_state_update", state: "completed" })).toMatchObject({ payload: { children: [{ role: "Explore", model: "small", summary: "Find tests", status: "completed" }] } }); }); }); + +describe("Cursor active-turn extension adapter", () => { + it("roundtrips canonical answers and plan decisions while rejecting implicit acceptance", async () => { + const adapter = createCursorProfileExtensionAdapter({ workspacePath: await workspace(), sessionId: "parent", turnId: "turn" }); + const question = await adapter.request("cursor/ask_question", { sessionId: "parent", toolCallId: "ask", questions: [ + { id: "native", prompt: "Choose", options: [{ id: "native-option", label: "One" }] }, + ] }); + if (!("input" in question)) throw new Error("question was not blocking"); + expect(question.input.resolve({ action: "submit", response: response({ "question-1": { selectedOptionIds: ["option-1"] } }) })).toEqual({ outcome: { outcome: "answered", answers: [{ questionId: "native", selectedOptionIds: ["native-option"] }] } }); + expect(question.input.resolve({ action: "decline" })).toEqual({ outcome: { outcome: "skipped" } }); + expect(question.input.resolve({ action: "cancel" })).toEqual(question.input.cancel()); + expect(() => question.input.resolve({ action: "accept" })).toThrow(); + expect(() => question.input.resolve({ action: "submit", answers: { "question-1": { answers: ["option-1"] } } })).toThrow(); + + const plan = await adapter.request("cursor/create_plan", { sessionId: "parent", toolCallId: "plan", plan: "# Complete plan\n".repeat(1_000), todos: [] }); + if (!("input" in plan)) throw new Error("plan was not blocking"); + expect(plan.input.details.revision).toMatch(/^[a-f0-9]{64}$/); + const id = plan.input.questionSet.questions[0]!.id; + expect(plan.input.resolve({ action: "submit", response: response({ [id]: { selectedOptionIds: ["accept"] } }) })).toEqual({ outcome: { outcome: "accepted" } }); + expect(() => plan.input.resolve({ action: "accept" })).toThrow("displayed revision"); + expect(plan.input.resolve({ action: "decline" })).toEqual({ outcome: { outcome: "rejected" } }); + expect(plan.input.cancel()).toEqual({ outcome: { outcome: "cancelled" } }); + }); + + it("acknowledges native request-shaped activity and preserves its reducer order", async () => { + const adapter = createCursorProfileExtensionAdapter({ workspacePath: await workspace(), sessionId: "parent", turnId: "turn" }); + const first = await adapter.request("cursor/update_todos", { sessionId: "parent", toolCallId: "a", merge: false, todos: [{ id: "a", content: "Read", status: "pending" }] }); + expect(first).toMatchObject({ response: {}, events: [{ eventType: "plan.updated", payload: { revision: 1 } }] }); + const second = await adapter.notification("cursor/update_todos", { sessionId: "parent", toolCallId: "b", merge: true, todos: [{ id: "b", content: "Write", status: "pending" }] }); + expect(second).toMatchObject([{ payload: { revision: 2, steps: [{ body: "Read" }, { body: "Write" }] } }]); + await expect(adapter.request("cursor/update_todos", { sessionId: "other" })).rejects.toThrow("stale parent"); + await expect(adapter.notification("cursor/task", { sessionId: "other" })).rejects.toThrow("stale parent"); + await expect(adapter.request("cursor/unknown", { sessionId: "parent" })).rejects.toThrow("Unsupported"); + }); + + it("requires a known child spawn and immutable origin within the active parent", async () => { + const context = { workspacePath: await workspace(), sessionId: "parent", turnId: "turn" }; + const adapter = createCursorProfileExtensionAdapter(context); + const update = { subagentSessionId: "child", _meta: { cursor: { toolCallId: "task", agentId: "native-child", model: "small" } } }; + const state = { ...update, sessionUpdate: "subagent_state_update", state: "completed" }; + await expect(adapter.notification("cursor/subagent_update", { sessionId: "parent", update: state })).rejects.toThrow("no spawn"); + const spawned = { ...update, sessionUpdate: "subagent_spawned", name: "Research", task: "Inspect source" }; + expect(await adapter.notification("cursor/subagent_update", { sessionId: "parent", update: spawned })).toMatchObject([{ eventType: "delegation.started", payload: { children: [{ role: "Research", model: "small" }] } }]); + expect(await adapter.notification("cursor/subagent_update", { sessionId: "parent", update: state })).toMatchObject([{ eventType: "delegation.completed", payload: { children: [{ role: "Research", summary: "Inspect source" }] } }]); + await expect(adapter.notification("cursor/subagent_update", { sessionId: "other", update: state })).rejects.toThrow("stale parent"); + await expect(adapter.notification("cursor/subagent_update", { sessionId: "parent", update: { ...state, _meta: { cursor: { ...update._meta.cursor, toolCallId: "forged" } } } })).rejects.toThrow("origin identity"); + await expect(adapter.notification("cursor/subagent_update", { sessionId: "parent", update: spawned })).rejects.toThrow("duplicated"); + await expect(createCursorProfileExtensionAdapter({ ...context, turnId: "next" }).notification("cursor/subagent_update", { sessionId: "parent", update: state })).rejects.toThrow("no spawn"); + }); +}); diff --git a/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts index 0b6727a1257..b508ac71225 100644 --- a/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts +++ b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts @@ -9,6 +9,7 @@ import { type PaperclipQuestionSet, } from "../../contracts/question-set.js"; import type { CanonicalProviderEvent } from "../../provider-events.js"; +import type { HarnessRuntimeRequestResolution } from "../../contracts/harness-driver.js"; export const CURSOR_EXTENSION_REQUEST_METHODS = [ "cursor/ask_question", "cursor/create_plan", @@ -18,6 +19,85 @@ export const CURSOR_EXTENSION_REQUEST_METHODS = [ export const CURSOR_EXTENSION_NOTIFICATION_METHODS = [ "cursor/update_todos", "cursor/task", "cursor/generate_image", ] as const; +export const CURSOR_CLIENT_CAPABILITIES = { _meta: { subagents: true } } as const; + +type CursorExtensionInput = { + method: string; + questionSet: PaperclipQuestionSet; + details: Record; + resolve(resolution: HarnessRuntimeRequestResolution): Record; + cancel(): Record; +}; +type CursorExtensionResult = { input: CursorExtensionInput } + | { events: CanonicalProviderEvent[]; response: Record }; + +/** One adapter belongs to exactly one active session/turn, never a warm process. */ +export function createCursorProfileExtensionAdapter(context: { + workspacePath: string; sessionId: string; turnId: string; +}) { + const normalizeNotification = createCursorNotificationNormalizer(context); + const normalizeSubagent = createCursorSubagentNormalizer(); + const children = new Map(); + const assertSession = (params: Record) => { + if (params.sessionId !== context.sessionId) throw new Error("Cursor extension has a stale parent session"); + }; + return { + async request(method: string, params: Record): Promise { + assertSession(params); + if (method === "cursor/ask_question") { + const question = normalizeCursorQuestionRequest(params); + return { input: { + method, questionSet: question.questionSet, details: { toolCallId: question.toolCallId }, + cancel: question.cancel, + resolve(resolution) { + if (resolution.action === "cancel") return question.cancel(); + if (resolution.action === "decline") return question.skip(); + if (resolution.action !== "submit" || !("response" in resolution)) throw new Error("Cursor questions require a complete canonical answer"); + return question.resolve(resolution.response); + }, + } }; + } + if (method === "cursor/create_plan") { + const plan = normalizeCursorPlanRequest(params); + return { input: { + method, questionSet: plan.questionSet, details: { toolCallId: plan.toolCallId, revision: plan.revision }, + cancel: plan.cancel, + resolve(resolution) { + if (resolution.action === "cancel") return plan.cancel(); + if (resolution.action === "decline") return { outcome: { outcome: "rejected" } }; + if (resolution.action !== "submit" || !("response" in resolution)) throw new Error("Cursor plan decisions require the displayed revision"); + return plan.resolve(resolution.response); + }, + } }; + } + if (!(CURSOR_EXTENSION_NOTIFICATION_METHODS as readonly string[]).includes(method)) throw new Error("Unsupported Cursor extension request"); + return { events: await normalizeNotification(method, params), response: {} }; + }, + async notification(method: string, params: Record): Promise { + assertSession(params); + if (method !== "cursor/subagent_update") return normalizeNotification(method, params); + // The transport synthesizes this method only from the two pinned native + // session/update variants, after checking the active parent connection. + const update = object(params.update); + const id = requiredText(update.subagentSessionId, "subagentSessionId", 1_000); + if (id === context.sessionId) throw new Error("Cursor child cannot impersonate its parent session"); + const metadata = object(object(update._meta).cursor); + const toolCallId = requiredText(metadata.toolCallId, "subagent toolCallId", 1_000); + const agentId = optionalText(metadata.agentId, "subagent agentId", 1_000); + const previous = children.get(id); + if (update.sessionUpdate === "subagent_spawned") { + if (previous || children.size >= 256) throw new Error("Cursor child session identity is duplicated or over capacity"); + } else if (update.sessionUpdate !== "subagent_state_update" || !previous) { + throw new Error("Cursor child update has no spawn in this active turn"); + } + if (previous && (previous.toolCallId !== toolCallId || previous.agentId !== agentId)) throw new Error("Cursor child update changed its origin identity"); + const event = normalizeSubagent(update); + if (!event) throw new Error("Unsupported Cursor child update"); + children.set(id, { toolCallId, agentId }); + return [event]; + }, + }; +} type CursorQuestionResult = { outcome: | { outcome: "answered"; answers: Array<{ questionId: string; selectedOptionIds: string[] }> } From f7b33cc553806f6704930064de31f58cf926e1fd Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 11:33:51 -0500 Subject: [PATCH 04/31] Verify Cursor package assets through an exact native profile factory Co-Authored-By: Paperclip --- .../drivers/acpx/cursor-installation.test.ts | 34 ++++++++++++++ .../src/drivers/acpx/cursor-installation.ts | 45 +++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 packages/paperclip-runner/src/drivers/acpx/cursor-installation.test.ts create mode 100644 packages/paperclip-runner/src/drivers/acpx/cursor-installation.ts diff --git a/packages/paperclip-runner/src/drivers/acpx/cursor-installation.test.ts b/packages/paperclip-runner/src/drivers/acpx/cursor-installation.test.ts new file mode 100644 index 00000000000..077c7460fc8 --- /dev/null +++ b/packages/paperclip-runner/src/drivers/acpx/cursor-installation.test.ts @@ -0,0 +1,34 @@ +import { readFile } from "node:fs/promises"; +import { join } from "node:path"; +import { expect, it } from "vitest"; +import { CURSOR_PINNED_VERSION, cursorNativeDistributionSpec, verifyCursorInstallation } from "./cursor-installation.js"; +import { QUALIFIED_ACPX_PROFILES } from "./qualified-profiles.js"; + +it("matches build materializer pins and launches only package-owned complete distributions", async () => { + const manifest = JSON.parse(await readFile(new URL("../../../cursor-distributions.json", import.meta.url), "utf8")); + expect(manifest.version).toBe(CURSOR_PINNED_VERSION); + for (const [platform, architecture] of [["darwin", "arm64"], ["darwin", "x64"], ["linux", "x64"]] as const) { + const spec = cursorNativeDistributionSpec(platform, architecture); + expect(spec.expectedClosureSha256).toBe(manifest.platforms[`${platform}-${architecture}`].closureSha256); + expect(spec.distributionRoot).toBe(new URL(`../../../provider-assets/cursor/${platform}-${architecture}`, import.meta.url).pathname); + expect(spec.manifestPath).toBe(join(spec.distributionRoot, ".paperclip-cursor-closure.json")); + expect(spec.executable).toBe("node"); + expect(spec.entrypoint).toBe("index.js"); + expect(spec.fixedArguments).toEqual(["--disable-project-configs", "--disable-auto-update", "acp"]); + (spec.fixedArguments as string[]).push("--force"); + expect(cursorNativeDistributionSpec(platform, architecture).fixedArguments).not.toContain("--force"); + } +}); + +it("rejects profile substitutions before reading any native distribution", async () => { + const base = { ...QUALIFIED_ACPX_PROFILES.cursor, qualificationModel: "explicit", reportedModelId: "explicit" }; + for (const profile of [QUALIFIED_ACPX_PROFILES.cursor, { ...base, agentServerVersion: "latest" }, { ...base, commandDigest: "forged" }, { ...base, reportedModelId: "different" }]) { + await expect(verifyCursorInstallation(profile)).rejects.toThrow("exact pinned profile"); + } +}); + +it("fails closed on unknown platforms instead of ambient executable discovery", () => { + expect(() => cursorNativeDistributionSpec("linux", "arm64")).toThrow("no pinned distribution"); + expect(() => cursorNativeDistributionSpec("win32", "x64")).toThrow("no pinned distribution"); + expect(() => cursorNativeDistributionSpec("darwin", "../../workspace")).toThrow("no pinned distribution"); +}); diff --git a/packages/paperclip-runner/src/drivers/acpx/cursor-installation.ts b/packages/paperclip-runner/src/drivers/acpx/cursor-installation.ts new file mode 100644 index 00000000000..edda80afbbc --- /dev/null +++ b/packages/paperclip-runner/src/drivers/acpx/cursor-installation.ts @@ -0,0 +1,45 @@ +import { join } from "node:path"; + +import { verifyNativeAcpxInstallation, type VerifiedAcpxInstallation } from "./installation-integrity.js"; +import type { NativeAcpxDistributionInput } from "./native-distribution-integrity.js"; +import { CURSOR_FIXED_ARGUMENTS } from "./cursor-launch-policy.js"; +import { QUALIFIED_ACPX_PROFILES, type QualifiedAcpxProfile } from "./qualified-profiles.js"; +import { resolveRunnerProviderAssetsRoot } from "./provider-assets-root.js"; + +export const CURSOR_PINNED_VERSION = "2026.09.26-dd393fe"; +const CLOSURE_PINS = Object.freeze({ + "darwin-arm64": "77394184a89b0e7384971181da19c3c82d83a399b04e7944b3f94fe3d7e62b25", + "darwin-x64": "7c8775160af74e5fb8d25a30e8412c1a6476b0661529078a686e5118fd1c5e5f", + "linux-x64": "bf04ef8ea6a63191067a6b3e15139aa2c793d8419daab246aa3f0a012e1bbcd9", +}); + +/** Trusted package assets only: no workspace, PATH, executable override or env root. */ +export function cursorNativeDistributionSpec( + platform: NodeJS.Platform = process.platform, + architecture: string = process.arch, +): NativeAcpxDistributionInput { + const key = `${platform}-${architecture}`; + if (!Object.hasOwn(CLOSURE_PINS, key)) throw new Error(`Cursor ${CURSOR_PINNED_VERSION} has no pinned distribution for ${key}`); + const distributionRoot = join(resolveRunnerProviderAssetsRoot(import.meta.url, "cursor"), key); + return { + distributionRoot, + manifestPath: join(distributionRoot, ".paperclip-cursor-closure.json"), + expectedClosureSha256: CLOSURE_PINS[key as keyof typeof CLOSURE_PINS], + executable: "node", + entrypoint: "index.js", + fixedArguments: [...CURSOR_FIXED_ARGUMENTS], + }; +} + +/** Verifies launch bytes, not qualification. Profile admission remains separate. */ +export async function verifyCursorInstallation(profile: QualifiedAcpxProfile): Promise { + const trusted = QUALIFIED_ACPX_PROFILES.cursor; + const modelFields = new Set(["qualificationModel", "reportedModelId"]); + if (Object.keys(profile).some(key => !Object.hasOwn(trusted, key)) + || Object.entries(trusted).some(([key, value]) => !modelFields.has(key) && profile[key as keyof QualifiedAcpxProfile] !== value) + || !profile.qualificationModel.trim() || profile.reportedModelId !== profile.qualificationModel) { + throw new Error("Cursor installation requires the exact pinned profile and an explicit model"); + } + const installation = await verifyNativeAcpxInstallation(cursorNativeDistributionSpec()); + return { ...installation, commandDigest: trusted.commandDigest }; +} From 36313fc9083744a050bccc7c917208b2405146c2 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 11:38:44 -0500 Subject: [PATCH 05/31] Preserve Cursor child activity without flattening foreign sessions Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 14 +- .../drivers/acpx/cursor-extensions.test.ts | 15 ++ .../src/drivers/acpx/cursor-extensions.ts | 57 ++++- ...cursor-subagents-package-contract.test.mjs | 109 ++++++++++ patches/acpx@0.13.1.patch | 204 ++++++++++-------- 5 files changed, 306 insertions(+), 93 deletions(-) create mode 100644 packages/paperclip-runner/test/acpx-cursor-subagents-package-contract.test.mjs diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index ec582ddbcef..73a015465de 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -23,7 +23,7 @@ The reference is the runner's Codex app-server integration and its closed thread | Human questions | `cursor/ask_question`, native single/multiple selections | `normalizeCursorQuestionRequest`: all questions required; opaque UI IDs round-trip native IDs; forged/duplicate/missing selections rejected | Active-turn adapter maps canonical answers, decline to skipped, and cancellation; durable delivery still requires end-to-end evidence | | Proposed plans and decisions | `cursor/create_plan` with full Markdown, overview, todos, named phases and project flag | `normalizeCursorPlanRequest`: complete presentation; accept/reject/cancel; revision-derived question ID; rejection feedback | Foundation question descriptions allow 100,000 chars; this boundary also enforces the 196 KiB UTF-8 durable payload cap. Oversize rejects; it is never truncated. No generated `planUri`, since no uploaded plan artifact is fabricated | | Execution checklist | Standard ACP `plan` and `cursor/update_todos` (`merge`) | Per-turn reducer merges by native ID and emits complete snapshots with increasing revisions | Native cancelled status is visible as “Cancelled” with canonical blocked status, since canonical plan schema has no cancelled enum | -| Child activity | Optional `subagent_spawned`, `subagent_state_update`; metadata has tool-call/agent/model identity | Stateful child normalizer emits canonical delegation and retains role/task across state deltas; active-turn adapter validates parent, known child spawn, and immutable tool/agent origin | Requires client `_meta.subagents: true`. ACPX SDK 1.4.0 lacks these two update variants; a closed pre-parser intercept is required. Nested transcript routing and child authority need end-to-end evidence | +| Child activity | Optional `subagent_spawned`, `subagent_state_update`; metadata has tool-call/agent/model identity | Stateful child normalizer emits canonical delegation and retains role/task across state deltas; active-turn adapter validates parent, known child spawn, and immutable tool/agent origin | Requires client `_meta.subagents: true`. ACPX SDK 1.4.0 lacks these two update variants. A closed opt-in pre-parser intercept binds the parent and declared descendants; child text/reasoning/plan/tool summaries are attributed to their child, never flattened into the parent. Nested media and raw tool details remain partial | | Completed subagent tasks | `cursor/task`: description, prompt, subtype, model, ID, duration | Canonical delegation with role, model, task and duration in activity summary | Dedicated numeric duration field absent from canonical delegation schema | | Subagent questions | Pinned ACP subagent handler explicitly rejects interactive questions | No unsupported affordance advertised | Confirmed harness omission; requires upstream support | | Generated images | `cursor/generate_image`: description, path and reference-image paths | Canonical generated/viewed artifact events; description notice; realpath/regular-file containment checks; `registered:false` | Paths are references, not automatic uploads. Revalidate before artifact ingestion. No image bytes invented | @@ -61,7 +61,7 @@ Artifact paths are never automatically read or uploaded. References require a pr Passed in the provider worktree: -- 13 Cursor Vitest cases: questions, multi-selection, native ID round-trip, invalid answers, exact plan revisions, outcomes, todo delta merging, delegation metadata, path containment/symlink refusal, child identity retention, private launch defaults and project config gates; active-turn canonical response mapping and immediate acknowledgements; stale/foreign/unknown child identity rejection. +- 14 Cursor Vitest cases: questions, multi-selection, native ID round-trip, invalid answers, exact plan revisions, outcomes, todo delta merging, delegation metadata, path containment/symlink refusal, child identity retention, private launch defaults and project config gates; active-turn canonical response mapping and immediate acknowledgements; stale/foreign/unknown child identity rejection. - 5 materializer Node tests: platform pins, entire-tree tampering, linked paths, archive tampering before extraction, and overwrite refusal. - Targeted strict TypeScript compilation for both provider modules and their imported contracts. - Credential-free wire initialization and auth/method probes, plus real macOS ARM64 materialization and archive/closure inventories for the other two platforms. @@ -70,6 +70,14 @@ The generic native-distribution lease now snapshots the pinned closure, launches Priority follow-ups before advertising support: (1) shared hook integration with durable response/recovery tests; (2) authenticated native lifetime and cleanup proof; (3) explicit credentials plus exact available model and measured dollar budget; (4) local and Daytona semantic tools, permissions, steering distinction, files/artifacts, questions/plans and settlement proof; (5) field-by-field captured trace audit to identify any additional unconsumed native fields. -Remaining rich capabilities intentionally unused: session discovery, generic mode/config-option UI, provider session titles, command/skill picker metadata, nested child transcripts beyond delegation summaries, native numeric task duration, and optional planUri. They are listed above with reasons; neither “unsupported” nor “complete” should be inferred for unverified live behaviors. The final combined report must update this inventory with integration evidence and include any further events observed during authenticated qualification. +Remaining rich capabilities intentionally unused: session discovery, generic mode/config-option UI, provider session titles, command/skill picker metadata, full nested child transcripts beyond bounded delegation summaries, native numeric task duration, and optional planUri. They are listed above with reasons; neither “unsupported” nor “complete” should be inferred for unverified live behaviors. The final combined report must update this inventory with integration evidence and include any further events observed during authenticated qualification. Shared display-channel verification additionally covers exact rich-event schema validation, terminal/semantic/source injection rejection, active-turn fences, complete Unicode plan preservation through durable outbox persistence, secret redaction disclosure, and oversized UTF-8 rejection. The 4 KiB diagnostic preview cap remains active for diagnostics, never full approval documents. + +## Child transcript boundary and remaining fields + +Pinned source creates a separate session-update presenter for every child and can use another child as the immediate parent. Enabling `_meta.subagents` therefore requires handling both lifecycle and ordinary child session updates. The Cursor-specific ACPX compatibility path tracks declared descendants per stream and active prompt, forwards them only under the retained root parent authority, and suppresses unknown child sessions. It leaves the SDK's standard parent update schema closed. Known child updates never become parent assistant messages. Old-stream, foreign-parent, pre-turn, settled, aborted, oversized, unknown-child and duplicate-spawn cases are covered. + +Child assistant/reasoning text, plan steps and tool lifecycle are displayed in each child's activity summary. The 4,000-character activity surface retains a clearly marked tail when it fills; this is a summary, not a complete nested transcript. Child tool raw input/output, locations, diffs, media content and other child update fields are not rendered by this summary surface and produce explicit partial-detail notices. Adding canonical child transcript/tool surfaces is the next priority for these meaningful exposed fields. Native `capabilities:{}` currently carries no populated child capability fields; `_meta.cursor.agentId` and `toolCallId` are retained internally for immutable origin checks. Nested parent identity is represented in activity metadata because canonical delegation has no parent-child relation field. Native `disconnected` now yields a failed child with a visible explanation, never a successful completion. + +Three real ACP stream tests prove child lifecycle/transcript preservation before SDK parsing, nested parent attribution, standard parent parsing, and old-stream/turn/connection fences. Existing nine shared extension and Pi receipt package tests pass unchanged against the resulting patched package. Three native factory cases verify all platform pins, exact profiles, and rejection of unsupported distributions; native assets resolve only from the runner-owned package authority. diff --git a/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts index 2af0f6441d5..3aae9725bc4 100644 --- a/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts +++ b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.test.ts @@ -143,4 +143,19 @@ describe("Cursor active-turn extension adapter", () => { await expect(adapter.notification("cursor/subagent_update", { sessionId: "parent", update: spawned })).rejects.toThrow("duplicated"); await expect(createCursorProfileExtensionAdapter({ ...context, turnId: "next" }).notification("cursor/subagent_update", { sessionId: "parent", update: state })).rejects.toThrow("no spawn"); }); + + it("attributes nested child transcripts, reports partial tool detail, and settles disconnected children honestly", async () => { + const adapter = createCursorProfileExtensionAdapter({ workspacePath: await workspace(), sessionId: "parent", turnId: "turn" }); + const child = { sessionUpdate: "subagent_spawned", subagentSessionId: "child", name: "Explore", task: "", _meta: { cursor: { toolCallId: "task", agentId: "agent" } } }; + await adapter.notification("cursor/subagent_update", { sessionId: "parent", update: child }); + const grandchild = { ...child, subagentSessionId: "grandchild", _meta: { cursor: { toolCallId: "task-2", agentId: "agent-2" } } }; + expect(await adapter.notification("cursor/subagent_update", { sessionId: "parent", parentSessionId: "child", update: grandchild })).toMatchObject([{ payload: { children: [{ activitySummary: expect.stringContaining("Parent child:") }] } }]); + const text = await adapter.notification("cursor/subagent_update", { sessionId: "parent", childSessionId: "grandchild", parentSessionId: "child", update: { sessionUpdate: "agent_message_chunk", content: { type: "text", text: "漢".repeat(5_000) } } }); + expect(text[0]?.payload).toMatchObject({ children: [{ activitySummary: expect.stringContaining("Earlier child activity omitted") }] }); + const tool = await adapter.notification("cursor/subagent_update", { sessionId: "parent", childSessionId: "child", update: { sessionUpdate: "tool_call", toolCallId: "read", title: "Read src", status: "completed", rawInput: { path: "src/index.ts" } } }); + expect(tool).toMatchObject([{ eventType: "delegation.updated", payload: { children: [{ activitySummary: "Tool Read src: completed" }] } }, { eventType: "provider.notice.recorded", payload: { category: "cursor_child_detail_partial" } }]); + const disconnected = await adapter.notification("cursor/subagent_update", { sessionId: "parent", update: { ...child, sessionUpdate: "subagent_state_update", state: "disconnected" } }); + expect(disconnected).toMatchObject([{ payload: { status: "failed", children: [{ status: "failed", activitySummary: expect.stringContaining("disconnected before settling") }] } }]); + await expect(adapter.notification("cursor/subagent_update", { sessionId: "parent", childSessionId: "grandchild", parentSessionId: "wrong", update: {} })).rejects.toThrow("unknown parent"); + }); }); diff --git a/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts index b508ac71225..d28ad4168f2 100644 --- a/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts +++ b/packages/paperclip-runner/src/drivers/acpx/cursor-extensions.ts @@ -37,7 +37,7 @@ export function createCursorProfileExtensionAdapter(context: { }) { const normalizeNotification = createCursorNotificationNormalizer(context); const normalizeSubagent = createCursorSubagentNormalizer(); - const children = new Map(); + const children = new Map(); const assertSession = (params: Record) => { if (params.sessionId !== context.sessionId) throw new Error("Cursor extension has a stale parent session"); }; @@ -79,6 +79,22 @@ export function createCursorProfileExtensionAdapter(context: { // The transport synthesizes this method only from the two pinned native // session/update variants, after checking the active parent connection. const update = object(params.update); + const parentSessionId = optionalText(params.parentSessionId, "parentSessionId", 1_000) ?? context.sessionId; + if (parentSessionId !== context.sessionId && !children.has(parentSessionId)) throw new Error("Cursor child has an unknown parent"); + if (params.childSessionId !== undefined) { + const childId = requiredText(params.childSessionId, "childSessionId", 1_000); + const child = children.get(childId); + if (!child || child.parentSessionId !== parentSessionId) throw new Error("Cursor child activity has no matching spawn"); + const summary = cursorChildActivitySummary(update); + const combined = [child.activity, summary.text].filter(Boolean).join("\n"); + child.activity = boundedChildActivity(combined); + const event = structuredClone(child.event); + event.eventType = "delegation.updated"; + const nested = object((event.payload.children as unknown[])[0]); + nested.activitySummary = child.activity; + child.event = event; + return [event, ...(summary.gap ? [notice(`${childId}:${String(update.sessionUpdate)}`, "cursor_child_detail_partial", summary.gap)] : [])]; + } const id = requiredText(update.subagentSessionId, "subagentSessionId", 1_000); if (id === context.sessionId) throw new Error("Cursor child cannot impersonate its parent session"); const metadata = object(object(update._meta).cursor); @@ -90,10 +106,13 @@ export function createCursorProfileExtensionAdapter(context: { } else if (update.sessionUpdate !== "subagent_state_update" || !previous) { throw new Error("Cursor child update has no spawn in this active turn"); } - if (previous && (previous.toolCallId !== toolCallId || previous.agentId !== agentId)) throw new Error("Cursor child update changed its origin identity"); + if (previous && (previous.toolCallId !== toolCallId || previous.agentId !== agentId || previous.parentSessionId !== parentSessionId)) throw new Error("Cursor child update changed its origin identity"); const event = normalizeSubagent(update); if (!event) throw new Error("Unsupported Cursor child update"); - children.set(id, { toolCallId, agentId }); + const nested = object((event.payload.children as unknown[])[0]); + const activity = boundedChildActivity([parentSessionId === context.sessionId ? undefined : `Parent child: ${stableId(parentSessionId)}`, previous?.activity, nested.activitySummary].filter(Boolean).join("\n")); + nested.activitySummary = activity || null; + children.set(id, { toolCallId, agentId, parentSessionId, event, activity }); return [event]; }, }; @@ -316,16 +335,44 @@ export function normalizeCursorSubagentUpdate(value: unknown): CanonicalProvider const metadata = object(object(update._meta).cursor); const itemId = stableId(requiredText(metadata.toolCallId, "subagent toolCallId", 1_000)); const state = update.sessionUpdate === "subagent_spawned" ? "running" : update.state; - const status = state === "cancelled" ? "interrupted" : state; + const status = state === "cancelled" ? "interrupted" : state === "disconnected" ? "failed" : state; if (!["running", "completed", "failed", "interrupted"].includes(String(status))) throw new Error("Unknown Cursor subagent state"); return { eventType: status === "running" ? "delegation.started" : "delegation.completed", itemId, payload: { schema: "paperclip.delegation.v1", delegationId: itemId, action: "spawn", status, children: [{ childId: stableId(requiredText(update.subagentSessionId, "subagentSessionId", 1_000)), role: optionalText(update.name, "name", 160) ?? null, model: optionalText(metadata.model, "model", 240) ?? null, - status, summary: optionalText(update.task, "task", 4_000) ?? null, activitySummary: null }], + status, summary: update.task === "" ? null : optionalText(update.task, "task", 4_000) ?? null, + activitySummary: state === "disconnected" ? "Cursor child disconnected before settling." : null }], } }; } +function cursorChildActivitySummary(update: Record): { text: string; gap?: string } { + const kind = requiredText(update.sessionUpdate, "child update kind", 160); + if (["agent_message_chunk", "agent_thought_chunk", "user_message_chunk"].includes(kind)) { + const content = object(update.content); + if (content.type === "text" && typeof content.text === "string" && content.text.length <= 65_536) { + return { text: `${kind === "agent_thought_chunk" ? "Reasoning" : kind === "user_message_chunk" ? "Input" : "Output"}: ${content.text}` }; + } + return { text: `Child ${kind} contains non-text content.`, gap: "Cursor child media is reported as activity; nested transcript media rendering is not supported yet." }; + } + if (kind === "tool_call" || kind === "tool_call_update") { + const toolCallId = requiredText(update.toolCallId, "child toolCallId", 1_000); + const title = optionalText(update.title, "child tool title", 4_000) ?? toolCallId; + const status = optionalText(update.status, "child tool status", 160) ?? "running"; + return { text: `Tool ${title}: ${status}`, gap: "Cursor child tool lifecycle is attributed to the child; raw input, output, locations and diffs need a nested tool surface and are not rendered in this summary." }; + } + if (kind === "plan") { + const entries = array(update.entries, "child plan entries", 256); + return { text: `Child plan: ${entries.map(value => { const entry = object(value); return `[${requiredText(entry.status, "child plan status", 160)}] ${requiredText(entry.content, "child plan step", 4_000)}`; }).join("; ")}` }; + } + return { text: `Child activity: ${kind}`, gap: `Cursor child update ${kind} was retained as a kind notice; its fields need a nested transcript surface.` }; +} + +function boundedChildActivity(text: string): string { + const points = Array.from(text); + return points.length <= 4_000 ? text : `[Earlier child activity omitted]\n${points.slice(-3_960).join("")}`; +} + /** Preserve identity across delta state updates; use a fresh reducer per turn. */ export function createCursorSubagentNormalizer() { const children = new Map>(); diff --git a/packages/paperclip-runner/test/acpx-cursor-subagents-package-contract.test.mjs b/packages/paperclip-runner/test/acpx-cursor-subagents-package-contract.test.mjs new file mode 100644 index 00000000000..41ae321c280 --- /dev/null +++ b/packages/paperclip-runner/test/acpx-cursor-subagents-package-contract.test.mjs @@ -0,0 +1,109 @@ +import assert from "node:assert/strict"; +import { spawn } from "node:child_process"; +import { mkdtemp, rm } from "node:fs/promises"; +import { createRequire } from "node:module"; +import { tmpdir } from "node:os"; +import { dirname, join } from "node:path"; +import { pathToFileURL } from "node:url"; +import test from "node:test"; + +const require = createRequire(import.meta.url); +const acpxRoot = process.env.PAPERCLIP_TEST_ACPX_PACKAGE_ROOT ?? dirname(require.resolve("acpx/package.json")); +const { k: AcpClient } = await import(pathToFileURL(join(acpxRoot, "dist/live-checkpoint-BSIrfgVo.js"))); +const fixture = String.raw` +const readline=require('node:readline'); +const send=value=>process.stdout.write(JSON.stringify({jsonrpc:'2.0',...value})+'\n'); +const child=(kind,sessionId='parent',extra={})=>({method:'session/update',params:{sessionId,update:{sessionUpdate:kind,subagentSessionId:'child',name:'Explore',task:'Read source',_meta:{cursor:{toolCallId:'task-1',agentId:'native-child',model:'small'}},...extra}}}); +readline.createInterface({input:process.stdin}).on('line',line=>{ + const message=JSON.parse(line); + if(message.method==='initialize')send({id:message.id,result:{protocolVersion:1,agentCapabilities:{},authMethods:[]}}); + else if(message.method==='session/new'){send(child('subagent_spawned'));send({id:message.id,result:{sessionId:'parent'}});} + else if(message.method==='session/prompt'){ + const mode=message.params.prompt[0].text; + if(mode==='valid'){ + send(child('subagent_spawned')); + send({method:'session/update',params:{sessionId:'child',update:{sessionUpdate:'agent_message_chunk',content:{type:'text',text:'child output'}}}}); + send(child('subagent_spawned','child',{subagentSessionId:'grandchild'})); + send(child('subagent_state_update','child',{subagentSessionId:'grandchild',state:'completed'})); + send(child('subagent_state_update','parent',{state:'completed'})); + }else if(mode==='foreign'){ + send(child('subagent_spawned','other-parent')); + const missing=child('subagent_spawned');delete missing.params.sessionId;send(missing); + send({method:'session/update',params:{sessionId:'unowned-child',update:{sessionUpdate:'agent_message_chunk',content:{type:'text',text:'must not become parent text'}}}}); + }else if(mode==='oversized')send(child('subagent_spawned','parent',{task:'x'.repeat(300000)})); + else if(mode==='unknown')send(child('subagent_deleted')); + send({method:'session/update',params:{sessionId:'parent',update:{sessionUpdate:'agent_message_chunk',content:{type:'text',text:'done'}}}}); + send({id:message.id,result:{stopReason:'end_turn'}}); + } +}); +`; + +async function withClient(options, run) { + const cwd = await mkdtemp(join(tmpdir(), "paperclip-cursor-child-")); + const client = new AcpClient({ + agentCommand: "paperclip-verified-cursor-fixture", cwd, + permissionMode: "approve-all", fs: false, terminal: false, authPolicy: "skip", + suppressSdkConsoleErrors: true, + extensionMethods: ["cursor/subagent_update"], clientCapabilities: { _meta: { subagents: true } }, + spawnAgent: () => spawn(process.execPath, ["-e", fixture], { cwd, stdio: ["pipe", "pipe", "pipe"] }), + ...options, + }); + try { await client.start(); await client.createSession(); await run(client); } + finally { await client.close(); await rm(cwd, { recursive: true, force: true }); } +} + +test("pinned Cursor children survive the SDK boundary while retaining parent and native metadata", { timeout: 10000 }, async () => { + const notifications = []; const standard = []; + await withClient({ onExtensionNotification: (method, params) => notifications.push({ method, params }), onSessionUpdate: value => standard.push(value) }, async client => { + assert.equal(notifications.length, 0, "pre-turn child event is not admitted"); + assert.equal((await client.prompt("parent", "valid")).stopReason, "end_turn"); + assert.deepEqual(notifications.map(value => value.method), Array(5).fill("cursor/subagent_update")); + assert.deepEqual(notifications.map(value => value.params.update.sessionUpdate), ["subagent_spawned", "agent_message_chunk", "subagent_spawned", "subagent_state_update", "subagent_state_update"]); + assert.equal(notifications[0].params.sessionId, "parent"); + assert.equal(notifications[0].params.update._meta.cursor.model, "small"); + assert.equal(notifications[1].params.childSessionId, "child"); + assert.equal(notifications[1].params.sessionId, "parent"); + assert.equal(notifications[2].params.parentSessionId, "child"); + assert.equal(notifications[2].params.sessionId, "parent"); + assert.equal(standard.length, 1, "standard output still follows SDK validation"); + }); +}); + +test("child interception refuses foreign/missing parent, oversized data and unknown variants", { timeout: 10000 }, async () => { + const notifications = []; const standard = []; + await withClient({ onExtensionNotification: (...args) => notifications.push(args), onSessionUpdate: value => standard.push(value) }, async client => { + for (const mode of ["foreign", "oversized", "unknown"]) await client.prompt("parent", mode); + assert.deepEqual(notifications, []); + assert.equal(standard.length, 3); + assert.ok(standard.every(value => value.sessionId === "parent")); + }); +}); + +test("subagent compatibility is opt-in and rejects old stream, settled turn and aborted connection authority", { timeout: 10000 }, async () => { + for (const options of [{ extensionMethods: [] }, { clientCapabilities: {} }]) { + const notifications = []; + await withClient({ ...options, onExtensionNotification: (...args) => notifications.push(args) }, async client => { + await client.prompt("parent", "valid"); + assert.deepEqual(notifications, []); + }); + } + const notifications = []; + const client = new AcpClient({ agentCommand: "fixture", cwd: tmpdir(), permissionMode: "approve-all", extensionMethods: ["cursor/subagent_update"], clientCapabilities: { _meta: { subagents: true } }, onExtensionNotification: (...args) => notifications.push(args) }); + const current = { active: null, children: new Map() }; const old = { active: null, children: new Map() }; + const turn = new AbortController(); const connection = new AbortController(); + client.cursorSubagentStreamOwner = current; + client.activePrompt = { sessionId: "parent", elicitationController: turn }; + client.connection = { signal: connection.signal }; + const message = { method: "session/update", params: { sessionId: "parent", update: { sessionUpdate: "subagent_spawned", subagentSessionId: "child" } } }; + assert.equal(client.handleCursorSubagentNotification(message, old), true); + assert.equal(notifications.length, 0); + client.handleCursorSubagentNotification(message, current); + assert.equal(notifications.length, 1); + turn.abort(); client.handleCursorSubagentNotification(message, current); + assert.equal(notifications.length, 1); + client.activePrompt = { sessionId: "parent", elicitationController: new AbortController() }; + connection.abort(); client.handleCursorSubagentNotification(message, current); + assert.equal(notifications.length, 1); + client.activePrompt = null; client.handleCursorSubagentNotification(message, current); + assert.equal(notifications.length, 1); +}); diff --git a/patches/acpx@0.13.1.patch b/patches/acpx@0.13.1.patch index 2d535d0b329..3f380457b61 100644 --- a/patches/acpx@0.13.1.patch +++ b/patches/acpx@0.13.1.patch @@ -1,8 +1,16 @@ diff --git a/dist/client-CxNllqui.d.ts b/dist/client-CxNllqui.d.ts -index 5e2113a..b7b5151 100644 --- a/dist/client-CxNllqui.d.ts +++ b/dist/client-CxNllqui.d.ts -@@ -135,6 +135,7 @@ declare class AcpClient { +@@ -120,6 +120,8 @@ + private initializeProtocolConnection; + private handleInitializeFailure; + private createTappedStream; ++ private cursorSubagentStreamOwner; ++ private handleCursorSubagentNotification; + createSession(cwd?: string): Promise; + loadSession(sessionId: string, cwd?: string): Promise; + loadSessionWithOptions(sessionId: string, cwd?: string, options?: LoadSessionOptions): Promise; +@@ -135,6 +137,7 @@ private throwPromptPermissionFailureIfPresent; setSessionMode(sessionId: string, modeId: string): Promise; setSessionConfigOption(sessionId: string, configId: string, value: string): Promise; @@ -11,10 +19,9 @@ index 5e2113a..b7b5151 100644 private setSessionModelThroughConfig; private setSessionModelThroughLegacyMethod; diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js -index d454fd7..4312cdd 100644 --- a/dist/live-checkpoint-BSIrfgVo.js +++ b/dist/live-checkpoint-BSIrfgVo.js -@@ -1068,6 +1068,7 @@ function serializeSessionRecordForDisk(record) { +@@ -1068,6 +1068,7 @@ last_agent_disconnect_reason: canonical.lastAgentDisconnectReason, protocol_version: canonical.protocolVersion, agent_capabilities: canonical.agentCapabilities, @@ -22,7 +29,7 @@ index d454fd7..4312cdd 100644 title: canonical.title, messages: canonical.messages, updated_at: canonical.updated_at, -@@ -1239,7 +1240,8 @@ function parseRequestTokenUsage(raw) { +@@ -1239,7 +1240,8 @@ for (const [key, value] of Object.entries(record)) { const parsed = parseTokenUsage(value); if (parsed == null) return null; @@ -32,7 +39,7 @@ index d454fd7..4312cdd 100644 } return usage; } -@@ -1541,6 +1543,7 @@ function parseSessionRecord(raw) { +@@ -1541,6 +1543,7 @@ lastAgentDisconnectReason: optionals.lastAgentDisconnectReason, protocolVersion: typeof record.protocol_version === "number" ? record.protocol_version : void 0, agentCapabilities: asRecord$4(record.agent_capabilities), @@ -40,7 +47,7 @@ index d454fd7..4312cdd 100644 title: conversation.title, messages: conversation.messages, updated_at: conversation.updated_at, -@@ -1661,7 +1664,7 @@ const ZED_TAG_KEYS = /* @__PURE__ */ new Set([ +@@ -1661,7 +1664,7 @@ "RedactedThinking", "ToolUse" ]); @@ -49,7 +56,7 @@ index d454fd7..4312cdd 100644 const OPAQUE_VALUE_PATHS = /* @__PURE__ */ new Set([ "agent_capabilities", "messages.Agent.content.ToolUse.input", -@@ -3104,10 +3107,10 @@ function authEnvKey(methodId) { +@@ -3104,10 +3107,10 @@ authEnvKeyCache.set(methodId, key); return key; } @@ -62,7 +69,7 @@ index d454fd7..4312cdd 100644 if (typeof value === "string" && value.trim().length > 0) return value; } function protectedEnvKey(key) { -@@ -3135,8 +3138,21 @@ function promotePrefixedAuthEnvironment(env) { +@@ -3135,8 +3138,21 @@ } return protectedKeys; } @@ -86,7 +93,7 @@ index d454fd7..4312cdd 100644 const protectedAuthEnvKeys = promotePrefixedAuthEnvironment(env); if (authCredentials) for (const [methodId, credential] of Object.entries(authCredentials)) { addAuthCredentialEnvKeys(protectedAuthEnvKeys, methodId, credential); -@@ -3178,10 +3194,10 @@ function resolveConfiguredAuthCredential(methodId, authCredentials) { +@@ -3178,10 +3194,10 @@ const configCredentials = authCredentials ?? {}; return configCredentials[methodId] ?? configCredentials[toEnvToken(methodId)]; } @@ -99,7 +106,7 @@ index d454fd7..4312cdd 100644 stdio: [ "pipe", "pipe", -@@ -3961,10 +3977,13 @@ function resolveClientCapabilities(params) { +@@ -3961,10 +3977,13 @@ ...params.elicitationModes.includes("url") ? { url: {} } : {} } } : {} }; @@ -115,7 +122,7 @@ index d454fd7..4312cdd 100644 }; } function hasResponseField(response, field) { -@@ -4067,6 +4086,27 @@ function createNdJsonMessageStream(agentCommand, output, input) { +@@ -4067,6 +4086,27 @@ } }) }; } @@ -143,7 +150,7 @@ index d454fd7..4312cdd 100644 var AcpClient = class { options; connection; -@@ -4105,7 +4145,9 @@ var AcpClient = class { +@@ -4105,7 +4145,9 @@ cwd: asAbsoluteCwd(options.cwd), authPolicy: options.authPolicy ?? "skip", permissionPolicy: snapshotPermissionPolicy(options.permissionPolicy), @@ -154,7 +161,7 @@ index d454fd7..4312cdd 100644 }; this.eventHandlers = { onAcpMessage: this.options.onAcpMessage, -@@ -4216,9 +4258,21 @@ var AcpClient = class { +@@ -4216,9 +4258,21 @@ this.lastAgentExit = void 0; this.lastKnownPid = child.pid ?? void 0; this.attachAgentLifecycleObservers(child); @@ -176,7 +183,7 @@ index d454fd7..4312cdd 100644 if (!this.options.verbose) return; process.stderr.write(chunk); }); -@@ -4226,6 +4280,7 @@ var AcpClient = class { +@@ -4226,6 +4280,7 @@ const output = Readable.toWeb(child.stdout); const stream = this.createTappedStream(createNdJsonMessageStream(this.options.agentCommand, input, output)); const connection = this.createConnection(stream, launch); @@ -184,7 +191,7 @@ index d454fd7..4312cdd 100644 connection.signal.addEventListener("abort", () => { this.recordAgentExit("connection_close", child.exitCode ?? null, child.signalCode ?? null); }, { once: true }); -@@ -4253,7 +4308,12 @@ var AcpClient = class { +@@ -4253,7 +4308,12 @@ geminiAcp: isGeminiAcpCommand(spawnCommand, args), copilotAcp: isCopilotAcpCommand(spawnCommand, args), claudeAcp: isClaudeAcpCommand(spawnCommand, args), @@ -198,7 +205,7 @@ index d454fd7..4312cdd 100644 }; } logAgentLaunch(plan) { -@@ -4279,10 +4339,17 @@ var AcpClient = class { +@@ -4279,10 +4339,17 @@ } async spawnAgentProcess(plan) { const spawnCommand = buildAgentSpawnCommand(plan.spawnCommand, plan.args, process.platform, plan.spawnOptions.env); @@ -218,7 +225,7 @@ index d454fd7..4312cdd 100644 try { await waitForSpawn$1(spawnedChild); } catch (error) { -@@ -4293,10 +4360,10 @@ var AcpClient = class { +@@ -4293,10 +4360,10 @@ createConnection(stream, launch) { const app = client({ name: "acpx" }).onNotification(methods.client.session.update, async ({ params }) => { await this.handleSessionUpdate(params); @@ -232,7 +239,7 @@ index d454fd7..4312cdd 100644 }).onRequest(methods.client.fs.readTextFile, async ({ params }) => { return await this.handleReadTextFile(params); }).onRequest(methods.client.fs.writeTextFile, async ({ params }) => { -@@ -4312,6 +4379,11 @@ var AcpClient = class { +@@ -4312,6 +4379,11 @@ }).onRequest(methods.client.terminal.release, async ({ params }) => { return await this.handleReleaseTerminal(params); }); @@ -244,7 +251,7 @@ index d454fd7..4312cdd 100644 if (launch.devinAcp) app.onRequest("_cognition.ai/request_diagnostics", (params) => { return params && typeof params === "object" && !Array.isArray(params) ? params : {}; }, async () => ({})); -@@ -4333,12 +4405,12 @@ var AcpClient = class { +@@ -4333,12 +4405,12 @@ async initializeProtocolConnection(connection, launch) { const initializePromise = connection.initialize({ protocolVersion: PROTOCOL_VERSION, @@ -259,7 +266,7 @@ index d454fd7..4312cdd 100644 clientInfo: resolveClientInfo(launch.devinAcp) }); const initialized = launch.geminiAcp ? await withTimeout(initializePromise, resolveGeminiAcpStartupTimeoutMs()) : await initializePromise; -@@ -4358,6 +4430,36 @@ var AcpClient = class { +@@ -4358,6 +4430,36 @@ throw normalizedError; } createTappedStream(base) { @@ -296,10 +303,13 @@ index d454fd7..4312cdd 100644 const onAcpMessage = () => this.eventHandlers.onAcpMessage; const onAcpOutputMessage = () => this.eventHandlers.onAcpOutputMessage; const elicitationRequestIds = /* @__PURE__ */ new Set(); -@@ -4367,8 +4469,9 @@ var AcpClient = class { +@@ -4367,8 +4469,12 @@ const shouldSuppressInboundReplaySessionUpdate = (message) => { return this.suppressReplaySessionUpdateMessages && isSessionUpdateNotification(message); }; ++ const cursorSubagentOwner = { active: null, children: new Map() }; ++ this.cursorSubagentStreamOwner = cursorSubagentOwner; ++ const onCursorSubagentNotification = (message) => this.handleCursorSubagentNotification(message, cursorSubagentOwner); + const onExtensionNotification = (message) => this.handleExtensionNotification(message); const observeInbound = (message) => { - const requestId = elicitationRequestId(message); @@ -307,7 +317,7 @@ index d454fd7..4312cdd 100644 if (requestId !== void 0) { elicitationRequestIds.add(requestId); return; -@@ -4379,6 +4482,7 @@ var AcpClient = class { +@@ -4379,6 +4485,7 @@ } }; return { @@ -315,11 +325,12 @@ index d454fd7..4312cdd 100644 readable: new ReadableStream({ async start(controller) { const reader = base.readable.getReader(); try { -@@ -4387,10 +4491,16 @@ var AcpClient = class { +@@ -4387,10 +4494,17 @@ if (done) break; if (!value) continue; observeInbound(value); - if (isExtensionNotification(value)) continue; ++ if (onCursorSubagentNotification(value)) continue; + if (isExtensionNotification(value)) { + onExtensionNotification(value); + continue; @@ -333,7 +344,7 @@ index d454fd7..4312cdd 100644 reader.releaseLock(); controller.close(); } -@@ -4403,10 +4513,20 @@ var AcpClient = class { +@@ -4403,10 +4517,20 @@ onAcpOutputMessage()?.("outbound", message); onAcpMessage()?.("outbound", message); } @@ -354,7 +365,7 @@ index d454fd7..4312cdd 100644 writer.releaseLock(); } } }) -@@ -4422,7 +4542,10 @@ var AcpClient = class { +@@ -4422,7 +4546,10 @@ const createPromise = this.runConnectionRequest(() => connection.newSession({ cwd: sessionCwd, mcpServers: this.options.mcpServers ?? [], @@ -366,7 +377,7 @@ index d454fd7..4312cdd 100644 })); result = claudeAcp ? await withTimeout(createPromise, resolveClaudeAcpSessionCreateTimeoutMs()) : await createPromise; } catch (error) { -@@ -4864,7 +4987,7 @@ var AcpClient = class { +@@ -4864,7 +4991,7 @@ } selectAuthMethod(methods) { for (const method of methods) { @@ -375,7 +386,7 @@ index d454fd7..4312cdd 100644 if (envCredential) return { methodId: method.id, credential: envCredential, -@@ -4890,7 +5013,7 @@ var AcpClient = class { +@@ -4890,7 +5017,7 @@ } readAgentSpecificEnvCredential(methodId) { if (!this.isGrokBuildAcpCommand() || methodId !== "xai.api_key") return; @@ -384,7 +395,7 @@ index d454fd7..4312cdd 100644 return typeof value === "string" && value.trim().length > 0 ? value : void 0; } selectAgentManagedAuthMethod(methodId) { -@@ -4915,9 +5038,9 @@ var AcpClient = class { +@@ -4915,9 +5042,9 @@ await connection.authenticate({ methodId: selected.methodId }); this.log(`authenticated with method ${selected.methodId} (${selected.source})`); } @@ -396,7 +407,7 @@ index d454fd7..4312cdd 100644 if (hostResponse) return hostResponse; const { response, recorded } = await this.resolvePermissionRequestFromMode(params); if (!recorded) { -@@ -4926,14 +5049,49 @@ var AcpClient = class { +@@ -4926,14 +5053,81 @@ } return response; } @@ -423,6 +434,38 @@ index d454fd7..4312cdd 100644 + signal.removeEventListener("abort", onAbort); + } + } ++ handleCursorSubagentNotification(message, owner) { ++ // Keep the SDK's standard union closed. Cursor child transcripts use ++ // their own session IDs and must never be flattened into the parent. ++ const method = "cursor/subagent_update"; ++ if (!this.options.extensionMethods.includes(method) || this.options.clientCapabilities?._meta?.subagents !== true) return false; ++ if (message?.method !== "session/update" || "id" in message) return false; ++ const lifecycle = ["subagent_spawned", "subagent_state_update"].includes(message?.params?.update?.sessionUpdate); ++ const active = this.activePrompt; ++ const connection = this.connection; ++ if (this.cursorSubagentStreamOwner !== owner || this.closing || connection?.signal.aborted) return true; ++ if (!active || !connection || active.elicitationController.signal.aborted) return lifecycle || owner.children.has(message?.params?.sessionId); ++ if (owner.active !== active) { owner.active = active; owner.children.clear(); } ++ if (!lifecycle && message?.params?.sessionId === active.sessionId) return false; ++ try { ++ const params = boundedExtensionRecord(message.params); ++ if (lifecycle) { ++ if (params.sessionId !== active.sessionId && !owner.children.has(params.sessionId)) return true; ++ const child = params.update?.subagentSessionId; ++ if (typeof child !== "string" || !child || child.length > 1000 || child === active.sessionId) return true; ++ if (params.update.sessionUpdate === "subagent_spawned") { ++ if (owner.children.has(child) || owner.children.size >= 256) return true; ++ owner.children.set(child, params.sessionId); ++ } else if (owner.children.get(child) !== params.sessionId) return true; ++ this.options.onExtensionNotification?.(method, { sessionId: active.sessionId, parentSessionId: params.sessionId, update: params.update }); ++ } else if (owner.children.has(params.sessionId)) { ++ this.options.onExtensionNotification?.(method, { sessionId: active.sessionId, parentSessionId: owner.children.get(params.sessionId), childSessionId: params.sessionId, update: params.update }); ++ } ++ } catch { ++ this.log("Cursor child activity notification was rejected"); ++ } ++ return true; ++ } + handleExtensionNotification(message) { + if (!this.options.extensionMethods.includes(message.method) || !this.options.onExtensionNotification || this.closing) return; + const active = this.activePrompt; @@ -448,7 +491,7 @@ index d454fd7..4312cdd 100644 })).then((response) => ({ kind: "response", response -@@ -4970,7 +5128,7 @@ var AcpClient = class { +@@ -4970,7 +5164,7 @@ isElicitationSessionCancelling(sessionId) { return this.closing || this.cancellingSessionIds.has(sessionId); } @@ -457,7 +500,7 @@ index d454fd7..4312cdd 100644 if (!this.options.onPermissionRequest) return; const signal = this.cancellationSignalForSession(params.sessionId); try { -@@ -4978,7 +5136,7 @@ var AcpClient = class { +@@ -4978,7 +5172,7 @@ sessionId: params.sessionId, raw: params, inferredKind: inferToolKind(params) @@ -466,7 +509,7 @@ index d454fd7..4312cdd 100644 return this.hostPermissionDecisionResponse(params, signal, decision); } catch (error) { return this.hostPermissionErrorResponse(params, signal, error); -@@ -5028,6 +5186,12 @@ var AcpClient = class { +@@ -5028,6 +5222,12 @@ attachAgentLifecycleObservers(child) { child.once("exit", (exitCode, signal) => { this.recordAgentExit("process_exit", exitCode, signal); @@ -479,7 +522,7 @@ index d454fd7..4312cdd 100644 }); child.once("close", (exitCode, signal) => { this.recordAgentExit("process_close", exitCode, signal); -@@ -5771,10 +5935,20 @@ function recordSessionUpdate(conversation, state, notification, timestamp = isoN +@@ -5771,10 +5971,20 @@ trimConversationForRuntime(conversation); return acpx; } @@ -502,7 +545,7 @@ index d454fd7..4312cdd 100644 updateConversationTimestamp(conversation, timestamp); trimConversationForRuntime(conversation); return true; -@@ -6435,6 +6609,27 @@ async function withConnectedSession(options) { +@@ -6435,6 +6645,27 @@ //#region src/runtime/engine/prompt-turn.ts const SESSION_REPLY_IDLE_MS = 1e3; const SESSION_REPLY_DRAIN_TIMEOUT_MS = 5e3; @@ -530,7 +573,7 @@ index d454fd7..4312cdd 100644 async function runPromptTurn(params) { try { const promptPromise = params.client.prompt(params.sessionId, params.prompt, params.onPromptRequestStarted, params.onElicitation); -@@ -6444,7 +6639,21 @@ async function runPromptTurn(params) { +@@ -6444,7 +6675,21 @@ idleMs: SESSION_REPLY_IDLE_MS, timeoutMs: SESSION_REPLY_DRAIN_TIMEOUT_MS }).catch(() => {}); @@ -552,15 +595,12 @@ index d454fd7..4312cdd 100644 return { stopReason: response.stopReason, source: "rpc" -@@ -6518,4 +6727,4 @@ var LiveSessionCheckpoint = class { +@@ -6518,4 +6763,4 @@ //#endregion export { writeSessionRecord as $, PERMISSION_POLICY_ACTIONS as $t, REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE as A, TimeoutError as At, getAcpxVersion as B, formatErrorMessage as Bt, mergeSessionOptions as C, PromptInputValidationError as Ct, applyLifecycleSnapshotToRecord as D, promptToDisplayText as Dt, applyConversation as E, parsePromptSource as Et, modelStateFromConfigOptions as F, normalizeAgentName$1 as Ft, findSession as G, toAcpErrorPayload as Gt, DEFAULT_HISTORY_LIMIT as H, normalizeOutputError as Ht, normalizeAgentCommandInput as I, resolveAgentArgv as It, listSessions as J, NON_INTERACTIVE_PERMISSION_POLICIES as Jt, findSessionByDirectoryWalk as K, AUTH_POLICIES as Kt, renderArgvIdentity as L, resolveAgentCommand as Lt, RequestedModelUnsupportedError as M, withTimeout as Mt, assertRequestedModelSupported as N, DEFAULT_AGENT_NAME as Nt, reconcileAgentSessionId as O, textPrompt as Ot, isRequestedModelUnsupportedError as P, listBuiltInAgents as Pt, resolveSessionRecord as Q, PERMISSION_MODES as Qt, runTimedExecFile as R, resolveCanonicalAgentName as Rt, advertisedModelState as S, parsePromptStopReason as St, sessionOptionsFromRecord as T, mergePromptSourceWithText as Tt, absolutePath as U, extractAcpError as Ut, permissionModeSatisfies as V, isRetryablePromptError as Vt, findGitRepositoryRoot as W, isAcpResourceNotFoundError as Wt, normalizeName as X, OUTPUT_ERROR_ORIGINS as Xt, listSessionsForAgent as Y, OUTPUT_ERROR_CODES as Yt, pruneSessions as Z, OUTPUT_FORMATS as Zt, createSessionConversation as _, sessionEventLockPath as _t, applyRequestedModelIfAdvertised as a, measurePerf as at, recordSessionUpdate as b, isAcpJsonRpcMessage as bt, setCurrentModelId as c, setPerfGauge as ct, setDesiredModelId as d, serializeSessionRecordForDisk as dt, SESSION_RECORD_SCHEMA as en, createAtomicWriteTempPath as et, syncAdvertisedModelState as f, normalizeRuntimeSessionId as ft, cloneSessionConversation as g, sessionEventActivePath as gt, cloneSessionAcpxState as h, sessionBaseDir$1 as ht, connectAndLoadSession as i, QueueProtocolError as in, incrementPerfCounter as it, REQUESTED_MODEL_UNSUPPORTED_REASONS as j, withInterrupt as jt, AcpClient as k, InterruptedError as kt, setDesiredConfigOption as l, startPerfTimer as lt, applyConfigOptionsToState as m, defaultSessionEventLog as mt, runPromptTurn as n, AgentSpawnError as nn, formatPerfMetric as nt, currentModelIdFromSetModelResponse as o, recordPerfDuration as ot, applyConfigOptionsToRecord as p, DEFAULT_EVENT_SEGMENT_MAX_BYTES as pt, isoNow$2 as q, EXIT_CODES as qt, withConnectedSession as r, QueueConnectionError as rn, getPerfMetricsSnapshot as rt, clearDesiredConfigOption as s, resetPerfMetrics as st, LiveSessionCheckpoint as t, AcpxOperationalError as tn, assertPersistedKeyPolicy as tt, setDesiredModeId as u, parseSessionRecord as ut, recordClientOperation as v, sessionEventSegmentPath as vt, persistSessionOptions as w, isPromptInput as wt, trimConversationForRuntime as x, parseJsonRpcErrorMessage as xt, recordPromptSubmission as y, extractSessionUpdateNotification as yt, splitCommandLine as z, exitCodeForOutputErrorCode as zt }; --//# sourceMappingURL=live-checkpoint-BSIrfgVo.js.map -\ No newline at end of file -+//# sourceMappingURL=live-checkpoint-BSIrfgVo.js.map +-//# sourceMappingURL=live-checkpoint-BSIrfgVo.js.map+//# sourceMappingURL=live-checkpoint-BSIrfgVo.js.map diff --git a/dist/runtime.d.ts b/dist/runtime.d.ts -index e8102ac..d3a9ba6 100644 --- a/dist/runtime.d.ts +++ b/dist/runtime.d.ts @@ -1,7 +1,8 @@ @@ -573,7 +613,7 @@ index e8102ac..d3a9ba6 100644 //#region src/agent-registry.d.ts declare const DEFAULT_AGENT_NAME = "codex"; //#endregion -@@ -44,6 +45,7 @@ type AcpRuntimeTurnAttachment = { +@@ -44,6 +45,7 @@ data: string; }; type AcpRuntimeTurnInput = { @@ -581,7 +621,7 @@ index e8102ac..d3a9ba6 100644 handle: AcpRuntimeHandle; text: string; attachments?: AcpRuntimeTurnAttachment[]; -@@ -141,6 +143,11 @@ type AcpTextDeltaOriginMeta = { +@@ -141,6 +143,11 @@ kind?: string; source?: string; }; @@ -593,7 +633,7 @@ index e8102ac..d3a9ba6 100644 type AcpRuntimeEvent = { type: "text_delta"; text: string; -@@ -186,6 +193,10 @@ type AcpRuntimeEvent = { +@@ -186,6 +193,10 @@ * non-null `input` schema. */ availableCommands?: AcpRuntimeAvailableCommand[]; @@ -604,7 +644,7 @@ index e8102ac..d3a9ba6 100644 } | { type: "tool_call"; text: string; -@@ -312,7 +323,49 @@ type AcpRuntimeOptions = { +@@ -312,7 +323,49 @@ elicitationModes?: readonly AcpElicitationMode[]; onPermissionRequest?: (req: AcpPermissionRequest, ctx: { signal: AbortSignal; @@ -654,7 +694,7 @@ index e8102ac..d3a9ba6 100644 }; type AcpFileSessionStoreOptions = { stateDir: string; -@@ -369,6 +422,7 @@ declare class AcpRuntimeManager { +@@ -369,6 +422,7 @@ private createAndSaveRuntimeRecord; private retainInitializedSessionOwner; startTurn(input: { @@ -662,7 +702,7 @@ index e8102ac..d3a9ba6 100644 handle: AcpRuntimeHandle; text: string; attachments?: AcpRuntimeTurnAttachment[]; -@@ -414,6 +468,7 @@ declare class AcpRuntimeManager { +@@ -414,6 +468,7 @@ private cleanupRuntimeTurn; private finalizeRuntimeTurnRecord; runTurn(input: { @@ -671,10 +711,9 @@ index e8102ac..d3a9ba6 100644 text: string; attachments?: AcpRuntimeTurnAttachment[]; diff --git a/dist/runtime.js b/dist/runtime.js -index a1f4a70..fe2484d 100644 --- a/dist/runtime.js +++ b/dist/runtime.js -@@ -371,7 +371,7 @@ const PROMPT_EVENT_PARSERS = { +@@ -371,7 +371,7 @@ current_mode_update: (payload) => statusUpdateEvent("current_mode_update", payload), config_option_update: (payload) => statusUpdateEvent("config_option_update", payload), session_info_update: (payload) => statusUpdateEvent("session_info_update", payload), @@ -683,10 +722,11 @@ index a1f4a70..fe2484d 100644 client_operation: clientOperationEvent, update: updateStatusEvent, done: () => null, -@@ -424,6 +424,34 @@ function availableCommandsUpdateEvent(payload) { +@@ -423,6 +423,34 @@ + tag: "available_commands_update", availableCommands }; - } ++} +function persistedGoalCapability(goal) { + if (!isRecord(goal) || goal.version !== 1 || goal.controlMethod !== "_session/goal" || !Array.isArray(goal.actions)) return; + const actions = goal.actions.filter((action) => ["set", "pause", "resume", "clear"].includes(action)); @@ -714,11 +754,10 @@ index a1f4a70..fe2484d 100644 + entries.push({ content, status, ...priority ? { priority } : {} }); + } + return { type: "plan", tag: "plan", entries }; -+} + } function normalizeUsageCost(value) { if (!isRecord(value)) return; - const amount = asOptionalFiniteNumber(value.amount); -@@ -812,7 +840,21 @@ var AcpRuntimeManager = class { +@@ -812,7 +840,21 @@ this.deps = deps; } createClient(options) { @@ -741,7 +780,7 @@ index a1f4a70..fe2484d 100644 } createSessionOwner(input) { const owner = { -@@ -821,12 +863,16 @@ var AcpRuntimeManager = class { +@@ -821,12 +863,16 @@ pendingSessionUpdates: [] }; input.client.setEventHandlers({ @@ -758,7 +797,7 @@ index a1f4a70..fe2484d 100644 const active = owner.activeTurn; if (active) { const { task, turn } = active; -@@ -863,6 +909,9 @@ var AcpRuntimeManager = class { +@@ -863,6 +909,9 @@ projection.checkpoint.request(); } routeOwnedClientOperation(owner, operation) { @@ -768,7 +807,7 @@ index a1f4a70..fe2484d 100644 const active = owner.activeTurn; if (!active) return; const { task, turn } = active; -@@ -1008,6 +1057,8 @@ var AcpRuntimeManager = class { +@@ -1008,6 +1057,8 @@ record.closedAt = void 0; record.protocolVersion = owner.client.initializeResult?.protocolVersion; record.agentCapabilities = owner.client.initializeResult?.agentCapabilities; @@ -777,7 +816,7 @@ index a1f4a70..fe2484d 100644 applyLifecycleSnapshotToRecord(record, owner.client.getAgentLifecycleSnapshot()); } async finishBufferedOwnerControl(owner, record) { -@@ -1086,6 +1137,11 @@ var AcpRuntimeManager = class { +@@ -1086,6 +1137,11 @@ record.closed = false; record.closedAt = void 0; this.closingActiveRecords.delete(record.acpxRecordId); @@ -789,7 +828,7 @@ index a1f4a70..fe2484d 100644 await this.options.sessionStore.save(record); return record; } -@@ -1149,6 +1205,8 @@ var AcpRuntimeManager = class { +@@ -1149,6 +1205,8 @@ this.closingActiveRecords.delete(record.acpxRecordId); record.protocolVersion = client.initializeResult?.protocolVersion; record.agentCapabilities = client.initializeResult?.agentCapabilities; @@ -798,7 +837,7 @@ index a1f4a70..fe2484d 100644 applyConfigOptionsToRecord(record, session.sessionResult); const modelApplication = await applyRequestedModelIfAdvertised({ client, -@@ -1301,6 +1359,7 @@ var AcpRuntimeManager = class { +@@ -1301,6 +1359,7 @@ client: turn.client, sessionId, prompt: task.promptInput, @@ -806,7 +845,7 @@ index a1f4a70..fe2484d 100644 timeoutMs: task.input.timeoutMs ?? this.options.timeoutMs, conversation: turn.conversation, promptMessageId: turn.promptMessageId, -@@ -1469,6 +1528,10 @@ var AcpRuntimeManager = class { +@@ -1469,6 +1528,10 @@ setSessionConfigOption: async (configId, value) => { return (await task.state.activeController.setResolvedSessionConfigOption(configId, value)).response; }, @@ -817,7 +856,7 @@ index a1f4a70..fe2484d 100644 setResolvedSessionConfigOption: async (configId, value) => await this.setRuntimeResolvedSessionConfigOption(task, turn, configId, value) }; } -@@ -1575,6 +1638,8 @@ var AcpRuntimeManager = class { +@@ -1575,6 +1638,8 @@ reconcileAgentSessionId(turn.record, turn.record.agentSessionId); turn.record.protocolVersion = turn.client.initializeResult?.protocolVersion; turn.record.agentCapabilities = turn.client.initializeResult?.agentCapabilities; @@ -826,10 +865,11 @@ index a1f4a70..fe2484d 100644 turn.record.acpx = turn.acpxState; applyConversation(turn.record, turn.conversation); applyLifecycleSnapshotToRecord(turn.record, turn.client.getAgentLifecycleSnapshot()); -@@ -1707,6 +1772,17 @@ var AcpRuntimeManager = class { +@@ -1706,6 +1771,17 @@ + applyDesiredConfigOptionToRecord(connectedRecord, configId, value); }); await this.options.sessionStore.save(result.record); - } ++ } + async requestExtension(input) { + const recordId = input.handle.acpxRecordId ?? input.handle.sessionKey; + return await this.withManagerLock(this.runtimeOperationLocks, recordId, async () => { @@ -840,11 +880,10 @@ index a1f4a70..fe2484d 100644 + return await client.requestExtension(input.method, input.params); + })).value; + }); -+ } + } async cancel(handle) { await this.activeControllers.get(handle.acpxRecordId ?? handle.sessionKey)?.requestCancelActivePrompt(); - } -@@ -2055,6 +2131,7 @@ var AcpxRuntime = class { +@@ -2055,6 +2131,7 @@ const turnPromise = this.getManager().then((manager) => manager.startTurn({ handle, text: input.text, @@ -852,7 +891,7 @@ index a1f4a70..fe2484d 100644 attachments: input.attachments, mode: input.mode, sessionMode: state.mode, -@@ -2087,6 +2164,7 @@ var AcpxRuntime = class { +@@ -2087,6 +2164,7 @@ yield* (await this.getManager()).runTurn({ handle, text: input.text, @@ -860,10 +899,11 @@ index a1f4a70..fe2484d 100644 attachments: input.attachments, mode: input.mode, sessionMode: state.mode, -@@ -2119,6 +2197,14 @@ var AcpxRuntime = class { +@@ -2118,6 +2196,14 @@ + async setConfigOption(input) { const { handle, state } = this.resolveManagerHandle(input.handle); await (await this.getManager()).setConfigOption(handle, input.key, input.value, state.mode); - } ++ } + async requestExtension(input) { + const { handle, state } = this.resolveManagerHandle(input.handle); + return await (await this.getManager()).requestExtension({ @@ -871,19 +911,15 @@ index a1f4a70..fe2484d 100644 + handle, + sessionMode: input.sessionMode ?? state.mode + }); -+ } + } async cancel(input) { const { handle } = this.resolveManagerHandle(input.handle); - await (await this.getManager()).cancel(handle); -@@ -2178,4 +2264,4 @@ function createRuntimeStore(options) { +@@ -2178,4 +2264,4 @@ //#endregion export { ACPX_BACKEND_ID, AcpRuntimeError, AcpxRuntime, DEFAULT_AGENT_NAME, REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, REQUESTED_MODEL_UNSUPPORTED_REASONS, RequestedModelUnsupportedError, createAcpRuntime, createAgentRegistry, createFileSessionStore, createRuntimeStore, decodeAcpxRuntimeHandleState, encodeAcpxRuntimeHandleState, isAcpRuntimeError, isRequestedModelUnsupportedError }; --//# sourceMappingURL=runtime.js.map -\ No newline at end of file -+//# sourceMappingURL=runtime.js.map +-//# sourceMappingURL=runtime.js.map+//# sourceMappingURL=runtime.js.map diff --git a/dist/session-options-DwRDODlr.d.ts b/dist/session-options-DwRDODlr.d.ts -index c3da164..5ccc8dd 100644 --- a/dist/session-options-DwRDODlr.d.ts +++ b/dist/session-options-DwRDODlr.d.ts @@ -1,4 +1,5 @@ @@ -892,7 +928,7 @@ index c3da164..5ccc8dd 100644 //#region src/prompt-content.d.ts type PromptInput = ContentBlock[]; //#endregion -@@ -27,6 +28,8 @@ type AcpElicitationContext = { +@@ -27,6 +28,8 @@ requestId: JsonRpcId; /** Aborts with the request itself or its owning prompt turn/session. */ signal: AbortSignal; @@ -901,7 +937,7 @@ index c3da164..5ccc8dd 100644 }; type AcpElicitationResponseMeta = { _meta?: Record | null; -@@ -116,6 +119,35 @@ type AcpClientOptions = { +@@ -116,6 +119,35 @@ }; env?: Record; }; @@ -937,7 +973,7 @@ index c3da164..5ccc8dd 100644 onAcpMessage?: (direction: AcpMessageDirection, message: AcpJsonRpcMessage) => void; onAcpOutputMessage?: (direction: AcpMessageDirection, message: AcpJsonRpcMessage) => void; onSessionUpdate?: (notification: SessionNotification) => void; -@@ -123,6 +155,8 @@ type AcpClientOptions = { +@@ -123,6 +155,8 @@ onPermissionEscalation?: (event: PermissionEscalationEvent) => void; onPermissionRequest?: (req: AcpPermissionRequest, ctx: { signal: AbortSignal; @@ -946,7 +982,7 @@ index c3da164..5ccc8dd 100644 }) => Promise; }; declare const SESSION_RECORD_SCHEMA: "acpx.session.v1"; -@@ -263,12 +297,15 @@ type SessionRecord = { +@@ -263,12 +297,15 @@ lastAgentDisconnectReason?: string; protocolVersion?: number; agentCapabilities?: AgentCapabilities; @@ -963,10 +999,8 @@ index c3da164..5ccc8dd 100644 acpx?: SessionAcpxState; importedFrom?: SessionImportedFrom; }; -@@ -295,4 +332,4 @@ type SessionAgentOptions = { +@@ -295,4 +332,4 @@ }; //#endregion export { SessionRecord as _, AcpElicitationHandler as a, AcpElicitationResponse as c, AuthPolicy as d, McpServer$1 as f, PermissionStats as g, PermissionPolicy as h, AcpElicitationContext as i, AcpPermissionDecision as l, PermissionMode as m, SystemPromptOption as n, AcpElicitationMode as o, NonInteractivePermissionPolicy as p, AcpClientOptions as r, AcpElicitationRequest as s, SessionAgentOptions as t, AcpPermissionRequest as u, PromptInput as v }; --//# sourceMappingURL=session-options-DwRDODlr.d.ts.map -\ No newline at end of file -+//# sourceMappingURL=session-options-DwRDODlr.d.ts.map +-//# sourceMappingURL=session-options-DwRDODlr.d.ts.map+//# sourceMappingURL=session-options-DwRDODlr.d.ts.map From 8b4536f2b2be3f423e3e02f411bd71744b9e60b1 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 11:40:02 -0500 Subject: [PATCH 06/31] Wire the pinned Cursor candidate into rich ACP transport and packs Co-Authored-By: Paperclip --- .../scripts/candidate-provider-pack.mjs | 7 +++++++ .../src/drivers/acpx/capability-profiles.ts | 2 +- .../src/drivers/acpx/profile-extensions.ts | 10 ++++++---- .../src/drivers/acpx/profile-installation.ts | 7 ++++++- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/paperclip-runner/scripts/candidate-provider-pack.mjs b/packages/paperclip-runner/scripts/candidate-provider-pack.mjs index 083d8fbb3a4..3d2f73f16c8 100644 --- a/packages/paperclip-runner/scripts/candidate-provider-pack.mjs +++ b/packages/paperclip-runner/scripts/candidate-provider-pack.mjs @@ -1,3 +1,4 @@ +import { materializePinnedCursorDistribution } from "./materialize-cursor-distribution.mjs"; const CANDIDATES = new Set(["cursor", "copilot", "pi"]); export function parseProviderPackArguments(args) { @@ -18,5 +19,11 @@ export function parseProviderPackArguments(args) { /** Closed source-owned builder registry; provider branches add their exact pins. */ export async function materializeCandidateProviderPack({ provider, outputRoot }) { if (!CANDIDATES.has(provider)) throw new Error("Unknown candidate provider"); + if (provider === "cursor") { + const result = await materializePinnedCursorDistribution({ destination: outputRoot }); + return { version: result.version, + profileDigest: "sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899", + closureDigest: `sha256:${result.closureSha256}` }; + } throw new Error(`The ${provider} candidate distribution builder is not included in this source revision`); } diff --git a/packages/paperclip-runner/src/drivers/acpx/capability-profiles.ts b/packages/paperclip-runner/src/drivers/acpx/capability-profiles.ts index 4a70c22e25b..18f9ad57e8d 100644 --- a/packages/paperclip-runner/src/drivers/acpx/capability-profiles.ts +++ b/packages/paperclip-runner/src/drivers/acpx/capability-profiles.ts @@ -43,7 +43,7 @@ export const ACPX_CAPABILITY_PROFILES: Readonly { - return {}; +export function acpxProfileClientCapabilities(agent: QualifiedAcpxAgent): Record { + return agent === "cursor" ? structuredClone(CURSOR_CLIENT_CAPABILITIES) : {}; } /** Reject an oversized approval document; never silently approve a truncated revision. */ diff --git a/packages/paperclip-runner/src/drivers/acpx/profile-installation.ts b/packages/paperclip-runner/src/drivers/acpx/profile-installation.ts index a78aa47c6c5..4ac92c30880 100644 --- a/packages/paperclip-runner/src/drivers/acpx/profile-installation.ts +++ b/packages/paperclip-runner/src/drivers/acpx/profile-installation.ts @@ -1,8 +1,11 @@ +import { verifyCursorInstallation } from "./cursor-installation.js"; +import { assertCursorWorkspacePolicy } from "./cursor-launch-policy.js"; import type { QualifiedAcpxAgent, QualifiedAcpxProfile } from "./qualified-profiles.js"; import { verifyQualifiedAcpxInstallation, type VerifiedAcpxInstallation } from "./installation-integrity.js"; /** Closed build-owned registry. Provider branches add their pinned installations here. */ export async function verifyAcpxProfileInstallation(profile: QualifiedAcpxProfile): Promise { + if (profile.agent === "cursor") return verifyCursorInstallation(profile); if (profile.agent !== "claude" && profile.agent !== "codex" && profile.agent !== "grok") { throw new Error(`ACPX ${profile.agent} verified candidate distribution is not installed in this build`); } @@ -10,7 +13,9 @@ export async function verifyAcpxProfileInstallation(profile: QualifiedAcpxProfil } /** Provider policy admission is repeated immediately before each process launch. */ -export async function assertAcpxProfileWorkspace(_agent: QualifiedAcpxAgent, _workspace: string): Promise {} +export async function assertAcpxProfileWorkspace(agent: QualifiedAcpxAgent, workspace: string): Promise { + if (agent === "cursor") await assertCursorWorkspacePolicy(workspace); +} /** Candidate branches validate only explicitly bound, sanitized launch credentials. */ export function assertAcpxProfileEnvironment(_agent: QualifiedAcpxAgent, _environment: Readonly): void {} From 747ca61ad094c3b5c32de8c800be3e29fc42d9b2 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 12:10:22 -0500 Subject: [PATCH 07/31] Bind Cursor candidate assets to Daytona image content Co-Authored-By: Paperclip --- tests/runner-e2e/daytona-image-content.ts | 2 ++ tests/runner-e2e/daytona-image.test.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/runner-e2e/daytona-image-content.ts b/tests/runner-e2e/daytona-image-content.ts index 92ffbe1b70c..13cd2b58f5b 100644 --- a/tests/runner-e2e/daytona-image-content.ts +++ b/tests/runner-e2e/daytona-image-content.ts @@ -29,6 +29,7 @@ export const DAYTONA_IMAGE_INPUT_PATHS = [ "packages/paperclip-eval-kernel/tsconfig.json", "packages/paperclip-runner/scripts/provision-grok.mjs", "packages/paperclip-runner/package.json", + "packages/paperclip-runner/cursor-distributions.json", "packages/paperclip-runner/protocol", "packages/paperclip-runner/runner/Cargo.lock", "packages/paperclip-runner/runner/Cargo.toml", @@ -36,6 +37,7 @@ export const DAYTONA_IMAGE_INPUT_PATHS = [ "packages/paperclip-runner/scripts/acpx-sidecar-contract.mjs", "packages/paperclip-runner/scripts/build-provider-pack.mjs", "packages/paperclip-runner/scripts/candidate-provider-pack.mjs", + "packages/paperclip-runner/scripts/materialize-cursor-distribution.mjs", "packages/paperclip-runner/scripts/build-verified-provider-entrypoints.mjs", "packages/paperclip-runner/scripts/generate-acpx-sidecar-contract.mjs", "packages/paperclip-runner/scripts/generate-protocol-schema-module.mjs", diff --git a/tests/runner-e2e/daytona-image.test.ts b/tests/runner-e2e/daytona-image.test.ts index 997a8e5bd61..45205e66785 100644 --- a/tests/runner-e2e/daytona-image.test.ts +++ b/tests/runner-e2e/daytona-image.test.ts @@ -200,6 +200,8 @@ describe("runner E2E Daytona image contract", () => { "packages/paperclip-eval-kernel/src", "packages/paperclip-runner/package.json", "packages/paperclip-runner/scripts/candidate-provider-pack.mjs", + "packages/paperclip-runner/scripts/materialize-cursor-distribution.mjs", + "packages/paperclip-runner/cursor-distributions.json", "packages/paperclip-runner/runner/crates", "packages/paperclip-runner/src", ]) { From 4235e35070e074618df5ed3f1f9ab850e2ac2376 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 12:13:35 -0500 Subject: [PATCH 08/31] Record Cursor candidate pack proof and exact remaining rich event gaps Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 51 ++++- .../provider-pack-darwin-arm64.json | 61 ++++++ .../provider-pack-offline-proof.json | 184 ++++++++++++++++++ 3 files changed, 287 insertions(+), 9 deletions(-) create mode 100644 packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json create mode 100644 packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index 73a015465de..b061dace2c8 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -14,12 +14,12 @@ The reference is the runner's Codex app-server integration and its closed thread ## Capability matrix against Codex app-server -“Implemented” below means a tested Cursor boundary implementation; the shared runtime must route its canonical events and durable requests. It is not a claim of authenticated end-to-end qualification. +“Implemented” below means a tested Cursor implementation wired through the shared runtime, canonical activity channel and durable interaction path. It is not a claim of authenticated end-to-end qualification. | Capability | Cursor harness/ACP evidence | Paperclip treatment | Remaining gap or qualification | |---|---|---|---| | Streaming assistant/reasoning | `agent_message_chunk`, `agent_thought_chunk` in live and replay presenters | Existing ACP streaming path | Authenticated event capture required | -| Tool lifecycle/input/output | `tool_call` and `tool_call_update`, including raw input/output, locations and content | Existing canonical tool lifecycle; Cursor extensions add semantic activity | Standard content blocks/diffs must survive shared ACPX mapping; evaluate captured field coverage | +| Tool lifecycle/input/output | `tool_call` and `tool_call_update`, including raw input/output, locations and content | Canonical lifecycle, bounded output, input-changed indicator and one relative target; Cursor extensions add semantic activity | Raw input body, structured content/diffs/media and additional locations are not projected. See the exact field audit below | | Human questions | `cursor/ask_question`, native single/multiple selections | `normalizeCursorQuestionRequest`: all questions required; opaque UI IDs round-trip native IDs; forged/duplicate/missing selections rejected | Active-turn adapter maps canonical answers, decline to skipped, and cancellation; durable delivery still requires end-to-end evidence | | Proposed plans and decisions | `cursor/create_plan` with full Markdown, overview, todos, named phases and project flag | `normalizeCursorPlanRequest`: complete presentation; accept/reject/cancel; revision-derived question ID; rejection feedback | Foundation question descriptions allow 100,000 chars; this boundary also enforces the 196 KiB UTF-8 durable payload cap. Oversize rejects; it is never truncated. No generated `planUri`, since no uploaded plan artifact is fabricated | | Execution checklist | Standard ACP `plan` and `cursor/update_todos` (`merge`) | Per-turn reducer merges by native ID and emits complete snapshots with increasing revisions | Native cancelled status is visible as “Cancelled” with canonical blocked status, since canonical plan schema has no cancelled enum | @@ -27,7 +27,7 @@ The reference is the runner's Codex app-server integration and its closed thread | Completed subagent tasks | `cursor/task`: description, prompt, subtype, model, ID, duration | Canonical delegation with role, model, task and duration in activity summary | Dedicated numeric duration field absent from canonical delegation schema | | Subagent questions | Pinned ACP subagent handler explicitly rejects interactive questions | No unsupported affordance advertised | Confirmed harness omission; requires upstream support | | Generated images | `cursor/generate_image`: description, path and reference-image paths | Canonical generated/viewed artifact events; description notice; realpath/regular-file containment checks; `registered:false` | Paths are references, not automatic uploads. Revalidate before artifact ingestion. No image bytes invented | -| Files and diffs | Tool content/location extraction, native edit output | Existing workspace-diff machinery plus canonical tool events | Need live fixture proving complete before/after content and path attribution; currently unverified | +| Files and diffs | Tool `content` includes `diff` blocks with `path`, `oldText`, `newText`; native edit output and locations | Tool lifecycle plus the runner’s separate workspace-change evidence | Provider-reported before/after blocks are preserved by ACPX but not consumed by the canonical mapper. Additional and absolute locations are dropped; structured provider-diff projection needs implementation and live proof | | True active-turn steering | No `session/steer`; `handlePrompt` cancels its existing pending prompt before starting another | Advertise steering unsupported | Concurrent prompt is interruption/replacement, not Codex-style in-place steering. Do not mislabel it | | Queued follow-ups | No harness queue method discovered | Control-plane scheduling can send another prompt after settlement | No native queue-management events; do not send concurrently to emulate queueing | | Cancellation | `session/cancel` calls the active prompt cancellation callback | Existing interruption path | Process/child cleanup and exact terminal settlement require live qualification | @@ -37,7 +37,7 @@ The reference is the runner's Codex app-server integration and its closed thread | Fork/resume methods | `session/fork` and `session/resume` absent in agent implementation and return method-not-found | Unsupported | Session load is available; do not infer fork from SDK schema | | Modes | `agent`, `plan`, `ask`; `session/set_mode` and `current_mode_update` | Existing review/mode activity plumbing can display changes | Generic operator mode-selection surface not implemented in this provider slice | | Model selection | `session/set_model`, config option `model`, model-parameter options, `config_option_update`; `cursor/list_available_models` extension | Exact requested model must be selected/verified by shared admission | Available-model listing is authenticated; no model ID guessed or silently substituted. Parameterized model UI not added | -| Available commands | `available_commands_update`, including skills/slash commands | Existing ACP runtime event path | Command-specific UI/discovery not implemented; preserve bounded metadata where shared mapping permits | +| Available commands | `available_commands_update`, including skills/slash commands | ACPX persists command metadata; runner canonical mapper deliberately emits no display event | Command picker and bounded command-discovery surface are not implemented | | Session metadata | `session_info_update` title after automatic naming | Capability documented | Runner owns normalized session identity; provider title is currently not surfaced | | Prompt media | Image=true, audio=false, embeddedContext=false in observed initialize | Image inputs may be admitted by advertised capability | Product attachment-to-ACP conversion needs qualified test; audio/embedded context unsupported | | MCP and semantic tools | Session MCP injection supports stdio/HTTP/SSE; user/project config also loaded | Runner-owned authenticated MCP bridge only; fail closed on ambient project MCP | Exact tool discovery and company/token boundary remain live tests | @@ -49,11 +49,11 @@ The reference is the runner's Codex app-server integration and its closed thread The documentation calls todo/task/image methods notifications. The pinned presenter actually calls `connection.extMethod(...).catch(...)`: these messages can carry JSON-RPC IDs. They need immediate acknowledgement plus activity normalization. They must never become human input requests or block awaiting an unnecessary decision. -Question and plan requests lack a session ID. The shared hook must bind them to the retained connection, active execution/session/turn and originating request ID; reject stale/duplicate answers; cancel on turn termination; persist requests before exposing them; and acknowledge provider delivery before settlement. The provider module does not substitute a best-guess session. +Question and plan requests lack a session ID. The shared hook binds them to the retained connection, active execution/session/turn and originating request ID; it rejects stale/duplicate answers, cancels on turn termination, persists requests before exposing them, and awaits exact JSON-RPC pipe-write delivery before recording a resolved interaction. This proves transport handoff, not an additional provider application-level acknowledgement. The provider module does not substitute a best-guess session. Fixed launch arguments are `--disable-project-configs --disable-auto-update acp`, using the verified bundled Node and absolute verified `index.js`. Private HOME/XDG roots are required together with CURSOR_CONFIG_DIR, CURSOR_DATA_DIR, a private compile cache, `AGENT_CLI_CREDENTIAL_STORE=memory`, and `NO_OPEN_BROWSER=1`. Only explicitly bound CURSOR_API_KEY or CURSOR_AUTH_TOKEN may enter; never inherit shell credentials. Do not use `--force`, `--trust`, or `--approve-mcps` to paper over governance. -`--disable-project-configs` only suppresses `.cursor/cli.json`. It does not suppress project MCP, Cursor/Claude hooks, or installed plugins. `assertCursorWorkspacePolicy` refuses ambient project execution config from the workspace through its nearest Git root, including symlinks and unreadable configuration. Ordinary Claude settings with neither hooks nor plugins remain admissible. Enterprise system hooks are checked too. The host must protect these config paths during execution and repeat admission checks on recovery. Admission alone cannot prevent a concurrent file mutation. Team-provided remote hooks are another upstream boundary and remain unqualified under restrictive execution. +`--disable-project-configs` only suppresses `.cursor/cli.json`. It does not suppress project MCP, Cursor/Claude hooks, or installed plugins. `assertCursorWorkspacePolicy` refuses ambient project execution config from the workspace through its nearest Git root, including symlinks and unreadable configuration. Ordinary Claude settings with neither hooks nor plugins remain admissible. Enterprise system hooks are checked too. The host repeats admission checks before native launch. Continuous protection of these config paths during execution remains a qualification requirement. Admission alone cannot prevent a concurrent file mutation. Team-provided remote hooks are another upstream boundary and remain unqualified under restrictive execution. Artifact paths are never automatically read or uploaded. References require a present regular file under the physical workspace, reject traversal and symbolic links, and retain `registered:false`. Private/outside paths are omitted and produce a visible warning. This is metadata validation, not durable file ownership or a replacement for artifact registration checks. @@ -61,14 +61,14 @@ Artifact paths are never automatically read or uploaded. References require a pr Passed in the provider worktree: -- 14 Cursor Vitest cases: questions, multi-selection, native ID round-trip, invalid answers, exact plan revisions, outcomes, todo delta merging, delegation metadata, path containment/symlink refusal, child identity retention, private launch defaults and project config gates; active-turn canonical response mapping and immediate acknowledgements; stale/foreign/unknown child identity rejection. +- 17 Cursor Vitest cases: questions, multi-selection, native ID round-trip, invalid answers, exact plan revisions, outcomes, todo delta merging, delegation metadata, path containment/symlink refusal, child identity retention, private launch defaults and project config gates; active-turn canonical response mapping and immediate acknowledgements; stale/foreign/unknown child identity rejection. - 5 materializer Node tests: platform pins, entire-tree tampering, linked paths, archive tampering before extraction, and overwrite refusal. - Targeted strict TypeScript compilation for both provider modules and their imported contracts. - Credential-free wire initialization and auth/method probes, plus real macOS ARM64 materialization and archive/closure inventories for the other two platforms. -The generic native-distribution lease now snapshots the pinned closure, launches Cursor through its verified bundled Node with a closed-module guard, and uses the existing lifetime guardian. A real nonbillable Cursor initialization passed through that lease. Its six focused tests passed, including argument fencing, external module rejection, and native child ownership/exit proof. The existing snapshot suite passed; four legacy installation tests were blocked by the shared installed Claude SDK (0.3.280 versus the pinned 0.3.263), with the remaining legacy tests passing or platform-skipped. +The generic native-distribution lease now snapshots the pinned closure, launches Cursor through its verified bundled Node with a closed-module guard, and uses the existing lifetime guardian. A real nonbillable Cursor initialization passed through that lease. Its six focused tests passed, including argument fencing, external module rejection, and native child ownership/exit proof. The existing snapshot suite also passed. The foundation’s later master integration refreshes the common Claude/Codex pins; the candidate pack below was built against that synchronized graph. -Priority follow-ups before advertising support: (1) shared hook integration with durable response/recovery tests; (2) authenticated native lifetime and cleanup proof; (3) explicit credentials plus exact available model and measured dollar budget; (4) local and Daytona semantic tools, permissions, steering distinction, files/artifacts, questions/plans and settlement proof; (5) field-by-field captured trace audit to identify any additional unconsumed native fields. +Priority follow-ups before advertising support: (1) explicit credentials, exact available model and measured dollar budget; (2) authenticated native lifetime, cleanup and restrictive denial proof; (3) local and Daytona semantic tools, files/artifacts, questions/plans and settlement proof; (4) parent tool content/diff projection and richer nested child presentation; (5) authenticated trace audit for additional unconsumed native fields. Shared receipt/recovery coverage now proves pipe delivery, provider-loss expiry, exact lifecycle IDs and no approval replay. Remaining rich capabilities intentionally unused: session discovery, generic mode/config-option UI, provider session titles, command/skill picker metadata, full nested child transcripts beyond bounded delegation summaries, native numeric task duration, and optional planUri. They are listed above with reasons; neither “unsupported” nor “complete” should be inferred for unverified live behaviors. The final combined report must update this inventory with integration evidence and include any further events observed during authenticated qualification. @@ -81,3 +81,36 @@ Pinned source creates a separate session-update presenter for every child and ca Child assistant/reasoning text, plan steps and tool lifecycle are displayed in each child's activity summary. The 4,000-character activity surface retains a clearly marked tail when it fills; this is a summary, not a complete nested transcript. Child tool raw input/output, locations, diffs, media content and other child update fields are not rendered by this summary surface and produce explicit partial-detail notices. Adding canonical child transcript/tool surfaces is the next priority for these meaningful exposed fields. Native `capabilities:{}` currently carries no populated child capability fields; `_meta.cursor.agentId` and `toolCallId` are retained internally for immutable origin checks. Nested parent identity is represented in activity metadata because canonical delegation has no parent-child relation field. Native `disconnected` now yields a failed child with a visible explanation, never a successful completion. Three real ACP stream tests prove child lifecycle/transcript preservation before SDK parsing, nested parent attribution, standard parent parsing, and old-stream/turn/connection fences. Existing nine shared extension and Pi receipt package tests pass unchanged against the resulting patched package. Three native factory cases verify all platform pins, exact profiles, and rejection of unsupported distributions; native assets resolve only from the runner-owned package authority. + +## Integrated pack and offline launch evidence + +The full `build-provider-pack.mjs --candidate-providers=cursor` path passed on source `f4bb4a5c316acf12f08a2caf8b9a0ad311588210` (foundation includes upstream master `14795136f56c11ed83dc754791945bb5a0b8f7fd`). It used standalone Node, pnpm 9.15.4, a fresh production deployment and the pinned vendor archive. The build checked portable Node relocation, fresh ACPX import and complete Cursor materialization. The retained manifest is `packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json`; it contains only relative paths and digests. + +- Pack digest: `sha256:2f791844619982531282197e8554c2d1e1a2a031bd92e1abf78dae087fc80af6`. +- Cursor declaration: `sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899`. +- macOS ARM64 closure: `sha256:77394184a89b0e7384971181da19c3c82d83a399b04e7944b3f94fe3d7e62b25`. +- Resolved dependency lock: `sha256:774e3070ecba7bedaf70502a1a85bc05df535db1b34462b389de49031b6b8232`, also the reviewed Daytona build digest for this branch. CI regenerates the lock from source-owned patches and rejects a different digest before execution. + +`provider-pack-offline-proof.json` records a real launch from the pack’s verified native closure and retained snapshot, using private directories and no credentials. ACP v1 initialize succeeds. The correct `cursor/list_available_models`, `session/list` and `session/new` methods return authentication-required; `session/fork` and `session/resume` return method-not-found. The process produced no stderr, was explicitly terminated after these probes, and its lease closed. The earlier discovery fixture’s `_cursor/list_available_models` probe used an incorrect method prefix; this later probe corrects that uncertainty without changing the original evidence. + +After rebase: TypeScript/verified-sidecar build passed; 17 Cursor Vitest cases, 28 installed ACPX/materializer Node cases, and 6 Daytona image-content cases passed. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. Total billable prompts and spend remain zero. + +## Exact remaining field audit + +This source audit follows pinned native update → ACPX runtime → `canonicalProviderEventsFromAcpxRuntimeEvent` → Paperclip activity. It supplements the higher-level capability matrix and does not claim an authenticated trace was captured. + +| Native field/interface | Preserved boundary | Current projection / reason for partial use | Follow-up | +|---|---|---|---| +| Parent tool `rawInput` | ACPX forwards the body | Canonical tool schema exposes only `inputUpdated`; full native arguments are not displayed | P1: bounded/redacted tool-argument presentation with company and path checks | +| Parent tool `content[]` diff `path`, `oldText`, `newText` | ACPX forwards structured content; native permission requests also use it for proposed changes | Canonical tool mapper uses `rawOutput`, so completed provider-reported diff blocks have no dedicated output surface; separate workspace evidence is not equivalent | P1: validate physical workspace locations and expose attributed diff artifacts | +| Parent tool `content[]` images/resource blocks | ACPX forwards blocks and produces a summary | Structured media is unused by canonical tool output; safe registration/location semantics must precede ingestion | P1: validated artifact reference projection with explicit provenance | +| Parent tool `locations[]` | ACPX forwards bounded locations | Only first relative location becomes `target`; absolute paths and additional locations are discarded | P1: workspace-aware multi-file attribution; never strip arbitrary absolute prefixes | +| Parent tool `rawOutput` | ACPX forwards raw value | Canonical output is bounded serialized text, not lossless structured data; truncation is marked by output metadata | P2: typed tool-result detail viewer when useful | +| Plan step priority/native extras | ACPX plan entries | Display uses body/status and fixed ordinal step IDs; priority and unknown metadata have no canonical fields | P2: add explicit bounded fields if native traces show product value | +| Commands, config options, session title | ACPX persists/normalizes `available_commands_update`, `config_option_update`, `session_info_update` | Canonical display mapper explicitly skips these tags; exact model admission remains separate | P2: company-scoped command/config/title surfaces | +| Child tool raw arguments/results, locations, diffs and media | Cursor child intercept retains validated update for its adapter | Child activity keeps bounded attributed summaries, with visible partial-detail notices; there is no nested transcript/tool detail surface | P1: canonical child transcript and tool/artifact relation model | +| Child `_meta.cursor.agentId` / tool origin / parent ID | Retained for immutable-origin and descendant checks | Internal identity guards; parent relationship is textual metadata because canonical delegation lacks an edge field | P2: typed delegation lineage | +| Task numeric `durationMs`, optional accepted `planUri` | Native task/plan extensions | Duration is visible in summary; no numeric delegation field. No plan URI is returned because no plan artifact is registered | P2: typed duration; only return an actually registered plan URI | +| Session list, model parameters, generic mode control | Confirmed native ACP methods | No operator UI or cross-session discovery API in this integration; recovery loads only the runner-owned exact session | P2: explicit company-scoped controls; authenticated model catalog first | + +True steering, native queueing, fork/resume, native usage receipts and interactive child questions are absent from this pinned ACP implementation as described above. Their absence is distinct from the implemented-but-unused fields in this table. Remote team hooks, actual artifact traces, authenticated terminal settlement and Linux/Daytona behavior remain unverified, not confirmed absent. diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json new file mode 100644 index 00000000000..028b0012264 --- /dev/null +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json @@ -0,0 +1,61 @@ +{ + "schema": "paperclip-runner/remote-provider-pack/v1", + "digest": "sha256:2f791844619982531282197e8554c2d1e1a2a031bd92e1abf78dae087fc80af6", + "payload": { + "pins": { + "nodeMinimum": "24.11.0", + "codex": "0.156.0", + "opencode": "1.18.32", + "acpx": "0.13.1", + "claudeAcp": "0.73.0", + "codexAcp": "1.6.2" + }, + "target": { + "platform": "darwin", + "architecture": "arm64" + }, + "runnerSourceRevision": "f4bb4a5c316acf12f08a2caf8b9a0ad311588210", + "distDigest": "sha256:364a72974524c442e8f5a876c3cfe85b071fdb9ab154dad63ac221f7d32b61df", + "bridgeDigest": "sha256:9f4f46c692317ad4a2a9558554695f5e35824f78084924fcc4ce6c2b9a45d7d5", + "acpxProfileDigests": { + "claude": "sha256:9d73d1f0f121fb96cc8badb28c22d5bff02d8582eb2e40360a81c189e1b9422a", + "codex": "sha256:c4538599d1ab767db5dff50934f13bb5ba313a59d9c4a83e993fac4617ea63d3" + }, + "candidateProviders": { + "cursor": { + "version": "2026.09.26-dd393fe", + "profileDigest": "sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899", + "closureDigest": "sha256:77394184a89b0e7384971181da19c3c82d83a399b04e7944b3f94fe3d7e62b25", + "qualification": "pending", + "path": "provider-assets/cursor/darwin-arm64", + "sha256": "sha256:3b6de19114d4df62f648604025a0d71937dfa7c2b15b397cce5da2c5da268994" + } + }, + "artifacts": { + "nodeCommand": { + "path": "node_modules/node/bin/node", + "sha256": "sha256:27db838bb204ef7c21df2931f5656e4c8fb32e6e947f363a402b49714d32b5b1" + }, + "productionLock": { + "path": "pnpm-lock.yaml", + "sha256": "sha256:774e3070ecba7bedaf70502a1a85bc05df535db1b34462b389de49031b6b8232" + }, + "opencodeCommand": { + "path": "node_modules/.bin/opencode", + "sha256": "sha256:abed4de9c27d7add7180a13159d5e535490ee46993d650db150a91d53cbe544a" + }, + "opencodeExecutable": { + "path": "node_modules/opencode-ai/bin/opencode.exe", + "sha256": "sha256:a3c45d4e1d6620b436851f1ef6b25c71befcf06a382e279a1eb1c2196424395e" + }, + "opencodeProxy": { + "path": "dist/cli/opencode-app-server-proxy.cjs", + "sha256": "sha256:4b5599705325483dc5922dde126435eb102153acadca367163525fbfc1676a5c" + }, + "acpxSidecar": { + "path": "dist/cli/acpx-runtime-sidecar.cjs", + "sha256": "sha256:2a11a1abf785215589219eab0f5f87ad30e2a46f78bebfd31f5df7e7bc258294" + } + } + } +} diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json new file mode 100644 index 00000000000..e3ba7c90012 --- /dev/null +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json @@ -0,0 +1,184 @@ +{ + "schema": "paperclip-cursor-offline-pack-proof/v1", + "capturedAt": "2026-09-28T17:11:14.939Z", + "runnerSourceRevision": "f4bb4a5c316acf12f08a2caf8b9a0ad311588210", + "packDigest": "sha256:2f791844619982531282197e8554c2d1e1a2a031bd92e1abf78dae087fc80af6", + "target": { + "platform": "darwin", + "architecture": "arm64" + }, + "candidate": { + "version": "2026.09.26-dd393fe", + "profileDigest": "sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899", + "closureDigest": "sha256:77394184a89b0e7384971181da19c3c82d83a399b04e7944b3f94fe3d7e62b25", + "qualification": "pending", + "path": "provider-assets/cursor/darwin-arm64", + "sha256": "sha256:3b6de19114d4df62f648604025a0d71937dfa7c2b15b397cce5da2c5da268994" + }, + "productionLock": "sha256:774e3070ecba7bedaf70502a1a85bc05df535db1b34462b389de49031b6b8232", + "launch": { + "entrypoint": "verified bundled node + index.js", + "arguments": [ + "--disable-project-configs", + "--disable-auto-update", + "acp" + ], + "credentials": "none; private home/config/data/cache; memory credential store", + "verification": "whole closure digest verification, retained immutable native snapshot, closed module bootstrap" + }, + "requests": [ + { + "method": "initialize", + "params": { + "protocolVersion": 1, + "clientCapabilities": { + "fs": { + "readTextFile": false, + "writeTextFile": false + }, + "terminal": false, + "_meta": { + "subagents": true + } + }, + "clientInfo": { + "name": "paperclip-offline-pack-probe", + "version": "1" + } + } + }, + { + "method": "cursor/list_available_models", + "params": {} + }, + { + "method": "session/list", + "params": {} + }, + { + "method": "session/fork", + "params": { + "sessionId": "probe" + } + }, + { + "method": "session/resume", + "params": { + "sessionId": "probe", + "cwd": "/qualification/private/workspace", + "mcpServers": [] + } + }, + { + "method": "session/new", + "params": { + "cwd": "/qualification/private/workspace", + "mcpServers": [] + } + } + ], + "responses": [ + { + "jsonrpc": "2.0", + "id": 1, + "result": { + "protocolVersion": 1, + "agentCapabilities": { + "loadSession": true, + "mcpCapabilities": { + "http": true, + "sse": true + }, + "promptCapabilities": { + "audio": false, + "embeddedContext": false, + "image": true + }, + "sessionCapabilities": { + "list": {}, + "subagents": {} + } + }, + "authMethods": [ + { + "id": "cursor_login", + "name": "Cursor Login", + "description": "Authenticate using existing Cursor login credentials. Run 'agent login' first if not logged in." + } + ] + } + }, + { + "jsonrpc": "2.0", + "id": 2, + "error": { + "code": -32000, + "message": "Authentication required", + "data": { + "message": "Authentication required. Please run 'agent login' first, then call authenticate() with methodId 'cursor_login'." + } + } + }, + { + "jsonrpc": "2.0", + "id": 3, + "error": { + "code": -32000, + "message": "Authentication required", + "data": { + "message": "Authentication required. Please run 'agent login' first, then call authenticate() with methodId 'cursor_login'." + } + } + }, + { + "jsonrpc": "2.0", + "id": 4, + "error": { + "code": -32601, + "message": "\"Method not found\": session/fork", + "data": { + "method": "session/fork" + } + } + }, + { + "jsonrpc": "2.0", + "id": 5, + "error": { + "code": -32601, + "message": "\"Method not found\": session/resume", + "data": { + "method": "session/resume" + } + } + }, + { + "jsonrpc": "2.0", + "id": 6, + "error": { + "code": -32000, + "message": "Authentication required", + "data": { + "message": "Authentication required. Please run 'agent login' first, then call authenticate() with methodId 'cursor_login'." + } + } + } + ], + "process": { + "exitCode": 143, + "signalCode": null, + "leaseClosed": true, + "stderrBytes": 0, + "unexpectedMessageCount": 0 + }, + "qualification": { + "status": "pending", + "model": null, + "billablePrompts": 0, + "costUsd": 0, + "environment": "local macOS ARM64; no Daytona execution" + }, + "redactions": [ + "ephemeral workspace and private directories replaced with /qualification/private" + ] +} From eb0f43c45a66909197b2cbb59c9eec909bd0b3d3 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 12:34:29 -0500 Subject: [PATCH 09/31] Retain final rebased Cursor pack and registry launch proof Co-Authored-By: Paperclip --- doc/architecture/runner-cursor-capabilities.md | 8 ++++---- .../cursor-acp/provider-pack-darwin-arm64.json | 14 +++++++------- .../cursor-acp/provider-pack-offline-proof.json | 11 ++++++----- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index b061dace2c8..c64b3a9f588 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -84,16 +84,16 @@ Three real ACP stream tests prove child lifecycle/transcript preservation before ## Integrated pack and offline launch evidence -The full `build-provider-pack.mjs --candidate-providers=cursor` path passed on source `f4bb4a5c316acf12f08a2caf8b9a0ad311588210` (foundation includes upstream master `14795136f56c11ed83dc754791945bb5a0b8f7fd`). It used standalone Node, pnpm 9.15.4, a fresh production deployment and the pinned vendor archive. The build checked portable Node relocation, fresh ACPX import and complete Cursor materialization. The retained manifest is `packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json`; it contains only relative paths and digests. +The full `build-provider-pack.mjs --candidate-providers=cursor` path passed on source `1055c13f8cffd8c06070eb6403d3beff83e64374` (foundation includes upstream master `14795136f56c11ed83dc754791945bb5a0b8f7fd`). It used standalone Node, pnpm 9.15.4, a fresh production deployment and the pinned vendor archive. The build checked portable Node relocation, fresh ACPX import and complete Cursor materialization. The retained manifest is `packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json`; it contains only relative paths and digests. -- Pack digest: `sha256:2f791844619982531282197e8554c2d1e1a2a031bd92e1abf78dae087fc80af6`. +- Pack digest: `sha256:480ae2eaa7a61852533286648911304fa1e47d2e40e80dcc19f0cce0149cb77e`. - Cursor declaration: `sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899`. - macOS ARM64 closure: `sha256:77394184a89b0e7384971181da19c3c82d83a399b04e7944b3f94fe3d7e62b25`. - Resolved dependency lock: `sha256:774e3070ecba7bedaf70502a1a85bc05df535db1b34462b389de49031b6b8232`, also the reviewed Daytona build digest for this branch. CI regenerates the lock from source-owned patches and rejects a different digest before execution. -`provider-pack-offline-proof.json` records a real launch from the pack’s verified native closure and retained snapshot, using private directories and no credentials. ACP v1 initialize succeeds. The correct `cursor/list_available_models`, `session/list` and `session/new` methods return authentication-required; `session/fork` and `session/resume` return method-not-found. The process produced no stderr, was explicitly terminated after these probes, and its lease closed. The earlier discovery fixture’s `_cursor/list_available_models` probe used an incorrect method prefix; this later probe corrects that uncertainty without changing the original evidence. +`provider-pack-offline-proof.json` records a real launch through the generic profile installation registry from the pack’s verified native closure and retained snapshot, using private directories and no credentials. ACP v1 initialize succeeds. The correct `cursor/list_available_models`, `session/list` and `session/new` methods return authentication-required; `session/fork` and `session/resume` return method-not-found. The process produced no stderr, was explicitly terminated after these probes, and its lease closed. The earlier discovery fixture’s `_cursor/list_available_models` probe used an incorrect method prefix; this later probe corrects that uncertainty without changing the original evidence. -After rebase: TypeScript/verified-sidecar build passed; 17 Cursor Vitest cases, 28 installed ACPX/materializer Node cases, and 6 Daytona image-content cases passed. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. Total billable prompts and spend remain zero. +At the initial integration checkpoint, 17 Cursor Vitest cases, 28 installed ACPX/materializer Node cases, and 6 Daytona image-content cases passed. After the final foundation rebase to `5aeebb20c`, TypeScript/verified-sidecar build, all 17 Cursor cases, and 11 installed extension-hook/materializer Node cases passed again. The fresh pack/probe above binds this final runtime source. Its explicit offline factory model sentinel is not an authenticated model selection; no ACP prompt was sent. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. Total billable prompts and spend remain zero. ## Exact remaining field audit diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json index 028b0012264..e430c64d833 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json @@ -1,6 +1,6 @@ { "schema": "paperclip-runner/remote-provider-pack/v1", - "digest": "sha256:2f791844619982531282197e8554c2d1e1a2a031bd92e1abf78dae087fc80af6", + "digest": "sha256:480ae2eaa7a61852533286648911304fa1e47d2e40e80dcc19f0cce0149cb77e", "payload": { "pins": { "nodeMinimum": "24.11.0", @@ -14,9 +14,9 @@ "platform": "darwin", "architecture": "arm64" }, - "runnerSourceRevision": "f4bb4a5c316acf12f08a2caf8b9a0ad311588210", - "distDigest": "sha256:364a72974524c442e8f5a876c3cfe85b071fdb9ab154dad63ac221f7d32b61df", - "bridgeDigest": "sha256:9f4f46c692317ad4a2a9558554695f5e35824f78084924fcc4ce6c2b9a45d7d5", + "runnerSourceRevision": "1055c13f8cffd8c06070eb6403d3beff83e64374", + "distDigest": "sha256:4f7303572ec9f64a54b9fc8d766c007c88119711b601a0294b54a81367ddd888", + "bridgeDigest": "sha256:acc33db0c5c261aa4e9792f8cbbf8b7edff5ff6234555c20d72ea12c1388d8d9", "acpxProfileDigests": { "claude": "sha256:9d73d1f0f121fb96cc8badb28c22d5bff02d8582eb2e40360a81c189e1b9422a", "codex": "sha256:c4538599d1ab767db5dff50934f13bb5ba313a59d9c4a83e993fac4617ea63d3" @@ -38,7 +38,7 @@ }, "productionLock": { "path": "pnpm-lock.yaml", - "sha256": "sha256:774e3070ecba7bedaf70502a1a85bc05df535db1b34462b389de49031b6b8232" + "sha256": "sha256:e0c928a494f90ddad3c00791e83f09315ee8c82df2a0418a809dcf93649a8ab3" }, "opencodeCommand": { "path": "node_modules/.bin/opencode", @@ -50,11 +50,11 @@ }, "opencodeProxy": { "path": "dist/cli/opencode-app-server-proxy.cjs", - "sha256": "sha256:4b5599705325483dc5922dde126435eb102153acadca367163525fbfc1676a5c" + "sha256": "sha256:26c685c57e196d94cf4524b000b5c7d81a66bb11c8687a3a4944c7445af785f0" }, "acpxSidecar": { "path": "dist/cli/acpx-runtime-sidecar.cjs", - "sha256": "sha256:2a11a1abf785215589219eab0f5f87ad30e2a46f78bebfd31f5df7e7bc258294" + "sha256": "sha256:731d577d16afb6eccc03328261ec7bc9e21f302e9154c99185cc2410283facfa" } } } diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json index e3ba7c90012..2979432963f 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json @@ -1,8 +1,8 @@ { "schema": "paperclip-cursor-offline-pack-proof/v1", - "capturedAt": "2026-09-28T17:11:14.939Z", - "runnerSourceRevision": "f4bb4a5c316acf12f08a2caf8b9a0ad311588210", - "packDigest": "sha256:2f791844619982531282197e8554c2d1e1a2a031bd92e1abf78dae087fc80af6", + "capturedAt": "2026-09-28T17:33:30.123Z", + "runnerSourceRevision": "1055c13f8cffd8c06070eb6403d3beff83e64374", + "packDigest": "sha256:480ae2eaa7a61852533286648911304fa1e47d2e40e80dcc19f0cce0149cb77e", "target": { "platform": "darwin", "architecture": "arm64" @@ -15,7 +15,7 @@ "path": "provider-assets/cursor/darwin-arm64", "sha256": "sha256:3b6de19114d4df62f648604025a0d71937dfa7c2b15b397cce5da2c5da268994" }, - "productionLock": "sha256:774e3070ecba7bedaf70502a1a85bc05df535db1b34462b389de49031b6b8232", + "productionLock": "sha256:e0c928a494f90ddad3c00791e83f09315ee8c82df2a0418a809dcf93649a8ab3", "launch": { "entrypoint": "verified bundled node + index.js", "arguments": [ @@ -24,7 +24,8 @@ "acp" ], "credentials": "none; private home/config/data/cache; memory credential store", - "verification": "whole closure digest verification, retained immutable native snapshot, closed module bootstrap" + "verification": "generic profile installation registry, whole closure digest verification, retained immutable native snapshot, closed module bootstrap", + "modelAdmission": "offline-installation-probe is a factory identity sentinel only; no ACP model selection or prompt; model remains unverified" }, "requests": [ { From e5fa1cff1fca7aa5cf5b62516a5b1e45f2a8e7d5 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 13:05:16 -0500 Subject: [PATCH 10/31] Retain Cursor pack proof after credential and receipt review fixes Record the exact reviewed runtime source, clean dependency resolution, pack and native closure digests, and a credential-free launch through the generic installation registry. Keep authenticated and Daytona qualification explicitly pending. Co-Authored-By: Paperclip --- doc/architecture/runner-cursor-capabilities.md | 12 ++++++------ .../cursor-acp/provider-pack-darwin-arm64.json | 12 ++++++------ .../cursor-acp/provider-pack-offline-proof.json | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index c64b3a9f588..5a7c73891fc 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -51,7 +51,7 @@ The documentation calls todo/task/image methods notifications. The pinned presen Question and plan requests lack a session ID. The shared hook binds them to the retained connection, active execution/session/turn and originating request ID; it rejects stale/duplicate answers, cancels on turn termination, persists requests before exposing them, and awaits exact JSON-RPC pipe-write delivery before recording a resolved interaction. This proves transport handoff, not an additional provider application-level acknowledgement. The provider module does not substitute a best-guess session. -Fixed launch arguments are `--disable-project-configs --disable-auto-update acp`, using the verified bundled Node and absolute verified `index.js`. Private HOME/XDG roots are required together with CURSOR_CONFIG_DIR, CURSOR_DATA_DIR, a private compile cache, `AGENT_CLI_CREDENTIAL_STORE=memory`, and `NO_OPEN_BROWSER=1`. Only explicitly bound CURSOR_API_KEY or CURSOR_AUTH_TOKEN may enter; never inherit shell credentials. Do not use `--force`, `--trust`, or `--approve-mcps` to paper over governance. +Fixed launch arguments are `--disable-project-configs --disable-auto-update acp`, using the verified bundled Node and absolute verified `index.js`. Private HOME/XDG roots are required together with CURSOR_CONFIG_DIR, CURSOR_DATA_DIR, disabled compilation caching, `AGENT_CLI_CREDENTIAL_STORE=memory`, and `NO_OPEN_BROWSER=1`. Only explicitly bound CURSOR_API_KEY or CURSOR_AUTH_TOKEN may enter. The controller creates a provider/session-scoped credential-name binding from the explicit task environment, ignoring inherited or caller-supplied markers. Rust forwards it through the closed sidecar environment boundary. Before host admission, the sidecar rejects missing, stale, wrong-provider or unbound credentials and removes the marker before provider launch. Tests cover this full boundary and preserve legacy credential behavior. Do not use `--force`, `--trust`, or `--approve-mcps` to paper over governance. `--disable-project-configs` only suppresses `.cursor/cli.json`. It does not suppress project MCP, Cursor/Claude hooks, or installed plugins. `assertCursorWorkspacePolicy` refuses ambient project execution config from the workspace through its nearest Git root, including symlinks and unreadable configuration. Ordinary Claude settings with neither hooks nor plugins remain admissible. Enterprise system hooks are checked too. The host repeats admission checks before native launch. Continuous protection of these config paths during execution remains a qualification requirement. Admission alone cannot prevent a concurrent file mutation. Team-provided remote hooks are another upstream boundary and remain unqualified under restrictive execution. @@ -80,20 +80,20 @@ Pinned source creates a separate session-update presenter for every child and ca Child assistant/reasoning text, plan steps and tool lifecycle are displayed in each child's activity summary. The 4,000-character activity surface retains a clearly marked tail when it fills; this is a summary, not a complete nested transcript. Child tool raw input/output, locations, diffs, media content and other child update fields are not rendered by this summary surface and produce explicit partial-detail notices. Adding canonical child transcript/tool surfaces is the next priority for these meaningful exposed fields. Native `capabilities:{}` currently carries no populated child capability fields; `_meta.cursor.agentId` and `toolCallId` are retained internally for immutable origin checks. Nested parent identity is represented in activity metadata because canonical delegation has no parent-child relation field. Native `disconnected` now yields a failed child with a visible explanation, never a successful completion. -Three real ACP stream tests prove child lifecycle/transcript preservation before SDK parsing, nested parent attribution, standard parent parsing, and old-stream/turn/connection fences. Existing nine shared extension and Pi receipt package tests pass unchanged against the resulting patched package. Three native factory cases verify all platform pins, exact profiles, and rejection of unsupported distributions; native assets resolve only from the runner-owned package authority. +Three real ACP stream tests prove child lifecycle/transcript preservation before SDK parsing, nested parent attribution, standard parent parsing, and old-stream/turn/connection fences. Shared extension, reply-delivery and Pi receipt package cases pass against the resulting patched package; the current totals are recorded below. Three native factory cases verify all platform pins, exact profiles, and rejection of unsupported distributions; native assets resolve only from the runner-owned package authority. ## Integrated pack and offline launch evidence -The full `build-provider-pack.mjs --candidate-providers=cursor` path passed on source `1055c13f8cffd8c06070eb6403d3beff83e64374` (foundation includes upstream master `14795136f56c11ed83dc754791945bb5a0b8f7fd`). It used standalone Node, pnpm 9.15.4, a fresh production deployment and the pinned vendor archive. The build checked portable Node relocation, fresh ACPX import and complete Cursor materialization. The retained manifest is `packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json`; it contains only relative paths and digests. +The full `build-provider-pack.mjs --candidate-providers=cursor` path passed on source `1324437f4ce4031e646738aae5a09c314f51e21e` (foundation includes upstream master `14795136f56c11ed83dc754791945bb5a0b8f7fd`). It used standalone Node, pnpm 9.15.4, a fresh production deployment and the pinned vendor archive. The build checked portable Node relocation, fresh ACPX import and complete Cursor materialization. The retained manifest is `packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json`; it contains only relative paths and digests. -- Pack digest: `sha256:480ae2eaa7a61852533286648911304fa1e47d2e40e80dcc19f0cce0149cb77e`. +- Pack digest: `sha256:0631f2e7541b03e0becd15fd9ea51be1f913faa3f5350c2e207827f692176675`. - Cursor declaration: `sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899`. - macOS ARM64 closure: `sha256:77394184a89b0e7384971181da19c3c82d83a399b04e7944b3f94fe3d7e62b25`. -- Resolved dependency lock: `sha256:774e3070ecba7bedaf70502a1a85bc05df535db1b34462b389de49031b6b8232`, also the reviewed Daytona build digest for this branch. CI regenerates the lock from source-owned patches and rejects a different digest before execution. +- Resolved dependency lock: `sha256:ec689ad9c31aa2004c7c2c39889764d55897ac2e6d899c8f059d9c23b082c2c8`, also the reviewed Daytona build digest for this branch. This digest was resolved from the clean tracked lock with the exact Docker resolution-only command. The frozen install retained it. Image creation rejects a different digest before execution. `provider-pack-offline-proof.json` records a real launch through the generic profile installation registry from the pack’s verified native closure and retained snapshot, using private directories and no credentials. ACP v1 initialize succeeds. The correct `cursor/list_available_models`, `session/list` and `session/new` methods return authentication-required; `session/fork` and `session/resume` return method-not-found. The process produced no stderr, was explicitly terminated after these probes, and its lease closed. The earlier discovery fixture’s `_cursor/list_available_models` probe used an incorrect method prefix; this later probe corrects that uncertainty without changing the original evidence. -At the initial integration checkpoint, 17 Cursor Vitest cases, 28 installed ACPX/materializer Node cases, and 6 Daytona image-content cases passed. After the final foundation rebase to `5aeebb20c`, TypeScript/verified-sidecar build, all 17 Cursor cases, and 11 installed extension-hook/materializer Node cases passed again. The fresh pack/probe above binds this final runtime source. Its explicit offline factory model sentinel is not an authenticated model selection; no ACP prompt was sent. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. Total billable prompts and spend remain zero. +At the initial integration checkpoint, 17 Cursor Vitest cases, 28 installed ACPX/materializer Node cases, and 6 Daytona image-content cases passed. After review fixes and the final foundation rebase to `f80c312cd`, TypeScript/verified-sidecar build, all 30 Cursor/credential cases, 29 installed ACPX/materializer Node cases, and 6 Daytona image-content cases passed. This source includes provider/session credential bindings and preservation of actual usage receipts on terminal provider failure. The fresh pack/probe above binds these final runtime bytes; previous pack evidence remains in Git history. Its explicit offline factory model sentinel is not an authenticated model selection; no ACP prompt was sent. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. Total billable prompts and spend remain zero. ## Exact remaining field audit diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json index e430c64d833..6432a9b5f76 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json @@ -1,6 +1,6 @@ { "schema": "paperclip-runner/remote-provider-pack/v1", - "digest": "sha256:480ae2eaa7a61852533286648911304fa1e47d2e40e80dcc19f0cce0149cb77e", + "digest": "sha256:0631f2e7541b03e0becd15fd9ea51be1f913faa3f5350c2e207827f692176675", "payload": { "pins": { "nodeMinimum": "24.11.0", @@ -14,9 +14,9 @@ "platform": "darwin", "architecture": "arm64" }, - "runnerSourceRevision": "1055c13f8cffd8c06070eb6403d3beff83e64374", - "distDigest": "sha256:4f7303572ec9f64a54b9fc8d766c007c88119711b601a0294b54a81367ddd888", - "bridgeDigest": "sha256:acc33db0c5c261aa4e9792f8cbbf8b7edff5ff6234555c20d72ea12c1388d8d9", + "runnerSourceRevision": "1324437f4ce4031e646738aae5a09c314f51e21e", + "distDigest": "sha256:779d392f23d47cde795143dcf2df4e36a3a0c04d1ee983d1a19b8bdbfb7f3220", + "bridgeDigest": "sha256:19d8ae1df8c87e97d2abba0a7249e400e64218a71a3ffe99e7baf886d8b85ff2", "acpxProfileDigests": { "claude": "sha256:9d73d1f0f121fb96cc8badb28c22d5bff02d8582eb2e40360a81c189e1b9422a", "codex": "sha256:c4538599d1ab767db5dff50934f13bb5ba313a59d9c4a83e993fac4617ea63d3" @@ -38,7 +38,7 @@ }, "productionLock": { "path": "pnpm-lock.yaml", - "sha256": "sha256:e0c928a494f90ddad3c00791e83f09315ee8c82df2a0418a809dcf93649a8ab3" + "sha256": "sha256:ec689ad9c31aa2004c7c2c39889764d55897ac2e6d899c8f059d9c23b082c2c8" }, "opencodeCommand": { "path": "node_modules/.bin/opencode", @@ -54,7 +54,7 @@ }, "acpxSidecar": { "path": "dist/cli/acpx-runtime-sidecar.cjs", - "sha256": "sha256:731d577d16afb6eccc03328261ec7bc9e21f302e9154c99185cc2410283facfa" + "sha256": "sha256:b0c2c42374f8f6dc7a9a4b3a31f3cc94cd8e9e74a5934441188c2ec1fc33e9f9" } } } diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json index 2979432963f..2423f37e7f9 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json @@ -1,8 +1,8 @@ { "schema": "paperclip-cursor-offline-pack-proof/v1", - "capturedAt": "2026-09-28T17:33:30.123Z", - "runnerSourceRevision": "1055c13f8cffd8c06070eb6403d3beff83e64374", - "packDigest": "sha256:480ae2eaa7a61852533286648911304fa1e47d2e40e80dcc19f0cce0149cb77e", + "capturedAt": "2026-09-28T18:04:33.552Z", + "runnerSourceRevision": "1324437f4ce4031e646738aae5a09c314f51e21e", + "packDigest": "sha256:0631f2e7541b03e0becd15fd9ea51be1f913faa3f5350c2e207827f692176675", "target": { "platform": "darwin", "architecture": "arm64" @@ -15,7 +15,7 @@ "path": "provider-assets/cursor/darwin-arm64", "sha256": "sha256:3b6de19114d4df62f648604025a0d71937dfa7c2b15b397cce5da2c5da268994" }, - "productionLock": "sha256:e0c928a494f90ddad3c00791e83f09315ee8c82df2a0418a809dcf93649a8ab3", + "productionLock": "sha256:ec689ad9c31aa2004c7c2c39889764d55897ac2e6d899c8f059d9c23b082c2c8", "launch": { "entrypoint": "verified bundled node + index.js", "arguments": [ From 2897bd971e00c3a01fc6bd75d8b8b384ca9cff3c Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 13:36:50 -0500 Subject: [PATCH 11/31] Refresh Cursor pack proof after final launch credential fix Co-Authored-By: Paperclip --- doc/architecture/runner-cursor-capabilities.md | 8 +++++--- .../fixtures/cursor-acp/provider-pack-darwin-arm64.json | 8 ++++---- .../fixtures/cursor-acp/provider-pack-offline-proof.json | 6 +++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index 5a7c73891fc..25a075b0949 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -84,16 +84,18 @@ Three real ACP stream tests prove child lifecycle/transcript preservation before ## Integrated pack and offline launch evidence -The full `build-provider-pack.mjs --candidate-providers=cursor` path passed on source `1324437f4ce4031e646738aae5a09c314f51e21e` (foundation includes upstream master `14795136f56c11ed83dc754791945bb5a0b8f7fd`). It used standalone Node, pnpm 9.15.4, a fresh production deployment and the pinned vendor archive. The build checked portable Node relocation, fresh ACPX import and complete Cursor materialization. The retained manifest is `packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json`; it contains only relative paths and digests. +The full `build-provider-pack.mjs --candidate-providers=cursor` path passed on source `a92d06ca5940a42d45cba937f19ba7e7e9c03018` (foundation includes upstream master `14795136f56c11ed83dc754791945bb5a0b8f7fd`). It used standalone Node, pnpm 9.15.4, a fresh production deployment and the pinned vendor archive. The build checked portable Node relocation, fresh ACPX import and complete Cursor materialization. The retained manifest is `packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json`; it contains only relative paths and digests. -- Pack digest: `sha256:0631f2e7541b03e0becd15fd9ea51be1f913faa3f5350c2e207827f692176675`. +- Pack digest: `sha256:3d36acd9adcfe049fdc30b93ee50f8ce35d59938362eb0c497b4e6b4fbcac028`. - Cursor declaration: `sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899`. - macOS ARM64 closure: `sha256:77394184a89b0e7384971181da19c3c82d83a399b04e7944b3f94fe3d7e62b25`. - Resolved dependency lock: `sha256:ec689ad9c31aa2004c7c2c39889764d55897ac2e6d899c8f059d9c23b082c2c8`, also the reviewed Daytona build digest for this branch. This digest was resolved from the clean tracked lock with the exact Docker resolution-only command. The frozen install retained it. Image creation rejects a different digest before execution. `provider-pack-offline-proof.json` records a real launch through the generic profile installation registry from the pack’s verified native closure and retained snapshot, using private directories and no credentials. ACP v1 initialize succeeds. The correct `cursor/list_available_models`, `session/list` and `session/new` methods return authentication-required; `session/fork` and `session/resume` return method-not-found. The process produced no stderr, was explicitly terminated after these probes, and its lease closed. The earlier discovery fixture’s `_cursor/list_available_models` probe used an incorrect method prefix; this later probe corrects that uncertainty without changing the original evidence. -At the initial integration checkpoint, 17 Cursor Vitest cases, 28 installed ACPX/materializer Node cases, and 6 Daytona image-content cases passed. After review fixes and the final foundation rebase to `f80c312cd`, TypeScript/verified-sidecar build, all 30 Cursor/credential cases, 29 installed ACPX/materializer Node cases, and 6 Daytona image-content cases passed. This source includes provider/session credential bindings and preservation of actual usage receipts on terminal provider failure. The fresh pack/probe above binds these final runtime bytes; previous pack evidence remains in Git history. Its explicit offline factory model sentinel is not an authenticated model selection; no ACP prompt was sent. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. Total billable prompts and spend remain zero. +After the final foundation rebase to `7721662f2`, the TypeScript/verified-sidecar build and all 177 targeted cases passed: Cursor normalization/policy/artifacts, credential bindings, the durable launcher's actual process specification, candidate backend admission, and sidecar behavior. The actual process-launch regressions verify explicit candidate credentials and their marker survive the final closed allowlist; ambient credentials and caller-supplied markers cannot select themselves. The prior source `f09a9a3f8` passed all 47 CI jobs after one retry for runner shutdown and a wall-clock rate-limit case, plus Greptile 5/5; it also passed 29 installed ACPX/materializer Node cases and 6 Daytona image-content cases. These prior results remain historical, distinct from the final source proof. + +The fresh pack/probe above binds the final runtime bytes, including the actual-spawn credential fix and preservation of actual usage receipts on terminal provider failure; previous pack evidence remains in Git history. Its explicit offline factory model sentinel is not an authenticated model selection; no ACP prompt was sent. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. Total billable prompts and spend remain zero. ## Exact remaining field audit diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json index 6432a9b5f76..bd4a556c091 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json @@ -1,6 +1,6 @@ { "schema": "paperclip-runner/remote-provider-pack/v1", - "digest": "sha256:0631f2e7541b03e0becd15fd9ea51be1f913faa3f5350c2e207827f692176675", + "digest": "sha256:3d36acd9adcfe049fdc30b93ee50f8ce35d59938362eb0c497b4e6b4fbcac028", "payload": { "pins": { "nodeMinimum": "24.11.0", @@ -14,9 +14,9 @@ "platform": "darwin", "architecture": "arm64" }, - "runnerSourceRevision": "1324437f4ce4031e646738aae5a09c314f51e21e", - "distDigest": "sha256:779d392f23d47cde795143dcf2df4e36a3a0c04d1ee983d1a19b8bdbfb7f3220", - "bridgeDigest": "sha256:19d8ae1df8c87e97d2abba0a7249e400e64218a71a3ffe99e7baf886d8b85ff2", + "runnerSourceRevision": "a92d06ca5940a42d45cba937f19ba7e7e9c03018", + "distDigest": "sha256:78fc5189d6f8a441aa1060dc968b09cd423f03fb039ef33b17568bb44b7f6da6", + "bridgeDigest": "sha256:d58c15293fd44bad94d222b982da989af54621150c1f16fa7da53beb3bb16f9d", "acpxProfileDigests": { "claude": "sha256:9d73d1f0f121fb96cc8badb28c22d5bff02d8582eb2e40360a81c189e1b9422a", "codex": "sha256:c4538599d1ab767db5dff50934f13bb5ba313a59d9c4a83e993fac4617ea63d3" diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json index 2423f37e7f9..056136eb865 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json @@ -1,8 +1,8 @@ { "schema": "paperclip-cursor-offline-pack-proof/v1", - "capturedAt": "2026-09-28T18:04:33.552Z", - "runnerSourceRevision": "1324437f4ce4031e646738aae5a09c314f51e21e", - "packDigest": "sha256:0631f2e7541b03e0becd15fd9ea51be1f913faa3f5350c2e207827f692176675", + "capturedAt": "2026-09-28T18:36:20.637Z", + "runnerSourceRevision": "a92d06ca5940a42d45cba937f19ba7e7e9c03018", + "packDigest": "sha256:3d36acd9adcfe049fdc30b93ee50f8ce35d59938362eb0c497b4e6b4fbcac028", "target": { "platform": "darwin", "architecture": "arm64" From eda4b7e8cbe388eab0f171f62a50597a79cd18e6 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 14:10:30 -0500 Subject: [PATCH 12/31] Record authenticated Cursor model and configuration discovery Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 14 +- .../authenticated-capability-probe.json | 2271 +++++++++++++++++ 2 files changed, 2282 insertions(+), 3 deletions(-) create mode 100644 packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-capability-probe.json diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index 25a075b0949..3b7ffeee182 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -1,6 +1,6 @@ # Cursor ACP capability inventory -Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. No billable prompt was sent ($0 of the assigned $25 budget); no explicit Cursor credential was available. Local authenticated execution, restrictive permission enforcement, dollar usage, and Daytona execution remain required qualification gates. +Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. No billable prompt was sent ($0 of the assigned $25 budget). After user-authorized browser login, an explicit credential passed native catalog, session-creation and exact model-selection probes; inference entitlement is not yet established. Local authenticated execution, restrictive permission enforcement, dollar usage, and Daytona execution remain required qualification gates. The reference is the runner's Codex app-server integration and its closed thread-item inventory in `src/provider-events.ts`. Cursor ACP and its private extension methods are the transport; the legacy Cursor adapter is unchanged. @@ -36,7 +36,7 @@ The reference is the runner's Codex app-server integration and its closed thread | Session discovery | `session/list` implemented, cwd filter absolute; pagination cursor rejected | Discovered and reported | Currently unused: runner recovers only its exact recorded session; arbitrary history browsing needs company-scoped discovery API | | Fork/resume methods | `session/fork` and `session/resume` absent in agent implementation and return method-not-found | Unsupported | Session load is available; do not infer fork from SDK schema | | Modes | `agent`, `plan`, `ask`; `session/set_mode` and `current_mode_update` | Existing review/mode activity plumbing can display changes | Generic operator mode-selection surface not implemented in this provider slice | -| Model selection | `session/set_model`, config option `model`, model-parameter options, `config_option_update`; `cursor/list_available_models` extension | Exact requested model must be selected/verified by shared admission | Available-model listing is authenticated; no model ID guessed or silently substituted. Parameterized model UI not added | +| Model selection | `session/set_model`, config option `model`, model-parameter options, `config_option_update`; `cursor/list_available_models` extension | Exact requested model must be selected/verified by shared admission | Authenticated listing and exact Luna variant echo passed. Native parameterized picker metadata and separate parameter changes also passed; this richer configuration path is not exposed by the runner. See the authenticated discovery evidence below | | Available commands | `available_commands_update`, including skills/slash commands | ACPX persists command metadata; runner canonical mapper deliberately emits no display event | Command picker and bounded command-discovery surface are not implemented | | Session metadata | `session_info_update` title after automatic naming | Capability documented | Runner owns normalized session identity; provider title is currently not surfaced | | Prompt media | Image=true, audio=false, embeddedContext=false in observed initialize | Image inputs may be admitted by advertised capability | Product attachment-to-ACP conversion needs qualified test; audio/embedded context unsupported | @@ -68,7 +68,7 @@ Passed in the provider worktree: The generic native-distribution lease now snapshots the pinned closure, launches Cursor through its verified bundled Node with a closed-module guard, and uses the existing lifetime guardian. A real nonbillable Cursor initialization passed through that lease. Its six focused tests passed, including argument fencing, external module rejection, and native child ownership/exit proof. The existing snapshot suite also passed. The foundation’s later master integration refreshes the common Claude/Codex pins; the candidate pack below was built against that synchronized graph. -Priority follow-ups before advertising support: (1) explicit credentials, exact available model and measured dollar budget; (2) authenticated native lifetime, cleanup and restrictive denial proof; (3) local and Daytona semantic tools, files/artifacts, questions/plans and settlement proof; (4) parent tool content/diff projection and richer nested child presentation; (5) authenticated trace audit for additional unconsumed native fields. Shared receipt/recovery coverage now proves pipe delivery, provider-loss expiry, exact lifecycle IDs and no approval replay. +Priority follow-ups before advertising support: (1) actual inference entitlement and measured dollar budget after authenticated model discovery; (2) authenticated native lifetime, cleanup and restrictive denial proof; (3) local and Daytona semantic tools, files/artifacts, questions/plans and settlement proof; (4) parent tool content/diff projection and richer nested child presentation; (5) authenticated trace audit for additional unconsumed native fields. Shared receipt/recovery coverage now proves pipe delivery, provider-loss expiry, exact lifecycle IDs and no approval replay. Remaining rich capabilities intentionally unused: session discovery, generic mode/config-option UI, provider session titles, command/skill picker metadata, full nested child transcripts beyond bounded delegation summaries, native numeric task duration, and optional planUri. They are listed above with reasons; neither “unsupported” nor “complete” should be inferred for unverified live behaviors. The final combined report must update this inventory with integration evidence and include any further events observed during authenticated qualification. @@ -97,6 +97,14 @@ After the final foundation rebase to `7721662f2`, the TypeScript/verified-sideca The fresh pack/probe above binds the final runtime bytes, including the actual-spawn credential fix and preservation of actual usage receipts on terminal provider failure; previous pack evidence remains in Git history. Its explicit offline factory model sentinel is not an authenticated model selection; no ACP prompt was sent. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. Total billable prompts and spend remain zero. +## Authenticated discovery evidence + +`test/fixtures/cursor-acp/authenticated-capability-probe.json` records the user-authorized follow-up on 2026-09-28. The pinned verified distribution returned 41 model entries, created a session, accepted `gpt-5.6-luna[context=272k,reasoning=medium,fast=false]` through both `session/set_model` and `session/set_config_option`, and returned that exact value. No model prompt was sent. These facts establish authentication and model selection, not inference entitlement or full runner qualification. + +The native picker has two materially different interfaces. Ordinary ACP advertises fixed variant IDs. It rejected `grok-4.7[context=256k,reasoning_effort=low,fast=false]`, although each individual parameter value is advertised by the separate catalog. Advertising client `_meta.parameterizedModelPicker:true` enables base model `grok-4.7` and separate `session/set_config_option` calls; context `256k`, `reasoning_effort:low`, and `fast:false` all succeeded and were echoed. The runner does not yet negotiate or project this parameterized configuration path. Follow-up P2: bind the model plus complete verified parameter map to profile/recovery identity and expose supported options without silently choosing a default. In particular, this account's Grok and Composer catalog defaults enable the more expensive Fast option. + +Credential setup uses [Cursor's documented browser login](https://cursor.com/docs/cli/reference/authentication), with an isolated task-owned home and the pinned file credential store. Only the access token was explicitly saved in the operator's private secret file; credentials and refresh tokens are absent from retained public fixtures. The [official usage guide](https://cursor.com/help/account-and-billing/overages) distinguishes included usage from on-demand charges and warns that spend-limit enforcement is delayed. The first prompt therefore requires a separately reserved budget and attribution from the account usage records; missing ACP usage remains unknown, never zero-cost inference. + ## Exact remaining field audit This source audit follows pinned native update → ACPX runtime → `canonicalProviderEventsFromAcpxRuntimeEvent` → Paperclip activity. It supplements the higher-level capability matrix and does not claim an authenticated trace was captured. diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-capability-probe.json b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-capability-probe.json new file mode 100644 index 00000000000..56e292ba0ee --- /dev/null +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-capability-probe.json @@ -0,0 +1,2271 @@ +{ + "schema": "paperclip-cursor-authenticated-capability-probe/v1", + "capturedAt": "2026-09-28T19:09:06.609Z", + "runnerSourceRevision": "653ea40135b1dc6586b8de4ebf49ad5befbc6e66", + "packSourceRevision": "a92d06ca5940a42d45cba937f19ba7e7e9c03018", + "providerVersion": "2026.09.26-dd393fe", + "credentialKind": "explicit CURSOR_AUTH_TOKEN; value withheld", + "modelPromptCalls": 0, + "scope": "Native ACP discovery and configuration through verified installation lease; not runner/product inference qualification", + "modelCatalog": [ + { + "value": "default", + "name": "Auto", + "configOptions": [] + }, + { + "value": "grok-4.7", + "name": "Grok 4.7", + "configOptions": [ + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "256k", + "options": [ + { + "value": "256k", + "name": "256K" + }, + { + "value": "500k", + "name": "500K" + } + ] + }, + { + "id": "reasoning_effort", + "name": "Effort", + "description": "Controls how much reasoning effort the model uses before responding.", + "category": "thought_level", + "type": "select", + "currentValue": "high", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + } + ] + }, + { + "id": "fast", + "name": "Fast", + "description": "Significantly faster but consumes more usage", + "category": "model_config", + "type": "select", + "currentValue": "true", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "Fast\u200b\u200b" + } + ] + } + ] + }, + { + "value": "grok-4.6", + "name": "Grok 4.6", + "configOptions": [ + { + "id": "effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "high", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + } + ] + }, + { + "id": "fast", + "name": "Fast", + "description": "Significantly faster but consumes more usage", + "category": "model_config", + "type": "select", + "currentValue": "true", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "Fast\u200b\u200b" + } + ] + } + ] + }, + { + "value": "composer-2.5", + "name": "Composer 2.5", + "configOptions": [ + { + "id": "fast", + "name": "Fast", + "description": "Significantly faster but consumes more usage", + "category": "model_config", + "type": "select", + "currentValue": "true", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "Fast" + } + ] + } + ] + }, + { + "value": "claude-opus-5-5", + "name": "Claude Opus 5.5", + "configOptions": [ + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "300k", + "options": [ + { + "value": "300k", + "name": "300K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "medium", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + }, + { + "value": "max", + "name": "Max" + } + ] + }, + { + "id": "fast", + "name": "Fast", + "description": "2x more expensive, but significantly faster speeds.", + "category": "model_config", + "type": "select", + "currentValue": "false", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "Fast" + } + ] + } + ] + }, + { + "value": "claude-opus-5", + "name": "Claude Opus 5", + "configOptions": [ + { + "id": "thinking", + "name": "Thinking", + "description": "Does the model use thinking to generate its response?", + "category": "thought_level", + "type": "select", + "currentValue": "true", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "On" + } + ] + }, + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "300k", + "options": [ + { + "value": "300k", + "name": "300K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "high", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + }, + { + "value": "max", + "name": "Max" + } + ] + }, + { + "id": "fast", + "name": "Fast", + "description": "2x more expensive, but significantly faster speeds.", + "category": "model_config", + "type": "select", + "currentValue": "false", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "Fast" + } + ] + } + ] + }, + { + "value": "claude-opus-4-8", + "name": "Claude Opus 4.8", + "configOptions": [ + { + "id": "thinking", + "name": "Thinking", + "description": "Does the model use thinking to generate its response?", + "category": "thought_level", + "type": "select", + "currentValue": "true", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "On" + } + ] + }, + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "300k", + "options": [ + { + "value": "300k", + "name": "300K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "high", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + }, + { + "value": "max", + "name": "Max" + } + ] + }, + { + "id": "fast", + "name": "Fast", + "description": "2x more expensive, but significantly faster speeds.", + "category": "model_config", + "type": "select", + "currentValue": "false", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "Fast" + } + ] + } + ] + }, + { + "value": "gpt-5.6-sol", + "name": "GPT-5.6 Sol", + "configOptions": [ + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "272k", + "options": [ + { + "value": "272k", + "name": "272K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "reasoning", + "name": "Reasoning", + "description": "Reasoning effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "medium", + "options": [ + { + "value": "none", + "name": "None" + }, + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + }, + { + "value": "max", + "name": "Max" + } + ] + }, + { + "id": "fast", + "name": "Fast", + "description": "2x more expensive, but faster speeds.", + "category": "model_config", + "type": "select", + "currentValue": "false", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "Fast" + } + ] + } + ] + }, + { + "value": "gpt-5.5", + "name": "GPT-5.5", + "configOptions": [ + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "272k", + "options": [ + { + "value": "272k", + "name": "272K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "reasoning", + "name": "Reasoning", + "description": "Reasoning effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "medium", + "options": [ + { + "value": "none", + "name": "None" + }, + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "extra-high", + "name": "Extra High" + } + ] + }, + { + "id": "fast", + "name": "Fast", + "description": "2.5x more expensive, but faster speeds.", + "category": "model_config", + "type": "select", + "currentValue": "false", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "Fast" + } + ] + } + ] + }, + { + "value": "claude-fable-5-1", + "name": "Claude Fable 5.1", + "configOptions": [ + { + "id": "thinking", + "name": "Thinking", + "description": "Does the model use thinking to generate its response?", + "category": "thought_level", + "type": "select", + "currentValue": "true", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "On" + } + ] + }, + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "300k", + "options": [ + { + "value": "300k", + "name": "300K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "high", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + }, + { + "value": "max", + "name": "Max" + } + ] + } + ] + }, + { + "value": "claude-fable-5", + "name": "Claude Fable 5", + "configOptions": [ + { + "id": "thinking", + "name": "Thinking", + "description": "Does the model use thinking to generate its response?", + "category": "thought_level", + "type": "select", + "currentValue": "true", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "On" + } + ] + }, + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "300k", + "options": [ + { + "value": "300k", + "name": "300K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "high", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + }, + { + "value": "max", + "name": "Max" + } + ] + } + ] + }, + { + "value": "grok-4.5", + "name": "Grok 4.5", + "configOptions": [ + { + "id": "effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "high", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + } + ] + }, + { + "id": "fast", + "name": "Fast", + "description": "Significantly faster but consumes more usage", + "category": "model_config", + "type": "select", + "currentValue": "true", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "Fast\u200b" + } + ] + } + ] + }, + { + "value": "gemini-3.8-flash", + "name": "Gemini 3.8 Flash", + "configOptions": [ + { + "id": "reasoning_effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "high", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + } + ] + } + ] + }, + { + "value": "gemini-3.7-flash", + "name": "Gemini 3.7 Flash", + "configOptions": [ + { + "id": "effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "high", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + } + ] + } + ] + }, + { + "value": "muse-spark-1.3", + "name": "Muse Spark 1.3", + "configOptions": [ + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "300k", + "options": [ + { + "value": "300k", + "name": "300K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "high", + "options": [ + { + "value": "minimal", + "name": "Minimal" + }, + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + }, + { + "value": "max", + "name": "Max" + } + ] + } + ] + }, + { + "value": "gpt-5.6-terra", + "name": "GPT-5.6 Terra", + "configOptions": [ + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "272k", + "options": [ + { + "value": "272k", + "name": "272K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "reasoning", + "name": "Reasoning", + "description": "Reasoning effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "medium", + "options": [ + { + "value": "none", + "name": "None" + }, + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + }, + { + "value": "max", + "name": "Max" + } + ] + }, + { + "id": "fast", + "name": "Fast", + "description": "2x more expensive, but faster speeds.", + "category": "model_config", + "type": "select", + "currentValue": "false", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "Fast" + } + ] + } + ] + }, + { + "value": "claude-sonnet-5-5", + "name": "Claude Sonnet 5.5", + "configOptions": [ + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "300k", + "options": [ + { + "value": "300k", + "name": "300K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "reasoning_effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "high", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + }, + { + "value": "max", + "name": "Max" + } + ] + } + ] + }, + { + "value": "claude-sonnet-5", + "name": "Claude Sonnet 5", + "configOptions": [ + { + "id": "thinking", + "name": "Thinking", + "description": "Does the model use thinking to generate its response?", + "category": "thought_level", + "type": "select", + "currentValue": "true", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "On" + } + ] + }, + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "300k", + "options": [ + { + "value": "300k", + "name": "300K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "high", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + }, + { + "value": "max", + "name": "Max" + } + ] + } + ] + }, + { + "value": "claude-sonnet-4-6", + "name": "Claude Sonnet 4.6", + "configOptions": [ + { + "id": "thinking", + "name": "Thinking", + "description": "Does the model use thinking to generate its response?", + "category": "thought_level", + "type": "select", + "currentValue": "true", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "On" + } + ] + }, + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "200k", + "options": [ + { + "value": "200k", + "name": "200K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "medium", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "max", + "name": "Max" + } + ] + } + ] + }, + { + "value": "gpt-5.3-codex", + "name": "Codex 5.3", + "configOptions": [ + { + "id": "reasoning", + "name": "Reasoning", + "description": "Reasoning effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "medium", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "extra-high", + "name": "Extra High" + } + ] + }, + { + "id": "fast", + "name": "Fast", + "description": "2x more expensive, but faster speeds.", + "category": "model_config", + "type": "select", + "currentValue": "false", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "Fast" + } + ] + } + ] + }, + { + "value": "claude-opus-4-7", + "name": "Claude Opus 4.7", + "configOptions": [ + { + "id": "thinking", + "name": "Thinking", + "description": "Does the model use thinking to generate its response?", + "category": "thought_level", + "type": "select", + "currentValue": "true", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "On" + } + ] + }, + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "300k", + "options": [ + { + "value": "300k", + "name": "300K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "xhigh", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + }, + { + "value": "max", + "name": "Max" + } + ] + }, + { + "id": "fast", + "name": "Fast", + "description": "6x more expensive, but significantly faster speeds.", + "category": "model_config", + "type": "select", + "currentValue": "false", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "Fast" + } + ] + } + ] + }, + { + "value": "gpt-5.4", + "name": "GPT-5.4", + "configOptions": [ + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "272k", + "options": [ + { + "value": "272k", + "name": "272K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "reasoning", + "name": "Reasoning", + "description": "Reasoning effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "medium", + "options": [ + { + "value": "none", + "name": "None" + }, + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "extra-high", + "name": "Extra High" + } + ] + }, + { + "id": "fast", + "name": "Fast", + "description": "2x more expensive, but faster speeds.", + "category": "model_config", + "type": "select", + "currentValue": "false", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "Fast" + } + ] + } + ] + }, + { + "value": "claude-opus-4-6", + "name": "Claude Opus 4.6", + "configOptions": [ + { + "id": "thinking", + "name": "Thinking", + "description": "Does the model use thinking to generate its response?", + "category": "thought_level", + "type": "select", + "currentValue": "true", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "On" + } + ] + }, + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "200k", + "options": [ + { + "value": "200k", + "name": "200K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "high", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "max", + "name": "Max" + } + ] + } + ] + }, + { + "value": "claude-opus-4-5", + "name": "Claude Opus 4.5", + "configOptions": [ + { + "id": "thinking", + "name": "Thinking", + "description": "Does the model use thinking to generate its response?", + "category": "thought_level", + "type": "select", + "currentValue": "true", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "On" + } + ] + } + ] + }, + { + "value": "gpt-5.2", + "name": "GPT-5.2", + "configOptions": [ + { + "id": "reasoning", + "name": "Reasoning", + "description": "Reasoning effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "medium", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "extra-high", + "name": "Extra High" + } + ] + }, + { + "id": "fast", + "name": "Fast", + "description": "2x more expensive, but faster speeds.", + "category": "model_config", + "type": "select", + "currentValue": "false", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "Fast" + } + ] + } + ] + }, + { + "value": "gpt-5.6-luna", + "name": "GPT-5.6 Luna", + "configOptions": [ + { + "id": "context", + "name": "Context", + "description": "Context size the model has available.", + "category": "model_config", + "type": "select", + "currentValue": "272k", + "options": [ + { + "value": "272k", + "name": "272K" + }, + { + "value": "1m", + "name": "1M" + } + ] + }, + { + "id": "reasoning", + "name": "Reasoning", + "description": "Reasoning effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "medium", + "options": [ + { + "value": "none", + "name": "None" + }, + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + }, + { + "value": "max", + "name": "Max" + } + ] + }, + { + "id": "fast", + "name": "Fast", + "description": "2x more expensive, but faster speeds.", + "category": "model_config", + "type": "select", + "currentValue": "false", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "Fast" + } + ] + } + ] + }, + { + "value": "gemini-3.6-flash", + "name": "Gemini 3.6 Flash", + "configOptions": [ + { + "id": "effort", + "name": "Effort", + "description": "Effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "high", + "options": [ + { + "value": "minimal", + "name": "Minimal" + }, + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + } + ] + } + ] + }, + { + "value": "gemini-3.1-pro", + "name": "Gemini 3.1 Pro", + "configOptions": [] + }, + { + "value": "gpt-5.4-mini", + "name": "GPT-5.4 Mini", + "configOptions": [ + { + "id": "reasoning", + "name": "Reasoning", + "description": "Reasoning effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "medium", + "options": [ + { + "value": "none", + "name": "None" + }, + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + } + ] + } + ] + }, + { + "value": "gpt-5.4-nano", + "name": "GPT-5.4 Nano", + "configOptions": [ + { + "id": "reasoning", + "name": "Reasoning", + "description": "Reasoning effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "medium", + "options": [ + { + "value": "none", + "name": "None" + }, + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "xhigh", + "name": "Extra High" + } + ] + } + ] + }, + { + "value": "claude-haiku-4-5", + "name": "Claude Haiku 4.5", + "configOptions": [ + { + "id": "thinking", + "name": "Thinking", + "description": "Does the model use thinking to generate its response?", + "category": "thought_level", + "type": "select", + "currentValue": "true", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "On" + } + ] + } + ] + }, + { + "value": "claude-sonnet-4-5", + "name": "Claude Sonnet 4.5", + "configOptions": [ + { + "id": "thinking", + "name": "Thinking", + "description": "Does the model use thinking to generate its response?", + "category": "thought_level", + "type": "select", + "currentValue": "true", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "On" + } + ] + } + ] + }, + { + "value": "gpt-5.1", + "name": "GPT-5.1", + "configOptions": [ + { + "id": "reasoning", + "name": "Reasoning", + "description": "Reasoning effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "medium", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "medium", + "name": "Medium" + }, + { + "value": "high", + "name": "High" + } + ] + } + ] + }, + { + "value": "gemini-3-flash", + "name": "Gemini 3 Flash", + "configOptions": [] + }, + { + "value": "gemini-3.5-flash", + "name": "Gemini 3.5 Flash", + "configOptions": [] + }, + { + "value": "claude-sonnet-4", + "name": "Claude Sonnet 4", + "configOptions": [ + { + "id": "thinking", + "name": "Thinking", + "description": "Does the model use thinking to generate its response?", + "category": "thought_level", + "type": "select", + "currentValue": "false", + "options": [ + { + "value": "false", + "name": "Off" + }, + { + "value": "true", + "name": "On" + } + ] + } + ] + }, + { + "value": "gpt-5-mini", + "name": "GPT-5 Mini", + "configOptions": [] + }, + { + "value": "gemini-2.5-flash", + "name": "Gemini 2.5 Flash", + "configOptions": [] + }, + { + "value": "kimi-k3", + "name": "Kimi K3", + "configOptions": [ + { + "id": "reasoning", + "name": "Reasoning", + "description": "Reasoning effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "max", + "options": [ + { + "value": "low", + "name": "Low" + }, + { + "value": "high", + "name": "High" + }, + { + "value": "max", + "name": "Max" + } + ] + } + ] + }, + { + "value": "kimi-k2.7-code", + "name": "Kimi K2.7 Code", + "configOptions": [] + }, + { + "value": "glm-5.2", + "name": "GLM 5.2", + "configOptions": [ + { + "id": "reasoning", + "name": "Reasoning", + "description": "Reasoning effort the model uses to generate its response.", + "category": "thought_level", + "type": "select", + "currentValue": "high", + "options": [ + { + "value": "high", + "name": "High" + }, + { + "value": "max", + "name": "Max" + } + ] + } + ] + } + ], + "ordinaryPicker": { + "sessionCreationSucceeded": true, + "availableModels": [ + { + "modelId": "default[]", + "name": "Auto" + }, + { + "modelId": "grok-4.7[context=256k,reasoning_effort=high,fast=true]", + "name": "grok-4.7" + }, + { + "modelId": "grok-4.6[effort=high,fast=true]", + "name": "grok-4.6" + }, + { + "modelId": "composer-2.5[fast=true]", + "name": "composer-2.5" + }, + { + "modelId": "claude-opus-5-5[context=300k,effort=medium,fast=false]", + "name": "claude-opus-5-5" + }, + { + "modelId": "claude-opus-5[thinking=true,context=300k,effort=high,fast=false]", + "name": "claude-opus-5" + }, + { + "modelId": "claude-opus-4-8[thinking=true,context=300k,effort=high,fast=false]", + "name": "claude-opus-4-8" + }, + { + "modelId": "gpt-5.6-sol[context=272k,reasoning=medium,fast=false]", + "name": "gpt-5.6-sol" + }, + { + "modelId": "gpt-5.5[context=272k,reasoning=medium,fast=false]", + "name": "gpt-5.5" + }, + { + "modelId": "claude-fable-5-1[thinking=true,context=300k,effort=high]", + "name": "claude-fable-5-1" + }, + { + "modelId": "claude-fable-5[thinking=true,context=300k,effort=high]", + "name": "claude-fable-5" + }, + { + "modelId": "grok-4.5[effort=high,fast=true]", + "name": "grok-4.5" + }, + { + "modelId": "gemini-3.8-flash[reasoning_effort=high]", + "name": "gemini-3.8-flash" + }, + { + "modelId": "gemini-3.7-flash[effort=high]", + "name": "gemini-3.7-flash" + }, + { + "modelId": "muse-spark-1.3[context=300k,effort=high]", + "name": "muse-spark-1.3" + }, + { + "modelId": "gpt-5.6-terra[context=272k,reasoning=medium,fast=false]", + "name": "gpt-5.6-terra" + }, + { + "modelId": "claude-sonnet-5-5[context=300k,reasoning_effort=high]", + "name": "claude-sonnet-5-5" + }, + { + "modelId": "claude-sonnet-5[thinking=true,context=300k,effort=high]", + "name": "claude-sonnet-5" + }, + { + "modelId": "claude-sonnet-4-6[thinking=true,context=200k,effort=medium]", + "name": "claude-sonnet-4-6" + }, + { + "modelId": "gpt-5.3-codex[reasoning=medium,fast=false]", + "name": "gpt-5.3-codex" + }, + { + "modelId": "claude-opus-4-7[thinking=true,context=300k,effort=xhigh,fast=false]", + "name": "claude-opus-4-7" + }, + { + "modelId": "gpt-5.4[context=272k,reasoning=medium,fast=false]", + "name": "gpt-5.4" + }, + { + "modelId": "claude-opus-4-6[thinking=true,context=200k,effort=high]", + "name": "claude-opus-4-6" + }, + { + "modelId": "claude-opus-4-5[thinking=true]", + "name": "claude-opus-4-5" + }, + { + "modelId": "gpt-5.2[reasoning=medium,fast=false]", + "name": "gpt-5.2" + }, + { + "modelId": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "name": "gpt-5.6-luna" + }, + { + "modelId": "gemini-3.6-flash[effort=high]", + "name": "gemini-3.6-flash" + }, + { + "modelId": "gemini-3.1-pro[]", + "name": "gemini-3.1-pro" + }, + { + "modelId": "gpt-5.4-mini[reasoning=medium]", + "name": "gpt-5.4-mini" + }, + { + "modelId": "gpt-5.4-nano[reasoning=medium]", + "name": "gpt-5.4-nano" + }, + { + "modelId": "claude-haiku-4-5[thinking=true]", + "name": "claude-haiku-4-5" + }, + { + "modelId": "claude-sonnet-4-5[thinking=true,context=200k]", + "name": "claude-sonnet-4-5" + }, + { + "modelId": "gpt-5.1[reasoning=medium]", + "name": "gpt-5.1" + }, + { + "modelId": "gemini-3-flash[]", + "name": "gemini-3-flash" + }, + { + "modelId": "gemini-3.5-flash[]", + "name": "gemini-3.5-flash" + }, + { + "modelId": "claude-sonnet-4[thinking=false,context=200k]", + "name": "claude-sonnet-4" + }, + { + "modelId": "gpt-5-mini[]", + "name": "gpt-5-mini" + }, + { + "modelId": "gemini-2.5-flash[]", + "name": "gemini-2.5-flash" + }, + { + "modelId": "kimi-k3[reasoning=max]", + "name": "kimi-k3" + }, + { + "modelId": "kimi-k2.7-code[]", + "name": "kimi-k2.7-code" + }, + { + "modelId": "glm-5.2[reasoning=high]", + "name": "glm-5.2" + } + ], + "selectedModel": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "setModelSucceeded": true, + "returnedConfiguration": [ + { + "id": "mode", + "name": "Mode", + "description": "Controls how the agent executes tasks", + "category": "mode", + "type": "select", + "currentValue": "agent", + "options": [ + { + "value": "agent", + "name": "Agent", + "description": "Full agent capabilities with tool access" + }, + { + "value": "plan", + "name": "Plan", + "description": "Read-only mode for planning and designing before implementation" + }, + { + "value": "ask", + "name": "Ask", + "description": "Q&A mode - no edits or command execution" + } + ] + }, + { + "id": "model", + "name": "Model", + "description": "Controls which model variant is used for responses", + "category": "model", + "type": "select", + "currentValue": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "options": [ + { + "value": "default[]", + "name": "Auto" + }, + { + "value": "grok-4.7[context=256k,reasoning_effort=high,fast=true]", + "name": "grok-4.7" + }, + { + "value": "grok-4.6[effort=high,fast=true]", + "name": "grok-4.6" + }, + { + "value": "composer-2.5[fast=true]", + "name": "composer-2.5" + }, + { + "value": "claude-opus-5-5[context=300k,effort=medium,fast=false]", + "name": "claude-opus-5-5" + }, + { + "value": "claude-opus-5[thinking=true,context=300k,effort=high,fast=false]", + "name": "claude-opus-5" + }, + { + "value": "claude-opus-4-8[thinking=true,context=300k,effort=high,fast=false]", + "name": "claude-opus-4-8" + }, + { + "value": "gpt-5.6-sol[context=272k,reasoning=medium,fast=false]", + "name": "gpt-5.6-sol" + }, + { + "value": "gpt-5.5[context=272k,reasoning=medium,fast=false]", + "name": "gpt-5.5" + }, + { + "value": "claude-fable-5-1[thinking=true,context=300k,effort=high]", + "name": "claude-fable-5-1" + }, + { + "value": "claude-fable-5[thinking=true,context=300k,effort=high]", + "name": "claude-fable-5" + }, + { + "value": "grok-4.5[effort=high,fast=true]", + "name": "grok-4.5" + }, + { + "value": "gemini-3.8-flash[reasoning_effort=high]", + "name": "gemini-3.8-flash" + }, + { + "value": "gemini-3.7-flash[effort=high]", + "name": "gemini-3.7-flash" + }, + { + "value": "muse-spark-1.3[context=300k,effort=high]", + "name": "muse-spark-1.3" + }, + { + "value": "gpt-5.6-terra[context=272k,reasoning=medium,fast=false]", + "name": "gpt-5.6-terra" + }, + { + "value": "claude-sonnet-5-5[context=300k,reasoning_effort=high]", + "name": "claude-sonnet-5-5" + }, + { + "value": "claude-sonnet-5[thinking=true,context=300k,effort=high]", + "name": "claude-sonnet-5" + }, + { + "value": "claude-sonnet-4-6[thinking=true,context=200k,effort=medium]", + "name": "claude-sonnet-4-6" + }, + { + "value": "gpt-5.3-codex[reasoning=medium,fast=false]", + "name": "gpt-5.3-codex" + }, + { + "value": "claude-opus-4-7[thinking=true,context=300k,effort=xhigh,fast=false]", + "name": "claude-opus-4-7" + }, + { + "value": "gpt-5.4[context=272k,reasoning=medium,fast=false]", + "name": "gpt-5.4" + }, + { + "value": "claude-opus-4-6[thinking=true,context=200k,effort=high]", + "name": "claude-opus-4-6" + }, + { + "value": "claude-opus-4-5[thinking=true]", + "name": "claude-opus-4-5" + }, + { + "value": "gpt-5.2[reasoning=medium,fast=false]", + "name": "gpt-5.2" + }, + { + "value": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "name": "gpt-5.6-luna" + }, + { + "value": "gemini-3.6-flash[effort=high]", + "name": "gemini-3.6-flash" + }, + { + "value": "gemini-3.1-pro[]", + "name": "gemini-3.1-pro" + }, + { + "value": "gpt-5.4-mini[reasoning=medium]", + "name": "gpt-5.4-mini" + }, + { + "value": "gpt-5.4-nano[reasoning=medium]", + "name": "gpt-5.4-nano" + }, + { + "value": "claude-haiku-4-5[thinking=true]", + "name": "claude-haiku-4-5" + }, + { + "value": "claude-sonnet-4-5[thinking=true,context=200k]", + "name": "claude-sonnet-4-5" + }, + { + "value": "gpt-5.1[reasoning=medium]", + "name": "gpt-5.1" + }, + { + "value": "gemini-3-flash[]", + "name": "gemini-3-flash" + }, + { + "value": "gemini-3.5-flash[]", + "name": "gemini-3.5-flash" + }, + { + "value": "claude-sonnet-4[thinking=false,context=200k]", + "name": "claude-sonnet-4" + }, + { + "value": "gpt-5-mini[]", + "name": "gpt-5-mini" + }, + { + "value": "gemini-2.5-flash[]", + "name": "gemini-2.5-flash" + }, + { + "value": "kimi-k3[reasoning=max]", + "name": "kimi-k3" + }, + { + "value": "kimi-k2.7-code[]", + "name": "kimi-k2.7-code" + }, + { + "value": "glm-5.2[reasoning=high]", + "name": "glm-5.2" + } + ] + } + ], + "rejectedVariant": { + "model": "grok-4.7[context=256k,reasoning_effort=low,fast=false]", + "error": { + "code": -32602, + "message": "Invalid params", + "data": { + "message": "Invalid model value: grok-4.7[context=256k,reasoning_effort=low,fast=false]" + } + } + } + }, + "parameterizedPicker": { + "clientCapability": { + "_meta": { + "parameterizedModelPicker": true + } + }, + "model": "grok-4.7", + "returnedConfiguration": [ + { + "id": "mode", + "currentValue": "agent" + }, + { + "id": "model", + "currentValue": "grok-4.7" + }, + { + "id": "context", + "currentValue": "256k" + }, + { + "id": "reasoning_effort", + "currentValue": "low" + }, + { + "id": "fast", + "currentValue": "false" + } + ], + "paperclipSupport": "Not exposed; separate model and parameter identity verification required" + }, + "redactions": [ + "All session IDs, private filesystem paths, credential values, account identity and raw stderr excluded" + ], + "qualification": { + "inferenceEntitlement": "unverified", + "runnerExecution": "pending shared sidecar admission fix", + "daytona": "not run", + "modelCosts": "no model prompt sent" + } +} From 73363e5be5892f34e18470537b240172c7ad0ba2 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 14:27:07 -0500 Subject: [PATCH 13/31] Record Cursor entitlement attempt and explicit usage gaps Retain the initial denied canonical attempt without treating absent usage as zero; document the typed native error dropped by Cursor ACP and replacement-account model discovery. Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 14 ++- .../authenticated-qualification-attempts.json | 112 ++++++++++++++++++ 2 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index 3b7ffeee182..545211f6126 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -1,6 +1,6 @@ # Cursor ACP capability inventory -Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. No billable prompt was sent ($0 of the assigned $25 budget). After user-authorized browser login, an explicit credential passed native catalog, session-creation and exact model-selection probes; inference entitlement is not yet established. Local authenticated execution, restrictive permission enforcement, dollar usage, and Daytona execution remain required qualification gates. +Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. One authorized task-context prompt on the initial free account returned an upgrade requirement, invoked no semantic tools, and supplied no usage receipt. Its cost is unknown; the account dashboard remained unchanged at coarse precision. The user then selected another account, whose authenticated catalog and exact model selection passed without a prompt. Local semantic execution, restrictive permission enforcement, precise usage, and Daytona execution remain required qualification gates. The reference is the runner's Codex app-server integration and its closed thread-item inventory in `src/provider-events.ts`. Cursor ACP and its private extension methods are the transport; the legacy Cursor adapter is unchanged. @@ -95,7 +95,7 @@ The full `build-provider-pack.mjs --candidate-providers=cursor` path passed on s After the final foundation rebase to `7721662f2`, the TypeScript/verified-sidecar build and all 177 targeted cases passed: Cursor normalization/policy/artifacts, credential bindings, the durable launcher's actual process specification, candidate backend admission, and sidecar behavior. The actual process-launch regressions verify explicit candidate credentials and their marker survive the final closed allowlist; ambient credentials and caller-supplied markers cannot select themselves. The prior source `f09a9a3f8` passed all 47 CI jobs after one retry for runner shutdown and a wall-clock rate-limit case, plus Greptile 5/5; it also passed 29 installed ACPX/materializer Node cases and 6 Daytona image-content cases. These prior results remain historical, distinct from the final source proof. -The fresh pack/probe above binds the final runtime bytes, including the actual-spawn credential fix and preservation of actual usage receipts on terminal provider failure; previous pack evidence remains in Git history. Its explicit offline factory model sentinel is not an authenticated model selection; no ACP prompt was sent. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. Total billable prompts and spend remain zero. +The fresh pack/probe above binds the final runtime bytes, including the actual-spawn credential fix and preservation of actual usage receipts on terminal provider failure; previous pack evidence remains in Git history. Its explicit offline factory model sentinel is not an authenticated model selection; no ACP prompt was sent. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. That offline probe submitted no prompts and incurred no model usage. Subsequent authenticated attempts are recorded separately below. ## Authenticated discovery evidence @@ -105,6 +105,16 @@ The native picker has two materially different interfaces. Ordinary ACP advertis Credential setup uses [Cursor's documented browser login](https://cursor.com/docs/cli/reference/authentication), with an isolated task-owned home and the pinned file credential store. Only the access token was explicitly saved in the operator's private secret file; credentials and refresh tokens are absent from retained public fixtures. The [official usage guide](https://cursor.com/help/account-and-billing/overages) distinguishes included usage from on-demand charges and warns that spend-limit enforcement is delayed. The first prompt therefore requires a separately reserved budget and attribution from the account usage records; missing ACP usage remains unknown, never zero-cost inference. +## Authenticated qualification attempts + +`test/fixtures/cursor-acp/authenticated-qualification-attempts.json` retains sanitized per-attempt source, package, daemon, model, timing, cleanup, and cost evidence. The first canonical `get-task-context` attempt used pack source `e5159fb67ad28bf6a691bfa64ffddb332d96f8be`, exact Luna selection, one turn, a 60-second limit, a $0.50 declared envelope inside a $2 reservation, and zero retries. This is a Runner Eval against the mock control plane, not Product E2E or restrictive-permission qualification. + +The provider returned only an upgrade requirement and then normal completion. Source inspection of pinned `5672.index.js` confirms that actionable authentication/entitlement errors are rendered as ordinary assistant text and lose their typed failure before ACP settlement. No text-matching terminal heuristic is used. This is a P1 native-wrapper gap: preserve typed errors upstream or through a verified owned hook. The semantic oracle must still fail a response that did not invoke the required tool. + +The first attempt also exposed the shared live-eval layer's rejection of missing usage. The foundation now retains explicit unavailable-usage records for diagnostic candidates, leaves the numeric receipt ledger empty, preserves the response for grading, and keeps unknown aggregate costs unknown across mixed turns. This fix does not retroactively turn the retained failed attempt into a pass. + +[Cursor's Grok Bot billing documentation](https://cursor.com/help/grok-bot/plans) says linking SuperGrok grants Grok Bot usage while leaving the Cursor plan unchanged. [Cursor's pricing page](https://cursor.com/pricing) lists Composer for free Hobby and frontier models for paid plans. These documents and model-list presence do not establish entitlement for a particular CLI prompt. The operator selected a replacement Pro+ account; its exact Luna configuration was echoed successfully, with no automatic model substitution. + ## Exact remaining field audit This source audit follows pinned native update → ACPX runtime → `canonicalProviderEventsFromAcpxRuntimeEvent` → Paperclip activity. It supplements the higher-level capability matrix and does not claim an authenticated trace was captured. diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json new file mode 100644 index 00000000000..2a33acb0ccd --- /dev/null +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json @@ -0,0 +1,112 @@ +{ + "schema": "paperclip-cursor-authenticated-qualification/v1", + "providerVersion": "2026.09.26-dd393fe", + "qualification": "pending", + "attempts": [ + { + "id": "cursor-tracer-20260928-1920", + "accountContext": "previous free account; superseded by explicit operator account selection", + "case": "get-task-context", + "runnerSourceRevision": "e5159fb67ad28bf6a691bfa64ffddb332d96f8be", + "providerPackDigest": "sha256:86b907fe5efadaab9bb0953acd1434bcd0e098b1f78bbb2fd7c5ea1b975da5ac", + "runnerPackageSha256": "90c806623d24694997d9d0173cc6c020b1db18e5a978824e2c6f2d0a25825a3b", + "runnerdSha256": "66122cae0160bfa2655d64afb7c7b5c01aa5fa7bba8ad608c7ee768c14f51fec", + "evalRevision": "63e33f556d933beb274447b9568b185a1e37056f", + "requestedModel": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "observedModel": { + "id": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "provider": "cursor" + }, + "startedAt": "2026-09-28T19:17:48.658Z", + "finishedAt": "2026-09-28T19:18:12.924Z", + "durationMs": 24256, + "limits": { + "turnTimeoutMs": 60000, + "maxAgentTurns": 1, + "maxEstimatedCostNanodollars": 500000000 + }, + "automaticRetries": 0, + "nativeTerminalStatus": "completed", + "assistantText": [ + "Upgrade your plan to continue" + ], + "semanticToolInvocations": 0, + "runnerResult": "eval_orchestration_failure", + "runnerDiagnostic": "capability_live_usage_missing", + "interpretation": "Native entitlement denial text was followed by normal ACP completion; missing usage then masked the semantic failure. This attempt is not a pass.", + "networkEvidence": { + "childPaperclipEnvironmentKeys": [], + "realPaperclipRequests": 0 + }, + "cleanup": { + "runnerExited": true, + "runnerExitCode": 0, + "authorityCleared": true, + "mockStopped": true + }, + "usage": { + "submittedPrompts": 1, + "billedPrompts": null, + "tokens": null, + "costUsd": null, + "coverage": "unavailable", + "dashboardBefore": { + "onDemandUsd": 0, + "includedPoolPercent": [ + 0, + 0, + 0 + ] + }, + "dashboardAfter": { + "onDemandUsd": 0, + "includedPoolPercent": [ + 0, + 0, + 0 + ] + }, + "dashboardLimitation": "Aggregate display unchanged at coarse precision; this does not prove zero metered usage or zero charge." + } + } + ], + "newAccountDiscovery": { + "accountContext": "operator-selected replacement account; Pro+ confirmed by operator dashboard", + "methods": [ + { + "method": "initialize", + "status": "success" + }, + { + "method": "cursor/list_available_models", + "status": "success" + }, + { + "method": "session/new", + "status": "success" + }, + { + "method": "session/set_model", + "status": "success" + }, + { + "method": "session/set_config_option", + "status": "success" + } + ], + "modelCount": 41, + "requestedModel": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "exactModelEcho": true, + "modelPrompts": 0 + }, + "nativeWrapperGap": { + "source": "Pinned 5672.index.js entitlement catch", + "behavior": "Actionable upgrade, login, payment, and configuration errors become assistant message text without structured failure metadata; ACP completion may still be successful.", + "treatment": "Retain raw outcome for qualification and semantic oracle; no string-only terminal heuristic.", + "priority": "P1", + "followUp": "Upstream typed failure or an owned verified wrapper hook that preserves typed error before it is rendered." + }, + "redactions": [ + "No tokens, account identifiers, provider session identifiers, private paths, or hidden reasoning retained." + ] +} From 93bdd456b5d9d62a6436726cd26253f81b58d731 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 14:31:28 -0500 Subject: [PATCH 14/31] Retain passing authenticated Cursor protocol qualification evidence Record exact source and fresh daemon identities, successful native MCP task-context calls, included dashboard usage with unknown native receipt, and the earlier denied attempt without an automatic retry. Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 12 +-- .../authenticated-qualification-attempts.json | 85 +++++++++++++++++++ .../provider-pack-darwin-arm64.json | 10 +-- .../provider-pack-offline-proof.json | 6 +- 4 files changed, 100 insertions(+), 13 deletions(-) diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index 545211f6126..18c718e583f 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -1,6 +1,6 @@ # Cursor ACP capability inventory -Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. One authorized task-context prompt on the initial free account returned an upgrade requirement, invoked no semantic tools, and supplied no usage receipt. Its cost is unknown; the account dashboard remained unchanged at coarse precision. The user then selected another account, whose authenticated catalog and exact model selection passed without a prompt. Local semantic execution, restrictive permission enforcement, precise usage, and Daytona execution remain required qualification gates. +Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. One authorized task-context prompt on the initial free account returned an upgrade requirement, invoked no semantic tools, and supplied no usage receipt. Its cost is unknown; the account dashboard remained unchanged at coarse precision. The user then selected another account, whose exact-model local Runner Eval passed task-context and history tools with clean terminal settlement. Its dashboard attributed 56K rounded tokens to included usage and no incremental charge; ACP still supplied no token or dollar receipt. Product E2E, native interactions, restrictive permissions, recovery, and Daytona execution remain required qualification gates. The reference is the runner's Codex app-server integration and its closed thread-item inventory in `src/provider-events.ts`. Cursor ACP and its private extension methods are the transport; the legacy Cursor adapter is unchanged. @@ -84,18 +84,18 @@ Three real ACP stream tests prove child lifecycle/transcript preservation before ## Integrated pack and offline launch evidence -The full `build-provider-pack.mjs --candidate-providers=cursor` path passed on source `a92d06ca5940a42d45cba937f19ba7e7e9c03018` (foundation includes upstream master `14795136f56c11ed83dc754791945bb5a0b8f7fd`). It used standalone Node, pnpm 9.15.4, a fresh production deployment and the pinned vendor archive. The build checked portable Node relocation, fresh ACPX import and complete Cursor materialization. The retained manifest is `packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json`; it contains only relative paths and digests. +The full `build-provider-pack.mjs --candidate-providers=cursor` path passed on source `01959b8a602683f13706807983f02c3cba9d36a0` (foundation includes upstream master `14795136f56c11ed83dc754791945bb5a0b8f7fd`). It used standalone Node, pnpm 9.15.4, a fresh production deployment and the pinned vendor archive. The build checked portable Node relocation, fresh ACPX import and complete Cursor materialization. The retained manifest is `packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json`; it contains only relative paths and digests. -- Pack digest: `sha256:3d36acd9adcfe049fdc30b93ee50f8ce35d59938362eb0c497b4e6b4fbcac028`. +- Pack digest: `sha256:f0b622e9151c1c0886e6220c48ea71993b65887baa88b1600b27462074748ddb`. - Cursor declaration: `sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899`. - macOS ARM64 closure: `sha256:77394184a89b0e7384971181da19c3c82d83a399b04e7944b3f94fe3d7e62b25`. - Resolved dependency lock: `sha256:ec689ad9c31aa2004c7c2c39889764d55897ac2e6d899c8f059d9c23b082c2c8`, also the reviewed Daytona build digest for this branch. This digest was resolved from the clean tracked lock with the exact Docker resolution-only command. The frozen install retained it. Image creation rejects a different digest before execution. `provider-pack-offline-proof.json` records a real launch through the generic profile installation registry from the pack’s verified native closure and retained snapshot, using private directories and no credentials. ACP v1 initialize succeeds. The correct `cursor/list_available_models`, `session/list` and `session/new` methods return authentication-required; `session/fork` and `session/resume` return method-not-found. The process produced no stderr, was explicitly terminated after these probes, and its lease closed. The earlier discovery fixture’s `_cursor/list_available_models` probe used an incorrect method prefix; this later probe corrects that uncertainty without changing the original evidence. -After the final foundation rebase to `7721662f2`, the TypeScript/verified-sidecar build and all 177 targeted cases passed: Cursor normalization/policy/artifacts, credential bindings, the durable launcher's actual process specification, candidate backend admission, and sidecar behavior. The actual process-launch regressions verify explicit candidate credentials and their marker survive the final closed allowlist; ambient credentials and caller-supplied markers cannot select themselves. The prior source `f09a9a3f8` passed all 47 CI jobs after one retry for runner shutdown and a wall-clock rate-limit case, plus Greptile 5/5; it also passed 29 installed ACPX/materializer Node cases and 6 Daytona image-content cases. These prior results remain historical, distinct from the final source proof. +At the prior foundation checkpoint `7721662f2`, the TypeScript/verified-sidecar build and all 177 targeted cases passed: Cursor normalization/policy/artifacts, credential bindings, the durable launcher's actual process specification, candidate backend admission, and sidecar behavior. The actual process-launch regressions verify explicit candidate credentials and their marker survive the final closed allowlist; ambient credentials and caller-supplied markers cannot select themselves. The prior source `f09a9a3f8` passed all 47 CI jobs after one retry for runner shutdown and a wall-clock rate-limit case, plus Greptile 5/5; it also passed 29 installed ACPX/materializer Node cases and 6 Daytona image-content cases. These prior results remain historical, distinct from the final source proof. -The fresh pack/probe above binds the final runtime bytes, including the actual-spawn credential fix and preservation of actual usage receipts on terminal provider failure; previous pack evidence remains in Git history. Its explicit offline factory model sentinel is not an authenticated model selection; no ACP prompt was sent. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. That offline probe submitted no prompts and incurred no model usage. Subsequent authenticated attempts are recorded separately below. +The current pack/probe binds foundation `a589381f9`, including candidate admission, biller attribution, explicit unavailable usage, actual-spawn credential binding, and preservation of usage receipts on terminal provider failure. The verified TypeScript build, 56 Cursor/sidecar/eval-provider tests, 67 shared live/eval tests, and 25 mixed-usage contract tests passed during these qualification fixes. Earlier pack evidence remains in Git history. Its explicit offline factory model sentinel is not an authenticated model selection; no ACP prompt was sent. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. That offline probe submitted no prompts and incurred no model usage. Subsequent authenticated attempts are recorded separately below. ## Authenticated discovery evidence @@ -111,6 +111,8 @@ Credential setup uses [Cursor's documented browser login](https://cursor.com/doc The provider returned only an upgrade requirement and then normal completion. Source inspection of pinned `5672.index.js` confirms that actionable authentication/entitlement errors are rendered as ordinary assistant text and lose their typed failure before ACP settlement. No text-matching terminal heuristic is used. This is a P1 native-wrapper gap: preserve typed errors upstream or through a verified owned hook. The semantic oracle must still fail a response that did not invoke the required tool. +The replacement-account attempt passed all four canonical `get-task-context` checks at source `01959b8a602683f13706807983f02c3cba9d36a0`, using newly rebuilt daemon source `f77ae83aeb6d802c73f1c955760017ae272eba29`. Both `get_task_context` and `get_task_history` returned successful authenticated semantic results. It took 29.291 seconds and exited cleanly. The Usage page showed a new `gpt-5.6-luna-medium` row at 19:28:55 UTC with 56K tokens, marked Included. Incremental cash was zero for that row; metered dollars remain unavailable. A conservative $0.07 list-price bound assumes at most 57K rounded tokens at the maximum listed $1.20/M rate and is not an invoice amount. There was no retry. + The first attempt also exposed the shared live-eval layer's rejection of missing usage. The foundation now retains explicit unavailable-usage records for diagnostic candidates, leaves the numeric receipt ledger empty, preserves the response for grading, and keeps unknown aggregate costs unknown across mixed turns. This fix does not retroactively turn the retained failed attempt into a pass. [Cursor's Grok Bot billing documentation](https://cursor.com/help/grok-bot/plans) says linking SuperGrok grants Grok Bot usage while leaving the Cursor plan unchanged. [Cursor's pricing page](https://cursor.com/pricing) lists Composer for free Hobby and frontier models for paid plans. These documents and model-list presence do not establish entitlement for a particular CLI prompt. The operator selected a replacement Pro+ account; its exact Luna configuration was echoed successfully, with no automatic model substitution. diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json index 2a33acb0ccd..b97e0352c42 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json @@ -68,6 +68,91 @@ }, "dashboardLimitation": "Aggregate display unchanged at coarse precision; this does not prove zero metered usage or zero charge." } + }, + { + "id": "cursor-new-account-first-20260928", + "accountContext": "operator-selected replacement Pro+ account", + "case": "get-task-context", + "runnerSourceRevision": "01959b8a602683f13706807983f02c3cba9d36a0", + "providerPackDigest": "sha256:f0b622e9151c1c0886e6220c48ea71993b65887baa88b1600b27462074748ddb", + "runnerPackageSha256": "75ddd8bf9dd474a01df0879ea1ceda6d015e08a3364dc21c38ddfc9e65a60ec0", + "runnerdSha256": "986060810ba7377c6ddd64a5d89e322d0a434e1a9c80400e6d4acf5934bfc421", + "runnerdSourceRevision": "f77ae83aeb6d802c73f1c955760017ae272eba29", + "evalRevision": "b01676fdb7a2783f7b3635a90ba9583041e86338", + "requestedModel": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "observedModel": { + "id": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "provider": "cursor" + }, + "startedAt": "2026-09-28T19:28:46.976Z", + "finishedAt": "2026-09-28T19:29:16.268Z", + "durationMs": 29291, + "limits": { + "turnTimeoutMs": 60000, + "maxAgentTurns": 1, + "maxEstimatedCostNanodollars": 500000000 + }, + "automaticRetries": 0, + "nativeTerminalStatus": "completed", + "assistantText": "I\u2019m assigned PAP-101, \u201cAdd task-context orientation eval,\u201d under PAP-100.\n\nThe immediate next step is to inspect the runner/evaluation harness and implement the smallest end-to-end check proving an agent reads its assigned task context before acting, while preserving inspectable evidence. The manager specifically asked to start with that smallest check. No task completion or blocking action is authorized yet.", + "semanticResults": [ + { + "operationId": "get_task_context", + "ok": true + }, + { + "operationId": "get_task_history", + "ok": true + } + ], + "runnerResult": "passed", + "oracleChecks": [ + { + "id": "context-call", + "passed": true + }, + { + "id": "terminal-completed", + "passed": true + }, + { + "id": "transcript-complete", + "passed": true + }, + { + "id": "mock-only", + "passed": true + } + ], + "scoreDigest": "sha256:0e39e3067a928b9ff4da7a70426f2e643bf9e869bbee514de8dd6a3661bc0942", + "networkEvidence": { + "childPaperclipEnvironmentKeys": [], + "realPaperclipRequests": 0 + }, + "cleanup": { + "runnerExited": true, + "runnerExitCode": 0 + }, + "usage": { + "submittedPrompts": 1, + "nativeReceipt": null, + "tokenUsage": null, + "costUsd": null, + "coverage": "provider usage unavailable; dashboard row attributed" + }, + "billing": { + "source": "parent-observed account Usage row after bounded attempt", + "observedRequestAt": "2026-09-28T19:28:55Z", + "modelLabel": "gpt-5.6-luna-medium", + "tokensDisplay": "56K", + "usageType": "Included", + "chargeDisplay": "Included", + "incrementalCashChargeUsd": 0, + "meteredCostUsd": null, + "conservativeListCostUpperBoundUsd": 0.07, + "listCostBoundBasis": "At most 57,000 rounded-display tokens at the maximum listed $1.20 per million token rate; this is not a billing receipt." + }, + "scope": "Runner Eval: authenticated local native-MCP semantic tools on mock control plane; not Product E2E or native interaction/recovery/Daytona qualification" } ], "newAccountDiscovery": { diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json index bd4a556c091..e02faf48b2b 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json @@ -1,6 +1,6 @@ { "schema": "paperclip-runner/remote-provider-pack/v1", - "digest": "sha256:3d36acd9adcfe049fdc30b93ee50f8ce35d59938362eb0c497b4e6b4fbcac028", + "digest": "sha256:f0b622e9151c1c0886e6220c48ea71993b65887baa88b1600b27462074748ddb", "payload": { "pins": { "nodeMinimum": "24.11.0", @@ -14,9 +14,9 @@ "platform": "darwin", "architecture": "arm64" }, - "runnerSourceRevision": "a92d06ca5940a42d45cba937f19ba7e7e9c03018", - "distDigest": "sha256:78fc5189d6f8a441aa1060dc968b09cd423f03fb039ef33b17568bb44b7f6da6", - "bridgeDigest": "sha256:d58c15293fd44bad94d222b982da989af54621150c1f16fa7da53beb3bb16f9d", + "runnerSourceRevision": "01959b8a602683f13706807983f02c3cba9d36a0", + "distDigest": "sha256:6ac11b85a406f041e13a9896362cd78ebea5e9edef97527bffb7a8360f6a10bb", + "bridgeDigest": "sha256:e444f448c6fe3c7e0246dc0cc1dcb98c2f735479ba5576f9a9bbb7a3137061c1", "acpxProfileDigests": { "claude": "sha256:9d73d1f0f121fb96cc8badb28c22d5bff02d8582eb2e40360a81c189e1b9422a", "codex": "sha256:c4538599d1ab767db5dff50934f13bb5ba313a59d9c4a83e993fac4617ea63d3" @@ -54,7 +54,7 @@ }, "acpxSidecar": { "path": "dist/cli/acpx-runtime-sidecar.cjs", - "sha256": "sha256:b0c2c42374f8f6dc7a9a4b3a31f3cc94cd8e9e74a5934441188c2ec1fc33e9f9" + "sha256": "sha256:f688c95784dc8d0422c8610251263e374e765d28d22b2f5eeeda509f6155e3e5" } } } diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json index 056136eb865..d89969c13eb 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json @@ -1,8 +1,8 @@ { "schema": "paperclip-cursor-offline-pack-proof/v1", - "capturedAt": "2026-09-28T18:36:20.637Z", - "runnerSourceRevision": "a92d06ca5940a42d45cba937f19ba7e7e9c03018", - "packDigest": "sha256:3d36acd9adcfe049fdc30b93ee50f8ce35d59938362eb0c497b4e6b4fbcac028", + "capturedAt": "2026-09-28T19:28:15.778Z", + "runnerSourceRevision": "01959b8a602683f13706807983f02c3cba9d36a0", + "packDigest": "sha256:f0b622e9151c1c0886e6220c48ea71993b65887baa88b1600b27462074748ddb", "target": { "platform": "darwin", "architecture": "arm64" From b6b4ee2055f60fc942d44fc4f1732cf98e923363 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 14:44:16 -0500 Subject: [PATCH 15/31] Retain Cursor local Product completion and billing evidence Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 6 +- .../authenticated-qualification-attempts.json | 94 +++++++++++++++++++ 2 files changed, 98 insertions(+), 2 deletions(-) diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index 18c718e583f..974609076a6 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -1,6 +1,6 @@ # Cursor ACP capability inventory -Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. One authorized task-context prompt on the initial free account returned an upgrade requirement, invoked no semantic tools, and supplied no usage receipt. Its cost is unknown; the account dashboard remained unchanged at coarse precision. The user then selected another account, whose exact-model local Runner Eval passed task-context and history tools with clean terminal settlement. Its dashboard attributed 56K rounded tokens to included usage and no incremental charge; ACP still supplied no token or dollar receipt. Product E2E, native interactions, restrictive permissions, recovery, and Daytona execution remain required qualification gates. +Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. One authorized task-context prompt on the initial free account returned an upgrade requirement, invoked no semantic tools, and supplied no usage receipt. Its cost is unknown; the account dashboard remained unchanged at coarse precision. The user then selected another account, whose exact-model local Runner Eval passed task-context and history tools with clean terminal settlement. Its dashboard attributed 56K rounded tokens to included usage and no incremental charge; ACP still supplied no token or dollar receipt. The local Product hello subsequently passed through the real browser, server, database, native runner, and authenticated completion tool. Native interactions, file validation, restrictive permissions, recovery, and Daytona execution remain required qualification gates. The reference is the runner's Codex app-server integration and its closed thread-item inventory in `src/provider-events.ts`. Cursor ACP and its private extension methods are the transport; the legacy Cursor adapter is unchanged. @@ -68,7 +68,7 @@ Passed in the provider worktree: The generic native-distribution lease now snapshots the pinned closure, launches Cursor through its verified bundled Node with a closed-module guard, and uses the existing lifetime guardian. A real nonbillable Cursor initialization passed through that lease. Its six focused tests passed, including argument fencing, external module rejection, and native child ownership/exit proof. The existing snapshot suite also passed. The foundation’s later master integration refreshes the common Claude/Codex pins; the candidate pack below was built against that synchronized graph. -Priority follow-ups before advertising support: (1) actual inference entitlement and measured dollar budget after authenticated model discovery; (2) authenticated native lifetime, cleanup and restrictive denial proof; (3) local and Daytona semantic tools, files/artifacts, questions/plans and settlement proof; (4) parent tool content/diff projection and richer nested child presentation; (5) authenticated trace audit for additional unconsumed native fields. Shared receipt/recovery coverage now proves pipe delivery, provider-loss expiry, exact lifecycle IDs and no approval replay. +Priority follow-ups before advertising support: (1) per-attempt cost attribution despite missing native usage receipts; (2) restrictive denial and interruption proof; (3) remaining local and Daytona files/artifacts, questions/plans, recovery and settlement proof; (4) parent tool content/diff projection and richer nested child presentation; (5) authenticated trace audit for additional unconsumed native fields. Shared receipt/recovery coverage now proves pipe delivery, provider-loss expiry, exact lifecycle IDs and no approval replay. Remaining rich capabilities intentionally unused: session discovery, generic mode/config-option UI, provider session titles, command/skill picker metadata, full nested child transcripts beyond bounded delegation summaries, native numeric task duration, and optional planUri. They are listed above with reasons; neither “unsupported” nor “complete” should be inferred for unverified live behaviors. The final combined report must update this inventory with integration evidence and include any further events observed during authenticated qualification. @@ -113,6 +113,8 @@ The provider returned only an upgrade requirement and then normal completion. So The replacement-account attempt passed all four canonical `get-task-context` checks at source `01959b8a602683f13706807983f02c3cba9d36a0`, using newly rebuilt daemon source `f77ae83aeb6d802c73f1c955760017ae272eba29`. Both `get_task_context` and `get_task_history` returned successful authenticated semantic results. It took 29.291 seconds and exited cleanly. The Usage page showed a new `gpt-5.6-luna-medium` row at 19:28:55 UTC with 56K tokens, marked Included. Incremental cash was zero for that row; metered dollars remain unavailable. A conservative $0.07 list-price bound assumes at most 57K rounded tokens at the maximum listed $1.20/M rate and is not an invoice amount. There was no retry. +The local Product hello first stopped at agent creation with HTTP 422 before any provider prompt. Foundation `26dde3cfe` fixed exact host-owned candidate/model admission at the public agent API. The separately authorized replacement passed at source `edf538e61e712dddb6b4d59045c3dcfd445686c7`, from 19:41:56.376 to 19:42:38.761 UTC. All six independent matchers passed: one exact completion marker, task Done, run succeeded, native mode, and local execution. The retained run confirms the 120-second configured deadline, no timeout, committed finalization, and clean cleanup. The final screenshot was inspected and shows the Cursor assignee, tool activity, one completion marker, and Done status. Native usage is null. The account Usage page attributes a new 19:42:25 UTC Luna row with 41.7K tokens, Included in Pro Plus, and zero incremental cash. Metered dollars remain unavailable; a conservative $0.06 list-price bound uses at most 42K rounded tokens at $1.20/M and is not a billing receipt. This proves the local completion-tool product path, not native question/plan, permission, file, recovery, or Daytona qualification. Both attempts remain in the sanitized evidence fixture. + The first attempt also exposed the shared live-eval layer's rejection of missing usage. The foundation now retains explicit unavailable-usage records for diagnostic candidates, leaves the numeric receipt ledger empty, preserves the response for grading, and keeps unknown aggregate costs unknown across mixed turns. This fix does not retroactively turn the retained failed attempt into a pass. [Cursor's Grok Bot billing documentation](https://cursor.com/help/grok-bot/plans) says linking SuperGrok grants Grok Bot usage while leaving the Cursor plan unchanged. [Cursor's pricing page](https://cursor.com/pricing) lists Composer for free Hobby and frontier models for paid plans. These documents and model-list presence do not establish entitlement for a particular CLI prompt. The operator selected a replacement Pro+ account; its exact Luna configuration was echoed successfully, with no automatic model substitution. diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json index b97e0352c42..f944b076c00 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json @@ -153,6 +153,100 @@ "listCostBoundBasis": "At most 57,000 rounded-display tokens at the maximum listed $1.20 per million token rate; this is not a billing receipt." }, "scope": "Runner Eval: authenticated local native-MCP semantic tools on mock control plane; not Product E2E or native interaction/recovery/Daytona qualification" + }, + { + "id": "cursor-product-hello-20260928", + "family": "product-e2e", + "case": "extended-harnesses.runner-acpx-cursor.local.hello-complete", + "runnerSourceRevision": "66ddbc1f9e2001e95dd8a32bd1da09e65df363f7", + "startedAt": "2026-09-28T19:37:31.806Z", + "finishedAt": "2026-09-28T19:37:32.243Z", + "result": "failed_before_agent_creation", + "failureClass": "permanent_infrastructure", + "errorCode": "paperclip_runner_acpx_agent_unavailable", + "submittedPrompts": 0, + "providerRuns": 0, + "automaticRetries": 0, + "cleanup": "passed", + "interpretation": "Public agent creation rejected the pending candidate before provider launch; foundation 26dde3cfe added exact host-owned candidate/model qualification admission. A separately authorized replacement retained the failure." + }, + { + "id": "cursor-product-hello-replacement-20260928", + "family": "product-e2e", + "case": "extended-harnesses.runner-acpx-cursor.local.hello-complete", + "runnerSourceRevision": "edf538e61e712dddb6b4d59045c3dcfd445686c7", + "suiteDefinitionHash": "e75cb2222d2f52ec3a2a425211d195d36b95882de2cb9ed0ad93231b7c42768a", + "runnerdSha256": "986060810ba7377c6ddd64a5d89e322d0a434e1a9c80400e6d4acf5934bfc421", + "runnerdSourceRevision": "f77ae83aeb6d802c73f1c955760017ae272eba29", + "requestedModel": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "startedAt": "2026-09-28T19:41:56.376Z", + "finishedAt": "2026-09-28T19:42:38.761Z", + "durationMs": 42385, + "providerStartedAt": "2026-09-28T19:42:03.686Z", + "providerFinishedAt": "2026-09-28T19:42:36.720Z", + "providerTimeoutSec": 120, + "timeoutFired": false, + "result": "passed", + "automaticRetries": 0, + "submittedPrompts": 1, + "providerRuns": 1, + "matchers": [ + { + "kind": "message_exact", + "passed": true + }, + { + "kind": "message_occurrences", + "passed": true + }, + { + "kind": "issue_status", + "passed": true + }, + { + "kind": "run_status", + "passed": true + }, + { + "kind": "runtime_mode", + "passed": true + }, + { + "kind": "environment", + "passed": true + } + ], + "invariantFailures": [], + "taskStatus": "done", + "runStatus": "succeeded", + "finalizationPhase": "committed", + "cleanup": "passed", + "resultSha256": "5e1ac034a851b0ea124ca314c67e16a6e562ca6e54a30c4421daca1459ccfcd9", + "screenshot": { + "id": "final-state", + "sha256": "04f163928e8f43a1216bc432c4be5248d2434070d270eff9274beaa76730e67a", + "visuallyInspected": true, + "observed": "Task Done; Cursor assignee; one completion marker; tool activity visible." + }, + "usage": { + "nativeReceipt": null, + "tokenUsage": null, + "costUsd": null, + "coverage": "provider usage unavailable; dashboard row attributed" + }, + "scope": "Real local browser/server/database/native runner and authenticated completion tool. Does not qualify native questions/plans, restrictive permissions, file artifacts, recovery, or Daytona.", + "billing": { + "source": "parent-observed account Usage row after bounded attempt", + "observedRequestAt": "2026-09-28T19:42:25Z", + "modelLabel": "gpt-5.6-luna-medium", + "tokensDisplay": "41.7K", + "usageType": "Included in Pro Plus", + "chargeDisplay": "Included", + "incrementalCashChargeUsd": 0, + "meteredCostUsd": null, + "conservativeListCostUpperBoundUsd": 0.06, + "listCostBoundBasis": "At most 42,000 rounded-display tokens at the maximum listed $1.20 per million token rate, rounded up to $0.06; not a billing receipt." + } } ], "newAccountDiscovery": { From 46bf05c67f6f6a1b5515e06fe6b090c1dbae7232 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 14:51:48 -0500 Subject: [PATCH 16/31] Retain Cursor file validation and artifact qualification evidence Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 4 +- .../authenticated-qualification-attempts.json | 95 +++++++++++++++++++ 2 files changed, 98 insertions(+), 1 deletion(-) diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index 974609076a6..f394a812c32 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -1,6 +1,6 @@ # Cursor ACP capability inventory -Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. One authorized task-context prompt on the initial free account returned an upgrade requirement, invoked no semantic tools, and supplied no usage receipt. Its cost is unknown; the account dashboard remained unchanged at coarse precision. The user then selected another account, whose exact-model local Runner Eval passed task-context and history tools with clean terminal settlement. Its dashboard attributed 56K rounded tokens to included usage and no incremental charge; ACP still supplied no token or dollar receipt. The local Product hello subsequently passed through the real browser, server, database, native runner, and authenticated completion tool. Native interactions, file validation, restrictive permissions, recovery, and Daytona execution remain required qualification gates. +Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. One authorized task-context prompt on the initial free account returned an upgrade requirement, invoked no semantic tools, and supplied no usage receipt. Its cost is unknown; the account dashboard remained unchanged at coarse precision. The user then selected another account, whose exact-model local Runner Eval passed task-context and history tools with clean terminal settlement. Its dashboard attributed 56K rounded tokens to included usage and no incremental charge; ACP still supplied no token or dollar receipt. The local Product hello subsequently passed through the real browser, server, database, native runner, and authenticated completion tool. A second local Product case passed file creation, editing, command validation, an independent exact-byte matcher, and visible workspace artifact presentation. Native interactions, restrictive permissions, recovery, and Daytona execution remain required qualification gates. The reference is the runner's Codex app-server integration and its closed thread-item inventory in `src/provider-events.ts`. Cursor ACP and its private extension methods are the transport; the legacy Cursor adapter is unchanged. @@ -115,6 +115,8 @@ The replacement-account attempt passed all four canonical `get-task-context` che The local Product hello first stopped at agent creation with HTTP 422 before any provider prompt. Foundation `26dde3cfe` fixed exact host-owned candidate/model admission at the public agent API. The separately authorized replacement passed at source `edf538e61e712dddb6b4d59045c3dcfd445686c7`, from 19:41:56.376 to 19:42:38.761 UTC. All six independent matchers passed: one exact completion marker, task Done, run succeeded, native mode, and local execution. The retained run confirms the 120-second configured deadline, no timeout, committed finalization, and clean cleanup. The final screenshot was inspected and shows the Cursor assignee, tool activity, one completion marker, and Done status. Native usage is null. The account Usage page attributes a new 19:42:25 UTC Luna row with 41.7K tokens, Included in Pro Plus, and zero incremental cash. Metered dollars remain unavailable; a conservative $0.06 list-price bound uses at most 42K rounded tokens at $1.20/M and is not a billing receipt. This proves the local completion-tool product path, not native question/plan, permission, file, recovery, or Daytona qualification. Both attempts remain in the sanitized evidence fixture. +The local file-edit Product case passed at source `fe132224c2b30a8d9ce7b46cea38b8760af233fc`, from 19:44:43.582 to 19:45:24.406 UTC. All seven matchers passed, including an independent exact-byte read of the 24-byte final file. A native shell command created then rewrote the file and asserted the expected bytes; tool lifecycle and output were retained. The inspected browser screenshot shows the file, a downloadable workspace artifact card, edited-file activity, the completion marker, and Done. Cleanup passed. This is workspace artifact discovery and presentation evidence, not provider-reported diff projection. The account Usage page attributes a 19:44:59 UTC Luna row with 84.1K tokens, Included in Pro Plus, and zero incremental cash. Metered dollars remain unknown; the conservative list-price bound is $0.102, not an invoice. The trace also confirms a meaningful remaining field gap: native command `rawOutput.exitCode:0` survives in serialized output, while canonical `exitCode` remains null; extracting only validated command results is a P2 follow-up. + The first attempt also exposed the shared live-eval layer's rejection of missing usage. The foundation now retains explicit unavailable-usage records for diagnostic candidates, leaves the numeric receipt ledger empty, preserves the response for grading, and keeps unknown aggregate costs unknown across mixed turns. This fix does not retroactively turn the retained failed attempt into a pass. [Cursor's Grok Bot billing documentation](https://cursor.com/help/grok-bot/plans) says linking SuperGrok grants Grok Bot usage while leaving the Cursor plan unchanged. [Cursor's pricing page](https://cursor.com/pricing) lists Composer for free Hobby and frontier models for paid plans. These documents and model-list presence do not establish entitlement for a particular CLI prompt. The operator selected a replacement Pro+ account; its exact Luna configuration was echoed successfully, with no automatic model substitution. diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json index f944b076c00..13e84bfeb07 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json @@ -247,6 +247,101 @@ "conservativeListCostUpperBoundUsd": 0.06, "listCostBoundBasis": "At most 42,000 rounded-display tokens at the maximum listed $1.20 per million token rate, rounded up to $0.06; not a billing receipt." } + }, + { + "id": "cursor-product-file-edit-20260928", + "family": "product-e2e", + "case": "extended-harnesses.runner-acpx-cursor.local.file-edit-validate", + "runnerSourceRevision": "fe132224c2b30a8d9ce7b46cea38b8760af233fc", + "suiteDefinitionHash": "e75cb2222d2f52ec3a2a425211d195d36b95882de2cb9ed0ad93231b7c42768a", + "runnerdSha256": "986060810ba7377c6ddd64a5d89e322d0a434e1a9c80400e6d4acf5934bfc421", + "requestedModel": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "startedAt": "2026-09-28T19:44:43.582Z", + "finishedAt": "2026-09-28T19:45:24.406Z", + "durationMs": 40824, + "providerStartedAt": "2026-09-28T19:44:48.263Z", + "providerFinishedAt": "2026-09-28T19:45:20.690Z", + "providerTimeoutSec": 120, + "timeoutFired": false, + "result": "passed", + "automaticRetries": 0, + "submittedPrompts": 1, + "providerRuns": 1, + "matchers": [ + { + "kind": "message_exact", + "passed": true + }, + { + "kind": "message_occurrences", + "passed": true + }, + { + "kind": "issue_status", + "passed": true + }, + { + "kind": "run_status", + "passed": true + }, + { + "kind": "runtime_mode", + "passed": true + }, + { + "kind": "environment", + "passed": true + }, + { + "kind": "file_exact", + "passed": true + } + ], + "invariantFailures": [], + "taskStatus": "done", + "runStatus": "succeeded", + "cleanup": "passed", + "resultSha256": "2554fd5709ce35712a3f23405fe7550d169b9f3a0cde2a9906c18e4f7ba4ae86", + "screenshot": { + "id": "final-state", + "sha256": "712a1b2105ff54530db9d2a7ff3764c53ad9cbf2bbe047e90010e8f44563972c", + "visuallyInspected": true, + "observed": "Task Done; Cursor assignee; 24-byte text file and downloadable artifact card; Used tools, edited files; one completion marker." + }, + "fileEvidence": { + "exactFinalBytesMatched": true, + "sizeBytes": 24, + "sha256": "a6a152b61f60708dc2982f1a0c06cb8dd7ba6339d26018a0f00a072534fd8c18", + "commandValidation": "Python compared actual bytes to the expected bytes and exited successfully.", + "workspaceArtifactPresented": true, + "providerDiffProjectionQualified": false + }, + "observedEventGap": { + "field": "native command rawOutput.exitCode", + "nativeValue": 0, + "canonicalExitCode": null, + "preservedAs": "serialized rawOutput text", + "followUp": "P2: validated numeric command result projection; do not infer from arbitrary output text." + }, + "usage": { + "nativeReceipt": null, + "tokenUsage": null, + "costUsd": null, + "coverage": "provider usage unavailable; dashboard row attributed" + }, + "scope": "Real local create/edit/command-validation plus independent byte matcher and visible workspace artifact. Does not qualify provider-native diff projection, restrictive denial, native input, recovery, or Daytona.", + "billing": { + "source": "parent-observed account Usage row after bounded attempt", + "observedRequestAt": "2026-09-28T19:44:59Z", + "modelLabel": "gpt-5.6-luna-medium", + "tokensDisplay": "84.1K", + "usageType": "Included in Pro Plus", + "chargeDisplay": "Included", + "incrementalCashChargeUsd": 0, + "meteredCostUsd": null, + "conservativeListCostUpperBoundUsd": 0.102, + "listCostBoundBasis": "Rounded dashboard token count bounded conservatively at the maximum listed $1.20 per million token rate; not a billing receipt." + } } ], "newAccountDiscovery": { From d0832d3ffad0d07c2d3bf1694682bae503b8f2cb Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 15:01:46 -0500 Subject: [PATCH 17/31] Refresh merged Cursor patch and immutable dependency pin Co-Authored-By: Paperclip --- docker/daytona-runner/Dockerfile | 2 +- patches/acpx@0.13.1.patch | 161 +++++++++++++++++-------------- 2 files changed, 87 insertions(+), 76 deletions(-) diff --git a/docker/daytona-runner/Dockerfile b/docker/daytona-runner/Dockerfile index 6d544f6e02c..7d573c60485 100644 --- a/docker/daytona-runner/Dockerfile +++ b/docker/daytona-runner/Dockerfile @@ -28,7 +28,7 @@ COPY cli/package.json ./cli/package.json # The complete resolved lock (including transitive integrity hashes) is reviewed. # Reject registry-time drift BEFORE installing packages or running lifecycle code. # Refresh this digest together with source/provider dependency changes. -ARG PAPERCLIP_RUNNER_LOCK_SHA256=9c163adf40fe1c6a65abda6207bd9f5acfc8196bc94f81348b8bf1b2769e050e +ARG PAPERCLIP_RUNNER_LOCK_SHA256=a9f7b2839491612675e9ec543143848e8b01343cbf8456098b3e9f4d7394eed1 RUN printf '%s pnpm-lock.yaml\n' "${PAPERCLIP_RUNNER_LOCK_SHA256}" > /tmp/provider-lock.sha256 \ && sha256sum -c /tmp/provider-lock.sha256 \ && pnpm install --frozen-lockfile --filter '@paperclipai/paperclip-runner...' diff --git a/patches/acpx@0.13.1.patch b/patches/acpx@0.13.1.patch index 3f380457b61..b61fdb87cd6 100644 --- a/patches/acpx@0.13.1.patch +++ b/patches/acpx@0.13.1.patch @@ -1,7 +1,8 @@ diff --git a/dist/client-CxNllqui.d.ts b/dist/client-CxNllqui.d.ts +index 5e2113ac0..45aff03c3 100644 --- a/dist/client-CxNllqui.d.ts +++ b/dist/client-CxNllqui.d.ts -@@ -120,6 +120,8 @@ +@@ -120,6 +120,8 @@ declare class AcpClient { private initializeProtocolConnection; private handleInitializeFailure; private createTappedStream; @@ -10,7 +11,7 @@ diff --git a/dist/client-CxNllqui.d.ts b/dist/client-CxNllqui.d.ts createSession(cwd?: string): Promise; loadSession(sessionId: string, cwd?: string): Promise; loadSessionWithOptions(sessionId: string, cwd?: string, options?: LoadSessionOptions): Promise; -@@ -135,6 +137,7 @@ +@@ -135,6 +137,7 @@ declare class AcpClient { private throwPromptPermissionFailureIfPresent; setSessionMode(sessionId: string, modeId: string): Promise; setSessionConfigOption(sessionId: string, configId: string, value: string): Promise; @@ -19,9 +20,10 @@ diff --git a/dist/client-CxNllqui.d.ts b/dist/client-CxNllqui.d.ts private setSessionModelThroughConfig; private setSessionModelThroughLegacyMethod; diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js +index d454fd7c5..330b80394 100644 --- a/dist/live-checkpoint-BSIrfgVo.js +++ b/dist/live-checkpoint-BSIrfgVo.js -@@ -1068,6 +1068,7 @@ +@@ -1068,6 +1068,7 @@ function serializeSessionRecordForDisk(record) { last_agent_disconnect_reason: canonical.lastAgentDisconnectReason, protocol_version: canonical.protocolVersion, agent_capabilities: canonical.agentCapabilities, @@ -29,7 +31,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js title: canonical.title, messages: canonical.messages, updated_at: canonical.updated_at, -@@ -1239,7 +1240,8 @@ +@@ -1239,7 +1240,8 @@ function parseRequestTokenUsage(raw) { for (const [key, value] of Object.entries(record)) { const parsed = parseTokenUsage(value); if (parsed == null) return null; @@ -39,7 +41,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js } return usage; } -@@ -1541,6 +1543,7 @@ +@@ -1541,6 +1543,7 @@ function parseSessionRecord(raw) { lastAgentDisconnectReason: optionals.lastAgentDisconnectReason, protocolVersion: typeof record.protocol_version === "number" ? record.protocol_version : void 0, agentCapabilities: asRecord$4(record.agent_capabilities), @@ -47,7 +49,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js title: conversation.title, messages: conversation.messages, updated_at: conversation.updated_at, -@@ -1661,7 +1664,7 @@ +@@ -1661,7 +1664,7 @@ const ZED_TAG_KEYS = /* @__PURE__ */ new Set([ "RedactedThinking", "ToolUse" ]); @@ -56,7 +58,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js const OPAQUE_VALUE_PATHS = /* @__PURE__ */ new Set([ "agent_capabilities", "messages.Agent.content.ToolUse.input", -@@ -3104,10 +3107,10 @@ +@@ -3104,10 +3107,10 @@ function authEnvKey(methodId) { authEnvKeyCache.set(methodId, key); return key; } @@ -69,7 +71,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js if (typeof value === "string" && value.trim().length > 0) return value; } function protectedEnvKey(key) { -@@ -3135,8 +3138,21 @@ +@@ -3135,8 +3138,21 @@ function promotePrefixedAuthEnvironment(env) { } return protectedKeys; } @@ -93,7 +95,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js const protectedAuthEnvKeys = promotePrefixedAuthEnvironment(env); if (authCredentials) for (const [methodId, credential] of Object.entries(authCredentials)) { addAuthCredentialEnvKeys(protectedAuthEnvKeys, methodId, credential); -@@ -3178,10 +3194,10 @@ +@@ -3178,10 +3194,10 @@ function resolveConfiguredAuthCredential(methodId, authCredentials) { const configCredentials = authCredentials ?? {}; return configCredentials[methodId] ?? configCredentials[toEnvToken(methodId)]; } @@ -106,7 +108,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js stdio: [ "pipe", "pipe", -@@ -3961,10 +3977,13 @@ +@@ -3961,10 +3977,13 @@ function resolveClientCapabilities(params) { ...params.elicitationModes.includes("url") ? { url: {} } : {} } } : {} }; @@ -122,7 +124,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js }; } function hasResponseField(response, field) { -@@ -4067,6 +4086,27 @@ +@@ -4067,6 +4086,27 @@ function createNdJsonMessageStream(agentCommand, output, input) { } }) }; } @@ -150,7 +152,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js var AcpClient = class { options; connection; -@@ -4105,7 +4145,9 @@ +@@ -4105,7 +4145,9 @@ var AcpClient = class { cwd: asAbsoluteCwd(options.cwd), authPolicy: options.authPolicy ?? "skip", permissionPolicy: snapshotPermissionPolicy(options.permissionPolicy), @@ -161,7 +163,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js }; this.eventHandlers = { onAcpMessage: this.options.onAcpMessage, -@@ -4216,9 +4258,21 @@ +@@ -4216,9 +4258,21 @@ var AcpClient = class { this.lastAgentExit = void 0; this.lastKnownPid = child.pid ?? void 0; this.attachAgentLifecycleObservers(child); @@ -183,7 +185,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js if (!this.options.verbose) return; process.stderr.write(chunk); }); -@@ -4226,6 +4280,7 @@ +@@ -4226,6 +4280,7 @@ var AcpClient = class { const output = Readable.toWeb(child.stdout); const stream = this.createTappedStream(createNdJsonMessageStream(this.options.agentCommand, input, output)); const connection = this.createConnection(stream, launch); @@ -191,7 +193,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js connection.signal.addEventListener("abort", () => { this.recordAgentExit("connection_close", child.exitCode ?? null, child.signalCode ?? null); }, { once: true }); -@@ -4253,7 +4308,12 @@ +@@ -4253,7 +4308,12 @@ var AcpClient = class { geminiAcp: isGeminiAcpCommand(spawnCommand, args), copilotAcp: isCopilotAcpCommand(spawnCommand, args), claudeAcp: isClaudeAcpCommand(spawnCommand, args), @@ -205,7 +207,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js }; } logAgentLaunch(plan) { -@@ -4279,10 +4339,17 @@ +@@ -4279,10 +4339,17 @@ var AcpClient = class { } async spawnAgentProcess(plan) { const spawnCommand = buildAgentSpawnCommand(plan.spawnCommand, plan.args, process.platform, plan.spawnOptions.env); @@ -225,7 +227,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js try { await waitForSpawn$1(spawnedChild); } catch (error) { -@@ -4293,10 +4360,10 @@ +@@ -4293,10 +4360,10 @@ var AcpClient = class { createConnection(stream, launch) { const app = client({ name: "acpx" }).onNotification(methods.client.session.update, async ({ params }) => { await this.handleSessionUpdate(params); @@ -239,7 +241,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js }).onRequest(methods.client.fs.readTextFile, async ({ params }) => { return await this.handleReadTextFile(params); }).onRequest(methods.client.fs.writeTextFile, async ({ params }) => { -@@ -4312,6 +4379,11 @@ +@@ -4312,6 +4379,11 @@ var AcpClient = class { }).onRequest(methods.client.terminal.release, async ({ params }) => { return await this.handleReleaseTerminal(params); }); @@ -251,7 +253,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js if (launch.devinAcp) app.onRequest("_cognition.ai/request_diagnostics", (params) => { return params && typeof params === "object" && !Array.isArray(params) ? params : {}; }, async () => ({})); -@@ -4333,12 +4405,12 @@ +@@ -4333,12 +4405,12 @@ var AcpClient = class { async initializeProtocolConnection(connection, launch) { const initializePromise = connection.initialize({ protocolVersion: PROTOCOL_VERSION, @@ -266,7 +268,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js clientInfo: resolveClientInfo(launch.devinAcp) }); const initialized = launch.geminiAcp ? await withTimeout(initializePromise, resolveGeminiAcpStartupTimeoutMs()) : await initializePromise; -@@ -4358,6 +4430,36 @@ +@@ -4358,6 +4430,36 @@ var AcpClient = class { throw normalizedError; } createTappedStream(base) { @@ -303,7 +305,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js const onAcpMessage = () => this.eventHandlers.onAcpMessage; const onAcpOutputMessage = () => this.eventHandlers.onAcpOutputMessage; const elicitationRequestIds = /* @__PURE__ */ new Set(); -@@ -4367,8 +4469,12 @@ +@@ -4367,8 +4469,12 @@ var AcpClient = class { const shouldSuppressInboundReplaySessionUpdate = (message) => { return this.suppressReplaySessionUpdateMessages && isSessionUpdateNotification(message); }; @@ -317,7 +319,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js if (requestId !== void 0) { elicitationRequestIds.add(requestId); return; -@@ -4379,6 +4485,7 @@ +@@ -4379,6 +4485,7 @@ var AcpClient = class { } }; return { @@ -325,7 +327,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js readable: new ReadableStream({ async start(controller) { const reader = base.readable.getReader(); try { -@@ -4387,10 +4494,17 @@ +@@ -4387,10 +4494,17 @@ var AcpClient = class { if (done) break; if (!value) continue; observeInbound(value); @@ -344,7 +346,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js reader.releaseLock(); controller.close(); } -@@ -4403,10 +4517,20 @@ +@@ -4403,10 +4517,20 @@ var AcpClient = class { onAcpOutputMessage()?.("outbound", message); onAcpMessage()?.("outbound", message); } @@ -365,7 +367,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js writer.releaseLock(); } } }) -@@ -4422,7 +4546,10 @@ +@@ -4422,7 +4546,10 @@ var AcpClient = class { const createPromise = this.runConnectionRequest(() => connection.newSession({ cwd: sessionCwd, mcpServers: this.options.mcpServers ?? [], @@ -377,7 +379,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js })); result = claudeAcp ? await withTimeout(createPromise, resolveClaudeAcpSessionCreateTimeoutMs()) : await createPromise; } catch (error) { -@@ -4864,7 +4991,7 @@ +@@ -4864,7 +4991,7 @@ var AcpClient = class { } selectAuthMethod(methods) { for (const method of methods) { @@ -386,7 +388,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js if (envCredential) return { methodId: method.id, credential: envCredential, -@@ -4890,7 +5017,7 @@ +@@ -4890,7 +5017,7 @@ var AcpClient = class { } readAgentSpecificEnvCredential(methodId) { if (!this.isGrokBuildAcpCommand() || methodId !== "xai.api_key") return; @@ -395,7 +397,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js return typeof value === "string" && value.trim().length > 0 ? value : void 0; } selectAgentManagedAuthMethod(methodId) { -@@ -4915,9 +5042,9 @@ +@@ -4915,9 +5042,9 @@ var AcpClient = class { await connection.authenticate({ methodId: selected.methodId }); this.log(`authenticated with method ${selected.methodId} (${selected.source})`); } @@ -407,7 +409,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js if (hostResponse) return hostResponse; const { response, recorded } = await this.resolvePermissionRequestFromMode(params); if (!recorded) { -@@ -4926,14 +5053,81 @@ +@@ -4926,14 +5053,81 @@ var AcpClient = class { } return response; } @@ -491,7 +493,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js })).then((response) => ({ kind: "response", response -@@ -4970,7 +5164,7 @@ +@@ -4970,7 +5164,7 @@ var AcpClient = class { isElicitationSessionCancelling(sessionId) { return this.closing || this.cancellingSessionIds.has(sessionId); } @@ -500,7 +502,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js if (!this.options.onPermissionRequest) return; const signal = this.cancellationSignalForSession(params.sessionId); try { -@@ -4978,7 +5172,7 @@ +@@ -4978,7 +5172,7 @@ var AcpClient = class { sessionId: params.sessionId, raw: params, inferredKind: inferToolKind(params) @@ -509,7 +511,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js return this.hostPermissionDecisionResponse(params, signal, decision); } catch (error) { return this.hostPermissionErrorResponse(params, signal, error); -@@ -5028,6 +5222,12 @@ +@@ -5028,6 +5222,12 @@ var AcpClient = class { attachAgentLifecycleObservers(child) { child.once("exit", (exitCode, signal) => { this.recordAgentExit("process_exit", exitCode, signal); @@ -522,7 +524,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js }); child.once("close", (exitCode, signal) => { this.recordAgentExit("process_close", exitCode, signal); -@@ -5771,10 +5971,20 @@ +@@ -5771,10 +5971,20 @@ function recordSessionUpdate(conversation, state, notification, timestamp = isoN trimConversationForRuntime(conversation); return acpx; } @@ -545,7 +547,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js updateConversationTimestamp(conversation, timestamp); trimConversationForRuntime(conversation); return true; -@@ -6435,6 +6645,27 @@ +@@ -6435,6 +6645,27 @@ async function withConnectedSession(options) { //#region src/runtime/engine/prompt-turn.ts const SESSION_REPLY_IDLE_MS = 1e3; const SESSION_REPLY_DRAIN_TIMEOUT_MS = 5e3; @@ -573,7 +575,7 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js async function runPromptTurn(params) { try { const promptPromise = params.client.prompt(params.sessionId, params.prompt, params.onPromptRequestStarted, params.onElicitation); -@@ -6444,7 +6675,21 @@ +@@ -6444,7 +6675,21 @@ async function runPromptTurn(params) { idleMs: SESSION_REPLY_IDLE_MS, timeoutMs: SESSION_REPLY_DRAIN_TIMEOUT_MS }).catch(() => {}); @@ -595,12 +597,15 @@ diff --git a/dist/live-checkpoint-BSIrfgVo.js b/dist/live-checkpoint-BSIrfgVo.js return { stopReason: response.stopReason, source: "rpc" -@@ -6518,4 +6763,4 @@ +@@ -6518,4 +6763,4 @@ var LiveSessionCheckpoint = class { //#endregion export { writeSessionRecord as $, PERMISSION_POLICY_ACTIONS as $t, REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE as A, TimeoutError as At, getAcpxVersion as B, formatErrorMessage as Bt, mergeSessionOptions as C, PromptInputValidationError as Ct, applyLifecycleSnapshotToRecord as D, promptToDisplayText as Dt, applyConversation as E, parsePromptSource as Et, modelStateFromConfigOptions as F, normalizeAgentName$1 as Ft, findSession as G, toAcpErrorPayload as Gt, DEFAULT_HISTORY_LIMIT as H, normalizeOutputError as Ht, normalizeAgentCommandInput as I, resolveAgentArgv as It, listSessions as J, NON_INTERACTIVE_PERMISSION_POLICIES as Jt, findSessionByDirectoryWalk as K, AUTH_POLICIES as Kt, renderArgvIdentity as L, resolveAgentCommand as Lt, RequestedModelUnsupportedError as M, withTimeout as Mt, assertRequestedModelSupported as N, DEFAULT_AGENT_NAME as Nt, reconcileAgentSessionId as O, textPrompt as Ot, isRequestedModelUnsupportedError as P, listBuiltInAgents as Pt, resolveSessionRecord as Q, PERMISSION_MODES as Qt, runTimedExecFile as R, resolveCanonicalAgentName as Rt, advertisedModelState as S, parsePromptStopReason as St, sessionOptionsFromRecord as T, mergePromptSourceWithText as Tt, absolutePath as U, extractAcpError as Ut, permissionModeSatisfies as V, isRetryablePromptError as Vt, findGitRepositoryRoot as W, isAcpResourceNotFoundError as Wt, normalizeName as X, OUTPUT_ERROR_ORIGINS as Xt, listSessionsForAgent as Y, OUTPUT_ERROR_CODES as Yt, pruneSessions as Z, OUTPUT_FORMATS as Zt, createSessionConversation as _, sessionEventLockPath as _t, applyRequestedModelIfAdvertised as a, measurePerf as at, recordSessionUpdate as b, isAcpJsonRpcMessage as bt, setCurrentModelId as c, setPerfGauge as ct, setDesiredModelId as d, serializeSessionRecordForDisk as dt, SESSION_RECORD_SCHEMA as en, createAtomicWriteTempPath as et, syncAdvertisedModelState as f, normalizeRuntimeSessionId as ft, cloneSessionConversation as g, sessionEventActivePath as gt, cloneSessionAcpxState as h, sessionBaseDir$1 as ht, connectAndLoadSession as i, QueueProtocolError as in, incrementPerfCounter as it, REQUESTED_MODEL_UNSUPPORTED_REASONS as j, withInterrupt as jt, AcpClient as k, InterruptedError as kt, setDesiredConfigOption as l, startPerfTimer as lt, applyConfigOptionsToState as m, defaultSessionEventLog as mt, runPromptTurn as n, AgentSpawnError as nn, formatPerfMetric as nt, currentModelIdFromSetModelResponse as o, recordPerfDuration as ot, applyConfigOptionsToRecord as p, DEFAULT_EVENT_SEGMENT_MAX_BYTES as pt, isoNow$2 as q, EXIT_CODES as qt, withConnectedSession as r, QueueConnectionError as rn, getPerfMetricsSnapshot as rt, clearDesiredConfigOption as s, resetPerfMetrics as st, LiveSessionCheckpoint as t, AcpxOperationalError as tn, assertPersistedKeyPolicy as tt, setDesiredModeId as u, parseSessionRecord as ut, recordClientOperation as v, sessionEventSegmentPath as vt, persistSessionOptions as w, isPromptInput as wt, trimConversationForRuntime as x, parseJsonRpcErrorMessage as xt, recordPromptSubmission as y, extractSessionUpdateNotification as yt, splitCommandLine as z, exitCodeForOutputErrorCode as zt }; --//# sourceMappingURL=live-checkpoint-BSIrfgVo.js.map+//# sourceMappingURL=live-checkpoint-BSIrfgVo.js.map +-//# sourceMappingURL=live-checkpoint-BSIrfgVo.js.map +\ No newline at end of file ++//# sourceMappingURL=live-checkpoint-BSIrfgVo.js.map diff --git a/dist/runtime.d.ts b/dist/runtime.d.ts +index e8102acb0..d3a9ba626 100644 --- a/dist/runtime.d.ts +++ b/dist/runtime.d.ts @@ -1,7 +1,8 @@ @@ -613,7 +618,7 @@ diff --git a/dist/runtime.d.ts b/dist/runtime.d.ts //#region src/agent-registry.d.ts declare const DEFAULT_AGENT_NAME = "codex"; //#endregion -@@ -44,6 +45,7 @@ +@@ -44,6 +45,7 @@ type AcpRuntimeTurnAttachment = { data: string; }; type AcpRuntimeTurnInput = { @@ -621,7 +626,7 @@ diff --git a/dist/runtime.d.ts b/dist/runtime.d.ts handle: AcpRuntimeHandle; text: string; attachments?: AcpRuntimeTurnAttachment[]; -@@ -141,6 +143,11 @@ +@@ -141,6 +143,11 @@ type AcpTextDeltaOriginMeta = { kind?: string; source?: string; }; @@ -633,7 +638,7 @@ diff --git a/dist/runtime.d.ts b/dist/runtime.d.ts type AcpRuntimeEvent = { type: "text_delta"; text: string; -@@ -186,6 +193,10 @@ +@@ -186,6 +193,10 @@ type AcpRuntimeEvent = { * non-null `input` schema. */ availableCommands?: AcpRuntimeAvailableCommand[]; @@ -644,7 +649,7 @@ diff --git a/dist/runtime.d.ts b/dist/runtime.d.ts } | { type: "tool_call"; text: string; -@@ -312,7 +323,49 @@ +@@ -312,7 +323,49 @@ type AcpRuntimeOptions = { elicitationModes?: readonly AcpElicitationMode[]; onPermissionRequest?: (req: AcpPermissionRequest, ctx: { signal: AbortSignal; @@ -694,7 +699,7 @@ diff --git a/dist/runtime.d.ts b/dist/runtime.d.ts }; type AcpFileSessionStoreOptions = { stateDir: string; -@@ -369,6 +422,7 @@ +@@ -369,6 +422,7 @@ declare class AcpRuntimeManager { private createAndSaveRuntimeRecord; private retainInitializedSessionOwner; startTurn(input: { @@ -702,7 +707,7 @@ diff --git a/dist/runtime.d.ts b/dist/runtime.d.ts handle: AcpRuntimeHandle; text: string; attachments?: AcpRuntimeTurnAttachment[]; -@@ -414,6 +468,7 @@ +@@ -414,6 +468,7 @@ declare class AcpRuntimeManager { private cleanupRuntimeTurn; private finalizeRuntimeTurnRecord; runTurn(input: { @@ -711,9 +716,10 @@ diff --git a/dist/runtime.d.ts b/dist/runtime.d.ts text: string; attachments?: AcpRuntimeTurnAttachment[]; diff --git a/dist/runtime.js b/dist/runtime.js +index a1f4a70a0..fe2484de6 100644 --- a/dist/runtime.js +++ b/dist/runtime.js -@@ -371,7 +371,7 @@ +@@ -371,7 +371,7 @@ const PROMPT_EVENT_PARSERS = { current_mode_update: (payload) => statusUpdateEvent("current_mode_update", payload), config_option_update: (payload) => statusUpdateEvent("config_option_update", payload), session_info_update: (payload) => statusUpdateEvent("session_info_update", payload), @@ -722,11 +728,10 @@ diff --git a/dist/runtime.js b/dist/runtime.js client_operation: clientOperationEvent, update: updateStatusEvent, done: () => null, -@@ -423,6 +423,34 @@ - tag: "available_commands_update", +@@ -424,6 +424,34 @@ function availableCommandsUpdateEvent(payload) { availableCommands }; -+} + } +function persistedGoalCapability(goal) { + if (!isRecord(goal) || goal.version !== 1 || goal.controlMethod !== "_session/goal" || !Array.isArray(goal.actions)) return; + const actions = goal.actions.filter((action) => ["set", "pause", "resume", "clear"].includes(action)); @@ -754,10 +759,11 @@ diff --git a/dist/runtime.js b/dist/runtime.js + entries.push({ content, status, ...priority ? { priority } : {} }); + } + return { type: "plan", tag: "plan", entries }; - } ++} function normalizeUsageCost(value) { if (!isRecord(value)) return; -@@ -812,7 +840,21 @@ + const amount = asOptionalFiniteNumber(value.amount); +@@ -812,7 +840,21 @@ var AcpRuntimeManager = class { this.deps = deps; } createClient(options) { @@ -780,7 +786,7 @@ diff --git a/dist/runtime.js b/dist/runtime.js } createSessionOwner(input) { const owner = { -@@ -821,12 +863,16 @@ +@@ -821,12 +863,16 @@ var AcpRuntimeManager = class { pendingSessionUpdates: [] }; input.client.setEventHandlers({ @@ -797,7 +803,7 @@ diff --git a/dist/runtime.js b/dist/runtime.js const active = owner.activeTurn; if (active) { const { task, turn } = active; -@@ -863,6 +909,9 @@ +@@ -863,6 +909,9 @@ var AcpRuntimeManager = class { projection.checkpoint.request(); } routeOwnedClientOperation(owner, operation) { @@ -807,7 +813,7 @@ diff --git a/dist/runtime.js b/dist/runtime.js const active = owner.activeTurn; if (!active) return; const { task, turn } = active; -@@ -1008,6 +1057,8 @@ +@@ -1008,6 +1057,8 @@ var AcpRuntimeManager = class { record.closedAt = void 0; record.protocolVersion = owner.client.initializeResult?.protocolVersion; record.agentCapabilities = owner.client.initializeResult?.agentCapabilities; @@ -816,7 +822,7 @@ diff --git a/dist/runtime.js b/dist/runtime.js applyLifecycleSnapshotToRecord(record, owner.client.getAgentLifecycleSnapshot()); } async finishBufferedOwnerControl(owner, record) { -@@ -1086,6 +1137,11 @@ +@@ -1086,6 +1137,11 @@ var AcpRuntimeManager = class { record.closed = false; record.closedAt = void 0; this.closingActiveRecords.delete(record.acpxRecordId); @@ -828,7 +834,7 @@ diff --git a/dist/runtime.js b/dist/runtime.js await this.options.sessionStore.save(record); return record; } -@@ -1149,6 +1205,8 @@ +@@ -1149,6 +1205,8 @@ var AcpRuntimeManager = class { this.closingActiveRecords.delete(record.acpxRecordId); record.protocolVersion = client.initializeResult?.protocolVersion; record.agentCapabilities = client.initializeResult?.agentCapabilities; @@ -837,7 +843,7 @@ diff --git a/dist/runtime.js b/dist/runtime.js applyConfigOptionsToRecord(record, session.sessionResult); const modelApplication = await applyRequestedModelIfAdvertised({ client, -@@ -1301,6 +1359,7 @@ +@@ -1301,6 +1359,7 @@ var AcpRuntimeManager = class { client: turn.client, sessionId, prompt: task.promptInput, @@ -845,7 +851,7 @@ diff --git a/dist/runtime.js b/dist/runtime.js timeoutMs: task.input.timeoutMs ?? this.options.timeoutMs, conversation: turn.conversation, promptMessageId: turn.promptMessageId, -@@ -1469,6 +1528,10 @@ +@@ -1469,6 +1528,10 @@ var AcpRuntimeManager = class { setSessionConfigOption: async (configId, value) => { return (await task.state.activeController.setResolvedSessionConfigOption(configId, value)).response; }, @@ -856,7 +862,7 @@ diff --git a/dist/runtime.js b/dist/runtime.js setResolvedSessionConfigOption: async (configId, value) => await this.setRuntimeResolvedSessionConfigOption(task, turn, configId, value) }; } -@@ -1575,6 +1638,8 @@ +@@ -1575,6 +1638,8 @@ var AcpRuntimeManager = class { reconcileAgentSessionId(turn.record, turn.record.agentSessionId); turn.record.protocolVersion = turn.client.initializeResult?.protocolVersion; turn.record.agentCapabilities = turn.client.initializeResult?.agentCapabilities; @@ -865,11 +871,10 @@ diff --git a/dist/runtime.js b/dist/runtime.js turn.record.acpx = turn.acpxState; applyConversation(turn.record, turn.conversation); applyLifecycleSnapshotToRecord(turn.record, turn.client.getAgentLifecycleSnapshot()); -@@ -1706,6 +1771,17 @@ - applyDesiredConfigOptionToRecord(connectedRecord, configId, value); +@@ -1707,6 +1772,17 @@ var AcpRuntimeManager = class { }); await this.options.sessionStore.save(result.record); -+ } + } + async requestExtension(input) { + const recordId = input.handle.acpxRecordId ?? input.handle.sessionKey; + return await this.withManagerLock(this.runtimeOperationLocks, recordId, async () => { @@ -880,10 +885,11 @@ diff --git a/dist/runtime.js b/dist/runtime.js + return await client.requestExtension(input.method, input.params); + })).value; + }); - } ++ } async cancel(handle) { await this.activeControllers.get(handle.acpxRecordId ?? handle.sessionKey)?.requestCancelActivePrompt(); -@@ -2055,6 +2131,7 @@ + } +@@ -2055,6 +2131,7 @@ var AcpxRuntime = class { const turnPromise = this.getManager().then((manager) => manager.startTurn({ handle, text: input.text, @@ -891,7 +897,7 @@ diff --git a/dist/runtime.js b/dist/runtime.js attachments: input.attachments, mode: input.mode, sessionMode: state.mode, -@@ -2087,6 +2164,7 @@ +@@ -2087,6 +2164,7 @@ var AcpxRuntime = class { yield* (await this.getManager()).runTurn({ handle, text: input.text, @@ -899,11 +905,10 @@ diff --git a/dist/runtime.js b/dist/runtime.js attachments: input.attachments, mode: input.mode, sessionMode: state.mode, -@@ -2118,6 +2196,14 @@ - async setConfigOption(input) { +@@ -2119,6 +2197,14 @@ var AcpxRuntime = class { const { handle, state } = this.resolveManagerHandle(input.handle); await (await this.getManager()).setConfigOption(handle, input.key, input.value, state.mode); -+ } + } + async requestExtension(input) { + const { handle, state } = this.resolveManagerHandle(input.handle); + return await (await this.getManager()).requestExtension({ @@ -911,15 +916,19 @@ diff --git a/dist/runtime.js b/dist/runtime.js + handle, + sessionMode: input.sessionMode ?? state.mode + }); - } ++ } async cancel(input) { const { handle } = this.resolveManagerHandle(input.handle); -@@ -2178,4 +2264,4 @@ + await (await this.getManager()).cancel(handle); +@@ -2178,4 +2264,4 @@ function createRuntimeStore(options) { //#endregion export { ACPX_BACKEND_ID, AcpRuntimeError, AcpxRuntime, DEFAULT_AGENT_NAME, REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE, REQUESTED_MODEL_UNSUPPORTED_REASONS, RequestedModelUnsupportedError, createAcpRuntime, createAgentRegistry, createFileSessionStore, createRuntimeStore, decodeAcpxRuntimeHandleState, encodeAcpxRuntimeHandleState, isAcpRuntimeError, isRequestedModelUnsupportedError }; --//# sourceMappingURL=runtime.js.map+//# sourceMappingURL=runtime.js.map +-//# sourceMappingURL=runtime.js.map +\ No newline at end of file ++//# sourceMappingURL=runtime.js.map diff --git a/dist/session-options-DwRDODlr.d.ts b/dist/session-options-DwRDODlr.d.ts +index c3da16452..5ccc8dda1 100644 --- a/dist/session-options-DwRDODlr.d.ts +++ b/dist/session-options-DwRDODlr.d.ts @@ -1,4 +1,5 @@ @@ -928,7 +937,7 @@ diff --git a/dist/session-options-DwRDODlr.d.ts b/dist/session-options-DwRDODlr. //#region src/prompt-content.d.ts type PromptInput = ContentBlock[]; //#endregion -@@ -27,6 +28,8 @@ +@@ -27,6 +28,8 @@ type AcpElicitationContext = { requestId: JsonRpcId; /** Aborts with the request itself or its owning prompt turn/session. */ signal: AbortSignal; @@ -937,7 +946,7 @@ diff --git a/dist/session-options-DwRDODlr.d.ts b/dist/session-options-DwRDODlr. }; type AcpElicitationResponseMeta = { _meta?: Record | null; -@@ -116,6 +119,35 @@ +@@ -116,6 +119,35 @@ type AcpClientOptions = { }; env?: Record; }; @@ -973,7 +982,7 @@ diff --git a/dist/session-options-DwRDODlr.d.ts b/dist/session-options-DwRDODlr. onAcpMessage?: (direction: AcpMessageDirection, message: AcpJsonRpcMessage) => void; onAcpOutputMessage?: (direction: AcpMessageDirection, message: AcpJsonRpcMessage) => void; onSessionUpdate?: (notification: SessionNotification) => void; -@@ -123,6 +155,8 @@ +@@ -123,6 +155,8 @@ type AcpClientOptions = { onPermissionEscalation?: (event: PermissionEscalationEvent) => void; onPermissionRequest?: (req: AcpPermissionRequest, ctx: { signal: AbortSignal; @@ -982,7 +991,7 @@ diff --git a/dist/session-options-DwRDODlr.d.ts b/dist/session-options-DwRDODlr. }) => Promise; }; declare const SESSION_RECORD_SCHEMA: "acpx.session.v1"; -@@ -263,12 +297,15 @@ +@@ -263,12 +297,15 @@ type SessionRecord = { lastAgentDisconnectReason?: string; protocolVersion?: number; agentCapabilities?: AgentCapabilities; @@ -999,8 +1008,10 @@ diff --git a/dist/session-options-DwRDODlr.d.ts b/dist/session-options-DwRDODlr. acpx?: SessionAcpxState; importedFrom?: SessionImportedFrom; }; -@@ -295,4 +332,4 @@ +@@ -295,4 +332,4 @@ type SessionAgentOptions = { }; //#endregion export { SessionRecord as _, AcpElicitationHandler as a, AcpElicitationResponse as c, AuthPolicy as d, McpServer$1 as f, PermissionStats as g, PermissionPolicy as h, AcpElicitationContext as i, AcpPermissionDecision as l, PermissionMode as m, SystemPromptOption as n, AcpElicitationMode as o, NonInteractivePermissionPolicy as p, AcpClientOptions as r, AcpElicitationRequest as s, SessionAgentOptions as t, AcpPermissionRequest as u, PromptInput as v }; --//# sourceMappingURL=session-options-DwRDODlr.d.ts.map+//# sourceMappingURL=session-options-DwRDODlr.d.ts.map +-//# sourceMappingURL=session-options-DwRDODlr.d.ts.map +\ No newline at end of file ++//# sourceMappingURL=session-options-DwRDODlr.d.ts.map From 9d4f9fbe8a4aa69b06a8b5a630125cd9f12a0155 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 15:03:32 -0500 Subject: [PATCH 18/31] Retain merged Cursor pack and daemon qualification provenance Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 10 ++++++---- .../provider-pack-darwin-arm64.json | 20 ++++++++++++------- .../provider-pack-offline-proof.json | 8 ++++---- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index f394a812c32..f2a914cff10 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -84,18 +84,20 @@ Three real ACP stream tests prove child lifecycle/transcript preservation before ## Integrated pack and offline launch evidence -The full `build-provider-pack.mjs --candidate-providers=cursor` path passed on source `01959b8a602683f13706807983f02c3cba9d36a0` (foundation includes upstream master `14795136f56c11ed83dc754791945bb5a0b8f7fd`). It used standalone Node, pnpm 9.15.4, a fresh production deployment and the pinned vendor archive. The build checked portable Node relocation, fresh ACPX import and complete Cursor materialization. The retained manifest is `packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json`; it contains only relative paths and digests. +The full `build-provider-pack.mjs --candidate-providers=cursor` path passed on source `19ac45c4fd87b8b9f28507b3ecd57803da3f7c73` (foundation includes upstream master `992f7202628543749236b5a59af4dbbe7c155cce`). It used standalone Node, pnpm 9.15.4, a fresh production deployment and the pinned vendor archive. The build checked portable Node relocation, fresh ACPX import and complete Cursor materialization. The retained manifest is `packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json`; it contains only relative paths and digests. -- Pack digest: `sha256:f0b622e9151c1c0886e6220c48ea71993b65887baa88b1600b27462074748ddb`. +- Pack digest: `sha256:f9b1869c3d6822981518a4acfa5ffd0d8623ac555034754d92e57dabd56feadb`. - Cursor declaration: `sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899`. - macOS ARM64 closure: `sha256:77394184a89b0e7384971181da19c3c82d83a399b04e7944b3f94fe3d7e62b25`. -- Resolved dependency lock: `sha256:ec689ad9c31aa2004c7c2c39889764d55897ac2e6d899c8f059d9c23b082c2c8`, also the reviewed Daytona build digest for this branch. This digest was resolved from the clean tracked lock with the exact Docker resolution-only command. The frozen install retained it. Image creation rejects a different digest before execution. +- Resolved dependency lock: `sha256:a9f7b2839491612675e9ec543143848e8b01343cbf8456098b3e9f4d7394eed1`, also the reviewed Daytona build digest for this branch. This digest was resolved from the clean tracked lock with the exact Docker resolution-only command. A second resolution from the clean tracked lock produced the identical digest; the frozen install applied the Cursor/Grok combined patch successfully. The image consumes the reviewed resolved-lock artifact without registry resolution. Image creation rejects a different digest before execution. `provider-pack-offline-proof.json` records a real launch through the generic profile installation registry from the pack’s verified native closure and retained snapshot, using private directories and no credentials. ACP v1 initialize succeeds. The correct `cursor/list_available_models`, `session/list` and `session/new` methods return authentication-required; `session/fork` and `session/resume` return method-not-found. The process produced no stderr, was explicitly terminated after these probes, and its lease closed. The earlier discovery fixture’s `_cursor/list_available_models` probe used an incorrect method prefix; this later probe corrects that uncertainty without changing the original evidence. At the prior foundation checkpoint `7721662f2`, the TypeScript/verified-sidecar build and all 177 targeted cases passed: Cursor normalization/policy/artifacts, credential bindings, the durable launcher's actual process specification, candidate backend admission, and sidecar behavior. The actual process-launch regressions verify explicit candidate credentials and their marker survive the final closed allowlist; ambient credentials and caller-supplied markers cannot select themselves. The prior source `f09a9a3f8` passed all 47 CI jobs after one retry for runner shutdown and a wall-clock rate-limit case, plus Greptile 5/5; it also passed 29 installed ACPX/materializer Node cases and 6 Daytona image-content cases. These prior results remain historical, distinct from the final source proof. -The current pack/probe binds foundation `a589381f9`, including candidate admission, biller attribution, explicit unavailable usage, actual-spawn credential binding, and preservation of usage receipts on terminal provider failure. The verified TypeScript build, 56 Cursor/sidecar/eval-provider tests, 67 shared live/eval tests, and 25 mixed-usage contract tests passed during these qualification fixes. Earlier pack evidence remains in Git history. Its explicit offline factory model sentinel is not an authenticated model selection; no ACP prompt was sent. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. That offline probe submitted no prompts and incurred no model usage. Subsequent authenticated attempts are recorded separately below. +The current pack/probe binds foundation `c3b7e9ecd`, including candidate admission, biller attribution, explicit unavailable usage, actual-spawn credential binding, and preservation of usage receipts on terminal provider failure. The verified TypeScript build, 56 Cursor/sidecar/eval-provider tests, 67 shared live/eval tests, and 25 mixed-usage contract tests passed during these qualification fixes. Earlier pack evidence remains in Git history. Its explicit offline factory model sentinel is not an authenticated model selection; no ACP prompt was sent. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. That offline probe submitted no prompts and incurred no model usage. Subsequent authenticated attempts are recorded separately below. + +The merged-source pack passed 29 installed-package/materializer contract tests and 17 Cursor profile tests. Its generic installation registry probe again initialized the pinned native executable without credentials or prompts, then shut down cleanly. A fresh release daemon was built from source `527ac0e31f45a613cba1f65c25b01547f176736d`, Rust tree `8a7155529bf3d4c26947fdc4642badd6fbe96232` (identical to foundation `c3b7e9ecd`), SHA256 `dadafb10a6a02f2046798ae4104edc481d205e65724e0526a7f34ba50eb746d0`. Earlier successful paid attempts retain their original sources and daemon digests. ## Authenticated discovery evidence diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json index e02faf48b2b..9e22625b539 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json @@ -1,12 +1,13 @@ { "schema": "paperclip-runner/remote-provider-pack/v1", - "digest": "sha256:f0b622e9151c1c0886e6220c48ea71993b65887baa88b1600b27462074748ddb", + "digest": "sha256:f9b1869c3d6822981518a4acfa5ffd0d8623ac555034754d92e57dabd56feadb", "payload": { "pins": { "nodeMinimum": "24.11.0", "codex": "0.156.0", "opencode": "1.18.32", "acpx": "0.13.1", + "grok": "1.0.13", "claudeAcp": "0.73.0", "codexAcp": "1.6.2" }, @@ -14,10 +15,11 @@ "platform": "darwin", "architecture": "arm64" }, - "runnerSourceRevision": "01959b8a602683f13706807983f02c3cba9d36a0", - "distDigest": "sha256:6ac11b85a406f041e13a9896362cd78ebea5e9edef97527bffb7a8360f6a10bb", - "bridgeDigest": "sha256:e444f448c6fe3c7e0246dc0cc1dcb98c2f735479ba5576f9a9bbb7a3137061c1", + "runnerSourceRevision": "19ac45c4fd87b8b9f28507b3ecd57803da3f7c73", + "distDigest": "sha256:b381359f0b80cc15f437f8d98c616c2f230f2ede672e4faca6e8e42a373f84d6", + "bridgeDigest": "sha256:5bf5b2c89849aaf2501c5410b3d4037bc59183516be08b9e7264e9089c0da6fa", "acpxProfileDigests": { + "grok": "sha256:f0b698395a3704ed2ffaf84ea19bdb20c36c8a0a70b7c629c7b6ffe144e59e55", "claude": "sha256:9d73d1f0f121fb96cc8badb28c22d5bff02d8582eb2e40360a81c189e1b9422a", "codex": "sha256:c4538599d1ab767db5dff50934f13bb5ba313a59d9c4a83e993fac4617ea63d3" }, @@ -32,13 +34,17 @@ } }, "artifacts": { + "grokExecutable": { + "path": "node_modules/@paperclipai/grok-acp/bin/grok", + "sha256": "sha256:8669e0fdadceec25b8c159c355f427ffbd82583525d774b6ab1522197ea83b80" + }, "nodeCommand": { "path": "node_modules/node/bin/node", "sha256": "sha256:27db838bb204ef7c21df2931f5656e4c8fb32e6e947f363a402b49714d32b5b1" }, "productionLock": { "path": "pnpm-lock.yaml", - "sha256": "sha256:ec689ad9c31aa2004c7c2c39889764d55897ac2e6d899c8f059d9c23b082c2c8" + "sha256": "sha256:a9f7b2839491612675e9ec543143848e8b01343cbf8456098b3e9f4d7394eed1" }, "opencodeCommand": { "path": "node_modules/.bin/opencode", @@ -50,11 +56,11 @@ }, "opencodeProxy": { "path": "dist/cli/opencode-app-server-proxy.cjs", - "sha256": "sha256:26c685c57e196d94cf4524b000b5c7d81a66bb11c8687a3a4944c7445af785f0" + "sha256": "sha256:c98afd501fb93b56388c0c0f673f9c815c9847ede906eb11a6f693ec56439862" }, "acpxSidecar": { "path": "dist/cli/acpx-runtime-sidecar.cjs", - "sha256": "sha256:f688c95784dc8d0422c8610251263e374e765d28d22b2f5eeeda509f6155e3e5" + "sha256": "sha256:dfc808bde4101915af8a7e5b304263862b50617cfbb5676fdf599711c2e65c66" } } } diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json index d89969c13eb..363c8497f12 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json @@ -1,8 +1,8 @@ { "schema": "paperclip-cursor-offline-pack-proof/v1", - "capturedAt": "2026-09-28T19:28:15.778Z", - "runnerSourceRevision": "01959b8a602683f13706807983f02c3cba9d36a0", - "packDigest": "sha256:f0b622e9151c1c0886e6220c48ea71993b65887baa88b1600b27462074748ddb", + "capturedAt": "2026-09-28T20:03:07.326Z", + "runnerSourceRevision": "19ac45c4fd87b8b9f28507b3ecd57803da3f7c73", + "packDigest": "sha256:f9b1869c3d6822981518a4acfa5ffd0d8623ac555034754d92e57dabd56feadb", "target": { "platform": "darwin", "architecture": "arm64" @@ -15,7 +15,7 @@ "path": "provider-assets/cursor/darwin-arm64", "sha256": "sha256:3b6de19114d4df62f648604025a0d71937dfa7c2b15b397cce5da2c5da268994" }, - "productionLock": "sha256:ec689ad9c31aa2004c7c2c39889764d55897ac2e6d899c8f059d9c23b082c2c8", + "productionLock": "sha256:a9f7b2839491612675e9ec543143848e8b01343cbf8456098b3e9f4d7394eed1", "launch": { "entrypoint": "verified bundled node + index.js", "arguments": [ From 78360fa55adff11da9f200b228467eca782b81e1 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 15:16:00 -0500 Subject: [PATCH 19/31] Record Cursor plan approval and retained restart infrastructure failure Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 10 +- .../authenticated-qualification-attempts.json | 287 ++++++++++++++++++ 2 files changed, 295 insertions(+), 2 deletions(-) diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index f2a914cff10..5c17f3bf379 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -1,6 +1,6 @@ # Cursor ACP capability inventory -Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. One authorized task-context prompt on the initial free account returned an upgrade requirement, invoked no semantic tools, and supplied no usage receipt. Its cost is unknown; the account dashboard remained unchanged at coarse precision. The user then selected another account, whose exact-model local Runner Eval passed task-context and history tools with clean terminal settlement. Its dashboard attributed 56K rounded tokens to included usage and no incremental charge; ACP still supplied no token or dollar receipt. The local Product hello subsequently passed through the real browser, server, database, native runner, and authenticated completion tool. A second local Product case passed file creation, editing, command validation, an independent exact-byte matcher, and visible workspace artifact presentation. Native interactions, restrictive permissions, recovery, and Daytona execution remain required qualification gates. +Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. One authorized task-context prompt on the initial free account returned an upgrade requirement, invoked no semantic tools, and supplied no usage receipt. Its cost is unknown; the account dashboard remained unchanged at coarse precision. The user then selected another account, whose exact-model local Runner Eval passed task-context and history tools with clean terminal settlement. Its dashboard attributed 56K rounded tokens to included usage and no incremental charge; ACP still supplied no token or dollar receipt. The local Product hello subsequently passed through the real browser, server, database, native runner, and authenticated completion tool. A second local Product case passed file creation, editing, command validation, an independent exact-byte matcher, and visible workspace artifact presentation. The merged-source local Product question and revision-bound Plan approval also passed browser response and semantic-tool continuation. Native Cursor interactions, restrictive permissions, restart recovery, and Daytona execution remain required qualification gates. The reference is the runner's Codex app-server integration and its closed thread-item inventory in `src/provider-events.ts`. Cursor ACP and its private extension methods are the transport; the legacy Cursor adapter is unchanged. @@ -119,6 +119,12 @@ The local Product hello first stopped at agent creation with HTTP 422 before any The local file-edit Product case passed at source `fe132224c2b30a8d9ce7b46cea38b8760af233fc`, from 19:44:43.582 to 19:45:24.406 UTC. All seven matchers passed, including an independent exact-byte read of the 24-byte final file. A native shell command created then rewrote the file and asserted the expected bytes; tool lifecycle and output were retained. The inspected browser screenshot shows the file, a downloadable workspace artifact card, edited-file activity, the completion marker, and Done. Cleanup passed. This is workspace artifact discovery and presentation evidence, not provider-reported diff projection. The account Usage page attributes a 19:44:59 UTC Luna row with 84.1K tokens, Included in Pro Plus, and zero incremental cash. Metered dollars remain unknown; the conservative list-price bound is $0.102, not an invoice. The trace also confirms a meaningful remaining field gap: native command `rawOutput.exitCode:0` survives in serialized output, while canonical `exitCode` remains null; extracting only validated command results is a P2 follow-up. +The merged-source local question Product case passed at `a7e01a0cec397dd5048f5d5b5825658dc6e91450`, from 20:04:44.147 to 20:05:52.691 UTC. Its two expected provider runs submitted at 20:05:00.738 and 20:05:30.525 UTC, with no retry. The real `request_human_input` semantic tool produced a pending single-choice question, the browser selected Cobalt through the public response endpoint, the answered interaction woke the assignee, and the task completed with one final marker. Both pending and final screenshots were inspected; all six terminal matchers, lifecycle invariants, and cleanup passed. Bounds were 120 seconds per turn, 300 seconds overall, and a $2 reservation. Native usage is unavailable. The dashboard attributes Included Luna rows at 20:05:01 UTC (35.5K tokens) and 20:05:35 UTC (42K tokens), with zero incremental cash; metered dollars remain unavailable. A conservative $0.10 list-price allowance is not an invoice. This is semantic interaction and continuation evidence, explicitly not qualification of native `cursor/ask_question`, server restart recovery, or plan decisions. + +The local Product Plan case also passed on the same frozen source `a7e01a0cec`: 20:09:56.429–20:10:49.114 UTC, two expected turns, six passing terminal matchers and no invariant failures. The inspected UI displayed the complete two-step Plan at revision 1. The pending confirmation's `target.revisionId` exactly equaled the displayed document's `latestRevisionId`; it was accepted before continuation and successful completion. Both account Usage rows (48.5K and 43.7K) were Included with zero incremental cash; native metered dollars remain unavailable. This covers semantic `write_document` plus `request_human_input` confirmation, not native `cursor/create_plan`. + +The subsequent server-restart case is **not qualified**. Its first launcher attempt failed before any provider call because the task's temporary Unix socket path exceeded the macOS limit; the zero-prompt failure remains recorded. An explicitly authorized infrastructure replacement used a short canonical private path and produced the required pending question. During the requested restart, embedded PostgreSQL failed `semget` because the host semaphore limit was exhausted. No answer or continuation occurred. The original result remains failed (`transient_infrastructure`), including failed API cleanup verification; a separate process inspection found no surviving task-owned server, PostgreSQL, runner, or provider process. Billing for that one completed question turn is pending dashboard reconciliation. No additional Product attempt was made. + The first attempt also exposed the shared live-eval layer's rejection of missing usage. The foundation now retains explicit unavailable-usage records for diagnostic candidates, leaves the numeric receipt ledger empty, preserves the response for grading, and keeps unknown aggregate costs unknown across mixed turns. This fix does not retroactively turn the retained failed attempt into a pass. [Cursor's Grok Bot billing documentation](https://cursor.com/help/grok-bot/plans) says linking SuperGrok grants Grok Bot usage while leaving the Cursor plan unchanged. [Cursor's pricing page](https://cursor.com/pricing) lists Composer for free Hobby and frontier models for paid plans. These documents and model-list presence do not establish entitlement for a particular CLI prompt. The operator selected a replacement Pro+ account; its exact Luna configuration was echoed successfully, with no automatic model substitution. @@ -141,4 +147,4 @@ This source audit follows pinned native update → ACPX runtime → `canonicalPr | Task numeric `durationMs`, optional accepted `planUri` | Native task/plan extensions | Duration is visible in summary; no numeric delegation field. No plan URI is returned because no plan artifact is registered | P2: typed duration; only return an actually registered plan URI | | Session list, model parameters, generic mode control | Confirmed native ACP methods | No operator UI or cross-session discovery API in this integration; recovery loads only the runner-owned exact session | P2: explicit company-scoped controls; authenticated model catalog first | -True steering, native queueing, fork/resume, native usage receipts and interactive child questions are absent from this pinned ACP implementation as described above. Their absence is distinct from the implemented-but-unused fields in this table. Remote team hooks, actual artifact traces, authenticated terminal settlement and Linux/Daytona behavior remain unverified, not confirmed absent. +True steering, native queueing, fork/resume, native usage receipts and interactive child questions are absent from this pinned ACP implementation as described above. Their absence is distinct from the implemented-but-unused fields in this table. Remote team hooks, provider-native artifact traces, interruption settlement and Linux/Daytona behavior remain unverified, not confirmed absent. diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json index 13e84bfeb07..86a40782449 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json @@ -342,6 +342,293 @@ "conservativeListCostUpperBoundUsd": 0.102, "listCostBoundBasis": "Rounded dashboard token count bounded conservatively at the maximum listed $1.20 per million token rate; not a billing receipt." } + }, + { + "id": "cursor-product-question-merged-20260928", + "family": "product-e2e", + "case": "extended-harnesses.runner-acpx-cursor.local.question-resume-complete", + "runnerSourceRevision": "a7e01a0cec397dd5048f5d5b5825658dc6e91450", + "suiteDefinitionHash": "e75cb2222d2f52ec3a2a425211d195d36b95882de2cb9ed0ad93231b7c42768a", + "packSourceRevision": "19ac45c4fd87b8b9f28507b3ecd57803da3f7c73", + "providerPackDigest": "sha256:f9b1869c3d6822981518a4acfa5ffd0d8623ac555034754d92e57dabd56feadb", + "runnerdSha256": "dadafb10a6a02f2046798ae4104edc481d205e65724e0526a7f34ba50eb746d0", + "runnerdSourceRevision": "527ac0e31f45a613cba1f65c25b01547f176736d", + "requestedModel": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "startedAt": "2026-09-28T20:04:44.147Z", + "finishedAt": "2026-09-28T20:05:52.691Z", + "durationMs": 68544, + "providerSubmittedAt": [ + "2026-09-28T20:05:00.738Z", + "2026-09-28T20:05:30.525Z" + ], + "providerTimeoutSec": 120, + "outerTimeoutSec": 300, + "result": "passed", + "automaticRetries": 0, + "submittedPrompts": 2, + "providerRuns": 2, + "matchers": [ + { + "kind": "message_exact", + "passed": true + }, + { + "kind": "message_occurrences", + "passed": true + }, + { + "kind": "issue_status", + "passed": true + }, + { + "kind": "run_status", + "passed": true + }, + { + "kind": "runtime_mode", + "passed": true + }, + { + "kind": "environment", + "passed": true + } + ], + "invariantFailures": [], + "taskStatus": "done", + "cleanup": "passed", + "resultSha256": "957fac7017a0059bbd222afa7e14b080fdea2e1c2409af5a6f0d852191ba7691", + "screenshots": [ + { + "id": "question-pending", + "sha256": "6ac5022e20d275b1746a3b038dcf3949653f053523fccb395163b1cbc1766713", + "visuallyInspected": true + }, + { + "id": "final-state", + "sha256": "2dc98776e6178c8f8a494ebb4bb66938fbfee2a41aa43b67e053b0bd8838fdc1", + "visuallyInspected": true + } + ], + "questionEvidence": { + "origin": "Paperclip request_human_input semantic tool", + "kind": "ask_user_questions", + "selectionMode": "single", + "pendingBeforeAnswer": true, + "requestedAt": "2026-09-28T20:05:10.459Z", + "resolvedAt": "2026-09-28T20:05:16.215Z", + "answer": "Cobalt", + "finalStatus": "answered", + "serverRestartedBeforeAnswer": false, + "continuationRunObserved": true, + "nativeCursorExtensionQualified": false + }, + "usage": { + "nativeReceipt": null, + "tokenUsage": null, + "costUsd": null, + "coverage": "provider usage unavailable; two dashboard rows attributed" + }, + "scope": "Real local browser question, answer, wake-assignee continuation and completion. Does not qualify cursor/ask_question native RPC, native plan decisions, restrictive permissions, restart recovery, or Daytona.", + "billing": { + "source": "parent-observed account Usage rows after bounded case", + "requests": [ + { + "at": "2026-09-28T20:05:01Z", + "tokensDisplay": "35.5K" + }, + { + "at": "2026-09-28T20:05:35Z", + "tokensDisplay": "42K" + } + ], + "modelLabel": "gpt-5.6-luna-medium", + "usageType": "Included in Pro Plus", + "incrementalCashChargeUsd": 0, + "meteredCostUsd": null, + "conservativeListCostUpperBoundUsd": 0.1, + "listCostBoundBasis": "Rounded display total bounded at80,000 tokens, maximum listed $1.20/M, rounded upward; not a billing receipt." + } + }, + { + "id": "cursor-product-plan-merged-20260928", + "family": "product-e2e", + "case": "extended-harnesses.runner-acpx-cursor.local.plan-approve-complete", + "runnerSourceRevision": "a7e01a0cec397dd5048f5d5b5825658dc6e91450", + "suiteDefinitionHash": "e75cb2222d2f52ec3a2a425211d195d36b95882de2cb9ed0ad93231b7c42768a", + "packSourceRevision": "19ac45c4fd87b8b9f28507b3ecd57803da3f7c73", + "providerPackDigest": "sha256:f9b1869c3d6822981518a4acfa5ffd0d8623ac555034754d92e57dabd56feadb", + "runnerdSha256": "dadafb10a6a02f2046798ae4104edc481d205e65724e0526a7f34ba50eb746d0", + "runnerdSourceRevision": "527ac0e31f45a613cba1f65c25b01547f176736d", + "requestedModel": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "startedAt": "2026-09-28T20:09:56.429Z", + "finishedAt": "2026-09-28T20:10:49.114Z", + "durationMs": 52685, + "providerSubmittedAt": [ + "2026-09-28T20:10:09.422Z", + "2026-09-28T20:10:33.832Z" + ], + "providerTimeoutSec": 120, + "outerTimeoutSec": 300, + "result": "passed", + "automaticRetries": 0, + "submittedPrompts": 2, + "providerRuns": 2, + "matchers": [ + { + "kind": "message_exact", + "passed": true + }, + { + "kind": "message_occurrences", + "passed": true + }, + { + "kind": "issue_status", + "passed": true + }, + { + "kind": "run_status", + "passed": true + }, + { + "kind": "runtime_mode", + "passed": true + }, + { + "kind": "environment", + "passed": true + } + ], + "invariantFailures": [], + "taskStatus": "done", + "cleanup": "passed", + "resultSha256": "3bfa8d5f62ae827e73bc0aabb496f8aefdf55338ada76985b9222485d4fd58d2", + "screenshots": [ + { + "id": "plan-pending", + "sha256": "ef025fedfe201da0e2a8e31f8fdd2b14d9d9e4248e2c5f2a310410915e5ea98c", + "visuallyInspected": true + }, + { + "id": "final-state", + "sha256": "bd7ad23c19903a4df63482a1b89642093fc74526fdae3331416986f5a0cd370f", + "visuallyInspected": true + } + ], + "usage": { + "nativeReceipt": null, + "tokenUsage": null, + "costUsd": null, + "coverage": "provider usage unavailable; two dashboard rows attributed" + }, + "scope": "Real local browser Plan display, exact-revision approval, wake-assignee continuation and completion. Does not qualify cursor/create_plan native RPC, restrictive permissions, restart recovery, or Daytona.", + "planEvidence": { + "origin": "Paperclip write_document and request_human_input semantic tools", + "kind": "request_confirmation", + "revisionNumber": 1, + "pendingBeforeApproval": true, + "requestedAt": "2026-09-28T20:10:21.718Z", + "resolvedAt": "2026-09-28T20:10:25.286Z", + "finalStatus": "accepted", + "confirmationTargetsDisplayedRevision": true, + "continuationRunObserved": true, + "nativeCursorExtensionQualified": false + }, + "billing": { + "source": "parent-observed account Usage rows after bounded case", + "requests": [ + { + "at": "2026-09-28T20:10:09Z", + "tokensDisplay": "48.5K" + }, + { + "at": "2026-09-28T20:10:34Z", + "tokensDisplay": "43.7K" + } + ], + "modelLabel": "gpt-5.6-luna-medium", + "usageType": "Included in Pro Plus", + "incrementalCashChargeUsd": 0, + "meteredCostUsd": null, + "conservativeListCostUpperBoundUsd": 0.114, + "listCostBoundBasis": "Rounded display total bounded at 95,000 tokens at the maximum listed $1.20/M; not a billing receipt." + } + }, + { + "id": "cursor-product-question-restart-merged-20260928", + "family": "product-e2e", + "case": "extended-harnesses.runner-acpx-cursor.local.structured-question-restart-resume", + "runnerSourceRevision": "a7e01a0cec397dd5048f5d5b5825658dc6e91450", + "requestedModel": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "startedAt": "2026-09-28T20:12:21.993813+00:00", + "finishedAt": "2026-09-28T20:12:22.080838+00:00", + "result": "failed_before_harness_start", + "failureClass": "local_launcher_infrastructure", + "errorCode": "tsx_ipc_socket_path_einval", + "submittedPrompts": 0, + "providerRuns": 0, + "automaticRetries": 0, + "processCleanupVerified": true, + "billing": { + "incrementalCashChargeUsd": 0, + "evidence": "tsx failed to bind startup Unix socket before loading Product harness; no provider process or prompt." + }, + "scope": "Task-owned temporary Unix socket path exceeded macOS length limit; no model or product behavior was measured." + }, + { + "id": "cursor-restart-20260928", + "family": "product-e2e", + "case": "extended-harnesses.runner-acpx-cursor.local.structured-question-restart-resume", + "runnerSourceRevision": "a7e01a0cec397dd5048f5d5b5825658dc6e91450", + "suiteDefinitionHash": "e75cb2222d2f52ec3a2a425211d195d36b95882de2cb9ed0ad93231b7c42768a", + "packSourceRevision": "19ac45c4fd87b8b9f28507b3ecd57803da3f7c73", + "providerPackDigest": "sha256:f9b1869c3d6822981518a4acfa5ffd0d8623ac555034754d92e57dabd56feadb", + "runnerdSha256": "dadafb10a6a02f2046798ae4104edc481d205e65724e0526a7f34ba50eb746d0", + "requestedModel": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "startedAt": "2026-09-28T20:13:24.214Z", + "finishedAt": "2026-09-28T20:14:00.389Z", + "durationMs": 36175, + "result": "failed", + "failureClass": "transient_infrastructure", + "errorCode": "embedded_postgres_semaphore_exhaustion", + "automaticRetries": 0, + "authorizedInfrastructureRetryOf": "cursor-product-question-restart-merged-20260928", + "providerTimeoutSec": 120, + "outerTimeoutSec": 300, + "submittedPrompts": 1, + "providerRuns": 1, + "promptCountEvidence": "Pending question screenshot and graceful shutdown with no interrupted active runs; replacement server failed before an answer or continuation. Post-failure API snapshot could not recover exact submission time.", + "cleanup": "failed", + "processCleanupVerifiedSeparately": true, + "cleanupEvidence": "Original cleanup API check failed because server was down; subsequent task-path process inspection and replacement PostgreSQL PID check found no surviving owned processes.", + "resultSha256": "c74c3f5e96ffc7940d7d87ca05b7ff77d7cf9912a87ec340c9db38e19a06fcfd", + "screenshots": [ + { + "id": "question-pending", + "sha256": "f575e57fc975175d7122893f3bf1110195b0dd2a68b82c5101838177932dd8d7", + "visuallyInspected": true + } + ], + "questionEvidence": { + "origin": "Paperclip request_human_input semantic tool", + "pendingQuestionVisible": true, + "options": [ + "Cobalt", + "Amber" + ], + "serverRestartRequested": true, + "replacementServerStarted": false, + "answered": false, + "continuationRunObserved": false, + "nativeCursorExtensionQualified": false + }, + "usage": { + "nativeReceipt": null, + "tokenUsage": null, + "costUsd": null, + "coverage": "provider usage unavailable; dashboard reconciliation pending" + }, + "scope": "Infrastructure failure after one completed pending-question turn; does not qualify server-restart recovery. Original failed cleanup and evidence retained." } ], "newAccountDiscovery": { From 25fb1b5b317e52a8ad50208d7681a1ee34bd939c Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 15:17:33 -0500 Subject: [PATCH 20/31] Pin final Cursor lock graph and reconcile bounded product usage Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 2 +- docker/daytona-runner/Dockerfile | 2 +- .../authenticated-qualification-attempts.json | 19 +++++++++++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index 5c17f3bf379..cf8df515de2 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -123,7 +123,7 @@ The merged-source local question Product case passed at `a7e01a0cec397dd5048f5d5 The local Product Plan case also passed on the same frozen source `a7e01a0cec`: 20:09:56.429–20:10:49.114 UTC, two expected turns, six passing terminal matchers and no invariant failures. The inspected UI displayed the complete two-step Plan at revision 1. The pending confirmation's `target.revisionId` exactly equaled the displayed document's `latestRevisionId`; it was accepted before continuation and successful completion. Both account Usage rows (48.5K and 43.7K) were Included with zero incremental cash; native metered dollars remain unavailable. This covers semantic `write_document` plus `request_human_input` confirmation, not native `cursor/create_plan`. -The subsequent server-restart case is **not qualified**. Its first launcher attempt failed before any provider call because the task's temporary Unix socket path exceeded the macOS limit; the zero-prompt failure remains recorded. An explicitly authorized infrastructure replacement used a short canonical private path and produced the required pending question. During the requested restart, embedded PostgreSQL failed `semget` because the host semaphore limit was exhausted. No answer or continuation occurred. The original result remains failed (`transient_infrastructure`), including failed API cleanup verification; a separate process inspection found no surviving task-owned server, PostgreSQL, runner, or provider process. Billing for that one completed question turn is pending dashboard reconciliation. No additional Product attempt was made. +The subsequent server-restart case is **not qualified**. Its first launcher attempt failed before any provider call because the task's temporary Unix socket path exceeded the macOS limit; the zero-prompt failure remains recorded. An explicitly authorized infrastructure replacement used a short canonical private path and produced the required pending question. During the requested restart, embedded PostgreSQL failed `semget` because the host semaphore limit was exhausted. No answer or continuation occurred. The original result remains failed (`transient_infrastructure`), including failed API cleanup verification; a separate process inspection found no surviving task-owned server, PostgreSQL, runner, or provider process. The dashboard attributes one 20:13:38 UTC Luna row with 23.7K tokens, Included in Pro Plus, zero incremental cash, and no continuation row; native metered dollars remain unavailable. Exact submission time was not recoverable from the post-failure API snapshot, so attribution uses the retained case window. No additional Product attempt was made. The first attempt also exposed the shared live-eval layer's rejection of missing usage. The foundation now retains explicit unavailable-usage records for diagnostic candidates, leaves the numeric receipt ledger empty, preserves the response for grading, and keeps unknown aggregate costs unknown across mixed turns. This fix does not retroactively turn the retained failed attempt into a pass. diff --git a/docker/daytona-runner/Dockerfile b/docker/daytona-runner/Dockerfile index 7d573c60485..7fc23797c12 100644 --- a/docker/daytona-runner/Dockerfile +++ b/docker/daytona-runner/Dockerfile @@ -28,7 +28,7 @@ COPY cli/package.json ./cli/package.json # The complete resolved lock (including transitive integrity hashes) is reviewed. # Reject registry-time drift BEFORE installing packages or running lifecycle code. # Refresh this digest together with source/provider dependency changes. -ARG PAPERCLIP_RUNNER_LOCK_SHA256=a9f7b2839491612675e9ec543143848e8b01343cbf8456098b3e9f4d7394eed1 +ARG PAPERCLIP_RUNNER_LOCK_SHA256=9eea60187c6c808efb4d936a234a8d8000beac45253091abd4c5348132bd1408 RUN printf '%s pnpm-lock.yaml\n' "${PAPERCLIP_RUNNER_LOCK_SHA256}" > /tmp/provider-lock.sha256 \ && sha256sum -c /tmp/provider-lock.sha256 \ && pnpm install --frozen-lockfile --filter '@paperclipai/paperclip-runner...' diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json index 86a40782449..5e39e4ea9ef 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json @@ -626,9 +626,24 @@ "nativeReceipt": null, "tokenUsage": null, "costUsd": null, - "coverage": "provider usage unavailable; dashboard reconciliation pending" + "coverage": "provider usage unavailable; one dashboard row attributed" }, - "scope": "Infrastructure failure after one completed pending-question turn; does not qualify server-restart recovery. Original failed cleanup and evidence retained." + "scope": "Infrastructure failure after one completed pending-question turn; does not qualify server-restart recovery. Original failed cleanup and evidence retained.", + "billing": { + "source": "parent-observed account Usage row within retained attempt time window", + "requests": [ + { + "at": "2026-09-28T20:13:38Z", + "tokensDisplay": "23.7K" + } + ], + "modelLabel": "gpt-5.6-luna-medium", + "usageType": "Included in Pro Plus", + "incrementalCashChargeUsd": 0, + "meteredCostUsd": null, + "conservativeListCostUpperBoundUsd": 0.03, + "listCostBoundBasis": "At most 25,000 rounded-display tokens at maximum listed $1.20/M; not a billing receipt." + } } ], "newAccountDiscovery": { From d9321659d4763920c202c7d760cf131598f2b245 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 15:19:19 -0500 Subject: [PATCH 21/31] Refresh Cursor packaged launch proof after shared integration Co-Authored-By: Paperclip --- doc/architecture/runner-cursor-capabilities.md | 10 +++++----- .../cursor-acp/provider-pack-darwin-arm64.json | 18 +++++++++--------- .../provider-pack-offline-proof.json | 8 ++++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index cf8df515de2..ca752857255 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -84,20 +84,20 @@ Three real ACP stream tests prove child lifecycle/transcript preservation before ## Integrated pack and offline launch evidence -The full `build-provider-pack.mjs --candidate-providers=cursor` path passed on source `19ac45c4fd87b8b9f28507b3ecd57803da3f7c73` (foundation includes upstream master `992f7202628543749236b5a59af4dbbe7c155cce`). It used standalone Node, pnpm 9.15.4, a fresh production deployment and the pinned vendor archive. The build checked portable Node relocation, fresh ACPX import and complete Cursor materialization. The retained manifest is `packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json`; it contains only relative paths and digests. +The full `build-provider-pack.mjs --candidate-providers=cursor` path passed on source `25fb1b5b317e52a8ad50208d7681a1ee34bd939c` (foundation includes upstream master `18e8c121d`). It used standalone Node, pnpm 9.15.4, a fresh production deployment and the pinned vendor archive. The build checked portable Node relocation, fresh ACPX import and complete Cursor materialization. The retained manifest is `packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json`; it contains only relative paths and digests. -- Pack digest: `sha256:f9b1869c3d6822981518a4acfa5ffd0d8623ac555034754d92e57dabd56feadb`. +- Pack digest: `sha256:38bc6dd39c13b0f5478a1018e26deb61b0333ab0242f3d857e3c79d3a34b7682`. - Cursor declaration: `sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899`. - macOS ARM64 closure: `sha256:77394184a89b0e7384971181da19c3c82d83a399b04e7944b3f94fe3d7e62b25`. -- Resolved dependency lock: `sha256:a9f7b2839491612675e9ec543143848e8b01343cbf8456098b3e9f4d7394eed1`, also the reviewed Daytona build digest for this branch. This digest was resolved from the clean tracked lock with the exact Docker resolution-only command. A second resolution from the clean tracked lock produced the identical digest; the frozen install applied the Cursor/Grok combined patch successfully. The image consumes the reviewed resolved-lock artifact without registry resolution. Image creation rejects a different digest before execution. +- Resolved dependency lock: `sha256:9eea60187c6c808efb4d936a234a8d8000beac45253091abd4c5348132bd1408`, also the reviewed Daytona build digest for this branch. This digest was resolved from the clean tracked lock with the exact Docker resolution-only command. A second resolution from the clean tracked lock produced the identical digest; the frozen install applied the Cursor/Grok combined patch successfully. The image consumes the reviewed resolved-lock artifact without registry resolution. Image creation rejects a different digest before execution. `provider-pack-offline-proof.json` records a real launch through the generic profile installation registry from the pack’s verified native closure and retained snapshot, using private directories and no credentials. ACP v1 initialize succeeds. The correct `cursor/list_available_models`, `session/list` and `session/new` methods return authentication-required; `session/fork` and `session/resume` return method-not-found. The process produced no stderr, was explicitly terminated after these probes, and its lease closed. The earlier discovery fixture’s `_cursor/list_available_models` probe used an incorrect method prefix; this later probe corrects that uncertainty without changing the original evidence. At the prior foundation checkpoint `7721662f2`, the TypeScript/verified-sidecar build and all 177 targeted cases passed: Cursor normalization/policy/artifacts, credential bindings, the durable launcher's actual process specification, candidate backend admission, and sidecar behavior. The actual process-launch regressions verify explicit candidate credentials and their marker survive the final closed allowlist; ambient credentials and caller-supplied markers cannot select themselves. The prior source `f09a9a3f8` passed all 47 CI jobs after one retry for runner shutdown and a wall-clock rate-limit case, plus Greptile 5/5; it also passed 29 installed ACPX/materializer Node cases and 6 Daytona image-content cases. These prior results remain historical, distinct from the final source proof. -The current pack/probe binds foundation `c3b7e9ecd`, including candidate admission, biller attribution, explicit unavailable usage, actual-spawn credential binding, and preservation of usage receipts on terminal provider failure. The verified TypeScript build, 56 Cursor/sidecar/eval-provider tests, 67 shared live/eval tests, and 25 mixed-usage contract tests passed during these qualification fixes. Earlier pack evidence remains in Git history. Its explicit offline factory model sentinel is not an authenticated model selection; no ACP prompt was sent. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. That offline probe submitted no prompts and incurred no model usage. Subsequent authenticated attempts are recorded separately below. +The current pack/probe binds foundation `f063fbf2b`, including candidate admission, biller attribution, explicit unavailable usage, actual-spawn credential binding, and preservation of usage receipts on terminal provider failure. The verified TypeScript build, 56 Cursor/sidecar/eval-provider tests, 67 shared live/eval tests, and 25 mixed-usage contract tests passed during these qualification fixes. Earlier pack evidence remains in Git history. Its explicit offline factory model sentinel is not an authenticated model selection; no ACP prompt was sent. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. That offline probe submitted no prompts and incurred no model usage. Subsequent authenticated attempts are recorded separately below. -The merged-source pack passed 29 installed-package/materializer contract tests and 17 Cursor profile tests. Its generic installation registry probe again initialized the pinned native executable without credentials or prompts, then shut down cleanly. A fresh release daemon was built from source `527ac0e31f45a613cba1f65c25b01547f176736d`, Rust tree `8a7155529bf3d4c26947fdc4642badd6fbe96232` (identical to foundation `c3b7e9ecd`), SHA256 `dadafb10a6a02f2046798ae4104edc481d205e65724e0526a7f34ba50eb746d0`. Earlier successful paid attempts retain their original sources and daemon digests. +The final pack passed 31 installed-package/materializer contract tests, 82 Cursor/integrity profile tests (six platform-specific skips), and 12 candidate/image-content tests. TypeScript and verified-sidecar compilation passed. Its generic installation registry probe initialized the pinned native executable without credentials or prompts, then shut down cleanly. A fresh release daemon was built from source `78360fa55adff11da9f200b228467eca782b81e1`, Rust tree `17d327094be5759d80ef5bd02e15c59e78548ea2` (identical to foundation `f063fbf2b`), SHA256 `e6a9fb5170b76a49b8411834b3706e8edf8f1a1ae85ad13b55368158aa7f67a0`. This source includes bounded snapshot copying and public Grok packaging. Earlier paid attempts retain their original sources, package identities, and daemon digests; refreshing packaging does not rerun or extend their qualification. ## Authenticated discovery evidence diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json index 9e22625b539..01f733b2468 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-darwin-arm64.json @@ -1,6 +1,6 @@ { "schema": "paperclip-runner/remote-provider-pack/v1", - "digest": "sha256:f9b1869c3d6822981518a4acfa5ffd0d8623ac555034754d92e57dabd56feadb", + "digest": "sha256:38bc6dd39c13b0f5478a1018e26deb61b0333ab0242f3d857e3c79d3a34b7682", "payload": { "pins": { "nodeMinimum": "24.11.0", @@ -15,9 +15,9 @@ "platform": "darwin", "architecture": "arm64" }, - "runnerSourceRevision": "19ac45c4fd87b8b9f28507b3ecd57803da3f7c73", - "distDigest": "sha256:b381359f0b80cc15f437f8d98c616c2f230f2ede672e4faca6e8e42a373f84d6", - "bridgeDigest": "sha256:5bf5b2c89849aaf2501c5410b3d4037bc59183516be08b9e7264e9089c0da6fa", + "runnerSourceRevision": "25fb1b5b317e52a8ad50208d7681a1ee34bd939c", + "distDigest": "sha256:b849c70826bcc0fb353b319b55e779ac9a31a2007fd358ad16f3502ea3bc9160", + "bridgeDigest": "sha256:4093de09695e15878d1614ff73bdabd95600af1e996055c3c981a7cee67486e2", "acpxProfileDigests": { "grok": "sha256:f0b698395a3704ed2ffaf84ea19bdb20c36c8a0a70b7c629c7b6ffe144e59e55", "claude": "sha256:9d73d1f0f121fb96cc8badb28c22d5bff02d8582eb2e40360a81c189e1b9422a", @@ -34,9 +34,9 @@ } }, "artifacts": { - "grokExecutable": { - "path": "node_modules/@paperclipai/grok-acp/bin/grok", - "sha256": "sha256:8669e0fdadceec25b8c159c355f427ffbd82583525d774b6ab1522197ea83b80" + "grokLauncher": { + "path": "dist/providers/grok/launcher.cjs", + "sha256": "sha256:f0b698395a3704ed2ffaf84ea19bdb20c36c8a0a70b7c629c7b6ffe144e59e55" }, "nodeCommand": { "path": "node_modules/node/bin/node", @@ -44,7 +44,7 @@ }, "productionLock": { "path": "pnpm-lock.yaml", - "sha256": "sha256:a9f7b2839491612675e9ec543143848e8b01343cbf8456098b3e9f4d7394eed1" + "sha256": "sha256:9eea60187c6c808efb4d936a234a8d8000beac45253091abd4c5348132bd1408" }, "opencodeCommand": { "path": "node_modules/.bin/opencode", @@ -60,7 +60,7 @@ }, "acpxSidecar": { "path": "dist/cli/acpx-runtime-sidecar.cjs", - "sha256": "sha256:dfc808bde4101915af8a7e5b304263862b50617cfbb5676fdf599711c2e65c66" + "sha256": "sha256:743f78a3bf8b5ba9632cbd8cd00f83d7f22dc2a5cffacbd022066bdefc67d837" } } } diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json index 363c8497f12..ab025aeb2b7 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json @@ -1,8 +1,8 @@ { "schema": "paperclip-cursor-offline-pack-proof/v1", - "capturedAt": "2026-09-28T20:03:07.326Z", - "runnerSourceRevision": "19ac45c4fd87b8b9f28507b3ecd57803da3f7c73", - "packDigest": "sha256:f9b1869c3d6822981518a4acfa5ffd0d8623ac555034754d92e57dabd56feadb", + "capturedAt": "2026-09-28T20:18:46.105Z", + "runnerSourceRevision": "25fb1b5b317e52a8ad50208d7681a1ee34bd939c", + "packDigest": "sha256:38bc6dd39c13b0f5478a1018e26deb61b0333ab0242f3d857e3c79d3a34b7682", "target": { "platform": "darwin", "architecture": "arm64" @@ -15,7 +15,7 @@ "path": "provider-assets/cursor/darwin-arm64", "sha256": "sha256:3b6de19114d4df62f648604025a0d71937dfa7c2b15b397cce5da2c5da268994" }, - "productionLock": "sha256:a9f7b2839491612675e9ec543143848e8b01343cbf8456098b3e9f4d7394eed1", + "productionLock": "sha256:9eea60187c6c808efb4d936a234a8d8000beac45253091abd4c5348132bd1408", "launch": { "entrypoint": "verified bundled node + index.js", "arguments": [ From d35b83074a018537f5475568d7410e3b1d676789 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 15:41:32 -0500 Subject: [PATCH 22/31] Retain native Cursor question availability qualification failure Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 2 + .../authenticated-qualification-attempts.json | 61 +++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index ca752857255..a1571b89774 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -125,6 +125,8 @@ The local Product Plan case also passed on the same frozen source `a7e01a0cec`: The subsequent server-restart case is **not qualified**. Its first launcher attempt failed before any provider call because the task's temporary Unix socket path exceeded the macOS limit; the zero-prompt failure remains recorded. An explicitly authorized infrastructure replacement used a short canonical private path and produced the required pending question. During the requested restart, embedded PostgreSQL failed `semget` because the host semaphore limit was exhausted. No answer or continuation occurred. The original result remains failed (`transient_infrastructure`), including failed API cleanup verification; a separate process inspection found no surviving task-owned server, PostgreSQL, runner, or provider process. The dashboard attributes one 20:13:38 UTC Luna row with 23.7K tokens, Included in Pro Plus, zero incremental cash, and no continuation row; native metered dollars remain unavailable. Exact submission time was not recoverable from the post-failure API snapshot, so attribution uses the retained case window. No additional Product attempt was made. +A separate native AskQuestion sidecar probe on final pack source `25fb1b5b317e52a8ad50208d7681a1ee34bd939c` sent one prompt at 20:39:47.990 UTC, with no Paperclip semantic tools. It requested single and multiple selection through Cursor's native question tool. The provider instead replied “The native AskQuestion tool is unavailable in this session,” emitted zero native input requests, and ended normally. The qualification oracle correctly failed; session close passed. The dashboard attributes a 20:39:48 UTC row with 17.4K tokens as Included, with zero incremental cash and unknown native metered dollars. This is observed default-mode tool unavailability, not proof of absence in every Cursor mode. The pinned source implements `session/set_mode` for agent/plan/ask and native question/plan handlers; the runner currently has no explicit mode-selection command. No native Plan prompt was attempted, and no native interaction pass is claimed. + The first attempt also exposed the shared live-eval layer's rejection of missing usage. The foundation now retains explicit unavailable-usage records for diagnostic candidates, leaves the numeric receipt ledger empty, preserves the response for grading, and keeps unknown aggregate costs unknown across mixed turns. This fix does not retroactively turn the retained failed attempt into a pass. [Cursor's Grok Bot billing documentation](https://cursor.com/help/grok-bot/plans) says linking SuperGrok grants Grok Bot usage while leaving the Cursor plan unchanged. [Cursor's pricing page](https://cursor.com/pricing) lists Composer for free Hobby and frontier models for paid plans. These documents and model-list presence do not establish entitlement for a particular CLI prompt. The operator selected a replacement Pro+ account; its exact Luna configuration was echoed successfully, with no automatic model substitution. diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json index 5e39e4ea9ef..c1f6e3f2315 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json @@ -644,6 +644,67 @@ "conservativeListCostUpperBoundUsd": 0.03, "listCostBoundBasis": "At most 25,000 rounded-display tokens at maximum listed $1.20/M; not a billing receipt." } + }, + { + "schema": "paperclip-cursor-native-question-probe/v1", + "sourceRevision": "25fb1b5b317e52a8ad50208d7681a1ee34bd939c", + "providerPackDigest": "sha256:38bc6dd39c13b0f5478a1018e26deb61b0333ab0242f3d857e3c79d3a34b7682", + "model": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "prompts": 1, + "automaticRetries": 0, + "activeDeadlineSec": 120, + "outerDeadlineSec": 180, + "reservedUsd": 2, + "declaredEnvelopeUsd": 0.5, + "expectedNativeMethod": "cursor/ask_question", + "expectedQuestions": [ + "single Cobalt/Amber", + "multi Cedar/Birch/Maple" + ], + "expectedAnswer": [ + "Cobalt", + [ + "Cedar", + "Maple" + ] + ], + "semanticTools": [], + "nativePlanProbe": "not attempted: runtime lacks explicit session/set_mode", + "scope": "actual native provider -> patched ACPX -> profile normalization -> sidecar runtime input and pipe response acknowledgement; excludes Rust durable replay and browser", + "startedAt": "2026-09-28T20:39:41.855Z", + "status": "failed", + "costUsd": null, + "promptSubmittedAt": "2026-09-28T20:39:47.990Z", + "sessionClosed": true, + "finishedAt": "2026-09-28T20:39:58.232Z", + "inputCount": 0, + "deliveryAcknowledged": false, + "duplicateResolutionRejected": false, + "terminalStatus": "completed", + "nativeUsageReceipt": null, + "id": "cursor-native-question-20260928", + "family": "native-sidecar-qualification", + "case": "cursor/ask_question-single-and-multi", + "failureClass": "provider_behavior", + "oracleFailure": "Expected one native input request; observed zero.", + "visibleProviderResponse": "The native AskQuestion tool is unavailable in this session.", + "probeSha256": "ff197923020be5b578112603980c9aebb0f1c644baffdf7c086bae52998e2c0b", + "resultSha256": "b0674dd97f36ff754875677b5b139fad8af3595455d6321600663b5df0e0775a", + "billing": { + "source": "parent-observed account Usage row within retained probe window", + "requests": [ + { + "at": "2026-09-28T20:39:48Z", + "tokensDisplay": "17.4K" + } + ], + "modelLabel": "gpt-5.6-luna-medium", + "usageType": "Included in Pro Plus", + "incrementalCashChargeUsd": 0, + "meteredCostUsd": null, + "conservativeListCostUpperBoundUsd": 0.024, + "listCostBoundBasis": "At most 20,000 rounded-display tokens at maximum listed $1.20/M; not a billing receipt." + } } ], "newAccountDiscovery": { From 829686b0c8787b3956fc813224c480d644f5742f Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 15:46:51 -0500 Subject: [PATCH 23/31] Record successful serialized Cursor question restart recovery Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 8 +- .../authenticated-qualification-attempts.json | 108 ++++++++++++++++++ 2 files changed, 113 insertions(+), 3 deletions(-) diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index a1571b89774..a6610a4eafb 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -1,6 +1,6 @@ # Cursor ACP capability inventory -Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. One authorized task-context prompt on the initial free account returned an upgrade requirement, invoked no semantic tools, and supplied no usage receipt. Its cost is unknown; the account dashboard remained unchanged at coarse precision. The user then selected another account, whose exact-model local Runner Eval passed task-context and history tools with clean terminal settlement. Its dashboard attributed 56K rounded tokens to included usage and no incremental charge; ACP still supplied no token or dollar receipt. The local Product hello subsequently passed through the real browser, server, database, native runner, and authenticated completion tool. A second local Product case passed file creation, editing, command validation, an independent exact-byte matcher, and visible workspace artifact presentation. The merged-source local Product question and revision-bound Plan approval also passed browser response and semantic-tool continuation. Native Cursor interactions, restrictive permissions, restart recovery, and Daytona execution remain required qualification gates. +Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. One authorized task-context prompt on the initial free account returned an upgrade requirement, invoked no semantic tools, and supplied no usage receipt. Its cost is unknown; the account dashboard remained unchanged at coarse precision. The user then selected another account, whose exact-model local Runner Eval passed task-context and history tools with clean terminal settlement. Its dashboard attributed 56K rounded tokens to included usage and no incremental charge; ACP still supplied no token or dollar receipt. The local Product hello subsequently passed through the real browser, server, database, native runner, and authenticated completion tool. A second local Product case passed file creation, editing, command validation, an independent exact-byte matcher, and visible workspace artifact presentation. The merged-source local Product question and revision-bound Plan approval also passed browser response and semantic-tool continuation. A serialized follow-up passed pending semantic-question recovery across a server restart. Native Cursor interactions and their recovery, restrictive permissions, interruption, and Daytona execution remain required qualification gates. The reference is the runner's Codex app-server integration and its closed thread-item inventory in `src/provider-events.ts`. Cursor ACP and its private extension methods are the transport; the legacy Cursor adapter is unchanged. @@ -123,9 +123,11 @@ The merged-source local question Product case passed at `a7e01a0cec397dd5048f5d5 The local Product Plan case also passed on the same frozen source `a7e01a0cec`: 20:09:56.429–20:10:49.114 UTC, two expected turns, six passing terminal matchers and no invariant failures. The inspected UI displayed the complete two-step Plan at revision 1. The pending confirmation's `target.revisionId` exactly equaled the displayed document's `latestRevisionId`; it was accepted before continuation and successful completion. Both account Usage rows (48.5K and 43.7K) were Included with zero incremental cash; native metered dollars remain unavailable. This covers semantic `write_document` plus `request_human_input` confirmation, not native `cursor/create_plan`. -The subsequent server-restart case is **not qualified**. Its first launcher attempt failed before any provider call because the task's temporary Unix socket path exceeded the macOS limit; the zero-prompt failure remains recorded. An explicitly authorized infrastructure replacement used a short canonical private path and produced the required pending question. During the requested restart, embedded PostgreSQL failed `semget` because the host semaphore limit was exhausted. No answer or continuation occurred. The original result remains failed (`transient_infrastructure`), including failed API cleanup verification; a separate process inspection found no surviving task-owned server, PostgreSQL, runner, or provider process. The dashboard attributes one 20:13:38 UTC Luna row with 23.7K tokens, Included in Pro Plus, zero incremental cash, and no continuation row; native metered dollars remain unavailable. Exact submission time was not recoverable from the post-failure API snapshot, so attribution uses the retained case window. No additional Product attempt was made. +The subsequent server-restart case is **not qualified**. Its first launcher attempt failed before any provider call because the task's temporary Unix socket path exceeded the macOS limit; the zero-prompt failure remains recorded. An explicitly authorized infrastructure replacement used a short canonical private path and produced the required pending question. During the requested restart, embedded PostgreSQL failed `semget` because the host semaphore limit was exhausted. No answer or continuation occurred. The original result remains failed (`transient_infrastructure`), including failed API cleanup verification; a separate process inspection found no surviving task-owned server, PostgreSQL, runner, or provider process. The dashboard attributes one 20:13:38 UTC Luna row with 23.7K tokens, Included in Pro Plus, zero incremental cash, and no continuation row; native metered dollars remain unavailable. Exact submission time was not recoverable from the post-failure API snapshot, so attribution uses the retained case window. No automatic retry was made. -A separate native AskQuestion sidecar probe on final pack source `25fb1b5b317e52a8ad50208d7681a1ee34bd939c` sent one prompt at 20:39:47.990 UTC, with no Paperclip semantic tools. It requested single and multiple selection through Cursor's native question tool. The provider instead replied “The native AskQuestion tool is unavailable in this session,” emitted zero native input requests, and ended normally. The qualification oracle correctly failed; session close passed. The dashboard attributes a 20:39:48 UTC row with 17.4K tokens as Included, with zero incremental cash and unknown native metered dollars. This is observed default-mode tool unavailability, not proof of absence in every Cursor mode. The pinned source implements `session/set_mode` for agent/plan/ask and native question/plan handlers; the runner currently has no explicit mode-selection command. No native Plan prompt was attempted, and no native interaction pass is claimed. +The explicitly authorized serialized restart retry passed on source `d35b83074a018537f5475568d7410e3b1d676789`, using the final pack and matching release daemon, from 20:42:13.120 to 20:43:10.985 UTC. All six matchers passed, no invariant failed, and cleanup passed; a separate process inspection confirmed no remaining task-owned processes. The real pending semantic question survived the server restart, was answered Cobalt through the browser, and produced one successful continuation and Done. Both screenshots were inspected. This establishes semantic interaction persistence and wake-assignee recovery, not restoration of a blocked native `cursor/ask_question` request. The dashboard attributes two Luna rows at 20:42:26 UTC (23.8K tokens) and 20:42:57 UTC (41.7K), both Included with zero incremental cash; the displayed current-account total is 458.1K across eleven requests. Native metered dollars remain unknown. Original launcher and PostgreSQL failures remain retained. + +A separate native AskQuestion sidecar probe on final pack source `25fb1b5b317e52a8ad50208d7681a1ee34bd939c` sent one prompt at 20:39:47.990 UTC, with no Paperclip semantic tools. It requested single and multiple selection through Cursor's native question tool. The provider instead replied “The native AskQuestion tool is unavailable in this session,” emitted zero native input requests, and ended normally. The qualification oracle correctly failed; session close passed. The dashboard attributes a 20:39:48 UTC row with 17.4K tokens as Included, with zero incremental cash and unknown native metered dollars. This is observed default-mode tool unavailability, not proof of absence in every Cursor mode. The pinned source implements `session/set_mode` for agent/plan/ask and native question/plan handlers; the runner currently has no explicit mode-selection command. Retained native initialization exposes modes and model settings but no native tool inventory or question/plan availability bit. The bundled `ask_question_all_modes:true` default does not prove the server-selected tool catalog. No native Plan prompt was attempted, and no native interaction pass is claimed. The first attempt also exposed the shared live-eval layer's rejection of missing usage. The foundation now retains explicit unavailable-usage records for diagnostic candidates, leaves the numeric receipt ledger empty, preserves the response for grading, and keeps unknown aggregate costs unknown across mixed turns. This fix does not retroactively turn the retained failed attempt into a pass. diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json index c1f6e3f2315..26969d0d50e 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json @@ -705,6 +705,114 @@ "conservativeListCostUpperBoundUsd": 0.024, "listCostBoundBasis": "At most 20,000 rounded-display tokens at maximum listed $1.20/M; not a billing receipt." } + }, + { + "id": "cursor-restart-final-20260928", + "family": "product-e2e", + "case": "extended-harnesses.runner-acpx-cursor.local.structured-question-restart-resume", + "runnerSourceRevision": "d35b83074a018537f5475568d7410e3b1d676789", + "suiteDefinitionHash": "e75cb2222d2f52ec3a2a425211d195d36b95882de2cb9ed0ad93231b7c42768a", + "packSourceRevision": "25fb1b5b317e52a8ad50208d7681a1ee34bd939c", + "providerPackDigest": "sha256:38bc6dd39c13b0f5478a1018e26deb61b0333ab0242f3d857e3c79d3a34b7682", + "runnerdSha256": "e6a9fb5170b76a49b8411834b3706e8edf8f1a1ae85ad13b55368158aa7f67a0", + "runnerdSourceRevision": "78360fa55adff11da9f200b228467eca782b81e1", + "requestedModel": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "startedAt": "2026-09-28T20:42:13.120Z", + "finishedAt": "2026-09-28T20:43:10.985Z", + "durationMs": 57865, + "providerSubmittedAt": [ + "2026-09-28T20:42:26.185Z", + "2026-09-28T20:42:53.642Z" + ], + "providerTimeoutSec": 120, + "outerTimeoutSec": 300, + "result": "passed", + "automaticRetries": 0, + "submittedPrompts": 2, + "providerRuns": 2, + "matchers": [ + { + "kind": "message_exact", + "passed": true + }, + { + "kind": "message_occurrences", + "passed": true + }, + { + "kind": "issue_status", + "passed": true + }, + { + "kind": "run_status", + "passed": true + }, + { + "kind": "runtime_mode", + "passed": true + }, + { + "kind": "environment", + "passed": true + } + ], + "invariantFailures": [], + "taskStatus": "done", + "cleanup": "passed", + "resultSha256": "0ca2c23dd458b35ffb7c72f6e7a1855ffc31b990124347805330a34cc365dddc", + "screenshots": [ + { + "id": "question-pending", + "sha256": "8d3d3fe7a3dfd28b5b4a950d12b2be7feb492d9c9b7112bb484f01e65f63c3a4", + "visuallyInspected": true + }, + { + "id": "final-state", + "sha256": "eeb684b5a06f23703c4a76a7c81c05b6d7f640706fd12035e996e5dda1849b21", + "visuallyInspected": true + } + ], + "questionEvidence": { + "origin": "Paperclip request_human_input semantic tool", + "kind": "ask_user_questions", + "selectionMode": "single", + "pendingBeforeAnswer": true, + "requestedAt": "2026-09-28T20:42:32.665Z", + "resolvedAt": "2026-09-28T20:42:51.140Z", + "answer": "Cobalt", + "finalStatus": "answered", + "serverRestartedBeforeAnswer": true, + "continuationRunObserved": true, + "nativeCursorExtensionQualified": false + }, + "usage": { + "nativeReceipt": null, + "tokenUsage": null, + "costUsd": null, + "coverage": "provider usage unavailable; two dashboard rows attributed" + }, + "scope": "Real local browser/server restart while a semantic question is pending, persisted answer, wake-assignee continuation and completion. Does not qualify native cursor/ask_question pending-request restoration, restrictive permissions, or Daytona.", + "authorizedInfrastructureRetryOf": "cursor-restart-20260928", + "processCleanupVerifiedSeparately": true, + "billing": { + "source": "parent-observed account Usage rows within retained retry window", + "requests": [ + { + "at": "2026-09-28T20:42:26Z", + "tokensDisplay": "23.8K" + }, + { + "at": "2026-09-28T20:42:57Z", + "tokensDisplay": "41.7K" + } + ], + "modelLabel": "gpt-5.6-luna-medium", + "usageType": "Included in Pro Plus", + "incrementalCashChargeUsd": 0, + "meteredCostUsd": null, + "conservativeListCostUpperBoundUsd": 0.084, + "listCostBoundBasis": "Rounded display total bounded at 70,000 tokens at maximum listed $1.20/M; not a billing receipt." + } } ], "newAccountDiscovery": { From cb63ccd1d0b35f9bd230eafb849cf6750661f809 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 15:51:38 -0500 Subject: [PATCH 24/31] test(runner): add bounded native Cursor denial qualification Co-Authored-By: Paperclip --- .../scripts/qualify-cursor-denial.mjs | 223 ++++++++++++++++++ .../scripts/qualify-cursor-denial.test.mjs | 36 +++ 2 files changed, 259 insertions(+) create mode 100644 packages/paperclip-runner/scripts/qualify-cursor-denial.mjs create mode 100644 packages/paperclip-runner/scripts/qualify-cursor-denial.test.mjs diff --git a/packages/paperclip-runner/scripts/qualify-cursor-denial.mjs b/packages/paperclip-runner/scripts/qualify-cursor-denial.mjs new file mode 100644 index 00000000000..323ab1d0f65 --- /dev/null +++ b/packages/paperclip-runner/scripts/qualify-cursor-denial.mjs @@ -0,0 +1,223 @@ +// One explicitly authorized real-service prompt. This probes native ACP denial, +// not Paperclip's durable approval presentation or recovery. +import assert from "node:assert/strict"; +import { createHash } from "node:crypto"; +import { appendFileSync, writeFileSync } from "node:fs"; +import { mkdir, mkdtemp, readFile, realpath } from "node:fs/promises"; +import { join } from "node:path"; +import { pathToFileURL } from "node:url"; + +export const MODEL = "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]"; +const SOURCE = "25fb1b5b317e52a8ad50208d7681a1ee34bd939c"; +const PACK = "sha256:38bc6dd39c13b0f5478a1018e26deb61b0333ab0242f3d857e3c79d3a34b7682"; +const MARKER = "qualification-marker.txt"; +const COMMAND = `printf 'MUST_NOT_EXIST' > ${MARKER}`; + +export function permissionResponse(message, activeSessionId) { + const params = message.params; + const exactSession = typeof activeSessionId === "string" && params?.sessionId === activeSessionId; + const options = Array.isArray(params?.options) ? params.options : []; + const validOptions = options.length > 0 && options.length <= 16 + && options.every(option => typeof option?.optionId === "string" && option.optionId.length > 0) + && new Set(options.map(option => option.optionId)).size === options.length; + const offered = validOptions ? options.filter(option => option.kind === "reject_once") : []; + const selected = exactSession && offered.length === 1 ? offered[0] : undefined; + const outcome = selected ? { outcome: "selected", optionId: selected.optionId } : { outcome: "cancelled" }; + return { exactSession, outcome, response: { jsonrpc: "2.0", id: message.id, result: { outcome } } }; +} + +export function evaluateDenial(evidence) { + const failures = []; + if (evidence.promptRequestsSent !== 1) failures.push("expected_exactly_one_prompt"); + if (evidence.stopReason !== "end_turn") failures.push("missing_successful_terminal"); + if (!evidence.permissions.some(permission => permission.exactSession && permission.writeAttempt + && permission.outcome.outcome === "selected" && permission.responseDelivered === true)) { + failures.push("no_observed_delivered_denial_of_write"); + } + for (const phase of ["before_launch", "terminal", "five_seconds_after_terminal", "after_process_cleanup"]) { + if (!evidence.markerSamples.some(sample => sample.phase === phase)) failures.push(`missing_marker_sample:${phase}`); + } + if (evidence.markerSamples.some(sample => sample.exists)) failures.push("denied_write_had_side_effect"); + if (!evidence.cleanupComplete || !evidence.leaseClosed) failures.push("process_cleanup_incomplete"); + if (evidence.failureCode) failures.push(evidence.failureCode); + return { passed: failures.length === 0, failures }; +} + +export async function verifyPack(packInput) { + const pack = await realpath(packInput); + const manifest = JSON.parse(await readFile(join(pack, "provider-pack.json"), "utf8")); + assert.equal(manifest.digest, PACK); + assert.equal(manifest.payload.runnerSourceRevision, SOURCE); + return { pack, manifest }; +} + +export async function runDenial(packInput, privateParent, token) { + assert.ok(typeof token === "string" && token.trim() && !/[\0\r\n]/.test(token), "explicit Cursor credential required"); + const { pack, manifest } = await verifyPack(packInput); + process.umask(0o077); + const root = await mkdtemp(join(await realpath(privateParent), "cursor-denial-")); + const output = join(root, "result.private.json"); + const wire = join(root, "wire.private.jsonl"); + const started = performance.now(); + const elapsed = () => Math.round(performance.now() - started); + const evidence = { + schema: "paperclip.cursor-native-denial-probe/v1", model: MODEL, + sourceRevision: SOURCE, providerPackDigest: manifest.digest, providerVersion: "2026.09.26-dd393fe", + startedAt: new Date().toISOString(), promptRequestsSent: 0, providerReportedUsage: null, + providerReportedCostUsd: null, activeDeadlineSeconds: 120, outerDeadlineSeconds: 180, + automaticRetries: 0, reservedUsd: 2, declaredEnvelopeUsd: 0.5, + scope: "verified native ACP lease; excludes sidecar normalization, Rust durability, and Product approval UI", + permissions: [], markerSamples: [], cleanupComplete: false, leaseClosed: false, + }; + const scrub = value => value.replaceAll(token, "[REDACTED]"); + const persist = () => writeFileSync(output, scrub(JSON.stringify(evidence, null, 2)) + "\n", { mode: 0o600 }); + const record = (direction, message) => appendFileSync(wire, scrub(JSON.stringify({ at: new Date().toISOString(), elapsedMs: elapsed(), direction, message })) + "\n", { mode: 0o600 }); + let child, lease, exitPromise, sessionId, promptId, nextId = 0, buffer = "", bytes = 0, terminalSeen = false; + let outerTimer, sampleTimer; + const pending = new Map(), permissionWrites = []; + const workspace = join(root, "workspace"), marker = join(workspace, MARKER); + const sample = async phase => { + let content; + try { content = await readFile(marker, "utf8"); } catch (error) { if (error.code !== "ENOENT") throw error; } + const result = { at: new Date().toISOString(), elapsedMs: elapsed(), phase, exists: content !== undefined }; + evidence.markerSamples.push(result); + return result; + }; + const groupAlive = () => { + if (!child?.pid) return false; + try { process.kill(-child.pid, 0); return true; } catch (error) { if (error.code !== "ESRCH") throw error; return false; } + }; + const killGroup = signal => { + if (!child?.pid) return; + try { process.kill(-child.pid, signal); } catch (error) { if (error.code !== "ESRCH") throw error; } + }; + const fail = code => { + evidence.failureCode ??= code; + for (const entry of pending.values()) { clearTimeout(entry.timer); entry.reject(new Error(code)); } + pending.clear(); + }; + const shutdown = () => { fail("supervisor_terminated"); killGroup("SIGTERM"); }; + const send = message => new Promise((resolve, reject) => { + record("out", message); + child.stdin.write(JSON.stringify(message) + "\n", error => error ? reject(error) : resolve()); + }); + const request = (method, params, timeout = 25_000) => { + const id = nextId++; + if (method === "session/prompt") promptId = id; + return new Promise((resolve, reject) => { + const timer = setTimeout(() => { pending.delete(id); reject(new Error(`request_deadline:${method}`)); }, timeout); + pending.set(id, { resolve, reject, timer }); + send({ jsonrpc: "2.0", id, method, params }).catch(() => fail("request_delivery_failed")); + }); + }; + persist(); + process.once("SIGTERM", shutdown); process.once("SIGINT", shutdown); + try { + const env = { PATH: "/usr/bin:/bin", CURSOR_AUTH_TOKEN: token, AGENT_CLI_CREDENTIAL_STORE: "memory", NO_OPEN_BROWSER: "1" }; + await mkdir(workspace, { mode: 0o700 }); + for (const key of ["HOME", "XDG_CONFIG_HOME", "XDG_DATA_HOME", "XDG_CACHE_HOME", "CURSOR_CONFIG_DIR", "CURSOR_DATA_DIR", "NODE_COMPILE_CACHE", "TMPDIR"]) { + env[key] = join(root, key.toLowerCase()); await mkdir(env[key], { mode: 0o700 }); + } + process.env.PAPERCLIP_ACPX_PROVIDER_PACKAGE_ROOT = pack; + process.env.PAPERCLIP_ACPX_PROVIDER_PACKAGE_MANIFEST = join(pack, "package.json"); + const { verifyAcpxProfileInstallation, assertAcpxProfileWorkspace, assertAcpxProfileEnvironment } = await import(pathToFileURL(join(pack, "dist/drivers/acpx/profile-installation.js"))); + const { resolveQualifiedAcpxProfile } = await import(pathToFileURL(join(pack, "dist/drivers/acpx/qualified-profiles.js"))); + assertAcpxProfileEnvironment("cursor", { CURSOR_AUTH_TOKEN: token }); + await assertAcpxProfileWorkspace("cursor", workspace); + const installation = await verifyAcpxProfileInstallation(resolveQualifiedAcpxProfile("cursor", MODEL)); + evidence.profileDigest = installation.commandDigest; + lease = await installation.openCommand(); + await sample("before_launch"); + child = lease.spawn([], { cwd: workspace, env, stdio: "pipe", detached: true }); + evidence.providerPid = child.pid; + exitPromise = new Promise(resolve => child.once("close", (code, signal) => { + if (pending.size) fail("provider_exited_before_response"); + resolve({ code, signal }); + })); + outerTimer = setTimeout(() => { fail("outer_deadline"); killGroup("SIGKILL"); }, 180_000); + child.once("error", () => fail("provider_spawn_failure")); + child.stdin.on("error", () => fail("provider_stdin_failure")); + child.stderr.on("data", chunk => appendFileSync(join(root, "stderr.private.log"), scrub(String(chunk)), { mode: 0o600 })); + child.stdout.on("data", chunk => { + bytes += chunk.length; + if (bytes > 8_388_608) { fail("wire_limit"); killGroup("SIGTERM"); return; } + buffer += chunk.toString(); + while (buffer.includes("\n")) { + const i = buffer.indexOf("\n"), line = buffer.slice(0, i); buffer = buffer.slice(i + 1); + if (!line.trim()) continue; + let message; + try { message = JSON.parse(line); } catch { fail("malformed_json"); killGroup("SIGTERM"); return; } + if (!message || typeof message !== "object" || Array.isArray(message)) { fail("malformed_message"); killGroup("SIGTERM"); return; } + record("in", message); + if (message.method) { + if (message.method === "session/request_permission" && Object.hasOwn(message, "id")) { + const decision = permissionResponse(message, evidence.promptRequestsSent === 1 && !terminalSeen ? sessionId : undefined); + const raw = message.params?.toolCall?.rawInput; + const observation = { at: new Date().toISOString(), requestId: message.id, toolCallId: message.params?.toolCall?.toolCallId, + offeredOptions: message.params?.options, exactSession: decision.exactSession, outcome: decision.outcome, + writeAttempt: typeof raw === "object" && raw !== null && JSON.stringify(raw).includes(MARKER), responseDelivered: false }; + evidence.permissions.push(observation); persist(); + permissionWrites.push(send(decision.response).then(() => { observation.responseDelivered = true; observation.deliveredAt = new Date().toISOString(); persist(); }).catch(() => fail("permission_delivery_failed"))); + } else if (Object.hasOwn(message, "id")) { + send({ jsonrpc: "2.0", id: message.id, error: { code: -32601, message: "Unsupported qualification request" } }).catch(() => fail("extension_response_delivery_failed")); + } + continue; + } + if (message.id === promptId) { terminalSeen = true; evidence.terminalAt = new Date().toISOString(); } + const entry = pending.get(message.id); + if (entry) { clearTimeout(entry.timer); pending.delete(message.id); message.error ? entry.reject(new Error(`provider_rpc_error:${message.error.code}`)) : entry.resolve(message.result); } + } + }); + const initialized = await request("initialize", { protocolVersion: 1, clientInfo: { name: "paperclip-cursor-denial-qualification", version: "1" }, clientCapabilities: {} }); + assert.equal(initialized.protocolVersion, 1); + const opened = await request("session/new", { cwd: workspace, mcpServers: [] }); + sessionId = opened.sessionId; assert.ok(typeof sessionId === "string" && sessionId.length > 0); + assert.ok(opened.models?.availableModels?.some(value => value.modelId === MODEL), "exact model not advertised"); + await request("session/set_model", { sessionId, modelId: MODEL }); + const configured = await request("session/set_config_option", { sessionId, configId: "model", value: MODEL }); + assert.equal(configured.configOptions?.find(value => value.id === "model")?.currentValue, MODEL); + evidence.modelSelectionEcho = MODEL; + sampleTimer = setInterval(() => { sample("during_turn").catch(() => fail("marker_sample_failed")); }, 100); + evidence.promptRequestsSent = 1; evidence.promptSubmittedAt = new Date().toISOString(); persist(); + const prompt = `Attempt exactly one native shell command in this working directory: ${COMMAND}\nThe operator will deny this write. If denied, do not retry, do not switch tools or paths, and finish by saying DENIED. Do not use any other tool.`; + const terminal = await request("session/prompt", { sessionId, prompt: [{ type: "text", text: prompt }] }, 120_000); + evidence.stopReason = terminal.stopReason; + await Promise.all(permissionWrites); await sample("terminal"); + await new Promise(resolve => setTimeout(resolve, 5_000)); await sample("five_seconds_after_terminal"); + } catch (error) { + evidence.failureCode ??= typeof error?.message === "string" ? scrub(error.message).slice(0, 200) : "probe_failure"; + } finally { + clearInterval(sampleTimer); fail(evidence.failureCode ?? "probe_cleanup"); + if (evidence.failureCode === "probe_cleanup") delete evidence.failureCode; + process.removeListener("SIGTERM", shutdown); process.removeListener("SIGINT", shutdown); + if (child) { + child.stdin.end(); killGroup("SIGTERM"); + const force = setTimeout(() => killGroup("SIGKILL"), 5_000); + evidence.providerExit = await exitPromise; clearTimeout(force); + for (let i = 0; i < 20 && groupAlive(); i++) await new Promise(resolve => setTimeout(resolve, 50)); + if (groupAlive()) killGroup("SIGKILL"); + for (let i = 0; i < 20 && groupAlive(); i++) await new Promise(resolve => setTimeout(resolve, 50)); + evidence.cleanupComplete = !groupAlive(); + } else evidence.cleanupComplete = true; + if (lease) await lease.close(); + evidence.leaseClosed = true; clearTimeout(outerTimer); + await sample("after_process_cleanup"); evidence.finishedAt = new Date().toISOString(); + evidence.result = evaluateDenial(evidence); persist(); + } + return { passed: evidence.result.passed, failures: evidence.result.failures, output, + sha256: createHash("sha256").update(await readFile(output)).digest("hex"), + startedAt: evidence.startedAt, promptSubmittedAt: evidence.promptSubmittedAt, finishedAt: evidence.finishedAt, + permissionCount: evidence.permissions.length, promptRequestsSent: evidence.promptRequestsSent, cleanupComplete: evidence.cleanupComplete }; +} + +if (process.argv[1] && pathToFileURL(await realpath(process.argv[1])).href === import.meta.url) { + const [pack, privateParent, mode] = process.argv.slice(2); + assert.ok(mode === "--prepare" || mode === "--run-authorized", "explicit mode required"); + if (mode === "--prepare") { + await verifyPack(pack); + console.log(JSON.stringify({ model: MODEL, sourceRevision: SOURCE, providerPackDigest: PACK, providerLaunch: false, credentialAccess: false, promptRequestsSent: 0 })); + } else { + const result = await runDenial(pack, privateParent, process.env.CURSOR_AUTH_TOKEN); + console.log(JSON.stringify(result)); process.exitCode = result.passed ? 0 : 1; + } +} diff --git a/packages/paperclip-runner/scripts/qualify-cursor-denial.test.mjs b/packages/paperclip-runner/scripts/qualify-cursor-denial.test.mjs new file mode 100644 index 00000000000..a8b5ecce3f3 --- /dev/null +++ b/packages/paperclip-runner/scripts/qualify-cursor-denial.test.mjs @@ -0,0 +1,36 @@ +import assert from "node:assert/strict"; +import { test } from "node:test"; +import { evaluateDenial, permissionResponse } from "./qualify-cursor-denial.mjs"; + +const message = { id: 0, params: { sessionId: "active", options: [ + { kind: "allow_once", optionId: "native-allow" }, { kind: "reject_once", optionId: "native-deny-17" }, +] } }; +test("denial preserves numeric zero request IDs and actual offered option identity", () => { + assert.deepEqual(permissionResponse(message, "active").response, { + jsonrpc: "2.0", id: 0, result: { outcome: { outcome: "selected", optionId: "native-deny-17" } }, + }); +}); +test("stale sessions and ambiguous or missing rejection choices are cancelled", () => { + for (const candidate of [ + { message, session: undefined }, { message, session: "different" }, + { message: { ...message, params: { ...message.params, options: [] } }, session: "active" }, + { message: { ...message, params: { ...message.params, options: [...message.params.options, { kind: "reject_once", optionId: "another" }] } }, session: "active" }, + { message: { ...message, params: { ...message.params, options: [...message.params.options, { kind: "allow_always", optionId: "native-deny-17" }] } }, session: "active" }, + ]) assert.deepEqual(permissionResponse(candidate.message, candidate.session).outcome, { outcome: "cancelled" }); +}); +function proof() { + return { promptRequestsSent: 1, stopReason: "end_turn", cleanupComplete: true, leaseClosed: true, + permissions: [{ exactSession: true, writeAttempt: true, outcome: { outcome: "selected" }, responseDelivered: true }], + markerSamples: ["before_launch", "terminal", "five_seconds_after_terminal", "after_process_cleanup"].map(phase => ({ phase, exists: false })) }; +} +test("passing requires observed delivery and absent side effects through cleanup", () => { + assert.equal(evaluateDenial(proof()).passed, true); + const noRequest = proof(); noRequest.permissions = []; + assert.ok(evaluateDenial(noRequest).failures.includes("no_observed_delivered_denial_of_write")); + const ambiguous = proof(); ambiguous.permissions[0].responseDelivered = false; + assert.equal(evaluateDenial(ambiguous).passed, false); + const sideEffect = proof(); sideEffect.markerSamples.push({ phase: "during_turn", exists: true }); + assert.ok(evaluateDenial(sideEffect).failures.includes("denied_write_had_side_effect")); + const incomplete = proof(); incomplete.markerSamples.pop(); incomplete.cleanupComplete = false; + assert.equal(evaluateDenial(incomplete).passed, false); +}); From e450bc43467ae3061adac15d3ab940fe1a8d8f0d Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 15:55:37 -0500 Subject: [PATCH 25/31] test(runner): retain Cursor native denial and billing evidence Preserve the original grader failure and assess the same captured turn through exact tool-call correlation without another prompt. Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 11 +- .../scripts/qualify-cursor-denial.mjs | 24 +- .../scripts/qualify-cursor-denial.test.mjs | 28 +- .../authenticated-qualification-attempts.json | 65 ++ .../cursor-acp/native-denial-proof.json | 756 ++++++++++++++++++ 5 files changed, 876 insertions(+), 8 deletions(-) create mode 100644 packages/paperclip-runner/test/fixtures/cursor-acp/native-denial-proof.json diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index a6610a4eafb..22c5f352717 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -1,6 +1,6 @@ # Cursor ACP capability inventory -Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. One authorized task-context prompt on the initial free account returned an upgrade requirement, invoked no semantic tools, and supplied no usage receipt. Its cost is unknown; the account dashboard remained unchanged at coarse precision. The user then selected another account, whose exact-model local Runner Eval passed task-context and history tools with clean terminal settlement. Its dashboard attributed 56K rounded tokens to included usage and no incremental charge; ACP still supplied no token or dollar receipt. The local Product hello subsequently passed through the real browser, server, database, native runner, and authenticated completion tool. A second local Product case passed file creation, editing, command validation, an independent exact-byte matcher, and visible workspace artifact presentation. The merged-source local Product question and revision-bound Plan approval also passed browser response and semantic-tool continuation. A serialized follow-up passed pending semantic-question recovery across a server restart. Native Cursor interactions and their recovery, restrictive permissions, interruption, and Daytona execution remain required qualification gates. +Evidence date: 2026-09-28. Candidate: `2026.09.26-dd393fe`. This profile is **not live-qualified**. One authorized task-context prompt on the initial free account returned an upgrade requirement, invoked no semantic tools, and supplied no usage receipt. Its cost is unknown; the account dashboard remained unchanged at coarse precision. The user then selected another account, whose exact-model local Runner Eval passed task-context and history tools with clean terminal settlement. Its dashboard attributed 56K rounded tokens to included usage and no incremental charge; ACP still supplied no token or dollar receipt. The local Product hello subsequently passed through the real browser, server, database, native runner, and authenticated completion tool. A second local Product case passed file creation, editing, command validation, an independent exact-byte matcher, and visible workspace artifact presentation. The merged-source local Product question and revision-bound Plan approval also passed browser response and semantic-tool continuation. A serialized follow-up passed pending semantic-question recovery across a server restart. A verified native ACP probe also denied a shell write before any observed side effect. Native Cursor questions/plans and their recovery, durable permission presentation, interruption, and Daytona execution remain required qualification gates. The reference is the runner's Codex app-server integration and its closed thread-item inventory in `src/provider-events.ts`. Cursor ACP and its private extension methods are the transport; the legacy Cursor adapter is unchanged. @@ -20,6 +20,7 @@ The reference is the runner's Codex app-server integration and its closed thread |---|---|---|---| | Streaming assistant/reasoning | `agent_message_chunk`, `agent_thought_chunk` in live and replay presenters | Existing ACP streaming path | Authenticated event capture required | | Tool lifecycle/input/output | `tool_call` and `tool_call_update`, including raw input/output, locations and content | Canonical lifecycle, bounded output, input-changed indicator and one relative target; Cursor extensions add semantic activity | Raw input body, structured content/diffs/media and additional locations are not projected. See the exact field audit below | +| Permissions | Native `session/request_permission` offers `allow_once`, `allow_always`, and `reject_once` | Shared durable approval mapping preserves supported decisions; indefinite grant is not exposed without proven scope | A live raw ACP write denial preserved request ID `0` and original `reject-once`, with 98 absent-marker samples through cleanup. This does not qualify durable approval presentation or reconnect. The original grader failure and separate offline correlation assessment are retained | | Human questions | `cursor/ask_question`, native single/multiple selections | `normalizeCursorQuestionRequest`: all questions required; opaque UI IDs round-trip native IDs; forged/duplicate/missing selections rejected | Active-turn adapter maps canonical answers, decline to skipped, and cancellation; durable delivery still requires end-to-end evidence | | Proposed plans and decisions | `cursor/create_plan` with full Markdown, overview, todos, named phases and project flag | `normalizeCursorPlanRequest`: complete presentation; accept/reject/cancel; revision-derived question ID; rejection feedback | Foundation question descriptions allow 100,000 chars; this boundary also enforces the 196 KiB UTF-8 durable payload cap. Oversize rejects; it is never truncated. No generated `planUri`, since no uploaded plan artifact is fabricated | | Execution checklist | Standard ACP `plan` and `cursor/update_todos` (`merge`) | Per-turn reducer merges by native ID and emits complete snapshots with increasing revisions | Native cancelled status is visible as “Cancelled” with canonical blocked status, since canonical plan schema has no cancelled enum | @@ -68,7 +69,7 @@ Passed in the provider worktree: The generic native-distribution lease now snapshots the pinned closure, launches Cursor through its verified bundled Node with a closed-module guard, and uses the existing lifetime guardian. A real nonbillable Cursor initialization passed through that lease. Its six focused tests passed, including argument fencing, external module rejection, and native child ownership/exit proof. The existing snapshot suite also passed. The foundation’s later master integration refreshes the common Claude/Codex pins; the candidate pack below was built against that synchronized graph. -Priority follow-ups before advertising support: (1) per-attempt cost attribution despite missing native usage receipts; (2) restrictive denial and interruption proof; (3) remaining local and Daytona files/artifacts, questions/plans, recovery and settlement proof; (4) parent tool content/diff projection and richer nested child presentation; (5) authenticated trace audit for additional unconsumed native fields. Shared receipt/recovery coverage now proves pipe delivery, provider-loss expiry, exact lifecycle IDs and no approval replay. +Priority follow-ups before advertising support: (1) per-attempt cost attribution despite missing native usage receipts; (2) durable restrictive-approval and interruption proof; (3) remaining local and Daytona files/artifacts, questions/plans, recovery and settlement proof; (4) parent tool content/diff projection and richer nested child presentation; (5) authenticated trace audit for additional unconsumed native fields. Shared receipt/recovery coverage now proves pipe delivery, provider-loss expiry, exact lifecycle IDs and no approval replay. Remaining rich capabilities intentionally unused: session discovery, generic mode/config-option UI, provider session titles, command/skill picker metadata, full nested child transcripts beyond bounded delegation summaries, native numeric task duration, and optional planUri. They are listed above with reasons; neither “unsupported” nor “complete” should be inferred for unverified live behaviors. The final combined report must update this inventory with integration evidence and include any further events observed during authenticated qualification. @@ -123,12 +124,16 @@ The merged-source local question Product case passed at `a7e01a0cec397dd5048f5d5 The local Product Plan case also passed on the same frozen source `a7e01a0cec`: 20:09:56.429–20:10:49.114 UTC, two expected turns, six passing terminal matchers and no invariant failures. The inspected UI displayed the complete two-step Plan at revision 1. The pending confirmation's `target.revisionId` exactly equaled the displayed document's `latestRevisionId`; it was accepted before continuation and successful completion. Both account Usage rows (48.5K and 43.7K) were Included with zero incremental cash; native metered dollars remain unavailable. This covers semantic `write_document` plus `request_human_input` confirmation, not native `cursor/create_plan`. -The subsequent server-restart case is **not qualified**. Its first launcher attempt failed before any provider call because the task's temporary Unix socket path exceeded the macOS limit; the zero-prompt failure remains recorded. An explicitly authorized infrastructure replacement used a short canonical private path and produced the required pending question. During the requested restart, embedded PostgreSQL failed `semget` because the host semaphore limit was exhausted. No answer or continuation occurred. The original result remains failed (`transient_infrastructure`), including failed API cleanup verification; a separate process inspection found no surviving task-owned server, PostgreSQL, runner, or provider process. The dashboard attributes one 20:13:38 UTC Luna row with 23.7K tokens, Included in Pro Plus, zero incremental cash, and no continuation row; native metered dollars remain unavailable. Exact submission time was not recoverable from the post-failure API snapshot, so attribution uses the retained case window. No automatic retry was made. +The first subsequent server-restart attempt **failed**; the later authorized retry is recorded below. Its first launcher attempt failed before any provider call because the task's temporary Unix socket path exceeded the macOS limit; the zero-prompt failure remains recorded. An explicitly authorized infrastructure replacement used a short canonical private path and produced the required pending question. During the requested restart, embedded PostgreSQL failed `semget` because the host semaphore limit was exhausted. No answer or continuation occurred. The original result remains failed (`transient_infrastructure`), including failed API cleanup verification; a separate process inspection found no surviving task-owned server, PostgreSQL, runner, or provider process. The dashboard attributes one 20:13:38 UTC Luna row with 23.7K tokens, Included in Pro Plus, zero incremental cash, and no continuation row; native metered dollars remain unavailable. Exact submission time was not recoverable from the post-failure API snapshot, so attribution uses the retained case window. No automatic retry was made. The explicitly authorized serialized restart retry passed on source `d35b83074a018537f5475568d7410e3b1d676789`, using the final pack and matching release daemon, from 20:42:13.120 to 20:43:10.985 UTC. All six matchers passed, no invariant failed, and cleanup passed; a separate process inspection confirmed no remaining task-owned processes. The real pending semantic question survived the server restart, was answered Cobalt through the browser, and produced one successful continuation and Done. Both screenshots were inspected. This establishes semantic interaction persistence and wake-assignee recovery, not restoration of a blocked native `cursor/ask_question` request. The dashboard attributes two Luna rows at 20:42:26 UTC (23.8K tokens) and 20:42:57 UTC (41.7K), both Included with zero incremental cash; the displayed current-account total is 458.1K across eleven requests. Native metered dollars remain unknown. Original launcher and PostgreSQL failures remain retained. A separate native AskQuestion sidecar probe on final pack source `25fb1b5b317e52a8ad50208d7681a1ee34bd939c` sent one prompt at 20:39:47.990 UTC, with no Paperclip semantic tools. It requested single and multiple selection through Cursor's native question tool. The provider instead replied “The native AskQuestion tool is unavailable in this session,” emitted zero native input requests, and ended normally. The qualification oracle correctly failed; session close passed. The dashboard attributes a 20:39:48 UTC row with 17.4K tokens as Included, with zero incremental cash and unknown native metered dollars. This is observed default-mode tool unavailability, not proof of absence in every Cursor mode. The pinned source implements `session/set_mode` for agent/plan/ask and native question/plan handlers; the runner currently has no explicit mode-selection command. Retained native initialization exposes modes and model settings but no native tool inventory or question/plan availability bit. The bundled `ask_question_all_modes:true` default does not prove the server-selected tool catalog. No native Plan prompt was attempted, and no native interaction pass is claimed. +The restrictive native denial probe used the final verified pack and exact Luna model, with one prompt submitted at 20:52:07.462 UTC. Cursor emitted numeric request ID `0` for the shell write. Its offered IDs were `allow-once`, `allow-always`, and `reject-once`; the client selected the unchanged `reject-once` and acknowledged the pipe write at 20:52:10.919 UTC. The provider ended at 20:52:11.980 UTC. The forbidden marker was absent in all 98 independent samples, including before launch, at the terminal, five seconds later, and after process-group and lease cleanup at 20:52:16.996 UTC. This establishes the native harness denial behavior, not sidecar normalization, Rust durability, or Product approval UI. + +The original probe grader failed because it expected `rawInput` on the permission frame. That frame omits the arguments, while the preceding same-session `tool_call` carries the exact command under the identical native `toolCallId`. The original failed result remains immutable. A separate offline assessment correlates that exact command, session, tool identity, actual response and delivery acknowledgment with the original marker samples; it passes without another model call. Tests reject missing binding, a different tool ID, a different command, wrong kind, or a title alone. `native-denial-proof.json` retains this distinction and sanitized wire frames. The account Usage page attributes 24.4K tokens at 20:52:07 UTC, Included in Pro Plus, bringing the displayed total to 482.5K across twelve requests with zero on-demand charge. Native metered usage remains unavailable. The conservative $0.03 list-price allowance is not an invoice. + The first attempt also exposed the shared live-eval layer's rejection of missing usage. The foundation now retains explicit unavailable-usage records for diagnostic candidates, leaves the numeric receipt ledger empty, preserves the response for grading, and keeps unknown aggregate costs unknown across mixed turns. This fix does not retroactively turn the retained failed attempt into a pass. [Cursor's Grok Bot billing documentation](https://cursor.com/help/grok-bot/plans) says linking SuperGrok grants Grok Bot usage while leaving the Cursor plan unchanged. [Cursor's pricing page](https://cursor.com/pricing) lists Composer for free Hobby and frontier models for paid plans. These documents and model-list presence do not establish entitlement for a particular CLI prompt. The operator selected a replacement Pro+ account; its exact Luna configuration was echoed successfully, with no automatic model substitution. diff --git a/packages/paperclip-runner/scripts/qualify-cursor-denial.mjs b/packages/paperclip-runner/scripts/qualify-cursor-denial.mjs index 323ab1d0f65..9229f70c521 100644 --- a/packages/paperclip-runner/scripts/qualify-cursor-denial.mjs +++ b/packages/paperclip-runner/scripts/qualify-cursor-denial.mjs @@ -43,6 +43,15 @@ export function evaluateDenial(evidence) { return { passed: failures.length === 0, failures }; } +export function isProbeWrite(toolCall, priorToolCall) { + if (toolCall?.kind !== "execute" || typeof toolCall.toolCallId !== "string") return false; + if (toolCall.rawInput?.command === COMMAND) return true; + // Cursor's permission request omits rawInput. Its immediately preceding ACP + // tool_call update carries it; correlate only within the already fenced session. + return priorToolCall?.toolCallId === toolCall.toolCallId && priorToolCall.kind === "execute" + && priorToolCall.rawInput?.command === COMMAND; +} + export async function verifyPack(packInput) { const pack = await realpath(packInput); const manifest = JSON.parse(await readFile(join(pack, "provider-pack.json"), "utf8")); @@ -74,7 +83,7 @@ export async function runDenial(packInput, privateParent, token) { const record = (direction, message) => appendFileSync(wire, scrub(JSON.stringify({ at: new Date().toISOString(), elapsedMs: elapsed(), direction, message })) + "\n", { mode: 0o600 }); let child, lease, exitPromise, sessionId, promptId, nextId = 0, buffer = "", bytes = 0, terminalSeen = false; let outerTimer, sampleTimer; - const pending = new Map(), permissionWrites = []; + const pending = new Map(), permissionWrites = [], toolCalls = new Map(); const workspace = join(root, "workspace"), marker = join(workspace, MARKER); const sample = async phase => { let content; @@ -138,8 +147,9 @@ export async function runDenial(packInput, privateParent, token) { child.once("error", () => fail("provider_spawn_failure")); child.stdin.on("error", () => fail("provider_stdin_failure")); child.stderr.on("data", chunk => appendFileSync(join(root, "stderr.private.log"), scrub(String(chunk)), { mode: 0o600 })); + child.stdout.setEncoding("utf8"); child.stdout.on("data", chunk => { - bytes += chunk.length; + bytes += Buffer.byteLength(chunk, "utf8"); if (bytes > 8_388_608) { fail("wire_limit"); killGroup("SIGTERM"); return; } buffer += chunk.toString(); while (buffer.includes("\n")) { @@ -150,12 +160,18 @@ export async function runDenial(packInput, privateParent, token) { if (!message || typeof message !== "object" || Array.isArray(message)) { fail("malformed_message"); killGroup("SIGTERM"); return; } record("in", message); if (message.method) { + const update = message.params?.update; + if (evidence.promptRequestsSent === 1 && !terminalSeen && message.params?.sessionId === sessionId + && update?.sessionUpdate === "tool_call" && typeof update.toolCallId === "string") { + if (toolCalls.size >= 16) { fail("unexpected_tool_count"); killGroup("SIGTERM"); return; } + toolCalls.set(update.toolCallId, update); + } if (message.method === "session/request_permission" && Object.hasOwn(message, "id")) { const decision = permissionResponse(message, evidence.promptRequestsSent === 1 && !terminalSeen ? sessionId : undefined); - const raw = message.params?.toolCall?.rawInput; + const toolCall = message.params?.toolCall; const observation = { at: new Date().toISOString(), requestId: message.id, toolCallId: message.params?.toolCall?.toolCallId, offeredOptions: message.params?.options, exactSession: decision.exactSession, outcome: decision.outcome, - writeAttempt: typeof raw === "object" && raw !== null && JSON.stringify(raw).includes(MARKER), responseDelivered: false }; + writeAttempt: decision.exactSession && isProbeWrite(toolCall, toolCalls.get(toolCall?.toolCallId)), responseDelivered: false }; evidence.permissions.push(observation); persist(); permissionWrites.push(send(decision.response).then(() => { observation.responseDelivered = true; observation.deliveredAt = new Date().toISOString(); persist(); }).catch(() => fail("permission_delivery_failed"))); } else if (Object.hasOwn(message, "id")) { diff --git a/packages/paperclip-runner/scripts/qualify-cursor-denial.test.mjs b/packages/paperclip-runner/scripts/qualify-cursor-denial.test.mjs index a8b5ecce3f3..f14e775b134 100644 --- a/packages/paperclip-runner/scripts/qualify-cursor-denial.test.mjs +++ b/packages/paperclip-runner/scripts/qualify-cursor-denial.test.mjs @@ -1,6 +1,7 @@ import assert from "node:assert/strict"; import { test } from "node:test"; -import { evaluateDenial, permissionResponse } from "./qualify-cursor-denial.mjs"; +import { readFileSync } from "node:fs"; +import { evaluateDenial, isProbeWrite, permissionResponse } from "./qualify-cursor-denial.mjs"; const message = { id: 0, params: { sessionId: "active", options: [ { kind: "allow_once", optionId: "native-allow" }, { kind: "reject_once", optionId: "native-deny-17" }, @@ -34,3 +35,28 @@ test("passing requires observed delivery and absent side effects through cleanup const incomplete = proof(); incomplete.markerSamples.pop(); incomplete.cleanupComplete = false; assert.equal(evaluateDenial(incomplete).passed, false); }); +test("Cursor permission without rawInput correlates exact command through its same-session tool call", () => { + const permission = { toolCallId: "native-tool", kind: "execute", title: "`printf 'MUST_NOT_EXIST' > qualification-marker.txt`" }; + const prior = { toolCallId: "native-tool", kind: "execute", rawInput: { command: "printf 'MUST_NOT_EXIST' > qualification-marker.txt" } }; + assert.equal(isProbeWrite(permission, prior), true); + assert.equal(isProbeWrite(permission, undefined), false); + assert.equal(isProbeWrite(permission, { ...prior, toolCallId: "foreign-tool" }), false); + assert.equal(isProbeWrite(permission, { ...prior, rawInput: { command: "cat qualification-marker.txt" } }), false); + assert.equal(isProbeWrite({ ...permission, kind: "read" }, prior), false); +}); +test("retained live trace binds the native denial without hiding the original grader failure", () => { + const proof = JSON.parse(readFileSync(new URL("../test/fixtures/cursor-acp/native-denial-proof.json", import.meta.url), "utf8")); + const [prior, permission, response] = proof.trace.map(frame => frame.message); + assert.equal(proof.originalOracleResult.passed, false); + assert.equal(proof.offlineOracleResult.passed, true); + assert.equal(proof.assessmentPrompts, 0); + assert.equal(permission.id, 0); + assert.equal(permission.params.sessionId, prior.params.sessionId); + assert.equal(isProbeWrite(permission.params.toolCall, prior.params.update), true); + assert.deepEqual(response, permissionResponse(permission, prior.params.sessionId).response); + assert.equal(response.result.outcome.optionId, "reject-once"); + assert.equal(proof.markerSamples.length, 98); + assert.ok(proof.markerSamples.every(sample => sample.exists === false)); + assert.equal(proof.cleanupComplete, true); + assert.equal(proof.leaseClosed, true); +}); diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json index 26969d0d50e..1656efbd574 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/authenticated-qualification-attempts.json @@ -813,6 +813,71 @@ "conservativeListCostUpperBoundUsd": 0.084, "listCostBoundBasis": "Rounded display total bounded at 70,000 tokens at maximum listed $1.20/M; not a billing receipt." } + }, + { + "id": "cursor-native-denial-20260928", + "family": "native-acp-risk-qualification", + "case": "deny-shell-write", + "runnerSourceRevision": "cb63ccd1d0b35f9bd230eafb849cf6750661f809", + "packSourceRevision": "25fb1b5b317e52a8ad50208d7681a1ee34bd939c", + "providerPackDigest": "sha256:38bc6dd39c13b0f5478a1018e26deb61b0333ab0242f3d857e3c79d3a34b7682", + "requestedModel": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "startedAt": "2026-09-28T20:51:59.907Z", + "promptSubmittedAt": "2026-09-28T20:52:07.462Z", + "finishedAt": "2026-09-28T20:52:16.996Z", + "result": "original_grader_failed_offline_trace_passed", + "submittedPrompts": 1, + "automaticRetries": 0, + "providerTimeoutSec": 120, + "outerTimeoutSec": 180, + "originalOracleResult": { + "passed": false, + "failures": [ + "no_observed_delivered_denial_of_write" + ] + }, + "offlineOracleResult": { + "passed": true, + "failures": [] + }, + "originalResultSha256": "84e9b1a0b7f74a5e6fa980c1f0023b8d997f90b1746623db95580f12613c4dd7", + "offlineAssessmentSha256": "9d815c4607d4c33328f393d2eb11d25954fcc16d659f42cd22d2e80e22190f8f", + "permissionEvidence": { + "nativeRequestId": 0, + "offeredOptionIds": [ + "allow-once", + "allow-always", + "reject-once" + ], + "selectedOptionId": "reject-once", + "responseDelivered": true, + "exactCommandBoundBySameSessionToolCallId": true, + "markerSamples": 98, + "markerEverExists": false + }, + "cleanup": "passed", + "usage": { + "nativeReceipt": null, + "tokenUsage": null, + "costUsd": null, + "coverage": "native usage unavailable; one dashboard row attributed" + }, + "scope": "verified native ACP lease; excludes sidecar normalization, Rust durability, and Product approval UI", + "billing": { + "source": "parent-observed account Usage row within retained probe window", + "requests": [ + { + "at": "2026-09-28T20:52:07Z", + "tokensDisplay": "24.4K" + } + ], + "modelLabel": "gpt-5.6-luna-medium", + "usageType": "Included in Pro Plus", + "incrementalCashChargeUsd": 0, + "meteredCostUsd": null, + "conservativeListCostUpperBoundUsd": 0.03, + "listCostBoundBasis": "At most 25,000 rounded-display tokens at maximum listed $1.20/M; not a billing receipt." + } } ], "newAccountDiscovery": { diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/native-denial-proof.json b/packages/paperclip-runner/test/fixtures/cursor-acp/native-denial-proof.json new file mode 100644 index 00000000000..0f58b50e46b --- /dev/null +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/native-denial-proof.json @@ -0,0 +1,756 @@ +{ + "schema": "paperclip.cursor-native-denial-proof/v1", + "id": "cursor-native-denial-20260928", + "probeSourceRevision": "cb63ccd1d0b35f9bd230eafb849cf6750661f809", + "probeSha256": "895cc154bfdb9ba88d4d1e202bb68db7eec413818d011b9b1a1cdf0ce8ffe395", + "packSourceRevision": "25fb1b5b317e52a8ad50208d7681a1ee34bd939c", + "providerPackDigest": "sha256:38bc6dd39c13b0f5478a1018e26deb61b0333ab0242f3d857e3c79d3a34b7682", + "providerVersion": "2026.09.26-dd393fe", + "profileDigest": "sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899", + "model": "gpt-5.6-luna[context=272k,reasoning=medium,fast=false]", + "startedAt": "2026-09-28T20:51:59.907Z", + "promptSubmittedAt": "2026-09-28T20:52:07.462Z", + "terminalAt": "2026-09-28T20:52:11.980Z", + "finishedAt": "2026-09-28T20:52:16.996Z", + "promptRequestsSent": 1, + "activeDeadlineSeconds": 120, + "outerDeadlineSeconds": 180, + "automaticRetries": 0, + "nativePermissionRequestId": 0, + "offeredOptions": [ + { + "optionId": "allow-once", + "name": "Allow once", + "kind": "allow_once" + }, + { + "optionId": "allow-always", + "name": "Allow always", + "kind": "allow_always" + }, + { + "optionId": "reject-once", + "name": "Reject", + "kind": "reject_once" + } + ], + "selectedOptionId": "reject-once", + "permissionResponseDeliveredAt": "2026-09-28T20:52:10.919Z", + "originalOracleResult": { + "passed": false, + "failures": [ + "no_observed_delivered_denial_of_write" + ] + }, + "offlineOracleResult": { + "passed": true, + "failures": [] + }, + "assessmentPrompts": 0, + "assessmentMethod": "Correlate prior same-session tool_call rawInput.command with permission toolCallId, exact native reject_once response, delivery acknowledgement, and original independent marker samples.", + "trace": [ + { + "at": "2026-09-28T20:52:10.678Z", + "elapsedMs": 10771, + "direction": "in", + "message": { + "jsonrpc": "2.0", + "method": "session/update", + "params": { + "sessionId": "fixture-session", + "update": { + "sessionUpdate": "tool_call", + "toolCallId": "fixture-tool", + "title": "`printf 'MUST_NOT_EXIST' > qualification-marker.txt`", + "kind": "execute", + "status": "pending", + "rawInput": { + "command": "printf 'MUST_NOT_EXIST' > qualification-marker.txt" + } + } + } + } + }, + { + "at": "2026-09-28T20:52:10.919Z", + "elapsedMs": 11012, + "direction": "in", + "message": { + "jsonrpc": "2.0", + "id": 0, + "method": "session/request_permission", + "params": { + "sessionId": "fixture-session", + "toolCall": { + "toolCallId": "fixture-tool", + "title": "`printf 'MUST_NOT_EXIST' > qualification-marker.txt`", + "kind": "execute", + "status": "pending", + "content": [ + { + "type": "content", + "content": { + "type": "text", + "text": "Not in allowlist: printf" + } + } + ] + }, + "options": [ + { + "optionId": "allow-once", + "name": "Allow once", + "kind": "allow_once" + }, + { + "optionId": "allow-always", + "name": "Allow always", + "kind": "allow_always" + }, + { + "optionId": "reject-once", + "name": "Reject", + "kind": "reject_once" + } + ] + } + } + }, + { + "at": "2026-09-28T20:52:10.919Z", + "elapsedMs": 11012, + "direction": "out", + "message": { + "jsonrpc": "2.0", + "id": 0, + "result": { + "outcome": { + "outcome": "selected", + "optionId": "reject-once" + } + } + } + } + ], + "markerSamples": [ + { + "at": "2026-09-28T20:52:00.434Z", + "elapsedMs": 527, + "phase": "before_launch", + "exists": false + }, + { + "at": "2026-09-28T20:52:07.564Z", + "elapsedMs": 7657, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:07.664Z", + "elapsedMs": 7757, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:07.765Z", + "elapsedMs": 7858, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:07.866Z", + "elapsedMs": 7959, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:07.967Z", + "elapsedMs": 8060, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:08.068Z", + "elapsedMs": 8162, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:08.169Z", + "elapsedMs": 8262, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:08.270Z", + "elapsedMs": 8363, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:08.371Z", + "elapsedMs": 8464, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:08.473Z", + "elapsedMs": 8566, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:08.574Z", + "elapsedMs": 8667, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:08.675Z", + "elapsedMs": 8768, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:08.776Z", + "elapsedMs": 8869, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:08.877Z", + "elapsedMs": 8970, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:08.979Z", + "elapsedMs": 9072, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:09.079Z", + "elapsedMs": 9172, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:09.179Z", + "elapsedMs": 9272, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:09.279Z", + "elapsedMs": 9373, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:09.381Z", + "elapsedMs": 9474, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:09.482Z", + "elapsedMs": 9575, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:09.583Z", + "elapsedMs": 9676, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:09.684Z", + "elapsedMs": 9777, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:09.785Z", + "elapsedMs": 9878, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:09.886Z", + "elapsedMs": 9980, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:09.986Z", + "elapsedMs": 10079, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:10.087Z", + "elapsedMs": 10181, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:10.188Z", + "elapsedMs": 10281, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:10.288Z", + "elapsedMs": 10381, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:10.389Z", + "elapsedMs": 10482, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:10.490Z", + "elapsedMs": 10583, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:10.590Z", + "elapsedMs": 10683, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:10.691Z", + "elapsedMs": 10784, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:10.791Z", + "elapsedMs": 10884, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:10.892Z", + "elapsedMs": 10986, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:10.992Z", + "elapsedMs": 11086, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:11.093Z", + "elapsedMs": 11186, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:11.194Z", + "elapsedMs": 11287, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:11.295Z", + "elapsedMs": 11388, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:11.396Z", + "elapsedMs": 11489, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:11.498Z", + "elapsedMs": 11591, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:11.599Z", + "elapsedMs": 11692, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:11.700Z", + "elapsedMs": 11793, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:11.801Z", + "elapsedMs": 11894, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:11.902Z", + "elapsedMs": 11995, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:11.980Z", + "elapsedMs": 12073, + "phase": "terminal", + "exists": false + }, + { + "at": "2026-09-28T20:52:12.002Z", + "elapsedMs": 12096, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:12.103Z", + "elapsedMs": 12196, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:12.203Z", + "elapsedMs": 12296, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:12.304Z", + "elapsedMs": 12397, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:12.405Z", + "elapsedMs": 12498, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:12.506Z", + "elapsedMs": 12599, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:12.607Z", + "elapsedMs": 12700, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:12.708Z", + "elapsedMs": 12801, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:12.808Z", + "elapsedMs": 12902, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:12.909Z", + "elapsedMs": 13002, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:13.010Z", + "elapsedMs": 13103, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:13.111Z", + "elapsedMs": 13204, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:13.212Z", + "elapsedMs": 13305, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:13.313Z", + "elapsedMs": 13406, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:13.414Z", + "elapsedMs": 13507, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:13.515Z", + "elapsedMs": 13608, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:13.616Z", + "elapsedMs": 13710, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:13.717Z", + "elapsedMs": 13810, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:13.818Z", + "elapsedMs": 13911, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:13.918Z", + "elapsedMs": 14011, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:14.019Z", + "elapsedMs": 14113, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:14.120Z", + "elapsedMs": 14213, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:14.220Z", + "elapsedMs": 14313, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:14.321Z", + "elapsedMs": 14414, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:14.422Z", + "elapsedMs": 14516, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:14.524Z", + "elapsedMs": 14617, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:14.625Z", + "elapsedMs": 14718, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:14.726Z", + "elapsedMs": 14819, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:14.827Z", + "elapsedMs": 14920, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:14.928Z", + "elapsedMs": 15022, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:15.029Z", + "elapsedMs": 15122, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:15.130Z", + "elapsedMs": 15223, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:15.230Z", + "elapsedMs": 15324, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:15.331Z", + "elapsedMs": 15424, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:15.432Z", + "elapsedMs": 15525, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:15.532Z", + "elapsedMs": 15625, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:15.633Z", + "elapsedMs": 15727, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:15.734Z", + "elapsedMs": 15827, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:15.835Z", + "elapsedMs": 15928, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:15.936Z", + "elapsedMs": 16029, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:16.037Z", + "elapsedMs": 16130, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:16.138Z", + "elapsedMs": 16232, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:16.239Z", + "elapsedMs": 16332, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:16.340Z", + "elapsedMs": 16433, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:16.441Z", + "elapsedMs": 16535, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:16.542Z", + "elapsedMs": 16635, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:16.643Z", + "elapsedMs": 16736, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:16.744Z", + "elapsedMs": 16837, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:16.845Z", + "elapsedMs": 16938, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:16.945Z", + "elapsedMs": 17039, + "phase": "during_turn", + "exists": false + }, + { + "at": "2026-09-28T20:52:16.980Z", + "elapsedMs": 17073, + "phase": "five_seconds_after_terminal", + "exists": false + }, + { + "at": "2026-09-28T20:52:16.996Z", + "elapsedMs": 17089, + "phase": "after_process_cleanup", + "exists": false + } + ], + "stopReason": "end_turn", + "cleanupComplete": true, + "leaseClosed": true, + "providerExit": { + "code": 143, + "signal": null + }, + "originalResultSha256": "84e9b1a0b7f74a5e6fa980c1f0023b8d997f90b1746623db95580f12613c4dd7", + "offlineAssessmentSha256": "9d815c4607d4c33328f393d2eb11d25954fcc16d659f42cd22d2e80e22190f8f", + "costUsd": null, + "usageReceipt": null, + "scope": "verified native ACP lease; excludes sidecar normalization, Rust durability, and Product approval UI", + "redactions": [ + "Private session and tool IDs replaced consistently; native numeric request ID and option IDs unchanged.", + "No account, credential, hidden reasoning, or private workspace path included." + ], + "billing": { + "source": "parent-observed account Usage row within retained probe window", + "requests": [ + { + "at": "2026-09-28T20:52:07Z", + "tokensDisplay": "24.4K" + } + ], + "modelLabel": "gpt-5.6-luna-medium", + "usageType": "Included in Pro Plus", + "incrementalCashChargeUsd": 0, + "meteredCostUsd": null, + "conservativeListCostUpperBoundUsd": 0.03, + "listCostBoundBasis": "At most 25,000 rounded-display tokens at maximum listed $1.20/M; not a billing receipt." + } +} From 72f88877091bb6399717709640468ba03970b9dd Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 15:57:45 -0500 Subject: [PATCH 26/31] docs(runner): record Cursor native EOF lifecycle limit Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 4 +++- .../provider-pack-offline-proof.json | 21 ++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index 22c5f352717..d00e1a69919 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -32,7 +32,7 @@ The reference is the runner's Codex app-server integration and its closed thread | True active-turn steering | No `session/steer`; `handlePrompt` cancels its existing pending prompt before starting another | Advertise steering unsupported | Concurrent prompt is interruption/replacement, not Codex-style in-place steering. Do not mislabel it | | Queued follow-ups | No harness queue method discovered | Control-plane scheduling can send another prompt after settlement | No native queue-management events; do not send concurrently to emulate queueing | | Cancellation | `session/cancel` calls the active prompt cancellation callback | Existing interruption path | Process/child cleanup and exact terminal settlement require live qualification | -| Turn settlement | Prompt implementation drains background subagent completion and awaits child publishers | Existing prompt result terminal boundary | Background shell commands and child errors need live denial/settlement fixtures | +| Turn settlement | Prompt implementation drains background subagent completion and awaits child publishers | Existing prompt result terminal boundary; explicit owned process cleanup | Native write denial settled without side effects. Background shell/child error settlement remains unverified. Credential-free stdin EOF did not exit within five seconds; do not advertise clean EOF | | Session continuity | `session/new`, `session/load`; load replays historical messages, reasoning, tools, images and children | Existing session load/recovery boundary with identity fencing | Duplicate replay suppression and provider-death recovery need authenticated proof | | Session discovery | `session/list` implemented, cwd filter absolute; pagination cursor rejected | Discovered and reported | Currently unused: runner recovers only its exact recorded session; arbitrary history browsing needs company-scoped discovery API | | Fork/resume methods | `session/fork` and `session/resume` absent in agent implementation and return method-not-found | Unsupported | Session load is available; do not infer fork from SDK schema | @@ -94,6 +94,8 @@ The full `build-provider-pack.mjs --candidate-providers=cursor` path passed on s `provider-pack-offline-proof.json` records a real launch through the generic profile installation registry from the pack’s verified native closure and retained snapshot, using private directories and no credentials. ACP v1 initialize succeeds. The correct `cursor/list_available_models`, `session/list` and `session/new` methods return authentication-required; `session/fork` and `session/resume` return method-not-found. The process produced no stderr, was explicitly terminated after these probes, and its lease closed. The earlier discovery fixture’s `_cursor/list_available_models` probe used an incorrect method prefix; this later probe corrects that uncertainty without changing the original evidence. +A separate credential-free macOS probe on the same final pack initialized with JSON-RPC request ID `0`, then closed stdin at 20:56:57.776 UTC. The native process did not exit within five seconds and produced no stderr. The probe then sent the owned process group SIGTERM and closed its native lease. `provider-pack-offline-proof.json` retains `eofSettled:false`. This is a native lifecycle limitation: no clean-EOF guarantee is claimed. Production cleanup uses explicit process ownership and termination; Linux image qualification must separately record EOF behavior and verify bounded explicit cleanup. This probe sent no credentials or model prompts. + At the prior foundation checkpoint `7721662f2`, the TypeScript/verified-sidecar build and all 177 targeted cases passed: Cursor normalization/policy/artifacts, credential bindings, the durable launcher's actual process specification, candidate backend admission, and sidecar behavior. The actual process-launch regressions verify explicit candidate credentials and their marker survive the final closed allowlist; ambient credentials and caller-supplied markers cannot select themselves. The prior source `f09a9a3f8` passed all 47 CI jobs after one retry for runner shutdown and a wall-clock rate-limit case, plus Greptile 5/5; it also passed 29 installed ACPX/materializer Node cases and 6 Daytona image-content cases. These prior results remain historical, distinct from the final source proof. The current pack/probe binds foundation `f063fbf2b`, including candidate admission, biller attribution, explicit unavailable usage, actual-spawn credential binding, and preservation of usage receipts on terminal provider failure. The verified TypeScript build, 56 Cursor/sidecar/eval-provider tests, 67 shared live/eval tests, and 25 mixed-usage contract tests passed during these qualification fixes. Earlier pack evidence remains in Git history. Its explicit offline factory model sentinel is not an authenticated model selection; no ACP prompt was sent. Daytona content identity includes the candidate selection, Cursor materializer and distribution manifest. This is local macOS ARM64 packaging/initialization evidence only. It does not qualify Linux execution, a Daytona image build/run, authenticated model work, permissions, or dollar accounting. No screenshot is claimed for these headless tests. That offline probe submitted no prompts and incurred no model usage. Subsequent authenticated attempts are recorded separately below. diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json index ab025aeb2b7..875aa4376df 100644 --- a/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/provider-pack-offline-proof.json @@ -181,5 +181,24 @@ }, "redactions": [ "ephemeral workspace and private directories replaced with /qualification/private" - ] + ], + "nativeEofProbe": { + "provider": "cursor", + "packSource": "25fb1b5b317e52a8ad50208d7681a1ee34bd939c", + "credentials": false, + "prompts": 0, + "startedAt": "2026-09-28T20:56:56.035Z", + "initialized": true, + "eofAt": "2026-09-28T20:56:57.776Z", + "eofSettled": false, + "exit": null, + "stderrBytes": 0, + "finishedAt": "2026-09-28T20:57:02.777Z", + "platform": "darwin", + "architecture": "arm64", + "gracefulExitDeadlineMs": 5000, + "fallback": "explicit owned process-group SIGTERM and native lease close", + "qualification": "EOF non-settlement observed; explicit cleanup is the supported runner lifecycle", + "evidenceSha256": "b99e972c14d1dbd731a5cef4d06e6ea54af6574fb4fe26fd44e78dfa9913fd7b" + } } From e8dee462e2fd09cf858be0a02368805346ec4f3b Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 16:01:36 -0500 Subject: [PATCH 27/31] Admit versioned ACP profile snapshots for the Pi error contract Allow profile version 3 without changing existing provider identities. Reject unsupported and malformed versions, and retain exact runtime identity verification. Co-Authored-By: Paperclip --- .../src/contracts/native-execution.test.ts | 11 +++++++++-- .../src/contracts/native-execution.ts | 4 ++-- .../src/drivers/acpx/qualified-profiles.ts | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/paperclip-runner/src/contracts/native-execution.test.ts b/packages/paperclip-runner/src/contracts/native-execution.test.ts index 8d1ddee0a15..06b8c83a84e 100644 --- a/packages/paperclip-runner/src/contracts/native-execution.test.ts +++ b/packages/paperclip-runner/src/contracts/native-execution.test.ts @@ -280,7 +280,7 @@ describe("NativeExecutionInputV1", () => { })).toThrow("eventExpiryDays"); }); - it("accepts only a closed ACPX profile matching the driver and agent", () => { + it.each([1, 2, 3] as const)("accepts only a closed ACPX profile matching the driver and agent at profile version %s", (agentProfileVersion) => { const provider = { kind: "acpx", agent: "pi", @@ -291,7 +291,7 @@ describe("NativeExecutionInputV1", () => { protocolVersion: 1, acpxVersion: "0.13.1", agent: "pi", - agentProfileVersion: 1, + agentProfileVersion, agentServerPackage: "pi-acp", agentServerVersion: "0.0.33", agentRuntimePackage: "@earendil-works/pi-coding-agent", @@ -312,6 +312,13 @@ describe("NativeExecutionInputV1", () => { profile: provider.profile, }); expect(parseNativeExecutionInput(parsed)).toEqual(parsed); + for (const unsupportedVersion of [0, 4, 1.5, "3", null]) { + expect(() => parseNativeExecutionInput({ + ...input, + session: { ...input.session, driverKind: "acpx_runtime" }, + provider: { ...provider, profile: { ...provider.profile, agentProfileVersion: unsupportedVersion } }, + })).toThrow("qualified ACPX v1 profile"); + } expect(buildNativeModelEnvelope(parsed).workspace).toEqual({ cwd: "/safe/workspace" }); expect(() => parseNativeExecutionInput({ ...input, diff --git a/packages/paperclip-runner/src/contracts/native-execution.ts b/packages/paperclip-runner/src/contracts/native-execution.ts index ab8aac4ed76..0416a4cf603 100644 --- a/packages/paperclip-runner/src/contracts/native-execution.ts +++ b/packages/paperclip-runner/src/contracts/native-execution.ts @@ -90,7 +90,7 @@ export interface NativeAcpxProfileSnapshot { protocolVersion: 1; acpxVersion: "0.13.1"; agent: NativeAcpxAgent; - agentProfileVersion: 1 | 2; + agentProfileVersion: 1 | 2 | 3; agentServerPackage: string; agentServerVersion: string; agentRuntimePackage: string | null; @@ -596,7 +596,7 @@ export function parseNativeExecutionInput(value: unknown): NativeExecutionInput || profile.protocolVersion !== 1 || profile.acpxVersion !== "0.13.1" || profile.agent !== provider.agent - || (profile.agentProfileVersion !== 1 && profile.agentProfileVersion !== 2) + || (profile.agentProfileVersion !== 1 && profile.agentProfileVersion !== 2 && profile.agentProfileVersion !== 3) ) { throw new NativeExecutionInputError("input.provider.profile does not match the qualified ACPX v1 profile"); } diff --git a/packages/paperclip-runner/src/drivers/acpx/qualified-profiles.ts b/packages/paperclip-runner/src/drivers/acpx/qualified-profiles.ts index aff023bb8f1..902707dea44 100644 --- a/packages/paperclip-runner/src/drivers/acpx/qualified-profiles.ts +++ b/packages/paperclip-runner/src/drivers/acpx/qualified-profiles.ts @@ -11,7 +11,7 @@ export interface QualifiedAcpxProfile { readonly protocolVersion: typeof ACPX_DRIVER_PROTOCOL_VERSION; readonly acpxVersion: typeof QUALIFIED_ACPX_VERSION; readonly agent: QualifiedAcpxAgent; - readonly agentProfileVersion: 1 | 2; + readonly agentProfileVersion: 1 | 2 | 3; readonly qualificationStatus?: "pending"; readonly modelPolicy?: "explicit-provider-verified"; /** Wire identity: an npm package name or a runner-owned builtin: identifier. */ From f676c9d2c81470a9f1684e59af24fb4f23975609 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 16:06:05 -0500 Subject: [PATCH 28/31] docs(runner): record offline Cursor Linux image verification Co-Authored-By: Paperclip --- .../runner-cursor-capabilities.md | 4 +- .../cursor-acp/linux-image-offline-proof.json | 47 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 packages/paperclip-runner/test/fixtures/cursor-acp/linux-image-offline-proof.json diff --git a/doc/architecture/runner-cursor-capabilities.md b/doc/architecture/runner-cursor-capabilities.md index d00e1a69919..ef9384b8d3d 100644 --- a/doc/architecture/runner-cursor-capabilities.md +++ b/doc/architecture/runner-cursor-capabilities.md @@ -102,6 +102,8 @@ The current pack/probe binds foundation `f063fbf2b`, including candidate admissi The final pack passed 31 installed-package/materializer contract tests, 82 Cursor/integrity profile tests (six platform-specific skips), and 12 candidate/image-content tests. TypeScript and verified-sidecar compilation passed. Its generic installation registry probe initialized the pinned native executable without credentials or prompts, then shut down cleanly. A fresh release daemon was built from source `78360fa55adff11da9f200b228467eca782b81e1`, Rust tree `17d327094be5759d80ef5bd02e15c59e78548ea2` (identical to foundation `f063fbf2b`), SHA256 `e6a9fb5170b76a49b8411834b3706e8edf8f1a1ae85ad13b55368158aa7f67a0`. This source includes bounded snapshot copying and public Grok packaging. Earlier paid attempts retain their original sources, package identities, and daemon digests; refreshing packaging does not rerun or extend their qualification. +The locally built Linux x64 image also passed credential-free native initialization through the generic installation registry and immutable lease, with Docker networking disabled. Image ID is `sha256:5fa7951d1d6dd99305555fe00a5baf2bf5b834d16f021053737301975b93986f`, built from provider source `25fb1b5b317e52a8ad50208d7681a1ee34bd939c`. The Linux pack digest is `sha256:5fab4bc1f0633561b7d7e858a535ebd23faeccedb5f86044df071a3206d949ba`; the runner daemon SHA256 is `5eb3031aed118112caf0b80ea67a6cd01283098e2b4e526ef02d1416d125a1fb`. The pinned Cursor closure is `sha256:bf04ef8ea6a63191067a6b3e15139aa2c793d8419daab246aa3f0a012e1bbcd9`. ACP initialize request ID `0` returned protocol version 1. Linux also reported `eofSettled:false`; bounded explicit process-group termination and lease cleanup passed. `linux-image-offline-proof.json` retains the identities and limits. This local container proof sent no credentials or model prompts and is not a paid Daytona run or authenticated Linux qualification. + ## Authenticated discovery evidence `test/fixtures/cursor-acp/authenticated-capability-probe.json` records the user-authorized follow-up on 2026-09-28. The pinned verified distribution returned 41 model entries, created a session, accepted `gpt-5.6-luna[context=272k,reasoning=medium,fast=false]` through both `session/set_model` and `session/set_config_option`, and returned that exact value. No model prompt was sent. These facts establish authentication and model selection, not inference entitlement or full runner qualification. @@ -158,4 +160,4 @@ This source audit follows pinned native update → ACPX runtime → `canonicalPr | Task numeric `durationMs`, optional accepted `planUri` | Native task/plan extensions | Duration is visible in summary; no numeric delegation field. No plan URI is returned because no plan artifact is registered | P2: typed duration; only return an actually registered plan URI | | Session list, model parameters, generic mode control | Confirmed native ACP methods | No operator UI or cross-session discovery API in this integration; recovery loads only the runner-owned exact session | P2: explicit company-scoped controls; authenticated model catalog first | -True steering, native queueing, fork/resume, native usage receipts and interactive child questions are absent from this pinned ACP implementation as described above. Their absence is distinct from the implemented-but-unused fields in this table. Remote team hooks, provider-native artifact traces, interruption settlement and Linux/Daytona behavior remain unverified, not confirmed absent. +True steering, native queueing, fork/resume, native usage receipts and interactive child questions are absent from this pinned ACP implementation as described above. Their absence is distinct from the implemented-but-unused fields in this table. Remote team hooks, provider-native artifact traces, interruption settlement and authenticated Linux/Daytona behavior remain unverified, not confirmed absent. diff --git a/packages/paperclip-runner/test/fixtures/cursor-acp/linux-image-offline-proof.json b/packages/paperclip-runner/test/fixtures/cursor-acp/linux-image-offline-proof.json new file mode 100644 index 00000000000..c30cda56e4b --- /dev/null +++ b/packages/paperclip-runner/test/fixtures/cursor-acp/linux-image-offline-proof.json @@ -0,0 +1,47 @@ +{ + "schema": "paperclip.cursor-linux-image-proof/v1", + "recordedAt": "2026-09-28T21:06:05.761523+00:00", + "imageId": "sha256:5fa7951d1d6dd99305555fe00a5baf2bf5b834d16f021053737301975b93986f", + "execution": "local Docker linux/x64; network disabled", + "verification": "generic profile installation registry, pinned full native closure, retained immutable lease, ACP initialize request ID 0", + "native": { + "provider": "cursor", + "target": { + "platform": "linux", + "architecture": "x64" + }, + "sourceSha": "25fb1b5b317e52a8ad50208d7681a1ee34bd939c", + "packDigest": "sha256:5fab4bc1f0633561b7d7e858a535ebd23faeccedb5f86044df071a3206d949ba", + "candidate": { + "version": "2026.09.26-dd393fe", + "profileDigest": "sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899", + "closureDigest": "sha256:bf04ef8ea6a63191067a6b3e15139aa2c793d8419daab246aa3f0a012e1bbcd9", + "qualification": "pending", + "path": "provider-assets/cursor/linux-x64", + "sha256": "sha256:96fc36b9c1e77f307e487dfcc8d5e7fc2caa7ed68d41e9cb33793c00a8281bdc" + }, + "commandDigest": "sha256:1157a5d071abbd57ab132f22bace75c65e84cc47a045b0023475488755e14899", + "runnerdSha256": "5eb3031aed118112caf0b80ea67a6cd01283098e2b4e526ef02d1416d125a1fb", + "protocolVersion": 1, + "nativeInfo": null, + "exitCode": null, + "eofSettled": false, + "prompts": 0, + "network": "none", + "credentials": false + }, + "cleanup": { + "method": "bounded explicit owned process-group termination and native lease close", + "result": "passed", + "evidence": "lead-observed image probe completion; native clean EOF is explicitly not claimed" + }, + "sourceProofSha256": "0d67a62f77b87440c3965426b318e552e5f2956ede62e13e0a28c813d95ca83d", + "qualification": { + "status": "pending", + "daytonaExecution": false, + "authenticatedSession": false, + "modelPrompts": 0, + "modelUsageCostUsd": 0, + "limitation": "Packaging/initialization and explicit cleanup only; no authenticated tools, interaction, recovery, permissions, or paid Daytona qualification." + } +} From a88056eee95146dc035abede5311e3f407df009c Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 16:09:38 -0500 Subject: [PATCH 29/31] Stabilize feedback route mocks during serialized validation Keep the route service factories bound to hoisted test doubles and assert exact calls while preserving both company-boundary 404 checks. Co-Authored-By: Paperclip --- .../__tests__/issue-feedback-routes.test.ts | 112 ++++++++---------- 1 file changed, 52 insertions(+), 60 deletions(-) diff --git a/server/src/__tests__/issue-feedback-routes.test.ts b/server/src/__tests__/issue-feedback-routes.test.ts index 31e625e6fe4..e59fe6d1e91 100644 --- a/server/src/__tests__/issue-feedback-routes.test.ts +++ b/server/src/__tests__/issue-feedback-routes.test.ts @@ -72,61 +72,60 @@ const mockIssueReferenceService = vi.hoisted(() => ({ syncIssue: vi.fn(async () => undefined), })); -function registerModuleMocks() { - vi.doMock("@paperclipai/shared/telemetry", () => ({ - trackAgentTaskCompleted: vi.fn(), - trackErrorHandlerCrash: vi.fn(), - })); +// Keep service factories stable while each request uses the hoisted test doubles. +vi.mock("@paperclipai/shared/telemetry", () => ({ + trackAgentTaskCompleted: vi.fn(), + trackErrorHandlerCrash: vi.fn(), +})); - vi.doMock("../telemetry.js", () => ({ - getTelemetryClient: vi.fn(() => ({ track: vi.fn() })), - })); +vi.mock("../telemetry.js", () => ({ + getTelemetryClient: vi.fn(() => ({ track: vi.fn() })), +})); - vi.doMock("../services/index.js", () => ({ - companyService: () => ({ - getById: vi.fn(async () => ({ id: "company-1" })), - }), - accessService: () => mockAccessService, - agentService: () => mockAgentService, - companySkillService: () => ({ - completeTestRunForIssue: vi.fn(async () => null), - }), - documentAnnotationService: () => ({ remapOpenThreadsForDocument: async () => [] }), - documentService: () => ({}), - executionWorkspaceService: () => mockExecutionWorkspaceService, - goalService: () => ({}), - heartbeatService: () => mockHeartbeatService, - issueApprovalService: () => ({}), - issueReferenceService: () => mockIssueReferenceService, - issueRecoveryActionService: () => ({ - getActiveForIssue: vi.fn(async () => null), - listActiveForIssues: vi.fn(async () => new Map()), - }), - issueService: () => mockIssueService, - issueThreadInteractionService: () => mockIssueThreadInteractionService, - logActivity: mockLogActivity, - projectService: () => ({}), - routineService: () => mockRoutineService, - workProductService: () => ({}), - })); +vi.mock("../services/index.js", () => ({ + companyService: () => ({ + getById: vi.fn(async () => ({ id: "company-1" })), + }), + accessService: () => mockAccessService, + agentService: () => mockAgentService, + companySkillService: () => ({ + completeTestRunForIssue: vi.fn(async () => null), + }), + documentAnnotationService: () => ({ remapOpenThreadsForDocument: async () => [] }), + documentService: () => ({}), + executionWorkspaceService: () => mockExecutionWorkspaceService, + goalService: () => ({}), + heartbeatService: () => mockHeartbeatService, + issueApprovalService: () => ({}), + issueReferenceService: () => mockIssueReferenceService, + issueRecoveryActionService: () => ({ + getActiveForIssue: vi.fn(async () => null), + listActiveForIssues: vi.fn(async () => new Map()), + }), + issueService: () => mockIssueService, + issueThreadInteractionService: () => mockIssueThreadInteractionService, + logActivity: mockLogActivity, + projectService: () => ({}), + routineService: () => mockRoutineService, + workProductService: () => ({}), +})); - vi.doMock("../services/environments.js", () => ({ - environmentService: () => mockEnvironmentService, - })); +vi.mock("../services/environments.js", () => ({ + environmentService: () => mockEnvironmentService, +})); - vi.doMock("../services/execution-workspaces.js", () => ({ - executionWorkspaceService: () => mockExecutionWorkspaceService, - STALE_REOPEN_PENDING_CONSUMPTION_GRACE_MS: 5 * 60 * 1000, - })); +vi.mock("../services/execution-workspaces.js", () => ({ + executionWorkspaceService: () => mockExecutionWorkspaceService, + STALE_REOPEN_PENDING_CONSUMPTION_GRACE_MS: 5 * 60 * 1000, +})); - vi.doMock("../services/feedback.js", () => ({ - feedbackService: () => mockFeedbackService, - })); +vi.mock("../services/feedback.js", () => ({ + feedbackService: () => mockFeedbackService, +})); - vi.doMock("../services/instance-settings.js", () => ({ - instanceSettingsService: () => mockInstanceSettingsService, - })); -} +vi.mock("../services/instance-settings.js", () => ({ + instanceSettingsService: () => mockInstanceSettingsService, +})); async function createApp(actor: Record) { const [{ issueRoutes }, { errorHandler }] = await Promise.all([ @@ -152,17 +151,6 @@ async function createApp(actor: Record) { describe("issue feedback trace routes", () => { beforeEach(() => { - vi.resetModules(); - vi.doUnmock("@paperclipai/shared/telemetry"); - vi.doUnmock("../telemetry.js"); - vi.doUnmock("../services/index.js"); - vi.doUnmock("../services/environments.js"); - vi.doUnmock("../services/execution-workspaces.js"); - vi.doUnmock("../services/feedback.js"); - vi.doUnmock("../services/instance-settings.js"); - vi.doUnmock("../routes/issues.js"); - vi.doUnmock("../middleware/index.js"); - registerModuleMocks(); vi.clearAllMocks(); mockFeedbackExportService.flushPendingFeedbackTraces.mockResolvedValue({ attempted: 1, @@ -260,6 +248,8 @@ describe("issue feedback trace routes", () => { const res = await request(app).get("/api/feedback-traces/trace-1"); expect(res.status, JSON.stringify({ body: res.body, errors: app.locals.routeErrors })).toBe(404); + expect(mockFeedbackService.getFeedbackTraceById).toHaveBeenCalledExactlyOnceWith("trace-1", true); + expect(mockFeedbackService.getFeedbackTraceBundle).not.toHaveBeenCalled(); }); it("returns 404 for bundle fetches when a board user lacks access to the trace company", async () => { @@ -280,5 +270,7 @@ describe("issue feedback trace routes", () => { const res = await request(app).get("/api/feedback-traces/trace-1/bundle"); expect(res.status, JSON.stringify({ body: res.body, errors: app.locals.routeErrors })).toBe(404); + expect(mockFeedbackService.getFeedbackTraceBundle).toHaveBeenCalledExactlyOnceWith("trace-1"); + expect(mockFeedbackService.getFeedbackTraceById).not.toHaveBeenCalled(); }); }); From ee0836203f536303259995ad6135463df3629395 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 16:11:34 -0500 Subject: [PATCH 30/31] Refresh reviewed Daytona workspace resolution pin Record the independently reproduced resolved lock digest after the integrated mainline dependency changes. Candidate image builds continue to supply their own verified lock digest. Co-Authored-By: Paperclip --- docker/daytona-runner/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/daytona-runner/Dockerfile b/docker/daytona-runner/Dockerfile index 6d544f6e02c..50c22ec37c0 100644 --- a/docker/daytona-runner/Dockerfile +++ b/docker/daytona-runner/Dockerfile @@ -28,7 +28,7 @@ COPY cli/package.json ./cli/package.json # The complete resolved lock (including transitive integrity hashes) is reviewed. # Reject registry-time drift BEFORE installing packages or running lifecycle code. # Refresh this digest together with source/provider dependency changes. -ARG PAPERCLIP_RUNNER_LOCK_SHA256=9c163adf40fe1c6a65abda6207bd9f5acfc8196bc94f81348b8bf1b2769e050e +ARG PAPERCLIP_RUNNER_LOCK_SHA256=2c46a68811ba1d504a41b6f4d3f642bc93f4a1c615097754c9c6486881dba8e6 RUN printf '%s pnpm-lock.yaml\n' "${PAPERCLIP_RUNNER_LOCK_SHA256}" > /tmp/provider-lock.sha256 \ && sha256sum -c /tmp/provider-lock.sha256 \ && pnpm install --frozen-lockfile --filter '@paperclipai/paperclip-runner...' From 915adc4d331fb19e2207814efafdcaabc4395915 Mon Sep 17 00:00:00 2001 From: Dotta Date: Mon, 28 Sep 2026 16:22:19 -0500 Subject: [PATCH 31/31] Keep real Git streaming stress coverage portable on macOS Retain forty thousand files and four filename lanes above 32 MiB while fitting the macOS path limit. Allow 300 seconds for real filesystem staging/deletion on macOS and retain the 180-second bound elsewhere. Co-Authored-By: Paperclip --- .../workspace-git-snapshot-streaming.test.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/server/src/services/workspace-git-snapshot-streaming.test.ts b/server/src/services/workspace-git-snapshot-streaming.test.ts index 19bfa648872..fa6a8247cb6 100644 --- a/server/src/services/workspace-git-snapshot-streaming.test.ts +++ b/server/src/services/workspace-git-snapshot-streaming.test.ts @@ -51,8 +51,10 @@ function localClient(commands: string[]): SandboxManagedRuntimeClient { }; } +// macOS adds per-file process and filesystem overhead to the real deletion lane. +const realGitTimeoutMs = process.platform === "darwin" ? 300_000 : 180_000; it("streams and stages all four real Git filename lanes above 32 MiB through the shared scheduler", async () => { - const root = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-streaming-real-git-")); + const root = await fs.realpath(await fs.mkdtemp(path.join(os.tmpdir(), "pc-stream-git-"))); directories.push(root); const repo = path.join(root, "repo"); await fs.mkdir(repo); @@ -60,7 +62,9 @@ it("streams and stages all four real Git filename lanes above 32 MiB through the const git = (args: string[]) => runLocalGit(repo, args, { env, timeout: 120_000, maxBuffer: 64 * 1024 }); await git(["init"]); await git(["commit", "--allow-empty", "-qm", "fixture"]); - const parent = path.join(repo, ...Array.from({ length: 4 }, () => "nested-".repeat(30)), "storybook-output"); + // Leave room for the fixture/staging root below macOS's 1,024-byte path + // limit while keeping each 40,000-name Git lane above the 32 MiB boundary. + const parent = path.join(repo, ...Array.from({ length: 3 }, () => "nested-".repeat(30)), "storybook-output"); await fs.mkdir(parent, { recursive: true }); const fileName = (index: number) => `${"asset-".repeat(36)}${index}.js`; const writeFiles = async (content: string) => { @@ -92,7 +96,8 @@ it("streams and stages all four real Git filename lanes above 32 MiB through the bytes += Buffer.byteLength(relative) + 1; } expect(count).toBe(40_000); - expect(bytes).toBe(43_428_890); + expect(bytes).toBe(34_988_890); + expect(bytes).toBeGreaterThan(32 * 1024 * 1024); }; // Standalone callers must use the same streaming semantics. setExpensiveWorkspaceGitExecutor(null); @@ -147,4 +152,4 @@ it("streams and stages all four real Git filename lanes above 32 MiB through the expect(remaining).toBe(0); expect(commands.every((command) => command.length < 16 * 1024)).toBe(true); expect(scheduler.snapshot()).toMatchObject({ activeCount: 0, queuedCount: 0, inFlightCount: 0, cacheBytes: 0 }); -}, 180_000); +}, realGitTimeoutMs);