@ours.network/install 1.2.1-nightly.15 → 1.2.1-nightly.17

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.
@@ -2,100 +2,100 @@
2
2
  "release": {
3
3
  "schema": 1,
4
4
  "channel": "nightly",
5
- "installerVersion": "1.2.1-nightly.15",
5
+ "installerVersion": "1.2.1-nightly.17",
6
6
  "packages": {
7
7
  "@ours.network/sdk": {
8
- "version": "3.8.1-nightly.11",
9
- "integrity": "sha512-dGiMUFXdZLzdwo0U2ilBTanG/aSBfUwfIkicGgCV2gQ710DYcWny9yqRAPCErw0zrh4sspm0HsWEUP/Q+Y/Q9g=="
8
+ "version": "3.8.1-nightly.14",
9
+ "integrity": "sha512-YUnFJ8hYFpLPMVLVDCWVx6m0EtMOpoEOdd9mXFwkl8zdTHr1OG0YOU8+5oJY6I95nhPa+sujSnwX5WJq9+BxRg=="
10
10
  },
11
11
  "@ours.network/cli": {
12
- "version": "2.8.1-nightly.9",
13
- "integrity": "sha512-vC6E2Tjgje2yJrw5WdSDEH/rt8YWphk1jLjao0Ie2gz+1oyNiAd9Q8VfFZGDSFa7p5xlVRTZzmOgybJuKbabew=="
12
+ "version": "2.8.1-nightly.12",
13
+ "integrity": "sha512-ZeUImuHbdFNRSfYUETfBv+gTevOJ1+Sn+QY0JjpO0cXJpGC7hVnQ0tYmZRM6qxT8QXq3+Z/NUwfJxyyrf95BgQ=="
14
14
  },
15
15
  "@ours.network/tg-connector": {
16
- "version": "1.0.1-nightly.6",
17
- "integrity": "sha512-ywgwHm59UotZJanvBj3fp0cjwcX3BC+sP+0UU0+P32Qdrl53DKKi6VAt0xleBmUmC874sWc4tW9y4J/Sg/cCOA=="
16
+ "version": "1.0.1-nightly.8",
17
+ "integrity": "sha512-8p7XLWIhsMLbJOby1dL5WJdf66tQYUAY2UKp5Dl2Oh8cy2EGkfIiwjsWREph6bjtYihwSzCgNa1qXTNFZgV9pg=="
18
18
  },
19
19
  "@ours.network/cowork": {
20
- "version": "1.3.3-nightly.20260923.2d2ff89",
21
- "integrity": "sha512-0dwh40D7mSfx2qg25wQsy83ed5IZR5DSOXi1libYqWdtFOznfGcp3H14T+0oEJPeRdae1kT9bzS3q3RCrUsg/A=="
20
+ "version": "1.3.3-nightly.20260926.ceab465",
21
+ "integrity": "sha512-MY0/BWHj1t7Cg7rUTUgyWt2ah86pzmgUCsGfpAv0mD+HLmpHXQ0dEl/b84V/PBHgmRwSg7c3lREoSFNWN/iLVw=="
22
22
  },
23
23
  "@ours.network/messenger-server": {
24
- "version": "1.0.31-nightly.6",
25
- "integrity": "sha512-enlos6BWfKiHdUNLRoPMzb0yfxRLWvfxH6uNaOjfAG88BK5qo74hQLwQ7CR4HbVE6OCDAGPLBe1BV7dQSRsbxw=="
24
+ "version": "1.0.31-nightly.8",
25
+ "integrity": "sha512-F0ucI09DnYCEnlB4u82T/J8cwEpkU0aRp7VXqaGj8vsmgGgDQIVISrFn86sffcgjbfZpdqCxuZEVlF7DeEDDTQ=="
26
26
  },
27
27
  "@ours.network/fleet": {
28
- "version": "1.2.0-nightly.10",
29
- "integrity": "sha512-vYCPXZUxrer1Wih5LIM0kix2mViBDkjDaem2RVV2LggHCYBTCZRx2Z0Ty6GN1N08Hj9EbhHvGPPKlOhtxkxU9Q=="
28
+ "version": "1.2.0-nightly.17",
29
+ "integrity": "sha512-gKpRXSsivncw83zGkwOh78yNuYUR5+3erjCOAYwitHrMsApYI06yxlmL+Em5mQsxdnLGlVBLtp4fgu8G7tOiHw=="
30
30
  },
31
31
  "@ours.network/mcp": {
32
- "version": "1.2.0-nightly.7",
33
- "integrity": "sha512-E9x7abO9BXt4MBSnsYh2m0A2E/xmhJHhsgoMLwoGunY6zhIiBx8SNejKPCLXLI+JXUw7nozptcTipBMpqhKqYA=="
32
+ "version": "1.2.0-nightly.9",
33
+ "integrity": "sha512-fL0KHuxzpvfSmKiNxugiJCdNRcfjuEaIVk1KbJfoB8gJAOBXZZVR8oQYHBz48XPlDhIQfJNJAC/6TwW1oN2F3A=="
34
34
  },
35
35
  "@ours.network/codex": {
36
- "version": "1.2.0-nightly.7",
37
- "integrity": "sha512-6BhRYNI/usYxxAQm3BKsQJD6QvrWOLZ3CjscAJZC35wKft3YC6ejDZ7AV5YdfDM2UcEc/LpcLej4GVkh0ZDRWA=="
36
+ "version": "1.2.0-nightly.9",
37
+ "integrity": "sha512-VFX9uRFqsON2kmczpGTpHw/r/Z1rgkK7DHWzWgzr4kW2utYvk/L5kvC4LbshS/3hGosa5C0GkGlNCqYtVRKiJQ=="
38
38
  },
39
39
  "@ours.network/claude-code": {
40
- "version": "1.2.0-nightly.7",
41
- "integrity": "sha512-3k8xcb9dd9o/p+xXWEmezo53lBNXj3toHhLxhMnqeNRv73abTFCEqQy50TjSRGZSqTr4yi2FmHEium7YuKvmqA=="
40
+ "version": "1.2.0-nightly.9",
41
+ "integrity": "sha512-lPRYbhvYwB5PocR2iK6gKm+Xk1vIjCGRaN28Lqah9hV4lxtVtrFctbNyLXX0/+nsO9cmk7eswWlBBN+SpF/khw=="
42
42
  },
43
43
  "@ours.network/daemon": {
44
- "version": "3.8.1-nightly.3",
45
- "integrity": "sha512-PHtaqjXGUphqX/18YigPa3rcfXmMcgkFLi0eCNlJWIZ16IiMSz1WiLXhmYHPIw1AD/Ng5TqQJ9jZZo28AGRdQw=="
44
+ "version": "3.8.1-nightly.6",
45
+ "integrity": "sha512-0U/bRAf/LvOrdYMUABQ0vU8gbd/4vblXuZQK/gfYoiCLEuYIlSJ91T/9VxbOs6I8CygZ2k4XW8UxLrlyzLQAMw=="
46
46
  }
47
47
  },
48
48
  "hostCli": {
49
49
  "@ours.network/sdk": {
50
- "version": "3.8.1-nightly.11",
51
- "integrity": "sha512-dGiMUFXdZLzdwo0U2ilBTanG/aSBfUwfIkicGgCV2gQ710DYcWny9yqRAPCErw0zrh4sspm0HsWEUP/Q+Y/Q9g=="
50
+ "version": "3.8.1-nightly.14",
51
+ "integrity": "sha512-YUnFJ8hYFpLPMVLVDCWVx6m0EtMOpoEOdd9mXFwkl8zdTHr1OG0YOU8+5oJY6I95nhPa+sujSnwX5WJq9+BxRg=="
52
52
  },
53
53
  "@ours.network/cli": {
54
- "version": "2.8.1-nightly.9",
55
- "integrity": "sha512-vC6E2Tjgje2yJrw5WdSDEH/rt8YWphk1jLjao0Ie2gz+1oyNiAd9Q8VfFZGDSFa7p5xlVRTZzmOgybJuKbabew=="
54
+ "version": "2.8.1-nightly.12",
55
+ "integrity": "sha512-ZeUImuHbdFNRSfYUETfBv+gTevOJ1+Sn+QY0JjpO0cXJpGC7hVnQ0tYmZRM6qxT8QXq3+Z/NUwfJxyyrf95BgQ=="
56
56
  }
57
57
  }
58
58
  },
59
59
  "packages": {
60
60
  "@ours.network/sdk": {
61
61
  "type": "npm",
62
- "version": "3.8.1-nightly.11"
62
+ "version": "3.8.1-nightly.14"
63
63
  },
64
64
  "@ours.network/cli": {
65
65
  "type": "npm",
66
- "version": "2.8.1-nightly.9"
66
+ "version": "2.8.1-nightly.12"
67
67
  },
68
68
  "@ours.network/tg-connector": {
69
69
  "type": "npm",
70
- "version": "1.0.1-nightly.6"
70
+ "version": "1.0.1-nightly.8"
71
71
  },
72
72
  "@ours.network/cowork": {
73
73
  "type": "npm",
74
- "version": "1.3.3-nightly.20260923.2d2ff89"
74
+ "version": "1.3.3-nightly.20260926.ceab465"
75
75
  },
76
76
  "@ours.network/messenger-server": {
77
77
  "type": "npm",
78
- "version": "1.0.31-nightly.6"
78
+ "version": "1.0.31-nightly.8"
79
79
  },
80
80
  "@ours.network/fleet": {
81
81
  "type": "npm",
82
- "version": "1.2.0-nightly.10"
82
+ "version": "1.2.0-nightly.17"
83
83
  },
84
84
  "@ours.network/mcp": {
85
85
  "type": "npm",
86
- "version": "1.2.0-nightly.7"
86
+ "version": "1.2.0-nightly.9"
87
87
  },
88
88
  "@ours.network/codex": {
89
89
  "type": "npm",
90
- "version": "1.2.0-nightly.7"
90
+ "version": "1.2.0-nightly.9"
91
91
  },
92
92
  "@ours.network/claude-code": {
93
93
  "type": "npm",
94
- "version": "1.2.0-nightly.7"
94
+ "version": "1.2.0-nightly.9"
95
95
  },
96
96
  "@ours.network/daemon": {
97
97
  "type": "npm",
98
- "version": "3.8.1-nightly.3"
98
+ "version": "3.8.1-nightly.6"
99
99
  }
100
100
  }
101
101
  }
@@ -0,0 +1,127 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { isAbsolute, resolve } from 'node:path';
3
+
4
+ export const engineName = record => record.containerEngine === undefined ? 'docker' : record.containerEngine;
5
+ const path = value => typeof value === 'string' && isAbsolute(value) && resolve(value) === value && !/[\x00-\x1f]/.test(value);
6
+ export function validateContainerEngine(record) {
7
+ const engine = engineName(record);
8
+ if (!['docker', 'podman'].includes(engine) || (record.mode !== 'docker' && (record.containerEngine !== undefined || record.containerBinding !== undefined))) throw new Error('Invalid container engine selection');
9
+ const b = record.containerBinding;
10
+ if (engine === 'docker') {
11
+ if (b !== undefined) throw new Error('Unexpected Docker backend binding');
12
+ return;
13
+ }
14
+ if (!b || b.version !== 1 || !Number.isInteger(b.uid) || b.uid <= 0 || !path(b.graphRoot) || !path(b.runRoot)
15
+ || !/^[a-f0-9]{64}$/.test(b.namespaceDigest ?? '') || !path(b.socket) || !path(b.provider) || typeof b.driver !== 'string' || !/^[a-z0-9]+$/.test(b.driver)
16
+ || Object.keys(b).some(k => !['version', 'uid', 'graphRoot', 'runRoot', 'socket', 'provider', 'driver', 'namespaceDigest'].includes(k))) throw new Error('Invalid rootless Podman backend binding');
17
+ }
18
+ function podmanEnvironment(record, env, uid) {
19
+ validateContainerEngine(record);
20
+ const b = record.containerBinding;
21
+ if (uid !== b.uid) throw new Error('Podman installation belongs to another rootless owner');
22
+ for (const key of ['CONTAINER_HOST', 'CONTAINER_CONNECTION', 'CONTAINERS_STORAGE_CONF', 'CONTAINERS_CONF', 'PODMAN_USERNS', 'STORAGE_DRIVER', 'STORAGE_OPTS']) {
23
+ if (env[key]) throw new Error(`${key} conflicts with the retained local Podman backend`);
24
+ }
25
+ if ((env.OURS_PODMAN_SOCKET && env.OURS_PODMAN_SOCKET !== b.socket) || env.DOCKER_CONTEXT || (env.DOCKER_HOST && env.DOCKER_HOST !== `unix://${b.socket}`)
26
+ || (env.PODMAN_COMPOSE_PROVIDER && env.PODMAN_COMPOSE_PROVIDER !== b.provider)) throw new Error('Environment conflicts with the retained Podman backend/provider');
27
+ return { DOCKER_CONTEXT: undefined, DOCKER_HOST: `unix://${b.socket}`, PODMAN_COMPOSE_PROVIDER: b.provider, PODMAN_COMPOSE_WARNING_LOGS: 'false' };
28
+ }
29
+ /** The only container command boundary. Legacy records keep their Docker path. */
30
+ export async function runContainer(effects, record, args, options = {}) {
31
+ if (engineName(record) === 'docker') return effects.run('docker', args, options);
32
+ const env = { ...(effects.env ?? {}), ...(options.env ?? {}) };
33
+ const selected = podmanEnvironment(record, env, process.getuid?.());
34
+ const b = record.containerBinding;
35
+ if (args[0] === 'build' && !args.some(arg => arg === '--format' || arg.startsWith('--format='))) args = ['build', '--format', 'docker', ...args.slice(1)];
36
+ // Docker reports a missing object as 1; Podman inspect uses 125. Probe exact
37
+ // existence separately so transport/permission failures are never absence.
38
+ if (['image', 'volume'].includes(args[0]) && args[1] === 'inspect' && options.allowCodes?.includes(1)) {
39
+ const found = await runContainer(effects, record, [args[0], 'exists', args.at(-1)], { ...options, allowCodes: [1] });
40
+ if (found.code === 1) return { code: 1, stdout: '', ok: false };
41
+ }
42
+ // Native commands and the Compose provider must address the SAME local store.
43
+ const prefix = args[0] === 'compose' ? ['--remote', '--url', `unix://${b.socket}`] : ['--remote=false', '--root', b.graphRoot, '--runroot', b.runRoot, '--storage-driver', b.driver];
44
+ const result = await effects.run('podman', [...prefix, ...args],
45
+ { ...options, env: { ...options.env, ...selected } });
46
+ if (args[0] === 'image' && args[1] === 'inspect' && !args.includes('--format') && result.code === 0) {
47
+ const images = JSON.parse(result.stdout);
48
+ for (const value of images) if (/^[a-f0-9]{64}$/.test(value.Id)) value.Id = `sha256:${value.Id}`;
49
+ return { ...result, stdout: JSON.stringify(images) };
50
+ }
51
+ return result;
52
+ }
53
+ export function namespaceDigest(info) {
54
+ const maps = info.host?.idMappings;
55
+ const normalized = ['uidmap', 'gidmap'].map(key => {
56
+ const rows = maps?.[key];
57
+ if (!Array.isArray(rows) || !rows.length) throw new Error('Podman user namespace mappings are unavailable');
58
+ return rows.map(row => {
59
+ const values = [row.container_id, row.host_id, row.size];
60
+ if (values.some(value => !Number.isInteger(value) || value < 0) || row.size < 1) throw new Error('Invalid Podman namespace mapping');
61
+ return values;
62
+ }).sort((a, b) => a[0] - b[0]);
63
+ });
64
+ return createHash('sha256').update(JSON.stringify(normalized)).digest('hex');
65
+ }
66
+ export async function bindPodman(effects, record) {
67
+ if (effects.platform.platform !== 'linux' || process.getuid?.() === 0) throw new Error('Podman server installation requires a non-root Linux user');
68
+ const env = effects.env ?? {};
69
+ const provider = record.containerBinding?.provider ?? env.PODMAN_COMPOSE_PROVIDER;
70
+ if (!path(provider)) throw new Error('Set PODMAN_COMPOSE_PROVIDER to an absolute standalone Docker Compose executable path');
71
+ // Reject ambient redirection before even probing an unbound store.
72
+ for (const key of ['CONTAINER_HOST', 'CONTAINER_CONNECTION', 'CONTAINERS_STORAGE_CONF', 'CONTAINERS_CONF', 'PODMAN_USERNS', 'STORAGE_DRIVER', 'STORAGE_OPTS', 'DOCKER_CONTEXT']) {
73
+ if (env[key]) throw new Error(`${key} conflicts with local rootless Podman`);
74
+ }
75
+ const info = JSON.parse((await effects.run('podman', ['--remote=false', 'info', '--format', 'json'])).stdout);
76
+ if (info.host?.security?.rootless !== true) throw new Error('Podman must report rootless=true');
77
+ const socket = record.containerBinding?.socket ?? env.OURS_PODMAN_SOCKET ?? info.host.remoteSocket?.path;
78
+ const observed = { version: 1, uid: process.getuid(), graphRoot: info.store?.graphRoot, runRoot: info.store?.runRoot, driver: info.store?.graphDriverName, socket, provider, namespaceDigest: namespaceDigest(info) };
79
+ validateContainerEngine({ ...record, containerBinding: observed });
80
+ if (record.containerBinding && Object.keys(observed).some(k => observed[k] !== record.containerBinding[k])) throw new Error('Podman backend differs from retained installation');
81
+ podmanEnvironment({ ...record, containerBinding: observed }, env, process.getuid());
82
+ const api = JSON.parse((await effects.run('podman', ['--remote', '--url', `unix://${socket}`, 'info', '--format', 'json'])).stdout);
83
+ if (api.host?.security?.rootless !== true || api.store?.graphRoot !== observed.graphRoot || api.store?.runRoot !== observed.runRoot || api.store?.graphDriverName !== observed.driver || namespaceDigest(api) !== observed.namespaceDigest) throw new Error('Podman socket does not address the selected rootless storage; enable the user podman.socket');
84
+ const version = (await effects.run(provider, ['version', '--short'])).stdout.trim();
85
+ const match = /^v?(\d+)\.(\d+)\./.exec(version);
86
+ if (!match || +match[1] < 2 || (+match[1] === 2 && +match[2] < 35)) throw new Error('Standalone Docker Compose 2.35+ is required');
87
+ record.containerBinding = observed;
88
+ }
89
+
90
+ /** Resolve Compose rather than maintaining a second, drifting build definition. */
91
+ export function nativeBuildCommands(config, services, env = {}) {
92
+ const commands = [], seen = new Set();
93
+ for (const name of services) {
94
+ const service = config.services?.[name], build = service?.build;
95
+ if (!build || typeof build !== 'object' || !path(build.context) || !service.image) throw new Error(`Missing resolved build definition for ${name}`);
96
+ const supported = ['context', 'dockerfile', 'target', 'args', 'secrets', 'cache_from', 'cache_to', 'platforms', 'labels', 'no_cache', 'pull'];
97
+ if (Object.keys(build).some(k => !supported.includes(k))) throw new Error(`Unsupported Podman build option for ${name}`);
98
+ const args = ['build', '--format', 'docker', '--layers', '--file', resolve(build.context, build.dockerfile ?? 'Dockerfile'), '--tag', service.image];
99
+ if (build.target) args.push('--target', build.target);
100
+ const platforms = build.platforms ?? (service.platform ? [service.platform] : []);
101
+ if (platforms.length > 1) throw new Error('Multi-platform Podman builds are not supported');
102
+ if (platforms.length) args.push('--platform', platforms[0]);
103
+ for (const [key, value] of Object.entries(build.args ?? {})) {
104
+ if (value === null) throw new Error(`Unresolved build argument: ${key}`);
105
+ args.push('--build-arg', `${key}=${value}`);
106
+ }
107
+ for (const [key, value] of Object.entries(build.labels ?? {})) args.push('--label', `${key}=${value}`);
108
+ for (const key of ['cache_from', 'cache_to']) for (const value of build[key] ?? []) args.push('--' + key.replace('_', '-'), value);
109
+ if (build.no_cache) args.push('--no-cache');
110
+ if (build.pull) args.push('--pull=always');
111
+ for (const secret of build.secrets ?? []) {
112
+ const source = typeof secret === 'string' ? secret : secret.source;
113
+ const id = typeof secret === 'string' ? source : secret.target ?? source;
114
+ const definition = config.secrets?.[source];
115
+ if (!/^[A-Za-z0-9_-]+$/.test(id)) throw new Error('Invalid build secret ID');
116
+ if (definition?.environment) {
117
+ // Native local Podman supports type=env; values never enter argv/files.
118
+ if (env[definition.environment]) args.push('--secret', `id=${id},type=env,env=${definition.environment}`);
119
+ } else if (definition?.file && path(definition.file)) args.push('--secret', `id=${id},src=${definition.file}`);
120
+ else throw new Error(`Unsupported build secret: ${source}`);
121
+ }
122
+ args.push(build.context);
123
+ const key = JSON.stringify(args);
124
+ if (!seen.has(key)) { seen.add(key); commands.push(args); }
125
+ }
126
+ return commands;
127
+ }
@@ -1,3 +1,4 @@
1
+ import { runContainer } from './container-engine.mjs';
1
2
  import * as fs from 'node:fs';
2
3
  import { join } from 'node:path';
3
4
  import { randomUUID } from 'node:crypto';
@@ -33,7 +34,7 @@ ENTRYPOINT ["node", "/opt/ours/docker/state-operation.mjs"]
33
34
  `);
34
35
  // Build maintenance first: both targets inherit the same retained runtime.
35
36
  for (const target of ['maintenance', 'runtime']) {
36
- await effects.run('docker', ['build', '--platform', 'linux/amd64', '--target', target,
37
+ await runContainer(effects, record, ['build', '--platform', 'linux/amd64', '--target', target,
37
38
  '--tag', `${record.project}:${target}`, context]);
38
39
  }
39
40
  atomicWriteConfig(compose, fs.readFileSync(join(assets, 'docker-compose.yaml')));
@@ -82,7 +83,7 @@ export async function runDockerConversion(record, selected, operation, label, ef
82
83
  const path = join(record.root, `.conversion-compose-${randomUUID()}.json`);
83
84
  try {
84
85
  fs.writeFileSync(path, JSON.stringify(definition), { mode: 0o600, flag: 'wx' });
85
- const result = await effects.run('docker', ['compose', '--file', path, '--project-name', record.project,
86
+ const result = await runContainer(effects, record, ['compose', '--file', path, '--project-name', record.project,
86
87
  'run', '--rm', '--no-deps', '-T', 'state-operation', operation, ...(label ? [label] : [])]);
87
88
  if (operation === 'cleanup') {
88
89
  const summary = JSON.parse(result.stdout);
@@ -1,3 +1,4 @@
1
+ import { runContainer } from './container-engine.mjs';
1
2
  import * as fs from 'node:fs';
2
3
  import { join, basename } from 'node:path';
3
4
  import { randomUUID } from 'node:crypto';
@@ -46,7 +47,7 @@ export async function convertDockerInstallation(record, operation, effects) {
46
47
  await effects.serverLifecycle(record, 'start', running);
47
48
  const cleanup = await effects.runDockerConversion(record, volumes, 'cleanup');
48
49
  if (cleanup.emptyVolumes.length) {
49
- await effects.run('docker', ['volume', 'rm', ...cleanup.emptyVolumes.map(alias => volumes.sources[alias])]);
50
+ await runContainer(effects, record, ['volume', 'rm', ...cleanup.emptyVolumes.map(alias => volumes.sources[alias])]);
50
51
  }
51
52
  try {
52
53
  const stat = fs.lstatSync(source.configPath);
@@ -1,3 +1,4 @@
1
+ import { runContainer } from './container-engine.mjs';
1
2
  /** Qualify cached images before reuse; repair only the known root-owned 0600 policy. */
2
3
  import { lstatSync, readFileSync, writeFileSync, mkdtempSync, rmSync, realpathSync, openSync, closeSync, fstatSync, fchmodSync, constants } from 'node:fs';
3
4
  import { join } from 'node:path';
@@ -66,7 +67,7 @@ export async function qualifyDockerRuntime(record, effects) {
66
67
  if (![uid, gid].every(n => Number.isInteger(n) && n > 0)) fail('non-root runtime UID/GID required');
67
68
  const tag = `${record.project}:runtime`;
68
69
  const inspect = async target => {
69
- const { stdout } = await effects.run('docker', ['image', 'inspect', target], { timeout: 60000 });
70
+ const { stdout } = await runContainer(effects, record, ['image', 'inspect', target], { timeout: 60000 });
70
71
  const [value] = JSON.parse(stdout);
71
72
  if (!imageId(value?.Id) || !Array.isArray(value.RootFS?.Layers) || value.Config?.Labels?.['network.ours.build-context'] !== '1') fail('image lacks recognized build metadata');
72
73
  return value;
@@ -74,13 +75,13 @@ export async function qualifyDockerRuntime(record, effects) {
74
75
  const probe = async (id, user) => {
75
76
  const name = `ours-runtime-probe-${randomUUID()}`;
76
77
  try {
77
- const result = await effects.run('docker', ['run', '--rm', '--name', name, '--read-only', '--network', 'none', '--cap-drop', 'ALL',
78
+ const result = await runContainer(effects, record, ['run', '--rm', '--name', name, '--read-only', '--network', 'none', '--cap-drop', 'ALL',
78
79
  '--security-opt', 'no-new-privileges:true', '--pids-limit', '64', '--memory', '256m', '--user', user, '--entrypoint', 'node', id, '-e', probeScript],
79
80
  { allowCodes: [1, 74], timeout: 60000 });
80
81
  return { code: result.code, report: result.code === 0 ? JSON.parse(result.stdout) : null };
81
82
  } catch (error) {
82
83
  // A killed Docker client can leave its own bounded probe container behind.
83
- try { await effects.run('docker', ['rm', '-f', name], { allowCodes: [1], timeout: 10000 }); } catch {}
84
+ try { await runContainer(effects, record, ['rm', '-f', name], { allowCodes: [1], timeout: 10000 }); } catch {}
84
85
  throw error;
85
86
  }
86
87
  };
@@ -101,11 +102,11 @@ export async function qualifyDockerRuntime(record, effects) {
101
102
  try {
102
103
  // Unique local alias transports the immutable ID into BuildKit. The resulting
103
104
  // layer ancestry and complete execution config are checked before publication.
104
- await effects.run('docker', ['image', 'tag', original.Id, baseTag]);
105
+ await runContainer(effects, record, ['image', 'tag', original.Id, baseTag]);
105
106
  if ((await inspect(baseTag)).Id !== original.Id) fail('repair base image changed');
106
107
  writeFileSync(join(directory, 'sources.json'), policy, { mode: 0o600, flag: 'wx' });
107
108
  writeFileSync(join(directory, 'Dockerfile'), `FROM ${baseTag}\nCOPY --chmod=644 sources.json ${policyPath}\n`, { mode: 0o600, flag: 'wx' });
108
- await effects.run('docker', ['build', '--network=none', '--pull=false', '--tag', candidateTag, directory], { stream: true, timeout: 120000 });
109
+ await runContainer(effects, record, ['build', '--network=none', '--pull=false', '--tag', candidateTag, directory], { stream: true, timeout: 120000 });
109
110
  const candidate = await inspect(candidateTag);
110
111
  if (!isDeepStrictEqual(candidate.Config, original.Config) || !isDeepStrictEqual(candidate.RootFS.Layers.slice(0, original.RootFS.Layers.length), original.RootFS.Layers)
111
112
  || candidate.RootFS.Layers.length !== original.RootFS.Layers.length + 1) fail('repair changed image execution settings or ancestry');
@@ -114,11 +115,11 @@ export async function qualifyDockerRuntime(record, effects) {
114
115
  check(verified.report, 0o644);
115
116
  if (!isDeepStrictEqual(verified.report.records, privileged.report.records)) fail('repair changed build provenance');
116
117
  if ((await inspect(tag)).Id !== original.Id) fail('selected image changed during repair; retry setup');
117
- await effects.run('docker', ['image', 'tag', candidate.Id, tag]);
118
+ await runContainer(effects, record, ['image', 'tag', candidate.Id, tag]);
118
119
  effects.out?.('Cached Docker image repaired and verified; continuing setup.');
119
120
  } finally {
120
121
  for (const temporary of [candidateTag, baseTag]) {
121
- try { await effects.run('docker', ['image', 'rm', temporary], { allowCodes: [1], timeout: 10000 }); } catch {}
122
+ try { await runContainer(effects, record, ['image', 'rm', temporary], { allowCodes: [1], timeout: 10000 }); } catch {}
122
123
  }
123
124
  rmSync(directory, { recursive: true, force: true });
124
125
  }