@astrosheep/square 0.3.63 → 0.3.65

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 (171) hide show
  1. package/claude-plugin/.claude-plugin/plugin.json +3 -2
  2. package/claude-plugin/hooks/hooks.json +1 -22
  3. package/claude-plugin/hooks/register.js +119 -0
  4. package/claude-plugin/types.d.ts +7 -0
  5. package/codex-plugin/.codex-plugin/plugin.json +1 -1
  6. package/dist/activity-feed.d.ts +1 -10
  7. package/dist/activity-feed.js +1 -27
  8. package/dist/activity.js +57 -25
  9. package/dist/artifact.d.ts +1 -1
  10. package/dist/artifact.js +24 -25
  11. package/dist/attention-presentation.js +1 -0
  12. package/dist/automatic-session.d.ts +3 -1
  13. package/dist/automatic-session.js +21 -34
  14. package/dist/boundary-presentation.js +4 -13
  15. package/dist/canonical-path.d.ts +11 -0
  16. package/dist/canonical-path.js +47 -0
  17. package/dist/catch-decisions.js +14 -10
  18. package/dist/catch-selection.d.ts +6 -0
  19. package/dist/catch-selection.js +14 -0
  20. package/dist/claude-delivery.d.ts +11 -0
  21. package/dist/claude-delivery.js +145 -0
  22. package/dist/claude-mod.d.ts +8 -0
  23. package/dist/claude-mod.js +164 -0
  24. package/dist/cli/context.d.ts +0 -1
  25. package/dist/cli/context.js +9 -21
  26. package/dist/cli/harness-command.d.ts +0 -1
  27. package/dist/cli/harness-command.js +0 -6
  28. package/dist/cli/observation-commands.d.ts +1 -1
  29. package/dist/cli/observation-commands.js +31 -58
  30. package/dist/cli/program.js +20 -18
  31. package/dist/cli/registry.js +2 -2
  32. package/dist/cli/square-commands.js +10 -6
  33. package/dist/codex-boundary-state.d.ts +2 -2
  34. package/dist/codex-boundary-state.js +4 -4
  35. package/dist/codex-hook.js +12 -15
  36. package/dist/codex-queue.d.ts +2 -2
  37. package/dist/codex-queue.js +7 -5
  38. package/dist/decisions.d.ts +2 -6
  39. package/dist/decisions.js +16 -17
  40. package/dist/delivery-health.d.ts +1 -2
  41. package/dist/delivery-health.js +4 -5
  42. package/dist/delivery-operations.d.ts +2 -5
  43. package/dist/delivery-operations.js +77 -214
  44. package/dist/delivery.d.ts +25 -47
  45. package/dist/delivery.js +14 -46
  46. package/dist/diagnostic-redaction.js +7 -9
  47. package/dist/file-changes.d.ts +0 -1
  48. package/dist/file-changes.js +2 -19
  49. package/dist/harness-claude.js +8 -6
  50. package/dist/harness-codex.d.ts +0 -2
  51. package/dist/harness-codex.js +0 -2
  52. package/dist/harness-links.js +13 -17
  53. package/dist/harness.js +3 -7
  54. package/dist/help.js +4 -3
  55. package/dist/host-ledger-file-adapter.d.ts +17 -8
  56. package/dist/host-ledger-file-adapter.js +164 -80
  57. package/dist/host-ledger.d.ts +55 -50
  58. package/dist/inbox.d.ts +0 -3
  59. package/dist/inbox.js +88 -50
  60. package/dist/index.d.ts +1 -1
  61. package/dist/index.js +1 -1
  62. package/dist/list.js +1 -4
  63. package/dist/mcp.js +24 -41
  64. package/dist/mention-parse.js +3 -9
  65. package/dist/model.d.ts +11 -2
  66. package/dist/model.js +1 -1
  67. package/dist/notifications.d.ts +3 -16
  68. package/dist/notifications.js +41 -122
  69. package/dist/opencode-delivery.d.ts +14 -0
  70. package/dist/opencode-delivery.js +171 -0
  71. package/dist/opencode.d.ts +39 -18
  72. package/dist/opencode.js +145 -40
  73. package/dist/packages/agent-delivery/src/claude-auth.d.ts +13 -0
  74. package/dist/packages/agent-delivery/src/claude-auth.js +75 -0
  75. package/dist/packages/agent-delivery/src/claude-native.d.ts +28 -0
  76. package/dist/packages/agent-delivery/src/claude-native.js +68 -0
  77. package/dist/packages/agent-delivery/src/claude.d.ts +14 -0
  78. package/dist/packages/agent-delivery/src/claude.js +66 -0
  79. package/dist/packages/agent-delivery/src/deadline.d.ts +11 -0
  80. package/dist/packages/agent-delivery/src/deadline.js +41 -0
  81. package/dist/packages/agent-delivery/src/errors.d.ts +16 -0
  82. package/dist/packages/agent-delivery/src/errors.js +41 -0
  83. package/dist/packages/agent-delivery/src/guards.d.ts +6 -0
  84. package/dist/packages/agent-delivery/src/guards.js +6 -0
  85. package/dist/packages/agent-delivery/src/index.d.ts +83 -0
  86. package/dist/packages/agent-delivery/src/index.js +110 -0
  87. package/dist/packages/agent-delivery/src/local-endpoint.d.ts +26 -0
  88. package/dist/packages/agent-delivery/src/local-endpoint.js +114 -0
  89. package/dist/packages/agent-delivery/src/opencode-native.d.ts +33 -0
  90. package/dist/packages/agent-delivery/src/opencode-native.js +75 -0
  91. package/dist/packages/agent-delivery/src/opencode.d.ts +14 -0
  92. package/dist/packages/agent-delivery/src/opencode.js +127 -0
  93. package/dist/packages/agent-delivery/src/paseo-native.d.ts +58 -0
  94. package/dist/packages/agent-delivery/src/paseo-native.js +122 -0
  95. package/dist/packages/agent-delivery/src/paseo.d.ts +19 -0
  96. package/dist/packages/agent-delivery/src/paseo.js +106 -0
  97. package/dist/packages/agent-delivery/src/pi-client.d.ts +10 -0
  98. package/dist/packages/agent-delivery/src/pi-client.js +106 -0
  99. package/dist/packages/agent-delivery/src/pi-protocol.d.ts +15 -0
  100. package/dist/packages/agent-delivery/src/pi-protocol.js +50 -0
  101. package/dist/packages/agent-delivery/src/pi-send.d.ts +23 -0
  102. package/dist/packages/agent-delivery/src/pi-send.js +4 -0
  103. package/dist/packages/agent-delivery/src/pi.d.ts +25 -0
  104. package/dist/packages/agent-delivery/src/pi.js +209 -0
  105. package/dist/packages/agent-delivery/src/types.d.ts +120 -0
  106. package/dist/participant-host.js +12 -13
  107. package/dist/participant-identity.d.ts +21 -0
  108. package/dist/participant-identity.js +32 -11
  109. package/dist/paseo-delivery.d.ts +2 -2
  110. package/dist/paseo-delivery.js +35 -27
  111. package/dist/paseo-timeline.js +25 -21
  112. package/dist/paseo.d.ts +2 -2
  113. package/dist/paseo.js +1 -2
  114. package/dist/ports.d.ts +7 -20
  115. package/dist/presentation-operations.js +16 -4
  116. package/dist/presentation.d.ts +19 -10
  117. package/dist/presentation.js +99 -177
  118. package/dist/registry.d.ts +15 -66
  119. package/dist/registry.js +45 -123
  120. package/dist/routes.d.ts +1 -28
  121. package/dist/routes.js +22 -104
  122. package/dist/runtime.d.ts +3 -9
  123. package/dist/runtime.js +14 -67
  124. package/dist/search.d.ts +0 -2
  125. package/dist/search.js +3 -10
  126. package/dist/square-actions.js +48 -72
  127. package/dist/square-application.js +32 -30
  128. package/dist/square-core.d.ts +3 -0
  129. package/dist/square-core.js +22 -5
  130. package/dist/square-facade.d.ts +2 -0
  131. package/dist/square-file-adapter.d.ts +2 -1
  132. package/dist/square-file-adapter.js +6 -9
  133. package/dist/square-projections.d.ts +40 -45
  134. package/dist/square-projections.js +60 -74
  135. package/dist/square-state.js +1 -4
  136. package/dist/square-storage.d.ts +5 -8
  137. package/dist/square-storage.js +13 -36
  138. package/dist/square-wiring.d.ts +2 -7
  139. package/dist/square-wiring.js +6 -24
  140. package/dist/stream.js +4 -6
  141. package/dist/time.js +2 -7
  142. package/dist/views.d.ts +6 -18
  143. package/dist/views.js +14 -21
  144. package/dist/wake-attempts.d.ts +2 -56
  145. package/dist/wake-attempts.js +15 -110
  146. package/dist/wake-eligibility.d.ts +43 -0
  147. package/dist/wake-eligibility.js +106 -0
  148. package/dist/wake-evidence.d.ts +32 -9
  149. package/dist/wake-evidence.js +29 -24
  150. package/dist/wake-sink.d.ts +13 -9
  151. package/dist/wake-sink.js +35 -54
  152. package/dist/watch.js +13 -21
  153. package/extensions/square-pi.js +27 -13
  154. package/guides/change-waits.md +1 -1
  155. package/guides/claude-native.md +101 -0
  156. package/guides/host-ledger.md +3 -1
  157. package/guides/participant.md +14 -7
  158. package/guides/pi-native-delivery.md +49 -0
  159. package/package.json +4 -3
  160. package/dist/claude-hook.d.ts +0 -10
  161. package/dist/claude-hook.js +0 -60
  162. package/dist/paseo-connection.d.ts +0 -15
  163. package/dist/paseo-connection.js +0 -141
  164. package/dist/presence.d.ts +0 -2
  165. package/dist/presence.js +0 -24
  166. package/dist/presented.d.ts +0 -2
  167. package/dist/presented.js +0 -10
  168. package/dist/state-cell.d.ts +0 -14
  169. package/dist/wake-port.d.ts +0 -23
  170. package/dist/wake-port.js +0 -27
  171. /package/dist/{state-cell.js → packages/agent-delivery/src/types.js} +0 -0
@@ -1,16 +1,14 @@
1
1
  const MAX_STRING_LENGTH = 1_000;
2
2
  const MAX_COLLECTION_ITEMS = 32;
3
3
  const MAX_NESTING = 8;
4
- function redactText(value, secret) {
5
- const withoutSecret = secret?.trim() ? value.split(secret.trim()).join('[redacted]') : value;
6
- const withoutUrlPassword = withoutSecret.replace(/([?&]password=)[^&\s]+/gi, '$1[redacted]');
7
- return [...withoutUrlPassword].length <= MAX_STRING_LENGTH
8
- ? withoutUrlPassword
9
- : `${[...withoutUrlPassword].slice(0, MAX_STRING_LENGTH - 1).join('')}…`;
10
- }
11
4
  function redactValue(value, secret, seen, depth) {
12
- if (typeof value === 'string')
13
- return redactText(value, secret);
5
+ if (typeof value === 'string') {
6
+ const withoutSecret = secret?.trim() ? value.split(secret.trim()).join('[redacted]') : value;
7
+ const withoutUrlPassword = withoutSecret.replace(/([?&]password=)[^&\s]+/gi, '$1[redacted]');
8
+ return [...withoutUrlPassword].length <= MAX_STRING_LENGTH
9
+ ? withoutUrlPassword
10
+ : `${[...withoutUrlPassword].slice(0, MAX_STRING_LENGTH - 1).join('')}…`;
11
+ }
14
12
  if (depth >= MAX_NESTING)
15
13
  return '[truncated]';
16
14
  if (Array.isArray(value)) {
@@ -1,4 +1,3 @@
1
- export declare function canonicalFilePath(value: string): Promise<string>;
2
1
  export interface VersionObserver<T> {
3
2
  readonly generation: number;
4
3
  hinted(since: number, timeoutMs: number, signal?: AbortSignal): Promise<boolean>;
@@ -1,25 +1,8 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
+ import { canonicalPath } from './canonical-path.js';
3
4
  /** Filesystem notifications are hints, never proof of a committed change. */
4
5
  const RECONCILE_MS = 2_000;
5
- export async function canonicalFilePath(value) {
6
- let current = path.resolve(value);
7
- const suffix = [];
8
- for (;;) {
9
- try {
10
- return path.join(await fs.promises.realpath(current), ...suffix.reverse());
11
- }
12
- catch (error) {
13
- if (error.code !== 'ENOENT')
14
- return path.resolve(value);
15
- const parent = path.dirname(current);
16
- if (parent === current)
17
- return path.resolve(value);
18
- suffix.push(path.basename(current));
19
- current = parent;
20
- }
21
- }
22
- }
23
6
  /** A local edge counter: register first, inspect state, then wait from that counter. */
24
7
  class Edges {
25
8
  version = 0;
@@ -144,7 +127,7 @@ async function abortable(promise, signal) {
144
127
  const versions = new Map();
145
128
  /** Shared only within this process. Durable state is always read at the storage boundary. */
146
129
  export async function observeFileVersion(filePath, kind, read) {
147
- const file = await canonicalFilePath(filePath);
130
+ const file = await canonicalPath(filePath);
148
131
  const key = kind + '\0' + file;
149
132
  let shared = versions.get(key);
150
133
  if (shared === undefined) {
@@ -27,10 +27,6 @@ function requireSuccess(result, operation, allowMissing = false) {
27
27
  return;
28
28
  throw new Error(`Claude ${operation} failed: ${result.stderr.trim() || result.stdout.trim() || `exit ${result.status}`}`);
29
29
  }
30
- function writeJson(file, value) {
31
- fs.mkdirSync(path.dirname(file), { recursive: true });
32
- fs.writeFileSync(file, `${JSON.stringify(value, null, 2)}\n`, { mode: 0o600 });
33
- }
34
30
  export async function installClaudePlugin(homeDir, run = runClaude) {
35
31
  const marketplaceRoot = claudeMarketplaceRoot(homeDir);
36
32
  const staged = stageReplacement(marketplaceRoot, (stage) => {
@@ -39,11 +35,13 @@ export async function installClaudePlugin(homeDir, run = runClaude) {
39
35
  const skill = path.join(plugin, 'skills', 'square', 'SKILL.md');
40
36
  fs.mkdirSync(path.dirname(skill), { recursive: true });
41
37
  fs.copyFileSync(path.join(fileURLToPath(new URL('../skills/square/', import.meta.url)), 'SKILL.md'), skill);
42
- writeJson(path.join(stage, '.claude-plugin', 'marketplace.json'), {
38
+ const manifestPath = path.join(stage, '.claude-plugin', 'marketplace.json');
39
+ fs.mkdirSync(path.dirname(manifestPath), { recursive: true });
40
+ fs.writeFileSync(manifestPath, `${JSON.stringify({
43
41
  name: CLAUDE_MARKETPLACE_NAME,
44
42
  owner: { name: 'Square' },
45
43
  plugins: [{ name: SQUARE_IDENTITY.pluginName, source: './plugins/square' }],
46
- });
44
+ }, null, 2)}\n`, { mode: 0o600 });
47
45
  });
48
46
  try {
49
47
  const add = run(homeDir, ['plugin', 'marketplace', 'add', marketplaceRoot]);
@@ -73,5 +71,9 @@ export async function doctorClaudePlugin(homeDir, run = runClaude) {
73
71
  return [
74
72
  fs.existsSync(bundle) ? `✓ Square Claude plugin bundle ${root}` : `○ Square Claude plugin bundle missing ${root}`,
75
73
  installed ? `✓ ${CLAUDE_PLUGIN_ID} installed` : `○ ${CLAUDE_PLUGIN_ID} unavailable`,
74
+ `Claude native inbox: validated on macOS Claude Code 2.1.295 with a trusted, approved interactive mod.`,
75
+ `Installation or a socket alone does not prove receiver availability; absent/disabled mods, headless unapproved mods, other builds/platforms are unavailable.`,
76
+ `Queue admission is not model processing. Queued or held native messages cannot be retracted by Square cancellation.`,
77
+ `Live routes and admission/presentation evidence: square harness doctor delivery. No legacy fallback.`,
76
78
  ];
77
79
  }
@@ -1,5 +1,3 @@
1
- export declare const CODEX_HOOK_COMMAND: "square codex-hook";
2
- export declare const SQUARE_CODEX_MARKER: "square-codex-hook";
3
1
  export declare const CODEX_PLUGIN_ID: "square@astrosheep";
4
2
  export declare const CODEX_MARKETPLACE_NAME: "astrosheep";
5
3
  export interface CodexCommandResult {
@@ -4,8 +4,6 @@ import { fileURLToPath } from 'node:url';
4
4
  import crossSpawn from 'cross-spawn';
5
5
  import { SQUARE_IDENTITY } from './identity.js';
6
6
  import { stageReplacement } from './harness-stage.js';
7
- export const CODEX_HOOK_COMMAND = SQUARE_IDENTITY.hookCommand;
8
- export const SQUARE_CODEX_MARKER = SQUARE_IDENTITY.hookMarker;
9
7
  export const CODEX_PLUGIN_ID = SQUARE_IDENTITY.pluginId;
10
8
  export const CODEX_MARKETPLACE_NAME = SQUARE_IDENTITY.marketplaceName;
11
9
  const LEGACY_MARKETPLACES = ['astrosheep-square'];
@@ -9,22 +9,21 @@ function packageRoot() {
9
9
  // Emitted modules live in dist; package assets are one level above them.
10
10
  return fileURLToPath(new URL('../', import.meta.url));
11
11
  }
12
- function lstatMaybe(target) {
13
- try {
14
- return fs.lstatSync(target);
15
- }
16
- catch (error) {
17
- if (error.code === 'ENOENT')
18
- return undefined;
19
- throw error;
20
- }
21
- }
22
12
  export function installHarnessLinks(links, force = false) {
23
13
  const prepared = links.map((link) => {
24
14
  if (!fs.existsSync(link.source)) {
25
15
  throw new Error(`Harness link source is missing: ${link.source}`);
26
16
  }
27
- const existing = lstatMaybe(link.target);
17
+ const existing = (() => {
18
+ try {
19
+ return fs.lstatSync(link.target);
20
+ }
21
+ catch (error) {
22
+ if (error.code === 'ENOENT')
23
+ return undefined;
24
+ throw error;
25
+ }
26
+ })();
28
27
  return {
29
28
  ...link,
30
29
  existing,
@@ -94,16 +93,13 @@ function runOpenCode(homeDir, args) {
94
93
  throw result.error;
95
94
  return { status: result.status ?? 1, stdout: result.stdout || '', stderr: result.stderr || '' };
96
95
  }
97
- function requireOpenCodeSuccess(result, action) {
98
- if (result.status === 0)
99
- return;
100
- throw new Error(`OpenCode ${action} failed: ${result.stderr.trim() || result.stdout.trim() || `exit ${result.status}`}`);
101
- }
102
96
  export function installOpenCodePlugin(homeDir, force = false, run = runOpenCode) {
103
97
  const args = ['plugin', SQUARE_IDENTITY.packageName, '--global'];
104
98
  if (force)
105
99
  args.push('--force');
106
- requireOpenCodeSuccess(run(homeDir, args), 'plugin install');
100
+ const result = run(homeDir, args);
101
+ if (result.status !== 0)
102
+ throw new Error(`OpenCode plugin install failed: ${result.stderr.trim() || result.stdout.trim() || `exit ${result.status}`}`);
107
103
  return [SQUARE_IDENTITY.packageName];
108
104
  }
109
105
  function configPath(homeDir) {
package/dist/harness.js CHANGED
@@ -97,14 +97,10 @@ const TARGETS = [
97
97
  export function harnessTargets() {
98
98
  return TARGETS;
99
99
  }
100
- function requireHarnessCapability(target, action) {
101
- const found = TARGETS.find((candidate) => candidate.name === target);
102
- if (found === undefined || !found.capabilities.includes(action))
103
- throw new Error(`Unsupported harness capability: ${action} ${target}`);
104
- return found;
105
- }
106
100
  export async function executeHarnessTarget(targetName, action, context) {
107
- const target = requireHarnessCapability(targetName, action);
101
+ const target = TARGETS.find((candidate) => candidate.name === targetName);
102
+ if (target === undefined || !target.capabilities.includes(action))
103
+ throw new Error(`Unsupported harness capability: ${action} ${targetName}`);
108
104
  const capability = target[action];
109
105
  if (capability === undefined)
110
106
  throw new Error(`Unsupported harness capability: ${action} ${targetName}`);
package/dist/help.js CHANGED
@@ -17,9 +17,9 @@ const COMMANDS = [
17
17
  details: ['Options:', ' --last <N> Show the last N public activities (default 10, maximum 100).', ' --kick End the standing participant and reclaim the name for this session.'],
18
18
  },
19
19
  {
20
- names: ['express'], usage: '--as <name> express [-f|--force] [--no-wait] (--mention <name>... | --no-mention | --bell) [--reply <activity-id>] <activity | ->', usesSquare: true, group: 'participant',
20
+ names: ['express'], usage: '--as <name> express [-f|--force] [--no-wait] (--mention <name>... | --no-mention | --bell | --reply <activity-id>) <activity | ->', usesSquare: true, group: 'participant',
21
21
  summary: 'Speak, gesture, or do both.',
22
- details: ['Reach:', ' --mention <name> Address one participant; repeat for multiple participants. The body stays unchanged.', ' --no-mention Land a bare activity explicitly; @names stay plain text. listen opts someone into future bare delivery.', " --bell Call every participant's attention to this activity.", ' @name An @name in the body also addresses that standing participant; `backticks` keep @text literal.', '', 'Options:', ' -f, --force Express without first catching unread activity or attention etiquette.', ' --no-wait If held or throttled, save a draft and return instead of waiting. A held wait gives up on its own after 10 minutes.', ' --reply <activity-id> Mark this activity as a reply to an earlier activity (for example act/12).'],
22
+ details: ['Reach:', ' --mention <name> Address one participant; repeat for multiple participants. The body stays unchanged.', ' --no-mention Land a bare activity explicitly; @names stay plain text. listen opts someone into future bare delivery.', " --bell Call every participant's attention to this activity.", ' @name An @name in the body also addresses that standing participant; `backticks` keep @text literal.', '', 'Options:', ' -f, --force Express without first catching unread activity or attention etiquette.', ' --no-wait If held or throttled, save a draft and return instead of waiting. A held wait gives up on its own after 10 minutes.', ' --reply <activity-id> Mark this activity as a reply to an earlier activity (for example act/12); it reaches that activity\'s author.'],
23
23
  },
24
24
  { names: ['listen'], usage: '--as <name> listen <participant>', usesSquare: true, group: 'participant', summary: 'Turn an ear toward one participant\'s future bare says.' },
25
25
  { names: ['ignore'], usage: '--as <name> ignore <participant>', usesSquare: true, group: 'participant', summary: 'Ignore one participant\'s future mentions and bare says.' },
@@ -40,7 +40,8 @@ const COMMANDS = [
40
40
  summary: 'Inspect a bounded machine-local notification snapshot for a native session.',
41
41
  details: ['Options:', ' --for-session <id> Required harness session id.', ' --limit <N> Snapshot memberships (default 20, maximum 100).', ' --json Emit the bounded snapshot as structured JSON.'],
42
42
  },
43
- { names: ['claude-hook', 'codex-hook'], usage: '{command}', summary: 'Present pending attention at one native agent boundary.', hiddenFromIndex: true },
43
+ { names: ['codex-hook'], usage: '{command}', summary: 'Present pending attention at one native agent boundary.', hiddenFromIndex: true },
44
+ { names: ['claude-mod'], usage: '{command}', summary: 'Receive a structured operation from the loaded Claude mod.', hiddenFromIndex: true },
44
45
  {
45
46
  names: ['history'], usage: 'history [filters] [output]', usesSquare: true, group: 'participant',
46
47
  summary: 'Read or search the archive without changing what you have caught.',
@@ -1,13 +1,11 @@
1
1
  import { type VersionObserver } from './file-changes.js';
2
- import type { HostLedgerPort, PresenceRecord, PresenceKey, PresenceLookup, PresenceResult, PresenceClaimResult, EvidenceRecord, EvidenceClaim, EvidenceRelease, EvidenceLookup, EvidenceGc, ClaimResult, WakeDispatchClaim, WakeDispatchClaimInput, WakeDispatchReleaseInput, WakeDispatchTransitionInput, WakeAttemptLookup } from './host-ledger.js';
2
+ import type { HostLedgerPort, PresenceRecord, PresenceKey, PresenceLookup, PresenceResult, PresenceClaimResult, EvidenceRecord, EvidenceClaim, EvidenceRelease, EvidenceLookup, EvidenceGc, ClaimResult, WakeAttemptClaim, WakeAttemptClaimInput, WakeAttemptLookup } from './host-ledger.js';
3
3
  export interface HostLedgerFileAdapterOptions {
4
4
  rootPath?: string;
5
- claimsPath?: string;
6
5
  now?: () => number;
7
6
  }
8
7
  export declare class FileHostLedgerPort implements HostLedgerPort {
9
8
  private readonly root;
10
- private readonly claims;
11
9
  private readonly clock;
12
10
  constructor(o?: HostLedgerFileAdapterOptions);
13
11
  private file;
@@ -18,20 +16,31 @@ export declare class FileHostLedgerPort implements HostLedgerPort {
18
16
  }>;
19
17
  /** Time can expire bindings/evidence even when their files do not change. */
20
18
  nextExpiry(session: string): Promise<number>;
19
+ /** The ownership claim critical section: the same lock as claimPresence and finalize. */
20
+ withClaimLock<T>(fn: () => Promise<T>, signal?: AbortSignal): Promise<T>;
21
21
  claimPresence(i: PresenceRecord, signal?: AbortSignal): Promise<PresenceClaimResult>;
22
22
  ensurePresence(i: PresenceRecord): Promise<PresenceResult>;
23
+ /** Local batch suppression is monotonic only for the captured host generation. */
24
+ suppressPresence(i: PresenceRecord, through: number): Promise<boolean>;
23
25
  removePresence(i: PresenceKey): Promise<void>;
24
26
  removePresenceIfUnchanged(i: PresenceRecord): Promise<boolean>;
25
27
  listPresence(i?: PresenceLookup): Promise<readonly PresenceRecord[]>;
26
- claimWakeDispatch(i: WakeDispatchClaimInput): Promise<WakeDispatchClaim>;
27
- transitionWakeDispatch(i: WakeDispatchTransitionInput): Promise<boolean>;
28
- releaseWakeDispatch(i: WakeDispatchReleaseInput): Promise<void>;
28
+ /** One attempt row owns attention-wide exclusion and session-scoped history for a wake. */
29
+ claimWakeAttempt(i: WakeAttemptClaimInput): Promise<WakeAttemptClaim>;
30
+ /** One locked, token-fenced replacement; each operation owns its state condition. */
31
+ private updateWake;
29
32
  listWakeAttempts(i?: WakeAttemptLookup): Promise<readonly EvidenceRecord[]>;
30
- appendWakeAttempt(i: EvidenceRecord & {
33
+ prepareNativeWake(i: EvidenceRecord & {
31
34
  readonly claimToken: string;
32
- }): Promise<void>;
35
+ readonly routeKind: import('./model.js').WakeRouteKind;
36
+ readonly nativeDelivery: import('./host-ledger.js').NativeDeliveryEvidence;
37
+ }): Promise<boolean>;
38
+ confirmWakeAdmission(i: EvidenceRecord & {
39
+ readonly claimToken: string;
40
+ }): Promise<boolean>;
33
41
  claimEvidence(i: EvidenceClaim): Promise<ClaimResult>;
34
42
  releaseEvidence(i: EvidenceRelease): Promise<void>;
43
+ /** Token-fenced terminal write. A token may only finish the attempt it claimed. */
35
44
  appendEvidence(i: EvidenceRecord & {
36
45
  readonly claimToken: string;
37
46
  }): Promise<void>;