cortad 0.3.1-rc.2 → 0.3.1-rc.3

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/local.mjs +12 -3
  2. package/package.json +1 -1
package/local.mjs CHANGED
@@ -813,11 +813,20 @@ async function restartNow() {
813
813
  if (!launched || !child) return { error: "You started this app yourself, so restart it in your own terminal. Most dev servers reload on save." };
814
814
  const port = app.port;
815
815
  await stopApp(child.pid);
816
- for (let i = 0; i < 25 && (await answers(port)); i++) await new Promise((r) => setTimeout(r, 200));
816
+ // Until the port is free, not merely silent: a listener still closing does not answer and still
817
+ // holds the bind, and the restarted app was moved to the next port while the run kept knocking on
818
+ // this one (resumeforge's verify played seven trials against nothing).
819
+ for (let i = 0; i < 75 && (await listenerOn(port)); i++) await new Promise((r) => setTimeout(r, 200));
817
820
  const up = await launch(90_000);
818
821
  if (!up.port) return { error: up.exited !== null ? `Your app exited ${up.exited} on restart.\n${up.tail}` : "Your app was restarted but did not answer within 90 seconds." };
819
- if (up.port !== port) return { error: `Your app came back on port ${up.port}, not ${port}. Run the command again to reconnect.` };
820
- return { restarted: true, port };
822
+ if (up.port !== port) {
823
+ // It moved anyway: the world follows the app, never the other way round.
824
+ app = up;
825
+ const told = await announce().catch(() => null);
826
+ if (!told?.ok) return { error: `Your app came back on port ${up.port}, not ${port}. Run the command again to reconnect.` };
827
+ say(`your app came back on port ${up.port}; the run follows it there`);
828
+ }
829
+ return { restarted: true, port: up.port };
821
830
  }
822
831
  // TCP ports your app is listening on: every process descended from the one this program started.
823
832
  // By descent, not by process group: nodemon, pm2 and concurrently put the real server in a group of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortad",
3
- "version": "0.3.1-rc.2",
3
+ "version": "0.3.1-rc.3",
4
4
  "description": "Connects the AI app on your machine to Cortad for test conversations, and gives your coding agent the MCP and skill to run them. No dependencies.",
5
5
  "bin": {
6
6
  "cortad": "local.mjs"