@astrosheep/square 0.3.106 → 0.4.1

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 (206) hide show
  1. package/dist/activity-feed.js +1 -1
  2. package/dist/artifact-store.d.ts +41 -0
  3. package/dist/artifact-store.js +272 -0
  4. package/dist/artifact.d.ts +6 -12
  5. package/dist/artifact.js +43 -344
  6. package/dist/attention-presentation.d.ts +13 -7
  7. package/dist/attention-presentation.js +29 -68
  8. package/dist/boundary-presentation.d.ts +3 -16
  9. package/dist/boundary-presentation.js +29 -109
  10. package/dist/card-presentation.d.ts +1 -0
  11. package/dist/card-presentation.js +2 -0
  12. package/dist/catch-decisions.d.ts +2 -2
  13. package/dist/catch-decisions.js +7 -3
  14. package/dist/catch-selection.d.ts +8 -0
  15. package/dist/catch-selection.js +5 -0
  16. package/dist/claude-delivery.d.ts +14 -12
  17. package/dist/claude-delivery.js +42 -142
  18. package/dist/claude-mcp-context.js +2 -2
  19. package/dist/claude-mod.js +28 -140
  20. package/dist/claude-transport.d.ts +5 -0
  21. package/dist/claude-transport.js +34 -0
  22. package/dist/cli/context.d.ts +2 -2
  23. package/dist/cli/context.js +7 -10
  24. package/dist/cli/maintenance-commands.d.ts +0 -4
  25. package/dist/cli/maintenance-commands.js +2 -29
  26. package/dist/cli/observation-commands.d.ts +2 -0
  27. package/dist/cli/observation-commands.js +12 -2
  28. package/dist/cli/program.js +1 -1
  29. package/dist/cli/registry.js +4 -3
  30. package/dist/codex-address.d.ts +2 -2
  31. package/dist/codex-boundary-state.d.ts +1 -5
  32. package/dist/codex-boundary-state.js +0 -4
  33. package/dist/codex-hook.d.ts +7 -10
  34. package/dist/codex-hook.js +69 -33
  35. package/dist/codex-queue.d.ts +10 -11
  36. package/dist/codex-queue.js +32 -34
  37. package/dist/codex-watch.d.ts +2 -0
  38. package/dist/codex-watch.js +100 -0
  39. package/dist/decisions.js +3 -3
  40. package/dist/delivery-deferral.d.ts +1 -19
  41. package/dist/delivery-deferral.js +1 -29
  42. package/dist/delivery-frame.d.ts +7 -0
  43. package/dist/delivery-frame.js +11 -0
  44. package/dist/delivery-ledger-sqlite.d.ts +97 -0
  45. package/dist/delivery-ledger-sqlite.js +496 -0
  46. package/dist/delivery-ledger.d.ts +196 -0
  47. package/dist/delivery-ledger.js +268 -0
  48. package/dist/delivery-lifetime.d.ts +6 -0
  49. package/dist/delivery-lifetime.js +45 -0
  50. package/dist/harness-links.js +61 -7
  51. package/dist/harness.js +12 -17
  52. package/dist/help.js +3 -6
  53. package/dist/http-delivery.d.ts +5 -9
  54. package/dist/http-delivery.js +20 -79
  55. package/dist/inbox.d.ts +6 -57
  56. package/dist/inbox.js +24 -380
  57. package/dist/index.d.ts +7 -4
  58. package/dist/index.js +5 -2
  59. package/dist/mcp.d.ts +2 -1
  60. package/dist/mcp.js +40 -70
  61. package/dist/message.d.ts +7 -0
  62. package/dist/message.js +23 -0
  63. package/dist/model.d.ts +15 -91
  64. package/dist/model.js +2 -140
  65. package/dist/neutral.d.ts +72 -0
  66. package/dist/neutral.js +27 -0
  67. package/dist/notifications.d.ts +24 -26
  68. package/dist/notifications.js +39 -143
  69. package/dist/operation-control.d.ts +4 -0
  70. package/dist/operation-control.js +20 -0
  71. package/dist/operation-presentation.d.ts +1 -2
  72. package/dist/operation-presentation.js +1 -7
  73. package/dist/owner.d.ts +2 -2
  74. package/dist/owner.js +1 -1
  75. package/dist/packages/agent-delivery/src/claude-native.d.ts +2 -0
  76. package/dist/packages/agent-delivery/src/claude-native.js +5 -0
  77. package/dist/packages/agent-delivery/src/codex-boundary.d.ts +11 -6
  78. package/dist/packages/agent-delivery/src/codex-boundary.js +31 -40
  79. package/dist/packages/agent-delivery/src/codex-hook.d.ts +17 -12
  80. package/dist/packages/agent-delivery/src/codex-hook.js +26 -39
  81. package/dist/packages/agent-delivery/src/codex.d.ts +3 -0
  82. package/dist/packages/agent-delivery/src/codex.js +41 -4
  83. package/dist/packages/agent-delivery/src/index.d.ts +3 -1
  84. package/dist/packages/agent-delivery/src/index.js +1 -1
  85. package/dist/packages/agent-delivery/src/paseo.js +11 -2
  86. package/dist/packages/agent-delivery/src/types.d.ts +1 -0
  87. package/dist/paseo-delivery.d.ts +5 -5
  88. package/dist/paseo-delivery.js +19 -99
  89. package/dist/paseo.d.ts +1 -1
  90. package/dist/paseo.js +1 -1
  91. package/dist/plugins/opencode/index.d.ts +5 -3
  92. package/dist/plugins/opencode/index.js +99 -21
  93. package/dist/plugins/opencode-shared/delivery.d.ts +23 -0
  94. package/dist/plugins/opencode-shared/delivery.js +109 -0
  95. package/dist/plugins/opencode-v1/index.d.ts +28 -0
  96. package/dist/plugins/opencode-v1/index.js +41 -0
  97. package/dist/plugins/opencode-v1/runtime.d.ts +56 -0
  98. package/dist/plugins/opencode-v1/runtime.js +152 -0
  99. package/dist/plugins/opencode-v1/transport.d.ts +13 -0
  100. package/dist/plugins/opencode-v1/transport.js +50 -0
  101. package/dist/plugins/paseo/shared/card-presentation.d.ts +10 -0
  102. package/dist/plugins/paseo/shared/card-presentation.js +7 -0
  103. package/dist/ports.d.ts +33 -214
  104. package/dist/presentation.d.ts +5 -5
  105. package/dist/presentation.js +1 -0
  106. package/dist/runtime.js +2 -2
  107. package/dist/search.js +1 -1
  108. package/dist/session-lifecycle.d.ts +8 -7
  109. package/dist/session-lifecycle.js +40 -42
  110. package/dist/sqlite-framing.d.ts +8 -0
  111. package/dist/sqlite-framing.js +31 -0
  112. package/dist/sqlite-square.d.ts +16 -26
  113. package/dist/sqlite-square.js +199 -262
  114. package/dist/sqlite-values.d.ts +21 -0
  115. package/dist/sqlite-values.js +78 -0
  116. package/dist/square-api.d.ts +1 -1
  117. package/dist/square-api.js +5 -8
  118. package/dist/square-core.d.ts +0 -1
  119. package/dist/square-domain.d.ts +12 -10
  120. package/dist/square-domain.js +105 -223
  121. package/dist/square-facade.d.ts +25 -76
  122. package/dist/square-location.d.ts +6 -1
  123. package/dist/square-location.js +1 -1
  124. package/dist/square-post.d.ts +53 -0
  125. package/dist/square-post.js +4 -0
  126. package/dist/square-posting.d.ts +13 -0
  127. package/dist/square-posting.js +174 -0
  128. package/dist/square-producer-sqlite.d.ts +11 -0
  129. package/dist/square-producer-sqlite.js +210 -0
  130. package/dist/square-receive.d.ts +2 -3
  131. package/dist/square-sqlite.d.ts +33 -42
  132. package/dist/square-sqlite.js +236 -768
  133. package/dist/square-tools.d.ts +8 -0
  134. package/dist/square-tools.js +39 -0
  135. package/dist/square-values.d.ts +27 -0
  136. package/dist/square-values.js +90 -0
  137. package/dist/views.d.ts +6 -6
  138. package/dist/views.js +14 -9
  139. package/dist/wake-sink.d.ts +4 -11
  140. package/dist/wake-sink.js +8 -32
  141. package/dist/wake-transports.d.ts +4 -0
  142. package/dist/wake-transports.js +11 -0
  143. package/examples/symmetric-domains.mjs +29 -249
  144. package/guides/change-waits.md +13 -53
  145. package/guides/claude-native.md +19 -172
  146. package/guides/codex-delivery.md +55 -78
  147. package/guides/delivery-primitives.md +48 -207
  148. package/guides/operation-cancellation.md +2 -5
  149. package/guides/participant-ownership.md +25 -89
  150. package/guides/pi-native-delivery.md +19 -56
  151. package/guides/pi-tools.md +6 -8
  152. package/guides/row-runtime-delivery-evidence.md +2 -0
  153. package/guides/row-storage-design.md +19 -44
  154. package/guides/square-api.md +113 -538
  155. package/package.json +8 -8
  156. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  157. package/plugins/claude/hooks/hooks.json +1 -1
  158. package/plugins/claude/{hooks/register.js → mods/square.js} +4 -7
  159. package/plugins/claude/types.d.ts +1 -1
  160. package/plugins/codex/.codex-plugin/plugin.json +1 -1
  161. package/plugins/codex/hooks/hooks.json +11 -23
  162. package/plugins/opencode/index.ts +91 -23
  163. package/plugins/opencode-shared/delivery.ts +91 -0
  164. package/plugins/opencode-v1/index.ts +36 -0
  165. package/plugins/opencode-v1/runtime.ts +134 -0
  166. package/plugins/opencode-v1/transport.ts +41 -0
  167. package/plugins/paseo/OVERVIEW.md +5 -5
  168. package/plugins/paseo/README.md +7 -6
  169. package/plugins/paseo/client/markdown.tsx +5 -5
  170. package/plugins/paseo/client/square-message.tsx +28 -24
  171. package/plugins/paseo/client/transform.ts +8 -5
  172. package/plugins/paseo/shared/card-presentation.ts +16 -0
  173. package/plugins/paseo/shared/message.ts +6 -11
  174. package/plugins/pi/square-pi.js +167 -451
  175. package/dist/channel.d.ts +0 -74
  176. package/dist/channel.js +0 -92
  177. package/dist/claude-delivery-status.d.ts +0 -13
  178. package/dist/claude-delivery-status.js +0 -46
  179. package/dist/cmd/notify-once.d.ts +0 -2
  180. package/dist/cmd/notify-once.js +0 -29
  181. package/dist/delivery-attempts.d.ts +0 -52
  182. package/dist/delivery-attempts.js +0 -73
  183. package/dist/delivery-effects.d.ts +0 -139
  184. package/dist/delivery-effects.js +0 -163
  185. package/dist/delivery-health.d.ts +0 -51
  186. package/dist/delivery-health.js +0 -173
  187. package/dist/delivery-operations.d.ts +0 -9
  188. package/dist/delivery-operations.js +0 -168
  189. package/dist/delivery-primitives.d.ts +0 -5
  190. package/dist/delivery-primitives.js +0 -3
  191. package/dist/delivery.d.ts +0 -45
  192. package/dist/delivery.js +0 -106
  193. package/dist/plugins/opencode/delivery.d.ts +0 -19
  194. package/dist/plugins/opencode/delivery.js +0 -238
  195. package/dist/presentation-operations.d.ts +0 -18
  196. package/dist/presentation-operations.js +0 -86
  197. package/dist/square-index.d.ts +0 -16
  198. package/dist/square-index.js +0 -106
  199. package/dist/square-legacy-framing.d.ts +0 -11
  200. package/dist/square-legacy-framing.js +0 -64
  201. package/dist/square-migration-host-ledger.d.ts +0 -26
  202. package/dist/square-migration-host-ledger.js +0 -169
  203. package/dist/square-migration.d.ts +0 -30
  204. package/dist/square-migration.js +0 -599
  205. package/guides/migration.md +0 -156
  206. package/plugins/opencode/delivery.ts +0 -211
package/dist/harness.js CHANGED
@@ -1,6 +1,4 @@
1
- import fs from 'node:fs';
2
- import { doctorDeliveryHealth } from './delivery-health.js';
3
- import { wakeGraceMs } from './notifications.js';
1
+ import { DeliveryLedger, deliveryLedgerLocation } from './delivery-ledger.js';
4
2
  import { truncateExternalDiagnostic } from './presentation.js';
5
3
  import { doctorClaudePlugin, installClaudePlugin, uninstallClaudePlugin, } from './harness-claude.js';
6
4
  import { doctorCodexPlugin, installCodexPlugin, uninstallCodexPlugin, } from './harness-codex.js';
@@ -18,16 +16,6 @@ async function doctorHost(label, inspect) {
18
16
  return result([`○ ${label} doctor unavailable (${truncateExternalDiagnostic(diagnostic)})`]);
19
17
  }
20
18
  }
21
- function readableSquarePath(squarePath) {
22
- if (squarePath === undefined)
23
- return false;
24
- try {
25
- return fs.statSync(squarePath).isFile() && (fs.accessSync(squarePath, fs.constants.R_OK), true);
26
- }
27
- catch {
28
- return false;
29
- }
30
- }
31
19
  const TARGETS = [
32
20
  {
33
21
  name: 'claude',
@@ -78,10 +66,17 @@ const TARGETS = [
78
66
  {
79
67
  name: 'delivery',
80
68
  capabilities: ['doctor'],
81
- async doctor({ squarePath }) {
82
- return result(readableSquarePath(squarePath)
83
- ? await doctorDeliveryHealth(squarePath, wakeGraceMs())
84
- : ['○ delivery health skipped (no readable square path)']);
69
+ async doctor({ homeDir }) {
70
+ return doctorHost('delivery', async () => {
71
+ const ledger = await DeliveryLedger.open({ location: deliveryLedgerLocation(process.env, homeDir) });
72
+ try {
73
+ const health = await ledger.health();
74
+ return [`· delivery health · ${health.unknownAttempts.length} unknown attempts · ${health.repeatedFailures.length} repeated failures · ${health.sessionsWithoutRoute.length} sessions without route`];
75
+ }
76
+ finally {
77
+ await ledger.close();
78
+ }
79
+ });
85
80
  },
86
81
  },
87
82
  ];
package/dist/help.js CHANGED
@@ -58,6 +58,8 @@ const COMMANDS = [
58
58
  details: ['Options:', ' --for-owner <id> Required opaque owner.', ' --limit <N> Snapshot memberships (default 20, maximum 100).'],
59
59
  },
60
60
  { names: ['codex-hook'], usage: '{command}', summary: 'Present pending attention at one native agent boundary.', hiddenFromIndex: true },
61
+ { names: ['codex-watch'], usage: '{command}', summary: 'Observe pending attention from a native async Stop hook.', hiddenFromIndex: true },
62
+ { names: ['codex-interrupt'], usage: '{command}', summary: 'Cancel pending attention at a native Interrupt boundary.', hiddenFromIndex: true },
61
63
  { names: ['claude-mod'], usage: '{command}', summary: 'Receive a structured operation from the loaded Claude mod.', hiddenFromIndex: true },
62
64
  {
63
65
  names: ['history'], usage: 'history [filters] [output]', usesSquare: true, group: 'participant',
@@ -89,11 +91,6 @@ const COMMANDS = [
89
91
  names: ['doctor'], usage: 'doctor', usesSquare: true, group: 'maintenance',
90
92
  summary: 'Validate artifact integrity.',
91
93
  },
92
- {
93
- names: ['migrate'], usage: 'migrate', usesSquare: true, group: 'maintenance',
94
- summary: 'Convert a supported older square to the current format in place.',
95
- details: ['For the selected .square artifact only. Stop sessions using this artifact before conversion. Back up the stopped artifact, migrate it, then run square --location <path> doctor before starting updated clients.', 'Versions 2–7 migrate explicitly to format 8. Format 7 migration deletes hold/resume activities and their keyed rows, clears replies to those activities, and preserves surviving activity ids with gaps. Format 6 attachment and opaque-owner conversion are preserved; versions 4/5 first gain attached seats, and 4 also gains empty deferrals. Version 1, unrelated or unsupported artifacts refuse without a write. Names whose legacy owner and routes agree may share an owner; ambiguous names stay standing without custody. Rejoin with the same owner after migration to republish discovery. There is no --check, --backup or --force.'],
96
- },
97
94
  ];
98
95
  function definitionFor(command) {
99
96
  return COMMANDS.find((item) => item.names.includes(command));
@@ -105,7 +102,7 @@ export function renderGlobalHelp() {
105
102
  const groups = [
106
103
  { key: 'participant', title: 'In the square:', order: ['join', 'express', 'listen', 'unlisten', 'ignore', 'listening', 'catch', 'history', 'status', 'done'] },
107
104
  { key: 'host', title: 'Prepare and manage:', order: ['build', 'list', 'participants'] },
108
- { key: 'maintenance', title: 'Setup:', order: ['install', 'uninstall', 'doctor', 'migrate'] },
105
+ { key: 'maintenance', title: 'Setup:', order: ['install', 'uninstall', 'doctor'] },
109
106
  ];
110
107
  const commandLines = groups.flatMap(({ key, title, order }) => [
111
108
  title,
@@ -1,16 +1,12 @@
1
- import type { WakeRoute } from './model.js';
2
- import type { WakeOutcome, WakeRequest, WakeTransportPort } from './ports.js';
1
+ import type { DeliveryCard, DeliveryTransport, DeliveryTransportContext, TransportOutcome } from './delivery-ledger.js';
3
2
  export interface HttpWakeTransportOptions {
4
3
  fetch?: typeof fetch;
5
4
  env?: NodeJS.ProcessEnv;
6
5
  }
7
- /** HTTP accepts wake custody only; it never consumes or presents Square activity. */
8
- export declare class HttpWakeTransport implements WakeTransportPort {
6
+ /** A successful HTTP response acknowledges custody, not presentation. */
7
+ export declare class HttpWakeTransport implements DeliveryTransport {
9
8
  private readonly opts;
9
+ readonly kind = "http";
10
10
  constructor(opts?: HttpWakeTransportOptions);
11
- probe(route: WakeRoute): Promise<boolean | {
12
- outcome: 'not-capable';
13
- diagnostic: string;
14
- }>;
15
- attempt(request: WakeRequest, timeoutMs: number, beforeSend: () => Promise<boolean>): Promise<WakeOutcome>;
11
+ send(card: DeliveryCard, address: Readonly<Record<string, string>>, context: DeliveryTransportContext): Promise<TransportOutcome>;
16
12
  }
@@ -1,101 +1,42 @@
1
- import { wakePreview } from './delivery.js';
2
- /** Configuration only: probing never contacts the receiver. */
3
- function configuration(route, env) {
4
- if (route.kind !== 'http')
5
- return undefined;
1
+ function configuration(address, env) {
6
2
  try {
7
- const url = new URL(route.address.url);
8
- if (!['http:', 'https:'].includes(url.protocol) || !url.hostname || url.username || url.password
9
- || route.address.url.includes('#'))
3
+ const url = new URL(address.url);
4
+ if (!['http:', 'https:'].includes(url.protocol) || !url.hostname || url.username || url.password || address.url.includes('#'))
10
5
  return undefined;
11
6
  const headers = new Headers({ 'Content-Type': 'application/json' });
12
- const tokenEnv = route.address.tokenEnv;
13
- if (tokenEnv !== undefined) {
14
- const token = tokenEnv.trim() ? env[tokenEnv] : undefined;
15
- // RFC 6750 bearer credentials; whitespace/control characters cannot become headers.
7
+ if (address.tokenEnv !== undefined) {
8
+ const token = address.tokenEnv.trim() ? env[address.tokenEnv] : undefined;
16
9
  if (!token || token !== token.trim() || !/^[A-Za-z0-9._~+\/-]+=*$/.test(token))
17
10
  return undefined;
18
11
  headers.set('Authorization', `Bearer ${token}`);
19
12
  }
20
- return { url: route.address.url, headers };
13
+ return { url: address.url, headers };
21
14
  }
22
15
  catch {
23
16
  return undefined;
24
17
  }
25
18
  }
26
- /** HTTP accepts wake custody only; it never consumes or presents Square activity. */
19
+ /** A successful HTTP response acknowledges custody, not presentation. */
27
20
  export class HttpWakeTransport {
28
21
  opts;
22
+ kind = 'http';
29
23
  constructor(opts = {}) {
30
24
  this.opts = opts;
31
25
  }
32
- async probe(route) {
33
- return configuration(route, this.opts.env ?? process.env) !== undefined
34
- ? true : { outcome: 'not-capable', diagnostic: 'HTTP wake configuration unavailable.' };
35
- }
36
- async attempt(request, timeoutMs, beforeSend) {
37
- const deadline = Date.now() + timeoutMs;
38
- if (request.route.kind !== 'http')
39
- return { outcome: 'not-capable' };
40
- const config = configuration(request.route, this.opts.env ?? process.env);
41
- if (config === undefined)
42
- return { outcome: 'failed', signature: 'http_config_rejected', message: 'Invalid HTTP wake configuration.' };
43
- const controller = new AbortController();
44
- let sent = false;
45
- const budgetUnavailable = () => sent
46
- ? { outcome: 'unknown', signature: 'http_send_timeout', message: 'HTTP wake acceptance is unknown after timeout.' }
47
- : { outcome: 'failed', signature: 'http_pre_send_timeout', message: 'HTTP wake budget elapsed before sending.' };
48
- if (!Number.isFinite(timeoutMs) || Date.now() >= deadline)
49
- return budgetUnavailable();
50
- let timer;
51
- const timeout = new Promise(resolve => {
52
- timer = setTimeout(() => { controller.abort(); resolve(budgetUnavailable()); }, Math.max(0, deadline - Date.now()));
53
- });
54
- const send = async () => {
55
- try {
56
- const preview = request.artifact === undefined ? undefined
57
- : (await request.artifact.read(facts => wakePreview(facts, request), controller.signal)).value;
58
- if (preview === undefined)
59
- return { outcome: 'not-capable', diagnostic: 'No pending Square activity to preview.' };
60
- const body = JSON.stringify({
61
- location: request.location, participant: request.participant, activity: request.activity, actor: request.actor,
62
- ...(request.attemptN === undefined ? {} : { attemptN: request.attemptN }), preview,
63
- });
64
- if (controller.signal.aborted || Date.now() >= deadline)
65
- return budgetUnavailable();
66
- if (!(await beforeSend()))
67
- return { outcome: 'not-capable' };
68
- // Preview and the final gate spend the same absolute budget as the request.
69
- if (controller.signal.aborted || Date.now() >= deadline)
70
- return budgetUnavailable();
71
- sent = true;
72
- const response = await (this.opts.fetch ?? fetch)(config.url, {
73
- method: 'POST', headers: config.headers, body, redirect: 'manual', signal: controller.signal,
74
- });
75
- // Status is the whole acknowledgement; never wait for or buffer a receiver body.
76
- void response.body?.cancel().catch(() => undefined);
77
- if (response.status >= 200 && response.status < 300)
78
- return { outcome: 'accepted', signature: 'http_accepted' };
79
- return {
80
- outcome: 'failed', signature: response.status >= 500 && response.status < 600 ? 'http_status_transient' : 'http_status_rejected',
81
- message: `HTTP wake returned status ${response.status}.`,
82
- };
83
- }
84
- catch {
85
- // URLs, query credentials and raw fetch exceptions must never reach evidence.
86
- if (controller.signal.aborted)
87
- return budgetUnavailable();
88
- return sent
89
- ? { outcome: 'unknown', signature: 'http_send_unknown', message: 'HTTP wake acceptance is unknown after a network error.' }
90
- : { outcome: 'failed', signature: 'http_pre_send_failed', message: 'HTTP wake could not be prepared.' };
91
- }
92
- };
26
+ async send(card, address, context) {
27
+ const config = configuration(address, this.opts.env ?? process.env);
28
+ if (!config)
29
+ return 'not-capable';
30
+ if (!await context.beforeSend() || context.signal.aborted || Date.now() >= context.deadline)
31
+ return 'not-capable';
93
32
  try {
94
- return await Promise.race([send(), timeout]);
33
+ const response = await (this.opts.fetch ?? fetch)(config.url, { method: 'POST', headers: config.headers,
34
+ body: JSON.stringify({ owner: card.owner, key: card.key, text: card.text }), redirect: 'manual', signal: context.signal });
35
+ void response.body?.cancel().catch(() => undefined);
36
+ return response.status >= 200 && response.status < 300 ? 'accepted' : 'failed';
95
37
  }
96
- finally {
97
- if (timer !== undefined)
98
- clearTimeout(timer);
38
+ catch {
39
+ return 'unknown';
99
40
  }
100
41
  }
101
42
  }
package/dist/inbox.d.ts CHANGED
@@ -1,58 +1,7 @@
1
- import { type Owner, type LocatedSeat, type PendingMembership } from './model.js';
2
- import type { SquareRead } from './ports.js';
3
- export interface PendingWaitOptions {
4
- signal?: AbortSignal;
5
- /** Local delivery suppression, never persisted as evidence of receipt. */
6
- excludeKeys?: ReadonlySet<string>;
7
- /** Arm before dispatch; retry only after a substantive change, not our failed evidence write. */
8
- skipImmediate?: boolean;
9
- onChangeArmed?: (armed: boolean) => void;
10
- }
11
- export declare function pendingKey(membership: LocatedSeat, actIndex: number): string;
12
- export declare function pendingAtBoundary(inbox: readonly PendingMembership[]): PendingMembership[];
13
- /** Revalidate a supplied batch immediately before the boundary's independent claim/send checks. */
14
- export declare function projectBoundaryEligibility(inbox: readonly PendingMembership[]): Promise<PendingMembership[]>;
15
- export interface SessionBindingCandidate {
16
- readonly location: string;
1
+ import type { Owner } from './model.js';
2
+ import type { InboxMembershipSummary } from './square-facade.js';
3
+ /** Filesystem-scoped membership counts. This is a World read, not a delivery scan. */
4
+ export declare function sessionInboxCounts(input: {
17
5
  readonly owner: Owner;
18
- }
19
- /** HOME is a candidate path index; current seats and delivery evidence live in the artifact. */
20
- export declare function projectSessionCandidates(input: SessionSeatQuery): Promise<readonly SessionBindingCandidate[]>;
21
- export interface SessionSeatQuery {
22
- readonly owner?: Owner;
23
- readonly location?: string;
24
- readonly env?: NodeJS.ProcessEnv;
25
- }
26
- /** Lifecycle reads resolve seats and join times, never pending activity bodies. */
27
- export declare function projectSessionSeats(input: SessionSeatQuery, signal?: AbortSignal): Promise<LocatedSeat[]>;
28
- /** Public count boundary: one coherent read per artifact, without pending body hydration. */
29
- export declare function sessionInboxCounts(input: SessionSeatQuery, signal?: AbortSignal): Promise<import('./square-facade.js').InboxMembershipSummary[]>;
30
- export interface NativePendingPreview {
31
- readonly payload: string;
32
- readonly clipped: boolean;
33
- }
34
- export type NativePendingPreviewInput = {
35
- readonly location: string;
36
- readonly generation: import('./model.js').ActivityId;
37
- readonly participant: string;
38
- readonly actIndex: number;
39
- readonly cancelledThrough?: number;
40
- readonly now: number;
41
- } & ({
42
- readonly routeKind: 'claude-native';
43
- readonly address: Readonly<Record<string, string>>;
44
- } | {
45
- readonly routeKind: 'opencode-server';
46
- readonly address: Readonly<Record<string, string>>;
47
- });
48
- /** Current-generation native attention, owned by its exact wake address and catch state. */
49
- export declare function nativePendingPreview(facts: SquareRead, input: NativePendingPreviewInput): NativePendingPreview | undefined;
50
- export declare function sessionInbox(owner: Owner, env?: NodeJS.ProcessEnv, signal?: AbortSignal): Promise<PendingMembership[]>;
51
- export interface SessionPendingObserver {
52
- /** Read committed revisions before reusing content; filesystem hints are only for waiting. */
53
- read(options?: Pick<PendingWaitOptions, 'signal' | 'excludeKeys'>): Promise<PendingMembership[]>;
54
- wait(timeoutMs: number, options?: PendingWaitOptions): Promise<PendingMembership[]>;
55
- close(): void;
56
- }
57
- /** Session-scoped projection over process-shared storage change detectors. */
58
- export declare function observeSessionPending(owner: Owner, suppliedEnv?: NodeJS.ProcessEnv): Promise<SessionPendingObserver>;
6
+ readonly cwd?: string;
7
+ }, signal?: AbortSignal): Promise<InboxMembershipSummary[]>;