@skaile/forge-agent-runtime 1.1.1 → 1.1.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.2
4
+
5
+ - Busy-port retry: `AgentProcessManager.create` now also retries on a fresh port when `skaile serve` prints `<host>:<port> is already in use: another process listens there` (the text `@skaile/workspaces` 5.12 and later print instead of `EADDRINUSE`, and exit 1). Before, the retry never ran for those versions and the session failed on the first port clash. `EADDRINUSE` still matches for older versions; the check is the exported `isPortConflict`.
6
+ - Accepts `@skaile/workspaces` 7: dependency range `^6.11.0 || ^7.0.0` (checked against 7.1.0; 7.0.0 removed model transforms only, which this package does not use). `@skaile/forge-settings` raised to `^1.1.1`, the first release that accepts `@skaile/workspaces` 7, so one copy of `@skaile/workspaces` is installed.
7
+
3
8
  ## 1.1.1
4
9
 
5
10
  - `app-runner-host`: a run whose `skaile serve` child exits, or whose connection is found dead on a command (`410`), is torn down immediately: credentials erased, scratch directory removed, listener closed, later requests `404`. The final error event is still delivered to `onEvent`. Before, the run stayed registered until its lease expired.
@@ -1,7 +1,7 @@
1
1
  import { randomBytes } from 'node:crypto';
2
2
  import { join, resolve } from 'node:path';
3
3
  import { consola } from 'consola';
4
- import { P as ProcessManagerAdapter } from '../shared/forge-agent-runtime.B1LZr0Sl.mjs';
4
+ import { P as ProcessManagerAdapter } from '../shared/forge-agent-runtime.ByEe8ijq.mjs';
5
5
  import { registryEntries, isEntryEnabled, entryPolicyRefusal, providerCredentialEnvName, parseCredentialRef, writeProviderLayer } from '@skaile/forge-settings/server';
6
6
  import { rm, mkdir, writeFile } from 'node:fs/promises';
7
7
  import 'node:events';
package/dist/index.d.mts CHANGED
@@ -87,6 +87,12 @@ interface AgentProcessConfig {
87
87
  */
88
88
  wsAuthToken?: string;
89
89
  }
90
+ /**
91
+ * True when the child's stderr says its port was taken. Two texts exist:
92
+ * `EADDRINUSE` (the raw Node error, skaile before 5.12) and
93
+ * `<host>:<port> is already in use: ...` (`skaile serve` 5.12+, which exits 1).
94
+ */
95
+ declare function isPortConflict(stderrLines: readonly string[]): boolean;
90
96
  declare class AgentProcessManager extends EventEmitter {
91
97
  private processes;
92
98
  constructor();
@@ -471,5 +477,5 @@ declare class FanoutTransport {
471
477
  get subscriberCount(): number;
472
478
  }
473
479
 
474
- export { AgentAdapter, AgentAdapterConfig, AgentCommand$1 as AgentCommand, AgentEvent, AgentProcessManager, AgentStatus, BaseAgentManager, EventEmitterSubscriberTransport, FanoutTransport, JsonlMessageStore, ProcessManagerAdapter, createAdapterForHarness, listRegisteredHarnesses, registerHarness };
480
+ export { AgentAdapter, AgentAdapterConfig, AgentCommand$1 as AgentCommand, AgentEvent, AgentProcessManager, AgentStatus, BaseAgentManager, EventEmitterSubscriberTransport, FanoutTransport, JsonlMessageStore, ProcessManagerAdapter, createAdapterForHarness, isPortConflict, listRegisteredHarnesses, registerHarness };
475
481
  export type { AgentProcessConfig, ManagedSession };
package/dist/index.d.ts CHANGED
@@ -87,6 +87,12 @@ interface AgentProcessConfig {
87
87
  */
88
88
  wsAuthToken?: string;
89
89
  }
90
+ /**
91
+ * True when the child's stderr says its port was taken. Two texts exist:
92
+ * `EADDRINUSE` (the raw Node error, skaile before 5.12) and
93
+ * `<host>:<port> is already in use: ...` (`skaile serve` 5.12+, which exits 1).
94
+ */
95
+ declare function isPortConflict(stderrLines: readonly string[]): boolean;
90
96
  declare class AgentProcessManager extends EventEmitter {
91
97
  private processes;
92
98
  constructor();
@@ -471,5 +477,5 @@ declare class FanoutTransport {
471
477
  get subscriberCount(): number;
472
478
  }
473
479
 
474
- export { AgentAdapter, AgentAdapterConfig, AgentCommand$1 as AgentCommand, AgentEvent, AgentProcessManager, AgentStatus, BaseAgentManager, EventEmitterSubscriberTransport, FanoutTransport, JsonlMessageStore, ProcessManagerAdapter, createAdapterForHarness, listRegisteredHarnesses, registerHarness };
480
+ export { AgentAdapter, AgentAdapterConfig, AgentCommand$1 as AgentCommand, AgentEvent, AgentProcessManager, AgentStatus, BaseAgentManager, EventEmitterSubscriberTransport, FanoutTransport, JsonlMessageStore, ProcessManagerAdapter, createAdapterForHarness, isPortConflict, listRegisteredHarnesses, registerHarness };
475
481
  export type { AgentProcessConfig, ManagedSession };
package/dist/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
- import { P as ProcessManagerAdapter, A as AgentProcessManager } from './shared/forge-agent-runtime.B1LZr0Sl.mjs';
1
+ import { P as ProcessManagerAdapter, A as AgentProcessManager } from './shared/forge-agent-runtime.ByEe8ijq.mjs';
2
+ export { i as isPortConflict } from './shared/forge-agent-runtime.ByEe8ijq.mjs';
2
3
  import { EventEmitter } from 'node:events';
3
4
  import { mkdir, appendFile, readFile } from 'node:fs/promises';
4
5
  import { join } from 'node:path';
@@ -36,6 +36,9 @@ async function allocatePort() {
36
36
  }
37
37
  throw new Error("Could not find a free port for skaile serve");
38
38
  }
39
+ function isPortConflict(stderrLines) {
40
+ return stderrLines.some((l) => l.includes("EADDRINUSE") || l.includes("is already in use"));
41
+ }
39
42
  function dialHost(host) {
40
43
  if (!host) return "127.0.0.1";
41
44
  return host.includes(":") && !host.startsWith("[") ? `[${host}]` : host;
@@ -210,7 +213,7 @@ class AgentProcessManager extends EventEmitter {
210
213
  try {
211
214
  await this.waitForReady(id, managed, 2e4);
212
215
  } catch (err) {
213
- const portConflict = managed.stderrBuffer.some((l) => l.includes("EADDRINUSE"));
216
+ const portConflict = isPortConflict(managed.stderrBuffer);
214
217
  try {
215
218
  if (managed.child.exitCode === null) managed.child.kill("SIGKILL");
216
219
  } catch {
@@ -535,4 +538,4 @@ class ProcessManagerAdapter {
535
538
  }
536
539
  }
537
540
 
538
- export { AgentProcessManager as A, ProcessManagerAdapter as P };
541
+ export { AgentProcessManager as A, ProcessManagerAdapter as P, isPortConflict as i };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skaile/forge-agent-runtime",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Agent process lifecycle for Skaile forge apps: spawns `skaile serve`, connects over WebSocket, and exposes the AgentAdapter, harness registry and session manager. Node-only.",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.3.9",
@@ -42,8 +42,8 @@
42
42
  "lint": "biome lint --fix --unsafe src tests"
43
43
  },
44
44
  "dependencies": {
45
- "@skaile/forge-settings": "^1.0.0",
46
- "@skaile/workspaces": "^6.11.0",
45
+ "@skaile/forge-settings": "^1.1.1",
46
+ "@skaile/workspaces": "^6.11.0 || ^7.0.0",
47
47
  "consola": "^3.4.2",
48
48
  "picocolors": "^1.1.1"
49
49
  },