@sellable/install 0.1.642 → 0.1.644

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.642
7
- ARG MCP_PACKAGE=@sellable/mcp@0.1.879
6
+ ARG INSTALLER_PACKAGE=@sellable/install@0.1.644
7
+ ARG MCP_PACKAGE=@sellable/mcp@0.1.880
8
8
  ARG INSTALLER_INTEGRITY
9
- ARG MCP_INTEGRITY=sha512-dmrjCHuxLqR35HYvwXBQZoNMfCpT/wIWcvkT47cbYcWjL3pvxmxJWJBHFIZetgfQWM0pCAa+zKKAWyuxtAtz+w==
9
+ ARG MCP_INTEGRITY=sha512-+Fo8aQlYduLaQMQff+ZA25LeUhWZ7I7UH5DECpND84LQ+rHSjKeKFj4Zs93bVHXwQCIy2OLbr75y4f4+CyT57w==
10
10
 
11
- RUN test "${INSTALLER_PACKAGE}" = "@sellable/install@0.1.642" \
12
- && test "${MCP_PACKAGE}" = "@sellable/mcp@0.1.879" \
11
+ RUN test "${INSTALLER_PACKAGE}" = "@sellable/install@0.1.644" \
12
+ && test "${MCP_PACKAGE}" = "@sellable/mcp@0.1.880" \
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.642" \
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.642' || mcp.name !== '@sellable/mcp' || mcp.version !== '0.1.879') 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.644' || mcp.name !== '@sellable/mcp' || mcp.version !== '0.1.880') 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.642', installerIntegrity: process.argv[1], mcpPackage: '@sellable/mcp@0.1.879', 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.644', installerIntegrity: process.argv[1], mcpPackage: '@sellable/mcp@0.1.880', 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.642` is
6
+ `@sellable/install@0.1.644` is
7
7
  published:
8
8
 
9
9
  ```sh
@@ -0,0 +1,318 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { createHash } from "node:crypto";
4
+ import {
5
+ chmodSync,
6
+ existsSync,
7
+ lstatSync,
8
+ mkdirSync,
9
+ readFileSync,
10
+ readdirSync,
11
+ writeFileSync,
12
+ } from "node:fs";
13
+ import { dirname, isAbsolute, join, posix, resolve } from "node:path";
14
+ import { fileURLToPath } from "node:url";
15
+
16
+ import { containsSoulSecretMaterial } from "./soul-artifact-validator.mjs";
17
+
18
+ const HERE = dirname(fileURLToPath(import.meta.url));
19
+ const FRAGMENTS = join(HERE, "default-profile-bundles");
20
+ const SCHEMA = "sellable-agent-default-profile-fragment/v1";
21
+ const BUNDLE_SCHEMA = "sellable-agent-default-profile-bundle/v1";
22
+ const ID = /^[a-z0-9][a-z0-9-]{0,63}$/;
23
+ const SKILL_PATH = /^skills\/sellable-defaults\/([a-z0-9][a-z0-9-]{0,63})(?:\/.*)?$/;
24
+ const CRON_PATH = /^crons\/([a-z0-9][a-z0-9-]{0,63})\.json$/;
25
+ const MAX_FILES = 64;
26
+ const MAX_FILE_BYTES = 64 * 1024;
27
+ const MAX_TOTAL_BYTES = 1024 * 1024;
28
+
29
+ function sha256(value) {
30
+ return createHash("sha256").update(value).digest("hex");
31
+ }
32
+
33
+ function canonicalJson(value) {
34
+ if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
35
+ if (value && typeof value === "object") {
36
+ return `{${Object.keys(value)
37
+ .sort()
38
+ .map((key) => `${JSON.stringify(key)}:${canonicalJson(value[key])}`)
39
+ .join(",")}}`;
40
+ }
41
+ return JSON.stringify(value);
42
+ }
43
+
44
+ function reject(code) {
45
+ throw new Error(`default_profile_bundle_${code}`);
46
+ }
47
+
48
+ function assertClosedFragmentRoot(path) {
49
+ const root = dirname(path);
50
+ const visit = (candidate, relativePath = "") => {
51
+ const entry = lstatSync(candidate);
52
+ if (entry.isSymbolicLink()) reject("symlink_rejected");
53
+ if (entry.isDirectory()) {
54
+ for (const name of readdirSync(candidate).sort()) {
55
+ visit(join(candidate, name), relativePath ? `${relativePath}/${name}` : name);
56
+ }
57
+ return;
58
+ }
59
+ if (!entry.isFile()) reject("file_type_rejected");
60
+ if (relativePath !== "manifest.fragment.json") reject("undeclared_file_rejected");
61
+ };
62
+ visit(root);
63
+ }
64
+
65
+ function readFragment(path) {
66
+ if (!isAbsolute(path) || !existsSync(path)) reject("fragment_missing");
67
+ assertClosedFragmentRoot(path);
68
+ let value;
69
+ try {
70
+ const bytes = readFileSync(path);
71
+ if (bytes.byteLength > 128 * 1024) reject("fragment_too_large");
72
+ value = JSON.parse(bytes.toString("utf8"));
73
+ } catch (error) {
74
+ if (error instanceof Error && error.message.startsWith("default_profile_bundle_")) {
75
+ throw error;
76
+ }
77
+ reject("fragment_invalid");
78
+ }
79
+ if (
80
+ !value ||
81
+ typeof value !== "object" ||
82
+ Array.isArray(value) ||
83
+ Object.keys(value).sort().join("\0") !==
84
+ [
85
+ "bundleVersion",
86
+ "files",
87
+ "fragmentId",
88
+ "kind",
89
+ "materializerReceipts",
90
+ "schemaVersion",
91
+ ]
92
+ .sort()
93
+ .join("\0") ||
94
+ value.schemaVersion !== SCHEMA ||
95
+ !ID.test(value.fragmentId ?? "") ||
96
+ !["SHARED", "CUSTOMER", "ADMIN", "FIXTURE"].includes(value.kind) ||
97
+ !Number.isSafeInteger(value.bundleVersion) ||
98
+ value.bundleVersion < 1 ||
99
+ value.bundleVersion > 2_147_483_647 ||
100
+ !Array.isArray(value.materializerReceipts) ||
101
+ !Array.isArray(value.files)
102
+ ) {
103
+ reject("fragment_invalid");
104
+ }
105
+ return value;
106
+ }
107
+
108
+ function validatePath(path) {
109
+ if (
110
+ typeof path !== "string" ||
111
+ path.length < 1 ||
112
+ path.length > 256 ||
113
+ isAbsolute(path) ||
114
+ path.includes("\\") ||
115
+ path.includes("\0") ||
116
+ posix.normalize(path) !== path ||
117
+ path.startsWith("../")
118
+ ) {
119
+ reject("path_rejected");
120
+ }
121
+ }
122
+
123
+ function normalizeFile(value, fragmentKind) {
124
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
125
+ reject("file_invalid");
126
+ }
127
+ const allowed =
128
+ value.type === "cron"
129
+ ? ["content", "id", "mode", "name", "ownership", "path", "type"]
130
+ : ["content", "id", "mode", "ownership", "path", "type"];
131
+ if (Object.keys(value).sort().join("\0") !== allowed.sort().join("\0")) {
132
+ reject("file_invalid");
133
+ }
134
+ validatePath(value.path);
135
+ if (
136
+ !ID.test(value.id ?? "") ||
137
+ !["skill", "cron"].includes(value.type) ||
138
+ value.ownership !== "system_managed" ||
139
+ value.mode !== "0444" ||
140
+ typeof value.content !== "string"
141
+ ) {
142
+ reject("file_invalid");
143
+ }
144
+ const bytes = Buffer.from(value.content, "utf8");
145
+ if (
146
+ bytes.byteLength < 1 ||
147
+ bytes.byteLength > MAX_FILE_BYTES ||
148
+ containsSoulSecretMaterial(bytes)
149
+ ) {
150
+ reject("content_rejected");
151
+ }
152
+ if (value.type === "skill") {
153
+ const match = SKILL_PATH.exec(value.path);
154
+ if (!match || match[1] !== value.id || !value.path.endsWith("/SKILL.md")) {
155
+ reject("skill_path_rejected");
156
+ }
157
+ } else {
158
+ const match = CRON_PATH.exec(value.path);
159
+ if (
160
+ !match ||
161
+ value.name !== match[1] ||
162
+ !value.name.startsWith("sellable-default-")
163
+ ) {
164
+ reject("cron_path_rejected");
165
+ }
166
+ }
167
+ return Object.freeze({
168
+ id: value.id,
169
+ type: value.type,
170
+ ownership: value.ownership,
171
+ kind: fragmentKind,
172
+ path: value.path,
173
+ mode: value.mode,
174
+ ...(value.type === "cron" ? { name: value.name } : {}),
175
+ content: value.content,
176
+ sha256: sha256(bytes),
177
+ });
178
+ }
179
+
180
+ function writeBundle(outputRoot, result) {
181
+ mkdirSync(outputRoot, { recursive: true, mode: 0o755 });
182
+ for (const file of result.files) {
183
+ const target = join(outputRoot, ...file.path.split("/"));
184
+ mkdirSync(dirname(target), { recursive: true, mode: 0o755 });
185
+ writeFileSync(target, file.content, { mode: 0o444 });
186
+ chmodSync(target, 0o444);
187
+ }
188
+ writeFileSync(
189
+ join(outputRoot, "manifest.json"),
190
+ `${canonicalJson({ ...result.manifest, bundleDigest: result.bundleDigest })}\n`,
191
+ { mode: 0o444 }
192
+ );
193
+ chmodSync(join(outputRoot, "manifest.json"), 0o444);
194
+ }
195
+
196
+ /** Build the one canonical kind bundle. No identity-specific digest is imported. */
197
+ export function buildDefaultProfileBundle({
198
+ kind,
199
+ fragmentPaths,
200
+ adminFragmentPath,
201
+ fixtureVersion,
202
+ outputRoot,
203
+ } = {}) {
204
+ if (!["CUSTOMER", "ADMIN"].includes(kind)) reject("kind_rejected");
205
+ if (fixtureVersion !== undefined && ![1, 2].includes(fixtureVersion)) {
206
+ reject("fixture_rejected");
207
+ }
208
+ const paths = fragmentPaths
209
+ ? [...fragmentPaths]
210
+ : [
211
+ join(FRAGMENTS, "shared", "manifest.fragment.json"),
212
+ kind === "CUSTOMER"
213
+ ? join(FRAGMENTS, "customer", "manifest.fragment.json")
214
+ : resolve(adminFragmentPath ?? ""),
215
+ ...(fixtureVersion
216
+ ? [
217
+ join(
218
+ FRAGMENTS,
219
+ "fixtures",
220
+ `v${fixtureVersion}`,
221
+ "manifest.fragment.json"
222
+ ),
223
+ ]
224
+ : []),
225
+ ];
226
+ if (!Array.isArray(paths) || paths.length < 1 || paths.length > 4) {
227
+ reject("fragment_inventory_rejected");
228
+ }
229
+ const fragments = paths.map((path) => readFragment(resolve(path)));
230
+ if (
231
+ new Set(fragments.map((fragment) => fragment.fragmentId)).size !==
232
+ fragments.length
233
+ ) {
234
+ reject("fragment_collision");
235
+ }
236
+ for (const fragment of fragments) {
237
+ if (
238
+ !["SHARED", kind].includes(fragment.kind) &&
239
+ !(fixtureVersion && fragment.kind === "FIXTURE")
240
+ ) {
241
+ reject("kind_isolation_rejected");
242
+ }
243
+ }
244
+ const files = fragments
245
+ .flatMap((fragment) =>
246
+ fragment.files.map((file) => normalizeFile(file, fragment.kind))
247
+ )
248
+ .sort((left, right) => left.path.localeCompare(right.path));
249
+ if (
250
+ files.length > MAX_FILES ||
251
+ files.reduce((sum, file) => sum + Buffer.byteLength(file.content), 0) >
252
+ MAX_TOTAL_BYTES ||
253
+ new Set(files.map((file) => file.path)).size !== files.length ||
254
+ new Set(files.filter((file) => file.type === "skill").map((file) => file.id))
255
+ .size !== files.filter((file) => file.type === "skill").length ||
256
+ new Set(files.filter((file) => file.type === "cron").map((file) => file.name))
257
+ .size !== files.filter((file) => file.type === "cron").length
258
+ ) {
259
+ reject("entry_collision");
260
+ }
261
+ const materializerReceipts = [
262
+ ...new Set(fragments.flatMap((fragment) => fragment.materializerReceipts)),
263
+ ].sort();
264
+ if (
265
+ materializerReceipts.some(
266
+ (path) =>
267
+ path !== "SOUL.md" &&
268
+ path !== "skills/sellable/SKILL.md" &&
269
+ path !== "skills/sellable-admin/SKILL.md"
270
+ )
271
+ ) {
272
+ reject("materializer_receipt_rejected");
273
+ }
274
+ const bundleVersion = Math.max(
275
+ ...fragments.map((fragment) => fragment.bundleVersion)
276
+ );
277
+ const inventory = files.map(({ content: _content, ...file }) => file);
278
+ const manifest = Object.freeze({
279
+ schemaVersion: BUNDLE_SCHEMA,
280
+ kind,
281
+ bundleVersion,
282
+ materializerReceipts,
283
+ files: inventory,
284
+ });
285
+ const result = Object.freeze({
286
+ bundleVersion,
287
+ manifest,
288
+ files,
289
+ bundleDigest: sha256(canonicalJson({ manifest, files })),
290
+ });
291
+ if (outputRoot !== undefined) {
292
+ if (!isAbsolute(outputRoot)) reject("output_root_rejected");
293
+ writeBundle(outputRoot, result);
294
+ }
295
+ return result;
296
+ }
297
+
298
+ function argumentValue(flag) {
299
+ const index = process.argv.indexOf(flag);
300
+ return index >= 0 ? process.argv[index + 1] : undefined;
301
+ }
302
+
303
+ if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
304
+ const result = buildDefaultProfileBundle({
305
+ kind: argumentValue("--kind"),
306
+ adminFragmentPath: argumentValue("--admin-fragment"),
307
+ fixtureVersion: argumentValue("--fixture-version")
308
+ ? Number(argumentValue("--fixture-version"))
309
+ : undefined,
310
+ outputRoot: resolve(argumentValue("--output") ?? ""),
311
+ });
312
+ process.stdout.write(
313
+ `${JSON.stringify({
314
+ bundleVersion: result.bundleVersion,
315
+ bundleDigest: result.bundleDigest,
316
+ })}\n`
317
+ );
318
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "schemaVersion": "sellable-agent-default-profile-fragment/v1",
3
+ "fragmentId": "customer",
4
+ "kind": "CUSTOMER",
5
+ "bundleVersion": 1,
6
+ "materializerReceipts": ["skills/sellable/SKILL.md"],
7
+ "files": []
8
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "schemaVersion": "sellable-agent-default-profile-fragment/v1",
3
+ "fragmentId": "fixture-v1",
4
+ "kind": "FIXTURE",
5
+ "bundleVersion": 1,
6
+ "materializerReceipts": [],
7
+ "files": [
8
+ {
9
+ "id": "default-bundle-probe",
10
+ "type": "skill",
11
+ "ownership": "system_managed",
12
+ "path": "skills/sellable-defaults/default-bundle-probe/SKILL.md",
13
+ "mode": "0444",
14
+ "content": "---\nname: default-bundle-probe\ndescription: Harmless default bundle fixture\n---\nDefault bundle fixture V1.\n"
15
+ },
16
+ {
17
+ "id": "default-bundle-probe-cron",
18
+ "type": "cron",
19
+ "ownership": "system_managed",
20
+ "path": "crons/sellable-default-probe.json",
21
+ "name": "sellable-default-probe",
22
+ "mode": "0444",
23
+ "content": "{\"schedule\":\"*/5 * * * *\",\"script\":\"sellable-default-probe.sh\",\"noAgent\":true,\"deliver\":\"local\",\"marker\":\"default-bundle-v1\"}\n"
24
+ }
25
+ ]
26
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "schemaVersion": "sellable-agent-default-profile-fragment/v1",
3
+ "fragmentId": "fixture-v2",
4
+ "kind": "FIXTURE",
5
+ "bundleVersion": 2,
6
+ "materializerReceipts": [],
7
+ "files": [
8
+ {
9
+ "id": "default-bundle-probe",
10
+ "type": "skill",
11
+ "ownership": "system_managed",
12
+ "path": "skills/sellable-defaults/default-bundle-probe/SKILL.md",
13
+ "mode": "0444",
14
+ "content": "---\nname: default-bundle-probe\ndescription: Harmless default bundle fixture\n---\nDefault bundle fixture V2.\n"
15
+ },
16
+ {
17
+ "id": "default-bundle-added",
18
+ "type": "skill",
19
+ "ownership": "system_managed",
20
+ "path": "skills/sellable-defaults/default-bundle-added/SKILL.md",
21
+ "mode": "0444",
22
+ "content": "---\nname: default-bundle-added\ndescription: Harmless added bundle fixture\n---\nAdded in V2.\n"
23
+ },
24
+ {
25
+ "id": "default-bundle-probe-cron",
26
+ "type": "cron",
27
+ "ownership": "system_managed",
28
+ "path": "crons/sellable-default-probe.json",
29
+ "name": "sellable-default-probe",
30
+ "mode": "0444",
31
+ "content": "{\"schedule\":\"*/5 * * * *\",\"script\":\"sellable-default-probe.sh\",\"noAgent\":true,\"deliver\":\"local\",\"marker\":\"default-bundle-v2\"}\n"
32
+ }
33
+ ]
34
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "schemaVersion": "sellable-agent-default-profile-fragment/v1",
3
+ "fragmentId": "shared",
4
+ "kind": "SHARED",
5
+ "bundleVersion": 1,
6
+ "materializerReceipts": ["SOUL.md"],
7
+ "files": []
8
+ }