@astrosheep/square 0.3.105 → 0.4.0
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.js +1 -1
- package/dist/artifact-store.d.ts +41 -0
- package/dist/artifact-store.js +272 -0
- package/dist/artifact.d.ts +8 -12
- package/dist/artifact.js +66 -343
- package/dist/attention-presentation.d.ts +33 -7
- package/dist/attention-presentation.js +33 -69
- package/dist/boundary-presentation.d.ts +0 -2
- package/dist/boundary-presentation.js +17 -22
- package/dist/catch-decisions.d.ts +2 -2
- package/dist/catch-decisions.js +14 -4
- package/dist/catch-selection.d.ts +8 -0
- package/dist/catch-selection.js +5 -0
- package/dist/channel-artifact.d.ts +10 -0
- package/dist/channel-artifact.js +55 -0
- package/dist/channel-delivery.d.ts +11 -0
- package/dist/channel-delivery.js +51 -0
- package/dist/channel-domain.d.ts +3 -0
- package/dist/channel-domain.js +83 -0
- package/dist/channel-facade.d.ts +76 -0
- package/dist/channel-facade.js +1 -0
- package/dist/channel-internal.d.ts +126 -0
- package/dist/channel-internal.js +440 -0
- package/dist/channel-metadata.d.ts +11 -0
- package/dist/channel-metadata.js +1 -0
- package/dist/channel-ports.d.ts +241 -0
- package/dist/channel-ports.js +1 -0
- package/dist/channel-presentation.d.ts +17 -0
- package/dist/channel-presentation.js +22 -0
- package/dist/channel-sqlite-schema.d.ts +13 -0
- package/dist/channel-sqlite-schema.js +81 -0
- package/dist/channel-transport.d.ts +62 -0
- package/dist/channel-transport.js +1 -0
- package/dist/channel-values.d.ts +27 -0
- package/dist/channel-values.js +90 -0
- package/dist/channel.d.ts +31 -21
- package/dist/channel.js +42 -74
- package/dist/claude-delivery-status.js +1 -1
- package/dist/claude-delivery.d.ts +2 -5
- package/dist/claude-delivery.js +56 -103
- package/dist/claude-mod.js +4 -4
- package/dist/claude-transport.d.ts +5 -0
- package/dist/claude-transport.js +58 -0
- package/dist/cli/context.d.ts +2 -2
- package/dist/cli/context.js +0 -1
- package/dist/cli/maintenance-commands.d.ts +0 -4
- package/dist/cli/maintenance-commands.js +2 -29
- package/dist/cli/program.js +1 -1
- package/dist/cli/registry.js +1 -2
- package/dist/codex-address.d.ts +1 -1
- package/dist/codex-queue.d.ts +2 -2
- package/dist/codex-queue.js +1 -3
- package/dist/decisions.js +3 -3
- package/dist/delivery-deferral.d.ts +9 -18
- package/dist/delivery-deferral.js +4 -4
- package/dist/delivery-health.d.ts +4 -4
- package/dist/delivery-health.js +11 -11
- package/dist/delivery-operations.d.ts +15 -2
- package/dist/delivery-operations.js +60 -30
- package/dist/delivery.d.ts +44 -33
- package/dist/delivery.js +49 -75
- package/dist/help.js +1 -6
- package/dist/http-delivery.d.ts +2 -2
- package/dist/http-delivery.js +2 -4
- package/dist/inbox.d.ts +10 -18
- package/dist/inbox.js +44 -53
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp.d.ts +2 -1
- package/dist/mcp.js +40 -70
- package/dist/message.d.ts +7 -0
- package/dist/message.js +23 -0
- package/dist/model.d.ts +41 -77
- package/dist/model.js +7 -139
- package/dist/neutral.d.ts +72 -0
- package/dist/neutral.js +27 -0
- package/dist/notifications.d.ts +2 -8
- package/dist/notifications.js +15 -50
- package/dist/operation-presentation.d.ts +1 -2
- package/dist/operation-presentation.js +1 -7
- package/dist/owner.d.ts +2 -2
- package/dist/owner.js +1 -1
- package/dist/paseo-delivery.d.ts +1 -1
- package/dist/paseo-delivery.js +2 -4
- package/dist/paseo-timeline.js +1 -0
- package/dist/plugins/opencode/delivery.js +27 -42
- package/dist/ports.d.ts +46 -168
- package/dist/presentation-operations.d.ts +1 -14
- package/dist/presentation-operations.js +16 -16
- package/dist/presentation.d.ts +5 -5
- package/dist/presentation.js +1 -0
- package/dist/runtime.js +2 -2
- package/dist/search.js +1 -1
- package/dist/sqlite-channel.d.ts +15 -0
- package/dist/sqlite-channel.js +600 -0
- package/dist/sqlite-framing.d.ts +8 -0
- package/dist/sqlite-framing.js +31 -0
- package/dist/sqlite-square.d.ts +12 -13
- package/dist/sqlite-square.js +192 -248
- package/dist/sqlite-values.d.ts +21 -0
- package/dist/sqlite-values.js +78 -0
- package/dist/square-api.d.ts +1 -1
- package/dist/square-api.js +1 -1
- package/dist/square-core.d.ts +1 -1
- package/dist/square-domain.d.ts +21 -7
- package/dist/square-domain.js +93 -94
- package/dist/square-facade.d.ts +12 -66
- package/dist/square-index.d.ts +1 -1
- package/dist/square-index.js +1 -1
- package/dist/square-location.d.ts +6 -1
- package/dist/square-location.js +1 -1
- package/dist/square-receive.d.ts +2 -3
- package/dist/square-sqlite.d.ts +45 -44
- package/dist/square-sqlite.js +308 -764
- package/dist/square-tools.d.ts +8 -0
- package/dist/square-tools.js +39 -0
- package/dist/views.d.ts +6 -6
- package/dist/views.js +15 -9
- package/dist/wake-preview.d.ts +7 -0
- package/dist/wake-preview.js +15 -0
- package/dist/wake-sink.d.ts +2 -2
- package/dist/wake-sink.js +1 -1
- package/dist/wake-transports.d.ts +7 -0
- package/dist/wake-transports.js +42 -0
- package/guides/claude-native.md +13 -10
- package/guides/codex-delivery.md +3 -1
- package/guides/participant-ownership.md +1 -1
- package/guides/row-runtime-delivery-evidence.md +2 -0
- package/guides/row-storage-design.md +19 -44
- package/guides/square-api.md +137 -60
- package/package.json +3 -3
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/types.d.ts +1 -1
- package/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/plugins/opencode/delivery.ts +28 -41
- package/plugins/pi/square-pi.js +28 -51
- package/dist/square-legacy-framing.d.ts +0 -11
- package/dist/square-legacy-framing.js +0 -64
- package/dist/square-migration-host-ledger.d.ts +0 -26
- package/dist/square-migration-host-ledger.js +0 -169
- package/dist/square-migration.d.ts +0 -30
- package/dist/square-migration.js +0 -599
- package/guides/migration.md +0 -156
package/guides/migration.md
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
# Migrating an existing square
|
|
2
|
-
|
|
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.
|
|
9
|
-
|
|
10
|
-
Stop all processes using the artifact, make an offline backup, then run:
|
|
11
|
-
|
|
12
|
-
```sh
|
|
13
|
-
square --location /path/to/SQUARE.square migrate
|
|
14
|
-
square --location /path/to/SQUARE.square doctor
|
|
15
|
-
```
|
|
16
|
-
|
|
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.
|