@paddockai/client 0.0.4 → 0.0.5

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/dist/index.cjs CHANGED
@@ -48,8 +48,10 @@ var streamEventNames = [
48
48
  "config.applied",
49
49
  "session.status",
50
50
  "outbox.queued",
51
+ "outbox.retrying",
51
52
  "outbox.delivered",
52
53
  "outbox.failed",
54
+ "inbox.failed",
53
55
  "status.update",
54
56
  "error"
55
57
  ];
@@ -549,9 +551,12 @@ var SessionOperations = class {
549
551
  get base() {
550
552
  return `/sessions/${segment(this.id)}`;
551
553
  }
552
- /** Stores a user message; resolves with its event once stored (002#operations_2). */
553
- send(text) {
554
- return this.transport.request({ method: "POST", path: `${this.base}/messages`, json: { text } });
554
+ /**
555
+ * Stores a user message; resolves with its event once stored (004#messages). author, the person
556
+ * the message speaks for, is allowed with an API key or a function token, never a session token.
557
+ */
558
+ send(text, options = {}) {
559
+ return this.transport.request({ method: "POST", path: `${this.base}/messages`, json: { text, ...options } });
555
560
  }
556
561
  /** Stores a stop.requested event and resolves with it. */
557
562
  stop() {
@@ -561,13 +566,15 @@ var SessionOperations = class {
561
566
  stream(options = {}) {
562
567
  return new EventStream(this.transport, `${this.base}/stream`, options);
563
568
  }
564
- /** Mints a session token for the browser. */
569
+ /**
570
+ * Mints a session token for the browser: ttl in seconds; participant authors the token's
571
+ * messages; readOnly makes a token that can only read and follow the session (004#credentials).
572
+ */
565
573
  createToken(options) {
566
- return this.transport.request({
567
- method: "POST",
568
- path: `${this.base}/tokens`,
569
- json: { ttlSeconds: options.ttl }
570
- });
574
+ const json = { ttlSeconds: options.ttl };
575
+ if (options.participant) json.participant = options.participant;
576
+ if (options.readOnly) json.readOnly = true;
577
+ return this.transport.request({ method: "POST", path: `${this.base}/tokens`, json });
571
578
  }
572
579
  /** Reads the session. */
573
580
  get() {
@@ -714,7 +721,7 @@ var SessionFold = class {
714
721
  };
715
722
 
716
723
  // src/version.ts
717
- var version = "0.0.4";
724
+ var version = "0.0.5";
718
725
 
719
726
  // src/client.ts
720
727
  var loadPage = 200;