run402 4.17.9 → 4.18.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.
@@ -0,0 +1,399 @@
1
+ /**
2
+ * `rooms` namespace — agent-messaging coordination rooms (gateway
3
+ * `agent-messaging`): session-grained presence, room-visible addressed
4
+ * messages with cursored reads, and TTL-expiring advisory claims, for 2+
5
+ * agents working the same product.
6
+ *
7
+ * Rooms are ORG-scoped and auto-vivify on first use — there is no create
8
+ * call. A room key equal to a project id is that project's DEFAULT room:
9
+ * {@link Rooms.forProject} resolves the owning org and returns the scoped
10
+ * handle, so two agents on different machines rendezvous through the project
11
+ * id already in `run402.config.json`, zero configuration. Free-form room
12
+ * keys name org rooms for multi-repo products.
13
+ *
14
+ * Load-bearing semantics:
15
+ * - Presence names are unique per room FOREVER; a `requestedName` is honored
16
+ * verbatim when free, else deterministically suffixed (`Opus` → `Opus-2`)
17
+ * and reported via `renamed: true` — never an error, never a retry.
18
+ * - Messages are room-visible; `to`/`cc` routes attention, not access.
19
+ * - Claims are ADVISORY and never block anything, anywhere (deploys
20
+ * included) — creation always succeeds and reports `conflicts[]`.
21
+ * - Message cursors are opaque (`mcr_…`): store and echo, never parse. An
22
+ * unusable cursor never errors — the page returns `reset: true` +
23
+ * `earliest_cursor` (events-feed semantics).
24
+ *
25
+ * Writes (presence registration, sends, acks, claims) need a
26
+ * principal-backed credential — SIWX, control-plane session, or a
27
+ * `run402_agent_key` delegate; a project service_key is read-only in its own
28
+ * default room. Rooms are never lifecycle-gated: agents of an org in grace
29
+ * keep coordinating.
30
+ */
31
+ import { LocalError } from "../errors.js";
32
+ function roomPath(orgId, roomKey) {
33
+ return `/orgs/v1/${encodeURIComponent(orgId)}/rooms/${encodeURIComponent(roomKey)}`;
34
+ }
35
+ function presencesQuery(opts = {}) {
36
+ const params = new URLSearchParams();
37
+ if (opts.includeExpired !== undefined)
38
+ params.set("include_expired", String(opts.includeExpired));
39
+ if (opts.name !== undefined)
40
+ params.set("name", opts.name);
41
+ const qs = params.toString();
42
+ return qs ? `?${qs}` : "";
43
+ }
44
+ function messagesQuery(opts = {}) {
45
+ const params = new URLSearchParams();
46
+ if (opts.cursor !== undefined)
47
+ params.set("cursor", opts.cursor);
48
+ if (opts.order !== undefined)
49
+ params.set("order", opts.order);
50
+ if (opts.before !== undefined)
51
+ params.set("before", opts.before);
52
+ if (opts.threadId !== undefined)
53
+ params.set("thread_id", opts.threadId);
54
+ if (opts.addressedTo !== undefined)
55
+ params.set("addressed_to", opts.addressedTo);
56
+ if (opts.unread !== undefined)
57
+ params.set("unread", String(opts.unread));
58
+ if (opts.presenceId !== undefined)
59
+ params.set("presence_id", opts.presenceId);
60
+ if (opts.limit !== undefined)
61
+ params.set("limit", String(opts.limit));
62
+ const qs = params.toString();
63
+ return qs ? `?${qs}` : "";
64
+ }
65
+ function claimsQuery(opts = {}) {
66
+ const params = new URLSearchParams();
67
+ if (opts.includeInactive !== undefined)
68
+ params.set("include_inactive", String(opts.includeInactive));
69
+ const qs = params.toString();
70
+ return qs ? `?${qs}` : "";
71
+ }
72
+ export class Rooms {
73
+ client;
74
+ constructor(client) {
75
+ this.client = client;
76
+ }
77
+ /**
78
+ * Register a session presence in a room
79
+ * (`POST /orgs/v1/:org_id/rooms/:room_key/presences`). Each call is a NEW
80
+ * presence with a new room-unique name — reuse the returned `presence_id`
81
+ * (or just send/claim, which resolve-or-create implicitly) instead of
82
+ * re-registering. `opts.requestedName` is honored-or-suffixed
83
+ * (`Opus` → `Opus-2`, reported via `renamed`); omit it for a
84
+ * server-assigned memorable name. Expiry after ~1h of silence; any
85
+ * coordination call bumps liveness.
86
+ */
87
+ async registerPresence(orgId, roomKey, opts = {}) {
88
+ if (!orgId) {
89
+ throw new LocalError("rooms.registerPresence requires an orgId", "registering room presence");
90
+ }
91
+ if (!roomKey) {
92
+ throw new LocalError("rooms.registerPresence requires a roomKey", "registering room presence");
93
+ }
94
+ const body = {};
95
+ if (opts.requestedName !== undefined)
96
+ body.requested_name = opts.requestedName;
97
+ if (opts.task !== undefined)
98
+ body.task = opts.task;
99
+ if (opts.program !== undefined)
100
+ body.program = opts.program;
101
+ if (opts.model !== undefined)
102
+ body.model = opts.model;
103
+ return this.client.request(`${roomPath(orgId, roomKey)}/presences`, {
104
+ method: "POST",
105
+ body,
106
+ context: "registering room presence",
107
+ });
108
+ }
109
+ /**
110
+ * List a room's live presences
111
+ * (`GET /orgs/v1/:org_id/rooms/:room_key/presences`) — who else is here,
112
+ * what they're working on, and their `active_claims` counts.
113
+ * `opts.includeExpired` adds history; `opts.name` is an exact-name lookup.
114
+ */
115
+ async listPresences(orgId, roomKey, opts = {}) {
116
+ if (!orgId) {
117
+ throw new LocalError("rooms.listPresences requires an orgId", "listing room presences");
118
+ }
119
+ if (!roomKey) {
120
+ throw new LocalError("rooms.listPresences requires a roomKey", "listing room presences");
121
+ }
122
+ return this.client.request(`${roomPath(orgId, roomKey)}/presences${presencesQuery(opts)}`, { method: "GET", context: "listing room presences" });
123
+ }
124
+ /**
125
+ * Read one presence
126
+ * (`GET /orgs/v1/:org_id/rooms/:room_key/presences/:presence_id`).
127
+ */
128
+ async getPresence(orgId, roomKey, presenceId) {
129
+ if (!orgId) {
130
+ throw new LocalError("rooms.getPresence requires an orgId", "reading room presence");
131
+ }
132
+ if (!roomKey) {
133
+ throw new LocalError("rooms.getPresence requires a roomKey", "reading room presence");
134
+ }
135
+ if (!presenceId) {
136
+ throw new LocalError("rooms.getPresence requires a presenceId", "reading room presence");
137
+ }
138
+ return this.client.request(`${roomPath(orgId, roomKey)}/presences/${encodeURIComponent(presenceId)}`, { method: "GET", context: "reading room presence" });
139
+ }
140
+ /**
141
+ * Send a room-visible message
142
+ * (`POST /orgs/v1/:org_id/rooms/:room_key/messages`). `to`/`cc` take
143
+ * presence NAMES and route attention, not access — an unknown or expired
144
+ * addressee is a 422 naming the unresolved entries. Sending
145
+ * resolve-or-creates your presence when `presenceId` is omitted
146
+ * (`requestedName`/`task` apply to that creation case). An
147
+ * `idempotencyKey` replay returns the ORIGINAL stored message with
148
+ * `deduplicated: true`. Sends are bounded by the org-pooled
149
+ * `messages_per_day` quota.
150
+ */
151
+ async sendMessage(orgId, roomKey, input) {
152
+ if (!orgId) {
153
+ throw new LocalError("rooms.sendMessage requires an orgId", "sending room message");
154
+ }
155
+ if (!roomKey) {
156
+ throw new LocalError("rooms.sendMessage requires a roomKey", "sending room message");
157
+ }
158
+ if (!input?.body) {
159
+ throw new LocalError("rooms.sendMessage requires { body }", "sending room message");
160
+ }
161
+ const body = { body: input.body };
162
+ if (input.to !== undefined)
163
+ body.to = input.to;
164
+ if (input.cc !== undefined)
165
+ body.cc = input.cc;
166
+ if (input.threadId !== undefined)
167
+ body.thread_id = input.threadId;
168
+ if (input.importance !== undefined)
169
+ body.importance = input.importance;
170
+ if (input.ackRequired !== undefined)
171
+ body.ack_required = input.ackRequired;
172
+ if (input.idempotencyKey !== undefined)
173
+ body.idempotency_key = input.idempotencyKey;
174
+ if (input.presenceId !== undefined)
175
+ body.presence_id = input.presenceId;
176
+ if (input.requestedName !== undefined)
177
+ body.requested_name = input.requestedName;
178
+ if (input.task !== undefined)
179
+ body.task = input.task;
180
+ return this.client.request(`${roomPath(orgId, roomKey)}/messages`, {
181
+ method: "POST",
182
+ body,
183
+ context: "sending room message",
184
+ });
185
+ }
186
+ /**
187
+ * Read a page of room messages
188
+ * (`GET /orgs/v1/:org_id/rooms/:room_key/messages`) — events-feed cursor
189
+ * semantics: ascending catch-up via `cursor`, or newest-first display via
190
+ * `order: "desc"` + `before`. List items carry `body_snippet` only; fetch
191
+ * the full body with {@link getMessage} (the view truncates, the data
192
+ * never does). Ascending reads with a resolved presence advance its read
193
+ * watermark (what `unread: true` filters against).
194
+ */
195
+ async listMessages(orgId, roomKey, opts = {}) {
196
+ if (!orgId) {
197
+ throw new LocalError("rooms.listMessages requires an orgId", "listing room messages");
198
+ }
199
+ if (!roomKey) {
200
+ throw new LocalError("rooms.listMessages requires a roomKey", "listing room messages");
201
+ }
202
+ return this.client.request(`${roomPath(orgId, roomKey)}/messages${messagesQuery(opts)}`, { method: "GET", context: "listing room messages" });
203
+ }
204
+ /**
205
+ * Read one message with its full body and per-recipient ack state
206
+ * (`GET /orgs/v1/:org_id/rooms/:room_key/messages/:message_id`).
207
+ */
208
+ async getMessage(orgId, roomKey, messageId) {
209
+ if (!orgId) {
210
+ throw new LocalError("rooms.getMessage requires an orgId", "reading room message");
211
+ }
212
+ if (!roomKey) {
213
+ throw new LocalError("rooms.getMessage requires a roomKey", "reading room message");
214
+ }
215
+ if (!messageId) {
216
+ throw new LocalError("rooms.getMessage requires a messageId", "reading room message");
217
+ }
218
+ return this.client.request(`${roomPath(orgId, roomKey)}/messages/${encodeURIComponent(messageId)}`, { method: "GET", context: "reading room message" });
219
+ }
220
+ /**
221
+ * Acknowledge a message addressed to you
222
+ * (`POST /orgs/v1/:org_id/rooms/:room_key/messages/:message_id/ack`).
223
+ * Recipients only (422 otherwise). Idempotent — a replay reports the
224
+ * ORIGINAL `acked_at` with `already_acked: true`.
225
+ */
226
+ async ackMessage(orgId, roomKey, messageId, opts = {}) {
227
+ if (!orgId) {
228
+ throw new LocalError("rooms.ackMessage requires an orgId", "acknowledging room message");
229
+ }
230
+ if (!roomKey) {
231
+ throw new LocalError("rooms.ackMessage requires a roomKey", "acknowledging room message");
232
+ }
233
+ if (!messageId) {
234
+ throw new LocalError("rooms.ackMessage requires a messageId", "acknowledging room message");
235
+ }
236
+ const body = {};
237
+ if (opts.presenceId !== undefined)
238
+ body.presence_id = opts.presenceId;
239
+ return this.client.request(`${roomPath(orgId, roomKey)}/messages/${encodeURIComponent(messageId)}/ack`, { method: "POST", body, context: "acknowledging room message" });
240
+ }
241
+ /**
242
+ * Create an advisory claim
243
+ * (`POST /orgs/v1/:org_id/rooms/:room_key/claims`). GRANT-AND-REPORT: the
244
+ * 201 always succeeds and returns the complete `conflicts[]` — a claim
245
+ * never blocks anything, anywhere (deploys included). Auto-expires
246
+ * (`ttlSeconds` default 3600, max 86400); at most 32 active claims per
247
+ * presence. Claiming resolve-or-creates your presence when `presenceId`
248
+ * is omitted.
249
+ */
250
+ async createClaim(orgId, roomKey, input) {
251
+ if (!orgId) {
252
+ throw new LocalError("rooms.createClaim requires an orgId", "creating room claim");
253
+ }
254
+ if (!roomKey) {
255
+ throw new LocalError("rooms.createClaim requires a roomKey", "creating room claim");
256
+ }
257
+ if (!input?.resource) {
258
+ throw new LocalError("rooms.createClaim requires { resource }", "creating room claim");
259
+ }
260
+ if (!input?.mode) {
261
+ throw new LocalError("rooms.createClaim requires { mode }", "creating room claim");
262
+ }
263
+ const body = { resource: input.resource, mode: input.mode };
264
+ if (input.ttlSeconds !== undefined)
265
+ body.ttl_seconds = input.ttlSeconds;
266
+ if (input.note !== undefined)
267
+ body.note = input.note;
268
+ if (input.presenceId !== undefined)
269
+ body.presence_id = input.presenceId;
270
+ return this.client.request(`${roomPath(orgId, roomKey)}/claims`, {
271
+ method: "POST",
272
+ body,
273
+ context: "creating room claim",
274
+ });
275
+ }
276
+ /**
277
+ * List a room's active claims
278
+ * (`GET /orgs/v1/:org_id/rooms/:room_key/claims`).
279
+ * `opts.includeInactive` adds released/expired history (with
280
+ * `released_at`).
281
+ */
282
+ async listClaims(orgId, roomKey, opts = {}) {
283
+ if (!orgId) {
284
+ throw new LocalError("rooms.listClaims requires an orgId", "listing room claims");
285
+ }
286
+ if (!roomKey) {
287
+ throw new LocalError("rooms.listClaims requires a roomKey", "listing room claims");
288
+ }
289
+ return this.client.request(`${roomPath(orgId, roomKey)}/claims${claimsQuery(opts)}`, { method: "GET", context: "listing room claims" });
290
+ }
291
+ /**
292
+ * Release your own claim
293
+ * (`DELETE /orgs/v1/:org_id/rooms/:room_key/claims/:claim_id`). Holder's
294
+ * credential only. Idempotent — an already-released claim returns
295
+ * `already_released: true` with the original time.
296
+ */
297
+ async releaseClaim(orgId, roomKey, claimId) {
298
+ if (!orgId) {
299
+ throw new LocalError("rooms.releaseClaim requires an orgId", "releasing room claim");
300
+ }
301
+ if (!roomKey) {
302
+ throw new LocalError("rooms.releaseClaim requires a roomKey", "releasing room claim");
303
+ }
304
+ if (!claimId) {
305
+ throw new LocalError("rooms.releaseClaim requires a claimId", "releasing room claim");
306
+ }
307
+ return this.client.request(`${roomPath(orgId, roomKey)}/claims/${encodeURIComponent(claimId)}`, { method: "DELETE", context: "releasing room claim" });
308
+ }
309
+ /**
310
+ * Return a room-scoped sub-client with `(orgId, roomKey)` pre-bound.
311
+ * Synchronous — both ids are explicit. For a project's default room
312
+ * without knowing the org, use {@link forProject}.
313
+ */
314
+ scoped(orgId, roomKey) {
315
+ return new ScopedRoom(this, orgId, roomKey);
316
+ }
317
+ /**
318
+ * Resolve a project's DEFAULT room (`GET /projects/v1/:project_id` for the
319
+ * owning `org_id`, then {@link scoped}). The default room's key IS the
320
+ * project id verbatim — this is the zero-config rendezvous: two agents
321
+ * holding the same `run402.config.json` land in the same room with no
322
+ * shared setup.
323
+ */
324
+ async forProject(projectId) {
325
+ if (!projectId) {
326
+ throw new LocalError("rooms.forProject requires a projectId", "resolving a project's default room");
327
+ }
328
+ const project = await this.client.request(`/projects/v1/${encodeURIComponent(projectId)}`, { method: "GET", context: "resolving a project's default room" });
329
+ const orgId = typeof project.org_id === "string" ? project.org_id : "";
330
+ if (!orgId) {
331
+ throw new LocalError("rooms.forProject could not resolve the project's owning org: the project read carried no org_id", "resolving a project's default room");
332
+ }
333
+ return this.scoped(orgId, projectId);
334
+ }
335
+ }
336
+ /**
337
+ * A room-scoped sub-client returned by {@link Rooms.scoped} /
338
+ * {@link Rooms.forProject}. The `(orgId, roomKey)` pair is bound at
339
+ * construction; instance operations drop both leading arguments.
340
+ */
341
+ export class ScopedRoom {
342
+ rooms;
343
+ /** The org id this sub-client is bound to. Read-only. */
344
+ orgId;
345
+ /** The room key this sub-client is bound to (a project id for a default room). Read-only. */
346
+ roomKey;
347
+ constructor(rooms, orgId, roomKey) {
348
+ this.rooms = rooms;
349
+ if (!orgId) {
350
+ throw new LocalError("rooms.scoped requires an orgId", "scoping client to room");
351
+ }
352
+ if (!roomKey) {
353
+ throw new LocalError("rooms.scoped requires a roomKey", "scoping client to room");
354
+ }
355
+ this.orgId = orgId;
356
+ this.roomKey = roomKey;
357
+ }
358
+ /** See {@link Rooms.registerPresence}. */
359
+ registerPresence(opts = {}) {
360
+ return this.rooms.registerPresence(this.orgId, this.roomKey, opts);
361
+ }
362
+ /** See {@link Rooms.listPresences}. */
363
+ listPresences(opts = {}) {
364
+ return this.rooms.listPresences(this.orgId, this.roomKey, opts);
365
+ }
366
+ /** See {@link Rooms.getPresence}. */
367
+ getPresence(presenceId) {
368
+ return this.rooms.getPresence(this.orgId, this.roomKey, presenceId);
369
+ }
370
+ /** See {@link Rooms.sendMessage}. */
371
+ sendMessage(input) {
372
+ return this.rooms.sendMessage(this.orgId, this.roomKey, input);
373
+ }
374
+ /** See {@link Rooms.listMessages}. */
375
+ listMessages(opts = {}) {
376
+ return this.rooms.listMessages(this.orgId, this.roomKey, opts);
377
+ }
378
+ /** See {@link Rooms.getMessage}. */
379
+ getMessage(messageId) {
380
+ return this.rooms.getMessage(this.orgId, this.roomKey, messageId);
381
+ }
382
+ /** See {@link Rooms.ackMessage}. */
383
+ ackMessage(messageId, opts = {}) {
384
+ return this.rooms.ackMessage(this.orgId, this.roomKey, messageId, opts);
385
+ }
386
+ /** See {@link Rooms.createClaim}. */
387
+ createClaim(input) {
388
+ return this.rooms.createClaim(this.orgId, this.roomKey, input);
389
+ }
390
+ /** See {@link Rooms.listClaims}. */
391
+ listClaims(opts = {}) {
392
+ return this.rooms.listClaims(this.orgId, this.roomKey, opts);
393
+ }
394
+ /** See {@link Rooms.releaseClaim}. */
395
+ releaseClaim(claimId) {
396
+ return this.rooms.releaseClaim(this.orgId, this.roomKey, claimId);
397
+ }
398
+ }
399
+ //# sourceMappingURL=rooms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rooms.js","sourceRoot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