@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
@@ -16,7 +16,10 @@ function classifyFailure(message) {
16
16
  return 'unknown';
17
17
  }
18
18
  export function sendCodexQueue({ threadId, message }, opts = {}) {
19
- const result = spawnSync(opts.bin ?? process.env.SQUARE_CODEX_BIN ?? 'codex', [...(opts.args ?? []), 'queue', '--thread', threadId, '--message', message], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: opts.timeoutMs ?? 5000, env: opts.env ?? process.env });
19
+ // The explicit bin wins. Otherwise a supplied env decides the executable and the child
20
+ // environment; it never falls back to the ambient process env for a key it omits.
21
+ const env = opts.env ?? process.env;
22
+ const result = spawnSync(opts.bin ?? env.SQUARE_CODEX_BIN ?? 'codex', [...(opts.args ?? []), 'queue', '--thread', threadId, '--message', message], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: opts.timeoutMs ?? 5000, env });
20
23
  if (result.error) {
21
24
  const messageText = result.error.message;
22
25
  throw new CodexQueueSendError(messageText, classifyFailure(messageText));
@@ -1,41 +1,28 @@
1
- import { type ActivitiesOptions, type Act, type StoredAct, type SquareState, type Reach, type HardCap } from './model.js';
2
- import { type Perception } from './square-core.js';
3
- import { type DeliveryModel } from './delivery.js';
4
- export interface UnreadActivitySummary {
5
- name: string;
6
- count: number;
7
- latestActivityAgeMs: number;
8
- previews: UnreadActivityPreview[];
9
- }
10
- export interface UnreadActivityPreview {
11
- number: number;
12
- act: Extract<StoredAct, {
13
- kind: 'say';
14
- }>;
15
- perception: Perception;
16
- }
17
- export declare function resolveKnownName(squareState: SquareState, name: string): string;
1
+ import { type Act, type Reach } from './model.js';
2
+ import type { SquareRead } from './ports.js';
3
+ type TimedAct<K extends Act['kind'] = Act['kind']> = Extract<Act, {
4
+ kind: K;
5
+ }> & {
6
+ at: number;
7
+ };
8
+ import type { ParticipantSummary as ParticipantStatus, UnreadActivitySummary } from './square-facade.js';
9
+ export type { ParticipantSummary as ParticipantStatus, ParticipantPresence as CorePresenceState, UnreadActivitySummary, UnreadActivityPreview } from './square-facade.js';
10
+ export declare function resolveKnownName(facts: SquareRead, name: string): string;
18
11
  export interface DecideJoinResult {
19
12
  joinedName: string;
20
13
  addParticipant: boolean;
21
- joinAct?: Extract<Act, {
22
- kind: 'join';
23
- }>;
14
+ joinAct?: TimedAct<'join'>;
24
15
  }
25
16
  export interface DecideImplicitJoinResult {
26
17
  joinedName: string;
27
18
  state: 'joined' | 'active' | 'done';
28
- joinAct?: Extract<Act, {
29
- kind: 'join';
30
- }>;
19
+ joinAct?: TimedAct<'join'>;
31
20
  }
32
- export declare function decideJoin(squareState: SquareState, name: string, now: number): DecideJoinResult;
33
- /** Automatic presence may enter only once; an explicit join remains the re-entry path. */
34
- export declare function decideImplicitJoin(squareState: SquareState, name: string, now: number): DecideImplicitJoinResult;
21
+ export declare function decideJoin(facts: SquareRead, name: string, now: number): DecideJoinResult;
22
+ export declare function decideImplicitJoin(facts: SquareRead, name: string, now: number): DecideImplicitJoinResult;
35
23
  export type ActDecision = {
36
24
  type: 'sent';
37
- act: Act;
38
- /** The replied-to author was not standing, so the reply landed without reaching them. */
25
+ act: TimedAct;
39
26
  replyAuthorNotHere?: string;
40
27
  } | {
41
28
  type: 'blocked';
@@ -54,9 +41,9 @@ export type ActDecision = {
54
41
  type: 'bell_quota';
55
42
  nextAt: number;
56
43
  };
57
- /** The unread activity a viewer has not caught up to, grouped by speaker. */
58
- export declare function unreadActivitySummaries(squareState: SquareState, name: string, now: number): UnreadActivitySummary[];
59
- export declare function decideAct(squareState: SquareState, input: {
44
+ /** Count the directed suffix, but hydrate only its last three previews per spelling. */
45
+ export declare function unreadActivitySummaries(facts: SquareRead, name: string, now: number): UnreadActivitySummary[];
46
+ export declare function decideAct(facts: SquareRead, input: {
60
47
  name: string;
61
48
  body: string;
62
49
  force: boolean;
@@ -65,49 +52,14 @@ export declare function decideAct(squareState: SquareState, input: {
65
52
  reach?: Reach;
66
53
  reply?: number;
67
54
  noMention?: boolean;
55
+ requireExplicitReach?: boolean;
68
56
  }): ActDecision;
69
57
  export declare function validateDoneBody(body: unknown): void;
70
- export declare function coreDone(squareState: SquareState, name: string, body: string, now: number): Extract<Act, {
71
- kind: 'done';
72
- }>;
73
- export declare function coreListen(squareState: SquareState, actor: string, target: string, now: number): Extract<Act, {
74
- kind: 'listen';
75
- }> | undefined;
76
- export declare function coreIgnore(squareState: SquareState, actor: string, target: string, now: number): Extract<Act, {
77
- kind: 'ignore';
78
- }> | undefined;
79
- export declare function coreListening(squareState: SquareState, actor: string): readonly string[];
80
- export declare function coreHold(squareState: SquareState, actor: string, body: string, now: number): Extract<Act, {
81
- kind: 'hold';
82
- }>;
83
- export declare function coreResume(squareState: SquareState, actor: string, now: number): Extract<Act, {
84
- kind: 'resume';
85
- }>;
86
- export interface ParticipantStatus {
87
- name: string;
88
- state: 'active' | 'done' | 'not joined';
89
- listening: readonly string[];
90
- activityCount: number;
91
- lastActiveAt: number | undefined;
92
- presence: CorePresenceState;
93
- unreadActivityCount: number;
94
- pendingMentionCount: number;
95
- }
96
- export type CorePresenceState = 'never-joined' | 'active' | 'watching' | 'done';
58
+ export declare function coreDone(facts: SquareRead, name: string, body: string, now: number): TimedAct<'done'>;
59
+ export declare function coreListen(facts: SquareRead, actor: string, target: string, now: number): TimedAct<"listen" | "ignore"> | undefined;
60
+ export declare function coreIgnore(facts: SquareRead, actor: string, target: string, now: number): TimedAct<"listen" | "ignore"> | undefined;
61
+ export declare function coreListening(facts: SquareRead, actor: string): readonly string[];
62
+ export declare function coreHold(facts: SquareRead, actor: string, body: string, now: number): TimedAct<'hold'>;
63
+ export declare function coreResume(facts: SquareRead, actor: string, now: number): TimedAct<'resume'>;
97
64
  export declare function compareParticipantActivity(a: Pick<ParticipantStatus, 'name' | 'lastActiveAt'>, b: Pick<ParticipantStatus, 'name' | 'lastActiveAt'>): number;
98
- export interface StatusResult {
99
- hardCap: HardCap;
100
- throttlePerMinute: number | undefined;
101
- activeCount: number;
102
- doneCount: number;
103
- holdActive: boolean;
104
- holdReason: string | undefined;
105
- holdActor: string | undefined;
106
- holdAt: number | undefined;
107
- participants: ParticipantStatus[];
108
- latestAct: StoredAct | undefined;
109
- now: number;
110
- }
111
- export declare function coreStatus(squareState: SquareState, now: number, delivery?: DeliveryModel): StatusResult;
112
- export declare function coreParticipants(squareState: SquareState, now: number, delivery?: DeliveryModel): ParticipantStatus[];
113
- export declare function coreActivities(squareState: SquareState, opts: ActivitiesOptions, suppliedDelivery?: DeliveryModel): StoredAct[];
65
+ export declare function coreParticipants(facts: SquareRead, now: number): ParticipantStatus[];