shipmates 0.0.0-stage → 0.2.0

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 (68) hide show
  1. package/LICENSE +661 -0
  2. package/dist/cli-run.d.ts +9 -0
  3. package/dist/cli-run.d.ts.map +1 -0
  4. package/dist/cli-run.js +237 -0
  5. package/dist/cli-run.js.map +1 -0
  6. package/dist/cli.d.ts +3 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +11 -0
  9. package/dist/cli.js.map +1 -0
  10. package/dist/delivery.d.ts +37 -0
  11. package/dist/delivery.d.ts.map +1 -0
  12. package/dist/delivery.js +13 -0
  13. package/dist/delivery.js.map +1 -0
  14. package/dist/host.d.ts +132 -0
  15. package/dist/host.d.ts.map +1 -0
  16. package/dist/host.js +66 -0
  17. package/dist/host.js.map +1 -0
  18. package/dist/ids.d.ts +3 -0
  19. package/dist/ids.d.ts.map +1 -0
  20. package/dist/ids.js +6 -0
  21. package/dist/ids.js.map +1 -0
  22. package/dist/index.d.ts +17 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +11 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/liveness.d.ts +25 -0
  27. package/dist/liveness.d.ts.map +1 -0
  28. package/dist/liveness.js +75 -0
  29. package/dist/liveness.js.map +1 -0
  30. package/dist/quiet.d.ts +7 -0
  31. package/dist/quiet.d.ts.map +1 -0
  32. package/dist/quiet.js +19 -0
  33. package/dist/quiet.js.map +1 -0
  34. package/dist/shipmates.d.ts +401 -0
  35. package/dist/shipmates.d.ts.map +1 -0
  36. package/dist/shipmates.js +1112 -0
  37. package/dist/shipmates.js.map +1 -0
  38. package/dist/store.d.ts +19 -0
  39. package/dist/store.d.ts.map +1 -0
  40. package/dist/store.js +236 -0
  41. package/dist/store.js.map +1 -0
  42. package/dist/tail.d.ts +27 -0
  43. package/dist/tail.d.ts.map +1 -0
  44. package/dist/tail.js +127 -0
  45. package/dist/tail.js.map +1 -0
  46. package/dist/types.d.ts +129 -0
  47. package/dist/types.d.ts.map +1 -0
  48. package/dist/types.js +11 -0
  49. package/dist/types.js.map +1 -0
  50. package/dist/watch.d.ts +13 -0
  51. package/dist/watch.d.ts.map +1 -0
  52. package/dist/watch.js +30 -0
  53. package/dist/watch.js.map +1 -0
  54. package/package.json +48 -3
  55. package/src/cli-run.ts +263 -0
  56. package/src/cli.ts +11 -0
  57. package/src/delivery.ts +49 -0
  58. package/src/host.ts +161 -0
  59. package/src/ids.ts +6 -0
  60. package/src/index.ts +44 -0
  61. package/src/liveness.ts +86 -0
  62. package/src/quiet.ts +22 -0
  63. package/src/shipmates.ts +1634 -0
  64. package/src/store.ts +252 -0
  65. package/src/tail.ts +143 -0
  66. package/src/types.ts +138 -0
  67. package/src/watch.ts +32 -0
  68. package/README.md +0 -3
@@ -0,0 +1,75 @@
1
+ import { execFileSync } from 'node:child_process';
2
+ import fs from 'node:fs';
3
+ import os from 'node:os';
4
+ /**
5
+ * The same rule as wherever's assistant lock: a process is alive when its pid
6
+ * runs on this boot with the start time recorded. On another host we cannot
7
+ * know, so it counts as alive (single machine is the stated scope).
8
+ */
9
+ export class OsProbe {
10
+ host = os.hostname();
11
+ bootId = readBootId();
12
+ me;
13
+ self() {
14
+ this.me ??= {
15
+ pid: process.pid,
16
+ startTime: startTimeOf(process.pid),
17
+ bootId: this.bootId,
18
+ host: this.host,
19
+ };
20
+ return this.me;
21
+ }
22
+ isAlive(p) {
23
+ if (p.host !== this.host)
24
+ return true;
25
+ if (p.bootId && this.bootId && p.bootId !== this.bootId)
26
+ return false;
27
+ try {
28
+ process.kill(p.pid, 0);
29
+ }
30
+ catch (e) {
31
+ // EPERM means it exists but belongs to someone else.
32
+ if (e.code !== 'EPERM')
33
+ return false;
34
+ }
35
+ if (!p.startTime)
36
+ return true;
37
+ const now = startTimeOf(p.pid);
38
+ return now === null || now === p.startTime;
39
+ }
40
+ }
41
+ function readBootId() {
42
+ try {
43
+ return fs.readFileSync('/proc/sys/kernel/random/boot_id', 'utf8').trim();
44
+ }
45
+ catch { }
46
+ if (process.platform === 'darwin') {
47
+ try {
48
+ return execFileSync('sysctl', ['-n', 'kern.boottime'], {
49
+ encoding: 'utf8',
50
+ }).trim();
51
+ }
52
+ catch { }
53
+ }
54
+ return null;
55
+ }
56
+ function startTimeOf(pid) {
57
+ try {
58
+ const stat = fs.readFileSync(`/proc/${pid}/stat`, 'utf8');
59
+ // Field 22 (starttime) counts after the ")" that closes the command name,
60
+ // which may itself contain spaces or parentheses.
61
+ const rest = stat.slice(stat.lastIndexOf(')') + 2).split(' ');
62
+ return rest[19] ?? null;
63
+ }
64
+ catch { }
65
+ if (process.platform === 'darwin') {
66
+ try {
67
+ return (execFileSync('ps', ['-o', 'lstart=', '-p', String(pid)], {
68
+ encoding: 'utf8',
69
+ }).trim() || null);
70
+ }
71
+ catch { }
72
+ }
73
+ return null;
74
+ }
75
+ //# sourceMappingURL=liveness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"liveness.js","sourceRoot":"","sources":["../src/liveness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AAgBzB;;;;GAIG;AACH,MAAM,OAAO,OAAO;IACF,IAAI,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IACrB,MAAM,GAAG,UAAU,EAAE,CAAC;IAC/B,EAAE,CAA8B;IAExC,IAAI;QACH,IAAI,CAAC,EAAE,KAAK;YACX,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,SAAS,EAAE,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC;YACnC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;SACf,CAAC;QACF,OAAO,IAAI,CAAC,EAAE,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,C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AE,MAAM,CAAC,CAAC;QAC1D,0EAA0E;QAC1E,kDAAkD;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;IACV,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACnC,IAAI,CAAC;YACJ,OAAO,CACN,YAAY,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;gBACxD,QAAQ,EAAE,MAAM;aAChB,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,CACjB,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACX,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `node:sqlite` is still flagged experimental and prints a warning on first
3
+ * use. That is noise in a CLI the user runs fifty times a day, so it is
4
+ * silenced here and ONLY here, narrowly: any other warning still gets through.
5
+ */
6
+ export declare function silenceSqliteWarning(): void;
7
+ //# sourceMappingURL=quiet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quiet.d.ts","sourceRoot":"","sources":["../src/quiet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAgB3C"}
package/dist/quiet.js ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `node:sqlite` is still flagged experimental and prints a warning on first
3
+ * use. That is noise in a CLI the user runs fifty times a day, so it is
4
+ * silenced here and ONLY here, narrowly: any other warning still gets through.
5
+ */
6
+ export function silenceSqliteWarning() {
7
+ const proc = process;
8
+ const original = proc.emit.bind(process);
9
+ proc.emit = (name, ...args) => {
10
+ if (name === 'warning') {
11
+ const warning = args[0];
12
+ if (warning?.name === 'ExperimentalWarning' &&
13
+ /SQLite/i.test(warning.message ?? ''))
14
+ return false;
15
+ }
16
+ return original(name, ...args);
17
+ };
18
+ }
19
+ //# sourceMappingURL=quiet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quiet.js","sourceRoot":"","sources":["../src/quiet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IACnC,MAAM,IAAI,GAAG,OAEZ,CAAC;IACF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAY,EAAE,GAAG,IAAe,EAAW,EAAE;QACzD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAkD,CAAC;YACzE,IACC,OAAO,EAAE,IAAI,KAAK,qBAAqB;gBACvC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;gBAErC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,QAAQ,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IAChC,CAAC,CAAC;AACH,CAAC"}
@@ -0,0 +1,401 @@
1
+ import { type DB } from './store.js';
2
+ import { type ProcessIdentity, type ProcessProbe } from './liveness.js';
3
+ import { type ArchiveMark, type AttentionItem, type Message, type Ownership, type SpawnVia, type StopRequest, type Origin, type Presence, type Question, type Relay, type SessionState } from './types.js';
4
+ export interface ShipmatesOptions {
5
+ stateDir?: string;
6
+ probe?: ProcessProbe;
7
+ now?: () => number;
8
+ }
9
+ export interface RegisterInput {
10
+ sessionFile: string;
11
+ sessionId?: string | null;
12
+ cwd?: string | null;
13
+ branch?: string | null;
14
+ }
15
+ export interface PresencePatch {
16
+ state?: SessionState;
17
+ status?: string | null;
18
+ refs?: string[];
19
+ waitingOn?: string | null;
20
+ branch?: string | null;
21
+ cwd?: string | null;
22
+ wake?: boolean;
23
+ }
24
+ export interface ListFilter {
25
+ cwd?: string;
26
+ role?: string;
27
+ state?: SessionState;
28
+ includeGone?: boolean;
29
+ }
30
+ export declare const MAX_TEXT_BYTES: number;
31
+ /**
32
+ * D24: an archive or delete cascade can be undone, as one batch, for 7 days. A
33
+ * cascade from an orchestrator takes every lane with it, and an accidental one
34
+ * is often noticed only after a weekend; until the window ends a host must not
35
+ * remove a deleted session's transcript. Rejected: a seconds-long "undo" toast
36
+ * (a cascade is noticed later than that) and 24 hours (shorter than a weekend).
37
+ */
38
+ export declare const ARCHIVE_UNDO_MS: number;
39
+ export interface SpawnInput {
40
+ owner: string;
41
+ folder: string;
42
+ /** The first prompt: delivered once, as a `spawn` message from the owner (D28). */
43
+ prompt?: string | null;
44
+ role?: string | null;
45
+ via: SpawnVia;
46
+ detail?: Record<string, unknown>;
47
+ }
48
+ type OwnershipRow = {
49
+ id: string;
50
+ session_file: string | null;
51
+ owner: string;
52
+ folder: string;
53
+ role: string | null;
54
+ via: SpawnVia;
55
+ detail: string | null;
56
+ prompt: string | null;
57
+ created_at: number;
58
+ bound_at: number | null;
59
+ wake_until: number | null;
60
+ };
61
+ export interface SendInput {
62
+ /** The sending session, or null for a human at the CLI. */
63
+ from: string | null;
64
+ fromLabel?: string;
65
+ to: string;
66
+ text: string;
67
+ kind?: 'tell' | 'ask';
68
+ origin?: Origin;
69
+ relay?: Relay | null;
70
+ requestId?: string | null;
71
+ urgent?: boolean;
72
+ }
73
+ export interface SendResult {
74
+ message: Message;
75
+ question: Question | null;
76
+ duplicate: boolean;
77
+ /** The live session the message goes to, or null when nobody holds the role or the session is gone. */
78
+ target: Presence | null;
79
+ openQuestions: Question[];
80
+ }
81
+ export type WaitStatus = {
82
+ status: 'answered';
83
+ question: Question;
84
+ } | {
85
+ status: 'withdrawn';
86
+ question: Question;
87
+ } | {
88
+ status: 'asked';
89
+ question: Question;
90
+ questions: Question[];
91
+ } | {
92
+ status: 'settled';
93
+ question: Question;
94
+ target: Presence;
95
+ };
96
+ export type Resolved = {
97
+ kind: 'session' | 'role';
98
+ target: string;
99
+ session: string | null;
100
+ };
101
+ type MessageRow = {
102
+ id: string;
103
+ from_session: string | null;
104
+ from_label: string;
105
+ to_kind: 'session' | 'role';
106
+ to_target: string;
107
+ kind: Message['kind'];
108
+ question_id: string | null;
109
+ item_id: string | null;
110
+ text: string;
111
+ origin: Origin;
112
+ relay: string | null;
113
+ urgent: number;
114
+ state: Message['state'];
115
+ superseded_by: string | null;
116
+ delivered_to: string | null;
117
+ claim_pid: number | null;
118
+ claim_start: string | null;
119
+ claim_until: number | null;
120
+ created_at: number;
121
+ };
122
+ export declare class Shipmates {
123
+ readonly db: DB;
124
+ readonly probe: ProcessProbe;
125
+ readonly now: () => number;
126
+ private localWrites;
127
+ constructor(opts?: ShipmatesOptions);
128
+ close(): void;
129
+ /** Changes whenever any connection (this one included) committed a write. */
130
+ changeToken(): string;
131
+ protected tx<T>(fn: () => T): T;
132
+ register(input: RegisterInput): Presence;
133
+ update(sessionFile: string, patch: PresencePatch): void;
134
+ unregister(sessionFile: string): void;
135
+ presence(sessionFile: string): Presence | null;
136
+ isLive(sessionFile: string): boolean;
137
+ list(filter?: ListFilter): Presence[];
138
+ claimRole(sessionFile: string, role: string, opts?: {
139
+ takeover?: boolean;
140
+ }): {
141
+ ok: true;
142
+ previous: string | null;
143
+ } | {
144
+ ok: false;
145
+ holder: string;
146
+ };
147
+ releaseRole(sessionFile: string, role: string): void;
148
+ roleHolder(role: string): string | null;
149
+ /** D15: a `.jsonl` string is a session; else an exact role; else a unique session-id prefix. */
150
+ resolve(target: string): Resolved;
151
+ /**
152
+ * Send a message. The result carries the target's presence and open
153
+ * questions, so the sender sees what it is talking to (read before send).
154
+ * `requestId` makes a retried send a no-op (exactly once per sender).
155
+ */
156
+ send(input: SendInput): SendResult;
157
+ /**
158
+ * Claim this session's deliverable messages for this process. A message is
159
+ * claimed by one process at a time (the same session file can be open in two),
160
+ * and a claim lapses when its process dies or its lease expires.
161
+ */
162
+ claim(sessionFile: string, opts?: {
163
+ leaseMs?: number;
164
+ ids?: string[];
165
+ }): Message[];
166
+ /** Give claimed messages back (they were not injected after all). */
167
+ release(ids: string[]): void;
168
+ /** The messages are in the receiver's transcript now. Idempotent. */
169
+ markDelivered(sessionFile: string, ids: string[]): void;
170
+ supersede(from: string | null, id: string, text: string): Message;
171
+ withdraw(from: string | null, id: string): void;
172
+ private ownPending;
173
+ /**
174
+ * Claimed by a live process whose lease has not expired, THIS process
175
+ * included: a message this process is already delivering must not be handed
176
+ * out again (measured: re-claiming returned in-flight messages twice).
177
+ */
178
+ private isClaimed;
179
+ private pendingRows;
180
+ question(id: string): Question | null;
181
+ /** Open questions addressed to this session, directly or through a role it holds. */
182
+ openQuestionsTo(sessionFile: string): Question[];
183
+ /**
184
+ * Answer a question: the only way to close one (D12). The answer is sent back
185
+ * to the asker as a message. Only the session it was asked of answers it
186
+ * (for a role, its current holder); `from: null` is a human at the CLI.
187
+ */
188
+ answer(input: {
189
+ from: string | null;
190
+ questionId: string;
191
+ text: string;
192
+ origin?: Origin;
193
+ relay?: Relay | null;
194
+ }): Message;
195
+ /**
196
+ * What `session_wait` returns on (D12), or null to keep waiting: the answer;
197
+ * the target settling (idle or waiting for the human) after the wait began
198
+ * without answering; a new question addressed to the waiter (two sessions
199
+ * waiting on each other would otherwise deadlock until the timeout); or the
200
+ * question being withdrawn.
201
+ */
202
+ waitStatus(input: {
203
+ waiter: string;
204
+ questionId: string;
205
+ since: number;
206
+ }): WaitStatus | null;
207
+ /** Raise an attention item: a question for the human, in the one inbox (D13). */
208
+ humanAsk(input: {
209
+ from: string;
210
+ question: string;
211
+ options?: string[];
212
+ blocking?: boolean;
213
+ onBehalfOf?: string[];
214
+ }): AttentionItem;
215
+ item(id: string): AttentionItem | null;
216
+ /** Open items, oldest first; blocking ones first of all. */
217
+ inbox(): AttentionItem[];
218
+ /**
219
+ * The human answered an item. Callers must only call this for a real human act
220
+ * (a slash command, the CLI at a terminal, a host's authenticated UI): ADR 0003.
221
+ */
222
+ answerItem(itemId: string, text: string, opts: {
223
+ channel: string;
224
+ }): Message;
225
+ withdrawItem(from: string, itemId: string): void;
226
+ /** The human's answers to this session's items, newest first. */
227
+ humanAnswers(sessionFile: string): AttentionItem[];
228
+ /**
229
+ * Record a turn a human really typed into this session (ADR 0003): TUI input,
230
+ * or a host's `shipmates:human-input` mark. Never call this for agent text.
231
+ */
232
+ recordHumanTurn(sessionFile: string, input: {
233
+ text: string;
234
+ channel: string;
235
+ }): string;
236
+ /**
237
+ * Build the relay for a human-relayed message: the human's own words, found
238
+ * among this session's recent human turns (by a quote the agent gives, or the
239
+ * latest turn), or an answered inbox item of this session. An agent can carry
240
+ * a human's words; it cannot make them up.
241
+ */
242
+ relayFromHuman(sessionFile: string, ref: {
243
+ quote?: string;
244
+ itemId?: string;
245
+ }): Relay;
246
+ /** Open questions this session asked. */
247
+ openQuestionsFrom(sessionFile: string): Question[];
248
+ /** Messages this session may receive now: to it, or to a role it holds. */
249
+ pendingFor(sessionFile: string): Message[];
250
+ message(id: string): Message | null;
251
+ protected insertMessage(m: {
252
+ from: string | null;
253
+ fromLabel: string;
254
+ to: {
255
+ kind: 'session' | 'role';
256
+ target: string;
257
+ };
258
+ kind: Message['kind'];
259
+ text: string;
260
+ origin: Origin;
261
+ relay?: Relay | null;
262
+ questionId?: string | null;
263
+ itemId?: string | null;
264
+ requestId?: string | null;
265
+ urgent?: boolean;
266
+ }): string;
267
+ /** How a sender is named to receivers: its roles if it has any, else its file. */
268
+ labelOf(sessionFile: string | null): string;
269
+ protected toMessage(r: MessageRow): Message;
270
+ /**
271
+ * Start a spawn: the ownership record exists before the new session does, so
272
+ * a terminal child can bind itself at its own `session_start` (D28). The owner
273
+ * is fixed here and never changes.
274
+ */
275
+ beginSpawn(input: SpawnInput): Ownership;
276
+ /**
277
+ * The spawned session exists: bind it to its spawn, once, and queue its first
278
+ * prompt as a `spawn` message from the owner, origin agent (never a human
279
+ * turn, D28). Binding the same session again is a no-op; a session that is
280
+ * already owned, or a spawn bound to another session, is refused: ownership
281
+ * never changes.
282
+ */
283
+ bindSpawn(spawnId: string, sessionFile: string): Ownership;
284
+ /** Record that `owner` owns an existing session (a host that spawned it by its own means). */
285
+ recordOwnership(input: SpawnInput & {
286
+ session: string;
287
+ }): Ownership;
288
+ spawnRecord(spawnId: string): Ownership | null;
289
+ /** The ownership record of a session, or null when nobody spawned it. */
290
+ ownership(sessionFile: string): Ownership | null;
291
+ ownerOf(sessionFile: string): string | null;
292
+ /**
293
+ * The sessions `owner` spawned, live or not, oldest first; with `transitive`,
294
+ * their own children too (depth first). Spawns that never came up are left out.
295
+ */
296
+ ownedBy(owner: string, opts?: {
297
+ transitive?: boolean;
298
+ }): Ownership[];
299
+ /**
300
+ * Whether `caller` owns `target`, directly or through the sessions it owns
301
+ * (D23): an orchestrator answers for its children's children too.
302
+ */
303
+ owns(caller: string, target: string): boolean;
304
+ /** The owner, the owner's owner, and so on up. */
305
+ private ancestors;
306
+ /**
307
+ * A host archives or deletes a session: mark it and every session it owns,
308
+ * transitively, as one batch (D24). shipmates cannot touch transcripts; the host
309
+ * hides or deletes them, and must keep a deleted one until `undoUntil`.
310
+ * Sessions already archived keep their own batch.
311
+ */
312
+ archive(sessionFile: string, opts: {
313
+ kind: ArchiveMark['kind'];
314
+ by: string;
315
+ }): {
316
+ batch: string;
317
+ at: number;
318
+ undoUntil: number;
319
+ sessions: string[];
320
+ };
321
+ /** Undo a whole archive batch within its window; returns the sessions restored. */
322
+ undoArchive(batch: string): string[];
323
+ archiveMark(sessionFile: string): ArchiveMark | null;
324
+ /** Marks whose undo window has passed: a host may now make them permanent. */
325
+ expiredArchives(): ArchiveMark[];
326
+ /**
327
+ * D29: the headless children of `owner` that have messages to read which
328
+ * arrived after their last stop, and are not archived. One cached query,
329
+ * since every session's poller asks on every change. Measured: 3 µs for a
330
+ * session that owns nothing, 42 µs with 5 children and one to wake, against
331
+ * about 500 µs as separate reads per child. Liveness is left to the caller:
332
+ * it is a process probe, not SQL.
333
+ */
334
+ wakeCandidates(owner: string): Ownership[];
335
+ /**
336
+ * Prepared once per connection, for the queries the poller runs on every
337
+ * change: compiling a statement is most of the cost of a small query.
338
+ */
339
+ private statements;
340
+ private cached;
341
+ /**
342
+ * A headless child is being woken (D29): granted to exactly one caller until
343
+ * the lease lapses, so two polls or two processes never start it twice. A
344
+ * refusal says when the current lease ends, so the caller can look again then.
345
+ */
346
+ leaseWake(sessionFile: string, ms: number): {
347
+ ok: true;
348
+ } | {
349
+ ok: false;
350
+ until: number | null;
351
+ };
352
+ /**
353
+ * The woken child is up: shorten its lease to `gapMs` from now. Once it has
354
+ * exited, the next wake may come after that gap, not before: a child that
355
+ * dies before reading its messages is retried at that pace, never in a loop.
356
+ */
357
+ wakeDone(sessionFile: string, gapMs: number): void;
358
+ protected toOwnership(r: OwnershipRow): Ownership;
359
+ /**
360
+ * Ask a session to stop its current turn (D30). Its own extension acts on it
361
+ * at the next poll and records the outcome; it never cascades. Authorisation
362
+ * is the caller's job: the tool checks `owns`, the CLI that a human runs it.
363
+ */
364
+ requestStop(sessionFile: string, opts: {
365
+ by: string | null;
366
+ }): StopRequest;
367
+ stopRequest(id: string): StopRequest | null;
368
+ /** Stop requests this session has not acted on yet, oldest first. A read: no lock. */
369
+ openStops(sessionFile: string): StopRequest[];
370
+ settleStop(id: string, outcome: 'stopped' | 'not-running'): void;
371
+ /** When this session was last asked to stop, or null. */
372
+ lastStopAt(sessionFile: string): number | null;
373
+ /**
374
+ * D11: finished messages, questions and items go after 30 days (the receiver's
375
+ * transcript keeps every delivered message for good); presence of a dead process
376
+ * after a day. Pending messages and open questions are never pruned by age.
377
+ */
378
+ prune(): void;
379
+ /**
380
+ * D25: ownership is never pruned while its session exists. A spawn that never
381
+ * came up goes after a day. A bound record goes only when its transcript file
382
+ * is gone, nobody runs it, and it is over 30 days old (pi writes a transcript
383
+ * only after the first assistant message, so a missing file alone proves
384
+ * nothing about a fresh session). An archive mark goes with its transcript,
385
+ * once the undo window has passed. Called inside prune's transaction.
386
+ */
387
+ private pruneOwnership;
388
+ /** Prune when the last prune is a day old. Cheap enough to call on every open. */
389
+ pruneIfDue(): boolean;
390
+ protected identityOf(row: {
391
+ pid: number;
392
+ start_time: string | null;
393
+ boot_id: string | null;
394
+ host: string | null;
395
+ }): ProcessIdentity;
396
+ protected rolesOf(sessionFile: string): string[];
397
+ private toPresence;
398
+ }
399
+ export declare function openShipmates(opts?: ShipmatesOptions): Shipmates;
400
+ export {};
401
+ //# sourceMappingURL=shipmates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shipmates.d.ts","sourceRoot":"","sources":["../src/shipmates.ts"],"names":[],"mappings":"AACA,OAAO,EAAiC,KAAK,EAAE,EAAC,MAAM,YAAY,CAAC;AACnE,OAAO,EAAU,KAAK,eAAe,EAAE,KAAK,YAAY,EAAC,MAAM,eAAe,CAAC;AAC/E,OAAO,EAEN,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC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