@poolzin/pool-bot 2026.2.2 → 2026.2.4
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/dist/acp/server.js +2 -0
- package/dist/agents/agent-paths.js +5 -1
- package/dist/agents/anthropic-payload-log.js +3 -2
- package/dist/agents/bash-tools.exec.js +2 -1
- package/dist/agents/bash-tools.shared.js +2 -1
- package/dist/agents/cache-trace.js +9 -5
- package/dist/agents/cli-runner.js +1 -1
- package/dist/agents/live-auth-keys.js +3 -2
- package/dist/agents/pi-embedded-runner/session-manager-cache.js +2 -1
- package/dist/agents/pi-embedded-subscribe.raw-stream.js +3 -2
- package/dist/agents/sandbox/browser.js +5 -0
- package/dist/agents/shell-utils.js +1 -1
- package/dist/agents/skills/bundled-dir.js +2 -1
- package/dist/agents/synthetic-models.js +8 -0
- package/dist/agents/workspace.js +1 -1
- package/dist/auto-reply/reply/get-reply.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/server.js +1 -1
- package/dist/channels/plugins/catalog.js +6 -1
- package/dist/cli/banner.js +12 -12
- package/dist/cli/browser-cli-manage.js +10 -10
- package/dist/cli/browser-cli.js +1 -1
- package/dist/cli/channel-options.js +1 -1
- package/dist/cli/cli-name.js +1 -1
- package/dist/cli/command-format.js +1 -1
- package/dist/cli/daemon-cli/install.js +4 -1
- package/dist/cli/daemon-cli/shared.js +8 -3
- package/dist/cli/daemon-cli/status.gather.js +2 -0
- package/dist/cli/daemon-cli/status.print.js +3 -3
- package/dist/cli/gateway-cli/dev.js +1 -1
- package/dist/cli/gateway-cli/run.js +11 -6
- package/dist/cli/gateway-cli/shared.js +1 -1
- package/dist/cli/memory-cli.js +9 -3
- package/dist/cli/node-cli/daemon.js +2 -1
- package/dist/cli/profile.js +14 -4
- package/dist/cli/program/help.js +1 -1
- package/dist/cli/program/preaction.js +1 -1
- package/dist/cli/program/register.agent.js +4 -4
- package/dist/cli/program/register.onboard.js +1 -1
- package/dist/cli/program/register.setup.js +1 -1
- package/dist/cli/program/register.subclis.js +2 -2
- package/dist/cli/route.js +1 -1
- package/dist/cli/tagline.js +8 -8
- package/dist/cli/update-cli.js +12 -10
- package/dist/commands/auth-choice-options.js +104 -33
- package/dist/commands/configure.wizard.js +28 -9
- package/dist/commands/daemon-install-helpers.js +1 -1
- package/dist/commands/dashboard.js +4 -1
- package/dist/commands/doctor-format.js +3 -3
- package/dist/commands/doctor-gateway-daemon-flow.js +9 -3
- package/dist/commands/doctor-gateway-services.js +6 -2
- package/dist/commands/doctor-platform-notes.js +25 -8
- package/dist/commands/doctor-update.js +1 -1
- package/dist/commands/gateway-status/helpers.js +4 -2
- package/dist/commands/health.js +2 -2
- package/dist/commands/node-daemon-install-helpers.js +1 -1
- package/dist/commands/onboard-helpers.js +6 -6
- package/dist/commands/status-all.js +4 -2
- package/dist/commands/status.gateway-probe.js +4 -2
- package/dist/commands/status.scan.js +3 -2
- package/dist/config/io.js +5 -3
- package/dist/config/paths.js +27 -14
- package/dist/config/schema.field-metadata.js +1 -1
- package/dist/config/schema.js +1 -1
- package/dist/config/sessions/store.js +1 -1
- package/dist/daemon/inspect.js +1 -1
- package/dist/daemon/launchd.js +8 -5
- package/dist/daemon/node-service.js +14 -0
- package/dist/daemon/paths.js +2 -2
- package/dist/daemon/schtasks.js +9 -6
- package/dist/daemon/service-env.js +25 -5
- package/dist/daemon/systemd.js +9 -6
- package/dist/entry.js +5 -2
- package/dist/gateway/auth.js +6 -3
- package/dist/gateway/call.js +3 -1
- package/dist/gateway/server/ws-connection/message-handler.js +4 -1
- package/dist/gateway/server-browser.js +4 -2
- package/dist/gateway/server-constants.js +5 -2
- package/dist/gateway/server-cron.js +3 -1
- package/dist/gateway/server-discovery-runtime.js +4 -1
- package/dist/gateway/server-discovery.js +2 -2
- package/dist/gateway/server-reload-handlers.js +4 -4
- package/dist/gateway/server-runtime-config.js +2 -2
- package/dist/gateway/server-startup.js +4 -4
- package/dist/gateway/server.impl.js +3 -2
- package/dist/gateway/test-helpers.mocks.js +3 -0
- package/dist/gateway/test-helpers.server.js +60 -22
- package/dist/hooks/bundled-dir.js +1 -1
- package/dist/hooks/gmail-watcher.js +1 -1
- package/dist/infra/bonjour.js +1 -1
- package/dist/infra/diagnostic-flags.js +3 -2
- package/dist/infra/dotenv.js +1 -1
- package/dist/infra/gateway-lock.js +1 -1
- package/dist/infra/home-dir.js +1 -1
- package/dist/infra/path-env.js +2 -1
- package/dist/infra/restart.js +4 -3
- package/dist/infra/shell-env.js +4 -3
- package/dist/infra/state-migrations.js +5 -3
- package/dist/infra/system-presence.js +4 -1
- package/dist/infra/update-runner.js +4 -1
- package/dist/infra/widearea-dns.js +1 -1
- package/dist/macos/gateway-daemon.js +6 -1
- package/dist/macos/relay-smoke.js +5 -1
- package/dist/macos/relay.js +1 -0
- package/dist/media/image-ops.js +4 -2
- package/dist/memory/batch-gemini.js +1 -1
- package/dist/memory/embeddings-gemini.js +1 -1
- package/dist/node-host/runner.js +4 -2
- package/dist/plugins/bundled-dir.js +2 -1
- package/dist/plugins/manifest-registry.js +3 -2
- package/dist/security/audit-extra.sync.js +1 -1
- package/dist/security/audit.js +4 -2
- package/dist/telegram/accounts.js +1 -1
- package/dist/telegram/bot-message-dispatch.js +1 -1
- package/dist/telegram/network-config.js +8 -4
- package/dist/terminal/palette.js +8 -6
- package/dist/terminal/theme.js +12 -12
- package/dist/test-helpers/state-dir-env.js +8 -0
- package/dist/tts/tts.js +1 -1
- package/dist/tui/gateway-chat.js +3 -1
- package/dist/tui/theme/theme.js +5 -5
- package/dist/tui/tui.js +12 -6
- package/dist/utils.js +2 -2
- package/dist/version.js +1 -0
- package/dist/wizard/onboarding.finalize.js +1 -1
- package/dist/wizard/onboarding.js +6 -2
- package/package.json +1 -1
|
@@ -72,7 +72,11 @@ export async function maybeRepairGatewayDaemon(params) {
|
|
|
72
72
|
prompter: params.prompter,
|
|
73
73
|
});
|
|
74
74
|
await maybeRepairLaunchAgentBootstrap({
|
|
75
|
-
env: {
|
|
75
|
+
env: {
|
|
76
|
+
...process.env,
|
|
77
|
+
POOLBOT_LAUNCHD_LABEL: resolveNodeLaunchAgentLabel(),
|
|
78
|
+
CLAWDBOT_LAUNCHD_LABEL: resolveNodeLaunchAgentLabel(),
|
|
79
|
+
},
|
|
76
80
|
title: "Node",
|
|
77
81
|
runtime: params.runtime,
|
|
78
82
|
prompter: params.prompter,
|
|
@@ -121,7 +125,9 @@ export async function maybeRepairGatewayDaemon(params) {
|
|
|
121
125
|
const { programArguments, workingDirectory, environment } = await buildGatewayInstallPlan({
|
|
122
126
|
env: process.env,
|
|
123
127
|
port,
|
|
124
|
-
token: params.cfg.gateway?.auth?.token ??
|
|
128
|
+
token: params.cfg.gateway?.auth?.token ??
|
|
129
|
+
process.env.POOLBOT_GATEWAY_TOKEN ??
|
|
130
|
+
process.env.CLAWDBOT_GATEWAY_TOKEN,
|
|
125
131
|
runtime: daemonRuntime,
|
|
126
132
|
warn: (message, title) => note(message, title),
|
|
127
133
|
config: params.cfg,
|
|
@@ -169,7 +175,7 @@ export async function maybeRepairGatewayDaemon(params) {
|
|
|
169
175
|
}
|
|
170
176
|
}
|
|
171
177
|
if (process.platform === "darwin") {
|
|
172
|
-
const label = resolveGatewayLaunchAgentLabel(process.env.CLAWDBOT_PROFILE);
|
|
178
|
+
const label = resolveGatewayLaunchAgentLabel(process.env.POOLBOT_PROFILE || process.env.CLAWDBOT_PROFILE);
|
|
173
179
|
note(`LaunchAgent loaded; stopping requires "${formatCliCommand("poolbot gateway stop")}" or launchctl bootout gui/$UID/${label}.`, "Gateway");
|
|
174
180
|
}
|
|
175
181
|
if (serviceRuntime?.status === "running") {
|
|
@@ -80,7 +80,9 @@ export async function maybeMigrateLegacyGatewayService(cfg, mode, runtime, promp
|
|
|
80
80
|
const { programArguments, workingDirectory, environment } = await buildGatewayInstallPlan({
|
|
81
81
|
env: process.env,
|
|
82
82
|
port,
|
|
83
|
-
token: cfg.gateway?.auth?.token ??
|
|
83
|
+
token: cfg.gateway?.auth?.token ??
|
|
84
|
+
process.env.POOLBOT_GATEWAY_TOKEN ??
|
|
85
|
+
process.env.CLAWDBOT_GATEWAY_TOKEN,
|
|
84
86
|
runtime: daemonRuntime,
|
|
85
87
|
warn: (message, title) => note(message, title),
|
|
86
88
|
config: cfg,
|
|
@@ -138,7 +140,9 @@ export async function maybeRepairGatewayServiceConfig(cfg, mode, runtime, prompt
|
|
|
138
140
|
const { programArguments, workingDirectory, environment } = await buildGatewayInstallPlan({
|
|
139
141
|
env: process.env,
|
|
140
142
|
port,
|
|
141
|
-
token: cfg.gateway?.auth?.token ??
|
|
143
|
+
token: cfg.gateway?.auth?.token ??
|
|
144
|
+
process.env.POOLBOT_GATEWAY_TOKEN ??
|
|
145
|
+
process.env.CLAWDBOT_GATEWAY_TOKEN,
|
|
142
146
|
runtime: needsNodeRuntime && systemNodePath ? "node" : runtimeChoice,
|
|
143
147
|
nodePath: systemNodePath ?? undefined,
|
|
144
148
|
warn: (message, title) => note(message, title),
|
|
@@ -48,19 +48,36 @@ export async function noteMacLaunchctlGatewayEnvOverrides(cfg, deps) {
|
|
|
48
48
|
if (!hasConfigGatewayCreds(cfg))
|
|
49
49
|
return;
|
|
50
50
|
const getenv = deps?.getenv ?? launchctlGetenv;
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
51
|
+
// Check both POOLBOT_ (preferred) and CLAWDBOT_ (legacy) launchctl env vars
|
|
52
|
+
const poolbotToken = await getenv("POOLBOT_GATEWAY_TOKEN");
|
|
53
|
+
const clawdbotToken = await getenv("CLAWDBOT_GATEWAY_TOKEN");
|
|
54
|
+
const poolbotPassword = await getenv("POOLBOT_GATEWAY_PASSWORD");
|
|
55
|
+
const clawdbotPassword = await getenv("CLAWDBOT_GATEWAY_PASSWORD");
|
|
56
|
+
const hasToken = poolbotToken ?? clawdbotToken;
|
|
57
|
+
const hasPassword = poolbotPassword ?? clawdbotPassword;
|
|
58
|
+
if (!hasToken && !hasPassword)
|
|
54
59
|
return;
|
|
60
|
+
const tokenUnsets = [];
|
|
61
|
+
if (poolbotToken)
|
|
62
|
+
tokenUnsets.push(" launchctl unsetenv POOLBOT_GATEWAY_TOKEN");
|
|
63
|
+
if (clawdbotToken)
|
|
64
|
+
tokenUnsets.push(" launchctl unsetenv CLAWDBOT_GATEWAY_TOKEN");
|
|
65
|
+
const passwordUnsets = [];
|
|
66
|
+
if (poolbotPassword)
|
|
67
|
+
passwordUnsets.push(" launchctl unsetenv POOLBOT_GATEWAY_PASSWORD");
|
|
68
|
+
if (clawdbotPassword)
|
|
69
|
+
passwordUnsets.push(" launchctl unsetenv CLAWDBOT_GATEWAY_PASSWORD");
|
|
55
70
|
const lines = [
|
|
56
71
|
"- launchctl environment overrides detected (can cause confusing unauthorized errors).",
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
72
|
+
hasToken
|
|
73
|
+
? `- \`${poolbotToken ? "POOLBOT" : "CLAWDBOT"}_GATEWAY_TOKEN\` is set; it overrides config tokens.`
|
|
74
|
+
: undefined,
|
|
75
|
+
hasPassword
|
|
76
|
+
? `- \`${poolbotPassword ? "POOLBOT" : "CLAWDBOT"}_GATEWAY_PASSWORD\` is set; it overrides config passwords.`
|
|
60
77
|
: undefined,
|
|
61
78
|
"- Clear overrides and restart the app/gateway:",
|
|
62
|
-
|
|
63
|
-
|
|
79
|
+
...tokenUnsets,
|
|
80
|
+
...passwordUnsets,
|
|
64
81
|
].filter((line) => Boolean(line));
|
|
65
82
|
(deps?.noteFn ?? note)(lines.join("\n"), "Gateway (macOS)");
|
|
66
83
|
}
|
|
@@ -20,7 +20,7 @@ async function detectPoolbotGitCheckout(root) {
|
|
|
20
20
|
return res.stdout.trim() === root ? "git" : "not-git";
|
|
21
21
|
}
|
|
22
22
|
export async function maybeOfferUpdateBeforeDoctor(params) {
|
|
23
|
-
const updateInProgress = isTruthyEnvValue(process.env.CLAWDBOT_UPDATE_IN_PROGRESS);
|
|
23
|
+
const updateInProgress = isTruthyEnvValue(process.env.POOLBOT_UPDATE_IN_PROGRESS || process.env.CLAWDBOT_UPDATE_IN_PROGRESS);
|
|
24
24
|
const canOfferUpdate = !updateInProgress &&
|
|
25
25
|
params.options.nonInteractive !== true &&
|
|
26
26
|
params.options.yes !== true &&
|
|
@@ -91,8 +91,10 @@ export function resolveAuthForTarget(cfg, target, overrides) {
|
|
|
91
91
|
password: password.length > 0 ? password : undefined,
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
const envToken = process.env.CLAWDBOT_GATEWAY_TOKEN?.trim() || "";
|
|
95
|
-
const envPassword = process.env.
|
|
94
|
+
const envToken = process.env.POOLBOT_GATEWAY_TOKEN?.trim() || process.env.CLAWDBOT_GATEWAY_TOKEN?.trim() || "";
|
|
95
|
+
const envPassword = process.env.POOLBOT_GATEWAY_PASSWORD?.trim() ||
|
|
96
|
+
process.env.CLAWDBOT_GATEWAY_PASSWORD?.trim() ||
|
|
97
|
+
"";
|
|
96
98
|
const cfgToken = typeof cfg.gateway?.auth?.token === "string" ? cfg.gateway.auth.token.trim() : "";
|
|
97
99
|
const cfgPassword = typeof cfg.gateway?.auth?.password === "string" ? cfg.gateway.auth.password.trim() : "";
|
|
98
100
|
return {
|
package/dist/commands/health.js
CHANGED
|
@@ -14,7 +14,7 @@ import { normalizeAgentId } from "../routing/session-key.js";
|
|
|
14
14
|
import { theme } from "../terminal/theme.js";
|
|
15
15
|
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
16
16
|
const debugHealth = (...args) => {
|
|
17
|
-
if (isTruthyEnvValue(process.env.CLAWDBOT_DEBUG_HEALTH)) {
|
|
17
|
+
if (isTruthyEnvValue(process.env.POOLBOT_DEBUG_HEALTH || process.env.CLAWDBOT_DEBUG_HEALTH)) {
|
|
18
18
|
console.warn("[health:debug]", ...args);
|
|
19
19
|
}
|
|
20
20
|
};
|
|
@@ -420,7 +420,7 @@ export async function healthCommand(opts, runtime) {
|
|
|
420
420
|
runtime.log(JSON.stringify(summary, null, 2));
|
|
421
421
|
}
|
|
422
422
|
else {
|
|
423
|
-
const debugEnabled = isTruthyEnvValue(process.env.CLAWDBOT_DEBUG_HEALTH);
|
|
423
|
+
const debugEnabled = isTruthyEnvValue(process.env.POOLBOT_DEBUG_HEALTH || process.env.CLAWDBOT_DEBUG_HEALTH);
|
|
424
424
|
if (opts.verbose) {
|
|
425
425
|
const details = buildGatewayConnectionDetails({ config: cfg });
|
|
426
426
|
runtime.log(info("Gateway connection:"));
|
|
@@ -29,7 +29,7 @@ export async function buildNodeInstallPlan(params) {
|
|
|
29
29
|
}
|
|
30
30
|
const environment = buildNodeServiceEnvironment({ env: params.env });
|
|
31
31
|
const description = formatNodeServiceDescription({
|
|
32
|
-
version: environment.CLAWDBOT_SERVICE_VERSION,
|
|
32
|
+
version: environment.POOLBOT_SERVICE_VERSION || environment.CLAWDBOT_SERVICE_VERSION,
|
|
33
33
|
});
|
|
34
34
|
return { programArguments, workingDirectory, environment, description };
|
|
35
35
|
}
|
|
@@ -53,12 +53,12 @@ export function randomToken() {
|
|
|
53
53
|
}
|
|
54
54
|
export function printWizardHeader(runtime) {
|
|
55
55
|
const header = [
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
56
|
+
"████░░░███░░░███░░█░░░░████░░░███░░▀█▀",
|
|
57
|
+
"█░░░█░█░░░█░█░░░█░█░░░░█░░░█░█░░░█░░█░",
|
|
58
|
+
"████░░█░░░█░█░░░█░█░░░░████░░█░░░█░░█░",
|
|
59
|
+
"█░░░░░█░░░█░█░░░█░█░░░░█░░░█░█░░░█░░█░",
|
|
60
|
+
"█░░░░░░███░░░███░░█████░████░░░███░░░█░",
|
|
61
|
+
" 🎱 RACK 'EM UP 🎱",
|
|
62
62
|
].join("\n");
|
|
63
63
|
runtime.log(header);
|
|
64
64
|
}
|
|
@@ -118,9 +118,11 @@ export async function statusAllCommand(runtime, opts) {
|
|
|
118
118
|
? typeof remote?.token === "string" && remote.token.trim()
|
|
119
119
|
? remote.token.trim()
|
|
120
120
|
: undefined
|
|
121
|
-
: process.env.
|
|
121
|
+
: process.env.POOLBOT_GATEWAY_TOKEN?.trim() ||
|
|
122
|
+
process.env.CLAWDBOT_GATEWAY_TOKEN?.trim() ||
|
|
122
123
|
(typeof authToken === "string" && authToken.trim() ? authToken.trim() : undefined);
|
|
123
|
-
const password = process.env.
|
|
124
|
+
const password = process.env.POOLBOT_GATEWAY_PASSWORD?.trim() ||
|
|
125
|
+
process.env.CLAWDBOT_GATEWAY_PASSWORD?.trim() ||
|
|
124
126
|
(mode === "remote"
|
|
125
127
|
? typeof remote?.password === "string" && remote.password.trim()
|
|
126
128
|
? remote.password.trim()
|
|
@@ -7,9 +7,11 @@ export function resolveGatewayProbeAuth(cfg) {
|
|
|
7
7
|
? typeof remote?.token === "string" && remote.token.trim().length > 0
|
|
8
8
|
? remote.token.trim()
|
|
9
9
|
: undefined
|
|
10
|
-
: process.env.
|
|
10
|
+
: process.env.POOLBOT_GATEWAY_TOKEN?.trim() ||
|
|
11
|
+
process.env.CLAWDBOT_GATEWAY_TOKEN?.trim() ||
|
|
11
12
|
(typeof authToken === "string" && authToken.trim().length > 0 ? authToken.trim() : undefined);
|
|
12
|
-
const password = process.env.
|
|
13
|
+
const password = process.env.POOLBOT_GATEWAY_PASSWORD?.trim() ||
|
|
14
|
+
process.env.CLAWDBOT_GATEWAY_PASSWORD?.trim() ||
|
|
13
15
|
(isRemoteMode
|
|
14
16
|
? typeof remote?.password === "string" && remote.password.trim().length > 0
|
|
15
17
|
? remote.password.trim()
|
|
@@ -86,8 +86,9 @@ export async function scanStatus(opts, _runtime) {
|
|
|
86
86
|
progress.setLabel("Summarizing channels…");
|
|
87
87
|
const channels = await buildChannelsTable(cfg, {
|
|
88
88
|
// Show token previews in regular status; keep `status --all` redacted.
|
|
89
|
-
// Set `CLAWDBOT_SHOW_SECRETS=0` to force redaction.
|
|
90
|
-
showSecrets: process.env.
|
|
89
|
+
// Set `POOLBOT_SHOW_SECRETS=0` (or `CLAWDBOT_SHOW_SECRETS=0`) to force redaction.
|
|
90
|
+
showSecrets: (process.env.POOLBOT_SHOW_SECRETS?.trim() ??
|
|
91
|
+
process.env.CLAWDBOT_SHOW_SECRETS?.trim()) !== "0",
|
|
91
92
|
});
|
|
92
93
|
progress.tick();
|
|
93
94
|
progress.setLabel("Checking memory…");
|
package/dist/config/io.js
CHANGED
|
@@ -34,6 +34,8 @@ const SHELL_ENV_EXPECTED_KEYS = [
|
|
|
34
34
|
"DISCORD_BOT_TOKEN",
|
|
35
35
|
"SLACK_BOT_TOKEN",
|
|
36
36
|
"SLACK_APP_TOKEN",
|
|
37
|
+
"POOLBOT_GATEWAY_TOKEN",
|
|
38
|
+
"POOLBOT_GATEWAY_PASSWORD",
|
|
37
39
|
"CLAWDBOT_GATEWAY_TOKEN",
|
|
38
40
|
"CLAWDBOT_GATEWAY_PASSWORD",
|
|
39
41
|
];
|
|
@@ -436,12 +438,12 @@ export function createConfigIO(overrides = {}) {
|
|
|
436
438
|
};
|
|
437
439
|
}
|
|
438
440
|
// NOTE: These wrappers intentionally do *not* cache the resolved config path at
|
|
439
|
-
// module scope. `CLAWDBOT_CONFIG_PATH` (and friends) are expected to work even
|
|
441
|
+
// module scope. `POOLBOT_CONFIG_PATH` / `CLAWDBOT_CONFIG_PATH` (and friends) are expected to work even
|
|
440
442
|
// when set after the module has been imported (tests, one-off scripts, etc.).
|
|
441
443
|
const DEFAULT_CONFIG_CACHE_MS = 200;
|
|
442
444
|
let configCache = null;
|
|
443
445
|
function resolveConfigCacheMs(env) {
|
|
444
|
-
const raw = env.CLAWDBOT_CONFIG_CACHE_MS?.trim();
|
|
446
|
+
const raw = env.POOLBOT_CONFIG_CACHE_MS?.trim() || env.CLAWDBOT_CONFIG_CACHE_MS?.trim();
|
|
445
447
|
if (raw === "" || raw === "0")
|
|
446
448
|
return 0;
|
|
447
449
|
if (!raw)
|
|
@@ -452,7 +454,7 @@ function resolveConfigCacheMs(env) {
|
|
|
452
454
|
return Math.max(0, parsed);
|
|
453
455
|
}
|
|
454
456
|
function shouldUseConfigCache(env) {
|
|
455
|
-
if (env.CLAWDBOT_DISABLE_CONFIG_CACHE?.trim())
|
|
457
|
+
if (env.POOLBOT_DISABLE_CONFIG_CACHE?.trim() || env.CLAWDBOT_DISABLE_CONFIG_CACHE?.trim())
|
|
456
458
|
return false;
|
|
457
459
|
return resolveConfigCacheMs(env) > 0;
|
|
458
460
|
}
|
package/dist/config/paths.js
CHANGED
|
@@ -3,14 +3,15 @@ import os from "node:os";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { expandHomePrefix, resolveRequiredHomeDir } from "../infra/home-dir.js";
|
|
5
5
|
/**
|
|
6
|
-
* Nix mode detection: When
|
|
6
|
+
* Nix mode detection: When POOLBOT_NIX_MODE=1 (or legacy CLAWDBOT_NIX_MODE=1),
|
|
7
|
+
* the gateway is running under Nix.
|
|
7
8
|
* In this mode:
|
|
8
9
|
* - No auto-install flows should be attempted
|
|
9
10
|
* - Missing dependencies should produce actionable Nix-specific error messages
|
|
10
11
|
* - Config is managed externally (read-only from Nix perspective)
|
|
11
12
|
*/
|
|
12
13
|
export function resolveIsNixMode(env = process.env) {
|
|
13
|
-
return env.CLAWDBOT_NIX_MODE === "1";
|
|
14
|
+
return (env.POOLBOT_NIX_MODE ?? env.CLAWDBOT_NIX_MODE) === "1";
|
|
14
15
|
}
|
|
15
16
|
export const isNixMode = resolveIsNixMode();
|
|
16
17
|
const LEGACY_STATE_DIRNAMES = [".clawdbot", ".moltbot", ".moldbot"];
|
|
@@ -20,7 +21,7 @@ const LEGACY_CONFIG_FILENAMES = ["clawdbot.json", "moltbot.json", "moldbot.json"
|
|
|
20
21
|
function resolveDefaultHomeDir() {
|
|
21
22
|
return resolveRequiredHomeDir(process.env, os.homedir);
|
|
22
23
|
}
|
|
23
|
-
/** Build a homedir thunk that respects CLAWDBOT_HOME for the given env. */
|
|
24
|
+
/** Build a homedir thunk that respects POOLBOT_HOME / CLAWDBOT_HOME for the given env. */
|
|
24
25
|
function envHomedir(env) {
|
|
25
26
|
return () => resolveRequiredHomeDir(env, os.homedir);
|
|
26
27
|
}
|
|
@@ -41,12 +42,14 @@ export function resolveNewStateDir(homedir = resolveDefaultHomeDir) {
|
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
43
44
|
* State directory for mutable data (sessions, logs, caches).
|
|
44
|
-
* Can be overridden via
|
|
45
|
+
* Can be overridden via POOLBOT_STATE_DIR (preferred), MOLTBOT_STATE_DIR, or CLAWDBOT_STATE_DIR (legacy).
|
|
45
46
|
* Default: ~/.poolbot
|
|
46
47
|
*/
|
|
47
48
|
export function resolveStateDir(env = process.env, homedir = envHomedir(env)) {
|
|
48
49
|
const effectiveHomedir = () => resolveRequiredHomeDir(env, homedir);
|
|
49
|
-
const override = env.
|
|
50
|
+
const override = env.POOLBOT_STATE_DIR?.trim() ||
|
|
51
|
+
env.MOLTBOT_STATE_DIR?.trim() ||
|
|
52
|
+
env.CLAWDBOT_STATE_DIR?.trim();
|
|
50
53
|
if (override) {
|
|
51
54
|
return resolveUserPath(override, env, effectiveHomedir);
|
|
52
55
|
}
|
|
@@ -87,11 +90,13 @@ function resolveUserPath(input, env = process.env, homedir = envHomedir(env)) {
|
|
|
87
90
|
export const STATE_DIR = resolveStateDir();
|
|
88
91
|
/**
|
|
89
92
|
* Config file path (JSON5).
|
|
90
|
-
* Can be overridden via
|
|
93
|
+
* Can be overridden via POOLBOT_CONFIG_PATH (preferred), MOLTBOT_CONFIG_PATH, or CLAWDBOT_CONFIG_PATH (legacy).
|
|
91
94
|
* Default: ~/.poolbot/poolbot.json (or $*_STATE_DIR/poolbot.json)
|
|
92
95
|
*/
|
|
93
96
|
export function resolveCanonicalConfigPath(env = process.env, stateDir = resolveStateDir(env, envHomedir(env))) {
|
|
94
|
-
const override = env.
|
|
97
|
+
const override = env.POOLBOT_CONFIG_PATH?.trim() ||
|
|
98
|
+
env.MOLTBOT_CONFIG_PATH?.trim() ||
|
|
99
|
+
env.CLAWDBOT_CONFIG_PATH?.trim();
|
|
95
100
|
if (override) {
|
|
96
101
|
return resolveUserPath(override, env, envHomedir(env));
|
|
97
102
|
}
|
|
@@ -120,11 +125,15 @@ export function resolveConfigPathCandidate(env = process.env, homedir = envHomed
|
|
|
120
125
|
* Active config path (prefers existing config files).
|
|
121
126
|
*/
|
|
122
127
|
export function resolveConfigPath(env = process.env, stateDir = resolveStateDir(env, envHomedir(env)), homedir = envHomedir(env)) {
|
|
123
|
-
const override = env.
|
|
128
|
+
const override = env.POOLBOT_CONFIG_PATH?.trim() ||
|
|
129
|
+
env.MOLTBOT_CONFIG_PATH?.trim() ||
|
|
130
|
+
env.CLAWDBOT_CONFIG_PATH?.trim();
|
|
124
131
|
if (override) {
|
|
125
132
|
return resolveUserPath(override, env, homedir);
|
|
126
133
|
}
|
|
127
|
-
const stateOverride = env.
|
|
134
|
+
const stateOverride = env.POOLBOT_STATE_DIR?.trim() ||
|
|
135
|
+
env.MOLTBOT_STATE_DIR?.trim() ||
|
|
136
|
+
env.CLAWDBOT_STATE_DIR?.trim();
|
|
128
137
|
const candidates = [
|
|
129
138
|
path.join(stateDir, CONFIG_FILENAME),
|
|
130
139
|
...LEGACY_CONFIG_FILENAMES.map((name) => path.join(stateDir, name)),
|
|
@@ -156,12 +165,16 @@ export const CONFIG_PATH = resolveConfigPathCandidate();
|
|
|
156
165
|
*/
|
|
157
166
|
export function resolveDefaultConfigCandidates(env = process.env, homedir = envHomedir(env)) {
|
|
158
167
|
const effectiveHomedir = () => resolveRequiredHomeDir(env, homedir);
|
|
159
|
-
const explicit = env.
|
|
168
|
+
const explicit = env.POOLBOT_CONFIG_PATH?.trim() ||
|
|
169
|
+
env.MOLTBOT_CONFIG_PATH?.trim() ||
|
|
170
|
+
env.CLAWDBOT_CONFIG_PATH?.trim();
|
|
160
171
|
if (explicit) {
|
|
161
172
|
return [resolveUserPath(explicit, env, effectiveHomedir)];
|
|
162
173
|
}
|
|
163
174
|
const candidates = [];
|
|
164
|
-
const poolbotStateDir = env.
|
|
175
|
+
const poolbotStateDir = env.POOLBOT_STATE_DIR?.trim() ||
|
|
176
|
+
env.MOLTBOT_STATE_DIR?.trim() ||
|
|
177
|
+
env.CLAWDBOT_STATE_DIR?.trim();
|
|
165
178
|
if (poolbotStateDir) {
|
|
166
179
|
const resolved = resolveUserPath(poolbotStateDir, env, effectiveHomedir);
|
|
167
180
|
candidates.push(path.join(resolved, CONFIG_FILENAME));
|
|
@@ -190,11 +203,11 @@ const OAUTH_FILENAME = "oauth.json";
|
|
|
190
203
|
* OAuth credentials storage directory.
|
|
191
204
|
*
|
|
192
205
|
* Precedence:
|
|
193
|
-
* - `CLAWDBOT_OAUTH_DIR` (explicit override)
|
|
206
|
+
* - `POOLBOT_OAUTH_DIR` / `CLAWDBOT_OAUTH_DIR` (explicit override)
|
|
194
207
|
* - `$*_STATE_DIR/credentials` (canonical server/default)
|
|
195
208
|
*/
|
|
196
209
|
export function resolveOAuthDir(env = process.env, stateDir = resolveStateDir(env, envHomedir(env))) {
|
|
197
|
-
const override = env.CLAWDBOT_OAUTH_DIR?.trim();
|
|
210
|
+
const override = env.POOLBOT_OAUTH_DIR?.trim() || env.CLAWDBOT_OAUTH_DIR?.trim();
|
|
198
211
|
if (override) {
|
|
199
212
|
return resolveUserPath(override, env, envHomedir(env));
|
|
200
213
|
}
|
|
@@ -204,7 +217,7 @@ export function resolveOAuthPath(env = process.env, stateDir = resolveStateDir(e
|
|
|
204
217
|
return path.join(resolveOAuthDir(env, stateDir), OAUTH_FILENAME);
|
|
205
218
|
}
|
|
206
219
|
export function resolveGatewayPort(cfg, env = process.env) {
|
|
207
|
-
const envRaw = env.CLAWDBOT_GATEWAY_PORT?.trim();
|
|
220
|
+
const envRaw = (env.POOLBOT_GATEWAY_PORT ?? env.CLAWDBOT_GATEWAY_PORT)?.trim();
|
|
208
221
|
if (envRaw) {
|
|
209
222
|
const parsed = Number.parseInt(envRaw, 10);
|
|
210
223
|
if (Number.isFinite(parsed) && parsed > 0) {
|
|
@@ -376,7 +376,7 @@ export const FIELD_HELP = {
|
|
|
376
376
|
"nodeHost.browserProxy.allowProfiles": "Optional allowlist of browser profile names exposed via the node proxy.",
|
|
377
377
|
"diagnostics.flags": 'Enable targeted diagnostics logs by flag (e.g. ["telegram.http"]). Supports wildcards like "telegram.*" or "*".',
|
|
378
378
|
"diagnostics.cacheTrace.enabled": "Log cache trace snapshots for embedded agent runs (default: false).",
|
|
379
|
-
"diagnostics.cacheTrace.filePath": "JSONL output path for cache trace logs (default: $
|
|
379
|
+
"diagnostics.cacheTrace.filePath": "JSONL output path for cache trace logs (default: $POOLBOT_STATE_DIR/logs/cache-trace.jsonl).",
|
|
380
380
|
"diagnostics.cacheTrace.includeMessages": "Include full message payloads in trace output (default: true).",
|
|
381
381
|
"diagnostics.cacheTrace.includePrompt": "Include prompt text in trace output (default: true).",
|
|
382
382
|
"diagnostics.cacheTrace.includeSystem": "Include system prompt in trace output (default: true).",
|
package/dist/config/schema.js
CHANGED
|
@@ -341,7 +341,7 @@ const FIELD_HELP = {
|
|
|
341
341
|
"nodeHost.browserProxy.allowProfiles": "Optional allowlist of browser profile names exposed via the node proxy.",
|
|
342
342
|
"diagnostics.flags": 'Enable targeted diagnostics logs by flag (e.g. ["telegram.http"]). Supports wildcards like "telegram.*" or "*".',
|
|
343
343
|
"diagnostics.cacheTrace.enabled": "Log cache trace snapshots for embedded agent runs (default: false).",
|
|
344
|
-
"diagnostics.cacheTrace.filePath": "JSONL output path for cache trace logs (default: $
|
|
344
|
+
"diagnostics.cacheTrace.filePath": "JSONL output path for cache trace logs (default: $POOLBOT_STATE_DIR/logs/cache-trace.jsonl).",
|
|
345
345
|
"diagnostics.cacheTrace.includeMessages": "Include full message payloads in trace output (default: true).",
|
|
346
346
|
"diagnostics.cacheTrace.includePrompt": "Include prompt text in trace output (default: true).",
|
|
347
347
|
"diagnostics.cacheTrace.includeSystem": "Include system prompt in trace output (default: true).",
|
|
@@ -18,7 +18,7 @@ function isSessionStoreRecord(value) {
|
|
|
18
18
|
}
|
|
19
19
|
function getSessionStoreTtl() {
|
|
20
20
|
return resolveCacheTtlMs({
|
|
21
|
-
envValue: process.env.CLAWDBOT_SESSION_CACHE_TTL_MS,
|
|
21
|
+
envValue: process.env.POOLBOT_SESSION_CACHE_TTL_MS || process.env.CLAWDBOT_SESSION_CACHE_TTL_MS,
|
|
22
22
|
defaultTtlMs: DEFAULT_SESSION_STORE_TTL_MS,
|
|
23
23
|
});
|
|
24
24
|
}
|
package/dist/daemon/inspect.js
CHANGED
|
@@ -6,7 +6,7 @@ import { GATEWAY_SERVICE_KIND, GATEWAY_SERVICE_MARKER, LEGACY_GATEWAY_LAUNCH_AGE
|
|
|
6
6
|
const EXTRA_MARKERS = ["poolbot"];
|
|
7
7
|
const execFileAsync = promisify(execFile);
|
|
8
8
|
export function renderGatewayServiceCleanupHints(env = process.env) {
|
|
9
|
-
const profile = env.CLAWDBOT_PROFILE;
|
|
9
|
+
const profile = env.POOLBOT_PROFILE || env.CLAWDBOT_PROFILE;
|
|
10
10
|
switch (process.platform) {
|
|
11
11
|
case "darwin": {
|
|
12
12
|
const label = resolveGatewayLaunchAgentLabel(profile);
|
package/dist/daemon/launchd.js
CHANGED
|
@@ -14,10 +14,10 @@ const formatLine = (label, value) => {
|
|
|
14
14
|
return `${colorize(rich, theme.muted, `${label}:`)} ${colorize(rich, theme.command, value)}`;
|
|
15
15
|
};
|
|
16
16
|
function resolveLaunchAgentLabel(args) {
|
|
17
|
-
const envLabel = args?.env?.CLAWDBOT_LAUNCHD_LABEL?.trim();
|
|
17
|
+
const envLabel = args?.env?.POOLBOT_LAUNCHD_LABEL?.trim() || args?.env?.CLAWDBOT_LAUNCHD_LABEL?.trim();
|
|
18
18
|
if (envLabel)
|
|
19
19
|
return envLabel;
|
|
20
|
-
return resolveGatewayLaunchAgentLabel(args?.env?.CLAWDBOT_PROFILE);
|
|
20
|
+
return resolveGatewayLaunchAgentLabel(args?.env?.POOLBOT_PROFILE ?? args?.env?.CLAWDBOT_PROFILE);
|
|
21
21
|
}
|
|
22
22
|
function resolveLaunchAgentPlistPathForLabel(env, label) {
|
|
23
23
|
const home = toPosixPath(resolveHomeDir(env));
|
|
@@ -30,7 +30,7 @@ export function resolveLaunchAgentPlistPath(env) {
|
|
|
30
30
|
export function resolveGatewayLogPaths(env) {
|
|
31
31
|
const stateDir = resolveGatewayStateDir(env);
|
|
32
32
|
const logDir = path.join(stateDir, "logs");
|
|
33
|
-
const prefix = env.CLAWDBOT_LOG_PREFIX?.trim() || "gateway";
|
|
33
|
+
const prefix = env.POOLBOT_LOG_PREFIX?.trim() || env.CLAWDBOT_LOG_PREFIX?.trim() || "gateway";
|
|
34
34
|
return {
|
|
35
35
|
logDir,
|
|
36
36
|
stdoutPath: path.join(logDir, `${prefix}.log`),
|
|
@@ -277,8 +277,11 @@ export async function installLaunchAgent({ env, stdout, programArguments, workin
|
|
|
277
277
|
await fs.mkdir(path.dirname(plistPath), { recursive: true });
|
|
278
278
|
const serviceDescription = description ??
|
|
279
279
|
formatGatewayServiceDescription({
|
|
280
|
-
profile: env.CLAWDBOT_PROFILE,
|
|
281
|
-
version: environment?.
|
|
280
|
+
profile: env.POOLBOT_PROFILE ?? env.CLAWDBOT_PROFILE,
|
|
281
|
+
version: environment?.POOLBOT_SERVICE_VERSION ??
|
|
282
|
+
environment?.CLAWDBOT_SERVICE_VERSION ??
|
|
283
|
+
env.POOLBOT_SERVICE_VERSION ??
|
|
284
|
+
env.CLAWDBOT_SERVICE_VERSION,
|
|
282
285
|
});
|
|
283
286
|
const plist = buildLaunchAgentPlist({
|
|
284
287
|
label,
|
|
@@ -3,6 +3,13 @@ import { NODE_SERVICE_KIND, NODE_SERVICE_MARKER, NODE_WINDOWS_TASK_SCRIPT_NAME,
|
|
|
3
3
|
function withNodeServiceEnv(env) {
|
|
4
4
|
return {
|
|
5
5
|
...env,
|
|
6
|
+
POOLBOT_LAUNCHD_LABEL: resolveNodeLaunchAgentLabel(),
|
|
7
|
+
POOLBOT_SYSTEMD_UNIT: resolveNodeSystemdServiceName(),
|
|
8
|
+
POOLBOT_WINDOWS_TASK_NAME: resolveNodeWindowsTaskName(),
|
|
9
|
+
POOLBOT_TASK_SCRIPT_NAME: NODE_WINDOWS_TASK_SCRIPT_NAME,
|
|
10
|
+
POOLBOT_LOG_PREFIX: "node",
|
|
11
|
+
POOLBOT_SERVICE_MARKER: NODE_SERVICE_MARKER,
|
|
12
|
+
POOLBOT_SERVICE_KIND: NODE_SERVICE_KIND,
|
|
6
13
|
CLAWDBOT_LAUNCHD_LABEL: resolveNodeLaunchAgentLabel(),
|
|
7
14
|
CLAWDBOT_SYSTEMD_UNIT: resolveNodeSystemdServiceName(),
|
|
8
15
|
CLAWDBOT_WINDOWS_TASK_NAME: resolveNodeWindowsTaskName(),
|
|
@@ -18,6 +25,13 @@ function withNodeInstallEnv(args) {
|
|
|
18
25
|
env: withNodeServiceEnv(args.env),
|
|
19
26
|
environment: {
|
|
20
27
|
...args.environment,
|
|
28
|
+
POOLBOT_LAUNCHD_LABEL: resolveNodeLaunchAgentLabel(),
|
|
29
|
+
POOLBOT_SYSTEMD_UNIT: resolveNodeSystemdServiceName(),
|
|
30
|
+
POOLBOT_WINDOWS_TASK_NAME: resolveNodeWindowsTaskName(),
|
|
31
|
+
POOLBOT_TASK_SCRIPT_NAME: NODE_WINDOWS_TASK_SCRIPT_NAME,
|
|
32
|
+
POOLBOT_LOG_PREFIX: "node",
|
|
33
|
+
POOLBOT_SERVICE_MARKER: NODE_SERVICE_MARKER,
|
|
34
|
+
POOLBOT_SERVICE_KIND: NODE_SERVICE_KIND,
|
|
21
35
|
CLAWDBOT_LAUNCHD_LABEL: resolveNodeLaunchAgentLabel(),
|
|
22
36
|
CLAWDBOT_SYSTEMD_UNIT: resolveNodeSystemdServiceName(),
|
|
23
37
|
CLAWDBOT_WINDOWS_TASK_NAME: resolveNodeWindowsTaskName(),
|
package/dist/daemon/paths.js
CHANGED
|
@@ -24,12 +24,12 @@ export function resolveUserPathWithHome(input, home) {
|
|
|
24
24
|
return path.resolve(trimmed);
|
|
25
25
|
}
|
|
26
26
|
export function resolveGatewayStateDir(env) {
|
|
27
|
-
const override = env.CLAWDBOT_STATE_DIR?.trim();
|
|
27
|
+
const override = env.POOLBOT_STATE_DIR?.trim() || env.CLAWDBOT_STATE_DIR?.trim();
|
|
28
28
|
if (override) {
|
|
29
29
|
const home = override.startsWith("~") ? resolveHomeDir(env) : undefined;
|
|
30
30
|
return resolveUserPathWithHome(override, home);
|
|
31
31
|
}
|
|
32
32
|
const home = resolveHomeDir(env);
|
|
33
|
-
const suffix = resolveGatewayProfileSuffix(env.CLAWDBOT_PROFILE);
|
|
33
|
+
const suffix = resolveGatewayProfileSuffix(env.POOLBOT_PROFILE ?? env.CLAWDBOT_PROFILE);
|
|
34
34
|
return path.join(home, `.poolbot${suffix}`);
|
|
35
35
|
}
|
package/dist/daemon/schtasks.js
CHANGED
|
@@ -12,16 +12,16 @@ const formatLine = (label, value) => {
|
|
|
12
12
|
return `${colorize(rich, theme.muted, `${label}:`)} ${colorize(rich, theme.command, value)}`;
|
|
13
13
|
};
|
|
14
14
|
function resolveTaskName(env) {
|
|
15
|
-
const override = env.CLAWDBOT_WINDOWS_TASK_NAME?.trim();
|
|
15
|
+
const override = env.POOLBOT_WINDOWS_TASK_NAME?.trim() || env.CLAWDBOT_WINDOWS_TASK_NAME?.trim();
|
|
16
16
|
if (override)
|
|
17
17
|
return override;
|
|
18
|
-
return resolveGatewayWindowsTaskName(env.CLAWDBOT_PROFILE);
|
|
18
|
+
return resolveGatewayWindowsTaskName(env.POOLBOT_PROFILE ?? env.CLAWDBOT_PROFILE);
|
|
19
19
|
}
|
|
20
20
|
export function resolveTaskScriptPath(env) {
|
|
21
|
-
const override = env.CLAWDBOT_TASK_SCRIPT?.trim();
|
|
21
|
+
const override = env.POOLBOT_TASK_SCRIPT?.trim() || env.CLAWDBOT_TASK_SCRIPT?.trim();
|
|
22
22
|
if (override)
|
|
23
23
|
return override;
|
|
24
|
-
const scriptName = env.CLAWDBOT_TASK_SCRIPT_NAME?.trim() || "gateway.cmd";
|
|
24
|
+
const scriptName = env.POOLBOT_TASK_SCRIPT_NAME?.trim() || env.CLAWDBOT_TASK_SCRIPT_NAME?.trim() || "gateway.cmd";
|
|
25
25
|
const stateDir = resolveGatewayStateDir(env);
|
|
26
26
|
return path.join(stateDir, scriptName);
|
|
27
27
|
}
|
|
@@ -185,8 +185,11 @@ export async function installScheduledTask({ env, stdout, programArguments, work
|
|
|
185
185
|
await fs.mkdir(path.dirname(scriptPath), { recursive: true });
|
|
186
186
|
const taskDescription = description ??
|
|
187
187
|
formatGatewayServiceDescription({
|
|
188
|
-
profile: env.CLAWDBOT_PROFILE,
|
|
189
|
-
version: environment?.
|
|
188
|
+
profile: env.POOLBOT_PROFILE ?? env.CLAWDBOT_PROFILE,
|
|
189
|
+
version: environment?.POOLBOT_SERVICE_VERSION ??
|
|
190
|
+
environment?.CLAWDBOT_SERVICE_VERSION ??
|
|
191
|
+
env.POOLBOT_SERVICE_VERSION ??
|
|
192
|
+
env.CLAWDBOT_SERVICE_VERSION,
|
|
190
193
|
});
|
|
191
194
|
const script = buildTaskScript({
|
|
192
195
|
description: taskDescription,
|
|
@@ -90,22 +90,32 @@ export function buildMinimalServicePath(options = {}) {
|
|
|
90
90
|
}
|
|
91
91
|
export function buildServiceEnvironment(params) {
|
|
92
92
|
const { env, port, token, launchdLabel } = params;
|
|
93
|
-
const profile = env.CLAWDBOT_PROFILE;
|
|
93
|
+
const profile = env.POOLBOT_PROFILE ?? env.CLAWDBOT_PROFILE;
|
|
94
94
|
const resolvedLaunchdLabel = launchdLabel ||
|
|
95
95
|
(process.platform === "darwin" ? resolveGatewayLaunchAgentLabel(profile) : undefined);
|
|
96
96
|
const systemdUnit = `${resolveGatewaySystemdServiceName(profile)}.service`;
|
|
97
97
|
return {
|
|
98
98
|
HOME: env.HOME,
|
|
99
99
|
PATH: buildMinimalServicePath({ env }),
|
|
100
|
+
POOLBOT_PROFILE: profile,
|
|
100
101
|
CLAWDBOT_PROFILE: profile,
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
POOLBOT_STATE_DIR: env.POOLBOT_STATE_DIR ?? env.CLAWDBOT_STATE_DIR,
|
|
103
|
+
CLAWDBOT_STATE_DIR: env.POOLBOT_STATE_DIR ?? env.CLAWDBOT_STATE_DIR,
|
|
104
|
+
POOLBOT_CONFIG_PATH: env.POOLBOT_CONFIG_PATH ?? env.CLAWDBOT_CONFIG_PATH,
|
|
105
|
+
CLAWDBOT_CONFIG_PATH: env.POOLBOT_CONFIG_PATH ?? env.CLAWDBOT_CONFIG_PATH,
|
|
106
|
+
POOLBOT_GATEWAY_PORT: String(port),
|
|
103
107
|
CLAWDBOT_GATEWAY_PORT: String(port),
|
|
108
|
+
POOLBOT_GATEWAY_TOKEN: token,
|
|
104
109
|
CLAWDBOT_GATEWAY_TOKEN: token,
|
|
110
|
+
POOLBOT_LAUNCHD_LABEL: resolvedLaunchdLabel,
|
|
105
111
|
CLAWDBOT_LAUNCHD_LABEL: resolvedLaunchdLabel,
|
|
112
|
+
POOLBOT_SYSTEMD_UNIT: systemdUnit,
|
|
106
113
|
CLAWDBOT_SYSTEMD_UNIT: systemdUnit,
|
|
114
|
+
POOLBOT_SERVICE_MARKER: GATEWAY_SERVICE_MARKER,
|
|
107
115
|
CLAWDBOT_SERVICE_MARKER: GATEWAY_SERVICE_MARKER,
|
|
116
|
+
POOLBOT_SERVICE_KIND: GATEWAY_SERVICE_KIND,
|
|
108
117
|
CLAWDBOT_SERVICE_KIND: GATEWAY_SERVICE_KIND,
|
|
118
|
+
POOLBOT_SERVICE_VERSION: VERSION,
|
|
109
119
|
CLAWDBOT_SERVICE_VERSION: VERSION,
|
|
110
120
|
};
|
|
111
121
|
}
|
|
@@ -114,15 +124,25 @@ export function buildNodeServiceEnvironment(params) {
|
|
|
114
124
|
return {
|
|
115
125
|
HOME: env.HOME,
|
|
116
126
|
PATH: buildMinimalServicePath({ env }),
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
POOLBOT_STATE_DIR: env.POOLBOT_STATE_DIR ?? env.CLAWDBOT_STATE_DIR,
|
|
128
|
+
CLAWDBOT_STATE_DIR: env.POOLBOT_STATE_DIR ?? env.CLAWDBOT_STATE_DIR,
|
|
129
|
+
POOLBOT_CONFIG_PATH: env.POOLBOT_CONFIG_PATH ?? env.CLAWDBOT_CONFIG_PATH,
|
|
130
|
+
CLAWDBOT_CONFIG_PATH: env.POOLBOT_CONFIG_PATH ?? env.CLAWDBOT_CONFIG_PATH,
|
|
131
|
+
POOLBOT_LAUNCHD_LABEL: resolveNodeLaunchAgentLabel(),
|
|
119
132
|
CLAWDBOT_LAUNCHD_LABEL: resolveNodeLaunchAgentLabel(),
|
|
133
|
+
POOLBOT_SYSTEMD_UNIT: resolveNodeSystemdServiceName(),
|
|
120
134
|
CLAWDBOT_SYSTEMD_UNIT: resolveNodeSystemdServiceName(),
|
|
135
|
+
POOLBOT_WINDOWS_TASK_NAME: resolveNodeWindowsTaskName(),
|
|
121
136
|
CLAWDBOT_WINDOWS_TASK_NAME: resolveNodeWindowsTaskName(),
|
|
137
|
+
POOLBOT_TASK_SCRIPT_NAME: NODE_WINDOWS_TASK_SCRIPT_NAME,
|
|
122
138
|
CLAWDBOT_TASK_SCRIPT_NAME: NODE_WINDOWS_TASK_SCRIPT_NAME,
|
|
139
|
+
POOLBOT_LOG_PREFIX: "node",
|
|
123
140
|
CLAWDBOT_LOG_PREFIX: "node",
|
|
141
|
+
POOLBOT_SERVICE_MARKER: NODE_SERVICE_MARKER,
|
|
124
142
|
CLAWDBOT_SERVICE_MARKER: NODE_SERVICE_MARKER,
|
|
143
|
+
POOLBOT_SERVICE_KIND: NODE_SERVICE_KIND,
|
|
125
144
|
CLAWDBOT_SERVICE_KIND: NODE_SERVICE_KIND,
|
|
145
|
+
POOLBOT_SERVICE_VERSION: VERSION,
|
|
126
146
|
CLAWDBOT_SERVICE_VERSION: VERSION,
|
|
127
147
|
};
|
|
128
148
|
}
|
package/dist/daemon/systemd.js
CHANGED
|
@@ -19,11 +19,11 @@ function resolveSystemdUnitPathForName(env, name) {
|
|
|
19
19
|
return path.posix.join(home, ".config", "systemd", "user", `${name}.service`);
|
|
20
20
|
}
|
|
21
21
|
function resolveSystemdServiceName(env) {
|
|
22
|
-
const override = env.CLAWDBOT_SYSTEMD_UNIT?.trim();
|
|
22
|
+
const override = env.POOLBOT_SYSTEMD_UNIT?.trim() || env.CLAWDBOT_SYSTEMD_UNIT?.trim();
|
|
23
23
|
if (override) {
|
|
24
24
|
return override.endsWith(".service") ? override.slice(0, -".service".length) : override;
|
|
25
25
|
}
|
|
26
|
-
return resolveGatewaySystemdServiceName(env.CLAWDBOT_PROFILE);
|
|
26
|
+
return resolveGatewaySystemdServiceName(env.POOLBOT_PROFILE ?? env.CLAWDBOT_PROFILE);
|
|
27
27
|
}
|
|
28
28
|
function resolveSystemdUnitPath(env) {
|
|
29
29
|
return resolveSystemdUnitPathForName(env, resolveSystemdServiceName(env));
|
|
@@ -152,8 +152,11 @@ export async function installSystemdService({ env, stdout, programArguments, wor
|
|
|
152
152
|
await fs.mkdir(path.dirname(unitPath), { recursive: true });
|
|
153
153
|
const serviceDescription = description ??
|
|
154
154
|
formatGatewayServiceDescription({
|
|
155
|
-
profile: env.CLAWDBOT_PROFILE,
|
|
156
|
-
version: environment?.
|
|
155
|
+
profile: env.POOLBOT_PROFILE ?? env.CLAWDBOT_PROFILE,
|
|
156
|
+
version: environment?.POOLBOT_SERVICE_VERSION ??
|
|
157
|
+
environment?.CLAWDBOT_SERVICE_VERSION ??
|
|
158
|
+
env.POOLBOT_SERVICE_VERSION ??
|
|
159
|
+
env.CLAWDBOT_SERVICE_VERSION,
|
|
157
160
|
});
|
|
158
161
|
const unit = buildSystemdUnit({
|
|
159
162
|
description: serviceDescription,
|
|
@@ -162,7 +165,7 @@ export async function installSystemdService({ env, stdout, programArguments, wor
|
|
|
162
165
|
environment,
|
|
163
166
|
});
|
|
164
167
|
await fs.writeFile(unitPath, unit, "utf8");
|
|
165
|
-
const serviceName = resolveGatewaySystemdServiceName(env.CLAWDBOT_PROFILE);
|
|
168
|
+
const serviceName = resolveGatewaySystemdServiceName(env.POOLBOT_PROFILE ?? env.CLAWDBOT_PROFILE);
|
|
166
169
|
const unitName = `${serviceName}.service`;
|
|
167
170
|
const reload = await execSystemctl(["--user", "daemon-reload"]);
|
|
168
171
|
if (reload.code !== 0) {
|
|
@@ -183,7 +186,7 @@ export async function installSystemdService({ env, stdout, programArguments, wor
|
|
|
183
186
|
}
|
|
184
187
|
export async function uninstallSystemdService({ env, stdout, }) {
|
|
185
188
|
await assertSystemdAvailable();
|
|
186
|
-
const serviceName = resolveGatewaySystemdServiceName(env.CLAWDBOT_PROFILE);
|
|
189
|
+
const serviceName = resolveGatewaySystemdServiceName(env.POOLBOT_PROFILE ?? env.CLAWDBOT_PROFILE);
|
|
187
190
|
const unitName = `${serviceName}.service`;
|
|
188
191
|
await execSystemctl(["--user", "disable", "--now", unitName]);
|
|
189
192
|
const unitPath = resolveSystemdUnitPath(env);
|