@astrosheep/square 0.3.92 → 0.3.94
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 +2 -2
- package/dist/boundary-presentation.d.ts +2 -2
- package/dist/catch-decisions.d.ts +4 -6
- package/dist/catch-decisions.js +4 -4
- 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 -25
- package/dist/cli/express-presentation.d.ts +3 -1
- package/dist/cli/express-presentation.js +26 -14
- 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 +2 -2
- package/dist/cli/registry.js +6 -3
- package/dist/cli/square-commands.d.ts +1 -1
- package/dist/cli/square-commands.js +46 -54
- 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 -11
- package/dist/decisions.js +9 -20
- package/dist/delivery-deferral.js +2 -2
- 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 +38 -38
- package/dist/delivery.d.ts +1 -1
- package/dist/delivery.js +1 -1
- package/dist/harness-links.d.ts +1 -10
- package/dist/harness-links.js +144 -109
- package/dist/harness.js +4 -13
- package/dist/help.js +12 -10
- 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 +8 -15
- package/dist/model.js +4 -7
- package/dist/notifications.d.ts +1 -1
- package/dist/notifications.js +6 -5
- package/dist/operation-presentation.d.ts +5 -4
- package/dist/operation-presentation.js +50 -45
- 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 +13 -33
- package/dist/presentation-operations.js +4 -4
- package/dist/presentation.d.ts +5 -8
- package/dist/presentation.js +33 -43
- package/dist/runtime.d.ts +1 -7
- package/dist/runtime.js +0 -14
- 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 -22
- package/dist/sqlite-square.js +138 -161
- package/dist/square-api.d.ts +15 -10
- package/dist/square-api.js +26 -22
- package/dist/square-core.d.ts +0 -5
- package/dist/square-core.js +0 -9
- package/dist/square-domain.d.ts +4 -2
- package/dist/square-domain.js +56 -21
- package/dist/square-facade.d.ts +45 -87
- package/dist/square-index.d.ts +5 -13
- package/dist/square-index.js +13 -38
- package/dist/square-location.d.ts +1 -14
- package/dist/square-location.js +4 -69
- 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 +2 -1
- package/dist/square-migration.js +52 -30
- package/dist/square-sqlite.d.ts +6 -2
- package/dist/square-sqlite.js +54 -28
- package/dist/square-tools.d.ts +7 -10
- package/dist/square-tools.js +22 -54
- package/dist/stream.js +4 -5
- package/dist/views.d.ts +21 -10
- package/dist/views.js +38 -38
- package/dist/wakes.d.ts +1 -2
- package/dist/wakes.js +1 -1
- package/guides/application-facade-delivery-evidence.md +1 -1
- package/guides/claude-native.md +18 -9
- package/guides/codex-delivery.md +17 -6
- package/guides/mcp-connection-lifetime.md +1 -1
- package/guides/mcp.md +3 -3
- package/guides/migration.md +142 -151
- package/guides/operation-cancellation.md +1 -1
- package/guides/participant-ownership.md +78 -47
- package/guides/pi-tools.md +33 -4
- package/guides/primitive-history-consolidation.md +1 -1
- package/guides/row-storage-design.md +8 -8
- package/guides/square-api.md +244 -88
- package/package.json +2 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- 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/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
package/dist/seats.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { SquareError,
|
|
2
|
-
export function
|
|
3
|
-
if (
|
|
4
|
-
throw new SquareError('invalid_args', 'Participant writes require an explicit
|
|
5
|
-
|
|
6
|
-
return
|
|
1
|
+
import { SquareError, validateOwner, validateName } from './model.js';
|
|
2
|
+
export function requireOwner(owner) {
|
|
3
|
+
if (owner === undefined)
|
|
4
|
+
throw new SquareError('invalid_args', 'Participant writes require an explicit owner.');
|
|
5
|
+
validateOwner(owner);
|
|
6
|
+
return owner;
|
|
7
7
|
}
|
|
8
8
|
export function requireJoinName(name) {
|
|
9
9
|
if (name === undefined)
|
|
@@ -12,16 +12,8 @@ export function requireJoinName(name) {
|
|
|
12
12
|
return name;
|
|
13
13
|
}
|
|
14
14
|
export function asSeatRef(seat) {
|
|
15
|
-
|
|
16
|
-
return ref;
|
|
15
|
+
return { participant: seat.participant, owner: seat.owner, generation: seat.generation };
|
|
17
16
|
}
|
|
18
17
|
export function participantAuthority(seat) {
|
|
19
18
|
return { kind: 'participant', seat: asSeatRef(seat) };
|
|
20
19
|
}
|
|
21
|
-
export function requireSeat(seat, body, participant) {
|
|
22
|
-
if (seat === undefined || !sameName(seat.participant, participant))
|
|
23
|
-
throw new SquareError('already_joined', `${participant} needs a current participant handle; join first`);
|
|
24
|
-
if (!sameBody(seat.body, requireBody(body)))
|
|
25
|
-
throw new SquareError('already_joined', `${participant} is not held by this body`);
|
|
26
|
-
return seat;
|
|
27
|
-
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { type Owner } from './owner.js';
|
|
1
2
|
import type { AutomaticProvider } from './participant-identity.js';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
import type { WakeAddress } from './model.js';
|
|
4
|
+
/** Host shutdown suspends execution, not membership. Discovery never grants custody. */
|
|
5
|
+
export declare function detachSessionSeats(provider: AutomaticProvider, sessionId: string, env?: NodeJS.ProcessEnv): Promise<void>;
|
|
6
|
+
/** Restore only detached, standing seats of this exact owner before starting a receiver. */
|
|
7
|
+
export declare function restoreSessionSeats(owner: Owner, env?: NodeJS.ProcessEnv, wakeAddress?: WakeAddress, signal?: AbortSignal): Promise<void>;
|
|
@@ -1,19 +1,47 @@
|
|
|
1
1
|
import { Square } from './square-api.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { harnessOwner } from './owner.js';
|
|
3
|
+
import { projectSessionCandidates, projectSessionSeats } from './inbox.js';
|
|
4
|
+
function ownerFor(provider, sessionId) {
|
|
5
|
+
return harnessOwner({ channel: provider === 'claude' ? 'claude-code' : provider, session: sessionId });
|
|
5
6
|
}
|
|
6
|
-
/**
|
|
7
|
-
export async function
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const square = await Square.at({ path: location, env, body, participant: seat.participant });
|
|
7
|
+
/** Host shutdown suspends execution, not membership. Discovery never grants custody. */
|
|
8
|
+
export async function detachSessionSeats(provider, sessionId, env = process.env) {
|
|
9
|
+
const owner = ownerFor(provider, sessionId);
|
|
10
|
+
for (const { location, seat } of await projectSessionSeats({ owner, env })) {
|
|
11
|
+
let square;
|
|
12
12
|
try {
|
|
13
|
-
await
|
|
13
|
+
square = await Square.at({ path: location, env });
|
|
14
|
+
await square.detach(seat.participant, { owner, generation: seat.generation });
|
|
14
15
|
}
|
|
16
|
+
catch { /* One unavailable or replaced seat must not block cleanup of the others. */ }
|
|
15
17
|
finally {
|
|
16
|
-
await square
|
|
18
|
+
await square?.close();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** Restore only detached, standing seats of this exact owner before starting a receiver. */
|
|
23
|
+
export async function restoreSessionSeats(owner, env = process.env, wakeAddress, signal) {
|
|
24
|
+
const locations = new Set((await projectSessionCandidates({ owner, env })).map(candidate => candidate.location));
|
|
25
|
+
for (const location of locations) {
|
|
26
|
+
if (signal?.aborted)
|
|
27
|
+
return;
|
|
28
|
+
let square;
|
|
29
|
+
try {
|
|
30
|
+
square = await Square.at({ path: location, env }, { signal });
|
|
31
|
+
for (const seat of await square.seatsOf(owner)) {
|
|
32
|
+
if (signal?.aborted)
|
|
33
|
+
return;
|
|
34
|
+
if (seat.attachment !== 'detached')
|
|
35
|
+
continue;
|
|
36
|
+
try {
|
|
37
|
+
await square.reattach(seat.name, { owner, wakeAddress }, { signal });
|
|
38
|
+
}
|
|
39
|
+
catch { /* A replacement or one failed seat does not block its peers. */ }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch { /* An indexed location is only a candidate, not a promise of availability. */ }
|
|
43
|
+
finally {
|
|
44
|
+
await square?.close();
|
|
17
45
|
}
|
|
18
46
|
}
|
|
19
47
|
}
|
package/dist/sqlite-square.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type {
|
|
1
|
+
import { type Owner } from './model.js';
|
|
2
|
+
import type { HistoryQuery, HistoryResult, JoinOptions, JoinResult, LifecycleResult, ObservationOptions, OperationControl, Participant, SquareAtInput, SquareBuildInput, SquareLocation, StatusOptions, StatusResult, ParticipantsResult, RecoveryResult, DiscoveryOptions, InboxOptions, InboxResult, StreamOptions, StreamRecord, Activity, PerceivedActivity } from './square-facade.js';
|
|
3
3
|
export type * from './square-facade.js';
|
|
4
4
|
export { createSquareResourceOwner } from './artifact.js';
|
|
5
5
|
export { formatActivityId, parseActivityId, MAX_IDENTITY_SET_SIZE } from './square-core.js';
|
|
@@ -13,41 +13,55 @@ export declare class SqliteSquare {
|
|
|
13
13
|
readonly location: string;
|
|
14
14
|
private readonly artifact;
|
|
15
15
|
private readonly clock;
|
|
16
|
-
private readonly body?;
|
|
17
|
-
private readonly wakeAddress?;
|
|
18
16
|
private readonly wakeTransport?;
|
|
19
17
|
private readonly indexPath?;
|
|
20
|
-
private readonly
|
|
21
|
-
private readonly
|
|
22
|
-
private readonly defaultParticipant?;
|
|
18
|
+
private readonly closesArtifact;
|
|
19
|
+
private readonly deliveryLocation;
|
|
23
20
|
private constructor();
|
|
24
|
-
static at(input: SquareAtInput, control?: OperationControl
|
|
25
|
-
static build(input: SquareBuildInput, control?: OperationControl
|
|
21
|
+
static at(input: SquareAtInput, control?: OperationControl): Promise<SqliteSquare>;
|
|
22
|
+
static build(input: SquareBuildInput, control?: OperationControl): Promise<SqliteSquare>;
|
|
26
23
|
static inMemory(input: Omit<SquareBuildInput, 'path' | 'resources'>): SqliteSquare;
|
|
27
|
-
/** Discovery is best effort and never grants write authority.
|
|
28
|
-
private
|
|
24
|
+
/** Discovery is best effort and never grants write authority. */
|
|
25
|
+
private publishSeat;
|
|
29
26
|
private observation;
|
|
30
27
|
private contextObservation;
|
|
31
28
|
private handle;
|
|
32
29
|
private static readonly ParticipantHandle;
|
|
33
|
-
participant(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}>;
|
|
30
|
+
participant(name: string, { owner }: {
|
|
31
|
+
readonly owner: Owner;
|
|
32
|
+
}): Promise<Participant>;
|
|
33
|
+
join(requested: string, options: JoinOptions, control?: OperationControl): Promise<JoinResult>;
|
|
34
|
+
/** Restore only a standing seat; a concurrent departure or takeover cannot be revived. */
|
|
35
|
+
reattach(name: string, { owner, wakeAddress }: Pick<JoinOptions, 'owner' | 'wakeAddress'>, control?: OperationControl): Promise<Participant | null>;
|
|
39
36
|
snapshot(control?: OperationControl): Promise<import("./square-facade.js").SquareSnapshot>;
|
|
40
37
|
history(query?: HistoryQuery, control?: OperationControl): Promise<HistoryResult>;
|
|
41
38
|
status(options?: StatusOptions, control?: OperationControl): Promise<StatusResult>;
|
|
42
39
|
participants(options?: ObservationOptions, control?: OperationControl): Promise<ParticipantsResult>;
|
|
43
40
|
recovery(requested?: string, control?: OperationControl): Promise<RecoveryResult>;
|
|
44
|
-
stream(options: StreamOptions
|
|
45
|
-
|
|
41
|
+
stream(options: StreamOptions & {
|
|
42
|
+
readonly recipient: string;
|
|
43
|
+
}, control?: OperationControl): AsyncIterable<PerceivedActivity>;
|
|
44
|
+
stream(options: StreamOptions & {
|
|
45
|
+
readonly recipient?: undefined;
|
|
46
|
+
}, control?: OperationControl): AsyncIterable<Activity>;
|
|
47
|
+
stream(options: StreamOptions, control?: OperationControl): AsyncIterable<StreamRecord>;
|
|
48
|
+
seatsOf(owner: Owner): Promise<readonly import('./square-facade.js').HeldSeat[]>;
|
|
46
49
|
close(): Promise<void>;
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
private heldSeat;
|
|
51
|
+
cancelDeliveries(name: string, identity: {
|
|
52
|
+
readonly owner: Owner;
|
|
53
|
+
readonly generation: import('./square-core.js').ActivityId;
|
|
54
|
+
}): Promise<boolean>;
|
|
55
|
+
detach(name: string, identity: {
|
|
56
|
+
readonly owner: Owner;
|
|
57
|
+
readonly generation: import('./square-core.js').ActivityId;
|
|
58
|
+
}): Promise<true | null>;
|
|
59
|
+
endHeld(name: string, identity: {
|
|
60
|
+
readonly owner: Owner;
|
|
61
|
+
readonly generation: import('./square-core.js').ActivityId;
|
|
62
|
+
}): Promise<LifecycleResult | null>;
|
|
49
63
|
}
|
|
50
64
|
export declare function diagnoseSquare(input: SquareLocation, control?: OperationControl): Promise<import("./artifact.js").DiagnoseResult>;
|
|
51
65
|
export declare function migrateSquare(input: SquareLocation, control?: OperationControl): Promise<import("./square-migration.js").MigrationOutcome>;
|
|
52
66
|
export declare function discover(input: SquareAtInput, options?: DiscoveryOptions, control?: OperationControl): Promise<import("./square-facade.js").DiscoveryResult>;
|
|
53
|
-
export declare function inbox(input: SquareAtInput,
|
|
67
|
+
export declare function inbox(input: SquareAtInput, owner: Owner, options?: InboxOptions, control?: OperationControl): Promise<InboxResult>;
|