@sellable/install 0.1.607 → 0.1.610-wip.phase187.20260811.18

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.607
7
- ARG MCP_PACKAGE=@sellable/mcp@0.1.864
6
+ ARG INSTALLER_PACKAGE=@sellable/install@0.1.610-wip.phase187.20260811.18
7
+ ARG MCP_PACKAGE=@sellable/mcp@0.1.865-wip.phase187.20260811.15
8
8
  ARG INSTALLER_INTEGRITY
9
- ARG MCP_INTEGRITY=sha512-UevVd71zQL2FgnqYaeHBkTi73iUV0Lg5BchM5JNhUbvaFxAFQ2M1n9uSS18qVuM9Km0aGZ7a0k8M9e2AVPboAw==
9
+ ARG MCP_INTEGRITY=sha512-eMgElGCRnQia1P9NUNuBoc3T/OKHbmDAGwurVljWK5ED+tifDYmXla3VWEmUrqImkthr+9zfJnApCqVBLZIpSA==
10
10
 
11
- RUN test "${INSTALLER_PACKAGE}" = "@sellable/install@0.1.607" \
12
- && test "${MCP_PACKAGE}" = "@sellable/mcp@0.1.864" \
11
+ RUN test "${INSTALLER_PACKAGE}" = "@sellable/install@0.1.610-wip.phase187.20260811.18" \
12
+ && test "${MCP_PACKAGE}" = "@sellable/mcp@0.1.865-wip.phase187.20260811.15" \
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.607" \
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.607-wip.hermes-desktop.20260811160530' || mcp.name !== '@sellable/mcp' || mcp.version !== '0.1.864') 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.608-wip.phase187.20260811.16-wip.hermes-desktop.20260811160530' || mcp.name !== '@sellable/mcp' || mcp.version !== '0.1.865-wip.phase187.20260811.15') 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.607', installerIntegrity: process.argv[1], mcpPackage: '@sellable/mcp@0.1.864', 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.610-wip.phase187.20260811.18', installerIntegrity: process.argv[1], mcpPackage: '@sellable/mcp@0.1.865-wip.phase187.20260811.15', 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.607` is
6
+ `@sellable/install@0.1.610-wip.phase187.20260811.18` 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.607-wip.hermes-desktop.20260811160530 .
12
+ --tag sellable-agent-host:0.1.608-wip.phase187.20260811.16-wip.hermes-desktop.20260811160530 .
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`.
@@ -20,6 +20,7 @@ import { createHash } from "node:crypto";
20
20
 
21
21
  const SHA256 = /^[a-f0-9]{64}$/;
22
22
  const EXACT_VERSION = /^\d+\.\d+\.\d+(?:[-.A-Za-z0-9]+)?$/;
23
+ const PACKAGE_DISPOSITIONS = new Set(["changed", "reused"]);
23
24
  const PUBLIC_ACTIONS = new Set(["INSTANTIATE", "REFRESH"]);
24
25
  const RESTORATION_ACTIONS = new Set([
25
26
  "START",
@@ -64,14 +65,13 @@ export function validateAdminRuntimeTuple(tuple) {
64
65
  }
65
66
  for (const name of ADMIN_RUNTIME_TUPLE_MEMBERS) {
66
67
  const item = tuple.packages[name];
67
- const expectedDisposition = name === "@sellable/mcp" ? "reused" : "changed";
68
68
  if (
69
69
  !item ||
70
70
  item.name !== name ||
71
71
  !EXACT_VERSION.test(item.version ?? "") ||
72
72
  typeof item.integrity !== "string" ||
73
73
  !/^sha512-[A-Za-z0-9+/]{80,}={0,2}$/.test(item.integrity) ||
74
- item.disposition !== expectedDisposition
74
+ !PACKAGE_DISPOSITIONS.has(item.disposition)
75
75
  ) {
76
76
  return {
77
77
  ok: false,
@@ -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.864";
31
+ const MCP_VERSION = "0.1.865-wip.phase187.20260811.15";
32
32
  const SAFE_COMPONENT = /^[A-Za-z0-9@._+-]+$/;
33
33
  const HERMES_EXCLUDES = new Set([".git", ".playwright", "node_modules"]);
34
34
 
@@ -67,6 +67,7 @@ import {
67
67
  HERMES_SNAPSHOT_HOOKS,
68
68
  HERMES_SNAPSHOT_HOOK_ALLOWLIST_BYTES,
69
69
  applyHermesHostedBackgroundReviewPolicy,
70
+ ensureHermesOpportunitySequencesCron,
70
71
  ensureHermesSnapshotCron,
71
72
  markHermesSnapshotDirty,
72
73
  mergeHermesState,
@@ -693,6 +694,22 @@ const ADMIN_LIVE_SKILLS_CONFIG_KEYS = Object.freeze([
693
694
  "disabled",
694
695
  "platform_disabled",
695
696
  ]);
697
+ function packagedAdminSkillDirectories() {
698
+ const skillsRoot = join(ADMIN_INSTALL_ASSET_ROOT, "mcp", "skills");
699
+ const directories = new Set(["sellable"]);
700
+ for (const entry of readdirSync(skillsRoot, { withFileTypes: true })) {
701
+ if (entry.isSymbolicLink() || !entry.isDirectory()) {
702
+ throw new Error("admin_runtime_packaged_skills_inventory_rejected");
703
+ }
704
+ directories.add(entry.name);
705
+ }
706
+ return directories;
707
+ }
708
+
709
+ // Candidate run 31458025989 proved that a fresh profile must not classify
710
+ // package-backed Admin skills as operator state: doing so made both allowed
711
+ // SOUL restage attempts compare an empty live inventory with the sealed stage.
712
+ const ADMIN_SEALED_SKILL_DIRECTORIES = packagedAdminSkillDirectories();
696
713
 
697
714
  function adminPreservedSlackToolsets(config) {
698
715
  const platformToolsets = config?.platform_toolsets;
@@ -712,17 +729,17 @@ function adminPreservedSlackToolsets(config) {
712
729
 
713
730
  function adminPreservedSkillsIdentity(profileRoot) {
714
731
  if (!existsSync(profileRoot)) return null;
715
- const entries = [];
716
732
  const skillsRoot = join(profileRoot, "skills");
717
733
  const configPath = join(profileRoot, "config.yaml");
718
734
  // Admin settings are delivered into .sellable-admin before the Hermes
719
735
  // profile is staged. That settings-only directory is not an existing live
720
736
  // profile and therefore has no skills state to preserve.
721
737
  if (!existsSync(skillsRoot) && !existsSync(configPath)) return null;
738
+ const entries = [];
722
739
  const walk = (directory, relativePath = "") => {
723
740
  for (const name of readdirSync(directory).sort()) {
724
741
  const nextRelative = relativePath ? `${relativePath}/${name}` : name;
725
- if (nextRelative === "sellable") continue;
742
+ if (ADMIN_SEALED_SKILL_DIRECTORIES.has(nextRelative)) continue;
726
743
  const path = join(directory, name);
727
744
  const stat = lstatSync(path);
728
745
  if (stat.isSymbolicLink()) {
@@ -1029,12 +1046,22 @@ async function materializeAdminProfile({
1029
1046
  hermesCli: HERMES,
1030
1047
  });
1031
1048
  if (!memoryCron.ok) throw new Error(memoryCron.code);
1049
+ const opportunitySequencesCron = await ensureHermesOpportunitySequencesCron({
1050
+ profileId: profile,
1051
+ profileRoot: profileHome,
1052
+ hermesRoot: DATA_ROOT,
1053
+ statePath: layout.statePath,
1054
+ });
1055
+ if (!opportunitySequencesCron.ok) {
1056
+ throw new Error(opportunitySequencesCron.code);
1057
+ }
1032
1058
  return {
1033
1059
  stage,
1034
1060
  promotion: promoted.promotion,
1035
1061
  profile,
1036
1062
  profileHome,
1037
1063
  adminHome,
1064
+ opportunitySequencesCron,
1038
1065
  observedSoulRawSha256: promoted.observedSoulRawSha256,
1039
1066
  servers: [serverProofs.sellable, serverProofs["sellable-admin"]].map(
1040
1067
  ({ tools: _tools, ...proof }) => proof
@@ -2488,6 +2515,7 @@ export async function runAdminCanary() {
2488
2515
  }
2489
2516
  const fixtureWorkspaceId = "phase158-canary-workspace";
2490
2517
  const fixtureAgentId = "phase158-canary-admin-agent";
2518
+ const fixtureNotificationSlackUserId = "U187CANARY";
2491
2519
  const fixtureFiles = {
2492
2520
  ".env": "PHASE158_ADMIN_CANARY=nonsecret\n",
2493
2521
  "settings.json": `${JSON.stringify({
@@ -2500,6 +2528,9 @@ export async function runAdminCanary() {
2500
2528
  })}\n`,
2501
2529
  "config-state.json": `${JSON.stringify({
2502
2530
  sellable: { workspaceIds: [], workspaceNames: {} },
2531
+ opportunitySequences: {
2532
+ notificationSlackUserId: fixtureNotificationSlackUserId,
2533
+ },
2503
2534
  })}\n`,
2504
2535
  };
2505
2536
  for (const [name, value] of Object.entries(fixtureFiles)) {
@@ -4,9 +4,9 @@ FROM ${HERMES_IMAGE}
4
4
 
5
5
  USER root
6
6
 
7
- ARG MCP_PACKAGE=@sellable/mcp@0.1.864
8
- ARG MCP_INTEGRITY=sha512-UevVd71zQL2FgnqYaeHBkTi73iUV0Lg5BchM5JNhUbvaFxAFQ2M1n9uSS18qVuM9Km0aGZ7a0k8M9e2AVPboAw==
9
- ARG INSTALLER_PACKAGE=@sellable/install@0.1.607
7
+ ARG MCP_PACKAGE=@sellable/mcp@0.1.865-wip.phase187.20260811.15
8
+ ARG MCP_INTEGRITY=sha512-eMgElGCRnQia1P9NUNuBoc3T/OKHbmDAGwurVljWK5ED+tifDYmXla3VWEmUrqImkthr+9zfJnApCqVBLZIpSA==
9
+ ARG INSTALLER_PACKAGE=@sellable/install@0.1.610-wip.phase187.20260811.18
10
10
  ARG ADMIN_MCP_PACKAGE=@sellable/admin-mcp@0.1.186-wip.phase158.20260802034727
11
11
  ARG ADMIN_MCP_INTEGRITY=sha512-qYNew5wd2IfgVcp1UYOG9QvpF/8Mx19YJ5HQtMKzvSfUf3evePjtaKsoXLf2C/GUJ5QlLlHJo84VWOI3V01+9A==
12
12
  ARG TUS_JS_CLIENT_VERSION=4.3.1
@@ -96,9 +96,9 @@ const RUNTIME_GENERATION = Number(
96
96
  const BOOT_SESSION_ID = randomUUID();
97
97
  const HERMES_VERSION = process.env.SELLABLE_AGENT_HERMES_VERSION ?? "0.20.0";
98
98
  const INSTALLER_PACKAGE =
99
- process.env.SELLABLE_AGENT_INSTALLER_PACKAGE ?? "@sellable/install@0.1.607";
99
+ process.env.SELLABLE_AGENT_INSTALLER_PACKAGE ?? "@sellable/install@0.1.610-wip.phase187.20260811.18";
100
100
  const MCP_PACKAGE =
101
- process.env.SELLABLE_AGENT_MCP_PACKAGE ?? "@sellable/mcp@0.1.864";
101
+ process.env.SELLABLE_AGENT_MCP_PACKAGE ?? "@sellable/mcp@0.1.865-wip.phase187.20260811.15";
102
102
 
103
103
  const sha256 = (value) => createHash("sha256").update(value).digest("hex");
104
104
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
@@ -55,9 +55,20 @@ export const HERMES_SNAPSHOT_CRON = Object.freeze({
55
55
  installedScript: "scripts/hermes-memory-reconcile.sh",
56
56
  noAgent: true,
57
57
  });
58
+ export const HERMES_OPPORTUNITY_SEQUENCES_CRON = Object.freeze({
59
+ name: "sellable-opportunity-sequences",
60
+ schedule: "every 30m",
61
+ deliver: "slack",
62
+ skills: Object.freeze(["sellable-admin-opportunity-sequences"]),
63
+ enabledToolsets: Object.freeze(["safe", "sellable", "mcp"]),
64
+ noAgent: false,
65
+ });
66
+ export const HERMES_OPPORTUNITY_SEQUENCES_JOURNAL_ROOT =
67
+ "/opt/data/.sellable-agent/admin-runtime/opportunity-sequences";
58
68
  const LEGACY_HERMES_SNAPSHOT_SCRIPT = "scripts/hermes-memory-reconcile.sh";
59
69
 
60
70
  const HERMES = "/opt/hermes/.venv/bin/hermes";
71
+ const HERMES_PYTHON = "/opt/hermes/.venv/bin/python";
61
72
  const VERSION = "0.20.0";
62
73
  const ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/;
63
74
  const SHA256 = /^[a-f0-9]{64}$/;
@@ -264,6 +275,68 @@ function cronJobs(profileRoot) {
264
275
  return jobs;
265
276
  }
266
277
 
278
+ const sameJson = (left, right) =>
279
+ JSON.stringify(left) === JSON.stringify(right);
280
+
281
+ export async function ensureHermesNamedCron({
282
+ profileRoot,
283
+ name,
284
+ isExpected,
285
+ isUpdatable = () => true,
286
+ create,
287
+ update,
288
+ codePrefix = "hermes_named_cron",
289
+ }) {
290
+ if (
291
+ !isAbsolute(profileRoot) ||
292
+ !ID.test(name ?? "") ||
293
+ typeof isExpected !== "function" ||
294
+ typeof create !== "function" ||
295
+ typeof update !== "function"
296
+ ) {
297
+ return failed(`${codePrefix}_identity_rejected`);
298
+ }
299
+ try {
300
+ const before = cronJobs(profileRoot);
301
+ const named = before.filter((job) => job?.name === name);
302
+ if (named.length > 1 || (named[0] && !isUpdatable(named[0]))) {
303
+ return failed(`${codePrefix}_inventory_rejected`);
304
+ }
305
+ if (named[0] && isExpected(named[0])) {
306
+ return {
307
+ ok: true,
308
+ status: "REUSED",
309
+ jobId: named[0].id,
310
+ job: named[0],
311
+ };
312
+ }
313
+ const siblings = before.filter((job) => job?.name !== name);
314
+ const mutation = named[0] ? await update(named[0]) : await create();
315
+ if (childFailed(mutation)) {
316
+ return failed(`${codePrefix}_${named[0] ? "update" : "create"}_failed`);
317
+ }
318
+ const after = cronJobs(profileRoot);
319
+ const readback = after.filter((job) => job?.name === name);
320
+ const afterSiblings = after.filter((job) => job?.name !== name);
321
+ if (!sameJson(afterSiblings, siblings)) {
322
+ return failed(`${codePrefix}_sibling_readback_rejected`);
323
+ }
324
+ if (readback.length !== 1 || !isExpected(readback[0])) {
325
+ return failed(
326
+ `${codePrefix}_${named[0] ? "update_readback" : "readback"}_rejected`
327
+ );
328
+ }
329
+ return {
330
+ ok: true,
331
+ status: named[0] ? "UPDATED" : "CREATED",
332
+ jobId: readback[0].id,
333
+ job: readback[0],
334
+ };
335
+ } catch {
336
+ return failed(`${codePrefix}_install_failed`);
337
+ }
338
+ }
339
+
267
340
  function isCron(job) {
268
341
  return Boolean(
269
342
  job?.id &&
@@ -547,25 +620,23 @@ export async function ensureHermesSnapshotCron({
547
620
  readFileSync(reconcileTemplatePath),
548
621
  0o700
549
622
  );
550
- const before = cronJobs(profileRoot).filter(
551
- (job) => job?.name === HERMES_SNAPSHOT_CRON.name
552
- );
553
- if (
554
- before.length > 1 ||
555
- (before[0] && !isCron(before[0]) && !isLegacyCron(before[0]))
556
- ) {
557
- return failed("hermes_snapshot_cron_inventory_rejected");
558
- }
559
- if (before[0]) {
560
- if (isLegacyCron(before[0])) {
561
- const migrated = await childRunner(runChild)(
623
+ const result = await ensureHermesNamedCron({
624
+ profileRoot,
625
+ name: HERMES_SNAPSHOT_CRON.name,
626
+ isExpected: isCron,
627
+ isUpdatable: (job) => isCron(job) || isLegacyCron(job),
628
+ codePrefix: "hermes_snapshot_cron",
629
+ create: () =>
630
+ childRunner(runChild)(
562
631
  invocation(
563
632
  [
564
633
  "--profile",
565
634
  profileId,
566
635
  "cron",
567
- "edit",
568
- before[0].id,
636
+ "create",
637
+ HERMES_SNAPSHOT_CRON.schedule,
638
+ "--name",
639
+ HERMES_SNAPSHOT_CRON.name,
569
640
  "--script",
570
641
  HERMES_SNAPSHOT_CRON.script,
571
642
  "--no-agent",
@@ -573,53 +644,216 @@ export async function ensureHermesSnapshotCron({
573
644
  hermesRoot,
574
645
  hermesCli
575
646
  )
576
- );
577
- if (childFailed(migrated)) {
578
- return failed("hermes_snapshot_cron_migrate_failed");
579
- }
580
- const afterMigration = cronJobs(profileRoot).filter(
581
- (job) => job?.name === HERMES_SNAPSHOT_CRON.name
582
- );
583
- return afterMigration.length === 1 && isCron(afterMigration[0])
584
- ? {
585
- ok: true,
586
- status: "MIGRATED",
587
- jobId: afterMigration[0].id,
647
+ ),
648
+ update: (job) =>
649
+ childRunner(runChild)(
650
+ invocation(
651
+ [
652
+ "--profile",
588
653
  profileId,
589
- }
590
- : failed("hermes_snapshot_cron_migrate_readback_rejected");
654
+ "cron",
655
+ "edit",
656
+ job.id,
657
+ "--script",
658
+ HERMES_SNAPSHOT_CRON.script,
659
+ "--no-agent",
660
+ ],
661
+ hermesRoot,
662
+ hermesCli
663
+ )
664
+ ),
665
+ });
666
+ if (!result.ok) {
667
+ if (result.code === "hermes_snapshot_cron_update_failed") {
668
+ return failed("hermes_snapshot_cron_migrate_failed");
669
+ }
670
+ if (result.code === "hermes_snapshot_cron_update_readback_rejected") {
671
+ return failed("hermes_snapshot_cron_migrate_readback_rejected");
591
672
  }
592
- return { ok: true, status: "REUSED", jobId: before[0].id, profileId };
673
+ return result;
593
674
  }
594
- const result = await childRunner(runChild)(
595
- invocation(
596
- [
597
- "--profile",
598
- profileId,
599
- "cron",
600
- "create",
601
- HERMES_SNAPSHOT_CRON.schedule,
602
- "--name",
603
- HERMES_SNAPSHOT_CRON.name,
604
- "--script",
605
- HERMES_SNAPSHOT_CRON.script,
606
- "--no-agent",
675
+ return {
676
+ ok: true,
677
+ status: result.status === "UPDATED" ? "MIGRATED" : result.status,
678
+ jobId: result.jobId,
679
+ profileId,
680
+ };
681
+ } catch {
682
+ return failed("hermes_snapshot_cron_install_failed");
683
+ }
684
+ }
685
+
686
+ const OPPORTUNITY_SEQUENCE_ASSETS = Object.freeze([
687
+ "SKILL.md",
688
+ "references/outbound-multichannel-v1.md",
689
+ "references/positive-reply-to-agreed-meeting-v1.md",
690
+ ]);
691
+ const SLACK_USER_ID = /^U[A-Z0-9]{8,20}$/;
692
+ const OPPORTUNITY_SEQUENCE_CRON_PYTHON = [
693
+ "import json,sys",
694
+ "from cron.jobs import create_job, update_job",
695
+ "value=json.loads(sys.argv[1])",
696
+ "job_id=value.pop('jobId', None)",
697
+ "enabled=value.pop('enabled')",
698
+ "result=update_job(job_id, {**value, 'enabled': enabled}) if job_id else create_job(**value)",
699
+ "print(json.dumps({'id': result.get('id') if result else None}))",
700
+ ].join("\n");
701
+
702
+ function opportunitySequenceIdentity(profileRoot) {
703
+ const root = join(
704
+ profileRoot,
705
+ "skills",
706
+ "sellable-admin",
707
+ HERMES_OPPORTUNITY_SEQUENCES_CRON.skills[0]
708
+ );
709
+ return Object.fromEntries(
710
+ OPPORTUNITY_SEQUENCE_ASSETS.map((relative) => {
711
+ const path = join(root, relative);
712
+ regularFile(path);
713
+ return [relative, sha256(readFileSync(path))];
714
+ })
715
+ );
716
+ }
717
+
718
+ function opportunitySequencePrompt({
719
+ notificationSlackUserId,
720
+ journalRoot,
721
+ hashes,
722
+ }) {
723
+ return [
724
+ "Run the installed opportunity-sequences skill for one bounded page.",
725
+ `Use the private journal at ${journalRoot}.`,
726
+ `Require these installed asset hashes: ${JSON.stringify(hashes)}.`,
727
+ `End with a compact native Slack summary addressed to <@${notificationSlackUserId}>.`,
728
+ "Never send prospect outreach; never claim exactly-once delivery; never use a direct Slack or Lightfield transport outside the installed skill and Product MCP.",
729
+ ].join(" ");
730
+ }
731
+
732
+ export async function ensureHermesOpportunitySequencesCron({
733
+ profileId,
734
+ profileRoot,
735
+ hermesRoot,
736
+ statePath,
737
+ journalRoot = HERMES_OPPORTUNITY_SEQUENCES_JOURNAL_ROOT,
738
+ hermesPython = HERMES_PYTHON,
739
+ runChild,
740
+ }) {
741
+ if (
742
+ !validProfilePath(profileId, profileRoot, hermesRoot) ||
743
+ !existsSync(profileRoot) ||
744
+ !isAbsolute(statePath) ||
745
+ !isAbsolute(journalRoot)
746
+ ) {
747
+ return failed("hermes_opportunity_sequences_cron_identity_rejected");
748
+ }
749
+ try {
750
+ const stateStat = regularFile(statePath);
751
+ if ((stateStat.mode & 0o077) !== 0) {
752
+ return failed("hermes_opportunity_sequences_cron_state_mode_rejected");
753
+ }
754
+ const state = JSON.parse(readFileSync(statePath, "utf8"));
755
+ const notificationSlackUserId =
756
+ state?.opportunitySequences?.notificationSlackUserId;
757
+ if (!SLACK_USER_ID.test(notificationSlackUserId ?? "")) {
758
+ return failed("hermes_opportunity_sequences_cron_notification_rejected");
759
+ }
760
+ mkdirSync(journalRoot, { recursive: true, mode: 0o700 });
761
+ chmodSync(journalRoot, 0o700);
762
+ const journalStat = lstatSync(journalRoot);
763
+ if (
764
+ journalStat.isSymbolicLink() ||
765
+ !journalStat.isDirectory() ||
766
+ (journalStat.mode & 0o077) !== 0
767
+ ) {
768
+ return failed("hermes_opportunity_sequences_cron_journal_rejected");
769
+ }
770
+ const hashes = opportunitySequenceIdentity(profileRoot);
771
+ const prompt = opportunitySequencePrompt({
772
+ notificationSlackUserId,
773
+ journalRoot,
774
+ hashes,
775
+ });
776
+ const expected = (job) =>
777
+ Boolean(
778
+ job?.id &&
779
+ job.name === HERMES_OPPORTUNITY_SEQUENCES_CRON.name &&
780
+ job.prompt === prompt &&
781
+ job.no_agent === false &&
782
+ job.enabled === true &&
783
+ job.deliver === HERMES_OPPORTUNITY_SEQUENCES_CRON.deliver &&
784
+ sameJson(job.skills, HERMES_OPPORTUNITY_SEQUENCES_CRON.skills) &&
785
+ sameJson(
786
+ job.enabled_toolsets,
787
+ HERMES_OPPORTUNITY_SEQUENCES_CRON.enabledToolsets
788
+ ) &&
789
+ job.schedule?.kind === "interval" &&
790
+ job.schedule?.minutes === 30
791
+ );
792
+ const mutate = (jobId = null) => {
793
+ const spec = {
794
+ prompt,
795
+ schedule: HERMES_OPPORTUNITY_SEQUENCES_CRON.schedule,
796
+ name: HERMES_OPPORTUNITY_SEQUENCES_CRON.name,
797
+ deliver: HERMES_OPPORTUNITY_SEQUENCES_CRON.deliver,
798
+ skills: [...HERMES_OPPORTUNITY_SEQUENCES_CRON.skills],
799
+ enabled_toolsets: [
800
+ ...HERMES_OPPORTUNITY_SEQUENCES_CRON.enabledToolsets,
607
801
  ],
608
- hermesRoot,
609
- hermesCli
610
- )
611
- );
612
- if (childFailed(result)) {
613
- return failed("hermes_snapshot_cron_create_failed");
802
+ no_agent: false,
803
+ enabled: true,
804
+ ...(jobId ? { jobId } : {}),
805
+ };
806
+ return childRunner(runChild)({
807
+ command: hermesPython,
808
+ args: ["-c", OPPORTUNITY_SEQUENCE_CRON_PYTHON, JSON.stringify(spec)],
809
+ env: {
810
+ ...process.env,
811
+ HOME: hermesRoot,
812
+ HERMES_HOME: profileRoot,
813
+ HERMES_PROFILE: profileId,
814
+ NO_COLOR: "1",
815
+ },
816
+ shell: false,
817
+ timeoutMs: NATIVE_COMMAND_TIMEOUT_MS,
818
+ maxOutputBytes: 64 * 1024,
819
+ });
820
+ };
821
+ const result = await ensureHermesNamedCron({
822
+ profileRoot,
823
+ name: HERMES_OPPORTUNITY_SEQUENCES_CRON.name,
824
+ isExpected: expected,
825
+ create: () => mutate(),
826
+ update: (job) => mutate(job.id),
827
+ codePrefix: "hermes_opportunity_sequences_cron",
828
+ });
829
+ if (!result.ok) return result;
830
+ const jobsMode =
831
+ lstatSync(join(profileRoot, "cron", "jobs.json")).mode & 0o777;
832
+ if ((jobsMode & 0o077) !== 0) {
833
+ return failed("hermes_opportunity_sequences_cron_jobs_mode_rejected");
614
834
  }
615
- const after = cronJobs(profileRoot).filter(
616
- (job) => job?.name === HERMES_SNAPSHOT_CRON.name
617
- );
618
- return after.length === 1 && isCron(after[0])
619
- ? { ok: true, status: "CREATED", jobId: after[0].id, profileId }
620
- : failed("hermes_snapshot_cron_readback_rejected");
835
+ return {
836
+ ok: true,
837
+ status: result.status,
838
+ jobId: result.jobId,
839
+ name: result.job.name,
840
+ prompt: result.job.prompt,
841
+ schedule: result.job.schedule,
842
+ profileId,
843
+ enabledToolsets: result.job.enabled_toolsets,
844
+ skills: result.job.skills,
845
+ assetHashes: hashes,
846
+ notificationSlackUserIdSource:
847
+ "config-state.json:opportunitySequences.notificationSlackUserId",
848
+ journalRoot,
849
+ modes: {
850
+ state: stateStat.mode & 0o777,
851
+ journal: journalStat.mode & 0o777,
852
+ jobs: jobsMode,
853
+ },
854
+ };
621
855
  } catch {
622
- return failed("hermes_snapshot_cron_install_failed");
856
+ return failed("hermes_opportunity_sequences_cron_install_failed");
623
857
  }
624
858
  }
625
859
 
@@ -38,8 +38,8 @@ 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.607";
42
- const MCP_PACKAGE = "@sellable/mcp@0.1.864";
41
+ const INSTALLER_PACKAGE = "@sellable/install@0.1.610-wip.phase187.20260811.18";
42
+ const MCP_PACKAGE = "@sellable/mcp@0.1.865-wip.phase187.20260811.15";
43
43
  const HERMES_VERSION = "0.18.0";
44
44
  const SHA256 = /^[a-f0-9]{64}$/;
45
45
  const SHA256_16 = /^[a-f0-9]{16}$/;
@@ -1546,8 +1546,8 @@ export function compileClaimToProfileDesired(activeClaim, config) {
1546
1546
  ]) ||
1547
1547
  pinned.hermesCli !== "hermes" ||
1548
1548
  pinned.hermesVersion !== "0.18.0" ||
1549
- pinned.installerPackage !== "@sellable/install@0.1.607" ||
1550
- pinned.mcpPackage !== "@sellable/mcp@0.1.864" ||
1549
+ pinned.installerPackage !== "@sellable/install@0.1.610-wip.phase187.20260811.18" ||
1550
+ pinned.mcpPackage !== "@sellable/mcp@0.1.865-wip.phase187.20260811.15" ||
1551
1551
  !Array.isArray(policy.toolInclude) ||
1552
1552
  policy.toolInclude.length === 0 ||
1553
1553
  !Number.isSafeInteger(slack.generation) ||
@@ -278,8 +278,8 @@ function validateDesired(desired) {
278
278
  desired.serviceCredentialGeneration < 1 ||
279
279
  desired.hermesCli !== "hermes" ||
280
280
  desired.hermesVersion !== "0.18.0" ||
281
- desired.installerPackage !== "@sellable/install@0.1.607" ||
282
- desired.mcpPackage !== "@sellable/mcp@0.1.864" ||
281
+ desired.installerPackage !== "@sellable/install@0.1.610-wip.phase187.20260811.18" ||
282
+ desired.mcpPackage !== "@sellable/mcp@0.1.865-wip.phase187.20260811.15" ||
283
283
  !Array.isArray(desired.toolInclude) ||
284
284
  desired.toolInclude.length === 0 ||
285
285
  desired.toolInclude.some((tool) => !/^[a-z][a-z0-9_]{0,127}$/.test(tool)) ||
@@ -25,8 +25,8 @@ 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.607";
29
- export const PINNED_MCP_PACKAGE = "@sellable/mcp@0.1.864";
28
+ export const PINNED_INSTALL_PACKAGE = "@sellable/install@0.1.610-wip.phase187.20260811.18";
29
+ export const PINNED_MCP_PACKAGE = "@sellable/mcp@0.1.865-wip.phase187.20260811.15";
30
30
  const PINNED_INSTALL_VERSION = PINNED_INSTALL_PACKAGE.slice(
31
31
  PINNED_INSTALL_PACKAGE.lastIndexOf("@") + 1
32
32
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellable/install",
3
- "version": "0.1.607",
3
+ "version": "0.1.610-wip.phase187.20260811.18",
4
4
  "type": "module",
5
5
  "description": "One-command installer for Sellable MCP in Claude Code, Codex, and Hermes",
6
6
  "bin": {