@sellable/install 0.1.794 → 0.1.796
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/container/Dockerfile +4 -4
- package/container/README.md +1 -1
- package/lib/sellable-agent/fly-admin-image/Dockerfile +5 -0
- package/lib/sellable-agent/fly-admin-image/admin-runtime.mjs +43 -0
- package/lib/sellable-agent/fly-customer-image/Dockerfile +2 -1
- package/lib/sellable-agent/fly-customer-image/claude-code-mcp-session.d.mts +1 -0
- package/lib/sellable-agent/fly-customer-image/claude-code-mcp-session.mjs +53 -0
- package/lib/sellable-agent/fly-customer-image/claude-code-runs-api.d.mts +77 -0
- package/lib/sellable-agent/fly-customer-image/claude-code-runs-api.mjs +611 -0
- package/lib/sellable-agent/fly-customer-image/customer-runtime.mjs +3 -4
- package/lib/sellable-agent/fly-customer-image/endpoint-model-selection.d.mts +22 -0
- package/lib/sellable-agent/fly-customer-image/endpoint-model-selection.mjs +84 -0
- package/lib/sellable-agent/fly-customer-image/hermes-runs-client.mjs +18 -29
- package/lib/sellable-agent/fly-customer-image/runs-api-connections.d.mts +27 -0
- package/lib/sellable-agent/fly-customer-image/runs-api-connections.mjs +228 -0
- package/lib/sellable-agent/host-bootstrap.mjs +1 -1
- package/lib/sellable-agent/host-worker.mjs +1 -1
- package/lib/sellable-agent/profile-materializer.mjs +1 -1
- package/lib/sellable-agent/provisioning-adapter.mjs +1 -1
- package/package.json +1 -1
package/container/Dockerfile
CHANGED
|
@@ -3,12 +3,12 @@ FROM ${HERMES_IMAGE}
|
|
|
3
3
|
|
|
4
4
|
USER root
|
|
5
5
|
|
|
6
|
-
ARG INSTALLER_PACKAGE=@sellable/install@0.1.
|
|
6
|
+
ARG INSTALLER_PACKAGE=@sellable/install@0.1.796
|
|
7
7
|
ARG MCP_PACKAGE=@sellable/mcp@0.1.957
|
|
8
8
|
ARG INSTALLER_INTEGRITY
|
|
9
9
|
ARG MCP_INTEGRITY=sha512-tIZuO5IEanT/afamDIWdorUNMdqZA6xnjL9jGAmGqYIlIqkXdHB9slWiwfLfmM44iEp7OT98IBHJlvbpMThk6A==
|
|
10
10
|
|
|
11
|
-
RUN test "${INSTALLER_PACKAGE}" = "@sellable/install@0.1.
|
|
11
|
+
RUN test "${INSTALLER_PACKAGE}" = "@sellable/install@0.1.796" \
|
|
12
12
|
&& test "${MCP_PACKAGE}" = "@sellable/mcp@0.1.957" \
|
|
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.794" \
|
|
|
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.
|
|
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.796' || mcp.name !== '@sellable/mcp' || mcp.version !== '0.1.957') 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.
|
|
28
|
+
&& node --input-type=module -e "import { chmodSync, writeFileSync } from 'node:fs'; const release = { installerPackage: '@sellable/install@0.1.796', installerIntegrity: process.argv[1], mcpPackage: '@sellable/mcp@0.1.957', 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
|
package/container/README.md
CHANGED
|
@@ -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.
|
|
6
|
+
`@sellable/install@0.1.796` is
|
|
7
7
|
published:
|
|
8
8
|
|
|
9
9
|
```sh
|
|
@@ -169,6 +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/claude-code-mcp-session.mjs /usr/local/lib/sellable-agent/fly-customer-image/
|
|
172
173
|
COPY fly-customer-image/opener-stage-execution.mjs /usr/local/lib/sellable-agent/fly-customer-image/opener-stage-execution.mjs
|
|
173
174
|
COPY fly-customer-image/endpoint-uat-completion-gate.mjs /usr/local/lib/sellable-agent/fly-customer-image/endpoint-uat-completion-gate.mjs
|
|
174
175
|
COPY fly-customer-image/customer-runtime-phase-telemetry.mjs /usr/local/lib/sellable-agent/fly-customer-image/customer-runtime-phase-telemetry.mjs
|
|
@@ -272,6 +273,10 @@ RUN set -eux; \
|
|
|
272
273
|
/usr/local/lib/sellable-agent/fly-customer-image/customer-runtime.mjs \
|
|
273
274
|
/usr/local/lib/sellable-agent/fly-customer-image/customer-runtime-phase-telemetry.mjs \
|
|
274
275
|
/usr/local/lib/sellable-agent/fly-customer-image/hermes-runs-client.mjs \
|
|
276
|
+
/usr/local/lib/sellable-agent/fly-customer-image/endpoint-model-selection.mjs \
|
|
277
|
+
/usr/local/lib/sellable-agent/fly-customer-image/runs-api-connections.mjs \
|
|
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 \
|
|
275
280
|
/usr/local/lib/sellable-agent/fly-customer-image/opener-stage-execution.mjs \
|
|
276
281
|
/usr/local/lib/sellable-agent/fly-customer-image/endpoint-uat-completion-gate.mjs \
|
|
277
282
|
/usr/local/lib/sellable-agent/admin-native-gateway-supervisor.mjs \
|
|
@@ -63,6 +63,7 @@ import {
|
|
|
63
63
|
} from "../fly-capabilities-bridge.mjs";
|
|
64
64
|
import { createCustomerEndpointRelay } from "../fly-customer-image/customer-runtime.mjs";
|
|
65
65
|
import { createHermesSessionRetention } from "../fly-customer-image/hermes-runs-client.mjs";
|
|
66
|
+
import { startConfiguredClaudeRunsApis } from "../fly-customer-image/claude-code-runs-api.mjs";
|
|
66
67
|
import {
|
|
67
68
|
claimWithSoulObservation,
|
|
68
69
|
createFlyCustomerControlClient,
|
|
@@ -900,6 +901,32 @@ function installAdminMcpRuntimeBinding(
|
|
|
900
901
|
);
|
|
901
902
|
}
|
|
902
903
|
|
|
904
|
+
// The profile's `sellable` MCP server exactly as Hermes runs it, so a Claude
|
|
905
|
+
// Code tool-lane run sees the same tools, through the same context proxy.
|
|
906
|
+
function profileSellableMcpServer(profileRoot) {
|
|
907
|
+
const path = join(profileRoot, "config.yaml");
|
|
908
|
+
const stat = lstatSync(path);
|
|
909
|
+
if (stat.isSymbolicLink() || !stat.isFile()) return null;
|
|
910
|
+
const document = parseDocument(readFileSync(path, "utf8"));
|
|
911
|
+
if (document.errors.length > 0) return null;
|
|
912
|
+
const server = document.toJS().mcp_servers?.sellable;
|
|
913
|
+
if (
|
|
914
|
+
server?.command !== NODE ||
|
|
915
|
+
JSON.stringify(server.args) !== JSON.stringify([MCP_CONTEXT_PROXY]) ||
|
|
916
|
+
!server.env ||
|
|
917
|
+
typeof server.env !== "object"
|
|
918
|
+
) {
|
|
919
|
+
return null;
|
|
920
|
+
}
|
|
921
|
+
return {
|
|
922
|
+
command: NODE,
|
|
923
|
+
args: [MCP_CONTEXT_PROXY],
|
|
924
|
+
env: Object.fromEntries(
|
|
925
|
+
Object.entries(server.env).map(([key, value]) => [key, String(value)])
|
|
926
|
+
),
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
|
|
903
930
|
function installAdminModelConfig(profileRoot, modelConfig) {
|
|
904
931
|
const path = join(profileRoot, "config.yaml");
|
|
905
932
|
const stat = lstatSync(path);
|
|
@@ -3817,6 +3844,21 @@ async function runAdminProduction() {
|
|
|
3817
3844
|
let activeLaunch = null;
|
|
3818
3845
|
let activeModelHealthReporter = null;
|
|
3819
3846
|
let shutdownMemorySnapshot = null;
|
|
3847
|
+
let customRunsServices = null;
|
|
3848
|
+
try {
|
|
3849
|
+
customRunsServices = await startConfiguredClaudeRunsApis({
|
|
3850
|
+
diagnostic: value => process.stderr.write(`${JSON.stringify(value)}\n`),
|
|
3851
|
+
toolLanes: {
|
|
3852
|
+
turnDescriptorPath: join(MCP_TURN_CONTEXT_ROOT, "turn-context.json"),
|
|
3853
|
+
server: () =>
|
|
3854
|
+
activeLaunch
|
|
3855
|
+
? profileSellableMcpServer(activeLaunch.profile.profileHome)
|
|
3856
|
+
: null,
|
|
3857
|
+
},
|
|
3858
|
+
});
|
|
3859
|
+
} catch {
|
|
3860
|
+
process.stderr.write(`${JSON.stringify({ ok: false, code: "custom_runs_api_start_failed" })}\n`);
|
|
3861
|
+
}
|
|
3820
3862
|
const endpointRelay = createCustomerEndpointRelay({
|
|
3821
3863
|
getControlClient: () => client,
|
|
3822
3864
|
getActiveRuntime: () =>
|
|
@@ -4453,6 +4495,7 @@ async function runAdminProduction() {
|
|
|
4453
4495
|
);
|
|
4454
4496
|
}
|
|
4455
4497
|
await endpointLoop;
|
|
4498
|
+
await customRunsServices?.stop();
|
|
4456
4499
|
await activeModelHealthReporter?.stop();
|
|
4457
4500
|
await stopNativeGateway(activeGateway);
|
|
4458
4501
|
await clearRuntimeSecrets();
|
|
@@ -8,7 +8,7 @@ ENV PLAYWRIGHT_BROWSERS_PATH=/opt/hermes/.playwright
|
|
|
8
8
|
|
|
9
9
|
ARG MCP_PACKAGE=@sellable/mcp@0.1.957
|
|
10
10
|
ARG MCP_INTEGRITY=sha512-tIZuO5IEanT/afamDIWdorUNMdqZA6xnjL9jGAmGqYIlIqkXdHB9slWiwfLfmM44iEp7OT98IBHJlvbpMThk6A==
|
|
11
|
-
ARG INSTALLER_PACKAGE=@sellable/install@0.1.
|
|
11
|
+
ARG INSTALLER_PACKAGE=@sellable/install@0.1.796
|
|
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
|
|
@@ -98,6 +98,7 @@ COPY hermes-memory-reconcile.sh /opt/sellable/share/hermes-memory-reconcile.sh
|
|
|
98
98
|
COPY hermes-endpoint-cron.mjs /opt/sellable/bin/hermes-endpoint-cron
|
|
99
99
|
COPY fly-customer-image/model-auth-store.mjs /usr/local/lib/sellable-agent/fly-customer-image/model-auth-store.mjs
|
|
100
100
|
COPY fly-customer-image/hermes-runs-client.mjs /usr/local/lib/sellable-agent/fly-customer-image/hermes-runs-client.mjs
|
|
101
|
+
COPY fly-customer-image/endpoint-model-selection.mjs fly-customer-image/runs-api-connections.mjs /usr/local/lib/sellable-agent/fly-customer-image/
|
|
101
102
|
COPY fly-customer-image/opener-stage-execution.mjs /usr/local/lib/sellable-agent/fly-customer-image/opener-stage-execution.mjs
|
|
102
103
|
COPY fly-customer-image/endpoint-uat-completion-gate.mjs /usr/local/lib/sellable-agent/fly-customer-image/endpoint-uat-completion-gate.mjs
|
|
103
104
|
COPY fly-customer-image/customer-runtime-phase-telemetry.mjs /usr/local/lib/sellable-agent/fly-customer-image/customer-runtime-phase-telemetry.mjs
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { SpawnOptions } from "node:child_process";
|
|
2
|
+
import type { Server } from "node:http";
|
|
3
|
+
import type { RunsApiConnection } from "./runs-api-connections.mjs";
|
|
4
|
+
|
|
5
|
+
export type ClaudeRunsRequest = {
|
|
6
|
+
input: string;
|
|
7
|
+
instructions: string;
|
|
8
|
+
schema: Record<string, unknown> | null;
|
|
9
|
+
model: string;
|
|
10
|
+
effort: string;
|
|
11
|
+
sessionId: string;
|
|
12
|
+
tools: ClaudeRunsTools | null;
|
|
13
|
+
};
|
|
14
|
+
export type ClaudeRunsToolServer = {
|
|
15
|
+
command: string;
|
|
16
|
+
args: string[];
|
|
17
|
+
env: Record<string, string>;
|
|
18
|
+
};
|
|
19
|
+
export type ClaudeRunsTools = { names: string[]; server: ClaudeRunsToolServer };
|
|
20
|
+
export type ClaudeRunsToolLanes = {
|
|
21
|
+
turnDescriptorPath: string;
|
|
22
|
+
server(): ClaudeRunsToolServer | null;
|
|
23
|
+
};
|
|
24
|
+
export type ClaudeRunsResult = {
|
|
25
|
+
output: string;
|
|
26
|
+
runtime: { provider: string; model: string };
|
|
27
|
+
usage: Record<string, number>;
|
|
28
|
+
};
|
|
29
|
+
export type ClaudeRunsServer = Server & { stopActiveRuns(): Promise<void> };
|
|
30
|
+
export type ClaudeRunsApiOptions = {
|
|
31
|
+
token: string;
|
|
32
|
+
connection: RunsApiConnection;
|
|
33
|
+
execute?: (request: ClaudeRunsRequest) => {
|
|
34
|
+
promise: Promise<ClaudeRunsResult>;
|
|
35
|
+
stop(): void;
|
|
36
|
+
};
|
|
37
|
+
audit?: (entry: Record<string, unknown>) => void;
|
|
38
|
+
maxConcurrency?: number;
|
|
39
|
+
maxToolConcurrency?: number;
|
|
40
|
+
toolLanes?: ClaudeRunsToolLanes | null;
|
|
41
|
+
};
|
|
42
|
+
export function validateClaudeRunsRequest(
|
|
43
|
+
body: unknown,
|
|
44
|
+
models: RunsApiConnection["models"]
|
|
45
|
+
): ClaudeRunsRequest;
|
|
46
|
+
export function endpointToolNames(options: {
|
|
47
|
+
turnDescriptorPath: string;
|
|
48
|
+
sessionId: string;
|
|
49
|
+
toolEndpointIds: string[];
|
|
50
|
+
}): string[] | null;
|
|
51
|
+
export function claudeInvocation(
|
|
52
|
+
request: ClaudeRunsRequest,
|
|
53
|
+
root: string,
|
|
54
|
+
mcpSpecPath?: string | null
|
|
55
|
+
): { command: string; args: string[]; options: SpawnOptions };
|
|
56
|
+
export function parseClaudeResult(
|
|
57
|
+
stdout: string,
|
|
58
|
+
request: ClaudeRunsRequest
|
|
59
|
+
): ClaudeRunsResult;
|
|
60
|
+
export function startClaudeRun(
|
|
61
|
+
request: ClaudeRunsRequest,
|
|
62
|
+
options: {
|
|
63
|
+
root: string;
|
|
64
|
+
spawnImpl?: (...args: any[]) => any;
|
|
65
|
+
timeoutMs?: number;
|
|
66
|
+
}
|
|
67
|
+
): { promise: Promise<ClaudeRunsResult>; stop(code?: string): void };
|
|
68
|
+
export function createClaudeRunsApi(
|
|
69
|
+
options: ClaudeRunsApiOptions
|
|
70
|
+
): ClaudeRunsServer;
|
|
71
|
+
export function startConfiguredClaudeRunsApis(options?: {
|
|
72
|
+
env?: Record<string, string | undefined>;
|
|
73
|
+
diagnostic?: (entry: Record<string, unknown>) => void;
|
|
74
|
+
createApi?: typeof createClaudeRunsApi;
|
|
75
|
+
readToken?: (path: string) => string;
|
|
76
|
+
toolLanes?: ClaudeRunsToolLanes | null;
|
|
77
|
+
}): Promise<{ stop(): Promise<void> }>;
|