@ccmsg/protocol 1.13.0 → 1.14.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/package.json +1 -1
- package/src/control/transcript.ts +19 -6
- package/src/fixtures/control.ts +17 -0
package/package.json
CHANGED
|
@@ -61,8 +61,12 @@ export const TranscriptReadResponse = response("transcript_read", TranscriptRead
|
|
|
61
61
|
* `source` that item carries.
|
|
62
62
|
*
|
|
63
63
|
* The range is cut the way a dump's is — an instant or a record on either side
|
|
64
|
-
* — and
|
|
65
|
-
*
|
|
64
|
+
* — and which end of it a limit keeps follows from which bound was given. A
|
|
65
|
+
* lower bound reads forward from it and `next` names the continuation; an upper
|
|
66
|
+
* bound alone reads the range's last items and `prev` names the continuation
|
|
67
|
+
* backwards, which is how a client that draws the newest items first walks back
|
|
68
|
+
* through a transcript it never has to read whole. The role decides how much is
|
|
69
|
+
* visible, as it does for the raw read. */
|
|
66
70
|
export const TranscriptItemsReadArgs = Type.Object({
|
|
67
71
|
sid: Sid,
|
|
68
72
|
/** Read one agent below the session instead of the session itself. */
|
|
@@ -78,11 +82,16 @@ export const TranscriptItemsReadArgs = Type.Object({
|
|
|
78
82
|
since_id: Type.Optional(TranscriptItemId),
|
|
79
83
|
until_at: Type.Optional(Timestamp),
|
|
80
84
|
until_uuid: Type.Optional(Type.String()),
|
|
85
|
+
/** Exclusive upper bound as an item id, the one a previous reply named as
|
|
86
|
+
* `prev`. Finer than `until_uuid`, which would stop at a record whose earlier
|
|
87
|
+
* items were already read. */
|
|
88
|
+
until_id: Type.Optional(TranscriptItemId),
|
|
81
89
|
/** Which item types to keep, applied left to right. Absent keeps everything
|
|
82
90
|
* but the attachments, as a dump's absent selection does. */
|
|
83
91
|
types: Type.Optional(Type.Array(TranscriptItemSelector)),
|
|
84
|
-
/** How many items to answer with
|
|
85
|
-
*
|
|
92
|
+
/** How many items to answer with, taken from the range's start when a lower
|
|
93
|
+
* bound was given and from its end when only an upper one was; the instance
|
|
94
|
+
* narrows this to its own limit. */
|
|
86
95
|
limit: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
87
96
|
});
|
|
88
97
|
export type TranscriptItemsReadArgs = Static<typeof TranscriptItemsReadArgs>;
|
|
@@ -90,9 +99,13 @@ export type TranscriptItemsReadArgs = Static<typeof TranscriptItemsReadArgs>;
|
|
|
90
99
|
export const TranscriptItemsReadResult = Type.Object({
|
|
91
100
|
/** Oldest first, as the transcript had them. */
|
|
92
101
|
items: Type.Array(TranscriptItem),
|
|
93
|
-
/** The first item left out, when a limit cut
|
|
94
|
-
*
|
|
102
|
+
/** The first item left out after the ones answered, when a limit cut a
|
|
103
|
+
* forward read short. Absent means nothing follows within the range. */
|
|
95
104
|
next: Type.Optional(TranscriptItemId),
|
|
105
|
+
/** The first item answered, when a limit left older ones inside the range
|
|
106
|
+
* unread. Pass it back as `until_id` to read what came before. Absent means
|
|
107
|
+
* the range reaches back to its start. */
|
|
108
|
+
prev: Type.Optional(TranscriptItemId),
|
|
96
109
|
/** The ids the answered items carried, gathered as a dump gathers them.
|
|
97
110
|
* Absent when the caller did not ask the instance to collect them. */
|
|
98
111
|
ids: Type.Optional(DumpIds),
|
package/src/fixtures/control.ts
CHANGED
|
@@ -336,6 +336,23 @@ export const TRANSCRIPT_ITEMS_READ_RESPONSE: Static<typeof TranscriptItemsReadRe
|
|
|
336
336
|
ids: [{ kind: "agent", id: "a471372f2", label: "dump-kinds-design", status: "running" }],
|
|
337
337
|
};
|
|
338
338
|
|
|
339
|
+
/** A client drawing the newest items first asks with an upper bound alone, and
|
|
340
|
+
* walks back by handing the `prev` it was given to the next call. */
|
|
341
|
+
export const TRANSCRIPT_ITEMS_READ_BACKWARD_REQUEST: Static<typeof TranscriptItemsReadRequest> = {
|
|
342
|
+
request_id,
|
|
343
|
+
op: "transcript_items_read",
|
|
344
|
+
sid,
|
|
345
|
+
until_id: "18d6f2c9:0",
|
|
346
|
+
limit: 2,
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
export const TRANSCRIPT_ITEMS_READ_BACKWARD_RESPONSE: Static<typeof TranscriptItemsReadResponse> = {
|
|
350
|
+
ok: true,
|
|
351
|
+
request_id,
|
|
352
|
+
items: TRANSCRIPT_ITEMS.slice(1, 3),
|
|
353
|
+
prev: "f10b6d43:0",
|
|
354
|
+
};
|
|
355
|
+
|
|
339
356
|
export const SESSION_FORK_ORIGIN_REQUEST: Static<typeof SessionForkOriginRequest> = {
|
|
340
357
|
request_id,
|
|
341
358
|
op: "session_fork_origin",
|