glasspane-mcp 1.25.2 → 1.26.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/README.md CHANGED
@@ -12,8 +12,11 @@ package alone does not give you a working verification engine.
12
12
 
13
13
  ```bash
14
14
  # Fetch install.sh, then run it — two steps on purpose: piped into `sh`, a curl that fails
15
- # leaves stdin empty and the pipeline exits 0 while nothing was installed.
16
- curl -fsSL https://raw.githubusercontent.com/jingzhao-l/GlassPane/main/install.sh -o /tmp/gp-install.sh && sh /tmp/gp-install.sh
15
+ # leaves stdin empty and the pipeline exits 0 while nothing was installed. The landing file
16
+ # comes from `mktemp`: `/tmp` is mode 1777 and the sticky bit does not stop another account
17
+ # from creating `/tmp/gp-install.sh -> ~/.bashrc` first — `curl -o` follows that symlink and
18
+ # truncates the target as *you*.
19
+ GP="$(mktemp "${TMPDIR:-/tmp/}gp-install.XXXXXXXX")" && curl -fsSL https://raw.githubusercontent.com/jingzhao-l/GlassPane/main/install.sh -o "$GP" && sh "$GP" && rm -f "$GP"
17
20
  # 或:npx glasspane-install
18
21
  ```
19
22
 
@@ -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.25.2";
29
+ readonly version: "1.26.0";
30
30
  };
31
31
  export declare const PARSE_ERROR = -32700;
32
32
  export declare const INVALID_REQUEST = -32600;
@@ -150,8 +150,17 @@ var StreamLineIo = class {
150
150
  messageHandler = null;
151
151
  closeHandler = null;
152
152
  errorHandler = null;
153
- writeLine(line) {
154
- this.output.write(line + "\n");
153
+ writeLine(line, onHandedOff) {
154
+ const text = line + "\n";
155
+ if (onHandedOff === void 0) {
156
+ this.output.write(text);
157
+ return;
158
+ }
159
+ this.output.write(text, (error) => {
160
+ if (!error) {
161
+ onHandedOff();
162
+ }
163
+ });
155
164
  }
156
165
  bufferedBytes() {
157
166
  return this.output.writableLength;
@@ -577,7 +586,6 @@ var EngineJsonRpcClient = class {
577
586
  entry.timer = setTimeout(() => this.onDeadline(entry), deadlineMs);
578
587
  const backlog = this.io.bufferedBytes?.() ?? 0;
579
588
  if (backlog > ENGINE_WRITE_BACKLOG_BYTES) {
580
- this.pending.delete(id);
581
589
  this.reject(entry, new EngineCallError(
582
590
  GP_E_ENGINE_BACKLOG,
583
591
  `not sending '${method}': ${backlog} bytes are already queued for the engine socket and it has not read them`,
@@ -589,8 +597,12 @@ var EngineJsonRpcClient = class {
589
597
  const queuedBefore = this.io.bufferedBytes?.() ?? null;
590
598
  try {
591
599
  const frameText = JSON.stringify(frame);
592
- this.io.writeLine(frameText);
593
- if (queuedBefore !== null) {
600
+ let writeHandedOffConfirmed = false;
601
+ this.io.writeLine(frameText, () => {
602
+ writeHandedOffConfirmed = true;
603
+ entry.handedOff = true;
604
+ });
605
+ if (queuedBefore !== null && !writeHandedOffConfirmed) {
594
606
  const queuedAfter = this.io.bufferedBytes?.() ?? 0;
595
607
  entry.handedOff = queuedAfter < queuedBefore + frameText.length + 1;
596
608
  }
@@ -621,7 +633,8 @@ var EngineJsonRpcClient = class {
621
633
  this.report(
622
634
  `engine has not answered '${entry.method}' (id ${entry.id}) within ${entry.deadlineMs}ms \u2014 still in flight`
623
635
  );
624
- const capped = entry.methodDeadlineMs > entry.deadlineMs ? ` This shell stops waiting for an MCP client's sake at ${entry.deadlineMs}ms while the daemon gets up to ${entry.methodDeadlineMs}ms for '${entry.method}', because a client that is left hanging retries on its own and a retried '${entry.method}' runs twice.` : "";
636
+ const waitingFor = this.surface === "mcp" ? "an MCP client" : "an HTTP caller";
637
+ const capped = entry.methodDeadlineMs > entry.deadlineMs ? ` This shell stops waiting for ${waitingFor}'s sake at ${entry.deadlineMs}ms while the daemon gets up to ${entry.methodDeadlineMs}ms for '${entry.method}', because a client that is left hanging retries on its own and a retried '${entry.method}' runs twice.` : "";
625
638
  this.reject(entry, new EngineCallError(
626
639
  GP_E_ENGINE_TIMEOUT,
627
640
  `engine is still working on '${entry.method}': no reply after ${entry.deadlineMs}ms. The request stays registered \u2014 a late reply is written to the server log \u2014 so this is a busy or slow daemon, not an unreachable one. That registration lasts only while this connection does: if the transport ends first, the server log says so and names what it stopped tracking.` + capped,
@@ -735,12 +748,19 @@ var EngineJsonRpcClient = class {
735
748
  this.report(`the engine's late reply to '${entry.method}' (id ${entry.id}) exceeded the ${MAX_FRAME_BYTES}-byte frame cap (${error.bytes} bytes), so its body could not be delivered even late${inferred ? " (attributed by arrival order: the frame's head carried no readable id)" : ""}`);
736
749
  return;
737
750
  }
738
- this.pending.delete(entry.id);
739
- this.reject(entry, attribute(new EngineCallError(
751
+ const failure = new EngineCallError(
740
752
  GP_E_PAYLOAD_TOO_LARGE,
741
753
  `the engine's reply to '${entry.method}' exceeded the ${MAX_FRAME_BYTES}-byte frame cap (${error.bytes} bytes) and was dropped; the connection is intact and other requests are unaffected`,
742
754
  "narrow this request or ask for less of it; the tool's own schema names the parameters that can shrink a reply, and this shell rewrites this line into that advice when it can (the transport layer deliberately does not guess them)"
743
- ), entry, inferred));
755
+ );
756
+ if (inferred) {
757
+ this.reject(entry, attribute(failure, entry));
758
+ entry.arrivalOrderConsumed = true;
759
+ this.retainForLateReply();
760
+ return;
761
+ }
762
+ this.pending.delete(entry.id);
763
+ this.reject(entry, attribute(failure, entry, false));
744
764
  }
745
765
  /**
746
766
  * The daemon's error frame, mapped into this shell's error.
@@ -1000,8 +1020,8 @@ var ReconnectingSocketIo = class {
1000
1020
  closeHandler = null;
1001
1021
  errorHandler = null;
1002
1022
  openHandler = null;
1003
- writeLine(line) {
1004
- this.connect().writeLine(line);
1023
+ writeLine(line, onHandedOff) {
1024
+ this.connect().writeLine(line, onHandedOff);
1005
1025
  }
1006
1026
  bufferedBytes() {
1007
1027
  return this.inner?.bufferedBytes() ?? 0;
@@ -3079,7 +3099,7 @@ var TOOL_SPECS = [
3079
3099
  },
3080
3100
  {
3081
3101
  name: "gp_probe_status",
3082
- description: "List GlassPaneProbe connections and whether the attached app has a live probe \u2014 probe presence is what makes T4/T5/T7/T8 verdicts and tier-1 checkpoint restores decidable. `attachedHasProbe` is that yes/no for the attached app; `probes` holds **live** registrations only (every row `connected: true`), so a probe that dropped is absent from it rather than flagged inside it: read `recentDisconnections` for that history (`pid`, `disconnectReason`, `disconnectedAt`, per-pid `drops`), and `disconnections` is just the total count since start. Each live row can also carry the frame-accounting that makes a zero verdict readable: `stateFramesUnmappedSource` (daemon-side, per pid), and `droppedEvents` / `droppedWrites` / `rejectedKeys` / `droppedInboundFrames` / `droppedInboundLines` as the probe itself reported them \u2014 those are **absent when unreported**, which is not the same as zero, and `unmapableStateFrames` is the daemon-side total that survives a disconnect. Two more daemon-side losses are readable here: `ringEvictedEvents` on a live row (that pid's events dropped when its 512-event ring overflowed) and `ringEvictedEventsTotal` for the process \u2014 a nonzero one means that window's `hitCount` and `handlers` are a **lower bound**, not a complete measurement, and the archived pack carries the same caveat under `circuitBreaker.reason`. The same reply is where the T9 degradation watch is readable without performing an action, under `degradation` (absent when this daemon runs without T9 wired): `tier` is `healthy` / `watch` / `degrading`, and `judged` says whether that tier is a measurement at all \u2014 `judged: false` with `tier: healthy` means the window was too thin or too short to read, **not** that the app is clean; `basis` spells out which of those it is with the numbers, alongside `samples`/`minimumSamples` and `spanSeconds`/`minimumSpanSeconds`. `longSession` marks the window spanning at least the long-session threshold; it is context for the trend, and it never changes `tier` by itself. `drivers` appears only when something is trending, and `slopes` carries only the channels that produced one (`pingMsPerSec`, `memoryBytesPerSec`, `handlesPerSec`) \u2014 a channel missing from `slopes` was never read, which is not a rate of zero.",
3102
+ description: "List GlassPaneProbe connections and whether the attached app has a live probe \u2014 probe presence is what makes T4/T5/T7/T8 verdicts and tier-1 checkpoint restores decidable. `attachedHasProbe` is that yes/no for the attached app; `probes` holds **live** registrations only (every row `connected: true`), so a probe that dropped is absent from it rather than flagged inside it: read `recentDisconnections` for that history (`pid`, `disconnectReason`, `disconnectedAt`, per-pid `drops`), and `disconnections` is just the total count since start. Each live row can also carry the frame-accounting that makes a zero verdict readable: `stateFramesUnmappedSource` (daemon-side, per pid), and `droppedEvents` / `droppedWrites` / `rejectedKeys` / `droppedInboundFrames` / `droppedInboundLines` as the probe itself reported them \u2014 those are **absent when unreported**, which is not the same as zero, and `unmapableStateFrames` is the daemon-side total that survives a disconnect. Two more daemon-side losses are readable here: `ringEvictedEvents` on a live row (that pid's events dropped when its 512-event ring overflowed) and `ringEvictedEventsTotal` for the process \u2014 a nonzero one means that window's `hitCount` and `handlers` are a **lower bound**, not a complete measurement, and the archived pack carries the same caveat under `circuitBreaker.reason`. A duration the probe read but this wire cannot carry is the fourth loss with its own reading: `durationOverflowFrames` on a live row counts the `handlerDurationOverflow` frames this daemon ingested for that pid, `durationOverflowCount` on the same row is the probe's own lifetime figure (**absent when the probe never reported one**, which is not a measured zero), and `durationOverflowFramesTotal` is the process-wide count that survives the disconnect. Those frames are lost readings, not protocol violations: they never enter the event ring, so they never raise `hitCount`, and they are counted apart from the daemon's malformed frames \u2014 a `hitCount` of 0 beside a nonzero overflow count means the slow call happened and only its duration was unreadable. The same reply is where the T9 degradation watch is readable without performing an action, under `degradation` (absent when this daemon runs without T9 wired): `tier` is `healthy` / `watch` / `degrading`, and `judged` says whether that tier is a measurement at all \u2014 `judged: false` with `tier: healthy` means the window was too thin or too short to read, **not** that the app is clean; `basis` spells out which of those it is with the numbers, alongside `samples`/`minimumSamples` and `spanSeconds`/`minimumSpanSeconds`. `longSession` marks the window spanning at least the long-session threshold; it is context for the trend, and it never changes `tier` by itself. `drivers` appears only when something is trending, and `slopes` carries only the channels that produced one (`pingMsPerSec`, `memoryBytesPerSec`, `handlesPerSec`) \u2014 a channel missing from `slopes` was never read, which is not a rate of zero.",
3083
3103
  engineMethod: "probe_status",
3084
3104
  inputSchema: {
3085
3105
  type: "object",
@@ -123,8 +123,17 @@ var StreamLineIo = class {
123
123
  messageHandler = null;
124
124
  closeHandler = null;
125
125
  errorHandler = null;
126
- writeLine(line) {
127
- this.output.write(line + "\n");
126
+ writeLine(line, onHandedOff) {
127
+ const text = line + "\n";
128
+ if (onHandedOff === void 0) {
129
+ this.output.write(text);
130
+ return;
131
+ }
132
+ this.output.write(text, (error) => {
133
+ if (!error) {
134
+ onHandedOff();
135
+ }
136
+ });
128
137
  }
129
138
  bufferedBytes() {
130
139
  return this.output.writableLength;
@@ -529,7 +538,6 @@ var EngineJsonRpcClient = class {
529
538
  entry.timer = setTimeout(() => this.onDeadline(entry), deadlineMs);
530
539
  const backlog = this.io.bufferedBytes?.() ?? 0;
531
540
  if (backlog > ENGINE_WRITE_BACKLOG_BYTES) {
532
- this.pending.delete(id);
533
541
  this.reject(entry, new EngineCallError(
534
542
  GP_E_ENGINE_BACKLOG,
535
543
  `not sending '${method}': ${backlog} bytes are already queued for the engine socket and it has not read them`,
@@ -541,8 +549,12 @@ var EngineJsonRpcClient = class {
541
549
  const queuedBefore = this.io.bufferedBytes?.() ?? null;
542
550
  try {
543
551
  const frameText = JSON.stringify(frame);
544
- this.io.writeLine(frameText);
545
- if (queuedBefore !== null) {
552
+ let writeHandedOffConfirmed = false;
553
+ this.io.writeLine(frameText, () => {
554
+ writeHandedOffConfirmed = true;
555
+ entry.handedOff = true;
556
+ });
557
+ if (queuedBefore !== null && !writeHandedOffConfirmed) {
546
558
  const queuedAfter = this.io.bufferedBytes?.() ?? 0;
547
559
  entry.handedOff = queuedAfter < queuedBefore + frameText.length + 1;
548
560
  }
@@ -573,7 +585,8 @@ var EngineJsonRpcClient = class {
573
585
  this.report(
574
586
  `engine has not answered '${entry.method}' (id ${entry.id}) within ${entry.deadlineMs}ms \u2014 still in flight`
575
587
  );
576
- const capped = entry.methodDeadlineMs > entry.deadlineMs ? ` This shell stops waiting for an MCP client's sake at ${entry.deadlineMs}ms while the daemon gets up to ${entry.methodDeadlineMs}ms for '${entry.method}', because a client that is left hanging retries on its own and a retried '${entry.method}' runs twice.` : "";
588
+ const waitingFor = this.surface === "mcp" ? "an MCP client" : "an HTTP caller";
589
+ const capped = entry.methodDeadlineMs > entry.deadlineMs ? ` This shell stops waiting for ${waitingFor}'s sake at ${entry.deadlineMs}ms while the daemon gets up to ${entry.methodDeadlineMs}ms for '${entry.method}', because a client that is left hanging retries on its own and a retried '${entry.method}' runs twice.` : "";
577
590
  this.reject(entry, new EngineCallError(
578
591
  GP_E_ENGINE_TIMEOUT,
579
592
  `engine is still working on '${entry.method}': no reply after ${entry.deadlineMs}ms. The request stays registered \u2014 a late reply is written to the server log \u2014 so this is a busy or slow daemon, not an unreachable one. That registration lasts only while this connection does: if the transport ends first, the server log says so and names what it stopped tracking.` + capped,
@@ -687,12 +700,19 @@ var EngineJsonRpcClient = class {
687
700
  this.report(`the engine's late reply to '${entry.method}' (id ${entry.id}) exceeded the ${MAX_FRAME_BYTES}-byte frame cap (${error.bytes} bytes), so its body could not be delivered even late${inferred ? " (attributed by arrival order: the frame's head carried no readable id)" : ""}`);
688
701
  return;
689
702
  }
690
- this.pending.delete(entry.id);
691
- this.reject(entry, attribute(new EngineCallError(
703
+ const failure = new EngineCallError(
692
704
  GP_E_PAYLOAD_TOO_LARGE,
693
705
  `the engine's reply to '${entry.method}' exceeded the ${MAX_FRAME_BYTES}-byte frame cap (${error.bytes} bytes) and was dropped; the connection is intact and other requests are unaffected`,
694
706
  "narrow this request or ask for less of it; the tool's own schema names the parameters that can shrink a reply, and this shell rewrites this line into that advice when it can (the transport layer deliberately does not guess them)"
695
- ), entry, inferred));
707
+ );
708
+ if (inferred) {
709
+ this.reject(entry, attribute(failure, entry));
710
+ entry.arrivalOrderConsumed = true;
711
+ this.retainForLateReply();
712
+ return;
713
+ }
714
+ this.pending.delete(entry.id);
715
+ this.reject(entry, attribute(failure, entry, false));
696
716
  }
697
717
  /**
698
718
  * The daemon's error frame, mapped into this shell's error.
@@ -952,8 +972,8 @@ var ReconnectingSocketIo = class {
952
972
  closeHandler = null;
953
973
  errorHandler = null;
954
974
  openHandler = null;
955
- writeLine(line) {
956
- this.connect().writeLine(line);
975
+ writeLine(line, onHandedOff) {
976
+ this.connect().writeLine(line, onHandedOff);
957
977
  }
958
978
  bufferedBytes() {
959
979
  return this.inner?.bufferedBytes() ?? 0;
@@ -3025,7 +3045,7 @@ var TOOL_SPECS = [
3025
3045
  },
3026
3046
  {
3027
3047
  name: "gp_probe_status",
3028
- description: "List GlassPaneProbe connections and whether the attached app has a live probe \u2014 probe presence is what makes T4/T5/T7/T8 verdicts and tier-1 checkpoint restores decidable. `attachedHasProbe` is that yes/no for the attached app; `probes` holds **live** registrations only (every row `connected: true`), so a probe that dropped is absent from it rather than flagged inside it: read `recentDisconnections` for that history (`pid`, `disconnectReason`, `disconnectedAt`, per-pid `drops`), and `disconnections` is just the total count since start. Each live row can also carry the frame-accounting that makes a zero verdict readable: `stateFramesUnmappedSource` (daemon-side, per pid), and `droppedEvents` / `droppedWrites` / `rejectedKeys` / `droppedInboundFrames` / `droppedInboundLines` as the probe itself reported them \u2014 those are **absent when unreported**, which is not the same as zero, and `unmapableStateFrames` is the daemon-side total that survives a disconnect. Two more daemon-side losses are readable here: `ringEvictedEvents` on a live row (that pid's events dropped when its 512-event ring overflowed) and `ringEvictedEventsTotal` for the process \u2014 a nonzero one means that window's `hitCount` and `handlers` are a **lower bound**, not a complete measurement, and the archived pack carries the same caveat under `circuitBreaker.reason`. The same reply is where the T9 degradation watch is readable without performing an action, under `degradation` (absent when this daemon runs without T9 wired): `tier` is `healthy` / `watch` / `degrading`, and `judged` says whether that tier is a measurement at all \u2014 `judged: false` with `tier: healthy` means the window was too thin or too short to read, **not** that the app is clean; `basis` spells out which of those it is with the numbers, alongside `samples`/`minimumSamples` and `spanSeconds`/`minimumSpanSeconds`. `longSession` marks the window spanning at least the long-session threshold; it is context for the trend, and it never changes `tier` by itself. `drivers` appears only when something is trending, and `slopes` carries only the channels that produced one (`pingMsPerSec`, `memoryBytesPerSec`, `handlesPerSec`) \u2014 a channel missing from `slopes` was never read, which is not a rate of zero.",
3048
+ description: "List GlassPaneProbe connections and whether the attached app has a live probe \u2014 probe presence is what makes T4/T5/T7/T8 verdicts and tier-1 checkpoint restores decidable. `attachedHasProbe` is that yes/no for the attached app; `probes` holds **live** registrations only (every row `connected: true`), so a probe that dropped is absent from it rather than flagged inside it: read `recentDisconnections` for that history (`pid`, `disconnectReason`, `disconnectedAt`, per-pid `drops`), and `disconnections` is just the total count since start. Each live row can also carry the frame-accounting that makes a zero verdict readable: `stateFramesUnmappedSource` (daemon-side, per pid), and `droppedEvents` / `droppedWrites` / `rejectedKeys` / `droppedInboundFrames` / `droppedInboundLines` as the probe itself reported them \u2014 those are **absent when unreported**, which is not the same as zero, and `unmapableStateFrames` is the daemon-side total that survives a disconnect. Two more daemon-side losses are readable here: `ringEvictedEvents` on a live row (that pid's events dropped when its 512-event ring overflowed) and `ringEvictedEventsTotal` for the process \u2014 a nonzero one means that window's `hitCount` and `handlers` are a **lower bound**, not a complete measurement, and the archived pack carries the same caveat under `circuitBreaker.reason`. A duration the probe read but this wire cannot carry is the fourth loss with its own reading: `durationOverflowFrames` on a live row counts the `handlerDurationOverflow` frames this daemon ingested for that pid, `durationOverflowCount` on the same row is the probe's own lifetime figure (**absent when the probe never reported one**, which is not a measured zero), and `durationOverflowFramesTotal` is the process-wide count that survives the disconnect. Those frames are lost readings, not protocol violations: they never enter the event ring, so they never raise `hitCount`, and they are counted apart from the daemon's malformed frames \u2014 a `hitCount` of 0 beside a nonzero overflow count means the slow call happened and only its duration was unreadable. The same reply is where the T9 degradation watch is readable without performing an action, under `degradation` (absent when this daemon runs without T9 wired): `tier` is `healthy` / `watch` / `degrading`, and `judged` says whether that tier is a measurement at all \u2014 `judged: false` with `tier: healthy` means the window was too thin or too short to read, **not** that the app is clean; `basis` spells out which of those it is with the numbers, alongside `samples`/`minimumSamples` and `spanSeconds`/`minimumSpanSeconds`. `longSession` marks the window spanning at least the long-session threshold; it is context for the trend, and it never changes `tier` by itself. `drivers` appears only when something is trending, and `slopes` carries only the channels that produced one (`pingMsPerSec`, `memoryBytesPerSec`, `handlesPerSec`) \u2014 a channel missing from `slopes` was never read, which is not a rate of zero.",
3029
3049
  engineMethod: "probe_status",
3030
3050
  inputSchema: {
3031
3051
  type: "object",
package/dist/index.js CHANGED
@@ -1307,8 +1307,17 @@ var StreamLineIo = class {
1307
1307
  messageHandler = null;
1308
1308
  closeHandler = null;
1309
1309
  errorHandler = null;
1310
- writeLine(line) {
1311
- this.output.write(line + "\n");
1310
+ writeLine(line, onHandedOff) {
1311
+ const text = line + "\n";
1312
+ if (onHandedOff === void 0) {
1313
+ this.output.write(text);
1314
+ return;
1315
+ }
1316
+ this.output.write(text, (error) => {
1317
+ if (!error) {
1318
+ onHandedOff();
1319
+ }
1320
+ });
1312
1321
  }
1313
1322
  bufferedBytes() {
1314
1323
  return this.output.writableLength;
@@ -1837,7 +1846,6 @@ var EngineJsonRpcClient = class {
1837
1846
  entry.timer = setTimeout(() => this.onDeadline(entry), deadlineMs);
1838
1847
  const backlog = this.io.bufferedBytes?.() ?? 0;
1839
1848
  if (backlog > ENGINE_WRITE_BACKLOG_BYTES) {
1840
- this.pending.delete(id);
1841
1849
  this.reject(entry, new EngineCallError(
1842
1850
  GP_E_ENGINE_BACKLOG,
1843
1851
  `not sending '${method}': ${backlog} bytes are already queued for the engine socket and it has not read them`,
@@ -1849,8 +1857,12 @@ var EngineJsonRpcClient = class {
1849
1857
  const queuedBefore = this.io.bufferedBytes?.() ?? null;
1850
1858
  try {
1851
1859
  const frameText = JSON.stringify(frame);
1852
- this.io.writeLine(frameText);
1853
- if (queuedBefore !== null) {
1860
+ let writeHandedOffConfirmed = false;
1861
+ this.io.writeLine(frameText, () => {
1862
+ writeHandedOffConfirmed = true;
1863
+ entry.handedOff = true;
1864
+ });
1865
+ if (queuedBefore !== null && !writeHandedOffConfirmed) {
1854
1866
  const queuedAfter = this.io.bufferedBytes?.() ?? 0;
1855
1867
  entry.handedOff = queuedAfter < queuedBefore + frameText.length + 1;
1856
1868
  }
@@ -1881,7 +1893,8 @@ var EngineJsonRpcClient = class {
1881
1893
  this.report(
1882
1894
  `engine has not answered '${entry.method}' (id ${entry.id}) within ${entry.deadlineMs}ms \u2014 still in flight`
1883
1895
  );
1884
- const capped = entry.methodDeadlineMs > entry.deadlineMs ? ` This shell stops waiting for an MCP client's sake at ${entry.deadlineMs}ms while the daemon gets up to ${entry.methodDeadlineMs}ms for '${entry.method}', because a client that is left hanging retries on its own and a retried '${entry.method}' runs twice.` : "";
1896
+ const waitingFor = this.surface === "mcp" ? "an MCP client" : "an HTTP caller";
1897
+ const capped = entry.methodDeadlineMs > entry.deadlineMs ? ` This shell stops waiting for ${waitingFor}'s sake at ${entry.deadlineMs}ms while the daemon gets up to ${entry.methodDeadlineMs}ms for '${entry.method}', because a client that is left hanging retries on its own and a retried '${entry.method}' runs twice.` : "";
1885
1898
  this.reject(entry, new EngineCallError(
1886
1899
  GP_E_ENGINE_TIMEOUT,
1887
1900
  `engine is still working on '${entry.method}': no reply after ${entry.deadlineMs}ms. The request stays registered \u2014 a late reply is written to the server log \u2014 so this is a busy or slow daemon, not an unreachable one. That registration lasts only while this connection does: if the transport ends first, the server log says so and names what it stopped tracking.` + capped,
@@ -1995,12 +2008,19 @@ var EngineJsonRpcClient = class {
1995
2008
  this.report(`the engine's late reply to '${entry.method}' (id ${entry.id}) exceeded the ${MAX_FRAME_BYTES}-byte frame cap (${error.bytes} bytes), so its body could not be delivered even late${inferred ? " (attributed by arrival order: the frame's head carried no readable id)" : ""}`);
1996
2009
  return;
1997
2010
  }
1998
- this.pending.delete(entry.id);
1999
- this.reject(entry, attribute(new EngineCallError(
2011
+ const failure = new EngineCallError(
2000
2012
  GP_E_PAYLOAD_TOO_LARGE,
2001
2013
  `the engine's reply to '${entry.method}' exceeded the ${MAX_FRAME_BYTES}-byte frame cap (${error.bytes} bytes) and was dropped; the connection is intact and other requests are unaffected`,
2002
2014
  "narrow this request or ask for less of it; the tool's own schema names the parameters that can shrink a reply, and this shell rewrites this line into that advice when it can (the transport layer deliberately does not guess them)"
2003
- ), entry, inferred));
2015
+ );
2016
+ if (inferred) {
2017
+ this.reject(entry, attribute(failure, entry));
2018
+ entry.arrivalOrderConsumed = true;
2019
+ this.retainForLateReply();
2020
+ return;
2021
+ }
2022
+ this.pending.delete(entry.id);
2023
+ this.reject(entry, attribute(failure, entry, false));
2004
2024
  }
2005
2025
  /**
2006
2026
  * The daemon's error frame, mapped into this shell's error.
@@ -2260,8 +2280,8 @@ var ReconnectingSocketIo = class {
2260
2280
  closeHandler = null;
2261
2281
  errorHandler = null;
2262
2282
  openHandler = null;
2263
- writeLine(line) {
2264
- this.connect().writeLine(line);
2283
+ writeLine(line, onHandedOff) {
2284
+ this.connect().writeLine(line, onHandedOff);
2265
2285
  }
2266
2286
  bufferedBytes() {
2267
2287
  return this.inner?.bufferedBytes() ?? 0;
@@ -3775,7 +3795,7 @@ var TOOL_SPECS = [
3775
3795
  },
3776
3796
  {
3777
3797
  name: "gp_probe_status",
3778
- description: "List GlassPaneProbe connections and whether the attached app has a live probe \u2014 probe presence is what makes T4/T5/T7/T8 verdicts and tier-1 checkpoint restores decidable. `attachedHasProbe` is that yes/no for the attached app; `probes` holds **live** registrations only (every row `connected: true`), so a probe that dropped is absent from it rather than flagged inside it: read `recentDisconnections` for that history (`pid`, `disconnectReason`, `disconnectedAt`, per-pid `drops`), and `disconnections` is just the total count since start. Each live row can also carry the frame-accounting that makes a zero verdict readable: `stateFramesUnmappedSource` (daemon-side, per pid), and `droppedEvents` / `droppedWrites` / `rejectedKeys` / `droppedInboundFrames` / `droppedInboundLines` as the probe itself reported them \u2014 those are **absent when unreported**, which is not the same as zero, and `unmapableStateFrames` is the daemon-side total that survives a disconnect. Two more daemon-side losses are readable here: `ringEvictedEvents` on a live row (that pid's events dropped when its 512-event ring overflowed) and `ringEvictedEventsTotal` for the process \u2014 a nonzero one means that window's `hitCount` and `handlers` are a **lower bound**, not a complete measurement, and the archived pack carries the same caveat under `circuitBreaker.reason`. The same reply is where the T9 degradation watch is readable without performing an action, under `degradation` (absent when this daemon runs without T9 wired): `tier` is `healthy` / `watch` / `degrading`, and `judged` says whether that tier is a measurement at all \u2014 `judged: false` with `tier: healthy` means the window was too thin or too short to read, **not** that the app is clean; `basis` spells out which of those it is with the numbers, alongside `samples`/`minimumSamples` and `spanSeconds`/`minimumSpanSeconds`. `longSession` marks the window spanning at least the long-session threshold; it is context for the trend, and it never changes `tier` by itself. `drivers` appears only when something is trending, and `slopes` carries only the channels that produced one (`pingMsPerSec`, `memoryBytesPerSec`, `handlesPerSec`) \u2014 a channel missing from `slopes` was never read, which is not a rate of zero.",
3798
+ description: "List GlassPaneProbe connections and whether the attached app has a live probe \u2014 probe presence is what makes T4/T5/T7/T8 verdicts and tier-1 checkpoint restores decidable. `attachedHasProbe` is that yes/no for the attached app; `probes` holds **live** registrations only (every row `connected: true`), so a probe that dropped is absent from it rather than flagged inside it: read `recentDisconnections` for that history (`pid`, `disconnectReason`, `disconnectedAt`, per-pid `drops`), and `disconnections` is just the total count since start. Each live row can also carry the frame-accounting that makes a zero verdict readable: `stateFramesUnmappedSource` (daemon-side, per pid), and `droppedEvents` / `droppedWrites` / `rejectedKeys` / `droppedInboundFrames` / `droppedInboundLines` as the probe itself reported them \u2014 those are **absent when unreported**, which is not the same as zero, and `unmapableStateFrames` is the daemon-side total that survives a disconnect. Two more daemon-side losses are readable here: `ringEvictedEvents` on a live row (that pid's events dropped when its 512-event ring overflowed) and `ringEvictedEventsTotal` for the process \u2014 a nonzero one means that window's `hitCount` and `handlers` are a **lower bound**, not a complete measurement, and the archived pack carries the same caveat under `circuitBreaker.reason`. A duration the probe read but this wire cannot carry is the fourth loss with its own reading: `durationOverflowFrames` on a live row counts the `handlerDurationOverflow` frames this daemon ingested for that pid, `durationOverflowCount` on the same row is the probe's own lifetime figure (**absent when the probe never reported one**, which is not a measured zero), and `durationOverflowFramesTotal` is the process-wide count that survives the disconnect. Those frames are lost readings, not protocol violations: they never enter the event ring, so they never raise `hitCount`, and they are counted apart from the daemon's malformed frames \u2014 a `hitCount` of 0 beside a nonzero overflow count means the slow call happened and only its duration was unreadable. The same reply is where the T9 degradation watch is readable without performing an action, under `degradation` (absent when this daemon runs without T9 wired): `tier` is `healthy` / `watch` / `degrading`, and `judged` says whether that tier is a measurement at all \u2014 `judged: false` with `tier: healthy` means the window was too thin or too short to read, **not** that the app is clean; `basis` spells out which of those it is with the numbers, alongside `samples`/`minimumSamples` and `spanSeconds`/`minimumSpanSeconds`. `longSession` marks the window spanning at least the long-session threshold; it is context for the trend, and it never changes `tier` by itself. `drivers` appears only when something is trending, and `slopes` carries only the channels that produced one (`pingMsPerSec`, `memoryBytesPerSec`, `handlesPerSec`) \u2014 a channel missing from `slopes` was never read, which is not a rate of zero.",
3779
3799
  engineMethod: "probe_status",
3780
3800
  inputSchema: {
3781
3801
  type: "object",
@@ -4846,7 +4866,7 @@ var SUPPORTED_PROTOCOL_VERSIONS = [
4846
4866
  "2025-03-26",
4847
4867
  MCP_PROTOCOL_VERSION
4848
4868
  ];
4849
- var SERVER_INFO = { name: "glasspane-mcp", version: "1.25.2" };
4869
+ var SERVER_INFO = { name: "glasspane-mcp", version: "1.26.0" };
4850
4870
  var PARSE_ERROR = -32700;
4851
4871
  var INVALID_REQUEST = -32600;
4852
4872
  var METHOD_NOT_FOUND = -32601;
package/dist/io.d.ts CHANGED
@@ -90,7 +90,21 @@ export declare function recoverFrameId(prefix: string): number | string | null;
90
90
  * a Unix socket; tests inject an in-memory fake transport.
91
91
  */
92
92
  export interface LineIo {
93
- writeLine(line: string): void;
93
+ /**
94
+ * Write one newline-terminated frame.
95
+ *
96
+ * @param onHandedOff optional. A transport that can tell *when* the bytes
97
+ * actually left this process (the flush callback of its write) calls this with
98
+ * no error. It is the temporal half of the hand-off question that
99
+ * `bufferedBytes()` answers statically (S1-1): a frame whose bytes sat in the
100
+ * local send queue at write time and drained out afterwards is a frame the
101
+ * daemon could have executed, and a transport that goes away after that may
102
+ * not claim "nothing left this process". Transports that never call it —
103
+ * every in-memory fake written before this parameter existed — leave the
104
+ * verdict to the static measurement, which is why the callback only ever
105
+ * *raises* `handedOff`, never lowers it.
106
+ */
107
+ writeLine(line: string, onHandedOff?: () => void): void;
94
108
  /**
95
109
  * 已经交给内核、还没被对端读走的字节数。可选:只有真的接在一条 socket/pipe 上
96
110
  * 的传输量得出这个数。
@@ -124,7 +138,7 @@ export declare class StreamLineIo implements LineIo {
124
138
  private closeHandler;
125
139
  private errorHandler;
126
140
  constructor(input: Readable, output: Writable);
127
- writeLine(line: string): void;
141
+ writeLine(line: string, onHandedOff?: () => void): void;
128
142
  bufferedBytes(): number;
129
143
  onMessage(handler: (line: string) => void): void;
130
144
  onClose(handler: () => void): void;
@@ -1302,8 +1302,17 @@ var StreamLineIo = class {
1302
1302
  messageHandler = null;
1303
1303
  closeHandler = null;
1304
1304
  errorHandler = null;
1305
- writeLine(line) {
1306
- this.output.write(line + "\n");
1305
+ writeLine(line, onHandedOff) {
1306
+ const text = line + "\n";
1307
+ if (onHandedOff === void 0) {
1308
+ this.output.write(text);
1309
+ return;
1310
+ }
1311
+ this.output.write(text, (error) => {
1312
+ if (!error) {
1313
+ onHandedOff();
1314
+ }
1315
+ });
1307
1316
  }
1308
1317
  bufferedBytes() {
1309
1318
  return this.output.writableLength;
@@ -1832,7 +1841,6 @@ var EngineJsonRpcClient = class {
1832
1841
  entry.timer = setTimeout(() => this.onDeadline(entry), deadlineMs);
1833
1842
  const backlog = this.io.bufferedBytes?.() ?? 0;
1834
1843
  if (backlog > ENGINE_WRITE_BACKLOG_BYTES) {
1835
- this.pending.delete(id);
1836
1844
  this.reject(entry, new EngineCallError(
1837
1845
  GP_E_ENGINE_BACKLOG,
1838
1846
  `not sending '${method}': ${backlog} bytes are already queued for the engine socket and it has not read them`,
@@ -1844,8 +1852,12 @@ var EngineJsonRpcClient = class {
1844
1852
  const queuedBefore = this.io.bufferedBytes?.() ?? null;
1845
1853
  try {
1846
1854
  const frameText = JSON.stringify(frame);
1847
- this.io.writeLine(frameText);
1848
- if (queuedBefore !== null) {
1855
+ let writeHandedOffConfirmed = false;
1856
+ this.io.writeLine(frameText, () => {
1857
+ writeHandedOffConfirmed = true;
1858
+ entry.handedOff = true;
1859
+ });
1860
+ if (queuedBefore !== null && !writeHandedOffConfirmed) {
1849
1861
  const queuedAfter = this.io.bufferedBytes?.() ?? 0;
1850
1862
  entry.handedOff = queuedAfter < queuedBefore + frameText.length + 1;
1851
1863
  }
@@ -1876,7 +1888,8 @@ var EngineJsonRpcClient = class {
1876
1888
  this.report(
1877
1889
  `engine has not answered '${entry.method}' (id ${entry.id}) within ${entry.deadlineMs}ms \u2014 still in flight`
1878
1890
  );
1879
- const capped = entry.methodDeadlineMs > entry.deadlineMs ? ` This shell stops waiting for an MCP client's sake at ${entry.deadlineMs}ms while the daemon gets up to ${entry.methodDeadlineMs}ms for '${entry.method}', because a client that is left hanging retries on its own and a retried '${entry.method}' runs twice.` : "";
1891
+ const waitingFor = this.surface === "mcp" ? "an MCP client" : "an HTTP caller";
1892
+ const capped = entry.methodDeadlineMs > entry.deadlineMs ? ` This shell stops waiting for ${waitingFor}'s sake at ${entry.deadlineMs}ms while the daemon gets up to ${entry.methodDeadlineMs}ms for '${entry.method}', because a client that is left hanging retries on its own and a retried '${entry.method}' runs twice.` : "";
1880
1893
  this.reject(entry, new EngineCallError(
1881
1894
  GP_E_ENGINE_TIMEOUT,
1882
1895
  `engine is still working on '${entry.method}': no reply after ${entry.deadlineMs}ms. The request stays registered \u2014 a late reply is written to the server log \u2014 so this is a busy or slow daemon, not an unreachable one. That registration lasts only while this connection does: if the transport ends first, the server log says so and names what it stopped tracking.` + capped,
@@ -1990,12 +2003,19 @@ var EngineJsonRpcClient = class {
1990
2003
  this.report(`the engine's late reply to '${entry.method}' (id ${entry.id}) exceeded the ${MAX_FRAME_BYTES}-byte frame cap (${error.bytes} bytes), so its body could not be delivered even late${inferred ? " (attributed by arrival order: the frame's head carried no readable id)" : ""}`);
1991
2004
  return;
1992
2005
  }
1993
- this.pending.delete(entry.id);
1994
- this.reject(entry, attribute(new EngineCallError(
2006
+ const failure = new EngineCallError(
1995
2007
  GP_E_PAYLOAD_TOO_LARGE,
1996
2008
  `the engine's reply to '${entry.method}' exceeded the ${MAX_FRAME_BYTES}-byte frame cap (${error.bytes} bytes) and was dropped; the connection is intact and other requests are unaffected`,
1997
2009
  "narrow this request or ask for less of it; the tool's own schema names the parameters that can shrink a reply, and this shell rewrites this line into that advice when it can (the transport layer deliberately does not guess them)"
1998
- ), entry, inferred));
2010
+ );
2011
+ if (inferred) {
2012
+ this.reject(entry, attribute(failure, entry));
2013
+ entry.arrivalOrderConsumed = true;
2014
+ this.retainForLateReply();
2015
+ return;
2016
+ }
2017
+ this.pending.delete(entry.id);
2018
+ this.reject(entry, attribute(failure, entry, false));
1999
2019
  }
2000
2020
  /**
2001
2021
  * The daemon's error frame, mapped into this shell's error.
@@ -2255,8 +2275,8 @@ var ReconnectingSocketIo = class {
2255
2275
  closeHandler = null;
2256
2276
  errorHandler = null;
2257
2277
  openHandler = null;
2258
- writeLine(line) {
2259
- this.connect().writeLine(line);
2278
+ writeLine(line, onHandedOff) {
2279
+ this.connect().writeLine(line, onHandedOff);
2260
2280
  }
2261
2281
  bufferedBytes() {
2262
2282
  return this.inner?.bufferedBytes() ?? 0;
@@ -3770,7 +3790,7 @@ var TOOL_SPECS = [
3770
3790
  },
3771
3791
  {
3772
3792
  name: "gp_probe_status",
3773
- description: "List GlassPaneProbe connections and whether the attached app has a live probe \u2014 probe presence is what makes T4/T5/T7/T8 verdicts and tier-1 checkpoint restores decidable. `attachedHasProbe` is that yes/no for the attached app; `probes` holds **live** registrations only (every row `connected: true`), so a probe that dropped is absent from it rather than flagged inside it: read `recentDisconnections` for that history (`pid`, `disconnectReason`, `disconnectedAt`, per-pid `drops`), and `disconnections` is just the total count since start. Each live row can also carry the frame-accounting that makes a zero verdict readable: `stateFramesUnmappedSource` (daemon-side, per pid), and `droppedEvents` / `droppedWrites` / `rejectedKeys` / `droppedInboundFrames` / `droppedInboundLines` as the probe itself reported them \u2014 those are **absent when unreported**, which is not the same as zero, and `unmapableStateFrames` is the daemon-side total that survives a disconnect. Two more daemon-side losses are readable here: `ringEvictedEvents` on a live row (that pid's events dropped when its 512-event ring overflowed) and `ringEvictedEventsTotal` for the process \u2014 a nonzero one means that window's `hitCount` and `handlers` are a **lower bound**, not a complete measurement, and the archived pack carries the same caveat under `circuitBreaker.reason`. The same reply is where the T9 degradation watch is readable without performing an action, under `degradation` (absent when this daemon runs without T9 wired): `tier` is `healthy` / `watch` / `degrading`, and `judged` says whether that tier is a measurement at all \u2014 `judged: false` with `tier: healthy` means the window was too thin or too short to read, **not** that the app is clean; `basis` spells out which of those it is with the numbers, alongside `samples`/`minimumSamples` and `spanSeconds`/`minimumSpanSeconds`. `longSession` marks the window spanning at least the long-session threshold; it is context for the trend, and it never changes `tier` by itself. `drivers` appears only when something is trending, and `slopes` carries only the channels that produced one (`pingMsPerSec`, `memoryBytesPerSec`, `handlesPerSec`) \u2014 a channel missing from `slopes` was never read, which is not a rate of zero.",
3793
+ description: "List GlassPaneProbe connections and whether the attached app has a live probe \u2014 probe presence is what makes T4/T5/T7/T8 verdicts and tier-1 checkpoint restores decidable. `attachedHasProbe` is that yes/no for the attached app; `probes` holds **live** registrations only (every row `connected: true`), so a probe that dropped is absent from it rather than flagged inside it: read `recentDisconnections` for that history (`pid`, `disconnectReason`, `disconnectedAt`, per-pid `drops`), and `disconnections` is just the total count since start. Each live row can also carry the frame-accounting that makes a zero verdict readable: `stateFramesUnmappedSource` (daemon-side, per pid), and `droppedEvents` / `droppedWrites` / `rejectedKeys` / `droppedInboundFrames` / `droppedInboundLines` as the probe itself reported them \u2014 those are **absent when unreported**, which is not the same as zero, and `unmapableStateFrames` is the daemon-side total that survives a disconnect. Two more daemon-side losses are readable here: `ringEvictedEvents` on a live row (that pid's events dropped when its 512-event ring overflowed) and `ringEvictedEventsTotal` for the process \u2014 a nonzero one means that window's `hitCount` and `handlers` are a **lower bound**, not a complete measurement, and the archived pack carries the same caveat under `circuitBreaker.reason`. A duration the probe read but this wire cannot carry is the fourth loss with its own reading: `durationOverflowFrames` on a live row counts the `handlerDurationOverflow` frames this daemon ingested for that pid, `durationOverflowCount` on the same row is the probe's own lifetime figure (**absent when the probe never reported one**, which is not a measured zero), and `durationOverflowFramesTotal` is the process-wide count that survives the disconnect. Those frames are lost readings, not protocol violations: they never enter the event ring, so they never raise `hitCount`, and they are counted apart from the daemon's malformed frames \u2014 a `hitCount` of 0 beside a nonzero overflow count means the slow call happened and only its duration was unreadable. The same reply is where the T9 degradation watch is readable without performing an action, under `degradation` (absent when this daemon runs without T9 wired): `tier` is `healthy` / `watch` / `degrading`, and `judged` says whether that tier is a measurement at all \u2014 `judged: false` with `tier: healthy` means the window was too thin or too short to read, **not** that the app is clean; `basis` spells out which of those it is with the numbers, alongside `samples`/`minimumSamples` and `spanSeconds`/`minimumSpanSeconds`. `longSession` marks the window spanning at least the long-session threshold; it is context for the trend, and it never changes `tier` by itself. `drivers` appears only when something is trending, and `slopes` carries only the channels that produced one (`pingMsPerSec`, `memoryBytesPerSec`, `handlesPerSec`) \u2014 a channel missing from `slopes` was never read, which is not a rate of zero.",
3774
3794
  engineMethod: "probe_status",
3775
3795
  inputSchema: {
3776
3796
  type: "object",
@@ -4841,7 +4861,7 @@ var SUPPORTED_PROTOCOL_VERSIONS = [
4841
4861
  "2025-03-26",
4842
4862
  MCP_PROTOCOL_VERSION
4843
4863
  ];
4844
- var SERVER_INFO = { name: "glasspane-mcp", version: "1.25.2" };
4864
+ var SERVER_INFO = { name: "glasspane-mcp", version: "1.26.0" };
4845
4865
  var PARSE_ERROR = -32700;
4846
4866
  var INVALID_REQUEST = -32600;
4847
4867
  var METHOD_NOT_FOUND = -32601;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glasspane-mcp",
3
- "version": "1.25.2",
3
+ "version": "1.26.0",
4
4
  "description": "GlassPane MCP stdio shell: JSON-RPC 2.0 over stdio bridging an AI agent to the glasspane engine daemon",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",