@jini-ai/sidecar 0.3.0 → 0.4.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 +93 -0
- package/README.md +39 -13
- package/dist/bootstrap.d.ts +6 -3
- package/dist/bootstrap.js +9 -14
- package/dist/daemon-registry.d.ts +20 -6
- package/dist/daemon-registry.js +38 -12
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/ipc-path.d.ts +6 -2
- package/dist/ipc-path.js +3 -3
- package/dist/json-file.d.ts +17 -6
- package/dist/json-file.js +16 -14
- package/dist/json-ipc.d.ts +12 -4
- package/dist/json-ipc.js +15 -15
- package/dist/paths.d.ts +10 -7
- package/dist/paths.js +15 -15
- package/dist/port.d.ts +10 -2
- package/dist/port.js +5 -5
- package/dist/respawn-policy.d.ts +51 -0
- package/dist/respawn-policy.js +46 -0
- package/dist/supervisor-node.d.ts +62 -0
- package/dist/supervisor-node.js +98 -0
- package/dist/supervisor.d.ts +106 -0
- package/dist/supervisor.js +178 -0
- package/dist/types.d.ts +32 -12
- package/package.json +40 -5
- package/dist/bootstrap.d.ts.map +0 -1
- package/dist/bootstrap.js.map +0 -1
- package/dist/daemon-registry.d.ts.map +0 -1
- package/dist/daemon-registry.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/ipc-path.d.ts.map +0 -1
- package/dist/ipc-path.js.map +0 -1
- package/dist/json-file.d.ts.map +0 -1
- package/dist/json-file.js.map +0 -1
- package/dist/json-ipc.d.ts.map +0 -1
- package/dist/json-ipc.js.map +0 -1
- package/dist/net.d.ts.map +0 -1
- package/dist/net.js.map +0 -1
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js.map +0 -1
- package/dist/port.d.ts.map +0 -1
- package/dist/port.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# @jini-ai/sidecar
|
|
2
|
+
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Tovu clean-up release (2026-10-08): code Tovu moved into Jini, plus the Jini clean-up (see the commit log since 0.4.0).
|
|
8
|
+
|
|
9
|
+
## 0.4.0 — 2026-10-02
|
|
10
|
+
|
|
11
|
+
### BREAKING
|
|
12
|
+
|
|
13
|
+
- Atomic filesystem handling is canonical in platform and Node supervisor defaults are isolated in ./supervisor/node.
|
|
14
|
+
- Distribution includes runtime output, release documentation and required assets only. Process records and per-job neutrality checks are no longer part of the package surface.
|
|
15
|
+
|
|
16
|
+
## Unreleased
|
|
17
|
+
|
|
18
|
+
- Fix supervisor test compilation by checking event-array emptiness without narrowing later lifecycle events to `never`.
|
|
19
|
+
|
|
20
|
+
- BREAKING: Node supervisor defaults and their types are available only from `./supervisor/node`, no longer the root or generic supervisor. The generic supervisor keeps its injected process ports and universal runtime entry.
|
|
21
|
+
|
|
22
|
+
- Adopt shared kernel contracts and preserve the module rationale in neutral documentation.
|
|
23
|
+
- Runtime JSON writes now preserve destination modes and fsync file plus parent directory, reject unserializable JSON, and clean failed owned temp writes.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
- **BREAKING:** Existing public helpers and data-bearing ports now take required and optional argument objects. Registry adapters and supervisor event/kill ports follow the same convention; migrate callers using `API.md` and the archived migration inventory.
|
|
27
|
+
- Expose the respawn policy and supervisor from the library barrel; declare runtimes for all subpaths.
|
|
28
|
+
|
|
29
|
+
- Add respawn-policy and supervisor subpaths with injected lifecycle ports, platform process/tree adapters and shared daemon registry support.
|
|
30
|
+
|
|
31
|
+
## 0.1.2
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Add top-level `main`/`types` fields alongside the existing `exports` map. A consumer on
|
|
36
|
+
TypeScript's classic `moduleResolution: "node"` (node10) — which ignores `package.json#exports`
|
|
37
|
+
entirely — could not resolve this package's types at all (`TS2307: Cannot find module`) even
|
|
38
|
+
after the previous exports-map fix restored `require()` at runtime; type resolution and runtime
|
|
39
|
+
resolution are separate algorithms. Verified against a real external consumer (whose
|
|
40
|
+
tsconfig uses this legacy resolution mode): adding these two fields, with its tsconfig completely
|
|
41
|
+
unchanged, made the error disappear. Also fixes absolute-path `require()` (distinct from a bare
|
|
42
|
+
specifier, which already worked) for the same reason — `main` was previously absent.
|
|
43
|
+
|
|
44
|
+
Purely additive: every modern resolver (Node's own runtime `exports` resolution, TypeScript's
|
|
45
|
+
`bundler`/`node16`/`nodenext`) prefers `exports` over `main`/`types` when both are present, so
|
|
46
|
+
this changes nothing for a consumer already on a modern resolver.
|
|
47
|
+
|
|
48
|
+
- Updated dependencies
|
|
49
|
+
- @jini-ai/core@0.1.2
|
|
50
|
+
|
|
51
|
+
## 0.1.1
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- Add a `"default"` export condition to every published package's `exports` map — every one of
|
|
56
|
+
them lacked it, which meant `require()` failed with `ERR_PACKAGE_PATH_NOT_EXPORTED` for any
|
|
57
|
+
CommonJS consumer (found via a real external integration attempt; Node needs `require(esm)`
|
|
58
|
+
support, i.e. Node >=22.12, for this to resolve).
|
|
59
|
+
|
|
60
|
+
`@jini-ai/agent-runtime`:
|
|
61
|
+
|
|
62
|
+
- **New**: `RuntimeBuildOptions.permissionMode` (`'bypass' | 'restricted'`) lets a caller opt a
|
|
63
|
+
run OUT of the auto-approve-every-permission-prompt flag every def with one
|
|
64
|
+
(`bypassPermissions` / `--yolo` / `--dangerously-skip-permissions`) previously pushed
|
|
65
|
+
unconditionally, with no way to turn it off. Omitting it keeps today's default (bypass)
|
|
66
|
+
behavior unchanged.
|
|
67
|
+
- **New**: `ClaudeStreamEvent`, `CopilotStreamEvent`, and `QoderEvent` are now real exported
|
|
68
|
+
discriminated unions instead of `Record<string, unknown>` — a real external consumer guessed a
|
|
69
|
+
nonexistent field name (`event.text` instead of the actual `event.delta`) against the old
|
|
70
|
+
untyped sink and silently lost every streamed token with no compile or runtime error.
|
|
71
|
+
- Fixed a doc/implementation mismatch in `claude-stream.ts`: the module doc claimed `tool_result`
|
|
72
|
+
events carry `{ tool_use_id, content, is_error }`; the actual emitted shape is
|
|
73
|
+
`{ toolUseId, content, isError }`.
|
|
74
|
+
|
|
75
|
+
`@jini-ai/daemon`: `AgentExecutorRunInput.permissionMode` forwards the new
|
|
76
|
+
`RuntimeBuildOptions.permissionMode` through to `buildArgs`, so a host can actually reach the new
|
|
77
|
+
opt-out from the daemon's real run-input surface, not just from `@jini-ai/agent-runtime` in
|
|
78
|
+
isolation.
|
|
79
|
+
|
|
80
|
+
`@jini-ai/agentic`: `setAtPointer` no longer throws on a malformed (e.g. missing leading `/`)
|
|
81
|
+
`updateDataModel` path — degrades to a no-op like its sibling `getAtPointer`, matching this
|
|
82
|
+
package's own "a bad binding must not crash the renderer" contract. That path is agent-authored
|
|
83
|
+
wire data with no error boundary above it in any host, so the uncaught throw could unmount an
|
|
84
|
+
entire chat UI from ~40 bytes of malformed input.
|
|
85
|
+
|
|
86
|
+
`@jini-ai/chat-react`: a local (client-resolved) A2UI button action is no longer a silent no-op —
|
|
87
|
+
`A2uiSurfaceCard` now surfaces the resolved value. New `ExtEventErrorBoundary` confines a
|
|
88
|
+
`kind: 'ext'` event group's renderer to its own card instead of letting a render/effect-phase
|
|
89
|
+
throw from agent-controlled content unmount the whole chat root (there was no error boundary
|
|
90
|
+
anywhere in this package or its hosts before this).
|
|
91
|
+
|
|
92
|
+
- Updated dependencies
|
|
93
|
+
- @jini-ai/core@0.1.1
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ or knows what your sidecar actually does — it is the filesystem/IPC/port layer
|
|
|
13
13
|
npm install @jini-ai/sidecar
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
No peer dependencies. Its
|
|
16
|
+
No peer dependencies. Its dependencies are `@jini-ai/core` and `@jini-ai/platform` (installed automatically); everything
|
|
17
17
|
else it uses is a Node built-in.
|
|
18
18
|
|
|
19
19
|
## What you get
|
|
@@ -28,20 +28,20 @@ hardcoded product constants: `resolveNamespace`, `resolveNamespaceRoot`, `resolv
|
|
|
28
28
|
**IPC paths** — `normalizeIpcPath` and `isWindowsNamedPipePath` (Windows named pipes vs. Unix
|
|
29
29
|
domain sockets), plus `resolveAppIpcPath` for the app-scoped socket path.
|
|
30
30
|
|
|
31
|
-
**JSON IPC** — `createJsonIpcServer({ socketPath, handler, maxFrameBytes, idleTimeoutMs })` and
|
|
32
|
-
`requestJsonIpc(socketPath, payload, { timeoutMs })`: a newline-delimited JSON request/response
|
|
31
|
+
**JSON IPC** — `createJsonIpcServer({ socketPath, handler }, { maxFrameBytes, idleTimeoutMs })` and
|
|
32
|
+
`requestJsonIpc({ socketPath, payload }, { timeoutMs })`: a newline-delimited JSON request/response
|
|
33
33
|
channel over a local socket, with a per-frame byte cap and an idle-connection timeout.
|
|
34
34
|
|
|
35
|
-
**Port allocation** — `allocatePort({ host, label, port, reserved })`, which either honors a forced
|
|
35
|
+
**Port allocation** — `allocatePort({}, { host, label, port, reserved })`, which either honors a forced
|
|
36
36
|
port or finds a free dynamic one, returning `{ port, source: 'dynamic' | 'forced' }`.
|
|
37
37
|
|
|
38
38
|
**Launch and bootstrap** — `createSidecarLaunchEnv` (parent side: build the child's environment) and
|
|
39
|
-
`bootstrapSidecarRuntime(
|
|
39
|
+
`bootstrapSidecarRuntime({ stampInput, env, app, contract }, options)` (child side: validate the stamp against the expected
|
|
40
40
|
app via the injected contract and return a `SidecarRuntimeContext`). A stamp mismatch throws rather
|
|
41
41
|
than starting a sidecar that belongs to a different app.
|
|
42
42
|
|
|
43
43
|
**Local daemon registry** — a `dataDir`-scoped pointer file recording a running daemon's
|
|
44
|
-
URL/host/port/pid/start time, plus liveness checking: `resolveDaemonRegistryPath(dataDir)`,
|
|
44
|
+
URL/host/port/pid/start time, plus liveness checking: `resolveDaemonRegistryPath({ dataDir })`,
|
|
45
45
|
`writeDaemonRegistryRecord`, `readLiveDaemonRegistryRecord` (returns `null` when the recorded pid is
|
|
46
46
|
gone), `removeDaemonRegistryRecordIfCurrent`, `isProcessAlive`.
|
|
47
47
|
|
|
@@ -60,9 +60,9 @@ import {
|
|
|
60
60
|
type LocalDaemonRegistryRecord,
|
|
61
61
|
} from '@jini-ai/sidecar';
|
|
62
62
|
|
|
63
|
-
const { port } = await allocatePort({ host: '127.0.0.1', label: 'daemon' });
|
|
63
|
+
const { port } = await allocatePort({}, { host: '127.0.0.1', label: 'daemon' });
|
|
64
64
|
|
|
65
|
-
const registryPath = resolveDaemonRegistryPath('/var/lib/example');
|
|
65
|
+
const registryPath = resolveDaemonRegistryPath({ dataDir: '/var/lib/example' });
|
|
66
66
|
const record: LocalDaemonRegistryRecord = {
|
|
67
67
|
url: `http://127.0.0.1:${port}`,
|
|
68
68
|
host: '127.0.0.1',
|
|
@@ -70,16 +70,16 @@ const record: LocalDaemonRegistryRecord = {
|
|
|
70
70
|
pid: process.pid,
|
|
71
71
|
startedAt: new Date().toISOString(),
|
|
72
72
|
};
|
|
73
|
-
await writeDaemonRegistryRecord(registryPath, record);
|
|
73
|
+
await writeDaemonRegistryRecord({ registryPath, record });
|
|
74
74
|
|
|
75
75
|
// Any other process, later — `null` when nothing is actually running.
|
|
76
|
-
const live = await readLiveDaemonRegistryRecord(registryPath);
|
|
76
|
+
const live = await readLiveDaemonRegistryRecord({ registryPath });
|
|
77
77
|
|
|
78
78
|
const ipc = await createJsonIpcServer({
|
|
79
79
|
socketPath: '/tmp/example/daemon.sock',
|
|
80
|
-
handler: async (message) => ({ echo: message }),
|
|
80
|
+
handler: async ({ message }) => ({ echo: message }),
|
|
81
81
|
});
|
|
82
|
-
const reply = await requestJsonIpc<{ echo: unknown }>('/tmp/example/daemon.sock', { ping: true });
|
|
82
|
+
const reply = await requestJsonIpc<{ echo: unknown }>({ socketPath: '/tmp/example/daemon.sock', payload: { ping: true } });
|
|
83
83
|
await ipc.close();
|
|
84
84
|
```
|
|
85
85
|
|
|
@@ -102,5 +102,31 @@ ESM only — ships `"type": "module"` with no CommonJS `require` build.
|
|
|
102
102
|
|
|
103
103
|
## Provenance
|
|
104
104
|
|
|
105
|
-
See
|
|
105
|
+
See the archived provenance ledger for per-file provenance and scope decisions. Apache-2.0,
|
|
106
106
|
inherited from Open Design — see the repo `NOTICE`.
|
|
107
|
+
|
|
108
|
+
## Argument convention and runtime subpaths
|
|
109
|
+
|
|
110
|
+
See [API.md](https://github.com/AINSEP/Jini/blob/main/packages/sidecar/API.md) for supervisor ports and the required/optional object convention. `./respawn-policy` and `./supervisor` are universal; `./supervisor/node` and the root entry use Node.
|
|
111
|
+
|
|
112
|
+
## Kernel contracts
|
|
113
|
+
|
|
114
|
+
Runtime JSON state writes delegate to `@jini-ai/platform/fs`'s async atomic writer.
|
|
115
|
+
`writeJsonFile({ filePath, payload })` keeps pretty JSON and its trailing newline. Existing
|
|
116
|
+
permissions survive replacement; new files keep the usual umask-filtered create mode.
|
|
117
|
+
The writer exclusively creates its sibling temp, syncs file bytes before rename, syncs the
|
|
118
|
+
parent directory afterward, and propagates failures (including a sync failure after replacement).
|
|
119
|
+
|
|
120
|
+
## Isolated supervisor Node defaults
|
|
121
|
+
|
|
122
|
+
`@jini-ai/sidecar/supervisor` exports only the generic process-port supervisor
|
|
123
|
+
and its types. `createNodeDaemonProcessAdapter`, `createSupervisorRegistry`,
|
|
124
|
+
`createNodeSupervisorScheduler` and the adapter types are exported exclusively
|
|
125
|
+
from `@jini-ai/sidecar/supervisor/node`. They are no longer re-exported from the
|
|
126
|
+
root or generic entry. Generic supervisor construction still requires the same
|
|
127
|
+
process, clock, scheduler and reporting ports and starts no work on import.
|
|
128
|
+
|
|
129
|
+
## Development typechecking
|
|
130
|
+
|
|
131
|
+
The package TypeScript configuration includes production source and `src/**/__tests__`.
|
|
132
|
+
`npx tsc -p tsconfig.json --noEmit`, run from this package directory, checks both without running tests.
|
package/dist/bootstrap.d.ts
CHANGED
|
@@ -7,18 +7,21 @@
|
|
|
7
7
|
* app/ipc/env, writes the canonical env back, and returns the live runtime
|
|
8
8
|
* context. Depends on the path resolvers and the public types.
|
|
9
9
|
*/
|
|
10
|
-
import type { BootstrapSidecarRuntimeOptions, SidecarLaunchEnvRequest, SidecarRuntimeContext, SidecarStampShape } from "./types.js";
|
|
10
|
+
import type { BootstrapSidecarRuntimeOptions, BootstrapSidecarRuntimeOptionsOptionalArgs, SidecarLaunchEnvRequestOptionalArgs, SidecarLaunchEnvRequest, SidecarRuntimeContext, SidecarStampShape } from "./types.js";
|
|
11
11
|
/**
|
|
12
12
|
* Compose the environment a child sidecar is launched with: the resolved base,
|
|
13
13
|
* the stamp's ipc path, namespace, and source, layered over `extraEnv`.
|
|
14
14
|
* @returns The launch environment.
|
|
15
15
|
*/
|
|
16
|
-
export declare function createSidecarLaunchEnv<TStamp extends SidecarStampShape>({ base, contract,
|
|
16
|
+
export declare function createSidecarLaunchEnv<TStamp extends SidecarStampShape>({ base, contract, stamp, }: SidecarLaunchEnvRequest<TStamp>, { extraEnv }?: SidecarLaunchEnvRequestOptionalArgs): NodeJS.ProcessEnv;
|
|
17
17
|
/**
|
|
18
18
|
* Bootstrap a sidecar runtime from an incoming stamp and env: validate app and
|
|
19
19
|
* ipc path, confirm no conflicting env, write the canonical env back, and return
|
|
20
20
|
* the resolved live runtime context.
|
|
21
21
|
* @returns The resolved {@link SidecarRuntimeContext}.
|
|
22
22
|
*/
|
|
23
|
-
export declare function bootstrapSidecarRuntime<TStamp extends SidecarStampShape>(stampInput
|
|
23
|
+
export declare function bootstrapSidecarRuntime<TStamp extends SidecarStampShape>({ stampInput, env, app, contract }: BootstrapSidecarRuntimeOptions<TStamp> & {
|
|
24
|
+
stampInput: unknown;
|
|
25
|
+
env: NodeJS.ProcessEnv;
|
|
26
|
+
}, optionalArgs?: BootstrapSidecarRuntimeOptionsOptionalArgs): SidecarRuntimeContext<TStamp>;
|
|
24
27
|
//# sourceMappingURL=bootstrap.d.ts.map
|
package/dist/bootstrap.js
CHANGED
|
@@ -13,11 +13,11 @@ import { resolveAppIpcPath, resolveSidecarBase } from "./paths.js";
|
|
|
13
13
|
* the stamp's ipc path, namespace, and source, layered over `extraEnv`.
|
|
14
14
|
* @returns The launch environment.
|
|
15
15
|
*/
|
|
16
|
-
export function createSidecarLaunchEnv({ base, contract, extraEnv = process.env
|
|
17
|
-
const normalizedStamp = contract.normalizeStamp(stamp);
|
|
16
|
+
export function createSidecarLaunchEnv({ base, contract, stamp, }, { extraEnv = process.env } = {}) {
|
|
17
|
+
const normalizedStamp = contract.normalizeStamp({ input: stamp });
|
|
18
18
|
return {
|
|
19
19
|
...extraEnv,
|
|
20
|
-
[contract.env.base]: resolveSidecarBase({
|
|
20
|
+
[contract.env.base]: resolveSidecarBase({ contract, source: normalizedStamp.source }, { base, env: extraEnv }),
|
|
21
21
|
[contract.env.ipcPath]: normalizedStamp.ipc,
|
|
22
22
|
[contract.env.namespace]: normalizedStamp.namespace,
|
|
23
23
|
[contract.env.source]: normalizedStamp.source,
|
|
@@ -39,20 +39,15 @@ function assertMatchingEnv(env, key, expected) {
|
|
|
39
39
|
* the resolved live runtime context.
|
|
40
40
|
* @returns The resolved {@link SidecarRuntimeContext}.
|
|
41
41
|
*/
|
|
42
|
-
export function bootstrapSidecarRuntime(stampInput, env,
|
|
43
|
-
const
|
|
44
|
-
const
|
|
42
|
+
export function bootstrapSidecarRuntime({ stampInput, env, app, contract }, optionalArgs = {}) {
|
|
43
|
+
const options = { app, contract, ...optionalArgs };
|
|
44
|
+
const stamp = options.contract.normalizeStamp({ input: stampInput });
|
|
45
|
+
const expectedApp = options.contract.normalizeApp({ app: options.app });
|
|
45
46
|
if (stamp.app !== expectedApp) {
|
|
46
47
|
throw new Error(`sidecar stamp app mismatch: expected ${expectedApp}, received ${stamp.app}`);
|
|
47
48
|
}
|
|
48
|
-
const base = resolveSidecarBase({
|
|
49
|
-
|
|
50
|
-
contract: options.contract,
|
|
51
|
-
env,
|
|
52
|
-
...(options.projectRoot === undefined ? {} : { projectRoot: options.projectRoot }),
|
|
53
|
-
source: stamp.source,
|
|
54
|
-
});
|
|
55
|
-
const ipc = resolveAppIpcPath({ app: stamp.app, contract: options.contract, env, namespace: stamp.namespace });
|
|
49
|
+
const base = resolveSidecarBase({ contract: options.contract, source: stamp.source }, { base: options.base ?? null, env, ...(options.projectRoot === undefined ? {} : { projectRoot: options.projectRoot }) });
|
|
50
|
+
const ipc = resolveAppIpcPath({ app: stamp.app, contract: options.contract, namespace: stamp.namespace }, { env });
|
|
56
51
|
if (stamp.ipc !== ipc) {
|
|
57
52
|
throw new Error(`sidecar ipc path mismatch: expected ${ipc}, received ${stamp.ipc}`);
|
|
58
53
|
}
|
|
@@ -34,20 +34,30 @@ export interface LocalDaemonRegistryRecord {
|
|
|
34
34
|
* @returns The resolved absolute registry file path.
|
|
35
35
|
* @throws When `dataDir` is not a non-empty string.
|
|
36
36
|
*/
|
|
37
|
-
export declare function resolveDaemonRegistryPath(dataDir
|
|
37
|
+
export declare function resolveDaemonRegistryPath({ dataDir }: {
|
|
38
|
+
dataDir: string;
|
|
39
|
+
}, { fileName }?: {
|
|
40
|
+
fileName?: string;
|
|
41
|
+
}): string;
|
|
38
42
|
/**
|
|
39
43
|
* Durably (atomically, via `json-file.ts`'s temp-file-rename writer) record a daemon's identity
|
|
40
44
|
* at `registryPath`. Safe under concurrent writers — the last writer to complete its rename wins,
|
|
41
45
|
* and every reader only ever observes a fully-written file, never a partial one.
|
|
42
46
|
*/
|
|
43
|
-
export declare function writeDaemonRegistryRecord(registryPath
|
|
47
|
+
export declare function writeDaemonRegistryRecord({ registryPath, record }: {
|
|
48
|
+
registryPath: string;
|
|
49
|
+
record: LocalDaemonRegistryRecord;
|
|
50
|
+
}): Promise<void>;
|
|
44
51
|
/**
|
|
45
52
|
* Remove a daemon's registry record at `registryPath`, but only if it still names `pid` as the
|
|
46
53
|
* owning process — the same guarded-removal shape `json-file.ts`'s `removePointerIfCurrent` uses
|
|
47
54
|
* for its own pointer file. Guards a fast crash-restart race on a reused `dataDir`: an old
|
|
48
55
|
* daemon's delayed shutdown cleanup must never delete a newer daemon's already-written record.
|
|
49
56
|
*/
|
|
50
|
-
export declare function removeDaemonRegistryRecordIfCurrent(registryPath
|
|
57
|
+
export declare function removeDaemonRegistryRecordIfCurrent({ registryPath, pid }: {
|
|
58
|
+
registryPath: string;
|
|
59
|
+
pid: number;
|
|
60
|
+
}): Promise<void>;
|
|
51
61
|
/**
|
|
52
62
|
* Probe whether OS process `pid` is currently alive, via `process.kill(pid, 0)` (sends no
|
|
53
63
|
* actual signal — `0` only tests deliverability). This is the liveness half of "verify, don't
|
|
@@ -59,15 +69,19 @@ export declare function removeDaemonRegistryRecordIfCurrent(registryPath: string
|
|
|
59
69
|
* discovery purposes). `false` for a non-positive/non-integer `pid`, a `pid` that does not exist
|
|
60
70
|
* (`ESRCH`), or any other unexpected failure (treated conservatively as not confirmed alive).
|
|
61
71
|
*/
|
|
62
|
-
export declare function isProcessAlive(pid
|
|
72
|
+
export declare function isProcessAlive({ pid }: {
|
|
73
|
+
pid: number;
|
|
74
|
+
}): boolean;
|
|
63
75
|
/**
|
|
64
76
|
* Read a daemon's registry record at `registryPath` and return it only if it is well-formed AND
|
|
65
77
|
* its recorded `pid` is still alive — the combined "read, don't just trust" discovery primitive a
|
|
66
|
-
* CLI-side `resolveDaemonUrl({ discover })` probe needs. A stale record from a daemon that crashed
|
|
78
|
+
* CLI-side `resolveDaemonUrl({}, { discover })` probe needs. A stale record from a daemon that crashed
|
|
67
79
|
* (pid no longer alive), a missing file, or a malformed/foreign JSON file all resolve to `null`
|
|
68
80
|
* rather than throwing — discovery failing is an expected, non-exceptional outcome (the caller
|
|
69
81
|
* falls through to its own `defaultUrl`/error, per `resolveDaemonUrl`'s own contract).
|
|
70
82
|
* @returns The live record, or `null` when nothing live was found.
|
|
71
83
|
*/
|
|
72
|
-
export declare function readLiveDaemonRegistryRecord(registryPath
|
|
84
|
+
export declare function readLiveDaemonRegistryRecord({ registryPath }: {
|
|
85
|
+
registryPath: string;
|
|
86
|
+
}): Promise<LocalDaemonRegistryRecord | null>;
|
|
73
87
|
//# sourceMappingURL=daemon-registry.d.ts.map
|
package/dist/daemon-registry.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
* existing module in this package needed before. Depends on `node:path` and this package's
|
|
12
12
|
* own `json-file.ts`.
|
|
13
13
|
*/
|
|
14
|
+
import { randomUUID } from "node:crypto";
|
|
15
|
+
import { link, rename } from "node:fs/promises";
|
|
14
16
|
import { join, resolve } from "node:path";
|
|
15
17
|
import { readJsonFile, removeFile, writeJsonFile } from "./json-file.js";
|
|
16
18
|
/** Default file name for a daemon's registry record, resolved relative to its `dataDir`. */
|
|
@@ -25,7 +27,7 @@ const DEFAULT_DAEMON_REGISTRY_FILE_NAME = "daemon.json";
|
|
|
25
27
|
* @returns The resolved absolute registry file path.
|
|
26
28
|
* @throws When `dataDir` is not a non-empty string.
|
|
27
29
|
*/
|
|
28
|
-
export function resolveDaemonRegistryPath(dataDir, fileName = DEFAULT_DAEMON_REGISTRY_FILE_NAME) {
|
|
30
|
+
export function resolveDaemonRegistryPath({ dataDir }, { fileName = DEFAULT_DAEMON_REGISTRY_FILE_NAME } = {}) {
|
|
29
31
|
if (typeof dataDir !== "string" || dataDir.trim().length === 0) {
|
|
30
32
|
throw new Error("dataDir must be a non-empty string");
|
|
31
33
|
}
|
|
@@ -36,8 +38,8 @@ export function resolveDaemonRegistryPath(dataDir, fileName = DEFAULT_DAEMON_REG
|
|
|
36
38
|
* at `registryPath`. Safe under concurrent writers — the last writer to complete its rename wins,
|
|
37
39
|
* and every reader only ever observes a fully-written file, never a partial one.
|
|
38
40
|
*/
|
|
39
|
-
export async function writeDaemonRegistryRecord(registryPath, record) {
|
|
40
|
-
await writeJsonFile(registryPath, record);
|
|
41
|
+
export async function writeDaemonRegistryRecord({ registryPath, record }) {
|
|
42
|
+
await writeJsonFile({ filePath: registryPath, payload: record });
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
43
45
|
* Remove a daemon's registry record at `registryPath`, but only if it still names `pid` as the
|
|
@@ -45,10 +47,34 @@ export async function writeDaemonRegistryRecord(registryPath, record) {
|
|
|
45
47
|
* for its own pointer file. Guards a fast crash-restart race on a reused `dataDir`: an old
|
|
46
48
|
* daemon's delayed shutdown cleanup must never delete a newer daemon's already-written record.
|
|
47
49
|
*/
|
|
48
|
-
export async function removeDaemonRegistryRecordIfCurrent(registryPath, pid) {
|
|
49
|
-
const record = await readJsonFile(registryPath);
|
|
50
|
-
if (record?.pid
|
|
51
|
-
|
|
50
|
+
export async function removeDaemonRegistryRecordIfCurrent({ registryPath, pid }) {
|
|
51
|
+
const record = await readJsonFile({ filePath: registryPath });
|
|
52
|
+
if (record?.pid !== pid)
|
|
53
|
+
return;
|
|
54
|
+
// Detach first, then check the captured record: a writer may replace the public path
|
|
55
|
+
// between the initial read and this rename. Only the captured file is ever removed.
|
|
56
|
+
const tombstonePath = `${registryPath}.${process.pid}.${randomUUID()}.removed`;
|
|
57
|
+
try {
|
|
58
|
+
await rename(registryPath, tombstonePath);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (error.code === "ENOENT")
|
|
62
|
+
return;
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
const captured = await readJsonFile({ filePath: tombstonePath });
|
|
66
|
+
if (captured?.pid !== pid) {
|
|
67
|
+
try {
|
|
68
|
+
// A hard link restores the captured file atomically ONLY if no newer record exists.
|
|
69
|
+
// Rename would overwrite that newer writer. Keep the tombstone if restoration fails.
|
|
70
|
+
await link(tombstonePath, registryPath);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
if (error.code !== "EEXIST")
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
await removeFile({ filePath: tombstonePath });
|
|
52
78
|
}
|
|
53
79
|
/**
|
|
54
80
|
* Probe whether OS process `pid` is currently alive, via `process.kill(pid, 0)` (sends no
|
|
@@ -61,7 +87,7 @@ export async function removeDaemonRegistryRecordIfCurrent(registryPath, pid) {
|
|
|
61
87
|
* discovery purposes). `false` for a non-positive/non-integer `pid`, a `pid` that does not exist
|
|
62
88
|
* (`ESRCH`), or any other unexpected failure (treated conservatively as not confirmed alive).
|
|
63
89
|
*/
|
|
64
|
-
export function isProcessAlive(pid) {
|
|
90
|
+
export function isProcessAlive({ pid }) {
|
|
65
91
|
if (!Number.isInteger(pid) || pid <= 0)
|
|
66
92
|
return false;
|
|
67
93
|
try {
|
|
@@ -98,17 +124,17 @@ function isValidRegistryRecord(value) {
|
|
|
98
124
|
/**
|
|
99
125
|
* Read a daemon's registry record at `registryPath` and return it only if it is well-formed AND
|
|
100
126
|
* its recorded `pid` is still alive — the combined "read, don't just trust" discovery primitive a
|
|
101
|
-
* CLI-side `resolveDaemonUrl({ discover })` probe needs. A stale record from a daemon that crashed
|
|
127
|
+
* CLI-side `resolveDaemonUrl({}, { discover })` probe needs. A stale record from a daemon that crashed
|
|
102
128
|
* (pid no longer alive), a missing file, or a malformed/foreign JSON file all resolve to `null`
|
|
103
129
|
* rather than throwing — discovery failing is an expected, non-exceptional outcome (the caller
|
|
104
130
|
* falls through to its own `defaultUrl`/error, per `resolveDaemonUrl`'s own contract).
|
|
105
131
|
* @returns The live record, or `null` when nothing live was found.
|
|
106
132
|
*/
|
|
107
|
-
export async function readLiveDaemonRegistryRecord(registryPath) {
|
|
108
|
-
const record = await readJsonFile(registryPath);
|
|
133
|
+
export async function readLiveDaemonRegistryRecord({ registryPath }) {
|
|
134
|
+
const record = await readJsonFile({ filePath: registryPath });
|
|
109
135
|
if (!isValidRegistryRecord(record))
|
|
110
136
|
return null;
|
|
111
|
-
if (!isProcessAlive(record.pid))
|
|
137
|
+
if (!isProcessAlive({ pid: record.pid }))
|
|
112
138
|
return null;
|
|
113
139
|
return record;
|
|
114
140
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* running daemon's URL/host/port/pid, and a liveness-checked reader. This file
|
|
10
10
|
* contains no logic; every implementation lives in a concern module beside it.
|
|
11
11
|
*/
|
|
12
|
-
export type { AppIpcPathRequest, AppRuntimePathRequest, BaseResolutionOptions, BootstrapSidecarRuntimeOptions, JsonIpcHandler, JsonIpcServerHandle, NamespaceResolutionOptions, PortAllocation, PortRequest, ProjectRuntimePathRequest, RuntimePathRequest, RuntimeRootRequest, SidecarContractDescriptor, SidecarLaunchEnvRequest, SidecarRuntimeContext, SidecarStampShape, } from "./types.js";
|
|
12
|
+
export type { AppIpcPathRequest, AppRuntimePathRequest, BaseResolutionOptions, BootstrapSidecarRuntimeOptions, JsonIpcHandler, JsonIpcServerHandle, NamespaceResolutionOptions, NamespaceOptionalArgs, BaseResolutionOptionsOptionalArgs, AppIpcPathRequestOptionalArgs, SidecarLaunchEnvRequestOptionalArgs, BootstrapSidecarRuntimeOptionsOptionalArgs, PortAllocation, PortRequest, ProjectRuntimePathRequest, RuntimePathRequest, RuntimeRootRequest, SidecarContractDescriptor, SidecarLaunchEnvRequest, SidecarRuntimeContext, SidecarStampShape, } from "./types.js";
|
|
13
13
|
export { isWindowsNamedPipePath, normalizeIpcPath } from "./ipc-path.js";
|
|
14
14
|
export { resolveAppIpcPath, resolveAppRuntimeDir, resolveAppRuntimePath, resolveLogFilePath, resolveLogsDir, resolveManifestPath, resolveNamespace, resolveNamespaceRoot, resolvePointerPath, resolveProjectRoot, resolveProjectTmpRoot, resolveRuntimeNamespaceRoot, resolveRuntimeRoot, resolveSidecarBase, resolveSourceRuntimeRoot, } from "./paths.js";
|
|
15
15
|
export { bootstrapSidecarRuntime, createSidecarLaunchEnv } from "./bootstrap.js";
|
|
@@ -18,4 +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
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -16,4 +16,6 @@ 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
|
+
export * from "./respawn-policy.js";
|
|
20
|
+
export * from "./supervisor.js";
|
|
19
21
|
//# sourceMappingURL=index.js.map
|
package/dist/ipc-path.d.ts
CHANGED
|
@@ -9,11 +9,15 @@
|
|
|
9
9
|
* Detect whether a value is a Windows named-pipe path (`\\.\pipe\...`).
|
|
10
10
|
* @returns `true` when `value` is such a pipe path.
|
|
11
11
|
*/
|
|
12
|
-
export declare function isWindowsNamedPipePath(value
|
|
12
|
+
export declare function isWindowsNamedPipePath({ value }: {
|
|
13
|
+
value: unknown;
|
|
14
|
+
}): boolean;
|
|
13
15
|
/**
|
|
14
16
|
* Validate and return an IPC path: a Windows named pipe is accepted as-is, and
|
|
15
17
|
* any other value must be a non-empty, un-padded, null-byte-free absolute path.
|
|
16
18
|
* @returns The validated IPC path.
|
|
17
19
|
*/
|
|
18
|
-
export declare function normalizeIpcPath(ipc
|
|
20
|
+
export declare function normalizeIpcPath({ ipc }: {
|
|
21
|
+
ipc: unknown;
|
|
22
|
+
}): string;
|
|
19
23
|
//# sourceMappingURL=ipc-path.d.ts.map
|
package/dist/ipc-path.js
CHANGED
|
@@ -10,7 +10,7 @@ import { isAbsolute } from "node:path";
|
|
|
10
10
|
* Detect whether a value is a Windows named-pipe path (`\\.\pipe\...`).
|
|
11
11
|
* @returns `true` when `value` is such a pipe path.
|
|
12
12
|
*/
|
|
13
|
-
export function isWindowsNamedPipePath(value) {
|
|
13
|
+
export function isWindowsNamedPipePath({ value }) {
|
|
14
14
|
return typeof value === "string" && value.startsWith("\\\\.\\pipe\\");
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
@@ -18,7 +18,7 @@ export function isWindowsNamedPipePath(value) {
|
|
|
18
18
|
* any other value must be a non-empty, un-padded, null-byte-free absolute path.
|
|
19
19
|
* @returns The validated IPC path.
|
|
20
20
|
*/
|
|
21
|
-
export function normalizeIpcPath(ipc) {
|
|
21
|
+
export function normalizeIpcPath({ ipc }) {
|
|
22
22
|
if (typeof ipc !== "string")
|
|
23
23
|
throw new Error("sidecar ipc path must be a string");
|
|
24
24
|
if (ipc.length === 0)
|
|
@@ -27,7 +27,7 @@ export function normalizeIpcPath(ipc) {
|
|
|
27
27
|
throw new Error("sidecar ipc path must not contain leading or trailing whitespace");
|
|
28
28
|
if (ipc.includes("\0"))
|
|
29
29
|
throw new Error("sidecar ipc path must not contain null bytes");
|
|
30
|
-
if (isWindowsNamedPipePath(ipc))
|
|
30
|
+
if (isWindowsNamedPipePath({ value: ipc }))
|
|
31
31
|
return ipc;
|
|
32
32
|
if (!isAbsolute(ipc))
|
|
33
33
|
throw new Error(`sidecar ipc path must be absolute: ${ipc}`);
|
package/dist/json-file.d.ts
CHANGED
|
@@ -5,24 +5,35 @@
|
|
|
5
5
|
* any failure), an atomic pretty-printed writer via temp-file rename, a
|
|
6
6
|
* best-effort remove, and a guarded pointer removal that only deletes when the
|
|
7
7
|
* pointer still names the given run. Depends on `node:fs/promises` and
|
|
8
|
-
*
|
|
8
|
+
* the platform filesystem writer for shared atomic replacement and durability.
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
11
11
|
* Read and parse a JSON file, swallowing any read/parse error.
|
|
12
12
|
* @returns The parsed value, or `null` if missing or unreadable.
|
|
13
13
|
*/
|
|
14
|
-
export declare function readJsonFile<T = any>(filePath
|
|
14
|
+
export declare function readJsonFile<T = any>({ filePath }: {
|
|
15
|
+
filePath: string;
|
|
16
|
+
}): Promise<T | null>;
|
|
15
17
|
/**
|
|
16
18
|
* Atomically write `payload` as pretty-printed JSON via a temp-file rename,
|
|
17
|
-
* creating the parent directory if needed.
|
|
19
|
+
* creating the parent directory if needed. Existing modes are preserved; file bytes
|
|
20
|
+
* are synced before rename and the parent directory afterward. Sync failures propagate.
|
|
18
21
|
*/
|
|
19
|
-
export declare function writeJsonFile(filePath
|
|
22
|
+
export declare function writeJsonFile({ filePath, payload }: {
|
|
23
|
+
filePath: string;
|
|
24
|
+
payload: unknown;
|
|
25
|
+
}): Promise<void>;
|
|
20
26
|
/**
|
|
21
27
|
* Remove a file, forcing (no error if absent).
|
|
22
28
|
*/
|
|
23
|
-
export declare function removeFile(filePath
|
|
29
|
+
export declare function removeFile({ filePath }: {
|
|
30
|
+
filePath: string;
|
|
31
|
+
}): Promise<void>;
|
|
24
32
|
/**
|
|
25
33
|
* Remove a pointer file only if it still points at `runId`.
|
|
26
34
|
*/
|
|
27
|
-
export declare function removePointerIfCurrent(pointerPath
|
|
35
|
+
export declare function removePointerIfCurrent({ pointerPath, runId }: {
|
|
36
|
+
pointerPath: string;
|
|
37
|
+
runId: string;
|
|
38
|
+
}): Promise<void>;
|
|
28
39
|
//# sourceMappingURL=json-file.d.ts.map
|
package/dist/json-file.js
CHANGED
|
@@ -5,15 +5,16 @@
|
|
|
5
5
|
* any failure), an atomic pretty-printed writer via temp-file rename, a
|
|
6
6
|
* best-effort remove, and a guarded pointer removal that only deletes when the
|
|
7
7
|
* pointer still names the given run. Depends on `node:fs/promises` and
|
|
8
|
-
*
|
|
8
|
+
* the platform filesystem writer for shared atomic replacement and durability.
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { randomUUID } from "node:crypto";
|
|
11
|
+
import { readFile, rm } from "node:fs/promises";
|
|
12
|
+
import { writeJsonFileAtomicAsync } from "@jini-ai/platform/fs";
|
|
12
13
|
/**
|
|
13
14
|
* Read and parse a JSON file, swallowing any read/parse error.
|
|
14
15
|
* @returns The parsed value, or `null` if missing or unreadable.
|
|
15
16
|
*/
|
|
16
|
-
export async function readJsonFile(filePath) {
|
|
17
|
+
export async function readJsonFile({ filePath }) {
|
|
17
18
|
try {
|
|
18
19
|
return JSON.parse(await readFile(filePath, "utf8"));
|
|
19
20
|
}
|
|
@@ -23,26 +24,27 @@ export async function readJsonFile(filePath) {
|
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
26
|
* Atomically write `payload` as pretty-printed JSON via a temp-file rename,
|
|
26
|
-
* creating the parent directory if needed.
|
|
27
|
+
* creating the parent directory if needed. Existing modes are preserved; file bytes
|
|
28
|
+
* are synced before rename and the parent directory afterward. Sync failures propagate.
|
|
27
29
|
*/
|
|
28
|
-
export async function writeJsonFile(filePath, payload) {
|
|
29
|
-
await
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
export async function writeJsonFile({ filePath, payload }) {
|
|
31
|
+
await writeJsonFileAtomicAsync({ filePath, data: payload }, {
|
|
32
|
+
createParent: true, trailingNewline: true, defaultMode: 0o666 & ~process.umask(),
|
|
33
|
+
tempPath: () => `${filePath}.${process.pid}.${randomUUID()}.tmp`,
|
|
34
|
+
});
|
|
33
35
|
}
|
|
34
36
|
/**
|
|
35
37
|
* Remove a file, forcing (no error if absent).
|
|
36
38
|
*/
|
|
37
|
-
export async function removeFile(filePath) {
|
|
39
|
+
export async function removeFile({ filePath }) {
|
|
38
40
|
await rm(filePath, { force: true });
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
41
43
|
* Remove a pointer file only if it still points at `runId`.
|
|
42
44
|
*/
|
|
43
|
-
export async function removePointerIfCurrent(pointerPath, runId) {
|
|
44
|
-
const pointer = await readJsonFile(pointerPath);
|
|
45
|
+
export async function removePointerIfCurrent({ pointerPath, runId }) {
|
|
46
|
+
const pointer = await readJsonFile({ filePath: pointerPath });
|
|
45
47
|
if (pointer?.runId === runId)
|
|
46
|
-
await removeFile(pointerPath);
|
|
48
|
+
await removeFile({ filePath: pointerPath });
|
|
47
49
|
}
|
|
48
50
|
//# sourceMappingURL=json-file.js.map
|
package/dist/json-ipc.d.ts
CHANGED
|
@@ -22,7 +22,9 @@ import type { JsonIpcHandler, JsonIpcServerHandle } from "./types.js";
|
|
|
22
22
|
* hand today — matching this repo's "extract into a directly-testable pure
|
|
23
23
|
* function" convention rather than narrowing the type away.
|
|
24
24
|
*/
|
|
25
|
-
export declare function jsonIpcError(error
|
|
25
|
+
export declare function jsonIpcError({ error }: {
|
|
26
|
+
error: unknown;
|
|
27
|
+
}): {
|
|
26
28
|
code?: string;
|
|
27
29
|
message: string;
|
|
28
30
|
};
|
|
@@ -38,16 +40,19 @@ export declare function jsonIpcError(error: unknown): {
|
|
|
38
40
|
* Windows. Testing this function directly (asserting no filesystem call
|
|
39
41
|
* happens) verifies the real behavior on every platform this runs on.
|
|
40
42
|
*/
|
|
41
|
-
export declare function prepareIpcPath(socketPath
|
|
43
|
+
export declare function prepareIpcPath({ socketPath }: {
|
|
44
|
+
socketPath: string;
|
|
45
|
+
}): Promise<void>;
|
|
42
46
|
/**
|
|
43
47
|
* Start a newline-delimited JSON IPC server on a unix socket / named pipe: each
|
|
44
48
|
* connection carries one JSON request, the handler's result is written back as
|
|
45
49
|
* `{ok:true,result}` (or `{ok:false,error}` on parse/handler failure).
|
|
46
50
|
* @returns A handle whose `close()` stops the server and unlinks the socket.
|
|
47
51
|
*/
|
|
48
|
-
export declare function createJsonIpcServer({ handler, socketPath,
|
|
52
|
+
export declare function createJsonIpcServer({ handler, socketPath, }: {
|
|
49
53
|
handler: JsonIpcHandler;
|
|
50
54
|
socketPath: string;
|
|
55
|
+
}, { maxFrameBytes, idleTimeoutMs }?: {
|
|
51
56
|
/** Reject a connection whose single frame exceeds this many bytes before a newline arrives (SEC-004). @default 1_000_000 */
|
|
52
57
|
maxFrameBytes?: number;
|
|
53
58
|
/** Drop a connection that has not delivered one complete frame within this many ms (SEC-004). @default 30_000 */
|
|
@@ -58,7 +63,10 @@ export declare function createJsonIpcServer({ handler, socketPath, maxFrameBytes
|
|
|
58
63
|
* resolve with the server's `result`, rejecting on error response or timeout.
|
|
59
64
|
* @returns The server's `result` payload.
|
|
60
65
|
*/
|
|
61
|
-
export declare function requestJsonIpc<T = any>(socketPath
|
|
66
|
+
export declare function requestJsonIpc<T = any>({ socketPath, payload }: {
|
|
67
|
+
socketPath: string;
|
|
68
|
+
payload: unknown;
|
|
69
|
+
}, { timeoutMs }?: {
|
|
62
70
|
timeoutMs?: number;
|
|
63
71
|
}): Promise<T>;
|
|
64
72
|
//# sourceMappingURL=json-ipc.d.ts.map
|