@ccmsg/protocol 0.6.1 → 0.7.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/session.ts +8 -1
- package/src/envelope.ts +10 -0
package/package.json
CHANGED
package/src/control/session.ts
CHANGED
|
@@ -27,6 +27,13 @@ export type SessionKillResult = Static<typeof SessionKillResult>;
|
|
|
27
27
|
export const SessionKillRequest = request("session_kill", SessionKillArgs);
|
|
28
28
|
export const SessionKillResponse = response("session_kill", SessionKillResult);
|
|
29
29
|
|
|
30
|
+
/** How long a title may be. A title is typed into a terminal and shown as a
|
|
31
|
+
* session's first line, where anything longer is unreadable whatever the
|
|
32
|
+
* terminal would accept — so the ceiling is the caller's to keep to, and a
|
|
33
|
+
* client that composes a title has to know it before it sends one. Counted the
|
|
34
|
+
* way a JSON Schema `maxLength` is, over the value as sent. */
|
|
35
|
+
export const TITLE_MAX_CHARS = 200;
|
|
36
|
+
|
|
30
37
|
/** Retitles a running session by typing its own rename command into the
|
|
31
38
|
* terminal it lives in.
|
|
32
39
|
*
|
|
@@ -40,7 +47,7 @@ export const SessionRenameArgs = Type.Object({
|
|
|
40
47
|
/** The new title. Surrounding whitespace is trimmed and control characters
|
|
41
48
|
* are refused: the value is typed, so a newline in it would submit a
|
|
42
49
|
* half-written command. */
|
|
43
|
-
title: Type.String({ minLength: 1 }),
|
|
50
|
+
title: Type.String({ minLength: 1, maxLength: TITLE_MAX_CHARS }),
|
|
44
51
|
});
|
|
45
52
|
export type SessionRenameArgs = Static<typeof SessionRenameArgs>;
|
|
46
53
|
|
package/src/envelope.ts
CHANGED
|
@@ -8,6 +8,16 @@ import { InstanceId, Role, Sid } from "./identifiers.ts";
|
|
|
8
8
|
* connections and on mesh links alike. */
|
|
9
9
|
export const PROTOCOL_VERSION = 2;
|
|
10
10
|
|
|
11
|
+
/** The largest a single frame — one newline-delimited line, request, reply or
|
|
12
|
+
* topic frame alike — may be, in bytes.
|
|
13
|
+
*
|
|
14
|
+
* A value both sides hold because only the sender can keep to it: a frame over
|
|
15
|
+
* it is answered `bad_request` and the connection stays up, so a client that
|
|
16
|
+
* does not know the ceiling reads a refusal it cannot attribute to size. What
|
|
17
|
+
* a caller does with a payload above it — split it, write it as a file — is its
|
|
18
|
+
* own decision, which is why the contract states the limit and not a remedy. */
|
|
19
|
+
export const MAX_FRAME_BYTES = 1_048_576;
|
|
20
|
+
|
|
11
21
|
/** The identity a forwarded request is dispatched as: the connection the
|
|
12
22
|
* forwarding instance received it on, in the two fields that decide anything —
|
|
13
23
|
* the role the attribute table is read against, and the session it speaks for. */
|