@astrosheep/square 0.3.93 → 0.3.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activity-feed.d.ts +3 -5
- package/dist/activity-feed.js +16 -14
- package/dist/artifact.js +3 -3
- package/dist/attention.d.ts +19 -0
- package/dist/attention.js +30 -0
- package/dist/boundary-presentation.d.ts +2 -2
- package/dist/boundary-presentation.js +33 -40
- package/dist/catch-decisions.d.ts +5 -8
- package/dist/catch-decisions.js +45 -25
- package/dist/claude-delivery-status.js +10 -4
- package/dist/claude-delivery.js +19 -11
- package/dist/claude-mod.js +24 -53
- package/dist/cli/context.d.ts +9 -4
- package/dist/cli/context.js +30 -27
- package/dist/cli/express-presentation.d.ts +3 -1
- package/dist/cli/express-presentation.js +28 -16
- package/dist/cli/json.d.ts +3 -0
- package/dist/cli/json.js +14 -0
- package/dist/cli/mcp-server-command.js +2 -2
- package/dist/cli/observation-commands.d.ts +1 -3
- package/dist/cli/observation-commands.js +43 -56
- package/dist/cli/program.js +3 -3
- package/dist/cli/registry.js +7 -6
- package/dist/cli/square-commands.d.ts +0 -2
- package/dist/cli/square-commands.js +30 -44
- package/dist/codex-hook.d.ts +3 -2
- package/dist/codex-hook.js +13 -4
- package/dist/codex-queue.js +4 -4
- package/dist/decisions.d.ts +5 -16
- package/dist/decisions.js +9 -33
- package/dist/delivery-attempts.d.ts +52 -0
- package/dist/delivery-attempts.js +73 -0
- package/dist/delivery-deferral.js +2 -2
- package/dist/delivery-effects.d.ts +139 -0
- package/dist/delivery-effects.js +163 -0
- package/dist/delivery-health.d.ts +0 -1
- package/dist/delivery-health.js +1 -3
- package/dist/delivery-operations.d.ts +2 -2
- package/dist/delivery-operations.js +76 -101
- package/dist/delivery-primitives.d.ts +5 -0
- package/dist/delivery-primitives.js +3 -0
- package/dist/delivery.d.ts +1 -1
- package/dist/delivery.js +7 -6
- package/dist/help.js +14 -14
- package/dist/http-delivery.d.ts +16 -0
- package/dist/http-delivery.js +101 -0
- package/dist/inbox.d.ts +9 -22
- package/dist/inbox.js +23 -27
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -1
- package/dist/mcp.d.ts +3 -0
- package/dist/mcp.js +23 -24
- package/dist/model.d.ts +12 -21
- package/dist/model.js +5 -8
- package/dist/notifications.d.ts +1 -1
- package/dist/notifications.js +8 -5
- package/dist/operation-presentation.d.ts +6 -6
- package/dist/operation-presentation.js +55 -58
- package/dist/owner.d.ts +11 -0
- package/dist/owner.js +32 -0
- package/dist/paseo-delivery.d.ts +4 -1
- package/dist/paseo-delivery.js +7 -12
- package/dist/paseo-state.d.ts +2 -2
- package/dist/paseo-state.js +6 -4
- package/dist/plugins/opencode/delivery.js +27 -15
- package/dist/ports.d.ts +18 -47
- package/dist/presentation-operations.d.ts +14 -19
- package/dist/presentation-operations.js +51 -61
- package/dist/presentation.d.ts +7 -17
- package/dist/presentation.js +46 -91
- package/dist/receive.d.ts +66 -0
- package/dist/receive.js +54 -0
- package/dist/runtime.d.ts +1 -8
- package/dist/runtime.js +2 -17
- package/dist/seats.d.ts +2 -3
- package/dist/seats.js +7 -15
- package/dist/session-lifecycle.d.ts +6 -2
- package/dist/session-lifecycle.js +39 -11
- package/dist/sqlite-square.d.ts +36 -23
- package/dist/sqlite-square.js +162 -211
- package/dist/square-api.d.ts +16 -11
- package/dist/square-api.js +27 -23
- package/dist/square-core.d.ts +0 -14
- package/dist/square-core.js +0 -9
- package/dist/square-domain.d.ts +4 -2
- package/dist/square-domain.js +65 -52
- package/dist/square-facade.d.ts +47 -105
- package/dist/square-index.d.ts +5 -13
- package/dist/square-index.js +13 -38
- package/dist/square-legacy-framing.d.ts +2 -0
- package/dist/square-legacy-framing.js +8 -0
- package/dist/square-location.d.ts +1 -14
- package/dist/square-location.js +4 -70
- package/dist/square-migration-host-ledger.d.ts +2 -2
- package/dist/square-migration-host-ledger.js +6 -5
- package/dist/square-migration.d.ts +4 -1
- package/dist/square-migration.js +93 -38
- package/dist/square-receive.d.ts +6 -0
- package/dist/square-receive.js +18 -0
- package/dist/square-sqlite.d.ts +9 -3
- package/dist/square-sqlite.js +139 -114
- package/dist/square-tools.d.ts +7 -10
- package/dist/square-tools.js +21 -61
- package/dist/stream.js +4 -5
- package/dist/views.d.ts +23 -13
- package/dist/views.js +47 -53
- package/dist/wakes.d.ts +1 -5
- package/dist/wakes.js +4 -6
- package/examples/symmetric-domains.mjs +250 -0
- package/guides/application-facade-delivery-evidence.md +6 -6
- package/guides/attention-primitive.md +32 -0
- package/guides/change-waits.md +2 -2
- package/guides/claude-native.md +18 -9
- package/guides/codex-delivery.md +17 -6
- package/guides/delivery-primitives.md +180 -0
- package/guides/mcp-connection-lifetime.md +1 -1
- package/guides/mcp.md +3 -3
- package/guides/migration.md +148 -151
- package/guides/operation-cancellation.md +1 -1
- package/guides/participant-ownership.md +78 -47
- package/guides/pi-tools.md +34 -5
- package/guides/primitive-catch-consolidation.md +5 -5
- package/guides/primitive-history-consolidation.md +2 -2
- package/guides/primitive-status-consolidation.md +3 -3
- package/guides/primitive-storage-consolidation.md +1 -1
- package/guides/receive-primitive.md +90 -0
- package/guides/row-runtime-delivery-evidence.md +1 -1
- package/guides/row-storage-design.md +22 -28
- package/guides/square-api.md +314 -91
- package/guides/symmetric-domains.md +92 -0
- package/package.json +14 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/skills/square/SKILL.md +2 -6
- package/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/plugins/opencode/delivery.ts +27 -17
- package/plugins/paseo/client/palette.ts +18 -18
- package/plugins/paseo/client/square-message.tsx +17 -23
- package/plugins/pi/square-pi.js +17 -17
- package/skills/square/SKILL.md +2 -6
- package/dist/square-backend.d.ts +0 -13
- package/dist/square-backend.js +0 -1
- package/dist/square-stdio.d.ts +0 -22
- package/dist/square-stdio.js +0 -235
- package/dist/stdio-server.d.ts +0 -3
- package/dist/stdio-server.js +0 -212
- package/guides/backends.md +0 -193
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MCP connection lifetime
|
|
2
2
|
|
|
3
|
-
An MCP server owns one artifact connection for its configured square. Its lifetime ends on close or disconnect; create a new server instance for a new connection. Replacing an artifact file under a running server remains unsupported. Every tool call opens an
|
|
3
|
+
An MCP server owns one artifact connection for its configured square. Its lifetime ends on close or disconnect; create a new server instance for a new connection. Replacing an artifact file under a running server remains unsupported. Every tool call opens an identity-free `Square` handle with that request's resource environment; harness identity is passed to `join(name, {body, wakeAddress?})` or `selectOwnSeat(square, body, as?)`, never captured by the resource. Calls with an explicit `location` override instead open and close a per-call connection, leaving the configured-square owner untouched. Only the default connection is shared: authorization, presence, activity facts and cancellation remain operation-scoped. The artifact port already serializes transactions on its connection.
|
|
4
4
|
|
|
5
5
|
`createSquareResourceOwner()` is the explicit lifetime boundary. `Square.at({resources, ...})` borrows its connection; closing a request handle leaves the owner open. Ordinary callers open and close their own Square. Cross-square `inbox()` reads remain independent. The connection captures no request abort signal. Explicit server close and transport disconnect share one shutdown path: the SDK cancels requests, handlers finish their cleanup, then the connection closes.
|
|
6
6
|
|
package/guides/mcp.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Square provides a stdio MCP server through `square mcp-server`.
|
|
4
4
|
|
|
5
|
-
Set `SQUARE_LOCATION` to the default `.square` artifact path; calls may override it with `location`. Relative paths use the server's startup working directory. Join with an explicit `as` name. Later calls may omit `as` only when the artifact recognizes exactly one current name held by the call's exact
|
|
5
|
+
Set `SQUARE_LOCATION` to the default `.square` artifact path; calls may override it with `location`. Relative paths use the server's startup working directory. Join with an explicit `as` name. Later calls may omit `as` only when the artifact recognizes exactly one current name held by the call's exact opaque owner; zero or multiple matches refuse and require explicit selection. An explicit name selects a voice but never grants custody. Request metadata supplies the live Codex (`threadId`) or OpenCode (`ai.opencode/sessionID`) coordinate when present, encoded through `harnessOwner`; otherwise the server-configured owner applies. CLI startup resolves `--owner`/`SQUARE_OWNER`, a complete harness coordinate, or the local user owner in that order, refusing incomplete harness identity. Owner is never a model tool argument. Read-only calls do not need an owner.
|
|
6
6
|
|
|
7
|
-
The server exposes `join`, `express`, `catch`, `history`, `attention`, `
|
|
7
|
+
The server exposes `join`, `express`, `catch`, `history`, `attention`, `done`, and `status`. `attention` takes `action: listen | unlisten | ignore`; `status` also reports who you listen to when a name resolves. `catch` consumes activities. `history` is read-only and accepts stable `act/<index>` cursors. All seven tools return the same human-readable text as the CLI in `content`, without `outputSchema` or `structuredContent`. Square failures set `isError: true` and return readable refusal and recovery text in `content`. Clients keep their native MCP result envelope; machine-readable domain results remain available through the SDK.
|
|
8
8
|
|
|
9
9
|
Claude's bundled plugin configures this server automatically. Its mod supplies live session/cwd/subagent attribution through an out-of-band tool-use-ID association, not AI-visible arguments; see [Claude call identity](claude-native.md#mcp-tools-and-call-identity). The bundled endpoint requires that association rather than falling back to its startup environment.
|
|
10
10
|
|
|
11
|
-
Tool definitions and argument-to-`Square`/`Participant` calls live in `square-tools.ts`, shared with the [Pi native tools](pi-tools.md).
|
|
11
|
+
Tool definitions and argument-to-`Square`/`Participant` calls live in `square-tools.ts`, shared with the [Pi native tools](pi-tools.md). Domain receipts stay internal to these adapters; tools return only their rendered text. All callers use the [same concrete resource API](square-api.md), with no alternate factory or generic outcome envelope. `express.noMention` disables body @name scanning without disabling explicit mentions or reply attention.
|
|
12
12
|
|
|
13
13
|
Configure a client with command `npx` and arguments `--yes --package @astrosheep/square square mcp-server`, or use the installed `square` executable with argument `mcp-server`. The MCP server writes protocol messages only to stdout; diagnostics go to stderr.
|
package/guides/migration.md
CHANGED
|
@@ -1,159 +1,156 @@
|
|
|
1
1
|
# Migrating an existing square
|
|
2
2
|
|
|
3
|
-
Square stores its authority in one versioned SQLite artifact. Format 1 kept
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
Square stores its authority in one versioned SQLite artifact. Format 1 kept a snapshot;
|
|
4
|
+
format 2 introduced typed facts; format 3 added `unlisten`; format 4 moved participant custody
|
|
5
|
+
and delivery evidence into the artifact; format 5 added independent delivery deferrals.
|
|
6
|
+
**Format 6 separates participant membership from host attachment; format 7 replaces harness Body
|
|
7
|
+
coordinates with opaque owners; format 8 removes Square hold/resume activities and held state.**
|
|
8
|
+
Existing artifacts are never converted implicitly.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
Stop all processes using the artifact, make an offline backup, then run:
|
|
10
11
|
|
|
11
12
|
```sh
|
|
12
13
|
square --location /path/to/SQUARE.square migrate
|
|
14
|
+
square --location /path/to/SQUARE.square doctor
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
The command handles supported formats 2
|
|
16
|
-
It does not
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
artifact does not install upgraded runtimes. For rollback after a committed conversion, stop all
|
|
156
|
-
clients and restore the offline backup with its compatible older runtime; do not downgrade the
|
|
157
|
-
format marker or drop tables in place. Run the read-only `doctor` command after migration and
|
|
158
|
-
before restarting clients. Repeating migration on a current artifact is a
|
|
159
|
-
byte-preserving no-op.
|
|
17
|
+
The command handles supported formats 2–7 in place and publishes only final format 8, in one
|
|
18
|
+
transaction. It does not make a backup, stop processes, install a runtime or update another
|
|
19
|
+
artifact. For formats 2/3, also freeze and back up the legacy HostLedger used for owner/evidence
|
|
20
|
+
import. A legacy ledger needing its own conversion must be prepared separately with its old
|
|
21
|
+
runtime's offline tooling. Snapshot format 1 is not accepted by this conversion.
|
|
22
|
+
|
|
23
|
+
Format 7 to 8 deletes hold/resume activities and rows keyed to them, clears replies that point to
|
|
24
|
+
deleted activities, and preserves every surviving activity index. Gaps remain legal; `lastActIndex`
|
|
25
|
+
is the greatest surviving index and `nextActIndex` never reuses a deleted index.
|
|
26
|
+
|
|
27
|
+
## Membership and attachment after conversion
|
|
28
|
+
|
|
29
|
+
Membership owns a participant's join/done history, read horizon and outgoing listens. Attachment
|
|
30
|
+
says whether its exact owner is currently executing for it. There are three distinct endings:
|
|
31
|
+
|
|
32
|
+
- A participant's voluntary `done` ends membership. A later explicit participant join is required
|
|
33
|
+
to return; no host start/resume revives it.
|
|
34
|
+
- Pi shutdown, Codex SessionEnd and Claude session end detach only. No activity lands; membership,
|
|
35
|
+
listens, read horizon, receipts and delivery evidence stay intact. Wake readiness, catch ownership
|
|
36
|
+
and delivery deferrals are cleared. Away participants still receive landed audience and accumulate
|
|
37
|
+
unread activity, but cannot write or receive proactive delivery. Away has no timeout.
|
|
38
|
+
- Host-confirmed permanent deletion ends membership through fenced
|
|
39
|
+
`endHeld(name, {owner, generation})`, including for a detached seat. OpenCode `session.deleted`
|
|
40
|
+
uses this path.
|
|
41
|
+
|
|
42
|
+
On start/resume, hosts discover only their exact owner's standing seats with `seatsOf(owner)` and
|
|
43
|
+
restore the detached ones with `reattach(name, {owner, wakeAddress?})` before arming delivery.
|
|
44
|
+
Same-owner `join` or `reattach` preserves the generation, read horizon and listens, so mentions
|
|
45
|
+
received while away remain unread. Reattachment returns `null` for absent, foreign or done seats;
|
|
46
|
+
it never creates membership. Explicit takeover still performs `done -> join` with a fresh
|
|
47
|
+
generation, even when taking over an away participant; old cleanup/recovery cannot reclaim it.
|
|
48
|
+
The owner API requires this explicit format migration; see the
|
|
49
|
+
[SDK breaking migration](square-api.md#sdk-breaking-migration-opaque-owners).
|
|
50
|
+
|
|
51
|
+
## Conversion from formats 6, 5 and 4
|
|
52
|
+
|
|
53
|
+
Format 6 -> 7 maps each seat's `channel`, `session` and optional `agent` through the adapter codec
|
|
54
|
+
into one owner string, preserving its generation, attachment and wake. Evidence, deferrals, catch
|
|
55
|
+
leases, cancellations, conversation facts and both revisions stay unchanged. Unmappable legacy
|
|
56
|
+
coordinates (for example an encoded owner exceeding 512 UTF-8 bytes) refuse without changing the
|
|
57
|
+
source; they are never truncated or reassigned. Keep the source backup for offline resolution.
|
|
58
|
+
|
|
59
|
+
Formats 4/5 first acquire format 6 semantics in that same transaction: every existing seat becomes
|
|
60
|
+
attached. Format 4 also gains empty deferral support. No detached seat is invented. Formats 4–6
|
|
61
|
+
never consult HostLedger; any failure rolls back schema changes and final publication together.
|
|
62
|
+
|
|
63
|
+
Existing done participants stay done. Before format 6, a host-cleanup `done` was indistinguishable
|
|
64
|
+
from a voluntary leave; migration conservatively treats both as voluntary. It does not infer
|
|
65
|
+
attachment history, reconstruct departures or provide a host recovery path for completed seats.
|
|
66
|
+
|
|
67
|
+
## Verified import from formats 3 and 2
|
|
68
|
+
|
|
69
|
+
Formats 2/3 need owner and delivery evidence import. Before writing, migration validates exact
|
|
70
|
+
source framing, header and legacy facts read-only. The frozen legacy HostLedger's latest owner
|
|
71
|
+
for each participant at this artifact is selected by source `(effectiveAt, seq)` only: no wall
|
|
72
|
+
clock, retention, expiry or ownership-history reconstruction is involved.
|
|
73
|
+
|
|
74
|
+
- A legacy owner Body (`channel`, `session`, optional `agent`) establishes a standing, attached
|
|
75
|
+
seat only when it agrees with all of that name's local route Bodies and the establishing join
|
|
76
|
+
is verified. An owner without routes needs no wake address. Without an owner, one unambiguous
|
|
77
|
+
route Body can establish the seat. An absent agent means the top-level Body; a known agent is
|
|
78
|
+
preserved and compared exactly. Matching repeated registrations are acceptable; wake readiness
|
|
79
|
+
carries forward only when the routes agree. Routes are location-bound: moving an artifact copy
|
|
80
|
+
does not establish that its original routes apply there.
|
|
81
|
+
- Without a verifiable owner or route Body, the participant stays standing without custody.
|
|
82
|
+
Membership, history, attention, receipts, landed audience and catch ownership are preserved.
|
|
83
|
+
No Body, route, attachment or departure is guessed. Its name grants no write/delivery authority.
|
|
84
|
+
- A Body may own several names; each retains its own generation and wake readiness. Sharing
|
|
85
|
+
does not merge names or choose a winner. Conflicting owner/route Bodies leave that name
|
|
86
|
+
standing without custody; disagreement does not abort conversion. An unverifiable establishing
|
|
87
|
+
join still refuses before publication.
|
|
88
|
+
- Evidence structure is validated before placement, including evidence that cannot be imported.
|
|
89
|
+
Malformed facts, activity IDs or native correlation refuse without changing either source.
|
|
90
|
+
- Wake/presentation evidence imports only when its Body agrees and it names an existing directed
|
|
91
|
+
say after the verified current join. Missing custody, conflicting session/agent/channel or native
|
|
92
|
+
harness, unknown participants and activity outside the generation cause evidence to be skipped,
|
|
93
|
+
never reassigned to another owner.
|
|
94
|
+
- Done participants gain no seat or recovery authority. Only native correlation directly
|
|
95
|
+
attributable to their verified latest join and directed activity before departure is retained
|
|
96
|
+
for retired-token recognition. It authorizes neither admission nor presentation. Ambiguous
|
|
97
|
+
completed-Body mappings, duplicate claim tokens and ambiguous attempt numbering cause all
|
|
98
|
+
affected evidence to be skipped, rather than selecting a winner. A record without an attempt
|
|
99
|
+
number receives attempt 0. Migrated Claude wake addresses retain their native session identity.
|
|
100
|
+
|
|
101
|
+
This is a narrow, deliberately lossy conversion, not a general history importer. Conversation,
|
|
102
|
+
activity IDs, bodies, audience, receipts, source revision meaning and directly verified replay
|
|
103
|
+
protection survive. Completed non-native evidence and noncritical metadata—including old presence
|
|
104
|
+
history, epochs, diagnostic messages, native observation histories and arbitrary legacy extras—do
|
|
105
|
+
not import. Evidence without current or verified completed ownership is skipped and counted. The
|
|
106
|
+
read-only legacy ledger remains available for offline diagnosis; an absent ledger permits route-
|
|
107
|
+
derived custody, but an unreadable or unsupported ledger refuses before changing the square.
|
|
108
|
+
|
|
109
|
+
One transaction imports verified authority/evidence, adds deferral and attachment support, applies
|
|
110
|
+
the format-7-to-8 deletion, and publishes format 8. Existing conversation and membership facts are
|
|
111
|
+
preserved apart from the deleted hold/resume rows and cleared replies; no intermediate format is
|
|
112
|
+
published. Legacy catch ownership is generation-bound only for exact standing owner
|
|
113
|
+
spellings; otherwise it stays unbound. Legacy routes are consumed only during migration and are
|
|
114
|
+
not a live authority source. The new delivery revision starts at zero. Format 2 first adds support
|
|
115
|
+
for `unlisten`, then follows the same conversion.
|
|
116
|
+
|
|
117
|
+
The receipt reports recovered seats, unowned standing names, seats sharing a recovered Body,
|
|
118
|
+
skipped evidence, and source activity/receipt/catch/route counts. The shared count measures seats,
|
|
119
|
+
not distinct Bodies or groups. Skipped includes every legacy wake/presentation record read but
|
|
120
|
+
not imported, including completed non-native diagnostics.
|
|
121
|
+
|
|
122
|
+
## Conservative refusal and retired-token protection
|
|
123
|
+
|
|
124
|
+
Unrelated databases, unsupported formats, non-`DELETE` journal mode, unknown framing, malformed
|
|
125
|
+
headers/facts or native correlation refuse without source changes. Migration is not repair and
|
|
126
|
+
never rewrites journal mode to make conversion possible.
|
|
127
|
+
|
|
128
|
+
For formats 2/3, **any nonempty legacy token-only tombstone collection makes preflight refuse**,
|
|
129
|
+
including tokens for other sessions. Those Claude tombstones are replay protection, not diagnostics:
|
|
130
|
+
they identify only a session and token, without artifact, participant, activity or join generation.
|
|
131
|
+
The converter cannot safely assign them. This is a ledger-wide conservative ambiguity refusal,
|
|
132
|
+
not a claim that each token belongs to the artifact being converted. Even a token duplicated by
|
|
133
|
+
retained evidence refuses; conversion does not deduplicate or infer history to bypass protection.
|
|
134
|
+
|
|
135
|
+
Keep the original ledger and artifact intact. Resolve ambiguity offline with replay protection
|
|
136
|
+
preserved; **do not delete tombstones just to bypass preflight**. An already-current artifact
|
|
137
|
+
returns without consulting the legacy ledger and remains a byte-preserving no-op.
|
|
138
|
+
|
|
139
|
+
## Before reopening and rollback
|
|
140
|
+
|
|
141
|
+
Freeze every artifact user and, for formats 2/3, every legacy-ledger writer. Make an offline backup
|
|
142
|
+
or use SQLite backup facilities rather than copying a live database. Migration cannot revoke an
|
|
143
|
+
in-flight remote delivery. Writes use ordinary SQLite `DELETE` journals: the artifact and its
|
|
144
|
+
containing directory must permit writing and journal creation/removal. A legacy ledger needs read
|
|
145
|
+
access only. Losing the rebuildable HOME discovery index may delay restoration/delivery but cannot
|
|
146
|
+
transfer custody or erase evidence. The disposable index changes to `{location, owner}`; old index
|
|
147
|
+
rows are ignored. Rejoin with the exact migrated owner to republish discovery (or let that same
|
|
148
|
+
harness reconnect). This preserves generation, listens and unread activity; do not use takeover
|
|
149
|
+
merely to rebuild the index.
|
|
150
|
+
|
|
151
|
+
Upgrade all attached runtimes before reopening format 8; older runtimes must not be mixed with it.
|
|
152
|
+
Updating a package does not migrate an artifact, and migration does not install upgraded runtimes.
|
|
153
|
+
After conversion, run read-only `doctor` before restarting clients. To roll back a committed
|
|
154
|
+
conversion, stop all clients and restore the offline backup with its compatible older runtime;
|
|
155
|
+
do not downgrade the format marker or remove facts in place. Repeating current-format migration
|
|
156
|
+
is a byte-preserving no-op.
|
|
@@ -21,7 +21,7 @@ Ownership and delivery have the same limitation: cancellation can stop work that
|
|
|
21
21
|
Presentation checks cancellation and eligibility before invoking its sink. A rejected sink is not
|
|
22
22
|
success, including a native notification whose landing acknowledgement was cancelled. Once the sink
|
|
23
23
|
succeeds, recording its evidence and seen receipts is mandatory settlement, not a new cancellable
|
|
24
|
-
presentation attempt. It uses the same artifact connection and captured
|
|
24
|
+
presentation attempt. It uses the same artifact connection and captured owner/join generation, without
|
|
25
25
|
inheriting the pre-effect operation signal or a signal captured when opening that artifact. Claim
|
|
26
26
|
release after a cancelled/failed attempt uses the same independent cleanup lifetime and writes no
|
|
27
27
|
success receipt. Both settle through the normal authority gate, with a five-second storage budget;
|
|
@@ -1,60 +1,91 @@
|
|
|
1
1
|
# Participant ownership
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
3
|
+
Membership and host attachment are different facts. Membership says a participant is in the
|
|
4
|
+
square; it owns their join history, read horizon and outgoing listens. Attachment says whether
|
|
5
|
+
an exact opaque owner is executing for that participant now.
|
|
6
|
+
A standing seat may be attached or detached. The artifact transaction is the sole custody
|
|
7
|
+
authority; display spelling, wake addresses and the rebuildable HOME discovery index never
|
|
8
|
+
grant ownership. There is no writable HostLedger ownership layer.
|
|
9
|
+
|
|
10
|
+
Owners are opaque non-secret strings, not harness coordinates or authentication. Harness adapters
|
|
11
|
+
encode their own identity; terminal owners use `user:<OS user>@<host>` and are never automatically
|
|
12
|
+
detached or ended by a harness. A seat's optional wake route is self-contained transport readiness,
|
|
13
|
+
not an owner or an alternative custody fact.
|
|
14
|
+
|
|
15
|
+
## Three endings
|
|
16
|
+
|
|
17
|
+
- **The participant leaves:** `Participant.done()` ends membership, removes its seat, catch
|
|
18
|
+
lease and delivery deferrals, and removes outgoing listens. A later explicit `join` establishes
|
|
19
|
+
a fresh generation and read horizon. No host start or resume brings a voluntary leave back.
|
|
20
|
+
- **The host session ends:** `detach(name, {owner, generation})` detaches only that exact owner and
|
|
21
|
+
join generation. It clears wake readiness, catch ownership and delivery deferrals, without landing
|
|
22
|
+
an activity or changing membership, listens or the read horizon. A detached participant is
|
|
23
|
+
**away**, still receives normal landed audience and accumulates unread activity, but cannot write
|
|
24
|
+
or receive proactive delivery. Away has no timeout; a session that never returns simply stays away.
|
|
25
|
+
- **The host confirms permanent deletion:** `endHeld(name, {owner, generation})` ends membership
|
|
26
|
+
with a fenced `done`, including for a detached seat. OpenCode's `session.deleted` uses this path.
|
|
27
|
+
Pi shutdown, Codex SessionEnd and Claude session end do not prove permanent deletion and therefore
|
|
28
|
+
detach.
|
|
29
|
+
|
|
30
|
+
An explicit takeover remains `done -> join` in one transaction, whether the old seat is attached
|
|
31
|
+
or detached. It transfers the name to the new owner with a fresh generation; old cleanup and
|
|
32
|
+
recovery cannot reclaim it.
|
|
33
|
+
|
|
34
|
+
## Captured handles and restoration
|
|
35
|
+
|
|
36
|
+
A `Square` captures no participant identity. `participant(name, {owner})` selects an attached,
|
|
37
|
+
standing seat held by that exact owner without joining; never-joined, done, foreign and detached
|
|
38
|
+
seats refuse with join recovery facts, not ghost handles. `seatsOf(owner)` is a read-only discovery
|
|
39
|
+
surface for the owner's standing seats as `{name, generation, attachment}`. It includes attached and
|
|
40
|
+
detached seats, but does not join or return done participants. See [square-api.md](square-api.md)
|
|
41
|
+
for resource lifetimes and adapter selection.
|
|
42
|
+
|
|
43
|
+
- `join(name, {owner, wakeAddress?})` atomically establishes membership and its seat when absent.
|
|
44
|
+
A same-owner reconnect preserves the establishing generation. On a detached seat it also
|
|
45
|
+
reattaches, using the operation's supplied wake address, and returns `reconnected`, with no
|
|
46
|
+
activity, new read horizon or listening changes. A foreign owner gets `already_joined`; takeover
|
|
47
|
+
must be explicit.
|
|
48
|
+
- `reattach(name, {owner, wakeAddress?})` returns a handle for an exact-owner standing seat, or
|
|
49
|
+
`null` for absent, foreign or done custody; it never creates membership. A foreign takeover racing
|
|
50
|
+
the transaction can instead refuse. It can also refresh an attached seat's wake address subject to
|
|
51
|
+
native-route preference. Host start/resume restores only detached seats found through
|
|
52
|
+
`seatsOf(owner)` before arming delivery. One unavailable location or
|
|
53
|
+
failed reattachment does not block the others. A new or forked session has a different owner and
|
|
54
|
+
restores nothing. Hosts never infer restoration from a historical departure.
|
|
55
|
+
- Participant mutations require both the captured generation and an attached current seat.
|
|
56
|
+
Detach suspends existing handles; they cannot express, catch, listen, leave or change
|
|
57
|
+
deferrals until reattachment. Rejoin/takeover fences old handles permanently, even if the same
|
|
58
|
+
owner later reacquires the name. Host cleanup checks owner and generation inside its transaction;
|
|
59
|
+
stale, foreign, done or already-detached detach changes nothing. Host `cancelDeliveries` also
|
|
60
|
+
requires the captured owner/generation and an attached current seat; it does not consume activity.
|
|
61
|
+
|
|
62
|
+
The HOME index supplies candidate paths only. Successful file-backed joins and non-null
|
|
63
|
+
reattachments attempt best-effort publication; opening or expressing does not publish. Losing the
|
|
64
|
+
index may delay restoration or delivery but cannot transfer a seat, erase delivery evidence or
|
|
65
|
+
consume unread activity. A wake address is transport readiness for an attached seat, not an
|
|
66
|
+
alternative ownership fact.
|
|
35
67
|
|
|
36
68
|
## Independent delivery deferrals
|
|
37
69
|
|
|
38
|
-
`deferDelivery`, `renewDeliveryDeferral`, and `releaseDeliveryDeferral` require
|
|
39
|
-
current seat.
|
|
40
|
-
|
|
41
|
-
|
|
70
|
+
`deferDelivery`, `renewDeliveryDeferral`, and `releaseDeliveryDeferral` require the same captured,
|
|
71
|
+
attached current seat. Independent artifact-owned leases belong to one participant and generation,
|
|
72
|
+
separately from catch ownership, delivery claims and receipts. Each has a fresh opaque ID, validated
|
|
73
|
+
metadata match and expiry. It is not an acknowledgement intent or an activity.
|
|
42
74
|
|
|
43
75
|
Each lease's nested own-property scalar equalities combine with AND; matching active leases combine
|
|
44
|
-
with OR. Renewal cannot revive an expired lease. Release touches only its named live lease
|
|
76
|
+
with OR. Renewal cannot revive an expired lease. Release touches only its named live lease and
|
|
45
77
|
returns false for an absent/expired ID. A current owner cannot use another participant's ID.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
rows can never become active for a new generation.
|
|
78
|
+
Expiry is checked live. Detach, done, takeover and rejoin clear deferrals in the same transaction;
|
|
79
|
+
reattachment never revives an old lease.
|
|
49
80
|
|
|
50
81
|
Deferrals change only proactive eligibility. They preserve audience, history, unread counts and
|
|
51
|
-
explicit catch.
|
|
52
|
-
|
|
53
|
-
|
|
82
|
+
explicit catch. A caught record is not replayed after release. Producers, observers, claims and
|
|
83
|
+
final send/presentation gates all require attached current custody and apply the same deferral
|
|
84
|
+
policy. Neither detach nor a deferral can recall an already-dispatched external message.
|
|
54
85
|
|
|
55
86
|
## Acceptance boundaries
|
|
56
87
|
|
|
57
|
-
Tests exercise foreign
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
copy. Migration
|
|
88
|
+
Tests exercise foreign/stale/detached handles, same-owner restoration with unread activity intact,
|
|
89
|
+
voluntary leave, explicit takeover, permanent deletion, exact-owner adapter lifecycle, generation
|
|
90
|
+
fences and delivery eligibility. Assertions belong to authoritative facts, not helper ordering or
|
|
91
|
+
display copy. Migration is offline and explicit; see [migration.md](migration.md).
|