@astrosheep/square 0.4.0 → 0.4.1
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/artifact.d.ts +1 -3
- package/dist/artifact.js +12 -36
- package/dist/attention-presentation.d.ts +2 -22
- package/dist/attention-presentation.js +9 -12
- package/dist/boundary-presentation.d.ts +3 -14
- package/dist/boundary-presentation.js +29 -104
- package/dist/card-presentation.d.ts +1 -0
- package/dist/card-presentation.js +2 -0
- package/dist/catch-decisions.js +1 -7
- package/dist/claude-delivery.d.ts +13 -8
- package/dist/claude-delivery.js +40 -93
- package/dist/claude-mcp-context.js +2 -2
- package/dist/claude-mod.js +28 -140
- package/dist/claude-transport.d.ts +3 -3
- package/dist/claude-transport.js +20 -44
- package/dist/cli/context.js +7 -9
- package/dist/cli/observation-commands.d.ts +2 -0
- package/dist/cli/observation-commands.js +12 -2
- package/dist/cli/registry.js +3 -1
- package/dist/codex-address.d.ts +2 -2
- package/dist/codex-boundary-state.d.ts +1 -5
- package/dist/codex-boundary-state.js +0 -4
- package/dist/codex-hook.d.ts +7 -10
- package/dist/codex-hook.js +69 -33
- package/dist/codex-queue.d.ts +10 -11
- package/dist/codex-queue.js +32 -32
- package/dist/codex-watch.d.ts +2 -0
- package/dist/codex-watch.js +100 -0
- package/dist/decisions.js +2 -2
- package/dist/delivery-deferral.d.ts +8 -17
- package/dist/delivery-deferral.js +0 -28
- package/dist/delivery-frame.d.ts +7 -0
- package/dist/delivery-frame.js +11 -0
- package/dist/delivery-ledger-sqlite.d.ts +97 -0
- package/dist/delivery-ledger-sqlite.js +496 -0
- package/dist/delivery-ledger.d.ts +196 -0
- package/dist/delivery-ledger.js +268 -0
- package/dist/delivery-lifetime.d.ts +6 -0
- package/dist/delivery-lifetime.js +45 -0
- package/dist/harness-links.js +61 -7
- package/dist/harness.js +12 -17
- package/dist/help.js +2 -0
- package/dist/http-delivery.d.ts +5 -9
- package/dist/http-delivery.js +20 -77
- package/dist/inbox.d.ts +6 -49
- package/dist/inbox.js +24 -371
- package/dist/index.d.ts +6 -3
- package/dist/index.js +4 -1
- package/dist/mcp.js +1 -1
- package/dist/model.d.ts +7 -47
- package/dist/model.js +1 -7
- package/dist/notifications.d.ts +24 -20
- package/dist/notifications.js +39 -108
- package/dist/operation-control.d.ts +4 -0
- package/dist/operation-control.js +20 -0
- package/dist/packages/agent-delivery/src/claude-native.d.ts +2 -0
- package/dist/packages/agent-delivery/src/claude-native.js +5 -0
- package/dist/packages/agent-delivery/src/codex-boundary.d.ts +11 -6
- package/dist/packages/agent-delivery/src/codex-boundary.js +31 -40
- package/dist/packages/agent-delivery/src/codex-hook.d.ts +17 -12
- package/dist/packages/agent-delivery/src/codex-hook.js +26 -39
- package/dist/packages/agent-delivery/src/codex.d.ts +3 -0
- package/dist/packages/agent-delivery/src/codex.js +41 -4
- package/dist/packages/agent-delivery/src/index.d.ts +3 -1
- package/dist/packages/agent-delivery/src/index.js +1 -1
- package/dist/packages/agent-delivery/src/paseo.js +11 -2
- package/dist/packages/agent-delivery/src/types.d.ts +1 -0
- package/dist/paseo-delivery.d.ts +5 -5
- package/dist/paseo-delivery.js +19 -97
- package/dist/paseo.d.ts +1 -1
- package/dist/paseo.js +1 -1
- package/dist/plugins/opencode/index.d.ts +5 -3
- package/dist/plugins/opencode/index.js +99 -21
- package/dist/plugins/opencode-shared/delivery.d.ts +23 -0
- package/dist/plugins/opencode-shared/delivery.js +109 -0
- package/dist/plugins/opencode-v1/index.d.ts +28 -0
- package/dist/plugins/opencode-v1/index.js +41 -0
- package/dist/plugins/opencode-v1/runtime.d.ts +56 -0
- package/dist/plugins/opencode-v1/runtime.js +152 -0
- package/dist/plugins/opencode-v1/transport.d.ts +13 -0
- package/dist/plugins/opencode-v1/transport.js +50 -0
- package/dist/plugins/paseo/shared/card-presentation.d.ts +10 -0
- package/dist/plugins/paseo/shared/card-presentation.js +7 -0
- package/dist/ports.d.ts +31 -90
- package/dist/session-lifecycle.d.ts +8 -7
- package/dist/session-lifecycle.js +40 -42
- package/dist/sqlite-square.d.ts +14 -23
- package/dist/sqlite-square.js +132 -139
- package/dist/square-api.js +4 -7
- package/dist/square-core.d.ts +0 -1
- package/dist/square-domain.d.ts +5 -17
- package/dist/square-domain.js +104 -221
- package/dist/square-facade.d.ts +18 -15
- package/dist/square-post.d.ts +53 -0
- package/dist/square-post.js +4 -0
- package/dist/square-posting.d.ts +13 -0
- package/dist/square-posting.js +174 -0
- package/dist/square-producer-sqlite.d.ts +11 -0
- package/dist/square-producer-sqlite.js +210 -0
- package/dist/square-sqlite.d.ts +15 -25
- package/dist/square-sqlite.js +150 -226
- package/dist/views.d.ts +2 -2
- package/dist/views.js +0 -1
- package/dist/wake-sink.d.ts +4 -11
- package/dist/wake-sink.js +8 -32
- package/dist/wake-transports.d.ts +4 -7
- package/dist/wake-transports.js +8 -39
- package/examples/symmetric-domains.mjs +29 -249
- package/guides/change-waits.md +13 -53
- package/guides/claude-native.md +19 -175
- package/guides/codex-delivery.md +55 -80
- package/guides/delivery-primitives.md +48 -207
- package/guides/operation-cancellation.md +2 -5
- package/guides/participant-ownership.md +25 -89
- package/guides/pi-native-delivery.md +19 -56
- package/guides/pi-tools.md +6 -8
- package/guides/square-api.md +113 -615
- package/package.json +8 -8
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/hooks/hooks.json +1 -1
- package/plugins/claude/{hooks/register.js → mods/square.js} +4 -7
- package/plugins/codex/.codex-plugin/plugin.json +1 -1
- package/plugins/codex/hooks/hooks.json +11 -23
- package/plugins/opencode/index.ts +91 -23
- package/plugins/opencode-shared/delivery.ts +91 -0
- package/plugins/opencode-v1/index.ts +36 -0
- package/plugins/opencode-v1/runtime.ts +134 -0
- package/plugins/opencode-v1/transport.ts +41 -0
- package/plugins/paseo/OVERVIEW.md +5 -5
- package/plugins/paseo/README.md +7 -6
- package/plugins/paseo/client/markdown.tsx +5 -5
- package/plugins/paseo/client/square-message.tsx +28 -24
- package/plugins/paseo/client/transform.ts +8 -5
- package/plugins/paseo/shared/card-presentation.ts +16 -0
- package/plugins/paseo/shared/message.ts +6 -11
- package/plugins/pi/square-pi.js +156 -417
- package/dist/channel-artifact.d.ts +0 -10
- package/dist/channel-artifact.js +0 -55
- package/dist/channel-delivery.d.ts +0 -11
- package/dist/channel-delivery.js +0 -51
- package/dist/channel-domain.d.ts +0 -3
- package/dist/channel-domain.js +0 -83
- package/dist/channel-facade.d.ts +0 -76
- package/dist/channel-facade.js +0 -1
- package/dist/channel-internal.d.ts +0 -126
- package/dist/channel-internal.js +0 -440
- package/dist/channel-metadata.d.ts +0 -11
- package/dist/channel-metadata.js +0 -1
- package/dist/channel-ports.d.ts +0 -241
- package/dist/channel-ports.js +0 -1
- package/dist/channel-presentation.d.ts +0 -17
- package/dist/channel-presentation.js +0 -22
- package/dist/channel-sqlite-schema.d.ts +0 -13
- package/dist/channel-sqlite-schema.js +0 -81
- package/dist/channel-transport.d.ts +0 -62
- package/dist/channel-transport.js +0 -1
- package/dist/channel.d.ts +0 -84
- package/dist/channel.js +0 -60
- package/dist/claude-delivery-status.d.ts +0 -13
- package/dist/claude-delivery-status.js +0 -46
- package/dist/cmd/notify-once.d.ts +0 -2
- package/dist/cmd/notify-once.js +0 -29
- package/dist/delivery-attempts.d.ts +0 -52
- package/dist/delivery-attempts.js +0 -73
- package/dist/delivery-effects.d.ts +0 -139
- package/dist/delivery-effects.js +0 -163
- package/dist/delivery-health.d.ts +0 -51
- package/dist/delivery-health.js +0 -173
- package/dist/delivery-operations.d.ts +0 -22
- package/dist/delivery-operations.js +0 -198
- package/dist/delivery-primitives.d.ts +0 -5
- package/dist/delivery-primitives.js +0 -3
- package/dist/delivery.d.ts +0 -56
- package/dist/delivery.js +0 -80
- package/dist/plugins/opencode/delivery.d.ts +0 -19
- package/dist/plugins/opencode/delivery.js +0 -223
- package/dist/presentation-operations.d.ts +0 -5
- package/dist/presentation-operations.js +0 -86
- package/dist/sqlite-channel.d.ts +0 -15
- package/dist/sqlite-channel.js +0 -600
- package/dist/square-index.d.ts +0 -16
- package/dist/square-index.js +0 -106
- package/dist/wake-preview.d.ts +0 -7
- package/dist/wake-preview.js +0 -15
- package/plugins/opencode/delivery.ts +0 -198
- /package/dist/{channel-values.d.ts → square-values.d.ts} +0 -0
- /package/dist/{channel-values.js → square-values.js} +0 -0
package/guides/claude-native.md
CHANGED
|
@@ -1,177 +1,21 @@
|
|
|
1
1
|
# Claude native inbox
|
|
2
2
|
|
|
3
|
-
Square's Claude plugin is a mod, not a shell-hook injector. Its
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
not
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
`square harness doctor claude` explains installation and these limits.
|
|
23
|
-
`square harness doctor delivery` derives current routes/evidence without sending.
|
|
24
|
-
An absent/broken endpoint is unavailable; it does not consume Square activity.
|
|
25
|
-
|
|
26
|
-
## Native-first routing and policy holds
|
|
27
|
-
|
|
28
|
-
Native delivery is preferred, including under Paseo. CLI and call-local MCP Codex
|
|
29
|
-
joins register the native queue for their thread. Claude and OpenCode receivers
|
|
30
|
-
register their native wake addresses only through their loaded integrations. An
|
|
31
|
-
ordinary reconnect or reattachment cannot replace a current native address with a
|
|
32
|
-
generic Paseo proposal. Addresses belong to the artifact seat generation, not an
|
|
33
|
-
expiring routes table: explicit receiver withdrawal permits fallback, and a new
|
|
34
|
-
seat generation cannot inherit the previous generation's native registration. Endpoint generations
|
|
35
|
-
are opaque strings, compared for equality rather than interpreted.
|
|
36
|
-
Participant expressions do not publish replacement addresses.
|
|
37
|
-
|
|
38
|
-
This is route preference, not permission to bypass receiver policy. Claude can
|
|
39
|
-
legitimately hold an unsolicited peer message with `no-mode-asserted`, especially
|
|
40
|
-
under `bypassPermissions`. Square neither asserts a made-up permission mode nor
|
|
41
|
-
changes `crossSessionInbound`. After bytes may have been sent, `unknown` remains
|
|
42
|
-
attention-wide and prevents another send through Paseo, even if routes later change.
|
|
43
|
-
|
|
44
|
-
Each native send persists a message ID before writing; the wire `uuid` and
|
|
45
|
-
`msg_id` carry that ID. Square records no native custody telemetry from Paseo:
|
|
46
|
-
official Paseo exposes no delivery-status lifecycle event, so a held message stays
|
|
47
|
-
`unknown` with `native_admission_unconfirmed`. Recording a `held`, `released` or
|
|
48
|
-
`dropped` observation would require a Paseo-provided event; Square does not patch
|
|
49
|
-
Paseo to invent one. Even when such an observation exists, the event ID is
|
|
50
|
-
deduplicated and the native reason and observation time remain diagnostic only.
|
|
51
|
-
Neither a release nor a drop is a queue receipt, proof of consumption or retry
|
|
52
|
-
authorization.
|
|
53
|
-
|
|
54
|
-
`square harness doctor delivery` shows native custody separately from pending
|
|
55
|
-
attention for current seat generations, including after the activity is seen. Paseo
|
|
56
|
-
presents the `peer_message_hold` state in its own timeline. Acceptance means normal
|
|
57
|
-
delivery when the receiver allows it, or a visible reason without bypass/replay when
|
|
58
|
-
policy holds it.
|
|
59
|
-
|
|
60
|
-
## MCP tools and call identity
|
|
61
|
-
|
|
62
|
-
The plugin's `.mcp.json` starts the existing Square MCP server. The mod no longer
|
|
63
|
-
registers an argv wrapper or executes participant CLI commands. MCP and Pi native
|
|
64
|
-
tools share their operation definitions and facade calls in `square-tools.ts`.
|
|
65
|
-
|
|
66
|
-
Before a bundled MCP call, the mod uses the existing `square claude-mod` helper
|
|
67
|
-
to publish `{toolUseId, sessionId, cwd, agentId?}`. It then calls `next(e)` unchanged.
|
|
68
|
-
The server correlates `_meta["claudecode/toolUseId"]` with that association: no
|
|
69
|
-
session, agent, token or other transport field is added to the model's schema or
|
|
70
|
-
arguments. Claude's native **session ID plus child flag** semantics are preserved;
|
|
71
|
-
the child loop's `agentId` is retained for attribution, not substituted as a session ID.
|
|
72
|
-
Calls use the live cwd and session even if the MCP process started earlier.
|
|
73
|
-
|
|
74
|
-
`SQUARE_CLAUDE_MCP_CONTEXT=1` is set only by the bundled MCP configuration. That
|
|
75
|
-
endpoint fails closed if an association is missing or expired; it never silently
|
|
76
|
-
uses the startup parent identity. Generic MCP configurations retain their existing
|
|
77
|
-
identity handling. The hook targets `mcp__plugin_square_square__*`, not unrelated
|
|
78
|
-
servers with similar operation names.
|
|
79
|
-
|
|
80
|
-
The mod owns publication and token-matched removal in `finally`; the server only
|
|
81
|
-
reads. Associations are private, transient transport files under
|
|
82
|
-
`<host-ledger-root>/claude-mcp-calls`, not Square domain state or another artifact.
|
|
83
|
-
Normal completion/errors remove them. If abrupt cancellation, unload or a crash
|
|
84
|
-
prevents cleanup, they expire after ten minutes and the next publication prunes
|
|
85
|
-
them. Expiry gates lookup, not an operation that already captured its context.
|
|
86
|
-
MCP owns operation cancellation and connection shutdown. No second execution
|
|
87
|
-
protocol, resident service or ledger schema migration is introduced.
|
|
88
|
-
|
|
89
|
-
## Membership and lifecycle
|
|
90
|
-
|
|
91
|
-
Participants join explicitly. The mod never discovers or joins a square from its
|
|
92
|
-
filename; `PUBLIC.square` has no special behavior. Existing memberships reconcile
|
|
93
|
-
on startup. Main-conversation tool completion (including failed/aborted tools) and
|
|
94
|
-
conversation start reconcile late memberships: the receiver itself publishes
|
|
95
|
-
routes; the CLI cannot infer mod capability from a socket or session environment.
|
|
96
|
-
This reconciliation injects no activity and does not poll. Its recovery sweep
|
|
97
|
-
only sends previously unsent eligible attention, never unknown/admitted attempts.
|
|
98
|
-
|
|
99
|
-
Initial activation and hot reload use `session.start`. New conversations use
|
|
100
|
-
`classic.SessionStart`: clear reads the new API coordinate; **resume's event
|
|
101
|
-
`session_id` is already the resumed coordinate while `$.session.id()` still reads
|
|
102
|
-
the ending one (observed in 2.1.295)**. The event coordinate is used at that boundary, with
|
|
103
|
-
API cwd/version/socket. Modern `session.end` detaches only its pinned `e.sessionId`
|
|
104
|
-
and captured owner/join generations, within the event budget. Late committed joins
|
|
105
|
-
are discovered at the pinned end timestamp. A process crash can omit end.
|
|
106
|
-
|
|
107
|
-
Host end is not a participant departure: no `done` lands, and membership, listens,
|
|
108
|
-
read horizon and generation remain intact. Catch ownership, deferrals and wake readiness
|
|
109
|
-
are cleared; the participant appears away and keeps accumulating unread audience without
|
|
110
|
-
proactive delivery. Before arming a receiver, start/resume discovers the exact owner's
|
|
111
|
-
standing seats through `seatsOf(owner)` and restores only detached ones with
|
|
112
|
-
`reattach(name, {owner, wakeAddress?})`. The adapter obtains that owner with
|
|
113
|
-
`harnessOwner({channel: 'claude-code', session, agent?})`. One failed seat or location does not block the
|
|
114
|
-
others. New/forked harness owners restore nothing. Neither a voluntary `done` nor a takeover is
|
|
115
|
-
revived; there is no completed-seat recovery path or timeout that turns away into done.
|
|
116
|
-
See [participant-ownership.md](participant-ownership.md).
|
|
117
|
-
|
|
118
|
-
## Body, admission, and presentation
|
|
119
|
-
|
|
120
|
-
The coordinator uses Square's canonical audience projection and bounded body
|
|
121
|
-
preview. Agora notifications identify the square, receiving participant and activity before its
|
|
122
|
-
event and body. A clipped preview describes catching that activity to read it in full; it never
|
|
123
|
-
embeds shell commands or tool-call syntax. Direct Channel notifications carry their stored preview
|
|
124
|
-
or body instead. Channel custody and consumption use `msg/N`; Agora relations use `act/N`.
|
|
125
|
-
Opaque text correlation resolves through bound memberships and the existing
|
|
126
|
-
attempt ledger, never a path or asserted source from incoming text.
|
|
127
|
-
|
|
128
|
-
Transport is the Node-only leaf published as `@astrosheep/agent-delivery/claude-native`,
|
|
129
|
-
sourced from `packages/agent-delivery/src/claude-native.ts`. Square imports that
|
|
130
|
-
source directly; its root package ships the compiled leaf without loading the
|
|
131
|
-
OpenCode SDK or requiring a separate agent-delivery installation. There is no
|
|
132
|
-
second socket sender. Receipt semantics (`written` is local bytes only, never
|
|
133
|
-
admission), the plain-peer use, and the standalone client API are documented in
|
|
134
|
-
the package `README.md`; the leaf accepts only target/session endpoint, text, and
|
|
135
|
-
bounded deadline/cancellation control.
|
|
136
|
-
|
|
137
|
-
`session.receive` runs before native policy; Square owns this admission gate and
|
|
138
|
-
the presentation writer, not the leaf. `await next(e)` confirms queue admission
|
|
139
|
-
only when the returned text is unchanged. Hold/refuse reject that gate;
|
|
140
|
-
consumed/rewritten results cannot confirm the original. Unknown peer messages
|
|
141
|
-
pass through. Recognized stale/cancelled deliveries can be consumed before queueing.
|
|
142
|
-
No ambiguous send is blindly retried.
|
|
143
|
-
|
|
144
|
-
The sole presentation writer observes **returned stored main user-role text**
|
|
145
|
-
after `session.append.next`. The native attempt persists the payload hash and full/clipped coverage
|
|
146
|
-
before sending. Stored ACK matches the entire framed payload against that persisted hash and checks
|
|
147
|
-
the captured custody and current eligibility; it does not depend on rendering the payload again with
|
|
148
|
-
the current renderer. Persisted full coverage records seen + presented; clipped coverage records
|
|
149
|
-
clipped only. This means stored in model context, not processed or understood. Catch/presentation
|
|
150
|
-
races are idempotent and revalidated immediately before send and inside the observation transaction.
|
|
151
|
-
|
|
152
|
-
## Cancellation and custody
|
|
153
|
-
|
|
154
|
-
Explicit plugin `turn.abort` and terminal `turn.complete(reason:'aborted')`
|
|
155
|
-
suppress the outstanding local batch without recording seen. Ordinary answer,
|
|
156
|
-
refusal, and error completion are not user cancellation. Separate engine-owned
|
|
157
|
-
family state survives hot reload, containing the abort timestamp and frozen
|
|
158
|
-
membership generations. The artifact stores a generation-scoped monotonic message-index
|
|
159
|
-
cutoff; replacement generations cannot inherit the old abort.
|
|
160
|
-
|
|
161
|
-
Engine state reads are snapshots of one dispatch. Confirmation therefore uses
|
|
162
|
-
one immediate fresh `clock.after` dispatch to read cancellation, not a repeated
|
|
163
|
-
read in the old dispatch. It is not polling. If reload cancels a pending callback,
|
|
164
|
-
its evidence stays unknown: reload does not replay it. A failed cancel bridge
|
|
165
|
-
can be repaired by the fresh confirmation/reconciliation dispatch from retained
|
|
166
|
-
engine state. If all bridge/state operations are unavailable, Square cannot
|
|
167
|
-
promise a receipt or suppression; it fails boundedly and preserves unrelated
|
|
168
|
-
Claude behavior.
|
|
169
|
-
|
|
170
|
-
**Already queued OR natively held messages cannot be retracted.** Approval may
|
|
171
|
-
release a held message without another receive guard. Append is observational,
|
|
172
|
-
not a veto. Square suppresses local retries and stale evidence but cannot erase
|
|
173
|
-
native custody or promise that remote work will not run. New activity after the
|
|
174
|
-
abort remains eligible. Protocol design and runtime evidence live in the package
|
|
175
|
-
`VALIDATION.md` and the commission artifacts it cites; the repository fixtures
|
|
176
|
-
cover the same coordinator and packaging boundaries without requiring a Claude
|
|
177
|
-
installation.
|
|
3
|
+
Square's Claude plugin is a mod, not a shell-hook injector. Its MCP server uses the mod's call-local
|
|
4
|
+
session association; a missing or expired association fails closed. A session ID or socket alone does
|
|
5
|
+
not establish that the mod is loaded. The supported native path requires macOS Claude Code with the
|
|
6
|
+
mod loaded and approved. Square does not alter inbound policy or bypass a held peer message.
|
|
7
|
+
|
|
8
|
+
The mod attaches and detaches the exact host session in the delivery ledger. Membership remains in
|
|
9
|
+
Square; host end does not land `done`, and start/resume does not restore seats. See
|
|
10
|
+
[participant-ownership.md](participant-ownership.md).
|
|
11
|
+
|
|
12
|
+
The sender dispatches finished ledger cards through the native socket. Native admission settles a
|
|
13
|
+
handoff as accepted, not presented; the stored main user-role text observation settles presentation
|
|
14
|
+
through its handoff reference. This establishes observation at that boundary, not comprehension, and
|
|
15
|
+
cannot promise that a later plugin leaves the card intact. Unknown native custody is not a safe reason
|
|
16
|
+
to replay through another route. A shortened activity card points to catch; Square only folds a receipt
|
|
17
|
+
for a full card into its read state. Direct producer notices retain their full body.
|
|
18
|
+
|
|
19
|
+
`turn.abort` cancels the outstanding ledger batch without asserting it was read. Already queued or
|
|
20
|
+
natively held messages cannot be recalled. The shared transport and its validated limits are documented
|
|
21
|
+
in [agent-delivery's README](../packages/agent-delivery/README.md) and `VALIDATION.md`.
|
package/guides/codex-delivery.md
CHANGED
|
@@ -1,92 +1,67 @@
|
|
|
1
1
|
# Codex delivery
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
app-server capability and its host-owned hook integration.
|
|
3
|
+
Producers post neutral cards to DeliveryLedger; neither default dispatch nor public `postAndDispatch`
|
|
4
|
+
queues Codex input. A native receiver owns both synchronous presentation and idle queue admission.
|
|
5
|
+
It never reads Square artifacts or producer content stores.
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
The shipped hooks for Codex 0.166.0 are synchronous SessionStart, UserPromptSubmit, PreToolUse,
|
|
8
|
+
PostToolUse, Stop, Interrupt and SessionEnd, plus an async Stop command with `timeout: 86400` seconds.
|
|
9
|
+
SessionStart disarms and attaches the exact native session. Active prompt/tool boundaries disarm and
|
|
10
|
+
present eligible cards as event-correct `additionalContext`, using neutral reminder framing and the
|
|
11
|
+
original card text. The output sink must accept the response before presentation evidence is recorded;
|
|
12
|
+
a later suppression does not erase a real output effect. SessionEnd disarms and detaches. None of these
|
|
13
|
+
host lifecycle events restores or detaches Square seats. SessionResume is not a verified native event
|
|
14
|
+
and is not registered. A resume path without a real SessionStart/Stop has no inferred idle authority.
|
|
11
15
|
|
|
12
|
-
|
|
16
|
+
Each synchronous Stop stores a unique token and native turn ID in the existing boundary store. One
|
|
17
|
+
receiver-owned `square codex-watch` command holds a separate private OS-backed lock for its native
|
|
18
|
+
session coordinate and observes the ledger, with a one-second bounded rescan for boundary changes or
|
|
19
|
+
missed notifications. Duplicate async Stop processes exit; the existing watcher follows newer Stop
|
|
20
|
+
tokens. The lock does not prove idle state. Observation never reserves cards while waiting.
|
|
13
21
|
|
|
14
|
-
|
|
22
|
+
Before claiming each card, the watcher reads the hosting endpoint's `thread/read(includeTurns:true)`.
|
|
23
|
+
It requires loaded idle state and the newest live turn to be completed with exactly the captured Stop
|
|
24
|
+
turn ID. Newest-last history ordering is verified for 0.166.0; other versions fail closed until verified.
|
|
25
|
+
After claiming, the receiver repeats that native read, checks the exact epoch again, then checks ledger
|
|
26
|
+
currentness, suppression, cancellation, attachment generation, signal and deadline immediately before
|
|
27
|
+
CLI invocation. Queue always uses the existing hosting endpoint explicitly, without starting a service.
|
|
28
|
+
Missing, malformed, ephemeral, notLoaded, active, interrupted or unreadable history cannot authorize a
|
|
29
|
+
queue. A delayed stale Stop cannot authorize sending merely by arriving after an active callback.
|
|
15
30
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
A new/forked session restores nothing.
|
|
24
|
-
- `PostToolUse` asks Square for current pending activity and returns the existing
|
|
25
|
-
bounded `additionalContext` presentation.
|
|
26
|
-
- `Stop` records queue eligibility and sweeps pending work, but does not itself
|
|
27
|
-
claim that a preview was presented.
|
|
31
|
+
`square codex-interrupt` handles only a native Interrupt payload and cancels the captured attachment's
|
|
32
|
+
pending through-sequence batch, then future cards remain available after a later verified Stop or active
|
|
33
|
+
boundary. Replacement attachments are fenced by generation. Before-effect epoch/suppression/cancel
|
|
34
|
+
failures release their claims where the ledger permits. Attachment rotation already normalizes an
|
|
35
|
+
in-flight ledger attempt to unknown: that custody remains unknown even if the final receiver check
|
|
36
|
+
then proves no queue was launched. The watcher exits on detach, deletion or generation change and
|
|
37
|
+
retains its ledger connection only for already-captured late settlements.
|
|
28
38
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
the internal budget, the hook waits for it and returns the associated context;
|
|
36
|
-
it never abandons settlement that can mark activity seen without returning text.
|
|
37
|
-
After expiry, no sweep starts, and a sweep timeout cannot erase successful pull
|
|
38
|
-
output. Settlement must still finish within Codex's external hook timeout. Hook inbox lookup uses
|
|
39
|
-
an exact owner from `harnessOwner({ channel: 'codex', session })`, not a bare session id. The shared
|
|
40
|
-
boundary store uses Square's caller-selected `SQUARE_CODEX_BOUNDARIES` file,
|
|
41
|
-
defaulting to `~/.square/codex-boundaries.json`; its JSON observations are not
|
|
42
|
-
conversation storage and are not proof of current native execution or consumption.
|
|
43
|
-
Square's format-11 artifact remains authoritative for membership, attachment and delivery evidence.
|
|
44
|
-
Message custody uses `msg/N`; Agora activity relations use `act/N`. Endpoint generations are opaque
|
|
45
|
-
and are compared for equality when fencing custody.
|
|
46
|
-
Detached members appear away indefinitely and keep accumulating unread audience, but have no
|
|
47
|
-
write or proactive delivery eligibility until same-owner reattachment. Only a host-confirmed
|
|
48
|
-
permanent deletion uses fenced membership-ending cleanup; Codex SessionEnd is not that proof.
|
|
39
|
+
Queue admission is custody, not presentation or model comprehension. Accepted/unknown outbox custody
|
|
40
|
+
has no remaining card content and cannot be automatically replayed. Invoked timeout or ambiguous
|
|
41
|
+
results remain unknown. Native idle reads and external queue are not atomic: a new turn can start after
|
|
42
|
+
the final check and a raced queue may arrive later. Interrupt cannot recall input already admitted by
|
|
43
|
+
Codex, and hook failure/timeout cannot prove that cancellation happened. Native callbacks have no
|
|
44
|
+
cross-incarnation event identity; SessionEnd can fence only the attachment observed when it runs.
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
artifact-owned delivery path; no host ledger or new route kind is introduced.
|
|
46
|
+
There is no watcher before the first Stop. Synchronous boundaries can present; otherwise cards wait.
|
|
47
|
+
The async budget is finite 24 hours, not a promise of 24-hour observation. After timeout, crash, host
|
|
48
|
+
termination or missed spawn while idle, cards wait for the next Stop/user/native boundary. There is no
|
|
49
|
+
producer fallback or autonomous crash-idle recovery. During attachment replacement an old watcher
|
|
50
|
+
may briefly retain the coordinate lock while the new Stop's duplicate exits; the next Stop restores
|
|
51
|
+
observation after the old process releases it.
|
|
57
52
|
|
|
58
|
-
|
|
59
|
-
recipient's `CODEX_HOME` (or home default), so later senders use the recipient's
|
|
60
|
-
CLI configuration rather than their own. Only an explicitly configured
|
|
61
|
-
`SQUARE_CODEX_ENDPOINT` adds a remote endpoint. `SQUARE_CODEX_BIN` remains
|
|
62
|
-
Square's executable selection; it is not an environment convention of the
|
|
63
|
-
independent package.
|
|
53
|
+
Reproduce the isolated native smoke from this checkout after a worktree-local build:
|
|
64
54
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
check also catches an end observed while the currentness gate was running.
|
|
70
|
-
It cannot retract a submission already launched or infer a missed end hook.
|
|
71
|
-
Queue success means native admission only; its receipt id is a local attempt
|
|
72
|
-
UUID, not a server message id. The child runs asynchronously and respects the
|
|
73
|
-
send's abort signal/deadline. Timeout, killed child and unexplained post-launch
|
|
74
|
-
failures remain unknown, not a safe reason to resend. A receiver with no tool
|
|
75
|
-
calls waits for Stop; this path is not instantaneous native steer.
|
|
55
|
+
```sh
|
|
56
|
+
env -u SQUARE_HOST_LEDGER_ROOT SQUARE_CODEX_NATIVE_SMOKE=1 \
|
|
57
|
+
node --import ./test/sandbox-env.js test/codex-watch-native.mjs
|
|
58
|
+
```
|
|
76
59
|
|
|
77
|
-
|
|
60
|
+
The probe creates a temporary HOME/CODEX_HOME, installs no plugin, and uses the actual shipped hook
|
|
61
|
+
manifest/CLI with an isolated native app-server and loopback fixture provider. Its JSON evidence names
|
|
62
|
+
the temporary directory. It verifies native Stop startup, idle wake, busy fencing, singleton reuse,
|
|
63
|
+
Interrupt RPC cancellation, real UserPromptSubmit presentation and process-group shutdown. Physical
|
|
64
|
+
TUI Escape-to-Interrupt is not verified; neither are 24-hour operation or every resume path.
|
|
78
65
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
`transport: 'app-server'` is the explicit spelling and the default when omitted;
|
|
82
|
-
it exposes both methods. `transport: 'cli'` exposes queue only and requires the
|
|
83
|
-
host's hook lifecycle source at connection time. There is no automatic fallback
|
|
84
|
-
between transports. The app-server transport never starts a service or calls
|
|
85
|
-
`thread/resume`. This does not replace Square's hook policy or add a new persisted
|
|
86
|
-
Square route kind. A loaded thread's owner remains its existing host, not the
|
|
87
|
-
external sender.
|
|
88
|
-
|
|
89
|
-
Neither path implements a read-receipt roundtrip. Admission and runtime
|
|
90
|
-
observations must not be presented as model comprehension or completion. An
|
|
91
|
-
unknown outcome stays unknown. Installing, restarting or changing a real Codex
|
|
92
|
-
server is outside this integration.
|
|
66
|
+
The shared package documents its transport leaves in [its README](../packages/agent-delivery/README.md).
|
|
67
|
+
See [participant ownership](participant-ownership.md) for host attachment and Square membership.
|