gdharness 1.3.18 → 1.3.19

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.
Files changed (2) hide show
  1. package/build/cli.js +41 -4
  2. package/package.json +1 -1
package/build/cli.js CHANGED
@@ -11803,8 +11803,42 @@ function dictionary(entries) {
11803
11803
 
11804
11804
  // src/call-signal.ts
11805
11805
  import { AsyncLocalStorage } from "node:async_hooks";
11806
- function withCallSignal(signal, answer, progress) {
11807
- return signal === undefined && progress === undefined ? answer() : current.run({ signal, progress: progress === undefined ? undefined : risingOnly(progress) }, answer);
11806
+ function stillGoingSaid(tool, op, elapsedMs) {
11807
+ const seconds = Math.floor(elapsedMs / 1000);
11808
+ const took = seconds < 60 ? `${seconds}s` : `${Math.floor(seconds / 60)}m ${seconds % 60}s`;
11809
+ return `${op === null || op === "" ? tool : `${tool} ${op}`} is still going; ${took} in.`;
11810
+ }
11811
+ async function withCallSignal(signal, answer, progress, still) {
11812
+ if (progress === undefined) {
11813
+ return signal === undefined ? answer() : current.run({ signal, progress: undefined }, answer);
11814
+ }
11815
+ const began = Date.now();
11816
+ const rising = risingOnly(progress);
11817
+ let going = still;
11818
+ let quiet;
11819
+ const rearm = () => {
11820
+ clearTimeout(quiet);
11821
+ if (going === undefined) {
11822
+ return;
11823
+ }
11824
+ const { everyMs, said } = going;
11825
+ quiet = setTimeout(() => {
11826
+ const elapsed = Date.now() - began;
11827
+ told(Math.floor(elapsed / 1000), said(elapsed));
11828
+ }, everyMs);
11829
+ quiet.unref();
11830
+ };
11831
+ const told = (number, message) => {
11832
+ rising(number, message);
11833
+ rearm();
11834
+ };
11835
+ rearm();
11836
+ try {
11837
+ return await current.run({ signal, progress: told }, answer);
11838
+ } finally {
11839
+ going = undefined;
11840
+ clearTimeout(quiet);
11841
+ }
11808
11842
  }
11809
11843
  function risingOnly(progress) {
11810
11844
  let last = Number.NEGATIVE_INFINITY;
@@ -11819,7 +11853,7 @@ function callSignal() {
11819
11853
  function callProgress() {
11820
11854
  return current.getStore()?.progress;
11821
11855
  }
11822
- var current;
11856
+ var current, CALL_HEARTBEAT_MS = 20000;
11823
11857
  var init_call_signal = __esm(() => {
11824
11858
  current = new AsyncLocalStorage;
11825
11859
  });
@@ -50347,7 +50381,10 @@ class GodotServer {
50347
50381
  const call = this.callsTaken++;
50348
50382
  this.inFlight.set(call, { tool: spec.name, op: checked.op ?? "", startedAt: Date.now() });
50349
50383
  try {
50350
- const answer = await withCallSignal(ctx.mcpReq.signal, () => this.answered(spec.name, checked.op ?? "", args), progress);
50384
+ const answer = await withCallSignal(ctx.mcpReq.signal, () => this.answered(spec.name, checked.op ?? "", args), progress, {
50385
+ everyMs: CALL_HEARTBEAT_MS,
50386
+ said: (elapsedMs) => stillGoingSaid(spec.name, checked.op, elapsedMs)
50387
+ });
50351
50388
  return this.withinTheClientsLimit(spec.name, this.withFeedbackNotice(this.withUpdateNotice(answer)));
50352
50389
  } finally {
50353
50390
  this.inFlight.delete(call);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdharness",
3
- "version": "1.3.18",
3
+ "version": "1.3.19",
4
4
  "mcpName": "io.github.Aureliolo/gdharness",
5
5
  "description": "A harness for driving a Godot 4 project from an agent: editor addons, a runtime bridge into the running game, an MCP server in front of them, and a CLI that installs and diagnoses the Godot side.",
6
6
  "type": "module",