@ours.network/fleet 2.4.2 → 2.4.4

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.
@@ -1,12 +1,12 @@
1
- import { createHash } from 'node:crypto';
2
1
  import { NativeClaudeConversation } from './application/native-claude-conversation.js';
3
- import { realpathSync } from 'node:fs';
2
+ import { mkdirSync, readFileSync, readdirSync, realpathSync, watch as watchDirectory } from 'node:fs';
3
+ import { atomicPrivateWrite } from './agent-ours/state.js';
4
4
  import { join, resolve } from 'node:path';
5
5
  import { homedir } from 'node:os';
6
6
  import { setTimeout as sleep } from 'node:timers/promises';
7
7
  import { InvalidArgumentError } from 'commander';
8
- import { inspectCodexThread, listLoadedCodexThreads, readCodexIdentity, validateCodexSocket, verifyCodexBinding, wakeCodexThread } from './native-codex-wake.js';
9
- import { NativeParticipation, nativeHostProfile, nativeParticipationRoot, parseCurrentIdentity, wakePrompt } from './native-participation.js';
8
+ import { inspectCodexThread, listLoadedCodexThreads, validateCodexSocket, verifyCodexBinding, wakeCodexThread } from './native-codex-wake.js';
9
+ import { NativeParticipation, nativeHostProfile, wakePrompt } from './native-participation.js';
10
10
  function harness(value) {
11
11
  if (value === 'claude' || value === 'codex')
12
12
  return value;
@@ -47,38 +47,31 @@ async function serveCodex(store) {
47
47
  const grant = store.authorization();
48
48
  if (!grant?.codexSocket)
49
49
  throw new Error('Enable participation with --codex first.');
50
- const socket = grant.codexSocket;
51
50
  const workers = new Map();
52
- // A thread whose watcher ended (refused, failed or left) is not restarted
53
- // automatically while it stays loaded; it is rediscovered only after Codex
54
- // unloads and loads it again.
55
- const settled = new Set();
56
- let failure;
51
+ const retryAfter = new Map();
57
52
  while (store.authorization()?.grant === grant.grant) {
58
53
  let ids;
59
54
  try {
60
- ids = await listLoadedCodexThreads(socket, (id, metadata) => store.setMetadata('codex', id, metadata));
55
+ ids = await listLoadedCodexThreads(grant.codexSocket, (id, metadata) => store.setMetadata('codex', id, metadata));
61
56
  }
62
57
  catch (error) {
63
- failure = new Error(`The Codex App Server at ${socket} could not list its loaded threads: ${error.message}. `
64
- + 'Start Codex with its App Server, then run `ours-fleet participation serve-codex` again.');
65
- break;
58
+ console.error('Waiting for the Codex App Server:', error.message);
59
+ await sleep(2500);
60
+ continue;
66
61
  }
67
62
  for (const [id, worker] of workers)
68
63
  if (!ids.includes(id))
69
64
  worker.controller.abort();
70
- for (const id of settled)
71
- if (!ids.includes(id)) {
72
- settled.delete(id);
73
- store.clearRefusal('codex', id);
74
- }
65
+ for (const id of retryAfter.keys())
66
+ if (!ids.includes(id))
67
+ retryAfter.delete(id);
75
68
  for (const id of ids) {
76
- if (workers.has(id) || settled.has(id))
69
+ if (workers.has(id) || (retryAfter.get(id) ?? 0) > Date.now())
77
70
  continue;
78
71
  const controller = new AbortController();
79
- const task = watch(store, 'codex', nativeId(id), controller.signal)
80
- .catch((error) => { console.error(`Codex participant ${id}:`, error.message); })
81
- .finally(() => { workers.delete(id); settled.add(id); });
72
+ const task = watch(store, 'codex', nativeId(id), controller.signal).then(() => { retryAfter.set(id, Date.now() + 30_000); })
73
+ .catch((error) => { retryAfter.set(id, Date.now() + 30_000); console.error('Codex participant:', error.message); })
74
+ .finally(() => workers.delete(id));
82
75
  workers.set(id, { task, controller });
83
76
  }
84
77
  await sleep(1000);
@@ -86,34 +79,6 @@ async function serveCodex(store) {
86
79
  for (const worker of workers.values())
87
80
  worker.controller.abort();
88
81
  await Promise.all([...workers.values()].map(worker => worker.task));
89
- if (failure)
90
- throw failure;
91
- }
92
- /**
93
- * Claude joins through the ours-fleet-native plugin, which reads the session's own identity with
94
- * current_identity over the session's live MCP connection. The hook only waits for that join.
95
- */
96
- async function claudeJoined(store, session, grant, signal) {
97
- for (let waited = 0; !signal?.aborted && store.authorization()?.grant === grant; waited++) {
98
- if (store.joined('claude', session))
99
- return true;
100
- const refusal = store.takeRefusal('claude', session);
101
- if (refusal) {
102
- console.error(refusal);
103
- process.exitCode = 1;
104
- return false;
105
- }
106
- if (store.refused('claude', session))
107
- return false;
108
- if (waited === 60) {
109
- console.error(`Native participation: Claude session ${session} has not joined. Its identity is read by the ours-fleet-native plugin; `
110
- + 'install it with `claude plugin install ours-fleet-native --marketplace <ours-fleet package>/contrib --scope user`, then restart or resume this session.');
111
- process.exitCode = 1;
112
- return false;
113
- }
114
- await sleep(1000);
115
- }
116
- return false;
117
82
  }
118
83
  async function watch(store, host, session, signal) {
119
84
  const grant = store.authorization();
@@ -121,29 +86,29 @@ async function watch(store, host, session, signal) {
121
86
  return;
122
87
  await store.watch(host, session, async () => {
123
88
  const socket = grant.codexSocket;
89
+ if (host === 'codex' && (!socket || await inspectCodexThread(socket, session) === 'absent'))
90
+ return;
124
91
  let binding;
125
- if (host === 'codex') {
126
- if (!socket || await inspectCodexThread(socket, session) === 'absent')
127
- return;
128
- // The thread's own live Ours integration reports its identity; Fleet never opens the attachment.
129
- const { text, error } = await readCodexIdentity(socket, session);
130
- const observed = parseCurrentIdentity(text);
131
- if (!await store.start(host, session, observed, observed ? undefined : error ?? text))
132
- return;
133
- binding = observed;
134
- }
135
- else if (!await claudeJoined(store, session, grant.grant, signal))
92
+ if (!await store.start(host, session, host === 'codex' && socket ? async (cid, name) => {
93
+ binding = { cid, name };
94
+ return verifyCodexBinding(socket, session, cid, name);
95
+ } : undefined))
136
96
  return;
97
+ let unreachable = 0;
137
98
  while (!signal?.aborted && store.authorization()?.grant === grant.grant) {
138
99
  try {
139
- // The thread was unloaded: the conversation ended, so Fleet leaves it.
140
- if (host === 'codex' && socket && await inspectCodexThread(socket, session) === 'absent')
141
- break;
100
+ if (host === 'codex' && socket && await inspectCodexThread(socket, session) === 'absent') {
101
+ if (++unreachable >= 3)
102
+ break;
103
+ await sleep(1000);
104
+ continue;
105
+ }
142
106
  const result = await store.poll(host, session, host === 'codex' && socket ? async (wakeId) => {
143
107
  if (!binding || !await verifyCodexBinding(socket, session, binding.cid, binding.name))
144
108
  throw new Error('The target Codex runtime no longer has the authorized Ours identity.');
145
109
  return wakeCodexThread(socket, session, wakeId);
146
110
  } : async () => true, signal);
111
+ unreachable = 0;
147
112
  if (result === 'end')
148
113
  return;
149
114
  if (result === 'wake' && host === 'claude') {
@@ -155,23 +120,19 @@ async function watch(store, host, session, signal) {
155
120
  catch (error) {
156
121
  if (signal?.aborted)
157
122
  break;
158
- // The first failure is terminal for this watcher: no retry, and Fleet leaves the session.
159
- store.recordRefusal(host, session, `Native participation stopped for ${host} session ${session}: ${error.message}. `
160
- + 'Fleet left this session and does not retry; resolve the cause, then '
161
- + (host === 'claude' ? 'restart or resume this Claude session to rejoin.' : 'reload the Codex thread to rejoin.'));
162
- console.error(store.takeRefusal(host, session));
163
- if (host === 'claude')
164
- process.exitCode = 1;
165
- break;
123
+ if (++unreachable >= 3) {
124
+ console.error('Native participation watcher stopped:', error.message);
125
+ break;
126
+ }
166
127
  }
167
128
  await sleep(1000);
168
129
  }
169
- await store.leave(host, session, false, grant.grant);
130
+ await store.leave(host, session, false);
170
131
  });
171
132
  }
172
133
  export function registerNativeParticipationCommands(program) {
173
134
  const participation = program.command('participation')
174
- .description('Experiment for ordinary terminal sessions that join Fleet voluntarily');
135
+ .description('Let ordinary Claude Code and Codex terminal sessions join Fleet voluntarily');
175
136
  const store = async () => new NativeParticipation(await nativeHostProfile());
176
137
  participation.command('enable')
177
138
  .description('Authorize automatic registration and peer-triggered wake under one Human')
@@ -224,6 +185,7 @@ export function registerNativeParticipationCommands(program) {
224
185
  else if (event === 'SessionStart' || event === 'Stop')
225
186
  await watch(registry, 'claude', session);
226
187
  });
188
+ // One-shot state exchange, run by the ours-fleet-native plugin on session events (not on a timer).
227
189
  participation.command('claude-bridge', { hidden: true }).argument('<session-id>', 'native session UUID', nativeId).action(async (session) => {
228
190
  let input = '';
229
191
  for await (const chunk of process.stdin) {
@@ -231,47 +193,64 @@ export function registerNativeParticipationCommands(program) {
231
193
  if (input.length > 1024 * 1024)
232
194
  throw Error('Claude bridge payload too large');
233
195
  }
234
- const registry = await store(), grant = registry.authorization();
235
- const state = JSON.parse(input);
236
- if (grant && !registry.joined('claude', session) && !registry.refused('claude', session)) {
237
- // Join with the identity the plugin read through this session's own MCP connection (current_identity).
238
- if (!state.identity) {
239
- console.log(JSON.stringify({ identity: 'required' }));
240
- return;
241
- }
242
- const observed = parseCurrentIdentity(state.identity.text);
243
- await registry.start('claude', session, observed, observed ? undefined : state.identity.error ?? state.identity.text);
244
- }
245
- const row = registry.list().find(r => r.harness === 'claude' && registry.participant(r.name)?.nativeId === session);
246
- if (!row || !grant) {
247
- console.log('{}');
248
- return;
249
- }
250
- // An answer to an on-demand App read (peer contacts/history) is a side call, not a pulse.
251
- if (Array.isArray(state.reads)) {
252
- for (const answer of state.reads)
253
- await registry.answerRead(session, answer.id, answer.value);
196
+ const registry = await store(), joined = registry.claudeBridge(session);
197
+ if (!joined) {
254
198
  console.log('{}');
255
199
  return;
256
200
  }
201
+ const state = JSON.parse(input);
257
202
  if (typeof state.transcriptPath !== 'string' || !['idle', 'busy', 'waiting'].includes(state.status) || typeof state.correlations !== 'object' || !Array.isArray(state.finished))
258
203
  throw Error('Invalid Claude bridge state');
259
- const key = `${grant.rootCid}:${row.cid}:${grant.grant}`;
260
- const guard = () => { if (registry.authorization()?.grant !== grant.grant || !registry.list().some(r => r.cid === row.cid))
204
+ const guard = () => { if (registry.claudeBridge(session)?.cid !== joined.cid)
261
205
  throw Error('Native participation withdrawn'); };
262
- const bridge = new NativeClaudeConversation(join(nativeParticipationRoot(), 'native-conversations', createHash('sha256').update(key).digest('hex'), 'bridge'), session, guard);
263
- const reply = await bridge.pulse(state);
264
- // The normal pulse runs first; at most one waiting read is claimed (once) and handed over with it.
265
- // The pulse was awaited: re-check consent right at the one-time handoff.
266
- let granted = true;
206
+ const bridge = new NativeClaudeConversation(joined.directory, session, guard);
207
+ console.log(JSON.stringify(await bridge.pulse(state)));
208
+ });
209
+ // The plugin's one long-lived child per Claude session: it says "input" when the App queues a prompt and
210
+ // keeps a heartbeat, so the plugin runs claude-bridge only when something happened.
211
+ participation.command('claude-watch', { hidden: true }).argument('<session-id>', 'native session UUID', nativeId).action(async (session) => {
212
+ const registry = await store(), parent = process.ppid;
213
+ const say = (line) => { process.stdout.write(line + '\n'); };
214
+ let joined = registry.claudeBridge(session);
215
+ // The SessionStart hook creates the session's identity; wait for that join while the grant stands.
216
+ while (!joined) {
217
+ if (!registry.authorization() || process.ppid !== parent)
218
+ return;
219
+ await sleep(2000);
220
+ joined = registry.claudeBridge(session);
221
+ }
222
+ const directory = joined.directory;
223
+ mkdirSync(directory, { recursive: true, mode: 0o700 });
224
+ const unclaimed = () => readdirSync(directory).filter(name => /^input-[a-f0-9]+\.json$/.test(name)).some(name => {
225
+ try {
226
+ return !JSON.parse(readFileSync(join(directory, name), 'utf8')).claimed;
227
+ }
228
+ catch {
229
+ return false;
230
+ }
231
+ });
232
+ say('joined');
233
+ const watcher = watchDirectory(directory, (_event, name) => { if (name && /^input-[a-f0-9]+\.json$/.test(String(name)) && unclaimed())
234
+ say('input'); });
267
235
  try {
268
- guard();
236
+ for (let tick = 0;; tick++) {
237
+ if (registry.claudeBridge(session)?.cid !== joined.cid) {
238
+ say('left');
239
+ return;
240
+ }
241
+ // Orphaned when Claude exits without unloading the plugin.
242
+ if (process.ppid !== parent)
243
+ return;
244
+ atomicPrivateWrite(join(directory, 'alive.json'), { pid: process.pid, at: Date.now() });
245
+ // A missed change notification is caught by this rescan.
246
+ if (tick % 6 === 5 && unclaimed())
247
+ say('input');
248
+ await sleep(5000);
249
+ }
269
250
  }
270
- catch {
271
- granted = false;
251
+ finally {
252
+ watcher.close();
272
253
  }
273
- const read = granted && state.canRead === true ? registry.claimRead(session) : undefined;
274
- console.log(JSON.stringify(read ? { ...reply, read } : reply));
275
254
  });
276
255
  participation.command('serve-codex')
277
256
  .description('Discover native conversations on the authorized local Codex App Server and wake them on mail')
@@ -1,4 +1,5 @@
1
1
  import type { OursClient } from '@ours.network/sdk';
2
+ import { ApplicationIdentityStore } from '@ours.network/mcp/application-identities';
2
3
  import type { HostProfile } from '@ours.network/mcp/dist/types/host-profile.d.ts';
3
4
  export type NativeHarness = 'claude' | 'codex';
4
5
  export type NativeWake = (wakeId: string) => Promise<boolean>;
@@ -23,37 +24,15 @@ type Session = {
23
24
  closed?: true;
24
25
  withdrawn?: true;
25
26
  };
26
- /** Fleet's own API-authenticated daemon client: it never opens, binds or allocates a native attachment. */
27
- type DaemonClient = Pick<OursClient, 'listIdentities' | 'readNotificationPage' | 'close'>;
27
+ type SessionClient = Pick<OursClient, 'listIdentities' | 'currentIdentity' | 'createTemporaryIdentity' | 'closeTemporaryIdentityOp' | 'readNotificationPage' | 'close'>;
28
28
  export declare function nativeHostProfile(): Promise<HostProfile>;
29
- /** What the native session's own Ours integration reports through its read-only current_identity tool. */
30
- export type ObservedIdentity = {
31
- name: string;
32
- cid: string;
33
- temporary: boolean;
34
- rootName?: string;
35
- };
36
- export declare function parseCurrentIdentity(text: string | undefined): ObservedIdentity | undefined;
37
- export type NativeToolResult = {
38
- isError?: boolean;
39
- structuredContent?: unknown;
40
- content?: Array<{
41
- type: string;
42
- text?: string;
43
- }>;
44
- };
45
- /** A read-only Ours tool result from the native session, with its current_identity text before and after. */
46
- export type NativeToolRead = {
47
- before?: string;
48
- result: NativeToolResult;
49
- after?: string; /** A failure produced by the bridge, not the tool. */
50
- local?: true;
51
- };
29
+ declare function nativeConnection(profile: HostProfile, session: string): Promise<SessionClient>;
52
30
  export declare class NativeParticipation {
53
31
  private readonly profile;
54
32
  private readonly directory;
55
33
  private readonly connect;
56
- constructor(profile: HostProfile, directory?: string, connect?: (profile: HostProfile) => Promise<DaemonClient>);
34
+ private readonly visibility;
35
+ constructor(profile: HostProfile, directory?: string, connect?: typeof nativeConnection, visibility?: ApplicationIdentityStore);
57
36
  private get profileDirectory();
58
37
  private get authorizationPath();
59
38
  private get authorizationLock();
@@ -72,53 +51,191 @@ export declare class NativeParticipation {
72
51
  }>;
73
52
  /** Internal locator; never part of the public directory response. */
74
53
  participant(name: string): Session | undefined;
75
- /**
76
- * Peer contacts and history are session-scoped, so they are read on demand through the participant's own
77
- * live MCP connection (Codex: App Server tool call; Claude: the ours-fleet-native plugin), with
78
- * current_identity read before and after. Fleet never opens or rebinds the native attachment.
79
- */
80
54
  correspondence(name: string, request?: {
81
55
  peer_cid: string;
82
56
  limit?: number;
83
57
  before_seq?: number;
84
58
  }): Promise<unknown>;
85
- private readsDirectory;
86
- /** A bounded on-demand request to the Claude plugin, answered once off its pulse; never repeated. */
87
- private claudeRead;
88
59
  /**
89
- * Claims at most one waiting request for the Claude plugin. The claim is an atomic rename, so each request
90
- * is handed out exactly once; the App's deadline governs how long it waits for the answer.
60
+ * The App's agent tools (contacts, invites, messaging) for a native participant: the same fixed-identity
61
+ * Ours MCP server a managed agent's supervisor serves, run over the session's own bound attachment. The
62
+ * binding is checked before the server starts and again around every call; file tools are refused because
63
+ * a terminal session has no sandbox file context to act in.
91
64
  */
92
- claimRead(session: string): {
93
- id: string;
65
+ withOursTools<T>(name: string, work: (client: import('@modelcontextprotocol/sdk/client/index.js').Client, identity: {
66
+ name: string;
67
+ cid: string;
68
+ generation: string;
69
+ }, verify: () => Promise<void>) => Promise<T>): Promise<T>;
70
+ listOursTools(name: string): Promise<{
71
+ tools: {
72
+ inputSchema: {
73
+ [x: string]: unknown;
74
+ type: "object";
75
+ properties?: Record<string, object> | undefined;
76
+ required?: string[] | undefined;
77
+ };
78
+ name: string;
79
+ description?: string | undefined;
80
+ outputSchema?: {
81
+ [x: string]: unknown;
82
+ type: "object";
83
+ properties?: Record<string, object> | undefined;
84
+ required?: string[] | undefined;
85
+ } | undefined;
86
+ annotations?: {
87
+ title?: string | undefined;
88
+ readOnlyHint?: boolean | undefined;
89
+ destructiveHint?: boolean | undefined;
90
+ idempotentHint?: boolean | undefined;
91
+ openWorldHint?: boolean | undefined;
92
+ } | undefined;
93
+ execution?: {
94
+ taskSupport?: "optional" | "required" | "forbidden" | undefined;
95
+ } | undefined;
96
+ _meta?: Record<string, unknown> | undefined;
97
+ icons?: {
98
+ src: string;
99
+ mimeType?: string | undefined;
100
+ sizes?: string[] | undefined;
101
+ theme?: "light" | "dark" | undefined;
102
+ }[] | undefined;
103
+ title?: string | undefined;
104
+ }[];
105
+ _meta?: {
106
+ [x: string]: unknown;
107
+ progressToken?: string | number | undefined;
108
+ "io.modelcontextprotocol/related-task"?: {
109
+ taskId: string;
110
+ } | undefined;
111
+ } | undefined;
112
+ nextCursor?: string | undefined;
113
+ agent: string;
114
+ identity: {
115
+ name: string;
116
+ cid: string;
117
+ generation: string;
118
+ };
119
+ }>;
120
+ callOursTool(name: string, request: {
94
121
  tool: string;
95
- arguments: object;
96
- expect: {
122
+ arguments?: Record<string, unknown>;
123
+ }): Promise<{
124
+ agent: string;
125
+ identity: {
97
126
  name: string;
98
127
  cid: string;
128
+ generation: string;
99
129
  };
130
+ result: {
131
+ [x: string]: unknown;
132
+ content: ({
133
+ type: "text";
134
+ text: string;
135
+ annotations?: {
136
+ audience?: ("user" | "assistant")[] | undefined;
137
+ priority?: number | undefined;
138
+ lastModified?: string | undefined;
139
+ } | undefined;
140
+ _meta?: Record<string, unknown> | undefined;
141
+ } | {
142
+ type: "image";
143
+ data: string;
144
+ mimeType: string;
145
+ annotations?: {
146
+ audience?: ("user" | "assistant")[] | undefined;
147
+ priority?: number | undefined;
148
+ lastModified?: string | undefined;
149
+ } | undefined;
150
+ _meta?: Record<string, unknown> | undefined;
151
+ } | {
152
+ type: "audio";
153
+ data: string;
154
+ mimeType: string;
155
+ annotations?: {
156
+ audience?: ("user" | "assistant")[] | undefined;
157
+ priority?: number | undefined;
158
+ lastModified?: string | undefined;
159
+ } | undefined;
160
+ _meta?: Record<string, unknown> | undefined;
161
+ } | {
162
+ type: "resource";
163
+ resource: {
164
+ uri: string;
165
+ text: string;
166
+ mimeType?: string | undefined;
167
+ _meta?: Record<string, unknown> | undefined;
168
+ } | {
169
+ uri: string;
170
+ blob: string;
171
+ mimeType?: string | undefined;
172
+ _meta?: Record<string, unknown> | undefined;
173
+ };
174
+ annotations?: {
175
+ audience?: ("user" | "assistant")[] | undefined;
176
+ priority?: number | undefined;
177
+ lastModified?: string | undefined;
178
+ } | undefined;
179
+ _meta?: Record<string, unknown> | undefined;
180
+ } | {
181
+ uri: string;
182
+ name: string;
183
+ type: "resource_link";
184
+ description?: string | undefined;
185
+ mimeType?: string | undefined;
186
+ size?: number | undefined;
187
+ annotations?: {
188
+ audience?: ("user" | "assistant")[] | undefined;
189
+ priority?: number | undefined;
190
+ lastModified?: string | undefined;
191
+ } | undefined;
192
+ _meta?: {
193
+ [x: string]: unknown;
194
+ } | undefined;
195
+ icons?: {
196
+ src: string;
197
+ mimeType?: string | undefined;
198
+ sizes?: string[] | undefined;
199
+ theme?: "light" | "dark" | undefined;
200
+ }[] | undefined;
201
+ title?: string | undefined;
202
+ })[];
203
+ _meta?: {
204
+ [x: string]: unknown;
205
+ progressToken?: string | number | undefined;
206
+ "io.modelcontextprotocol/related-task"?: {
207
+ taskId: string;
208
+ } | undefined;
209
+ } | undefined;
210
+ structuredContent?: Record<string, unknown> | undefined;
211
+ isError?: boolean | undefined;
212
+ } | {
213
+ [x: string]: unknown;
214
+ toolResult: unknown;
215
+ _meta?: {
216
+ [x: string]: unknown;
217
+ progressToken?: string | number | undefined;
218
+ "io.modelcontextprotocol/related-task"?: {
219
+ taskId: string;
220
+ } | undefined;
221
+ } | undefined;
222
+ };
223
+ }>;
224
+ /**
225
+ * Where a joined Claude session's plugin bridge lives under the current grant. Unlike the directory listing,
226
+ * it does not depend on the watcher's recent poll, so a long turn does not cut the plugin off.
227
+ */
228
+ claudeBridge(session: string): {
229
+ directory: string;
230
+ cid: string;
231
+ grant: string;
100
232
  } | undefined;
101
- /** Stores the plugin's answer only while the App still waits for it (the claim exists), under the request's lock. */
102
- answerRead(session: string, id: string, value: NativeToolRead): Promise<void>;
103
233
  setMetadata(harness: NativeHarness, session: string, metadata: {
104
234
  title?: string;
105
235
  cwd?: string;
106
236
  }): void;
107
237
  watch(harness: NativeHarness, session: string, run: () => Promise<void>): Promise<void>;
108
- private refusalPath;
109
- /** A refusal not yet shown to the person, returned once; the session is not tried again until it ends. */
110
- takeRefusal(harness: NativeHarness, session: string): string | undefined;
111
- recordRefusal(harness: NativeHarness, session: string, message: string): void;
112
- refused(harness: NativeHarness, session: string): boolean;
113
- clearRefusal(harness: NativeHarness, session: string): void;
114
- joined(harness: NativeHarness, session: string): boolean;
115
- /**
116
- * Joins the identity the native session is already bound to, as its own live Ours integration reports it.
117
- * Fleet never creates, binds or closes an identity: an unbound or ineligible session is refused once, with
118
- * what to do, and is not tried again automatically.
119
- */
120
- start(harness: NativeHarness, session: string, observed: ObservedIdentity | undefined, detail?: string): Promise<boolean>;
121
- /** Removes only Fleet's participation state; the identity, its CID and its inbox stay with the native session. */
238
+ start(harness: NativeHarness, session: string, verify?: (cid: string, name: string) => Promise<boolean>): Promise<boolean>;
122
239
  leave(harness: NativeHarness, session: string, withdraw?: boolean, grant?: string): Promise<void>;
123
240
  poll(harness: NativeHarness, session: string, wake: NativeWake, signal?: AbortSignal): Promise<'wake' | 'wait' | 'end'>;
124
241
  }