@frockbot/protocol 0.3.4 → 0.3.6
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/index.ts +10 -2
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -9,7 +9,12 @@ export interface PromptRequest {
|
|
|
9
9
|
*/
|
|
10
10
|
export const BOT_STATE_CHANNEL_VERSION = 1 as const;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* What a frame says has moved. `computer` is the Computer projection;
|
|
14
|
+
* `runs` is this Bot's durable run records — a Turn started, said more, or
|
|
15
|
+
* settled — so a client that is not holding the Turn's POST still learns.
|
|
16
|
+
*/
|
|
17
|
+
export type BotStateTopicV1 = "computer" | "runs";
|
|
13
18
|
|
|
14
19
|
export type BotStateChannelFrameV1 =
|
|
15
20
|
| {
|
|
@@ -84,7 +89,10 @@ export function decodeBotStateChannelFrameV1(
|
|
|
84
89
|
"cursor",
|
|
85
90
|
"topic",
|
|
86
91
|
]);
|
|
87
|
-
if (
|
|
92
|
+
if (
|
|
93
|
+
frame.schemaVersion !== 1 ||
|
|
94
|
+
(frame.topic !== "computer" && frame.topic !== "runs")
|
|
95
|
+
) {
|
|
88
96
|
throw new Error("invalid Bot-state frame");
|
|
89
97
|
}
|
|
90
98
|
return {
|