@astrosheep/square 0.3.69 → 0.3.71
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 +4 -5
- package/dist/activity-feed.js +14 -10
- package/dist/artifact.d.ts +26 -33
- package/dist/artifact.js +346 -317
- package/dist/attention-presentation.js +2 -9
- package/dist/automatic-session.js +6 -6
- package/dist/boundary-presentation.js +3 -3
- package/dist/catch-decisions.d.ts +19 -12
- package/dist/catch-decisions.js +32 -68
- package/dist/claude-delivery.js +7 -7
- package/dist/claude-mod.js +18 -7
- package/dist/cli/catch-presentation.d.ts +7 -0
- package/dist/cli/catch-presentation.js +55 -0
- package/dist/cli/context.d.ts +1 -1
- package/dist/cli/context.js +5 -23
- package/dist/cli/express-presentation.d.ts +10 -0
- package/dist/cli/express-presentation.js +196 -0
- package/dist/cli/maintenance-commands.d.ts +4 -0
- package/dist/cli/maintenance-commands.js +29 -6
- package/dist/cli/observation-commands.d.ts +7 -5
- package/dist/cli/observation-commands.js +275 -262
- package/dist/cli/program.d.ts +1 -1
- package/dist/cli/program.js +43 -56
- package/dist/cli/registry.js +2 -1
- package/dist/cli/square-commands.d.ts +3 -9
- package/dist/cli/square-commands.js +134 -255
- package/dist/codex-queue.js +4 -1
- package/dist/decisions.d.ts +26 -74
- package/dist/decisions.js +190 -335
- package/dist/delivery-health.js +13 -22
- package/dist/delivery-operations.d.ts +0 -11
- package/dist/delivery-operations.js +44 -33
- package/dist/delivery.d.ts +33 -32
- package/dist/delivery.js +70 -81
- package/dist/harness-claude.js +1 -1
- package/dist/harness-codex.js +1 -1
- package/dist/harness-pi.js +1 -1
- package/dist/help.js +6 -1
- package/dist/inbox.d.ts +27 -0
- package/dist/inbox.js +55 -18
- package/dist/index.d.ts +2 -4
- package/dist/index.js +1 -1
- package/dist/list.d.ts +7 -1
- package/dist/list.js +49 -122
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +7 -37
- package/dist/model.d.ts +4 -44
- package/dist/model.js +1 -3
- package/dist/notifications.d.ts +1 -1
- package/dist/notifications.js +13 -7
- package/dist/open-square.d.ts +16 -2
- package/dist/open-square.js +40 -1
- package/dist/perception-projection.d.ts +6 -15
- package/dist/perception-projection.js +6 -26
- package/dist/{opencode-delivery.d.ts → plugins/opencode/delivery.d.ts} +1 -1
- package/dist/{opencode-delivery.js → plugins/opencode/delivery.js} +18 -18
- package/dist/{opencode.d.ts → plugins/opencode/index.d.ts} +2 -2
- package/dist/{opencode.js → plugins/opencode/index.js} +9 -9
- package/dist/ports.d.ts +156 -11
- package/dist/presentation-operations.d.ts +1 -1
- package/dist/presentation-operations.js +35 -44
- package/dist/presentation.d.ts +12 -19
- package/dist/presentation.js +33 -54
- package/dist/routes.d.ts +7 -14
- package/dist/routes.js +33 -62
- package/dist/runtime.d.ts +12 -39
- package/dist/runtime.js +33 -164
- package/dist/square-actions.d.ts +11 -21
- package/dist/square-actions.js +171 -271
- package/dist/square-application.d.ts +31 -55
- package/dist/square-application.js +637 -141
- package/dist/square-core.d.ts +3 -94
- package/dist/square-core.js +8 -353
- package/dist/square-domain.d.ts +24 -0
- package/dist/square-domain.js +77 -0
- package/dist/square-facade.d.ts +360 -9
- package/dist/square-migration.d.ts +24 -0
- package/dist/square-migration.js +211 -0
- package/dist/square-projections.d.ts +2 -42
- package/dist/square-projections.js +1 -37
- package/dist/square-sqlite.d.ts +59 -0
- package/dist/square-sqlite.js +702 -0
- package/dist/stream.d.ts +3 -10
- package/dist/stream.js +81 -52
- package/dist/views.d.ts +27 -95
- package/dist/views.js +217 -87
- package/dist/wake-eligibility.d.ts +15 -5
- package/dist/wake-eligibility.js +32 -16
- package/dist/wakes.d.ts +3 -3
- package/dist/wakes.js +31 -27
- package/guides/application-facade-delivery-evidence.md +200 -0
- package/guides/application-facade-design.md +95 -0
- package/guides/change-waits.md +4 -4
- package/guides/migration.md +77 -0
- package/guides/pi-native-delivery.md +1 -1
- package/guides/primitive-catch-consolidation.md +85 -0
- package/guides/primitive-history-consolidation.md +76 -0
- package/guides/primitive-status-consolidation.md +87 -0
- package/guides/primitive-storage-consolidation.md +128 -0
- package/guides/row-runtime-delivery-evidence.md +160 -0
- package/guides/row-storage-design.md +567 -0
- package/package.json +5 -7
- package/{claude-plugin → plugins/claude}/.claude-plugin/plugin.json +1 -1
- package/{codex-plugin → plugins/codex}/.codex-plugin/plugin.json +1 -1
- package/plugins/opencode/delivery.ts +149 -0
- package/plugins/opencode/index.ts +136 -0
- package/plugins/paseo/OVERVIEW.md +14 -0
- package/plugins/paseo/README.md +54 -0
- package/plugins/paseo/client/square-message.tsx +106 -0
- package/plugins/paseo/client/transform.ts +24 -0
- package/plugins/paseo/index.client.tsx +19 -0
- package/plugins/paseo/package.json +19 -0
- package/plugins/paseo/paseo-plugin.json +7 -0
- package/plugins/paseo/shared/message.ts +29 -0
- package/{extensions → plugins/pi}/square-pi.js +8 -5
- package/dist/activity.d.ts +0 -14
- package/dist/activity.js +0 -248
- package/dist/square-file-adapter.d.ts +0 -26
- package/dist/square-file-adapter.js +0 -85
- package/dist/square-state.d.ts +0 -6
- package/dist/square-state.js +0 -138
- package/dist/square-storage.d.ts +0 -14
- package/dist/square-storage.js +0 -188
- package/dist/square-wiring.d.ts +0 -33
- package/dist/square-wiring.js +0 -109
- package/dist/watch.d.ts +0 -8
- package/dist/watch.js +0 -252
- /package/{claude-plugin → plugins/claude}/hooks/hooks.json +0 -0
- /package/{claude-plugin → plugins/claude}/hooks/register.js +0 -0
- /package/{claude-plugin → plugins/claude}/skills/square/SKILL.md +0 -0
- /package/{claude-plugin → plugins/claude}/types.d.ts +0 -0
- /package/{codex-plugin → plugins/codex}/hooks/hooks.json +0 -0
package/dist/stream.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} | {
|
|
5
|
-
readonly kind: 'after';
|
|
6
|
-
readonly after: number;
|
|
7
|
-
};
|
|
8
|
-
/** Machine-readable tailing stays available; interactive terminal rendering was retired. */
|
|
9
|
-
export declare function cmdStreamNdjson(squarePath: string, recipient?: string, start?: StreamStart): Promise<void>;
|
|
10
|
-
export declare function cmdStream(squarePath: string): Promise<void>;
|
|
1
|
+
import type { OpenOptions, OperationControl, StreamApplicationOptions, StreamApplicationRecord } from './square-facade.js';
|
|
2
|
+
/** Pull-based observation; return interrupts an outstanding pull before awaiting its cleanup. */
|
|
3
|
+
export declare function streamSquare(squarePath: string, options?: StreamApplicationOptions, control?: OperationControl, openOptions?: OpenOptions): AsyncIterable<StreamApplicationRecord>;
|
package/dist/stream.js
CHANGED
|
@@ -1,59 +1,88 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { openSquare, observeSquareChanges } from './square-file-adapter.js';
|
|
6
|
-
import { closeOpenSquare } from './open-square.js';
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import { SquareError } from './model.js';
|
|
3
|
+
import { observeSquareRevision } from './artifact.js';
|
|
4
|
+
import { openSquare, closeOpenSquare } from './open-square.js';
|
|
7
5
|
import { streamProjection, streamTailProjection } from './views.js';
|
|
8
|
-
/**
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
let hasMore;
|
|
6
|
+
/** Pull-based observation; return interrupts an outstanding pull before awaiting its cleanup. */
|
|
7
|
+
export function streamSquare(squarePath, options = {}, control, openOptions = {}) {
|
|
8
|
+
return {
|
|
9
|
+
[Symbol.asyncIterator]() {
|
|
10
|
+
const disposal = new AbortController();
|
|
11
|
+
const signal = control?.signal === undefined ? disposal.signal : AbortSignal.any([control.signal, disposal.signal]);
|
|
12
|
+
const iterationControl = { ...control, signal };
|
|
13
|
+
const records = observe();
|
|
14
|
+
return {
|
|
15
|
+
next: () => records.next(),
|
|
16
|
+
return() {
|
|
17
|
+
disposal.abort();
|
|
18
|
+
return records.return(undefined);
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
async function* observe() {
|
|
25
22
|
try {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
signal.throwIfAborted();
|
|
24
|
+
try {
|
|
25
|
+
await fs.stat(squarePath);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
signal.throwIfAborted();
|
|
29
|
+
throw new SquareError('unavailable', `Square is unavailable at ${squarePath}`);
|
|
30
|
+
}
|
|
31
|
+
signal.throwIfAborted();
|
|
32
|
+
const start = options.start ?? { kind: 'tail', last: 10 };
|
|
33
|
+
let cursor = start.kind === 'after' ? start.after : -1;
|
|
34
|
+
let initial = start.kind === 'tail' ? start : undefined;
|
|
35
|
+
const observer = await observeSquareRevision(squarePath);
|
|
36
|
+
const close = () => observer.close();
|
|
37
|
+
signal.addEventListener('abort', close, { once: true });
|
|
38
|
+
try {
|
|
39
|
+
signal.throwIfAborted();
|
|
40
|
+
while (true) {
|
|
41
|
+
const generation = observer.generation;
|
|
42
|
+
let baseline;
|
|
43
|
+
let projection;
|
|
44
|
+
try {
|
|
45
|
+
baseline = await observer.read(signal);
|
|
46
|
+
const square = await openSquare(squarePath, { ...openOptions, env: openOptions.env ?? {}, signal }, iterationControl);
|
|
47
|
+
try {
|
|
48
|
+
projection = initial === undefined
|
|
49
|
+
? await streamProjection(square, cursor, options.recipient, iterationControl)
|
|
50
|
+
: await streamTailProjection(square, initial.last, options.recipient, iterationControl);
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
await closeOpenSquare(square);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
signal.throwIfAborted();
|
|
58
|
+
if (error instanceof SquareError && error.code === 'invalid_args')
|
|
59
|
+
throw error;
|
|
60
|
+
// Repair/replacement is a hint, not a reason to scan history on a timer.
|
|
61
|
+
await observer.hinted(generation, Infinity, signal);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
for (const item of projection.activities) {
|
|
65
|
+
signal.throwIfAborted();
|
|
66
|
+
yield { seq: item.activity.index, square: squarePath, ...item.activity,
|
|
67
|
+
...(item.route === undefined ? {} : { route: item.route }) };
|
|
68
|
+
}
|
|
69
|
+
cursor = projection.cursor;
|
|
70
|
+
initial = undefined;
|
|
71
|
+
if (!projection.hasMore)
|
|
72
|
+
await observer.changed(baseline, Infinity, signal);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
signal.removeEventListener('abort', close);
|
|
77
|
+
observer.close();
|
|
34
78
|
}
|
|
35
|
-
cursor = projection.cursor;
|
|
36
|
-
initial = undefined;
|
|
37
|
-
hasMore = projection.hasMore;
|
|
38
79
|
}
|
|
39
|
-
|
|
40
|
-
|
|
80
|
+
catch (error) {
|
|
81
|
+
// Iterator disposal is completion; a caller cancellation still rejects the pull.
|
|
82
|
+
if (!disposal.signal.aborted || control?.signal?.aborted || error !== signal.reason)
|
|
83
|
+
throw error;
|
|
41
84
|
}
|
|
42
|
-
if (!hasMore)
|
|
43
|
-
await observer.changed(baseline, Infinity);
|
|
44
85
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
await observer.hinted(generation, Infinity);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
finally {
|
|
52
|
-
observer.close();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
export async function cmdStream(squarePath) {
|
|
56
|
-
process.stderr.write('✕ interactive stream was removed\n');
|
|
57
|
-
process.stderr.write(`square --location ${quoteShell(path.resolve(squarePath))} stream --ndjson\n`);
|
|
58
|
-
process.exitCode = 2;
|
|
86
|
+
},
|
|
87
|
+
};
|
|
59
88
|
}
|
package/dist/views.d.ts
CHANGED
|
@@ -1,105 +1,37 @@
|
|
|
1
1
|
import { type ActivityId } from './square-core.js';
|
|
2
|
-
import {
|
|
3
|
-
import { type DeliveryModel, type PlannedNotification } from './delivery.js';
|
|
4
|
-
import { type ActivitiesOptions, type PublicAct, type SquareState, type StoredAct } from './model.js';
|
|
2
|
+
import { type StoredAct } from './model.js';
|
|
5
3
|
import type { OpenSquare } from './open-square.js';
|
|
6
|
-
import type {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
readonly state: SquareState;
|
|
13
|
-
readonly participantCount: number;
|
|
14
|
-
readonly held: boolean;
|
|
15
|
-
readonly holdReason?: string;
|
|
16
|
-
readonly ownActivityCount: number;
|
|
17
|
-
readonly hardCap: number | null;
|
|
18
|
-
}
|
|
19
|
-
export interface EntryPresentation {
|
|
20
|
-
readonly joined: boolean;
|
|
21
|
-
readonly scene: string;
|
|
22
|
-
readonly context: string;
|
|
23
|
-
readonly joinContext: string;
|
|
24
|
-
readonly recentActivities: readonly StoredAct[];
|
|
25
|
-
readonly state: SquareState;
|
|
26
|
-
readonly sayNumbers: Readonly<Record<number, number>>;
|
|
27
|
-
readonly participantCount: number;
|
|
28
|
-
}
|
|
29
|
-
export interface HistoryPresentation {
|
|
30
|
-
readonly activities: readonly StoredAct[];
|
|
31
|
-
readonly sayNumbers: Readonly<Record<number, number>>;
|
|
32
|
-
readonly presenceAnchors: Readonly<Record<number, readonly string[]>>;
|
|
33
|
-
readonly participantCount: number;
|
|
34
|
-
}
|
|
35
|
-
export interface ListPresentation {
|
|
36
|
-
readonly context: readonly string[];
|
|
37
|
-
readonly participants: readonly string[];
|
|
38
|
-
readonly activities: number;
|
|
39
|
-
}
|
|
40
|
-
export interface StatusPresentation {
|
|
41
|
-
readonly state: SquareState;
|
|
42
|
-
readonly status: ReturnType<typeof coreStatus>;
|
|
43
|
-
readonly latestActNumber?: number;
|
|
44
|
-
}
|
|
45
|
-
export interface WatchPresentation {
|
|
46
|
-
readonly activities: readonly StoredAct[];
|
|
47
|
-
readonly state: SquareState;
|
|
48
|
-
readonly participantCount: number;
|
|
49
|
-
readonly presence: {
|
|
50
|
-
readonly participants: ReturnType<typeof coreParticipants>;
|
|
51
|
-
readonly now: number;
|
|
52
|
-
};
|
|
53
|
-
readonly terminalStatus?: 'capped' | 'quorum';
|
|
54
|
-
}
|
|
55
|
-
export interface StreamProjection {
|
|
56
|
-
readonly activities: readonly {
|
|
57
|
-
readonly activity: StoredAct;
|
|
58
|
-
readonly route?: string;
|
|
59
|
-
}[];
|
|
60
|
-
readonly cursor: number;
|
|
61
|
-
readonly hasMore: boolean;
|
|
62
|
-
}
|
|
63
|
-
export interface PendingDeliveryProjection {
|
|
64
|
-
readonly recipient: string;
|
|
65
|
-
readonly notifications: readonly PlannedNotification[];
|
|
66
|
-
}
|
|
4
|
+
import type { ActivityFilter, SquareRead } from './ports.js';
|
|
5
|
+
import type { Activity, ApplicationOutcome, ArchiveRecord, HistoryQuery, HistoryApplicationQuery, HistoryContinuation, OperationControl, ParticipantStatus, ParticipantsApplicationData, ParticipantsProjection, SquareSnapshot, RecoveryObservation, EntryPresentation, ListPresentation, StatusApplicationData, StatusProjection, SquareContextProjection, CatchPresence, StreamProjection, EventPresentation } from './square-facade.js';
|
|
6
|
+
export type { RecoveryObservation, EntryPresentation, ListPresentation, CatchPresence, StreamProjection } from './square-facade.js';
|
|
7
|
+
export declare const HISTORY_DEFAULT_LIMIT = 10;
|
|
8
|
+
export declare const HISTORY_MAX_LIMIT = 100;
|
|
9
|
+
export declare const NON_READ: readonly ["join", "done", "say", "hold", "resume", "listen", "ignore"];
|
|
67
10
|
/** The one StoredAct-to-public-Activity field mapping. Rejects read and actorless acts. */
|
|
68
11
|
export declare function toPublicActivity(stored: StoredAct): Activity;
|
|
69
12
|
export declare function parseRequiredActivityId(id: ActivityId): number;
|
|
13
|
+
/** Compile the public query directly to typed selectors; only search hydrates unselected bodies. */
|
|
14
|
+
export declare function selectHistory(facts: SquareRead, query: HistoryApplicationQuery, limit: number | null, kinds: ActivityFilter['kinds']): {
|
|
15
|
+
continuation?: HistoryContinuation | undefined;
|
|
16
|
+
activities: StoredAct[];
|
|
17
|
+
visibleActivities: StoredAct[];
|
|
18
|
+
totalMatches: number;
|
|
19
|
+
};
|
|
20
|
+
export declare function publicActivities(activities: readonly ArchiveRecord[]): Activity[];
|
|
70
21
|
export declare function history(square: OpenSquare, query?: HistoryQuery, control?: OperationControl): Promise<Activity[]>;
|
|
71
|
-
export declare function participantHistory(square: OpenSquare, _name: string, query?: HistoryQuery, control?: OperationControl): Promise<Activity[]>;
|
|
72
22
|
export declare function resolveParticipant(square: OpenSquare, name: string, control?: OperationControl): Promise<{
|
|
73
|
-
|
|
74
|
-
readonly roster: readonly string[];
|
|
23
|
+
name: string;
|
|
75
24
|
}>;
|
|
76
|
-
export declare function currentParticipant(square: OpenSquare, name: string): Promise<string | undefined>;
|
|
25
|
+
export declare function currentParticipant(square: OpenSquare, name: string, control?: OperationControl): Promise<string | undefined>;
|
|
77
26
|
export declare function participants(square: OpenSquare): Promise<ParticipantStatus[]>;
|
|
78
27
|
export declare function snapshot(square: OpenSquare, control?: OperationControl): Promise<SquareSnapshot>;
|
|
79
|
-
export declare function
|
|
80
|
-
export declare function entryPresentation(square: OpenSquare, name: string, lastN?: number | null): Promise<EntryPresentation>;
|
|
81
|
-
|
|
82
|
-
export declare function
|
|
83
|
-
export declare function listPresentation(square: OpenSquare): Promise<ListPresentation>;
|
|
84
|
-
export declare function
|
|
85
|
-
export declare function eventPresentation(square: OpenSquare, id: ActivityId): Promise<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}>;
|
|
90
|
-
export declare function watchPresentation(square: OpenSquare, name: string): Promise<WatchPresentation>;
|
|
91
|
-
export declare function streamProjection(square: OpenSquare | {
|
|
92
|
-
readonly cell: {
|
|
93
|
-
read(): Promise<{
|
|
94
|
-
state: SquareState;
|
|
95
|
-
}>;
|
|
96
|
-
};
|
|
97
|
-
}, cursor: number, recipient?: string): Promise<StreamProjection>;
|
|
98
|
-
export declare function streamTailProjection(square: OpenSquare | {
|
|
99
|
-
readonly cell: {
|
|
100
|
-
read(): Promise<{
|
|
101
|
-
state: SquareState;
|
|
102
|
-
}>;
|
|
103
|
-
};
|
|
104
|
-
}, last?: number, recipient?: string): Promise<StreamProjection>;
|
|
105
|
-
export declare function pendingDeliveriesFromState(state: SquareState, delivery?: DeliveryModel): readonly PendingDeliveryProjection[];
|
|
28
|
+
export declare function recoveryObservation(square: OpenSquare, name: string, control?: OperationControl): Promise<RecoveryObservation>;
|
|
29
|
+
export declare function entryPresentation(square: OpenSquare, name: string, lastN?: number | null, control?: OperationControl): Promise<EntryPresentation>;
|
|
30
|
+
type ParticipantQueryContext = Pick<SquareContextProjection, 'location' | 'now' | 'automaticDeliveryAvailable'>;
|
|
31
|
+
export declare function queryParticipants(facts: SquareRead, context: ParticipantQueryContext): ApplicationOutcome<ParticipantsApplicationData, ParticipantsProjection>;
|
|
32
|
+
export declare function listPresentation(square: OpenSquare, control?: OperationControl): Promise<ListPresentation>;
|
|
33
|
+
export declare function queryStatus(facts: SquareRead, context: ParticipantQueryContext, viewer?: string): ApplicationOutcome<StatusApplicationData, StatusProjection>;
|
|
34
|
+
export declare function eventPresentation(square: OpenSquare, id: ActivityId, control?: OperationControl): Promise<EventPresentation>;
|
|
35
|
+
export declare function catchPresence(square: OpenSquare, control?: OperationControl): Promise<CatchPresence>;
|
|
36
|
+
export declare function streamProjection(square: OpenSquare, cursor: number, recipient?: string, control?: OperationControl): Promise<StreamProjection>;
|
|
37
|
+
export declare function streamTailProjection(square: OpenSquare, last?: number, recipient?: string, control?: OperationControl): Promise<StreamProjection>;
|