@kdonev/termscape 0.1.2 → 0.1.4
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 +35 -4
- package/dist/agents/polling.d.ts +31 -0
- package/dist/agents/polling.d.ts.map +1 -0
- package/dist/agents/polling.js +65 -0
- package/dist/agents/polling.js.map +1 -0
- package/dist/agents/profiles.d.ts +21 -6
- package/dist/agents/profiles.d.ts.map +1 -1
- package/dist/agents/profiles.js +121 -3
- package/dist/agents/profiles.js.map +1 -1
- package/dist/agents/router.d.ts.map +1 -1
- package/dist/agents/router.js +2 -2
- package/dist/agents/router.js.map +1 -1
- package/dist/agents/shares.d.ts +32 -0
- package/dist/agents/shares.d.ts.map +1 -0
- package/dist/agents/shares.js +46 -0
- package/dist/agents/shares.js.map +1 -0
- package/dist/agents/wiring.d.ts +8 -0
- package/dist/agents/wiring.d.ts.map +1 -1
- package/dist/agents/wiring.js +72 -7
- package/dist/agents/wiring.js.map +1 -1
- package/dist/cli-args.d.ts +61 -0
- package/dist/cli-args.d.ts.map +1 -0
- package/dist/cli-args.js +35 -0
- package/dist/cli-args.js.map +1 -0
- package/dist/cli.js +10 -17
- package/dist/cli.js.map +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +69 -0
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/store.d.ts +21 -1
- package/dist/db/store.d.ts.map +1 -1
- package/dist/db/store.js +79 -3
- package/dist/db/store.js.map +1 -1
- package/dist/debug.d.ts +11 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +45 -0
- package/dist/debug.js.map +1 -0
- package/dist/folders.d.ts +33 -0
- package/dist/folders.d.ts.map +1 -0
- package/dist/folders.js +88 -0
- package/dist/folders.js.map +1 -0
- package/dist/hub.d.ts +128 -3
- package/dist/hub.d.ts.map +1 -1
- package/dist/hub.js +498 -44
- package/dist/hub.js.map +1 -1
- package/dist/hub.tgz +0 -0
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +38 -5
- package/dist/mcp/server.js.map +1 -1
- package/dist/paths.d.ts +9 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +9 -0
- package/dist/paths.js.map +1 -1
- package/dist/protocol/domain.d.ts +74 -0
- package/dist/protocol/domain.d.ts.map +1 -1
- package/dist/protocol/domain.js +58 -0
- package/dist/protocol/domain.js.map +1 -1
- package/dist/protocol/index.d.ts +1 -0
- package/dist/protocol/index.d.ts.map +1 -1
- package/dist/protocol/index.js +1 -0
- package/dist/protocol/index.js.map +1 -1
- package/dist/protocol/inject.d.ts +22 -2
- package/dist/protocol/inject.d.ts.map +1 -1
- package/dist/protocol/inject.js +24 -4
- package/dist/protocol/inject.js.map +1 -1
- package/dist/protocol/mcp-tools.d.ts +4 -0
- package/dist/protocol/mcp-tools.d.ts.map +1 -1
- package/dist/protocol/mcp-tools.js +16 -2
- package/dist/protocol/mcp-tools.js.map +1 -1
- package/dist/protocol/mouse.d.ts +54 -0
- package/dist/protocol/mouse.d.ts.map +1 -0
- package/dist/protocol/mouse.js +187 -0
- package/dist/protocol/mouse.js.map +1 -0
- package/dist/protocol/peer.d.ts +53 -1
- package/dist/protocol/peer.d.ts.map +1 -1
- package/dist/protocol/peer.js +96 -3
- package/dist/protocol/peer.js.map +1 -1
- package/dist/protocol/ws.d.ts +127 -2
- package/dist/protocol/ws.d.ts.map +1 -1
- package/dist/protocol/ws.js +83 -1
- package/dist/protocol/ws.js.map +1 -1
- package/dist/remote/deployer.d.ts.map +1 -1
- package/dist/remote/deployer.js +5 -1
- package/dist/remote/deployer.js.map +1 -1
- package/dist/remote/enroll.d.ts.map +1 -1
- package/dist/remote/enroll.js +25 -11
- package/dist/remote/enroll.js.map +1 -1
- package/dist/remote/join-script.d.ts.map +1 -1
- package/dist/remote/join-script.js +156 -31
- package/dist/remote/join-script.js.map +1 -1
- package/dist/remote/join.d.ts +2 -0
- package/dist/remote/join.d.ts.map +1 -1
- package/dist/remote/join.js +40 -1
- package/dist/remote/join.js.map +1 -1
- package/dist/remote/peer-serve.d.ts +19 -2
- package/dist/remote/peer-serve.d.ts.map +1 -1
- package/dist/remote/peer-serve.js +95 -7
- package/dist/remote/peer-serve.js.map +1 -1
- package/dist/remote/registry.d.ts +10 -0
- package/dist/remote/registry.d.ts.map +1 -1
- package/dist/remote/registry.js +31 -5
- package/dist/remote/registry.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +269 -10
- package/dist/server.js.map +1 -1
- package/dist/session/manager.d.ts +25 -0
- package/dist/session/manager.d.ts.map +1 -1
- package/dist/session/manager.js +42 -0
- package/dist/session/manager.js.map +1 -1
- package/dist/session/pty.d.ts +30 -1
- package/dist/session/pty.d.ts.map +1 -1
- package/dist/session/pty.js +98 -1
- package/dist/session/pty.js.map +1 -1
- package/package.json +1 -1
- package/web/assets/index-Z03Ta4g3.js +111 -0
- package/web/assets/index-u_uCiaPD.css +1 -0
- package/web/index.html +2 -2
- package/web/assets/index-9Z_8xZqk.js +0 -111
- package/web/assets/index-DheUm5dl.css +0 -1
|
@@ -19,11 +19,31 @@ export declare function sanitizeMessageBody(text: string): string;
|
|
|
19
19
|
/** The visible, unspoofable prefix a receiving agent sees. */
|
|
20
20
|
export declare function formatMessage(from: string, text: string): string;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* The keypress that submits an injected message.
|
|
23
|
+
*
|
|
24
|
+
* Deliberately not part of `encodeInjection`, and the split is the whole
|
|
25
|
+
* point of it. The CR used to be appended to the paste and written in the
|
|
26
|
+
* same go, on the reasonable-sounding grounds that a terminal sees the paste
|
|
27
|
+
* end and then an Enter. Agent TUIs do not behave that way: they debounce a
|
|
28
|
+
* paste - Claude Code among them, and deliberately, so that a pasted block
|
|
29
|
+
* full of newlines cannot fire off half-written prompts - and anything
|
|
30
|
+
* arriving inside that window is folded into the pasted text. A CR glued to
|
|
31
|
+
* the end of the paste therefore became a literal newline in the composer,
|
|
32
|
+
* and the message sat there fully typed and never sent. From the outside
|
|
33
|
+
* that looked like an agent messaging another and getting no answer, with
|
|
34
|
+
* its text plainly visible in the other's terminal.
|
|
35
|
+
*
|
|
36
|
+
* So it goes in on its own, once the paste has landed. `PtySession.inject`
|
|
37
|
+
* owns that timing.
|
|
38
|
+
*/
|
|
39
|
+
export declare const INJECT_SUBMIT = "\r";
|
|
40
|
+
/**
|
|
41
|
+
* Wire bytes for injecting `body` into a PTY - the message itself, without
|
|
42
|
+
* the keypress that sends it.
|
|
23
43
|
*
|
|
24
44
|
* Bracketed paste makes a multi-line body arrive as one atomic paste rather
|
|
25
45
|
* than as a line-by-line keystroke stream, so a CLI that reads line-at-a-time
|
|
26
|
-
* does not act on a half-delivered message.
|
|
46
|
+
* does not act on a half-delivered message. `INJECT_SUBMIT` follows separately.
|
|
27
47
|
*/
|
|
28
48
|
export declare function encodeInjection(body: string, mode: InjectMode): string;
|
|
29
49
|
//# sourceMappingURL=inject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,WAAW,gBAAc,CAAC;AACvC,eAAO,MAAM,SAAS,gBAAc,CAAC;AAErC,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,KAAK,CAAC;AAE7C,qEAAqE;AACrE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKxD;AAED,8DAA8D;AAC9D,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED
|
|
1
|
+
{"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,WAAW,gBAAc,CAAC;AACvC,eAAO,MAAM,SAAS,gBAAc,CAAC;AAErC,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,KAAK,CAAC;AAE7C,qEAAqE;AACrE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKxD;AAED,8DAA8D;AAC9D,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,aAAa,OAAO,CAAC;AAElC;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAItE"}
|
package/dist/protocol/inject.js
CHANGED
|
@@ -25,16 +25,36 @@ export function formatMessage(from, text) {
|
|
|
25
25
|
return `[from ${from}] ${sanitizeMessageBody(text)}`;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* The keypress that submits an injected message.
|
|
29
|
+
*
|
|
30
|
+
* Deliberately not part of `encodeInjection`, and the split is the whole
|
|
31
|
+
* point of it. The CR used to be appended to the paste and written in the
|
|
32
|
+
* same go, on the reasonable-sounding grounds that a terminal sees the paste
|
|
33
|
+
* end and then an Enter. Agent TUIs do not behave that way: they debounce a
|
|
34
|
+
* paste - Claude Code among them, and deliberately, so that a pasted block
|
|
35
|
+
* full of newlines cannot fire off half-written prompts - and anything
|
|
36
|
+
* arriving inside that window is folded into the pasted text. A CR glued to
|
|
37
|
+
* the end of the paste therefore became a literal newline in the composer,
|
|
38
|
+
* and the message sat there fully typed and never sent. From the outside
|
|
39
|
+
* that looked like an agent messaging another and getting no answer, with
|
|
40
|
+
* its text plainly visible in the other's terminal.
|
|
41
|
+
*
|
|
42
|
+
* So it goes in on its own, once the paste has landed. `PtySession.inject`
|
|
43
|
+
* owns that timing.
|
|
44
|
+
*/
|
|
45
|
+
export const INJECT_SUBMIT = '\r';
|
|
46
|
+
/**
|
|
47
|
+
* Wire bytes for injecting `body` into a PTY - the message itself, without
|
|
48
|
+
* the keypress that sends it.
|
|
29
49
|
*
|
|
30
50
|
* Bracketed paste makes a multi-line body arrive as one atomic paste rather
|
|
31
51
|
* than as a line-by-line keystroke stream, so a CLI that reads line-at-a-time
|
|
32
|
-
* does not act on a half-delivered message.
|
|
52
|
+
* does not act on a half-delivered message. `INJECT_SUBMIT` follows separately.
|
|
33
53
|
*/
|
|
34
54
|
export function encodeInjection(body, mode) {
|
|
35
55
|
const clean = sanitizeMessageBody(body);
|
|
36
56
|
if (mode === 'raw')
|
|
37
|
-
return
|
|
38
|
-
return `${PASTE_START}${clean}${PASTE_END}
|
|
57
|
+
return clean;
|
|
58
|
+
return `${PASTE_START}${clean}${PASTE_END}`;
|
|
39
59
|
}
|
|
40
60
|
//# sourceMappingURL=inject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject.js","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC;AACvC,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AAIrC,qEAAqE;AACrE,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI;SACR,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,0CAA0C;SAC/D,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,4CAA4C;SACpE,OAAO,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC,CAAC,sBAAsB;AAC7E,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,IAAY;IACtD,OAAO,SAAS,IAAI,KAAK,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;AACvD,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"inject.js","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC;AACvC,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AAIrC,qEAAqE;AACrE,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI;SACR,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,0CAA0C;SAC/D,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,4CAA4C;SACpE,OAAO,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC,CAAC,sBAAsB;AAC7E,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,IAAY;IACtD,OAAO,SAAS,IAAI,KAAK,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,IAAgB;IAC5D,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACxC,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IACjC,OAAO,GAAG,WAAW,GAAG,KAAK,GAAG,SAAS,EAAE,CAAC;AAC9C,CAAC"}
|
|
@@ -27,9 +27,12 @@ export declare const SendMessageInput: z.ZodObject<{
|
|
|
27
27
|
export declare const SpawnAgentInput: z.ZodObject<{
|
|
28
28
|
profile: z.ZodOptional<z.ZodString>;
|
|
29
29
|
name: z.ZodOptional<z.ZodString>;
|
|
30
|
+
host: z.ZodOptional<z.ZodString>;
|
|
30
31
|
workspace: z.ZodOptional<z.ZodString>;
|
|
31
32
|
prompt: z.ZodOptional<z.ZodString>;
|
|
32
33
|
}, z.core.$strip>;
|
|
34
|
+
/** No input: list_hosts always reports the whole canvas from wherever it is called. */
|
|
35
|
+
export declare const ListHostsInput: z.ZodObject<{}, z.core.$strip>;
|
|
33
36
|
export declare const ReadScreenInput: z.ZodObject<{
|
|
34
37
|
address: z.ZodString;
|
|
35
38
|
lines: z.ZodOptional<z.ZodNumber>;
|
|
@@ -62,6 +65,7 @@ export declare const ProposeTemplateInput: z.ZodObject<{
|
|
|
62
65
|
prompt: z.ZodOptional<z.ZodString>;
|
|
63
66
|
}, z.core.$strip>;
|
|
64
67
|
export type WhoamiInput = z.infer<typeof WhoamiInput>;
|
|
68
|
+
export type ListHostsInput = z.infer<typeof ListHostsInput>;
|
|
65
69
|
export type ListAgentsInput = z.infer<typeof ListAgentsInput>;
|
|
66
70
|
export type ListTemplatesInput = z.infer<typeof ListTemplatesInput>;
|
|
67
71
|
export type SendMessageInput = z.infer<typeof SendMessageInput>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-tools.d.ts","sourceRoot":"","sources":["../src/mcp-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AAEH,eAAO,MAAM,WAAW,gCAAe,CAAC;AAExC,eAAO,MAAM,eAAe;;iBAK1B,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;iBAK7B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;
|
|
1
|
+
{"version":3,"file":"mcp-tools.d.ts","sourceRoot":"","sources":["../src/mcp-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AAEH,eAAO,MAAM,WAAW,gCAAe,CAAC;AAExC,eAAO,MAAM,eAAe;;iBAK1B,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;iBAK7B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;iBAY3B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;iBAsB1B,CAAC;AAEH,uFAAuF;AACvF,eAAO,MAAM,cAA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
30
30
|
to: z
|
|
31
31
|
.string()
|
|
32
32
|
.describe('Target agent address, "workspace/name". Use list_agents to discover.'),
|
|
33
|
-
text: z
|
|
33
|
+
text: z
|
|
34
|
+
.string()
|
|
35
|
+
.min(1)
|
|
36
|
+
.max(8000)
|
|
37
|
+
.describe('Message body, injected into the target terminal. If you need an answer, ask for ' +
|
|
38
|
+
'one here — say to reply with send_message — then end your turn and let it arrive.'),
|
|
34
39
|
});
|
|
35
40
|
export const SpawnAgentInput = z.object({
|
|
36
41
|
profile: z.string().optional().describe('Agent profile id. Defaults to your own profile.'),
|
|
37
42
|
name: z.string().optional().describe('Name for the new agent. Auto-generated if omitted.'),
|
|
43
|
+
host: z
|
|
44
|
+
.string()
|
|
45
|
+
.optional()
|
|
46
|
+
.describe('Machine to start it on, by the label list_hosts gives. The machine that ' +
|
|
47
|
+
'owns the canvas is called "canvas"; "local" always means your own. ' +
|
|
48
|
+
'Defaults to your own machine.'),
|
|
38
49
|
workspace: z
|
|
39
50
|
.string()
|
|
40
51
|
.optional()
|
|
41
|
-
.describe('Workspace to spawn into. Defaults to your own workspace
|
|
52
|
+
.describe('Workspace to spawn into. Defaults to your own workspace if it exists on the ' +
|
|
53
|
+
'target machine, else the only workspace there.'),
|
|
42
54
|
prompt: z
|
|
43
55
|
.string()
|
|
44
56
|
.optional()
|
|
45
57
|
.describe('First instruction, injected once the new agent is ready.'),
|
|
46
58
|
});
|
|
59
|
+
/** No input: list_hosts always reports the whole canvas from wherever it is called. */
|
|
60
|
+
export const ListHostsInput = z.object({});
|
|
47
61
|
export const ReadScreenInput = z.object({
|
|
48
62
|
address: z.string().describe('Agent address to inspect.'),
|
|
49
63
|
lines: z.number().int().positive().max(200).optional().describe('Trailing lines to return (default 40).'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-tools.js","sourceRoot":"","sources":["../src/mcp-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC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,CAAC,MAAM,kBAAkB,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAW,CAAC;AACzE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading terminal input and output back as what it is, for tracing.
|
|
3
|
+
*
|
|
4
|
+
* Nothing here is on a hot path by itself — every caller is behind a debug
|
|
5
|
+
* switch — but it lives in the protocol package because the interesting
|
|
6
|
+
* question spans four processes. A wheel over a remote terminal is encoded in
|
|
7
|
+
* the browser, framed by the canvas hub, forwarded over the peer link, and
|
|
8
|
+
* written to a pty on another machine; each hop logs separately, and a trace
|
|
9
|
+
* is only worth reading if all four spell the same event the same way.
|
|
10
|
+
*
|
|
11
|
+
* The decoders are deliberately lenient. A log that says "6 bytes" for
|
|
12
|
+
* something it half-recognises is worse than one that says what it saw and
|
|
13
|
+
* lets the reader disagree.
|
|
14
|
+
*/
|
|
15
|
+
/** A byte burst as hex, capped so a paste cannot fill the log. */
|
|
16
|
+
export declare function hexBytes(bytes: Uint8Array, limit?: number): string;
|
|
17
|
+
/**
|
|
18
|
+
* One line describing a burst of terminal input.
|
|
19
|
+
*
|
|
20
|
+
* Mouse reports are named because they are what a scroll trace is looking
|
|
21
|
+
* for; everything else is shown as text plus hex, because the failure this
|
|
22
|
+
* exists to catch is a report arriving as the wrong bytes rather than not
|
|
23
|
+
* arriving at all.
|
|
24
|
+
*/
|
|
25
|
+
export declare function describeInput(bytes: Uint8Array): string;
|
|
26
|
+
/** The same, for input a caller is holding as one-byte-per-code-unit text. */
|
|
27
|
+
export declare function describeLatin1(data: string): string;
|
|
28
|
+
export interface ModeChange {
|
|
29
|
+
mode: string;
|
|
30
|
+
name: string;
|
|
31
|
+
set: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Every mouse or screen mode the program flipped in this chunk of output.
|
|
35
|
+
*
|
|
36
|
+
* Read off the stream rather than off a terminal, because the interesting
|
|
37
|
+
* moment is often before any terminal exists to ask: the hub sees a session's
|
|
38
|
+
* whole life, a freshly mounted window sees only what arrives after it
|
|
39
|
+
* attached. Both ends log through this so the two views can be compared.
|
|
40
|
+
*/
|
|
41
|
+
export declare function modeChanges(text: string): ModeChange[];
|
|
42
|
+
/** Those changes as one loggable phrase, or null when there were none. */
|
|
43
|
+
export declare function describeModeChanges(text: string): string | null;
|
|
44
|
+
/**
|
|
45
|
+
* What a serialized screen would restore, as far as scrolling is concerned.
|
|
46
|
+
*
|
|
47
|
+
* `@xterm/addon-serialize` replays the tracking mode but not the *encoding*
|
|
48
|
+
* one, so a snapshot can restore `?1003h` without `?1006h` and leave a
|
|
49
|
+
* reattached window sending X10 reports to a program that had been getting
|
|
50
|
+
* SGR ones. Worth being able to see in a trace, because the two ends of a
|
|
51
|
+
* remote session deliver their snapshots by different routes.
|
|
52
|
+
*/
|
|
53
|
+
export declare function describeSnapshotModes(serialized: string): string;
|
|
54
|
+
//# sourceMappingURL=mouse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mouse.d.ts","sourceRoot":"","sources":["../src/mouse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,kEAAkE;AAClE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,SAAK,GAAG,MAAM,CAK9D;AAqED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIvD;AAED,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAInD;AA4BD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;CACd;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,CAUtD;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAIhE"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading terminal input and output back as what it is, for tracing.
|
|
3
|
+
*
|
|
4
|
+
* Nothing here is on a hot path by itself — every caller is behind a debug
|
|
5
|
+
* switch — but it lives in the protocol package because the interesting
|
|
6
|
+
* question spans four processes. A wheel over a remote terminal is encoded in
|
|
7
|
+
* the browser, framed by the canvas hub, forwarded over the peer link, and
|
|
8
|
+
* written to a pty on another machine; each hop logs separately, and a trace
|
|
9
|
+
* is only worth reading if all four spell the same event the same way.
|
|
10
|
+
*
|
|
11
|
+
* The decoders are deliberately lenient. A log that says "6 bytes" for
|
|
12
|
+
* something it half-recognises is worse than one that says what it saw and
|
|
13
|
+
* lets the reader disagree.
|
|
14
|
+
*/
|
|
15
|
+
/** A byte burst as hex, capped so a paste cannot fill the log. */
|
|
16
|
+
export function hexBytes(bytes, limit = 32) {
|
|
17
|
+
const shown = Array.from(bytes.subarray(0, limit))
|
|
18
|
+
.map((b) => b.toString(16).padStart(2, '0'))
|
|
19
|
+
.join(' ');
|
|
20
|
+
return bytes.length > limit ? `${shown} … (${bytes.length}B)` : shown;
|
|
21
|
+
}
|
|
22
|
+
/** Printable rendering of an input burst, with escapes made visible. */
|
|
23
|
+
function asText(bytes) {
|
|
24
|
+
let out = '';
|
|
25
|
+
for (const b of bytes) {
|
|
26
|
+
if (b === 0x1b)
|
|
27
|
+
out += '\\e';
|
|
28
|
+
else if (b === 0x0d)
|
|
29
|
+
out += '\\r';
|
|
30
|
+
else if (b === 0x0a)
|
|
31
|
+
out += '\\n';
|
|
32
|
+
else if (b === 0x09)
|
|
33
|
+
out += '\\t';
|
|
34
|
+
else if (b < 0x20 || b === 0x7f)
|
|
35
|
+
out += `\\x${b.toString(16).padStart(2, '0')}`;
|
|
36
|
+
else if (b < 0x7f)
|
|
37
|
+
out += String.fromCharCode(b);
|
|
38
|
+
else
|
|
39
|
+
out += `\\x${b.toString(16).padStart(2, '0')}`;
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* What one mouse button field means.
|
|
45
|
+
*
|
|
46
|
+
* The wheel is the reason this exists: it is not a button in the low two bits
|
|
47
|
+
* but bit 6, so a wheel report and a left-click differ by 64 and read
|
|
48
|
+
* identically to anyone counting buttons. Bits 2-4 are the modifiers.
|
|
49
|
+
*/
|
|
50
|
+
function describeButton(b) {
|
|
51
|
+
const motion = (b & 32) !== 0;
|
|
52
|
+
const wheel = (b & 64) !== 0;
|
|
53
|
+
const low = b & 3;
|
|
54
|
+
const mods = [
|
|
55
|
+
b & 4 ? 'shift' : '',
|
|
56
|
+
b & 8 ? 'meta' : '',
|
|
57
|
+
b & 16 ? 'ctrl' : '',
|
|
58
|
+
].filter(Boolean);
|
|
59
|
+
let name;
|
|
60
|
+
if (wheel)
|
|
61
|
+
name = low === 0 ? 'wheel-up' : low === 1 ? 'wheel-down' : `wheel-${low}`;
|
|
62
|
+
else if (low === 3)
|
|
63
|
+
name = 'release';
|
|
64
|
+
else
|
|
65
|
+
name = ['left', 'middle', 'right'][low];
|
|
66
|
+
if (motion && !wheel)
|
|
67
|
+
name += '-motion';
|
|
68
|
+
return mods.length ? `${name}+${mods.join('+')}` : name;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* An X10 mouse report: `ESC [ M b x y`, each of the last three offset by 32.
|
|
72
|
+
*
|
|
73
|
+
* This is the encoding a program gets when it enables tracking without also
|
|
74
|
+
* asking for SGR, and it is the one that cannot survive being treated as
|
|
75
|
+
* text: past column or row 95 the coordinate byte is above 0x7f, which is not
|
|
76
|
+
* UTF-8 at all. A trace that shows a two-byte coordinate where this expects
|
|
77
|
+
* one is looking at exactly that corruption.
|
|
78
|
+
*/
|
|
79
|
+
function decodeX10(bytes) {
|
|
80
|
+
if (bytes.length < 6)
|
|
81
|
+
return null;
|
|
82
|
+
if (bytes[0] !== 0x1b || bytes[1] !== 0x5b || bytes[2] !== 0x4d)
|
|
83
|
+
return null;
|
|
84
|
+
const b = bytes[3] - 32;
|
|
85
|
+
const col = bytes[4] - 32;
|
|
86
|
+
const row = bytes[5] - 32;
|
|
87
|
+
const tail = bytes.length > 6 ? ` +${bytes.length - 6}B` : '';
|
|
88
|
+
return `X10 ${describeButton(b)} col=${col} row=${row}${tail}`;
|
|
89
|
+
}
|
|
90
|
+
/** An SGR mouse report: `ESC [ < b ; col ; row M|m`, all in decimal. */
|
|
91
|
+
function decodeSgr(bytes) {
|
|
92
|
+
const s = asText(bytes);
|
|
93
|
+
const m = /^\\e\[<(\d+);(\d+);(\d+)([Mm])/.exec(s);
|
|
94
|
+
if (!m)
|
|
95
|
+
return null;
|
|
96
|
+
const press = m[4] === 'M' ? 'press' : 'release';
|
|
97
|
+
return `SGR ${describeButton(Number(m[1]))} col=${m[2]} row=${m[3]} ${press}`;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* One line describing a burst of terminal input.
|
|
101
|
+
*
|
|
102
|
+
* Mouse reports are named because they are what a scroll trace is looking
|
|
103
|
+
* for; everything else is shown as text plus hex, because the failure this
|
|
104
|
+
* exists to catch is a report arriving as the wrong bytes rather than not
|
|
105
|
+
* arriving at all.
|
|
106
|
+
*/
|
|
107
|
+
export function describeInput(bytes) {
|
|
108
|
+
const mouse = decodeX10(bytes) ?? decodeSgr(bytes);
|
|
109
|
+
if (mouse)
|
|
110
|
+
return `${mouse} [${hexBytes(bytes)}]`;
|
|
111
|
+
return `"${asText(bytes)}" [${hexBytes(bytes)}]`;
|
|
112
|
+
}
|
|
113
|
+
/** The same, for input a caller is holding as one-byte-per-code-unit text. */
|
|
114
|
+
export function describeLatin1(data) {
|
|
115
|
+
const bytes = new Uint8Array(data.length);
|
|
116
|
+
for (let i = 0; i < data.length; i++)
|
|
117
|
+
bytes[i] = data.charCodeAt(i) & 0xff;
|
|
118
|
+
return describeInput(bytes);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The modes that decide whether a wheel is the program's business or the
|
|
122
|
+
* terminal's, named by what they do rather than by number.
|
|
123
|
+
*
|
|
124
|
+
* `?1049` is here because it is the one that explains a terminal with no
|
|
125
|
+
* scrollback at all: on the alternate screen there is nothing to scroll to,
|
|
126
|
+
* so a program that has not also asked for mouse reports cannot be scrolled
|
|
127
|
+
* by any means. That combination — alternate screen, no tracking — is the
|
|
128
|
+
* shape a stale CLI leaves behind, and it is worth being able to see it
|
|
129
|
+
* rather than infer it.
|
|
130
|
+
*/
|
|
131
|
+
const MODE_NAMES = {
|
|
132
|
+
'9': 'x10-mouse',
|
|
133
|
+
'1000': 'vt200-mouse',
|
|
134
|
+
'1002': 'drag-mouse',
|
|
135
|
+
'1003': 'any-motion-mouse',
|
|
136
|
+
'1004': 'focus-events',
|
|
137
|
+
'1005': 'utf8-mouse-encoding',
|
|
138
|
+
'1006': 'sgr-mouse-encoding',
|
|
139
|
+
'1015': 'urxvt-mouse-encoding',
|
|
140
|
+
'1016': 'sgr-pixel-encoding',
|
|
141
|
+
'1047': 'alt-screen',
|
|
142
|
+
'1049': 'alt-screen+cursor',
|
|
143
|
+
'47': 'alt-screen-legacy',
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Every mouse or screen mode the program flipped in this chunk of output.
|
|
147
|
+
*
|
|
148
|
+
* Read off the stream rather than off a terminal, because the interesting
|
|
149
|
+
* moment is often before any terminal exists to ask: the hub sees a session's
|
|
150
|
+
* whole life, a freshly mounted window sees only what arrives after it
|
|
151
|
+
* attached. Both ends log through this so the two views can be compared.
|
|
152
|
+
*/
|
|
153
|
+
export function modeChanges(text) {
|
|
154
|
+
const out = [];
|
|
155
|
+
// A single DECSET/DECRST can carry several modes, e.g. `ESC [ ? 1002;1006 h`.
|
|
156
|
+
for (const m of text.matchAll(/\x1b\[\?([\d;]+)([hl])/g)) {
|
|
157
|
+
for (const mode of m[1].split(';')) {
|
|
158
|
+
const name = MODE_NAMES[mode];
|
|
159
|
+
if (name)
|
|
160
|
+
out.push({ mode, name, set: m[2] === 'h' });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return out;
|
|
164
|
+
}
|
|
165
|
+
/** Those changes as one loggable phrase, or null when there were none. */
|
|
166
|
+
export function describeModeChanges(text) {
|
|
167
|
+
const changes = modeChanges(text);
|
|
168
|
+
if (changes.length === 0)
|
|
169
|
+
return null;
|
|
170
|
+
return changes.map((c) => `${c.set ? '+' : '-'}${c.name}(?${c.mode})`).join(' ');
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* What a serialized screen would restore, as far as scrolling is concerned.
|
|
174
|
+
*
|
|
175
|
+
* `@xterm/addon-serialize` replays the tracking mode but not the *encoding*
|
|
176
|
+
* one, so a snapshot can restore `?1003h` without `?1006h` and leave a
|
|
177
|
+
* reattached window sending X10 reports to a program that had been getting
|
|
178
|
+
* SGR ones. Worth being able to see in a trace, because the two ends of a
|
|
179
|
+
* remote session deliver their snapshots by different routes.
|
|
180
|
+
*/
|
|
181
|
+
export function describeSnapshotModes(serialized) {
|
|
182
|
+
const changes = modeChanges(serialized);
|
|
183
|
+
if (changes.length === 0)
|
|
184
|
+
return 'no mouse/screen modes';
|
|
185
|
+
return changes.map((c) => `${c.set ? '+' : '-'}${c.name}`).join(' ');
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=mouse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mouse.js","sourceRoot":"","sources":["../src/mouse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,kEAAkE;AAClE,MAAM,UAAU,QAAQ,CAAC,KAAiB,EAAE,KAAK,GAAG,EAAE;I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AAC,CAAC;YAC9B,IAAI,IAAI;gBAAE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAkB;IACtD,MAAM,OAAO,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;IACxC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,uBAAuB,CAAC;IACzD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvE,CAAC"}
|
package/dist/protocol/peer.d.ts
CHANGED
|
@@ -65,6 +65,21 @@ export declare const PeerRelayAsk: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
65
65
|
t: z.ZodLiteral<"readScreen">;
|
|
66
66
|
address: z.ZodString;
|
|
67
67
|
lines: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
69
|
+
t: z.ZodLiteral<"listHosts">;
|
|
70
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
71
|
+
t: z.ZodLiteral<"spawn">;
|
|
72
|
+
from: z.ZodString;
|
|
73
|
+
host: z.ZodString;
|
|
74
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
75
|
+
name: z.ZodOptional<z.ZodString>;
|
|
76
|
+
agent: z.ZodString;
|
|
77
|
+
template: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
|
+
model: z.ZodOptional<z.ZodString>;
|
|
79
|
+
effort: z.ZodOptional<z.ZodString>;
|
|
80
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
81
|
+
opening: z.ZodOptional<z.ZodString>;
|
|
82
|
+
promptGiven: z.ZodBoolean;
|
|
68
83
|
}, z.core.$strip>], "t">;
|
|
69
84
|
export type PeerRelayAsk = z.infer<typeof PeerRelayAsk>;
|
|
70
85
|
export declare const PeerHello: z.ZodObject<{
|
|
@@ -77,6 +92,7 @@ export declare const PeerHello: z.ZodObject<{
|
|
|
77
92
|
platform: z.ZodString;
|
|
78
93
|
arch: z.ZodString;
|
|
79
94
|
homeDir: z.ZodString;
|
|
95
|
+
machineId: z.ZodOptional<z.ZodString>;
|
|
80
96
|
}, z.core.$strip>>;
|
|
81
97
|
}, z.core.$strip>;
|
|
82
98
|
export declare const PeerRequest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -89,6 +105,7 @@ export declare const PeerRequest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
89
105
|
platform: z.ZodString;
|
|
90
106
|
arch: z.ZodString;
|
|
91
107
|
homeDir: z.ZodString;
|
|
108
|
+
machineId: z.ZodOptional<z.ZodString>;
|
|
92
109
|
}, z.core.$strip>>;
|
|
93
110
|
}, z.core.$strip>, z.ZodObject<{
|
|
94
111
|
t: z.ZodLiteral<"listSessions">;
|
|
@@ -147,6 +164,7 @@ export declare const PeerRequest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
147
164
|
statusText: z.ZodNullable<z.ZodString>;
|
|
148
165
|
host: z.ZodString;
|
|
149
166
|
}, z.core.$strip>>;
|
|
167
|
+
youAre: z.ZodOptional<z.ZodString>;
|
|
150
168
|
}, z.core.$strip>, z.ZodObject<{
|
|
151
169
|
t: z.ZodLiteral<"relayResult">;
|
|
152
170
|
id: z.ZodString;
|
|
@@ -178,12 +196,20 @@ export declare const PeerRequest: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
178
196
|
id: z.ZodString;
|
|
179
197
|
address: z.ZodString;
|
|
180
198
|
data: z.ZodString;
|
|
199
|
+
encoding: z.ZodOptional<z.ZodEnum<{
|
|
200
|
+
utf8: "utf8";
|
|
201
|
+
binary: "binary";
|
|
202
|
+
}>>;
|
|
181
203
|
}, z.core.$strip>, z.ZodObject<{
|
|
182
204
|
t: z.ZodLiteral<"resize">;
|
|
183
205
|
id: z.ZodString;
|
|
184
206
|
address: z.ZodString;
|
|
185
207
|
cols: z.ZodNumber;
|
|
186
208
|
rows: z.ZodNumber;
|
|
209
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
210
|
+
t: z.ZodLiteral<"checkFolder">;
|
|
211
|
+
id: z.ZodString;
|
|
212
|
+
path: z.ZodString;
|
|
187
213
|
}, z.core.$strip>], "t">;
|
|
188
214
|
export type PeerRequest = z.infer<typeof PeerRequest>;
|
|
189
215
|
export declare const PeerResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -199,6 +225,11 @@ export declare const PeerResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
199
225
|
t: z.ZodLiteral<"err">;
|
|
200
226
|
id: z.ZodString;
|
|
201
227
|
message: z.ZodString;
|
|
228
|
+
code: z.ZodOptional<z.ZodEnum<{
|
|
229
|
+
"unknown-token": "unknown-token";
|
|
230
|
+
"schema-mismatch": "schema-mismatch";
|
|
231
|
+
"bad-hello": "bad-hello";
|
|
232
|
+
}>>;
|
|
202
233
|
}, z.core.$strip>, z.ZodObject<{
|
|
203
234
|
t: z.ZodLiteral<"sessions">;
|
|
204
235
|
sessions: z.ZodArray<z.ZodObject<{
|
|
@@ -330,12 +361,33 @@ export declare const PeerResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
330
361
|
t: z.ZodLiteral<"readScreen">;
|
|
331
362
|
address: z.ZodString;
|
|
332
363
|
lines: z.ZodOptional<z.ZodNumber>;
|
|
364
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
365
|
+
t: z.ZodLiteral<"listHosts">;
|
|
366
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
367
|
+
t: z.ZodLiteral<"spawn">;
|
|
368
|
+
from: z.ZodString;
|
|
369
|
+
host: z.ZodString;
|
|
370
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
371
|
+
name: z.ZodOptional<z.ZodString>;
|
|
372
|
+
agent: z.ZodString;
|
|
373
|
+
template: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
374
|
+
model: z.ZodOptional<z.ZodString>;
|
|
375
|
+
effort: z.ZodOptional<z.ZodString>;
|
|
376
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
377
|
+
opening: z.ZodOptional<z.ZodString>;
|
|
378
|
+
promptGiven: z.ZodBoolean;
|
|
333
379
|
}, z.core.$strip>], "t">;
|
|
334
380
|
}, z.core.$strip>], "t">;
|
|
335
381
|
export type PeerResponse = z.infer<typeof PeerResponse>;
|
|
336
382
|
/**
|
|
337
383
|
* Bumped whenever the peer protocol or the DB schema changes shape. Hubs
|
|
338
384
|
* refuse to connect across a mismatch rather than corrupting each other.
|
|
385
|
+
*
|
|
386
|
+
* 9: added `checkFolder`. Required, not cosmetic — `peer-serve.ts` drops a
|
|
387
|
+
* frame it cannot parse silently, so a peer older than this would leave a
|
|
388
|
+
* `checkFolder` request hanging forever instead of refusing it; the version
|
|
389
|
+
* gate is what turns that into an honest refusal at the handshake instead.
|
|
390
|
+
* Consequence: every already-joined machine has to re-run the installer.
|
|
339
391
|
*/
|
|
340
|
-
export declare const PEER_SCHEMA_VERSION =
|
|
392
|
+
export declare const PEER_SCHEMA_VERSION = 9;
|
|
341
393
|
//# sourceMappingURL=peer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer.d.ts","sourceRoot":"","sources":["../src/peer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,+EAA+E;AAC/E,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;iBASpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD;;;;;;;;GAQG;AACH;;;;;;GAMG;AACH,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"peer.d.ts","sourceRoot":"","sources":["../src/peer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,+EAA+E;AAC/E,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;iBASpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD;;;;;;;;GAQG;AACH;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;wBA2CvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,eAAO,MAAM,SAAS;;;;;;;;;;;;iBA+BpB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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