@relaymessenger/cli 0.3.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.
- package/LICENSE +21 -0
- package/README.md +139 -0
- package/claude-plugin/marketplace/.claude-plugin/marketplace.json +14 -0
- package/claude-plugin/marketplace/plugins/relay/.claude-plugin/plugin.json +18 -0
- package/claude-plugin/marketplace/plugins/relay/LICENSE +21 -0
- package/claude-plugin/marketplace/plugins/relay/README.md +173 -0
- package/claude-plugin/marketplace/plugins/relay/commands/configure.md +71 -0
- package/claude-plugin/marketplace/plugins/relay/runtime/server.mjs +26107 -0
- package/dist/api.d.ts +74 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +129 -0
- package/dist/api.js.map +1 -0
- package/dist/claude-settings.d.ts +14 -0
- package/dist/claude-settings.d.ts.map +1 -0
- package/dist/claude-settings.js +47 -0
- package/dist/claude-settings.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +162 -0
- package/dist/cli.js.map +1 -0
- package/dist/codex.d.ts +25 -0
- package/dist/codex.d.ts.map +1 -0
- package/dist/codex.js +227 -0
- package/dist/codex.js.map +1 -0
- package/dist/doctor.d.ts +2 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +122 -0
- package/dist/doctor.js.map +1 -0
- package/dist/engine/acp.d.ts +69 -0
- package/dist/engine/acp.d.ts.map +1 -0
- package/dist/engine/acp.js +402 -0
- package/dist/engine/acp.js.map +1 -0
- package/dist/engine/catalog.d.ts +26 -0
- package/dist/engine/catalog.d.ts.map +1 -0
- package/dist/engine/catalog.js +41 -0
- package/dist/engine/catalog.js.map +1 -0
- package/dist/engine/process.d.ts +12 -0
- package/dist/engine/process.d.ts.map +1 -0
- package/dist/engine/process.js +54 -0
- package/dist/engine/process.js.map +1 -0
- package/dist/engine/types.d.ts +57 -0
- package/dist/engine/types.d.ts.map +1 -0
- package/dist/engine/types.js +8 -0
- package/dist/engine/types.js.map +1 -0
- package/dist/flags.d.ts +9 -0
- package/dist/flags.d.ts.map +1 -0
- package/dist/flags.js +34 -0
- package/dist/flags.js.map +1 -0
- package/dist/install.d.ts +69 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +510 -0
- package/dist/install.js.map +1 -0
- package/dist/mcp.d.ts +16 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +127 -0
- package/dist/mcp.js.map +1 -0
- package/dist/pair.d.ts +20 -0
- package/dist/pair.d.ts.map +1 -0
- package/dist/pair.js +135 -0
- package/dist/pair.js.map +1 -0
- package/dist/permissions.d.ts +87 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +342 -0
- package/dist/permissions.js.map +1 -0
- package/dist/receive.d.ts +54 -0
- package/dist/receive.d.ts.map +1 -0
- package/dist/receive.js +353 -0
- package/dist/receive.js.map +1 -0
- package/dist/store.d.ts +260 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +550 -0
- package/dist/store.js.map +1 -0
- package/openclaw-plugin/relaymessenger-openclaw-plugin-0.1.0.tgz +0 -0
- package/package.json +51 -0
package/dist/receive.js
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Receive loop: long-poll GET /v1/events → durable queue → engine turn →
|
|
3
|
+
* one finalized POST /v1/messages per turn.
|
|
4
|
+
*
|
|
5
|
+
* Reliability contract:
|
|
6
|
+
* - Durable-before-ack: inbound events are appended to state.json's
|
|
7
|
+
* pending_events queue in the SAME atomic write that advances the cursor,
|
|
8
|
+
* so an acked event is always durable and a crash replays, never drops.
|
|
9
|
+
* - Dedupe: delivery is at-least-once; event_id is checked against a
|
|
10
|
+
* persisted seen-set before enqueueing.
|
|
11
|
+
* - Debounce: rapid messages in one conversation coalesce for ~800 ms into a
|
|
12
|
+
* single engine turn.
|
|
13
|
+
* - Supervisor: poll/turn failures restart with exponential backoff + jitter.
|
|
14
|
+
*/
|
|
15
|
+
import { createHash } from "node:crypto";
|
|
16
|
+
export function turnIdempotencyKey(conversationId, eventIds) {
|
|
17
|
+
const digest = createHash("sha256")
|
|
18
|
+
.update(JSON.stringify([conversationId, eventIds]))
|
|
19
|
+
.digest("hex");
|
|
20
|
+
return `relay-turn-${digest.slice(0, 40)}`;
|
|
21
|
+
}
|
|
22
|
+
export function promptTextFromMessages(messages) {
|
|
23
|
+
const chunks = [];
|
|
24
|
+
for (const message of messages) {
|
|
25
|
+
const text = message.parts
|
|
26
|
+
.filter((part) => part.type === "text" && typeof part.text === "string")
|
|
27
|
+
.map((part) => part.text)
|
|
28
|
+
.join("\n")
|
|
29
|
+
.trim();
|
|
30
|
+
chunks.push(text.length > 0 ? text : message.fallback_text);
|
|
31
|
+
}
|
|
32
|
+
return chunks.filter((chunk) => chunk && chunk.length > 0).join("\n\n");
|
|
33
|
+
}
|
|
34
|
+
export class ReceiveLoop {
|
|
35
|
+
client;
|
|
36
|
+
state;
|
|
37
|
+
engine;
|
|
38
|
+
broker;
|
|
39
|
+
ownerUserId;
|
|
40
|
+
debounceMs;
|
|
41
|
+
cwd;
|
|
42
|
+
log;
|
|
43
|
+
setTimeoutImpl;
|
|
44
|
+
debounceTimers = new Map();
|
|
45
|
+
/** Serializes turns per conversation. */
|
|
46
|
+
turnChains = new Map();
|
|
47
|
+
stopped = false;
|
|
48
|
+
constructor(client, state, engine, broker, options) {
|
|
49
|
+
this.client = client;
|
|
50
|
+
this.state = state;
|
|
51
|
+
this.engine = engine;
|
|
52
|
+
this.broker = broker;
|
|
53
|
+
this.ownerUserId = options.ownerUserId;
|
|
54
|
+
this.debounceMs = options.debounceMs ?? 800;
|
|
55
|
+
this.cwd = options.cwd ?? process.cwd();
|
|
56
|
+
this.log = options.log ?? (() => { });
|
|
57
|
+
this.setTimeoutImpl = options.setTimeoutImpl ?? setTimeout;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* One poll cycle: fetch, dedupe, durably enqueue + ack, schedule flushes.
|
|
61
|
+
* Exposed for tests; `run()` supervises it forever.
|
|
62
|
+
*/
|
|
63
|
+
async pollOnce(timeoutS = 25) {
|
|
64
|
+
const page = await this.client.getEvents(this.state.current.cursor, timeoutS);
|
|
65
|
+
const touched = new Set();
|
|
66
|
+
let accepted = 0;
|
|
67
|
+
for (const event of page.events ?? []) {
|
|
68
|
+
if (!event.event_id || this.state.hasSeen(event.event_id))
|
|
69
|
+
continue;
|
|
70
|
+
this.state.markSeen(event.event_id);
|
|
71
|
+
const routed = this.routeEvent(event);
|
|
72
|
+
if (routed) {
|
|
73
|
+
touched.add(routed);
|
|
74
|
+
accepted += 1;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Durable-before-ack: queue mutation and cursor advance are one atomic write.
|
|
78
|
+
if (typeof page.next_cursor === "number") {
|
|
79
|
+
this.state.current.cursor = page.next_cursor;
|
|
80
|
+
}
|
|
81
|
+
this.state.persist();
|
|
82
|
+
for (const conversationId of touched)
|
|
83
|
+
this.scheduleFlush(conversationId);
|
|
84
|
+
return accepted;
|
|
85
|
+
}
|
|
86
|
+
/** Returns the conversation id when the event was enqueued for the engine. */
|
|
87
|
+
routeEvent(event) {
|
|
88
|
+
if (event.event_type !== "message.received")
|
|
89
|
+
return undefined;
|
|
90
|
+
const message = event.data?.message;
|
|
91
|
+
if (!message || message.sender?.kind !== "user")
|
|
92
|
+
return undefined;
|
|
93
|
+
// Owner gate before any content is interpreted: non-owner senders can
|
|
94
|
+
// neither prompt the engine nor answer a permission card.
|
|
95
|
+
if (message.sender.id !== this.ownerUserId) {
|
|
96
|
+
this.log(`ignoring message from non-owner sender ${message.sender.id}`);
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
// First owner message pins the default notify/MCP conversation.
|
|
100
|
+
this.state.current.owner_conversation_id ??= message.conversation_id;
|
|
101
|
+
if (this.broker.consumeReply(message))
|
|
102
|
+
return undefined;
|
|
103
|
+
const queue = (this.state.current.pending_events[message.conversation_id] ??= []);
|
|
104
|
+
queue.push(event);
|
|
105
|
+
return message.conversation_id;
|
|
106
|
+
}
|
|
107
|
+
scheduleFlush(conversationId) {
|
|
108
|
+
if (this.stopped)
|
|
109
|
+
return;
|
|
110
|
+
const existing = this.debounceTimers.get(conversationId);
|
|
111
|
+
if (existing)
|
|
112
|
+
clearTimeout(existing);
|
|
113
|
+
const timer = this.setTimeoutImpl(() => {
|
|
114
|
+
this.debounceTimers.delete(conversationId);
|
|
115
|
+
this.chainTurn(conversationId);
|
|
116
|
+
}, this.debounceMs);
|
|
117
|
+
timer.unref?.();
|
|
118
|
+
this.debounceTimers.set(conversationId, timer);
|
|
119
|
+
}
|
|
120
|
+
chainTurn(conversationId) {
|
|
121
|
+
const previous = this.turnChains.get(conversationId) ?? Promise.resolve();
|
|
122
|
+
const next = previous
|
|
123
|
+
.then(() => this.runTurn(conversationId))
|
|
124
|
+
.catch((error) => {
|
|
125
|
+
this.log(`turn failed for ${conversationId}: ${error}`);
|
|
126
|
+
});
|
|
127
|
+
this.turnChains.set(conversationId, next);
|
|
128
|
+
void next.finally(() => {
|
|
129
|
+
if (this.turnChains.get(conversationId) === next)
|
|
130
|
+
this.turnChains.delete(conversationId);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/** Waits for in-flight turns (tests + graceful shutdown). */
|
|
134
|
+
async settle() {
|
|
135
|
+
await Promise.allSettled([...this.turnChains.values()]);
|
|
136
|
+
}
|
|
137
|
+
/** Removes THIS turn's consumed events (and its attempt marker) durably. */
|
|
138
|
+
clearBatch(conversationId, events, turnKey) {
|
|
139
|
+
const queue = this.state.current.pending_events[conversationId] ?? [];
|
|
140
|
+
const remaining = queue.filter((event) => !events.some((consumed) => consumed.event_id === event.event_id));
|
|
141
|
+
if (remaining.length === 0) {
|
|
142
|
+
delete this.state.current.pending_events[conversationId];
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
this.state.current.pending_events[conversationId] = remaining;
|
|
146
|
+
// New messages arrived mid-turn; run again.
|
|
147
|
+
this.scheduleFlush(conversationId);
|
|
148
|
+
}
|
|
149
|
+
const attempted = (this.state.current.attempted_turns ??= {})[conversationId];
|
|
150
|
+
if (attempted && (!turnKey || attempted.turn_key === turnKey)) {
|
|
151
|
+
delete this.state.current.attempted_turns[conversationId];
|
|
152
|
+
}
|
|
153
|
+
if (turnKey)
|
|
154
|
+
delete (this.state.current.pending_replies ??= {})[turnKey];
|
|
155
|
+
this.state.persist();
|
|
156
|
+
}
|
|
157
|
+
async postNotice(conversationId, text, key) {
|
|
158
|
+
try {
|
|
159
|
+
await this.client.postMessage({ conversation_id: conversationId, parts: [{ type: "text", text }] }, key);
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
this.log(`notice post failed for ${conversationId}: ${error}`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
pendingReplyForConversation(conversationId) {
|
|
166
|
+
return Object.entries(this.state.current.pending_replies ?? {}).find(([, reply]) => reply.conversation_id === conversationId);
|
|
167
|
+
}
|
|
168
|
+
/** Idempotently deliver an engine-completed reply without rerunning tools. */
|
|
169
|
+
async deliverPendingReply(turnKey, reply) {
|
|
170
|
+
let lastError;
|
|
171
|
+
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
172
|
+
try {
|
|
173
|
+
await this.client.postMessage({ conversation_id: reply.conversation_id, parts: [{ type: "text", text: reply.text }] }, turnKey);
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
lastError = error;
|
|
178
|
+
if (attempt < 2) {
|
|
179
|
+
await new Promise((resolve) => this.setTimeoutImpl(resolve, 1_000 * (attempt + 1)));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
this.log(`final reply post failed for ${reply.conversation_id}: ${lastError}`);
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
async runTurn(conversationId) {
|
|
187
|
+
// Delivery is its own durable phase. Finish an older reply before looking
|
|
188
|
+
// at newer queued prompts, otherwise appending a message after an unknown
|
|
189
|
+
// POST outcome could cause the older tool turn to execute again.
|
|
190
|
+
const queuedReply = this.pendingReplyForConversation(conversationId);
|
|
191
|
+
if (queuedReply) {
|
|
192
|
+
const [turnKey, reply] = queuedReply;
|
|
193
|
+
const queuedEvents = this.state.current.pending_events[conversationId] ?? [];
|
|
194
|
+
const consumed = queuedEvents.filter((event) => reply.event_ids.includes(event.event_id));
|
|
195
|
+
if (await this.deliverPendingReply(turnKey, reply)) {
|
|
196
|
+
this.clearBatch(conversationId, consumed, turnKey);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
this.scheduleFlush(conversationId);
|
|
200
|
+
}
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
// Recover the exact prefix a previous invocation durably claimed before
|
|
204
|
+
// it disappeared. Later events may already be queued; they must survive
|
|
205
|
+
// and run separately, while the attempted prefix is never re-executed.
|
|
206
|
+
const attempted = (this.state.current.attempted_turns ??= {})[conversationId];
|
|
207
|
+
if (attempted) {
|
|
208
|
+
const queue = this.state.current.pending_events[conversationId] ?? [];
|
|
209
|
+
const prefix = queue.slice(0, attempted.event_ids.length);
|
|
210
|
+
if (prefix.length !== attempted.event_ids.length ||
|
|
211
|
+
prefix.some((event, index) => event.event_id !== attempted.event_ids[index])) {
|
|
212
|
+
throw new Error(`attempt ledger mismatch for ${conversationId}; refusing to execute queued events`);
|
|
213
|
+
}
|
|
214
|
+
this.log(`turn ${attempted.turn_key} was interrupted — dropping its ${prefix.length}-event prefix, not re-executing`);
|
|
215
|
+
this.clearBatch(conversationId, prefix, attempted.turn_key);
|
|
216
|
+
await this.postNotice(conversationId, "The bridge restarted while working on your last message, so it was not retried " +
|
|
217
|
+
"automatically (its tools may have partially run). Send it again to retry.", `${attempted.turn_key}-crashed`);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
// Snapshot: routeEvent keeps appending to the live queue while the turn
|
|
221
|
+
// runs, and the post-turn filter must only remove what THIS turn consumed.
|
|
222
|
+
const events = [...(this.state.current.pending_events[conversationId] ?? [])];
|
|
223
|
+
if (events.length === 0)
|
|
224
|
+
return;
|
|
225
|
+
const messages = events
|
|
226
|
+
.map((event) => event.data?.message)
|
|
227
|
+
.filter((message) => message !== undefined);
|
|
228
|
+
const promptText = promptTextFromMessages(messages);
|
|
229
|
+
if (promptText.length === 0) {
|
|
230
|
+
// Nothing promptable; drop the batch durably.
|
|
231
|
+
delete this.state.current.pending_events[conversationId];
|
|
232
|
+
this.state.persist();
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
// Crash semantics: engine/tool side effects are at-most-once per batch.
|
|
236
|
+
// The exact event-id batch is persisted BEFORE the engine starts. A later
|
|
237
|
+
// message cannot change or overwrite which prefix was already attempted.
|
|
238
|
+
const eventIds = events.map((event) => event.event_id);
|
|
239
|
+
const turnKey = turnIdempotencyKey(conversationId, eventIds);
|
|
240
|
+
(this.state.current.attempted_turns ??= {})[conversationId] = {
|
|
241
|
+
turn_key: turnKey,
|
|
242
|
+
event_ids: eventIds,
|
|
243
|
+
started_at: new Date().toISOString(),
|
|
244
|
+
};
|
|
245
|
+
this.state.persist();
|
|
246
|
+
const typing = this.startTyping(conversationId);
|
|
247
|
+
try {
|
|
248
|
+
let result;
|
|
249
|
+
try {
|
|
250
|
+
result = await this.engine.startTurn({ conversationId, cwd: this.cwd }, promptText, {
|
|
251
|
+
onToolEvent: (event) => typing.setLabel(event.title ?? "Working…"),
|
|
252
|
+
onPermissionAsk: (ask) => this.broker.ask(conversationId, ask, this.engine.engine),
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
// A failed engine turn is not silently retried (its side effects may
|
|
257
|
+
// have partially run) and must not strand the queue: tell the owner
|
|
258
|
+
// and clear the batch so the conversation stays usable.
|
|
259
|
+
this.log(`engine turn failed for ${conversationId}: ${error}`);
|
|
260
|
+
this.clearBatch(conversationId, events, turnKey);
|
|
261
|
+
await this.postNotice(conversationId, `The ${this.engine.engine} turn failed: ${String(error instanceof Error ? error.message : error).slice(0, 300)}\n` +
|
|
262
|
+
"Send your message again to retry.", `${turnKey}-failed`);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const text = result.text.trim().length > 0
|
|
266
|
+
? result.text.trim()
|
|
267
|
+
: `(turn finished: ${result.stopReason})`;
|
|
268
|
+
// Persist the completed output BEFORE delivery. Any crash from here on
|
|
269
|
+
// can retry this idempotent POST without rerunning the engine or tools.
|
|
270
|
+
const pendingReply = {
|
|
271
|
+
conversation_id: conversationId,
|
|
272
|
+
event_ids: events.map((event) => event.event_id),
|
|
273
|
+
text,
|
|
274
|
+
created_at: new Date().toISOString(),
|
|
275
|
+
};
|
|
276
|
+
(this.state.current.pending_replies ??= {})[turnKey] = pendingReply;
|
|
277
|
+
this.state.persist();
|
|
278
|
+
if (await this.deliverPendingReply(turnKey, pendingReply)) {
|
|
279
|
+
this.clearBatch(conversationId, events, turnKey);
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
// Keep the queue, attempt marker and completed reply. The scheduled
|
|
283
|
+
// retry enters the delivery-only path above.
|
|
284
|
+
this.scheduleFlush(conversationId);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
finally {
|
|
288
|
+
await typing.stop();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
startTyping(conversationId) {
|
|
292
|
+
let label;
|
|
293
|
+
let active = true;
|
|
294
|
+
const push = () => {
|
|
295
|
+
if (!active)
|
|
296
|
+
return;
|
|
297
|
+
this.client.setTyping(conversationId, true, label).catch(() => { });
|
|
298
|
+
};
|
|
299
|
+
push();
|
|
300
|
+
const interval = setInterval(push, 20_000);
|
|
301
|
+
interval.unref?.();
|
|
302
|
+
return {
|
|
303
|
+
setLabel: (next) => {
|
|
304
|
+
label = next.slice(0, 80);
|
|
305
|
+
push();
|
|
306
|
+
},
|
|
307
|
+
stop: async () => {
|
|
308
|
+
active = false;
|
|
309
|
+
clearInterval(interval);
|
|
310
|
+
await this.client.setTyping(conversationId, false).catch(() => { });
|
|
311
|
+
},
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
stop() {
|
|
315
|
+
this.stopped = true;
|
|
316
|
+
for (const timer of this.debounceTimers.values())
|
|
317
|
+
clearTimeout(timer);
|
|
318
|
+
this.debounceTimers.clear();
|
|
319
|
+
}
|
|
320
|
+
/** Supervisor: restart the poll loop on failure with capped backoff + jitter. */
|
|
321
|
+
async run() {
|
|
322
|
+
let failures = 0;
|
|
323
|
+
// Replay anything a previous process left behind.
|
|
324
|
+
this.broker.sweep();
|
|
325
|
+
for (const conversationId of Object.keys(this.state.current.pending_events)) {
|
|
326
|
+
this.scheduleFlush(conversationId);
|
|
327
|
+
}
|
|
328
|
+
while (!this.stopped) {
|
|
329
|
+
try {
|
|
330
|
+
this.broker.sweep();
|
|
331
|
+
await this.pollOnce();
|
|
332
|
+
failures = 0;
|
|
333
|
+
}
|
|
334
|
+
catch (error) {
|
|
335
|
+
if (error?.status === 409) {
|
|
336
|
+
// Another consumer (webhook or second long-poll) owns this token.
|
|
337
|
+
this.log(`fatal: ${error.message}`);
|
|
338
|
+
throw error;
|
|
339
|
+
}
|
|
340
|
+
if (error?.status === 401) {
|
|
341
|
+
this.log("fatal: agent token rejected (401) — run `relaymessenger pair` again.");
|
|
342
|
+
throw error;
|
|
343
|
+
}
|
|
344
|
+
failures += 1;
|
|
345
|
+
const base = Math.min(500 * 2 ** Math.min(failures, 6), 30_000);
|
|
346
|
+
const jitter = base * (0.7 + Math.random() * 0.6);
|
|
347
|
+
this.log(`poll failed (attempt ${failures}), retrying in ${Math.round(jitter)}ms: ${error}`);
|
|
348
|
+
await new Promise((resolve) => this.setTimeoutImpl(resolve, jitter));
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
//# sourceMappingURL=receive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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kE;oBAClE,IAAI,CAAC,GAAG,CAAC,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;oBACpC,MAAM,KAAK,CAAC;gBACd,CAAC;gBACD,IAAI,KAAK,EAAE,MAAM,KAAK,GAAG,EAAE,CAAC;oBAC1B,IAAI,CAAC,GAAG,CAAC,sEAAsE,CAAC,CAAC;oBACjF,MAAM,KAAK,CAAC;gBACd,CAAC;gBACD,QAAQ,IAAI,CAAC,CAAC;gBACd,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;gBAChE,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC;gBAClD,IAAI,CAAC,GAAG,CAAC,wBAAwB,QAAQ,kBAAkB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC;gBAC7F,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
package/dist/store.d.ts
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable local state for the relaymessenger bridge.
|
|
3
|
+
*
|
|
4
|
+
* Everything lives under ~/.relaymessenger (override with RELAYMESSENGER_HOME):
|
|
5
|
+
* config.json — active agent token, API origin, owner_user_id (chmod 600)
|
|
6
|
+
* accounts/<origin-agent-hash>/state.json — receive cursor, dedupe set,
|
|
7
|
+
* pending events. EXCLUSIVELY
|
|
8
|
+
* owned (written) by the `start` loop process; other
|
|
9
|
+
* entrypoints (codex hook, notify, mcp) may only read it
|
|
10
|
+
* via readStateSnapshot().
|
|
11
|
+
* accounts/<hash>/approvals/<request_id>.json — pending approval (create-once
|
|
12
|
+
* by whoever arms it, resolution written by the loop,
|
|
13
|
+
* consumed+unlinked by the waiter). No read-modify-write
|
|
14
|
+
* of shared snapshots across processes.
|
|
15
|
+
* accounts/<hash>/sessions.json — conversation_id → engine session binding
|
|
16
|
+
*
|
|
17
|
+
* Writes are atomic: content is fsync'd to a tmp file, then renamed into
|
|
18
|
+
* place, so a crash can never leave a half-written file. Cursor + pending
|
|
19
|
+
* queue share one file, so the durable-before-ack invariant holds with a
|
|
20
|
+
* single atomic write.
|
|
21
|
+
*/
|
|
22
|
+
import { renameSync } from "node:fs";
|
|
23
|
+
export declare function relaymessengerHome(): string;
|
|
24
|
+
export interface RelayConfig {
|
|
25
|
+
api_origin: string;
|
|
26
|
+
agent_token: string;
|
|
27
|
+
/**
|
|
28
|
+
* The Relay user id allowed to drive this bridge. Pinned at pair time from
|
|
29
|
+
* GET /v1/agents/me; overridable with RELAY_OWNER_USER_ID. Everything the
|
|
30
|
+
* bridge does — prompts, approvals, notify targets — is gated on it.
|
|
31
|
+
*/
|
|
32
|
+
owner_user_id?: string;
|
|
33
|
+
agent?: {
|
|
34
|
+
id?: string;
|
|
35
|
+
handle?: string;
|
|
36
|
+
display_name?: string;
|
|
37
|
+
};
|
|
38
|
+
paired_at?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Stable, non-secret identity label used inside account-scoped ledgers. */
|
|
41
|
+
export declare function relayIdentityForConfig(config: Pick<RelayConfig, "agent_token" | "agent">): string;
|
|
42
|
+
/**
|
|
43
|
+
* Durable bridge state is scoped to one authenticated Relay identity. The
|
|
44
|
+
* agent id is preferred; a token fingerprint is the fail-safe fallback for
|
|
45
|
+
* legacy servers that do not expose it. Raw tokens/origins never enter paths.
|
|
46
|
+
*/
|
|
47
|
+
export declare function runtimeHomeForConfig(config: Pick<RelayConfig, "api_origin" | "agent_token" | "agent">, baseHome?: string): string;
|
|
48
|
+
export declare function activeRuntimeHome(baseHome?: string): string;
|
|
49
|
+
/** Resolve the pinned owner, failing closed when it is missing. */
|
|
50
|
+
export declare function resolveOwnerUserId(config: RelayConfig | undefined): string;
|
|
51
|
+
export interface PendingApproval {
|
|
52
|
+
request_id: string;
|
|
53
|
+
conversation_id: string;
|
|
54
|
+
engine?: string;
|
|
55
|
+
tool_name?: string;
|
|
56
|
+
created_at: string;
|
|
57
|
+
/** ISO time after which the approval is denied. */
|
|
58
|
+
deadline_at: string;
|
|
59
|
+
/** Relay message id of the card, for reply_to matching. */
|
|
60
|
+
relay_message_id?: string;
|
|
61
|
+
options: Array<{
|
|
62
|
+
option_id: string;
|
|
63
|
+
label: string;
|
|
64
|
+
kind?: string;
|
|
65
|
+
}>;
|
|
66
|
+
source: "acp" | "hook";
|
|
67
|
+
resolution?: {
|
|
68
|
+
option_id?: string;
|
|
69
|
+
behavior: "allow" | "deny" | "cancelled";
|
|
70
|
+
decided_at: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export interface RelayEvent {
|
|
74
|
+
event_id: string;
|
|
75
|
+
event_type: string;
|
|
76
|
+
agent_id?: string;
|
|
77
|
+
created_at?: string;
|
|
78
|
+
data?: {
|
|
79
|
+
message?: RelayMessage;
|
|
80
|
+
[key: string]: unknown;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export interface RelayMessage {
|
|
84
|
+
id: string;
|
|
85
|
+
conversation_id: string;
|
|
86
|
+
sequence: number;
|
|
87
|
+
sender: {
|
|
88
|
+
kind: "user" | "agent";
|
|
89
|
+
id: string;
|
|
90
|
+
};
|
|
91
|
+
parts: Array<{
|
|
92
|
+
type: string;
|
|
93
|
+
text?: string;
|
|
94
|
+
[key: string]: unknown;
|
|
95
|
+
}>;
|
|
96
|
+
fallback_text: string;
|
|
97
|
+
reply_to?: {
|
|
98
|
+
message_id?: string;
|
|
99
|
+
part_index?: number;
|
|
100
|
+
} | null;
|
|
101
|
+
created_at?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface BridgeState {
|
|
104
|
+
cursor: number;
|
|
105
|
+
seen_event_ids: string[];
|
|
106
|
+
pending_events: Record<string, RelayEvent[]>;
|
|
107
|
+
/**
|
|
108
|
+
* conversation_id → turn idempotency key persisted immediately BEFORE the
|
|
109
|
+
* engine turn starts and cleared on success. A marker found at startup means
|
|
110
|
+
* a previous process crashed mid-turn: that batch is dropped with a notice
|
|
111
|
+
* instead of re-executed, so engine/tool side effects (deploys, deletions,
|
|
112
|
+
* sends) run at most once per owner message.
|
|
113
|
+
*/
|
|
114
|
+
attempted_turns?: Record<string, {
|
|
115
|
+
turn_key: string;
|
|
116
|
+
event_ids: string[];
|
|
117
|
+
started_at: string;
|
|
118
|
+
}>;
|
|
119
|
+
/**
|
|
120
|
+
* Engine-completed replies waiting for idempotent Relay delivery. The full
|
|
121
|
+
* reply is persisted before the POST, so a restart can redeliver it without
|
|
122
|
+
* executing the engine or its tools again.
|
|
123
|
+
*/
|
|
124
|
+
pending_replies?: Record<string, {
|
|
125
|
+
conversation_id: string;
|
|
126
|
+
event_ids: string[];
|
|
127
|
+
text: string;
|
|
128
|
+
created_at: string;
|
|
129
|
+
}>;
|
|
130
|
+
/**
|
|
131
|
+
* The owner's conversation with this agent, persisted by the loop when the
|
|
132
|
+
* first owner message arrives. Default target for notify/MCP sends. Never
|
|
133
|
+
* derived from the most recent writer.
|
|
134
|
+
*/
|
|
135
|
+
owner_conversation_id?: string;
|
|
136
|
+
}
|
|
137
|
+
export interface SessionBinding {
|
|
138
|
+
engine: string;
|
|
139
|
+
session_id: string;
|
|
140
|
+
cwd: string;
|
|
141
|
+
created_at: string;
|
|
142
|
+
}
|
|
143
|
+
export interface BlockInvalidStateOperations {
|
|
144
|
+
writeBlock?: typeof atomicWriteJson;
|
|
145
|
+
quarantine?: typeof renameSync;
|
|
146
|
+
/** Test-only crash boundary after the fail-closed marker is durable. */
|
|
147
|
+
afterBlockPersisted?: () => void;
|
|
148
|
+
}
|
|
149
|
+
export declare function blockInvalidState(home: string, path: string, reason: string, operations?: BlockInvalidStateOperations): never;
|
|
150
|
+
export declare function atomicWriteJson(path: string, value: unknown, mode: number): void;
|
|
151
|
+
export declare class ConfigStore {
|
|
152
|
+
private readonly home;
|
|
153
|
+
constructor(home?: string);
|
|
154
|
+
get path(): string;
|
|
155
|
+
load(): RelayConfig | undefined;
|
|
156
|
+
save(config: RelayConfig): void;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Read-only view of state.json for non-loop processes (hook, notify, mcp).
|
|
160
|
+
* Those processes MUST NOT construct a StateStore: only the `start` loop
|
|
161
|
+
* writes state.json.
|
|
162
|
+
*/
|
|
163
|
+
export declare function readStateSnapshot(home?: string): BridgeState;
|
|
164
|
+
export declare class StateStore {
|
|
165
|
+
private readonly home;
|
|
166
|
+
private state;
|
|
167
|
+
constructor(home?: string);
|
|
168
|
+
get path(): string;
|
|
169
|
+
get current(): BridgeState;
|
|
170
|
+
markSeen(eventId: string): void;
|
|
171
|
+
hasSeen(eventId: string): boolean;
|
|
172
|
+
persist(): void;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Per-request approval files in the active account runtime directory.
|
|
176
|
+
* Create-once by whoever arms the approval (loop or codex hook), resolution
|
|
177
|
+
* written by the loop when the tap arrives, consumed + unlinked by the waiter.
|
|
178
|
+
* Each file has a single writer at a time, so there is no read-modify-write
|
|
179
|
+
* of a shared snapshot across processes.
|
|
180
|
+
*/
|
|
181
|
+
export declare class ApprovalStore {
|
|
182
|
+
private readonly home;
|
|
183
|
+
constructor(home?: string);
|
|
184
|
+
get dir(): string;
|
|
185
|
+
private pathFor;
|
|
186
|
+
/** Create-once: throws if the request id already exists. */
|
|
187
|
+
create(approval: PendingApproval): void;
|
|
188
|
+
get(requestId: string): PendingApproval | undefined;
|
|
189
|
+
/** Full rewrite of one approval file (single-writer per file by protocol). */
|
|
190
|
+
put(approval: PendingApproval): void;
|
|
191
|
+
/** The waiter consumes the decision by removing the file. */
|
|
192
|
+
consume(requestId: string): void;
|
|
193
|
+
list(): PendingApproval[];
|
|
194
|
+
/**
|
|
195
|
+
* Age out abandoned files. An unconsumed resolution belongs to a waiter in
|
|
196
|
+
* another process, so nothing is removed before deadline + grace — only
|
|
197
|
+
* files whose waiter has clearly given up (crashed hook, dead loop).
|
|
198
|
+
*/
|
|
199
|
+
sweep(now?: number, graceMs?: number): string[];
|
|
200
|
+
}
|
|
201
|
+
export interface McpOutboundSend {
|
|
202
|
+
send_id: string;
|
|
203
|
+
api_origin: string;
|
|
204
|
+
account_identity: string;
|
|
205
|
+
conversation_id: string;
|
|
206
|
+
payload_hash: string;
|
|
207
|
+
idempotency_key: string;
|
|
208
|
+
created_at: string;
|
|
209
|
+
confirmed_at?: string;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Create-once ledger for Codex MCP logical sends. Each caller-provided send_id
|
|
213
|
+
* is permanently bound to one account, origin, conversation, and exact body.
|
|
214
|
+
* An ambiguous POST can therefore be repeated after a process restart with
|
|
215
|
+
* the same server idempotency key, while changed content fails closed.
|
|
216
|
+
*/
|
|
217
|
+
export declare class McpSendLedger {
|
|
218
|
+
private readonly home;
|
|
219
|
+
private readonly apiOrigin;
|
|
220
|
+
private readonly accountIdentity;
|
|
221
|
+
constructor(home: string, apiOrigin: string, accountIdentity: string);
|
|
222
|
+
get dir(): string;
|
|
223
|
+
private pathFor;
|
|
224
|
+
register(sendId: string, conversationId: string, text: string): McpOutboundSend;
|
|
225
|
+
confirm(send: McpOutboundSend): void;
|
|
226
|
+
}
|
|
227
|
+
export declare class SessionStore {
|
|
228
|
+
private readonly home;
|
|
229
|
+
private sessions;
|
|
230
|
+
constructor(home?: string);
|
|
231
|
+
get path(): string;
|
|
232
|
+
get(conversationId: string): SessionBinding | undefined;
|
|
233
|
+
set(conversationId: string, binding: SessionBinding): void;
|
|
234
|
+
delete(conversationId: string): void;
|
|
235
|
+
all(): Record<string, SessionBinding>;
|
|
236
|
+
}
|
|
237
|
+
export interface CodexNotifyPolicy {
|
|
238
|
+
allowed_project_roots: string[];
|
|
239
|
+
}
|
|
240
|
+
/** Local, non-secret project opt-ins shared across Relay re-pairs. */
|
|
241
|
+
export declare class CodexNotifyPolicyStore {
|
|
242
|
+
private readonly home;
|
|
243
|
+
constructor(home?: string);
|
|
244
|
+
get path(): string;
|
|
245
|
+
load(): CodexNotifyPolicy;
|
|
246
|
+
allowProject(projectRoot: string): string;
|
|
247
|
+
matchProject(cwd: string | undefined): string | undefined;
|
|
248
|
+
}
|
|
249
|
+
/** One live `relaymessenger start` process per origin+agent runtime namespace. */
|
|
250
|
+
export declare class RuntimeLock {
|
|
251
|
+
private readonly runtimeHome;
|
|
252
|
+
private readonly nonce;
|
|
253
|
+
private held;
|
|
254
|
+
constructor(runtimeHome: string);
|
|
255
|
+
get dir(): string;
|
|
256
|
+
private ownerPath;
|
|
257
|
+
acquire(): void;
|
|
258
|
+
release(): void;
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAUL,UAAU,EAIX,MAAM,SAAS,CAAC;AAKjB,wBAAgB,kBAAkB,IAAI,MAAM,CAU3C;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,4EAA4E;AAC5E,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,IAAI,CAAC,WAAW,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