@jini-ai/sidecar 0.6.21 → 0.7.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/CHANGELOG.md +19 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -2
- package/dist/{supervisor-node.d.ts → supervision/supervisor-node.d.ts} +1 -1
- package/dist/{supervisor-node.js → supervision/supervisor-node.js} +1 -1
- package/dist/{supervisor.js → supervision/supervisor.js} +17 -6
- package/package.json +14 -14
- /package/dist/{respawn-policy.d.ts → supervision/respawn-policy.d.ts} +0 -0
- /package/dist/{respawn-policy.js → supervision/respawn-policy.js} +0 -0
- /package/dist/{supervisor.d.ts → supervision/supervisor.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @jini-ai/sidecar
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [8fe045b]
|
|
8
|
+
- Updated dependencies [c393010]
|
|
9
|
+
- Updated dependencies [41ff2ff]
|
|
10
|
+
- Updated dependencies [a266ba8]
|
|
11
|
+
- Updated dependencies [27063ef]
|
|
12
|
+
- Updated dependencies [6ab1d81]
|
|
13
|
+
- Updated dependencies [699b478]
|
|
14
|
+
- Updated dependencies [39cf677]
|
|
15
|
+
- @jini-ai/core@0.7.0
|
|
16
|
+
- @jini-ai/platform@0.7.0
|
|
17
|
+
|
|
18
|
+
## 0.6.22
|
|
19
|
+
|
|
20
|
+
- Supervision moved to `src/supervision/`; published entry points are unchanged. The supervisor rediscovers a replacement sidecar.
|
|
21
|
+
|
|
3
22
|
## 0.6.21
|
|
4
23
|
|
|
5
24
|
- Native IPC carries a handler's explicit public `refusalReason` (1–1024 characters) back to the caller instead of a generic "IPC request refused"; raw handler errors still never cross the channel.
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,6 @@ export { readJsonFile, removeFile, removePointerIfCurrent, writeJsonFile } from
|
|
|
18
18
|
export { createJsonIpcServer, requestJsonIpc } from "./json-ipc.js";
|
|
19
19
|
export type { LocalDaemonRegistryRecord } from "./daemon-registry.js";
|
|
20
20
|
export { isProcessAlive, readLiveDaemonRegistryRecord, removeDaemonRegistryRecordIfCurrent, resolveDaemonRegistryPath, writeDaemonRegistryRecord, } from "./daemon-registry.js";
|
|
21
|
-
export * from "./respawn-policy.js";
|
|
22
|
-
export * from "./supervisor.js";
|
|
21
|
+
export * from "./supervision/respawn-policy.js";
|
|
22
|
+
export * from "./supervision/supervisor.js";
|
|
23
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { allocatePort } from "./port.js";
|
|
|
16
16
|
export { readJsonFile, removeFile, removePointerIfCurrent, writeJsonFile } from "./json-file.js";
|
|
17
17
|
export { createJsonIpcServer, requestJsonIpc } from "./json-ipc.js";
|
|
18
18
|
export { isProcessAlive, readLiveDaemonRegistryRecord, removeDaemonRegistryRecordIfCurrent, resolveDaemonRegistryPath, writeDaemonRegistryRecord, } from "./daemon-registry.js";
|
|
19
|
-
|
|
20
|
-
export * from "./
|
|
19
|
+
// Preserve published entries with one implementation in supervision; Node adapters stay isolated.
|
|
20
|
+
export * from "./supervision/respawn-policy.js";
|
|
21
|
+
export * from "./supervision/supervisor.js";
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -2,7 +2,7 @@ import type { Writable } from "node:stream";
|
|
|
2
2
|
import type { ChildProcess, SpawnOptions } from "node:child_process";
|
|
3
3
|
import type { Serializable } from "node:child_process";
|
|
4
4
|
import { listProcessSnapshots, stopProcesses, waitForProcessExit } from "@jini-ai/platform/process";
|
|
5
|
-
import type { LocalDaemonRegistryRecord } from "
|
|
5
|
+
import type { LocalDaemonRegistryRecord } from "../daemon-registry.js";
|
|
6
6
|
import type { SpawnedDaemonProcess, SupervisorScheduler } from "./supervisor.js";
|
|
7
7
|
export interface SupervisorRegistry {
|
|
8
8
|
readLive(): Promise<LocalDaemonRegistryRecord | null>;
|
|
@@ -3,7 +3,7 @@ import { randomUUID } from "node:crypto";
|
|
|
3
3
|
import { createCommandInvocation } from "@jini-ai/platform/command";
|
|
4
4
|
import { omitEnvironmentKeys } from "@jini-ai/platform/child-environment";
|
|
5
5
|
import { collectProcessTreePids, listProcessSnapshots, stopProcesses, waitForProcessExit } from "@jini-ai/platform/process";
|
|
6
|
-
import { readLiveDaemonRegistryRecord, removeDaemonRegistryRecordIfCurrent, writeDaemonRegistryRecord } from "
|
|
6
|
+
import { readLiveDaemonRegistryRecord, removeDaemonRegistryRecordIfCurrent, writeDaemonRegistryRecord } from "../daemon-registry.js";
|
|
7
7
|
/**
|
|
8
8
|
* Reuse the sidecar registry's atomic records, liveness checks and ownership-guarded removal.
|
|
9
9
|
* The child calls write only after it actually starts listening.
|
|
@@ -80,6 +80,18 @@ export function createDaemonSupervisor(deps, options = {}) {
|
|
|
80
80
|
void poll();
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
+
/** One monitor spans demand and replacement; background shutdown rejection is observed.
|
|
84
|
+
* @complexity O(1) state; one PID probe immediately, then at most once per 250ms until ready.
|
|
85
|
+
*/
|
|
86
|
+
function discoverReadiness() {
|
|
87
|
+
if (!discoveryWork) {
|
|
88
|
+
const discovery = waitForReady().finally(() => { if (discoveryWork === discovery)
|
|
89
|
+
discoveryWork = undefined; });
|
|
90
|
+
discoveryWork = discovery;
|
|
91
|
+
void discovery.catch(() => { });
|
|
92
|
+
}
|
|
93
|
+
return discoveryWork;
|
|
94
|
+
}
|
|
83
95
|
function ensureReady(_required, { signal } = {}) {
|
|
84
96
|
if (signal?.aborted)
|
|
85
97
|
return Promise.reject(signal.reason);
|
|
@@ -100,12 +112,7 @@ export function createDaemonSupervisor(deps, options = {}) {
|
|
|
100
112
|
// A slow healthy child must keep being discovered after an HTTP caller gives up.
|
|
101
113
|
// Share the monitor across subsequent demands; shutdown or parking cancels polling.
|
|
102
114
|
// A parked waiter's cleanup must not clear a fresh wake's discovery or request work.
|
|
103
|
-
|
|
104
|
-
const discovery = waitForReady().finally(() => { if (discoveryWork === discovery)
|
|
105
|
-
discoveryWork = undefined; });
|
|
106
|
-
discoveryWork = discovery;
|
|
107
|
-
}
|
|
108
|
-
const ready = readinessDeadline({ work: discoveryWork, scheduler: deps.scheduler }).finally(() => { if (readyWork === ready)
|
|
115
|
+
const ready = readinessDeadline({ work: discoverReadiness(), scheduler: deps.scheduler }).finally(() => { if (readyWork === ready)
|
|
109
116
|
readyWork = undefined; });
|
|
110
117
|
readyWork = ready;
|
|
111
118
|
}
|
|
@@ -215,6 +222,10 @@ export function createDaemonSupervisor(deps, options = {}) {
|
|
|
215
222
|
if (!state.deliberate)
|
|
216
223
|
handleUnexpectedExit(code, signal);
|
|
217
224
|
} });
|
|
225
|
+
// Cold construction and an idle park do no discovery. A replacement must still publish
|
|
226
|
+
// readiness when no caller is waiting; reuse the current monitor if startup is ongoing.
|
|
227
|
+
if (spawnAttempts > 1 && deps.readiness)
|
|
228
|
+
void discoverReadiness();
|
|
218
229
|
}
|
|
219
230
|
// Wait for a still-live child to exit before replacement: spawning alongside it would
|
|
220
231
|
// collide on its listening port and manufacture the bind failure we are recovering from.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/sidecar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Sidecar process runtime: JSON-IPC server and client, IPC path validation, namespace/runtime path resolution, port allocation, launch bootstrap, and a local daemon registry.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
"default": "./dist/index.js"
|
|
31
31
|
},
|
|
32
32
|
"./respawn-policy": {
|
|
33
|
-
"types": "./dist/respawn-policy.d.ts",
|
|
34
|
-
"import": "./dist/respawn-policy.js",
|
|
35
|
-
"default": "./dist/respawn-policy.js"
|
|
33
|
+
"types": "./dist/supervision/respawn-policy.d.ts",
|
|
34
|
+
"import": "./dist/supervision/respawn-policy.js",
|
|
35
|
+
"default": "./dist/supervision/respawn-policy.js"
|
|
36
36
|
},
|
|
37
37
|
"./supervisor": {
|
|
38
|
-
"types": "./dist/supervisor.d.ts",
|
|
39
|
-
"import": "./dist/supervisor.js",
|
|
40
|
-
"default": "./dist/supervisor.js"
|
|
38
|
+
"types": "./dist/supervision/supervisor.d.ts",
|
|
39
|
+
"import": "./dist/supervision/supervisor.js",
|
|
40
|
+
"default": "./dist/supervision/supervisor.js"
|
|
41
41
|
},
|
|
42
42
|
"./supervisor/node": {
|
|
43
|
-
"types": "./dist/supervisor-node.d.ts",
|
|
44
|
-
"import": "./dist/supervisor-node.js",
|
|
45
|
-
"default": "./dist/supervisor-node.js"
|
|
43
|
+
"types": "./dist/supervision/supervisor-node.d.ts",
|
|
44
|
+
"import": "./dist/supervision/supervisor-node.js",
|
|
45
|
+
"default": "./dist/supervision/supervisor-node.js"
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
"files": [
|
|
@@ -63,12 +63,12 @@
|
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@vitest/coverage-v8": "^2.1.9",
|
|
66
|
-
"@jini-ai/core": "0.
|
|
67
|
-
"@jini-ai/platform": "0.
|
|
66
|
+
"@jini-ai/core": "0.7.0",
|
|
67
|
+
"@jini-ai/platform": "0.7.0"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@jini-ai/core": "^0.
|
|
71
|
-
"@jini-ai/platform": "^0.
|
|
70
|
+
"@jini-ai/core": "^0.7.0",
|
|
71
|
+
"@jini-ai/platform": "^0.7.0"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"build": "tsc -p tsconfig.json",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|