@spark-strategic/helix-core 0.1.4 → 0.1.5
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/autostart.d.ts +28 -0
- package/dist/autostart.d.ts.map +1 -0
- package/dist/autostart.js +241 -0
- package/dist/autostart.js.map +1 -0
- package/dist/cli.js +47 -0
- package/dist/cli.js.map +1 -1
- package/dist/update.d.ts +32 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +119 -0
- package/dist/update.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `helix-core autostart install|uninstall|status` — make the connector daemon
|
|
3
|
+
* come up at machine boot, before any interactive login, so the agent is online
|
|
4
|
+
* even when nobody is logged in.
|
|
5
|
+
*
|
|
6
|
+
* The boot launcher just runs `helix-core start`, so it reuses the exact same
|
|
7
|
+
* detached-daemon + pidfile machinery as a manual start. That's deliberate: the
|
|
8
|
+
* boot-started daemon is then indistinguishable from a hand-started one, so
|
|
9
|
+
* `helix-core status | restart | stop` all operate on it normally.
|
|
10
|
+
*
|
|
11
|
+
* Platform strategy:
|
|
12
|
+
* Windows — a Scheduled Task with an `AtStartup` trigger, registered with
|
|
13
|
+
* LogonType **S4U** (service-for-user). S4U runs the task AS THE INSTALLING
|
|
14
|
+
* USER without storing a password and without requiring an interactive
|
|
15
|
+
* session, so: (a) it fires at boot before login, and (b) it runs under the
|
|
16
|
+
* user's identity — `os.homedir()` still resolves to the user's profile
|
|
17
|
+
* (same `~/.helix`), and the user can `stop`/`restart` it without elevation.
|
|
18
|
+
* Registering an AtStartup/S4U task requires an ELEVATED shell; we detect the
|
|
19
|
+
* access-denied case and say so.
|
|
20
|
+
* macOS / Linux — printed, copy-pasteable launchd / systemd instructions
|
|
21
|
+
* rather than a half-working auto-writer, since both need root or per-distro
|
|
22
|
+
* specifics to run truly pre-login.
|
|
23
|
+
*/
|
|
24
|
+
import type { DaemonFlags } from './daemon';
|
|
25
|
+
export type AutostartAction = 'install' | 'uninstall' | 'status';
|
|
26
|
+
/** `helix-core autostart <action>` handler. */
|
|
27
|
+
export declare function runAutostart(action: AutostartAction, flags: DaemonFlags): void;
|
|
28
|
+
//# sourceMappingURL=autostart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autostart.d.ts","sourceRoot":"","sources":["../src/autostart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAMH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AAgLjE,+CAA+C;AAC/C,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAO9E"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `helix-core autostart install|uninstall|status` — make the connector daemon
|
|
4
|
+
* come up at machine boot, before any interactive login, so the agent is online
|
|
5
|
+
* even when nobody is logged in.
|
|
6
|
+
*
|
|
7
|
+
* The boot launcher just runs `helix-core start`, so it reuses the exact same
|
|
8
|
+
* detached-daemon + pidfile machinery as a manual start. That's deliberate: the
|
|
9
|
+
* boot-started daemon is then indistinguishable from a hand-started one, so
|
|
10
|
+
* `helix-core status | restart | stop` all operate on it normally.
|
|
11
|
+
*
|
|
12
|
+
* Platform strategy:
|
|
13
|
+
* Windows — a Scheduled Task with an `AtStartup` trigger, registered with
|
|
14
|
+
* LogonType **S4U** (service-for-user). S4U runs the task AS THE INSTALLING
|
|
15
|
+
* USER without storing a password and without requiring an interactive
|
|
16
|
+
* session, so: (a) it fires at boot before login, and (b) it runs under the
|
|
17
|
+
* user's identity — `os.homedir()` still resolves to the user's profile
|
|
18
|
+
* (same `~/.helix`), and the user can `stop`/`restart` it without elevation.
|
|
19
|
+
* Registering an AtStartup/S4U task requires an ELEVATED shell; we detect the
|
|
20
|
+
* access-denied case and say so.
|
|
21
|
+
* macOS / Linux — printed, copy-pasteable launchd / systemd instructions
|
|
22
|
+
* rather than a half-working auto-writer, since both need root or per-distro
|
|
23
|
+
* specifics to run truly pre-login.
|
|
24
|
+
*/
|
|
25
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
26
|
+
if (k2 === undefined) k2 = k;
|
|
27
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
28
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
29
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
30
|
+
}
|
|
31
|
+
Object.defineProperty(o, k2, desc);
|
|
32
|
+
}) : (function(o, m, k, k2) {
|
|
33
|
+
if (k2 === undefined) k2 = k;
|
|
34
|
+
o[k2] = m[k];
|
|
35
|
+
}));
|
|
36
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
37
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
38
|
+
}) : function(o, v) {
|
|
39
|
+
o["default"] = v;
|
|
40
|
+
});
|
|
41
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
42
|
+
var ownKeys = function(o) {
|
|
43
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
44
|
+
var ar = [];
|
|
45
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
46
|
+
return ar;
|
|
47
|
+
};
|
|
48
|
+
return ownKeys(o);
|
|
49
|
+
};
|
|
50
|
+
return function (mod) {
|
|
51
|
+
if (mod && mod.__esModule) return mod;
|
|
52
|
+
var result = {};
|
|
53
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
54
|
+
__setModuleDefault(result, mod);
|
|
55
|
+
return result;
|
|
56
|
+
};
|
|
57
|
+
})();
|
|
58
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
exports.runAutostart = runAutostart;
|
|
60
|
+
const child_process_1 = require("child_process");
|
|
61
|
+
const fs = __importStar(require("fs"));
|
|
62
|
+
const os = __importStar(require("os"));
|
|
63
|
+
const path = __importStar(require("path"));
|
|
64
|
+
const TASK_NAME = 'HelixCoreConnector';
|
|
65
|
+
/** Absolute path to this CLI's entrypoint, so the boot task re-invokes the same
|
|
66
|
+
* installed build regardless of what's on PATH at boot. */
|
|
67
|
+
function cliEntrypoint() {
|
|
68
|
+
return process.argv[1];
|
|
69
|
+
}
|
|
70
|
+
/** Build the `start` argument list the boot launcher runs. Mirrors what the
|
|
71
|
+
* daemon forwards, so a boot-started connector matches a manual one. */
|
|
72
|
+
function startArgs(flags) {
|
|
73
|
+
const args = ['start', '--adapter', flags.adapter?.trim() || 'openclaw'];
|
|
74
|
+
if (flags.agent?.trim())
|
|
75
|
+
args.push('--agent', flags.agent.trim());
|
|
76
|
+
if (flags.url?.trim())
|
|
77
|
+
args.push('--url', flags.url.trim());
|
|
78
|
+
return args;
|
|
79
|
+
}
|
|
80
|
+
/** Run a PowerShell script (written to a temp .ps1 to avoid inline-quoting hell)
|
|
81
|
+
* and return its result. */
|
|
82
|
+
function runPowerShell(script) {
|
|
83
|
+
const file = path.join(os.tmpdir(), `helix-core-autostart-${process.pid}.ps1`);
|
|
84
|
+
fs.writeFileSync(file, script, 'utf-8');
|
|
85
|
+
try {
|
|
86
|
+
const res = (0, child_process_1.spawnSync)('powershell', ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', file], { encoding: 'utf-8' });
|
|
87
|
+
if (res.error)
|
|
88
|
+
return { ok: false, stdout: '', stderr: String(res.error.message ?? res.error) };
|
|
89
|
+
return { ok: res.status === 0, stdout: (res.stdout ?? '').trim(), stderr: (res.stderr ?? '').trim() };
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
try {
|
|
93
|
+
fs.unlinkSync(file);
|
|
94
|
+
}
|
|
95
|
+
catch { /* best effort */ }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/** Escape a string for embedding inside a PowerShell single-quoted literal. */
|
|
99
|
+
function psSingleQuote(s) {
|
|
100
|
+
return s.replace(/'/g, "''");
|
|
101
|
+
}
|
|
102
|
+
function installWindows(flags) {
|
|
103
|
+
const log = (m) => console.log(`[helix-core] ${m}`);
|
|
104
|
+
const node = process.execPath;
|
|
105
|
+
const cli = cliEntrypoint();
|
|
106
|
+
// The task action runs: "<node>" "<cli>" start --adapter openclaw ...
|
|
107
|
+
// Paths are wrapped in double quotes (literal inside the PS single-quoted
|
|
108
|
+
// -Argument string) so spaces in the profile path don't split the args.
|
|
109
|
+
const argument = `"${cli}" ${startArgs(flags).join(' ')}`;
|
|
110
|
+
const script = `
|
|
111
|
+
$ErrorActionPreference = 'Stop'
|
|
112
|
+
$action = New-ScheduledTaskAction -Execute '${psSingleQuote(node)}' -Argument '${psSingleQuote(argument)}'
|
|
113
|
+
$trigger = New-ScheduledTaskTrigger -AtStartup
|
|
114
|
+
$principal = New-ScheduledTaskPrincipal -UserId "$env:USERDOMAIN\\$env:USERNAME" -LogonType S4U -RunLevel Limited
|
|
115
|
+
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -StartWhenAvailable
|
|
116
|
+
Register-ScheduledTask -TaskName '${TASK_NAME}' -Action $action -Trigger $trigger -Principal $principal -Settings $settings -Force -Description 'Helix Core personal-agent connector — auto-start at boot.' | Out-Null
|
|
117
|
+
Write-Output 'registered'
|
|
118
|
+
`;
|
|
119
|
+
const res = runPowerShell(script);
|
|
120
|
+
if (res.ok) {
|
|
121
|
+
log(`installed boot auto-start (Scheduled Task "${TASK_NAME}").`);
|
|
122
|
+
log('the connector will start at every boot, before login, running as you.');
|
|
123
|
+
log('note: it only produces replies while the OpenClaw gateway is also running — make sure OpenClaw itself auto-starts too.');
|
|
124
|
+
log(`remove it later with: helix-core autostart uninstall`);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const denied = /access is denied|denied|elevat|administrat/i.test(`${res.stderr} ${res.stdout}`);
|
|
128
|
+
if (denied) {
|
|
129
|
+
throw new Error('registering a boot task requires an elevated terminal. Re-run in an Administrator PowerShell/Command Prompt:\n' +
|
|
130
|
+
' helix-core autostart install');
|
|
131
|
+
}
|
|
132
|
+
throw new Error(`failed to register the boot task: ${res.stderr || res.stdout || 'unknown error'}`);
|
|
133
|
+
}
|
|
134
|
+
function uninstallWindows() {
|
|
135
|
+
const log = (m) => console.log(`[helix-core] ${m}`);
|
|
136
|
+
const res = runPowerShell(`$ErrorActionPreference='SilentlyContinue'
|
|
137
|
+
if (Get-ScheduledTask -TaskName '${TASK_NAME}' -ErrorAction SilentlyContinue) {
|
|
138
|
+
Unregister-ScheduledTask -TaskName '${TASK_NAME}' -Confirm:$false
|
|
139
|
+
Write-Output 'removed'
|
|
140
|
+
} else { Write-Output 'absent' }`);
|
|
141
|
+
if (res.stdout.includes('absent')) {
|
|
142
|
+
log('no boot auto-start was installed.');
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (res.ok || res.stdout.includes('removed')) {
|
|
146
|
+
log(`removed boot auto-start (Scheduled Task "${TASK_NAME}").`);
|
|
147
|
+
log('the currently running connector is left untouched — use `helix-core stop` to end it now.');
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const denied = /access is denied|denied|elevat|administrat/i.test(`${res.stderr} ${res.stdout}`);
|
|
151
|
+
if (denied) {
|
|
152
|
+
throw new Error('removing the boot task requires an elevated terminal. Re-run in an Administrator shell:\n helix-core autostart uninstall');
|
|
153
|
+
}
|
|
154
|
+
throw new Error(`failed to remove the boot task: ${res.stderr || res.stdout || 'unknown error'}`);
|
|
155
|
+
}
|
|
156
|
+
function statusWindows() {
|
|
157
|
+
const log = (m) => console.log(`[helix-core] ${m}`);
|
|
158
|
+
const res = runPowerShell(`$t = Get-ScheduledTask -TaskName '${TASK_NAME}' -ErrorAction SilentlyContinue
|
|
159
|
+
if ($t) { Write-Output ("installed:" + $t.State) } else { Write-Output 'absent' }`);
|
|
160
|
+
if (res.stdout.startsWith('installed')) {
|
|
161
|
+
const state = res.stdout.split(':')[1] || 'unknown';
|
|
162
|
+
log(`boot auto-start is INSTALLED (Scheduled Task "${TASK_NAME}", state: ${state}).`);
|
|
163
|
+
log('this only controls launch-at-boot; use `helix-core status` to see if the connector is running right now.');
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
log('boot auto-start is NOT installed. Install it with: helix-core autostart install');
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/** Print copy-pasteable manual setup for non-Windows hosts. */
|
|
170
|
+
function printUnixInstructions(action, flags) {
|
|
171
|
+
const log = (m) => console.log(`[helix-core] ${m}`);
|
|
172
|
+
const node = process.execPath;
|
|
173
|
+
const cli = cliEntrypoint();
|
|
174
|
+
const cmd = `${node} ${cli} ${startArgs(flags).join(' ')}`;
|
|
175
|
+
if (action === 'uninstall') {
|
|
176
|
+
log('to remove a boot auto-start you set up manually:');
|
|
177
|
+
if (process.platform === 'darwin') {
|
|
178
|
+
console.log(' sudo launchctl bootout system /Library/LaunchDaemons/ai.spark-strategic.helix-core.plist');
|
|
179
|
+
console.log(' sudo rm /Library/LaunchDaemons/ai.spark-strategic.helix-core.plist');
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
console.log(' sudo systemctl disable --now helix-core.service');
|
|
183
|
+
console.log(' sudo rm /etc/systemd/system/helix-core.service');
|
|
184
|
+
}
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (action === 'status') {
|
|
188
|
+
log('check your manually-installed boot service:');
|
|
189
|
+
console.log(process.platform === 'darwin'
|
|
190
|
+
? ' sudo launchctl print system/ai.spark-strategic.helix-core'
|
|
191
|
+
: ' systemctl status helix-core.service');
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
log(`automated boot install isn't wired for ${process.platform} yet — here's a ready-to-use unit.`);
|
|
195
|
+
if (process.platform === 'darwin') {
|
|
196
|
+
console.log('Save as /Library/LaunchDaemons/ai.spark-strategic.helix-core.plist (runs at boot, before login):\n');
|
|
197
|
+
console.log(`<?xml version="1.0" encoding="UTF-8"?>
|
|
198
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
199
|
+
<plist version="1.0"><dict>
|
|
200
|
+
<key>Label</key><string>ai.spark-strategic.helix-core</string>
|
|
201
|
+
<key>ProgramArguments</key><array>
|
|
202
|
+
<string>${node}</string><string>${cli}</string>${startArgs(flags).map((a) => `<string>${a}</string>`).join('')}
|
|
203
|
+
</array>
|
|
204
|
+
<key>RunAtLoad</key><true/>
|
|
205
|
+
<key>KeepAlive</key><true/>
|
|
206
|
+
<key>UserName</key><string>${os.userInfo().username}</string>
|
|
207
|
+
</dict></plist>`);
|
|
208
|
+
console.log('\nThen: sudo launchctl bootstrap system /Library/LaunchDaemons/ai.spark-strategic.helix-core.plist');
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
console.log('Save as /etc/systemd/system/helix-core.service (runs at boot, before login):\n');
|
|
212
|
+
console.log(`[Unit]
|
|
213
|
+
Description=Helix Core personal-agent connector
|
|
214
|
+
After=network-online.target
|
|
215
|
+
Wants=network-online.target
|
|
216
|
+
|
|
217
|
+
[Service]
|
|
218
|
+
Type=forking
|
|
219
|
+
User=${os.userInfo().username}
|
|
220
|
+
ExecStart=${cmd}
|
|
221
|
+
ExecStop=${node} ${cli} stop
|
|
222
|
+
Restart=on-failure
|
|
223
|
+
|
|
224
|
+
[Install]
|
|
225
|
+
WantedBy=multi-user.target`);
|
|
226
|
+
console.log('\nThen: sudo systemctl daemon-reload && sudo systemctl enable --now helix-core.service');
|
|
227
|
+
}
|
|
228
|
+
log('note: the connector only produces replies while the OpenClaw gateway is also running — ensure OpenClaw auto-starts too.');
|
|
229
|
+
}
|
|
230
|
+
/** `helix-core autostart <action>` handler. */
|
|
231
|
+
function runAutostart(action, flags) {
|
|
232
|
+
if (process.platform === 'win32') {
|
|
233
|
+
if (action === 'install')
|
|
234
|
+
return installWindows(flags);
|
|
235
|
+
if (action === 'uninstall')
|
|
236
|
+
return uninstallWindows();
|
|
237
|
+
return statusWindows();
|
|
238
|
+
}
|
|
239
|
+
printUnixInstructions(action, flags);
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=autostart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autostart.js","sourceRoot":"","sources":["../src/autostart.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2LH,oCAOC;AAhMD,iDAA0C;AAC1C,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAG7B,MAAM,SAAS,GAAG,oBAAoB,CAAC;AAIvC;4DAC4D;AAC5D,SAAS,aAAa;IACpB,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACzB,CAAC;AAED;yEACyE;AACzE,SAAS,SAAS,CAAC,KAAkB;IACnC,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,UAAU,CAAC,CAAC;IACzE,IAAI,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE;QAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAClE,IAAI,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE;QAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5D,OAAO,IAAI,CAAC;AACd,CAAC;AAED;6BAC6B;AAC7B,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OAAO,CAAC,GAAG,CAAC;;;;;cAKF,IAAI,oBAAoB,GAAG,YAAY,SAAS,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;;;;+BAInF,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ;gBACrC,CAAC,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,oGAAoG,CAAC,CAAC;IACpH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,gFAAgF,CAAC,CAAC;QAC9F,OAAO,CAAC,GAAG,CAAC;;;;;;;OAOT,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ;YACjB,GAAG;WACJ,IAAI,IAAI,GAAG;;;;2BAIK,CAAC,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,wFAAwF,CAAC,CAAC;IACxG,CAAC;IACD,GAAG,CAAC,yHAAyH,CAAC,CAAC;AACjI,CAAC;AAED,+CAA+C;AAC/C,SAAgB,YAAY,CAAC,MAAuB,EAAE,KAAkB;IACtE,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;QACvD,IAAI,MAAM,KAAK,WAAW;YAAE,OAAO,gBAAgB,EAAE,CAAC;QACtD,OAAO,aAAa,EAAE,CAAC;IACzB,CAAC;IACD,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACvC,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -14,6 +14,8 @@ const adapter_1 = require("./adapter");
|
|
|
14
14
|
const openclaw_adapter_1 = require("./openclaw-adapter");
|
|
15
15
|
const init_1 = require("./init");
|
|
16
16
|
const daemon_1 = require("./daemon");
|
|
17
|
+
const update_1 = require("./update");
|
|
18
|
+
const autostart_1 = require("./autostart");
|
|
17
19
|
const version_1 = require("./version");
|
|
18
20
|
/** Minimal flag parser: `--key value`, `--key=value`, and boolean `--flag`. */
|
|
19
21
|
function parseArgs(argv) {
|
|
@@ -107,6 +109,12 @@ Daemon commands:
|
|
|
107
109
|
helix-core restart Restart the background connector
|
|
108
110
|
helix-core status Show whether the connector is running
|
|
109
111
|
|
|
112
|
+
Keeping it online:
|
|
113
|
+
helix-core autostart install Start the connector at boot, before login (survives logout/reboot)
|
|
114
|
+
helix-core autostart uninstall Remove the boot auto-start
|
|
115
|
+
helix-core autostart status Show whether boot auto-start is installed
|
|
116
|
+
helix-core update Update to the latest published version and relaunch the connector
|
|
117
|
+
|
|
110
118
|
Other commands:
|
|
111
119
|
helix-core connect Run the connector in the FOREGROUND (attached; for debugging)
|
|
112
120
|
helix-core version Print package + protocol version
|
|
@@ -119,6 +127,18 @@ Options (init openclaw):
|
|
|
119
127
|
--no-connect Configure only; don't start the background daemon
|
|
120
128
|
--foreground After setup, attach in the foreground instead of daemonizing
|
|
121
129
|
--agent <id> OpenClaw agent id to route turns to (default: main)
|
|
130
|
+
|
|
131
|
+
Options (update):
|
|
132
|
+
--yes, -y Skip the confirmation prompt
|
|
133
|
+
--tag <tag> Install a specific dist-tag or version (default: latest)
|
|
134
|
+
|
|
135
|
+
Options (autostart install):
|
|
136
|
+
--agent <id> OpenClaw agent id the boot-started connector routes to (default: main)
|
|
137
|
+
|
|
138
|
+
Note: on Windows, "autostart install/uninstall" must be run in an elevated
|
|
139
|
+
(Administrator) terminal. On macOS/Linux it prints a ready-to-use launchd/systemd
|
|
140
|
+
unit. The connector only replies while the OpenClaw gateway is also running, so
|
|
141
|
+
make sure OpenClaw itself starts at boot too.
|
|
122
142
|
`;
|
|
123
143
|
function main() {
|
|
124
144
|
const { command, flags } = parseArgs(process.argv.slice(2));
|
|
@@ -170,6 +190,33 @@ function main() {
|
|
|
170
190
|
}
|
|
171
191
|
break;
|
|
172
192
|
}
|
|
193
|
+
case 'update':
|
|
194
|
+
(0, update_1.runUpdate)({
|
|
195
|
+
yes: flags.yes === true || flags.y === true,
|
|
196
|
+
tag: typeof flags.tag === 'string' ? flags.tag : undefined,
|
|
197
|
+
daemon: daemonFlagsFrom(flags),
|
|
198
|
+
}).catch((err) => {
|
|
199
|
+
console.error(`[helix-core] ${err instanceof Error ? err.message : String(err)}`);
|
|
200
|
+
process.exit(1);
|
|
201
|
+
});
|
|
202
|
+
break;
|
|
203
|
+
case 'autostart': {
|
|
204
|
+
// `autostart <action>` — action is the first positional after the command.
|
|
205
|
+
const action = process.argv.slice(3).find((a) => !a.startsWith('-'));
|
|
206
|
+
if (action !== 'install' && action !== 'uninstall' && action !== 'status') {
|
|
207
|
+
console.error(`[helix-core] unknown autostart action "${action ?? ''}" — supported: install, uninstall, status\n`);
|
|
208
|
+
console.log(HELP);
|
|
209
|
+
process.exit(1);
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
(0, autostart_1.runAutostart)(action, daemonFlagsFrom(flags));
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
console.error(`[helix-core] ${err instanceof Error ? err.message : String(err)}`);
|
|
216
|
+
process.exit(1);
|
|
217
|
+
}
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
173
220
|
case 'init': {
|
|
174
221
|
// `init <target>` — target is the first positional after the command.
|
|
175
222
|
const target = process.argv.slice(3).find((a) => !a.startsWith('-'));
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AACA;;;;;;GAMG;;AAEH,qCAA+D;AAC/D,2CAAwC;AACxC,uCAA2D;AAC3D,yDAAqD;AACrD,iCAAyC;AACzC,qCAA6F;AAC7F,uCAA0D;AAO1D,+EAA+E;AAC/E,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,CAAC,OAAO,GAAG,SAAS,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAC5C,MAAM,K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C,CAAC,SAAS;aAC3D,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACf,OAAO,CAAC,KAAK,CAAC,gBAAgB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAClF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;YACH,MAAM;QACR,CAAC;QACD;YACE,OAAO,CAAC,KAAK,CAAC,iCAAiC,OAAO,KAAK,CAAC,CAAC;YAC7D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
|
package/dist/update.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `helix-core update` — pull the latest published package and relaunch the
|
|
3
|
+
* running connector on the new build.
|
|
4
|
+
*
|
|
5
|
+
* This is a thin wrapper over `npm install -g <pkg>@<tag>`; the value it adds is
|
|
6
|
+
* being honest about the side effect. Updating the global package replaces the
|
|
7
|
+
* on-disk `dist/` out from under any RUNNING connector daemon, but a live daemon
|
|
8
|
+
* keeps executing the OLD code it already loaded into memory — so the new build
|
|
9
|
+
* isn't actually live until the daemon is restarted. We therefore:
|
|
10
|
+
*
|
|
11
|
+
* 1. warn that the connector (this agent) will briefly go offline for the
|
|
12
|
+
* restart, and confirm before touching anything,
|
|
13
|
+
* 2. run the global install,
|
|
14
|
+
* 3. restart the daemon IFF one was running, so the new build goes live.
|
|
15
|
+
*
|
|
16
|
+
* The OpenClaw gateway itself is never restarted by an update — only the thin
|
|
17
|
+
* connector daemon is. (The one path that bounces the gateway is re-running
|
|
18
|
+
* `init openclaw`, which this command deliberately does not do.)
|
|
19
|
+
*/
|
|
20
|
+
import { type DaemonFlags } from './daemon';
|
|
21
|
+
export interface UpdateFlags {
|
|
22
|
+
/** Skip the confirmation prompt (non-interactive). */
|
|
23
|
+
yes?: boolean;
|
|
24
|
+
/** dist-tag or version to install (default: latest). */
|
|
25
|
+
tag?: string;
|
|
26
|
+
/** Forwarded to the daemon restart so the relaunched connector keeps its
|
|
27
|
+
* adapter/agent/url wiring. */
|
|
28
|
+
daemon?: DaemonFlags;
|
|
29
|
+
}
|
|
30
|
+
/** `helix-core update` handler. */
|
|
31
|
+
export declare function runUpdate(flags: UpdateFlags): Promise<void>;
|
|
32
|
+
//# sourceMappingURL=update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAA+B,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAGzE,MAAM,WAAW,WAAW;IAC1B,sDAAsD;IACtD,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,wDAAwD;IACxD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;oCACgC;IAChC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAuBD,mCAAmC;AACnC,wBAAsB,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA0CjE"}
|
package/dist/update.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `helix-core update` — pull the latest published package and relaunch the
|
|
4
|
+
* running connector on the new build.
|
|
5
|
+
*
|
|
6
|
+
* This is a thin wrapper over `npm install -g <pkg>@<tag>`; the value it adds is
|
|
7
|
+
* being honest about the side effect. Updating the global package replaces the
|
|
8
|
+
* on-disk `dist/` out from under any RUNNING connector daemon, but a live daemon
|
|
9
|
+
* keeps executing the OLD code it already loaded into memory — so the new build
|
|
10
|
+
* isn't actually live until the daemon is restarted. We therefore:
|
|
11
|
+
*
|
|
12
|
+
* 1. warn that the connector (this agent) will briefly go offline for the
|
|
13
|
+
* restart, and confirm before touching anything,
|
|
14
|
+
* 2. run the global install,
|
|
15
|
+
* 3. restart the daemon IFF one was running, so the new build goes live.
|
|
16
|
+
*
|
|
17
|
+
* The OpenClaw gateway itself is never restarted by an update — only the thin
|
|
18
|
+
* connector daemon is. (The one path that bounces the gateway is re-running
|
|
19
|
+
* `init openclaw`, which this command deliberately does not do.)
|
|
20
|
+
*/
|
|
21
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
24
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
25
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
26
|
+
}
|
|
27
|
+
Object.defineProperty(o, k2, desc);
|
|
28
|
+
}) : (function(o, m, k, k2) {
|
|
29
|
+
if (k2 === undefined) k2 = k;
|
|
30
|
+
o[k2] = m[k];
|
|
31
|
+
}));
|
|
32
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
33
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
34
|
+
}) : function(o, v) {
|
|
35
|
+
o["default"] = v;
|
|
36
|
+
});
|
|
37
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
38
|
+
var ownKeys = function(o) {
|
|
39
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
40
|
+
var ar = [];
|
|
41
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
42
|
+
return ar;
|
|
43
|
+
};
|
|
44
|
+
return ownKeys(o);
|
|
45
|
+
};
|
|
46
|
+
return function (mod) {
|
|
47
|
+
if (mod && mod.__esModule) return mod;
|
|
48
|
+
var result = {};
|
|
49
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
50
|
+
__setModuleDefault(result, mod);
|
|
51
|
+
return result;
|
|
52
|
+
};
|
|
53
|
+
})();
|
|
54
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
+
exports.runUpdate = runUpdate;
|
|
56
|
+
const child_process_1 = require("child_process");
|
|
57
|
+
const readline = __importStar(require("readline"));
|
|
58
|
+
const daemon_1 = require("./daemon");
|
|
59
|
+
const version_1 = require("./version");
|
|
60
|
+
/** Ask a yes/no question on the TTY. No TTY (piped/CI) → false; pass --yes. */
|
|
61
|
+
function confirm(question) {
|
|
62
|
+
if (!process.stdin.isTTY)
|
|
63
|
+
return Promise.resolve(false);
|
|
64
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
65
|
+
return new Promise((resolve) => {
|
|
66
|
+
rl.question(`${question} [y/N] `, (answer) => {
|
|
67
|
+
rl.close();
|
|
68
|
+
resolve(/^y(es)?$/i.test(answer.trim()));
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/** Run `npm install -g <pkg>@<tag>`, streaming npm's own output to the console
|
|
73
|
+
* so the operator sees the real progress/errors. Returns whether it succeeded. */
|
|
74
|
+
function npmInstallGlobal(spec) {
|
|
75
|
+
// shell:true so Windows resolves `npm.cmd`; the spec is built from our own
|
|
76
|
+
// package name + a validated tag, never raw user input.
|
|
77
|
+
const res = (0, child_process_1.spawnSync)(`npm install -g ${spec}`, { stdio: 'inherit', shell: true });
|
|
78
|
+
return res.status === 0;
|
|
79
|
+
}
|
|
80
|
+
/** `helix-core update` handler. */
|
|
81
|
+
async function runUpdate(flags) {
|
|
82
|
+
const log = (m) => console.log(`[helix-core] ${m}`);
|
|
83
|
+
const info = (0, version_1.packageInfo)();
|
|
84
|
+
// Only allow a simple tag/version token — this ends up in a shell command.
|
|
85
|
+
const rawTag = flags.tag?.trim() || 'latest';
|
|
86
|
+
if (!/^[a-zA-Z0-9.\-^~*]+$/.test(rawTag)) {
|
|
87
|
+
throw new Error(`invalid --tag "${rawTag}". Use a dist-tag (e.g. latest) or a version (e.g. 0.1.4).`);
|
|
88
|
+
}
|
|
89
|
+
const spec = `${info.name}@${rawTag}`;
|
|
90
|
+
const running = (0, daemon_1.daemonStatus)().running;
|
|
91
|
+
log(`current version: ${info.version}. Updating to ${spec}.`);
|
|
92
|
+
if (running) {
|
|
93
|
+
log('the background connector is running; it will be restarted after the update, so this agent will briefly go offline.');
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
log('no background connector is running, so nothing goes offline. Start it afterwards with: helix-core start');
|
|
97
|
+
}
|
|
98
|
+
log('this does NOT restart the OpenClaw gateway (only re-run `init openclaw` does that).');
|
|
99
|
+
const proceed = flags.yes || (await confirm(`Install ${spec}${running ? ' and restart the connector' : ''}?`));
|
|
100
|
+
if (!proceed) {
|
|
101
|
+
log('update cancelled — nothing changed.');
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
log(`installing ${spec}…`);
|
|
105
|
+
if (!npmInstallGlobal(spec)) {
|
|
106
|
+
throw new Error(`npm failed to install ${spec}. If it was a permissions error, re-run in a terminal with the right privileges ` +
|
|
107
|
+
'(elevated on Windows, or `sudo` on macOS/Linux), then run `helix-core restart`.');
|
|
108
|
+
}
|
|
109
|
+
log('package updated.');
|
|
110
|
+
if (running) {
|
|
111
|
+
log('restarting the connector to load the new build…');
|
|
112
|
+
await (0, daemon_1.restartDaemon)(flags.daemon ?? {});
|
|
113
|
+
log('done — the agent is back online on the new version.');
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
log('done. Bring the agent online with: helix-core start');
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;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CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;QACxC,GAAG,CAAC,qDAAqD,CAAC,CAAC;IAC7D,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,qDAAqD,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spark-strategic/helix-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Helix Core — the minimal local runtime you run to connect a personal agent to Helix. Other tools (MCP, etc.) ship as their own packages that Core runs.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|