@sellable/install 0.1.813 → 0.1.814-wip.writers.20261006.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.
@@ -3,13 +3,13 @@ FROM ${HERMES_IMAGE}
3
3
 
4
4
  USER root
5
5
 
6
- ARG INSTALLER_PACKAGE=@sellable/install@0.1.813
7
- ARG MCP_PACKAGE=@sellable/mcp@0.1.959
6
+ ARG INSTALLER_PACKAGE=@sellable/install@0.1.814-wip.writers.20261006.1
7
+ ARG MCP_PACKAGE=@sellable/mcp@0.1.960-wip.writers.20261006.1
8
8
  ARG INSTALLER_INTEGRITY
9
- ARG MCP_INTEGRITY=sha512-sOEIaI/O41qIhxuiLSx6zWz31I5MG+oJuVqfWKnIRBhfWnbjeLbNlPKaE6U88T0jby5sa0S5Vhtn77MRKEnE5Q==
9
+ ARG MCP_INTEGRITY=sha512-g84wHCH9zmDM3MRxkD84T2Teo0smbp8JBqcfgBUqqDP0/HiHA8SM0306hLpyluXyy+xMkqoPqU7o/2wNSFq3fw==
10
10
 
11
- RUN test "${INSTALLER_PACKAGE}" = "@sellable/install@0.1.813" \
12
- && test "${MCP_PACKAGE}" = "@sellable/mcp@0.1.959" \
11
+ RUN test "${INSTALLER_PACKAGE}" = "@sellable/install@0.1.814-wip.writers.20261006.1" \
12
+ && test "${MCP_PACKAGE}" = "@sellable/mcp@0.1.960-wip.writers.20261006.1" \
13
13
  && test -n "${INSTALLER_INTEGRITY}" \
14
14
  && test "$(npm view "${INSTALLER_PACKAGE}" dist.integrity)" = "${INSTALLER_INTEGRITY}" \
15
15
  && test "$(npm view "${MCP_PACKAGE}" dist.integrity)" = "${MCP_INTEGRITY}" \
@@ -23,9 +23,9 @@ RUN test "${INSTALLER_PACKAGE}" = "@sellable/install@0.1.813" \
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.813' || mcp.name !== '@sellable/mcp' || mcp.version !== '0.1.959') 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.814-wip.writers.20261006.1' || mcp.name !== '@sellable/mcp' || mcp.version !== '0.1.960-wip.writers.20261006.1') 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.813', installerIntegrity: process.argv[1], mcpPackage: '@sellable/mcp@0.1.959', 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.814-wip.writers.20261006.1', installerIntegrity: process.argv[1], mcpPackage: '@sellable/mcp@0.1.960-wip.writers.20261006.1', 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,7 +3,7 @@
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.813` is
6
+ `@sellable/install@0.1.814-wip.writers.20261006.1` is
7
7
  published:
8
8
 
9
9
  ```sh
@@ -28,7 +28,7 @@ import {
28
28
 
29
29
  const MANIFEST_VERSION = "sellable-agent-external-runtime-closure/v1";
30
30
  const MCP_PACKAGE = "@sellable/mcp";
31
- const MCP_VERSION = "0.1.959";
31
+ const MCP_VERSION = "0.1.960-wip.writers.20261006.1";
32
32
  const SAFE_COMPONENT = /^[A-Za-z0-9@._+-]+$/;
33
33
  const HERMES_EXCLUDES = new Set([".git", ".playwright", "node_modules"]);
34
34
 
@@ -169,7 +169,7 @@ COPY fly-admin-image/start-admin-runtime /usr/local/lib/sellable-agent/admin-run
169
169
  COPY fly-customer-image/customer-runtime.mjs /usr/local/lib/sellable-agent/fly-customer-image/customer-runtime.mjs
170
170
  COPY hermes-first-welcome.mjs /usr/local/lib/sellable-agent/hermes-first-welcome.mjs
171
171
  COPY fly-customer-image/hermes-runs-client.mjs /usr/local/lib/sellable-agent/fly-customer-image/hermes-runs-client.mjs
172
- COPY fly-customer-image/endpoint-model-selection.mjs fly-customer-image/runs-api-connections.mjs fly-customer-image/claude-code-runs-api.mjs fly-customer-image/openai-runs-client.mjs fly-customer-image/runs-api-health-check.mjs fly-customer-image/public-endpoint-guard.mjs fly-customer-image/workspace-connection-client.mjs /usr/local/lib/sellable-agent/fly-customer-image/
172
+ COPY fly-customer-image/endpoint-model-selection.mjs fly-customer-image/runs-api-connections.mjs fly-customer-image/claude-code-runs-api.mjs fly-customer-image/claude-code-mcp-session.mjs fly-customer-image/openai-runs-client.mjs fly-customer-image/runs-api-health-check.mjs fly-customer-image/public-endpoint-guard.mjs fly-customer-image/workspace-connection-client.mjs /usr/local/lib/sellable-agent/fly-customer-image/
173
173
  COPY fly-customer-image/opener-stage-execution.mjs /usr/local/lib/sellable-agent/fly-customer-image/opener-stage-execution.mjs
174
174
  COPY fly-customer-image/endpoint-uat-completion-gate.mjs /usr/local/lib/sellable-agent/fly-customer-image/endpoint-uat-completion-gate.mjs
175
175
  COPY fly-customer-image/customer-runtime-phase-telemetry.mjs /usr/local/lib/sellable-agent/fly-customer-image/customer-runtime-phase-telemetry.mjs
@@ -276,6 +276,7 @@ RUN set -eux; \
276
276
  /usr/local/lib/sellable-agent/fly-customer-image/endpoint-model-selection.mjs \
277
277
  /usr/local/lib/sellable-agent/fly-customer-image/runs-api-connections.mjs \
278
278
  /usr/local/lib/sellable-agent/fly-customer-image/claude-code-runs-api.mjs \
279
+ /usr/local/lib/sellable-agent/fly-customer-image/claude-code-mcp-session.mjs \
279
280
  /usr/local/lib/sellable-agent/fly-customer-image/public-endpoint-guard.mjs \
280
281
  /usr/local/lib/sellable-agent/fly-customer-image/workspace-connection-client.mjs \
281
282
  /usr/local/lib/sellable-agent/fly-customer-image/opener-stage-execution.mjs \
@@ -61,7 +61,10 @@ import {
61
61
  SELLABLE_BROWSER_TOOLSET_DEFAULT_MARKER,
62
62
  sellableSlackToolsetsForMaterialization,
63
63
  } from "../fly-capabilities-bridge.mjs";
64
- import { startPublicClaudeRunsApi } from "../fly-customer-image/claude-code-runs-api.mjs";
64
+ import {
65
+ startConfiguredClaudeRunsApis,
66
+ startPublicClaudeRunsApi,
67
+ } from "../fly-customer-image/claude-code-runs-api.mjs";
65
68
  import { createCustomerEndpointRelay } from "../fly-customer-image/customer-runtime.mjs";
66
69
  import { createHermesSessionRetention } from "../fly-customer-image/hermes-runs-client.mjs";
67
70
  import {
@@ -906,6 +909,32 @@ function installAdminMcpRuntimeBinding(
906
909
  );
907
910
  }
908
911
 
912
+ // The profile's `sellable` MCP server exactly as Hermes runs it, so a Claude
913
+ // Code tool-lane run sees the same tools, through the same context proxy.
914
+ function profileSellableMcpServer(profileRoot) {
915
+ const path = join(profileRoot, "config.yaml");
916
+ const stat = lstatSync(path);
917
+ if (stat.isSymbolicLink() || !stat.isFile()) return null;
918
+ const document = parseDocument(readFileSync(path, "utf8"));
919
+ if (document.errors.length > 0) return null;
920
+ const server = document.toJS().mcp_servers?.sellable;
921
+ if (
922
+ server?.command !== NODE ||
923
+ JSON.stringify(server.args) !== JSON.stringify([MCP_CONTEXT_PROXY]) ||
924
+ !server.env ||
925
+ typeof server.env !== "object"
926
+ ) {
927
+ return null;
928
+ }
929
+ return {
930
+ command: NODE,
931
+ args: [MCP_CONTEXT_PROXY],
932
+ env: Object.fromEntries(
933
+ Object.entries(server.env).map(([key, value]) => [key, String(value)])
934
+ ),
935
+ };
936
+ }
937
+
909
938
  function installAdminModelConfig(profileRoot, modelConfig) {
910
939
  const path = join(profileRoot, "config.yaml");
911
940
  const stat = lstatSync(path);
@@ -3823,6 +3852,23 @@ async function runAdminProduction() {
3823
3852
  let activeLaunch = null;
3824
3853
  let activeModelHealthReporter = null;
3825
3854
  let shutdownMemorySnapshot = null;
3855
+ let customRunsServices = null;
3856
+ try {
3857
+ customRunsServices = await startConfiguredClaudeRunsApis({
3858
+ diagnostic: (value) => process.stderr.write(`${JSON.stringify(value)}\n`),
3859
+ toolLanes: {
3860
+ turnDescriptorPath: join(MCP_TURN_CONTEXT_ROOT, "turn-context.json"),
3861
+ server: () =>
3862
+ activeLaunch
3863
+ ? profileSellableMcpServer(activeLaunch.profile.profileHome)
3864
+ : null,
3865
+ },
3866
+ });
3867
+ } catch {
3868
+ process.stderr.write(
3869
+ `${JSON.stringify({ ok: false, code: "custom_runs_api_start_failed" })}\n`
3870
+ );
3871
+ }
3826
3872
  let publicRunsService = null;
3827
3873
  try {
3828
3874
  publicRunsService = await startPublicClaudeRunsApi({
@@ -4469,6 +4515,7 @@ async function runAdminProduction() {
4469
4515
  );
4470
4516
  }
4471
4517
  await endpointLoop;
4518
+ await customRunsServices?.stop();
4472
4519
  await publicRunsService?.stop();
4473
4520
  await activeModelHealthReporter?.stop();
4474
4521
  await stopNativeGateway(activeGateway);
@@ -6,9 +6,9 @@ USER root
6
6
 
7
7
  ENV PLAYWRIGHT_BROWSERS_PATH=/opt/hermes/.playwright
8
8
 
9
- ARG MCP_PACKAGE=@sellable/mcp@0.1.959
10
- ARG MCP_INTEGRITY=sha512-sOEIaI/O41qIhxuiLSx6zWz31I5MG+oJuVqfWKnIRBhfWnbjeLbNlPKaE6U88T0jby5sa0S5Vhtn77MRKEnE5Q==
11
- ARG INSTALLER_PACKAGE=@sellable/install@0.1.813
9
+ ARG MCP_PACKAGE=@sellable/mcp@0.1.960-wip.writers.20261006.1
10
+ ARG MCP_INTEGRITY=sha512-g84wHCH9zmDM3MRxkD84T2Teo0smbp8JBqcfgBUqqDP0/HiHA8SM0306hLpyluXyy+xMkqoPqU7o/2wNSFq3fw==
11
+ ARG INSTALLER_PACKAGE=@sellable/install@0.1.814-wip.writers.20261006.1
12
12
  ARG ADMIN_MCP_PACKAGE=@sellable/admin-mcp@0.1.202
13
13
  ARG ADMIN_MCP_INTEGRITY=sha512-ym3aye/0vQ8tfULJlKz9JFOxvIQsl1G+n3np+TTgK/tecwNblBo/j3AkTnRqH9iomKzPbZzP+n4tEQsvsU8ByA==
14
14
  ARG TUS_JS_CLIENT_VERSION=4.3.1
@@ -0,0 +1 @@
1
+ export function tagEndpointSession(line: string, sessionId: string): string;
@@ -0,0 +1,53 @@
1
+ // Claude Code's only MCP server for a tool-lane run. It starts the profile's
2
+ // own `sellable` server (the context proxy, with exactly its configured
3
+ // environment) and adds this run's endpoint session to every tools/list and
4
+ // tools/call. The proxy then loads the run's signed turn descriptor, lists
5
+ // only the run's allowed tools and stamps the run identity on each call; the
6
+ // backend checks it again. Nothing in this file grants anything.
7
+ import { spawn } from "node:child_process";
8
+ import { readFileSync } from "node:fs";
9
+ import { createInterface } from "node:readline";
10
+ import { fileURLToPath } from "node:url";
11
+
12
+ export function tagEndpointSession(line, sessionId) {
13
+ let message;
14
+ try {
15
+ message = JSON.parse(line);
16
+ } catch {
17
+ return line;
18
+ }
19
+ if (
20
+ !message ||
21
+ typeof message !== "object" ||
22
+ !["tools/list", "tools/call"].includes(message.method)
23
+ )
24
+ return line;
25
+ const params =
26
+ message.params && typeof message.params === "object" ? message.params : {};
27
+ // The proxy accepts exactly this shape and nothing else in _meta.
28
+ return JSON.stringify({
29
+ ...message,
30
+ params: { ...params, _meta: { sellableEndpoint: { sessionId } } },
31
+ });
32
+ }
33
+
34
+ function main(specPath) {
35
+ const spec = JSON.parse(readFileSync(specPath, "utf8"));
36
+ if (!/^sellable_endpoint_[a-f0-9]{32}$/.test(spec.sessionId ?? ""))
37
+ throw new Error("claude_runs_mcp_session_rejected");
38
+ const child = spawn(spec.command, spec.args, {
39
+ stdio: ["pipe", "inherit", "ignore"],
40
+ env: spec.env,
41
+ });
42
+ child.once("exit", (code) => process.exit(code ?? 1));
43
+ child.stdin.on("error", () => {});
44
+ const lines = createInterface({ input: process.stdin, crlfDelay: Infinity });
45
+ lines.on("line", (line) =>
46
+ child.stdin.write(`${tagEndpointSession(line, spec.sessionId)}\n`)
47
+ );
48
+ lines.on("close", () => child.stdin.end());
49
+ }
50
+
51
+ if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
52
+ main(process.argv[2]);
53
+ }
@@ -1,5 +1,6 @@
1
1
  import type { SpawnOptions } from "node:child_process";
2
2
  import type { Server } from "node:http";
3
+ import type { RunsApiConnection } from "./runs-api-connections.mjs";
3
4
 
4
5
  export const CLAUDE_RUNS_MAX_CONCURRENCY: number;
5
6
  export type ClaudeRunsRequest = {
@@ -9,15 +10,25 @@ export type ClaudeRunsRequest = {
9
10
  model: string;
10
11
  effort: string;
11
12
  sessionId: string;
12
- tools: ClaudeRunsRemoteTools | null;
13
- /** The run's private MCP config file, written by the service. */
13
+ tools: ClaudeRunsTools | ClaudeRunsRemoteTools | null;
14
+ /** Remote tools: the run's private MCP config file, written by the service. */
14
15
  mcpConfigPath?: string;
15
16
  };
16
- /** The run's own remote MCP server and grant. */
17
+ export type ClaudeRunsToolServer = {
18
+ command: string;
19
+ args: string[];
20
+ env: Record<string, string>;
21
+ };
22
+ export type ClaudeRunsTools = { names: string[]; server: ClaudeRunsToolServer };
23
+ /** The run's own remote MCP server and grant (public mode). */
17
24
  export type ClaudeRunsRemoteTools = {
18
25
  names: string[];
19
26
  remote: { url: string; authorization: string };
20
27
  };
28
+ export type ClaudeRunsToolLanes = {
29
+ turnDescriptorPath: string;
30
+ server(): ClaudeRunsToolServer | null;
31
+ };
21
32
  export type ClaudeRunsResult = {
22
33
  output: string;
23
34
  runtime: { provider: string; model: string };
@@ -26,7 +37,10 @@ export type ClaudeRunsResult = {
26
37
  export type ClaudeRunsServer = Server & { stopActiveRuns(): Promise<void> };
27
38
  export type ClaudeRunsApiOptions = {
28
39
  token: string;
29
- /** The CLI and account root; defaults to /opt/data/private-opener. */
40
+ /** Required in loopback mode; the public listener has none. */
41
+ connection?: RunsApiConnection;
42
+ mode?: "loopback" | "public";
43
+ /** The CLI and account root; defaults to the connection's localRoot. */
30
44
  root?: string;
31
45
  execute?:
32
46
  | ((request: ClaudeRunsRequest) => {
@@ -37,6 +51,7 @@ export type ClaudeRunsApiOptions = {
37
51
  audit?: (entry: Record<string, unknown>) => void;
38
52
  maxConcurrency?: number;
39
53
  maxToolConcurrency?: number;
54
+ toolLanes?: ClaudeRunsToolLanes | null;
40
55
  checkAuthentication?: (
41
56
  configDir: string
42
57
  ) => Promise<"READY" | "SIGN_IN_REQUIRED" | "UNAVAILABLE">;
@@ -47,11 +62,21 @@ export type ClaudeRunsApiOptions = {
47
62
  ) => { promise: Promise<ClaudeRunsResult>; stop(code?: string): void };
48
63
  now?: () => number;
49
64
  };
50
- /** Any claude-* model at low/medium/high effort, with optional remote tools. */
51
- export function validateClaudeRunsRequest(body: unknown): ClaudeRunsRequest;
65
+ export function validateClaudeRunsRequest(
66
+ body: unknown,
67
+ /** null: the public rule (claude-* model, low/medium/high effort). */
68
+ models: RunsApiConnection["models"] | null
69
+ ): ClaudeRunsRequest;
70
+ export function endpointToolNames(options: {
71
+ turnDescriptorPath: string;
72
+ sessionId: string;
73
+ /** Absent: every run gets the tools its own turn descriptor allows. */
74
+ toolEndpointIds?: string[];
75
+ }): string[] | null;
52
76
  export function claudeInvocation(
53
77
  request: ClaudeRunsRequest,
54
78
  root: string,
79
+ mcpSpecPath?: string | null,
55
80
  configDir?: string
56
81
  ): { command: string; args: string[]; options: SpawnOptions };
57
82
  export function claudeAccountDirs(root: string): string[];
@@ -59,16 +84,6 @@ export function claudeUsageLimit(
59
84
  stdout: string,
60
85
  now?: number
61
86
  ): { retryAt: number } | null;
62
- /** Why a CLI run failed, for the audit only: never its text. */
63
- export function claudeFailureFacts(
64
- stdout: string,
65
- exitCode: number | null
66
- ): {
67
- exitCode: number | null;
68
- apiErrorStatus: number | null;
69
- terminalReason: string | null;
70
- subtype: string | null;
71
- };
72
87
  export function parseClaudeResult(
73
88
  stdout: string,
74
89
  request: ClaudeRunsRequest
@@ -85,6 +100,14 @@ export function startClaudeRun(
85
100
  export function createClaudeRunsApi(
86
101
  options: ClaudeRunsApiOptions
87
102
  ): ClaudeRunsServer;
103
+ export function startConfiguredClaudeRunsApis(options?: {
104
+ env?: Record<string, string | undefined>;
105
+ diagnostic?: (entry: Record<string, unknown>) => void;
106
+ createApi?: typeof createClaudeRunsApi;
107
+ readToken?: (path: string) => string;
108
+ toolLanes?: ClaudeRunsToolLanes | null;
109
+ }): Promise<{ stop(): Promise<void> }>;
110
+
88
111
  export function startPublicClaudeRunsApi(options?: {
89
112
  env?: Record<string, string | undefined>;
90
113
  diagnostic?: (entry: Record<string, unknown>) => void;