refactor(sandbox): derive the private temp dir; drop the acl-session record

The durable sandbox/acl-session event carried a workspace binding that
always equals the session cwd and a random temp path that only needed
to be stable per session. Both are now derived: the temp subdirectory
is sha256(session id + workspace), created exclusively and removed on
provider dispose, so fork/resume semantics fall out of the derivation
and the record, its fold/provision/tamper validation, the immediate
flush kick, and the session-store dependency all disappear.
This commit is contained in:
Huanqi Cao
2026-08-10 00:54:55 +08:00
parent a29966b71f
commit 976020f2bb
12 changed files with 257 additions and 487 deletions

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/persistence-catalog.md
persistence-catalog.md: b07a02fcfca093c08acd206235e009d4d5fb9664
persistence-catalog.zh.md: 6f75e4ae522b75fc48bf95df707a0bd0a990ea5c
persistence-catalog.md: a17cae015eaa107a900069de916dddb216b87ec7
persistence-catalog.zh.md: 3aef073dedcff0b6addb99d7c287f4e5f372c402

View File

@@ -488,31 +488,6 @@ Source: [`packages/core/session/src/types.ts:276`](../packages/core/session/src/
### `sandbox/*`
#### `sandbox/acl-session` — log-only
```ts persistence-catalog
/**
* The session's windows-acl write record was provisioned — log-only
* (like `sandbox/mode`; NOT a surface event, carries no `surfaceOp`):
* durable and replayable, never in the model transcript. The LAST such
* event owned by the session is its record ({@link sessionAclRecord});
* the provider appends exactly one on the session's first Windows
* confined execution. The write SID itself is NOT stored — it is the
* per-workspace identity derived from `workspace`
* (`workspaceWriteSid`).
*/
'sandbox/acl-session': {
/** The owning session — the binding a fork's copied event cannot satisfy. */
sessionId: SessionId
/** The workspace root the grant applies to (the session's immutable cwd, as resolved). */
workspace: string
/** The session's private temp subdirectory under the host temp root. */
tempDir: string
}
```
Source: [`packages/sandbox/sandbox-local/src/acl-session.ts:43`](../packages/sandbox/sandbox-local/src/acl-session.ts)
#### `sandbox/mode` — log-only
```ts persistence-catalog

View File

@@ -490,31 +490,6 @@ export type SessionEvent<T extends SessionEventType = SessionEventType> = {
### `sandbox/*`
#### `sandbox/acl-session` — log-only
```ts persistence-catalog
/**
* The session's windows-acl write record was provisioned — log-only
* (like `sandbox/mode`; NOT a surface event, carries no `surfaceOp`):
* durable and replayable, never in the model transcript. The LAST such
* event owned by the session is its record ({@link sessionAclRecord});
* the provider appends exactly one on the session's first Windows
* confined execution. The write SID itself is NOT stored — it is the
* per-workspace identity derived from `workspace`
* (`workspaceWriteSid`).
*/
'sandbox/acl-session': {
/** The owning session — the binding a fork's copied event cannot satisfy. */
sessionId: SessionId
/** The workspace root the grant applies to (the session's immutable cwd, as resolved). */
workspace: string
/** The session's private temp subdirectory under the host temp root. */
tempDir: string
}
```
来源:[`packages/sandbox/sandbox-local/src/acl-session.ts:43`](../packages/sandbox/sandbox-local/src/acl-session.ts)
#### `sandbox/mode` — log-only
```ts persistence-catalog