@sellable/install 0.1.462 → 0.1.464

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.
@@ -3,12 +3,12 @@ FROM ${HERMES_IMAGE}
3
3
 
4
4
  USER root
5
5
 
6
- ARG INSTALLER_PACKAGE=@sellable/install@0.1.462
6
+ ARG INSTALLER_PACKAGE=@sellable/install@0.1.464
7
7
  ARG MCP_PACKAGE=@sellable/mcp@0.1.760-wip.phase143.20260727100513
8
8
  ARG INSTALLER_INTEGRITY
9
9
  ARG MCP_INTEGRITY=sha512-muNXHuRnLTfsnW+MQUvK+p0VBZETDKeevr70iRliXyqE3/SLrZQJLL1laJzMo+qiUs9jMXMHdKOQfQqLiwJvtg==
10
10
 
11
- RUN test "${INSTALLER_PACKAGE}" = "@sellable/install@0.1.462" \
11
+ RUN test "${INSTALLER_PACKAGE}" = "@sellable/install@0.1.464" \
12
12
  && test "${MCP_PACKAGE}" = "@sellable/mcp@0.1.760-wip.phase143.20260727100513" \
13
13
  && test -n "${INSTALLER_INTEGRITY}" \
14
14
  && test "$(npm view "${INSTALLER_PACKAGE}" dist.integrity)" = "${INSTALLER_INTEGRITY}" \
@@ -23,9 +23,9 @@ RUN test "${INSTALLER_PACKAGE}" = "@sellable/install@0.1.462" \
23
23
  && mkdir -p /opt/sellable-agent/install-root /opt/sellable-agent/mcp-root \
24
24
  && npm install --prefix /opt/sellable-agent/install-root --omit=dev --ignore-scripts --no-audit --no-fund "${INSTALLER_PACKAGE}" \
25
25
  && npm install --prefix /opt/sellable-agent/mcp-root --omit=dev --ignore-scripts --no-audit --no-fund "${MCP_PACKAGE}" \
26
- && node --input-type=module -e "import { readFileSync } from 'node:fs'; const install = JSON.parse(readFileSync('/opt/sellable-agent/install-root/node_modules/@sellable/install/package.json')); const mcp = JSON.parse(readFileSync('/opt/sellable-agent/mcp-root/node_modules/@sellable/mcp/package.json')); if (install.name !== '@sellable/install' || install.version !== '0.1.462' || mcp.name !== '@sellable/mcp' || mcp.version !== '0.1.760-wip.phase143.20260727100513') throw new Error('package identity rejected');" \
26
+ && node --input-type=module -e "import { readFileSync } from 'node:fs'; const install = JSON.parse(readFileSync('/opt/sellable-agent/install-root/node_modules/@sellable/install/package.json')); const mcp = JSON.parse(readFileSync('/opt/sellable-agent/mcp-root/node_modules/@sellable/mcp/package.json')); if (install.name !== '@sellable/install' || install.version !== '0.1.464' || mcp.name !== '@sellable/mcp' || mcp.version !== '0.1.760-wip.phase143.20260727100513') throw new Error('package identity rejected');" \
27
27
  && node --input-type=module -e "import { buildExternalRuntimeClosure } from '/opt/sellable-agent/install-root/node_modules/@sellable/install/lib/sellable-agent/external-runtime-builder.mjs'; const built = buildExternalRuntimeClosure({ mcpPackageRoot: '/opt/sellable-agent/mcp-root/node_modules/@sellable/mcp', mcpNodeModulesRoot: '/opt/sellable-agent/mcp-root/node_modules', hermesSourceRoot: '/opt/hermes', ownerUid: 0, ownerGid: 0 }); if (!built.closureDigest) throw new Error('runtime closure rejected');" \
28
- && node --input-type=module -e "import { chmodSync, writeFileSync } from 'node:fs'; const release = { installerPackage: '@sellable/install@0.1.462', installerIntegrity: process.argv[1], mcpPackage: '@sellable/mcp@0.1.760-wip.phase143.20260727100513', mcpIntegrity: process.argv[2] }; writeFileSync('/opt/sellable-agent/release.json', JSON.stringify(release) + '\\n', { mode: 0o444 }); chmodSync('/opt/sellable-agent/release.json', 0o444);" "${INSTALLER_INTEGRITY}" "${MCP_INTEGRITY}" \
28
+ && node --input-type=module -e "import { chmodSync, writeFileSync } from 'node:fs'; const release = { installerPackage: '@sellable/install@0.1.464', installerIntegrity: process.argv[1], mcpPackage: '@sellable/mcp@0.1.760-wip.phase143.20260727100513', mcpIntegrity: process.argv[2] }; writeFileSync('/opt/sellable-agent/release.json', JSON.stringify(release) + '\\n', { mode: 0o444 }); chmodSync('/opt/sellable-agent/release.json', 0o444);" "${INSTALLER_INTEGRITY}" "${MCP_INTEGRITY}" \
29
29
  && npm cache clean --force
30
30
 
31
31
  COPY entrypoint.sh /usr/local/bin/sellable-agent-container-entrypoint
@@ -3,13 +3,13 @@
3
3
  This image is a dedicated Agent worker/runtime boundary beside an existing Hermes dashboard. It never replaces or reconfigures the dashboard container.
4
4
 
5
5
  Build from this directory after
6
- `@sellable/install@0.1.462` is
6
+ `@sellable/install@0.1.464` is
7
7
  published:
8
8
 
9
9
  ```sh
10
10
  docker build --platform linux/amd64 \
11
11
  --build-arg INSTALLER_INTEGRITY='sha512-…' \
12
- --tag sellable-agent-host:0.1.462 .
12
+ --tag sellable-agent-host:0.1.464 .
13
13
  ```
14
14
 
15
15
  Create a private `bootstrap/` directory owned by root with mode `0700`. It must contain `bootstrap.json`, `provider-auth`, and `slack-app`, each owned by root with mode `0600`. `bootstrap.json` contains only non-secret identities, hashes, package integrities, and the control-plane URL. The other two files contain the provider JSON and global Slack app token whose hashes are pinned by `bootstrap.json`.
@@ -15,6 +15,7 @@ ARG ADMIN_LOCKED_TREE_DIGEST
15
15
  ARG ADMIN_ARTIFACT_DIGEST
16
16
  ARG ADMIN_PACKAGE_LOCK_B64
17
17
  ARG ADMIN_PROFILE_CONTRACT_TEMPLATE_B64
18
+ ARG TUS_JS_CLIENT_VERSION=4.3.1
18
19
 
19
20
  RUN set -eux; \
20
21
  test -n "${ADMIN_PACKAGE_LOCK_B64}"; \
@@ -40,6 +41,14 @@ RUN set -eux; \
40
41
  --omit=dev \
41
42
  --no-audit \
42
43
  --no-fund; \
44
+ npm install \
45
+ --prefix /usr/local/lib/sellable-agent \
46
+ --omit=dev \
47
+ --ignore-scripts \
48
+ --no-audit \
49
+ --no-fund \
50
+ "tus-js-client@${TUS_JS_CLIENT_VERSION}"; \
51
+ test "$(node -p "require('/usr/local/lib/sellable-agent/node_modules/tus-js-client/package.json').version")" = "${TUS_JS_CLIENT_VERSION}"; \
43
52
  test -f /usr/local/lib/sellable-agent/admin-artifact/node_modules/@sellable/install/lib/sellable-agent/admin-runtime-reconciler.mjs; \
44
53
  test -f /usr/local/lib/sellable-agent/admin-artifact/node_modules/@sellable/admin-mcp/dist/index.js; \
45
54
  node -e 'const p=require("/usr/local/lib/sellable-agent/admin-artifact/node_modules/@sellable/admin-mcp/package.json"); if(p.main!=="dist/index.js" || p.bin?.["sellable-admin-mcp"]!=="dist/index.js") process.exit(1);'; \
@@ -60,7 +69,9 @@ COPY hermes-memory-dirty.mjs /opt/sellable/bin/hermes-memory-dirty
60
69
  COPY hermes-memory-reconcile.sh /opt/sellable/share/hermes-memory-reconcile.sh
61
70
  COPY fly-admin-image/rootfs/ /
62
71
 
63
- RUN chmod 0755 /etc \
72
+ RUN node --input-type=module -e \
73
+ 'await import("/usr/local/lib/sellable-agent/fly-runtime-identity.mjs");' \
74
+ && chmod 0755 /etc \
64
75
  && chmod 0555 \
65
76
  /usr/local/lib/sellable-agent/admin-runtime/admin-runtime.mjs \
66
77
  /usr/local/lib/sellable-agent/admin-runtime/start-admin-runtime \
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { spawn } from "node:child_process";
3
+ import { spawn, spawnSync } from "node:child_process";
4
4
  import {
5
5
  createHash,
6
6
  createPrivateKey,
@@ -11,6 +11,7 @@ import {
11
11
  import {
12
12
  chmodSync,
13
13
  closeSync,
14
+ cpSync,
14
15
  existsSync,
15
16
  lstatSync,
16
17
  mkdirSync,
@@ -37,7 +38,10 @@ import {
37
38
  stageAdminProfile,
38
39
  } from "../admin-artifact/node_modules/@sellable/admin-install/lib/hermes-admin-profile-factory.mjs";
39
40
  import { parseFlyCustomerModelCredential } from "../admin-artifact/node_modules/@sellable/install/lib/sellable-agent/fly-customer-model.mjs";
40
- import { buildNativeHermesLaunch } from "../admin-artifact/node_modules/@sellable/install/lib/sellable-agent/fly-customer-worker.mjs";
41
+ import {
42
+ buildAgentServiceEnvironment,
43
+ buildNativeHermesLaunch,
44
+ } from "../admin-artifact/node_modules/@sellable/install/lib/sellable-agent/fly-customer-worker.mjs";
41
45
  import sodium from "../admin-artifact/node_modules/libsodium-wrappers/dist/modules-esm/libsodium-wrappers.mjs";
42
46
  import {
43
47
  createFlyCustomerControlClient,
@@ -79,6 +83,51 @@ const RUNTIME_ROOT = join(DATA_ROOT, ".sellable-agent", "admin-runtime");
79
83
  const DELIVERY_ROOT = join(RUNTIME_ROOT, "delivery");
80
84
  const SECRET_ROOT = "/run/sellable-agent/admin-runtime";
81
85
  const HERMES = "/opt/hermes/.venv/bin/hermes";
86
+ const NODE = "/usr/local/bin/node";
87
+ const ADMIN_INSTALL_PACKAGE_ROOT = join(
88
+ ARTIFACT_ROOT,
89
+ "node_modules",
90
+ "@sellable",
91
+ "admin-install"
92
+ );
93
+ const ADMIN_INSTALL_ASSET_ROOT = join(ADMIN_INSTALL_PACKAGE_ROOT, "runtime");
94
+ const ADMIN_INSTALL_CLI = join(
95
+ ADMIN_INSTALL_PACKAGE_ROOT,
96
+ "bin",
97
+ "sellable-admin-install.mjs"
98
+ );
99
+ // The installer materializes these four dependencies next to the runtime tree
100
+ // in `--source package` mode; the sealed image already carries the exact
101
+ // locked copies, so the runtime reuses them instead of reaching the registry.
102
+ const ADMIN_INSTALL_DEPENDENCIES = Object.freeze([
103
+ "libsodium",
104
+ "libsodium-wrappers",
105
+ "playwright-core",
106
+ "yaml",
107
+ ]);
108
+ const ADMIN_SETTINGS_FILES = Object.freeze([
109
+ ".env",
110
+ "settings.json",
111
+ "config-state.json",
112
+ ]);
113
+ const ADMIN_HOME_BINARIES = Object.freeze([
114
+ "grain",
115
+ "grain-lightfield-sync",
116
+ "lightfield",
117
+ "notion-browser",
118
+ "notion-profile-sync",
119
+ "notion-publish",
120
+ "sellable-admin-install",
121
+ "slack-pp-cli",
122
+ "with-sellable-admin-env",
123
+ ]);
124
+ // Codex shims and the Lightfield SDK virtualenv are the installer's only
125
+ // symlink-bearing outputs. They live outside the profile home because
126
+ // mergeHermesState refuses to merge a profile that contains any symlink.
127
+ const ADMIN_CODEX_ROOT = join(RUNTIME_ROOT, "codex");
128
+ const ADMIN_LIGHTFIELD_VENV = join(RUNTIME_ROOT, "venvs", "lightfield");
129
+ const SYSTEM_PATH =
130
+ "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
82
131
  const RECEIPT_PATH =
83
132
  process.env.SELLABLE_AGENT_ADMIN_CANARY_RECEIPT_PATH ??
84
133
  "/run/sellable-agent/admin-canary/receipt.json";
@@ -151,6 +200,198 @@ function installAdminHermesMemoryHook(profileRoot) {
151
200
  );
152
201
  }
153
202
 
203
+ // The installed Admin layout is the exact shape `sellable-admin-install`
204
+ // produces for a Hermes profile: `<profileHome>/.sellable-admin` holds the
205
+ // generated CLI wrappers, the runtime tree, and the working copies of the
206
+ // delivered settings generation.
207
+ export function adminHomeLayout(profileHome) {
208
+ const adminHome = join(profileHome, ".sellable-admin");
209
+ const adminRoot = join(adminHome, "runtime", "sellable-admin");
210
+ const binRoot = join(adminHome, "bin");
211
+ return {
212
+ profileHome,
213
+ adminHome,
214
+ adminRoot,
215
+ binRoot,
216
+ configPath: join(adminHome, "settings.json"),
217
+ statePath: join(adminHome, "config-state.json"),
218
+ envPath: join(adminHome, ".env"),
219
+ lightfieldBin: join(binRoot, "lightfield"),
220
+ path: [
221
+ join(profileHome, ".local", "bin"),
222
+ binRoot,
223
+ join(profileHome, ".slack", "bin"),
224
+ join(profileHome, ".venvs", "browser-use", "bin"),
225
+ "/opt/hermes/bin",
226
+ "/opt/hermes/.venv/bin",
227
+ SYSTEM_PATH,
228
+ ].join(":"),
229
+ };
230
+ }
231
+
232
+ function adminToolEnv(layout) {
233
+ return {
234
+ PATH: layout.path,
235
+ SELLABLE_ADMIN_HOME: layout.adminHome,
236
+ SELLABLE_ADMIN_CONFIG_PATH: layout.configPath,
237
+ SELLABLE_ADMIN_STATE_PATH: layout.statePath,
238
+ SELLABLE_ADMIN_ROOT: layout.adminRoot,
239
+ SELLABLE_ADMIN_LIGHTFIELD_BIN: layout.lightfieldBin,
240
+ SELLABLE_ADMIN_LIGHTFIELD_VENV: ADMIN_LIGHTFIELD_VENV,
241
+ };
242
+ }
243
+
244
+ // The delivered generation directory stays the immutable proof subject; the
245
+ // Admin home keeps working copies exactly like an installer-managed host.
246
+ function deliverAdminSettings(settingsRoot, layout) {
247
+ const delivered = ADMIN_SETTINGS_FILES.map((name) => {
248
+ const path = join(settingsRoot, name);
249
+ if (
250
+ !existsSync(path) ||
251
+ lstatSync(path).isSymbolicLink() ||
252
+ !lstatSync(path).isFile()
253
+ ) {
254
+ throw new Error("admin_runtime_settings_generation_rejected");
255
+ }
256
+ return { name, bytes: readFileSync(path) };
257
+ });
258
+ privateDirectory(layout.adminHome);
259
+ for (const { name, bytes } of delivered) {
260
+ atomicPrivateFile(join(layout.adminHome, name), bytes);
261
+ }
262
+ }
263
+
264
+ function assertNoSymlinks(root, code) {
265
+ for (const entry of readdirSync(root, { withFileTypes: true })) {
266
+ if (entry.isSymbolicLink()) throw new Error(code);
267
+ if (entry.isDirectory()) assertNoSymlinks(join(root, entry.name), code);
268
+ }
269
+ }
270
+
271
+ // Staged so the promotion rename publishes the runtime tree atomically with
272
+ // the rest of the profile.
273
+ function stageAdminRuntimeTree(stageRoot) {
274
+ const stagedRoot = join(
275
+ stageRoot,
276
+ ".sellable-admin",
277
+ "runtime",
278
+ "sellable-admin"
279
+ );
280
+ rmSync(stagedRoot, { recursive: true, force: true });
281
+ mkdirSync(dirname(stagedRoot), { recursive: true, mode: 0o700 });
282
+ cpSync(ADMIN_INSTALL_ASSET_ROOT, stagedRoot, { recursive: true });
283
+ for (const name of ADMIN_INSTALL_DEPENDENCIES) {
284
+ const target = join(stagedRoot, "node_modules", name);
285
+ rmSync(target, { recursive: true, force: true });
286
+ mkdirSync(dirname(target), { recursive: true });
287
+ cpSync(join(ARTIFACT_ROOT, "node_modules", name), target, {
288
+ recursive: true,
289
+ });
290
+ }
291
+ assertNoSymlinks(stagedRoot, "admin_runtime_admin_tree_symlink_rejected");
292
+ return stagedRoot;
293
+ }
294
+
295
+ // The published `bin/sellable-admin-install` shim resolves the installer from
296
+ // the registry at call time, which a sealed runtime must never do. The image
297
+ // already carries the exact locked installer, so the shim executes that copy.
298
+ function writeAdminInstallShim(layout) {
299
+ mkdirSync(layout.binRoot, { recursive: true });
300
+ const path = join(layout.binRoot, "sellable-admin-install");
301
+ writeFileSync(
302
+ path,
303
+ `#!/usr/bin/env sh\nexec ${NODE} ${ADMIN_INSTALL_CLI} "$@"\n`,
304
+ { mode: 0o755 }
305
+ );
306
+ chmodSync(path, 0o755);
307
+ return path;
308
+ }
309
+
310
+ function installAdminHome({ settingsRoot, layout }) {
311
+ deliverAdminSettings(settingsRoot, layout);
312
+ if (!existsSync(join(layout.adminRoot, "scripts", "install-local-mcp.mjs"))) {
313
+ throw new Error("admin_runtime_admin_tree_missing");
314
+ }
315
+ privateDirectory(ADMIN_CODEX_ROOT);
316
+ writeAdminInstallShim(layout);
317
+ // `SELLABLE_ADMIN_CLI_WRAPPERS_ONLY` is the installer's own Hermes path: it
318
+ // writes bin/ plus install.json from local bytes and performs no network,
319
+ // registry, pip, or npm work.
320
+ const generated = spawnSync(
321
+ NODE,
322
+ [join(layout.adminRoot, "scripts", "install-local-mcp.mjs")],
323
+ {
324
+ cwd: layout.adminRoot,
325
+ env: {
326
+ ...adminToolEnv(layout),
327
+ HOME: layout.profileHome,
328
+ CODEX_HOME: ADMIN_CODEX_ROOT,
329
+ SELLABLE_ADMIN_INSTALL_HOST: "hermes",
330
+ SELLABLE_ADMIN_CLI_WRAPPERS_ONLY: "1",
331
+ SELLABLE_ADMIN_EMPLOYEE_INSTALL: "1",
332
+ SELLABLE_ADMIN_MCP_MODE: "package",
333
+ SELLABLE_ADMIN_MCP_PACKAGE_SPEC:
334
+ process.env.SELLABLE_AGENT_ADMIN_MCP_PACKAGE ?? "",
335
+ SELLABLE_ADMIN_INSTALL_PACKAGE_SPEC:
336
+ process.env.SELLABLE_AGENT_ADMIN_INSTALL_PACKAGE ?? "",
337
+ NO_COLOR: "1",
338
+ },
339
+ encoding: "utf8",
340
+ timeout: TIMEOUT_MS,
341
+ }
342
+ );
343
+ let summary;
344
+ try {
345
+ summary = JSON.parse(generated.stdout);
346
+ } catch {
347
+ throw new Error("admin_runtime_admin_home_wrappers_rejected");
348
+ }
349
+ // The installer reports a non-zero status whenever any wrapper is unready,
350
+ // and `slack-pp` resolves a pinned external binary this sealed runtime does
351
+ // not carry. Every wrapper it generates from local bytes must still be ready.
352
+ if (
353
+ generated.error ||
354
+ summary?.adminHome !== layout.adminHome ||
355
+ !Array.isArray(summary.wrappers) ||
356
+ summary.wrappers.length < 1 ||
357
+ summary.wrappers.some(
358
+ (wrapper) =>
359
+ wrapper?.kind !== "external-binary" && wrapper?.ready !== true
360
+ )
361
+ ) {
362
+ throw new Error("admin_runtime_admin_home_wrappers_rejected");
363
+ }
364
+ for (const name of ADMIN_HOME_BINARIES) {
365
+ const stat = lstatSync(join(layout.binRoot, name));
366
+ if (stat.isSymbolicLink() || !stat.isFile() || (stat.mode & 0o111) === 0) {
367
+ throw new Error("admin_runtime_admin_home_binary_rejected");
368
+ }
369
+ }
370
+ const install = JSON.parse(
371
+ readFileSync(join(layout.adminHome, "install.json"), "utf8")
372
+ );
373
+ if (
374
+ install.adminHome !== layout.adminHome ||
375
+ install.adminRoot !== layout.adminRoot
376
+ ) {
377
+ throw new Error("admin_runtime_admin_home_install_rejected");
378
+ }
379
+ for (const name of ADMIN_SETTINGS_FILES) {
380
+ const stat = lstatSync(join(layout.adminHome, name));
381
+ if (stat.isSymbolicLink() || !stat.isFile() || (stat.mode & 0o077) !== 0) {
382
+ throw new Error("admin_runtime_admin_home_settings_rejected");
383
+ }
384
+ }
385
+ return {
386
+ home: layout.adminHome,
387
+ root: layout.adminRoot,
388
+ binaries: [...ADMIN_HOME_BINARIES],
389
+ settings: [...ADMIN_SETTINGS_FILES],
390
+ marketplaceRoot: install.marketplaceRoot,
391
+ pluginCacheRoot: install.pluginCacheRoot,
392
+ };
393
+ }
394
+
154
395
  async function installedPackage(packageName) {
155
396
  const path = `${ARTIFACT_ROOT}/node_modules/${packageName}/package.json`;
156
397
  const value = JSON.parse(await readFile(path, "utf8"));
@@ -294,7 +535,13 @@ function exactSoul(claim) {
294
535
  return { bytes: soul, sha256: sha256(soul), byteLength: soul.byteLength };
295
536
  }
296
537
 
297
- function profilePackageReceipt(profileContract, alias, role) {
538
+ function profilePackageReceipt(
539
+ profileContract,
540
+ alias,
541
+ role,
542
+ layout,
543
+ agentServiceEnv = {}
544
+ ) {
298
545
  const entry = profileContract.packages[alias][role];
299
546
  const packageName = entry.name;
300
547
  const entrypoint =
@@ -305,6 +552,13 @@ function profilePackageReceipt(profileContract, alias, role) {
305
552
  ...entry,
306
553
  command: "/usr/local/bin/node",
307
554
  args: [entrypoint],
555
+ // The Admin MCP resolves its packaged gateway scripts through
556
+ // SELLABLE_ADMIN_ROOT and its CLI shell-outs through PATH, so the server
557
+ // entry carries them instead of relying on gateway inheritance.
558
+ ...(alias === "sellable-admin" ? { env: adminToolEnv(layout) } : {}),
559
+ ...(alias === "sellable" && Object.keys(agentServiceEnv).length > 0
560
+ ? { env: agentServiceEnv }
561
+ : {}),
308
562
  };
309
563
  }
310
564
 
@@ -315,6 +569,7 @@ async function materializeAdminProfile({
315
569
  productConfigPath,
316
570
  soul,
317
571
  slack = null,
572
+ agentServiceEnv = {},
318
573
  }) {
319
574
  const profileHome = profileContract.profileHome;
320
575
  const profile = basename(profileHome);
@@ -324,6 +579,10 @@ async function materializeAdminProfile({
324
579
  const stageRoot = join(PROFILES_ROOT, ".staging", profile);
325
580
  const backupRoot = join(PROFILES_ROOT, ".backup", profile);
326
581
  privateDirectory(PROFILES_ROOT);
582
+ const layout = adminHomeLayout(profileHome);
583
+ // stageAdminProfile canonicalizes these two paths before staging, so the
584
+ // Admin home working copies must exist before the factory runs.
585
+ deliverAdminSettings(settingsRoot, layout);
327
586
  const serverProofs = {};
328
587
  const stage = await stageAdminProfile({
329
588
  mode: slack ? "direct_soul_native_slack" : "direct_soul",
@@ -335,8 +594,8 @@ async function materializeAdminProfile({
335
594
  stageRoot,
336
595
  finalProfileRoot: profileHome,
337
596
  rootAuthPath,
338
- canonicalAdminConfigPath: join(settingsRoot, "settings.json"),
339
- canonicalAdminStatePath: join(settingsRoot, "config-state.json"),
597
+ canonicalAdminConfigPath: layout.configPath,
598
+ canonicalAdminStatePath: layout.statePath,
340
599
  productConfigPath,
341
600
  model: "gpt-5.6-sol",
342
601
  reasoningEffort: "high",
@@ -351,18 +610,19 @@ async function materializeAdminProfile({
351
610
  slackApp: slack.slackApp,
352
611
  }
353
612
  : {}),
354
- skillsRoot: `${ARTIFACT_ROOT}/node_modules/@sellable/admin-install/runtime/mcp/skills`,
355
- installRoot: join(
356
- profileHome,
357
- ".sellable-admin",
358
- "runtime",
359
- "sellable-admin"
360
- ),
361
- adminHome: settingsRoot,
613
+ skillsRoot: join(ADMIN_INSTALL_ASSET_ROOT, "mcp", "skills"),
614
+ installRoot: layout.adminRoot,
615
+ adminHome: layout.adminHome,
362
616
  installAdmin: async () =>
363
- profilePackageReceipt(profileContract, "sellable-admin", "mcp"),
617
+ profilePackageReceipt(profileContract, "sellable-admin", "mcp", layout),
364
618
  installProduct: async () =>
365
- profilePackageReceipt(profileContract, "sellable", "mcp"),
619
+ profilePackageReceipt(
620
+ profileContract,
621
+ "sellable",
622
+ "mcp",
623
+ layout,
624
+ agentServiceEnv
625
+ ),
366
626
  verifyMcp: async ({ kind, profileRoot, config }) => {
367
627
  const alias = kind === "admin" ? "sellable-admin" : "sellable";
368
628
  const server = config.mcp_servers[alias];
@@ -373,9 +633,8 @@ async function materializeAdminProfile({
373
633
  env: {
374
634
  HOME: profileRoot,
375
635
  HERMES_HOME: profileRoot,
376
- SELLABLE_ADMIN_HOME: settingsRoot,
377
- SELLABLE_ADMIN_CONFIG_PATH: join(settingsRoot, "settings.json"),
378
- SELLABLE_ADMIN_STATE_PATH: join(settingsRoot, "config-state.json"),
636
+ ...adminToolEnv(layout),
637
+ ...agentServiceEnv,
379
638
  SELLABLE_CONFIG_PATH: productConfigPath,
380
639
  ...(server.env ?? {}),
381
640
  },
@@ -393,12 +652,16 @@ async function materializeAdminProfile({
393
652
  });
394
653
  mergeHermesState(profileHome, stageRoot);
395
654
  installAdminHermesMemoryHook(stageRoot);
655
+ stageAdminRuntimeTree(stageRoot);
396
656
  const promotion = await promoteAdminProfileAtomically({
397
657
  profile,
398
658
  currentRoot: profileHome,
399
659
  stagedRoot: stageRoot,
400
660
  backupRoot,
401
661
  });
662
+ // The installer bakes absolute paths into every generated wrapper, so the
663
+ // bin/ tree is generated once the promoted Admin home is at its final path.
664
+ const adminHome = installAdminHome({ settingsRoot, layout });
402
665
  const memoryCron = await ensureHermesSnapshotCron({
403
666
  profileId: profile,
404
667
  profileRoot: profileHome,
@@ -411,6 +674,7 @@ async function materializeAdminProfile({
411
674
  promotion,
412
675
  profile,
413
676
  profileHome,
677
+ adminHome,
414
678
  servers: [serverProofs.sellable, serverProofs["sellable-admin"]].map(
415
679
  ({ tools: _tools, ...proof }) => proof
416
680
  ),
@@ -675,6 +939,41 @@ function clearRuntimeSecrets() {
675
939
  }
676
940
  }
677
941
 
942
+ function adminAgentServiceEnvironment(claim) {
943
+ const operation = claim?.operation;
944
+ const service = claim?.runtimeContract?.service;
945
+ const bindings = claim?.runtimeContract?.slack?.selectedBindings;
946
+ const toolInclude = service?.toolInclude;
947
+ if (
948
+ !operation ||
949
+ !service ||
950
+ !/^[A-Za-z0-9_-]{1,128}$/.test(service.principalId ?? "") ||
951
+ !Array.isArray(toolInclude) ||
952
+ toolInclude.length < 1 ||
953
+ JSON.stringify(toolInclude) !==
954
+ JSON.stringify([...new Set(toolInclude)].sort()) ||
955
+ !Array.isArray(bindings) ||
956
+ bindings.length < 1 ||
957
+ bindings.some(
958
+ (binding) =>
959
+ !binding ||
960
+ typeof binding.channelId !== "string" ||
961
+ !/^[A-Za-z0-9_-]{1,128}$/.test(binding.channelId)
962
+ )
963
+ ) {
964
+ throw new Error("admin_runtime_agent_service_environment_rejected");
965
+ }
966
+ return buildAgentServiceEnvironment({
967
+ workspaceId: operation.workspaceId,
968
+ agentId: operation.agentId,
969
+ serviceCredentialGeneration: service.credentialGeneration,
970
+ policyHash: service.policyHash,
971
+ selectedChannelIds: [
972
+ ...new Set(bindings.map((binding) => binding.channelId)),
973
+ ].sort(),
974
+ });
975
+ }
976
+
678
977
  function nativeSlackProfileInput(claim, installed) {
679
978
  const slack = claim.runtimeContract?.slack;
680
979
  const bindings = slack?.selectedBindings;
@@ -1286,19 +1585,25 @@ function desiredLifecycleForClaim(claim) {
1286
1585
  }
1287
1586
  }
1288
1587
 
1289
- async function startNativeGateway({ profile, claim, settingsRoot }) {
1588
+ async function startNativeGateway({ profile, claim }) {
1589
+ // buildNativeHermesLaunch replaces the environment instead of merging it, so
1590
+ // the Admin gateway carries its own PATH for the generated bin/ wrappers.
1591
+ // The escrowed .env is deliberately not sourced here: it carries
1592
+ // SLACK_BOT_TOKEN, which the shared native-gateway policy rejects and which
1593
+ // this runtime passes only through inherited file descriptors 8 and 9. Tool
1594
+ // credentials stay in 0600 files and are loaded per invocation by
1595
+ // bin/with-sellable-admin-env and by the generated CLI wrappers.
1290
1596
  const launch = buildNativeHermesLaunch({
1291
1597
  profileRoot: profile.profileHome,
1292
1598
  secretsRoot: SECRET_ROOT,
1293
1599
  profileId: profile.profile,
1294
1600
  env: {
1601
+ ...adminToolEnv(adminHomeLayout(profile.profileHome)),
1602
+ ...adminAgentServiceEnvironment(claim),
1295
1603
  HOME: SECRET_ROOT,
1296
1604
  HERMES_HOME: DATA_ROOT,
1297
1605
  SELLABLE_HERMES_PROFILE_ID: profile.profile,
1298
1606
  CODEX_HOME: SECRET_ROOT,
1299
- SELLABLE_ADMIN_HOME: settingsRoot,
1300
- SELLABLE_ADMIN_CONFIG_PATH: join(settingsRoot, "settings.json"),
1301
- SELLABLE_ADMIN_STATE_PATH: join(settingsRoot, "config-state.json"),
1302
1607
  NO_COLOR: "1",
1303
1608
  },
1304
1609
  });
@@ -1634,6 +1939,7 @@ export async function runAdminCanary() {
1634
1939
  profileDigest: profileContract.digest,
1635
1940
  servers: profile.servers,
1636
1941
  settings: observedSettings,
1942
+ adminHome: profile.adminHome,
1637
1943
  transition,
1638
1944
  permissions: {
1639
1945
  profileMode: (profileStat.mode & 0o777).toString(8).padStart(4, "0"),
@@ -1921,6 +2227,7 @@ async function runAdminProduction() {
1921
2227
  productConfigPath: installed.productConfigPath,
1922
2228
  soul: exactSoul(claim),
1923
2229
  slack: nativeSlackProfileInput(claim, installed),
2230
+ agentServiceEnv: adminAgentServiceEnvironment(claim),
1924
2231
  });
1925
2232
  const memorySnapshot = await flushHermesSnapshot({
1926
2233
  client,
@@ -1960,13 +2267,7 @@ async function runAdminProduction() {
1960
2267
  });
1961
2268
  operationHeartbeat.assertHealthy();
1962
2269
  const candidateLaunch =
1963
- desiredLifecycle === "ON"
1964
- ? {
1965
- profile,
1966
- claim,
1967
- settingsRoot: imported.receipt.generationRoot,
1968
- }
1969
- : null;
2270
+ desiredLifecycle === "ON" ? { profile, claim } : null;
1970
2271
  let candidateGateway = null;
1971
2272
  try {
1972
2273
  if (candidateLaunch) {
@@ -5,7 +5,7 @@ USER root
5
5
 
6
6
  ARG MCP_PACKAGE=@sellable/mcp@0.1.789-wip.phase159.20260729223403
7
7
  ARG MCP_INTEGRITY=sha512-KoheQcAQe/c8xzhF3R1ls6nQd11bcQqM3ykOUlzzNX5kykO7rO8RR2KsOvomwMv2Nn5VzvZZx6rGrle/6woKfw==
8
- ARG INSTALLER_PACKAGE=@sellable/install@0.1.462
8
+ ARG INSTALLER_PACKAGE=@sellable/install@0.1.464
9
9
  ARG TUS_JS_CLIENT_VERSION=4.3.1
10
10
  ARG HERMES_VERSION=0.19.0
11
11
  ARG MCP_TRUST_ROOT_B64
@@ -69,7 +69,7 @@ const RUNTIME_GENERATION = Number(
69
69
  const BOOT_SESSION_ID = randomUUID();
70
70
  const HERMES_VERSION = process.env.SELLABLE_AGENT_HERMES_VERSION ?? "0.19.0";
71
71
  const INSTALLER_PACKAGE =
72
- process.env.SELLABLE_AGENT_INSTALLER_PACKAGE ?? "@sellable/install@0.1.462";
72
+ process.env.SELLABLE_AGENT_INSTALLER_PACKAGE ?? "@sellable/install@0.1.464";
73
73
  const MCP_PACKAGE =
74
74
  process.env.SELLABLE_AGENT_MCP_PACKAGE ??
75
75
  "@sellable/mcp@0.1.789-wip.phase159.20260729223403";
@@ -32,6 +32,40 @@ function stableJson(value) {
32
32
  return JSON.stringify(value);
33
33
  }
34
34
 
35
+ export function buildAgentServiceEnvironment({
36
+ workspaceId,
37
+ agentId,
38
+ serviceCredentialGeneration,
39
+ policyHash,
40
+ selectedChannelIds,
41
+ }) {
42
+ const canonicalChannels = Array.isArray(selectedChannelIds)
43
+ ? [...new Set(selectedChannelIds)].sort()
44
+ : [];
45
+ if (
46
+ !SAFE_ID.test(workspaceId ?? "") ||
47
+ !SAFE_ID.test(agentId ?? "") ||
48
+ !Number.isSafeInteger(serviceCredentialGeneration) ||
49
+ serviceCredentialGeneration < 1 ||
50
+ !SHA256.test(policyHash ?? "") ||
51
+ canonicalChannels.length < 1 ||
52
+ canonicalChannels.length > 100 ||
53
+ canonicalChannels.some((channelId) => !SAFE_ID.test(channelId ?? "")) ||
54
+ JSON.stringify(selectedChannelIds) !== JSON.stringify(canonicalChannels)
55
+ ) {
56
+ throw new Error("agent_service_environment_rejected");
57
+ }
58
+ return Object.freeze({
59
+ SELLABLE_AGENT_WORKSPACE_ID: workspaceId,
60
+ SELLABLE_AGENT_ID: agentId,
61
+ SELLABLE_AGENT_CREDENTIAL_GENERATION: String(serviceCredentialGeneration),
62
+ SELLABLE_AGENT_POLICY_HASH: policyHash,
63
+ SELLABLE_AGENT_SELECTED_CHANNEL_IDS: JSON.stringify(canonicalChannels),
64
+ SELLABLE_LOCK_WORKSPACE_ID: workspaceId,
65
+ SELLABLE_REQUIRE_WORKSPACE_LOCK: "1",
66
+ });
67
+ }
68
+
35
69
  function exactKeys(value, keys) {
36
70
  return Boolean(
37
71
  value &&
@@ -38,7 +38,7 @@ import { installAgentHostServices } from "./service-installer.mjs";
38
38
  const PACKAGE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
39
39
  const VERSION = "sellable-agent-host-bootstrap/v1";
40
40
  const RECEIPT_VERSION = "sellable-agent-host-registration/v1";
41
- const INSTALLER_PACKAGE = "@sellable/install@0.1.462";
41
+ const INSTALLER_PACKAGE = "@sellable/install@0.1.464";
42
42
  const MCP_PACKAGE = "@sellable/mcp@0.1.760-wip.phase143.20260727100513";
43
43
  const HERMES_VERSION = "0.18.0";
44
44
  const SHA256 = /^[a-f0-9]{64}$/;
@@ -1540,7 +1540,7 @@ export function compileClaimToProfileDesired(activeClaim, config) {
1540
1540
  ]) ||
1541
1541
  pinned.hermesCli !== "hermes" ||
1542
1542
  pinned.hermesVersion !== "0.18.0" ||
1543
- pinned.installerPackage !== "@sellable/install@0.1.462" ||
1543
+ pinned.installerPackage !== "@sellable/install@0.1.464" ||
1544
1544
  pinned.mcpPackage !==
1545
1545
  "@sellable/mcp@0.1.760-wip.phase143.20260727100513" ||
1546
1546
  !Array.isArray(policy.toolInclude) ||
@@ -197,7 +197,7 @@ function validateDesired(desired) {
197
197
  desired.serviceCredentialGeneration < 1 ||
198
198
  desired.hermesCli !== "hermes" ||
199
199
  desired.hermesVersion !== "0.18.0" ||
200
- desired.installerPackage !== "@sellable/install@0.1.462" ||
200
+ desired.installerPackage !== "@sellable/install@0.1.464" ||
201
201
  desired.mcpPackage !==
202
202
  "@sellable/mcp@0.1.760-wip.phase143.20260727100513" ||
203
203
  !Array.isArray(desired.toolInclude) ||
@@ -25,7 +25,7 @@ import { fileURLToPath } from "node:url";
25
25
  import { deriveContainedProfileId } from "./profile-materializer.mjs";
26
26
 
27
27
  export const PROVISIONING_ACTION = "PROVISION_HERMES_PROFILE";
28
- export const PINNED_INSTALL_PACKAGE = "@sellable/install@0.1.462";
28
+ export const PINNED_INSTALL_PACKAGE = "@sellable/install@0.1.464";
29
29
  export const PINNED_MCP_PACKAGE =
30
30
  "@sellable/mcp@0.1.760-wip.phase143.20260727100513";
31
31
 
@@ -612,7 +612,7 @@ function inspectProvisionedProfile({
612
612
  !matchesReadback(manifest, request) ||
613
613
  manifest.serviceCredentialReference !== serviceCredentialReference ||
614
614
  manifest.installerPackage !== PINNED_INSTALL_PACKAGE ||
615
- manifest.installerVersion !== "0.1.462" ||
615
+ manifest.installerVersion !== "0.1.464" ||
616
616
  manifest.mcpPackage !== PINNED_MCP_PACKAGE ||
617
617
  manifest.credentialKeyVersion !== credentialKeyVersion ||
618
618
  !/^[a-f0-9]{16}$/.test(manifest.credentialFingerprint) ||
@@ -826,7 +826,7 @@ function successReceipt({
826
826
  subject: `agent-profile:${observed.profileId}`,
827
827
  cli: {
828
828
  installPackage: PINNED_INSTALL_PACKAGE,
829
- installVersion: "0.1.462",
829
+ installVersion: "0.1.464",
830
830
  mcpPackage: PINNED_MCP_PACKAGE,
831
831
  command: "hermes profile bootstrap",
832
832
  },
@@ -874,7 +874,7 @@ function failure(code, stages, extra = {}, request = null) {
874
874
  : "agent-profile:unbound",
875
875
  cli: {
876
876
  installPackage: PINNED_INSTALL_PACKAGE,
877
- installVersion: "0.1.462",
877
+ installVersion: "0.1.464",
878
878
  mcpPackage: PINNED_MCP_PACKAGE,
879
879
  command: "hermes profile bootstrap",
880
880
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellable/install",
3
- "version": "0.1.462",
3
+ "version": "0.1.464",
4
4
  "type": "module",
5
5
  "description": "One-command installer for Sellable MCP in Claude Code, Codex, and Hermes",
6
6
  "bin": {