werkmeister-core 0.90.5 → 0.90.6
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 +6 -0
- package/dist/docker.d.ts +2 -1
- package/dist/docker.js +2 -2
- package/dist/dockerode_load.d.ts +2 -0
- package/dist/dockerode_load.js +11 -0
- package/dist/proc.js +8 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# sandbox-core
|
|
2
2
|
|
|
3
|
+
## 0.90.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fa318f9: Faster starts and prompt exits. `dockerode` (about 300 modules, ~0.2 s of CPU) loads on the first Docker call instead of at start, so a command that never reaches the Engine no longer pays for it. A command that is not installed (a missing `gh`, say) no longer holds the process open for its whole timeout after failing. The MCP proxy exits when its client closes stdin, instead of waiting two seconds to be signalled.
|
|
8
|
+
|
|
3
9
|
## 0.90.5
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/docker.d.ts
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* `depends_on: service_healthy`, profiles, BuildKit, `.env` interpolation — is a
|
|
11
11
|
* project to reimplement, not a refactor.
|
|
12
12
|
*/
|
|
13
|
-
import
|
|
13
|
+
import type Dockerode from "dockerode";
|
|
14
|
+
import type { DockerOptions } from "dockerode";
|
|
14
15
|
/**
|
|
15
16
|
* Where the daemon is.
|
|
16
17
|
*
|
package/dist/docker.js
CHANGED
|
@@ -16,9 +16,9 @@ import * as os from "node:os";
|
|
|
16
16
|
import * as path from "node:path";
|
|
17
17
|
import { PassThrough, Readable } from "node:stream";
|
|
18
18
|
import { StringDecoder } from "node:string_decoder";
|
|
19
|
-
import Dockerode from "dockerode";
|
|
20
19
|
import * as tar from "tar-fs";
|
|
21
20
|
import { BLUE, CYAN, GREEN, MAGENTA, RESET, YELLOW } from "./colors.js";
|
|
21
|
+
import { loadDockerode } from "./dockerode_load.js";
|
|
22
22
|
import { ProcError, run } from "./proc.js";
|
|
23
23
|
/**
|
|
24
24
|
* Where the daemon is.
|
|
@@ -125,7 +125,7 @@ export function endpointOptions(host) {
|
|
|
125
125
|
let client = null;
|
|
126
126
|
/** The shared client. The endpoint is resolved once, on first use. */
|
|
127
127
|
export function docker() {
|
|
128
|
-
return (client ??= new
|
|
128
|
+
return (client ??= new (loadDockerode())(resolveEndpoint()));
|
|
129
129
|
}
|
|
130
130
|
/**
|
|
131
131
|
* A compose project's containers, found by the labels compose stamps on them.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dockerode, loaded on first use. Its graph is about 300 CommonJS modules (~0.2 s of CPU at
|
|
3
|
+
* start), and most processes that import docker.ts never reach the Engine.
|
|
4
|
+
*
|
|
5
|
+
* A bundler cannot follow this require: the CLI leaves dockerode external, so it resolves at
|
|
6
|
+
* run time, and the VS Code extension's esbuild.mjs swaps this module for a static import.
|
|
7
|
+
*/
|
|
8
|
+
import { createRequire } from "node:module";
|
|
9
|
+
export function loadDockerode() {
|
|
10
|
+
return createRequire(import.meta.url)("dockerode");
|
|
11
|
+
}
|
package/dist/proc.js
CHANGED
|
@@ -94,8 +94,12 @@ export function runAsync(cmd, opts = {}) {
|
|
|
94
94
|
env: spawnEnv(cmd, opts.env),
|
|
95
95
|
stdio,
|
|
96
96
|
signal: opts.signal,
|
|
97
|
-
timeout: opts.timeout !== undefined ? timeoutMs(opts.timeout) : undefined,
|
|
98
97
|
});
|
|
98
|
+
// Not spawn's own `timeout`: Node leaves that timer running when the command is missing,
|
|
99
|
+
// and it holds the process open for the whole timeout after the ENOENT.
|
|
100
|
+
const timer = opts.timeout !== undefined
|
|
101
|
+
? setTimeout(() => child.kill(), timeoutMs(opts.timeout))
|
|
102
|
+
: undefined;
|
|
99
103
|
let stdout = "";
|
|
100
104
|
let stderr = "";
|
|
101
105
|
child.stdout?.on("data", (d) => (stdout += d.toString()));
|
|
@@ -119,6 +123,7 @@ export function runAsync(cmd, opts = {}) {
|
|
|
119
123
|
};
|
|
120
124
|
const aborted = () => opts.signal?.aborted === true;
|
|
121
125
|
child.on("error", (e) => {
|
|
126
|
+
clearTimeout(timer);
|
|
122
127
|
const code = e.code;
|
|
123
128
|
if (aborted()) {
|
|
124
129
|
fail(`Command aborted: ${cmd.join(" ")}`, -1, "ABORT_ERR");
|
|
@@ -131,11 +136,12 @@ export function runAsync(cmd, opts = {}) {
|
|
|
131
136
|
fail(`Command failed to start: ${cmd.join(" ")} (${e.message})`, -1, code);
|
|
132
137
|
});
|
|
133
138
|
child.on("close", (status) => {
|
|
139
|
+
clearTimeout(timer);
|
|
134
140
|
if (aborted()) {
|
|
135
141
|
fail(`Command aborted: ${cmd.join(" ")}`, -1, "ABORT_ERR");
|
|
136
142
|
return;
|
|
137
143
|
}
|
|
138
|
-
// Not aborted, so a kill can only be the timeout
|
|
144
|
+
// Not aborted, so a kill can only be the timeout above. Asked of
|
|
139
145
|
// the child, not its exit shape: docker compose traps the SIGTERM and exits
|
|
140
146
|
// 130 with no signal (SW-86).
|
|
141
147
|
if (child.killed && opts.timeout !== undefined) {
|
package/package.json
CHANGED