@sellable/install 0.1.606-wip.phase187.20260811.15 → 0.1.607
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 +7 -7
- package/container/README.md +2 -2
- package/lib/sellable-agent/admin-runtime-reconciler.mjs +2 -2
- package/lib/sellable-agent/external-runtime-builder.mjs +1 -1
- package/lib/sellable-agent/fly-admin-image/Dockerfile +16 -0
- package/lib/sellable-agent/fly-admin-image/admin-runtime.mjs +12 -40
- package/lib/sellable-agent/fly-customer-image/Dockerfile +3 -3
- package/lib/sellable-agent/fly-customer-image/customer-runtime.mjs +9 -2
- package/lib/sellable-agent/hermes-memory-snapshot.mjs +170 -290
- package/lib/sellable-agent/host-bootstrap.mjs +2 -2
- package/lib/sellable-agent/host-worker.mjs +2 -2
- package/lib/sellable-agent/profile-materializer.mjs +2 -2
- package/lib/sellable-agent/provisioning-adapter.mjs +2 -2
- package/package.json +1 -1
package/container/Dockerfile
CHANGED
|
@@ -3,13 +3,13 @@ FROM ${HERMES_IMAGE}
|
|
|
3
3
|
|
|
4
4
|
USER root
|
|
5
5
|
|
|
6
|
-
ARG INSTALLER_PACKAGE=@sellable/install@0.1.
|
|
7
|
-
ARG MCP_PACKAGE=@sellable/mcp@0.1.
|
|
6
|
+
ARG INSTALLER_PACKAGE=@sellable/install@0.1.607
|
|
7
|
+
ARG MCP_PACKAGE=@sellable/mcp@0.1.864
|
|
8
8
|
ARG INSTALLER_INTEGRITY
|
|
9
|
-
ARG MCP_INTEGRITY=sha512-
|
|
9
|
+
ARG MCP_INTEGRITY=sha512-UevVd71zQL2FgnqYaeHBkTi73iUV0Lg5BchM5JNhUbvaFxAFQ2M1n9uSS18qVuM9Km0aGZ7a0k8M9e2AVPboAw==
|
|
10
10
|
|
|
11
|
-
RUN test "${INSTALLER_PACKAGE}" = "@sellable/install@0.1.
|
|
12
|
-
&& test "${MCP_PACKAGE}" = "@sellable/mcp@0.1.
|
|
11
|
+
RUN test "${INSTALLER_PACKAGE}" = "@sellable/install@0.1.607" \
|
|
12
|
+
&& test "${MCP_PACKAGE}" = "@sellable/mcp@0.1.864" \
|
|
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.606-wip.phase187.202608
|
|
|
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.607-wip.hermes-desktop.20260811160530' || mcp.name !== '@sellable/mcp' || mcp.version !== '0.1.864') 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.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}" \
|
|
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,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.
|
|
6
|
+
`@sellable/install@0.1.607` 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.
|
|
12
|
+
--tag sellable-agent-host:0.1.607-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,7 +20,6 @@ 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"]);
|
|
24
23
|
const PUBLIC_ACTIONS = new Set(["INSTANTIATE", "REFRESH"]);
|
|
25
24
|
const RESTORATION_ACTIONS = new Set([
|
|
26
25
|
"START",
|
|
@@ -65,13 +64,14 @@ export function validateAdminRuntimeTuple(tuple) {
|
|
|
65
64
|
}
|
|
66
65
|
for (const name of ADMIN_RUNTIME_TUPLE_MEMBERS) {
|
|
67
66
|
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
|
-
|
|
74
|
+
item.disposition !== expectedDisposition
|
|
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.
|
|
31
|
+
const MCP_VERSION = "0.1.864";
|
|
32
32
|
const SAFE_COMPONENT = /^[A-Za-z0-9@._+-]+$/;
|
|
33
33
|
const HERMES_EXCLUDES = new Set([".git", ".playwright", "node_modules"]);
|
|
34
34
|
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
ARG HERMES_IMAGE=nousresearch/hermes-agent@sha256:c0cab4e3711bcb27a312be1b3776254fc06fd50d5f7a6b8017915fc7171cb39e
|
|
2
|
+
ARG SLACK_PP_GO_IMAGE=golang@sha256:386d475a660466863d9f8c766fec64d7fdad3edac2c6a05020c09534d71edb4b
|
|
3
|
+
|
|
4
|
+
FROM ${SLACK_PP_GO_IMAGE} AS slack-pp-cli-builder
|
|
5
|
+
|
|
6
|
+
ARG SLACK_PP_CLI_PACKAGE=github.com/mvanhorn/printing-press-library/library/productivity/slack/cmd/slack-pp-cli@v0.0.0-20260519210111-529e9728df37
|
|
7
|
+
ARG SLACK_PP_CLI_SHA256=2d7289d9e0d7f6ab85e2f650dfb95d1841ea6a1e97c31f74b91e9f0b71b39a8e
|
|
8
|
+
|
|
9
|
+
RUN set -eux; \
|
|
10
|
+
install -d -m 0755 /out; \
|
|
11
|
+
env GOBIN=/out CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
|
|
12
|
+
go install -trimpath "${SLACK_PP_CLI_PACKAGE}"; \
|
|
13
|
+
test "$(sha256sum /out/slack-pp-cli | cut -d ' ' -f 1)" = "${SLACK_PP_CLI_SHA256}"
|
|
14
|
+
|
|
2
15
|
FROM ${HERMES_IMAGE}
|
|
3
16
|
|
|
4
17
|
USER root
|
|
@@ -20,6 +33,8 @@ ARG TUS_JS_CLIENT_VERSION=4.3.1
|
|
|
20
33
|
ARG STRIPE_CLI_PACKAGE=@stripe/cli-linux-x64@1.45.0
|
|
21
34
|
ARG STRIPE_CLI_INTEGRITY=sha512-1ZhoPpoweYfynqsvhCLlTjZ7lPz5IKtxqAMT5MBy6zrwLRTP9x0T6r8h/jLYL8lRH1c7zC/6X6/XUu2V+r9Bog==
|
|
22
35
|
|
|
36
|
+
COPY --from=slack-pp-cli-builder --chmod=0555 /out/slack-pp-cli /usr/local/bin/slack-pp-cli
|
|
37
|
+
|
|
23
38
|
RUN set -eux; \
|
|
24
39
|
test -n "${ADMIN_PACKAGE_LOCK_B64}"; \
|
|
25
40
|
test -n "${ADMIN_PROFILE_CONTRACT_TEMPLATE_B64}"; \
|
|
@@ -65,6 +80,7 @@ RUN set -eux; \
|
|
|
65
80
|
stripe_cli_version="$(node -p "require('/usr/local/lib/sellable-agent/stripe-cli/node_modules/@stripe/cli-linux-x64/package.json').version")"; \
|
|
66
81
|
test "$(stripe version | head -n 1)" = "stripe version ${stripe_cli_version}"; \
|
|
67
82
|
test "$(node -p "require('/usr/local/lib/sellable-agent/node_modules/tus-js-client/package.json').version")" = "${TUS_JS_CLIENT_VERSION}"; \
|
|
83
|
+
slack-pp-cli --help >/dev/null; \
|
|
68
84
|
test -f /usr/local/lib/sellable-agent/admin-artifact/node_modules/@sellable/install/lib/sellable-agent/admin-runtime-reconciler.mjs; \
|
|
69
85
|
test -f /usr/local/lib/sellable-agent/admin-artifact/node_modules/@sellable/admin-mcp/dist/index.js; \
|
|
70
86
|
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);'; \
|
|
@@ -67,10 +67,10 @@ import {
|
|
|
67
67
|
HERMES_SNAPSHOT_HOOKS,
|
|
68
68
|
HERMES_SNAPSHOT_HOOK_ALLOWLIST_BYTES,
|
|
69
69
|
applyHermesHostedBackgroundReviewPolicy,
|
|
70
|
-
ensureHermesOpportunitySequencesCron,
|
|
71
70
|
ensureHermesSnapshotCron,
|
|
72
71
|
markHermesSnapshotDirty,
|
|
73
72
|
mergeHermesState,
|
|
73
|
+
migrateLegacyHermesUserState,
|
|
74
74
|
reconcileHermesSnapshot,
|
|
75
75
|
restoreLatestHermesSnapshot,
|
|
76
76
|
} from "../hermes-memory-snapshot.mjs";
|
|
@@ -383,18 +383,14 @@ function installAdminHome({ settingsRoot, layout }) {
|
|
|
383
383
|
} catch {
|
|
384
384
|
throw new Error("admin_runtime_admin_home_wrappers_rejected");
|
|
385
385
|
}
|
|
386
|
-
// The
|
|
387
|
-
//
|
|
388
|
-
// not carry. Every wrapper it generates from local bytes must still be ready.
|
|
386
|
+
// The sealed image carries the checksum-pinned Printing Press binary, so
|
|
387
|
+
// every wrapper generated from local bytes must be immediately usable.
|
|
389
388
|
if (
|
|
390
389
|
generated.error ||
|
|
391
390
|
summary?.adminHome !== layout.adminHome ||
|
|
392
391
|
!Array.isArray(summary.wrappers) ||
|
|
393
392
|
summary.wrappers.length < 1 ||
|
|
394
|
-
summary.wrappers.some(
|
|
395
|
-
(wrapper) =>
|
|
396
|
-
wrapper?.kind !== "external-binary" && wrapper?.ready !== true
|
|
397
|
-
)
|
|
393
|
+
summary.wrappers.some((wrapper) => wrapper?.ready !== true)
|
|
398
394
|
) {
|
|
399
395
|
throw new Error("admin_runtime_admin_home_wrappers_rejected");
|
|
400
396
|
}
|
|
@@ -697,22 +693,6 @@ const ADMIN_LIVE_SKILLS_CONFIG_KEYS = Object.freeze([
|
|
|
697
693
|
"disabled",
|
|
698
694
|
"platform_disabled",
|
|
699
695
|
]);
|
|
700
|
-
function packagedAdminSkillDirectories() {
|
|
701
|
-
const skillsRoot = join(ADMIN_INSTALL_ASSET_ROOT, "mcp", "skills");
|
|
702
|
-
const directories = new Set(["sellable"]);
|
|
703
|
-
for (const entry of readdirSync(skillsRoot, { withFileTypes: true })) {
|
|
704
|
-
if (entry.isSymbolicLink() || !entry.isDirectory()) {
|
|
705
|
-
throw new Error("admin_runtime_packaged_skills_inventory_rejected");
|
|
706
|
-
}
|
|
707
|
-
directories.add(entry.name);
|
|
708
|
-
}
|
|
709
|
-
return directories;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
// Candidate run 31458025989 proved that a fresh profile must not classify
|
|
713
|
-
// package-backed Admin skills as operator state: doing so made both allowed
|
|
714
|
-
// SOUL restage attempts compare an empty live inventory with the sealed stage.
|
|
715
|
-
const ADMIN_SEALED_SKILL_DIRECTORIES = packagedAdminSkillDirectories();
|
|
716
696
|
|
|
717
697
|
function adminPreservedSlackToolsets(config) {
|
|
718
698
|
const platformToolsets = config?.platform_toolsets;
|
|
@@ -732,17 +712,17 @@ function adminPreservedSlackToolsets(config) {
|
|
|
732
712
|
|
|
733
713
|
function adminPreservedSkillsIdentity(profileRoot) {
|
|
734
714
|
if (!existsSync(profileRoot)) return null;
|
|
715
|
+
const entries = [];
|
|
735
716
|
const skillsRoot = join(profileRoot, "skills");
|
|
736
717
|
const configPath = join(profileRoot, "config.yaml");
|
|
737
718
|
// Admin settings are delivered into .sellable-admin before the Hermes
|
|
738
719
|
// profile is staged. That settings-only directory is not an existing live
|
|
739
720
|
// profile and therefore has no skills state to preserve.
|
|
740
721
|
if (!existsSync(skillsRoot) && !existsSync(configPath)) return null;
|
|
741
|
-
const entries = [];
|
|
742
722
|
const walk = (directory, relativePath = "") => {
|
|
743
723
|
for (const name of readdirSync(directory).sort()) {
|
|
744
724
|
const nextRelative = relativePath ? `${relativePath}/${name}` : name;
|
|
745
|
-
if (
|
|
725
|
+
if (nextRelative === "sellable") continue;
|
|
746
726
|
const path = join(directory, name);
|
|
747
727
|
const stat = lstatSync(path);
|
|
748
728
|
if (stat.isSymbolicLink()) {
|
|
@@ -1049,22 +1029,12 @@ async function materializeAdminProfile({
|
|
|
1049
1029
|
hermesCli: HERMES,
|
|
1050
1030
|
});
|
|
1051
1031
|
if (!memoryCron.ok) throw new Error(memoryCron.code);
|
|
1052
|
-
const opportunitySequencesCron = await ensureHermesOpportunitySequencesCron({
|
|
1053
|
-
profileId: profile,
|
|
1054
|
-
profileRoot: profileHome,
|
|
1055
|
-
hermesRoot: DATA_ROOT,
|
|
1056
|
-
statePath: layout.statePath,
|
|
1057
|
-
});
|
|
1058
|
-
if (!opportunitySequencesCron.ok) {
|
|
1059
|
-
throw new Error(opportunitySequencesCron.code);
|
|
1060
|
-
}
|
|
1061
1032
|
return {
|
|
1062
1033
|
stage,
|
|
1063
1034
|
promotion: promoted.promotion,
|
|
1064
1035
|
profile,
|
|
1065
1036
|
profileHome,
|
|
1066
1037
|
adminHome,
|
|
1067
|
-
opportunitySequencesCron,
|
|
1068
1038
|
observedSoulRawSha256: promoted.observedSoulRawSha256,
|
|
1069
1039
|
servers: [serverProofs.sellable, serverProofs["sellable-admin"]].map(
|
|
1070
1040
|
({ tools: _tools, ...proof }) => proof
|
|
@@ -2518,7 +2488,6 @@ export async function runAdminCanary() {
|
|
|
2518
2488
|
}
|
|
2519
2489
|
const fixtureWorkspaceId = "phase158-canary-workspace";
|
|
2520
2490
|
const fixtureAgentId = "phase158-canary-admin-agent";
|
|
2521
|
-
const fixtureNotificationSlackUserId = "U187CANARY";
|
|
2522
2491
|
const fixtureFiles = {
|
|
2523
2492
|
".env": "PHASE158_ADMIN_CANARY=nonsecret\n",
|
|
2524
2493
|
"settings.json": `${JSON.stringify({
|
|
@@ -2531,9 +2500,6 @@ export async function runAdminCanary() {
|
|
|
2531
2500
|
})}\n`,
|
|
2532
2501
|
"config-state.json": `${JSON.stringify({
|
|
2533
2502
|
sellable: { workspaceIds: [], workspaceNames: {} },
|
|
2534
|
-
opportunitySequences: {
|
|
2535
|
-
notificationSlackUserId: fixtureNotificationSlackUserId,
|
|
2536
|
-
},
|
|
2537
2503
|
})}\n`,
|
|
2538
2504
|
};
|
|
2539
2505
|
for (const [name, value] of Object.entries(fixtureFiles)) {
|
|
@@ -3201,6 +3167,12 @@ async function runAdminProduction() {
|
|
|
3201
3167
|
fetchLatest: () => client.getMemorySnapshot(),
|
|
3202
3168
|
});
|
|
3203
3169
|
if (!memoryRestore.ok) throw new Error(memoryRestore.code);
|
|
3170
|
+
const legacyUserState = migrateLegacyHermesUserState({
|
|
3171
|
+
profileId: basename(profileContract.profileHome),
|
|
3172
|
+
profileRoot: profileContract.profileHome,
|
|
3173
|
+
hermesRoot: DATA_ROOT,
|
|
3174
|
+
});
|
|
3175
|
+
if (!legacyUserState.ok) throw new Error(legacyUserState.code);
|
|
3204
3176
|
const profile = await materializeAdminProfile({
|
|
3205
3177
|
profileContract,
|
|
3206
3178
|
settingsRoot: imported.receipt.generationRoot,
|
|
@@ -4,9 +4,9 @@ FROM ${HERMES_IMAGE}
|
|
|
4
4
|
|
|
5
5
|
USER root
|
|
6
6
|
|
|
7
|
-
ARG MCP_PACKAGE=@sellable/mcp@0.1.
|
|
8
|
-
ARG MCP_INTEGRITY=sha512-
|
|
9
|
-
ARG INSTALLER_PACKAGE=@sellable/install@0.1.
|
|
7
|
+
ARG MCP_PACKAGE=@sellable/mcp@0.1.864
|
|
8
|
+
ARG MCP_INTEGRITY=sha512-UevVd71zQL2FgnqYaeHBkTi73iUV0Lg5BchM5JNhUbvaFxAFQ2M1n9uSS18qVuM9Km0aGZ7a0k8M9e2AVPboAw==
|
|
9
|
+
ARG INSTALLER_PACKAGE=@sellable/install@0.1.607
|
|
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
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
import {
|
|
45
45
|
ensureHermesSnapshotCron,
|
|
46
46
|
markHermesSnapshotDirty,
|
|
47
|
+
migrateLegacyHermesUserState,
|
|
47
48
|
reconcileHermesSnapshot,
|
|
48
49
|
restoreLatestHermesSnapshot,
|
|
49
50
|
} from "../hermes-memory-snapshot.mjs";
|
|
@@ -95,9 +96,9 @@ const RUNTIME_GENERATION = Number(
|
|
|
95
96
|
const BOOT_SESSION_ID = randomUUID();
|
|
96
97
|
const HERMES_VERSION = process.env.SELLABLE_AGENT_HERMES_VERSION ?? "0.20.0";
|
|
97
98
|
const INSTALLER_PACKAGE =
|
|
98
|
-
process.env.SELLABLE_AGENT_INSTALLER_PACKAGE ?? "@sellable/install@0.1.
|
|
99
|
+
process.env.SELLABLE_AGENT_INSTALLER_PACKAGE ?? "@sellable/install@0.1.607";
|
|
99
100
|
const MCP_PACKAGE =
|
|
100
|
-
process.env.SELLABLE_AGENT_MCP_PACKAGE ?? "@sellable/mcp@0.1.
|
|
101
|
+
process.env.SELLABLE_AGENT_MCP_PACKAGE ?? "@sellable/mcp@0.1.864";
|
|
101
102
|
|
|
102
103
|
const sha256 = (value) => createHash("sha256").update(value).digest("hex");
|
|
103
104
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -2674,6 +2675,12 @@ async function processOperation({ claim, exchange, client, identity }) {
|
|
|
2674
2675
|
fetchLatest: () => client.getMemorySnapshot(),
|
|
2675
2676
|
});
|
|
2676
2677
|
if (!memoryRestore.ok) throw new Error(memoryRestore.code);
|
|
2678
|
+
const legacyUserState = migrateLegacyHermesUserState({
|
|
2679
|
+
profileId: desired.profileId,
|
|
2680
|
+
profileRoot,
|
|
2681
|
+
hermesRoot: DATA_ROOT,
|
|
2682
|
+
});
|
|
2683
|
+
if (!legacyUserState.ok) throw new Error(legacyUserState.code);
|
|
2677
2684
|
const materialized = materializeNativeSlackCustomerProfile({
|
|
2678
2685
|
desired,
|
|
2679
2686
|
profilesRoot: PROFILES_ROOT,
|
|
@@ -25,7 +25,7 @@ import { withProfileSoulLock } from "./fly-soul-bridge.mjs";
|
|
|
25
25
|
export const HERMES_SNAPSHOT_HOOKS = Object.freeze({
|
|
26
26
|
post_tool_call: Object.freeze([
|
|
27
27
|
Object.freeze({
|
|
28
|
-
matcher: "^(memory|skill_manage)$",
|
|
28
|
+
matcher: "^(cronjob|memory|skill_manage)$",
|
|
29
29
|
command: "/opt/sellable/bin/hermes-memory-dirty",
|
|
30
30
|
// Node startup can exceed one second when a shared-CPU customer is also
|
|
31
31
|
// serving Slack and an operator Desktop. Missing this hook defers a real
|
|
@@ -55,20 +55,9 @@ 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";
|
|
68
58
|
const LEGACY_HERMES_SNAPSHOT_SCRIPT = "scripts/hermes-memory-reconcile.sh";
|
|
69
59
|
|
|
70
60
|
const HERMES = "/opt/hermes/.venv/bin/hermes";
|
|
71
|
-
const HERMES_PYTHON = "/opt/hermes/.venv/bin/python";
|
|
72
61
|
const VERSION = "0.20.0";
|
|
73
62
|
const ID = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/;
|
|
74
63
|
const SHA256 = /^[a-f0-9]{64}$/;
|
|
@@ -136,6 +125,8 @@ const SNAPSHOT_TRANSIENT_DIRECTORIES = new Set([
|
|
|
136
125
|
"venv",
|
|
137
126
|
]);
|
|
138
127
|
const SOUL_LOCK_ROOT = "soul-locks";
|
|
128
|
+
const LEGACY_USER_STATE_MIGRATION_SCHEMA =
|
|
129
|
+
"sellable-hermes-legacy-user-state-migration/v1";
|
|
139
130
|
const RESTORE_STATE_SCHEMA = "sellable-hermes-restore-state/v1";
|
|
140
131
|
const RETRY_STATE_SCHEMA = "sellable-hermes-snapshot-retry/v1";
|
|
141
132
|
const snapshotReconciles = new Map();
|
|
@@ -273,68 +264,6 @@ function cronJobs(profileRoot) {
|
|
|
273
264
|
return jobs;
|
|
274
265
|
}
|
|
275
266
|
|
|
276
|
-
const sameJson = (left, right) =>
|
|
277
|
-
JSON.stringify(left) === JSON.stringify(right);
|
|
278
|
-
|
|
279
|
-
export async function ensureHermesNamedCron({
|
|
280
|
-
profileRoot,
|
|
281
|
-
name,
|
|
282
|
-
isExpected,
|
|
283
|
-
isUpdatable = () => true,
|
|
284
|
-
create,
|
|
285
|
-
update,
|
|
286
|
-
codePrefix = "hermes_named_cron",
|
|
287
|
-
}) {
|
|
288
|
-
if (
|
|
289
|
-
!isAbsolute(profileRoot) ||
|
|
290
|
-
!ID.test(name ?? "") ||
|
|
291
|
-
typeof isExpected !== "function" ||
|
|
292
|
-
typeof create !== "function" ||
|
|
293
|
-
typeof update !== "function"
|
|
294
|
-
) {
|
|
295
|
-
return failed(`${codePrefix}_identity_rejected`);
|
|
296
|
-
}
|
|
297
|
-
try {
|
|
298
|
-
const before = cronJobs(profileRoot);
|
|
299
|
-
const named = before.filter((job) => job?.name === name);
|
|
300
|
-
if (named.length > 1 || (named[0] && !isUpdatable(named[0]))) {
|
|
301
|
-
return failed(`${codePrefix}_inventory_rejected`);
|
|
302
|
-
}
|
|
303
|
-
if (named[0] && isExpected(named[0])) {
|
|
304
|
-
return {
|
|
305
|
-
ok: true,
|
|
306
|
-
status: "REUSED",
|
|
307
|
-
jobId: named[0].id,
|
|
308
|
-
job: named[0],
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
const siblings = before.filter((job) => job?.name !== name);
|
|
312
|
-
const mutation = named[0] ? await update(named[0]) : await create();
|
|
313
|
-
if (childFailed(mutation)) {
|
|
314
|
-
return failed(`${codePrefix}_${named[0] ? "update" : "create"}_failed`);
|
|
315
|
-
}
|
|
316
|
-
const after = cronJobs(profileRoot);
|
|
317
|
-
const readback = after.filter((job) => job?.name === name);
|
|
318
|
-
const afterSiblings = after.filter((job) => job?.name !== name);
|
|
319
|
-
if (!sameJson(afterSiblings, siblings)) {
|
|
320
|
-
return failed(`${codePrefix}_sibling_readback_rejected`);
|
|
321
|
-
}
|
|
322
|
-
if (readback.length !== 1 || !isExpected(readback[0])) {
|
|
323
|
-
return failed(
|
|
324
|
-
`${codePrefix}_${named[0] ? "update_readback" : "readback"}_rejected`
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
|
-
return {
|
|
328
|
-
ok: true,
|
|
329
|
-
status: named[0] ? "UPDATED" : "CREATED",
|
|
330
|
-
jobId: readback[0].id,
|
|
331
|
-
job: readback[0],
|
|
332
|
-
};
|
|
333
|
-
} catch {
|
|
334
|
-
return failed(`${codePrefix}_install_failed`);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
267
|
function isCron(job) {
|
|
339
268
|
return Boolean(
|
|
340
269
|
job?.id &&
|
|
@@ -469,6 +398,118 @@ function stageHermesUserState({ profileId, profileRoot, hermesRoot }) {
|
|
|
469
398
|
return stagingRoot;
|
|
470
399
|
}
|
|
471
400
|
|
|
401
|
+
function legacyUserStateMigrationMarker(profileRoot) {
|
|
402
|
+
return join(
|
|
403
|
+
profileRoot,
|
|
404
|
+
".sellable-agent",
|
|
405
|
+
"migrations",
|
|
406
|
+
"legacy-root-user-state-v1.json"
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function readLegacyUserStateMigration(path, profileId) {
|
|
411
|
+
regularFile(path);
|
|
412
|
+
const value = JSON.parse(readFileSync(path, "utf8"));
|
|
413
|
+
if (
|
|
414
|
+
value?.schemaVersion !== LEGACY_USER_STATE_MIGRATION_SCHEMA ||
|
|
415
|
+
value.profileId !== profileId ||
|
|
416
|
+
!Array.isArray(value.entries) ||
|
|
417
|
+
value.entries.some(
|
|
418
|
+
(name) =>
|
|
419
|
+
typeof name !== "string" ||
|
|
420
|
+
!HERMES_SNAPSHOT_USER_STATE_ENTRIES.includes(name)
|
|
421
|
+
) ||
|
|
422
|
+
new Set(value.entries).size !== value.entries.length
|
|
423
|
+
) {
|
|
424
|
+
throw new Error("hermes_legacy_user_state_migration_rejected");
|
|
425
|
+
}
|
|
426
|
+
return value;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Move the pre-profile Hermes layout into the current profile exactly once.
|
|
431
|
+
*
|
|
432
|
+
* Older Admin Machines stored durable user state directly under HERMES_HOME
|
|
433
|
+
* (for example /opt/data/skills and /opt/data/cron). Profile isolation moved
|
|
434
|
+
* those paths under profiles/<id>. Snapshot restore cannot discover that
|
|
435
|
+
* unscoped state because it intentionally restores profile archives only.
|
|
436
|
+
* Stage only the same bounded user-state allowlist used by snapshots, merge
|
|
437
|
+
* without overwriting newer profile bytes, then mark the resulting profile
|
|
438
|
+
* dirty so the next portable snapshot becomes self-contained.
|
|
439
|
+
*/
|
|
440
|
+
export function migrateLegacyHermesUserState({
|
|
441
|
+
profileId,
|
|
442
|
+
profileRoot,
|
|
443
|
+
hermesRoot,
|
|
444
|
+
}) {
|
|
445
|
+
if (!validProfilePath(profileId, profileRoot, hermesRoot)) {
|
|
446
|
+
return failed("hermes_legacy_user_state_identity_rejected");
|
|
447
|
+
}
|
|
448
|
+
const marker = legacyUserStateMigrationMarker(profileRoot);
|
|
449
|
+
try {
|
|
450
|
+
if (existsSync(marker)) {
|
|
451
|
+
const receipt = readLegacyUserStateMigration(marker, profileId);
|
|
452
|
+
return {
|
|
453
|
+
ok: true,
|
|
454
|
+
status: "REUSED",
|
|
455
|
+
profileId,
|
|
456
|
+
entries: receipt.entries,
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
const entries = HERMES_SNAPSHOT_USER_STATE_ENTRIES.filter((name) =>
|
|
460
|
+
existsSync(join(hermesRoot, name))
|
|
461
|
+
);
|
|
462
|
+
if (entries.length === 0) {
|
|
463
|
+
return { ok: true, status: "NO_LEGACY_STATE", profileId, entries: [] };
|
|
464
|
+
}
|
|
465
|
+
const backupsRoot = join(hermesRoot, "backups");
|
|
466
|
+
mkdirSync(backupsRoot, { recursive: true, mode: 0o700 });
|
|
467
|
+
const stagingRoot = mkdtempSync(join(backupsRoot, ".legacy-user-state-"));
|
|
468
|
+
chmodSync(stagingRoot, 0o700);
|
|
469
|
+
try {
|
|
470
|
+
for (const name of entries) {
|
|
471
|
+
const source = join(hermesRoot, name);
|
|
472
|
+
const stat = lstatSync(source);
|
|
473
|
+
if (stat.isSymbolicLink()) {
|
|
474
|
+
throw new Error("hermes_legacy_user_state_symlink_rejected");
|
|
475
|
+
}
|
|
476
|
+
stageUserStateEntry(source, join(stagingRoot, name));
|
|
477
|
+
if (name.endsWith(".db")) {
|
|
478
|
+
for (const suffix of ["-wal", "-shm", "-journal"]) {
|
|
479
|
+
const sidecar = `${source}${suffix}`;
|
|
480
|
+
if (existsSync(sidecar)) {
|
|
481
|
+
stageUserStateEntry(
|
|
482
|
+
sidecar,
|
|
483
|
+
join(stagingRoot, `${name}${suffix}`)
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
mkdirSync(profileRoot, { recursive: true, mode: 0o700 });
|
|
490
|
+
mergeHermesState(stagingRoot, profileRoot);
|
|
491
|
+
if (entries.some((name) => !existsSync(join(profileRoot, name)))) {
|
|
492
|
+
throw new Error("hermes_legacy_user_state_readback_rejected");
|
|
493
|
+
}
|
|
494
|
+
atomicWrite(
|
|
495
|
+
marker,
|
|
496
|
+
`${JSON.stringify({
|
|
497
|
+
schemaVersion: LEGACY_USER_STATE_MIGRATION_SCHEMA,
|
|
498
|
+
profileId,
|
|
499
|
+
entries,
|
|
500
|
+
})}\n`,
|
|
501
|
+
0o600
|
|
502
|
+
);
|
|
503
|
+
markHermesSnapshotDirty(profileRoot);
|
|
504
|
+
return { ok: true, status: "MIGRATED", profileId, entries };
|
|
505
|
+
} finally {
|
|
506
|
+
rmSync(stagingRoot, { recursive: true, force: true });
|
|
507
|
+
}
|
|
508
|
+
} catch {
|
|
509
|
+
return failed("hermes_legacy_user_state_migration_failed");
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
472
513
|
export function markHermesSnapshotDirty(profileRoot) {
|
|
473
514
|
if (
|
|
474
515
|
!isAbsolute(profileRoot) ||
|
|
@@ -506,40 +547,25 @@ export async function ensureHermesSnapshotCron({
|
|
|
506
547
|
readFileSync(reconcileTemplatePath),
|
|
507
548
|
0o700
|
|
508
549
|
);
|
|
509
|
-
const
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
"cron",
|
|
522
|
-
"create",
|
|
523
|
-
HERMES_SNAPSHOT_CRON.schedule,
|
|
524
|
-
"--name",
|
|
525
|
-
HERMES_SNAPSHOT_CRON.name,
|
|
526
|
-
"--script",
|
|
527
|
-
HERMES_SNAPSHOT_CRON.script,
|
|
528
|
-
"--no-agent",
|
|
529
|
-
],
|
|
530
|
-
hermesRoot,
|
|
531
|
-
hermesCli
|
|
532
|
-
)
|
|
533
|
-
),
|
|
534
|
-
update: (job) =>
|
|
535
|
-
childRunner(runChild)(
|
|
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)(
|
|
536
562
|
invocation(
|
|
537
563
|
[
|
|
538
564
|
"--profile",
|
|
539
565
|
profileId,
|
|
540
566
|
"cron",
|
|
541
567
|
"edit",
|
|
542
|
-
|
|
568
|
+
before[0].id,
|
|
543
569
|
"--script",
|
|
544
570
|
HERMES_SNAPSHOT_CRON.script,
|
|
545
571
|
"--no-agent",
|
|
@@ -547,199 +573,53 @@ export async function ensureHermesSnapshotCron({
|
|
|
547
573
|
hermesRoot,
|
|
548
574
|
hermesCli
|
|
549
575
|
)
|
|
550
|
-
)
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
return
|
|
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,
|
|
588
|
+
profileId,
|
|
589
|
+
}
|
|
590
|
+
: failed("hermes_snapshot_cron_migrate_readback_rejected");
|
|
558
591
|
}
|
|
559
|
-
return
|
|
592
|
+
return { ok: true, status: "REUSED", jobId: before[0].id, profileId };
|
|
560
593
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
"references/outbound-multichannel-v1.md",
|
|
575
|
-
"references/positive-reply-to-agreed-meeting-v1.md",
|
|
576
|
-
]);
|
|
577
|
-
const SLACK_USER_ID = /^U[A-Z0-9]{8,20}$/;
|
|
578
|
-
const OPPORTUNITY_SEQUENCE_CRON_PYTHON = [
|
|
579
|
-
"import json,sys",
|
|
580
|
-
"from cron.jobs import create_job, update_job",
|
|
581
|
-
"value=json.loads(sys.argv[1])",
|
|
582
|
-
"job_id=value.pop('jobId', None)",
|
|
583
|
-
"enabled=value.pop('enabled')",
|
|
584
|
-
"result=update_job(job_id, {**value, 'enabled': enabled}) if job_id else create_job(**value)",
|
|
585
|
-
"print(json.dumps({'id': result.get('id') if result else None}))",
|
|
586
|
-
].join("\n");
|
|
587
|
-
|
|
588
|
-
function opportunitySequenceIdentity(profileRoot) {
|
|
589
|
-
const root = join(
|
|
590
|
-
profileRoot,
|
|
591
|
-
"skills",
|
|
592
|
-
"sellable-admin",
|
|
593
|
-
HERMES_OPPORTUNITY_SEQUENCES_CRON.skills[0]
|
|
594
|
-
);
|
|
595
|
-
return Object.fromEntries(
|
|
596
|
-
OPPORTUNITY_SEQUENCE_ASSETS.map((relative) => {
|
|
597
|
-
const path = join(root, relative);
|
|
598
|
-
regularFile(path);
|
|
599
|
-
return [relative, sha256(readFileSync(path))];
|
|
600
|
-
})
|
|
601
|
-
);
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
function opportunitySequencePrompt({
|
|
605
|
-
notificationSlackUserId,
|
|
606
|
-
journalRoot,
|
|
607
|
-
hashes,
|
|
608
|
-
}) {
|
|
609
|
-
return [
|
|
610
|
-
"Run the installed opportunity-sequences skill for one bounded page.",
|
|
611
|
-
`Use the private journal at ${journalRoot}.`,
|
|
612
|
-
`Require these installed asset hashes: ${JSON.stringify(hashes)}.`,
|
|
613
|
-
`End with a compact native Slack summary addressed to <@${notificationSlackUserId}>.`,
|
|
614
|
-
"Never send prospect outreach; never claim exactly-once delivery; never use a direct Slack or Lightfield transport outside the installed skill and Product MCP.",
|
|
615
|
-
].join(" ");
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
export async function ensureHermesOpportunitySequencesCron({
|
|
619
|
-
profileId,
|
|
620
|
-
profileRoot,
|
|
621
|
-
hermesRoot,
|
|
622
|
-
statePath,
|
|
623
|
-
journalRoot = HERMES_OPPORTUNITY_SEQUENCES_JOURNAL_ROOT,
|
|
624
|
-
hermesPython = HERMES_PYTHON,
|
|
625
|
-
runChild,
|
|
626
|
-
}) {
|
|
627
|
-
if (
|
|
628
|
-
!validProfilePath(profileId, profileRoot, hermesRoot) ||
|
|
629
|
-
!existsSync(profileRoot) ||
|
|
630
|
-
!isAbsolute(statePath) ||
|
|
631
|
-
!isAbsolute(journalRoot)
|
|
632
|
-
) {
|
|
633
|
-
return failed("hermes_opportunity_sequences_cron_identity_rejected");
|
|
634
|
-
}
|
|
635
|
-
try {
|
|
636
|
-
const stateStat = regularFile(statePath);
|
|
637
|
-
if ((stateStat.mode & 0o077) !== 0) {
|
|
638
|
-
return failed("hermes_opportunity_sequences_cron_state_mode_rejected");
|
|
639
|
-
}
|
|
640
|
-
const state = JSON.parse(readFileSync(statePath, "utf8"));
|
|
641
|
-
const notificationSlackUserId =
|
|
642
|
-
state?.opportunitySequences?.notificationSlackUserId;
|
|
643
|
-
if (!SLACK_USER_ID.test(notificationSlackUserId ?? "")) {
|
|
644
|
-
return failed("hermes_opportunity_sequences_cron_notification_rejected");
|
|
645
|
-
}
|
|
646
|
-
mkdirSync(journalRoot, { recursive: true, mode: 0o700 });
|
|
647
|
-
chmodSync(journalRoot, 0o700);
|
|
648
|
-
const journalStat = lstatSync(journalRoot);
|
|
649
|
-
if (
|
|
650
|
-
journalStat.isSymbolicLink() ||
|
|
651
|
-
!journalStat.isDirectory() ||
|
|
652
|
-
(journalStat.mode & 0o077) !== 0
|
|
653
|
-
) {
|
|
654
|
-
return failed("hermes_opportunity_sequences_cron_journal_rejected");
|
|
655
|
-
}
|
|
656
|
-
const hashes = opportunitySequenceIdentity(profileRoot);
|
|
657
|
-
const prompt = opportunitySequencePrompt({
|
|
658
|
-
notificationSlackUserId,
|
|
659
|
-
journalRoot,
|
|
660
|
-
hashes,
|
|
661
|
-
});
|
|
662
|
-
const expected = (job) =>
|
|
663
|
-
Boolean(
|
|
664
|
-
job?.id &&
|
|
665
|
-
job.name === HERMES_OPPORTUNITY_SEQUENCES_CRON.name &&
|
|
666
|
-
job.prompt === prompt &&
|
|
667
|
-
job.no_agent === false &&
|
|
668
|
-
job.enabled === true &&
|
|
669
|
-
job.deliver === HERMES_OPPORTUNITY_SEQUENCES_CRON.deliver &&
|
|
670
|
-
sameJson(job.skills, HERMES_OPPORTUNITY_SEQUENCES_CRON.skills) &&
|
|
671
|
-
sameJson(
|
|
672
|
-
job.enabled_toolsets,
|
|
673
|
-
HERMES_OPPORTUNITY_SEQUENCES_CRON.enabledToolsets
|
|
674
|
-
) &&
|
|
675
|
-
job.schedule?.kind === "interval" &&
|
|
676
|
-
job.schedule?.minutes === 30
|
|
677
|
-
);
|
|
678
|
-
const mutate = (jobId = null) => {
|
|
679
|
-
const spec = {
|
|
680
|
-
prompt,
|
|
681
|
-
schedule: HERMES_OPPORTUNITY_SEQUENCES_CRON.schedule,
|
|
682
|
-
name: HERMES_OPPORTUNITY_SEQUENCES_CRON.name,
|
|
683
|
-
deliver: HERMES_OPPORTUNITY_SEQUENCES_CRON.deliver,
|
|
684
|
-
skills: [...HERMES_OPPORTUNITY_SEQUENCES_CRON.skills],
|
|
685
|
-
enabled_toolsets: [
|
|
686
|
-
...HERMES_OPPORTUNITY_SEQUENCES_CRON.enabledToolsets,
|
|
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",
|
|
687
607
|
],
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
args: ["-c", OPPORTUNITY_SEQUENCE_CRON_PYTHON, JSON.stringify(spec)],
|
|
695
|
-
env: {
|
|
696
|
-
...process.env,
|
|
697
|
-
HOME: hermesRoot,
|
|
698
|
-
HERMES_HOME: profileRoot,
|
|
699
|
-
HERMES_PROFILE: profileId,
|
|
700
|
-
NO_COLOR: "1",
|
|
701
|
-
},
|
|
702
|
-
shell: false,
|
|
703
|
-
timeoutMs: NATIVE_COMMAND_TIMEOUT_MS,
|
|
704
|
-
maxOutputBytes: 64 * 1024,
|
|
705
|
-
});
|
|
706
|
-
};
|
|
707
|
-
const result = await ensureHermesNamedCron({
|
|
708
|
-
profileRoot,
|
|
709
|
-
name: HERMES_OPPORTUNITY_SEQUENCES_CRON.name,
|
|
710
|
-
isExpected: expected,
|
|
711
|
-
create: () => mutate(),
|
|
712
|
-
update: (job) => mutate(job.id),
|
|
713
|
-
codePrefix: "hermes_opportunity_sequences_cron",
|
|
714
|
-
});
|
|
715
|
-
if (!result.ok) return result;
|
|
716
|
-
const jobsMode =
|
|
717
|
-
lstatSync(join(profileRoot, "cron", "jobs.json")).mode & 0o777;
|
|
718
|
-
if ((jobsMode & 0o077) !== 0) {
|
|
719
|
-
return failed("hermes_opportunity_sequences_cron_jobs_mode_rejected");
|
|
608
|
+
hermesRoot,
|
|
609
|
+
hermesCli
|
|
610
|
+
)
|
|
611
|
+
);
|
|
612
|
+
if (childFailed(result)) {
|
|
613
|
+
return failed("hermes_snapshot_cron_create_failed");
|
|
720
614
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
schedule: result.job.schedule,
|
|
728
|
-
profileId,
|
|
729
|
-
enabledToolsets: result.job.enabled_toolsets,
|
|
730
|
-
skills: result.job.skills,
|
|
731
|
-
assetHashes: hashes,
|
|
732
|
-
notificationSlackUserIdSource:
|
|
733
|
-
"config-state.json:opportunitySequences.notificationSlackUserId",
|
|
734
|
-
journalRoot,
|
|
735
|
-
modes: {
|
|
736
|
-
state: stateStat.mode & 0o777,
|
|
737
|
-
journal: journalStat.mode & 0o777,
|
|
738
|
-
jobs: jobsMode,
|
|
739
|
-
},
|
|
740
|
-
};
|
|
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");
|
|
741
621
|
} catch {
|
|
742
|
-
return failed("
|
|
622
|
+
return failed("hermes_snapshot_cron_install_failed");
|
|
743
623
|
}
|
|
744
624
|
}
|
|
745
625
|
|
|
@@ -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.
|
|
42
|
-
const MCP_PACKAGE = "@sellable/mcp@0.1.
|
|
41
|
+
const INSTALLER_PACKAGE = "@sellable/install@0.1.607";
|
|
42
|
+
const MCP_PACKAGE = "@sellable/mcp@0.1.864";
|
|
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.
|
|
1550
|
-
pinned.mcpPackage !== "@sellable/mcp@0.1.
|
|
1549
|
+
pinned.installerPackage !== "@sellable/install@0.1.607" ||
|
|
1550
|
+
pinned.mcpPackage !== "@sellable/mcp@0.1.864" ||
|
|
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.
|
|
282
|
-
desired.mcpPackage !== "@sellable/mcp@0.1.
|
|
281
|
+
desired.installerPackage !== "@sellable/install@0.1.607" ||
|
|
282
|
+
desired.mcpPackage !== "@sellable/mcp@0.1.864" ||
|
|
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.
|
|
29
|
-
export const PINNED_MCP_PACKAGE = "@sellable/mcp@0.1.
|
|
28
|
+
export const PINNED_INSTALL_PACKAGE = "@sellable/install@0.1.607";
|
|
29
|
+
export const PINNED_MCP_PACKAGE = "@sellable/mcp@0.1.864";
|
|
30
30
|
const PINNED_INSTALL_VERSION = PINNED_INSTALL_PACKAGE.slice(
|
|
31
31
|
PINNED_INSTALL_PACKAGE.lastIndexOf("@") + 1
|
|
32
32
|
);
|