Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
chore(composer): complete file reference validation gates
Linuxdazhao852911aef80f
diff --git a/apps/desktop/test/composer-input-history.test.mjs b/apps/desktop/test/composer-input-history.test.mjsindex 12cc004c5..75e23faad 100644--- a/apps/desktop/test/composer-input-history.test.mjs+++ b/apps/desktop/test/composer-input-history.test.mjs@@ -79,6 +79,21 @@ test("records per conversation, newest-first, collapsing consecutive duplicatesassert.deepEqual(texts("s1"), ["b", "a"]);});+test("local file history restores path, size and reference metadata without a source snapshot", () => {+ const storage = installStorage();+ const reference = {+ path: "/synthetic/unavailable-large-file.bin", name: "large-file.bin", kind: "file",+ size: 67108865, localReference: "11111111-2222-4333-8444-555555555555", token: "\ue001",+ };+ rememberComposerInput("source", snap("Inspect \ue001", [reference]));+ assert.deepEqual(loadComposerInputHistory("source")[0].fileReferences, [reference]);+ const stored = JSON.parse(storage.get(KEY)).sessions[0].entries[0].fileReferences[0];+ assert.deepEqual(stored, reference, "history stores only the live reference metadata");+ const harness = createHarness("store", { sessionId: "source" });+ harness.run("older", { draftEmpty: true });+ assert.deepEqual(harness.state.applied[0].references, [{ ...reference, attached: true }]);+});+test("a conversation never recalls another conversation's prompts (AC1)", () => {installStorage();rememberComposerInput("s1", snap("from A"));diff --git a/crates/host-core/src/sessions.rs b/crates/host-core/src/sessions.rsindex 433f5183a..aca114058 100644--- a/crates/host-core/src/sessions.rs+++ b/crates/host-core/src/sessions.rs@@ -5960,7 +5960,11 @@ mod tests {fn local_file_attachments_roundtrip_as_canonical_blocks() {let db = test_db();let session = create_session(&db, None, None, None, None, None).unwrap();- let mut user = user_msg("local-file", "Inspect the reference", "2026-11-13T00:00:00Z");+ let mut user = user_msg(+ "local-file",+ "Inspect the reference",+ "2026-11-13T00:00:00Z",+ );user.attachments = Some(vec | Accepted (D682; amends ADR 0342 §4 and §6) || 0345 | [One settings destination owns one subject](0345-one-settings-destination-one-subject.md) | Accepted (D684; amends D143, D166, D678) || 0346 | [`@agent` mentions route a turn to a named subagent](0346-composer-agent-mentions.md) | Accepted (issue #986; extends 0024 / 0062) |+| composer-local-file-references | [Pasted local files are live references](composer-local-file-references.md) | Accepted (issue #2314) |diff --git a/docs/adr/composer-local-file-references.md b/docs/adr/composer-local-file-references.mdindex 4f20b6084..cf81ba7d8 100644--- a/docs/adr/composer-local-file-references.md+++ b/docs/adr/composer-local-file-references.md@@ -29,6 +29,12 @@ Read path. Screenshots and other generated clipboard payloads retain existingscratch materialization and model image checks. Native picker and drop behavioris unchanged.+Input history retains the original path, reference id, display metadata and size+captured with the draft. Recording and restoring a reference perform no source+reads or snapshots. Unavailable sources remain restorable and are reported at+dispatch. Restored cards retain their removable inline tokens; dispatch refreshes+the byte size again.+## ConsequencesThe file transfer byte limits still protect actual transfers, while native