@kl-c/matrixos 0.3.26 → 0.3.27
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/cli/index.js +238 -1
- package/dist/cli/service.d.ts +6 -0
- package/dist/cli-node/index.js +238 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2163,7 +2163,7 @@ var package_default;
|
|
|
2163
2163
|
var init_package = __esm(() => {
|
|
2164
2164
|
package_default = {
|
|
2165
2165
|
name: "@kl-c/matrixos",
|
|
2166
|
-
version: "0.3.
|
|
2166
|
+
version: "0.3.27",
|
|
2167
2167
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
2168
2168
|
main: "./dist/index.js",
|
|
2169
2169
|
types: "dist/index.d.ts",
|
|
@@ -167053,6 +167053,226 @@ function executeRgpdConsentCommand(args) {
|
|
|
167053
167053
|
}
|
|
167054
167054
|
}
|
|
167055
167055
|
|
|
167056
|
+
// packages/omo-opencode/src/cli/service.ts
|
|
167057
|
+
var exports_service = {};
|
|
167058
|
+
__export(exports_service, {
|
|
167059
|
+
serviceInstallCommand: () => serviceInstallCommand
|
|
167060
|
+
});
|
|
167061
|
+
import * as os15 from "os";
|
|
167062
|
+
import * as fs24 from "fs";
|
|
167063
|
+
import * as path29 from "path";
|
|
167064
|
+
import { execSync as execSync3 } from "child_process";
|
|
167065
|
+
function resolveMatrixosBin2() {
|
|
167066
|
+
try {
|
|
167067
|
+
const p2 = execSync3("command -v matrixos", { encoding: "utf-8" }).trim();
|
|
167068
|
+
if (p2)
|
|
167069
|
+
return p2;
|
|
167070
|
+
} catch {}
|
|
167071
|
+
for (const cand of ["/usr/local/bin/matrixos", "/usr/bin/matrixos", path29.join(os15.homedir(), ".bun/bin/matrixos")]) {
|
|
167072
|
+
if (fs24.existsSync(cand))
|
|
167073
|
+
return cand;
|
|
167074
|
+
}
|
|
167075
|
+
return "matrixos";
|
|
167076
|
+
}
|
|
167077
|
+
function resolveBunBin() {
|
|
167078
|
+
try {
|
|
167079
|
+
const p2 = execSync3("command -v bun", { encoding: "utf-8" }).trim();
|
|
167080
|
+
if (p2)
|
|
167081
|
+
return p2;
|
|
167082
|
+
} catch {}
|
|
167083
|
+
return "/usr/bin/bun";
|
|
167084
|
+
}
|
|
167085
|
+
function writeFileEnsureDir(filePath, content) {
|
|
167086
|
+
fs24.mkdirSync(path29.dirname(filePath), { recursive: true });
|
|
167087
|
+
fs24.writeFileSync(filePath, content, "utf-8");
|
|
167088
|
+
console.log(`[service] written: ${filePath}`);
|
|
167089
|
+
}
|
|
167090
|
+
function installSystemd(opts) {
|
|
167091
|
+
const bin = resolveMatrixosBin2();
|
|
167092
|
+
const bun = resolveBunBin();
|
|
167093
|
+
const scope = opts.user ? "--user" : "";
|
|
167094
|
+
const unitDir = opts.user ? path29.join(os15.homedir(), ".config", "systemd", "user") : "/etc/systemd/system";
|
|
167095
|
+
const envPath = `/usr/local/bin:/usr/bin:/bin:${path29.dirname(bun)}`;
|
|
167096
|
+
if (opts.dashboard !== false) {
|
|
167097
|
+
const unit = `[Unit]
|
|
167098
|
+
Description=MaTrixOS Dashboard
|
|
167099
|
+
After=network.target
|
|
167100
|
+
|
|
167101
|
+
[Service]
|
|
167102
|
+
Type=simple
|
|
167103
|
+
User=${os15.userInfo().username}
|
|
167104
|
+
WorkingDirectory=${os15.homedir()}
|
|
167105
|
+
Environment=PATH=${envPath}
|
|
167106
|
+
Environment=HOME=${os15.homedir()}
|
|
167107
|
+
ExecStart=${bin} dashboard --host 0.0.0.0 --daemon
|
|
167108
|
+
Restart=always
|
|
167109
|
+
RestartSec=5
|
|
167110
|
+
|
|
167111
|
+
[Install]
|
|
167112
|
+
WantedBy=${opts.user ? "default.target" : "multi-user.target"}
|
|
167113
|
+
`;
|
|
167114
|
+
writeFileEnsureDir(path29.join(unitDir, "matrixos-dashboard.service"), unit);
|
|
167115
|
+
}
|
|
167116
|
+
if (opts.gateway !== false) {
|
|
167117
|
+
const unit = `[Unit]
|
|
167118
|
+
Description=MaTrixOS Telegram Gateway
|
|
167119
|
+
After=network.target
|
|
167120
|
+
|
|
167121
|
+
[Service]
|
|
167122
|
+
Type=simple
|
|
167123
|
+
User=${os15.userInfo().username}
|
|
167124
|
+
WorkingDirectory=${os15.homedir()}
|
|
167125
|
+
Environment=PATH=${envPath}
|
|
167126
|
+
Environment=HOME=${os15.homedir()}
|
|
167127
|
+
ExecStart=${bin} gateway start --command "${bin} run"
|
|
167128
|
+
Restart=always
|
|
167129
|
+
RestartSec=5
|
|
167130
|
+
|
|
167131
|
+
[Install]
|
|
167132
|
+
WantedBy=${opts.user ? "default.target" : "multi-user.target"}
|
|
167133
|
+
`;
|
|
167134
|
+
writeFileEnsureDir(path29.join(unitDir, "matrixos-gateway.service"), unit);
|
|
167135
|
+
}
|
|
167136
|
+
console.log("[service] reloading systemd...");
|
|
167137
|
+
if (scope) {
|
|
167138
|
+
execSync3(`${scope} systemctl --user daemon-reload`, { stdio: "inherit" });
|
|
167139
|
+
if (opts.dashboard !== false)
|
|
167140
|
+
execSync3(`${scope} systemctl --user enable matrixos-dashboard.service`, { stdio: "inherit" });
|
|
167141
|
+
if (opts.gateway !== false)
|
|
167142
|
+
execSync3(`${scope} systemctl --user enable matrixos-gateway.service`, { stdio: "inherit" });
|
|
167143
|
+
if (opts.dashboard !== false)
|
|
167144
|
+
execSync3(`${scope} systemctl --user start matrixos-dashboard.service`, { stdio: "inherit" });
|
|
167145
|
+
if (opts.gateway !== false)
|
|
167146
|
+
execSync3(`${scope} systemctl --user start matrixos-gateway.service`, { stdio: "inherit" });
|
|
167147
|
+
} else {
|
|
167148
|
+
execSync3("systemctl daemon-reload", { stdio: "inherit" });
|
|
167149
|
+
if (opts.dashboard !== false)
|
|
167150
|
+
execSync3("systemctl enable matrixos-dashboard.service", { stdio: "inherit" });
|
|
167151
|
+
if (opts.gateway !== false)
|
|
167152
|
+
execSync3("systemctl enable matrixos-gateway.service", { stdio: "inherit" });
|
|
167153
|
+
if (opts.dashboard !== false)
|
|
167154
|
+
execSync3("systemctl start matrixos-dashboard.service", { stdio: "inherit" });
|
|
167155
|
+
if (opts.gateway !== false)
|
|
167156
|
+
execSync3("systemctl start matrixos-gateway.service", { stdio: "inherit" });
|
|
167157
|
+
}
|
|
167158
|
+
console.log("[service] systemd units installed and started.");
|
|
167159
|
+
}
|
|
167160
|
+
function installLaunchd(opts) {
|
|
167161
|
+
const bin = resolveMatrixosBin2();
|
|
167162
|
+
const bun = resolveBunBin();
|
|
167163
|
+
const launchDir = path29.join(os15.homedir(), "Library", "LaunchAgents");
|
|
167164
|
+
const envPath = `/usr/local/bin:/usr/bin:/bin:${path29.dirname(bun)}`;
|
|
167165
|
+
if (opts.dashboard !== false) {
|
|
167166
|
+
const label = "com.klc.matrixos.dashboard";
|
|
167167
|
+
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
167168
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
167169
|
+
<plist version="1.0">
|
|
167170
|
+
<dict>
|
|
167171
|
+
<key>Label</key>
|
|
167172
|
+
<string>${label}</string>
|
|
167173
|
+
<key>ProgramArguments</key>
|
|
167174
|
+
<array>
|
|
167175
|
+
<string>${bin}</string>
|
|
167176
|
+
<string>dashboard</string>
|
|
167177
|
+
<string>--host</string>
|
|
167178
|
+
<string>0.0.0.0</string>
|
|
167179
|
+
<string>--daemon</string>
|
|
167180
|
+
</array>
|
|
167181
|
+
<key>WorkingDirectory</key>
|
|
167182
|
+
<string>${os15.homedir()}</string>
|
|
167183
|
+
<key>EnvironmentVariables</key>
|
|
167184
|
+
<dict>
|
|
167185
|
+
<key>PATH</key>
|
|
167186
|
+
<string>${envPath}</string>
|
|
167187
|
+
<key>HOME</key>
|
|
167188
|
+
<string>${os15.homedir()}</string>
|
|
167189
|
+
</dict>
|
|
167190
|
+
<key>RunAtLoad</key>
|
|
167191
|
+
<true/>
|
|
167192
|
+
<key>KeepAlive</key>
|
|
167193
|
+
<true/>
|
|
167194
|
+
<key>StandardOutPath</key>
|
|
167195
|
+
<string>${os15.homedir()}/Library/Logs/matrixos-dashboard.log</string>
|
|
167196
|
+
<key>StandardErrorPath</key>
|
|
167197
|
+
<string>${os15.homedir()}/Library/Logs/matrixos-dashboard.log</string>
|
|
167198
|
+
</dict>
|
|
167199
|
+
</plist>
|
|
167200
|
+
`;
|
|
167201
|
+
writeFileEnsureDir(path29.join(launchDir, `${label}.plist`), plist);
|
|
167202
|
+
execSync3(`launchctl load ${path29.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
|
|
167203
|
+
}
|
|
167204
|
+
if (opts.gateway !== false) {
|
|
167205
|
+
const label = "com.klc.matrixos.gateway";
|
|
167206
|
+
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
167207
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
167208
|
+
<plist version="1.0">
|
|
167209
|
+
<dict>
|
|
167210
|
+
<key>Label</key>
|
|
167211
|
+
<string>${label}</string>
|
|
167212
|
+
<key>ProgramArguments</key>
|
|
167213
|
+
<array>
|
|
167214
|
+
<string>${bin}</string>
|
|
167215
|
+
<string>gateway</string>
|
|
167216
|
+
<string>start</string>
|
|
167217
|
+
<string>--command</string>
|
|
167218
|
+
<string>${bin} run</string>
|
|
167219
|
+
</array>
|
|
167220
|
+
<key>WorkingDirectory</key>
|
|
167221
|
+
<string>${os15.homedir()}</string>
|
|
167222
|
+
<key>EnvironmentVariables</key>
|
|
167223
|
+
<dict>
|
|
167224
|
+
<key>PATH</key>
|
|
167225
|
+
<string>${envPath}</string>
|
|
167226
|
+
<key>HOME</key>
|
|
167227
|
+
<string>${os15.homedir()}</string>
|
|
167228
|
+
</dict>
|
|
167229
|
+
<key>RunAtLoad</key>
|
|
167230
|
+
<true/>
|
|
167231
|
+
<key>KeepAlive</key>
|
|
167232
|
+
<true/>
|
|
167233
|
+
<key>StandardOutPath</key>
|
|
167234
|
+
<string>${os15.homedir()}/Library/Logs/matrixos-gateway.log</string>
|
|
167235
|
+
<key>StandardErrorPath</key>
|
|
167236
|
+
<string>${os15.homedir()}/Library/Logs/matrixos-gateway.log</string>
|
|
167237
|
+
</dict>
|
|
167238
|
+
</plist>
|
|
167239
|
+
`;
|
|
167240
|
+
writeFileEnsureDir(path29.join(launchDir, `${label}.plist`), plist);
|
|
167241
|
+
execSync3(`launchctl load ${path29.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
|
|
167242
|
+
}
|
|
167243
|
+
console.log("[service] launchd agents installed and loaded.");
|
|
167244
|
+
}
|
|
167245
|
+
function installWindowsNote() {
|
|
167246
|
+
console.log("[service] Windows: no auto-service installer yet.");
|
|
167247
|
+
console.log(" Use Task Scheduler to run `matrixos dashboard --host 0.0.0.0 --daemon`");
|
|
167248
|
+
console.log(' and `matrixos gateway start --command "matrixos run"` at logon.');
|
|
167249
|
+
console.log(" Or run them in the background via a startup script.");
|
|
167250
|
+
}
|
|
167251
|
+
async function serviceInstallCommand(options) {
|
|
167252
|
+
const platform2 = process.platform;
|
|
167253
|
+
console.log(`[service] detected platform: ${platform2}`);
|
|
167254
|
+
if (platform2 === "linux") {
|
|
167255
|
+
if (!fs24.existsSync("/run/systemd/system") && !fs24.existsSync("/etc/systemd/system")) {
|
|
167256
|
+
console.error("[service] systemd not detected \u2014 cannot install service automatically.");
|
|
167257
|
+
console.error(" Start manually: matrixos dashboard --host 0.0.0.0 --daemon");
|
|
167258
|
+
return 1;
|
|
167259
|
+
}
|
|
167260
|
+
installSystemd(options);
|
|
167261
|
+
return 0;
|
|
167262
|
+
}
|
|
167263
|
+
if (platform2 === "darwin") {
|
|
167264
|
+
installLaunchd(options);
|
|
167265
|
+
return 0;
|
|
167266
|
+
}
|
|
167267
|
+
if (platform2 === "win32") {
|
|
167268
|
+
installWindowsNote();
|
|
167269
|
+
return 0;
|
|
167270
|
+
}
|
|
167271
|
+
console.error(`[service] unsupported platform: ${platform2}`);
|
|
167272
|
+
return 1;
|
|
167273
|
+
}
|
|
167274
|
+
var init_service = () => {};
|
|
167275
|
+
|
|
167056
167276
|
// node_modules/.bun/commander@14.0.3/node_modules/commander/esm.mjs
|
|
167057
167277
|
var import__ = __toESM(require_commander(), 1);
|
|
167058
167278
|
var {
|
|
@@ -188224,6 +188444,23 @@ Examples:
|
|
|
188224
188444
|
process.stdout.write(result.stdout);
|
|
188225
188445
|
process.exit(result.exitCode);
|
|
188226
188446
|
});
|
|
188447
|
+
program2.command("service").description("Install MaTrixOS as a persistent OS service (dashboard + gateway)").argument("<action>", "install | uninstall").option("--no-dashboard", "Skip dashboard service").option("--no-gateway", "Skip gateway service").option("--user", "Install as current user (systemd --user / launchd user agent)").action(async (action, options) => {
|
|
188448
|
+
if (action !== "install" && action !== "uninstall") {
|
|
188449
|
+
console.error(`[service] unknown action: ${action}. Use 'install' or 'uninstall'.`);
|
|
188450
|
+
process.exit(1);
|
|
188451
|
+
}
|
|
188452
|
+
if (action === "uninstall") {
|
|
188453
|
+
console.log("[service] uninstall not yet implemented \u2014 remove units manually (systemctl disable / launchctl unload).");
|
|
188454
|
+
process.exit(0);
|
|
188455
|
+
}
|
|
188456
|
+
const { serviceInstallCommand: serviceInstallCommand2 } = await Promise.resolve().then(() => (init_service(), exports_service));
|
|
188457
|
+
const exitCode = await serviceInstallCommand2({
|
|
188458
|
+
dashboard: options.dashboard ?? true,
|
|
188459
|
+
gateway: options.gateway ?? true,
|
|
188460
|
+
user: options.user ?? false
|
|
188461
|
+
});
|
|
188462
|
+
process.exit(exitCode);
|
|
188463
|
+
});
|
|
188227
188464
|
|
|
188228
188465
|
// packages/omo-opencode/src/cli/index.ts
|
|
188229
188466
|
runCli();
|
package/dist/cli-node/index.js
CHANGED
|
@@ -2163,7 +2163,7 @@ var package_default;
|
|
|
2163
2163
|
var init_package = __esm(() => {
|
|
2164
2164
|
package_default = {
|
|
2165
2165
|
name: "@kl-c/matrixos",
|
|
2166
|
-
version: "0.3.
|
|
2166
|
+
version: "0.3.27",
|
|
2167
2167
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
2168
2168
|
main: "./dist/index.js",
|
|
2169
2169
|
types: "dist/index.d.ts",
|
|
@@ -167108,6 +167108,226 @@ function executeRgpdConsentCommand(args) {
|
|
|
167108
167108
|
}
|
|
167109
167109
|
}
|
|
167110
167110
|
|
|
167111
|
+
// packages/omo-opencode/src/cli/service.ts
|
|
167112
|
+
var exports_service = {};
|
|
167113
|
+
__export(exports_service, {
|
|
167114
|
+
serviceInstallCommand: () => serviceInstallCommand
|
|
167115
|
+
});
|
|
167116
|
+
import * as os15 from "os";
|
|
167117
|
+
import * as fs24 from "fs";
|
|
167118
|
+
import * as path29 from "path";
|
|
167119
|
+
import { execSync as execSync3 } from "child_process";
|
|
167120
|
+
function resolveMatrixosBin2() {
|
|
167121
|
+
try {
|
|
167122
|
+
const p2 = execSync3("command -v matrixos", { encoding: "utf-8" }).trim();
|
|
167123
|
+
if (p2)
|
|
167124
|
+
return p2;
|
|
167125
|
+
} catch {}
|
|
167126
|
+
for (const cand of ["/usr/local/bin/matrixos", "/usr/bin/matrixos", path29.join(os15.homedir(), ".bun/bin/matrixos")]) {
|
|
167127
|
+
if (fs24.existsSync(cand))
|
|
167128
|
+
return cand;
|
|
167129
|
+
}
|
|
167130
|
+
return "matrixos";
|
|
167131
|
+
}
|
|
167132
|
+
function resolveBunBin() {
|
|
167133
|
+
try {
|
|
167134
|
+
const p2 = execSync3("command -v bun", { encoding: "utf-8" }).trim();
|
|
167135
|
+
if (p2)
|
|
167136
|
+
return p2;
|
|
167137
|
+
} catch {}
|
|
167138
|
+
return "/usr/bin/bun";
|
|
167139
|
+
}
|
|
167140
|
+
function writeFileEnsureDir(filePath, content) {
|
|
167141
|
+
fs24.mkdirSync(path29.dirname(filePath), { recursive: true });
|
|
167142
|
+
fs24.writeFileSync(filePath, content, "utf-8");
|
|
167143
|
+
console.log(`[service] written: ${filePath}`);
|
|
167144
|
+
}
|
|
167145
|
+
function installSystemd(opts) {
|
|
167146
|
+
const bin = resolveMatrixosBin2();
|
|
167147
|
+
const bun = resolveBunBin();
|
|
167148
|
+
const scope = opts.user ? "--user" : "";
|
|
167149
|
+
const unitDir = opts.user ? path29.join(os15.homedir(), ".config", "systemd", "user") : "/etc/systemd/system";
|
|
167150
|
+
const envPath = `/usr/local/bin:/usr/bin:/bin:${path29.dirname(bun)}`;
|
|
167151
|
+
if (opts.dashboard !== false) {
|
|
167152
|
+
const unit = `[Unit]
|
|
167153
|
+
Description=MaTrixOS Dashboard
|
|
167154
|
+
After=network.target
|
|
167155
|
+
|
|
167156
|
+
[Service]
|
|
167157
|
+
Type=simple
|
|
167158
|
+
User=${os15.userInfo().username}
|
|
167159
|
+
WorkingDirectory=${os15.homedir()}
|
|
167160
|
+
Environment=PATH=${envPath}
|
|
167161
|
+
Environment=HOME=${os15.homedir()}
|
|
167162
|
+
ExecStart=${bin} dashboard --host 0.0.0.0 --daemon
|
|
167163
|
+
Restart=always
|
|
167164
|
+
RestartSec=5
|
|
167165
|
+
|
|
167166
|
+
[Install]
|
|
167167
|
+
WantedBy=${opts.user ? "default.target" : "multi-user.target"}
|
|
167168
|
+
`;
|
|
167169
|
+
writeFileEnsureDir(path29.join(unitDir, "matrixos-dashboard.service"), unit);
|
|
167170
|
+
}
|
|
167171
|
+
if (opts.gateway !== false) {
|
|
167172
|
+
const unit = `[Unit]
|
|
167173
|
+
Description=MaTrixOS Telegram Gateway
|
|
167174
|
+
After=network.target
|
|
167175
|
+
|
|
167176
|
+
[Service]
|
|
167177
|
+
Type=simple
|
|
167178
|
+
User=${os15.userInfo().username}
|
|
167179
|
+
WorkingDirectory=${os15.homedir()}
|
|
167180
|
+
Environment=PATH=${envPath}
|
|
167181
|
+
Environment=HOME=${os15.homedir()}
|
|
167182
|
+
ExecStart=${bin} gateway start --command "${bin} run"
|
|
167183
|
+
Restart=always
|
|
167184
|
+
RestartSec=5
|
|
167185
|
+
|
|
167186
|
+
[Install]
|
|
167187
|
+
WantedBy=${opts.user ? "default.target" : "multi-user.target"}
|
|
167188
|
+
`;
|
|
167189
|
+
writeFileEnsureDir(path29.join(unitDir, "matrixos-gateway.service"), unit);
|
|
167190
|
+
}
|
|
167191
|
+
console.log("[service] reloading systemd...");
|
|
167192
|
+
if (scope) {
|
|
167193
|
+
execSync3(`${scope} systemctl --user daemon-reload`, { stdio: "inherit" });
|
|
167194
|
+
if (opts.dashboard !== false)
|
|
167195
|
+
execSync3(`${scope} systemctl --user enable matrixos-dashboard.service`, { stdio: "inherit" });
|
|
167196
|
+
if (opts.gateway !== false)
|
|
167197
|
+
execSync3(`${scope} systemctl --user enable matrixos-gateway.service`, { stdio: "inherit" });
|
|
167198
|
+
if (opts.dashboard !== false)
|
|
167199
|
+
execSync3(`${scope} systemctl --user start matrixos-dashboard.service`, { stdio: "inherit" });
|
|
167200
|
+
if (opts.gateway !== false)
|
|
167201
|
+
execSync3(`${scope} systemctl --user start matrixos-gateway.service`, { stdio: "inherit" });
|
|
167202
|
+
} else {
|
|
167203
|
+
execSync3("systemctl daemon-reload", { stdio: "inherit" });
|
|
167204
|
+
if (opts.dashboard !== false)
|
|
167205
|
+
execSync3("systemctl enable matrixos-dashboard.service", { stdio: "inherit" });
|
|
167206
|
+
if (opts.gateway !== false)
|
|
167207
|
+
execSync3("systemctl enable matrixos-gateway.service", { stdio: "inherit" });
|
|
167208
|
+
if (opts.dashboard !== false)
|
|
167209
|
+
execSync3("systemctl start matrixos-dashboard.service", { stdio: "inherit" });
|
|
167210
|
+
if (opts.gateway !== false)
|
|
167211
|
+
execSync3("systemctl start matrixos-gateway.service", { stdio: "inherit" });
|
|
167212
|
+
}
|
|
167213
|
+
console.log("[service] systemd units installed and started.");
|
|
167214
|
+
}
|
|
167215
|
+
function installLaunchd(opts) {
|
|
167216
|
+
const bin = resolveMatrixosBin2();
|
|
167217
|
+
const bun = resolveBunBin();
|
|
167218
|
+
const launchDir = path29.join(os15.homedir(), "Library", "LaunchAgents");
|
|
167219
|
+
const envPath = `/usr/local/bin:/usr/bin:/bin:${path29.dirname(bun)}`;
|
|
167220
|
+
if (opts.dashboard !== false) {
|
|
167221
|
+
const label = "com.klc.matrixos.dashboard";
|
|
167222
|
+
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
167223
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
167224
|
+
<plist version="1.0">
|
|
167225
|
+
<dict>
|
|
167226
|
+
<key>Label</key>
|
|
167227
|
+
<string>${label}</string>
|
|
167228
|
+
<key>ProgramArguments</key>
|
|
167229
|
+
<array>
|
|
167230
|
+
<string>${bin}</string>
|
|
167231
|
+
<string>dashboard</string>
|
|
167232
|
+
<string>--host</string>
|
|
167233
|
+
<string>0.0.0.0</string>
|
|
167234
|
+
<string>--daemon</string>
|
|
167235
|
+
</array>
|
|
167236
|
+
<key>WorkingDirectory</key>
|
|
167237
|
+
<string>${os15.homedir()}</string>
|
|
167238
|
+
<key>EnvironmentVariables</key>
|
|
167239
|
+
<dict>
|
|
167240
|
+
<key>PATH</key>
|
|
167241
|
+
<string>${envPath}</string>
|
|
167242
|
+
<key>HOME</key>
|
|
167243
|
+
<string>${os15.homedir()}</string>
|
|
167244
|
+
</dict>
|
|
167245
|
+
<key>RunAtLoad</key>
|
|
167246
|
+
<true/>
|
|
167247
|
+
<key>KeepAlive</key>
|
|
167248
|
+
<true/>
|
|
167249
|
+
<key>StandardOutPath</key>
|
|
167250
|
+
<string>${os15.homedir()}/Library/Logs/matrixos-dashboard.log</string>
|
|
167251
|
+
<key>StandardErrorPath</key>
|
|
167252
|
+
<string>${os15.homedir()}/Library/Logs/matrixos-dashboard.log</string>
|
|
167253
|
+
</dict>
|
|
167254
|
+
</plist>
|
|
167255
|
+
`;
|
|
167256
|
+
writeFileEnsureDir(path29.join(launchDir, `${label}.plist`), plist);
|
|
167257
|
+
execSync3(`launchctl load ${path29.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
|
|
167258
|
+
}
|
|
167259
|
+
if (opts.gateway !== false) {
|
|
167260
|
+
const label = "com.klc.matrixos.gateway";
|
|
167261
|
+
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
167262
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
167263
|
+
<plist version="1.0">
|
|
167264
|
+
<dict>
|
|
167265
|
+
<key>Label</key>
|
|
167266
|
+
<string>${label}</string>
|
|
167267
|
+
<key>ProgramArguments</key>
|
|
167268
|
+
<array>
|
|
167269
|
+
<string>${bin}</string>
|
|
167270
|
+
<string>gateway</string>
|
|
167271
|
+
<string>start</string>
|
|
167272
|
+
<string>--command</string>
|
|
167273
|
+
<string>${bin} run</string>
|
|
167274
|
+
</array>
|
|
167275
|
+
<key>WorkingDirectory</key>
|
|
167276
|
+
<string>${os15.homedir()}</string>
|
|
167277
|
+
<key>EnvironmentVariables</key>
|
|
167278
|
+
<dict>
|
|
167279
|
+
<key>PATH</key>
|
|
167280
|
+
<string>${envPath}</string>
|
|
167281
|
+
<key>HOME</key>
|
|
167282
|
+
<string>${os15.homedir()}</string>
|
|
167283
|
+
</dict>
|
|
167284
|
+
<key>RunAtLoad</key>
|
|
167285
|
+
<true/>
|
|
167286
|
+
<key>KeepAlive</key>
|
|
167287
|
+
<true/>
|
|
167288
|
+
<key>StandardOutPath</key>
|
|
167289
|
+
<string>${os15.homedir()}/Library/Logs/matrixos-gateway.log</string>
|
|
167290
|
+
<key>StandardErrorPath</key>
|
|
167291
|
+
<string>${os15.homedir()}/Library/Logs/matrixos-gateway.log</string>
|
|
167292
|
+
</dict>
|
|
167293
|
+
</plist>
|
|
167294
|
+
`;
|
|
167295
|
+
writeFileEnsureDir(path29.join(launchDir, `${label}.plist`), plist);
|
|
167296
|
+
execSync3(`launchctl load ${path29.join(launchDir, `${label}.plist`)}`, { stdio: "inherit" });
|
|
167297
|
+
}
|
|
167298
|
+
console.log("[service] launchd agents installed and loaded.");
|
|
167299
|
+
}
|
|
167300
|
+
function installWindowsNote() {
|
|
167301
|
+
console.log("[service] Windows: no auto-service installer yet.");
|
|
167302
|
+
console.log(" Use Task Scheduler to run `matrixos dashboard --host 0.0.0.0 --daemon`");
|
|
167303
|
+
console.log(' and `matrixos gateway start --command "matrixos run"` at logon.');
|
|
167304
|
+
console.log(" Or run them in the background via a startup script.");
|
|
167305
|
+
}
|
|
167306
|
+
async function serviceInstallCommand(options) {
|
|
167307
|
+
const platform2 = process.platform;
|
|
167308
|
+
console.log(`[service] detected platform: ${platform2}`);
|
|
167309
|
+
if (platform2 === "linux") {
|
|
167310
|
+
if (!fs24.existsSync("/run/systemd/system") && !fs24.existsSync("/etc/systemd/system")) {
|
|
167311
|
+
console.error("[service] systemd not detected \u2014 cannot install service automatically.");
|
|
167312
|
+
console.error(" Start manually: matrixos dashboard --host 0.0.0.0 --daemon");
|
|
167313
|
+
return 1;
|
|
167314
|
+
}
|
|
167315
|
+
installSystemd(options);
|
|
167316
|
+
return 0;
|
|
167317
|
+
}
|
|
167318
|
+
if (platform2 === "darwin") {
|
|
167319
|
+
installLaunchd(options);
|
|
167320
|
+
return 0;
|
|
167321
|
+
}
|
|
167322
|
+
if (platform2 === "win32") {
|
|
167323
|
+
installWindowsNote();
|
|
167324
|
+
return 0;
|
|
167325
|
+
}
|
|
167326
|
+
console.error(`[service] unsupported platform: ${platform2}`);
|
|
167327
|
+
return 1;
|
|
167328
|
+
}
|
|
167329
|
+
var init_service = () => {};
|
|
167330
|
+
|
|
167111
167331
|
// node_modules/.bun/commander@14.0.3/node_modules/commander/esm.mjs
|
|
167112
167332
|
var import__ = __toESM(require_commander(), 1);
|
|
167113
167333
|
var {
|
|
@@ -188279,6 +188499,23 @@ Examples:
|
|
|
188279
188499
|
process.stdout.write(result.stdout);
|
|
188280
188500
|
process.exit(result.exitCode);
|
|
188281
188501
|
});
|
|
188502
|
+
program2.command("service").description("Install MaTrixOS as a persistent OS service (dashboard + gateway)").argument("<action>", "install | uninstall").option("--no-dashboard", "Skip dashboard service").option("--no-gateway", "Skip gateway service").option("--user", "Install as current user (systemd --user / launchd user agent)").action(async (action, options) => {
|
|
188503
|
+
if (action !== "install" && action !== "uninstall") {
|
|
188504
|
+
console.error(`[service] unknown action: ${action}. Use 'install' or 'uninstall'.`);
|
|
188505
|
+
process.exit(1);
|
|
188506
|
+
}
|
|
188507
|
+
if (action === "uninstall") {
|
|
188508
|
+
console.log("[service] uninstall not yet implemented \u2014 remove units manually (systemctl disable / launchctl unload).");
|
|
188509
|
+
process.exit(0);
|
|
188510
|
+
}
|
|
188511
|
+
const { serviceInstallCommand: serviceInstallCommand2 } = await Promise.resolve().then(() => (init_service(), exports_service));
|
|
188512
|
+
const exitCode = await serviceInstallCommand2({
|
|
188513
|
+
dashboard: options.dashboard ?? true,
|
|
188514
|
+
gateway: options.gateway ?? true,
|
|
188515
|
+
user: options.user ?? false
|
|
188516
|
+
});
|
|
188517
|
+
process.exit(exitCode);
|
|
188518
|
+
});
|
|
188282
188519
|
|
|
188283
188520
|
// packages/omo-opencode/src/cli/index.ts
|
|
188284
188521
|
runCli();
|
package/dist/index.js
CHANGED
|
@@ -368019,7 +368019,7 @@ function getCachedVersion(options = {}) {
|
|
|
368019
368019
|
// package.json
|
|
368020
368020
|
var package_default = {
|
|
368021
368021
|
name: "@kl-c/matrixos",
|
|
368022
|
-
version: "0.3.
|
|
368022
|
+
version: "0.3.27",
|
|
368023
368023
|
description: "MaTrixOS \u2014 Agentic OS for OpenCode. Personalizable, communicating, self-improving, resilient.",
|
|
368024
368024
|
main: "./dist/index.js",
|
|
368025
368025
|
types: "dist/index.d.ts",
|
package/package.json
CHANGED