glasspane-mcp 1.29.0 → 1.29.1
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/dispatch.d.ts +1 -1
- package/dist/http-gateway-cli.js +40 -19
- package/dist/http-gateway.d.ts +14 -0
- package/dist/http-gateway.js +41 -19
- package/dist/index.js +27 -19
- package/dist/io.d.ts +17 -6
- package/dist/stdio-session.d.ts +1 -1
- package/dist/stdio-session.js +27 -19
- package/package.json +1 -1
package/dist/dispatch.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare const MCP_PROTOCOL_VERSION: "2025-06-18";
|
|
|
26
26
|
export declare const SUPPORTED_PROTOCOL_VERSIONS: readonly string[];
|
|
27
27
|
export declare const SERVER_INFO: {
|
|
28
28
|
readonly name: "glasspane-mcp";
|
|
29
|
-
readonly version: "1.29.
|
|
29
|
+
readonly version: "1.29.1";
|
|
30
30
|
};
|
|
31
31
|
export declare const PARSE_ERROR = -32700;
|
|
32
32
|
export declare const INVALID_REQUEST = -32600;
|
package/dist/http-gateway-cli.js
CHANGED
|
@@ -46,17 +46,28 @@ var LineReader = class {
|
|
|
46
46
|
this.sink = sink;
|
|
47
47
|
}
|
|
48
48
|
sink;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Bytes of the line in progress, in arrival order. Decoding happens ONCE, at delivery.
|
|
51
|
+
*
|
|
52
|
+
* The previous version decoded every segment on its own (`segment.toString("utf8")`) and
|
|
53
|
+
* concatenated the results into a string. A chunk boundary that lands inside a multi-byte
|
|
54
|
+
* UTF-8 sequence is normal for frames larger than a socket read: the left half ends the
|
|
55
|
+
* segment, the right half starts the next one, and `toString` replaces both with U+FFFD.
|
|
56
|
+
* `JSON.parse` still succeeded, so a daemon reply carrying screen text (`observe`,
|
|
57
|
+
* `last_evidence`) reached the agent and the report renderer with that text silently
|
|
58
|
+
* rewritten, while `bytes`/`raw` stayed correct — the shape looked fine, only the content
|
|
59
|
+
* had been edited. Measured 2026-11-04: feeding `{"title":"数据"}\n` (19 bytes) split at
|
|
60
|
+
* each of its 18 positions corrupts the title at 4 of them.
|
|
61
|
+
*/
|
|
62
|
+
chunks = [];
|
|
63
|
+
/** UTF-8 bytes seen for the line in progress (counted past the cap, never all retained). */
|
|
53
64
|
bytes = 0;
|
|
54
65
|
/** The line in progress already blew the cap; only the head is retained. */
|
|
55
66
|
discarding = false;
|
|
56
67
|
/**
|
|
57
68
|
* @param chunk a fragment from the stream. A `Buffer` keeps the wire bytes for
|
|
58
|
-
* {@link LineSink.onLine}; a string is
|
|
59
|
-
*
|
|
69
|
+
* {@link LineSink.onLine}; a string is encoded to UTF-8 first, so the byte count
|
|
70
|
+
* stays a byte count either way.
|
|
60
71
|
*/
|
|
61
72
|
push(chunk) {
|
|
62
73
|
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
|
|
@@ -73,36 +84,33 @@ var LineReader = class {
|
|
|
73
84
|
}
|
|
74
85
|
/** Partial line so far; only the retained head while a line is discarded. */
|
|
75
86
|
pendingText() {
|
|
76
|
-
return this.
|
|
87
|
+
return this.chunks.length === 0 ? "" : Buffer.concat(this.chunks).toString("utf8");
|
|
77
88
|
}
|
|
78
89
|
consume(segment) {
|
|
79
90
|
const segmentBytes = segment.length;
|
|
80
91
|
if (segmentBytes === 0 && !this.discarding) {
|
|
81
92
|
return;
|
|
82
93
|
}
|
|
83
|
-
const text = segment.toString("utf8");
|
|
84
94
|
if (this.discarding) {
|
|
85
95
|
this.bytes += segmentBytes;
|
|
86
96
|
return;
|
|
87
97
|
}
|
|
88
98
|
if (this.bytes + segmentBytes > MAX_FRAME_BYTES) {
|
|
89
99
|
this.discarding = true;
|
|
90
|
-
|
|
91
|
-
this.
|
|
100
|
+
const head = Buffer.concat([...this.chunks, segment]).subarray(0, OVERSIZE_PREFIX_BYTES);
|
|
101
|
+
this.chunks = [head];
|
|
92
102
|
this.bytes += segmentBytes;
|
|
93
103
|
return;
|
|
94
104
|
}
|
|
95
|
-
this.
|
|
96
|
-
this.rawChunks.push(Buffer.from(segment));
|
|
105
|
+
this.chunks.push(Buffer.from(segment));
|
|
97
106
|
this.bytes += segmentBytes;
|
|
98
107
|
}
|
|
99
108
|
deliver() {
|
|
100
|
-
const
|
|
109
|
+
const raw = this.chunks.length === 0 ? void 0 : Buffer.concat(this.chunks);
|
|
110
|
+
const line = raw === void 0 ? "" : raw.toString("utf8");
|
|
101
111
|
const bytes = this.bytes;
|
|
102
112
|
const oversize = this.discarding;
|
|
103
|
-
|
|
104
|
-
this.buffer = "";
|
|
105
|
-
this.rawChunks = [];
|
|
113
|
+
this.chunks = [];
|
|
106
114
|
this.bytes = 0;
|
|
107
115
|
this.discarding = false;
|
|
108
116
|
if (oversize) {
|
|
@@ -1184,6 +1192,8 @@ function unixSocketEngineClient(socketPath, options = {}) {
|
|
|
1184
1192
|
import http from "node:http";
|
|
1185
1193
|
import { createHash as createHash3, timingSafeEqual } from "node:crypto";
|
|
1186
1194
|
import { isIP } from "node:net";
|
|
1195
|
+
import os3 from "node:os";
|
|
1196
|
+
import path4 from "node:path";
|
|
1187
1197
|
import { URL } from "node:url";
|
|
1188
1198
|
|
|
1189
1199
|
// ../node_modules/iterate-kernel/dist/dimension-context.js
|
|
@@ -4002,7 +4012,7 @@ function mapAuditError(error, engineMethod = "last_evidence") {
|
|
|
4002
4012
|
}
|
|
4003
4013
|
|
|
4004
4014
|
// src/dispatch.ts
|
|
4005
|
-
var SERVER_INFO = { name: "glasspane-mcp", version: "1.29.
|
|
4015
|
+
var SERVER_INFO = { name: "glasspane-mcp", version: "1.29.1" };
|
|
4006
4016
|
|
|
4007
4017
|
// src/http-gateway.ts
|
|
4008
4018
|
var GLASSPANE_HTTP_TOKEN_ENV = "GLASSPANE_HTTP_TOKEN";
|
|
@@ -4575,13 +4585,24 @@ async function handleToolForward(name, req, client, res, bodyReadTimeoutMs = DEF
|
|
|
4575
4585
|
await failEngine(res, error, spec, engineBody(checked.value));
|
|
4576
4586
|
}
|
|
4577
4587
|
}
|
|
4588
|
+
function daemonCliCommand(...flags) {
|
|
4589
|
+
const installed = path4.join(
|
|
4590
|
+
os3.homedir(),
|
|
4591
|
+
"Applications",
|
|
4592
|
+
"GlassPane Daemon.app",
|
|
4593
|
+
"Contents",
|
|
4594
|
+
"MacOS",
|
|
4595
|
+
"glasspaned"
|
|
4596
|
+
);
|
|
4597
|
+
return [quoteShellArg(installed), ...flags].join(" ");
|
|
4598
|
+
}
|
|
4578
4599
|
function handleEvidenceStats(res) {
|
|
4579
4600
|
fail(
|
|
4580
4601
|
res,
|
|
4581
4602
|
501,
|
|
4582
4603
|
HTTP_NOT_PROVIDED,
|
|
4583
4604
|
"evidence statistics are not exposed over this daemon's socket protocol in this build",
|
|
4584
|
-
|
|
4605
|
+
`run \`${daemonCliCommand("--evidence-stats")}\` against the same --state-dir this socket serves to get count/totalBytes/listFailure/dir`
|
|
4585
4606
|
);
|
|
4586
4607
|
}
|
|
4587
4608
|
async function handleRecipeValidate(req, res, bodyReadTimeoutMs = DEFAULT_BODY_READ_TIMEOUT_MS) {
|
|
@@ -4616,7 +4637,7 @@ async function handleRecipeValidate(req, res, bodyReadTimeoutMs = DEFAULT_BODY_R
|
|
|
4616
4637
|
501,
|
|
4617
4638
|
HTTP_NOT_PROVIDED,
|
|
4618
4639
|
"recipe validation is not exposed over this daemon's socket protocol in this build",
|
|
4619
|
-
|
|
4640
|
+
`run \`${daemonCliCommand("--recipe-validate", "<recipe.json-path>")}\`; this build provides no socket method for it`
|
|
4620
4641
|
);
|
|
4621
4642
|
}
|
|
4622
4643
|
function authorized(req, expected) {
|
package/dist/http-gateway.d.ts
CHANGED
|
@@ -165,6 +165,20 @@ export declare function assertTokenPolicy(token: string): void;
|
|
|
165
165
|
/** Install the sink. Exported for the gateway factory; a caller that replaces it gets
|
|
166
166
|
* the last writer, which is what a single-process gateway already is. */
|
|
167
167
|
export declare function setGatewayReportSink(sink: (note: string) => void): void;
|
|
168
|
+
/**
|
|
169
|
+
* The daemon CLI, spelled the way a caller on THIS machine can actually run it.
|
|
170
|
+
*
|
|
171
|
+
* `glasspaned` is not on PATH (measured 2026-11-04: `command -v glasspaned` answers nothing, and
|
|
172
|
+
* no npm package declares that bin), so a remedy printing the bare name promises a repair and
|
|
173
|
+
* delivers `command not found` (127). The installed bundle is where `installer/cli.js` puts the
|
|
174
|
+
* daemon, and it is the same location `project-registry.ts` names. The directory contains a space,
|
|
175
|
+
* so the path must be ONE shell word — otherwise the copy-paste lands on `.../GlassPane` and hands
|
|
176
|
+
* `Daemon.app/...` to the next argv slot. Swift's half of this rule is
|
|
177
|
+
* `engine/Sources/GlassPaneEngine/DaemonInvocation.swift`; the gate that keeps both honest is
|
|
178
|
+
* `test/daily-20261104-bare-daemon-name.test.mjs`, because this list has been short of the next
|
|
179
|
+
* site five times running.
|
|
180
|
+
*/
|
|
181
|
+
export declare function daemonCliCommand(...flags: string[]): string;
|
|
168
182
|
/** How long one request body may take, when the caller did not choose (see {@link HttpGatewayOptions.bodyReadTimeoutMs}). */
|
|
169
183
|
export declare const DEFAULT_BODY_READ_TIMEOUT_MS = 15000;
|
|
170
184
|
//# sourceMappingURL=http-gateway.d.ts.map
|
package/dist/http-gateway.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import http from "node:http";
|
|
3
3
|
import { createHash as createHash3, timingSafeEqual } from "node:crypto";
|
|
4
4
|
import { isIP } from "node:net";
|
|
5
|
+
import os3 from "node:os";
|
|
6
|
+
import path4 from "node:path";
|
|
5
7
|
import { URL } from "node:url";
|
|
6
8
|
|
|
7
9
|
// src/engine-client.ts
|
|
@@ -20,17 +22,28 @@ var LineReader = class {
|
|
|
20
22
|
this.sink = sink;
|
|
21
23
|
}
|
|
22
24
|
sink;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Bytes of the line in progress, in arrival order. Decoding happens ONCE, at delivery.
|
|
27
|
+
*
|
|
28
|
+
* The previous version decoded every segment on its own (`segment.toString("utf8")`) and
|
|
29
|
+
* concatenated the results into a string. A chunk boundary that lands inside a multi-byte
|
|
30
|
+
* UTF-8 sequence is normal for frames larger than a socket read: the left half ends the
|
|
31
|
+
* segment, the right half starts the next one, and `toString` replaces both with U+FFFD.
|
|
32
|
+
* `JSON.parse` still succeeded, so a daemon reply carrying screen text (`observe`,
|
|
33
|
+
* `last_evidence`) reached the agent and the report renderer with that text silently
|
|
34
|
+
* rewritten, while `bytes`/`raw` stayed correct — the shape looked fine, only the content
|
|
35
|
+
* had been edited. Measured 2026-11-04: feeding `{"title":"数据"}\n` (19 bytes) split at
|
|
36
|
+
* each of its 18 positions corrupts the title at 4 of them.
|
|
37
|
+
*/
|
|
38
|
+
chunks = [];
|
|
39
|
+
/** UTF-8 bytes seen for the line in progress (counted past the cap, never all retained). */
|
|
27
40
|
bytes = 0;
|
|
28
41
|
/** The line in progress already blew the cap; only the head is retained. */
|
|
29
42
|
discarding = false;
|
|
30
43
|
/**
|
|
31
44
|
* @param chunk a fragment from the stream. A `Buffer` keeps the wire bytes for
|
|
32
|
-
* {@link LineSink.onLine}; a string is
|
|
33
|
-
*
|
|
45
|
+
* {@link LineSink.onLine}; a string is encoded to UTF-8 first, so the byte count
|
|
46
|
+
* stays a byte count either way.
|
|
34
47
|
*/
|
|
35
48
|
push(chunk) {
|
|
36
49
|
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
|
|
@@ -47,36 +60,33 @@ var LineReader = class {
|
|
|
47
60
|
}
|
|
48
61
|
/** Partial line so far; only the retained head while a line is discarded. */
|
|
49
62
|
pendingText() {
|
|
50
|
-
return this.
|
|
63
|
+
return this.chunks.length === 0 ? "" : Buffer.concat(this.chunks).toString("utf8");
|
|
51
64
|
}
|
|
52
65
|
consume(segment) {
|
|
53
66
|
const segmentBytes = segment.length;
|
|
54
67
|
if (segmentBytes === 0 && !this.discarding) {
|
|
55
68
|
return;
|
|
56
69
|
}
|
|
57
|
-
const text = segment.toString("utf8");
|
|
58
70
|
if (this.discarding) {
|
|
59
71
|
this.bytes += segmentBytes;
|
|
60
72
|
return;
|
|
61
73
|
}
|
|
62
74
|
if (this.bytes + segmentBytes > MAX_FRAME_BYTES) {
|
|
63
75
|
this.discarding = true;
|
|
64
|
-
|
|
65
|
-
this.
|
|
76
|
+
const head = Buffer.concat([...this.chunks, segment]).subarray(0, OVERSIZE_PREFIX_BYTES);
|
|
77
|
+
this.chunks = [head];
|
|
66
78
|
this.bytes += segmentBytes;
|
|
67
79
|
return;
|
|
68
80
|
}
|
|
69
|
-
this.
|
|
70
|
-
this.rawChunks.push(Buffer.from(segment));
|
|
81
|
+
this.chunks.push(Buffer.from(segment));
|
|
71
82
|
this.bytes += segmentBytes;
|
|
72
83
|
}
|
|
73
84
|
deliver() {
|
|
74
|
-
const
|
|
85
|
+
const raw = this.chunks.length === 0 ? void 0 : Buffer.concat(this.chunks);
|
|
86
|
+
const line = raw === void 0 ? "" : raw.toString("utf8");
|
|
75
87
|
const bytes = this.bytes;
|
|
76
88
|
const oversize = this.discarding;
|
|
77
|
-
|
|
78
|
-
this.buffer = "";
|
|
79
|
-
this.rawChunks = [];
|
|
89
|
+
this.chunks = [];
|
|
80
90
|
this.bytes = 0;
|
|
81
91
|
this.discarding = false;
|
|
82
92
|
if (oversize) {
|
|
@@ -3950,7 +3960,7 @@ function mapAuditError(error, engineMethod = "last_evidence") {
|
|
|
3950
3960
|
}
|
|
3951
3961
|
|
|
3952
3962
|
// src/dispatch.ts
|
|
3953
|
-
var SERVER_INFO = { name: "glasspane-mcp", version: "1.29.
|
|
3963
|
+
var SERVER_INFO = { name: "glasspane-mcp", version: "1.29.1" };
|
|
3954
3964
|
|
|
3955
3965
|
// src/http-gateway.ts
|
|
3956
3966
|
var GLASSPANE_HTTP_TOKEN_ENV = "GLASSPANE_HTTP_TOKEN";
|
|
@@ -4523,13 +4533,24 @@ async function handleToolForward(name, req, client, res, bodyReadTimeoutMs = DEF
|
|
|
4523
4533
|
await failEngine(res, error, spec, engineBody(checked.value));
|
|
4524
4534
|
}
|
|
4525
4535
|
}
|
|
4536
|
+
function daemonCliCommand(...flags) {
|
|
4537
|
+
const installed = path4.join(
|
|
4538
|
+
os3.homedir(),
|
|
4539
|
+
"Applications",
|
|
4540
|
+
"GlassPane Daemon.app",
|
|
4541
|
+
"Contents",
|
|
4542
|
+
"MacOS",
|
|
4543
|
+
"glasspaned"
|
|
4544
|
+
);
|
|
4545
|
+
return [quoteShellArg(installed), ...flags].join(" ");
|
|
4546
|
+
}
|
|
4526
4547
|
function handleEvidenceStats(res) {
|
|
4527
4548
|
fail(
|
|
4528
4549
|
res,
|
|
4529
4550
|
501,
|
|
4530
4551
|
HTTP_NOT_PROVIDED,
|
|
4531
4552
|
"evidence statistics are not exposed over this daemon's socket protocol in this build",
|
|
4532
|
-
|
|
4553
|
+
`run \`${daemonCliCommand("--evidence-stats")}\` against the same --state-dir this socket serves to get count/totalBytes/listFailure/dir`
|
|
4533
4554
|
);
|
|
4534
4555
|
}
|
|
4535
4556
|
async function handleRecipeValidate(req, res, bodyReadTimeoutMs = DEFAULT_BODY_READ_TIMEOUT_MS) {
|
|
@@ -4564,7 +4585,7 @@ async function handleRecipeValidate(req, res, bodyReadTimeoutMs = DEFAULT_BODY_R
|
|
|
4564
4585
|
501,
|
|
4565
4586
|
HTTP_NOT_PROVIDED,
|
|
4566
4587
|
"recipe validation is not exposed over this daemon's socket protocol in this build",
|
|
4567
|
-
|
|
4588
|
+
`run \`${daemonCliCommand("--recipe-validate", "<recipe.json-path>")}\`; this build provides no socket method for it`
|
|
4568
4589
|
);
|
|
4569
4590
|
}
|
|
4570
4591
|
function authorized(req, expected) {
|
|
@@ -4853,6 +4874,7 @@ export {
|
|
|
4853
4874
|
assertLoopbackHost,
|
|
4854
4875
|
assertTokenPolicy,
|
|
4855
4876
|
createHttpGateway,
|
|
4877
|
+
daemonCliCommand,
|
|
4856
4878
|
isLoopbackHost,
|
|
4857
4879
|
setGatewayReportSink
|
|
4858
4880
|
};
|
package/dist/index.js
CHANGED
|
@@ -1473,17 +1473,28 @@ var LineReader = class {
|
|
|
1473
1473
|
this.sink = sink;
|
|
1474
1474
|
}
|
|
1475
1475
|
sink;
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1476
|
+
/**
|
|
1477
|
+
* Bytes of the line in progress, in arrival order. Decoding happens ONCE, at delivery.
|
|
1478
|
+
*
|
|
1479
|
+
* The previous version decoded every segment on its own (`segment.toString("utf8")`) and
|
|
1480
|
+
* concatenated the results into a string. A chunk boundary that lands inside a multi-byte
|
|
1481
|
+
* UTF-8 sequence is normal for frames larger than a socket read: the left half ends the
|
|
1482
|
+
* segment, the right half starts the next one, and `toString` replaces both with U+FFFD.
|
|
1483
|
+
* `JSON.parse` still succeeded, so a daemon reply carrying screen text (`observe`,
|
|
1484
|
+
* `last_evidence`) reached the agent and the report renderer with that text silently
|
|
1485
|
+
* rewritten, while `bytes`/`raw` stayed correct — the shape looked fine, only the content
|
|
1486
|
+
* had been edited. Measured 2026-11-04: feeding `{"title":"数据"}\n` (19 bytes) split at
|
|
1487
|
+
* each of its 18 positions corrupts the title at 4 of them.
|
|
1488
|
+
*/
|
|
1489
|
+
chunks = [];
|
|
1490
|
+
/** UTF-8 bytes seen for the line in progress (counted past the cap, never all retained). */
|
|
1480
1491
|
bytes = 0;
|
|
1481
1492
|
/** The line in progress already blew the cap; only the head is retained. */
|
|
1482
1493
|
discarding = false;
|
|
1483
1494
|
/**
|
|
1484
1495
|
* @param chunk a fragment from the stream. A `Buffer` keeps the wire bytes for
|
|
1485
|
-
* {@link LineSink.onLine}; a string is
|
|
1486
|
-
*
|
|
1496
|
+
* {@link LineSink.onLine}; a string is encoded to UTF-8 first, so the byte count
|
|
1497
|
+
* stays a byte count either way.
|
|
1487
1498
|
*/
|
|
1488
1499
|
push(chunk) {
|
|
1489
1500
|
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
|
|
@@ -1500,36 +1511,33 @@ var LineReader = class {
|
|
|
1500
1511
|
}
|
|
1501
1512
|
/** Partial line so far; only the retained head while a line is discarded. */
|
|
1502
1513
|
pendingText() {
|
|
1503
|
-
return this.
|
|
1514
|
+
return this.chunks.length === 0 ? "" : Buffer.concat(this.chunks).toString("utf8");
|
|
1504
1515
|
}
|
|
1505
1516
|
consume(segment) {
|
|
1506
1517
|
const segmentBytes = segment.length;
|
|
1507
1518
|
if (segmentBytes === 0 && !this.discarding) {
|
|
1508
1519
|
return;
|
|
1509
1520
|
}
|
|
1510
|
-
const text = segment.toString("utf8");
|
|
1511
1521
|
if (this.discarding) {
|
|
1512
1522
|
this.bytes += segmentBytes;
|
|
1513
1523
|
return;
|
|
1514
1524
|
}
|
|
1515
1525
|
if (this.bytes + segmentBytes > MAX_FRAME_BYTES) {
|
|
1516
1526
|
this.discarding = true;
|
|
1517
|
-
|
|
1518
|
-
this.
|
|
1527
|
+
const head = Buffer.concat([...this.chunks, segment]).subarray(0, OVERSIZE_PREFIX_BYTES);
|
|
1528
|
+
this.chunks = [head];
|
|
1519
1529
|
this.bytes += segmentBytes;
|
|
1520
1530
|
return;
|
|
1521
1531
|
}
|
|
1522
|
-
this.
|
|
1523
|
-
this.rawChunks.push(Buffer.from(segment));
|
|
1532
|
+
this.chunks.push(Buffer.from(segment));
|
|
1524
1533
|
this.bytes += segmentBytes;
|
|
1525
1534
|
}
|
|
1526
1535
|
deliver() {
|
|
1527
|
-
const
|
|
1536
|
+
const raw = this.chunks.length === 0 ? void 0 : Buffer.concat(this.chunks);
|
|
1537
|
+
const line = raw === void 0 ? "" : raw.toString("utf8");
|
|
1528
1538
|
const bytes = this.bytes;
|
|
1529
1539
|
const oversize = this.discarding;
|
|
1530
|
-
|
|
1531
|
-
this.buffer = "";
|
|
1532
|
-
this.rawChunks = [];
|
|
1540
|
+
this.chunks = [];
|
|
1533
1541
|
this.bytes = 0;
|
|
1534
1542
|
this.discarding = false;
|
|
1535
1543
|
if (oversize) {
|
|
@@ -5046,7 +5054,7 @@ var SUPPORTED_PROTOCOL_VERSIONS = [
|
|
|
5046
5054
|
"2025-03-26",
|
|
5047
5055
|
MCP_PROTOCOL_VERSION
|
|
5048
5056
|
];
|
|
5049
|
-
var SERVER_INFO = { name: "glasspane-mcp", version: "1.29.
|
|
5057
|
+
var SERVER_INFO = { name: "glasspane-mcp", version: "1.29.1" };
|
|
5050
5058
|
var PARSE_ERROR = -32700;
|
|
5051
5059
|
var INVALID_REQUEST = -32600;
|
|
5052
5060
|
var METHOD_NOT_FOUND = -32601;
|
|
@@ -5355,8 +5363,8 @@ Socket, in the order this shell resolves it:
|
|
|
5355
5363
|
2. GLASSPANE_ENGINE_SOCK=<path>
|
|
5356
5364
|
3. $HOME/.glasspane/engine.sock \u2014 a guess read from this process's HOME, not
|
|
5357
5365
|
the daemon's rule: glasspaned's own default is the home folder the system
|
|
5358
|
-
reports, which a HOME you export does not move, and
|
|
5359
|
-
<dir> serves <dir>/daemon.sock instead.
|
|
5366
|
+
reports, which a HOME you export does not move, and a daemon started with
|
|
5367
|
+
--state-dir <dir> serves <dir>/daemon.sock instead.
|
|
5360
5368
|
|
|
5361
5369
|
So "nothing is listening on the default path" means this shell guessed a
|
|
5362
5370
|
different directory, not that the daemon is dead. Connect to the socket the
|
package/dist/io.d.ts
CHANGED
|
@@ -64,18 +64,29 @@ export interface LineSink {
|
|
|
64
64
|
*/
|
|
65
65
|
export declare class LineReader {
|
|
66
66
|
private readonly sink;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Bytes of the line in progress, in arrival order. Decoding happens ONCE, at delivery.
|
|
69
|
+
*
|
|
70
|
+
* The previous version decoded every segment on its own (`segment.toString("utf8")`) and
|
|
71
|
+
* concatenated the results into a string. A chunk boundary that lands inside a multi-byte
|
|
72
|
+
* UTF-8 sequence is normal for frames larger than a socket read: the left half ends the
|
|
73
|
+
* segment, the right half starts the next one, and `toString` replaces both with U+FFFD.
|
|
74
|
+
* `JSON.parse` still succeeded, so a daemon reply carrying screen text (`observe`,
|
|
75
|
+
* `last_evidence`) reached the agent and the report renderer with that text silently
|
|
76
|
+
* rewritten, while `bytes`/`raw` stayed correct — the shape looked fine, only the content
|
|
77
|
+
* had been edited. Measured 2026-11-04: feeding `{"title":"数据"}\n` (19 bytes) split at
|
|
78
|
+
* each of its 18 positions corrupts the title at 4 of them.
|
|
79
|
+
*/
|
|
80
|
+
private chunks;
|
|
81
|
+
/** UTF-8 bytes seen for the line in progress (counted past the cap, never all retained). */
|
|
71
82
|
private bytes;
|
|
72
83
|
/** The line in progress already blew the cap; only the head is retained. */
|
|
73
84
|
private discarding;
|
|
74
85
|
constructor(sink: LineSink);
|
|
75
86
|
/**
|
|
76
87
|
* @param chunk a fragment from the stream. A `Buffer` keeps the wire bytes for
|
|
77
|
-
* {@link LineSink.onLine}; a string is
|
|
78
|
-
*
|
|
88
|
+
* {@link LineSink.onLine}; a string is encoded to UTF-8 first, so the byte count
|
|
89
|
+
* stays a byte count either way.
|
|
79
90
|
*/
|
|
80
91
|
push(chunk: string | Buffer): void;
|
|
81
92
|
/** Partial line so far; only the retained head while a line is discarded. */
|
package/dist/stdio-session.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface CliOptions {
|
|
|
29
29
|
* a daemon started with `--state-dir` binds `<state-dir>/daemon.sock` where no
|
|
30
30
|
* `HOME` value points. `defaultSocketPath` carries the full reason.
|
|
31
31
|
*/
|
|
32
|
-
export declare const USAGE = "usage: glasspane-mcp [--socket-path <path>]\n\nBridges an AI agent (MCP stdio) to the GlassPane engine daemon.\n\nSocket, in the order this shell resolves it:\n 1. --socket-path <path>\n 2. GLASSPANE_ENGINE_SOCK=<path>\n 3. $HOME/.glasspane/engine.sock \u2014 a guess read from this process's HOME, not\n the daemon's rule: glasspaned's own default is the home folder the system\n reports, which a HOME you export does not move, and
|
|
32
|
+
export declare const USAGE = "usage: glasspane-mcp [--socket-path <path>]\n\nBridges an AI agent (MCP stdio) to the GlassPane engine daemon.\n\nSocket, in the order this shell resolves it:\n 1. --socket-path <path>\n 2. GLASSPANE_ENGINE_SOCK=<path>\n 3. $HOME/.glasspane/engine.sock \u2014 a guess read from this process's HOME, not\n the daemon's rule: glasspaned's own default is the home folder the system\n reports, which a HOME you export does not move, and a daemon started with\n --state-dir <dir> serves <dir>/daemon.sock instead.\n\nSo \"nothing is listening on the default path\" means this shell guessed a\ndifferent directory, not that the daemon is dead. Connect to the socket the\ndaemon is really on \u2014 read it, do not re-derive it:\n launchctl print gui/$(id -u)/com.glasspane.daemon # the installed job's --socket-path value\n glasspane-mcp --socket-path <that path> # or, equivalently:\n GLASSPANE_ENGINE_SOCK=<that path> glasspane-mcp\nA daemon started by hand with --state-dir has no launchd job to read: pass it\n<state-dir>/daemon.sock.\n";
|
|
33
33
|
export declare function parseArgs(argv: readonly string[]): CliOptions;
|
|
34
34
|
/**
|
|
35
35
|
* JSON-RPC answer to a request frame that could not be framed at all.
|
package/dist/stdio-session.js
CHANGED
|
@@ -1468,17 +1468,28 @@ var LineReader = class {
|
|
|
1468
1468
|
this.sink = sink;
|
|
1469
1469
|
}
|
|
1470
1470
|
sink;
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1471
|
+
/**
|
|
1472
|
+
* Bytes of the line in progress, in arrival order. Decoding happens ONCE, at delivery.
|
|
1473
|
+
*
|
|
1474
|
+
* The previous version decoded every segment on its own (`segment.toString("utf8")`) and
|
|
1475
|
+
* concatenated the results into a string. A chunk boundary that lands inside a multi-byte
|
|
1476
|
+
* UTF-8 sequence is normal for frames larger than a socket read: the left half ends the
|
|
1477
|
+
* segment, the right half starts the next one, and `toString` replaces both with U+FFFD.
|
|
1478
|
+
* `JSON.parse` still succeeded, so a daemon reply carrying screen text (`observe`,
|
|
1479
|
+
* `last_evidence`) reached the agent and the report renderer with that text silently
|
|
1480
|
+
* rewritten, while `bytes`/`raw` stayed correct — the shape looked fine, only the content
|
|
1481
|
+
* had been edited. Measured 2026-11-04: feeding `{"title":"数据"}\n` (19 bytes) split at
|
|
1482
|
+
* each of its 18 positions corrupts the title at 4 of them.
|
|
1483
|
+
*/
|
|
1484
|
+
chunks = [];
|
|
1485
|
+
/** UTF-8 bytes seen for the line in progress (counted past the cap, never all retained). */
|
|
1475
1486
|
bytes = 0;
|
|
1476
1487
|
/** The line in progress already blew the cap; only the head is retained. */
|
|
1477
1488
|
discarding = false;
|
|
1478
1489
|
/**
|
|
1479
1490
|
* @param chunk a fragment from the stream. A `Buffer` keeps the wire bytes for
|
|
1480
|
-
* {@link LineSink.onLine}; a string is
|
|
1481
|
-
*
|
|
1491
|
+
* {@link LineSink.onLine}; a string is encoded to UTF-8 first, so the byte count
|
|
1492
|
+
* stays a byte count either way.
|
|
1482
1493
|
*/
|
|
1483
1494
|
push(chunk) {
|
|
1484
1495
|
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
|
|
@@ -1495,36 +1506,33 @@ var LineReader = class {
|
|
|
1495
1506
|
}
|
|
1496
1507
|
/** Partial line so far; only the retained head while a line is discarded. */
|
|
1497
1508
|
pendingText() {
|
|
1498
|
-
return this.
|
|
1509
|
+
return this.chunks.length === 0 ? "" : Buffer.concat(this.chunks).toString("utf8");
|
|
1499
1510
|
}
|
|
1500
1511
|
consume(segment) {
|
|
1501
1512
|
const segmentBytes = segment.length;
|
|
1502
1513
|
if (segmentBytes === 0 && !this.discarding) {
|
|
1503
1514
|
return;
|
|
1504
1515
|
}
|
|
1505
|
-
const text = segment.toString("utf8");
|
|
1506
1516
|
if (this.discarding) {
|
|
1507
1517
|
this.bytes += segmentBytes;
|
|
1508
1518
|
return;
|
|
1509
1519
|
}
|
|
1510
1520
|
if (this.bytes + segmentBytes > MAX_FRAME_BYTES) {
|
|
1511
1521
|
this.discarding = true;
|
|
1512
|
-
|
|
1513
|
-
this.
|
|
1522
|
+
const head = Buffer.concat([...this.chunks, segment]).subarray(0, OVERSIZE_PREFIX_BYTES);
|
|
1523
|
+
this.chunks = [head];
|
|
1514
1524
|
this.bytes += segmentBytes;
|
|
1515
1525
|
return;
|
|
1516
1526
|
}
|
|
1517
|
-
this.
|
|
1518
|
-
this.rawChunks.push(Buffer.from(segment));
|
|
1527
|
+
this.chunks.push(Buffer.from(segment));
|
|
1519
1528
|
this.bytes += segmentBytes;
|
|
1520
1529
|
}
|
|
1521
1530
|
deliver() {
|
|
1522
|
-
const
|
|
1531
|
+
const raw = this.chunks.length === 0 ? void 0 : Buffer.concat(this.chunks);
|
|
1532
|
+
const line = raw === void 0 ? "" : raw.toString("utf8");
|
|
1523
1533
|
const bytes = this.bytes;
|
|
1524
1534
|
const oversize = this.discarding;
|
|
1525
|
-
|
|
1526
|
-
this.buffer = "";
|
|
1527
|
-
this.rawChunks = [];
|
|
1535
|
+
this.chunks = [];
|
|
1528
1536
|
this.bytes = 0;
|
|
1529
1537
|
this.discarding = false;
|
|
1530
1538
|
if (oversize) {
|
|
@@ -5041,7 +5049,7 @@ var SUPPORTED_PROTOCOL_VERSIONS = [
|
|
|
5041
5049
|
"2025-03-26",
|
|
5042
5050
|
MCP_PROTOCOL_VERSION
|
|
5043
5051
|
];
|
|
5044
|
-
var SERVER_INFO = { name: "glasspane-mcp", version: "1.29.
|
|
5052
|
+
var SERVER_INFO = { name: "glasspane-mcp", version: "1.29.1" };
|
|
5045
5053
|
var PARSE_ERROR = -32700;
|
|
5046
5054
|
var INVALID_REQUEST = -32600;
|
|
5047
5055
|
var METHOD_NOT_FOUND = -32601;
|
|
@@ -5350,8 +5358,8 @@ Socket, in the order this shell resolves it:
|
|
|
5350
5358
|
2. GLASSPANE_ENGINE_SOCK=<path>
|
|
5351
5359
|
3. $HOME/.glasspane/engine.sock \u2014 a guess read from this process's HOME, not
|
|
5352
5360
|
the daemon's rule: glasspaned's own default is the home folder the system
|
|
5353
|
-
reports, which a HOME you export does not move, and
|
|
5354
|
-
<dir> serves <dir>/daemon.sock instead.
|
|
5361
|
+
reports, which a HOME you export does not move, and a daemon started with
|
|
5362
|
+
--state-dir <dir> serves <dir>/daemon.sock instead.
|
|
5355
5363
|
|
|
5356
5364
|
So "nothing is listening on the default path" means this shell guessed a
|
|
5357
5365
|
different directory, not that the daemon is dead. Connect to the socket the
|
package/package.json
CHANGED