Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions docs/host-persistence.md
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,13 @@ writes which Pie intentionally does not own:
**Daemon cold transcript open** is a Developer-approved exception: while a
Pie session holds no live Pi child and none is starting, that session may
call `SessionManager.findById` and then `SessionManager.open` in the daemon
process (`packages/server/src/harness/session.ts`). Pi 0.99.1 still owns the
file format. `open` is not read-only. On Pi 0.99.1 it may rewrite the
transcript when repairing or migrating it:
process (`packages/server/src/harness/session.ts`). Pi still owns the file
format. `open` is not read-only. On Pi 0.99.1 and 1.0.2 it may rewrite the
transcript when repairing or migrating it. Pi 1.0.2's `open` matches 0.99.1:
`dist/core/session-manager.js` is byte-identical, as are the modules it
depends on (`dist/core/messages.js`, `dist/utils/paths.js`), and the
`config.js` exports it uses (`getAgentDir`, `getSessionsDir`, `APP_NAME`)
are unchanged, so 1.0.2 adds no `open` side effects:

| Property | Current contract |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -580,9 +584,22 @@ writes which Pie intentionally does not own:
| Repair writes | Only inside Pi's `open`, and only for these cases. A final parsed entry with no trailing newline is repaired by appending one `\n` (`appendFileSync`) after the header is validated. A header version below 3 (missing counts as 1) is migrated in memory and the whole file is rewritten by `_rewriteFile` (`openSync` with `"w"`, then one JSON line plus `\n` per entry). A zero-byte file is rewritten with a version-3 session header at that same path. A non-empty file that is not a Pi session throws and is left unchanged. |
| Atomicity | Newline repair is one append. `_rewriteFile` truncates then rewrites; it is not temp-file plus rename. A crash during that rewrite can leave a short file. |
| Concurrency | One Pie session holds at most one daemon `SessionManager`. A held or still-starting Pi child is the only reader; the daemon does not `open` then. Starting or releasing the child drops the daemon handle first so the two do not both keep the file. There is no lock against another daemon or a user `pi` on the same file. A cold read that already opened may still fold its in-memory copy after the handle is dropped; it does not append. |
| Compatibility | Migrated files stay at version 3. Pie downgrade does not reverse the migration, the added newline, or a header written into a previously empty file. Older JSONL readers can still read the rewritten lines if they tolerate version 3. Further `open` side effects in a newer Pi need a new persistence decision. |
| Compatibility | Migrated files stay at version 3. Pie downgrade does not reverse the migration, the added newline, or a header written into a previously empty file. Older JSONL readers can still read the rewritten lines if they tolerate version 3. The comparison above covers Pi 1.0.2; it adds no `open` side effects. Further `open` side effects in a Pi newer than 1.0.2 need a new persistence decision. |
| Retention | Pie session delete and uninstall do not remove the transcript or directories `findById` created. Permissions follow the process umask. Transcripts may contain prompts and tool output; this path does not copy them into Pie logs. |

**MCP OAuth credentials** are Pi-owned state in
`$PI_CODING_AGENT_DIR/mcp-auth.json` (`PI_CODING_AGENT_DIR` defaults to
`~/.pi/agent`). Pi 1.0 keys entries by server name and URL
(`mcp__<name>|<url>`, with `-` in the name replaced by `_`) instead of the
URL alone. The first time a server loads a legacy URL-only entry, Pi copies
it onto that server's name+URL key and deletes the URL-only key. Another
server with the same URL does not receive those credentials and must sign
in. The file holds OAuth client registration and tokens. Pi creates it mode
`0600` and rewrites it in place under its auth-file lock. Pie does not read,
migrate, or delete it, and uninstall does not remove it. A Pie or `pi` older
than 1.0 that uses the same agent directory, including after rollback, still
looks up the URL-only key, so those MCP servers must be signed in again.

2. **Workspace mutation.** Agent tools and commands may create, edit, rename, or
delete arbitrary files under the selected project/worktree and may invoke
other host tools with their own state. The paths and data structures are
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/harness/pi/rpc/json-event.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Vendored from @earendil-works/pi-coding-agent v0.99.1
* Vendored from @earendil-works/pi-coding-agent v1.0.2
* (`packages/coding-agent/src/modes/json-event.ts`).
*/

Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/harness/pi/rpc/jsonl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Vendored from @earendil-works/pi-coding-agent v0.99.1
* Vendored from @earendil-works/pi-coding-agent v1.0.2
* (`packages/coding-agent/src/modes/rpc/jsonl.ts`).
*/

Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/harness/pi/rpc/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Pie-owned Pi RPC child. Session construction uses the published SDK;
* the JSONL loop is `./rpc-mode.ts` (vendored from Pi v0.99.1).
* the JSONL loop is `./rpc-mode.ts` (vendored from Pi v1.0.2).
*
* Do not import package `runRpcMode` or spawn `./rpc-entry`: pie owns
* extension bind/UI/protocol here, and extension loading via
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/harness/pi/rpc/output-guard.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Vendored from @earendil-works/pi-coding-agent v0.99.1
* Vendored from @earendil-works/pi-coding-agent v1.0.2
* (`packages/coding-agent/src/core/output-guard.ts`).
* RPC JSONL must own stdout; agent console noise is redirected to stderr.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/harness/pi/rpc/rpc-mode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Vendored from @earendil-works/pi-coding-agent v0.99.1
* Vendored from @earendil-works/pi-coding-agent v1.0.2
* (`packages/coding-agent/src/modes/rpc/rpc-mode.ts`).
*
* Pie owns this loop so extension bind (`session.bindExtensions`), the RPC
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/harness/pi/rpc/rpc-types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Vendored from @earendil-works/pi-coding-agent v0.99.1
* Vendored from @earendil-works/pi-coding-agent v1.0.2
* (`packages/coding-agent/src/modes/rpc/rpc-types.ts`).
* Pie owns this command table.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/server/test/harness/pi/rpc-bundle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ layer(NodeServices.layer, { excludeTestServices: true })("Pi RPC bundle", (it) =
assert.equal(getModel("xai", "grok-4.6").provider, "xai");
assert.ok(builtInExtensions.some((extension) => extension.name === "llama.cpp"));
assert.equal(getPackageDir(), path.join(process.cwd(), "runtime"));
assert.equal(VERSION, "0.99.1");
assert.equal(VERSION, "1.0.2");
for (const file of [getReadmePath(), path.join(getDocsPath(), "extensions.md"),
path.join(getExamplesPath(), "sdk/06-extensions.ts"),
path.join(getPackageDir(), "CHANGELOG.md")]) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/dist/index.d.ts b/dist/index.d.ts
index 045ddb2aaa9dc0b2f1dc9c4cd81e4278a08131d2..da92b3d93de07227423220d8b66de2c76307f4b4 100644
index 9f9bd7370e5ecc288de58d20e81b2a0aadb6ea4b..a8182623f7fc65fc859806a1a007900862f36bfe 100644
--- a/dist/index.d.ts
+++ b/dist/index.d.ts
@@ -1,3 +1,5 @@
Expand Down Expand Up @@ -290,18 +290,18 @@ index 7c40360ce63bc65d8eff063379bfce8646e9389b..a445a5f73bd4f129faaddc6db761c3e9
+export function supportsLanguage(_name) { return false; }
diff --git a/examples/extensions/custom-provider-anthropic/package-lock.json b/examples/extensions/custom-provider-anthropic/package-lock.json
deleted file mode 100644
index 0f04a4b6e990ec2354e48dd096522edbe95fe8bf..0000000000000000000000000000000000000000
index bd05ded4a4e3fa90b71cd5167e46fba1060c1822..0000000000000000000000000000000000000000
diff --git a/examples/extensions/gondolin/package-lock.json b/examples/extensions/gondolin/package-lock.json
deleted file mode 100644
index 8ccf39f0447d6635656ae041d9cffc842f7099cb..0000000000000000000000000000000000000000
index cd411a5c669fa5020451ee5df7abea0fdf92b903..0000000000000000000000000000000000000000
diff --git a/examples/extensions/sandbox/package-lock.json b/examples/extensions/sandbox/package-lock.json
deleted file mode 100644
index b701a1ba670ce5ea05dfcd5c5e7566ba7f703810..0000000000000000000000000000000000000000
index 8966a1ac64e89bbf59340c3eab342432926f5886..0000000000000000000000000000000000000000
diff --git a/examples/extensions/with-deps/package-lock.json b/examples/extensions/with-deps/package-lock.json
deleted file mode 100644
index 2b01794b0f89bcebf1d6bf38cbf356d65b8fe6b9..0000000000000000000000000000000000000000
index dff4bb95909145d4d7677322458af92b48f39371..0000000000000000000000000000000000000000
diff --git a/package.json b/package.json
index 22b6fdcb43e81f4eb7f782c44e4d659293dcb544..c5012a27d2bebc9358970b0cabf7c270eefefbd6 100644
index 90f4c62dcd7e5ce51134f5da9f69937eba7da02d..01ece5041cc8017d99562f279054e908d7bdae6f 100644
--- a/package.json
+++ b/package.json
@@ -16,6 +16,14 @@
Expand Down
Loading
Loading