@astrosheep/square 0.3.106 → 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/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 +1 -1
- 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
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
/** The only schema owned by the shared physical store. */
|
|
3
|
+
export declare const STORAGE_META_SQL = "CREATE TABLE storage_meta (\n id INTEGER PRIMARY KEY CHECK (id = 1),\n revision INTEGER NOT NULL CHECK (revision BETWEEN 0 AND 9007199254740991),\n delivery_revision INTEGER NOT NULL CHECK (delivery_revision BETWEEN 0 AND 9007199254740991)\n);";
|
|
4
|
+
export declare function initializeStorageMeta(db: DatabaseSync, revision?: number): void;
|
|
5
|
+
export declare function resetStorageMeta(db: DatabaseSync): void;
|
|
6
|
+
export declare function readStorageRevision(db: DatabaseSync, delivery?: boolean): number;
|
|
7
|
+
/** Compare an owner's complete current schema and journal mode without modifying the database. */
|
|
8
|
+
export declare function validateSchema(db: DatabaseSync, expectedSql: string, location?: string): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { integer, requireFact, string } from './sqlite-values.js';
|
|
2
|
+
/** The only schema owned by the shared physical store. */
|
|
3
|
+
export const STORAGE_META_SQL = `CREATE TABLE storage_meta (
|
|
4
|
+
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
5
|
+
revision INTEGER NOT NULL CHECK (revision BETWEEN 0 AND 9007199254740991),
|
|
6
|
+
delivery_revision INTEGER NOT NULL CHECK (delivery_revision BETWEEN 0 AND 9007199254740991)
|
|
7
|
+
);`;
|
|
8
|
+
export function initializeStorageMeta(db, revision = 0) {
|
|
9
|
+
integer(revision);
|
|
10
|
+
db.exec(STORAGE_META_SQL);
|
|
11
|
+
db.prepare('INSERT INTO storage_meta(id,revision,delivery_revision) VALUES(1,?,0)').run(revision);
|
|
12
|
+
}
|
|
13
|
+
export function resetStorageMeta(db) {
|
|
14
|
+
db.exec('DROP TABLE storage_meta');
|
|
15
|
+
}
|
|
16
|
+
export function readStorageRevision(db, delivery = false) {
|
|
17
|
+
const rows = db.prepare(`SELECT id, ${delivery ? 'delivery_revision' : 'revision'} AS revision FROM storage_meta`).all();
|
|
18
|
+
requireFact(rows.length === 1 && rows[0].id === 1, 'revision header is malformed.');
|
|
19
|
+
return integer(rows[0].revision);
|
|
20
|
+
}
|
|
21
|
+
function normalizedSql(sql) {
|
|
22
|
+
return sql.trim().replace(/;$/, '').replace(/\s+/g, ' ').replace(/\s*([(),=])\s*/g, '$1');
|
|
23
|
+
}
|
|
24
|
+
/** Compare an owner's complete current schema and journal mode without modifying the database. */
|
|
25
|
+
export function validateSchema(db, expectedSql, location = '') {
|
|
26
|
+
const expected = expectedSql.split(';').map(s => s.trim()).filter(Boolean).map(normalizedSql).sort();
|
|
27
|
+
const actual = db.prepare("SELECT sql FROM sqlite_schema WHERE name NOT GLOB 'sqlite_*' AND sql IS NOT NULL").all()
|
|
28
|
+
.map(row => normalizedSql(string(row.sql))).sort();
|
|
29
|
+
requireFact(actual.length === expected.length && actual.every((sql, index) => sql === expected[index]), 'unsupported row schema.');
|
|
30
|
+
requireFact(db.prepare('PRAGMA journal_mode').get().journal_mode === (location === ':memory:' ? 'memory' : 'delete'), 'unsupported journal mode.');
|
|
31
|
+
}
|
package/dist/sqlite-square.d.ts
CHANGED
|
@@ -2,37 +2,38 @@ import { type Owner } from './model.js';
|
|
|
2
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, ChannelSendInput, ChannelSendResult } from './square-facade.js';
|
|
3
3
|
export type * from './square-facade.js';
|
|
4
4
|
export { createSquareResourceOwner } from './artifact.js';
|
|
5
|
+
export { squareClock } from './channel-internal.js';
|
|
5
6
|
export { formatActivityId, parseActivityId, MAX_IDENTITY_SET_SIZE } from './square-core.js';
|
|
6
7
|
export { CATCH_DEFAULT_LIMIT, CATCH_MAX_LIMIT } from './catch-decisions.js';
|
|
7
8
|
export { HISTORY_DEFAULT_LIMIT, HISTORY_MAX_LIMIT } from './views.js';
|
|
8
9
|
export { DEFAULT_LIST_DEPTH, MAX_LIST_DEPTH, DEFAULT_LIST_LIMIT, MAX_LIST_LIMIT } from './list.js';
|
|
9
|
-
export declare function squareClock(env: NodeJS.ProcessEnv, clock?: () => number): () => number;
|
|
10
10
|
/** One concrete local resource, including its entry-resolved dependencies and lifetime. */
|
|
11
11
|
export declare class SqliteSquare {
|
|
12
12
|
readonly location: string;
|
|
13
13
|
private readonly artifact;
|
|
14
14
|
private readonly clock;
|
|
15
15
|
private readonly wakeTransport?;
|
|
16
|
-
private readonly indexPath?;
|
|
17
|
-
private readonly closesArtifact;
|
|
18
16
|
private readonly deliveryLocation;
|
|
17
|
+
private readonly channel;
|
|
19
18
|
private constructor();
|
|
20
19
|
static at(input: SquareAtInput, control?: OperationControl): Promise<SqliteSquare>;
|
|
21
20
|
static build(input: SquareBuildInput, control?: OperationControl): Promise<SqliteSquare>;
|
|
22
21
|
static inMemory(input: Omit<SquareBuildInput, 'path' | 'resources'>): SqliteSquare;
|
|
23
|
-
/**
|
|
24
|
-
private
|
|
22
|
+
/** Agora join composes membership and endpoint custody in one transaction. */
|
|
23
|
+
private joinSeat;
|
|
24
|
+
private requiredSeat;
|
|
25
|
+
private reattachSeat;
|
|
26
|
+
private endHeldSeat;
|
|
27
|
+
private cancelHeld;
|
|
25
28
|
private observation;
|
|
26
29
|
private contextObservation;
|
|
27
30
|
private handle;
|
|
28
31
|
private static readonly ParticipantHandle;
|
|
29
|
-
/** Direct messages use explicit recipients, not participant expression admission or body attention. */
|
|
30
32
|
send(input: ChannelSendInput, control?: OperationControl): Promise<ChannelSendResult>;
|
|
31
|
-
participant(name: string,
|
|
33
|
+
participant(name: string, options: {
|
|
32
34
|
readonly owner: Owner;
|
|
33
35
|
}): Promise<Participant>;
|
|
34
36
|
join(requested: string, options: JoinOptions, control?: OperationControl): Promise<JoinResult>;
|
|
35
|
-
/** Restore only a standing seat; a concurrent departure or takeover cannot be revived. */
|
|
36
37
|
reattach(name: string, { owner, wakeAddress }: Pick<JoinOptions, 'owner' | 'wakeAddress'>, control?: OperationControl): Promise<Participant | null>;
|
|
37
38
|
history(query?: HistoryQuery, control?: OperationControl): Promise<HistoryResult>;
|
|
38
39
|
status(options?: StatusOptions, control?: OperationControl): Promise<StatusResult>;
|
|
@@ -47,21 +48,19 @@ export declare class SqliteSquare {
|
|
|
47
48
|
stream(options: StreamOptions, control?: OperationControl): AsyncIterable<StreamRecord>;
|
|
48
49
|
seatsOf(owner: Owner): Promise<readonly import('./square-facade.js').HeldSeat[]>;
|
|
49
50
|
close(): Promise<void>;
|
|
50
|
-
private heldSeat;
|
|
51
51
|
cancelDeliveries(name: string, identity: {
|
|
52
52
|
readonly owner: Owner;
|
|
53
|
-
readonly generation:
|
|
53
|
+
readonly generation: string;
|
|
54
54
|
}): Promise<boolean>;
|
|
55
55
|
detach(name: string, identity: {
|
|
56
56
|
readonly owner: Owner;
|
|
57
|
-
readonly generation:
|
|
57
|
+
readonly generation: string;
|
|
58
58
|
}): Promise<true | null>;
|
|
59
59
|
endHeld(name: string, identity: {
|
|
60
60
|
readonly owner: Owner;
|
|
61
|
-
readonly generation:
|
|
61
|
+
readonly generation: string;
|
|
62
62
|
}): Promise<LifecycleResult | null>;
|
|
63
63
|
}
|
|
64
64
|
export declare function diagnoseSquare(input: SquareLocation, control?: OperationControl): Promise<import("./artifact.js").DiagnoseResult>;
|
|
65
|
-
export declare function migrateSquare(input: SquareLocation, control?: OperationControl): Promise<import("./square-migration.js").MigrationOutcome>;
|
|
66
65
|
export declare function discover(input: SquareAtInput, options?: DiscoveryOptions, control?: OperationControl): Promise<import("./square-facade.js").DiscoveryResult>;
|
|
67
66
|
export declare function inbox(input: SquareAtInput, owner: Owner, options?: InboxOptions, control?: OperationControl): Promise<InboxResult>;
|