@astrosheep/square 0.3.70 → 0.3.72

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.
Files changed (126) hide show
  1. package/dist/activity-feed.d.ts +4 -5
  2. package/dist/activity-feed.js +14 -10
  3. package/dist/artifact.d.ts +26 -33
  4. package/dist/artifact.js +346 -317
  5. package/dist/attention-presentation.js +2 -9
  6. package/dist/automatic-session.js +6 -6
  7. package/dist/boundary-presentation.js +3 -3
  8. package/dist/catch-decisions.d.ts +19 -12
  9. package/dist/catch-decisions.js +32 -68
  10. package/dist/claude-delivery.js +7 -7
  11. package/dist/claude-mod.js +18 -7
  12. package/dist/cli/catch-presentation.d.ts +7 -0
  13. package/dist/cli/catch-presentation.js +55 -0
  14. package/dist/cli/context.d.ts +1 -1
  15. package/dist/cli/context.js +5 -23
  16. package/dist/cli/express-presentation.d.ts +10 -0
  17. package/dist/cli/express-presentation.js +196 -0
  18. package/dist/cli/maintenance-commands.d.ts +4 -0
  19. package/dist/cli/maintenance-commands.js +29 -6
  20. package/dist/cli/observation-commands.d.ts +7 -5
  21. package/dist/cli/observation-commands.js +275 -262
  22. package/dist/cli/program.d.ts +1 -1
  23. package/dist/cli/program.js +43 -56
  24. package/dist/cli/registry.js +2 -1
  25. package/dist/cli/square-commands.d.ts +3 -9
  26. package/dist/cli/square-commands.js +134 -255
  27. package/dist/codex-queue.js +4 -1
  28. package/dist/decisions.d.ts +26 -74
  29. package/dist/decisions.js +190 -335
  30. package/dist/delivery-health.js +13 -22
  31. package/dist/delivery-operations.d.ts +0 -11
  32. package/dist/delivery-operations.js +44 -33
  33. package/dist/delivery.d.ts +33 -32
  34. package/dist/delivery.js +70 -81
  35. package/dist/help.js +6 -1
  36. package/dist/inbox.d.ts +27 -0
  37. package/dist/inbox.js +55 -18
  38. package/dist/index.d.ts +2 -4
  39. package/dist/index.js +1 -1
  40. package/dist/list.d.ts +7 -1
  41. package/dist/list.js +49 -122
  42. package/dist/mcp.d.ts +1 -1
  43. package/dist/mcp.js +7 -37
  44. package/dist/model.d.ts +4 -44
  45. package/dist/model.js +1 -3
  46. package/dist/notifications.d.ts +1 -1
  47. package/dist/notifications.js +13 -7
  48. package/dist/open-square.d.ts +16 -2
  49. package/dist/open-square.js +40 -1
  50. package/dist/packages/agent-delivery/src/claude.d.ts +2 -11
  51. package/dist/packages/agent-delivery/src/index.d.ts +2 -42
  52. package/dist/packages/agent-delivery/src/opencode.d.ts +2 -11
  53. package/dist/packages/agent-delivery/src/paseo.d.ts +2 -13
  54. package/dist/packages/agent-delivery/src/pi-client.d.ts +2 -9
  55. package/dist/packages/agent-delivery/src/types.d.ts +42 -0
  56. package/dist/participant-host.d.ts +6 -3
  57. package/dist/participant-host.js +44 -38
  58. package/dist/perception-projection.d.ts +6 -15
  59. package/dist/perception-projection.js +6 -26
  60. package/dist/plugins/opencode/delivery.js +9 -9
  61. package/dist/plugins/opencode/index.js +3 -3
  62. package/dist/ports.d.ts +156 -11
  63. package/dist/presentation-operations.d.ts +1 -1
  64. package/dist/presentation-operations.js +35 -44
  65. package/dist/presentation.d.ts +12 -19
  66. package/dist/presentation.js +33 -54
  67. package/dist/registry.d.ts +2 -0
  68. package/dist/registry.js +1 -1
  69. package/dist/routes.d.ts +7 -14
  70. package/dist/routes.js +34 -72
  71. package/dist/runtime.d.ts +12 -39
  72. package/dist/runtime.js +33 -164
  73. package/dist/square-actions.d.ts +11 -21
  74. package/dist/square-actions.js +171 -275
  75. package/dist/square-application.d.ts +31 -55
  76. package/dist/square-application.js +625 -141
  77. package/dist/square-core.d.ts +3 -94
  78. package/dist/square-core.js +8 -353
  79. package/dist/square-domain.d.ts +24 -0
  80. package/dist/square-domain.js +77 -0
  81. package/dist/square-facade.d.ts +360 -9
  82. package/dist/square-migration.d.ts +24 -0
  83. package/dist/square-migration.js +211 -0
  84. package/dist/square-projections.d.ts +2 -42
  85. package/dist/square-projections.js +1 -37
  86. package/dist/square-sqlite.d.ts +59 -0
  87. package/dist/square-sqlite.js +702 -0
  88. package/dist/stream.d.ts +3 -10
  89. package/dist/stream.js +81 -52
  90. package/dist/views.d.ts +27 -95
  91. package/dist/views.js +217 -87
  92. package/dist/wake-eligibility.d.ts +15 -5
  93. package/dist/wake-eligibility.js +32 -16
  94. package/dist/wakes.d.ts +3 -3
  95. package/dist/wakes.js +31 -27
  96. package/guides/application-facade-delivery-evidence.md +200 -0
  97. package/guides/application-facade-design.md +95 -0
  98. package/guides/change-waits.md +4 -4
  99. package/guides/migration.md +77 -0
  100. package/guides/postcommit-simplification-performance.md +36 -0
  101. package/guides/primitive-catch-consolidation.md +85 -0
  102. package/guides/primitive-history-consolidation.md +76 -0
  103. package/guides/primitive-status-consolidation.md +87 -0
  104. package/guides/primitive-storage-consolidation.md +128 -0
  105. package/guides/row-runtime-delivery-evidence.md +160 -0
  106. package/guides/row-storage-design.md +567 -0
  107. package/package.json +1 -1
  108. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  109. package/plugins/codex/.codex-plugin/plugin.json +1 -1
  110. package/plugins/opencode/delivery.ts +11 -11
  111. package/plugins/opencode/index.ts +3 -3
  112. package/plugins/paseo/client/square-message.tsx +77 -64
  113. package/plugins/paseo/shared/message.ts +16 -0
  114. package/plugins/pi/square-pi.js +5 -1
  115. package/dist/activity.d.ts +0 -14
  116. package/dist/activity.js +0 -248
  117. package/dist/square-file-adapter.d.ts +0 -26
  118. package/dist/square-file-adapter.js +0 -85
  119. package/dist/square-state.d.ts +0 -6
  120. package/dist/square-state.js +0 -138
  121. package/dist/square-storage.d.ts +0 -14
  122. package/dist/square-storage.js +0 -188
  123. package/dist/square-wiring.d.ts +0 -33
  124. package/dist/square-wiring.js +0 -109
  125. package/dist/watch.d.ts +0 -8
  126. package/dist/watch.js +0 -252
@@ -1,7 +1,6 @@
1
- import { type StoredAct, type SquareState } from './model.js';
2
- export declare function actDelta(acts: StoredAct[], cursor: number): StoredAct[];
3
- /** Visible activities after the participant's derived continuous-seen prefix. */
4
- export declare function deliveryDelta(squareState: SquareState, name: string, delivery?: import("./delivery.js").DeliveryModel): StoredAct[];
5
- export declare function directedPeerSays(squareState: SquareState, delta: StoredAct[], name: string, delivery?: import("./delivery.js").DeliveryModel): Extract<StoredAct, {
1
+ import type { SquareRead } from './ports.js';
2
+ import type { StoredAct } from './model.js';
3
+ /** Directed suffix includes seen rows beyond an earlier hole, unlike notification pending. */
4
+ export declare function directedSuffix(facts: SquareRead, name: string): Extract<StoredAct, {
6
5
  kind: 'say';
7
6
  }>[];
@@ -1,11 +1,15 @@
1
- import { deriveDeliveryModel } from './delivery.js';
2
- export function actDelta(acts, cursor) {
3
- return acts.filter((act) => act.index > cursor);
4
- }
5
- /** Visible activities after the participant's derived continuous-seen prefix. */
6
- export function deliveryDelta(squareState, name, delivery = deriveDeliveryModel(squareState)) {
7
- return actDelta(squareState.acts, delivery.cursorFor(name));
8
- }
9
- export function directedPeerSays(squareState, delta, name, delivery = deriveDeliveryModel(squareState)) {
10
- return delta.filter((act) => delivery.directedTo(act, name));
1
+ import { readCursor } from './runtime.js';
2
+ /** Directed suffix includes seen rows beyond an earlier hole, unlike notification pending. */
3
+ export function directedSuffix(facts, name) {
4
+ const result = [];
5
+ let afterIndex = readCursor(facts, name);
6
+ while (true) {
7
+ const page = facts.directed(name, { afterIndex }, { edge: 'oldest', limit: 100 });
8
+ for (const act of facts.activities(page.items.map((head) => head.index)))
9
+ if (act.kind === 'say')
10
+ result.push(act);
11
+ if (!page.hasMore)
12
+ return result;
13
+ afterIndex = page.items.at(-1).index;
14
+ }
11
15
  }
@@ -1,45 +1,38 @@
1
- import { type SquareState } from './model.js';
2
- export { createSquareState, emptyRuntimeState } from './square-state.js';
1
+ import { DatabaseSync } from 'node:sqlite';
2
+ import { type BuildOptions } from './model.js';
3
+ import type { SquareArtifactPort } from './ports.js';
4
+ import { type SquareState } from './square-sqlite.js';
5
+ /** All build paths share configuration validation and lazy guide preparation. */
6
+ export declare function prepareSquareBuild(options: Omit<BuildOptions, 'force'>, snippet: string): SquareState;
7
+ /** File build owns publication and CLI conflict semantics, not host resources. */
8
+ export declare function createSquare(location: string, options: BuildOptions, snippet: string, signal?: AbortSignal): Promise<Pick<SquareState, 'hardCap' | 'throttlePerMinute'>>;
3
9
  export interface DoctorProblem {
4
10
  kind: string;
5
11
  message: string;
6
12
  }
7
13
  export interface DiagnoseResult {
8
14
  unfixable?: string;
15
+ migrationRequired?: string;
9
16
  problems: DoctorProblem[];
10
- state?: SquareState;
17
+ standingCount?: number;
11
18
  }
12
19
  export interface SquareSnapshot {
13
20
  readonly state: SquareState;
14
21
  readonly revision: number;
15
22
  }
16
- /** Creates a new SQLite artifact only when its pathname did not already exist. */
17
- export declare function createSquareFile(squarePath: string, state: SquareState): Promise<boolean>;
18
- /**
19
- * Reads a complete validated snapshot, yielding between transient SQLite lock
20
- * conflicts. The URI remains create-disabled throughout the retry loop.
21
- */
22
- export declare function readSquareSnapshot(squarePath: string, signal?: AbortSignal): Promise<SquareSnapshot>;
23
- /** Check the artifact revision without loading or parsing the historical state. */
24
- export declare function readSquareRevision(squarePath: string, signal?: AbortSignal): Promise<number>;
25
- /** One reference-counted revision detector per canonical artifact in this process. */
26
- export declare function observeSquareRevision(squarePath: string): Promise<import('./file-changes.js').VersionObserver<number | null>>;
27
- export type SquareTransition<R> = (state: SquareState, revision: number) => {
28
- state?: SquareState;
29
- result: R;
30
- };
31
- /**
32
- * Executes one synchronous SquareState transition under SQLite's write lock.
33
- * A busy COMMIT retries on this same transaction, so fn is never replayed.
34
- */
35
- export declare function transactSquareSnapshot<R>(squarePath: string, fn: SquareTransition<R>, signal?: AbortSignal, forceCommit?: boolean): Promise<{
36
- result: R;
37
- revision: number;
38
- changed: boolean;
39
- }>;
40
- /** Replaces an existing validated snapshot in place and always advances its revision. */
41
- export declare function replaceSquareSnapshot(squarePath: string, state: SquareState): Promise<SquareSnapshot>;
42
- export declare function writeSquareFile(squarePath: string, squareState: SquareState): Promise<void>;
43
- export declare function loadSquare(squarePath: string): Promise<SquareState>;
44
- export declare function probeSquare(squarePath: string): Promise<SquareState | undefined>;
45
- export declare function diagnoseSquareFile(squarePath: string): Promise<DiagnoseResult>;
23
+ /** Private artifact-boundary connection shared with explicit migration. Never creates a path. */
24
+ export declare function openExistingSquareDatabase(location: string): DatabaseSync;
25
+ export declare function retrySqliteBusy<T>(operation: () => T, signal?: AbortSignal): Promise<T>;
26
+ /** Acquisition may retry; after change starts, only COMMIT retries, retaining its result. */
27
+ export declare function inSqliteTransaction<T>(db: DatabaseSync, write: boolean, validate: () => void, change: () => T, signal?: AbortSignal): Promise<T>;
28
+ /** One connection, ordered operations, guarded synchronous transaction capabilities. */
29
+ export declare function createArtifactPort(location: string, initial?: SquareState, externalSignal?: AbortSignal): SquareArtifactPort;
30
+ /** New-format creation; initial authority is accepted only at this explicit boundary. */
31
+ export declare function createSquareFile(location: string, state: SquareState, signal?: AbortSignal): Promise<boolean>;
32
+ /** Explicit build --force / fixture import, never a runtime state-replacement callback. */
33
+ export declare function writeSquareFile(location: string, state: SquareState, signal?: AbortSignal): Promise<void>;
34
+ /** Explicit test/export projection. Hot callers must use the typed port. */
35
+ export declare function readSquareSnapshot(location: string, signal?: AbortSignal): Promise<SquareSnapshot>;
36
+ export declare function readSquareRevision(location: string, signal?: AbortSignal): Promise<number>;
37
+ export declare function observeSquareRevision(location: string): Promise<import('./file-changes.js').VersionObserver<number | null>>;
38
+ export declare function diagnoseSquareFile(location: string): Promise<DiagnoseResult>;