@jini-ai/devops 0.5.0 → 0.5.1

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
  # @jini-ai/devops
2
2
 
3
+ ## 0.5.1 — 2026-10-04
4
+
5
+ - `@jini-ai/devops/local-dev` exports `listenServer`.
6
+ - Internal `@jini-ai/*` dependencies are caret ranges (`workspace:^`) instead of exact pins, so a host on a newer patch resolves a single copy without an override.
7
+
3
8
  ## 0.5.0 — 2026-10-02
4
9
 
5
10
  ### BREAKING
@@ -31,4 +31,25 @@ export declare function listenersOn({ port, runner, listenerCommand }: {
31
31
  port: number;
32
32
  }) => ProcessRequest;
33
33
  }): Promise<PortListener[]>;
34
+ /** Minimal listener port; adapters may supply HTTP, HTTPS, or a deterministic socket double. */
35
+ export interface ServerListenerPort {
36
+ once(event: 'error' | 'listening', handler: (...args: unknown[]) => void): unknown;
37
+ off(event: 'error' | 'listening', handler: (...args: unknown[]) => void): unknown;
38
+ listen(input: {
39
+ port: number;
40
+ host?: string;
41
+ }): unknown;
42
+ address(): {
43
+ port: number;
44
+ } | string | null;
45
+ }
46
+ /** Bind the actual listener, retaining it across boot. Only address collisions may try the next
47
+ * port; explicit addresses use the default single attempt. No probe/release/bind race. */
48
+ export declare function listenServer({ server, port }: {
49
+ server: ServerListenerPort;
50
+ port: number;
51
+ }, { host, attempts }?: {
52
+ host?: string;
53
+ attempts?: number;
54
+ }): Promise<number>;
34
55
  //# sourceMappingURL=index.d.ts.map
@@ -34,4 +34,35 @@ export async function listenersOn({ port, runner, listenerCommand }) {
34
34
  return [];
35
35
  }
36
36
  }
37
+ /** Bind the actual listener, retaining it across boot. Only address collisions may try the next
38
+ * port; explicit addresses use the default single attempt. No probe/release/bind race. */
39
+ export async function listenServer({ server, port }, { host, attempts = 1 } = {}) {
40
+ if (!Number.isInteger(attempts) || attempts < 1 || !Number.isInteger(port) || port < 0 || port + attempts - 1 > 65535) {
41
+ throw new RangeError('Invalid listener port or attempt range');
42
+ }
43
+ for (let offset = 0; offset < attempts; offset++) {
44
+ try {
45
+ await new Promise((resolve, reject) => {
46
+ const cleanup = () => { server.off('error', onError); server.off('listening', onListening); };
47
+ const onError = (error) => { cleanup(); reject(error); };
48
+ const onListening = () => { cleanup(); resolve(); };
49
+ server.once('error', onError);
50
+ server.once('listening', onListening);
51
+ try {
52
+ server.listen({ port: port + offset, ...(host === undefined ? {} : { host }) });
53
+ }
54
+ catch (error) {
55
+ onError(error);
56
+ }
57
+ });
58
+ const address = server.address();
59
+ return typeof address === 'object' && address !== null ? address.port : port + offset;
60
+ }
61
+ catch (error) {
62
+ if (error?.code !== 'EADDRINUSE' || offset === attempts - 1)
63
+ throw error;
64
+ }
65
+ }
66
+ throw new Error('Listener range exhausted');
67
+ }
37
68
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jini-ai/devops",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "DevOps capabilities for deployment, source control, and CI/CD, exposed through independent subpaths.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -117,8 +117,8 @@
117
117
  },
118
118
  "dependencies": {
119
119
  "undici": "^7.25.0",
120
- "@jini-ai/core": "0.4.0",
121
- "@jini-ai/platform": "0.5.0"
120
+ "@jini-ai/core": "^0.4.0",
121
+ "@jini-ai/platform": "^0.5.0"
122
122
  },
123
123
  "devDependencies": {
124
124
  "@vitest/coverage-v8": "^2.1.9",