glasspane-mcp 1.28.0 → 1.29.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/dist/dispatch.d.ts +1 -1
- package/dist/engine-client.d.ts +1 -1
- package/dist/http-gateway-cli.js +62 -45
- package/dist/http-gateway.js +62 -45
- package/dist/index.js +65 -51
- package/dist/io.d.ts +18 -4
- package/dist/project-registry.d.ts +4 -2
- package/dist/stdio-session.js +65 -51
- package/package.json +2 -2
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
|
+
readonly version: "1.29.0";
|
|
30
30
|
};
|
|
31
31
|
export declare const PARSE_ERROR = -32700;
|
|
32
32
|
export declare const INVALID_REQUEST = -32600;
|
package/dist/engine-client.d.ts
CHANGED
|
@@ -684,7 +684,7 @@ export declare class EngineJsonRpcClient {
|
|
|
684
684
|
*
|
|
685
685
|
* The reverse mutation is to interpolate the frame back into any of those seven lines.
|
|
686
686
|
*/
|
|
687
|
-
export declare function frameBodyNotLoggedNote(serializedFrame: string): string;
|
|
687
|
+
export declare function frameBodyNotLoggedNote(serializedFrame: string, wireBytes?: Buffer): string;
|
|
688
688
|
/**
|
|
689
689
|
* A single frame *field* quoted into a log line, bounded.
|
|
690
690
|
*
|
package/dist/http-gateway-cli.js
CHANGED
|
@@ -47,56 +47,68 @@ var LineReader = class {
|
|
|
47
47
|
}
|
|
48
48
|
sink;
|
|
49
49
|
buffer = "";
|
|
50
|
+
/** Wire bytes of the line in progress; emptied the moment the line is discarded. */
|
|
51
|
+
rawChunks = [];
|
|
50
52
|
/** UTF-8 bytes seen for the line in progress (counted, not all retained). */
|
|
51
53
|
bytes = 0;
|
|
52
54
|
/** The line in progress already blew the cap; only the head is retained. */
|
|
53
55
|
discarding = false;
|
|
54
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* @param chunk a fragment from the stream. A `Buffer` keeps the wire bytes for
|
|
58
|
+
* {@link LineSink.onLine}; a string is decoded as UTF-8 first, so the byte
|
|
59
|
+
* count stays a byte count either way.
|
|
60
|
+
*/
|
|
55
61
|
push(chunk) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, "utf8");
|
|
63
|
+
let start = 0;
|
|
64
|
+
while (start < bytes.length) {
|
|
65
|
+
const nl = bytes.indexOf(10, start);
|
|
66
|
+
const segment = nl === -1 ? bytes.subarray(start) : bytes.subarray(start, nl);
|
|
67
|
+
this.consume(segment);
|
|
68
|
+
if (nl === -1) break;
|
|
69
|
+
this.deliver();
|
|
70
|
+
start = nl + 1;
|
|
65
71
|
}
|
|
72
|
+
if (bytes.length === 0) this.consume(bytes);
|
|
66
73
|
}
|
|
67
74
|
/** Partial line so far; only the retained head while a line is discarded. */
|
|
68
75
|
pendingText() {
|
|
69
76
|
return this.buffer;
|
|
70
77
|
}
|
|
71
78
|
consume(segment) {
|
|
72
|
-
|
|
79
|
+
const segmentBytes = segment.length;
|
|
80
|
+
if (segmentBytes === 0 && !this.discarding) {
|
|
73
81
|
return;
|
|
74
82
|
}
|
|
75
|
-
const
|
|
83
|
+
const text = segment.toString("utf8");
|
|
76
84
|
if (this.discarding) {
|
|
77
85
|
this.bytes += segmentBytes;
|
|
78
86
|
return;
|
|
79
87
|
}
|
|
80
88
|
if (this.bytes + segmentBytes > MAX_FRAME_BYTES) {
|
|
81
89
|
this.discarding = true;
|
|
82
|
-
this.buffer = this.buffer.length >= OVERSIZE_PREFIX_BYTES ? this.buffer.slice(0, OVERSIZE_PREFIX_BYTES) : (this.buffer +
|
|
90
|
+
this.buffer = this.buffer.length >= OVERSIZE_PREFIX_BYTES ? this.buffer.slice(0, OVERSIZE_PREFIX_BYTES) : (this.buffer + text).slice(0, OVERSIZE_PREFIX_BYTES);
|
|
91
|
+
this.rawChunks = [];
|
|
83
92
|
this.bytes += segmentBytes;
|
|
84
93
|
return;
|
|
85
94
|
}
|
|
86
|
-
this.buffer +=
|
|
95
|
+
this.buffer += text;
|
|
96
|
+
this.rawChunks.push(Buffer.from(segment));
|
|
87
97
|
this.bytes += segmentBytes;
|
|
88
98
|
}
|
|
89
99
|
deliver() {
|
|
90
100
|
const line = this.buffer;
|
|
91
101
|
const bytes = this.bytes;
|
|
92
102
|
const oversize = this.discarding;
|
|
103
|
+
const raw = this.rawChunks.length === 0 ? void 0 : Buffer.concat(this.rawChunks);
|
|
93
104
|
this.buffer = "";
|
|
105
|
+
this.rawChunks = [];
|
|
94
106
|
this.bytes = 0;
|
|
95
107
|
this.discarding = false;
|
|
96
108
|
if (oversize) {
|
|
97
109
|
this.sink.onOversize(bytes, line);
|
|
98
110
|
} else {
|
|
99
|
-
this.sink.onLine(line);
|
|
111
|
+
this.sink.onLine(line, raw);
|
|
100
112
|
}
|
|
101
113
|
}
|
|
102
114
|
};
|
|
@@ -136,10 +148,9 @@ var StreamLineIo = class {
|
|
|
136
148
|
this.input = input;
|
|
137
149
|
this.output = output;
|
|
138
150
|
this.reader = new LineReader({
|
|
139
|
-
onLine: (line) => this.messageHandler?.(line),
|
|
151
|
+
onLine: (line, raw) => this.messageHandler?.(line, raw),
|
|
140
152
|
onOversize: (bytes, prefix) => this.errorHandler?.(new OversizeFrameError(bytes, prefix))
|
|
141
153
|
});
|
|
142
|
-
input.setEncoding("utf8");
|
|
143
154
|
input.on("data", (chunk) => this.reader.push(chunk));
|
|
144
155
|
input.on("close", () => this.closeHandler?.());
|
|
145
156
|
input.on("error", (error) => this.errorHandler?.(error));
|
|
@@ -732,16 +743,16 @@ var EngineJsonRpcClient = class {
|
|
|
732
743
|
this.pending.delete(evicted.id);
|
|
733
744
|
this.report(`dropped late-reply tracking for '${evicted.method}' (id ${evicted.id}): retention cap ${LATE_REPLY_RETENTION} reached`);
|
|
734
745
|
}
|
|
735
|
-
handleMessage(line) {
|
|
746
|
+
handleMessage(line, raw) {
|
|
736
747
|
let parsed;
|
|
737
748
|
try {
|
|
738
749
|
parsed = JSON.parse(line);
|
|
739
750
|
} catch {
|
|
740
|
-
this.report(`engine sent a non-JSON frame, dropped: ${frameBodyNotLoggedNote(line)}`);
|
|
751
|
+
this.report(`engine sent a non-JSON frame, dropped: ${frameBodyNotLoggedNote(line, raw)}`);
|
|
741
752
|
return;
|
|
742
753
|
}
|
|
743
754
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
744
|
-
this.report(`engine sent a frame that is not a JSON object, dropped: ${frameBodyNotLoggedNote(line)}`);
|
|
755
|
+
this.report(`engine sent a frame that is not a JSON object, dropped: ${frameBodyNotLoggedNote(line, raw)}`);
|
|
745
756
|
return;
|
|
746
757
|
}
|
|
747
758
|
const frame = parsed;
|
|
@@ -752,7 +763,7 @@ var EngineJsonRpcClient = class {
|
|
|
752
763
|
const tracked = [...this.pending.values()];
|
|
753
764
|
const held = tracked.length === 0 ? "nothing is tracked now" : `this client still tracks ${tracked.length} request(s): ` + tracked.map((kept) => "'" + kept.method + "' id " + kept.id + (kept.settled ? " (caller already answered)" : "")).join(", ");
|
|
754
765
|
this.report(
|
|
755
|
-
`engine sent a frame for request id ${id}, which this client never issued (or already gave up on); ` + held + ": " + frameBodyNotLoggedNote(line)
|
|
766
|
+
`engine sent a frame for request id ${id}, which this client never issued (or already gave up on); ` + held + ": " + frameBodyNotLoggedNote(line, raw)
|
|
756
767
|
);
|
|
757
768
|
return;
|
|
758
769
|
}
|
|
@@ -779,13 +790,13 @@ var EngineJsonRpcClient = class {
|
|
|
779
790
|
this.retainForLateReply();
|
|
780
791
|
return;
|
|
781
792
|
}
|
|
782
|
-
this.report(`engine sent an id-less frame with a result while '${target.method}' (id ${target.id}) is still waiting for its answer; an id-less answer from this daemon is an error frame, so this one was not delivered to any caller: ${frameBodyNotLoggedNote(line)}`);
|
|
793
|
+
this.report(`engine sent an id-less frame with a result while '${target.method}' (id ${target.id}) is still waiting for its answer; an id-less answer from this daemon is an error frame, so this one was not delivered to any caller: ${frameBodyNotLoggedNote(line, raw)}`);
|
|
783
794
|
return;
|
|
784
795
|
}
|
|
785
|
-
this.report(frame.error ? `engine reported ${this.engineError(frame.error, null).code} with no request in flight: ${frameBodyNotLoggedNote(line)}` : `engine sent an id-less frame with no request in flight: ${frameBodyNotLoggedNote(line)}`);
|
|
796
|
+
this.report(frame.error ? `engine reported ${this.engineError(frame.error, null).code} with no request in flight: ${frameBodyNotLoggedNote(line, raw)}` : `engine sent an id-less frame with no request in flight: ${frameBodyNotLoggedNote(line, raw)}`);
|
|
786
797
|
return;
|
|
787
798
|
}
|
|
788
|
-
this.report(`engine sent a frame with a non-numeric request id (${shortFieldValue(id)}), which this client never issues: ${frameBodyNotLoggedNote(line)}`);
|
|
799
|
+
this.report(`engine sent a frame with a non-numeric request id (${shortFieldValue(id)}), which this client never issues: ${frameBodyNotLoggedNote(line, raw)}`);
|
|
789
800
|
}
|
|
790
801
|
settleFromFrame(entry, frame) {
|
|
791
802
|
if (frame.error) {
|
|
@@ -1049,10 +1060,11 @@ function attribute(error, entry, inferred = true) {
|
|
|
1049
1060
|
error.remedy
|
|
1050
1061
|
);
|
|
1051
1062
|
}
|
|
1052
|
-
function frameBodyNotLoggedNote(serializedFrame) {
|
|
1053
|
-
const
|
|
1054
|
-
const
|
|
1055
|
-
|
|
1063
|
+
function frameBodyNotLoggedNote(serializedFrame, wireBytes) {
|
|
1064
|
+
const source = wireBytes ?? Buffer.from(serializedFrame, "utf8");
|
|
1065
|
+
const bytes = source.length;
|
|
1066
|
+
const digest = createHash("sha256").update(source).digest("hex").slice(0, 12);
|
|
1067
|
+
return `a ${bytes}-byte frame (sha256 ${digest}, ${wireBytes ? "of the exact bytes this transport received" : "of the frame text as this transport decoded it"}) whose text is not written to this log: on this socket a frame body is on-screen accessibility content \u2014 element titles and values, sometimes a document's text \u2014 and this log's sink is a file this product never sets the mode of, so the state root's 0700 does not cover it. Anything the daemon did record is in its evidence archive under the state root, read back with gp_last_evidence {operationId} or gp_export_evidence {operationId}`;
|
|
1056
1068
|
}
|
|
1057
1069
|
function shortFieldValue(value) {
|
|
1058
1070
|
const text = JSON.stringify(value) ?? String(value);
|
|
@@ -2270,7 +2282,7 @@ function refusedStateRootMessage(raw, defect) {
|
|
|
2270
2282
|
suggested = `${stripFirmlink(path3.posix.normalize(systemHome()))}/.glasspane`;
|
|
2271
2283
|
} catch {
|
|
2272
2284
|
}
|
|
2273
|
-
return `the background service's self-reported state root ${defect}, so this shell refuses to use it: ${quoteShellArg(raw)}. That value is not a choice this process made \u2014 it is the \`stateRoot\` field of the \`hello\` frame the daemon answered, and the engine socket has no peer authentication (SECURITY.md: any process running as this user may answer one), so a reply can name a directory this install does not own. \`gp_project_*\` would have created that directory and re-permissioned it to 0700 before writing projects.json into it, which is the daemon's own \`--state-dir\` guard arriving one step late: \`StateRoot.notADedicatedRoot\` rejects the same two shapes at the argument precisely so that nothing is ever touched. This shell will not create or re-permission that path, and it will NOT quietly fall back to the home default instead \u2014 writing a different file while reporting success is the failure this registry refuses by design. Nothing was read and nothing was written: no directory was created, no permission was changed, no projects.json was opened, listed or saved. Move the service onto a directory this install owns: start it as ` + (suggested === null ? "
|
|
2285
|
+
return `the background service's self-reported state root ${defect}, so this shell refuses to use it: ${quoteShellArg(raw)}. That value is not a choice this process made \u2014 it is the \`stateRoot\` field of the \`hello\` frame the daemon answered, and the engine socket has no peer authentication (SECURITY.md: any process running as this user may answer one), so a reply can name a directory this install does not own. \`gp_project_*\` would have created that directory and re-permissioned it to 0700 before writing projects.json into it, which is the daemon's own \`--state-dir\` guard arriving one step late: \`StateRoot.notADedicatedRoot\` rejects the same two shapes at the argument precisely so that nothing is ever touched. This shell will not create or re-permission that path, and it will NOT quietly fall back to the home default instead \u2014 writing a different file while reporting success is the failure this registry refuses by design. Nothing was read and nothing was written: no directory was created, no permission was changed, no projects.json was opened, listed or saved. Move the service onto a directory this install owns: start it as ` + (suggested === null ? "`$HOME/Applications/GlassPane Daemon.app/Contents/MacOS/glasspaned --state-dir <a directory this install owns>` " : `\`$HOME/Applications/GlassPane Daemon.app/Contents/MacOS/glasspaned --state-dir <a directory this install owns>\` (the daemon's own suggested form is \`$HOME/Applications/GlassPane Daemon.app/Contents/MacOS/glasspaned --state-dir ${quoteShellArg(suggested)}\`) `) + `then reconnect so a fresh hello reports the new root, and repeat the call. If the reported root is not one you configured, treat the answer to that handshake as untrusted: another process on this account replied to it.`;
|
|
2274
2286
|
}
|
|
2275
2287
|
function daemonProjectsPath(daemonStateRoot) {
|
|
2276
2288
|
const named2 = typeof daemonStateRoot === "string" ? daemonStateRoot.trim() : "";
|
|
@@ -2349,7 +2361,7 @@ function refusedProjectsFileOverride(raw, defect) {
|
|
|
2349
2361
|
return new ProjectRegistryError(
|
|
2350
2362
|
GP_E_STATE_ROOT_REFUSED,
|
|
2351
2363
|
`the ${PROJECTS_FILE_ENV} override this shell was started with ${defect}, so this shell refuses to use it: ${quoteShellArg(raw)}. This is the override slot of **this process**, not a root the background service reported about itself \u2014 the daemon never reads ${PROJECTS_FILE_ENV} (R7-14), so the value being judged is one an environment, a wrapper, or an agent set for the MCP shell alone. It is not a harmless pointer either: \`gp_project_set\` would have created that directory and re-permissioned it to 0700, then written the project registry \u2014 bundle ids, pids and storage paths \u2014 into it, which is the same authority this module refuses a self-reported root over (\`StateRoot.notADedicatedRoot\`) and refuses an agent-named evidence archive over (\`refuseCandidate\`). Nothing was read and nothing was written by this call: no directory was created, no permission was changed, no projects.json was opened, listed or saved.`,
|
|
2352
|
-
`this shell's own override is what is configured, not your arguments and not a damaged file: \`unset ${PROJECTS_FILE_ENV}\` for this MCP server process and repeat gp_project_set \u2014 it then writes the projects file of the root the running daemon named in its hello, or the home default \`${quoteShellArg(defaultFile)}\` when it named none. Alternatively point the override at one of those two paths; do not point it at a tree this shell will not create or re-permission, and do not repair a projects file for this refusal \u2014 the refusal names a directory, and no path under it was touched. If the service really is running on a root this shell cannot accept, move the service instead:
|
|
2364
|
+
`this shell's own override is what is configured, not your arguments and not a damaged file: \`unset ${PROJECTS_FILE_ENV}\` for this MCP server process and repeat gp_project_set \u2014 it then writes the projects file of the root the running daemon named in its hello, or the home default \`${quoteShellArg(defaultFile)}\` when it named none. Alternatively point the override at one of those two paths; do not point it at a tree this shell will not create or re-permission, and do not repair a projects file for this refusal \u2014 the refusal names a directory, and no path under it was touched. If the service really is running on a root this shell cannot accept, move the service instead: \`$HOME/Applications/GlassPane Daemon.app/Contents/MacOS/glasspaned --state-dir <a directory this install owns>\`, then reconnect so a fresh hello reports it`
|
|
2353
2365
|
);
|
|
2354
2366
|
}
|
|
2355
2367
|
function loadRegistry(filePath) {
|
|
@@ -2559,7 +2571,7 @@ function saveProjects(filePath, entries) {
|
|
|
2559
2571
|
// The refusal above already names the two commands that make the modes true, so the
|
|
2560
2572
|
// remedy transcribes them instead of sending the reader to repair a file nobody
|
|
2561
2573
|
// called damaged (B5). Nothing here is a judgement about the registry's contents.
|
|
2562
|
-
`the mode this shell asked for did not stick, so nothing was published: bring it to the daemon's own modes yourself \u2014 \`chmod 700 ${quoteShellArg(dir)}\` and \`chmod 600 ${quoteShellArg(filePath)}\` \u2014 read them back with \`stat -f '%Sp %N' ${quoteShellArg(dir)} ${quoteShellArg(filePath)}\`, and repeat gp_project_set once they say 700 and 600. If chmod answers success and the mode stays loose, the volume ignores permissions: find out with \`ls -lO ${quoteShellArg(dir)}\` (an immutable flag) and \`diskutil info -live ${quoteShellArg(dir)}\` (a read-only or remote mount), and move the service onto a volume that honours them
|
|
2574
|
+
`the mode this shell asked for did not stick, so nothing was published: bring it to the daemon's own modes yourself \u2014 \`chmod 700 ${quoteShellArg(dir)}\` and \`chmod 600 ${quoteShellArg(filePath)}\` \u2014 read them back with \`stat -f '%Sp %N' ${quoteShellArg(dir)} ${quoteShellArg(filePath)}\`, and repeat gp_project_set once they say 700 and 600. If chmod answers success and the mode stays loose, the volume ignores permissions: find out with \`ls -lO ${quoteShellArg(dir)}\` (an immutable flag) and \`diskutil info -live ${quoteShellArg(dir)}\` (a read-only or remote mount), and move the service onto a volume that honours them \`$HOME/Applications/GlassPane Daemon.app/Contents/MacOS/glasspaned --state-dir <a directory this install owns>\`). Do not repair or overwrite projects.json for this one, and do not set ${FORCE_OVERWRITE_ENV}: the fault is the mode, not the bytes in the file`
|
|
2563
2575
|
);
|
|
2564
2576
|
}
|
|
2565
2577
|
const errno = error?.code ?? "unknown";
|
|
@@ -2710,7 +2722,7 @@ function reloadSentence(changed) {
|
|
|
2710
2722
|
return changed ? "the running background service loaded that file once when it started, so gp_attach will keep returning GP_E_NOT_FOUND for this projectId until the service restarts" : "this call rewrote the entry that file already held, field for field, so it left no new registration for the service to pick up \u2014 restarting changes nothing about an entry that was already there";
|
|
2711
2723
|
}
|
|
2712
2724
|
function rootDiscriminator() {
|
|
2713
|
-
return 'Tell the two cases apart with the service\'s own answer: gp_project_list reads the file this call wrote, so an entry it lists is on disk, and gp_attach {projectId} is answered by the running service \u2014 an entry the list shows plus an attach that answers GP_E_NOT_FOUND means the service is loading a different projects.json than the one this write reached, not that the write failed. Which file the running service loads is not something this shell guesses from $HOME:
|
|
2725
|
+
return 'Tell the two cases apart with the service\'s own answer: gp_project_list reads the file this call wrote, so an entry it lists is on disk, and gp_attach {projectId} is answered by the running service \u2014 an entry the list shows plus an attach that answers GP_E_NOT_FOUND means the service is loading a different projects.json than the one this write reached, not that the write failed. Which file the running service loads is not something this shell guesses from $HOME: `$HOME/Applications/GlassPane Daemon.app/Contents/MacOS/glasspaned --state-dir <root>` moves it to <root>/projects.json, and the daemon reports the root it resolved \u2014 `hello` names the state root under its `stateRoot` key. A daemon predating 1.15.0 omits the key, and an omitted key means "that daemon does not report it", never "so it must be the home default": for those binaries the discriminator below is the only read. Cross-check either way \u2014 `launchctl print gui/' + currentUid() + "/com.glasspane.daemon` prints the arguments the job was started with. If those arguments name a --state-dir, the entry has to go into that root's projects.json (repeat gp_project_set with " + PROJECTS_FILE_ENV + " pointed at <that root>/projects.json \u2014 this shell judges that override with the same path gates it judges every root it writes, because writing there means creating the directory and bringing it to 0700, so a shared scratch tree, a directory this user does not own, or a world-writable one is refused with " + GP_E_STATE_ROOT_REFUSED + " and nothing is written; such a service root is not a place this surface can register into, and the fix is to run the service on a root both sides accept): no restart of the service will make it read anywhere else, so restarting again changes nothing. If they name no --state-dir, the service is on the default root and simply predates this write, and one restart with the command in this notice is what surfaces it.";
|
|
2714
2726
|
}
|
|
2715
2727
|
function restartCommand() {
|
|
2716
2728
|
return `run \`launchctl kickstart -k gui/${currentUid()}/com.glasspane.daemon\` \u2014 if that reports the service was not found, the launchd job was never bootstrapped, so ${daemonUnreachableRemedy()}`;
|
|
@@ -2866,11 +2878,9 @@ function generateProjectId() {
|
|
|
2866
2878
|
const CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
2867
2879
|
const body = [];
|
|
2868
2880
|
const bytes = new Uint8Array(26);
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
}
|
|
2872
|
-
for (let i = 0; i < 26; i++) bytes[i] = Math.floor(Math.random() * 256);
|
|
2873
|
-
}
|
|
2881
|
+
randomBytes(26).forEach((byte, index) => {
|
|
2882
|
+
bytes[index] = byte;
|
|
2883
|
+
});
|
|
2874
2884
|
for (let i = 0; i < 26; i++) {
|
|
2875
2885
|
const byte = bytes[i];
|
|
2876
2886
|
body.push(CROCKFORD.charAt(byte % 32));
|
|
@@ -3266,7 +3276,7 @@ var TOOL_SPECS = [
|
|
|
3266
3276
|
additionalProperties: false,
|
|
3267
3277
|
properties: {
|
|
3268
3278
|
projectId: { type: "string", pattern: "^prj_[0-9A-HJKMNP-TV-Z]{26}$" },
|
|
3269
|
-
displayName: { type: "string", minLength: 1, maxLength:
|
|
3279
|
+
displayName: { type: "string", minLength: 1, maxLength: MAX_DISPLAY_NAME_LENGTH },
|
|
3270
3280
|
// `null` clears the field on update, so these mirror
|
|
3271
3281
|
// ProjectSetArgs' `.nullish()` rather than the old optional-string form.
|
|
3272
3282
|
// The ceiling is `gp_attach`'s, from the daemon's own bound — the identity a
|
|
@@ -3276,9 +3286,9 @@ var TOOL_SPECS = [
|
|
|
3276
3286
|
// the daemon stores (an out-of-range pid made Swift fail to decode the
|
|
3277
3287
|
// whole registry file, which then got rewritten as an empty table).
|
|
3278
3288
|
pid: { type: ["integer", "null"], minimum: 1, maximum: PID_INT32_MAX },
|
|
3279
|
-
recipeConfigPath: { type: ["string", "null"], maxLength:
|
|
3280
|
-
calibrationAssetsPath: { type: ["string", "null"], maxLength:
|
|
3281
|
-
evidenceStoragePath: { type: ["string", "null"], maxLength:
|
|
3289
|
+
recipeConfigPath: { type: ["string", "null"], maxLength: MAX_FIELD_LENGTH },
|
|
3290
|
+
calibrationAssetsPath: { type: ["string", "null"], maxLength: MAX_FIELD_LENGTH },
|
|
3291
|
+
evidenceStoragePath: { type: ["string", "null"], maxLength: MAX_FIELD_LENGTH }
|
|
3282
3292
|
},
|
|
3283
3293
|
required: ["displayName"],
|
|
3284
3294
|
// Exactly one of bundleId/pid must identify the app *after* an update is
|
|
@@ -3683,19 +3693,19 @@ function passedThroughRegistryError(error) {
|
|
|
3683
3693
|
}
|
|
3684
3694
|
function projectErrorRemedy(code) {
|
|
3685
3695
|
if (code === GP_E_PROJECT_LIMIT) {
|
|
3686
|
-
return `the limit (${MAX_PROJECTS}) counts the entries stored in the projects file named above, so a new registration cannot be made to fit by changing an existing one: gp_project_set with an existing projectId patches that entry and leaves the count where it is. See what is stored with gp_project_list, then free a slot with a removal this product does implement:
|
|
3696
|
+
return `the limit (${MAX_PROJECTS}) counts the entries stored in the projects file named above, so a new registration cannot be made to fit by changing an existing one: gp_project_set with an existing projectId patches that entry and leaves the count where it is. See what is stored with gp_project_list, then free a slot with a removal this product does implement: \`$HOME/Applications/GlassPane Daemon.app/Contents/MacOS/glasspaned --project-remove <projectId>\` removes exactly one registration, and \`$HOME/Applications/GlassPane Daemon.app/Contents/MacOS/glasspaned --project-prune\` removes only the engine's own test residue \u2014 both take \`--dry-run\` to preview and print JSON, and an unknown id exits 3. A running daemon keeps its own copy of the table, so the removal only sticks after it is restarted (the reply's requiresDaemonRestart says whether one is pending; \`launchctl kickstart -k gui/$(id -u)/com.glasspane.daemon\`). Do NOT hand-edit the projects file: the next daemon save overwrites it. To read the same set without this shell: $HOME/Applications/GlassPane Daemon.app/Contents/MacOS/glasspaned --list-projects prints the file the service loads by default`;
|
|
3687
3697
|
}
|
|
3688
3698
|
if (code === GP_E_NOT_FOUND) {
|
|
3689
3699
|
return "check the projectId; use gp_project_list to view available projects";
|
|
3690
3700
|
}
|
|
3691
3701
|
if (code === GP_E_REGISTRY_DRIFT) {
|
|
3692
|
-
return "the projects file changed between the read that produced this reply and the write it attempted, so nothing was written: re-run the same gp_project_set \u2014 what this refusal wants is a second read, not different arguments. If it repeats, another writer owns that file (the daemon's maintenance CLI and the settings panel both rewrite it): read the table with
|
|
3702
|
+
return "the projects file changed between the read that produced this reply and the write it attempted, so nothing was written: re-run the same gp_project_set \u2014 what this refusal wants is a second read, not different arguments. If it repeats, another writer owns that file (the daemon's maintenance CLI and the settings panel both rewrite it): read the table with `$HOME/Applications/GlassPane Daemon.app/Contents/MacOS/glasspaned --list-projects`, and remember a removal only sticks after the daemon restarts. `GLASSPANE_PROJECTS_FORCE_OVERWRITE=1` moves a file aside before writing, and nothing is overwritten without it.";
|
|
3693
3703
|
}
|
|
3694
3704
|
if (code === GP_E_NO_USER_RECORD) {
|
|
3695
3705
|
return "this process has no entry in the password database, so neither it nor the daemon can know which user's state directory is meant; run the shell as a user that has one (`id -u` / `dscl . -read /Users/<name> NFSHomeDirectory`). Nothing in ~/.glasspane needs repairing for this";
|
|
3696
3706
|
}
|
|
3697
3707
|
if (code === GP_E_STATE_ROOT_REFUSED) {
|
|
3698
|
-
return "the running service named a state root this shell will not create or re-permission, so nothing was read or written by this call: the refused root is named in the message above, so nothing has to be asked again. To see which root the job really starts with, run `launchctl print gui/$(id -u)/com.glasspane.daemon` (read-only \u2014 it prints the job's own arguments), and
|
|
3708
|
+
return "the running service named a state root this shell will not create or re-permission, so nothing was read or written by this call: the refused root is named in the message above, so nothing has to be asked again. To see which root the job really starts with, run `launchctl print gui/$(id -u)/com.glasspane.daemon` (read-only \u2014 it prints the job's own arguments), and `$HOME/Applications/GlassPane Daemon.app/Contents/MacOS/glasspaned --state-dir <path> --evidence-stats` echoes that run's `dir` under the root it resolved, which is how to confirm a candidate without writing anything. Then start the service with a directory this install owns (`$HOME/Applications/GlassPane Daemon.app/Contents/MacOS/glasspaned --state-dir <path>`). Do not repair projects.json for this one \u2014 the refusal names a root, not a file, and no path under that root was touched";
|
|
3699
3709
|
}
|
|
3700
3710
|
if (code === GP_E_INTERNAL) {
|
|
3701
3711
|
return `the projects file is the problem, not your arguments: the message above names its path, so read it with ${registryReaders("<that path>")}; repair or restore the damaged entry, and retry \u2014 or set ${FORCE_OVERWRITE_ENV}=1 and call gp_project_set to rebuild the registry from scratch (the unloadable file is moved aside as <path>.unreadable-<id>, never deleted, and every entry still in it is lost). Do not retry the same read-only call unchanged: it will keep failing.`;
|
|
@@ -3991,6 +4001,9 @@ function mapAuditError(error, engineMethod = "last_evidence") {
|
|
|
3991
4001
|
};
|
|
3992
4002
|
}
|
|
3993
4003
|
|
|
4004
|
+
// src/dispatch.ts
|
|
4005
|
+
var SERVER_INFO = { name: "glasspane-mcp", version: "1.29.0" };
|
|
4006
|
+
|
|
3994
4007
|
// src/http-gateway.ts
|
|
3995
4008
|
var GLASSPANE_HTTP_TOKEN_ENV = "GLASSPANE_HTTP_TOKEN";
|
|
3996
4009
|
var DEFAULT_GATEWAY_PORT = 8787;
|
|
@@ -4066,7 +4079,11 @@ function createHttpGateway(options) {
|
|
|
4066
4079
|
}
|
|
4067
4080
|
});
|
|
4068
4081
|
setGatewayReportSink(report);
|
|
4069
|
-
const client = options.connectController !== void 0 ? options.connectController(options.socketPath) : unixSocketEngineClient(options.socketPath, {
|
|
4082
|
+
const client = options.connectController !== void 0 ? options.connectController(options.socketPath) : unixSocketEngineClient(options.socketPath, {
|
|
4083
|
+
identity: { version: SERVER_INFO.version },
|
|
4084
|
+
expectedDaemonMethods: DAEMON_FORWARDED_METHODS,
|
|
4085
|
+
surface: "http"
|
|
4086
|
+
});
|
|
4070
4087
|
client.onEngineNote?.((note) => report(`engine: ${note}`));
|
|
4071
4088
|
client.onLateReply?.(({ method, result }) => {
|
|
4072
4089
|
report(`late engine reply to '${method}': the engine did answer, ${lateReplyBodyNote(stringifyReply(result), result?.operationId)}`);
|