@ours.network/messenger-server 2.0.4-nightly.1 → 2.1.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/README.md CHANGED
@@ -284,6 +284,48 @@ input bounds, identity isolation, and secret redaction. It does not authenticate
284
284
  public users: any non-loopback deployment still requires an authenticated
285
285
  reverse proxy. No nginx or other proxy-specific configuration is assumed.
286
286
 
287
+ ## Agent statuses (external agents)
288
+
289
+ Agents that the Owner's Fleet does not run can post statuses to the Owner's
290
+ feed. The Messenger server is the canonical store for them; Fleet agents'
291
+ statuses stay in Fleet, and the App reads both. When typed commands are
292
+ enabled (`OURS_MESSENGER_TYPED_COMMANDS`, on by default), the Owner identity
293
+ advertises two typed commands, merged into whatever catalog it already
294
+ advertises:
295
+
296
+ - `ours.status.publish` with `{ kind: update | question | alert, title, body,
297
+ attachments?, interaction?, supersedes?, request_key? }`. The result is
298
+ `{ status_id }` or `{ error: { code, message } }`. The author is the sending
299
+ identity, never an argument, and external statuses have no mission. A
300
+ question needs an `interaction` (`text`, `single` or `multi`). With a
301
+ `request_key`, a retried publish returns the first result.
302
+ - `ours.status.close` with `{ status_id, reason? }`. An agent can close only
303
+ its own statuses.
304
+
305
+ A command is applied and recorded durably by its wire ID before it is consumed
306
+ and answered, so a crash never applies it twice or loses it. The Owner answers
307
+ in the feed or in the chat: the first answer wins. It goes to the agent as the
308
+ typed command `ours.status.answer` (`{ status_id, submission_id, question,
309
+ selection?, text? }`). If the agent does not advertise that command, it goes
310
+ as a readable text reply to the publish message, recorded as
311
+ `delivered_as_text`. An attempt that fails is `not_delivered`, and only the
312
+ Owner's **Try again** sends it again.
313
+
314
+ Status pushes require the Notifications producer to be configured
315
+ (`OURS_NOTIFICATIONS_ORIGIN` and `OURS_NOTIFICATIONS_PRODUCER_TOKEN`). With it,
316
+ each status is pushed with a `status` target, an open question's notification
317
+ is resolved when it is answered, closed or superseded, and a status command is
318
+ not pushed a second time as a chat message. Push work that the producer's
319
+ outbox refuses (full or failing) stays on the status and is handed off by the
320
+ server's periodic recovery tick. With only the server's own Web Push (no
321
+ Notifications producer), statuses are **not** pushed, and a status command
322
+ still arrives as an ordinary chat-message push.
323
+
324
+ Routes: `GET /api/statuses?scope=global|agent&agent=<cid>&after=&limit=`,
325
+ `GET /api/statuses/:id`, `GET /api/statuses/by-wire/:wireId` (the chat card),
326
+ `POST /api/statuses/:id/answer`, `POST /api/statuses/:id/answer/deliver`
327
+ (Try again), `POST /api/statuses/:id/seen`. The resource view is `statuses`.
328
+
287
329
  ## REST surface
288
330
 
289
331
  Routes live under `/api/`; `src/api.ts` is the executable route list. Principal
@@ -38,7 +38,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
38
38
  var define_MESSENGER_BUILD_INFO_default;
39
39
  var init_define_MESSENGER_BUILD_INFO = __esm({
40
40
  "<define:__MESSENGER_BUILD_INFO__>"() {
41
- define_MESSENGER_BUILD_INFO_default = { name: "@ours.network/messenger-server", version: "2.0.4-nightly.1", sha: "799503193fa69d232cda15fd04eda36d63e284e1", dirty: true };
41
+ define_MESSENGER_BUILD_INFO_default = { name: "@ours.network/messenger-server", version: "2.1.0", sha: "09708dfd76879f6280e19fc0c693d1e59a876541", dirty: false };
42
42
  }
43
43
  });
44
44